From: Andrea Bianco Date: Tue, 23 Jul 2019 17:35:04 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.1.0 X-Git-Tag: 2.2.0~1 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=41778671748d4287cf596f582ac642ec344a9b0d;p=motion2.git Built motion from commit (unavailable).|2.1.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 299d84b..668e49e 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.1.0", "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-23T17:20:21.859Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); +define({ "name": "xCALLY Motion API", "version": "2.1.0", "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-23T17:29:14.313Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index b1f5d09..dfb8e99 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.1.0", "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-23T17:20:21.859Z", "url": "http://apidocjs.com", "version": "0.17.7" } } +{ "name": "xCALLY Motion API", "version": "2.1.0", "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-23T17:29:14.313Z", "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 d50a4e0..33edf38 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 _0x032e=['browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','STRING','contactManager','integration','motionbar','jscripty','urlForward'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x032e,0x124));var _0xe032=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x032e[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'name':{'type':Sequelize[_0xe032('0x1')],'get':function(_0x1cf95c){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0xe032('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe032('0x3'),_0xe032('0x4'),_0xe032('0x5'),_0xe032('0x6'),_0xe032('0x7'),_0xe032('0x8'),_0xe032('0x9')]],'msg':_0xe032('0xa')}},'comment':_0xe032('0xa')},'data1':{'type':Sequelize[_0xe032('0x2')](0x1000),'comment':_0xe032('0xb')},'data2':{'type':Sequelize[_0xe032('0x2')](0x1000),'comment':_0xe032('0xc')},'data3':{'type':Sequelize[_0xe032('0x2')](0x1000),'comment':_0xe032('0xd')},'data4':{'type':Sequelize[_0xe032('0x2')](0x1000)},'data5':{'type':Sequelize[_0xe032('0x2')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0xe032('0xe')]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fc3,0xa8));var _0x35fc=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0x5fc3[_0x34df4a];return _0x145c69;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x253d6e){return this[_0x35fc('0x2')](_0x35fc('0x3'));}},'action':{'type':Sequelize[_0x35fc('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x35fc('0x5'),'integration',_0x35fc('0x6'),_0x35fc('0x7'),_0x35fc('0x8'),'browser','bot']],'msg':_0x35fc('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot'},'data1':{'type':Sequelize[_0x35fc('0x4')](0x1000),'comment':_0x35fc('0xa')},'data2':{'type':Sequelize[_0x35fc('0x4')](0x1000),'comment':_0x35fc('0xb')},'data3':{'type':Sequelize[_0x35fc('0x4')](0x1000),'comment':_0x35fc('0xc')},'data4':{'type':Sequelize[_0x35fc('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x35fc('0x4')]},'data7':{'type':Sequelize[_0x35fc('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1c942e8..650ce2a 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 _0xdba7=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','send','body','Action','find','catch','params','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv'];(function(_0xf07ad1,_0xb05867){var _0x1075f2=function(_0x4546fe){while(--_0x4546fe){_0xf07ad1['push'](_0xf07ad1['shift']());}};_0x1075f2(++_0xb05867);}(_0xdba7,0x125));var _0x7dba=function(_0xb391ba,_0x5968ca){_0xb391ba=_0xb391ba-0x0;var _0x4213e8=_0xdba7[_0xb391ba];return _0x4213e8;};'use strict';var pdf=require(_0x7dba('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7dba('0x1'));var jsonpatch=require(_0x7dba('0x2'));var rp=require(_0x7dba('0x3'));var moment=require('moment');var BPromise=require(_0x7dba('0x4'));var Mustache=require(_0x7dba('0x5'));var util=require(_0x7dba('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7dba('0x7'));var ejs=require(_0x7dba('0x8'));var fs=require('fs');var _=require(_0x7dba('0x9'));var squel=require(_0x7dba('0xa'));var crypto=require(_0x7dba('0xb'));var jsforce=require(_0x7dba('0xc'));var deskjs=require(_0x7dba('0xd'));var toCsv=require(_0x7dba('0x7'));var querystring=require(_0x7dba('0xe'));var Papa=require(_0x7dba('0xf'));var Redis=require(_0x7dba('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x7dba('0x11'))(_0x7dba('0x12'));var utils=require(_0x7dba('0x13'));var config=require(_0x7dba('0x14'));var db=require(_0x7dba('0x15'))['db'];function respondWithStatusCode(_0x43c77e,_0x1de1e3){_0x1de1e3=_0x1de1e3||0xcc;return function(_0x378bec){if(_0x378bec){return _0x43c77e[_0x7dba('0x16')](_0x1de1e3);}return _0x43c77e[_0x7dba('0x17')](_0x1de1e3)[_0x7dba('0x18')]();};}function respondWithResult(_0x17d431,_0x5b9534){_0x5b9534=_0x5b9534||0xc8;return function(_0xff1440){if(_0xff1440){return _0x17d431[_0x7dba('0x17')](_0x5b9534)[_0x7dba('0x19')](_0xff1440);}};}function respondWithFilteredResult(_0x56ebe4,_0x442b92){return function(_0x35736b){if(_0x35736b){var _0x521585=_0x35736b[_0x7dba('0x1a')],_0x13e7d0=_0x442b92[_0x7dba('0x1b')],_0x1da758=_0x442b92[_0x7dba('0x1b')]+_0x442b92[_0x7dba('0x1c')],_0x28a92b;if(_0x1da758>=_0x521585){_0x1da758=_0x521585;_0x28a92b=0xc8;}else{_0x28a92b=0xce;}_0x56ebe4[_0x7dba('0x17')](_0x28a92b);return _0x56ebe4[_0x7dba('0x1d')](_0x7dba('0x1e'),_0x13e7d0+'-'+_0x1da758+'/'+_0x521585)[_0x7dba('0x19')](_0x35736b);}return null;};}function patchUpdates(_0x8183fd){return function(_0x10914f){try{jsonpatch[_0x7dba('0x1f')](_0x10914f,_0x8183fd,!![]);}catch(_0xb58297){return BPromise[_0x7dba('0x20')](_0xb58297);}return _0x10914f['save']();};}function saveUpdates(_0x35e587,_0x2d3a9e){return function(_0x16f3a2){if(_0x16f3a2){return _0x16f3a2[_0x7dba('0x21')](_0x35e587)[_0x7dba('0x22')](function(_0xf6b888){return _0xf6b888;});}return null;};}function removeEntity(_0x32449c,_0x5a7a3c){return function(_0x3e7f96){if(_0x3e7f96){return _0x3e7f96[_0x7dba('0x23')]()[_0x7dba('0x22')](function(){_0x32449c[_0x7dba('0x17')](0xcc)[_0x7dba('0x18')]();});}};}function handleEntityNotFound(_0x28536d,_0x50f870){return function(_0x6cae2d){if(!_0x6cae2d){_0x28536d[_0x7dba('0x16')](0x194);}return _0x6cae2d;};}function handleError(_0x228cb8,_0x34f964){_0x34f964=_0x34f964||0x1f4;return function(_0x45b3e3){logger['error'](_0x45b3e3['stack']);if(_0x45b3e3[_0x7dba('0x24')]){delete _0x45b3e3[_0x7dba('0x24')];}_0x228cb8['status'](_0x34f964)[_0x7dba('0x25')](_0x45b3e3);};}exports[_0x7dba('0x21')]=function(_0x45d9a9,_0x2b848d){if(_0x45d9a9[_0x7dba('0x26')]['id']){delete _0x45d9a9[_0x7dba('0x26')]['id'];}return db[_0x7dba('0x27')][_0x7dba('0x28')]({'where':{'id':_0x45d9a9['params']['id']}})['then'](handleEntityNotFound(_0x2b848d,null))[_0x7dba('0x22')](saveUpdates(_0x45d9a9['body'],null))[_0x7dba('0x22')](respondWithResult(_0x2b848d,null))[_0x7dba('0x29')](handleError(_0x2b848d,null));};exports[_0x7dba('0x23')]=function(_0x3ff887,_0x368b2b){return db['Action'][_0x7dba('0x28')]({'where':{'id':_0x3ff887[_0x7dba('0x2a')]['id']}})[_0x7dba('0x22')](handleEntityNotFound(_0x368b2b,null))[_0x7dba('0x22')](removeEntity(_0x368b2b,null))[_0x7dba('0x29')](handleError(_0x368b2b,null));}; \ No newline at end of file +var _0x6a7a=['end','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','body','Action','find','params','catch','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x4e9a47,_0x275288){var _0x5865e3=function(_0x2934b0){while(--_0x2934b0){_0x4e9a47['push'](_0x4e9a47['shift']());}};_0x5865e3(++_0x275288);}(_0x6a7a,0x1ad));var _0xa6a7=function(_0x2ce872,_0x10ec32){_0x2ce872=_0x2ce872-0x0;var _0x7cd744=_0x6a7a[_0x2ce872];return _0x7cd744;};'use strict';var pdf=require(_0xa6a7('0x0'));var emlformat=require(_0xa6a7('0x1'));var rimraf=require(_0xa6a7('0x2'));var zipdir=require(_0xa6a7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6a7('0x4'));var moment=require(_0xa6a7('0x5'));var BPromise=require(_0xa6a7('0x6'));var Mustache=require('mustache');var util=require(_0xa6a7('0x7'));var path=require(_0xa6a7('0x8'));var sox=require(_0xa6a7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa6a7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa6a7('0xb'));var deskjs=require(_0xa6a7('0xc'));var toCsv=require(_0xa6a7('0xd'));var querystring=require(_0xa6a7('0xe'));var Papa=require(_0xa6a7('0xf'));var Redis=require(_0xa6a7('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa6a7('0x11'));var utils=require(_0xa6a7('0x12'));var config=require(_0xa6a7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x65e2ca,_0x7ae551){_0x7ae551=_0x7ae551||0xcc;return function(_0x25d182){if(_0x25d182){return _0x65e2ca[_0xa6a7('0x14')](_0x7ae551);}return _0x65e2ca[_0xa6a7('0x15')](_0x7ae551)[_0xa6a7('0x16')]();};}function respondWithResult(_0x26f733,_0x4d87b4){_0x4d87b4=_0x4d87b4||0xc8;return function(_0x39d676){if(_0x39d676){return _0x26f733[_0xa6a7('0x15')](_0x4d87b4)[_0xa6a7('0x17')](_0x39d676);}};}function respondWithFilteredResult(_0x286e82,_0x3d1dd3){return function(_0x27dddf){if(_0x27dddf){var _0xfb22f2=_0x27dddf[_0xa6a7('0x18')],_0x4775e5=_0x3d1dd3[_0xa6a7('0x19')],_0x3da7f8=_0x3d1dd3[_0xa6a7('0x19')]+_0x3d1dd3['limit'],_0xe650f;if(_0x3da7f8>=_0xfb22f2){_0x3da7f8=_0xfb22f2;_0xe650f=0xc8;}else{_0xe650f=0xce;}_0x286e82[_0xa6a7('0x15')](_0xe650f);return _0x286e82[_0xa6a7('0x1a')](_0xa6a7('0x1b'),_0x4775e5+'-'+_0x3da7f8+'/'+_0xfb22f2)[_0xa6a7('0x17')](_0x27dddf);}return null;};}function patchUpdates(_0x25586a){return function(_0x5b14d9){try{jsonpatch[_0xa6a7('0x1c')](_0x5b14d9,_0x25586a,!![]);}catch(_0x32e209){return BPromise['reject'](_0x32e209);}return _0x5b14d9[_0xa6a7('0x1d')]();};}function saveUpdates(_0x18e7df,_0x36065c){return function(_0x5aa860){if(_0x5aa860){return _0x5aa860[_0xa6a7('0x1e')](_0x18e7df)[_0xa6a7('0x1f')](function(_0x3bfb98){return _0x3bfb98;});}return null;};}function removeEntity(_0x16cd4d,_0xd829c7){return function(_0x164b3d){if(_0x164b3d){return _0x164b3d['destroy']()[_0xa6a7('0x1f')](function(){_0x16cd4d[_0xa6a7('0x15')](0xcc)[_0xa6a7('0x16')]();});}};}function handleEntityNotFound(_0x59cb00,_0x511438){return function(_0x37e684){if(!_0x37e684){_0x59cb00[_0xa6a7('0x14')](0x194);}return _0x37e684;};}function handleError(_0xf24e5f,_0x54a20a){_0x54a20a=_0x54a20a||0x1f4;return function(_0x2b99db){logger[_0xa6a7('0x20')](_0x2b99db[_0xa6a7('0x21')]);if(_0x2b99db[_0xa6a7('0x22')]){delete _0x2b99db[_0xa6a7('0x22')];}_0xf24e5f[_0xa6a7('0x15')](_0x54a20a)['send'](_0x2b99db);};}exports['update']=function(_0x17c2c9,_0x1bbfe2){if(_0x17c2c9[_0xa6a7('0x23')]['id']){delete _0x17c2c9[_0xa6a7('0x23')]['id'];}return db[_0xa6a7('0x24')][_0xa6a7('0x25')]({'where':{'id':_0x17c2c9[_0xa6a7('0x26')]['id']}})[_0xa6a7('0x1f')](handleEntityNotFound(_0x1bbfe2,null))[_0xa6a7('0x1f')](saveUpdates(_0x17c2c9[_0xa6a7('0x23')],null))[_0xa6a7('0x1f')](respondWithResult(_0x1bbfe2,null))[_0xa6a7('0x27')](handleError(_0x1bbfe2,null));};exports[_0xa6a7('0x28')]=function(_0x46068e,_0x170cc0){return db['Action'][_0xa6a7('0x25')]({'where':{'id':_0x46068e[_0xa6a7('0x26')]['id']}})[_0xa6a7('0x1f')](handleEntityNotFound(_0x170cc0,null))[_0xa6a7('0x1f')](removeEntity(_0x170cc0,null))[_0xa6a7('0x27')](handleError(_0x170cc0,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 999fe5e..81a908c 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 _0x67c1=['./action.attributes','Action','tools_actions','lodash','api','bluebird'];(function(_0x169264,_0x12e914){var _0x193a10=function(_0x22cb58){while(--_0x22cb58){_0x169264['push'](_0x169264['shift']());}};_0x193a10(++_0x12e914);}(_0x67c1,0x8d));var _0x167c=function(_0x6b910b,_0x38ce8f){_0x6b910b=_0x6b910b-0x0;var _0x3408a7=_0x67c1[_0x6b910b];return _0x3408a7;};'use strict';var _=require(_0x167c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x167c('0x1'));var moment=require('moment');var BPromise=require(_0x167c('0x2'));var rp=require('request-promise');var attributes=require(_0x167c('0x3'));module['exports']=function(_0x17306b,_0x44cf50){return _0x17306b['define'](_0x167c('0x4'),attributes,{'tableName':_0x167c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x503b=['api','moment','bluebird','define','Action','lodash'];(function(_0x59b69a,_0x3f0213){var _0x20d7f8=function(_0x51f066){while(--_0x51f066){_0x59b69a['push'](_0x59b69a['shift']());}};_0x20d7f8(++_0x3f0213);}(_0x503b,0x179));var _0xb503=function(_0x2ff061,_0x4d3335){_0x2ff061=_0x2ff061-0x0;var _0xb9b05c=_0x503b[_0x2ff061];return _0xb9b05c;};'use strict';var _=require(_0xb503('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb503('0x1'));var moment=require(_0xb503('0x2'));var BPromise=require(_0xb503('0x3'));var rp=require('request-promise');var attributes=require('./action.attributes');module['exports']=function(_0x566a07,_0x29a989){return _0x566a07[_0xb503('0x4')](_0xb503('0x5'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 3839afa..ddc869a 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 _0xa5ca=['request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','Action,\x20%s,\x20%s'];(function(_0x5a633a,_0x4e8830){var _0x4a9df=function(_0x1a6732){while(--_0x1a6732){_0x5a633a['push'](_0x5a633a['shift']());}};_0x4a9df(++_0x4e8830);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xa5ca[_0x31eb67];return _0x2a8cb8;};'use strict';var _=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var moment=require(_0xaa5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa5c('0x3'));var db=require(_0xaa5c('0x4'))['db'];var utils=require(_0xaa5c('0x5'));var logger=require(_0xaa5c('0x6'))(_0xaa5c('0x7'));var config=require(_0xaa5c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41b86b,_0x10bee5,_0x283bc5){return new BPromise(function(_0x5b39a7,_0x496243){return client[_0xaa5c('0x9')](_0x41b86b,_0x283bc5)[_0xaa5c('0xa')](function(_0x170d3b){logger['info'](_0xaa5c('0xb'),_0x10bee5,_0xaa5c('0xc'));logger[_0xaa5c('0xd')](_0xaa5c('0xe'),_0x10bee5,_0xaa5c('0xc'),JSON[_0xaa5c('0xf')](_0x170d3b));if(_0x170d3b[_0xaa5c('0x10')]){if(_0x170d3b[_0xaa5c('0x10')][_0xaa5c('0x11')]===0x1f4){logger[_0xaa5c('0x10')](_0xaa5c('0xb'),_0x10bee5,_0x170d3b[_0xaa5c('0x10')][_0xaa5c('0x12')]);return _0x496243(_0x170d3b['error'][_0xaa5c('0x12')]);}logger['error']('Action,\x20%s,\x20%s',_0x10bee5,_0x170d3b['error'][_0xaa5c('0x12')]);return _0x5b39a7(_0x170d3b[_0xaa5c('0x10')][_0xaa5c('0x12')]);}else{logger['info'](_0xaa5c('0xb'),_0x10bee5,_0xaa5c('0xc'));_0x5b39a7(_0x170d3b[_0xaa5c('0x13')][_0xaa5c('0x12')]);}})[_0xaa5c('0x14')](function(_0x272d06){logger['error']('Action,\x20%s,\x20%s',_0x10bee5,_0x272d06);_0x496243(_0x272d06);});});} \ No newline at end of file +var _0xb377=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x39430e,_0x58ee31){var _0x4bd34c=function(_0x2e4e7e){while(--_0x2e4e7e){_0x39430e['push'](_0x39430e['shift']());}};_0x4bd34c(++_0x58ee31);}(_0xb377,0x1b6));var _0x7b37=function(_0x36e472,_0x340be0){_0x36e472=_0x36e472-0x0;var _0x12292a=_0xb377[_0x36e472];return _0x12292a;};'use strict';var _=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var moment=require(_0x7b37('0x2'));var BPromise=require(_0x7b37('0x3'));var rs=require(_0x7b37('0x4'));var fs=require('fs');var Redis=require(_0x7b37('0x5'));var db=require(_0x7b37('0x6'))['db'];var utils=require(_0x7b37('0x7'));var logger=require(_0x7b37('0x8'))(_0x7b37('0x9'));var config=require(_0x7b37('0xa'));var jayson=require(_0x7b37('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x409d34,_0x4cb89b,_0x5afdb8){return new BPromise(function(_0x3de992,_0x3df40f){return client[_0x7b37('0xc')](_0x409d34,_0x5afdb8)[_0x7b37('0xd')](function(_0x1d435b){logger[_0x7b37('0xe')](_0x7b37('0xf'),_0x4cb89b,_0x7b37('0x10'));logger['debug'](_0x7b37('0x11'),_0x4cb89b,_0x7b37('0x10'),JSON['stringify'](_0x1d435b));if(_0x1d435b['error']){if(_0x1d435b[_0x7b37('0x12')][_0x7b37('0x13')]===0x1f4){logger[_0x7b37('0x12')](_0x7b37('0xf'),_0x4cb89b,_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);return _0x3df40f(_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);}logger[_0x7b37('0x12')](_0x7b37('0xf'),_0x4cb89b,_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);return _0x3de992(_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);}else{logger[_0x7b37('0xe')](_0x7b37('0xf'),_0x4cb89b,_0x7b37('0x10'));_0x3de992(_0x1d435b['result']['message']);}})[_0x7b37('0x15')](function(_0x5b06f9){logger['error'](_0x7b37('0xf'),_0x4cb89b,_0x5b06f9);_0x3df40f(_0x5b06f9);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 028a715..3e8772a 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 _0x6f2f=['Router','../../config/environment','./action.controller','put','update','delete','/:id','isAuthenticated','destroy','exports','multer','util'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x6f2f[_0x4b73a2];return _0x383c66;};'use strict';var multer=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf6f2('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf6f2('0x3'));var controller=require(_0xf6f2('0x4'));router[_0xf6f2('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xf6f2('0x6')]);router[_0xf6f2('0x7')](_0xf6f2('0x8'),auth[_0xf6f2('0x9')](),controller[_0xf6f2('0xa')]);module[_0xf6f2('0xb')]=router; \ No newline at end of file +var _0xefda=['./action.controller','put','/:id','update','delete','isAuthenticated','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc3fe56,_0x5520e2){var _0x3d5f79=function(_0x3cd592){while(--_0x3cd592){_0xc3fe56['push'](_0xc3fe56['shift']());}};_0x3d5f79(++_0x5520e2);}(_0xefda,0x96));var _0xaefd=function(_0x5ec78c,_0x22adfa){_0x5ec78c=_0x5ec78c-0x0;var _0x4b951b=_0xefda[_0x5ec78c];return _0x4b951b;};'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')](_0xaefd('0x8'),auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0xa')](_0xaefd('0x8'),auth[_0xaefd('0xb')](),controller['destroy']);module[_0xaefd('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 2e4fa8d..60c6f2d 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 _0xad06=['STRING','TEXT','sequelize','exports'];(function(_0x3accdb,_0x187888){var _0x4dab57=function(_0x2ac22b){while(--_0x2ac22b){_0x3accdb['push'](_0x3accdb['shift']());}};_0x4dab57(++_0x187888);}(_0xad06,0x1ce));var _0x6ad0=function(_0x351c5c,_0x2d76c5){_0x351c5c=_0x351c5c-0x0;var _0x39bfcc=_0xad06[_0x351c5c];return _0x39bfcc;};'use strict';var Sequelize=require(_0x6ad0('0x0'));module[_0x6ad0('0x1')]={'name':{'type':Sequelize[_0x6ad0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6ad0('0x2')]},'parent':{'type':Sequelize[_0x6ad0('0x2')]},'table':{'type':Sequelize[_0x6ad0('0x2')]},'conditions':{'type':Sequelize[_0x6ad0('0x3')]},'joins':{'type':Sequelize[_0x6ad0('0x3')]}}; \ No newline at end of file +var _0x51bc=['exports','STRING','TEXT','sequelize'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x51bc,0x10b));var _0xc51b=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x51bc[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0xc51b('0x0'));module[_0xc51b('0x1')]={'name':{'type':Sequelize[_0xc51b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc51b('0x2')]},'parent':{'type':Sequelize[_0xc51b('0x2')]},'table':{'type':Sequelize[_0xc51b('0x2')]},'conditions':{'type':Sequelize[_0xc51b('0x3')]},'joins':{'type':Sequelize[_0xc51b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0fd871c..15c07f5 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 _0x8439=['api','../../config/utils','end','json','offset','set','apply','save','get','CustomReports','UserProfileResource','destroy','then','error','stack','status','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','add','day','map','merge','options','count','includeAll','AnalyticCustomReport','findAll','rows','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','name','catch','update','body','left_join','outer_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','field','condition','getFields','Sequelize','ValidationErrorItem','select','table','MetricId','metric','function','replace','format','group','order','DESC','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','right_join','cross_join','SUM(%s)','HOUR(%s)','value','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','groupBy','orderBy','foreignKey','No\x20available\x20data','web','%s-%s.%s','randomstring','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','../../components/export/','output','../../files/reports','countTable','COUNT(*)','run','IS\x20NOT\x20NULL','AnalyticMetric','debug','html-pdf','zip-dir','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x393500,_0x1037af){var _0x120d3b=function(_0x17234e){while(--_0x17234e){_0x393500['push'](_0x393500['shift']());}};_0x120d3b(++_0x1037af);}(_0x8439,0x125));var _0x9843=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x8439[_0x31ced5];return _0x10d9e5;};'use strict';var pdf=require(_0x9843('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9843('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9843('0x2'));var Mustache=require('mustache');var util=require(_0x9843('0x3'));var path=require(_0x9843('0x4'));var sox=require(_0x9843('0x5'));var csv=require(_0x9843('0x6'));var ejs=require(_0x9843('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9843('0x8'));var crypto=require(_0x9843('0x9'));var jsforce=require(_0x9843('0xa'));var deskjs=require(_0x9843('0xb'));var toCsv=require(_0x9843('0x6'));var querystring=require(_0x9843('0xc'));var Papa=require(_0x9843('0xd'));var Redis=require(_0x9843('0xe'));var qs=require(_0x9843('0xf'));var logger=require(_0x9843('0x10'))(_0x9843('0x11'));var utils=require(_0x9843('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9f0c6d,_0x38f295){_0x38f295=_0x38f295||0xcc;return function(_0x2e64c4){if(_0x2e64c4){return _0x9f0c6d['sendStatus'](_0x38f295);}return _0x9f0c6d['status'](_0x38f295)[_0x9843('0x13')]();};}function respondWithResult(_0x344b26,_0x1f74bd){_0x1f74bd=_0x1f74bd||0xc8;return function(_0x16fa36){if(_0x16fa36){return _0x344b26['status'](_0x1f74bd)[_0x9843('0x14')](_0x16fa36);}};}function respondWithFilteredResult(_0x323128,_0x2423d7){return function(_0x40b1d2){if(_0x40b1d2){var _0x2693f7=_0x40b1d2['count'],_0x3e0fd8=_0x2423d7[_0x9843('0x15')],_0x5eb324=_0x2423d7[_0x9843('0x15')]+_0x2423d7['limit'],_0x15cd2b;if(_0x5eb324>=_0x2693f7){_0x5eb324=_0x2693f7;_0x15cd2b=0xc8;}else{_0x15cd2b=0xce;}_0x323128['status'](_0x15cd2b);return _0x323128[_0x9843('0x16')]('Content-Range',_0x3e0fd8+'-'+_0x5eb324+'/'+_0x2693f7)[_0x9843('0x14')](_0x40b1d2);}return null;};}function patchUpdates(_0x57b6b3){return function(_0x3f8577){try{jsonpatch[_0x9843('0x17')](_0x3f8577,_0x57b6b3,!![]);}catch(_0x334511){return BPromise['reject'](_0x334511);}return _0x3f8577[_0x9843('0x18')]();};}function saveUpdates(_0x41829d,_0x4b6ae7){return function(_0x31c061){if(_0x31c061){return _0x31c061['update'](_0x41829d)['then'](function(_0x1eff49){return _0x1eff49;});}return null;};}function removeEntity(_0x460022,_0x2929b9){return function(_0x1ee2cb){if(_0x1ee2cb){return _0x1ee2cb['destroy']()['then'](function(){var _0x1afb8c=_0x1ee2cb[_0x9843('0x19')]({'plain':!![]});var _0x3589cc=_0x9843('0x1a');return db[_0x9843('0x1b')][_0x9843('0x1c')]({'where':{'type':_0x3589cc,'resourceId':_0x1afb8c['id']}})[_0x9843('0x1d')](function(){return _0x1ee2cb;});})['then'](function(){_0x460022['status'](0xcc)[_0x9843('0x13')]();});}};}function handleEntityNotFound(_0x40e4c6,_0x11f5a1){return function(_0xf0b749){if(!_0xf0b749){_0x40e4c6['sendStatus'](0x194);}return _0xf0b749;};}function handleError(_0x47ec87,_0x1eb611){_0x1eb611=_0x1eb611||0x1f4;return function(_0x188e68){logger[_0x9843('0x1e')](_0x188e68[_0x9843('0x1f')]);if(_0x188e68['name']){delete _0x188e68['name'];}_0x47ec87[_0x9843('0x20')](_0x1eb611)[_0x9843('0x21')](_0x188e68);};}exports[_0x9843('0x22')]=function(_0x5f26c7,_0x4ce79e){var _0x5830d9={},_0x3ffb77={},_0x1a69d2={'count':0x0,'rows':[]};var _0x3aa5e5=db['AnalyticCustomReport'][_0x9843('0x23')];_0x3ffb77[_0x9843('0x24')]=_[_0x9843('0x25')](_0x3aa5e5);var _0x384548={'dateStart':_0x5f26c7[_0x9843('0x26')][_0x9843('0x27')],'dateEnd':_0x5f26c7[_0x9843('0x26')][_0x9843('0x28')]};delete _0x5f26c7['query'][_0x9843('0x27')];delete _0x5f26c7[_0x9843('0x26')][_0x9843('0x28')];_0x3ffb77[_0x9843('0x26')]=_[_0x9843('0x25')](_0x5f26c7[_0x9843('0x26')]);_0x3ffb77[_0x9843('0x29')]=_['intersection'](_0x3ffb77[_0x9843('0x24')],_0x3ffb77[_0x9843('0x26')]);_0x5830d9[_0x9843('0x2a')]=_[_0x9843('0x2b')](_0x3ffb77[_0x9843('0x24')],qs[_0x9843('0x2c')](_0x5f26c7['query']['fields']));_0x5830d9[_0x9843('0x2a')]=_0x5830d9['attributes'][_0x9843('0x2d')]?_0x5830d9[_0x9843('0x2a')]:_0x3ffb77['model'];if(!_0x5f26c7[_0x9843('0x26')]['hasOwnProperty'](_0x9843('0x2e'))){_0x5830d9['limit']=qs[_0x9843('0x2f')](_0x5f26c7[_0x9843('0x26')]['limit']);_0x5830d9[_0x9843('0x15')]=qs['offset'](_0x5f26c7[_0x9843('0x26')]['offset']);}_0x5830d9['order']=qs[_0x9843('0x30')](_0x5f26c7['query'][_0x9843('0x30')]);_0x5830d9[_0x9843('0x31')]=qs[_0x9843('0x29')](_[_0x9843('0x32')](_0x5f26c7[_0x9843('0x26')],_0x3ffb77[_0x9843('0x29')]));if(_0x384548['dateStart']){if(_0x384548[_0x9843('0x28')]){_0x384548[_0x9843('0x28')]=moment(_0x384548['dateEnd'])[_0x9843('0x33')](0x1,_0x9843('0x34'));}else{_0x384548[_0x9843('0x28')]=moment(_0x384548[_0x9843('0x27')])[_0x9843('0x33')](0x1,_0x9843('0x34'));}_['merge'](_0x5830d9['where'],{'createdAt':{'$gte':_0x384548[_0x9843('0x27')],'$lte':_0x384548[_0x9843('0x28')]}});}if(_0x5f26c7[_0x9843('0x26')]['filter']){_0x5830d9[_0x9843('0x31')]=_['merge'](_0x5830d9[_0x9843('0x31')],{'$or':_[_0x9843('0x35')](_0x5830d9[_0x9843('0x2a')],function(_0x1468b1){var _0x278a99={};_0x278a99[_0x1468b1]={'$like':'%'+_0x5f26c7['query']['filter']+'%'};return _0x278a99;})});}_0x5830d9=_[_0x9843('0x36')]({},_0x5830d9,_0x5f26c7[_0x9843('0x37')]);var _0x1ac8e8={'where':_0x5830d9[_0x9843('0x31')]};return db['AnalyticCustomReport'][_0x9843('0x38')](_0x1ac8e8)['then'](function(_0x4e9b81){_0x1a69d2['count']=_0x4e9b81;if(_0x5f26c7['query'][_0x9843('0x39')]){_0x5830d9['include']=[{'all':!![]}];}return db[_0x9843('0x3a')][_0x9843('0x3b')](_0x5830d9);})[_0x9843('0x1d')](function(_0x5802d3){_0x1a69d2[_0x9843('0x3c')]=_0x5802d3;return _0x1a69d2;})[_0x9843('0x1d')](respondWithFilteredResult(_0x4ce79e,_0x5830d9))['catch'](handleError(_0x4ce79e,null));};exports[_0x9843('0x3d')]=function(_0x40ad88,_0x247488){var _0x229deb={'raw':![],'where':{'id':_0x40ad88[_0x9843('0x3e')]['id']}},_0x18e333={};_0x18e333[_0x9843('0x24')]=_[_0x9843('0x25')](db[_0x9843('0x3a')]['rawAttributes']);_0x18e333[_0x9843('0x26')]=_['keys'](_0x40ad88['query']);_0x18e333[_0x9843('0x29')]=_['intersection'](_0x18e333[_0x9843('0x24')],_0x18e333[_0x9843('0x26')]);_0x229deb[_0x9843('0x2a')]=_[_0x9843('0x2b')](_0x18e333[_0x9843('0x24')],qs[_0x9843('0x2c')](_0x40ad88[_0x9843('0x26')][_0x9843('0x2c')]));_0x229deb[_0x9843('0x2a')]=_0x229deb[_0x9843('0x2a')]['length']?_0x229deb['attributes']:_0x18e333['model'];if(_0x40ad88['query'][_0x9843('0x39')]){_0x229deb[_0x9843('0x3f')]=[{'all':!![]}];}_0x229deb=_['merge']({},_0x229deb,_0x40ad88[_0x9843('0x37')]);return db['AnalyticCustomReport'][_0x9843('0x40')](_0x229deb)[_0x9843('0x1d')](handleEntityNotFound(_0x247488,null))['then'](respondWithResult(_0x247488,null))['catch'](handleError(_0x247488,null));};exports[_0x9843('0x41')]=function(_0x192ba4,_0x151587){return db[_0x9843('0x3a')][_0x9843('0x41')](_0x192ba4['body'],{})['then'](function(_0x25bbd9){var _0x1825d7=_0x192ba4[_0x9843('0x42')]['get']({'plain':!![]});if(!_0x1825d7)throw new Error(_0x9843('0x43'));if(_0x1825d7[_0x9843('0x44')]===_0x9843('0x42')){var _0x3f30d6=_0x25bbd9['get']({'plain':!![]});var _0x1cdfcd=_0x9843('0x45');return db[_0x9843('0x46')][_0x9843('0x40')]({'where':{'name':_0x1cdfcd,'userProfileId':_0x1825d7[_0x9843('0x47')]},'raw':!![]})[_0x9843('0x1d')](function(_0x6742c5){if(_0x6742c5&&_0x6742c5[_0x9843('0x48')]===0x0){return db[_0x9843('0x1b')][_0x9843('0x41')]({'name':_0x3f30d6[_0x9843('0x49')],'resourceId':_0x3f30d6['id'],'type':_0x9843('0x1a'),'sectionId':_0x6742c5['id']},{})[_0x9843('0x1d')](function(){return _0x25bbd9;});}else{return _0x25bbd9;}})[_0x9843('0x4a')](function(_0x4d27d8){logger[_0x9843('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d27d8);throw _0x4d27d8;});}return _0x25bbd9;})[_0x9843('0x1d')](respondWithResult(_0x151587,0xc9))[_0x9843('0x4a')](handleError(_0x151587,null));};exports[_0x9843('0x4b')]=function(_0xa00465,_0x40ae47){if(_0xa00465[_0x9843('0x4c')]['id']){delete _0xa00465[_0x9843('0x4c')]['id'];}return db[_0x9843('0x3a')]['find']({'where':{'id':_0xa00465['params']['id']}})[_0x9843('0x1d')](handleEntityNotFound(_0x40ae47,null))[_0x9843('0x1d')](saveUpdates(_0xa00465[_0x9843('0x4c')],null))[_0x9843('0x1d')](respondWithResult(_0x40ae47,null))['catch'](handleError(_0x40ae47,null));};exports[_0x9843('0x1c')]=function(_0x1978d5,_0x445193){return db[_0x9843('0x3a')][_0x9843('0x40')]({'where':{'id':_0x1978d5[_0x9843('0x3e')]['id']}})[_0x9843('0x1d')](handleEntityNotFound(_0x445193,null))[_0x9843('0x1d')](removeEntity(_0x445193,null))[_0x9843('0x4a')](handleError(_0x445193,null));};exports['preview']=function(_0xb851df,_0x143677){var _0x2a99fe=0xa;var _0xa13981=['join',_0x9843('0x4d'),'right_join',_0x9843('0x4e'),'cross_join'];var _0x46d729={'SUM':'SUM(%s)','COUNT':_0x9843('0x4f'),'COUNT DISTINCT':_0x9843('0x50'),'MAX':_0x9843('0x51'),'MIN':_0x9843('0x52'),'AVG':_0x9843('0x53'),'GROUP_CONCAT':_0x9843('0x54'),'GROUP_CONCAT ASC':_0x9843('0x55'),'GROUP_CONCAT DESC':_0x9843('0x56')};var _0x446b75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9843('0x57'),'UNIX_TIMESTAMP':_0x9843('0x58')};var _0x15cd0c=function(_0x352e1b){return!_[_0x9843('0x59')]([_0x9843('0x5a'),'IS\x20NOT\x20NULL',_0x9843('0x5b'),_0x9843('0x5c')],_0x352e1b);};var _0x1ce49d=function(_0x3f8956){if(!_0x3f8956||!_0x3f8956['rules'][_0x9843('0x2d')]){return'';}for(var _0x4b7398='(',_0x4a2cb6=0x0;_0x4a2cb6<_0x3f8956['rules'][_0x9843('0x2d')];_0x4a2cb6+=0x1){_0x4a2cb6>0x0&&(_0x4b7398+='\x20'+_0x3f8956[_0x9843('0x5d')]+'\x20');_0x4b7398+=_0x3f8956[_0x9843('0x5e')][_0x4a2cb6]['group']?_0x1ce49d(_0x3f8956[_0x9843('0x5e')][_0x4a2cb6]['group']):_0x3f8956['rules'][_0x4a2cb6][_0x9843('0x5f')]+'\x20'+_0x3f8956[_0x9843('0x5e')][_0x4a2cb6][_0x9843('0x60')]+(_0x15cd0c(_0x3f8956[_0x9843('0x5e')][_0x4a2cb6][_0x9843('0x60')])?'\x20'+_0x3f8956[_0x9843('0x5e')][_0x4a2cb6]['value']:'');}return _0x4b7398+')';};var _0x1227f8={'where':{'id':_0xb851df['params']['id']}},_0x32be27,_0xb3c3d0,_0x597b8e,_0x446ac8,_0x4c451b;_0x1227f8=_[_0x9843('0x36')]({},_0x1227f8,_0xb851df[_0x9843('0x37')]);return db['AnalyticCustomReport']['find'](_0x1227f8)[_0x9843('0x1d')](function(_0x4f311d){if(_0x4f311d){_0x32be27=_0x4f311d;return _0x4f311d[_0x9843('0x61')]();}return null;})[_0x9843('0x1d')](function(_0x28c4e0){if(_0x28c4e0){if(!_0x28c4e0[_0x9843('0x2d')]){throw new db[(_0x9843('0x62'))][(_0x9843('0x63'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xb3c3d0=_0x28c4e0;return db['AnalyticMetric'][_0x9843('0x3b')]({'raw':!![]});}return null;})['then'](function(_0x36965d){if(_0x36965d){_0x597b8e=_['keyBy'](_0x36965d,'id');var _0x2a6d88;var _0x120d6e=squel[_0x9843('0x64')]();_0x120d6e['from'](_0x32be27[_0x9843('0x65')]);for(var _0x19d3ba=0x0;_0x19d3ba<_0xb3c3d0['length'];_0x19d3ba+=0x1){_0x2a6d88=_0xb3c3d0[_0x19d3ba][_0x9843('0x66')]?_0x597b8e[_0xb3c3d0[_0x19d3ba][_0x9843('0x66')]][_0x9843('0x67')]:_0xb3c3d0[_0x19d3ba][_0x9843('0x5f')];_0x2a6d88=_0xb3c3d0[_0x19d3ba][_0x9843('0x68')]?_[_0x9843('0x69')](_0x46d729[_0xb3c3d0[_0x19d3ba][_0x9843('0x68')]],'%s',_0x2a6d88):_0x2a6d88;_0x2a6d88=_0xb3c3d0[_0x19d3ba][_0x9843('0x6a')]?_[_0x9843('0x69')](_0x446b75[_0xb3c3d0[_0x19d3ba]['format']],'%s',_0x2a6d88):_0x2a6d88;if(_0xb3c3d0[_0x19d3ba]['groupBy']){_0x120d6e[_0x9843('0x6b')](_0x2a6d88);}_0xb3c3d0[_0x19d3ba]['orderBy']&&_0x120d6e[_0x9843('0x6c')](_0x2a6d88,_0xb3c3d0[_0x19d3ba]['orderBy']===_0x9843('0x6d')?![]:!![]);_0x120d6e[_0x9843('0x5f')](_0x2a6d88,_0xb3c3d0[_0x19d3ba][_0x9843('0x6e')]||_0x2a6d88);}if(_0x32be27[_0x9843('0x6f')]){_0x32be27[_0x9843('0x6f')]=JSON[_0x9843('0x70')](_0x32be27[_0x9843('0x6f')]);for(var _0x3c36a8=0x0;_0x3c36a8<_0x32be27[_0x9843('0x6f')]['length'];_0x3c36a8+=0x1){if(_0x32be27[_0x9843('0x6f')][_0x3c36a8][_0x9843('0x71')]&&_['includes'](_0xa13981,_0x32be27[_0x9843('0x6f')][_0x3c36a8][_0x9843('0x71')])&&_0x32be27['joins'][_0x3c36a8]['parentKey']&&_0x32be27['joins'][_0x3c36a8][_0x9843('0x72')]&&_0x32be27[_0x9843('0x6f')][_0x3c36a8]['foreignKey']){_0x120d6e[_0x32be27['joins'][_0x3c36a8][_0x9843('0x71')]](_0x32be27[_0x9843('0x6f')][_0x3c36a8]['foreignTable'],null,util['format'](_0x9843('0x73'),_0x32be27[_0x9843('0x65')],_0x32be27['joins'][_0x3c36a8][_0x9843('0x74')],_0x32be27[_0x9843('0x6f')][_0x3c36a8][_0x9843('0x72')],_0x32be27['joins'][_0x3c36a8]['foreignKey']));}}}if(_0x32be27[_0x9843('0x75')]){_0x32be27['conditions']=JSON[_0x9843('0x70')](_0x32be27[_0x9843('0x75')]);_0x120d6e['where'](_0x1ce49d(_0x32be27[_0x9843('0x75')][_0x9843('0x6b')]));}_0x4c451b=_0x120d6e[_0x9843('0x76')]();_0x120d6e[_0x9843('0x2f')](_0x2a99fe);_0x120d6e['offset'](0x0);logger['debug'](_0x9843('0x77'),_0x120d6e[_0x9843('0x78')]());return db[_0x9843('0x79')]['query'](_0x120d6e['toString'](),{'type':db[_0x9843('0x79')][_0x9843('0x7a')][_0x9843('0x7b')]});}})[_0x9843('0x1d')](respondWithResult(_0x143677,null))['catch'](handleError(_0x143677,null));};function runReport(_0x357e43,_0x3eb4dc,_0x141b1e){var _0x39d8d8=_0x3eb4dc[_0x9843('0x49')];var _0x298255=0xa;var _0x277067=[_0x9843('0x7c'),_0x9843('0x4d'),_0x9843('0x7d'),_0x9843('0x4e'),_0x9843('0x7e')];var _0xb9d994={'SUM':_0x9843('0x7f'),'COUNT':_0x9843('0x4f'),'COUNT DISTINCT':_0x9843('0x50'),'MAX':_0x9843('0x51'),'MIN':'MIN(%s)','AVG':_0x9843('0x53'),'GROUP_CONCAT':_0x9843('0x54'),'GROUP_CONCAT ASC':_0x9843('0x55'),'GROUP_CONCAT DESC':_0x9843('0x56')};var _0x1aa076={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x9843('0x80'),'ROUND':_0x9843('0x57'),'UNIX_TIMESTAMP':_0x9843('0x58')};var _0x1f7e77=function(_0x2d92cf){return!_[_0x9843('0x59')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x9843('0x5b'),_0x9843('0x5c')],_0x2d92cf);};var _0x5d34c2=function(_0x40d8e0){if(!_0x40d8e0||!_0x40d8e0[_0x9843('0x5e')][_0x9843('0x2d')]){return'';}for(var _0x3c6dca='(',_0x5b0768=0x0;_0x5b0768<_0x40d8e0['rules']['length'];_0x5b0768+=0x1){_0x5b0768>0x0&&(_0x3c6dca+='\x20'+_0x40d8e0['operator']+'\x20');_0x3c6dca+=_0x40d8e0[_0x9843('0x5e')][_0x5b0768][_0x9843('0x6b')]?_0x5d34c2(_0x40d8e0[_0x9843('0x5e')][_0x5b0768][_0x9843('0x6b')]):_0x40d8e0['rules'][_0x5b0768][_0x9843('0x5f')]+'\x20'+_0x40d8e0[_0x9843('0x5e')][_0x5b0768][_0x9843('0x60')]+(_0x1f7e77(_0x40d8e0[_0x9843('0x5e')][_0x5b0768]['condition'])?'\x20'+_0x40d8e0[_0x9843('0x5e')][_0x5b0768][_0x9843('0x81')]:'');}return _0x3c6dca+')';};var _0x3ba0fb={'where':{'id':_0x357e43['id']}},_0x3844dc,_0x1c31c4,_0x19b4ab,_0x35d9f9,_0x1f785c;_0x3ba0fb=_['merge']({},_0x3ba0fb,_0x141b1e);return db['AnalyticCustomReport'][_0x9843('0x40')](_0x3ba0fb)[_0x9843('0x1d')](function(_0x483969){if(_0x483969){_0x3844dc=_0x483969;return _0x483969[_0x9843('0x61')]();}return null;})[_0x9843('0x1d')](function(_0x46be13){if(_0x46be13){if(!_0x46be13[_0x9843('0x2d')]){throw new db[(_0x9843('0x62'))][(_0x9843('0x63'))](_0x9843('0x82'),0x193);}_0x1c31c4=_0x46be13;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x19e60c){if(_0x19e60c){_0x19b4ab=_[_0x9843('0x83')](_0x19e60c,'id');var _0x386272;var _0x2a6937=squel[_0x9843('0x64')]();_0x2a6937[_0x9843('0x84')](_0x3844dc[_0x9843('0x65')]);for(var _0x48f88c=0x0;_0x48f88c<_0x1c31c4[_0x9843('0x2d')];_0x48f88c+=0x1){_0x386272=_0x1c31c4[_0x48f88c]['MetricId']?_0x19b4ab[_0x1c31c4[_0x48f88c][_0x9843('0x66')]]['metric']:_0x1c31c4[_0x48f88c][_0x9843('0x5f')];_0x386272=_0x1c31c4[_0x48f88c][_0x9843('0x68')]?_[_0x9843('0x69')](_0xb9d994[_0x1c31c4[_0x48f88c][_0x9843('0x68')]],'%s',_0x386272):_0x386272;_0x386272=_0x1c31c4[_0x48f88c][_0x9843('0x6a')]?_['replace'](_0x1aa076[_0x1c31c4[_0x48f88c][_0x9843('0x6a')]],'%s',_0x386272):_0x386272;if(_0x1c31c4[_0x48f88c][_0x9843('0x85')]){_0x2a6937[_0x9843('0x6b')](_0x386272);}_0x1c31c4[_0x48f88c][_0x9843('0x86')]&&_0x2a6937['order'](_0x386272,_0x1c31c4[_0x48f88c][_0x9843('0x86')]===_0x9843('0x6d')?![]:!![]);_0x2a6937[_0x9843('0x5f')](_0x386272,_0x1c31c4[_0x48f88c][_0x9843('0x6e')]||_0x386272);}if(_0x3844dc[_0x9843('0x6f')]){_0x3844dc[_0x9843('0x6f')]=JSON[_0x9843('0x70')](_0x3844dc[_0x9843('0x6f')]);for(var _0x49ebee=0x0;_0x49ebee<_0x3844dc[_0x9843('0x6f')]['length'];_0x49ebee+=0x1){if(_0x3844dc[_0x9843('0x6f')][_0x49ebee][_0x9843('0x71')]&&_['includes'](_0x277067,_0x3844dc[_0x9843('0x6f')][_0x49ebee][_0x9843('0x71')])&&_0x3844dc['joins'][_0x49ebee]['parentKey']&&_0x3844dc['joins'][_0x49ebee][_0x9843('0x72')]&&_0x3844dc[_0x9843('0x6f')][_0x49ebee][_0x9843('0x87')]){_0x2a6937[_0x3844dc[_0x9843('0x6f')][_0x49ebee][_0x9843('0x71')]](_0x3844dc[_0x9843('0x6f')][_0x49ebee]['foreignTable'],null,util[_0x9843('0x6a')](_0x9843('0x73'),_0x3844dc['table'],_0x3844dc[_0x9843('0x6f')][_0x49ebee][_0x9843('0x74')],_0x3844dc[_0x9843('0x6f')][_0x49ebee][_0x9843('0x72')],_0x3844dc['joins'][_0x49ebee]['foreignKey']));}}}if(_0x3844dc[_0x9843('0x75')]){_0x3844dc[_0x9843('0x75')]=JSON['parse'](_0x3844dc['conditions']);_0x2a6937['where'](_0x5d34c2(_0x3844dc[_0x9843('0x75')][_0x9843('0x6b')]));}_0x1f785c=_0x2a6937[_0x9843('0x76')]();_0x2a6937['limit'](_0x298255);_0x2a6937[_0x9843('0x15')](0x0);logger['debug'](_0x9843('0x77'),_0x2a6937[_0x9843('0x78')]());return db[_0x9843('0x79')]['query'](_0x2a6937[_0x9843('0x78')](),{'type':db[_0x9843('0x79')][_0x9843('0x7a')][_0x9843('0x7b')]});}})['then'](function(_0x240399){if(!_0x240399[_0x9843('0x2d')]){throw new db[(_0x9843('0x62'))][(_0x9843('0x63'))](_0x9843('0x88'),0xcc);}if(_0x3eb4dc['output']===_0x9843('0x89')){return null;}var _0x1d0445=_[_0x9843('0x36')](_0x3eb4dc,{'name':_0x3eb4dc['fullPath']||_0x3eb4dc['name']||_0x3844dc[_0x9843('0x49')],'basename':_0x39d8d8,'savename':util[_0x9843('0x6a')](_0x9843('0x8a'),_0x3eb4dc[_0x9843('0x49')]||_0x3844dc[_0x9843('0x49')],require(_0x9843('0x8b'))['generate'](0x4),_0x3eb4dc['output']||'csv'),'reportId':_0x3844dc['id'],'reportType':'custom'});return db[_0x9843('0x8c')]['create'](_0x1d0445,{'raw':!![]});})[_0x9843('0x1d')](function(_0xd43368){if(_0x3844dc['table']===_0x9843('0x8d')){_0x1f785c[_0x9843('0x31')](_0x3844dc[_0x9843('0x65')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3eb4dc[_0x9843('0x8e')],_0x3eb4dc[_0x9843('0x8f')]);}else{_0x1f785c['where'](_0x3844dc[_0x9843('0x65')]+_0x9843('0x90'),_0x3eb4dc[_0x9843('0x8e')],_0x3eb4dc[_0x9843('0x8f')]);}if(_0xd43368){logger['info'](_0x9843('0x91'),_0x1f785c[_0x9843('0x78')]());require('child_process')['fork'](path[_0x9843('0x7c')](__dirname,_0x9843('0x92'),_0xd43368[_0x9843('0x93')]),[_0xd43368['id'],_0x1f785c['toString'](),path[_0x9843('0x7c')](__dirname,_0x9843('0x94'),_0xd43368['savename']),_0x39d8d8]);return _0xd43368;}else{var _0x321e2e=squel['select']();_0x321e2e[_0x9843('0x84')]('('+_0x1f785c[_0x9843('0x78')]()+')',_0x9843('0x95'));_0x321e2e['field'](_0x9843('0x96'),'count');_0x1f785c[_0x9843('0x2f')](_0x3eb4dc[_0x9843('0x2f')]||_0x298255);_0x1f785c[_0x9843('0x15')](_0x3eb4dc[_0x9843('0x15')]||0x0);return db['sequelize']['query'](_0x321e2e[_0x9843('0x78')](),{'type':db[_0x9843('0x79')][_0x9843('0x7a')][_0x9843('0x7b')]})[_0x9843('0x1d')](function(_0x3525f0){if(!_0x3525f0[_0x9843('0x2d')]){_0x35d9f9=0x0;}else{_0x35d9f9=_0x3525f0[0x0][_0x9843('0x38')]||0x0;}return db['sequelize'][_0x9843('0x26')](_0x1f785c[_0x9843('0x78')](),{'type':db['sequelize'][_0x9843('0x7a')][_0x9843('0x7b')]});})['then'](function(_0x3a9ddd){return{'rows':_0x3a9ddd||[],'count':_0x35d9f9};});}});}exports[_0x9843('0x97')]=function(_0x18b5e9,_0x594502){return runReport(_0x18b5e9['params'],_0x18b5e9[_0x9843('0x26')],_0x18b5e9[_0x9843('0x37')])['then'](respondWithResult(_0x594502,null))[_0x9843('0x4a')](handleError(_0x594502,null));};exports['runReport']=runReport;exports['query']=function(_0x4fe8be,_0x3c8f43){var _0x1b3cd7=0xa;var _0x3934be=[_0x9843('0x7c'),_0x9843('0x4d'),_0x9843('0x7d'),'outer_join',_0x9843('0x7e')];var _0x12a381={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9843('0x50'),'MAX':'MAX(%s)','MIN':_0x9843('0x52'),'AVG':_0x9843('0x53'),'GROUP_CONCAT':_0x9843('0x54'),'GROUP_CONCAT ASC':_0x9843('0x55'),'GROUP_CONCAT DESC':_0x9843('0x56')};var _0x55719f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9843('0x57'),'UNIX_TIMESTAMP':_0x9843('0x58')};var _0x47de54=function(_0xac7f06){return!_[_0x9843('0x59')]([_0x9843('0x5a'),_0x9843('0x98'),'IS\x20EMPTY',_0x9843('0x5c')],_0xac7f06);};var _0x123a5c=function(_0x53681f){if(!_0x53681f||!_0x53681f[_0x9843('0x5e')][_0x9843('0x2d')]){return'';}for(var _0x5c710a='(',_0x1b5678=0x0;_0x1b5678<_0x53681f[_0x9843('0x5e')][_0x9843('0x2d')];_0x1b5678+=0x1){_0x1b5678>0x0&&(_0x5c710a+='\x20'+_0x53681f[_0x9843('0x5d')]+'\x20');_0x5c710a+=_0x53681f['rules'][_0x1b5678][_0x9843('0x6b')]?_0x123a5c(_0x53681f['rules'][_0x1b5678][_0x9843('0x6b')]):_0x53681f['rules'][_0x1b5678]['field']+'\x20'+_0x53681f['rules'][_0x1b5678][_0x9843('0x60')]+(_0x47de54(_0x53681f[_0x9843('0x5e')][_0x1b5678]['condition'])?'\x20'+_0x53681f[_0x9843('0x5e')][_0x1b5678][_0x9843('0x81')]:'');}return _0x5c710a+')';};var _0x361693={'where':{'id':_0x4fe8be[_0x9843('0x3e')]['id']}},_0x2bc70c,_0x1b0d74,_0x1a1966,_0x1a15b2,_0x17bc99;_0x361693=_[_0x9843('0x36')]({},_0x361693,_0x4fe8be[_0x9843('0x37')]);return db['AnalyticCustomReport'][_0x9843('0x40')](_0x361693)[_0x9843('0x1d')](function(_0x1754c8){if(_0x1754c8){_0x2bc70c=_0x1754c8;return _0x1754c8[_0x9843('0x61')]();}return null;})[_0x9843('0x1d')](function(_0x5b92d1){if(_0x5b92d1){if(!_0x5b92d1[_0x9843('0x2d')]){throw new db[(_0x9843('0x62'))][(_0x9843('0x63'))](_0x9843('0x82'),0x193);}_0x1b0d74=_0x5b92d1;return db[_0x9843('0x99')][_0x9843('0x3b')]({'raw':!![]});}return null;})['then'](function(_0x1311c8){if(_0x1311c8){_0x1a1966=_[_0x9843('0x83')](_0x1311c8,'id');var _0x33f60f;var _0xfab652=squel[_0x9843('0x64')]();_0xfab652['from'](_0x2bc70c[_0x9843('0x65')]);for(var _0x1ff098=0x0;_0x1ff098<_0x1b0d74[_0x9843('0x2d')];_0x1ff098+=0x1){_0x33f60f=_0x1b0d74[_0x1ff098][_0x9843('0x66')]?_0x1a1966[_0x1b0d74[_0x1ff098][_0x9843('0x66')]]['metric']:_0x1b0d74[_0x1ff098]['field'];_0x33f60f=_0x1b0d74[_0x1ff098][_0x9843('0x68')]?_[_0x9843('0x69')](_0x12a381[_0x1b0d74[_0x1ff098]['function']],'%s',_0x33f60f):_0x33f60f;_0x33f60f=_0x1b0d74[_0x1ff098][_0x9843('0x6a')]?_['replace'](_0x55719f[_0x1b0d74[_0x1ff098]['format']],'%s',_0x33f60f):_0x33f60f;if(_0x1b0d74[_0x1ff098]['groupBy']){_0xfab652[_0x9843('0x6b')](_0x33f60f);}_0x1b0d74[_0x1ff098]['orderBy']&&_0xfab652[_0x9843('0x6c')](_0x33f60f,_0x1b0d74[_0x1ff098][_0x9843('0x86')]===_0x9843('0x6d')?![]:!![]);_0xfab652['field'](_0x33f60f,_0x1b0d74[_0x1ff098][_0x9843('0x6e')]||_0x33f60f);}if(_0x2bc70c['joins']){_0x2bc70c[_0x9843('0x6f')]=JSON[_0x9843('0x70')](_0x2bc70c[_0x9843('0x6f')]);for(var _0x340272=0x0;_0x340272<_0x2bc70c[_0x9843('0x6f')][_0x9843('0x2d')];_0x340272+=0x1){if(_0x2bc70c['joins'][_0x340272][_0x9843('0x71')]&&_[_0x9843('0x59')](_0x3934be,_0x2bc70c[_0x9843('0x6f')][_0x340272]['type'])&&_0x2bc70c['joins'][_0x340272][_0x9843('0x74')]&&_0x2bc70c[_0x9843('0x6f')][_0x340272][_0x9843('0x72')]&&_0x2bc70c[_0x9843('0x6f')][_0x340272][_0x9843('0x87')]){_0xfab652[_0x2bc70c[_0x9843('0x6f')][_0x340272][_0x9843('0x71')]](_0x2bc70c['joins'][_0x340272][_0x9843('0x72')],null,util[_0x9843('0x6a')]('%s.%s\x20=\x20%s.%s',_0x2bc70c[_0x9843('0x65')],_0x2bc70c['joins'][_0x340272]['parentKey'],_0x2bc70c[_0x9843('0x6f')][_0x340272]['foreignTable'],_0x2bc70c['joins'][_0x340272][_0x9843('0x87')]));}}}if(_0x2bc70c[_0x9843('0x75')]){_0x2bc70c[_0x9843('0x75')]=JSON['parse'](_0x2bc70c[_0x9843('0x75')]);_0xfab652[_0x9843('0x31')](_0x123a5c(_0x2bc70c[_0x9843('0x75')][_0x9843('0x6b')]));}_0x17bc99=_0xfab652[_0x9843('0x76')]();_0xfab652['limit'](_0x1b3cd7);_0xfab652['offset'](0x0);logger[_0x9843('0x9a')]('Limited\x20Query:',_0xfab652[_0x9843('0x78')]());return db[_0x9843('0x79')][_0x9843('0x26')](_0xfab652[_0x9843('0x78')](),{'type':db[_0x9843('0x79')]['QueryTypes']['SELECT']});}})[_0x9843('0x1d')](function(){return{'sql':_0x17bc99[_0x9843('0x78')]()};})[_0x9843('0x1d')](respondWithResult(_0x3c8f43,null))[_0x9843('0x4a')](handleError(_0x3c8f43,null));}; \ No newline at end of file +var _0x16c7=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','apply','destroy','then','get','CustomReports','status','send','AnalyticCustomReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','attributes','intersection','fields','nolimit','where','pick','add','day','merge','filter','map','options','includeAll','include','rows','catch','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','UserProfileResource','name','error','update','body','join','right_join','outer_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','type','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NULL','getFields','ValidationErrorItem','AnalyticMetric','No\x20available\x20data','web','fullPath','%s-%s.%s','randomstring','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','ROUND(%s)'];(function(_0x4a5c02,_0x5dc14a){var _0x39a30f=function(_0x3fd756){while(--_0x3fd756){_0x4a5c02['push'](_0x4a5c02['shift']());}};_0x39a30f(++_0x5dc14a);}(_0x16c7,0x1e0));var _0x716c=function(_0x12ba7a,_0x1e0832){_0x12ba7a=_0x12ba7a-0x0;var _0x3ebf18=_0x16c7[_0x12ba7a];return _0x3ebf18;};'use strict';var pdf=require(_0x716c('0x0'));var emlformat=require(_0x716c('0x1'));var rimraf=require(_0x716c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x716c('0x3'));var rp=require(_0x716c('0x4'));var moment=require(_0x716c('0x5'));var BPromise=require(_0x716c('0x6'));var Mustache=require(_0x716c('0x7'));var util=require(_0x716c('0x8'));var path=require(_0x716c('0x9'));var sox=require('sox');var csv=require(_0x716c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x716c('0xb'));var crypto=require('crypto');var jsforce=require(_0x716c('0xc'));var deskjs=require(_0x716c('0xd'));var toCsv=require(_0x716c('0xa'));var querystring=require(_0x716c('0xe'));var Papa=require(_0x716c('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x716c('0x10'))(_0x716c('0x11'));var utils=require(_0x716c('0x12'));var config=require(_0x716c('0x13'));var db=require(_0x716c('0x14'))['db'];function respondWithStatusCode(_0x17dab1,_0x1387c2){_0x1387c2=_0x1387c2||0xcc;return function(_0x46f400){if(_0x46f400){return _0x17dab1[_0x716c('0x15')](_0x1387c2);}return _0x17dab1['status'](_0x1387c2)[_0x716c('0x16')]();};}function respondWithResult(_0x5203e5,_0x1fd080){_0x1fd080=_0x1fd080||0xc8;return function(_0x26eb50){if(_0x26eb50){return _0x5203e5['status'](_0x1fd080)[_0x716c('0x17')](_0x26eb50);}};}function respondWithFilteredResult(_0xef180c,_0x509d68){return function(_0x240650){if(_0x240650){var _0x36613e=_0x240650[_0x716c('0x18')],_0xae810d=_0x509d68['offset'],_0x49e6eb=_0x509d68[_0x716c('0x19')]+_0x509d68[_0x716c('0x1a')],_0x42e072;if(_0x49e6eb>=_0x36613e){_0x49e6eb=_0x36613e;_0x42e072=0xc8;}else{_0x42e072=0xce;}_0xef180c['status'](_0x42e072);return _0xef180c['set']('Content-Range',_0xae810d+'-'+_0x49e6eb+'/'+_0x36613e)['json'](_0x240650);}return null;};}function patchUpdates(_0x3248ec){return function(_0x4d60e1){try{jsonpatch[_0x716c('0x1b')](_0x4d60e1,_0x3248ec,!![]);}catch(_0x3c416a){return BPromise['reject'](_0x3c416a);}return _0x4d60e1['save']();};}function saveUpdates(_0x14e308,_0x40dcc1){return function(_0x50b781){if(_0x50b781){return _0x50b781['update'](_0x14e308)['then'](function(_0x379bb7){return _0x379bb7;});}return null;};}function removeEntity(_0xbcd331,_0x13bf99){return function(_0x35c271){if(_0x35c271){return _0x35c271[_0x716c('0x1c')]()[_0x716c('0x1d')](function(){var _0x44d806=_0x35c271[_0x716c('0x1e')]({'plain':!![]});var _0x208419=_0x716c('0x1f');return db['UserProfileResource'][_0x716c('0x1c')]({'where':{'type':_0x208419,'resourceId':_0x44d806['id']}})[_0x716c('0x1d')](function(){return _0x35c271;});})[_0x716c('0x1d')](function(){_0xbcd331[_0x716c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x184326,_0x22fd41){return function(_0x5ed2b5){if(!_0x5ed2b5){_0x184326[_0x716c('0x15')](0x194);}return _0x5ed2b5;};}function handleError(_0x45bd3a,_0x4e1a07){_0x4e1a07=_0x4e1a07||0x1f4;return function(_0x369e4a){logger['error'](_0x369e4a['stack']);if(_0x369e4a['name']){delete _0x369e4a['name'];}_0x45bd3a[_0x716c('0x20')](_0x4e1a07)[_0x716c('0x21')](_0x369e4a);};}exports['index']=function(_0x5cc2e4,_0xc983a9){var _0x4b9015={},_0x1877c7={},_0x1e7331={'count':0x0,'rows':[]};var _0x1c7f00=db[_0x716c('0x22')][_0x716c('0x23')];_0x1877c7[_0x716c('0x24')]=_[_0x716c('0x25')](_0x1c7f00);var _0x4662ba={'dateStart':_0x5cc2e4['query'][_0x716c('0x26')],'dateEnd':_0x5cc2e4[_0x716c('0x27')]['dateEnd']};delete _0x5cc2e4[_0x716c('0x27')][_0x716c('0x26')];delete _0x5cc2e4[_0x716c('0x27')][_0x716c('0x28')];_0x1877c7[_0x716c('0x27')]=_[_0x716c('0x25')](_0x5cc2e4['query']);_0x1877c7[_0x716c('0x29')]=_['intersection'](_0x1877c7[_0x716c('0x24')],_0x1877c7['query']);_0x4b9015[_0x716c('0x2a')]=_[_0x716c('0x2b')](_0x1877c7[_0x716c('0x24')],qs[_0x716c('0x2c')](_0x5cc2e4[_0x716c('0x27')][_0x716c('0x2c')]));_0x4b9015[_0x716c('0x2a')]=_0x4b9015[_0x716c('0x2a')]['length']?_0x4b9015[_0x716c('0x2a')]:_0x1877c7[_0x716c('0x24')];if(!_0x5cc2e4[_0x716c('0x27')]['hasOwnProperty'](_0x716c('0x2d'))){_0x4b9015[_0x716c('0x1a')]=qs[_0x716c('0x1a')](_0x5cc2e4[_0x716c('0x27')][_0x716c('0x1a')]);_0x4b9015['offset']=qs[_0x716c('0x19')](_0x5cc2e4['query'][_0x716c('0x19')]);}_0x4b9015['order']=qs['sort'](_0x5cc2e4[_0x716c('0x27')]['sort']);_0x4b9015[_0x716c('0x2e')]=qs[_0x716c('0x29')](_[_0x716c('0x2f')](_0x5cc2e4[_0x716c('0x27')],_0x1877c7['filters']));if(_0x4662ba[_0x716c('0x26')]){if(_0x4662ba[_0x716c('0x28')]){_0x4662ba['dateEnd']=moment(_0x4662ba['dateEnd'])[_0x716c('0x30')](0x1,_0x716c('0x31'));}else{_0x4662ba[_0x716c('0x28')]=moment(_0x4662ba[_0x716c('0x26')])[_0x716c('0x30')](0x1,_0x716c('0x31'));}_[_0x716c('0x32')](_0x4b9015[_0x716c('0x2e')],{'createdAt':{'$gte':_0x4662ba[_0x716c('0x26')],'$lte':_0x4662ba[_0x716c('0x28')]}});}if(_0x5cc2e4['query'][_0x716c('0x33')]){_0x4b9015[_0x716c('0x2e')]=_[_0x716c('0x32')](_0x4b9015[_0x716c('0x2e')],{'$or':_[_0x716c('0x34')](_0x4b9015[_0x716c('0x2a')],function(_0xd71921){var _0x4a7cb4={};_0x4a7cb4[_0xd71921]={'$like':'%'+_0x5cc2e4[_0x716c('0x27')]['filter']+'%'};return _0x4a7cb4;})});}_0x4b9015=_[_0x716c('0x32')]({},_0x4b9015,_0x5cc2e4[_0x716c('0x35')]);var _0x21bb68={'where':_0x4b9015[_0x716c('0x2e')]};return db[_0x716c('0x22')][_0x716c('0x18')](_0x21bb68)[_0x716c('0x1d')](function(_0x1c0392){_0x1e7331['count']=_0x1c0392;if(_0x5cc2e4[_0x716c('0x27')][_0x716c('0x36')]){_0x4b9015[_0x716c('0x37')]=[{'all':!![]}];}return db[_0x716c('0x22')]['findAll'](_0x4b9015);})[_0x716c('0x1d')](function(_0x2941a0){_0x1e7331[_0x716c('0x38')]=_0x2941a0;return _0x1e7331;})[_0x716c('0x1d')](respondWithFilteredResult(_0xc983a9,_0x4b9015))[_0x716c('0x39')](handleError(_0xc983a9,null));};exports['show']=function(_0x526bd1,_0x18e59a){var _0x560105={'raw':![],'where':{'id':_0x526bd1[_0x716c('0x3a')]['id']}},_0x2d966c={};_0x2d966c[_0x716c('0x24')]=_[_0x716c('0x25')](db[_0x716c('0x22')][_0x716c('0x23')]);_0x2d966c[_0x716c('0x27')]=_['keys'](_0x526bd1[_0x716c('0x27')]);_0x2d966c['filters']=_[_0x716c('0x2b')](_0x2d966c[_0x716c('0x24')],_0x2d966c[_0x716c('0x27')]);_0x560105['attributes']=_[_0x716c('0x2b')](_0x2d966c[_0x716c('0x24')],qs[_0x716c('0x2c')](_0x526bd1[_0x716c('0x27')][_0x716c('0x2c')]));_0x560105[_0x716c('0x2a')]=_0x560105[_0x716c('0x2a')][_0x716c('0x3b')]?_0x560105[_0x716c('0x2a')]:_0x2d966c[_0x716c('0x24')];if(_0x526bd1['query']['includeAll']){_0x560105[_0x716c('0x37')]=[{'all':!![]}];}_0x560105=_['merge']({},_0x560105,_0x526bd1[_0x716c('0x35')]);return db['AnalyticCustomReport'][_0x716c('0x3c')](_0x560105)['then'](handleEntityNotFound(_0x18e59a,null))[_0x716c('0x1d')](respondWithResult(_0x18e59a,null))['catch'](handleError(_0x18e59a,null));};exports['create']=function(_0x5a0def,_0x3ad94c){return db[_0x716c('0x22')][_0x716c('0x3d')](_0x5a0def['body'],{})['then'](function(_0x30f7fd){var _0x126b28=_0x5a0def[_0x716c('0x3e')][_0x716c('0x1e')]({'plain':!![]});if(!_0x126b28)throw new Error(_0x716c('0x3f'));if(_0x126b28['role']===_0x716c('0x3e')){var _0x21f1b3=_0x30f7fd[_0x716c('0x1e')]({'plain':!![]});var _0x3d4990=_0x716c('0x40');return db[_0x716c('0x41')][_0x716c('0x3c')]({'where':{'name':_0x3d4990,'userProfileId':_0x126b28[_0x716c('0x42')]},'raw':!![]})[_0x716c('0x1d')](function(_0x44188a){if(_0x44188a&&_0x44188a['autoAssociation']===0x0){return db[_0x716c('0x43')][_0x716c('0x3d')]({'name':_0x21f1b3[_0x716c('0x44')],'resourceId':_0x21f1b3['id'],'type':'CustomReports','sectionId':_0x44188a['id']},{})[_0x716c('0x1d')](function(){return _0x30f7fd;});}else{return _0x30f7fd;}})['catch'](function(_0x202dd1){logger[_0x716c('0x45')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x202dd1);throw _0x202dd1;});}return _0x30f7fd;})[_0x716c('0x1d')](respondWithResult(_0x3ad94c,0xc9))[_0x716c('0x39')](handleError(_0x3ad94c,null));};exports[_0x716c('0x46')]=function(_0x1a7a2c,_0xdebbd5){if(_0x1a7a2c['body']['id']){delete _0x1a7a2c[_0x716c('0x47')]['id'];}return db[_0x716c('0x22')]['find']({'where':{'id':_0x1a7a2c['params']['id']}})[_0x716c('0x1d')](handleEntityNotFound(_0xdebbd5,null))[_0x716c('0x1d')](saveUpdates(_0x1a7a2c[_0x716c('0x47')],null))['then'](respondWithResult(_0xdebbd5,null))[_0x716c('0x39')](handleError(_0xdebbd5,null));};exports['destroy']=function(_0x422bf7,_0x272eda){return db['AnalyticCustomReport'][_0x716c('0x3c')]({'where':{'id':_0x422bf7[_0x716c('0x3a')]['id']}})[_0x716c('0x1d')](handleEntityNotFound(_0x272eda,null))[_0x716c('0x1d')](removeEntity(_0x272eda,null))[_0x716c('0x39')](handleError(_0x272eda,null));};exports['preview']=function(_0x1f510c,_0x4db45f){var _0xcd9d4a=0xa;var _0x502610=[_0x716c('0x48'),'left_join',_0x716c('0x49'),_0x716c('0x4a'),_0x716c('0x4b')];var _0x147d38={'SUM':_0x716c('0x4c'),'COUNT':_0x716c('0x4d'),'COUNT DISTINCT':_0x716c('0x4e'),'MAX':_0x716c('0x4f'),'MIN':_0x716c('0x50'),'AVG':_0x716c('0x51'),'GROUP_CONCAT':_0x716c('0x52'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x33fa4d={'SEC_TO_TIME':_0x716c('0x53'),'DATE':_0x716c('0x54'),'HOUR':_0x716c('0x55'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x716c('0x56')};var _0x17b4df=function(_0x44cec9){return!_['includes'](['IS\x20NULL',_0x716c('0x57'),_0x716c('0x58'),_0x716c('0x59')],_0x44cec9);};var _0x236397=function(_0xe52b2){if(!_0xe52b2||!_0xe52b2[_0x716c('0x5a')][_0x716c('0x3b')]){return'';}for(var _0x2c88b9='(',_0x4b7659=0x0;_0x4b7659<_0xe52b2['rules'][_0x716c('0x3b')];_0x4b7659+=0x1){_0x4b7659>0x0&&(_0x2c88b9+='\x20'+_0xe52b2[_0x716c('0x5b')]+'\x20');_0x2c88b9+=_0xe52b2[_0x716c('0x5a')][_0x4b7659][_0x716c('0x5c')]?_0x236397(_0xe52b2[_0x716c('0x5a')][_0x4b7659][_0x716c('0x5c')]):_0xe52b2[_0x716c('0x5a')][_0x4b7659]['field']+'\x20'+_0xe52b2[_0x716c('0x5a')][_0x4b7659]['condition']+(_0x17b4df(_0xe52b2[_0x716c('0x5a')][_0x4b7659][_0x716c('0x5d')])?'\x20'+_0xe52b2[_0x716c('0x5a')][_0x4b7659][_0x716c('0x5e')]:'');}return _0x2c88b9+')';};var _0x145fb8={'where':{'id':_0x1f510c['params']['id']}},_0x387991,_0x3d0bb4,_0x267111,_0x1ff7a5,_0x10a996;_0x145fb8=_[_0x716c('0x32')]({},_0x145fb8,_0x1f510c['options']);return db['AnalyticCustomReport'][_0x716c('0x3c')](_0x145fb8)[_0x716c('0x1d')](function(_0x217128){if(_0x217128){_0x387991=_0x217128;return _0x217128['getFields']();}return null;})['then'](function(_0x5e2e62){if(_0x5e2e62){if(!_0x5e2e62[_0x716c('0x3b')]){throw new db[(_0x716c('0x5f'))]['ValidationErrorItem'](_0x716c('0x60'),0x193);}_0x3d0bb4=_0x5e2e62;return db['AnalyticMetric'][_0x716c('0x61')]({'raw':!![]});}return null;})[_0x716c('0x1d')](function(_0x431ca8){if(_0x431ca8){_0x267111=_[_0x716c('0x62')](_0x431ca8,'id');var _0x75b0a;var _0x1ccf01=squel[_0x716c('0x63')]();_0x1ccf01[_0x716c('0x64')](_0x387991[_0x716c('0x65')]);for(var _0x113f47=0x0;_0x113f47<_0x3d0bb4[_0x716c('0x3b')];_0x113f47+=0x1){_0x75b0a=_0x3d0bb4[_0x113f47]['MetricId']?_0x267111[_0x3d0bb4[_0x113f47][_0x716c('0x66')]][_0x716c('0x67')]:_0x3d0bb4[_0x113f47][_0x716c('0x68')];_0x75b0a=_0x3d0bb4[_0x113f47][_0x716c('0x69')]?_[_0x716c('0x6a')](_0x147d38[_0x3d0bb4[_0x113f47][_0x716c('0x69')]],'%s',_0x75b0a):_0x75b0a;_0x75b0a=_0x3d0bb4[_0x113f47]['format']?_[_0x716c('0x6a')](_0x33fa4d[_0x3d0bb4[_0x113f47][_0x716c('0x6b')]],'%s',_0x75b0a):_0x75b0a;if(_0x3d0bb4[_0x113f47][_0x716c('0x6c')]){_0x1ccf01[_0x716c('0x5c')](_0x75b0a);}_0x3d0bb4[_0x113f47][_0x716c('0x6d')]&&_0x1ccf01[_0x716c('0x6e')](_0x75b0a,_0x3d0bb4[_0x113f47][_0x716c('0x6d')]===_0x716c('0x6f')?![]:!![]);_0x1ccf01[_0x716c('0x68')](_0x75b0a,_0x3d0bb4[_0x113f47][_0x716c('0x70')]||_0x75b0a);}if(_0x387991[_0x716c('0x71')]){_0x387991[_0x716c('0x71')]=JSON[_0x716c('0x72')](_0x387991[_0x716c('0x71')]);for(var _0x34ce65=0x0;_0x34ce65<_0x387991['joins']['length'];_0x34ce65+=0x1){if(_0x387991[_0x716c('0x71')][_0x34ce65][_0x716c('0x73')]&&_[_0x716c('0x74')](_0x502610,_0x387991[_0x716c('0x71')][_0x34ce65][_0x716c('0x73')])&&_0x387991['joins'][_0x34ce65][_0x716c('0x75')]&&_0x387991[_0x716c('0x71')][_0x34ce65][_0x716c('0x76')]&&_0x387991[_0x716c('0x71')][_0x34ce65][_0x716c('0x77')]){_0x1ccf01[_0x387991[_0x716c('0x71')][_0x34ce65][_0x716c('0x73')]](_0x387991[_0x716c('0x71')][_0x34ce65][_0x716c('0x76')],null,util[_0x716c('0x6b')](_0x716c('0x78'),_0x387991[_0x716c('0x65')],_0x387991['joins'][_0x34ce65][_0x716c('0x75')],_0x387991[_0x716c('0x71')][_0x34ce65][_0x716c('0x76')],_0x387991[_0x716c('0x71')][_0x34ce65]['foreignKey']));}}}if(_0x387991['conditions']){_0x387991[_0x716c('0x79')]=JSON[_0x716c('0x72')](_0x387991[_0x716c('0x79')]);_0x1ccf01[_0x716c('0x2e')](_0x236397(_0x387991[_0x716c('0x79')][_0x716c('0x5c')]));}_0x10a996=_0x1ccf01[_0x716c('0x7a')]();_0x1ccf01['limit'](_0xcd9d4a);_0x1ccf01[_0x716c('0x19')](0x0);logger[_0x716c('0x7b')](_0x716c('0x7c'),_0x1ccf01['toString']());return db[_0x716c('0x7d')][_0x716c('0x27')](_0x1ccf01[_0x716c('0x7e')](),{'type':db[_0x716c('0x7d')][_0x716c('0x7f')][_0x716c('0x80')]});}})[_0x716c('0x1d')](respondWithResult(_0x4db45f,null))[_0x716c('0x39')](handleError(_0x4db45f,null));};function runReport(_0x2a7108,_0x1395fa,_0x385afd){var _0x2c5e5=_0x1395fa[_0x716c('0x44')];var _0x19fe77=0xa;var _0x2388a1=['join',_0x716c('0x81'),_0x716c('0x49'),'outer_join','cross_join'];var _0x3b656f={'SUM':_0x716c('0x4c'),'COUNT':_0x716c('0x4d'),'COUNT DISTINCT':_0x716c('0x4e'),'MAX':_0x716c('0x4f'),'MIN':_0x716c('0x50'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x716c('0x52'),'GROUP_CONCAT ASC':_0x716c('0x82'),'GROUP_CONCAT DESC':_0x716c('0x83')};var _0x50cccc={'SEC_TO_TIME':_0x716c('0x53'),'DATE':'DATE(%s)','HOUR':_0x716c('0x55'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x12805d=function(_0x3fd0ec){return!_[_0x716c('0x74')]([_0x716c('0x84'),_0x716c('0x57'),_0x716c('0x58'),_0x716c('0x59')],_0x3fd0ec);};var _0xe7e9cc=function(_0x228fe2){if(!_0x228fe2||!_0x228fe2[_0x716c('0x5a')][_0x716c('0x3b')]){return'';}for(var _0x5dbb69='(',_0x872ea=0x0;_0x872ea<_0x228fe2[_0x716c('0x5a')][_0x716c('0x3b')];_0x872ea+=0x1){_0x872ea>0x0&&(_0x5dbb69+='\x20'+_0x228fe2[_0x716c('0x5b')]+'\x20');_0x5dbb69+=_0x228fe2['rules'][_0x872ea]['group']?_0xe7e9cc(_0x228fe2[_0x716c('0x5a')][_0x872ea]['group']):_0x228fe2['rules'][_0x872ea][_0x716c('0x68')]+'\x20'+_0x228fe2[_0x716c('0x5a')][_0x872ea][_0x716c('0x5d')]+(_0x12805d(_0x228fe2[_0x716c('0x5a')][_0x872ea][_0x716c('0x5d')])?'\x20'+_0x228fe2[_0x716c('0x5a')][_0x872ea][_0x716c('0x5e')]:'');}return _0x5dbb69+')';};var _0xfcb383={'where':{'id':_0x2a7108['id']}},_0x30bc27,_0x2b75da,_0x13a8c8,_0x205ac2,_0x8a909b;_0xfcb383=_['merge']({},_0xfcb383,_0x385afd);return db[_0x716c('0x22')][_0x716c('0x3c')](_0xfcb383)[_0x716c('0x1d')](function(_0x2ee0d5){if(_0x2ee0d5){_0x30bc27=_0x2ee0d5;return _0x2ee0d5[_0x716c('0x85')]();}return null;})[_0x716c('0x1d')](function(_0x2aacec){if(_0x2aacec){if(!_0x2aacec[_0x716c('0x3b')]){throw new db[(_0x716c('0x5f'))][(_0x716c('0x86'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2b75da=_0x2aacec;return db[_0x716c('0x87')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x23125f){if(_0x23125f){_0x13a8c8=_[_0x716c('0x62')](_0x23125f,'id');var _0x2954aa;var _0x692979=squel[_0x716c('0x63')]();_0x692979[_0x716c('0x64')](_0x30bc27[_0x716c('0x65')]);for(var _0x3d2905=0x0;_0x3d2905<_0x2b75da['length'];_0x3d2905+=0x1){_0x2954aa=_0x2b75da[_0x3d2905][_0x716c('0x66')]?_0x13a8c8[_0x2b75da[_0x3d2905][_0x716c('0x66')]][_0x716c('0x67')]:_0x2b75da[_0x3d2905]['field'];_0x2954aa=_0x2b75da[_0x3d2905][_0x716c('0x69')]?_['replace'](_0x3b656f[_0x2b75da[_0x3d2905][_0x716c('0x69')]],'%s',_0x2954aa):_0x2954aa;_0x2954aa=_0x2b75da[_0x3d2905]['format']?_[_0x716c('0x6a')](_0x50cccc[_0x2b75da[_0x3d2905]['format']],'%s',_0x2954aa):_0x2954aa;if(_0x2b75da[_0x3d2905]['groupBy']){_0x692979[_0x716c('0x5c')](_0x2954aa);}_0x2b75da[_0x3d2905][_0x716c('0x6d')]&&_0x692979[_0x716c('0x6e')](_0x2954aa,_0x2b75da[_0x3d2905][_0x716c('0x6d')]==='DESC'?![]:!![]);_0x692979[_0x716c('0x68')](_0x2954aa,_0x2b75da[_0x3d2905][_0x716c('0x70')]||_0x2954aa);}if(_0x30bc27[_0x716c('0x71')]){_0x30bc27[_0x716c('0x71')]=JSON[_0x716c('0x72')](_0x30bc27[_0x716c('0x71')]);for(var _0x3e1e24=0x0;_0x3e1e24<_0x30bc27[_0x716c('0x71')][_0x716c('0x3b')];_0x3e1e24+=0x1){if(_0x30bc27[_0x716c('0x71')][_0x3e1e24][_0x716c('0x73')]&&_[_0x716c('0x74')](_0x2388a1,_0x30bc27['joins'][_0x3e1e24][_0x716c('0x73')])&&_0x30bc27[_0x716c('0x71')][_0x3e1e24][_0x716c('0x75')]&&_0x30bc27[_0x716c('0x71')][_0x3e1e24][_0x716c('0x76')]&&_0x30bc27['joins'][_0x3e1e24][_0x716c('0x77')]){_0x692979[_0x30bc27['joins'][_0x3e1e24][_0x716c('0x73')]](_0x30bc27[_0x716c('0x71')][_0x3e1e24]['foreignTable'],null,util[_0x716c('0x6b')](_0x716c('0x78'),_0x30bc27[_0x716c('0x65')],_0x30bc27['joins'][_0x3e1e24]['parentKey'],_0x30bc27['joins'][_0x3e1e24][_0x716c('0x76')],_0x30bc27[_0x716c('0x71')][_0x3e1e24][_0x716c('0x77')]));}}}if(_0x30bc27[_0x716c('0x79')]){_0x30bc27[_0x716c('0x79')]=JSON[_0x716c('0x72')](_0x30bc27['conditions']);_0x692979['where'](_0xe7e9cc(_0x30bc27[_0x716c('0x79')]['group']));}_0x8a909b=_0x692979[_0x716c('0x7a')]();_0x692979['limit'](_0x19fe77);_0x692979['offset'](0x0);logger['debug']('Limited\x20Query:',_0x692979[_0x716c('0x7e')]());return db[_0x716c('0x7d')][_0x716c('0x27')](_0x692979[_0x716c('0x7e')](),{'type':db[_0x716c('0x7d')]['QueryTypes']['SELECT']});}})[_0x716c('0x1d')](function(_0x3ea28f){if(!_0x3ea28f[_0x716c('0x3b')]){throw new db[(_0x716c('0x5f'))][(_0x716c('0x86'))](_0x716c('0x88'),0xcc);}if(_0x1395fa['output']===_0x716c('0x89')){return null;}var _0x1c1fe5=_[_0x716c('0x32')](_0x1395fa,{'name':_0x1395fa[_0x716c('0x8a')]||_0x1395fa[_0x716c('0x44')]||_0x30bc27[_0x716c('0x44')],'basename':_0x2c5e5,'savename':util[_0x716c('0x6b')](_0x716c('0x8b'),_0x1395fa['name']||_0x30bc27[_0x716c('0x44')],require(_0x716c('0x8c'))['generate'](0x4),_0x1395fa[_0x716c('0x8d')]||_0x716c('0x8e')),'reportId':_0x30bc27['id'],'reportType':_0x716c('0x8f')});return db[_0x716c('0x90')][_0x716c('0x3d')](_0x1c1fe5,{'raw':!![]});})[_0x716c('0x1d')](function(_0x2ce80a){if(_0x30bc27['table']===_0x716c('0x91')){_0x8a909b[_0x716c('0x2e')](_0x30bc27['table']+_0x716c('0x92'),_0x1395fa['startDate'],_0x1395fa['endDate']);}else{_0x8a909b[_0x716c('0x2e')](_0x30bc27[_0x716c('0x65')]+_0x716c('0x93'),_0x1395fa[_0x716c('0x94')],_0x1395fa[_0x716c('0x95')]);}if(_0x2ce80a){logger['info'](_0x716c('0x96'),_0x8a909b['toString']());require(_0x716c('0x97'))[_0x716c('0x98')](path['join'](__dirname,_0x716c('0x99'),_0x2ce80a[_0x716c('0x8d')]),[_0x2ce80a['id'],_0x8a909b[_0x716c('0x7e')](),path[_0x716c('0x48')](__dirname,_0x716c('0x9a'),_0x2ce80a['savename']),_0x2c5e5]);return _0x2ce80a;}else{var _0x2736b8=squel[_0x716c('0x63')]();_0x2736b8[_0x716c('0x64')]('('+_0x8a909b[_0x716c('0x7e')]()+')',_0x716c('0x9b'));_0x2736b8[_0x716c('0x68')](_0x716c('0x9c'),_0x716c('0x18'));_0x8a909b[_0x716c('0x1a')](_0x1395fa['limit']||_0x19fe77);_0x8a909b[_0x716c('0x19')](_0x1395fa['offset']||0x0);return db[_0x716c('0x7d')][_0x716c('0x27')](_0x2736b8['toString'](),{'type':db['sequelize'][_0x716c('0x7f')][_0x716c('0x80')]})[_0x716c('0x1d')](function(_0x4e57fb){if(!_0x4e57fb['length']){_0x205ac2=0x0;}else{_0x205ac2=_0x4e57fb[0x0]['count']||0x0;}return db['sequelize'][_0x716c('0x27')](_0x8a909b['toString'](),{'type':db[_0x716c('0x7d')][_0x716c('0x7f')][_0x716c('0x80')]});})['then'](function(_0x35ee4){return{'rows':_0x35ee4||[],'count':_0x205ac2};});}});}exports[_0x716c('0x9d')]=function(_0x193b36,_0x2f388a){return runReport(_0x193b36[_0x716c('0x3a')],_0x193b36[_0x716c('0x27')],_0x193b36['options'])[_0x716c('0x1d')](respondWithResult(_0x2f388a,null))[_0x716c('0x39')](handleError(_0x2f388a,null));};exports[_0x716c('0x9e')]=runReport;exports[_0x716c('0x27')]=function(_0x124420,_0x2e3b6e){var _0x20aefc=0xa;var _0x361a21=[_0x716c('0x48'),_0x716c('0x81'),_0x716c('0x49'),'outer_join',_0x716c('0x4b')];var _0x3ffffb={'SUM':_0x716c('0x4c'),'COUNT':_0x716c('0x4d'),'COUNT DISTINCT':_0x716c('0x4e'),'MAX':_0x716c('0x4f'),'MIN':'MIN(%s)','AVG':_0x716c('0x51'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x716c('0x82'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x59700d={'SEC_TO_TIME':_0x716c('0x53'),'DATE':'DATE(%s)','HOUR':_0x716c('0x55'),'ROUND':_0x716c('0x9f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x455459=function(_0x37017b){return!_['includes'](['IS\x20NULL',_0x716c('0x57'),_0x716c('0x58'),_0x716c('0x59')],_0x37017b);};var _0x5cd9ea=function(_0x4524d7){if(!_0x4524d7||!_0x4524d7['rules'][_0x716c('0x3b')]){return'';}for(var _0x5e5929='(',_0x5c4873=0x0;_0x5c4873<_0x4524d7[_0x716c('0x5a')]['length'];_0x5c4873+=0x1){_0x5c4873>0x0&&(_0x5e5929+='\x20'+_0x4524d7[_0x716c('0x5b')]+'\x20');_0x5e5929+=_0x4524d7[_0x716c('0x5a')][_0x5c4873]['group']?_0x5cd9ea(_0x4524d7['rules'][_0x5c4873]['group']):_0x4524d7['rules'][_0x5c4873][_0x716c('0x68')]+'\x20'+_0x4524d7['rules'][_0x5c4873]['condition']+(_0x455459(_0x4524d7[_0x716c('0x5a')][_0x5c4873][_0x716c('0x5d')])?'\x20'+_0x4524d7[_0x716c('0x5a')][_0x5c4873][_0x716c('0x5e')]:'');}return _0x5e5929+')';};var _0x2b30c8={'where':{'id':_0x124420[_0x716c('0x3a')]['id']}},_0x374e03,_0x314481,_0x8ff3a2,_0x1552c3,_0x4fc899;_0x2b30c8=_[_0x716c('0x32')]({},_0x2b30c8,_0x124420[_0x716c('0x35')]);return db[_0x716c('0x22')]['find'](_0x2b30c8)[_0x716c('0x1d')](function(_0x2af7f1){if(_0x2af7f1){_0x374e03=_0x2af7f1;return _0x2af7f1['getFields']();}return null;})['then'](function(_0x539e5a){if(_0x539e5a){if(!_0x539e5a[_0x716c('0x3b')]){throw new db[(_0x716c('0x5f'))]['ValidationErrorItem'](_0x716c('0x60'),0x193);}_0x314481=_0x539e5a;return db['AnalyticMetric'][_0x716c('0x61')]({'raw':!![]});}return null;})[_0x716c('0x1d')](function(_0x26e616){if(_0x26e616){_0x8ff3a2=_['keyBy'](_0x26e616,'id');var _0x32a7e8;var _0x27557a=squel[_0x716c('0x63')]();_0x27557a[_0x716c('0x64')](_0x374e03['table']);for(var _0x1af522=0x0;_0x1af522<_0x314481[_0x716c('0x3b')];_0x1af522+=0x1){_0x32a7e8=_0x314481[_0x1af522][_0x716c('0x66')]?_0x8ff3a2[_0x314481[_0x1af522][_0x716c('0x66')]][_0x716c('0x67')]:_0x314481[_0x1af522]['field'];_0x32a7e8=_0x314481[_0x1af522][_0x716c('0x69')]?_[_0x716c('0x6a')](_0x3ffffb[_0x314481[_0x1af522][_0x716c('0x69')]],'%s',_0x32a7e8):_0x32a7e8;_0x32a7e8=_0x314481[_0x1af522][_0x716c('0x6b')]?_[_0x716c('0x6a')](_0x59700d[_0x314481[_0x1af522][_0x716c('0x6b')]],'%s',_0x32a7e8):_0x32a7e8;if(_0x314481[_0x1af522][_0x716c('0x6c')]){_0x27557a[_0x716c('0x5c')](_0x32a7e8);}_0x314481[_0x1af522]['orderBy']&&_0x27557a['order'](_0x32a7e8,_0x314481[_0x1af522][_0x716c('0x6d')]===_0x716c('0x6f')?![]:!![]);_0x27557a[_0x716c('0x68')](_0x32a7e8,_0x314481[_0x1af522][_0x716c('0x70')]||_0x32a7e8);}if(_0x374e03[_0x716c('0x71')]){_0x374e03[_0x716c('0x71')]=JSON['parse'](_0x374e03[_0x716c('0x71')]);for(var _0x5487e8=0x0;_0x5487e8<_0x374e03[_0x716c('0x71')][_0x716c('0x3b')];_0x5487e8+=0x1){if(_0x374e03[_0x716c('0x71')][_0x5487e8][_0x716c('0x73')]&&_[_0x716c('0x74')](_0x361a21,_0x374e03[_0x716c('0x71')][_0x5487e8][_0x716c('0x73')])&&_0x374e03[_0x716c('0x71')][_0x5487e8][_0x716c('0x75')]&&_0x374e03[_0x716c('0x71')][_0x5487e8]['foreignTable']&&_0x374e03[_0x716c('0x71')][_0x5487e8][_0x716c('0x77')]){_0x27557a[_0x374e03[_0x716c('0x71')][_0x5487e8]['type']](_0x374e03['joins'][_0x5487e8][_0x716c('0x76')],null,util['format'](_0x716c('0x78'),_0x374e03[_0x716c('0x65')],_0x374e03[_0x716c('0x71')][_0x5487e8]['parentKey'],_0x374e03[_0x716c('0x71')][_0x5487e8]['foreignTable'],_0x374e03[_0x716c('0x71')][_0x5487e8][_0x716c('0x77')]));}}}if(_0x374e03[_0x716c('0x79')]){_0x374e03['conditions']=JSON['parse'](_0x374e03[_0x716c('0x79')]);_0x27557a[_0x716c('0x2e')](_0x5cd9ea(_0x374e03['conditions'][_0x716c('0x5c')]));}_0x4fc899=_0x27557a[_0x716c('0x7a')]();_0x27557a[_0x716c('0x1a')](_0x20aefc);_0x27557a[_0x716c('0x19')](0x0);logger[_0x716c('0x7b')](_0x716c('0x7c'),_0x27557a['toString']());return db[_0x716c('0x7d')][_0x716c('0x27')](_0x27557a[_0x716c('0x7e')](),{'type':db[_0x716c('0x7d')]['QueryTypes'][_0x716c('0x80')]});}})['then'](function(){return{'sql':_0x4fc899[_0x716c('0x7e')]()};})['then'](respondWithResult(_0x2e3b6e,null))[_0x716c('0x39')](handleError(_0x2e3b6e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 40ef793..02c79c9 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 _0xe5c1=['util','api','moment','bluebird','request-promise','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x119940,_0x4f6830){var _0x158581=function(_0x2ce545){while(--_0x2ce545){_0x119940['push'](_0x119940['shift']());}};_0x158581(++_0x4f6830);}(_0xe5c1,0x128));var _0x1e5c=function(_0x513ce6,_0x49dea1){_0x513ce6=_0x513ce6-0x0;var _0x511301=_0xe5c1[_0x513ce6];return _0x511301;};'use strict';var _=require(_0x1e5c('0x0'));var util=require(_0x1e5c('0x1'));var logger=require('../../config/logger')(_0x1e5c('0x2'));var moment=require(_0x1e5c('0x3'));var BPromise=require(_0x1e5c('0x4'));var rp=require(_0x1e5c('0x5'));var attributes=require(_0x1e5c('0x6'));module[_0x1e5c('0x7')]=function(_0x557b87,_0x48193c){return _0x557b87[_0x1e5c('0x8')](_0x1e5c('0x9'),attributes,{'tableName':_0x1e5c('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8eaa=['moment','request-promise','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','api'];(function(_0xa74ba5,_0x38c2a3){var _0x595b6c=function(_0x393a7a){while(--_0x393a7a){_0xa74ba5['push'](_0xa74ba5['shift']());}};_0x595b6c(++_0x38c2a3);}(_0x8eaa,0x154));var _0xa8ea=function(_0x1ab47a,_0x102bc5){_0x1ab47a=_0x1ab47a-0x0;var _0x3febf4=_0x8eaa[_0x1ab47a];return _0x3febf4;};'use strict';var _=require(_0xa8ea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa8ea('0x1'));var moment=require(_0xa8ea('0x2'));var BPromise=require('bluebird');var rp=require(_0xa8ea('0x3'));var attributes=require(_0xa8ea('0x4'));module[_0xa8ea('0x5')]=function(_0x481cd1,_0x466784){return _0x481cd1[_0xa8ea('0x6')](_0xa8ea('0x7'),attributes,{'tableName':_0xa8ea('0x8'),'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 c4db167..f8e1612 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x1f1fb4,_0x15a561){var _0x12fa15=function(_0x5ecc9b){while(--_0x5ecc9b){_0x1f1fb4['push'](_0x1f1fb4['shift']());}};_0x12fa15(++_0x15a561);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x34b941,_0x18d40f){var _0x1de334=function(_0x296704){while(--_0x296704){_0x34b941['push'](_0x34b941['shift']());}};_0x1de334(++_0x18d40f);}(_0xb10b,0x12a));var _0xbb10=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0xb10b[_0xe1269d];return _0x261ca1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8a7c7c6..bf052b0 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 _0x5f66=['express','Router','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','isAuthenticated','index','show','get','/:id/preview','preview','run','/:id/query','query','create','/:id','update','delete','destroy','exports','util','connect-timeout'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/:id',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['get']('/:id/run',auth[_0x65f6('0x7')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xa')](_0x65f6('0xe'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);router['put'](_0x65f6('0x11'),auth['isAuthenticated'](),controller[_0x65f6('0x12')]);router[_0x65f6('0x13')](_0x65f6('0x11'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x14')]);module[_0x65f6('0x15')]=router; \ No newline at end of file +var _0x1a37=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id','show','/:id/run','run','/:id/query','query','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a37,0xb4));var _0x71a3=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x1a37[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var auth=require(_0x71a3('0x6'));var interaction=require(_0x71a3('0x7'));var config=require(_0x71a3('0x8'));var controller=require(_0x71a3('0x9'));router['get']('/',auth[_0x71a3('0xa')](),controller['index']);router[_0x71a3('0xb')](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0xd')]);router['get']('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0x71a3('0xb')](_0x71a3('0xe'),auth[_0x71a3('0xa')](),controller[_0x71a3('0xf')]);router[_0x71a3('0xb')](_0x71a3('0x10'),auth[_0x71a3('0xa')](),controller[_0x71a3('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x71a3('0x12')](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0x13')]);router[_0x71a3('0x14')](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0x15')]);module[_0x71a3('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 e39b578..188d33e 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 _0x8699=['TEXT','STRING'];(function(_0x3747ae,_0x408e61){var _0x339035=function(_0x83be87){while(--_0x83be87){_0x3747ae['push'](_0x3747ae['shift']());}};_0x339035(++_0x408e61);}(_0x8699,0x169));var _0x9869=function(_0x8be9fb,_0x2f90d9){_0x8be9fb=_0x8be9fb-0x0;var _0x3b41ac=_0x8699[_0x8be9fb];return _0x3b41ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9869('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x9869('0x0')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x9869('0x0')]},'conditions':{'type':Sequelize[_0x9869('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0e46=['STRING','TEXT','sequelize','exports'];(function(_0x265b94,_0x296d4b){var _0x338c2c=function(_0x56b9c5){while(--_0x56b9c5){_0x265b94['push'](_0x265b94['shift']());}};_0x338c2c(++_0x296d4b);}(_0x0e46,0x106));var _0x60e4=function(_0x14eed8,_0x4b11c9){_0x14eed8=_0x14eed8-0x0;var _0x31956d=_0x0e46[_0x14eed8];return _0x31956d;};'use strict';var Sequelize=require(_0x60e4('0x0'));module[_0x60e4('0x1')]={'name':{'type':Sequelize[_0x60e4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x60e4('0x2')]},'parent':{'type':Sequelize[_0x60e4('0x2')]},'table':{'type':Sequelize[_0x60e4('0x2')]},'conditions':{'type':Sequelize[_0x60e4('0x3')]},'joins':{'type':Sequelize[_0x60e4('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 84579dd..b975781 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 _0xad94=['bluebird','util','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','get','DefaultReports','UserProfileResource','error','stack','name','AnalyticDefaultReport','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length','sort','where','filters','pick','add','day','filter','merge','map','options','include','findAll','catch','show','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','outer_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','params','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','select','from','table','MetricId','metric','replace','format','groupBy','orderBy','order','DESC','field','alias','joins','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20NULL','getFields','AnalyticMetric','keyBy','function','QueryTypes','No\x20available\x20data','web','fullPath','generate','output','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','AVG(%s)','ROUND(%s)','IS\x20NOT\x20NULL','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0xad94,0x1dc));var _0x4ad9=function(_0x556784,_0x42d1af){_0x556784=_0x556784-0x0;var _0x20c7bc=_0xad94[_0x556784];return _0x20c7bc;};'use strict';var pdf=require(_0x4ad9('0x0'));var emlformat=require(_0x4ad9('0x1'));var rimraf=require(_0x4ad9('0x2'));var zipdir=require(_0x4ad9('0x3'));var jsonpatch=require(_0x4ad9('0x4'));var rp=require(_0x4ad9('0x5'));var moment=require(_0x4ad9('0x6'));var BPromise=require(_0x4ad9('0x7'));var Mustache=require('mustache');var util=require(_0x4ad9('0x8'));var path=require('path');var sox=require(_0x4ad9('0x9'));var csv=require(_0x4ad9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4ad9('0xb'));var jsforce=require(_0x4ad9('0xc'));var deskjs=require(_0x4ad9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4ad9('0xe'));var Papa=require('papaparse');var Redis=require(_0x4ad9('0xf'));var qs=require(_0x4ad9('0x10'));var logger=require(_0x4ad9('0x11'))(_0x4ad9('0x12'));var utils=require(_0x4ad9('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fc8b8,_0x4a35f5){_0x4a35f5=_0x4a35f5||0xcc;return function(_0x48c16a){if(_0x48c16a){return _0x4fc8b8[_0x4ad9('0x14')](_0x4a35f5);}return _0x4fc8b8['status'](_0x4a35f5)[_0x4ad9('0x15')]();};}function respondWithResult(_0x37a30f,_0x4c412f){_0x4c412f=_0x4c412f||0xc8;return function(_0x188d4b){if(_0x188d4b){return _0x37a30f[_0x4ad9('0x16')](_0x4c412f)[_0x4ad9('0x17')](_0x188d4b);}};}function respondWithFilteredResult(_0x43a457,_0x53be0b){return function(_0xae9f3e){if(_0xae9f3e){var _0x2e0831=_0xae9f3e[_0x4ad9('0x18')],_0x2e86af=_0x53be0b['offset'],_0x55b02d=_0x53be0b[_0x4ad9('0x19')]+_0x53be0b[_0x4ad9('0x1a')],_0x4a5266;if(_0x55b02d>=_0x2e0831){_0x55b02d=_0x2e0831;_0x4a5266=0xc8;}else{_0x4a5266=0xce;}_0x43a457[_0x4ad9('0x16')](_0x4a5266);return _0x43a457[_0x4ad9('0x1b')](_0x4ad9('0x1c'),_0x2e86af+'-'+_0x55b02d+'/'+_0x2e0831)[_0x4ad9('0x17')](_0xae9f3e);}return null;};}function patchUpdates(_0x5f0eb0){return function(_0x239a3c){try{jsonpatch['apply'](_0x239a3c,_0x5f0eb0,!![]);}catch(_0x49ee6a){return BPromise[_0x4ad9('0x1d')](_0x49ee6a);}return _0x239a3c[_0x4ad9('0x1e')]();};}function saveUpdates(_0x4856f3,_0x48dfc8){return function(_0xd88a7f){if(_0xd88a7f){return _0xd88a7f['update'](_0x4856f3)['then'](function(_0x4db492){return _0x4db492;});}return null;};}function removeEntity(_0x3f58ef,_0x51c2be){return function(_0x5e3956){if(_0x5e3956){return _0x5e3956[_0x4ad9('0x1f')]()[_0x4ad9('0x20')](function(){var _0x52385a=_0x5e3956[_0x4ad9('0x21')]({'plain':!![]});var _0x405054=_0x4ad9('0x22');return db[_0x4ad9('0x23')][_0x4ad9('0x1f')]({'where':{'type':_0x405054,'resourceId':_0x52385a['id']}})[_0x4ad9('0x20')](function(){return _0x5e3956;});})[_0x4ad9('0x20')](function(){_0x3f58ef[_0x4ad9('0x16')](0xcc)[_0x4ad9('0x15')]();});}};}function handleEntityNotFound(_0x359665,_0x94c49b){return function(_0x57f0a3){if(!_0x57f0a3){_0x359665[_0x4ad9('0x14')](0x194);}return _0x57f0a3;};}function handleError(_0x36d582,_0x5b5f3b){_0x5b5f3b=_0x5b5f3b||0x1f4;return function(_0x43c194){logger[_0x4ad9('0x24')](_0x43c194[_0x4ad9('0x25')]);if(_0x43c194[_0x4ad9('0x26')]){delete _0x43c194[_0x4ad9('0x26')];}_0x36d582[_0x4ad9('0x16')](_0x5b5f3b)['send'](_0x43c194);};}exports['index']=function(_0x2b763c,_0x4e806a){var _0x80b61a={},_0x417d13={},_0x2003ea={'count':0x0,'rows':[]};var _0x51ee4c=db[_0x4ad9('0x27')]['rawAttributes'];_0x417d13['model']=_[_0x4ad9('0x28')](_0x51ee4c);var _0x19d416={'dateStart':_0x2b763c[_0x4ad9('0x29')][_0x4ad9('0x2a')],'dateEnd':_0x2b763c[_0x4ad9('0x29')][_0x4ad9('0x2b')]};delete _0x2b763c[_0x4ad9('0x29')][_0x4ad9('0x2a')];delete _0x2b763c[_0x4ad9('0x29')][_0x4ad9('0x2b')];_0x417d13['query']=_['keys'](_0x2b763c[_0x4ad9('0x29')]);_0x417d13['filters']=_[_0x4ad9('0x2c')](_0x417d13[_0x4ad9('0x2d')],_0x417d13['query']);_0x80b61a[_0x4ad9('0x2e')]=_[_0x4ad9('0x2c')](_0x417d13[_0x4ad9('0x2d')],qs[_0x4ad9('0x2f')](_0x2b763c[_0x4ad9('0x29')][_0x4ad9('0x2f')]));_0x80b61a[_0x4ad9('0x2e')]=_0x80b61a[_0x4ad9('0x2e')][_0x4ad9('0x30')]?_0x80b61a[_0x4ad9('0x2e')]:_0x417d13['model'];if(!_0x2b763c[_0x4ad9('0x29')]['hasOwnProperty']('nolimit')){_0x80b61a[_0x4ad9('0x1a')]=qs[_0x4ad9('0x1a')](_0x2b763c[_0x4ad9('0x29')][_0x4ad9('0x1a')]);_0x80b61a['offset']=qs[_0x4ad9('0x19')](_0x2b763c[_0x4ad9('0x29')][_0x4ad9('0x19')]);}_0x80b61a['order']=qs[_0x4ad9('0x31')](_0x2b763c['query'][_0x4ad9('0x31')]);_0x80b61a[_0x4ad9('0x32')]=qs[_0x4ad9('0x33')](_[_0x4ad9('0x34')](_0x2b763c['query'],_0x417d13['filters']));if(_0x19d416[_0x4ad9('0x2a')]){if(_0x19d416[_0x4ad9('0x2b')]){_0x19d416['dateEnd']=moment(_0x19d416[_0x4ad9('0x2b')])[_0x4ad9('0x35')](0x1,_0x4ad9('0x36'));}else{_0x19d416[_0x4ad9('0x2b')]=moment(_0x19d416[_0x4ad9('0x2a')])['add'](0x1,_0x4ad9('0x36'));}_['merge'](_0x80b61a['where'],{'createdAt':{'$gte':_0x19d416[_0x4ad9('0x2a')],'$lte':_0x19d416[_0x4ad9('0x2b')]}});}if(_0x2b763c[_0x4ad9('0x29')][_0x4ad9('0x37')]){_0x80b61a[_0x4ad9('0x32')]=_[_0x4ad9('0x38')](_0x80b61a[_0x4ad9('0x32')],{'$or':_[_0x4ad9('0x39')](_0x80b61a['attributes'],function(_0xa05cdd){var _0x557026={};_0x557026[_0xa05cdd]={'$like':'%'+_0x2b763c[_0x4ad9('0x29')]['filter']+'%'};return _0x557026;})});}_0x80b61a=_[_0x4ad9('0x38')]({},_0x80b61a,_0x2b763c[_0x4ad9('0x3a')]);var _0x3478a6={'where':_0x80b61a['where']};return db[_0x4ad9('0x27')][_0x4ad9('0x18')](_0x3478a6)[_0x4ad9('0x20')](function(_0x3bc318){_0x2003ea[_0x4ad9('0x18')]=_0x3bc318;if(_0x2b763c[_0x4ad9('0x29')]['includeAll']){_0x80b61a[_0x4ad9('0x3b')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x4ad9('0x3c')](_0x80b61a);})[_0x4ad9('0x20')](function(_0x5687b4){_0x2003ea['rows']=_0x5687b4;return _0x2003ea;})[_0x4ad9('0x20')](respondWithFilteredResult(_0x4e806a,_0x80b61a))[_0x4ad9('0x3d')](handleError(_0x4e806a,null));};exports[_0x4ad9('0x3e')]=function(_0x279a7b,_0x4478e9){var _0x5db04f={'raw':!![],'where':{'id':_0x279a7b['params']['id']}},_0x3826ea={};_0x3826ea[_0x4ad9('0x2d')]=_[_0x4ad9('0x28')](db['AnalyticDefaultReport'][_0x4ad9('0x3f')]);_0x3826ea['query']=_[_0x4ad9('0x28')](_0x279a7b[_0x4ad9('0x29')]);_0x3826ea[_0x4ad9('0x33')]=_['intersection'](_0x3826ea[_0x4ad9('0x2d')],_0x3826ea['query']);_0x5db04f['attributes']=_[_0x4ad9('0x2c')](_0x3826ea[_0x4ad9('0x2d')],qs[_0x4ad9('0x2f')](_0x279a7b['query']['fields']));_0x5db04f[_0x4ad9('0x2e')]=_0x5db04f[_0x4ad9('0x2e')][_0x4ad9('0x30')]?_0x5db04f[_0x4ad9('0x2e')]:_0x3826ea['model'];if(_0x279a7b[_0x4ad9('0x29')][_0x4ad9('0x40')]){_0x5db04f[_0x4ad9('0x3b')]=[{'all':!![]}];}_0x5db04f=_[_0x4ad9('0x38')]({},_0x5db04f,_0x279a7b['options']);return db[_0x4ad9('0x27')][_0x4ad9('0x41')](_0x5db04f)[_0x4ad9('0x20')](handleEntityNotFound(_0x4478e9,null))[_0x4ad9('0x20')](respondWithResult(_0x4478e9,null))[_0x4ad9('0x3d')](handleError(_0x4478e9,null));};exports[_0x4ad9('0x42')]=function(_0x39197b,_0x16b271){return db[_0x4ad9('0x27')][_0x4ad9('0x42')](_0x39197b[_0x4ad9('0x43')],{})[_0x4ad9('0x20')](function(_0x49845f){var _0x201610=_0x39197b['user'][_0x4ad9('0x21')]({'plain':!![]});if(!_0x201610)throw new Error(_0x4ad9('0x44'));if(_0x201610[_0x4ad9('0x45')]===_0x4ad9('0x46')){var _0x572304=_0x49845f['get']({'plain':!![]});var _0x1c2a6a=_0x4ad9('0x47');return db[_0x4ad9('0x48')][_0x4ad9('0x41')]({'where':{'name':_0x1c2a6a,'userProfileId':_0x201610['userProfileId']},'raw':!![]})[_0x4ad9('0x20')](function(_0x4f66c5){if(_0x4f66c5&&_0x4f66c5[_0x4ad9('0x49')]===0x0){return db[_0x4ad9('0x23')][_0x4ad9('0x42')]({'name':_0x572304[_0x4ad9('0x26')],'resourceId':_0x572304['id'],'type':_0x4ad9('0x22'),'sectionId':_0x4f66c5['id']},{})[_0x4ad9('0x20')](function(){return _0x49845f;});}else{return _0x49845f;}})[_0x4ad9('0x3d')](function(_0x52dbae){logger[_0x4ad9('0x24')](_0x4ad9('0x4a'),_0x52dbae);throw _0x52dbae;});}return _0x49845f;})[_0x4ad9('0x20')](respondWithResult(_0x16b271,0xc9))[_0x4ad9('0x3d')](handleError(_0x16b271,null));};exports[_0x4ad9('0x4b')]=function(_0x2f58df,_0x25fefe){if(_0x2f58df[_0x4ad9('0x43')]['id']){delete _0x2f58df['body']['id'];}return db[_0x4ad9('0x27')][_0x4ad9('0x41')]({'where':{'id':_0x2f58df['params']['id']}})[_0x4ad9('0x20')](handleEntityNotFound(_0x25fefe,null))[_0x4ad9('0x20')](saveUpdates(_0x2f58df[_0x4ad9('0x43')],null))[_0x4ad9('0x20')](respondWithResult(_0x25fefe,null))[_0x4ad9('0x3d')](handleError(_0x25fefe,null));};exports[_0x4ad9('0x1f')]=function(_0xd6c7b0,_0x2b94be){return db[_0x4ad9('0x27')]['find']({'where':{'id':_0xd6c7b0['params']['id']}})['then'](handleEntityNotFound(_0x2b94be,null))[_0x4ad9('0x20')](removeEntity(_0x2b94be,null))['catch'](handleError(_0x2b94be,null));};exports[_0x4ad9('0x4c')]=function(_0x4e9701,_0x5a10a5){var _0x36f5b7=0xa;var _0x4e9f30=[_0x4ad9('0x4d'),_0x4ad9('0x4e'),_0x4ad9('0x4f'),_0x4ad9('0x50'),'cross_join'];var _0x597df1={'SUM':_0x4ad9('0x51'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ad9('0x52'),'MAX':_0x4ad9('0x53'),'MIN':_0x4ad9('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ad9('0x55'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ad9('0x56')};var _0x361b9c={'SEC_TO_TIME':_0x4ad9('0x57'),'DATE':'DATE(%s)','HOUR':_0x4ad9('0x58'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ad9('0x59')};var _0x227bef=function(_0x2a487d){return!_[_0x4ad9('0x5a')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x4ad9('0x5b'),_0x4ad9('0x5c')],_0x2a487d);};var _0x512ead=function(_0x216b4c){if(!_0x216b4c||!_0x216b4c[_0x4ad9('0x5d')][_0x4ad9('0x30')]){return'';}for(var _0x56a13f='(',_0x197b33=0x0;_0x197b33<_0x216b4c[_0x4ad9('0x5d')][_0x4ad9('0x30')];_0x197b33+=0x1){_0x197b33>0x0&&(_0x56a13f+='\x20'+_0x216b4c[_0x4ad9('0x5e')]+'\x20');_0x56a13f+=_0x216b4c[_0x4ad9('0x5d')][_0x197b33]['group']?_0x512ead(_0x216b4c[_0x4ad9('0x5d')][_0x197b33][_0x4ad9('0x5f')]):_0x216b4c[_0x4ad9('0x5d')][_0x197b33]['field']+'\x20'+_0x216b4c[_0x4ad9('0x5d')][_0x197b33][_0x4ad9('0x60')]+(_0x227bef(_0x216b4c['rules'][_0x197b33][_0x4ad9('0x60')])?'\x20'+_0x216b4c['rules'][_0x197b33][_0x4ad9('0x61')]:'');}return _0x56a13f+')';};var _0xa487c5={'where':{'id':_0x4e9701[_0x4ad9('0x62')]['id']}},_0x131f02,_0xeec33e,_0x2b813a,_0x2353b6,_0xbd3572;_0xa487c5=_[_0x4ad9('0x38')]({},_0xa487c5,_0x4e9701['options']);return db['AnalyticDefaultReport']['find'](_0xa487c5)[_0x4ad9('0x20')](function(_0x348423){if(_0x348423){_0x131f02=_0x348423;return _0x348423['getFields']();}return null;})[_0x4ad9('0x20')](function(_0x2f992b){if(_0x2f992b){if(!_0x2f992b[_0x4ad9('0x30')]){throw new db[(_0x4ad9('0x63'))][(_0x4ad9('0x64'))](_0x4ad9('0x65'),0x193);}_0xeec33e=_0x2f992b;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ad9('0x20')](function(_0x4cbfcd){if(_0x4cbfcd){_0x2b813a=_['keyBy'](_0x4cbfcd,'id');var _0x515c41;var _0x5adfce=squel[_0x4ad9('0x66')]();_0x5adfce[_0x4ad9('0x67')](_0x131f02[_0x4ad9('0x68')]);for(var _0x3349e0=0x0;_0x3349e0<_0xeec33e[_0x4ad9('0x30')];_0x3349e0+=0x1){_0x515c41=_0xeec33e[_0x3349e0][_0x4ad9('0x69')]?_0x2b813a[_0xeec33e[_0x3349e0]['MetricId']][_0x4ad9('0x6a')]:_0xeec33e[_0x3349e0]['field'];_0x515c41=_0xeec33e[_0x3349e0]['function']?_[_0x4ad9('0x6b')](_0x597df1[_0xeec33e[_0x3349e0]['function']],'%s',_0x515c41):_0x515c41;_0x515c41=_0xeec33e[_0x3349e0][_0x4ad9('0x6c')]?_[_0x4ad9('0x6b')](_0x361b9c[_0xeec33e[_0x3349e0]['format']],'%s',_0x515c41):_0x515c41;if(_0xeec33e[_0x3349e0][_0x4ad9('0x6d')]){_0x5adfce[_0x4ad9('0x5f')](_0x515c41);}_0xeec33e[_0x3349e0][_0x4ad9('0x6e')]&&_0x5adfce[_0x4ad9('0x6f')](_0x515c41,_0xeec33e[_0x3349e0]['orderBy']===_0x4ad9('0x70')?![]:!![]);_0x5adfce[_0x4ad9('0x71')](_0x515c41,_0xeec33e[_0x3349e0][_0x4ad9('0x72')]||_0x515c41);}if(_0x131f02[_0x4ad9('0x73')]){_0x131f02[_0x4ad9('0x73')]=JSON['parse'](_0x131f02['joins']);for(var _0x5c09a9=0x0;_0x5c09a9<_0x131f02[_0x4ad9('0x73')][_0x4ad9('0x30')];_0x5c09a9+=0x1){if(_0x131f02[_0x4ad9('0x73')][_0x5c09a9][_0x4ad9('0x74')]&&_[_0x4ad9('0x5a')](_0x4e9f30,_0x131f02[_0x4ad9('0x73')][_0x5c09a9][_0x4ad9('0x74')])&&_0x131f02[_0x4ad9('0x73')][_0x5c09a9][_0x4ad9('0x75')]&&_0x131f02['joins'][_0x5c09a9][_0x4ad9('0x76')]&&_0x131f02[_0x4ad9('0x73')][_0x5c09a9][_0x4ad9('0x77')]){_0x5adfce[_0x131f02[_0x4ad9('0x73')][_0x5c09a9][_0x4ad9('0x74')]](_0x131f02[_0x4ad9('0x73')][_0x5c09a9]['foreignTable'],null,util['format'](_0x4ad9('0x78'),_0x131f02['table'],_0x131f02[_0x4ad9('0x73')][_0x5c09a9]['parentKey'],_0x131f02['joins'][_0x5c09a9][_0x4ad9('0x76')],_0x131f02['joins'][_0x5c09a9][_0x4ad9('0x77')]));}}}if(_0x131f02[_0x4ad9('0x79')]){_0x131f02[_0x4ad9('0x79')]=JSON[_0x4ad9('0x7a')](_0x131f02[_0x4ad9('0x79')]);_0x5adfce[_0x4ad9('0x32')](_0x512ead(_0x131f02['conditions'][_0x4ad9('0x5f')]));}_0xbd3572=_0x5adfce[_0x4ad9('0x7b')]();_0x5adfce['limit'](_0x36f5b7);_0x5adfce[_0x4ad9('0x19')](0x0);logger[_0x4ad9('0x7c')](_0x4ad9('0x7d'),_0x5adfce['toString']());return db[_0x4ad9('0x7e')]['query'](_0x5adfce[_0x4ad9('0x7f')](),{'type':db[_0x4ad9('0x7e')]['QueryTypes'][_0x4ad9('0x80')]});}})['then'](respondWithResult(_0x5a10a5,null))[_0x4ad9('0x3d')](handleError(_0x5a10a5,null));};function runReport(_0x3de801,_0x2a3192,_0x58d721){var _0xcbbb7b=_0x2a3192[_0x4ad9('0x26')];var _0x415188=0xa;var _0x3b4ac1=[_0x4ad9('0x4d'),_0x4ad9('0x4e'),_0x4ad9('0x4f'),_0x4ad9('0x50'),'cross_join'];var _0x313f91={'SUM':_0x4ad9('0x51'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ad9('0x52'),'MAX':'MAX(%s)','MIN':_0x4ad9('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ad9('0x55'),'GROUP_CONCAT ASC':_0x4ad9('0x81'),'GROUP_CONCAT DESC':_0x4ad9('0x56')};var _0x4b714a={'SEC_TO_TIME':_0x4ad9('0x57'),'DATE':_0x4ad9('0x82'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xddb1dc=function(_0x5f0207){return!_[_0x4ad9('0x5a')]([_0x4ad9('0x83'),'IS\x20NOT\x20NULL',_0x4ad9('0x5b'),_0x4ad9('0x5c')],_0x5f0207);};var _0x3133b8=function(_0x40c385){if(!_0x40c385||!_0x40c385[_0x4ad9('0x5d')][_0x4ad9('0x30')]){return'';}for(var _0xab3980='(',_0x465920=0x0;_0x465920<_0x40c385[_0x4ad9('0x5d')]['length'];_0x465920+=0x1){_0x465920>0x0&&(_0xab3980+='\x20'+_0x40c385[_0x4ad9('0x5e')]+'\x20');_0xab3980+=_0x40c385[_0x4ad9('0x5d')][_0x465920][_0x4ad9('0x5f')]?_0x3133b8(_0x40c385['rules'][_0x465920][_0x4ad9('0x5f')]):_0x40c385[_0x4ad9('0x5d')][_0x465920][_0x4ad9('0x71')]+'\x20'+_0x40c385[_0x4ad9('0x5d')][_0x465920][_0x4ad9('0x60')]+(_0xddb1dc(_0x40c385[_0x4ad9('0x5d')][_0x465920][_0x4ad9('0x60')])?'\x20'+_0x40c385[_0x4ad9('0x5d')][_0x465920][_0x4ad9('0x61')]:'');}return _0xab3980+')';};var _0x6ee26b={'where':{'id':_0x3de801['id']}},_0x4a8c7f,_0x5e5f8b,_0x329009,_0x28f3f6,_0x41ae96;_0x6ee26b=_[_0x4ad9('0x38')]({},_0x6ee26b,_0x58d721);return db['AnalyticDefaultReport'][_0x4ad9('0x41')](_0x6ee26b)[_0x4ad9('0x20')](function(_0x47258d){if(_0x47258d){_0x4a8c7f=_0x47258d;return _0x47258d[_0x4ad9('0x84')]();}return null;})[_0x4ad9('0x20')](function(_0x21af0d){if(_0x21af0d){if(!_0x21af0d[_0x4ad9('0x30')]){throw new db[(_0x4ad9('0x63'))]['ValidationErrorItem'](_0x4ad9('0x65'),0x193);}_0x5e5f8b=_0x21af0d;return db[_0x4ad9('0x85')][_0x4ad9('0x3c')]({'raw':!![]});}return null;})['then'](function(_0x53928a){if(_0x53928a){_0x329009=_[_0x4ad9('0x86')](_0x53928a,'id');var _0x2c9535;var _0x3b6b27=squel['select']();_0x3b6b27[_0x4ad9('0x67')](_0x4a8c7f[_0x4ad9('0x68')]);for(var _0x37d3bd=0x0;_0x37d3bd<_0x5e5f8b[_0x4ad9('0x30')];_0x37d3bd+=0x1){_0x2c9535=_0x5e5f8b[_0x37d3bd][_0x4ad9('0x69')]?_0x329009[_0x5e5f8b[_0x37d3bd]['MetricId']]['metric']:_0x5e5f8b[_0x37d3bd][_0x4ad9('0x71')];_0x2c9535=_0x5e5f8b[_0x37d3bd][_0x4ad9('0x87')]?_[_0x4ad9('0x6b')](_0x313f91[_0x5e5f8b[_0x37d3bd]['function']],'%s',_0x2c9535):_0x2c9535;_0x2c9535=_0x5e5f8b[_0x37d3bd][_0x4ad9('0x6c')]?_['replace'](_0x4b714a[_0x5e5f8b[_0x37d3bd][_0x4ad9('0x6c')]],'%s',_0x2c9535):_0x2c9535;if(_0x5e5f8b[_0x37d3bd]['groupBy']){_0x3b6b27['group'](_0x2c9535);}_0x5e5f8b[_0x37d3bd][_0x4ad9('0x6e')]&&_0x3b6b27[_0x4ad9('0x6f')](_0x2c9535,_0x5e5f8b[_0x37d3bd][_0x4ad9('0x6e')]===_0x4ad9('0x70')?![]:!![]);_0x3b6b27[_0x4ad9('0x71')](_0x2c9535,_0x5e5f8b[_0x37d3bd][_0x4ad9('0x72')]||_0x2c9535);}if(_0x4a8c7f[_0x4ad9('0x73')]){_0x4a8c7f['joins']=JSON['parse'](_0x4a8c7f['joins']);for(var _0x59dd6e=0x0;_0x59dd6e<_0x4a8c7f[_0x4ad9('0x73')][_0x4ad9('0x30')];_0x59dd6e+=0x1){if(_0x4a8c7f[_0x4ad9('0x73')][_0x59dd6e]['type']&&_[_0x4ad9('0x5a')](_0x3b4ac1,_0x4a8c7f['joins'][_0x59dd6e][_0x4ad9('0x74')])&&_0x4a8c7f[_0x4ad9('0x73')][_0x59dd6e][_0x4ad9('0x75')]&&_0x4a8c7f['joins'][_0x59dd6e]['foreignTable']&&_0x4a8c7f[_0x4ad9('0x73')][_0x59dd6e][_0x4ad9('0x77')]){_0x3b6b27[_0x4a8c7f[_0x4ad9('0x73')][_0x59dd6e][_0x4ad9('0x74')]](_0x4a8c7f['joins'][_0x59dd6e][_0x4ad9('0x76')],null,util[_0x4ad9('0x6c')](_0x4ad9('0x78'),_0x4a8c7f['table'],_0x4a8c7f['joins'][_0x59dd6e]['parentKey'],_0x4a8c7f['joins'][_0x59dd6e]['foreignTable'],_0x4a8c7f[_0x4ad9('0x73')][_0x59dd6e][_0x4ad9('0x77')]));}}}if(_0x4a8c7f['conditions']){_0x4a8c7f[_0x4ad9('0x79')]=JSON['parse'](_0x4a8c7f[_0x4ad9('0x79')]);_0x3b6b27[_0x4ad9('0x32')](_0x3133b8(_0x4a8c7f[_0x4ad9('0x79')]['group']));}_0x41ae96=_0x3b6b27[_0x4ad9('0x7b')]();_0x3b6b27['limit'](_0x415188);_0x3b6b27[_0x4ad9('0x19')](0x0);logger[_0x4ad9('0x7c')]('Limited\x20Query:',_0x3b6b27['toString']());return db[_0x4ad9('0x7e')]['query'](_0x3b6b27[_0x4ad9('0x7f')](),{'type':db['sequelize'][_0x4ad9('0x88')][_0x4ad9('0x80')]});}})[_0x4ad9('0x20')](function(_0x4a4bf5){if(!_0x4a4bf5[_0x4ad9('0x30')]){throw new db[(_0x4ad9('0x63'))][(_0x4ad9('0x64'))](_0x4ad9('0x89'),0xcc);}if(_0x2a3192['output']===_0x4ad9('0x8a')){return null;}var _0x19c636=_[_0x4ad9('0x38')](_0x2a3192,{'name':_0x2a3192[_0x4ad9('0x8b')]||_0x2a3192[_0x4ad9('0x26')]||_0x4a8c7f[_0x4ad9('0x26')],'basename':_0xcbbb7b,'savename':util[_0x4ad9('0x6c')]('%s-%s.%s',_0x2a3192['name']||_0x4a8c7f[_0x4ad9('0x26')],require('randomstring')[_0x4ad9('0x8c')](0x4),_0x2a3192[_0x4ad9('0x8d')]||_0x4ad9('0x8e')),'reportId':_0x4a8c7f['id'],'reportType':_0x4ad9('0x8f')});return db['AnalyticExtractedReport'][_0x4ad9('0x42')](_0x19c636,{'raw':!![]});})[_0x4ad9('0x20')](function(_0x5cd061){if(_0x4a8c7f[_0x4ad9('0x68')]===_0x4ad9('0x90')){_0x41ae96[_0x4ad9('0x32')](_0x4a8c7f[_0x4ad9('0x68')]+_0x4ad9('0x91'),_0x2a3192['startDate'],_0x2a3192[_0x4ad9('0x92')]);}else{_0x41ae96[_0x4ad9('0x32')](_0x4a8c7f['table']+_0x4ad9('0x93'),_0x2a3192['startDate'],_0x2a3192[_0x4ad9('0x92')]);}if(_0x5cd061){logger[_0x4ad9('0x94')](_0x4ad9('0x95'),_0x41ae96['toString']());require(_0x4ad9('0x96'))[_0x4ad9('0x97')](path[_0x4ad9('0x4d')](__dirname,_0x4ad9('0x98'),_0x5cd061['output']),[_0x5cd061['id'],_0x41ae96['toString'](),path['join'](__dirname,_0x4ad9('0x99'),_0x5cd061[_0x4ad9('0x9a')]),_0xcbbb7b]);return _0x5cd061;}else{var _0x10f714=squel[_0x4ad9('0x66')]();_0x10f714[_0x4ad9('0x67')]('('+_0x41ae96[_0x4ad9('0x7f')]()+')',_0x4ad9('0x9b'));_0x10f714[_0x4ad9('0x71')](_0x4ad9('0x9c'),'count');_0x41ae96[_0x4ad9('0x1a')](_0x2a3192['limit']||_0x415188);_0x41ae96[_0x4ad9('0x19')](_0x2a3192[_0x4ad9('0x19')]||0x0);return db['sequelize'][_0x4ad9('0x29')](_0x10f714[_0x4ad9('0x7f')](),{'type':db[_0x4ad9('0x7e')][_0x4ad9('0x88')]['SELECT']})['then'](function(_0xa8c95e){if(!_0xa8c95e[_0x4ad9('0x30')]){_0x28f3f6=0x0;}else{_0x28f3f6=_0xa8c95e[0x0]['count']||0x0;}return db[_0x4ad9('0x7e')]['query'](_0x41ae96[_0x4ad9('0x7f')](),{'type':db[_0x4ad9('0x7e')]['QueryTypes'][_0x4ad9('0x80')]});})[_0x4ad9('0x20')](function(_0x461e1f){return{'rows':_0x461e1f||[],'count':_0x28f3f6};});}});}exports['run']=function(_0x4f17e7,_0x55070e){return runReport(_0x4f17e7[_0x4ad9('0x62')],_0x4f17e7[_0x4ad9('0x29')],_0x4f17e7[_0x4ad9('0x3a')])[_0x4ad9('0x20')](respondWithResult(_0x55070e,null))[_0x4ad9('0x3d')](handleError(_0x55070e,null));};exports[_0x4ad9('0x9d')]=runReport;exports[_0x4ad9('0x29')]=function(_0x11cb58,_0x1eb561){var _0x1d9b6b=0xa;var _0x4c9104=[_0x4ad9('0x4d'),'left_join',_0x4ad9('0x4f'),_0x4ad9('0x50'),'cross_join'];var _0x278705={'SUM':_0x4ad9('0x51'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ad9('0x52'),'MAX':_0x4ad9('0x53'),'MIN':'MIN(%s)','AVG':_0x4ad9('0x9e'),'GROUP_CONCAT':_0x4ad9('0x55'),'GROUP_CONCAT ASC':_0x4ad9('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2a6aa9={'SEC_TO_TIME':_0x4ad9('0x57'),'DATE':'DATE(%s)','HOUR':_0x4ad9('0x58'),'ROUND':_0x4ad9('0x9f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x15a77e=function(_0x3ce908){return!_[_0x4ad9('0x5a')]([_0x4ad9('0x83'),_0x4ad9('0xa0'),_0x4ad9('0x5b'),_0x4ad9('0x5c')],_0x3ce908);};var _0x345d51=function(_0x4529ee){if(!_0x4529ee||!_0x4529ee[_0x4ad9('0x5d')][_0x4ad9('0x30')]){return'';}for(var _0x125dfe='(',_0xb53caa=0x0;_0xb53caa<_0x4529ee[_0x4ad9('0x5d')][_0x4ad9('0x30')];_0xb53caa+=0x1){_0xb53caa>0x0&&(_0x125dfe+='\x20'+_0x4529ee[_0x4ad9('0x5e')]+'\x20');_0x125dfe+=_0x4529ee[_0x4ad9('0x5d')][_0xb53caa]['group']?_0x345d51(_0x4529ee[_0x4ad9('0x5d')][_0xb53caa][_0x4ad9('0x5f')]):_0x4529ee['rules'][_0xb53caa][_0x4ad9('0x71')]+'\x20'+_0x4529ee[_0x4ad9('0x5d')][_0xb53caa]['condition']+(_0x15a77e(_0x4529ee[_0x4ad9('0x5d')][_0xb53caa][_0x4ad9('0x60')])?'\x20'+_0x4529ee[_0x4ad9('0x5d')][_0xb53caa]['value']:'');}return _0x125dfe+')';};var _0x14d2b3={'where':{'id':_0x11cb58[_0x4ad9('0x62')]['id']}},_0xfd6a1,_0x43f522,_0x285c17,_0x1eecb7,_0x420686;_0x14d2b3=_[_0x4ad9('0x38')]({},_0x14d2b3,_0x11cb58[_0x4ad9('0x3a')]);return db[_0x4ad9('0x27')][_0x4ad9('0x41')](_0x14d2b3)['then'](function(_0x5b32ea){if(_0x5b32ea){_0xfd6a1=_0x5b32ea;return _0x5b32ea[_0x4ad9('0x84')]();}return null;})[_0x4ad9('0x20')](function(_0x39ff8f){if(_0x39ff8f){if(!_0x39ff8f[_0x4ad9('0x30')]){throw new db[(_0x4ad9('0x63'))][(_0x4ad9('0x64'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x43f522=_0x39ff8f;return db[_0x4ad9('0x85')][_0x4ad9('0x3c')]({'raw':!![]});}return null;})[_0x4ad9('0x20')](function(_0x4fb743){if(_0x4fb743){_0x285c17=_['keyBy'](_0x4fb743,'id');var _0xe24567;var _0x3d64d5=squel[_0x4ad9('0x66')]();_0x3d64d5[_0x4ad9('0x67')](_0xfd6a1[_0x4ad9('0x68')]);for(var _0x1931a0=0x0;_0x1931a0<_0x43f522[_0x4ad9('0x30')];_0x1931a0+=0x1){_0xe24567=_0x43f522[_0x1931a0][_0x4ad9('0x69')]?_0x285c17[_0x43f522[_0x1931a0]['MetricId']][_0x4ad9('0x6a')]:_0x43f522[_0x1931a0][_0x4ad9('0x71')];_0xe24567=_0x43f522[_0x1931a0]['function']?_['replace'](_0x278705[_0x43f522[_0x1931a0][_0x4ad9('0x87')]],'%s',_0xe24567):_0xe24567;_0xe24567=_0x43f522[_0x1931a0][_0x4ad9('0x6c')]?_['replace'](_0x2a6aa9[_0x43f522[_0x1931a0][_0x4ad9('0x6c')]],'%s',_0xe24567):_0xe24567;if(_0x43f522[_0x1931a0][_0x4ad9('0x6d')]){_0x3d64d5['group'](_0xe24567);}_0x43f522[_0x1931a0][_0x4ad9('0x6e')]&&_0x3d64d5['order'](_0xe24567,_0x43f522[_0x1931a0]['orderBy']==='DESC'?![]:!![]);_0x3d64d5[_0x4ad9('0x71')](_0xe24567,_0x43f522[_0x1931a0][_0x4ad9('0x72')]||_0xe24567);}if(_0xfd6a1[_0x4ad9('0x73')]){_0xfd6a1[_0x4ad9('0x73')]=JSON[_0x4ad9('0x7a')](_0xfd6a1[_0x4ad9('0x73')]);for(var _0xe7ea4a=0x0;_0xe7ea4a<_0xfd6a1[_0x4ad9('0x73')][_0x4ad9('0x30')];_0xe7ea4a+=0x1){if(_0xfd6a1[_0x4ad9('0x73')][_0xe7ea4a][_0x4ad9('0x74')]&&_[_0x4ad9('0x5a')](_0x4c9104,_0xfd6a1[_0x4ad9('0x73')][_0xe7ea4a][_0x4ad9('0x74')])&&_0xfd6a1[_0x4ad9('0x73')][_0xe7ea4a][_0x4ad9('0x75')]&&_0xfd6a1[_0x4ad9('0x73')][_0xe7ea4a][_0x4ad9('0x76')]&&_0xfd6a1[_0x4ad9('0x73')][_0xe7ea4a][_0x4ad9('0x77')]){_0x3d64d5[_0xfd6a1[_0x4ad9('0x73')][_0xe7ea4a][_0x4ad9('0x74')]](_0xfd6a1['joins'][_0xe7ea4a]['foreignTable'],null,util[_0x4ad9('0x6c')]('%s.%s\x20=\x20%s.%s',_0xfd6a1[_0x4ad9('0x68')],_0xfd6a1[_0x4ad9('0x73')][_0xe7ea4a][_0x4ad9('0x75')],_0xfd6a1[_0x4ad9('0x73')][_0xe7ea4a][_0x4ad9('0x76')],_0xfd6a1[_0x4ad9('0x73')][_0xe7ea4a][_0x4ad9('0x77')]));}}}if(_0xfd6a1[_0x4ad9('0x79')]){_0xfd6a1[_0x4ad9('0x79')]=JSON[_0x4ad9('0x7a')](_0xfd6a1[_0x4ad9('0x79')]);_0x3d64d5[_0x4ad9('0x32')](_0x345d51(_0xfd6a1[_0x4ad9('0x79')][_0x4ad9('0x5f')]));}_0x420686=_0x3d64d5[_0x4ad9('0x7b')]();_0x3d64d5['limit'](_0x1d9b6b);_0x3d64d5[_0x4ad9('0x19')](0x0);logger[_0x4ad9('0x7c')](_0x4ad9('0x7d'),_0x3d64d5[_0x4ad9('0x7f')]());return db[_0x4ad9('0x7e')]['query'](_0x3d64d5[_0x4ad9('0x7f')](),{'type':db[_0x4ad9('0x7e')]['QueryTypes'][_0x4ad9('0x80')]});}})[_0x4ad9('0x20')](function(){return{'sql':_0x420686[_0x4ad9('0x7f')]()};})[_0x4ad9('0x20')](respondWithResult(_0x1eb561,null))[_0x4ad9('0x3d')](handleError(_0x1eb561,null));}; \ No newline at end of file +var _0x5cd0=['AnalyticDefaultReport','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','rows','show','params','length','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','outer_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','MAX(%s)','MIN(%s)','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','AnalyticMetric','No\x20available\x20data','output','fullPath','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','../../components/export/','../../files/reports','savename','run','operator','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','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','stack','name','send','index'];(function(_0x56c8a5,_0x2a981d){var _0x3ece5f=function(_0x2a90ab){while(--_0x2a90ab){_0x56c8a5['push'](_0x56c8a5['shift']());}};_0x3ece5f(++_0x2a981d);}(_0x5cd0,0x78));var _0x05cd=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5cd0[_0x199572];return _0x13cfa3;};'use strict';var pdf=require(_0x05cd('0x0'));var emlformat=require(_0x05cd('0x1'));var rimraf=require(_0x05cd('0x2'));var zipdir=require(_0x05cd('0x3'));var jsonpatch=require(_0x05cd('0x4'));var rp=require('request-promise');var moment=require(_0x05cd('0x5'));var BPromise=require(_0x05cd('0x6'));var Mustache=require(_0x05cd('0x7'));var util=require(_0x05cd('0x8'));var path=require(_0x05cd('0x9'));var sox=require(_0x05cd('0xa'));var csv=require(_0x05cd('0xb'));var ejs=require(_0x05cd('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x05cd('0xd'));var crypto=require(_0x05cd('0xe'));var jsforce=require(_0x05cd('0xf'));var deskjs=require(_0x05cd('0x10'));var toCsv=require(_0x05cd('0xb'));var querystring=require(_0x05cd('0x11'));var Papa=require(_0x05cd('0x12'));var Redis=require(_0x05cd('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x05cd('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x05cd('0x15'));var db=require(_0x05cd('0x16'))['db'];function respondWithStatusCode(_0x2a1408,_0x5ea6b9){_0x5ea6b9=_0x5ea6b9||0xcc;return function(_0x5812a5){if(_0x5812a5){return _0x2a1408[_0x05cd('0x17')](_0x5ea6b9);}return _0x2a1408[_0x05cd('0x18')](_0x5ea6b9)[_0x05cd('0x19')]();};}function respondWithResult(_0x3b35e9,_0x40956e){_0x40956e=_0x40956e||0xc8;return function(_0x3f8b55){if(_0x3f8b55){return _0x3b35e9[_0x05cd('0x18')](_0x40956e)['json'](_0x3f8b55);}};}function respondWithFilteredResult(_0x9946a2,_0x4ad9e4){return function(_0xa6d48a){if(_0xa6d48a){var _0x46c135=_0xa6d48a[_0x05cd('0x1a')],_0x3db4f9=_0x4ad9e4[_0x05cd('0x1b')],_0x5437c8=_0x4ad9e4[_0x05cd('0x1b')]+_0x4ad9e4[_0x05cd('0x1c')],_0xc66df0;if(_0x5437c8>=_0x46c135){_0x5437c8=_0x46c135;_0xc66df0=0xc8;}else{_0xc66df0=0xce;}_0x9946a2[_0x05cd('0x18')](_0xc66df0);return _0x9946a2[_0x05cd('0x1d')]('Content-Range',_0x3db4f9+'-'+_0x5437c8+'/'+_0x46c135)[_0x05cd('0x1e')](_0xa6d48a);}return null;};}function patchUpdates(_0x1357f){return function(_0x2b416c){try{jsonpatch[_0x05cd('0x1f')](_0x2b416c,_0x1357f,!![]);}catch(_0x5837b1){return BPromise[_0x05cd('0x20')](_0x5837b1);}return _0x2b416c[_0x05cd('0x21')]();};}function saveUpdates(_0xa4d380,_0x585b88){return function(_0x4e085e){if(_0x4e085e){return _0x4e085e[_0x05cd('0x22')](_0xa4d380)[_0x05cd('0x23')](function(_0x5ebe66){return _0x5ebe66;});}return null;};}function removeEntity(_0x4414b3,_0x3e057d){return function(_0x2749ab){if(_0x2749ab){return _0x2749ab[_0x05cd('0x24')]()[_0x05cd('0x23')](function(){var _0x357a38=_0x2749ab[_0x05cd('0x25')]({'plain':!![]});var _0x3e5aaa=_0x05cd('0x26');return db[_0x05cd('0x27')]['destroy']({'where':{'type':_0x3e5aaa,'resourceId':_0x357a38['id']}})[_0x05cd('0x23')](function(){return _0x2749ab;});})[_0x05cd('0x23')](function(){_0x4414b3['status'](0xcc)[_0x05cd('0x19')]();});}};}function handleEntityNotFound(_0x5ae07d,_0x5e3b2a){return function(_0x547b8b){if(!_0x547b8b){_0x5ae07d[_0x05cd('0x17')](0x194);}return _0x547b8b;};}function handleError(_0x26efc9,_0x7f471b){_0x7f471b=_0x7f471b||0x1f4;return function(_0x45be96){logger['error'](_0x45be96[_0x05cd('0x28')]);if(_0x45be96[_0x05cd('0x29')]){delete _0x45be96[_0x05cd('0x29')];}_0x26efc9[_0x05cd('0x18')](_0x7f471b)[_0x05cd('0x2a')](_0x45be96);};}exports[_0x05cd('0x2b')]=function(_0x445500,_0x37ad3b){var _0x3bec95={},_0x2b85fc={},_0x2088e3={'count':0x0,'rows':[]};var _0xf8ce2e=db[_0x05cd('0x2c')]['rawAttributes'];_0x2b85fc[_0x05cd('0x2d')]=_[_0x05cd('0x2e')](_0xf8ce2e);var _0x26214a={'dateStart':_0x445500[_0x05cd('0x2f')][_0x05cd('0x30')],'dateEnd':_0x445500[_0x05cd('0x2f')][_0x05cd('0x31')]};delete _0x445500[_0x05cd('0x2f')]['dateStart'];delete _0x445500[_0x05cd('0x2f')][_0x05cd('0x31')];_0x2b85fc[_0x05cd('0x2f')]=_[_0x05cd('0x2e')](_0x445500[_0x05cd('0x2f')]);_0x2b85fc['filters']=_[_0x05cd('0x32')](_0x2b85fc[_0x05cd('0x2d')],_0x2b85fc[_0x05cd('0x2f')]);_0x3bec95['attributes']=_[_0x05cd('0x32')](_0x2b85fc[_0x05cd('0x2d')],qs[_0x05cd('0x33')](_0x445500[_0x05cd('0x2f')][_0x05cd('0x33')]));_0x3bec95['attributes']=_0x3bec95[_0x05cd('0x34')]['length']?_0x3bec95[_0x05cd('0x34')]:_0x2b85fc[_0x05cd('0x2d')];if(!_0x445500['query'][_0x05cd('0x35')](_0x05cd('0x36'))){_0x3bec95[_0x05cd('0x1c')]=qs[_0x05cd('0x1c')](_0x445500[_0x05cd('0x2f')]['limit']);_0x3bec95[_0x05cd('0x1b')]=qs[_0x05cd('0x1b')](_0x445500[_0x05cd('0x2f')]['offset']);}_0x3bec95[_0x05cd('0x37')]=qs[_0x05cd('0x38')](_0x445500[_0x05cd('0x2f')][_0x05cd('0x38')]);_0x3bec95[_0x05cd('0x39')]=qs[_0x05cd('0x3a')](_[_0x05cd('0x3b')](_0x445500[_0x05cd('0x2f')],_0x2b85fc[_0x05cd('0x3a')]));if(_0x26214a[_0x05cd('0x30')]){if(_0x26214a[_0x05cd('0x31')]){_0x26214a['dateEnd']=moment(_0x26214a[_0x05cd('0x31')])[_0x05cd('0x3c')](0x1,_0x05cd('0x3d'));}else{_0x26214a[_0x05cd('0x31')]=moment(_0x26214a[_0x05cd('0x30')])[_0x05cd('0x3c')](0x1,_0x05cd('0x3d'));}_[_0x05cd('0x3e')](_0x3bec95[_0x05cd('0x39')],{'createdAt':{'$gte':_0x26214a[_0x05cd('0x30')],'$lte':_0x26214a[_0x05cd('0x31')]}});}if(_0x445500[_0x05cd('0x2f')][_0x05cd('0x3f')]){_0x3bec95[_0x05cd('0x39')]=_[_0x05cd('0x3e')](_0x3bec95[_0x05cd('0x39')],{'$or':_[_0x05cd('0x40')](_0x3bec95[_0x05cd('0x34')],function(_0x1e671f){var _0x1f34aa={};_0x1f34aa[_0x1e671f]={'$like':'%'+_0x445500[_0x05cd('0x2f')][_0x05cd('0x3f')]+'%'};return _0x1f34aa;})});}_0x3bec95=_[_0x05cd('0x3e')]({},_0x3bec95,_0x445500[_0x05cd('0x41')]);var _0x4dd3c2={'where':_0x3bec95[_0x05cd('0x39')]};return db['AnalyticDefaultReport'][_0x05cd('0x1a')](_0x4dd3c2)[_0x05cd('0x23')](function(_0x20a26f){_0x2088e3[_0x05cd('0x1a')]=_0x20a26f;if(_0x445500['query'][_0x05cd('0x42')]){_0x3bec95['include']=[{'all':!![]}];}return db[_0x05cd('0x2c')]['findAll'](_0x3bec95);})[_0x05cd('0x23')](function(_0x7072c5){_0x2088e3[_0x05cd('0x43')]=_0x7072c5;return _0x2088e3;})[_0x05cd('0x23')](respondWithFilteredResult(_0x37ad3b,_0x3bec95))['catch'](handleError(_0x37ad3b,null));};exports[_0x05cd('0x44')]=function(_0x10a3ec,_0x30904e){var _0x56902d={'raw':!![],'where':{'id':_0x10a3ec[_0x05cd('0x45')]['id']}},_0x10041c={};_0x10041c[_0x05cd('0x2d')]=_[_0x05cd('0x2e')](db[_0x05cd('0x2c')]['rawAttributes']);_0x10041c['query']=_[_0x05cd('0x2e')](_0x10a3ec[_0x05cd('0x2f')]);_0x10041c[_0x05cd('0x3a')]=_[_0x05cd('0x32')](_0x10041c[_0x05cd('0x2d')],_0x10041c[_0x05cd('0x2f')]);_0x56902d[_0x05cd('0x34')]=_[_0x05cd('0x32')](_0x10041c['model'],qs[_0x05cd('0x33')](_0x10a3ec[_0x05cd('0x2f')][_0x05cd('0x33')]));_0x56902d[_0x05cd('0x34')]=_0x56902d[_0x05cd('0x34')][_0x05cd('0x46')]?_0x56902d[_0x05cd('0x34')]:_0x10041c[_0x05cd('0x2d')];if(_0x10a3ec['query'][_0x05cd('0x42')]){_0x56902d[_0x05cd('0x47')]=[{'all':!![]}];}_0x56902d=_[_0x05cd('0x3e')]({},_0x56902d,_0x10a3ec[_0x05cd('0x41')]);return db[_0x05cd('0x2c')]['find'](_0x56902d)[_0x05cd('0x23')](handleEntityNotFound(_0x30904e,null))[_0x05cd('0x23')](respondWithResult(_0x30904e,null))[_0x05cd('0x48')](handleError(_0x30904e,null));};exports[_0x05cd('0x49')]=function(_0x582e0e,_0x1e7480){return db[_0x05cd('0x2c')][_0x05cd('0x49')](_0x582e0e[_0x05cd('0x4a')],{})[_0x05cd('0x23')](function(_0xea721a){var _0x569f80=_0x582e0e[_0x05cd('0x4b')][_0x05cd('0x25')]({'plain':!![]});if(!_0x569f80)throw new Error(_0x05cd('0x4c'));if(_0x569f80[_0x05cd('0x4d')]==='user'){var _0xfbea71=_0xea721a[_0x05cd('0x25')]({'plain':!![]});var _0x72ddee='Reports';return db['UserProfileSection'][_0x05cd('0x4e')]({'where':{'name':_0x72ddee,'userProfileId':_0x569f80[_0x05cd('0x4f')]},'raw':!![]})[_0x05cd('0x23')](function(_0x326ec5){if(_0x326ec5&&_0x326ec5[_0x05cd('0x50')]===0x0){return db[_0x05cd('0x27')][_0x05cd('0x49')]({'name':_0xfbea71['name'],'resourceId':_0xfbea71['id'],'type':_0x05cd('0x26'),'sectionId':_0x326ec5['id']},{})[_0x05cd('0x23')](function(){return _0xea721a;});}else{return _0xea721a;}})[_0x05cd('0x48')](function(_0x38fc5a){logger[_0x05cd('0x51')](_0x05cd('0x52'),_0x38fc5a);throw _0x38fc5a;});}return _0xea721a;})[_0x05cd('0x23')](respondWithResult(_0x1e7480,0xc9))[_0x05cd('0x48')](handleError(_0x1e7480,null));};exports['update']=function(_0x18a91c,_0x4328c5){if(_0x18a91c[_0x05cd('0x4a')]['id']){delete _0x18a91c[_0x05cd('0x4a')]['id'];}return db[_0x05cd('0x2c')]['find']({'where':{'id':_0x18a91c[_0x05cd('0x45')]['id']}})[_0x05cd('0x23')](handleEntityNotFound(_0x4328c5,null))[_0x05cd('0x23')](saveUpdates(_0x18a91c[_0x05cd('0x4a')],null))[_0x05cd('0x23')](respondWithResult(_0x4328c5,null))['catch'](handleError(_0x4328c5,null));};exports['destroy']=function(_0x5046c9,_0x12a013){return db[_0x05cd('0x2c')][_0x05cd('0x4e')]({'where':{'id':_0x5046c9[_0x05cd('0x45')]['id']}})[_0x05cd('0x23')](handleEntityNotFound(_0x12a013,null))[_0x05cd('0x23')](removeEntity(_0x12a013,null))['catch'](handleError(_0x12a013,null));};exports[_0x05cd('0x53')]=function(_0x1ce889,_0x34cf67){var _0x677b44=0xa;var _0x4e1adc=[_0x05cd('0x54'),_0x05cd('0x55'),_0x05cd('0x56'),_0x05cd('0x57'),_0x05cd('0x58')];var _0x3eaa60={'SUM':_0x05cd('0x59'),'COUNT':_0x05cd('0x5a'),'COUNT DISTINCT':_0x05cd('0x5b'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x05cd('0x5c'),'GROUP_CONCAT':_0x05cd('0x5d'),'GROUP_CONCAT ASC':_0x05cd('0x5e'),'GROUP_CONCAT DESC':_0x05cd('0x5f')};var _0x107564={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x05cd('0x60'),'HOUR':_0x05cd('0x61'),'ROUND':_0x05cd('0x62'),'UNIX_TIMESTAMP':_0x05cd('0x63')};var _0x27f4c0=function(_0xe5edd1){return!_[_0x05cd('0x64')]([_0x05cd('0x65'),_0x05cd('0x66'),'IS\x20EMPTY',_0x05cd('0x67')],_0xe5edd1);};var _0x288908=function(_0x5235d6){if(!_0x5235d6||!_0x5235d6[_0x05cd('0x68')]['length']){return'';}for(var _0x68a106='(',_0x672e40=0x0;_0x672e40<_0x5235d6[_0x05cd('0x68')][_0x05cd('0x46')];_0x672e40+=0x1){_0x672e40>0x0&&(_0x68a106+='\x20'+_0x5235d6['operator']+'\x20');_0x68a106+=_0x5235d6[_0x05cd('0x68')][_0x672e40][_0x05cd('0x69')]?_0x288908(_0x5235d6['rules'][_0x672e40][_0x05cd('0x69')]):_0x5235d6['rules'][_0x672e40][_0x05cd('0x6a')]+'\x20'+_0x5235d6[_0x05cd('0x68')][_0x672e40][_0x05cd('0x6b')]+(_0x27f4c0(_0x5235d6[_0x05cd('0x68')][_0x672e40][_0x05cd('0x6b')])?'\x20'+_0x5235d6[_0x05cd('0x68')][_0x672e40][_0x05cd('0x6c')]:'');}return _0x68a106+')';};var _0x4422d9={'where':{'id':_0x1ce889[_0x05cd('0x45')]['id']}},_0x4932d9,_0x56ebc1,_0x1907e2,_0x2667a5,_0x1911ac;_0x4422d9=_[_0x05cd('0x3e')]({},_0x4422d9,_0x1ce889['options']);return db['AnalyticDefaultReport'][_0x05cd('0x4e')](_0x4422d9)[_0x05cd('0x23')](function(_0x42cc17){if(_0x42cc17){_0x4932d9=_0x42cc17;return _0x42cc17[_0x05cd('0x6d')]();}return null;})[_0x05cd('0x23')](function(_0x3f1b90){if(_0x3f1b90){if(!_0x3f1b90[_0x05cd('0x46')]){throw new db['Sequelize'][(_0x05cd('0x6e'))](_0x05cd('0x6f'),0x193);}_0x56ebc1=_0x3f1b90;return db['AnalyticMetric'][_0x05cd('0x70')]({'raw':!![]});}return null;})['then'](function(_0x4ff782){if(_0x4ff782){_0x1907e2=_[_0x05cd('0x71')](_0x4ff782,'id');var _0x2716b1;var _0x30cbd0=squel[_0x05cd('0x72')]();_0x30cbd0[_0x05cd('0x73')](_0x4932d9[_0x05cd('0x74')]);for(var _0x37a664=0x0;_0x37a664<_0x56ebc1[_0x05cd('0x46')];_0x37a664+=0x1){_0x2716b1=_0x56ebc1[_0x37a664][_0x05cd('0x75')]?_0x1907e2[_0x56ebc1[_0x37a664][_0x05cd('0x75')]][_0x05cd('0x76')]:_0x56ebc1[_0x37a664][_0x05cd('0x6a')];_0x2716b1=_0x56ebc1[_0x37a664]['function']?_['replace'](_0x3eaa60[_0x56ebc1[_0x37a664][_0x05cd('0x77')]],'%s',_0x2716b1):_0x2716b1;_0x2716b1=_0x56ebc1[_0x37a664][_0x05cd('0x78')]?_[_0x05cd('0x79')](_0x107564[_0x56ebc1[_0x37a664][_0x05cd('0x78')]],'%s',_0x2716b1):_0x2716b1;if(_0x56ebc1[_0x37a664][_0x05cd('0x7a')]){_0x30cbd0[_0x05cd('0x69')](_0x2716b1);}_0x56ebc1[_0x37a664]['orderBy']&&_0x30cbd0['order'](_0x2716b1,_0x56ebc1[_0x37a664][_0x05cd('0x7b')]===_0x05cd('0x7c')?![]:!![]);_0x30cbd0['field'](_0x2716b1,_0x56ebc1[_0x37a664][_0x05cd('0x7d')]||_0x2716b1);}if(_0x4932d9[_0x05cd('0x7e')]){_0x4932d9[_0x05cd('0x7e')]=JSON[_0x05cd('0x7f')](_0x4932d9[_0x05cd('0x7e')]);for(var _0x565d45=0x0;_0x565d45<_0x4932d9[_0x05cd('0x7e')][_0x05cd('0x46')];_0x565d45+=0x1){if(_0x4932d9[_0x05cd('0x7e')][_0x565d45][_0x05cd('0x80')]&&_[_0x05cd('0x64')](_0x4e1adc,_0x4932d9[_0x05cd('0x7e')][_0x565d45][_0x05cd('0x80')])&&_0x4932d9['joins'][_0x565d45][_0x05cd('0x81')]&&_0x4932d9[_0x05cd('0x7e')][_0x565d45][_0x05cd('0x82')]&&_0x4932d9[_0x05cd('0x7e')][_0x565d45][_0x05cd('0x83')]){_0x30cbd0[_0x4932d9[_0x05cd('0x7e')][_0x565d45][_0x05cd('0x80')]](_0x4932d9[_0x05cd('0x7e')][_0x565d45][_0x05cd('0x82')],null,util['format'](_0x05cd('0x84'),_0x4932d9[_0x05cd('0x74')],_0x4932d9['joins'][_0x565d45][_0x05cd('0x81')],_0x4932d9[_0x05cd('0x7e')][_0x565d45][_0x05cd('0x82')],_0x4932d9[_0x05cd('0x7e')][_0x565d45][_0x05cd('0x83')]));}}}if(_0x4932d9['conditions']){_0x4932d9['conditions']=JSON[_0x05cd('0x7f')](_0x4932d9['conditions']);_0x30cbd0['where'](_0x288908(_0x4932d9[_0x05cd('0x85')][_0x05cd('0x69')]));}_0x1911ac=_0x30cbd0[_0x05cd('0x86')]();_0x30cbd0[_0x05cd('0x1c')](_0x677b44);_0x30cbd0[_0x05cd('0x1b')](0x0);logger[_0x05cd('0x87')](_0x05cd('0x88'),_0x30cbd0['toString']());return db[_0x05cd('0x89')][_0x05cd('0x2f')](_0x30cbd0[_0x05cd('0x8a')](),{'type':db[_0x05cd('0x89')][_0x05cd('0x8b')][_0x05cd('0x8c')]});}})['then'](respondWithResult(_0x34cf67,null))[_0x05cd('0x48')](handleError(_0x34cf67,null));};function runReport(_0x521247,_0x24db9d,_0x5d8c25){var _0x5abf95=_0x24db9d[_0x05cd('0x29')];var _0x585bcc=0xa;var _0x4647b6=[_0x05cd('0x54'),_0x05cd('0x55'),_0x05cd('0x56'),_0x05cd('0x57'),_0x05cd('0x58')];var _0x4c67e4={'SUM':_0x05cd('0x59'),'COUNT':_0x05cd('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x05cd('0x8d'),'MIN':_0x05cd('0x8e'),'AVG':_0x05cd('0x5c'),'GROUP_CONCAT':_0x05cd('0x5d'),'GROUP_CONCAT ASC':_0x05cd('0x5e'),'GROUP_CONCAT DESC':_0x05cd('0x5f')};var _0x323a91={'SEC_TO_TIME':_0x05cd('0x8f'),'DATE':_0x05cd('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x05cd('0x62'),'UNIX_TIMESTAMP':_0x05cd('0x63')};var _0x179096=function(_0x3f7667){return!_[_0x05cd('0x64')](['IS\x20NULL',_0x05cd('0x66'),_0x05cd('0x90'),_0x05cd('0x67')],_0x3f7667);};var _0x287a68=function(_0x4b411b){if(!_0x4b411b||!_0x4b411b[_0x05cd('0x68')][_0x05cd('0x46')]){return'';}for(var _0x16abb8='(',_0xb22a52=0x0;_0xb22a52<_0x4b411b[_0x05cd('0x68')][_0x05cd('0x46')];_0xb22a52+=0x1){_0xb22a52>0x0&&(_0x16abb8+='\x20'+_0x4b411b['operator']+'\x20');_0x16abb8+=_0x4b411b[_0x05cd('0x68')][_0xb22a52][_0x05cd('0x69')]?_0x287a68(_0x4b411b[_0x05cd('0x68')][_0xb22a52]['group']):_0x4b411b[_0x05cd('0x68')][_0xb22a52][_0x05cd('0x6a')]+'\x20'+_0x4b411b[_0x05cd('0x68')][_0xb22a52]['condition']+(_0x179096(_0x4b411b['rules'][_0xb22a52][_0x05cd('0x6b')])?'\x20'+_0x4b411b[_0x05cd('0x68')][_0xb22a52]['value']:'');}return _0x16abb8+')';};var _0x19a883={'where':{'id':_0x521247['id']}},_0x42d982,_0x13a6c0,_0x2b5ec4,_0x2c09a6,_0x495a8b;_0x19a883=_[_0x05cd('0x3e')]({},_0x19a883,_0x5d8c25);return db[_0x05cd('0x2c')][_0x05cd('0x4e')](_0x19a883)[_0x05cd('0x23')](function(_0x108e4f){if(_0x108e4f){_0x42d982=_0x108e4f;return _0x108e4f[_0x05cd('0x6d')]();}return null;})['then'](function(_0x2b1beb){if(_0x2b1beb){if(!_0x2b1beb[_0x05cd('0x46')]){throw new db[(_0x05cd('0x91'))][(_0x05cd('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x13a6c0=_0x2b1beb;return db[_0x05cd('0x92')][_0x05cd('0x70')]({'raw':!![]});}return null;})[_0x05cd('0x23')](function(_0x59e3fa){if(_0x59e3fa){_0x2b5ec4=_[_0x05cd('0x71')](_0x59e3fa,'id');var _0x42ca9d;var _0x5b6d9b=squel[_0x05cd('0x72')]();_0x5b6d9b[_0x05cd('0x73')](_0x42d982[_0x05cd('0x74')]);for(var _0x60986=0x0;_0x60986<_0x13a6c0[_0x05cd('0x46')];_0x60986+=0x1){_0x42ca9d=_0x13a6c0[_0x60986]['MetricId']?_0x2b5ec4[_0x13a6c0[_0x60986][_0x05cd('0x75')]][_0x05cd('0x76')]:_0x13a6c0[_0x60986]['field'];_0x42ca9d=_0x13a6c0[_0x60986][_0x05cd('0x77')]?_[_0x05cd('0x79')](_0x4c67e4[_0x13a6c0[_0x60986]['function']],'%s',_0x42ca9d):_0x42ca9d;_0x42ca9d=_0x13a6c0[_0x60986][_0x05cd('0x78')]?_[_0x05cd('0x79')](_0x323a91[_0x13a6c0[_0x60986]['format']],'%s',_0x42ca9d):_0x42ca9d;if(_0x13a6c0[_0x60986][_0x05cd('0x7a')]){_0x5b6d9b['group'](_0x42ca9d);}_0x13a6c0[_0x60986]['orderBy']&&_0x5b6d9b[_0x05cd('0x37')](_0x42ca9d,_0x13a6c0[_0x60986][_0x05cd('0x7b')]===_0x05cd('0x7c')?![]:!![]);_0x5b6d9b[_0x05cd('0x6a')](_0x42ca9d,_0x13a6c0[_0x60986][_0x05cd('0x7d')]||_0x42ca9d);}if(_0x42d982[_0x05cd('0x7e')]){_0x42d982[_0x05cd('0x7e')]=JSON[_0x05cd('0x7f')](_0x42d982[_0x05cd('0x7e')]);for(var _0x5ca4b6=0x0;_0x5ca4b6<_0x42d982[_0x05cd('0x7e')][_0x05cd('0x46')];_0x5ca4b6+=0x1){if(_0x42d982[_0x05cd('0x7e')][_0x5ca4b6][_0x05cd('0x80')]&&_[_0x05cd('0x64')](_0x4647b6,_0x42d982[_0x05cd('0x7e')][_0x5ca4b6]['type'])&&_0x42d982[_0x05cd('0x7e')][_0x5ca4b6][_0x05cd('0x81')]&&_0x42d982['joins'][_0x5ca4b6]['foreignTable']&&_0x42d982[_0x05cd('0x7e')][_0x5ca4b6][_0x05cd('0x83')]){_0x5b6d9b[_0x42d982[_0x05cd('0x7e')][_0x5ca4b6][_0x05cd('0x80')]](_0x42d982[_0x05cd('0x7e')][_0x5ca4b6]['foreignTable'],null,util[_0x05cd('0x78')](_0x05cd('0x84'),_0x42d982[_0x05cd('0x74')],_0x42d982[_0x05cd('0x7e')][_0x5ca4b6][_0x05cd('0x81')],_0x42d982[_0x05cd('0x7e')][_0x5ca4b6][_0x05cd('0x82')],_0x42d982[_0x05cd('0x7e')][_0x5ca4b6][_0x05cd('0x83')]));}}}if(_0x42d982[_0x05cd('0x85')]){_0x42d982['conditions']=JSON['parse'](_0x42d982[_0x05cd('0x85')]);_0x5b6d9b[_0x05cd('0x39')](_0x287a68(_0x42d982['conditions']['group']));}_0x495a8b=_0x5b6d9b[_0x05cd('0x86')]();_0x5b6d9b[_0x05cd('0x1c')](_0x585bcc);_0x5b6d9b['offset'](0x0);logger[_0x05cd('0x87')](_0x05cd('0x88'),_0x5b6d9b[_0x05cd('0x8a')]());return db['sequelize']['query'](_0x5b6d9b[_0x05cd('0x8a')](),{'type':db['sequelize']['QueryTypes'][_0x05cd('0x8c')]});}})['then'](function(_0x3a6180){if(!_0x3a6180[_0x05cd('0x46')]){throw new db[(_0x05cd('0x91'))][(_0x05cd('0x6e'))](_0x05cd('0x93'),0xcc);}if(_0x24db9d[_0x05cd('0x94')]==='web'){return null;}var _0x292e40=_[_0x05cd('0x3e')](_0x24db9d,{'name':_0x24db9d[_0x05cd('0x95')]||_0x24db9d[_0x05cd('0x29')]||_0x42d982[_0x05cd('0x29')],'basename':_0x5abf95,'savename':util[_0x05cd('0x78')]('%s-%s.%s',_0x24db9d['name']||_0x42d982[_0x05cd('0x29')],require(_0x05cd('0x96'))['generate'](0x4),_0x24db9d[_0x05cd('0x94')]||_0x05cd('0x97')),'reportId':_0x42d982['id'],'reportType':'default'});return db[_0x05cd('0x98')][_0x05cd('0x49')](_0x292e40,{'raw':!![]});})['then'](function(_0x46f694){if(_0x42d982['table']===_0x05cd('0x99')){_0x495a8b[_0x05cd('0x39')](_0x42d982['table']+_0x05cd('0x9a'),_0x24db9d[_0x05cd('0x9b')],_0x24db9d[_0x05cd('0x9c')]);}else{_0x495a8b['where'](_0x42d982[_0x05cd('0x74')]+_0x05cd('0x9d'),_0x24db9d[_0x05cd('0x9b')],_0x24db9d['endDate']);}if(_0x46f694){logger['info']('Run\x20Query:',_0x495a8b[_0x05cd('0x8a')]());require(_0x05cd('0x9e'))['fork'](path['join'](__dirname,_0x05cd('0x9f'),_0x46f694[_0x05cd('0x94')]),[_0x46f694['id'],_0x495a8b['toString'](),path[_0x05cd('0x54')](__dirname,_0x05cd('0xa0'),_0x46f694[_0x05cd('0xa1')]),_0x5abf95]);return _0x46f694;}else{var _0x38aa11=squel['select']();_0x38aa11['from']('('+_0x495a8b['toString']()+')','countTable');_0x38aa11[_0x05cd('0x6a')]('COUNT(*)',_0x05cd('0x1a'));_0x495a8b[_0x05cd('0x1c')](_0x24db9d['limit']||_0x585bcc);_0x495a8b[_0x05cd('0x1b')](_0x24db9d[_0x05cd('0x1b')]||0x0);return db[_0x05cd('0x89')]['query'](_0x38aa11[_0x05cd('0x8a')](),{'type':db[_0x05cd('0x89')][_0x05cd('0x8b')][_0x05cd('0x8c')]})['then'](function(_0x235740){if(!_0x235740['length']){_0x2c09a6=0x0;}else{_0x2c09a6=_0x235740[0x0][_0x05cd('0x1a')]||0x0;}return db[_0x05cd('0x89')][_0x05cd('0x2f')](_0x495a8b[_0x05cd('0x8a')](),{'type':db['sequelize'][_0x05cd('0x8b')][_0x05cd('0x8c')]});})[_0x05cd('0x23')](function(_0x2d5513){return{'rows':_0x2d5513||[],'count':_0x2c09a6};});}});}exports[_0x05cd('0xa2')]=function(_0x551fb5,_0x465248){return runReport(_0x551fb5['params'],_0x551fb5[_0x05cd('0x2f')],_0x551fb5[_0x05cd('0x41')])['then'](respondWithResult(_0x465248,null))['catch'](handleError(_0x465248,null));};exports['runReport']=runReport;exports['query']=function(_0x17274e,_0x2e7a7b){var _0x30255c=0xa;var _0x38f001=['join','left_join',_0x05cd('0x56'),'outer_join',_0x05cd('0x58')];var _0x3760a2={'SUM':_0x05cd('0x59'),'COUNT':_0x05cd('0x5a'),'COUNT DISTINCT':_0x05cd('0x5b'),'MAX':_0x05cd('0x8d'),'MIN':_0x05cd('0x8e'),'AVG':_0x05cd('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x05cd('0x5f')};var _0x1fe26a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x05cd('0x61'),'ROUND':_0x05cd('0x62'),'UNIX_TIMESTAMP':_0x05cd('0x63')};var _0x28fd2e=function(_0x247063){return!_[_0x05cd('0x64')](['IS\x20NULL',_0x05cd('0x66'),_0x05cd('0x90'),_0x05cd('0x67')],_0x247063);};var _0x29279f=function(_0x18905e){if(!_0x18905e||!_0x18905e[_0x05cd('0x68')][_0x05cd('0x46')]){return'';}for(var _0x39478e='(',_0x410d81=0x0;_0x410d81<_0x18905e[_0x05cd('0x68')]['length'];_0x410d81+=0x1){_0x410d81>0x0&&(_0x39478e+='\x20'+_0x18905e[_0x05cd('0xa3')]+'\x20');_0x39478e+=_0x18905e[_0x05cd('0x68')][_0x410d81][_0x05cd('0x69')]?_0x29279f(_0x18905e[_0x05cd('0x68')][_0x410d81][_0x05cd('0x69')]):_0x18905e[_0x05cd('0x68')][_0x410d81][_0x05cd('0x6a')]+'\x20'+_0x18905e[_0x05cd('0x68')][_0x410d81][_0x05cd('0x6b')]+(_0x28fd2e(_0x18905e[_0x05cd('0x68')][_0x410d81]['condition'])?'\x20'+_0x18905e[_0x05cd('0x68')][_0x410d81]['value']:'');}return _0x39478e+')';};var _0x46263a={'where':{'id':_0x17274e[_0x05cd('0x45')]['id']}},_0x4fb419,_0x52a2d8,_0x165493,_0x5a7bb5,_0x582cdc;_0x46263a=_['merge']({},_0x46263a,_0x17274e['options']);return db[_0x05cd('0x2c')][_0x05cd('0x4e')](_0x46263a)[_0x05cd('0x23')](function(_0x1a596e){if(_0x1a596e){_0x4fb419=_0x1a596e;return _0x1a596e[_0x05cd('0x6d')]();}return null;})[_0x05cd('0x23')](function(_0x28e05a){if(_0x28e05a){if(!_0x28e05a['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x05cd('0x6f'),0x193);}_0x52a2d8=_0x28e05a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x05cd('0x23')](function(_0x1aedab){if(_0x1aedab){_0x165493=_['keyBy'](_0x1aedab,'id');var _0x53a821;var _0x436e71=squel['select']();_0x436e71[_0x05cd('0x73')](_0x4fb419[_0x05cd('0x74')]);for(var _0x514b49=0x0;_0x514b49<_0x52a2d8['length'];_0x514b49+=0x1){_0x53a821=_0x52a2d8[_0x514b49][_0x05cd('0x75')]?_0x165493[_0x52a2d8[_0x514b49][_0x05cd('0x75')]][_0x05cd('0x76')]:_0x52a2d8[_0x514b49][_0x05cd('0x6a')];_0x53a821=_0x52a2d8[_0x514b49]['function']?_[_0x05cd('0x79')](_0x3760a2[_0x52a2d8[_0x514b49][_0x05cd('0x77')]],'%s',_0x53a821):_0x53a821;_0x53a821=_0x52a2d8[_0x514b49][_0x05cd('0x78')]?_[_0x05cd('0x79')](_0x1fe26a[_0x52a2d8[_0x514b49]['format']],'%s',_0x53a821):_0x53a821;if(_0x52a2d8[_0x514b49][_0x05cd('0x7a')]){_0x436e71[_0x05cd('0x69')](_0x53a821);}_0x52a2d8[_0x514b49][_0x05cd('0x7b')]&&_0x436e71[_0x05cd('0x37')](_0x53a821,_0x52a2d8[_0x514b49][_0x05cd('0x7b')]===_0x05cd('0x7c')?![]:!![]);_0x436e71['field'](_0x53a821,_0x52a2d8[_0x514b49][_0x05cd('0x7d')]||_0x53a821);}if(_0x4fb419['joins']){_0x4fb419['joins']=JSON['parse'](_0x4fb419[_0x05cd('0x7e')]);for(var _0x2f0109=0x0;_0x2f0109<_0x4fb419[_0x05cd('0x7e')]['length'];_0x2f0109+=0x1){if(_0x4fb419[_0x05cd('0x7e')][_0x2f0109][_0x05cd('0x80')]&&_[_0x05cd('0x64')](_0x38f001,_0x4fb419['joins'][_0x2f0109][_0x05cd('0x80')])&&_0x4fb419[_0x05cd('0x7e')][_0x2f0109][_0x05cd('0x81')]&&_0x4fb419['joins'][_0x2f0109][_0x05cd('0x82')]&&_0x4fb419[_0x05cd('0x7e')][_0x2f0109][_0x05cd('0x83')]){_0x436e71[_0x4fb419['joins'][_0x2f0109][_0x05cd('0x80')]](_0x4fb419[_0x05cd('0x7e')][_0x2f0109][_0x05cd('0x82')],null,util[_0x05cd('0x78')](_0x05cd('0x84'),_0x4fb419[_0x05cd('0x74')],_0x4fb419[_0x05cd('0x7e')][_0x2f0109][_0x05cd('0x81')],_0x4fb419[_0x05cd('0x7e')][_0x2f0109][_0x05cd('0x82')],_0x4fb419[_0x05cd('0x7e')][_0x2f0109][_0x05cd('0x83')]));}}}if(_0x4fb419['conditions']){_0x4fb419[_0x05cd('0x85')]=JSON[_0x05cd('0x7f')](_0x4fb419[_0x05cd('0x85')]);_0x436e71['where'](_0x29279f(_0x4fb419[_0x05cd('0x85')][_0x05cd('0x69')]));}_0x582cdc=_0x436e71['clone']();_0x436e71[_0x05cd('0x1c')](_0x30255c);_0x436e71['offset'](0x0);logger[_0x05cd('0x87')](_0x05cd('0x88'),_0x436e71[_0x05cd('0x8a')]());return db['sequelize'][_0x05cd('0x2f')](_0x436e71[_0x05cd('0x8a')](),{'type':db[_0x05cd('0x89')][_0x05cd('0x8b')][_0x05cd('0x8c')]});}})['then'](function(){return{'sql':_0x582cdc[_0x05cd('0x8a')]()};})[_0x05cd('0x23')](respondWithResult(_0x2e7a7b,null))[_0x05cd('0x48')](handleError(_0x2e7a7b,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index cd82040..1936453 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 _0xb64d=['AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','request-promise','./analyticDefaultReport.attributes','exports'];(function(_0x2d585a,_0x5a8ce6){var _0x322b36=function(_0x5725ad){while(--_0x5725ad){_0x2d585a['push'](_0x2d585a['shift']());}};_0x322b36(++_0x5a8ce6);}(_0xb64d,0x122));var _0xdb64=function(_0x251cd1,_0x5cefa6){_0x251cd1=_0x251cd1-0x0;var _0x4d08ee=_0xb64d[_0x251cd1];return _0x4d08ee;};'use strict';var _=require(_0xdb64('0x0'));var util=require('util');var logger=require(_0xdb64('0x1'))(_0xdb64('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb64('0x3'));var attributes=require(_0xdb64('0x4'));module[_0xdb64('0x5')]=function(_0x171af9,_0x201500){return _0x171af9['define'](_0xdb64('0x6'),attributes,{'tableName':_0xdb64('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e21=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./analyticDefaultReport.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6e21,0x13c));var _0x16e2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6e21[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x16e2('0x0'));var util=require(_0x16e2('0x1'));var logger=require(_0x16e2('0x2'))(_0x16e2('0x3'));var moment=require(_0x16e2('0x4'));var BPromise=require(_0x16e2('0x5'));var rp=require(_0x16e2('0x6'));var attributes=require(_0x16e2('0x7'));module[_0x16e2('0x8')]=function(_0x3441a7,_0x87ecdd){return _0x3441a7[_0x16e2('0x9')](_0x16e2('0xa'),attributes,{'tableName':_0x16e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 04c5658..c57e441 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 _0xf4eb=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2b7675,_0x5969c9){var _0x4c4f97=function(_0x233188){while(--_0x233188){_0x2b7675['push'](_0x2b7675['shift']());}};_0x4c4f97(++_0x5969c9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x54edc7,_0x4c9530){_0x54edc7=_0x54edc7-0x0;var _0x185310=_0xf4eb[_0x54edc7];return _0x185310;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x3e5457,_0xd17e2d){var _0x1503b9=function(_0x287543){while(--_0x287543){_0x3e5457['push'](_0x3e5457['shift']());}};_0x1503b9(++_0xd17e2d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x00bb[_0x33032e];return _0x13316b;};'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});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 79d0677..381f511 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 _0x1ba4=['put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create'];(function(_0x145b0c,_0x1e7fc7){var _0x2451e0=function(_0x28053f){while(--_0x28053f){_0x145b0c['push'](_0x145b0c['shift']());}};_0x2451e0(++_0x1e7fc7);}(_0x1ba4,0x119));var _0x41ba=function(_0x33e267,_0x2f566c){_0x33e267=_0x33e267-0x0;var _0x4fdc72=_0x1ba4[_0x33e267];return _0x4fdc72;};'use strict';var multer=require(_0x41ba('0x0'));var util=require(_0x41ba('0x1'));var path=require(_0x41ba('0x2'));var timeout=require('connect-timeout');var express=require(_0x41ba('0x3'));var router=express['Router']();var auth=require(_0x41ba('0x4'));var interaction=require(_0x41ba('0x5'));var config=require(_0x41ba('0x6'));var controller=require(_0x41ba('0x7'));router[_0x41ba('0x8')]('/',auth[_0x41ba('0x9')](),controller[_0x41ba('0xa')]);router[_0x41ba('0x8')]('/:id',auth[_0x41ba('0x9')](),controller['show']);router['get'](_0x41ba('0xb'),auth[_0x41ba('0x9')](),controller[_0x41ba('0xc')]);router[_0x41ba('0x8')](_0x41ba('0xd'),auth[_0x41ba('0x9')](),controller[_0x41ba('0xe')]);router[_0x41ba('0x8')](_0x41ba('0xf'),auth[_0x41ba('0x9')](),controller[_0x41ba('0x10')]);router[_0x41ba('0x11')]('/',auth['isAuthenticated'](),controller[_0x41ba('0x12')]);router[_0x41ba('0x13')](_0x41ba('0x14'),auth[_0x41ba('0x9')](),controller[_0x41ba('0x15')]);router[_0x41ba('0x16')]('/:id',auth[_0x41ba('0x9')](),controller[_0x41ba('0x17')]);module[_0x41ba('0x18')]=router; \ No newline at end of file +var _0x6412=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','/:id','update','delete','exports','multer','util','path','../../components/auth/service'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6412,0x19e));var _0x2641=function(_0x1af5a4,_0x1fb288){_0x1af5a4=_0x1af5a4-0x0;var _0x2d94ea=_0x6412[_0x1af5a4];return _0x2d94ea;};'use strict';var multer=require(_0x2641('0x0'));var util=require(_0x2641('0x1'));var path=require(_0x2641('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2641('0x3'));var interaction=require(_0x2641('0x4'));var config=require(_0x2641('0x5'));var controller=require(_0x2641('0x6'));router[_0x2641('0x7')]('/',auth[_0x2641('0x8')](),controller[_0x2641('0x9')]);router['get']('/:id',auth[_0x2641('0x8')](),controller[_0x2641('0xa')]);router[_0x2641('0x7')](_0x2641('0xb'),auth['isAuthenticated'](),controller[_0x2641('0xc')]);router[_0x2641('0x7')](_0x2641('0xd'),auth[_0x2641('0x8')](),controller[_0x2641('0xe')]);router[_0x2641('0x7')](_0x2641('0xf'),auth[_0x2641('0x8')](),controller['query']);router[_0x2641('0x10')]('/',auth[_0x2641('0x8')](),controller[_0x2641('0x11')]);router['put'](_0x2641('0x12'),auth[_0x2641('0x8')](),controller[_0x2641('0x13')]);router[_0x2641('0x14')](_0x2641('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x2641('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index a2cad9e..81e9cb8 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 _0xf3bc=['pdf','xlsx','ENUM','manual','INTEGER','sequelize','moment','exports','STRING','csv'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xf3bc,0x113));var _0xcf3b=function(_0x341517,_0xaa2d89){_0x341517=_0x341517-0x0;var _0x4f09d8=_0xf3bc[_0x341517];return _0x4f09d8;};'use strict';var Sequelize=require(_0xcf3b('0x0'));var moment=require(_0xcf3b('0x1'));module[_0xcf3b('0x2')]={'name':{'type':Sequelize[_0xcf3b('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xcf3b('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xcf3b('0x4'),_0xcf3b('0x5'),_0xcf3b('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xcf3b('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xcf3b('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xcf3b('0x7')](_0xcf3b('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0xcf3b('0x8')},'reportId':{'type':Sequelize[_0xcf3b('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2933=['manual','scheduled','UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2933,0x18f));var _0x3293=function(_0x46ff79,_0x492cca){_0x46ff79=_0x46ff79-0x0;var _0x5d5a02=_0x2933[_0x46ff79];return _0x5d5a02;};'use strict';var Sequelize=require(_0x3293('0x0'));var moment=require('moment');module[_0x3293('0x1')]={'name':{'type':Sequelize[_0x3293('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x3293('0x3')](_0x3293('0x4'),_0x3293('0x5'),_0x3293('0x6')),'allowNull':![],'defaultValue':_0x3293('0x4')},'savename':{'type':Sequelize[_0x3293('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x3293('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x3293('0x8')},'type':{'type':Sequelize['ENUM'](_0x3293('0x9'),_0x3293('0xa')),'allowNull':![],'defaultValue':_0x3293('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x3293('0xb')]},'reportType':{'type':Sequelize[_0x3293('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2bb3e59..d1a83d6 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 _0x62ca=['pick','filters','add','day','merge','filter','map','findAll','catch','params','includeAll','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','format','%s.%s','output','toLowerCase','html-pdf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','index','AnalyticExtractedReport','query','dateStart','dateEnd','keys','attributes','intersection','model','fields','length','nolimit','sort','where'];(function(_0x31ab68,_0x5ca817){var _0x41fb73=function(_0x161803){while(--_0x161803){_0x31ab68['push'](_0x31ab68['shift']());}};_0x41fb73(++_0x5ca817);}(_0x62ca,0x179));var _0xa62c=function(_0x2fe691,_0x1a85ed){_0x2fe691=_0x2fe691-0x0;var _0x49cb1d=_0x62ca[_0x2fe691];return _0x49cb1d;};'use strict';var pdf=require(_0xa62c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa62c('0x1'));var rp=require('request-promise');var moment=require(_0xa62c('0x2'));var BPromise=require(_0xa62c('0x3'));var Mustache=require(_0xa62c('0x4'));var util=require('util');var path=require(_0xa62c('0x5'));var sox=require(_0xa62c('0x6'));var csv=require('to-csv');var ejs=require(_0xa62c('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa62c('0x8'));var crypto=require(_0xa62c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa62c('0xa'));var toCsv=require(_0xa62c('0xb'));var querystring=require(_0xa62c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xa62c('0xd'));var logger=require(_0xa62c('0xe'))(_0xa62c('0xf'));var utils=require(_0xa62c('0x10'));var config=require(_0xa62c('0x11'));var db=require(_0xa62c('0x12'))['db'];function respondWithStatusCode(_0x39a0fe,_0x9b2a5b){_0x9b2a5b=_0x9b2a5b||0xcc;return function(_0x2509da){if(_0x2509da){return _0x39a0fe[_0xa62c('0x13')](_0x9b2a5b);}return _0x39a0fe[_0xa62c('0x14')](_0x9b2a5b)['end']();};}function respondWithResult(_0x12252a,_0x2a2852){_0x2a2852=_0x2a2852||0xc8;return function(_0x18fdc0){if(_0x18fdc0){return _0x12252a[_0xa62c('0x14')](_0x2a2852)[_0xa62c('0x15')](_0x18fdc0);}};}function respondWithFilteredResult(_0x5bb822,_0xca0d7){return function(_0x207680){if(_0x207680){var _0x58f82b=_0x207680['count'],_0x4a4453=_0xca0d7['offset'],_0x1fd5b3=_0xca0d7[_0xa62c('0x16')]+_0xca0d7[_0xa62c('0x17')],_0x1b799d;if(_0x1fd5b3>=_0x58f82b){_0x1fd5b3=_0x58f82b;_0x1b799d=0xc8;}else{_0x1b799d=0xce;}_0x5bb822[_0xa62c('0x14')](_0x1b799d);return _0x5bb822['set']('Content-Range',_0x4a4453+'-'+_0x1fd5b3+'/'+_0x58f82b)[_0xa62c('0x15')](_0x207680);}return null;};}function patchUpdates(_0x480e57){return function(_0x19f966){try{jsonpatch[_0xa62c('0x18')](_0x19f966,_0x480e57,!![]);}catch(_0x327e03){return BPromise[_0xa62c('0x19')](_0x327e03);}return _0x19f966['save']();};}function saveUpdates(_0x3cca63,_0x45d27a){return function(_0x351fe6){if(_0x351fe6){return _0x351fe6[_0xa62c('0x1a')](_0x3cca63)[_0xa62c('0x1b')](function(_0x77ab93){return _0x77ab93;});}return null;};}function removeEntity(_0x32ba98,_0x3979a8){return function(_0x41a60c){if(_0x41a60c){return _0x41a60c[_0xa62c('0x1c')]()[_0xa62c('0x1b')](function(){var _0xaa8daa=_0x41a60c[_0xa62c('0x1d')]({'plain':!![]});var _0x187d05='ExtractedReports';return db[_0xa62c('0x1e')][_0xa62c('0x1c')]({'where':{'type':_0x187d05,'resourceId':_0xaa8daa['id']}})['then'](function(){return _0x41a60c;});})[_0xa62c('0x1b')](function(){_0x32ba98[_0xa62c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5da240,_0x2f1c10){return function(_0x19dd25){if(!_0x19dd25){_0x5da240[_0xa62c('0x13')](0x194);}return _0x19dd25;};}function handleError(_0x4cd920,_0x53af1f){_0x53af1f=_0x53af1f||0x1f4;return function(_0xe74d32){logger[_0xa62c('0x1f')](_0xe74d32[_0xa62c('0x20')]);if(_0xe74d32['name']){delete _0xe74d32[_0xa62c('0x21')];}_0x4cd920[_0xa62c('0x14')](_0x53af1f)['send'](_0xe74d32);};}exports[_0xa62c('0x22')]=function(_0x4da09a,_0x4d3fc4){var _0x5aea67={},_0x9b0a89={},_0x389926={'count':0x0,'rows':[]};var _0x8c9eca=db[_0xa62c('0x23')]['rawAttributes'];_0x9b0a89['model']=_['keys'](_0x8c9eca);var _0x156fd5={'dateStart':_0x4da09a[_0xa62c('0x24')][_0xa62c('0x25')],'dateEnd':_0x4da09a['query'][_0xa62c('0x26')]};delete _0x4da09a['query']['dateStart'];delete _0x4da09a[_0xa62c('0x24')]['dateEnd'];_0x9b0a89[_0xa62c('0x24')]=_[_0xa62c('0x27')](_0x4da09a[_0xa62c('0x24')]);_0x9b0a89['filters']=_['intersection'](_0x9b0a89['model'],_0x9b0a89[_0xa62c('0x24')]);_0x5aea67[_0xa62c('0x28')]=_[_0xa62c('0x29')](_0x9b0a89[_0xa62c('0x2a')],qs[_0xa62c('0x2b')](_0x4da09a[_0xa62c('0x24')][_0xa62c('0x2b')]));_0x5aea67[_0xa62c('0x28')]=_0x5aea67[_0xa62c('0x28')][_0xa62c('0x2c')]?_0x5aea67[_0xa62c('0x28')]:_0x9b0a89[_0xa62c('0x2a')];if(!_0x4da09a[_0xa62c('0x24')]['hasOwnProperty'](_0xa62c('0x2d'))){_0x5aea67[_0xa62c('0x17')]=qs[_0xa62c('0x17')](_0x4da09a[_0xa62c('0x24')]['limit']);_0x5aea67[_0xa62c('0x16')]=qs['offset'](_0x4da09a[_0xa62c('0x24')][_0xa62c('0x16')]);}_0x5aea67['order']=qs['sort'](_0x4da09a['query'][_0xa62c('0x2e')]);_0x5aea67[_0xa62c('0x2f')]=qs['filters'](_[_0xa62c('0x30')](_0x4da09a[_0xa62c('0x24')],_0x9b0a89[_0xa62c('0x31')]));if(_0x156fd5[_0xa62c('0x25')]){if(_0x156fd5[_0xa62c('0x26')]){_0x156fd5[_0xa62c('0x26')]=moment(_0x156fd5[_0xa62c('0x26')])[_0xa62c('0x32')](0x1,'day');}else{_0x156fd5[_0xa62c('0x26')]=moment(_0x156fd5[_0xa62c('0x25')])[_0xa62c('0x32')](0x1,_0xa62c('0x33'));}_[_0xa62c('0x34')](_0x5aea67['where'],{'createdAt':{'$gte':_0x156fd5[_0xa62c('0x25')],'$lte':_0x156fd5[_0xa62c('0x26')]}});}if(_0x4da09a[_0xa62c('0x24')][_0xa62c('0x35')]){_0x5aea67['where']=_[_0xa62c('0x34')](_0x5aea67['where'],{'$or':_[_0xa62c('0x36')](_0x5aea67[_0xa62c('0x28')],function(_0x357814){var _0x2db229={};_0x2db229[_0x357814]={'$like':'%'+_0x4da09a['query'][_0xa62c('0x35')]+'%'};return _0x2db229;})});}_0x5aea67=_[_0xa62c('0x34')]({},_0x5aea67,_0x4da09a['options']);var _0x22500e={'where':_0x5aea67[_0xa62c('0x2f')]};return db[_0xa62c('0x23')]['count'](_0x22500e)[_0xa62c('0x1b')](function(_0x1f443d){_0x389926['count']=_0x1f443d;if(_0x4da09a[_0xa62c('0x24')]['includeAll']){_0x5aea67['include']=[{'all':!![]}];}return db[_0xa62c('0x23')][_0xa62c('0x37')](_0x5aea67);})[_0xa62c('0x1b')](function(_0x4e07b5){_0x389926['rows']=_0x4e07b5;return _0x389926;})[_0xa62c('0x1b')](respondWithFilteredResult(_0x4d3fc4,_0x5aea67))[_0xa62c('0x38')](handleError(_0x4d3fc4,null));};exports['show']=function(_0x203953,_0x4fa30a){var _0x135fd7={'raw':!![],'where':{'id':_0x203953[_0xa62c('0x39')]['id']}},_0x432041={};_0x432041[_0xa62c('0x2a')]=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x432041[_0xa62c('0x24')]=_[_0xa62c('0x27')](_0x203953[_0xa62c('0x24')]);_0x432041[_0xa62c('0x31')]=_[_0xa62c('0x29')](_0x432041[_0xa62c('0x2a')],_0x432041[_0xa62c('0x24')]);_0x135fd7['attributes']=_[_0xa62c('0x29')](_0x432041[_0xa62c('0x2a')],qs[_0xa62c('0x2b')](_0x203953[_0xa62c('0x24')]['fields']));_0x135fd7[_0xa62c('0x28')]=_0x135fd7[_0xa62c('0x28')]['length']?_0x135fd7['attributes']:_0x432041[_0xa62c('0x2a')];if(_0x203953[_0xa62c('0x24')][_0xa62c('0x3a')]){_0x135fd7[_0xa62c('0x3b')]=[{'all':!![]}];}_0x135fd7=_['merge']({},_0x135fd7,_0x203953[_0xa62c('0x3c')]);return db[_0xa62c('0x23')]['find'](_0x135fd7)[_0xa62c('0x1b')](handleEntityNotFound(_0x4fa30a,null))[_0xa62c('0x1b')](respondWithResult(_0x4fa30a,null))[_0xa62c('0x38')](handleError(_0x4fa30a,null));};exports[_0xa62c('0x3d')]=function(_0x559680,_0x24c81c){return db[_0xa62c('0x23')]['create'](_0x559680[_0xa62c('0x3e')],{})[_0xa62c('0x1b')](function(_0x2d4715){var _0x302c90=_0x559680[_0xa62c('0x3f')]['get']({'plain':!![]});if(!_0x302c90)throw new Error(_0xa62c('0x40'));if(_0x302c90['role']===_0xa62c('0x3f')){var _0xcec7a8=_0x2d4715[_0xa62c('0x1d')]({'plain':!![]});var _0x25c541=_0xa62c('0x41');return db[_0xa62c('0x42')][_0xa62c('0x43')]({'where':{'name':_0x25c541,'userProfileId':_0x302c90[_0xa62c('0x44')]},'raw':!![]})[_0xa62c('0x1b')](function(_0x1f1ce6){if(_0x1f1ce6&&_0x1f1ce6[_0xa62c('0x45')]===0x0){return db['UserProfileResource'][_0xa62c('0x3d')]({'name':_0xcec7a8[_0xa62c('0x21')],'resourceId':_0xcec7a8['id'],'type':_0x1f1ce6[_0xa62c('0x21')],'sectionId':_0x1f1ce6['id']},{})[_0xa62c('0x1b')](function(){return _0x2d4715;});}else{return _0x2d4715;}})['catch'](function(_0x3316a8){logger['error'](_0xa62c('0x46'),_0x3316a8);throw _0x3316a8;});}return _0x2d4715;})[_0xa62c('0x1b')](respondWithResult(_0x24c81c,0xc9))[_0xa62c('0x38')](handleError(_0x24c81c,null));};exports[_0xa62c('0x1a')]=function(_0x168655,_0x4056cb){if(_0x168655[_0xa62c('0x3e')]['id']){delete _0x168655[_0xa62c('0x3e')]['id'];}return db[_0xa62c('0x23')][_0xa62c('0x43')]({'where':{'id':_0x168655[_0xa62c('0x39')]['id']}})[_0xa62c('0x1b')](handleEntityNotFound(_0x4056cb,null))['then'](saveUpdates(_0x168655['body'],null))[_0xa62c('0x1b')](respondWithResult(_0x4056cb,null))[_0xa62c('0x38')](handleError(_0x4056cb,null));};exports[_0xa62c('0x1c')]=function(_0x513513,_0x4bfe34){return db['AnalyticExtractedReport'][_0xa62c('0x43')]({'where':{'id':_0x513513[_0xa62c('0x39')]['id']}})[_0xa62c('0x1b')](handleEntityNotFound(_0x4bfe34,null))[_0xa62c('0x1b')](removeEntity(_0x4bfe34,null))[_0xa62c('0x38')](handleError(_0x4bfe34,null));};exports[_0xa62c('0x47')]=function(_0x3f37a0,_0x48cba0,_0xf11a6f){return db['AnalyticExtractedReport'][_0xa62c('0x43')]({'where':{'id':_0x3f37a0['params']['id']},'attributes':[_0xa62c('0x21'),_0xa62c('0x48'),_0xa62c('0x49'),'output'],'raw':!![]})[_0xa62c('0x1b')](handleEntityNotFound(_0x48cba0,null))['then'](function(_0x5d238f){if(_0x5d238f){if(!fs[_0xa62c('0x4a')](path[_0xa62c('0x4b')](config['root'],_0xa62c('0x4c'),_0x5d238f[_0xa62c('0x49')]))){throw new db[(_0xa62c('0x4d'))][(_0xa62c('0x4e'))](_0xa62c('0x4f'));}if(_0x3f37a0[_0xa62c('0x24')]['exists']){return _0x48cba0[_0xa62c('0x13')](0xc8);}return _0x48cba0[_0xa62c('0x47')](path[_0xa62c('0x4b')](config[_0xa62c('0x50')],_0xa62c('0x4c'),_0x5d238f[_0xa62c('0x49')]),util[_0xa62c('0x51')](_0xa62c('0x52'),_0x5d238f['basename']||_0x5d238f['name'],_0x5d238f[_0xa62c('0x53')][_0xa62c('0x54')]()));}})[_0xa62c('0x38')](handleError(_0x48cba0,null));}; \ No newline at end of file +var _0x5b0d=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','get','UserProfileResource','name','send','index','AnalyticExtractedReport','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','filter','map','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','exists','download','format','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x1c71fc,_0xb3c9a7){var _0x1aa873=function(_0xfc4e3a){while(--_0xfc4e3a){_0x1c71fc['push'](_0x1c71fc['shift']());}};_0x1aa873(++_0xb3c9a7);}(_0x5b0d,0x172));var _0xd5b0=function(_0x284529,_0x1a0ef4){_0x284529=_0x284529-0x0;var _0x30d7a6=_0x5b0d[_0x284529];return _0x30d7a6;};'use strict';var pdf=require(_0xd5b0('0x0'));var emlformat=require(_0xd5b0('0x1'));var rimraf=require(_0xd5b0('0x2'));var zipdir=require(_0xd5b0('0x3'));var jsonpatch=require(_0xd5b0('0x4'));var rp=require(_0xd5b0('0x5'));var moment=require(_0xd5b0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd5b0('0x7'));var util=require(_0xd5b0('0x8'));var path=require('path');var sox=require(_0xd5b0('0x9'));var csv=require(_0xd5b0('0xa'));var ejs=require(_0xd5b0('0xb'));var fs=require('fs');var _=require(_0xd5b0('0xc'));var squel=require(_0xd5b0('0xd'));var crypto=require(_0xd5b0('0xe'));var jsforce=require(_0xd5b0('0xf'));var deskjs=require(_0xd5b0('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd5b0('0x11'));var Papa=require(_0xd5b0('0x12'));var Redis=require(_0xd5b0('0x13'));var qs=require(_0xd5b0('0x14'));var logger=require(_0xd5b0('0x15'))(_0xd5b0('0x16'));var utils=require('../../config/utils');var config=require(_0xd5b0('0x17'));var db=require(_0xd5b0('0x18'))['db'];function respondWithStatusCode(_0x4ce2b7,_0x54ab09){_0x54ab09=_0x54ab09||0xcc;return function(_0x51ce1d){if(_0x51ce1d){return _0x4ce2b7[_0xd5b0('0x19')](_0x54ab09);}return _0x4ce2b7[_0xd5b0('0x1a')](_0x54ab09)[_0xd5b0('0x1b')]();};}function respondWithResult(_0xc72430,_0x4e5d71){_0x4e5d71=_0x4e5d71||0xc8;return function(_0x4c7f3e){if(_0x4c7f3e){return _0xc72430[_0xd5b0('0x1a')](_0x4e5d71)['json'](_0x4c7f3e);}};}function respondWithFilteredResult(_0x5e863d,_0x578b92){return function(_0x544c4c){if(_0x544c4c){var _0x5c63de=_0x544c4c[_0xd5b0('0x1c')],_0x30ef0a=_0x578b92[_0xd5b0('0x1d')],_0x46dda5=_0x578b92['offset']+_0x578b92[_0xd5b0('0x1e')],_0x1d91f4;if(_0x46dda5>=_0x5c63de){_0x46dda5=_0x5c63de;_0x1d91f4=0xc8;}else{_0x1d91f4=0xce;}_0x5e863d[_0xd5b0('0x1a')](_0x1d91f4);return _0x5e863d[_0xd5b0('0x1f')](_0xd5b0('0x20'),_0x30ef0a+'-'+_0x46dda5+'/'+_0x5c63de)[_0xd5b0('0x21')](_0x544c4c);}return null;};}function patchUpdates(_0x45d9ad){return function(_0xb0a0f0){try{jsonpatch[_0xd5b0('0x22')](_0xb0a0f0,_0x45d9ad,!![]);}catch(_0x59bd7b){return BPromise[_0xd5b0('0x23')](_0x59bd7b);}return _0xb0a0f0['save']();};}function saveUpdates(_0x299d0d,_0x48d512){return function(_0x28e333){if(_0x28e333){return _0x28e333['update'](_0x299d0d)[_0xd5b0('0x24')](function(_0x5d965b){return _0x5d965b;});}return null;};}function removeEntity(_0x480e6d,_0x111712){return function(_0x7e4d77){if(_0x7e4d77){return _0x7e4d77[_0xd5b0('0x25')]()['then'](function(){var _0x4bdca0=_0x7e4d77[_0xd5b0('0x26')]({'plain':!![]});var _0x599e67='ExtractedReports';return db[_0xd5b0('0x27')]['destroy']({'where':{'type':_0x599e67,'resourceId':_0x4bdca0['id']}})['then'](function(){return _0x7e4d77;});})[_0xd5b0('0x24')](function(){_0x480e6d['status'](0xcc)[_0xd5b0('0x1b')]();});}};}function handleEntityNotFound(_0x3b5b24,_0x770f0c){return function(_0xd2b20c){if(!_0xd2b20c){_0x3b5b24[_0xd5b0('0x19')](0x194);}return _0xd2b20c;};}function handleError(_0x37190f,_0x436a8b){_0x436a8b=_0x436a8b||0x1f4;return function(_0x19b46c){logger['error'](_0x19b46c['stack']);if(_0x19b46c[_0xd5b0('0x28')]){delete _0x19b46c['name'];}_0x37190f[_0xd5b0('0x1a')](_0x436a8b)[_0xd5b0('0x29')](_0x19b46c);};}exports[_0xd5b0('0x2a')]=function(_0x398e21,_0x1f27d0){var _0x5a23b1={},_0x371591={},_0x5cf7bc={'count':0x0,'rows':[]};var _0xdc8d0e=db[_0xd5b0('0x2b')][_0xd5b0('0x2c')];_0x371591['model']=_[_0xd5b0('0x2d')](_0xdc8d0e);var _0xe574bb={'dateStart':_0x398e21[_0xd5b0('0x2e')]['dateStart'],'dateEnd':_0x398e21[_0xd5b0('0x2e')][_0xd5b0('0x2f')]};delete _0x398e21['query'][_0xd5b0('0x30')];delete _0x398e21['query'][_0xd5b0('0x2f')];_0x371591[_0xd5b0('0x2e')]=_[_0xd5b0('0x2d')](_0x398e21[_0xd5b0('0x2e')]);_0x371591[_0xd5b0('0x31')]=_[_0xd5b0('0x32')](_0x371591[_0xd5b0('0x33')],_0x371591['query']);_0x5a23b1[_0xd5b0('0x34')]=_[_0xd5b0('0x32')](_0x371591[_0xd5b0('0x33')],qs[_0xd5b0('0x35')](_0x398e21['query'][_0xd5b0('0x35')]));_0x5a23b1[_0xd5b0('0x34')]=_0x5a23b1[_0xd5b0('0x34')][_0xd5b0('0x36')]?_0x5a23b1['attributes']:_0x371591[_0xd5b0('0x33')];if(!_0x398e21[_0xd5b0('0x2e')][_0xd5b0('0x37')](_0xd5b0('0x38'))){_0x5a23b1[_0xd5b0('0x1e')]=qs['limit'](_0x398e21[_0xd5b0('0x2e')][_0xd5b0('0x1e')]);_0x5a23b1['offset']=qs[_0xd5b0('0x1d')](_0x398e21[_0xd5b0('0x2e')][_0xd5b0('0x1d')]);}_0x5a23b1['order']=qs['sort'](_0x398e21['query'][_0xd5b0('0x39')]);_0x5a23b1[_0xd5b0('0x3a')]=qs[_0xd5b0('0x31')](_[_0xd5b0('0x3b')](_0x398e21['query'],_0x371591[_0xd5b0('0x31')]));if(_0xe574bb['dateStart']){if(_0xe574bb[_0xd5b0('0x2f')]){_0xe574bb[_0xd5b0('0x2f')]=moment(_0xe574bb[_0xd5b0('0x2f')])[_0xd5b0('0x3c')](0x1,_0xd5b0('0x3d'));}else{_0xe574bb[_0xd5b0('0x2f')]=moment(_0xe574bb['dateStart'])[_0xd5b0('0x3c')](0x1,_0xd5b0('0x3d'));}_['merge'](_0x5a23b1[_0xd5b0('0x3a')],{'createdAt':{'$gte':_0xe574bb[_0xd5b0('0x30')],'$lte':_0xe574bb[_0xd5b0('0x2f')]}});}if(_0x398e21[_0xd5b0('0x2e')][_0xd5b0('0x3e')]){_0x5a23b1[_0xd5b0('0x3a')]=_['merge'](_0x5a23b1['where'],{'$or':_[_0xd5b0('0x3f')](_0x5a23b1[_0xd5b0('0x34')],function(_0x3d8459){var _0x8baf65={};_0x8baf65[_0x3d8459]={'$like':'%'+_0x398e21[_0xd5b0('0x2e')][_0xd5b0('0x3e')]+'%'};return _0x8baf65;})});}_0x5a23b1=_[_0xd5b0('0x40')]({},_0x5a23b1,_0x398e21[_0xd5b0('0x41')]);var _0x21064d={'where':_0x5a23b1[_0xd5b0('0x3a')]};return db[_0xd5b0('0x2b')][_0xd5b0('0x1c')](_0x21064d)['then'](function(_0x5da157){_0x5cf7bc['count']=_0x5da157;if(_0x398e21[_0xd5b0('0x2e')][_0xd5b0('0x42')]){_0x5a23b1[_0xd5b0('0x43')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xd5b0('0x44')](_0x5a23b1);})[_0xd5b0('0x24')](function(_0x2150a1){_0x5cf7bc['rows']=_0x2150a1;return _0x5cf7bc;})[_0xd5b0('0x24')](respondWithFilteredResult(_0x1f27d0,_0x5a23b1))[_0xd5b0('0x45')](handleError(_0x1f27d0,null));};exports[_0xd5b0('0x46')]=function(_0x13e9b6,_0x10ed76){var _0x5a8a1f={'raw':!![],'where':{'id':_0x13e9b6[_0xd5b0('0x47')]['id']}},_0x55abaf={};_0x55abaf[_0xd5b0('0x33')]=_[_0xd5b0('0x2d')](db[_0xd5b0('0x2b')][_0xd5b0('0x2c')]);_0x55abaf[_0xd5b0('0x2e')]=_[_0xd5b0('0x2d')](_0x13e9b6[_0xd5b0('0x2e')]);_0x55abaf['filters']=_[_0xd5b0('0x32')](_0x55abaf[_0xd5b0('0x33')],_0x55abaf['query']);_0x5a8a1f[_0xd5b0('0x34')]=_[_0xd5b0('0x32')](_0x55abaf[_0xd5b0('0x33')],qs['fields'](_0x13e9b6['query'][_0xd5b0('0x35')]));_0x5a8a1f[_0xd5b0('0x34')]=_0x5a8a1f['attributes']['length']?_0x5a8a1f[_0xd5b0('0x34')]:_0x55abaf[_0xd5b0('0x33')];if(_0x13e9b6[_0xd5b0('0x2e')][_0xd5b0('0x42')]){_0x5a8a1f[_0xd5b0('0x43')]=[{'all':!![]}];}_0x5a8a1f=_[_0xd5b0('0x40')]({},_0x5a8a1f,_0x13e9b6['options']);return db[_0xd5b0('0x2b')][_0xd5b0('0x48')](_0x5a8a1f)[_0xd5b0('0x24')](handleEntityNotFound(_0x10ed76,null))['then'](respondWithResult(_0x10ed76,null))['catch'](handleError(_0x10ed76,null));};exports['create']=function(_0x1fb834,_0x4ddff1){return db[_0xd5b0('0x2b')][_0xd5b0('0x49')](_0x1fb834[_0xd5b0('0x4a')],{})[_0xd5b0('0x24')](function(_0x1ed190){var _0xef3e12=_0x1fb834[_0xd5b0('0x4b')][_0xd5b0('0x26')]({'plain':!![]});if(!_0xef3e12)throw new Error(_0xd5b0('0x4c'));if(_0xef3e12['role']===_0xd5b0('0x4b')){var _0x25a007=_0x1ed190['get']({'plain':!![]});var _0x4ba6d6=_0xd5b0('0x4d');return db[_0xd5b0('0x4e')][_0xd5b0('0x48')]({'where':{'name':_0x4ba6d6,'userProfileId':_0xef3e12[_0xd5b0('0x4f')]},'raw':!![]})[_0xd5b0('0x24')](function(_0x492e83){if(_0x492e83&&_0x492e83[_0xd5b0('0x50')]===0x0){return db[_0xd5b0('0x27')][_0xd5b0('0x49')]({'name':_0x25a007['name'],'resourceId':_0x25a007['id'],'type':_0x492e83[_0xd5b0('0x28')],'sectionId':_0x492e83['id']},{})[_0xd5b0('0x24')](function(){return _0x1ed190;});}else{return _0x1ed190;}})[_0xd5b0('0x45')](function(_0x4c3286){logger[_0xd5b0('0x51')](_0xd5b0('0x52'),_0x4c3286);throw _0x4c3286;});}return _0x1ed190;})[_0xd5b0('0x24')](respondWithResult(_0x4ddff1,0xc9))[_0xd5b0('0x45')](handleError(_0x4ddff1,null));};exports[_0xd5b0('0x53')]=function(_0x2bf7c1,_0x88d2a0){if(_0x2bf7c1[_0xd5b0('0x4a')]['id']){delete _0x2bf7c1[_0xd5b0('0x4a')]['id'];}return db[_0xd5b0('0x2b')]['find']({'where':{'id':_0x2bf7c1[_0xd5b0('0x47')]['id']}})['then'](handleEntityNotFound(_0x88d2a0,null))[_0xd5b0('0x24')](saveUpdates(_0x2bf7c1['body'],null))[_0xd5b0('0x24')](respondWithResult(_0x88d2a0,null))['catch'](handleError(_0x88d2a0,null));};exports[_0xd5b0('0x25')]=function(_0x47f5fd,_0x61102e){return db['AnalyticExtractedReport'][_0xd5b0('0x48')]({'where':{'id':_0x47f5fd['params']['id']}})[_0xd5b0('0x24')](handleEntityNotFound(_0x61102e,null))[_0xd5b0('0x24')](removeEntity(_0x61102e,null))[_0xd5b0('0x45')](handleError(_0x61102e,null));};exports['download']=function(_0x55bb65,_0xd5ef56,_0x3160c3){return db[_0xd5b0('0x2b')]['find']({'where':{'id':_0x55bb65[_0xd5b0('0x47')]['id']},'attributes':[_0xd5b0('0x28'),_0xd5b0('0x54'),_0xd5b0('0x55'),_0xd5b0('0x56')],'raw':!![]})[_0xd5b0('0x24')](handleEntityNotFound(_0xd5ef56,null))[_0xd5b0('0x24')](function(_0x1a3961){if(_0x1a3961){if(!fs[_0xd5b0('0x57')](path[_0xd5b0('0x58')](config[_0xd5b0('0x59')],_0xd5b0('0x5a'),_0x1a3961[_0xd5b0('0x55')]))){throw new db['Sequelize'][(_0xd5b0('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x55bb65[_0xd5b0('0x2e')][_0xd5b0('0x5c')]){return _0xd5ef56[_0xd5b0('0x19')](0xc8);}return _0xd5ef56[_0xd5b0('0x5d')](path[_0xd5b0('0x58')](config[_0xd5b0('0x59')],_0xd5b0('0x5a'),_0x1a3961['savename']),util[_0xd5b0('0x5e')]('%s.%s',_0x1a3961[_0xd5b0('0x54')]||_0x1a3961[_0xd5b0('0x28')],_0x1a3961[_0xd5b0('0x56')][_0xd5b0('0x5f')]()));}})[_0xd5b0('0x45')](handleError(_0xd5ef56,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index fe55c86..091089d 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 _0x0e24=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','api','moment','bluebird','request-promise','./analyticExtractedReport.attributes'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0x0e24,0x1da));var _0x40e2=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x0e24[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40e2('0x0'))(_0x40e2('0x1'));var moment=require(_0x40e2('0x2'));var BPromise=require(_0x40e2('0x3'));var rp=require(_0x40e2('0x4'));var attributes=require(_0x40e2('0x5'));module[_0x40e2('0x6')]=function(_0x432b4f,_0x1f8c23){return _0x432b4f[_0x40e2('0x7')](_0x40e2('0x8'),attributes,{'tableName':_0x40e2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6351=['bluebird','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment'];(function(_0x283298,_0x1d5685){var _0x39a736=function(_0x44e800){while(--_0x44e800){_0x283298['push'](_0x283298['shift']());}};_0x39a736(++_0x1d5685);}(_0x6351,0x12f));var _0x1635=function(_0x508ae5,_0x456dda){_0x508ae5=_0x508ae5-0x0;var _0x23ab10=_0x6351[_0x508ae5];return _0x23ab10;};'use strict';var _=require(_0x1635('0x0'));var util=require(_0x1635('0x1'));var logger=require(_0x1635('0x2'))(_0x1635('0x3'));var moment=require(_0x1635('0x4'));var BPromise=require(_0x1635('0x5'));var rp=require('request-promise');var attributes=require(_0x1635('0x6'));module[_0x1635('0x7')]=function(_0x41b0e7,_0x30962d){return _0x41b0e7[_0x1635('0x8')](_0x1635('0x9'),attributes,{'tableName':_0x1635('0xa'),'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 cd369d6..2e8c8b3 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 _0x2822=['../../config/logger','rpc','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x407c4f,_0x57ac20){var _0x289ca9=function(_0x7a7d18){while(--_0x7a7d18){_0x407c4f['push'](_0x407c4f['shift']());}};_0x289ca9(++_0x57ac20);}(_0x2822,0x1a8));var _0x2282=function(_0x4aee9e,_0x4e3d6d){_0x4aee9e=_0x4aee9e-0x0;var _0x501471=_0x2822[_0x4aee9e];return _0x501471;};'use strict';var _=require(_0x2282('0x0'));var util=require(_0x2282('0x1'));var moment=require(_0x2282('0x2'));var BPromise=require(_0x2282('0x3'));var rs=require(_0x2282('0x4'));var fs=require('fs');var Redis=require(_0x2282('0x5'));var db=require(_0x2282('0x6'))['db'];var utils=require(_0x2282('0x7'));var logger=require(_0x2282('0x8'))(_0x2282('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2282('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301902,_0x4cd13a,_0x585c70){return new BPromise(function(_0xb4da71,_0xddd236){return client[_0x2282('0xb')](_0x301902,_0x585c70)[_0x2282('0xc')](function(_0x769e0e){logger[_0x2282('0xd')](_0x2282('0xe'),_0x4cd13a,'request\x20sent');logger[_0x2282('0xf')](_0x2282('0x10'),_0x4cd13a,_0x2282('0x11'),JSON[_0x2282('0x12')](_0x769e0e));if(_0x769e0e[_0x2282('0x13')]){if(_0x769e0e['error'][_0x2282('0x14')]===0x1f4){logger[_0x2282('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4cd13a,_0x769e0e['error'][_0x2282('0x15')]);return _0xddd236(_0x769e0e['error'][_0x2282('0x15')]);}logger['error'](_0x2282('0xe'),_0x4cd13a,_0x769e0e[_0x2282('0x13')]['message']);return _0xb4da71(_0x769e0e[_0x2282('0x13')][_0x2282('0x15')]);}else{logger[_0x2282('0xd')](_0x2282('0xe'),_0x4cd13a,_0x2282('0x11'));_0xb4da71(_0x769e0e[_0x2282('0x16')]['message']);}})[_0x2282('0x17')](function(_0x194c18){logger[_0x2282('0x13')](_0x2282('0xe'),_0x4cd13a,_0x194c18);_0xddd236(_0x194c18);});});} \ No newline at end of file +var _0x83ef=['message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1784b2,_0x178ae1){var _0x4e438e=function(_0x440bad){while(--_0x440bad){_0x1784b2['push'](_0x1784b2['shift']());}};_0x4e438e(++_0x178ae1);}(_0x83ef,0xc0));var _0xf83e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x83ef[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xf83e('0x0'));var util=require('util');var moment=require(_0xf83e('0x1'));var BPromise=require('bluebird');var rs=require(_0xf83e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf83e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf83e('0x4'))(_0xf83e('0x5'));var config=require('../../config/environment');var jayson=require(_0xf83e('0x6'));var client=jayson[_0xf83e('0x7')][_0xf83e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x496111,_0x3c8b40,_0x441a70){return new BPromise(function(_0x15fca2,_0x2cac89){return client[_0xf83e('0x9')](_0x496111,_0x441a70)[_0xf83e('0xa')](function(_0x28a62c){logger[_0xf83e('0xb')](_0xf83e('0xc'),_0x3c8b40,_0xf83e('0xd'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x3c8b40,_0xf83e('0xd'),JSON[_0xf83e('0xe')](_0x28a62c));if(_0x28a62c['error']){if(_0x28a62c[_0xf83e('0xf')][_0xf83e('0x10')]===0x1f4){logger[_0xf83e('0xf')](_0xf83e('0xc'),_0x3c8b40,_0x28a62c['error'][_0xf83e('0x11')]);return _0x2cac89(_0x28a62c['error'][_0xf83e('0x11')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x3c8b40,_0x28a62c['error'][_0xf83e('0x11')]);return _0x15fca2(_0x28a62c['error'][_0xf83e('0x11')]);}else{logger[_0xf83e('0xb')](_0xf83e('0xc'),_0x3c8b40,_0xf83e('0xd'));_0x15fca2(_0x28a62c['result'][_0xf83e('0x11')]);}})[_0xf83e('0x12')](function(_0x350225){logger[_0xf83e('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3c8b40,_0x350225);_0x2cac89(_0x350225);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1050bf9..3849881 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 _0xd7d6=['../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x58b639,_0x527fdb){var _0xdfe74a=function(_0x16f75a){while(--_0x16f75a){_0x58b639['push'](_0x58b639['shift']());}};_0xdfe74a(++_0x527fdb);}(_0xd7d6,0x83));var _0x6d7d=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0xd7d6[_0x18546c];return _0x46ef43;};'use strict';var multer=require('multer');var util=require(_0x6d7d('0x0'));var path=require(_0x6d7d('0x1'));var timeout=require(_0x6d7d('0x2'));var express=require(_0x6d7d('0x3'));var router=express[_0x6d7d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6d7d('0x5'));var config=require('../../config/environment');var controller=require(_0x6d7d('0x6'));router[_0x6d7d('0x7')]('/',auth[_0x6d7d('0x8')](),controller['index']);router['get'](_0x6d7d('0x9'),auth[_0x6d7d('0x8')](),controller[_0x6d7d('0xa')]);router[_0x6d7d('0x7')]('/:id/download',auth[_0x6d7d('0x8')](),controller[_0x6d7d('0xb')]);router[_0x6d7d('0xc')]('/',auth[_0x6d7d('0x8')](),controller[_0x6d7d('0xd')]);router[_0x6d7d('0xe')](_0x6d7d('0x9'),auth[_0x6d7d('0x8')](),controller['update']);router[_0x6d7d('0xf')](_0x6d7d('0x9'),auth[_0x6d7d('0x8')](),controller['destroy']);module[_0x6d7d('0x10')]=router; \ No newline at end of file +var _0xe2bc=['put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','post','create'];(function(_0x350aeb,_0x3d265a){var _0x3c5273=function(_0x32b417){while(--_0x32b417){_0x350aeb['push'](_0x350aeb['shift']());}};_0x3c5273(++_0x3d265a);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xe2bc[_0x45783c];return _0x1161da;};'use strict';var multer=require(_0xce2b('0x0'));var util=require('util');var path=require(_0xce2b('0x1'));var timeout=require('connect-timeout');var express=require(_0xce2b('0x2'));var router=express[_0xce2b('0x3')]();var auth=require(_0xce2b('0x4'));var interaction=require(_0xce2b('0x5'));var config=require(_0xce2b('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0xce2b('0x7')]('/',auth[_0xce2b('0x8')](),controller[_0xce2b('0x9')]);router[_0xce2b('0x7')](_0xce2b('0xa'),auth['isAuthenticated'](),controller[_0xce2b('0xb')]);router[_0xce2b('0x7')]('/:id/download',auth[_0xce2b('0x8')](),controller[_0xce2b('0xc')]);router[_0xce2b('0xd')]('/',auth[_0xce2b('0x8')](),controller[_0xce2b('0xe')]);router[_0xce2b('0xf')](_0xce2b('0xa'),auth[_0xce2b('0x8')](),controller[_0xce2b('0x10')]);router[_0xce2b('0x11')]('/:id',auth[_0xce2b('0x8')](),controller['destroy']);module[_0xce2b('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 6fd89af..76b9e78 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 _0x6e8e=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0x6e8e,0x9b));var _0xe6e8=function(_0x2bf8fa,_0x511ab7){_0x2bf8fa=_0x2bf8fa-0x0;var _0x368b70=_0x6e8e[_0x2bf8fa];return _0x368b70;};'use strict';var Sequelize=require(_0xe6e8('0x0'));module[_0xe6e8('0x1')]={'field':{'type':Sequelize[_0xe6e8('0x2')]},'alias':{'type':Sequelize[_0xe6e8('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xe6e8('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xe6e8('0x3')]},'custom':{'type':Sequelize[_0xe6e8('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa5b9=['STRING','BOOLEAN','exports','TEXT'];(function(_0x5645cd,_0x55b57f){var _0x4c3abb=function(_0x3b8d59){while(--_0x3b8d59){_0x5645cd['push'](_0x5645cd['shift']());}};_0x4c3abb(++_0x55b57f);}(_0xa5b9,0xf2));var _0x9a5b=function(_0x46c9b9,_0x2224aa){_0x46c9b9=_0x46c9b9-0x0;var _0x46762e=_0xa5b9[_0x46c9b9];return _0x46762e;};'use strict';var Sequelize=require('sequelize');module[_0x9a5b('0x0')]={'field':{'type':Sequelize[_0x9a5b('0x1')]},'alias':{'type':Sequelize[_0x9a5b('0x2')]},'function':{'type':Sequelize[_0x9a5b('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x9a5b('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x9a5b('0x2')]},'custom':{'type':Sequelize[_0x9a5b('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 88d2b05..85e4349 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 _0x58a4=['send','index','AnalyticFieldReport','keys','query','dateStart','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','options','count','includeAll','include','findAll','rows','catch','params','create','body','bulkCreate','update','find','findOne','sequelize','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','save','then','destroy','error','stack','name'];(function(_0x2967b4,_0x9b5a9b){var _0x483322=function(_0x4652d0){while(--_0x4652d0){_0x2967b4['push'](_0x2967b4['shift']());}};_0x483322(++_0x9b5a9b);}(_0x58a4,0xbf));var _0x458a=function(_0xca6909,_0x31d421){_0xca6909=_0xca6909-0x0;var _0x44d08e=_0x58a4[_0xca6909];return _0x44d08e;};'use strict';var pdf=require(_0x458a('0x0'));var emlformat=require(_0x458a('0x1'));var rimraf=require(_0x458a('0x2'));var zipdir=require(_0x458a('0x3'));var jsonpatch=require(_0x458a('0x4'));var rp=require(_0x458a('0x5'));var moment=require(_0x458a('0x6'));var BPromise=require(_0x458a('0x7'));var Mustache=require(_0x458a('0x8'));var util=require(_0x458a('0x9'));var path=require(_0x458a('0xa'));var sox=require(_0x458a('0xb'));var csv=require(_0x458a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var qs=require(_0x458a('0x12'));var logger=require(_0x458a('0x13'))(_0x458a('0x14'));var utils=require(_0x458a('0x15'));var config=require('../../config/environment');var db=require(_0x458a('0x16'))['db'];function respondWithStatusCode(_0x804e01,_0x5a3874){_0x5a3874=_0x5a3874||0xcc;return function(_0x183d9d){if(_0x183d9d){return _0x804e01[_0x458a('0x17')](_0x5a3874);}return _0x804e01[_0x458a('0x18')](_0x5a3874)[_0x458a('0x19')]();};}function respondWithResult(_0x2e788b,_0x5bd09e){_0x5bd09e=_0x5bd09e||0xc8;return function(_0x53e6b4){if(_0x53e6b4){return _0x2e788b[_0x458a('0x18')](_0x5bd09e)['json'](_0x53e6b4);}};}function respondWithFilteredResult(_0x2c7528,_0x44f683){return function(_0x10133b){if(_0x10133b){var _0x3b74f9=_0x10133b['count'],_0xad80f9=_0x44f683['offset'],_0x29acee=_0x44f683[_0x458a('0x1a')]+_0x44f683[_0x458a('0x1b')],_0x507b0f;if(_0x29acee>=_0x3b74f9){_0x29acee=_0x3b74f9;_0x507b0f=0xc8;}else{_0x507b0f=0xce;}_0x2c7528[_0x458a('0x18')](_0x507b0f);return _0x2c7528['set'](_0x458a('0x1c'),_0xad80f9+'-'+_0x29acee+'/'+_0x3b74f9)[_0x458a('0x1d')](_0x10133b);}return null;};}function patchUpdates(_0x18504d){return function(_0x392986){try{jsonpatch[_0x458a('0x1e')](_0x392986,_0x18504d,!![]);}catch(_0x4df9ef){return BPromise['reject'](_0x4df9ef);}return _0x392986[_0x458a('0x1f')]();};}function saveUpdates(_0x4d07a7,_0x3302b7){return function(_0x398ff2){if(_0x398ff2){return _0x398ff2['update'](_0x4d07a7)[_0x458a('0x20')](function(_0x55a588){return _0x55a588;});}return null;};}function removeEntity(_0x200213,_0x1c79cb){return function(_0x59f44c){if(_0x59f44c){return _0x59f44c[_0x458a('0x21')]()[_0x458a('0x20')](function(){_0x200213['status'](0xcc)[_0x458a('0x19')]();});}};}function handleEntityNotFound(_0x5ad95a,_0x370959){return function(_0x5bca42){if(!_0x5bca42){_0x5ad95a[_0x458a('0x17')](0x194);}return _0x5bca42;};}function handleError(_0x5dfc6c,_0x36b08e){_0x36b08e=_0x36b08e||0x1f4;return function(_0x911eaf){logger[_0x458a('0x22')](_0x911eaf[_0x458a('0x23')]);if(_0x911eaf[_0x458a('0x24')]){delete _0x911eaf[_0x458a('0x24')];}_0x5dfc6c[_0x458a('0x18')](_0x36b08e)[_0x458a('0x25')](_0x911eaf);};}exports[_0x458a('0x26')]=function(_0xfc6b24,_0x52efed){var _0x327fcb={},_0x21ec38={},_0x5a55b7={'count':0x0,'rows':[]};var _0xb94bd9=db[_0x458a('0x27')]['rawAttributes'];_0x21ec38['model']=_[_0x458a('0x28')](_0xb94bd9);var _0x596fe2={'dateStart':_0xfc6b24[_0x458a('0x29')][_0x458a('0x2a')],'dateEnd':_0xfc6b24[_0x458a('0x29')]['dateEnd']};delete _0xfc6b24[_0x458a('0x29')][_0x458a('0x2a')];delete _0xfc6b24[_0x458a('0x29')]['dateEnd'];_0x21ec38['query']=_[_0x458a('0x28')](_0xfc6b24['query']);_0x21ec38[_0x458a('0x2b')]=_['intersection'](_0x21ec38[_0x458a('0x2c')],_0x21ec38[_0x458a('0x29')]);_0x327fcb['attributes']=_[_0x458a('0x2d')](_0x21ec38[_0x458a('0x2c')],qs[_0x458a('0x2e')](_0xfc6b24['query'][_0x458a('0x2e')]));_0x327fcb[_0x458a('0x2f')]=_0x327fcb[_0x458a('0x2f')][_0x458a('0x30')]?_0x327fcb[_0x458a('0x2f')]:_0x21ec38['model'];if(!_0xfc6b24[_0x458a('0x29')][_0x458a('0x31')](_0x458a('0x32'))){_0x327fcb[_0x458a('0x1b')]=qs[_0x458a('0x1b')](_0xfc6b24[_0x458a('0x29')]['limit']);_0x327fcb[_0x458a('0x1a')]=qs[_0x458a('0x1a')](_0xfc6b24[_0x458a('0x29')][_0x458a('0x1a')]);}_0x327fcb[_0x458a('0x33')]=qs[_0x458a('0x34')](_0xfc6b24[_0x458a('0x29')][_0x458a('0x34')]);_0x327fcb[_0x458a('0x35')]=qs['filters'](_[_0x458a('0x36')](_0xfc6b24[_0x458a('0x29')],_0x21ec38[_0x458a('0x2b')]));if(_0x596fe2[_0x458a('0x2a')]){if(_0x596fe2[_0x458a('0x37')]){_0x596fe2[_0x458a('0x37')]=moment(_0x596fe2[_0x458a('0x37')])[_0x458a('0x38')](0x1,_0x458a('0x39'));}else{_0x596fe2[_0x458a('0x37')]=moment(_0x596fe2[_0x458a('0x2a')])[_0x458a('0x38')](0x1,_0x458a('0x39'));}_[_0x458a('0x3a')](_0x327fcb[_0x458a('0x35')],{'createdAt':{'$gte':_0x596fe2['dateStart'],'$lte':_0x596fe2[_0x458a('0x37')]}});}if(_0xfc6b24[_0x458a('0x29')][_0x458a('0x3b')]){_0x327fcb[_0x458a('0x35')]=_[_0x458a('0x3a')](_0x327fcb[_0x458a('0x35')],{'$or':_[_0x458a('0x3c')](_0x327fcb[_0x458a('0x2f')],function(_0x41d125){var _0x44c5ba={};_0x44c5ba[_0x41d125]={'$like':'%'+_0xfc6b24[_0x458a('0x29')]['filter']+'%'};return _0x44c5ba;})});}_0x327fcb=_[_0x458a('0x3a')]({},_0x327fcb,_0xfc6b24[_0x458a('0x3d')]);var _0x5da57a={'where':_0x327fcb[_0x458a('0x35')]};return db[_0x458a('0x27')][_0x458a('0x3e')](_0x5da57a)['then'](function(_0x406312){_0x5a55b7[_0x458a('0x3e')]=_0x406312;if(_0xfc6b24[_0x458a('0x29')][_0x458a('0x3f')]){_0x327fcb[_0x458a('0x40')]=[{'all':!![]}];}return db[_0x458a('0x27')][_0x458a('0x41')](_0x327fcb);})[_0x458a('0x20')](function(_0x5883ab){_0x5a55b7[_0x458a('0x42')]=_0x5883ab;return _0x5a55b7;})[_0x458a('0x20')](respondWithFilteredResult(_0x52efed,_0x327fcb))[_0x458a('0x43')](handleError(_0x52efed,null));};exports['show']=function(_0x3d3d0e,_0x369d4b){var _0x49d06e={'raw':![],'where':{'id':_0x3d3d0e[_0x458a('0x44')]['id']}},_0x598707={};_0x598707[_0x458a('0x2c')]=_[_0x458a('0x28')](db[_0x458a('0x27')]['rawAttributes']);_0x598707['query']=_[_0x458a('0x28')](_0x3d3d0e[_0x458a('0x29')]);_0x598707[_0x458a('0x2b')]=_[_0x458a('0x2d')](_0x598707['model'],_0x598707[_0x458a('0x29')]);_0x49d06e[_0x458a('0x2f')]=_['intersection'](_0x598707[_0x458a('0x2c')],qs['fields'](_0x3d3d0e[_0x458a('0x29')][_0x458a('0x2e')]));_0x49d06e[_0x458a('0x2f')]=_0x49d06e['attributes'][_0x458a('0x30')]?_0x49d06e[_0x458a('0x2f')]:_0x598707[_0x458a('0x2c')];if(_0x3d3d0e['query']['includeAll']){_0x49d06e[_0x458a('0x40')]=[{'all':!![]}];}_0x49d06e=_[_0x458a('0x3a')]({},_0x49d06e,_0x3d3d0e[_0x458a('0x3d')]);return db['AnalyticFieldReport']['find'](_0x49d06e)[_0x458a('0x20')](handleEntityNotFound(_0x369d4b,null))[_0x458a('0x20')](respondWithResult(_0x369d4b,null))[_0x458a('0x43')](handleError(_0x369d4b,null));};exports[_0x458a('0x45')]=function(_0x41ca6a,_0x43be95){return db[_0x458a('0x27')][_0x458a('0x45')](_0x41ca6a[_0x458a('0x46')],{})[_0x458a('0x20')](respondWithResult(_0x43be95,0xc9))[_0x458a('0x43')](handleError(_0x43be95,null));};exports[_0x458a('0x47')]=function(_0x3c6056,_0x1b0c11){return db[_0x458a('0x27')][_0x458a('0x47')](_0x3c6056['body'],{'raw':![],'individualHooks':!![]})[_0x458a('0x20')](respondWithResult(_0x1b0c11,0xc9))[_0x458a('0x43')](handleError(_0x1b0c11,null));};exports[_0x458a('0x48')]=function(_0x396bb3,_0x44670a){if(_0x396bb3['body']['id']){delete _0x396bb3['body']['id'];}return db['AnalyticFieldReport'][_0x458a('0x49')]({'where':{'id':_0x396bb3['params']['id']}})[_0x458a('0x20')](handleEntityNotFound(_0x44670a,null))[_0x458a('0x20')](saveUpdates(_0x396bb3[_0x458a('0x46')],null))[_0x458a('0x20')](respondWithResult(_0x44670a,null))[_0x458a('0x43')](handleError(_0x44670a,null));};exports['destroy']=function(_0x48f68e,_0x3d7616){return db[_0x458a('0x27')][_0x458a('0x49')]({'where':{'id':_0x48f68e[_0x458a('0x44')]['id']}})[_0x458a('0x20')](handleEntityNotFound(_0x3d7616,null))['then'](removeEntity(_0x3d7616,null))[_0x458a('0x43')](handleError(_0x3d7616,null));};exports['bulkDestroy']=function(_0xa51e28,_0x5b428c){return db[_0x458a('0x27')]['destroy']({'where':{'id':_0xa51e28['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x458a('0x20')](respondWithResult(_0x5b428c,0xcc))[_0x458a('0x43')](handleError(_0x5b428c,null));};exports['addFields']=function(_0x3858d9,_0x704b02,_0x194592){return db['AnalyticCustomReport'][_0x458a('0x4a')]({'where':{'id':_0x3858d9[_0x458a('0x44')]['id']}})[_0x458a('0x20')](handleEntityNotFound(_0x704b02,null))[_0x458a('0x20')](function(_0x42166e){if(_0x42166e){return db[_0x458a('0x4b')]['transaction'](function(_0x15200c){return db[_0x458a('0x27')][_0x458a('0x21')]({'where':{'CustomReportId':_0x3858d9[_0x458a('0x44')]['id']},'transaction':_0x15200c})[_0x458a('0x20')](function(_0x268f9a){var _0x1181c2=_[_0x458a('0x3c')](_0x3858d9['body'],function(_0xb365f5){delete _0xb365f5['id'];_0xb365f5['CustomReportId']=_0x3858d9[_0x458a('0x44')]['id'];return _0xb365f5;});return db[_0x458a('0x27')][_0x458a('0x47')](_0x1181c2,{'transaction':_0x15200c});});})[_0x458a('0x20')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x3858d9[_0x458a('0x44')]['id']}});});}})[_0x458a('0x20')](respondWithResult(_0x704b02,null))[_0x458a('0x43')](handleError(_0x704b02,null));}; \ No newline at end of file +var _0x1eba=['jsforce','desk.js','querystring','ioredis','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','add','day','merge','filter','map','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x5729d7,_0x48ebd8){var _0x533540=function(_0xcb7f0){while(--_0xcb7f0){_0x5729d7['push'](_0x5729d7['shift']());}};_0x533540(++_0x48ebd8);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0x1eba[_0x52121d];return _0x448627;};'use strict';var pdf=require(_0xa1eb('0x0'));var emlformat=require(_0xa1eb('0x1'));var rimraf=require(_0xa1eb('0x2'));var zipdir=require(_0xa1eb('0x3'));var jsonpatch=require(_0xa1eb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1eb('0x5'));var Mustache=require(_0xa1eb('0x6'));var util=require(_0xa1eb('0x7'));var path=require(_0xa1eb('0x8'));var sox=require(_0xa1eb('0x9'));var csv=require(_0xa1eb('0xa'));var ejs=require(_0xa1eb('0xb'));var fs=require('fs');var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0xa1eb('0x13'))('api');var utils=require(_0xa1eb('0x14'));var config=require('../../config/environment');var db=require(_0xa1eb('0x15'))['db'];function respondWithStatusCode(_0x325d13,_0x151580){_0x151580=_0x151580||0xcc;return function(_0x5839d3){if(_0x5839d3){return _0x325d13[_0xa1eb('0x16')](_0x151580);}return _0x325d13[_0xa1eb('0x17')](_0x151580)['end']();};}function respondWithResult(_0x16a623,_0x4a3774){_0x4a3774=_0x4a3774||0xc8;return function(_0x4e65dc){if(_0x4e65dc){return _0x16a623[_0xa1eb('0x17')](_0x4a3774)['json'](_0x4e65dc);}};}function respondWithFilteredResult(_0x25d058,_0x2178e2){return function(_0x14e048){if(_0x14e048){var _0x2877cb=_0x14e048[_0xa1eb('0x18')],_0x3cd675=_0x2178e2[_0xa1eb('0x19')],_0x44f37d=_0x2178e2['offset']+_0x2178e2[_0xa1eb('0x1a')],_0x1c858c;if(_0x44f37d>=_0x2877cb){_0x44f37d=_0x2877cb;_0x1c858c=0xc8;}else{_0x1c858c=0xce;}_0x25d058['status'](_0x1c858c);return _0x25d058[_0xa1eb('0x1b')](_0xa1eb('0x1c'),_0x3cd675+'-'+_0x44f37d+'/'+_0x2877cb)[_0xa1eb('0x1d')](_0x14e048);}return null;};}function patchUpdates(_0x1a5d2c){return function(_0x49bfaa){try{jsonpatch[_0xa1eb('0x1e')](_0x49bfaa,_0x1a5d2c,!![]);}catch(_0x22cd44){return BPromise[_0xa1eb('0x1f')](_0x22cd44);}return _0x49bfaa[_0xa1eb('0x20')]();};}function saveUpdates(_0x3d0961,_0x3b8607){return function(_0x2143e6){if(_0x2143e6){return _0x2143e6[_0xa1eb('0x21')](_0x3d0961)['then'](function(_0x137e2c){return _0x137e2c;});}return null;};}function removeEntity(_0x56653c,_0x2258d1){return function(_0x215e7f){if(_0x215e7f){return _0x215e7f[_0xa1eb('0x22')]()[_0xa1eb('0x23')](function(){_0x56653c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x168221,_0xc64cb9){return function(_0x5b0903){if(!_0x5b0903){_0x168221[_0xa1eb('0x16')](0x194);}return _0x5b0903;};}function handleError(_0x250728,_0x258d3a){_0x258d3a=_0x258d3a||0x1f4;return function(_0xa6b20c){logger[_0xa1eb('0x24')](_0xa6b20c[_0xa1eb('0x25')]);if(_0xa6b20c[_0xa1eb('0x26')]){delete _0xa6b20c[_0xa1eb('0x26')];}_0x250728[_0xa1eb('0x17')](_0x258d3a)[_0xa1eb('0x27')](_0xa6b20c);};}exports[_0xa1eb('0x28')]=function(_0x208844,_0x57d089){var _0x7c617e={},_0xbd5517={},_0x491f37={'count':0x0,'rows':[]};var _0x2680c0=db['AnalyticFieldReport'][_0xa1eb('0x29')];_0xbd5517[_0xa1eb('0x2a')]=_['keys'](_0x2680c0);var _0x45ff0d={'dateStart':_0x208844[_0xa1eb('0x2b')][_0xa1eb('0x2c')],'dateEnd':_0x208844['query'][_0xa1eb('0x2d')]};delete _0x208844[_0xa1eb('0x2b')]['dateStart'];delete _0x208844[_0xa1eb('0x2b')][_0xa1eb('0x2d')];_0xbd5517[_0xa1eb('0x2b')]=_[_0xa1eb('0x2e')](_0x208844[_0xa1eb('0x2b')]);_0xbd5517['filters']=_[_0xa1eb('0x2f')](_0xbd5517[_0xa1eb('0x2a')],_0xbd5517[_0xa1eb('0x2b')]);_0x7c617e[_0xa1eb('0x30')]=_[_0xa1eb('0x2f')](_0xbd5517[_0xa1eb('0x2a')],qs[_0xa1eb('0x31')](_0x208844[_0xa1eb('0x2b')][_0xa1eb('0x31')]));_0x7c617e[_0xa1eb('0x30')]=_0x7c617e[_0xa1eb('0x30')]['length']?_0x7c617e['attributes']:_0xbd5517[_0xa1eb('0x2a')];if(!_0x208844[_0xa1eb('0x2b')][_0xa1eb('0x32')](_0xa1eb('0x33'))){_0x7c617e[_0xa1eb('0x1a')]=qs['limit'](_0x208844['query'][_0xa1eb('0x1a')]);_0x7c617e[_0xa1eb('0x19')]=qs['offset'](_0x208844['query'][_0xa1eb('0x19')]);}_0x7c617e['order']=qs[_0xa1eb('0x34')](_0x208844['query'][_0xa1eb('0x34')]);_0x7c617e[_0xa1eb('0x35')]=qs[_0xa1eb('0x36')](_['pick'](_0x208844[_0xa1eb('0x2b')],_0xbd5517[_0xa1eb('0x36')]));if(_0x45ff0d[_0xa1eb('0x2c')]){if(_0x45ff0d['dateEnd']){_0x45ff0d[_0xa1eb('0x2d')]=moment(_0x45ff0d[_0xa1eb('0x2d')])[_0xa1eb('0x37')](0x1,_0xa1eb('0x38'));}else{_0x45ff0d[_0xa1eb('0x2d')]=moment(_0x45ff0d['dateStart'])[_0xa1eb('0x37')](0x1,_0xa1eb('0x38'));}_[_0xa1eb('0x39')](_0x7c617e[_0xa1eb('0x35')],{'createdAt':{'$gte':_0x45ff0d[_0xa1eb('0x2c')],'$lte':_0x45ff0d[_0xa1eb('0x2d')]}});}if(_0x208844[_0xa1eb('0x2b')][_0xa1eb('0x3a')]){_0x7c617e['where']=_[_0xa1eb('0x39')](_0x7c617e[_0xa1eb('0x35')],{'$or':_[_0xa1eb('0x3b')](_0x7c617e[_0xa1eb('0x30')],function(_0x1c390c){var _0x5bf994={};_0x5bf994[_0x1c390c]={'$like':'%'+_0x208844[_0xa1eb('0x2b')][_0xa1eb('0x3a')]+'%'};return _0x5bf994;})});}_0x7c617e=_[_0xa1eb('0x39')]({},_0x7c617e,_0x208844['options']);var _0x334849={'where':_0x7c617e[_0xa1eb('0x35')]};return db[_0xa1eb('0x3c')][_0xa1eb('0x18')](_0x334849)[_0xa1eb('0x23')](function(_0x1e5b3b){_0x491f37[_0xa1eb('0x18')]=_0x1e5b3b;if(_0x208844['query'][_0xa1eb('0x3d')]){_0x7c617e[_0xa1eb('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xa1eb('0x3f')](_0x7c617e);})['then'](function(_0x1744e4){_0x491f37[_0xa1eb('0x40')]=_0x1744e4;return _0x491f37;})[_0xa1eb('0x23')](respondWithFilteredResult(_0x57d089,_0x7c617e))[_0xa1eb('0x41')](handleError(_0x57d089,null));};exports[_0xa1eb('0x42')]=function(_0x3d08e0,_0x3e8482){var _0x38d184={'raw':![],'where':{'id':_0x3d08e0[_0xa1eb('0x43')]['id']}},_0x9c297d={};_0x9c297d[_0xa1eb('0x2a')]=_[_0xa1eb('0x2e')](db[_0xa1eb('0x3c')][_0xa1eb('0x29')]);_0x9c297d[_0xa1eb('0x2b')]=_[_0xa1eb('0x2e')](_0x3d08e0['query']);_0x9c297d[_0xa1eb('0x36')]=_['intersection'](_0x9c297d[_0xa1eb('0x2a')],_0x9c297d[_0xa1eb('0x2b')]);_0x38d184['attributes']=_['intersection'](_0x9c297d[_0xa1eb('0x2a')],qs[_0xa1eb('0x31')](_0x3d08e0[_0xa1eb('0x2b')]['fields']));_0x38d184[_0xa1eb('0x30')]=_0x38d184[_0xa1eb('0x30')][_0xa1eb('0x44')]?_0x38d184[_0xa1eb('0x30')]:_0x9c297d[_0xa1eb('0x2a')];if(_0x3d08e0[_0xa1eb('0x2b')][_0xa1eb('0x3d')]){_0x38d184[_0xa1eb('0x3e')]=[{'all':!![]}];}_0x38d184=_[_0xa1eb('0x39')]({},_0x38d184,_0x3d08e0[_0xa1eb('0x45')]);return db[_0xa1eb('0x3c')][_0xa1eb('0x46')](_0x38d184)[_0xa1eb('0x23')](handleEntityNotFound(_0x3e8482,null))[_0xa1eb('0x23')](respondWithResult(_0x3e8482,null))['catch'](handleError(_0x3e8482,null));};exports[_0xa1eb('0x47')]=function(_0x3c15c4,_0x1c94bc){return db[_0xa1eb('0x3c')][_0xa1eb('0x47')](_0x3c15c4[_0xa1eb('0x48')],{})[_0xa1eb('0x23')](respondWithResult(_0x1c94bc,0xc9))['catch'](handleError(_0x1c94bc,null));};exports[_0xa1eb('0x49')]=function(_0x4144cf,_0x27021a){return db[_0xa1eb('0x3c')][_0xa1eb('0x49')](_0x4144cf[_0xa1eb('0x48')],{'raw':![],'individualHooks':!![]})[_0xa1eb('0x23')](respondWithResult(_0x27021a,0xc9))[_0xa1eb('0x41')](handleError(_0x27021a,null));};exports[_0xa1eb('0x21')]=function(_0x4f7c05,_0x190370){if(_0x4f7c05['body']['id']){delete _0x4f7c05[_0xa1eb('0x48')]['id'];}return db['AnalyticFieldReport'][_0xa1eb('0x46')]({'where':{'id':_0x4f7c05[_0xa1eb('0x43')]['id']}})[_0xa1eb('0x23')](handleEntityNotFound(_0x190370,null))['then'](saveUpdates(_0x4f7c05[_0xa1eb('0x48')],null))[_0xa1eb('0x23')](respondWithResult(_0x190370,null))['catch'](handleError(_0x190370,null));};exports[_0xa1eb('0x22')]=function(_0x2926e7,_0x3f1833){return db[_0xa1eb('0x3c')][_0xa1eb('0x46')]({'where':{'id':_0x2926e7[_0xa1eb('0x43')]['id']}})[_0xa1eb('0x23')](handleEntityNotFound(_0x3f1833,null))[_0xa1eb('0x23')](removeEntity(_0x3f1833,null))[_0xa1eb('0x41')](handleError(_0x3f1833,null));};exports[_0xa1eb('0x4a')]=function(_0x42519b,_0x4391be){return db[_0xa1eb('0x3c')][_0xa1eb('0x22')]({'where':{'id':_0x42519b[_0xa1eb('0x2b')][_0xa1eb('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xa1eb('0x23')](respondWithResult(_0x4391be,0xcc))['catch'](handleError(_0x4391be,null));};exports[_0xa1eb('0x4c')]=function(_0x51ce91,_0x2161ed,_0x1085ca){return db[_0xa1eb('0x4d')][_0xa1eb('0x4e')]({'where':{'id':_0x51ce91['params']['id']}})[_0xa1eb('0x23')](handleEntityNotFound(_0x2161ed,null))[_0xa1eb('0x23')](function(_0x217ecb){if(_0x217ecb){return db[_0xa1eb('0x4f')][_0xa1eb('0x50')](function(_0x1e01f2){return db[_0xa1eb('0x3c')]['destroy']({'where':{'CustomReportId':_0x51ce91[_0xa1eb('0x43')]['id']},'transaction':_0x1e01f2})[_0xa1eb('0x23')](function(_0x378726){var _0x1c8fd0=_['map'](_0x51ce91['body'],function(_0x58ca4e){delete _0x58ca4e['id'];_0x58ca4e['CustomReportId']=_0x51ce91[_0xa1eb('0x43')]['id'];return _0x58ca4e;});return db[_0xa1eb('0x3c')]['bulkCreate'](_0x1c8fd0,{'transaction':_0x1e01f2});});})[_0xa1eb('0x23')](function(){return db[_0xa1eb('0x3c')][_0xa1eb('0x3f')]({'where':{'CustomReportId':_0x51ce91[_0xa1eb('0x43')]['id']}});});}})['then'](respondWithResult(_0x2161ed,null))['catch'](handleError(_0x2161ed,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 39a820a..b31829c 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 _0x90ba=['api','moment','bluebird','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger'];(function(_0x237dc1,_0xb53e37){var _0x16de45=function(_0x3b1770){while(--_0x3b1770){_0x237dc1['push'](_0x237dc1['shift']());}};_0x16de45(++_0xb53e37);}(_0x90ba,0xc3));var _0xa90b=function(_0x5c4ce1,_0x3be64c){_0x5c4ce1=_0x5c4ce1-0x0;var _0x2fd310=_0x90ba[_0x5c4ce1];return _0x2fd310;};'use strict';var _=require(_0xa90b('0x0'));var util=require(_0xa90b('0x1'));var logger=require(_0xa90b('0x2'))(_0xa90b('0x3'));var moment=require(_0xa90b('0x4'));var BPromise=require(_0xa90b('0x5'));var rp=require('request-promise');var attributes=require(_0xa90b('0x6'));module[_0xa90b('0x7')]=function(_0x426c55,_0x32734f){return _0x426c55[_0xa90b('0x8')](_0xa90b('0x9'),attributes,{'tableName':_0xa90b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed2e=['moment','request-promise','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x582347,_0x38ed5f){var _0x3d278e=function(_0x29cec5){while(--_0x29cec5){_0x582347['push'](_0x582347['shift']());}};_0x3d278e(++_0x38ed5f);}(_0xed2e,0x196));var _0xeed2=function(_0x2abd13,_0x501317){_0x2abd13=_0x2abd13-0x0;var _0x5ad645=_0xed2e[_0x2abd13];return _0x5ad645;};'use strict';var _=require(_0xeed2('0x0'));var util=require(_0xeed2('0x1'));var logger=require(_0xeed2('0x2'))(_0xeed2('0x3'));var moment=require(_0xeed2('0x4'));var BPromise=require('bluebird');var rp=require(_0xeed2('0x5'));var attributes=require('./analyticFieldReport.attributes');module[_0xeed2('0x6')]=function(_0x2a2f8a,_0xd2c05d){return _0x2a2f8a[_0xeed2('0x7')](_0xeed2('0x8'),attributes,{'tableName':_0xeed2('0x9'),'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 8557168..f1326e4 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 _0xf873=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x499c0d,_0x3a36b7){var _0x19dfb4=function(_0x55463f){while(--_0x55463f){_0x499c0d['push'](_0x499c0d['shift']());}};_0x19dfb4(++_0x3a36b7);}(_0xf873,0xb2));var _0x3f87=function(_0x5ca277,_0x267911){_0x5ca277=_0x5ca277-0x0;var _0x4512f4=_0xf873[_0x5ca277];return _0x4512f4;};'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')]('AnalyticFieldReport,\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')]('AnalyticFieldReport,\x20%s,\x20%s',_0x8bf89b,_0x3ac7a7);_0x41faf2(_0x3ac7a7);});});} \ No newline at end of file +var _0xd7c3=['../../config/environment','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x36f6b7,_0x1d0a57){var _0x49d498=function(_0x33edfd){while(--_0x33edfd){_0x36f6b7['push'](_0x36f6b7['shift']());}};_0x49d498(++_0x1d0a57);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x5a34ac,_0x107593){_0x5a34ac=_0x5a34ac-0x0;var _0x3a1f31=_0xd7c3[_0x5a34ac];return _0x3a1f31;};'use strict';var _=require(_0x3d7c('0x0'));var util=require(_0x3d7c('0x1'));var moment=require(_0x3d7c('0x2'));var BPromise=require(_0x3d7c('0x3'));var rs=require(_0x3d7c('0x4'));var fs=require('fs');var Redis=require(_0x3d7c('0x5'));var db=require(_0x3d7c('0x6'))['db'];var utils=require(_0x3d7c('0x7'));var logger=require(_0x3d7c('0x8'))('rpc');var config=require(_0x3d7c('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeccebe,_0x1047f5,_0x3416dd){return new BPromise(function(_0x2bd736,_0x34f0b2){return client[_0x3d7c('0xa')](_0xeccebe,_0x3416dd)[_0x3d7c('0xb')](function(_0x440980){logger[_0x3d7c('0xc')](_0x3d7c('0xd'),_0x1047f5,_0x3d7c('0xe'));logger[_0x3d7c('0xf')](_0x3d7c('0x10'),_0x1047f5,_0x3d7c('0xe'),JSON[_0x3d7c('0x11')](_0x440980));if(_0x440980[_0x3d7c('0x12')]){if(_0x440980[_0x3d7c('0x12')][_0x3d7c('0x13')]===0x1f4){logger['error'](_0x3d7c('0xd'),_0x1047f5,_0x440980[_0x3d7c('0x12')][_0x3d7c('0x14')]);return _0x34f0b2(_0x440980[_0x3d7c('0x12')][_0x3d7c('0x14')]);}logger[_0x3d7c('0x12')](_0x3d7c('0xd'),_0x1047f5,_0x440980[_0x3d7c('0x12')][_0x3d7c('0x14')]);return _0x2bd736(_0x440980[_0x3d7c('0x12')][_0x3d7c('0x14')]);}else{logger[_0x3d7c('0xc')](_0x3d7c('0xd'),_0x1047f5,_0x3d7c('0xe'));_0x2bd736(_0x440980[_0x3d7c('0x15')][_0x3d7c('0x14')]);}})['catch'](function(_0x10f4d5){logger[_0x3d7c('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1047f5,_0x10f4d5);_0x34f0b2(_0x10f4d5);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3ff2ec8..cc971a9 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 _0x9354=['../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','delete','/destroy_many','bulkDestroy','destroy','exports','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9354,0x96));var _0x4935=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0x9354[_0x4ec7f2];return _0x118004;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var auth=require(_0x4935('0x4'));var interaction=require(_0x4935('0x5'));var config=require('../../config/environment');var controller=require(_0x4935('0x6'));router[_0x4935('0x7')]('/',auth[_0x4935('0x8')](),controller[_0x4935('0x9')]);router[_0x4935('0x7')](_0x4935('0xa'),auth[_0x4935('0x8')](),controller[_0x4935('0xb')]);router[_0x4935('0xc')]('/',auth['isAuthenticated'](),controller[_0x4935('0xd')]);router['post'](_0x4935('0xe'),auth[_0x4935('0x8')](),controller[_0x4935('0xf')]);router[_0x4935('0xc')](_0x4935('0x10'),auth[_0x4935('0x8')](),controller['addFields']);router['put'](_0x4935('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4935('0x11')](_0x4935('0x12'),auth[_0x4935('0x8')](),controller[_0x4935('0x13')]);router[_0x4935('0x11')](_0x4935('0xa'),auth[_0x4935('0x8')](),controller[_0x4935('0x14')]);module[_0x4935('0x15')]=router; \ No newline at end of file +var _0x4483=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','put','/destroy_many','delete'];(function(_0x1cac87,_0x369e25){var _0xf6ed36=function(_0x518b00){while(--_0x518b00){_0x1cac87['push'](_0x1cac87['shift']());}};_0xf6ed36(++_0x369e25);}(_0x4483,0x1a3));var _0x3448=function(_0x46dd6c,_0x5bcfab){_0x46dd6c=_0x46dd6c-0x0;var _0x4ecfc0=_0x4483[_0x46dd6c];return _0x4ecfc0;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var auth=require(_0x3448('0x5'));var interaction=require(_0x3448('0x6'));var config=require(_0x3448('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x3448('0x8')]('/',auth[_0x3448('0x9')](),controller[_0x3448('0xa')]);router[_0x3448('0x8')](_0x3448('0xb'),auth[_0x3448('0x9')](),controller[_0x3448('0xc')]);router[_0x3448('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3448('0xd')](_0x3448('0xe'),auth[_0x3448('0x9')](),controller[_0x3448('0xf')]);router[_0x3448('0xd')](_0x3448('0x10'),auth[_0x3448('0x9')](),controller[_0x3448('0x11')]);router[_0x3448('0x12')](_0x3448('0xb'),auth[_0x3448('0x9')](),controller['update']);router['delete'](_0x3448('0x13'),auth[_0x3448('0x9')](),controller['bulkDestroy']);router[_0x3448('0x14')](_0x3448('0xb'),auth[_0x3448('0x9')](),controller['destroy']);module[_0x3448('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 94149eb..707963f 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 _0xeab7=['exports','name','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeab7,0xcc));var _0x7eab=function(_0x5d8a39,_0x570001){_0x5d8a39=_0x5d8a39-0x0;var _0x2ece7d=_0xeab7[_0x5d8a39];return _0x2ece7d;};'use strict';var Sequelize=require('sequelize');module[_0x7eab('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7eab('0x1')},'table':{'type':Sequelize[_0x7eab('0x2')]},'metric':{'type':Sequelize[_0x7eab('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9ee6=['exports','STRING','TEXT','sequelize'];(function(_0x12ea2c,_0x36d1ff){var _0x4c71f4=function(_0x3ff3d1){while(--_0x3ff3d1){_0x12ea2c['push'](_0x12ea2c['shift']());}};_0x4c71f4(++_0x36d1ff);}(_0x9ee6,0x97));var _0x69ee=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x9ee6[_0x4d8a8f];return _0xfc4adc;};'use strict';var Sequelize=require(_0x69ee('0x0'));module[_0x69ee('0x1')]={'name':{'type':Sequelize[_0x69ee('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x69ee('0x3')]},'description':{'type':Sequelize[_0x69ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index f14b788..6e98c76 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 _0xe6d4=['rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','AnalyticMetric','rows','catch','params','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','Content-Range','save','update','then','get','Metrics','UserProfileResource','sendStatus','stack','name','send','index'];(function(_0x273243,_0x52fd6d){var _0x1d7b33=function(_0x31bc80){while(--_0x31bc80){_0x273243['push'](_0x273243['shift']());}};_0x1d7b33(++_0x52fd6d);}(_0xe6d4,0x159));var _0x4e6d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe6d4[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x4e6d('0x0'));var emlformat=require(_0x4e6d('0x1'));var rimraf=require(_0x4e6d('0x2'));var zipdir=require(_0x4e6d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e6d('0x4'));var moment=require(_0x4e6d('0x5'));var BPromise=require(_0x4e6d('0x6'));var Mustache=require(_0x4e6d('0x7'));var util=require('util');var path=require(_0x4e6d('0x8'));var sox=require('sox');var csv=require(_0x4e6d('0x9'));var ejs=require(_0x4e6d('0xa'));var fs=require('fs');var _=require(_0x4e6d('0xb'));var squel=require(_0x4e6d('0xc'));var crypto=require(_0x4e6d('0xd'));var jsforce=require(_0x4e6d('0xe'));var deskjs=require(_0x4e6d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4e6d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x4e6d('0x11'));var logger=require(_0x4e6d('0x12'))(_0x4e6d('0x13'));var utils=require(_0x4e6d('0x14'));var config=require(_0x4e6d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x284948,_0x784d66){_0x784d66=_0x784d66||0xcc;return function(_0x39883f){if(_0x39883f){return _0x284948['sendStatus'](_0x784d66);}return _0x284948[_0x4e6d('0x16')](_0x784d66)[_0x4e6d('0x17')]();};}function respondWithResult(_0x56364a,_0x555d96){_0x555d96=_0x555d96||0xc8;return function(_0x269d9a){if(_0x269d9a){return _0x56364a[_0x4e6d('0x16')](_0x555d96)[_0x4e6d('0x18')](_0x269d9a);}};}function respondWithFilteredResult(_0x2f1012,_0x350009){return function(_0x13c754){if(_0x13c754){var _0x3ead4f=_0x13c754[_0x4e6d('0x19')],_0x444fe2=_0x350009[_0x4e6d('0x1a')],_0x3f8e0f=_0x350009['offset']+_0x350009[_0x4e6d('0x1b')],_0x54f55e;if(_0x3f8e0f>=_0x3ead4f){_0x3f8e0f=_0x3ead4f;_0x54f55e=0xc8;}else{_0x54f55e=0xce;}_0x2f1012[_0x4e6d('0x16')](_0x54f55e);return _0x2f1012['set'](_0x4e6d('0x1c'),_0x444fe2+'-'+_0x3f8e0f+'/'+_0x3ead4f)[_0x4e6d('0x18')](_0x13c754);}return null;};}function patchUpdates(_0x291a58){return function(_0xbae57b){try{jsonpatch['apply'](_0xbae57b,_0x291a58,!![]);}catch(_0x31f0e7){return BPromise['reject'](_0x31f0e7);}return _0xbae57b[_0x4e6d('0x1d')]();};}function saveUpdates(_0x24ad46,_0x1e0c51){return function(_0x38b254){if(_0x38b254){return _0x38b254[_0x4e6d('0x1e')](_0x24ad46)['then'](function(_0x1d33a3){return _0x1d33a3;});}return null;};}function removeEntity(_0x20e179,_0x417c97){return function(_0x5d564f){if(_0x5d564f){return _0x5d564f['destroy']()[_0x4e6d('0x1f')](function(){var _0x5f0e3c=_0x5d564f[_0x4e6d('0x20')]({'plain':!![]});var _0x2eaacc=_0x4e6d('0x21');return db[_0x4e6d('0x22')]['destroy']({'where':{'type':_0x2eaacc,'resourceId':_0x5f0e3c['id']}})[_0x4e6d('0x1f')](function(){return _0x5d564f;});})[_0x4e6d('0x1f')](function(){_0x20e179[_0x4e6d('0x16')](0xcc)[_0x4e6d('0x17')]();});}};}function handleEntityNotFound(_0x29ade0,_0x5041d4){return function(_0x4d0f4d){if(!_0x4d0f4d){_0x29ade0[_0x4e6d('0x23')](0x194);}return _0x4d0f4d;};}function handleError(_0xc70a5c,_0x622aa2){_0x622aa2=_0x622aa2||0x1f4;return function(_0x2cc443){logger['error'](_0x2cc443[_0x4e6d('0x24')]);if(_0x2cc443['name']){delete _0x2cc443[_0x4e6d('0x25')];}_0xc70a5c['status'](_0x622aa2)[_0x4e6d('0x26')](_0x2cc443);};}exports[_0x4e6d('0x27')]=function(_0x23b530,_0x464912){var _0x2e0ec3={},_0x307bcf={},_0x6e8938={'count':0x0,'rows':[]};var _0x114180=db['AnalyticMetric'][_0x4e6d('0x28')];_0x307bcf[_0x4e6d('0x29')]=_['keys'](_0x114180);var _0x4736e5={'dateStart':_0x23b530[_0x4e6d('0x2a')][_0x4e6d('0x2b')],'dateEnd':_0x23b530[_0x4e6d('0x2a')][_0x4e6d('0x2c')]};delete _0x23b530[_0x4e6d('0x2a')][_0x4e6d('0x2b')];delete _0x23b530[_0x4e6d('0x2a')]['dateEnd'];_0x307bcf[_0x4e6d('0x2a')]=_[_0x4e6d('0x2d')](_0x23b530['query']);_0x307bcf[_0x4e6d('0x2e')]=_[_0x4e6d('0x2f')](_0x307bcf[_0x4e6d('0x29')],_0x307bcf[_0x4e6d('0x2a')]);_0x2e0ec3['attributes']=_[_0x4e6d('0x2f')](_0x307bcf['model'],qs['fields'](_0x23b530[_0x4e6d('0x2a')][_0x4e6d('0x30')]));_0x2e0ec3[_0x4e6d('0x31')]=_0x2e0ec3['attributes']['length']?_0x2e0ec3[_0x4e6d('0x31')]:_0x307bcf[_0x4e6d('0x29')];if(!_0x23b530[_0x4e6d('0x2a')][_0x4e6d('0x32')](_0x4e6d('0x33'))){_0x2e0ec3[_0x4e6d('0x1b')]=qs[_0x4e6d('0x1b')](_0x23b530[_0x4e6d('0x2a')][_0x4e6d('0x1b')]);_0x2e0ec3['offset']=qs[_0x4e6d('0x1a')](_0x23b530[_0x4e6d('0x2a')]['offset']);}_0x2e0ec3[_0x4e6d('0x34')]=qs[_0x4e6d('0x35')](_0x23b530['query'][_0x4e6d('0x35')]);_0x2e0ec3[_0x4e6d('0x36')]=qs[_0x4e6d('0x2e')](_[_0x4e6d('0x37')](_0x23b530['query'],_0x307bcf[_0x4e6d('0x2e')]));if(_0x4736e5[_0x4e6d('0x2b')]){if(_0x4736e5[_0x4e6d('0x2c')]){_0x4736e5[_0x4e6d('0x2c')]=moment(_0x4736e5['dateEnd'])[_0x4e6d('0x38')](0x1,_0x4e6d('0x39'));}else{_0x4736e5[_0x4e6d('0x2c')]=moment(_0x4736e5[_0x4e6d('0x2b')])[_0x4e6d('0x38')](0x1,'day');}_[_0x4e6d('0x3a')](_0x2e0ec3['where'],{'createdAt':{'$gte':_0x4736e5[_0x4e6d('0x2b')],'$lte':_0x4736e5[_0x4e6d('0x2c')]}});}if(_0x23b530[_0x4e6d('0x2a')][_0x4e6d('0x3b')]){_0x2e0ec3[_0x4e6d('0x36')]=_[_0x4e6d('0x3a')](_0x2e0ec3[_0x4e6d('0x36')],{'$or':_[_0x4e6d('0x3c')](_0x2e0ec3[_0x4e6d('0x31')],function(_0x5c7da3){var _0x28c943={};_0x28c943[_0x5c7da3]={'$like':'%'+_0x23b530[_0x4e6d('0x2a')][_0x4e6d('0x3b')]+'%'};return _0x28c943;})});}_0x2e0ec3=_[_0x4e6d('0x3a')]({},_0x2e0ec3,_0x23b530[_0x4e6d('0x3d')]);var _0xc8adbc={'where':_0x2e0ec3['where']};return db['AnalyticMetric'][_0x4e6d('0x19')](_0xc8adbc)['then'](function(_0x348f6a){_0x6e8938[_0x4e6d('0x19')]=_0x348f6a;if(_0x23b530[_0x4e6d('0x2a')][_0x4e6d('0x3e')]){_0x2e0ec3[_0x4e6d('0x3f')]=[{'all':!![]}];}return db[_0x4e6d('0x40')]['findAll'](_0x2e0ec3);})[_0x4e6d('0x1f')](function(_0x45e682){_0x6e8938[_0x4e6d('0x41')]=_0x45e682;return _0x6e8938;})[_0x4e6d('0x1f')](respondWithFilteredResult(_0x464912,_0x2e0ec3))[_0x4e6d('0x42')](handleError(_0x464912,null));};exports['show']=function(_0x444b48,_0x2b0433){var _0x41220a={'raw':!![],'where':{'id':_0x444b48[_0x4e6d('0x43')]['id']}},_0x22c228={};_0x22c228[_0x4e6d('0x29')]=_[_0x4e6d('0x2d')](db['AnalyticMetric']['rawAttributes']);_0x22c228['query']=_[_0x4e6d('0x2d')](_0x444b48[_0x4e6d('0x2a')]);_0x22c228[_0x4e6d('0x2e')]=_[_0x4e6d('0x2f')](_0x22c228[_0x4e6d('0x29')],_0x22c228['query']);_0x41220a[_0x4e6d('0x31')]=_[_0x4e6d('0x2f')](_0x22c228['model'],qs[_0x4e6d('0x30')](_0x444b48[_0x4e6d('0x2a')][_0x4e6d('0x30')]));_0x41220a[_0x4e6d('0x31')]=_0x41220a['attributes']['length']?_0x41220a[_0x4e6d('0x31')]:_0x22c228[_0x4e6d('0x29')];if(_0x444b48['query'][_0x4e6d('0x3e')]){_0x41220a[_0x4e6d('0x3f')]=[{'all':!![]}];}_0x41220a=_[_0x4e6d('0x3a')]({},_0x41220a,_0x444b48['options']);return db[_0x4e6d('0x40')][_0x4e6d('0x44')](_0x41220a)[_0x4e6d('0x1f')](handleEntityNotFound(_0x2b0433,null))[_0x4e6d('0x1f')](respondWithResult(_0x2b0433,null))['catch'](handleError(_0x2b0433,null));};exports['create']=function(_0x3794eb,_0x475f44){return db['AnalyticMetric'][_0x4e6d('0x45')](_0x3794eb[_0x4e6d('0x46')],{})['then'](function(_0xe85c26){var _0x3220d5=_0x3794eb['user'][_0x4e6d('0x20')]({'plain':!![]});if(!_0x3220d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3220d5[_0x4e6d('0x47')]===_0x4e6d('0x48')){var _0x39e297=_0xe85c26[_0x4e6d('0x20')]({'plain':!![]});var _0x3c0161=_0x4e6d('0x21');return db[_0x4e6d('0x49')][_0x4e6d('0x44')]({'where':{'name':_0x3c0161,'userProfileId':_0x3220d5[_0x4e6d('0x4a')]},'raw':!![]})[_0x4e6d('0x1f')](function(_0x14962){if(_0x14962&&_0x14962[_0x4e6d('0x4b')]===0x0){return db[_0x4e6d('0x22')][_0x4e6d('0x45')]({'name':_0x39e297[_0x4e6d('0x25')],'resourceId':_0x39e297['id'],'type':_0x14962[_0x4e6d('0x25')],'sectionId':_0x14962['id']},{})[_0x4e6d('0x1f')](function(){return _0xe85c26;});}else{return _0xe85c26;}})[_0x4e6d('0x42')](function(_0xb3ffb8){logger['error'](_0x4e6d('0x4c'),_0xb3ffb8);throw _0xb3ffb8;});}return _0xe85c26;})[_0x4e6d('0x1f')](respondWithResult(_0x475f44,0xc9))[_0x4e6d('0x42')](handleError(_0x475f44,null));};exports[_0x4e6d('0x1e')]=function(_0x3faafb,_0xb632c6){if(_0x3faafb[_0x4e6d('0x46')]['id']){delete _0x3faafb[_0x4e6d('0x46')]['id'];}return db[_0x4e6d('0x40')][_0x4e6d('0x44')]({'where':{'id':_0x3faafb[_0x4e6d('0x43')]['id']}})[_0x4e6d('0x1f')](handleEntityNotFound(_0xb632c6,null))[_0x4e6d('0x1f')](saveUpdates(_0x3faafb['body'],null))[_0x4e6d('0x1f')](respondWithResult(_0xb632c6,null))[_0x4e6d('0x42')](handleError(_0xb632c6,null));};exports['destroy']=function(_0x335826,_0x18dda8){return db[_0x4e6d('0x40')][_0x4e6d('0x44')]({'where':{'id':_0x335826[_0x4e6d('0x43')]['id']}})[_0x4e6d('0x1f')](handleEntityNotFound(_0x18dda8,null))[_0x4e6d('0x1f')](removeEntity(_0x18dda8,null))[_0x4e6d('0x42')](handleError(_0x18dda8,null));}; \ No newline at end of file +var _0xea2f=['send','index','model','keys','query','dateEnd','dateStart','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','add','day','merge','where','filter','map','options','AnalyticMetric','includeAll','include','findAll','catch','rawAttributes','intersection','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','rimraf','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Metrics','UserProfileResource','error','name'];(function(_0x2812be,_0x1a0e1d){var _0x4ccd2c=function(_0x365eb3){while(--_0x365eb3){_0x2812be['push'](_0x2812be['shift']());}};_0x4ccd2c(++_0x1a0e1d);}(_0xea2f,0x1ea));var _0xfea2=function(_0x528f09,_0x2ea787){_0x528f09=_0x528f09-0x0;var _0x46cc00=_0xea2f[_0x528f09];return _0x46cc00;};'use strict';var pdf=require(_0xfea2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfea2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfea2('0x2'));var Mustache=require(_0xfea2('0x3'));var util=require(_0xfea2('0x4'));var path=require(_0xfea2('0x5'));var sox=require(_0xfea2('0x6'));var csv=require(_0xfea2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfea2('0x8'));var squel=require(_0xfea2('0x9'));var crypto=require(_0xfea2('0xa'));var jsforce=require(_0xfea2('0xb'));var deskjs=require(_0xfea2('0xc'));var toCsv=require(_0xfea2('0x7'));var querystring=require('querystring');var Papa=require(_0xfea2('0xd'));var Redis=require(_0xfea2('0xe'));var qs=require(_0xfea2('0xf'));var logger=require(_0xfea2('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xfea2('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ad4c9,_0x4891f5){_0x4891f5=_0x4891f5||0xcc;return function(_0x547e21){if(_0x547e21){return _0x5ad4c9['sendStatus'](_0x4891f5);}return _0x5ad4c9[_0xfea2('0x12')](_0x4891f5)[_0xfea2('0x13')]();};}function respondWithResult(_0x84b262,_0x1b9373){_0x1b9373=_0x1b9373||0xc8;return function(_0x379af1){if(_0x379af1){return _0x84b262[_0xfea2('0x12')](_0x1b9373)[_0xfea2('0x14')](_0x379af1);}};}function respondWithFilteredResult(_0x52dcc8,_0x366945){return function(_0xd5eaec){if(_0xd5eaec){var _0x2fc26c=_0xd5eaec[_0xfea2('0x15')],_0x596ba1=_0x366945['offset'],_0x1da6dd=_0x366945[_0xfea2('0x16')]+_0x366945['limit'],_0x31866b;if(_0x1da6dd>=_0x2fc26c){_0x1da6dd=_0x2fc26c;_0x31866b=0xc8;}else{_0x31866b=0xce;}_0x52dcc8[_0xfea2('0x12')](_0x31866b);return _0x52dcc8[_0xfea2('0x17')](_0xfea2('0x18'),_0x596ba1+'-'+_0x1da6dd+'/'+_0x2fc26c)[_0xfea2('0x14')](_0xd5eaec);}return null;};}function patchUpdates(_0x536a3e){return function(_0x39cd5b){try{jsonpatch[_0xfea2('0x19')](_0x39cd5b,_0x536a3e,!![]);}catch(_0x24fb06){return BPromise[_0xfea2('0x1a')](_0x24fb06);}return _0x39cd5b[_0xfea2('0x1b')]();};}function saveUpdates(_0x44b4f1,_0x3de5b0){return function(_0x1975fd){if(_0x1975fd){return _0x1975fd[_0xfea2('0x1c')](_0x44b4f1)[_0xfea2('0x1d')](function(_0x3a3921){return _0x3a3921;});}return null;};}function removeEntity(_0x335a83,_0x43aeb1){return function(_0x1221a3){if(_0x1221a3){return _0x1221a3[_0xfea2('0x1e')]()['then'](function(){var _0x10e1a3=_0x1221a3['get']({'plain':!![]});var _0x4d3e36=_0xfea2('0x1f');return db[_0xfea2('0x20')][_0xfea2('0x1e')]({'where':{'type':_0x4d3e36,'resourceId':_0x10e1a3['id']}})[_0xfea2('0x1d')](function(){return _0x1221a3;});})[_0xfea2('0x1d')](function(){_0x335a83[_0xfea2('0x12')](0xcc)[_0xfea2('0x13')]();});}};}function handleEntityNotFound(_0x128eb1,_0x42a056){return function(_0x176475){if(!_0x176475){_0x128eb1['sendStatus'](0x194);}return _0x176475;};}function handleError(_0x27916e,_0x208f80){_0x208f80=_0x208f80||0x1f4;return function(_0x55a76c){logger[_0xfea2('0x21')](_0x55a76c['stack']);if(_0x55a76c[_0xfea2('0x22')]){delete _0x55a76c[_0xfea2('0x22')];}_0x27916e[_0xfea2('0x12')](_0x208f80)[_0xfea2('0x23')](_0x55a76c);};}exports[_0xfea2('0x24')]=function(_0x379268,_0x4dc6c1){var _0x2b6e76={},_0x333efa={},_0x38e7c5={'count':0x0,'rows':[]};var _0x22f73f=db['AnalyticMetric']['rawAttributes'];_0x333efa[_0xfea2('0x25')]=_[_0xfea2('0x26')](_0x22f73f);var _0x44827c={'dateStart':_0x379268[_0xfea2('0x27')]['dateStart'],'dateEnd':_0x379268[_0xfea2('0x27')][_0xfea2('0x28')]};delete _0x379268[_0xfea2('0x27')][_0xfea2('0x29')];delete _0x379268[_0xfea2('0x27')]['dateEnd'];_0x333efa[_0xfea2('0x27')]=_['keys'](_0x379268[_0xfea2('0x27')]);_0x333efa[_0xfea2('0x2a')]=_['intersection'](_0x333efa[_0xfea2('0x25')],_0x333efa[_0xfea2('0x27')]);_0x2b6e76['attributes']=_['intersection'](_0x333efa[_0xfea2('0x25')],qs['fields'](_0x379268['query'][_0xfea2('0x2b')]));_0x2b6e76[_0xfea2('0x2c')]=_0x2b6e76['attributes'][_0xfea2('0x2d')]?_0x2b6e76[_0xfea2('0x2c')]:_0x333efa[_0xfea2('0x25')];if(!_0x379268[_0xfea2('0x27')][_0xfea2('0x2e')](_0xfea2('0x2f'))){_0x2b6e76['limit']=qs[_0xfea2('0x30')](_0x379268['query'][_0xfea2('0x30')]);_0x2b6e76[_0xfea2('0x16')]=qs[_0xfea2('0x16')](_0x379268[_0xfea2('0x27')][_0xfea2('0x16')]);}_0x2b6e76['order']=qs[_0xfea2('0x31')](_0x379268[_0xfea2('0x27')]['sort']);_0x2b6e76['where']=qs[_0xfea2('0x2a')](_['pick'](_0x379268['query'],_0x333efa[_0xfea2('0x2a')]));if(_0x44827c[_0xfea2('0x29')]){if(_0x44827c[_0xfea2('0x28')]){_0x44827c[_0xfea2('0x28')]=moment(_0x44827c[_0xfea2('0x28')])[_0xfea2('0x32')](0x1,_0xfea2('0x33'));}else{_0x44827c['dateEnd']=moment(_0x44827c[_0xfea2('0x29')])[_0xfea2('0x32')](0x1,_0xfea2('0x33'));}_[_0xfea2('0x34')](_0x2b6e76[_0xfea2('0x35')],{'createdAt':{'$gte':_0x44827c[_0xfea2('0x29')],'$lte':_0x44827c['dateEnd']}});}if(_0x379268[_0xfea2('0x27')][_0xfea2('0x36')]){_0x2b6e76[_0xfea2('0x35')]=_[_0xfea2('0x34')](_0x2b6e76[_0xfea2('0x35')],{'$or':_[_0xfea2('0x37')](_0x2b6e76[_0xfea2('0x2c')],function(_0x562bc8){var _0x6060b6={};_0x6060b6[_0x562bc8]={'$like':'%'+_0x379268[_0xfea2('0x27')][_0xfea2('0x36')]+'%'};return _0x6060b6;})});}_0x2b6e76=_[_0xfea2('0x34')]({},_0x2b6e76,_0x379268[_0xfea2('0x38')]);var _0x2b0c0f={'where':_0x2b6e76['where']};return db[_0xfea2('0x39')]['count'](_0x2b0c0f)[_0xfea2('0x1d')](function(_0xc11ce4){_0x38e7c5[_0xfea2('0x15')]=_0xc11ce4;if(_0x379268[_0xfea2('0x27')][_0xfea2('0x3a')]){_0x2b6e76[_0xfea2('0x3b')]=[{'all':!![]}];}return db['AnalyticMetric'][_0xfea2('0x3c')](_0x2b6e76);})[_0xfea2('0x1d')](function(_0x526546){_0x38e7c5['rows']=_0x526546;return _0x38e7c5;})['then'](respondWithFilteredResult(_0x4dc6c1,_0x2b6e76))[_0xfea2('0x3d')](handleError(_0x4dc6c1,null));};exports['show']=function(_0x34f6bd,_0x119556){var _0x4b52f6={'raw':!![],'where':{'id':_0x34f6bd['params']['id']}},_0x3748e6={};_0x3748e6[_0xfea2('0x25')]=_[_0xfea2('0x26')](db['AnalyticMetric'][_0xfea2('0x3e')]);_0x3748e6[_0xfea2('0x27')]=_[_0xfea2('0x26')](_0x34f6bd[_0xfea2('0x27')]);_0x3748e6[_0xfea2('0x2a')]=_[_0xfea2('0x3f')](_0x3748e6[_0xfea2('0x25')],_0x3748e6[_0xfea2('0x27')]);_0x4b52f6[_0xfea2('0x2c')]=_[_0xfea2('0x3f')](_0x3748e6[_0xfea2('0x25')],qs[_0xfea2('0x2b')](_0x34f6bd[_0xfea2('0x27')][_0xfea2('0x2b')]));_0x4b52f6[_0xfea2('0x2c')]=_0x4b52f6[_0xfea2('0x2c')]['length']?_0x4b52f6['attributes']:_0x3748e6[_0xfea2('0x25')];if(_0x34f6bd[_0xfea2('0x27')]['includeAll']){_0x4b52f6[_0xfea2('0x3b')]=[{'all':!![]}];}_0x4b52f6=_[_0xfea2('0x34')]({},_0x4b52f6,_0x34f6bd[_0xfea2('0x38')]);return db[_0xfea2('0x39')][_0xfea2('0x40')](_0x4b52f6)['then'](handleEntityNotFound(_0x119556,null))[_0xfea2('0x1d')](respondWithResult(_0x119556,null))[_0xfea2('0x3d')](handleError(_0x119556,null));};exports[_0xfea2('0x41')]=function(_0x239c5b,_0x33e87f){return db[_0xfea2('0x39')]['create'](_0x239c5b['body'],{})[_0xfea2('0x1d')](function(_0x1e8080){var _0x24b08c=_0x239c5b[_0xfea2('0x42')][_0xfea2('0x43')]({'plain':!![]});if(!_0x24b08c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24b08c[_0xfea2('0x44')]===_0xfea2('0x42')){var _0x124799=_0x1e8080[_0xfea2('0x43')]({'plain':!![]});var _0x4a14f8=_0xfea2('0x1f');return db[_0xfea2('0x45')][_0xfea2('0x40')]({'where':{'name':_0x4a14f8,'userProfileId':_0x24b08c[_0xfea2('0x46')]},'raw':!![]})[_0xfea2('0x1d')](function(_0x181889){if(_0x181889&&_0x181889[_0xfea2('0x47')]===0x0){return db[_0xfea2('0x20')][_0xfea2('0x41')]({'name':_0x124799[_0xfea2('0x22')],'resourceId':_0x124799['id'],'type':_0x181889[_0xfea2('0x22')],'sectionId':_0x181889['id']},{})[_0xfea2('0x1d')](function(){return _0x1e8080;});}else{return _0x1e8080;}})[_0xfea2('0x3d')](function(_0x2df1d5){logger[_0xfea2('0x21')](_0xfea2('0x48'),_0x2df1d5);throw _0x2df1d5;});}return _0x1e8080;})[_0xfea2('0x1d')](respondWithResult(_0x33e87f,0xc9))[_0xfea2('0x3d')](handleError(_0x33e87f,null));};exports['update']=function(_0x43385d,_0x164f16){if(_0x43385d[_0xfea2('0x49')]['id']){delete _0x43385d[_0xfea2('0x49')]['id'];}return db['AnalyticMetric'][_0xfea2('0x40')]({'where':{'id':_0x43385d['params']['id']}})[_0xfea2('0x1d')](handleEntityNotFound(_0x164f16,null))[_0xfea2('0x1d')](saveUpdates(_0x43385d[_0xfea2('0x49')],null))['then'](respondWithResult(_0x164f16,null))['catch'](handleError(_0x164f16,null));};exports[_0xfea2('0x1e')]=function(_0x17872a,_0x454f73){return db[_0xfea2('0x39')]['find']({'where':{'id':_0x17872a[_0xfea2('0x4a')]['id']}})[_0xfea2('0x1d')](handleEntityNotFound(_0x454f73,null))[_0xfea2('0x1d')](removeEntity(_0x454f73,null))[_0xfea2('0x3d')](handleError(_0x454f73,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 6ff0aad..22a871e 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 _0x529e=['moment','request-promise','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger'];(function(_0x5ebe79,_0xbe9d6b){var _0x898c34=function(_0x173f73){while(--_0x173f73){_0x5ebe79['push'](_0x5ebe79['shift']());}};_0x898c34(++_0xbe9d6b);}(_0x529e,0x183));var _0xe529=function(_0x342798,_0x157e25){_0x342798=_0x342798-0x0;var _0x34d9aa=_0x529e[_0x342798];return _0x34d9aa;};'use strict';var _=require(_0xe529('0x0'));var util=require(_0xe529('0x1'));var logger=require(_0xe529('0x2'))('api');var moment=require(_0xe529('0x3'));var BPromise=require('bluebird');var rp=require(_0xe529('0x4'));var attributes=require(_0xe529('0x5'));module[_0xe529('0x6')]=function(_0x5594b3,_0x203e19){return _0x5594b3[_0xe529('0x7')](_0xe529('0x8'),attributes,{'tableName':_0xe529('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7e9=['api','moment','request-promise','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','../../config/logger'];(function(_0x1b4853,_0x3c1e83){var _0x4b17f8=function(_0x430b10){while(--_0x430b10){_0x1b4853['push'](_0x1b4853['shift']());}};_0x4b17f8(++_0x3c1e83);}(_0xa7e9,0x127));var _0x9a7e=function(_0x33ad14,_0x4f5193){_0x33ad14=_0x33ad14-0x0;var _0x875e12=_0xa7e9[_0x33ad14];return _0x875e12;};'use strict';var _=require(_0x9a7e('0x0'));var util=require('util');var logger=require(_0x9a7e('0x1'))(_0x9a7e('0x2'));var moment=require(_0x9a7e('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a7e('0x4'));var attributes=require(_0x9a7e('0x5'));module[_0x9a7e('0x6')]=function(_0x6af5ae,_0x2b1974){return _0x6af5ae['define'](_0x9a7e('0x7'),attributes,{'tableName':_0x9a7e('0x8'),'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 7f44b12..769d0bb 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 _0x47c7=['request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x501165,_0x56fb0b){var _0x523247=function(_0x2e2da7){while(--_0x2e2da7){_0x501165['push'](_0x501165['shift']());}};_0x523247(++_0x56fb0b);}(_0x47c7,0x1ab));var _0x747c=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0x47c7[_0x2e0443];return _0x52d450;};'use strict';var _=require(_0x747c('0x0'));var util=require('util');var moment=require(_0x747c('0x1'));var BPromise=require(_0x747c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x747c('0x3'));var db=require(_0x747c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x747c('0x5'))(_0x747c('0x6'));var config=require(_0x747c('0x7'));var jayson=require(_0x747c('0x8'));var client=jayson['client'][_0x747c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eb6bc,_0xfc4504,_0x24206f){return new BPromise(function(_0x10b9f0,_0x21e0f1){return client[_0x747c('0xa')](_0x4eb6bc,_0x24206f)['then'](function(_0x47eac8){logger[_0x747c('0xb')](_0x747c('0xc'),_0xfc4504,_0x747c('0xd'));logger['debug'](_0x747c('0xe'),_0xfc4504,_0x747c('0xd'),JSON[_0x747c('0xf')](_0x47eac8));if(_0x47eac8['error']){if(_0x47eac8[_0x747c('0x10')]['code']===0x1f4){logger['error'](_0x747c('0xc'),_0xfc4504,_0x47eac8[_0x747c('0x10')][_0x747c('0x11')]);return _0x21e0f1(_0x47eac8[_0x747c('0x10')][_0x747c('0x11')]);}logger[_0x747c('0x10')](_0x747c('0xc'),_0xfc4504,_0x47eac8[_0x747c('0x10')][_0x747c('0x11')]);return _0x10b9f0(_0x47eac8[_0x747c('0x10')]['message']);}else{logger['info'](_0x747c('0xc'),_0xfc4504,_0x747c('0xd'));_0x10b9f0(_0x47eac8[_0x747c('0x12')]['message']);}})[_0x747c('0x13')](function(_0x1887d6){logger[_0x747c('0x10')](_0x747c('0xc'),_0xfc4504,_0x1887d6);_0x21e0f1(_0x1887d6);});});} \ No newline at end of file +var _0x4b1f=['stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x4b1f,0x195));var _0xf4b1=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4b1f[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var moment=require('moment');var BPromise=require(_0xf4b1('0x2'));var rs=require(_0xf4b1('0x3'));var fs=require('fs');var Redis=require(_0xf4b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4b1('0x5'));var logger=require(_0xf4b1('0x6'))(_0xf4b1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf4b1('0x8')][_0xf4b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310db5,_0x3b9c78,_0x1abfc7){return new BPromise(function(_0x50738c,_0x59cf77){return client['request'](_0x310db5,_0x1abfc7)[_0xf4b1('0xa')](function(_0x53a786){logger[_0xf4b1('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x3b9c78,'request\x20sent');logger[_0xf4b1('0xc')](_0xf4b1('0xd'),_0x3b9c78,_0xf4b1('0xe'),JSON[_0xf4b1('0xf')](_0x53a786));if(_0x53a786[_0xf4b1('0x10')]){if(_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x11')]===0x1f4){logger[_0xf4b1('0x10')](_0xf4b1('0x12'),_0x3b9c78,_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x13')]);return _0x59cf77(_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x13')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3b9c78,_0x53a786[_0xf4b1('0x10')]['message']);return _0x50738c(_0x53a786['error'][_0xf4b1('0x13')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x3b9c78,_0xf4b1('0xe'));_0x50738c(_0x53a786['result']['message']);}})['catch'](function(_0x5cb2a1){logger[_0xf4b1('0x10')](_0xf4b1('0x12'),_0x3b9c78,_0x5cb2a1);_0x59cf77(_0x5cb2a1);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c502a7f..b84f83c 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 _0x1b0e=['multer','util','path','connect-timeout','express','Router','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','show','create','put','/:id','update','delete','destroy'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1b0e,0x132));var _0xe1b0=function(_0x2dab,_0x1ae9b2){_0x2dab=_0x2dab-0x0;var _0x3ba6f=_0x1b0e[_0x2dab];return _0x3ba6f;};'use strict';var multer=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var path=require(_0xe1b0('0x2'));var timeout=require(_0xe1b0('0x3'));var express=require(_0xe1b0('0x4'));var router=express[_0xe1b0('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe1b0('0x6'));var controller=require(_0xe1b0('0x7'));router['get']('/',auth[_0xe1b0('0x8')](),controller[_0xe1b0('0x9')]);router[_0xe1b0('0xa')]('/:id',auth[_0xe1b0('0x8')](),controller[_0xe1b0('0xb')]);router['post']('/',auth[_0xe1b0('0x8')](),controller[_0xe1b0('0xc')]);router[_0xe1b0('0xd')](_0xe1b0('0xe'),auth[_0xe1b0('0x8')](),controller[_0xe1b0('0xf')]);router[_0xe1b0('0x10')](_0xe1b0('0xe'),auth[_0xe1b0('0x8')](),controller[_0xe1b0('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7382=['../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','post','create','update','destroy','util','../../components/interaction/service'];(function(_0x275e13,_0x213621){var _0x26ab03=function(_0x34f0ef){while(--_0x34f0ef){_0x275e13['push'](_0x275e13['shift']());}};_0x26ab03(++_0x213621);}(_0x7382,0x111));var _0x2738=function(_0x36a6dc,_0x3b6f16){_0x36a6dc=_0x36a6dc-0x0;var _0x1036dd=_0x7382[_0x36a6dc];return _0x1036dd;};'use strict';var multer=require('multer');var util=require(_0x2738('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2738('0x1'));var config=require(_0x2738('0x2'));var controller=require(_0x2738('0x3'));router[_0x2738('0x4')]('/',auth[_0x2738('0x5')](),controller['index']);router[_0x2738('0x4')](_0x2738('0x6'),auth[_0x2738('0x5')](),controller['show']);router[_0x2738('0x7')]('/',auth[_0x2738('0x5')](),controller[_0x2738('0x8')]);router['put'](_0x2738('0x6'),auth[_0x2738('0x5')](),controller[_0x2738('0x9')]);router['delete'](_0x2738('0x6'),auth[_0x2738('0x5')](),controller[_0x2738('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index e465db4..634e565 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 _0xc799=['sequelize','exports'];(function(_0x36d384,_0x36096e){var _0x2d5e63=function(_0x1f5b56){while(--_0x1f5b56){_0x36d384['push'](_0x36d384['shift']());}};_0x2d5e63(++_0x36096e);}(_0xc799,0x174));var _0x9c79=function(_0x286726,_0x17c56b){_0x286726=_0x286726-0x0;var _0xf9c34=_0xc799[_0x286726];return _0xf9c34;};'use strict';var Sequelize=require(_0x9c79('0x0'));module[_0x9c79('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x9184=['exports','TEXT','sequelize'];(function(_0x10aea4,_0x3ed848){var _0x4603ef=function(_0x45f91d){while(--_0x45f91d){_0x10aea4['push'](_0x10aea4['shift']());}};_0x4603ef(++_0x3ed848);}(_0x9184,0x12b));var _0x4918=function(_0x47f7f5,_0xa5caf){_0x47f7f5=_0x47f7f5-0x0;var _0x52fe6b=_0x9184[_0x47f7f5];return _0x52fe6b;};'use strict';var Sequelize=require(_0x4918('0x0'));module[_0x4918('0x1')]={'tree':{'type':Sequelize[_0x4918('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 20cb825..9ca2b8b 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 _0x33c5=['find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','add','day','filter','merge','map','options','count','includeAll','include','rows','show'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x33c5,0xe6));var _0x533c=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0x33c5[_0x1f5143];return _0x383a38;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x533c('0x0'));var rimraf=require(_0x533c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x533c('0x2'));var rp=require(_0x533c('0x3'));var moment=require(_0x533c('0x4'));var BPromise=require(_0x533c('0x5'));var Mustache=require(_0x533c('0x6'));var util=require('util');var path=require(_0x533c('0x7'));var sox=require(_0x533c('0x8'));var csv=require(_0x533c('0x9'));var ejs=require(_0x533c('0xa'));var fs=require('fs');var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x9'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var qs=require(_0x533c('0x13'));var logger=require(_0x533c('0x14'))(_0x533c('0x15'));var utils=require('../../config/utils');var config=require(_0x533c('0x16'));var db=require(_0x533c('0x17'))['db'];function respondWithStatusCode(_0x272a11,_0x1e2b68){_0x1e2b68=_0x1e2b68||0xcc;return function(_0x1a2c22){if(_0x1a2c22){return _0x272a11[_0x533c('0x18')](_0x1e2b68);}return _0x272a11['status'](_0x1e2b68)[_0x533c('0x19')]();};}function respondWithResult(_0xf93007,_0x300a63){_0x300a63=_0x300a63||0xc8;return function(_0x12ecae){if(_0x12ecae){return _0xf93007[_0x533c('0x1a')](_0x300a63)[_0x533c('0x1b')](_0x12ecae);}};}function respondWithFilteredResult(_0x8d7c66,_0xa616ca){return function(_0x59298d){if(_0x59298d){var _0x335f73=_0x59298d['count'],_0x7c1d33=_0xa616ca[_0x533c('0x1c')],_0x3f4a5c=_0xa616ca[_0x533c('0x1c')]+_0xa616ca[_0x533c('0x1d')],_0x3e544f;if(_0x3f4a5c>=_0x335f73){_0x3f4a5c=_0x335f73;_0x3e544f=0xc8;}else{_0x3e544f=0xce;}_0x8d7c66[_0x533c('0x1a')](_0x3e544f);return _0x8d7c66[_0x533c('0x1e')](_0x533c('0x1f'),_0x7c1d33+'-'+_0x3f4a5c+'/'+_0x335f73)[_0x533c('0x1b')](_0x59298d);}return null;};}function patchUpdates(_0x35bfd3){return function(_0x1f9f85){try{jsonpatch[_0x533c('0x20')](_0x1f9f85,_0x35bfd3,!![]);}catch(_0x287b9e){return BPromise[_0x533c('0x21')](_0x287b9e);}return _0x1f9f85[_0x533c('0x22')]();};}function saveUpdates(_0x23f970,_0x2f21db){return function(_0x3de9fa){if(_0x3de9fa){return _0x3de9fa[_0x533c('0x23')](_0x23f970)[_0x533c('0x24')](function(_0x4ba0bd){return _0x4ba0bd;});}return null;};}function removeEntity(_0xce8d9,_0x51785c){return function(_0x57f5aa){if(_0x57f5aa){return _0x57f5aa[_0x533c('0x25')]()[_0x533c('0x24')](function(){_0xce8d9['status'](0xcc)[_0x533c('0x19')]();});}};}function handleEntityNotFound(_0x37651e,_0x3839fe){return function(_0x3dd249){if(!_0x3dd249){_0x37651e['sendStatus'](0x194);}return _0x3dd249;};}function handleError(_0x3762f7,_0x42c87b){_0x42c87b=_0x42c87b||0x1f4;return function(_0x3ff86f){logger[_0x533c('0x26')](_0x3ff86f[_0x533c('0x27')]);if(_0x3ff86f[_0x533c('0x28')]){delete _0x3ff86f[_0x533c('0x28')];}_0x3762f7[_0x533c('0x1a')](_0x42c87b)[_0x533c('0x29')](_0x3ff86f);};}exports[_0x533c('0x2a')]=function(_0x4d47d0,_0x11d775){var _0xfab4da={},_0x503c2e={},_0x3caaa5={'count':0x0,'rows':[]};var _0x4f9f4a=db[_0x533c('0x2b')][_0x533c('0x2c')];_0x503c2e[_0x533c('0x2d')]=_[_0x533c('0x2e')](_0x4f9f4a);var _0x425f60={'dateStart':_0x4d47d0[_0x533c('0x2f')][_0x533c('0x30')],'dateEnd':_0x4d47d0[_0x533c('0x2f')][_0x533c('0x31')]};delete _0x4d47d0[_0x533c('0x2f')][_0x533c('0x30')];delete _0x4d47d0[_0x533c('0x2f')]['dateEnd'];_0x503c2e[_0x533c('0x2f')]=_['keys'](_0x4d47d0[_0x533c('0x2f')]);_0x503c2e[_0x533c('0x32')]=_[_0x533c('0x33')](_0x503c2e[_0x533c('0x2d')],_0x503c2e[_0x533c('0x2f')]);_0xfab4da[_0x533c('0x34')]=_[_0x533c('0x33')](_0x503c2e[_0x533c('0x2d')],qs[_0x533c('0x35')](_0x4d47d0[_0x533c('0x2f')][_0x533c('0x35')]));_0xfab4da[_0x533c('0x34')]=_0xfab4da[_0x533c('0x34')][_0x533c('0x36')]?_0xfab4da[_0x533c('0x34')]:_0x503c2e['model'];if(!_0x4d47d0[_0x533c('0x2f')][_0x533c('0x37')](_0x533c('0x38'))){_0xfab4da[_0x533c('0x1d')]=qs['limit'](_0x4d47d0[_0x533c('0x2f')][_0x533c('0x1d')]);_0xfab4da[_0x533c('0x1c')]=qs[_0x533c('0x1c')](_0x4d47d0[_0x533c('0x2f')]['offset']);}_0xfab4da['order']=qs['sort'](_0x4d47d0['query']['sort']);_0xfab4da[_0x533c('0x39')]=qs['filters'](_[_0x533c('0x3a')](_0x4d47d0['query'],_0x503c2e[_0x533c('0x32')]));if(_0x425f60[_0x533c('0x30')]){if(_0x425f60[_0x533c('0x31')]){_0x425f60['dateEnd']=moment(_0x425f60[_0x533c('0x31')])[_0x533c('0x3b')](0x1,_0x533c('0x3c'));}else{_0x425f60['dateEnd']=moment(_0x425f60[_0x533c('0x30')])[_0x533c('0x3b')](0x1,_0x533c('0x3c'));}_['merge'](_0xfab4da[_0x533c('0x39')],{'createdAt':{'$gte':_0x425f60[_0x533c('0x30')],'$lte':_0x425f60[_0x533c('0x31')]}});}if(_0x4d47d0[_0x533c('0x2f')][_0x533c('0x3d')]){_0xfab4da[_0x533c('0x39')]=_[_0x533c('0x3e')](_0xfab4da[_0x533c('0x39')],{'$or':_[_0x533c('0x3f')](_0xfab4da[_0x533c('0x34')],function(_0x298cea){var _0x55af6e={};_0x55af6e[_0x298cea]={'$like':'%'+_0x4d47d0[_0x533c('0x2f')][_0x533c('0x3d')]+'%'};return _0x55af6e;})});}_0xfab4da=_[_0x533c('0x3e')]({},_0xfab4da,_0x4d47d0[_0x533c('0x40')]);var _0x29b4c6={'where':_0xfab4da[_0x533c('0x39')]};return db['AnalyticTreeReport'][_0x533c('0x41')](_0x29b4c6)[_0x533c('0x24')](function(_0x41f5a2){_0x3caaa5['count']=_0x41f5a2;if(_0x4d47d0[_0x533c('0x2f')][_0x533c('0x42')]){_0xfab4da[_0x533c('0x43')]=[{'all':!![]}];}return db[_0x533c('0x2b')]['findAll'](_0xfab4da);})[_0x533c('0x24')](function(_0x4f5e26){_0x3caaa5[_0x533c('0x44')]=_0x4f5e26;return _0x3caaa5;})[_0x533c('0x24')](respondWithFilteredResult(_0x11d775,_0xfab4da))['catch'](handleError(_0x11d775,null));};exports[_0x533c('0x45')]=function(_0x3f1e47,_0x115d79){var _0x599b7e={'raw':!![],'where':{'id':_0x3f1e47['params']['id']}},_0x4d96cf={};_0x4d96cf['model']=_[_0x533c('0x2e')](db['AnalyticTreeReport'][_0x533c('0x2c')]);_0x4d96cf['query']=_[_0x533c('0x2e')](_0x3f1e47['query']);_0x4d96cf[_0x533c('0x32')]=_[_0x533c('0x33')](_0x4d96cf['model'],_0x4d96cf[_0x533c('0x2f')]);_0x599b7e[_0x533c('0x34')]=_[_0x533c('0x33')](_0x4d96cf[_0x533c('0x2d')],qs[_0x533c('0x35')](_0x3f1e47['query'][_0x533c('0x35')]));_0x599b7e[_0x533c('0x34')]=_0x599b7e[_0x533c('0x34')][_0x533c('0x36')]?_0x599b7e['attributes']:_0x4d96cf[_0x533c('0x2d')];if(_0x3f1e47[_0x533c('0x2f')]['includeAll']){_0x599b7e['include']=[{'all':!![]}];}_0x599b7e=_[_0x533c('0x3e')]({},_0x599b7e,_0x3f1e47['options']);return db[_0x533c('0x2b')][_0x533c('0x46')](_0x599b7e)[_0x533c('0x24')](handleEntityNotFound(_0x115d79,null))[_0x533c('0x24')](respondWithResult(_0x115d79,null))[_0x533c('0x47')](handleError(_0x115d79,null));};exports[_0x533c('0x48')]=function(_0xa34f64,_0x654ad7){return db['AnalyticTreeReport'][_0x533c('0x48')](_0xa34f64[_0x533c('0x49')],{})[_0x533c('0x24')](respondWithResult(_0x654ad7,0xc9))['catch'](handleError(_0x654ad7,null));};exports[_0x533c('0x23')]=function(_0x30f457,_0x5ce027){if(_0x30f457[_0x533c('0x49')]['id']){delete _0x30f457['body']['id'];}return db[_0x533c('0x2b')][_0x533c('0x46')]({'where':{'id':_0x30f457[_0x533c('0x4a')]['id']}})[_0x533c('0x24')](handleEntityNotFound(_0x5ce027,null))[_0x533c('0x24')](saveUpdates(_0x30f457[_0x533c('0x49')],null))[_0x533c('0x24')](respondWithResult(_0x5ce027,null))['catch'](handleError(_0x5ce027,null));};exports[_0x533c('0x25')]=function(_0x24c2f4,_0x349bd7){return db[_0x533c('0x2b')][_0x533c('0x46')]({'where':{'id':_0x24c2f4[_0x533c('0x4a')]['id']}})[_0x533c('0x24')](handleEntityNotFound(_0x349bd7,null))['then'](removeEntity(_0x349bd7,null))['catch'](handleError(_0x349bd7,null));}; \ No newline at end of file +var _0xed1f=['index','AnalyticTreeReport','model','query','dateEnd','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','dateStart','add','day','merge','filter','map','options','count','includeAll','include','rows','catch','show','params','rawAttributes','intersection','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','Content-Range','json','save','update','then','error','stack','name','send'];(function(_0x257de3,_0x5cd303){var _0x22862b=function(_0x1fed20){while(--_0x1fed20){_0x257de3['push'](_0x257de3['shift']());}};_0x22862b(++_0x5cd303);}(_0xed1f,0x6a));var _0xfed1=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xed1f[_0x220f3f];return _0x1f170e;};'use strict';var pdf=require(_0xfed1('0x0'));var emlformat=require(_0xfed1('0x1'));var rimraf=require(_0xfed1('0x2'));var zipdir=require(_0xfed1('0x3'));var jsonpatch=require(_0xfed1('0x4'));var rp=require(_0xfed1('0x5'));var moment=require(_0xfed1('0x6'));var BPromise=require(_0xfed1('0x7'));var Mustache=require(_0xfed1('0x8'));var util=require(_0xfed1('0x9'));var path=require(_0xfed1('0xa'));var sox=require(_0xfed1('0xb'));var csv=require(_0xfed1('0xc'));var ejs=require(_0xfed1('0xd'));var fs=require('fs');var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xc'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var qs=require(_0xfed1('0x14'));var logger=require('../../config/logger')(_0xfed1('0x15'));var utils=require('../../config/utils');var config=require(_0xfed1('0x16'));var db=require(_0xfed1('0x17'))['db'];function respondWithStatusCode(_0x4a8369,_0x5c0b5f){_0x5c0b5f=_0x5c0b5f||0xcc;return function(_0x3d1891){if(_0x3d1891){return _0x4a8369[_0xfed1('0x18')](_0x5c0b5f);}return _0x4a8369['status'](_0x5c0b5f)[_0xfed1('0x19')]();};}function respondWithResult(_0x5a3469,_0x529b3d){_0x529b3d=_0x529b3d||0xc8;return function(_0x3f6555){if(_0x3f6555){return _0x5a3469[_0xfed1('0x1a')](_0x529b3d)['json'](_0x3f6555);}};}function respondWithFilteredResult(_0x2dde3a,_0x5b9455){return function(_0x4cd9d1){if(_0x4cd9d1){var _0xde25db=_0x4cd9d1['count'],_0x39aa0c=_0x5b9455[_0xfed1('0x1b')],_0x1fbb7a=_0x5b9455['offset']+_0x5b9455[_0xfed1('0x1c')],_0x123c46;if(_0x1fbb7a>=_0xde25db){_0x1fbb7a=_0xde25db;_0x123c46=0xc8;}else{_0x123c46=0xce;}_0x2dde3a[_0xfed1('0x1a')](_0x123c46);return _0x2dde3a['set'](_0xfed1('0x1d'),_0x39aa0c+'-'+_0x1fbb7a+'/'+_0xde25db)[_0xfed1('0x1e')](_0x4cd9d1);}return null;};}function patchUpdates(_0x5c0d9f){return function(_0x59509b){try{jsonpatch['apply'](_0x59509b,_0x5c0d9f,!![]);}catch(_0x1e5afb){return BPromise['reject'](_0x1e5afb);}return _0x59509b[_0xfed1('0x1f')]();};}function saveUpdates(_0x34fa04,_0x51a860){return function(_0x94cb84){if(_0x94cb84){return _0x94cb84[_0xfed1('0x20')](_0x34fa04)['then'](function(_0x3ce944){return _0x3ce944;});}return null;};}function removeEntity(_0x2ea7a8,_0xff4842){return function(_0x92b92d){if(_0x92b92d){return _0x92b92d['destroy']()[_0xfed1('0x21')](function(){_0x2ea7a8['status'](0xcc)[_0xfed1('0x19')]();});}};}function handleEntityNotFound(_0x1317c8,_0x37c384){return function(_0x532ec2){if(!_0x532ec2){_0x1317c8[_0xfed1('0x18')](0x194);}return _0x532ec2;};}function handleError(_0x594917,_0x460555){_0x460555=_0x460555||0x1f4;return function(_0x2793b7){logger[_0xfed1('0x22')](_0x2793b7[_0xfed1('0x23')]);if(_0x2793b7[_0xfed1('0x24')]){delete _0x2793b7[_0xfed1('0x24')];}_0x594917['status'](_0x460555)[_0xfed1('0x25')](_0x2793b7);};}exports[_0xfed1('0x26')]=function(_0x49072b,_0x1d6c72){var _0x2b9dd2={},_0x1b871a={},_0x1d62c5={'count':0x0,'rows':[]};var _0x3b9122=db[_0xfed1('0x27')]['rawAttributes'];_0x1b871a[_0xfed1('0x28')]=_['keys'](_0x3b9122);var _0x3106ee={'dateStart':_0x49072b['query']['dateStart'],'dateEnd':_0x49072b[_0xfed1('0x29')][_0xfed1('0x2a')]};delete _0x49072b[_0xfed1('0x29')]['dateStart'];delete _0x49072b[_0xfed1('0x29')][_0xfed1('0x2a')];_0x1b871a[_0xfed1('0x29')]=_[_0xfed1('0x2b')](_0x49072b[_0xfed1('0x29')]);_0x1b871a[_0xfed1('0x2c')]=_['intersection'](_0x1b871a[_0xfed1('0x28')],_0x1b871a[_0xfed1('0x29')]);_0x2b9dd2['attributes']=_['intersection'](_0x1b871a[_0xfed1('0x28')],qs[_0xfed1('0x2d')](_0x49072b[_0xfed1('0x29')][_0xfed1('0x2d')]));_0x2b9dd2[_0xfed1('0x2e')]=_0x2b9dd2['attributes'][_0xfed1('0x2f')]?_0x2b9dd2[_0xfed1('0x2e')]:_0x1b871a[_0xfed1('0x28')];if(!_0x49072b[_0xfed1('0x29')][_0xfed1('0x30')]('nolimit')){_0x2b9dd2[_0xfed1('0x1c')]=qs['limit'](_0x49072b[_0xfed1('0x29')][_0xfed1('0x1c')]);_0x2b9dd2[_0xfed1('0x1b')]=qs[_0xfed1('0x1b')](_0x49072b[_0xfed1('0x29')][_0xfed1('0x1b')]);}_0x2b9dd2[_0xfed1('0x31')]=qs[_0xfed1('0x32')](_0x49072b['query'][_0xfed1('0x32')]);_0x2b9dd2[_0xfed1('0x33')]=qs[_0xfed1('0x2c')](_[_0xfed1('0x34')](_0x49072b['query'],_0x1b871a['filters']));if(_0x3106ee[_0xfed1('0x35')]){if(_0x3106ee[_0xfed1('0x2a')]){_0x3106ee[_0xfed1('0x2a')]=moment(_0x3106ee[_0xfed1('0x2a')])[_0xfed1('0x36')](0x1,_0xfed1('0x37'));}else{_0x3106ee[_0xfed1('0x2a')]=moment(_0x3106ee[_0xfed1('0x35')])['add'](0x1,'day');}_[_0xfed1('0x38')](_0x2b9dd2[_0xfed1('0x33')],{'createdAt':{'$gte':_0x3106ee['dateStart'],'$lte':_0x3106ee[_0xfed1('0x2a')]}});}if(_0x49072b[_0xfed1('0x29')][_0xfed1('0x39')]){_0x2b9dd2[_0xfed1('0x33')]=_[_0xfed1('0x38')](_0x2b9dd2[_0xfed1('0x33')],{'$or':_[_0xfed1('0x3a')](_0x2b9dd2[_0xfed1('0x2e')],function(_0x3c27de){var _0x5f3e1f={};_0x5f3e1f[_0x3c27de]={'$like':'%'+_0x49072b['query']['filter']+'%'};return _0x5f3e1f;})});}_0x2b9dd2=_[_0xfed1('0x38')]({},_0x2b9dd2,_0x49072b[_0xfed1('0x3b')]);var _0x2f8f08={'where':_0x2b9dd2['where']};return db[_0xfed1('0x27')]['count'](_0x2f8f08)[_0xfed1('0x21')](function(_0x2cfdca){_0x1d62c5[_0xfed1('0x3c')]=_0x2cfdca;if(_0x49072b['query'][_0xfed1('0x3d')]){_0x2b9dd2[_0xfed1('0x3e')]=[{'all':!![]}];}return db[_0xfed1('0x27')]['findAll'](_0x2b9dd2);})[_0xfed1('0x21')](function(_0x545f22){_0x1d62c5[_0xfed1('0x3f')]=_0x545f22;return _0x1d62c5;})[_0xfed1('0x21')](respondWithFilteredResult(_0x1d6c72,_0x2b9dd2))[_0xfed1('0x40')](handleError(_0x1d6c72,null));};exports[_0xfed1('0x41')]=function(_0x1bfbe8,_0x371047){var _0x2d4f82={'raw':!![],'where':{'id':_0x1bfbe8[_0xfed1('0x42')]['id']}},_0x3de5d4={};_0x3de5d4['model']=_[_0xfed1('0x2b')](db[_0xfed1('0x27')][_0xfed1('0x43')]);_0x3de5d4['query']=_['keys'](_0x1bfbe8[_0xfed1('0x29')]);_0x3de5d4[_0xfed1('0x2c')]=_[_0xfed1('0x44')](_0x3de5d4[_0xfed1('0x28')],_0x3de5d4[_0xfed1('0x29')]);_0x2d4f82[_0xfed1('0x2e')]=_[_0xfed1('0x44')](_0x3de5d4[_0xfed1('0x28')],qs[_0xfed1('0x2d')](_0x1bfbe8[_0xfed1('0x29')][_0xfed1('0x2d')]));_0x2d4f82[_0xfed1('0x2e')]=_0x2d4f82['attributes'][_0xfed1('0x2f')]?_0x2d4f82[_0xfed1('0x2e')]:_0x3de5d4[_0xfed1('0x28')];if(_0x1bfbe8[_0xfed1('0x29')][_0xfed1('0x3d')]){_0x2d4f82[_0xfed1('0x3e')]=[{'all':!![]}];}_0x2d4f82=_['merge']({},_0x2d4f82,_0x1bfbe8[_0xfed1('0x3b')]);return db[_0xfed1('0x27')][_0xfed1('0x45')](_0x2d4f82)['then'](handleEntityNotFound(_0x371047,null))[_0xfed1('0x21')](respondWithResult(_0x371047,null))[_0xfed1('0x40')](handleError(_0x371047,null));};exports[_0xfed1('0x46')]=function(_0x32c404,_0x48005b){return db[_0xfed1('0x27')][_0xfed1('0x46')](_0x32c404[_0xfed1('0x47')],{})[_0xfed1('0x21')](respondWithResult(_0x48005b,0xc9))[_0xfed1('0x40')](handleError(_0x48005b,null));};exports[_0xfed1('0x20')]=function(_0x388078,_0x18d761){if(_0x388078[_0xfed1('0x47')]['id']){delete _0x388078[_0xfed1('0x47')]['id'];}return db[_0xfed1('0x27')][_0xfed1('0x45')]({'where':{'id':_0x388078[_0xfed1('0x42')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x18d761,null))[_0xfed1('0x21')](saveUpdates(_0x388078[_0xfed1('0x47')],null))[_0xfed1('0x21')](respondWithResult(_0x18d761,null))[_0xfed1('0x40')](handleError(_0x18d761,null));};exports['destroy']=function(_0x589feb,_0x1e1a8e){return db[_0xfed1('0x27')][_0xfed1('0x45')]({'where':{'id':_0x589feb[_0xfed1('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1a8e,null))[_0xfed1('0x21')](removeEntity(_0x1e1a8e,null))[_0xfed1('0x40')](handleError(_0x1e1a8e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8173c37..0e8c703 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 _0xb260=['moment','bluebird','request-promise','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api'];(function(_0xeb6bb1,_0xc83c4c){var _0x387e00=function(_0x55a427){while(--_0x55a427){_0xeb6bb1['push'](_0xeb6bb1['shift']());}};_0x387e00(++_0xc83c4c);}(_0xb260,0x6b));var _0x0b26=function(_0x1eea73,_0xb319f3){_0x1eea73=_0x1eea73-0x0;var _0x12be02=_0xb260[_0x1eea73];return _0x12be02;};'use strict';var _=require(_0x0b26('0x0'));var util=require('util');var logger=require(_0x0b26('0x1'))(_0x0b26('0x2'));var moment=require(_0x0b26('0x3'));var BPromise=require(_0x0b26('0x4'));var rp=require(_0x0b26('0x5'));var attributes=require('./analyticTreeReport.attributes');module[_0x0b26('0x6')]=function(_0x2f1eeb,_0x3410ee){return _0x2f1eeb[_0x0b26('0x7')](_0x0b26('0x8'),attributes,{'tableName':_0x0b26('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2984=['moment','AnalyticTreeReport','analytics_report_trees','../../config/logger'];(function(_0x2c654f,_0x34d1a6){var _0xb80a4d=function(_0x3c47e3){while(--_0x3c47e3){_0x2c654f['push'](_0x2c654f['shift']());}};_0xb80a4d(++_0x34d1a6);}(_0x2984,0x12f));var _0x4298=function(_0x5d9c37,_0x518b93){_0x5d9c37=_0x5d9c37-0x0;var _0x1ba9eb=_0x2984[_0x5d9c37];return _0x1ba9eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4298('0x0'))('api');var moment=require(_0x4298('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x4e3f66,_0x20cb0f){return _0x4e3f66['define'](_0x4298('0x2'),attributes,{'tableName':_0x4298('0x3'),'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 e9381b5..60bbe64 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 _0x2167=['client','http','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2167,0x19c));var _0x7216=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2167[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7216('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7216('0x1'));var rs=require(_0x7216('0x2'));var fs=require('fs');var Redis=require(_0x7216('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7216('0x4'));var logger=require(_0x7216('0x5'))(_0x7216('0x6'));var config=require(_0x7216('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7216('0x8')][_0x7216('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb8b48d,_0x57462e,_0x48f53c){return new BPromise(function(_0x497b20,_0xf46bf1){return client['request'](_0xb8b48d,_0x48f53c)['then'](function(_0x57fad0){logger[_0x7216('0xa')](_0x7216('0xb'),_0x57462e,_0x7216('0xc'));logger[_0x7216('0xd')](_0x7216('0xe'),_0x57462e,_0x7216('0xc'),JSON[_0x7216('0xf')](_0x57fad0));if(_0x57fad0[_0x7216('0x10')]){if(_0x57fad0[_0x7216('0x10')][_0x7216('0x11')]===0x1f4){logger[_0x7216('0x10')](_0x7216('0xb'),_0x57462e,_0x57fad0['error'][_0x7216('0x12')]);return _0xf46bf1(_0x57fad0[_0x7216('0x10')][_0x7216('0x12')]);}logger[_0x7216('0x10')](_0x7216('0xb'),_0x57462e,_0x57fad0[_0x7216('0x10')][_0x7216('0x12')]);return _0x497b20(_0x57fad0[_0x7216('0x10')]['message']);}else{logger[_0x7216('0xa')](_0x7216('0xb'),_0x57462e,_0x7216('0xc'));_0x497b20(_0x57fad0['result']['message']);}})[_0x7216('0x13')](function(_0x5e6adc){logger[_0x7216('0x10')](_0x7216('0xb'),_0x57462e,_0x5e6adc);_0xf46bf1(_0x5e6adc);});});} \ No newline at end of file +var _0x0dc7=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','request'];(function(_0x588b67,_0x2b44cf){var _0x50c763=function(_0x5337fa){while(--_0x5337fa){_0x588b67['push'](_0x588b67['shift']());}};_0x50c763(++_0x2b44cf);}(_0x0dc7,0xa3));var _0x70dc=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0x0dc7[_0x582d0b];return _0x2e93e1;};'use strict';var _=require('lodash');var util=require(_0x70dc('0x0'));var moment=require('moment');var BPromise=require(_0x70dc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70dc('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x70dc('0x3'));var logger=require('../../config/logger')(_0x70dc('0x4'));var config=require(_0x70dc('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4af61c,_0x36ef65,_0x143666){return new BPromise(function(_0x448055,_0x2ad3f5){return client[_0x70dc('0x6')](_0x4af61c,_0x143666)[_0x70dc('0x7')](function(_0x58d038){logger[_0x70dc('0x8')](_0x70dc('0x9'),_0x36ef65,_0x70dc('0xa'));logger[_0x70dc('0xb')](_0x70dc('0xc'),_0x36ef65,_0x70dc('0xa'),JSON[_0x70dc('0xd')](_0x58d038));if(_0x58d038[_0x70dc('0xe')]){if(_0x58d038[_0x70dc('0xe')][_0x70dc('0xf')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x36ef65,_0x58d038['error'][_0x70dc('0x10')]);return _0x2ad3f5(_0x58d038[_0x70dc('0xe')][_0x70dc('0x10')]);}logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x36ef65,_0x58d038[_0x70dc('0xe')][_0x70dc('0x10')]);return _0x448055(_0x58d038[_0x70dc('0xe')][_0x70dc('0x10')]);}else{logger[_0x70dc('0x8')](_0x70dc('0x9'),_0x36ef65,_0x70dc('0xa'));_0x448055(_0x58d038['result'][_0x70dc('0x10')]);}})['catch'](function(_0x1ea377){logger['error'](_0x70dc('0x9'),_0x36ef65,_0x1ea377);_0x2ad3f5(_0x1ea377);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 202a8da..97b5480 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 _0xf523=['post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show'];(function(_0x2b4542,_0x21650f){var _0x15c826=function(_0x54cdcb){while(--_0x54cdcb){_0x2b4542['push'](_0x2b4542['shift']());}};_0x15c826(++_0x21650f);}(_0xf523,0x85));var _0x3f52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf523[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f52('0x0'));var util=require(_0x3f52('0x1'));var path=require(_0x3f52('0x2'));var timeout=require('connect-timeout');var express=require(_0x3f52('0x3'));var router=express[_0x3f52('0x4')]();var auth=require(_0x3f52('0x5'));var interaction=require(_0x3f52('0x6'));var config=require(_0x3f52('0x7'));var controller=require(_0x3f52('0x8'));router['get']('/',auth[_0x3f52('0x9')](),controller[_0x3f52('0xa')]);router[_0x3f52('0xb')](_0x3f52('0xc'),auth[_0x3f52('0x9')](),controller[_0x3f52('0xd')]);router[_0x3f52('0xe')]('/',auth[_0x3f52('0x9')](),controller[_0x3f52('0xf')]);router[_0x3f52('0x10')](_0x3f52('0xc'),auth[_0x3f52('0x9')](),controller[_0x3f52('0x11')]);router[_0x3f52('0x12')](_0x3f52('0xc'),auth[_0x3f52('0x9')](),controller[_0x3f52('0x13')]);module[_0x3f52('0x14')]=router; \ No newline at end of file +var _0x2b61=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x6ec1fe,_0x3e820c){var _0x16d021=function(_0xbd09b5){while(--_0xbd09b5){_0x6ec1fe['push'](_0x6ec1fe['shift']());}};_0x16d021(++_0x3e820c);}(_0x2b61,0x72));var _0x12b6=function(_0x5bda3b,_0x41160f){_0x5bda3b=_0x5bda3b-0x0;var _0x431bb9=_0x2b61[_0x5bda3b];return _0x431bb9;};'use strict';var multer=require(_0x12b6('0x0'));var util=require(_0x12b6('0x1'));var path=require(_0x12b6('0x2'));var timeout=require(_0x12b6('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x12b6('0x4'));var interaction=require(_0x12b6('0x5'));var config=require(_0x12b6('0x6'));var controller=require(_0x12b6('0x7'));router[_0x12b6('0x8')]('/',auth[_0x12b6('0x9')](),controller[_0x12b6('0xa')]);router['get'](_0x12b6('0xb'),auth[_0x12b6('0x9')](),controller[_0x12b6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x12b6('0xd')]);router[_0x12b6('0xe')](_0x12b6('0xb'),auth[_0x12b6('0x9')](),controller[_0x12b6('0xf')]);module[_0x12b6('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 08c1b50..98e121d 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 _0xab76=['STRING','sequelize','exports'];(function(_0xc828c0,_0x42f130){var _0x14fc92=function(_0x1e7c02){while(--_0x1e7c02){_0xc828c0['push'](_0xc828c0['shift']());}};_0x14fc92(++_0x42f130);}(_0xab76,0x8b));var _0x6ab7=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xab76[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0x6ab7('0x0'));module[_0x6ab7('0x1')]={'name':{'type':Sequelize[_0x6ab7('0x2')]},'basename':{'type':Sequelize[_0x6ab7('0x2')]},'type':{'type':Sequelize[_0x6ab7('0x2')]}}; \ No newline at end of file +var _0x47d0=['sequelize','STRING'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x47d0,0x18c));var _0x047d=function(_0x220e1b,_0x375ffa){_0x220e1b=_0x220e1b-0x0;var _0x1f2de6=_0x47d0[_0x220e1b];return _0x1f2de6;};'use strict';var Sequelize=require(_0x047d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x047d('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index beae01e..8f3dc7c 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 _0xeee9=['filename','type','create','download','findOne','join','root','server/files/attachments/','basename','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','api','../../mysqldb','status','json','count','offset','Content-Range','apply','reject','save','then','end','error','name','send','index','rawAttributes','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','add','day','filter','merge','options','includeAll','Attachment','findAll','rows','catch','show','params','include','find','update','body','destroy','file','originalname'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xeee9,0x1dd));var _0x9eee=function(_0x9e7ae8,_0x16faa2){_0x9e7ae8=_0x9e7ae8-0x0;var _0x6bbf94=_0xeee9[_0x9e7ae8];return _0x6bbf94;};'use strict';var pdf=require(_0x9eee('0x0'));var emlformat=require(_0x9eee('0x1'));var rimraf=require(_0x9eee('0x2'));var zipdir=require(_0x9eee('0x3'));var jsonpatch=require(_0x9eee('0x4'));var rp=require('request-promise');var moment=require(_0x9eee('0x5'));var BPromise=require(_0x9eee('0x6'));var Mustache=require('mustache');var util=require(_0x9eee('0x7'));var path=require(_0x9eee('0x8'));var sox=require(_0x9eee('0x9'));var csv=require('to-csv');var ejs=require(_0x9eee('0xa'));var fs=require('fs');var _=require(_0x9eee('0xb'));var squel=require(_0x9eee('0xc'));var crypto=require(_0x9eee('0xd'));var jsforce=require(_0x9eee('0xe'));var deskjs=require(_0x9eee('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9eee('0x10'));var Papa=require(_0x9eee('0x11'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9eee('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9eee('0x13'))['db'];function respondWithStatusCode(_0x1f7cc8,_0x2515ed){_0x2515ed=_0x2515ed||0xcc;return function(_0x40518e){if(_0x40518e){return _0x1f7cc8['sendStatus'](_0x2515ed);}return _0x1f7cc8['status'](_0x2515ed)['end']();};}function respondWithResult(_0x3faa63,_0x20db3a){_0x20db3a=_0x20db3a||0xc8;return function(_0x4a669e){if(_0x4a669e){return _0x3faa63[_0x9eee('0x14')](_0x20db3a)[_0x9eee('0x15')](_0x4a669e);}};}function respondWithFilteredResult(_0x38acd9,_0x1d0600){return function(_0x4765ae){if(_0x4765ae){var _0x37331a=_0x4765ae[_0x9eee('0x16')],_0x303292=_0x1d0600[_0x9eee('0x17')],_0x15402d=_0x1d0600['offset']+_0x1d0600['limit'],_0x39e7b9;if(_0x15402d>=_0x37331a){_0x15402d=_0x37331a;_0x39e7b9=0xc8;}else{_0x39e7b9=0xce;}_0x38acd9['status'](_0x39e7b9);return _0x38acd9['set'](_0x9eee('0x18'),_0x303292+'-'+_0x15402d+'/'+_0x37331a)[_0x9eee('0x15')](_0x4765ae);}return null;};}function patchUpdates(_0x2a9606){return function(_0x515331){try{jsonpatch[_0x9eee('0x19')](_0x515331,_0x2a9606,!![]);}catch(_0x272153){return BPromise[_0x9eee('0x1a')](_0x272153);}return _0x515331[_0x9eee('0x1b')]();};}function saveUpdates(_0x5733e5,_0x521a57){return function(_0x5985e7){if(_0x5985e7){return _0x5985e7['update'](_0x5733e5)[_0x9eee('0x1c')](function(_0xa69521){return _0xa69521;});}return null;};}function removeEntity(_0x13b192,_0x513707){return function(_0x549917){if(_0x549917){return _0x549917['destroy']()['then'](function(){_0x13b192[_0x9eee('0x14')](0xcc)[_0x9eee('0x1d')]();});}};}function handleEntityNotFound(_0x1fa834,_0x91cbf7){return function(_0x59d797){if(!_0x59d797){_0x1fa834['sendStatus'](0x194);}return _0x59d797;};}function handleError(_0x12641b,_0x3c20f1){_0x3c20f1=_0x3c20f1||0x1f4;return function(_0x4f6e08){logger[_0x9eee('0x1e')](_0x4f6e08['stack']);if(_0x4f6e08[_0x9eee('0x1f')]){delete _0x4f6e08[_0x9eee('0x1f')];}_0x12641b['status'](_0x3c20f1)[_0x9eee('0x20')](_0x4f6e08);};}exports[_0x9eee('0x21')]=function(_0x5984ab,_0x4c671c){var _0x46d6cb={},_0x3881d8={},_0x1e8f56={'count':0x0,'rows':[]};var _0x34fcf6=db['Attachment'][_0x9eee('0x22')];_0x3881d8[_0x9eee('0x23')]=_[_0x9eee('0x24')](_0x34fcf6);var _0x1f3215={'dateStart':_0x5984ab[_0x9eee('0x25')]['dateStart'],'dateEnd':_0x5984ab[_0x9eee('0x25')][_0x9eee('0x26')]};delete _0x5984ab[_0x9eee('0x25')][_0x9eee('0x27')];delete _0x5984ab[_0x9eee('0x25')][_0x9eee('0x26')];_0x3881d8[_0x9eee('0x25')]=_[_0x9eee('0x24')](_0x5984ab[_0x9eee('0x25')]);_0x3881d8['filters']=_[_0x9eee('0x28')](_0x3881d8['model'],_0x3881d8[_0x9eee('0x25')]);_0x46d6cb[_0x9eee('0x29')]=_[_0x9eee('0x28')](_0x3881d8[_0x9eee('0x23')],qs[_0x9eee('0x2a')](_0x5984ab['query'][_0x9eee('0x2a')]));_0x46d6cb['attributes']=_0x46d6cb['attributes'][_0x9eee('0x2b')]?_0x46d6cb[_0x9eee('0x29')]:_0x3881d8[_0x9eee('0x23')];if(!_0x5984ab[_0x9eee('0x25')][_0x9eee('0x2c')]('nolimit')){_0x46d6cb['limit']=qs[_0x9eee('0x2d')](_0x5984ab[_0x9eee('0x25')]['limit']);_0x46d6cb['offset']=qs[_0x9eee('0x17')](_0x5984ab['query'][_0x9eee('0x17')]);}_0x46d6cb[_0x9eee('0x2e')]=qs['sort'](_0x5984ab[_0x9eee('0x25')][_0x9eee('0x2f')]);_0x46d6cb[_0x9eee('0x30')]=qs[_0x9eee('0x31')](_['pick'](_0x5984ab[_0x9eee('0x25')],_0x3881d8[_0x9eee('0x31')]));if(_0x1f3215[_0x9eee('0x27')]){if(_0x1f3215[_0x9eee('0x26')]){_0x1f3215[_0x9eee('0x26')]=moment(_0x1f3215[_0x9eee('0x26')])[_0x9eee('0x32')](0x1,_0x9eee('0x33'));}else{_0x1f3215[_0x9eee('0x26')]=moment(_0x1f3215[_0x9eee('0x27')])['add'](0x1,_0x9eee('0x33'));}_['merge'](_0x46d6cb[_0x9eee('0x30')],{'createdAt':{'$gte':_0x1f3215['dateStart'],'$lte':_0x1f3215['dateEnd']}});}if(_0x5984ab['query'][_0x9eee('0x34')]){_0x46d6cb[_0x9eee('0x30')]=_['merge'](_0x46d6cb[_0x9eee('0x30')],{'$or':_['map'](_0x46d6cb[_0x9eee('0x29')],function(_0x2cd5a7){var _0x30f0a1={};_0x30f0a1[_0x2cd5a7]={'$like':'%'+_0x5984ab[_0x9eee('0x25')]['filter']+'%'};return _0x30f0a1;})});}_0x46d6cb=_[_0x9eee('0x35')]({},_0x46d6cb,_0x5984ab[_0x9eee('0x36')]);var _0x4f9a6e={'where':_0x46d6cb[_0x9eee('0x30')]};return db['Attachment'][_0x9eee('0x16')](_0x4f9a6e)[_0x9eee('0x1c')](function(_0x4f2eac){_0x1e8f56['count']=_0x4f2eac;if(_0x5984ab[_0x9eee('0x25')][_0x9eee('0x37')]){_0x46d6cb['include']=[{'all':!![]}];}return db[_0x9eee('0x38')][_0x9eee('0x39')](_0x46d6cb);})[_0x9eee('0x1c')](function(_0x575dce){_0x1e8f56[_0x9eee('0x3a')]=_0x575dce;return _0x1e8f56;})[_0x9eee('0x1c')](respondWithFilteredResult(_0x4c671c,_0x46d6cb))[_0x9eee('0x3b')](handleError(_0x4c671c,null));};exports[_0x9eee('0x3c')]=function(_0x2d3d29,_0xc85c8e){var _0x259169={'raw':!![],'where':{'id':_0x2d3d29[_0x9eee('0x3d')]['id']}},_0x519efc={};_0x519efc[_0x9eee('0x23')]=_['keys'](db['Attachment'][_0x9eee('0x22')]);_0x519efc[_0x9eee('0x25')]=_[_0x9eee('0x24')](_0x2d3d29[_0x9eee('0x25')]);_0x519efc[_0x9eee('0x31')]=_[_0x9eee('0x28')](_0x519efc[_0x9eee('0x23')],_0x519efc[_0x9eee('0x25')]);_0x259169[_0x9eee('0x29')]=_[_0x9eee('0x28')](_0x519efc[_0x9eee('0x23')],qs[_0x9eee('0x2a')](_0x2d3d29[_0x9eee('0x25')]['fields']));_0x259169['attributes']=_0x259169[_0x9eee('0x29')]['length']?_0x259169[_0x9eee('0x29')]:_0x519efc[_0x9eee('0x23')];if(_0x2d3d29[_0x9eee('0x25')][_0x9eee('0x37')]){_0x259169[_0x9eee('0x3e')]=[{'all':!![]}];}_0x259169=_[_0x9eee('0x35')]({},_0x259169,_0x2d3d29[_0x9eee('0x36')]);return db[_0x9eee('0x38')][_0x9eee('0x3f')](_0x259169)[_0x9eee('0x1c')](handleEntityNotFound(_0xc85c8e,null))['then'](respondWithResult(_0xc85c8e,null))['catch'](handleError(_0xc85c8e,null));};exports[_0x9eee('0x40')]=function(_0x1d7ec2,_0x45824b){if(_0x1d7ec2[_0x9eee('0x41')]['id']){delete _0x1d7ec2[_0x9eee('0x41')]['id'];}return db[_0x9eee('0x38')][_0x9eee('0x3f')]({'where':{'id':_0x1d7ec2[_0x9eee('0x3d')]['id']}})[_0x9eee('0x1c')](handleEntityNotFound(_0x45824b,null))['then'](saveUpdates(_0x1d7ec2['body'],null))[_0x9eee('0x1c')](respondWithResult(_0x45824b,null))[_0x9eee('0x3b')](handleError(_0x45824b,null));};exports[_0x9eee('0x42')]=function(_0x4986cf,_0x22a9b0){return db[_0x9eee('0x38')][_0x9eee('0x3f')]({'where':{'id':_0x4986cf[_0x9eee('0x3d')]['id']}})[_0x9eee('0x1c')](handleEntityNotFound(_0x22a9b0,null))['then'](removeEntity(_0x22a9b0,null))[_0x9eee('0x3b')](handleError(_0x22a9b0,null));};exports['create']=function(_0x2c2dfc,_0x1f9416,_0x7ce140){_0x2c2dfc[_0x9eee('0x41')][_0x9eee('0x1f')]=_0x2c2dfc[_0x9eee('0x43')][_0x9eee('0x44')];_0x2c2dfc[_0x9eee('0x41')]['basename']=_0x2c2dfc[_0x9eee('0x43')][_0x9eee('0x45')];_0x2c2dfc[_0x9eee('0x41')][_0x9eee('0x46')]=_0x2c2dfc[_0x9eee('0x43')]['mimetype'];return db[_0x9eee('0x38')][_0x9eee('0x47')](_0x2c2dfc[_0x9eee('0x41')])['then'](respondWithResult(_0x1f9416,0xc9))[_0x9eee('0x3b')](handleError(_0x1f9416,null));};exports[_0x9eee('0x48')]=function(_0x5740d7,_0x1356b5,_0x2eab0d){return db[_0x9eee('0x38')][_0x9eee('0x49')]({'where':{'id':_0x5740d7['params']['id']},'raw':!![]})[_0x9eee('0x1c')](handleEntityNotFound(_0x1356b5,null))[_0x9eee('0x1c')](function(_0x1f99a4){if(_0x1f99a4){return _0x1356b5[_0x9eee('0x48')](path[_0x9eee('0x4a')](config[_0x9eee('0x4b')],_0x9eee('0x4c'),_0x1f99a4[_0x9eee('0x4d')]));}})[_0x9eee('0x3b')](handleError(_0x1356b5,null));}; \ No newline at end of file +var _0xbb0e=['filename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','Attachment','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','day','merge','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','body','create','file','originalname','basename'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbb0e,0xfa));var _0xebb0=function(_0x3dcbf0,_0x2a6a5e){_0x3dcbf0=_0x3dcbf0-0x0;var _0x3d683f=_0xbb0e[_0x3dcbf0];return _0x3d683f;};'use strict';var pdf=require(_0xebb0('0x0'));var emlformat=require(_0xebb0('0x1'));var rimraf=require(_0xebb0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebb0('0x3'));var rp=require(_0xebb0('0x4'));var moment=require(_0xebb0('0x5'));var BPromise=require(_0xebb0('0x6'));var Mustache=require(_0xebb0('0x7'));var util=require(_0xebb0('0x8'));var path=require(_0xebb0('0x9'));var sox=require(_0xebb0('0xa'));var csv=require(_0xebb0('0xb'));var ejs=require(_0xebb0('0xc'));var fs=require('fs');var _=require(_0xebb0('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xebb0('0xe'));var deskjs=require(_0xebb0('0xf'));var toCsv=require(_0xebb0('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xebb0('0x10'));var qs=require(_0xebb0('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xebb0('0x12'));var config=require(_0xebb0('0x13'));var db=require(_0xebb0('0x14'))['db'];function respondWithStatusCode(_0x3a061f,_0x3324a8){_0x3324a8=_0x3324a8||0xcc;return function(_0x2cd233){if(_0x2cd233){return _0x3a061f['sendStatus'](_0x3324a8);}return _0x3a061f['status'](_0x3324a8)[_0xebb0('0x15')]();};}function respondWithResult(_0x3fd8d6,_0x3b7e00){_0x3b7e00=_0x3b7e00||0xc8;return function(_0x4973e4){if(_0x4973e4){return _0x3fd8d6[_0xebb0('0x16')](_0x3b7e00)[_0xebb0('0x17')](_0x4973e4);}};}function respondWithFilteredResult(_0x4eeeb4,_0x4ab689){return function(_0xd65aa4){if(_0xd65aa4){var _0x190f25=_0xd65aa4[_0xebb0('0x18')],_0x248e06=_0x4ab689[_0xebb0('0x19')],_0x396d94=_0x4ab689['offset']+_0x4ab689[_0xebb0('0x1a')],_0x185d2c;if(_0x396d94>=_0x190f25){_0x396d94=_0x190f25;_0x185d2c=0xc8;}else{_0x185d2c=0xce;}_0x4eeeb4[_0xebb0('0x16')](_0x185d2c);return _0x4eeeb4[_0xebb0('0x1b')](_0xebb0('0x1c'),_0x248e06+'-'+_0x396d94+'/'+_0x190f25)[_0xebb0('0x17')](_0xd65aa4);}return null;};}function patchUpdates(_0x4f5670){return function(_0x398ce8){try{jsonpatch['apply'](_0x398ce8,_0x4f5670,!![]);}catch(_0x7f32a7){return BPromise[_0xebb0('0x1d')](_0x7f32a7);}return _0x398ce8[_0xebb0('0x1e')]();};}function saveUpdates(_0x29d712,_0x2fd0df){return function(_0x40fdfa){if(_0x40fdfa){return _0x40fdfa[_0xebb0('0x1f')](_0x29d712)['then'](function(_0x3c9f73){return _0x3c9f73;});}return null;};}function removeEntity(_0x24c607,_0x686c83){return function(_0x323727){if(_0x323727){return _0x323727[_0xebb0('0x20')]()[_0xebb0('0x21')](function(){_0x24c607['status'](0xcc)[_0xebb0('0x15')]();});}};}function handleEntityNotFound(_0x16c0f7,_0xdd539c){return function(_0x5439bf){if(!_0x5439bf){_0x16c0f7[_0xebb0('0x22')](0x194);}return _0x5439bf;};}function handleError(_0x5801cf,_0x44030b){_0x44030b=_0x44030b||0x1f4;return function(_0x57bd7a){logger[_0xebb0('0x23')](_0x57bd7a[_0xebb0('0x24')]);if(_0x57bd7a['name']){delete _0x57bd7a[_0xebb0('0x25')];}_0x5801cf['status'](_0x44030b)[_0xebb0('0x26')](_0x57bd7a);};}exports['index']=function(_0x50454c,_0x322b5b){var _0x2b7915={},_0x32a2a9={},_0x1391d4={'count':0x0,'rows':[]};var _0x17120e=db[_0xebb0('0x27')][_0xebb0('0x28')];_0x32a2a9[_0xebb0('0x29')]=_[_0xebb0('0x2a')](_0x17120e);var _0x318292={'dateStart':_0x50454c['query'][_0xebb0('0x2b')],'dateEnd':_0x50454c[_0xebb0('0x2c')]['dateEnd']};delete _0x50454c[_0xebb0('0x2c')][_0xebb0('0x2b')];delete _0x50454c['query'][_0xebb0('0x2d')];_0x32a2a9[_0xebb0('0x2c')]=_['keys'](_0x50454c[_0xebb0('0x2c')]);_0x32a2a9[_0xebb0('0x2e')]=_[_0xebb0('0x2f')](_0x32a2a9['model'],_0x32a2a9[_0xebb0('0x2c')]);_0x2b7915[_0xebb0('0x30')]=_[_0xebb0('0x2f')](_0x32a2a9[_0xebb0('0x29')],qs[_0xebb0('0x31')](_0x50454c['query'][_0xebb0('0x31')]));_0x2b7915[_0xebb0('0x30')]=_0x2b7915[_0xebb0('0x30')]['length']?_0x2b7915[_0xebb0('0x30')]:_0x32a2a9[_0xebb0('0x29')];if(!_0x50454c['query'][_0xebb0('0x32')](_0xebb0('0x33'))){_0x2b7915[_0xebb0('0x1a')]=qs[_0xebb0('0x1a')](_0x50454c['query'][_0xebb0('0x1a')]);_0x2b7915[_0xebb0('0x19')]=qs[_0xebb0('0x19')](_0x50454c[_0xebb0('0x2c')][_0xebb0('0x19')]);}_0x2b7915[_0xebb0('0x34')]=qs['sort'](_0x50454c[_0xebb0('0x2c')][_0xebb0('0x35')]);_0x2b7915[_0xebb0('0x36')]=qs[_0xebb0('0x2e')](_[_0xebb0('0x37')](_0x50454c[_0xebb0('0x2c')],_0x32a2a9['filters']));if(_0x318292[_0xebb0('0x2b')]){if(_0x318292[_0xebb0('0x2d')]){_0x318292['dateEnd']=moment(_0x318292['dateEnd'])['add'](0x1,_0xebb0('0x38'));}else{_0x318292[_0xebb0('0x2d')]=moment(_0x318292[_0xebb0('0x2b')])['add'](0x1,_0xebb0('0x38'));}_[_0xebb0('0x39')](_0x2b7915[_0xebb0('0x36')],{'createdAt':{'$gte':_0x318292[_0xebb0('0x2b')],'$lte':_0x318292[_0xebb0('0x2d')]}});}if(_0x50454c[_0xebb0('0x2c')][_0xebb0('0x3a')]){_0x2b7915['where']=_[_0xebb0('0x39')](_0x2b7915[_0xebb0('0x36')],{'$or':_['map'](_0x2b7915[_0xebb0('0x30')],function(_0x2bbb78){var _0x3437de={};_0x3437de[_0x2bbb78]={'$like':'%'+_0x50454c[_0xebb0('0x2c')][_0xebb0('0x3a')]+'%'};return _0x3437de;})});}_0x2b7915=_[_0xebb0('0x39')]({},_0x2b7915,_0x50454c[_0xebb0('0x3b')]);var _0x5debd2={'where':_0x2b7915['where']};return db['Attachment'][_0xebb0('0x18')](_0x5debd2)[_0xebb0('0x21')](function(_0x45e03f){_0x1391d4[_0xebb0('0x18')]=_0x45e03f;if(_0x50454c[_0xebb0('0x2c')]['includeAll']){_0x2b7915[_0xebb0('0x3c')]=[{'all':!![]}];}return db[_0xebb0('0x27')][_0xebb0('0x3d')](_0x2b7915);})[_0xebb0('0x21')](function(_0x4a022e){_0x1391d4[_0xebb0('0x3e')]=_0x4a022e;return _0x1391d4;})[_0xebb0('0x21')](respondWithFilteredResult(_0x322b5b,_0x2b7915))[_0xebb0('0x3f')](handleError(_0x322b5b,null));};exports[_0xebb0('0x40')]=function(_0x20891d,_0x13dc93){var _0x530670={'raw':!![],'where':{'id':_0x20891d[_0xebb0('0x41')]['id']}},_0x146b27={};_0x146b27['model']=_[_0xebb0('0x2a')](db[_0xebb0('0x27')][_0xebb0('0x28')]);_0x146b27['query']=_[_0xebb0('0x2a')](_0x20891d[_0xebb0('0x2c')]);_0x146b27[_0xebb0('0x2e')]=_[_0xebb0('0x2f')](_0x146b27['model'],_0x146b27['query']);_0x530670['attributes']=_['intersection'](_0x146b27[_0xebb0('0x29')],qs[_0xebb0('0x31')](_0x20891d[_0xebb0('0x2c')][_0xebb0('0x31')]));_0x530670[_0xebb0('0x30')]=_0x530670['attributes'][_0xebb0('0x42')]?_0x530670[_0xebb0('0x30')]:_0x146b27['model'];if(_0x20891d['query'][_0xebb0('0x43')]){_0x530670[_0xebb0('0x3c')]=[{'all':!![]}];}_0x530670=_[_0xebb0('0x39')]({},_0x530670,_0x20891d['options']);return db[_0xebb0('0x27')][_0xebb0('0x44')](_0x530670)[_0xebb0('0x21')](handleEntityNotFound(_0x13dc93,null))[_0xebb0('0x21')](respondWithResult(_0x13dc93,null))[_0xebb0('0x3f')](handleError(_0x13dc93,null));};exports['update']=function(_0x28f8c5,_0x39201e){if(_0x28f8c5[_0xebb0('0x45')]['id']){delete _0x28f8c5[_0xebb0('0x45')]['id'];}return db['Attachment'][_0xebb0('0x44')]({'where':{'id':_0x28f8c5[_0xebb0('0x41')]['id']}})[_0xebb0('0x21')](handleEntityNotFound(_0x39201e,null))[_0xebb0('0x21')](saveUpdates(_0x28f8c5[_0xebb0('0x45')],null))[_0xebb0('0x21')](respondWithResult(_0x39201e,null))[_0xebb0('0x3f')](handleError(_0x39201e,null));};exports[_0xebb0('0x20')]=function(_0x3957ff,_0x2ac287){return db[_0xebb0('0x27')][_0xebb0('0x44')]({'where':{'id':_0x3957ff[_0xebb0('0x41')]['id']}})[_0xebb0('0x21')](handleEntityNotFound(_0x2ac287,null))[_0xebb0('0x21')](removeEntity(_0x2ac287,null))[_0xebb0('0x3f')](handleError(_0x2ac287,null));};exports[_0xebb0('0x46')]=function(_0x23e692,_0x40b20e,_0x112bab){_0x23e692[_0xebb0('0x45')][_0xebb0('0x25')]=_0x23e692[_0xebb0('0x47')][_0xebb0('0x48')];_0x23e692['body'][_0xebb0('0x49')]=_0x23e692[_0xebb0('0x47')][_0xebb0('0x4a')];_0x23e692['body']['type']=_0x23e692['file'][_0xebb0('0x4b')];return db[_0xebb0('0x27')][_0xebb0('0x46')](_0x23e692[_0xebb0('0x45')])[_0xebb0('0x21')](respondWithResult(_0x40b20e,0xc9))[_0xebb0('0x3f')](handleError(_0x40b20e,null));};exports[_0xebb0('0x4c')]=function(_0x549f99,_0x2067a2,_0x8797c7){return db[_0xebb0('0x27')][_0xebb0('0x4d')]({'where':{'id':_0x549f99['params']['id']},'raw':!![]})[_0xebb0('0x21')](handleEntityNotFound(_0x2067a2,null))[_0xebb0('0x21')](function(_0x161b1e){if(_0x161b1e){return _0x2067a2[_0xebb0('0x4c')](path[_0xebb0('0x4e')](config[_0xebb0('0x4f')],_0xebb0('0x50'),_0x161b1e['basename']));}})[_0xebb0('0x3f')](handleError(_0x2067a2,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index ec14d36..fc86344 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 _0x814b=['../../config/logger','api','moment','bluebird','./attachment.attributes','exports','define','Attachment','lodash','util'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x814b,0x1a2));var _0xb814=function(_0x3be2e2,_0x5c166d){_0x3be2e2=_0x3be2e2-0x0;var _0x53b9c5=_0x814b[_0x3be2e2];return _0x53b9c5;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var attributes=require(_0xb814('0x6'));module[_0xb814('0x7')]=function(_0x258866,_0x4237bc){return _0x258866[_0xb814('0x8')](_0xb814('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['./attachment.attributes','exports','Attachment','lodash','util','../../config/logger','api','moment'];(function(_0x515813,_0x5f569a){var _0x524d0b=function(_0x30815a){while(--_0x30815a){_0x515813['push'](_0x515813['shift']());}};_0x524d0b(++_0x5f569a);}(_0xabce,0x103));var _0xeabc=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xabce[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xeabc('0x5'));module[_0xeabc('0x6')]=function(_0x1a88a7,_0x5e9e2d){return _0x1a88a7['define'](_0xeabc('0x7'),attributes,{'tableName':'attachments','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 baa21d6..e171fef 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 _0x8caf=['../../config/environment','jayson/promise','client','http','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateAttachment','Attachment','create','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1b2944,_0x4b9b67){var _0xb01686=function(_0x1431de){while(--_0x1431de){_0x1b2944['push'](_0x1b2944['shift']());}};_0xb01686(++_0x4b9b67);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x47a12a,_0x70f591){_0x47a12a=_0x47a12a-0x0;var _0x30cd40=_0x8caf[_0x47a12a];return _0x30cd40;};'use strict';var _=require('lodash');var util=require(_0xf8ca('0x0'));var moment=require(_0xf8ca('0x1'));var BPromise=require(_0xf8ca('0x2'));var rs=require(_0xf8ca('0x3'));var fs=require('fs');var Redis=require(_0xf8ca('0x4'));var db=require(_0xf8ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8ca('0x6'))(_0xf8ca('0x7'));var config=require(_0xf8ca('0x8'));var jayson=require(_0xf8ca('0x9'));var client=jayson[_0xf8ca('0xa')][_0xf8ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x562eea,_0x773b9f,_0x3abd58){return new BPromise(function(_0x3a91d3,_0x31300c){return client['request'](_0x562eea,_0x3abd58)['then'](function(_0x3a9674){logger['info'](_0xf8ca('0xc'),_0x773b9f,_0xf8ca('0xd'));logger[_0xf8ca('0xe')](_0xf8ca('0xf'),_0x773b9f,'request\x20sent',JSON[_0xf8ca('0x10')](_0x3a9674));if(_0x3a9674[_0xf8ca('0x11')]){if(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x12')]===0x1f4){logger['error'](_0xf8ca('0xc'),_0x773b9f,_0x3a9674[_0xf8ca('0x11')]['message']);return _0x31300c(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);}logger[_0xf8ca('0x11')](_0xf8ca('0xc'),_0x773b9f,_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);return _0x3a91d3(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);}else{logger[_0xf8ca('0x14')](_0xf8ca('0xc'),_0x773b9f,'request\x20sent');_0x3a91d3(_0x3a9674[_0xf8ca('0x15')][_0xf8ca('0x13')]);}})[_0xf8ca('0x16')](function(_0x12e8f0){logger[_0xf8ca('0x11')](_0xf8ca('0xc'),_0x773b9f,_0x12e8f0);_0x31300c(_0x12e8f0);});});}exports[_0xf8ca('0x17')]=function(_0x127119){var _0x50e805=this;return new Promise(function(_0x237f44,_0x3b5400){return db[_0xf8ca('0x18')][_0xf8ca('0x19')](_0x127119['body'],{'raw':_0x127119[_0xf8ca('0x1a')]?_0x127119[_0xf8ca('0x1a')][_0xf8ca('0x1b')]===undefined?!![]:![]:!![]})[_0xf8ca('0x1c')](function(_0x18e8da){logger[_0xf8ca('0x14')]('CreateAttachment',_0x127119);logger[_0xf8ca('0xe')]('CreateAttachment',_0x127119,JSON[_0xf8ca('0x10')](_0x18e8da));_0x237f44(_0x18e8da);})[_0xf8ca('0x16')](function(_0x179a48){logger[_0xf8ca('0x11')](_0xf8ca('0x17'),_0x179a48[_0xf8ca('0x13')],_0x127119);_0x3b5400(_0x50e805['error'](0x1f4,_0x179a48['message']));});});}; \ No newline at end of file +var _0xb678=['raw','then','lodash','util','randomstring','../../config/utils','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb678,0x6a));var _0x8b67=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xb678[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x8b67('0x0'));var util=require(_0x8b67('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b67('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8b67('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8b67('0x4'));var client=jayson[_0x8b67('0x5')][_0x8b67('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x22dbcc,_0xd470fb,_0x2b0540){return new BPromise(function(_0xdec636,_0x345847){return client[_0x8b67('0x7')](_0x22dbcc,_0x2b0540)['then'](function(_0x3c931f){logger[_0x8b67('0x8')](_0x8b67('0x9'),_0xd470fb,'request\x20sent');logger[_0x8b67('0xa')](_0x8b67('0xb'),_0xd470fb,_0x8b67('0xc'),JSON[_0x8b67('0xd')](_0x3c931f));if(_0x3c931f[_0x8b67('0xe')]){if(_0x3c931f[_0x8b67('0xe')][_0x8b67('0xf')]===0x1f4){logger[_0x8b67('0xe')](_0x8b67('0x9'),_0xd470fb,_0x3c931f['error'][_0x8b67('0x10')]);return _0x345847(_0x3c931f['error'][_0x8b67('0x10')]);}logger['error']('Attachment,\x20%s,\x20%s',_0xd470fb,_0x3c931f[_0x8b67('0xe')][_0x8b67('0x10')]);return _0xdec636(_0x3c931f[_0x8b67('0xe')][_0x8b67('0x10')]);}else{logger[_0x8b67('0x8')](_0x8b67('0x9'),_0xd470fb,_0x8b67('0xc'));_0xdec636(_0x3c931f[_0x8b67('0x11')][_0x8b67('0x10')]);}})[_0x8b67('0x12')](function(_0x5876d){logger[_0x8b67('0xe')](_0x8b67('0x9'),_0xd470fb,_0x5876d);_0x345847(_0x5876d);});});}exports[_0x8b67('0x13')]=function(_0x4dae38){var _0x3b3958=this;return new Promise(function(_0x1c214e,_0x3f945f){return db[_0x8b67('0x14')][_0x8b67('0x15')](_0x4dae38[_0x8b67('0x16')],{'raw':_0x4dae38['options']?_0x4dae38[_0x8b67('0x17')][_0x8b67('0x18')]===undefined?!![]:![]:!![]})[_0x8b67('0x19')](function(_0x5026a1){logger[_0x8b67('0x8')](_0x8b67('0x13'),_0x4dae38);logger[_0x8b67('0xa')](_0x8b67('0x13'),_0x4dae38,JSON[_0x8b67('0xd')](_0x5026a1));_0x1c214e(_0x5026a1);})[_0x8b67('0x12')](function(_0x44a4b3){logger[_0x8b67('0xe')](_0x8b67('0x13'),_0x44a4b3[_0x8b67('0x10')],_0x4dae38);_0x3f945f(_0x3b3958['error'](0x1f4,_0x44a4b3[_0x8b67('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 23b7184..6f1fc18 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 _0x2285=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','post','single','file','create','put','update','exports','util','path'];(function(_0x2bb66c,_0x36c6c6){var _0x1e0f98=function(_0x1e3412){while(--_0x1e3412){_0x2bb66c['push'](_0x2bb66c['shift']());}};_0x1e0f98(++_0x36c6c6);}(_0x2285,0x177));var _0x5228=function(_0x21bed5,_0x51c998){_0x21bed5=_0x21bed5-0x0;var _0x533a91=_0x2285[_0x21bed5];return _0x533a91;};'use strict';var multer=require('multer');var util=require(_0x5228('0x0'));var path=require(_0x5228('0x1'));var timeout=require(_0x5228('0x2'));var express=require(_0x5228('0x3'));var router=express[_0x5228('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5228('0x5'));var config=require(_0x5228('0x6'));var controller=require('./attachment.controller');router[_0x5228('0x7')]('/',auth[_0x5228('0x8')](),controller[_0x5228('0x9')]);router['get'](_0x5228('0xa'),auth[_0x5228('0x8')](),controller[_0x5228('0xb')]);router[_0x5228('0x7')](_0x5228('0xc'),auth[_0x5228('0x8')](),controller[_0x5228('0xd')]);var upload=multer({'storage':multer[_0x5228('0xe')]({'destination':function(_0x2b0169,_0x16c1f2,_0x4865e0){_0x4865e0(null,path[_0x5228('0xf')](config[_0x5228('0x10')],_0x5228('0x11')));},'filename':function(_0x128f28,_0x594038,_0x6cf415){_0x6cf415(null,util[_0x5228('0x12')](_0x5228('0x13'),Date[_0x5228('0x14')](),_0x594038['originalname'][_0x5228('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5228('0x16')]('/',upload[_0x5228('0x17')](_0x5228('0x18')),controller[_0x5228('0x19')]);router[_0x5228('0x1a')]('/:id',auth[_0x5228('0x8')](),controller[_0x5228('0x1b')]);router['delete'](_0x5228('0xa'),auth[_0x5228('0x8')](),controller['destroy']);module[_0x5228('0x1c')]=router; \ No newline at end of file +var _0x5397=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','isAuthenticated','index','get','/:id','download','diskStorage','join','root','server/files/attachments/','format','%s-%s','originalname','replace','single','file','put','update','delete','destroy','exports'];(function(_0x240b0a,_0x50335f){var _0x35346a=function(_0x56d904){while(--_0x56d904){_0x240b0a['push'](_0x240b0a['shift']());}};_0x35346a(++_0x50335f);}(_0x5397,0x105));var _0x7539=function(_0x591a2b,_0x2f721c){_0x591a2b=_0x591a2b-0x0;var _0x47ffac=_0x5397[_0x591a2b];return _0x47ffac;};'use strict';var multer=require('multer');var util=require(_0x7539('0x0'));var path=require(_0x7539('0x1'));var timeout=require(_0x7539('0x2'));var express=require(_0x7539('0x3'));var router=express[_0x7539('0x4')]();var auth=require(_0x7539('0x5'));var interaction=require(_0x7539('0x6'));var config=require(_0x7539('0x7'));var controller=require(_0x7539('0x8'));router['get']('/',auth[_0x7539('0x9')](),controller[_0x7539('0xa')]);router[_0x7539('0xb')](_0x7539('0xc'),auth[_0x7539('0x9')](),controller['show']);router[_0x7539('0xb')]('/:id/download',auth[_0x7539('0x9')](),controller[_0x7539('0xd')]);var upload=multer({'storage':multer[_0x7539('0xe')]({'destination':function(_0x448095,_0x48c243,_0x55b586){_0x55b586(null,path[_0x7539('0xf')](config[_0x7539('0x10')],_0x7539('0x11')));},'filename':function(_0x9f4ff9,_0x3b34be,_0x4b21a9){_0x4b21a9(null,util[_0x7539('0x12')](_0x7539('0x13'),Date['now'](),_0x3b34be[_0x7539('0x14')][_0x7539('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x7539('0x16')](_0x7539('0x17')),controller['create']);router[_0x7539('0x18')](_0x7539('0xc'),auth[_0x7539('0x9')](),controller[_0x7539('0x19')]);router[_0x7539('0x1a')]('/:id',auth[_0x7539('0x9')](),controller[_0x7539('0x1b')]);module[_0x7539('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 67ae3df..bdeb51c 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 _0x9aa8=['user','agent','then','User\x20email\x20not\x20found!','catch','lodash','passport','passport-google-oauth20','../../mysqldb','login','authenticate','/login','callback','google','use','clientID','clientSecret','secret','User','find','map','emails','value','admin'];(function(_0x2e4e27,_0x3b7f28){var _0x3cf708=function(_0x26921b){while(--_0x26921b){_0x2e4e27['push'](_0x2e4e27['shift']());}};_0x3cf708(++_0x3b7f28);}(_0x9aa8,0x155));var _0x89aa=function(_0x5f3314,_0x190027){_0x5f3314=_0x5f3314-0x0;var _0x439cb3=_0x9aa8[_0x5f3314];return _0x439cb3;};'use strict';var _=require(_0x89aa('0x0'));var passport=require(_0x89aa('0x1'));var GoogleStrategy=require(_0x89aa('0x2'))['Strategy'];var db=require(_0x89aa('0x3'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')['signToken'];exports[_0x89aa('0x4')]=passport[_0x89aa('0x5')]('google',{'failureRedirect':_0x89aa('0x6'),'scope':['profile','email'],'session':![]});exports[_0x89aa('0x7')]=passport[_0x89aa('0x5')](_0x89aa('0x8'),{'failureRedirect':_0x89aa('0x6'),'session':![]});passport[_0x89aa('0x9')](new GoogleStrategy({'clientID':config[_0x89aa('0x8')]?config[_0x89aa('0x8')][_0x89aa('0xa')]:'id','clientSecret':config[_0x89aa('0x8')]?config[_0x89aa('0x8')][_0x89aa('0xb')]:_0x89aa('0xc'),'callbackURL':config[_0x89aa('0x8')]?config[_0x89aa('0x8')]['callbackURL']:''},function(_0x4b29a2,_0x42040,_0x1286d8,_0x29508e){db[_0x89aa('0xd')][_0x89aa('0xe')]({'where':{'email':_[_0x89aa('0xf')](_0x1286d8[_0x89aa('0x10')],_0x89aa('0x11')),'role':{'$or':[_0x89aa('0x12'),_0x89aa('0x13'),_0x89aa('0x14')]}}})[_0x89aa('0x15')](function(_0x591c14){if(_0x591c14){return _0x29508e(null,_0x591c14);}_0x29508e(_0x89aa('0x16'));})[_0x89aa('0x17')](function(_0xc0969a){_0x29508e(_0xc0969a);});})); \ No newline at end of file +var _0xb44f=['signToken','login','authenticate','google','profile','callback','/login','use','clientID','clientSecret','secret','callbackURL','User','find','map','emails','user','then','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service'];(function(_0x1d602d,_0x45c011){var _0x20f3f6=function(_0x3252d1){while(--_0x3252d1){_0x1d602d['push'](_0x1d602d['shift']());}};_0x20f3f6(++_0x45c011);}(_0xb44f,0x165));var _0xfb44=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb44f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xfb44('0x0'));var passport=require(_0xfb44('0x1'));var GoogleStrategy=require(_0xfb44('0x2'))[_0xfb44('0x3')];var db=require(_0xfb44('0x4'))['db'];var config=require(_0xfb44('0x5'));var signToken=require(_0xfb44('0x6'))[_0xfb44('0x7')];exports[_0xfb44('0x8')]=passport[_0xfb44('0x9')](_0xfb44('0xa'),{'failureRedirect':'/login','scope':[_0xfb44('0xb'),'email'],'session':![]});exports[_0xfb44('0xc')]=passport[_0xfb44('0x9')](_0xfb44('0xa'),{'failureRedirect':_0xfb44('0xd'),'session':![]});passport[_0xfb44('0xe')](new GoogleStrategy({'clientID':config[_0xfb44('0xa')]?config[_0xfb44('0xa')][_0xfb44('0xf')]:'id','clientSecret':config[_0xfb44('0xa')]?config[_0xfb44('0xa')][_0xfb44('0x10')]:_0xfb44('0x11'),'callbackURL':config['google']?config[_0xfb44('0xa')][_0xfb44('0x12')]:''},function(_0x1d8f06,_0x1617bd,_0x3bb67a,_0x303be4){db[_0xfb44('0x13')][_0xfb44('0x14')]({'where':{'email':_[_0xfb44('0x15')](_0x3bb67a[_0xfb44('0x16')],'value'),'role':{'$or':['admin',_0xfb44('0x17'),'agent']}}})[_0xfb44('0x18')](function(_0x1ee8b6){if(_0x1ee8b6){return _0x303be4(null,_0x1ee8b6);}_0x303be4('User\x20email\x20not\x20found!');})[_0xfb44('0x19')](function(_0x4ea838){_0x303be4(_0x4ea838);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 8288d08..af45b56 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 _0x7828=['Router','./authGoogle.controller','setTokenCookie','get','login','/callback','exports','express','passport'];(function(_0x45bbc8,_0xeaec9c){var _0x3c2f43=function(_0x1137f1){while(--_0x1137f1){_0x45bbc8['push'](_0x45bbc8['shift']());}};_0x3c2f43(++_0xeaec9c);}(_0x7828,0x73));var _0x8782=function(_0x30b5a7,_0x28f9ea){_0x30b5a7=_0x30b5a7-0x0;var _0x3bc37b=_0x7828[_0x30b5a7];return _0x3bc37b;};'use strict';var express=require(_0x8782('0x0'));var passport=require(_0x8782('0x1'));var router=express[_0x8782('0x2')]();var controller=require(_0x8782('0x3'));var setTokenCookie=require('../../components/auth/service')[_0x8782('0x4')];router[_0x8782('0x5')]('/',controller[_0x8782('0x6')]);router[_0x8782('0x5')](_0x8782('0x7'),controller['callback'],setTokenCookie);module[_0x8782('0x8')]=router; \ No newline at end of file +var _0x3794=['login','/callback','express','Router','./authGoogle.controller','setTokenCookie','get'];(function(_0x24d454,_0x399220){var _0x294f43=function(_0x1940e4){while(--_0x1940e4){_0x24d454['push'](_0x24d454['shift']());}};_0x294f43(++_0x399220);}(_0x3794,0x160));var _0x4379=function(_0x7a319d,_0x235959){_0x7a319d=_0x7a319d-0x0;var _0x5c6b4e=_0x3794[_0x7a319d];return _0x5c6b4e;};'use strict';var express=require(_0x4379('0x0'));var passport=require('passport');var router=express[_0x4379('0x1')]();var controller=require(_0x4379('0x2'));var setTokenCookie=require('../../components/auth/service')[_0x4379('0x3')];router[_0x4379('0x4')]('/',controller[_0x4379('0x5')]);router[_0x4379('0x4')](_0x4379('0x6'),controller['callback'],setTokenCookie);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0f35a5a..d05960e 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 _0x8439=['MailAccount','find','MailServerOut','Smtp','service','host','port','secure','pass','format','\x22%s\x22\x20<%s>','email','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','send','login','local','role','json','online','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','Password\x20reset!','passport','passport-local','Strategy','jayson/promise','lodash','../../config/logger','api','randomstring','../../components/auth/service','signToken','client','http','agent','count','then','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','user','name','This\x20name\x20is\x20not\x20registered','authenticate'];(function(_0x21b936,_0x4e0544){var _0x3d213d=function(_0x91a0d){while(--_0x91a0d){_0x21b936['push'](_0x21b936['shift']());}};_0x3d213d(++_0x4e0544);}(_0x8439,0xf8));var _0x9843=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x8439[_0x5a3cf0];return _0x5a64ee;};'use strict';var util=require('util');var passport=require(_0x9843('0x0'));var LocalStrategy=require(_0x9843('0x1'))[_0x9843('0x2')];var BPromise=require('bluebird');var jayson=require(_0x9843('0x3'));var _=require(_0x9843('0x4'));var logger=require(_0x9843('0x5'))(_0x9843('0x6'));var rs=require(_0x9843('0x7'));var db=require('../../mysqldb')['db'];var signToken=require(_0x9843('0x8'))[_0x9843('0x9')];var client=jayson[_0x9843('0xa')][_0x9843('0xb')]({'port':0x232b});var getLicense=function(_0x3320e6){return new BPromise(function(_0x12b9d5,_0x291cf0){var _0x256000=0x0;_0x3320e6['role']!==_0x9843('0xc')&&_0x12b9d5(_0x3320e6);return db['User'][_0x9843('0xd')]({'where':{'role':_0x9843('0xc'),'online':!![],'id':{'$ne':_0x3320e6['id']}}})[_0x9843('0xe')](function(_0x41f802){_0x256000=_0x41f802;return require(_0x9843('0xf'))[_0x9843('0x10')]();})[_0x9843('0xe')](function(_0x4e386b){if(_0x4e386b&&_0x4e386b['agents']&&_0x256000>=_0x4e386b[_0x9843('0x11')]){return _0x291cf0({'message':_0x9843('0x12')});}return _0x12b9d5(_0x3320e6);})[_0x9843('0x13')](function(_0x2ffca9){return _0x291cf0(_0x2ffca9);});});};function localAuthenticate(_0xf7f3bb,_0x4b09a4,_0x13c1bd,_0x4c234b){_0xf7f3bb['find']({'where':{'name':_0x4b09a4,'role':{'$or':['admin',_0x9843('0x14'),_0x9843('0xc')]}}})[_0x9843('0xe')](function(_0x1c9bc0){if(!_0x1c9bc0||_0x1c9bc0&&_0x1c9bc0[_0x9843('0x15')]!==_0x4b09a4){return _0x4c234b(null,![],{'message':_0x9843('0x16')});}return getLicense(_0x1c9bc0);})[_0x9843('0xe')](function(_0x5afa3b){_0x5afa3b[_0x9843('0x17')](_0x13c1bd,function(_0x1b5843,_0x361480){if(_0x1b5843){return _0x4c234b(_0x1b5843);}if(!_0x361480){return _0x4c234b(null,![],{'message':'This\x20password\x20is\x20not\x20correct'});}else{return _0x4c234b(null,_0x5afa3b);}});})[_0x9843('0x13')](function(_0x1b89e3){_0x4c234b(_0x1b89e3);});}function sendServiceMail(_0x113fb1){return db[_0x9843('0x18')][_0x9843('0x19')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x9843('0x1a')],'as':_0x9843('0x1b')}]})[_0x9843('0xe')](function(_0x1aed29){if(!_0x1aed29){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0xb15e88={'tls':{'rejectUnauthorized':![]}};if(_0x1aed29[_0x9843('0x1b')][_0x9843('0x1c')]){_0xb15e88['service']=_0x1aed29[_0x9843('0x1b')]['service'];}else{_0xb15e88[_0x9843('0x1d')]=_0x1aed29[_0x9843('0x1b')][_0x9843('0x1d')];_0xb15e88[_0x9843('0x1e')]=_0x1aed29[_0x9843('0x1b')]['port'];_0xb15e88[_0x9843('0x1f')]=_0x1aed29['Smtp'][_0x9843('0x1f')];}if(_0x1aed29[_0x9843('0x1b')]['authentication']){_0xb15e88['auth']={'user':_0x1aed29[_0x9843('0x1b')]['user'],'pass':_0x1aed29['Smtp'][_0x9843('0x20')]};}var _0x525082={'account':_0xb15e88,'message':_['merge']({'from':util[_0x9843('0x21')](_0x9843('0x22'),_0x1aed29[_0x9843('0x15')],_0x1aed29[_0x9843('0x23')]||_0x1aed29[_0x9843('0x1b')]['user'])},_0x113fb1)};return client[_0x9843('0x24')]('SendMail',_0x525082);})[_0x9843('0xe')](function(_0x44f88f){if(_0x44f88f[_0x9843('0x25')]){throw new Error(util[_0x9843('0x21')](_0x9843('0x26'),_0x44f88f['error'][_0x9843('0x27')]||JSON['stringify'](_0x44f88f['error'])));}return!![];});}function handleError(_0x4482b2,_0x2340e4,_0x42964a){return _0x4482b2['status'](_0x2340e4||0x1f4)[_0x9843('0x28')]({'message':_0x42964a?_0x42964a[_0x9843('0x27')]||_0x42964a:''});}exports[_0x9843('0x29')]=function(_0x41ff40,_0x186893,_0x565cc3){passport[_0x9843('0x17')](_0x9843('0x2a'),function(_0x5df30c,_0x5d87bb,_0x150f8d){var _0x37207d=_0x5df30c||_0x150f8d;if(_0x37207d){return handleError(_0x186893,0x191,_0x37207d);}if(!_0x5d87bb){return handleError(_0x186893,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}var _0x3f052f=signToken(_0x5d87bb['id'],_0x5d87bb[_0x9843('0x2b')]);_0x186893[_0x9843('0x2c')]({'id':_0x5d87bb['id'],'token':_0x3f052f,'statusCall':'','isAlreadyLogged':_0x5d87bb[_0x9843('0x2d')]});})(_0x41ff40,_0x186893,_0x565cc3);};exports['forgot']=function(_0x36935f,_0x2b5013,_0xf913a1){if(!_0x36935f[_0x9843('0x2e')][_0x9843('0x23')]){return handleError(_0x2b5013,0x1f4,{'message':_0x9843('0x2f')});}var _0x84b83b=rs[_0x9843('0x30')]();_0x36935f[_0x9843('0x2e')][_0x9843('0x23')]=_0x36935f[_0x9843('0x2e')][_0x9843('0x23')]['trim']()[_0x9843('0x31')]();return db[_0x9843('0x32')][_0x9843('0x19')]({'where':{'email':_0x36935f['body'][_0x9843('0x23')]}})[_0x9843('0xe')](function(_0x11ca10){if(!_0x11ca10){throw new Error(_0x9843('0x33'));}_0x11ca10[_0x9843('0x34')]=_0x84b83b;_0x11ca10[_0x9843('0x35')]=Date['now']()+0x36ee80;return _0x11ca10[_0x9843('0x36')]();})[_0x9843('0xe')](function(){return sendServiceMail({'to':_0x36935f['body'][_0x9843('0x23')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x9843('0x37')+_0x9843('0x38')+_0x36935f[_0x9843('0x39')][_0x9843('0x1d')]+_0x9843('0x3a')+_0x84b83b+'\x0a\x0a'+_0x9843('0x3b')});})[_0x9843('0xe')](function(){_0x2b5013[_0x9843('0x3c')](0xc8)[_0x9843('0x28')]({'message':_0x9843('0x3d')});})['catch'](function(_0x35eb92){return handleError(_0x2b5013,0x1f4,_0x35eb92);});};exports[_0x9843('0x3e')]=function(_0x2ab43e,_0x3b79e8,_0x1c5258){return db[_0x9843('0x32')][_0x9843('0x19')]({'where':{'resetPasswordToken':_0x2ab43e[_0x9843('0x3f')][_0x9843('0x40')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x9843('0xe')](function(_0x1f0356){if(!_0x1f0356){throw new Error(_0x9843('0x41'));}_0x1f0356[_0x9843('0x42')]=_0x2ab43e[_0x9843('0x2e')][_0x9843('0x42')];_0x1f0356['resetPasswordToken']=null;_0x1f0356[_0x9843('0x35')]=null;return _0x1f0356[_0x9843('0x36')]();})['then'](function(){_0x3b79e8[_0x9843('0x3c')](0xc8)[_0x9843('0x28')]({'message':_0x9843('0x43')});})[_0x9843('0x13')](function(_0x5753b7){return handleError(_0x3b79e8,0x1f4,_0x5753b7);});};passport['use'](new LocalStrategy({'usernameField':_0x9843('0x15'),'passwordField':_0x9843('0x42')},function(_0x4e22f8,_0x4aaff7,_0x3145a9){return localAuthenticate(db[_0x9843('0x32')],_0x4e22f8,_0x4aaff7,_0x3145a9);})); \ No newline at end of file +var _0x1e82=['jayson/promise','../../config/logger','api','../../mysqldb','signToken','client','http','role','User','count','agent','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','admin','user','name','This\x20name\x20is\x20not\x20registered','authenticate','This\x20password\x20is\x20not\x20correct','catch','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','SendMail','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','Password\x20reset!','use','util','passport','passport-local','Strategy','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1e82,0x8b));var _0x21e8=function(_0x2e91f6,_0x577fd6){_0x2e91f6=_0x2e91f6-0x0;var _0x21945e=_0x1e82[_0x2e91f6];return _0x21945e;};'use strict';var util=require(_0x21e8('0x0'));var passport=require(_0x21e8('0x1'));var LocalStrategy=require(_0x21e8('0x2'))[_0x21e8('0x3')];var BPromise=require(_0x21e8('0x4'));var jayson=require(_0x21e8('0x5'));var _=require('lodash');var logger=require(_0x21e8('0x6'))(_0x21e8('0x7'));var rs=require('randomstring');var db=require(_0x21e8('0x8'))['db'];var signToken=require('../../components/auth/service')[_0x21e8('0x9')];var client=jayson[_0x21e8('0xa')][_0x21e8('0xb')]({'port':0x232b});var getLicense=function(_0x22cbd4){return new BPromise(function(_0x47b3b3,_0x45e5c1){var _0x3754c9=0x0;_0x22cbd4[_0x21e8('0xc')]!=='agent'&&_0x47b3b3(_0x22cbd4);return db[_0x21e8('0xd')][_0x21e8('0xe')]({'where':{'role':_0x21e8('0xf'),'online':!![],'id':{'$ne':_0x22cbd4['id']}}})[_0x21e8('0x10')](function(_0x5c6d17){_0x3754c9=_0x5c6d17;return require('../../config/license/util')[_0x21e8('0x11')]();})['then'](function(_0x131349){if(_0x131349&&_0x131349[_0x21e8('0x12')]&&_0x3754c9>=_0x131349['agents']){return _0x45e5c1({'message':_0x21e8('0x13')});}return _0x47b3b3(_0x22cbd4);})['catch'](function(_0x22d02e){return _0x45e5c1(_0x22d02e);});});};function localAuthenticate(_0x2afc7a,_0x16a877,_0x4eb523,_0x217605){_0x2afc7a['find']({'where':{'name':_0x16a877,'role':{'$or':[_0x21e8('0x14'),_0x21e8('0x15'),_0x21e8('0xf')]}}})['then'](function(_0x4ee658){if(!_0x4ee658||_0x4ee658&&_0x4ee658[_0x21e8('0x16')]!==_0x16a877){return _0x217605(null,![],{'message':_0x21e8('0x17')});}return getLicense(_0x4ee658);})[_0x21e8('0x10')](function(_0x18915a){_0x18915a[_0x21e8('0x18')](_0x4eb523,function(_0x13da4f,_0x29d932){if(_0x13da4f){return _0x217605(_0x13da4f);}if(!_0x29d932){return _0x217605(null,![],{'message':_0x21e8('0x19')});}else{return _0x217605(null,_0x18915a);}});})[_0x21e8('0x1a')](function(_0x552c6f){_0x217605(_0x552c6f);});}function sendServiceMail(_0x1c70cc){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x21e8('0x16'),_0x21e8('0x1b')],'include':[{'model':db[_0x21e8('0x1c')],'as':_0x21e8('0x1d')}]})['then'](function(_0x45243f){if(!_0x45243f){throw new Error(_0x21e8('0x1e'));}var _0x25b678={'tls':{'rejectUnauthorized':![]}};if(_0x45243f[_0x21e8('0x1d')][_0x21e8('0x1f')]){_0x25b678[_0x21e8('0x1f')]=_0x45243f[_0x21e8('0x1d')][_0x21e8('0x1f')];}else{_0x25b678['host']=_0x45243f[_0x21e8('0x1d')][_0x21e8('0x20')];_0x25b678['port']=_0x45243f[_0x21e8('0x1d')][_0x21e8('0x21')];_0x25b678[_0x21e8('0x22')]=_0x45243f[_0x21e8('0x1d')][_0x21e8('0x22')];}if(_0x45243f[_0x21e8('0x1d')][_0x21e8('0x23')]){_0x25b678[_0x21e8('0x24')]={'user':_0x45243f['Smtp'][_0x21e8('0x15')],'pass':_0x45243f['Smtp'][_0x21e8('0x25')]};}var _0x364dad={'account':_0x25b678,'message':_[_0x21e8('0x26')]({'from':util['format'](_0x21e8('0x27'),_0x45243f['name'],_0x45243f[_0x21e8('0x1b')]||_0x45243f[_0x21e8('0x1d')][_0x21e8('0x15')])},_0x1c70cc)};return client['request'](_0x21e8('0x28'),_0x364dad);})[_0x21e8('0x10')](function(_0x364cd8){if(_0x364cd8['error']){throw new Error(util[_0x21e8('0x29')](_0x21e8('0x2a'),_0x364cd8[_0x21e8('0x2b')][_0x21e8('0x2c')]||JSON[_0x21e8('0x2d')](_0x364cd8[_0x21e8('0x2b')])));}return!![];});}function handleError(_0x2116f2,_0x3339b6,_0x20d095){return _0x2116f2[_0x21e8('0x2e')](_0x3339b6||0x1f4)[_0x21e8('0x2f')]({'message':_0x20d095?_0x20d095[_0x21e8('0x2c')]||_0x20d095:''});}exports['login']=function(_0x452dfa,_0x418d46,_0x5a5436){passport['authenticate']('local',function(_0x9f1117,_0x5504df,_0x45be6f){var _0x3ebd06=_0x9f1117||_0x45be6f;if(_0x3ebd06){return handleError(_0x418d46,0x191,_0x3ebd06);}if(!_0x5504df){return handleError(_0x418d46,0x194,{'message':_0x21e8('0x30')});}var _0x8a1d94=signToken(_0x5504df['id'],_0x5504df['role']);_0x418d46['json']({'id':_0x5504df['id'],'token':_0x8a1d94,'statusCall':'','isAlreadyLogged':_0x5504df[_0x21e8('0x31')]});})(_0x452dfa,_0x418d46,_0x5a5436);};exports['forgot']=function(_0x2c20ec,_0x1cf161,_0x25d51e){if(!_0x2c20ec[_0x21e8('0x32')]['email']){return handleError(_0x1cf161,0x1f4,{'message':_0x21e8('0x33')});}var _0x2acb3b=rs[_0x21e8('0x34')]();_0x2c20ec[_0x21e8('0x32')][_0x21e8('0x1b')]=_0x2c20ec['body'][_0x21e8('0x1b')][_0x21e8('0x35')]()[_0x21e8('0x36')]();return db[_0x21e8('0xd')][_0x21e8('0x37')]({'where':{'email':_0x2c20ec[_0x21e8('0x32')][_0x21e8('0x1b')]}})[_0x21e8('0x10')](function(_0x1b7ae0){if(!_0x1b7ae0){throw new Error(_0x21e8('0x38'));}_0x1b7ae0[_0x21e8('0x39')]=_0x2acb3b;_0x1b7ae0[_0x21e8('0x3a')]=Date[_0x21e8('0x3b')]()+0x36ee80;return _0x1b7ae0[_0x21e8('0x3c')]();})[_0x21e8('0x10')](function(){return sendServiceMail({'to':_0x2c20ec['body'][_0x21e8('0x1b')],'subject':_0x21e8('0x3d'),'text':_0x21e8('0x3e')+_0x21e8('0x3f')+_0x21e8('0x40')+_0x2c20ec[_0x21e8('0x41')][_0x21e8('0x20')]+_0x21e8('0x42')+_0x2acb3b+'\x0a\x0a'+_0x21e8('0x43')});})[_0x21e8('0x10')](function(){_0x1cf161['status'](0xc8)[_0x21e8('0x2f')]({'message':'Reset\x20Email\x20sent!'});})[_0x21e8('0x1a')](function(_0x13ffe5){return handleError(_0x1cf161,0x1f4,_0x13ffe5);});};exports['reset']=function(_0x2fc11,_0x2f7dc5,_0x4040bf){return db[_0x21e8('0xd')][_0x21e8('0x37')]({'where':{'resetPasswordToken':_0x2fc11['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x21e8('0x3b')]()}}})[_0x21e8('0x10')](function(_0x22b2a7){if(!_0x22b2a7){throw new Error(_0x21e8('0x44'));}_0x22b2a7[_0x21e8('0x45')]=_0x2fc11[_0x21e8('0x32')][_0x21e8('0x45')];_0x22b2a7['resetPasswordToken']=null;_0x22b2a7[_0x21e8('0x3a')]=null;return _0x22b2a7['save']();})[_0x21e8('0x10')](function(){_0x2f7dc5[_0x21e8('0x2e')](0xc8)[_0x21e8('0x2f')]({'message':_0x21e8('0x46')});})[_0x21e8('0x1a')](function(_0x218845){return handleError(_0x2f7dc5,0x1f4,_0x218845);});};passport[_0x21e8('0x47')](new LocalStrategy({'usernameField':_0x21e8('0x16'),'passwordField':_0x21e8('0x45')},function(_0x2b91c2,_0x49ad00,_0x132f16){return localAuthenticate(db[_0x21e8('0xd')],_0x2b91c2,_0x49ad00,_0x132f16);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1b0d379..9e0edfa 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 _0xb4bd=['exports','express','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token','reset'];(function(_0xd6a74,_0x3b878a){var _0x4ed128=function(_0x15cc95){while(--_0x15cc95){_0xd6a74['push'](_0xd6a74['shift']());}};_0x4ed128(++_0x3b878a);}(_0xb4bd,0x7f));var _0xdb4b=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0xb4bd[_0xcf581b];return _0x4f454d;};'use strict';var express=require(_0xdb4b('0x0'));var router=express[_0xdb4b('0x1')]();var controller=require(_0xdb4b('0x2'));router[_0xdb4b('0x3')]('/',controller['login']);router[_0xdb4b('0x3')](_0xdb4b('0x4'),controller[_0xdb4b('0x5')]);router['post'](_0xdb4b('0x6'),controller[_0xdb4b('0x7')]);module[_0xdb4b('0x8')]=router; \ No newline at end of file +var _0x6caf=['./authLocal.controller','post','/forgot','forgot','/reset/:token','reset','exports','express'];(function(_0x5961fc,_0x2ed335){var _0x4f8c6e=function(_0x71392c){while(--_0x71392c){_0x5961fc['push'](_0x5961fc['shift']());}};_0x4f8c6e(++_0x2ed335);}(_0x6caf,0xd7));var _0xf6ca=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0x6caf[_0x256422];return _0x55dddc;};'use strict';var express=require(_0xf6ca('0x0'));var router=express['Router']();var controller=require(_0xf6ca('0x1'));router[_0xf6ca('0x2')]('/',controller['login']);router['post'](_0xf6ca('0x3'),controller[_0xf6ca('0x4')]);router[_0xf6ca('0x2')](_0xf6ca('0x5'),controller[_0xf6ca('0x6')]);module[_0xf6ca('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 3cc4fa6..65ac0ff 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 _0xccbf=['STRING'];(function(_0x200454,_0xb81cb6){var _0x1d45a3=function(_0x2272cd){while(--_0x2272cd){_0x200454['push'](_0x200454['shift']());}};_0x1d45a3(++_0xb81cb6);}(_0xccbf,0x1ef));var _0xfccb=function(_0xda60bc,_0x279d2e){_0xda60bc=_0xda60bc-0x0;var _0x2c4700=_0xccbf[_0xda60bc];return _0x2c4700;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfccb('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xfccb('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x87e5=['INTEGER','sequelize','exports','STRING'];(function(_0x293be2,_0x487ae2){var _0xba541a=function(_0x43593c){while(--_0x43593c){_0x293be2['push'](_0x293be2['shift']());}};_0xba541a(++_0x487ae2);}(_0x87e5,0xc1));var _0x587e=function(_0x9ea933,_0x565d76){_0x9ea933=_0x9ea933-0x0;var _0x4fdcd0=_0x87e5[_0x9ea933];return _0x4fdcd0;};'use strict';var Sequelize=require(_0x587e('0x0'));module[_0x587e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x587e('0x2')]},'description':{'type':Sequelize[_0x587e('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x587e('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 0504a28..988ad4c 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 _0xb377=['length','hasOwnProperty','limit','order','sort','where','pick','add','day','filter','merge','map','options','count','includeAll','include','findAll','rows','catch','show','create','body','find','params','addConditions','Condition','ids','findOne','getConditions','nolimit','addActions','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','apply','update','then','destroy','stack','send','index','Automation','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields'];(function(_0x1abcd8,_0x455a6e){var _0x34bc06=function(_0xf60a41){while(--_0xf60a41){_0x1abcd8['push'](_0x1abcd8['shift']());}};_0x34bc06(++_0x455a6e);}(_0xb377,0x1b6));var _0x7b37=function(_0x1dd67a,_0x3c474e){_0x1dd67a=_0x1dd67a-0x0;var _0x3717fd=_0xb377[_0x1dd67a];return _0x3717fd;};'use strict';var pdf=require(_0x7b37('0x0'));var emlformat=require(_0x7b37('0x1'));var rimraf=require(_0x7b37('0x2'));var zipdir=require(_0x7b37('0x3'));var jsonpatch=require(_0x7b37('0x4'));var rp=require(_0x7b37('0x5'));var moment=require(_0x7b37('0x6'));var BPromise=require(_0x7b37('0x7'));var Mustache=require(_0x7b37('0x8'));var util=require(_0x7b37('0x9'));var path=require(_0x7b37('0xa'));var sox=require(_0x7b37('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b37('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b37('0xd'));var deskjs=require(_0x7b37('0xe'));var toCsv=require(_0x7b37('0xf'));var querystring=require(_0x7b37('0x10'));var Papa=require(_0x7b37('0x11'));var Redis=require(_0x7b37('0x12'));var qs=require(_0x7b37('0x13'));var logger=require(_0x7b37('0x14'))('api');var utils=require(_0x7b37('0x15'));var config=require(_0x7b37('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5fb5,_0x29154d){_0x29154d=_0x29154d||0xcc;return function(_0xaca3d6){if(_0xaca3d6){return _0x5e5fb5[_0x7b37('0x17')](_0x29154d);}return _0x5e5fb5[_0x7b37('0x18')](_0x29154d)[_0x7b37('0x19')]();};}function respondWithResult(_0x1edd5a,_0x28dd9c){_0x28dd9c=_0x28dd9c||0xc8;return function(_0x6de05b){if(_0x6de05b){return _0x1edd5a[_0x7b37('0x18')](_0x28dd9c)[_0x7b37('0x1a')](_0x6de05b);}};}function respondWithFilteredResult(_0x1a381a,_0x19ce67){return function(_0x35a61f){if(_0x35a61f){var _0x330ee2=_0x35a61f['count'],_0xbfdc78=_0x19ce67['offset'],_0x17e9e4=_0x19ce67[_0x7b37('0x1b')]+_0x19ce67['limit'],_0x456318;if(_0x17e9e4>=_0x330ee2){_0x17e9e4=_0x330ee2;_0x456318=0xc8;}else{_0x456318=0xce;}_0x1a381a['status'](_0x456318);return _0x1a381a[_0x7b37('0x1c')](_0x7b37('0x1d'),_0xbfdc78+'-'+_0x17e9e4+'/'+_0x330ee2)[_0x7b37('0x1a')](_0x35a61f);}return null;};}function patchUpdates(_0x487f5c){return function(_0x29a9dd){try{jsonpatch[_0x7b37('0x1e')](_0x29a9dd,_0x487f5c,!![]);}catch(_0x2a77ae){return BPromise['reject'](_0x2a77ae);}return _0x29a9dd['save']();};}function saveUpdates(_0x6905bb,_0x1ee877){return function(_0x3f3bbb){if(_0x3f3bbb){return _0x3f3bbb[_0x7b37('0x1f')](_0x6905bb)[_0x7b37('0x20')](function(_0x51851a){return _0x51851a;});}return null;};}function removeEntity(_0x50b1ab,_0x57f7f2){return function(_0x436d15){if(_0x436d15){return _0x436d15[_0x7b37('0x21')]()[_0x7b37('0x20')](function(){_0x50b1ab[_0x7b37('0x18')](0xcc)[_0x7b37('0x19')]();});}};}function handleEntityNotFound(_0x3059d8,_0x11af8e){return function(_0x58bae2){if(!_0x58bae2){_0x3059d8[_0x7b37('0x17')](0x194);}return _0x58bae2;};}function handleError(_0x2e60d9,_0x550744){_0x550744=_0x550744||0x1f4;return function(_0x239cfc){logger['error'](_0x239cfc[_0x7b37('0x22')]);if(_0x239cfc['name']){delete _0x239cfc['name'];}_0x2e60d9[_0x7b37('0x18')](_0x550744)[_0x7b37('0x23')](_0x239cfc);};}exports[_0x7b37('0x24')]=function(_0x94ecb2,_0x2f3805){var _0x5ab694={},_0x4d7c53={},_0x20a3cc={'count':0x0,'rows':[]};var _0xdc5403=db[_0x7b37('0x25')][_0x7b37('0x26')];_0x4d7c53[_0x7b37('0x27')]=_[_0x7b37('0x28')](_0xdc5403);var _0x46810f={'dateStart':_0x94ecb2[_0x7b37('0x29')][_0x7b37('0x2a')],'dateEnd':_0x94ecb2['query'][_0x7b37('0x2b')]};delete _0x94ecb2[_0x7b37('0x29')][_0x7b37('0x2a')];delete _0x94ecb2[_0x7b37('0x29')]['dateEnd'];_0x4d7c53[_0x7b37('0x29')]=_[_0x7b37('0x28')](_0x94ecb2[_0x7b37('0x29')]);_0x4d7c53[_0x7b37('0x2c')]=_[_0x7b37('0x2d')](_0x4d7c53[_0x7b37('0x27')],_0x4d7c53['query']);_0x5ab694[_0x7b37('0x2e')]=_['intersection'](_0x4d7c53[_0x7b37('0x27')],qs['fields'](_0x94ecb2[_0x7b37('0x29')][_0x7b37('0x2f')]));_0x5ab694[_0x7b37('0x2e')]=_0x5ab694['attributes'][_0x7b37('0x30')]?_0x5ab694['attributes']:_0x4d7c53['model'];if(!_0x94ecb2[_0x7b37('0x29')][_0x7b37('0x31')]('nolimit')){_0x5ab694[_0x7b37('0x32')]=qs[_0x7b37('0x32')](_0x94ecb2['query']['limit']);_0x5ab694[_0x7b37('0x1b')]=qs['offset'](_0x94ecb2['query']['offset']);}_0x5ab694[_0x7b37('0x33')]=qs['sort'](_0x94ecb2['query'][_0x7b37('0x34')]);_0x5ab694[_0x7b37('0x35')]=qs[_0x7b37('0x2c')](_[_0x7b37('0x36')](_0x94ecb2[_0x7b37('0x29')],_0x4d7c53[_0x7b37('0x2c')]));if(_0x46810f[_0x7b37('0x2a')]){if(_0x46810f['dateEnd']){_0x46810f[_0x7b37('0x2b')]=moment(_0x46810f[_0x7b37('0x2b')])[_0x7b37('0x37')](0x1,_0x7b37('0x38'));}else{_0x46810f[_0x7b37('0x2b')]=moment(_0x46810f[_0x7b37('0x2a')])[_0x7b37('0x37')](0x1,_0x7b37('0x38'));}_['merge'](_0x5ab694[_0x7b37('0x35')],{'createdAt':{'$gte':_0x46810f[_0x7b37('0x2a')],'$lte':_0x46810f['dateEnd']}});}if(_0x94ecb2[_0x7b37('0x29')][_0x7b37('0x39')]){_0x5ab694[_0x7b37('0x35')]=_[_0x7b37('0x3a')](_0x5ab694[_0x7b37('0x35')],{'$or':_[_0x7b37('0x3b')](_0x5ab694[_0x7b37('0x2e')],function(_0x2fc886){var _0x2e9062={};_0x2e9062[_0x2fc886]={'$like':'%'+_0x94ecb2[_0x7b37('0x29')]['filter']+'%'};return _0x2e9062;})});}_0x5ab694=_[_0x7b37('0x3a')]({},_0x5ab694,_0x94ecb2[_0x7b37('0x3c')]);var _0x262876={'where':_0x5ab694[_0x7b37('0x35')]};return db[_0x7b37('0x25')][_0x7b37('0x3d')](_0x262876)[_0x7b37('0x20')](function(_0x1bf527){_0x20a3cc['count']=_0x1bf527;if(_0x94ecb2['query'][_0x7b37('0x3e')]){_0x5ab694[_0x7b37('0x3f')]=[{'all':!![]}];}return db[_0x7b37('0x25')][_0x7b37('0x40')](_0x5ab694);})[_0x7b37('0x20')](function(_0x25eeb7){_0x20a3cc[_0x7b37('0x41')]=_0x25eeb7;return _0x20a3cc;})[_0x7b37('0x20')](respondWithFilteredResult(_0x2f3805,_0x5ab694))[_0x7b37('0x42')](handleError(_0x2f3805,null));};exports[_0x7b37('0x43')]=function(_0x3bb2f9,_0x5ce4e2){var _0x5047ba={'raw':![],'where':{'id':_0x3bb2f9['params']['id']}},_0x72d424={};_0x72d424[_0x7b37('0x27')]=_[_0x7b37('0x28')](db['Automation']['rawAttributes']);_0x72d424[_0x7b37('0x29')]=_[_0x7b37('0x28')](_0x3bb2f9['query']);_0x72d424[_0x7b37('0x2c')]=_['intersection'](_0x72d424[_0x7b37('0x27')],_0x72d424[_0x7b37('0x29')]);_0x5047ba[_0x7b37('0x2e')]=_[_0x7b37('0x2d')](_0x72d424[_0x7b37('0x27')],qs[_0x7b37('0x2f')](_0x3bb2f9[_0x7b37('0x29')][_0x7b37('0x2f')]));_0x5047ba[_0x7b37('0x2e')]=_0x5047ba[_0x7b37('0x2e')][_0x7b37('0x30')]?_0x5047ba[_0x7b37('0x2e')]:_0x72d424[_0x7b37('0x27')];if(_0x3bb2f9[_0x7b37('0x29')]['includeAll']){_0x5047ba['include']=[{'all':!![]}];}_0x5047ba=_[_0x7b37('0x3a')]({},_0x5047ba,_0x3bb2f9[_0x7b37('0x3c')]);return db[_0x7b37('0x25')]['find'](_0x5047ba)['then'](handleEntityNotFound(_0x5ce4e2,null))[_0x7b37('0x20')](respondWithResult(_0x5ce4e2,null))[_0x7b37('0x42')](handleError(_0x5ce4e2,null));};exports[_0x7b37('0x44')]=function(_0x224449,_0x76b6dc){return db[_0x7b37('0x25')][_0x7b37('0x44')](_0x224449[_0x7b37('0x45')],{})[_0x7b37('0x20')](respondWithResult(_0x76b6dc,0xc9))['catch'](handleError(_0x76b6dc,null));};exports['update']=function(_0x4863d4,_0x2a50f5){if(_0x4863d4['body']['id']){delete _0x4863d4[_0x7b37('0x45')]['id'];}return db[_0x7b37('0x25')][_0x7b37('0x46')]({'where':{'id':_0x4863d4[_0x7b37('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a50f5,null))[_0x7b37('0x20')](saveUpdates(_0x4863d4[_0x7b37('0x45')],null))[_0x7b37('0x20')](respondWithResult(_0x2a50f5,null))[_0x7b37('0x42')](handleError(_0x2a50f5,null));};exports['destroy']=function(_0x5064bf,_0x4681ab){return db[_0x7b37('0x25')]['find']({'where':{'id':_0x5064bf[_0x7b37('0x47')]['id']}})[_0x7b37('0x20')](handleEntityNotFound(_0x4681ab,null))['then'](removeEntity(_0x4681ab,null))[_0x7b37('0x42')](handleError(_0x4681ab,null));};exports[_0x7b37('0x48')]=function(_0x3f9fb1,_0x4f79c3,_0x495af9){return db[_0x7b37('0x49')][_0x7b37('0x46')]({'where':{'id':_0x3f9fb1[_0x7b37('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f79c3,null))[_0x7b37('0x20')](function(_0x3483b6){if(_0x3483b6){return _0x3483b6[_0x7b37('0x48')](_0x3f9fb1[_0x7b37('0x45')][_0x7b37('0x4a')],_['omit'](_0x3f9fb1['body'],[_0x7b37('0x4a'),'id'])||{});}})[_0x7b37('0x20')](respondWithResult(_0x4f79c3,null))[_0x7b37('0x42')](handleError(_0x4f79c3,null));};exports['getConditions']=function(_0xaf0f88,_0x58fdcd,_0x14fbaf){var _0xff2e8b={};var _0x26c1a0={};var _0x31af15;var _0x2cca89;return db['Automation'][_0x7b37('0x4b')]({'where':{'id':_0xaf0f88[_0x7b37('0x47')]['id']}})[_0x7b37('0x20')](handleEntityNotFound(_0x58fdcd,null))[_0x7b37('0x20')](function(_0x5c09aa){if(_0x5c09aa){_0x31af15=_0x5c09aa;_0x26c1a0['model']=_[_0x7b37('0x28')](db[_0x7b37('0x49')][_0x7b37('0x26')]);_0x26c1a0[_0x7b37('0x29')]=_['keys'](_0xaf0f88['query']);_0x26c1a0[_0x7b37('0x2c')]=_[_0x7b37('0x2d')](_0x26c1a0['model'],_0x26c1a0[_0x7b37('0x29')]);_0xff2e8b[_0x7b37('0x2e')]=_[_0x7b37('0x2d')](_0x26c1a0[_0x7b37('0x27')],qs[_0x7b37('0x2f')](_0xaf0f88[_0x7b37('0x29')]['fields']));_0xff2e8b[_0x7b37('0x2e')]=_0xff2e8b[_0x7b37('0x2e')][_0x7b37('0x30')]?_0xff2e8b[_0x7b37('0x2e')]:_0x26c1a0[_0x7b37('0x27')];_0xff2e8b[_0x7b37('0x33')]=qs[_0x7b37('0x34')](_0xaf0f88[_0x7b37('0x29')][_0x7b37('0x34')]);_0xff2e8b[_0x7b37('0x35')]=qs[_0x7b37('0x2c')](_[_0x7b37('0x36')](_0xaf0f88[_0x7b37('0x29')],_0x26c1a0[_0x7b37('0x2c')]));if(_0xaf0f88['query'][_0x7b37('0x39')]){_0xff2e8b['where']=_[_0x7b37('0x3a')](_0xff2e8b[_0x7b37('0x35')],{'$or':_[_0x7b37('0x3b')](_0xff2e8b[_0x7b37('0x2e')],function(_0x4440ff){var _0xf7af76={};_0xf7af76[_0x4440ff]={'$like':'%'+_0xaf0f88[_0x7b37('0x29')]['filter']+'%'};return _0xf7af76;})});}_0xff2e8b=_[_0x7b37('0x3a')]({},_0xff2e8b,_0xaf0f88[_0x7b37('0x3c')]);return _0x31af15[_0x7b37('0x4c')](_0xff2e8b);}})[_0x7b37('0x20')](function(_0x25cfe4){if(_0x25cfe4){_0x2cca89=_0x25cfe4[_0x7b37('0x30')];if(!_0xaf0f88[_0x7b37('0x29')]['hasOwnProperty'](_0x7b37('0x4d'))){_0xff2e8b[_0x7b37('0x32')]=qs[_0x7b37('0x32')](_0xaf0f88[_0x7b37('0x29')][_0x7b37('0x32')]);_0xff2e8b[_0x7b37('0x1b')]=qs[_0x7b37('0x1b')](_0xaf0f88['query'][_0x7b37('0x1b')]);}return _0x31af15[_0x7b37('0x4c')](_0xff2e8b);}})[_0x7b37('0x20')](function(_0x2e9a92){if(_0x2e9a92){return _0x2e9a92?{'count':_0x2cca89,'rows':_0x2e9a92}:null;}})[_0x7b37('0x20')](respondWithResult(_0x58fdcd,null))['catch'](handleError(_0x58fdcd,null));};exports[_0x7b37('0x4e')]=function(_0x3d710a,_0x45efec,_0x497f90){return db[_0x7b37('0x4f')][_0x7b37('0x46')]({'where':{'id':_0x3d710a[_0x7b37('0x47')]['id']}})[_0x7b37('0x20')](handleEntityNotFound(_0x45efec,null))['then'](function(_0x2fa9c3){if(_0x2fa9c3){return _0x2fa9c3[_0x7b37('0x4e')](_0x3d710a[_0x7b37('0x45')][_0x7b37('0x4a')],_['omit'](_0x3d710a[_0x7b37('0x45')],[_0x7b37('0x4a'),'id'])||{});}})[_0x7b37('0x20')](respondWithResult(_0x45efec,null))[_0x7b37('0x42')](handleError(_0x45efec,null));};exports['getActions']=function(_0x463cf5,_0x43beac,_0x46a627){var _0x22a009={};var _0x4f6a97={};var _0x1e4003;var _0x184724;return db['Automation']['findOne']({'where':{'id':_0x463cf5[_0x7b37('0x47')]['id']}})[_0x7b37('0x20')](handleEntityNotFound(_0x43beac,null))[_0x7b37('0x20')](function(_0x5095e5){if(_0x5095e5){_0x1e4003=_0x5095e5;_0x4f6a97[_0x7b37('0x27')]=_[_0x7b37('0x28')](db[_0x7b37('0x4f')][_0x7b37('0x26')]);_0x4f6a97[_0x7b37('0x29')]=_[_0x7b37('0x28')](_0x463cf5[_0x7b37('0x29')]);_0x4f6a97[_0x7b37('0x2c')]=_['intersection'](_0x4f6a97[_0x7b37('0x27')],_0x4f6a97[_0x7b37('0x29')]);_0x22a009[_0x7b37('0x2e')]=_[_0x7b37('0x2d')](_0x4f6a97[_0x7b37('0x27')],qs[_0x7b37('0x2f')](_0x463cf5[_0x7b37('0x29')][_0x7b37('0x2f')]));_0x22a009[_0x7b37('0x2e')]=_0x22a009[_0x7b37('0x2e')][_0x7b37('0x30')]?_0x22a009[_0x7b37('0x2e')]:_0x4f6a97[_0x7b37('0x27')];_0x22a009[_0x7b37('0x33')]=qs[_0x7b37('0x34')](_0x463cf5[_0x7b37('0x29')][_0x7b37('0x34')]);_0x22a009['where']=qs['filters'](_[_0x7b37('0x36')](_0x463cf5[_0x7b37('0x29')],_0x4f6a97[_0x7b37('0x2c')]));if(_0x463cf5[_0x7b37('0x29')][_0x7b37('0x39')]){_0x22a009[_0x7b37('0x35')]=_['merge'](_0x22a009[_0x7b37('0x35')],{'$or':_[_0x7b37('0x3b')](_0x22a009[_0x7b37('0x2e')],function(_0x3a587a){var _0x1148fe={};_0x1148fe[_0x3a587a]={'$like':'%'+_0x463cf5['query'][_0x7b37('0x39')]+'%'};return _0x1148fe;})});}_0x22a009=_['merge']({},_0x22a009,_0x463cf5[_0x7b37('0x3c')]);return _0x1e4003[_0x7b37('0x50')](_0x22a009);}})['then'](function(_0x3156f8){if(_0x3156f8){_0x184724=_0x3156f8['length'];if(!_0x463cf5[_0x7b37('0x29')]['hasOwnProperty'](_0x7b37('0x4d'))){_0x22a009[_0x7b37('0x32')]=qs[_0x7b37('0x32')](_0x463cf5[_0x7b37('0x29')][_0x7b37('0x32')]);_0x22a009[_0x7b37('0x1b')]=qs[_0x7b37('0x1b')](_0x463cf5[_0x7b37('0x29')]['offset']);}return _0x1e4003[_0x7b37('0x50')](_0x22a009);}})[_0x7b37('0x20')](function(_0x1f8f7e){if(_0x1f8f7e){return _0x1f8f7e?{'count':_0x184724,'rows':_0x1f8f7e}:null;}})[_0x7b37('0x20')](respondWithResult(_0x43beac,null))[_0x7b37('0x42')](handleError(_0x43beac,null));}; \ No newline at end of file +var _0x1339=['create','body','destroy','addConditions','Condition','omit','getConditions','findOne','nolimit','addActions','Action','ids','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','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','reject','sendStatus','stack','name','send','index','Automation','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','filter','map','options','then','includeAll','include','findAll','rows','catch','params','find'];(function(_0x56ecd6,_0xaba92f){var _0x497007=function(_0x3d38d8){while(--_0x3d38d8){_0x56ecd6['push'](_0x56ecd6['shift']());}};_0x497007(++_0xaba92f);}(_0x1339,0x1ed));var _0x9133=function(_0x19caed,_0x4f774c){_0x19caed=_0x19caed-0x0;var _0x2ee13f=_0x1339[_0x19caed];return _0x2ee13f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9133('0x0'));var zipdir=require(_0x9133('0x1'));var jsonpatch=require(_0x9133('0x2'));var rp=require(_0x9133('0x3'));var moment=require(_0x9133('0x4'));var BPromise=require(_0x9133('0x5'));var Mustache=require(_0x9133('0x6'));var util=require(_0x9133('0x7'));var path=require('path');var sox=require(_0x9133('0x8'));var csv=require(_0x9133('0x9'));var ejs=require(_0x9133('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x9'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var qs=require(_0x9133('0x12'));var logger=require(_0x9133('0x13'))('api');var utils=require(_0x9133('0x14'));var config=require(_0x9133('0x15'));var db=require(_0x9133('0x16'))['db'];function respondWithStatusCode(_0x452481,_0x3b8f89){_0x3b8f89=_0x3b8f89||0xcc;return function(_0x244ced){if(_0x244ced){return _0x452481['sendStatus'](_0x3b8f89);}return _0x452481[_0x9133('0x17')](_0x3b8f89)[_0x9133('0x18')]();};}function respondWithResult(_0x4bbfdc,_0x5283a3){_0x5283a3=_0x5283a3||0xc8;return function(_0x10475c){if(_0x10475c){return _0x4bbfdc['status'](_0x5283a3)[_0x9133('0x19')](_0x10475c);}};}function respondWithFilteredResult(_0x439e1a,_0x17dfd1){return function(_0x464ec5){if(_0x464ec5){var _0x31847a=_0x464ec5[_0x9133('0x1a')],_0x4327b3=_0x17dfd1['offset'],_0x49cc5d=_0x17dfd1[_0x9133('0x1b')]+_0x17dfd1[_0x9133('0x1c')],_0x13f8fc;if(_0x49cc5d>=_0x31847a){_0x49cc5d=_0x31847a;_0x13f8fc=0xc8;}else{_0x13f8fc=0xce;}_0x439e1a[_0x9133('0x17')](_0x13f8fc);return _0x439e1a[_0x9133('0x1d')]('Content-Range',_0x4327b3+'-'+_0x49cc5d+'/'+_0x31847a)[_0x9133('0x19')](_0x464ec5);}return null;};}function patchUpdates(_0x573998){return function(_0x3c48ef){try{jsonpatch['apply'](_0x3c48ef,_0x573998,!![]);}catch(_0x115ee8){return BPromise[_0x9133('0x1e')](_0x115ee8);}return _0x3c48ef['save']();};}function saveUpdates(_0x38dd60,_0x4b940b){return function(_0x2f91f8){if(_0x2f91f8){return _0x2f91f8['update'](_0x38dd60)['then'](function(_0x2f7354){return _0x2f7354;});}return null;};}function removeEntity(_0x577de4,_0x12c2d4){return function(_0x4c1088){if(_0x4c1088){return _0x4c1088['destroy']()['then'](function(){_0x577de4[_0x9133('0x17')](0xcc)[_0x9133('0x18')]();});}};}function handleEntityNotFound(_0x4da09c,_0x448f8b){return function(_0x3f5d0e){if(!_0x3f5d0e){_0x4da09c[_0x9133('0x1f')](0x194);}return _0x3f5d0e;};}function handleError(_0x26190c,_0x4f26e8){_0x4f26e8=_0x4f26e8||0x1f4;return function(_0xdb7a98){logger['error'](_0xdb7a98[_0x9133('0x20')]);if(_0xdb7a98[_0x9133('0x21')]){delete _0xdb7a98[_0x9133('0x21')];}_0x26190c[_0x9133('0x17')](_0x4f26e8)[_0x9133('0x22')](_0xdb7a98);};}exports[_0x9133('0x23')]=function(_0x294332,_0x313d43){var _0x1b6b3e={},_0x46050b={},_0x51de62={'count':0x0,'rows':[]};var _0x517e7b=db[_0x9133('0x24')][_0x9133('0x25')];_0x46050b[_0x9133('0x26')]=_[_0x9133('0x27')](_0x517e7b);var _0x4de894={'dateStart':_0x294332['query'][_0x9133('0x28')],'dateEnd':_0x294332[_0x9133('0x29')][_0x9133('0x2a')]};delete _0x294332[_0x9133('0x29')][_0x9133('0x28')];delete _0x294332[_0x9133('0x29')]['dateEnd'];_0x46050b['query']=_['keys'](_0x294332[_0x9133('0x29')]);_0x46050b['filters']=_[_0x9133('0x2b')](_0x46050b[_0x9133('0x26')],_0x46050b['query']);_0x1b6b3e[_0x9133('0x2c')]=_['intersection'](_0x46050b[_0x9133('0x26')],qs[_0x9133('0x2d')](_0x294332[_0x9133('0x29')]['fields']));_0x1b6b3e[_0x9133('0x2c')]=_0x1b6b3e[_0x9133('0x2c')][_0x9133('0x2e')]?_0x1b6b3e['attributes']:_0x46050b[_0x9133('0x26')];if(!_0x294332[_0x9133('0x29')][_0x9133('0x2f')]('nolimit')){_0x1b6b3e[_0x9133('0x1c')]=qs[_0x9133('0x1c')](_0x294332[_0x9133('0x29')][_0x9133('0x1c')]);_0x1b6b3e['offset']=qs[_0x9133('0x1b')](_0x294332[_0x9133('0x29')]['offset']);}_0x1b6b3e[_0x9133('0x30')]=qs[_0x9133('0x31')](_0x294332[_0x9133('0x29')][_0x9133('0x31')]);_0x1b6b3e[_0x9133('0x32')]=qs[_0x9133('0x33')](_[_0x9133('0x34')](_0x294332[_0x9133('0x29')],_0x46050b[_0x9133('0x33')]));if(_0x4de894[_0x9133('0x28')]){if(_0x4de894[_0x9133('0x2a')]){_0x4de894['dateEnd']=moment(_0x4de894[_0x9133('0x2a')])[_0x9133('0x35')](0x1,'day');}else{_0x4de894[_0x9133('0x2a')]=moment(_0x4de894[_0x9133('0x28')])[_0x9133('0x35')](0x1,_0x9133('0x36'));}_[_0x9133('0x37')](_0x1b6b3e[_0x9133('0x32')],{'createdAt':{'$gte':_0x4de894['dateStart'],'$lte':_0x4de894['dateEnd']}});}if(_0x294332[_0x9133('0x29')][_0x9133('0x38')]){_0x1b6b3e[_0x9133('0x32')]=_[_0x9133('0x37')](_0x1b6b3e[_0x9133('0x32')],{'$or':_[_0x9133('0x39')](_0x1b6b3e[_0x9133('0x2c')],function(_0x2ee83e){var _0x720048={};_0x720048[_0x2ee83e]={'$like':'%'+_0x294332['query'][_0x9133('0x38')]+'%'};return _0x720048;})});}_0x1b6b3e=_[_0x9133('0x37')]({},_0x1b6b3e,_0x294332[_0x9133('0x3a')]);var _0x199ae9={'where':_0x1b6b3e[_0x9133('0x32')]};return db['Automation'][_0x9133('0x1a')](_0x199ae9)[_0x9133('0x3b')](function(_0x151069){_0x51de62[_0x9133('0x1a')]=_0x151069;if(_0x294332['query'][_0x9133('0x3c')]){_0x1b6b3e[_0x9133('0x3d')]=[{'all':!![]}];}return db[_0x9133('0x24')][_0x9133('0x3e')](_0x1b6b3e);})[_0x9133('0x3b')](function(_0x338049){_0x51de62[_0x9133('0x3f')]=_0x338049;return _0x51de62;})['then'](respondWithFilteredResult(_0x313d43,_0x1b6b3e))[_0x9133('0x40')](handleError(_0x313d43,null));};exports['show']=function(_0x499bae,_0x41333c){var _0x1d564f={'raw':![],'where':{'id':_0x499bae[_0x9133('0x41')]['id']}},_0x46156d={};_0x46156d[_0x9133('0x26')]=_[_0x9133('0x27')](db[_0x9133('0x24')][_0x9133('0x25')]);_0x46156d[_0x9133('0x29')]=_['keys'](_0x499bae[_0x9133('0x29')]);_0x46156d[_0x9133('0x33')]=_[_0x9133('0x2b')](_0x46156d['model'],_0x46156d['query']);_0x1d564f[_0x9133('0x2c')]=_[_0x9133('0x2b')](_0x46156d['model'],qs[_0x9133('0x2d')](_0x499bae[_0x9133('0x29')][_0x9133('0x2d')]));_0x1d564f[_0x9133('0x2c')]=_0x1d564f[_0x9133('0x2c')]['length']?_0x1d564f[_0x9133('0x2c')]:_0x46156d[_0x9133('0x26')];if(_0x499bae[_0x9133('0x29')]['includeAll']){_0x1d564f[_0x9133('0x3d')]=[{'all':!![]}];}_0x1d564f=_[_0x9133('0x37')]({},_0x1d564f,_0x499bae['options']);return db['Automation'][_0x9133('0x42')](_0x1d564f)[_0x9133('0x3b')](handleEntityNotFound(_0x41333c,null))[_0x9133('0x3b')](respondWithResult(_0x41333c,null))[_0x9133('0x40')](handleError(_0x41333c,null));};exports[_0x9133('0x43')]=function(_0xe31c84,_0xe065c4){return db[_0x9133('0x24')][_0x9133('0x43')](_0xe31c84[_0x9133('0x44')],{})[_0x9133('0x3b')](respondWithResult(_0xe065c4,0xc9))[_0x9133('0x40')](handleError(_0xe065c4,null));};exports['update']=function(_0x4dc5ee,_0xf2e098){if(_0x4dc5ee['body']['id']){delete _0x4dc5ee[_0x9133('0x44')]['id'];}return db[_0x9133('0x24')][_0x9133('0x42')]({'where':{'id':_0x4dc5ee[_0x9133('0x41')]['id']}})['then'](handleEntityNotFound(_0xf2e098,null))[_0x9133('0x3b')](saveUpdates(_0x4dc5ee[_0x9133('0x44')],null))[_0x9133('0x3b')](respondWithResult(_0xf2e098,null))['catch'](handleError(_0xf2e098,null));};exports[_0x9133('0x45')]=function(_0x27c996,_0x15f638){return db['Automation'][_0x9133('0x42')]({'where':{'id':_0x27c996['params']['id']}})[_0x9133('0x3b')](handleEntityNotFound(_0x15f638,null))[_0x9133('0x3b')](removeEntity(_0x15f638,null))[_0x9133('0x40')](handleError(_0x15f638,null));};exports[_0x9133('0x46')]=function(_0x4f58fe,_0x4a346c,_0x2f09f6){return db[_0x9133('0x47')][_0x9133('0x42')]({'where':{'id':_0x4f58fe[_0x9133('0x41')]['id']}})[_0x9133('0x3b')](handleEntityNotFound(_0x4a346c,null))['then'](function(_0x554bb9){if(_0x554bb9){return _0x554bb9[_0x9133('0x46')](_0x4f58fe[_0x9133('0x44')]['ids'],_[_0x9133('0x48')](_0x4f58fe[_0x9133('0x44')],['ids','id'])||{});}})['then'](respondWithResult(_0x4a346c,null))['catch'](handleError(_0x4a346c,null));};exports[_0x9133('0x49')]=function(_0x537046,_0x12d9e1,_0x3c11b9){var _0x439258={};var _0x3d6daa={};var _0x5d98df;var _0x29e0e3;return db['Automation'][_0x9133('0x4a')]({'where':{'id':_0x537046[_0x9133('0x41')]['id']}})[_0x9133('0x3b')](handleEntityNotFound(_0x12d9e1,null))[_0x9133('0x3b')](function(_0x3b9927){if(_0x3b9927){_0x5d98df=_0x3b9927;_0x3d6daa[_0x9133('0x26')]=_['keys'](db['Condition']['rawAttributes']);_0x3d6daa[_0x9133('0x29')]=_[_0x9133('0x27')](_0x537046[_0x9133('0x29')]);_0x3d6daa['filters']=_[_0x9133('0x2b')](_0x3d6daa[_0x9133('0x26')],_0x3d6daa[_0x9133('0x29')]);_0x439258[_0x9133('0x2c')]=_[_0x9133('0x2b')](_0x3d6daa[_0x9133('0x26')],qs[_0x9133('0x2d')](_0x537046[_0x9133('0x29')]['fields']));_0x439258[_0x9133('0x2c')]=_0x439258['attributes'][_0x9133('0x2e')]?_0x439258['attributes']:_0x3d6daa[_0x9133('0x26')];_0x439258[_0x9133('0x30')]=qs['sort'](_0x537046['query'][_0x9133('0x31')]);_0x439258[_0x9133('0x32')]=qs[_0x9133('0x33')](_[_0x9133('0x34')](_0x537046[_0x9133('0x29')],_0x3d6daa[_0x9133('0x33')]));if(_0x537046[_0x9133('0x29')][_0x9133('0x38')]){_0x439258[_0x9133('0x32')]=_[_0x9133('0x37')](_0x439258[_0x9133('0x32')],{'$or':_['map'](_0x439258[_0x9133('0x2c')],function(_0x562658){var _0x23d61f={};_0x23d61f[_0x562658]={'$like':'%'+_0x537046[_0x9133('0x29')][_0x9133('0x38')]+'%'};return _0x23d61f;})});}_0x439258=_[_0x9133('0x37')]({},_0x439258,_0x537046[_0x9133('0x3a')]);return _0x5d98df['getConditions'](_0x439258);}})[_0x9133('0x3b')](function(_0x1f0ca7){if(_0x1f0ca7){_0x29e0e3=_0x1f0ca7[_0x9133('0x2e')];if(!_0x537046[_0x9133('0x29')]['hasOwnProperty'](_0x9133('0x4b'))){_0x439258[_0x9133('0x1c')]=qs[_0x9133('0x1c')](_0x537046[_0x9133('0x29')]['limit']);_0x439258['offset']=qs[_0x9133('0x1b')](_0x537046[_0x9133('0x29')][_0x9133('0x1b')]);}return _0x5d98df[_0x9133('0x49')](_0x439258);}})[_0x9133('0x3b')](function(_0x2cfaf8){if(_0x2cfaf8){return _0x2cfaf8?{'count':_0x29e0e3,'rows':_0x2cfaf8}:null;}})['then'](respondWithResult(_0x12d9e1,null))[_0x9133('0x40')](handleError(_0x12d9e1,null));};exports[_0x9133('0x4c')]=function(_0x2576c8,_0x22611b,_0x57e4e9){return db[_0x9133('0x4d')]['find']({'where':{'id':_0x2576c8[_0x9133('0x41')]['id']}})[_0x9133('0x3b')](handleEntityNotFound(_0x22611b,null))[_0x9133('0x3b')](function(_0x39b46d){if(_0x39b46d){return _0x39b46d[_0x9133('0x4c')](_0x2576c8[_0x9133('0x44')][_0x9133('0x4e')],_[_0x9133('0x48')](_0x2576c8['body'],[_0x9133('0x4e'),'id'])||{});}})[_0x9133('0x3b')](respondWithResult(_0x22611b,null))[_0x9133('0x40')](handleError(_0x22611b,null));};exports[_0x9133('0x4f')]=function(_0x406861,_0x4e0afe,_0x5bdb85){var _0x5a2522={};var _0x7e0f3c={};var _0x1ea18c;var _0x3d7a07;return db['Automation'][_0x9133('0x4a')]({'where':{'id':_0x406861[_0x9133('0x41')]['id']}})[_0x9133('0x3b')](handleEntityNotFound(_0x4e0afe,null))[_0x9133('0x3b')](function(_0x3c8abf){if(_0x3c8abf){_0x1ea18c=_0x3c8abf;_0x7e0f3c[_0x9133('0x26')]=_[_0x9133('0x27')](db[_0x9133('0x4d')]['rawAttributes']);_0x7e0f3c[_0x9133('0x29')]=_[_0x9133('0x27')](_0x406861['query']);_0x7e0f3c[_0x9133('0x33')]=_['intersection'](_0x7e0f3c[_0x9133('0x26')],_0x7e0f3c[_0x9133('0x29')]);_0x5a2522[_0x9133('0x2c')]=_[_0x9133('0x2b')](_0x7e0f3c[_0x9133('0x26')],qs['fields'](_0x406861[_0x9133('0x29')][_0x9133('0x2d')]));_0x5a2522[_0x9133('0x2c')]=_0x5a2522[_0x9133('0x2c')]['length']?_0x5a2522[_0x9133('0x2c')]:_0x7e0f3c[_0x9133('0x26')];_0x5a2522[_0x9133('0x30')]=qs[_0x9133('0x31')](_0x406861[_0x9133('0x29')][_0x9133('0x31')]);_0x5a2522[_0x9133('0x32')]=qs[_0x9133('0x33')](_[_0x9133('0x34')](_0x406861[_0x9133('0x29')],_0x7e0f3c[_0x9133('0x33')]));if(_0x406861['query'][_0x9133('0x38')]){_0x5a2522[_0x9133('0x32')]=_[_0x9133('0x37')](_0x5a2522[_0x9133('0x32')],{'$or':_['map'](_0x5a2522[_0x9133('0x2c')],function(_0x4eebb2){var _0x14df1b={};_0x14df1b[_0x4eebb2]={'$like':'%'+_0x406861[_0x9133('0x29')][_0x9133('0x38')]+'%'};return _0x14df1b;})});}_0x5a2522=_['merge']({},_0x5a2522,_0x406861[_0x9133('0x3a')]);return _0x1ea18c[_0x9133('0x4f')](_0x5a2522);}})[_0x9133('0x3b')](function(_0x52d940){if(_0x52d940){_0x3d7a07=_0x52d940[_0x9133('0x2e')];if(!_0x406861[_0x9133('0x29')]['hasOwnProperty'](_0x9133('0x4b'))){_0x5a2522[_0x9133('0x1c')]=qs[_0x9133('0x1c')](_0x406861['query'][_0x9133('0x1c')]);_0x5a2522['offset']=qs[_0x9133('0x1b')](_0x406861[_0x9133('0x29')][_0x9133('0x1b')]);}return _0x1ea18c['getActions'](_0x5a2522);}})[_0x9133('0x3b')](function(_0x54f9ad){if(_0x54f9ad){return _0x54f9ad?{'count':_0x3d7a07,'rows':_0x54f9ad}:null;}})[_0x9133('0x3b')](respondWithResult(_0x4e0afe,null))[_0x9133('0x40')](handleError(_0x4e0afe,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index dbd1814..0504308 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 _0x3468=['tools_automations','lodash','util','../../config/logger','api','bluebird','./automation.attributes','exports'];(function(_0x3c1314,_0x3ca8cb){var _0x13ad3a=function(_0x9d5025){while(--_0x9d5025){_0x3c1314['push'](_0x3c1314['shift']());}};_0x13ad3a(++_0x3ca8cb);}(_0x3468,0x141));var _0x8346=function(_0x5d8867,_0x392c42){_0x5d8867=_0x5d8867-0x0;var _0x13417e=_0x3468[_0x5d8867];return _0x13417e;};'use strict';var _=require(_0x8346('0x0'));var util=require(_0x8346('0x1'));var logger=require(_0x8346('0x2'))(_0x8346('0x3'));var moment=require('moment');var BPromise=require(_0x8346('0x4'));var rp=require('request-promise');var attributes=require(_0x8346('0x5'));module[_0x8346('0x6')]=function(_0x4f1f43,_0x24aa4b){return _0x4f1f43['define']('Automation',attributes,{'tableName':_0x8346('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f7c=['exports','define','Automation','tools_automations','lodash','../../config/logger','moment','bluebird','request-promise','./automation.attributes'];(function(_0x2490ad,_0x33836e){var _0x38262d=function(_0x159a42){while(--_0x159a42){_0x2490ad['push'](_0x2490ad['shift']());}};_0x38262d(++_0x33836e);}(_0x4f7c,0x72));var _0xc4f7=function(_0x1e3c64,_0x143633){_0x1e3c64=_0x1e3c64-0x0;var _0x55f084=_0x4f7c[_0x1e3c64];return _0x55f084;};'use strict';var _=require(_0xc4f7('0x0'));var util=require('util');var logger=require(_0xc4f7('0x1'))('api');var moment=require(_0xc4f7('0x2'));var BPromise=require(_0xc4f7('0x3'));var rp=require(_0xc4f7('0x4'));var attributes=require(_0xc4f7('0x5'));module[_0xc4f7('0x6')]=function(_0x15cd0c,_0x5c1684){return _0x15cd0c[_0xc4f7('0x7')](_0xc4f7('0x8'),attributes,{'tableName':_0xc4f7('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 8de7896..f1ce79f 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 _0xfa0b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x28fb5e,_0x5d07e8){var _0x5115d3=function(_0x22fd80){while(--_0x22fd80){_0x28fb5e['push'](_0x28fb5e['shift']());}};_0x5115d3(++_0x5d07e8);}(_0xfa0b,0x1cc));var _0xbfa0=function(_0x7b7f5f,_0x2d472b){_0x7b7f5f=_0x7b7f5f-0x0;var _0x35e97f=_0xfa0b[_0x7b7f5f];return _0x35e97f;};'use strict';var _=require(_0xbfa0('0x0'));var util=require('util');var moment=require(_0xbfa0('0x1'));var BPromise=require(_0xbfa0('0x2'));var rs=require(_0xbfa0('0x3'));var fs=require('fs');var Redis=require(_0xbfa0('0x4'));var db=require(_0xbfa0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfa0('0x6'))(_0xbfa0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbfa0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd0673d,_0x49b755,_0x361450){return new BPromise(function(_0x4c4464,_0x5195e9){return client[_0xbfa0('0x9')](_0xd0673d,_0x361450)[_0xbfa0('0xa')](function(_0x3fcd92){logger[_0xbfa0('0xb')](_0xbfa0('0xc'),_0x49b755,'request\x20sent');logger[_0xbfa0('0xd')](_0xbfa0('0xe'),_0x49b755,_0xbfa0('0xf'),JSON[_0xbfa0('0x10')](_0x3fcd92));if(_0x3fcd92['error']){if(_0x3fcd92[_0xbfa0('0x11')][_0xbfa0('0x12')]===0x1f4){logger[_0xbfa0('0x11')](_0xbfa0('0xc'),_0x49b755,_0x3fcd92[_0xbfa0('0x11')][_0xbfa0('0x13')]);return _0x5195e9(_0x3fcd92[_0xbfa0('0x11')]['message']);}logger[_0xbfa0('0x11')]('Automation,\x20%s,\x20%s',_0x49b755,_0x3fcd92[_0xbfa0('0x11')][_0xbfa0('0x13')]);return _0x4c4464(_0x3fcd92[_0xbfa0('0x11')][_0xbfa0('0x13')]);}else{logger['info'](_0xbfa0('0xc'),_0x49b755,_0xbfa0('0xf'));_0x4c4464(_0x3fcd92[_0xbfa0('0x14')][_0xbfa0('0x13')]);}})[_0xbfa0('0x15')](function(_0x1fc2b2){logger[_0xbfa0('0x11')](_0xbfa0('0xc'),_0x49b755,_0x1fc2b2);_0x5195e9(_0x1fc2b2);});});} \ No newline at end of file +var _0xebae=['info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xebae,0x83));var _0xeeba=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0xebae[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0xeeba('0x0'));var util=require(_0xeeba('0x1'));var moment=require(_0xeeba('0x2'));var BPromise=require(_0xeeba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeeba('0x4'))['db'];var utils=require(_0xeeba('0x5'));var logger=require(_0xeeba('0x6'))(_0xeeba('0x7'));var config=require(_0xeeba('0x8'));var jayson=require(_0xeeba('0x9'));var client=jayson[_0xeeba('0xa')][_0xeeba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x372a41,_0x42d440,_0x1e155b){return new BPromise(function(_0x121cb8,_0x4374a5){return client['request'](_0x372a41,_0x1e155b)[_0xeeba('0xc')](function(_0x9af1e6){logger[_0xeeba('0xd')](_0xeeba('0xe'),_0x42d440,_0xeeba('0xf'));logger[_0xeeba('0x10')](_0xeeba('0x11'),_0x42d440,_0xeeba('0xf'),JSON[_0xeeba('0x12')](_0x9af1e6));if(_0x9af1e6[_0xeeba('0x13')]){if(_0x9af1e6['error'][_0xeeba('0x14')]===0x1f4){logger['error'](_0xeeba('0xe'),_0x42d440,_0x9af1e6[_0xeeba('0x13')][_0xeeba('0x15')]);return _0x4374a5(_0x9af1e6['error'][_0xeeba('0x15')]);}logger[_0xeeba('0x13')]('Automation,\x20%s,\x20%s',_0x42d440,_0x9af1e6[_0xeeba('0x13')][_0xeeba('0x15')]);return _0x121cb8(_0x9af1e6[_0xeeba('0x13')][_0xeeba('0x15')]);}else{logger['info'](_0xeeba('0xe'),_0x42d440,'request\x20sent');_0x121cb8(_0x9af1e6[_0xeeba('0x16')][_0xeeba('0x15')]);}})[_0xeeba('0x17')](function(_0x5868c1){logger[_0xeeba('0x13')]('Automation,\x20%s,\x20%s',_0x42d440,_0x5868c1);_0x4374a5(_0x5868c1);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0b351e1..88e3062 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 _0x9dc9=['show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','addActions','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./automation.controller','get','isAuthenticated','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9dc9,0x121));var _0x99dc=function(_0x2932e0,_0x470af0){_0x2932e0=_0x2932e0-0x0;var _0x17eef7=_0x9dc9[_0x2932e0];return _0x17eef7;};'use strict';var multer=require(_0x99dc('0x0'));var util=require(_0x99dc('0x1'));var path=require(_0x99dc('0x2'));var timeout=require(_0x99dc('0x3'));var express=require(_0x99dc('0x4'));var router=express[_0x99dc('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x99dc('0x6'));var controller=require(_0x99dc('0x7'));router[_0x99dc('0x8')]('/',auth[_0x99dc('0x9')](),controller[_0x99dc('0xa')]);router[_0x99dc('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x99dc('0xb')]);router[_0x99dc('0x8')](_0x99dc('0xc'),auth['isAuthenticated'](),controller[_0x99dc('0xd')]);router[_0x99dc('0x8')](_0x99dc('0xe'),auth[_0x99dc('0x9')](),controller[_0x99dc('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x99dc('0x10')]);router[_0x99dc('0x11')](_0x99dc('0xc'),auth['isAuthenticated'](),controller[_0x99dc('0x12')]);router[_0x99dc('0x11')](_0x99dc('0xe'),auth[_0x99dc('0x9')](),controller[_0x99dc('0x13')]);router[_0x99dc('0x14')](_0x99dc('0x15'),auth[_0x99dc('0x9')](),controller['update']);router[_0x99dc('0x16')](_0x99dc('0x15'),auth['isAuthenticated'](),controller[_0x99dc('0x17')]);module[_0x99dc('0x18')]=router; \ No newline at end of file +var _0x5204=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','put','update','delete','destroy','exports','multer','util'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5204,0xdf));var _0x4520=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x5204[_0xfd495c];return _0x561dd8;};'use strict';var multer=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var path=require('path');var timeout=require(_0x4520('0x2'));var express=require(_0x4520('0x3'));var router=express[_0x4520('0x4')]();var auth=require(_0x4520('0x5'));var interaction=require(_0x4520('0x6'));var config=require('../../config/environment');var controller=require(_0x4520('0x7'));router['get']('/',auth[_0x4520('0x8')](),controller[_0x4520('0x9')]);router[_0x4520('0xa')](_0x4520('0xb'),auth[_0x4520('0x8')](),controller[_0x4520('0xc')]);router[_0x4520('0xa')]('/:id/conditions',auth[_0x4520('0x8')](),controller['getConditions']);router[_0x4520('0xa')](_0x4520('0xd'),auth[_0x4520('0x8')](),controller[_0x4520('0xe')]);router[_0x4520('0xf')]('/',auth[_0x4520('0x8')](),controller[_0x4520('0x10')]);router[_0x4520('0xf')](_0x4520('0x11'),auth[_0x4520('0x8')](),controller[_0x4520('0x12')]);router[_0x4520('0xf')](_0x4520('0xd'),auth[_0x4520('0x8')](),controller[_0x4520('0x13')]);router[_0x4520('0x14')](_0x4520('0xb'),auth[_0x4520('0x8')](),controller[_0x4520('0x15')]);router[_0x4520('0x16')](_0x4520('0xb'),auth['isAuthenticated'](),controller[_0x4520('0x17')]);module[_0x4520('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index a7d152c..56b661e 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 _0x00b4=['07:00-22:00,*,*,*','ENUM','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','STRING','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'];(function(_0x299b68,_0x5077e5){var _0x154637=function(_0x560d4e){while(--_0x560d4e){_0x299b68['push'](_0x299b68['shift']());}};_0x154637(++_0x5077e5);}(_0x00b4,0x179));var _0x400b=function(_0x12f505,_0x2d8028){_0x12f505=_0x12f505-0x0;var _0x239c6a=_0x00b4[_0x12f505];return _0x239c6a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x400b('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x400b('0x1')),'allowNull':![],'defaultValue':_0x400b('0x1')},'description':{'type':Sequelize[_0x400b('0x0')]},'active':{'type':Sequelize[_0x400b('0x2')],'defaultValue':0x0,'comment':_0x400b('0x3')},'limitCalls':{'type':Sequelize[_0x400b('0x4')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x400b('0x5')},'dialOriginateCallerIdName':{'type':Sequelize[_0x400b('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x400b('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0x400b('0x4')](0x3)[_0x400b('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x400b('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x400b('0x4')](0x3)[_0x400b('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x400b('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x400b('0x4')](0x3)[_0x400b('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x400b('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x400b('0x4')](0x5)[_0x400b('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x400b('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x400b('0x4')](0x3)[_0x400b('0x6')],'defaultValue':0x3,'comment':_0x400b('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x400b('0x4')](0x5)[_0x400b('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x400b('0x4')](0x3)[_0x400b('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x400b('0xc')},'dialTimezone':{'type':Sequelize[_0x400b('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x400b('0x0')],'defaultValue':_0x400b('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x400b('0xe')]('always',_0x400b('0xf'),_0x400b('0x10')),'defaultValue':_0x400b('0x11')},'dialAMDActive':{'type':Sequelize[_0x400b('0x2')],'defaultValue':0x0,'comment':_0x400b('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x400b('0x4')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x400b('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x400b('0x4')](0x9)[_0x400b('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x400b('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x400b('0x4')](0x9)[_0x400b('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x400b('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x400b('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x400b('0x4')](0x9)[_0x400b('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x400b('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x400b('0x4')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x400b('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x400b('0x4')](0x9)[_0x400b('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x400b('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x400b('0x4')](0x5)[_0x400b('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x400b('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x400b('0x4')](0x9)[_0x400b('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x400b('0x1a'),_0x400b('0x1b')),'defaultValue':_0x400b('0x1a')},'dialPrefix':{'type':Sequelize[_0x400b('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x400b('0x4')](0x3)[_0x400b('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x400b('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x400b('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x400b('0x1d')}}; \ No newline at end of file +var _0xe1e4=['UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','ENUM','ivr','STRING','BOOLEAN'];(function(_0x18553b,_0x51c8d8){var _0x429d8c=function(_0x2c6012){while(--_0x2c6012){_0x18553b['push'](_0x18553b['shift']());}};_0x429d8c(++_0x51c8d8);}(_0xe1e4,0x157));var _0x4e1e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe1e4[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x4e1e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4e1e('0x1')](_0x4e1e('0x2')),'allowNull':![],'defaultValue':_0x4e1e('0x2')},'description':{'type':Sequelize[_0x4e1e('0x3')]},'active':{'type':Sequelize[_0x4e1e('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x4e1e('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4e1e('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4e1e('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x4e1e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4e1e('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4e1e('0x7')](0x5)[_0x4e1e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4e1e('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x4e1e('0x7')](0x3)[_0x4e1e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4e1e('0xa')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4e1e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4e1e('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4e1e('0x7')](0x3)[_0x4e1e('0x5')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4e1e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4e1e('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4e1e('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4e1e('0xd')},'dialTimezone':{'type':Sequelize[_0x4e1e('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x4e1e('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x4e1e('0x1')](_0x4e1e('0xf'),_0x4e1e('0x10'),_0x4e1e('0x11')),'defaultValue':_0x4e1e('0xf')},'dialAMDActive':{'type':Sequelize[_0x4e1e('0x4')],'defaultValue':0x0,'comment':_0x4e1e('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x4e1e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4e1e('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x4e1e('0x7')](0x9)[_0x4e1e('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4e1e('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4e1e('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4e1e('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4e1e('0x7')](0x9)[_0x4e1e('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4e1e('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x4e1e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4e1e('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4e1e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4e1e('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4e1e('0x7')](0x9)[_0x4e1e('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4e1e('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4e1e('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4e1e('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4e1e('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4e1e('0x1')](_0x4e1e('0x1b'),'ASC'),'defaultValue':_0x4e1e('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4e1e('0x7')](0x3)[_0x4e1e('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4e1e('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4e1e('0x1c')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 6ff6eb4..ff92509 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 _0x4ddf=['CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','CampaignId\x20=\x20?','ListId\x20=\x20?','insert','all','removeLists','getBlackLists','addBlackLists','push','sequelize','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','Campaign','rawAttributes','model','keys','dateStart','query','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','options','include','rows','catch','show','params','filters','find','create','body','role','userProfileId','autoAssociation','clone','includeAll','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','nolimit','CampaignId','findAll','getHopperHistories'];(function(_0x4f3f70,_0x4c38d3){var _0x1b3760=function(_0x1441b2){while(--_0x1441b2){_0x4f3f70['push'](_0x4f3f70['shift']());}};_0x1b3760(++_0x4c38d3);}(_0x4ddf,0x1b1));var _0xf4dd=function(_0x3d14ff,_0x3b7cb2){_0x3d14ff=_0x3d14ff-0x0;var _0x232035=_0x4ddf[_0x3d14ff];return _0x232035;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf4dd('0x0'));var zipdir=require(_0xf4dd('0x1'));var jsonpatch=require(_0xf4dd('0x2'));var rp=require(_0xf4dd('0x3'));var moment=require(_0xf4dd('0x4'));var BPromise=require(_0xf4dd('0x5'));var Mustache=require(_0xf4dd('0x6'));var util=require(_0xf4dd('0x7'));var path=require(_0xf4dd('0x8'));var sox=require('sox');var csv=require(_0xf4dd('0x9'));var ejs=require(_0xf4dd('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf4dd('0xb'));var jsforce=require(_0xf4dd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf4dd('0x9'));var querystring=require(_0xf4dd('0xd'));var Papa=require(_0xf4dd('0xe'));var Redis=require(_0xf4dd('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xf4dd('0x10'))(_0xf4dd('0x11'));var utils=require(_0xf4dd('0x12'));var config=require('../../config/environment');var db=require(_0xf4dd('0x13'))['db'];function respondWithStatusCode(_0xf24f02,_0x1cce5d){_0x1cce5d=_0x1cce5d||0xcc;return function(_0x1bca6f){if(_0x1bca6f){return _0xf24f02[_0xf4dd('0x14')](_0x1cce5d);}return _0xf24f02[_0xf4dd('0x15')](_0x1cce5d)[_0xf4dd('0x16')]();};}function respondWithResult(_0x326469,_0x33cd81){_0x33cd81=_0x33cd81||0xc8;return function(_0x1d9ff9){if(_0x1d9ff9){return _0x326469['status'](_0x33cd81)[_0xf4dd('0x17')](_0x1d9ff9);}};}function respondWithFilteredResult(_0x4d96d7,_0x3dc457){return function(_0x3cfa2b){if(_0x3cfa2b){var _0x489e98=_0x3cfa2b[_0xf4dd('0x18')],_0x3e046b=_0x3dc457[_0xf4dd('0x19')],_0xba1f40=_0x3dc457['offset']+_0x3dc457['limit'],_0x2522d4;if(_0xba1f40>=_0x489e98){_0xba1f40=_0x489e98;_0x2522d4=0xc8;}else{_0x2522d4=0xce;}_0x4d96d7[_0xf4dd('0x15')](_0x2522d4);return _0x4d96d7[_0xf4dd('0x1a')](_0xf4dd('0x1b'),_0x3e046b+'-'+_0xba1f40+'/'+_0x489e98)['json'](_0x3cfa2b);}return null;};}function patchUpdates(_0x3485f7){return function(_0x11c148){try{jsonpatch[_0xf4dd('0x1c')](_0x11c148,_0x3485f7,!![]);}catch(_0x2a75d7){return BPromise['reject'](_0x2a75d7);}return _0x11c148[_0xf4dd('0x1d')]();};}function saveUpdates(_0x313b3f,_0x39ebdf){return function(_0x1bde9a){if(_0x1bde9a){return _0x1bde9a[_0xf4dd('0x1e')](_0x313b3f)[_0xf4dd('0x1f')](function(_0x81955c){return _0x81955c;});}return null;};}function removeEntity(_0x4b45bc,_0x45f409){return function(_0x601650){if(_0x601650){return _0x601650[_0xf4dd('0x20')]()[_0xf4dd('0x1f')](function(){var _0x417072=_0x601650[_0xf4dd('0x21')]({'plain':!![]});var _0x209d2f=_0xf4dd('0x22');return db[_0xf4dd('0x23')][_0xf4dd('0x20')]({'where':{'type':_0x209d2f,'resourceId':_0x417072['id']}})[_0xf4dd('0x1f')](function(){return _0x601650;});})[_0xf4dd('0x1f')](function(){_0x4b45bc[_0xf4dd('0x15')](0xcc)[_0xf4dd('0x16')]();});}};}function handleEntityNotFound(_0x474fe8,_0x2160f4){return function(_0x42aa3a){if(!_0x42aa3a){_0x474fe8[_0xf4dd('0x14')](0x194);}return _0x42aa3a;};}function handleError(_0x8c8691,_0x1fdbe2){_0x1fdbe2=_0x1fdbe2||0x1f4;return function(_0x127571){logger[_0xf4dd('0x24')](_0x127571[_0xf4dd('0x25')]);if(_0x127571[_0xf4dd('0x26')]){delete _0x127571[_0xf4dd('0x26')];}_0x8c8691[_0xf4dd('0x15')](_0x1fdbe2)[_0xf4dd('0x27')](_0x127571);};}exports[_0xf4dd('0x28')]=function(_0x28bd94,_0x2bceda){var _0x211ab9={},_0x338331={},_0x49a68c={'count':0x0,'rows':[]};var _0x218ca9=db[_0xf4dd('0x29')][_0xf4dd('0x2a')];_0x338331[_0xf4dd('0x2b')]=_[_0xf4dd('0x2c')](_0x218ca9);var _0x4bb6de={'dateStart':_0x28bd94['query'][_0xf4dd('0x2d')],'dateEnd':_0x28bd94['query']['dateEnd']};delete _0x28bd94[_0xf4dd('0x2e')]['dateStart'];delete _0x28bd94[_0xf4dd('0x2e')]['dateEnd'];_0x338331['query']=_[_0xf4dd('0x2c')](_0x28bd94[_0xf4dd('0x2e')]);_0x338331['filters']=_['intersection'](_0x338331['model'],_0x338331[_0xf4dd('0x2e')]);_0x211ab9[_0xf4dd('0x2f')]=_[_0xf4dd('0x30')](_0x338331['model'],qs[_0xf4dd('0x31')](_0x28bd94[_0xf4dd('0x2e')][_0xf4dd('0x31')]));_0x211ab9['attributes']=_0x211ab9[_0xf4dd('0x2f')][_0xf4dd('0x32')]?_0x211ab9[_0xf4dd('0x2f')]:_0x338331[_0xf4dd('0x2b')];if(!_0x28bd94[_0xf4dd('0x2e')][_0xf4dd('0x33')]('nolimit')){_0x211ab9[_0xf4dd('0x34')]=qs[_0xf4dd('0x34')](_0x28bd94[_0xf4dd('0x2e')][_0xf4dd('0x34')]);_0x211ab9[_0xf4dd('0x19')]=qs[_0xf4dd('0x19')](_0x28bd94['query'][_0xf4dd('0x19')]);}_0x211ab9[_0xf4dd('0x35')]=qs[_0xf4dd('0x36')](_0x28bd94[_0xf4dd('0x2e')][_0xf4dd('0x36')]);_0x211ab9[_0xf4dd('0x37')]=qs['filters'](_[_0xf4dd('0x38')](_0x28bd94[_0xf4dd('0x2e')],_0x338331['filters']));if(_0x4bb6de[_0xf4dd('0x2d')]){if(_0x4bb6de[_0xf4dd('0x39')]){_0x4bb6de['dateEnd']=moment(_0x4bb6de[_0xf4dd('0x39')])[_0xf4dd('0x3a')](0x1,_0xf4dd('0x3b'));}else{_0x4bb6de['dateEnd']=moment(_0x4bb6de['dateStart'])['add'](0x1,'day');}_[_0xf4dd('0x3c')](_0x211ab9[_0xf4dd('0x37')],{'createdAt':{'$gte':_0x4bb6de['dateStart'],'$lte':_0x4bb6de['dateEnd']}});}if(_0x28bd94[_0xf4dd('0x2e')][_0xf4dd('0x3d')]){_0x211ab9[_0xf4dd('0x37')]=_[_0xf4dd('0x3c')](_0x211ab9[_0xf4dd('0x37')],{'$or':_[_0xf4dd('0x3e')](_0x211ab9[_0xf4dd('0x2f')],function(_0x1994e1){var _0x30cf81={};_0x30cf81[_0x1994e1]={'$like':'%'+_0x28bd94['query']['filter']+'%'};return _0x30cf81;})});}_0x211ab9=_[_0xf4dd('0x3c')]({},_0x211ab9,_0x28bd94[_0xf4dd('0x3f')]);var _0x22104e={'where':_0x211ab9['where']};return db[_0xf4dd('0x29')][_0xf4dd('0x18')](_0x22104e)['then'](function(_0x216bf7){_0x49a68c['count']=_0x216bf7;if(_0x28bd94[_0xf4dd('0x2e')]['includeAll']){_0x211ab9[_0xf4dd('0x40')]=[{'all':!![]}];}return db[_0xf4dd('0x29')]['findAll'](_0x211ab9);})['then'](function(_0x22ba96){_0x49a68c[_0xf4dd('0x41')]=_0x22ba96;return _0x49a68c;})[_0xf4dd('0x1f')](respondWithFilteredResult(_0x2bceda,_0x211ab9))[_0xf4dd('0x42')](handleError(_0x2bceda,null));};exports[_0xf4dd('0x43')]=function(_0x20b0c0,_0x3c8a3b){var _0x3adafc={'raw':![],'where':{'id':_0x20b0c0[_0xf4dd('0x44')]['id']}},_0x401e21={};_0x401e21[_0xf4dd('0x2b')]=_[_0xf4dd('0x2c')](db[_0xf4dd('0x29')][_0xf4dd('0x2a')]);_0x401e21[_0xf4dd('0x2e')]=_['keys'](_0x20b0c0[_0xf4dd('0x2e')]);_0x401e21[_0xf4dd('0x45')]=_[_0xf4dd('0x30')](_0x401e21[_0xf4dd('0x2b')],_0x401e21[_0xf4dd('0x2e')]);_0x3adafc[_0xf4dd('0x2f')]=_['intersection'](_0x401e21[_0xf4dd('0x2b')],qs[_0xf4dd('0x31')](_0x20b0c0[_0xf4dd('0x2e')][_0xf4dd('0x31')]));_0x3adafc[_0xf4dd('0x2f')]=_0x3adafc[_0xf4dd('0x2f')][_0xf4dd('0x32')]?_0x3adafc[_0xf4dd('0x2f')]:_0x401e21[_0xf4dd('0x2b')];if(_0x20b0c0[_0xf4dd('0x2e')]['includeAll']){_0x3adafc[_0xf4dd('0x40')]=[{'all':!![]}];}_0x3adafc=_[_0xf4dd('0x3c')]({},_0x3adafc,_0x20b0c0[_0xf4dd('0x3f')]);return db[_0xf4dd('0x29')][_0xf4dd('0x46')](_0x3adafc)['then'](handleEntityNotFound(_0x3c8a3b,null))[_0xf4dd('0x1f')](respondWithResult(_0x3c8a3b,null))[_0xf4dd('0x42')](handleError(_0x3c8a3b,null));};exports['create']=function(_0x17a2c7,_0x1c2694){return db[_0xf4dd('0x29')][_0xf4dd('0x47')](_0x17a2c7[_0xf4dd('0x48')],{})[_0xf4dd('0x1f')](function(_0x5dfd59){var _0x4b2a12=_0x17a2c7['user'][_0xf4dd('0x21')]({'plain':!![]});if(!_0x4b2a12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2a12[_0xf4dd('0x49')]==='user'){var _0x2c7658=_0x5dfd59[_0xf4dd('0x21')]({'plain':!![]});var _0x2b58c4=_0xf4dd('0x22');return db['UserProfileSection'][_0xf4dd('0x46')]({'where':{'name':_0x2b58c4,'userProfileId':_0x4b2a12[_0xf4dd('0x4a')]},'raw':!![]})[_0xf4dd('0x1f')](function(_0x465a58){if(_0x465a58&&_0x465a58[_0xf4dd('0x4b')]===0x0){return db[_0xf4dd('0x23')][_0xf4dd('0x47')]({'name':_0x2c7658['name'],'resourceId':_0x2c7658['id'],'type':_0x465a58[_0xf4dd('0x26')],'sectionId':_0x465a58['id']},{})['then'](function(){return _0x5dfd59;});}else{return _0x5dfd59;}})[_0xf4dd('0x42')](function(_0x1dcec7){logger[_0xf4dd('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dcec7);throw _0x1dcec7;});}return _0x5dfd59;})[_0xf4dd('0x1f')](respondWithResult(_0x1c2694,0xc9))[_0xf4dd('0x42')](handleError(_0x1c2694,null));};exports[_0xf4dd('0x4c')]=function(_0x122257,_0x128ff4){var _0x58b131={'raw':![],'where':{'id':_0x122257[_0xf4dd('0x44')]['id']}},_0x46e61e={};_0x46e61e[_0xf4dd('0x2b')]=_[_0xf4dd('0x2c')](db[_0xf4dd('0x29')][_0xf4dd('0x2a')]);_0x58b131['attributes']=_[_0xf4dd('0x30')](_0x46e61e[_0xf4dd('0x2b')],qs[_0xf4dd('0x31')](_0x122257[_0xf4dd('0x2e')][_0xf4dd('0x31')]));_0x58b131[_0xf4dd('0x2f')]=_0x58b131[_0xf4dd('0x2f')][_0xf4dd('0x32')]?_0x58b131[_0xf4dd('0x2f')]:_0x46e61e[_0xf4dd('0x2b')];if(_0x122257[_0xf4dd('0x2e')][_0xf4dd('0x4d')]){_0x58b131[_0xf4dd('0x40')]=[{'all':!![]}];}_0x58b131=_[_0xf4dd('0x3c')]({},_0x58b131,_0x122257[_0xf4dd('0x3f')]);return db[_0xf4dd('0x29')][_0xf4dd('0x46')](_0x58b131)[_0xf4dd('0x1f')](handleEntityNotFound(_0x128ff4,null))[_0xf4dd('0x1f')](function(_0x19a901){if(_0x19a901){var _0x2c38c8=_0x19a901['get']({'plain':!![]});_0x2c38c8=qs[_0xf4dd('0x4e')](_0x2c38c8,['id','createdAt','updatedAt']);_0x122257[_0xf4dd('0x48')]=_[_0xf4dd('0x4e')](_0x122257[_0xf4dd('0x48')],['id',_0xf4dd('0x4f'),_0xf4dd('0x50')]);return db[_0xf4dd('0x29')][_0xf4dd('0x47')](_['merge'](_0x2c38c8,_0x122257[_0xf4dd('0x48')]),{'include':_0x122257[_0xf4dd('0x2e')][_0xf4dd('0x4d')]?[{'all':!![]}]:undefined})[_0xf4dd('0x1f')](function(_0x21c077){var _0x5bb56d=_0x122257['user'][_0xf4dd('0x21')]({'plain':!![]});if(!_0x5bb56d)throw new Error(_0xf4dd('0x51'));if(_0x5bb56d[_0xf4dd('0x49')]===_0xf4dd('0x52')){var _0x1b3d67=_0x21c077[_0xf4dd('0x21')]({'plain':!![]});var _0x1c514c=_0xf4dd('0x22');return db[_0xf4dd('0x53')][_0xf4dd('0x46')]({'where':{'name':_0x1c514c,'userProfileId':_0x5bb56d[_0xf4dd('0x4a')]},'raw':!![]})[_0xf4dd('0x1f')](function(_0x5623df){if(_0x5623df&&_0x5623df[_0xf4dd('0x4b')]===0x0){return db['UserProfileResource'][_0xf4dd('0x47')]({'name':_0x1b3d67[_0xf4dd('0x26')],'resourceId':_0x1b3d67['id'],'type':_0x5623df['name'],'sectionId':_0x5623df['id']},{})[_0xf4dd('0x1f')](function(){return _0x21c077;});}else{return _0x21c077;}})[_0xf4dd('0x42')](function(_0x2ee671){logger[_0xf4dd('0x24')](_0xf4dd('0x54'),_0x2ee671);throw _0x2ee671;});}return _0x21c077;});}})['then'](respondWithResult(_0x128ff4,0xc9))[_0xf4dd('0x42')](handleError(_0x128ff4,null));};exports['update']=function(_0x5e7a3,_0x59118c){if(_0x5e7a3[_0xf4dd('0x48')]['id']){delete _0x5e7a3[_0xf4dd('0x48')]['id'];}return db[_0xf4dd('0x29')][_0xf4dd('0x46')]({'where':{'id':_0x5e7a3[_0xf4dd('0x44')]['id']}})[_0xf4dd('0x1f')](handleEntityNotFound(_0x59118c,null))['then'](saveUpdates(_0x5e7a3['body'],null))[_0xf4dd('0x1f')](respondWithResult(_0x59118c,null))[_0xf4dd('0x42')](handleError(_0x59118c,null));};exports[_0xf4dd('0x20')]=function(_0x24a52b,_0x39b622){return db[_0xf4dd('0x29')]['find']({'where':{'id':_0x24a52b['params']['id']}})[_0xf4dd('0x1f')](handleEntityNotFound(_0x39b622,null))[_0xf4dd('0x1f')](removeEntity(_0x39b622,null))[_0xf4dd('0x42')](handleError(_0x39b622,null));};exports['getHoppers']=function(_0x3edc29,_0x375aa4,_0x134558){var _0x211a63={'raw':!![],'where':{}};var _0x3feb22={};var _0x48ead5={'count':0x0,'rows':[]};return db[_0xf4dd('0x29')][_0xf4dd('0x55')]({'where':{'id':_0x3edc29[_0xf4dd('0x44')]['id']}})[_0xf4dd('0x1f')](handleEntityNotFound(_0x375aa4,null))['then'](function(_0x47f1e2){if(_0x47f1e2){_0x3feb22[_0xf4dd('0x2b')]=_['keys'](db[_0xf4dd('0x56')]['rawAttributes']);_0x3feb22['query']=_['keys'](_0x3edc29[_0xf4dd('0x2e')]);_0x3feb22[_0xf4dd('0x45')]=_[_0xf4dd('0x30')](_0x3feb22[_0xf4dd('0x2b')],_0x3feb22[_0xf4dd('0x2e')]);_0x211a63[_0xf4dd('0x2f')]=_[_0xf4dd('0x30')](_0x3feb22['model'],qs[_0xf4dd('0x31')](_0x3edc29[_0xf4dd('0x2e')]['fields']));_0x211a63['attributes']=_0x211a63[_0xf4dd('0x2f')][_0xf4dd('0x32')]?_0x211a63[_0xf4dd('0x2f')]:_0x3feb22[_0xf4dd('0x2b')];if(!_0x3edc29[_0xf4dd('0x2e')][_0xf4dd('0x33')](_0xf4dd('0x57'))){_0x211a63['limit']=qs[_0xf4dd('0x34')](_0x3edc29['query'][_0xf4dd('0x34')]);_0x211a63[_0xf4dd('0x19')]=qs['offset'](_0x3edc29[_0xf4dd('0x2e')]['offset']);}_0x211a63['order']=qs['sort'](_0x3edc29[_0xf4dd('0x2e')][_0xf4dd('0x36')]);_0x211a63[_0xf4dd('0x37')]=qs[_0xf4dd('0x45')](_[_0xf4dd('0x38')](_0x3edc29[_0xf4dd('0x2e')],_0x3feb22[_0xf4dd('0x45')]));_0x211a63[_0xf4dd('0x37')][_0xf4dd('0x58')]=_0x47f1e2['id'];if(_0x3edc29[_0xf4dd('0x2e')][_0xf4dd('0x3d')]){_0x211a63['where']=_[_0xf4dd('0x3c')](_0x211a63[_0xf4dd('0x37')],{'$or':_[_0xf4dd('0x3e')](_0x211a63[_0xf4dd('0x2f')],function(_0x36167f){var _0x4a419a={};_0x4a419a[_0x36167f]={'$like':'%'+_0x3edc29[_0xf4dd('0x2e')][_0xf4dd('0x3d')]+'%'};return _0x4a419a;})});}_0x211a63=_[_0xf4dd('0x3c')]({},_0x211a63,_0x3edc29[_0xf4dd('0x3f')]);return db[_0xf4dd('0x56')][_0xf4dd('0x18')]({'where':_0x211a63[_0xf4dd('0x37')]})['then'](function(_0x108e8c){_0x48ead5[_0xf4dd('0x18')]=_0x108e8c;if(_0x3edc29[_0xf4dd('0x2e')][_0xf4dd('0x4d')]){_0x211a63[_0xf4dd('0x40')]=[{'all':!![]}];}return db[_0xf4dd('0x56')][_0xf4dd('0x59')](_0x211a63);})['then'](function(_0x4f8056){_0x48ead5['rows']=_0x4f8056;return _0x48ead5;});}})[_0xf4dd('0x1f')](respondWithFilteredResult(_0x375aa4,_0x211a63))[_0xf4dd('0x42')](handleError(_0x375aa4,null));};exports[_0xf4dd('0x5a')]=function(_0x962650,_0x51b68a,_0x1b7f20){var _0x3aba0e={'raw':!![],'where':{}};var _0x55aa02={};var _0x36780e={'count':0x0,'rows':[]};return db[_0xf4dd('0x29')][_0xf4dd('0x55')]({'where':{'id':_0x962650[_0xf4dd('0x44')]['id']}})[_0xf4dd('0x1f')](handleEntityNotFound(_0x51b68a,null))[_0xf4dd('0x1f')](function(_0x1c7c69){if(_0x1c7c69){_0x55aa02['model']=_['keys'](db[_0xf4dd('0x5b')][_0xf4dd('0x2a')]);_0x55aa02['query']=_['keys'](_0x962650[_0xf4dd('0x2e')]);_0x55aa02[_0xf4dd('0x45')]=_['intersection'](_0x55aa02[_0xf4dd('0x2b')],_0x55aa02['query']);_0x3aba0e['attributes']=_[_0xf4dd('0x30')](_0x55aa02['model'],qs[_0xf4dd('0x31')](_0x962650[_0xf4dd('0x2e')][_0xf4dd('0x31')]));_0x3aba0e[_0xf4dd('0x2f')]=_0x3aba0e[_0xf4dd('0x2f')][_0xf4dd('0x32')]?_0x3aba0e[_0xf4dd('0x2f')]:_0x55aa02['model'];if(!_0x962650[_0xf4dd('0x2e')][_0xf4dd('0x33')]('nolimit')){_0x3aba0e[_0xf4dd('0x34')]=qs[_0xf4dd('0x34')](_0x962650[_0xf4dd('0x2e')][_0xf4dd('0x34')]);_0x3aba0e[_0xf4dd('0x19')]=qs['offset'](_0x962650[_0xf4dd('0x2e')][_0xf4dd('0x19')]);}_0x3aba0e[_0xf4dd('0x35')]=qs[_0xf4dd('0x36')](_0x962650['query'][_0xf4dd('0x36')]);_0x3aba0e[_0xf4dd('0x37')]=qs[_0xf4dd('0x45')](_['pick'](_0x962650[_0xf4dd('0x2e')],_0x55aa02['filters']));_0x3aba0e[_0xf4dd('0x37')][_0xf4dd('0x58')]=_0x1c7c69['id'];if(_0x962650['query'][_0xf4dd('0x3d')]){_0x3aba0e[_0xf4dd('0x37')]=_[_0xf4dd('0x3c')](_0x3aba0e['where'],{'$or':_[_0xf4dd('0x3e')](_0x3aba0e[_0xf4dd('0x2f')],function(_0x128615){var _0x4397a5={};_0x4397a5[_0x128615]={'$like':'%'+_0x962650[_0xf4dd('0x2e')][_0xf4dd('0x3d')]+'%'};return _0x4397a5;})});}_0x3aba0e=_[_0xf4dd('0x3c')]({},_0x3aba0e,_0x962650[_0xf4dd('0x3f')]);return db[_0xf4dd('0x5b')]['count']({'where':_0x3aba0e[_0xf4dd('0x37')]})[_0xf4dd('0x1f')](function(_0x1c0df9){_0x36780e['count']=_0x1c0df9;if(_0x962650[_0xf4dd('0x2e')]['includeAll']){_0x3aba0e[_0xf4dd('0x40')]=[{'all':!![]}];}return db[_0xf4dd('0x5b')]['findAll'](_0x3aba0e);})[_0xf4dd('0x1f')](function(_0x41bbd){_0x36780e[_0xf4dd('0x41')]=_0x41bbd;return _0x36780e;});}})[_0xf4dd('0x1f')](respondWithFilteredResult(_0x51b68a,_0x3aba0e))[_0xf4dd('0x42')](handleError(_0x51b68a,null));};exports['getHopperFinals']=function(_0x1bb7b3,_0x42269c,_0x163cad){var _0x1958d6={'raw':!![],'where':{}};var _0x3775d1={};var _0x3578f9={'count':0x0,'rows':[]};return db['Campaign'][_0xf4dd('0x55')]({'where':{'id':_0x1bb7b3[_0xf4dd('0x44')]['id']}})['then'](handleEntityNotFound(_0x42269c,null))[_0xf4dd('0x1f')](function(_0x5343d6){if(_0x5343d6){_0x3775d1['model']=_[_0xf4dd('0x2c')](db['CmHopperFinal'][_0xf4dd('0x2a')]);_0x3775d1[_0xf4dd('0x2e')]=_[_0xf4dd('0x2c')](_0x1bb7b3['query']);_0x3775d1[_0xf4dd('0x45')]=_[_0xf4dd('0x30')](_0x3775d1[_0xf4dd('0x2b')],_0x3775d1[_0xf4dd('0x2e')]);_0x1958d6['attributes']=_[_0xf4dd('0x30')](_0x3775d1['model'],qs['fields'](_0x1bb7b3[_0xf4dd('0x2e')][_0xf4dd('0x31')]));_0x1958d6[_0xf4dd('0x2f')]=_0x1958d6[_0xf4dd('0x2f')]['length']?_0x1958d6[_0xf4dd('0x2f')]:_0x3775d1['model'];if(!_0x1bb7b3[_0xf4dd('0x2e')]['hasOwnProperty'](_0xf4dd('0x57'))){_0x1958d6['limit']=qs['limit'](_0x1bb7b3[_0xf4dd('0x2e')]['limit']);_0x1958d6[_0xf4dd('0x19')]=qs[_0xf4dd('0x19')](_0x1bb7b3[_0xf4dd('0x2e')]['offset']);}_0x1958d6[_0xf4dd('0x35')]=qs['sort'](_0x1bb7b3['query'][_0xf4dd('0x36')]);_0x1958d6[_0xf4dd('0x37')]=qs['filters'](_['pick'](_0x1bb7b3[_0xf4dd('0x2e')],_0x3775d1[_0xf4dd('0x45')]));_0x1958d6[_0xf4dd('0x37')][_0xf4dd('0x58')]=_0x5343d6['id'];if(_0x1bb7b3['query'][_0xf4dd('0x3d')]){_0x1958d6[_0xf4dd('0x37')]=_['merge'](_0x1958d6['where'],{'$or':_[_0xf4dd('0x3e')](_0x1958d6[_0xf4dd('0x2f')],function(_0x88bb8c){var _0x5a6a00={};_0x5a6a00[_0x88bb8c]={'$like':'%'+_0x1bb7b3[_0xf4dd('0x2e')][_0xf4dd('0x3d')]+'%'};return _0x5a6a00;})});}_0x1958d6=_[_0xf4dd('0x3c')]({},_0x1958d6,_0x1bb7b3['options']);return db['CmHopperFinal'][_0xf4dd('0x18')]({'where':_0x1958d6[_0xf4dd('0x37')]})['then'](function(_0x19e283){_0x3578f9[_0xf4dd('0x18')]=_0x19e283;if(_0x1bb7b3[_0xf4dd('0x2e')][_0xf4dd('0x4d')]){_0x1958d6['include']=[{'all':!![]}];}return db[_0xf4dd('0x5c')][_0xf4dd('0x59')](_0x1958d6);})[_0xf4dd('0x1f')](function(_0x325526){_0x3578f9[_0xf4dd('0x41')]=_0x325526;return _0x3578f9;});}})['then'](respondWithFilteredResult(_0x42269c,_0x1958d6))[_0xf4dd('0x42')](handleError(_0x42269c,null));};exports[_0xf4dd('0x5d')]=function(_0x44fca1,_0x1b61b6,_0x1088b1){var _0x5d3ef0={'raw':!![],'where':{}};var _0x46b1fd={};var _0xd6beae={'count':0x0,'rows':[]};return db['Campaign'][_0xf4dd('0x55')]({'where':{'id':_0x44fca1[_0xf4dd('0x44')]['id']}})[_0xf4dd('0x1f')](handleEntityNotFound(_0x1b61b6,null))['then'](function(_0x4a33cd){if(_0x4a33cd){_0x46b1fd[_0xf4dd('0x2b')]=_[_0xf4dd('0x2c')](db[_0xf4dd('0x5e')]['rawAttributes']);_0x46b1fd['query']=_[_0xf4dd('0x2c')](_0x44fca1[_0xf4dd('0x2e')]);_0x46b1fd[_0xf4dd('0x45')]=_['intersection'](_0x46b1fd[_0xf4dd('0x2b')],_0x46b1fd[_0xf4dd('0x2e')]);_0x5d3ef0['attributes']=_[_0xf4dd('0x30')](_0x46b1fd[_0xf4dd('0x2b')],qs[_0xf4dd('0x31')](_0x44fca1[_0xf4dd('0x2e')][_0xf4dd('0x31')]));_0x5d3ef0['attributes']=_0x5d3ef0[_0xf4dd('0x2f')][_0xf4dd('0x32')]?_0x5d3ef0[_0xf4dd('0x2f')]:_0x46b1fd[_0xf4dd('0x2b')];if(!_0x44fca1[_0xf4dd('0x2e')]['hasOwnProperty']('nolimit')){_0x5d3ef0[_0xf4dd('0x34')]=qs['limit'](_0x44fca1[_0xf4dd('0x2e')][_0xf4dd('0x34')]);_0x5d3ef0['offset']=qs[_0xf4dd('0x19')](_0x44fca1[_0xf4dd('0x2e')][_0xf4dd('0x19')]);}_0x5d3ef0['order']=qs[_0xf4dd('0x36')](_0x44fca1[_0xf4dd('0x2e')][_0xf4dd('0x36')]);_0x5d3ef0[_0xf4dd('0x37')]=qs[_0xf4dd('0x45')](_[_0xf4dd('0x38')](_0x44fca1['query'],_0x46b1fd['filters']));_0x5d3ef0[_0xf4dd('0x37')]['CampaignId']=_0x4a33cd['id'];if(_0x44fca1[_0xf4dd('0x2e')][_0xf4dd('0x3d')]){_0x5d3ef0[_0xf4dd('0x37')]=_[_0xf4dd('0x3c')](_0x5d3ef0[_0xf4dd('0x37')],{'$or':_[_0xf4dd('0x3e')](_0x5d3ef0[_0xf4dd('0x2f')],function(_0x57408e){var _0xe3f4b3={};_0xe3f4b3[_0x57408e]={'$like':'%'+_0x44fca1['query'][_0xf4dd('0x3d')]+'%'};return _0xe3f4b3;})});}_0x5d3ef0=_[_0xf4dd('0x3c')]({},_0x5d3ef0,_0x44fca1[_0xf4dd('0x3f')]);return db[_0xf4dd('0x5e')][_0xf4dd('0x18')]({'where':_0x5d3ef0[_0xf4dd('0x37')]})[_0xf4dd('0x1f')](function(_0xf46bd0){_0xd6beae[_0xf4dd('0x18')]=_0xf46bd0;if(_0x44fca1[_0xf4dd('0x2e')][_0xf4dd('0x4d')]){_0x5d3ef0['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xf4dd('0x59')](_0x5d3ef0);})[_0xf4dd('0x1f')](function(_0xc50294){_0xd6beae[_0xf4dd('0x41')]=_0xc50294;return _0xd6beae;});}})[_0xf4dd('0x1f')](respondWithFilteredResult(_0x1b61b6,_0x5d3ef0))['catch'](handleError(_0x1b61b6,null));};exports[_0xf4dd('0x5f')]=function(_0x328e3d,_0x433bad,_0x69fd0b){var _0x15480a={};var _0x1ad674={};var _0x367f5e;var _0x39295c;return db['Campaign']['findOne']({'where':{'id':_0x328e3d[_0xf4dd('0x44')]['id']}})[_0xf4dd('0x1f')](handleEntityNotFound(_0x433bad,null))[_0xf4dd('0x1f')](function(_0x41b8ed){if(_0x41b8ed){_0x367f5e=_0x41b8ed;_0x1ad674['model']=_['keys'](db[_0xf4dd('0x60')][_0xf4dd('0x2a')]);_0x1ad674[_0xf4dd('0x2e')]=_[_0xf4dd('0x2c')](_0x328e3d[_0xf4dd('0x2e')]);_0x1ad674[_0xf4dd('0x45')]=_['intersection'](_0x1ad674[_0xf4dd('0x2b')],_0x1ad674[_0xf4dd('0x2e')]);_0x15480a['attributes']=_['intersection'](_0x1ad674[_0xf4dd('0x2b')],qs[_0xf4dd('0x31')](_0x328e3d['query']['fields']));_0x15480a['attributes']=_0x15480a['attributes'][_0xf4dd('0x32')]?_0x15480a[_0xf4dd('0x2f')]:_0x1ad674[_0xf4dd('0x2b')];_0x15480a[_0xf4dd('0x35')]=qs[_0xf4dd('0x36')](_0x328e3d[_0xf4dd('0x2e')][_0xf4dd('0x36')]);_0x15480a['where']=qs[_0xf4dd('0x45')](_[_0xf4dd('0x38')](_0x328e3d[_0xf4dd('0x2e')],_0x1ad674[_0xf4dd('0x45')]));if(_0x328e3d[_0xf4dd('0x2e')][_0xf4dd('0x3d')]){_0x15480a[_0xf4dd('0x37')]=_[_0xf4dd('0x3c')](_0x15480a[_0xf4dd('0x37')],{'$or':_[_0xf4dd('0x3e')](_0x15480a[_0xf4dd('0x2f')],function(_0xb84391){var _0x85cd8b={};_0x85cd8b[_0xb84391]={'$like':'%'+_0x328e3d[_0xf4dd('0x2e')][_0xf4dd('0x3d')]+'%'};return _0x85cd8b;})});}_0x15480a=_['merge']({},_0x15480a,_0x328e3d[_0xf4dd('0x3f')]);return _0x367f5e[_0xf4dd('0x5f')](_0x15480a);}})[_0xf4dd('0x1f')](function(_0x6882a4){if(_0x6882a4){_0x39295c=_0x6882a4['length'];if(!_0x328e3d['query'][_0xf4dd('0x33')]('nolimit')){_0x15480a[_0xf4dd('0x34')]=qs[_0xf4dd('0x34')](_0x328e3d[_0xf4dd('0x2e')]['limit']);_0x15480a[_0xf4dd('0x19')]=qs[_0xf4dd('0x19')](_0x328e3d[_0xf4dd('0x2e')][_0xf4dd('0x19')]);}return _0x367f5e[_0xf4dd('0x5f')](_0x15480a);}})[_0xf4dd('0x1f')](function(_0x4a87fd){if(_0x4a87fd){return _0x4a87fd?{'count':_0x39295c,'rows':_0x4a87fd}:null;}})[_0xf4dd('0x1f')](respondWithResult(_0x433bad,null))['catch'](handleError(_0x433bad,null));};exports['addLists']=function(_0x8c8772,_0x20efff,_0x1d846d){var _0x323399,_0x23b016;return db[_0xf4dd('0x29')][_0xf4dd('0x46')]({'where':{'id':_0x8c8772['params']['id']}})['then'](handleEntityNotFound(_0x20efff,null))['then'](function(_0x12b97e){if(_0x12b97e){_0x23b016=_0x12b97e;return _0x12b97e[_0xf4dd('0x61')](_0x8c8772[_0xf4dd('0x48')][_0xf4dd('0x62')],_['omit'](_0x8c8772[_0xf4dd('0x48')],[_0xf4dd('0x62'),'id'])||{});}return null;})[_0xf4dd('0x63')](function(_0x35e87e){var _0x1f936c;_0x323399=_0x35e87e||[];var _0x3b407c=[];if(_0x35e87e){for(var _0x503651=0x0;_0x503651<_0x35e87e['length'];_0x503651+=0x1){var _0x4af519=_0x35e87e[_0x503651][_0xf4dd('0x21')]({'plain':!![]});_0x23b016['dialCheckDuplicateType']=_0x8c8772[_0xf4dd('0x48')][_0xf4dd('0x64')]?_0x8c8772[_0xf4dd('0x48')][_0xf4dd('0x64')]:_0x23b016[_0xf4dd('0x64')];switch(_0x23b016[_0xf4dd('0x64')]){case _0xf4dd('0x65'):_0x1f936c=squel['insert']()[_0xf4dd('0x66')](_0xf4dd('0x67'))[_0xf4dd('0x68')]([_0xf4dd('0x69'),_0xf4dd('0x6a'),'ContactId',_0xf4dd('0x6b'),_0xf4dd('0x58'),_0xf4dd('0x4f'),_0xf4dd('0x50')],squel[_0xf4dd('0x6c')]()[_0xf4dd('0x6d')](_0xf4dd('0x69'),_0xf4dd('0x69'))[_0xf4dd('0x6d')](_0xf4dd('0x6e'),_0xf4dd('0x6a'))[_0xf4dd('0x6d')]('id',_0xf4dd('0x6f'))[_0xf4dd('0x6d')](_0x4af519[_0xf4dd('0x70')][_0xf4dd('0x71')](),'ListId')[_0xf4dd('0x6d')](_0x8c8772[_0xf4dd('0x44')]['id'][_0xf4dd('0x71')](),'CampaignId')[_0xf4dd('0x6d')](_0xf4dd('0x6e'),_0xf4dd('0x4f'))[_0xf4dd('0x6d')](_0xf4dd('0x6e'),_0xf4dd('0x50'))[_0xf4dd('0x72')](_0xf4dd('0x73'))['where'](_0xf4dd('0x74'))[_0xf4dd('0x37')]('ListId\x20=\x20?',_0x4af519[_0xf4dd('0x70')][_0xf4dd('0x71')]())[_0xf4dd('0x37')](_0xf4dd('0x75'))[_0xf4dd('0x37')](_0xf4dd('0x76'),squel[_0xf4dd('0x6c')]()[_0xf4dd('0x6d')](_0xf4dd('0x77'))[_0xf4dd('0x72')](_0xf4dd('0x78'))[_0xf4dd('0x37')](_0xf4dd('0x79'),_0x8c8772[_0xf4dd('0x44')]['id'][_0xf4dd('0x71')]()))[_0xf4dd('0x37')](_0xf4dd('0x76'),squel[_0xf4dd('0x6c')]()[_0xf4dd('0x6d')](_0xf4dd('0x69'))[_0xf4dd('0x72')](_0xf4dd('0x67'))[_0xf4dd('0x37')](_0xf4dd('0x79'),_0x8c8772[_0xf4dd('0x44')]['id'][_0xf4dd('0x71')]())))[_0xf4dd('0x71')]();break;case'onlyIfOpen':_0x1f936c=squel['insert']()[_0xf4dd('0x66')]('cm_hopper')['fromQuery'](['phone',_0xf4dd('0x6a'),_0xf4dd('0x6f'),_0xf4dd('0x6b'),_0xf4dd('0x58'),_0xf4dd('0x4f'),_0xf4dd('0x50')],squel[_0xf4dd('0x6c')]()[_0xf4dd('0x6d')](_0xf4dd('0x69'),_0xf4dd('0x69'))[_0xf4dd('0x6d')](_0xf4dd('0x6e'),'scheduledAt')['field']('id','ContactId')['field'](_0x4af519[_0xf4dd('0x70')][_0xf4dd('0x71')](),_0xf4dd('0x6b'))[_0xf4dd('0x6d')](_0x8c8772[_0xf4dd('0x44')]['id']['toString'](),'CampaignId')['field'](_0xf4dd('0x6e'),_0xf4dd('0x4f'))[_0xf4dd('0x6d')](_0xf4dd('0x6e'),_0xf4dd('0x50'))[_0xf4dd('0x72')](_0xf4dd('0x73'))['where']('deletedAt\x20IS\x20NULL')[_0xf4dd('0x37')](_0xf4dd('0x7a'),_0x4af519[_0xf4dd('0x70')][_0xf4dd('0x71')]())[_0xf4dd('0x37')](_0xf4dd('0x75'))['where'](_0xf4dd('0x76'),squel['select']()[_0xf4dd('0x6d')](_0xf4dd('0x69'))[_0xf4dd('0x72')](_0xf4dd('0x67'))[_0xf4dd('0x37')]('CampaignId\x20=\x20?',_0x8c8772[_0xf4dd('0x44')]['id'][_0xf4dd('0x71')]())))[_0xf4dd('0x71')]();break;default:_0x1f936c=squel[_0xf4dd('0x7b')]()[_0xf4dd('0x66')]('cm_hopper')[_0xf4dd('0x68')](['phone',_0xf4dd('0x6a'),_0xf4dd('0x6f'),_0xf4dd('0x6b'),_0xf4dd('0x58'),_0xf4dd('0x4f'),_0xf4dd('0x50')],squel['select']()['field']('phone',_0xf4dd('0x69'))[_0xf4dd('0x6d')](_0xf4dd('0x6e'),_0xf4dd('0x6a'))[_0xf4dd('0x6d')]('id','ContactId')[_0xf4dd('0x6d')](_0x4af519['CmListId'][_0xf4dd('0x71')](),_0xf4dd('0x6b'))[_0xf4dd('0x6d')](_0x8c8772[_0xf4dd('0x44')]['id'][_0xf4dd('0x71')](),_0xf4dd('0x58'))['field'](_0xf4dd('0x6e'),_0xf4dd('0x4f'))[_0xf4dd('0x6d')](_0xf4dd('0x6e'),_0xf4dd('0x50'))['from'](_0xf4dd('0x73'))['where'](_0xf4dd('0x74'))[_0xf4dd('0x37')]('ListId\x20=\x20?',_0x4af519[_0xf4dd('0x70')][_0xf4dd('0x71')]())[_0xf4dd('0x37')]('phone\x20IS\x20NOT\x20NULL'))[_0xf4dd('0x71')]();}_0x3b407c['push'](db['sequelize'][_0xf4dd('0x2e')](_0x1f936c));}return BPromise[_0xf4dd('0x7c')](_0x3b407c);}})['then'](function(){return _0x323399;})[_0xf4dd('0x1f')](respondWithResult(_0x20efff,null))[_0xf4dd('0x42')](handleError(_0x20efff,null));};exports[_0xf4dd('0x7d')]=function(_0x56de06,_0x4b18c8,_0x33d380){var _0x4f7f2c;return db[_0xf4dd('0x29')][_0xf4dd('0x46')]({'where':{'id':_0x56de06[_0xf4dd('0x44')]['id']}})[_0xf4dd('0x1f')](handleEntityNotFound(_0x4b18c8,null))[_0xf4dd('0x1f')](function(_0x279f74){if(_0x279f74){return _0x279f74[_0xf4dd('0x7d')](_0x56de06[_0xf4dd('0x2e')]['ids']);}})['then'](function(_0x34c869){if(_0x34c869){_0x4f7f2c=_0x34c869;return db[_0xf4dd('0x56')]['destroy']({'where':{'ListId':_0x56de06[_0xf4dd('0x2e')][_0xf4dd('0x62')],'CampaignId':_0x56de06[_0xf4dd('0x44')]['id']}})[_0xf4dd('0x1f')](function(){return _0x4f7f2c;});}})[_0xf4dd('0x1f')](respondWithStatusCode(_0x4b18c8,null))[_0xf4dd('0x42')](handleError(_0x4b18c8,null));};exports[_0xf4dd('0x7e')]=function(_0x560ead,_0x1ec5d0,_0x5461a9){var _0x4e4c8f={'raw':!![],'where':{}};var _0x1d26cc={};var _0x261548={'count':0x0,'rows':[]};return db[_0xf4dd('0x29')][_0xf4dd('0x55')]({'where':{'id':_0x560ead[_0xf4dd('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ec5d0,null))[_0xf4dd('0x1f')](function(_0x59a286){if(_0x59a286){_0x1d26cc[_0xf4dd('0x2b')]=_[_0xf4dd('0x2c')](db[_0xf4dd('0x60')][_0xf4dd('0x2a')]);_0x1d26cc[_0xf4dd('0x2e')]=_[_0xf4dd('0x2c')](_0x560ead[_0xf4dd('0x2e')]);_0x1d26cc[_0xf4dd('0x45')]=_[_0xf4dd('0x30')](_0x1d26cc[_0xf4dd('0x2b')],_0x1d26cc[_0xf4dd('0x2e')]);_0x4e4c8f[_0xf4dd('0x2f')]=_['intersection'](_0x1d26cc[_0xf4dd('0x2b')],qs[_0xf4dd('0x31')](_0x560ead[_0xf4dd('0x2e')]['fields']));_0x4e4c8f[_0xf4dd('0x2f')]=_0x4e4c8f[_0xf4dd('0x2f')]['length']?_0x4e4c8f[_0xf4dd('0x2f')]:_0x1d26cc[_0xf4dd('0x2b')];if(!_0x560ead['query'][_0xf4dd('0x33')]('nolimit')){_0x4e4c8f[_0xf4dd('0x34')]=qs['limit'](_0x560ead[_0xf4dd('0x2e')]['limit']);_0x4e4c8f[_0xf4dd('0x19')]=qs[_0xf4dd('0x19')](_0x560ead['query'][_0xf4dd('0x19')]);}_0x4e4c8f[_0xf4dd('0x35')]=qs[_0xf4dd('0x36')](_0x560ead['query'][_0xf4dd('0x36')]);_0x4e4c8f[_0xf4dd('0x37')]=qs['filters'](_[_0xf4dd('0x38')](_0x560ead[_0xf4dd('0x2e')],_0x1d26cc[_0xf4dd('0x45')]));_0x4e4c8f['where'][_0xf4dd('0x58')]=_0x59a286['id'];if(_0x560ead[_0xf4dd('0x2e')][_0xf4dd('0x3d')]){_0x4e4c8f['where']=_[_0xf4dd('0x3c')](_0x4e4c8f['where'],{'$or':_[_0xf4dd('0x3e')](_0x4e4c8f[_0xf4dd('0x2f')],function(_0x2ec908){var _0x1890ba={};_0x1890ba[_0x2ec908]={'$like':'%'+_0x560ead['query'][_0xf4dd('0x3d')]+'%'};return _0x1890ba;})});}_0x4e4c8f=_[_0xf4dd('0x3c')]({},_0x4e4c8f,_0x560ead['options']);return db[_0xf4dd('0x60')]['count']({'where':_0x4e4c8f['where']})[_0xf4dd('0x1f')](function(_0x35ba32){_0x261548[_0xf4dd('0x18')]=_0x35ba32;if(_0x560ead['query'][_0xf4dd('0x4d')]){_0x4e4c8f['include']=[{'all':!![]}];}return db['CmList'][_0xf4dd('0x59')](_0x4e4c8f);})[_0xf4dd('0x1f')](function(_0x33d638){_0x261548[_0xf4dd('0x41')]=_0x33d638;return _0x261548;});}})[_0xf4dd('0x1f')](respondWithFilteredResult(_0x1ec5d0,_0x4e4c8f))[_0xf4dd('0x42')](handleError(_0x1ec5d0,null));};exports['addBlackLists']=function(_0x1b6bf0,_0x4dfc04,_0x38e0c7){var _0x2030ff,_0x8879ea;return db['Campaign'][_0xf4dd('0x46')]({'where':{'id':_0x1b6bf0['params']['id']}})['then'](handleEntityNotFound(_0x4dfc04,null))['then'](function(_0x32bfd3){if(_0x32bfd3){_0x8879ea=_0x32bfd3;return _0x32bfd3[_0xf4dd('0x7f')](_0x1b6bf0['body']['ids'],_[_0xf4dd('0x4e')](_0x1b6bf0['body'],['ids','id'])||{});}return null;})[_0xf4dd('0x63')](function(_0x5e4598){var _0x5bb369;_0x2030ff=_0x5e4598||[];var _0x27ce89=[];if(_0x5e4598){for(var _0x295bda=0x0;_0x295bda<_0x5e4598[_0xf4dd('0x32')];_0x295bda+=0x1){var _0x105fc2=_0x5e4598[_0x295bda][_0xf4dd('0x21')]({'plain':!![]});_0x5bb369=squel[_0xf4dd('0x7b')]()['into']('cm_hopper_black')[_0xf4dd('0x68')]([_0xf4dd('0x69'),_0xf4dd('0x6f'),_0xf4dd('0x6b'),_0xf4dd('0x58'),_0xf4dd('0x4f'),'updatedAt'],squel[_0xf4dd('0x6c')]()[_0xf4dd('0x6d')]('phone','phone')[_0xf4dd('0x6d')]('id',_0xf4dd('0x6f'))[_0xf4dd('0x6d')](_0x105fc2[_0xf4dd('0x70')][_0xf4dd('0x71')](),_0xf4dd('0x6b'))['field'](_0x1b6bf0['params']['id']['toString'](),_0xf4dd('0x58'))['field'](_0xf4dd('0x6e'),_0xf4dd('0x4f'))[_0xf4dd('0x6d')]('NOW()',_0xf4dd('0x50'))[_0xf4dd('0x72')]('cm_contacts')[_0xf4dd('0x37')](_0xf4dd('0x74'))['where'](_0xf4dd('0x7a'),_0x105fc2[_0xf4dd('0x70')][_0xf4dd('0x71')]())[_0xf4dd('0x37')](_0xf4dd('0x75')))['toString']();_0x27ce89[_0xf4dd('0x80')](db[_0xf4dd('0x81')][_0xf4dd('0x2e')](_0x5bb369));}return BPromise[_0xf4dd('0x7c')](_0x27ce89);}})[_0xf4dd('0x1f')](function(){return _0x2030ff;})['then'](respondWithResult(_0x4dfc04,null))[_0xf4dd('0x42')](handleError(_0x4dfc04,null));};exports[_0xf4dd('0x82')]=function(_0x213c12,_0x5f05d8,_0x3f81f3){var _0x482e0d;return db[_0xf4dd('0x29')][_0xf4dd('0x46')]({'where':{'id':_0x213c12['params']['id']}})[_0xf4dd('0x1f')](handleEntityNotFound(_0x5f05d8,null))[_0xf4dd('0x1f')](function(_0x59aed2){if(_0x59aed2){return _0x59aed2[_0xf4dd('0x82')](_0x213c12[_0xf4dd('0x2e')][_0xf4dd('0x62')]);}})[_0xf4dd('0x1f')](function(_0x3a608d){if(_0x3a608d){_0x482e0d=_0x3a608d;return db[_0xf4dd('0x5e')][_0xf4dd('0x20')]({'where':{'ListId':_0x213c12[_0xf4dd('0x2e')][_0xf4dd('0x62')],'CampaignId':_0x213c12[_0xf4dd('0x44')]['id']}})[_0xf4dd('0x1f')](function(){return _0x482e0d;});}})[_0xf4dd('0x1f')](respondWithStatusCode(_0x5f05d8,null))[_0xf4dd('0x42')](handleError(_0x5f05d8,null));}; \ No newline at end of file +var _0x59ed=['length','hasOwnProperty','nolimit','sort','pick','day','add','where','merge','map','options','Campaign','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','clone','omit','createdAt','updatedAt','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','CmHopper','CampaignId','filter','findOne','CmHopperHistory','order','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','insert','into','scheduledAt','phone\x20NOT\x20IN\x20(?)','sequelize','all','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','get','IvrCampaigns','error','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x59ed,0x14c));var _0xd59e=function(_0x16b672,_0x29071e){_0x16b672=_0x16b672-0x0;var _0x2d69d2=_0x59ed[_0x16b672];return _0x2d69d2;};'use strict';var pdf=require(_0xd59e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd59e('0x1'));var zipdir=require(_0xd59e('0x2'));var jsonpatch=require(_0xd59e('0x3'));var rp=require(_0xd59e('0x4'));var moment=require('moment');var BPromise=require(_0xd59e('0x5'));var Mustache=require(_0xd59e('0x6'));var util=require('util');var path=require(_0xd59e('0x7'));var sox=require(_0xd59e('0x8'));var csv=require('to-csv');var ejs=require(_0xd59e('0x9'));var fs=require('fs');var _=require(_0xd59e('0xa'));var squel=require('squel');var crypto=require(_0xd59e('0xb'));var jsforce=require(_0xd59e('0xc'));var deskjs=require(_0xd59e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd59e('0xe'));var Papa=require(_0xd59e('0xf'));var Redis=require(_0xd59e('0x10'));var qs=require(_0xd59e('0x11'));var logger=require('../../config/logger')(_0xd59e('0x12'));var utils=require('../../config/utils');var config=require(_0xd59e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3244a1,_0x3af700){_0x3af700=_0x3af700||0xcc;return function(_0x2957e2){if(_0x2957e2){return _0x3244a1[_0xd59e('0x14')](_0x3af700);}return _0x3244a1[_0xd59e('0x15')](_0x3af700)[_0xd59e('0x16')]();};}function respondWithResult(_0x2a18c5,_0x1e68eb){_0x1e68eb=_0x1e68eb||0xc8;return function(_0x4216b1){if(_0x4216b1){return _0x2a18c5[_0xd59e('0x15')](_0x1e68eb)[_0xd59e('0x17')](_0x4216b1);}};}function respondWithFilteredResult(_0x6c7cab,_0xfeb2dc){return function(_0x4b5dd2){if(_0x4b5dd2){var _0x3067c5=_0x4b5dd2[_0xd59e('0x18')],_0x2d6018=_0xfeb2dc[_0xd59e('0x19')],_0x1ce376=_0xfeb2dc[_0xd59e('0x19')]+_0xfeb2dc[_0xd59e('0x1a')],_0x464bf0;if(_0x1ce376>=_0x3067c5){_0x1ce376=_0x3067c5;_0x464bf0=0xc8;}else{_0x464bf0=0xce;}_0x6c7cab[_0xd59e('0x15')](_0x464bf0);return _0x6c7cab['set'](_0xd59e('0x1b'),_0x2d6018+'-'+_0x1ce376+'/'+_0x3067c5)[_0xd59e('0x17')](_0x4b5dd2);}return null;};}function patchUpdates(_0x40a406){return function(_0x320e10){try{jsonpatch['apply'](_0x320e10,_0x40a406,!![]);}catch(_0x59dfbb){return BPromise[_0xd59e('0x1c')](_0x59dfbb);}return _0x320e10[_0xd59e('0x1d')]();};}function saveUpdates(_0x4ddd88,_0x37d174){return function(_0x10c74f){if(_0x10c74f){return _0x10c74f[_0xd59e('0x1e')](_0x4ddd88)[_0xd59e('0x1f')](function(_0x173f52){return _0x173f52;});}return null;};}function removeEntity(_0x329975,_0x482d3e){return function(_0x5967c0){if(_0x5967c0){return _0x5967c0['destroy']()[_0xd59e('0x1f')](function(){var _0x1af3c2=_0x5967c0[_0xd59e('0x20')]({'plain':!![]});var _0x4a8d5e=_0xd59e('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x4a8d5e,'resourceId':_0x1af3c2['id']}})[_0xd59e('0x1f')](function(){return _0x5967c0;});})[_0xd59e('0x1f')](function(){_0x329975[_0xd59e('0x15')](0xcc)[_0xd59e('0x16')]();});}};}function handleEntityNotFound(_0x7565ee,_0x2d1de3){return function(_0xff6246){if(!_0xff6246){_0x7565ee[_0xd59e('0x14')](0x194);}return _0xff6246;};}function handleError(_0x4d8900,_0x25fc52){_0x25fc52=_0x25fc52||0x1f4;return function(_0x9af0bd){logger[_0xd59e('0x22')](_0x9af0bd['stack']);if(_0x9af0bd[_0xd59e('0x23')]){delete _0x9af0bd[_0xd59e('0x23')];}_0x4d8900[_0xd59e('0x15')](_0x25fc52)[_0xd59e('0x24')](_0x9af0bd);};}exports['index']=function(_0x11c622,_0x162f5e){var _0x5718e7={},_0x3d78a7={},_0x4114a={'count':0x0,'rows':[]};var _0x46404a=db['Campaign'][_0xd59e('0x25')];_0x3d78a7[_0xd59e('0x26')]=_[_0xd59e('0x27')](_0x46404a);var _0x88460={'dateStart':_0x11c622[_0xd59e('0x28')][_0xd59e('0x29')],'dateEnd':_0x11c622[_0xd59e('0x28')][_0xd59e('0x2a')]};delete _0x11c622[_0xd59e('0x28')][_0xd59e('0x29')];delete _0x11c622[_0xd59e('0x28')]['dateEnd'];_0x3d78a7['query']=_[_0xd59e('0x27')](_0x11c622[_0xd59e('0x28')]);_0x3d78a7[_0xd59e('0x2b')]=_[_0xd59e('0x2c')](_0x3d78a7['model'],_0x3d78a7[_0xd59e('0x28')]);_0x5718e7[_0xd59e('0x2d')]=_[_0xd59e('0x2c')](_0x3d78a7[_0xd59e('0x26')],qs['fields'](_0x11c622['query']['fields']));_0x5718e7[_0xd59e('0x2d')]=_0x5718e7[_0xd59e('0x2d')][_0xd59e('0x2e')]?_0x5718e7[_0xd59e('0x2d')]:_0x3d78a7[_0xd59e('0x26')];if(!_0x11c622[_0xd59e('0x28')][_0xd59e('0x2f')](_0xd59e('0x30'))){_0x5718e7['limit']=qs[_0xd59e('0x1a')](_0x11c622[_0xd59e('0x28')][_0xd59e('0x1a')]);_0x5718e7[_0xd59e('0x19')]=qs[_0xd59e('0x19')](_0x11c622[_0xd59e('0x28')][_0xd59e('0x19')]);}_0x5718e7['order']=qs[_0xd59e('0x31')](_0x11c622[_0xd59e('0x28')][_0xd59e('0x31')]);_0x5718e7['where']=qs[_0xd59e('0x2b')](_[_0xd59e('0x32')](_0x11c622[_0xd59e('0x28')],_0x3d78a7[_0xd59e('0x2b')]));if(_0x88460['dateStart']){if(_0x88460[_0xd59e('0x2a')]){_0x88460['dateEnd']=moment(_0x88460[_0xd59e('0x2a')])['add'](0x1,_0xd59e('0x33'));}else{_0x88460['dateEnd']=moment(_0x88460[_0xd59e('0x29')])[_0xd59e('0x34')](0x1,_0xd59e('0x33'));}_['merge'](_0x5718e7['where'],{'createdAt':{'$gte':_0x88460[_0xd59e('0x29')],'$lte':_0x88460[_0xd59e('0x2a')]}});}if(_0x11c622[_0xd59e('0x28')]['filter']){_0x5718e7[_0xd59e('0x35')]=_[_0xd59e('0x36')](_0x5718e7[_0xd59e('0x35')],{'$or':_[_0xd59e('0x37')](_0x5718e7[_0xd59e('0x2d')],function(_0x133fa5){var _0x39a552={};_0x39a552[_0x133fa5]={'$like':'%'+_0x11c622[_0xd59e('0x28')]['filter']+'%'};return _0x39a552;})});}_0x5718e7=_[_0xd59e('0x36')]({},_0x5718e7,_0x11c622[_0xd59e('0x38')]);var _0x5d5dff={'where':_0x5718e7['where']};return db[_0xd59e('0x39')][_0xd59e('0x18')](_0x5d5dff)[_0xd59e('0x1f')](function(_0x15e7c2){_0x4114a[_0xd59e('0x18')]=_0x15e7c2;if(_0x11c622[_0xd59e('0x28')][_0xd59e('0x3a')]){_0x5718e7['include']=[{'all':!![]}];}return db[_0xd59e('0x39')][_0xd59e('0x3b')](_0x5718e7);})[_0xd59e('0x1f')](function(_0x24a86a){_0x4114a[_0xd59e('0x3c')]=_0x24a86a;return _0x4114a;})[_0xd59e('0x1f')](respondWithFilteredResult(_0x162f5e,_0x5718e7))[_0xd59e('0x3d')](handleError(_0x162f5e,null));};exports[_0xd59e('0x3e')]=function(_0x425f16,_0x52c92a){var _0x25aea3={'raw':![],'where':{'id':_0x425f16[_0xd59e('0x3f')]['id']}},_0x3772c7={};_0x3772c7[_0xd59e('0x26')]=_[_0xd59e('0x27')](db['Campaign']['rawAttributes']);_0x3772c7['query']=_[_0xd59e('0x27')](_0x425f16[_0xd59e('0x28')]);_0x3772c7[_0xd59e('0x2b')]=_[_0xd59e('0x2c')](_0x3772c7[_0xd59e('0x26')],_0x3772c7['query']);_0x25aea3[_0xd59e('0x2d')]=_[_0xd59e('0x2c')](_0x3772c7[_0xd59e('0x26')],qs[_0xd59e('0x40')](_0x425f16[_0xd59e('0x28')][_0xd59e('0x40')]));_0x25aea3[_0xd59e('0x2d')]=_0x25aea3[_0xd59e('0x2d')][_0xd59e('0x2e')]?_0x25aea3['attributes']:_0x3772c7[_0xd59e('0x26')];if(_0x425f16[_0xd59e('0x28')][_0xd59e('0x3a')]){_0x25aea3[_0xd59e('0x41')]=[{'all':!![]}];}_0x25aea3=_[_0xd59e('0x36')]({},_0x25aea3,_0x425f16[_0xd59e('0x38')]);return db[_0xd59e('0x39')][_0xd59e('0x42')](_0x25aea3)['then'](handleEntityNotFound(_0x52c92a,null))[_0xd59e('0x1f')](respondWithResult(_0x52c92a,null))['catch'](handleError(_0x52c92a,null));};exports[_0xd59e('0x43')]=function(_0x4c51e3,_0x2f9f05){return db[_0xd59e('0x39')][_0xd59e('0x43')](_0x4c51e3[_0xd59e('0x44')],{})['then'](function(_0x4bc177){var _0xeeeb42=_0x4c51e3[_0xd59e('0x45')][_0xd59e('0x20')]({'plain':!![]});if(!_0xeeeb42)throw new Error(_0xd59e('0x46'));if(_0xeeeb42[_0xd59e('0x47')]==='user'){var _0x124773=_0x4bc177['get']({'plain':!![]});var _0x1133bb=_0xd59e('0x21');return db[_0xd59e('0x48')][_0xd59e('0x42')]({'where':{'name':_0x1133bb,'userProfileId':_0xeeeb42['userProfileId']},'raw':!![]})[_0xd59e('0x1f')](function(_0x5945d9){if(_0x5945d9&&_0x5945d9['autoAssociation']===0x0){return db['UserProfileResource'][_0xd59e('0x43')]({'name':_0x124773[_0xd59e('0x23')],'resourceId':_0x124773['id'],'type':_0x5945d9[_0xd59e('0x23')],'sectionId':_0x5945d9['id']},{})['then'](function(){return _0x4bc177;});}else{return _0x4bc177;}})[_0xd59e('0x3d')](function(_0x4d5c1f){logger[_0xd59e('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d5c1f);throw _0x4d5c1f;});}return _0x4bc177;})[_0xd59e('0x1f')](respondWithResult(_0x2f9f05,0xc9))[_0xd59e('0x3d')](handleError(_0x2f9f05,null));};exports[_0xd59e('0x49')]=function(_0x34f2c0,_0xe74710){var _0x54e993={'raw':![],'where':{'id':_0x34f2c0[_0xd59e('0x3f')]['id']}},_0x38fdcf={};_0x38fdcf[_0xd59e('0x26')]=_[_0xd59e('0x27')](db['Campaign'][_0xd59e('0x25')]);_0x54e993[_0xd59e('0x2d')]=_[_0xd59e('0x2c')](_0x38fdcf['model'],qs[_0xd59e('0x40')](_0x34f2c0[_0xd59e('0x28')][_0xd59e('0x40')]));_0x54e993['attributes']=_0x54e993['attributes'][_0xd59e('0x2e')]?_0x54e993['attributes']:_0x38fdcf['model'];if(_0x34f2c0[_0xd59e('0x28')][_0xd59e('0x3a')]){_0x54e993['include']=[{'all':!![]}];}_0x54e993=_[_0xd59e('0x36')]({},_0x54e993,_0x34f2c0[_0xd59e('0x38')]);return db[_0xd59e('0x39')][_0xd59e('0x42')](_0x54e993)[_0xd59e('0x1f')](handleEntityNotFound(_0xe74710,null))['then'](function(_0x5ecadc){if(_0x5ecadc){var _0x5db693=_0x5ecadc[_0xd59e('0x20')]({'plain':!![]});_0x5db693=qs[_0xd59e('0x4a')](_0x5db693,['id',_0xd59e('0x4b'),'updatedAt']);_0x34f2c0[_0xd59e('0x44')]=_[_0xd59e('0x4a')](_0x34f2c0['body'],['id',_0xd59e('0x4b'),_0xd59e('0x4c')]);return db[_0xd59e('0x39')]['create'](_['merge'](_0x5db693,_0x34f2c0[_0xd59e('0x44')]),{'include':_0x34f2c0[_0xd59e('0x28')]['includeAll']?[{'all':!![]}]:undefined})[_0xd59e('0x1f')](function(_0x32ceaa){var _0x1b900e=_0x34f2c0[_0xd59e('0x45')][_0xd59e('0x20')]({'plain':!![]});if(!_0x1b900e)throw new Error(_0xd59e('0x46'));if(_0x1b900e['role']==='user'){var _0x4521ce=_0x32ceaa['get']({'plain':!![]});var _0x5a19c9=_0xd59e('0x21');return db[_0xd59e('0x48')][_0xd59e('0x42')]({'where':{'name':_0x5a19c9,'userProfileId':_0x1b900e[_0xd59e('0x4d')]},'raw':!![]})[_0xd59e('0x1f')](function(_0x84ed8c){if(_0x84ed8c&&_0x84ed8c['autoAssociation']===0x0){return db[_0xd59e('0x4e')][_0xd59e('0x43')]({'name':_0x4521ce[_0xd59e('0x23')],'resourceId':_0x4521ce['id'],'type':_0x84ed8c[_0xd59e('0x23')],'sectionId':_0x84ed8c['id']},{})['then'](function(){return _0x32ceaa;});}else{return _0x32ceaa;}})[_0xd59e('0x3d')](function(_0x615449){logger['error'](_0xd59e('0x4f'),_0x615449);throw _0x615449;});}return _0x32ceaa;});}})[_0xd59e('0x1f')](respondWithResult(_0xe74710,0xc9))[_0xd59e('0x3d')](handleError(_0xe74710,null));};exports['update']=function(_0x155aca,_0x17dd1f){if(_0x155aca['body']['id']){delete _0x155aca['body']['id'];}return db['Campaign'][_0xd59e('0x42')]({'where':{'id':_0x155aca[_0xd59e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x17dd1f,null))[_0xd59e('0x1f')](saveUpdates(_0x155aca[_0xd59e('0x44')],null))['then'](respondWithResult(_0x17dd1f,null))[_0xd59e('0x3d')](handleError(_0x17dd1f,null));};exports[_0xd59e('0x50')]=function(_0x1654f0,_0x765416){return db['Campaign']['find']({'where':{'id':_0x1654f0['params']['id']}})['then'](handleEntityNotFound(_0x765416,null))['then'](removeEntity(_0x765416,null))['catch'](handleError(_0x765416,null));};exports['getHoppers']=function(_0x286f5b,_0x34b0f4,_0x493bae){var _0x42dc48={'raw':!![],'where':{}};var _0x16e261={};var _0x268a6d={'count':0x0,'rows':[]};return db[_0xd59e('0x39')]['findOne']({'where':{'id':_0x286f5b['params']['id']}})[_0xd59e('0x1f')](handleEntityNotFound(_0x34b0f4,null))[_0xd59e('0x1f')](function(_0x34a2f9){if(_0x34a2f9){_0x16e261[_0xd59e('0x26')]=_[_0xd59e('0x27')](db[_0xd59e('0x51')][_0xd59e('0x25')]);_0x16e261['query']=_['keys'](_0x286f5b[_0xd59e('0x28')]);_0x16e261[_0xd59e('0x2b')]=_[_0xd59e('0x2c')](_0x16e261[_0xd59e('0x26')],_0x16e261['query']);_0x42dc48[_0xd59e('0x2d')]=_[_0xd59e('0x2c')](_0x16e261[_0xd59e('0x26')],qs[_0xd59e('0x40')](_0x286f5b['query']['fields']));_0x42dc48[_0xd59e('0x2d')]=_0x42dc48[_0xd59e('0x2d')][_0xd59e('0x2e')]?_0x42dc48[_0xd59e('0x2d')]:_0x16e261[_0xd59e('0x26')];if(!_0x286f5b['query']['hasOwnProperty'](_0xd59e('0x30'))){_0x42dc48[_0xd59e('0x1a')]=qs['limit'](_0x286f5b[_0xd59e('0x28')][_0xd59e('0x1a')]);_0x42dc48[_0xd59e('0x19')]=qs[_0xd59e('0x19')](_0x286f5b[_0xd59e('0x28')]['offset']);}_0x42dc48['order']=qs['sort'](_0x286f5b[_0xd59e('0x28')][_0xd59e('0x31')]);_0x42dc48[_0xd59e('0x35')]=qs['filters'](_[_0xd59e('0x32')](_0x286f5b[_0xd59e('0x28')],_0x16e261[_0xd59e('0x2b')]));_0x42dc48['where'][_0xd59e('0x52')]=_0x34a2f9['id'];if(_0x286f5b[_0xd59e('0x28')][_0xd59e('0x53')]){_0x42dc48[_0xd59e('0x35')]=_['merge'](_0x42dc48[_0xd59e('0x35')],{'$or':_[_0xd59e('0x37')](_0x42dc48[_0xd59e('0x2d')],function(_0x11bf31){var _0x3d4289={};_0x3d4289[_0x11bf31]={'$like':'%'+_0x286f5b[_0xd59e('0x28')][_0xd59e('0x53')]+'%'};return _0x3d4289;})});}_0x42dc48=_[_0xd59e('0x36')]({},_0x42dc48,_0x286f5b[_0xd59e('0x38')]);return db[_0xd59e('0x51')]['count']({'where':_0x42dc48[_0xd59e('0x35')]})[_0xd59e('0x1f')](function(_0x41b6b2){_0x268a6d[_0xd59e('0x18')]=_0x41b6b2;if(_0x286f5b[_0xd59e('0x28')]['includeAll']){_0x42dc48[_0xd59e('0x41')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x42dc48);})['then'](function(_0xb35a5c){_0x268a6d[_0xd59e('0x3c')]=_0xb35a5c;return _0x268a6d;});}})['then'](respondWithFilteredResult(_0x34b0f4,_0x42dc48))[_0xd59e('0x3d')](handleError(_0x34b0f4,null));};exports['getHopperHistories']=function(_0x3e05b5,_0x5c78b3,_0x25b4ed){var _0x5cb4ca={'raw':!![],'where':{}};var _0x1ff233={};var _0x402001={'count':0x0,'rows':[]};return db[_0xd59e('0x39')][_0xd59e('0x54')]({'where':{'id':_0x3e05b5['params']['id']}})[_0xd59e('0x1f')](handleEntityNotFound(_0x5c78b3,null))[_0xd59e('0x1f')](function(_0x300e79){if(_0x300e79){_0x1ff233[_0xd59e('0x26')]=_[_0xd59e('0x27')](db[_0xd59e('0x55')][_0xd59e('0x25')]);_0x1ff233['query']=_['keys'](_0x3e05b5['query']);_0x1ff233[_0xd59e('0x2b')]=_['intersection'](_0x1ff233[_0xd59e('0x26')],_0x1ff233[_0xd59e('0x28')]);_0x5cb4ca[_0xd59e('0x2d')]=_[_0xd59e('0x2c')](_0x1ff233[_0xd59e('0x26')],qs[_0xd59e('0x40')](_0x3e05b5[_0xd59e('0x28')][_0xd59e('0x40')]));_0x5cb4ca[_0xd59e('0x2d')]=_0x5cb4ca['attributes'][_0xd59e('0x2e')]?_0x5cb4ca[_0xd59e('0x2d')]:_0x1ff233[_0xd59e('0x26')];if(!_0x3e05b5[_0xd59e('0x28')][_0xd59e('0x2f')](_0xd59e('0x30'))){_0x5cb4ca[_0xd59e('0x1a')]=qs['limit'](_0x3e05b5[_0xd59e('0x28')][_0xd59e('0x1a')]);_0x5cb4ca['offset']=qs[_0xd59e('0x19')](_0x3e05b5[_0xd59e('0x28')][_0xd59e('0x19')]);}_0x5cb4ca[_0xd59e('0x56')]=qs[_0xd59e('0x31')](_0x3e05b5[_0xd59e('0x28')][_0xd59e('0x31')]);_0x5cb4ca[_0xd59e('0x35')]=qs[_0xd59e('0x2b')](_[_0xd59e('0x32')](_0x3e05b5[_0xd59e('0x28')],_0x1ff233['filters']));_0x5cb4ca[_0xd59e('0x35')][_0xd59e('0x52')]=_0x300e79['id'];if(_0x3e05b5['query']['filter']){_0x5cb4ca['where']=_[_0xd59e('0x36')](_0x5cb4ca[_0xd59e('0x35')],{'$or':_[_0xd59e('0x37')](_0x5cb4ca[_0xd59e('0x2d')],function(_0x161f2b){var _0x4103d1={};_0x4103d1[_0x161f2b]={'$like':'%'+_0x3e05b5[_0xd59e('0x28')][_0xd59e('0x53')]+'%'};return _0x4103d1;})});}_0x5cb4ca=_[_0xd59e('0x36')]({},_0x5cb4ca,_0x3e05b5[_0xd59e('0x38')]);return db[_0xd59e('0x55')][_0xd59e('0x18')]({'where':_0x5cb4ca[_0xd59e('0x35')]})[_0xd59e('0x1f')](function(_0x4340bc){_0x402001['count']=_0x4340bc;if(_0x3e05b5['query'][_0xd59e('0x3a')]){_0x5cb4ca['include']=[{'all':!![]}];}return db[_0xd59e('0x55')][_0xd59e('0x3b')](_0x5cb4ca);})[_0xd59e('0x1f')](function(_0x3efd42){_0x402001[_0xd59e('0x3c')]=_0x3efd42;return _0x402001;});}})[_0xd59e('0x1f')](respondWithFilteredResult(_0x5c78b3,_0x5cb4ca))[_0xd59e('0x3d')](handleError(_0x5c78b3,null));};exports['getHopperFinals']=function(_0x30782d,_0x45d930,_0x136fe9){var _0x324fef={'raw':!![],'where':{}};var _0x522990={};var _0x93d2ad={'count':0x0,'rows':[]};return db[_0xd59e('0x39')][_0xd59e('0x54')]({'where':{'id':_0x30782d[_0xd59e('0x3f')]['id']}})[_0xd59e('0x1f')](handleEntityNotFound(_0x45d930,null))[_0xd59e('0x1f')](function(_0x4a61f2){if(_0x4a61f2){_0x522990[_0xd59e('0x26')]=_[_0xd59e('0x27')](db['CmHopperFinal'][_0xd59e('0x25')]);_0x522990[_0xd59e('0x28')]=_['keys'](_0x30782d[_0xd59e('0x28')]);_0x522990[_0xd59e('0x2b')]=_[_0xd59e('0x2c')](_0x522990['model'],_0x522990[_0xd59e('0x28')]);_0x324fef[_0xd59e('0x2d')]=_['intersection'](_0x522990['model'],qs[_0xd59e('0x40')](_0x30782d[_0xd59e('0x28')]['fields']));_0x324fef[_0xd59e('0x2d')]=_0x324fef[_0xd59e('0x2d')][_0xd59e('0x2e')]?_0x324fef['attributes']:_0x522990['model'];if(!_0x30782d['query'][_0xd59e('0x2f')]('nolimit')){_0x324fef['limit']=qs['limit'](_0x30782d[_0xd59e('0x28')]['limit']);_0x324fef['offset']=qs['offset'](_0x30782d[_0xd59e('0x28')][_0xd59e('0x19')]);}_0x324fef[_0xd59e('0x56')]=qs[_0xd59e('0x31')](_0x30782d[_0xd59e('0x28')]['sort']);_0x324fef['where']=qs[_0xd59e('0x2b')](_[_0xd59e('0x32')](_0x30782d[_0xd59e('0x28')],_0x522990['filters']));_0x324fef[_0xd59e('0x35')]['CampaignId']=_0x4a61f2['id'];if(_0x30782d['query'][_0xd59e('0x53')]){_0x324fef[_0xd59e('0x35')]=_[_0xd59e('0x36')](_0x324fef[_0xd59e('0x35')],{'$or':_['map'](_0x324fef[_0xd59e('0x2d')],function(_0x32f1da){var _0xd7b775={};_0xd7b775[_0x32f1da]={'$like':'%'+_0x30782d[_0xd59e('0x28')][_0xd59e('0x53')]+'%'};return _0xd7b775;})});}_0x324fef=_[_0xd59e('0x36')]({},_0x324fef,_0x30782d[_0xd59e('0x38')]);return db[_0xd59e('0x57')]['count']({'where':_0x324fef['where']})['then'](function(_0x2116ee){_0x93d2ad[_0xd59e('0x18')]=_0x2116ee;if(_0x30782d[_0xd59e('0x28')][_0xd59e('0x3a')]){_0x324fef[_0xd59e('0x41')]=[{'all':!![]}];}return db[_0xd59e('0x57')]['findAll'](_0x324fef);})[_0xd59e('0x1f')](function(_0x34ba5e){_0x93d2ad[_0xd59e('0x3c')]=_0x34ba5e;return _0x93d2ad;});}})[_0xd59e('0x1f')](respondWithFilteredResult(_0x45d930,_0x324fef))['catch'](handleError(_0x45d930,null));};exports[_0xd59e('0x58')]=function(_0x40b939,_0xe2f106,_0xf2290d){var _0x1923af={'raw':!![],'where':{}};var _0x2196d7={};var _0x4bbda3={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x40b939[_0xd59e('0x3f')]['id']}})[_0xd59e('0x1f')](handleEntityNotFound(_0xe2f106,null))[_0xd59e('0x1f')](function(_0x3aa8c8){if(_0x3aa8c8){_0x2196d7[_0xd59e('0x26')]=_[_0xd59e('0x27')](db[_0xd59e('0x59')][_0xd59e('0x25')]);_0x2196d7[_0xd59e('0x28')]=_[_0xd59e('0x27')](_0x40b939[_0xd59e('0x28')]);_0x2196d7[_0xd59e('0x2b')]=_[_0xd59e('0x2c')](_0x2196d7['model'],_0x2196d7[_0xd59e('0x28')]);_0x1923af[_0xd59e('0x2d')]=_['intersection'](_0x2196d7[_0xd59e('0x26')],qs[_0xd59e('0x40')](_0x40b939[_0xd59e('0x28')][_0xd59e('0x40')]));_0x1923af['attributes']=_0x1923af['attributes'][_0xd59e('0x2e')]?_0x1923af[_0xd59e('0x2d')]:_0x2196d7[_0xd59e('0x26')];if(!_0x40b939[_0xd59e('0x28')][_0xd59e('0x2f')](_0xd59e('0x30'))){_0x1923af[_0xd59e('0x1a')]=qs[_0xd59e('0x1a')](_0x40b939[_0xd59e('0x28')][_0xd59e('0x1a')]);_0x1923af[_0xd59e('0x19')]=qs[_0xd59e('0x19')](_0x40b939[_0xd59e('0x28')][_0xd59e('0x19')]);}_0x1923af[_0xd59e('0x56')]=qs['sort'](_0x40b939[_0xd59e('0x28')]['sort']);_0x1923af['where']=qs['filters'](_[_0xd59e('0x32')](_0x40b939[_0xd59e('0x28')],_0x2196d7[_0xd59e('0x2b')]));_0x1923af[_0xd59e('0x35')][_0xd59e('0x52')]=_0x3aa8c8['id'];if(_0x40b939['query'][_0xd59e('0x53')]){_0x1923af[_0xd59e('0x35')]=_['merge'](_0x1923af[_0xd59e('0x35')],{'$or':_[_0xd59e('0x37')](_0x1923af[_0xd59e('0x2d')],function(_0x14d679){var _0x3efc86={};_0x3efc86[_0x14d679]={'$like':'%'+_0x40b939[_0xd59e('0x28')][_0xd59e('0x53')]+'%'};return _0x3efc86;})});}_0x1923af=_[_0xd59e('0x36')]({},_0x1923af,_0x40b939['options']);return db[_0xd59e('0x59')]['count']({'where':_0x1923af[_0xd59e('0x35')]})[_0xd59e('0x1f')](function(_0x18aa5a){_0x4bbda3[_0xd59e('0x18')]=_0x18aa5a;if(_0x40b939[_0xd59e('0x28')]['includeAll']){_0x1923af[_0xd59e('0x41')]=[{'all':!![]}];}return db[_0xd59e('0x59')][_0xd59e('0x3b')](_0x1923af);})['then'](function(_0x4e44eb){_0x4bbda3['rows']=_0x4e44eb;return _0x4bbda3;});}})[_0xd59e('0x1f')](respondWithFilteredResult(_0xe2f106,_0x1923af))[_0xd59e('0x3d')](handleError(_0xe2f106,null));};exports[_0xd59e('0x5a')]=function(_0x590490,_0x5a8ddf,_0x31f710){var _0x4fe9b0={};var _0x4a0c01={};var _0x6a864e;var _0x212906;return db[_0xd59e('0x39')][_0xd59e('0x54')]({'where':{'id':_0x590490['params']['id']}})[_0xd59e('0x1f')](handleEntityNotFound(_0x5a8ddf,null))[_0xd59e('0x1f')](function(_0x681fe0){if(_0x681fe0){_0x6a864e=_0x681fe0;_0x4a0c01[_0xd59e('0x26')]=_['keys'](db[_0xd59e('0x5b')][_0xd59e('0x25')]);_0x4a0c01[_0xd59e('0x28')]=_[_0xd59e('0x27')](_0x590490[_0xd59e('0x28')]);_0x4a0c01[_0xd59e('0x2b')]=_['intersection'](_0x4a0c01[_0xd59e('0x26')],_0x4a0c01['query']);_0x4fe9b0['attributes']=_['intersection'](_0x4a0c01[_0xd59e('0x26')],qs[_0xd59e('0x40')](_0x590490[_0xd59e('0x28')][_0xd59e('0x40')]));_0x4fe9b0['attributes']=_0x4fe9b0[_0xd59e('0x2d')][_0xd59e('0x2e')]?_0x4fe9b0['attributes']:_0x4a0c01[_0xd59e('0x26')];_0x4fe9b0[_0xd59e('0x56')]=qs[_0xd59e('0x31')](_0x590490[_0xd59e('0x28')][_0xd59e('0x31')]);_0x4fe9b0[_0xd59e('0x35')]=qs[_0xd59e('0x2b')](_[_0xd59e('0x32')](_0x590490[_0xd59e('0x28')],_0x4a0c01[_0xd59e('0x2b')]));if(_0x590490[_0xd59e('0x28')][_0xd59e('0x53')]){_0x4fe9b0[_0xd59e('0x35')]=_[_0xd59e('0x36')](_0x4fe9b0[_0xd59e('0x35')],{'$or':_[_0xd59e('0x37')](_0x4fe9b0[_0xd59e('0x2d')],function(_0x43d1ca){var _0x1ead52={};_0x1ead52[_0x43d1ca]={'$like':'%'+_0x590490[_0xd59e('0x28')][_0xd59e('0x53')]+'%'};return _0x1ead52;})});}_0x4fe9b0=_[_0xd59e('0x36')]({},_0x4fe9b0,_0x590490[_0xd59e('0x38')]);return _0x6a864e['getLists'](_0x4fe9b0);}})[_0xd59e('0x1f')](function(_0x230d9f){if(_0x230d9f){_0x212906=_0x230d9f['length'];if(!_0x590490[_0xd59e('0x28')][_0xd59e('0x2f')]('nolimit')){_0x4fe9b0[_0xd59e('0x1a')]=qs['limit'](_0x590490[_0xd59e('0x28')][_0xd59e('0x1a')]);_0x4fe9b0[_0xd59e('0x19')]=qs['offset'](_0x590490['query']['offset']);}return _0x6a864e['getLists'](_0x4fe9b0);}})['then'](function(_0x505fc7){if(_0x505fc7){return _0x505fc7?{'count':_0x212906,'rows':_0x505fc7}:null;}})[_0xd59e('0x1f')](respondWithResult(_0x5a8ddf,null))['catch'](handleError(_0x5a8ddf,null));};exports[_0xd59e('0x5c')]=function(_0xab2747,_0x6c9df1,_0x1fafd1){var _0x5d58fb,_0x41ca92;return db[_0xd59e('0x39')][_0xd59e('0x42')]({'where':{'id':_0xab2747['params']['id']}})['then'](handleEntityNotFound(_0x6c9df1,null))[_0xd59e('0x1f')](function(_0x24209f){if(_0x24209f){_0x41ca92=_0x24209f;return _0x24209f[_0xd59e('0x5c')](_0xab2747[_0xd59e('0x44')][_0xd59e('0x5d')],_['omit'](_0xab2747['body'],['ids','id'])||{});}return null;})[_0xd59e('0x5e')](function(_0x5b4ce7){var _0x37d69b;_0x5d58fb=_0x5b4ce7||[];var _0x1eafee=[];if(_0x5b4ce7){for(var _0x47b0e2=0x0;_0x47b0e2<_0x5b4ce7['length'];_0x47b0e2+=0x1){var _0x249046=_0x5b4ce7[_0x47b0e2][_0xd59e('0x20')]({'plain':!![]});_0x41ca92['dialCheckDuplicateType']=_0xab2747[_0xd59e('0x44')][_0xd59e('0x5f')]?_0xab2747['body'][_0xd59e('0x5f')]:_0x41ca92[_0xd59e('0x5f')];switch(_0x41ca92[_0xd59e('0x5f')]){case _0xd59e('0x60'):_0x37d69b=squel['insert']()['into'](_0xd59e('0x61'))[_0xd59e('0x62')]([_0xd59e('0x63'),'scheduledAt',_0xd59e('0x64'),_0xd59e('0x65'),_0xd59e('0x52'),_0xd59e('0x4b'),_0xd59e('0x4c')],squel[_0xd59e('0x66')]()[_0xd59e('0x67')]('phone',_0xd59e('0x63'))[_0xd59e('0x67')](_0xd59e('0x68'),'scheduledAt')[_0xd59e('0x67')]('id',_0xd59e('0x64'))[_0xd59e('0x67')](_0x249046[_0xd59e('0x69')][_0xd59e('0x6a')](),_0xd59e('0x65'))['field'](_0xab2747[_0xd59e('0x3f')]['id'][_0xd59e('0x6a')](),'CampaignId')['field'](_0xd59e('0x68'),'createdAt')[_0xd59e('0x67')](_0xd59e('0x68'),_0xd59e('0x4c'))['from'](_0xd59e('0x6b'))['where'](_0xd59e('0x6c'))['where'](_0xd59e('0x6d'),_0x249046[_0xd59e('0x69')][_0xd59e('0x6a')]())[_0xd59e('0x35')](_0xd59e('0x6e'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xd59e('0x66')]()[_0xd59e('0x67')]('calleridnum')[_0xd59e('0x6f')](_0xd59e('0x70'))[_0xd59e('0x35')]('CampaignId\x20=\x20?',_0xab2747[_0xd59e('0x3f')]['id'][_0xd59e('0x6a')]()))[_0xd59e('0x35')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd59e('0x66')]()[_0xd59e('0x67')](_0xd59e('0x63'))[_0xd59e('0x6f')](_0xd59e('0x61'))[_0xd59e('0x35')](_0xd59e('0x71'),_0xab2747[_0xd59e('0x3f')]['id']['toString']())))['toString']();break;case _0xd59e('0x72'):_0x37d69b=squel[_0xd59e('0x73')]()[_0xd59e('0x74')](_0xd59e('0x61'))[_0xd59e('0x62')]([_0xd59e('0x63'),_0xd59e('0x75'),'ContactId',_0xd59e('0x65'),'CampaignId',_0xd59e('0x4b'),_0xd59e('0x4c')],squel[_0xd59e('0x66')]()[_0xd59e('0x67')]('phone',_0xd59e('0x63'))[_0xd59e('0x67')](_0xd59e('0x68'),_0xd59e('0x75'))['field']('id',_0xd59e('0x64'))[_0xd59e('0x67')](_0x249046[_0xd59e('0x69')][_0xd59e('0x6a')](),_0xd59e('0x65'))[_0xd59e('0x67')](_0xab2747[_0xd59e('0x3f')]['id'][_0xd59e('0x6a')](),_0xd59e('0x52'))['field'](_0xd59e('0x68'),_0xd59e('0x4b'))[_0xd59e('0x67')](_0xd59e('0x68'),'updatedAt')['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xd59e('0x35')](_0xd59e('0x6d'),_0x249046[_0xd59e('0x69')][_0xd59e('0x6a')]())[_0xd59e('0x35')]('phone\x20IS\x20NOT\x20NULL')[_0xd59e('0x35')](_0xd59e('0x76'),squel[_0xd59e('0x66')]()[_0xd59e('0x67')]('phone')[_0xd59e('0x6f')](_0xd59e('0x61'))[_0xd59e('0x35')]('CampaignId\x20=\x20?',_0xab2747[_0xd59e('0x3f')]['id'][_0xd59e('0x6a')]())))[_0xd59e('0x6a')]();break;default:_0x37d69b=squel[_0xd59e('0x73')]()[_0xd59e('0x74')]('cm_hopper')[_0xd59e('0x62')](['phone',_0xd59e('0x75'),_0xd59e('0x64'),_0xd59e('0x65'),_0xd59e('0x52'),_0xd59e('0x4b'),_0xd59e('0x4c')],squel[_0xd59e('0x66')]()[_0xd59e('0x67')](_0xd59e('0x63'),_0xd59e('0x63'))[_0xd59e('0x67')](_0xd59e('0x68'),'scheduledAt')['field']('id',_0xd59e('0x64'))['field'](_0x249046[_0xd59e('0x69')][_0xd59e('0x6a')](),'ListId')[_0xd59e('0x67')](_0xab2747[_0xd59e('0x3f')]['id'][_0xd59e('0x6a')](),_0xd59e('0x52'))[_0xd59e('0x67')](_0xd59e('0x68'),_0xd59e('0x4b'))[_0xd59e('0x67')](_0xd59e('0x68'),_0xd59e('0x4c'))[_0xd59e('0x6f')](_0xd59e('0x6b'))[_0xd59e('0x35')](_0xd59e('0x6c'))['where'](_0xd59e('0x6d'),_0x249046[_0xd59e('0x69')][_0xd59e('0x6a')]())[_0xd59e('0x35')]('phone\x20IS\x20NOT\x20NULL'))[_0xd59e('0x6a')]();}_0x1eafee['push'](db[_0xd59e('0x77')]['query'](_0x37d69b));}return BPromise[_0xd59e('0x78')](_0x1eafee);}})['then'](function(){return _0x5d58fb;})[_0xd59e('0x1f')](respondWithResult(_0x6c9df1,null))[_0xd59e('0x3d')](handleError(_0x6c9df1,null));};exports['removeLists']=function(_0x49bd31,_0x10dfac,_0x572399){var _0x5dabd4;return db['Campaign'][_0xd59e('0x42')]({'where':{'id':_0x49bd31[_0xd59e('0x3f')]['id']}})[_0xd59e('0x1f')](handleEntityNotFound(_0x10dfac,null))['then'](function(_0x1403a3){if(_0x1403a3){return _0x1403a3[_0xd59e('0x79')](_0x49bd31[_0xd59e('0x28')][_0xd59e('0x5d')]);}})[_0xd59e('0x1f')](function(_0x5e06eb){if(_0x5e06eb){_0x5dabd4=_0x5e06eb;return db['CmHopper'][_0xd59e('0x50')]({'where':{'ListId':_0x49bd31['query'][_0xd59e('0x5d')],'CampaignId':_0x49bd31[_0xd59e('0x3f')]['id']}})['then'](function(){return _0x5dabd4;});}})[_0xd59e('0x1f')](respondWithStatusCode(_0x10dfac,null))['catch'](handleError(_0x10dfac,null));};exports[_0xd59e('0x7a')]=function(_0x32f64b,_0x4ac554,_0x1b24aa){var _0x158355={'raw':!![],'where':{}};var _0x49252f={};var _0x51aa60={'count':0x0,'rows':[]};return db[_0xd59e('0x39')][_0xd59e('0x54')]({'where':{'id':_0x32f64b[_0xd59e('0x3f')]['id']}})[_0xd59e('0x1f')](handleEntityNotFound(_0x4ac554,null))['then'](function(_0x536458){if(_0x536458){_0x49252f[_0xd59e('0x26')]=_[_0xd59e('0x27')](db[_0xd59e('0x5b')]['rawAttributes']);_0x49252f[_0xd59e('0x28')]=_[_0xd59e('0x27')](_0x32f64b['query']);_0x49252f[_0xd59e('0x2b')]=_[_0xd59e('0x2c')](_0x49252f[_0xd59e('0x26')],_0x49252f[_0xd59e('0x28')]);_0x158355[_0xd59e('0x2d')]=_[_0xd59e('0x2c')](_0x49252f[_0xd59e('0x26')],qs['fields'](_0x32f64b[_0xd59e('0x28')]['fields']));_0x158355[_0xd59e('0x2d')]=_0x158355[_0xd59e('0x2d')][_0xd59e('0x2e')]?_0x158355[_0xd59e('0x2d')]:_0x49252f['model'];if(!_0x32f64b[_0xd59e('0x28')][_0xd59e('0x2f')](_0xd59e('0x30'))){_0x158355[_0xd59e('0x1a')]=qs['limit'](_0x32f64b[_0xd59e('0x28')]['limit']);_0x158355['offset']=qs[_0xd59e('0x19')](_0x32f64b[_0xd59e('0x28')][_0xd59e('0x19')]);}_0x158355['order']=qs[_0xd59e('0x31')](_0x32f64b[_0xd59e('0x28')][_0xd59e('0x31')]);_0x158355[_0xd59e('0x35')]=qs['filters'](_[_0xd59e('0x32')](_0x32f64b[_0xd59e('0x28')],_0x49252f[_0xd59e('0x2b')]));_0x158355[_0xd59e('0x35')]['CampaignId']=_0x536458['id'];if(_0x32f64b[_0xd59e('0x28')][_0xd59e('0x53')]){_0x158355[_0xd59e('0x35')]=_['merge'](_0x158355[_0xd59e('0x35')],{'$or':_[_0xd59e('0x37')](_0x158355[_0xd59e('0x2d')],function(_0x461f03){var _0x13782a={};_0x13782a[_0x461f03]={'$like':'%'+_0x32f64b[_0xd59e('0x28')]['filter']+'%'};return _0x13782a;})});}_0x158355=_[_0xd59e('0x36')]({},_0x158355,_0x32f64b['options']);return db['CmList']['count']({'where':_0x158355['where']})[_0xd59e('0x1f')](function(_0x29925e){_0x51aa60['count']=_0x29925e;if(_0x32f64b[_0xd59e('0x28')][_0xd59e('0x3a')]){_0x158355[_0xd59e('0x41')]=[{'all':!![]}];}return db[_0xd59e('0x5b')][_0xd59e('0x3b')](_0x158355);})[_0xd59e('0x1f')](function(_0x11f1e3){_0x51aa60[_0xd59e('0x3c')]=_0x11f1e3;return _0x51aa60;});}})[_0xd59e('0x1f')](respondWithFilteredResult(_0x4ac554,_0x158355))[_0xd59e('0x3d')](handleError(_0x4ac554,null));};exports[_0xd59e('0x7b')]=function(_0x49d28e,_0x5e3f40,_0x4cd4d6){var _0x1b210f,_0x2041c7;return db[_0xd59e('0x39')]['find']({'where':{'id':_0x49d28e['params']['id']}})['then'](handleEntityNotFound(_0x5e3f40,null))['then'](function(_0x549578){if(_0x549578){_0x2041c7=_0x549578;return _0x549578[_0xd59e('0x7b')](_0x49d28e[_0xd59e('0x44')]['ids'],_['omit'](_0x49d28e[_0xd59e('0x44')],[_0xd59e('0x5d'),'id'])||{});}return null;})[_0xd59e('0x5e')](function(_0x228bd8){var _0x160366;_0x1b210f=_0x228bd8||[];var _0x2b6811=[];if(_0x228bd8){for(var _0x39a787=0x0;_0x39a787<_0x228bd8[_0xd59e('0x2e')];_0x39a787+=0x1){var _0x83f5a7=_0x228bd8[_0x39a787][_0xd59e('0x20')]({'plain':!![]});_0x160366=squel[_0xd59e('0x73')]()['into']('cm_hopper_black')[_0xd59e('0x62')](['phone','ContactId',_0xd59e('0x65'),_0xd59e('0x52'),_0xd59e('0x4b'),'updatedAt'],squel[_0xd59e('0x66')]()[_0xd59e('0x67')](_0xd59e('0x63'),_0xd59e('0x63'))[_0xd59e('0x67')]('id','ContactId')[_0xd59e('0x67')](_0x83f5a7[_0xd59e('0x69')][_0xd59e('0x6a')](),_0xd59e('0x65'))[_0xd59e('0x67')](_0x49d28e[_0xd59e('0x3f')]['id']['toString'](),'CampaignId')['field'](_0xd59e('0x68'),'createdAt')[_0xd59e('0x67')](_0xd59e('0x68'),_0xd59e('0x4c'))[_0xd59e('0x6f')]('cm_contacts')[_0xd59e('0x35')](_0xd59e('0x6c'))['where'](_0xd59e('0x6d'),_0x83f5a7[_0xd59e('0x69')][_0xd59e('0x6a')]())[_0xd59e('0x35')]('phone\x20IS\x20NOT\x20NULL'))[_0xd59e('0x6a')]();_0x2b6811[_0xd59e('0x7c')](db['sequelize'][_0xd59e('0x28')](_0x160366));}return BPromise['all'](_0x2b6811);}})[_0xd59e('0x1f')](function(){return _0x1b210f;})[_0xd59e('0x1f')](respondWithResult(_0x5e3f40,null))[_0xd59e('0x3d')](handleError(_0x5e3f40,null));};exports[_0xd59e('0x7d')]=function(_0x5d0cc8,_0x3a371e,_0x3428ee){var _0x3aacd4;return db[_0xd59e('0x39')][_0xd59e('0x42')]({'where':{'id':_0x5d0cc8[_0xd59e('0x3f')]['id']}})[_0xd59e('0x1f')](handleEntityNotFound(_0x3a371e,null))['then'](function(_0x24228c){if(_0x24228c){return _0x24228c[_0xd59e('0x7d')](_0x5d0cc8[_0xd59e('0x28')][_0xd59e('0x5d')]);}})[_0xd59e('0x1f')](function(_0x8e9e2d){if(_0x8e9e2d){_0x3aacd4=_0x8e9e2d;return db[_0xd59e('0x59')][_0xd59e('0x50')]({'where':{'ListId':_0x5d0cc8[_0xd59e('0x28')][_0xd59e('0x5d')],'CampaignId':_0x5d0cc8[_0xd59e('0x3f')]['id']}})['then'](function(){return _0x3aacd4;});}})[_0xd59e('0x1f')](respondWithStatusCode(_0x3a371e,null))[_0xd59e('0x3d')](handleError(_0x3a371e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6b16220..a449c2a 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 _0x17a9=['api','moment','request-promise','./campaign.attributes','campaigns','lodash'];(function(_0x5a572b,_0x460f20){var _0x141b42=function(_0x1929c0){while(--_0x1929c0){_0x5a572b['push'](_0x5a572b['shift']());}};_0x141b42(++_0x460f20);}(_0x17a9,0x1c7));var _0x917a=function(_0x1de289,_0x39f352){_0x1de289=_0x1de289-0x0;var _0x343c47=_0x17a9[_0x1de289];return _0x343c47;};'use strict';var _=require(_0x917a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x917a('0x1'));var moment=require(_0x917a('0x2'));var BPromise=require('bluebird');var rp=require(_0x917a('0x3'));var attributes=require(_0x917a('0x4'));module['exports']=function(_0x5d7167,_0x113be1){return _0x5d7167['define']('Campaign',attributes,{'tableName':_0x917a('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcb2=['./campaign.attributes','exports','define','Campaign','campaigns','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x8bb067,_0x51b550){var _0x4adea6=function(_0x5aef1e){while(--_0x5aef1e){_0x8bb067['push'](_0x8bb067['shift']());}};_0x4adea6(++_0x51b550);}(_0xdcb2,0x191));var _0x2dcb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdcb2[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x2dcb('0x0'));var util=require('util');var logger=require(_0x2dcb('0x1'))(_0x2dcb('0x2'));var moment=require(_0x2dcb('0x3'));var BPromise=require(_0x2dcb('0x4'));var rp=require(_0x2dcb('0x5'));var attributes=require(_0x2dcb('0x6'));module[_0x2dcb('0x7')]=function(_0x333dc1,_0x4af385){return _0x333dc1[_0x2dcb('0x8')](_0x2dcb('0x9'),attributes,{'tableName':_0x2dcb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index c8b541a..21822eb 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 _0xe81f=['result','Campaign','findAll','options','raw','where','attributes','limit','include','model','then','info','GetCampaign','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Campaign,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe81f,0x1a7));var _0xfe81=function(_0x5a001d,_0x591f45){_0x5a001d=_0x5a001d-0x0;var _0x3d0a81=_0xe81f[_0x5a001d];return _0x3d0a81;};'use strict';var _=require(_0xfe81('0x0'));var util=require(_0xfe81('0x1'));var moment=require(_0xfe81('0x2'));var BPromise=require(_0xfe81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe81('0x4'));var db=require(_0xfe81('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe81('0x6'))(_0xfe81('0x7'));var config=require(_0xfe81('0x8'));var jayson=require(_0xfe81('0x9'));var client=jayson[_0xfe81('0xa')][_0xfe81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c7793,_0x1a1165,_0x89e796){return new BPromise(function(_0x2cfd42,_0x83ffeb){return client[_0xfe81('0xc')](_0x1c7793,_0x89e796)['then'](function(_0x202085){logger['info'](_0xfe81('0xd'),_0x1a1165,_0xfe81('0xe'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x1a1165,_0xfe81('0xe'),JSON[_0xfe81('0xf')](_0x202085));if(_0x202085['error']){if(_0x202085[_0xfe81('0x10')][_0xfe81('0x11')]===0x1f4){logger[_0xfe81('0x10')](_0xfe81('0xd'),_0x1a1165,_0x202085['error'][_0xfe81('0x12')]);return _0x83ffeb(_0x202085[_0xfe81('0x10')][_0xfe81('0x12')]);}logger[_0xfe81('0x10')](_0xfe81('0xd'),_0x1a1165,_0x202085['error'][_0xfe81('0x12')]);return _0x2cfd42(_0x202085[_0xfe81('0x10')][_0xfe81('0x12')]);}else{logger['info'](_0xfe81('0xd'),_0x1a1165,_0xfe81('0xe'));_0x2cfd42(_0x202085[_0xfe81('0x13')][_0xfe81('0x12')]);}})['catch'](function(_0x1a6e92){logger[_0xfe81('0x10')]('Campaign,\x20%s,\x20%s',_0x1a1165,_0x1a6e92);_0x83ffeb(_0x1a6e92);});});}exports['GetCampaign']=function(_0x4440a2){var _0xde4007=this;return new Promise(function(_0x3160d0,_0xc55103){return db[_0xfe81('0x14')][_0xfe81('0x15')]({'raw':_0x4440a2[_0xfe81('0x16')]?_0x4440a2[_0xfe81('0x16')][_0xfe81('0x17')]===undefined?!![]:![]:!![],'where':_0x4440a2[_0xfe81('0x16')]?_0x4440a2[_0xfe81('0x16')][_0xfe81('0x18')]||null:null,'attributes':_0x4440a2['options']?_0x4440a2['options'][_0xfe81('0x19')]||null:null,'limit':_0x4440a2[_0xfe81('0x16')]?_0x4440a2[_0xfe81('0x16')][_0xfe81('0x1a')]||null:null,'include':_0x4440a2[_0xfe81('0x16')]?_0x4440a2[_0xfe81('0x16')][_0xfe81('0x1b')]?_['map'](_0x4440a2['options'][_0xfe81('0x1b')],function(_0x36ef5e){return{'model':db[_0x36ef5e['model']],'as':_0x36ef5e['as'],'attributes':_0x36ef5e[_0xfe81('0x19')],'include':_0x36ef5e[_0xfe81('0x1b')]?_['map'](_0x36ef5e[_0xfe81('0x1b')],function(_0x377d38){return{'model':db[_0x377d38['model']],'as':_0x377d38['as'],'attributes':_0x377d38[_0xfe81('0x19')],'include':_0x377d38[_0xfe81('0x1b')]?_['map'](_0x377d38[_0xfe81('0x1b')],function(_0x4f48d5){return{'model':db[_0x4f48d5[_0xfe81('0x1c')]],'as':_0x4f48d5['as'],'attributes':_0x4f48d5[_0xfe81('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfe81('0x1d')](function(_0x158d87){logger[_0xfe81('0x1e')](_0xfe81('0x1f'),_0x4440a2);logger[_0xfe81('0x20')](_0xfe81('0x1f'),_0x4440a2,JSON['stringify'](_0x158d87));_0x3160d0(_0x158d87);})[_0xfe81('0x21')](function(_0x315da3){logger['error'](_0xfe81('0x1f'),_0x315da3['message'],_0x4440a2);_0xc55103(_0xde4007['error'](0x1f4,_0x315da3[_0xfe81('0x12')]));});});}; \ No newline at end of file +var _0x490f=['bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','info','Campaign,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','model','map','then','GetCampaign','stringify','util','moment'];(function(_0x2f7abe,_0x5465ee){var _0x50eaff=function(_0x351f1c){while(--_0x351f1c){_0x2f7abe['push'](_0x2f7abe['shift']());}};_0x50eaff(++_0x5465ee);}(_0x490f,0x1de));var _0xf490=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x490f[_0x5eb22e];return _0x27fed5;};'use strict';var _=require('lodash');var util=require(_0xf490('0x0'));var moment=require(_0xf490('0x1'));var BPromise=require(_0xf490('0x2'));var rs=require(_0xf490('0x3'));var fs=require('fs');var Redis=require(_0xf490('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf490('0x5'))(_0xf490('0x6'));var config=require('../../config/environment');var jayson=require(_0xf490('0x7'));var client=jayson['client'][_0xf490('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x345fde,_0x345895,_0x45e73e){return new BPromise(function(_0x4746d5,_0x3c5db7){return client[_0xf490('0x9')](_0x345fde,_0x45e73e)['then'](function(_0x1ca9e1){logger[_0xf490('0xa')](_0xf490('0xb'),_0x345895,'request\x20sent');logger[_0xf490('0xc')]('Campaign,\x20%s,\x20%s,\x20%s',_0x345895,_0xf490('0xd'),JSON['stringify'](_0x1ca9e1));if(_0x1ca9e1['error']){if(_0x1ca9e1[_0xf490('0xe')][_0xf490('0xf')]===0x1f4){logger['error'](_0xf490('0xb'),_0x345895,_0x1ca9e1[_0xf490('0xe')]['message']);return _0x3c5db7(_0x1ca9e1[_0xf490('0xe')][_0xf490('0x10')]);}logger[_0xf490('0xe')](_0xf490('0xb'),_0x345895,_0x1ca9e1[_0xf490('0xe')]['message']);return _0x4746d5(_0x1ca9e1[_0xf490('0xe')]['message']);}else{logger[_0xf490('0xa')](_0xf490('0xb'),_0x345895,_0xf490('0xd'));_0x4746d5(_0x1ca9e1[_0xf490('0x11')][_0xf490('0x10')]);}})[_0xf490('0x12')](function(_0x3d7fdf){logger[_0xf490('0xe')](_0xf490('0xb'),_0x345895,_0x3d7fdf);_0x3c5db7(_0x3d7fdf);});});}exports['GetCampaign']=function(_0x5cc253){var _0x4d1262=this;return new Promise(function(_0x19b60d,_0x39a472){return db[_0xf490('0x13')][_0xf490('0x14')]({'raw':_0x5cc253['options']?_0x5cc253[_0xf490('0x15')][_0xf490('0x16')]===undefined?!![]:![]:!![],'where':_0x5cc253['options']?_0x5cc253[_0xf490('0x15')][_0xf490('0x17')]||null:null,'attributes':_0x5cc253[_0xf490('0x15')]?_0x5cc253['options'][_0xf490('0x18')]||null:null,'limit':_0x5cc253[_0xf490('0x15')]?_0x5cc253[_0xf490('0x15')][_0xf490('0x19')]||null:null,'include':_0x5cc253[_0xf490('0x15')]?_0x5cc253[_0xf490('0x15')]['include']?_['map'](_0x5cc253[_0xf490('0x15')][_0xf490('0x1a')],function(_0x2d75b4){return{'model':db[_0x2d75b4[_0xf490('0x1b')]],'as':_0x2d75b4['as'],'attributes':_0x2d75b4[_0xf490('0x18')],'include':_0x2d75b4[_0xf490('0x1a')]?_['map'](_0x2d75b4[_0xf490('0x1a')],function(_0x243481){return{'model':db[_0x243481[_0xf490('0x1b')]],'as':_0x243481['as'],'attributes':_0x243481['attributes'],'include':_0x243481[_0xf490('0x1a')]?_[_0xf490('0x1c')](_0x243481['include'],function(_0x2ed47b){return{'model':db[_0x2ed47b[_0xf490('0x1b')]],'as':_0x2ed47b['as'],'attributes':_0x2ed47b['attributes']};}):[]};}):[]};}):[]:[]})[_0xf490('0x1d')](function(_0x1ed917){logger[_0xf490('0xa')](_0xf490('0x1e'),_0x5cc253);logger[_0xf490('0xc')](_0xf490('0x1e'),_0x5cc253,JSON[_0xf490('0x1f')](_0x1ed917));_0x19b60d(_0x1ed917);})['catch'](function(_0x1027e2){logger[_0xf490('0xe')](_0xf490('0x1e'),_0x1027e2['message'],_0x5cc253);_0x39a472(_0x4d1262[_0xf490('0xe')](0x1f4,_0x1027e2['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 17d92b8..207cda4 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 _0x2ac6=['addBlackLists','put','/:id','update','delete','removeBlackLists','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','addLists'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x2ac6,0xcd));var _0x62ac=function(_0x3b1106,_0x4bd523){_0x3b1106=_0x3b1106-0x0;var _0x1fbeef=_0x2ac6[_0x3b1106];return _0x1fbeef;};'use strict';var multer=require(_0x62ac('0x0'));var util=require(_0x62ac('0x1'));var path=require(_0x62ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x62ac('0x3'));var router=express[_0x62ac('0x4')]();var auth=require(_0x62ac('0x5'));var interaction=require(_0x62ac('0x6'));var config=require('../../config/environment');var controller=require(_0x62ac('0x7'));router[_0x62ac('0x8')]('/',auth[_0x62ac('0x9')](),controller[_0x62ac('0xa')]);router['get']('/:id',auth[_0x62ac('0x9')](),controller['show']);router[_0x62ac('0x8')](_0x62ac('0xb'),auth[_0x62ac('0x9')](),controller[_0x62ac('0xc')]);router[_0x62ac('0x8')](_0x62ac('0xd'),auth['isAuthenticated'](),controller[_0x62ac('0xe')]);router[_0x62ac('0x8')](_0x62ac('0xf'),auth[_0x62ac('0x9')](),controller[_0x62ac('0x10')]);router[_0x62ac('0x8')](_0x62ac('0x11'),auth[_0x62ac('0x9')](),controller[_0x62ac('0x12')]);router[_0x62ac('0x8')](_0x62ac('0x13'),auth[_0x62ac('0x9')](),controller[_0x62ac('0x14')]);router[_0x62ac('0x8')](_0x62ac('0x15'),auth[_0x62ac('0x9')](),controller['getBlackLists']);router[_0x62ac('0x16')]('/',auth[_0x62ac('0x9')](),controller[_0x62ac('0x17')]);router['post'](_0x62ac('0x18'),auth[_0x62ac('0x9')](),controller['clone']);router[_0x62ac('0x16')](_0x62ac('0x13'),auth[_0x62ac('0x9')](),controller[_0x62ac('0x19')]);router[_0x62ac('0x16')](_0x62ac('0x15'),auth[_0x62ac('0x9')](),controller[_0x62ac('0x1a')]);router[_0x62ac('0x1b')](_0x62ac('0x1c'),auth[_0x62ac('0x9')](),controller[_0x62ac('0x1d')]);router[_0x62ac('0x1e')](_0x62ac('0x1c'),auth[_0x62ac('0x9')](),controller['destroy']);router[_0x62ac('0x1e')](_0x62ac('0x13'),auth[_0x62ac('0x9')](),controller['removeLists']);router[_0x62ac('0x1e')](_0x62ac('0x15'),auth['isAuthenticated'](),controller[_0x62ac('0x1f')]);module[_0x62ac('0x20')]=router; \ No newline at end of file +var _0xeb51=['/:id/clone','addBlackLists','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create'];(function(_0x5665b7,_0x634f29){var _0x21418c=function(_0x4e7741){while(--_0x4e7741){_0x5665b7['push'](_0x5665b7['shift']());}};_0x21418c(++_0x634f29);}(_0xeb51,0x18c));var _0x1eb5=function(_0x3ca20d,_0x398ae2){_0x3ca20d=_0x3ca20d-0x0;var _0x54ae80=_0xeb51[_0x3ca20d];return _0x54ae80;};'use strict';var multer=require(_0x1eb5('0x0'));var util=require(_0x1eb5('0x1'));var path=require(_0x1eb5('0x2'));var timeout=require(_0x1eb5('0x3'));var express=require(_0x1eb5('0x4'));var router=express[_0x1eb5('0x5')]();var auth=require(_0x1eb5('0x6'));var interaction=require(_0x1eb5('0x7'));var config=require(_0x1eb5('0x8'));var controller=require('./campaign.controller');router[_0x1eb5('0x9')]('/',auth[_0x1eb5('0xa')](),controller[_0x1eb5('0xb')]);router[_0x1eb5('0x9')](_0x1eb5('0xc'),auth[_0x1eb5('0xa')](),controller[_0x1eb5('0xd')]);router['get'](_0x1eb5('0xe'),auth[_0x1eb5('0xa')](),controller[_0x1eb5('0xf')]);router[_0x1eb5('0x9')]('/:id/hopper_histories',auth[_0x1eb5('0xa')](),controller[_0x1eb5('0x10')]);router[_0x1eb5('0x9')]('/:id/hopper_finals',auth[_0x1eb5('0xa')](),controller[_0x1eb5('0x11')]);router[_0x1eb5('0x9')]('/:id/hopper_black',auth[_0x1eb5('0xa')](),controller[_0x1eb5('0x12')]);router[_0x1eb5('0x9')](_0x1eb5('0x13'),auth[_0x1eb5('0xa')](),controller['getLists']);router['get'](_0x1eb5('0x14'),auth[_0x1eb5('0xa')](),controller[_0x1eb5('0x15')]);router[_0x1eb5('0x16')]('/',auth[_0x1eb5('0xa')](),controller[_0x1eb5('0x17')]);router[_0x1eb5('0x16')](_0x1eb5('0x18'),auth[_0x1eb5('0xa')](),controller['clone']);router['post'](_0x1eb5('0x13'),auth['isAuthenticated'](),controller['addLists']);router[_0x1eb5('0x16')](_0x1eb5('0x14'),auth[_0x1eb5('0xa')](),controller[_0x1eb5('0x19')]);router[_0x1eb5('0x1a')]('/:id',auth[_0x1eb5('0xa')](),controller['update']);router[_0x1eb5('0x1b')](_0x1eb5('0xc'),auth['isAuthenticated'](),controller[_0x1eb5('0x1c')]);router[_0x1eb5('0x1b')](_0x1eb5('0x13'),auth[_0x1eb5('0xa')](),controller['removeLists']);router[_0x1eb5('0x1b')](_0x1eb5('0x14'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x1eb5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ce13523..04e16e4 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 _0xbd75=['getDataValue','key','sequelize','exports','STRING','TEXT'];(function(_0x109f6b,_0x2a164c){var _0x22c967=function(_0x854889){while(--_0x854889){_0x109f6b['push'](_0x109f6b['shift']());}};_0x22c967(++_0x2a164c);}(_0xbd75,0x1b2));var _0x5bd7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbd75[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x5bd7('0x0'));module[_0x5bd7('0x1')]={'key':{'type':Sequelize[_0x5bd7('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x5bd7('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x5bd7('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x5bd7('0x4')](_0x5bd7('0x5'));}}}; \ No newline at end of file +var _0xf570=['STRING','VIRTUAL','getDataValue','exports'];(function(_0x44b517,_0x5d0ed5){var _0x82d9b5=function(_0x4fb0fc){while(--_0x4fb0fc){_0x44b517['push'](_0x44b517['shift']());}};_0x82d9b5(++_0x5d0ed5);}(_0xf570,0x137));var _0x0f57=function(_0x5b6b71,_0x1f3e63){_0x5b6b71=_0x5b6b71-0x0;var _0x24b994=_0xf570[_0x5b6b71];return _0x24b994;};'use strict';var Sequelize=require('sequelize');module[_0x0f57('0x0')]={'key':{'type':Sequelize[_0x0f57('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x0f57('0x1')]},'name':{'type':Sequelize[_0x0f57('0x2')],'get':function(){return this[_0x0f57('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5dfa760..6dd5c36 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 _0x7217=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','error','stack','name','index','CannedAnswer','model','keys','dateStart','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','dateEnd','add','day','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x7217,0x19e));var _0x7721=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x7217[_0x2cfb58];return _0xd99951;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var qs=require(_0x7721('0x13'));var logger=require('../../config/logger')(_0x7721('0x14'));var utils=require(_0x7721('0x15'));var config=require(_0x7721('0x16'));var db=require(_0x7721('0x17'))['db'];function respondWithStatusCode(_0xa8977c,_0x409b37){_0x409b37=_0x409b37||0xcc;return function(_0x1e7fd7){if(_0x1e7fd7){return _0xa8977c[_0x7721('0x18')](_0x409b37);}return _0xa8977c['status'](_0x409b37)[_0x7721('0x19')]();};}function respondWithResult(_0x199930,_0x57ff6d){_0x57ff6d=_0x57ff6d||0xc8;return function(_0x109900){if(_0x109900){return _0x199930[_0x7721('0x1a')](_0x57ff6d)[_0x7721('0x1b')](_0x109900);}};}function respondWithFilteredResult(_0x2e9752,_0x5069da){return function(_0x3cbce8){if(_0x3cbce8){var _0x25b1c0=_0x3cbce8[_0x7721('0x1c')],_0x534f1b=_0x5069da[_0x7721('0x1d')],_0x4e199a=_0x5069da[_0x7721('0x1d')]+_0x5069da[_0x7721('0x1e')],_0x4b183e;if(_0x4e199a>=_0x25b1c0){_0x4e199a=_0x25b1c0;_0x4b183e=0xc8;}else{_0x4b183e=0xce;}_0x2e9752['status'](_0x4b183e);return _0x2e9752[_0x7721('0x1f')]('Content-Range',_0x534f1b+'-'+_0x4e199a+'/'+_0x25b1c0)[_0x7721('0x1b')](_0x3cbce8);}return null;};}function patchUpdates(_0x5cb0e6){return function(_0xfec626){try{jsonpatch[_0x7721('0x20')](_0xfec626,_0x5cb0e6,!![]);}catch(_0x3ab5a5){return BPromise[_0x7721('0x21')](_0x3ab5a5);}return _0xfec626[_0x7721('0x22')]();};}function saveUpdates(_0x40af90,_0x402820){return function(_0x413263){if(_0x413263){return _0x413263[_0x7721('0x23')](_0x40af90)[_0x7721('0x24')](function(_0x4ce1db){return _0x4ce1db;});}return null;};}function removeEntity(_0x288f7e,_0x2c1583){return function(_0x3a053f){if(_0x3a053f){return _0x3a053f[_0x7721('0x25')]()['then'](function(){var _0x28f5a6=_0x3a053f['get']({'plain':!![]});var _0xb9e9dd=_0x7721('0x26');return db[_0x7721('0x27')][_0x7721('0x25')]({'where':{'type':_0xb9e9dd,'resourceId':_0x28f5a6['id']}})[_0x7721('0x24')](function(){return _0x3a053f;});})[_0x7721('0x24')](function(){_0x288f7e[_0x7721('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216f20,_0x1abedb){return function(_0x125564){if(!_0x125564){_0x216f20[_0x7721('0x18')](0x194);}return _0x125564;};}function handleError(_0x40d550,_0x16355a){_0x16355a=_0x16355a||0x1f4;return function(_0x424e05){logger[_0x7721('0x28')](_0x424e05[_0x7721('0x29')]);if(_0x424e05['name']){delete _0x424e05[_0x7721('0x2a')];}_0x40d550['status'](_0x16355a)['send'](_0x424e05);};}exports[_0x7721('0x2b')]=function(_0x343c19,_0x53c904){var _0x158d98={},_0x1ea4d={},_0x37b9f0={'count':0x0,'rows':[]};var _0xd7d703=db[_0x7721('0x2c')]['rawAttributes'];_0x1ea4d[_0x7721('0x2d')]=_[_0x7721('0x2e')](_0xd7d703);var _0x497f9f={'dateStart':_0x343c19['query'][_0x7721('0x2f')],'dateEnd':_0x343c19[_0x7721('0x30')]['dateEnd']};delete _0x343c19[_0x7721('0x30')][_0x7721('0x2f')];delete _0x343c19[_0x7721('0x30')]['dateEnd'];_0x1ea4d[_0x7721('0x30')]=_[_0x7721('0x2e')](_0x343c19[_0x7721('0x30')]);_0x1ea4d[_0x7721('0x31')]=_[_0x7721('0x32')](_0x1ea4d['model'],_0x1ea4d[_0x7721('0x30')]);_0x158d98[_0x7721('0x33')]=_[_0x7721('0x32')](_0x1ea4d['model'],qs[_0x7721('0x34')](_0x343c19[_0x7721('0x30')]['fields']));_0x158d98[_0x7721('0x33')]=_0x158d98['attributes'][_0x7721('0x35')]?_0x158d98[_0x7721('0x33')]:_0x1ea4d[_0x7721('0x2d')];if(!_0x343c19[_0x7721('0x30')][_0x7721('0x36')](_0x7721('0x37'))){_0x158d98[_0x7721('0x1e')]=qs[_0x7721('0x1e')](_0x343c19[_0x7721('0x30')][_0x7721('0x1e')]);_0x158d98[_0x7721('0x1d')]=qs['offset'](_0x343c19[_0x7721('0x30')]['offset']);}_0x158d98[_0x7721('0x38')]=qs[_0x7721('0x39')](_0x343c19[_0x7721('0x30')][_0x7721('0x39')]);_0x158d98[_0x7721('0x3a')]=qs[_0x7721('0x31')](_['pick'](_0x343c19['query'],_0x1ea4d['filters']));if(_0x497f9f['dateStart']){if(_0x497f9f[_0x7721('0x3b')]){_0x497f9f[_0x7721('0x3b')]=moment(_0x497f9f[_0x7721('0x3b')])[_0x7721('0x3c')](0x1,'day');}else{_0x497f9f[_0x7721('0x3b')]=moment(_0x497f9f['dateStart'])[_0x7721('0x3c')](0x1,_0x7721('0x3d'));}_['merge'](_0x158d98[_0x7721('0x3a')],{'createdAt':{'$gte':_0x497f9f[_0x7721('0x2f')],'$lte':_0x497f9f['dateEnd']}});}if(_0x343c19['query'][_0x7721('0x3e')]){_0x158d98[_0x7721('0x3a')]=_[_0x7721('0x3f')](_0x158d98[_0x7721('0x3a')],{'$or':_['map'](_0x158d98[_0x7721('0x33')],function(_0x120de9){var _0x40ce8c={};_0x40ce8c[_0x120de9]={'$like':'%'+_0x343c19[_0x7721('0x30')][_0x7721('0x3e')]+'%'};return _0x40ce8c;})});}_0x158d98=_['merge']({},_0x158d98,_0x343c19[_0x7721('0x40')]);var _0x4a2c28={'where':_0x158d98[_0x7721('0x3a')]};return db['CannedAnswer'][_0x7721('0x1c')](_0x4a2c28)[_0x7721('0x24')](function(_0x231dad){_0x37b9f0['count']=_0x231dad;if(_0x343c19[_0x7721('0x30')][_0x7721('0x41')]){_0x158d98[_0x7721('0x42')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7721('0x43')](_0x158d98);})[_0x7721('0x24')](function(_0xdb3033){_0x37b9f0[_0x7721('0x44')]=_0xdb3033;return _0x37b9f0;})[_0x7721('0x24')](respondWithFilteredResult(_0x53c904,_0x158d98))[_0x7721('0x45')](handleError(_0x53c904,null));};exports[_0x7721('0x46')]=function(_0x4c76c3,_0x479698){var _0x1ac3af={'raw':!![],'where':{'id':_0x4c76c3[_0x7721('0x47')]['id']}},_0x1fdc79={};_0x1fdc79[_0x7721('0x2d')]=_[_0x7721('0x2e')](db[_0x7721('0x2c')][_0x7721('0x48')]);_0x1fdc79[_0x7721('0x30')]=_[_0x7721('0x2e')](_0x4c76c3[_0x7721('0x30')]);_0x1fdc79['filters']=_['intersection'](_0x1fdc79[_0x7721('0x2d')],_0x1fdc79[_0x7721('0x30')]);_0x1ac3af[_0x7721('0x33')]=_[_0x7721('0x32')](_0x1fdc79['model'],qs[_0x7721('0x34')](_0x4c76c3[_0x7721('0x30')]['fields']));_0x1ac3af[_0x7721('0x33')]=_0x1ac3af['attributes'][_0x7721('0x35')]?_0x1ac3af['attributes']:_0x1fdc79[_0x7721('0x2d')];if(_0x4c76c3[_0x7721('0x30')][_0x7721('0x41')]){_0x1ac3af['include']=[{'all':!![]}];}_0x1ac3af=_[_0x7721('0x3f')]({},_0x1ac3af,_0x4c76c3[_0x7721('0x40')]);return db['CannedAnswer'][_0x7721('0x49')](_0x1ac3af)[_0x7721('0x24')](handleEntityNotFound(_0x479698,null))[_0x7721('0x24')](respondWithResult(_0x479698,null))['catch'](handleError(_0x479698,null));};exports[_0x7721('0x23')]=function(_0x5a32b6,_0xdb1ca8){if(_0x5a32b6[_0x7721('0x4a')]['id']){delete _0x5a32b6[_0x7721('0x4a')]['id'];}return db[_0x7721('0x2c')][_0x7721('0x49')]({'where':{'id':_0x5a32b6[_0x7721('0x47')]['id']}})[_0x7721('0x24')](handleEntityNotFound(_0xdb1ca8,null))[_0x7721('0x24')](saveUpdates(_0x5a32b6[_0x7721('0x4a')],null))[_0x7721('0x24')](respondWithResult(_0xdb1ca8,null))[_0x7721('0x45')](handleError(_0xdb1ca8,null));};exports[_0x7721('0x25')]=function(_0x24b17d,_0xbcd90e){return db[_0x7721('0x2c')]['find']({'where':{'id':_0x24b17d[_0x7721('0x47')]['id']}})[_0x7721('0x24')](handleEntityNotFound(_0xbcd90e,null))[_0x7721('0x24')](removeEntity(_0xbcd90e,null))[_0x7721('0x45')](handleError(_0xbcd90e,null));};exports[_0x7721('0x4b')]=function(_0x315127,_0x267f5e){var _0x57484c={'key':_0x315127[_0x7721('0x4a')][_0x7721('0x4c')]};if(_0x315127[_0x7721('0x4a')][_0x7721('0x4d')]){_0x57484c[_0x7721('0x4d')]=_0x315127[_0x7721('0x4a')][_0x7721('0x4d')];}else if(_0x315127[_0x7721('0x4a')][_0x7721('0x4e')]){_0x57484c[_0x7721('0x4e')]=_0x315127[_0x7721('0x4a')]['SmsAccountId'];}else if(_0x315127[_0x7721('0x4a')][_0x7721('0x4f')]){_0x57484c[_0x7721('0x4f')]=_0x315127[_0x7721('0x4a')][_0x7721('0x4f')];}else if(_0x315127[_0x7721('0x4a')][_0x7721('0x50')]){_0x57484c[_0x7721('0x50')]=_0x315127[_0x7721('0x4a')][_0x7721('0x50')];}return db[_0x7721('0x2c')][_0x7721('0x49')]({'where':_0x57484c})[_0x7721('0x24')](function(_0x18f7f6){if(_0x18f7f6){throw new db[(_0x7721('0x51'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x7721('0x4b')](_0x315127['body']);})['then'](function(_0x57348c){var _0x5d7036=_0x315127[_0x7721('0x52')][_0x7721('0x53')]({'plain':!![]});if(!_0x5d7036)throw new Error(_0x7721('0x54'));if(_0x5d7036['role']===_0x7721('0x52')){var _0x5925b7=_0x57348c['get']({'plain':!![]});return db['UserProfileSection'][_0x7721('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x5d7036['userProfileId']},'raw':!![]})['then'](function(_0x160292){if(_0x160292&&_0x160292[_0x7721('0x55')]===0x0){return db[_0x7721('0x27')]['create']({'name':_0x5925b7[_0x7721('0x2a')],'resourceId':_0x5925b7['id'],'type':_0x160292[_0x7721('0x2a')],'sectionId':_0x160292['id']},{})[_0x7721('0x24')](function(){return _0x57348c;});}else{return _0x57348c;}})[_0x7721('0x45')](function(_0x6b7c1e){logger[_0x7721('0x28')](_0x7721('0x56'),_0x6b7c1e);throw _0x6b7c1e;});}return _0x57348c;})[_0x7721('0x24')](respondWithResult(_0x267f5e,0xc9))[_0x7721('0x45')](handleError(_0x267f5e,null));}; \ No newline at end of file +var _0xe14b=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','index','CannedAnswer','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','include','rows','params','includeAll','catch','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','sendStatus','status','end','json','count'];(function(_0x1c1031,_0x4008d8){var _0x25f276=function(_0x977845){while(--_0x977845){_0x1c1031['push'](_0x1c1031['shift']());}};_0x25f276(++_0x4008d8);}(_0xe14b,0x93));var _0xbe14=function(_0x1ab846,_0x1fc066){_0x1ab846=_0x1ab846-0x0;var _0x46082a=_0xe14b[_0x1ab846];return _0x46082a;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var qs=require(_0xbe14('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xbe14('0x10'));var config=require(_0xbe14('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x254c3b,_0x35aa19){_0x35aa19=_0x35aa19||0xcc;return function(_0x886a5e){if(_0x886a5e){return _0x254c3b[_0xbe14('0x12')](_0x35aa19);}return _0x254c3b[_0xbe14('0x13')](_0x35aa19)[_0xbe14('0x14')]();};}function respondWithResult(_0x23a730,_0x2850cb){_0x2850cb=_0x2850cb||0xc8;return function(_0x16893f){if(_0x16893f){return _0x23a730[_0xbe14('0x13')](_0x2850cb)[_0xbe14('0x15')](_0x16893f);}};}function respondWithFilteredResult(_0x33fd54,_0x813399){return function(_0x530538){if(_0x530538){var _0x55b3a7=_0x530538[_0xbe14('0x16')],_0x3f58f5=_0x813399['offset'],_0x3dc4a9=_0x813399[_0xbe14('0x17')]+_0x813399[_0xbe14('0x18')],_0xf4ac9;if(_0x3dc4a9>=_0x55b3a7){_0x3dc4a9=_0x55b3a7;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x33fd54[_0xbe14('0x13')](_0xf4ac9);return _0x33fd54[_0xbe14('0x19')](_0xbe14('0x1a'),_0x3f58f5+'-'+_0x3dc4a9+'/'+_0x55b3a7)[_0xbe14('0x15')](_0x530538);}return null;};}function patchUpdates(_0x17ae86){return function(_0x5ea1f8){try{jsonpatch[_0xbe14('0x1b')](_0x5ea1f8,_0x17ae86,!![]);}catch(_0x456ca8){return BPromise[_0xbe14('0x1c')](_0x456ca8);}return _0x5ea1f8[_0xbe14('0x1d')]();};}function saveUpdates(_0x3249da,_0x37e4c1){return function(_0x59a9e3){if(_0x59a9e3){return _0x59a9e3[_0xbe14('0x1e')](_0x3249da)[_0xbe14('0x1f')](function(_0x417c8d){return _0x417c8d;});}return null;};}function removeEntity(_0xc12977,_0x188ec4){return function(_0x51dc0b){if(_0x51dc0b){return _0x51dc0b[_0xbe14('0x20')]()['then'](function(){var _0x3c1c85=_0x51dc0b['get']({'plain':!![]});var _0x32e8eb='CannedAnswers';return db[_0xbe14('0x21')][_0xbe14('0x20')]({'where':{'type':_0x32e8eb,'resourceId':_0x3c1c85['id']}})['then'](function(){return _0x51dc0b;});})[_0xbe14('0x1f')](function(){_0xc12977['status'](0xcc)[_0xbe14('0x14')]();});}};}function handleEntityNotFound(_0x4851f8,_0x36a21e){return function(_0x5fa043){if(!_0x5fa043){_0x4851f8[_0xbe14('0x12')](0x194);}return _0x5fa043;};}function handleError(_0x39cc81,_0x15ef02){_0x15ef02=_0x15ef02||0x1f4;return function(_0x2703f5){logger['error'](_0x2703f5[_0xbe14('0x22')]);if(_0x2703f5[_0xbe14('0x23')]){delete _0x2703f5[_0xbe14('0x23')];}_0x39cc81[_0xbe14('0x13')](_0x15ef02)['send'](_0x2703f5);};}exports[_0xbe14('0x24')]=function(_0x29fc64,_0x59bf34){var _0x3c3613={},_0x3b3e84={},_0x1c7cc7={'count':0x0,'rows':[]};var _0x19252f=db[_0xbe14('0x25')][_0xbe14('0x26')];_0x3b3e84[_0xbe14('0x27')]=_[_0xbe14('0x28')](_0x19252f);var _0x4168c8={'dateStart':_0x29fc64[_0xbe14('0x29')][_0xbe14('0x2a')],'dateEnd':_0x29fc64[_0xbe14('0x29')][_0xbe14('0x2b')]};delete _0x29fc64[_0xbe14('0x29')][_0xbe14('0x2a')];delete _0x29fc64[_0xbe14('0x29')][_0xbe14('0x2b')];_0x3b3e84[_0xbe14('0x29')]=_[_0xbe14('0x28')](_0x29fc64[_0xbe14('0x29')]);_0x3b3e84['filters']=_[_0xbe14('0x2c')](_0x3b3e84['model'],_0x3b3e84['query']);_0x3c3613[_0xbe14('0x2d')]=_['intersection'](_0x3b3e84[_0xbe14('0x27')],qs[_0xbe14('0x2e')](_0x29fc64['query']['fields']));_0x3c3613['attributes']=_0x3c3613[_0xbe14('0x2d')][_0xbe14('0x2f')]?_0x3c3613['attributes']:_0x3b3e84[_0xbe14('0x27')];if(!_0x29fc64[_0xbe14('0x29')][_0xbe14('0x30')](_0xbe14('0x31'))){_0x3c3613[_0xbe14('0x18')]=qs['limit'](_0x29fc64['query'][_0xbe14('0x18')]);_0x3c3613['offset']=qs['offset'](_0x29fc64['query'][_0xbe14('0x17')]);}_0x3c3613[_0xbe14('0x32')]=qs[_0xbe14('0x33')](_0x29fc64[_0xbe14('0x29')][_0xbe14('0x33')]);_0x3c3613[_0xbe14('0x34')]=qs[_0xbe14('0x35')](_[_0xbe14('0x36')](_0x29fc64[_0xbe14('0x29')],_0x3b3e84[_0xbe14('0x35')]));if(_0x4168c8[_0xbe14('0x2a')]){if(_0x4168c8[_0xbe14('0x2b')]){_0x4168c8['dateEnd']=moment(_0x4168c8['dateEnd'])[_0xbe14('0x37')](0x1,_0xbe14('0x38'));}else{_0x4168c8[_0xbe14('0x2b')]=moment(_0x4168c8['dateStart'])[_0xbe14('0x37')](0x1,_0xbe14('0x38'));}_[_0xbe14('0x39')](_0x3c3613[_0xbe14('0x34')],{'createdAt':{'$gte':_0x4168c8[_0xbe14('0x2a')],'$lte':_0x4168c8[_0xbe14('0x2b')]}});}if(_0x29fc64[_0xbe14('0x29')][_0xbe14('0x3a')]){_0x3c3613[_0xbe14('0x34')]=_['merge'](_0x3c3613[_0xbe14('0x34')],{'$or':_[_0xbe14('0x3b')](_0x3c3613[_0xbe14('0x2d')],function(_0x1b3118){var _0x3287b9={};_0x3287b9[_0x1b3118]={'$like':'%'+_0x29fc64[_0xbe14('0x29')]['filter']+'%'};return _0x3287b9;})});}_0x3c3613=_[_0xbe14('0x39')]({},_0x3c3613,_0x29fc64[_0xbe14('0x3c')]);var _0x1220c9={'where':_0x3c3613[_0xbe14('0x34')]};return db['CannedAnswer']['count'](_0x1220c9)[_0xbe14('0x1f')](function(_0xe417b){_0x1c7cc7[_0xbe14('0x16')]=_0xe417b;if(_0x29fc64['query']['includeAll']){_0x3c3613[_0xbe14('0x3d')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3c3613);})[_0xbe14('0x1f')](function(_0x1f0355){_0x1c7cc7[_0xbe14('0x3e')]=_0x1f0355;return _0x1c7cc7;})['then'](respondWithFilteredResult(_0x59bf34,_0x3c3613))['catch'](handleError(_0x59bf34,null));};exports['show']=function(_0x46fee8,_0x1eccf7){var _0x1085d2={'raw':!![],'where':{'id':_0x46fee8[_0xbe14('0x3f')]['id']}},_0x562325={};_0x562325[_0xbe14('0x27')]=_[_0xbe14('0x28')](db[_0xbe14('0x25')]['rawAttributes']);_0x562325['query']=_[_0xbe14('0x28')](_0x46fee8[_0xbe14('0x29')]);_0x562325[_0xbe14('0x35')]=_[_0xbe14('0x2c')](_0x562325[_0xbe14('0x27')],_0x562325['query']);_0x1085d2['attributes']=_[_0xbe14('0x2c')](_0x562325[_0xbe14('0x27')],qs[_0xbe14('0x2e')](_0x46fee8[_0xbe14('0x29')]['fields']));_0x1085d2[_0xbe14('0x2d')]=_0x1085d2[_0xbe14('0x2d')]['length']?_0x1085d2[_0xbe14('0x2d')]:_0x562325[_0xbe14('0x27')];if(_0x46fee8[_0xbe14('0x29')][_0xbe14('0x40')]){_0x1085d2['include']=[{'all':!![]}];}_0x1085d2=_['merge']({},_0x1085d2,_0x46fee8[_0xbe14('0x3c')]);return db[_0xbe14('0x25')]['find'](_0x1085d2)['then'](handleEntityNotFound(_0x1eccf7,null))[_0xbe14('0x1f')](respondWithResult(_0x1eccf7,null))[_0xbe14('0x41')](handleError(_0x1eccf7,null));};exports[_0xbe14('0x1e')]=function(_0x1a8a3d,_0xdbc6e1){if(_0x1a8a3d[_0xbe14('0x42')]['id']){delete _0x1a8a3d[_0xbe14('0x42')]['id'];}return db['CannedAnswer'][_0xbe14('0x43')]({'where':{'id':_0x1a8a3d[_0xbe14('0x3f')]['id']}})[_0xbe14('0x1f')](handleEntityNotFound(_0xdbc6e1,null))[_0xbe14('0x1f')](saveUpdates(_0x1a8a3d[_0xbe14('0x42')],null))['then'](respondWithResult(_0xdbc6e1,null))[_0xbe14('0x41')](handleError(_0xdbc6e1,null));};exports[_0xbe14('0x20')]=function(_0x35126f,_0x20f46d){return db[_0xbe14('0x25')][_0xbe14('0x43')]({'where':{'id':_0x35126f['params']['id']}})['then'](handleEntityNotFound(_0x20f46d,null))[_0xbe14('0x1f')](removeEntity(_0x20f46d,null))[_0xbe14('0x41')](handleError(_0x20f46d,null));};exports[_0xbe14('0x44')]=function(_0x48554a,_0x497b00){var _0x44fe0d={'key':_0x48554a[_0xbe14('0x42')]['key']};if(_0x48554a[_0xbe14('0x42')][_0xbe14('0x45')]){_0x44fe0d['MailAccountId']=_0x48554a[_0xbe14('0x42')]['MailAccountId'];}else if(_0x48554a[_0xbe14('0x42')][_0xbe14('0x46')]){_0x44fe0d[_0xbe14('0x46')]=_0x48554a['body'][_0xbe14('0x46')];}else if(_0x48554a[_0xbe14('0x42')]['OpenchannelAccountId']){_0x44fe0d[_0xbe14('0x47')]=_0x48554a[_0xbe14('0x42')][_0xbe14('0x47')];}else if(_0x48554a[_0xbe14('0x42')][_0xbe14('0x48')]){_0x44fe0d['ChatWebsiteId']=_0x48554a[_0xbe14('0x42')][_0xbe14('0x48')];}return db[_0xbe14('0x25')][_0xbe14('0x43')]({'where':_0x44fe0d})[_0xbe14('0x1f')](function(_0x44084c){if(_0x44084c){throw new db[(_0xbe14('0x49'))]['ValidationError'](_0xbe14('0x4a'));}return db[_0xbe14('0x25')][_0xbe14('0x44')](_0x48554a[_0xbe14('0x42')]);})[_0xbe14('0x1f')](function(_0x2ed3fb){var _0xd8f78f=_0x48554a[_0xbe14('0x4b')][_0xbe14('0x4c')]({'plain':!![]});if(!_0xd8f78f)throw new Error(_0xbe14('0x4d'));if(_0xd8f78f[_0xbe14('0x4e')]==='user'){var _0x56bcd3=_0x2ed3fb['get']({'plain':!![]});return db[_0xbe14('0x4f')][_0xbe14('0x43')]({'where':{'name':_0xbe14('0x50'),'userProfileId':_0xd8f78f[_0xbe14('0x51')]},'raw':!![]})[_0xbe14('0x1f')](function(_0x66ddf){if(_0x66ddf&&_0x66ddf[_0xbe14('0x52')]===0x0){return db[_0xbe14('0x21')][_0xbe14('0x44')]({'name':_0x56bcd3[_0xbe14('0x23')],'resourceId':_0x56bcd3['id'],'type':_0x66ddf[_0xbe14('0x23')],'sectionId':_0x66ddf['id']},{})[_0xbe14('0x1f')](function(){return _0x2ed3fb;});}else{return _0x2ed3fb;}})[_0xbe14('0x41')](function(_0xeb915b){logger[_0xbe14('0x53')](_0xbe14('0x54'),_0xeb915b);throw _0xeb915b;});}return _0x2ed3fb;})[_0xbe14('0x1f')](respondWithResult(_0x497b00,0xc9))[_0xbe14('0x41')](handleError(_0x497b00,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index cbef418..c5d52a2 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 _0x69bf=['tools_canned_answers','lodash','util','../../config/logger','bluebird','request-promise','./cannedAnswer.attributes'];(function(_0x302229,_0xb9ab13){var _0x257c22=function(_0x12cdca){while(--_0x12cdca){_0x302229['push'](_0x302229['shift']());}};_0x257c22(++_0xb9ab13);}(_0x69bf,0x10b));var _0xf69b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x69bf[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf69b('0x0'));var util=require(_0xf69b('0x1'));var logger=require(_0xf69b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf69b('0x3'));var rp=require(_0xf69b('0x4'));var attributes=require(_0xf69b('0x5'));module['exports']=function(_0xc8222c,_0x5a135d){return _0xc8222c['define']('CannedAnswer',attributes,{'tableName':_0xf69b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecce=['bluebird','request-promise','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','lodash','util','../../config/logger','api','moment'];(function(_0x3ce116,_0x124dcc){var _0x2d8e03=function(_0x271319){while(--_0x271319){_0x3ce116['push'](_0x3ce116['shift']());}};_0x2d8e03(++_0x124dcc);}(_0xecce,0x1c9));var _0xeecc=function(_0x307101,_0x45fd0a){_0x307101=_0x307101-0x0;var _0x5d4775=_0xecce[_0x307101];return _0x5d4775;};'use strict';var _=require(_0xeecc('0x0'));var util=require(_0xeecc('0x1'));var logger=require(_0xeecc('0x2'))(_0xeecc('0x3'));var moment=require(_0xeecc('0x4'));var BPromise=require(_0xeecc('0x5'));var rp=require(_0xeecc('0x6'));var attributes=require(_0xeecc('0x7'));module[_0xeecc('0x8')]=function(_0x1fe0d5,_0x540d85){return _0x1fe0d5['define'](_0xeecc('0x9'),attributes,{'tableName':_0xeecc('0xa'),'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 a9c6d4f..44b7836 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 _0x8f8c=['client','http','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f8c,0x11d));var _0xc8f8=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x8f8c[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0xc8f8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc8f8('0x1'));var rs=require(_0xc8f8('0x2'));var fs=require('fs');var Redis=require(_0xc8f8('0x3'));var db=require(_0xc8f8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8f8('0x5'))(_0xc8f8('0x6'));var config=require(_0xc8f8('0x7'));var jayson=require(_0xc8f8('0x8'));var client=jayson[_0xc8f8('0x9')][_0xc8f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36edbd,_0x14a55b,_0x497f72){return new BPromise(function(_0x24abd1,_0x3e6afe){return client['request'](_0x36edbd,_0x497f72)[_0xc8f8('0xb')](function(_0x54e948){logger['info'](_0xc8f8('0xc'),_0x14a55b,_0xc8f8('0xd'));logger[_0xc8f8('0xe')](_0xc8f8('0xf'),_0x14a55b,_0xc8f8('0xd'),JSON[_0xc8f8('0x10')](_0x54e948));if(_0x54e948[_0xc8f8('0x11')]){if(_0x54e948[_0xc8f8('0x11')][_0xc8f8('0x12')]===0x1f4){logger['error'](_0xc8f8('0xc'),_0x14a55b,_0x54e948['error'][_0xc8f8('0x13')]);return _0x3e6afe(_0x54e948['error'][_0xc8f8('0x13')]);}logger[_0xc8f8('0x11')](_0xc8f8('0xc'),_0x14a55b,_0x54e948[_0xc8f8('0x11')][_0xc8f8('0x13')]);return _0x24abd1(_0x54e948[_0xc8f8('0x11')][_0xc8f8('0x13')]);}else{logger[_0xc8f8('0x14')](_0xc8f8('0xc'),_0x14a55b,'request\x20sent');_0x24abd1(_0x54e948['result']['message']);}})['catch'](function(_0xd6b3aa){logger[_0xc8f8('0x11')](_0xc8f8('0xc'),_0x14a55b,_0xd6b3aa);_0x3e6afe(_0xd6b3aa);});});} \ No newline at end of file +var _0x354c=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0x354c,0x1a3));var _0xc354=function(_0x4fe10e,_0x576d57){_0x4fe10e=_0x4fe10e-0x0;var _0x374e05=_0x354c[_0x4fe10e];return _0x374e05;};'use strict';var _=require(_0xc354('0x0'));var util=require(_0xc354('0x1'));var moment=require('moment');var BPromise=require(_0xc354('0x2'));var rs=require(_0xc354('0x3'));var fs=require('fs');var Redis=require(_0xc354('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc354('0x5'));var logger=require(_0xc354('0x6'))(_0xc354('0x7'));var config=require('../../config/environment');var jayson=require(_0xc354('0x8'));var client=jayson[_0xc354('0x9')][_0xc354('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40c348,_0x31e52b,_0x54721c){return new BPromise(function(_0x1d9590,_0x23eeaf){return client[_0xc354('0xb')](_0x40c348,_0x54721c)['then'](function(_0x5c00c4){logger['info'](_0xc354('0xc'),_0x31e52b,_0xc354('0xd'));logger[_0xc354('0xe')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x31e52b,'request\x20sent',JSON[_0xc354('0xf')](_0x5c00c4));if(_0x5c00c4[_0xc354('0x10')]){if(_0x5c00c4[_0xc354('0x10')][_0xc354('0x11')]===0x1f4){logger[_0xc354('0x10')](_0xc354('0xc'),_0x31e52b,_0x5c00c4['error'][_0xc354('0x12')]);return _0x23eeaf(_0x5c00c4[_0xc354('0x10')][_0xc354('0x12')]);}logger[_0xc354('0x10')](_0xc354('0xc'),_0x31e52b,_0x5c00c4[_0xc354('0x10')][_0xc354('0x12')]);return _0x1d9590(_0x5c00c4['error']['message']);}else{logger[_0xc354('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x31e52b,_0xc354('0xd'));_0x1d9590(_0x5c00c4['result'][_0xc354('0x12')]);}})['catch'](function(_0x1841b0){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x31e52b,_0x1841b0);_0x23eeaf(_0x1841b0);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 57dc201..af064db 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 _0x5b39=['../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','create','update','delete','multer','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xa9fcc9,_0xe1d51){var _0x20bd18=function(_0x1eee85){while(--_0x1eee85){_0xa9fcc9['push'](_0xa9fcc9['shift']());}};_0x20bd18(++_0xe1d51);}(_0x5b39,0x127));var _0x95b3=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5b39[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x95b3('0x0'));var util=require(_0x95b3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x95b3('0x2')]();var auth=require(_0x95b3('0x3'));var interaction=require(_0x95b3('0x4'));var config=require(_0x95b3('0x5'));var controller=require(_0x95b3('0x6'));router[_0x95b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x95b3('0x8')]);router[_0x95b3('0x7')](_0x95b3('0x9'),auth[_0x95b3('0xa')](),controller[_0x95b3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x95b3('0xc')]);router['put'](_0x95b3('0x9'),auth[_0x95b3('0xa')](),controller[_0x95b3('0xd')]);router[_0x95b3('0xe')](_0x95b3('0x9'),auth[_0x95b3('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x14dd=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','/:id','show','create','put','delete','destroy','path','connect-timeout'];(function(_0x216f7d,_0x496249){var _0xc49d7f=function(_0x27be52){while(--_0x27be52){_0x216f7d['push'](_0x216f7d['shift']());}};_0xc49d7f(++_0x496249);}(_0x14dd,0x19e));var _0xd14d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14dd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd14d('0x0'));var timeout=require(_0xd14d('0x1'));var express=require(_0xd14d('0x2'));var router=express[_0xd14d('0x3')]();var auth=require(_0xd14d('0x4'));var interaction=require(_0xd14d('0x5'));var config=require(_0xd14d('0x6'));var controller=require(_0xd14d('0x7'));router['get']('/',auth[_0xd14d('0x8')](),controller['index']);router[_0xd14d('0x9')](_0xd14d('0xa'),auth['isAuthenticated'](),controller[_0xd14d('0xb')]);router['post']('/',auth[_0xd14d('0x8')](),controller[_0xd14d('0xc')]);router[_0xd14d('0xd')](_0xd14d('0xa'),auth[_0xd14d('0x8')](),controller['update']);router[_0xd14d('0xe')](_0xd14d('0xa'),auth[_0xd14d('0x8')](),controller[_0xd14d('0xf')]);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 d880b20..1af5e0c 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 _0x6442=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x159652,_0x5ca329){var _0x4555df=function(_0xd00c38){while(--_0xd00c38){_0x159652['push'](_0x159652['shift']());}};_0x4555df(++_0x5ca329);}(_0x6442,0x197));var _0x2644=function(_0xd2f4ac,_0x5aa8e5){_0xd2f4ac=_0xd2f4ac-0x0;var _0x9757b2=_0x6442[_0xd2f4ac];return _0x9757b2;};'use strict';var Sequelize=require(_0x2644('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x2644('0x1')},'clid':{'type':Sequelize[_0x2644('0x2')]},'src':{'type':Sequelize[_0x2644('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x2644('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x2644('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x2644('0x2')]},'duration':{'type':Sequelize[_0x2644('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2644('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2644('0x2')]},'amaflags':{'type':Sequelize[_0x2644('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2644('0x2')]},'linkedid':{'type':Sequelize[_0x2644('0x2')]},'sequence':{'type':Sequelize[_0x2644('0x2')]},'peeraccount':{'type':Sequelize[_0x2644('0x2')]},'type':{'type':Sequelize[_0x2644('0x2')]},'tag':{'type':Sequelize[_0x2644('0x2')]}}; \ No newline at end of file +var _0x9bb0=['INTEGER','sequelize','exports','STRING'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x9bb0,0x1a1));var _0x09bb=function(_0x5d3276,_0xd38063){_0x5d3276=_0x5d3276-0x0;var _0x3562f5=_0x9bb0[_0x5d3276];return _0x3562f5;};'use strict';var Sequelize=require(_0x09bb('0x0'));module[_0x09bb('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x09bb('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x09bb('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x09bb('0x2')]},'duration':{'type':Sequelize[_0x09bb('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x09bb('0x2')]},'amaflags':{'type':Sequelize[_0x09bb('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x09bb('0x2')]},'userfield':{'type':Sequelize[_0x09bb('0x2')]},'uniqueid':{'type':Sequelize[_0x09bb('0x2')]},'linkedid':{'type':Sequelize[_0x09bb('0x2')]},'sequence':{'type':Sequelize[_0x09bb('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x09bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index e3cb1bb..b926fec 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 _0xd6bf=['limit','status','set','reject','save','then','error','stack','name','send','index','Cdr','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','nolimit','order','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset'];(function(_0x309682,_0x490392){var _0x216aa3=function(_0x29ffd9){while(--_0x29ffd9){_0x309682['push'](_0x309682['shift']());}};_0x216aa3(++_0x490392);}(_0xd6bf,0xc1));var _0xfd6b=function(_0x34dd30,_0x3590e4){_0x34dd30=_0x34dd30-0x0;var _0x1f66fc=_0xd6bf[_0x34dd30];return _0x1f66fc;};'use strict';var pdf=require(_0xfd6b('0x0'));var emlformat=require(_0xfd6b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfd6b('0x2'));var jsonpatch=require(_0xfd6b('0x3'));var rp=require(_0xfd6b('0x4'));var moment=require(_0xfd6b('0x5'));var BPromise=require(_0xfd6b('0x6'));var Mustache=require(_0xfd6b('0x7'));var util=require(_0xfd6b('0x8'));var path=require(_0xfd6b('0x9'));var sox=require(_0xfd6b('0xa'));var csv=require(_0xfd6b('0xb'));var ejs=require(_0xfd6b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfd6b('0xd'));var crypto=require('crypto');var jsforce=require(_0xfd6b('0xe'));var deskjs=require(_0xfd6b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfd6b('0x10'));var Papa=require(_0xfd6b('0x11'));var Redis=require(_0xfd6b('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0xfd6b('0x13'))(_0xfd6b('0x14'));var utils=require(_0xfd6b('0x15'));var config=require(_0xfd6b('0x16'));var db=require(_0xfd6b('0x17'))['db'];function respondWithStatusCode(_0x39efd5,_0x280771){_0x280771=_0x280771||0xcc;return function(_0x42bf9d){if(_0x42bf9d){return _0x39efd5[_0xfd6b('0x18')](_0x280771);}return _0x39efd5['status'](_0x280771)[_0xfd6b('0x19')]();};}function respondWithResult(_0x5888a2,_0x4d95ea){_0x4d95ea=_0x4d95ea||0xc8;return function(_0x287c9d){if(_0x287c9d){return _0x5888a2['status'](_0x4d95ea)[_0xfd6b('0x1a')](_0x287c9d);}};}function respondWithFilteredResult(_0x23db2d,_0x238192){return function(_0x9446e4){if(_0x9446e4){var _0x44c87e=_0x9446e4[_0xfd6b('0x1b')],_0x587f28=_0x238192['offset'],_0x293d76=_0x238192[_0xfd6b('0x1c')]+_0x238192[_0xfd6b('0x1d')],_0x4ebfb7;if(_0x293d76>=_0x44c87e){_0x293d76=_0x44c87e;_0x4ebfb7=0xc8;}else{_0x4ebfb7=0xce;}_0x23db2d[_0xfd6b('0x1e')](_0x4ebfb7);return _0x23db2d[_0xfd6b('0x1f')]('Content-Range',_0x587f28+'-'+_0x293d76+'/'+_0x44c87e)[_0xfd6b('0x1a')](_0x9446e4);}return null;};}function patchUpdates(_0x2eaab3){return function(_0x59a960){try{jsonpatch['apply'](_0x59a960,_0x2eaab3,!![]);}catch(_0x55fc05){return BPromise[_0xfd6b('0x20')](_0x55fc05);}return _0x59a960[_0xfd6b('0x21')]();};}function saveUpdates(_0x2ea47a,_0x25337d){return function(_0x232d45){if(_0x232d45){return _0x232d45['update'](_0x2ea47a)[_0xfd6b('0x22')](function(_0x111bfe){return _0x111bfe;});}return null;};}function removeEntity(_0x404646,_0x3cc6d2){return function(_0x152a24){if(_0x152a24){return _0x152a24['destroy']()['then'](function(){_0x404646[_0xfd6b('0x1e')](0xcc)[_0xfd6b('0x19')]();});}};}function handleEntityNotFound(_0x50cc41,_0xe59d05){return function(_0x3a1f8f){if(!_0x3a1f8f){_0x50cc41['sendStatus'](0x194);}return _0x3a1f8f;};}function handleError(_0xac1078,_0x356579){_0x356579=_0x356579||0x1f4;return function(_0x2444b7){logger[_0xfd6b('0x23')](_0x2444b7[_0xfd6b('0x24')]);if(_0x2444b7[_0xfd6b('0x25')]){delete _0x2444b7['name'];}_0xac1078[_0xfd6b('0x1e')](_0x356579)[_0xfd6b('0x26')](_0x2444b7);};}exports[_0xfd6b('0x27')]=function(_0x331e36,_0x5a1cba){var _0x3e0ead={},_0x342c56={},_0x53396a={'count':0x0,'rows':[]};var _0x2aacc0=db[_0xfd6b('0x28')]['rawAttributes'];_0x342c56[_0xfd6b('0x29')]=_[_0xfd6b('0x2a')](_0x2aacc0);var _0x500e63={'dateStart':_0x331e36[_0xfd6b('0x2b')][_0xfd6b('0x2c')],'dateEnd':_0x331e36[_0xfd6b('0x2b')][_0xfd6b('0x2d')]};delete _0x331e36['query'][_0xfd6b('0x2c')];delete _0x331e36['query'][_0xfd6b('0x2d')];_0x342c56[_0xfd6b('0x2b')]=_[_0xfd6b('0x2a')](_0x331e36[_0xfd6b('0x2b')]);_0x342c56[_0xfd6b('0x2e')]=_[_0xfd6b('0x2f')](_0x342c56[_0xfd6b('0x29')],_0x342c56['query']);_0x3e0ead[_0xfd6b('0x30')]=_[_0xfd6b('0x2f')](_0x342c56[_0xfd6b('0x29')],qs[_0xfd6b('0x31')](_0x331e36[_0xfd6b('0x2b')][_0xfd6b('0x31')]));_0x3e0ead[_0xfd6b('0x30')]=_0x3e0ead['attributes']['length']?_0x3e0ead[_0xfd6b('0x30')]:_0x342c56[_0xfd6b('0x29')];if(!_0x331e36[_0xfd6b('0x2b')]['hasOwnProperty'](_0xfd6b('0x32'))){_0x3e0ead['limit']=qs[_0xfd6b('0x1d')](_0x331e36[_0xfd6b('0x2b')]['limit']);_0x3e0ead[_0xfd6b('0x1c')]=qs['offset'](_0x331e36[_0xfd6b('0x2b')][_0xfd6b('0x1c')]);}_0x3e0ead[_0xfd6b('0x33')]=qs['sort'](_0x331e36['query']['sort']);_0x3e0ead[_0xfd6b('0x34')]=qs['filters'](_[_0xfd6b('0x35')](_0x331e36[_0xfd6b('0x2b')],_0x342c56[_0xfd6b('0x2e')]));if(_0x500e63[_0xfd6b('0x2c')]){if(_0x500e63['dateEnd']){_0x500e63[_0xfd6b('0x2d')]=moment(_0x500e63[_0xfd6b('0x2d')])[_0xfd6b('0x36')](0x1,'day');}else{_0x500e63[_0xfd6b('0x2d')]=moment(_0x500e63['dateStart'])[_0xfd6b('0x36')](0x1,_0xfd6b('0x37'));}_[_0xfd6b('0x38')](_0x3e0ead[_0xfd6b('0x34')],{'createdAt':{'$gte':_0x500e63['dateStart'],'$lte':_0x500e63['dateEnd']}});}if(_0x331e36[_0xfd6b('0x2b')]['filter']){_0x3e0ead[_0xfd6b('0x34')]=_[_0xfd6b('0x38')](_0x3e0ead[_0xfd6b('0x34')],{'$or':_['map'](_0x3e0ead[_0xfd6b('0x30')],function(_0x24ec85){var _0x1fcf33={};_0x1fcf33[_0x24ec85]={'$like':'%'+_0x331e36[_0xfd6b('0x2b')][_0xfd6b('0x39')]+'%'};return _0x1fcf33;})});}_0x3e0ead=_[_0xfd6b('0x38')]({},_0x3e0ead,_0x331e36[_0xfd6b('0x3a')]);var _0x133abc={'where':_0x3e0ead[_0xfd6b('0x34')]};return db[_0xfd6b('0x28')][_0xfd6b('0x1b')](_0x133abc)['then'](function(_0x16e959){_0x53396a[_0xfd6b('0x1b')]=_0x16e959;if(_0x331e36['query'][_0xfd6b('0x3b')]){_0x3e0ead[_0xfd6b('0x3c')]=[{'all':!![]}];}return db[_0xfd6b('0x28')][_0xfd6b('0x3d')](_0x3e0ead);})[_0xfd6b('0x22')](function(_0x37ec58){_0x53396a[_0xfd6b('0x3e')]=_0x37ec58;return _0x53396a;})[_0xfd6b('0x22')](respondWithFilteredResult(_0x5a1cba,_0x3e0ead))[_0xfd6b('0x3f')](handleError(_0x5a1cba,null));};exports[_0xfd6b('0x40')]=function(_0x1f26db,_0x27dd6d){var _0x3d054f={'raw':!![],'where':{'id':_0x1f26db[_0xfd6b('0x41')]['id']}},_0x2df9a6={};_0x2df9a6[_0xfd6b('0x29')]=_['keys'](db['Cdr'][_0xfd6b('0x42')]);_0x2df9a6['query']=_[_0xfd6b('0x2a')](_0x1f26db[_0xfd6b('0x2b')]);_0x2df9a6[_0xfd6b('0x2e')]=_[_0xfd6b('0x2f')](_0x2df9a6[_0xfd6b('0x29')],_0x2df9a6[_0xfd6b('0x2b')]);_0x3d054f[_0xfd6b('0x30')]=_[_0xfd6b('0x2f')](_0x2df9a6[_0xfd6b('0x29')],qs[_0xfd6b('0x31')](_0x1f26db[_0xfd6b('0x2b')][_0xfd6b('0x31')]));_0x3d054f[_0xfd6b('0x30')]=_0x3d054f['attributes'][_0xfd6b('0x43')]?_0x3d054f[_0xfd6b('0x30')]:_0x2df9a6[_0xfd6b('0x29')];if(_0x1f26db[_0xfd6b('0x2b')][_0xfd6b('0x3b')]){_0x3d054f[_0xfd6b('0x3c')]=[{'all':!![]}];}_0x3d054f=_[_0xfd6b('0x38')]({},_0x3d054f,_0x1f26db['options']);return db[_0xfd6b('0x28')][_0xfd6b('0x44')](_0x3d054f)[_0xfd6b('0x22')](handleEntityNotFound(_0x27dd6d,null))['then'](respondWithResult(_0x27dd6d,null))[_0xfd6b('0x3f')](handleError(_0x27dd6d,null));};exports[_0xfd6b('0x45')]=function(_0x1caa95,_0x4dec4f){return db[_0xfd6b('0x28')][_0xfd6b('0x45')](_0x1caa95[_0xfd6b('0x46')],{})[_0xfd6b('0x22')](respondWithResult(_0x4dec4f,0xc9))[_0xfd6b('0x3f')](handleError(_0x4dec4f,null));};exports[_0xfd6b('0x47')]=function(_0x1a0c95,_0x4c0b76){if(_0x1a0c95[_0xfd6b('0x46')]['id']){delete _0x1a0c95['body']['id'];}return db[_0xfd6b('0x28')][_0xfd6b('0x44')]({'where':{'id':_0x1a0c95['params']['id']}})[_0xfd6b('0x22')](handleEntityNotFound(_0x4c0b76,null))[_0xfd6b('0x22')](saveUpdates(_0x1a0c95['body'],null))[_0xfd6b('0x22')](respondWithResult(_0x4c0b76,null))[_0xfd6b('0x3f')](handleError(_0x4c0b76,null));};exports[_0xfd6b('0x48')]=function(_0x782234,_0x4aa47d){return db[_0xfd6b('0x28')][_0xfd6b('0x44')]({'where':{'id':_0x782234[_0xfd6b('0x41')]['id']}})['then'](handleEntityNotFound(_0x4aa47d,null))[_0xfd6b('0x22')](removeEntity(_0x4aa47d,null))[_0xfd6b('0x3f')](handleError(_0x4aa47d,null));};exports['describe']=function(_0x4178c1,_0x34b917){return db[_0xfd6b('0x28')][_0xfd6b('0x49')]()[_0xfd6b('0x22')](respondWithResult(_0x34b917,null))[_0xfd6b('0x3f')](handleError(_0x34b917,null));}; \ No newline at end of file +var _0xd1d3=['lodash','crypto','jsforce','desk.js','to-csv','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','error','stack','name','send','index','Cdr','rawAttributes','model','query','dateEnd','dateStart','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','options','count','includeAll','include','findAll','show','params','find','catch','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x3f072a,_0x381b1e){var _0x45eb64=function(_0x5b8533){while(--_0x5b8533){_0x3f072a['push'](_0x3f072a['shift']());}};_0x45eb64(++_0x381b1e);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x584852,_0x3dda2c){_0x584852=_0x584852-0x0;var _0x46e21b=_0xd1d3[_0x584852];return _0x46e21b;};'use strict';var pdf=require(_0x3d1d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3d1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d1d('0x2'));var rp=require(_0x3d1d('0x3'));var moment=require(_0x3d1d('0x4'));var BPromise=require(_0x3d1d('0x5'));var Mustache=require(_0x3d1d('0x6'));var util=require('util');var path=require(_0x3d1d('0x7'));var sox=require(_0x3d1d('0x8'));var csv=require('to-csv');var ejs=require(_0x3d1d('0x9'));var fs=require('fs');var _=require(_0x3d1d('0xa'));var squel=require('squel');var crypto=require(_0x3d1d('0xb'));var jsforce=require(_0x3d1d('0xc'));var deskjs=require(_0x3d1d('0xd'));var toCsv=require(_0x3d1d('0xe'));var querystring=require(_0x3d1d('0xf'));var Papa=require(_0x3d1d('0x10'));var Redis=require(_0x3d1d('0x11'));var qs=require(_0x3d1d('0x12'));var logger=require(_0x3d1d('0x13'))(_0x3d1d('0x14'));var utils=require(_0x3d1d('0x15'));var config=require(_0x3d1d('0x16'));var db=require(_0x3d1d('0x17'))['db'];function respondWithStatusCode(_0xde1f63,_0x164a3a){_0x164a3a=_0x164a3a||0xcc;return function(_0x3cf0ad){if(_0x3cf0ad){return _0xde1f63[_0x3d1d('0x18')](_0x164a3a);}return _0xde1f63[_0x3d1d('0x19')](_0x164a3a)[_0x3d1d('0x1a')]();};}function respondWithResult(_0x5d7db5,_0x285bd2){_0x285bd2=_0x285bd2||0xc8;return function(_0x41a8ed){if(_0x41a8ed){return _0x5d7db5[_0x3d1d('0x19')](_0x285bd2)[_0x3d1d('0x1b')](_0x41a8ed);}};}function respondWithFilteredResult(_0x461a0a,_0x12dd84){return function(_0x4751b9){if(_0x4751b9){var _0x343fd1=_0x4751b9['count'],_0x59fa63=_0x12dd84['offset'],_0x325e90=_0x12dd84[_0x3d1d('0x1c')]+_0x12dd84[_0x3d1d('0x1d')],_0x128f51;if(_0x325e90>=_0x343fd1){_0x325e90=_0x343fd1;_0x128f51=0xc8;}else{_0x128f51=0xce;}_0x461a0a[_0x3d1d('0x19')](_0x128f51);return _0x461a0a[_0x3d1d('0x1e')]('Content-Range',_0x59fa63+'-'+_0x325e90+'/'+_0x343fd1)[_0x3d1d('0x1b')](_0x4751b9);}return null;};}function patchUpdates(_0x46bc02){return function(_0x1f6035){try{jsonpatch[_0x3d1d('0x1f')](_0x1f6035,_0x46bc02,!![]);}catch(_0x20ad94){return BPromise[_0x3d1d('0x20')](_0x20ad94);}return _0x1f6035['save']();};}function saveUpdates(_0x5d1af5,_0x5a749d){return function(_0x2b92d3){if(_0x2b92d3){return _0x2b92d3[_0x3d1d('0x21')](_0x5d1af5)[_0x3d1d('0x22')](function(_0xedf825){return _0xedf825;});}return null;};}function removeEntity(_0x1f5c7c,_0x4737f4){return function(_0x2c8b68){if(_0x2c8b68){return _0x2c8b68[_0x3d1d('0x23')]()[_0x3d1d('0x22')](function(){_0x1f5c7c['status'](0xcc)[_0x3d1d('0x1a')]();});}};}function handleEntityNotFound(_0x292392,_0x1dd00e){return function(_0x36331f){if(!_0x36331f){_0x292392['sendStatus'](0x194);}return _0x36331f;};}function handleError(_0x228735,_0x3dae29){_0x3dae29=_0x3dae29||0x1f4;return function(_0x4760a4){logger[_0x3d1d('0x24')](_0x4760a4[_0x3d1d('0x25')]);if(_0x4760a4['name']){delete _0x4760a4[_0x3d1d('0x26')];}_0x228735[_0x3d1d('0x19')](_0x3dae29)[_0x3d1d('0x27')](_0x4760a4);};}exports[_0x3d1d('0x28')]=function(_0x2f644c,_0xbda25a){var _0x49b800={},_0x5c07e2={},_0x4efc5c={'count':0x0,'rows':[]};var _0x2feb04=db[_0x3d1d('0x29')][_0x3d1d('0x2a')];_0x5c07e2[_0x3d1d('0x2b')]=_['keys'](_0x2feb04);var _0x4a4623={'dateStart':_0x2f644c[_0x3d1d('0x2c')]['dateStart'],'dateEnd':_0x2f644c[_0x3d1d('0x2c')][_0x3d1d('0x2d')]};delete _0x2f644c[_0x3d1d('0x2c')][_0x3d1d('0x2e')];delete _0x2f644c[_0x3d1d('0x2c')][_0x3d1d('0x2d')];_0x5c07e2[_0x3d1d('0x2c')]=_[_0x3d1d('0x2f')](_0x2f644c[_0x3d1d('0x2c')]);_0x5c07e2['filters']=_[_0x3d1d('0x30')](_0x5c07e2[_0x3d1d('0x2b')],_0x5c07e2[_0x3d1d('0x2c')]);_0x49b800[_0x3d1d('0x31')]=_[_0x3d1d('0x30')](_0x5c07e2[_0x3d1d('0x2b')],qs[_0x3d1d('0x32')](_0x2f644c[_0x3d1d('0x2c')]['fields']));_0x49b800[_0x3d1d('0x31')]=_0x49b800[_0x3d1d('0x31')][_0x3d1d('0x33')]?_0x49b800[_0x3d1d('0x31')]:_0x5c07e2[_0x3d1d('0x2b')];if(!_0x2f644c[_0x3d1d('0x2c')][_0x3d1d('0x34')](_0x3d1d('0x35'))){_0x49b800[_0x3d1d('0x1d')]=qs[_0x3d1d('0x1d')](_0x2f644c['query'][_0x3d1d('0x1d')]);_0x49b800[_0x3d1d('0x1c')]=qs[_0x3d1d('0x1c')](_0x2f644c[_0x3d1d('0x2c')][_0x3d1d('0x1c')]);}_0x49b800[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_0x2f644c[_0x3d1d('0x2c')][_0x3d1d('0x37')]);_0x49b800[_0x3d1d('0x38')]=qs[_0x3d1d('0x39')](_[_0x3d1d('0x3a')](_0x2f644c['query'],_0x5c07e2[_0x3d1d('0x39')]));if(_0x4a4623[_0x3d1d('0x2e')]){if(_0x4a4623[_0x3d1d('0x2d')]){_0x4a4623['dateEnd']=moment(_0x4a4623[_0x3d1d('0x2d')])[_0x3d1d('0x3b')](0x1,_0x3d1d('0x3c'));}else{_0x4a4623['dateEnd']=moment(_0x4a4623['dateStart'])[_0x3d1d('0x3b')](0x1,'day');}_['merge'](_0x49b800[_0x3d1d('0x38')],{'createdAt':{'$gte':_0x4a4623[_0x3d1d('0x2e')],'$lte':_0x4a4623[_0x3d1d('0x2d')]}});}if(_0x2f644c[_0x3d1d('0x2c')]['filter']){_0x49b800[_0x3d1d('0x38')]=_[_0x3d1d('0x3d')](_0x49b800[_0x3d1d('0x38')],{'$or':_['map'](_0x49b800[_0x3d1d('0x31')],function(_0x16661d){var _0x1b0c8d={};_0x1b0c8d[_0x16661d]={'$like':'%'+_0x2f644c[_0x3d1d('0x2c')][_0x3d1d('0x3e')]+'%'};return _0x1b0c8d;})});}_0x49b800=_[_0x3d1d('0x3d')]({},_0x49b800,_0x2f644c[_0x3d1d('0x3f')]);var _0x5a7a4d={'where':_0x49b800[_0x3d1d('0x38')]};return db[_0x3d1d('0x29')][_0x3d1d('0x40')](_0x5a7a4d)[_0x3d1d('0x22')](function(_0x2ee752){_0x4efc5c[_0x3d1d('0x40')]=_0x2ee752;if(_0x2f644c[_0x3d1d('0x2c')][_0x3d1d('0x41')]){_0x49b800[_0x3d1d('0x42')]=[{'all':!![]}];}return db[_0x3d1d('0x29')][_0x3d1d('0x43')](_0x49b800);})[_0x3d1d('0x22')](function(_0x564078){_0x4efc5c['rows']=_0x564078;return _0x4efc5c;})[_0x3d1d('0x22')](respondWithFilteredResult(_0xbda25a,_0x49b800))['catch'](handleError(_0xbda25a,null));};exports[_0x3d1d('0x44')]=function(_0x550213,_0x5ed1ba){var _0x3e750c={'raw':!![],'where':{'id':_0x550213[_0x3d1d('0x45')]['id']}},_0x12a8e3={};_0x12a8e3[_0x3d1d('0x2b')]=_[_0x3d1d('0x2f')](db[_0x3d1d('0x29')][_0x3d1d('0x2a')]);_0x12a8e3[_0x3d1d('0x2c')]=_[_0x3d1d('0x2f')](_0x550213[_0x3d1d('0x2c')]);_0x12a8e3[_0x3d1d('0x39')]=_[_0x3d1d('0x30')](_0x12a8e3[_0x3d1d('0x2b')],_0x12a8e3['query']);_0x3e750c[_0x3d1d('0x31')]=_[_0x3d1d('0x30')](_0x12a8e3[_0x3d1d('0x2b')],qs[_0x3d1d('0x32')](_0x550213[_0x3d1d('0x2c')][_0x3d1d('0x32')]));_0x3e750c[_0x3d1d('0x31')]=_0x3e750c['attributes']['length']?_0x3e750c['attributes']:_0x12a8e3[_0x3d1d('0x2b')];if(_0x550213[_0x3d1d('0x2c')][_0x3d1d('0x41')]){_0x3e750c['include']=[{'all':!![]}];}_0x3e750c=_[_0x3d1d('0x3d')]({},_0x3e750c,_0x550213[_0x3d1d('0x3f')]);return db[_0x3d1d('0x29')][_0x3d1d('0x46')](_0x3e750c)[_0x3d1d('0x22')](handleEntityNotFound(_0x5ed1ba,null))[_0x3d1d('0x22')](respondWithResult(_0x5ed1ba,null))[_0x3d1d('0x47')](handleError(_0x5ed1ba,null));};exports[_0x3d1d('0x48')]=function(_0xa4ced0,_0x1185b0){return db[_0x3d1d('0x29')][_0x3d1d('0x48')](_0xa4ced0[_0x3d1d('0x49')],{})['then'](respondWithResult(_0x1185b0,0xc9))['catch'](handleError(_0x1185b0,null));};exports[_0x3d1d('0x21')]=function(_0x3b856e,_0x5579ad){if(_0x3b856e[_0x3d1d('0x49')]['id']){delete _0x3b856e[_0x3d1d('0x49')]['id'];}return db[_0x3d1d('0x29')][_0x3d1d('0x46')]({'where':{'id':_0x3b856e[_0x3d1d('0x45')]['id']}})[_0x3d1d('0x22')](handleEntityNotFound(_0x5579ad,null))[_0x3d1d('0x22')](saveUpdates(_0x3b856e[_0x3d1d('0x49')],null))[_0x3d1d('0x22')](respondWithResult(_0x5579ad,null))[_0x3d1d('0x47')](handleError(_0x5579ad,null));};exports['destroy']=function(_0xd2194d,_0x1bc5bb){return db['Cdr'][_0x3d1d('0x46')]({'where':{'id':_0xd2194d[_0x3d1d('0x45')]['id']}})[_0x3d1d('0x22')](handleEntityNotFound(_0x1bc5bb,null))['then'](removeEntity(_0x1bc5bb,null))[_0x3d1d('0x47')](handleError(_0x1bc5bb,null));};exports['describe']=function(_0x5160df,_0x5a8984){return db[_0x3d1d('0x29')][_0x3d1d('0x4a')]()[_0x3d1d('0x22')](respondWithResult(_0x5a8984,null))[_0x3d1d('0x47')](handleError(_0x5a8984,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4a68e64..14dc4b8 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 _0x4648=['bluebird','request-promise','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0xaa716b,_0x480277){var _0x2f54f3=function(_0x4a4036){while(--_0x4a4036){_0xaa716b['push'](_0xaa716b['shift']());}};_0x2f54f3(++_0x480277);}(_0x4648,0x12d));var _0x8464=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x4648[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x8464('0x0'));var util=require(_0x8464('0x1'));var logger=require(_0x8464('0x2'))(_0x8464('0x3'));var moment=require(_0x8464('0x4'));var BPromise=require(_0x8464('0x5'));var rp=require(_0x8464('0x6'));var attributes=require(_0x8464('0x7'));module[_0x8464('0x8')]=function(_0x303eb1,_0x5e0e25){return _0x303eb1[_0x8464('0x9')](_0x8464('0xa'),attributes,{'tableName':_0x8464('0xb'),'paranoid':![],'indexes':[{'name':_0x8464('0xc'),'fields':['accountcode']},{'name':_0x8464('0xd'),'fields':['calldate']},{'name':'disposition','fields':[_0x8464('0xe')]},{'name':_0x8464('0xf'),'fields':[_0x8464('0xf')]},{'name':_0x8464('0x10'),'fields':['src']},{'name':'uniqueid','fields':[_0x8464('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1a8e=['request-promise','./cdr.attributes','exports','define','accountcode','calldate','disposition','dst','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4608ac,_0x340cd9){var _0x318daa=function(_0x58c895){while(--_0x58c895){_0x4608ac['push'](_0x4608ac['shift']());}};_0x318daa(++_0x340cd9);}(_0x1a8e,0x117));var _0xe1a8=function(_0x50c299,_0x16b857){_0x50c299=_0x50c299-0x0;var _0x375162=_0x1a8e[_0x50c299];return _0x375162;};'use strict';var _=require(_0xe1a8('0x0'));var util=require(_0xe1a8('0x1'));var logger=require(_0xe1a8('0x2'))(_0xe1a8('0x3'));var moment=require(_0xe1a8('0x4'));var BPromise=require(_0xe1a8('0x5'));var rp=require(_0xe1a8('0x6'));var attributes=require(_0xe1a8('0x7'));module[_0xe1a8('0x8')]=function(_0x2d83d8,_0x28075d){return _0x2d83d8[_0xe1a8('0x9')]('Cdr',attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xe1a8('0xa'),'fields':[_0xe1a8('0xa')]},{'name':_0xe1a8('0xb'),'fields':[_0xe1a8('0xb')]},{'name':_0xe1a8('0xc'),'fields':[_0xe1a8('0xc')]},{'name':_0xe1a8('0xd'),'fields':[_0xe1a8('0xd')]},{'name':'src','fields':['src']},{'name':_0xe1a8('0xe'),'fields':[_0xe1a8('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index e6d649d..b71c078 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 _0xbdd5=['Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x137cbb,_0x2caeb6){var _0x2c3fb8=function(_0x5b7bb9){while(--_0x5b7bb9){_0x137cbb['push'](_0x137cbb['shift']());}};_0x2c3fb8(++_0x2caeb6);}(_0xbdd5,0x84));var _0x5bdd=function(_0x2b12ac,_0x2f654b){_0x2b12ac=_0x2b12ac-0x0;var _0x177d3e=_0xbdd5[_0x2b12ac];return _0x177d3e;};'use strict';var _=require(_0x5bdd('0x0'));var util=require(_0x5bdd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bdd('0x2'));var db=require(_0x5bdd('0x3'))['db'];var utils=require(_0x5bdd('0x4'));var logger=require(_0x5bdd('0x5'))(_0x5bdd('0x6'));var config=require(_0x5bdd('0x7'));var jayson=require(_0x5bdd('0x8'));var client=jayson[_0x5bdd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31930d,_0x5ef552,_0x21b3f9){return new BPromise(function(_0x419ba2,_0x37b0d3){return client['request'](_0x31930d,_0x21b3f9)[_0x5bdd('0xa')](function(_0x2abf55){logger[_0x5bdd('0xb')](_0x5bdd('0xc'),_0x5ef552,_0x5bdd('0xd'));logger[_0x5bdd('0xe')](_0x5bdd('0xf'),_0x5ef552,_0x5bdd('0xd'),JSON['stringify'](_0x2abf55));if(_0x2abf55[_0x5bdd('0x10')]){if(_0x2abf55[_0x5bdd('0x10')][_0x5bdd('0x11')]===0x1f4){logger['error'](_0x5bdd('0xc'),_0x5ef552,_0x2abf55['error'][_0x5bdd('0x12')]);return _0x37b0d3(_0x2abf55[_0x5bdd('0x10')]['message']);}logger[_0x5bdd('0x10')](_0x5bdd('0xc'),_0x5ef552,_0x2abf55[_0x5bdd('0x10')][_0x5bdd('0x12')]);return _0x419ba2(_0x2abf55['error'][_0x5bdd('0x12')]);}else{logger[_0x5bdd('0xb')]('Cdr,\x20%s,\x20%s',_0x5ef552,_0x5bdd('0xd'));_0x419ba2(_0x2abf55[_0x5bdd('0x13')]['message']);}})[_0x5bdd('0x14')](function(_0x3020a9){logger[_0x5bdd('0x10')]('Cdr,\x20%s,\x20%s',_0x5ef552,_0x3020a9);_0x37b0d3(_0x3020a9);});});} \ No newline at end of file +var _0x2da3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','../../config/utils'];(function(_0x302f6d,_0x6b24ab){var _0x104915=function(_0x5e951d){while(--_0x5e951d){_0x302f6d['push'](_0x302f6d['shift']());}};_0x104915(++_0x6b24ab);}(_0x2da3,0x121));var _0x32da=function(_0x305b82,_0x40bdbc){_0x305b82=_0x305b82-0x0;var _0x7db37f=_0x2da3[_0x305b82];return _0x7db37f;};'use strict';var _=require(_0x32da('0x0'));var util=require(_0x32da('0x1'));var moment=require(_0x32da('0x2'));var BPromise=require(_0x32da('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32da('0x4'));var logger=require(_0x32da('0x5'))(_0x32da('0x6'));var config=require(_0x32da('0x7'));var jayson=require(_0x32da('0x8'));var client=jayson[_0x32da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a1f72,_0x9423a7,_0x3e9fb7){return new BPromise(function(_0x560f79,_0x3d1a5d){return client[_0x32da('0xa')](_0x1a1f72,_0x3e9fb7)[_0x32da('0xb')](function(_0x590c17){logger['info']('Cdr,\x20%s,\x20%s',_0x9423a7,'request\x20sent');logger['debug'](_0x32da('0xc'),_0x9423a7,'request\x20sent',JSON[_0x32da('0xd')](_0x590c17));if(_0x590c17[_0x32da('0xe')]){if(_0x590c17['error'][_0x32da('0xf')]===0x1f4){logger[_0x32da('0xe')](_0x32da('0x10'),_0x9423a7,_0x590c17[_0x32da('0xe')][_0x32da('0x11')]);return _0x3d1a5d(_0x590c17['error'][_0x32da('0x11')]);}logger[_0x32da('0xe')]('Cdr,\x20%s,\x20%s',_0x9423a7,_0x590c17[_0x32da('0xe')][_0x32da('0x11')]);return _0x560f79(_0x590c17['error']['message']);}else{logger['info'](_0x32da('0x10'),_0x9423a7,_0x32da('0x12'));_0x560f79(_0x590c17[_0x32da('0x13')][_0x32da('0x11')]);}})[_0x32da('0x14')](function(_0x590112){logger[_0x32da('0xe')](_0x32da('0x10'),_0x9423a7,_0x590112);_0x3d1a5d(_0x590112);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c8c5c3f..a3bbd01 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 _0xda55=['show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x50eb05,_0x4e8da7){var _0x494887=function(_0x342343){while(--_0x342343){_0x50eb05['push'](_0x50eb05['shift']());}};_0x494887(++_0x4e8da7);}(_0xda55,0x157));var _0x5da5=function(_0x2ecdbe,_0x114206){_0x2ecdbe=_0x2ecdbe-0x0;var _0x44d6d4=_0xda55[_0x2ecdbe];return _0x44d6d4;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require(_0x5da5('0x2'));var express=require(_0x5da5('0x3'));var router=express[_0x5da5('0x4')]();var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require(_0x5da5('0x7'));var controller=require(_0x5da5('0x8'));router['get']('/',auth[_0x5da5('0x9')](),controller['index']);router[_0x5da5('0xa')](_0x5da5('0xb'),auth[_0x5da5('0x9')](),controller[_0x5da5('0xc')]);router['get'](_0x5da5('0xd'),auth[_0x5da5('0x9')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')]('/',auth[_0x5da5('0x9')](),controller[_0x5da5('0x10')]);router['put']('/:id',auth[_0x5da5('0x9')](),controller[_0x5da5('0x11')]);router[_0x5da5('0x12')](_0x5da5('0xd'),auth[_0x5da5('0x9')](),controller[_0x5da5('0x13')]);module[_0x5da5('0x14')]=router; \ No newline at end of file +var _0xe73c=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update'];(function(_0x2190ef,_0x3d023f){var _0x1482a9=function(_0x51040a){while(--_0x51040a){_0x2190ef['push'](_0x2190ef['shift']());}};_0x1482a9(++_0x3d023f);}(_0xe73c,0x167));var _0xce73=function(_0x32bd85,_0x4a8919){_0x32bd85=_0x32bd85-0x0;var _0x45fff9=_0xe73c[_0x32bd85];return _0x45fff9;};'use strict';var multer=require(_0xce73('0x0'));var util=require(_0xce73('0x1'));var path=require(_0xce73('0x2'));var timeout=require(_0xce73('0x3'));var express=require(_0xce73('0x4'));var router=express[_0xce73('0x5')]();var auth=require(_0xce73('0x6'));var interaction=require(_0xce73('0x7'));var config=require(_0xce73('0x8'));var controller=require(_0xce73('0x9'));router[_0xce73('0xa')]('/',auth[_0xce73('0xb')](),controller[_0xce73('0xc')]);router['get'](_0xce73('0xd'),auth['isAuthenticated'](),controller[_0xce73('0xe')]);router[_0xce73('0xa')](_0xce73('0xf'),auth[_0xce73('0xb')](),controller[_0xce73('0x10')]);router['post']('/',auth[_0xce73('0xb')](),controller['create']);router[_0xce73('0x11')]('/:id',auth[_0xce73('0xb')](),controller[_0xce73('0x12')]);router['delete'](_0xce73('0xf'),auth[_0xce73('0xb')](),controller[_0xce73('0x13')]);module[_0xce73('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 63fa11d..7d7f391 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 _0xcc15=['exports','INTEGER','STRING','noop','sequelize'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0xcc15,0x108));var _0x5cc1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcc15[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x5cc1('0x0'));module[_0x5cc1('0x1')]={'priority':{'type':Sequelize[_0x5cc1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5cc1('0x3')],'allowNull':![],'defaultValue':_0x5cc1('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x5cc1('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5aae=['*,*,*,*','STRING','noop'];(function(_0x5dbd55,_0x446270){var _0x2396e8=function(_0x13ce95){while(--_0x13ce95){_0x5dbd55['push'](_0x5dbd55['shift']());}};_0x2396e8(++_0x446270);}(_0x5aae,0x115));var _0xe5aa=function(_0x1460ab,_0x74d06e){_0x1460ab=_0x1460ab-0x0;var _0x1eeb5c=_0x5aae[_0x1460ab];return _0x1eeb5c;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe5aa('0x0')],'allowNull':![],'defaultValue':_0xe5aa('0x1')},'appdata':{'type':Sequelize[_0xe5aa('0x0')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xe5aa('0x0')]},'interval':{'type':Sequelize[_0xe5aa('0x0')],'defaultValue':_0xe5aa('0x2')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 7cbbd27..5b755ad 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 _0x835c=['model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','catch','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','apply','reject','update','then','sendStatus','error','stack','name','params'];(function(_0x1c1df1,_0x1ede08){var _0x4ffa80=function(_0x4a9262){while(--_0x4a9262){_0x1c1df1['push'](_0x1c1df1['shift']());}};_0x4ffa80(++_0x1ede08);}(_0x835c,0xe4));var _0xc835=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x835c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc835('0x0'));var emlformat=require(_0xc835('0x1'));var rimraf=require(_0xc835('0x2'));var zipdir=require(_0xc835('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc835('0x4'));var BPromise=require(_0xc835('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc835('0x6'));var sox=require(_0xc835('0x7'));var csv=require('to-csv');var ejs=require(_0xc835('0x8'));var fs=require('fs');var _=require(_0xc835('0x9'));var squel=require(_0xc835('0xa'));var crypto=require(_0xc835('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc835('0xc'));var toCsv=require(_0xc835('0xd'));var querystring=require(_0xc835('0xe'));var Papa=require(_0xc835('0xf'));var Redis=require(_0xc835('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xc835('0x11'))(_0xc835('0x12'));var utils=require(_0xc835('0x13'));var config=require(_0xc835('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e2481,_0x232bd4){_0x232bd4=_0x232bd4||0xcc;return function(_0x411703){if(_0x411703){return _0x1e2481['sendStatus'](_0x232bd4);}return _0x1e2481[_0xc835('0x15')](_0x232bd4)[_0xc835('0x16')]();};}function respondWithResult(_0x2bd53d,_0x57bc65){_0x57bc65=_0x57bc65||0xc8;return function(_0x414265){if(_0x414265){return _0x2bd53d[_0xc835('0x15')](_0x57bc65)[_0xc835('0x17')](_0x414265);}};}function respondWithFilteredResult(_0x112350,_0x555742){return function(_0xe91428){if(_0xe91428){var _0x4eb2eb=_0xe91428[_0xc835('0x18')],_0x247a02=_0x555742[_0xc835('0x19')],_0x5e57af=_0x555742[_0xc835('0x19')]+_0x555742[_0xc835('0x1a')],_0x5cb687;if(_0x5e57af>=_0x4eb2eb){_0x5e57af=_0x4eb2eb;_0x5cb687=0xc8;}else{_0x5cb687=0xce;}_0x112350[_0xc835('0x15')](_0x5cb687);return _0x112350[_0xc835('0x1b')]('Content-Range',_0x247a02+'-'+_0x5e57af+'/'+_0x4eb2eb)[_0xc835('0x17')](_0xe91428);}return null;};}function patchUpdates(_0x5e7eb1){return function(_0x4df739){try{jsonpatch[_0xc835('0x1c')](_0x4df739,_0x5e7eb1,!![]);}catch(_0x44901b){return BPromise[_0xc835('0x1d')](_0x44901b);}return _0x4df739['save']();};}function saveUpdates(_0x3f6893,_0x51bfc3){return function(_0x2abe99){if(_0x2abe99){return _0x2abe99[_0xc835('0x1e')](_0x3f6893)[_0xc835('0x1f')](function(_0x5f3748){return _0x5f3748;});}return null;};}function removeEntity(_0x8a6703,_0x11c310){return function(_0x37043b){if(_0x37043b){return _0x37043b['destroy']()['then'](function(){_0x8a6703[_0xc835('0x15')](0xcc)[_0xc835('0x16')]();});}};}function handleEntityNotFound(_0x53869b,_0x3a4963){return function(_0x1002fa){if(!_0x1002fa){_0x53869b[_0xc835('0x20')](0x194);}return _0x1002fa;};}function handleError(_0x34c237,_0x643891){_0x643891=_0x643891||0x1f4;return function(_0x2c4275){logger[_0xc835('0x21')](_0x2c4275[_0xc835('0x22')]);if(_0x2c4275[_0xc835('0x23')]){delete _0x2c4275[_0xc835('0x23')];}_0x34c237[_0xc835('0x15')](_0x643891)['send'](_0x2c4275);};}exports['show']=function(_0x2e382b,_0x464877){var _0x4683b3={'raw':!![],'where':{'id':_0x2e382b[_0xc835('0x24')]['id']}},_0x312db3={};_0x312db3[_0xc835('0x25')]=_[_0xc835('0x26')](db[_0xc835('0x27')][_0xc835('0x28')]);_0x312db3[_0xc835('0x29')]=_['keys'](_0x2e382b['query']);_0x312db3[_0xc835('0x2a')]=_[_0xc835('0x2b')](_0x312db3['model'],_0x312db3[_0xc835('0x29')]);_0x4683b3[_0xc835('0x2c')]=_[_0xc835('0x2b')](_0x312db3[_0xc835('0x25')],qs[_0xc835('0x2d')](_0x2e382b['query'][_0xc835('0x2d')]));_0x4683b3[_0xc835('0x2c')]=_0x4683b3[_0xc835('0x2c')][_0xc835('0x2e')]?_0x4683b3[_0xc835('0x2c')]:_0x312db3[_0xc835('0x25')];if(_0x2e382b[_0xc835('0x29')][_0xc835('0x2f')]){_0x4683b3['include']=[{'all':!![]}];}_0x4683b3=_[_0xc835('0x30')]({},_0x4683b3,_0x2e382b[_0xc835('0x31')]);return db[_0xc835('0x27')][_0xc835('0x32')](_0x4683b3)['then'](handleEntityNotFound(_0x464877,null))[_0xc835('0x1f')](respondWithResult(_0x464877,null))['catch'](handleError(_0x464877,null));};exports[_0xc835('0x1e')]=function(_0x55ebd6,_0x6c1c4f){if(_0x55ebd6[_0xc835('0x33')]['id']){delete _0x55ebd6[_0xc835('0x33')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x55ebd6[_0xc835('0x24')]['id']}})['then'](handleEntityNotFound(_0x6c1c4f,null))['then'](saveUpdates(_0x55ebd6[_0xc835('0x33')],null))['then'](respondWithResult(_0x6c1c4f,null))[_0xc835('0x34')](handleError(_0x6c1c4f,null));};exports['destroy']=function(_0x25d205,_0x310a32){return db[_0xc835('0x27')]['find']({'where':{'id':_0x25d205['params']['id']}})['then'](handleEntityNotFound(_0x310a32,null))['then'](removeEntity(_0x310a32,null))[_0xc835('0x34')](handleError(_0x310a32,null));}; \ No newline at end of file +var _0xd99e=['util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','error','stack','name','show','params','ChatApplication','filters','model','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x31094a,_0x4ea45e){var _0x37092c=function(_0x44423e){while(--_0x44423e){_0x31094a['push'](_0x31094a['shift']());}};_0x37092c(++_0x4ea45e);}(_0xd99e,0x1a8));var _0xed99=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0xd99e[_0xaf25ae];return _0x49732d;};'use strict';var pdf=require(_0xed99('0x0'));var emlformat=require(_0xed99('0x1'));var rimraf=require(_0xed99('0x2'));var zipdir=require(_0xed99('0x3'));var jsonpatch=require(_0xed99('0x4'));var rp=require(_0xed99('0x5'));var moment=require(_0xed99('0x6'));var BPromise=require(_0xed99('0x7'));var Mustache=require('mustache');var util=require(_0xed99('0x8'));var path=require(_0xed99('0x9'));var sox=require(_0xed99('0xa'));var csv=require('to-csv');var ejs=require(_0xed99('0xb'));var fs=require('fs');var _=require(_0xed99('0xc'));var squel=require(_0xed99('0xd'));var crypto=require(_0xed99('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xed99('0xf'));var toCsv=require(_0xed99('0x10'));var querystring=require('querystring');var Papa=require(_0xed99('0x11'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xed99('0x12'))('api');var utils=require(_0xed99('0x13'));var config=require('../../config/environment');var db=require(_0xed99('0x14'))['db'];function respondWithStatusCode(_0x2f61f5,_0x995348){_0x995348=_0x995348||0xcc;return function(_0x38a531){if(_0x38a531){return _0x2f61f5[_0xed99('0x15')](_0x995348);}return _0x2f61f5[_0xed99('0x16')](_0x995348)[_0xed99('0x17')]();};}function respondWithResult(_0x342ac1,_0x38fca8){_0x38fca8=_0x38fca8||0xc8;return function(_0x2630fe){if(_0x2630fe){return _0x342ac1[_0xed99('0x16')](_0x38fca8)[_0xed99('0x18')](_0x2630fe);}};}function respondWithFilteredResult(_0x60fae1,_0x406f40){return function(_0x3c8176){if(_0x3c8176){var _0xa94606=_0x3c8176[_0xed99('0x19')],_0x20e80e=_0x406f40[_0xed99('0x1a')],_0x334663=_0x406f40['offset']+_0x406f40[_0xed99('0x1b')],_0x55ec38;if(_0x334663>=_0xa94606){_0x334663=_0xa94606;_0x55ec38=0xc8;}else{_0x55ec38=0xce;}_0x60fae1['status'](_0x55ec38);return _0x60fae1['set'](_0xed99('0x1c'),_0x20e80e+'-'+_0x334663+'/'+_0xa94606)[_0xed99('0x18')](_0x3c8176);}return null;};}function patchUpdates(_0x50a8b6){return function(_0x5a96e3){try{jsonpatch[_0xed99('0x1d')](_0x5a96e3,_0x50a8b6,!![]);}catch(_0x48fa93){return BPromise[_0xed99('0x1e')](_0x48fa93);}return _0x5a96e3['save']();};}function saveUpdates(_0x44b0a5,_0x1cd957){return function(_0x2a65f0){if(_0x2a65f0){return _0x2a65f0[_0xed99('0x1f')](_0x44b0a5)['then'](function(_0xc5b9bb){return _0xc5b9bb;});}return null;};}function removeEntity(_0x4455b3,_0x4b240a){return function(_0x595b3a){if(_0x595b3a){return _0x595b3a[_0xed99('0x20')]()[_0xed99('0x21')](function(){_0x4455b3[_0xed99('0x16')](0xcc)[_0xed99('0x17')]();});}};}function handleEntityNotFound(_0x5a3054,_0x191258){return function(_0xe27bed){if(!_0xe27bed){_0x5a3054['sendStatus'](0x194);}return _0xe27bed;};}function handleError(_0x380c6b,_0x28782b){_0x28782b=_0x28782b||0x1f4;return function(_0x24888c){logger[_0xed99('0x22')](_0x24888c[_0xed99('0x23')]);if(_0x24888c[_0xed99('0x24')]){delete _0x24888c['name'];}_0x380c6b['status'](_0x28782b)['send'](_0x24888c);};}exports[_0xed99('0x25')]=function(_0x1b22c7,_0x506561){var _0x4e1da9={'raw':!![],'where':{'id':_0x1b22c7[_0xed99('0x26')]['id']}},_0x54e89d={};_0x54e89d['model']=_['keys'](db[_0xed99('0x27')]['rawAttributes']);_0x54e89d['query']=_['keys'](_0x1b22c7['query']);_0x54e89d[_0xed99('0x28')]=_['intersection'](_0x54e89d[_0xed99('0x29')],_0x54e89d[_0xed99('0x2a')]);_0x4e1da9[_0xed99('0x2b')]=_[_0xed99('0x2c')](_0x54e89d[_0xed99('0x29')],qs[_0xed99('0x2d')](_0x1b22c7[_0xed99('0x2a')][_0xed99('0x2d')]));_0x4e1da9['attributes']=_0x4e1da9[_0xed99('0x2b')][_0xed99('0x2e')]?_0x4e1da9[_0xed99('0x2b')]:_0x54e89d[_0xed99('0x29')];if(_0x1b22c7['query'][_0xed99('0x2f')]){_0x4e1da9[_0xed99('0x30')]=[{'all':!![]}];}_0x4e1da9=_[_0xed99('0x31')]({},_0x4e1da9,_0x1b22c7[_0xed99('0x32')]);return db['ChatApplication'][_0xed99('0x33')](_0x4e1da9)[_0xed99('0x21')](handleEntityNotFound(_0x506561,null))[_0xed99('0x21')](respondWithResult(_0x506561,null))[_0xed99('0x34')](handleError(_0x506561,null));};exports[_0xed99('0x1f')]=function(_0x16a135,_0x30e9bd){if(_0x16a135[_0xed99('0x35')]['id']){delete _0x16a135[_0xed99('0x35')]['id'];}return db[_0xed99('0x27')][_0xed99('0x33')]({'where':{'id':_0x16a135[_0xed99('0x26')]['id']}})[_0xed99('0x21')](handleEntityNotFound(_0x30e9bd,null))[_0xed99('0x21')](saveUpdates(_0x16a135[_0xed99('0x35')],null))[_0xed99('0x21')](respondWithResult(_0x30e9bd,null))[_0xed99('0x34')](handleError(_0x30e9bd,null));};exports[_0xed99('0x20')]=function(_0x1d64ab,_0x4ed8c2){return db[_0xed99('0x27')]['find']({'where':{'id':_0x1d64ab['params']['id']}})['then'](handleEntityNotFound(_0x4ed8c2,null))[_0xed99('0x21')](removeEntity(_0x4ed8c2,null))[_0xed99('0x34')](handleError(_0x4ed8c2,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index b11d5ab..256af02 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 _0x708a=['exports','chat_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatApplication.attributes'];(function(_0x2a17db,_0x5a8487){var _0x5184dd=function(_0x161c99){while(--_0x161c99){_0x2a17db['push'](_0x2a17db['shift']());}};_0x5184dd(++_0x5a8487);}(_0x708a,0x174));var _0xa708=function(_0x22acd2,_0x51e929){_0x22acd2=_0x22acd2-0x0;var _0x355f76=_0x708a[_0x22acd2];return _0x355f76;};'use strict';var _=require(_0xa708('0x0'));var util=require(_0xa708('0x1'));var logger=require(_0xa708('0x2'))(_0xa708('0x3'));var moment=require(_0xa708('0x4'));var BPromise=require(_0xa708('0x5'));var rp=require(_0xa708('0x6'));var attributes=require(_0xa708('0x7'));module[_0xa708('0x8')]=function(_0x2e4e8b,_0x124c65){return _0x2e4e8b['define']('ChatApplication',attributes,{'tableName':_0xa708('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba86=['define','ChatApplication','chat_applications','lodash','../../config/logger','moment','bluebird','request-promise','./chatApplication.attributes','exports'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0xba86,0xb7));var _0x6ba8=function(_0x1639a8,_0x39abd1){_0x1639a8=_0x1639a8-0x0;var _0x177300=_0xba86[_0x1639a8];return _0x177300;};'use strict';var _=require(_0x6ba8('0x0'));var util=require('util');var logger=require(_0x6ba8('0x1'))('api');var moment=require(_0x6ba8('0x2'));var BPromise=require(_0x6ba8('0x3'));var rp=require(_0x6ba8('0x4'));var attributes=require(_0x6ba8('0x5'));module[_0x6ba8('0x6')]=function(_0x4e5b9d,_0x5e0593){return _0x4e5b9d[_0x6ba8('0x7')](_0x6ba8('0x8'),attributes,{'tableName':_0x6ba8('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 6352f9a..3609691 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 _0xa968=['error','code','message','info','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x299cc9,_0x36ac0c){var _0x2f8681=function(_0x446eb4){while(--_0x446eb4){_0x299cc9['push'](_0x299cc9['shift']());}};_0x2f8681(++_0x36ac0c);}(_0xa968,0x92));var _0x8a96=function(_0x152449,_0xd1e036){_0x152449=_0x152449-0x0;var _0x368320=_0xa968[_0x152449];return _0x368320;};'use strict';var _=require(_0x8a96('0x0'));var util=require(_0x8a96('0x1'));var moment=require(_0x8a96('0x2'));var BPromise=require(_0x8a96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a96('0x4'));var db=require(_0x8a96('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8a96('0x6'));var config=require(_0x8a96('0x7'));var jayson=require(_0x8a96('0x8'));var client=jayson[_0x8a96('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3531ca,_0x10db13,_0x5e1583){return new BPromise(function(_0x369aa7,_0x42706a){return client['request'](_0x3531ca,_0x5e1583)[_0x8a96('0xa')](function(_0x16c8ae){logger['info'](_0x8a96('0xb'),_0x10db13,'request\x20sent');logger['debug'](_0x8a96('0xc'),_0x10db13,'request\x20sent',JSON[_0x8a96('0xd')](_0x16c8ae));if(_0x16c8ae[_0x8a96('0xe')]){if(_0x16c8ae[_0x8a96('0xe')][_0x8a96('0xf')]===0x1f4){logger[_0x8a96('0xe')]('ChatApplication,\x20%s,\x20%s',_0x10db13,_0x16c8ae['error'][_0x8a96('0x10')]);return _0x42706a(_0x16c8ae[_0x8a96('0xe')]['message']);}logger[_0x8a96('0xe')](_0x8a96('0xb'),_0x10db13,_0x16c8ae['error']['message']);return _0x369aa7(_0x16c8ae['error'][_0x8a96('0x10')]);}else{logger[_0x8a96('0x11')](_0x8a96('0xb'),_0x10db13,_0x8a96('0x12'));_0x369aa7(_0x16c8ae['result'][_0x8a96('0x10')]);}})[_0x8a96('0x13')](function(_0xdc1638){logger[_0x8a96('0xe')]('ChatApplication,\x20%s,\x20%s',_0x10db13,_0xdc1638);_0x42706a(_0xdc1638);});});} \ No newline at end of file +var _0xfc42=['message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x580cee,_0x189c97){var _0x47dfe9=function(_0x6a17d3){while(--_0x6a17d3){_0x580cee['push'](_0x580cee['shift']());}};_0x47dfe9(++_0x189c97);}(_0xfc42,0xd2));var _0x2fc4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfc42[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x2fc4('0x0'));var moment=require(_0x2fc4('0x1'));var BPromise=require(_0x2fc4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fc4('0x3'));var db=require(_0x2fc4('0x4'))['db'];var utils=require(_0x2fc4('0x5'));var logger=require(_0x2fc4('0x6'))('rpc');var config=require(_0x2fc4('0x7'));var jayson=require(_0x2fc4('0x8'));var client=jayson[_0x2fc4('0x9')][_0x2fc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56e6a3,_0x2ef457,_0x47d7f4){return new BPromise(function(_0xa02d5f,_0x47a85d){return client[_0x2fc4('0xb')](_0x56e6a3,_0x47d7f4)[_0x2fc4('0xc')](function(_0x4799c3){logger[_0x2fc4('0xd')](_0x2fc4('0xe'),_0x2ef457,_0x2fc4('0xf'));logger[_0x2fc4('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x2ef457,'request\x20sent',JSON[_0x2fc4('0x11')](_0x4799c3));if(_0x4799c3['error']){if(_0x4799c3[_0x2fc4('0x12')][_0x2fc4('0x13')]===0x1f4){logger[_0x2fc4('0x12')](_0x2fc4('0xe'),_0x2ef457,_0x4799c3[_0x2fc4('0x12')]['message']);return _0x47a85d(_0x4799c3['error'][_0x2fc4('0x14')]);}logger['error'](_0x2fc4('0xe'),_0x2ef457,_0x4799c3[_0x2fc4('0x12')][_0x2fc4('0x14')]);return _0xa02d5f(_0x4799c3['error']['message']);}else{logger[_0x2fc4('0xd')](_0x2fc4('0xe'),_0x2ef457,_0x2fc4('0xf'));_0xa02d5f(_0x4799c3[_0x2fc4('0x15')][_0x2fc4('0x14')]);}})[_0x2fc4('0x16')](function(_0xec8680){logger[_0x2fc4('0x12')]('ChatApplication,\x20%s,\x20%s',_0x2ef457,_0xec8680);_0x47a85d(_0xec8680);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a08af2f..12c0030 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 _0x3dbf=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','/:id','show','put','isAuthenticated'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x3dbf,0x144));var _0xf3db=function(_0x51e496,_0xcd0e4b){_0x51e496=_0x51e496-0x0;var _0x19cb20=_0x3dbf[_0x51e496];return _0x19cb20;};'use strict';var multer=require(_0xf3db('0x0'));var util=require(_0xf3db('0x1'));var path=require('path');var timeout=require(_0xf3db('0x2'));var express=require(_0xf3db('0x3'));var router=express[_0xf3db('0x4')]();var auth=require(_0xf3db('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf3db('0x6'));var controller=require('./chatApplication.controller');router[_0xf3db('0x7')](_0xf3db('0x8'),auth['isAuthenticated'](),controller[_0xf3db('0x9')]);router[_0xf3db('0xa')]('/:id',auth[_0xf3db('0xb')](),controller[_0xf3db('0xc')]);router[_0xf3db('0xd')](_0xf3db('0x8'),auth[_0xf3db('0xb')](),controller[_0xf3db('0xe')]);module[_0xf3db('0xf')]=router; \ No newline at end of file +var _0x5c10=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0x3d9568,_0x3325a9){var _0x356419=function(_0x479b53){while(--_0x479b53){_0x3d9568['push'](_0x3d9568['shift']());}};_0x356419(++_0x3325a9);}(_0x5c10,0x6b));var _0x05c1=function(_0x4545b3,_0xbb9164){_0x4545b3=_0x4545b3-0x0;var _0x47fb41=_0x5c10[_0x4545b3];return _0x47fb41;};'use strict';var multer=require(_0x05c1('0x0'));var util=require(_0x05c1('0x1'));var path=require('path');var timeout=require(_0x05c1('0x2'));var express=require(_0x05c1('0x3'));var router=express[_0x05c1('0x4')]();var auth=require(_0x05c1('0x5'));var interaction=require(_0x05c1('0x6'));var config=require(_0x05c1('0x7'));var controller=require(_0x05c1('0x8'));router[_0x05c1('0x9')](_0x05c1('0xa'),auth[_0x05c1('0xb')](),controller[_0x05c1('0xc')]);router[_0x05c1('0xd')](_0x05c1('0xa'),auth['isAuthenticated'](),controller[_0x05c1('0xe')]);router[_0x05c1('0xf')](_0x05c1('0xa'),auth[_0x05c1('0xb')](),controller[_0x05c1('0x10')]);module[_0x05c1('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 36bacde..d0a56c6 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 _0x7ace=['BOOLEAN','sequelize','exports','STRING'];(function(_0x53bb44,_0x3666af){var _0x2105ad=function(_0x504cf5){while(--_0x504cf5){_0x53bb44['push'](_0x53bb44['shift']());}};_0x2105ad(++_0x3666af);}(_0x7ace,0x14d));var _0xe7ac=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x7ace[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0xe7ac('0x0'));module[_0xe7ac('0x1')]={'name':{'type':Sequelize[_0xe7ac('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe7ac('0x2')]},'write':{'type':Sequelize[_0xe7ac('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2bc7=['STRING','sequelize','exports'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0x2bc7,0x1cc));var _0x72bc=function(_0x50db26,_0x366dee){_0x50db26=_0x50db26-0x0;var _0xb64d16=_0x2bc7[_0x50db26];return _0xb64d16;};'use strict';var Sequelize=require(_0x72bc('0x0'));module[_0x72bc('0x1')]={'name':{'type':Sequelize[_0x72bc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x72bc('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 7b5961e..ab4369e 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 _0xa6f2=['message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','day','add','filter','merge','map','options','ChatGroup','includeAll','include','findAll','rows','show','find','create','body','describe','getUnread','user','toInteger','params','addMembers','ids','getMembers','findOne','User','nolimit','removeMembers','ChatGroupId','getMessages','ChatInternalMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa6f2,0x118));var _0x2a6f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa6f2[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2a6f('0x0'));var rimraf=require(_0x2a6f('0x1'));var zipdir=require(_0x2a6f('0x2'));var jsonpatch=require(_0x2a6f('0x3'));var rp=require(_0x2a6f('0x4'));var moment=require(_0x2a6f('0x5'));var BPromise=require(_0x2a6f('0x6'));var Mustache=require(_0x2a6f('0x7'));var util=require(_0x2a6f('0x8'));var path=require('path');var sox=require(_0x2a6f('0x9'));var csv=require(_0x2a6f('0xa'));var ejs=require(_0x2a6f('0xb'));var fs=require('fs');var _=require(_0x2a6f('0xc'));var squel=require(_0x2a6f('0xd'));var crypto=require(_0x2a6f('0xe'));var jsforce=require(_0x2a6f('0xf'));var deskjs=require(_0x2a6f('0x10'));var toCsv=require(_0x2a6f('0xa'));var querystring=require(_0x2a6f('0x11'));var Papa=require(_0x2a6f('0x12'));var Redis=require(_0x2a6f('0x13'));var qs=require(_0x2a6f('0x14'));var logger=require(_0x2a6f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2a6f('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2a6f('0x17')](config[_0x2a6f('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a6f('0x19'))(new Redis(config[_0x2a6f('0x18')]));require('./chatGroup.socket')[_0x2a6f('0x1a')](socket);var jayson=require(_0x2a6f('0x1b'));var client=jayson[_0x2a6f('0x1c')][_0x2a6f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4ef7aa,_0x486b42,_0x59ae08,_0x59b8c4){return new BPromise(function(_0x3ead3f,_0x46a134){var _0x49e42b=_0x59b8c4||client;return _0x49e42b[_0x2a6f('0x1e')](_0x4ef7aa,_0x59ae08)[_0x2a6f('0x1f')](function(_0x2fb152){logger['info'](_0x2a6f('0x20'),_0x486b42,_0x2a6f('0x21'));logger[_0x2a6f('0x22')](_0x2a6f('0x23'),_0x486b42,_0x2a6f('0x21'),JSON['stringify'](_0x2fb152));if(_0x2fb152[_0x2a6f('0x24')]){if(_0x2fb152[_0x2a6f('0x24')][_0x2a6f('0x25')]===0x1f4){logger['error'](_0x2a6f('0x20'),_0x486b42,_0x2fb152['error'][_0x2a6f('0x26')]);return _0x46a134(_0x2fb152[_0x2a6f('0x24')][_0x2a6f('0x26')]);}logger[_0x2a6f('0x24')](_0x2a6f('0x20'),_0x486b42,_0x2fb152[_0x2a6f('0x24')][_0x2a6f('0x26')]);return _0x3ead3f(_0x2fb152[_0x2a6f('0x24')]['message']);}else{logger[_0x2a6f('0x27')](_0x2a6f('0x20'),_0x486b42,_0x2a6f('0x21'));_0x3ead3f(_0x2fb152[_0x2a6f('0x28')]['message']);}})[_0x2a6f('0x29')](function(_0xfdae5d){logger[_0x2a6f('0x24')]('ChatGroup,\x20%s,\x20%s',_0x486b42,_0xfdae5d);_0x46a134(_0xfdae5d);});});}function respondWithStatusCode(_0x2b1e86,_0x1d238c){_0x1d238c=_0x1d238c||0xcc;return function(_0x17deb3){if(_0x17deb3){return _0x2b1e86[_0x2a6f('0x2a')](_0x1d238c);}return _0x2b1e86[_0x2a6f('0x2b')](_0x1d238c)[_0x2a6f('0x2c')]();};}function respondWithResult(_0x3961f9,_0x42b3ed){_0x42b3ed=_0x42b3ed||0xc8;return function(_0x36b9d7){if(_0x36b9d7){return _0x3961f9['status'](_0x42b3ed)[_0x2a6f('0x2d')](_0x36b9d7);}};}function respondWithFilteredResult(_0x5982dc,_0x441414){return function(_0x14ab15){if(_0x14ab15){var _0x1b2506=_0x14ab15[_0x2a6f('0x2e')],_0x5375bb=_0x441414[_0x2a6f('0x2f')],_0x5b898e=_0x441414['offset']+_0x441414[_0x2a6f('0x30')],_0x261649;if(_0x5b898e>=_0x1b2506){_0x5b898e=_0x1b2506;_0x261649=0xc8;}else{_0x261649=0xce;}_0x5982dc[_0x2a6f('0x2b')](_0x261649);return _0x5982dc[_0x2a6f('0x31')]('Content-Range',_0x5375bb+'-'+_0x5b898e+'/'+_0x1b2506)[_0x2a6f('0x2d')](_0x14ab15);}return null;};}function patchUpdates(_0x524617){return function(_0x15f9d2){try{jsonpatch[_0x2a6f('0x32')](_0x15f9d2,_0x524617,!![]);}catch(_0x36d639){return BPromise[_0x2a6f('0x33')](_0x36d639);}return _0x15f9d2[_0x2a6f('0x34')]();};}function saveUpdates(_0x2ea7a4,_0x45b6c4){return function(_0x29b4b3){if(_0x29b4b3){return _0x29b4b3[_0x2a6f('0x35')](_0x2ea7a4)[_0x2a6f('0x1f')](function(_0x229818){return _0x229818;});}return null;};}function removeEntity(_0x515b07,_0x3aed98){return function(_0x4d0b58){if(_0x4d0b58){return _0x4d0b58[_0x2a6f('0x36')]()['then'](function(){_0x515b07[_0x2a6f('0x2b')](0xcc)[_0x2a6f('0x2c')]();});}};}function handleEntityNotFound(_0x25d6fc,_0x2e7ca2){return function(_0xde39e7){if(!_0xde39e7){_0x25d6fc['sendStatus'](0x194);}return _0xde39e7;};}function handleError(_0x14bd65,_0x4595e4){_0x4595e4=_0x4595e4||0x1f4;return function(_0x410de6){logger[_0x2a6f('0x24')](_0x410de6[_0x2a6f('0x37')]);if(_0x410de6['name']){delete _0x410de6[_0x2a6f('0x38')];}_0x14bd65[_0x2a6f('0x2b')](_0x4595e4)['send'](_0x410de6);};}exports['index']=function(_0x519fb8,_0x47c861){var _0x1c525b={},_0x366afe={},_0x2893de={'count':0x0,'rows':[]};var _0xbe2815=db['ChatGroup'][_0x2a6f('0x39')];_0x366afe[_0x2a6f('0x3a')]=_[_0x2a6f('0x3b')](_0xbe2815);var _0x356b6c={'dateStart':_0x519fb8[_0x2a6f('0x3c')][_0x2a6f('0x3d')],'dateEnd':_0x519fb8['query'][_0x2a6f('0x3e')]};delete _0x519fb8[_0x2a6f('0x3c')][_0x2a6f('0x3d')];delete _0x519fb8[_0x2a6f('0x3c')][_0x2a6f('0x3e')];_0x366afe['query']=_['keys'](_0x519fb8[_0x2a6f('0x3c')]);_0x366afe[_0x2a6f('0x3f')]=_['intersection'](_0x366afe['model'],_0x366afe[_0x2a6f('0x3c')]);_0x1c525b[_0x2a6f('0x40')]=_[_0x2a6f('0x41')](_0x366afe['model'],qs[_0x2a6f('0x42')](_0x519fb8[_0x2a6f('0x3c')][_0x2a6f('0x42')]));_0x1c525b[_0x2a6f('0x40')]=_0x1c525b[_0x2a6f('0x40')][_0x2a6f('0x43')]?_0x1c525b[_0x2a6f('0x40')]:_0x366afe[_0x2a6f('0x3a')];if(!_0x519fb8[_0x2a6f('0x3c')][_0x2a6f('0x44')]('nolimit')){_0x1c525b[_0x2a6f('0x30')]=qs[_0x2a6f('0x30')](_0x519fb8['query'][_0x2a6f('0x30')]);_0x1c525b[_0x2a6f('0x2f')]=qs[_0x2a6f('0x2f')](_0x519fb8[_0x2a6f('0x3c')]['offset']);}_0x1c525b[_0x2a6f('0x45')]=qs[_0x2a6f('0x46')](_0x519fb8['query']['sort']);_0x1c525b[_0x2a6f('0x47')]=qs[_0x2a6f('0x3f')](_[_0x2a6f('0x48')](_0x519fb8[_0x2a6f('0x3c')],_0x366afe[_0x2a6f('0x3f')]));if(_0x356b6c['dateStart']){if(_0x356b6c['dateEnd']){_0x356b6c[_0x2a6f('0x3e')]=moment(_0x356b6c[_0x2a6f('0x3e')])['add'](0x1,_0x2a6f('0x49'));}else{_0x356b6c['dateEnd']=moment(_0x356b6c[_0x2a6f('0x3d')])[_0x2a6f('0x4a')](0x1,_0x2a6f('0x49'));}_['merge'](_0x1c525b[_0x2a6f('0x47')],{'createdAt':{'$gte':_0x356b6c[_0x2a6f('0x3d')],'$lte':_0x356b6c[_0x2a6f('0x3e')]}});}if(_0x519fb8[_0x2a6f('0x3c')][_0x2a6f('0x4b')]){_0x1c525b[_0x2a6f('0x47')]=_[_0x2a6f('0x4c')](_0x1c525b[_0x2a6f('0x47')],{'$or':_[_0x2a6f('0x4d')](_0x1c525b[_0x2a6f('0x40')],function(_0x3e7ee9){var _0x36722f={};_0x36722f[_0x3e7ee9]={'$like':'%'+_0x519fb8[_0x2a6f('0x3c')][_0x2a6f('0x4b')]+'%'};return _0x36722f;})});}_0x1c525b=_['merge']({},_0x1c525b,_0x519fb8[_0x2a6f('0x4e')]);var _0x15f968={'where':_0x1c525b[_0x2a6f('0x47')]};return db[_0x2a6f('0x4f')][_0x2a6f('0x2e')](_0x15f968)[_0x2a6f('0x1f')](function(_0x2835db){_0x2893de[_0x2a6f('0x2e')]=_0x2835db;if(_0x519fb8[_0x2a6f('0x3c')][_0x2a6f('0x50')]){_0x1c525b[_0x2a6f('0x51')]=[{'all':!![]}];}return db['ChatGroup'][_0x2a6f('0x52')](_0x1c525b);})['then'](function(_0x6f8429){_0x2893de[_0x2a6f('0x53')]=_0x6f8429;return _0x2893de;})['then'](respondWithFilteredResult(_0x47c861,_0x1c525b))[_0x2a6f('0x29')](handleError(_0x47c861,null));};exports[_0x2a6f('0x54')]=function(_0x4bd99e,_0x16f0b2){var _0x870e7f={'raw':!![],'where':{'id':_0x4bd99e['params']['id']}},_0x4a036f={};_0x4a036f[_0x2a6f('0x3a')]=_[_0x2a6f('0x3b')](db[_0x2a6f('0x4f')][_0x2a6f('0x39')]);_0x4a036f[_0x2a6f('0x3c')]=_[_0x2a6f('0x3b')](_0x4bd99e[_0x2a6f('0x3c')]);_0x4a036f[_0x2a6f('0x3f')]=_['intersection'](_0x4a036f[_0x2a6f('0x3a')],_0x4a036f[_0x2a6f('0x3c')]);_0x870e7f[_0x2a6f('0x40')]=_[_0x2a6f('0x41')](_0x4a036f['model'],qs['fields'](_0x4bd99e[_0x2a6f('0x3c')][_0x2a6f('0x42')]));_0x870e7f[_0x2a6f('0x40')]=_0x870e7f[_0x2a6f('0x40')]['length']?_0x870e7f[_0x2a6f('0x40')]:_0x4a036f[_0x2a6f('0x3a')];if(_0x4bd99e[_0x2a6f('0x3c')][_0x2a6f('0x50')]){_0x870e7f['include']=[{'all':!![]}];}_0x870e7f=_[_0x2a6f('0x4c')]({},_0x870e7f,_0x4bd99e[_0x2a6f('0x4e')]);return db[_0x2a6f('0x4f')][_0x2a6f('0x55')](_0x870e7f)[_0x2a6f('0x1f')](handleEntityNotFound(_0x16f0b2,null))[_0x2a6f('0x1f')](respondWithResult(_0x16f0b2,null))[_0x2a6f('0x29')](handleError(_0x16f0b2,null));};exports[_0x2a6f('0x56')]=function(_0x19a016,_0x281f9e){return db[_0x2a6f('0x4f')][_0x2a6f('0x56')](_0x19a016[_0x2a6f('0x57')],{})[_0x2a6f('0x1f')](respondWithResult(_0x281f9e,0xc9))[_0x2a6f('0x29')](handleError(_0x281f9e,null));};exports[_0x2a6f('0x35')]=function(_0x30f58b,_0x3ef16f){if(_0x30f58b[_0x2a6f('0x57')]['id']){delete _0x30f58b['body']['id'];}return db[_0x2a6f('0x4f')][_0x2a6f('0x55')]({'where':{'id':_0x30f58b['params']['id']}})[_0x2a6f('0x1f')](handleEntityNotFound(_0x3ef16f,null))[_0x2a6f('0x1f')](saveUpdates(_0x30f58b[_0x2a6f('0x57')],null))[_0x2a6f('0x1f')](respondWithResult(_0x3ef16f,null))[_0x2a6f('0x29')](handleError(_0x3ef16f,null));};exports['destroy']=function(_0x497450,_0x279a0f){return db[_0x2a6f('0x4f')][_0x2a6f('0x55')]({'where':{'id':_0x497450['params']['id']}})[_0x2a6f('0x1f')](handleEntityNotFound(_0x279a0f,null))['then'](removeEntity(_0x279a0f,null))['catch'](handleError(_0x279a0f,null));};exports[_0x2a6f('0x58')]=function(_0x5b0feb,_0x3ac016){return db[_0x2a6f('0x4f')][_0x2a6f('0x58')]()[_0x2a6f('0x1f')](respondWithResult(_0x3ac016,null))[_0x2a6f('0x29')](handleError(_0x3ac016,null));};exports[_0x2a6f('0x59')]=function(_0x4cef60,_0x39f1b2,_0x25530f){return db['ChatInternalMessage'][_0x2a6f('0x2e')]({'where':{'ChatGroupId':_0x4cef60['params']['id'],'ToId':_0x4cef60[_0x2a6f('0x5a')]['id'],'read':![]}})[_0x2a6f('0x1f')](function(_0x3d4639){return{'id':_[_0x2a6f('0x5b')](_0x4cef60[_0x2a6f('0x5c')]['id']),'count':_0x3d4639};})[_0x2a6f('0x1f')](respondWithResult(_0x39f1b2,null))[_0x2a6f('0x29')](handleError(_0x39f1b2,null));};exports[_0x2a6f('0x5d')]=function(_0x69163f,_0x389b2f,_0x289447){return db['ChatGroup'][_0x2a6f('0x55')]({'where':{'id':_0x69163f[_0x2a6f('0x5c')]['id']}})[_0x2a6f('0x1f')](handleEntityNotFound(_0x389b2f,null))[_0x2a6f('0x1f')](function(_0x2a7cea){if(_0x2a7cea){return _0x2a7cea['addMembers'](_0x69163f[_0x2a6f('0x57')][_0x2a6f('0x5e')],_['omit'](_0x69163f['body'],[_0x2a6f('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x389b2f,null))[_0x2a6f('0x29')](handleError(_0x389b2f,null));};exports[_0x2a6f('0x5f')]=function(_0x3ae118,_0x1addaf,_0x4ec48e){var _0x24f51b={};var _0x5737f1={};var _0x2541cb;var _0x3a1793;return db['ChatGroup'][_0x2a6f('0x60')]({'where':{'id':_0x3ae118['params']['id']}})[_0x2a6f('0x1f')](handleEntityNotFound(_0x1addaf,null))[_0x2a6f('0x1f')](function(_0x26cd21){if(_0x26cd21){_0x2541cb=_0x26cd21;_0x5737f1[_0x2a6f('0x3a')]=_[_0x2a6f('0x3b')](db[_0x2a6f('0x61')][_0x2a6f('0x39')]);_0x5737f1[_0x2a6f('0x3c')]=_[_0x2a6f('0x3b')](_0x3ae118['query']);_0x5737f1[_0x2a6f('0x3f')]=_['intersection'](_0x5737f1[_0x2a6f('0x3a')],_0x5737f1[_0x2a6f('0x3c')]);_0x24f51b[_0x2a6f('0x40')]=_[_0x2a6f('0x41')](_0x5737f1[_0x2a6f('0x3a')],qs[_0x2a6f('0x42')](_0x3ae118[_0x2a6f('0x3c')][_0x2a6f('0x42')]));_0x24f51b[_0x2a6f('0x40')]=_0x24f51b[_0x2a6f('0x40')]['length']?_0x24f51b['attributes']:_0x5737f1['model'];_0x24f51b[_0x2a6f('0x45')]=qs[_0x2a6f('0x46')](_0x3ae118['query'][_0x2a6f('0x46')]);_0x24f51b[_0x2a6f('0x47')]=qs['filters'](_['pick'](_0x3ae118[_0x2a6f('0x3c')],_0x5737f1[_0x2a6f('0x3f')]));if(_0x3ae118[_0x2a6f('0x3c')]['filter']){_0x24f51b[_0x2a6f('0x47')]=_['merge'](_0x24f51b[_0x2a6f('0x47')],{'$or':_[_0x2a6f('0x4d')](_0x24f51b[_0x2a6f('0x40')],function(_0x47776f){var _0x10acf0={};_0x10acf0[_0x47776f]={'$like':'%'+_0x3ae118[_0x2a6f('0x3c')][_0x2a6f('0x4b')]+'%'};return _0x10acf0;})});}_0x24f51b=_[_0x2a6f('0x4c')]({},_0x24f51b,_0x3ae118[_0x2a6f('0x4e')]);return _0x2541cb[_0x2a6f('0x5f')](_0x24f51b);}})[_0x2a6f('0x1f')](function(_0xb61b98){if(_0xb61b98){_0x3a1793=_0xb61b98['length'];if(!_0x3ae118['query'][_0x2a6f('0x44')](_0x2a6f('0x62'))){_0x24f51b[_0x2a6f('0x30')]=qs[_0x2a6f('0x30')](_0x3ae118[_0x2a6f('0x3c')][_0x2a6f('0x30')]);_0x24f51b[_0x2a6f('0x2f')]=qs[_0x2a6f('0x2f')](_0x3ae118[_0x2a6f('0x3c')][_0x2a6f('0x2f')]);}return _0x2541cb[_0x2a6f('0x5f')](_0x24f51b);}})[_0x2a6f('0x1f')](function(_0x107244){if(_0x107244){return _0x107244?{'count':_0x3a1793,'rows':_0x107244}:null;}})['then'](respondWithResult(_0x1addaf,null))[_0x2a6f('0x29')](handleError(_0x1addaf,null));};exports[_0x2a6f('0x63')]=function(_0x1a2f6b,_0x5028f5,_0x22676e){var _0x5ab445;return db[_0x2a6f('0x4f')][_0x2a6f('0x55')]({'where':{'id':_0x1a2f6b[_0x2a6f('0x5c')]['id']}})[_0x2a6f('0x1f')](handleEntityNotFound(_0x5028f5,null))[_0x2a6f('0x1f')](function(_0x57a199){if(_0x57a199){return _0x57a199[_0x2a6f('0x63')](_0x1a2f6b[_0x2a6f('0x3c')]['ids']);}})[_0x2a6f('0x1f')](respondWithStatusCode(_0x5028f5,null))['catch'](handleError(_0x5028f5,null));};exports['addMessage']=function(_0x263089,_0x432278,_0x5807b0){if(_0x263089['body']['id']){delete _0x263089[_0x2a6f('0x57')]['id'];}return db[_0x2a6f('0x4f')]['find']({'where':{'id':_0x263089['params']['id']}})['then'](handleEntityNotFound(_0x432278,null))[_0x2a6f('0x1f')](function(_0x580015){if(_0x580015){_0x263089[_0x2a6f('0x57')][_0x2a6f('0x64')]=_0x580015['id'];return db['ChatInternalMessage'][_0x2a6f('0x56')](_0x263089[_0x2a6f('0x57')]);}})['then'](respondWithResult(_0x432278,null))[_0x2a6f('0x29')](handleError(_0x432278,null));};exports[_0x2a6f('0x65')]=function(_0x4ae323,_0x2460b5,_0x4d9d10){var _0x5622d7={};var _0x4adfb1={};var _0x219dac;var _0x162f63;return db[_0x2a6f('0x4f')][_0x2a6f('0x60')]({'where':{'id':_0x4ae323[_0x2a6f('0x5c')]['id']}})[_0x2a6f('0x1f')](handleEntityNotFound(_0x2460b5,null))[_0x2a6f('0x1f')](function(_0x4cf28e){if(_0x4cf28e){_0x219dac=_0x4cf28e;_0x4adfb1['model']=_[_0x2a6f('0x3b')](db[_0x2a6f('0x66')][_0x2a6f('0x39')]);_0x4adfb1[_0x2a6f('0x3c')]=_[_0x2a6f('0x3b')](_0x4ae323[_0x2a6f('0x3c')]);_0x4adfb1['filters']=_[_0x2a6f('0x41')](_0x4adfb1[_0x2a6f('0x3a')],_0x4adfb1[_0x2a6f('0x3c')]);_0x5622d7['attributes']=_[_0x2a6f('0x41')](_0x4adfb1[_0x2a6f('0x3a')],qs[_0x2a6f('0x42')](_0x4ae323[_0x2a6f('0x3c')][_0x2a6f('0x42')]));_0x5622d7[_0x2a6f('0x40')]=_0x5622d7[_0x2a6f('0x40')][_0x2a6f('0x43')]?_0x5622d7[_0x2a6f('0x40')]:_0x4adfb1[_0x2a6f('0x3a')];_0x5622d7['order']=qs[_0x2a6f('0x46')](_0x4ae323[_0x2a6f('0x3c')][_0x2a6f('0x46')]);_0x5622d7[_0x2a6f('0x47')]=qs[_0x2a6f('0x3f')](_[_0x2a6f('0x48')](_0x4ae323[_0x2a6f('0x3c')],_0x4adfb1[_0x2a6f('0x3f')]));if(_0x4ae323['query'][_0x2a6f('0x4b')]){_0x5622d7['where']=_['merge'](_0x5622d7[_0x2a6f('0x47')],{'$or':_[_0x2a6f('0x4d')](_0x5622d7[_0x2a6f('0x40')],function(_0x440033){var _0x2befdc={};_0x2befdc[_0x440033]={'$like':'%'+_0x4ae323[_0x2a6f('0x3c')][_0x2a6f('0x4b')]+'%'};return _0x2befdc;})});}if(_0x4ae323['query']['$gte']){var _0x782f9f=_0x4ae323[_0x2a6f('0x3c')][_0x2a6f('0x67')][_0x2a6f('0x68')](',');var _0x1c86b4={};_0x1c86b4[_0x782f9f[0x0]]={'$gte':moment(_0x782f9f[0x1])['format'](_0x2a6f('0x69'))};_0x5622d7['where']=_[_0x2a6f('0x4c')](_0x5622d7[_0x2a6f('0x47')],_0x1c86b4);}_0x5622d7=_[_0x2a6f('0x4c')]({},_0x5622d7,_0x4ae323[_0x2a6f('0x4e')]);return _0x219dac['getMessages'](_0x5622d7);}})[_0x2a6f('0x1f')](function(_0x413456){if(_0x413456){_0x162f63=_0x413456[_0x2a6f('0x43')];if(!_0x4ae323['query']['hasOwnProperty']('nolimit')){_0x5622d7[_0x2a6f('0x30')]=qs[_0x2a6f('0x30')](_0x4ae323[_0x2a6f('0x3c')][_0x2a6f('0x30')]);_0x5622d7[_0x2a6f('0x2f')]=qs[_0x2a6f('0x2f')](_0x4ae323[_0x2a6f('0x3c')][_0x2a6f('0x2f')]);}return _0x219dac[_0x2a6f('0x65')](_0x5622d7);}})[_0x2a6f('0x1f')](function(_0x16463d){if(_0x16463d){return _0x16463d?{'count':_0x162f63,'rows':_0x16463d}:null;}})[_0x2a6f('0x1f')](respondWithResult(_0x2460b5,null))['catch'](handleError(_0x2460b5,null));}; \ No newline at end of file +var _0x2387=['count','includeAll','findAll','rows','show','params','intersection','include','find','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','name','send','index','ChatGroup','rawAttributes','keys','query','dateStart','dateEnd','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','add','day','filter','merge','map','options'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2387,0x8a));var _0x7238=function(_0x15aef4,_0x101ee8){_0x15aef4=_0x15aef4-0x0;var _0x399c94=_0x2387[_0x15aef4];return _0x399c94;};'use strict';var pdf=require(_0x7238('0x0'));var emlformat=require(_0x7238('0x1'));var rimraf=require(_0x7238('0x2'));var zipdir=require(_0x7238('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7238('0x4'));var BPromise=require(_0x7238('0x5'));var Mustache=require(_0x7238('0x6'));var util=require(_0x7238('0x7'));var path=require(_0x7238('0x8'));var sox=require(_0x7238('0x9'));var csv=require('to-csv');var ejs=require(_0x7238('0xa'));var fs=require('fs');var _=require(_0x7238('0xb'));var squel=require(_0x7238('0xc'));var crypto=require('crypto');var jsforce=require(_0x7238('0xd'));var deskjs=require(_0x7238('0xe'));var toCsv=require(_0x7238('0xf'));var querystring=require(_0x7238('0x10'));var Papa=require('papaparse');var Redis=require(_0x7238('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x7238('0x12'))('api');var utils=require(_0x7238('0x13'));var config=require(_0x7238('0x14'));var db=require(_0x7238('0x15'))['db'];config[_0x7238('0x16')]=_[_0x7238('0x17')](config[_0x7238('0x16')],{'host':_0x7238('0x18'),'port':0x18eb});var socket=require(_0x7238('0x19'))(new Redis(config[_0x7238('0x16')]));require(_0x7238('0x1a'))[_0x7238('0x1b')](socket);var jayson=require(_0x7238('0x1c'));var client=jayson[_0x7238('0x1d')][_0x7238('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x47196f,_0x552d73,_0x43eb5b,_0x6a2bdf){return new BPromise(function(_0x385e43,_0x2003c8){var _0x3fb31a=_0x6a2bdf||client;return _0x3fb31a['request'](_0x47196f,_0x43eb5b)[_0x7238('0x1f')](function(_0x154a91){logger['info'](_0x7238('0x20'),_0x552d73,_0x7238('0x21'));logger[_0x7238('0x22')](_0x7238('0x23'),_0x552d73,_0x7238('0x21'),JSON[_0x7238('0x24')](_0x154a91));if(_0x154a91[_0x7238('0x25')]){if(_0x154a91['error'][_0x7238('0x26')]===0x1f4){logger[_0x7238('0x25')](_0x7238('0x20'),_0x552d73,_0x154a91[_0x7238('0x25')][_0x7238('0x27')]);return _0x2003c8(_0x154a91[_0x7238('0x25')][_0x7238('0x27')]);}logger[_0x7238('0x25')](_0x7238('0x20'),_0x552d73,_0x154a91[_0x7238('0x25')][_0x7238('0x27')]);return _0x385e43(_0x154a91[_0x7238('0x25')][_0x7238('0x27')]);}else{logger[_0x7238('0x28')](_0x7238('0x20'),_0x552d73,_0x7238('0x21'));_0x385e43(_0x154a91[_0x7238('0x29')][_0x7238('0x27')]);}})[_0x7238('0x2a')](function(_0x565ecb){logger[_0x7238('0x25')](_0x7238('0x20'),_0x552d73,_0x565ecb);_0x2003c8(_0x565ecb);});});}function respondWithStatusCode(_0x1584f3,_0xd85000){_0xd85000=_0xd85000||0xcc;return function(_0x3cd15e){if(_0x3cd15e){return _0x1584f3[_0x7238('0x2b')](_0xd85000);}return _0x1584f3[_0x7238('0x2c')](_0xd85000)[_0x7238('0x2d')]();};}function respondWithResult(_0x6453f3,_0x3b1eef){_0x3b1eef=_0x3b1eef||0xc8;return function(_0x133f06){if(_0x133f06){return _0x6453f3[_0x7238('0x2c')](_0x3b1eef)[_0x7238('0x2e')](_0x133f06);}};}function respondWithFilteredResult(_0x2eedce,_0x457002){return function(_0x44e488){if(_0x44e488){var _0x1cbe99=_0x44e488['count'],_0x315998=_0x457002[_0x7238('0x2f')],_0x530152=_0x457002[_0x7238('0x2f')]+_0x457002[_0x7238('0x30')],_0xef7158;if(_0x530152>=_0x1cbe99){_0x530152=_0x1cbe99;_0xef7158=0xc8;}else{_0xef7158=0xce;}_0x2eedce[_0x7238('0x2c')](_0xef7158);return _0x2eedce[_0x7238('0x31')]('Content-Range',_0x315998+'-'+_0x530152+'/'+_0x1cbe99)[_0x7238('0x2e')](_0x44e488);}return null;};}function patchUpdates(_0x4fcf65){return function(_0x550d3b){try{jsonpatch[_0x7238('0x32')](_0x550d3b,_0x4fcf65,!![]);}catch(_0x4462f1){return BPromise[_0x7238('0x33')](_0x4462f1);}return _0x550d3b[_0x7238('0x34')]();};}function saveUpdates(_0x19490b,_0x48d83f){return function(_0x55bf63){if(_0x55bf63){return _0x55bf63[_0x7238('0x35')](_0x19490b)['then'](function(_0x3e852d){return _0x3e852d;});}return null;};}function removeEntity(_0x15033e,_0x28fefa){return function(_0x5b5923){if(_0x5b5923){return _0x5b5923[_0x7238('0x36')]()['then'](function(){_0x15033e['status'](0xcc)[_0x7238('0x2d')]();});}};}function handleEntityNotFound(_0x2b32f4,_0x4fabc3){return function(_0x5b751c){if(!_0x5b751c){_0x2b32f4[_0x7238('0x2b')](0x194);}return _0x5b751c;};}function handleError(_0x238267,_0x4242b4){_0x4242b4=_0x4242b4||0x1f4;return function(_0xcf7d5d){logger['error'](_0xcf7d5d['stack']);if(_0xcf7d5d[_0x7238('0x37')]){delete _0xcf7d5d[_0x7238('0x37')];}_0x238267[_0x7238('0x2c')](_0x4242b4)[_0x7238('0x38')](_0xcf7d5d);};}exports[_0x7238('0x39')]=function(_0x41b224,_0x1d7db2){var _0x31747c={},_0x2557b1={},_0x511450={'count':0x0,'rows':[]};var _0x29878b=db[_0x7238('0x3a')][_0x7238('0x3b')];_0x2557b1['model']=_[_0x7238('0x3c')](_0x29878b);var _0x121fc6={'dateStart':_0x41b224[_0x7238('0x3d')][_0x7238('0x3e')],'dateEnd':_0x41b224[_0x7238('0x3d')][_0x7238('0x3f')]};delete _0x41b224['query'][_0x7238('0x3e')];delete _0x41b224[_0x7238('0x3d')]['dateEnd'];_0x2557b1['query']=_[_0x7238('0x3c')](_0x41b224[_0x7238('0x3d')]);_0x2557b1['filters']=_['intersection'](_0x2557b1[_0x7238('0x40')],_0x2557b1[_0x7238('0x3d')]);_0x31747c[_0x7238('0x41')]=_['intersection'](_0x2557b1[_0x7238('0x40')],qs['fields'](_0x41b224[_0x7238('0x3d')][_0x7238('0x42')]));_0x31747c[_0x7238('0x41')]=_0x31747c[_0x7238('0x41')][_0x7238('0x43')]?_0x31747c[_0x7238('0x41')]:_0x2557b1[_0x7238('0x40')];if(!_0x41b224[_0x7238('0x3d')][_0x7238('0x44')](_0x7238('0x45'))){_0x31747c[_0x7238('0x30')]=qs[_0x7238('0x30')](_0x41b224[_0x7238('0x3d')][_0x7238('0x30')]);_0x31747c['offset']=qs['offset'](_0x41b224[_0x7238('0x3d')][_0x7238('0x2f')]);}_0x31747c[_0x7238('0x46')]=qs['sort'](_0x41b224[_0x7238('0x3d')][_0x7238('0x47')]);_0x31747c[_0x7238('0x48')]=qs[_0x7238('0x49')](_['pick'](_0x41b224[_0x7238('0x3d')],_0x2557b1[_0x7238('0x49')]));if(_0x121fc6[_0x7238('0x3e')]){if(_0x121fc6['dateEnd']){_0x121fc6['dateEnd']=moment(_0x121fc6[_0x7238('0x3f')])[_0x7238('0x4a')](0x1,'day');}else{_0x121fc6[_0x7238('0x3f')]=moment(_0x121fc6[_0x7238('0x3e')])[_0x7238('0x4a')](0x1,_0x7238('0x4b'));}_['merge'](_0x31747c['where'],{'createdAt':{'$gte':_0x121fc6[_0x7238('0x3e')],'$lte':_0x121fc6[_0x7238('0x3f')]}});}if(_0x41b224[_0x7238('0x3d')][_0x7238('0x4c')]){_0x31747c[_0x7238('0x48')]=_[_0x7238('0x4d')](_0x31747c[_0x7238('0x48')],{'$or':_[_0x7238('0x4e')](_0x31747c[_0x7238('0x41')],function(_0x2a02c5){var _0x3c1eee={};_0x3c1eee[_0x2a02c5]={'$like':'%'+_0x41b224[_0x7238('0x3d')]['filter']+'%'};return _0x3c1eee;})});}_0x31747c=_[_0x7238('0x4d')]({},_0x31747c,_0x41b224[_0x7238('0x4f')]);var _0x3498ba={'where':_0x31747c[_0x7238('0x48')]};return db['ChatGroup']['count'](_0x3498ba)['then'](function(_0x44631c){_0x511450[_0x7238('0x50')]=_0x44631c;if(_0x41b224['query'][_0x7238('0x51')]){_0x31747c['include']=[{'all':!![]}];}return db[_0x7238('0x3a')][_0x7238('0x52')](_0x31747c);})[_0x7238('0x1f')](function(_0x4d8517){_0x511450[_0x7238('0x53')]=_0x4d8517;return _0x511450;})[_0x7238('0x1f')](respondWithFilteredResult(_0x1d7db2,_0x31747c))['catch'](handleError(_0x1d7db2,null));};exports[_0x7238('0x54')]=function(_0x2f1967,_0x2d5b78){var _0x4f62eb={'raw':!![],'where':{'id':_0x2f1967[_0x7238('0x55')]['id']}},_0x56564f={};_0x56564f[_0x7238('0x40')]=_[_0x7238('0x3c')](db['ChatGroup'][_0x7238('0x3b')]);_0x56564f[_0x7238('0x3d')]=_[_0x7238('0x3c')](_0x2f1967[_0x7238('0x3d')]);_0x56564f['filters']=_[_0x7238('0x56')](_0x56564f[_0x7238('0x40')],_0x56564f[_0x7238('0x3d')]);_0x4f62eb['attributes']=_['intersection'](_0x56564f[_0x7238('0x40')],qs['fields'](_0x2f1967[_0x7238('0x3d')]['fields']));_0x4f62eb[_0x7238('0x41')]=_0x4f62eb['attributes'][_0x7238('0x43')]?_0x4f62eb[_0x7238('0x41')]:_0x56564f[_0x7238('0x40')];if(_0x2f1967[_0x7238('0x3d')]['includeAll']){_0x4f62eb[_0x7238('0x57')]=[{'all':!![]}];}_0x4f62eb=_[_0x7238('0x4d')]({},_0x4f62eb,_0x2f1967[_0x7238('0x4f')]);return db[_0x7238('0x3a')][_0x7238('0x58')](_0x4f62eb)[_0x7238('0x1f')](handleEntityNotFound(_0x2d5b78,null))['then'](respondWithResult(_0x2d5b78,null))['catch'](handleError(_0x2d5b78,null));};exports[_0x7238('0x59')]=function(_0x232fc0,_0x46a35d){return db[_0x7238('0x3a')]['create'](_0x232fc0[_0x7238('0x5a')],{})[_0x7238('0x1f')](respondWithResult(_0x46a35d,0xc9))['catch'](handleError(_0x46a35d,null));};exports[_0x7238('0x35')]=function(_0x26582f,_0x5e1223){if(_0x26582f['body']['id']){delete _0x26582f[_0x7238('0x5a')]['id'];}return db[_0x7238('0x3a')][_0x7238('0x58')]({'where':{'id':_0x26582f['params']['id']}})[_0x7238('0x1f')](handleEntityNotFound(_0x5e1223,null))['then'](saveUpdates(_0x26582f['body'],null))['then'](respondWithResult(_0x5e1223,null))['catch'](handleError(_0x5e1223,null));};exports['destroy']=function(_0x2acef5,_0xefa11c){return db[_0x7238('0x3a')]['find']({'where':{'id':_0x2acef5[_0x7238('0x55')]['id']}})[_0x7238('0x1f')](handleEntityNotFound(_0xefa11c,null))[_0x7238('0x1f')](removeEntity(_0xefa11c,null))[_0x7238('0x2a')](handleError(_0xefa11c,null));};exports[_0x7238('0x5b')]=function(_0x1e00b3,_0x2600e2){return db[_0x7238('0x3a')][_0x7238('0x5b')]()[_0x7238('0x1f')](respondWithResult(_0x2600e2,null))['catch'](handleError(_0x2600e2,null));};exports['getUnread']=function(_0x14ca89,_0x36c883,_0x2e2236){return db[_0x7238('0x5c')]['count']({'where':{'ChatGroupId':_0x14ca89[_0x7238('0x55')]['id'],'ToId':_0x14ca89[_0x7238('0x5d')]['id'],'read':![]}})[_0x7238('0x1f')](function(_0x1db267){return{'id':_[_0x7238('0x5e')](_0x14ca89['params']['id']),'count':_0x1db267};})[_0x7238('0x1f')](respondWithResult(_0x36c883,null))['catch'](handleError(_0x36c883,null));};exports['addMembers']=function(_0x410ec9,_0xa9756b,_0x290677){return db[_0x7238('0x3a')][_0x7238('0x58')]({'where':{'id':_0x410ec9[_0x7238('0x55')]['id']}})[_0x7238('0x1f')](handleEntityNotFound(_0xa9756b,null))[_0x7238('0x1f')](function(_0x35b82d){if(_0x35b82d){return _0x35b82d[_0x7238('0x5f')](_0x410ec9[_0x7238('0x5a')][_0x7238('0x60')],_[_0x7238('0x61')](_0x410ec9[_0x7238('0x5a')],[_0x7238('0x60'),'id'])||{});}})[_0x7238('0x1f')](respondWithResult(_0xa9756b,null))[_0x7238('0x2a')](handleError(_0xa9756b,null));};exports[_0x7238('0x62')]=function(_0x4e6fdf,_0x11b73d,_0x5e38e3){var _0x1d2da5={};var _0x8d7e4c={};var _0x4757f6;var _0x2bb14c;return db[_0x7238('0x3a')][_0x7238('0x63')]({'where':{'id':_0x4e6fdf['params']['id']}})[_0x7238('0x1f')](handleEntityNotFound(_0x11b73d,null))[_0x7238('0x1f')](function(_0x453a37){if(_0x453a37){_0x4757f6=_0x453a37;_0x8d7e4c[_0x7238('0x40')]=_[_0x7238('0x3c')](db[_0x7238('0x64')][_0x7238('0x3b')]);_0x8d7e4c[_0x7238('0x3d')]=_[_0x7238('0x3c')](_0x4e6fdf[_0x7238('0x3d')]);_0x8d7e4c[_0x7238('0x49')]=_[_0x7238('0x56')](_0x8d7e4c[_0x7238('0x40')],_0x8d7e4c[_0x7238('0x3d')]);_0x1d2da5[_0x7238('0x41')]=_[_0x7238('0x56')](_0x8d7e4c[_0x7238('0x40')],qs[_0x7238('0x42')](_0x4e6fdf[_0x7238('0x3d')][_0x7238('0x42')]));_0x1d2da5[_0x7238('0x41')]=_0x1d2da5[_0x7238('0x41')][_0x7238('0x43')]?_0x1d2da5[_0x7238('0x41')]:_0x8d7e4c['model'];_0x1d2da5[_0x7238('0x46')]=qs['sort'](_0x4e6fdf[_0x7238('0x3d')]['sort']);_0x1d2da5['where']=qs[_0x7238('0x49')](_[_0x7238('0x65')](_0x4e6fdf[_0x7238('0x3d')],_0x8d7e4c[_0x7238('0x49')]));if(_0x4e6fdf[_0x7238('0x3d')][_0x7238('0x4c')]){_0x1d2da5[_0x7238('0x48')]=_[_0x7238('0x4d')](_0x1d2da5[_0x7238('0x48')],{'$or':_[_0x7238('0x4e')](_0x1d2da5[_0x7238('0x41')],function(_0x33e47c){var _0x47e5bb={};_0x47e5bb[_0x33e47c]={'$like':'%'+_0x4e6fdf[_0x7238('0x3d')][_0x7238('0x4c')]+'%'};return _0x47e5bb;})});}_0x1d2da5=_[_0x7238('0x4d')]({},_0x1d2da5,_0x4e6fdf[_0x7238('0x4f')]);return _0x4757f6[_0x7238('0x62')](_0x1d2da5);}})[_0x7238('0x1f')](function(_0xe1d8eb){if(_0xe1d8eb){_0x2bb14c=_0xe1d8eb[_0x7238('0x43')];if(!_0x4e6fdf[_0x7238('0x3d')]['hasOwnProperty'](_0x7238('0x45'))){_0x1d2da5[_0x7238('0x30')]=qs[_0x7238('0x30')](_0x4e6fdf[_0x7238('0x3d')][_0x7238('0x30')]);_0x1d2da5['offset']=qs['offset'](_0x4e6fdf['query'][_0x7238('0x2f')]);}return _0x4757f6[_0x7238('0x62')](_0x1d2da5);}})[_0x7238('0x1f')](function(_0xc59975){if(_0xc59975){return _0xc59975?{'count':_0x2bb14c,'rows':_0xc59975}:null;}})['then'](respondWithResult(_0x11b73d,null))[_0x7238('0x2a')](handleError(_0x11b73d,null));};exports[_0x7238('0x66')]=function(_0x33e703,_0x486b1a,_0xc87ea7){var _0x570bbd;return db[_0x7238('0x3a')]['find']({'where':{'id':_0x33e703['params']['id']}})[_0x7238('0x1f')](handleEntityNotFound(_0x486b1a,null))[_0x7238('0x1f')](function(_0x5d1aa7){if(_0x5d1aa7){return _0x5d1aa7[_0x7238('0x66')](_0x33e703[_0x7238('0x3d')][_0x7238('0x60')]);}})[_0x7238('0x1f')](respondWithStatusCode(_0x486b1a,null))[_0x7238('0x2a')](handleError(_0x486b1a,null));};exports[_0x7238('0x67')]=function(_0xa3a777,_0x3c08ed,_0x4753ea){if(_0xa3a777[_0x7238('0x5a')]['id']){delete _0xa3a777[_0x7238('0x5a')]['id'];}return db[_0x7238('0x3a')][_0x7238('0x58')]({'where':{'id':_0xa3a777[_0x7238('0x55')]['id']}})[_0x7238('0x1f')](handleEntityNotFound(_0x3c08ed,null))['then'](function(_0x339542){if(_0x339542){_0xa3a777[_0x7238('0x5a')][_0x7238('0x68')]=_0x339542['id'];return db[_0x7238('0x5c')][_0x7238('0x59')](_0xa3a777[_0x7238('0x5a')]);}})[_0x7238('0x1f')](respondWithResult(_0x3c08ed,null))[_0x7238('0x2a')](handleError(_0x3c08ed,null));};exports[_0x7238('0x69')]=function(_0x75d954,_0x3d1e47,_0x51c931){var _0x120b5c={};var _0x3089af={};var _0xb42bf7;var _0x5f377e;return db['ChatGroup'][_0x7238('0x63')]({'where':{'id':_0x75d954[_0x7238('0x55')]['id']}})[_0x7238('0x1f')](handleEntityNotFound(_0x3d1e47,null))[_0x7238('0x1f')](function(_0x542d25){if(_0x542d25){_0xb42bf7=_0x542d25;_0x3089af['model']=_[_0x7238('0x3c')](db[_0x7238('0x5c')]['rawAttributes']);_0x3089af['query']=_[_0x7238('0x3c')](_0x75d954[_0x7238('0x3d')]);_0x3089af[_0x7238('0x49')]=_[_0x7238('0x56')](_0x3089af['model'],_0x3089af['query']);_0x120b5c[_0x7238('0x41')]=_[_0x7238('0x56')](_0x3089af[_0x7238('0x40')],qs[_0x7238('0x42')](_0x75d954[_0x7238('0x3d')][_0x7238('0x42')]));_0x120b5c['attributes']=_0x120b5c[_0x7238('0x41')][_0x7238('0x43')]?_0x120b5c[_0x7238('0x41')]:_0x3089af[_0x7238('0x40')];_0x120b5c['order']=qs[_0x7238('0x47')](_0x75d954[_0x7238('0x3d')]['sort']);_0x120b5c['where']=qs[_0x7238('0x49')](_[_0x7238('0x65')](_0x75d954['query'],_0x3089af['filters']));if(_0x75d954[_0x7238('0x3d')][_0x7238('0x4c')]){_0x120b5c[_0x7238('0x48')]=_[_0x7238('0x4d')](_0x120b5c['where'],{'$or':_[_0x7238('0x4e')](_0x120b5c[_0x7238('0x41')],function(_0x2871ac){var _0x152482={};_0x152482[_0x2871ac]={'$like':'%'+_0x75d954[_0x7238('0x3d')]['filter']+'%'};return _0x152482;})});}if(_0x75d954[_0x7238('0x3d')][_0x7238('0x6a')]){var _0x53e144=_0x75d954['query'][_0x7238('0x6a')][_0x7238('0x6b')](',');var _0xca6ec7={};_0xca6ec7[_0x53e144[0x0]]={'$gte':moment(_0x53e144[0x1])['format'](_0x7238('0x6c'))};_0x120b5c[_0x7238('0x48')]=_[_0x7238('0x4d')](_0x120b5c['where'],_0xca6ec7);}_0x120b5c=_['merge']({},_0x120b5c,_0x75d954[_0x7238('0x4f')]);return _0xb42bf7[_0x7238('0x69')](_0x120b5c);}})['then'](function(_0x229f72){if(_0x229f72){_0x5f377e=_0x229f72['length'];if(!_0x75d954[_0x7238('0x3d')][_0x7238('0x44')](_0x7238('0x45'))){_0x120b5c[_0x7238('0x30')]=qs['limit'](_0x75d954[_0x7238('0x3d')]['limit']);_0x120b5c[_0x7238('0x2f')]=qs[_0x7238('0x2f')](_0x75d954[_0x7238('0x3d')]['offset']);}return _0xb42bf7[_0x7238('0x69')](_0x120b5c);}})['then'](function(_0x4e83ce){if(_0x4e83ce){return _0x4e83ce?{'count':_0x5f377e,'rows':_0x4e83ce}:null;}})[_0x7238('0x1f')](respondWithResult(_0x3d1e47,null))[_0x7238('0x2a')](handleError(_0x3d1e47,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index dd86734..1cad4b9 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 _0xa6ba=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa6ba,0x8e));var _0xaa6b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa6ba[_0x46aff0];return _0x9d78cf;};'use strict';var EventEmitter=require(_0xaa6b('0x0'));var ChatGroup=require(_0xaa6b('0x1'))['db'][_0xaa6b('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xaa6b('0x3')](0x0);var events={'afterCreate':_0xaa6b('0x4'),'afterUpdate':_0xaa6b('0x5'),'afterDestroy':_0xaa6b('0x6')};function emitEvent(_0xa695c3){return function(_0x1dde7e,_0x466aa4,_0x1e8fbd){ChatGroupEvents['emit'](_0xa695c3+':'+_0x1dde7e['id'],_0x1dde7e);ChatGroupEvents[_0xaa6b('0x7')](_0xa695c3,_0x1dde7e);_0x1e8fbd(null);};}for(var e in events){if(events[_0xaa6b('0x8')](e)){var event=events[e];ChatGroup[_0xaa6b('0x9')](e,emitEvent(event));}}module[_0xaa6b('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0xf465=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x4b635b,_0xeef4d8){var _0x49c6ce=function(_0x522ddf){while(--_0x522ddf){_0x4b635b['push'](_0x4b635b['shift']());}};_0x49c6ce(++_0xeef4d8);}(_0xf465,0x14b));var _0x5f46=function(_0x3aea6a,_0x51b0ec){_0x3aea6a=_0x3aea6a-0x0;var _0x5cb945=_0xf465[_0x3aea6a];return _0x5cb945;};'use strict';var EventEmitter=require(_0x5f46('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5f46('0x1')](0x0);var events={'afterCreate':_0x5f46('0x2'),'afterUpdate':_0x5f46('0x3'),'afterDestroy':_0x5f46('0x4')};function emitEvent(_0x3c8f3c){return function(_0x4abbff,_0x2b77d3,_0x4bdfe3){ChatGroupEvents[_0x5f46('0x5')](_0x3c8f3c+':'+_0x4abbff['id'],_0x4abbff);ChatGroupEvents[_0x5f46('0x5')](_0x3c8f3c,_0x4abbff);_0x4bdfe3(null);};}for(var e in events){if(events[_0x5f46('0x6')](e)){var event=events[e];ChatGroup[_0x5f46('0x7')](e,emitEvent(event));}}module[_0x5f46('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 6d72277..42d37ea 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 _0x9d23=['../../config/logger','moment','bluebird','request-promise','./chatGroup.attributes','exports','ChatGroup','chat_groups'];(function(_0x117694,_0x1fa4b9){var _0x5d74ae=function(_0x265f3c){while(--_0x265f3c){_0x117694['push'](_0x117694['shift']());}};_0x5d74ae(++_0x1fa4b9);}(_0x9d23,0x188));var _0x39d2=function(_0x4c3262,_0x58f8ef){_0x4c3262=_0x4c3262-0x0;var _0x314477=_0x9d23[_0x4c3262];return _0x314477;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x39d2('0x0'))('api');var moment=require(_0x39d2('0x1'));var BPromise=require(_0x39d2('0x2'));var rp=require(_0x39d2('0x3'));var attributes=require(_0x39d2('0x4'));module[_0x39d2('0x5')]=function(_0x1dcb7d,_0x1eafb3){return _0x1dcb7d['define'](_0x39d2('0x6'),attributes,{'tableName':_0x39d2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0385=['api','moment','bluebird','request-promise','./chatGroup.attributes','exports','chat_groups','lodash','../../config/logger'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x0385,0x181));var _0x5038=function(_0x3047ef,_0x286b20){_0x3047ef=_0x3047ef-0x0;var _0x3878d3=_0x0385[_0x3047ef];return _0x3878d3;};'use strict';var _=require(_0x5038('0x0'));var util=require('util');var logger=require(_0x5038('0x1'))(_0x5038('0x2'));var moment=require(_0x5038('0x3'));var BPromise=require(_0x5038('0x4'));var rp=require(_0x5038('0x5'));var attributes=require(_0x5038('0x6'));module[_0x5038('0x7')]=function(_0x39437b,_0xa236d8){return _0x39437b['define']('ChatGroup',attributes,{'tableName':_0x5038('0x8'),'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 f2bb277..bcc200b 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 _0x0faf=['request\x20sent','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','request','then','ChatGroup,\x20%s,\x20%s','debug'];(function(_0x3eb719,_0x53fdd3){var _0x496128=function(_0x42c46d){while(--_0x42c46d){_0x3eb719['push'](_0x3eb719['shift']());}};_0x496128(++_0x53fdd3);}(_0x0faf,0x132));var _0xf0fa=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x0faf[_0xd336fa];return _0x3370b1;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var moment=require(_0xf0fa('0x1'));var BPromise=require(_0xf0fa('0x2'));var rs=require(_0xf0fa('0x3'));var fs=require('fs');var Redis=require(_0xf0fa('0x4'));var db=require(_0xf0fa('0x5'))['db'];var utils=require(_0xf0fa('0x6'));var logger=require(_0xf0fa('0x7'))(_0xf0fa('0x8'));var config=require(_0xf0fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0fa('0xa')][_0xf0fa('0xb')]({'port':0x232a});config[_0xf0fa('0xc')]=_[_0xf0fa('0xd')](config[_0xf0fa('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf0fa('0xe'))(new Redis(config[_0xf0fa('0xc')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x3bda51,_0x1e8cc0,_0x25dfec){return new BPromise(function(_0x1f3bb7,_0x2bd807){return client[_0xf0fa('0xf')](_0x3bda51,_0x25dfec)[_0xf0fa('0x10')](function(_0x20fd09){logger['info'](_0xf0fa('0x11'),_0x1e8cc0,'request\x20sent');logger[_0xf0fa('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1e8cc0,_0xf0fa('0x13'),JSON[_0xf0fa('0x14')](_0x20fd09));if(_0x20fd09[_0xf0fa('0x15')]){if(_0x20fd09['error']['code']===0x1f4){logger[_0xf0fa('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1e8cc0,_0x20fd09[_0xf0fa('0x15')][_0xf0fa('0x16')]);return _0x2bd807(_0x20fd09[_0xf0fa('0x15')][_0xf0fa('0x16')]);}logger[_0xf0fa('0x15')](_0xf0fa('0x11'),_0x1e8cc0,_0x20fd09[_0xf0fa('0x15')][_0xf0fa('0x16')]);return _0x1f3bb7(_0x20fd09['error'][_0xf0fa('0x16')]);}else{logger[_0xf0fa('0x17')](_0xf0fa('0x11'),_0x1e8cc0,_0xf0fa('0x13'));_0x1f3bb7(_0x20fd09[_0xf0fa('0x18')][_0xf0fa('0x16')]);}})['catch'](function(_0x56ef81){logger[_0xf0fa('0x15')](_0xf0fa('0x11'),_0x1e8cc0,_0x56ef81);_0x2bd807(_0x56ef81);});});} \ No newline at end of file +var _0x5ad3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x314ccd,_0xb410af){var _0x27ed35=function(_0x35fd09){while(--_0x35fd09){_0x314ccd['push'](_0x314ccd['shift']());}};_0x27ed35(++_0xb410af);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x5ad3[_0x2cc8bb];return _0x140e40;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var moment=require(_0x35ad('0x2'));var BPromise=require(_0x35ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ad('0x4'));var db=require(_0x35ad('0x5'))['db'];var utils=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var config=require(_0x35ad('0x9'));var jayson=require(_0x35ad('0xa'));var client=jayson[_0x35ad('0xb')][_0x35ad('0xc')]({'port':0x232a});config[_0x35ad('0xd')]=_['defaults'](config[_0x35ad('0xd')],{'host':_0x35ad('0xe'),'port':0x18eb});var socket=require(_0x35ad('0xf'))(new Redis(config['redis']));require(_0x35ad('0x10'))['register'](socket);function respondWithRpcPromise(_0x5a29e3,_0x2efae0,_0x3e9830){return new BPromise(function(_0x4881d1,_0x34c2cb){return client[_0x35ad('0x11')](_0x5a29e3,_0x3e9830)['then'](function(_0x4b31a1){logger[_0x35ad('0x12')](_0x35ad('0x13'),_0x2efae0,'request\x20sent');logger[_0x35ad('0x14')](_0x35ad('0x15'),_0x2efae0,'request\x20sent',JSON['stringify'](_0x4b31a1));if(_0x4b31a1[_0x35ad('0x16')]){if(_0x4b31a1[_0x35ad('0x16')][_0x35ad('0x17')]===0x1f4){logger['error'](_0x35ad('0x13'),_0x2efae0,_0x4b31a1[_0x35ad('0x16')]['message']);return _0x34c2cb(_0x4b31a1[_0x35ad('0x16')]['message']);}logger['error'](_0x35ad('0x13'),_0x2efae0,_0x4b31a1[_0x35ad('0x16')][_0x35ad('0x18')]);return _0x4881d1(_0x4b31a1['error'][_0x35ad('0x18')]);}else{logger[_0x35ad('0x12')](_0x35ad('0x13'),_0x2efae0,_0x35ad('0x19'));_0x4881d1(_0x4b31a1[_0x35ad('0x1a')][_0x35ad('0x18')]);}})['catch'](function(_0xd32a43){logger[_0x35ad('0x16')]('ChatGroup,\x20%s,\x20%s',_0x2efae0,_0xd32a43);_0x34c2cb(_0xd32a43);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 4e0e5f5..56ae2c8 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 _0x5ebe=['removeListener','register','length','save','remove','update'];(function(_0x4d15bf,_0x1f0795){var _0x130b2e=function(_0x1921a9){while(--_0x1921a9){_0x4d15bf['push'](_0x4d15bf['shift']());}};_0x130b2e(++_0x1f0795);}(_0x5ebe,0x69));var _0xe5eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5ebe[_0x122ef9];return _0x42fba0;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xe5eb('0x0'),_0xe5eb('0x1'),_0xe5eb('0x2')];function createListener(_0x351ab2,_0x1f85f8){return function(_0x3912d6){_0x1f85f8['emit'](_0x351ab2,_0x3912d6);};}function removeListener(_0x56ef37,_0x465c4e){return function(){ChatGroupEvents[_0xe5eb('0x3')](_0x56ef37,_0x465c4e);};}exports[_0xe5eb('0x4')]=function(_0x1f7414){for(var _0x3055ba=0x0,_0x3ae8d2=events[_0xe5eb('0x5')];_0x3055ba<_0x3ae8d2;_0x3055ba++){var _0x1acd9d=events[_0x3055ba];var _0x5158f0=createListener('chatGroup:'+_0x1acd9d,_0x1f7414);ChatGroupEvents['on'](_0x1acd9d,_0x5158f0);}}; \ No newline at end of file +var _0x780f=['emit','removeListener','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x31f9c7,_0x1d5f54){var _0x46c5b3=function(_0x3180e3){while(--_0x3180e3){_0x31f9c7['push'](_0x31f9c7['shift']());}};_0x46c5b3(++_0x1d5f54);}(_0x780f,0x6c));var _0xf780=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0x780f[_0x3a4f18];return _0x4c20fc;};'use strict';var ChatGroupEvents=require(_0xf780('0x0'));var events=[_0xf780('0x1'),_0xf780('0x2'),_0xf780('0x3')];function createListener(_0xe9686a,_0x4ede54){return function(_0x5a7301){_0x4ede54[_0xf780('0x4')](_0xe9686a,_0x5a7301);};}function removeListener(_0x26ed87,_0x1a22c0){return function(){ChatGroupEvents[_0xf780('0x5')](_0x26ed87,_0x1a22c0);};}exports['register']=function(_0x37b0a2){for(var _0x4b55e7=0x0,_0x1bd856=events[_0xf780('0x6')];_0x4b55e7<_0x1bd856;_0x4b55e7++){var _0x1c3fdc=events[_0x4b55e7];var _0xa12d00=createListener(_0xf780('0x7')+_0x1c3fdc,_0x37b0a2);ChatGroupEvents['on'](_0x1c3fdc,_0xa12d00);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 7697017..d1763c7 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 _0xde62=['../../components/interaction/service','./chatGroup.controller','index','/describe','isAuthenticated','describe','get','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','create','post','/:id/members','addMessage','put','/:id','update','delete','removeMembers','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3b63cd,_0x5d853f){var _0x59383f=function(_0x2bf4c1){while(--_0x2bf4c1){_0x3b63cd['push'](_0x3b63cd['shift']());}};_0x59383f(++_0x5d853f);}(_0xde62,0xa8));var _0x2de6=function(_0x2e32c0,_0x777624){_0x2e32c0=_0x2e32c0-0x0;var _0x3fd7e5=_0xde62[_0x2e32c0];return _0x3fd7e5;};'use strict';var multer=require(_0x2de6('0x0'));var util=require(_0x2de6('0x1'));var path=require(_0x2de6('0x2'));var timeout=require('connect-timeout');var express=require(_0x2de6('0x3'));var router=express[_0x2de6('0x4')]();var auth=require(_0x2de6('0x5'));var interaction=require(_0x2de6('0x6'));var config=require('../../config/environment');var controller=require(_0x2de6('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2de6('0x8')]);router['get'](_0x2de6('0x9'),auth[_0x2de6('0xa')](),controller[_0x2de6('0xb')]);router[_0x2de6('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x2de6('0xd')]);router[_0x2de6('0xc')](_0x2de6('0xe'),auth['isAuthenticated'](),controller[_0x2de6('0xf')]);router['get']('/:id/members',auth[_0x2de6('0xa')](),controller[_0x2de6('0x10')]);router[_0x2de6('0xc')](_0x2de6('0x11'),auth[_0x2de6('0xa')](),controller[_0x2de6('0x12')]);router['post']('/',auth[_0x2de6('0xa')](),controller[_0x2de6('0x13')]);router[_0x2de6('0x14')](_0x2de6('0x15'),auth[_0x2de6('0xa')](),controller['addMembers']);router[_0x2de6('0x14')](_0x2de6('0x11'),auth[_0x2de6('0xa')](),controller[_0x2de6('0x16')]);router[_0x2de6('0x17')](_0x2de6('0x18'),auth[_0x2de6('0xa')](),controller[_0x2de6('0x19')]);router[_0x2de6('0x1a')](_0x2de6('0x18'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x2de6('0x15'),auth['isAuthenticated'](),controller[_0x2de6('0x1b')]);module[_0x2de6('0x1c')]=router; \ No newline at end of file +var _0x97a6=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','addMessage','put','/:id','delete','destroy','multer','path'];(function(_0xa316d9,_0x50be4f){var _0x1ed3e0=function(_0x4ebba2){while(--_0x4ebba2){_0xa316d9['push'](_0xa316d9['shift']());}};_0x1ed3e0(++_0x50be4f);}(_0x97a6,0x143));var _0x697a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97a6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x697a('0x0'));var util=require('util');var path=require(_0x697a('0x1'));var timeout=require(_0x697a('0x2'));var express=require(_0x697a('0x3'));var router=express[_0x697a('0x4')]();var auth=require(_0x697a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x697a('0x6'));var controller=require(_0x697a('0x7'));router[_0x697a('0x8')]('/',auth[_0x697a('0x9')](),controller[_0x697a('0xa')]);router[_0x697a('0x8')](_0x697a('0xb'),auth[_0x697a('0x9')](),controller[_0x697a('0xc')]);router[_0x697a('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x697a('0x8')]('/:id/unread',auth[_0x697a('0x9')](),controller[_0x697a('0xd')]);router[_0x697a('0x8')](_0x697a('0xe'),auth[_0x697a('0x9')](),controller[_0x697a('0xf')]);router[_0x697a('0x8')]('/:id/messages',auth[_0x697a('0x9')](),controller[_0x697a('0x10')]);router[_0x697a('0x11')]('/',auth['isAuthenticated'](),controller[_0x697a('0x12')]);router[_0x697a('0x11')](_0x697a('0xe'),auth[_0x697a('0x9')](),controller[_0x697a('0x13')]);router[_0x697a('0x11')]('/:id/messages',auth[_0x697a('0x9')](),controller[_0x697a('0x14')]);router[_0x697a('0x15')](_0x697a('0x16'),auth[_0x697a('0x9')](),controller['update']);router[_0x697a('0x17')](_0x697a('0x16'),auth[_0x697a('0x9')](),controller[_0x697a('0x18')]);router[_0x697a('0x17')](_0x697a('0xe'),auth[_0x697a('0x9')](),controller['removeMembers']);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 dd07895..63faa2c 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 _0x91a7=['star','STRING','DATE','long','ENUM','out','exports','BOOLEAN','INTEGER'];(function(_0x282f35,_0x3b7c17){var _0x3fbc4b=function(_0x2cb54e){while(--_0x2cb54e){_0x282f35['push'](_0x282f35['shift']());}};_0x3fbc4b(++_0x3b7c17);}(_0x91a7,0xe7));var _0x791a=function(_0x39cf56,_0x3e9787){_0x39cf56=_0x39cf56-0x0;var _0x4b9b47=_0x91a7[_0x39cf56];return _0x4b9b47;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'closed':{'type':Sequelize[_0x791a('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x791a('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x791a('0x3'),'thumb'),'defaultValue':_0x791a('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x791a('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x791a('0x5')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x791a('0x4')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x791a('0x4')]},'osName':{'type':Sequelize[_0x791a('0x4')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x791a('0x4')]},'deviceVendor':{'type':Sequelize[_0x791a('0x4')]},'deviceType':{'type':Sequelize[_0x791a('0x4')]},'referer':{'type':Sequelize[_0x791a('0x4')]},'customerIp':{'type':Sequelize[_0x791a('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x791a('0x6'))},'read1stAt':{'type':Sequelize[_0x791a('0x5')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x791a('0x7')]('in',_0x791a('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x791a('0x4')]}}; \ No newline at end of file +var _0xe511=['star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports','INTEGER'];(function(_0x124e48,_0x3ee43e){var _0x515c64=function(_0x51cd32){while(--_0x51cd32){_0x124e48['push'](_0x124e48['shift']());}};_0x515c64(++_0x3ee43e);}(_0xe511,0x16f));var _0x1e51=function(_0x3e978c,_0x1d5774){_0x3e978c=_0x3e978c-0x0;var _0x295585=_0xe511[_0x3e978c];return _0x295585;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1e51('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x1e51('0x3'),_0x1e51('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1e51('0x5')]},'pathTranscript':{'type':Sequelize[_0x1e51('0x5')]},'mailTranscript':{'type':Sequelize[_0x1e51('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1e51('0x7')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1e51('0x6')]},'browserName':{'type':Sequelize[_0x1e51('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x1e51('0x6')]},'deviceModel':{'type':Sequelize[_0x1e51('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x1e51('0x6')]},'customerIp':{'type':Sequelize[_0x1e51('0x6')]},'formData':{'type':Sequelize[_0x1e51('0x5')](_0x1e51('0x8'))},'read1stAt':{'type':Sequelize[_0x1e51('0x7')]},'lastMsgAt':{'type':Sequelize[_0x1e51('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1e51('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1e51('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 4e27f07..1dda660 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 _0xca62=['request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','update','sendStatus','stack','name','send','index','ChatInteraction','rawAttributes','query','dateStart','dateEnd','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','add','day','merge','filter','options','tag','push','Tags','distinct','include','createdAt','read','count','includeAll','User','CmContact','Owner','fullname','internal','ChatWebsite','Account','key','ChatMessage','direction','Tag','color','ThroughTags','params','create','body','find','describe','customUpdate','abandon','entity\x20not\x20found','Sequelize','closed','closedAt','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','type','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','attachId','download','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','now','pathTranscript','Messages','ChatWebsiteId','UserId','format','agentAlias','System','%s%d','Visitor','ContactId','agentIdentifier','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','user','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','pick','ChatInteractionId','map','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','rows','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','files','tmp','attachments','interaction-%s.zip','Contact','firstName','1cm','mkdirSync','

Chat\x20Interaction:\x20#%d

','

Date:\x20%s

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

','','existsSync','createReadStream','pipe','createWriteStream','interaction-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','client','http','then','info','ChatInteraction,\x20%s,\x20%s'];(function(_0x781db5,_0x3d0ceb){var _0x31d042=function(_0x46eea6){while(--_0x46eea6){_0x781db5['push'](_0x781db5['shift']());}};_0x31d042(++_0x3d0ceb);}(_0xca62,0x179));var _0x2ca6=function(_0x3170ef,_0x5d5be7){_0x3170ef=_0x3170ef-0x0;var _0x59758c=_0xca62[_0x3170ef];return _0x59758c;};'use strict';var pdf=require(_0x2ca6('0x0'));var emlformat=require(_0x2ca6('0x1'));var rimraf=require(_0x2ca6('0x2'));var zipdir=require(_0x2ca6('0x3'));var jsonpatch=require(_0x2ca6('0x4'));var rp=require(_0x2ca6('0x5'));var moment=require('moment');var BPromise=require(_0x2ca6('0x6'));var Mustache=require('mustache');var util=require(_0x2ca6('0x7'));var path=require(_0x2ca6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2ca6('0x9'));var squel=require(_0x2ca6('0xa'));var crypto=require('crypto');var jsforce=require(_0x2ca6('0xb'));var deskjs=require(_0x2ca6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2ca6('0xd'));var Papa=require(_0x2ca6('0xe'));var Redis=require(_0x2ca6('0xf'));var qs=require(_0x2ca6('0x10'));var logger=require(_0x2ca6('0x11'))(_0x2ca6('0x12'));var utils=require(_0x2ca6('0x13'));var config=require(_0x2ca6('0x14'));var db=require(_0x2ca6('0x15'))['db'];config[_0x2ca6('0x16')]=_['defaults'](config[_0x2ca6('0x16')],{'host':_0x2ca6('0x17'),'port':0x18eb});var socket=require(_0x2ca6('0x18'))(new Redis(config['redis']));require(_0x2ca6('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2ca6('0x1a')][_0x2ca6('0x1b')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1fdfa0,_0x429310,_0x35577d,_0x30d9ad){return new BPromise(function(_0x1f38a9,_0x197c84){var _0x1561ff=_0x30d9ad||client;return _0x1561ff['request'](_0x1fdfa0,_0x35577d)[_0x2ca6('0x1c')](function(_0x4bc990){logger[_0x2ca6('0x1d')](_0x2ca6('0x1e'),_0x429310,_0x2ca6('0x1f'));logger[_0x2ca6('0x20')](_0x2ca6('0x21'),_0x429310,_0x2ca6('0x1f'),JSON[_0x2ca6('0x22')](_0x4bc990));if(_0x4bc990[_0x2ca6('0x23')]){if(_0x4bc990[_0x2ca6('0x23')][_0x2ca6('0x24')]===0x1f4){logger[_0x2ca6('0x23')](_0x2ca6('0x1e'),_0x429310,_0x4bc990[_0x2ca6('0x23')][_0x2ca6('0x25')]);return _0x197c84(_0x4bc990[_0x2ca6('0x23')][_0x2ca6('0x25')]);}logger[_0x2ca6('0x23')](_0x2ca6('0x1e'),_0x429310,_0x4bc990[_0x2ca6('0x23')][_0x2ca6('0x25')]);return _0x1f38a9(_0x4bc990[_0x2ca6('0x23')][_0x2ca6('0x25')]);}else{logger[_0x2ca6('0x1d')](_0x2ca6('0x1e'),_0x429310,_0x2ca6('0x1f'));_0x1f38a9(_0x4bc990[_0x2ca6('0x26')][_0x2ca6('0x25')]);}})[_0x2ca6('0x27')](function(_0x1397ef){logger['error'](_0x2ca6('0x1e'),_0x429310,_0x1397ef);_0x197c84(_0x1397ef);});});}function respondWithStatusCode(_0x22187a,_0x4b20be){_0x4b20be=_0x4b20be||0xcc;return function(_0x337658){if(_0x337658){return _0x22187a['sendStatus'](_0x4b20be);}return _0x22187a[_0x2ca6('0x28')](_0x4b20be)[_0x2ca6('0x29')]();};}function respondWithResult(_0x278c7d,_0x3cc40e){_0x3cc40e=_0x3cc40e||0xc8;return function(_0x5a02bc){if(_0x5a02bc){return _0x278c7d[_0x2ca6('0x28')](_0x3cc40e)[_0x2ca6('0x2a')](_0x5a02bc);}};}function respondWithFilteredResult(_0x2ebbb6,_0x4d00a6){return function(_0x49c7ba){if(_0x49c7ba){var _0x12d04a=_0x49c7ba['count'],_0x387147=_0x4d00a6[_0x2ca6('0x2b')],_0x4d0b63=_0x4d00a6[_0x2ca6('0x2b')]+_0x4d00a6[_0x2ca6('0x2c')],_0xdcda37;if(_0x4d0b63>=_0x12d04a){_0x4d0b63=_0x12d04a;_0xdcda37=0xc8;}else{_0xdcda37=0xce;}_0x2ebbb6['status'](_0xdcda37);return _0x2ebbb6[_0x2ca6('0x2d')](_0x2ca6('0x2e'),_0x387147+'-'+_0x4d0b63+'/'+_0x12d04a)[_0x2ca6('0x2a')](_0x49c7ba);}return null;};}function patchUpdates(_0x575f63){return function(_0x30de82){try{jsonpatch[_0x2ca6('0x2f')](_0x30de82,_0x575f63,!![]);}catch(_0x2d7991){return BPromise[_0x2ca6('0x30')](_0x2d7991);}return _0x30de82['save']();};}function saveUpdates(_0x8414d6,_0x2c1923){return function(_0x325b30){if(_0x325b30){return _0x325b30[_0x2ca6('0x31')](_0x8414d6)[_0x2ca6('0x1c')](function(_0x5e8b72){return _0x5e8b72;});}return null;};}function removeEntity(_0x423282,_0x5f020f){return function(_0x6864dc){if(_0x6864dc){return _0x6864dc['destroy']()[_0x2ca6('0x1c')](function(){_0x423282[_0x2ca6('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20b4,_0x3fb728){return function(_0x5c77d6){if(!_0x5c77d6){_0x2a20b4[_0x2ca6('0x32')](0x194);}return _0x5c77d6;};}function handleError(_0x4dd100,_0x4621ab){_0x4621ab=_0x4621ab||0x1f4;return function(_0x111ffd){logger[_0x2ca6('0x23')](_0x111ffd[_0x2ca6('0x33')]);if(_0x111ffd[_0x2ca6('0x34')]){delete _0x111ffd['name'];}_0x4dd100[_0x2ca6('0x28')](_0x4621ab)[_0x2ca6('0x35')](_0x111ffd);};}exports[_0x2ca6('0x36')]=function(_0x503972,_0xc69add){var _0x2ca0d0={},_0x4170db={},_0x382619={'count':0x0,'rows':[]};var _0x598d5b=db[_0x2ca6('0x37')][_0x2ca6('0x38')];_0x4170db['model']=_['keys'](_0x598d5b);var _0x58d82f={'dateStart':_0x503972[_0x2ca6('0x39')][_0x2ca6('0x3a')],'dateEnd':_0x503972[_0x2ca6('0x39')][_0x2ca6('0x3b')]};delete _0x503972[_0x2ca6('0x39')]['dateStart'];delete _0x503972['query'][_0x2ca6('0x3b')];_0x4170db[_0x2ca6('0x39')]=_[_0x2ca6('0x3c')](_0x503972[_0x2ca6('0x39')]);_0x4170db['filters']=_[_0x2ca6('0x3d')](_0x4170db[_0x2ca6('0x3e')],_0x4170db[_0x2ca6('0x39')]);_0x2ca0d0['attributes']=_[_0x2ca6('0x3d')](_0x4170db[_0x2ca6('0x3e')],qs['fields'](_0x503972[_0x2ca6('0x39')][_0x2ca6('0x3f')]));_0x2ca0d0['attributes']=_0x2ca0d0[_0x2ca6('0x40')][_0x2ca6('0x41')]?_0x2ca0d0[_0x2ca6('0x40')]:_0x4170db['model'];if(!_0x503972['query']['hasOwnProperty'](_0x2ca6('0x42'))){_0x2ca0d0[_0x2ca6('0x2c')]=qs['limit'](_0x503972['query'][_0x2ca6('0x2c')]);_0x2ca0d0[_0x2ca6('0x2b')]=qs[_0x2ca6('0x2b')](_0x503972[_0x2ca6('0x39')][_0x2ca6('0x2b')]);}_0x2ca0d0[_0x2ca6('0x43')]=qs[_0x2ca6('0x44')](_0x503972[_0x2ca6('0x39')][_0x2ca6('0x44')]);_0x2ca0d0[_0x2ca6('0x45')]=qs['filters'](_['pick'](_0x503972['query'],_0x4170db[_0x2ca6('0x46')]));if(_0x58d82f[_0x2ca6('0x3a')]){if(_0x58d82f[_0x2ca6('0x3b')]){_0x58d82f[_0x2ca6('0x3b')]=moment(_0x58d82f[_0x2ca6('0x3b')])['add'](0x1,'day');}else{_0x58d82f[_0x2ca6('0x3b')]=moment(_0x58d82f[_0x2ca6('0x3a')])[_0x2ca6('0x47')](0x1,_0x2ca6('0x48'));}_[_0x2ca6('0x49')](_0x2ca0d0[_0x2ca6('0x45')],{'createdAt':{'$gte':_0x58d82f[_0x2ca6('0x3a')],'$lte':_0x58d82f['dateEnd']}});}if(_0x503972[_0x2ca6('0x39')][_0x2ca6('0x4a')]){_0x2ca0d0[_0x2ca6('0x45')]=_[_0x2ca6('0x49')](_0x2ca0d0['where'],{'$or':_['map'](_0x2ca0d0['attributes'],function(_0x1814c5){var _0x2ace10={};_0x2ace10[_0x1814c5]={'$like':'%'+_0x503972[_0x2ca6('0x39')][_0x2ca6('0x4a')]+'%'};return _0x2ace10;})});}_0x2ca0d0=_['merge']({},_0x2ca0d0,_0x503972[_0x2ca6('0x4b')]);var _0x2f6c19={'where':_0x2ca0d0[_0x2ca6('0x45')]};_0x2f6c19['include']=[];if(_0x503972['query'][_0x2ca6('0x4c')]){_0x2f6c19['include'][_0x2ca6('0x4d')]({'model':db['Tag'],'as':_0x2ca6('0x4e'),'attributes':['id'],'where':{'id':_0x503972[_0x2ca6('0x39')][_0x2ca6('0x4c')]},'required':!![]});_0x2f6c19[_0x2ca6('0x4f')]=!![];}if(_0x503972['query']['read']){_0x2f6c19[_0x2ca6('0x50')][_0x2ca6('0x4d')]({'model':db['ChatMessage'],'as':'Messages','attributes':['id','direction',_0x2ca6('0x51'),'read'],'where':{'direction':'in','read':_0x503972[_0x2ca6('0x39')][_0x2ca6('0x52')]||![]},'required':!![]});_0x2f6c19[_0x2ca6('0x4f')]=!![];}return db[_0x2ca6('0x37')][_0x2ca6('0x53')](_0x2f6c19)['then'](function(_0x1763e2){_0x382619[_0x2ca6('0x53')]=_0x1763e2;if(_0x503972[_0x2ca6('0x39')][_0x2ca6('0x54')]){_0x2ca0d0[_0x2ca6('0x50')]=[{'model':db[_0x2ca6('0x55')],'as':'Users','required':![],'attributes':['id','name','fullname']},{'model':db[_0x2ca6('0x56')],'as':'Contact','required':![]},{'model':db[_0x2ca6('0x55')],'as':_0x2ca6('0x57'),'attributes':['name',_0x2ca6('0x58'),_0x2ca6('0x59')],'required':![]},{'model':db[_0x2ca6('0x5a')],'as':_0x2ca6('0x5b'),'attributes':['name',_0x2ca6('0x5c')],'required':![]},{'model':db[_0x2ca6('0x5d')],'as':'Messages','attributes':['id',_0x2ca6('0x5e'),'createdAt','read'],'where':{'direction':'in','read':_0x503972[_0x2ca6('0x39')][_0x2ca6('0x52')]||![]},'required':_0x503972['query'][_0x2ca6('0x52')]||![]},{'model':db[_0x2ca6('0x5f')],'as':_0x2ca6('0x4e'),'attributes':['id',_0x2ca6('0x34'),_0x2ca6('0x60')],'required':_0x503972[_0x2ca6('0x39')][_0x2ca6('0x4c')]?!![]:![]},{'model':db['Tag'],'as':_0x2ca6('0x61'),'attributes':['id',_0x2ca6('0x34'),_0x2ca6('0x60')],'through':_0x503972['query'][_0x2ca6('0x4c')]?{'attributes':[],'where':{'TagId':_0x503972['query'][_0x2ca6('0x4c')]||undefined}}:{},'required':_0x503972['query'][_0x2ca6('0x4c')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x2ca0d0);})[_0x2ca6('0x1c')](function(_0x2f7225){_0x382619['rows']=_0x2f7225;return _0x382619;})[_0x2ca6('0x1c')](respondWithFilteredResult(_0xc69add,_0x2ca0d0))['catch'](handleError(_0xc69add,null));};exports['show']=function(_0x80855c,_0x1f8e3b){var _0x5263c2={'raw':![],'where':{'id':_0x80855c[_0x2ca6('0x62')]['id']}},_0x43e514={};_0x43e514[_0x2ca6('0x3e')]=_['keys'](db['ChatInteraction'][_0x2ca6('0x38')]);_0x43e514[_0x2ca6('0x39')]=_[_0x2ca6('0x3c')](_0x80855c['query']);_0x43e514['filters']=_[_0x2ca6('0x3d')](_0x43e514[_0x2ca6('0x3e')],_0x43e514[_0x2ca6('0x39')]);_0x5263c2[_0x2ca6('0x40')]=_[_0x2ca6('0x3d')](_0x43e514['model'],qs[_0x2ca6('0x3f')](_0x80855c[_0x2ca6('0x39')][_0x2ca6('0x3f')]));_0x5263c2['attributes']=_0x5263c2[_0x2ca6('0x40')]['length']?_0x5263c2['attributes']:_0x43e514[_0x2ca6('0x3e')];if(_0x80855c[_0x2ca6('0x39')][_0x2ca6('0x54')]){_0x5263c2[_0x2ca6('0x50')]=[{'all':!![]}];}_0x5263c2=_[_0x2ca6('0x49')]({},_0x5263c2,_0x80855c[_0x2ca6('0x4b')]);return db[_0x2ca6('0x37')]['find'](_0x5263c2)['then'](handleEntityNotFound(_0x1f8e3b,null))[_0x2ca6('0x1c')](respondWithResult(_0x1f8e3b,null))[_0x2ca6('0x27')](handleError(_0x1f8e3b,null));};exports[_0x2ca6('0x63')]=function(_0x37599e,_0x124390){return db[_0x2ca6('0x37')][_0x2ca6('0x63')](_0x37599e[_0x2ca6('0x64')],{})[_0x2ca6('0x1c')](respondWithResult(_0x124390,0xc9))[_0x2ca6('0x27')](handleError(_0x124390,null));};exports['update']=function(_0x38fdcc,_0x2eb6c7){if(_0x38fdcc['body']['id']){delete _0x38fdcc[_0x2ca6('0x64')]['id'];}return db['ChatInteraction'][_0x2ca6('0x65')]({'where':{'id':_0x38fdcc['params']['id']}})[_0x2ca6('0x1c')](handleEntityNotFound(_0x2eb6c7,null))[_0x2ca6('0x1c')](saveUpdates(_0x38fdcc['body'],null))['then'](respondWithResult(_0x2eb6c7,null))[_0x2ca6('0x27')](handleError(_0x2eb6c7,null));};exports['destroy']=function(_0x52f8bb,_0x34a468){return db[_0x2ca6('0x37')][_0x2ca6('0x65')]({'where':{'id':_0x52f8bb[_0x2ca6('0x62')]['id']}})[_0x2ca6('0x1c')](handleEntityNotFound(_0x34a468,null))[_0x2ca6('0x1c')](removeEntity(_0x34a468,null))['catch'](handleError(_0x34a468,null));};exports['describe']=function(_0x14a582,_0x58e72c){return db[_0x2ca6('0x37')][_0x2ca6('0x66')]()['then'](respondWithResult(_0x58e72c,null))['catch'](handleError(_0x58e72c,null));};exports[_0x2ca6('0x67')]=function(_0x4102a7,_0x8928ab){if(_0x4102a7['body']['id']){delete _0x4102a7[_0x2ca6('0x64')]['id'];}return db[_0x2ca6('0x37')][_0x2ca6('0x65')]({'where':{'id':_0x4102a7[_0x2ca6('0x62')]['id']}})[_0x2ca6('0x1c')](handleEntityNotFound(_0x8928ab,null))[_0x2ca6('0x1c')](saveUpdates(_0x4102a7[_0x2ca6('0x64')],null))[_0x2ca6('0x1c')](respondWithResult(_0x8928ab,null))[_0x2ca6('0x27')](handleError(_0x8928ab,null));};exports[_0x2ca6('0x68')]=function(_0x1cb6f5,_0x59a674,_0x41e277){if(_0x1cb6f5[_0x2ca6('0x64')]['id']){delete _0x1cb6f5['body']['id'];}return db['ChatInteraction'][_0x2ca6('0x65')]({'where':{'id':_0x1cb6f5[_0x2ca6('0x62')]['id']}})[_0x2ca6('0x1c')](function(_0x199cbc){if(!_0x199cbc){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x2ca6('0x68'),0x194,_0x2ca6('0x69'));_0x59a674[_0x2ca6('0x32')](0x194);}else{if(_0x199cbc['UserId']){throw new db[(_0x2ca6('0x6a'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x199cbc;})['then'](function(_0xcf3193){if(_0xcf3193){return _0xcf3193[_0x2ca6('0x31')]({'closed':_0x1cb6f5[_0x2ca6('0x64')][_0x2ca6('0x6b')],'closedAt':_0x1cb6f5[_0x2ca6('0x64')][_0x2ca6('0x6c')],'disposition':_0x1cb6f5['body'][_0x2ca6('0x6d')]})[_0x2ca6('0x1c')](function(_0x3ad7e9){return _0x3ad7e9;});}})[_0x2ca6('0x1c')](function(_0x5f217b){return respondWithRpcPromise(_0x2ca6('0x6e'),_0x2ca6('0x68'),_0x1cb6f5[_0x2ca6('0x64')],client9004);})['then'](respondWithResult(_0x59a674,null))[_0x2ca6('0x27')](handleError(_0x59a674,null));};exports[_0x2ca6('0x6f')]=function(_0x5b8a2c,_0x212859,_0xc4eeff){_0x5b8a2c['body'][_0x2ca6('0x34')]=_0x5b8a2c[_0x2ca6('0x70')][_0x2ca6('0x71')];_0x5b8a2c[_0x2ca6('0x64')][_0x2ca6('0x72')]=_0x5b8a2c[_0x2ca6('0x70')][_0x2ca6('0x73')];_0x5b8a2c['body'][_0x2ca6('0x74')]=_0x5b8a2c[_0x2ca6('0x70')][_0x2ca6('0x75')];return db[_0x2ca6('0x76')][_0x2ca6('0x63')](_0x5b8a2c[_0x2ca6('0x64')])['then'](respondWithResult(_0x212859,0xc9))[_0x2ca6('0x27')](handleError(_0x212859,null));};exports[_0x2ca6('0x77')]=function(_0x20c6b5,_0x580f5a,_0x207e4c){return db[_0x2ca6('0x37')][_0x2ca6('0x78')]({'where':{'id':_0x20c6b5['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x580f5a,null))[_0x2ca6('0x1c')](function(_0x586faf){if(_0x586faf){if(_0x586faf[_0x2ca6('0x6b')]){return _0x580f5a[_0x2ca6('0x28')](0x193)[_0x2ca6('0x2a')]({'status':0x193,'message':_0x2ca6('0x79')});}return db[_0x2ca6('0x76')]['findOne']({'where':{'id':_0x20c6b5[_0x2ca6('0x39')][_0x2ca6('0x7a')]},'raw':!![]})[_0x2ca6('0x1c')](handleEntityNotFound(_0x580f5a,null));}})[_0x2ca6('0x1c')](function(_0xd8b9a5){if(_0xd8b9a5){return _0x580f5a[_0x2ca6('0x7b')](path[_0x2ca6('0x7c')](config[_0x2ca6('0x7d')],_0x2ca6('0x7e'),_0xd8b9a5[_0x2ca6('0x72')]));}})['catch'](handleError(_0x580f5a,null));};exports['close']=function(_0x3c3e5c,_0x31c666){var _0x5ddfb4=null;var _0x35a4f4=null;var _0x19eca3=null;var _0x18a4d4=null;if(_0x3c3e5c[_0x2ca6('0x64')]['id']){delete _0x3c3e5c[_0x2ca6('0x64')]['id'];}if(_0x3c3e5c[_0x2ca6('0x64')][_0x2ca6('0x7f')]){_0x18a4d4=path[_0x2ca6('0x7c')](config[_0x2ca6('0x7d')],_0x2ca6('0x80'),util['format']('transcript-%s.txt',Date[_0x2ca6('0x81')]()));_0x3c3e5c[_0x2ca6('0x64')][_0x2ca6('0x82')]=_0x18a4d4;}return db[_0x2ca6('0x37')][_0x2ca6('0x65')]({'where':{'id':_0x3c3e5c[_0x2ca6('0x62')]['id']},'include':[{'model':db[_0x2ca6('0x5d')],'as':_0x2ca6('0x83'),'include':[{'model':db[_0x2ca6('0x55')],'as':_0x2ca6('0x55')}]}]})[_0x2ca6('0x1c')](handleEntityNotFound(_0x31c666,null))[_0x2ca6('0x1c')](saveUpdates(_0x3c3e5c[_0x2ca6('0x64')],null))[_0x2ca6('0x1c')](function(_0x4f1743){if(_0x4f1743){_0x5ddfb4=_0x4f1743;return db[_0x2ca6('0x5a')][_0x2ca6('0x65')]({'where':{'id':_0x5ddfb4[_0x2ca6('0x84')]}});}})['then'](function(_0x5a70a8){if(_0x5a70a8){_0x19eca3=_0x5a70a8;return db[_0x2ca6('0x56')][_0x2ca6('0x65')]({'where':{'id':_0x5ddfb4['ContactId']}});}})[_0x2ca6('0x1c')](function(_0x1ab30c){if(_0x1ab30c){_0x35a4f4=_0x1ab30c;if(_0x18a4d4){var _0x22c609=null;for(var _0xdb3e91=0x1;_0xdb3e91<_0x5ddfb4['Messages'][_0x2ca6('0x41')];++_0xdb3e91){_0x22c609=_0x5ddfb4[_0x2ca6('0x83')][_0xdb3e91];var _0x27c02e=_0x22c609[_0x2ca6('0x85')]?util[_0x2ca6('0x86')]('%s%d',_0x19eca3[_0x2ca6('0x87')],_0x22c609[_0x2ca6('0x85')]):_0x2ca6('0x88');var _0x4be2d9=_0x3c3e5c[_0x2ca6('0x64')]['customer']||util['format'](_0x2ca6('0x89'),_0x2ca6('0x8a'),_0x22c609[_0x2ca6('0x8b')]);switch(_0x19eca3[_0x2ca6('0x8c')]){case'website_alias':_0x27c02e=_0x22c609['UserId']?util[_0x2ca6('0x86')](_0x2ca6('0x89'),_0x19eca3[_0x2ca6('0x87')],_0x22c609['UserId']):'System';break;case'agent_alias':_0x27c02e=_0x22c609[_0x2ca6('0x85')]?_0x22c609[_0x2ca6('0x55')][_0x2ca6('0x8d')]||_0x22c609['User'][_0x2ca6('0x58')]:_0x2ca6('0x88');break;case'agent_fullname':_0x27c02e=_0x22c609['UserId']?_0x22c609[_0x2ca6('0x55')][_0x2ca6('0x58')]:'System';break;default:_0x27c02e=_0x22c609['UserId']?util[_0x2ca6('0x86')]('%s%d',_0x19eca3[_0x2ca6('0x87')],_0x22c609[_0x2ca6('0x85')]):_0x2ca6('0x88');}var _0xe436fa=util[_0x2ca6('0x86')](_0x2ca6('0x8e'),moment(_0x22c609[_0x2ca6('0x51')])[_0x2ca6('0x86')](_0x2ca6('0x8f')),_0x22c609[_0x2ca6('0x5e')]==='in'?_0x4be2d9:_0x27c02e,_0x22c609[_0x2ca6('0x64')]);if(!_0x22c609['secret']){fs[_0x2ca6('0x90')](_0x18a4d4,_0xe436fa);}}return db[_0x2ca6('0x91')][_0x2ca6('0x78')]({'where':{'service':!![]},'include':[{'model':db[_0x2ca6('0x92')],'as':_0x2ca6('0x93'),'raw':!![]}]});}}})['then'](function(_0x3d4c74){if(_0x3d4c74&&_0x3d4c74['Smtp']&&_0x3c3e5c[_0x2ca6('0x64')]){var _0x1eeb6f={'tls':{'rejectUnauthorized':![]}};if(_0x3d4c74['Smtp'][_0x2ca6('0x94')]){_0x1eeb6f[_0x2ca6('0x94')]=_0x3d4c74[_0x2ca6('0x93')][_0x2ca6('0x94')];}else{_0x1eeb6f[_0x2ca6('0x95')]=_0x3d4c74[_0x2ca6('0x93')]['host'];_0x1eeb6f[_0x2ca6('0x96')]=_0x3d4c74[_0x2ca6('0x93')][_0x2ca6('0x96')];_0x1eeb6f[_0x2ca6('0x97')]=_0x3d4c74[_0x2ca6('0x93')][_0x2ca6('0x97')];}if(_0x3d4c74[_0x2ca6('0x93')][_0x2ca6('0x98')]){_0x1eeb6f[_0x2ca6('0x99')]={'user':_0x3d4c74[_0x2ca6('0x93')]['user'],'pass':_0x3d4c74[_0x2ca6('0x93')][_0x2ca6('0x9a')]};}return respondWithRpcPromise(_0x2ca6('0x9b'),_0x2ca6('0x9c'),{'account':_0x1eeb6f,'message':{'from':util[_0x2ca6('0x86')](_0x2ca6('0x9d'),_0x3d4c74[_0x2ca6('0x34')],_0x3d4c74[_0x2ca6('0x9e')]||_0x3d4c74[_0x2ca6('0x93')][_0x2ca6('0x9f')]),'to':_0x3c3e5c[_0x2ca6('0x64')][_0x2ca6('0x7f')],'subject':_0x2ca6('0xa0'),'text':util[_0x2ca6('0x86')](_0x2ca6('0xa1'),_0x3c3e5c[_0x2ca6('0x64')][_0x2ca6('0x7f')]),'attachments':[{'path':_0x18a4d4}]}})[_0x2ca6('0x1c')](function(){return _0x5ddfb4;})[_0x2ca6('0x27')](function(_0x2b67bb){console['error'](_0x2b67bb);});}else{return _0x5ddfb4;}})[_0x2ca6('0x1c')](respondWithStatusCode(_0x31c666,0xc8))[_0x2ca6('0x27')](handleError(_0x31c666,null));};exports[_0x2ca6('0xa2')]=function(_0x44c5d0,_0xfb82c5,_0x1af51e){return db['ChatMessage']['find']({'where':{'id':_0x44c5d0['params']['id']}})[_0x2ca6('0x1c')](handleEntityNotFound(_0xfb82c5,null))[_0x2ca6('0x1c')](function(_0x1a19ae){if(_0x1a19ae){return _0x1a19ae[_0x2ca6('0xa2')](_0x44c5d0[_0x2ca6('0x64')][_0x2ca6('0xa3')],_[_0x2ca6('0xa4')](_0x44c5d0[_0x2ca6('0x64')],['ids','id'])||{});}})[_0x2ca6('0x1c')](respondWithResult(_0xfb82c5,null))[_0x2ca6('0x27')](handleError(_0xfb82c5,null));};exports[_0x2ca6('0xa5')]=function(_0x4d123e,_0x239075,_0x16d983){var _0xb13f97={'raw':![],'where':{}};var _0x57d6d8={};var _0x3a70ce={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x4d123e[_0x2ca6('0x62')]['id']}})[_0x2ca6('0x1c')](handleEntityNotFound(_0x239075,null))[_0x2ca6('0x1c')](function(_0x1f4b43){if(_0x1f4b43){_0x57d6d8[_0x2ca6('0x3e')]=_[_0x2ca6('0x3c')](db[_0x2ca6('0x5d')]['rawAttributes']);_0x57d6d8[_0x2ca6('0x39')]=_[_0x2ca6('0x3c')](_0x4d123e[_0x2ca6('0x39')]);_0x57d6d8[_0x2ca6('0x46')]=_[_0x2ca6('0x3d')](_0x57d6d8[_0x2ca6('0x3e')],_0x57d6d8[_0x2ca6('0x39')]);_0xb13f97[_0x2ca6('0x40')]=_['intersection'](_0x57d6d8[_0x2ca6('0x3e')],qs[_0x2ca6('0x3f')](_0x4d123e[_0x2ca6('0x39')]['fields']));_0xb13f97[_0x2ca6('0x40')]=_0xb13f97['attributes']['length']?_0xb13f97[_0x2ca6('0x40')]:_0x57d6d8[_0x2ca6('0x3e')];if(!_0x4d123e['query'][_0x2ca6('0xa6')](_0x2ca6('0x42'))){_0xb13f97[_0x2ca6('0x2c')]=qs[_0x2ca6('0x2c')](_0x4d123e[_0x2ca6('0x39')][_0x2ca6('0x2c')]);_0xb13f97[_0x2ca6('0x2b')]=qs[_0x2ca6('0x2b')](_0x4d123e[_0x2ca6('0x39')][_0x2ca6('0x2b')]);}_0xb13f97[_0x2ca6('0x43')]=qs['sort'](_0x4d123e[_0x2ca6('0x39')][_0x2ca6('0x44')]);_0xb13f97[_0x2ca6('0x45')]=qs[_0x2ca6('0x46')](_[_0x2ca6('0xa7')](_0x4d123e['query'],_0x57d6d8[_0x2ca6('0x46')]));_0xb13f97[_0x2ca6('0x45')][_0x2ca6('0xa8')]=_0x1f4b43['id'];if(_0x4d123e[_0x2ca6('0x39')][_0x2ca6('0x4a')]){_0xb13f97[_0x2ca6('0x45')]=_[_0x2ca6('0x49')](_0xb13f97[_0x2ca6('0x45')],{'$or':_[_0x2ca6('0xa9')](_0xb13f97[_0x2ca6('0x40')],function(_0x4e21cb){var _0x47d71d={};_0x47d71d[_0x4e21cb]={'$like':'%'+_0x4d123e[_0x2ca6('0x39')][_0x2ca6('0x4a')]+'%'};return _0x47d71d;})});}if(_0x4d123e['query']['$gte']){var _0x6cbc59=_0x4d123e[_0x2ca6('0x39')][_0x2ca6('0xaa')]['split'](',');var _0x21c214={};_0x21c214[_0x6cbc59[0x0]]={'$gte':moment(_0x6cbc59[0x1])['format'](_0x2ca6('0xab'))};_0xb13f97[_0x2ca6('0x45')]=_['merge'](_0xb13f97['where'],_0x21c214);}_0xb13f97=_[_0x2ca6('0x49')]({},_0xb13f97,_0x4d123e['options']);return db[_0x2ca6('0x5d')][_0x2ca6('0x53')]({'where':_0xb13f97[_0x2ca6('0x45')]})[_0x2ca6('0x1c')](function(_0x480c00){_0x3a70ce[_0x2ca6('0x53')]=_0x480c00;if(_0x4d123e[_0x2ca6('0x39')][_0x2ca6('0x54')]){_0xb13f97[_0x2ca6('0x50')]=[{'all':!![]}];}return db[_0x2ca6('0x5d')][_0x2ca6('0xac')](_0xb13f97);})['then'](function(_0x51147b){_0x3a70ce['rows']=_0x51147b;return _0x3a70ce;});}})[_0x2ca6('0x1c')](respondWithFilteredResult(_0x239075,_0xb13f97))['catch'](handleError(_0x239075,null));};exports[_0x2ca6('0xad')]=function(_0x223884,_0x49f045,_0x195966){var _0x2aab7b={'where':{}},_0x1c7baa={},_0x4fc3a6={'count':0x0,'rows':[]};return db[_0x2ca6('0x37')][_0x2ca6('0x78')]({'where':{'id':_0x223884[_0x2ca6('0x62')]['id']}})['then'](handleEntityNotFound(_0x49f045,null))[_0x2ca6('0x1c')](function(_0x29c991){if(_0x29c991){_0x1c7baa['model']=_[_0x2ca6('0x3c')](db['ChatMessage']['rawAttributes']);_0x1c7baa['query']=_[_0x2ca6('0x3c')](_0x223884[_0x2ca6('0x39')]);_0x1c7baa[_0x2ca6('0x46')]=_[_0x2ca6('0x3d')](_0x1c7baa[_0x2ca6('0x3e')],_0x1c7baa['query']);_0x2aab7b[_0x2ca6('0x40')]=_[_0x2ca6('0x3d')](_0x1c7baa[_0x2ca6('0x3e')],qs[_0x2ca6('0x3f')](_0x223884[_0x2ca6('0x39')][_0x2ca6('0x3f')]));_0x2aab7b['attributes']=_0x2aab7b[_0x2ca6('0x40')][_0x2ca6('0x41')]?_0x2aab7b[_0x2ca6('0x40')]:_0x1c7baa['model'];if(!_0x223884['query'][_0x2ca6('0xa6')]('nolimit')){_0x2aab7b[_0x2ca6('0x2c')]=qs[_0x2ca6('0x2c')](_0x223884[_0x2ca6('0x39')][_0x2ca6('0x2c')]);_0x2aab7b[_0x2ca6('0x2b')]=qs[_0x2ca6('0x2b')](_0x223884['query']['offset']);}_0x2aab7b[_0x2ca6('0x43')]=qs[_0x2ca6('0x44')](_0x223884[_0x2ca6('0x39')][_0x2ca6('0x44')]);_0x2aab7b[_0x2ca6('0x45')]=qs['filters'](_[_0x2ca6('0xa7')](_0x223884[_0x2ca6('0x39')],_0x1c7baa[_0x2ca6('0x46')]));_0x2aab7b[_0x2ca6('0x45')][_0x2ca6('0xa8')]=_0x29c991['id'];if(_0x223884[_0x2ca6('0x39')]['filter']){_0x2aab7b[_0x2ca6('0x45')]=_[_0x2ca6('0x49')](_0x2aab7b[_0x2ca6('0x45')],{'$or':_[_0x2ca6('0xa9')](_0x2aab7b[_0x2ca6('0x40')],function(_0x73c6fa){var _0xa00f03={};_0xa00f03[_0x73c6fa]={'$like':'%'+_0x223884[_0x2ca6('0x39')][_0x2ca6('0x4a')]+'%'};return _0xa00f03;})});}_0x2aab7b[_0x2ca6('0x45')]['secret']=![];if(_0x223884['query']['id']){_0x2aab7b[_0x2ca6('0x45')]['id']={'$gt':_0x223884[_0x2ca6('0x39')]['id']};}_0x2aab7b=_[_0x2ca6('0x49')]({},_0x2aab7b,_0x223884['options']);return db[_0x2ca6('0x5d')][_0x2ca6('0x53')]({'where':_0x2aab7b['where']})[_0x2ca6('0x1c')](function(_0x50ddca){_0x4fc3a6[_0x2ca6('0x53')]=_0x50ddca;_0x2aab7b[_0x2ca6('0x50')]=[];if(_0x223884[_0x2ca6('0x39')]['includeAgent']){_0x2aab7b[_0x2ca6('0x50')]['push']({'model':db[_0x2ca6('0x55')],'as':_0x2ca6('0x55'),'attributes':['id',_0x2ca6('0x58'),'alias']});}if(_0x223884[_0x2ca6('0x39')][_0x2ca6('0x54')]){_0x2aab7b[_0x2ca6('0x50')]=[{'all':!![]}];}return db[_0x2ca6('0x5d')][_0x2ca6('0xac')](_0x2aab7b);})[_0x2ca6('0x1c')](function(_0x4b8a96){_0x4fc3a6[_0x2ca6('0xae')]=_0x4b8a96;return _0x4fc3a6;});}})[_0x2ca6('0x1c')](respondWithFilteredResult(_0x49f045,_0x2aab7b))['catch'](handleError(_0x49f045,null));};exports['addTags']=function(_0xca30fe,_0x37e9a4,_0x48609f){return db['ChatInteraction']['find']({'where':{'id':_0xca30fe[_0x2ca6('0x62')]['id']}})[_0x2ca6('0x1c')](handleEntityNotFound(_0x37e9a4,null))[_0x2ca6('0x1c')](function(_0x2d24e0){if(_0x2d24e0){return _0x2d24e0[_0x2ca6('0xaf')](_0xca30fe[_0x2ca6('0x64')][_0x2ca6('0xa3')],_[_0x2ca6('0xa4')](_0xca30fe[_0x2ca6('0x64')],[_0x2ca6('0xa3'),'id'])||{})[_0x2ca6('0xb0')](function(){return db[_0x2ca6('0x5f')][_0x2ca6('0xac')]({'attributes':['id',_0x2ca6('0x34'),_0x2ca6('0x60')],'where':{'id':_0xca30fe['body'][_0x2ca6('0xa3')]}});})[_0x2ca6('0x1c')](function(_0x203165){socket[_0x2ca6('0xb1')](_0x2ca6('0xb2'),{'id':Number(_0xca30fe['params']['id']),'tags':_0x203165||[]});return{'id':Number(_0xca30fe[_0x2ca6('0x62')]['id']),'tags':_0x203165||[]};});}})[_0x2ca6('0x1c')](respondWithResult(_0x37e9a4,null))[_0x2ca6('0x27')](handleError(_0x37e9a4,null));};exports[_0x2ca6('0xb3')]=function(_0x51b29a,_0x32c6b5,_0x3ffd6f){var _0x58d094;return db['ChatInteraction'][_0x2ca6('0x65')]({'where':{'id':_0x51b29a[_0x2ca6('0x62')]['id']}})['then'](handleEntityNotFound(_0x32c6b5,null))['then'](function(_0x535710){if(_0x535710){return _0x535710[_0x2ca6('0xb3')](_0x51b29a[_0x2ca6('0x39')][_0x2ca6('0xa3')]);}})[_0x2ca6('0x1c')](respondWithStatusCode(_0x32c6b5,null))['catch'](handleError(_0x32c6b5,null));};exports['download']=function(_0x3c02e9,_0x419d31){var _0x5640e7=moment()[_0x2ca6('0xb4')]()['toString']();var _0x36e44c=path[_0x2ca6('0x7c')](config['root'],'server',_0x2ca6('0xb5'),_0x2ca6('0xb6'));var _0x2ac3e4=path[_0x2ca6('0x7c')](config[_0x2ca6('0x7d')],'server',_0x2ca6('0xb5'),_0x2ca6('0xb7'));var _0x1c4344=path[_0x2ca6('0x7c')](_0x36e44c,_0x5640e7);var _0x2d3be2=util[_0x2ca6('0x86')](_0x2ca6('0xb8'),_0x5640e7);var _0x123be0=path['join'](_0x36e44c,_0x2d3be2);var _0x24c0fb=![];return db[_0x2ca6('0x37')][_0x2ca6('0x65')]({'where':{'id':_0x3c02e9[_0x2ca6('0x62')]['id']},'include':[{'model':db[_0x2ca6('0x5d')],'as':_0x2ca6('0x83'),'attributes':['id',_0x2ca6('0x64')],'include':[{'model':db[_0x2ca6('0x55')],'as':_0x2ca6('0x55'),'attributes':['id',_0x2ca6('0x58')],'raw':!![]},{'model':db['CmContact'],'as':_0x2ca6('0xb9'),'attributes':['id',_0x2ca6('0xba')],'raw':!![]},{'model':db['Attachment'],'as':_0x2ca6('0x76'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x419d31,null))[_0x2ca6('0x1c')](function(_0x184169){if(_0x184169){_0x24c0fb=!![];var _0x4569e4='';var _0x3d6762={'format':'Letter','border':_0x2ca6('0xbb')};fs[_0x2ca6('0xbc')](_0x1c4344);_0x4569e4+=util[_0x2ca6('0x86')](_0x2ca6('0xbd'),_0x184169['id']);_0x4569e4+=util[_0x2ca6('0x86')](_0x2ca6('0xbe'),moment()[_0x2ca6('0x86')]('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')['toString']());_0x4569e4+=_0x2ca6('0xbf');for(var _0x2953b6=0x1;_0x2953b6<_0x184169[_0x2ca6('0x83')][_0x2ca6('0x41')];_0x2953b6++){var _0x4e6db3=_0x184169[_0x2ca6('0x83')][_0x2953b6];_0x4569e4+=_0x2ca6('0xc0');_0x4569e4+=util['format'](_0x2ca6('0xc1'),_0x4e6db3['User']?_0x4e6db3[_0x2ca6('0x55')][_0x2ca6('0x58')]:_0x4e6db3['Contact'][_0x2ca6('0xba')],_0x4e6db3[_0x2ca6('0x64')]);_0x4569e4+=_0x2ca6('0xc2');if(_0x4e6db3[_0x2ca6('0x76')]){var _0x296670=_0x4e6db3[_0x2ca6('0x76')];var _0x1021a3=path['join'](_0x2ac3e4,_0x296670[_0x2ca6('0x72')]);if(fs[_0x2ca6('0xc3')](_0x1021a3)){fs[_0x2ca6('0xc4')](_0x1021a3)[_0x2ca6('0xc5')](fs[_0x2ca6('0xc6')](path[_0x2ca6('0x7c')](_0x1c4344,_0x296670[_0x2ca6('0x72')])));}}}return new BPromise(function(_0x224dfd,_0x26d02b){pdf[_0x2ca6('0x63')](_0x4569e4,_0x3d6762)['toFile'](path['join'](_0x1c4344,_0x2ca6('0xc7')+_0x5640e7+_0x2ca6('0xc8')),function(_0x3ea403,_0x121e42){if(_0x3ea403)return _0x26d02b(_0x3ea403);_0x224dfd(_0x121e42);});});}})['then'](function(){if(_0x24c0fb){return new BPromise(function(_0x5db7a5,_0x28ce35){zipdir(_0x1c4344,{'saveTo':_0x123be0},function(_0x588997,_0x2af359){if(_0x588997)return _0x28ce35(_0x588997);return _0x5db7a5(_0x2af359);});});}})[_0x2ca6('0x1c')](function(){if(_0x24c0fb){return new BPromise(function(_0x43198e,_0x3add79){rimraf(_0x1c4344,function(_0xbfe414){if(_0xbfe414)_0x3add79(_0xbfe414);return _0x43198e();});});}})['then'](function(){if(_0x24c0fb){return _0x419d31[_0x2ca6('0x7b')](_0x123be0,_0x2d3be2,function(_0xb424b8){if(_0xb424b8){console[_0x2ca6('0xc9')](_0x2ca6('0xca'),_0xb424b8);}else{fs[_0x2ca6('0xcb')](_0x123be0);}});}else{return _0x419d31[_0x2ca6('0x32')](0xc8);}})[_0x2ca6('0x27')](handleError(_0x419d31,null));}; \ No newline at end of file +var _0xbca2=['destroy','stack','name','send','index','ChatInteraction','rawAttributes','model','keys','dateEnd','query','dateStart','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','add','day','filter','map','merge','options','tag','include','push','Tags','distinct','ChatMessage','createdAt','read','Users','fullname','CmContact','Contact','User','Owner','internal','ChatWebsite','Account','key','Messages','direction','Tag','color','findAll','rows','catch','show','includeAll','find','create','body','params','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','ValidationError','Interaction\x20already\x20assigned','closedAt','AbandonInteraction','originalname','basename','filename','type','file','mimetype','Attachment','attachmentDownload','findOne','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','ChatWebsiteId','ContactId','%s%d','agentAlias','customer','agentIdentifier','System','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','service','Smtp','host','port','secure','authentication','auth','sendMail','\x22%s\x22\x20<%s>','email','user','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','$gte','split','getMyMessages','addTags','setTags','omit','spread','chatInteractionTags:save','removeTags','toString','server','files','tmp','interaction-%s.zip','firstName','1cm','mkdirSync','

Chat\x20Interaction:\x20#%d

','

Date:\x20%s

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

','','existsSync','pipe','createWriteStream','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','end','status','json','count','limit','set','Content-Range','reject','save','update'];(function(_0x1784ae,_0x485117){var _0xc5291d=function(_0x398d6d){while(--_0x398d6d){_0x1784ae['push'](_0x1784ae['shift']());}};_0xc5291d(++_0x485117);}(_0xbca2,0x161));var _0x2bca=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xbca2[_0x2a67fe];return _0x57e726;};'use strict';var pdf=require(_0x2bca('0x0'));var emlformat=require(_0x2bca('0x1'));var rimraf=require(_0x2bca('0x2'));var zipdir=require(_0x2bca('0x3'));var jsonpatch=require(_0x2bca('0x4'));var rp=require(_0x2bca('0x5'));var moment=require('moment');var BPromise=require(_0x2bca('0x6'));var Mustache=require(_0x2bca('0x7'));var util=require(_0x2bca('0x8'));var path=require(_0x2bca('0x9'));var sox=require(_0x2bca('0xa'));var csv=require(_0x2bca('0xb'));var ejs=require(_0x2bca('0xc'));var fs=require('fs');var _=require(_0x2bca('0xd'));var squel=require(_0x2bca('0xe'));var crypto=require(_0x2bca('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2bca('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2bca('0x11'));var Papa=require(_0x2bca('0x12'));var Redis=require(_0x2bca('0x13'));var qs=require(_0x2bca('0x14'));var logger=require(_0x2bca('0x15'))(_0x2bca('0x16'));var utils=require('../../config/utils');var config=require(_0x2bca('0x17'));var db=require(_0x2bca('0x18'))['db'];config[_0x2bca('0x19')]=_[_0x2bca('0x1a')](config['redis'],{'host':_0x2bca('0x1b'),'port':0x18eb});var socket=require(_0x2bca('0x1c'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x2bca('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2bca('0x1e')][_0x2bca('0x1f')]({'port':0x232b});var client9004=jayson[_0x2bca('0x1e')][_0x2bca('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x4cd18c,_0xde2c79,_0x3f00e2,_0x1a83af){return new BPromise(function(_0x164a80,_0x4e8e1a){var _0x5830b6=_0x1a83af||client;return _0x5830b6[_0x2bca('0x20')](_0x4cd18c,_0x3f00e2)[_0x2bca('0x21')](function(_0xa2515b){logger[_0x2bca('0x22')]('ChatInteraction,\x20%s,\x20%s',_0xde2c79,_0x2bca('0x23'));logger[_0x2bca('0x24')](_0x2bca('0x25'),_0xde2c79,'request\x20sent',JSON[_0x2bca('0x26')](_0xa2515b));if(_0xa2515b[_0x2bca('0x27')]){if(_0xa2515b[_0x2bca('0x27')][_0x2bca('0x28')]===0x1f4){logger[_0x2bca('0x27')](_0x2bca('0x29'),_0xde2c79,_0xa2515b[_0x2bca('0x27')][_0x2bca('0x2a')]);return _0x4e8e1a(_0xa2515b[_0x2bca('0x27')][_0x2bca('0x2a')]);}logger[_0x2bca('0x27')]('ChatInteraction,\x20%s,\x20%s',_0xde2c79,_0xa2515b['error'][_0x2bca('0x2a')]);return _0x164a80(_0xa2515b['error'][_0x2bca('0x2a')]);}else{logger[_0x2bca('0x22')](_0x2bca('0x29'),_0xde2c79,'request\x20sent');_0x164a80(_0xa2515b[_0x2bca('0x2b')][_0x2bca('0x2a')]);}})['catch'](function(_0x57a095){logger['error'](_0x2bca('0x29'),_0xde2c79,_0x57a095);_0x4e8e1a(_0x57a095);});});}function respondWithStatusCode(_0x203efe,_0x257a16){_0x257a16=_0x257a16||0xcc;return function(_0x3b537d){if(_0x3b537d){return _0x203efe[_0x2bca('0x2c')](_0x257a16);}return _0x203efe['status'](_0x257a16)[_0x2bca('0x2d')]();};}function respondWithResult(_0x5be044,_0x309a95){_0x309a95=_0x309a95||0xc8;return function(_0x2c48ed){if(_0x2c48ed){return _0x5be044[_0x2bca('0x2e')](_0x309a95)[_0x2bca('0x2f')](_0x2c48ed);}};}function respondWithFilteredResult(_0x358a52,_0x497357){return function(_0x38c16f){if(_0x38c16f){var _0x1aea0b=_0x38c16f[_0x2bca('0x30')],_0x16e849=_0x497357['offset'],_0x126fcc=_0x497357['offset']+_0x497357[_0x2bca('0x31')],_0x329ff0;if(_0x126fcc>=_0x1aea0b){_0x126fcc=_0x1aea0b;_0x329ff0=0xc8;}else{_0x329ff0=0xce;}_0x358a52[_0x2bca('0x2e')](_0x329ff0);return _0x358a52[_0x2bca('0x32')](_0x2bca('0x33'),_0x16e849+'-'+_0x126fcc+'/'+_0x1aea0b)[_0x2bca('0x2f')](_0x38c16f);}return null;};}function patchUpdates(_0x56e67e){return function(_0x5f2868){try{jsonpatch['apply'](_0x5f2868,_0x56e67e,!![]);}catch(_0x59e2d0){return BPromise[_0x2bca('0x34')](_0x59e2d0);}return _0x5f2868[_0x2bca('0x35')]();};}function saveUpdates(_0x542e7f,_0x5462bd){return function(_0x2caa78){if(_0x2caa78){return _0x2caa78[_0x2bca('0x36')](_0x542e7f)[_0x2bca('0x21')](function(_0x2abfa1){return _0x2abfa1;});}return null;};}function removeEntity(_0x26a335,_0x277cc1){return function(_0x473115){if(_0x473115){return _0x473115[_0x2bca('0x37')]()[_0x2bca('0x21')](function(){_0x26a335[_0x2bca('0x2e')](0xcc)[_0x2bca('0x2d')]();});}};}function handleEntityNotFound(_0x2782af,_0x16f0a0){return function(_0x4c3fc4){if(!_0x4c3fc4){_0x2782af[_0x2bca('0x2c')](0x194);}return _0x4c3fc4;};}function handleError(_0x56c817,_0x44b6d6){_0x44b6d6=_0x44b6d6||0x1f4;return function(_0x3e9cdf){logger['error'](_0x3e9cdf[_0x2bca('0x38')]);if(_0x3e9cdf[_0x2bca('0x39')]){delete _0x3e9cdf[_0x2bca('0x39')];}_0x56c817[_0x2bca('0x2e')](_0x44b6d6)[_0x2bca('0x3a')](_0x3e9cdf);};}exports[_0x2bca('0x3b')]=function(_0x2b8c2d,_0x8f3a9a){var _0x4ac21b={},_0x31351f={},_0x31ffe4={'count':0x0,'rows':[]};var _0x439ebe=db[_0x2bca('0x3c')][_0x2bca('0x3d')];_0x31351f[_0x2bca('0x3e')]=_[_0x2bca('0x3f')](_0x439ebe);var _0x20c7d2={'dateStart':_0x2b8c2d['query']['dateStart'],'dateEnd':_0x2b8c2d['query'][_0x2bca('0x40')]};delete _0x2b8c2d[_0x2bca('0x41')][_0x2bca('0x42')];delete _0x2b8c2d[_0x2bca('0x41')][_0x2bca('0x40')];_0x31351f[_0x2bca('0x41')]=_[_0x2bca('0x3f')](_0x2b8c2d[_0x2bca('0x41')]);_0x31351f[_0x2bca('0x43')]=_[_0x2bca('0x44')](_0x31351f[_0x2bca('0x3e')],_0x31351f[_0x2bca('0x41')]);_0x4ac21b[_0x2bca('0x45')]=_[_0x2bca('0x44')](_0x31351f[_0x2bca('0x3e')],qs[_0x2bca('0x46')](_0x2b8c2d[_0x2bca('0x41')]['fields']));_0x4ac21b[_0x2bca('0x45')]=_0x4ac21b['attributes'][_0x2bca('0x47')]?_0x4ac21b['attributes']:_0x31351f[_0x2bca('0x3e')];if(!_0x2b8c2d['query']['hasOwnProperty']('nolimit')){_0x4ac21b[_0x2bca('0x31')]=qs[_0x2bca('0x31')](_0x2b8c2d[_0x2bca('0x41')]['limit']);_0x4ac21b[_0x2bca('0x48')]=qs[_0x2bca('0x48')](_0x2b8c2d[_0x2bca('0x41')][_0x2bca('0x48')]);}_0x4ac21b[_0x2bca('0x49')]=qs[_0x2bca('0x4a')](_0x2b8c2d[_0x2bca('0x41')][_0x2bca('0x4a')]);_0x4ac21b[_0x2bca('0x4b')]=qs[_0x2bca('0x43')](_[_0x2bca('0x4c')](_0x2b8c2d[_0x2bca('0x41')],_0x31351f['filters']));if(_0x20c7d2[_0x2bca('0x42')]){if(_0x20c7d2[_0x2bca('0x40')]){_0x20c7d2[_0x2bca('0x40')]=moment(_0x20c7d2[_0x2bca('0x40')])['add'](0x1,'day');}else{_0x20c7d2['dateEnd']=moment(_0x20c7d2[_0x2bca('0x42')])[_0x2bca('0x4d')](0x1,_0x2bca('0x4e'));}_['merge'](_0x4ac21b[_0x2bca('0x4b')],{'createdAt':{'$gte':_0x20c7d2[_0x2bca('0x42')],'$lte':_0x20c7d2[_0x2bca('0x40')]}});}if(_0x2b8c2d[_0x2bca('0x41')][_0x2bca('0x4f')]){_0x4ac21b['where']=_['merge'](_0x4ac21b[_0x2bca('0x4b')],{'$or':_[_0x2bca('0x50')](_0x4ac21b[_0x2bca('0x45')],function(_0x2a6714){var _0x51c6ec={};_0x51c6ec[_0x2a6714]={'$like':'%'+_0x2b8c2d['query'][_0x2bca('0x4f')]+'%'};return _0x51c6ec;})});}_0x4ac21b=_[_0x2bca('0x51')]({},_0x4ac21b,_0x2b8c2d[_0x2bca('0x52')]);var _0x1cc257={'where':_0x4ac21b[_0x2bca('0x4b')]};_0x1cc257['include']=[];if(_0x2b8c2d['query'][_0x2bca('0x53')]){_0x1cc257[_0x2bca('0x54')][_0x2bca('0x55')]({'model':db['Tag'],'as':_0x2bca('0x56'),'attributes':['id'],'where':{'id':_0x2b8c2d[_0x2bca('0x41')]['tag']},'required':!![]});_0x1cc257[_0x2bca('0x57')]=!![];}if(_0x2b8c2d[_0x2bca('0x41')]['read']){_0x1cc257['include'][_0x2bca('0x55')]({'model':db[_0x2bca('0x58')],'as':'Messages','attributes':['id','direction',_0x2bca('0x59'),'read'],'where':{'direction':'in','read':_0x2b8c2d['query'][_0x2bca('0x5a')]||![]},'required':!![]});_0x1cc257[_0x2bca('0x57')]=!![];}return db[_0x2bca('0x3c')][_0x2bca('0x30')](_0x1cc257)[_0x2bca('0x21')](function(_0x5365f2){_0x31ffe4[_0x2bca('0x30')]=_0x5365f2;if(_0x2b8c2d['query']['includeAll']){_0x4ac21b['include']=[{'model':db['User'],'as':_0x2bca('0x5b'),'required':![],'attributes':['id',_0x2bca('0x39'),_0x2bca('0x5c')]},{'model':db[_0x2bca('0x5d')],'as':_0x2bca('0x5e'),'required':![]},{'model':db[_0x2bca('0x5f')],'as':_0x2bca('0x60'),'attributes':[_0x2bca('0x39'),_0x2bca('0x5c'),_0x2bca('0x61')],'required':![]},{'model':db[_0x2bca('0x62')],'as':_0x2bca('0x63'),'attributes':[_0x2bca('0x39'),_0x2bca('0x64')],'required':![]},{'model':db[_0x2bca('0x58')],'as':_0x2bca('0x65'),'attributes':['id',_0x2bca('0x66'),_0x2bca('0x59'),_0x2bca('0x5a')],'where':{'direction':'in','read':_0x2b8c2d[_0x2bca('0x41')][_0x2bca('0x5a')]||![]},'required':_0x2b8c2d[_0x2bca('0x41')][_0x2bca('0x5a')]||![]},{'model':db[_0x2bca('0x67')],'as':'Tags','attributes':['id','name','color'],'required':_0x2b8c2d[_0x2bca('0x41')][_0x2bca('0x53')]?!![]:![]},{'model':db[_0x2bca('0x67')],'as':'ThroughTags','attributes':['id','name',_0x2bca('0x68')],'through':_0x2b8c2d['query']['tag']?{'attributes':[],'where':{'TagId':_0x2b8c2d[_0x2bca('0x41')][_0x2bca('0x53')]||undefined}}:{},'required':_0x2b8c2d[_0x2bca('0x41')][_0x2bca('0x53')]?!![]:![]}];}return db[_0x2bca('0x3c')][_0x2bca('0x69')](_0x4ac21b);})['then'](function(_0x3e7285){_0x31ffe4[_0x2bca('0x6a')]=_0x3e7285;return _0x31ffe4;})[_0x2bca('0x21')](respondWithFilteredResult(_0x8f3a9a,_0x4ac21b))[_0x2bca('0x6b')](handleError(_0x8f3a9a,null));};exports[_0x2bca('0x6c')]=function(_0x54860b,_0x2b6c6b){var _0x8c8c76={'raw':![],'where':{'id':_0x54860b['params']['id']}},_0x21e46a={};_0x21e46a[_0x2bca('0x3e')]=_[_0x2bca('0x3f')](db['ChatInteraction'][_0x2bca('0x3d')]);_0x21e46a[_0x2bca('0x41')]=_['keys'](_0x54860b[_0x2bca('0x41')]);_0x21e46a['filters']=_[_0x2bca('0x44')](_0x21e46a[_0x2bca('0x3e')],_0x21e46a[_0x2bca('0x41')]);_0x8c8c76[_0x2bca('0x45')]=_[_0x2bca('0x44')](_0x21e46a[_0x2bca('0x3e')],qs[_0x2bca('0x46')](_0x54860b['query'][_0x2bca('0x46')]));_0x8c8c76[_0x2bca('0x45')]=_0x8c8c76[_0x2bca('0x45')][_0x2bca('0x47')]?_0x8c8c76[_0x2bca('0x45')]:_0x21e46a['model'];if(_0x54860b['query'][_0x2bca('0x6d')]){_0x8c8c76['include']=[{'all':!![]}];}_0x8c8c76=_[_0x2bca('0x51')]({},_0x8c8c76,_0x54860b[_0x2bca('0x52')]);return db['ChatInteraction'][_0x2bca('0x6e')](_0x8c8c76)['then'](handleEntityNotFound(_0x2b6c6b,null))[_0x2bca('0x21')](respondWithResult(_0x2b6c6b,null))[_0x2bca('0x6b')](handleError(_0x2b6c6b,null));};exports['create']=function(_0x2deeae,_0x132b88){return db[_0x2bca('0x3c')][_0x2bca('0x6f')](_0x2deeae[_0x2bca('0x70')],{})[_0x2bca('0x21')](respondWithResult(_0x132b88,0xc9))[_0x2bca('0x6b')](handleError(_0x132b88,null));};exports[_0x2bca('0x36')]=function(_0x27a25a,_0x3c1571){if(_0x27a25a[_0x2bca('0x70')]['id']){delete _0x27a25a['body']['id'];}return db[_0x2bca('0x3c')][_0x2bca('0x6e')]({'where':{'id':_0x27a25a['params']['id']}})[_0x2bca('0x21')](handleEntityNotFound(_0x3c1571,null))[_0x2bca('0x21')](saveUpdates(_0x27a25a[_0x2bca('0x70')],null))['then'](respondWithResult(_0x3c1571,null))[_0x2bca('0x6b')](handleError(_0x3c1571,null));};exports[_0x2bca('0x37')]=function(_0x3e3afe,_0x4e45ad){return db[_0x2bca('0x3c')][_0x2bca('0x6e')]({'where':{'id':_0x3e3afe[_0x2bca('0x71')]['id']}})[_0x2bca('0x21')](handleEntityNotFound(_0x4e45ad,null))[_0x2bca('0x21')](removeEntity(_0x4e45ad,null))[_0x2bca('0x6b')](handleError(_0x4e45ad,null));};exports[_0x2bca('0x72')]=function(_0x5cc12a,_0x2e5640){return db['ChatInteraction']['describe']()[_0x2bca('0x21')](respondWithResult(_0x2e5640,null))['catch'](handleError(_0x2e5640,null));};exports[_0x2bca('0x73')]=function(_0x162d37,_0xf70c99){if(_0x162d37[_0x2bca('0x70')]['id']){delete _0x162d37[_0x2bca('0x70')]['id'];}return db['ChatInteraction'][_0x2bca('0x6e')]({'where':{'id':_0x162d37[_0x2bca('0x71')]['id']}})[_0x2bca('0x21')](handleEntityNotFound(_0xf70c99,null))['then'](saveUpdates(_0x162d37[_0x2bca('0x70')],null))[_0x2bca('0x21')](respondWithResult(_0xf70c99,null))[_0x2bca('0x6b')](handleError(_0xf70c99,null));};exports[_0x2bca('0x74')]=function(_0x58c642,_0x41711b,_0x20e797){if(_0x58c642[_0x2bca('0x70')]['id']){delete _0x58c642[_0x2bca('0x70')]['id'];}return db['ChatInteraction'][_0x2bca('0x6e')]({'where':{'id':_0x58c642[_0x2bca('0x71')]['id']}})[_0x2bca('0x21')](function(_0x365bf7){if(!_0x365bf7){logger['error'](_0x2bca('0x75'),_0x2bca('0x74'),0x194,'entity\x20not\x20found');_0x41711b[_0x2bca('0x2c')](0x194);}else{if(_0x365bf7[_0x2bca('0x76')]){throw new db['Sequelize'][(_0x2bca('0x77'))](_0x2bca('0x78'));}}return _0x365bf7;})['then'](function(_0x37e43e){if(_0x37e43e){return _0x37e43e[_0x2bca('0x36')]({'closed':_0x58c642[_0x2bca('0x70')]['closed'],'closedAt':_0x58c642['body'][_0x2bca('0x79')],'disposition':_0x58c642['body']['disposition']})[_0x2bca('0x21')](function(_0x56d2a9){return _0x56d2a9;});}})['then'](function(_0x32396a){return respondWithRpcPromise(_0x2bca('0x7a'),_0x2bca('0x74'),_0x58c642[_0x2bca('0x70')],client9004);})[_0x2bca('0x21')](respondWithResult(_0x41711b,null))[_0x2bca('0x6b')](handleError(_0x41711b,null));};exports['attachmentUpload']=function(_0x42a7c3,_0xe8e3d2,_0xa3bed0){_0x42a7c3[_0x2bca('0x70')][_0x2bca('0x39')]=_0x42a7c3['file'][_0x2bca('0x7b')];_0x42a7c3[_0x2bca('0x70')][_0x2bca('0x7c')]=_0x42a7c3['file'][_0x2bca('0x7d')];_0x42a7c3['body'][_0x2bca('0x7e')]=_0x42a7c3[_0x2bca('0x7f')][_0x2bca('0x80')];return db[_0x2bca('0x81')][_0x2bca('0x6f')](_0x42a7c3[_0x2bca('0x70')])[_0x2bca('0x21')](respondWithResult(_0xe8e3d2,0xc9))[_0x2bca('0x6b')](handleError(_0xe8e3d2,null));};exports[_0x2bca('0x82')]=function(_0xc86ce3,_0x465905,_0x56b8f3){return db[_0x2bca('0x3c')][_0x2bca('0x83')]({'where':{'id':_0xc86ce3[_0x2bca('0x71')]['id']},'raw':!![]})[_0x2bca('0x21')](handleEntityNotFound(_0x465905,null))['then'](function(_0x4d3d71){if(_0x4d3d71){if(_0x4d3d71['closed']){return _0x465905[_0x2bca('0x2e')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db['Attachment']['findOne']({'where':{'id':_0xc86ce3[_0x2bca('0x41')][_0x2bca('0x84')]},'raw':!![]})[_0x2bca('0x21')](handleEntityNotFound(_0x465905,null));}})[_0x2bca('0x21')](function(_0x4a2877){if(_0x4a2877){return _0x465905[_0x2bca('0x85')](path[_0x2bca('0x86')](config[_0x2bca('0x87')],_0x2bca('0x88'),_0x4a2877[_0x2bca('0x7c')]));}})[_0x2bca('0x6b')](handleError(_0x465905,null));};exports[_0x2bca('0x89')]=function(_0x37ec3a,_0xb6b1ae){var _0x291da6=null;var _0x48c293=null;var _0x40fa9d=null;var _0x5c92b3=null;if(_0x37ec3a[_0x2bca('0x70')]['id']){delete _0x37ec3a[_0x2bca('0x70')]['id'];}if(_0x37ec3a[_0x2bca('0x70')][_0x2bca('0x8a')]){_0x5c92b3=path[_0x2bca('0x86')](config['root'],_0x2bca('0x8b'),util[_0x2bca('0x8c')](_0x2bca('0x8d'),Date[_0x2bca('0x8e')]()));_0x37ec3a[_0x2bca('0x70')]['pathTranscript']=_0x5c92b3;}return db[_0x2bca('0x3c')][_0x2bca('0x6e')]({'where':{'id':_0x37ec3a[_0x2bca('0x71')]['id']},'include':[{'model':db[_0x2bca('0x58')],'as':_0x2bca('0x65'),'include':[{'model':db[_0x2bca('0x5f')],'as':_0x2bca('0x5f')}]}]})[_0x2bca('0x21')](handleEntityNotFound(_0xb6b1ae,null))[_0x2bca('0x21')](saveUpdates(_0x37ec3a[_0x2bca('0x70')],null))[_0x2bca('0x21')](function(_0xc494c8){if(_0xc494c8){_0x291da6=_0xc494c8;return db[_0x2bca('0x62')][_0x2bca('0x6e')]({'where':{'id':_0x291da6[_0x2bca('0x8f')]}});}})[_0x2bca('0x21')](function(_0x4e3cc3){if(_0x4e3cc3){_0x40fa9d=_0x4e3cc3;return db[_0x2bca('0x5d')][_0x2bca('0x6e')]({'where':{'id':_0x291da6[_0x2bca('0x90')]}});}})[_0x2bca('0x21')](function(_0x433428){if(_0x433428){_0x48c293=_0x433428;if(_0x5c92b3){var _0x393296=null;for(var _0x49e759=0x1;_0x49e759<_0x291da6['Messages']['length'];++_0x49e759){_0x393296=_0x291da6[_0x2bca('0x65')][_0x49e759];var _0x3ecba3=_0x393296[_0x2bca('0x76')]?util[_0x2bca('0x8c')](_0x2bca('0x91'),_0x40fa9d[_0x2bca('0x92')],_0x393296[_0x2bca('0x76')]):'System';var _0x317d4e=_0x37ec3a[_0x2bca('0x70')][_0x2bca('0x93')]||util[_0x2bca('0x8c')]('%s%d','Visitor',_0x393296['ContactId']);switch(_0x40fa9d[_0x2bca('0x94')]){case'website_alias':_0x3ecba3=_0x393296[_0x2bca('0x76')]?util[_0x2bca('0x8c')](_0x2bca('0x91'),_0x40fa9d[_0x2bca('0x92')],_0x393296['UserId']):_0x2bca('0x95');break;case _0x2bca('0x96'):_0x3ecba3=_0x393296[_0x2bca('0x76')]?_0x393296[_0x2bca('0x5f')][_0x2bca('0x97')]||_0x393296[_0x2bca('0x5f')][_0x2bca('0x5c')]:_0x2bca('0x95');break;case _0x2bca('0x98'):_0x3ecba3=_0x393296['UserId']?_0x393296[_0x2bca('0x5f')][_0x2bca('0x5c')]:'System';break;default:_0x3ecba3=_0x393296[_0x2bca('0x76')]?util[_0x2bca('0x8c')](_0x2bca('0x91'),_0x40fa9d[_0x2bca('0x92')],_0x393296[_0x2bca('0x76')]):_0x2bca('0x95');}var _0x3e0ff9=util[_0x2bca('0x8c')]('[%s]\x20%s:\x20%s\x0a',moment(_0x393296[_0x2bca('0x59')])[_0x2bca('0x8c')](_0x2bca('0x99')),_0x393296[_0x2bca('0x66')]==='in'?_0x317d4e:_0x3ecba3,_0x393296['body']);if(!_0x393296[_0x2bca('0x9a')]){fs['appendFileSync'](_0x5c92b3,_0x3e0ff9);}}return db[_0x2bca('0x9b')][_0x2bca('0x83')]({'where':{'service':!![]},'include':[{'model':db[_0x2bca('0x9c')],'as':'Smtp','raw':!![]}]});}}})[_0x2bca('0x21')](function(_0x537a1b){if(_0x537a1b&&_0x537a1b['Smtp']&&_0x37ec3a[_0x2bca('0x70')]){var _0xfa9dfb={'tls':{'rejectUnauthorized':![]}};if(_0x537a1b['Smtp']['service']){_0xfa9dfb[_0x2bca('0x9d')]=_0x537a1b[_0x2bca('0x9e')][_0x2bca('0x9d')];}else{_0xfa9dfb[_0x2bca('0x9f')]=_0x537a1b[_0x2bca('0x9e')][_0x2bca('0x9f')];_0xfa9dfb['port']=_0x537a1b[_0x2bca('0x9e')][_0x2bca('0xa0')];_0xfa9dfb[_0x2bca('0xa1')]=_0x537a1b[_0x2bca('0x9e')][_0x2bca('0xa1')];}if(_0x537a1b[_0x2bca('0x9e')][_0x2bca('0xa2')]){_0xfa9dfb[_0x2bca('0xa3')]={'user':_0x537a1b[_0x2bca('0x9e')]['user'],'pass':_0x537a1b[_0x2bca('0x9e')]['pass']};}return respondWithRpcPromise('SendMail',_0x2bca('0xa4'),{'account':_0xfa9dfb,'message':{'from':util[_0x2bca('0x8c')](_0x2bca('0xa5'),_0x537a1b['name'],_0x537a1b[_0x2bca('0xa6')]||_0x537a1b[_0x2bca('0x9e')][_0x2bca('0xa7')]),'to':_0x37ec3a[_0x2bca('0x70')][_0x2bca('0x8a')],'subject':_0x2bca('0xa8'),'text':util[_0x2bca('0x8c')](_0x2bca('0xa9'),_0x37ec3a[_0x2bca('0x70')][_0x2bca('0x8a')]),'attachments':[{'path':_0x5c92b3}]}})['then'](function(){return _0x291da6;})[_0x2bca('0x6b')](function(_0x4eb48a){console['error'](_0x4eb48a);});}else{return _0x291da6;}})['then'](respondWithStatusCode(_0xb6b1ae,0xc8))['catch'](handleError(_0xb6b1ae,null));};exports[_0x2bca('0xaa')]=function(_0x13732b,_0x6ae44c,_0x351732){return db[_0x2bca('0x58')][_0x2bca('0x6e')]({'where':{'id':_0x13732b['params']['id']}})['then'](handleEntityNotFound(_0x6ae44c,null))[_0x2bca('0x21')](function(_0x4fcb8b){if(_0x4fcb8b){return _0x4fcb8b[_0x2bca('0xaa')](_0x13732b[_0x2bca('0x70')]['ids'],_['omit'](_0x13732b[_0x2bca('0x70')],[_0x2bca('0xab'),'id'])||{});}})[_0x2bca('0x21')](respondWithResult(_0x6ae44c,null))[_0x2bca('0x6b')](handleError(_0x6ae44c,null));};exports[_0x2bca('0xac')]=function(_0x53467a,_0x2e069f,_0x473411){var _0x36e247={'raw':![],'where':{}};var _0x2f7f4a={};var _0x9482={'count':0x0,'rows':[]};return db[_0x2bca('0x3c')][_0x2bca('0x83')]({'where':{'id':_0x53467a[_0x2bca('0x71')]['id']}})['then'](handleEntityNotFound(_0x2e069f,null))[_0x2bca('0x21')](function(_0x6d3452){if(_0x6d3452){_0x2f7f4a[_0x2bca('0x3e')]=_[_0x2bca('0x3f')](db[_0x2bca('0x58')][_0x2bca('0x3d')]);_0x2f7f4a[_0x2bca('0x41')]=_[_0x2bca('0x3f')](_0x53467a[_0x2bca('0x41')]);_0x2f7f4a[_0x2bca('0x43')]=_[_0x2bca('0x44')](_0x2f7f4a[_0x2bca('0x3e')],_0x2f7f4a['query']);_0x36e247[_0x2bca('0x45')]=_[_0x2bca('0x44')](_0x2f7f4a[_0x2bca('0x3e')],qs[_0x2bca('0x46')](_0x53467a[_0x2bca('0x41')][_0x2bca('0x46')]));_0x36e247[_0x2bca('0x45')]=_0x36e247[_0x2bca('0x45')][_0x2bca('0x47')]?_0x36e247[_0x2bca('0x45')]:_0x2f7f4a[_0x2bca('0x3e')];if(!_0x53467a[_0x2bca('0x41')][_0x2bca('0xad')]('nolimit')){_0x36e247[_0x2bca('0x31')]=qs['limit'](_0x53467a[_0x2bca('0x41')][_0x2bca('0x31')]);_0x36e247[_0x2bca('0x48')]=qs['offset'](_0x53467a[_0x2bca('0x41')][_0x2bca('0x48')]);}_0x36e247[_0x2bca('0x49')]=qs['sort'](_0x53467a[_0x2bca('0x41')][_0x2bca('0x4a')]);_0x36e247[_0x2bca('0x4b')]=qs[_0x2bca('0x43')](_['pick'](_0x53467a[_0x2bca('0x41')],_0x2f7f4a[_0x2bca('0x43')]));_0x36e247['where']['ChatInteractionId']=_0x6d3452['id'];if(_0x53467a[_0x2bca('0x41')][_0x2bca('0x4f')]){_0x36e247[_0x2bca('0x4b')]=_['merge'](_0x36e247[_0x2bca('0x4b')],{'$or':_['map'](_0x36e247[_0x2bca('0x45')],function(_0x3d548e){var _0x3854a6={};_0x3854a6[_0x3d548e]={'$like':'%'+_0x53467a[_0x2bca('0x41')][_0x2bca('0x4f')]+'%'};return _0x3854a6;})});}if(_0x53467a[_0x2bca('0x41')][_0x2bca('0xae')]){var _0x5af4e1=_0x53467a[_0x2bca('0x41')][_0x2bca('0xae')][_0x2bca('0xaf')](',');var _0x82e199={};_0x82e199[_0x5af4e1[0x0]]={'$gte':moment(_0x5af4e1[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x36e247[_0x2bca('0x4b')]=_[_0x2bca('0x51')](_0x36e247['where'],_0x82e199);}_0x36e247=_[_0x2bca('0x51')]({},_0x36e247,_0x53467a['options']);return db[_0x2bca('0x58')][_0x2bca('0x30')]({'where':_0x36e247[_0x2bca('0x4b')]})[_0x2bca('0x21')](function(_0x1539f8){_0x9482['count']=_0x1539f8;if(_0x53467a['query']['includeAll']){_0x36e247[_0x2bca('0x54')]=[{'all':!![]}];}return db[_0x2bca('0x58')]['findAll'](_0x36e247);})[_0x2bca('0x21')](function(_0x346d13){_0x9482['rows']=_0x346d13;return _0x9482;});}})[_0x2bca('0x21')](respondWithFilteredResult(_0x2e069f,_0x36e247))[_0x2bca('0x6b')](handleError(_0x2e069f,null));};exports[_0x2bca('0xb0')]=function(_0x30bddd,_0x1ce212,_0x155eac){var _0x5b71c2={'where':{}},_0x2a5937={},_0x21d8f1={'count':0x0,'rows':[]};return db[_0x2bca('0x3c')][_0x2bca('0x83')]({'where':{'id':_0x30bddd[_0x2bca('0x71')]['id']}})[_0x2bca('0x21')](handleEntityNotFound(_0x1ce212,null))['then'](function(_0x467072){if(_0x467072){_0x2a5937[_0x2bca('0x3e')]=_[_0x2bca('0x3f')](db[_0x2bca('0x58')][_0x2bca('0x3d')]);_0x2a5937[_0x2bca('0x41')]=_[_0x2bca('0x3f')](_0x30bddd['query']);_0x2a5937['filters']=_[_0x2bca('0x44')](_0x2a5937[_0x2bca('0x3e')],_0x2a5937['query']);_0x5b71c2[_0x2bca('0x45')]=_[_0x2bca('0x44')](_0x2a5937[_0x2bca('0x3e')],qs[_0x2bca('0x46')](_0x30bddd['query']['fields']));_0x5b71c2[_0x2bca('0x45')]=_0x5b71c2['attributes'][_0x2bca('0x47')]?_0x5b71c2[_0x2bca('0x45')]:_0x2a5937['model'];if(!_0x30bddd['query'][_0x2bca('0xad')]('nolimit')){_0x5b71c2[_0x2bca('0x31')]=qs[_0x2bca('0x31')](_0x30bddd[_0x2bca('0x41')][_0x2bca('0x31')]);_0x5b71c2[_0x2bca('0x48')]=qs['offset'](_0x30bddd[_0x2bca('0x41')][_0x2bca('0x48')]);}_0x5b71c2[_0x2bca('0x49')]=qs[_0x2bca('0x4a')](_0x30bddd[_0x2bca('0x41')][_0x2bca('0x4a')]);_0x5b71c2['where']=qs['filters'](_['pick'](_0x30bddd[_0x2bca('0x41')],_0x2a5937[_0x2bca('0x43')]));_0x5b71c2[_0x2bca('0x4b')]['ChatInteractionId']=_0x467072['id'];if(_0x30bddd[_0x2bca('0x41')][_0x2bca('0x4f')]){_0x5b71c2['where']=_[_0x2bca('0x51')](_0x5b71c2[_0x2bca('0x4b')],{'$or':_[_0x2bca('0x50')](_0x5b71c2[_0x2bca('0x45')],function(_0x376e76){var _0x284eef={};_0x284eef[_0x376e76]={'$like':'%'+_0x30bddd[_0x2bca('0x41')]['filter']+'%'};return _0x284eef;})});}_0x5b71c2[_0x2bca('0x4b')][_0x2bca('0x9a')]=![];if(_0x30bddd[_0x2bca('0x41')]['id']){_0x5b71c2[_0x2bca('0x4b')]['id']={'$gt':_0x30bddd[_0x2bca('0x41')]['id']};}_0x5b71c2=_[_0x2bca('0x51')]({},_0x5b71c2,_0x30bddd[_0x2bca('0x52')]);return db['ChatMessage']['count']({'where':_0x5b71c2[_0x2bca('0x4b')]})['then'](function(_0x211931){_0x21d8f1['count']=_0x211931;_0x5b71c2[_0x2bca('0x54')]=[];if(_0x30bddd[_0x2bca('0x41')]['includeAgent']){_0x5b71c2[_0x2bca('0x54')][_0x2bca('0x55')]({'model':db['User'],'as':_0x2bca('0x5f'),'attributes':['id',_0x2bca('0x5c'),_0x2bca('0x97')]});}if(_0x30bddd[_0x2bca('0x41')][_0x2bca('0x6d')]){_0x5b71c2['include']=[{'all':!![]}];}return db[_0x2bca('0x58')][_0x2bca('0x69')](_0x5b71c2);})[_0x2bca('0x21')](function(_0x1c22e8){_0x21d8f1[_0x2bca('0x6a')]=_0x1c22e8;return _0x21d8f1;});}})['then'](respondWithFilteredResult(_0x1ce212,_0x5b71c2))['catch'](handleError(_0x1ce212,null));};exports[_0x2bca('0xb1')]=function(_0x2cfd61,_0x14513f,_0x29c2a5){return db[_0x2bca('0x3c')]['find']({'where':{'id':_0x2cfd61[_0x2bca('0x71')]['id']}})['then'](handleEntityNotFound(_0x14513f,null))[_0x2bca('0x21')](function(_0x29b5df){if(_0x29b5df){return _0x29b5df[_0x2bca('0xb2')](_0x2cfd61[_0x2bca('0x70')]['ids'],_[_0x2bca('0xb3')](_0x2cfd61[_0x2bca('0x70')],[_0x2bca('0xab'),'id'])||{})[_0x2bca('0xb4')](function(){return db[_0x2bca('0x67')][_0x2bca('0x69')]({'attributes':['id',_0x2bca('0x39'),'color'],'where':{'id':_0x2cfd61[_0x2bca('0x70')]['ids']}});})[_0x2bca('0x21')](function(_0x580c97){socket['emit'](_0x2bca('0xb5'),{'id':Number(_0x2cfd61[_0x2bca('0x71')]['id']),'tags':_0x580c97||[]});return{'id':Number(_0x2cfd61[_0x2bca('0x71')]['id']),'tags':_0x580c97||[]};});}})[_0x2bca('0x21')](respondWithResult(_0x14513f,null))[_0x2bca('0x6b')](handleError(_0x14513f,null));};exports[_0x2bca('0xb6')]=function(_0x534969,_0x510e40,_0x330d46){var _0x1f7914;return db[_0x2bca('0x3c')][_0x2bca('0x6e')]({'where':{'id':_0x534969[_0x2bca('0x71')]['id']}})['then'](handleEntityNotFound(_0x510e40,null))[_0x2bca('0x21')](function(_0x54dafa){if(_0x54dafa){return _0x54dafa[_0x2bca('0xb6')](_0x534969[_0x2bca('0x41')][_0x2bca('0xab')]);}})[_0x2bca('0x21')](respondWithStatusCode(_0x510e40,null))[_0x2bca('0x6b')](handleError(_0x510e40,null));};exports[_0x2bca('0x85')]=function(_0x2f9935,_0x541d0d){var _0x4875a9=moment()['unix']()[_0x2bca('0xb7')]();var _0x247b3b=path['join'](config['root'],_0x2bca('0xb8'),_0x2bca('0xb9'),_0x2bca('0xba'));var _0x4f2015=path[_0x2bca('0x86')](config[_0x2bca('0x87')],_0x2bca('0xb8'),_0x2bca('0xb9'),'attachments');var _0xf23782=path['join'](_0x247b3b,_0x4875a9);var _0x112192=util['format'](_0x2bca('0xbb'),_0x4875a9);var _0x297206=path[_0x2bca('0x86')](_0x247b3b,_0x112192);var _0x373958=![];return db[_0x2bca('0x3c')][_0x2bca('0x6e')]({'where':{'id':_0x2f9935['params']['id']},'include':[{'model':db[_0x2bca('0x58')],'as':'Messages','attributes':['id',_0x2bca('0x70')],'include':[{'model':db[_0x2bca('0x5f')],'as':_0x2bca('0x5f'),'attributes':['id','fullname'],'raw':!![]},{'model':db[_0x2bca('0x5d')],'as':_0x2bca('0x5e'),'attributes':['id',_0x2bca('0xbc')],'raw':!![]},{'model':db[_0x2bca('0x81')],'as':_0x2bca('0x81'),'raw':!![]}]}]})[_0x2bca('0x21')](handleEntityNotFound(_0x541d0d,null))[_0x2bca('0x21')](function(_0x4aad5f){if(_0x4aad5f){_0x373958=!![];var _0x106d01='';var _0x7aa548={'format':'Letter','border':_0x2bca('0xbd')};fs[_0x2bca('0xbe')](_0xf23782);_0x106d01+=util[_0x2bca('0x8c')](_0x2bca('0xbf'),_0x4aad5f['id']);_0x106d01+=util[_0x2bca('0x8c')](_0x2bca('0xc0'),moment()['format']('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')[_0x2bca('0xb7')]());_0x106d01+=_0x2bca('0xc1');for(var _0x4b7a6f=0x1;_0x4b7a6f<_0x4aad5f[_0x2bca('0x65')][_0x2bca('0x47')];_0x4b7a6f++){var _0x117c67=_0x4aad5f[_0x2bca('0x65')][_0x4b7a6f];_0x106d01+=_0x2bca('0xc2');_0x106d01+=util['format'](_0x2bca('0xc3'),_0x117c67[_0x2bca('0x5f')]?_0x117c67[_0x2bca('0x5f')][_0x2bca('0x5c')]:_0x117c67[_0x2bca('0x5e')]['firstName'],_0x117c67[_0x2bca('0x70')]);_0x106d01+=_0x2bca('0xc4');if(_0x117c67['Attachment']){var _0x7a74d6=_0x117c67['Attachment'];var _0x2e8d02=path[_0x2bca('0x86')](_0x4f2015,_0x7a74d6['basename']);if(fs[_0x2bca('0xc5')](_0x2e8d02)){fs['createReadStream'](_0x2e8d02)[_0x2bca('0xc6')](fs[_0x2bca('0xc7')](path[_0x2bca('0x86')](_0xf23782,_0x7a74d6['basename'])));}}}return new BPromise(function(_0x222a81,_0x28c48f){pdf[_0x2bca('0x6f')](_0x106d01,_0x7aa548)['toFile'](path[_0x2bca('0x86')](_0xf23782,'interaction-'+_0x4875a9+_0x2bca('0xc8')),function(_0x2d472d,_0x40bbd0){if(_0x2d472d)return _0x28c48f(_0x2d472d);_0x222a81(_0x40bbd0);});});}})[_0x2bca('0x21')](function(){if(_0x373958){return new BPromise(function(_0x4c388f,_0x374881){zipdir(_0xf23782,{'saveTo':_0x297206},function(_0x5997e2,_0x356998){if(_0x5997e2)return _0x374881(_0x5997e2);return _0x4c388f(_0x356998);});});}})[_0x2bca('0x21')](function(){if(_0x373958){return new BPromise(function(_0x44099b,_0xbe1208){rimraf(_0xf23782,function(_0x4a1de5){if(_0x4a1de5)_0xbe1208(_0x4a1de5);return _0x44099b();});});}})['then'](function(){if(_0x373958){return _0x541d0d['download'](_0x297206,_0x112192,function(_0x3053bf){if(_0x3053bf){console[_0x2bca('0xc9')](_0x2bca('0xca'),_0x3053bf);}else{fs[_0x2bca('0xcb')](_0x297206);}});}else{return _0x541d0d[_0x2bca('0x2c')](0xc8);}})[_0x2bca('0x6b')](handleError(_0x541d0d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5efe93d..5be6426 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 _0x6cf5=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','save'];(function(_0x3d9866,_0x226ff8){var _0x1d6f97=function(_0xe9695f){while(--_0xe9695f){_0x3d9866['push'](_0x3d9866['shift']());}};_0x1d6f97(++_0x226ff8);}(_0x6cf5,0x147));var _0x56cf=function(_0x4bde04,_0x4aac94){_0x4bde04=_0x4bde04-0x0;var _0x371ee4=_0x6cf5[_0x4bde04];return _0x371ee4;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x56cf('0x0'))['db']['ChatInteraction'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x56cf('0x1'),'afterUpdate':_0x56cf('0x2'),'afterDestroy':_0x56cf('0x3')};function emitEvent(_0x25179c){return function(_0x4f7493,_0x276839,_0x562712){ChatInteractionEvents[_0x56cf('0x4')](_0x25179c+':'+_0x4f7493['id'],_0x4f7493);ChatInteractionEvents[_0x56cf('0x4')](_0x25179c,_0x4f7493);_0x562712(null);};}for(var e in events){if(events[_0x56cf('0x5')](e)){var event=events[e];ChatInteraction[_0x56cf('0x6')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x3d63=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x426ddd,_0x373efe){var _0x11a489=function(_0x30683){while(--_0x30683){_0x426ddd['push'](_0x426ddd['shift']());}};_0x11a489(++_0x373efe);}(_0x3d63,0xae));var _0x33d6=function(_0x250250,_0x19ae54){_0x250250=_0x250250-0x0;var _0x2812f2=_0x3d63[_0x250250];return _0x2812f2;};'use strict';var EventEmitter=require(_0x33d6('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x33d6('0x1')](0x0);var events={'afterCreate':_0x33d6('0x2'),'afterUpdate':_0x33d6('0x3'),'afterDestroy':_0x33d6('0x4')};function emitEvent(_0x2a7ca3){return function(_0x4e0f18,_0x50786e,_0x4fe455){ChatInteractionEvents[_0x33d6('0x5')](_0x2a7ca3+':'+_0x4e0f18['id'],_0x4e0f18);ChatInteractionEvents[_0x33d6('0x5')](_0x2a7ca3,_0x4e0f18);_0x4fe455(null);};}for(var e in events){if(events[_0x33d6('0x6')](e)){var event=events[e];ChatInteraction[_0x33d6('0x7')](e,emitEvent(event));}}module[_0x33d6('0x8')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 24cbfa4..50d543e 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 _0xc30a=['chat_interactions','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','./chatInteraction.attributes','exports','ChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc30a,0x116));var _0xac30=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc30a[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xac30('0x0'));var util=require(_0xac30('0x1'));var logger=require(_0xac30('0x2'))(_0xac30('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac30('0x4'));var attributes=require(_0xac30('0x5'));module[_0xac30('0x6')]=function(_0x1913c3,_0x4c3778){return _0x1913c3['define'](_0xac30('0x7'),attributes,{'tableName':_0xac30('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xac30('0x9'),'collate':_0xac30('0xa')});}; \ No newline at end of file +var _0xc9b4=['exports','define','ChatInteraction','chat_interactions','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','./chatInteraction.attributes'];(function(_0x5785c3,_0x366c7d){var _0x421186=function(_0x278fef){while(--_0x278fef){_0x5785c3['push'](_0x5785c3['shift']());}};_0x421186(++_0x366c7d);}(_0xc9b4,0x10d));var _0x4c9b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc9b4[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4c9b('0x0'));var util=require(_0x4c9b('0x1'));var logger=require('../../config/logger')(_0x4c9b('0x2'));var moment=require(_0x4c9b('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c9b('0x4'));var attributes=require(_0x4c9b('0x5'));module[_0x4c9b('0x6')]=function(_0x22da07,_0x42e523){return _0x22da07[_0x4c9b('0x7')](_0x4c9b('0x8'),attributes,{'tableName':_0x4c9b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4c9b('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 40363ab..ca0de35 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 _0xacbf=['addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','redis','defaults','socket.io-emitter','./chatInteraction.socket','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','update','body','raw','options','where','limit','then','UpdateChatInteraction','AddTagsToChatInteraction','find'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xacbf,0x1d9));var _0xfacb=function(_0x56fb02,_0x179d7a){_0x56fb02=_0x56fb02-0x0;var _0x177f5b=_0xacbf[_0x56fb02];return _0x177f5b;};'use strict';var _=require(_0xfacb('0x0'));var util=require('util');var moment=require(_0xfacb('0x1'));var BPromise=require(_0xfacb('0x2'));var rs=require(_0xfacb('0x3'));var fs=require('fs');var Redis=require(_0xfacb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfacb('0x5'));var logger=require('../../config/logger')(_0xfacb('0x6'));var config=require(_0xfacb('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xfacb('0x8')]=_[_0xfacb('0x9')](config[_0xfacb('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xfacb('0xa'))(new Redis(config[_0xfacb('0x8')]));require(_0xfacb('0xb'))['register'](socket);function respondWithRpcPromise(_0x5759fc,_0xffd336,_0x320b2e){return new BPromise(function(_0x4356a1,_0x43e89a){return client['request'](_0x5759fc,_0x320b2e)['then'](function(_0x3c404f){logger[_0xfacb('0xc')](_0xfacb('0xd'),_0xffd336,_0xfacb('0xe'));logger[_0xfacb('0xf')](_0xfacb('0x10'),_0xffd336,_0xfacb('0xe'),JSON[_0xfacb('0x11')](_0x3c404f));if(_0x3c404f[_0xfacb('0x12')]){if(_0x3c404f[_0xfacb('0x12')][_0xfacb('0x13')]===0x1f4){logger[_0xfacb('0x12')](_0xfacb('0xd'),_0xffd336,_0x3c404f[_0xfacb('0x12')][_0xfacb('0x14')]);return _0x43e89a(_0x3c404f['error'][_0xfacb('0x14')]);}logger['error'](_0xfacb('0xd'),_0xffd336,_0x3c404f['error'][_0xfacb('0x14')]);return _0x4356a1(_0x3c404f['error']['message']);}else{logger[_0xfacb('0xc')]('ChatInteraction,\x20%s,\x20%s',_0xffd336,_0xfacb('0xe'));_0x4356a1(_0x3c404f[_0xfacb('0x15')]['message']);}})[_0xfacb('0x16')](function(_0x36ffaf){logger[_0xfacb('0x12')](_0xfacb('0xd'),_0xffd336,_0x36ffaf);_0x43e89a(_0x36ffaf);});});}exports['UpdateChatInteraction']=function(_0x6c57a1){var _0x3f5fab=this;return new Promise(function(_0x3b0df7,_0x5703d2){return db[_0xfacb('0x17')][_0xfacb('0x18')](_0x6c57a1[_0xfacb('0x19')],{'raw':_0x6c57a1['options']?_0x6c57a1['options'][_0xfacb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6c57a1[_0xfacb('0x1b')]?_0x6c57a1['options'][_0xfacb('0x1c')]||null:null,'attributes':_0x6c57a1[_0xfacb('0x1b')]?_0x6c57a1[_0xfacb('0x1b')]['attributes']||null:null,'limit':_0x6c57a1[_0xfacb('0x1b')]?_0x6c57a1[_0xfacb('0x1b')][_0xfacb('0x1d')]||null:null})[_0xfacb('0x1e')](function(_0x4057cd){logger[_0xfacb('0xc')]('UpdateChatInteraction',_0x6c57a1);logger[_0xfacb('0xf')](_0xfacb('0x1f'),_0x6c57a1,JSON['stringify'](_0x4057cd));_0x3b0df7(_0x4057cd);})[_0xfacb('0x16')](function(_0xe1e966){logger[_0xfacb('0x12')](_0xfacb('0x1f'),_0xe1e966['message'],_0x6c57a1);_0x5703d2(_0x3f5fab[_0xfacb('0x12')](0x1f4,_0xe1e966[_0xfacb('0x14')]));});});};exports[_0xfacb('0x20')]=function(_0xd6afe1){return new Promise(function(_0x3c8484,_0x1d8a30){return db[_0xfacb('0x17')][_0xfacb('0x21')]({'where':_0xd6afe1[_0xfacb('0x1b')]?_0xd6afe1[_0xfacb('0x1b')][_0xfacb('0x1c')]||null:null})[_0xfacb('0x1e')](function(_0x3e6915){if(_0x3e6915){return _0x3e6915[_0xfacb('0x22')](_0xd6afe1[_0xfacb('0x19')][_0xfacb('0x23')],_[_0xfacb('0x24')](_0xd6afe1[_0xfacb('0x19')],[_0xfacb('0x23'),'id'])||{});}})[_0xfacb('0x25')](function(_0x4edfd8){logger[_0xfacb('0xc')](_0xfacb('0x26'),_0xd6afe1);logger['debug'](_0xfacb('0x26'),_0xd6afe1,JSON[_0xfacb('0x11')](_0x4edfd8));_0x3c8484(_0x4edfd8);})['catch'](function(_0x563ca2){logger['error']('AddTags',_0x563ca2[_0xfacb('0x14')],_0xd6afe1);_0x1d8a30(_this[_0xfacb('0x12')](0x1f4,_0x563ca2[_0xfacb('0x14')]));});});}; \ No newline at end of file +var _0xc228=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','limit','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','spread','info','AddTags','util','moment','bluebird','randomstring'];(function(_0x2089d9,_0x4f7364){var _0x289e92=function(_0x1a3d52){while(--_0x1a3d52){_0x2089d9['push'](_0x2089d9['shift']());}};_0x289e92(++_0x4f7364);}(_0xc228,0xc9));var _0x8c22=function(_0x2ab54b,_0x38d11e){_0x2ab54b=_0x2ab54b-0x0;var _0x43db33=_0xc228[_0x2ab54b];return _0x43db33;};'use strict';var _=require('lodash');var util=require(_0x8c22('0x0'));var moment=require(_0x8c22('0x1'));var BPromise=require(_0x8c22('0x2'));var rs=require(_0x8c22('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c22('0x4'))['db'];var utils=require(_0x8c22('0x5'));var logger=require(_0x8c22('0x6'))('rpc');var config=require(_0x8c22('0x7'));var jayson=require(_0x8c22('0x8'));var client=jayson[_0x8c22('0x9')]['http']({'port':0x232a});config['redis']=_[_0x8c22('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8c22('0xb')]));require(_0x8c22('0xc'))[_0x8c22('0xd')](socket);function respondWithRpcPromise(_0x238266,_0x3f2e46,_0x47950c){return new BPromise(function(_0x51bba1,_0x32df19){return client[_0x8c22('0xe')](_0x238266,_0x47950c)[_0x8c22('0xf')](function(_0x28bb97){logger['info'](_0x8c22('0x10'),_0x3f2e46,_0x8c22('0x11'));logger[_0x8c22('0x12')](_0x8c22('0x13'),_0x3f2e46,_0x8c22('0x11'),JSON['stringify'](_0x28bb97));if(_0x28bb97[_0x8c22('0x14')]){if(_0x28bb97[_0x8c22('0x14')][_0x8c22('0x15')]===0x1f4){logger[_0x8c22('0x14')](_0x8c22('0x10'),_0x3f2e46,_0x28bb97[_0x8c22('0x14')]['message']);return _0x32df19(_0x28bb97['error'][_0x8c22('0x16')]);}logger[_0x8c22('0x14')](_0x8c22('0x10'),_0x3f2e46,_0x28bb97[_0x8c22('0x14')][_0x8c22('0x16')]);return _0x51bba1(_0x28bb97[_0x8c22('0x14')][_0x8c22('0x16')]);}else{logger['info'](_0x8c22('0x10'),_0x3f2e46,_0x8c22('0x11'));_0x51bba1(_0x28bb97[_0x8c22('0x17')][_0x8c22('0x16')]);}})[_0x8c22('0x18')](function(_0x7aa17a){logger[_0x8c22('0x14')](_0x8c22('0x10'),_0x3f2e46,_0x7aa17a);_0x32df19(_0x7aa17a);});});}exports[_0x8c22('0x19')]=function(_0x19b663){var _0x164d4f=this;return new Promise(function(_0x2defee,_0x2c49f6){return db[_0x8c22('0x1a')][_0x8c22('0x1b')](_0x19b663[_0x8c22('0x1c')],{'raw':_0x19b663[_0x8c22('0x1d')]?_0x19b663[_0x8c22('0x1d')][_0x8c22('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19b663[_0x8c22('0x1d')]?_0x19b663[_0x8c22('0x1d')]['where']||null:null,'attributes':_0x19b663['options']?_0x19b663['options']['attributes']||null:null,'limit':_0x19b663[_0x8c22('0x1d')]?_0x19b663[_0x8c22('0x1d')][_0x8c22('0x1f')]||null:null})[_0x8c22('0xf')](function(_0x177a72){logger['info'](_0x8c22('0x19'),_0x19b663);logger[_0x8c22('0x12')](_0x8c22('0x19'),_0x19b663,JSON[_0x8c22('0x20')](_0x177a72));_0x2defee(_0x177a72);})[_0x8c22('0x18')](function(_0x4001ed){logger[_0x8c22('0x14')](_0x8c22('0x19'),_0x4001ed[_0x8c22('0x16')],_0x19b663);_0x2c49f6(_0x164d4f[_0x8c22('0x14')](0x1f4,_0x4001ed[_0x8c22('0x16')]));});});};exports[_0x8c22('0x21')]=function(_0x470a77){return new Promise(function(_0x30ec6c,_0x20d857){return db[_0x8c22('0x1a')][_0x8c22('0x22')]({'where':_0x470a77[_0x8c22('0x1d')]?_0x470a77[_0x8c22('0x1d')]['where']||null:null})[_0x8c22('0xf')](function(_0x15fd7a){if(_0x15fd7a){return _0x15fd7a[_0x8c22('0x23')](_0x470a77['body'][_0x8c22('0x24')],_[_0x8c22('0x25')](_0x470a77[_0x8c22('0x1c')],[_0x8c22('0x24'),'id'])||{});}})[_0x8c22('0x26')](function(_0x44d6e0){logger[_0x8c22('0x27')](_0x8c22('0x28'),_0x470a77);logger[_0x8c22('0x12')](_0x8c22('0x28'),_0x470a77,JSON[_0x8c22('0x20')](_0x44d6e0));_0x30ec6c(_0x44d6e0);})[_0x8c22('0x18')](function(_0x77bd4e){logger[_0x8c22('0x14')](_0x8c22('0x28'),_0x77bd4e['message'],_0x470a77);_0x20d857(_this[_0x8c22('0x14')](0x1f4,_0x77bd4e[_0x8c22('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d6893bb..c6db394 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 _0x0605=['length','chatInteraction:','./chatInteraction.events','save','remove','update','removeListener','register'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x0605,0x1da));var _0x5060=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x0605[_0x37c22c];return _0x119d79;};'use strict';var ChatInteractionEvents=require(_0x5060('0x0'));var events=[_0x5060('0x1'),_0x5060('0x2'),_0x5060('0x3')];function createListener(_0x3a051e,_0x3cdb2a){return function(_0x178701){_0x3cdb2a['emit'](_0x3a051e,_0x178701);};}function removeListener(_0xed71fa,_0x457eca){return function(){ChatInteractionEvents[_0x5060('0x4')](_0xed71fa,_0x457eca);};}exports[_0x5060('0x5')]=function(_0x64ecf0){for(var _0x2ba5a6=0x0,_0x4f4bd0=events[_0x5060('0x6')];_0x2ba5a6<_0x4f4bd0;_0x2ba5a6++){var _0x3a1807=events[_0x2ba5a6];var _0x1dca2d=createListener(_0x5060('0x7')+_0x3a1807,_0x64ecf0);ChatInteractionEvents['on'](_0x3a1807,_0x1dca2d);}}; \ No newline at end of file +var _0x415b=['remove','update','removeListener','length','chatInteraction:','./chatInteraction.events'];(function(_0x3f05d2,_0x290ee1){var _0x39cf55=function(_0x2caac0){while(--_0x2caac0){_0x3f05d2['push'](_0x3f05d2['shift']());}};_0x39cf55(++_0x290ee1);}(_0x415b,0xfb));var _0xb415=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x415b[_0x178e48];return _0x440d7e;};'use strict';var ChatInteractionEvents=require(_0xb415('0x0'));var events=['save',_0xb415('0x1'),_0xb415('0x2')];function createListener(_0x6ecf8,_0x2d9147){return function(_0x45a02c){_0x2d9147['emit'](_0x6ecf8,_0x45a02c);};}function removeListener(_0x15012b,_0x2b2316){return function(){ChatInteractionEvents[_0xb415('0x3')](_0x15012b,_0x2b2316);};}exports['register']=function(_0x2a13d8){for(var _0x38f933=0x0,_0x4cb6a7=events[_0xb415('0x4')];_0x38f933<_0x4cb6a7;_0x38f933++){var _0x1ce28e=events[_0x38f933];var _0x298dd2=createListener(_0xb415('0x5')+_0x1ce28e,_0x2a13d8);ChatInteractionEvents['on'](_0x1ce28e,_0x298dd2);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 40bb2b7..d700c79 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 _0xa571=['file','attachmentUpload','/:id/tags','addTags','put','tracked','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','join','server/files/attachments/','format','%s-%s','originalname','replace','single'];(function(_0x3fe437,_0x225eab){var _0x5ef435=function(_0x164f97){while(--_0x164f97){_0x3fe437['push'](_0x3fe437['shift']());}};_0x5ef435(++_0x225eab);}(_0xa571,0x107));var _0x1a57=function(_0xe035d9,_0x503074){_0xe035d9=_0xe035d9-0x0;var _0x3214d6=_0xa571[_0xe035d9];return _0x3214d6;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var auth=require(_0x1a57('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a57('0x6'));router['get']('/',auth[_0x1a57('0x7')](),controller[_0x1a57('0x8')]);router[_0x1a57('0x9')](_0x1a57('0xa'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xb')]);router['get'](_0x1a57('0xc'),auth[_0x1a57('0xd')](),controller[_0x1a57('0xe')]);router['get'](_0x1a57('0xf'),auth[_0x1a57('0xd')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x9')](_0x1a57('0x11'),auth[_0x1a57('0x7')](),controller[_0x1a57('0x12')]);router[_0x1a57('0x9')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0x1a57('0x13')]);router[_0x1a57('0x9')](_0x1a57('0x14'),auth['isAuthenticated'](),controller[_0x1a57('0x15')]);router[_0x1a57('0x16')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd08107,_0x17434c,_0x27e824){_0x27e824(null,path[_0x1a57('0x18')](config['root'],_0x1a57('0x19')));},'filename':function(_0x53c61f,_0x49ee05,_0x1b58d7){_0x1b58d7(null,util[_0x1a57('0x1a')](_0x1a57('0x1b'),Date['now'](),_0x49ee05[_0x1a57('0x1c')][_0x1a57('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1a57('0x16')]('/:id/attachment_upload',upload[_0x1a57('0x1e')](_0x1a57('0x1f')),controller[_0x1a57('0x20')]);router[_0x1a57('0x16')](_0x1a57('0x11'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x1a57('0x16')](_0x1a57('0x21'),auth[_0x1a57('0x7')](),interaction['tracked']('chat','chatinteraction:addtags'),controller[_0x1a57('0x22')]);router[_0x1a57('0x23')](_0x1a57('0xc'),auth[_0x1a57('0x7')](),interaction[_0x1a57('0x24')](_0x1a57('0x25'),_0x1a57('0x26')),controller[_0x1a57('0x27')]);router[_0x1a57('0x23')](_0x1a57('0x28'),controller[_0x1a57('0x29')]);router[_0x1a57('0x23')](_0x1a57('0x2a'),auth[_0x1a57('0xd')](),controller[_0x1a57('0x2b')]);router[_0x1a57('0x23')](_0x1a57('0x2c'),controller[_0x1a57('0x2d')]);router[_0x1a57('0x2e')](_0x1a57('0xc'),auth[_0x1a57('0x7')](),interaction[_0x1a57('0x24')]('chat','chatinteraction:destroy'),controller[_0x1a57('0x2f')]);router[_0x1a57('0x2e')]('/:id/tags',auth[_0x1a57('0x7')](),controller['removeTags']);module[_0x1a57('0x30')]=router; \ No newline at end of file +var _0x0abf=['/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','/:id/close','delete','destroy','removeTags','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized'];(function(_0x41b195,_0x5b610e){var _0x94740f=function(_0x870200){while(--_0x870200){_0x41b195['push'](_0x41b195['shift']());}};_0x94740f(++_0x5b610e);}(_0x0abf,0xe8));var _0xf0ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0abf[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf0ab('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf0ab('0x4'));var controller=require(_0xf0ab('0x5'));router[_0xf0ab('0x6')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0x8')]);router[_0xf0ab('0x6')](_0xf0ab('0x9'),auth['isAuthenticated'](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x6')](_0xf0ab('0xb'),auth[_0xf0ab('0xc')](),controller['show']);router[_0xf0ab('0x6')](_0xf0ab('0xd'),auth[_0xf0ab('0xc')](),controller['attachmentDownload']);router['get'](_0xf0ab('0xe'),auth['isAuthenticated'](),controller[_0xf0ab('0xf')]);router[_0xf0ab('0x6')](_0xf0ab('0x10'),auth[_0xf0ab('0xc')](),controller[_0xf0ab('0x11')]);router[_0xf0ab('0x6')](_0xf0ab('0x12'),auth['isAuthenticated'](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0x15')]);var upload=multer({'storage':multer[_0xf0ab('0x16')]({'destination':function(_0x36cabe,_0x3d7129,_0x1fb4e5){_0x1fb4e5(null,path[_0xf0ab('0x17')](config[_0xf0ab('0x18')],_0xf0ab('0x19')));},'filename':function(_0x221bac,_0x200cf5,_0x2f4618){_0x2f4618(null,util[_0xf0ab('0x1a')]('%s-%s',Date[_0xf0ab('0x1b')](),_0x200cf5[_0xf0ab('0x1c')][_0xf0ab('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf0ab('0x14')](_0xf0ab('0x1e'),upload[_0xf0ab('0x1f')](_0xf0ab('0x20')),controller[_0xf0ab('0x21')]);router[_0xf0ab('0x14')](_0xf0ab('0xe'),auth[_0xf0ab('0xc')](),controller[_0xf0ab('0x22')]);router[_0xf0ab('0x14')](_0xf0ab('0x23'),auth[_0xf0ab('0x7')](),interaction[_0xf0ab('0x24')]('chat',_0xf0ab('0x25')),controller[_0xf0ab('0x26')]);router[_0xf0ab('0x27')](_0xf0ab('0xb'),auth[_0xf0ab('0x7')](),interaction[_0xf0ab('0x24')](_0xf0ab('0x28'),_0xf0ab('0x29')),controller[_0xf0ab('0x2a')]);router[_0xf0ab('0x27')](_0xf0ab('0x2b'),controller['customUpdate']);router['put']('/:id/abandon',auth[_0xf0ab('0xc')](),controller['abandon']);router[_0xf0ab('0x27')](_0xf0ab('0x2c'),controller['close']);router[_0xf0ab('0x2d')](_0xf0ab('0xb'),auth[_0xf0ab('0x7')](),interaction[_0xf0ab('0x24')](_0xf0ab('0x28'),'chatinteraction:destroy'),controller[_0xf0ab('0x2e')]);router['delete']('/:id/tags',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0x2f')]);module[_0xf0ab('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 2c3706f..8ab2d18 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 _0x6d11=['exports','TEXT','BOOLEAN','sequelize'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x6d11,0xbf));var _0x16d1=function(_0x34d81e,_0x1b5309){_0x34d81e=_0x34d81e-0x0;var _0x1f5181=_0x6d11[_0x34d81e];return _0x1f5181;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'body':{'type':Sequelize[_0x16d1('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x16d1('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6455=['INTEGER','sequelize','TEXT','medium','BOOLEAN'];(function(_0x337da3,_0x9422f0){var _0x3d45f0=function(_0x5e1368){while(--_0x5e1368){_0x337da3['push'](_0x337da3['shift']());}};_0x3d45f0(++_0x9422f0);}(_0x6455,0x97));var _0x5645=function(_0x4968f5,_0x2074e6){_0x4968f5=_0x4968f5-0x0;var _0x4fd247=_0x6455[_0x4968f5];return _0x4fd247;};'use strict';var Sequelize=require(_0x5645('0x0'));module['exports']={'body':{'type':Sequelize[_0x5645('0x1')](_0x5645('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5645('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5645('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 6735a71..1d35c90 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 _0xba71=['type','get','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','limit','set','apply','reject','save','update','then','end','stack','name','send','index','ChatInternalMessage','rawAttributes','model','query','dateEnd','dateStart','keys','intersection','fields','attributes','length','offset','sort','where','filters','pick','day','merge','filter','map','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba71,0x75));var _0x1ba7=function(_0x4ec6db,_0x393d10){_0x4ec6db=_0x4ec6db-0x0;var _0x5b46fc=_0xba71[_0x4ec6db];return _0x5b46fc;};'use strict';var pdf=require(_0x1ba7('0x0'));var emlformat=require(_0x1ba7('0x1'));var rimraf=require(_0x1ba7('0x2'));var zipdir=require(_0x1ba7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ba7('0x4'));var moment=require(_0x1ba7('0x5'));var BPromise=require(_0x1ba7('0x6'));var Mustache=require(_0x1ba7('0x7'));var util=require(_0x1ba7('0x8'));var path=require(_0x1ba7('0x9'));var sox=require(_0x1ba7('0xa'));var csv=require(_0x1ba7('0xb'));var ejs=require(_0x1ba7('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ba7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1ba7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ba7('0xf'));var Papa=require(_0x1ba7('0x10'));var Redis=require(_0x1ba7('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x1ba7('0x12'))(_0x1ba7('0x13'));var utils=require('../../config/utils');var config=require(_0x1ba7('0x14'));var db=require(_0x1ba7('0x15'))['db'];config[_0x1ba7('0x16')]=_[_0x1ba7('0x17')](config[_0x1ba7('0x16')],{'host':_0x1ba7('0x18'),'port':0x18eb});var socket=require(_0x1ba7('0x19'))(new Redis(config[_0x1ba7('0x16')]));require(_0x1ba7('0x1a'))[_0x1ba7('0x1b')](socket);function respondWithStatusCode(_0x469139,_0x4b2ae7){_0x4b2ae7=_0x4b2ae7||0xcc;return function(_0x2bc40f){if(_0x2bc40f){return _0x469139[_0x1ba7('0x1c')](_0x4b2ae7);}return _0x469139[_0x1ba7('0x1d')](_0x4b2ae7)['end']();};}function respondWithResult(_0x50630d,_0x128ee0){_0x128ee0=_0x128ee0||0xc8;return function(_0x3cd6f0){if(_0x3cd6f0){return _0x50630d['status'](_0x128ee0)[_0x1ba7('0x1e')](_0x3cd6f0);}};}function respondWithFilteredResult(_0x2cd55a,_0x1624f4){return function(_0x8b84c){if(_0x8b84c){var _0x964732=_0x8b84c['count'],_0x4f2552=_0x1624f4['offset'],_0x4f4f95=_0x1624f4['offset']+_0x1624f4[_0x1ba7('0x1f')],_0x2589b8;if(_0x4f4f95>=_0x964732){_0x4f4f95=_0x964732;_0x2589b8=0xc8;}else{_0x2589b8=0xce;}_0x2cd55a[_0x1ba7('0x1d')](_0x2589b8);return _0x2cd55a[_0x1ba7('0x20')]('Content-Range',_0x4f2552+'-'+_0x4f4f95+'/'+_0x964732)['json'](_0x8b84c);}return null;};}function patchUpdates(_0x56ff90){return function(_0x3d7abc){try{jsonpatch[_0x1ba7('0x21')](_0x3d7abc,_0x56ff90,!![]);}catch(_0x30f285){return BPromise[_0x1ba7('0x22')](_0x30f285);}return _0x3d7abc[_0x1ba7('0x23')]();};}function saveUpdates(_0xc344fa,_0x11e64b){return function(_0x46f94b){if(_0x46f94b){return _0x46f94b[_0x1ba7('0x24')](_0xc344fa)[_0x1ba7('0x25')](function(_0xec8f55){return _0xec8f55;});}return null;};}function removeEntity(_0x5b7720,_0x107613){return function(_0x3d89cf){if(_0x3d89cf){return _0x3d89cf['destroy']()[_0x1ba7('0x25')](function(){_0x5b7720[_0x1ba7('0x1d')](0xcc)[_0x1ba7('0x26')]();});}};}function handleEntityNotFound(_0x4d9bca,_0x4910d3){return function(_0x436ad3){if(!_0x436ad3){_0x4d9bca[_0x1ba7('0x1c')](0x194);}return _0x436ad3;};}function handleError(_0x37f7ee,_0x317372){_0x317372=_0x317372||0x1f4;return function(_0x64a526){logger['error'](_0x64a526[_0x1ba7('0x27')]);if(_0x64a526[_0x1ba7('0x28')]){delete _0x64a526['name'];}_0x37f7ee[_0x1ba7('0x1d')](_0x317372)[_0x1ba7('0x29')](_0x64a526);};}exports[_0x1ba7('0x2a')]=function(_0x291290,_0x27801c){var _0x5f3bf9={},_0x226e7c={},_0xe9b6ee={'count':0x0,'rows':[]};var _0x54e86d=db[_0x1ba7('0x2b')][_0x1ba7('0x2c')];_0x226e7c[_0x1ba7('0x2d')]=_['keys'](_0x54e86d);var _0x4c3712={'dateStart':_0x291290[_0x1ba7('0x2e')]['dateStart'],'dateEnd':_0x291290[_0x1ba7('0x2e')][_0x1ba7('0x2f')]};delete _0x291290[_0x1ba7('0x2e')][_0x1ba7('0x30')];delete _0x291290[_0x1ba7('0x2e')][_0x1ba7('0x2f')];_0x226e7c['query']=_[_0x1ba7('0x31')](_0x291290[_0x1ba7('0x2e')]);_0x226e7c['filters']=_[_0x1ba7('0x32')](_0x226e7c[_0x1ba7('0x2d')],_0x226e7c[_0x1ba7('0x2e')]);_0x5f3bf9['attributes']=_[_0x1ba7('0x32')](_0x226e7c[_0x1ba7('0x2d')],qs[_0x1ba7('0x33')](_0x291290[_0x1ba7('0x2e')][_0x1ba7('0x33')]));_0x5f3bf9[_0x1ba7('0x34')]=_0x5f3bf9[_0x1ba7('0x34')][_0x1ba7('0x35')]?_0x5f3bf9[_0x1ba7('0x34')]:_0x226e7c[_0x1ba7('0x2d')];if(!_0x291290[_0x1ba7('0x2e')]['hasOwnProperty']('nolimit')){_0x5f3bf9[_0x1ba7('0x1f')]=qs[_0x1ba7('0x1f')](_0x291290['query'][_0x1ba7('0x1f')]);_0x5f3bf9[_0x1ba7('0x36')]=qs[_0x1ba7('0x36')](_0x291290[_0x1ba7('0x2e')][_0x1ba7('0x36')]);}_0x5f3bf9['order']=qs[_0x1ba7('0x37')](_0x291290[_0x1ba7('0x2e')][_0x1ba7('0x37')]);_0x5f3bf9[_0x1ba7('0x38')]=qs[_0x1ba7('0x39')](_[_0x1ba7('0x3a')](_0x291290[_0x1ba7('0x2e')],_0x226e7c['filters']));if(_0x4c3712[_0x1ba7('0x30')]){if(_0x4c3712[_0x1ba7('0x2f')]){_0x4c3712[_0x1ba7('0x2f')]=moment(_0x4c3712[_0x1ba7('0x2f')])['add'](0x1,_0x1ba7('0x3b'));}else{_0x4c3712['dateEnd']=moment(_0x4c3712[_0x1ba7('0x30')])['add'](0x1,_0x1ba7('0x3b'));}_[_0x1ba7('0x3c')](_0x5f3bf9[_0x1ba7('0x38')],{'createdAt':{'$gte':_0x4c3712['dateStart'],'$lte':_0x4c3712[_0x1ba7('0x2f')]}});}if(_0x291290['query'][_0x1ba7('0x3d')]){_0x5f3bf9[_0x1ba7('0x38')]=_['merge'](_0x5f3bf9[_0x1ba7('0x38')],{'$or':_[_0x1ba7('0x3e')](_0x5f3bf9[_0x1ba7('0x34')],function(_0xac708){var _0x5cb8e5={};_0x5cb8e5[_0xac708]={'$like':'%'+_0x291290[_0x1ba7('0x2e')][_0x1ba7('0x3d')]+'%'};return _0x5cb8e5;})});}_0x5f3bf9=_[_0x1ba7('0x3c')]({},_0x5f3bf9,_0x291290['options']);var _0x1519a1={'where':_0x5f3bf9[_0x1ba7('0x38')]};return db[_0x1ba7('0x2b')][_0x1ba7('0x3f')](_0x1519a1)[_0x1ba7('0x25')](function(_0x58416b){_0xe9b6ee['count']=_0x58416b;if(_0x291290[_0x1ba7('0x2e')][_0x1ba7('0x40')]){_0x5f3bf9[_0x1ba7('0x41')]=[{'all':!![]}];}return db[_0x1ba7('0x2b')][_0x1ba7('0x42')](_0x5f3bf9);})[_0x1ba7('0x25')](function(_0x145694){_0xe9b6ee[_0x1ba7('0x43')]=_0x145694;return _0xe9b6ee;})[_0x1ba7('0x25')](respondWithFilteredResult(_0x27801c,_0x5f3bf9))['catch'](handleError(_0x27801c,null));};exports[_0x1ba7('0x44')]=function(_0x5f3453,_0x4214fd){var _0x1a7ba6={'raw':!![],'where':{'id':_0x5f3453[_0x1ba7('0x45')]['id']}},_0x3b4761={};_0x3b4761[_0x1ba7('0x2d')]=_[_0x1ba7('0x31')](db[_0x1ba7('0x2b')]['rawAttributes']);_0x3b4761[_0x1ba7('0x2e')]=_[_0x1ba7('0x31')](_0x5f3453[_0x1ba7('0x2e')]);_0x3b4761[_0x1ba7('0x39')]=_[_0x1ba7('0x32')](_0x3b4761[_0x1ba7('0x2d')],_0x3b4761[_0x1ba7('0x2e')]);_0x1a7ba6[_0x1ba7('0x34')]=_['intersection'](_0x3b4761[_0x1ba7('0x2d')],qs[_0x1ba7('0x33')](_0x5f3453[_0x1ba7('0x2e')][_0x1ba7('0x33')]));_0x1a7ba6[_0x1ba7('0x34')]=_0x1a7ba6[_0x1ba7('0x34')][_0x1ba7('0x35')]?_0x1a7ba6[_0x1ba7('0x34')]:_0x3b4761['model'];if(_0x5f3453[_0x1ba7('0x2e')]['includeAll']){_0x1a7ba6[_0x1ba7('0x41')]=[{'all':!![]}];}_0x1a7ba6=_[_0x1ba7('0x3c')]({},_0x1a7ba6,_0x5f3453['options']);return db['ChatInternalMessage'][_0x1ba7('0x46')](_0x1a7ba6)[_0x1ba7('0x25')](handleEntityNotFound(_0x4214fd,null))[_0x1ba7('0x25')](respondWithResult(_0x4214fd,null))[_0x1ba7('0x47')](handleError(_0x4214fd,null));};exports[_0x1ba7('0x48')]=function(_0x3b9e93,_0x1e5eac){return db[_0x1ba7('0x2b')][_0x1ba7('0x48')](_0x3b9e93[_0x1ba7('0x49')],{})[_0x1ba7('0x25')](respondWithResult(_0x1e5eac,0xc9))[_0x1ba7('0x47')](handleError(_0x1e5eac,null));};exports[_0x1ba7('0x24')]=function(_0x394020,_0x1c1dc9){if(_0x394020[_0x1ba7('0x49')]['id']){delete _0x394020[_0x1ba7('0x49')]['id'];}return db[_0x1ba7('0x2b')][_0x1ba7('0x46')]({'where':{'id':_0x394020[_0x1ba7('0x45')]['id']}})[_0x1ba7('0x25')](handleEntityNotFound(_0x1c1dc9,null))[_0x1ba7('0x25')](saveUpdates(_0x394020[_0x1ba7('0x49')],null))[_0x1ba7('0x25')](respondWithResult(_0x1c1dc9,null))['catch'](handleError(_0x1c1dc9,null));};exports['destroy']=function(_0x14aa32,_0x55c32b){return db[_0x1ba7('0x2b')][_0x1ba7('0x46')]({'where':{'id':_0x14aa32[_0x1ba7('0x45')]['id']}})[_0x1ba7('0x25')](handleEntityNotFound(_0x55c32b,null))[_0x1ba7('0x25')](removeEntity(_0x55c32b,null))[_0x1ba7('0x47')](handleError(_0x55c32b,null));};exports[_0x1ba7('0x4a')]=function(_0xc65881,_0x5a972a){return db['ChatInternalMessage'][_0x1ba7('0x4a')]()[_0x1ba7('0x25')](respondWithResult(_0x5a972a,null))[_0x1ba7('0x47')](handleError(_0x5a972a,null));};function wrapUser(_0x206b34){return function(_0x5ae631){var _0x425ab7=_0x206b34['get']({'plain':!![]});_0x425ab7[_0x1ba7('0x4b')]=[];if(_0x5ae631){_0x425ab7[_0x1ba7('0x4c')]=_0x5ae631[_0x1ba7('0x4d')];_0x425ab7[_0x1ba7('0x4e')]=_0x5ae631;}else{_0x425ab7[_0x1ba7('0x4c')]=moment(0x0)[_0x1ba7('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x425ab7[_0x1ba7('0x4e')]={};}return _0x425ab7;};}exports[_0x1ba7('0x50')]=function(_0x157433,_0x47d173,_0x13edff){var _0x24dc22=[];return db[_0x1ba7('0x51')][_0x1ba7('0x42')]({'where':{'role':[_0x1ba7('0x52'),_0x1ba7('0x53'),_0x1ba7('0x54')]},'attributes':['id',_0x1ba7('0x55'),_0x1ba7('0x28'),_0x1ba7('0x56'),_0x1ba7('0x57'),_0x1ba7('0x58'),_0x1ba7('0x59'),_0x1ba7('0x5a'),_0x1ba7('0x5b'),'showWebBar'],'order':qs[_0x1ba7('0x37')](_0x1ba7('0x5c')),'include':[{'model':db[_0x1ba7('0x5d')],'as':_0x1ba7('0x5e'),'attributes':['id',_0x1ba7('0x28'),_0x1ba7('0x5f')],'through':{'attributes':[]}}]})[_0x1ba7('0x25')](function(_0x14256f){if(_0x14256f){var _0x583c11=_0x157433[_0x1ba7('0x54')][_0x1ba7('0x60')]({'plain':!![]});if(!_0x583c11)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x583c11[_0x1ba7('0x56')]===_0x1ba7('0x54')){return db[_0x1ba7('0x61')][_0x1ba7('0x46')]({'where':{'name':_0x1ba7('0x62'),'userProfileId':_0x583c11['userProfileId']},'raw':!![]})[_0x1ba7('0x25')](function(_0xbbdccd){if(_0xbbdccd){if(_0xbbdccd[_0x1ba7('0x63')]===0x0){return db[_0x1ba7('0x64')][_0x1ba7('0x42')]({'where':{'sectionId':_0xbbdccd['id']},'raw':!![]})['then'](function(_0x38aba0){var _0x24937d=[];if(_[_0x1ba7('0x65')](_0x38aba0)){_0x24937d=_[_0x1ba7('0x3d')](_0x14256f,function(_0xb9bffe){if(_0xb9bffe[_0x1ba7('0x56')]!==_0x1ba7('0x52')){return _0xb9bffe;}});return _0x24937d;}else{for(var _0x1bf011=0x0;_0x1bf011<_0x14256f['length'];_0x1bf011++){var _0x33ed52=_0x14256f[_0x1bf011];if(_0x33ed52[_0x1ba7('0x56')]===_0x1ba7('0x52')){var _0x197104=_[_0x1ba7('0x46')](_0x38aba0,function(_0x133af8){return _0x133af8[_0x1ba7('0x66')]===_0x33ed52['id'];});if(_0x197104)_0x24937d[_0x1ba7('0x67')](_0x33ed52);}else{_0x24937d[_0x1ba7('0x67')](_0x33ed52);}}return _0x24937d;}});}else{return _0x14256f;}}else{var _0x3df4e6=_[_0x1ba7('0x3d')](_0x14256f,function(_0x5caa76){if(_0x5caa76[_0x1ba7('0x56')]!==_0x1ba7('0x52')){return _0x5caa76;}});return _0x3df4e6;}});}else{return _0x14256f;}}})[_0x1ba7('0x25')](function(_0x4b1068){var _0x393a3c=[];if(_0x4b1068){_0x24dc22=_0x4b1068;for(var _0x37c46a=0x0;_0x37c46a<_0x4b1068['length'];_0x37c46a+=0x1){_0x24dc22[_0x37c46a][_0x1ba7('0x4b')]=[];_0x393a3c[_0x1ba7('0x67')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x157433[_0x1ba7('0x54')]['id'],_0x4b1068[_0x37c46a]['id']],'ToId':[_0x157433['user']['id'],_0x4b1068[_0x37c46a]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x1ba7('0x68'),'ToId',_0x1ba7('0x69'),_0x1ba7('0x49')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x4b1068[_0x37c46a])));}return BPromise['all'](_0x393a3c);}return[];})[_0x1ba7('0x25')](function(_0x522226){return{'rows':_0x522226,'count':_0x522226[_0x1ba7('0x35')]};})[_0x1ba7('0x25')](respondWithResult(_0x47d173,null))[_0x1ba7('0x47')](handleError(_0x47d173,null));}; \ No newline at end of file +var _0xf963=['Content-Range','apply','reject','save','update','then','destroy','stack','name','index','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','add','merge','filter','options','ChatInternalMessage','includeAll','rows','catch','params','rawAttributes','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','user','internal','online','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','agent','resourceId','push','FromId','ToId','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','json','count','offset','limit','status','set'];(function(_0x1511dd,_0x543b24){var _0x1cafca=function(_0x1dd3a8){while(--_0x1dd3a8){_0x1511dd['push'](_0x1511dd['shift']());}};_0x1cafca(++_0x543b24);}(_0xf963,0x9e));var _0x3f96=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf963[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0x3f96('0x0'));var emlformat=require(_0x3f96('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3f96('0x2'));var rp=require(_0x3f96('0x3'));var moment=require(_0x3f96('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f96('0x5'));var util=require(_0x3f96('0x6'));var path=require(_0x3f96('0x7'));var sox=require(_0x3f96('0x8'));var csv=require(_0x3f96('0x9'));var ejs=require(_0x3f96('0xa'));var fs=require('fs');var _=require(_0x3f96('0xb'));var squel=require(_0x3f96('0xc'));var crypto=require(_0x3f96('0xd'));var jsforce=require(_0x3f96('0xe'));var deskjs=require(_0x3f96('0xf'));var toCsv=require(_0x3f96('0x9'));var querystring=require(_0x3f96('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x3f96('0x11'));var config=require(_0x3f96('0x12'));var db=require(_0x3f96('0x13'))['db'];config[_0x3f96('0x14')]=_['defaults'](config[_0x3f96('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f96('0x15'))(new Redis(config[_0x3f96('0x14')]));require(_0x3f96('0x16'))[_0x3f96('0x17')](socket);function respondWithStatusCode(_0x2935bd,_0x2b3c4c){_0x2b3c4c=_0x2b3c4c||0xcc;return function(_0x5cb3e6){if(_0x5cb3e6){return _0x2935bd[_0x3f96('0x18')](_0x2b3c4c);}return _0x2935bd['status'](_0x2b3c4c)[_0x3f96('0x19')]();};}function respondWithResult(_0x51e6c9,_0x4b9494){_0x4b9494=_0x4b9494||0xc8;return function(_0x4d51ae){if(_0x4d51ae){return _0x51e6c9['status'](_0x4b9494)[_0x3f96('0x1a')](_0x4d51ae);}};}function respondWithFilteredResult(_0x1e8cae,_0x1828c0){return function(_0x954dfd){if(_0x954dfd){var _0x7dfaf1=_0x954dfd[_0x3f96('0x1b')],_0xb6eb0d=_0x1828c0[_0x3f96('0x1c')],_0x2c2de4=_0x1828c0[_0x3f96('0x1c')]+_0x1828c0[_0x3f96('0x1d')],_0x47beba;if(_0x2c2de4>=_0x7dfaf1){_0x2c2de4=_0x7dfaf1;_0x47beba=0xc8;}else{_0x47beba=0xce;}_0x1e8cae[_0x3f96('0x1e')](_0x47beba);return _0x1e8cae[_0x3f96('0x1f')](_0x3f96('0x20'),_0xb6eb0d+'-'+_0x2c2de4+'/'+_0x7dfaf1)['json'](_0x954dfd);}return null;};}function patchUpdates(_0x72c98){return function(_0x13bd08){try{jsonpatch[_0x3f96('0x21')](_0x13bd08,_0x72c98,!![]);}catch(_0x191408){return BPromise[_0x3f96('0x22')](_0x191408);}return _0x13bd08[_0x3f96('0x23')]();};}function saveUpdates(_0xa70d1d,_0x41263b){return function(_0x26f34c){if(_0x26f34c){return _0x26f34c[_0x3f96('0x24')](_0xa70d1d)[_0x3f96('0x25')](function(_0xf9b65c){return _0xf9b65c;});}return null;};}function removeEntity(_0x2f2078,_0x507f84){return function(_0x2a8ac5){if(_0x2a8ac5){return _0x2a8ac5[_0x3f96('0x26')]()[_0x3f96('0x25')](function(){_0x2f2078[_0x3f96('0x1e')](0xcc)[_0x3f96('0x19')]();});}};}function handleEntityNotFound(_0x1546c7,_0x226ff4){return function(_0x1e1143){if(!_0x1e1143){_0x1546c7['sendStatus'](0x194);}return _0x1e1143;};}function handleError(_0x42b052,_0x7173aa){_0x7173aa=_0x7173aa||0x1f4;return function(_0x255b25){logger['error'](_0x255b25[_0x3f96('0x27')]);if(_0x255b25[_0x3f96('0x28')]){delete _0x255b25[_0x3f96('0x28')];}_0x42b052[_0x3f96('0x1e')](_0x7173aa)['send'](_0x255b25);};}exports[_0x3f96('0x29')]=function(_0x3ddd1f,_0x13c4b5){var _0x281ed0={},_0x1eb3e5={},_0x5df06b={'count':0x0,'rows':[]};var _0x44d4ae=db['ChatInternalMessage']['rawAttributes'];_0x1eb3e5[_0x3f96('0x2a')]=_[_0x3f96('0x2b')](_0x44d4ae);var _0x57d151={'dateStart':_0x3ddd1f[_0x3f96('0x2c')][_0x3f96('0x2d')],'dateEnd':_0x3ddd1f[_0x3f96('0x2c')]['dateEnd']};delete _0x3ddd1f[_0x3f96('0x2c')][_0x3f96('0x2d')];delete _0x3ddd1f[_0x3f96('0x2c')][_0x3f96('0x2e')];_0x1eb3e5[_0x3f96('0x2c')]=_['keys'](_0x3ddd1f[_0x3f96('0x2c')]);_0x1eb3e5['filters']=_[_0x3f96('0x2f')](_0x1eb3e5[_0x3f96('0x2a')],_0x1eb3e5[_0x3f96('0x2c')]);_0x281ed0['attributes']=_[_0x3f96('0x2f')](_0x1eb3e5[_0x3f96('0x2a')],qs[_0x3f96('0x30')](_0x3ddd1f[_0x3f96('0x2c')][_0x3f96('0x30')]));_0x281ed0[_0x3f96('0x31')]=_0x281ed0[_0x3f96('0x31')][_0x3f96('0x32')]?_0x281ed0['attributes']:_0x1eb3e5[_0x3f96('0x2a')];if(!_0x3ddd1f[_0x3f96('0x2c')]['hasOwnProperty'](_0x3f96('0x33'))){_0x281ed0[_0x3f96('0x1d')]=qs['limit'](_0x3ddd1f['query']['limit']);_0x281ed0['offset']=qs[_0x3f96('0x1c')](_0x3ddd1f[_0x3f96('0x2c')][_0x3f96('0x1c')]);}_0x281ed0[_0x3f96('0x34')]=qs['sort'](_0x3ddd1f[_0x3f96('0x2c')][_0x3f96('0x35')]);_0x281ed0[_0x3f96('0x36')]=qs[_0x3f96('0x37')](_[_0x3f96('0x38')](_0x3ddd1f['query'],_0x1eb3e5[_0x3f96('0x37')]));if(_0x57d151[_0x3f96('0x2d')]){if(_0x57d151['dateEnd']){_0x57d151[_0x3f96('0x2e')]=moment(_0x57d151[_0x3f96('0x2e')])[_0x3f96('0x39')](0x1,'day');}else{_0x57d151[_0x3f96('0x2e')]=moment(_0x57d151[_0x3f96('0x2d')])[_0x3f96('0x39')](0x1,'day');}_[_0x3f96('0x3a')](_0x281ed0[_0x3f96('0x36')],{'createdAt':{'$gte':_0x57d151[_0x3f96('0x2d')],'$lte':_0x57d151[_0x3f96('0x2e')]}});}if(_0x3ddd1f[_0x3f96('0x2c')][_0x3f96('0x3b')]){_0x281ed0[_0x3f96('0x36')]=_[_0x3f96('0x3a')](_0x281ed0[_0x3f96('0x36')],{'$or':_['map'](_0x281ed0[_0x3f96('0x31')],function(_0x4873bd){var _0x56451e={};_0x56451e[_0x4873bd]={'$like':'%'+_0x3ddd1f['query'][_0x3f96('0x3b')]+'%'};return _0x56451e;})});}_0x281ed0=_['merge']({},_0x281ed0,_0x3ddd1f[_0x3f96('0x3c')]);var _0x363f2e={'where':_0x281ed0['where']};return db[_0x3f96('0x3d')][_0x3f96('0x1b')](_0x363f2e)[_0x3f96('0x25')](function(_0x4e038f){_0x5df06b[_0x3f96('0x1b')]=_0x4e038f;if(_0x3ddd1f['query'][_0x3f96('0x3e')]){_0x281ed0['include']=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x281ed0);})[_0x3f96('0x25')](function(_0x1542e1){_0x5df06b[_0x3f96('0x3f')]=_0x1542e1;return _0x5df06b;})[_0x3f96('0x25')](respondWithFilteredResult(_0x13c4b5,_0x281ed0))[_0x3f96('0x40')](handleError(_0x13c4b5,null));};exports['show']=function(_0x3b79a7,_0x3fcd9b){var _0x35d7d2={'raw':!![],'where':{'id':_0x3b79a7[_0x3f96('0x41')]['id']}},_0x313e7c={};_0x313e7c['model']=_[_0x3f96('0x2b')](db['ChatInternalMessage'][_0x3f96('0x42')]);_0x313e7c[_0x3f96('0x2c')]=_[_0x3f96('0x2b')](_0x3b79a7[_0x3f96('0x2c')]);_0x313e7c[_0x3f96('0x37')]=_[_0x3f96('0x2f')](_0x313e7c[_0x3f96('0x2a')],_0x313e7c[_0x3f96('0x2c')]);_0x35d7d2[_0x3f96('0x31')]=_[_0x3f96('0x2f')](_0x313e7c[_0x3f96('0x2a')],qs['fields'](_0x3b79a7[_0x3f96('0x2c')][_0x3f96('0x30')]));_0x35d7d2[_0x3f96('0x31')]=_0x35d7d2[_0x3f96('0x31')][_0x3f96('0x32')]?_0x35d7d2[_0x3f96('0x31')]:_0x313e7c[_0x3f96('0x2a')];if(_0x3b79a7['query'][_0x3f96('0x3e')]){_0x35d7d2['include']=[{'all':!![]}];}_0x35d7d2=_[_0x3f96('0x3a')]({},_0x35d7d2,_0x3b79a7[_0x3f96('0x3c')]);return db[_0x3f96('0x3d')][_0x3f96('0x43')](_0x35d7d2)['then'](handleEntityNotFound(_0x3fcd9b,null))[_0x3f96('0x25')](respondWithResult(_0x3fcd9b,null))[_0x3f96('0x40')](handleError(_0x3fcd9b,null));};exports[_0x3f96('0x44')]=function(_0x222469,_0x52181f){return db['ChatInternalMessage'][_0x3f96('0x44')](_0x222469['body'],{})[_0x3f96('0x25')](respondWithResult(_0x52181f,0xc9))[_0x3f96('0x40')](handleError(_0x52181f,null));};exports[_0x3f96('0x24')]=function(_0x11da50,_0x31785d){if(_0x11da50[_0x3f96('0x45')]['id']){delete _0x11da50['body']['id'];}return db['ChatInternalMessage'][_0x3f96('0x43')]({'where':{'id':_0x11da50[_0x3f96('0x41')]['id']}})[_0x3f96('0x25')](handleEntityNotFound(_0x31785d,null))[_0x3f96('0x25')](saveUpdates(_0x11da50[_0x3f96('0x45')],null))[_0x3f96('0x25')](respondWithResult(_0x31785d,null))[_0x3f96('0x40')](handleError(_0x31785d,null));};exports[_0x3f96('0x26')]=function(_0x4c8ff2,_0x37d038){return db[_0x3f96('0x3d')][_0x3f96('0x43')]({'where':{'id':_0x4c8ff2['params']['id']}})['then'](handleEntityNotFound(_0x37d038,null))[_0x3f96('0x25')](removeEntity(_0x37d038,null))[_0x3f96('0x40')](handleError(_0x37d038,null));};exports['describe']=function(_0x926aa4,_0x861835){return db[_0x3f96('0x3d')][_0x3f96('0x46')]()[_0x3f96('0x25')](respondWithResult(_0x861835,null))[_0x3f96('0x40')](handleError(_0x861835,null));};function wrapUser(_0x1fe33d){return function(_0x17fc24){var _0x26e786=_0x1fe33d[_0x3f96('0x47')]({'plain':!![]});_0x26e786[_0x3f96('0x48')]=[];if(_0x17fc24){_0x26e786[_0x3f96('0x49')]=_0x17fc24[_0x3f96('0x4a')];_0x26e786[_0x3f96('0x4b')]=_0x17fc24;}else{_0x26e786[_0x3f96('0x49')]=moment(0x0)[_0x3f96('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x26e786[_0x3f96('0x4b')]={};}return _0x26e786;};}exports[_0x3f96('0x4d')]=function(_0x58fa47,_0x266c1f,_0xe285ae){var _0x157367=[];return db[_0x3f96('0x4e')]['findAll']({'where':{'role':['agent','admin',_0x3f96('0x4f')]},'attributes':['id','fullname',_0x3f96('0x28'),'role','userpic',_0x3f96('0x50'),_0x3f96('0x51'),'lastLoginAt','allowmessenger',_0x3f96('0x52')],'order':qs[_0x3f96('0x35')](_0x3f96('0x53')),'include':[{'model':db[_0x3f96('0x54')],'as':_0x3f96('0x55'),'attributes':['id',_0x3f96('0x28'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x3d8b90){if(_0x3d8b90){var _0x4d490b=_0x58fa47[_0x3f96('0x4f')]['get']({'plain':!![]});if(!_0x4d490b)throw new Error(_0x3f96('0x56'));if(_0x4d490b[_0x3f96('0x57')]===_0x3f96('0x4f')){return db['UserProfileSection'][_0x3f96('0x43')]({'where':{'name':'Agents','userProfileId':_0x4d490b[_0x3f96('0x58')]},'raw':!![]})[_0x3f96('0x25')](function(_0x1bef28){if(_0x1bef28){if(_0x1bef28['autoAssociation']===0x0){return db[_0x3f96('0x59')]['findAll']({'where':{'sectionId':_0x1bef28['id']},'raw':!![]})['then'](function(_0x52bea6){var _0x335093=[];if(_['isEmpty'](_0x52bea6)){_0x335093=_['filter'](_0x3d8b90,function(_0x436bc0){if(_0x436bc0[_0x3f96('0x57')]!==_0x3f96('0x5a')){return _0x436bc0;}});return _0x335093;}else{for(var _0x505bae=0x0;_0x505bae<_0x3d8b90[_0x3f96('0x32')];_0x505bae++){var _0x4a36fe=_0x3d8b90[_0x505bae];if(_0x4a36fe['role']==='agent'){var _0x3f0fdf=_[_0x3f96('0x43')](_0x52bea6,function(_0x1a2316){return _0x1a2316[_0x3f96('0x5b')]===_0x4a36fe['id'];});if(_0x3f0fdf)_0x335093[_0x3f96('0x5c')](_0x4a36fe);}else{_0x335093['push'](_0x4a36fe);}}return _0x335093;}});}else{return _0x3d8b90;}}else{var _0x188849=_['filter'](_0x3d8b90,function(_0x2e5972){if(_0x2e5972[_0x3f96('0x57')]!==_0x3f96('0x5a')){return _0x2e5972;}});return _0x188849;}});}else{return _0x3d8b90;}}})['then'](function(_0x3fb378){var _0x4f07a1=[];if(_0x3fb378){_0x157367=_0x3fb378;for(var _0x28744e=0x0;_0x28744e<_0x3fb378[_0x3f96('0x32')];_0x28744e+=0x1){_0x157367[_0x28744e][_0x3f96('0x48')]=[];_0x4f07a1[_0x3f96('0x5c')](db[_0x3f96('0x3d')][_0x3f96('0x43')]({'where':{'FromId':[_0x58fa47[_0x3f96('0x4f')]['id'],_0x3fb378[_0x28744e]['id']],'ToId':[_0x58fa47[_0x3f96('0x4f')]['id'],_0x3fb378[_0x28744e]['id']],'ChatGroupId':null},'attributes':['id',_0x3f96('0x4a'),_0x3f96('0x5d'),_0x3f96('0x5e'),'read',_0x3f96('0x45')],'order':qs[_0x3f96('0x35')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3f96('0x25')](wrapUser(_0x3fb378[_0x28744e])));}return BPromise['all'](_0x4f07a1);}return[];})['then'](function(_0x1a37f0){return{'rows':_0x1a37f0,'count':_0x1a37f0[_0x3f96('0x32')]};})['then'](respondWithResult(_0x266c1f,null))[_0x3f96('0x40')](handleError(_0x266c1f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index fd7df7a..e0619cb 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 _0xda34=['../../mysqldb','ChatInternalMessage','setMaxListeners','update','emit','hasOwnProperty','events'];(function(_0x51ff9c,_0x2a3a66){var _0xae33fa=function(_0x3172fa){while(--_0x3172fa){_0x51ff9c['push'](_0x51ff9c['shift']());}};_0xae33fa(++_0x2a3a66);}(_0xda34,0x1d4));var _0x4da3=function(_0x36a790,_0x228b91){_0x36a790=_0x36a790-0x0;var _0x25d8b3=_0xda34[_0x36a790];return _0x25d8b3;};'use strict';var EventEmitter=require(_0x4da3('0x0'));var ChatInternalMessage=require(_0x4da3('0x1'))['db'][_0x4da3('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4da3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4da3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x138c1d){return function(_0x52e71c,_0x49f2a0,_0x49c22a){ChatInternalMessageEvents[_0x4da3('0x5')](_0x138c1d+':'+_0x52e71c['id'],_0x52e71c);ChatInternalMessageEvents['emit'](_0x138c1d,_0x52e71c);_0x49c22a(null);};}for(var e in events){if(events[_0x4da3('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xdf25=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x176d54,_0x1164c8){var _0x2bb091=function(_0x489d50){while(--_0x489d50){_0x176d54['push'](_0x176d54['shift']());}};_0x2bb091(++_0x1164c8);}(_0xdf25,0x99));var _0x5df2=function(_0x4eff6a,_0x466240){_0x4eff6a=_0x4eff6a-0x0;var _0x5bec4e=_0xdf25[_0x4eff6a];return _0x5bec4e;};'use strict';var EventEmitter=require(_0x5df2('0x0'));var ChatInternalMessage=require(_0x5df2('0x1'))['db'][_0x5df2('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5df2('0x3')](0x0);var events={'afterCreate':_0x5df2('0x4'),'afterUpdate':_0x5df2('0x5'),'afterDestroy':_0x5df2('0x6')};function emitEvent(_0x4bcfd9){return function(_0x780c8a,_0x6854c,_0x2ea239){ChatInternalMessageEvents[_0x5df2('0x7')](_0x4bcfd9+':'+_0x780c8a['id'],_0x780c8a);ChatInternalMessageEvents[_0x5df2('0x7')](_0x4bcfd9,_0x780c8a);_0x2ea239(null);};}for(var e in events){if(events[_0x5df2('0x8')](e)){var event=events[e];ChatInternalMessage[_0x5df2('0x9')](e,emitEvent(event));}}module[_0x5df2('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index cf08064..c017ef5 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 _0xe2fb=['define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','exports'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xe2fb,0xd1));var _0xbe2f=function(_0x4d53ce,_0x53b2d3){_0x4d53ce=_0x4d53ce-0x0;var _0xc823a8=_0xe2fb[_0x4d53ce];return _0xc823a8;};'use strict';var _=require(_0xbe2f('0x0'));var util=require(_0xbe2f('0x1'));var logger=require(_0xbe2f('0x2'))(_0xbe2f('0x3'));var moment=require(_0xbe2f('0x4'));var BPromise=require(_0xbe2f('0x5'));var rp=require('request-promise');var attributes=require('./chatInternalMessage.attributes');module[_0xbe2f('0x6')]=function(_0x170c16,_0x24bb95){return _0x170c16[_0xbe2f('0x7')](_0xbe2f('0x8'),attributes,{'tableName':_0xbe2f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe2f('0xa'),'collate':_0xbe2f('0xb')});}; \ No newline at end of file +var _0xbbea=['utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x2a6f29,_0x597d43){var _0x430d9f=function(_0x146c7b){while(--_0x146c7b){_0x2a6f29['push'](_0x2a6f29['shift']());}};_0x430d9f(++_0x597d43);}(_0xbbea,0x1a5));var _0xabbe=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbbea[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xabbe('0x0'));var util=require('util');var logger=require(_0xabbe('0x1'))(_0xabbe('0x2'));var moment=require('moment');var BPromise=require(_0xabbe('0x3'));var rp=require(_0xabbe('0x4'));var attributes=require(_0xabbe('0x5'));module[_0xabbe('0x6')]=function(_0x3fc9b3,_0x161901){return _0x3fc9b3[_0xabbe('0x7')](_0xabbe('0x8'),attributes,{'tableName':_0xabbe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xabbe('0xa'),'collate':_0xabbe('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 263196e..755ec50 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 _0x14c4=['debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x2f9f8c,_0x54c298){var _0x4b94e6=function(_0x4006c5){while(--_0x4006c5){_0x2f9f8c['push'](_0x2f9f8c['shift']());}};_0x4b94e6(++_0x54c298);}(_0x14c4,0x158));var _0x414c=function(_0xf47605,_0x22a2f5){_0xf47605=_0xf47605-0x0;var _0x33bee8=_0x14c4[_0xf47605];return _0x33bee8;};'use strict';var _=require(_0x414c('0x0'));var util=require(_0x414c('0x1'));var moment=require('moment');var BPromise=require(_0x414c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x414c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x414c('0x4'));var logger=require(_0x414c('0x5'))(_0x414c('0x6'));var config=require(_0x414c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x414c('0x8')][_0x414c('0x9')]({'port':0x232a});config[_0x414c('0xa')]=_[_0x414c('0xb')](config['redis'],{'host':_0x414c('0xc'),'port':0x18eb});var socket=require(_0x414c('0xd'))(new Redis(config[_0x414c('0xa')]));require('./chatInternalMessage.socket')[_0x414c('0xe')](socket);function respondWithRpcPromise(_0xe89339,_0x22fde2,_0x2f9989){return new BPromise(function(_0x734bbd,_0x252015){return client[_0x414c('0xf')](_0xe89339,_0x2f9989)[_0x414c('0x10')](function(_0x2f725d){logger[_0x414c('0x11')](_0x414c('0x12'),_0x22fde2,_0x414c('0x13'));logger[_0x414c('0x14')](_0x414c('0x15'),_0x22fde2,'request\x20sent',JSON[_0x414c('0x16')](_0x2f725d));if(_0x2f725d[_0x414c('0x17')]){if(_0x2f725d[_0x414c('0x17')][_0x414c('0x18')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x22fde2,_0x2f725d['error']['message']);return _0x252015(_0x2f725d[_0x414c('0x17')]['message']);}logger[_0x414c('0x17')](_0x414c('0x12'),_0x22fde2,_0x2f725d[_0x414c('0x17')]['message']);return _0x734bbd(_0x2f725d['error'][_0x414c('0x19')]);}else{logger[_0x414c('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x22fde2,_0x414c('0x13'));_0x734bbd(_0x2f725d['result'][_0x414c('0x19')]);}})['catch'](function(_0x40c934){logger[_0x414c('0x17')](_0x414c('0x12'),_0x22fde2,_0x40c934);_0x252015(_0x40c934);});});} \ No newline at end of file +var _0xe852=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','ChatInternalMessage,\x20%s,\x20%s','debug','stringify','code','error','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x2f40da,_0xadd44c){var _0x5342af=function(_0x487c83){while(--_0x487c83){_0x2f40da['push'](_0x2f40da['shift']());}};_0x5342af(++_0xadd44c);}(_0xe852,0x123));var _0x2e85=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe852[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x2e85('0x0'));var moment=require(_0x2e85('0x1'));var BPromise=require(_0x2e85('0x2'));var rs=require(_0x2e85('0x3'));var fs=require('fs');var Redis=require(_0x2e85('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e85('0x5'))(_0x2e85('0x6'));var config=require(_0x2e85('0x7'));var jayson=require(_0x2e85('0x8'));var client=jayson[_0x2e85('0x9')][_0x2e85('0xa')]({'port':0x232a});config[_0x2e85('0xb')]=_[_0x2e85('0xc')](config['redis'],{'host':_0x2e85('0xd'),'port':0x18eb});var socket=require(_0x2e85('0xe'))(new Redis(config[_0x2e85('0xb')]));require('./chatInternalMessage.socket')[_0x2e85('0xf')](socket);function respondWithRpcPromise(_0x5a82ae,_0x20073f,_0x1999ec){return new BPromise(function(_0x3ac76b,_0xadfdee){return client[_0x2e85('0x10')](_0x5a82ae,_0x1999ec)['then'](function(_0x24b003){logger['info'](_0x2e85('0x11'),_0x20073f,'request\x20sent');logger[_0x2e85('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x20073f,'request\x20sent',JSON[_0x2e85('0x13')](_0x24b003));if(_0x24b003['error']){if(_0x24b003['error'][_0x2e85('0x14')]===0x1f4){logger[_0x2e85('0x15')](_0x2e85('0x11'),_0x20073f,_0x24b003[_0x2e85('0x15')]['message']);return _0xadfdee(_0x24b003['error'][_0x2e85('0x16')]);}logger['error'](_0x2e85('0x11'),_0x20073f,_0x24b003[_0x2e85('0x15')][_0x2e85('0x16')]);return _0x3ac76b(_0x24b003[_0x2e85('0x15')][_0x2e85('0x16')]);}else{logger[_0x2e85('0x17')](_0x2e85('0x11'),_0x20073f,_0x2e85('0x18'));_0x3ac76b(_0x24b003[_0x2e85('0x19')]['message']);}})[_0x2e85('0x1a')](function(_0x1906b4){logger['error'](_0x2e85('0x11'),_0x20073f,_0x1906b4);_0xadfdee(_0x1906b4);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 578e711..b83e3b4 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 _0x7851=['save','update','emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x59d525,_0x59c324){var _0x1ea43f=function(_0x3e4934){while(--_0x3e4934){_0x59d525['push'](_0x59d525['shift']());}};_0x1ea43f(++_0x59c324);}(_0x7851,0x109));var _0x1785=function(_0x539bd5,_0x581fac){_0x539bd5=_0x539bd5-0x0;var _0x3912ba=_0x7851[_0x539bd5];return _0x3912ba;};'use strict';var ChatInternalMessageEvents=require(_0x1785('0x0'));var events=[_0x1785('0x1'),'remove',_0x1785('0x2')];function createListener(_0x734e93,_0x130eb5){return function(_0x376d1a){_0x130eb5[_0x1785('0x3')](_0x734e93,_0x376d1a);};}function removeListener(_0x45dff6,_0x1bde9e){return function(){ChatInternalMessageEvents[_0x1785('0x4')](_0x45dff6,_0x1bde9e);};}exports[_0x1785('0x5')]=function(_0x2f7567){for(var _0x1fa1a1=0x0,_0x41e8e5=events['length'];_0x1fa1a1<_0x41e8e5;_0x1fa1a1++){var _0x37c749=events[_0x1fa1a1];var _0x3d2446=createListener(_0x1785('0x6')+_0x37c749,_0x2f7567);ChatInternalMessageEvents['on'](_0x37c749,_0x3d2446);}}; \ No newline at end of file +var _0xaebb=['./chatInternalMessage.events','save','remove','update','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xaebb,0xcf));var _0xbaeb=function(_0x506627,_0x425248){_0x506627=_0x506627-0x0;var _0x2317c3=_0xaebb[_0x506627];return _0x2317c3;};'use strict';var ChatInternalMessageEvents=require(_0xbaeb('0x0'));var events=[_0xbaeb('0x1'),_0xbaeb('0x2'),_0xbaeb('0x3')];function createListener(_0x54f040,_0x1601f1){return function(_0x37d77e){_0x1601f1[_0xbaeb('0x4')](_0x54f040,_0x37d77e);};}function removeListener(_0x25f730,_0x178ade){return function(){ChatInternalMessageEvents[_0xbaeb('0x5')](_0x25f730,_0x178ade);};}exports[_0xbaeb('0x6')]=function(_0x4711db){for(var _0x4dea4d=0x0,_0x28bec0=events[_0xbaeb('0x7')];_0x4dea4d<_0x28bec0;_0x4dea4d++){var _0x6765fa=events[_0x4dea4d];var _0x536b6c=createListener(_0xbaeb('0x8')+_0x6765fa,_0x4711db);ChatInternalMessageEvents['on'](_0x6765fa,_0x536b6c);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 146e326..7490ebd 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 _0xfeda=['/describe','isAuthenticated','describe','getUsers','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x28c481,_0xf262c5){var _0x5a92fd=function(_0xcce71){while(--_0xcce71){_0x28c481['push'](_0x28c481['shift']());}};_0x5a92fd(++_0xf262c5);}(_0xfeda,0x11d));var _0xafed=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xfeda[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0xafed('0x0'));var util=require(_0xafed('0x1'));var path=require(_0xafed('0x2'));var timeout=require(_0xafed('0x3'));var express=require(_0xafed('0x4'));var router=express['Router']();var auth=require(_0xafed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xafed('0x6'));var controller=require(_0xafed('0x7'));router[_0xafed('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xafed('0x8')](_0xafed('0x9'),auth[_0xafed('0xa')](),controller[_0xafed('0xb')]);router[_0xafed('0x8')]('/users',auth[_0xafed('0xa')](),controller[_0xafed('0xc')]);router[_0xafed('0x8')](_0xafed('0xd'),auth[_0xafed('0xa')](),controller[_0xafed('0xe')]);router[_0xafed('0xf')]('/',auth[_0xafed('0xa')](),controller[_0xafed('0x10')]);router[_0xafed('0x11')](_0xafed('0xd'),controller[_0xafed('0x12')]);router['delete']('/:id',auth[_0xafed('0xa')](),controller[_0xafed('0x13')]);module[_0xafed('0x14')]=router; \ No newline at end of file +var _0x63a6=['../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','show','post','create','put','update','delete','/:id','exports','util','path','express','Router','../../components/interaction/service'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x63a6,0x1c7));var _0x663a=function(_0x472378,_0x327f94){_0x472378=_0x472378-0x0;var _0x4c1e48=_0x63a6[_0x472378];return _0x4c1e48;};'use strict';var multer=require('multer');var util=require(_0x663a('0x0'));var path=require(_0x663a('0x1'));var timeout=require('connect-timeout');var express=require(_0x663a('0x2'));var router=express[_0x663a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x663a('0x4'));var config=require(_0x663a('0x5'));var controller=require(_0x663a('0x6'));router[_0x663a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x663a('0x8'),auth[_0x663a('0x9')](),controller['describe']);router['get'](_0x663a('0xa'),auth[_0x663a('0x9')](),controller[_0x663a('0xb')]);router['get']('/:id',auth[_0x663a('0x9')](),controller[_0x663a('0xc')]);router[_0x663a('0xd')]('/',auth[_0x663a('0x9')](),controller[_0x663a('0xe')]);router[_0x663a('0xf')]('/:id',controller[_0x663a('0x10')]);router[_0x663a('0x11')](_0x663a('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x663a('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 0c0fa77..f977b24 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 _0x74cf=['DATE','sequelize','TEXT','BOOLEAN','ENUM','out'];(function(_0x5e03ab,_0x595d38){var _0x25a10f=function(_0x49fd47){while(--_0x49fd47){_0x5e03ab['push'](_0x5e03ab['shift']());}};_0x25a10f(++_0x595d38);}(_0x74cf,0x15d));var _0xf74c=function(_0x5cc71f,_0x4f6f52){_0x5cc71f=_0x5cc71f-0x0;var _0x4e1b52=_0x74cf[_0x5cc71f];return _0x4e1b52;};'use strict';var Sequelize=require(_0xf74c('0x0'));module['exports']={'body':{'type':Sequelize[_0xf74c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf74c('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf74c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf74c('0x3')]('in','out'),'defaultValue':_0xf74c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf74c('0x5')]}}; \ No newline at end of file +var _0x18c6=['BOOLEAN','out','DATE','TEXT','medium'];(function(_0x50cf2f,_0x5ccc60){var _0x3af567=function(_0x1d41e0){while(--_0x1d41e0){_0x50cf2f['push'](_0x50cf2f['shift']());}};_0x3af567(++_0x5ccc60);}(_0x18c6,0x10c));var _0x618c=function(_0x9f0318,_0x57ab3d){_0x9f0318=_0x9f0318-0x0;var _0x261330=_0x18c6[_0x9f0318];return _0x261330;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x618c('0x0')](_0x618c('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x618c('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x618c('0x3')),'defaultValue':_0x618c('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x618c('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 4232a30..290d3c5 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 _0x8f9d=['papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','destroy','name','index','ChatMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','includeAll','include','findAll','show','params','options','find','create','body','update','describe','chat-interactions','accept','chat','read','format','user','CmContact','Contact','get','ChatInteraction','UserId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','manual','interface','channel','formData','reject','agent','ChatInteractionId','RejectMessage','rejectMessage','event','EventManager','rejectmessage','rimraf','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x55b0ae,_0x1e1096){var _0x4417d5=function(_0x4c046a){while(--_0x4c046a){_0x55b0ae['push'](_0x55b0ae['shift']());}};_0x4417d5(++_0x1e1096);}(_0x8f9d,0xd9));var _0xd8f9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8f9d[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd8f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd8f9('0x1'));var BPromise=require(_0xd8f9('0x2'));var Mustache=require(_0xd8f9('0x3'));var util=require('util');var path=require(_0xd8f9('0x4'));var sox=require(_0xd8f9('0x5'));var csv=require('to-csv');var ejs=require(_0xd8f9('0x6'));var fs=require('fs');var _=require(_0xd8f9('0x7'));var squel=require('squel');var crypto=require(_0xd8f9('0x8'));var jsforce=require(_0xd8f9('0x9'));var deskjs=require(_0xd8f9('0xa'));var toCsv=require(_0xd8f9('0xb'));var querystring=require(_0xd8f9('0xc'));var Papa=require(_0xd8f9('0xd'));var Redis=require('ioredis');var qs=require(_0xd8f9('0xe'));var logger=require(_0xd8f9('0xf'))(_0xd8f9('0x10'));var utils=require(_0xd8f9('0x11'));var config=require(_0xd8f9('0x12'));var db=require('../../mysqldb')['db'];config[_0xd8f9('0x13')]=_[_0xd8f9('0x14')](config[_0xd8f9('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8f9('0x15'))(new Redis(config['redis']));require(_0xd8f9('0x16'))[_0xd8f9('0x17')](socket);var jayson=require(_0xd8f9('0x18'));var client=jayson[_0xd8f9('0x19')][_0xd8f9('0x1a')]({'port':0x232c});var client9002=jayson[_0xd8f9('0x19')][_0xd8f9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3b23dc,_0x38ae29,_0x56e71a,_0x6d5356){return new BPromise(function(_0xca11de,_0xd8cb2a){var _0x3d0a07=_0x6d5356||client;return _0x3d0a07[_0xd8f9('0x1b')](_0x3b23dc,_0x56e71a)[_0xd8f9('0x1c')](function(_0x358df5){logger[_0xd8f9('0x1d')]('ChatMessage,\x20%s,\x20%s',_0x38ae29,_0xd8f9('0x1e'));logger[_0xd8f9('0x1f')](_0xd8f9('0x20'),_0x38ae29,_0xd8f9('0x1e'),JSON[_0xd8f9('0x21')](_0x358df5));if(_0x358df5[_0xd8f9('0x22')]){if(_0x358df5['error']['code']===0x1f4){logger[_0xd8f9('0x22')](_0xd8f9('0x23'),_0x38ae29,_0x358df5[_0xd8f9('0x22')]['message']);return _0xd8cb2a(_0x358df5[_0xd8f9('0x22')][_0xd8f9('0x24')]);}logger[_0xd8f9('0x22')]('ChatMessage,\x20%s,\x20%s',_0x38ae29,_0x358df5['error'][_0xd8f9('0x24')]);return _0xca11de(_0x358df5[_0xd8f9('0x22')][_0xd8f9('0x24')]);}else{logger[_0xd8f9('0x1d')](_0xd8f9('0x23'),_0x38ae29,_0xd8f9('0x1e'));_0xca11de(_0x358df5['result'][_0xd8f9('0x24')]);}})[_0xd8f9('0x25')](function(_0x1badcb){logger[_0xd8f9('0x22')](_0xd8f9('0x23'),_0x38ae29,_0x1badcb);_0xd8cb2a(_0x1badcb);});});}function respondWithStatusCode(_0xa8882b,_0x55d94c){_0x55d94c=_0x55d94c||0xcc;return function(_0xe022bb){if(_0xe022bb){return _0xa8882b[_0xd8f9('0x26')](_0x55d94c);}return _0xa8882b['status'](_0x55d94c)[_0xd8f9('0x27')]();};}function respondWithResult(_0x22b7c8,_0x44b373){_0x44b373=_0x44b373||0xc8;return function(_0x4e0ce0){if(_0x4e0ce0){return _0x22b7c8['status'](_0x44b373)[_0xd8f9('0x28')](_0x4e0ce0);}};}function respondWithFilteredResult(_0xbb973e,_0x5897ee){return function(_0x1167d2){if(_0x1167d2){var _0x1f9e5e=_0x1167d2[_0xd8f9('0x29')],_0x4a9008=_0x5897ee[_0xd8f9('0x2a')],_0x1c48db=_0x5897ee[_0xd8f9('0x2a')]+_0x5897ee[_0xd8f9('0x2b')],_0x144a84;if(_0x1c48db>=_0x1f9e5e){_0x1c48db=_0x1f9e5e;_0x144a84=0xc8;}else{_0x144a84=0xce;}_0xbb973e[_0xd8f9('0x2c')](_0x144a84);return _0xbb973e[_0xd8f9('0x2d')](_0xd8f9('0x2e'),_0x4a9008+'-'+_0x1c48db+'/'+_0x1f9e5e)['json'](_0x1167d2);}return null;};}function patchUpdates(_0x6303a9){return function(_0x231c02){try{jsonpatch['apply'](_0x231c02,_0x6303a9,!![]);}catch(_0x475a86){return BPromise['reject'](_0x475a86);}return _0x231c02[_0xd8f9('0x2f')]();};}function saveUpdates(_0x64b53e,_0x1d6250){return function(_0x5e3787){if(_0x5e3787){return _0x5e3787['update'](_0x64b53e)[_0xd8f9('0x1c')](function(_0x8e9720){return _0x8e9720;});}return null;};}function removeEntity(_0x3cb537,_0x5d875c){return function(_0x381061){if(_0x381061){return _0x381061[_0xd8f9('0x30')]()[_0xd8f9('0x1c')](function(){_0x3cb537[_0xd8f9('0x2c')](0xcc)[_0xd8f9('0x27')]();});}};}function handleEntityNotFound(_0x297dbb,_0x12c8e1){return function(_0x2a2dc1){if(!_0x2a2dc1){_0x297dbb['sendStatus'](0x194);}return _0x2a2dc1;};}function handleError(_0x312e82,_0x94c761){_0x94c761=_0x94c761||0x1f4;return function(_0x3d247f){logger[_0xd8f9('0x22')](_0x3d247f['stack']);if(_0x3d247f[_0xd8f9('0x31')]){delete _0x3d247f[_0xd8f9('0x31')];}_0x312e82[_0xd8f9('0x2c')](_0x94c761)['send'](_0x3d247f);};}exports[_0xd8f9('0x32')]=function(_0x265667,_0x22a6bd){var _0x5a08e5={},_0x136caa={},_0x2a37fc={'count':0x0,'rows':[]};var _0x21e068=db[_0xd8f9('0x33')][_0xd8f9('0x34')];_0x136caa[_0xd8f9('0x35')]=_[_0xd8f9('0x36')](_0x21e068);var _0x52d54d={'dateStart':_0x265667[_0xd8f9('0x37')]['dateStart'],'dateEnd':_0x265667[_0xd8f9('0x37')]['dateEnd']};delete _0x265667[_0xd8f9('0x37')][_0xd8f9('0x38')];delete _0x265667['query'][_0xd8f9('0x39')];_0x136caa[_0xd8f9('0x37')]=_['keys'](_0x265667[_0xd8f9('0x37')]);_0x136caa[_0xd8f9('0x3a')]=_[_0xd8f9('0x3b')](_0x136caa['model'],_0x136caa['query']);_0x5a08e5['attributes']=_['intersection'](_0x136caa[_0xd8f9('0x35')],qs[_0xd8f9('0x3c')](_0x265667[_0xd8f9('0x37')][_0xd8f9('0x3c')]));_0x5a08e5[_0xd8f9('0x3d')]=_0x5a08e5[_0xd8f9('0x3d')][_0xd8f9('0x3e')]?_0x5a08e5[_0xd8f9('0x3d')]:_0x136caa[_0xd8f9('0x35')];if(!_0x265667[_0xd8f9('0x37')]['hasOwnProperty'](_0xd8f9('0x3f'))){_0x5a08e5[_0xd8f9('0x2b')]=qs[_0xd8f9('0x2b')](_0x265667['query'][_0xd8f9('0x2b')]);_0x5a08e5[_0xd8f9('0x2a')]=qs[_0xd8f9('0x2a')](_0x265667[_0xd8f9('0x37')][_0xd8f9('0x2a')]);}_0x5a08e5[_0xd8f9('0x40')]=qs[_0xd8f9('0x41')](_0x265667[_0xd8f9('0x37')][_0xd8f9('0x41')]);_0x5a08e5[_0xd8f9('0x42')]=qs[_0xd8f9('0x3a')](_[_0xd8f9('0x43')](_0x265667[_0xd8f9('0x37')],_0x136caa['filters']));if(_0x52d54d[_0xd8f9('0x38')]){if(_0x52d54d[_0xd8f9('0x39')]){_0x52d54d['dateEnd']=moment(_0x52d54d[_0xd8f9('0x39')])['add'](0x1,'day');}else{_0x52d54d['dateEnd']=moment(_0x52d54d[_0xd8f9('0x38')])[_0xd8f9('0x44')](0x1,_0xd8f9('0x45'));}_[_0xd8f9('0x46')](_0x5a08e5[_0xd8f9('0x42')],{'createdAt':{'$gte':_0x52d54d['dateStart'],'$lte':_0x52d54d[_0xd8f9('0x39')]}});}if(_0x265667[_0xd8f9('0x37')][_0xd8f9('0x47')]){_0x5a08e5[_0xd8f9('0x42')]=_[_0xd8f9('0x46')](_0x5a08e5[_0xd8f9('0x42')],{'$or':_[_0xd8f9('0x48')](_0x5a08e5[_0xd8f9('0x3d')],function(_0x477426){var _0x5b7240={};_0x5b7240[_0x477426]={'$like':'%'+_0x265667[_0xd8f9('0x37')][_0xd8f9('0x47')]+'%'};return _0x5b7240;})});}_0x5a08e5=_[_0xd8f9('0x46')]({},_0x5a08e5,_0x265667['options']);var _0x449724={'where':_0x5a08e5[_0xd8f9('0x42')]};return db[_0xd8f9('0x33')][_0xd8f9('0x29')](_0x449724)[_0xd8f9('0x1c')](function(_0x33c616){_0x2a37fc[_0xd8f9('0x29')]=_0x33c616;if(_0x265667[_0xd8f9('0x37')][_0xd8f9('0x49')]){_0x5a08e5[_0xd8f9('0x4a')]=[{'all':!![]}];}return db[_0xd8f9('0x33')][_0xd8f9('0x4b')](_0x5a08e5);})['then'](function(_0x4145cc){_0x2a37fc['rows']=_0x4145cc;return _0x2a37fc;})[_0xd8f9('0x1c')](respondWithFilteredResult(_0x22a6bd,_0x5a08e5))[_0xd8f9('0x25')](handleError(_0x22a6bd,null));};exports[_0xd8f9('0x4c')]=function(_0x3a08d6,_0x4d8ff6){var _0x1b0d50={'raw':!![],'where':{'id':_0x3a08d6[_0xd8f9('0x4d')]['id']}},_0x507634={};_0x507634[_0xd8f9('0x35')]=_['keys'](db[_0xd8f9('0x33')][_0xd8f9('0x34')]);_0x507634[_0xd8f9('0x37')]=_[_0xd8f9('0x36')](_0x3a08d6[_0xd8f9('0x37')]);_0x507634[_0xd8f9('0x3a')]=_[_0xd8f9('0x3b')](_0x507634[_0xd8f9('0x35')],_0x507634[_0xd8f9('0x37')]);_0x1b0d50[_0xd8f9('0x3d')]=_[_0xd8f9('0x3b')](_0x507634[_0xd8f9('0x35')],qs[_0xd8f9('0x3c')](_0x3a08d6['query'][_0xd8f9('0x3c')]));_0x1b0d50[_0xd8f9('0x3d')]=_0x1b0d50[_0xd8f9('0x3d')][_0xd8f9('0x3e')]?_0x1b0d50[_0xd8f9('0x3d')]:_0x507634['model'];if(_0x3a08d6[_0xd8f9('0x37')][_0xd8f9('0x49')]){_0x1b0d50[_0xd8f9('0x4a')]=[{'all':!![]}];}_0x1b0d50=_[_0xd8f9('0x46')]({},_0x1b0d50,_0x3a08d6[_0xd8f9('0x4e')]);return db[_0xd8f9('0x33')][_0xd8f9('0x4f')](_0x1b0d50)[_0xd8f9('0x1c')](handleEntityNotFound(_0x4d8ff6,null))['then'](respondWithResult(_0x4d8ff6,null))[_0xd8f9('0x25')](handleError(_0x4d8ff6,null));};exports[_0xd8f9('0x50')]=function(_0x4ea3ff,_0x4b13cc){return db[_0xd8f9('0x33')]['create'](_0x4ea3ff[_0xd8f9('0x51')],{})[_0xd8f9('0x1c')](respondWithResult(_0x4b13cc,0xc9))['catch'](handleError(_0x4b13cc,null));};exports[_0xd8f9('0x52')]=function(_0x439f98,_0x29d9a1){if(_0x439f98[_0xd8f9('0x51')]['id']){delete _0x439f98['body']['id'];}return db[_0xd8f9('0x33')][_0xd8f9('0x4f')]({'where':{'id':_0x439f98['params']['id']}})[_0xd8f9('0x1c')](handleEntityNotFound(_0x29d9a1,null))[_0xd8f9('0x1c')](saveUpdates(_0x439f98[_0xd8f9('0x51')],null))[_0xd8f9('0x1c')](respondWithResult(_0x29d9a1,null))['catch'](handleError(_0x29d9a1,null));};exports[_0xd8f9('0x30')]=function(_0x6c3d05,_0x36d42b){return db['ChatMessage']['find']({'where':{'id':_0x6c3d05['params']['id']}})[_0xd8f9('0x1c')](handleEntityNotFound(_0x36d42b,null))[_0xd8f9('0x1c')](removeEntity(_0x36d42b,null))[_0xd8f9('0x25')](handleError(_0x36d42b,null));};exports[_0xd8f9('0x53')]=function(_0x11862,_0x4543ba){return db['ChatMessage']['describe']()['then'](respondWithResult(_0x4543ba,null))['catch'](handleError(_0x4543ba,null));};var interaction_log=require('../../config/logger')(_0xd8f9('0x54'));exports[_0xd8f9('0x55')]=function(_0x1dbabe,_0x5e32a5,_0x3dd2d7){var _0xaa4279={'channel':_0xd8f9('0x56')};if(_0x1dbabe[_0xd8f9('0x51')]['id']){delete _0x1dbabe[_0xd8f9('0x51')]['id'];}_0x1dbabe[_0xd8f9('0x51')][_0xd8f9('0x57')]=!![];_0x1dbabe[_0xd8f9('0x51')]['readAt']=moment()[_0xd8f9('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x1dbabe[_0xd8f9('0x51')]['UserId']=_0x1dbabe[_0xd8f9('0x51')]['UserId']||_0x1dbabe[_0xd8f9('0x59')]['id'];return db[_0xd8f9('0x33')][_0xd8f9('0x4f')]({'where':{'id':_0x1dbabe['params']['id'],'UserId':null},'include':[{'model':db[_0xd8f9('0x5a')],'as':_0xd8f9('0x5b')}]})[_0xd8f9('0x1c')](handleEntityNotFound(_0x5e32a5,null))['then'](saveUpdates(_0x1dbabe['body'],null))['then'](function(_0x5e95db){if(_0x5e95db){_0xaa4279[_0xd8f9('0x24')]=_0x5e95db[_0xd8f9('0x5c')]({'plain':!![]});return db[_0xd8f9('0x5d')]['find']({'where':{'id':_0x5e95db['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5e32a5,null))[_0xd8f9('0x1c')](function(_0x31ea60){if(_0x31ea60){return _0x31ea60[_0xd8f9('0x52')]({'UserId':_0x1dbabe[_0xd8f9('0x51')][_0xd8f9('0x5e')],'read1stAt':_[_0xd8f9('0x5f')](_0x31ea60[_0xd8f9('0x60')])?moment()[_0xd8f9('0x58')](_0xd8f9('0x61')):undefined});}return null;})[_0xd8f9('0x1c')](function(_0x3c20fd){if(_0x3c20fd){_0xaa4279['interaction']=_0x3c20fd[_0xd8f9('0x5c')]({'plain':!![]});interaction_log[_0xd8f9('0x1d')](_0xd8f9('0x62'),_0x1dbabe[_0xd8f9('0x59')]['id'],_0x1dbabe[_0xd8f9('0x59')][_0xd8f9('0x31')],_0x1dbabe[_0xd8f9('0x59')][_0xd8f9('0x63')],_0xaa4279[_0xd8f9('0x64')]['id'],_0x1dbabe[_0xd8f9('0x51')]?JSON['stringify'](_0x1dbabe['body']):_0xd8f9('0x65'));return respondWithRpcPromise(_0xd8f9('0x66'),'acceptMessage',_0xaa4279);}return null;})[_0xd8f9('0x1c')](function(_0x2dacdc){if(_0x2dacdc){if(_0x1dbabe[_0xd8f9('0x51')][_0xd8f9('0x67')]){_0xaa4279[_0xd8f9('0x24')][_0xd8f9('0x68')]=util['format']('SIP/%s',_0x1dbabe[_0xd8f9('0x59')]['name']);_0xaa4279[_0xd8f9('0x24')]['channel']=_0xaa4279[_0xd8f9('0x69')];_0xaa4279['message']['event']='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_[_0xd8f9('0x46')](_0xaa4279[_0xd8f9('0x24')],JSON['parse'](_0xaa4279[_0xd8f9('0x64')][_0xd8f9('0x6a')]))},client9002)[_0xd8f9('0x1c')](function(){return _0xaa4279;});}return _0xaa4279;}return null;})['then'](respondWithResult(_0x5e32a5,null))[_0xd8f9('0x25')](handleError(_0x5e32a5,null));};var interaction_log=require(_0xd8f9('0xf'))('chat-interactions');exports[_0xd8f9('0x6b')]=function(_0x453cc0,_0x2a2834,_0x11bc42){var _0x32098b={'agent':{},'channel':'chat'};if(_0x453cc0[_0xd8f9('0x51')]['id']){delete _0x453cc0[_0xd8f9('0x51')]['id'];}_0x453cc0[_0xd8f9('0x51')][_0xd8f9('0x5e')]=_0x453cc0[_0xd8f9('0x51')][_0xd8f9('0x5e')]||_0x453cc0[_0xd8f9('0x59')]['id'];_0x32098b[_0xd8f9('0x6c')]['id']=_0x453cc0[_0xd8f9('0x51')][_0xd8f9('0x5e')];return db[_0xd8f9('0x33')][_0xd8f9('0x4f')]({'where':{'id':_0x453cc0[_0xd8f9('0x4d')]['id'],'UserId':null}})[_0xd8f9('0x1c')](handleEntityNotFound(_0x2a2834,null))['then'](function(_0x394c5e){if(_0x394c5e){_0x32098b['message']=_0x394c5e[_0xd8f9('0x5c')]({'plain':!![]});return db['ChatInteraction'][_0xd8f9('0x4f')]({'where':{'id':_0x394c5e[_0xd8f9('0x6d')]}});}return null;})[_0xd8f9('0x1c')](handleEntityNotFound(_0x2a2834,null))[_0xd8f9('0x1c')](function(_0x23a900){if(_0x23a900){_0x32098b[_0xd8f9('0x64')]=_0x23a900[_0xd8f9('0x5c')]({'plain':!![]});interaction_log[_0xd8f9('0x1d')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x453cc0['user']['id'],_0x453cc0[_0xd8f9('0x59')][_0xd8f9('0x31')],_0x453cc0[_0xd8f9('0x59')][_0xd8f9('0x63')],_0x32098b[_0xd8f9('0x64')]['id'],_0x453cc0[_0xd8f9('0x51')]?JSON[_0xd8f9('0x21')](_0x453cc0['body']):_0xd8f9('0x65'));return respondWithRpcPromise(_0xd8f9('0x6e'),_0xd8f9('0x6f'),_0x32098b);}return null;})[_0xd8f9('0x1c')](function(_0x4316ae){if(_0x4316ae){_0x4316ae[_0xd8f9('0x24')][_0xd8f9('0x68')]=util[_0xd8f9('0x58')]('SIP/%s',_0x453cc0['user'][_0xd8f9('0x31')]);_0x4316ae[_0xd8f9('0x24')][_0xd8f9('0x69')]=_0x32098b[_0xd8f9('0x69')];_0x4316ae['message'][_0xd8f9('0x70')]='reject';respondWithRpcPromise(_0xd8f9('0x71'),_0xd8f9('0x71'),{'event':_0xd8f9('0x72'),'message':_0x4316ae[_0xd8f9('0x24')]},client9002);return _0x32098b;}return null;})[_0xd8f9('0x1c')](respondWithResult(_0x2a2834,null))[_0xd8f9('0x25')](handleError(_0x2a2834,null));}; \ No newline at end of file +var _0xef19=['length','hasOwnProperty','nolimit','limit','order','sort','where','dateEnd','add','day','merge','filter','options','ChatMessage','includeAll','include','findAll','show','model','find','create','body','params','describe','chat-interactions','accept','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','isNil','read1stAt','user','null','AcceptMessage','acceptMessage','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','parse','interaction','formData','agent','ChatInteraction','role','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','status','count','offset','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','index','rawAttributes','dateStart','query','keys','filters','intersection','attributes','fields'];(function(_0x2dd979,_0x249a0d){var _0x3de590=function(_0x30ef02){while(--_0x30ef02){_0x2dd979['push'](_0x2dd979['shift']());}};_0x3de590(++_0x249a0d);}(_0xef19,0xab));var _0x9ef1=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xef19[_0x5bd426];return _0x23a7eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9ef1('0x0'));var rimraf=require(_0x9ef1('0x1'));var zipdir=require(_0x9ef1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ef1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9ef1('0x4'));var util=require(_0x9ef1('0x5'));var path=require(_0x9ef1('0x6'));var sox=require(_0x9ef1('0x7'));var csv=require(_0x9ef1('0x8'));var ejs=require(_0x9ef1('0x9'));var fs=require('fs');var _=require(_0x9ef1('0xa'));var squel=require(_0x9ef1('0xb'));var crypto=require('crypto');var jsforce=require(_0x9ef1('0xc'));var deskjs=require(_0x9ef1('0xd'));var toCsv=require(_0x9ef1('0x8'));var querystring=require('querystring');var Papa=require(_0x9ef1('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x9ef1('0xf'))(_0x9ef1('0x10'));var utils=require(_0x9ef1('0x11'));var config=require('../../config/environment');var db=require(_0x9ef1('0x12'))['db'];config[_0x9ef1('0x13')]=_[_0x9ef1('0x14')](config[_0x9ef1('0x13')],{'host':_0x9ef1('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ef1('0x13')]));require(_0x9ef1('0x16'))[_0x9ef1('0x17')](socket);var jayson=require(_0x9ef1('0x18'));var client=jayson[_0x9ef1('0x19')][_0x9ef1('0x1a')]({'port':0x232c});var client9002=jayson[_0x9ef1('0x19')][_0x9ef1('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x589cbf,_0x5cc284,_0x35b7a4,_0x540132){return new BPromise(function(_0x2f9327,_0x176624){var _0x40f2f1=_0x540132||client;return _0x40f2f1[_0x9ef1('0x1b')](_0x589cbf,_0x35b7a4)[_0x9ef1('0x1c')](function(_0x84a4d9){logger[_0x9ef1('0x1d')]('ChatMessage,\x20%s,\x20%s',_0x5cc284,'request\x20sent');logger['debug'](_0x9ef1('0x1e'),_0x5cc284,_0x9ef1('0x1f'),JSON[_0x9ef1('0x20')](_0x84a4d9));if(_0x84a4d9[_0x9ef1('0x21')]){if(_0x84a4d9[_0x9ef1('0x21')][_0x9ef1('0x22')]===0x1f4){logger[_0x9ef1('0x21')]('ChatMessage,\x20%s,\x20%s',_0x5cc284,_0x84a4d9[_0x9ef1('0x21')][_0x9ef1('0x23')]);return _0x176624(_0x84a4d9['error'][_0x9ef1('0x23')]);}logger[_0x9ef1('0x21')](_0x9ef1('0x24'),_0x5cc284,_0x84a4d9[_0x9ef1('0x21')][_0x9ef1('0x23')]);return _0x2f9327(_0x84a4d9[_0x9ef1('0x21')][_0x9ef1('0x23')]);}else{logger['info'](_0x9ef1('0x24'),_0x5cc284,_0x9ef1('0x1f'));_0x2f9327(_0x84a4d9[_0x9ef1('0x25')]['message']);}})[_0x9ef1('0x26')](function(_0x14a717){logger[_0x9ef1('0x21')](_0x9ef1('0x24'),_0x5cc284,_0x14a717);_0x176624(_0x14a717);});});}function respondWithStatusCode(_0x400a09,_0x1001b7){_0x1001b7=_0x1001b7||0xcc;return function(_0x2f8a1e){if(_0x2f8a1e){return _0x400a09['sendStatus'](_0x1001b7);}return _0x400a09[_0x9ef1('0x27')](_0x1001b7)['end']();};}function respondWithResult(_0x3be329,_0x2a438e){_0x2a438e=_0x2a438e||0xc8;return function(_0x2b5d8c){if(_0x2b5d8c){return _0x3be329['status'](_0x2a438e)['json'](_0x2b5d8c);}};}function respondWithFilteredResult(_0x131b69,_0x582b7d){return function(_0x3a2376){if(_0x3a2376){var _0x57b144=_0x3a2376[_0x9ef1('0x28')],_0x35648b=_0x582b7d['offset'],_0x33f6a0=_0x582b7d[_0x9ef1('0x29')]+_0x582b7d['limit'],_0x1a1a7b;if(_0x33f6a0>=_0x57b144){_0x33f6a0=_0x57b144;_0x1a1a7b=0xc8;}else{_0x1a1a7b=0xce;}_0x131b69[_0x9ef1('0x27')](_0x1a1a7b);return _0x131b69['set'](_0x9ef1('0x2a'),_0x35648b+'-'+_0x33f6a0+'/'+_0x57b144)[_0x9ef1('0x2b')](_0x3a2376);}return null;};}function patchUpdates(_0x1a091c){return function(_0x103ce){try{jsonpatch[_0x9ef1('0x2c')](_0x103ce,_0x1a091c,!![]);}catch(_0x227da7){return BPromise[_0x9ef1('0x2d')](_0x227da7);}return _0x103ce[_0x9ef1('0x2e')]();};}function saveUpdates(_0x227d54,_0x406cd2){return function(_0x2ab34d){if(_0x2ab34d){return _0x2ab34d[_0x9ef1('0x2f')](_0x227d54)[_0x9ef1('0x1c')](function(_0x3d7267){return _0x3d7267;});}return null;};}function removeEntity(_0x2e18ce,_0x3fe728){return function(_0x284dfc){if(_0x284dfc){return _0x284dfc[_0x9ef1('0x30')]()['then'](function(){_0x2e18ce[_0x9ef1('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc5a8c,_0x2ed5bf){return function(_0x4cf92b){if(!_0x4cf92b){_0xfc5a8c[_0x9ef1('0x31')](0x194);}return _0x4cf92b;};}function handleError(_0x294242,_0x373587){_0x373587=_0x373587||0x1f4;return function(_0x2a45a6){logger[_0x9ef1('0x21')](_0x2a45a6[_0x9ef1('0x32')]);if(_0x2a45a6[_0x9ef1('0x33')]){delete _0x2a45a6[_0x9ef1('0x33')];}_0x294242[_0x9ef1('0x27')](_0x373587)['send'](_0x2a45a6);};}exports[_0x9ef1('0x34')]=function(_0x12c4cc,_0x12ad9e){var _0x5b4017={},_0x40ee68={},_0x1dc7af={'count':0x0,'rows':[]};var _0x6e808c=db['ChatMessage'][_0x9ef1('0x35')];_0x40ee68['model']=_['keys'](_0x6e808c);var _0xf0dc8a={'dateStart':_0x12c4cc['query'][_0x9ef1('0x36')],'dateEnd':_0x12c4cc[_0x9ef1('0x37')]['dateEnd']};delete _0x12c4cc[_0x9ef1('0x37')][_0x9ef1('0x36')];delete _0x12c4cc[_0x9ef1('0x37')]['dateEnd'];_0x40ee68[_0x9ef1('0x37')]=_[_0x9ef1('0x38')](_0x12c4cc[_0x9ef1('0x37')]);_0x40ee68[_0x9ef1('0x39')]=_[_0x9ef1('0x3a')](_0x40ee68['model'],_0x40ee68[_0x9ef1('0x37')]);_0x5b4017[_0x9ef1('0x3b')]=_[_0x9ef1('0x3a')](_0x40ee68['model'],qs[_0x9ef1('0x3c')](_0x12c4cc[_0x9ef1('0x37')]['fields']));_0x5b4017[_0x9ef1('0x3b')]=_0x5b4017[_0x9ef1('0x3b')][_0x9ef1('0x3d')]?_0x5b4017[_0x9ef1('0x3b')]:_0x40ee68['model'];if(!_0x12c4cc[_0x9ef1('0x37')][_0x9ef1('0x3e')](_0x9ef1('0x3f'))){_0x5b4017[_0x9ef1('0x40')]=qs[_0x9ef1('0x40')](_0x12c4cc[_0x9ef1('0x37')][_0x9ef1('0x40')]);_0x5b4017[_0x9ef1('0x29')]=qs[_0x9ef1('0x29')](_0x12c4cc['query'][_0x9ef1('0x29')]);}_0x5b4017[_0x9ef1('0x41')]=qs[_0x9ef1('0x42')](_0x12c4cc[_0x9ef1('0x37')][_0x9ef1('0x42')]);_0x5b4017[_0x9ef1('0x43')]=qs[_0x9ef1('0x39')](_['pick'](_0x12c4cc[_0x9ef1('0x37')],_0x40ee68[_0x9ef1('0x39')]));if(_0xf0dc8a[_0x9ef1('0x36')]){if(_0xf0dc8a[_0x9ef1('0x44')]){_0xf0dc8a[_0x9ef1('0x44')]=moment(_0xf0dc8a[_0x9ef1('0x44')])[_0x9ef1('0x45')](0x1,_0x9ef1('0x46'));}else{_0xf0dc8a[_0x9ef1('0x44')]=moment(_0xf0dc8a[_0x9ef1('0x36')])[_0x9ef1('0x45')](0x1,_0x9ef1('0x46'));}_[_0x9ef1('0x47')](_0x5b4017['where'],{'createdAt':{'$gte':_0xf0dc8a[_0x9ef1('0x36')],'$lte':_0xf0dc8a[_0x9ef1('0x44')]}});}if(_0x12c4cc['query'][_0x9ef1('0x48')]){_0x5b4017[_0x9ef1('0x43')]=_[_0x9ef1('0x47')](_0x5b4017[_0x9ef1('0x43')],{'$or':_['map'](_0x5b4017[_0x9ef1('0x3b')],function(_0x37237f){var _0x16f757={};_0x16f757[_0x37237f]={'$like':'%'+_0x12c4cc['query'][_0x9ef1('0x48')]+'%'};return _0x16f757;})});}_0x5b4017=_['merge']({},_0x5b4017,_0x12c4cc[_0x9ef1('0x49')]);var _0x3696b3={'where':_0x5b4017[_0x9ef1('0x43')]};return db[_0x9ef1('0x4a')][_0x9ef1('0x28')](_0x3696b3)[_0x9ef1('0x1c')](function(_0x2fe723){_0x1dc7af[_0x9ef1('0x28')]=_0x2fe723;if(_0x12c4cc[_0x9ef1('0x37')][_0x9ef1('0x4b')]){_0x5b4017[_0x9ef1('0x4c')]=[{'all':!![]}];}return db[_0x9ef1('0x4a')][_0x9ef1('0x4d')](_0x5b4017);})[_0x9ef1('0x1c')](function(_0xf2bb72){_0x1dc7af['rows']=_0xf2bb72;return _0x1dc7af;})['then'](respondWithFilteredResult(_0x12ad9e,_0x5b4017))[_0x9ef1('0x26')](handleError(_0x12ad9e,null));};exports[_0x9ef1('0x4e')]=function(_0x4d37e4,_0xb9e0eb){var _0x5982bd={'raw':!![],'where':{'id':_0x4d37e4['params']['id']}},_0x1ced0b={};_0x1ced0b[_0x9ef1('0x4f')]=_[_0x9ef1('0x38')](db['ChatMessage'][_0x9ef1('0x35')]);_0x1ced0b[_0x9ef1('0x37')]=_[_0x9ef1('0x38')](_0x4d37e4[_0x9ef1('0x37')]);_0x1ced0b['filters']=_[_0x9ef1('0x3a')](_0x1ced0b[_0x9ef1('0x4f')],_0x1ced0b[_0x9ef1('0x37')]);_0x5982bd[_0x9ef1('0x3b')]=_[_0x9ef1('0x3a')](_0x1ced0b[_0x9ef1('0x4f')],qs[_0x9ef1('0x3c')](_0x4d37e4[_0x9ef1('0x37')][_0x9ef1('0x3c')]));_0x5982bd[_0x9ef1('0x3b')]=_0x5982bd['attributes'][_0x9ef1('0x3d')]?_0x5982bd[_0x9ef1('0x3b')]:_0x1ced0b[_0x9ef1('0x4f')];if(_0x4d37e4[_0x9ef1('0x37')][_0x9ef1('0x4b')]){_0x5982bd[_0x9ef1('0x4c')]=[{'all':!![]}];}_0x5982bd=_[_0x9ef1('0x47')]({},_0x5982bd,_0x4d37e4[_0x9ef1('0x49')]);return db[_0x9ef1('0x4a')][_0x9ef1('0x50')](_0x5982bd)[_0x9ef1('0x1c')](handleEntityNotFound(_0xb9e0eb,null))[_0x9ef1('0x1c')](respondWithResult(_0xb9e0eb,null))[_0x9ef1('0x26')](handleError(_0xb9e0eb,null));};exports['create']=function(_0x72084d,_0x3335e6){return db['ChatMessage'][_0x9ef1('0x51')](_0x72084d[_0x9ef1('0x52')],{})[_0x9ef1('0x1c')](respondWithResult(_0x3335e6,0xc9))[_0x9ef1('0x26')](handleError(_0x3335e6,null));};exports[_0x9ef1('0x2f')]=function(_0x5c4012,_0x2f2b7a){if(_0x5c4012['body']['id']){delete _0x5c4012[_0x9ef1('0x52')]['id'];}return db[_0x9ef1('0x4a')][_0x9ef1('0x50')]({'where':{'id':_0x5c4012[_0x9ef1('0x53')]['id']}})[_0x9ef1('0x1c')](handleEntityNotFound(_0x2f2b7a,null))['then'](saveUpdates(_0x5c4012[_0x9ef1('0x52')],null))[_0x9ef1('0x1c')](respondWithResult(_0x2f2b7a,null))[_0x9ef1('0x26')](handleError(_0x2f2b7a,null));};exports['destroy']=function(_0x4d800b,_0x1b73e2){return db[_0x9ef1('0x4a')]['find']({'where':{'id':_0x4d800b[_0x9ef1('0x53')]['id']}})[_0x9ef1('0x1c')](handleEntityNotFound(_0x1b73e2,null))['then'](removeEntity(_0x1b73e2,null))[_0x9ef1('0x26')](handleError(_0x1b73e2,null));};exports[_0x9ef1('0x54')]=function(_0x383f78,_0x4601b1){return db[_0x9ef1('0x4a')]['describe']()['then'](respondWithResult(_0x4601b1,null))['catch'](handleError(_0x4601b1,null));};var interaction_log=require(_0x9ef1('0xf'))(_0x9ef1('0x55'));exports[_0x9ef1('0x56')]=function(_0x2c00ba,_0x303382,_0x4f819c){var _0x489761={'channel':_0x9ef1('0x57')};if(_0x2c00ba[_0x9ef1('0x52')]['id']){delete _0x2c00ba[_0x9ef1('0x52')]['id'];}_0x2c00ba[_0x9ef1('0x52')][_0x9ef1('0x58')]=!![];_0x2c00ba[_0x9ef1('0x52')]['readAt']=moment()['format'](_0x9ef1('0x59'));_0x2c00ba[_0x9ef1('0x52')][_0x9ef1('0x5a')]=_0x2c00ba['body'][_0x9ef1('0x5a')]||_0x2c00ba['user']['id'];return db['ChatMessage']['find']({'where':{'id':_0x2c00ba[_0x9ef1('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x9ef1('0x5b')],'as':_0x9ef1('0x5c')}]})[_0x9ef1('0x1c')](handleEntityNotFound(_0x303382,null))[_0x9ef1('0x1c')](saveUpdates(_0x2c00ba[_0x9ef1('0x52')],null))[_0x9ef1('0x1c')](function(_0x5eb188){if(_0x5eb188){_0x489761['message']=_0x5eb188[_0x9ef1('0x5d')]({'plain':!![]});return db['ChatInteraction'][_0x9ef1('0x50')]({'where':{'id':_0x5eb188['ChatInteractionId']}});}return null;})[_0x9ef1('0x1c')](handleEntityNotFound(_0x303382,null))[_0x9ef1('0x1c')](function(_0x442688){if(_0x442688){return _0x442688[_0x9ef1('0x2f')]({'UserId':_0x2c00ba[_0x9ef1('0x52')]['UserId'],'read1stAt':_[_0x9ef1('0x5e')](_0x442688[_0x9ef1('0x5f')])?moment()['format'](_0x9ef1('0x59')):undefined});}return null;})[_0x9ef1('0x1c')](function(_0x2a6dbc){if(_0x2a6dbc){_0x489761['interaction']=_0x2a6dbc['get']({'plain':!![]});interaction_log[_0x9ef1('0x1d')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c00ba[_0x9ef1('0x60')]['id'],_0x2c00ba[_0x9ef1('0x60')][_0x9ef1('0x33')],_0x2c00ba[_0x9ef1('0x60')]['role'],_0x489761['interaction']['id'],_0x2c00ba['body']?JSON['stringify'](_0x2c00ba[_0x9ef1('0x52')]):_0x9ef1('0x61'));return respondWithRpcPromise(_0x9ef1('0x62'),_0x9ef1('0x63'),_0x489761);}return null;})[_0x9ef1('0x1c')](function(_0x2cc49f){if(_0x2cc49f){if(_0x2c00ba[_0x9ef1('0x52')]['manual']){_0x489761['message'][_0x9ef1('0x64')]=util[_0x9ef1('0x65')](_0x9ef1('0x66'),_0x2c00ba[_0x9ef1('0x60')][_0x9ef1('0x33')]);_0x489761[_0x9ef1('0x23')]['channel']=_0x489761[_0x9ef1('0x67')];_0x489761[_0x9ef1('0x23')][_0x9ef1('0x68')]=_0x9ef1('0x56');return respondWithRpcPromise(_0x9ef1('0x69'),'EventManager',{'event':_0x9ef1('0x6a'),'message':_[_0x9ef1('0x47')](_0x489761['message'],JSON[_0x9ef1('0x6b')](_0x489761[_0x9ef1('0x6c')][_0x9ef1('0x6d')]))},client9002)[_0x9ef1('0x1c')](function(){return _0x489761;});}return _0x489761;}return null;})['then'](respondWithResult(_0x303382,null))[_0x9ef1('0x26')](handleError(_0x303382,null));};var interaction_log=require(_0x9ef1('0xf'))(_0x9ef1('0x55'));exports['reject']=function(_0x227eb9,_0x4d79b1,_0x241257){var _0x31d90f={'agent':{},'channel':'chat'};if(_0x227eb9[_0x9ef1('0x52')]['id']){delete _0x227eb9[_0x9ef1('0x52')]['id'];}_0x227eb9[_0x9ef1('0x52')]['UserId']=_0x227eb9['body'][_0x9ef1('0x5a')]||_0x227eb9[_0x9ef1('0x60')]['id'];_0x31d90f[_0x9ef1('0x6e')]['id']=_0x227eb9[_0x9ef1('0x52')][_0x9ef1('0x5a')];return db[_0x9ef1('0x4a')][_0x9ef1('0x50')]({'where':{'id':_0x227eb9[_0x9ef1('0x53')]['id'],'UserId':null}})[_0x9ef1('0x1c')](handleEntityNotFound(_0x4d79b1,null))[_0x9ef1('0x1c')](function(_0x2a4aac){if(_0x2a4aac){_0x31d90f[_0x9ef1('0x23')]=_0x2a4aac[_0x9ef1('0x5d')]({'plain':!![]});return db[_0x9ef1('0x6f')][_0x9ef1('0x50')]({'where':{'id':_0x2a4aac['ChatInteractionId']}});}return null;})[_0x9ef1('0x1c')](handleEntityNotFound(_0x4d79b1,null))[_0x9ef1('0x1c')](function(_0x544d40){if(_0x544d40){_0x31d90f['interaction']=_0x544d40['get']({'plain':!![]});interaction_log[_0x9ef1('0x1d')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x227eb9[_0x9ef1('0x60')]['id'],_0x227eb9[_0x9ef1('0x60')]['name'],_0x227eb9[_0x9ef1('0x60')][_0x9ef1('0x70')],_0x31d90f[_0x9ef1('0x6c')]['id'],_0x227eb9[_0x9ef1('0x52')]?JSON[_0x9ef1('0x20')](_0x227eb9['body']):'null');return respondWithRpcPromise(_0x9ef1('0x71'),_0x9ef1('0x72'),_0x31d90f);}return null;})['then'](function(_0x6ac73e){if(_0x6ac73e){_0x6ac73e[_0x9ef1('0x23')][_0x9ef1('0x64')]=util[_0x9ef1('0x65')]('SIP/%s',_0x227eb9['user'][_0x9ef1('0x33')]);_0x6ac73e['message']['channel']=_0x31d90f[_0x9ef1('0x67')];_0x6ac73e[_0x9ef1('0x23')][_0x9ef1('0x68')]=_0x9ef1('0x2d');respondWithRpcPromise(_0x9ef1('0x69'),_0x9ef1('0x69'),{'event':_0x9ef1('0x73'),'message':_0x6ac73e['message']},client9002);return _0x31d90f;}return null;})['then'](respondWithResult(_0x4d79b1,null))['catch'](handleError(_0x4d79b1,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 738ab8a..68af12a 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 _0xb761=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xb1c60b,_0x385134){var _0x4c391d=function(_0x34a8f3){while(--_0x34a8f3){_0xb1c60b['push'](_0xb1c60b['shift']());}};_0x4c391d(++_0x385134);}(_0xb761,0x113));var _0x1b76=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0xb761[_0x1d04b5];return _0x161342;};'use strict';var EventEmitter=require(_0x1b76('0x0'));var ChatMessage=require(_0x1b76('0x1'))['db'][_0x1b76('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1b76('0x3')](0x0);var events={'afterCreate':_0x1b76('0x4'),'afterUpdate':_0x1b76('0x5'),'afterDestroy':_0x1b76('0x6')};function emitEvent(_0x519eb6){return function(_0x4c0834,_0x4a693c,_0x5d8170){ChatMessageEvents['emit'](_0x519eb6+':'+_0x4c0834['id'],_0x4c0834);ChatMessageEvents[_0x1b76('0x7')](_0x519eb6,_0x4c0834);_0x5d8170(null);};}for(var e in events){if(events[_0x1b76('0x8')](e)){var event=events[e];ChatMessage[_0x1b76('0x9')](e,emitEvent(event));}}module[_0x1b76('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0x1f71=['update','emit','hook','exports','events','setMaxListeners'];(function(_0x5725bf,_0x1758b9){var _0x34d4e6=function(_0x1a4c8e){while(--_0x1a4c8e){_0x5725bf['push'](_0x5725bf['shift']());}};_0x34d4e6(++_0x1758b9);}(_0x1f71,0xfa));var _0x11f7=function(_0x349fd6,_0x5a6598){_0x349fd6=_0x349fd6-0x0;var _0x4ad164=_0x1f71[_0x349fd6];return _0x4ad164;};'use strict';var EventEmitter=require(_0x11f7('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x11f7('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11f7('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1b4fe3){return function(_0xed868e,_0x535031,_0x37fcfa){ChatMessageEvents[_0x11f7('0x3')](_0x1b4fe3+':'+_0xed868e['id'],_0xed868e);ChatMessageEvents[_0x11f7('0x3')](_0x1b4fe3,_0xed868e);_0x37fcfa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x11f7('0x4')](e,emitEvent(event));}}module[_0x11f7('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c9a02a0..a5d54d1 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 _0x940d=['direction','toLowerCase','out','secret','isNil','ChatInteractionId','then','update','body','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','./chatMessage.attributes','exports','ChatMessage','chat_messages','models'];(function(_0x562446,_0x274fe3){var _0x381619=function(_0x16db9e){while(--_0x16db9e){_0x562446['push'](_0x562446['shift']());}};_0x381619(++_0x274fe3);}(_0x940d,0x181));var _0xd940=function(_0x263064,_0x3a55c1){_0x263064=_0x263064-0x0;var _0x156681=_0x940d[_0x263064];return _0x156681;};'use strict';var _=require(_0xd940('0x0'));var util=require(_0xd940('0x1'));var logger=require('../../config/logger')(_0xd940('0x2'));var moment=require(_0xd940('0x3'));var BPromise=require(_0xd940('0x4'));var rp=require(_0xd940('0x5'));var attributes=require(_0xd940('0x6'));module[_0xd940('0x7')]=function(_0xbc022b,_0x338c63){return _0xbc022b['define'](_0xd940('0x8'),attributes,{'tableName':_0xd940('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x33cc18,_0x36187a,_0x9cb9ee){var _0x3a7b50=_0xbc022b[_0xd940('0xa')];var _0x5e680b=_0x33cc18['get']({'plain':!![]});if(_0x5e680b[_0xd940('0xb')][_0xd940('0xc')]()==='in'||_0x5e680b[_0xd940('0xb')][_0xd940('0xc')]()===_0xd940('0xd')&&!_0x5e680b[_0xd940('0xe')]&&!_[_0xd940('0xf')](_0x5e680b['UserId'])){_0x3a7b50['ChatInteraction']['findOne']({'where':{'id':_0x5e680b[_0xd940('0x10')]}})[_0xd940('0x11')](function(_0x3c4e1f){if(_0x3c4e1f){_0x3c4e1f[_0xd940('0x12')]({'lastMsgAt':_0x5e680b['createdAt'],'lastMsgDirection':_0x5e680b[_0xd940('0xb')][_0xd940('0xc')](),'lastMsgBody':_0x5e680b[_0xd940('0x13')]});}})['catch'](function(_0x328ea5){console['error'](_0x328ea5);});}_0x9cb9ee();}},'charset':_0xd940('0x14'),'collate':_0xd940('0x15')});}; \ No newline at end of file +var _0xd758=['update','createdAt','body','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then'];(function(_0x33fe50,_0x1464c8){var _0x20b544=function(_0x9becc5){while(--_0x9becc5){_0x33fe50['push'](_0x33fe50['shift']());}};_0x20b544(++_0x1464c8);}(_0xd758,0x172));var _0x8d75=function(_0x11fc1a,_0x42c36c){_0x11fc1a=_0x11fc1a-0x0;var _0x1692de=_0xd758[_0x11fc1a];return _0x1692de;};'use strict';var _=require(_0x8d75('0x0'));var util=require(_0x8d75('0x1'));var logger=require(_0x8d75('0x2'))(_0x8d75('0x3'));var moment=require(_0x8d75('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x8d75('0x5'));module[_0x8d75('0x6')]=function(_0x2b06a7,_0x50247f){return _0x2b06a7[_0x8d75('0x7')](_0x8d75('0x8'),attributes,{'tableName':_0x8d75('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c6a33,_0x4046f2,_0x1c44c2){var _0x3fd211=_0x2b06a7['models'];var _0x1ac430=_0x2c6a33[_0x8d75('0xa')]({'plain':!![]});if(_0x1ac430[_0x8d75('0xb')][_0x8d75('0xc')]()==='in'||_0x1ac430[_0x8d75('0xb')][_0x8d75('0xc')]()==='out'&&!_0x1ac430[_0x8d75('0xd')]&&!_[_0x8d75('0xe')](_0x1ac430[_0x8d75('0xf')])){_0x3fd211[_0x8d75('0x10')][_0x8d75('0x11')]({'where':{'id':_0x1ac430[_0x8d75('0x12')]}})[_0x8d75('0x13')](function(_0xcfdc1b){if(_0xcfdc1b){_0xcfdc1b[_0x8d75('0x14')]({'lastMsgAt':_0x1ac430[_0x8d75('0x15')],'lastMsgDirection':_0x1ac430['direction'][_0x8d75('0xc')](),'lastMsgBody':_0x1ac430[_0x8d75('0x16')]});}})[_0x8d75('0x17')](function(_0x38a425){console[_0x8d75('0x18')](_0x38a425);});}_0x1c44c2();}},'charset':'utf8mb4','collate':_0x8d75('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index a44ee8b..b30e5b2 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 _0x5c03=['moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','ChatMessage','create','options','raw','then','CreateChatMessage','debug','stringify','catch','lodash'];(function(_0x9e03ad,_0x3c6e88){var _0x1f3545=function(_0x84aad8){while(--_0x84aad8){_0x9e03ad['push'](_0x9e03ad['shift']());}};_0x1f3545(++_0x3c6e88);}(_0x5c03,0xd8));var _0x35c0=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x5c03[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x35c0('0x0'));var util=require('util');var moment=require(_0x35c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x35c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35c0('0x3'));var logger=require(_0x35c0('0x4'))(_0x35c0('0x5'));var config=require(_0x35c0('0x6'));var jayson=require(_0x35c0('0x7'));var client=jayson['client'][_0x35c0('0x8')]({'port':0x232a});config[_0x35c0('0x9')]=_[_0x35c0('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x35c0('0xb'))(new Redis(config[_0x35c0('0x9')]));require(_0x35c0('0xc'))[_0x35c0('0xd')](socket);function respondWithRpcPromise(_0x4b3030,_0x1b7ff2,_0x4e5f57){return new BPromise(function(_0x1b03ef,_0x2e83ce){return client[_0x35c0('0xe')](_0x4b3030,_0x4e5f57)['then'](function(_0x41b59e){logger[_0x35c0('0xf')](_0x35c0('0x10'),_0x1b7ff2,'request\x20sent');logger['debug'](_0x35c0('0x11'),_0x1b7ff2,'request\x20sent',JSON['stringify'](_0x41b59e));if(_0x41b59e[_0x35c0('0x12')]){if(_0x41b59e['error'][_0x35c0('0x13')]===0x1f4){logger[_0x35c0('0x12')](_0x35c0('0x10'),_0x1b7ff2,_0x41b59e[_0x35c0('0x12')][_0x35c0('0x14')]);return _0x2e83ce(_0x41b59e['error']['message']);}logger['error'](_0x35c0('0x10'),_0x1b7ff2,_0x41b59e[_0x35c0('0x12')][_0x35c0('0x14')]);return _0x1b03ef(_0x41b59e[_0x35c0('0x12')][_0x35c0('0x14')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x1b7ff2,'request\x20sent');_0x1b03ef(_0x41b59e[_0x35c0('0x15')]['message']);}})['catch'](function(_0x2e285d){logger[_0x35c0('0x12')](_0x35c0('0x10'),_0x1b7ff2,_0x2e285d);_0x2e83ce(_0x2e285d);});});}exports['CreateChatMessage']=function(_0x17e682){var _0x362f66=this;return new Promise(function(_0x35588e,_0x1816a4){return db[_0x35c0('0x16')][_0x35c0('0x17')](_0x17e682['body'],{'raw':_0x17e682[_0x35c0('0x18')]?_0x17e682[_0x35c0('0x18')][_0x35c0('0x19')]===undefined?!![]:![]:!![]})[_0x35c0('0x1a')](function(_0x4e6473){logger['info'](_0x35c0('0x1b'),_0x17e682);logger[_0x35c0('0x1c')](_0x35c0('0x1b'),_0x17e682,JSON[_0x35c0('0x1d')](_0x4e6473));_0x35588e(_0x4e6473);})[_0x35c0('0x1e')](function(_0x2f8512){logger[_0x35c0('0x12')]('CreateChatMessage',_0x2f8512['message'],_0x17e682);_0x1816a4(_0x362f66[_0x35c0('0x12')](0x1f4,_0x2f8512[_0x35c0('0x14')]));});});}; \ No newline at end of file +var _0x704b=['stringify','error','code','message','info','catch','CreateChatMessage','create','body','options','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47eba9,_0x36061a){var _0x23bf95=function(_0x5ca57d){while(--_0x5ca57d){_0x47eba9['push'](_0x47eba9['shift']());}};_0x23bf95(++_0x36061a);}(_0x704b,0x106));var _0xb704=function(_0x3b2666,_0x4a319c){_0x3b2666=_0x3b2666-0x0;var _0x2e9da6=_0x704b[_0x3b2666];return _0x2e9da6;};'use strict';var _=require(_0xb704('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb704('0x1'));var rs=require(_0xb704('0x2'));var fs=require('fs');var Redis=require(_0xb704('0x3'));var db=require(_0xb704('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb704('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb704('0x6')][_0xb704('0x7')]({'port':0x232a});config[_0xb704('0x8')]=_[_0xb704('0x9')](config['redis'],{'host':_0xb704('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb704('0x8')]));require(_0xb704('0xb'))[_0xb704('0xc')](socket);function respondWithRpcPromise(_0x390015,_0x17bd16,_0xb05c6e){return new BPromise(function(_0x43cb11,_0xfd44c8){return client[_0xb704('0xd')](_0x390015,_0xb05c6e)[_0xb704('0xe')](function(_0x127bec){logger['info'](_0xb704('0xf'),_0x17bd16,_0xb704('0x10'));logger[_0xb704('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x17bd16,_0xb704('0x10'),JSON[_0xb704('0x12')](_0x127bec));if(_0x127bec[_0xb704('0x13')]){if(_0x127bec[_0xb704('0x13')][_0xb704('0x14')]===0x1f4){logger[_0xb704('0x13')](_0xb704('0xf'),_0x17bd16,_0x127bec[_0xb704('0x13')][_0xb704('0x15')]);return _0xfd44c8(_0x127bec['error']['message']);}logger[_0xb704('0x13')](_0xb704('0xf'),_0x17bd16,_0x127bec[_0xb704('0x13')][_0xb704('0x15')]);return _0x43cb11(_0x127bec[_0xb704('0x13')][_0xb704('0x15')]);}else{logger[_0xb704('0x16')](_0xb704('0xf'),_0x17bd16,'request\x20sent');_0x43cb11(_0x127bec['result'][_0xb704('0x15')]);}})[_0xb704('0x17')](function(_0x369cbc){logger[_0xb704('0x13')]('ChatMessage,\x20%s,\x20%s',_0x17bd16,_0x369cbc);_0xfd44c8(_0x369cbc);});});}exports[_0xb704('0x18')]=function(_0x1039eb){var _0x170468=this;return new Promise(function(_0x3783df,_0x35071c){return db['ChatMessage'][_0xb704('0x19')](_0x1039eb[_0xb704('0x1a')],{'raw':_0x1039eb[_0xb704('0x1b')]?_0x1039eb['options']['raw']===undefined?!![]:![]:!![]})[_0xb704('0xe')](function(_0x567779){logger[_0xb704('0x16')](_0xb704('0x18'),_0x1039eb);logger['debug']('CreateChatMessage',_0x1039eb,JSON[_0xb704('0x12')](_0x567779));_0x3783df(_0x567779);})[_0xb704('0x17')](function(_0x18bb8d){logger[_0xb704('0x13')]('CreateChatMessage',_0x18bb8d[_0xb704('0x15')],_0x1039eb);_0x35071c(_0x170468[_0xb704('0x13')](0x1f4,_0x18bb8d[_0xb704('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a50db82..0761f05 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 _0xedd9=['removeListener','register','length','chatMessage:','save','remove','update','emit'];(function(_0x223e06,_0x18459d){var _0x28e638=function(_0x40c4a8){while(--_0x40c4a8){_0x223e06['push'](_0x223e06['shift']());}};_0x28e638(++_0x18459d);}(_0xedd9,0xfc));var _0x9edd=function(_0x1bbcd4,_0x3ed594){_0x1bbcd4=_0x1bbcd4-0x0;var _0x5a3f32=_0xedd9[_0x1bbcd4];return _0x5a3f32;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){ChatMessageEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);ChatMessageEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file +var _0x3e74=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','remove','update'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x3e74,0x175));var _0x43e7=function(_0x18a403,_0x156206){_0x18a403=_0x18a403-0x0;var _0x144f43=_0x3e74[_0x18a403];return _0x144f43;};'use strict';var ChatMessageEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){ChatMessageEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);ChatMessageEvents['on'](_0x3491d6,_0x2ede2d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 2242d08..472c56d 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 _0xb006=['express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat','chatmessage:create','put','/:id/accept','accept','reject','delete','destroy','exports','multer','connect-timeout'];(function(_0x1de2bb,_0x5d0cd1){var _0x59aa52=function(_0x2e7f83){while(--_0x2e7f83){_0x1de2bb['push'](_0x1de2bb['shift']());}};_0x59aa52(++_0x5d0cd1);}(_0xb006,0x106));var _0x6b00=function(_0x1e6951,_0x4d39ee){_0x1e6951=_0x1e6951-0x0;var _0x235723=_0xb006[_0x1e6951];return _0x235723;};'use strict';var multer=require(_0x6b00('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b00('0x1'));var express=require(_0x6b00('0x2'));var router=express[_0x6b00('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6b00('0x4'));var config=require(_0x6b00('0x5'));var controller=require(_0x6b00('0x6'));router[_0x6b00('0x7')]('/',auth[_0x6b00('0x8')](),controller[_0x6b00('0x9')]);router['get'](_0x6b00('0xa'),auth['isAuthenticated'](),controller[_0x6b00('0xb')]);router[_0x6b00('0x7')](_0x6b00('0xc'),auth[_0x6b00('0x8')](),controller['show']);router[_0x6b00('0xd')]('/',auth[_0x6b00('0x8')](),interaction[_0x6b00('0xe')](_0x6b00('0xf'),_0x6b00('0x10')),controller['create']);router[_0x6b00('0x11')]('/:id',controller['update']);router[_0x6b00('0x11')](_0x6b00('0x12'),auth['isAuthenticated'](),controller[_0x6b00('0x13')]);router['put']('/:id/reject',auth[_0x6b00('0x8')](),controller[_0x6b00('0x14')]);router[_0x6b00('0x15')](_0x6b00('0xc'),auth[_0x6b00('0x8')](),controller[_0x6b00('0x16')]);module[_0x6b00('0x17')]=router; \ No newline at end of file +var _0xd538=['../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','/describe','isAuthenticated','describe','/:id','post','tracked','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3aad62,_0x52bd6e){var _0x1e58ae=function(_0xfe3ad){while(--_0xfe3ad){_0x3aad62['push'](_0x3aad62['shift']());}};_0x1e58ae(++_0x52bd6e);}(_0xd538,0x73));var _0x8d53=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0xd538[_0x50e40b];return _0x2608b7;};'use strict';var multer=require('multer');var util=require(_0x8d53('0x0'));var path=require(_0x8d53('0x1'));var timeout=require(_0x8d53('0x2'));var express=require(_0x8d53('0x3'));var router=express[_0x8d53('0x4')]();var auth=require(_0x8d53('0x5'));var interaction=require(_0x8d53('0x6'));var config=require('../../config/environment');var controller=require(_0x8d53('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8d53('0x8')](_0x8d53('0x9'),auth[_0x8d53('0xa')](),controller[_0x8d53('0xb')]);router[_0x8d53('0x8')](_0x8d53('0xc'),auth[_0x8d53('0xa')](),controller['show']);router[_0x8d53('0xd')]('/',auth[_0x8d53('0xa')](),interaction[_0x8d53('0xe')]('chat',_0x8d53('0xf')),controller['create']);router[_0x8d53('0x10')](_0x8d53('0xc'),controller[_0x8d53('0x11')]);router[_0x8d53('0x10')](_0x8d53('0x12'),auth[_0x8d53('0xa')](),controller[_0x8d53('0x13')]);router[_0x8d53('0x10')](_0x8d53('0x14'),auth[_0x8d53('0xa')](),controller[_0x8d53('0x15')]);router['delete'](_0x8d53('0xc'),auth[_0x8d53('0xa')](),controller[_0x8d53('0x16')]);module[_0x8d53('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 80cad6f..db43a6f 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 _0xe2e4=['sequelize','exports','medium'];(function(_0x133d38,_0x4ff3c1){var _0x5f2fb6=function(_0x2b9d1d){while(--_0x2b9d1d){_0x133d38['push'](_0x133d38['shift']());}};_0x5f2fb6(++_0x4ff3c1);}(_0xe2e4,0x6f));var _0x4e2e=function(_0x2894e4,_0x39f2f7){_0x2894e4=_0x2894e4-0x0;var _0x341734=_0xe2e4[_0x2894e4];return _0x341734;};'use strict';var Sequelize=require(_0x4e2e('0x0'));module[_0x4e2e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4e2e('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x4eaf=['medium','sequelize','TEXT'];(function(_0x31df21,_0x5e1711){var _0x269e9d=function(_0x974919){while(--_0x974919){_0x31df21['push'](_0x31df21['shift']());}};_0x269e9d(++_0x5e1711);}(_0x4eaf,0x112));var _0xf4ea=function(_0xaf1ff5,_0x1c8c87){_0xaf1ff5=_0xaf1ff5-0x0;var _0x1a615b=_0x4eaf[_0xaf1ff5];return _0x1a615b;};'use strict';var Sequelize=require(_0xf4ea('0x0'));module['exports']={'body':{'type':Sequelize[_0xf4ea('0x1')](_0xf4ea('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 2ca35a0..01682e6 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 _0xe49a=['catch','show','fields','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','name','ChatOfflineMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','day','merge','filter','map','options','includeAll','include','rows'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xe49a,0xd7));var _0xae49=function(_0x4a7e12,_0x46479e){_0x4a7e12=_0x4a7e12-0x0;var _0x350a06=_0xe49a[_0x4a7e12];return _0x350a06;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae49('0x0'));var rimraf=require(_0xae49('0x1'));var zipdir=require(_0xae49('0x2'));var jsonpatch=require(_0xae49('0x3'));var rp=require(_0xae49('0x4'));var moment=require(_0xae49('0x5'));var BPromise=require(_0xae49('0x6'));var Mustache=require('mustache');var util=require(_0xae49('0x7'));var path=require(_0xae49('0x8'));var sox=require(_0xae49('0x9'));var csv=require('to-csv');var ejs=require(_0xae49('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xae49('0xb'));var crypto=require(_0xae49('0xc'));var jsforce=require(_0xae49('0xd'));var deskjs=require(_0xae49('0xe'));var toCsv=require(_0xae49('0xf'));var querystring=require(_0xae49('0x10'));var Papa=require(_0xae49('0x11'));var Redis=require('ioredis');var qs=require(_0xae49('0x12'));var logger=require('../../config/logger')(_0xae49('0x13'));var utils=require(_0xae49('0x14'));var config=require(_0xae49('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39d94b,_0x32c80f){_0x32c80f=_0x32c80f||0xcc;return function(_0x2810e2){if(_0x2810e2){return _0x39d94b[_0xae49('0x16')](_0x32c80f);}return _0x39d94b[_0xae49('0x17')](_0x32c80f)[_0xae49('0x18')]();};}function respondWithResult(_0x56a96e,_0x5447d2){_0x5447d2=_0x5447d2||0xc8;return function(_0x430eff){if(_0x430eff){return _0x56a96e[_0xae49('0x17')](_0x5447d2)[_0xae49('0x19')](_0x430eff);}};}function respondWithFilteredResult(_0xffb91e,_0x2e9256){return function(_0x13bdff){if(_0x13bdff){var _0x13df8f=_0x13bdff[_0xae49('0x1a')],_0x182d26=_0x2e9256['offset'],_0x296e27=_0x2e9256[_0xae49('0x1b')]+_0x2e9256[_0xae49('0x1c')],_0x603f4c;if(_0x296e27>=_0x13df8f){_0x296e27=_0x13df8f;_0x603f4c=0xc8;}else{_0x603f4c=0xce;}_0xffb91e[_0xae49('0x17')](_0x603f4c);return _0xffb91e['set'](_0xae49('0x1d'),_0x182d26+'-'+_0x296e27+'/'+_0x13df8f)[_0xae49('0x19')](_0x13bdff);}return null;};}function patchUpdates(_0x54bc9c){return function(_0x290d8b){try{jsonpatch[_0xae49('0x1e')](_0x290d8b,_0x54bc9c,!![]);}catch(_0x5094c7){return BPromise['reject'](_0x5094c7);}return _0x290d8b[_0xae49('0x1f')]();};}function saveUpdates(_0x5ea5d2,_0x5a3ab7){return function(_0x5b9289){if(_0x5b9289){return _0x5b9289[_0xae49('0x20')](_0x5ea5d2)[_0xae49('0x21')](function(_0x48562a){return _0x48562a;});}return null;};}function removeEntity(_0x2ea615,_0x836b55){return function(_0x293a53){if(_0x293a53){return _0x293a53[_0xae49('0x22')]()[_0xae49('0x21')](function(){_0x2ea615['status'](0xcc)[_0xae49('0x18')]();});}};}function handleEntityNotFound(_0xbbdef9,_0xd97f22){return function(_0x595129){if(!_0x595129){_0xbbdef9[_0xae49('0x16')](0x194);}return _0x595129;};}function handleError(_0x5d3fcc,_0x1ca991){_0x1ca991=_0x1ca991||0x1f4;return function(_0x56f93f){logger[_0xae49('0x23')](_0x56f93f['stack']);if(_0x56f93f[_0xae49('0x24')]){delete _0x56f93f[_0xae49('0x24')];}_0x5d3fcc['status'](_0x1ca991)['send'](_0x56f93f);};}exports['index']=function(_0x4167f4,_0x189e62){var _0xd79a45={},_0x1d5a74={},_0x20f6b9={'count':0x0,'rows':[]};var _0x4bb955=db[_0xae49('0x25')][_0xae49('0x26')];_0x1d5a74[_0xae49('0x27')]=_[_0xae49('0x28')](_0x4bb955);var _0x1178ce={'dateStart':_0x4167f4[_0xae49('0x29')][_0xae49('0x2a')],'dateEnd':_0x4167f4[_0xae49('0x29')][_0xae49('0x2b')]};delete _0x4167f4[_0xae49('0x29')][_0xae49('0x2a')];delete _0x4167f4['query'][_0xae49('0x2b')];_0x1d5a74['query']=_[_0xae49('0x28')](_0x4167f4['query']);_0x1d5a74[_0xae49('0x2c')]=_[_0xae49('0x2d')](_0x1d5a74[_0xae49('0x27')],_0x1d5a74[_0xae49('0x29')]);_0xd79a45[_0xae49('0x2e')]=_[_0xae49('0x2d')](_0x1d5a74[_0xae49('0x27')],qs['fields'](_0x4167f4[_0xae49('0x29')]['fields']));_0xd79a45[_0xae49('0x2e')]=_0xd79a45['attributes'][_0xae49('0x2f')]?_0xd79a45['attributes']:_0x1d5a74[_0xae49('0x27')];if(!_0x4167f4[_0xae49('0x29')][_0xae49('0x30')](_0xae49('0x31'))){_0xd79a45[_0xae49('0x1c')]=qs[_0xae49('0x1c')](_0x4167f4[_0xae49('0x29')][_0xae49('0x1c')]);_0xd79a45[_0xae49('0x1b')]=qs[_0xae49('0x1b')](_0x4167f4[_0xae49('0x29')][_0xae49('0x1b')]);}_0xd79a45['order']=qs[_0xae49('0x32')](_0x4167f4[_0xae49('0x29')][_0xae49('0x32')]);_0xd79a45[_0xae49('0x33')]=qs[_0xae49('0x2c')](_[_0xae49('0x34')](_0x4167f4[_0xae49('0x29')],_0x1d5a74[_0xae49('0x2c')]));if(_0x1178ce[_0xae49('0x2a')]){if(_0x1178ce[_0xae49('0x2b')]){_0x1178ce['dateEnd']=moment(_0x1178ce[_0xae49('0x2b')])['add'](0x1,'day');}else{_0x1178ce[_0xae49('0x2b')]=moment(_0x1178ce['dateStart'])['add'](0x1,_0xae49('0x35'));}_[_0xae49('0x36')](_0xd79a45['where'],{'createdAt':{'$gte':_0x1178ce[_0xae49('0x2a')],'$lte':_0x1178ce[_0xae49('0x2b')]}});}if(_0x4167f4['query'][_0xae49('0x37')]){_0xd79a45[_0xae49('0x33')]=_[_0xae49('0x36')](_0xd79a45[_0xae49('0x33')],{'$or':_[_0xae49('0x38')](_0xd79a45[_0xae49('0x2e')],function(_0x3ffcca){var _0x4130b1={};_0x4130b1[_0x3ffcca]={'$like':'%'+_0x4167f4['query'][_0xae49('0x37')]+'%'};return _0x4130b1;})});}_0xd79a45=_['merge']({},_0xd79a45,_0x4167f4[_0xae49('0x39')]);var _0x94f2ee={'where':_0xd79a45['where']};return db['ChatOfflineMessage'][_0xae49('0x1a')](_0x94f2ee)[_0xae49('0x21')](function(_0x59f0b2){_0x20f6b9[_0xae49('0x1a')]=_0x59f0b2;if(_0x4167f4['query'][_0xae49('0x3a')]){_0xd79a45[_0xae49('0x3b')]=[{'all':!![]}];}return db[_0xae49('0x25')]['findAll'](_0xd79a45);})[_0xae49('0x21')](function(_0x4d59ec){_0x20f6b9[_0xae49('0x3c')]=_0x4d59ec;return _0x20f6b9;})[_0xae49('0x21')](respondWithFilteredResult(_0x189e62,_0xd79a45))[_0xae49('0x3d')](handleError(_0x189e62,null));};exports[_0xae49('0x3e')]=function(_0x3d8808,_0x1fb1eb){var _0x2ef5d5={'raw':!![],'where':{'id':_0x3d8808['params']['id']}},_0x1c553c={};_0x1c553c[_0xae49('0x27')]=_[_0xae49('0x28')](db[_0xae49('0x25')][_0xae49('0x26')]);_0x1c553c[_0xae49('0x29')]=_['keys'](_0x3d8808[_0xae49('0x29')]);_0x1c553c['filters']=_[_0xae49('0x2d')](_0x1c553c[_0xae49('0x27')],_0x1c553c[_0xae49('0x29')]);_0x2ef5d5[_0xae49('0x2e')]=_['intersection'](_0x1c553c['model'],qs[_0xae49('0x3f')](_0x3d8808[_0xae49('0x29')][_0xae49('0x3f')]));_0x2ef5d5[_0xae49('0x2e')]=_0x2ef5d5[_0xae49('0x2e')][_0xae49('0x2f')]?_0x2ef5d5[_0xae49('0x2e')]:_0x1c553c[_0xae49('0x27')];if(_0x3d8808['query']['includeAll']){_0x2ef5d5[_0xae49('0x3b')]=[{'all':!![]}];}_0x2ef5d5=_[_0xae49('0x36')]({},_0x2ef5d5,_0x3d8808[_0xae49('0x39')]);return db['ChatOfflineMessage'][_0xae49('0x40')](_0x2ef5d5)[_0xae49('0x21')](handleEntityNotFound(_0x1fb1eb,null))[_0xae49('0x21')](respondWithResult(_0x1fb1eb,null))['catch'](handleError(_0x1fb1eb,null));};exports[_0xae49('0x41')]=function(_0x25d78a,_0x295cf0){return db[_0xae49('0x25')][_0xae49('0x41')](_0x25d78a[_0xae49('0x42')],{})[_0xae49('0x21')](respondWithResult(_0x295cf0,0xc9))[_0xae49('0x3d')](handleError(_0x295cf0,null));};exports[_0xae49('0x20')]=function(_0x1620d3,_0x2ac82e){if(_0x1620d3['body']['id']){delete _0x1620d3[_0xae49('0x42')]['id'];}return db['ChatOfflineMessage']['find']({'where':{'id':_0x1620d3[_0xae49('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ac82e,null))['then'](saveUpdates(_0x1620d3[_0xae49('0x42')],null))[_0xae49('0x21')](respondWithResult(_0x2ac82e,null))['catch'](handleError(_0x2ac82e,null));};exports[_0xae49('0x22')]=function(_0xbf906,_0x3e092d){return db[_0xae49('0x25')][_0xae49('0x40')]({'where':{'id':_0xbf906[_0xae49('0x43')]['id']}})[_0xae49('0x21')](handleEntityNotFound(_0x3e092d,null))[_0xae49('0x21')](removeEntity(_0x3e092d,null))['catch'](handleError(_0x3e092d,null));};exports[_0xae49('0x44')]=function(_0x452286,_0x299019){return db['ChatOfflineMessage'][_0xae49('0x44')]()[_0xae49('0x21')](respondWithResult(_0x299019,null))['catch'](handleError(_0x299019,null));}; \ No newline at end of file +var _0x24e9=['merge','map','options','include','ChatOfflineMessage','findAll','catch','show','params','length','includeAll','create','body','destroy','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','error','stack','send','index','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','add','day','where'];(function(_0x1348dd,_0x16bb43){var _0x5bfe9d=function(_0x2574a4){while(--_0x2574a4){_0x1348dd['push'](_0x1348dd['shift']());}};_0x5bfe9d(++_0x16bb43);}(_0x24e9,0x1a8));var _0x924e=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x24e9[_0x35f7f5];return _0x5567a4;};'use strict';var pdf=require(_0x924e('0x0'));var emlformat=require(_0x924e('0x1'));var rimraf=require(_0x924e('0x2'));var zipdir=require(_0x924e('0x3'));var jsonpatch=require(_0x924e('0x4'));var rp=require(_0x924e('0x5'));var moment=require(_0x924e('0x6'));var BPromise=require(_0x924e('0x7'));var Mustache=require(_0x924e('0x8'));var util=require('util');var path=require(_0x924e('0x9'));var sox=require(_0x924e('0xa'));var csv=require('to-csv');var ejs=require(_0x924e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x924e('0xc'));var jsforce=require(_0x924e('0xd'));var deskjs=require(_0x924e('0xe'));var toCsv=require(_0x924e('0xf'));var querystring=require(_0x924e('0x10'));var Papa=require(_0x924e('0x11'));var Redis=require(_0x924e('0x12'));var qs=require(_0x924e('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x924e('0x14'));var db=require(_0x924e('0x15'))['db'];function respondWithStatusCode(_0x3d5540,_0x575038){_0x575038=_0x575038||0xcc;return function(_0x52ad6c){if(_0x52ad6c){return _0x3d5540[_0x924e('0x16')](_0x575038);}return _0x3d5540['status'](_0x575038)[_0x924e('0x17')]();};}function respondWithResult(_0x39dbf9,_0x1b9a30){_0x1b9a30=_0x1b9a30||0xc8;return function(_0x583f52){if(_0x583f52){return _0x39dbf9[_0x924e('0x18')](_0x1b9a30)[_0x924e('0x19')](_0x583f52);}};}function respondWithFilteredResult(_0x54d1aa,_0x4fba54){return function(_0x3b5340){if(_0x3b5340){var _0x1787b4=_0x3b5340[_0x924e('0x1a')],_0x8bae56=_0x4fba54[_0x924e('0x1b')],_0xac4684=_0x4fba54[_0x924e('0x1b')]+_0x4fba54[_0x924e('0x1c')],_0x5bae73;if(_0xac4684>=_0x1787b4){_0xac4684=_0x1787b4;_0x5bae73=0xc8;}else{_0x5bae73=0xce;}_0x54d1aa[_0x924e('0x18')](_0x5bae73);return _0x54d1aa[_0x924e('0x1d')](_0x924e('0x1e'),_0x8bae56+'-'+_0xac4684+'/'+_0x1787b4)[_0x924e('0x19')](_0x3b5340);}return null;};}function patchUpdates(_0x400670){return function(_0x114202){try{jsonpatch[_0x924e('0x1f')](_0x114202,_0x400670,!![]);}catch(_0x2bc6ee){return BPromise['reject'](_0x2bc6ee);}return _0x114202[_0x924e('0x20')]();};}function saveUpdates(_0x27233c,_0xc30b7a){return function(_0x3d70b8){if(_0x3d70b8){return _0x3d70b8['update'](_0x27233c)[_0x924e('0x21')](function(_0x4b98dc){return _0x4b98dc;});}return null;};}function removeEntity(_0x11d9d3,_0x465d90){return function(_0x31d66b){if(_0x31d66b){return _0x31d66b['destroy']()[_0x924e('0x21')](function(){_0x11d9d3['status'](0xcc)[_0x924e('0x17')]();});}};}function handleEntityNotFound(_0xd9352b,_0x893860){return function(_0x3b53a4){if(!_0x3b53a4){_0xd9352b[_0x924e('0x16')](0x194);}return _0x3b53a4;};}function handleError(_0x2fff24,_0x3447ec){_0x3447ec=_0x3447ec||0x1f4;return function(_0xe3b697){logger[_0x924e('0x22')](_0xe3b697[_0x924e('0x23')]);if(_0xe3b697['name']){delete _0xe3b697['name'];}_0x2fff24['status'](_0x3447ec)[_0x924e('0x24')](_0xe3b697);};}exports[_0x924e('0x25')]=function(_0x315571,_0x112a7a){var _0x3187b7={},_0x4acf09={},_0x336a68={'count':0x0,'rows':[]};var _0xa7c09d=db['ChatOfflineMessage']['rawAttributes'];_0x4acf09[_0x924e('0x26')]=_['keys'](_0xa7c09d);var _0x203921={'dateStart':_0x315571[_0x924e('0x27')]['dateStart'],'dateEnd':_0x315571[_0x924e('0x27')][_0x924e('0x28')]};delete _0x315571[_0x924e('0x27')][_0x924e('0x29')];delete _0x315571[_0x924e('0x27')][_0x924e('0x28')];_0x4acf09[_0x924e('0x27')]=_[_0x924e('0x2a')](_0x315571['query']);_0x4acf09[_0x924e('0x2b')]=_[_0x924e('0x2c')](_0x4acf09[_0x924e('0x26')],_0x4acf09['query']);_0x3187b7[_0x924e('0x2d')]=_[_0x924e('0x2c')](_0x4acf09[_0x924e('0x26')],qs[_0x924e('0x2e')](_0x315571[_0x924e('0x27')]['fields']));_0x3187b7[_0x924e('0x2d')]=_0x3187b7['attributes']['length']?_0x3187b7['attributes']:_0x4acf09[_0x924e('0x26')];if(!_0x315571['query'][_0x924e('0x2f')]('nolimit')){_0x3187b7['limit']=qs[_0x924e('0x1c')](_0x315571['query'][_0x924e('0x1c')]);_0x3187b7['offset']=qs[_0x924e('0x1b')](_0x315571[_0x924e('0x27')][_0x924e('0x1b')]);}_0x3187b7['order']=qs[_0x924e('0x30')](_0x315571[_0x924e('0x27')]['sort']);_0x3187b7['where']=qs[_0x924e('0x2b')](_['pick'](_0x315571['query'],_0x4acf09[_0x924e('0x2b')]));if(_0x203921[_0x924e('0x29')]){if(_0x203921[_0x924e('0x28')]){_0x203921[_0x924e('0x28')]=moment(_0x203921[_0x924e('0x28')])[_0x924e('0x31')](0x1,_0x924e('0x32'));}else{_0x203921[_0x924e('0x28')]=moment(_0x203921[_0x924e('0x29')])[_0x924e('0x31')](0x1,_0x924e('0x32'));}_['merge'](_0x3187b7[_0x924e('0x33')],{'createdAt':{'$gte':_0x203921[_0x924e('0x29')],'$lte':_0x203921[_0x924e('0x28')]}});}if(_0x315571['query']['filter']){_0x3187b7['where']=_[_0x924e('0x34')](_0x3187b7[_0x924e('0x33')],{'$or':_[_0x924e('0x35')](_0x3187b7[_0x924e('0x2d')],function(_0x2ca21d){var _0x1e0ba1={};_0x1e0ba1[_0x2ca21d]={'$like':'%'+_0x315571[_0x924e('0x27')]['filter']+'%'};return _0x1e0ba1;})});}_0x3187b7=_['merge']({},_0x3187b7,_0x315571[_0x924e('0x36')]);var _0x1df3f8={'where':_0x3187b7[_0x924e('0x33')]};return db['ChatOfflineMessage'][_0x924e('0x1a')](_0x1df3f8)[_0x924e('0x21')](function(_0x6d9f09){_0x336a68['count']=_0x6d9f09;if(_0x315571[_0x924e('0x27')]['includeAll']){_0x3187b7[_0x924e('0x37')]=[{'all':!![]}];}return db[_0x924e('0x38')][_0x924e('0x39')](_0x3187b7);})['then'](function(_0x130058){_0x336a68['rows']=_0x130058;return _0x336a68;})[_0x924e('0x21')](respondWithFilteredResult(_0x112a7a,_0x3187b7))[_0x924e('0x3a')](handleError(_0x112a7a,null));};exports[_0x924e('0x3b')]=function(_0x5ec31e,_0xc1f884){var _0x475f5e={'raw':!![],'where':{'id':_0x5ec31e[_0x924e('0x3c')]['id']}},_0xbf8520={};_0xbf8520[_0x924e('0x26')]=_[_0x924e('0x2a')](db[_0x924e('0x38')]['rawAttributes']);_0xbf8520[_0x924e('0x27')]=_[_0x924e('0x2a')](_0x5ec31e[_0x924e('0x27')]);_0xbf8520[_0x924e('0x2b')]=_[_0x924e('0x2c')](_0xbf8520[_0x924e('0x26')],_0xbf8520[_0x924e('0x27')]);_0x475f5e[_0x924e('0x2d')]=_[_0x924e('0x2c')](_0xbf8520[_0x924e('0x26')],qs[_0x924e('0x2e')](_0x5ec31e[_0x924e('0x27')][_0x924e('0x2e')]));_0x475f5e['attributes']=_0x475f5e['attributes'][_0x924e('0x3d')]?_0x475f5e['attributes']:_0xbf8520[_0x924e('0x26')];if(_0x5ec31e[_0x924e('0x27')][_0x924e('0x3e')]){_0x475f5e[_0x924e('0x37')]=[{'all':!![]}];}_0x475f5e=_['merge']({},_0x475f5e,_0x5ec31e[_0x924e('0x36')]);return db[_0x924e('0x38')]['find'](_0x475f5e)[_0x924e('0x21')](handleEntityNotFound(_0xc1f884,null))['then'](respondWithResult(_0xc1f884,null))[_0x924e('0x3a')](handleError(_0xc1f884,null));};exports[_0x924e('0x3f')]=function(_0x564f8d,_0x1773bd){return db[_0x924e('0x38')][_0x924e('0x3f')](_0x564f8d[_0x924e('0x40')],{})['then'](respondWithResult(_0x1773bd,0xc9))[_0x924e('0x3a')](handleError(_0x1773bd,null));};exports['update']=function(_0x4e4a87,_0x29ffd0){if(_0x4e4a87[_0x924e('0x40')]['id']){delete _0x4e4a87['body']['id'];}return db[_0x924e('0x38')]['find']({'where':{'id':_0x4e4a87[_0x924e('0x3c')]['id']}})[_0x924e('0x21')](handleEntityNotFound(_0x29ffd0,null))[_0x924e('0x21')](saveUpdates(_0x4e4a87[_0x924e('0x40')],null))[_0x924e('0x21')](respondWithResult(_0x29ffd0,null))[_0x924e('0x3a')](handleError(_0x29ffd0,null));};exports[_0x924e('0x41')]=function(_0x48ef53,_0x4c29e8){return db[_0x924e('0x38')][_0x924e('0x42')]({'where':{'id':_0x48ef53[_0x924e('0x3c')]['id']}})[_0x924e('0x21')](handleEntityNotFound(_0x4c29e8,null))['then'](removeEntity(_0x4c29e8,null))['catch'](handleError(_0x4c29e8,null));};exports[_0x924e('0x43')]=function(_0x4d6b45,_0x7d013c){return db[_0x924e('0x38')][_0x924e('0x43')]()[_0x924e('0x21')](respondWithResult(_0x7d013c,null))['catch'](handleError(_0x7d013c,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index bdf16c4..4f17eb8 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 _0x207b=['lodash','util','api','moment','bluebird','request-promise','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2e40f2,_0x510f02){var _0x427094=function(_0x175107){while(--_0x175107){_0x2e40f2['push'](_0x2e40f2['shift']());}};_0x427094(++_0x510f02);}(_0x207b,0xf2));var _0xb207=function(_0x16fce4,_0x45b06d){_0x16fce4=_0x16fce4-0x0;var _0x9dd321=_0x207b[_0x16fce4];return _0x9dd321;};'use strict';var _=require(_0xb207('0x0'));var util=require(_0xb207('0x1'));var logger=require('../../config/logger')(_0xb207('0x2'));var moment=require(_0xb207('0x3'));var BPromise=require(_0xb207('0x4'));var rp=require(_0xb207('0x5'));var attributes=require(_0xb207('0x6'));module[_0xb207('0x7')]=function(_0x1b1257,_0x7646c8){return _0x1b1257[_0xb207('0x8')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb207('0x9'),'collate':_0xb207('0xa')});}; \ No newline at end of file +var _0x0990=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x0990,0x67));var _0x0099=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x0990[_0x6d6a66];return _0x11eb6e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0099('0x0'))('api');var moment=require(_0x0099('0x1'));var BPromise=require('bluebird');var rp=require(_0x0099('0x2'));var attributes=require(_0x0099('0x3'));module[_0x0099('0x4')]=function(_0x187b4a,_0x4c462e){return _0x187b4a[_0x0099('0x5')](_0x0099('0x6'),attributes,{'tableName':_0x0099('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0099('0x8'),'collate':_0x0099('0x9')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4ca8972..4301b7e 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 _0x7e15=['request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0xb87014,_0x524eaa){var _0x1f0cc7=function(_0x1bfdeb){while(--_0x1bfdeb){_0xb87014['push'](_0xb87014['shift']());}};_0x1f0cc7(++_0x524eaa);}(_0x7e15,0x1ed));var _0x57e1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7e15[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x57e1('0x0'));var moment=require(_0x57e1('0x1'));var BPromise=require(_0x57e1('0x2'));var rs=require(_0x57e1('0x3'));var fs=require('fs');var Redis=require(_0x57e1('0x4'));var db=require(_0x57e1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x57e1('0x6'))('rpc');var config=require(_0x57e1('0x7'));var jayson=require(_0x57e1('0x8'));var client=jayson[_0x57e1('0x9')][_0x57e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x461ad6,_0x476a3c,_0x3a99b9){return new BPromise(function(_0x375875,_0x39c020){return client[_0x57e1('0xb')](_0x461ad6,_0x3a99b9)['then'](function(_0x9fdf9c){logger[_0x57e1('0xc')](_0x57e1('0xd'),_0x476a3c,_0x57e1('0xe'));logger[_0x57e1('0xf')](_0x57e1('0x10'),_0x476a3c,_0x57e1('0xe'),JSON[_0x57e1('0x11')](_0x9fdf9c));if(_0x9fdf9c[_0x57e1('0x12')]){if(_0x9fdf9c[_0x57e1('0x12')]['code']===0x1f4){logger['error'](_0x57e1('0xd'),_0x476a3c,_0x9fdf9c[_0x57e1('0x12')][_0x57e1('0x13')]);return _0x39c020(_0x9fdf9c[_0x57e1('0x12')][_0x57e1('0x13')]);}logger[_0x57e1('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x476a3c,_0x9fdf9c[_0x57e1('0x12')][_0x57e1('0x13')]);return _0x375875(_0x9fdf9c[_0x57e1('0x12')][_0x57e1('0x13')]);}else{logger[_0x57e1('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x476a3c,'request\x20sent');_0x375875(_0x9fdf9c[_0x57e1('0x14')][_0x57e1('0x13')]);}})['catch'](function(_0x1387b5){logger[_0x57e1('0x12')](_0x57e1('0xd'),_0x476a3c,_0x1387b5);_0x39c020(_0x1387b5);});});} \ No newline at end of file +var _0xf9a4=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x5534e0,_0x5b0d6a){var _0x1b2f94=function(_0x201d91){while(--_0x201d91){_0x5534e0['push'](_0x5534e0['shift']());}};_0x1b2f94(++_0x5b0d6a);}(_0xf9a4,0x11e));var _0x4f9a=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xf9a4[_0x47aa64];return _0x549c7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f9a('0x0'));var BPromise=require(_0x4f9a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f9a('0x2'));var db=require(_0x4f9a('0x3'))['db'];var utils=require(_0x4f9a('0x4'));var logger=require(_0x4f9a('0x5'))(_0x4f9a('0x6'));var config=require('../../config/environment');var jayson=require(_0x4f9a('0x7'));var client=jayson[_0x4f9a('0x8')][_0x4f9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3051df,_0x21c238,_0x3f519f){return new BPromise(function(_0x47143a,_0x1be92b){return client['request'](_0x3051df,_0x3f519f)[_0x4f9a('0xa')](function(_0x24c2dc){logger[_0x4f9a('0xb')](_0x4f9a('0xc'),_0x21c238,_0x4f9a('0xd'));logger[_0x4f9a('0xe')](_0x4f9a('0xf'),_0x21c238,'request\x20sent',JSON['stringify'](_0x24c2dc));if(_0x24c2dc[_0x4f9a('0x10')]){if(_0x24c2dc['error']['code']===0x1f4){logger['error'](_0x4f9a('0xc'),_0x21c238,_0x24c2dc[_0x4f9a('0x10')][_0x4f9a('0x11')]);return _0x1be92b(_0x24c2dc['error'][_0x4f9a('0x11')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x21c238,_0x24c2dc[_0x4f9a('0x10')][_0x4f9a('0x11')]);return _0x47143a(_0x24c2dc['error']['message']);}else{logger[_0x4f9a('0xb')](_0x4f9a('0xc'),_0x21c238,_0x4f9a('0xd'));_0x47143a(_0x24c2dc[_0x4f9a('0x12')][_0x4f9a('0x11')]);}})[_0x4f9a('0x13')](function(_0x532888){logger[_0x4f9a('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x21c238,_0x532888);_0x1be92b(_0x532888);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index eb4183b..1c7b43b 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 _0x3402=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3402,0x1f0));var _0x2340=function(_0x2c7d9a,_0x31eb4b){_0x2c7d9a=_0x2c7d9a-0x0;var _0x45916f=_0x3402[_0x2c7d9a];return _0x45916f;};'use strict';var multer=require(_0x2340('0x0'));var util=require('util');var path=require(_0x2340('0x1'));var timeout=require(_0x2340('0x2'));var express=require(_0x2340('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2340('0x4'));var config=require(_0x2340('0x5'));var controller=require(_0x2340('0x6'));router[_0x2340('0x7')]('/',auth[_0x2340('0x8')](),controller['index']);router['get'](_0x2340('0x9'),auth[_0x2340('0x8')](),controller[_0x2340('0xa')]);router[_0x2340('0x7')](_0x2340('0xb'),auth['isAuthenticated'](),controller[_0x2340('0xc')]);router[_0x2340('0xd')]('/',auth[_0x2340('0x8')](),controller[_0x2340('0xe')]);router[_0x2340('0xf')]('/:id',auth[_0x2340('0x8')](),controller[_0x2340('0x10')]);router['delete']('/:id',auth[_0x2340('0x8')](),controller['destroy']);module[_0x2340('0x11')]=router; \ No newline at end of file +var _0x89c3=['Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','/describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0x89c3,0xff));var _0x389c=function(_0x3ce515,_0x64146b){_0x3ce515=_0x3ce515-0x0;var _0x14a03e=_0x89c3[_0x3ce515];return _0x14a03e;};'use strict';var multer=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var path=require(_0x389c('0x2'));var timeout=require(_0x389c('0x3'));var express=require(_0x389c('0x4'));var router=express[_0x389c('0x5')]();var auth=require(_0x389c('0x6'));var interaction=require(_0x389c('0x7'));var config=require('../../config/environment');var controller=require(_0x389c('0x8'));router['get']('/',auth[_0x389c('0x9')](),controller['index']);router['get'](_0x389c('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x389c('0xb')](_0x389c('0xc'),auth[_0x389c('0x9')](),controller[_0x389c('0xd')]);router[_0x389c('0xe')]('/',auth[_0x389c('0x9')](),controller[_0x389c('0xf')]);router[_0x389c('0x10')](_0x389c('0xc'),auth['isAuthenticated'](),controller[_0x389c('0x11')]);router[_0x389c('0x12')](_0x389c('0xc'),auth[_0x389c('0x9')](),controller[_0x389c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b40e6a9..e098853 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 _0x1d3a=['timeout','STRING','INTEGER','sequelize','exports','mouseOver'];(function(_0x299369,_0x27fcbe){var _0x49db36=function(_0x3b62a1){while(--_0x3b62a1){_0x299369['push'](_0x299369['shift']());}};_0x49db36(++_0x27fcbe);}(_0x1d3a,0x18f));var _0xa1d3=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x1d3a[_0x50aa2e];return _0x5e07f0;};'use strict';var Sequelize=require(_0xa1d3('0x0'));module[_0xa1d3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa1d3('0x2'),_0xa1d3('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xa1d3('0x4')]},'timeout':{'type':Sequelize[_0xa1d3('0x5')]}}; \ No newline at end of file +var _0xeec0=['mouseOver','INTEGER','exports','STRING','timeout'];(function(_0xc33523,_0x6ae768){var _0x1c937d=function(_0x65ed8f){while(--_0x65ed8f){_0xc33523['push'](_0xc33523['shift']());}};_0x1c937d(++_0x6ae768);}(_0xeec0,0x98));var _0x0eec=function(_0x45f580,_0x40a100){_0x45f580=_0x45f580-0x0;var _0x41a405=_0xeec0[_0x45f580];return _0x41a405;};'use strict';var Sequelize=require('sequelize');module[_0x0eec('0x0')]={'name':{'type':Sequelize[_0x0eec('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x0eec('0x2')),'defaultValue':_0x0eec('0x3')},'selector':{'type':Sequelize[_0x0eec('0x1')]},'timeout':{'type':Sequelize[_0x0eec('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c5a515c..55d19c3 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 _0x4253=['error','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','filters','intersection','query','attributes','fields','length','includeAll','include','merge','options','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy'];(function(_0xdabd59,_0x55e984){var _0x4af920=function(_0x7e5f46){while(--_0x7e5f46){_0xdabd59['push'](_0xdabd59['shift']());}};_0x4af920(++_0x55e984);}(_0x4253,0xcb));var _0x3425=function(_0x54d879,_0x35c691){_0x54d879=_0x54d879-0x0;var _0xf1c912=_0x4253[_0x54d879];return _0xf1c912;};'use strict';var pdf=require(_0x3425('0x0'));var emlformat=require(_0x3425('0x1'));var rimraf=require(_0x3425('0x2'));var zipdir=require(_0x3425('0x3'));var jsonpatch=require(_0x3425('0x4'));var rp=require(_0x3425('0x5'));var moment=require(_0x3425('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3425('0x7'));var util=require('util');var path=require(_0x3425('0x8'));var sox=require(_0x3425('0x9'));var csv=require(_0x3425('0xa'));var ejs=require(_0x3425('0xb'));var fs=require('fs');var _=require(_0x3425('0xc'));var squel=require(_0x3425('0xd'));var crypto=require(_0x3425('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3425('0xf'));var toCsv=require(_0x3425('0xa'));var querystring=require(_0x3425('0x10'));var Papa=require(_0x3425('0x11'));var Redis=require('ioredis');var qs=require(_0x3425('0x12'));var logger=require(_0x3425('0x13'))('api');var utils=require(_0x3425('0x14'));var config=require(_0x3425('0x15'));var db=require(_0x3425('0x16'))['db'];function respondWithStatusCode(_0xe106db,_0x3c3eae){_0x3c3eae=_0x3c3eae||0xcc;return function(_0x5a6494){if(_0x5a6494){return _0xe106db[_0x3425('0x17')](_0x3c3eae);}return _0xe106db[_0x3425('0x18')](_0x3c3eae)[_0x3425('0x19')]();};}function respondWithResult(_0x5c22a8,_0x252bee){_0x252bee=_0x252bee||0xc8;return function(_0x2ede78){if(_0x2ede78){return _0x5c22a8[_0x3425('0x18')](_0x252bee)[_0x3425('0x1a')](_0x2ede78);}};}function respondWithFilteredResult(_0xa04d4d,_0x5207f7){return function(_0x169c21){if(_0x169c21){var _0x44c194=_0x169c21[_0x3425('0x1b')],_0xb54f69=_0x5207f7[_0x3425('0x1c')],_0x33782a=_0x5207f7[_0x3425('0x1c')]+_0x5207f7[_0x3425('0x1d')],_0x350599;if(_0x33782a>=_0x44c194){_0x33782a=_0x44c194;_0x350599=0xc8;}else{_0x350599=0xce;}_0xa04d4d[_0x3425('0x18')](_0x350599);return _0xa04d4d[_0x3425('0x1e')](_0x3425('0x1f'),_0xb54f69+'-'+_0x33782a+'/'+_0x44c194)[_0x3425('0x1a')](_0x169c21);}return null;};}function patchUpdates(_0x4028f6){return function(_0x526da6){try{jsonpatch['apply'](_0x526da6,_0x4028f6,!![]);}catch(_0x212bd3){return BPromise[_0x3425('0x20')](_0x212bd3);}return _0x526da6[_0x3425('0x21')]();};}function saveUpdates(_0xeaead5,_0x571a67){return function(_0x3b2660){if(_0x3b2660){return _0x3b2660[_0x3425('0x22')](_0xeaead5)[_0x3425('0x23')](function(_0x182241){return _0x182241;});}return null;};}function removeEntity(_0x239779,_0xde83a1){return function(_0x314244){if(_0x314244){return _0x314244[_0x3425('0x24')]()[_0x3425('0x23')](function(){_0x239779[_0x3425('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa11ab,_0x1995e6){return function(_0x26ab07){if(!_0x26ab07){_0xa11ab['sendStatus'](0x194);}return _0x26ab07;};}function handleError(_0x24aee2,_0x1da8b4){_0x1da8b4=_0x1da8b4||0x1f4;return function(_0x3bc356){logger[_0x3425('0x25')](_0x3bc356['stack']);if(_0x3bc356[_0x3425('0x26')]){delete _0x3bc356[_0x3425('0x26')];}_0x24aee2[_0x3425('0x18')](_0x1da8b4)[_0x3425('0x27')](_0x3bc356);};}exports[_0x3425('0x28')]=function(_0x1fcd2d,_0x27323c){var _0x2e5f5c={'raw':!![],'where':{'id':_0x1fcd2d[_0x3425('0x29')]['id']}},_0x39edd5={};_0x39edd5[_0x3425('0x2a')]=_[_0x3425('0x2b')](db[_0x3425('0x2c')][_0x3425('0x2d')]);_0x39edd5['query']=_['keys'](_0x1fcd2d['query']);_0x39edd5[_0x3425('0x2e')]=_[_0x3425('0x2f')](_0x39edd5[_0x3425('0x2a')],_0x39edd5[_0x3425('0x30')]);_0x2e5f5c[_0x3425('0x31')]=_[_0x3425('0x2f')](_0x39edd5[_0x3425('0x2a')],qs[_0x3425('0x32')](_0x1fcd2d['query'][_0x3425('0x32')]));_0x2e5f5c[_0x3425('0x31')]=_0x2e5f5c['attributes'][_0x3425('0x33')]?_0x2e5f5c[_0x3425('0x31')]:_0x39edd5[_0x3425('0x2a')];if(_0x1fcd2d[_0x3425('0x30')][_0x3425('0x34')]){_0x2e5f5c[_0x3425('0x35')]=[{'all':!![]}];}_0x2e5f5c=_[_0x3425('0x36')]({},_0x2e5f5c,_0x1fcd2d[_0x3425('0x37')]);return db[_0x3425('0x2c')]['find'](_0x2e5f5c)[_0x3425('0x23')](handleEntityNotFound(_0x27323c,null))[_0x3425('0x23')](respondWithResult(_0x27323c,null))[_0x3425('0x38')](handleError(_0x27323c,null));};exports[_0x3425('0x39')]=function(_0x331fa6,_0x223e95){return db['ChatProactiveAction'][_0x3425('0x39')](_0x331fa6['body'],{})[_0x3425('0x23')](respondWithResult(_0x223e95,0xc9))[_0x3425('0x38')](handleError(_0x223e95,null));};exports[_0x3425('0x22')]=function(_0x4c6493,_0x3c60b2){if(_0x4c6493[_0x3425('0x3a')]['id']){delete _0x4c6493[_0x3425('0x3a')]['id'];}return db['ChatProactiveAction'][_0x3425('0x3b')]({'where':{'id':_0x4c6493[_0x3425('0x29')]['id']}})['then'](handleEntityNotFound(_0x3c60b2,null))[_0x3425('0x23')](saveUpdates(_0x4c6493[_0x3425('0x3a')],null))['then'](respondWithResult(_0x3c60b2,null))['catch'](handleError(_0x3c60b2,null));};exports[_0x3425('0x24')]=function(_0x3cf79d,_0x2a3f3d){return db[_0x3425('0x2c')]['find']({'where':{'id':_0x3cf79d[_0x3425('0x29')]['id']}})[_0x3425('0x23')](handleEntityNotFound(_0x2a3f3d,null))[_0x3425('0x23')](removeEntity(_0x2a3f3d,null))[_0x3425('0x38')](handleError(_0x2a3f3d,null));}; \ No newline at end of file +var _0xd80e=['then','end','sendStatus','name','send','show','params','model','ChatProactiveAction','query','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','html-pdf','rimraf','zip-dir','request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x99e6fc,_0xa6a33e){var _0x4b240e=function(_0x580337){while(--_0x580337){_0x99e6fc['push'](_0x99e6fc['shift']());}};_0x4b240e(++_0xa6a33e);}(_0xd80e,0x167));var _0xed80=function(_0x16dd01,_0x2029d8){_0x16dd01=_0x16dd01-0x0;var _0x23c07f=_0xd80e[_0x16dd01];return _0x23c07f;};'use strict';var pdf=require(_0xed80('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed80('0x1'));var zipdir=require(_0xed80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed80('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xed80('0x4'));var util=require('util');var path=require('path');var sox=require(_0xed80('0x5'));var csv=require(_0xed80('0x6'));var ejs=require(_0xed80('0x7'));var fs=require('fs');var _=require(_0xed80('0x8'));var squel=require(_0xed80('0x9'));var crypto=require(_0xed80('0xa'));var jsforce=require(_0xed80('0xb'));var deskjs=require(_0xed80('0xc'));var toCsv=require(_0xed80('0x6'));var querystring=require(_0xed80('0xd'));var Papa=require(_0xed80('0xe'));var Redis=require(_0xed80('0xf'));var qs=require(_0xed80('0x10'));var logger=require(_0xed80('0x11'))(_0xed80('0x12'));var utils=require(_0xed80('0x13'));var config=require(_0xed80('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x361bb5,_0x5aee76){_0x5aee76=_0x5aee76||0xcc;return function(_0x3c1de1){if(_0x3c1de1){return _0x361bb5['sendStatus'](_0x5aee76);}return _0x361bb5[_0xed80('0x15')](_0x5aee76)['end']();};}function respondWithResult(_0x169a12,_0x529850){_0x529850=_0x529850||0xc8;return function(_0x4d81d9){if(_0x4d81d9){return _0x169a12[_0xed80('0x15')](_0x529850)[_0xed80('0x16')](_0x4d81d9);}};}function respondWithFilteredResult(_0x593216,_0x3235b9){return function(_0x170871){if(_0x170871){var _0x1af530=_0x170871[_0xed80('0x17')],_0x4536c7=_0x3235b9[_0xed80('0x18')],_0x1f165d=_0x3235b9[_0xed80('0x18')]+_0x3235b9[_0xed80('0x19')],_0x2aa486;if(_0x1f165d>=_0x1af530){_0x1f165d=_0x1af530;_0x2aa486=0xc8;}else{_0x2aa486=0xce;}_0x593216[_0xed80('0x15')](_0x2aa486);return _0x593216[_0xed80('0x1a')](_0xed80('0x1b'),_0x4536c7+'-'+_0x1f165d+'/'+_0x1af530)['json'](_0x170871);}return null;};}function patchUpdates(_0x3643dc){return function(_0xaf8477){try{jsonpatch[_0xed80('0x1c')](_0xaf8477,_0x3643dc,!![]);}catch(_0x27e166){return BPromise[_0xed80('0x1d')](_0x27e166);}return _0xaf8477[_0xed80('0x1e')]();};}function saveUpdates(_0x4b49de,_0x227884){return function(_0x544460){if(_0x544460){return _0x544460[_0xed80('0x1f')](_0x4b49de)['then'](function(_0x278004){return _0x278004;});}return null;};}function removeEntity(_0x22bd68,_0xc86f0){return function(_0x4067d8){if(_0x4067d8){return _0x4067d8[_0xed80('0x20')]()[_0xed80('0x21')](function(){_0x22bd68[_0xed80('0x15')](0xcc)[_0xed80('0x22')]();});}};}function handleEntityNotFound(_0x516575,_0x5cfeb0){return function(_0x4c0c3d){if(!_0x4c0c3d){_0x516575[_0xed80('0x23')](0x194);}return _0x4c0c3d;};}function handleError(_0x2c86a1,_0x2dda28){_0x2dda28=_0x2dda28||0x1f4;return function(_0xb5e098){logger['error'](_0xb5e098['stack']);if(_0xb5e098[_0xed80('0x24')]){delete _0xb5e098[_0xed80('0x24')];}_0x2c86a1[_0xed80('0x15')](_0x2dda28)[_0xed80('0x25')](_0xb5e098);};}exports[_0xed80('0x26')]=function(_0x398568,_0x4113ac){var _0x5d6904={'raw':!![],'where':{'id':_0x398568[_0xed80('0x27')]['id']}},_0x32b89b={};_0x32b89b[_0xed80('0x28')]=_['keys'](db[_0xed80('0x29')]['rawAttributes']);_0x32b89b[_0xed80('0x2a')]=_[_0xed80('0x2b')](_0x398568['query']);_0x32b89b[_0xed80('0x2c')]=_[_0xed80('0x2d')](_0x32b89b[_0xed80('0x28')],_0x32b89b['query']);_0x5d6904[_0xed80('0x2e')]=_[_0xed80('0x2d')](_0x32b89b[_0xed80('0x28')],qs[_0xed80('0x2f')](_0x398568[_0xed80('0x2a')][_0xed80('0x2f')]));_0x5d6904['attributes']=_0x5d6904[_0xed80('0x2e')]['length']?_0x5d6904[_0xed80('0x2e')]:_0x32b89b[_0xed80('0x28')];if(_0x398568['query'][_0xed80('0x30')]){_0x5d6904[_0xed80('0x31')]=[{'all':!![]}];}_0x5d6904=_[_0xed80('0x32')]({},_0x5d6904,_0x398568[_0xed80('0x33')]);return db[_0xed80('0x29')][_0xed80('0x34')](_0x5d6904)[_0xed80('0x21')](handleEntityNotFound(_0x4113ac,null))[_0xed80('0x21')](respondWithResult(_0x4113ac,null))[_0xed80('0x35')](handleError(_0x4113ac,null));};exports[_0xed80('0x36')]=function(_0x4a9ab2,_0x52da53){return db[_0xed80('0x29')][_0xed80('0x36')](_0x4a9ab2[_0xed80('0x37')],{})[_0xed80('0x21')](respondWithResult(_0x52da53,0xc9))[_0xed80('0x35')](handleError(_0x52da53,null));};exports[_0xed80('0x1f')]=function(_0x3de871,_0x3896cf){if(_0x3de871[_0xed80('0x37')]['id']){delete _0x3de871[_0xed80('0x37')]['id'];}return db[_0xed80('0x29')]['find']({'where':{'id':_0x3de871[_0xed80('0x27')]['id']}})[_0xed80('0x21')](handleEntityNotFound(_0x3896cf,null))[_0xed80('0x21')](saveUpdates(_0x3de871['body'],null))[_0xed80('0x21')](respondWithResult(_0x3896cf,null))[_0xed80('0x35')](handleError(_0x3896cf,null));};exports[_0xed80('0x20')]=function(_0x4953b7,_0x1fee11){return db[_0xed80('0x29')][_0xed80('0x34')]({'where':{'id':_0x4953b7[_0xed80('0x27')]['id']}})[_0xed80('0x21')](handleEntityNotFound(_0x1fee11,null))[_0xed80('0x21')](removeEntity(_0x1fee11,null))[_0xed80('0x35')](handleError(_0x1fee11,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index d41a376..6c0c165 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 _0x1967=['chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','./chatProactiveAction.attributes','exports','ChatProactiveAction'];(function(_0x182e82,_0x30eef4){var _0x475fb4=function(_0x25a521){while(--_0x25a521){_0x182e82['push'](_0x182e82['shift']());}};_0x475fb4(++_0x30eef4);}(_0x1967,0x173));var _0x7196=function(_0x150366,_0x33c02c){_0x150366=_0x150366-0x0;var _0x151bb6=_0x1967[_0x150366];return _0x151bb6;};'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 +var _0x2032=['chat_proactive_actions','util','../../config/logger','api','bluebird','request-promise','exports','define','ChatProactiveAction'];(function(_0x167fda,_0x495c58){var _0x51285a=function(_0x4c9e23){while(--_0x4c9e23){_0x167fda['push'](_0x167fda['shift']());}};_0x51285a(++_0x495c58);}(_0x2032,0xd9));var _0x2203=function(_0x174d43,_0x18f60a){_0x174d43=_0x174d43-0x0;var _0x16a903=_0x2032[_0x174d43];return _0x16a903;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var attributes=require('./chatProactiveAction.attributes');module[_0x2203('0x5')]=function(_0x880dcd,_0x44ccfd){return _0x880dcd[_0x2203('0x6')](_0x2203('0x7'),attributes,{'tableName':_0x2203('0x8'),'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 dc135ca..9ae2e43 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 _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(_0x46625b,_0x5503a2){var _0x135aa9=function(_0x39eafb){while(--_0x39eafb){_0x46625b['push'](_0x46625b['shift']());}};_0x135aa9(++_0x5503a2);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('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 +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(_0x1b2220,_0x115039){var _0x805a42=function(_0x44e2ca){while(--_0x44e2ca){_0x1b2220['push'](_0x1b2220['shift']());}};_0x805a42(++_0x115039);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 00429cb..7df5b7a 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 _0xcae2=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','put','destroy','exports','multer'];(function(_0xd2de55,_0x5e73c6){var _0xae89de=function(_0x5c45ee){while(--_0x5c45ee){_0xd2de55['push'](_0xd2de55['shift']());}};_0xae89de(++_0x5e73c6);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2cae('0x0'));var util=require(_0x2cae('0x1'));var path=require(_0x2cae('0x2'));var timeout=require(_0x2cae('0x3'));var express=require(_0x2cae('0x4'));var router=express[_0x2cae('0x5')]();var auth=require(_0x2cae('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2cae('0x7'));var controller=require(_0x2cae('0x8'));router[_0x2cae('0x9')](_0x2cae('0xa'),auth['isAuthenticated'](),controller[_0x2cae('0xb')]);router[_0x2cae('0xc')]('/',auth[_0x2cae('0xd')](),controller[_0x2cae('0xe')]);router[_0x2cae('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2cae('0xa'),auth[_0x2cae('0xd')](),controller[_0x2cae('0x10')]);module[_0x2cae('0x11')]=router; \ No newline at end of file +var _0xf3e2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','/:id','isAuthenticated','show','post','create','put','update','destroy','exports'];(function(_0x36c0d1,_0x1d9948){var _0x59c859=function(_0x5d4c69){while(--_0x5d4c69){_0x36c0d1['push'](_0x36c0d1['shift']());}};_0x59c859(++_0x1d9948);}(_0xf3e2,0x168));var _0x2f3e=function(_0x11acac,_0x37d55f){_0x11acac=_0x11acac-0x0;var _0x1daa7e=_0xf3e2[_0x11acac];return _0x1daa7e;};'use strict';var multer=require(_0x2f3e('0x0'));var util=require(_0x2f3e('0x1'));var path=require(_0x2f3e('0x2'));var timeout=require(_0x2f3e('0x3'));var express=require(_0x2f3e('0x4'));var router=express[_0x2f3e('0x5')]();var auth=require(_0x2f3e('0x6'));var interaction=require(_0x2f3e('0x7'));var config=require('../../config/environment');var controller=require(_0x2f3e('0x8'));router['get'](_0x2f3e('0x9'),auth[_0x2f3e('0xa')](),controller[_0x2f3e('0xb')]);router[_0x2f3e('0xc')]('/',auth[_0x2f3e('0xa')](),controller[_0x2f3e('0xd')]);router[_0x2f3e('0xe')](_0x2f3e('0x9'),auth['isAuthenticated'](),controller[_0x2f3e('0xf')]);router['delete'](_0x2f3e('0x9'),auth[_0x2f3e('0xa')](),controller[_0x2f3e('0x10')]);module[_0x2f3e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index eef0083..a06dd4d 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 _0x7b28=['ENUM','rrmemory','roundrobin','exports','STRING','name','INTEGER'];(function(_0x1dc01f,_0x157a75){var _0x298041=function(_0x47fce1){while(--_0x47fce1){_0x1dc01f['push'](_0x1dc01f['shift']());}};_0x298041(++_0x157a75);}(_0x7b28,0x13e));var _0x87b2=function(_0x5ba03a,_0x2f2a39){_0x5ba03a=_0x5ba03a-0x0;var _0x49b58f=_0x7b28[_0x5ba03a];return _0x49b58f;};'use strict';var Sequelize=require('sequelize');module[_0x87b2('0x0')]={'name':{'type':Sequelize[_0x87b2('0x1')],'unique':_0x87b2('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x87b2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x87b2('0x4')](_0x87b2('0x5'),'beepall',_0x87b2('0x6'))}}; \ No newline at end of file +var _0xa2e6=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x3df140,_0x56be83){var _0x493646=function(_0x15a84b){while(--_0x15a84b){_0x3df140['push'](_0x3df140['shift']());}};_0x493646(++_0x56be83);}(_0xa2e6,0x13f));var _0x6a2e=function(_0x1cf51b,_0x327c87){_0x1cf51b=_0x1cf51b-0x0;var _0x328456=_0xa2e6[_0x1cf51b];return _0x328456;};'use strict';var Sequelize=require(_0x6a2e('0x0'));module[_0x6a2e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6a2e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6a2e('0x3')]},'timeout':{'type':Sequelize[_0x6a2e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6a2e('0x5')](_0x6a2e('0x6'),_0x6a2e('0x7'),_0x6a2e('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 07ea983..89dd1b5 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 _0xce96=['createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','User','Agents','addAgents','penalty','ids','removeTeams','union','removeAgents','spread','emit','userChatQueue:save','isArray','userChatQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','info','ChatQueue,\x20%s,\x20%s','debug','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','ChatQueue','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length','order','sort','pick','filters','add','day','merge','where','filter','map','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','nolimit','ChatQueueId','UserChatQueue','findAndCountAll','UserId','updatedAt'];(function(_0x294b7a,_0x51b167){var _0x30d2a3=function(_0x13a696){while(--_0x13a696){_0x294b7a['push'](_0x294b7a['shift']());}};_0x30d2a3(++_0x51b167);}(_0xce96,0x18f));var _0x6ce9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xce96[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x6ce9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6ce9('0x1'));var zipdir=require(_0x6ce9('0x2'));var jsonpatch=require(_0x6ce9('0x3'));var rp=require(_0x6ce9('0x4'));var moment=require(_0x6ce9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6ce9('0x6'));var util=require('util');var path=require(_0x6ce9('0x7'));var sox=require('sox');var csv=require(_0x6ce9('0x8'));var ejs=require(_0x6ce9('0x9'));var fs=require('fs');var _=require(_0x6ce9('0xa'));var squel=require('squel');var crypto=require(_0x6ce9('0xb'));var jsforce=require(_0x6ce9('0xc'));var deskjs=require(_0x6ce9('0xd'));var toCsv=require(_0x6ce9('0x8'));var querystring=require(_0x6ce9('0xe'));var Papa=require('papaparse');var Redis=require(_0x6ce9('0xf'));var qs=require(_0x6ce9('0x10'));var logger=require(_0x6ce9('0x11'))('api');var utils=require(_0x6ce9('0x12'));var config=require(_0x6ce9('0x13'));var db=require(_0x6ce9('0x14'))['db'];config[_0x6ce9('0x15')]=_[_0x6ce9('0x16')](config['redis'],{'host':_0x6ce9('0x17'),'port':0x18eb});var socket=require(_0x6ce9('0x18'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x6ce9('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6ce9('0x1a')][_0x6ce9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x147642,_0x36cfd4,_0x1be175,_0x5f1901){return new BPromise(function(_0x5b0df0,_0x3ea432){var _0x15e1c1=_0x5f1901||client;return _0x15e1c1[_0x6ce9('0x1c')](_0x147642,_0x1be175)['then'](function(_0x5b3d2b){logger[_0x6ce9('0x1d')](_0x6ce9('0x1e'),_0x36cfd4,'request\x20sent');logger[_0x6ce9('0x1f')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x36cfd4,'request\x20sent',JSON['stringify'](_0x5b3d2b));if(_0x5b3d2b[_0x6ce9('0x20')]){if(_0x5b3d2b[_0x6ce9('0x20')][_0x6ce9('0x21')]===0x1f4){logger[_0x6ce9('0x20')](_0x6ce9('0x1e'),_0x36cfd4,_0x5b3d2b[_0x6ce9('0x20')]['message']);return _0x3ea432(_0x5b3d2b[_0x6ce9('0x20')][_0x6ce9('0x22')]);}logger[_0x6ce9('0x20')]('ChatQueue,\x20%s,\x20%s',_0x36cfd4,_0x5b3d2b[_0x6ce9('0x20')][_0x6ce9('0x22')]);return _0x5b0df0(_0x5b3d2b[_0x6ce9('0x20')][_0x6ce9('0x22')]);}else{logger[_0x6ce9('0x1d')]('ChatQueue,\x20%s,\x20%s',_0x36cfd4,'request\x20sent');_0x5b0df0(_0x5b3d2b[_0x6ce9('0x23')]['message']);}})[_0x6ce9('0x24')](function(_0x539208){logger['error'](_0x6ce9('0x1e'),_0x36cfd4,_0x539208);_0x3ea432(_0x539208);});});}function respondWithStatusCode(_0x56251,_0x595d2b){_0x595d2b=_0x595d2b||0xcc;return function(_0x45e956){if(_0x45e956){return _0x56251[_0x6ce9('0x25')](_0x595d2b);}return _0x56251[_0x6ce9('0x26')](_0x595d2b)[_0x6ce9('0x27')]();};}function respondWithResult(_0x35bacf,_0x1e5a35){_0x1e5a35=_0x1e5a35||0xc8;return function(_0x49f801){if(_0x49f801){return _0x35bacf[_0x6ce9('0x26')](_0x1e5a35)[_0x6ce9('0x28')](_0x49f801);}};}function respondWithFilteredResult(_0x5b8747,_0x4c82e1){return function(_0x3ee17c){if(_0x3ee17c){var _0x2d839d=_0x3ee17c[_0x6ce9('0x29')],_0x38ee77=_0x4c82e1[_0x6ce9('0x2a')],_0x7b57c1=_0x4c82e1['offset']+_0x4c82e1[_0x6ce9('0x2b')],_0x2565a3;if(_0x7b57c1>=_0x2d839d){_0x7b57c1=_0x2d839d;_0x2565a3=0xc8;}else{_0x2565a3=0xce;}_0x5b8747[_0x6ce9('0x26')](_0x2565a3);return _0x5b8747[_0x6ce9('0x2c')]('Content-Range',_0x38ee77+'-'+_0x7b57c1+'/'+_0x2d839d)[_0x6ce9('0x28')](_0x3ee17c);}return null;};}function patchUpdates(_0x9b5e0c){return function(_0x294b3b){try{jsonpatch[_0x6ce9('0x2d')](_0x294b3b,_0x9b5e0c,!![]);}catch(_0x429376){return BPromise['reject'](_0x429376);}return _0x294b3b[_0x6ce9('0x2e')]();};}function saveUpdates(_0x5bd9e4,_0x4f5097){return function(_0x2a90f6){if(_0x2a90f6){return _0x2a90f6[_0x6ce9('0x2f')](_0x5bd9e4)[_0x6ce9('0x30')](function(_0x38da4a){return _0x38da4a;});}return null;};}function removeEntity(_0x410e2c,_0xf833f2){return function(_0x3c1260){if(_0x3c1260){return _0x3c1260[_0x6ce9('0x31')]()['then'](function(){var _0x397ba3=_0x3c1260[_0x6ce9('0x32')]({'plain':!![]});var _0x4b51f3=_0x6ce9('0x33');return db[_0x6ce9('0x34')]['destroy']({'where':{'type':_0x4b51f3,'resourceId':_0x397ba3['id']}})[_0x6ce9('0x30')](function(){return _0x3c1260;});})[_0x6ce9('0x30')](function(){_0x410e2c[_0x6ce9('0x26')](0xcc)[_0x6ce9('0x27')]();});}};}function handleEntityNotFound(_0x2be146,_0x5b796e){return function(_0x52e678){if(!_0x52e678){_0x2be146[_0x6ce9('0x25')](0x194);}return _0x52e678;};}function handleError(_0x5602ba,_0x3f0c04){_0x3f0c04=_0x3f0c04||0x1f4;return function(_0x11cf64){logger[_0x6ce9('0x20')](_0x11cf64[_0x6ce9('0x35')]);if(_0x11cf64[_0x6ce9('0x36')]){delete _0x11cf64[_0x6ce9('0x36')];}_0x5602ba['status'](_0x3f0c04)[_0x6ce9('0x37')](_0x11cf64);};}exports[_0x6ce9('0x38')]=function(_0x3362ff,_0x396c60){var _0x918621={},_0x53e35c={},_0x696a5b={'count':0x0,'rows':[]};var _0x32621=db[_0x6ce9('0x39')]['rawAttributes'];_0x53e35c['model']=_[_0x6ce9('0x3a')](_0x32621);var _0x3e0fd7={'dateStart':_0x3362ff[_0x6ce9('0x3b')][_0x6ce9('0x3c')],'dateEnd':_0x3362ff[_0x6ce9('0x3b')][_0x6ce9('0x3d')]};delete _0x3362ff[_0x6ce9('0x3b')]['dateStart'];delete _0x3362ff['query'][_0x6ce9('0x3d')];_0x53e35c[_0x6ce9('0x3b')]=_[_0x6ce9('0x3a')](_0x3362ff[_0x6ce9('0x3b')]);_0x53e35c['filters']=_[_0x6ce9('0x3e')](_0x53e35c[_0x6ce9('0x3f')],_0x53e35c[_0x6ce9('0x3b')]);_0x918621[_0x6ce9('0x40')]=_['intersection'](_0x53e35c[_0x6ce9('0x3f')],qs[_0x6ce9('0x41')](_0x3362ff['query'][_0x6ce9('0x41')]));_0x918621[_0x6ce9('0x40')]=_0x918621[_0x6ce9('0x40')][_0x6ce9('0x42')]?_0x918621[_0x6ce9('0x40')]:_0x53e35c[_0x6ce9('0x3f')];if(!_0x3362ff[_0x6ce9('0x3b')]['hasOwnProperty']('nolimit')){_0x918621[_0x6ce9('0x2b')]=qs[_0x6ce9('0x2b')](_0x3362ff[_0x6ce9('0x3b')][_0x6ce9('0x2b')]);_0x918621['offset']=qs['offset'](_0x3362ff[_0x6ce9('0x3b')][_0x6ce9('0x2a')]);}_0x918621[_0x6ce9('0x43')]=qs[_0x6ce9('0x44')](_0x3362ff[_0x6ce9('0x3b')][_0x6ce9('0x44')]);_0x918621['where']=qs['filters'](_[_0x6ce9('0x45')](_0x3362ff[_0x6ce9('0x3b')],_0x53e35c[_0x6ce9('0x46')]));if(_0x3e0fd7['dateStart']){if(_0x3e0fd7['dateEnd']){_0x3e0fd7[_0x6ce9('0x3d')]=moment(_0x3e0fd7[_0x6ce9('0x3d')])[_0x6ce9('0x47')](0x1,'day');}else{_0x3e0fd7[_0x6ce9('0x3d')]=moment(_0x3e0fd7[_0x6ce9('0x3c')])[_0x6ce9('0x47')](0x1,_0x6ce9('0x48'));}_[_0x6ce9('0x49')](_0x918621[_0x6ce9('0x4a')],{'createdAt':{'$gte':_0x3e0fd7[_0x6ce9('0x3c')],'$lte':_0x3e0fd7[_0x6ce9('0x3d')]}});}if(_0x3362ff[_0x6ce9('0x3b')][_0x6ce9('0x4b')]){_0x918621[_0x6ce9('0x4a')]=_[_0x6ce9('0x49')](_0x918621[_0x6ce9('0x4a')],{'$or':_[_0x6ce9('0x4c')](_0x918621[_0x6ce9('0x40')],function(_0x24eb88){var _0x546be6={};_0x546be6[_0x24eb88]={'$like':'%'+_0x3362ff[_0x6ce9('0x3b')][_0x6ce9('0x4b')]+'%'};return _0x546be6;})});}_0x918621=_[_0x6ce9('0x49')]({},_0x918621,_0x3362ff[_0x6ce9('0x4d')]);var _0x220b6b={'where':_0x918621[_0x6ce9('0x4a')]};return db['ChatQueue']['count'](_0x220b6b)[_0x6ce9('0x30')](function(_0x1b1e40){_0x696a5b[_0x6ce9('0x29')]=_0x1b1e40;if(_0x3362ff['query'][_0x6ce9('0x4e')]){_0x918621[_0x6ce9('0x4f')]=[{'all':!![]}];}return db[_0x6ce9('0x39')][_0x6ce9('0x50')](_0x918621);})[_0x6ce9('0x30')](function(_0x4d7317){_0x696a5b[_0x6ce9('0x51')]=_0x4d7317;return _0x696a5b;})['then'](respondWithFilteredResult(_0x396c60,_0x918621))[_0x6ce9('0x24')](handleError(_0x396c60,null));};exports[_0x6ce9('0x52')]=function(_0x4dd022,_0x3ee27c){var _0x41b1ea={'raw':!![],'where':{'id':_0x4dd022[_0x6ce9('0x53')]['id']}},_0x52458c={};_0x52458c['model']=_['keys'](db['ChatQueue'][_0x6ce9('0x54')]);_0x52458c['query']=_[_0x6ce9('0x3a')](_0x4dd022[_0x6ce9('0x3b')]);_0x52458c['filters']=_[_0x6ce9('0x3e')](_0x52458c[_0x6ce9('0x3f')],_0x52458c['query']);_0x41b1ea[_0x6ce9('0x40')]=_[_0x6ce9('0x3e')](_0x52458c['model'],qs[_0x6ce9('0x41')](_0x4dd022['query'][_0x6ce9('0x41')]));_0x41b1ea[_0x6ce9('0x40')]=_0x41b1ea[_0x6ce9('0x40')][_0x6ce9('0x42')]?_0x41b1ea[_0x6ce9('0x40')]:_0x52458c[_0x6ce9('0x3f')];if(_0x4dd022[_0x6ce9('0x3b')][_0x6ce9('0x4e')]){_0x41b1ea[_0x6ce9('0x4f')]=[{'all':!![]}];}_0x41b1ea=_[_0x6ce9('0x49')]({},_0x41b1ea,_0x4dd022['options']);return db['ChatQueue']['find'](_0x41b1ea)[_0x6ce9('0x30')](handleEntityNotFound(_0x3ee27c,null))[_0x6ce9('0x30')](respondWithResult(_0x3ee27c,null))['catch'](handleError(_0x3ee27c,null));};exports[_0x6ce9('0x55')]=function(_0xca867d,_0x5544c3){return db['ChatQueue'][_0x6ce9('0x55')](_0xca867d[_0x6ce9('0x56')],{})[_0x6ce9('0x30')](function(_0x1ce802){var _0x3be2de=_0xca867d[_0x6ce9('0x57')][_0x6ce9('0x32')]({'plain':!![]});if(!_0x3be2de)throw new Error(_0x6ce9('0x58'));if(_0x3be2de[_0x6ce9('0x59')]==='user'){var _0x237966=_0x1ce802['get']({'plain':!![]});var _0x3fe785=_0x6ce9('0x33');return db[_0x6ce9('0x5a')][_0x6ce9('0x5b')]({'where':{'name':_0x3fe785,'userProfileId':_0x3be2de[_0x6ce9('0x5c')]},'raw':!![]})[_0x6ce9('0x30')](function(_0x52d9ed){if(_0x52d9ed&&_0x52d9ed[_0x6ce9('0x5d')]===0x0){return db[_0x6ce9('0x34')][_0x6ce9('0x55')]({'name':_0x237966['name'],'resourceId':_0x237966['id'],'type':_0x52d9ed['name'],'sectionId':_0x52d9ed['id']},{})[_0x6ce9('0x30')](function(){return _0x1ce802;});}else{return _0x1ce802;}})['catch'](function(_0x4708fe){logger[_0x6ce9('0x20')](_0x6ce9('0x5e'),_0x4708fe);throw _0x4708fe;});}return _0x1ce802;})[_0x6ce9('0x30')](respondWithResult(_0x5544c3,0xc9))[_0x6ce9('0x24')](handleError(_0x5544c3,null));};exports[_0x6ce9('0x2f')]=function(_0x4c79cb,_0xd8621b){if(_0x4c79cb['body']['id']){delete _0x4c79cb[_0x6ce9('0x56')]['id'];}return db['ChatQueue'][_0x6ce9('0x5b')]({'where':{'id':_0x4c79cb['params']['id']}})[_0x6ce9('0x30')](handleEntityNotFound(_0xd8621b,null))['then'](saveUpdates(_0x4c79cb[_0x6ce9('0x56')],null))[_0x6ce9('0x30')](respondWithResult(_0xd8621b,null))[_0x6ce9('0x24')](handleError(_0xd8621b,null));};exports['destroy']=function(_0x3ed268,_0x4c6579){return db[_0x6ce9('0x39')][_0x6ce9('0x5b')]({'where':{'id':_0x3ed268[_0x6ce9('0x53')]['id']}})['then'](handleEntityNotFound(_0x4c6579,null))[_0x6ce9('0x30')](removeEntity(_0x4c6579,null))[_0x6ce9('0x24')](handleError(_0x4c6579,null));};exports[_0x6ce9('0x5f')]=function(_0x208098,_0x5d76ce){return db['ChatQueue'][_0x6ce9('0x5f')]()['then'](respondWithResult(_0x5d76ce,null))['catch'](handleError(_0x5d76ce,null));};exports[_0x6ce9('0x60')]=function(_0x47c728,_0x5a2718,_0x12b2fe){var _0x358e8a={'raw':!![],'where':{}},_0xb7c901={},_0x3597c3;return db[_0x6ce9('0x39')][_0x6ce9('0x61')]({'where':{'id':_0x47c728['params']['id']}})[_0x6ce9('0x30')](handleEntityNotFound(_0x5a2718,null))['then'](function(_0x49f8f2){if(_0x49f8f2){_0x3597c3=_0x49f8f2[_0x6ce9('0x32')]({'plain':!![]});_0xb7c901[_0x6ce9('0x3f')]=_['keys'](db['UserChatQueue'][_0x6ce9('0x54')]);_0xb7c901['query']=_[_0x6ce9('0x3a')](_0x47c728[_0x6ce9('0x3b')]);_0xb7c901[_0x6ce9('0x46')]=_['intersection'](_0xb7c901[_0x6ce9('0x3f')],_0xb7c901[_0x6ce9('0x3b')]);_0x358e8a[_0x6ce9('0x40')]=_[_0x6ce9('0x3e')](_0xb7c901[_0x6ce9('0x3f')],qs['fields'](_0x47c728[_0x6ce9('0x3b')][_0x6ce9('0x41')]));_0x358e8a[_0x6ce9('0x40')]=_0x358e8a[_0x6ce9('0x40')][_0x6ce9('0x42')]?_0x358e8a[_0x6ce9('0x40')]:_0xb7c901[_0x6ce9('0x3f')];if(!_0x47c728['query'][_0x6ce9('0x62')](_0x6ce9('0x63'))){_0x358e8a[_0x6ce9('0x2b')]=qs[_0x6ce9('0x2b')](_0x47c728[_0x6ce9('0x3b')]['limit']);_0x358e8a[_0x6ce9('0x2a')]=qs[_0x6ce9('0x2a')](_0x47c728[_0x6ce9('0x3b')][_0x6ce9('0x2a')]);}_0x358e8a['order']=qs[_0x6ce9('0x44')](_0x47c728['query'][_0x6ce9('0x44')]);_0x358e8a[_0x6ce9('0x4a')]=qs[_0x6ce9('0x46')](_[_0x6ce9('0x45')](_0x47c728['query'],_0xb7c901['filters']));_0x358e8a[_0x6ce9('0x4a')][_0x6ce9('0x64')]=_0x49f8f2['id'];if(_0x47c728[_0x6ce9('0x3b')]['filter']){_0x358e8a[_0x6ce9('0x4a')]=_[_0x6ce9('0x49')](_0x358e8a['where'],{'$or':_['map'](_0x358e8a['attributes'],function(_0x1bc747){var _0x35fdb1={};_0x35fdb1[_0x1bc747]={'$like':'%'+_0x47c728[_0x6ce9('0x3b')]['filter']+'%'};return _0x35fdb1;})});}_0x358e8a=_[_0x6ce9('0x49')]({},_0x358e8a,_0x47c728[_0x6ce9('0x4d')]);return db[_0x6ce9('0x65')]['findAll'](_0x358e8a);}})['then'](function(_0x22d77a){if(_0x22d77a){return db['User'][_0x6ce9('0x66')]({'where':{'id':_[_0x6ce9('0x4c')](_0x22d77a,_0x6ce9('0x67')),'role':'agent'},'attributes':['id','name','chatPause',_0x6ce9('0x68'),_0x6ce9('0x69')]});}})[_0x6ce9('0x30')](function(_0x2ac2c2){if(_0x2ac2c2){return{'count':_0x2ac2c2['count'],'rows':_[_0x6ce9('0x4c')](_0x2ac2c2[_0x6ce9('0x51')],function(_0x12d775){return{'membername':_0x12d775[_0x6ce9('0x36')],'UserId':_0x12d775['id'],'queue_name':_0x3597c3[_0x6ce9('0x36')],'ChatQueueId':_0x3597c3['id'],'interface':util[_0x6ce9('0x6a')](_0x6ce9('0x6b'),_0x6ce9('0x6c'),_0x12d775[_0x6ce9('0x36')]),'penalty':0x0,'paused':_0x12d775['chatPause'],'createdAt':_0x12d775[_0x6ce9('0x69')],'updatedAt':_0x12d775['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6ce9('0x30')](respondWithFilteredResult(_0x5a2718,_0x358e8a))[_0x6ce9('0x24')](handleError(_0x5a2718,null));};exports['getTeams']=function(_0xf9cb6e,_0x3bd82b,_0x1a04ce){var _0x2993d0={};var _0x460ab0={};var _0x9f0951;var _0x29937f;return db[_0x6ce9('0x39')]['findOne']({'where':{'id':_0xf9cb6e[_0x6ce9('0x53')]['id']}})[_0x6ce9('0x30')](handleEntityNotFound(_0x3bd82b,null))[_0x6ce9('0x30')](function(_0x402e5d){if(_0x402e5d){_0x9f0951=_0x402e5d;_0x460ab0[_0x6ce9('0x3f')]=_['keys'](db[_0x6ce9('0x6d')]['rawAttributes']);_0x460ab0[_0x6ce9('0x3b')]=_[_0x6ce9('0x3a')](_0xf9cb6e['query']);_0x460ab0[_0x6ce9('0x46')]=_[_0x6ce9('0x3e')](_0x460ab0[_0x6ce9('0x3f')],_0x460ab0[_0x6ce9('0x3b')]);_0x2993d0[_0x6ce9('0x40')]=_[_0x6ce9('0x3e')](_0x460ab0[_0x6ce9('0x3f')],qs[_0x6ce9('0x41')](_0xf9cb6e[_0x6ce9('0x3b')][_0x6ce9('0x41')]));_0x2993d0[_0x6ce9('0x40')]=_0x2993d0[_0x6ce9('0x40')][_0x6ce9('0x42')]?_0x2993d0['attributes']:_0x460ab0[_0x6ce9('0x3f')];_0x2993d0[_0x6ce9('0x43')]=qs[_0x6ce9('0x44')](_0xf9cb6e[_0x6ce9('0x3b')][_0x6ce9('0x44')]);_0x2993d0[_0x6ce9('0x4a')]=qs['filters'](_[_0x6ce9('0x45')](_0xf9cb6e['query'],_0x460ab0[_0x6ce9('0x46')]));if(_0xf9cb6e[_0x6ce9('0x3b')][_0x6ce9('0x4b')]){_0x2993d0['where']=_[_0x6ce9('0x49')](_0x2993d0[_0x6ce9('0x4a')],{'$or':_[_0x6ce9('0x4c')](_0x2993d0['attributes'],function(_0x10279b){var _0x4e8463={};_0x4e8463[_0x10279b]={'$like':'%'+_0xf9cb6e['query']['filter']+'%'};return _0x4e8463;})});}_0x2993d0=_['merge']({},_0x2993d0,_0xf9cb6e[_0x6ce9('0x4d')]);return _0x9f0951[_0x6ce9('0x6e')](_0x2993d0);}})['then'](function(_0x2d7cf7){if(_0x2d7cf7){_0x29937f=_0x2d7cf7[_0x6ce9('0x42')];if(!_0xf9cb6e[_0x6ce9('0x3b')][_0x6ce9('0x62')](_0x6ce9('0x63'))){_0x2993d0[_0x6ce9('0x2b')]=qs[_0x6ce9('0x2b')](_0xf9cb6e[_0x6ce9('0x3b')][_0x6ce9('0x2b')]);_0x2993d0[_0x6ce9('0x2a')]=qs[_0x6ce9('0x2a')](_0xf9cb6e[_0x6ce9('0x3b')][_0x6ce9('0x2a')]);}return _0x9f0951[_0x6ce9('0x6e')](_0x2993d0);}})[_0x6ce9('0x30')](function(_0x87d9a1){if(_0x87d9a1){return _0x87d9a1?{'count':_0x29937f,'rows':_0x87d9a1}:null;}})[_0x6ce9('0x30')](respondWithResult(_0x3bd82b,null))[_0x6ce9('0x24')](handleError(_0x3bd82b,null));};exports[_0x6ce9('0x6f')]=function(_0x6ef741,_0x36fef4,_0x9a3cf8){var _0x19517a=[];var _0x19c93d;return db[_0x6ce9('0x6d')]['findAll']({'where':{'id':_0x6ef741['body']['ids']},'attributes':['id'],'include':[{'model':db[_0x6ce9('0x70')],'as':_0x6ce9('0x71'),'attributes':['id'],'raw':!![]}]})[_0x6ce9('0x30')](function(_0x462409){if(_0x462409){for(var _0x2d3bf7=0x0;_0x2d3bf7<_0x462409['length'];_0x2d3bf7+=0x1){for(var _0x5f1b8a=0x0;_0x5f1b8a<_0x462409[_0x2d3bf7][_0x6ce9('0x71')][_0x6ce9('0x42')];_0x5f1b8a+=0x1){_0x19517a=_['union'](_0x19517a,[_0x462409[_0x2d3bf7][_0x6ce9('0x71')][_0x5f1b8a]['id']]);}}return _0x19517a;}})[_0x6ce9('0x30')](function(_0x2eb67c){if(_0x2eb67c){return db[_0x6ce9('0x39')]['find']({'where':{'id':_0x6ef741[_0x6ce9('0x53')]['id']}});}})['then'](function(_0x1bd1bc){if(_0x1bd1bc){_0x19c93d=_0x1bd1bc;return _0x19c93d[_0x6ce9('0x72')](_0x19517a,{'penalty':_0x6ef741[_0x6ce9('0x56')][_0x6ce9('0x73')]});}})[_0x6ce9('0x30')](function(_0x2594fd){if(_0x2594fd){return _0x19c93d[_0x6ce9('0x6f')](_0x6ef741[_0x6ce9('0x56')][_0x6ce9('0x74')]);}})[_0x6ce9('0x30')](handleEntityNotFound(_0x36fef4,null))[_0x6ce9('0x30')](respondWithStatusCode(_0x36fef4,null))[_0x6ce9('0x24')](handleError(_0x36fef4,null));};exports[_0x6ce9('0x75')]=function(_0xf8c65c,_0x16ff91,_0x2ade07){var _0x3fbed6=[];var _0x26982b;return db[_0x6ce9('0x6d')][_0x6ce9('0x50')]({'where':{'id':_0xf8c65c[_0x6ce9('0x3b')][_0x6ce9('0x74')]},'attributes':['id'],'include':[{'model':db[_0x6ce9('0x70')],'as':_0x6ce9('0x71'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x54ce97){if(_0x54ce97){for(var _0x527301=0x0;_0x527301<_0x54ce97[_0x6ce9('0x42')];_0x527301+=0x1){for(var _0xc739f=0x0;_0xc739f<_0x54ce97[_0x527301][_0x6ce9('0x71')][_0x6ce9('0x42')];_0xc739f+=0x1){_0x3fbed6=_[_0x6ce9('0x76')](_0x3fbed6,[_0x54ce97[_0x527301][_0x6ce9('0x71')][_0xc739f]['id']]);}}return _0x3fbed6;}})[_0x6ce9('0x30')](function(_0x4d199c){if(_0x4d199c){return db['ChatQueue'][_0x6ce9('0x5b')]({'where':{'id':_0xf8c65c[_0x6ce9('0x53')]['id']}});}})['then'](function(_0x25cffa){if(_0x25cffa){_0x26982b=_0x25cffa;return _0x26982b[_0x6ce9('0x77')](_0x3fbed6);}})[_0x6ce9('0x30')](function(_0x799c51){if(_0x26982b){return _0x26982b['removeTeams'](_0xf8c65c['query']['ids']);}})['then'](handleEntityNotFound(_0x16ff91,null))[_0x6ce9('0x30')](respondWithStatusCode(_0x16ff91,null))[_0x6ce9('0x24')](handleError(_0x16ff91,null));};exports[_0x6ce9('0x72')]=function(_0x67f946,_0x233d13,_0x458395){return db[_0x6ce9('0x39')]['find']({'where':{'id':_0x67f946[_0x6ce9('0x53')]['id']}})[_0x6ce9('0x30')](handleEntityNotFound(_0x233d13,null))[_0x6ce9('0x30')](function(_0x501113){if(_0x501113){return _0x501113[_0x6ce9('0x72')](_0x67f946[_0x6ce9('0x56')]['ids'],_['omit'](_0x67f946[_0x6ce9('0x56')],[_0x6ce9('0x74'),'id'])||{})[_0x6ce9('0x78')](function(_0x48d334){for(var _0x5c6a0b=0x0;_0x5c6a0b<_0x67f946[_0x6ce9('0x56')][_0x6ce9('0x74')][_0x6ce9('0x42')];_0x5c6a0b+=0x1){socket[_0x6ce9('0x79')](_0x6ce9('0x7a'),{'UserId':_0x67f946[_0x6ce9('0x56')][_0x6ce9('0x74')][_0x5c6a0b],'ChatQueueId':_0x67f946[_0x6ce9('0x53')]['id']});}return _0x48d334;});}})['then'](respondWithResult(_0x233d13,null))[_0x6ce9('0x24')](handleError(_0x233d13,null));};exports[_0x6ce9('0x77')]=function(_0x131139,_0x32872f,_0x5d3829){var _0x5215dd;return db['ChatQueue'][_0x6ce9('0x5b')]({'where':{'id':_0x131139[_0x6ce9('0x53')]['id']}})['then'](handleEntityNotFound(_0x32872f,null))[_0x6ce9('0x30')](function(_0x595b7d){if(_0x595b7d){return _0x595b7d['removeAgents'](_0x131139['query'][_0x6ce9('0x74')])[_0x6ce9('0x30')](function(_0x108a28){if(_[_0x6ce9('0x7b')](_0x131139[_0x6ce9('0x3b')][_0x6ce9('0x74')])){for(var _0x3f2632=0x0;_0x3f2632<_0x131139[_0x6ce9('0x3b')][_0x6ce9('0x74')][_0x6ce9('0x42')];_0x3f2632+=0x1){socket[_0x6ce9('0x79')](_0x6ce9('0x7c'),{'UserId':_0x131139[_0x6ce9('0x3b')][_0x6ce9('0x74')][_0x3f2632],'ChatQueueId':_0x131139['params']['id']});}}else{socket[_0x6ce9('0x79')](_0x6ce9('0x7c'),{'UserId':_0x131139[_0x6ce9('0x3b')]['ids'],'ChatQueueId':_0x131139[_0x6ce9('0x53')]['id']});}});}})[_0x6ce9('0x30')](respondWithStatusCode(_0x32872f,null))[_0x6ce9('0x24')](handleError(_0x32872f,null));};exports[_0x6ce9('0x7d')]=function(_0x1c701b,_0x3de839,_0x396f74){var _0x36b1d8={};var _0xf2951={};var _0x53b0bd;var _0x4424ca;return db['ChatQueue']['findOne']({'where':{'id':_0x1c701b[_0x6ce9('0x53')]['id']}})[_0x6ce9('0x30')](handleEntityNotFound(_0x3de839,null))['then'](function(_0x3be000){if(_0x3be000){_0x53b0bd=_0x3be000;_0xf2951['model']=_[_0x6ce9('0x3a')](db[_0x6ce9('0x70')][_0x6ce9('0x54')]);_0xf2951[_0x6ce9('0x3b')]=_[_0x6ce9('0x3a')](_0x1c701b['query']);_0xf2951[_0x6ce9('0x46')]=_[_0x6ce9('0x3e')](_0xf2951[_0x6ce9('0x3f')],_0xf2951[_0x6ce9('0x3b')]);_0x36b1d8[_0x6ce9('0x40')]=_['intersection'](_0xf2951[_0x6ce9('0x3f')],qs[_0x6ce9('0x41')](_0x1c701b[_0x6ce9('0x3b')]['fields']));_0x36b1d8[_0x6ce9('0x40')]=_0x36b1d8[_0x6ce9('0x40')][_0x6ce9('0x42')]?_0x36b1d8[_0x6ce9('0x40')]:_0xf2951['model'];_0x36b1d8[_0x6ce9('0x43')]=qs[_0x6ce9('0x44')](_0x1c701b[_0x6ce9('0x3b')][_0x6ce9('0x44')]);_0x36b1d8['where']=qs[_0x6ce9('0x46')](_['pick'](_0x1c701b[_0x6ce9('0x3b')],_0xf2951[_0x6ce9('0x46')]));if(_0x1c701b[_0x6ce9('0x3b')][_0x6ce9('0x4b')]){_0x36b1d8['where']=_['merge'](_0x36b1d8['where'],{'$or':_[_0x6ce9('0x4c')](_0x36b1d8['attributes'],function(_0x85cf14){var _0x550cf0={};_0x550cf0[_0x85cf14]={'$like':'%'+_0x1c701b[_0x6ce9('0x3b')][_0x6ce9('0x4b')]+'%'};return _0x550cf0;})});}_0x36b1d8=_[_0x6ce9('0x49')]({},_0x36b1d8,_0x1c701b['options']);return _0x53b0bd[_0x6ce9('0x7d')](_0x36b1d8);}})['then'](function(_0x10905c){if(_0x10905c){_0x4424ca=_0x10905c[_0x6ce9('0x42')];if(!_0x1c701b['query']['hasOwnProperty'](_0x6ce9('0x63'))){_0x36b1d8['limit']=qs['limit'](_0x1c701b[_0x6ce9('0x3b')][_0x6ce9('0x2b')]);_0x36b1d8[_0x6ce9('0x2a')]=qs[_0x6ce9('0x2a')](_0x1c701b[_0x6ce9('0x3b')]['offset']);}return _0x53b0bd[_0x6ce9('0x7d')](_0x36b1d8);}})['then'](function(_0x36a4e6){if(_0x36a4e6){return _0x36a4e6?{'count':_0x4424ca,'rows':_0x36a4e6}:null;}})[_0x6ce9('0x30')](respondWithResult(_0x3de839,null))[_0x6ce9('0x24')](handleError(_0x3de839,null));}; \ No newline at end of file +var _0x72ff=['../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','count','offset','set','Content-Range','update','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','name','send','index','ChatQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','filter','map','merge','options','includeAll','rows','show','params','include','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','describe','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','chatPause','getTeams','Team','addTeams','findAll','ids','Agents','union','addAgents','penalty','removeTeams','removeAgents','omit','spread','isArray','emit','userChatQueue:remove','getAgents','html-pdf','rimraf','request-promise','moment','mustache','util','path','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1961af,_0x13f75c){var _0x2a2bc7=function(_0x52a937){while(--_0x52a937){_0x1961af['push'](_0x1961af['shift']());}};_0x2a2bc7(++_0x13f75c);}(_0x72ff,0x162));var _0xf72f=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x72ff[_0x3b0731];return _0x4204d7;};'use strict';var pdf=require(_0xf72f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf72f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf72f('0x2'));var moment=require(_0xf72f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf72f('0x4'));var util=require(_0xf72f('0x5'));var path=require(_0xf72f('0x6'));var sox=require('sox');var csv=require(_0xf72f('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf72f('0x8'));var deskjs=require(_0xf72f('0x9'));var toCsv=require(_0xf72f('0x7'));var querystring=require(_0xf72f('0xa'));var Papa=require(_0xf72f('0xb'));var Redis=require(_0xf72f('0xc'));var qs=require(_0xf72f('0xd'));var logger=require(_0xf72f('0xe'))(_0xf72f('0xf'));var utils=require(_0xf72f('0x10'));var config=require(_0xf72f('0x11'));var db=require(_0xf72f('0x12'))['db'];config[_0xf72f('0x13')]=_[_0xf72f('0x14')](config[_0xf72f('0x13')],{'host':_0xf72f('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf72f('0x13')]));require(_0xf72f('0x16'))[_0xf72f('0x17')](socket);var jayson=require(_0xf72f('0x18'));var client=jayson[_0xf72f('0x19')][_0xf72f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x26635f,_0x4b53fd,_0x48533f,_0x54654f){return new BPromise(function(_0x267395,_0x54dab8){var _0x3d36d3=_0x54654f||client;return _0x3d36d3[_0xf72f('0x1b')](_0x26635f,_0x48533f)[_0xf72f('0x1c')](function(_0x1a0084){logger['info'](_0xf72f('0x1d'),_0x4b53fd,_0xf72f('0x1e'));logger[_0xf72f('0x1f')](_0xf72f('0x20'),_0x4b53fd,_0xf72f('0x1e'),JSON[_0xf72f('0x21')](_0x1a0084));if(_0x1a0084[_0xf72f('0x22')]){if(_0x1a0084[_0xf72f('0x22')][_0xf72f('0x23')]===0x1f4){logger[_0xf72f('0x22')](_0xf72f('0x1d'),_0x4b53fd,_0x1a0084[_0xf72f('0x22')][_0xf72f('0x24')]);return _0x54dab8(_0x1a0084[_0xf72f('0x22')]['message']);}logger['error'](_0xf72f('0x1d'),_0x4b53fd,_0x1a0084['error'][_0xf72f('0x24')]);return _0x267395(_0x1a0084[_0xf72f('0x22')]['message']);}else{logger[_0xf72f('0x25')](_0xf72f('0x1d'),_0x4b53fd,_0xf72f('0x1e'));_0x267395(_0x1a0084[_0xf72f('0x26')]['message']);}})[_0xf72f('0x27')](function(_0x58db61){logger[_0xf72f('0x22')](_0xf72f('0x1d'),_0x4b53fd,_0x58db61);_0x54dab8(_0x58db61);});});}function respondWithStatusCode(_0x29103e,_0x532457){_0x532457=_0x532457||0xcc;return function(_0x16f345){if(_0x16f345){return _0x29103e['sendStatus'](_0x532457);}return _0x29103e[_0xf72f('0x28')](_0x532457)[_0xf72f('0x29')]();};}function respondWithResult(_0x31c0fe,_0x36d85a){_0x36d85a=_0x36d85a||0xc8;return function(_0x1135c9){if(_0x1135c9){return _0x31c0fe['status'](_0x36d85a)[_0xf72f('0x2a')](_0x1135c9);}};}function respondWithFilteredResult(_0x333d2b,_0x28d3a6){return function(_0x3acb8a){if(_0x3acb8a){var _0x184093=_0x3acb8a[_0xf72f('0x2b')],_0x3d83af=_0x28d3a6[_0xf72f('0x2c')],_0x14aa8f=_0x28d3a6[_0xf72f('0x2c')]+_0x28d3a6['limit'],_0xd21161;if(_0x14aa8f>=_0x184093){_0x14aa8f=_0x184093;_0xd21161=0xc8;}else{_0xd21161=0xce;}_0x333d2b[_0xf72f('0x28')](_0xd21161);return _0x333d2b[_0xf72f('0x2d')](_0xf72f('0x2e'),_0x3d83af+'-'+_0x14aa8f+'/'+_0x184093)[_0xf72f('0x2a')](_0x3acb8a);}return null;};}function patchUpdates(_0x2cf4ce){return function(_0x31ab08){try{jsonpatch['apply'](_0x31ab08,_0x2cf4ce,!![]);}catch(_0x54945b){return BPromise['reject'](_0x54945b);}return _0x31ab08['save']();};}function saveUpdates(_0x2fa9b9,_0x1ee860){return function(_0x2a1c3e){if(_0x2a1c3e){return _0x2a1c3e[_0xf72f('0x2f')](_0x2fa9b9)[_0xf72f('0x1c')](function(_0x2b9a1d){return _0x2b9a1d;});}return null;};}function removeEntity(_0x1c4edf,_0xe9a384){return function(_0x386f22){if(_0x386f22){return _0x386f22[_0xf72f('0x30')]()[_0xf72f('0x1c')](function(){var _0x266cd8=_0x386f22[_0xf72f('0x31')]({'plain':!![]});var _0x1a6520=_0xf72f('0x32');return db[_0xf72f('0x33')][_0xf72f('0x30')]({'where':{'type':_0x1a6520,'resourceId':_0x266cd8['id']}})[_0xf72f('0x1c')](function(){return _0x386f22;});})[_0xf72f('0x1c')](function(){_0x1c4edf[_0xf72f('0x28')](0xcc)[_0xf72f('0x29')]();});}};}function handleEntityNotFound(_0x2fa63e,_0x54808b){return function(_0x4d16ff){if(!_0x4d16ff){_0x2fa63e[_0xf72f('0x34')](0x194);}return _0x4d16ff;};}function handleError(_0x26adcd,_0x24962b){_0x24962b=_0x24962b||0x1f4;return function(_0x35dc73){logger[_0xf72f('0x22')](_0x35dc73[_0xf72f('0x35')]);if(_0x35dc73['name']){delete _0x35dc73[_0xf72f('0x36')];}_0x26adcd[_0xf72f('0x28')](_0x24962b)[_0xf72f('0x37')](_0x35dc73);};}exports[_0xf72f('0x38')]=function(_0x1bf421,_0x172acf){var _0x2f4bcd={},_0x244040={},_0x6e49b7={'count':0x0,'rows':[]};var _0x250aaa=db[_0xf72f('0x39')][_0xf72f('0x3a')];_0x244040[_0xf72f('0x3b')]=_[_0xf72f('0x3c')](_0x250aaa);var _0xf8469c={'dateStart':_0x1bf421[_0xf72f('0x3d')][_0xf72f('0x3e')],'dateEnd':_0x1bf421['query']['dateEnd']};delete _0x1bf421[_0xf72f('0x3d')][_0xf72f('0x3e')];delete _0x1bf421[_0xf72f('0x3d')][_0xf72f('0x3f')];_0x244040['query']=_['keys'](_0x1bf421[_0xf72f('0x3d')]);_0x244040[_0xf72f('0x40')]=_[_0xf72f('0x41')](_0x244040['model'],_0x244040[_0xf72f('0x3d')]);_0x2f4bcd[_0xf72f('0x42')]=_[_0xf72f('0x41')](_0x244040[_0xf72f('0x3b')],qs[_0xf72f('0x43')](_0x1bf421[_0xf72f('0x3d')][_0xf72f('0x43')]));_0x2f4bcd[_0xf72f('0x42')]=_0x2f4bcd[_0xf72f('0x42')][_0xf72f('0x44')]?_0x2f4bcd['attributes']:_0x244040['model'];if(!_0x1bf421[_0xf72f('0x3d')][_0xf72f('0x45')](_0xf72f('0x46'))){_0x2f4bcd[_0xf72f('0x47')]=qs[_0xf72f('0x47')](_0x1bf421[_0xf72f('0x3d')][_0xf72f('0x47')]);_0x2f4bcd[_0xf72f('0x2c')]=qs[_0xf72f('0x2c')](_0x1bf421[_0xf72f('0x3d')]['offset']);}_0x2f4bcd[_0xf72f('0x48')]=qs['sort'](_0x1bf421[_0xf72f('0x3d')][_0xf72f('0x49')]);_0x2f4bcd[_0xf72f('0x4a')]=qs[_0xf72f('0x40')](_[_0xf72f('0x4b')](_0x1bf421[_0xf72f('0x3d')],_0x244040[_0xf72f('0x40')]));if(_0xf8469c[_0xf72f('0x3e')]){if(_0xf8469c['dateEnd']){_0xf8469c['dateEnd']=moment(_0xf8469c[_0xf72f('0x3f')])[_0xf72f('0x4c')](0x1,'day');}else{_0xf8469c['dateEnd']=moment(_0xf8469c['dateStart'])[_0xf72f('0x4c')](0x1,_0xf72f('0x4d'));}_['merge'](_0x2f4bcd['where'],{'createdAt':{'$gte':_0xf8469c['dateStart'],'$lte':_0xf8469c[_0xf72f('0x3f')]}});}if(_0x1bf421[_0xf72f('0x3d')][_0xf72f('0x4e')]){_0x2f4bcd['where']=_['merge'](_0x2f4bcd[_0xf72f('0x4a')],{'$or':_[_0xf72f('0x4f')](_0x2f4bcd[_0xf72f('0x42')],function(_0x22e67f){var _0x27e15e={};_0x27e15e[_0x22e67f]={'$like':'%'+_0x1bf421[_0xf72f('0x3d')][_0xf72f('0x4e')]+'%'};return _0x27e15e;})});}_0x2f4bcd=_[_0xf72f('0x50')]({},_0x2f4bcd,_0x1bf421[_0xf72f('0x51')]);var _0x28dba1={'where':_0x2f4bcd[_0xf72f('0x4a')]};return db[_0xf72f('0x39')][_0xf72f('0x2b')](_0x28dba1)[_0xf72f('0x1c')](function(_0x4bcc9f){_0x6e49b7['count']=_0x4bcc9f;if(_0x1bf421[_0xf72f('0x3d')][_0xf72f('0x52')]){_0x2f4bcd['include']=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x2f4bcd);})[_0xf72f('0x1c')](function(_0x4cad94){_0x6e49b7[_0xf72f('0x53')]=_0x4cad94;return _0x6e49b7;})[_0xf72f('0x1c')](respondWithFilteredResult(_0x172acf,_0x2f4bcd))[_0xf72f('0x27')](handleError(_0x172acf,null));};exports[_0xf72f('0x54')]=function(_0x3898e8,_0x1c5181){var _0x10888b={'raw':!![],'where':{'id':_0x3898e8[_0xf72f('0x55')]['id']}},_0x414d98={};_0x414d98[_0xf72f('0x3b')]=_['keys'](db[_0xf72f('0x39')][_0xf72f('0x3a')]);_0x414d98[_0xf72f('0x3d')]=_['keys'](_0x3898e8[_0xf72f('0x3d')]);_0x414d98[_0xf72f('0x40')]=_[_0xf72f('0x41')](_0x414d98[_0xf72f('0x3b')],_0x414d98['query']);_0x10888b[_0xf72f('0x42')]=_['intersection'](_0x414d98[_0xf72f('0x3b')],qs[_0xf72f('0x43')](_0x3898e8[_0xf72f('0x3d')]['fields']));_0x10888b['attributes']=_0x10888b[_0xf72f('0x42')][_0xf72f('0x44')]?_0x10888b[_0xf72f('0x42')]:_0x414d98[_0xf72f('0x3b')];if(_0x3898e8[_0xf72f('0x3d')]['includeAll']){_0x10888b[_0xf72f('0x56')]=[{'all':!![]}];}_0x10888b=_[_0xf72f('0x50')]({},_0x10888b,_0x3898e8[_0xf72f('0x51')]);return db[_0xf72f('0x39')][_0xf72f('0x57')](_0x10888b)[_0xf72f('0x1c')](handleEntityNotFound(_0x1c5181,null))[_0xf72f('0x1c')](respondWithResult(_0x1c5181,null))[_0xf72f('0x27')](handleError(_0x1c5181,null));};exports[_0xf72f('0x58')]=function(_0x28bc0c,_0x1a694f){return db['ChatQueue'][_0xf72f('0x58')](_0x28bc0c[_0xf72f('0x59')],{})[_0xf72f('0x1c')](function(_0x99a3f1){var _0x28c46c=_0x28bc0c['user'][_0xf72f('0x31')]({'plain':!![]});if(!_0x28c46c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28c46c[_0xf72f('0x5a')]===_0xf72f('0x5b')){var _0x5c1426=_0x99a3f1[_0xf72f('0x31')]({'plain':!![]});var _0x4679c1='ChatQueues';return db[_0xf72f('0x5c')][_0xf72f('0x57')]({'where':{'name':_0x4679c1,'userProfileId':_0x28c46c[_0xf72f('0x5d')]},'raw':!![]})['then'](function(_0x2f37f7){if(_0x2f37f7&&_0x2f37f7[_0xf72f('0x5e')]===0x0){return db[_0xf72f('0x33')][_0xf72f('0x58')]({'name':_0x5c1426[_0xf72f('0x36')],'resourceId':_0x5c1426['id'],'type':_0x2f37f7[_0xf72f('0x36')],'sectionId':_0x2f37f7['id']},{})[_0xf72f('0x1c')](function(){return _0x99a3f1;});}else{return _0x99a3f1;}})[_0xf72f('0x27')](function(_0x3c0a08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0a08);throw _0x3c0a08;});}return _0x99a3f1;})[_0xf72f('0x1c')](respondWithResult(_0x1a694f,0xc9))[_0xf72f('0x27')](handleError(_0x1a694f,null));};exports[_0xf72f('0x2f')]=function(_0x3d7b7e,_0x7e4fe9){if(_0x3d7b7e[_0xf72f('0x59')]['id']){delete _0x3d7b7e[_0xf72f('0x59')]['id'];}return db[_0xf72f('0x39')][_0xf72f('0x57')]({'where':{'id':_0x3d7b7e[_0xf72f('0x55')]['id']}})[_0xf72f('0x1c')](handleEntityNotFound(_0x7e4fe9,null))[_0xf72f('0x1c')](saveUpdates(_0x3d7b7e[_0xf72f('0x59')],null))[_0xf72f('0x1c')](respondWithResult(_0x7e4fe9,null))[_0xf72f('0x27')](handleError(_0x7e4fe9,null));};exports[_0xf72f('0x30')]=function(_0x4c350d,_0x4d5486){return db[_0xf72f('0x39')][_0xf72f('0x57')]({'where':{'id':_0x4c350d[_0xf72f('0x55')]['id']}})[_0xf72f('0x1c')](handleEntityNotFound(_0x4d5486,null))[_0xf72f('0x1c')](removeEntity(_0x4d5486,null))[_0xf72f('0x27')](handleError(_0x4d5486,null));};exports[_0xf72f('0x5f')]=function(_0x32bf0f,_0x4f7249){return db[_0xf72f('0x39')]['describe']()[_0xf72f('0x1c')](respondWithResult(_0x4f7249,null))[_0xf72f('0x27')](handleError(_0x4f7249,null));};exports['getMembers']=function(_0x5506bd,_0x143652,_0x322cae){var _0x45f37f={'raw':!![],'where':{}},_0x1a266d={},_0x2f8b28;return db[_0xf72f('0x39')][_0xf72f('0x60')]({'where':{'id':_0x5506bd[_0xf72f('0x55')]['id']}})[_0xf72f('0x1c')](handleEntityNotFound(_0x143652,null))['then'](function(_0x475734){if(_0x475734){_0x2f8b28=_0x475734[_0xf72f('0x31')]({'plain':!![]});_0x1a266d[_0xf72f('0x3b')]=_['keys'](db[_0xf72f('0x61')][_0xf72f('0x3a')]);_0x1a266d[_0xf72f('0x3d')]=_[_0xf72f('0x3c')](_0x5506bd[_0xf72f('0x3d')]);_0x1a266d[_0xf72f('0x40')]=_['intersection'](_0x1a266d[_0xf72f('0x3b')],_0x1a266d['query']);_0x45f37f[_0xf72f('0x42')]=_[_0xf72f('0x41')](_0x1a266d[_0xf72f('0x3b')],qs[_0xf72f('0x43')](_0x5506bd[_0xf72f('0x3d')][_0xf72f('0x43')]));_0x45f37f[_0xf72f('0x42')]=_0x45f37f['attributes']['length']?_0x45f37f[_0xf72f('0x42')]:_0x1a266d['model'];if(!_0x5506bd[_0xf72f('0x3d')][_0xf72f('0x45')](_0xf72f('0x46'))){_0x45f37f[_0xf72f('0x47')]=qs[_0xf72f('0x47')](_0x5506bd[_0xf72f('0x3d')][_0xf72f('0x47')]);_0x45f37f[_0xf72f('0x2c')]=qs[_0xf72f('0x2c')](_0x5506bd[_0xf72f('0x3d')][_0xf72f('0x2c')]);}_0x45f37f[_0xf72f('0x48')]=qs[_0xf72f('0x49')](_0x5506bd[_0xf72f('0x3d')]['sort']);_0x45f37f[_0xf72f('0x4a')]=qs[_0xf72f('0x40')](_['pick'](_0x5506bd[_0xf72f('0x3d')],_0x1a266d['filters']));_0x45f37f[_0xf72f('0x4a')][_0xf72f('0x62')]=_0x475734['id'];if(_0x5506bd[_0xf72f('0x3d')][_0xf72f('0x4e')]){_0x45f37f[_0xf72f('0x4a')]=_[_0xf72f('0x50')](_0x45f37f['where'],{'$or':_['map'](_0x45f37f[_0xf72f('0x42')],function(_0x2dd830){var _0x55e0d3={};_0x55e0d3[_0x2dd830]={'$like':'%'+_0x5506bd[_0xf72f('0x3d')][_0xf72f('0x4e')]+'%'};return _0x55e0d3;})});}_0x45f37f=_[_0xf72f('0x50')]({},_0x45f37f,_0x5506bd['options']);return db[_0xf72f('0x61')]['findAll'](_0x45f37f);}})[_0xf72f('0x1c')](function(_0x58fe90){if(_0x58fe90){return db[_0xf72f('0x63')][_0xf72f('0x64')]({'where':{'id':_[_0xf72f('0x4f')](_0x58fe90,_0xf72f('0x65')),'role':_0xf72f('0x66')},'attributes':['id',_0xf72f('0x36'),'chatPause',_0xf72f('0x67'),_0xf72f('0x68')]});}})['then'](function(_0x389de1){if(_0x389de1){return{'count':_0x389de1[_0xf72f('0x2b')],'rows':_['map'](_0x389de1[_0xf72f('0x53')],function(_0xdccf31){return{'membername':_0xdccf31[_0xf72f('0x36')],'UserId':_0xdccf31['id'],'queue_name':_0x2f8b28[_0xf72f('0x36')],'ChatQueueId':_0x2f8b28['id'],'interface':util[_0xf72f('0x69')]('%s/%s','SIP',_0xdccf31[_0xf72f('0x36')]),'penalty':0x0,'paused':_0xdccf31[_0xf72f('0x6a')],'createdAt':_0xdccf31[_0xf72f('0x68')],'updatedAt':_0xdccf31[_0xf72f('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf72f('0x1c')](respondWithFilteredResult(_0x143652,_0x45f37f))[_0xf72f('0x27')](handleError(_0x143652,null));};exports[_0xf72f('0x6b')]=function(_0x222830,_0x264a76,_0x1575d4){var _0x2de8bf={};var _0x3944dc={};var _0x24d2bb;var _0x4e8c61;return db['ChatQueue'][_0xf72f('0x60')]({'where':{'id':_0x222830[_0xf72f('0x55')]['id']}})[_0xf72f('0x1c')](handleEntityNotFound(_0x264a76,null))[_0xf72f('0x1c')](function(_0x3247e4){if(_0x3247e4){_0x24d2bb=_0x3247e4;_0x3944dc['model']=_[_0xf72f('0x3c')](db[_0xf72f('0x6c')][_0xf72f('0x3a')]);_0x3944dc[_0xf72f('0x3d')]=_[_0xf72f('0x3c')](_0x222830[_0xf72f('0x3d')]);_0x3944dc[_0xf72f('0x40')]=_['intersection'](_0x3944dc[_0xf72f('0x3b')],_0x3944dc['query']);_0x2de8bf[_0xf72f('0x42')]=_['intersection'](_0x3944dc[_0xf72f('0x3b')],qs[_0xf72f('0x43')](_0x222830['query'][_0xf72f('0x43')]));_0x2de8bf[_0xf72f('0x42')]=_0x2de8bf[_0xf72f('0x42')][_0xf72f('0x44')]?_0x2de8bf[_0xf72f('0x42')]:_0x3944dc[_0xf72f('0x3b')];_0x2de8bf['order']=qs['sort'](_0x222830[_0xf72f('0x3d')][_0xf72f('0x49')]);_0x2de8bf[_0xf72f('0x4a')]=qs[_0xf72f('0x40')](_['pick'](_0x222830[_0xf72f('0x3d')],_0x3944dc['filters']));if(_0x222830[_0xf72f('0x3d')]['filter']){_0x2de8bf['where']=_['merge'](_0x2de8bf[_0xf72f('0x4a')],{'$or':_[_0xf72f('0x4f')](_0x2de8bf[_0xf72f('0x42')],function(_0x12e3d2){var _0x379651={};_0x379651[_0x12e3d2]={'$like':'%'+_0x222830['query'][_0xf72f('0x4e')]+'%'};return _0x379651;})});}_0x2de8bf=_['merge']({},_0x2de8bf,_0x222830[_0xf72f('0x51')]);return _0x24d2bb['getTeams'](_0x2de8bf);}})[_0xf72f('0x1c')](function(_0x5118da){if(_0x5118da){_0x4e8c61=_0x5118da[_0xf72f('0x44')];if(!_0x222830['query'][_0xf72f('0x45')](_0xf72f('0x46'))){_0x2de8bf[_0xf72f('0x47')]=qs[_0xf72f('0x47')](_0x222830[_0xf72f('0x3d')]['limit']);_0x2de8bf['offset']=qs[_0xf72f('0x2c')](_0x222830[_0xf72f('0x3d')][_0xf72f('0x2c')]);}return _0x24d2bb['getTeams'](_0x2de8bf);}})[_0xf72f('0x1c')](function(_0x380206){if(_0x380206){return _0x380206?{'count':_0x4e8c61,'rows':_0x380206}:null;}})[_0xf72f('0x1c')](respondWithResult(_0x264a76,null))['catch'](handleError(_0x264a76,null));};exports[_0xf72f('0x6d')]=function(_0x22c231,_0x551c1d,_0x3ed407){var _0xda517b=[];var _0x876587;return db['Team'][_0xf72f('0x6e')]({'where':{'id':_0x22c231[_0xf72f('0x59')][_0xf72f('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xf72f('0x63')],'as':_0xf72f('0x70'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x4fcd9a){if(_0x4fcd9a){for(var _0x22ec21=0x0;_0x22ec21<_0x4fcd9a[_0xf72f('0x44')];_0x22ec21+=0x1){for(var _0x127dc8=0x0;_0x127dc8<_0x4fcd9a[_0x22ec21][_0xf72f('0x70')]['length'];_0x127dc8+=0x1){_0xda517b=_[_0xf72f('0x71')](_0xda517b,[_0x4fcd9a[_0x22ec21]['Agents'][_0x127dc8]['id']]);}}return _0xda517b;}})[_0xf72f('0x1c')](function(_0x4f26e8){if(_0x4f26e8){return db[_0xf72f('0x39')][_0xf72f('0x57')]({'where':{'id':_0x22c231[_0xf72f('0x55')]['id']}});}})[_0xf72f('0x1c')](function(_0x283f4b){if(_0x283f4b){_0x876587=_0x283f4b;return _0x876587[_0xf72f('0x72')](_0xda517b,{'penalty':_0x22c231[_0xf72f('0x59')][_0xf72f('0x73')]});}})[_0xf72f('0x1c')](function(_0x7724e1){if(_0x7724e1){return _0x876587['addTeams'](_0x22c231[_0xf72f('0x59')]['ids']);}})[_0xf72f('0x1c')](handleEntityNotFound(_0x551c1d,null))[_0xf72f('0x1c')](respondWithStatusCode(_0x551c1d,null))[_0xf72f('0x27')](handleError(_0x551c1d,null));};exports[_0xf72f('0x74')]=function(_0x5b1447,_0x189f56,_0x21867c){var _0x3613ee=[];var _0x13ada1;return db['Team']['findAll']({'where':{'id':_0x5b1447['query'][_0xf72f('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf72f('0x70'),'attributes':['id'],'raw':!![]}]})[_0xf72f('0x1c')](function(_0xdecb29){if(_0xdecb29){for(var _0x547d87=0x0;_0x547d87<_0xdecb29[_0xf72f('0x44')];_0x547d87+=0x1){for(var _0x161b70=0x0;_0x161b70<_0xdecb29[_0x547d87][_0xf72f('0x70')][_0xf72f('0x44')];_0x161b70+=0x1){_0x3613ee=_[_0xf72f('0x71')](_0x3613ee,[_0xdecb29[_0x547d87][_0xf72f('0x70')][_0x161b70]['id']]);}}return _0x3613ee;}})[_0xf72f('0x1c')](function(_0x40c373){if(_0x40c373){return db[_0xf72f('0x39')][_0xf72f('0x57')]({'where':{'id':_0x5b1447[_0xf72f('0x55')]['id']}});}})[_0xf72f('0x1c')](function(_0x3308a1){if(_0x3308a1){_0x13ada1=_0x3308a1;return _0x13ada1[_0xf72f('0x75')](_0x3613ee);}})[_0xf72f('0x1c')](function(_0x564e33){if(_0x13ada1){return _0x13ada1[_0xf72f('0x74')](_0x5b1447[_0xf72f('0x3d')]['ids']);}})[_0xf72f('0x1c')](handleEntityNotFound(_0x189f56,null))[_0xf72f('0x1c')](respondWithStatusCode(_0x189f56,null))[_0xf72f('0x27')](handleError(_0x189f56,null));};exports[_0xf72f('0x72')]=function(_0x5957f9,_0x489c4a,_0x325559){return db[_0xf72f('0x39')]['find']({'where':{'id':_0x5957f9['params']['id']}})[_0xf72f('0x1c')](handleEntityNotFound(_0x489c4a,null))[_0xf72f('0x1c')](function(_0x499ace){if(_0x499ace){return _0x499ace['addAgents'](_0x5957f9[_0xf72f('0x59')][_0xf72f('0x6f')],_[_0xf72f('0x76')](_0x5957f9[_0xf72f('0x59')],['ids','id'])||{})[_0xf72f('0x77')](function(_0x4610be){for(var _0x443be6=0x0;_0x443be6<_0x5957f9[_0xf72f('0x59')][_0xf72f('0x6f')][_0xf72f('0x44')];_0x443be6+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x5957f9['body'][_0xf72f('0x6f')][_0x443be6],'ChatQueueId':_0x5957f9[_0xf72f('0x55')]['id']});}return _0x4610be;});}})['then'](respondWithResult(_0x489c4a,null))[_0xf72f('0x27')](handleError(_0x489c4a,null));};exports['removeAgents']=function(_0x154758,_0x32efa9,_0x345921){var _0x1bc430;return db[_0xf72f('0x39')][_0xf72f('0x57')]({'where':{'id':_0x154758[_0xf72f('0x55')]['id']}})[_0xf72f('0x1c')](handleEntityNotFound(_0x32efa9,null))[_0xf72f('0x1c')](function(_0x414cea){if(_0x414cea){return _0x414cea[_0xf72f('0x75')](_0x154758['query'][_0xf72f('0x6f')])[_0xf72f('0x1c')](function(_0xd709a5){if(_[_0xf72f('0x78')](_0x154758[_0xf72f('0x3d')][_0xf72f('0x6f')])){for(var _0x2bf098=0x0;_0x2bf098<_0x154758[_0xf72f('0x3d')][_0xf72f('0x6f')]['length'];_0x2bf098+=0x1){socket[_0xf72f('0x79')](_0xf72f('0x7a'),{'UserId':_0x154758[_0xf72f('0x3d')][_0xf72f('0x6f')][_0x2bf098],'ChatQueueId':_0x154758[_0xf72f('0x55')]['id']});}}else{socket[_0xf72f('0x79')](_0xf72f('0x7a'),{'UserId':_0x154758[_0xf72f('0x3d')][_0xf72f('0x6f')],'ChatQueueId':_0x154758['params']['id']});}});}})[_0xf72f('0x1c')](respondWithStatusCode(_0x32efa9,null))[_0xf72f('0x27')](handleError(_0x32efa9,null));};exports[_0xf72f('0x7b')]=function(_0x4adfa5,_0x3d97e0,_0x344f67){var _0x1a725f={};var _0xbec41f={};var _0x3c8dbd;var _0x1275c8;return db['ChatQueue'][_0xf72f('0x60')]({'where':{'id':_0x4adfa5[_0xf72f('0x55')]['id']}})[_0xf72f('0x1c')](handleEntityNotFound(_0x3d97e0,null))[_0xf72f('0x1c')](function(_0x144ade){if(_0x144ade){_0x3c8dbd=_0x144ade;_0xbec41f[_0xf72f('0x3b')]=_[_0xf72f('0x3c')](db[_0xf72f('0x63')][_0xf72f('0x3a')]);_0xbec41f['query']=_['keys'](_0x4adfa5[_0xf72f('0x3d')]);_0xbec41f[_0xf72f('0x40')]=_[_0xf72f('0x41')](_0xbec41f['model'],_0xbec41f[_0xf72f('0x3d')]);_0x1a725f[_0xf72f('0x42')]=_[_0xf72f('0x41')](_0xbec41f[_0xf72f('0x3b')],qs['fields'](_0x4adfa5[_0xf72f('0x3d')][_0xf72f('0x43')]));_0x1a725f[_0xf72f('0x42')]=_0x1a725f[_0xf72f('0x42')][_0xf72f('0x44')]?_0x1a725f[_0xf72f('0x42')]:_0xbec41f['model'];_0x1a725f[_0xf72f('0x48')]=qs[_0xf72f('0x49')](_0x4adfa5['query'][_0xf72f('0x49')]);_0x1a725f[_0xf72f('0x4a')]=qs[_0xf72f('0x40')](_['pick'](_0x4adfa5[_0xf72f('0x3d')],_0xbec41f[_0xf72f('0x40')]));if(_0x4adfa5[_0xf72f('0x3d')][_0xf72f('0x4e')]){_0x1a725f[_0xf72f('0x4a')]=_['merge'](_0x1a725f[_0xf72f('0x4a')],{'$or':_[_0xf72f('0x4f')](_0x1a725f['attributes'],function(_0x2e4b2f){var _0x2b9605={};_0x2b9605[_0x2e4b2f]={'$like':'%'+_0x4adfa5[_0xf72f('0x3d')][_0xf72f('0x4e')]+'%'};return _0x2b9605;})});}_0x1a725f=_[_0xf72f('0x50')]({},_0x1a725f,_0x4adfa5[_0xf72f('0x51')]);return _0x3c8dbd[_0xf72f('0x7b')](_0x1a725f);}})['then'](function(_0x4b56c7){if(_0x4b56c7){_0x1275c8=_0x4b56c7[_0xf72f('0x44')];if(!_0x4adfa5[_0xf72f('0x3d')][_0xf72f('0x45')](_0xf72f('0x46'))){_0x1a725f[_0xf72f('0x47')]=qs['limit'](_0x4adfa5['query'][_0xf72f('0x47')]);_0x1a725f[_0xf72f('0x2c')]=qs[_0xf72f('0x2c')](_0x4adfa5['query']['offset']);}return _0x3c8dbd['getAgents'](_0x1a725f);}})[_0xf72f('0x1c')](function(_0x43ceda){if(_0x43ceda){return _0x43ceda?{'count':_0x1275c8,'rows':_0x43ceda}:null;}})[_0xf72f('0x1c')](respondWithResult(_0x3d97e0,null))[_0xf72f('0x27')](handleError(_0x3d97e0,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 7d37633..4e5e27e 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 _0xf04c=['setMaxListeners','save','remove','emit','exports','events','../../mysqldb','ChatQueue'];(function(_0x5db667,_0x4e2cc5){var _0x51e38b=function(_0x48f74a){while(--_0x48f74a){_0x5db667['push'](_0x5db667['shift']());}};_0x51e38b(++_0x4e2cc5);}(_0xf04c,0xfd));var _0xcf04=function(_0x1e3e7e,_0x53b7e6){_0x1e3e7e=_0x1e3e7e-0x0;var _0x1261de=_0xf04c[_0x1e3e7e];return _0x1261de;};'use strict';var EventEmitter=require(_0xcf04('0x0'));var ChatQueue=require(_0xcf04('0x1'))['db'][_0xcf04('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xcf04('0x3')](0x0);var events={'afterCreate':_0xcf04('0x4'),'afterUpdate':'update','afterDestroy':_0xcf04('0x5')};function emitEvent(_0x2c7ff0){return function(_0x38348c,_0x1b7582,_0x5c9a4b){ChatQueueEvents[_0xcf04('0x6')](_0x2c7ff0+':'+_0x38348c['id'],_0x38348c);ChatQueueEvents[_0xcf04('0x6')](_0x2c7ff0,_0x38348c);_0x5c9a4b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xcf04('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x7217=['exports','ChatQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x3f8fac,_0xfda655){var _0xc5ad3a=function(_0x57afb3){while(--_0x57afb3){_0x3f8fac['push'](_0x3f8fac['shift']());}};_0xc5ad3a(++_0xfda655);}(_0x7217,0xa9));var _0x7721=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7217[_0x3b5250];return _0xc844a1;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x7721('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7721('0x1'),'afterUpdate':_0x7721('0x2'),'afterDestroy':_0x7721('0x3')};function emitEvent(_0x18353b){return function(_0x363be8,_0x41f292,_0x320ac3){ChatQueueEvents[_0x7721('0x4')](_0x18353b+':'+_0x363be8['id'],_0x363be8);ChatQueueEvents[_0x7721('0x4')](_0x18353b,_0x363be8);_0x320ac3(null);};}for(var e in events){if(events[_0x7721('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x7721('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index bd8e0b1..bab143d 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 _0x0c02=['ChatQueue','chat_queues','util','../../config/logger','moment','bluebird','request-promise','./chatQueue.attributes','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var logger=require(_0x20c0('0x1'))('api');var moment=require(_0x20c0('0x2'));var BPromise=require(_0x20c0('0x3'));var rp=require(_0x20c0('0x4'));var attributes=require(_0x20c0('0x5'));module[_0x20c0('0x6')]=function(_0x2e9d65,_0x2afa72){return _0x2e9d65[_0x20c0('0x7')](_0x20c0('0x8'),attributes,{'tableName':_0x20c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['./chatQueue.attributes','exports','ChatQueue','lodash','util','../../config/logger','api','moment'];(function(_0x34769b,_0x365a59){var _0x53ff8a=function(_0x48a9b6){while(--_0x48a9b6){_0x34769b['push'](_0x34769b['shift']());}};_0x53ff8a(++_0x365a59);}(_0xabce,0x103));var _0xeabc=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xabce[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xeabc('0x5'));module[_0xeabc('0x6')]=function(_0x1a88a7,_0x5e9e2d){return _0x1a88a7['define'](_0xeabc('0x7'),attributes,{'tableName':'chat_queues','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 c55dfb0..3169b6f 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 _0xb52f=['ChatQueue','findAll','options','raw','limit','include','model','attributes','map','then','catch','ShowChatQueue','find','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','GetChatQueue'];(function(_0x1f406d,_0x139d0b){var _0x1eb2d5=function(_0x1c2d19){while(--_0x1c2d19){_0x1f406d['push'](_0x1f406d['shift']());}};_0x1eb2d5(++_0x139d0b);}(_0xb52f,0xbc));var _0xfb52=function(_0x3249ba,_0x4df7a0){_0x3249ba=_0x3249ba-0x0;var _0x542c4a=_0xb52f[_0x3249ba];return _0x542c4a;};'use strict';var _=require('lodash');var util=require(_0xfb52('0x0'));var moment=require('moment');var BPromise=require(_0xfb52('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb52('0x2'));var db=require(_0xfb52('0x3'))['db'];var utils=require(_0xfb52('0x4'));var logger=require(_0xfb52('0x5'))(_0xfb52('0x6'));var config=require(_0xfb52('0x7'));var jayson=require(_0xfb52('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xfb52('0x9')]=_[_0xfb52('0xa')](config[_0xfb52('0x9')],{'host':_0xfb52('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb52('0x9')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0xb10bb5,_0x516bbe,_0x3fed13){return new BPromise(function(_0x181a9c,_0x52e514){return client[_0xfb52('0xc')](_0xb10bb5,_0x3fed13)['then'](function(_0x176e84){logger[_0xfb52('0xd')](_0xfb52('0xe'),_0x516bbe,_0xfb52('0xf'));logger[_0xfb52('0x10')](_0xfb52('0x11'),_0x516bbe,'request\x20sent',JSON[_0xfb52('0x12')](_0x176e84));if(_0x176e84[_0xfb52('0x13')]){if(_0x176e84[_0xfb52('0x13')]['code']===0x1f4){logger[_0xfb52('0x13')]('ChatQueue,\x20%s,\x20%s',_0x516bbe,_0x176e84[_0xfb52('0x13')][_0xfb52('0x14')]);return _0x52e514(_0x176e84[_0xfb52('0x13')]['message']);}logger[_0xfb52('0x13')](_0xfb52('0xe'),_0x516bbe,_0x176e84[_0xfb52('0x13')][_0xfb52('0x14')]);return _0x181a9c(_0x176e84[_0xfb52('0x13')]['message']);}else{logger[_0xfb52('0xd')](_0xfb52('0xe'),_0x516bbe,_0xfb52('0xf'));_0x181a9c(_0x176e84['result']['message']);}})['catch'](function(_0x267c54){logger['error'](_0xfb52('0xe'),_0x516bbe,_0x267c54);_0x52e514(_0x267c54);});});}exports[_0xfb52('0x15')]=function(_0x244dab){var _0x1b62a5=this;return new Promise(function(_0x581c10,_0x43238f){return db[_0xfb52('0x16')][_0xfb52('0x17')]({'raw':_0x244dab['options']?_0x244dab[_0xfb52('0x18')][_0xfb52('0x19')]===undefined?!![]:![]:!![],'where':_0x244dab[_0xfb52('0x18')]?_0x244dab[_0xfb52('0x18')]['where']||null:null,'attributes':_0x244dab[_0xfb52('0x18')]?_0x244dab[_0xfb52('0x18')]['attributes']||null:null,'limit':_0x244dab[_0xfb52('0x18')]?_0x244dab[_0xfb52('0x18')][_0xfb52('0x1a')]||null:null,'include':_0x244dab[_0xfb52('0x18')]?_0x244dab[_0xfb52('0x18')][_0xfb52('0x1b')]?_['map'](_0x244dab['options']['include'],function(_0x2602f1){return{'model':db[_0x2602f1[_0xfb52('0x1c')]],'as':_0x2602f1['as'],'attributes':_0x2602f1[_0xfb52('0x1d')],'include':_0x2602f1[_0xfb52('0x1b')]?_[_0xfb52('0x1e')](_0x2602f1['include'],function(_0x2f95d6){return{'model':db[_0x2f95d6[_0xfb52('0x1c')]],'as':_0x2f95d6['as'],'attributes':_0x2f95d6[_0xfb52('0x1d')],'include':_0x2f95d6[_0xfb52('0x1b')]?_[_0xfb52('0x1e')](_0x2f95d6[_0xfb52('0x1b')],function(_0x132594){return{'model':db[_0x132594[_0xfb52('0x1c')]],'as':_0x132594['as'],'attributes':_0x132594[_0xfb52('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfb52('0x1f')](function(_0x3ee022){logger[_0xfb52('0xd')]('GetChatQueue',_0x244dab);logger['debug'](_0xfb52('0x15'),_0x244dab,JSON[_0xfb52('0x12')](_0x3ee022));_0x581c10(_0x3ee022);})[_0xfb52('0x20')](function(_0x1d156b){logger[_0xfb52('0x13')](_0xfb52('0x15'),_0x1d156b['message'],_0x244dab);_0x43238f(_0x1b62a5[_0xfb52('0x13')](0x1f4,_0x1d156b['message']));});});};exports[_0xfb52('0x21')]=function(_0x2c2213){var _0x5a8c35=this;return new Promise(function(_0x35b892,_0x277e8b){return db['ChatQueue'][_0xfb52('0x22')]({'raw':_0x2c2213['options']?_0x2c2213[_0xfb52('0x18')][_0xfb52('0x19')]===undefined?!![]:![]:!![],'where':_0x2c2213[_0xfb52('0x18')]?_0x2c2213['options']['where']||null:null,'attributes':_0x2c2213[_0xfb52('0x18')]?_0x2c2213[_0xfb52('0x18')][_0xfb52('0x1d')]||null:null,'include':_0x2c2213[_0xfb52('0x18')]?_0x2c2213[_0xfb52('0x18')][_0xfb52('0x1b')]?_[_0xfb52('0x1e')](_0x2c2213[_0xfb52('0x18')][_0xfb52('0x1b')],function(_0x590f47){return{'model':db[_0x590f47['model']],'as':_0x590f47['as'],'attributes':_0x590f47[_0xfb52('0x1d')],'include':_0x590f47[_0xfb52('0x1b')]?_['map'](_0x590f47[_0xfb52('0x1b')],function(_0x27db68){return{'model':db[_0x27db68[_0xfb52('0x1c')]],'as':_0x27db68['as'],'attributes':_0x27db68[_0xfb52('0x1d')],'include':_0x27db68[_0xfb52('0x1b')]?_[_0xfb52('0x1e')](_0x27db68['include'],function(_0x2121fb){return{'model':db[_0x2121fb[_0xfb52('0x1c')]],'as':_0x2121fb['as'],'attributes':_0x2121fb[_0xfb52('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfb52('0x1f')](function(_0x1dd487){logger[_0xfb52('0xd')](_0xfb52('0x21'),_0x2c2213);logger['debug'](_0xfb52('0x21'),_0x2c2213,JSON['stringify'](_0x1dd487));_0x35b892(_0x1dd487);})['catch'](function(_0x593b09){logger[_0xfb52('0x13')](_0xfb52('0x21'),_0x593b09[_0xfb52('0x14')],_0x2c2213);_0x277e8b(_0x5a8c35[_0xfb52('0x13')](0x1f4,_0x593b09['message']));});});}; \ No newline at end of file +var _0x091d=['redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','request\x20sent','debug','error','ChatQueue,\x20%s,\x20%s','message','result','catch','ChatQueue','findAll','options','raw','where','include','attributes','map','model','then','GetChatQueue','ShowChatQueue','find','stringify','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x20473a,_0x38b93f){var _0x5b11ff=function(_0xddd1d2){while(--_0xddd1d2){_0x20473a['push'](_0x20473a['shift']());}};_0x5b11ff(++_0x38b93f);}(_0x091d,0x92));var _0xd091=function(_0x46d60f,_0x37a376){_0x46d60f=_0x46d60f-0x0;var _0x362d23=_0x091d[_0x46d60f];return _0x362d23;};'use strict';var _=require(_0xd091('0x0'));var util=require(_0xd091('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd091('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd091('0x3'))['db'];var utils=require(_0xd091('0x4'));var logger=require(_0xd091('0x5'))('rpc');var config=require(_0xd091('0x6'));var jayson=require(_0xd091('0x7'));var client=jayson[_0xd091('0x8')][_0xd091('0x9')]({'port':0x232a});config[_0xd091('0xa')]=_[_0xd091('0xb')](config[_0xd091('0xa')],{'host':_0xd091('0xc'),'port':0x18eb});var socket=require(_0xd091('0xd'))(new Redis(config['redis']));require(_0xd091('0xe'))[_0xd091('0xf')](socket);function respondWithRpcPromise(_0x814902,_0x11599f,_0x489a06){return new BPromise(function(_0x1b1f0c,_0x4c31e5){return client[_0xd091('0x10')](_0x814902,_0x489a06)['then'](function(_0x438a03){logger[_0xd091('0x11')]('ChatQueue,\x20%s,\x20%s',_0x11599f,_0xd091('0x12'));logger[_0xd091('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x11599f,_0xd091('0x12'),JSON['stringify'](_0x438a03));if(_0x438a03[_0xd091('0x14')]){if(_0x438a03['error']['code']===0x1f4){logger[_0xd091('0x14')](_0xd091('0x15'),_0x11599f,_0x438a03[_0xd091('0x14')][_0xd091('0x16')]);return _0x4c31e5(_0x438a03[_0xd091('0x14')]['message']);}logger[_0xd091('0x14')]('ChatQueue,\x20%s,\x20%s',_0x11599f,_0x438a03[_0xd091('0x14')]['message']);return _0x1b1f0c(_0x438a03[_0xd091('0x14')]['message']);}else{logger['info'](_0xd091('0x15'),_0x11599f,'request\x20sent');_0x1b1f0c(_0x438a03[_0xd091('0x17')][_0xd091('0x16')]);}})[_0xd091('0x18')](function(_0x3edc1c){logger[_0xd091('0x14')](_0xd091('0x15'),_0x11599f,_0x3edc1c);_0x4c31e5(_0x3edc1c);});});}exports['GetChatQueue']=function(_0x532005){var _0x411634=this;return new Promise(function(_0x5b6c96,_0x3137aa){return db[_0xd091('0x19')][_0xd091('0x1a')]({'raw':_0x532005[_0xd091('0x1b')]?_0x532005[_0xd091('0x1b')][_0xd091('0x1c')]===undefined?!![]:![]:!![],'where':_0x532005[_0xd091('0x1b')]?_0x532005[_0xd091('0x1b')][_0xd091('0x1d')]||null:null,'attributes':_0x532005[_0xd091('0x1b')]?_0x532005[_0xd091('0x1b')]['attributes']||null:null,'limit':_0x532005[_0xd091('0x1b')]?_0x532005['options']['limit']||null:null,'include':_0x532005[_0xd091('0x1b')]?_0x532005['options'][_0xd091('0x1e')]?_['map'](_0x532005[_0xd091('0x1b')][_0xd091('0x1e')],function(_0x236f43){return{'model':db[_0x236f43['model']],'as':_0x236f43['as'],'attributes':_0x236f43[_0xd091('0x1f')],'include':_0x236f43[_0xd091('0x1e')]?_[_0xd091('0x20')](_0x236f43['include'],function(_0x38dc51){return{'model':db[_0x38dc51[_0xd091('0x21')]],'as':_0x38dc51['as'],'attributes':_0x38dc51[_0xd091('0x1f')],'include':_0x38dc51[_0xd091('0x1e')]?_[_0xd091('0x20')](_0x38dc51[_0xd091('0x1e')],function(_0x28392c){return{'model':db[_0x28392c['model']],'as':_0x28392c['as'],'attributes':_0x28392c[_0xd091('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd091('0x22')](function(_0x5b30f3){logger['info'](_0xd091('0x23'),_0x532005);logger[_0xd091('0x13')]('GetChatQueue',_0x532005,JSON['stringify'](_0x5b30f3));_0x5b6c96(_0x5b30f3);})[_0xd091('0x18')](function(_0x310744){logger[_0xd091('0x14')](_0xd091('0x23'),_0x310744[_0xd091('0x16')],_0x532005);_0x3137aa(_0x411634[_0xd091('0x14')](0x1f4,_0x310744[_0xd091('0x16')]));});});};exports[_0xd091('0x24')]=function(_0x34f530){var _0x4333a8=this;return new Promise(function(_0x26e3bc,_0x1ca639){return db['ChatQueue'][_0xd091('0x25')]({'raw':_0x34f530[_0xd091('0x1b')]?_0x34f530[_0xd091('0x1b')][_0xd091('0x1c')]===undefined?!![]:![]:!![],'where':_0x34f530['options']?_0x34f530[_0xd091('0x1b')][_0xd091('0x1d')]||null:null,'attributes':_0x34f530[_0xd091('0x1b')]?_0x34f530[_0xd091('0x1b')]['attributes']||null:null,'include':_0x34f530['options']?_0x34f530[_0xd091('0x1b')]['include']?_[_0xd091('0x20')](_0x34f530[_0xd091('0x1b')]['include'],function(_0x2eec05){return{'model':db[_0x2eec05[_0xd091('0x21')]],'as':_0x2eec05['as'],'attributes':_0x2eec05[_0xd091('0x1f')],'include':_0x2eec05[_0xd091('0x1e')]?_[_0xd091('0x20')](_0x2eec05[_0xd091('0x1e')],function(_0x2ed2e4){return{'model':db[_0x2ed2e4['model']],'as':_0x2ed2e4['as'],'attributes':_0x2ed2e4[_0xd091('0x1f')],'include':_0x2ed2e4[_0xd091('0x1e')]?_[_0xd091('0x20')](_0x2ed2e4[_0xd091('0x1e')],function(_0x42d770){return{'model':db[_0x42d770[_0xd091('0x21')]],'as':_0x42d770['as'],'attributes':_0x42d770['attributes']};}):[]};}):[]};}):[]:[]})[_0xd091('0x22')](function(_0x464f14){logger['info'](_0xd091('0x24'),_0x34f530);logger[_0xd091('0x13')](_0xd091('0x24'),_0x34f530,JSON[_0xd091('0x26')](_0x464f14));_0x26e3bc(_0x464f14);})[_0xd091('0x18')](function(_0x17f328){logger[_0xd091('0x14')](_0xd091('0x24'),_0x17f328[_0xd091('0x16')],_0x34f530);_0x1ca639(_0x4333a8[_0xd091('0x14')](0x1f4,_0x17f328[_0xd091('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 2b2955d..c32dd28 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 0ed3a0c..58f9e24 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 _0x561d=['multer','util','path','connect-timeout','express','Router','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x331365,_0x4968db){var _0x4e7685=function(_0x3340d7){while(--_0x3340d7){_0x331365['push'](_0x331365['shift']());}};_0x4e7685(++_0x4968db);}(_0x561d,0xe8));var _0xd561=function(_0x116d2f,_0x40f001){_0x116d2f=_0x116d2f-0x0;var _0x55acda=_0x561d[_0x116d2f];return _0x55acda;};'use strict';var multer=require(_0xd561('0x0'));var util=require(_0xd561('0x1'));var path=require(_0xd561('0x2'));var timeout=require(_0xd561('0x3'));var express=require(_0xd561('0x4'));var router=express[_0xd561('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd561('0x6'));router[_0xd561('0x7')]('/',auth[_0xd561('0x8')](),controller['index']);router[_0xd561('0x7')](_0xd561('0x9'),auth[_0xd561('0x8')](),controller[_0xd561('0xa')]);router[_0xd561('0x7')](_0xd561('0xb'),auth[_0xd561('0x8')](),controller[_0xd561('0xc')]);router[_0xd561('0x7')](_0xd561('0xd'),auth[_0xd561('0x8')](),controller[_0xd561('0xe')]);router[_0xd561('0x7')](_0xd561('0xf'),auth[_0xd561('0x8')](),controller[_0xd561('0x10')]);router[_0xd561('0x7')]('/:id/users',auth[_0xd561('0x8')](),controller[_0xd561('0x11')]);router[_0xd561('0x12')]('/',auth[_0xd561('0x8')](),controller[_0xd561('0x13')]);router[_0xd561('0x12')](_0xd561('0xf'),auth[_0xd561('0x8')](),controller[_0xd561('0x14')]);router[_0xd561('0x12')](_0xd561('0x15'),auth[_0xd561('0x8')](),controller['addAgents']);router[_0xd561('0x16')](_0xd561('0xb'),auth[_0xd561('0x8')](),controller[_0xd561('0x17')]);router[_0xd561('0x18')](_0xd561('0xb'),auth[_0xd561('0x8')](),controller[_0xd561('0x19')]);router[_0xd561('0x18')](_0xd561('0xf'),auth['isAuthenticated'](),controller[_0xd561('0x1a')]);router[_0xd561('0x18')](_0xd561('0x15'),auth[_0xd561('0x8')](),controller[_0xd561('0x1b')]);module[_0xd561('0x1c')]=router; \ No newline at end of file +var _0x0cb6=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x217a17,_0xf4d328){var _0x2b2a56=function(_0x3bd69c){while(--_0x3bd69c){_0x217a17['push'](_0x217a17['shift']());}};_0x2b2a56(++_0xf4d328);}(_0x0cb6,0x1d0));var _0x60cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cb6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x60cb('0x0'));var util=require(_0x60cb('0x1'));var path=require(_0x60cb('0x2'));var timeout=require(_0x60cb('0x3'));var express=require(_0x60cb('0x4'));var router=express[_0x60cb('0x5')]();var auth=require(_0x60cb('0x6'));var interaction=require(_0x60cb('0x7'));var config=require('../../config/environment');var controller=require(_0x60cb('0x8'));router[_0x60cb('0x9')]('/',auth[_0x60cb('0xa')](),controller[_0x60cb('0xb')]);router['get']('/describe',auth[_0x60cb('0xa')](),controller[_0x60cb('0xc')]);router[_0x60cb('0x9')](_0x60cb('0xd'),auth[_0x60cb('0xa')](),controller[_0x60cb('0xe')]);router[_0x60cb('0x9')](_0x60cb('0xf'),auth[_0x60cb('0xa')](),controller[_0x60cb('0x10')]);router['get'](_0x60cb('0x11'),auth['isAuthenticated'](),controller[_0x60cb('0x12')]);router['get'](_0x60cb('0x13'),auth[_0x60cb('0xa')](),controller[_0x60cb('0x14')]);router[_0x60cb('0x15')]('/',auth['isAuthenticated'](),controller[_0x60cb('0x16')]);router['post'](_0x60cb('0x11'),auth[_0x60cb('0xa')](),controller[_0x60cb('0x17')]);router[_0x60cb('0x15')](_0x60cb('0x13'),auth[_0x60cb('0xa')](),controller[_0x60cb('0x18')]);router[_0x60cb('0x19')](_0x60cb('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x60cb('0xd'),auth[_0x60cb('0xa')](),controller['destroy']);router['delete'](_0x60cb('0x11'),auth[_0x60cb('0xa')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x60cb('0xa')](),controller[_0x60cb('0x1a')]);module[_0x60cb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index ccc4a0b..77b6d26 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 _0x192d=['STRING','DATE','moment','sequelize'];(function(_0x386078,_0x49ad4f){var _0xd6675c=function(_0x1573c9){while(--_0x1573c9){_0x386078['push'](_0x386078['shift']());}};_0xd6675c(++_0x49ad4f);}(_0x192d,0x146));var _0xd192=function(_0x2cf75f,_0x3ad9d0){_0x2cf75f=_0x2cf75f-0x0;var _0x55a19c=_0x192d[_0x2cf75f];return _0x55a19c;};'use strict';var moment=require(_0xd192('0x0'));var Sequelize=require(_0xd192('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd192('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd192('0x2')]},'joinAt':{'type':Sequelize[_0xd192('0x3')]},'leaveAt':{'type':Sequelize[_0xd192('0x3')]},'acceptAt':{'type':Sequelize[_0xd192('0x3')]},'exitAt':{'type':Sequelize[_0xd192('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfcd2=['sequelize','exports','STRING','DATE'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xfcd2,0x1cc));var _0x2fcd=function(_0x28d8ee,_0x5372df){_0x28d8ee=_0x28d8ee-0x0;var _0x5e8218=_0xfcd2[_0x28d8ee];return _0x5e8218;};'use strict';var moment=require('moment');var Sequelize=require(_0x2fcd('0x0'));module[_0x2fcd('0x1')]={'uniqueid':{'type':Sequelize[_0x2fcd('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2fcd('0x2')]},'joinAt':{'type':Sequelize[_0x2fcd('0x3')]},'leaveAt':{'type':Sequelize[_0x2fcd('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2fcd('0x3')]},'reason':{'type':Sequelize[_0x2fcd('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 36c675a..72eccc6 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 _0xe2a6=['apply','reject','save','update','then','destroy','end','error','stack','name','send','index','ChatQueueReport','rawAttributes','model','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','add','day','merge','map','filter','include','findAll','rows','catch','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','status','set','Content-Range'];(function(_0x512da6,_0x30eb6b){var _0xe7823b=function(_0x17ecac){while(--_0x17ecac){_0x512da6['push'](_0x512da6['shift']());}};_0xe7823b(++_0x30eb6b);}(_0xe2a6,0x190));var _0x6e2a=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xe2a6[_0x202c61];return _0x540691;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6e2a('0x0'));var rimraf=require(_0x6e2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6e2a('0x2'));var path=require(_0x6e2a('0x3'));var sox=require(_0x6e2a('0x4'));var csv=require('to-csv');var ejs=require(_0x6e2a('0x5'));var fs=require('fs');var _=require(_0x6e2a('0x6'));var squel=require(_0x6e2a('0x7'));var crypto=require(_0x6e2a('0x8'));var jsforce=require(_0x6e2a('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x6e2a('0xa'));var querystring=require(_0x6e2a('0xb'));var Papa=require(_0x6e2a('0xc'));var Redis=require(_0x6e2a('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x6e2a('0xe'))(_0x6e2a('0xf'));var utils=require(_0x6e2a('0x10'));var config=require(_0x6e2a('0x11'));var db=require(_0x6e2a('0x12'))['db'];function respondWithStatusCode(_0x1e906a,_0x5d2121){_0x5d2121=_0x5d2121||0xcc;return function(_0x34d036){if(_0x34d036){return _0x1e906a[_0x6e2a('0x13')](_0x5d2121);}return _0x1e906a['status'](_0x5d2121)['end']();};}function respondWithResult(_0x2cf0b8,_0x5813ce){_0x5813ce=_0x5813ce||0xc8;return function(_0x38a621){if(_0x38a621){return _0x2cf0b8['status'](_0x5813ce)[_0x6e2a('0x14')](_0x38a621);}};}function respondWithFilteredResult(_0xf8a08d,_0x365cda){return function(_0x119b2b){if(_0x119b2b){var _0x36701d=_0x119b2b[_0x6e2a('0x15')],_0x5325a4=_0x365cda[_0x6e2a('0x16')],_0x34711b=_0x365cda[_0x6e2a('0x16')]+_0x365cda['limit'],_0x4eb44d;if(_0x34711b>=_0x36701d){_0x34711b=_0x36701d;_0x4eb44d=0xc8;}else{_0x4eb44d=0xce;}_0xf8a08d[_0x6e2a('0x17')](_0x4eb44d);return _0xf8a08d[_0x6e2a('0x18')](_0x6e2a('0x19'),_0x5325a4+'-'+_0x34711b+'/'+_0x36701d)[_0x6e2a('0x14')](_0x119b2b);}return null;};}function patchUpdates(_0x334038){return function(_0xb7cc79){try{jsonpatch[_0x6e2a('0x1a')](_0xb7cc79,_0x334038,!![]);}catch(_0x44cf37){return BPromise[_0x6e2a('0x1b')](_0x44cf37);}return _0xb7cc79[_0x6e2a('0x1c')]();};}function saveUpdates(_0x1591f9,_0x235032){return function(_0x23f36e){if(_0x23f36e){return _0x23f36e[_0x6e2a('0x1d')](_0x1591f9)[_0x6e2a('0x1e')](function(_0x2ebb4e){return _0x2ebb4e;});}return null;};}function removeEntity(_0x184d3b,_0x1afc70){return function(_0x5b494e){if(_0x5b494e){return _0x5b494e[_0x6e2a('0x1f')]()[_0x6e2a('0x1e')](function(){_0x184d3b[_0x6e2a('0x17')](0xcc)[_0x6e2a('0x20')]();});}};}function handleEntityNotFound(_0x2cfde1,_0x1a99fe){return function(_0x41538e){if(!_0x41538e){_0x2cfde1[_0x6e2a('0x13')](0x194);}return _0x41538e;};}function handleError(_0x4fb021,_0x3ca590){_0x3ca590=_0x3ca590||0x1f4;return function(_0x47b2d5){logger[_0x6e2a('0x21')](_0x47b2d5[_0x6e2a('0x22')]);if(_0x47b2d5['name']){delete _0x47b2d5[_0x6e2a('0x23')];}_0x4fb021[_0x6e2a('0x17')](_0x3ca590)[_0x6e2a('0x24')](_0x47b2d5);};}exports[_0x6e2a('0x25')]=function(_0x5c9af2,_0x4c4510){var _0x275e96={},_0x27fee1={},_0x563826={'count':0x0,'rows':[]};var _0x1a90af=db[_0x6e2a('0x26')][_0x6e2a('0x27')];_0x27fee1[_0x6e2a('0x28')]=_['keys'](_0x1a90af);var _0x195b1b={'dateStart':_0x5c9af2['query']['dateStart'],'dateEnd':_0x5c9af2[_0x6e2a('0x29')]['dateEnd']};delete _0x5c9af2[_0x6e2a('0x29')][_0x6e2a('0x2a')];delete _0x5c9af2['query'][_0x6e2a('0x2b')];_0x27fee1[_0x6e2a('0x29')]=_['keys'](_0x5c9af2[_0x6e2a('0x29')]);_0x27fee1[_0x6e2a('0x2c')]=_[_0x6e2a('0x2d')](_0x27fee1[_0x6e2a('0x28')],_0x27fee1[_0x6e2a('0x29')]);_0x275e96[_0x6e2a('0x2e')]=_[_0x6e2a('0x2d')](_0x27fee1[_0x6e2a('0x28')],qs[_0x6e2a('0x2f')](_0x5c9af2['query'][_0x6e2a('0x2f')]));_0x275e96[_0x6e2a('0x2e')]=_0x275e96[_0x6e2a('0x2e')][_0x6e2a('0x30')]?_0x275e96['attributes']:_0x27fee1['model'];if(!_0x5c9af2[_0x6e2a('0x29')]['hasOwnProperty'](_0x6e2a('0x31'))){_0x275e96[_0x6e2a('0x32')]=qs[_0x6e2a('0x32')](_0x5c9af2['query'][_0x6e2a('0x32')]);_0x275e96['offset']=qs[_0x6e2a('0x16')](_0x5c9af2[_0x6e2a('0x29')][_0x6e2a('0x16')]);}_0x275e96[_0x6e2a('0x33')]=qs['sort'](_0x5c9af2[_0x6e2a('0x29')][_0x6e2a('0x34')]);_0x275e96[_0x6e2a('0x35')]=qs[_0x6e2a('0x2c')](_[_0x6e2a('0x36')](_0x5c9af2[_0x6e2a('0x29')],_0x27fee1[_0x6e2a('0x2c')]));if(_0x195b1b[_0x6e2a('0x2a')]){if(_0x195b1b['dateEnd']){_0x195b1b[_0x6e2a('0x2b')]=moment(_0x195b1b[_0x6e2a('0x2b')])[_0x6e2a('0x37')](0x1,_0x6e2a('0x38'));}else{_0x195b1b[_0x6e2a('0x2b')]=moment(_0x195b1b['dateStart'])[_0x6e2a('0x37')](0x1,_0x6e2a('0x38'));}_[_0x6e2a('0x39')](_0x275e96['where'],{'createdAt':{'$gte':_0x195b1b[_0x6e2a('0x2a')],'$lte':_0x195b1b[_0x6e2a('0x2b')]}});}if(_0x5c9af2[_0x6e2a('0x29')]['filter']){_0x275e96[_0x6e2a('0x35')]=_[_0x6e2a('0x39')](_0x275e96[_0x6e2a('0x35')],{'$or':_[_0x6e2a('0x3a')](_0x275e96['attributes'],function(_0x219ee9){var _0x3c8801={};_0x3c8801[_0x219ee9]={'$like':'%'+_0x5c9af2[_0x6e2a('0x29')][_0x6e2a('0x3b')]+'%'};return _0x3c8801;})});}_0x275e96=_[_0x6e2a('0x39')]({},_0x275e96,_0x5c9af2['options']);var _0x5b48db={'where':_0x275e96['where']};return db[_0x6e2a('0x26')][_0x6e2a('0x15')](_0x5b48db)[_0x6e2a('0x1e')](function(_0x4aad27){_0x563826['count']=_0x4aad27;if(_0x5c9af2[_0x6e2a('0x29')]['includeAll']){_0x275e96[_0x6e2a('0x3c')]=[{'all':!![]}];}return db[_0x6e2a('0x26')][_0x6e2a('0x3d')](_0x275e96);})['then'](function(_0x253443){_0x563826[_0x6e2a('0x3e')]=_0x253443;return _0x563826;})[_0x6e2a('0x1e')](respondWithFilteredResult(_0x4c4510,_0x275e96))[_0x6e2a('0x3f')](handleError(_0x4c4510,null));};exports['show']=function(_0x3c96b8,_0x53f632){var _0x4f79a8={'raw':!![],'where':{'id':_0x3c96b8[_0x6e2a('0x40')]['id']}},_0x11ae84={};_0x11ae84[_0x6e2a('0x28')]=_[_0x6e2a('0x41')](db[_0x6e2a('0x26')]['rawAttributes']);_0x11ae84[_0x6e2a('0x29')]=_['keys'](_0x3c96b8[_0x6e2a('0x29')]);_0x11ae84[_0x6e2a('0x2c')]=_[_0x6e2a('0x2d')](_0x11ae84[_0x6e2a('0x28')],_0x11ae84[_0x6e2a('0x29')]);_0x4f79a8[_0x6e2a('0x2e')]=_[_0x6e2a('0x2d')](_0x11ae84['model'],qs['fields'](_0x3c96b8[_0x6e2a('0x29')][_0x6e2a('0x2f')]));_0x4f79a8['attributes']=_0x4f79a8[_0x6e2a('0x2e')][_0x6e2a('0x30')]?_0x4f79a8[_0x6e2a('0x2e')]:_0x11ae84[_0x6e2a('0x28')];if(_0x3c96b8[_0x6e2a('0x29')][_0x6e2a('0x42')]){_0x4f79a8[_0x6e2a('0x3c')]=[{'all':!![]}];}_0x4f79a8=_[_0x6e2a('0x39')]({},_0x4f79a8,_0x3c96b8['options']);return db[_0x6e2a('0x26')][_0x6e2a('0x43')](_0x4f79a8)[_0x6e2a('0x1e')](handleEntityNotFound(_0x53f632,null))[_0x6e2a('0x1e')](respondWithResult(_0x53f632,null))['catch'](handleError(_0x53f632,null));};exports[_0x6e2a('0x44')]=function(_0x251be0,_0xbfcae1){return db[_0x6e2a('0x26')][_0x6e2a('0x44')](_0x251be0[_0x6e2a('0x45')],{})['then'](respondWithResult(_0xbfcae1,0xc9))[_0x6e2a('0x3f')](handleError(_0xbfcae1,null));};exports[_0x6e2a('0x1d')]=function(_0x6bee70,_0x4b75c4){if(_0x6bee70[_0x6e2a('0x45')]['id']){delete _0x6bee70['body']['id'];}return db['ChatQueueReport'][_0x6e2a('0x43')]({'where':{'id':_0x6bee70[_0x6e2a('0x40')]['id']}})[_0x6e2a('0x1e')](handleEntityNotFound(_0x4b75c4,null))[_0x6e2a('0x1e')](saveUpdates(_0x6bee70[_0x6e2a('0x45')],null))[_0x6e2a('0x1e')](respondWithResult(_0x4b75c4,null))[_0x6e2a('0x3f')](handleError(_0x4b75c4,null));};exports['destroy']=function(_0x37608f,_0x39e4a4){return db['ChatQueueReport'][_0x6e2a('0x43')]({'where':{'id':_0x37608f[_0x6e2a('0x40')]['id']}})[_0x6e2a('0x1e')](handleEntityNotFound(_0x39e4a4,null))[_0x6e2a('0x1e')](removeEntity(_0x39e4a4,null))[_0x6e2a('0x3f')](handleError(_0x39e4a4,null));};exports[_0x6e2a('0x46')]=function(_0x2e959e,_0xfd11d0){return db[_0x6e2a('0x26')][_0x6e2a('0x46')]()[_0x6e2a('0x1e')](respondWithResult(_0xfd11d0,null))['catch'](handleError(_0xfd11d0,null));}; \ No newline at end of file +var _0x811e=['bluebird','mustache','path','crypto','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','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','keys','query','dateStart','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','dateEnd','add','day','merge','where','map','filter','ChatQueueReport','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x811e,0xd6));var _0xe811=function(_0x29fdaa,_0x387a25){_0x29fdaa=_0x29fdaa-0x0;var _0x236dd9=_0x811e[_0x29fdaa];return _0x236dd9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe811('0x0'));var rimraf=require(_0xe811('0x1'));var zipdir=require(_0xe811('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe811('0x3'));var moment=require(_0xe811('0x4'));var BPromise=require(_0xe811('0x5'));var Mustache=require(_0xe811('0x6'));var util=require('util');var path=require(_0xe811('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe811('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xe811('0x9'));var toCsv=require(_0xe811('0xa'));var querystring=require(_0xe811('0xb'));var Papa=require(_0xe811('0xc'));var Redis=require(_0xe811('0xd'));var qs=require(_0xe811('0xe'));var logger=require(_0xe811('0xf'))(_0xe811('0x10'));var utils=require(_0xe811('0x11'));var config=require(_0xe811('0x12'));var db=require(_0xe811('0x13'))['db'];function respondWithStatusCode(_0x2b523d,_0x535e96){_0x535e96=_0x535e96||0xcc;return function(_0x17b79c){if(_0x17b79c){return _0x2b523d[_0xe811('0x14')](_0x535e96);}return _0x2b523d[_0xe811('0x15')](_0x535e96)[_0xe811('0x16')]();};}function respondWithResult(_0x4f1307,_0x3a167e){_0x3a167e=_0x3a167e||0xc8;return function(_0x5be451){if(_0x5be451){return _0x4f1307[_0xe811('0x15')](_0x3a167e)[_0xe811('0x17')](_0x5be451);}};}function respondWithFilteredResult(_0x107f34,_0x349136){return function(_0x484e9e){if(_0x484e9e){var _0x4ddeba=_0x484e9e[_0xe811('0x18')],_0x19b402=_0x349136[_0xe811('0x19')],_0x1c1a94=_0x349136[_0xe811('0x19')]+_0x349136[_0xe811('0x1a')],_0x31800d;if(_0x1c1a94>=_0x4ddeba){_0x1c1a94=_0x4ddeba;_0x31800d=0xc8;}else{_0x31800d=0xce;}_0x107f34['status'](_0x31800d);return _0x107f34['set'](_0xe811('0x1b'),_0x19b402+'-'+_0x1c1a94+'/'+_0x4ddeba)['json'](_0x484e9e);}return null;};}function patchUpdates(_0x4ceebd){return function(_0x2ba5b6){try{jsonpatch[_0xe811('0x1c')](_0x2ba5b6,_0x4ceebd,!![]);}catch(_0x97602d){return BPromise[_0xe811('0x1d')](_0x97602d);}return _0x2ba5b6[_0xe811('0x1e')]();};}function saveUpdates(_0x5c67ef,_0x14b3e7){return function(_0x3f078e){if(_0x3f078e){return _0x3f078e[_0xe811('0x1f')](_0x5c67ef)[_0xe811('0x20')](function(_0x3c2051){return _0x3c2051;});}return null;};}function removeEntity(_0x145271,_0x39981e){return function(_0xb9c0f5){if(_0xb9c0f5){return _0xb9c0f5[_0xe811('0x21')]()['then'](function(){_0x145271['status'](0xcc)[_0xe811('0x16')]();});}};}function handleEntityNotFound(_0x578afd,_0x3de638){return function(_0xb91080){if(!_0xb91080){_0x578afd[_0xe811('0x14')](0x194);}return _0xb91080;};}function handleError(_0x54d2e4,_0x44f5a0){_0x44f5a0=_0x44f5a0||0x1f4;return function(_0x26d773){logger[_0xe811('0x22')](_0x26d773[_0xe811('0x23')]);if(_0x26d773[_0xe811('0x24')]){delete _0x26d773[_0xe811('0x24')];}_0x54d2e4['status'](_0x44f5a0)[_0xe811('0x25')](_0x26d773);};}exports[_0xe811('0x26')]=function(_0x361327,_0x36b173){var _0x12fbb0={},_0x27535f={},_0x23ff1f={'count':0x0,'rows':[]};var _0x2b90e6=db['ChatQueueReport'][_0xe811('0x27')];_0x27535f['model']=_[_0xe811('0x28')](_0x2b90e6);var _0x2bb7be={'dateStart':_0x361327[_0xe811('0x29')][_0xe811('0x2a')],'dateEnd':_0x361327[_0xe811('0x29')]['dateEnd']};delete _0x361327[_0xe811('0x29')][_0xe811('0x2a')];delete _0x361327[_0xe811('0x29')]['dateEnd'];_0x27535f[_0xe811('0x29')]=_[_0xe811('0x28')](_0x361327[_0xe811('0x29')]);_0x27535f[_0xe811('0x2b')]=_[_0xe811('0x2c')](_0x27535f['model'],_0x27535f['query']);_0x12fbb0[_0xe811('0x2d')]=_[_0xe811('0x2c')](_0x27535f['model'],qs[_0xe811('0x2e')](_0x361327['query'][_0xe811('0x2e')]));_0x12fbb0['attributes']=_0x12fbb0[_0xe811('0x2d')][_0xe811('0x2f')]?_0x12fbb0[_0xe811('0x2d')]:_0x27535f[_0xe811('0x30')];if(!_0x361327['query'][_0xe811('0x31')](_0xe811('0x32'))){_0x12fbb0[_0xe811('0x1a')]=qs[_0xe811('0x1a')](_0x361327[_0xe811('0x29')][_0xe811('0x1a')]);_0x12fbb0[_0xe811('0x19')]=qs[_0xe811('0x19')](_0x361327[_0xe811('0x29')]['offset']);}_0x12fbb0[_0xe811('0x33')]=qs[_0xe811('0x34')](_0x361327[_0xe811('0x29')]['sort']);_0x12fbb0['where']=qs[_0xe811('0x2b')](_[_0xe811('0x35')](_0x361327['query'],_0x27535f['filters']));if(_0x2bb7be[_0xe811('0x2a')]){if(_0x2bb7be['dateEnd']){_0x2bb7be[_0xe811('0x36')]=moment(_0x2bb7be[_0xe811('0x36')])[_0xe811('0x37')](0x1,'day');}else{_0x2bb7be['dateEnd']=moment(_0x2bb7be[_0xe811('0x2a')])[_0xe811('0x37')](0x1,_0xe811('0x38'));}_[_0xe811('0x39')](_0x12fbb0[_0xe811('0x3a')],{'createdAt':{'$gte':_0x2bb7be[_0xe811('0x2a')],'$lte':_0x2bb7be[_0xe811('0x36')]}});}if(_0x361327[_0xe811('0x29')]['filter']){_0x12fbb0[_0xe811('0x3a')]=_[_0xe811('0x39')](_0x12fbb0[_0xe811('0x3a')],{'$or':_[_0xe811('0x3b')](_0x12fbb0[_0xe811('0x2d')],function(_0x5dc873){var _0x507339={};_0x507339[_0x5dc873]={'$like':'%'+_0x361327[_0xe811('0x29')][_0xe811('0x3c')]+'%'};return _0x507339;})});}_0x12fbb0=_[_0xe811('0x39')]({},_0x12fbb0,_0x361327['options']);var _0x28ff8d={'where':_0x12fbb0[_0xe811('0x3a')]};return db[_0xe811('0x3d')][_0xe811('0x18')](_0x28ff8d)[_0xe811('0x20')](function(_0x2ddd6a){_0x23ff1f[_0xe811('0x18')]=_0x2ddd6a;if(_0x361327[_0xe811('0x29')]['includeAll']){_0x12fbb0['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xe811('0x3e')](_0x12fbb0);})[_0xe811('0x20')](function(_0x5d7c7f){_0x23ff1f[_0xe811('0x3f')]=_0x5d7c7f;return _0x23ff1f;})[_0xe811('0x20')](respondWithFilteredResult(_0x36b173,_0x12fbb0))[_0xe811('0x40')](handleError(_0x36b173,null));};exports[_0xe811('0x41')]=function(_0x57cace,_0x139964){var _0xa61487={'raw':!![],'where':{'id':_0x57cace[_0xe811('0x42')]['id']}},_0x4d9ba0={};_0x4d9ba0['model']=_[_0xe811('0x28')](db[_0xe811('0x3d')][_0xe811('0x27')]);_0x4d9ba0['query']=_['keys'](_0x57cace['query']);_0x4d9ba0[_0xe811('0x2b')]=_['intersection'](_0x4d9ba0['model'],_0x4d9ba0[_0xe811('0x29')]);_0xa61487[_0xe811('0x2d')]=_['intersection'](_0x4d9ba0[_0xe811('0x30')],qs['fields'](_0x57cace['query'][_0xe811('0x2e')]));_0xa61487['attributes']=_0xa61487[_0xe811('0x2d')][_0xe811('0x2f')]?_0xa61487[_0xe811('0x2d')]:_0x4d9ba0['model'];if(_0x57cace[_0xe811('0x29')][_0xe811('0x43')]){_0xa61487[_0xe811('0x44')]=[{'all':!![]}];}_0xa61487=_[_0xe811('0x39')]({},_0xa61487,_0x57cace[_0xe811('0x45')]);return db['ChatQueueReport'][_0xe811('0x46')](_0xa61487)['then'](handleEntityNotFound(_0x139964,null))[_0xe811('0x20')](respondWithResult(_0x139964,null))[_0xe811('0x40')](handleError(_0x139964,null));};exports[_0xe811('0x47')]=function(_0x2e4865,_0xefcbde){return db[_0xe811('0x3d')][_0xe811('0x47')](_0x2e4865['body'],{})[_0xe811('0x20')](respondWithResult(_0xefcbde,0xc9))['catch'](handleError(_0xefcbde,null));};exports['update']=function(_0x136f13,_0x3a8602){if(_0x136f13[_0xe811('0x48')]['id']){delete _0x136f13['body']['id'];}return db[_0xe811('0x3d')]['find']({'where':{'id':_0x136f13['params']['id']}})[_0xe811('0x20')](handleEntityNotFound(_0x3a8602,null))[_0xe811('0x20')](saveUpdates(_0x136f13[_0xe811('0x48')],null))[_0xe811('0x20')](respondWithResult(_0x3a8602,null))['catch'](handleError(_0x3a8602,null));};exports[_0xe811('0x21')]=function(_0x450ef0,_0x247e2d){return db[_0xe811('0x3d')][_0xe811('0x46')]({'where':{'id':_0x450ef0[_0xe811('0x42')]['id']}})[_0xe811('0x20')](handleEntityNotFound(_0x247e2d,null))[_0xe811('0x20')](removeEntity(_0x247e2d,null))[_0xe811('0x40')](handleError(_0x247e2d,null));};exports['describe']=function(_0x27b81,_0x570ed9){return db['ChatQueueReport']['describe']()[_0xe811('0x20')](respondWithResult(_0x570ed9,null))[_0xe811('0x40')](handleError(_0x570ed9,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 22fe691..775aabf 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 _0x008c=['moment','request-promise','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x105a77,_0x193bdd){var _0x519f28=function(_0x356d67){while(--_0x356d67){_0x105a77['push'](_0x105a77['shift']());}};_0x519f28(++_0x193bdd);}(_0x008c,0x188));var _0xc008=function(_0x3d5aef,_0x64e2d5){_0x3d5aef=_0x3d5aef-0x0;var _0x33e385=_0x008c[_0x3d5aef];return _0x33e385;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var attributes=require(_0xc008('0x6'));module[_0xc008('0x7')]=function(_0x163bd9,_0x1cbe76){return _0x163bd9[_0xc008('0x8')](_0xc008('0x9'),attributes,{'tableName':_0xc008('0xa'),'paranoid':![],'indexes':[{'name':_0xc008('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['define','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','./chatQueueReport.attributes','exports'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x34e8,0x12c));var _0x834e=function(_0x586d52,_0x55e21b){_0x586d52=_0x586d52-0x0;var _0x1dfa4a=_0x34e8[_0x586d52];return _0x1dfa4a;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var attributes=require(_0x834e('0x6'));module[_0x834e('0x7')]=function(_0x289ef2,_0x19a3e0){return _0x289ef2[_0x834e('0x8')]('ChatQueueReport',attributes,{'tableName':_0x834e('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x834e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 8c0b7e5..d1febbc 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 _0xb8be=['request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','ChatQueueReport,\x20%s,\x20%s','CreateChatQueueReport','body','options','raw','debug','stringify','catch','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xb8be,0xa0));var _0xeb8b=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0xb8be[_0x582d0b];return _0x2e93e1;};'use strict';var _=require(_0xeb8b('0x0'));var util=require(_0xeb8b('0x1'));var moment=require(_0xeb8b('0x2'));var BPromise=require(_0xeb8b('0x3'));var rs=require(_0xeb8b('0x4'));var fs=require('fs');var Redis=require(_0xeb8b('0x5'));var db=require(_0xeb8b('0x6'))['db'];var utils=require(_0xeb8b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xeb8b('0x8'));var jayson=require(_0xeb8b('0x9'));var client=jayson[_0xeb8b('0xa')][_0xeb8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5118b8,_0x982b6b,_0x58e0d7){return new BPromise(function(_0x217884,_0x2e89d3){return client[_0xeb8b('0xc')](_0x5118b8,_0x58e0d7)[_0xeb8b('0xd')](function(_0x11816d){logger[_0xeb8b('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x982b6b,_0xeb8b('0xf'));logger['debug'](_0xeb8b('0x10'),_0x982b6b,_0xeb8b('0xf'),JSON['stringify'](_0x11816d));if(_0x11816d[_0xeb8b('0x11')]){if(_0x11816d['error'][_0xeb8b('0x12')]===0x1f4){logger[_0xeb8b('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x982b6b,_0x11816d[_0xeb8b('0x11')][_0xeb8b('0x13')]);return _0x2e89d3(_0x11816d[_0xeb8b('0x11')][_0xeb8b('0x13')]);}logger[_0xeb8b('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x982b6b,_0x11816d[_0xeb8b('0x11')]['message']);return _0x217884(_0x11816d[_0xeb8b('0x11')][_0xeb8b('0x13')]);}else{logger[_0xeb8b('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x982b6b,'request\x20sent');_0x217884(_0x11816d[_0xeb8b('0x14')][_0xeb8b('0x13')]);}})['catch'](function(_0xe7c314){logger[_0xeb8b('0x11')](_0xeb8b('0x15'),_0x982b6b,_0xe7c314);_0x2e89d3(_0xe7c314);});});}exports[_0xeb8b('0x16')]=function(_0xf5ec88){var _0x563219=this;return new Promise(function(_0x375f16,_0x59b13d){return db['ChatQueueReport']['create'](_0xf5ec88[_0xeb8b('0x17')],{'raw':_0xf5ec88[_0xeb8b('0x18')]?_0xf5ec88[_0xeb8b('0x18')][_0xeb8b('0x19')]===undefined?!![]:![]:!![]})[_0xeb8b('0xd')](function(_0x5b211e){logger['info'](_0xeb8b('0x16'),_0xf5ec88);logger[_0xeb8b('0x1a')](_0xeb8b('0x16'),_0xf5ec88,JSON[_0xeb8b('0x1b')](_0x5b211e));_0x375f16(_0x5b211e);})[_0xeb8b('0x1c')](function(_0x4f09cb){logger[_0xeb8b('0x11')](_0xeb8b('0x16'),_0x4f09cb[_0xeb8b('0x13')],_0xf5ec88);_0x59b13d(_0x563219['error'](0x1f4,_0x4f09cb[_0xeb8b('0x13')]));});});};exports[_0xeb8b('0x1d')]=function(_0x3537ae){var _0xb8251a=this;return new Promise(function(_0x215b0d,_0x5956a4){return db[_0xeb8b('0x1e')][_0xeb8b('0x1f')](_0x3537ae[_0xeb8b('0x17')],{'raw':_0x3537ae['options']?_0x3537ae[_0xeb8b('0x18')][_0xeb8b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3537ae[_0xeb8b('0x18')]?_0x3537ae[_0xeb8b('0x18')][_0xeb8b('0x20')]||null:null,'attributes':_0x3537ae['options']?_0x3537ae[_0xeb8b('0x18')][_0xeb8b('0x21')]||null:null,'limit':_0x3537ae['options']?_0x3537ae['options'][_0xeb8b('0x22')]||null:null})[_0xeb8b('0xd')](function(_0x49e4ff){logger[_0xeb8b('0xe')](_0xeb8b('0x1d'),_0x3537ae);logger[_0xeb8b('0x1a')](_0xeb8b('0x1d'),_0x3537ae,JSON['stringify'](_0x49e4ff));_0x215b0d(_0x49e4ff);})[_0xeb8b('0x1c')](function(_0x2bb3d7){logger[_0xeb8b('0x11')](_0xeb8b('0x1d'),_0x2bb3d7[_0xeb8b('0x13')],_0x3537ae);_0x5956a4(_0xb8251a[_0xeb8b('0x11')](0x1f4,_0x2bb3d7[_0xeb8b('0x13')]));});});}; \ No newline at end of file +var _0x7786=['result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','then','stringify','UpdateChatQueueReport','update','where','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4d4c59,_0x44fe0f){var _0xfc7b23=function(_0x4bc9ee){while(--_0x4bc9ee){_0x4d4c59['push'](_0x4d4c59['shift']());}};_0xfc7b23(++_0x44fe0f);}(_0x7786,0x11b));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6778('0x0'));var util=require(_0x6778('0x1'));var moment=require('moment');var BPromise=require(_0x6778('0x2'));var rs=require(_0x6778('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6778('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6778('0x5'))('rpc');var config=require(_0x6778('0x6'));var jayson=require(_0x6778('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1cd671,_0x572a9b,_0x4c9632){return new BPromise(function(_0x3fb18f,_0x2d7c20){return client[_0x6778('0x8')](_0x1cd671,_0x4c9632)['then'](function(_0x3363c3){logger[_0x6778('0x9')](_0x6778('0xa'),_0x572a9b,_0x6778('0xb'));logger[_0x6778('0xc')](_0x6778('0xd'),_0x572a9b,_0x6778('0xb'),JSON['stringify'](_0x3363c3));if(_0x3363c3['error']){if(_0x3363c3[_0x6778('0xe')][_0x6778('0xf')]===0x1f4){logger[_0x6778('0xe')](_0x6778('0xa'),_0x572a9b,_0x3363c3[_0x6778('0xe')]['message']);return _0x2d7c20(_0x3363c3[_0x6778('0xe')][_0x6778('0x10')]);}logger[_0x6778('0xe')](_0x6778('0xa'),_0x572a9b,_0x3363c3['error']['message']);return _0x3fb18f(_0x3363c3[_0x6778('0xe')]['message']);}else{logger[_0x6778('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x572a9b,_0x6778('0xb'));_0x3fb18f(_0x3363c3[_0x6778('0x11')]['message']);}})[_0x6778('0x12')](function(_0x484ac3){logger[_0x6778('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x572a9b,_0x484ac3);_0x2d7c20(_0x484ac3);});});}exports[_0x6778('0x13')]=function(_0x5d8a97){var _0x1b01e2=this;return new Promise(function(_0x148d76,_0x2fd8d6){return db[_0x6778('0x14')][_0x6778('0x15')](_0x5d8a97[_0x6778('0x16')],{'raw':_0x5d8a97[_0x6778('0x17')]?_0x5d8a97[_0x6778('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x6778('0x18')](function(_0x5a8c6e){logger[_0x6778('0x9')](_0x6778('0x13'),_0x5d8a97);logger[_0x6778('0xc')]('CreateChatQueueReport',_0x5d8a97,JSON[_0x6778('0x19')](_0x5a8c6e));_0x148d76(_0x5a8c6e);})[_0x6778('0x12')](function(_0x42b40a){logger[_0x6778('0xe')](_0x6778('0x13'),_0x42b40a[_0x6778('0x10')],_0x5d8a97);_0x2fd8d6(_0x1b01e2[_0x6778('0xe')](0x1f4,_0x42b40a[_0x6778('0x10')]));});});};exports[_0x6778('0x1a')]=function(_0x3e9b96){var _0x44c65f=this;return new Promise(function(_0x154914,_0x29f577){return db['ChatQueueReport'][_0x6778('0x1b')](_0x3e9b96[_0x6778('0x16')],{'raw':_0x3e9b96[_0x6778('0x17')]?_0x3e9b96[_0x6778('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e9b96[_0x6778('0x17')]?_0x3e9b96[_0x6778('0x17')][_0x6778('0x1c')]||null:null,'attributes':_0x3e9b96['options']?_0x3e9b96[_0x6778('0x17')]['attributes']||null:null,'limit':_0x3e9b96[_0x6778('0x17')]?_0x3e9b96[_0x6778('0x17')][_0x6778('0x1d')]||null:null})[_0x6778('0x18')](function(_0x3488ec){logger[_0x6778('0x9')]('UpdateChatQueueReport',_0x3e9b96);logger[_0x6778('0xc')](_0x6778('0x1a'),_0x3e9b96,JSON[_0x6778('0x19')](_0x3488ec));_0x154914(_0x3488ec);})[_0x6778('0x12')](function(_0xbbac6b){logger[_0x6778('0xe')]('UpdateChatQueueReport',_0xbbac6b[_0x6778('0x10')],_0x3e9b96);_0x29f577(_0x44c65f[_0x6778('0xe')](0x1f4,_0xbbac6b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index ca1b3e9..8b3a91e 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 _0x10ec=['index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x9e6e8c,_0x6ed498){var _0x120e48=function(_0x37031a){while(--_0x37031a){_0x9e6e8c['push'](_0x9e6e8c['shift']());}};_0x120e48(++_0x6ed498);}(_0x10ec,0x184));var _0xc10e=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x10ec[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xc10e('0x0'));var util=require(_0xc10e('0x1'));var path=require('path');var timeout=require(_0xc10e('0x2'));var express=require(_0xc10e('0x3'));var router=express[_0xc10e('0x4')]();var auth=require(_0xc10e('0x5'));var interaction=require(_0xc10e('0x6'));var config=require(_0xc10e('0x7'));var controller=require(_0xc10e('0x8'));router[_0xc10e('0x9')]('/',auth[_0xc10e('0xa')](),controller[_0xc10e('0xb')]);router['get'](_0xc10e('0xc'),auth[_0xc10e('0xa')](),controller[_0xc10e('0xd')]);router[_0xc10e('0x9')](_0xc10e('0xe'),auth[_0xc10e('0xa')](),controller[_0xc10e('0xf')]);router[_0xc10e('0x10')]('/',auth['isAuthenticated'](),controller[_0xc10e('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc10e('0x12')]);router[_0xc10e('0x13')](_0xc10e('0xe'),auth[_0xc10e('0xa')](),controller['destroy']);module[_0xc10e('0x14')]=router; \ No newline at end of file +var _0x8848=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','/:id','isAuthenticated','show','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5c4ce1,_0x3be64c){var _0x2fd310=function(_0x1ab4e8){while(--_0x1ab4e8){_0x5c4ce1['push'](_0x5c4ce1['shift']());}};_0x2fd310(++_0x3be64c);}(_0x8848,0x163));var _0x8884=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x8848[_0x1c8c28];return _0x1f59b4;};'use strict';var multer=require(_0x8884('0x0'));var util=require('util');var path=require(_0x8884('0x1'));var timeout=require(_0x8884('0x2'));var express=require(_0x8884('0x3'));var router=express[_0x8884('0x4')]();var auth=require(_0x8884('0x5'));var interaction=require(_0x8884('0x6'));var config=require(_0x8884('0x7'));var controller=require(_0x8884('0x8'));router[_0x8884('0x9')]('/',auth['isAuthenticated'](),controller[_0x8884('0xa')]);router[_0x8884('0x9')](_0x8884('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x8884('0x9')](_0x8884('0xc'),auth[_0x8884('0xd')](),controller[_0x8884('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8884('0xf')]);router[_0x8884('0x10')]('/:id',auth[_0x8884('0xd')](),controller[_0x8884('0x11')]);router[_0x8884('0x12')](_0x8884('0xc'),auth['isAuthenticated'](),controller['destroy']);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 8fcbf28..8ae78c4 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 _0xb01a=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb01a,0x111));var _0xab01=function(_0x4b234f,_0x30d262){_0x4b234f=_0x4b234f-0x0;var _0x4d3db1=_0xb01a[_0x4b234f];return _0x4d3db1;};'use strict';var moment=require(_0xab01('0x0'));var Sequelize=require('sequelize');module[_0xab01('0x1')]={'uniqueid':{'type':Sequelize[_0xab01('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xab01('0x3')](_0xab01('0x4'),_0xab01('0x5'),_0xab01('0x6')),'allowNull':![],'defaultValue':_0xab01('0x6')},'transferredAt':{'type':Sequelize[_0xab01('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xab01('0x8')]}}; \ No newline at end of file +var _0x9794=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x2f2fd8,_0x36aa74){var _0x1f1113=function(_0xf596b4){while(--_0xf596b4){_0x2f2fd8['push'](_0x2f2fd8['shift']());}};_0x1f1113(++_0x36aa74);}(_0x9794,0x170));var _0x4979=function(_0x3032d2,_0x55c88f){_0x3032d2=_0x3032d2-0x0;var _0x393bfd=_0x9794[_0x3032d2];return _0x393bfd;};'use strict';var moment=require(_0x4979('0x0'));var Sequelize=require(_0x4979('0x1'));module[_0x4979('0x2')]={'uniqueid':{'type':Sequelize[_0x4979('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4979('0x4')](_0x4979('0x5'),_0x4979('0x6'),_0x4979('0x7')),'allowNull':![],'defaultValue':_0x4979('0x7')},'transferredAt':{'type':Sequelize[_0x4979('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x4979('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 24c5219..0c80697 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 _0xa72d=['send','index','ChatTransferReport','model','keys','query','dateEnd','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','pick','dateStart','add','day','merge','filter','map','options','count','includeAll','include','catch','show','rawAttributes','fields','find','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name'];(function(_0x219bca,_0xe5a6e5){var _0x5e3451=function(_0x29a891){while(--_0x29a891){_0x219bca['push'](_0x219bca['shift']());}};_0x5e3451(++_0xe5a6e5);}(_0xa72d,0x6d));var _0xda72=function(_0x4fe22e,_0x581f98){_0x4fe22e=_0x4fe22e-0x0;var _0x176b81=_0xa72d[_0x4fe22e];return _0x176b81;};'use strict';var pdf=require(_0xda72('0x0'));var emlformat=require(_0xda72('0x1'));var rimraf=require(_0xda72('0x2'));var zipdir=require(_0xda72('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda72('0x4'));var moment=require(_0xda72('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xda72('0x6'));var util=require(_0xda72('0x7'));var path=require(_0xda72('0x8'));var sox=require(_0xda72('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xda72('0xa'));var squel=require(_0xda72('0xb'));var crypto=require(_0xda72('0xc'));var jsforce=require(_0xda72('0xd'));var deskjs=require(_0xda72('0xe'));var toCsv=require(_0xda72('0xf'));var querystring=require('querystring');var Papa=require(_0xda72('0x10'));var Redis=require(_0xda72('0x11'));var qs=require(_0xda72('0x12'));var logger=require(_0xda72('0x13'))(_0xda72('0x14'));var utils=require(_0xda72('0x15'));var config=require(_0xda72('0x16'));var db=require(_0xda72('0x17'))['db'];function respondWithStatusCode(_0x1e23a5,_0x5864e6){_0x5864e6=_0x5864e6||0xcc;return function(_0x5613e8){if(_0x5613e8){return _0x1e23a5[_0xda72('0x18')](_0x5864e6);}return _0x1e23a5[_0xda72('0x19')](_0x5864e6)[_0xda72('0x1a')]();};}function respondWithResult(_0x176de9,_0xda8da2){_0xda8da2=_0xda8da2||0xc8;return function(_0x2a8716){if(_0x2a8716){return _0x176de9['status'](_0xda8da2)['json'](_0x2a8716);}};}function respondWithFilteredResult(_0x24f348,_0x258136){return function(_0x49a225){if(_0x49a225){var _0x73fe9=_0x49a225['count'],_0x48c548=_0x258136[_0xda72('0x1b')],_0x58ca8a=_0x258136['offset']+_0x258136['limit'],_0x480f73;if(_0x58ca8a>=_0x73fe9){_0x58ca8a=_0x73fe9;_0x480f73=0xc8;}else{_0x480f73=0xce;}_0x24f348['status'](_0x480f73);return _0x24f348[_0xda72('0x1c')](_0xda72('0x1d'),_0x48c548+'-'+_0x58ca8a+'/'+_0x73fe9)[_0xda72('0x1e')](_0x49a225);}return null;};}function patchUpdates(_0x2a22f7){return function(_0x3fb171){try{jsonpatch[_0xda72('0x1f')](_0x3fb171,_0x2a22f7,!![]);}catch(_0x386c3d){return BPromise[_0xda72('0x20')](_0x386c3d);}return _0x3fb171['save']();};}function saveUpdates(_0x4cb222,_0x49d676){return function(_0x560103){if(_0x560103){return _0x560103[_0xda72('0x21')](_0x4cb222)[_0xda72('0x22')](function(_0x370306){return _0x370306;});}return null;};}function removeEntity(_0x406ca2,_0x551c30){return function(_0x1ae64d){if(_0x1ae64d){return _0x1ae64d[_0xda72('0x23')]()[_0xda72('0x22')](function(){_0x406ca2[_0xda72('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5da1,_0xfd33b3){return function(_0x2f28a8){if(!_0x2f28a8){_0x3c5da1[_0xda72('0x18')](0x194);}return _0x2f28a8;};}function handleError(_0x5e9400,_0x6ae8c4){_0x6ae8c4=_0x6ae8c4||0x1f4;return function(_0x19e8c0){logger[_0xda72('0x24')](_0x19e8c0[_0xda72('0x25')]);if(_0x19e8c0['name']){delete _0x19e8c0[_0xda72('0x26')];}_0x5e9400[_0xda72('0x19')](_0x6ae8c4)[_0xda72('0x27')](_0x19e8c0);};}exports[_0xda72('0x28')]=function(_0x3f966a,_0x2586d4){var _0x178491={},_0x33e408={},_0x43cbb6={'count':0x0,'rows':[]};var _0x228944=db[_0xda72('0x29')]['rawAttributes'];_0x33e408[_0xda72('0x2a')]=_[_0xda72('0x2b')](_0x228944);var _0x3bcc67={'dateStart':_0x3f966a[_0xda72('0x2c')]['dateStart'],'dateEnd':_0x3f966a[_0xda72('0x2c')][_0xda72('0x2d')]};delete _0x3f966a[_0xda72('0x2c')]['dateStart'];delete _0x3f966a[_0xda72('0x2c')][_0xda72('0x2d')];_0x33e408['query']=_['keys'](_0x3f966a['query']);_0x33e408[_0xda72('0x2e')]=_['intersection'](_0x33e408[_0xda72('0x2a')],_0x33e408['query']);_0x178491['attributes']=_[_0xda72('0x2f')](_0x33e408[_0xda72('0x2a')],qs['fields'](_0x3f966a[_0xda72('0x2c')]['fields']));_0x178491[_0xda72('0x30')]=_0x178491['attributes'][_0xda72('0x31')]?_0x178491[_0xda72('0x30')]:_0x33e408['model'];if(!_0x3f966a[_0xda72('0x2c')][_0xda72('0x32')]('nolimit')){_0x178491['limit']=qs[_0xda72('0x33')](_0x3f966a[_0xda72('0x2c')][_0xda72('0x33')]);_0x178491[_0xda72('0x1b')]=qs[_0xda72('0x1b')](_0x3f966a[_0xda72('0x2c')][_0xda72('0x1b')]);}_0x178491[_0xda72('0x34')]=qs[_0xda72('0x35')](_0x3f966a['query'][_0xda72('0x35')]);_0x178491[_0xda72('0x36')]=qs[_0xda72('0x2e')](_[_0xda72('0x37')](_0x3f966a[_0xda72('0x2c')],_0x33e408[_0xda72('0x2e')]));if(_0x3bcc67[_0xda72('0x38')]){if(_0x3bcc67[_0xda72('0x2d')]){_0x3bcc67[_0xda72('0x2d')]=moment(_0x3bcc67[_0xda72('0x2d')])[_0xda72('0x39')](0x1,'day');}else{_0x3bcc67['dateEnd']=moment(_0x3bcc67[_0xda72('0x38')])[_0xda72('0x39')](0x1,_0xda72('0x3a'));}_[_0xda72('0x3b')](_0x178491[_0xda72('0x36')],{'createdAt':{'$gte':_0x3bcc67['dateStart'],'$lte':_0x3bcc67['dateEnd']}});}if(_0x3f966a['query'][_0xda72('0x3c')]){_0x178491['where']=_['merge'](_0x178491[_0xda72('0x36')],{'$or':_[_0xda72('0x3d')](_0x178491['attributes'],function(_0x2a26f1){var _0x166746={};_0x166746[_0x2a26f1]={'$like':'%'+_0x3f966a[_0xda72('0x2c')][_0xda72('0x3c')]+'%'};return _0x166746;})});}_0x178491=_[_0xda72('0x3b')]({},_0x178491,_0x3f966a[_0xda72('0x3e')]);var _0x35ad78={'where':_0x178491[_0xda72('0x36')]};return db[_0xda72('0x29')][_0xda72('0x3f')](_0x35ad78)['then'](function(_0x4e1bbd){_0x43cbb6[_0xda72('0x3f')]=_0x4e1bbd;if(_0x3f966a[_0xda72('0x2c')][_0xda72('0x40')]){_0x178491[_0xda72('0x41')]=[{'all':!![]}];}return db[_0xda72('0x29')]['findAll'](_0x178491);})['then'](function(_0x4f40ca){_0x43cbb6['rows']=_0x4f40ca;return _0x43cbb6;})[_0xda72('0x22')](respondWithFilteredResult(_0x2586d4,_0x178491))[_0xda72('0x42')](handleError(_0x2586d4,null));};exports[_0xda72('0x43')]=function(_0x1a51f1,_0x426a86){var _0x395ac8={'raw':!![],'where':{'id':_0x1a51f1['params']['id']}},_0x248b10={};_0x248b10[_0xda72('0x2a')]=_[_0xda72('0x2b')](db[_0xda72('0x29')][_0xda72('0x44')]);_0x248b10['query']=_[_0xda72('0x2b')](_0x1a51f1[_0xda72('0x2c')]);_0x248b10[_0xda72('0x2e')]=_['intersection'](_0x248b10[_0xda72('0x2a')],_0x248b10[_0xda72('0x2c')]);_0x395ac8['attributes']=_[_0xda72('0x2f')](_0x248b10[_0xda72('0x2a')],qs[_0xda72('0x45')](_0x1a51f1[_0xda72('0x2c')][_0xda72('0x45')]));_0x395ac8['attributes']=_0x395ac8[_0xda72('0x30')][_0xda72('0x31')]?_0x395ac8[_0xda72('0x30')]:_0x248b10[_0xda72('0x2a')];if(_0x1a51f1['query'][_0xda72('0x40')]){_0x395ac8[_0xda72('0x41')]=[{'all':!![]}];}_0x395ac8=_[_0xda72('0x3b')]({},_0x395ac8,_0x1a51f1[_0xda72('0x3e')]);return db[_0xda72('0x29')][_0xda72('0x46')](_0x395ac8)[_0xda72('0x22')](handleEntityNotFound(_0x426a86,null))[_0xda72('0x22')](respondWithResult(_0x426a86,null))[_0xda72('0x42')](handleError(_0x426a86,null));};exports['create']=function(_0x131f12,_0x57c986){return db['ChatTransferReport']['create'](_0x131f12[_0xda72('0x47')],{})['then'](respondWithResult(_0x57c986,0xc9))[_0xda72('0x42')](handleError(_0x57c986,null));};exports[_0xda72('0x21')]=function(_0x1ca305,_0xfac698){if(_0x1ca305[_0xda72('0x47')]['id']){delete _0x1ca305[_0xda72('0x47')]['id'];}return db['ChatTransferReport'][_0xda72('0x46')]({'where':{'id':_0x1ca305[_0xda72('0x48')]['id']}})['then'](handleEntityNotFound(_0xfac698,null))['then'](saveUpdates(_0x1ca305[_0xda72('0x47')],null))[_0xda72('0x22')](respondWithResult(_0xfac698,null))['catch'](handleError(_0xfac698,null));};exports[_0xda72('0x23')]=function(_0x3bdf2d,_0x1f4ed2){return db[_0xda72('0x29')][_0xda72('0x46')]({'where':{'id':_0x3bdf2d[_0xda72('0x48')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x1f4ed2,null))[_0xda72('0x22')](removeEntity(_0x1f4ed2,null))['catch'](handleError(_0x1f4ed2,null));};exports[_0xda72('0x49')]=function(_0x3afdeb,_0x2ae0c2){return db[_0xda72('0x29')][_0xda72('0x49')]()['then'](respondWithResult(_0x2ae0c2,null))[_0xda72('0x42')](handleError(_0x2ae0c2,null));}; \ No newline at end of file +var _0x2d36=['papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','add','day','merge','filter','map','options','count','includeAll','findAll','rows','catch','show','ChatTransferReport','rawAttributes','length','create','body','find','params','describe','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','lodash','crypto','desk.js','to-csv','querystring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2d36,0xcb));var _0x62d3=function(_0x489fc1,_0x54c815){_0x489fc1=_0x489fc1-0x0;var _0x4d0773=_0x2d36[_0x489fc1];return _0x4d0773;};'use strict';var pdf=require(_0x62d3('0x0'));var emlformat=require(_0x62d3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x62d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x62d3('0x3'));var BPromise=require(_0x62d3('0x4'));var Mustache=require('mustache');var util=require(_0x62d3('0x5'));var path=require(_0x62d3('0x6'));var sox=require(_0x62d3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x62d3('0x8'));var squel=require('squel');var crypto=require(_0x62d3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x62d3('0xa'));var toCsv=require(_0x62d3('0xb'));var querystring=require(_0x62d3('0xc'));var Papa=require(_0x62d3('0xd'));var Redis=require(_0x62d3('0xe'));var qs=require(_0x62d3('0xf'));var logger=require(_0x62d3('0x10'))(_0x62d3('0x11'));var utils=require(_0x62d3('0x12'));var config=require(_0x62d3('0x13'));var db=require(_0x62d3('0x14'))['db'];function respondWithStatusCode(_0x20f558,_0x3b3bba){_0x3b3bba=_0x3b3bba||0xcc;return function(_0x112537){if(_0x112537){return _0x20f558[_0x62d3('0x15')](_0x3b3bba);}return _0x20f558[_0x62d3('0x16')](_0x3b3bba)['end']();};}function respondWithResult(_0x4cd0e5,_0x36253e){_0x36253e=_0x36253e||0xc8;return function(_0x29a4b0){if(_0x29a4b0){return _0x4cd0e5[_0x62d3('0x16')](_0x36253e)[_0x62d3('0x17')](_0x29a4b0);}};}function respondWithFilteredResult(_0x2bdd5e,_0x22ac6a){return function(_0x51dec0){if(_0x51dec0){var _0x57c553=_0x51dec0['count'],_0x587e1c=_0x22ac6a['offset'],_0x2b21a1=_0x22ac6a[_0x62d3('0x18')]+_0x22ac6a['limit'],_0xa547e0;if(_0x2b21a1>=_0x57c553){_0x2b21a1=_0x57c553;_0xa547e0=0xc8;}else{_0xa547e0=0xce;}_0x2bdd5e['status'](_0xa547e0);return _0x2bdd5e[_0x62d3('0x19')](_0x62d3('0x1a'),_0x587e1c+'-'+_0x2b21a1+'/'+_0x57c553)[_0x62d3('0x17')](_0x51dec0);}return null;};}function patchUpdates(_0x19efe0){return function(_0x5d4301){try{jsonpatch[_0x62d3('0x1b')](_0x5d4301,_0x19efe0,!![]);}catch(_0x3e8ed7){return BPromise[_0x62d3('0x1c')](_0x3e8ed7);}return _0x5d4301[_0x62d3('0x1d')]();};}function saveUpdates(_0x4d6ae1,_0x533e73){return function(_0x23354d){if(_0x23354d){return _0x23354d[_0x62d3('0x1e')](_0x4d6ae1)[_0x62d3('0x1f')](function(_0x5d2050){return _0x5d2050;});}return null;};}function removeEntity(_0x104712,_0x108d64){return function(_0x529912){if(_0x529912){return _0x529912[_0x62d3('0x20')]()['then'](function(){_0x104712[_0x62d3('0x16')](0xcc)[_0x62d3('0x21')]();});}};}function handleEntityNotFound(_0x11f791,_0x56bd31){return function(_0x28150d){if(!_0x28150d){_0x11f791['sendStatus'](0x194);}return _0x28150d;};}function handleError(_0x195d6d,_0x5332b3){_0x5332b3=_0x5332b3||0x1f4;return function(_0x30cffc){logger[_0x62d3('0x22')](_0x30cffc[_0x62d3('0x23')]);if(_0x30cffc[_0x62d3('0x24')]){delete _0x30cffc[_0x62d3('0x24')];}_0x195d6d[_0x62d3('0x16')](_0x5332b3)[_0x62d3('0x25')](_0x30cffc);};}exports['index']=function(_0x59976c,_0x433f03){var _0x7b5ae={},_0x4c7f50={},_0x494544={'count':0x0,'rows':[]};var _0x5529ad=db['ChatTransferReport']['rawAttributes'];_0x4c7f50['model']=_[_0x62d3('0x26')](_0x5529ad);var _0x53d09a={'dateStart':_0x59976c[_0x62d3('0x27')][_0x62d3('0x28')],'dateEnd':_0x59976c['query'][_0x62d3('0x29')]};delete _0x59976c[_0x62d3('0x27')][_0x62d3('0x28')];delete _0x59976c[_0x62d3('0x27')]['dateEnd'];_0x4c7f50['query']=_[_0x62d3('0x26')](_0x59976c[_0x62d3('0x27')]);_0x4c7f50[_0x62d3('0x2a')]=_[_0x62d3('0x2b')](_0x4c7f50[_0x62d3('0x2c')],_0x4c7f50['query']);_0x7b5ae[_0x62d3('0x2d')]=_[_0x62d3('0x2b')](_0x4c7f50[_0x62d3('0x2c')],qs[_0x62d3('0x2e')](_0x59976c[_0x62d3('0x27')][_0x62d3('0x2e')]));_0x7b5ae['attributes']=_0x7b5ae[_0x62d3('0x2d')]['length']?_0x7b5ae[_0x62d3('0x2d')]:_0x4c7f50[_0x62d3('0x2c')];if(!_0x59976c['query'][_0x62d3('0x2f')]('nolimit')){_0x7b5ae[_0x62d3('0x30')]=qs[_0x62d3('0x30')](_0x59976c[_0x62d3('0x27')][_0x62d3('0x30')]);_0x7b5ae[_0x62d3('0x18')]=qs[_0x62d3('0x18')](_0x59976c['query'][_0x62d3('0x18')]);}_0x7b5ae[_0x62d3('0x31')]=qs[_0x62d3('0x32')](_0x59976c[_0x62d3('0x27')][_0x62d3('0x32')]);_0x7b5ae[_0x62d3('0x33')]=qs[_0x62d3('0x2a')](_['pick'](_0x59976c[_0x62d3('0x27')],_0x4c7f50[_0x62d3('0x2a')]));if(_0x53d09a[_0x62d3('0x28')]){if(_0x53d09a[_0x62d3('0x29')]){_0x53d09a[_0x62d3('0x29')]=moment(_0x53d09a[_0x62d3('0x29')])[_0x62d3('0x34')](0x1,_0x62d3('0x35'));}else{_0x53d09a[_0x62d3('0x29')]=moment(_0x53d09a['dateStart'])['add'](0x1,_0x62d3('0x35'));}_[_0x62d3('0x36')](_0x7b5ae[_0x62d3('0x33')],{'createdAt':{'$gte':_0x53d09a['dateStart'],'$lte':_0x53d09a[_0x62d3('0x29')]}});}if(_0x59976c[_0x62d3('0x27')][_0x62d3('0x37')]){_0x7b5ae[_0x62d3('0x33')]=_[_0x62d3('0x36')](_0x7b5ae[_0x62d3('0x33')],{'$or':_[_0x62d3('0x38')](_0x7b5ae[_0x62d3('0x2d')],function(_0x522f69){var _0x15b43c={};_0x15b43c[_0x522f69]={'$like':'%'+_0x59976c['query'][_0x62d3('0x37')]+'%'};return _0x15b43c;})});}_0x7b5ae=_[_0x62d3('0x36')]({},_0x7b5ae,_0x59976c[_0x62d3('0x39')]);var _0x32c5d0={'where':_0x7b5ae[_0x62d3('0x33')]};return db['ChatTransferReport']['count'](_0x32c5d0)[_0x62d3('0x1f')](function(_0x410ae9){_0x494544[_0x62d3('0x3a')]=_0x410ae9;if(_0x59976c[_0x62d3('0x27')][_0x62d3('0x3b')]){_0x7b5ae['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x62d3('0x3c')](_0x7b5ae);})[_0x62d3('0x1f')](function(_0x28ab56){_0x494544[_0x62d3('0x3d')]=_0x28ab56;return _0x494544;})[_0x62d3('0x1f')](respondWithFilteredResult(_0x433f03,_0x7b5ae))[_0x62d3('0x3e')](handleError(_0x433f03,null));};exports[_0x62d3('0x3f')]=function(_0x4a3a14,_0x495551){var _0x10c78e={'raw':!![],'where':{'id':_0x4a3a14['params']['id']}},_0x4f0300={};_0x4f0300[_0x62d3('0x2c')]=_[_0x62d3('0x26')](db[_0x62d3('0x40')][_0x62d3('0x41')]);_0x4f0300[_0x62d3('0x27')]=_[_0x62d3('0x26')](_0x4a3a14[_0x62d3('0x27')]);_0x4f0300['filters']=_[_0x62d3('0x2b')](_0x4f0300[_0x62d3('0x2c')],_0x4f0300['query']);_0x10c78e[_0x62d3('0x2d')]=_['intersection'](_0x4f0300[_0x62d3('0x2c')],qs[_0x62d3('0x2e')](_0x4a3a14[_0x62d3('0x27')]['fields']));_0x10c78e[_0x62d3('0x2d')]=_0x10c78e[_0x62d3('0x2d')][_0x62d3('0x42')]?_0x10c78e[_0x62d3('0x2d')]:_0x4f0300[_0x62d3('0x2c')];if(_0x4a3a14['query']['includeAll']){_0x10c78e['include']=[{'all':!![]}];}_0x10c78e=_[_0x62d3('0x36')]({},_0x10c78e,_0x4a3a14[_0x62d3('0x39')]);return db[_0x62d3('0x40')]['find'](_0x10c78e)['then'](handleEntityNotFound(_0x495551,null))[_0x62d3('0x1f')](respondWithResult(_0x495551,null))[_0x62d3('0x3e')](handleError(_0x495551,null));};exports['create']=function(_0x2b4755,_0x4b2c97){return db[_0x62d3('0x40')][_0x62d3('0x43')](_0x2b4755[_0x62d3('0x44')],{})['then'](respondWithResult(_0x4b2c97,0xc9))[_0x62d3('0x3e')](handleError(_0x4b2c97,null));};exports[_0x62d3('0x1e')]=function(_0x203868,_0x4d18a3){if(_0x203868[_0x62d3('0x44')]['id']){delete _0x203868[_0x62d3('0x44')]['id'];}return db[_0x62d3('0x40')][_0x62d3('0x45')]({'where':{'id':_0x203868['params']['id']}})['then'](handleEntityNotFound(_0x4d18a3,null))[_0x62d3('0x1f')](saveUpdates(_0x203868[_0x62d3('0x44')],null))[_0x62d3('0x1f')](respondWithResult(_0x4d18a3,null))[_0x62d3('0x3e')](handleError(_0x4d18a3,null));};exports[_0x62d3('0x20')]=function(_0x29d019,_0x4fd25f){return db['ChatTransferReport'][_0x62d3('0x45')]({'where':{'id':_0x29d019[_0x62d3('0x46')]['id']}})['then'](handleEntityNotFound(_0x4fd25f,null))['then'](removeEntity(_0x4fd25f,null))[_0x62d3('0x3e')](handleError(_0x4fd25f,null));};exports[_0x62d3('0x47')]=function(_0x426610,_0x280c58){return db[_0x62d3('0x40')][_0x62d3('0x47')]()[_0x62d3('0x1f')](respondWithResult(_0x280c58,null))[_0x62d3('0x3e')](handleError(_0x280c58,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3000fe0..b3a49ec 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 _0xbe8e=['lodash','util','../../config/logger','api','moment','bluebird','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xbe8e,0x16b));var _0xebe8=function(_0x3533e3,_0x254f61){_0x3533e3=_0x3533e3-0x0;var _0x584365=_0xbe8e[_0x3533e3];return _0x584365;};'use strict';var _=require(_0xebe8('0x0'));var util=require(_0xebe8('0x1'));var logger=require(_0xebe8('0x2'))(_0xebe8('0x3'));var moment=require(_0xebe8('0x4'));var BPromise=require(_0xebe8('0x5'));var rp=require('request-promise');var attributes=require(_0xebe8('0x6'));module[_0xebe8('0x7')]=function(_0x412d87,_0x508578){return _0x412d87[_0xebe8('0x8')]('ChatTransferReport',attributes,{'tableName':_0xebe8('0x9'),'paranoid':![],'indexes':[{'name':_0xebe8('0xa'),'fields':[_0xebe8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17ca=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x4b2a1e,_0x58debe){var _0x3f12a9=function(_0x1eeec5){while(--_0x1eeec5){_0x4b2a1e['push'](_0x4b2a1e['shift']());}};_0x3f12a9(++_0x58debe);}(_0x17ca,0x16c));var _0xa17c=function(_0x3e52e3,_0x23a711){_0x3e52e3=_0x3e52e3-0x0;var _0xaac282=_0x17ca[_0x3e52e3];return _0xaac282;};'use strict';var _=require(_0xa17c('0x0'));var util=require(_0xa17c('0x1'));var logger=require(_0xa17c('0x2'))(_0xa17c('0x3'));var moment=require(_0xa17c('0x4'));var BPromise=require(_0xa17c('0x5'));var rp=require(_0xa17c('0x6'));var attributes=require(_0xa17c('0x7'));module[_0xa17c('0x8')]=function(_0x4a9082,_0x1ef1d0){return _0x4a9082[_0xa17c('0x9')](_0xa17c('0xa'),attributes,{'tableName':_0xa17c('0xb'),'paranoid':![],'indexes':[{'name':_0xa17c('0xc'),'fields':[_0xa17c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 63edbaf..d52cf4d 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 _0x380a=['message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatTransferReport,\x20%s,\x20%s'];(function(_0x26ac27,_0x574b86){var _0x44a599=function(_0x130e2c){while(--_0x130e2c){_0x26ac27['push'](_0x26ac27['shift']());}};_0x44a599(++_0x574b86);}(_0x380a,0x16c));var _0xa380=function(_0x34f553,_0x5885f0){_0x34f553=_0x34f553-0x0;var _0x271bf2=_0x380a[_0x34f553];return _0x271bf2;};'use strict';var _=require(_0xa380('0x0'));var util=require(_0xa380('0x1'));var moment=require(_0xa380('0x2'));var BPromise=require('bluebird');var rs=require(_0xa380('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa380('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa380('0x5'));var jayson=require(_0xa380('0x6'));var client=jayson[_0xa380('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x570db0,_0x52b3aa,_0x842c8e){return new BPromise(function(_0x4d583c,_0x5cfb5e){return client[_0xa380('0x8')](_0x570db0,_0x842c8e)[_0xa380('0x9')](function(_0x49ea22){logger[_0xa380('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x52b3aa,'request\x20sent');logger['debug'](_0xa380('0xb'),_0x52b3aa,_0xa380('0xc'),JSON['stringify'](_0x49ea22));if(_0x49ea22[_0xa380('0xd')]){if(_0x49ea22[_0xa380('0xd')][_0xa380('0xe')]===0x1f4){logger[_0xa380('0xd')](_0xa380('0xf'),_0x52b3aa,_0x49ea22[_0xa380('0xd')][_0xa380('0x10')]);return _0x5cfb5e(_0x49ea22['error'][_0xa380('0x10')]);}logger[_0xa380('0xd')](_0xa380('0xf'),_0x52b3aa,_0x49ea22['error']['message']);return _0x4d583c(_0x49ea22[_0xa380('0xd')][_0xa380('0x10')]);}else{logger[_0xa380('0xa')](_0xa380('0xf'),_0x52b3aa,_0xa380('0xc'));_0x4d583c(_0x49ea22[_0xa380('0x11')]['message']);}})[_0xa380('0x12')](function(_0x5cb63d){logger[_0xa380('0xd')](_0xa380('0xf'),_0x52b3aa,_0x5cb63d);_0x5cfb5e(_0x5cb63d);});});} \ No newline at end of file +var _0xcdd2=['rpc','../../config/environment','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0xcdd2,0x13d));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var moment=require('moment');var BPromise=require(_0x2cdd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cdd('0x3'));var db=require(_0x2cdd('0x4'))['db'];var utils=require(_0x2cdd('0x5'));var logger=require('../../config/logger')(_0x2cdd('0x6'));var config=require(_0x2cdd('0x7'));var jayson=require(_0x2cdd('0x8'));var client=jayson[_0x2cdd('0x9')][_0x2cdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dd0d4,_0x8b9856,_0x3a4498){return new BPromise(function(_0x25e2f8,_0x1e63f3){return client['request'](_0x3dd0d4,_0x3a4498)['then'](function(_0x28b7c7){logger[_0x2cdd('0xb')](_0x2cdd('0xc'),_0x8b9856,_0x2cdd('0xd'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x8b9856,_0x2cdd('0xd'),JSON['stringify'](_0x28b7c7));if(_0x28b7c7[_0x2cdd('0xe')]){if(_0x28b7c7[_0x2cdd('0xe')][_0x2cdd('0xf')]===0x1f4){logger[_0x2cdd('0xe')](_0x2cdd('0xc'),_0x8b9856,_0x28b7c7[_0x2cdd('0xe')][_0x2cdd('0x10')]);return _0x1e63f3(_0x28b7c7[_0x2cdd('0xe')][_0x2cdd('0x10')]);}logger[_0x2cdd('0xe')](_0x2cdd('0xc'),_0x8b9856,_0x28b7c7[_0x2cdd('0xe')][_0x2cdd('0x10')]);return _0x25e2f8(_0x28b7c7['error'][_0x2cdd('0x10')]);}else{logger['info'](_0x2cdd('0xc'),_0x8b9856,_0x2cdd('0xd'));_0x25e2f8(_0x28b7c7[_0x2cdd('0x11')][_0x2cdd('0x10')]);}})[_0x2cdd('0x12')](function(_0x7ae468){logger[_0x2cdd('0xe')](_0x2cdd('0xc'),_0x8b9856,_0x7ae468);_0x1e63f3(_0x7ae468);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 895ad3d..4a496be 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 _0xc537=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x20dd9b,_0x3c0fb8){var _0x2de3b0=function(_0x5673d2){while(--_0x5673d2){_0x20dd9b['push'](_0x20dd9b['shift']());}};_0x2de3b0(++_0x3c0fb8);}(_0xc537,0x1b6));var _0x7c53=function(_0x5bc351,_0x38b55f){_0x5bc351=_0x5bc351-0x0;var _0x321b95=_0xc537[_0x5bc351];return _0x321b95;};'use strict';var multer=require('multer');var util=require(_0x7c53('0x0'));var path=require(_0x7c53('0x1'));var timeout=require(_0x7c53('0x2'));var express=require('express');var router=express[_0x7c53('0x3')]();var auth=require(_0x7c53('0x4'));var interaction=require(_0x7c53('0x5'));var config=require(_0x7c53('0x6'));var controller=require(_0x7c53('0x7'));router[_0x7c53('0x8')]('/',auth[_0x7c53('0x9')](),controller[_0x7c53('0xa')]);router[_0x7c53('0x8')](_0x7c53('0xb'),auth[_0x7c53('0x9')](),controller[_0x7c53('0xc')]);router[_0x7c53('0x8')](_0x7c53('0xd'),auth[_0x7c53('0x9')](),controller[_0x7c53('0xe')]);router[_0x7c53('0xf')]('/',auth[_0x7c53('0x9')](),controller[_0x7c53('0x10')]);router[_0x7c53('0x11')]('/:id',auth[_0x7c53('0x9')](),controller['update']);router[_0x7c53('0x12')](_0x7c53('0xd'),auth['isAuthenticated'](),controller[_0x7c53('0x13')]);module[_0x7c53('0x14')]=router; \ No newline at end of file +var _0xbae6=['show','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x2df341,_0x1945e3){var _0x3bdc13=function(_0x118e26){while(--_0x118e26){_0x2df341['push'](_0x2df341['shift']());}};_0x3bdc13(++_0x1945e3);}(_0xbae6,0x172));var _0x6bae=function(_0x4a800a,_0x2255e2){_0x4a800a=_0x4a800a-0x0;var _0x151b5b=_0xbae6[_0x4a800a];return _0x151b5b;};'use strict';var multer=require(_0x6bae('0x0'));var util=require(_0x6bae('0x1'));var path=require(_0x6bae('0x2'));var timeout=require(_0x6bae('0x3'));var express=require(_0x6bae('0x4'));var router=express[_0x6bae('0x5')]();var auth=require(_0x6bae('0x6'));var interaction=require(_0x6bae('0x7'));var config=require('../../config/environment');var controller=require(_0x6bae('0x8'));router[_0x6bae('0x9')]('/',auth[_0x6bae('0xa')](),controller[_0x6bae('0xb')]);router[_0x6bae('0x9')]('/describe',auth[_0x6bae('0xa')](),controller[_0x6bae('0xc')]);router[_0x6bae('0x9')](_0x6bae('0xd'),auth[_0x6bae('0xa')](),controller[_0x6bae('0xe')]);router['post']('/',auth[_0x6bae('0xa')](),controller['create']);router['put'](_0x6bae('0xd'),auth[_0x6bae('0xa')](),controller['update']);router['delete'](_0x6bae('0xd'),auth[_0x6bae('0xa')](),controller['destroy']);module[_0x6bae('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 2fedf61..00fb6ea 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 _0x8f1a=['Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','#fafafa','sequelize','randomstring','exports','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','ENUM','rounded','We\x20are\x20here!','Chat','Send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x1b4104,_0x572fc6){_0x1b4104=_0x1b4104-0x0;var _0x4a64f8=_0x8f1a[_0x1b4104];return _0x4a64f8;};'use strict';var Sequelize=require(_0xa8f1('0x0'));var rs=require(_0xa8f1('0x1'));module[_0xa8f1('0x2')]={'name':{'type':Sequelize[_0xa8f1('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xa8f1('0x3')],'allowNull':![],'unique':_0xa8f1('0x4')},'description':{'type':Sequelize[_0xa8f1('0x3')]},'mapKey':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xa8f1('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa8f1('0x3')],'allowNull':![],'defaultValue':_0xa8f1('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa8f1('0x3')],'allowNull':![],'defaultValue':_0xa8f1('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa8f1('0x3')],'allowNull':![],'defaultValue':_0xa8f1('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa8f1('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa8f1('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xa8f1('0xa')](_0xa8f1('0xb'),'squared'),'defaultValue':_0xa8f1('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xa8f1('0xc')},'start_chat_button':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xa8f1('0xe')},'header_offline':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0xf')},'download_transcript':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa8f1('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xa8f1('0x11')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa8f1('0x12')]},'closingQuestion':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa8f1('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x14')},'noteTitle':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x15')},'placeholderMessage':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x16')},'closingMessage':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x17')},'closingMessageButton':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0xe')},'skipMessageButton':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x18')},'conditionAgreement':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingType':{'type':Sequelize[_0xa8f1('0xa')](_0xa8f1('0x19'),_0xa8f1('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xa8f1('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa8f1('0x12')],'defaultValue':function(){return JSON[_0xa8f1('0x1b')]({'items':[{'type':_0xa8f1('0x1c'),'variable':null,'config':{'placeholder':_0xa8f1('0x1d'),'type':'text','required':!![]},'props':{'title':_0xa8f1('0x1d'),'helpText':''}},{'type':_0xa8f1('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa8f1('0x5'),'type':_0xa8f1('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa8f1('0x1e')](_0xa8f1('0x1f'))?JSON[_0xa8f1('0x20')](this[_0xa8f1('0x1e')](_0xa8f1('0x1f'))):{};},'set':function(_0x2e2dc6){return this[_0xa8f1('0x21')]('onlineForm',JSON[_0xa8f1('0x1b')](_0x2e2dc6));}},'offlineForm':{'type':Sequelize[_0xa8f1('0x12')],'defaultValue':function(){return JSON[_0xa8f1('0x1b')]({'items':[{'type':_0xa8f1('0x1c'),'props':{'title':_0xa8f1('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xa8f1('0x5')},'variable':null},{'type':_0xa8f1('0x22'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xa8f1('0x1e')](_0xa8f1('0x23'))?JSON['parse'](this['getDataValue']('offlineForm')):{};},'set':function(_0x274277){return this[_0xa8f1('0x21')](_0xa8f1('0x23'),JSON[_0xa8f1('0x1b')](_0x274277));}},'token':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':function(){return rs[_0xa8f1('0x24')]();}},'autoclose':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa8f1('0x3')]},'forwardOffline':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa8f1('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x26')},'offlineMessageBody':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xa8f1('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa8f1('0x12')]},'showAgentAvatar':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa8f1('0x29');}},'notificationSound':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xa8f1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':_0xa8f1('0x2a')},'verticalAlignment':{'type':Sequelize[_0xa8f1('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xa8f1('0x3')]},'customerAvatar':{'type':Sequelize[_0xa8f1('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa8f1('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa8f1('0x3')],'allowNull':![],'defaultValue':_0xa8f1('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa8f1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa8f1('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xa8f1('0x12')]}}; \ No newline at end of file +var _0xdc86=['star','stringify','input','name','text','getDataValue','parse','onlineForm','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','randomstring','STRING','address','email','Agent','#9f946a','#ffffff','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xdc86,0x118));var _0x6dc8=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdc86[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6dc8('0x0'));module['exports']={'name':{'type':Sequelize[_0x6dc8('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6dc8('0x2')},'description':{'type':Sequelize[_0x6dc8('0x1')]},'mapKey':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x3')},'mapKeyOffline':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0x6dc8('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x4')},'customerAlias':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6dc8('0x1')],'allowNull':![],'defaultValue':_0x6dc8('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6dc8('0x1')],'allowNull':![],'defaultValue':_0x6dc8('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6dc8('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6dc8('0x1')]},'animation':{'type':Sequelize[_0x6dc8('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6dc8('0x8')](_0x6dc8('0x9'),'squared'),'defaultValue':_0x6dc8('0x9')},'header_online':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0xa')},'start_chat_button':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0xb')},'offline_chat_button':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6dc8('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0xd')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6dc8('0xe')]},'closingQuestion':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x11')},'noteTitle':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x13')},'closingMessageButton':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x14')},'skipMessageButton':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6dc8('0x7')],'defaultValue':![]},'ratingType':{'type':Sequelize['ENUM'](_0x6dc8('0x15'),'thumb'),'defaultValue':_0x6dc8('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x6dc8('0xc')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6dc8('0xe')],'defaultValue':function(){return JSON[_0x6dc8('0x16')]({'items':[{'type':_0x6dc8('0x17'),'variable':null,'config':{'placeholder':_0x6dc8('0x18'),'type':_0x6dc8('0x19'),'required':!![]},'props':{'title':_0x6dc8('0x18'),'helpText':''}},{'type':_0x6dc8('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x6dc8('0x3'),'type':_0x6dc8('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6dc8('0x1a')]('onlineForm')?JSON[_0x6dc8('0x1b')](this['getDataValue'](_0x6dc8('0x1c'))):{};},'set':function(_0x3309fa){return this[_0x6dc8('0x1d')]('onlineForm',JSON[_0x6dc8('0x16')](_0x3309fa));}},'offlineForm':{'type':Sequelize[_0x6dc8('0xe')],'defaultValue':function(){return JSON[_0x6dc8('0x16')]({'items':[{'type':'input','props':{'title':_0x6dc8('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x6dc8('0x3'),'type':_0x6dc8('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x6dc8('0x1e'),'helpText':_0x6dc8('0x1f')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x6dc8('0x20'))?JSON['parse'](this['getDataValue']('offlineForm')):{};},'set':function(_0x63da34){return this[_0x6dc8('0x1d')](_0x6dc8('0x20'),JSON[_0x6dc8('0x16')](_0x63da34));}},'token':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':function(){return rs[_0x6dc8('0x21')]();}},'autoclose':{'type':Sequelize[_0x6dc8('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6dc8('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6dc8('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6dc8('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6dc8('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x23')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x6dc8('0x24')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x25')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x6dc8('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x6dc8('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6dc8('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x6dc8('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6dc8('0x1')]},'notificationTemplate':{'type':Sequelize[_0x6dc8('0xe')],'defaultValue':function(){return _0x6dc8('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6dc8('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x6dc8('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6dc8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x6dc8('0xc')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x6dc8('0x28')},'defaultTitle':{'type':Sequelize[_0x6dc8('0x1')]},'customerAvatar':{'type':Sequelize[_0x6dc8('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x6dc8('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6dc8('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6dc8('0x1')],'allowNull':![],'defaultValue':_0x6dc8('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6dc8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6dc8('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6dc8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6dc8('0x1')],'defaultValue':_0x6dc8('0x2a')},'systemAvatar':{'type':Sequelize[_0x6dc8('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 71d5315..27624af 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 _0xc8a6=['pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','Contact','Owner','internal','color','tag','timezone','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','Intervals','getProactiveActions','custom','increment','push','some','utf8','remote','x-forwarded-for','connection','referer','virtual','replace','render','alignment','verticalAlignment','addApplications','sequelize','transaction','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','ChatWebsites','stack','name','send','index','ChatWebsite','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','filter','merge','map','options','findAll','rows','catch','params','includeAll','include','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','pick','removeAnswers','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','sitepic','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','CmContact','Contacts','applications','Applications','list','priority','asc','account','List','contact','lastName','customerIp','browser','version','format','%s\x20%s','unknown','device','vendor','type','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','messageId','close','unmanaged','*,*,*,*','User','UserId','unshift','agent','Start','startRouting','EventManager','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth'];(function(_0x573c9e,_0xd4ab71){var _0x5d0714=function(_0x127a2a){while(--_0x127a2a){_0x573c9e['push'](_0x573c9e['shift']());}};_0x5d0714(++_0xd4ab71);}(_0xc8a6,0x146));var _0x6c8a=function(_0x215d6d,_0x2919e5){_0x215d6d=_0x215d6d-0x0;var _0x3205d5=_0xc8a6[_0x215d6d];return _0x3205d5;};'use strict';var pdf=require(_0x6c8a('0x0'));var emlformat=require(_0x6c8a('0x1'));var rimraf=require(_0x6c8a('0x2'));var zipdir=require(_0x6c8a('0x3'));var jsonpatch=require(_0x6c8a('0x4'));var rp=require(_0x6c8a('0x5'));var moment=require(_0x6c8a('0x6'));var BPromise=require(_0x6c8a('0x7'));var Mustache=require(_0x6c8a('0x8'));var util=require(_0x6c8a('0x9'));var path=require('path');var sox=require(_0x6c8a('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6c8a('0xb'));var squel=require(_0x6c8a('0xc'));var crypto=require(_0x6c8a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6c8a('0xe'));var Papa=require(_0x6c8a('0xf'));var Redis=require(_0x6c8a('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x6c8a('0x11'))(_0x6c8a('0x12'));var utils=require(_0x6c8a('0x13'));var config=require(_0x6c8a('0x14'));var db=require(_0x6c8a('0x15'))['db'];config[_0x6c8a('0x16')]=_[_0x6c8a('0x17')](config[_0x6c8a('0x16')],{'host':_0x6c8a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6c8a('0x19'))['register'](socket);var jayson=require(_0x6c8a('0x1a'));var client=jayson[_0x6c8a('0x1b')][_0x6c8a('0x1c')]({'port':0x232c});var client9002=jayson[_0x6c8a('0x1b')][_0x6c8a('0x1c')]({'port':0x232a});var client9003=jayson[_0x6c8a('0x1b')][_0x6c8a('0x1c')]({'port':0x232b});function respondWithRpcPromise(_0x308e8d,_0x3ef5b8,_0x89bab3,_0x2209cd){return new BPromise(function(_0xa472c7,_0x332bb4){var _0x5d327=_0x2209cd||client;return _0x5d327[_0x6c8a('0x1d')](_0x308e8d,_0x89bab3)[_0x6c8a('0x1e')](function(_0x32d29e){logger[_0x6c8a('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x3ef5b8,_0x6c8a('0x20'));logger[_0x6c8a('0x21')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3ef5b8,_0x6c8a('0x20'),JSON[_0x6c8a('0x22')](_0x32d29e));if(_0x32d29e['error']){if(_0x32d29e[_0x6c8a('0x23')][_0x6c8a('0x24')]===0x1f4){logger['error'](_0x6c8a('0x25'),_0x3ef5b8,_0x32d29e['error'][_0x6c8a('0x26')]);return _0x332bb4(_0x32d29e[_0x6c8a('0x23')]['message']);}logger['error'](_0x6c8a('0x25'),_0x3ef5b8,_0x32d29e['error'][_0x6c8a('0x26')]);return _0xa472c7(_0x32d29e[_0x6c8a('0x23')][_0x6c8a('0x26')]);}else{logger['info'](_0x6c8a('0x25'),_0x3ef5b8,'request\x20sent');_0xa472c7(_0x32d29e[_0x6c8a('0x27')][_0x6c8a('0x26')]);}})['catch'](function(_0x4e12c5){logger[_0x6c8a('0x23')](_0x6c8a('0x25'),_0x3ef5b8,_0x4e12c5);_0x332bb4(_0x4e12c5);});});}function respondWithStatusCode(_0x2d17f4,_0x1f5ac2){_0x1f5ac2=_0x1f5ac2||0xcc;return function(_0xa5c2c4){if(_0xa5c2c4){return _0x2d17f4[_0x6c8a('0x28')](_0x1f5ac2);}return _0x2d17f4[_0x6c8a('0x29')](_0x1f5ac2)[_0x6c8a('0x2a')]();};}function respondWithResult(_0x1436e7,_0x1d36f7){_0x1d36f7=_0x1d36f7||0xc8;return function(_0xecc478){if(_0xecc478){return _0x1436e7[_0x6c8a('0x29')](_0x1d36f7)[_0x6c8a('0x2b')](_0xecc478);}};}function respondWithFilteredResult(_0x532d08,_0x13b06b){return function(_0x5e5157){if(_0x5e5157){var _0x4f6447=_0x5e5157[_0x6c8a('0x2c')],_0x1b7d0b=_0x13b06b[_0x6c8a('0x2d')],_0x2a2682=_0x13b06b[_0x6c8a('0x2d')]+_0x13b06b[_0x6c8a('0x2e')],_0x1cd776;if(_0x2a2682>=_0x4f6447){_0x2a2682=_0x4f6447;_0x1cd776=0xc8;}else{_0x1cd776=0xce;}_0x532d08['status'](_0x1cd776);return _0x532d08[_0x6c8a('0x2f')](_0x6c8a('0x30'),_0x1b7d0b+'-'+_0x2a2682+'/'+_0x4f6447)[_0x6c8a('0x2b')](_0x5e5157);}return null;};}function patchUpdates(_0xc65d2a){return function(_0x2b2b7f){try{jsonpatch['apply'](_0x2b2b7f,_0xc65d2a,!![]);}catch(_0x120cf7){return BPromise[_0x6c8a('0x31')](_0x120cf7);}return _0x2b2b7f[_0x6c8a('0x32')]();};}function saveUpdates(_0x479388,_0x2db603){return function(_0x41caa3){if(_0x41caa3){return _0x41caa3[_0x6c8a('0x33')](_0x479388)[_0x6c8a('0x1e')](function(_0x5d2355){return _0x5d2355;});}return null;};}function removeEntity(_0x559612,_0x2b58c7){return function(_0x1062bd){if(_0x1062bd){return _0x1062bd[_0x6c8a('0x34')]()[_0x6c8a('0x1e')](function(){var _0x2abad5=_0x1062bd['get']({'plain':!![]});var _0x478ccb=_0x6c8a('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x478ccb,'resourceId':_0x2abad5['id']}})[_0x6c8a('0x1e')](function(){return _0x1062bd;});})[_0x6c8a('0x1e')](function(){_0x559612[_0x6c8a('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfaaef7,_0x52aa59){return function(_0x3f92e5){if(!_0x3f92e5){_0xfaaef7['sendStatus'](0x194);}return _0x3f92e5;};}function handleError(_0x2736f5,_0x14936d){_0x14936d=_0x14936d||0x1f4;return function(_0x3de012){logger['error'](_0x3de012[_0x6c8a('0x36')]);if(_0x3de012[_0x6c8a('0x37')]){delete _0x3de012[_0x6c8a('0x37')];}_0x2736f5[_0x6c8a('0x29')](_0x14936d)[_0x6c8a('0x38')](_0x3de012);};}exports[_0x6c8a('0x39')]=function(_0x34eaaf,_0x5ea799){var _0x520712={},_0x52bda0={},_0x169d50={'count':0x0,'rows':[]};var _0xc67fe8=db[_0x6c8a('0x3a')][_0x6c8a('0x3b')];_0x52bda0['model']=_[_0x6c8a('0x3c')](_0xc67fe8);var _0x3e34e7={'dateStart':_0x34eaaf[_0x6c8a('0x3d')][_0x6c8a('0x3e')],'dateEnd':_0x34eaaf[_0x6c8a('0x3d')][_0x6c8a('0x3f')]};delete _0x34eaaf['query'][_0x6c8a('0x3e')];delete _0x34eaaf[_0x6c8a('0x3d')][_0x6c8a('0x3f')];_0x52bda0['query']=_[_0x6c8a('0x3c')](_0x34eaaf[_0x6c8a('0x3d')]);_0x52bda0[_0x6c8a('0x40')]=_[_0x6c8a('0x41')](_0x52bda0[_0x6c8a('0x42')],_0x52bda0[_0x6c8a('0x3d')]);_0x520712[_0x6c8a('0x43')]=_['intersection'](_0x52bda0[_0x6c8a('0x42')],qs[_0x6c8a('0x44')](_0x34eaaf['query'][_0x6c8a('0x44')]));_0x520712[_0x6c8a('0x43')]=_0x520712[_0x6c8a('0x43')][_0x6c8a('0x45')]?_0x520712['attributes']:_0x52bda0[_0x6c8a('0x42')];if(!_0x34eaaf[_0x6c8a('0x3d')][_0x6c8a('0x46')](_0x6c8a('0x47'))){_0x520712['limit']=qs[_0x6c8a('0x2e')](_0x34eaaf['query'][_0x6c8a('0x2e')]);_0x520712['offset']=qs[_0x6c8a('0x2d')](_0x34eaaf[_0x6c8a('0x3d')][_0x6c8a('0x2d')]);}_0x520712[_0x6c8a('0x48')]=qs[_0x6c8a('0x49')](_0x34eaaf[_0x6c8a('0x3d')]['sort']);_0x520712[_0x6c8a('0x4a')]=qs[_0x6c8a('0x40')](_['pick'](_0x34eaaf[_0x6c8a('0x3d')],_0x52bda0[_0x6c8a('0x40')]));if(_0x3e34e7[_0x6c8a('0x3e')]){if(_0x3e34e7[_0x6c8a('0x3f')]){_0x3e34e7['dateEnd']=moment(_0x3e34e7[_0x6c8a('0x3f')])[_0x6c8a('0x4b')](0x1,_0x6c8a('0x4c'));}else{_0x3e34e7[_0x6c8a('0x3f')]=moment(_0x3e34e7[_0x6c8a('0x3e')])[_0x6c8a('0x4b')](0x1,_0x6c8a('0x4c'));}_['merge'](_0x520712[_0x6c8a('0x4a')],{'createdAt':{'$gte':_0x3e34e7[_0x6c8a('0x3e')],'$lte':_0x3e34e7[_0x6c8a('0x3f')]}});}if(_0x34eaaf[_0x6c8a('0x3d')][_0x6c8a('0x4d')]){_0x520712[_0x6c8a('0x4a')]=_[_0x6c8a('0x4e')](_0x520712['where'],{'$or':_[_0x6c8a('0x4f')](_0x520712['attributes'],function(_0xd460eb){var _0x17afef={};_0x17afef[_0xd460eb]={'$like':'%'+_0x34eaaf[_0x6c8a('0x3d')][_0x6c8a('0x4d')]+'%'};return _0x17afef;})});}_0x520712=_[_0x6c8a('0x4e')]({},_0x520712,_0x34eaaf[_0x6c8a('0x50')]);var _0x32d77a={'where':_0x520712['where']};return db[_0x6c8a('0x3a')][_0x6c8a('0x2c')](_0x32d77a)[_0x6c8a('0x1e')](function(_0x29a72e){_0x169d50[_0x6c8a('0x2c')]=_0x29a72e;if(_0x34eaaf[_0x6c8a('0x3d')]['includeAll']){_0x520712['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x6c8a('0x51')](_0x520712);})['then'](function(_0x191e75){_0x169d50[_0x6c8a('0x52')]=_0x191e75;return _0x169d50;})[_0x6c8a('0x1e')](respondWithFilteredResult(_0x5ea799,_0x520712))[_0x6c8a('0x53')](handleError(_0x5ea799,null));};exports['show']=function(_0x43f7a1,_0x46f434){var _0xd60f81={'raw':![],'where':{'id':_0x43f7a1[_0x6c8a('0x54')]['id']}},_0x47d582={};_0x47d582[_0x6c8a('0x42')]=_[_0x6c8a('0x3c')](db[_0x6c8a('0x3a')][_0x6c8a('0x3b')]);_0x47d582[_0x6c8a('0x3d')]=_[_0x6c8a('0x3c')](_0x43f7a1['query']);_0x47d582[_0x6c8a('0x40')]=_[_0x6c8a('0x41')](_0x47d582[_0x6c8a('0x42')],_0x47d582[_0x6c8a('0x3d')]);_0xd60f81[_0x6c8a('0x43')]=_['intersection'](_0x47d582['model'],qs[_0x6c8a('0x44')](_0x43f7a1[_0x6c8a('0x3d')][_0x6c8a('0x44')]));_0xd60f81['attributes']=_0xd60f81[_0x6c8a('0x43')][_0x6c8a('0x45')]?_0xd60f81[_0x6c8a('0x43')]:_0x47d582[_0x6c8a('0x42')];if(_0x43f7a1[_0x6c8a('0x3d')][_0x6c8a('0x55')]){_0xd60f81[_0x6c8a('0x56')]=[{'all':!![]}];}_0xd60f81=_['merge']({},_0xd60f81,_0x43f7a1['options']);return db[_0x6c8a('0x3a')][_0x6c8a('0x57')](_0xd60f81)[_0x6c8a('0x1e')](handleEntityNotFound(_0x46f434,null))['then'](respondWithResult(_0x46f434,null))[_0x6c8a('0x53')](handleError(_0x46f434,null));};exports[_0x6c8a('0x58')]=function(_0x2e5dfb,_0x3ca9ae){return db[_0x6c8a('0x3a')][_0x6c8a('0x58')](_0x2e5dfb[_0x6c8a('0x59')],{})[_0x6c8a('0x1e')](function(_0x5cd03d){var _0x3b3452=_0x2e5dfb['user'][_0x6c8a('0x5a')]({'plain':!![]});if(!_0x3b3452)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b3452[_0x6c8a('0x5b')]===_0x6c8a('0x5c')){var _0x3f647f=_0x5cd03d[_0x6c8a('0x5a')]({'plain':!![]});var _0x291c32=_0x6c8a('0x35');return db[_0x6c8a('0x5d')][_0x6c8a('0x57')]({'where':{'name':_0x291c32,'userProfileId':_0x3b3452[_0x6c8a('0x5e')]},'raw':!![]})[_0x6c8a('0x1e')](function(_0x4db342){if(_0x4db342&&_0x4db342[_0x6c8a('0x5f')]===0x0){return db['UserProfileResource'][_0x6c8a('0x58')]({'name':_0x3f647f[_0x6c8a('0x37')],'resourceId':_0x3f647f['id'],'type':_0x4db342['name'],'sectionId':_0x4db342['id']},{})[_0x6c8a('0x1e')](function(){return _0x5cd03d;});}else{return _0x5cd03d;}})[_0x6c8a('0x53')](function(_0x591964){logger[_0x6c8a('0x23')](_0x6c8a('0x60'),_0x591964);throw _0x591964;});}return _0x5cd03d;})['then'](respondWithResult(_0x3ca9ae,0xc9))['catch'](handleError(_0x3ca9ae,null));};exports[_0x6c8a('0x33')]=function(_0x5ca442,_0x24df5c){if(_0x5ca442[_0x6c8a('0x59')]['id']){delete _0x5ca442[_0x6c8a('0x59')]['id'];}return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x5ca442[_0x6c8a('0x54')]['id']}})['then'](handleEntityNotFound(_0x24df5c,null))['then'](saveUpdates(_0x5ca442[_0x6c8a('0x59')],null))[_0x6c8a('0x1e')](respondWithResult(_0x24df5c,null))[_0x6c8a('0x53')](handleError(_0x24df5c,null));};exports[_0x6c8a('0x34')]=function(_0x195042,_0x53ba23){return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x195042['params']['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x53ba23,null))[_0x6c8a('0x1e')](removeEntity(_0x53ba23,null))['catch'](handleError(_0x53ba23,null));};exports[_0x6c8a('0x61')]=function(_0x5f2261,_0x22176e){return db[_0x6c8a('0x3a')][_0x6c8a('0x61')]()[_0x6c8a('0x1e')](respondWithResult(_0x22176e,null))['catch'](handleError(_0x22176e,null));};exports['addDisposition']=function(_0xfe4bea,_0x161f6f,_0x1f27c5){if(_0xfe4bea[_0x6c8a('0x59')]['id']){delete _0xfe4bea['body']['id'];}return db[_0x6c8a('0x3a')]['find']({'where':{'id':_0xfe4bea[_0x6c8a('0x54')]['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x161f6f,null))[_0x6c8a('0x1e')](function(_0x46adbe){if(_0x46adbe){_0xfe4bea[_0x6c8a('0x59')][_0x6c8a('0x62')]=_0x46adbe['id'];return db[_0x6c8a('0x63')]['create'](_0xfe4bea['body']);}})[_0x6c8a('0x1e')](respondWithResult(_0x161f6f,null))[_0x6c8a('0x53')](handleError(_0x161f6f,null));};exports[_0x6c8a('0x64')]=function(_0x37a768,_0x486941,_0x3afaf6){var _0x4e4637={'raw':![],'where':{}};var _0x210a41={};var _0x4dd976={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x6c8a('0x65')]({'where':{'id':_0x37a768[_0x6c8a('0x54')]['id']}})['then'](handleEntityNotFound(_0x486941,null))[_0x6c8a('0x1e')](function(_0x6a1f45){if(_0x6a1f45){_0x210a41['model']=_[_0x6c8a('0x3c')](db[_0x6c8a('0x63')][_0x6c8a('0x3b')]);_0x210a41['query']=_[_0x6c8a('0x3c')](_0x37a768[_0x6c8a('0x3d')]);_0x210a41[_0x6c8a('0x40')]=_[_0x6c8a('0x41')](_0x210a41['model'],_0x210a41[_0x6c8a('0x3d')]);_0x4e4637[_0x6c8a('0x43')]=_[_0x6c8a('0x41')](_0x210a41[_0x6c8a('0x42')],qs[_0x6c8a('0x44')](_0x37a768[_0x6c8a('0x3d')]['fields']));_0x4e4637[_0x6c8a('0x43')]=_0x4e4637[_0x6c8a('0x43')][_0x6c8a('0x45')]?_0x4e4637[_0x6c8a('0x43')]:_0x210a41[_0x6c8a('0x42')];if(!_0x37a768[_0x6c8a('0x3d')]['hasOwnProperty'](_0x6c8a('0x47'))){_0x4e4637['limit']=qs['limit'](_0x37a768[_0x6c8a('0x3d')][_0x6c8a('0x2e')]);_0x4e4637[_0x6c8a('0x2d')]=qs[_0x6c8a('0x2d')](_0x37a768[_0x6c8a('0x3d')]['offset']);}_0x4e4637[_0x6c8a('0x48')]=qs[_0x6c8a('0x49')](_0x37a768[_0x6c8a('0x3d')][_0x6c8a('0x49')]);_0x4e4637[_0x6c8a('0x4a')]=qs[_0x6c8a('0x40')](_['pick'](_0x37a768[_0x6c8a('0x3d')],_0x210a41[_0x6c8a('0x40')]));_0x4e4637[_0x6c8a('0x4a')][_0x6c8a('0x62')]=_0x6a1f45['id'];if(_0x37a768[_0x6c8a('0x3d')][_0x6c8a('0x4d')]){_0x4e4637[_0x6c8a('0x4a')]=_[_0x6c8a('0x4e')](_0x4e4637[_0x6c8a('0x4a')],{'$or':_[_0x6c8a('0x4f')](_0x4e4637[_0x6c8a('0x43')],function(_0x209ae9){var _0x48fc91={};_0x48fc91[_0x209ae9]={'$like':'%'+_0x37a768[_0x6c8a('0x3d')][_0x6c8a('0x4d')]+'%'};return _0x48fc91;})});}_0x4e4637=_[_0x6c8a('0x4e')]({},_0x4e4637,_0x37a768['options']);return db[_0x6c8a('0x63')][_0x6c8a('0x2c')]({'where':_0x4e4637[_0x6c8a('0x4a')]})[_0x6c8a('0x1e')](function(_0x482d92){_0x4dd976[_0x6c8a('0x2c')]=_0x482d92;if(_0x37a768[_0x6c8a('0x3d')][_0x6c8a('0x55')]){_0x4e4637[_0x6c8a('0x56')]=[{'all':!![]}];}return db[_0x6c8a('0x63')][_0x6c8a('0x51')](_0x4e4637);})[_0x6c8a('0x1e')](function(_0xacf8c0){_0x4dd976[_0x6c8a('0x52')]=_0xacf8c0;return _0x4dd976;});}})[_0x6c8a('0x1e')](respondWithFilteredResult(_0x486941,_0x4e4637))[_0x6c8a('0x53')](handleError(_0x486941,null));};exports[_0x6c8a('0x66')]=function(_0x37f5e5,_0x484060,_0x19a634){var _0x2d1e80;return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x37f5e5['params']['id']}})['then'](handleEntityNotFound(_0x484060,null))[_0x6c8a('0x1e')](function(_0x4b3f6e){if(_0x4b3f6e){return _0x4b3f6e[_0x6c8a('0x66')](_0x37f5e5[_0x6c8a('0x3d')][_0x6c8a('0x67')]);}})[_0x6c8a('0x1e')](respondWithStatusCode(_0x484060,null))[_0x6c8a('0x53')](handleError(_0x484060,null));};exports[_0x6c8a('0x68')]=function(_0x3a1ac9,_0x6ef873,_0x208552){if(_0x3a1ac9[_0x6c8a('0x59')]['id']){delete _0x3a1ac9[_0x6c8a('0x59')]['id'];}return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x3a1ac9[_0x6c8a('0x54')]['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x6ef873,null))[_0x6c8a('0x1e')](function(_0x24645b){if(_0x24645b){_0x3a1ac9['body'][_0x6c8a('0x62')]=_0x24645b['id'];return db['CannedAnswer'][_0x6c8a('0x58')](_0x3a1ac9['body']);}})['then'](respondWithResult(_0x6ef873,null))['catch'](handleError(_0x6ef873,null));};exports[_0x6c8a('0x69')]=function(_0x84a73d,_0x36f7e2,_0x317082){var _0x2562c0={'raw':![],'where':{}};var _0x1068d5={};var _0x24f191={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x6c8a('0x65')]({'where':{'id':_0x84a73d[_0x6c8a('0x54')]['id']}})['then'](handleEntityNotFound(_0x36f7e2,null))[_0x6c8a('0x1e')](function(_0x252923){if(_0x252923){_0x1068d5[_0x6c8a('0x42')]=_[_0x6c8a('0x3c')](db[_0x6c8a('0x6a')][_0x6c8a('0x3b')]);_0x1068d5[_0x6c8a('0x3d')]=_[_0x6c8a('0x3c')](_0x84a73d['query']);_0x1068d5['filters']=_[_0x6c8a('0x41')](_0x1068d5['model'],_0x1068d5['query']);_0x2562c0['attributes']=_[_0x6c8a('0x41')](_0x1068d5[_0x6c8a('0x42')],qs['fields'](_0x84a73d[_0x6c8a('0x3d')][_0x6c8a('0x44')]));_0x2562c0[_0x6c8a('0x43')]=_0x2562c0[_0x6c8a('0x43')][_0x6c8a('0x45')]?_0x2562c0[_0x6c8a('0x43')]:_0x1068d5['model'];if(!_0x84a73d[_0x6c8a('0x3d')][_0x6c8a('0x46')](_0x6c8a('0x47'))){_0x2562c0[_0x6c8a('0x2e')]=qs[_0x6c8a('0x2e')](_0x84a73d[_0x6c8a('0x3d')][_0x6c8a('0x2e')]);_0x2562c0['offset']=qs[_0x6c8a('0x2d')](_0x84a73d[_0x6c8a('0x3d')][_0x6c8a('0x2d')]);}_0x2562c0[_0x6c8a('0x48')]=qs['sort'](_0x84a73d['query'][_0x6c8a('0x49')]);_0x2562c0[_0x6c8a('0x4a')]=qs['filters'](_[_0x6c8a('0x6b')](_0x84a73d[_0x6c8a('0x3d')],_0x1068d5[_0x6c8a('0x40')]));_0x2562c0[_0x6c8a('0x4a')]['ChatWebsiteId']=_0x252923['id'];if(_0x84a73d['query']['filter']){_0x2562c0[_0x6c8a('0x4a')]=_['merge'](_0x2562c0[_0x6c8a('0x4a')],{'$or':_[_0x6c8a('0x4f')](_0x2562c0[_0x6c8a('0x43')],function(_0x54a7c9){var _0x3144c4={};_0x3144c4[_0x54a7c9]={'$like':'%'+_0x84a73d[_0x6c8a('0x3d')]['filter']+'%'};return _0x3144c4;})});}_0x2562c0=_[_0x6c8a('0x4e')]({},_0x2562c0,_0x84a73d['options']);return db[_0x6c8a('0x6a')][_0x6c8a('0x2c')]({'where':_0x2562c0[_0x6c8a('0x4a')]})['then'](function(_0x36de2a){_0x24f191[_0x6c8a('0x2c')]=_0x36de2a;if(_0x84a73d[_0x6c8a('0x3d')]['includeAll']){_0x2562c0[_0x6c8a('0x56')]=[{'all':!![]}];}return db[_0x6c8a('0x6a')]['findAll'](_0x2562c0);})['then'](function(_0x3350cf){_0x24f191['rows']=_0x3350cf;return _0x24f191;});}})[_0x6c8a('0x1e')](respondWithFilteredResult(_0x36f7e2,_0x2562c0))[_0x6c8a('0x53')](handleError(_0x36f7e2,null));};exports[_0x6c8a('0x6c')]=function(_0x10ad62,_0x1f5f22,_0xf98f85){var _0x986b89;return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x10ad62[_0x6c8a('0x54')]['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x1f5f22,null))['then'](function(_0x498271){if(_0x498271){return _0x498271['removeAnswers'](_0x10ad62['query'][_0x6c8a('0x67')]);}})[_0x6c8a('0x1e')](respondWithStatusCode(_0x1f5f22,null))['catch'](handleError(_0x1f5f22,null));};exports['addLogo']=function(_0x285dd0,_0x51d4a6,_0x4a0b71){_0x285dd0[_0x6c8a('0x59')]['sitepic']=_0x285dd0[_0x6c8a('0x6d')][_0x6c8a('0x6e')];return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x285dd0['params']['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x51d4a6,null))[_0x6c8a('0x1e')](saveUpdates(_0x285dd0[_0x6c8a('0x59')],null))[_0x6c8a('0x1e')](respondWithResult(_0x51d4a6,null))[_0x6c8a('0x53')](handleError(_0x51d4a6,null));};exports[_0x6c8a('0x6f')]=function(_0x385e94,_0x58451e,_0x1f1c3c){_0x385e94[_0x6c8a('0x59')]['agentAvatar']=_0x385e94[_0x6c8a('0x6d')][_0x6c8a('0x6e')];return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x385e94['params']['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x58451e,null))[_0x6c8a('0x1e')](saveUpdates(_0x385e94['body'],null))[_0x6c8a('0x1e')](respondWithResult(_0x58451e,null))[_0x6c8a('0x53')](handleError(_0x58451e,null));};exports[_0x6c8a('0x70')]=function(_0xc62376,_0x119065,_0xb69442){_0xc62376[_0x6c8a('0x59')][_0x6c8a('0x71')]=_0xc62376[_0x6c8a('0x6d')][_0x6c8a('0x6e')];return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0xc62376[_0x6c8a('0x54')]['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x119065,null))[_0x6c8a('0x1e')](saveUpdates(_0xc62376[_0x6c8a('0x59')],null))['then'](respondWithResult(_0x119065,null))[_0x6c8a('0x53')](handleError(_0x119065,null));};exports[_0x6c8a('0x72')]=function(_0x793df9,_0x43301c,_0x1dc246){_0x793df9[_0x6c8a('0x59')][_0x6c8a('0x73')]=_0x793df9['file'][_0x6c8a('0x6e')];return db[_0x6c8a('0x3a')]['find']({'where':{'id':_0x793df9[_0x6c8a('0x54')]['id']}})['then'](handleEntityNotFound(_0x43301c,null))[_0x6c8a('0x1e')](saveUpdates(_0x793df9[_0x6c8a('0x59')],null))[_0x6c8a('0x1e')](respondWithResult(_0x43301c,null))[_0x6c8a('0x53')](handleError(_0x43301c,null));};exports[_0x6c8a('0x74')]=function(_0x30e2e4,_0x5401f0,_0x15077f){var _0x2ecafd=path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],_0x6c8a('0x77'));var _0x2ef080={'where':{'id':_0x30e2e4[_0x6c8a('0x54')]['id']},'attributes':['id',_0x6c8a('0x78')],'raw':!![]};var _0x40ddd7=![];return require(_0x6c8a('0x79'))[_0x6c8a('0x7a')]()[_0x6c8a('0x1e')](function(_0x21dd36){if(_0x21dd36){_0x40ddd7=_0x21dd36['custom'];}})[_0x6c8a('0x1e')](function(){return db[_0x6c8a('0x3a')][_0x6c8a('0x57')](_0x2ef080);})['then'](handleEntityNotFound(_0x5401f0,null))[_0x6c8a('0x1e')](function(_0x40e62a){if(_0x40e62a){if(!_[_0x6c8a('0x7b')](_0x40e62a[_0x6c8a('0x78')])){if(fs[_0x6c8a('0x7c')](path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],_0x6c8a('0x7d'),_0x40e62a['sitepic']))&&_0x40ddd7){_0x2ecafd=path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],_0x6c8a('0x7d'),_0x40e62a[_0x6c8a('0x78')]);}}return _0x5401f0['download'](_0x2ecafd);}})[_0x6c8a('0x53')](handleError(_0x5401f0,null));};exports['getAvatar']=function(_0x1ea50a,_0x23e354,_0x52266e){var _0x522a2e=path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],_0x6c8a('0x7e'));var _0x3779ef={'where':{'id':_0x1ea50a[_0x6c8a('0x54')]['id']},'attributes':['id',_0x6c8a('0x7f')],'raw':!![]};return db['ChatWebsite'][_0x6c8a('0x57')](_0x3779ef)[_0x6c8a('0x1e')](handleEntityNotFound(_0x23e354,null))[_0x6c8a('0x1e')](function(_0x118c5f){if(_0x118c5f){if(!_[_0x6c8a('0x7b')](_0x118c5f['agentAvatar'])){if(fs[_0x6c8a('0x7c')](path[_0x6c8a('0x75')](config['root'],_0x6c8a('0x80'),_0x118c5f[_0x6c8a('0x7f')]))){_0x522a2e=path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],_0x6c8a('0x80'),_0x118c5f[_0x6c8a('0x7f')]);}}return _0x23e354['download'](_0x522a2e);}})['catch'](handleError(_0x23e354,null));};exports['getCustomerAvatar']=function(_0x50a425,_0x553700,_0x30cebd){var _0x3e6dd4=path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],_0x6c8a('0x81'));var _0xa5abc5={'where':{'id':_0x50a425[_0x6c8a('0x54')]['id']},'attributes':['id',_0x6c8a('0x71'),_0x6c8a('0x82')],'raw':!![]};return db[_0x6c8a('0x3a')][_0x6c8a('0x57')](_0xa5abc5)[_0x6c8a('0x1e')](handleEntityNotFound(_0x553700,null))[_0x6c8a('0x1e')](function(_0x2cd90e){if(_0x2cd90e){if(!_[_0x6c8a('0x7b')](_0x2cd90e[_0x6c8a('0x71')])){if(fs[_0x6c8a('0x7c')](path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],_0x6c8a('0x80'),_0x2cd90e[_0x6c8a('0x71')]))&&_0x2cd90e[_0x6c8a('0x82')]){_0x3e6dd4=path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],'server/files/images/avatars/',_0x2cd90e[_0x6c8a('0x71')]);}}return _0x553700[_0x6c8a('0x83')](_0x3e6dd4);}})['catch'](handleError(_0x553700,null));};exports[_0x6c8a('0x84')]=function(_0x41cfd7,_0x3020dc,_0x13ec9c){var _0x53d4ae=path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],_0x6c8a('0x85'));var _0x346f05={'where':{'id':_0x41cfd7[_0x6c8a('0x54')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x6c8a('0x3a')]['find'](_0x346f05)[_0x6c8a('0x1e')](handleEntityNotFound(_0x3020dc,null))['then'](function(_0x2dada5){if(_0x2dada5){if(!_[_0x6c8a('0x7b')](_0x2dada5['systemAvatar'])){if(fs[_0x6c8a('0x7c')](path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],_0x6c8a('0x80'),_0x2dada5[_0x6c8a('0x73')]))){_0x53d4ae=path[_0x6c8a('0x75')](config['root'],_0x6c8a('0x80'),_0x2dada5[_0x6c8a('0x73')]);}}return _0x3020dc[_0x6c8a('0x83')](_0x53d4ae);}})[_0x6c8a('0x53')](handleError(_0x3020dc,null));};exports[_0x6c8a('0x86')]=function(_0x233631,_0x246bc5,_0x4aadfe){var _0x2e8cde=require(_0x6c8a('0x87'));var _0x11b5c9=new _0x2e8cde();var _0x3a016f=_0x11b5c9[_0x6c8a('0x88')](_0x233631[_0x6c8a('0x89')][_0x6c8a('0x8a')])[_0x6c8a('0x8b')]();var _0x3d7629={'body':_0x233631[_0x6c8a('0x59')],'channel':_0x6c8a('0x8c')};var _0xf8c478=[];var _0x467189=[];var _0x1b8dcb={};var _0x27d3fe=![];return db['CmContact']['describe']()[_0x6c8a('0x1e')](function(_0x5d53ca){if(!_0x5d53ca){throw new db[(_0x6c8a('0x8d'))][(_0x6c8a('0x8e'))](_0x6c8a('0x8f'));}_0xf8c478=_[_0x6c8a('0x90')](_[_0x6c8a('0x3c')](_0x5d53ca),[_0x6c8a('0x91'),_0x6c8a('0x92')]);_0x467189=_['difference'](_[_0x6c8a('0x3c')](_0x5d53ca),[_0x6c8a('0x91'),_0x6c8a('0x92'),'CompanyId',_0x6c8a('0x93')]);if(_0x233631[_0x6c8a('0x59')]['id']){delete _0x233631[_0x6c8a('0x59')]['id'];}if(_['isNil'](_0x233631[_0x6c8a('0x59')]['from'])){throw new db[(_0x6c8a('0x8d'))]['ValidationError'](_0x6c8a('0x94'));}if(_[_0x6c8a('0x7b')](_0x233631['body'][_0x6c8a('0x59')])||_0x233631['body'][_0x6c8a('0x59')]===''){throw new db[(_0x6c8a('0x8d'))][(_0x6c8a('0x8e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x233631[_0x6c8a('0x59')][_0x6c8a('0x95')])){throw new db[(_0x6c8a('0x8d'))][(_0x6c8a('0x8e'))](_0x6c8a('0x96')+_0x467189);}if(!_[_0x6c8a('0x97')](_0x467189,_0x233631[_0x6c8a('0x59')][_0x6c8a('0x95')])){throw new db[(_0x6c8a('0x8d'))]['ValidationError'](_0x6c8a('0x98')+_0x467189);}_0x1b8dcb[_0x233631[_0x6c8a('0x59')]['mapKey']]=_0x233631[_0x6c8a('0x59')][_0x6c8a('0x99')];})[_0x6c8a('0x1e')](function(){return db[_0x6c8a('0x3a')]['find']({'where':{'id':_0x233631[_0x6c8a('0x54')]['id']},'include':[{'model':db[_0x6c8a('0x9a')],'as':'List','include':[{'model':db[_0x6c8a('0x9b')],'as':_0x6c8a('0x9c'),'where':_0x1b8dcb,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x246bc5,null))[_0x6c8a('0x1e')](function(_0x3e0465){if(_0x3e0465&&_0x3e0465['List']){_0x3d7629['account']=_0x3e0465;_0x3d7629[_0x6c8a('0x9d')]=_0x3e0465[_0x6c8a('0x9e')];_0x3d7629[_0x6c8a('0x9f')]=_0x3e0465['List'];_0x3d7629[_0x6c8a('0x9d')]=_['orderBy'](_0x3d7629[_0x6c8a('0x9d')],[_0x6c8a('0xa0')],[_0x6c8a('0xa1')]);if(_0x3d7629['account'][_0x6c8a('0x9e')]){delete _0x3d7629[_0x6c8a('0xa2')]['Applications'];}if(_0x3d7629[_0x6c8a('0xa2')][_0x6c8a('0xa3')]&&_0x3d7629['account']['List'][_0x6c8a('0x9c')]['length']){return _0x3d7629[_0x6c8a('0xa2')][_0x6c8a('0xa3')][_0x6c8a('0x9c')][0x0];}var _0x222fc6=_[_0x6c8a('0x17')](_0x233631[_0x6c8a('0x59')],{'firstName':_0x233631[_0x6c8a('0x59')][_0x6c8a('0x99')],'ListId':_0x3e0465[_0x6c8a('0x93')]});_0x222fc6[_0x233631[_0x6c8a('0x59')][_0x6c8a('0x95')]]=_0x233631[_0x6c8a('0x59')][_0x6c8a('0x99')];return db[_0x6c8a('0x9b')][_0x6c8a('0x58')](_0x222fc6,{'fields':_0xf8c478,'raw':!![]});}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x246bc5,null))[_0x6c8a('0x1e')](function(_0x4cc181){_0x3d7629[_0x6c8a('0xa4')]=_0x4cc181;if(_0x4cc181){var _0x5b395d={'ContactId':_0x4cc181['id'],'ChatWebsiteId':_0x233631['params']['id'],'from':(_0x4cc181['firstName']||'')+'\x20'+(_0x4cc181[_0x6c8a('0xa5')]||''),'customerIp':_0x233631[_0x6c8a('0x59')][_0x6c8a('0xa6')],'referer':_0x233631[_0x6c8a('0x59')]['referer'],'browserName':_0x3a016f[_0x6c8a('0xa7')][_0x6c8a('0x37')]&&_0x3a016f['browser'][_0x6c8a('0xa8')]?util[_0x6c8a('0xa9')](_0x6c8a('0xaa'),_0x3a016f['browser'][_0x6c8a('0x37')],_0x3a016f[_0x6c8a('0xa7')][_0x6c8a('0xa8')]):_0x6c8a('0xab'),'browserVersion':_0x3a016f[_0x6c8a('0xa7')][_0x6c8a('0xa8')]||_0x6c8a('0xab'),'osName':util[_0x6c8a('0xa9')](_0x6c8a('0xaa'),_0x3a016f['os'][_0x6c8a('0x37')],_0x3a016f['os'][_0x6c8a('0xa8')]),'osVersion':_0x3a016f['os'][_0x6c8a('0xa8')],'deviceModel':_0x3a016f['device']['model']&&_0x3a016f[_0x6c8a('0xac')][_0x6c8a('0xad')]?util[_0x6c8a('0xa9')]('%s\x20%s\x20%s',_0x3a016f[_0x6c8a('0xac')][_0x6c8a('0x42')],_0x3a016f[_0x6c8a('0xac')]['vendor'],_0x3a016f[_0x6c8a('0xac')][_0x6c8a('0xae')]):null,'deviceVendor':_0x3a016f[_0x6c8a('0xac')][_0x6c8a('0xad')],'deviceType':_0x3a016f[_0x6c8a('0xac')][_0x6c8a('0xae')],'formData':JSON[_0x6c8a('0x22')](_0x233631[_0x6c8a('0x59')])};var _0xc5ce74={'ChatWebsiteId':_0x233631['params']['id'],'closed':![]};if(_0x233631[_0x6c8a('0x59')]['threadId']){_0xc5ce74['threadId']=_0x233631[_0x6c8a('0x59')][_0x6c8a('0xaf')];return db[_0x6c8a('0xb0')][_0x6c8a('0x57')]({'where':_0xc5ce74})[_0x6c8a('0x1e')](function(_0x1a9052){if(_0x1a9052){return[_0x1a9052,![]];}_0x5b395d[_0x6c8a('0xaf')]=_0x233631[_0x6c8a('0x59')]['threadId'];_0x5b395d[_0x6c8a('0xb1')]=_0x233631[_0x6c8a('0x59')][_0x6c8a('0xb1')];return db['ChatInteraction'][_0x6c8a('0x58')](_0x5b395d)['then'](function(_0x28cc9b){return[_0x28cc9b,!![]];});});}_0xc5ce74[_0x6c8a('0xb2')]=_0x4cc181['id'];if(_0x233631['body']['interaction']&&_0x233631[_0x6c8a('0x59')][_0x6c8a('0xb3')]['id']){_0xc5ce74['id']=_0x233631['body'][_0x6c8a('0xb3')]['id'];return db['ChatInteraction'][_0x6c8a('0x57')]({'where':_0xc5ce74})['then'](function(_0x782040){if(_0x782040){return[_0x782040,![]];}return db[_0x6c8a('0xb0')]['create'](_0x5b395d)[_0x6c8a('0x1e')](function(_0x4594b4){return[_0x4594b4,!![]];});});}return db[_0x6c8a('0xb0')][_0x6c8a('0x58')](_0x5b395d)[_0x6c8a('0x1e')](function(_0xea352f){return[_0xea352f,!![]];});}})['spread'](function(_0x152367,_0x4f8ddf){if(_0x152367){_0x27d3fe=_0x4f8ddf;if(!_0x4f8ddf){var _0x15d038={'from':(_0x3d7629[_0x6c8a('0xa4')][_0x6c8a('0xb4')]||'')+'\x20'+(_0x3d7629[_0x6c8a('0xa4')][_0x6c8a('0xa5')]||'')};if(_0x233631['body'][_0x6c8a('0xaf')]&&_0x233631[_0x6c8a('0x59')][_0x6c8a('0xb5')]&&_0x233631[_0x6c8a('0x59')]['threadId']!=_0x233631[_0x6c8a('0x59')]['messageId']){_0x15d038[_0x6c8a('0xaf')]=_0x233631[_0x6c8a('0x59')]['messageId'];}return _0x152367['update'](_0x15d038);}else{return _0x152367;}}})[_0x6c8a('0x1e')](function(_0x44eefc){_0x3d7629['interaction']=_0x44eefc[_0x6c8a('0x5a')]({'plain':!![]});_0x3d7629['interaction']['created']=_0x27d3fe;if(_0x3d7629[_0x6c8a('0xb3')]['created']){if(_0x3d7629[_0x6c8a('0xa2')]['autoclose']){_0x3d7629[_0x6c8a('0x9d')]['push']({'id':0x0,'priority':_0x3d7629[_0x6c8a('0x9d')]['length']+0x1,'app':_0x6c8a('0xb6'),'appdata':_0x6c8a('0xb7'),'interval':_0x6c8a('0xb8')});}}return db['ChatMessage']['create']({'body':_0x233631['body'][_0x6c8a('0x59')],'ChatWebsiteId':_0x233631[_0x6c8a('0x54')]['id'],'ChatInteractionId':_0x44eefc['id'],'direction':'in','ContactId':_0x3d7629[_0x6c8a('0xa4')]['id'],'AttachmentId':_0x233631[_0x6c8a('0x59')]['AttachmentId']});})['then'](function(_0x44596b){_0x3d7629[_0x6c8a('0x26')]=_0x44596b;if(_0x3d7629[_0x6c8a('0xb3')]['UserId']){return db[_0x6c8a('0xb9')][_0x6c8a('0x57')]({'attributes':['id',_0x6c8a('0x37')],'where':{'id':_0x3d7629['interaction'][_0x6c8a('0xba')]}})[_0x6c8a('0x1e')](function(_0x3820d0){if(_0x3820d0){_0x3d7629[_0x6c8a('0x9d')][_0x6c8a('0xbb')]({'id':0x0,'priority':0x0,'app':_0x6c8a('0xbc'),'appdata':_0x3820d0[_0x6c8a('0x37')]+','+(_0x3d7629[_0x6c8a('0xa2')]['waitForTheAssignedAgent']||0xa),'interval':_0x6c8a('0xb8')});_0x3d7629['forcedOwnership']=!![];}return respondWithRpcPromise(_0x6c8a('0xbd'),_0x6c8a('0xbe'),_0x3d7629);});}return respondWithRpcPromise('Start','startRouting',_0x3d7629);})['then'](function(_0x4aa085){respondWithRpcPromise(_0x6c8a('0xbf'),_0x6c8a('0xbf'),{'event':_0x6c8a('0x86'),'message':_0x4aa085},client9002);return _0x4aa085;})[_0x6c8a('0x1e')](respondWithResult(_0x246bc5,null))[_0x6c8a('0x53')](handleError(_0x246bc5,null));};exports[_0x6c8a('0xc0')]=function(_0x43a163,_0x4b1193,_0x66536d){var _0x21ff9e,_0xa6a4d1,_0x5bd819;var _0x35fff3=[];var _0x6c1219=[];var _0x3a9af7={};return db[_0x6c8a('0x9b')][_0x6c8a('0x61')]()[_0x6c8a('0x1e')](function(_0x37755a){if(!_0x37755a){throw new db[(_0x6c8a('0x8d'))][(_0x6c8a('0x8e'))](_0x6c8a('0x8f'));}_0x6c1219=_[_0x6c8a('0x90')](_['keys'](_0x37755a),[_0x6c8a('0x91'),_0x6c8a('0x92')]);_0x35fff3=_[_0x6c8a('0x90')](_['keys'](_0x37755a),[_0x6c8a('0x91'),_0x6c8a('0x92'),'CompanyId',_0x6c8a('0x93')]);if(_0x43a163[_0x6c8a('0x59')]['id']){delete _0x43a163[_0x6c8a('0x59')]['id'];}if(_['isNil'](_0x43a163[_0x6c8a('0x59')][_0x6c8a('0x99')])){throw _0x4b1193[_0x6c8a('0x29')](0x1f4)[_0x6c8a('0x38')](new db[(_0x6c8a('0x8d'))][(_0x6c8a('0x8e'))](_0x6c8a('0x94')));}if(_[_0x6c8a('0x7b')](_0x43a163[_0x6c8a('0x59')][_0x6c8a('0x59')])||_0x43a163[_0x6c8a('0x59')][_0x6c8a('0x59')]===''){throw _0x4b1193[_0x6c8a('0x29')](0x1f4)[_0x6c8a('0x38')](new db[(_0x6c8a('0x8d'))][(_0x6c8a('0x8e'))](_0x6c8a('0xc1')));}if(_[_0x6c8a('0x7b')](_0x43a163['body'][_0x6c8a('0xc2')])){throw _0x4b1193[_0x6c8a('0x29')](0x1f4)[_0x6c8a('0x38')](new db[(_0x6c8a('0x8d'))][(_0x6c8a('0x8e'))](_0x6c8a('0xc3')+_0x35fff3));}if(!_[_0x6c8a('0x97')](_0x35fff3,_0x43a163[_0x6c8a('0x59')][_0x6c8a('0xc2')])){throw _0x4b1193[_0x6c8a('0x29')](0x1f4)['send'](new db[(_0x6c8a('0x8d'))][(_0x6c8a('0x8e'))](_0x6c8a('0xc4')+_0x35fff3));}_0x3a9af7[_0x43a163['body'][_0x6c8a('0xc2')]]=_0x43a163[_0x6c8a('0x59')][_0x6c8a('0x99')];})[_0x6c8a('0x1e')](function(){return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x43a163[_0x6c8a('0x54')]['id']},'include':[{'model':db[_0x6c8a('0x9a')],'as':'List'}]});})[_0x6c8a('0x1e')](handleEntityNotFound(_0x4b1193,null))[_0x6c8a('0x1e')](function(_0x485afc){if(_0x485afc&&_0x485afc[_0x6c8a('0xa3')]){_0xa6a4d1=_0x485afc;var _0x3e86c3=_['defaults'](_0x43a163[_0x6c8a('0x59')],{'firstName':_0x43a163[_0x6c8a('0x59')]['from'],'phone':_0x43a163['body'][_0x6c8a('0x99')],'ListId':_0x485afc[_0x6c8a('0x93')]});_0x3e86c3[_0x43a163[_0x6c8a('0x59')][_0x6c8a('0xc2')]]=_0x43a163[_0x6c8a('0x59')][_0x6c8a('0x99')];return db[_0x6c8a('0x9b')][_0x6c8a('0xc5')]({'where':_0x3a9af7,'defaults':_0x3e86c3});}})[_0x6c8a('0xc6')](function(_0xa7b93b){if(_0xa7b93b){_0x5bd819=_0xa7b93b;var _0x4cc39d=fs[_0x6c8a('0xc7')](path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x290dfb=ejs['render'](_0x4cc39d,{'body':_[_0x6c8a('0xc8')](_0x43a163['body'][_0x6c8a('0x59')]),'bodyTitle':_0xa6a4d1[_0x6c8a('0xc9')]});return db[_0x6c8a('0xca')][_0x6c8a('0x58')]({'body':_0x290dfb,'ContactId':_0xa7b93b['id'],'ChatWebsiteId':_0xa6a4d1['id']});}})['then'](function(_0x457e8c){if(_0x457e8c){_0x21ff9e=_0x457e8c;return db['MailAccount'][_0x6c8a('0x65')]({'where':{'service':!![]},'include':[{'model':db[_0x6c8a('0xcb')],'as':_0x6c8a('0xcc'),'raw':!![]}]});}})[_0x6c8a('0x1e')](function(_0x24956f){if(_0x24956f&&_0x24956f[_0x6c8a('0xcc')]&&_0xa6a4d1[_0x6c8a('0xcd')]){var _0x369acf={'tls':{'rejectUnauthorized':![]}};if(_0x24956f[_0x6c8a('0xcc')][_0x6c8a('0xce')]){_0x369acf['service']=_0x24956f[_0x6c8a('0xcc')][_0x6c8a('0xce')];}else{_0x369acf[_0x6c8a('0xcf')]=_0x24956f[_0x6c8a('0xcc')][_0x6c8a('0xcf')];_0x369acf[_0x6c8a('0xd0')]=_0x24956f[_0x6c8a('0xcc')]['port'];_0x369acf[_0x6c8a('0xd1')]=_0x24956f[_0x6c8a('0xcc')]['secure'];}if(_0x24956f[_0x6c8a('0xcc')][_0x6c8a('0xd2')]){_0x369acf[_0x6c8a('0xd3')]={'user':_0x24956f['Smtp'][_0x6c8a('0x5c')],'pass':_0x24956f[_0x6c8a('0xcc')][_0x6c8a('0xd4')]};}return respondWithRpcPromise(_0x6c8a('0xd5'),_0x6c8a('0xd6'),{'account':_0x369acf,'message':{'from':util[_0x6c8a('0xa9')](_0x6c8a('0xd7'),_0x24956f[_0x6c8a('0x37')],_0x24956f[_0x6c8a('0xd8')]||_0x24956f['Smtp'][_0x6c8a('0x5c')]),'to':_0xa6a4d1[_0x6c8a('0xcd')],'subject':_0xa6a4d1['offlineMessageSubject'],'text':_0x21ff9e[_0x6c8a('0x59')]}},client9003)[_0x6c8a('0x1e')](function(){return _0x21ff9e;})['catch'](function(_0xe40151){console[_0x6c8a('0x23')](_0xe40151);});}})[_0x6c8a('0x1e')](function(){if(_0x21ff9e){return _0x21ff9e;}})[_0x6c8a('0x1e')](respondWithResult(_0x4b1193,null))[_0x6c8a('0x53')](handleError(_0x4b1193,null));};exports['addInteraction']=function(_0x1cbfc4,_0x4c3579,_0x9527ee){return db[_0x6c8a('0xb0')][_0x6c8a('0x57')]({'where':{'id':_0x1cbfc4[_0x6c8a('0x54')]['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x4c3579,null))[_0x6c8a('0x1e')](function(_0x588156){if(_0x588156){return _0x588156[_0x6c8a('0xd9')](_0x1cbfc4['body'][_0x6c8a('0x67')],_[_0x6c8a('0xda')](_0x1cbfc4['body'],[_0x6c8a('0x67'),'id'])||{});}})[_0x6c8a('0x1e')](respondWithResult(_0x4c3579,null))[_0x6c8a('0x53')](handleError(_0x4c3579,null));};exports[_0x6c8a('0xdb')]=function(_0x27c3a3,_0x40af85,_0x5a6528){var _0x7f4752={'raw':![],'where':{}};var _0x1f883c={};var _0x3adcc3={'count':0x0,'rows':[]};return db[_0x6c8a('0x3a')][_0x6c8a('0x65')]({'where':{'id':_0x27c3a3[_0x6c8a('0x54')]['id']}})['then'](handleEntityNotFound(_0x40af85,null))[_0x6c8a('0x1e')](function(_0x49c11a){if(_0x49c11a){_0x1f883c[_0x6c8a('0x42')]=_[_0x6c8a('0x3c')](db[_0x6c8a('0xb0')][_0x6c8a('0x3b')]);_0x1f883c['query']=_[_0x6c8a('0x3c')](_0x27c3a3[_0x6c8a('0x3d')]);_0x1f883c['filters']=_[_0x6c8a('0x41')](_0x1f883c[_0x6c8a('0x42')],_0x1f883c[_0x6c8a('0x3d')]);_0x7f4752[_0x6c8a('0x43')]=_[_0x6c8a('0x41')](_0x1f883c[_0x6c8a('0x42')],qs[_0x6c8a('0x44')](_0x27c3a3[_0x6c8a('0x3d')]['fields']));_0x7f4752[_0x6c8a('0x43')]=_0x7f4752[_0x6c8a('0x43')]['length']?_0x7f4752['attributes']:_0x1f883c[_0x6c8a('0x42')];if(!_0x27c3a3[_0x6c8a('0x3d')]['hasOwnProperty'](_0x6c8a('0x47'))){_0x7f4752[_0x6c8a('0x2e')]=qs[_0x6c8a('0x2e')](_0x27c3a3[_0x6c8a('0x3d')][_0x6c8a('0x2e')]);_0x7f4752[_0x6c8a('0x2d')]=qs[_0x6c8a('0x2d')](_0x27c3a3['query'][_0x6c8a('0x2d')]);}_0x7f4752[_0x6c8a('0x48')]=qs[_0x6c8a('0x49')](_0x27c3a3['query'][_0x6c8a('0x49')]);_0x7f4752[_0x6c8a('0x4a')]=qs[_0x6c8a('0x40')](_[_0x6c8a('0x6b')](_0x27c3a3['query'],_0x1f883c[_0x6c8a('0x40')]));_0x7f4752[_0x6c8a('0x4a')][_0x6c8a('0x62')]=_0x49c11a['id'];if(_0x27c3a3[_0x6c8a('0x3d')][_0x6c8a('0x4d')]){_0x7f4752['where']=_[_0x6c8a('0x4e')](_0x7f4752[_0x6c8a('0x4a')],{'$or':_[_0x6c8a('0x4f')](_0x7f4752[_0x6c8a('0x43')],function(_0xf08ab6){var _0x32b796={};_0x32b796[_0xf08ab6]={'$like':'%'+_0x27c3a3[_0x6c8a('0x3d')][_0x6c8a('0x4d')]+'%'};return _0x32b796;})});}_0x7f4752=_[_0x6c8a('0x4e')]({},_0x7f4752,_0x27c3a3[_0x6c8a('0x50')]);return db[_0x6c8a('0xb0')][_0x6c8a('0x2c')]({'where':_0x7f4752[_0x6c8a('0x4a')]})[_0x6c8a('0x1e')](function(_0x4083be){_0x3adcc3[_0x6c8a('0x2c')]=_0x4083be;if(_0x27c3a3['query'][_0x6c8a('0x55')]){_0x7f4752[_0x6c8a('0x56')]=[{'model':db[_0x6c8a('0x9b')],'as':_0x6c8a('0xdc'),'required':![]},{'model':db[_0x6c8a('0xb9')],'as':_0x6c8a('0xdd'),'attributes':[_0x6c8a('0x37'),'fullname',_0x6c8a('0xde')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x6c8a('0x37'),_0x6c8a('0xdf')],'where':_0x27c3a3['query'][_0x6c8a('0xe0')]?{'id':_0x27c3a3[_0x6c8a('0x3d')][_0x6c8a('0xe0')]}:undefined,'required':_0x27c3a3[_0x6c8a('0x3d')][_0x6c8a('0xe0')]?!![]:![]}];}return db['ChatInteraction'][_0x6c8a('0x51')](_0x7f4752);})[_0x6c8a('0x1e')](function(_0x20ba6a){_0x3adcc3['rows']=_0x20ba6a;return _0x3adcc3;});}})[_0x6c8a('0x1e')](respondWithFilteredResult(_0x40af85,_0x7f4752))[_0x6c8a('0x53')](handleError(_0x40af85,null));};function iftimePromise(_0x46e101,_0x122a0d){return respondWithRpcPromise('Command','getSnippet',{'command':_0x122a0d[_0x6c8a('0xe1')]?util[_0x6c8a('0xa9')]('iftime\x20%s,%s',_0x46e101[_0x6c8a('0xe2')],_0x122a0d[_0x6c8a('0xe1')]):util[_0x6c8a('0xa9')]('iftime\x20%s',_0x46e101[_0x6c8a('0xe2')])},client9002)[_0x6c8a('0x1e')](function(_0x3ce9fe){var _0x16803e=_0x3ce9fe&&_0x3ce9fe['indexOf'](_0x6c8a('0xe3'))>=0x0?!![]:![];logger[_0x6c8a('0x1f')](_0x6c8a('0xe4'),_0x122a0d['id'],_0x46e101['id'],_0x46e101['interval'],_0x16803e?_0x6c8a('0xe5'):'OFFLINE',_0x122a0d[_0x6c8a('0xe1')]?_0x122a0d[_0x6c8a('0xe1')]:_0x6c8a('0xe6'));return _0x16803e;})[_0x6c8a('0x53')](function(_0x264e10){logger[_0x6c8a('0x23')](_0x6c8a('0xe4'),_0x122a0d['id'],_0x46e101['id'],_0x46e101[_0x6c8a('0xe2')],util['inspect'](_0x264e10,{'showHidden':![],'depth':null}),_0x122a0d[_0x6c8a('0xe1')]?_0x122a0d[_0x6c8a('0xe1')]:_0x6c8a('0xe6'));return![];});}exports['getSnippet']=function(_0x4f2e30,_0xeb2d20,_0x1936b4){var _0x3f9b44=0x0;var _0x38fa4c=0x0;var _0xede757=![];var _0x53553b;var _0xd49e02;return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x4f2e30['params']['id']},'include':[{'model':db['Interval'],'as':_0x6c8a('0xe7'),'include':[{'model':db[_0x6c8a('0xe7')],'as':_0x6c8a('0xe8'),'attributes':['id',_0x6c8a('0xe2')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0xeb2d20,null))[_0x6c8a('0x1e')](function(_0x540f81){if(_0x540f81){_0x53553b=_0x540f81;return _0x540f81[_0x6c8a('0xe9')]({'raw':!![]});}})['then'](function(_0x50d0ab){if(_0x53553b){if(_0x50d0ab){_0xd49e02=_0x50d0ab;}}return require(_0x6c8a('0x79'))['getLicense']();})[_0x6c8a('0x1e')](function(_0x2d4627){if(_0x2d4627){_0x38fa4c=_0x2d4627['virtual'];_0xede757=_0x2d4627[_0x6c8a('0xea')];}})[_0x6c8a('0x1e')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x6c8a('0x1e')](function(_0x4b46bc){_0x3f9b44=_0x4b46bc;if(_0x38fa4c&&_0x4b46bc>_0x38fa4c){return db['License'][_0x6c8a('0x65')]({'where':{'id':0x1}})[_0x6c8a('0x1e')](function(_0x38efbd){if(_0x38efbd){_0x38efbd[_0x6c8a('0xeb')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x53553b[_0x6c8a('0xe7')]&&_0x53553b[_0x6c8a('0xe7')][_0x6c8a('0xe8')]){var _0x1c1d60=[];for(var _0x200226=0x0;_0x200226<_0x53553b[_0x6c8a('0xe7')][_0x6c8a('0xe8')]['length'];_0x200226++){var _0x581b76=_0x53553b[_0x6c8a('0xe7')][_0x6c8a('0xe8')][_0x200226][_0x6c8a('0x5a')]({'plain':!![]});_0x1c1d60[_0x6c8a('0xec')](iftimePromise(_0x581b76,_0x53553b));}return BPromise['all'](_0x1c1d60)[_0x6c8a('0x1e')](function(_0x481a9e){return _[_0x6c8a('0xed')](_0x481a9e);});}else{return!![];}})['then'](function(_0x5664b2){var _0x49ade6=fs['readFileSync'](path[_0x6c8a('0x75')](config[_0x6c8a('0x76')],'server/files/chat/iframe.js'),_0x6c8a('0xee'));var _0x1543e2={'remote':_0x53553b[_0x6c8a('0xef')],'query':querystring[_0x6c8a('0x22')](_['merge'](_0x53553b[_0x6c8a('0x5a')]({'plain':!![]}),{'customerIp':_0x4f2e30[_0x6c8a('0x89')][_0x6c8a('0xf0')]||_0x4f2e30['headers']['x-real-ip']||_0x4f2e30[_0x6c8a('0xf1')]['remoteAddress']||_0x4f2e30['ip'],'referer':_0x4f2e30[_0x6c8a('0x89')][_0x6c8a('0xf2')],'openedInteractions':_0x3f9b44,'maxInteractions':_0x38fa4c,'virtual':_0xede757[_0x6c8a('0xf3')],'online':_0x5664b2,'custom':_0xede757}))[_0x6c8a('0xf4')](/'/g,'\x5c\x27')};_0xeb2d20['send'](ejs[_0x6c8a('0xf5')](Mustache[_0x6c8a('0xf5')](_0x49ade6,_0x1543e2),{'proactiveActions':_0xd49e02,'alignment':_0x53553b[_0x6c8a('0xf6')],'verticalAlignment':_0x53553b[_0x6c8a('0xf7')]}));})[_0x6c8a('0x53')](handleError(_0xeb2d20,null));};exports[_0x6c8a('0xf8')]=function(_0x1b8f4f,_0x2fe909,_0x1f174e){return db[_0x6c8a('0x3a')][_0x6c8a('0x65')]({'where':{'id':_0x1b8f4f[_0x6c8a('0x54')]['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x2fe909,null))[_0x6c8a('0x1e')](function(_0x50c56f){if(_0x50c56f){return db[_0x6c8a('0xf9')][_0x6c8a('0xfa')](function(_0x31e281){return db[_0x6c8a('0xfb')][_0x6c8a('0x34')]({'where':{'ChatWebsiteId':_0x1b8f4f[_0x6c8a('0x54')]['id']},'transaction':_0x31e281})['then'](function(_0x2282b6){var _0x43ca7a=_['map'](_0x1b8f4f[_0x6c8a('0x59')],function(_0x19c7f5){_0x19c7f5[_0x6c8a('0x62')]=_0x1b8f4f['params']['id'];return _0x19c7f5;});return db[_0x6c8a('0xfb')]['bulkCreate'](_0x43ca7a,{'transaction':_0x31e281});});})[_0x6c8a('0x1e')](function(){return db[_0x6c8a('0xfb')][_0x6c8a('0xfc')]({'where':{'ChatWebsiteId':_0x1b8f4f[_0x6c8a('0x54')]['id']},'order':_0x6c8a('0xa0')});});}})[_0x6c8a('0x1e')](respondWithResult(_0x2fe909,null))[_0x6c8a('0x53')](handleError(_0x2fe909,null));};exports[_0x6c8a('0xfd')]=function(_0x470d5e,_0x2aca2e,_0x2d4b93){var _0x465fe7={};var _0x2e9aef={};var _0x5b43b4;var _0x36235e;return db[_0x6c8a('0x3a')][_0x6c8a('0x65')]({'where':{'id':_0x470d5e['params']['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x2aca2e,null))['then'](function(_0x3070b8){if(_0x3070b8){_0x5b43b4=_0x3070b8;_0x2e9aef[_0x6c8a('0x42')]=_[_0x6c8a('0x3c')](db[_0x6c8a('0xfb')][_0x6c8a('0x3b')]);_0x2e9aef[_0x6c8a('0x3d')]=_[_0x6c8a('0x3c')](_0x470d5e[_0x6c8a('0x3d')]);_0x2e9aef[_0x6c8a('0x40')]=_['intersection'](_0x2e9aef[_0x6c8a('0x42')],_0x2e9aef['query']);_0x465fe7[_0x6c8a('0x43')]=_[_0x6c8a('0x41')](_0x2e9aef[_0x6c8a('0x42')],qs[_0x6c8a('0x44')](_0x470d5e[_0x6c8a('0x3d')][_0x6c8a('0x44')]));_0x465fe7['attributes']=_0x465fe7[_0x6c8a('0x43')][_0x6c8a('0x45')]?_0x465fe7[_0x6c8a('0x43')]:_0x2e9aef[_0x6c8a('0x42')];_0x465fe7['order']=qs['sort'](_0x470d5e[_0x6c8a('0x3d')][_0x6c8a('0x49')]);_0x465fe7[_0x6c8a('0x4a')]=qs['filters'](_['pick'](_0x470d5e[_0x6c8a('0x3d')],_0x2e9aef[_0x6c8a('0x40')]));if(_0x470d5e[_0x6c8a('0x3d')][_0x6c8a('0x4d')]){_0x465fe7[_0x6c8a('0x4a')]=_['merge'](_0x465fe7[_0x6c8a('0x4a')],{'$or':_['map'](_0x465fe7[_0x6c8a('0x43')],function(_0x10aab8){var _0x49807e={};_0x49807e[_0x10aab8]={'$like':'%'+_0x470d5e['query'][_0x6c8a('0x4d')]+'%'};return _0x49807e;})});}_0x465fe7=_['merge']({},_0x465fe7,_0x470d5e[_0x6c8a('0x50')]);return _0x5b43b4['getApplications'](_0x465fe7);}})[_0x6c8a('0x1e')](function(_0x3b3c75){if(_0x3b3c75){_0x36235e=_0x3b3c75[_0x6c8a('0x45')];if(!_0x470d5e[_0x6c8a('0x3d')][_0x6c8a('0x46')](_0x6c8a('0x47'))){_0x465fe7[_0x6c8a('0x2e')]=qs['limit'](_0x470d5e[_0x6c8a('0x3d')][_0x6c8a('0x2e')]);_0x465fe7[_0x6c8a('0x2d')]=qs['offset'](_0x470d5e[_0x6c8a('0x3d')][_0x6c8a('0x2d')]);}return _0x5b43b4[_0x6c8a('0xfd')](_0x465fe7);}})[_0x6c8a('0x1e')](function(_0x716e6d){if(_0x716e6d){return _0x716e6d?{'count':_0x36235e,'rows':_0x716e6d}:null;}})[_0x6c8a('0x1e')](respondWithResult(_0x2aca2e,null))[_0x6c8a('0x53')](handleError(_0x2aca2e,null));};exports[_0x6c8a('0xfe')]=function(_0x7c3a99,_0x59406e,_0x72c80d){return db[_0x6c8a('0xff')][_0x6c8a('0x57')]({'where':{'id':_0x7c3a99[_0x6c8a('0x54')]['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x59406e,null))['then'](function(_0x51559c){if(_0x51559c){return _0x51559c['addProactiveActions'](_0x7c3a99[_0x6c8a('0x59')][_0x6c8a('0x67')],_[_0x6c8a('0xda')](_0x7c3a99[_0x6c8a('0x59')],[_0x6c8a('0x67'),'id'])||{});}})[_0x6c8a('0x1e')](respondWithResult(_0x59406e,null))['catch'](handleError(_0x59406e,null));};exports['getProactiveActions']=function(_0x343078,_0x136e83,_0x5aa0c8){var _0x232070={};var _0x2b9d29={};var _0x18a926;var _0x5005fd;return db[_0x6c8a('0x3a')]['findOne']({'where':{'id':_0x343078['params']['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x136e83,null))[_0x6c8a('0x1e')](function(_0x3cc8e5){if(_0x3cc8e5){_0x18a926=_0x3cc8e5;_0x2b9d29['model']=_[_0x6c8a('0x3c')](db['ChatProactiveAction'][_0x6c8a('0x3b')]);_0x2b9d29[_0x6c8a('0x3d')]=_[_0x6c8a('0x3c')](_0x343078[_0x6c8a('0x3d')]);_0x2b9d29[_0x6c8a('0x40')]=_['intersection'](_0x2b9d29[_0x6c8a('0x42')],_0x2b9d29[_0x6c8a('0x3d')]);_0x232070[_0x6c8a('0x43')]=_['intersection'](_0x2b9d29[_0x6c8a('0x42')],qs['fields'](_0x343078[_0x6c8a('0x3d')]['fields']));_0x232070['attributes']=_0x232070[_0x6c8a('0x43')]['length']?_0x232070[_0x6c8a('0x43')]:_0x2b9d29['model'];_0x232070[_0x6c8a('0x48')]=qs[_0x6c8a('0x49')](_0x343078['query'][_0x6c8a('0x49')]);_0x232070[_0x6c8a('0x4a')]=qs[_0x6c8a('0x40')](_[_0x6c8a('0x6b')](_0x343078['query'],_0x2b9d29[_0x6c8a('0x40')]));if(_0x343078[_0x6c8a('0x3d')]['filter']){_0x232070[_0x6c8a('0x4a')]=_[_0x6c8a('0x4e')](_0x232070['where'],{'$or':_[_0x6c8a('0x4f')](_0x232070[_0x6c8a('0x43')],function(_0x1c39ff){var _0x4c137a={};_0x4c137a[_0x1c39ff]={'$like':'%'+_0x343078[_0x6c8a('0x3d')][_0x6c8a('0x4d')]+'%'};return _0x4c137a;})});}_0x232070=_[_0x6c8a('0x4e')]({},_0x232070,_0x343078[_0x6c8a('0x50')]);return _0x18a926[_0x6c8a('0xe9')](_0x232070);}})[_0x6c8a('0x1e')](function(_0xfc8445){if(_0xfc8445){_0x5005fd=_0xfc8445[_0x6c8a('0x45')];if(!_0x343078[_0x6c8a('0x3d')][_0x6c8a('0x46')](_0x6c8a('0x47'))){_0x232070['limit']=qs['limit'](_0x343078['query'][_0x6c8a('0x2e')]);_0x232070[_0x6c8a('0x2d')]=qs[_0x6c8a('0x2d')](_0x343078[_0x6c8a('0x3d')]['offset']);}return _0x18a926[_0x6c8a('0xe9')](_0x232070);}})[_0x6c8a('0x1e')](function(_0x1868eb){if(_0x1868eb){return _0x1868eb?{'count':_0x5005fd,'rows':_0x1868eb}:null;}})[_0x6c8a('0x1e')](respondWithResult(_0x136e83,null))[_0x6c8a('0x53')](handleError(_0x136e83,null));};exports[_0x6c8a('0x100')]=function(_0x124c33,_0x3f9d9b,_0x6abd2b){var _0x421eeb=_0x124c33[_0x6c8a('0x3d')]['online']===_0x6c8a('0x101')?'offlineForm':_0x6c8a('0x102');return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'attributes':['id',_0x421eeb],'where':{'id':_0x124c33[_0x6c8a('0x54')]['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x3f9d9b,null))['then'](function(_0x4b99aa){if(_0x4b99aa){var _0x17920e=_0x4b99aa[_0x421eeb];var _0x16f190=_0x17920e&&_0x17920e[_0x6c8a('0x103')]?_0x17920e[_0x6c8a('0x103')]:[];_0x3f9d9b['send']({'fromKey':_[_0x6c8a('0x7b')](_0x17920e[_0x6c8a('0x104')])?undefined:_0x17920e[_0x6c8a('0x104')],'count':_0x16f190[_0x6c8a('0x45')],'rows':_0x16f190});}})[_0x6c8a('0x53')](handleError(_0x3f9d9b,null));};exports[_0x6c8a('0x105')]=function(_0x1167ad,_0x935408,_0x1b987e){var _0x1aa3ec={'raw':!![],'where':{}};var _0x1186f6={};var _0x290f6a={'count':0x0,'rows':[]};return db[_0x6c8a('0x3a')][_0x6c8a('0x65')]({'where':{'id':_0x1167ad['params']['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x935408,null))[_0x6c8a('0x1e')](function(_0x120583){if(_0x120583){_0x1186f6[_0x6c8a('0x42')]=_[_0x6c8a('0x3c')](db[_0x6c8a('0xca')][_0x6c8a('0x3b')]);_0x1186f6[_0x6c8a('0x3d')]=_['keys'](_0x1167ad[_0x6c8a('0x3d')]);_0x1186f6[_0x6c8a('0x40')]=_[_0x6c8a('0x41')](_0x1186f6['model'],_0x1186f6['query']);_0x1aa3ec['attributes']=_[_0x6c8a('0x41')](_0x1186f6[_0x6c8a('0x42')],qs[_0x6c8a('0x44')](_0x1167ad[_0x6c8a('0x3d')][_0x6c8a('0x44')]));_0x1aa3ec[_0x6c8a('0x43')]=_0x1aa3ec[_0x6c8a('0x43')][_0x6c8a('0x45')]?_0x1aa3ec[_0x6c8a('0x43')]:_0x1186f6[_0x6c8a('0x42')];if(!_0x1167ad[_0x6c8a('0x3d')][_0x6c8a('0x46')]('nolimit')){_0x1aa3ec[_0x6c8a('0x2e')]=qs[_0x6c8a('0x2e')](_0x1167ad[_0x6c8a('0x3d')][_0x6c8a('0x2e')]);_0x1aa3ec[_0x6c8a('0x2d')]=qs[_0x6c8a('0x2d')](_0x1167ad[_0x6c8a('0x3d')][_0x6c8a('0x2d')]);}_0x1aa3ec[_0x6c8a('0x48')]=qs[_0x6c8a('0x49')](_0x1167ad[_0x6c8a('0x3d')]['sort']);_0x1aa3ec[_0x6c8a('0x4a')]=qs[_0x6c8a('0x40')](_['pick'](_0x1167ad[_0x6c8a('0x3d')],_0x1186f6[_0x6c8a('0x40')]));_0x1aa3ec[_0x6c8a('0x4a')][_0x6c8a('0x62')]=_0x120583['id'];if(_0x1167ad[_0x6c8a('0x3d')][_0x6c8a('0x4d')]){_0x1aa3ec[_0x6c8a('0x4a')]=_[_0x6c8a('0x4e')](_0x1aa3ec[_0x6c8a('0x4a')],{'$or':_[_0x6c8a('0x4f')](_0x1aa3ec[_0x6c8a('0x43')],function(_0x31dad6){var _0x518e4d={};_0x518e4d[_0x31dad6]={'$like':'%'+_0x1167ad[_0x6c8a('0x3d')][_0x6c8a('0x4d')]+'%'};return _0x518e4d;})});}_0x1aa3ec=_[_0x6c8a('0x4e')]({},_0x1aa3ec,_0x1167ad[_0x6c8a('0x50')]);return db['ChatOfflineMessage']['count']({'where':_0x1aa3ec['where']})[_0x6c8a('0x1e')](function(_0x8baae4){_0x290f6a[_0x6c8a('0x2c')]=_0x8baae4;if(_0x1167ad['query'][_0x6c8a('0x55')]){_0x1aa3ec['include']=[{'all':!![]}];}return db[_0x6c8a('0xca')][_0x6c8a('0x51')](_0x1aa3ec);})['then'](function(_0x16ffc1){_0x290f6a[_0x6c8a('0x52')]=_0x16ffc1;return _0x290f6a;});}})['then'](respondWithFilteredResult(_0x935408,_0x1aa3ec))[_0x6c8a('0x53')](handleError(_0x935408,null));};exports[_0x6c8a('0x106')]=function(_0x2c2ab1,_0x46ab4f,_0x1b3b6f){return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x2c2ab1[_0x6c8a('0x54')]['id']}})['then'](handleEntityNotFound(_0x46ab4f,null))[_0x6c8a('0x1e')](function(_0x3b8e40){if(_0x3b8e40){return _0x3b8e40[_0x6c8a('0x106')](_0x2c2ab1['body'][_0x6c8a('0x67')],_['omit'](_0x2c2ab1[_0x6c8a('0x59')],[_0x6c8a('0x67'),'id'])||{})[_0x6c8a('0xc6')](function(_0x57518a){for(var _0x36451d=0x0;_0x36451d<_0x2c2ab1[_0x6c8a('0x59')][_0x6c8a('0x67')][_0x6c8a('0x45')];_0x36451d+=0x1){socket[_0x6c8a('0x107')](_0x6c8a('0x108'),{'UserId':_0x2c2ab1[_0x6c8a('0x59')]['ids'][_0x36451d],'ChatWebsiteId':_0x2c2ab1[_0x6c8a('0x54')]['id']});}return _0x57518a;});}})[_0x6c8a('0x1e')](respondWithResult(_0x46ab4f,null))[_0x6c8a('0x53')](handleError(_0x46ab4f,null));};exports[_0x6c8a('0x109')]=function(_0x563757,_0x4a50ef,_0x1139e8){var _0x3048c7;return db[_0x6c8a('0x3a')][_0x6c8a('0x57')]({'where':{'id':_0x563757['params']['id']}})['then'](handleEntityNotFound(_0x4a50ef,null))[_0x6c8a('0x1e')](function(_0x23972d){if(_0x23972d){return _0x23972d[_0x6c8a('0x109')](_0x563757['query'][_0x6c8a('0x67')])[_0x6c8a('0x1e')](function(_0x4f890f){if(_[_0x6c8a('0x10a')](_0x563757['query'][_0x6c8a('0x67')])){for(var _0x87bb72=0x0;_0x87bb72<_0x563757[_0x6c8a('0x3d')][_0x6c8a('0x67')][_0x6c8a('0x45')];_0x87bb72+=0x1){socket[_0x6c8a('0x107')](_0x6c8a('0x10b'),{'UserId':_0x563757[_0x6c8a('0x3d')][_0x6c8a('0x67')][_0x87bb72],'ChatWebsiteId':_0x563757[_0x6c8a('0x54')]['id']});}}else{socket[_0x6c8a('0x107')](_0x6c8a('0x10b'),{'UserId':_0x563757[_0x6c8a('0x3d')]['ids'],'ChatWebsiteId':_0x563757[_0x6c8a('0x54')]['id']});}});}})[_0x6c8a('0x1e')](respondWithStatusCode(_0x4a50ef,null))[_0x6c8a('0x53')](handleError(_0x4a50ef,null));};exports['getAgents']=function(_0x45f5d6,_0x1c763a,_0x3a5d02){var _0x42bd02={};var _0xba41fd={};var _0x32b38d;var _0x2908ce;return db[_0x6c8a('0x3a')][_0x6c8a('0x65')]({'where':{'id':_0x45f5d6['params']['id']}})[_0x6c8a('0x1e')](handleEntityNotFound(_0x1c763a,null))[_0x6c8a('0x1e')](function(_0x2d0b9a){if(_0x2d0b9a){_0x32b38d=_0x2d0b9a;_0xba41fd[_0x6c8a('0x42')]=_['keys'](db[_0x6c8a('0xb9')]['rawAttributes']);_0xba41fd[_0x6c8a('0x3d')]=_[_0x6c8a('0x3c')](_0x45f5d6[_0x6c8a('0x3d')]);_0xba41fd[_0x6c8a('0x40')]=_[_0x6c8a('0x41')](_0xba41fd[_0x6c8a('0x42')],_0xba41fd[_0x6c8a('0x3d')]);_0x42bd02[_0x6c8a('0x43')]=_[_0x6c8a('0x41')](_0xba41fd['model'],qs[_0x6c8a('0x44')](_0x45f5d6[_0x6c8a('0x3d')][_0x6c8a('0x44')]));_0x42bd02[_0x6c8a('0x43')]=_0x42bd02['attributes'][_0x6c8a('0x45')]?_0x42bd02[_0x6c8a('0x43')]:_0xba41fd['model'];_0x42bd02[_0x6c8a('0x48')]=qs['sort'](_0x45f5d6[_0x6c8a('0x3d')][_0x6c8a('0x49')]);_0x42bd02[_0x6c8a('0x4a')]=qs[_0x6c8a('0x40')](_[_0x6c8a('0x6b')](_0x45f5d6[_0x6c8a('0x3d')],_0xba41fd[_0x6c8a('0x40')]));if(_0x45f5d6[_0x6c8a('0x3d')][_0x6c8a('0x4d')]){_0x42bd02[_0x6c8a('0x4a')]=_['merge'](_0x42bd02['where'],{'$or':_[_0x6c8a('0x4f')](_0x42bd02[_0x6c8a('0x43')],function(_0x517772){var _0x499c4a={};_0x499c4a[_0x517772]={'$like':'%'+_0x45f5d6['query']['filter']+'%'};return _0x499c4a;})});}_0x42bd02=_['merge']({},_0x42bd02,_0x45f5d6[_0x6c8a('0x50')]);return _0x32b38d['getAgents'](_0x42bd02);}})[_0x6c8a('0x1e')](function(_0x1b0c47){if(_0x1b0c47){_0x2908ce=_0x1b0c47[_0x6c8a('0x45')];if(!_0x45f5d6[_0x6c8a('0x3d')][_0x6c8a('0x46')]('nolimit')){_0x42bd02[_0x6c8a('0x2e')]=qs[_0x6c8a('0x2e')](_0x45f5d6[_0x6c8a('0x3d')][_0x6c8a('0x2e')]);_0x42bd02['offset']=qs[_0x6c8a('0x2d')](_0x45f5d6[_0x6c8a('0x3d')][_0x6c8a('0x2d')]);}return _0x32b38d[_0x6c8a('0x10c')](_0x42bd02);}})['then'](function(_0x5f2e4a){if(_0x5f2e4a){return _0x5f2e4a?{'count':_0x2908ce,'rows':_0x5f2e4a}:null;}})[_0x6c8a('0x1e')](respondWithResult(_0x1c763a,null))['catch'](handleError(_0x1c763a,null));}; \ No newline at end of file +var _0xe9d6=['ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','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','CmList','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','orderBy','priority','asc','contact','firstName','lastName','customerIp','referer','browser','version','format','%s\x20%s','unknown','vendor','device','type','threadId','ChatInteraction','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','CompanyId','mapKeyOffline','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','omit','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','getProactiveActions','License','chatLicenseExceeded','Intervals','some','server/files/chat/iframe.js','headers','x-forwarded-for','x-real-ip','connection','remoteAddress','virtual','replace','render','alignment','verticalAlignment','addApplications','transaction','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','get','ChatWebsites','UserProfileResource','end','sendStatus','stack','name','send','rawAttributes','keys','query','dateEnd','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','add','day','dateStart','where','merge','map','filter','options','includeAll','include','ChatWebsite','findAll','rows','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','length','ChatWebsiteId'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0xe9d6,0x1c7));var _0x6e9d=function(_0x3ce51e,_0x3789d7){_0x3ce51e=_0x3ce51e-0x0;var _0x45c999=_0xe9d6[_0x3ce51e];return _0x45c999;};'use strict';var pdf=require(_0x6e9d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6e9d('0x1'));var zipdir=require(_0x6e9d('0x2'));var jsonpatch=require(_0x6e9d('0x3'));var rp=require(_0x6e9d('0x4'));var moment=require(_0x6e9d('0x5'));var BPromise=require(_0x6e9d('0x6'));var Mustache=require(_0x6e9d('0x7'));var util=require(_0x6e9d('0x8'));var path=require('path');var sox=require(_0x6e9d('0x9'));var csv=require(_0x6e9d('0xa'));var ejs=require(_0x6e9d('0xb'));var fs=require('fs');var _=require(_0x6e9d('0xc'));var squel=require(_0x6e9d('0xd'));var crypto=require('crypto');var jsforce=require(_0x6e9d('0xe'));var deskjs=require(_0x6e9d('0xf'));var toCsv=require(_0x6e9d('0xa'));var querystring=require(_0x6e9d('0x10'));var Papa=require(_0x6e9d('0x11'));var Redis=require(_0x6e9d('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x6e9d('0x13'));var config=require(_0x6e9d('0x14'));var db=require(_0x6e9d('0x15'))['db'];config[_0x6e9d('0x16')]=_[_0x6e9d('0x17')](config[_0x6e9d('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e9d('0x16')]));require(_0x6e9d('0x18'))[_0x6e9d('0x19')](socket);var jayson=require(_0x6e9d('0x1a'));var client=jayson[_0x6e9d('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x6e9d('0x1b')]['http']({'port':0x232a});var client9003=jayson[_0x6e9d('0x1b')][_0x6e9d('0x1c')]({'port':0x232b});function respondWithRpcPromise(_0x442a7e,_0x596eec,_0x429012,_0x5531b7){return new BPromise(function(_0x537459,_0x2bfdbc){var _0x87ae3d=_0x5531b7||client;return _0x87ae3d[_0x6e9d('0x1d')](_0x442a7e,_0x429012)[_0x6e9d('0x1e')](function(_0x2091c6){logger[_0x6e9d('0x1f')](_0x6e9d('0x20'),_0x596eec,_0x6e9d('0x21'));logger[_0x6e9d('0x22')](_0x6e9d('0x23'),_0x596eec,_0x6e9d('0x21'),JSON[_0x6e9d('0x24')](_0x2091c6));if(_0x2091c6[_0x6e9d('0x25')]){if(_0x2091c6[_0x6e9d('0x25')]['code']===0x1f4){logger['error'](_0x6e9d('0x20'),_0x596eec,_0x2091c6[_0x6e9d('0x25')][_0x6e9d('0x26')]);return _0x2bfdbc(_0x2091c6[_0x6e9d('0x25')][_0x6e9d('0x26')]);}logger[_0x6e9d('0x25')](_0x6e9d('0x20'),_0x596eec,_0x2091c6[_0x6e9d('0x25')][_0x6e9d('0x26')]);return _0x537459(_0x2091c6['error'][_0x6e9d('0x26')]);}else{logger[_0x6e9d('0x1f')](_0x6e9d('0x20'),_0x596eec,_0x6e9d('0x21'));_0x537459(_0x2091c6[_0x6e9d('0x27')][_0x6e9d('0x26')]);}})[_0x6e9d('0x28')](function(_0x31c2ea){logger[_0x6e9d('0x25')](_0x6e9d('0x20'),_0x596eec,_0x31c2ea);_0x2bfdbc(_0x31c2ea);});});}function respondWithStatusCode(_0x5ca0b8,_0x30ebf1){_0x30ebf1=_0x30ebf1||0xcc;return function(_0x36fca6){if(_0x36fca6){return _0x5ca0b8['sendStatus'](_0x30ebf1);}return _0x5ca0b8['status'](_0x30ebf1)['end']();};}function respondWithResult(_0x49a5d9,_0x421f9a){_0x421f9a=_0x421f9a||0xc8;return function(_0x892610){if(_0x892610){return _0x49a5d9[_0x6e9d('0x29')](_0x421f9a)[_0x6e9d('0x2a')](_0x892610);}};}function respondWithFilteredResult(_0x43d09e,_0x1eec53){return function(_0x4b6421){if(_0x4b6421){var _0x24911f=_0x4b6421[_0x6e9d('0x2b')],_0x3dba1=_0x1eec53[_0x6e9d('0x2c')],_0x3cb52b=_0x1eec53[_0x6e9d('0x2c')]+_0x1eec53[_0x6e9d('0x2d')],_0x71c525;if(_0x3cb52b>=_0x24911f){_0x3cb52b=_0x24911f;_0x71c525=0xc8;}else{_0x71c525=0xce;}_0x43d09e[_0x6e9d('0x29')](_0x71c525);return _0x43d09e['set'](_0x6e9d('0x2e'),_0x3dba1+'-'+_0x3cb52b+'/'+_0x24911f)[_0x6e9d('0x2a')](_0x4b6421);}return null;};}function patchUpdates(_0x4624c3){return function(_0x21556a){try{jsonpatch[_0x6e9d('0x2f')](_0x21556a,_0x4624c3,!![]);}catch(_0x47292c){return BPromise['reject'](_0x47292c);}return _0x21556a[_0x6e9d('0x30')]();};}function saveUpdates(_0x37ce45,_0x2d68eb){return function(_0x2a6d6b){if(_0x2a6d6b){return _0x2a6d6b[_0x6e9d('0x31')](_0x37ce45)['then'](function(_0x3ce96e){return _0x3ce96e;});}return null;};}function removeEntity(_0x2857cd,_0x2d8b38){return function(_0x48d91a){if(_0x48d91a){return _0x48d91a[_0x6e9d('0x32')]()[_0x6e9d('0x1e')](function(){var _0x4f928a=_0x48d91a[_0x6e9d('0x33')]({'plain':!![]});var _0x266cde=_0x6e9d('0x34');return db[_0x6e9d('0x35')]['destroy']({'where':{'type':_0x266cde,'resourceId':_0x4f928a['id']}})[_0x6e9d('0x1e')](function(){return _0x48d91a;});})[_0x6e9d('0x1e')](function(){_0x2857cd['status'](0xcc)[_0x6e9d('0x36')]();});}};}function handleEntityNotFound(_0x132534,_0x4e4286){return function(_0x1b79ea){if(!_0x1b79ea){_0x132534[_0x6e9d('0x37')](0x194);}return _0x1b79ea;};}function handleError(_0x4c08be,_0x813028){_0x813028=_0x813028||0x1f4;return function(_0x39bd69){logger[_0x6e9d('0x25')](_0x39bd69[_0x6e9d('0x38')]);if(_0x39bd69[_0x6e9d('0x39')]){delete _0x39bd69['name'];}_0x4c08be[_0x6e9d('0x29')](_0x813028)[_0x6e9d('0x3a')](_0x39bd69);};}exports['index']=function(_0x2d1539,_0x280859){var _0x3ebdb1={},_0x549486={},_0x25f8bd={'count':0x0,'rows':[]};var _0x203484=db['ChatWebsite'][_0x6e9d('0x3b')];_0x549486['model']=_[_0x6e9d('0x3c')](_0x203484);var _0x30acb1={'dateStart':_0x2d1539[_0x6e9d('0x3d')]['dateStart'],'dateEnd':_0x2d1539[_0x6e9d('0x3d')][_0x6e9d('0x3e')]};delete _0x2d1539[_0x6e9d('0x3d')]['dateStart'];delete _0x2d1539[_0x6e9d('0x3d')]['dateEnd'];_0x549486[_0x6e9d('0x3d')]=_[_0x6e9d('0x3c')](_0x2d1539[_0x6e9d('0x3d')]);_0x549486[_0x6e9d('0x3f')]=_['intersection'](_0x549486[_0x6e9d('0x40')],_0x549486[_0x6e9d('0x3d')]);_0x3ebdb1[_0x6e9d('0x41')]=_[_0x6e9d('0x42')](_0x549486[_0x6e9d('0x40')],qs[_0x6e9d('0x43')](_0x2d1539[_0x6e9d('0x3d')]['fields']));_0x3ebdb1['attributes']=_0x3ebdb1['attributes']['length']?_0x3ebdb1[_0x6e9d('0x41')]:_0x549486['model'];if(!_0x2d1539[_0x6e9d('0x3d')][_0x6e9d('0x44')](_0x6e9d('0x45'))){_0x3ebdb1[_0x6e9d('0x2d')]=qs[_0x6e9d('0x2d')](_0x2d1539[_0x6e9d('0x3d')][_0x6e9d('0x2d')]);_0x3ebdb1[_0x6e9d('0x2c')]=qs['offset'](_0x2d1539[_0x6e9d('0x3d')][_0x6e9d('0x2c')]);}_0x3ebdb1[_0x6e9d('0x46')]=qs[_0x6e9d('0x47')](_0x2d1539[_0x6e9d('0x3d')]['sort']);_0x3ebdb1['where']=qs[_0x6e9d('0x3f')](_[_0x6e9d('0x48')](_0x2d1539[_0x6e9d('0x3d')],_0x549486[_0x6e9d('0x3f')]));if(_0x30acb1['dateStart']){if(_0x30acb1[_0x6e9d('0x3e')]){_0x30acb1[_0x6e9d('0x3e')]=moment(_0x30acb1[_0x6e9d('0x3e')])[_0x6e9d('0x49')](0x1,_0x6e9d('0x4a'));}else{_0x30acb1['dateEnd']=moment(_0x30acb1[_0x6e9d('0x4b')])['add'](0x1,'day');}_['merge'](_0x3ebdb1['where'],{'createdAt':{'$gte':_0x30acb1[_0x6e9d('0x4b')],'$lte':_0x30acb1[_0x6e9d('0x3e')]}});}if(_0x2d1539[_0x6e9d('0x3d')]['filter']){_0x3ebdb1[_0x6e9d('0x4c')]=_[_0x6e9d('0x4d')](_0x3ebdb1['where'],{'$or':_[_0x6e9d('0x4e')](_0x3ebdb1[_0x6e9d('0x41')],function(_0x8ae44d){var _0x25c60f={};_0x25c60f[_0x8ae44d]={'$like':'%'+_0x2d1539[_0x6e9d('0x3d')][_0x6e9d('0x4f')]+'%'};return _0x25c60f;})});}_0x3ebdb1=_[_0x6e9d('0x4d')]({},_0x3ebdb1,_0x2d1539[_0x6e9d('0x50')]);var _0x3977f8={'where':_0x3ebdb1[_0x6e9d('0x4c')]};return db['ChatWebsite'][_0x6e9d('0x2b')](_0x3977f8)['then'](function(_0x52142c){_0x25f8bd[_0x6e9d('0x2b')]=_0x52142c;if(_0x2d1539[_0x6e9d('0x3d')][_0x6e9d('0x51')]){_0x3ebdb1[_0x6e9d('0x52')]=[{'all':!![]}];}return db[_0x6e9d('0x53')][_0x6e9d('0x54')](_0x3ebdb1);})[_0x6e9d('0x1e')](function(_0x2e6f88){_0x25f8bd[_0x6e9d('0x55')]=_0x2e6f88;return _0x25f8bd;})[_0x6e9d('0x1e')](respondWithFilteredResult(_0x280859,_0x3ebdb1))[_0x6e9d('0x28')](handleError(_0x280859,null));};exports[_0x6e9d('0x56')]=function(_0x33c063,_0x336ab9){var _0x9409e2={'raw':![],'where':{'id':_0x33c063['params']['id']}},_0x1f8564={};_0x1f8564[_0x6e9d('0x40')]=_[_0x6e9d('0x3c')](db['ChatWebsite'][_0x6e9d('0x3b')]);_0x1f8564['query']=_[_0x6e9d('0x3c')](_0x33c063[_0x6e9d('0x3d')]);_0x1f8564[_0x6e9d('0x3f')]=_['intersection'](_0x1f8564['model'],_0x1f8564[_0x6e9d('0x3d')]);_0x9409e2[_0x6e9d('0x41')]=_[_0x6e9d('0x42')](_0x1f8564[_0x6e9d('0x40')],qs[_0x6e9d('0x43')](_0x33c063[_0x6e9d('0x3d')]['fields']));_0x9409e2['attributes']=_0x9409e2[_0x6e9d('0x41')]['length']?_0x9409e2[_0x6e9d('0x41')]:_0x1f8564['model'];if(_0x33c063['query']['includeAll']){_0x9409e2[_0x6e9d('0x52')]=[{'all':!![]}];}_0x9409e2=_[_0x6e9d('0x4d')]({},_0x9409e2,_0x33c063[_0x6e9d('0x50')]);return db['ChatWebsite'][_0x6e9d('0x57')](_0x9409e2)[_0x6e9d('0x1e')](handleEntityNotFound(_0x336ab9,null))['then'](respondWithResult(_0x336ab9,null))[_0x6e9d('0x28')](handleError(_0x336ab9,null));};exports[_0x6e9d('0x58')]=function(_0x5becd3,_0x5bbde6){return db['ChatWebsite']['create'](_0x5becd3[_0x6e9d('0x59')],{})[_0x6e9d('0x1e')](function(_0x2eb767){var _0x1c5109=_0x5becd3[_0x6e9d('0x5a')]['get']({'plain':!![]});if(!_0x1c5109)throw new Error(_0x6e9d('0x5b'));if(_0x1c5109[_0x6e9d('0x5c')]===_0x6e9d('0x5a')){var _0x114857=_0x2eb767[_0x6e9d('0x33')]({'plain':!![]});var _0x547e33=_0x6e9d('0x34');return db[_0x6e9d('0x5d')][_0x6e9d('0x57')]({'where':{'name':_0x547e33,'userProfileId':_0x1c5109['userProfileId']},'raw':!![]})[_0x6e9d('0x1e')](function(_0x19b26b){if(_0x19b26b&&_0x19b26b[_0x6e9d('0x5e')]===0x0){return db[_0x6e9d('0x35')][_0x6e9d('0x58')]({'name':_0x114857[_0x6e9d('0x39')],'resourceId':_0x114857['id'],'type':_0x19b26b[_0x6e9d('0x39')],'sectionId':_0x19b26b['id']},{})[_0x6e9d('0x1e')](function(){return _0x2eb767;});}else{return _0x2eb767;}})['catch'](function(_0x2779a3){logger['error'](_0x6e9d('0x5f'),_0x2779a3);throw _0x2779a3;});}return _0x2eb767;})['then'](respondWithResult(_0x5bbde6,0xc9))[_0x6e9d('0x28')](handleError(_0x5bbde6,null));};exports[_0x6e9d('0x31')]=function(_0x2cf001,_0x962127){if(_0x2cf001[_0x6e9d('0x59')]['id']){delete _0x2cf001[_0x6e9d('0x59')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x2cf001[_0x6e9d('0x60')]['id']}})['then'](handleEntityNotFound(_0x962127,null))['then'](saveUpdates(_0x2cf001[_0x6e9d('0x59')],null))['then'](respondWithResult(_0x962127,null))[_0x6e9d('0x28')](handleError(_0x962127,null));};exports[_0x6e9d('0x32')]=function(_0x4ea38b,_0x44975d){return db['ChatWebsite'][_0x6e9d('0x57')]({'where':{'id':_0x4ea38b[_0x6e9d('0x60')]['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x44975d,null))[_0x6e9d('0x1e')](removeEntity(_0x44975d,null))[_0x6e9d('0x28')](handleError(_0x44975d,null));};exports[_0x6e9d('0x61')]=function(_0x3a85ef,_0x5d2d48){return db[_0x6e9d('0x53')][_0x6e9d('0x61')]()[_0x6e9d('0x1e')](respondWithResult(_0x5d2d48,null))['catch'](handleError(_0x5d2d48,null));};exports['addDisposition']=function(_0x20bb54,_0x2ed2ff,_0x1ec84f){if(_0x20bb54[_0x6e9d('0x59')]['id']){delete _0x20bb54['body']['id'];}return db['ChatWebsite'][_0x6e9d('0x57')]({'where':{'id':_0x20bb54['params']['id']}})['then'](handleEntityNotFound(_0x2ed2ff,null))['then'](function(_0x5e2d21){if(_0x5e2d21){_0x20bb54['body']['ChatWebsiteId']=_0x5e2d21['id'];return db[_0x6e9d('0x62')][_0x6e9d('0x58')](_0x20bb54[_0x6e9d('0x59')]);}})[_0x6e9d('0x1e')](respondWithResult(_0x2ed2ff,null))[_0x6e9d('0x28')](handleError(_0x2ed2ff,null));};exports[_0x6e9d('0x63')]=function(_0x4f29f3,_0x2ba07f,_0x595d39){var _0x31b19a={'raw':![],'where':{}};var _0x367f7e={};var _0x194f58={'count':0x0,'rows':[]};return db[_0x6e9d('0x53')][_0x6e9d('0x64')]({'where':{'id':_0x4f29f3[_0x6e9d('0x60')]['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x2ba07f,null))['then'](function(_0x39969a){if(_0x39969a){_0x367f7e[_0x6e9d('0x40')]=_[_0x6e9d('0x3c')](db[_0x6e9d('0x62')]['rawAttributes']);_0x367f7e[_0x6e9d('0x3d')]=_[_0x6e9d('0x3c')](_0x4f29f3[_0x6e9d('0x3d')]);_0x367f7e[_0x6e9d('0x3f')]=_[_0x6e9d('0x42')](_0x367f7e[_0x6e9d('0x40')],_0x367f7e[_0x6e9d('0x3d')]);_0x31b19a[_0x6e9d('0x41')]=_[_0x6e9d('0x42')](_0x367f7e[_0x6e9d('0x40')],qs[_0x6e9d('0x43')](_0x4f29f3[_0x6e9d('0x3d')][_0x6e9d('0x43')]));_0x31b19a['attributes']=_0x31b19a[_0x6e9d('0x41')][_0x6e9d('0x65')]?_0x31b19a[_0x6e9d('0x41')]:_0x367f7e[_0x6e9d('0x40')];if(!_0x4f29f3['query'][_0x6e9d('0x44')](_0x6e9d('0x45'))){_0x31b19a[_0x6e9d('0x2d')]=qs[_0x6e9d('0x2d')](_0x4f29f3[_0x6e9d('0x3d')][_0x6e9d('0x2d')]);_0x31b19a[_0x6e9d('0x2c')]=qs[_0x6e9d('0x2c')](_0x4f29f3['query'][_0x6e9d('0x2c')]);}_0x31b19a['order']=qs['sort'](_0x4f29f3[_0x6e9d('0x3d')][_0x6e9d('0x47')]);_0x31b19a[_0x6e9d('0x4c')]=qs[_0x6e9d('0x3f')](_[_0x6e9d('0x48')](_0x4f29f3[_0x6e9d('0x3d')],_0x367f7e[_0x6e9d('0x3f')]));_0x31b19a[_0x6e9d('0x4c')][_0x6e9d('0x66')]=_0x39969a['id'];if(_0x4f29f3[_0x6e9d('0x3d')][_0x6e9d('0x4f')]){_0x31b19a['where']=_[_0x6e9d('0x4d')](_0x31b19a[_0x6e9d('0x4c')],{'$or':_[_0x6e9d('0x4e')](_0x31b19a[_0x6e9d('0x41')],function(_0x3a88e7){var _0x1c9953={};_0x1c9953[_0x3a88e7]={'$like':'%'+_0x4f29f3[_0x6e9d('0x3d')][_0x6e9d('0x4f')]+'%'};return _0x1c9953;})});}_0x31b19a=_[_0x6e9d('0x4d')]({},_0x31b19a,_0x4f29f3[_0x6e9d('0x50')]);return db[_0x6e9d('0x62')][_0x6e9d('0x2b')]({'where':_0x31b19a['where']})[_0x6e9d('0x1e')](function(_0x1e94ce){_0x194f58[_0x6e9d('0x2b')]=_0x1e94ce;if(_0x4f29f3[_0x6e9d('0x3d')][_0x6e9d('0x51')]){_0x31b19a['include']=[{'all':!![]}];}return db['Disposition'][_0x6e9d('0x54')](_0x31b19a);})['then'](function(_0xbe7f5b){_0x194f58['rows']=_0xbe7f5b;return _0x194f58;});}})['then'](respondWithFilteredResult(_0x2ba07f,_0x31b19a))[_0x6e9d('0x28')](handleError(_0x2ba07f,null));};exports['removeDispositions']=function(_0x5e6aff,_0x149915,_0x1c55e0){var _0x50e72a;return db['ChatWebsite'][_0x6e9d('0x57')]({'where':{'id':_0x5e6aff[_0x6e9d('0x60')]['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x149915,null))[_0x6e9d('0x1e')](function(_0x38f0b4){if(_0x38f0b4){return _0x38f0b4['removeDispositions'](_0x5e6aff[_0x6e9d('0x3d')][_0x6e9d('0x67')]);}})[_0x6e9d('0x1e')](respondWithStatusCode(_0x149915,null))[_0x6e9d('0x28')](handleError(_0x149915,null));};exports[_0x6e9d('0x68')]=function(_0x39ba51,_0x393370,_0x3f5740){if(_0x39ba51[_0x6e9d('0x59')]['id']){delete _0x39ba51[_0x6e9d('0x59')]['id'];}return db[_0x6e9d('0x53')]['find']({'where':{'id':_0x39ba51[_0x6e9d('0x60')]['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x393370,null))['then'](function(_0x489353){if(_0x489353){_0x39ba51[_0x6e9d('0x59')][_0x6e9d('0x66')]=_0x489353['id'];return db[_0x6e9d('0x69')][_0x6e9d('0x58')](_0x39ba51[_0x6e9d('0x59')]);}})[_0x6e9d('0x1e')](respondWithResult(_0x393370,null))[_0x6e9d('0x28')](handleError(_0x393370,null));};exports[_0x6e9d('0x6a')]=function(_0x2de5a1,_0x4234ed,_0x409567){var _0x242b33={'raw':![],'where':{}};var _0xc44d77={};var _0x213eda={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x2de5a1[_0x6e9d('0x60')]['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x4234ed,null))[_0x6e9d('0x1e')](function(_0x14a554){if(_0x14a554){_0xc44d77[_0x6e9d('0x40')]=_[_0x6e9d('0x3c')](db[_0x6e9d('0x69')]['rawAttributes']);_0xc44d77['query']=_['keys'](_0x2de5a1['query']);_0xc44d77[_0x6e9d('0x3f')]=_[_0x6e9d('0x42')](_0xc44d77[_0x6e9d('0x40')],_0xc44d77[_0x6e9d('0x3d')]);_0x242b33[_0x6e9d('0x41')]=_[_0x6e9d('0x42')](_0xc44d77[_0x6e9d('0x40')],qs[_0x6e9d('0x43')](_0x2de5a1[_0x6e9d('0x3d')]['fields']));_0x242b33['attributes']=_0x242b33['attributes']['length']?_0x242b33['attributes']:_0xc44d77[_0x6e9d('0x40')];if(!_0x2de5a1[_0x6e9d('0x3d')][_0x6e9d('0x44')](_0x6e9d('0x45'))){_0x242b33[_0x6e9d('0x2d')]=qs['limit'](_0x2de5a1[_0x6e9d('0x3d')][_0x6e9d('0x2d')]);_0x242b33[_0x6e9d('0x2c')]=qs[_0x6e9d('0x2c')](_0x2de5a1[_0x6e9d('0x3d')][_0x6e9d('0x2c')]);}_0x242b33[_0x6e9d('0x46')]=qs[_0x6e9d('0x47')](_0x2de5a1[_0x6e9d('0x3d')]['sort']);_0x242b33[_0x6e9d('0x4c')]=qs['filters'](_[_0x6e9d('0x48')](_0x2de5a1[_0x6e9d('0x3d')],_0xc44d77['filters']));_0x242b33[_0x6e9d('0x4c')][_0x6e9d('0x66')]=_0x14a554['id'];if(_0x2de5a1[_0x6e9d('0x3d')]['filter']){_0x242b33[_0x6e9d('0x4c')]=_[_0x6e9d('0x4d')](_0x242b33['where'],{'$or':_['map'](_0x242b33[_0x6e9d('0x41')],function(_0x29ae21){var _0x32e6c0={};_0x32e6c0[_0x29ae21]={'$like':'%'+_0x2de5a1['query'][_0x6e9d('0x4f')]+'%'};return _0x32e6c0;})});}_0x242b33=_[_0x6e9d('0x4d')]({},_0x242b33,_0x2de5a1[_0x6e9d('0x50')]);return db[_0x6e9d('0x69')]['count']({'where':_0x242b33['where']})['then'](function(_0x560aa1){_0x213eda['count']=_0x560aa1;if(_0x2de5a1[_0x6e9d('0x3d')]['includeAll']){_0x242b33[_0x6e9d('0x52')]=[{'all':!![]}];}return db[_0x6e9d('0x69')]['findAll'](_0x242b33);})['then'](function(_0x36ad72){_0x213eda[_0x6e9d('0x55')]=_0x36ad72;return _0x213eda;});}})[_0x6e9d('0x1e')](respondWithFilteredResult(_0x4234ed,_0x242b33))[_0x6e9d('0x28')](handleError(_0x4234ed,null));};exports[_0x6e9d('0x6b')]=function(_0x4607b6,_0x5446b2,_0x31d81a){var _0x3b6934;return db['ChatWebsite']['find']({'where':{'id':_0x4607b6['params']['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x5446b2,null))['then'](function(_0xf687c0){if(_0xf687c0){return _0xf687c0[_0x6e9d('0x6b')](_0x4607b6['query'][_0x6e9d('0x67')]);}})[_0x6e9d('0x1e')](respondWithStatusCode(_0x5446b2,null))[_0x6e9d('0x28')](handleError(_0x5446b2,null));};exports[_0x6e9d('0x6c')]=function(_0xbc3632,_0x4e4dcd,_0x124737){_0xbc3632[_0x6e9d('0x59')][_0x6e9d('0x6d')]=_0xbc3632['file'][_0x6e9d('0x6e')];return db[_0x6e9d('0x53')]['find']({'where':{'id':_0xbc3632['params']['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x4e4dcd,null))[_0x6e9d('0x1e')](saveUpdates(_0xbc3632[_0x6e9d('0x59')],null))[_0x6e9d('0x1e')](respondWithResult(_0x4e4dcd,null))[_0x6e9d('0x28')](handleError(_0x4e4dcd,null));};exports[_0x6e9d('0x6f')]=function(_0x3c7a86,_0x2575b1,_0x593895){_0x3c7a86[_0x6e9d('0x59')][_0x6e9d('0x70')]=_0x3c7a86[_0x6e9d('0x71')]['filename'];return db[_0x6e9d('0x53')][_0x6e9d('0x57')]({'where':{'id':_0x3c7a86[_0x6e9d('0x60')]['id']}})['then'](handleEntityNotFound(_0x2575b1,null))[_0x6e9d('0x1e')](saveUpdates(_0x3c7a86[_0x6e9d('0x59')],null))[_0x6e9d('0x1e')](respondWithResult(_0x2575b1,null))[_0x6e9d('0x28')](handleError(_0x2575b1,null));};exports[_0x6e9d('0x72')]=function(_0x587f63,_0x5cd30f,_0x49f9b1){_0x587f63['body'][_0x6e9d('0x73')]=_0x587f63['file'][_0x6e9d('0x6e')];return db[_0x6e9d('0x53')]['find']({'where':{'id':_0x587f63[_0x6e9d('0x60')]['id']}})['then'](handleEntityNotFound(_0x5cd30f,null))[_0x6e9d('0x1e')](saveUpdates(_0x587f63[_0x6e9d('0x59')],null))['then'](respondWithResult(_0x5cd30f,null))[_0x6e9d('0x28')](handleError(_0x5cd30f,null));};exports[_0x6e9d('0x74')]=function(_0x62f8a8,_0x49a592,_0x5021de){_0x62f8a8[_0x6e9d('0x59')][_0x6e9d('0x75')]=_0x62f8a8[_0x6e9d('0x71')]['filename'];return db['ChatWebsite'][_0x6e9d('0x57')]({'where':{'id':_0x62f8a8[_0x6e9d('0x60')]['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x49a592,null))['then'](saveUpdates(_0x62f8a8['body'],null))[_0x6e9d('0x1e')](respondWithResult(_0x49a592,null))[_0x6e9d('0x28')](handleError(_0x49a592,null));};exports['getLogo']=function(_0x4bbcd2,_0x24bb9f,_0x50da9d){var _0x4faed5=path[_0x6e9d('0x76')](config['root'],_0x6e9d('0x77'));var _0x5fed85={'where':{'id':_0x4bbcd2[_0x6e9d('0x60')]['id']},'attributes':['id',_0x6e9d('0x6d')],'raw':!![]};var _0x52e1ad=![];return require(_0x6e9d('0x78'))[_0x6e9d('0x79')]()[_0x6e9d('0x1e')](function(_0x39a195){if(_0x39a195){_0x52e1ad=_0x39a195[_0x6e9d('0x7a')];}})['then'](function(){return db['ChatWebsite'][_0x6e9d('0x57')](_0x5fed85);})[_0x6e9d('0x1e')](handleEntityNotFound(_0x24bb9f,null))[_0x6e9d('0x1e')](function(_0x59009b){if(_0x59009b){if(!_[_0x6e9d('0x7b')](_0x59009b['sitepic'])){if(fs[_0x6e9d('0x7c')](path[_0x6e9d('0x76')](config[_0x6e9d('0x7d')],'server/files/images/logos/',_0x59009b[_0x6e9d('0x6d')]))&&_0x52e1ad){_0x4faed5=path['join'](config[_0x6e9d('0x7d')],_0x6e9d('0x7e'),_0x59009b[_0x6e9d('0x6d')]);}}return _0x24bb9f[_0x6e9d('0x7f')](_0x4faed5);}})[_0x6e9d('0x28')](handleError(_0x24bb9f,null));};exports[_0x6e9d('0x80')]=function(_0x281387,_0x362fb1,_0x3223a6){var _0x48b050=path[_0x6e9d('0x76')](config[_0x6e9d('0x7d')],_0x6e9d('0x81'));var _0x51c844={'where':{'id':_0x281387[_0x6e9d('0x60')]['id']},'attributes':['id',_0x6e9d('0x70')],'raw':!![]};return db[_0x6e9d('0x53')][_0x6e9d('0x57')](_0x51c844)[_0x6e9d('0x1e')](handleEntityNotFound(_0x362fb1,null))[_0x6e9d('0x1e')](function(_0x38287f){if(_0x38287f){if(!_[_0x6e9d('0x7b')](_0x38287f['agentAvatar'])){if(fs[_0x6e9d('0x7c')](path[_0x6e9d('0x76')](config['root'],_0x6e9d('0x82'),_0x38287f[_0x6e9d('0x70')]))){_0x48b050=path[_0x6e9d('0x76')](config[_0x6e9d('0x7d')],_0x6e9d('0x82'),_0x38287f[_0x6e9d('0x70')]);}}return _0x362fb1[_0x6e9d('0x7f')](_0x48b050);}})[_0x6e9d('0x28')](handleError(_0x362fb1,null));};exports[_0x6e9d('0x83')]=function(_0x176350,_0x556af8,_0x27b93f){var _0x4a7d4f=path[_0x6e9d('0x76')](config['root'],_0x6e9d('0x84'));var _0x3614e1={'where':{'id':_0x176350['params']['id']},'attributes':['id','customerAvatar',_0x6e9d('0x85')],'raw':!![]};return db[_0x6e9d('0x53')][_0x6e9d('0x57')](_0x3614e1)[_0x6e9d('0x1e')](handleEntityNotFound(_0x556af8,null))['then'](function(_0x20eb36){if(_0x20eb36){if(!_['isNil'](_0x20eb36[_0x6e9d('0x73')])){if(fs[_0x6e9d('0x7c')](path[_0x6e9d('0x76')](config[_0x6e9d('0x7d')],_0x6e9d('0x82'),_0x20eb36[_0x6e9d('0x73')]))&&_0x20eb36[_0x6e9d('0x85')]){_0x4a7d4f=path['join'](config['root'],'server/files/images/avatars/',_0x20eb36['customerAvatar']);}}return _0x556af8[_0x6e9d('0x7f')](_0x4a7d4f);}})[_0x6e9d('0x28')](handleError(_0x556af8,null));};exports[_0x6e9d('0x86')]=function(_0x450951,_0x36af9b,_0x38c1d5){var _0xf4bdea=path[_0x6e9d('0x76')](config[_0x6e9d('0x7d')],'server/files/images/avatars/system_avatar.png');var _0x5da83d={'where':{'id':_0x450951['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x5da83d)['then'](handleEntityNotFound(_0x36af9b,null))[_0x6e9d('0x1e')](function(_0x5add06){if(_0x5add06){if(!_[_0x6e9d('0x7b')](_0x5add06[_0x6e9d('0x75')])){if(fs[_0x6e9d('0x7c')](path[_0x6e9d('0x76')](config[_0x6e9d('0x7d')],_0x6e9d('0x82'),_0x5add06['systemAvatar']))){_0xf4bdea=path[_0x6e9d('0x76')](config[_0x6e9d('0x7d')],_0x6e9d('0x82'),_0x5add06['systemAvatar']);}}return _0x36af9b[_0x6e9d('0x7f')](_0xf4bdea);}})[_0x6e9d('0x28')](handleError(_0x36af9b,null));};exports[_0x6e9d('0x87')]=function(_0x3106be,_0x3303f3,_0x3eccd7){var _0x41ef30=require(_0x6e9d('0x88'));var _0x3da9e1=new _0x41ef30();var _0x592f90=_0x3da9e1[_0x6e9d('0x89')](_0x3106be['headers'][_0x6e9d('0x8a')])[_0x6e9d('0x8b')]();var _0x2cad43={'body':_0x3106be[_0x6e9d('0x59')],'channel':'chat'};var _0x1586df=[];var _0x1355e7=[];var _0x2a7782={};var _0x1c0c37=![];return db[_0x6e9d('0x8c')][_0x6e9d('0x61')]()['then'](function(_0x11e917){if(!_0x11e917){throw new db[(_0x6e9d('0x8d'))][(_0x6e9d('0x8e'))](_0x6e9d('0x8f'));}_0x1586df=_['difference'](_[_0x6e9d('0x3c')](_0x11e917),[_0x6e9d('0x90'),_0x6e9d('0x91')]);_0x1355e7=_[_0x6e9d('0x92')](_[_0x6e9d('0x3c')](_0x11e917),[_0x6e9d('0x90'),_0x6e9d('0x91'),'CompanyId',_0x6e9d('0x93')]);if(_0x3106be[_0x6e9d('0x59')]['id']){delete _0x3106be[_0x6e9d('0x59')]['id'];}if(_[_0x6e9d('0x7b')](_0x3106be[_0x6e9d('0x59')][_0x6e9d('0x94')])){throw new db[(_0x6e9d('0x8d'))][(_0x6e9d('0x8e'))](_0x6e9d('0x95'));}if(_[_0x6e9d('0x7b')](_0x3106be[_0x6e9d('0x59')][_0x6e9d('0x59')])||_0x3106be['body']['body']===''){throw new db[(_0x6e9d('0x8d'))]['ValidationError'](_0x6e9d('0x96'));}if(_[_0x6e9d('0x7b')](_0x3106be[_0x6e9d('0x59')][_0x6e9d('0x97')])){throw new db[(_0x6e9d('0x8d'))][(_0x6e9d('0x8e'))](_0x6e9d('0x98')+_0x1355e7);}if(!_['includes'](_0x1355e7,_0x3106be['body'][_0x6e9d('0x97')])){throw new db[(_0x6e9d('0x8d'))][(_0x6e9d('0x8e'))](_0x6e9d('0x99')+_0x1355e7);}_0x2a7782[_0x3106be[_0x6e9d('0x59')]['mapKey']]=_0x3106be[_0x6e9d('0x59')][_0x6e9d('0x94')];})[_0x6e9d('0x1e')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x3106be['params']['id']},'include':[{'model':db[_0x6e9d('0x9a')],'as':_0x6e9d('0x9b'),'include':[{'model':db[_0x6e9d('0x8c')],'as':_0x6e9d('0x9c'),'where':_0x2a7782,'limit':0x1,'order':[[_0x6e9d('0x91'),_0x6e9d('0x9d')]]}]},{'model':db[_0x6e9d('0x9e')],'as':_0x6e9d('0x9f')}]});})[_0x6e9d('0x1e')](handleEntityNotFound(_0x3303f3,null))[_0x6e9d('0x1e')](function(_0x2b8a42){if(_0x2b8a42&&_0x2b8a42[_0x6e9d('0x9b')]){_0x2cad43[_0x6e9d('0xa0')]=_0x2b8a42;_0x2cad43['applications']=_0x2b8a42[_0x6e9d('0x9f')];_0x2cad43[_0x6e9d('0xa1')]=_0x2b8a42[_0x6e9d('0x9b')];_0x2cad43[_0x6e9d('0xa2')]=_[_0x6e9d('0xa3')](_0x2cad43[_0x6e9d('0xa2')],[_0x6e9d('0xa4')],[_0x6e9d('0xa5')]);if(_0x2cad43['account'][_0x6e9d('0x9f')]){delete _0x2cad43[_0x6e9d('0xa0')]['Applications'];}if(_0x2cad43['account'][_0x6e9d('0x9b')]&&_0x2cad43[_0x6e9d('0xa0')][_0x6e9d('0x9b')]['Contacts']['length']){return _0x2cad43[_0x6e9d('0xa0')]['List'][_0x6e9d('0x9c')][0x0];}var _0x2866dc=_[_0x6e9d('0x17')](_0x3106be[_0x6e9d('0x59')],{'firstName':_0x3106be['body'][_0x6e9d('0x94')],'ListId':_0x2b8a42[_0x6e9d('0x93')]});_0x2866dc[_0x3106be[_0x6e9d('0x59')][_0x6e9d('0x97')]]=_0x3106be[_0x6e9d('0x59')][_0x6e9d('0x94')];return db[_0x6e9d('0x8c')]['create'](_0x2866dc,{'fields':_0x1586df,'raw':!![]});}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x3303f3,null))['then'](function(_0x393eb9){_0x2cad43[_0x6e9d('0xa6')]=_0x393eb9;if(_0x393eb9){var _0x579553={'ContactId':_0x393eb9['id'],'ChatWebsiteId':_0x3106be[_0x6e9d('0x60')]['id'],'from':(_0x393eb9[_0x6e9d('0xa7')]||'')+'\x20'+(_0x393eb9[_0x6e9d('0xa8')]||''),'customerIp':_0x3106be['body'][_0x6e9d('0xa9')],'referer':_0x3106be[_0x6e9d('0x59')][_0x6e9d('0xaa')],'browserName':_0x592f90['browser'][_0x6e9d('0x39')]&&_0x592f90[_0x6e9d('0xab')][_0x6e9d('0xac')]?util[_0x6e9d('0xad')](_0x6e9d('0xae'),_0x592f90[_0x6e9d('0xab')]['name'],_0x592f90['browser']['version']):_0x6e9d('0xaf'),'browserVersion':_0x592f90[_0x6e9d('0xab')][_0x6e9d('0xac')]||_0x6e9d('0xaf'),'osName':util[_0x6e9d('0xad')](_0x6e9d('0xae'),_0x592f90['os'][_0x6e9d('0x39')],_0x592f90['os']['version']),'osVersion':_0x592f90['os'][_0x6e9d('0xac')],'deviceModel':_0x592f90['device'][_0x6e9d('0x40')]&&_0x592f90['device'][_0x6e9d('0xb0')]?util[_0x6e9d('0xad')]('%s\x20%s\x20%s',_0x592f90[_0x6e9d('0xb1')][_0x6e9d('0x40')],_0x592f90[_0x6e9d('0xb1')][_0x6e9d('0xb0')],_0x592f90['device'][_0x6e9d('0xb2')]):null,'deviceVendor':_0x592f90[_0x6e9d('0xb1')][_0x6e9d('0xb0')],'deviceType':_0x592f90[_0x6e9d('0xb1')][_0x6e9d('0xb2')],'formData':JSON['stringify'](_0x3106be[_0x6e9d('0x59')])};var _0x5f0e4b={'ChatWebsiteId':_0x3106be[_0x6e9d('0x60')]['id'],'closed':![]};if(_0x3106be[_0x6e9d('0x59')][_0x6e9d('0xb3')]){_0x5f0e4b['threadId']=_0x3106be['body'][_0x6e9d('0xb3')];return db[_0x6e9d('0xb4')][_0x6e9d('0x57')]({'where':_0x5f0e4b})[_0x6e9d('0x1e')](function(_0x8e0dc5){if(_0x8e0dc5){return[_0x8e0dc5,![]];}_0x579553['threadId']=_0x3106be[_0x6e9d('0x59')][_0x6e9d('0xb3')];_0x579553['externalUrl']=_0x3106be[_0x6e9d('0x59')]['externalUrl'];return db[_0x6e9d('0xb4')][_0x6e9d('0x58')](_0x579553)[_0x6e9d('0x1e')](function(_0x55ac90){return[_0x55ac90,!![]];});});}_0x5f0e4b['ContactId']=_0x393eb9['id'];if(_0x3106be[_0x6e9d('0x59')][_0x6e9d('0xb5')]&&_0x3106be[_0x6e9d('0x59')][_0x6e9d('0xb5')]['id']){_0x5f0e4b['id']=_0x3106be[_0x6e9d('0x59')][_0x6e9d('0xb5')]['id'];return db[_0x6e9d('0xb4')]['find']({'where':_0x5f0e4b})['then'](function(_0x1923b3){if(_0x1923b3){return[_0x1923b3,![]];}return db[_0x6e9d('0xb4')][_0x6e9d('0x58')](_0x579553)['then'](function(_0x5396bd){return[_0x5396bd,!![]];});});}return db[_0x6e9d('0xb4')][_0x6e9d('0x58')](_0x579553)[_0x6e9d('0x1e')](function(_0x38931d){return[_0x38931d,!![]];});}})[_0x6e9d('0xb6')](function(_0x43cb8b,_0x28ad25){if(_0x43cb8b){_0x1c0c37=_0x28ad25;if(!_0x28ad25){var _0x222540={'from':(_0x2cad43[_0x6e9d('0xa6')][_0x6e9d('0xa7')]||'')+'\x20'+(_0x2cad43[_0x6e9d('0xa6')][_0x6e9d('0xa8')]||'')};if(_0x3106be['body'][_0x6e9d('0xb3')]&&_0x3106be[_0x6e9d('0x59')][_0x6e9d('0xb7')]&&_0x3106be['body'][_0x6e9d('0xb3')]!=_0x3106be[_0x6e9d('0x59')][_0x6e9d('0xb7')]){_0x222540[_0x6e9d('0xb3')]=_0x3106be[_0x6e9d('0x59')][_0x6e9d('0xb7')];}return _0x43cb8b['update'](_0x222540);}else{return _0x43cb8b;}}})[_0x6e9d('0x1e')](function(_0x2badd8){_0x2cad43[_0x6e9d('0xb5')]=_0x2badd8[_0x6e9d('0x33')]({'plain':!![]});_0x2cad43[_0x6e9d('0xb5')][_0x6e9d('0xb8')]=_0x1c0c37;if(_0x2cad43['interaction'][_0x6e9d('0xb8')]){if(_0x2cad43['account'][_0x6e9d('0xb9')]){_0x2cad43[_0x6e9d('0xa2')][_0x6e9d('0xba')]({'id':0x0,'priority':_0x2cad43[_0x6e9d('0xa2')][_0x6e9d('0x65')]+0x1,'app':'close','appdata':_0x6e9d('0xbb'),'interval':_0x6e9d('0xbc')});}}return db[_0x6e9d('0xbd')][_0x6e9d('0x58')]({'body':_0x3106be['body'][_0x6e9d('0x59')],'ChatWebsiteId':_0x3106be['params']['id'],'ChatInteractionId':_0x2badd8['id'],'direction':'in','ContactId':_0x2cad43[_0x6e9d('0xa6')]['id'],'AttachmentId':_0x3106be[_0x6e9d('0x59')][_0x6e9d('0xbe')]});})[_0x6e9d('0x1e')](function(_0x4d9424){_0x2cad43[_0x6e9d('0x26')]=_0x4d9424;if(_0x2cad43[_0x6e9d('0xb5')][_0x6e9d('0xbf')]){return db[_0x6e9d('0xc0')][_0x6e9d('0x57')]({'attributes':['id',_0x6e9d('0x39')],'where':{'id':_0x2cad43[_0x6e9d('0xb5')][_0x6e9d('0xbf')]}})[_0x6e9d('0x1e')](function(_0x48a86f){if(_0x48a86f){_0x2cad43['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x6e9d('0xc1'),'appdata':_0x48a86f[_0x6e9d('0x39')]+','+(_0x2cad43[_0x6e9d('0xa0')][_0x6e9d('0xc2')]||0xa),'interval':'*,*,*,*'});_0x2cad43[_0x6e9d('0xc3')]=!![];}return respondWithRpcPromise(_0x6e9d('0xc4'),_0x6e9d('0xc5'),_0x2cad43);});}return respondWithRpcPromise(_0x6e9d('0xc4'),_0x6e9d('0xc5'),_0x2cad43);})[_0x6e9d('0x1e')](function(_0x11e387){respondWithRpcPromise(_0x6e9d('0xc6'),_0x6e9d('0xc6'),{'event':_0x6e9d('0x87'),'message':_0x11e387},client9002);return _0x11e387;})[_0x6e9d('0x1e')](respondWithResult(_0x3303f3,null))[_0x6e9d('0x28')](handleError(_0x3303f3,null));};exports[_0x6e9d('0xc7')]=function(_0x453551,_0x275458,_0x386dbc){var _0x625cef,_0x5a7795,_0x27600c;var _0x12a33d=[];var _0x23c676=[];var _0x2f085a={};return db[_0x6e9d('0x8c')][_0x6e9d('0x61')]()[_0x6e9d('0x1e')](function(_0x3af9f3){if(!_0x3af9f3){throw new db[(_0x6e9d('0x8d'))][(_0x6e9d('0x8e'))](_0x6e9d('0x8f'));}_0x23c676=_[_0x6e9d('0x92')](_[_0x6e9d('0x3c')](_0x3af9f3),[_0x6e9d('0x90'),_0x6e9d('0x91')]);_0x12a33d=_[_0x6e9d('0x92')](_['keys'](_0x3af9f3),['createdAt',_0x6e9d('0x91'),_0x6e9d('0xc8'),_0x6e9d('0x93')]);if(_0x453551[_0x6e9d('0x59')]['id']){delete _0x453551[_0x6e9d('0x59')]['id'];}if(_[_0x6e9d('0x7b')](_0x453551['body'][_0x6e9d('0x94')])){throw _0x275458[_0x6e9d('0x29')](0x1f4)[_0x6e9d('0x3a')](new db['Sequelize'][(_0x6e9d('0x8e'))]('from\x20is\x20mandatory'));}if(_[_0x6e9d('0x7b')](_0x453551[_0x6e9d('0x59')]['body'])||_0x453551[_0x6e9d('0x59')][_0x6e9d('0x59')]===''){throw _0x275458[_0x6e9d('0x29')](0x1f4)['send'](new db[(_0x6e9d('0x8d'))][(_0x6e9d('0x8e'))](_0x6e9d('0x96')));}if(_[_0x6e9d('0x7b')](_0x453551['body'][_0x6e9d('0xc9')])){throw _0x275458['status'](0x1f4)[_0x6e9d('0x3a')](new db[(_0x6e9d('0x8d'))][(_0x6e9d('0x8e'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12a33d));}if(!_[_0x6e9d('0xca')](_0x12a33d,_0x453551[_0x6e9d('0x59')]['mapKeyOffline'])){throw _0x275458[_0x6e9d('0x29')](0x1f4)[_0x6e9d('0x3a')](new db[(_0x6e9d('0x8d'))][(_0x6e9d('0x8e'))](_0x6e9d('0xcb')+_0x12a33d));}_0x2f085a[_0x453551[_0x6e9d('0x59')][_0x6e9d('0xc9')]]=_0x453551[_0x6e9d('0x59')][_0x6e9d('0x94')];})[_0x6e9d('0x1e')](function(){return db[_0x6e9d('0x53')][_0x6e9d('0x57')]({'where':{'id':_0x453551[_0x6e9d('0x60')]['id']},'include':[{'model':db[_0x6e9d('0x9a')],'as':_0x6e9d('0x9b')}]});})[_0x6e9d('0x1e')](handleEntityNotFound(_0x275458,null))['then'](function(_0x6a3492){if(_0x6a3492&&_0x6a3492['List']){_0x5a7795=_0x6a3492;var _0x143d55=_[_0x6e9d('0x17')](_0x453551[_0x6e9d('0x59')],{'firstName':_0x453551[_0x6e9d('0x59')][_0x6e9d('0x94')],'phone':_0x453551['body'][_0x6e9d('0x94')],'ListId':_0x6a3492[_0x6e9d('0x93')]});_0x143d55[_0x453551['body']['mapKeyOffline']]=_0x453551[_0x6e9d('0x59')][_0x6e9d('0x94')];return db[_0x6e9d('0x8c')][_0x6e9d('0xcc')]({'where':_0x2f085a,'defaults':_0x143d55});}})[_0x6e9d('0xb6')](function(_0x2db530){if(_0x2db530){_0x27600c=_0x2db530;var _0x537dd7=fs[_0x6e9d('0xcd')](path['join'](config['root'],_0x6e9d('0xce')),_0x6e9d('0xcf'));var _0x2657fc=ejs['render'](_0x537dd7,{'body':_[_0x6e9d('0xd0')](_0x453551[_0x6e9d('0x59')][_0x6e9d('0x59')]),'bodyTitle':_0x5a7795['offlineMessageBody']});return db[_0x6e9d('0xd1')]['create']({'body':_0x2657fc,'ContactId':_0x2db530['id'],'ChatWebsiteId':_0x5a7795['id']});}})[_0x6e9d('0x1e')](function(_0x3319b8){if(_0x3319b8){_0x625cef=_0x3319b8;return db[_0x6e9d('0xd2')][_0x6e9d('0x64')]({'where':{'service':!![]},'include':[{'model':db[_0x6e9d('0xd3')],'as':_0x6e9d('0xd4'),'raw':!![]}]});}})[_0x6e9d('0x1e')](function(_0x441273){if(_0x441273&&_0x441273[_0x6e9d('0xd4')]&&_0x5a7795[_0x6e9d('0xd5')]){var _0x54bf24={'tls':{'rejectUnauthorized':![]}};if(_0x441273[_0x6e9d('0xd4')][_0x6e9d('0xd6')]){_0x54bf24['service']=_0x441273['Smtp'][_0x6e9d('0xd6')];}else{_0x54bf24['host']=_0x441273[_0x6e9d('0xd4')][_0x6e9d('0xd7')];_0x54bf24['port']=_0x441273[_0x6e9d('0xd4')]['port'];_0x54bf24[_0x6e9d('0xd8')]=_0x441273[_0x6e9d('0xd4')][_0x6e9d('0xd8')];}if(_0x441273[_0x6e9d('0xd4')][_0x6e9d('0xd9')]){_0x54bf24['auth']={'user':_0x441273[_0x6e9d('0xd4')][_0x6e9d('0x5a')],'pass':_0x441273[_0x6e9d('0xd4')][_0x6e9d('0xda')]};}return respondWithRpcPromise(_0x6e9d('0xdb'),_0x6e9d('0xdc'),{'account':_0x54bf24,'message':{'from':util[_0x6e9d('0xad')](_0x6e9d('0xdd'),_0x441273[_0x6e9d('0x39')],_0x441273[_0x6e9d('0xde')]||_0x441273[_0x6e9d('0xd4')]['user']),'to':_0x5a7795['forwardOfflineAddress'],'subject':_0x5a7795[_0x6e9d('0xdf')],'text':_0x625cef['body']}},client9003)[_0x6e9d('0x1e')](function(){return _0x625cef;})[_0x6e9d('0x28')](function(_0x231dcd){console[_0x6e9d('0x25')](_0x231dcd);});}})['then'](function(){if(_0x625cef){return _0x625cef;}})[_0x6e9d('0x1e')](respondWithResult(_0x275458,null))[_0x6e9d('0x28')](handleError(_0x275458,null));};exports['addInteraction']=function(_0x5a606c,_0x449bed,_0x59021b){return db['ChatInteraction'][_0x6e9d('0x57')]({'where':{'id':_0x5a606c['params']['id']}})['then'](handleEntityNotFound(_0x449bed,null))['then'](function(_0x17d2d1){if(_0x17d2d1){return _0x17d2d1['addInteraction'](_0x5a606c[_0x6e9d('0x59')][_0x6e9d('0x67')],_[_0x6e9d('0xe0')](_0x5a606c[_0x6e9d('0x59')],[_0x6e9d('0x67'),'id'])||{});}})[_0x6e9d('0x1e')](respondWithResult(_0x449bed,null))[_0x6e9d('0x28')](handleError(_0x449bed,null));};exports[_0x6e9d('0xe1')]=function(_0x5b615c,_0xdc36d0,_0x2922f3){var _0x28be58={'raw':![],'where':{}};var _0x57d42e={};var _0x42752b={'count':0x0,'rows':[]};return db[_0x6e9d('0x53')][_0x6e9d('0x64')]({'where':{'id':_0x5b615c[_0x6e9d('0x60')]['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0xdc36d0,null))[_0x6e9d('0x1e')](function(_0x53b17c){if(_0x53b17c){_0x57d42e[_0x6e9d('0x40')]=_[_0x6e9d('0x3c')](db[_0x6e9d('0xb4')][_0x6e9d('0x3b')]);_0x57d42e['query']=_['keys'](_0x5b615c[_0x6e9d('0x3d')]);_0x57d42e[_0x6e9d('0x3f')]=_['intersection'](_0x57d42e[_0x6e9d('0x40')],_0x57d42e[_0x6e9d('0x3d')]);_0x28be58['attributes']=_[_0x6e9d('0x42')](_0x57d42e[_0x6e9d('0x40')],qs[_0x6e9d('0x43')](_0x5b615c[_0x6e9d('0x3d')][_0x6e9d('0x43')]));_0x28be58['attributes']=_0x28be58[_0x6e9d('0x41')][_0x6e9d('0x65')]?_0x28be58['attributes']:_0x57d42e[_0x6e9d('0x40')];if(!_0x5b615c[_0x6e9d('0x3d')][_0x6e9d('0x44')](_0x6e9d('0x45'))){_0x28be58['limit']=qs[_0x6e9d('0x2d')](_0x5b615c[_0x6e9d('0x3d')]['limit']);_0x28be58[_0x6e9d('0x2c')]=qs[_0x6e9d('0x2c')](_0x5b615c['query']['offset']);}_0x28be58['order']=qs[_0x6e9d('0x47')](_0x5b615c['query'][_0x6e9d('0x47')]);_0x28be58['where']=qs[_0x6e9d('0x3f')](_[_0x6e9d('0x48')](_0x5b615c[_0x6e9d('0x3d')],_0x57d42e['filters']));_0x28be58['where']['ChatWebsiteId']=_0x53b17c['id'];if(_0x5b615c['query'][_0x6e9d('0x4f')]){_0x28be58[_0x6e9d('0x4c')]=_[_0x6e9d('0x4d')](_0x28be58[_0x6e9d('0x4c')],{'$or':_[_0x6e9d('0x4e')](_0x28be58[_0x6e9d('0x41')],function(_0x2860e3){var _0x328c64={};_0x328c64[_0x2860e3]={'$like':'%'+_0x5b615c[_0x6e9d('0x3d')][_0x6e9d('0x4f')]+'%'};return _0x328c64;})});}_0x28be58=_[_0x6e9d('0x4d')]({},_0x28be58,_0x5b615c[_0x6e9d('0x50')]);return db['ChatInteraction'][_0x6e9d('0x2b')]({'where':_0x28be58[_0x6e9d('0x4c')]})[_0x6e9d('0x1e')](function(_0x1e6e03){_0x42752b['count']=_0x1e6e03;if(_0x5b615c[_0x6e9d('0x3d')]['includeAll']){_0x28be58['include']=[{'model':db[_0x6e9d('0x8c')],'as':'Contact','required':![]},{'model':db[_0x6e9d('0xc0')],'as':_0x6e9d('0xe2'),'attributes':[_0x6e9d('0x39'),_0x6e9d('0xe3'),_0x6e9d('0xe4')],'required':![]},{'model':db[_0x6e9d('0xe5')],'as':_0x6e9d('0xe6'),'attributes':['id',_0x6e9d('0x39'),_0x6e9d('0xe7')],'where':_0x5b615c[_0x6e9d('0x3d')][_0x6e9d('0xe8')]?{'id':_0x5b615c['query'][_0x6e9d('0xe8')]}:undefined,'required':_0x5b615c[_0x6e9d('0x3d')][_0x6e9d('0xe8')]?!![]:![]}];}return db[_0x6e9d('0xb4')][_0x6e9d('0x54')](_0x28be58);})[_0x6e9d('0x1e')](function(_0x483199){_0x42752b[_0x6e9d('0x55')]=_0x483199;return _0x42752b;});}})['then'](respondWithFilteredResult(_0xdc36d0,_0x28be58))[_0x6e9d('0x28')](handleError(_0xdc36d0,null));};function iftimePromise(_0x4c9cd2,_0xa8e1aa){return respondWithRpcPromise(_0x6e9d('0xe9'),_0x6e9d('0xea'),{'command':_0xa8e1aa[_0x6e9d('0xeb')]?util[_0x6e9d('0xad')](_0x6e9d('0xec'),_0x4c9cd2['interval'],_0xa8e1aa[_0x6e9d('0xeb')]):util[_0x6e9d('0xad')](_0x6e9d('0xed'),_0x4c9cd2[_0x6e9d('0xee')])},client9002)[_0x6e9d('0x1e')](function(_0x1a80ad){var _0x5c904d=_0x1a80ad&&_0x1a80ad[_0x6e9d('0xef')](_0x6e9d('0xf0'))>=0x0?!![]:![];logger[_0x6e9d('0x1f')](_0x6e9d('0xf1'),_0xa8e1aa['id'],_0x4c9cd2['id'],_0x4c9cd2[_0x6e9d('0xee')],_0x5c904d?_0x6e9d('0xf2'):'OFFLINE',_0xa8e1aa[_0x6e9d('0xeb')]?_0xa8e1aa['timezone']:_0x6e9d('0xf3'));return _0x5c904d;})['catch'](function(_0x2fdefc){logger[_0x6e9d('0x25')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xa8e1aa['id'],_0x4c9cd2['id'],_0x4c9cd2['interval'],util['inspect'](_0x2fdefc,{'showHidden':![],'depth':null}),_0xa8e1aa[_0x6e9d('0xeb')]?_0xa8e1aa['timezone']:_0x6e9d('0xf3'));return![];});}exports[_0x6e9d('0xea')]=function(_0x4b02ed,_0x29fe9d,_0x3ebf2b){var _0x3002bb=0x0;var _0x639bff=0x0;var _0x3dcfd1=![];var _0x567d3e;var _0x457ce8;return db[_0x6e9d('0x53')]['find']({'where':{'id':_0x4b02ed[_0x6e9d('0x60')]['id']},'include':[{'model':db[_0x6e9d('0xf4')],'as':_0x6e9d('0xf4'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x29fe9d,null))[_0x6e9d('0x1e')](function(_0x1dfb22){if(_0x1dfb22){_0x567d3e=_0x1dfb22;return _0x1dfb22[_0x6e9d('0xf5')]({'raw':!![]});}})[_0x6e9d('0x1e')](function(_0x2e1c94){if(_0x567d3e){if(_0x2e1c94){_0x457ce8=_0x2e1c94;}}return require(_0x6e9d('0x78'))['getLicense']();})[_0x6e9d('0x1e')](function(_0x28a154){if(_0x28a154){_0x639bff=_0x28a154['virtual'];_0x3dcfd1=_0x28a154[_0x6e9d('0x7a')];}})[_0x6e9d('0x1e')](function(){return db['ChatInteraction'][_0x6e9d('0x2b')]({'where':{'closed':![]}});})['then'](function(_0x15e9d9){_0x3002bb=_0x15e9d9;if(_0x639bff&&_0x15e9d9>_0x639bff){return db[_0x6e9d('0xf6')][_0x6e9d('0x64')]({'where':{'id':0x1}})[_0x6e9d('0x1e')](function(_0x533875){if(_0x533875){_0x533875['increment'](_0x6e9d('0xf7'));}});}})['then'](function(){if(_0x567d3e['Interval']&&_0x567d3e['Interval'][_0x6e9d('0xf8')]){var _0x484b3e=[];for(var _0x164266=0x0;_0x164266<_0x567d3e[_0x6e9d('0xf4')][_0x6e9d('0xf8')][_0x6e9d('0x65')];_0x164266++){var _0x4dcf26=_0x567d3e[_0x6e9d('0xf4')]['Intervals'][_0x164266]['get']({'plain':!![]});_0x484b3e['push'](iftimePromise(_0x4dcf26,_0x567d3e));}return BPromise['all'](_0x484b3e)[_0x6e9d('0x1e')](function(_0x383c9e){return _[_0x6e9d('0xf9')](_0x383c9e);});}else{return!![];}})['then'](function(_0xae0552){var _0x30d1b1=fs[_0x6e9d('0xcd')](path[_0x6e9d('0x76')](config[_0x6e9d('0x7d')],_0x6e9d('0xfa')),_0x6e9d('0xcf'));var _0x3c120f={'remote':_0x567d3e['remote'],'query':querystring[_0x6e9d('0x24')](_[_0x6e9d('0x4d')](_0x567d3e['get']({'plain':!![]}),{'customerIp':_0x4b02ed[_0x6e9d('0xfb')][_0x6e9d('0xfc')]||_0x4b02ed[_0x6e9d('0xfb')][_0x6e9d('0xfd')]||_0x4b02ed[_0x6e9d('0xfe')][_0x6e9d('0xff')]||_0x4b02ed['ip'],'referer':_0x4b02ed['headers'][_0x6e9d('0xaa')],'openedInteractions':_0x3002bb,'maxInteractions':_0x639bff,'virtual':_0x3dcfd1[_0x6e9d('0x100')],'online':_0xae0552,'custom':_0x3dcfd1}))[_0x6e9d('0x101')](/'/g,'\x5c\x27')};_0x29fe9d[_0x6e9d('0x3a')](ejs[_0x6e9d('0x102')](Mustache['render'](_0x30d1b1,_0x3c120f),{'proactiveActions':_0x457ce8,'alignment':_0x567d3e[_0x6e9d('0x103')],'verticalAlignment':_0x567d3e[_0x6e9d('0x104')]}));})[_0x6e9d('0x28')](handleError(_0x29fe9d,null));};exports[_0x6e9d('0x105')]=function(_0x2e8685,_0x105579,_0x141cf8){return db[_0x6e9d('0x53')][_0x6e9d('0x64')]({'where':{'id':_0x2e8685['params']['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x105579,null))[_0x6e9d('0x1e')](function(_0x29e6b5){if(_0x29e6b5){return db['sequelize'][_0x6e9d('0x106')](function(_0xd0b616){return db[_0x6e9d('0x9e')][_0x6e9d('0x32')]({'where':{'ChatWebsiteId':_0x2e8685[_0x6e9d('0x60')]['id']},'transaction':_0xd0b616})[_0x6e9d('0x1e')](function(_0x483b48){var _0x245913=_[_0x6e9d('0x4e')](_0x2e8685[_0x6e9d('0x59')],function(_0x4a5596){_0x4a5596[_0x6e9d('0x66')]=_0x2e8685[_0x6e9d('0x60')]['id'];return _0x4a5596;});return db[_0x6e9d('0x9e')]['bulkCreate'](_0x245913,{'transaction':_0xd0b616});});})[_0x6e9d('0x1e')](function(){return db[_0x6e9d('0x9e')][_0x6e9d('0x107')]({'where':{'ChatWebsiteId':_0x2e8685[_0x6e9d('0x60')]['id']},'order':_0x6e9d('0xa4')});});}})[_0x6e9d('0x1e')](respondWithResult(_0x105579,null))[_0x6e9d('0x28')](handleError(_0x105579,null));};exports[_0x6e9d('0x108')]=function(_0x1396b5,_0x593d20,_0x2382ab){var _0x49e579={};var _0x5da06a={};var _0x46bd0f;var _0x117f30;return db[_0x6e9d('0x53')][_0x6e9d('0x64')]({'where':{'id':_0x1396b5[_0x6e9d('0x60')]['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x593d20,null))[_0x6e9d('0x1e')](function(_0x56cd62){if(_0x56cd62){_0x46bd0f=_0x56cd62;_0x5da06a[_0x6e9d('0x40')]=_[_0x6e9d('0x3c')](db['ChatApplication']['rawAttributes']);_0x5da06a[_0x6e9d('0x3d')]=_[_0x6e9d('0x3c')](_0x1396b5[_0x6e9d('0x3d')]);_0x5da06a[_0x6e9d('0x3f')]=_[_0x6e9d('0x42')](_0x5da06a[_0x6e9d('0x40')],_0x5da06a[_0x6e9d('0x3d')]);_0x49e579[_0x6e9d('0x41')]=_[_0x6e9d('0x42')](_0x5da06a['model'],qs[_0x6e9d('0x43')](_0x1396b5[_0x6e9d('0x3d')]['fields']));_0x49e579['attributes']=_0x49e579[_0x6e9d('0x41')]['length']?_0x49e579[_0x6e9d('0x41')]:_0x5da06a[_0x6e9d('0x40')];_0x49e579['order']=qs['sort'](_0x1396b5[_0x6e9d('0x3d')]['sort']);_0x49e579[_0x6e9d('0x4c')]=qs[_0x6e9d('0x3f')](_[_0x6e9d('0x48')](_0x1396b5[_0x6e9d('0x3d')],_0x5da06a[_0x6e9d('0x3f')]));if(_0x1396b5[_0x6e9d('0x3d')]['filter']){_0x49e579['where']=_[_0x6e9d('0x4d')](_0x49e579[_0x6e9d('0x4c')],{'$or':_[_0x6e9d('0x4e')](_0x49e579[_0x6e9d('0x41')],function(_0x5e4c52){var _0x10c27d={};_0x10c27d[_0x5e4c52]={'$like':'%'+_0x1396b5['query'][_0x6e9d('0x4f')]+'%'};return _0x10c27d;})});}_0x49e579=_[_0x6e9d('0x4d')]({},_0x49e579,_0x1396b5['options']);return _0x46bd0f[_0x6e9d('0x108')](_0x49e579);}})['then'](function(_0x31f7e2){if(_0x31f7e2){_0x117f30=_0x31f7e2['length'];if(!_0x1396b5[_0x6e9d('0x3d')]['hasOwnProperty'](_0x6e9d('0x45'))){_0x49e579[_0x6e9d('0x2d')]=qs['limit'](_0x1396b5[_0x6e9d('0x3d')]['limit']);_0x49e579['offset']=qs[_0x6e9d('0x2c')](_0x1396b5[_0x6e9d('0x3d')][_0x6e9d('0x2c')]);}return _0x46bd0f[_0x6e9d('0x108')](_0x49e579);}})[_0x6e9d('0x1e')](function(_0x3b858a){if(_0x3b858a){return _0x3b858a?{'count':_0x117f30,'rows':_0x3b858a}:null;}})['then'](respondWithResult(_0x593d20,null))[_0x6e9d('0x28')](handleError(_0x593d20,null));};exports[_0x6e9d('0x109')]=function(_0x1302be,_0x5c0319,_0x4aa4c9){return db[_0x6e9d('0x10a')]['find']({'where':{'id':_0x1302be[_0x6e9d('0x60')]['id']}})['then'](handleEntityNotFound(_0x5c0319,null))[_0x6e9d('0x1e')](function(_0x5c0138){if(_0x5c0138){return _0x5c0138[_0x6e9d('0x109')](_0x1302be[_0x6e9d('0x59')]['ids'],_[_0x6e9d('0xe0')](_0x1302be[_0x6e9d('0x59')],['ids','id'])||{});}})[_0x6e9d('0x1e')](respondWithResult(_0x5c0319,null))['catch'](handleError(_0x5c0319,null));};exports['getProactiveActions']=function(_0xb2b15,_0x134859,_0x2787a1){var _0x23f7bc={};var _0x5d0835={};var _0x570699;var _0x329933;return db[_0x6e9d('0x53')][_0x6e9d('0x64')]({'where':{'id':_0xb2b15[_0x6e9d('0x60')]['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x134859,null))['then'](function(_0x45d213){if(_0x45d213){_0x570699=_0x45d213;_0x5d0835['model']=_[_0x6e9d('0x3c')](db[_0x6e9d('0x10b')]['rawAttributes']);_0x5d0835['query']=_[_0x6e9d('0x3c')](_0xb2b15[_0x6e9d('0x3d')]);_0x5d0835[_0x6e9d('0x3f')]=_['intersection'](_0x5d0835[_0x6e9d('0x40')],_0x5d0835['query']);_0x23f7bc[_0x6e9d('0x41')]=_[_0x6e9d('0x42')](_0x5d0835[_0x6e9d('0x40')],qs[_0x6e9d('0x43')](_0xb2b15[_0x6e9d('0x3d')][_0x6e9d('0x43')]));_0x23f7bc[_0x6e9d('0x41')]=_0x23f7bc[_0x6e9d('0x41')][_0x6e9d('0x65')]?_0x23f7bc[_0x6e9d('0x41')]:_0x5d0835[_0x6e9d('0x40')];_0x23f7bc[_0x6e9d('0x46')]=qs[_0x6e9d('0x47')](_0xb2b15[_0x6e9d('0x3d')][_0x6e9d('0x47')]);_0x23f7bc['where']=qs[_0x6e9d('0x3f')](_['pick'](_0xb2b15[_0x6e9d('0x3d')],_0x5d0835[_0x6e9d('0x3f')]));if(_0xb2b15[_0x6e9d('0x3d')]['filter']){_0x23f7bc[_0x6e9d('0x4c')]=_[_0x6e9d('0x4d')](_0x23f7bc[_0x6e9d('0x4c')],{'$or':_[_0x6e9d('0x4e')](_0x23f7bc['attributes'],function(_0x53816a){var _0x1a6367={};_0x1a6367[_0x53816a]={'$like':'%'+_0xb2b15['query'][_0x6e9d('0x4f')]+'%'};return _0x1a6367;})});}_0x23f7bc=_['merge']({},_0x23f7bc,_0xb2b15['options']);return _0x570699[_0x6e9d('0xf5')](_0x23f7bc);}})[_0x6e9d('0x1e')](function(_0x1f8c93){if(_0x1f8c93){_0x329933=_0x1f8c93[_0x6e9d('0x65')];if(!_0xb2b15[_0x6e9d('0x3d')][_0x6e9d('0x44')]('nolimit')){_0x23f7bc[_0x6e9d('0x2d')]=qs['limit'](_0xb2b15['query'][_0x6e9d('0x2d')]);_0x23f7bc[_0x6e9d('0x2c')]=qs['offset'](_0xb2b15[_0x6e9d('0x3d')][_0x6e9d('0x2c')]);}return _0x570699[_0x6e9d('0xf5')](_0x23f7bc);}})[_0x6e9d('0x1e')](function(_0x43c353){if(_0x43c353){return _0x43c353?{'count':_0x329933,'rows':_0x43c353}:null;}})[_0x6e9d('0x1e')](respondWithResult(_0x134859,null))[_0x6e9d('0x28')](handleError(_0x134859,null));};exports[_0x6e9d('0x10c')]=function(_0x4b483a,_0x3427b5,_0x44f4ee){var _0x648974=_0x4b483a[_0x6e9d('0x3d')][_0x6e9d('0x10d')]===_0x6e9d('0x10e')?'offlineForm':_0x6e9d('0x10f');return db['ChatWebsite'][_0x6e9d('0x57')]({'attributes':['id',_0x648974],'where':{'id':_0x4b483a[_0x6e9d('0x60')]['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x3427b5,null))['then'](function(_0x2698e6){if(_0x2698e6){var _0x1db444=_0x2698e6[_0x648974];var _0x5da8d9=_0x1db444&&_0x1db444['items']?_0x1db444[_0x6e9d('0x110')]:[];_0x3427b5[_0x6e9d('0x3a')]({'fromKey':_[_0x6e9d('0x7b')](_0x1db444[_0x6e9d('0x111')])?undefined:_0x1db444[_0x6e9d('0x111')],'count':_0x5da8d9[_0x6e9d('0x65')],'rows':_0x5da8d9});}})[_0x6e9d('0x28')](handleError(_0x3427b5,null));};exports['getOfflineMessages']=function(_0x39f387,_0x2aa87b,_0x17994a){var _0x1a7df0={'raw':!![],'where':{}};var _0x544c7d={};var _0x3a15f9={'count':0x0,'rows':[]};return db[_0x6e9d('0x53')][_0x6e9d('0x64')]({'where':{'id':_0x39f387[_0x6e9d('0x60')]['id']}})['then'](handleEntityNotFound(_0x2aa87b,null))['then'](function(_0x5dbf63){if(_0x5dbf63){_0x544c7d[_0x6e9d('0x40')]=_[_0x6e9d('0x3c')](db[_0x6e9d('0xd1')]['rawAttributes']);_0x544c7d[_0x6e9d('0x3d')]=_[_0x6e9d('0x3c')](_0x39f387[_0x6e9d('0x3d')]);_0x544c7d[_0x6e9d('0x3f')]=_[_0x6e9d('0x42')](_0x544c7d[_0x6e9d('0x40')],_0x544c7d['query']);_0x1a7df0[_0x6e9d('0x41')]=_[_0x6e9d('0x42')](_0x544c7d[_0x6e9d('0x40')],qs[_0x6e9d('0x43')](_0x39f387[_0x6e9d('0x3d')][_0x6e9d('0x43')]));_0x1a7df0['attributes']=_0x1a7df0[_0x6e9d('0x41')]['length']?_0x1a7df0[_0x6e9d('0x41')]:_0x544c7d[_0x6e9d('0x40')];if(!_0x39f387[_0x6e9d('0x3d')][_0x6e9d('0x44')]('nolimit')){_0x1a7df0[_0x6e9d('0x2d')]=qs[_0x6e9d('0x2d')](_0x39f387['query'][_0x6e9d('0x2d')]);_0x1a7df0[_0x6e9d('0x2c')]=qs[_0x6e9d('0x2c')](_0x39f387[_0x6e9d('0x3d')]['offset']);}_0x1a7df0[_0x6e9d('0x46')]=qs[_0x6e9d('0x47')](_0x39f387[_0x6e9d('0x3d')][_0x6e9d('0x47')]);_0x1a7df0['where']=qs[_0x6e9d('0x3f')](_['pick'](_0x39f387[_0x6e9d('0x3d')],_0x544c7d[_0x6e9d('0x3f')]));_0x1a7df0[_0x6e9d('0x4c')][_0x6e9d('0x66')]=_0x5dbf63['id'];if(_0x39f387['query'][_0x6e9d('0x4f')]){_0x1a7df0['where']=_[_0x6e9d('0x4d')](_0x1a7df0[_0x6e9d('0x4c')],{'$or':_['map'](_0x1a7df0['attributes'],function(_0x11ea0f){var _0x2e05d8={};_0x2e05d8[_0x11ea0f]={'$like':'%'+_0x39f387[_0x6e9d('0x3d')][_0x6e9d('0x4f')]+'%'};return _0x2e05d8;})});}_0x1a7df0=_[_0x6e9d('0x4d')]({},_0x1a7df0,_0x39f387[_0x6e9d('0x50')]);return db[_0x6e9d('0xd1')][_0x6e9d('0x2b')]({'where':_0x1a7df0[_0x6e9d('0x4c')]})[_0x6e9d('0x1e')](function(_0x3024af){_0x3a15f9[_0x6e9d('0x2b')]=_0x3024af;if(_0x39f387[_0x6e9d('0x3d')][_0x6e9d('0x51')]){_0x1a7df0[_0x6e9d('0x52')]=[{'all':!![]}];}return db[_0x6e9d('0xd1')][_0x6e9d('0x54')](_0x1a7df0);})[_0x6e9d('0x1e')](function(_0x30389c){_0x3a15f9[_0x6e9d('0x55')]=_0x30389c;return _0x3a15f9;});}})['then'](respondWithFilteredResult(_0x2aa87b,_0x1a7df0))[_0x6e9d('0x28')](handleError(_0x2aa87b,null));};exports[_0x6e9d('0x112')]=function(_0x3eefc5,_0x2fbcd7,_0x2e1acb){return db['ChatWebsite'][_0x6e9d('0x57')]({'where':{'id':_0x3eefc5['params']['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x2fbcd7,null))['then'](function(_0x10cb08){if(_0x10cb08){return _0x10cb08[_0x6e9d('0x112')](_0x3eefc5[_0x6e9d('0x59')][_0x6e9d('0x67')],_[_0x6e9d('0xe0')](_0x3eefc5[_0x6e9d('0x59')],['ids','id'])||{})['spread'](function(_0x26a5ac){for(var _0x295d52=0x0;_0x295d52<_0x3eefc5[_0x6e9d('0x59')]['ids'][_0x6e9d('0x65')];_0x295d52+=0x1){socket[_0x6e9d('0x113')]('userChatWebsite:save',{'UserId':_0x3eefc5[_0x6e9d('0x59')]['ids'][_0x295d52],'ChatWebsiteId':_0x3eefc5[_0x6e9d('0x60')]['id']});}return _0x26a5ac;});}})[_0x6e9d('0x1e')](respondWithResult(_0x2fbcd7,null))['catch'](handleError(_0x2fbcd7,null));};exports[_0x6e9d('0x114')]=function(_0x278284,_0x172421,_0x37cffa){var _0x112a15;return db['ChatWebsite'][_0x6e9d('0x57')]({'where':{'id':_0x278284['params']['id']}})[_0x6e9d('0x1e')](handleEntityNotFound(_0x172421,null))[_0x6e9d('0x1e')](function(_0x5045cd){if(_0x5045cd){return _0x5045cd[_0x6e9d('0x114')](_0x278284[_0x6e9d('0x3d')][_0x6e9d('0x67')])['then'](function(_0x49a07b){if(_['isArray'](_0x278284['query'][_0x6e9d('0x67')])){for(var _0x278543=0x0;_0x278543<_0x278284[_0x6e9d('0x3d')][_0x6e9d('0x67')][_0x6e9d('0x65')];_0x278543+=0x1){socket[_0x6e9d('0x113')](_0x6e9d('0x115'),{'UserId':_0x278284[_0x6e9d('0x3d')]['ids'][_0x278543],'ChatWebsiteId':_0x278284[_0x6e9d('0x60')]['id']});}}else{socket[_0x6e9d('0x113')](_0x6e9d('0x115'),{'UserId':_0x278284['query'][_0x6e9d('0x67')],'ChatWebsiteId':_0x278284[_0x6e9d('0x60')]['id']});}});}})['then'](respondWithStatusCode(_0x172421,null))[_0x6e9d('0x28')](handleError(_0x172421,null));};exports['getAgents']=function(_0x46a40a,_0x48033b,_0x306803){var _0x5d22b8={};var _0x24c695={};var _0x10a85d;var _0x34877f;return db['ChatWebsite'][_0x6e9d('0x64')]({'where':{'id':_0x46a40a[_0x6e9d('0x60')]['id']}})['then'](handleEntityNotFound(_0x48033b,null))[_0x6e9d('0x1e')](function(_0x384440){if(_0x384440){_0x10a85d=_0x384440;_0x24c695[_0x6e9d('0x40')]=_[_0x6e9d('0x3c')](db[_0x6e9d('0xc0')][_0x6e9d('0x3b')]);_0x24c695[_0x6e9d('0x3d')]=_[_0x6e9d('0x3c')](_0x46a40a['query']);_0x24c695[_0x6e9d('0x3f')]=_['intersection'](_0x24c695[_0x6e9d('0x40')],_0x24c695[_0x6e9d('0x3d')]);_0x5d22b8[_0x6e9d('0x41')]=_['intersection'](_0x24c695['model'],qs['fields'](_0x46a40a[_0x6e9d('0x3d')][_0x6e9d('0x43')]));_0x5d22b8[_0x6e9d('0x41')]=_0x5d22b8[_0x6e9d('0x41')]['length']?_0x5d22b8[_0x6e9d('0x41')]:_0x24c695[_0x6e9d('0x40')];_0x5d22b8[_0x6e9d('0x46')]=qs['sort'](_0x46a40a[_0x6e9d('0x3d')][_0x6e9d('0x47')]);_0x5d22b8[_0x6e9d('0x4c')]=qs['filters'](_[_0x6e9d('0x48')](_0x46a40a[_0x6e9d('0x3d')],_0x24c695[_0x6e9d('0x3f')]));if(_0x46a40a[_0x6e9d('0x3d')][_0x6e9d('0x4f')]){_0x5d22b8[_0x6e9d('0x4c')]=_[_0x6e9d('0x4d')](_0x5d22b8[_0x6e9d('0x4c')],{'$or':_['map'](_0x5d22b8[_0x6e9d('0x41')],function(_0x59501e){var _0x28d306={};_0x28d306[_0x59501e]={'$like':'%'+_0x46a40a[_0x6e9d('0x3d')][_0x6e9d('0x4f')]+'%'};return _0x28d306;})});}_0x5d22b8=_['merge']({},_0x5d22b8,_0x46a40a[_0x6e9d('0x50')]);return _0x10a85d[_0x6e9d('0x116')](_0x5d22b8);}})['then'](function(_0x1525aa){if(_0x1525aa){_0x34877f=_0x1525aa[_0x6e9d('0x65')];if(!_0x46a40a['query'][_0x6e9d('0x44')]('nolimit')){_0x5d22b8[_0x6e9d('0x2d')]=qs['limit'](_0x46a40a[_0x6e9d('0x3d')][_0x6e9d('0x2d')]);_0x5d22b8[_0x6e9d('0x2c')]=qs[_0x6e9d('0x2c')](_0x46a40a[_0x6e9d('0x3d')]['offset']);}return _0x10a85d[_0x6e9d('0x116')](_0x5d22b8);}})[_0x6e9d('0x1e')](function(_0x55cfa0){if(_0x55cfa0){return _0x55cfa0?{'count':_0x34877f,'rows':_0x55cfa0}:null;}})[_0x6e9d('0x1e')](respondWithResult(_0x48033b,null))[_0x6e9d('0x28')](handleError(_0x48033b,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 68b8675..ba35ba8 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 _0xac0a=['update','remove','emit','hasOwnProperty','hook','exports','ChatWebsite','setMaxListeners'];(function(_0x509f72,_0x3f5226){var _0x31a3d5=function(_0x15ef42){while(--_0x15ef42){_0x509f72['push'](_0x509f72['shift']());}};_0x31a3d5(++_0x3f5226);}(_0xac0a,0x11e));var _0xaac0=function(_0x532757,_0x2f42f9){_0x532757=_0x532757-0x0;var _0x5bc417=_0xac0a[_0x532757];return _0x5bc417;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0xaac0('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xaac0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaac0('0x2'),'afterDestroy':_0xaac0('0x3')};function emitEvent(_0xb0ecd5){return function(_0x1ca4e1,_0x3ccfd9,_0x295299){ChatWebsiteEvents[_0xaac0('0x4')](_0xb0ecd5+':'+_0x1ca4e1['id'],_0x1ca4e1);ChatWebsiteEvents[_0xaac0('0x4')](_0xb0ecd5,_0x1ca4e1);_0x295299(null);};}for(var e in events){if(events[_0xaac0('0x5')](e)){var event=events[e];ChatWebsite[_0xaac0('0x6')](e,emitEvent(event));}}module[_0xaac0('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xef72=['emit','hook','exports','events','../../mysqldb','ChatWebsite','remove'];(function(_0x3c67f5,_0x8f2f39){var _0x2cf4dc=function(_0x282507){while(--_0x282507){_0x3c67f5['push'](_0x3c67f5['shift']());}};_0x2cf4dc(++_0x8f2f39);}(_0xef72,0xf8));var _0x2ef7=function(_0x34124f,_0x4f6b22){_0x34124f=_0x34124f-0x0;var _0x2f1c44=_0xef72[_0x34124f];return _0x2f1c44;};'use strict';var EventEmitter=require(_0x2ef7('0x0'));var ChatWebsite=require(_0x2ef7('0x1'))['db'][_0x2ef7('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2ef7('0x3')};function emitEvent(_0x53b24f){return function(_0x1ceba3,_0x473662,_0x32b281){ChatWebsiteEvents['emit'](_0x53b24f+':'+_0x1ceba3['id'],_0x1ceba3);ChatWebsiteEvents[_0x2ef7('0x4')](_0x53b24f,_0x1ceba3);_0x32b281(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x2ef7('0x5')](e,emitEvent(event));}}module[_0x2ef7('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d9763cf..4ddf40e 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 _0xe739=['define','chat_websites','lodash','../../config/logger','api','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe739,0x105));var _0x9e73=function(_0x2eb984,_0x46aa75){_0x2eb984=_0x2eb984-0x0;var _0x29138c=_0xe739[_0x2eb984];return _0x29138c;};'use strict';var _=require(_0x9e73('0x0'));var util=require('util');var logger=require(_0x9e73('0x1'))(_0x9e73('0x2'));var moment=require(_0x9e73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./chatWebsite.attributes');module[_0x9e73('0x4')]=function(_0x43c2e8,_0x3e86f4){return _0x43c2e8[_0x9e73('0x5')]('ChatWebsite',attributes,{'tableName':_0x9e73('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x152f=['./chatWebsite.attributes','exports','define','chat_websites','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x99430b,_0x1ee60b){var _0x1865b2=function(_0x49aa91){while(--_0x49aa91){_0x99430b['push'](_0x99430b['shift']());}};_0x1865b2(++_0x1ee60b);}(_0x152f,0x144));var _0xf152=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x152f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xf152('0x0'));var util=require(_0xf152('0x1'));var logger=require(_0xf152('0x2'))(_0xf152('0x3'));var moment=require(_0xf152('0x4'));var BPromise=require('bluebird');var rp=require(_0xf152('0x5'));var attributes=require(_0xf152('0x6'));module[_0xf152('0x7')]=function(_0x303e32,_0x51ddec){return _0x303e32[_0xf152('0x8')]('ChatWebsite',attributes,{'tableName':_0xf152('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 e3e5230..e5683f7 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 _0x95e0=['http','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x46ea1b,_0x48ec3a){var _0x5c5532=function(_0x18ff77){while(--_0x18ff77){_0x46ea1b['push'](_0x46ea1b['shift']());}};_0x5c5532(++_0x48ec3a);}(_0x95e0,0x163));var _0x095e=function(_0x53e63e,_0x18ef2d){_0x53e63e=_0x53e63e-0x0;var _0x19394e=_0x95e0[_0x53e63e];return _0x19394e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x095e('0x0'));var BPromise=require('bluebird');var rs=require(_0x095e('0x1'));var fs=require('fs');var Redis=require(_0x095e('0x2'));var db=require(_0x095e('0x3'))['db'];var utils=require(_0x095e('0x4'));var logger=require('../../config/logger')(_0x095e('0x5'));var config=require(_0x095e('0x6'));var jayson=require(_0x095e('0x7'));var client=jayson[_0x095e('0x8')][_0x095e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x095e('0xa'),'port':0x18eb});var socket=require(_0x095e('0xb'))(new Redis(config['redis']));require(_0x095e('0xc'))[_0x095e('0xd')](socket);function respondWithRpcPromise(_0x293a69,_0x3e7f89,_0x39bf03){return new BPromise(function(_0x68179a,_0x4faecb){return client['request'](_0x293a69,_0x39bf03)[_0x095e('0xe')](function(_0x54353c){logger[_0x095e('0xf')](_0x095e('0x10'),_0x3e7f89,_0x095e('0x11'));logger[_0x095e('0x12')](_0x095e('0x13'),_0x3e7f89,_0x095e('0x11'),JSON[_0x095e('0x14')](_0x54353c));if(_0x54353c[_0x095e('0x15')]){if(_0x54353c[_0x095e('0x15')][_0x095e('0x16')]===0x1f4){logger['error'](_0x095e('0x10'),_0x3e7f89,_0x54353c[_0x095e('0x15')][_0x095e('0x17')]);return _0x4faecb(_0x54353c['error']['message']);}logger[_0x095e('0x15')](_0x095e('0x10'),_0x3e7f89,_0x54353c[_0x095e('0x15')][_0x095e('0x17')]);return _0x68179a(_0x54353c[_0x095e('0x15')][_0x095e('0x17')]);}else{logger[_0x095e('0xf')](_0x095e('0x10'),_0x3e7f89,_0x095e('0x11'));_0x68179a(_0x54353c[_0x095e('0x18')]['message']);}})[_0x095e('0x19')](function(_0x390d39){logger[_0x095e('0x15')](_0x095e('0x10'),_0x3e7f89,_0x390d39);_0x4faecb(_0x390d39);});});} \ No newline at end of file +var _0xbfcc=['request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','socket.io-emitter','./chatWebsite.socket','register'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xbfcc,0x186));var _0xcbfc=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xbfcc[_0x1afabf];return _0x497ff1;};'use strict';var _=require(_0xcbfc('0x0'));var util=require(_0xcbfc('0x1'));var moment=require(_0xcbfc('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbfc('0x3'));var fs=require('fs');var Redis=require(_0xcbfc('0x4'));var db=require(_0xcbfc('0x5'))['db'];var utils=require(_0xcbfc('0x6'));var logger=require('../../config/logger')(_0xcbfc('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbfc('0x8'));var client=jayson[_0xcbfc('0x9')][_0xcbfc('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcbfc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcbfc('0xc'))(new Redis(config['redis']));require(_0xcbfc('0xd'))[_0xcbfc('0xe')](socket);function respondWithRpcPromise(_0x4c3131,_0x3a18e3,_0x396806){return new BPromise(function(_0x2eb60c,_0x56e1a1){return client[_0xcbfc('0xf')](_0x4c3131,_0x396806)[_0xcbfc('0x10')](function(_0x4b236c){logger[_0xcbfc('0x11')](_0xcbfc('0x12'),_0x3a18e3,_0xcbfc('0x13'));logger['debug'](_0xcbfc('0x14'),_0x3a18e3,_0xcbfc('0x13'),JSON[_0xcbfc('0x15')](_0x4b236c));if(_0x4b236c[_0xcbfc('0x16')]){if(_0x4b236c[_0xcbfc('0x16')][_0xcbfc('0x17')]===0x1f4){logger[_0xcbfc('0x16')](_0xcbfc('0x12'),_0x3a18e3,_0x4b236c[_0xcbfc('0x16')][_0xcbfc('0x18')]);return _0x56e1a1(_0x4b236c[_0xcbfc('0x16')][_0xcbfc('0x18')]);}logger[_0xcbfc('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x3a18e3,_0x4b236c[_0xcbfc('0x16')]['message']);return _0x2eb60c(_0x4b236c[_0xcbfc('0x16')]['message']);}else{logger[_0xcbfc('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x3a18e3,_0xcbfc('0x13'));_0x2eb60c(_0x4b236c[_0xcbfc('0x19')]['message']);}})[_0xcbfc('0x1a')](function(_0x1062cc){logger['error'](_0xcbfc('0x12'),_0x3a18e3,_0x1062cc);_0x56e1a1(_0x1062cc);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 7b9575d..b3301d6 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 _0x05ad=['chatWebsite:','save','remove','update','removeListener','length'];(function(_0x301262,_0x938a63){var _0x4eb6f3=function(_0x1a1519){while(--_0x1a1519){_0x301262['push'](_0x301262['shift']());}};_0x4eb6f3(++_0x938a63);}(_0x05ad,0x12d));var _0xd05a=function(_0x5de20b,_0x469b11){_0x5de20b=_0x5de20b-0x0;var _0x38a779=_0x05ad[_0x5de20b];return _0x38a779;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xd05a('0x0'),_0xd05a('0x1'),_0xd05a('0x2')];function createListener(_0x3e98c6,_0x116e7d){return function(_0x1f88f0){_0x116e7d['emit'](_0x3e98c6,_0x1f88f0);};}function removeListener(_0x41d67c,_0x3759c5){return function(){ChatWebsiteEvents[_0xd05a('0x3')](_0x41d67c,_0x3759c5);};}exports['register']=function(_0x47eab8){for(var _0x1e08df=0x0,_0x2de8b6=events[_0xd05a('0x4')];_0x1e08df<_0x2de8b6;_0x1e08df++){var _0x50b3ee=events[_0x1e08df];var _0x4f8def=createListener(_0xd05a('0x5')+_0x50b3ee,_0x47eab8);ChatWebsiteEvents['on'](_0x50b3ee,_0x4f8def);}}; \ No newline at end of file +var _0x11b7=['./chatWebsite.events','save','update','emit','removeListener','register','length','chatWebsite:'];(function(_0x8be669,_0x3ec774){var _0x264448=function(_0x35beb4){while(--_0x35beb4){_0x8be669['push'](_0x8be669['shift']());}};_0x264448(++_0x3ec774);}(_0x11b7,0x180));var _0x711b=function(_0x2d2906,_0x37ba99){_0x2d2906=_0x2d2906-0x0;var _0x5a62d3=_0x11b7[_0x2d2906];return _0x5a62d3;};'use strict';var ChatWebsiteEvents=require(_0x711b('0x0'));var events=[_0x711b('0x1'),'remove',_0x711b('0x2')];function createListener(_0xd0703,_0x3dc287){return function(_0x5d03ac){_0x3dc287[_0x711b('0x3')](_0xd0703,_0x5d03ac);};}function removeListener(_0x36732d,_0x1bd398){return function(){ChatWebsiteEvents[_0x711b('0x4')](_0x36732d,_0x1bd398);};}exports[_0x711b('0x5')]=function(_0x5f34a5){for(var _0x266c6b=0x0,_0x2a9bc5=events[_0x711b('0x6')];_0x266c6b<_0x2a9bc5;_0x266c6b++){var _0xac1d39=events[_0x266c6b];var _0x711880=createListener(_0x711b('0x7')+_0xac1d39,_0x5f34a5);ChatWebsiteEvents['on'](_0xac1d39,_0x711880);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 2a6f139..5458313 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 _0x6faf=['get','index','/describe','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','getAgents','post','create','/:id/dispositions','addAnswer','root','server/files/images/logos/','format','%s-%s','originalname','file','addLogo','diskStorage','join','server/files/images/avatars/','now','/:id/avatar','single','addCustomerAvatar','addSystemAvatar','notify','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3b87ea,_0x33a6ff){var _0x18a85a=function(_0x473b2e){while(--_0x473b2e){_0x3b87ea['push'](_0x3b87ea['shift']());}};_0x18a85a(++_0x33a6ff);}(_0x6faf,0xf9));var _0xf6fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6faf[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xf6fa('0x0'));var path=require(_0xf6fa('0x1'));var timeout=require(_0xf6fa('0x2'));var express=require(_0xf6fa('0x3'));var router=express[_0xf6fa('0x4')]();var auth=require(_0xf6fa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf6fa('0x6'));var controller=require('./chatWebsite.controller');router[_0xf6fa('0x7')]('/',auth['isAuthenticated'](),controller[_0xf6fa('0x8')]);router[_0xf6fa('0x7')](_0xf6fa('0x9'),auth[_0xf6fa('0xa')](),controller[_0xf6fa('0xb')]);router['get'](_0xf6fa('0xc'),auth[_0xf6fa('0xa')](),controller[_0xf6fa('0xd')]);router['get']('/:id/dispositions',auth[_0xf6fa('0xa')](),controller['getDispositions']);router[_0xf6fa('0x7')](_0xf6fa('0xe'),auth['isAuthenticated'](),controller[_0xf6fa('0xf')]);router['get'](_0xf6fa('0x10'),controller['getLogo']);router['get']('/:id/avatar',controller[_0xf6fa('0x11')]);router[_0xf6fa('0x7')](_0xf6fa('0x12'),controller[_0xf6fa('0x13')]);router[_0xf6fa('0x7')](_0xf6fa('0x14'),controller[_0xf6fa('0x15')]);router[_0xf6fa('0x7')](_0xf6fa('0x16'),auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x17')]);router['get'](_0xf6fa('0x18'),controller[_0xf6fa('0x19')]);router['get'](_0xf6fa('0x1a'),auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x1b')]);router['get'](_0xf6fa('0x1c'),auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x1d')]);router[_0xf6fa('0x7')](_0xf6fa('0x1e'),controller['getFields']);router[_0xf6fa('0x7')]('/:id/offline_messages',auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x1f')]);router[_0xf6fa('0x7')]('/:id/users',auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x20')]);router[_0xf6fa('0x21')]('/',auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x22')]);router[_0xf6fa('0x21')](_0xf6fa('0x23'),auth[_0xf6fa('0xa')](),controller['addDisposition']);router['post'](_0xf6fa('0xe'),auth['isAuthenticated'](),controller[_0xf6fa('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5ca795,_0x5cca4d,_0x4bfc7b){_0x4bfc7b(null,path['join'](config[_0xf6fa('0x25')],_0xf6fa('0x26')));},'filename':function(_0x25e642,_0x221a2a,_0x2d38cb){_0x2d38cb(null,util[_0xf6fa('0x27')](_0xf6fa('0x28'),Date['now'](),_0x221a2a[_0xf6fa('0x29')]));}})});router[_0xf6fa('0x21')](_0xf6fa('0x10'),upload['single'](_0xf6fa('0x2a')),controller[_0xf6fa('0x2b')]);var upload=multer({'storage':multer[_0xf6fa('0x2c')]({'destination':function(_0x419633,_0xef2878,_0x3c5678){_0x3c5678(null,path[_0xf6fa('0x2d')](config['root'],_0xf6fa('0x2e')));},'filename':function(_0xad99cb,_0x28f1ad,_0x55b395){_0x55b395(null,util[_0xf6fa('0x27')](_0xf6fa('0x28'),Date[_0xf6fa('0x2f')](),_0x28f1ad['originalname']));}})});router[_0xf6fa('0x21')](_0xf6fa('0x30'),upload[_0xf6fa('0x31')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xf6fa('0x2c')]({'destination':function(_0x372496,_0x4a6994,_0x1f9f91){_0x1f9f91(null,path[_0xf6fa('0x2d')](config[_0xf6fa('0x25')],_0xf6fa('0x2e')));},'filename':function(_0x31cfd8,_0x20af53,_0x566887){_0x566887(null,util[_0xf6fa('0x27')](_0xf6fa('0x28'),Date[_0xf6fa('0x2f')](),_0x20af53['originalname']));}})});router[_0xf6fa('0x21')](_0xf6fa('0x12'),upload['single'](_0xf6fa('0x2a')),controller[_0xf6fa('0x32')]);var upload=multer({'storage':multer[_0xf6fa('0x2c')]({'destination':function(_0x10400e,_0x38a345,_0x1dff32){_0x1dff32(null,path[_0xf6fa('0x2d')](config['root'],_0xf6fa('0x2e')));},'filename':function(_0xcf791a,_0x300e44,_0x80b99f){_0x80b99f(null,util[_0xf6fa('0x27')](_0xf6fa('0x28'),Date[_0xf6fa('0x2f')](),_0x300e44[_0xf6fa('0x29')]));}})});router[_0xf6fa('0x21')](_0xf6fa('0x14'),upload[_0xf6fa('0x31')](_0xf6fa('0x2a')),controller[_0xf6fa('0x33')]);router['post']('/:id/notify',controller[_0xf6fa('0x34')]);router['post']('/:id/offline',controller['offline']);router[_0xf6fa('0x21')]('/:id/interactions',auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x35')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf6fa('0x36')]);router[_0xf6fa('0x21')](_0xf6fa('0x1c'),auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x37')]);router[_0xf6fa('0x21')](_0xf6fa('0x38'),auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x39')]);router[_0xf6fa('0x3a')]('/:id',auth[_0xf6fa('0xa')](),controller['update']);router['delete'](_0xf6fa('0xc'),auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x3b')]);router[_0xf6fa('0x3c')](_0xf6fa('0x23'),auth[_0xf6fa('0xa')](),controller[_0xf6fa('0x3d')]);router[_0xf6fa('0x3c')](_0xf6fa('0xe'),auth['isAuthenticated'](),controller[_0xf6fa('0x3e')]);router[_0xf6fa('0x3c')](_0xf6fa('0x38'),auth['isAuthenticated'](),controller[_0xf6fa('0x3f')]);module['exports']=router; \ No newline at end of file +var _0xf61e=['delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','join','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','diskStorage','root','server/files/images/avatars/','addAvatar','addSystemAvatar','/:id/offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','destroy'];(function(_0x2e6509,_0x3e35da){var _0x33c305=function(_0xfa5f00){while(--_0xfa5f00){_0x2e6509['push'](_0x2e6509['shift']());}};_0x33c305(++_0x3e35da);}(_0xf61e,0x191));var _0xef61=function(_0x11d1b8,_0xee8596){_0x11d1b8=_0x11d1b8-0x0;var _0xd7bf87=_0xf61e[_0x11d1b8];return _0xd7bf87;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var auth=require(_0xef61('0x6'));var interaction=require(_0xef61('0x7'));var config=require(_0xef61('0x8'));var controller=require(_0xef61('0x9'));router[_0xef61('0xa')]('/',auth[_0xef61('0xb')](),controller['index']);router[_0xef61('0xa')](_0xef61('0xc'),auth['isAuthenticated'](),controller[_0xef61('0xd')]);router[_0xef61('0xa')](_0xef61('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xef61('0xa')](_0xef61('0xf'),auth[_0xef61('0xb')](),controller[_0xef61('0x10')]);router[_0xef61('0xa')](_0xef61('0x11'),auth[_0xef61('0xb')](),controller[_0xef61('0x12')]);router[_0xef61('0xa')](_0xef61('0x13'),controller[_0xef61('0x14')]);router[_0xef61('0xa')](_0xef61('0x15'),controller[_0xef61('0x16')]);router['get'](_0xef61('0x17'),controller['getCustomerAvatar']);router[_0xef61('0xa')](_0xef61('0x18'),controller[_0xef61('0x19')]);router[_0xef61('0xa')]('/:id/interactions',auth[_0xef61('0xb')](),controller[_0xef61('0x1a')]);router[_0xef61('0xa')](_0xef61('0x1b'),controller['getSnippet']);router[_0xef61('0xa')](_0xef61('0x1c'),auth['isAuthenticated'](),controller[_0xef61('0x1d')]);router[_0xef61('0xa')](_0xef61('0x1e'),auth[_0xef61('0xb')](),controller[_0xef61('0x1f')]);router[_0xef61('0xa')](_0xef61('0x20'),controller['getFields']);router[_0xef61('0xa')](_0xef61('0x21'),auth['isAuthenticated'](),controller[_0xef61('0x22')]);router[_0xef61('0xa')](_0xef61('0x23'),auth[_0xef61('0xb')](),controller[_0xef61('0x24')]);router[_0xef61('0x25')]('/',auth[_0xef61('0xb')](),controller['create']);router['post'](_0xef61('0xf'),auth['isAuthenticated'](),controller[_0xef61('0x26')]);router['post']('/:id/canned_answers',auth[_0xef61('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfbee94,_0x3782c6,_0x3ceb14){_0x3ceb14(null,path[_0xef61('0x27')](config['root'],_0xef61('0x28')));},'filename':function(_0x4e738f,_0x2a6832,_0xb00f83){_0xb00f83(null,util[_0xef61('0x29')](_0xef61('0x2a'),Date[_0xef61('0x2b')](),_0x2a6832[_0xef61('0x2c')]));}})});router[_0xef61('0x25')](_0xef61('0x13'),upload[_0xef61('0x2d')](_0xef61('0x2e')),controller[_0xef61('0x2f')]);var upload=multer({'storage':multer[_0xef61('0x30')]({'destination':function(_0xeb9a62,_0x63edd4,_0x1f3572){_0x1f3572(null,path[_0xef61('0x27')](config[_0xef61('0x31')],_0xef61('0x32')));},'filename':function(_0x587e26,_0x2fe908,_0x43bc47){_0x43bc47(null,util[_0xef61('0x29')]('%s-%s',Date['now'](),_0x2fe908[_0xef61('0x2c')]));}})});router[_0xef61('0x25')](_0xef61('0x15'),upload['single'](_0xef61('0x2e')),controller[_0xef61('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x474120,_0x5d77f9,_0x4c7fd3){_0x4c7fd3(null,path[_0xef61('0x27')](config['root'],_0xef61('0x32')));},'filename':function(_0x5ee9e4,_0x41d9e9,_0x4155a0){_0x4155a0(null,util[_0xef61('0x29')](_0xef61('0x2a'),Date[_0xef61('0x2b')](),_0x41d9e9[_0xef61('0x2c')]));}})});router[_0xef61('0x25')](_0xef61('0x17'),upload[_0xef61('0x2d')](_0xef61('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xef61('0x30')]({'destination':function(_0x4ce644,_0x3dd5a2,_0x1c1760){_0x1c1760(null,path[_0xef61('0x27')](config['root'],_0xef61('0x32')));},'filename':function(_0x3b7373,_0x291944,_0x53bdb9){_0x53bdb9(null,util['format']('%s-%s',Date[_0xef61('0x2b')](),_0x291944['originalname']));}})});router['post']('/:id/system_avatar',upload[_0xef61('0x2d')](_0xef61('0x2e')),controller[_0xef61('0x34')]);router['post']('/:id/notify',controller['notify']);router[_0xef61('0x25')](_0xef61('0x35'),controller['offline']);router[_0xef61('0x25')](_0xef61('0x36'),auth[_0xef61('0xb')](),controller[_0xef61('0x37')]);router['post'](_0xef61('0x1c'),auth[_0xef61('0xb')](),controller[_0xef61('0x38')]);router[_0xef61('0x25')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xef61('0x39')]);router[_0xef61('0x25')](_0xef61('0x23'),auth['isAuthenticated'](),controller[_0xef61('0x3a')]);router[_0xef61('0x3b')](_0xef61('0xe'),auth[_0xef61('0xb')](),controller['update']);router['delete']('/:id',auth[_0xef61('0xb')](),controller[_0xef61('0x3c')]);router[_0xef61('0x3d')](_0xef61('0xf'),auth[_0xef61('0xb')](),controller[_0xef61('0x3e')]);router[_0xef61('0x3d')]('/:id/canned_answers',auth[_0xef61('0xb')](),controller[_0xef61('0x3f')]);router[_0xef61('0x3d')](_0xef61('0x23'),auth['isAuthenticated'](),controller[_0xef61('0x40')]);module[_0xef61('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 7ccec07..dda4db6 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 _0x3c6d=['STRING','sequelize','exports','name'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3c6d,0x75));var _0xd3c6=function(_0x5db136,_0x485ac3){_0x5db136=_0x5db136-0x0;var _0x1c7317=_0x3c6d[_0x5db136];return _0x1c7317;};'use strict';var Sequelize=require(_0xd3c6('0x0'));module[_0xd3c6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd3c6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd3c6('0x3')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xd3c6('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xd3c6('0x3')]},'type':{'type':Sequelize[_0xd3c6('0x3')]},'street':{'type':Sequelize[_0xd3c6('0x3')]},'postalCode':{'type':Sequelize[_0xd3c6('0x3')]},'city':{'type':Sequelize[_0xd3c6('0x3')]},'country':{'type':Sequelize[_0xd3c6('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd3c6('0x3')]},'sStreet':{'type':Sequelize[_0xd3c6('0x3')]},'sPostalCode':{'type':Sequelize[_0xd3c6('0x3')]},'sCity':{'type':Sequelize[_0xd3c6('0x3')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3c6('0x3')]}}; \ No newline at end of file +var _0xf6d2=['exports','STRING','name','sequelize'];(function(_0xb23061,_0x4b1210){var _0x79d365=function(_0x26f3ba){while(--_0x26f3ba){_0xb23061['push'](_0xb23061['shift']());}};_0x79d365(++_0x4b1210);}(_0xf6d2,0xa3));var _0x2f6d=function(_0x5d8c17,_0xcf1e61){_0x5d8c17=_0x5d8c17-0x0;var _0x3b1fcd=_0xf6d2[_0x5d8c17];return _0x3b1fcd;};'use strict';var Sequelize=require(_0x2f6d('0x0'));module[_0x2f6d('0x1')]={'name':{'type':Sequelize[_0x2f6d('0x2')],'unique':_0x2f6d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2f6d('0x2')]},'companyId':{'type':Sequelize[_0x2f6d('0x2')]},'website':{'type':Sequelize[_0x2f6d('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x2f6d('0x2')]},'type':{'type':Sequelize[_0x2f6d('0x2')]},'street':{'type':Sequelize[_0x2f6d('0x2')]},'postalCode':{'type':Sequelize[_0x2f6d('0x2')]},'city':{'type':Sequelize[_0x2f6d('0x2')]},'country':{'type':Sequelize[_0x2f6d('0x2')]},'email':{'type':Sequelize[_0x2f6d('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x2f6d('0x2')]},'sStreet':{'type':Sequelize[_0x2f6d('0x2')]},'sPostalCode':{'type':Sequelize[_0x2f6d('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x2f6d('0x2')]},'description':{'type':Sequelize[_0x2f6d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b0f61df..0db729c 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 _0x7dff=['order','where','filters','pick','day','add','filter','map','merge','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','getContacts','findOne','sort','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','name','send','index','CmCompany','rawAttributes','model','query','dateEnd','dateStart','keys','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x332998,_0x2d99c7){var _0x460be7=function(_0x1a4d24){while(--_0x1a4d24){_0x332998['push'](_0x332998['shift']());}};_0x460be7(++_0x2d99c7);}(_0x7dff,0x75));var _0xf7df=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7dff[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0xf7df('0x0'));var emlformat=require(_0xf7df('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf7df('0x2'));var jsonpatch=require(_0xf7df('0x3'));var rp=require(_0xf7df('0x4'));var moment=require(_0xf7df('0x5'));var BPromise=require(_0xf7df('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf7df('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf7df('0x8'));var squel=require(_0xf7df('0x9'));var crypto=require(_0xf7df('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf7df('0xb'));var toCsv=require(_0xf7df('0xc'));var querystring=require('querystring');var Papa=require(_0xf7df('0xd'));var Redis=require('ioredis');var qs=require(_0xf7df('0xe'));var logger=require(_0xf7df('0xf'))('api');var utils=require(_0xf7df('0x10'));var config=require(_0xf7df('0x11'));var db=require(_0xf7df('0x12'))['db'];function respondWithStatusCode(_0x3e1917,_0x4f4844){_0x4f4844=_0x4f4844||0xcc;return function(_0x5b81df){if(_0x5b81df){return _0x3e1917[_0xf7df('0x13')](_0x4f4844);}return _0x3e1917[_0xf7df('0x14')](_0x4f4844)[_0xf7df('0x15')]();};}function respondWithResult(_0x44a257,_0x133241){_0x133241=_0x133241||0xc8;return function(_0x296070){if(_0x296070){return _0x44a257['status'](_0x133241)[_0xf7df('0x16')](_0x296070);}};}function respondWithFilteredResult(_0x4618b7,_0x457d18){return function(_0xa50006){if(_0xa50006){var _0x4c2aef=_0xa50006[_0xf7df('0x17')],_0x4d20e8=_0x457d18[_0xf7df('0x18')],_0x457cc8=_0x457d18[_0xf7df('0x18')]+_0x457d18[_0xf7df('0x19')],_0x63ebf0;if(_0x457cc8>=_0x4c2aef){_0x457cc8=_0x4c2aef;_0x63ebf0=0xc8;}else{_0x63ebf0=0xce;}_0x4618b7[_0xf7df('0x14')](_0x63ebf0);return _0x4618b7[_0xf7df('0x1a')](_0xf7df('0x1b'),_0x4d20e8+'-'+_0x457cc8+'/'+_0x4c2aef)[_0xf7df('0x16')](_0xa50006);}return null;};}function patchUpdates(_0x2cf881){return function(_0xd2d884){try{jsonpatch[_0xf7df('0x1c')](_0xd2d884,_0x2cf881,!![]);}catch(_0x3ff6c0){return BPromise[_0xf7df('0x1d')](_0x3ff6c0);}return _0xd2d884[_0xf7df('0x1e')]();};}function saveUpdates(_0x3f2263,_0x5824f8){return function(_0x11de7a){if(_0x11de7a){return _0x11de7a[_0xf7df('0x1f')](_0x3f2263)[_0xf7df('0x20')](function(_0x3ed310){return _0x3ed310;});}return null;};}function removeEntity(_0x4bcc5c,_0x51e1c3){return function(_0x9c4d63){if(_0x9c4d63){return _0x9c4d63[_0xf7df('0x21')]()['then'](function(){var _0x51c00f=_0x9c4d63[_0xf7df('0x22')]({'plain':!![]});var _0x56973e=_0xf7df('0x23');return db[_0xf7df('0x24')][_0xf7df('0x21')]({'where':{'type':_0x56973e,'resourceId':_0x51c00f['id']}})['then'](function(){return _0x9c4d63;});})['then'](function(){_0x4bcc5c[_0xf7df('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a0d48,_0x200038){return function(_0x16f70f){if(!_0x16f70f){_0x2a0d48[_0xf7df('0x13')](0x194);}return _0x16f70f;};}function handleError(_0xafdd3e,_0x28d07f){_0x28d07f=_0x28d07f||0x1f4;return function(_0x509dc3){logger[_0xf7df('0x25')](_0x509dc3['stack']);if(_0x509dc3['name']){delete _0x509dc3[_0xf7df('0x26')];}_0xafdd3e[_0xf7df('0x14')](_0x28d07f)[_0xf7df('0x27')](_0x509dc3);};}exports[_0xf7df('0x28')]=function(_0x485bad,_0x500ed5){var _0x10fcb8={},_0x200df4={},_0x162e2c={'count':0x0,'rows':[]};var _0x2c7a38=db[_0xf7df('0x29')][_0xf7df('0x2a')];_0x200df4[_0xf7df('0x2b')]=_['keys'](_0x2c7a38);var _0x56c7a5={'dateStart':_0x485bad[_0xf7df('0x2c')]['dateStart'],'dateEnd':_0x485bad[_0xf7df('0x2c')][_0xf7df('0x2d')]};delete _0x485bad['query'][_0xf7df('0x2e')];delete _0x485bad[_0xf7df('0x2c')]['dateEnd'];_0x200df4[_0xf7df('0x2c')]=_[_0xf7df('0x2f')](_0x485bad['query']);_0x200df4['filters']=_['intersection'](_0x200df4[_0xf7df('0x2b')],_0x200df4['query']);_0x10fcb8[_0xf7df('0x30')]=_['intersection'](_0x200df4[_0xf7df('0x2b')],qs[_0xf7df('0x31')](_0x485bad[_0xf7df('0x2c')]['fields']));_0x10fcb8[_0xf7df('0x30')]=_0x10fcb8[_0xf7df('0x30')][_0xf7df('0x32')]?_0x10fcb8[_0xf7df('0x30')]:_0x200df4[_0xf7df('0x2b')];if(!_0x485bad[_0xf7df('0x2c')][_0xf7df('0x33')](_0xf7df('0x34'))){_0x10fcb8[_0xf7df('0x19')]=qs['limit'](_0x485bad['query'][_0xf7df('0x19')]);_0x10fcb8[_0xf7df('0x18')]=qs[_0xf7df('0x18')](_0x485bad['query'][_0xf7df('0x18')]);}_0x10fcb8[_0xf7df('0x35')]=qs['sort'](_0x485bad[_0xf7df('0x2c')]['sort']);_0x10fcb8[_0xf7df('0x36')]=qs[_0xf7df('0x37')](_[_0xf7df('0x38')](_0x485bad[_0xf7df('0x2c')],_0x200df4[_0xf7df('0x37')]));if(_0x56c7a5[_0xf7df('0x2e')]){if(_0x56c7a5[_0xf7df('0x2d')]){_0x56c7a5[_0xf7df('0x2d')]=moment(_0x56c7a5[_0xf7df('0x2d')])['add'](0x1,_0xf7df('0x39'));}else{_0x56c7a5[_0xf7df('0x2d')]=moment(_0x56c7a5[_0xf7df('0x2e')])[_0xf7df('0x3a')](0x1,_0xf7df('0x39'));}_['merge'](_0x10fcb8['where'],{'createdAt':{'$gte':_0x56c7a5['dateStart'],'$lte':_0x56c7a5[_0xf7df('0x2d')]}});}if(_0x485bad[_0xf7df('0x2c')][_0xf7df('0x3b')]){_0x10fcb8[_0xf7df('0x36')]=_['merge'](_0x10fcb8['where'],{'$or':_[_0xf7df('0x3c')](_0x10fcb8[_0xf7df('0x30')],function(_0x10e20b){var _0x27d538={};_0x27d538[_0x10e20b]={'$like':'%'+_0x485bad[_0xf7df('0x2c')][_0xf7df('0x3b')]+'%'};return _0x27d538;})});}_0x10fcb8=_[_0xf7df('0x3d')]({},_0x10fcb8,_0x485bad[_0xf7df('0x3e')]);var _0x4a641b={'where':_0x10fcb8[_0xf7df('0x36')]};return db[_0xf7df('0x29')][_0xf7df('0x17')](_0x4a641b)[_0xf7df('0x20')](function(_0x54e360){_0x162e2c[_0xf7df('0x17')]=_0x54e360;if(_0x485bad[_0xf7df('0x2c')]['includeAll']){_0x10fcb8[_0xf7df('0x3f')]=[{'all':!![]}];}return db[_0xf7df('0x29')][_0xf7df('0x40')](_0x10fcb8);})[_0xf7df('0x20')](function(_0x98af61){_0x162e2c[_0xf7df('0x41')]=_0x98af61;return _0x162e2c;})[_0xf7df('0x20')](respondWithFilteredResult(_0x500ed5,_0x10fcb8))[_0xf7df('0x42')](handleError(_0x500ed5,null));};exports[_0xf7df('0x43')]=function(_0x4c9f46,_0x24aa8e){var _0x11fa56={'raw':![],'where':{'id':_0x4c9f46[_0xf7df('0x44')]['id']}},_0x40ca00={};_0x40ca00['model']=_[_0xf7df('0x2f')](db['CmCompany'][_0xf7df('0x2a')]);_0x40ca00[_0xf7df('0x2c')]=_['keys'](_0x4c9f46[_0xf7df('0x2c')]);_0x40ca00['filters']=_[_0xf7df('0x45')](_0x40ca00[_0xf7df('0x2b')],_0x40ca00[_0xf7df('0x2c')]);_0x11fa56[_0xf7df('0x30')]=_[_0xf7df('0x45')](_0x40ca00[_0xf7df('0x2b')],qs['fields'](_0x4c9f46[_0xf7df('0x2c')][_0xf7df('0x31')]));_0x11fa56[_0xf7df('0x30')]=_0x11fa56[_0xf7df('0x30')][_0xf7df('0x32')]?_0x11fa56['attributes']:_0x40ca00[_0xf7df('0x2b')];if(_0x4c9f46[_0xf7df('0x2c')][_0xf7df('0x46')]){_0x11fa56['include']=[{'all':!![]}];}_0x11fa56=_[_0xf7df('0x3d')]({},_0x11fa56,_0x4c9f46[_0xf7df('0x3e')]);return db['CmCompany'][_0xf7df('0x47')](_0x11fa56)[_0xf7df('0x20')](handleEntityNotFound(_0x24aa8e,null))['then'](respondWithResult(_0x24aa8e,null))[_0xf7df('0x42')](handleError(_0x24aa8e,null));};exports[_0xf7df('0x48')]=function(_0x5e2e93,_0x11a4f7){return db[_0xf7df('0x29')][_0xf7df('0x48')](_0x5e2e93[_0xf7df('0x49')],{})[_0xf7df('0x20')](function(_0x2e5dd0){var _0x105942=_0x5e2e93['user'][_0xf7df('0x22')]({'plain':!![]});if(!_0x105942)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x105942[_0xf7df('0x4a')]===_0xf7df('0x4b')){var _0x5e406c=_0x2e5dd0[_0xf7df('0x22')]({'plain':!![]});var _0x43d9c=_0xf7df('0x23');return db[_0xf7df('0x4c')]['find']({'where':{'name':_0x43d9c,'userProfileId':_0x105942['userProfileId']},'raw':!![]})[_0xf7df('0x20')](function(_0x5aa4dc){if(_0x5aa4dc&&_0x5aa4dc[_0xf7df('0x4d')]===0x0){return db[_0xf7df('0x24')][_0xf7df('0x48')]({'name':_0x5e406c['name'],'resourceId':_0x5e406c['id'],'type':_0x5aa4dc['name'],'sectionId':_0x5aa4dc['id']},{})[_0xf7df('0x20')](function(){return _0x2e5dd0;});}else{return _0x2e5dd0;}})['catch'](function(_0x4b0c9a){logger[_0xf7df('0x25')](_0xf7df('0x4e'),_0x4b0c9a);throw _0x4b0c9a;});}return _0x2e5dd0;})[_0xf7df('0x20')](respondWithResult(_0x11a4f7,0xc9))[_0xf7df('0x42')](handleError(_0x11a4f7,null));};exports['update']=function(_0x318dbe,_0x3395a5){if(_0x318dbe[_0xf7df('0x49')]['id']){delete _0x318dbe[_0xf7df('0x49')]['id'];}return db[_0xf7df('0x29')]['find']({'where':{'id':_0x318dbe[_0xf7df('0x44')]['id']}})[_0xf7df('0x20')](handleEntityNotFound(_0x3395a5,null))[_0xf7df('0x20')](saveUpdates(_0x318dbe['body'],null))[_0xf7df('0x20')](respondWithResult(_0x3395a5,null))[_0xf7df('0x42')](handleError(_0x3395a5,null));};exports['destroy']=function(_0x4674f4,_0x25b1ff){return db[_0xf7df('0x29')]['find']({'where':{'id':_0x4674f4['params']['id']}})['then'](handleEntityNotFound(_0x25b1ff,null))[_0xf7df('0x20')](removeEntity(_0x25b1ff,null))['catch'](handleError(_0x25b1ff,null));};exports['addContacts']=function(_0x12420d,_0x3affbb,_0xe89649){return db[_0xf7df('0x4f')][_0xf7df('0x47')]({'where':{'id':_0x12420d[_0xf7df('0x44')]['id']}})[_0xf7df('0x20')](handleEntityNotFound(_0x3affbb,null))[_0xf7df('0x20')](function(_0x3e57a1){if(_0x3e57a1){return _0x3e57a1[_0xf7df('0x50')](_0x12420d[_0xf7df('0x49')][_0xf7df('0x51')],_['omit'](_0x12420d['body'],['ids','id'])||{});}})[_0xf7df('0x20')](respondWithResult(_0x3affbb,null))[_0xf7df('0x42')](handleError(_0x3affbb,null));};exports[_0xf7df('0x52')]=function(_0x13b76d,_0x2c843f,_0x58f955){var _0x3dac97={};var _0x1a0a56={};var _0x1829ee;var _0x3e77b7;return db['CmCompany'][_0xf7df('0x53')]({'where':{'id':_0x13b76d[_0xf7df('0x44')]['id']}})[_0xf7df('0x20')](handleEntityNotFound(_0x2c843f,null))[_0xf7df('0x20')](function(_0x1bc02c){if(_0x1bc02c){_0x1829ee=_0x1bc02c;_0x1a0a56[_0xf7df('0x2b')]=_[_0xf7df('0x2f')](db['CmContact'][_0xf7df('0x2a')]);_0x1a0a56['query']=_['keys'](_0x13b76d[_0xf7df('0x2c')]);_0x1a0a56['filters']=_[_0xf7df('0x45')](_0x1a0a56['model'],_0x1a0a56['query']);_0x3dac97[_0xf7df('0x30')]=_[_0xf7df('0x45')](_0x1a0a56[_0xf7df('0x2b')],qs[_0xf7df('0x31')](_0x13b76d[_0xf7df('0x2c')]['fields']));_0x3dac97[_0xf7df('0x30')]=_0x3dac97[_0xf7df('0x30')][_0xf7df('0x32')]?_0x3dac97[_0xf7df('0x30')]:_0x1a0a56[_0xf7df('0x2b')];_0x3dac97['order']=qs[_0xf7df('0x54')](_0x13b76d['query']['sort']);_0x3dac97['where']=qs[_0xf7df('0x37')](_['pick'](_0x13b76d[_0xf7df('0x2c')],_0x1a0a56[_0xf7df('0x37')]));if(_0x13b76d[_0xf7df('0x2c')][_0xf7df('0x3b')]){_0x3dac97['where']=_[_0xf7df('0x3d')](_0x3dac97[_0xf7df('0x36')],{'$or':_[_0xf7df('0x3c')](_0x3dac97['attributes'],function(_0x5ab038){var _0x3d8340={};_0x3d8340[_0x5ab038]={'$like':'%'+_0x13b76d[_0xf7df('0x2c')]['filter']+'%'};return _0x3d8340;})});}_0x3dac97=_['merge']({},_0x3dac97,_0x13b76d[_0xf7df('0x3e')]);return _0x1829ee[_0xf7df('0x52')](_0x3dac97);}})[_0xf7df('0x20')](function(_0x3f3903){if(_0x3f3903){_0x3e77b7=_0x3f3903[_0xf7df('0x32')];if(!_0x13b76d[_0xf7df('0x2c')][_0xf7df('0x33')](_0xf7df('0x34'))){_0x3dac97['limit']=qs[_0xf7df('0x19')](_0x13b76d[_0xf7df('0x2c')][_0xf7df('0x19')]);_0x3dac97[_0xf7df('0x18')]=qs[_0xf7df('0x18')](_0x13b76d[_0xf7df('0x2c')][_0xf7df('0x18')]);}return _0x1829ee[_0xf7df('0x52')](_0x3dac97);}})[_0xf7df('0x20')](function(_0x18cdf1){if(_0x18cdf1){return _0x18cdf1?{'count':_0x3e77b7,'rows':_0x18cdf1}:null;}})[_0xf7df('0x20')](respondWithResult(_0x2c843f,null))['catch'](handleError(_0x2c843f,null));}; \ No newline at end of file +var _0xa784=['CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','get','Companies','destroy','end','error','stack','name','send','index','CmCompany','rawAttributes','keys','dateStart','dateEnd','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','day','add','merge','filter','map','options','count','includeAll','findAll','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0xa784,0xad));var _0x4a78=function(_0x46dbf0,_0x16821c){_0x46dbf0=_0x46dbf0-0x0;var _0x5c6a18=_0xa784[_0x46dbf0];return _0x5c6a18;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4a78('0x0'));var rimraf=require(_0x4a78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a78('0x2'));var rp=require(_0x4a78('0x3'));var moment=require('moment');var BPromise=require(_0x4a78('0x4'));var Mustache=require('mustache');var util=require(_0x4a78('0x5'));var path=require(_0x4a78('0x6'));var sox=require(_0x4a78('0x7'));var csv=require(_0x4a78('0x8'));var ejs=require(_0x4a78('0x9'));var fs=require('fs');var _=require(_0x4a78('0xa'));var squel=require('squel');var crypto=require(_0x4a78('0xb'));var jsforce=require(_0x4a78('0xc'));var deskjs=require(_0x4a78('0xd'));var toCsv=require(_0x4a78('0x8'));var querystring=require('querystring');var Papa=require(_0x4a78('0xe'));var Redis=require(_0x4a78('0xf'));var qs=require(_0x4a78('0x10'));var logger=require(_0x4a78('0x11'))(_0x4a78('0x12'));var utils=require('../../config/utils');var config=require(_0x4a78('0x13'));var db=require(_0x4a78('0x14'))['db'];function respondWithStatusCode(_0x5e343e,_0x3a9d98){_0x3a9d98=_0x3a9d98||0xcc;return function(_0x363ff0){if(_0x363ff0){return _0x5e343e[_0x4a78('0x15')](_0x3a9d98);}return _0x5e343e[_0x4a78('0x16')](_0x3a9d98)['end']();};}function respondWithResult(_0xeb5705,_0x4bfd97){_0x4bfd97=_0x4bfd97||0xc8;return function(_0x1c7846){if(_0x1c7846){return _0xeb5705[_0x4a78('0x16')](_0x4bfd97)[_0x4a78('0x17')](_0x1c7846);}};}function respondWithFilteredResult(_0x2a9c59,_0x482f6a){return function(_0x3fd41b){if(_0x3fd41b){var _0x5319d1=_0x3fd41b['count'],_0x2940cf=_0x482f6a[_0x4a78('0x18')],_0x46c678=_0x482f6a[_0x4a78('0x18')]+_0x482f6a[_0x4a78('0x19')],_0xfc1d9;if(_0x46c678>=_0x5319d1){_0x46c678=_0x5319d1;_0xfc1d9=0xc8;}else{_0xfc1d9=0xce;}_0x2a9c59['status'](_0xfc1d9);return _0x2a9c59[_0x4a78('0x1a')](_0x4a78('0x1b'),_0x2940cf+'-'+_0x46c678+'/'+_0x5319d1)[_0x4a78('0x17')](_0x3fd41b);}return null;};}function patchUpdates(_0x5d68ce){return function(_0x4d3fdd){try{jsonpatch['apply'](_0x4d3fdd,_0x5d68ce,!![]);}catch(_0x21cb41){return BPromise[_0x4a78('0x1c')](_0x21cb41);}return _0x4d3fdd[_0x4a78('0x1d')]();};}function saveUpdates(_0x4a6a08,_0x679c8e){return function(_0x4b8fcb){if(_0x4b8fcb){return _0x4b8fcb[_0x4a78('0x1e')](_0x4a6a08)[_0x4a78('0x1f')](function(_0x19c1cc){return _0x19c1cc;});}return null;};}function removeEntity(_0x269f0c,_0x12cae8){return function(_0x199693){if(_0x199693){return _0x199693['destroy']()[_0x4a78('0x1f')](function(){var _0x30536e=_0x199693[_0x4a78('0x20')]({'plain':!![]});var _0x512b0d=_0x4a78('0x21');return db['UserProfileResource'][_0x4a78('0x22')]({'where':{'type':_0x512b0d,'resourceId':_0x30536e['id']}})[_0x4a78('0x1f')](function(){return _0x199693;});})[_0x4a78('0x1f')](function(){_0x269f0c[_0x4a78('0x16')](0xcc)[_0x4a78('0x23')]();});}};}function handleEntityNotFound(_0x47383d,_0x2fd8ff){return function(_0x13548d){if(!_0x13548d){_0x47383d['sendStatus'](0x194);}return _0x13548d;};}function handleError(_0x5870bd,_0x27eb11){_0x27eb11=_0x27eb11||0x1f4;return function(_0xf1259e){logger[_0x4a78('0x24')](_0xf1259e[_0x4a78('0x25')]);if(_0xf1259e['name']){delete _0xf1259e[_0x4a78('0x26')];}_0x5870bd[_0x4a78('0x16')](_0x27eb11)[_0x4a78('0x27')](_0xf1259e);};}exports[_0x4a78('0x28')]=function(_0x310b9d,_0x160bec){var _0x5f5b87={},_0x35cbeb={},_0x33ddc0={'count':0x0,'rows':[]};var _0x449b82=db[_0x4a78('0x29')][_0x4a78('0x2a')];_0x35cbeb['model']=_[_0x4a78('0x2b')](_0x449b82);var _0x70f5d2={'dateStart':_0x310b9d['query'][_0x4a78('0x2c')],'dateEnd':_0x310b9d['query'][_0x4a78('0x2d')]};delete _0x310b9d[_0x4a78('0x2e')][_0x4a78('0x2c')];delete _0x310b9d[_0x4a78('0x2e')][_0x4a78('0x2d')];_0x35cbeb[_0x4a78('0x2e')]=_[_0x4a78('0x2b')](_0x310b9d[_0x4a78('0x2e')]);_0x35cbeb[_0x4a78('0x2f')]=_[_0x4a78('0x30')](_0x35cbeb[_0x4a78('0x31')],_0x35cbeb[_0x4a78('0x2e')]);_0x5f5b87['attributes']=_['intersection'](_0x35cbeb[_0x4a78('0x31')],qs[_0x4a78('0x32')](_0x310b9d[_0x4a78('0x2e')][_0x4a78('0x32')]));_0x5f5b87['attributes']=_0x5f5b87[_0x4a78('0x33')][_0x4a78('0x34')]?_0x5f5b87[_0x4a78('0x33')]:_0x35cbeb[_0x4a78('0x31')];if(!_0x310b9d[_0x4a78('0x2e')][_0x4a78('0x35')](_0x4a78('0x36'))){_0x5f5b87[_0x4a78('0x19')]=qs[_0x4a78('0x19')](_0x310b9d[_0x4a78('0x2e')][_0x4a78('0x19')]);_0x5f5b87[_0x4a78('0x18')]=qs[_0x4a78('0x18')](_0x310b9d[_0x4a78('0x2e')][_0x4a78('0x18')]);}_0x5f5b87[_0x4a78('0x37')]=qs[_0x4a78('0x38')](_0x310b9d[_0x4a78('0x2e')][_0x4a78('0x38')]);_0x5f5b87[_0x4a78('0x39')]=qs[_0x4a78('0x2f')](_[_0x4a78('0x3a')](_0x310b9d['query'],_0x35cbeb['filters']));if(_0x70f5d2[_0x4a78('0x2c')]){if(_0x70f5d2[_0x4a78('0x2d')]){_0x70f5d2['dateEnd']=moment(_0x70f5d2[_0x4a78('0x2d')])['add'](0x1,_0x4a78('0x3b'));}else{_0x70f5d2[_0x4a78('0x2d')]=moment(_0x70f5d2['dateStart'])[_0x4a78('0x3c')](0x1,_0x4a78('0x3b'));}_[_0x4a78('0x3d')](_0x5f5b87['where'],{'createdAt':{'$gte':_0x70f5d2[_0x4a78('0x2c')],'$lte':_0x70f5d2[_0x4a78('0x2d')]}});}if(_0x310b9d[_0x4a78('0x2e')][_0x4a78('0x3e')]){_0x5f5b87['where']=_[_0x4a78('0x3d')](_0x5f5b87[_0x4a78('0x39')],{'$or':_[_0x4a78('0x3f')](_0x5f5b87[_0x4a78('0x33')],function(_0x3a2b57){var _0x41b6b4={};_0x41b6b4[_0x3a2b57]={'$like':'%'+_0x310b9d[_0x4a78('0x2e')][_0x4a78('0x3e')]+'%'};return _0x41b6b4;})});}_0x5f5b87=_[_0x4a78('0x3d')]({},_0x5f5b87,_0x310b9d[_0x4a78('0x40')]);var _0x34f3b7={'where':_0x5f5b87[_0x4a78('0x39')]};return db[_0x4a78('0x29')][_0x4a78('0x41')](_0x34f3b7)[_0x4a78('0x1f')](function(_0x1bd284){_0x33ddc0['count']=_0x1bd284;if(_0x310b9d[_0x4a78('0x2e')][_0x4a78('0x42')]){_0x5f5b87['include']=[{'all':!![]}];}return db[_0x4a78('0x29')][_0x4a78('0x43')](_0x5f5b87);})[_0x4a78('0x1f')](function(_0x48e824){_0x33ddc0['rows']=_0x48e824;return _0x33ddc0;})['then'](respondWithFilteredResult(_0x160bec,_0x5f5b87))['catch'](handleError(_0x160bec,null));};exports['show']=function(_0x21ee53,_0x38c4e5){var _0x55f871={'raw':![],'where':{'id':_0x21ee53[_0x4a78('0x44')]['id']}},_0x243a36={};_0x243a36[_0x4a78('0x31')]=_[_0x4a78('0x2b')](db[_0x4a78('0x29')][_0x4a78('0x2a')]);_0x243a36[_0x4a78('0x2e')]=_['keys'](_0x21ee53[_0x4a78('0x2e')]);_0x243a36[_0x4a78('0x2f')]=_[_0x4a78('0x30')](_0x243a36[_0x4a78('0x31')],_0x243a36[_0x4a78('0x2e')]);_0x55f871['attributes']=_['intersection'](_0x243a36[_0x4a78('0x31')],qs['fields'](_0x21ee53[_0x4a78('0x2e')][_0x4a78('0x32')]));_0x55f871[_0x4a78('0x33')]=_0x55f871[_0x4a78('0x33')][_0x4a78('0x34')]?_0x55f871[_0x4a78('0x33')]:_0x243a36[_0x4a78('0x31')];if(_0x21ee53['query']['includeAll']){_0x55f871['include']=[{'all':!![]}];}_0x55f871=_['merge']({},_0x55f871,_0x21ee53[_0x4a78('0x40')]);return db['CmCompany']['find'](_0x55f871)[_0x4a78('0x1f')](handleEntityNotFound(_0x38c4e5,null))['then'](respondWithResult(_0x38c4e5,null))[_0x4a78('0x45')](handleError(_0x38c4e5,null));};exports[_0x4a78('0x46')]=function(_0x371a04,_0x589d5c){return db[_0x4a78('0x29')]['create'](_0x371a04[_0x4a78('0x47')],{})[_0x4a78('0x1f')](function(_0x4a4570){var _0x48c8fb=_0x371a04[_0x4a78('0x48')]['get']({'plain':!![]});if(!_0x48c8fb)throw new Error(_0x4a78('0x49'));if(_0x48c8fb[_0x4a78('0x4a')]==='user'){var _0x50d157=_0x4a4570[_0x4a78('0x20')]({'plain':!![]});var _0x3c736a=_0x4a78('0x21');return db['UserProfileSection'][_0x4a78('0x4b')]({'where':{'name':_0x3c736a,'userProfileId':_0x48c8fb[_0x4a78('0x4c')]},'raw':!![]})[_0x4a78('0x1f')](function(_0xd1be64){if(_0xd1be64&&_0xd1be64['autoAssociation']===0x0){return db['UserProfileResource'][_0x4a78('0x46')]({'name':_0x50d157[_0x4a78('0x26')],'resourceId':_0x50d157['id'],'type':_0xd1be64[_0x4a78('0x26')],'sectionId':_0xd1be64['id']},{})[_0x4a78('0x1f')](function(){return _0x4a4570;});}else{return _0x4a4570;}})[_0x4a78('0x45')](function(_0x2acd77){logger['error'](_0x4a78('0x4d'),_0x2acd77);throw _0x2acd77;});}return _0x4a4570;})[_0x4a78('0x1f')](respondWithResult(_0x589d5c,0xc9))[_0x4a78('0x45')](handleError(_0x589d5c,null));};exports['update']=function(_0x1ec6ba,_0x94b1d9){if(_0x1ec6ba[_0x4a78('0x47')]['id']){delete _0x1ec6ba[_0x4a78('0x47')]['id'];}return db[_0x4a78('0x29')][_0x4a78('0x4b')]({'where':{'id':_0x1ec6ba[_0x4a78('0x44')]['id']}})['then'](handleEntityNotFound(_0x94b1d9,null))[_0x4a78('0x1f')](saveUpdates(_0x1ec6ba['body'],null))[_0x4a78('0x1f')](respondWithResult(_0x94b1d9,null))[_0x4a78('0x45')](handleError(_0x94b1d9,null));};exports[_0x4a78('0x22')]=function(_0x479174,_0x5692c7){return db['CmCompany'][_0x4a78('0x4b')]({'where':{'id':_0x479174[_0x4a78('0x44')]['id']}})[_0x4a78('0x1f')](handleEntityNotFound(_0x5692c7,null))['then'](removeEntity(_0x5692c7,null))[_0x4a78('0x45')](handleError(_0x5692c7,null));};exports[_0x4a78('0x4e')]=function(_0x1154c2,_0xb0b0f6,_0x32ad95){return db[_0x4a78('0x4f')][_0x4a78('0x4b')]({'where':{'id':_0x1154c2[_0x4a78('0x44')]['id']}})[_0x4a78('0x1f')](handleEntityNotFound(_0xb0b0f6,null))['then'](function(_0x1547d3){if(_0x1547d3){return _0x1547d3[_0x4a78('0x4e')](_0x1154c2[_0x4a78('0x47')][_0x4a78('0x50')],_[_0x4a78('0x51')](_0x1154c2['body'],[_0x4a78('0x50'),'id'])||{});}})[_0x4a78('0x1f')](respondWithResult(_0xb0b0f6,null))[_0x4a78('0x45')](handleError(_0xb0b0f6,null));};exports[_0x4a78('0x52')]=function(_0x34a968,_0x4d6d26,_0x130ed1){var _0x54b0b5={};var _0x27f9a6={};var _0x1e43bb;var _0x127269;return db[_0x4a78('0x29')][_0x4a78('0x53')]({'where':{'id':_0x34a968['params']['id']}})[_0x4a78('0x1f')](handleEntityNotFound(_0x4d6d26,null))[_0x4a78('0x1f')](function(_0x380b9c){if(_0x380b9c){_0x1e43bb=_0x380b9c;_0x27f9a6[_0x4a78('0x31')]=_[_0x4a78('0x2b')](db['CmContact'][_0x4a78('0x2a')]);_0x27f9a6[_0x4a78('0x2e')]=_[_0x4a78('0x2b')](_0x34a968[_0x4a78('0x2e')]);_0x27f9a6[_0x4a78('0x2f')]=_[_0x4a78('0x30')](_0x27f9a6[_0x4a78('0x31')],_0x27f9a6[_0x4a78('0x2e')]);_0x54b0b5[_0x4a78('0x33')]=_[_0x4a78('0x30')](_0x27f9a6[_0x4a78('0x31')],qs['fields'](_0x34a968['query'][_0x4a78('0x32')]));_0x54b0b5['attributes']=_0x54b0b5['attributes'][_0x4a78('0x34')]?_0x54b0b5[_0x4a78('0x33')]:_0x27f9a6['model'];_0x54b0b5[_0x4a78('0x37')]=qs[_0x4a78('0x38')](_0x34a968['query']['sort']);_0x54b0b5[_0x4a78('0x39')]=qs[_0x4a78('0x2f')](_['pick'](_0x34a968[_0x4a78('0x2e')],_0x27f9a6[_0x4a78('0x2f')]));if(_0x34a968[_0x4a78('0x2e')]['filter']){_0x54b0b5[_0x4a78('0x39')]=_['merge'](_0x54b0b5[_0x4a78('0x39')],{'$or':_[_0x4a78('0x3f')](_0x54b0b5[_0x4a78('0x33')],function(_0x7601f3){var _0x3e8fde={};_0x3e8fde[_0x7601f3]={'$like':'%'+_0x34a968[_0x4a78('0x2e')][_0x4a78('0x3e')]+'%'};return _0x3e8fde;})});}_0x54b0b5=_['merge']({},_0x54b0b5,_0x34a968[_0x4a78('0x40')]);return _0x1e43bb[_0x4a78('0x52')](_0x54b0b5);}})[_0x4a78('0x1f')](function(_0x22910a){if(_0x22910a){_0x127269=_0x22910a[_0x4a78('0x34')];if(!_0x34a968[_0x4a78('0x2e')][_0x4a78('0x35')](_0x4a78('0x36'))){_0x54b0b5[_0x4a78('0x19')]=qs[_0x4a78('0x19')](_0x34a968[_0x4a78('0x2e')][_0x4a78('0x19')]);_0x54b0b5[_0x4a78('0x18')]=qs[_0x4a78('0x18')](_0x34a968[_0x4a78('0x2e')][_0x4a78('0x18')]);}return _0x1e43bb[_0x4a78('0x52')](_0x54b0b5);}})[_0x4a78('0x1f')](function(_0x868179){if(_0x868179){return _0x868179?{'count':_0x127269,'rows':_0x868179}:null;}})[_0x4a78('0x1f')](respondWithResult(_0x4d6d26,null))[_0x4a78('0x45')](handleError(_0x4d6d26,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index db15f96..b00badb 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 _0x9099=['../../config/logger','api','moment','bluebird','request-promise','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash'];(function(_0x336757,_0x1723de){var _0x4074d2=function(_0x3b3d2a){while(--_0x3b3d2a){_0x336757['push'](_0x336757['shift']());}};_0x4074d2(++_0x1723de);}(_0x9099,0x1ac));var _0x9909=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9099[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x9909('0x0'));var util=require('util');var logger=require(_0x9909('0x1'))(_0x9909('0x2'));var moment=require(_0x9909('0x3'));var BPromise=require(_0x9909('0x4'));var rp=require(_0x9909('0x5'));var attributes=require(_0x9909('0x6'));module[_0x9909('0x7')]=function(_0x6eb0ac,_0x2369d1){return _0x6eb0ac[_0x9909('0x8')](_0x9909('0x9'),attributes,{'tableName':_0x9909('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde2c=['bluebird','request-promise','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment'];(function(_0x2c4aef,_0x116fe2){var _0x3deaed=function(_0x131052){while(--_0x131052){_0x2c4aef['push'](_0x2c4aef['shift']());}};_0x3deaed(++_0x116fe2);}(_0xde2c,0x7f));var _0xcde2=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0xde2c[_0x5f5cce];return _0x705ecf;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var moment=require(_0xcde2('0x4'));var BPromise=require(_0xcde2('0x5'));var rp=require(_0xcde2('0x6'));var attributes=require(_0xcde2('0x7'));module['exports']=function(_0x4353c8,_0x196898){return _0x4353c8[_0xcde2('0x8')](_0xcde2('0x9'),attributes,{'tableName':_0xcde2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 903e9d2..84fa93a 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 _0xb5ec=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x55836c,_0x3923ef){var _0x4e9c62=function(_0x40f923){while(--_0x40f923){_0x55836c['push'](_0x55836c['shift']());}};_0x4e9c62(++_0x3923ef);}(_0xb5ec,0x97));var _0xcb5e=function(_0x553644,_0x73981){_0x553644=_0x553644-0x0;var _0x26e7d0=_0xb5ec[_0x553644];return _0x26e7d0;};'use strict';var _=require(_0xcb5e('0x0'));var util=require(_0xcb5e('0x1'));var moment=require(_0xcb5e('0x2'));var BPromise=require(_0xcb5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb5e('0x4'));var db=require(_0xcb5e('0x5'))['db'];var utils=require(_0xcb5e('0x6'));var logger=require('../../config/logger')(_0xcb5e('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb5e('0x8'));var client=jayson[_0xcb5e('0x9')][_0xcb5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20e2a2,_0x1c449c,_0x3a51a8){return new BPromise(function(_0x1c9952,_0x3150be){return client[_0xcb5e('0xb')](_0x20e2a2,_0x3a51a8)[_0xcb5e('0xc')](function(_0x5d9e02){logger[_0xcb5e('0xd')](_0xcb5e('0xe'),_0x1c449c,_0xcb5e('0xf'));logger[_0xcb5e('0x10')](_0xcb5e('0x11'),_0x1c449c,_0xcb5e('0xf'),JSON[_0xcb5e('0x12')](_0x5d9e02));if(_0x5d9e02[_0xcb5e('0x13')]){if(_0x5d9e02['error'][_0xcb5e('0x14')]===0x1f4){logger[_0xcb5e('0x13')](_0xcb5e('0xe'),_0x1c449c,_0x5d9e02[_0xcb5e('0x13')][_0xcb5e('0x15')]);return _0x3150be(_0x5d9e02[_0xcb5e('0x13')]['message']);}logger[_0xcb5e('0x13')](_0xcb5e('0xe'),_0x1c449c,_0x5d9e02['error'][_0xcb5e('0x15')]);return _0x1c9952(_0x5d9e02[_0xcb5e('0x13')][_0xcb5e('0x15')]);}else{logger[_0xcb5e('0xd')](_0xcb5e('0xe'),_0x1c449c,_0xcb5e('0xf'));_0x1c9952(_0x5d9e02[_0xcb5e('0x16')][_0xcb5e('0x15')]);}})[_0xcb5e('0x17')](function(_0x2e7ba9){logger[_0xcb5e('0x13')]('CmCompany,\x20%s,\x20%s',_0x1c449c,_0x2e7ba9);_0x3150be(_0x2e7ba9);});});} \ No newline at end of file +var _0x2ed9=['client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x1bf4f9,_0x48a7b2){var _0x2f0a77=function(_0x353fce){while(--_0x353fce){_0x1bf4f9['push'](_0x1bf4f9['shift']());}};_0x2f0a77(++_0x48a7b2);}(_0x2ed9,0xf1));var _0x92ed=function(_0x48776a,_0x9af593){_0x48776a=_0x48776a-0x0;var _0x5d344b=_0x2ed9[_0x48776a];return _0x5d344b;};'use strict';var _=require('lodash');var util=require(_0x92ed('0x0'));var moment=require(_0x92ed('0x1'));var BPromise=require(_0x92ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92ed('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x92ed('0x4'));var logger=require(_0x92ed('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x92ed('0x6')][_0x92ed('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e8563,_0x5f38d3,_0x3bd909){return new BPromise(function(_0x3f4138,_0x13765c){return client[_0x92ed('0x8')](_0x5e8563,_0x3bd909)[_0x92ed('0x9')](function(_0x226ac0){logger['info'](_0x92ed('0xa'),_0x5f38d3,_0x92ed('0xb'));logger[_0x92ed('0xc')](_0x92ed('0xd'),_0x5f38d3,_0x92ed('0xb'),JSON[_0x92ed('0xe')](_0x226ac0));if(_0x226ac0[_0x92ed('0xf')]){if(_0x226ac0[_0x92ed('0xf')][_0x92ed('0x10')]===0x1f4){logger[_0x92ed('0xf')](_0x92ed('0xa'),_0x5f38d3,_0x226ac0[_0x92ed('0xf')][_0x92ed('0x11')]);return _0x13765c(_0x226ac0['error'][_0x92ed('0x11')]);}logger[_0x92ed('0xf')](_0x92ed('0xa'),_0x5f38d3,_0x226ac0['error'][_0x92ed('0x11')]);return _0x3f4138(_0x226ac0[_0x92ed('0xf')][_0x92ed('0x11')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x5f38d3,_0x92ed('0xb'));_0x3f4138(_0x226ac0['result'][_0x92ed('0x11')]);}})[_0x92ed('0x12')](function(_0x4c37c3){logger[_0x92ed('0xf')](_0x92ed('0xa'),_0x5f38d3,_0x4c37c3);_0x13765c(_0x4c37c3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 74171d0..6d41503 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 _0x8404=['../../config/environment','./cmCompany.controller','isAuthenticated','get','/:id','show','/:id/contacts','getContacts','create','post','addContacts','put','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x25f2be,_0x1965ac){var _0x3f1ca0=function(_0x106d66){while(--_0x106d66){_0x25f2be['push'](_0x25f2be['shift']());}};_0x3f1ca0(++_0x1965ac);}(_0x8404,0x112));var _0x4840=function(_0x8fdcac,_0x190a85){_0x8fdcac=_0x8fdcac-0x0;var _0x266800=_0x8404[_0x8fdcac];return _0x266800;};'use strict';var multer=require('multer');var util=require(_0x4840('0x0'));var path=require(_0x4840('0x1'));var timeout=require(_0x4840('0x2'));var express=require('express');var router=express[_0x4840('0x3')]();var auth=require(_0x4840('0x4'));var interaction=require(_0x4840('0x5'));var config=require(_0x4840('0x6'));var controller=require(_0x4840('0x7'));router['get']('/',auth[_0x4840('0x8')](),controller['index']);router[_0x4840('0x9')](_0x4840('0xa'),auth[_0x4840('0x8')](),controller[_0x4840('0xb')]);router['get'](_0x4840('0xc'),auth[_0x4840('0x8')](),controller[_0x4840('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4840('0xe')]);router[_0x4840('0xf')](_0x4840('0xc'),auth['isAuthenticated'](),controller[_0x4840('0x10')]);router[_0x4840('0x11')]('/:id',auth[_0x4840('0x8')](),controller['update']);router['delete'](_0x4840('0xa'),auth['isAuthenticated'](),controller[_0x4840('0x12')]);module[_0x4840('0x13')]=router; \ No newline at end of file +var _0x8689=['connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','exports','multer','util','path'];(function(_0x356299,_0x2fb1ed){var _0x3c4eed=function(_0x4db21c){while(--_0x4db21c){_0x356299['push'](_0x356299['shift']());}};_0x3c4eed(++_0x2fb1ed);}(_0x8689,0xa5));var _0x9868=function(_0x4cb921,_0x5ba51f){_0x4cb921=_0x4cb921-0x0;var _0x4497ca=_0x8689[_0x4cb921];return _0x4497ca;};'use strict';var multer=require(_0x9868('0x0'));var util=require(_0x9868('0x1'));var path=require(_0x9868('0x2'));var timeout=require(_0x9868('0x3'));var express=require(_0x9868('0x4'));var router=express[_0x9868('0x5')]();var auth=require(_0x9868('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x9868('0x7')]('/',auth[_0x9868('0x8')](),controller[_0x9868('0x9')]);router[_0x9868('0x7')](_0x9868('0xa'),auth['isAuthenticated'](),controller[_0x9868('0xb')]);router[_0x9868('0x7')](_0x9868('0xc'),auth[_0x9868('0x8')](),controller[_0x9868('0xd')]);router[_0x9868('0xe')]('/',auth[_0x9868('0x8')](),controller[_0x9868('0xf')]);router[_0x9868('0xe')](_0x9868('0xc'),auth[_0x9868('0x8')](),controller[_0x9868('0x10')]);router[_0x9868('0x11')](_0x9868('0xa'),auth[_0x9868('0x8')](),controller[_0x9868('0x12')]);router[_0x9868('0x13')](_0x9868('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9868('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 dbe49a8..3cb3f3c 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 _0x0c9a=['DATE','NOW','lodash','sequelize','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x2bb9c8,_0x2471c0){var _0x1d204f=function(_0x203ca3){while(--_0x203ca3){_0x2bb9c8['push'](_0x2bb9c8['shift']());}};_0x1d204f(++_0x2471c0);}(_0x0c9a,0x14a));var _0xa0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa0c9('0x0'));var Sequelize=require(_0xa0c9('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa0c9('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa0c9('0x2')]},'country':{'type':Sequelize[_0xa0c9('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa0c9('0x2')]},'description':{'type':Sequelize[_0xa0c9('0x3')]},'phone':{'type':Sequelize[_0xa0c9('0x2')]},'mobile':{'type':Sequelize[_0xa0c9('0x2')]},'fax':{'type':Sequelize[_0xa0c9('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xa0c9('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xa0c9('0x2')]},'twitter':{'type':Sequelize[_0xa0c9('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xa0c9('0x2')]},'viber':{'type':Sequelize[_0xa0c9('0x2')]},'line':{'type':Sequelize[_0xa0c9('0x2')]},'wechat':{'type':Sequelize[_0xa0c9('0x2')]},'telegram':{'type':Sequelize[_0xa0c9('0x2')]},'UserId':{'type':Sequelize[_0xa0c9('0x4')]},'priority':{'type':Sequelize[_0xa0c9('0x4')](0x2)[_0xa0c9('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa0c9('0x6')],'defaultValue':Sequelize[_0xa0c9('0x7')]}}; \ No newline at end of file +var _0x6dae=['DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x1b7763,_0x21f500){var _0x2c6633=function(_0x3a22d6){while(--_0x3a22d6){_0x1b7763['push'](_0x1b7763['shift']());}};_0x2c6633(++_0x21f500);}(_0x6dae,0x162));var _0xe6da=function(_0x5ca79e,_0x185d0e){_0x5ca79e=_0x5ca79e-0x0;var _0x8d5177=_0x6dae[_0x5ca79e];return _0x8d5177;};'use strict';var _=require('lodash');var Sequelize=require(_0xe6da('0x0'));module[_0xe6da('0x1')]={'firstName':{'type':Sequelize[_0xe6da('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe6da('0x2')]},'street':{'type':Sequelize[_0xe6da('0x2')]},'postalCode':{'type':Sequelize[_0xe6da('0x2')]},'city':{'type':Sequelize[_0xe6da('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe6da('0x3')]},'phone':{'type':Sequelize[_0xe6da('0x2')]},'mobile':{'type':Sequelize[_0xe6da('0x2')]},'fax':{'type':Sequelize[_0xe6da('0x2')]},'email':{'type':Sequelize[_0xe6da('0x2')]},'url':{'type':Sequelize[_0xe6da('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe6da('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xe6da('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe6da('0x2')]},'wechat':{'type':Sequelize[_0xe6da('0x2')]},'telegram':{'type':Sequelize[_0xe6da('0x2')]},'UserId':{'type':Sequelize[_0xe6da('0x4')]},'priority':{'type':Sequelize[_0xe6da('0x4')](0x2)[_0xe6da('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe6da('0x6')],'defaultValue':Sequelize[_0xe6da('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 7cbcac3..f33de7f 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 _0xae43=['offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','CmContact','describe','model','keys','dateStart','query','dateEnd','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','include','push','Tag','Tags','distinct','includeAll','color','tag','ThroughTags','findAll','rows','catch','find','params','startsWith','cf_','columnName','displayName','alias','body','from','get','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','info','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','ListId','findOrCreate','spread','show','CmCustomField','omit','format','cf_%d','$and','pickBy','table','cm_contacts','id\x20=\x20?','toParam','sequelize','text','values','phone','getTags','rawAttributes','setTags','findOne','ids','getHoppers','ContactId','getHopperHistories','getHopperFinals','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','path','parse','binding','../../components/import/cm/csv2','message','start\x20child\x20process\x20correctly!','html-pdf','eml-format','rimraf','request-promise','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count'];(function(_0xb02439,_0x1d3109){var _0x2a86d8=function(_0x415375){while(--_0x415375){_0xb02439['push'](_0xb02439['shift']());}};_0x2a86d8(++_0x1d3109);}(_0xae43,0x93));var _0x3ae4=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0xae43[_0x29dda1];return _0x21b0ef;};'use strict';var pdf=require(_0x3ae4('0x0'));var emlformat=require(_0x3ae4('0x1'));var rimraf=require(_0x3ae4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3ae4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3ae4('0x4'));var util=require(_0x3ae4('0x5'));var path=require('path');var sox=require(_0x3ae4('0x6'));var csv=require(_0x3ae4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3ae4('0x8'));var squel=require('squel');var crypto=require(_0x3ae4('0x9'));var jsforce=require(_0x3ae4('0xa'));var deskjs=require(_0x3ae4('0xb'));var toCsv=require(_0x3ae4('0x7'));var querystring=require('querystring');var Papa=require(_0x3ae4('0xc'));var Redis=require(_0x3ae4('0xd'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x3ae4('0xe'));var config=require('../../config/environment');var db=require(_0x3ae4('0xf'))['db'];config[_0x3ae4('0x10')]=_[_0x3ae4('0x11')](config[_0x3ae4('0x10')],{'host':_0x3ae4('0x12'),'port':0x18eb});var socket=require(_0x3ae4('0x13'))(new Redis(config[_0x3ae4('0x10')]));require('./cmContact.socket')[_0x3ae4('0x14')](socket);function respondWithStatusCode(_0x5c947d,_0x10dd23){_0x10dd23=_0x10dd23||0xcc;return function(_0x31c5e5){if(_0x31c5e5){return _0x5c947d[_0x3ae4('0x15')](_0x10dd23);}return _0x5c947d[_0x3ae4('0x16')](_0x10dd23)['end']();};}function respondWithResult(_0x343238,_0x41c6e6){_0x41c6e6=_0x41c6e6||0xc8;return function(_0x238e2c){if(_0x238e2c){return _0x343238['status'](_0x41c6e6)[_0x3ae4('0x17')](_0x238e2c);}};}function respondWithFilteredResult(_0x310f65,_0x237fab){return function(_0x2f6ff3){if(_0x2f6ff3){var _0x2c52aa=_0x2f6ff3[_0x3ae4('0x18')],_0x2a2ed6=_0x237fab[_0x3ae4('0x19')],_0x4a6981=_0x237fab[_0x3ae4('0x19')]+_0x237fab[_0x3ae4('0x1a')],_0x382c75;if(_0x4a6981>=_0x2c52aa){_0x4a6981=_0x2c52aa;_0x382c75=0xc8;}else{_0x382c75=0xce;}_0x310f65[_0x3ae4('0x16')](_0x382c75);return _0x310f65[_0x3ae4('0x1b')](_0x3ae4('0x1c'),_0x2a2ed6+'-'+_0x4a6981+'/'+_0x2c52aa)[_0x3ae4('0x17')](_0x2f6ff3);}return null;};}function patchUpdates(_0x5e93ac){return function(_0x1cf3c0){try{jsonpatch['apply'](_0x1cf3c0,_0x5e93ac,!![]);}catch(_0x2671ed){return BPromise[_0x3ae4('0x1d')](_0x2671ed);}return _0x1cf3c0[_0x3ae4('0x1e')]();};}function saveUpdates(_0x230408,_0x43f513){return function(_0x3ee391){if(_0x3ee391){return _0x3ee391[_0x3ae4('0x1f')](_0x230408)[_0x3ae4('0x20')](function(_0x13cd77){return _0x13cd77;});}return null;};}function removeEntity(_0x58cc79,_0x53af9d){return function(_0x402509){if(_0x402509){return _0x402509[_0x3ae4('0x21')]()[_0x3ae4('0x20')](function(){_0x58cc79[_0x3ae4('0x16')](0xcc)[_0x3ae4('0x22')]();});}};}function handleEntityNotFound(_0x522f2a,_0x2462c7){return function(_0xbb9bbe){if(!_0xbb9bbe){_0x522f2a[_0x3ae4('0x15')](0x194);}return _0xbb9bbe;};}function handleError(_0x5d0d02,_0x336e82){_0x336e82=_0x336e82||0x1f4;return function(_0x469868){logger[_0x3ae4('0x23')](_0x469868[_0x3ae4('0x24')]);if(_0x469868[_0x3ae4('0x25')]){delete _0x469868['name'];}_0x5d0d02[_0x3ae4('0x16')](_0x336e82)[_0x3ae4('0x26')](_0x469868);};}exports[_0x3ae4('0x27')]=function(_0x3d4737,_0x598c73){var _0x308610={},_0xb8d390={},_0x190e09={'count':0x0,'rows':[]};return db[_0x3ae4('0x28')][_0x3ae4('0x29')]()[_0x3ae4('0x20')](function(_0x407c53){_0xb8d390[_0x3ae4('0x2a')]=_[_0x3ae4('0x2b')](_0x407c53);var _0x30fdd1={'dateStart':_0x3d4737['query'][_0x3ae4('0x2c')],'dateEnd':_0x3d4737[_0x3ae4('0x2d')]['dateEnd']};delete _0x3d4737[_0x3ae4('0x2d')][_0x3ae4('0x2c')];delete _0x3d4737[_0x3ae4('0x2d')][_0x3ae4('0x2e')];_0xb8d390[_0x3ae4('0x2d')]=_[_0x3ae4('0x2b')](_0x3d4737[_0x3ae4('0x2d')]);_0xb8d390['filters']=_['intersection'](_0xb8d390['model'],_0xb8d390[_0x3ae4('0x2d')]);_0x308610[_0x3ae4('0x2f')]=_[_0x3ae4('0x30')](_0xb8d390[_0x3ae4('0x2a')],qs[_0x3ae4('0x31')](_0x3d4737[_0x3ae4('0x2d')][_0x3ae4('0x31')]));_0x308610[_0x3ae4('0x2f')]=_0x308610[_0x3ae4('0x2f')][_0x3ae4('0x32')]?_0x308610['attributes']:_0xb8d390[_0x3ae4('0x2a')];if(!_0x3d4737[_0x3ae4('0x2d')][_0x3ae4('0x33')](_0x3ae4('0x34'))){_0x308610['limit']=qs['limit'](_0x3d4737[_0x3ae4('0x2d')]['limit']);_0x308610[_0x3ae4('0x19')]=qs[_0x3ae4('0x19')](_0x3d4737[_0x3ae4('0x2d')][_0x3ae4('0x19')]);}_0x308610[_0x3ae4('0x35')]=qs['sort'](_0x3d4737[_0x3ae4('0x2d')][_0x3ae4('0x36')]);_0x308610[_0x3ae4('0x37')]=qs[_0x3ae4('0x38')](_[_0x3ae4('0x39')](_0x3d4737[_0x3ae4('0x2d')],_0xb8d390[_0x3ae4('0x38')]));if(_0x30fdd1['dateStart']){if(_0x30fdd1[_0x3ae4('0x2e')]){_0x30fdd1[_0x3ae4('0x2e')]=moment(_0x30fdd1[_0x3ae4('0x2e')])[_0x3ae4('0x3a')](0x1,'day');}else{_0x30fdd1[_0x3ae4('0x2e')]=moment(_0x30fdd1[_0x3ae4('0x2c')])[_0x3ae4('0x3a')](0x1,_0x3ae4('0x3b'));}_[_0x3ae4('0x3c')](_0x308610[_0x3ae4('0x37')],{'createdAt':{'$gte':_0x30fdd1['dateStart'],'$lte':_0x30fdd1[_0x3ae4('0x2e')]}});}if(_0x3d4737[_0x3ae4('0x2d')][_0x3ae4('0x3d')]){_0x308610[_0x3ae4('0x37')]=_[_0x3ae4('0x3c')](_0x308610['where'],{'$or':_[_0x3ae4('0x3e')](_0x308610[_0x3ae4('0x2f')],function(_0x289f2e){var _0x12b084={};_0x12b084[_0x289f2e]={'$like':'%'+_0x3d4737[_0x3ae4('0x2d')]['filter']+'%'};return _0x12b084;})});}_0x308610=_[_0x3ae4('0x3c')]({},_0x308610,_0x3d4737[_0x3ae4('0x3f')]);var _0x1d9fdd={'where':_0x308610[_0x3ae4('0x37')]};_0x1d9fdd[_0x3ae4('0x40')]=[];if(_0x3d4737[_0x3ae4('0x2d')]['tag']){_0x1d9fdd[_0x3ae4('0x40')][_0x3ae4('0x41')]({'model':db[_0x3ae4('0x42')],'as':_0x3ae4('0x43'),'attributes':['id'],'where':{'id':_0x3d4737[_0x3ae4('0x2d')]['tag']},'required':!![]});_0x1d9fdd[_0x3ae4('0x44')]=!![];}return db[_0x3ae4('0x28')][_0x3ae4('0x18')](_0x1d9fdd)[_0x3ae4('0x20')](function(_0x149738){_0x190e09[_0x3ae4('0x18')]=_0x149738;if(_0x3d4737[_0x3ae4('0x2d')][_0x3ae4('0x45')]){_0x308610[_0x3ae4('0x40')]=[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x3ae4('0x25'),_0x3ae4('0x46')],'required':_0x3d4737[_0x3ae4('0x2d')][_0x3ae4('0x47')]?!![]:![]},{'model':db['Tag'],'as':_0x3ae4('0x48'),'attributes':['id','name',_0x3ae4('0x46')],'through':_0x3d4737[_0x3ae4('0x2d')][_0x3ae4('0x47')]?{'attributes':[],'where':{'TagId':_0x3d4737[_0x3ae4('0x2d')]['tag']||undefined}}:{},'required':_0x3d4737['query'][_0x3ae4('0x47')]?!![]:![]}];}return db[_0x3ae4('0x28')][_0x3ae4('0x49')](_0x308610);})[_0x3ae4('0x20')](function(_0xc98b70){_0x190e09[_0x3ae4('0x4a')]=_0xc98b70;return _0x190e09;})[_0x3ae4('0x20')](respondWithFilteredResult(_0x598c73,_0x308610))[_0x3ae4('0x4b')](handleError(_0x598c73,null));});};exports[_0x3ae4('0x21')]=function(_0x339cdd,_0x2dbd48){return db['CmContact'][_0x3ae4('0x4c')]({'where':{'id':_0x339cdd[_0x3ae4('0x4d')]['id']}})[_0x3ae4('0x20')](handleEntityNotFound(_0x2dbd48,null))[_0x3ae4('0x20')](removeEntity(_0x2dbd48,null))['catch'](handleError(_0x2dbd48,null));};exports[_0x3ae4('0x29')]=function(_0x5eb329,_0x31f989){return db['CmContact'][_0x3ae4('0x29')]()[_0x3ae4('0x20')](function(_0x3a30aa){for(var _0x58c2d6=0x0;_0x58c2d6=_0x4f371d){_0x229f05=_0x4f371d;_0x300538=0xc8;}else{_0x300538=0xce;}_0x4003b7[_0xa30d('0x1f')](_0x300538);return _0x4003b7['set'](_0xa30d('0x22'),_0x56b361+'-'+_0x229f05+'/'+_0x4f371d)[_0xa30d('0x23')](_0x540bca);}return null;};}function patchUpdates(_0x2518a4){return function(_0x3c4eb2){try{jsonpatch[_0xa30d('0x24')](_0x3c4eb2,_0x2518a4,!![]);}catch(_0x4ba4fc){return BPromise[_0xa30d('0x25')](_0x4ba4fc);}return _0x3c4eb2[_0xa30d('0x26')]();};}function saveUpdates(_0x490231,_0x35e74b){return function(_0x2d4dc2){if(_0x2d4dc2){return _0x2d4dc2[_0xa30d('0x27')](_0x490231)['then'](function(_0x4c2754){return _0x4c2754;});}return null;};}function removeEntity(_0x788691,_0x2f99d7){return function(_0x54ffa1){if(_0x54ffa1){return _0x54ffa1[_0xa30d('0x28')]()[_0xa30d('0x29')](function(){_0x788691[_0xa30d('0x1f')](0xcc)[_0xa30d('0x2a')]();});}};}function handleEntityNotFound(_0x17d4a9,_0x937573){return function(_0xc3ded3){if(!_0xc3ded3){_0x17d4a9[_0xa30d('0x2b')](0x194);}return _0xc3ded3;};}function handleError(_0x4912b6,_0x356c05){_0x356c05=_0x356c05||0x1f4;return function(_0x76de9a){logger[_0xa30d('0x2c')](_0x76de9a['stack']);if(_0x76de9a[_0xa30d('0x2d')]){delete _0x76de9a[_0xa30d('0x2d')];}_0x4912b6[_0xa30d('0x1f')](_0x356c05)[_0xa30d('0x2e')](_0x76de9a);};}exports[_0xa30d('0x2f')]=function(_0x1c43b5,_0x36358e){var _0x35f1c2={},_0x33c352={},_0x2f5e29={'count':0x0,'rows':[]};return db[_0xa30d('0x30')][_0xa30d('0x31')]()[_0xa30d('0x29')](function(_0x39b01e){_0x33c352[_0xa30d('0x32')]=_['keys'](_0x39b01e);var _0x49f72b={'dateStart':_0x1c43b5[_0xa30d('0x33')][_0xa30d('0x34')],'dateEnd':_0x1c43b5[_0xa30d('0x33')]['dateEnd']};delete _0x1c43b5[_0xa30d('0x33')][_0xa30d('0x34')];delete _0x1c43b5[_0xa30d('0x33')][_0xa30d('0x35')];_0x33c352[_0xa30d('0x33')]=_[_0xa30d('0x36')](_0x1c43b5[_0xa30d('0x33')]);_0x33c352[_0xa30d('0x37')]=_[_0xa30d('0x38')](_0x33c352[_0xa30d('0x32')],_0x33c352[_0xa30d('0x33')]);_0x35f1c2[_0xa30d('0x39')]=_[_0xa30d('0x38')](_0x33c352['model'],qs['fields'](_0x1c43b5[_0xa30d('0x33')][_0xa30d('0x3a')]));_0x35f1c2[_0xa30d('0x39')]=_0x35f1c2[_0xa30d('0x39')][_0xa30d('0x3b')]?_0x35f1c2[_0xa30d('0x39')]:_0x33c352['model'];if(!_0x1c43b5['query'][_0xa30d('0x3c')](_0xa30d('0x3d'))){_0x35f1c2['limit']=qs[_0xa30d('0x3e')](_0x1c43b5[_0xa30d('0x33')][_0xa30d('0x3e')]);_0x35f1c2['offset']=qs[_0xa30d('0x21')](_0x1c43b5[_0xa30d('0x33')]['offset']);}_0x35f1c2[_0xa30d('0x3f')]=qs[_0xa30d('0x40')](_0x1c43b5[_0xa30d('0x33')][_0xa30d('0x40')]);_0x35f1c2[_0xa30d('0x41')]=qs[_0xa30d('0x37')](_[_0xa30d('0x42')](_0x1c43b5[_0xa30d('0x33')],_0x33c352[_0xa30d('0x37')]));if(_0x49f72b[_0xa30d('0x34')]){if(_0x49f72b[_0xa30d('0x35')]){_0x49f72b['dateEnd']=moment(_0x49f72b[_0xa30d('0x35')])[_0xa30d('0x43')](0x1,_0xa30d('0x44'));}else{_0x49f72b[_0xa30d('0x35')]=moment(_0x49f72b[_0xa30d('0x34')])[_0xa30d('0x43')](0x1,_0xa30d('0x44'));}_['merge'](_0x35f1c2[_0xa30d('0x41')],{'createdAt':{'$gte':_0x49f72b[_0xa30d('0x34')],'$lte':_0x49f72b[_0xa30d('0x35')]}});}if(_0x1c43b5[_0xa30d('0x33')][_0xa30d('0x45')]){_0x35f1c2[_0xa30d('0x41')]=_[_0xa30d('0x46')](_0x35f1c2[_0xa30d('0x41')],{'$or':_[_0xa30d('0x47')](_0x35f1c2[_0xa30d('0x39')],function(_0xe0f787){var _0x4393fa={};_0x4393fa[_0xe0f787]={'$like':'%'+_0x1c43b5['query'][_0xa30d('0x45')]+'%'};return _0x4393fa;})});}_0x35f1c2=_['merge']({},_0x35f1c2,_0x1c43b5['options']);var _0x255c2a={'where':_0x35f1c2['where']};_0x255c2a[_0xa30d('0x48')]=[];if(_0x1c43b5['query'][_0xa30d('0x49')]){_0x255c2a['include']['push']({'model':db['Tag'],'as':_0xa30d('0x4a'),'attributes':['id'],'where':{'id':_0x1c43b5[_0xa30d('0x33')]['tag']},'required':!![]});_0x255c2a['distinct']=!![];}return db['CmContact'][_0xa30d('0x20')](_0x255c2a)['then'](function(_0xefb190){_0x2f5e29[_0xa30d('0x20')]=_0xefb190;if(_0x1c43b5[_0xa30d('0x33')][_0xa30d('0x4b')]){_0x35f1c2['include']=[{'model':db[_0xa30d('0x4c')],'as':_0xa30d('0x4a'),'attributes':['id',_0xa30d('0x2d'),'color'],'required':_0x1c43b5[_0xa30d('0x33')][_0xa30d('0x49')]?!![]:![]},{'model':db[_0xa30d('0x4c')],'as':'ThroughTags','attributes':['id','name',_0xa30d('0x4d')],'through':_0x1c43b5[_0xa30d('0x33')][_0xa30d('0x49')]?{'attributes':[],'where':{'TagId':_0x1c43b5[_0xa30d('0x33')]['tag']||undefined}}:{},'required':_0x1c43b5[_0xa30d('0x33')][_0xa30d('0x49')]?!![]:![]}];}return db['CmContact'][_0xa30d('0x4e')](_0x35f1c2);})[_0xa30d('0x29')](function(_0x54b2e9){_0x2f5e29['rows']=_0x54b2e9;return _0x2f5e29;})[_0xa30d('0x29')](respondWithFilteredResult(_0x36358e,_0x35f1c2))['catch'](handleError(_0x36358e,null));});};exports['destroy']=function(_0x479fe1,_0x5997a4){return db[_0xa30d('0x30')][_0xa30d('0x4f')]({'where':{'id':_0x479fe1['params']['id']}})[_0xa30d('0x29')](handleEntityNotFound(_0x5997a4,null))[_0xa30d('0x29')](removeEntity(_0x5997a4,null))[_0xa30d('0x50')](handleError(_0x5997a4,null));};exports[_0xa30d('0x31')]=function(_0x508d19,_0x2bea33){return db[_0xa30d('0x30')][_0xa30d('0x31')]()[_0xa30d('0x29')](function(_0x125878){for(var _0x79b2bc=0x0;_0x79b2bc{}\s\\|]/g,'-');_0x28c1ba(null,util[_0x6b0b('0x1e')](_0x6b0b('0x1f'),path[_0x6b0b('0x20')](_0x830dc9[_0x6b0b('0x1d')],path['extname'](_0x830dc9[_0x6b0b('0x1d')])),Date['now'](),path[_0x6b0b('0x21')](_0x830dc9[_0x6b0b('0x1d')])));}})});router[_0x6b0b('0x13')](_0x6b0b('0x22'),upload[_0x6b0b('0x23')](_0x6b0b('0x24')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x6b0b('0x1a')]({'destination':function(_0x41d595,_0x54abb5,_0x577918){_0x577918(null,path[_0x6b0b('0x25')](config['root'],'server/files/tmp'));},'filename':function(_0xa2983b,_0x338ad7,_0x3abb4e){_0x338ad7[_0x6b0b('0x1d')]=_0x338ad7[_0x6b0b('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3abb4e(null,util[_0x6b0b('0x1e')](_0x6b0b('0x1f'),path[_0x6b0b('0x20')](_0x338ad7[_0x6b0b('0x1d')],path['extname'](_0x338ad7[_0x6b0b('0x1d')])),Date[_0x6b0b('0x26')](),path[_0x6b0b('0x21')](_0x338ad7[_0x6b0b('0x1d')])));}})});router[_0x6b0b('0x13')](_0x6b0b('0x27'),upload[_0x6b0b('0x23')](_0x6b0b('0x24')),controller[_0x6b0b('0x28')]);router[_0x6b0b('0x13')]('/upload/:id',auth[_0x6b0b('0xa')](),controller[_0x6b0b('0x29')]);router[_0x6b0b('0x2a')]('/:id',auth[_0x6b0b('0xa')](),controller['update']);router[_0x6b0b('0x2b')](_0x6b0b('0xc'),auth['isAuthenticated'](),controller[_0x6b0b('0x2c')]);module[_0x6b0b('0x2d')]=router; \ No newline at end of file +var _0x8fbd=['file','uploadCsv','/upload','upload','/upload/:id','import','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','/:id/tags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','create','/create_many','bulkCreate','diskStorage','join','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','single'];(function(_0x3f6dcd,_0x469d2c){var _0x410c69=function(_0x3f8c8c){while(--_0x3f8c8c){_0x3f6dcd['push'](_0x3f6dcd['shift']());}};_0x410c69(++_0x469d2c);}(_0x8fbd,0xf5));var _0xd8fb=function(_0x27fd5b,_0x316d40){_0x27fd5b=_0x27fd5b-0x0;var _0x2964b6=_0x8fbd[_0x27fd5b];return _0x2964b6;};'use strict';var multer=require(_0xd8fb('0x0'));var util=require(_0xd8fb('0x1'));var path=require(_0xd8fb('0x2'));var timeout=require(_0xd8fb('0x3'));var express=require(_0xd8fb('0x4'));var router=express[_0xd8fb('0x5')]();var auth=require(_0xd8fb('0x6'));var interaction=require(_0xd8fb('0x7'));var config=require(_0xd8fb('0x8'));var controller=require('./cmContact.controller');router[_0xd8fb('0x9')]('/',auth[_0xd8fb('0xa')](),controller['index']);router[_0xd8fb('0x9')](_0xd8fb('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd8fb('0x9')]('/:id',auth[_0xd8fb('0xa')](),controller[_0xd8fb('0xc')]);router[_0xd8fb('0x9')](_0xd8fb('0xd'),auth[_0xd8fb('0xa')](),controller['getTags']);router[_0xd8fb('0x9')](_0xd8fb('0xe'),auth['isAuthenticated'](),controller[_0xd8fb('0xf')]);router['get'](_0xd8fb('0x10'),auth[_0xd8fb('0xa')](),controller[_0xd8fb('0x11')]);router['get'](_0xd8fb('0x12'),auth[_0xd8fb('0xa')](),controller['getHopperFinals']);router[_0xd8fb('0x9')](_0xd8fb('0x13'),auth[_0xd8fb('0xa')](),controller[_0xd8fb('0x14')]);router[_0xd8fb('0x15')](_0xd8fb('0x16'),auth[_0xd8fb('0xa')](),controller['merge']);router[_0xd8fb('0x15')]('/',auth[_0xd8fb('0xa')](),controller[_0xd8fb('0x17')]);router[_0xd8fb('0x15')](_0xd8fb('0x18'),auth[_0xd8fb('0xa')](),controller[_0xd8fb('0x19')]);router[_0xd8fb('0x15')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);var upload=multer({'storage':multer[_0xd8fb('0x1a')]({'destination':function(_0xc2e56a,_0x49ffeb,_0x5da99e){_0x5da99e(null,path[_0xd8fb('0x1b')](config['root'],_0xd8fb('0x1c')));},'filename':function(_0x22768e,_0x1a7b95,_0x4079be){_0x1a7b95['originalname']=_0x1a7b95[_0xd8fb('0x1d')][_0xd8fb('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4079be(null,util[_0xd8fb('0x1f')](_0xd8fb('0x20'),path[_0xd8fb('0x21')](_0x1a7b95[_0xd8fb('0x1d')],path[_0xd8fb('0x22')](_0x1a7b95[_0xd8fb('0x1d')])),Date[_0xd8fb('0x23')](),path[_0xd8fb('0x22')](_0x1a7b95['originalname'])));}})});router[_0xd8fb('0x15')]('/csv',upload[_0xd8fb('0x24')](_0xd8fb('0x25')),controller[_0xd8fb('0x26')]);var upload=multer({'storage':multer[_0xd8fb('0x1a')]({'destination':function(_0x1fe3e5,_0x142663,_0xd323b2){_0xd323b2(null,path['join'](config['root'],_0xd8fb('0x1c')));},'filename':function(_0x34504e,_0x172b6b,_0x40ecc9){_0x172b6b[_0xd8fb('0x1d')]=_0x172b6b[_0xd8fb('0x1d')][_0xd8fb('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x40ecc9(null,util['format'](_0xd8fb('0x20'),path['basename'](_0x172b6b[_0xd8fb('0x1d')],path[_0xd8fb('0x22')](_0x172b6b[_0xd8fb('0x1d')])),Date['now'](),path[_0xd8fb('0x22')](_0x172b6b[_0xd8fb('0x1d')])));}})});router[_0xd8fb('0x15')](_0xd8fb('0x27'),upload['single'](_0xd8fb('0x25')),controller[_0xd8fb('0x28')]);router['post'](_0xd8fb('0x29'),auth[_0xd8fb('0xa')](),controller[_0xd8fb('0x2a')]);router[_0xd8fb('0x2b')](_0xd8fb('0x2c'),auth['isAuthenticated'](),controller[_0xd8fb('0x2d')]);router[_0xd8fb('0x2e')](_0xd8fb('0x2c'),auth[_0xd8fb('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 786c7c7..b38cebf 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 _0x151d=['isArray','stringify','BOOLEAN','sequelize','lodash','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','type','select','parse','values'];(function(_0x241d43,_0x262af3){var _0x228fbe=function(_0x2d0841){while(--_0x2d0841){_0x241d43['push'](_0x241d43['shift']());}};_0x228fbe(++_0x262af3);}(_0x151d,0x173));var _0xd151=function(_0x49ac7e,_0x88c4ab){_0x49ac7e=_0x49ac7e-0x0;var _0x269569=_0x151d[_0x49ac7e];return _0x269569;};'use strict';var Sequelize=require(_0xd151('0x0'));var _=require(_0xd151('0x1'));module['exports']={'name':{'type':Sequelize[_0xd151('0x2')],'get':function(_0x43b8d4){return this[_0xd151('0x3')]('alias');}},'alias':{'type':Sequelize[_0xd151('0x4')],'allowNull':![],'set':function(_0x23f1b8){this[_0xd151('0x5')](_0xd151('0x6'),_0x23f1b8?_0x23f1b8:this[_0xd151('0x3')](_0xd151('0x7')));}},'type':{'type':Sequelize[_0xd151('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xd151('0x8')]('long'),'get':function(){if(this[_0xd151('0x3')](_0xd151('0x9'))===_0xd151('0xa')){return JSON[_0xd151('0xb')](this[_0xd151('0x3')](_0xd151('0xc')));}else{return this[_0xd151('0x3')]('values');}},'set':function(_0x1850d5){if(Array[_0xd151('0xd')](_0x1850d5)){this[_0xd151('0x5')]('values',JSON[_0xd151('0xe')](_0x1850d5));}else{this[_0xd151('0x5')](_0xd151('0xc'),_0x1850d5);}}},'required':{'type':Sequelize[_0xd151('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x0a51=['VIRTUAL','getDataValue','STRING','name','TEXT','long','type','parse','values','isArray','stringify','setDataValue','BOOLEAN','sequelize','lodash','exports'];(function(_0x6fa44f,_0x334dc5){var _0x96eb21=function(_0x371742){while(--_0x371742){_0x6fa44f['push'](_0x6fa44f['shift']());}};_0x96eb21(++_0x334dc5);}(_0x0a51,0xcd));var _0x10a5=function(_0x31e407,_0x45c20a){_0x31e407=_0x31e407-0x0;var _0x120fe2=_0x0a51[_0x31e407];return _0x120fe2;};'use strict';var Sequelize=require(_0x10a5('0x0'));var _=require(_0x10a5('0x1'));module[_0x10a5('0x2')]={'name':{'type':Sequelize[_0x10a5('0x3')],'get':function(_0x5633cd){return this[_0x10a5('0x4')]('alias');}},'alias':{'type':Sequelize[_0x10a5('0x5')],'allowNull':![],'set':function(_0x2be6cc){this['setDataValue']('alias',_0x2be6cc?_0x2be6cc:this['getDataValue'](_0x10a5('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x10a5('0x7')](_0x10a5('0x8')),'get':function(){if(this[_0x10a5('0x4')](_0x10a5('0x9'))==='select'){return JSON[_0x10a5('0xa')](this[_0x10a5('0x4')](_0x10a5('0xb')));}else{return this[_0x10a5('0x4')](_0x10a5('0xb'));}},'set':function(_0x4a2a5f){if(Array[_0x10a5('0xc')](_0x4a2a5f)){this['setDataValue'](_0x10a5('0xb'),JSON[_0x10a5('0xd')](_0x4a2a5f));}else{this[_0x10a5('0xe')](_0x10a5('0xb'),_0x4a2a5f);}}},'required':{'type':Sequelize[_0x10a5('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index cce3d3c..8e43e4c 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 _0x0f5b=['include','findAll','rows','catch','show','params','length','includeAll','find','body','create','sequelize','transaction','type','text','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','CmCustomField','rawAttributes','differenceBy','keys','query','dateStart','dateEnd','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','add','day','merge','where','filter','map','options'];(function(_0x4e5a86,_0x11ad67){var _0x456b73=function(_0x24411e){while(--_0x24411e){_0x4e5a86['push'](_0x4e5a86['shift']());}};_0x456b73(++_0x11ad67);}(_0x0f5b,0x71));var _0xb0f5=function(_0x5878aa,_0x32bf6a){_0x5878aa=_0x5878aa-0x0;var _0x1243fd=_0x0f5b[_0x5878aa];return _0x1243fd;};'use strict';var pdf=require(_0xb0f5('0x0'));var emlformat=require(_0xb0f5('0x1'));var rimraf=require(_0xb0f5('0x2'));var zipdir=require(_0xb0f5('0x3'));var jsonpatch=require(_0xb0f5('0x4'));var rp=require(_0xb0f5('0x5'));var moment=require('moment');var BPromise=require(_0xb0f5('0x6'));var Mustache=require(_0xb0f5('0x7'));var util=require('util');var path=require(_0xb0f5('0x8'));var sox=require(_0xb0f5('0x9'));var csv=require(_0xb0f5('0xa'));var ejs=require(_0xb0f5('0xb'));var fs=require('fs');var _=require(_0xb0f5('0xc'));var squel=require(_0xb0f5('0xd'));var crypto=require(_0xb0f5('0xe'));var jsforce=require(_0xb0f5('0xf'));var deskjs=require(_0xb0f5('0x10'));var toCsv=require(_0xb0f5('0xa'));var querystring=require(_0xb0f5('0x11'));var Papa=require(_0xb0f5('0x12'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xb0f5('0x13'))(_0xb0f5('0x14'));var utils=require(_0xb0f5('0x15'));var config=require(_0xb0f5('0x16'));var db=require(_0xb0f5('0x17'))['db'];function respondWithStatusCode(_0x270904,_0x2ac04a){_0x2ac04a=_0x2ac04a||0xcc;return function(_0x3423f0){if(_0x3423f0){return _0x270904[_0xb0f5('0x18')](_0x2ac04a);}return _0x270904[_0xb0f5('0x19')](_0x2ac04a)[_0xb0f5('0x1a')]();};}function respondWithResult(_0x5a434b,_0x190216){_0x190216=_0x190216||0xc8;return function(_0x243898){if(_0x243898){return _0x5a434b[_0xb0f5('0x19')](_0x190216)['json'](_0x243898);}};}function respondWithFilteredResult(_0x284853,_0x297896){return function(_0x2cf6ac){if(_0x2cf6ac){var _0x565614=_0x2cf6ac[_0xb0f5('0x1b')],_0x363a5d=_0x297896[_0xb0f5('0x1c')],_0x3b2045=_0x297896[_0xb0f5('0x1c')]+_0x297896[_0xb0f5('0x1d')],_0x439189;if(_0x3b2045>=_0x565614){_0x3b2045=_0x565614;_0x439189=0xc8;}else{_0x439189=0xce;}_0x284853[_0xb0f5('0x19')](_0x439189);return _0x284853[_0xb0f5('0x1e')](_0xb0f5('0x1f'),_0x363a5d+'-'+_0x3b2045+'/'+_0x565614)[_0xb0f5('0x20')](_0x2cf6ac);}return null;};}function patchUpdates(_0x1147f9){return function(_0x52fb6b){try{jsonpatch[_0xb0f5('0x21')](_0x52fb6b,_0x1147f9,!![]);}catch(_0x3d5f96){return BPromise['reject'](_0x3d5f96);}return _0x52fb6b[_0xb0f5('0x22')]();};}function saveUpdates(_0x4a997d,_0x1b63f6){return function(_0x1f28d3){if(_0x1f28d3){return _0x1f28d3[_0xb0f5('0x23')](_0x4a997d)[_0xb0f5('0x24')](function(_0x25599e){return _0x25599e;});}return null;};}function removeEntity(_0x38afc9,_0x2c1222){return function(_0x4e0ad9){if(_0x4e0ad9){return _0x4e0ad9[_0xb0f5('0x25')]()[_0xb0f5('0x24')](function(){_0x38afc9['status'](0xcc)[_0xb0f5('0x1a')]();});}};}function handleEntityNotFound(_0x5b69dd,_0x4b16c1){return function(_0x22c633){if(!_0x22c633){_0x5b69dd[_0xb0f5('0x18')](0x194);}return _0x22c633;};}function handleError(_0x7a1573,_0x47df24){_0x47df24=_0x47df24||0x1f4;return function(_0x298c77){logger[_0xb0f5('0x26')](_0x298c77['stack']);if(_0x298c77[_0xb0f5('0x27')]){delete _0x298c77[_0xb0f5('0x27')];}_0x7a1573[_0xb0f5('0x19')](_0x47df24)[_0xb0f5('0x28')](_0x298c77);};}exports[_0xb0f5('0x29')]=function(_0x4b68a0,_0x35b839){var _0x5d04e3={},_0x411818={},_0x52907d={'count':0x0,'rows':[]};var _0x1e37bf=db[_0xb0f5('0x2a')][_0xb0f5('0x2b')];_0x411818['model']=_[_0xb0f5('0x2c')](_[_0xb0f5('0x2d')](_0x1e37bf),['name']);var _0x1339d4={'dateStart':_0x4b68a0[_0xb0f5('0x2e')][_0xb0f5('0x2f')],'dateEnd':_0x4b68a0[_0xb0f5('0x2e')][_0xb0f5('0x30')]};delete _0x4b68a0[_0xb0f5('0x2e')][_0xb0f5('0x2f')];delete _0x4b68a0['query']['dateEnd'];_0x411818['query']=_[_0xb0f5('0x2d')](_0x4b68a0[_0xb0f5('0x2e')]);_0x411818[_0xb0f5('0x31')]=_['intersection'](_0x411818[_0xb0f5('0x32')],_0x411818[_0xb0f5('0x2e')]);_0x5d04e3[_0xb0f5('0x33')]=_[_0xb0f5('0x34')](_0x411818[_0xb0f5('0x32')],qs[_0xb0f5('0x35')](_0x4b68a0[_0xb0f5('0x2e')][_0xb0f5('0x35')]));_0x5d04e3[_0xb0f5('0x33')]=_0x5d04e3['attributes']['length']?_0x5d04e3['attributes']:_0x411818[_0xb0f5('0x32')];if(!_0x4b68a0[_0xb0f5('0x2e')][_0xb0f5('0x36')](_0xb0f5('0x37'))){_0x5d04e3['limit']=qs[_0xb0f5('0x1d')](_0x4b68a0[_0xb0f5('0x2e')][_0xb0f5('0x1d')]);_0x5d04e3[_0xb0f5('0x1c')]=qs[_0xb0f5('0x1c')](_0x4b68a0[_0xb0f5('0x2e')][_0xb0f5('0x1c')]);}_0x5d04e3['order']=qs[_0xb0f5('0x38')](_0x4b68a0[_0xb0f5('0x2e')]['sort']);_0x5d04e3['where']=qs[_0xb0f5('0x31')](_[_0xb0f5('0x39')](_0x4b68a0[_0xb0f5('0x2e')],_0x411818[_0xb0f5('0x31')]));if(_0x1339d4[_0xb0f5('0x2f')]){if(_0x1339d4[_0xb0f5('0x30')]){_0x1339d4[_0xb0f5('0x30')]=moment(_0x1339d4[_0xb0f5('0x30')])[_0xb0f5('0x3a')](0x1,_0xb0f5('0x3b'));}else{_0x1339d4[_0xb0f5('0x30')]=moment(_0x1339d4[_0xb0f5('0x2f')])[_0xb0f5('0x3a')](0x1,_0xb0f5('0x3b'));}_[_0xb0f5('0x3c')](_0x5d04e3[_0xb0f5('0x3d')],{'createdAt':{'$gte':_0x1339d4[_0xb0f5('0x2f')],'$lte':_0x1339d4['dateEnd']}});}if(_0x4b68a0['query'][_0xb0f5('0x3e')]){_0x5d04e3[_0xb0f5('0x3d')]=_[_0xb0f5('0x3c')](_0x5d04e3[_0xb0f5('0x3d')],{'$or':_[_0xb0f5('0x3f')](_0x5d04e3['attributes'],function(_0x302002){var _0x480b83={};_0x480b83[_0x302002]={'$like':'%'+_0x4b68a0[_0xb0f5('0x2e')][_0xb0f5('0x3e')]+'%'};return _0x480b83;})});}_0x5d04e3=_[_0xb0f5('0x3c')]({},_0x5d04e3,_0x4b68a0[_0xb0f5('0x40')]);var _0x2ab66d={'where':_0x5d04e3[_0xb0f5('0x3d')]};return db['CmCustomField'][_0xb0f5('0x1b')](_0x2ab66d)[_0xb0f5('0x24')](function(_0x4d559a){_0x52907d[_0xb0f5('0x1b')]=_0x4d559a;if(_0x4b68a0[_0xb0f5('0x2e')]['includeAll']){_0x5d04e3[_0xb0f5('0x41')]=[{'all':!![]}];}return db[_0xb0f5('0x2a')][_0xb0f5('0x42')](_0x5d04e3);})[_0xb0f5('0x24')](function(_0x584b93){_0x52907d[_0xb0f5('0x43')]=_0x584b93;return _0x52907d;})[_0xb0f5('0x24')](respondWithFilteredResult(_0x35b839,_0x5d04e3))[_0xb0f5('0x44')](handleError(_0x35b839,null));};exports[_0xb0f5('0x45')]=function(_0x28196d,_0xe04ba3){var _0x5abf0f={'raw':!![],'where':{'id':_0x28196d[_0xb0f5('0x46')]['id']}},_0x4f63d1={};_0x4f63d1[_0xb0f5('0x32')]=_[_0xb0f5('0x2d')](db['CmCustomField']['rawAttributes']);_0x4f63d1[_0xb0f5('0x2e')]=_[_0xb0f5('0x2d')](_0x28196d[_0xb0f5('0x2e')]);_0x4f63d1['filters']=_['intersection'](_0x4f63d1[_0xb0f5('0x32')],_0x4f63d1[_0xb0f5('0x2e')]);_0x5abf0f['attributes']=_[_0xb0f5('0x34')](_0x4f63d1['model'],qs[_0xb0f5('0x35')](_0x28196d[_0xb0f5('0x2e')][_0xb0f5('0x35')]));_0x5abf0f[_0xb0f5('0x33')]=_0x5abf0f[_0xb0f5('0x33')][_0xb0f5('0x47')]?_0x5abf0f[_0xb0f5('0x33')]:_0x4f63d1[_0xb0f5('0x32')];if(_0x28196d[_0xb0f5('0x2e')][_0xb0f5('0x48')]){_0x5abf0f[_0xb0f5('0x41')]=[{'all':!![]}];}_0x5abf0f=_['merge']({},_0x5abf0f,_0x28196d['options']);return db[_0xb0f5('0x2a')][_0xb0f5('0x49')](_0x5abf0f)[_0xb0f5('0x24')](handleEntityNotFound(_0xe04ba3,null))[_0xb0f5('0x24')](respondWithResult(_0xe04ba3,null))[_0xb0f5('0x44')](handleError(_0xe04ba3,null));};exports[_0xb0f5('0x23')]=function(_0x201233,_0x4114ea){if(_0x201233[_0xb0f5('0x4a')]['id']){delete _0x201233[_0xb0f5('0x4a')]['id'];}return db[_0xb0f5('0x2a')]['find']({'where':{'id':_0x201233[_0xb0f5('0x46')]['id']}})[_0xb0f5('0x24')](handleEntityNotFound(_0x4114ea,null))['then'](saveUpdates(_0x201233[_0xb0f5('0x4a')],null))['then'](respondWithResult(_0x4114ea,null))['catch'](handleError(_0x4114ea,null));};exports[_0xb0f5('0x25')]=function(_0x17b28b,_0x1bd401){return db[_0xb0f5('0x2a')][_0xb0f5('0x49')]({'where':{'id':_0x17b28b[_0xb0f5('0x46')]['id']}})[_0xb0f5('0x24')](handleEntityNotFound(_0x1bd401,null))[_0xb0f5('0x24')](removeEntity(_0x1bd401,null))[_0xb0f5('0x44')](handleError(_0x1bd401,null));};exports[_0xb0f5('0x4b')]=function(_0x28d93e,_0x814c86){var _0x40deaa;return db[_0xb0f5('0x4c')][_0xb0f5('0x4d')](function(_0x48d277){return db[_0xb0f5('0x2a')][_0xb0f5('0x4b')](_0x28d93e[_0xb0f5('0x4a')],{'transaction':_0x48d277})[_0xb0f5('0x24')](function(_0xea102){_0x40deaa=_0xea102;var _0x4a1b26={'type':db['Sequelize']['TEXT'],'transaction':_0x48d277};switch(_0x28d93e[_0xb0f5('0x4a')][_0xb0f5('0x4e')]){case _0xb0f5('0x4f'):_0x4a1b26['type']=db[_0xb0f5('0x50')][_0xb0f5('0x51')];break;case _0xb0f5('0x52'):_0x4a1b26['type']=db['Sequelize'][_0xb0f5('0x53')];break;case _0xb0f5('0x54'):_0x4a1b26[_0xb0f5('0x4e')]=db[_0xb0f5('0x50')][_0xb0f5('0x55')];_0x4a1b26[_0xb0f5('0x56')]=![];break;default:}return db['sequelize']['queryInterface'][_0xb0f5('0x57')]('cm_contacts',util['format'](_0xb0f5('0x58'),_0x40deaa['id']),_0x4a1b26);})['then'](function(){return _0x40deaa;});})['then'](respondWithResult(_0x814c86,0xc9))[_0xb0f5('0x44')](handleError(_0x814c86,null));}; \ No newline at end of file +var _0x47fb=['dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','add','day','where','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','body','find','destroy','sequelize','Sequelize','TEXT','type','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','stack','name','index','CmCustomField','rawAttributes','model','differenceBy','keys','query','dateStart'];(function(_0x481847,_0x52e929){var _0x241970=function(_0x1bae69){while(--_0x1bae69){_0x481847['push'](_0x481847['shift']());}};_0x241970(++_0x52e929);}(_0x47fb,0x108));var _0xb47f=function(_0x59c359,_0x5ac83a){_0x59c359=_0x59c359-0x0;var _0x254b8d=_0x47fb[_0x59c359];return _0x254b8d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb47f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb47f('0x1'));var rp=require('request-promise');var moment=require(_0xb47f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb47f('0x3'));var util=require('util');var path=require('path');var sox=require(_0xb47f('0x4'));var csv=require(_0xb47f('0x5'));var ejs=require(_0xb47f('0x6'));var fs=require('fs');var _=require(_0xb47f('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb47f('0x8'));var toCsv=require('to-csv');var querystring=require(_0xb47f('0x9'));var Papa=require(_0xb47f('0xa'));var Redis=require(_0xb47f('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0xb47f('0xc'))(_0xb47f('0xd'));var utils=require('../../config/utils');var config=require(_0xb47f('0xe'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4eb52f,_0x1c5a30){_0x1c5a30=_0x1c5a30||0xcc;return function(_0x27e470){if(_0x27e470){return _0x4eb52f[_0xb47f('0xf')](_0x1c5a30);}return _0x4eb52f[_0xb47f('0x10')](_0x1c5a30)[_0xb47f('0x11')]();};}function respondWithResult(_0x23fbc4,_0x5696de){_0x5696de=_0x5696de||0xc8;return function(_0x4bfbdd){if(_0x4bfbdd){return _0x23fbc4[_0xb47f('0x10')](_0x5696de)[_0xb47f('0x12')](_0x4bfbdd);}};}function respondWithFilteredResult(_0x277260,_0x52670f){return function(_0x267c8a){if(_0x267c8a){var _0x2a915f=_0x267c8a[_0xb47f('0x13')],_0x4f4322=_0x52670f[_0xb47f('0x14')],_0x10ddf5=_0x52670f[_0xb47f('0x14')]+_0x52670f[_0xb47f('0x15')],_0x1fbcec;if(_0x10ddf5>=_0x2a915f){_0x10ddf5=_0x2a915f;_0x1fbcec=0xc8;}else{_0x1fbcec=0xce;}_0x277260[_0xb47f('0x10')](_0x1fbcec);return _0x277260['set']('Content-Range',_0x4f4322+'-'+_0x10ddf5+'/'+_0x2a915f)[_0xb47f('0x12')](_0x267c8a);}return null;};}function patchUpdates(_0x134b88){return function(_0x3454a6){try{jsonpatch['apply'](_0x3454a6,_0x134b88,!![]);}catch(_0x100b4f){return BPromise[_0xb47f('0x16')](_0x100b4f);}return _0x3454a6[_0xb47f('0x17')]();};}function saveUpdates(_0x4dc3ce,_0x1f77e5){return function(_0x27f587){if(_0x27f587){return _0x27f587[_0xb47f('0x18')](_0x4dc3ce)[_0xb47f('0x19')](function(_0x3b109b){return _0x3b109b;});}return null;};}function removeEntity(_0x185a17,_0x2ab73f){return function(_0x7d2f8e){if(_0x7d2f8e){return _0x7d2f8e['destroy']()[_0xb47f('0x19')](function(){_0x185a17[_0xb47f('0x10')](0xcc)[_0xb47f('0x11')]();});}};}function handleEntityNotFound(_0x542f69,_0x36b6a3){return function(_0x4f8174){if(!_0x4f8174){_0x542f69['sendStatus'](0x194);}return _0x4f8174;};}function handleError(_0x192837,_0x50db2a){_0x50db2a=_0x50db2a||0x1f4;return function(_0xf6f817){logger['error'](_0xf6f817[_0xb47f('0x1a')]);if(_0xf6f817['name']){delete _0xf6f817[_0xb47f('0x1b')];}_0x192837[_0xb47f('0x10')](_0x50db2a)['send'](_0xf6f817);};}exports[_0xb47f('0x1c')]=function(_0x1e7a97,_0x26f46e){var _0x14a31a={},_0x3647d9={},_0x2e7e70={'count':0x0,'rows':[]};var _0x432e3f=db[_0xb47f('0x1d')][_0xb47f('0x1e')];_0x3647d9[_0xb47f('0x1f')]=_[_0xb47f('0x20')](_[_0xb47f('0x21')](_0x432e3f),[_0xb47f('0x1b')]);var _0x174fa6={'dateStart':_0x1e7a97[_0xb47f('0x22')][_0xb47f('0x23')],'dateEnd':_0x1e7a97[_0xb47f('0x22')][_0xb47f('0x24')]};delete _0x1e7a97[_0xb47f('0x22')][_0xb47f('0x23')];delete _0x1e7a97[_0xb47f('0x22')][_0xb47f('0x24')];_0x3647d9[_0xb47f('0x22')]=_[_0xb47f('0x21')](_0x1e7a97[_0xb47f('0x22')]);_0x3647d9[_0xb47f('0x25')]=_['intersection'](_0x3647d9[_0xb47f('0x1f')],_0x3647d9[_0xb47f('0x22')]);_0x14a31a[_0xb47f('0x26')]=_[_0xb47f('0x27')](_0x3647d9[_0xb47f('0x1f')],qs[_0xb47f('0x28')](_0x1e7a97['query'][_0xb47f('0x28')]));_0x14a31a['attributes']=_0x14a31a[_0xb47f('0x26')][_0xb47f('0x29')]?_0x14a31a[_0xb47f('0x26')]:_0x3647d9[_0xb47f('0x1f')];if(!_0x1e7a97[_0xb47f('0x22')][_0xb47f('0x2a')](_0xb47f('0x2b'))){_0x14a31a['limit']=qs[_0xb47f('0x15')](_0x1e7a97[_0xb47f('0x22')][_0xb47f('0x15')]);_0x14a31a[_0xb47f('0x14')]=qs['offset'](_0x1e7a97[_0xb47f('0x22')][_0xb47f('0x14')]);}_0x14a31a[_0xb47f('0x2c')]=qs['sort'](_0x1e7a97[_0xb47f('0x22')]['sort']);_0x14a31a['where']=qs[_0xb47f('0x25')](_[_0xb47f('0x2d')](_0x1e7a97[_0xb47f('0x22')],_0x3647d9[_0xb47f('0x25')]));if(_0x174fa6[_0xb47f('0x23')]){if(_0x174fa6[_0xb47f('0x24')]){_0x174fa6[_0xb47f('0x24')]=moment(_0x174fa6[_0xb47f('0x24')])[_0xb47f('0x2e')](0x1,'day');}else{_0x174fa6['dateEnd']=moment(_0x174fa6[_0xb47f('0x23')])['add'](0x1,_0xb47f('0x2f'));}_['merge'](_0x14a31a[_0xb47f('0x30')],{'createdAt':{'$gte':_0x174fa6[_0xb47f('0x23')],'$lte':_0x174fa6['dateEnd']}});}if(_0x1e7a97[_0xb47f('0x22')][_0xb47f('0x31')]){_0x14a31a['where']=_[_0xb47f('0x32')](_0x14a31a[_0xb47f('0x30')],{'$or':_[_0xb47f('0x33')](_0x14a31a[_0xb47f('0x26')],function(_0x1e6d66){var _0x254f0e={};_0x254f0e[_0x1e6d66]={'$like':'%'+_0x1e7a97[_0xb47f('0x22')]['filter']+'%'};return _0x254f0e;})});}_0x14a31a=_[_0xb47f('0x32')]({},_0x14a31a,_0x1e7a97[_0xb47f('0x34')]);var _0x16e3d8={'where':_0x14a31a[_0xb47f('0x30')]};return db[_0xb47f('0x1d')][_0xb47f('0x13')](_0x16e3d8)[_0xb47f('0x19')](function(_0x226a2e){_0x2e7e70['count']=_0x226a2e;if(_0x1e7a97[_0xb47f('0x22')][_0xb47f('0x35')]){_0x14a31a[_0xb47f('0x36')]=[{'all':!![]}];}return db[_0xb47f('0x1d')][_0xb47f('0x37')](_0x14a31a);})[_0xb47f('0x19')](function(_0x23c58f){_0x2e7e70[_0xb47f('0x38')]=_0x23c58f;return _0x2e7e70;})[_0xb47f('0x19')](respondWithFilteredResult(_0x26f46e,_0x14a31a))[_0xb47f('0x39')](handleError(_0x26f46e,null));};exports[_0xb47f('0x3a')]=function(_0xe1177e,_0x5b1c65){var _0x312bd1={'raw':!![],'where':{'id':_0xe1177e[_0xb47f('0x3b')]['id']}},_0x5d78bf={};_0x5d78bf[_0xb47f('0x1f')]=_[_0xb47f('0x21')](db['CmCustomField'][_0xb47f('0x1e')]);_0x5d78bf[_0xb47f('0x22')]=_[_0xb47f('0x21')](_0xe1177e[_0xb47f('0x22')]);_0x5d78bf['filters']=_[_0xb47f('0x27')](_0x5d78bf[_0xb47f('0x1f')],_0x5d78bf[_0xb47f('0x22')]);_0x312bd1[_0xb47f('0x26')]=_[_0xb47f('0x27')](_0x5d78bf[_0xb47f('0x1f')],qs['fields'](_0xe1177e[_0xb47f('0x22')][_0xb47f('0x28')]));_0x312bd1[_0xb47f('0x26')]=_0x312bd1[_0xb47f('0x26')][_0xb47f('0x29')]?_0x312bd1[_0xb47f('0x26')]:_0x5d78bf[_0xb47f('0x1f')];if(_0xe1177e[_0xb47f('0x22')][_0xb47f('0x35')]){_0x312bd1[_0xb47f('0x36')]=[{'all':!![]}];}_0x312bd1=_[_0xb47f('0x32')]({},_0x312bd1,_0xe1177e[_0xb47f('0x34')]);return db[_0xb47f('0x1d')]['find'](_0x312bd1)[_0xb47f('0x19')](handleEntityNotFound(_0x5b1c65,null))[_0xb47f('0x19')](respondWithResult(_0x5b1c65,null))[_0xb47f('0x39')](handleError(_0x5b1c65,null));};exports[_0xb47f('0x18')]=function(_0x41c90b,_0x24088f){if(_0x41c90b[_0xb47f('0x3c')]['id']){delete _0x41c90b[_0xb47f('0x3c')]['id'];}return db['CmCustomField'][_0xb47f('0x3d')]({'where':{'id':_0x41c90b[_0xb47f('0x3b')]['id']}})[_0xb47f('0x19')](handleEntityNotFound(_0x24088f,null))[_0xb47f('0x19')](saveUpdates(_0x41c90b['body'],null))[_0xb47f('0x19')](respondWithResult(_0x24088f,null))[_0xb47f('0x39')](handleError(_0x24088f,null));};exports[_0xb47f('0x3e')]=function(_0x2ede17,_0x1fc2ec){return db[_0xb47f('0x1d')][_0xb47f('0x3d')]({'where':{'id':_0x2ede17[_0xb47f('0x3b')]['id']}})[_0xb47f('0x19')](handleEntityNotFound(_0x1fc2ec,null))[_0xb47f('0x19')](removeEntity(_0x1fc2ec,null))[_0xb47f('0x39')](handleError(_0x1fc2ec,null));};exports['create']=function(_0x29f201,_0x23073d){var _0xd783a3;return db[_0xb47f('0x3f')]['transaction'](function(_0x444971){return db[_0xb47f('0x1d')]['create'](_0x29f201[_0xb47f('0x3c')],{'transaction':_0x444971})[_0xb47f('0x19')](function(_0x310dec){_0xd783a3=_0x310dec;var _0x49f405={'type':db[_0xb47f('0x40')][_0xb47f('0x41')],'transaction':_0x444971};switch(_0x29f201[_0xb47f('0x3c')][_0xb47f('0x42')]){case _0xb47f('0x43'):_0x49f405['type']=db[_0xb47f('0x40')][_0xb47f('0x41')];break;case _0xb47f('0x44'):_0x49f405[_0xb47f('0x42')]=db[_0xb47f('0x40')]['INTEGER'];break;case _0xb47f('0x45'):_0x49f405[_0xb47f('0x42')]=db['Sequelize'][_0xb47f('0x46')];_0x49f405[_0xb47f('0x47')]=![];break;default:}return db[_0xb47f('0x3f')][_0xb47f('0x48')][_0xb47f('0x49')]('cm_contacts',util[_0xb47f('0x4a')]('cf_%d',_0xd783a3['id']),_0x49f405);})[_0xb47f('0x19')](function(){return _0xd783a3;});})[_0xb47f('0x19')](respondWithResult(_0x23073d,0xc9))[_0xb47f('0x39')](handleError(_0x23073d,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7eb84bb..ba9d3ba 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 _0x8883=['define','CmCustomField','lodash','api','moment','bluebird','exports'];(function(_0xbff286,_0x509402){var _0x27597e=function(_0x3ccff8){while(--_0x3ccff8){_0xbff286['push'](_0xbff286['shift']());}};_0x27597e(++_0x509402);}(_0x8883,0x6b));var _0x3888=function(_0x2fefbf,_0x454c76){_0x2fefbf=_0x2fefbf-0x0;var _0x4b4a51=_0x8883[_0x2fefbf];return _0x4b4a51;};'use strict';var _=require(_0x3888('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3888('0x1'));var moment=require(_0x3888('0x2'));var BPromise=require(_0x3888('0x3'));var rp=require('request-promise');var attributes=require('./cmCustomField.attributes');module[_0x3888('0x4')]=function(_0x1087ec,_0xc87021){return _0x1087ec[_0x3888('0x5')](_0x3888('0x6'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffe8=['moment','request-promise','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api'];(function(_0x570058,_0x1a8989){var _0x148c05=function(_0x2aaae5){while(--_0x2aaae5){_0x570058['push'](_0x570058['shift']());}};_0x148c05(++_0x1a8989);}(_0xffe8,0xec));var _0x8ffe=function(_0x207968,_0x11ba45){_0x207968=_0x207968-0x0;var _0x13d78c=_0xffe8[_0x207968];return _0x13d78c;};'use strict';var _=require(_0x8ffe('0x0'));var util=require(_0x8ffe('0x1'));var logger=require(_0x8ffe('0x2'))(_0x8ffe('0x3'));var moment=require(_0x8ffe('0x4'));var BPromise=require('bluebird');var rp=require(_0x8ffe('0x5'));var attributes=require('./cmCustomField.attributes');module[_0x8ffe('0x6')]=function(_0x2c3037,_0x2c305c){return _0x2c3037[_0x8ffe('0x7')](_0x8ffe('0x8'),attributes,{'tableName':_0x8ffe('0x9'),'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 59a7f5d..95f91c6 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 _0x8f80=['code','message','info','result','lodash','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x8f80,0xaf));var _0x08f8=function(_0xa444b6,_0x5c0cac){_0xa444b6=_0xa444b6-0x0;var _0x1755e1=_0x8f80[_0xa444b6];return _0x1755e1;};'use strict';var _=require(_0x08f8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x08f8('0x1'));var rs=require(_0x08f8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08f8('0x3'));var logger=require(_0x08f8('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x08f8('0x5'));var client=jayson[_0x08f8('0x6')][_0x08f8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x226396,_0xb5727c,_0x121558){return new BPromise(function(_0x414d8a,_0x5beeb7){return client[_0x08f8('0x8')](_0x226396,_0x121558)[_0x08f8('0x9')](function(_0x1e402a){logger['info'](_0x08f8('0xa'),_0xb5727c,'request\x20sent');logger['debug'](_0x08f8('0xb'),_0xb5727c,_0x08f8('0xc'),JSON[_0x08f8('0xd')](_0x1e402a));if(_0x1e402a[_0x08f8('0xe')]){if(_0x1e402a[_0x08f8('0xe')][_0x08f8('0xf')]===0x1f4){logger[_0x08f8('0xe')]('CmCustomField,\x20%s,\x20%s',_0xb5727c,_0x1e402a[_0x08f8('0xe')][_0x08f8('0x10')]);return _0x5beeb7(_0x1e402a['error'][_0x08f8('0x10')]);}logger[_0x08f8('0xe')]('CmCustomField,\x20%s,\x20%s',_0xb5727c,_0x1e402a[_0x08f8('0xe')][_0x08f8('0x10')]);return _0x414d8a(_0x1e402a[_0x08f8('0xe')]['message']);}else{logger[_0x08f8('0x11')](_0x08f8('0xa'),_0xb5727c,_0x08f8('0xc'));_0x414d8a(_0x1e402a[_0x08f8('0x12')]['message']);}})['catch'](function(_0x2ee733){logger['error'](_0x08f8('0xa'),_0xb5727c,_0x2ee733);_0x5beeb7(_0x2ee733);});});} \ No newline at end of file +var _0x45eb=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x45eb,0x126));var _0xb45e=function(_0x189989,_0x392303){_0x189989=_0x189989-0x0;var _0x289565=_0x45eb[_0x189989];return _0x289565;};'use strict';var _=require(_0xb45e('0x0'));var util=require(_0xb45e('0x1'));var moment=require('moment');var BPromise=require(_0xb45e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb45e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb45e('0x4'));var logger=require('../../config/logger')(_0xb45e('0x5'));var config=require(_0xb45e('0x6'));var jayson=require(_0xb45e('0x7'));var client=jayson[_0xb45e('0x8')][_0xb45e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55fda1,_0xea3e5,_0x30c10c){return new BPromise(function(_0x55cf2d,_0x1a7c0c){return client[_0xb45e('0xa')](_0x55fda1,_0x30c10c)[_0xb45e('0xb')](function(_0x160a1e){logger[_0xb45e('0xc')](_0xb45e('0xd'),_0xea3e5,_0xb45e('0xe'));logger[_0xb45e('0xf')](_0xb45e('0x10'),_0xea3e5,'request\x20sent',JSON[_0xb45e('0x11')](_0x160a1e));if(_0x160a1e[_0xb45e('0x12')]){if(_0x160a1e[_0xb45e('0x12')][_0xb45e('0x13')]===0x1f4){logger['error'](_0xb45e('0xd'),_0xea3e5,_0x160a1e['error']['message']);return _0x1a7c0c(_0x160a1e[_0xb45e('0x12')][_0xb45e('0x14')]);}logger[_0xb45e('0x12')](_0xb45e('0xd'),_0xea3e5,_0x160a1e[_0xb45e('0x12')][_0xb45e('0x14')]);return _0x55cf2d(_0x160a1e[_0xb45e('0x12')][_0xb45e('0x14')]);}else{logger['info'](_0xb45e('0xd'),_0xea3e5,_0xb45e('0xe'));_0x55cf2d(_0x160a1e['result'][_0xb45e('0x14')]);}})[_0xb45e('0x15')](function(_0x1b3901){logger[_0xb45e('0x12')](_0xb45e('0xd'),_0xea3e5,_0x1b3901);_0x1a7c0c(_0x1b3901);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5808c67..b05544b 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 _0xd45d=['show','post','create','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xd45d,0x17b));var _0xdd45=function(_0x481706,_0x2abe18){_0x481706=_0x481706-0x0;var _0x31e3b8=_0xd45d[_0x481706];return _0x31e3b8;};'use strict';var multer=require(_0xdd45('0x0'));var util=require(_0xdd45('0x1'));var path=require(_0xdd45('0x2'));var timeout=require(_0xdd45('0x3'));var express=require('express');var router=express[_0xdd45('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdd45('0x5'));var config=require('../../config/environment');var controller=require(_0xdd45('0x6'));router[_0xdd45('0x7')]('/',auth[_0xdd45('0x8')](),controller[_0xdd45('0x9')]);router[_0xdd45('0x7')](_0xdd45('0xa'),auth['isAuthenticated'](),controller[_0xdd45('0xb')]);router[_0xdd45('0xc')]('/',auth[_0xdd45('0x8')](),controller[_0xdd45('0xd')]);router['put'](_0xdd45('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xdd45('0x8')](),controller[_0xdd45('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5f39=['multer','util','connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3ed92c,_0x56595d){var _0x1898d5=function(_0x3da588){while(--_0x3da588){_0x3ed92c['push'](_0x3ed92c['shift']());}};_0x1898d5(++_0x56595d);}(_0x5f39,0x1ba));var _0x95f3=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5f39[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x95f3('0x0'));var util=require(_0x95f3('0x1'));var path=require('path');var timeout=require(_0x95f3('0x2'));var express=require(_0x95f3('0x3'));var router=express['Router']();var auth=require(_0x95f3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x95f3('0x5')]('/',auth[_0x95f3('0x6')](),controller[_0x95f3('0x7')]);router['get'](_0x95f3('0x8'),auth[_0x95f3('0x6')](),controller[_0x95f3('0x9')]);router[_0x95f3('0xa')]('/',auth['isAuthenticated'](),controller[_0x95f3('0xb')]);router[_0x95f3('0xc')](_0x95f3('0x8'),auth[_0x95f3('0x6')](),controller[_0x95f3('0xd')]);router[_0x95f3('0xe')](_0x95f3('0x8'),auth[_0x95f3('0x6')](),controller[_0x95f3('0xf')]);module[_0x95f3('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 965dbc6..5fc9c01 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 _0xe308=['UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING'];(function(_0x4ff4af,_0x1e0211){var _0x29eeba=function(_0x231469){while(--_0x231469){_0x4ff4af['push'](_0x4ff4af['shift']());}};_0x29eeba(++_0x1e0211);}(_0xe308,0x110));var _0x8e30=function(_0x48d57f,_0x289f80){_0x48d57f=_0x48d57f-0x0;var _0x5edfa1=_0xe308[_0x48d57f];return _0x5edfa1;};'use strict';var moment=require('moment');var Sequelize=require(_0x8e30('0x0'));module[_0x8e30('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x8e30('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8e30('0x3')],'defaultValue':moment()[_0x8e30('0x4')](_0x8e30('0x5'))},'countbusyretry':{'type':Sequelize[_0x8e30('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8e30('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8e30('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8e30('0x3')]},'priority':{'type':Sequelize[_0x8e30('0x6')](0x2)[_0x8e30('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8e30('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8e30('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8e30('0x6')],'unique':_0x8e30('0x9')},'UserId':{'type':Sequelize[_0x8e30('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x8e30('0x9')},'CampaignId':{'type':Sequelize[_0x8e30('0x6')]}}; \ No newline at end of file +var _0x6717=['contactListQueue','sequelize','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x315b9c,_0x183add){var _0x12246e=function(_0x339301){while(--_0x339301){_0x315b9c['push'](_0x315b9c['shift']());}};_0x12246e(++_0x183add);}(_0x6717,0x1a1));var _0x7671=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6717[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x7671('0x0'));module['exports']={'phone':{'type':Sequelize[_0x7671('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x7671('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7671('0x3')],'defaultValue':moment()[_0x7671('0x4')](_0x7671('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7671('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7671('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7671('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7671('0x6')],'unique':_0x7671('0x7')},'ListId':{'type':Sequelize[_0x7671('0x6')],'unique':_0x7671('0x7')},'UserId':{'type':Sequelize[_0x7671('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x7671('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index aec800d..90def6f 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 _0xe01c=['entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','end','name','index','CmHopper','rawAttributes','model','keys','query','dateStart','dateEnd','filters','concat','$and','$or','$lt','$lte','$ne','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','day','add','merge','where','map','includeAll','include','findAll','rows','catch','show','intersection','length','options','find','create','body','update','params','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','lastName','isNil','firstName','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe01c,0x11f));var _0xce01=function(_0xd6ec59,_0x659791){_0xd6ec59=_0xd6ec59-0x0;var _0x194d08=_0xe01c[_0xd6ec59];return _0x194d08;};'use strict';var pdf=require(_0xce01('0x0'));var emlformat=require(_0xce01('0x1'));var rimraf=require(_0xce01('0x2'));var zipdir=require(_0xce01('0x3'));var jsonpatch=require(_0xce01('0x4'));var rp=require(_0xce01('0x5'));var moment=require('moment');var BPromise=require(_0xce01('0x6'));var Mustache=require(_0xce01('0x7'));var util=require(_0xce01('0x8'));var path=require(_0xce01('0x9'));var sox=require(_0xce01('0xa'));var csv=require(_0xce01('0xb'));var ejs=require(_0xce01('0xc'));var fs=require('fs');var _=require(_0xce01('0xd'));var squel=require('squel');var crypto=require(_0xce01('0xe'));var jsforce=require(_0xce01('0xf'));var deskjs=require(_0xce01('0x10'));var toCsv=require('to-csv');var querystring=require(_0xce01('0x11'));var Papa=require(_0xce01('0x12'));var Redis=require('ioredis');var qs=require(_0xce01('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xce01('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e82b0,_0x4e0205){_0x4e0205=_0x4e0205||0xcc;return function(_0x12913c){if(_0x12913c){return _0x4e82b0[_0xce01('0x15')](_0x4e0205);}return _0x4e82b0['status'](_0x4e0205)['end']();};}function respondWithResult(_0x2fce4e,_0x2cd2b0){_0x2cd2b0=_0x2cd2b0||0xc8;return function(_0x255f8f){if(_0x255f8f){return _0x2fce4e[_0xce01('0x16')](_0x2cd2b0)['json'](_0x255f8f);}};}function respondWithFilteredResult(_0x474d07,_0x2c2076){return function(_0x2c7118){if(_0x2c7118){var _0x397746=_0x2c7118[_0xce01('0x17')],_0x367a24=_0x2c2076[_0xce01('0x18')],_0x3b1e21=_0x2c2076[_0xce01('0x18')]+_0x2c2076[_0xce01('0x19')],_0x5d7952;if(_0x3b1e21>=_0x397746){_0x3b1e21=_0x397746;_0x5d7952=0xc8;}else{_0x5d7952=0xce;}_0x474d07['status'](_0x5d7952);return _0x474d07[_0xce01('0x1a')](_0xce01('0x1b'),_0x367a24+'-'+_0x3b1e21+'/'+_0x397746)[_0xce01('0x1c')](_0x2c7118);}return null;};}function patchUpdates(_0x15c7c4){return function(_0xc4969b){try{jsonpatch[_0xce01('0x1d')](_0xc4969b,_0x15c7c4,!![]);}catch(_0x1e8b74){return BPromise[_0xce01('0x1e')](_0x1e8b74);}return _0xc4969b['save']();};}function saveUpdates(_0x134bd0,_0x58ca77){return function(_0xac7a29){if(_0xac7a29){return _0xac7a29['update'](_0x134bd0)[_0xce01('0x1f')](function(_0x29e9ee){return _0x29e9ee;});}return null;};}function removeEntity(_0x582ad1,_0x52dd34){return function(_0x297e02){if(_0x297e02){return _0x297e02[_0xce01('0x20')]()[_0xce01('0x1f')](function(){_0x582ad1[_0xce01('0x16')](0xcc)[_0xce01('0x21')]();});}};}function handleEntityNotFound(_0x47660b,_0x28b604){return function(_0x265279){if(!_0x265279){_0x47660b[_0xce01('0x15')](0x194);}return _0x265279;};}function handleError(_0x23203e,_0x521ba5){_0x521ba5=_0x521ba5||0x1f4;return function(_0x3f05e1){logger['error'](_0x3f05e1['stack']);if(_0x3f05e1[_0xce01('0x22')]){delete _0x3f05e1[_0xce01('0x22')];}_0x23203e[_0xce01('0x16')](_0x521ba5)['send'](_0x3f05e1);};}exports[_0xce01('0x23')]=function(_0xd269d3,_0x54aa2c){var _0x1f1e2a={},_0x23bf0b={},_0xf3c0ed={'count':0x0,'rows':[]};var _0xe8d274=db[_0xce01('0x24')][_0xce01('0x25')];_0x23bf0b[_0xce01('0x26')]=_[_0xce01('0x27')](_0xe8d274);var _0x436aae={'dateStart':_0xd269d3[_0xce01('0x28')][_0xce01('0x29')],'dateEnd':_0xd269d3[_0xce01('0x28')][_0xce01('0x2a')]};delete _0xd269d3['query'][_0xce01('0x29')];delete _0xd269d3[_0xce01('0x28')][_0xce01('0x2a')];_0x23bf0b[_0xce01('0x28')]=_[_0xce01('0x27')](_0xd269d3[_0xce01('0x28')]);_0x23bf0b[_0xce01('0x2b')]=_['intersection'](_0x23bf0b[_0xce01('0x26')],_0x23bf0b['query']);_0x23bf0b[_0xce01('0x2b')]=_[_0xce01('0x2c')](_0x23bf0b[_0xce01('0x2b')],[_0xce01('0x2d'),_0xce01('0x2e'),'$gt','$gte',_0xce01('0x2f'),_0xce01('0x30'),_0xce01('0x31'),_0xce01('0x32'),'$not','$between',_0xce01('0x33'),_0xce01('0x34'),_0xce01('0x35'),_0xce01('0x36'),_0xce01('0x37'),_0xce01('0x38'),'$notILike',_0xce01('0x36'),'$overlap',_0xce01('0x39'),_0xce01('0x3a'),_0xce01('0x3b')]);_0x1f1e2a[_0xce01('0x3c')]=_['intersection'](_0x23bf0b['model'],qs[_0xce01('0x3d')](_0xd269d3[_0xce01('0x28')][_0xce01('0x3d')]));_0x1f1e2a['attributes']=_0x1f1e2a['attributes']['length']?_0x1f1e2a[_0xce01('0x3c')]:_0x23bf0b[_0xce01('0x26')];if(!_0xd269d3[_0xce01('0x28')][_0xce01('0x3e')](_0xce01('0x3f'))){_0x1f1e2a['limit']=qs[_0xce01('0x19')](_0xd269d3[_0xce01('0x28')][_0xce01('0x19')]);_0x1f1e2a[_0xce01('0x18')]=qs[_0xce01('0x18')](_0xd269d3[_0xce01('0x28')][_0xce01('0x18')]);}_0x1f1e2a[_0xce01('0x40')]=qs[_0xce01('0x41')](_0xd269d3['query'][_0xce01('0x41')]);_0x1f1e2a['where']=qs[_0xce01('0x2b')](_[_0xce01('0x42')](_0xd269d3[_0xce01('0x28')],_0x23bf0b[_0xce01('0x2b')]));if(_0x436aae[_0xce01('0x29')]){if(_0x436aae[_0xce01('0x2a')]){_0x436aae[_0xce01('0x2a')]=moment(_0x436aae[_0xce01('0x2a')])['add'](0x1,_0xce01('0x43'));}else{_0x436aae[_0xce01('0x2a')]=moment(_0x436aae[_0xce01('0x29')])[_0xce01('0x44')](0x1,'day');}_[_0xce01('0x45')](_0x1f1e2a[_0xce01('0x46')],{'createdAt':{'$gte':_0x436aae[_0xce01('0x29')],'$lte':_0x436aae[_0xce01('0x2a')]}});}if(_0xd269d3[_0xce01('0x28')]['filter']){_0x1f1e2a[_0xce01('0x46')]=_[_0xce01('0x45')](_0x1f1e2a['where'],{'$or':_[_0xce01('0x47')](_0x1f1e2a[_0xce01('0x3c')],function(_0x3bf493){var _0x4ca027={};_0x4ca027[_0x3bf493]={'$like':'%'+_0xd269d3[_0xce01('0x28')]['filter']+'%'};return _0x4ca027;})});}_0x1f1e2a=_['merge']({},_0x1f1e2a,_0xd269d3['options']);var _0x1a7e0c={'where':_0x1f1e2a[_0xce01('0x46')]};return db[_0xce01('0x24')][_0xce01('0x17')](_0x1a7e0c)[_0xce01('0x1f')](function(_0x2f0e54){_0xf3c0ed['count']=_0x2f0e54;if(_0xd269d3['query'][_0xce01('0x48')]){_0x1f1e2a[_0xce01('0x49')]=[{'all':!![]}];}return db[_0xce01('0x24')][_0xce01('0x4a')](_0x1f1e2a);})[_0xce01('0x1f')](function(_0x2d1fe1){_0xf3c0ed[_0xce01('0x4b')]=_0x2d1fe1;return _0xf3c0ed;})['then'](respondWithFilteredResult(_0x54aa2c,_0x1f1e2a))[_0xce01('0x4c')](handleError(_0x54aa2c,null));};exports[_0xce01('0x4d')]=function(_0x1a5d82,_0x467738){var _0x1bf459={'raw':!![],'where':{'id':_0x1a5d82['params']['id']}},_0x3506e6={};_0x3506e6['model']=_['keys'](db['CmHopper'][_0xce01('0x25')]);_0x3506e6[_0xce01('0x28')]=_['keys'](_0x1a5d82[_0xce01('0x28')]);_0x3506e6[_0xce01('0x2b')]=_[_0xce01('0x4e')](_0x3506e6['model'],_0x3506e6[_0xce01('0x28')]);_0x1bf459['attributes']=_[_0xce01('0x4e')](_0x3506e6[_0xce01('0x26')],qs['fields'](_0x1a5d82[_0xce01('0x28')][_0xce01('0x3d')]));_0x1bf459['attributes']=_0x1bf459['attributes'][_0xce01('0x4f')]?_0x1bf459[_0xce01('0x3c')]:_0x3506e6[_0xce01('0x26')];if(_0x1a5d82['query'][_0xce01('0x48')]){_0x1bf459[_0xce01('0x49')]=[{'all':!![]}];}_0x1bf459=_[_0xce01('0x45')]({},_0x1bf459,_0x1a5d82[_0xce01('0x50')]);return db[_0xce01('0x24')][_0xce01('0x51')](_0x1bf459)[_0xce01('0x1f')](handleEntityNotFound(_0x467738,null))[_0xce01('0x1f')](respondWithResult(_0x467738,null))[_0xce01('0x4c')](handleError(_0x467738,null));};exports[_0xce01('0x52')]=function(_0x2adf59,_0x35717f){return db[_0xce01('0x24')][_0xce01('0x52')](_0x2adf59[_0xce01('0x53')],{})[_0xce01('0x1f')](respondWithResult(_0x35717f,0xc9))['catch'](handleError(_0x35717f,null));};exports[_0xce01('0x54')]=function(_0x2c3080,_0x52d277){if(_0x2c3080[_0xce01('0x53')]['id']){delete _0x2c3080['body']['id'];}return db[_0xce01('0x24')][_0xce01('0x51')]({'where':{'id':_0x2c3080[_0xce01('0x55')]['id']}})[_0xce01('0x1f')](handleEntityNotFound(_0x52d277,null))[_0xce01('0x1f')](saveUpdates(_0x2c3080[_0xce01('0x53')],null))[_0xce01('0x1f')](respondWithResult(_0x52d277,null))[_0xce01('0x4c')](handleError(_0x52d277,null));};exports[_0xce01('0x56')]=function(_0x3e47cf,_0x41850e){return db[_0xce01('0x24')][_0xce01('0x56')]()[_0xce01('0x1f')](respondWithResult(_0x41850e,null))[_0xce01('0x4c')](handleError(_0x41850e,null));};exports[_0xce01('0x20')]=function(_0x2ef819,_0x38aa53){var _0x467adf;return db[_0xce01('0x24')][_0xce01('0x51')]({'where':{'id':_0x2ef819['params']['id']}})[_0xce01('0x1f')](handleEntityNotFound(_0x38aa53,null))[_0xce01('0x1f')](function(_0x1aa50c){if(_0x1aa50c){return _0x1aa50c[_0xce01('0x20')]()[_0xce01('0x1f')](function(_0x516895){return _0x516895;});}})['then'](function(_0x4af950){_0x467adf=_0x4af950;if(_0x4af950){if(_0x4af950[_0xce01('0x57')]||_0x4af950['CampaignId']){return db[_0x4af950['VoiceQueueId']?_0xce01('0x58'):_0xce01('0x59')][_0xce01('0x51')]({'where':{'id':_0x4af950[_0xce01('0x57')]?_0x4af950['VoiceQueueId']:_0x4af950[_0xce01('0x5a')]},'attributes':['id',_0xce01('0x22')],'raw':!![]});}}})[_0xce01('0x1f')](function(_0x26957f){var _0x15a9a5={};if(_0x26957f){_[_0xce01('0x45')](_0x15a9a5,_[_0xce01('0x5b')](_0x467adf[_0xce01('0x5c')],[_0xce01('0x5d'),_0xce01('0x5e'),'id']));_0x15a9a5[_0xce01('0x5f')]=0x15;_0x15a9a5[_0xce01('0x60')]=_0xce01('0x61');_0x15a9a5['campaign']=_0x26957f[_0xce01('0x22')];_0x15a9a5[_0xce01('0x62')]=_0x2ef819[_0xce01('0x63')][_0xce01('0x22')];_0x15a9a5[_0xce01('0x64')]=_0x2ef819[_0xce01('0x63')]['id'];_0x15a9a5['deleted']=!![];_0x15a9a5[_0xce01('0x65')]=moment()[_0xce01('0x66')](_0xce01('0x67'));_0x15a9a5[_0xce01('0x68')]=_0x467adf[_0xce01('0x69')];_0x15a9a5[_0xce01('0x6a')]=_0x467adf['VoiceQueueId']?_0xce01('0x6b'):_0xce01('0x6c');return db[_0xce01('0x6d')]['find']({'where':{'id':_0x15a9a5['ContactId']},'attributes':['firstName',_0xce01('0x6e')]})['then'](function(_0x12ad06){if(!_['isNil'](_0x38aa53)&&!_[_0xce01('0x6f')](_0x12ad06['firstName'])){_0x15a9a5['calleridname']=_0x12ad06[_0xce01('0x70')];if(!_[_0xce01('0x6f')](_0x12ad06[_0xce01('0x6e')])){_0x15a9a5['calleridname']+='\x20'+_0x12ad06[_0xce01('0x6e')];}}})['finally'](function(){return db['CmHopperFinal'][_0xce01('0x52')](_0x15a9a5);});}})[_0xce01('0x1f')](function(){return _0x38aa53[_0xce01('0x16')](0xcc)['end']();})[_0xce01('0x4c')](handleError(_0x38aa53,null));};exports['getPreview']=function(_0x209e16,_0x288ef2,_0x25ed0b){var _0x5e0dd7=[];return db[_0xce01('0x6d')][_0xce01('0x56')]()['then'](function(_0x5780b6){_0x5e0dd7=_[_0xce01('0x27')](_0x5780b6);return _0x209e16[_0xce01('0x63')][_0xce01('0x71')]({'where':{'type':_0xce01('0x72'),'dialActive':!![],'dialMethod':_0xce01('0x73')},'attributes':['id',_0xce01('0x74')],'raw':!![]});})[_0xce01('0x1f')](function(_0x5d5073){if(_0x5d5073&&_0x5d5073[_0xce01('0x4f')]){return db[_0xce01('0x75')][_0xce01('0x76')](function(_0x47274b){var _0x39891f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xce01('0x67'))},'VoiceQueueId':{'$in':_[_0xce01('0x47')](_0x5d5073,'id')},'$or':[{'UserId':null},{'UserId':_0x209e16['user']['id']}]};var _0x56e1c7=[];if(_0x209e16[_0xce01('0x53')][_0xce01('0x77')]&&_0x209e16[_0xce01('0x53')][_0xce01('0x77')]==='prev'){if(!_[_0xce01('0x78')](_0x209e16[_0xce01('0x53')][_0xce01('0x79')])){_0x39891f['id']={'$in':_0x209e16['body'][_0xce01('0x79')]};}_0x56e1c7=[[_0xce01('0x7a'),_0xce01('0x7b')],[_0xce01('0x7c'),_0x5d5073[0x0][_0xce01('0x74')]===_0xce01('0x7b')?_0xce01('0x7d'):_0xce01('0x7b')],db['sequelize'][_0xce01('0x7e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xce01('0x7d')]];}else{if(!_[_0xce01('0x78')](_0x209e16[_0xce01('0x53')][_0xce01('0x79')])){_0x39891f['id']={'$notIn':_0x209e16[_0xce01('0x53')][_0xce01('0x79')]};}_0x56e1c7=[['priority','DESC'],['scheduledAt',_0x5d5073[0x0][_0xce01('0x74')]],db[_0xce01('0x75')][_0xce01('0x7e')](_0xce01('0x7f')),['id',_0xce01('0x7b')]];}return db[_0xce01('0x24')]['findOne']({'attributes':['id',_0xce01('0x80')],'where':_0x39891f,'order':_0x56e1c7,'transaction':_0x47274b,'lock':_0x47274b[_0xce01('0x81')][_0xce01('0x82')],'include':[{'model':db[_0xce01('0x6d')],'as':_0xce01('0x83'),'attributes':_0x5e0dd7,'include':[{'model':db[_0xce01('0x84')],'as':_0xce01('0x85'),'attributes':['id',_0xce01('0x22')]}]},{'model':db[_0xce01('0x86')],'as':_0xce01('0x87'),'attributes':['id',_0xce01('0x22')]},{'model':db[_0xce01('0x58')],'as':_0xce01('0x88'),'attributes':['id',_0xce01('0x22'),_0xce01('0x89')]}]})[_0xce01('0x1f')](function(_0x5fe407){if(_0x5fe407){return _0x5fe407['update']({'UserId':_0x209e16[_0xce01('0x63')]['id']},{'transaction':_0x47274b});}});});}})[_0xce01('0x1f')](handleEntityNotFound(_0x288ef2,null))[_0xce01('0x1f')](respondWithResult(_0x288ef2,null))['catch'](handleError(_0x288ef2,null));};exports['getOpenContacts']=function(_0x140ff3,_0x1e894b,_0x125048){return _0x140ff3['user']['getVoiceQueues']({'where':{'type':_0xce01('0x72'),'dialActive':!![],'dialMethod':_0xce01('0x73')},'attributes':['id'],'raw':!![]})[_0xce01('0x1f')](function(_0x5275d9){if(_0x5275d9&&_0x5275d9[_0xce01('0x4f')]){return db[_0xce01('0x24')][_0xce01('0x17')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xce01('0x66')](_0xce01('0x67'))},'VoiceQueueId':{'$in':_['map'](_0x5275d9,'id')},'$or':[{'UserId':null},{'UserId':_0x140ff3[_0xce01('0x63')]['id']}]}});}return 0x0;})['then'](function(_0x3f09fd){if(!_[_0xce01('0x6f')](_0x3f09fd)&&_[_0xce01('0x8a')](_0x3f09fd)){return _0x1e894b[_0xce01('0x16')](0xc8)[_0xce01('0x1c')]({'contacts':_0x3f09fd});}else{logger[_0xce01('0x8b')](_0xce01('0x8c'),_0xce01('0x8d'),0x194,_0xce01('0x8e'));_0x1e894b[_0xce01('0x15')](0x194);}})[_0xce01('0x4c')](handleError(_0x1e894b,null));}; \ No newline at end of file +var _0xd0b7=['sequelize','transaction','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','Queue','preview','count','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','eml-format','request-promise','moment','bluebird','util','sox','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','CmHopper','model','keys','query','dateEnd','dateStart','filters','intersection','concat','$and','$or','$gt','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','fields','attributes','length','hasOwnProperty','sort','where','pick','add','day','merge','filter','map','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','describe','destroy','find','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','dialOrderByScheduledAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0b7,0x1c3));var _0x7d0b=function(_0x31106c,_0x2560cd){_0x31106c=_0x31106c-0x0;var _0x4805a4=_0xd0b7[_0x31106c];return _0x4805a4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d0b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7d0b('0x1'));var moment=require(_0x7d0b('0x2'));var BPromise=require(_0x7d0b('0x3'));var Mustache=require('mustache');var util=require(_0x7d0b('0x4'));var path=require('path');var sox=require(_0x7d0b('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d0b('0x6'));var squel=require(_0x7d0b('0x7'));var crypto=require('crypto');var jsforce=require(_0x7d0b('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x7d0b('0x9'));var querystring=require(_0x7d0b('0xa'));var Papa=require('papaparse');var Redis=require(_0x7d0b('0xb'));var qs=require(_0x7d0b('0xc'));var logger=require(_0x7d0b('0xd'))(_0x7d0b('0xe'));var utils=require(_0x7d0b('0xf'));var config=require(_0x7d0b('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14999d,_0x598ce9){_0x598ce9=_0x598ce9||0xcc;return function(_0xf7f695){if(_0xf7f695){return _0x14999d[_0x7d0b('0x11')](_0x598ce9);}return _0x14999d['status'](_0x598ce9)['end']();};}function respondWithResult(_0x2b8adf,_0x17a756){_0x17a756=_0x17a756||0xc8;return function(_0x467763){if(_0x467763){return _0x2b8adf[_0x7d0b('0x12')](_0x17a756)[_0x7d0b('0x13')](_0x467763);}};}function respondWithFilteredResult(_0x3a4202,_0x568134){return function(_0x24553a){if(_0x24553a){var _0x568d7b=_0x24553a['count'],_0x2c63be=_0x568134[_0x7d0b('0x14')],_0x59dfa7=_0x568134['offset']+_0x568134[_0x7d0b('0x15')],_0x4624ed;if(_0x59dfa7>=_0x568d7b){_0x59dfa7=_0x568d7b;_0x4624ed=0xc8;}else{_0x4624ed=0xce;}_0x3a4202['status'](_0x4624ed);return _0x3a4202['set'](_0x7d0b('0x16'),_0x2c63be+'-'+_0x59dfa7+'/'+_0x568d7b)[_0x7d0b('0x13')](_0x24553a);}return null;};}function patchUpdates(_0x1238e1){return function(_0xe71170){try{jsonpatch[_0x7d0b('0x17')](_0xe71170,_0x1238e1,!![]);}catch(_0xfb6a4c){return BPromise[_0x7d0b('0x18')](_0xfb6a4c);}return _0xe71170['save']();};}function saveUpdates(_0x216405,_0x6fb5fc){return function(_0x5bf5fa){if(_0x5bf5fa){return _0x5bf5fa[_0x7d0b('0x19')](_0x216405)['then'](function(_0x3c4568){return _0x3c4568;});}return null;};}function removeEntity(_0x2a7546,_0x6b1525){return function(_0x102e97){if(_0x102e97){return _0x102e97['destroy']()[_0x7d0b('0x1a')](function(){_0x2a7546['status'](0xcc)[_0x7d0b('0x1b')]();});}};}function handleEntityNotFound(_0x877a92,_0x43ca48){return function(_0x18045b){if(!_0x18045b){_0x877a92[_0x7d0b('0x11')](0x194);}return _0x18045b;};}function handleError(_0x46e904,_0x4ebf59){_0x4ebf59=_0x4ebf59||0x1f4;return function(_0x56a44b){logger[_0x7d0b('0x1c')](_0x56a44b[_0x7d0b('0x1d')]);if(_0x56a44b[_0x7d0b('0x1e')]){delete _0x56a44b[_0x7d0b('0x1e')];}_0x46e904['status'](_0x4ebf59)[_0x7d0b('0x1f')](_0x56a44b);};}exports[_0x7d0b('0x20')]=function(_0x8a79ef,_0xa43305){var _0x181674={},_0x1e76b7={},_0x3a7496={'count':0x0,'rows':[]};var _0x3ec3d0=db[_0x7d0b('0x21')]['rawAttributes'];_0x1e76b7[_0x7d0b('0x22')]=_[_0x7d0b('0x23')](_0x3ec3d0);var _0x5a1367={'dateStart':_0x8a79ef[_0x7d0b('0x24')]['dateStart'],'dateEnd':_0x8a79ef[_0x7d0b('0x24')][_0x7d0b('0x25')]};delete _0x8a79ef[_0x7d0b('0x24')][_0x7d0b('0x26')];delete _0x8a79ef[_0x7d0b('0x24')]['dateEnd'];_0x1e76b7[_0x7d0b('0x24')]=_['keys'](_0x8a79ef[_0x7d0b('0x24')]);_0x1e76b7[_0x7d0b('0x27')]=_[_0x7d0b('0x28')](_0x1e76b7[_0x7d0b('0x22')],_0x1e76b7['query']);_0x1e76b7[_0x7d0b('0x27')]=_[_0x7d0b('0x29')](_0x1e76b7['filters'],[_0x7d0b('0x2a'),_0x7d0b('0x2b'),_0x7d0b('0x2c'),'$gte',_0x7d0b('0x2d'),_0x7d0b('0x2e'),_0x7d0b('0x2f'),'$eq',_0x7d0b('0x30'),_0x7d0b('0x31'),_0x7d0b('0x32'),_0x7d0b('0x33'),_0x7d0b('0x34'),'$like',_0x7d0b('0x35'),_0x7d0b('0x36'),_0x7d0b('0x37'),_0x7d0b('0x38'),_0x7d0b('0x39'),_0x7d0b('0x3a'),'$contained','$any']);_0x181674['attributes']=_[_0x7d0b('0x28')](_0x1e76b7[_0x7d0b('0x22')],qs[_0x7d0b('0x3b')](_0x8a79ef[_0x7d0b('0x24')][_0x7d0b('0x3b')]));_0x181674[_0x7d0b('0x3c')]=_0x181674[_0x7d0b('0x3c')][_0x7d0b('0x3d')]?_0x181674['attributes']:_0x1e76b7[_0x7d0b('0x22')];if(!_0x8a79ef[_0x7d0b('0x24')][_0x7d0b('0x3e')]('nolimit')){_0x181674[_0x7d0b('0x15')]=qs[_0x7d0b('0x15')](_0x8a79ef[_0x7d0b('0x24')][_0x7d0b('0x15')]);_0x181674['offset']=qs[_0x7d0b('0x14')](_0x8a79ef['query'][_0x7d0b('0x14')]);}_0x181674['order']=qs['sort'](_0x8a79ef['query'][_0x7d0b('0x3f')]);_0x181674[_0x7d0b('0x40')]=qs[_0x7d0b('0x27')](_[_0x7d0b('0x41')](_0x8a79ef[_0x7d0b('0x24')],_0x1e76b7[_0x7d0b('0x27')]));if(_0x5a1367[_0x7d0b('0x26')]){if(_0x5a1367[_0x7d0b('0x25')]){_0x5a1367['dateEnd']=moment(_0x5a1367['dateEnd'])[_0x7d0b('0x42')](0x1,_0x7d0b('0x43'));}else{_0x5a1367[_0x7d0b('0x25')]=moment(_0x5a1367[_0x7d0b('0x26')])['add'](0x1,_0x7d0b('0x43'));}_[_0x7d0b('0x44')](_0x181674[_0x7d0b('0x40')],{'createdAt':{'$gte':_0x5a1367[_0x7d0b('0x26')],'$lte':_0x5a1367['dateEnd']}});}if(_0x8a79ef[_0x7d0b('0x24')][_0x7d0b('0x45')]){_0x181674[_0x7d0b('0x40')]=_['merge'](_0x181674[_0x7d0b('0x40')],{'$or':_[_0x7d0b('0x46')](_0x181674[_0x7d0b('0x3c')],function(_0x46fb79){var _0x27c4d0={};_0x27c4d0[_0x46fb79]={'$like':'%'+_0x8a79ef[_0x7d0b('0x24')][_0x7d0b('0x45')]+'%'};return _0x27c4d0;})});}_0x181674=_[_0x7d0b('0x44')]({},_0x181674,_0x8a79ef[_0x7d0b('0x47')]);var _0xda8232={'where':_0x181674[_0x7d0b('0x40')]};return db['CmHopper']['count'](_0xda8232)[_0x7d0b('0x1a')](function(_0x2ec916){_0x3a7496['count']=_0x2ec916;if(_0x8a79ef[_0x7d0b('0x24')]['includeAll']){_0x181674[_0x7d0b('0x48')]=[{'all':!![]}];}return db[_0x7d0b('0x21')][_0x7d0b('0x49')](_0x181674);})[_0x7d0b('0x1a')](function(_0x22689d){_0x3a7496[_0x7d0b('0x4a')]=_0x22689d;return _0x3a7496;})['then'](respondWithFilteredResult(_0xa43305,_0x181674))[_0x7d0b('0x4b')](handleError(_0xa43305,null));};exports[_0x7d0b('0x4c')]=function(_0x44fc84,_0x288abe){var _0x44d174={'raw':!![],'where':{'id':_0x44fc84[_0x7d0b('0x4d')]['id']}},_0x361f65={};_0x361f65[_0x7d0b('0x22')]=_[_0x7d0b('0x23')](db['CmHopper'][_0x7d0b('0x4e')]);_0x361f65['query']=_[_0x7d0b('0x23')](_0x44fc84[_0x7d0b('0x24')]);_0x361f65['filters']=_['intersection'](_0x361f65[_0x7d0b('0x22')],_0x361f65[_0x7d0b('0x24')]);_0x44d174[_0x7d0b('0x3c')]=_[_0x7d0b('0x28')](_0x361f65['model'],qs[_0x7d0b('0x3b')](_0x44fc84[_0x7d0b('0x24')][_0x7d0b('0x3b')]));_0x44d174[_0x7d0b('0x3c')]=_0x44d174[_0x7d0b('0x3c')][_0x7d0b('0x3d')]?_0x44d174[_0x7d0b('0x3c')]:_0x361f65[_0x7d0b('0x22')];if(_0x44fc84[_0x7d0b('0x24')][_0x7d0b('0x4f')]){_0x44d174[_0x7d0b('0x48')]=[{'all':!![]}];}_0x44d174=_[_0x7d0b('0x44')]({},_0x44d174,_0x44fc84['options']);return db['CmHopper']['find'](_0x44d174)['then'](handleEntityNotFound(_0x288abe,null))[_0x7d0b('0x1a')](respondWithResult(_0x288abe,null))[_0x7d0b('0x4b')](handleError(_0x288abe,null));};exports[_0x7d0b('0x50')]=function(_0x1b87ed,_0x51e020){return db[_0x7d0b('0x21')]['create'](_0x1b87ed[_0x7d0b('0x51')],{})['then'](respondWithResult(_0x51e020,0xc9))[_0x7d0b('0x4b')](handleError(_0x51e020,null));};exports[_0x7d0b('0x19')]=function(_0x3418c9,_0x12c472){if(_0x3418c9['body']['id']){delete _0x3418c9[_0x7d0b('0x51')]['id'];}return db[_0x7d0b('0x21')]['find']({'where':{'id':_0x3418c9[_0x7d0b('0x4d')]['id']}})[_0x7d0b('0x1a')](handleEntityNotFound(_0x12c472,null))['then'](saveUpdates(_0x3418c9[_0x7d0b('0x51')],null))[_0x7d0b('0x1a')](respondWithResult(_0x12c472,null))['catch'](handleError(_0x12c472,null));};exports['describe']=function(_0x5869cf,_0x287170){return db['CmHopper'][_0x7d0b('0x52')]()['then'](respondWithResult(_0x287170,null))['catch'](handleError(_0x287170,null));};exports[_0x7d0b('0x53')]=function(_0x41e677,_0x5822f6){var _0x52d96d;return db[_0x7d0b('0x21')][_0x7d0b('0x54')]({'where':{'id':_0x41e677[_0x7d0b('0x4d')]['id']}})[_0x7d0b('0x1a')](handleEntityNotFound(_0x5822f6,null))[_0x7d0b('0x1a')](function(_0x8741e5){if(_0x8741e5){return _0x8741e5[_0x7d0b('0x53')]()['then'](function(_0x3dd812){return _0x3dd812;});}})[_0x7d0b('0x1a')](function(_0x524abf){_0x52d96d=_0x524abf;if(_0x524abf){if(_0x524abf[_0x7d0b('0x55')]||_0x524abf[_0x7d0b('0x56')]){return db[_0x524abf[_0x7d0b('0x55')]?_0x7d0b('0x57'):'Campaign'][_0x7d0b('0x54')]({'where':{'id':_0x524abf['VoiceQueueId']?_0x524abf[_0x7d0b('0x55')]:_0x524abf[_0x7d0b('0x56')]},'attributes':['id',_0x7d0b('0x1e')],'raw':!![]});}}})[_0x7d0b('0x1a')](function(_0xa763eb){var _0xebc1fa={};if(_0xa763eb){_[_0x7d0b('0x44')](_0xebc1fa,_[_0x7d0b('0x58')](_0x52d96d[_0x7d0b('0x59')],[_0x7d0b('0x5a'),_0x7d0b('0x5b'),'id']));_0xebc1fa[_0x7d0b('0x5c')]=0x15;_0xebc1fa[_0x7d0b('0x5d')]=_0x7d0b('0x5e');_0xebc1fa['campaign']=_0xa763eb[_0x7d0b('0x1e')];_0xebc1fa[_0x7d0b('0x5f')]=_0x41e677[_0x7d0b('0x60')][_0x7d0b('0x1e')];_0xebc1fa[_0x7d0b('0x61')]=_0x41e677[_0x7d0b('0x60')]['id'];_0xebc1fa[_0x7d0b('0x5e')]=!![];_0xebc1fa[_0x7d0b('0x62')]=moment()[_0x7d0b('0x63')](_0x7d0b('0x64'));_0xebc1fa[_0x7d0b('0x65')]=_0x52d96d[_0x7d0b('0x66')];_0xebc1fa[_0x7d0b('0x67')]=_0x52d96d[_0x7d0b('0x55')]?_0x7d0b('0x68'):_0x7d0b('0x69');return db['CmContact'][_0x7d0b('0x54')]({'where':{'id':_0xebc1fa[_0x7d0b('0x6a')]},'attributes':[_0x7d0b('0x6b'),_0x7d0b('0x6c')]})['then'](function(_0x186296){if(!_[_0x7d0b('0x6d')](_0x5822f6)&&!_['isNil'](_0x186296['firstName'])){_0xebc1fa[_0x7d0b('0x6e')]=_0x186296[_0x7d0b('0x6b')];if(!_[_0x7d0b('0x6d')](_0x186296[_0x7d0b('0x6c')])){_0xebc1fa['calleridname']+='\x20'+_0x186296[_0x7d0b('0x6c')];}}})['finally'](function(){return db[_0x7d0b('0x6f')][_0x7d0b('0x50')](_0xebc1fa);});}})[_0x7d0b('0x1a')](function(){return _0x5822f6['status'](0xcc)['end']();})[_0x7d0b('0x4b')](handleError(_0x5822f6,null));};exports[_0x7d0b('0x70')]=function(_0x713b41,_0x2fb417,_0x10cd3d){var _0x58f365=[];return db[_0x7d0b('0x71')][_0x7d0b('0x52')]()[_0x7d0b('0x1a')](function(_0x128cad){_0x58f365=_['keys'](_0x128cad);return _0x713b41['user'][_0x7d0b('0x72')]({'where':{'type':_0x7d0b('0x73'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x7d0b('0x74')],'raw':!![]});})['then'](function(_0x4a3fdf){if(_0x4a3fdf&&_0x4a3fdf['length']){return db[_0x7d0b('0x75')][_0x7d0b('0x76')](function(_0x256c57){var _0x27a638={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7d0b('0x63')](_0x7d0b('0x64'))},'VoiceQueueId':{'$in':_['map'](_0x4a3fdf,'id')},'$or':[{'UserId':null},{'UserId':_0x713b41[_0x7d0b('0x60')]['id']}]};var _0x523a75=[];if(_0x713b41[_0x7d0b('0x51')][_0x7d0b('0x77')]&&_0x713b41[_0x7d0b('0x51')][_0x7d0b('0x77')]===_0x7d0b('0x78')){if(!_[_0x7d0b('0x79')](_0x713b41[_0x7d0b('0x51')][_0x7d0b('0x7a')])){_0x27a638['id']={'$in':_0x713b41[_0x7d0b('0x51')][_0x7d0b('0x7a')]};}_0x523a75=[['priority',_0x7d0b('0x7b')],[_0x7d0b('0x7c'),_0x4a3fdf[0x0]['dialOrderByScheduledAt']==='ASC'?_0x7d0b('0x7d'):'ASC'],db['sequelize'][_0x7d0b('0x7e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7d0b('0x7d')]];}else{if(!_[_0x7d0b('0x79')](_0x713b41['body'][_0x7d0b('0x7a')])){_0x27a638['id']={'$notIn':_0x713b41['body'][_0x7d0b('0x7a')]};}_0x523a75=[[_0x7d0b('0x7f'),_0x7d0b('0x7d')],[_0x7d0b('0x7c'),_0x4a3fdf[0x0][_0x7d0b('0x74')]],db[_0x7d0b('0x75')]['literal'](_0x7d0b('0x80')),['id','ASC']];}return db[_0x7d0b('0x21')][_0x7d0b('0x81')]({'attributes':['id',_0x7d0b('0x82')],'where':_0x27a638,'order':_0x523a75,'transaction':_0x256c57,'lock':_0x256c57[_0x7d0b('0x83')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x7d0b('0x84'),'attributes':_0x58f365,'include':[{'model':db[_0x7d0b('0x85')],'as':_0x7d0b('0x86'),'attributes':['id',_0x7d0b('0x1e')]}]},{'model':db[_0x7d0b('0x87')],'as':'List','attributes':['id',_0x7d0b('0x1e')]},{'model':db[_0x7d0b('0x57')],'as':_0x7d0b('0x88'),'attributes':['id',_0x7d0b('0x1e'),'dialActive']}]})[_0x7d0b('0x1a')](function(_0x1300c7){if(_0x1300c7){return _0x1300c7[_0x7d0b('0x19')]({'UserId':_0x713b41[_0x7d0b('0x60')]['id']},{'transaction':_0x256c57});}});});}})[_0x7d0b('0x1a')](handleEntityNotFound(_0x2fb417,null))[_0x7d0b('0x1a')](respondWithResult(_0x2fb417,null))[_0x7d0b('0x4b')](handleError(_0x2fb417,null));};exports['getOpenContacts']=function(_0x337ce6,_0x423982,_0x1aa5af){return _0x337ce6['user'][_0x7d0b('0x72')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x7d0b('0x89')},'attributes':['id'],'raw':!![]})[_0x7d0b('0x1a')](function(_0x23447){if(_0x23447&&_0x23447[_0x7d0b('0x3d')]){return db[_0x7d0b('0x21')][_0x7d0b('0x8a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7d0b('0x63')](_0x7d0b('0x64'))},'VoiceQueueId':{'$in':_[_0x7d0b('0x46')](_0x23447,'id')},'$or':[{'UserId':null},{'UserId':_0x337ce6[_0x7d0b('0x60')]['id']}]}});}return 0x0;})[_0x7d0b('0x1a')](function(_0x39f6be){if(!_['isNil'](_0x39f6be)&&_[_0x7d0b('0x8b')](_0x39f6be)){return _0x423982[_0x7d0b('0x12')](0xc8)['json']({'contacts':_0x39f6be});}else{logger[_0x7d0b('0x1c')](_0x7d0b('0x8c'),_0x7d0b('0x8d'),0x194,'entity\x20not\x20found');_0x423982[_0x7d0b('0x11')](0x194);}})['catch'](handleError(_0x423982,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f70713e..ff6e4ea 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 _0xf333=['util','api','bluebird','request-promise','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x2dcce3,_0x5b838f){var _0x35511b=function(_0x5da840){while(--_0x5da840){_0x2dcce3['push'](_0x2dcce3['shift']());}};_0x35511b(++_0x5b838f);}(_0xf333,0x107));var _0x3f33=function(_0x1f8069,_0x10b62c){_0x1f8069=_0x1f8069-0x0;var _0x1c2603=_0xf333[_0x1f8069];return _0x1c2603;};'use strict';var _=require(_0x3f33('0x0'));var util=require(_0x3f33('0x1'));var logger=require('../../config/logger')(_0x3f33('0x2'));var moment=require('moment');var BPromise=require(_0x3f33('0x3'));var rp=require(_0x3f33('0x4'));var attributes=require('./cmHopper.attributes');module[_0x3f33('0x5')]=function(_0x10601e,_0x340383){return _0x10601e[_0x3f33('0x6')](_0x3f33('0x7'),attributes,{'tableName':_0x3f33('0x8'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x3f33('0x9')]},{'name':_0x3f33('0xa'),'fields':['phone']},{'name':'priority','fields':[_0x3f33('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x785a=['lodash','util','../../config/logger','api','bluebird','request-promise','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone','priority'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x785a,0x68));var _0xa785=function(_0x2f5813,_0x4b8271){_0x2f5813=_0x2f5813-0x0;var _0x44aef8=_0x785a[_0x2f5813];return _0x44aef8;};'use strict';var _=require(_0xa785('0x0'));var util=require(_0xa785('0x1'));var logger=require(_0xa785('0x2'))(_0xa785('0x3'));var moment=require('moment');var BPromise=require(_0xa785('0x4'));var rp=require(_0xa785('0x5'));var attributes=require(_0xa785('0x6'));module[_0xa785('0x7')]=function(_0x1f1336,_0x5119f4){return _0x1f1336[_0xa785('0x8')]('CmHopper',attributes,{'tableName':_0xa785('0x9'),'paranoid':![],'indexes':[{'name':_0xa785('0xa'),'fields':[_0xa785('0xa')]},{'name':_0xa785('0xb'),'fields':['phone']},{'name':_0xa785('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 3171e95..9040b42 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 _0xb02d=['attributes','GetCmHopper','stringify','find','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','describe','order','LOCK','UPDATE','CmContact','keys','length','push','all','GetContactDialer','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UserId','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','CmHopper','findAll','options','raw','where','limit','include','map','model'];(function(_0x5c9365,_0x22da36){var _0x3fdf72=function(_0x23d8ec){while(--_0x23d8ec){_0x5c9365['push'](_0x5c9365['shift']());}};_0x3fdf72(++_0x22da36);}(_0xb02d,0x16c));var _0xdb02=function(_0x52220f,_0x5c4b24){_0x52220f=_0x52220f-0x0;var _0x54301a=_0xb02d[_0x52220f];return _0x54301a;};'use strict';var _=require(_0xdb02('0x0'));var util=require(_0xdb02('0x1'));var moment=require(_0xdb02('0x2'));var BPromise=require(_0xdb02('0x3'));var rs=require(_0xdb02('0x4'));var fs=require('fs');var Redis=require(_0xdb02('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb02('0x6'));var logger=require(_0xdb02('0x7'))(_0xdb02('0x8'));var config=require(_0xdb02('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdb02('0xa')][_0xdb02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7a8025,_0xcab08e,_0x2ba8e8){return new BPromise(function(_0xec753,_0x35b72e){return client['request'](_0x7a8025,_0x2ba8e8)[_0xdb02('0xc')](function(_0x177cca){logger[_0xdb02('0xd')]('CmHopper,\x20%s,\x20%s',_0xcab08e,_0xdb02('0xe'));logger[_0xdb02('0xf')](_0xdb02('0x10'),_0xcab08e,_0xdb02('0xe'),JSON['stringify'](_0x177cca));if(_0x177cca['error']){if(_0x177cca[_0xdb02('0x11')][_0xdb02('0x12')]===0x1f4){logger[_0xdb02('0x11')](_0xdb02('0x13'),_0xcab08e,_0x177cca[_0xdb02('0x11')][_0xdb02('0x14')]);return _0x35b72e(_0x177cca[_0xdb02('0x11')][_0xdb02('0x14')]);}logger[_0xdb02('0x11')](_0xdb02('0x13'),_0xcab08e,_0x177cca[_0xdb02('0x11')][_0xdb02('0x14')]);return _0xec753(_0x177cca[_0xdb02('0x11')][_0xdb02('0x14')]);}else{logger['info'](_0xdb02('0x13'),_0xcab08e,'request\x20sent');_0xec753(_0x177cca[_0xdb02('0x15')][_0xdb02('0x14')]);}})[_0xdb02('0x16')](function(_0x5b5ea5){logger[_0xdb02('0x11')]('CmHopper,\x20%s,\x20%s',_0xcab08e,_0x5b5ea5);_0x35b72e(_0x5b5ea5);});});}exports['GetCmHopper']=function(_0x4da579){var _0x2f2b5e=this;return new Promise(function(_0x43c5dd,_0x2cf74d){return db[_0xdb02('0x17')][_0xdb02('0x18')]({'raw':_0x4da579[_0xdb02('0x19')]?_0x4da579['options'][_0xdb02('0x1a')]===undefined?!![]:![]:!![],'where':_0x4da579['options']?_0x4da579['options'][_0xdb02('0x1b')]||null:null,'attributes':_0x4da579['options']?_0x4da579['options']['attributes']||null:null,'limit':_0x4da579[_0xdb02('0x19')]?_0x4da579['options'][_0xdb02('0x1c')]||null:null,'include':_0x4da579[_0xdb02('0x19')]?_0x4da579[_0xdb02('0x19')][_0xdb02('0x1d')]?_[_0xdb02('0x1e')](_0x4da579['options'][_0xdb02('0x1d')],function(_0x6bc769){return{'model':db[_0x6bc769[_0xdb02('0x1f')]],'as':_0x6bc769['as'],'attributes':_0x6bc769[_0xdb02('0x20')],'include':_0x6bc769[_0xdb02('0x1d')]?_[_0xdb02('0x1e')](_0x6bc769['include'],function(_0x270e84){return{'model':db[_0x270e84[_0xdb02('0x1f')]],'as':_0x270e84['as'],'attributes':_0x270e84[_0xdb02('0x20')],'include':_0x270e84[_0xdb02('0x1d')]?_[_0xdb02('0x1e')](_0x270e84['include'],function(_0x14bc93){return{'model':db[_0x14bc93[_0xdb02('0x1f')]],'as':_0x14bc93['as'],'attributes':_0x14bc93[_0xdb02('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdb02('0xc')](function(_0x3d5b4e){logger[_0xdb02('0xd')]('GetCmHopper',_0x4da579);logger[_0xdb02('0xf')](_0xdb02('0x21'),_0x4da579,JSON[_0xdb02('0x22')](_0x3d5b4e));_0x43c5dd(_0x3d5b4e);})[_0xdb02('0x16')](function(_0x2c1ab9){logger[_0xdb02('0x11')](_0xdb02('0x21'),_0x2c1ab9['message'],_0x4da579);_0x2cf74d(_0x2f2b5e[_0xdb02('0x11')](0x1f4,_0x2c1ab9[_0xdb02('0x14')]));});});};exports['ShowCmHopper']=function(_0x3846cd){var _0x222e1a=this;return new Promise(function(_0x46f017,_0x2aabdc){return db[_0xdb02('0x17')][_0xdb02('0x23')]({'raw':_0x3846cd[_0xdb02('0x19')]?_0x3846cd[_0xdb02('0x19')][_0xdb02('0x1a')]===undefined?!![]:![]:!![],'where':_0x3846cd[_0xdb02('0x19')]?_0x3846cd[_0xdb02('0x19')][_0xdb02('0x1b')]||null:null,'attributes':_0x3846cd['options']?_0x3846cd[_0xdb02('0x19')][_0xdb02('0x20')]||null:null,'include':_0x3846cd[_0xdb02('0x19')]?_0x3846cd['options'][_0xdb02('0x1d')]?_[_0xdb02('0x1e')](_0x3846cd['options'][_0xdb02('0x1d')],function(_0x58d842){return{'model':db[_0x58d842[_0xdb02('0x1f')]],'as':_0x58d842['as'],'attributes':_0x58d842['attributes'],'include':_0x58d842['include']?_['map'](_0x58d842[_0xdb02('0x1d')],function(_0x40e4e7){return{'model':db[_0x40e4e7[_0xdb02('0x1f')]],'as':_0x40e4e7['as'],'attributes':_0x40e4e7[_0xdb02('0x20')],'include':_0x40e4e7[_0xdb02('0x1d')]?_['map'](_0x40e4e7[_0xdb02('0x1d')],function(_0xc4b93c){return{'model':db[_0xc4b93c[_0xdb02('0x1f')]],'as':_0xc4b93c['as'],'attributes':_0xc4b93c[_0xdb02('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdb02('0xc')](function(_0x4b8ee5){logger[_0xdb02('0xd')](_0xdb02('0x24'),_0x3846cd);logger[_0xdb02('0xf')]('ShowCmHopper',_0x3846cd,JSON[_0xdb02('0x22')](_0x4b8ee5));_0x46f017(_0x4b8ee5);})[_0xdb02('0x16')](function(_0x5d66d5){logger[_0xdb02('0x11')]('ShowCmHopper',_0x5d66d5[_0xdb02('0x14')],_0x3846cd);_0x2aabdc(_0x222e1a['error'](0x1f4,_0x5d66d5[_0xdb02('0x14')]));});});};exports['CreateCmHopper']=function(_0x654e6b){var _0x164643=this;return new Promise(function(_0x2fc56d,_0x3ebec1){return db['CmHopper'][_0xdb02('0x25')](_0x654e6b[_0xdb02('0x26')],{'raw':_0x654e6b[_0xdb02('0x19')]?_0x654e6b[_0xdb02('0x19')][_0xdb02('0x1a')]===undefined?!![]:![]:!![]})[_0xdb02('0xc')](function(_0x1c6959){logger['info']('CreateCmHopper',_0x654e6b);logger[_0xdb02('0xf')](_0xdb02('0x27'),_0x654e6b,JSON['stringify'](_0x1c6959));_0x2fc56d(_0x1c6959);})['catch'](function(_0x8082c1){logger['error'](_0xdb02('0x27'),_0x8082c1[_0xdb02('0x14')],_0x654e6b);_0x3ebec1(_0x164643[_0xdb02('0x11')](0x1f4,_0x8082c1[_0xdb02('0x14')]));});});};exports[_0xdb02('0x28')]=function(_0x4ce94e){var _0x5b5945=this;return new Promise(function(_0xf7fb0d,_0x32a770){return db[_0xdb02('0x17')][_0xdb02('0x29')](_0x4ce94e[_0xdb02('0x26')],{'raw':_0x4ce94e[_0xdb02('0x19')]?_0x4ce94e[_0xdb02('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ce94e[_0xdb02('0x19')]?_0x4ce94e[_0xdb02('0x19')]['where']||null:null,'attributes':_0x4ce94e['options']?_0x4ce94e['options'][_0xdb02('0x20')]||null:null,'limit':_0x4ce94e[_0xdb02('0x19')]?_0x4ce94e['options']['limit']||null:null})[_0xdb02('0xc')](function(_0x46b998){logger[_0xdb02('0xd')](_0xdb02('0x28'),_0x4ce94e);logger[_0xdb02('0xf')](_0xdb02('0x28'),_0x4ce94e,JSON[_0xdb02('0x22')](_0x46b998));_0xf7fb0d(_0x46b998);})[_0xdb02('0x16')](function(_0x541714){logger['error'](_0xdb02('0x28'),_0x541714[_0xdb02('0x14')],_0x4ce94e);_0x32a770(_0x5b5945[_0xdb02('0x11')](0x1f4,_0x541714[_0xdb02('0x14')]));});});};exports[_0xdb02('0x2a')]=function(_0x264693){var _0xb4b1ec=this;return new Promise(function(_0x67498a,_0x1cc778){return db['CmHopper'][_0xdb02('0x2b')]({'where':_0x264693[_0xdb02('0x19')]?_0x264693[_0xdb02('0x19')][_0xdb02('0x1b')]||null:null})['then'](function(_0x508a7e){logger[_0xdb02('0xd')](_0xdb02('0x2a'),_0x264693);logger[_0xdb02('0xf')](_0xdb02('0x2a'),_0x264693,JSON[_0xdb02('0x22')](_0x508a7e));_0x67498a(_0x508a7e);})[_0xdb02('0x16')](function(_0x59b78b){logger['error'](_0xdb02('0x2a'),_0x59b78b[_0xdb02('0x14')],_0x264693);_0x1cc778(_0xb4b1ec[_0xdb02('0x11')](0x1f4,_0x59b78b[_0xdb02('0x14')]));});});};exports['GetContactDialer']=function(_0x48bbc7){var _0x5c2b80=this;return new Promise(function(_0x8c44d2,_0x5312f1){return db['CmContact'][_0xdb02('0x2c')]()[_0xdb02('0xc')](function(_0x5d46e5){return db['sequelize']['transaction'](function(_0x341eb0){return db[_0xdb02('0x17')][_0xdb02('0x18')]({'where':_0x48bbc7['options']?_0x48bbc7[_0xdb02('0x19')][_0xdb02('0x1b')]||null:null,'attributes':_0x48bbc7['options']?_0x48bbc7[_0xdb02('0x19')][_0xdb02('0x20')]||null:null,'limit':_0x48bbc7[_0xdb02('0x19')]?_0x48bbc7[_0xdb02('0x19')]['limit']||null:null,'order':_0x48bbc7[_0xdb02('0x19')]?_0x48bbc7[_0xdb02('0x19')][_0xdb02('0x2d')]||null:null,'transaction':_0x341eb0,'lock':_0x341eb0[_0xdb02('0x2e')][_0xdb02('0x2f')],'include':[{'model':db[_0xdb02('0x30')],'as':'Contact','attributes':_[_0xdb02('0x31')](_0x5d46e5)}]})[_0xdb02('0xc')](function(_0x59055e){var _0x2a6085=[];for(var _0x699b45=0x0;_0x699b45<_0x59055e[_0xdb02('0x32')];_0x699b45+=0x1){_0x2a6085[_0xdb02('0x33')](_0x59055e[_0x699b45][_0xdb02('0x29')](_0x48bbc7[_0xdb02('0x26')],{'transaction':_0x341eb0}));}return BPromise[_0xdb02('0x34')](_0x2a6085);});})[_0xdb02('0xc')](function(_0x377b19){logger[_0xdb02('0xd')](_0xdb02('0x35'),_0x48bbc7);logger[_0xdb02('0xf')]('GetContactDialer',_0x48bbc7,JSON[_0xdb02('0x22')](_0x377b19));_0x8c44d2(_0x377b19);})[_0xdb02('0x16')](function(_0x168e83){logger['error']('GetContactDialer',_0x168e83[_0xdb02('0x14')],_0x48bbc7);_0x5312f1(_0x5c2b80[_0xdb02('0x11')](0x1f4,_0x168e83[_0xdb02('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x26ccdc){var _0xd6acee=this;return new Promise(function(_0x29b6f6,_0x310cfe){return db[_0xdb02('0x36')][_0xdb02('0x37')](function(_0x3dbd3d){return db[_0xdb02('0x38')]['create'](_0x26ccdc[_0xdb02('0x26')],{'raw':_0x26ccdc[_0xdb02('0x19')]?_0x26ccdc[_0xdb02('0x19')][_0xdb02('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x3dbd3d})[_0xdb02('0xc')](function(){return db[_0xdb02('0x17')][_0xdb02('0x2b')]({'where':_0x26ccdc[_0xdb02('0x19')]?_0x26ccdc['options'][_0xdb02('0x1b')]||null:null,'transaction':_0x3dbd3d});});})['then'](function(_0x3d3cf5){logger[_0xdb02('0xd')](_0xdb02('0x39'),_0x26ccdc);logger[_0xdb02('0xf')](_0xdb02('0x39'),_0x26ccdc,JSON[_0xdb02('0x22')](_0x3d3cf5));_0x29b6f6(_0x3d3cf5);})[_0xdb02('0x16')](function(_0x9b0a9){logger[_0xdb02('0x11')]('MoveContactManagedDialer',_0x9b0a9[_0xdb02('0x14')],_0x26ccdc);_0x310cfe(_0xd6acee[_0xdb02('0x11')](0x1f4,_0x9b0a9[_0xdb02('0x14')]));});});};exports[_0xdb02('0x3a')]=function(_0x1ffca0){var _0x5b4156=this;return new Promise(function(_0x1c69bb,_0x52e8de){return db[_0xdb02('0x17')][_0xdb02('0x18')]({'raw':_0x1ffca0[_0xdb02('0x19')]?_0x1ffca0[_0xdb02('0x19')][_0xdb02('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ffca0[_0xdb02('0x19')]?_0x1ffca0[_0xdb02('0x19')]['where']||null:null,'attributes':[[db[_0xdb02('0x36')]['fn']('COUNT',db[_0xdb02('0x36')]['fn']('IF',db['sequelize'][_0xdb02('0x3b')](_0xdb02('0x3c')+util[_0xdb02('0x3d')]('\x22%s\x22',moment()[_0xdb02('0x3d')](_0xdb02('0x3e')))+'\x20,\x201,\x20null'))),_0xdb02('0x3f')]]})[_0xdb02('0xc')](function(_0x1819d1){logger[_0xdb02('0xd')](_0xdb02('0x3a'),_0x1ffca0);logger[_0xdb02('0xf')](_0xdb02('0x3a'),_0x1ffca0,JSON[_0xdb02('0x22')](_0x1819d1));_0x1c69bb(_0x1819d1);})['catch'](function(_0x1dccac){logger[_0xdb02('0x11')]('CountReScheduled',_0x1dccac[_0xdb02('0x14')],_0x1ffca0);_0x52e8de(_0x5b4156[_0xdb02('0x11')](0x1f4,_0x1dccac[_0xdb02('0x14')]));});});};exports[_0xdb02('0x40')]=function(_0x4b9e56){var _0x4e60e4=this;return new Promise(function(_0x218149,_0xbf3670){return db[_0xdb02('0x30')][_0xdb02('0x2c')]()[_0xdb02('0xc')](function(_0x462de2){return db[_0xdb02('0x36')][_0xdb02('0x37')](function(_0x2fd5da){return db['CmHopper'][_0xdb02('0x18')]({'where':_0x4b9e56['options']?_0x4b9e56['options'][_0xdb02('0x1b')]||null:null,'attributes':_0x4b9e56[_0xdb02('0x19')]?_0x4b9e56[_0xdb02('0x19')][_0xdb02('0x20')]||null:null,'limit':0x1,'order':_0x4b9e56[_0xdb02('0x19')]?_0x4b9e56['options'][_0xdb02('0x2d')]||null:null,'group':db[_0xdb02('0x17')][_0xdb02('0x41')],'transaction':_0x2fd5da,'lock':_0x2fd5da['LOCK']['UPDATE'],'include':_0x4b9e56[_0xdb02('0x19')]?_0x4b9e56[_0xdb02('0x19')][_0xdb02('0x1d')]?_[_0xdb02('0x1e')](_0x4b9e56[_0xdb02('0x19')][_0xdb02('0x1d')],function(_0x48d906){return{'model':db[_0x48d906[_0xdb02('0x1f')]],'as':_0x48d906['as'],'attributes':_0x48d906[_0xdb02('0x20')],'include':_0x48d906[_0xdb02('0x1d')]?_['map'](_0x48d906['include'],function(_0x5a106c){return{'model':db[_0x5a106c['model']],'as':_0x5a106c['as'],'attributes':_0x5a106c[_0xdb02('0x20')],'include':_0x5a106c[_0xdb02('0x1d')]?_[_0xdb02('0x1e')](_0x5a106c[_0xdb02('0x1d')],function(_0x137638){return{'model':db[_0x137638[_0xdb02('0x1f')]],'as':_0x137638['as'],'attributes':_0x137638[_0xdb02('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdb02('0xc')](function(_0x29d8e7){var _0x4c880f=[];for(var _0x59bb8c=0x0;_0x59bb8c<_0x29d8e7[_0xdb02('0x32')];_0x59bb8c+=0x1){_0x4c880f[_0xdb02('0x33')](_0x29d8e7[_0x59bb8c]['update'](_0x4b9e56[_0xdb02('0x26')],{'transaction':_0x2fd5da}));}return BPromise[_0xdb02('0x34')](_0x4c880f);});})['then'](function(_0x370d48){logger['info'](_0xdb02('0x40'),_0x4b9e56);logger[_0xdb02('0xf')](_0xdb02('0x40'),_0x4b9e56,JSON[_0xdb02('0x22')](_0x370d48));_0x218149(_0x370d48);})[_0xdb02('0x16')](function(_0xc369d5){logger['error'](_0xdb02('0x40'),_0xc369d5[_0xdb02('0x14')],_0x4b9e56);_0xbf3670(_0x4e60e4[_0xdb02('0x11')](0x1f4,_0xc369d5[_0xdb02('0x14')]));});});});}; \ No newline at end of file +var _0x985c=['UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','sequelize','order','LOCK','Contact','keys','length','push','update','all','transaction','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','describe','UserId','UPDATE','GetContactRecallMe','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include','model','map','catch','ShowCmHopper','find','where','create','body','CreateCmHopper'];(function(_0x2966cf,_0x2f8487){var _0x18f33c=function(_0x17d285){while(--_0x17d285){_0x2966cf['push'](_0x2966cf['shift']());}};_0x18f33c(++_0x2f8487);}(_0x985c,0x1e3));var _0xc985=function(_0x23c6c0,_0x16d12f){_0x23c6c0=_0x23c6c0-0x0;var _0x159e9d=_0x985c[_0x23c6c0];return _0x159e9d;};'use strict';var _=require(_0xc985('0x0'));var util=require(_0xc985('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc985('0x2'));var fs=require('fs');var Redis=require(_0xc985('0x3'));var db=require(_0xc985('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc985('0x5'));var config=require(_0xc985('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc985('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x47d432,_0x36ff06,_0x10731c){return new BPromise(function(_0x5ad8f5,_0x29aaf6){return client[_0xc985('0x8')](_0x47d432,_0x10731c)[_0xc985('0x9')](function(_0x4f7400){logger[_0xc985('0xa')](_0xc985('0xb'),_0x36ff06,_0xc985('0xc'));logger[_0xc985('0xd')](_0xc985('0xe'),_0x36ff06,'request\x20sent',JSON[_0xc985('0xf')](_0x4f7400));if(_0x4f7400[_0xc985('0x10')]){if(_0x4f7400['error'][_0xc985('0x11')]===0x1f4){logger[_0xc985('0x10')](_0xc985('0xb'),_0x36ff06,_0x4f7400[_0xc985('0x10')]['message']);return _0x29aaf6(_0x4f7400[_0xc985('0x10')][_0xc985('0x12')]);}logger[_0xc985('0x10')](_0xc985('0xb'),_0x36ff06,_0x4f7400[_0xc985('0x10')][_0xc985('0x12')]);return _0x5ad8f5(_0x4f7400[_0xc985('0x10')][_0xc985('0x12')]);}else{logger[_0xc985('0xa')](_0xc985('0xb'),_0x36ff06,_0xc985('0xc'));_0x5ad8f5(_0x4f7400[_0xc985('0x13')]['message']);}})['catch'](function(_0x4806c4){logger[_0xc985('0x10')]('CmHopper,\x20%s,\x20%s',_0x36ff06,_0x4806c4);_0x29aaf6(_0x4806c4);});});}exports[_0xc985('0x14')]=function(_0x10c900){var _0x551707=this;return new Promise(function(_0x5c2dee,_0x5a4768){return db[_0xc985('0x15')][_0xc985('0x16')]({'raw':_0x10c900[_0xc985('0x17')]?_0x10c900[_0xc985('0x17')][_0xc985('0x18')]===undefined?!![]:![]:!![],'where':_0x10c900['options']?_0x10c900['options']['where']||null:null,'attributes':_0x10c900[_0xc985('0x17')]?_0x10c900[_0xc985('0x17')][_0xc985('0x19')]||null:null,'limit':_0x10c900[_0xc985('0x17')]?_0x10c900[_0xc985('0x17')][_0xc985('0x1a')]||null:null,'include':_0x10c900['options']?_0x10c900[_0xc985('0x17')][_0xc985('0x1b')]?_['map'](_0x10c900[_0xc985('0x17')][_0xc985('0x1b')],function(_0x3fc998){return{'model':db[_0x3fc998[_0xc985('0x1c')]],'as':_0x3fc998['as'],'attributes':_0x3fc998[_0xc985('0x19')],'include':_0x3fc998[_0xc985('0x1b')]?_[_0xc985('0x1d')](_0x3fc998[_0xc985('0x1b')],function(_0x73d0cc){return{'model':db[_0x73d0cc[_0xc985('0x1c')]],'as':_0x73d0cc['as'],'attributes':_0x73d0cc['attributes'],'include':_0x73d0cc[_0xc985('0x1b')]?_[_0xc985('0x1d')](_0x73d0cc[_0xc985('0x1b')],function(_0x543f27){return{'model':db[_0x543f27[_0xc985('0x1c')]],'as':_0x543f27['as'],'attributes':_0x543f27['attributes']};}):[]};}):[]};}):[]:[]})[_0xc985('0x9')](function(_0x1a688f){logger[_0xc985('0xa')](_0xc985('0x14'),_0x10c900);logger[_0xc985('0xd')]('GetCmHopper',_0x10c900,JSON['stringify'](_0x1a688f));_0x5c2dee(_0x1a688f);})[_0xc985('0x1e')](function(_0x5cf0ad){logger[_0xc985('0x10')]('GetCmHopper',_0x5cf0ad[_0xc985('0x12')],_0x10c900);_0x5a4768(_0x551707['error'](0x1f4,_0x5cf0ad['message']));});});};exports[_0xc985('0x1f')]=function(_0x1af3be){var _0x5232c9=this;return new Promise(function(_0x3a2266,_0x216e67){return db['CmHopper'][_0xc985('0x20')]({'raw':_0x1af3be['options']?_0x1af3be[_0xc985('0x17')][_0xc985('0x18')]===undefined?!![]:![]:!![],'where':_0x1af3be['options']?_0x1af3be[_0xc985('0x17')][_0xc985('0x21')]||null:null,'attributes':_0x1af3be[_0xc985('0x17')]?_0x1af3be['options']['attributes']||null:null,'include':_0x1af3be[_0xc985('0x17')]?_0x1af3be[_0xc985('0x17')][_0xc985('0x1b')]?_[_0xc985('0x1d')](_0x1af3be[_0xc985('0x17')][_0xc985('0x1b')],function(_0x31f4ad){return{'model':db[_0x31f4ad[_0xc985('0x1c')]],'as':_0x31f4ad['as'],'attributes':_0x31f4ad[_0xc985('0x19')],'include':_0x31f4ad[_0xc985('0x1b')]?_['map'](_0x31f4ad[_0xc985('0x1b')],function(_0x19dd87){return{'model':db[_0x19dd87[_0xc985('0x1c')]],'as':_0x19dd87['as'],'attributes':_0x19dd87['attributes'],'include':_0x19dd87[_0xc985('0x1b')]?_[_0xc985('0x1d')](_0x19dd87[_0xc985('0x1b')],function(_0x1cfabd){return{'model':db[_0x1cfabd[_0xc985('0x1c')]],'as':_0x1cfabd['as'],'attributes':_0x1cfabd[_0xc985('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x369521){logger[_0xc985('0xa')](_0xc985('0x1f'),_0x1af3be);logger[_0xc985('0xd')](_0xc985('0x1f'),_0x1af3be,JSON[_0xc985('0xf')](_0x369521));_0x3a2266(_0x369521);})[_0xc985('0x1e')](function(_0x404a72){logger[_0xc985('0x10')](_0xc985('0x1f'),_0x404a72[_0xc985('0x12')],_0x1af3be);_0x216e67(_0x5232c9[_0xc985('0x10')](0x1f4,_0x404a72[_0xc985('0x12')]));});});};exports['CreateCmHopper']=function(_0x1ec0d8){var _0x4b213d=this;return new Promise(function(_0x5244ec,_0x3d64ed){return db[_0xc985('0x15')][_0xc985('0x22')](_0x1ec0d8[_0xc985('0x23')],{'raw':_0x1ec0d8[_0xc985('0x17')]?_0x1ec0d8[_0xc985('0x17')][_0xc985('0x18')]===undefined?!![]:![]:!![]})[_0xc985('0x9')](function(_0x53ab52){logger['info'](_0xc985('0x24'),_0x1ec0d8);logger[_0xc985('0xd')](_0xc985('0x24'),_0x1ec0d8,JSON[_0xc985('0xf')](_0x53ab52));_0x5244ec(_0x53ab52);})['catch'](function(_0x555101){logger[_0xc985('0x10')](_0xc985('0x24'),_0x555101[_0xc985('0x12')],_0x1ec0d8);_0x3d64ed(_0x4b213d['error'](0x1f4,_0x555101['message']));});});};exports['UpdateCmHopper']=function(_0x1ffa7b){var _0x545303=this;return new Promise(function(_0x177eac,_0x4d24b7){return db[_0xc985('0x15')]['update'](_0x1ffa7b[_0xc985('0x23')],{'raw':_0x1ffa7b[_0xc985('0x17')]?_0x1ffa7b[_0xc985('0x17')][_0xc985('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ffa7b[_0xc985('0x17')]?_0x1ffa7b[_0xc985('0x17')][_0xc985('0x21')]||null:null,'attributes':_0x1ffa7b[_0xc985('0x17')]?_0x1ffa7b[_0xc985('0x17')][_0xc985('0x19')]||null:null,'limit':_0x1ffa7b[_0xc985('0x17')]?_0x1ffa7b['options'][_0xc985('0x1a')]||null:null})[_0xc985('0x9')](function(_0x5639c8){logger[_0xc985('0xa')](_0xc985('0x25'),_0x1ffa7b);logger[_0xc985('0xd')](_0xc985('0x25'),_0x1ffa7b,JSON['stringify'](_0x5639c8));_0x177eac(_0x5639c8);})[_0xc985('0x1e')](function(_0x19cdd3){logger[_0xc985('0x10')](_0xc985('0x25'),_0x19cdd3['message'],_0x1ffa7b);_0x4d24b7(_0x545303[_0xc985('0x10')](0x1f4,_0x19cdd3['message']));});});};exports['DestroyCmHopper']=function(_0x457cea){var _0x66c7f1=this;return new Promise(function(_0x51643d,_0x397635){return db[_0xc985('0x15')][_0xc985('0x26')]({'where':_0x457cea['options']?_0x457cea[_0xc985('0x17')][_0xc985('0x21')]||null:null})[_0xc985('0x9')](function(_0x1ab52a){logger[_0xc985('0xa')]('DestroyCmHopper',_0x457cea);logger[_0xc985('0xd')](_0xc985('0x27'),_0x457cea,JSON[_0xc985('0xf')](_0x1ab52a));_0x51643d(_0x1ab52a);})['catch'](function(_0x6ee9a7){logger[_0xc985('0x10')](_0xc985('0x27'),_0x6ee9a7[_0xc985('0x12')],_0x457cea);_0x397635(_0x66c7f1[_0xc985('0x10')](0x1f4,_0x6ee9a7[_0xc985('0x12')]));});});};exports[_0xc985('0x28')]=function(_0x4020c2){var _0x19140c=this;return new Promise(function(_0x55013c,_0x4b02f7){return db[_0xc985('0x29')]['describe']()[_0xc985('0x9')](function(_0x3ad919){return db[_0xc985('0x2a')]['transaction'](function(_0x1592f6){return db['CmHopper'][_0xc985('0x16')]({'where':_0x4020c2['options']?_0x4020c2[_0xc985('0x17')][_0xc985('0x21')]||null:null,'attributes':_0x4020c2[_0xc985('0x17')]?_0x4020c2['options'][_0xc985('0x19')]||null:null,'limit':_0x4020c2['options']?_0x4020c2['options']['limit']||null:null,'order':_0x4020c2[_0xc985('0x17')]?_0x4020c2[_0xc985('0x17')][_0xc985('0x2b')]||null:null,'transaction':_0x1592f6,'lock':_0x1592f6[_0xc985('0x2c')]['UPDATE'],'include':[{'model':db[_0xc985('0x29')],'as':_0xc985('0x2d'),'attributes':_[_0xc985('0x2e')](_0x3ad919)}]})[_0xc985('0x9')](function(_0x42066b){var _0x5621bc=[];for(var _0x5a8d0a=0x0;_0x5a8d0a<_0x42066b[_0xc985('0x2f')];_0x5a8d0a+=0x1){_0x5621bc[_0xc985('0x30')](_0x42066b[_0x5a8d0a][_0xc985('0x31')](_0x4020c2[_0xc985('0x23')],{'transaction':_0x1592f6}));}return BPromise[_0xc985('0x32')](_0x5621bc);});})[_0xc985('0x9')](function(_0x47b4fd){logger['info'](_0xc985('0x28'),_0x4020c2);logger[_0xc985('0xd')](_0xc985('0x28'),_0x4020c2,JSON[_0xc985('0xf')](_0x47b4fd));_0x55013c(_0x47b4fd);})['catch'](function(_0x1a11bd){logger[_0xc985('0x10')](_0xc985('0x28'),_0x1a11bd[_0xc985('0x12')],_0x4020c2);_0x4b02f7(_0x19140c[_0xc985('0x10')](0x1f4,_0x1a11bd[_0xc985('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x3c17bb){var _0x59700c=this;return new Promise(function(_0x36f981,_0x55e4e1){return db[_0xc985('0x2a')][_0xc985('0x33')](function(_0x38a7cd){return db['CmHopperFinal'][_0xc985('0x22')](_0x3c17bb[_0xc985('0x23')],{'raw':_0x3c17bb[_0xc985('0x17')]?_0x3c17bb[_0xc985('0x17')][_0xc985('0x18')]===undefined?!![]:![]:!![],'transaction':_0x38a7cd})[_0xc985('0x9')](function(){return db[_0xc985('0x15')][_0xc985('0x26')]({'where':_0x3c17bb[_0xc985('0x17')]?_0x3c17bb['options'][_0xc985('0x21')]||null:null,'transaction':_0x38a7cd});});})['then'](function(_0x49b91b){logger['info'](_0xc985('0x34'),_0x3c17bb);logger['debug'](_0xc985('0x34'),_0x3c17bb,JSON[_0xc985('0xf')](_0x49b91b));_0x36f981(_0x49b91b);})[_0xc985('0x1e')](function(_0x1a9dee){logger[_0xc985('0x10')]('MoveContactManagedDialer',_0x1a9dee[_0xc985('0x12')],_0x3c17bb);_0x55e4e1(_0x59700c['error'](0x1f4,_0x1a9dee[_0xc985('0x12')]));});});};exports[_0xc985('0x35')]=function(_0x2e3544){var _0x3c0d8e=this;return new Promise(function(_0x2855df,_0x79f335){return db[_0xc985('0x15')][_0xc985('0x16')]({'raw':_0x2e3544['options']?_0x2e3544[_0xc985('0x17')][_0xc985('0x18')]===undefined?!![]:![]:!![],'where':_0x2e3544[_0xc985('0x17')]?_0x2e3544[_0xc985('0x17')][_0xc985('0x21')]||null:null,'attributes':[[db[_0xc985('0x2a')]['fn'](_0xc985('0x36'),db[_0xc985('0x2a')]['fn']('IF',db[_0xc985('0x2a')][_0xc985('0x37')](_0xc985('0x38')+util[_0xc985('0x39')](_0xc985('0x3a'),moment()[_0xc985('0x39')](_0xc985('0x3b')))+'\x20,\x201,\x20null'))),_0xc985('0x3c')]]})[_0xc985('0x9')](function(_0x4a93a9){logger[_0xc985('0xa')](_0xc985('0x35'),_0x2e3544);logger['debug'](_0xc985('0x35'),_0x2e3544,JSON[_0xc985('0xf')](_0x4a93a9));_0x2855df(_0x4a93a9);})[_0xc985('0x1e')](function(_0x278e59){logger['error'](_0xc985('0x35'),_0x278e59[_0xc985('0x12')],_0x2e3544);_0x79f335(_0x3c0d8e['error'](0x1f4,_0x278e59[_0xc985('0x12')]));});});};exports['GetContactRecallMe']=function(_0x5a125a){var _0x2908be=this;return new Promise(function(_0x3feb67,_0x2a8e69){return db[_0xc985('0x29')][_0xc985('0x3d')]()[_0xc985('0x9')](function(_0x547a4c){return db[_0xc985('0x2a')]['transaction'](function(_0x3d4db2){return db['CmHopper'][_0xc985('0x16')]({'where':_0x5a125a['options']?_0x5a125a[_0xc985('0x17')][_0xc985('0x21')]||null:null,'attributes':_0x5a125a[_0xc985('0x17')]?_0x5a125a[_0xc985('0x17')][_0xc985('0x19')]||null:null,'limit':0x1,'order':_0x5a125a[_0xc985('0x17')]?_0x5a125a[_0xc985('0x17')][_0xc985('0x2b')]||null:null,'group':db[_0xc985('0x15')][_0xc985('0x3e')],'transaction':_0x3d4db2,'lock':_0x3d4db2[_0xc985('0x2c')][_0xc985('0x3f')],'include':_0x5a125a['options']?_0x5a125a['options']['include']?_[_0xc985('0x1d')](_0x5a125a[_0xc985('0x17')][_0xc985('0x1b')],function(_0x12e326){return{'model':db[_0x12e326['model']],'as':_0x12e326['as'],'attributes':_0x12e326[_0xc985('0x19')],'include':_0x12e326['include']?_[_0xc985('0x1d')](_0x12e326[_0xc985('0x1b')],function(_0x5a5a29){return{'model':db[_0x5a5a29[_0xc985('0x1c')]],'as':_0x5a5a29['as'],'attributes':_0x5a5a29[_0xc985('0x19')],'include':_0x5a5a29[_0xc985('0x1b')]?_[_0xc985('0x1d')](_0x5a5a29[_0xc985('0x1b')],function(_0x130acb){return{'model':db[_0x130acb['model']],'as':_0x130acb['as'],'attributes':_0x130acb[_0xc985('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc985('0x9')](function(_0x2eb304){var _0x562c04=[];for(var _0x5259d6=0x0;_0x5259d6<_0x2eb304[_0xc985('0x2f')];_0x5259d6+=0x1){_0x562c04[_0xc985('0x30')](_0x2eb304[_0x5259d6][_0xc985('0x31')](_0x5a125a['body'],{'transaction':_0x3d4db2}));}return BPromise[_0xc985('0x32')](_0x562c04);});})[_0xc985('0x9')](function(_0x490063){logger[_0xc985('0xa')](_0xc985('0x40'),_0x5a125a);logger[_0xc985('0xd')](_0xc985('0x40'),_0x5a125a,JSON['stringify'](_0x490063));_0x3feb67(_0x490063);})[_0xc985('0x1e')](function(_0x4d4dff){logger[_0xc985('0x10')]('GetContactRecallMe',_0x4d4dff['message'],_0x5a125a);_0x2a8e69(_0x2908be['error'](0x1f4,_0x4d4dff[_0xc985('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 96e3574..4d5ba58 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 _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(_0x1d6960,_0x11a48a){var _0x278934=function(_0x36dd3d){while(--_0x36dd3d){_0x1d6960['push'](_0x1d6960['shift']());}};_0x278934(++_0x11a48a);}(_0x7a54,0x106));var _0x47a5=function(_0x32de47,_0x458327){_0x32de47=_0x32de47-0x0;var _0x4f135e=_0x7a54[_0x32de47];return _0x4f135e;};'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 +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(_0x3f9517,_0x3e25c1){var _0x298d82=function(_0x5b2065){while(--_0x5b2065){_0x3f9517['push'](_0x3f9517['shift']());}};_0x298d82(++_0x3e25c1);}(_0x7a54,0x106));var _0x47a5=function(_0x140f0b,_0x375c5f){_0x140f0b=_0x140f0b-0x0;var _0x915ed1=_0x7a54[_0x140f0b];return _0x915ed1;};'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 43b1cf0..c654d18 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 _0xbe63=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x1e3905,_0x5e68d0){var _0x1c0e49=function(_0x3adee5){while(--_0x3adee5){_0x1e3905['push'](_0x1e3905['shift']());}};_0x1c0e49(++_0x5e68d0);}(_0xbe63,0x16b));var _0x3be6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xbe63[_0x5d4607];return _0x5e4a86;};'use strict';var moment=require('moment');var Sequelize=require(_0x3be6('0x0'));module[_0x3be6('0x1')]={'phone':{'type':Sequelize[_0x3be6('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3be6('0x3')],'unique':_0x3be6('0x4')},'ListId':{'type':Sequelize[_0x3be6('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x3be6('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x30c3=['contactListQueue','INTEGER','moment','exports','STRING'];(function(_0x4383e9,_0xa4b307){var _0x355405=function(_0x545b5b){while(--_0x545b5b){_0x4383e9['push'](_0x4383e9['shift']());}};_0x355405(++_0xa4b307);}(_0x30c3,0xac));var _0x330c=function(_0x388caa,_0x7bc7b8){_0x388caa=_0x388caa-0x0;var _0x5ecbe6=_0x30c3[_0x388caa];return _0x5ecbe6;};'use strict';var moment=require(_0x330c('0x0'));var Sequelize=require('sequelize');module[_0x330c('0x1')]={'phone':{'type':Sequelize[_0x330c('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x330c('0x3')},'ListId':{'type':Sequelize[_0x330c('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x330c('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 4f8c50c..2391a06 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 _0x8167=['jsforce','desk.js','querystring','papaparse','ioredis','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','save','update','then','destroy','sendStatus','error','name','send','index','CmHopperBlack','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','order','sort','day','add','merge','where','filter','map','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','body','catch','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x1a39a4,_0x3120c5){var _0x57c77d=function(_0x114731){while(--_0x114731){_0x1a39a4['push'](_0x1a39a4['shift']());}};_0x57c77d(++_0x3120c5);}(_0x8167,0x192));var _0x7816=function(_0x8a2b1d,_0x15e260){_0x8a2b1d=_0x8a2b1d-0x0;var _0x519554=_0x8167[_0x8a2b1d];return _0x519554;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7816('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7816('0x1'));var jsonpatch=require(_0x7816('0x2'));var rp=require('request-promise');var moment=require(_0x7816('0x3'));var BPromise=require(_0x7816('0x4'));var Mustache=require('mustache');var util=require(_0x7816('0x5'));var path=require('path');var sox=require(_0x7816('0x6'));var csv=require(_0x7816('0x7'));var ejs=require(_0x7816('0x8'));var fs=require('fs');var _=require(_0x7816('0x9'));var squel=require(_0x7816('0xa'));var crypto=require(_0x7816('0xb'));var jsforce=require(_0x7816('0xc'));var deskjs=require(_0x7816('0xd'));var toCsv=require(_0x7816('0x7'));var querystring=require(_0x7816('0xe'));var Papa=require(_0x7816('0xf'));var Redis=require(_0x7816('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7816('0x11'));var utils=require('../../config/utils');var config=require(_0x7816('0x12'));var db=require(_0x7816('0x13'))['db'];function respondWithStatusCode(_0x2b8ee0,_0x3f8514){_0x3f8514=_0x3f8514||0xcc;return function(_0x64c9f4){if(_0x64c9f4){return _0x2b8ee0['sendStatus'](_0x3f8514);}return _0x2b8ee0[_0x7816('0x14')](_0x3f8514)[_0x7816('0x15')]();};}function respondWithResult(_0x116d38,_0x44e3e1){_0x44e3e1=_0x44e3e1||0xc8;return function(_0x1d87cc){if(_0x1d87cc){return _0x116d38['status'](_0x44e3e1)['json'](_0x1d87cc);}};}function respondWithFilteredResult(_0x4b33f6,_0x28347e){return function(_0x5e26b0){if(_0x5e26b0){var _0x5e6e18=_0x5e26b0[_0x7816('0x16')],_0x39d89c=_0x28347e[_0x7816('0x17')],_0x2fcb4a=_0x28347e['offset']+_0x28347e[_0x7816('0x18')],_0x4bd904;if(_0x2fcb4a>=_0x5e6e18){_0x2fcb4a=_0x5e6e18;_0x4bd904=0xc8;}else{_0x4bd904=0xce;}_0x4b33f6['status'](_0x4bd904);return _0x4b33f6[_0x7816('0x19')]('Content-Range',_0x39d89c+'-'+_0x2fcb4a+'/'+_0x5e6e18)[_0x7816('0x1a')](_0x5e26b0);}return null;};}function patchUpdates(_0x3c0ca0){return function(_0x177385){try{jsonpatch[_0x7816('0x1b')](_0x177385,_0x3c0ca0,!![]);}catch(_0x418197){return BPromise['reject'](_0x418197);}return _0x177385[_0x7816('0x1c')]();};}function saveUpdates(_0x2d04a5,_0x3e4341){return function(_0x27b847){if(_0x27b847){return _0x27b847[_0x7816('0x1d')](_0x2d04a5)[_0x7816('0x1e')](function(_0x3bb222){return _0x3bb222;});}return null;};}function removeEntity(_0x40a261,_0x476077){return function(_0x4eff06){if(_0x4eff06){return _0x4eff06[_0x7816('0x1f')]()['then'](function(){_0x40a261[_0x7816('0x14')](0xcc)[_0x7816('0x15')]();});}};}function handleEntityNotFound(_0x3bb435,_0x36aa9c){return function(_0x5547b1){if(!_0x5547b1){_0x3bb435[_0x7816('0x20')](0x194);}return _0x5547b1;};}function handleError(_0x52f465,_0x45cdaa){_0x45cdaa=_0x45cdaa||0x1f4;return function(_0x5da148){logger[_0x7816('0x21')](_0x5da148['stack']);if(_0x5da148['name']){delete _0x5da148[_0x7816('0x22')];}_0x52f465[_0x7816('0x14')](_0x45cdaa)[_0x7816('0x23')](_0x5da148);};}exports[_0x7816('0x24')]=function(_0xf7c40d,_0x1354b9){var _0x22af0={},_0x516cee={},_0x3ab1f1={'count':0x0,'rows':[]};var _0x50558c=db[_0x7816('0x25')]['rawAttributes'];_0x516cee[_0x7816('0x26')]=_[_0x7816('0x27')](_0x50558c);var _0x4d46b2={'dateStart':_0xf7c40d[_0x7816('0x28')][_0x7816('0x29')],'dateEnd':_0xf7c40d[_0x7816('0x28')][_0x7816('0x2a')]};delete _0xf7c40d[_0x7816('0x28')][_0x7816('0x29')];delete _0xf7c40d[_0x7816('0x28')][_0x7816('0x2a')];_0x516cee[_0x7816('0x28')]=_[_0x7816('0x27')](_0xf7c40d[_0x7816('0x28')]);_0x516cee[_0x7816('0x2b')]=_['intersection'](_0x516cee['model'],_0x516cee[_0x7816('0x28')]);_0x22af0[_0x7816('0x2c')]=_[_0x7816('0x2d')](_0x516cee[_0x7816('0x26')],qs[_0x7816('0x2e')](_0xf7c40d[_0x7816('0x28')][_0x7816('0x2e')]));_0x22af0[_0x7816('0x2c')]=_0x22af0['attributes'][_0x7816('0x2f')]?_0x22af0['attributes']:_0x516cee[_0x7816('0x26')];if(!_0xf7c40d[_0x7816('0x28')]['hasOwnProperty'](_0x7816('0x30'))){_0x22af0[_0x7816('0x18')]=qs['limit'](_0xf7c40d[_0x7816('0x28')][_0x7816('0x18')]);_0x22af0[_0x7816('0x17')]=qs[_0x7816('0x17')](_0xf7c40d[_0x7816('0x28')][_0x7816('0x17')]);}_0x22af0[_0x7816('0x31')]=qs['sort'](_0xf7c40d[_0x7816('0x28')][_0x7816('0x32')]);_0x22af0['where']=qs[_0x7816('0x2b')](_['pick'](_0xf7c40d[_0x7816('0x28')],_0x516cee['filters']));if(_0x4d46b2[_0x7816('0x29')]){if(_0x4d46b2['dateEnd']){_0x4d46b2['dateEnd']=moment(_0x4d46b2['dateEnd'])['add'](0x1,_0x7816('0x33'));}else{_0x4d46b2[_0x7816('0x2a')]=moment(_0x4d46b2[_0x7816('0x29')])[_0x7816('0x34')](0x1,_0x7816('0x33'));}_[_0x7816('0x35')](_0x22af0[_0x7816('0x36')],{'createdAt':{'$gte':_0x4d46b2[_0x7816('0x29')],'$lte':_0x4d46b2[_0x7816('0x2a')]}});}if(_0xf7c40d[_0x7816('0x28')][_0x7816('0x37')]){_0x22af0['where']=_[_0x7816('0x35')](_0x22af0[_0x7816('0x36')],{'$or':_[_0x7816('0x38')](_0x22af0[_0x7816('0x2c')],function(_0x40ac1b){var _0x4b72c2={};_0x4b72c2[_0x40ac1b]={'$like':'%'+_0xf7c40d[_0x7816('0x28')]['filter']+'%'};return _0x4b72c2;})});}_0x22af0=_[_0x7816('0x35')]({},_0x22af0,_0xf7c40d[_0x7816('0x39')]);var _0x37ac19={'where':_0x22af0[_0x7816('0x36')]};return db[_0x7816('0x25')]['count'](_0x37ac19)[_0x7816('0x1e')](function(_0x112528){_0x3ab1f1['count']=_0x112528;if(_0xf7c40d[_0x7816('0x28')][_0x7816('0x3a')]){_0x22af0['include']=[{'all':!![]}];}return db[_0x7816('0x25')][_0x7816('0x3b')](_0x22af0);})[_0x7816('0x1e')](function(_0x5f2158){_0x3ab1f1[_0x7816('0x3c')]=_0x5f2158;return _0x3ab1f1;})[_0x7816('0x1e')](respondWithFilteredResult(_0x1354b9,_0x22af0))['catch'](handleError(_0x1354b9,null));};exports[_0x7816('0x3d')]=function(_0x2161ab,_0xd8bb2f){var _0x16f97a={'raw':!![],'where':{'id':_0x2161ab[_0x7816('0x3e')]['id']}},_0x58c36e={};_0x58c36e[_0x7816('0x26')]=_[_0x7816('0x27')](db[_0x7816('0x25')][_0x7816('0x3f')]);_0x58c36e['query']=_['keys'](_0x2161ab[_0x7816('0x28')]);_0x58c36e['filters']=_[_0x7816('0x2d')](_0x58c36e[_0x7816('0x26')],_0x58c36e[_0x7816('0x28')]);_0x16f97a[_0x7816('0x2c')]=_[_0x7816('0x2d')](_0x58c36e[_0x7816('0x26')],qs[_0x7816('0x2e')](_0x2161ab[_0x7816('0x28')]['fields']));_0x16f97a[_0x7816('0x2c')]=_0x16f97a['attributes']['length']?_0x16f97a['attributes']:_0x58c36e[_0x7816('0x26')];if(_0x2161ab[_0x7816('0x28')][_0x7816('0x3a')]){_0x16f97a[_0x7816('0x40')]=[{'all':!![]}];}_0x16f97a=_[_0x7816('0x35')]({},_0x16f97a,_0x2161ab['options']);return db[_0x7816('0x25')][_0x7816('0x41')](_0x16f97a)['then'](handleEntityNotFound(_0xd8bb2f,null))[_0x7816('0x1e')](respondWithResult(_0xd8bb2f,null))['catch'](handleError(_0xd8bb2f,null));};exports[_0x7816('0x1d')]=function(_0x5caeff,_0x35ba3f){if(_0x5caeff[_0x7816('0x42')]['id']){delete _0x5caeff[_0x7816('0x42')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x5caeff[_0x7816('0x3e')]['id']}})[_0x7816('0x1e')](handleEntityNotFound(_0x35ba3f,null))['then'](saveUpdates(_0x5caeff[_0x7816('0x42')],null))[_0x7816('0x1e')](respondWithResult(_0x35ba3f,null))[_0x7816('0x43')](handleError(_0x35ba3f,null));};exports[_0x7816('0x1f')]=function(_0x1e90e6,_0x59534c){return db['CmHopperBlack'][_0x7816('0x41')]({'where':{'id':_0x1e90e6[_0x7816('0x3e')]['id']}})[_0x7816('0x1e')](handleEntityNotFound(_0x59534c,null))[_0x7816('0x1e')](removeEntity(_0x59534c,null))[_0x7816('0x43')](handleError(_0x59534c,null));};exports['describe']=function(_0x49a4a1,_0x42e099){return db[_0x7816('0x25')][_0x7816('0x44')]()[_0x7816('0x1e')](respondWithResult(_0x42e099,null))[_0x7816('0x43')](handleError(_0x42e099,null));}; \ No newline at end of file +var _0x2591=['crypto','jsforce','desk.js','papaparse','ioredis','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','index','CmHopperBlack','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','add','where','merge','map','filter','options','includeAll','include','findAll','rows','catch','find','body','params','describe','html-pdf','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','squel'];(function(_0x53ae06,_0x381774){var _0x293591=function(_0x31c2c6){while(--_0x31c2c6){_0x53ae06['push'](_0x53ae06['shift']());}};_0x293591(++_0x381774);}(_0x2591,0x17c));var _0x1259=function(_0x131139,_0x5a2871){_0x131139=_0x131139-0x0;var _0x4c02c1=_0x2591[_0x131139];return _0x4c02c1;};'use strict';var pdf=require(_0x1259('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1259('0x1'));var zipdir=require(_0x1259('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1259('0x3'));var BPromise=require(_0x1259('0x4'));var Mustache=require('mustache');var util=require(_0x1259('0x5'));var path=require(_0x1259('0x6'));var sox=require(_0x1259('0x7'));var csv=require('to-csv');var ejs=require(_0x1259('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1259('0x9'));var crypto=require(_0x1259('0xa'));var jsforce=require(_0x1259('0xb'));var deskjs=require(_0x1259('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1259('0xd'));var Redis=require(_0x1259('0xe'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x1259('0xf'));var utils=require('../../config/utils');var config=require(_0x1259('0x10'));var db=require(_0x1259('0x11'))['db'];function respondWithStatusCode(_0x1bfc8a,_0x588540){_0x588540=_0x588540||0xcc;return function(_0x78f7dc){if(_0x78f7dc){return _0x1bfc8a[_0x1259('0x12')](_0x588540);}return _0x1bfc8a[_0x1259('0x13')](_0x588540)[_0x1259('0x14')]();};}function respondWithResult(_0x1997f4,_0x130d9c){_0x130d9c=_0x130d9c||0xc8;return function(_0x3239d8){if(_0x3239d8){return _0x1997f4[_0x1259('0x13')](_0x130d9c)[_0x1259('0x15')](_0x3239d8);}};}function respondWithFilteredResult(_0x297894,_0xd6cdb6){return function(_0x46f5f3){if(_0x46f5f3){var _0x2878a1=_0x46f5f3[_0x1259('0x16')],_0x3587e0=_0xd6cdb6['offset'],_0x542783=_0xd6cdb6[_0x1259('0x17')]+_0xd6cdb6[_0x1259('0x18')],_0x4294d6;if(_0x542783>=_0x2878a1){_0x542783=_0x2878a1;_0x4294d6=0xc8;}else{_0x4294d6=0xce;}_0x297894['status'](_0x4294d6);return _0x297894[_0x1259('0x19')]('Content-Range',_0x3587e0+'-'+_0x542783+'/'+_0x2878a1)[_0x1259('0x15')](_0x46f5f3);}return null;};}function patchUpdates(_0x54992a){return function(_0x25eb5c){try{jsonpatch[_0x1259('0x1a')](_0x25eb5c,_0x54992a,!![]);}catch(_0x50ea17){return BPromise['reject'](_0x50ea17);}return _0x25eb5c[_0x1259('0x1b')]();};}function saveUpdates(_0x353745,_0x1a61eb){return function(_0x1dae8e){if(_0x1dae8e){return _0x1dae8e[_0x1259('0x1c')](_0x353745)[_0x1259('0x1d')](function(_0x195d42){return _0x195d42;});}return null;};}function removeEntity(_0x23130c,_0x1b94ad){return function(_0x12765f){if(_0x12765f){return _0x12765f[_0x1259('0x1e')]()[_0x1259('0x1d')](function(){_0x23130c[_0x1259('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3c5c,_0x1cb477){return function(_0xb73ac8){if(!_0xb73ac8){_0x5b3c5c[_0x1259('0x12')](0x194);}return _0xb73ac8;};}function handleError(_0x468d62,_0x4217fd){_0x4217fd=_0x4217fd||0x1f4;return function(_0x262087){logger[_0x1259('0x1f')](_0x262087[_0x1259('0x20')]);if(_0x262087[_0x1259('0x21')]){delete _0x262087[_0x1259('0x21')];}_0x468d62['status'](_0x4217fd)['send'](_0x262087);};}exports[_0x1259('0x22')]=function(_0x1072ec,_0x1a21d3){var _0x482601={},_0x5d7b3f={},_0x517150={'count':0x0,'rows':[]};var _0x4e33c2=db[_0x1259('0x23')]['rawAttributes'];_0x5d7b3f[_0x1259('0x24')]=_[_0x1259('0x25')](_0x4e33c2);var _0x43398c={'dateStart':_0x1072ec[_0x1259('0x26')]['dateStart'],'dateEnd':_0x1072ec[_0x1259('0x26')][_0x1259('0x27')]};delete _0x1072ec[_0x1259('0x26')][_0x1259('0x28')];delete _0x1072ec[_0x1259('0x26')][_0x1259('0x27')];_0x5d7b3f[_0x1259('0x26')]=_[_0x1259('0x25')](_0x1072ec['query']);_0x5d7b3f[_0x1259('0x29')]=_[_0x1259('0x2a')](_0x5d7b3f[_0x1259('0x24')],_0x5d7b3f[_0x1259('0x26')]);_0x482601['attributes']=_['intersection'](_0x5d7b3f['model'],qs[_0x1259('0x2b')](_0x1072ec[_0x1259('0x26')]['fields']));_0x482601['attributes']=_0x482601[_0x1259('0x2c')][_0x1259('0x2d')]?_0x482601[_0x1259('0x2c')]:_0x5d7b3f['model'];if(!_0x1072ec['query'][_0x1259('0x2e')](_0x1259('0x2f'))){_0x482601['limit']=qs[_0x1259('0x18')](_0x1072ec[_0x1259('0x26')][_0x1259('0x18')]);_0x482601['offset']=qs[_0x1259('0x17')](_0x1072ec[_0x1259('0x26')][_0x1259('0x17')]);}_0x482601['order']=qs[_0x1259('0x30')](_0x1072ec['query'][_0x1259('0x30')]);_0x482601['where']=qs[_0x1259('0x29')](_[_0x1259('0x31')](_0x1072ec['query'],_0x5d7b3f[_0x1259('0x29')]));if(_0x43398c[_0x1259('0x28')]){if(_0x43398c[_0x1259('0x27')]){_0x43398c[_0x1259('0x27')]=moment(_0x43398c[_0x1259('0x27')])['add'](0x1,'day');}else{_0x43398c['dateEnd']=moment(_0x43398c[_0x1259('0x28')])[_0x1259('0x32')](0x1,'day');}_['merge'](_0x482601[_0x1259('0x33')],{'createdAt':{'$gte':_0x43398c[_0x1259('0x28')],'$lte':_0x43398c['dateEnd']}});}if(_0x1072ec[_0x1259('0x26')]['filter']){_0x482601[_0x1259('0x33')]=_[_0x1259('0x34')](_0x482601[_0x1259('0x33')],{'$or':_[_0x1259('0x35')](_0x482601[_0x1259('0x2c')],function(_0x43c066){var _0x57d82b={};_0x57d82b[_0x43c066]={'$like':'%'+_0x1072ec['query'][_0x1259('0x36')]+'%'};return _0x57d82b;})});}_0x482601=_['merge']({},_0x482601,_0x1072ec[_0x1259('0x37')]);var _0xb417f1={'where':_0x482601[_0x1259('0x33')]};return db[_0x1259('0x23')]['count'](_0xb417f1)[_0x1259('0x1d')](function(_0x35a0d4){_0x517150[_0x1259('0x16')]=_0x35a0d4;if(_0x1072ec[_0x1259('0x26')][_0x1259('0x38')]){_0x482601[_0x1259('0x39')]=[{'all':!![]}];}return db[_0x1259('0x23')][_0x1259('0x3a')](_0x482601);})['then'](function(_0x2a0fb6){_0x517150[_0x1259('0x3b')]=_0x2a0fb6;return _0x517150;})[_0x1259('0x1d')](respondWithFilteredResult(_0x1a21d3,_0x482601))[_0x1259('0x3c')](handleError(_0x1a21d3,null));};exports['show']=function(_0x4dfb3b,_0x396263){var _0x4ced4f={'raw':!![],'where':{'id':_0x4dfb3b['params']['id']}},_0x580b06={};_0x580b06['model']=_[_0x1259('0x25')](db['CmHopperBlack']['rawAttributes']);_0x580b06['query']=_[_0x1259('0x25')](_0x4dfb3b[_0x1259('0x26')]);_0x580b06[_0x1259('0x29')]=_['intersection'](_0x580b06[_0x1259('0x24')],_0x580b06['query']);_0x4ced4f[_0x1259('0x2c')]=_[_0x1259('0x2a')](_0x580b06[_0x1259('0x24')],qs[_0x1259('0x2b')](_0x4dfb3b[_0x1259('0x26')][_0x1259('0x2b')]));_0x4ced4f['attributes']=_0x4ced4f[_0x1259('0x2c')][_0x1259('0x2d')]?_0x4ced4f[_0x1259('0x2c')]:_0x580b06[_0x1259('0x24')];if(_0x4dfb3b[_0x1259('0x26')]['includeAll']){_0x4ced4f['include']=[{'all':!![]}];}_0x4ced4f=_[_0x1259('0x34')]({},_0x4ced4f,_0x4dfb3b[_0x1259('0x37')]);return db[_0x1259('0x23')][_0x1259('0x3d')](_0x4ced4f)['then'](handleEntityNotFound(_0x396263,null))[_0x1259('0x1d')](respondWithResult(_0x396263,null))[_0x1259('0x3c')](handleError(_0x396263,null));};exports[_0x1259('0x1c')]=function(_0x324ad4,_0xd84151){if(_0x324ad4['body']['id']){delete _0x324ad4[_0x1259('0x3e')]['id'];}return db['CmHopperBlack'][_0x1259('0x3d')]({'where':{'id':_0x324ad4[_0x1259('0x3f')]['id']}})[_0x1259('0x1d')](handleEntityNotFound(_0xd84151,null))[_0x1259('0x1d')](saveUpdates(_0x324ad4[_0x1259('0x3e')],null))[_0x1259('0x1d')](respondWithResult(_0xd84151,null))['catch'](handleError(_0xd84151,null));};exports[_0x1259('0x1e')]=function(_0x50c387,_0x304ea4){return db[_0x1259('0x23')]['find']({'where':{'id':_0x50c387[_0x1259('0x3f')]['id']}})['then'](handleEntityNotFound(_0x304ea4,null))[_0x1259('0x1d')](removeEntity(_0x304ea4,null))[_0x1259('0x3c')](handleError(_0x304ea4,null));};exports[_0x1259('0x40')]=function(_0x17bf39,_0x2d9514){return db[_0x1259('0x23')]['describe']()[_0x1259('0x1d')](respondWithResult(_0x2d9514,null))[_0x1259('0x3c')](handleError(_0x2d9514,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e809705..5b5c834 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 _0x59a3=['cm_hopper_black','lodash','util','../../config/logger','api','bluebird','exports','define','CmHopperBlack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x59a3,0x169));var _0x359a=function(_0x5c9b45,_0x1a4cd4){_0x5c9b45=_0x5c9b45-0x0;var _0x501362=_0x59a3[_0x5c9b45];return _0x501362;};'use strict';var _=require(_0x359a('0x0'));var util=require(_0x359a('0x1'));var logger=require(_0x359a('0x2'))(_0x359a('0x3'));var moment=require('moment');var BPromise=require(_0x359a('0x4'));var rp=require('request-promise');var attributes=require('./cmHopperBlack.attributes');module[_0x359a('0x5')]=function(_0x159fcb,_0x3c5f7e){return _0x159fcb[_0x359a('0x6')](_0x359a('0x7'),attributes,{'tableName':_0x359a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0741=['cm_hopper_black','lodash','util','../../config/logger','api','request-promise','exports','define','CmHopperBlack'];(function(_0x31fbdb,_0x4cca4c){var _0x1e1e9e=function(_0x34b1ee){while(--_0x34b1ee){_0x31fbdb['push'](_0x31fbdb['shift']());}};_0x1e1e9e(++_0x4cca4c);}(_0x0741,0x10f));var _0x1074=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0741[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x1074('0x0'));var util=require(_0x1074('0x1'));var logger=require(_0x1074('0x2'))(_0x1074('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1074('0x4'));var attributes=require('./cmHopperBlack.attributes');module[_0x1074('0x5')]=function(_0x432e60,_0x3d2630){return _0x432e60[_0x1074('0x6')](_0x1074('0x7'),attributes,{'tableName':_0x1074('0x8'),'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 2c6f675..d30aaae 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 _0xa04a=['request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','model','attributes','map','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa04a,0x8f));var _0xaa04=function(_0x186232,_0x56e14e){_0x186232=_0x186232-0x0;var _0x403a4d=_0xa04a[_0x186232];return _0x403a4d;};'use strict';var _=require(_0xaa04('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa04('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa04('0x2'));var db=require(_0xaa04('0x3'))['db'];var utils=require(_0xaa04('0x4'));var logger=require(_0xaa04('0x5'))('rpc');var config=require(_0xaa04('0x6'));var jayson=require(_0xaa04('0x7'));var client=jayson[_0xaa04('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9fb972,_0x4af8db,_0x5a1f1f){return new BPromise(function(_0x51ad6f,_0x146996){return client[_0xaa04('0x9')](_0x9fb972,_0x5a1f1f)[_0xaa04('0xa')](function(_0x23f4cc){logger['info'](_0xaa04('0xb'),_0x4af8db,_0xaa04('0xc'));logger[_0xaa04('0xd')](_0xaa04('0xe'),_0x4af8db,_0xaa04('0xc'),JSON[_0xaa04('0xf')](_0x23f4cc));if(_0x23f4cc[_0xaa04('0x10')]){if(_0x23f4cc['error'][_0xaa04('0x11')]===0x1f4){logger[_0xaa04('0x10')](_0xaa04('0xb'),_0x4af8db,_0x23f4cc['error'][_0xaa04('0x12')]);return _0x146996(_0x23f4cc[_0xaa04('0x10')][_0xaa04('0x12')]);}logger[_0xaa04('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x4af8db,_0x23f4cc[_0xaa04('0x10')][_0xaa04('0x12')]);return _0x51ad6f(_0x23f4cc[_0xaa04('0x10')]['message']);}else{logger[_0xaa04('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x4af8db,_0xaa04('0xc'));_0x51ad6f(_0x23f4cc[_0xaa04('0x14')][_0xaa04('0x12')]);}})[_0xaa04('0x15')](function(_0x2c530a){logger[_0xaa04('0x10')](_0xaa04('0xb'),_0x4af8db,_0x2c530a);_0x146996(_0x2c530a);});});}exports[_0xaa04('0x16')]=function(_0x3c77e4){var _0x440717=this;return new Promise(function(_0x1b802b,_0xeb7e06){return db[_0xaa04('0x17')][_0xaa04('0x18')]({'raw':_0x3c77e4[_0xaa04('0x19')]?_0x3c77e4['options'][_0xaa04('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c77e4[_0xaa04('0x19')]?_0x3c77e4[_0xaa04('0x19')][_0xaa04('0x1b')]||null:null,'attributes':_0x3c77e4[_0xaa04('0x19')]?_0x3c77e4['options']['attributes']||null:null,'limit':_0x3c77e4[_0xaa04('0x19')]?_0x3c77e4['options'][_0xaa04('0x1c')]||null:null,'include':_0x3c77e4[_0xaa04('0x19')]?_0x3c77e4[_0xaa04('0x19')][_0xaa04('0x1d')]?_['map'](_0x3c77e4[_0xaa04('0x19')]['include'],function(_0xa1fef6){return{'model':db[_0xa1fef6[_0xaa04('0x1e')]],'as':_0xa1fef6['as'],'attributes':_0xa1fef6[_0xaa04('0x1f')],'include':_0xa1fef6[_0xaa04('0x1d')]?_[_0xaa04('0x20')](_0xa1fef6[_0xaa04('0x1d')],function(_0x189de4){return{'model':db[_0x189de4['model']],'as':_0x189de4['as'],'attributes':_0x189de4[_0xaa04('0x1f')],'include':_0x189de4[_0xaa04('0x1d')]?_[_0xaa04('0x20')](_0x189de4['include'],function(_0x254d60){return{'model':db[_0x254d60[_0xaa04('0x1e')]],'as':_0x254d60['as'],'attributes':_0x254d60[_0xaa04('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x174f46){logger[_0xaa04('0x13')](_0xaa04('0x16'),_0x3c77e4);logger[_0xaa04('0xd')](_0xaa04('0x16'),_0x3c77e4,JSON['stringify'](_0x174f46));_0x1b802b(_0x174f46);})[_0xaa04('0x15')](function(_0x48ccd7){logger[_0xaa04('0x10')](_0xaa04('0x16'),_0x48ccd7[_0xaa04('0x12')],_0x3c77e4);_0xeb7e06(_0x440717[_0xaa04('0x10')](0x1f4,_0x48ccd7['message']));});});};exports[_0xaa04('0x21')]=function(_0x24a772){var _0x126d96=this;return new Promise(function(_0x4d6df1,_0x273357){return db[_0xaa04('0x17')][_0xaa04('0x22')](_0x24a772[_0xaa04('0x23')],{'raw':_0x24a772['options']?_0x24a772[_0xaa04('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24a772[_0xaa04('0x19')]?_0x24a772['options'][_0xaa04('0x1b')]||null:null,'attributes':_0x24a772['options']?_0x24a772['options']['attributes']||null:null,'limit':_0x24a772[_0xaa04('0x19')]?_0x24a772[_0xaa04('0x19')][_0xaa04('0x1c')]||null:null})[_0xaa04('0xa')](function(_0x336553){logger[_0xaa04('0x13')](_0xaa04('0x21'),_0x24a772);logger[_0xaa04('0xd')](_0xaa04('0x21'),_0x24a772,JSON[_0xaa04('0xf')](_0x336553));_0x4d6df1(_0x336553);})[_0xaa04('0x15')](function(_0xea5a2f){logger[_0xaa04('0x10')](_0xaa04('0x21'),_0xea5a2f[_0xaa04('0x12')],_0x24a772);_0x273357(_0x126d96[_0xaa04('0x10')](0x1f4,_0xea5a2f[_0xaa04('0x12')]));});});};exports[_0xaa04('0x24')]=function(_0x5cd838){var _0x44dfa0=this;return new Promise(function(_0x1b0a55,_0xfceef8){return db[_0xaa04('0x17')][_0xaa04('0x25')]({'where':_0x5cd838[_0xaa04('0x19')]?_0x5cd838[_0xaa04('0x19')][_0xaa04('0x1b')]||null:null})['then'](function(_0x43cc23){logger[_0xaa04('0x13')](_0xaa04('0x24'),_0x5cd838);logger[_0xaa04('0xd')](_0xaa04('0x24'),_0x5cd838,JSON[_0xaa04('0xf')](_0x43cc23));_0x1b0a55(_0x43cc23);})[_0xaa04('0x15')](function(_0x1e5d53){logger['error']('DestroyCmHopperBlack',_0x1e5d53[_0xaa04('0x12')],_0x5cd838);_0xfceef8(_0x44dfa0['error'](0x1f4,_0x1e5d53[_0xaa04('0x12')]));});});}; \ No newline at end of file +var _0x8fc6=['destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','then','UpdateCmHopperBlack','limit','DestroyCmHopperBlack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8fc6,0x76));var _0x68fc=function(_0x445b7e,_0x3ea85f){_0x445b7e=_0x445b7e-0x0;var _0x17d997=_0x8fc6[_0x445b7e];return _0x17d997;};'use strict';var _=require(_0x68fc('0x0'));var util=require(_0x68fc('0x1'));var moment=require(_0x68fc('0x2'));var BPromise=require(_0x68fc('0x3'));var rs=require(_0x68fc('0x4'));var fs=require('fs');var Redis=require(_0x68fc('0x5'));var db=require(_0x68fc('0x6'))['db'];var utils=require(_0x68fc('0x7'));var logger=require(_0x68fc('0x8'))(_0x68fc('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x68fc('0xa')][_0x68fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b36b7,_0x18af0c,_0x2d32d7){return new BPromise(function(_0x1fdcfb,_0x1d13fb){return client[_0x68fc('0xc')](_0x1b36b7,_0x2d32d7)['then'](function(_0x49ac3f){logger[_0x68fc('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x18af0c,_0x68fc('0xe'));logger[_0x68fc('0xf')](_0x68fc('0x10'),_0x18af0c,_0x68fc('0xe'),JSON[_0x68fc('0x11')](_0x49ac3f));if(_0x49ac3f[_0x68fc('0x12')]){if(_0x49ac3f[_0x68fc('0x12')][_0x68fc('0x13')]===0x1f4){logger[_0x68fc('0x12')](_0x68fc('0x14'),_0x18af0c,_0x49ac3f[_0x68fc('0x12')][_0x68fc('0x15')]);return _0x1d13fb(_0x49ac3f['error'][_0x68fc('0x15')]);}logger[_0x68fc('0x12')](_0x68fc('0x14'),_0x18af0c,_0x49ac3f[_0x68fc('0x12')]['message']);return _0x1fdcfb(_0x49ac3f[_0x68fc('0x12')]['message']);}else{logger[_0x68fc('0xd')](_0x68fc('0x14'),_0x18af0c,_0x68fc('0xe'));_0x1fdcfb(_0x49ac3f[_0x68fc('0x16')][_0x68fc('0x15')]);}})[_0x68fc('0x17')](function(_0x521e27){logger[_0x68fc('0x12')](_0x68fc('0x14'),_0x18af0c,_0x521e27);_0x1d13fb(_0x521e27);});});}exports[_0x68fc('0x18')]=function(_0x32f34e){var _0x5ee4af=this;return new Promise(function(_0x5325ad,_0x47a623){return db[_0x68fc('0x19')][_0x68fc('0x1a')]({'raw':_0x32f34e[_0x68fc('0x1b')]?_0x32f34e[_0x68fc('0x1b')][_0x68fc('0x1c')]===undefined?!![]:![]:!![],'where':_0x32f34e[_0x68fc('0x1b')]?_0x32f34e[_0x68fc('0x1b')][_0x68fc('0x1d')]||null:null,'attributes':_0x32f34e['options']?_0x32f34e[_0x68fc('0x1b')][_0x68fc('0x1e')]||null:null,'limit':_0x32f34e[_0x68fc('0x1b')]?_0x32f34e[_0x68fc('0x1b')]['limit']||null:null,'include':_0x32f34e[_0x68fc('0x1b')]?_0x32f34e[_0x68fc('0x1b')][_0x68fc('0x1f')]?_[_0x68fc('0x20')](_0x32f34e['options'][_0x68fc('0x1f')],function(_0x49a333){return{'model':db[_0x49a333[_0x68fc('0x21')]],'as':_0x49a333['as'],'attributes':_0x49a333['attributes'],'include':_0x49a333['include']?_[_0x68fc('0x20')](_0x49a333[_0x68fc('0x1f')],function(_0x4a6bb3){return{'model':db[_0x4a6bb3['model']],'as':_0x4a6bb3['as'],'attributes':_0x4a6bb3[_0x68fc('0x1e')],'include':_0x4a6bb3['include']?_[_0x68fc('0x20')](_0x4a6bb3[_0x68fc('0x1f')],function(_0x5244f7){return{'model':db[_0x5244f7[_0x68fc('0x21')]],'as':_0x5244f7['as'],'attributes':_0x5244f7[_0x68fc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x68fc('0x22')](function(_0x422121){logger[_0x68fc('0xd')](_0x68fc('0x18'),_0x32f34e);logger[_0x68fc('0xf')](_0x68fc('0x18'),_0x32f34e,JSON[_0x68fc('0x11')](_0x422121));_0x5325ad(_0x422121);})[_0x68fc('0x17')](function(_0x473491){logger[_0x68fc('0x12')](_0x68fc('0x18'),_0x473491['message'],_0x32f34e);_0x47a623(_0x5ee4af[_0x68fc('0x12')](0x1f4,_0x473491[_0x68fc('0x15')]));});});};exports[_0x68fc('0x23')]=function(_0x37ccfe){var _0xc48d7a=this;return new Promise(function(_0x37b588,_0x4dd250){return db['CmHopperBlack']['update'](_0x37ccfe['body'],{'raw':_0x37ccfe[_0x68fc('0x1b')]?_0x37ccfe[_0x68fc('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37ccfe[_0x68fc('0x1b')]?_0x37ccfe[_0x68fc('0x1b')][_0x68fc('0x1d')]||null:null,'attributes':_0x37ccfe[_0x68fc('0x1b')]?_0x37ccfe[_0x68fc('0x1b')]['attributes']||null:null,'limit':_0x37ccfe[_0x68fc('0x1b')]?_0x37ccfe[_0x68fc('0x1b')][_0x68fc('0x24')]||null:null})[_0x68fc('0x22')](function(_0x3d747a){logger[_0x68fc('0xd')](_0x68fc('0x23'),_0x37ccfe);logger[_0x68fc('0xf')](_0x68fc('0x23'),_0x37ccfe,JSON[_0x68fc('0x11')](_0x3d747a));_0x37b588(_0x3d747a);})[_0x68fc('0x17')](function(_0xb15d20){logger[_0x68fc('0x12')](_0x68fc('0x23'),_0xb15d20[_0x68fc('0x15')],_0x37ccfe);_0x4dd250(_0xc48d7a[_0x68fc('0x12')](0x1f4,_0xb15d20[_0x68fc('0x15')]));});});};exports[_0x68fc('0x25')]=function(_0x37867a){var _0x9bc01=this;return new Promise(function(_0x11b7a1,_0x458037){return db['CmHopperBlack'][_0x68fc('0x26')]({'where':_0x37867a[_0x68fc('0x1b')]?_0x37867a[_0x68fc('0x1b')][_0x68fc('0x1d')]||null:null})[_0x68fc('0x22')](function(_0x1ef653){logger[_0x68fc('0xd')](_0x68fc('0x25'),_0x37867a);logger[_0x68fc('0xf')](_0x68fc('0x25'),_0x37867a,JSON[_0x68fc('0x11')](_0x1ef653));_0x11b7a1(_0x1ef653);})[_0x68fc('0x17')](function(_0x42c0a1){logger['error'](_0x68fc('0x25'),_0x42c0a1[_0x68fc('0x15')],_0x37867a);_0x458037(_0x9bc01[_0x68fc('0x12')](0x1f4,_0x42c0a1[_0x68fc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index f450352..a0293ca 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 _0x8135=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy'];(function(_0x5a4d43,_0x65a318){var _0x2ea8a0=function(_0x2ca102){while(--_0x2ca102){_0x5a4d43['push'](_0x5a4d43['shift']());}};_0x2ea8a0(++_0x65a318);}(_0x8135,0x99));var _0x5813=function(_0xd7d53a,_0x3ee1ae){_0xd7d53a=_0xd7d53a-0x0;var _0x238e3d=_0x8135[_0xd7d53a];return _0x238e3d;};'use strict';var multer=require('multer');var util=require(_0x5813('0x0'));var path=require(_0x5813('0x1'));var timeout=require(_0x5813('0x2'));var express=require(_0x5813('0x3'));var router=express['Router']();var auth=require(_0x5813('0x4'));var interaction=require(_0x5813('0x5'));var config=require(_0x5813('0x6'));var controller=require(_0x5813('0x7'));router[_0x5813('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5813('0x8')](_0x5813('0x9'),auth[_0x5813('0xa')](),controller[_0x5813('0xb')]);router[_0x5813('0x8')](_0x5813('0xc'),auth[_0x5813('0xa')](),controller[_0x5813('0xd')]);router[_0x5813('0xe')](_0x5813('0xc'),auth[_0x5813('0xa')](),controller[_0x5813('0xf')]);router[_0x5813('0x10')](_0x5813('0xc'),auth[_0x5813('0xa')](),controller[_0x5813('0x11')]);module[_0x5813('0x12')]=router; \ No newline at end of file +var _0xea89=['describe','/:id','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x462f67,_0x148a2c){var _0x3de02a=function(_0x82fa20){while(--_0x82fa20){_0x462f67['push'](_0x462f67['shift']());}};_0x3de02a(++_0x148a2c);}(_0xea89,0x1e2));var _0x9ea8=function(_0xd99bf8,_0xdfc258){_0xd99bf8=_0xd99bf8-0x0;var _0x1cac76=_0xea89[_0xd99bf8];return _0x1cac76;};'use strict';var multer=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var path=require(_0x9ea8('0x2'));var timeout=require(_0x9ea8('0x3'));var express=require(_0x9ea8('0x4'));var router=express['Router']();var auth=require(_0x9ea8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9ea8('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x9ea8('0x7')]('/',auth[_0x9ea8('0x8')](),controller[_0x9ea8('0x9')]);router[_0x9ea8('0x7')](_0x9ea8('0xa'),auth[_0x9ea8('0x8')](),controller[_0x9ea8('0xb')]);router['get'](_0x9ea8('0xc'),auth[_0x9ea8('0x8')](),controller['show']);router[_0x9ea8('0xd')](_0x9ea8('0xc'),auth[_0x9ea8('0x8')](),controller['update']);router[_0x9ea8('0xe')](_0x9ea8('0xc'),auth[_0x9ea8('0x8')](),controller[_0x9ea8('0xf')]);module[_0x9ea8('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 971d260..07b5321 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 _0x3faa=['STRING','DATE','getDataValue','endtime','followuptime','diff','setDataValue','dispositionat','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x3faa,0x1ad));var _0xa3fa=function(_0x451a07,_0x45a6e4){_0x451a07=_0x451a07-0x0;var _0x3914ba=_0x3faa[_0x451a07];return _0x3914ba;};'use strict';var Sequelize=require(_0xa3fa('0x0'));var moment=require('moment');module[_0xa3fa('0x1')]={'state':{'type':Sequelize[_0xa3fa('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa3fa('0x3')]},'scheduledat':{'type':Sequelize[_0xa3fa('0x4')]},'countbusyretry':{'type':Sequelize[_0xa3fa('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa3fa('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa3fa('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa3fa('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa3fa('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xa3fa('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa3fa('0x3')]},'calleridnum':{'type':Sequelize[_0xa3fa('0x3')]},'calleridname':{'type':Sequelize[_0xa3fa('0x3')]},'starttime':{'type':Sequelize[_0xa3fa('0x4')]},'responsetime':{'type':Sequelize[_0xa3fa('0x4')]},'answertime':{'type':Sequelize[_0xa3fa('0x4')]},'droptime':{'type':Sequelize[_0xa3fa('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa3fa('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa3fa('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa3fa('0x3')]},'campaign':{'type':Sequelize[_0xa3fa('0x3')]},'campaigntype':{'type':Sequelize[_0xa3fa('0x3')]},'membername':{'type':Sequelize[_0xa3fa('0x3')]},'reason':{'type':Sequelize[_0xa3fa('0x3')]},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1e28f0){var _0x4cfcdc=this[_0xa3fa('0x5')](_0xa3fa('0x6'));if(_0x4cfcdc&&_0x1e28f0){this['setDataValue'](_0xa3fa('0x7'),moment(_0x1e28f0)[_0xa3fa('0x8')](moment(_0x4cfcdc),'seconds'));}return this[_0xa3fa('0x9')](_0xa3fa('0xa'),_0x1e28f0);}},'amd':{'type':Sequelize[_0xa3fa('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa3fa('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa3fa('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xa3fa('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa3fa('0x4')]},'callback':{'type':Sequelize[_0xa3fa('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa3fa('0x4')]},'deleted':{'type':Sequelize[_0xa3fa('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa3fa('0x4')]},'recallme':{'type':Sequelize[_0xa3fa('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa3fa('0x4')]}}; \ No newline at end of file +var _0x2915=['seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x2d23ed,_0xb3e0ff){var _0x3d8a88=function(_0x657fdd){while(--_0x657fdd){_0x2d23ed['push'](_0x2d23ed['shift']());}};_0x3d8a88(++_0xb3e0ff);}(_0x2915,0x145));var _0x5291=function(_0xb2dab9,_0x2f6f99){_0xb2dab9=_0xb2dab9-0x0;var _0x10c6ae=_0x2915[_0xb2dab9];return _0x10c6ae;};'use strict';var Sequelize=require(_0x5291('0x0'));var moment=require(_0x5291('0x1'));module[_0x5291('0x2')]={'state':{'type':Sequelize[_0x5291('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x5291('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x5291('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5291('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5291('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5291('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x5291('0x4')]},'calleridnum':{'type':Sequelize[_0x5291('0x4')]},'calleridname':{'type':Sequelize[_0x5291('0x4')]},'starttime':{'type':Sequelize[_0x5291('0x5')]},'responsetime':{'type':Sequelize[_0x5291('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x5291('0x5')]},'endtime':{'type':Sequelize[_0x5291('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5291('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5291('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5291('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5291('0x4')]},'reason':{'type':Sequelize[_0x5291('0x4')]},'disposition':{'type':Sequelize[_0x5291('0x4')]},'dispositionat':{'type':Sequelize[_0x5291('0x5')],'set':function(_0x524bea){var _0x113343=this[_0x5291('0x6')](_0x5291('0x7'));if(_0x113343&&_0x524bea){this[_0x5291('0x8')](_0x5291('0x9'),moment(_0x524bea)[_0x5291('0xa')](moment(_0x113343),_0x5291('0xb')));}return this['setDataValue'](_0x5291('0xc'),_0x524bea);}},'amd':{'type':Sequelize[_0x5291('0xd')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5291('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5291('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5291('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5291('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5291('0x5')]},'deleted':{'type':Sequelize[_0x5291('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5291('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index a6e94bb..fffbe75 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 _0xb5b5=['day','merge','where','filter','map','options','CmHopperFinal','includeAll','include','findAll','then','catch','show','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','VoiceQueueId','updatedAt','ANY_VALUE(calleridnum)','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','state\x20=\x204','group','ContactId','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','state\x20=\x20?','state','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset','status','Content-Range','apply','reject','save','update','destroy','error','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','add'];(function(_0x40bdb3,_0x5a81f2){var _0xeac086=function(_0x199fba){while(--_0x199fba){_0x40bdb3['push'](_0x40bdb3['shift']());}};_0xeac086(++_0x5a81f2);}(_0xb5b5,0x149));var _0x5b5b=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0xb5b5[_0x45b1ba];return _0x145ddb;};'use strict';var pdf=require(_0x5b5b('0x0'));var emlformat=require(_0x5b5b('0x1'));var rimraf=require(_0x5b5b('0x2'));var zipdir=require(_0x5b5b('0x3'));var jsonpatch=require(_0x5b5b('0x4'));var rp=require(_0x5b5b('0x5'));var moment=require(_0x5b5b('0x6'));var BPromise=require(_0x5b5b('0x7'));var Mustache=require(_0x5b5b('0x8'));var util=require('util');var path=require('path');var sox=require(_0x5b5b('0x9'));var csv=require(_0x5b5b('0xa'));var ejs=require(_0x5b5b('0xb'));var fs=require('fs');var _=require(_0x5b5b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5b5b('0xd'));var deskjs=require(_0x5b5b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5b5b('0xf'));var Papa=require(_0x5b5b('0x10'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x5b5b('0x11'))(_0x5b5b('0x12'));var utils=require(_0x5b5b('0x13'));var config=require(_0x5b5b('0x14'));var db=require(_0x5b5b('0x15'))['db'];function respondWithStatusCode(_0x1bbf23,_0x38687c){_0x38687c=_0x38687c||0xcc;return function(_0x247e39){if(_0x247e39){return _0x1bbf23[_0x5b5b('0x16')](_0x38687c);}return _0x1bbf23['status'](_0x38687c)[_0x5b5b('0x17')]();};}function respondWithResult(_0x97aaf2,_0x49a34c){_0x49a34c=_0x49a34c||0xc8;return function(_0xcf33e1){if(_0xcf33e1){return _0x97aaf2['status'](_0x49a34c)['json'](_0xcf33e1);}};}function respondWithFilteredResult(_0x4c6d7e,_0x1669f7){return function(_0x4aa308){if(_0x4aa308){var _0x4e78a3=_0x4aa308[_0x5b5b('0x18')],_0x31f61e=_0x1669f7['offset'],_0x56e781=_0x1669f7[_0x5b5b('0x19')]+_0x1669f7['limit'],_0x1d62ad;if(_0x56e781>=_0x4e78a3){_0x56e781=_0x4e78a3;_0x1d62ad=0xc8;}else{_0x1d62ad=0xce;}_0x4c6d7e[_0x5b5b('0x1a')](_0x1d62ad);return _0x4c6d7e['set'](_0x5b5b('0x1b'),_0x31f61e+'-'+_0x56e781+'/'+_0x4e78a3)['json'](_0x4aa308);}return null;};}function patchUpdates(_0x2668c9){return function(_0x46c2ca){try{jsonpatch[_0x5b5b('0x1c')](_0x46c2ca,_0x2668c9,!![]);}catch(_0x58ce60){return BPromise[_0x5b5b('0x1d')](_0x58ce60);}return _0x46c2ca[_0x5b5b('0x1e')]();};}function saveUpdates(_0x17a34b,_0x457346){return function(_0x40c382){if(_0x40c382){return _0x40c382[_0x5b5b('0x1f')](_0x17a34b)['then'](function(_0x3ff8bd){return _0x3ff8bd;});}return null;};}function removeEntity(_0x4b27eb,_0x3322e7){return function(_0x33f181){if(_0x33f181){return _0x33f181[_0x5b5b('0x20')]()['then'](function(){_0x4b27eb[_0x5b5b('0x1a')](0xcc)[_0x5b5b('0x17')]();});}};}function handleEntityNotFound(_0x1a11e9,_0x41afd5){return function(_0x5b47b3){if(!_0x5b47b3){_0x1a11e9['sendStatus'](0x194);}return _0x5b47b3;};}function handleError(_0x413ab9,_0xd207b7){_0xd207b7=_0xd207b7||0x1f4;return function(_0x3ab664){logger[_0x5b5b('0x21')](_0x3ab664['stack']);if(_0x3ab664[_0x5b5b('0x22')]){delete _0x3ab664[_0x5b5b('0x22')];}_0x413ab9[_0x5b5b('0x1a')](_0xd207b7)[_0x5b5b('0x23')](_0x3ab664);};}exports[_0x5b5b('0x24')]=function(_0x5a7e1e,_0x487c43){var _0x3ff76c={},_0x1573ed={},_0x337482={'count':0x0,'rows':[]};var _0x464940=db['CmHopperFinal'][_0x5b5b('0x25')];_0x1573ed[_0x5b5b('0x26')]=_['keys'](_0x464940);var _0x5278b1={'dateStart':_0x5a7e1e[_0x5b5b('0x27')][_0x5b5b('0x28')],'dateEnd':_0x5a7e1e[_0x5b5b('0x27')][_0x5b5b('0x29')]};delete _0x5a7e1e['query'][_0x5b5b('0x28')];delete _0x5a7e1e['query'][_0x5b5b('0x29')];_0x1573ed[_0x5b5b('0x27')]=_[_0x5b5b('0x2a')](_0x5a7e1e[_0x5b5b('0x27')]);_0x1573ed[_0x5b5b('0x2b')]=_[_0x5b5b('0x2c')](_0x1573ed[_0x5b5b('0x26')],_0x1573ed[_0x5b5b('0x27')]);_0x3ff76c[_0x5b5b('0x2d')]=_[_0x5b5b('0x2c')](_0x1573ed[_0x5b5b('0x26')],qs['fields'](_0x5a7e1e['query'][_0x5b5b('0x2e')]));_0x3ff76c[_0x5b5b('0x2d')]=_0x3ff76c[_0x5b5b('0x2d')][_0x5b5b('0x2f')]?_0x3ff76c[_0x5b5b('0x2d')]:_0x1573ed['model'];if(!_0x5a7e1e[_0x5b5b('0x27')][_0x5b5b('0x30')](_0x5b5b('0x31'))){_0x3ff76c[_0x5b5b('0x32')]=qs[_0x5b5b('0x32')](_0x5a7e1e[_0x5b5b('0x27')][_0x5b5b('0x32')]);_0x3ff76c['offset']=qs[_0x5b5b('0x19')](_0x5a7e1e[_0x5b5b('0x27')][_0x5b5b('0x19')]);}_0x3ff76c[_0x5b5b('0x33')]=qs[_0x5b5b('0x34')](_0x5a7e1e[_0x5b5b('0x27')][_0x5b5b('0x34')]);_0x3ff76c['where']=qs[_0x5b5b('0x2b')](_[_0x5b5b('0x35')](_0x5a7e1e['query'],_0x1573ed[_0x5b5b('0x2b')]));if(_0x5278b1[_0x5b5b('0x28')]){if(_0x5278b1[_0x5b5b('0x29')]){_0x5278b1[_0x5b5b('0x29')]=moment(_0x5278b1[_0x5b5b('0x29')])[_0x5b5b('0x36')](0x1,_0x5b5b('0x37'));}else{_0x5278b1[_0x5b5b('0x29')]=moment(_0x5278b1['dateStart'])[_0x5b5b('0x36')](0x1,_0x5b5b('0x37'));}_[_0x5b5b('0x38')](_0x3ff76c[_0x5b5b('0x39')],{'createdAt':{'$gte':_0x5278b1[_0x5b5b('0x28')],'$lte':_0x5278b1['dateEnd']}});}if(_0x5a7e1e[_0x5b5b('0x27')][_0x5b5b('0x3a')]){_0x3ff76c['where']=_[_0x5b5b('0x38')](_0x3ff76c['where'],{'$or':_[_0x5b5b('0x3b')](_0x3ff76c[_0x5b5b('0x2d')],function(_0x4ed9ef){var _0x31022c={};_0x31022c[_0x4ed9ef]={'$like':'%'+_0x5a7e1e[_0x5b5b('0x27')][_0x5b5b('0x3a')]+'%'};return _0x31022c;})});}_0x3ff76c=_[_0x5b5b('0x38')]({},_0x3ff76c,_0x5a7e1e[_0x5b5b('0x3c')]);var _0x7b02a6={'where':_0x3ff76c['where']};return db[_0x5b5b('0x3d')]['count'](_0x7b02a6)['then'](function(_0x1ded50){_0x337482[_0x5b5b('0x18')]=_0x1ded50;if(_0x5a7e1e[_0x5b5b('0x27')][_0x5b5b('0x3e')]){_0x3ff76c[_0x5b5b('0x3f')]=[{'all':!![]}];}return db[_0x5b5b('0x3d')][_0x5b5b('0x40')](_0x3ff76c);})[_0x5b5b('0x41')](function(_0x197249){_0x337482['rows']=_0x197249;return _0x337482;})[_0x5b5b('0x41')](respondWithFilteredResult(_0x487c43,_0x3ff76c))[_0x5b5b('0x42')](handleError(_0x487c43,null));};exports[_0x5b5b('0x43')]=function(_0x356974,_0x11678d){var _0x3a738b={'raw':!![],'where':{'id':_0x356974[_0x5b5b('0x44')]['id']}},_0x4f891c={};_0x4f891c['model']=_[_0x5b5b('0x2a')](db[_0x5b5b('0x3d')][_0x5b5b('0x25')]);_0x4f891c[_0x5b5b('0x27')]=_[_0x5b5b('0x2a')](_0x356974['query']);_0x4f891c[_0x5b5b('0x2b')]=_[_0x5b5b('0x2c')](_0x4f891c['model'],_0x4f891c['query']);_0x3a738b['attributes']=_[_0x5b5b('0x2c')](_0x4f891c[_0x5b5b('0x26')],qs[_0x5b5b('0x2e')](_0x356974[_0x5b5b('0x27')][_0x5b5b('0x2e')]));_0x3a738b['attributes']=_0x3a738b['attributes'][_0x5b5b('0x2f')]?_0x3a738b[_0x5b5b('0x2d')]:_0x4f891c[_0x5b5b('0x26')];if(_0x356974[_0x5b5b('0x27')][_0x5b5b('0x3e')]){_0x3a738b['include']=[{'all':!![]}];}_0x3a738b=_['merge']({},_0x3a738b,_0x356974[_0x5b5b('0x3c')]);return db[_0x5b5b('0x3d')][_0x5b5b('0x45')](_0x3a738b)['then'](handleEntityNotFound(_0x11678d,null))['then'](respondWithResult(_0x11678d,null))['catch'](handleError(_0x11678d,null));};exports[_0x5b5b('0x46')]=function(_0x21b6a9,_0x374e32){return db[_0x5b5b('0x3d')][_0x5b5b('0x46')]()[_0x5b5b('0x41')](respondWithResult(_0x374e32,null))[_0x5b5b('0x42')](handleError(_0x374e32,null));};exports[_0x5b5b('0x1f')]=function(_0x2b8460,_0x316310){if(_0x2b8460[_0x5b5b('0x47')][_0x5b5b('0x48')]){delete _0x2b8460['body'][_0x5b5b('0x48')];}return db[_0x5b5b('0x3d')][_0x5b5b('0x45')]({'where':{'uniqueid':_0x2b8460['params']['id']}})[_0x5b5b('0x41')](handleEntityNotFound(_0x316310,null))[_0x5b5b('0x41')](saveUpdates(_0x2b8460['body'],null))[_0x5b5b('0x41')](respondWithResult(_0x316310,null))[_0x5b5b('0x42')](handleError(_0x316310,null));};exports[_0x5b5b('0x49')]=function(_0x17e48c,_0x508aa3,_0x52acc4){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x17e48c['params']['id']},'attributes':[[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db['sequelize'][_0x5b5b('0x4c')](_0x5b5b('0x4d')))),_0x5b5b('0x4e')],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db[_0x5b5b('0x4a')][_0x5b5b('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db['sequelize']['fn']('IF',db[_0x5b5b('0x4a')][_0x5b5b('0x4c')](_0x5b5b('0x4f')))),'busyContacts'],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db[_0x5b5b('0x4a')][_0x5b5b('0x4c')](_0x5b5b('0x50')))),_0x5b5b('0x51')],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db[_0x5b5b('0x4a')][_0x5b5b('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5b5b('0x52')],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db['sequelize'][_0x5b5b('0x4c')](_0x5b5b('0x53')))),_0x5b5b('0x54')],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db['sequelize'][_0x5b5b('0x4c')](_0x5b5b('0x55')))),_0x5b5b('0x56')]]})[_0x5b5b('0x41')](handleEntityNotFound(_0x508aa3,null))['then'](respondWithResult(_0x508aa3,null))[_0x5b5b('0x42')](handleError(_0x508aa3,null));};exports[_0x5b5b('0x57')]=function(_0x451992,_0x10242b,_0x4e2266){return db[_0x5b5b('0x3d')]['findAll']({'raw':![],'where':{'CampaignId':_0x451992[_0x5b5b('0x44')]['id']},'attributes':[[db['sequelize']['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db[_0x5b5b('0x4a')]['literal'](_0x5b5b('0x4d')))),_0x5b5b('0x4e')],[db['sequelize']['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db[_0x5b5b('0x4a')][_0x5b5b('0x4c')](_0x5b5b('0x58')))),_0x5b5b('0x59')],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db['sequelize']['fn']('IF',db[_0x5b5b('0x4a')][_0x5b5b('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0x5b5b('0x5a')],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db['sequelize'][_0x5b5b('0x4c')](_0x5b5b('0x50')))),_0x5b5b('0x51')],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db[_0x5b5b('0x4a')][_0x5b5b('0x4c')](_0x5b5b('0x5b')))),_0x5b5b('0x52')],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db['sequelize']['fn']('IF',db[_0x5b5b('0x4a')][_0x5b5b('0x4c')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5b5b('0x54')],[db[_0x5b5b('0x4a')]['fn'](_0x5b5b('0x4b'),db[_0x5b5b('0x4a')]['fn']('IF',db[_0x5b5b('0x4a')]['literal'](_0x5b5b('0x55')))),'reCallContacts']]})['then'](handleEntityNotFound(_0x10242b,null))[_0x5b5b('0x41')](respondWithResult(_0x10242b,null))[_0x5b5b('0x42')](handleError(_0x10242b,null));};exports[_0x5b5b('0x5c')]=function(_0x5a1010,_0x1b28a6,_0x3cbd75){return db['VoiceQueue']['find']({'where':{'id':_0x5a1010['params']['id']}})[_0x5b5b('0x41')](handleEntityNotFound(_0x1b28a6,null))[_0x5b5b('0x41')](function(_0x1e2a00){var _0x18d298;if(_0x1e2a00){_0x18d298=squel[_0x5b5b('0x5d')]()[_0x5b5b('0x5e')](_0x5b5b('0x5f'))['fromQuery']([_0x5b5b('0x60'),_0x5b5b('0x61'),'ContactId',_0x5b5b('0x62'),_0x5b5b('0x63'),'createdAt',_0x5b5b('0x64')],squel['select']()['field'](_0x5b5b('0x65'),_0x5b5b('0x60'))[_0x5b5b('0x66')]('NOW()','scheduledAt')[_0x5b5b('0x66')](_0x5b5b('0x67'),'ContactId')[_0x5b5b('0x66')](_0x5b5b('0x68'),_0x5b5b('0x62'))[_0x5b5b('0x66')](_0x5b5b('0x69'),_0x5b5b('0x63'))['field']('NOW()',_0x5b5b('0x6a'))['field'](_0x5b5b('0x6b'),_0x5b5b('0x64'))[_0x5b5b('0x6c')](_0x5b5b('0x6d'))[_0x5b5b('0x39')](_0x5b5b('0x6e'),_0x5a1010[_0x5b5b('0x44')]['id'][_0x5b5b('0x6f')]())[_0x5b5b('0x39')]('state\x20=\x20?',_0x5a1010['body']['state'][_0x5b5b('0x6f')]())[_0x5b5b('0x39')](_0x5b5b('0x70'))['where'](_0x5b5b('0x71'),squel[_0x5b5b('0x72')]()[_0x5b5b('0x66')](_0x5b5b('0x60'))[_0x5b5b('0x6c')](_0x5b5b('0x5f'))['where'](_0x5b5b('0x6e'),_0x5a1010[_0x5b5b('0x44')]['id'][_0x5b5b('0x6f')]()))[_0x5b5b('0x39')](_0x5b5b('0x71'),squel[_0x5b5b('0x72')]()['field']('calleridnum')[_0x5b5b('0x6c')](_0x5b5b('0x6d'))[_0x5b5b('0x39')]('VoiceQueueId\x20=\x20?',_0x5a1010[_0x5b5b('0x44')]['id'][_0x5b5b('0x6f')]())[_0x5b5b('0x39')](_0x5b5b('0x73')))[_0x5b5b('0x74')](_0x5b5b('0x75')))['toString']();return db[_0x5b5b('0x4a')][_0x5b5b('0x27')](_0x18d298);}return[];})[_0x5b5b('0x41')](respondWithResult(_0x1b28a6,null))[_0x5b5b('0x42')](handleError(_0x1b28a6,null));};exports[_0x5b5b('0x76')]=function(_0xec4ea5,_0x106f9b,_0x122261){return db[_0x5b5b('0x77')][_0x5b5b('0x45')]({'where':{'id':_0xec4ea5[_0x5b5b('0x44')]['id']}})[_0x5b5b('0x41')](handleEntityNotFound(_0x106f9b,null))[_0x5b5b('0x41')](function(_0x577b7e){var _0x51f5b8;if(_0x577b7e){_0x51f5b8=squel[_0x5b5b('0x5d')]()[_0x5b5b('0x5e')](_0x5b5b('0x5f'))[_0x5b5b('0x78')](['phone',_0x5b5b('0x61'),_0x5b5b('0x75'),_0x5b5b('0x62'),'CampaignId',_0x5b5b('0x6a'),_0x5b5b('0x64')],squel[_0x5b5b('0x72')]()[_0x5b5b('0x66')](_0x5b5b('0x65'),_0x5b5b('0x60'))[_0x5b5b('0x66')](_0x5b5b('0x6b'),_0x5b5b('0x61'))[_0x5b5b('0x66')]('ANY_VALUE(ContactId)',_0x5b5b('0x75'))[_0x5b5b('0x66')](_0x5b5b('0x68'),_0x5b5b('0x62'))[_0x5b5b('0x66')]('ANY_VALUE(CampaignId)',_0x5b5b('0x79'))[_0x5b5b('0x66')]('NOW()',_0x5b5b('0x6a'))[_0x5b5b('0x66')](_0x5b5b('0x6b'),_0x5b5b('0x64'))[_0x5b5b('0x6c')](_0x5b5b('0x6d'))['where']('CampaignId\x20=\x20?',_0xec4ea5['params']['id']['toString']())[_0x5b5b('0x39')](_0x5b5b('0x7a'),_0xec4ea5[_0x5b5b('0x47')][_0x5b5b('0x7b')][_0x5b5b('0x6f')]())['where'](_0x5b5b('0x70'))[_0x5b5b('0x39')](_0x5b5b('0x71'),squel[_0x5b5b('0x72')]()[_0x5b5b('0x66')]('phone')['from']('cm_hopper')[_0x5b5b('0x39')](_0x5b5b('0x7c'),_0xec4ea5['params']['id'][_0x5b5b('0x6f')]()))[_0x5b5b('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5b5b('0x72')]()['field'](_0x5b5b('0x7d'))[_0x5b5b('0x6c')]('cm_hopper_final')[_0x5b5b('0x39')](_0x5b5b('0x7c'),_0xec4ea5[_0x5b5b('0x44')]['id'][_0x5b5b('0x6f')]())[_0x5b5b('0x39')](_0x5b5b('0x73')))['group'](_0x5b5b('0x75')))[_0x5b5b('0x6f')]();return db[_0x5b5b('0x4a')][_0x5b5b('0x27')](_0x51f5b8);}return[];})['then'](respondWithResult(_0x106f9b,null))[_0x5b5b('0x42')](handleError(_0x106f9b,null));};exports['checkContactHopper']=function(_0x3e4ef3,_0x341b02,_0x1f3731){return db[_0x5b5b('0x7e')][_0x5b5b('0x7f')]({'where':{'VoiceQueueId':_0x3e4ef3[_0x5b5b('0x47')]['VoiceQueueId'],'CampaignId':_0x3e4ef3[_0x5b5b('0x47')][_0x5b5b('0x79')],'ContactId':_0x3e4ef3[_0x5b5b('0x47')][_0x5b5b('0x75')]}})[_0x5b5b('0x41')](handleEntityNotFound(_0x341b02,null))[_0x5b5b('0x41')](function(_0x3e6051){if(_0x3e6051){return _0x3e6051;}return null;})[_0x5b5b('0x41')](respondWithResult(_0x341b02,null))['catch'](handleError(_0x341b02,null));}; \ No newline at end of file +var _0x1cba=['abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','group','checkContactHopper','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','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','CmHopperFinal','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','day','add','merge','where','map','filter','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','describe','uniqueid','body','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts'];(function(_0x5c730c,_0x19ce1e){var _0x1add3c=function(_0x5cdf46){while(--_0x5cdf46){_0x5c730c['push'](_0x5c730c['shift']());}};_0x1add3c(++_0x19ce1e);}(_0x1cba,0x1a2));var _0xa1cb=function(_0x37cca8,_0x14827c){_0x37cca8=_0x37cca8-0x0;var _0x594b79=_0x1cba[_0x37cca8];return _0x594b79;};'use strict';var pdf=require(_0xa1cb('0x0'));var emlformat=require(_0xa1cb('0x1'));var rimraf=require(_0xa1cb('0x2'));var zipdir=require(_0xa1cb('0x3'));var jsonpatch=require(_0xa1cb('0x4'));var rp=require(_0xa1cb('0x5'));var moment=require(_0xa1cb('0x6'));var BPromise=require(_0xa1cb('0x7'));var Mustache=require(_0xa1cb('0x8'));var util=require(_0xa1cb('0x9'));var path=require(_0xa1cb('0xa'));var sox=require('sox');var csv=require(_0xa1cb('0xb'));var ejs=require(_0xa1cb('0xc'));var fs=require('fs');var _=require(_0xa1cb('0xd'));var squel=require(_0xa1cb('0xe'));var crypto=require(_0xa1cb('0xf'));var jsforce=require(_0xa1cb('0x10'));var deskjs=require(_0xa1cb('0x11'));var toCsv=require(_0xa1cb('0xb'));var querystring=require('querystring');var Papa=require(_0xa1cb('0x12'));var Redis=require(_0xa1cb('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xa1cb('0x14'))(_0xa1cb('0x15'));var utils=require(_0xa1cb('0x16'));var config=require(_0xa1cb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb1dc3c,_0x2d602b){_0x2d602b=_0x2d602b||0xcc;return function(_0x4ea09c){if(_0x4ea09c){return _0xb1dc3c[_0xa1cb('0x18')](_0x2d602b);}return _0xb1dc3c[_0xa1cb('0x19')](_0x2d602b)[_0xa1cb('0x1a')]();};}function respondWithResult(_0x38b72d,_0x2480f9){_0x2480f9=_0x2480f9||0xc8;return function(_0x2dcc5a){if(_0x2dcc5a){return _0x38b72d[_0xa1cb('0x19')](_0x2480f9)[_0xa1cb('0x1b')](_0x2dcc5a);}};}function respondWithFilteredResult(_0x444e30,_0x1cd2fe){return function(_0x31da20){if(_0x31da20){var _0x2cd763=_0x31da20[_0xa1cb('0x1c')],_0x332351=_0x1cd2fe[_0xa1cb('0x1d')],_0x2ca93f=_0x1cd2fe['offset']+_0x1cd2fe[_0xa1cb('0x1e')],_0x4be4c4;if(_0x2ca93f>=_0x2cd763){_0x2ca93f=_0x2cd763;_0x4be4c4=0xc8;}else{_0x4be4c4=0xce;}_0x444e30[_0xa1cb('0x19')](_0x4be4c4);return _0x444e30['set'](_0xa1cb('0x1f'),_0x332351+'-'+_0x2ca93f+'/'+_0x2cd763)[_0xa1cb('0x1b')](_0x31da20);}return null;};}function patchUpdates(_0x400d20){return function(_0x3bb5eb){try{jsonpatch[_0xa1cb('0x20')](_0x3bb5eb,_0x400d20,!![]);}catch(_0x24c47a){return BPromise[_0xa1cb('0x21')](_0x24c47a);}return _0x3bb5eb['save']();};}function saveUpdates(_0x393f3e,_0x58c392){return function(_0x4d3f22){if(_0x4d3f22){return _0x4d3f22[_0xa1cb('0x22')](_0x393f3e)['then'](function(_0x38918c){return _0x38918c;});}return null;};}function removeEntity(_0x468da7,_0x595415){return function(_0x124de8){if(_0x124de8){return _0x124de8[_0xa1cb('0x23')]()[_0xa1cb('0x24')](function(){_0x468da7[_0xa1cb('0x19')](0xcc)[_0xa1cb('0x1a')]();});}};}function handleEntityNotFound(_0xea5f5f,_0x17a5cb){return function(_0x12627f){if(!_0x12627f){_0xea5f5f[_0xa1cb('0x18')](0x194);}return _0x12627f;};}function handleError(_0x409796,_0x4c909e){_0x4c909e=_0x4c909e||0x1f4;return function(_0x590cd){logger[_0xa1cb('0x25')](_0x590cd[_0xa1cb('0x26')]);if(_0x590cd[_0xa1cb('0x27')]){delete _0x590cd[_0xa1cb('0x27')];}_0x409796[_0xa1cb('0x19')](_0x4c909e)[_0xa1cb('0x28')](_0x590cd);};}exports[_0xa1cb('0x29')]=function(_0x57582c,_0x30ee88){var _0x12dd90={},_0x4d5a51={},_0x576a9e={'count':0x0,'rows':[]};var _0x4f4c12=db[_0xa1cb('0x2a')]['rawAttributes'];_0x4d5a51[_0xa1cb('0x2b')]=_[_0xa1cb('0x2c')](_0x4f4c12);var _0x308dad={'dateStart':_0x57582c['query'][_0xa1cb('0x2d')],'dateEnd':_0x57582c[_0xa1cb('0x2e')][_0xa1cb('0x2f')]};delete _0x57582c[_0xa1cb('0x2e')]['dateStart'];delete _0x57582c[_0xa1cb('0x2e')][_0xa1cb('0x2f')];_0x4d5a51['query']=_[_0xa1cb('0x2c')](_0x57582c[_0xa1cb('0x2e')]);_0x4d5a51[_0xa1cb('0x30')]=_[_0xa1cb('0x31')](_0x4d5a51[_0xa1cb('0x2b')],_0x4d5a51[_0xa1cb('0x2e')]);_0x12dd90[_0xa1cb('0x32')]=_[_0xa1cb('0x31')](_0x4d5a51[_0xa1cb('0x2b')],qs[_0xa1cb('0x33')](_0x57582c[_0xa1cb('0x2e')]['fields']));_0x12dd90[_0xa1cb('0x32')]=_0x12dd90[_0xa1cb('0x32')][_0xa1cb('0x34')]?_0x12dd90['attributes']:_0x4d5a51[_0xa1cb('0x2b')];if(!_0x57582c[_0xa1cb('0x2e')][_0xa1cb('0x35')](_0xa1cb('0x36'))){_0x12dd90['limit']=qs[_0xa1cb('0x1e')](_0x57582c['query'][_0xa1cb('0x1e')]);_0x12dd90[_0xa1cb('0x1d')]=qs[_0xa1cb('0x1d')](_0x57582c['query']['offset']);}_0x12dd90[_0xa1cb('0x37')]=qs[_0xa1cb('0x38')](_0x57582c[_0xa1cb('0x2e')]['sort']);_0x12dd90['where']=qs['filters'](_['pick'](_0x57582c[_0xa1cb('0x2e')],_0x4d5a51['filters']));if(_0x308dad[_0xa1cb('0x2d')]){if(_0x308dad[_0xa1cb('0x2f')]){_0x308dad[_0xa1cb('0x2f')]=moment(_0x308dad[_0xa1cb('0x2f')])['add'](0x1,_0xa1cb('0x39'));}else{_0x308dad[_0xa1cb('0x2f')]=moment(_0x308dad[_0xa1cb('0x2d')])[_0xa1cb('0x3a')](0x1,_0xa1cb('0x39'));}_[_0xa1cb('0x3b')](_0x12dd90[_0xa1cb('0x3c')],{'createdAt':{'$gte':_0x308dad[_0xa1cb('0x2d')],'$lte':_0x308dad[_0xa1cb('0x2f')]}});}if(_0x57582c[_0xa1cb('0x2e')]['filter']){_0x12dd90[_0xa1cb('0x3c')]=_[_0xa1cb('0x3b')](_0x12dd90['where'],{'$or':_[_0xa1cb('0x3d')](_0x12dd90[_0xa1cb('0x32')],function(_0x3dff4d){var _0x518701={};_0x518701[_0x3dff4d]={'$like':'%'+_0x57582c[_0xa1cb('0x2e')][_0xa1cb('0x3e')]+'%'};return _0x518701;})});}_0x12dd90=_[_0xa1cb('0x3b')]({},_0x12dd90,_0x57582c['options']);var _0x51bc7e={'where':_0x12dd90[_0xa1cb('0x3c')]};return db[_0xa1cb('0x2a')][_0xa1cb('0x1c')](_0x51bc7e)['then'](function(_0x4583dc){_0x576a9e['count']=_0x4583dc;if(_0x57582c[_0xa1cb('0x2e')][_0xa1cb('0x3f')]){_0x12dd90[_0xa1cb('0x40')]=[{'all':!![]}];}return db[_0xa1cb('0x2a')][_0xa1cb('0x41')](_0x12dd90);})[_0xa1cb('0x24')](function(_0x454394){_0x576a9e['rows']=_0x454394;return _0x576a9e;})[_0xa1cb('0x24')](respondWithFilteredResult(_0x30ee88,_0x12dd90))[_0xa1cb('0x42')](handleError(_0x30ee88,null));};exports[_0xa1cb('0x43')]=function(_0x2c5fbe,_0x26dc42){var _0x51ab71={'raw':!![],'where':{'id':_0x2c5fbe[_0xa1cb('0x44')]['id']}},_0x42bab1={};_0x42bab1[_0xa1cb('0x2b')]=_['keys'](db[_0xa1cb('0x2a')][_0xa1cb('0x45')]);_0x42bab1[_0xa1cb('0x2e')]=_['keys'](_0x2c5fbe[_0xa1cb('0x2e')]);_0x42bab1[_0xa1cb('0x30')]=_[_0xa1cb('0x31')](_0x42bab1[_0xa1cb('0x2b')],_0x42bab1[_0xa1cb('0x2e')]);_0x51ab71[_0xa1cb('0x32')]=_[_0xa1cb('0x31')](_0x42bab1['model'],qs[_0xa1cb('0x33')](_0x2c5fbe[_0xa1cb('0x2e')][_0xa1cb('0x33')]));_0x51ab71[_0xa1cb('0x32')]=_0x51ab71[_0xa1cb('0x32')][_0xa1cb('0x34')]?_0x51ab71['attributes']:_0x42bab1[_0xa1cb('0x2b')];if(_0x2c5fbe['query']['includeAll']){_0x51ab71['include']=[{'all':!![]}];}_0x51ab71=_[_0xa1cb('0x3b')]({},_0x51ab71,_0x2c5fbe[_0xa1cb('0x46')]);return db[_0xa1cb('0x2a')][_0xa1cb('0x47')](_0x51ab71)[_0xa1cb('0x24')](handleEntityNotFound(_0x26dc42,null))[_0xa1cb('0x24')](respondWithResult(_0x26dc42,null))['catch'](handleError(_0x26dc42,null));};exports[_0xa1cb('0x48')]=function(_0x5d375e,_0x3d0d5f){return db['CmHopperFinal']['describe']()[_0xa1cb('0x24')](respondWithResult(_0x3d0d5f,null))[_0xa1cb('0x42')](handleError(_0x3d0d5f,null));};exports['update']=function(_0x396c97,_0x1ec923){if(_0x396c97['body'][_0xa1cb('0x49')]){delete _0x396c97[_0xa1cb('0x4a')][_0xa1cb('0x49')];}return db[_0xa1cb('0x2a')]['find']({'where':{'uniqueid':_0x396c97['params']['id']}})[_0xa1cb('0x24')](handleEntityNotFound(_0x1ec923,null))[_0xa1cb('0x24')](saveUpdates(_0x396c97['body'],null))[_0xa1cb('0x24')](respondWithResult(_0x1ec923,null))[_0xa1cb('0x42')](handleError(_0x1ec923,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x27ff6e,_0x3e46bc,_0x1c16f5){return db['CmHopperFinal'][_0xa1cb('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x27ff6e[_0xa1cb('0x44')]['id']},'attributes':[[db[_0xa1cb('0x4b')]['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db[_0xa1cb('0x4b')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xa1cb('0x4d')],[db[_0xa1cb('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa1cb('0x4b')][_0xa1cb('0x4e')](_0xa1cb('0x4f')))),_0xa1cb('0x50')],[db[_0xa1cb('0x4b')]['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xa1cb('0x51')))),_0xa1cb('0x52')],[db[_0xa1cb('0x4b')]['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db['sequelize'][_0xa1cb('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0xa1cb('0x53')],[db['sequelize']['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db[_0xa1cb('0x4b')][_0xa1cb('0x4e')](_0xa1cb('0x54')))),'dropContacts'],[db[_0xa1cb('0x4b')]['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db[_0xa1cb('0x4b')][_0xa1cb('0x4e')](_0xa1cb('0x55')))),'abandonedContacts'],[db['sequelize']['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db['sequelize'][_0xa1cb('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0xa1cb('0x56')]]})['then'](handleEntityNotFound(_0x3e46bc,null))[_0xa1cb('0x24')](respondWithResult(_0x3e46bc,null))['catch'](handleError(_0x3e46bc,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4c48d9,_0x106243,_0xa82ee){return db[_0xa1cb('0x2a')][_0xa1cb('0x41')]({'raw':![],'where':{'CampaignId':_0x4c48d9['params']['id']},'attributes':[[db[_0xa1cb('0x4b')]['fn'](_0xa1cb('0x4c'),db['sequelize']['fn']('IF',db[_0xa1cb('0x4b')][_0xa1cb('0x4e')](_0xa1cb('0x57')))),'noSuchContacts'],[db[_0xa1cb('0x4b')]['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db[_0xa1cb('0x4b')][_0xa1cb('0x4e')](_0xa1cb('0x4f')))),_0xa1cb('0x50')],[db[_0xa1cb('0x4b')]['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db['sequelize'][_0xa1cb('0x4e')](_0xa1cb('0x51')))),_0xa1cb('0x52')],[db[_0xa1cb('0x4b')]['fn'](_0xa1cb('0x4c'),db['sequelize']['fn']('IF',db[_0xa1cb('0x4b')][_0xa1cb('0x4e')](_0xa1cb('0x58')))),_0xa1cb('0x53')],[db[_0xa1cb('0x4b')]['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db[_0xa1cb('0x4b')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa1cb('0x59')],[db['sequelize']['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xa1cb('0x55')))),_0xa1cb('0x5a')],[db[_0xa1cb('0x4b')]['fn'](_0xa1cb('0x4c'),db[_0xa1cb('0x4b')]['fn']('IF',db[_0xa1cb('0x4b')]['literal'](_0xa1cb('0x5b')))),_0xa1cb('0x56')]]})[_0xa1cb('0x24')](handleEntityNotFound(_0x106243,null))[_0xa1cb('0x24')](respondWithResult(_0x106243,null))[_0xa1cb('0x42')](handleError(_0x106243,null));};exports[_0xa1cb('0x5c')]=function(_0xec048,_0x3b6756,_0x164c4c){return db[_0xa1cb('0x5d')][_0xa1cb('0x47')]({'where':{'id':_0xec048[_0xa1cb('0x44')]['id']}})[_0xa1cb('0x24')](handleEntityNotFound(_0x3b6756,null))[_0xa1cb('0x24')](function(_0x137d5d){var _0x12f8c2;if(_0x137d5d){_0x12f8c2=squel[_0xa1cb('0x5e')]()[_0xa1cb('0x5f')](_0xa1cb('0x60'))['fromQuery'](['phone',_0xa1cb('0x61'),_0xa1cb('0x62'),_0xa1cb('0x63'),'VoiceQueueId',_0xa1cb('0x64'),_0xa1cb('0x65')],squel[_0xa1cb('0x66')]()[_0xa1cb('0x67')](_0xa1cb('0x68'),_0xa1cb('0x69'))[_0xa1cb('0x67')](_0xa1cb('0x6a'),_0xa1cb('0x61'))['field'](_0xa1cb('0x6b'),_0xa1cb('0x62'))[_0xa1cb('0x67')]('ANY_VALUE(ListId)',_0xa1cb('0x63'))[_0xa1cb('0x67')](_0xa1cb('0x6c'),_0xa1cb('0x6d'))[_0xa1cb('0x67')](_0xa1cb('0x6a'),_0xa1cb('0x64'))[_0xa1cb('0x67')]('NOW()',_0xa1cb('0x65'))[_0xa1cb('0x6e')]('cm_hopper_final')[_0xa1cb('0x3c')](_0xa1cb('0x6f'),_0xec048[_0xa1cb('0x44')]['id']['toString']())[_0xa1cb('0x3c')]('state\x20=\x20?',_0xec048[_0xa1cb('0x4a')]['state'][_0xa1cb('0x70')]())['where'](_0xa1cb('0x71'))[_0xa1cb('0x3c')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa1cb('0x69'))[_0xa1cb('0x6e')]('cm_hopper')[_0xa1cb('0x3c')]('VoiceQueueId\x20=\x20?',_0xec048[_0xa1cb('0x44')]['id'][_0xa1cb('0x70')]()))[_0xa1cb('0x3c')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa1cb('0x66')]()[_0xa1cb('0x67')](_0xa1cb('0x72'))[_0xa1cb('0x6e')](_0xa1cb('0x73'))['where'](_0xa1cb('0x6f'),_0xec048[_0xa1cb('0x44')]['id'][_0xa1cb('0x70')]())[_0xa1cb('0x3c')](_0xa1cb('0x74')))['group'](_0xa1cb('0x62')))[_0xa1cb('0x70')]();return db[_0xa1cb('0x4b')][_0xa1cb('0x2e')](_0x12f8c2);}return[];})[_0xa1cb('0x24')](respondWithResult(_0x3b6756,null))[_0xa1cb('0x42')](handleError(_0x3b6756,null));};exports[_0xa1cb('0x75')]=function(_0xf895ac,_0x407e4c,_0x2b073a){return db[_0xa1cb('0x76')][_0xa1cb('0x47')]({'where':{'id':_0xf895ac['params']['id']}})[_0xa1cb('0x24')](handleEntityNotFound(_0x407e4c,null))[_0xa1cb('0x24')](function(_0x12dff1){var _0x4c2407;if(_0x12dff1){_0x4c2407=squel[_0xa1cb('0x5e')]()[_0xa1cb('0x5f')](_0xa1cb('0x60'))[_0xa1cb('0x77')](['phone',_0xa1cb('0x61'),_0xa1cb('0x62'),_0xa1cb('0x63'),_0xa1cb('0x78'),'createdAt',_0xa1cb('0x65')],squel[_0xa1cb('0x66')]()['field'](_0xa1cb('0x68'),'phone')[_0xa1cb('0x67')]('NOW()',_0xa1cb('0x61'))['field'](_0xa1cb('0x6b'),_0xa1cb('0x62'))['field']('ANY_VALUE(ListId)','ListId')['field']('ANY_VALUE(CampaignId)',_0xa1cb('0x78'))[_0xa1cb('0x67')](_0xa1cb('0x6a'),_0xa1cb('0x64'))[_0xa1cb('0x67')](_0xa1cb('0x6a'),_0xa1cb('0x65'))[_0xa1cb('0x6e')](_0xa1cb('0x73'))[_0xa1cb('0x3c')](_0xa1cb('0x79'),_0xf895ac['params']['id'][_0xa1cb('0x70')]())[_0xa1cb('0x3c')](_0xa1cb('0x7a'),_0xf895ac['body'][_0xa1cb('0x7b')][_0xa1cb('0x70')]())[_0xa1cb('0x3c')](_0xa1cb('0x71'))[_0xa1cb('0x3c')](_0xa1cb('0x7c'),squel[_0xa1cb('0x66')]()[_0xa1cb('0x67')](_0xa1cb('0x69'))[_0xa1cb('0x6e')](_0xa1cb('0x60'))[_0xa1cb('0x3c')]('CampaignId\x20=\x20?',_0xf895ac[_0xa1cb('0x44')]['id'][_0xa1cb('0x70')]()))[_0xa1cb('0x3c')](_0xa1cb('0x7c'),squel['select']()[_0xa1cb('0x67')](_0xa1cb('0x72'))['from'](_0xa1cb('0x73'))[_0xa1cb('0x3c')](_0xa1cb('0x79'),_0xf895ac[_0xa1cb('0x44')]['id']['toString']())[_0xa1cb('0x3c')](_0xa1cb('0x74')))[_0xa1cb('0x7d')](_0xa1cb('0x62')))['toString']();return db[_0xa1cb('0x4b')][_0xa1cb('0x2e')](_0x4c2407);}return[];})[_0xa1cb('0x24')](respondWithResult(_0x407e4c,null))['catch'](handleError(_0x407e4c,null));};exports[_0xa1cb('0x7e')]=function(_0x772607,_0x1c912e,_0x4bb72a){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x772607[_0xa1cb('0x4a')][_0xa1cb('0x6d')],'CampaignId':_0x772607[_0xa1cb('0x4a')][_0xa1cb('0x78')],'ContactId':_0x772607['body'][_0xa1cb('0x62')]}})[_0xa1cb('0x24')](handleEntityNotFound(_0x1c912e,null))['then'](function(_0x4dd766){if(_0x4dd766){return _0x4dd766;}return null;})[_0xa1cb('0x24')](respondWithResult(_0x1c912e,null))[_0xa1cb('0x42')](handleError(_0x1c912e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 1aea9f8..3ceac8b 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 _0x4975=['calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','./cmHopperFinal.attributes','exports','define','cm_hopper_final'];(function(_0x2805ae,_0x5c7841){var _0x2a8d73=function(_0x551a40){while(--_0x551a40){_0x2805ae['push'](_0x2805ae['shift']());}};_0x2a8d73(++_0x5c7841);}(_0x4975,0x86));var _0x5497=function(_0x213b44,_0x57443f){_0x213b44=_0x213b44-0x0;var _0x7e4f2a=_0x4975[_0x213b44];return _0x7e4f2a;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var attributes=require(_0x5497('0x6'));module[_0x5497('0x7')]=function(_0xeb31af,_0xbb1888){return _0xeb31af[_0x5497('0x8')]('CmHopperFinal',attributes,{'tableName':_0x5497('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x5497('0xa')]},{'name':_0x5497('0xb'),'fields':[_0x5497('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['util','../../config/logger','api','moment','bluebird','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash'];(function(_0xd68d5b,_0x49ba24){var _0x3fa4b8=function(_0x283c3f){while(--_0x283c3f){_0xd68d5b['push'](_0xd68d5b['shift']());}};_0x3fa4b8(++_0x49ba24);}(_0x2ef3,0xba));var _0x32ef=function(_0x579feb,_0x18c2dc){_0x579feb=_0x579feb-0x0;var _0x218685=_0x2ef3[_0x579feb];return _0x218685;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var attributes=require(_0x32ef('0x6'));module[_0x32ef('0x7')]=function(_0x524ab6,_0x402857){return _0x524ab6[_0x32ef('0x8')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x32ef('0x9'),'fields':[_0x32ef('0x9')]},{'name':_0x32ef('0xa'),'fields':[_0x32ef('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index db4bc15..29d3593 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 _0xec56=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3999ab,_0x2012d0){var _0x282363=function(_0x1d50ed){while(--_0x1d50ed){_0x3999ab['push'](_0x3999ab['shift']());}};_0x282363(++_0x2012d0);}(_0xec56,0x1bd));var _0x6ec5=function(_0x6b952f,_0x446abc){_0x6b952f=_0x6b952f-0x0;var _0x599b66=_0xec56[_0x6b952f];return _0x599b66;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ec5('0x1'));var rs=require(_0x6ec5('0x2'));var fs=require('fs');var Redis=require(_0x6ec5('0x3'));var db=require(_0x6ec5('0x4'))['db'];var utils=require(_0x6ec5('0x5'));var logger=require(_0x6ec5('0x6'))(_0x6ec5('0x7'));var config=require(_0x6ec5('0x8'));var jayson=require(_0x6ec5('0x9'));var client=jayson[_0x6ec5('0xa')][_0x6ec5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb683,_0x35be4e,_0x1f59cd){return new BPromise(function(_0x3dd891,_0x225d2f){return client[_0x6ec5('0xc')](_0x3bb683,_0x1f59cd)[_0x6ec5('0xd')](function(_0x3ff17c){logger['info'](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));logger[_0x6ec5('0x10')](_0x6ec5('0x11'),_0x35be4e,_0x6ec5('0xf'),JSON[_0x6ec5('0x12')](_0x3ff17c));if(_0x3ff17c[_0x6ec5('0x13')]){if(_0x3ff17c['error'][_0x6ec5('0x14')]===0x1f4){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);return _0x225d2f(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}logger[_0x6ec5('0x13')]('CmHopperFinal,\x20%s,\x20%s',_0x35be4e,_0x3ff17c[_0x6ec5('0x13')]['message']);return _0x3dd891(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}else{logger[_0x6ec5('0x16')](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));_0x3dd891(_0x3ff17c['result'][_0x6ec5('0x15')]);}})[_0x6ec5('0x17')](function(_0x125ae6){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x125ae6);_0x225d2f(_0x125ae6);});});}exports[_0x6ec5('0x18')]=function(_0x1dbee9){var _0x4237bc=this;return new Promise(function(_0x2608c0,_0x3d5d45){return db[_0x6ec5('0x19')][_0x6ec5('0x1a')](_0x1dbee9[_0x6ec5('0x1b')],{'raw':_0x1dbee9[_0x6ec5('0x1c')]?_0x1dbee9[_0x6ec5('0x1c')][_0x6ec5('0x1d')]===undefined?!![]:![]:!![]})[_0x6ec5('0xd')](function(_0x4abd5d){logger[_0x6ec5('0x16')](_0x6ec5('0x18'),_0x1dbee9);logger[_0x6ec5('0x10')](_0x6ec5('0x18'),_0x1dbee9,JSON[_0x6ec5('0x12')](_0x4abd5d));_0x2608c0(_0x4abd5d);})[_0x6ec5('0x17')](function(_0x18243f){logger['error'](_0x6ec5('0x18'),_0x18243f[_0x6ec5('0x15')],_0x1dbee9);_0x3d5d45(_0x4237bc[_0x6ec5('0x13')](0x1f4,_0x18243f[_0x6ec5('0x15')]));});});}; \ No newline at end of file +var _0xcea2=['../../config/logger','rpc','../../config/environment','client','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CmHopperFinal','create','options','raw','then','CreateCmHopperFinal','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcea2,0x15a));var _0x2cea=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xcea2[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var moment=require(_0x2cea('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cea('0x2'));var fs=require('fs');var Redis=require(_0x2cea('0x3'));var db=require(_0x2cea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cea('0x5'))(_0x2cea('0x6'));var config=require(_0x2cea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d69ff,_0xc04963,_0x805a1b){return new BPromise(function(_0x160cca,_0x11c5c0){return client[_0x2cea('0x9')](_0x2d69ff,_0x805a1b)['then'](function(_0x1f4d90){logger[_0x2cea('0xa')](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));logger[_0x2cea('0xd')](_0x2cea('0xe'),_0xc04963,_0x2cea('0xc'),JSON[_0x2cea('0xf')](_0x1f4d90));if(_0x1f4d90['error']){if(_0x1f4d90['error'][_0x2cea('0x10')]===0x1f4){logger[_0x2cea('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0xc04963,_0x1f4d90['error'][_0x2cea('0x12')]);return _0x11c5c0(_0x1f4d90['error'][_0x2cea('0x12')]);}logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1f4d90['error']['message']);return _0x160cca(_0x1f4d90['error'][_0x2cea('0x12')]);}else{logger['info'](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));_0x160cca(_0x1f4d90[_0x2cea('0x13')][_0x2cea('0x12')]);}})[_0x2cea('0x14')](function(_0x1bbfdb){logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1bbfdb);_0x11c5c0(_0x1bbfdb);});});}exports['CreateCmHopperFinal']=function(_0x19927a){var _0x464f7d=this;return new Promise(function(_0x20c46c,_0x43ae15){return db[_0x2cea('0x15')][_0x2cea('0x16')](_0x19927a['body'],{'raw':_0x19927a[_0x2cea('0x17')]?_0x19927a['options'][_0x2cea('0x18')]===undefined?!![]:![]:!![]})[_0x2cea('0x19')](function(_0xa73bea){logger['info'](_0x2cea('0x1a'),_0x19927a);logger[_0x2cea('0xd')](_0x2cea('0x1a'),_0x19927a,JSON[_0x2cea('0xf')](_0xa73bea));_0x20c46c(_0xa73bea);})[_0x2cea('0x14')](function(_0x3f6f0e){logger[_0x2cea('0x11')]('CreateCmHopperFinal',_0x3f6f0e[_0x2cea('0x12')],_0x19927a);_0x43ae15(_0x464f7d['error'](0x1f4,_0x3f6f0e[_0x2cea('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 54bac21..02e44d0 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 _0x3e74=['isAuthenticated','index','describe','/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','update','exports','multer','path','connect-timeout','express','../../components/interaction/service','./cmHopperFinal.controller','get'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0x3e74,0x175));var _0x43e7=function(_0x3d59f8,_0x4f5717){_0x3d59f8=_0x3d59f8-0x0;var _0x399a19=_0x3e74[_0x3d59f8];return _0x399a19;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0x6')]('/campaign/countAttributes/:id',auth[_0x43e7('0x7')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x43e7('0xc')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xc')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x43e7('0x10'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);router['put']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);module[_0x43e7('0x13')]=router; \ No newline at end of file +var _0x9c44=['put','update','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','post','/checkContactHopper','checkContactHopper'];(function(_0x21d9b8,_0xcfcc0a){var _0x139449=function(_0x4ee8e5){while(--_0x4ee8e5){_0x21d9b8['push'](_0x21d9b8['shift']());}};_0x139449(++_0xcfcc0a);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0x6')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0x6')]('/campaign/countAttributes/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0xe')]);router['post']('/voice/queue/moveContacts/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0xf')]);router['post'](_0x49c4('0x10'),auth[_0x49c4('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x49c4('0x11')](_0x49c4('0x12'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);router[_0x49c4('0x14')](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x15')]);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 d4671ea..e715d71 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 _0x1224=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x3ffd40,_0x4c65b8){var _0x14309d=function(_0x48886e){while(--_0x48886e){_0x3ffd40['push'](_0x3ffd40['shift']());}};_0x14309d(++_0x4c65b8);}(_0x1224,0x10d));var _0x4122=function(_0x331b85,_0x5f3e6e){_0x331b85=_0x331b85-0x0;var _0x1b97b2=_0x1224[_0x331b85];return _0x1b97b2;};'use strict';var Sequelize=require(_0x4122('0x0'));module[_0x4122('0x1')]={'state':{'type':Sequelize[_0x4122('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4122('0x3')]},'scheduledat':{'type':Sequelize[_0x4122('0x4')]},'countbusyretry':{'type':Sequelize[_0x4122('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4122('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4122('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4122('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x4122('0x3')]},'calleridnum':{'type':Sequelize[_0x4122('0x3')]},'calleridname':{'type':Sequelize[_0x4122('0x3')]},'starttime':{'type':Sequelize[_0x4122('0x4')]},'responsetime':{'type':Sequelize[_0x4122('0x4')]},'answertime':{'type':Sequelize[_0x4122('0x4')]},'droptime':{'type':Sequelize[_0x4122('0x4')]},'endtime':{'type':Sequelize[_0x4122('0x4')]},'ringtime':{'type':Sequelize[_0x4122('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4122('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4122('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4122('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4122('0x3')]},'campaign':{'type':Sequelize[_0x4122('0x3')]},'campaigntype':{'type':Sequelize[_0x4122('0x3')]},'membername':{'type':Sequelize[_0x4122('0x3')]},'reason':{'type':Sequelize[_0x4122('0x3')]},'amd':{'type':Sequelize[_0x4122('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4122('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x4122('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4122('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4122('0x4')]},'recallme':{'type':Sequelize[_0x4122('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4122('0x4')]},'edited':{'type':Sequelize[_0x4122('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x3fa4=['sequelize','DATE','INTEGER','STRING','BOOLEAN'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x3fa4,0xf0));var _0x43fa=function(_0x52c649,_0x463f0c){_0x52c649=_0x52c649-0x0;var _0x43dccb=_0x3fa4[_0x52c649];return _0x43dccb;};'use strict';var Sequelize=require(_0x43fa('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x43fa('0x1')]},'countbusyretry':{'type':Sequelize[_0x43fa('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x43fa('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x43fa('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x43fa('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x43fa('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x43fa('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x43fa('0x3')]},'calleridname':{'type':Sequelize[_0x43fa('0x3')]},'starttime':{'type':Sequelize[_0x43fa('0x1')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x43fa('0x1')]},'droptime':{'type':Sequelize[_0x43fa('0x1')]},'endtime':{'type':Sequelize[_0x43fa('0x1')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x43fa('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x43fa('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x43fa('0x3')]},'campaigntype':{'type':Sequelize[_0x43fa('0x3')]},'membername':{'type':Sequelize[_0x43fa('0x3')]},'reason':{'type':Sequelize[_0x43fa('0x3')]},'amd':{'type':Sequelize[_0x43fa('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x43fa('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x43fa('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x43fa('0x1')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x43fa('0x1')]},'edited':{'type':Sequelize[_0x43fa('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 712d9df..f31ba1b 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 _0xad14=['body','describe','uniqueid','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','end','name','send','index','CmHopperHistory','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','map','options','include','findAll','rows','catch','show','params','includeAll','create'];(function(_0x5e5222,_0x167561){var _0x37bfe1=function(_0x878261){while(--_0x878261){_0x5e5222['push'](_0x5e5222['shift']());}};_0x37bfe1(++_0x167561);}(_0xad14,0x195));var _0x4ad1=function(_0x371b25,_0x224870){_0x371b25=_0x371b25-0x0;var _0x5588e8=_0xad14[_0x371b25];return _0x5588e8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4ad1('0x0'));var rimraf=require(_0x4ad1('0x1'));var zipdir=require(_0x4ad1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4ad1('0x3'));var BPromise=require(_0x4ad1('0x4'));var Mustache=require(_0x4ad1('0x5'));var util=require(_0x4ad1('0x6'));var path=require('path');var sox=require(_0x4ad1('0x7'));var csv=require(_0x4ad1('0x8'));var ejs=require(_0x4ad1('0x9'));var fs=require('fs');var _=require(_0x4ad1('0xa'));var squel=require('squel');var crypto=require(_0x4ad1('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4ad1('0x8'));var querystring=require(_0x4ad1('0xc'));var Papa=require('papaparse');var Redis=require(_0x4ad1('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x4ad1('0xe'))(_0x4ad1('0xf'));var utils=require(_0x4ad1('0x10'));var config=require(_0x4ad1('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6ea333,_0x38c525){_0x38c525=_0x38c525||0xcc;return function(_0x257357){if(_0x257357){return _0x6ea333[_0x4ad1('0x12')](_0x38c525);}return _0x6ea333['status'](_0x38c525)['end']();};}function respondWithResult(_0x5e74f3,_0x48dcd5){_0x48dcd5=_0x48dcd5||0xc8;return function(_0xf29bf9){if(_0xf29bf9){return _0x5e74f3[_0x4ad1('0x13')](_0x48dcd5)['json'](_0xf29bf9);}};}function respondWithFilteredResult(_0x4c9d03,_0x2c9e27){return function(_0x38545c){if(_0x38545c){var _0x3e4469=_0x38545c[_0x4ad1('0x14')],_0x145d30=_0x2c9e27['offset'],_0x4bac90=_0x2c9e27[_0x4ad1('0x15')]+_0x2c9e27[_0x4ad1('0x16')],_0x480dce;if(_0x4bac90>=_0x3e4469){_0x4bac90=_0x3e4469;_0x480dce=0xc8;}else{_0x480dce=0xce;}_0x4c9d03[_0x4ad1('0x13')](_0x480dce);return _0x4c9d03['set'](_0x4ad1('0x17'),_0x145d30+'-'+_0x4bac90+'/'+_0x3e4469)[_0x4ad1('0x18')](_0x38545c);}return null;};}function patchUpdates(_0x2d0d54){return function(_0x3aedcd){try{jsonpatch[_0x4ad1('0x19')](_0x3aedcd,_0x2d0d54,!![]);}catch(_0x16bdc9){return BPromise['reject'](_0x16bdc9);}return _0x3aedcd[_0x4ad1('0x1a')]();};}function saveUpdates(_0x5c9463,_0x34ec45){return function(_0x5d95fe){if(_0x5d95fe){return _0x5d95fe[_0x4ad1('0x1b')](_0x5c9463)[_0x4ad1('0x1c')](function(_0x4ec665){return _0x4ec665;});}return null;};}function removeEntity(_0x4a0ee4,_0x22f086){return function(_0xbdcac0){if(_0xbdcac0){return _0xbdcac0[_0x4ad1('0x1d')]()[_0x4ad1('0x1c')](function(){_0x4a0ee4[_0x4ad1('0x13')](0xcc)[_0x4ad1('0x1e')]();});}};}function handleEntityNotFound(_0x3be4bf,_0x2d1261){return function(_0x5b3601){if(!_0x5b3601){_0x3be4bf[_0x4ad1('0x12')](0x194);}return _0x5b3601;};}function handleError(_0x31cef1,_0x50255c){_0x50255c=_0x50255c||0x1f4;return function(_0x5c13ee){logger['error'](_0x5c13ee['stack']);if(_0x5c13ee[_0x4ad1('0x1f')]){delete _0x5c13ee[_0x4ad1('0x1f')];}_0x31cef1['status'](_0x50255c)[_0x4ad1('0x20')](_0x5c13ee);};}exports[_0x4ad1('0x21')]=function(_0x5a4446,_0x58b27e){var _0x502e49={},_0x2e3781={},_0xce3072={'count':0x0,'rows':[]};var _0xadbd98=db[_0x4ad1('0x22')][_0x4ad1('0x23')];_0x2e3781[_0x4ad1('0x24')]=_[_0x4ad1('0x25')](_0xadbd98);var _0x3b60fd={'dateStart':_0x5a4446[_0x4ad1('0x26')][_0x4ad1('0x27')],'dateEnd':_0x5a4446[_0x4ad1('0x26')][_0x4ad1('0x28')]};delete _0x5a4446[_0x4ad1('0x26')][_0x4ad1('0x27')];delete _0x5a4446[_0x4ad1('0x26')][_0x4ad1('0x28')];_0x2e3781[_0x4ad1('0x26')]=_[_0x4ad1('0x25')](_0x5a4446[_0x4ad1('0x26')]);_0x2e3781[_0x4ad1('0x29')]=_['intersection'](_0x2e3781['model'],_0x2e3781[_0x4ad1('0x26')]);_0x502e49['attributes']=_[_0x4ad1('0x2a')](_0x2e3781[_0x4ad1('0x24')],qs[_0x4ad1('0x2b')](_0x5a4446['query']['fields']));_0x502e49[_0x4ad1('0x2c')]=_0x502e49[_0x4ad1('0x2c')][_0x4ad1('0x2d')]?_0x502e49[_0x4ad1('0x2c')]:_0x2e3781[_0x4ad1('0x24')];if(!_0x5a4446['query'][_0x4ad1('0x2e')](_0x4ad1('0x2f'))){_0x502e49[_0x4ad1('0x16')]=qs[_0x4ad1('0x16')](_0x5a4446['query'][_0x4ad1('0x16')]);_0x502e49[_0x4ad1('0x15')]=qs[_0x4ad1('0x15')](_0x5a4446[_0x4ad1('0x26')][_0x4ad1('0x15')]);}_0x502e49[_0x4ad1('0x30')]=qs['sort'](_0x5a4446['query'][_0x4ad1('0x31')]);_0x502e49[_0x4ad1('0x32')]=qs[_0x4ad1('0x29')](_['pick'](_0x5a4446[_0x4ad1('0x26')],_0x2e3781[_0x4ad1('0x29')]));if(_0x3b60fd['dateStart']){if(_0x3b60fd[_0x4ad1('0x28')]){_0x3b60fd[_0x4ad1('0x28')]=moment(_0x3b60fd[_0x4ad1('0x28')])[_0x4ad1('0x33')](0x1,_0x4ad1('0x34'));}else{_0x3b60fd[_0x4ad1('0x28')]=moment(_0x3b60fd[_0x4ad1('0x27')])[_0x4ad1('0x33')](0x1,_0x4ad1('0x34'));}_['merge'](_0x502e49[_0x4ad1('0x32')],{'createdAt':{'$gte':_0x3b60fd[_0x4ad1('0x27')],'$lte':_0x3b60fd[_0x4ad1('0x28')]}});}if(_0x5a4446[_0x4ad1('0x26')]['filter']){_0x502e49['where']=_[_0x4ad1('0x35')](_0x502e49[_0x4ad1('0x32')],{'$or':_[_0x4ad1('0x36')](_0x502e49[_0x4ad1('0x2c')],function(_0x4cbd80){var _0x251325={};_0x251325[_0x4cbd80]={'$like':'%'+_0x5a4446[_0x4ad1('0x26')]['filter']+'%'};return _0x251325;})});}_0x502e49=_[_0x4ad1('0x35')]({},_0x502e49,_0x5a4446[_0x4ad1('0x37')]);var _0x3a8ebc={'where':_0x502e49[_0x4ad1('0x32')]};return db[_0x4ad1('0x22')]['count'](_0x3a8ebc)[_0x4ad1('0x1c')](function(_0x8bf479){_0xce3072['count']=_0x8bf479;if(_0x5a4446[_0x4ad1('0x26')]['includeAll']){_0x502e49[_0x4ad1('0x38')]=[{'all':!![]}];}return db[_0x4ad1('0x22')][_0x4ad1('0x39')](_0x502e49);})[_0x4ad1('0x1c')](function(_0x2fe764){_0xce3072[_0x4ad1('0x3a')]=_0x2fe764;return _0xce3072;})[_0x4ad1('0x1c')](respondWithFilteredResult(_0x58b27e,_0x502e49))[_0x4ad1('0x3b')](handleError(_0x58b27e,null));};exports[_0x4ad1('0x3c')]=function(_0x4487f7,_0x2fe80e){var _0x41fbb2={'raw':!![],'where':{'id':_0x4487f7[_0x4ad1('0x3d')]['id']}},_0x16c78e={};_0x16c78e[_0x4ad1('0x24')]=_[_0x4ad1('0x25')](db['CmHopperHistory'][_0x4ad1('0x23')]);_0x16c78e[_0x4ad1('0x26')]=_[_0x4ad1('0x25')](_0x4487f7[_0x4ad1('0x26')]);_0x16c78e[_0x4ad1('0x29')]=_['intersection'](_0x16c78e['model'],_0x16c78e[_0x4ad1('0x26')]);_0x41fbb2[_0x4ad1('0x2c')]=_[_0x4ad1('0x2a')](_0x16c78e['model'],qs[_0x4ad1('0x2b')](_0x4487f7['query'][_0x4ad1('0x2b')]));_0x41fbb2[_0x4ad1('0x2c')]=_0x41fbb2[_0x4ad1('0x2c')]['length']?_0x41fbb2[_0x4ad1('0x2c')]:_0x16c78e['model'];if(_0x4487f7['query'][_0x4ad1('0x3e')]){_0x41fbb2[_0x4ad1('0x38')]=[{'all':!![]}];}_0x41fbb2=_[_0x4ad1('0x35')]({},_0x41fbb2,_0x4487f7[_0x4ad1('0x37')]);return db[_0x4ad1('0x22')]['find'](_0x41fbb2)[_0x4ad1('0x1c')](handleEntityNotFound(_0x2fe80e,null))['then'](respondWithResult(_0x2fe80e,null))[_0x4ad1('0x3b')](handleError(_0x2fe80e,null));};exports[_0x4ad1('0x3f')]=function(_0x48643e,_0x4ae4f2){return db[_0x4ad1('0x22')][_0x4ad1('0x3f')](_0x48643e[_0x4ad1('0x40')],{})['then'](respondWithResult(_0x4ae4f2,0xc9))[_0x4ad1('0x3b')](handleError(_0x4ae4f2,null));};exports[_0x4ad1('0x41')]=function(_0x37f733,_0x513b0a){return db['CmHopperHistory'][_0x4ad1('0x41')]()[_0x4ad1('0x1c')](respondWithResult(_0x513b0a,null))[_0x4ad1('0x3b')](handleError(_0x513b0a,null));};exports[_0x4ad1('0x1b')]=function(_0x523f41,_0x1c31c5){if(_0x523f41[_0x4ad1('0x40')][_0x4ad1('0x42')]){delete _0x523f41[_0x4ad1('0x40')][_0x4ad1('0x42')];}return db[_0x4ad1('0x22')]['find']({'where':{'uniqueid':_0x523f41[_0x4ad1('0x3d')]['id']}})[_0x4ad1('0x1c')](handleEntityNotFound(_0x1c31c5,null))['then'](saveUpdates(_0x523f41[_0x4ad1('0x40')],null))[_0x4ad1('0x1c')](respondWithResult(_0x1c31c5,null))[_0x4ad1('0x3b')](handleError(_0x1c31c5,null));}; \ No newline at end of file +var _0x65db=['pick','add','day','filter','map','options','includeAll','include','CmHopperHistory','findAll','rows','catch','params','merge','find','create','body','describe','uniqueid','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','json','apply','save','then','destroy','name','send','index','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65db,0x97));var _0xb65d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x65db[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb65d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb65d('0x1'));var rp=require(_0xb65d('0x2'));var moment=require('moment');var BPromise=require(_0xb65d('0x3'));var Mustache=require(_0xb65d('0x4'));var util=require('util');var path=require(_0xb65d('0x5'));var sox=require(_0xb65d('0x6'));var csv=require('to-csv');var ejs=require(_0xb65d('0x7'));var fs=require('fs');var _=require(_0xb65d('0x8'));var squel=require(_0xb65d('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb65d('0xa'));var toCsv=require(_0xb65d('0xb'));var querystring=require('querystring');var Papa=require(_0xb65d('0xc'));var Redis=require('ioredis');var qs=require(_0xb65d('0xd'));var logger=require(_0xb65d('0xe'))('api');var utils=require(_0xb65d('0xf'));var config=require(_0xb65d('0x10'));var db=require(_0xb65d('0x11'))['db'];function respondWithStatusCode(_0x14f3fe,_0x3a3389){_0x3a3389=_0x3a3389||0xcc;return function(_0x3ff469){if(_0x3ff469){return _0x14f3fe[_0xb65d('0x12')](_0x3a3389);}return _0x14f3fe[_0xb65d('0x13')](_0x3a3389)[_0xb65d('0x14')]();};}function respondWithResult(_0x48686c,_0x34b178){_0x34b178=_0x34b178||0xc8;return function(_0x20675c){if(_0x20675c){return _0x48686c[_0xb65d('0x13')](_0x34b178)['json'](_0x20675c);}};}function respondWithFilteredResult(_0x352037,_0x36db1c){return function(_0xd390d5){if(_0xd390d5){var _0x5cfe35=_0xd390d5[_0xb65d('0x15')],_0x4a6e43=_0x36db1c[_0xb65d('0x16')],_0x3913d8=_0x36db1c['offset']+_0x36db1c[_0xb65d('0x17')],_0x300b22;if(_0x3913d8>=_0x5cfe35){_0x3913d8=_0x5cfe35;_0x300b22=0xc8;}else{_0x300b22=0xce;}_0x352037['status'](_0x300b22);return _0x352037['set']('Content-Range',_0x4a6e43+'-'+_0x3913d8+'/'+_0x5cfe35)[_0xb65d('0x18')](_0xd390d5);}return null;};}function patchUpdates(_0x228083){return function(_0x5c8e0e){try{jsonpatch[_0xb65d('0x19')](_0x5c8e0e,_0x228083,!![]);}catch(_0x34e2dd){return BPromise['reject'](_0x34e2dd);}return _0x5c8e0e[_0xb65d('0x1a')]();};}function saveUpdates(_0x3e9aa0,_0x13be74){return function(_0x4ef482){if(_0x4ef482){return _0x4ef482['update'](_0x3e9aa0)[_0xb65d('0x1b')](function(_0x477489){return _0x477489;});}return null;};}function removeEntity(_0x1e05e8,_0xfa9655){return function(_0x343e96){if(_0x343e96){return _0x343e96[_0xb65d('0x1c')]()[_0xb65d('0x1b')](function(){_0x1e05e8[_0xb65d('0x13')](0xcc)[_0xb65d('0x14')]();});}};}function handleEntityNotFound(_0x24c1c8,_0x2f0eb1){return function(_0x3acf74){if(!_0x3acf74){_0x24c1c8['sendStatus'](0x194);}return _0x3acf74;};}function handleError(_0x1733bb,_0x42f243){_0x42f243=_0x42f243||0x1f4;return function(_0x1f557c){logger['error'](_0x1f557c['stack']);if(_0x1f557c[_0xb65d('0x1d')]){delete _0x1f557c[_0xb65d('0x1d')];}_0x1733bb[_0xb65d('0x13')](_0x42f243)[_0xb65d('0x1e')](_0x1f557c);};}exports[_0xb65d('0x1f')]=function(_0x341b14,_0x2703c8){var _0x92b331={},_0x1422be={},_0x3ffea4={'count':0x0,'rows':[]};var _0x4e2409=db['CmHopperHistory'][_0xb65d('0x20')];_0x1422be['model']=_[_0xb65d('0x21')](_0x4e2409);var _0xae60b6={'dateStart':_0x341b14[_0xb65d('0x22')]['dateStart'],'dateEnd':_0x341b14[_0xb65d('0x22')]['dateEnd']};delete _0x341b14[_0xb65d('0x22')][_0xb65d('0x23')];delete _0x341b14[_0xb65d('0x22')][_0xb65d('0x24')];_0x1422be[_0xb65d('0x22')]=_[_0xb65d('0x21')](_0x341b14[_0xb65d('0x22')]);_0x1422be['filters']=_[_0xb65d('0x25')](_0x1422be[_0xb65d('0x26')],_0x1422be['query']);_0x92b331[_0xb65d('0x27')]=_['intersection'](_0x1422be[_0xb65d('0x26')],qs[_0xb65d('0x28')](_0x341b14[_0xb65d('0x22')][_0xb65d('0x28')]));_0x92b331[_0xb65d('0x27')]=_0x92b331['attributes'][_0xb65d('0x29')]?_0x92b331[_0xb65d('0x27')]:_0x1422be[_0xb65d('0x26')];if(!_0x341b14[_0xb65d('0x22')][_0xb65d('0x2a')](_0xb65d('0x2b'))){_0x92b331['limit']=qs[_0xb65d('0x17')](_0x341b14[_0xb65d('0x22')]['limit']);_0x92b331[_0xb65d('0x16')]=qs[_0xb65d('0x16')](_0x341b14[_0xb65d('0x22')][_0xb65d('0x16')]);}_0x92b331['order']=qs[_0xb65d('0x2c')](_0x341b14['query'][_0xb65d('0x2c')]);_0x92b331[_0xb65d('0x2d')]=qs[_0xb65d('0x2e')](_[_0xb65d('0x2f')](_0x341b14[_0xb65d('0x22')],_0x1422be[_0xb65d('0x2e')]));if(_0xae60b6['dateStart']){if(_0xae60b6[_0xb65d('0x24')]){_0xae60b6[_0xb65d('0x24')]=moment(_0xae60b6[_0xb65d('0x24')])[_0xb65d('0x30')](0x1,'day');}else{_0xae60b6[_0xb65d('0x24')]=moment(_0xae60b6[_0xb65d('0x23')])['add'](0x1,_0xb65d('0x31'));}_['merge'](_0x92b331['where'],{'createdAt':{'$gte':_0xae60b6[_0xb65d('0x23')],'$lte':_0xae60b6[_0xb65d('0x24')]}});}if(_0x341b14[_0xb65d('0x22')][_0xb65d('0x32')]){_0x92b331[_0xb65d('0x2d')]=_['merge'](_0x92b331['where'],{'$or':_[_0xb65d('0x33')](_0x92b331[_0xb65d('0x27')],function(_0x2b7522){var _0x187eb7={};_0x187eb7[_0x2b7522]={'$like':'%'+_0x341b14[_0xb65d('0x22')]['filter']+'%'};return _0x187eb7;})});}_0x92b331=_['merge']({},_0x92b331,_0x341b14[_0xb65d('0x34')]);var _0x58a0f3={'where':_0x92b331[_0xb65d('0x2d')]};return db['CmHopperHistory'][_0xb65d('0x15')](_0x58a0f3)[_0xb65d('0x1b')](function(_0x3bb29d){_0x3ffea4[_0xb65d('0x15')]=_0x3bb29d;if(_0x341b14[_0xb65d('0x22')][_0xb65d('0x35')]){_0x92b331[_0xb65d('0x36')]=[{'all':!![]}];}return db[_0xb65d('0x37')][_0xb65d('0x38')](_0x92b331);})[_0xb65d('0x1b')](function(_0x5d0cca){_0x3ffea4[_0xb65d('0x39')]=_0x5d0cca;return _0x3ffea4;})[_0xb65d('0x1b')](respondWithFilteredResult(_0x2703c8,_0x92b331))[_0xb65d('0x3a')](handleError(_0x2703c8,null));};exports['show']=function(_0x51b044,_0x3e70a5){var _0x382cb0={'raw':!![],'where':{'id':_0x51b044[_0xb65d('0x3b')]['id']}},_0x363e5f={};_0x363e5f['model']=_[_0xb65d('0x21')](db['CmHopperHistory']['rawAttributes']);_0x363e5f[_0xb65d('0x22')]=_[_0xb65d('0x21')](_0x51b044[_0xb65d('0x22')]);_0x363e5f['filters']=_[_0xb65d('0x25')](_0x363e5f['model'],_0x363e5f[_0xb65d('0x22')]);_0x382cb0['attributes']=_[_0xb65d('0x25')](_0x363e5f[_0xb65d('0x26')],qs[_0xb65d('0x28')](_0x51b044[_0xb65d('0x22')][_0xb65d('0x28')]));_0x382cb0[_0xb65d('0x27')]=_0x382cb0[_0xb65d('0x27')][_0xb65d('0x29')]?_0x382cb0[_0xb65d('0x27')]:_0x363e5f[_0xb65d('0x26')];if(_0x51b044['query'][_0xb65d('0x35')]){_0x382cb0[_0xb65d('0x36')]=[{'all':!![]}];}_0x382cb0=_[_0xb65d('0x3c')]({},_0x382cb0,_0x51b044[_0xb65d('0x34')]);return db[_0xb65d('0x37')][_0xb65d('0x3d')](_0x382cb0)[_0xb65d('0x1b')](handleEntityNotFound(_0x3e70a5,null))['then'](respondWithResult(_0x3e70a5,null))[_0xb65d('0x3a')](handleError(_0x3e70a5,null));};exports[_0xb65d('0x3e')]=function(_0x5b8d81,_0x1b716d){return db['CmHopperHistory'][_0xb65d('0x3e')](_0x5b8d81[_0xb65d('0x3f')],{})[_0xb65d('0x1b')](respondWithResult(_0x1b716d,0xc9))['catch'](handleError(_0x1b716d,null));};exports[_0xb65d('0x40')]=function(_0x48c845,_0x477dc0){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x477dc0,null))[_0xb65d('0x3a')](handleError(_0x477dc0,null));};exports['update']=function(_0x440bd3,_0x75c51a){if(_0x440bd3[_0xb65d('0x3f')][_0xb65d('0x41')]){delete _0x440bd3[_0xb65d('0x3f')][_0xb65d('0x41')];}return db[_0xb65d('0x37')]['find']({'where':{'uniqueid':_0x440bd3['params']['id']}})[_0xb65d('0x1b')](handleEntityNotFound(_0x75c51a,null))[_0xb65d('0x1b')](saveUpdates(_0x440bd3['body'],null))[_0xb65d('0x1b')](respondWithResult(_0x75c51a,null))['catch'](handleError(_0x75c51a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 93a07eb..f03ecfd 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 _0x647b=['CmHopperHistory','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./cmHopperHistory.attributes','exports','define'];(function(_0x50a510,_0x5ac219){var _0x364951=function(_0x429dcc){while(--_0x429dcc){_0x50a510['push'](_0x50a510['shift']());}};_0x364951(++_0x5ac219);}(_0x647b,0x1b0));var _0xb647=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x647b[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xb647('0x0'));var util=require(_0xb647('0x1'));var logger=require(_0xb647('0x2'))(_0xb647('0x3'));var moment=require(_0xb647('0x4'));var BPromise=require(_0xb647('0x5'));var rp=require(_0xb647('0x6'));var attributes=require(_0xb647('0x7'));module[_0xb647('0x8')]=function(_0x2e88bc,_0x5c3a10){return _0x2e88bc[_0xb647('0x9')](_0xb647('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0xb647('0xb')]},{'name':_0xb647('0xc'),'fields':[_0xb647('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0704=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','./cmHopperHistory.attributes','exports','define','endtime'];(function(_0x2d7116,_0x37bee1){var _0x522d5a=function(_0x34cba3){while(--_0x34cba3){_0x2d7116['push'](_0x2d7116['shift']());}};_0x522d5a(++_0x37bee1);}(_0x0704,0xdd));var _0x4070=function(_0x2a9cab,_0xacb618){_0x2a9cab=_0x2a9cab-0x0;var _0x4c75f1=_0x0704[_0x2a9cab];return _0x4c75f1;};'use strict';var _=require(_0x4070('0x0'));var util=require(_0x4070('0x1'));var logger=require(_0x4070('0x2'))(_0x4070('0x3'));var moment=require('moment');var BPromise=require(_0x4070('0x4'));var rp=require(_0x4070('0x5'));var attributes=require(_0x4070('0x6'));module[_0x4070('0x7')]=function(_0x5d002d,_0x2a3749){return _0x5d002d[_0x4070('0x8')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x4070('0x9'),'fields':[_0x4070('0x9')]},{'name':_0x4070('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 7b5c73e..5e8c8ed 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 _0x91ab=['ivrTotalCallsDays','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperHistory','body','options','raw','CreateCmHopperHistory','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name'];(function(_0x9dd8ae,_0x1f1c66){var _0x45f3ee=function(_0xafba74){while(--_0xafba74){_0x9dd8ae['push'](_0x9dd8ae['shift']());}};_0x45f3ee(++_0x1f1c66);}(_0x91ab,0x7b));var _0xb91a=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x91ab[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0xb91a('0x0'));var moment=require('moment');var BPromise=require(_0xb91a('0x1'));var rs=require(_0xb91a('0x2'));var fs=require('fs');var Redis=require(_0xb91a('0x3'));var db=require(_0xb91a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb91a('0x5'));var config=require('../../config/environment');var jayson=require(_0xb91a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x228351,_0x512ab8,_0x1491e8){return new BPromise(function(_0x5ae123,_0x3ff640){return client[_0xb91a('0x7')](_0x228351,_0x1491e8)[_0xb91a('0x8')](function(_0x4b3925){logger[_0xb91a('0x9')](_0xb91a('0xa'),_0x512ab8,_0xb91a('0xb'));logger[_0xb91a('0xc')](_0xb91a('0xd'),_0x512ab8,'request\x20sent',JSON[_0xb91a('0xe')](_0x4b3925));if(_0x4b3925['error']){if(_0x4b3925[_0xb91a('0xf')][_0xb91a('0x10')]===0x1f4){logger[_0xb91a('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x512ab8,_0x4b3925[_0xb91a('0xf')][_0xb91a('0x11')]);return _0x3ff640(_0x4b3925[_0xb91a('0xf')][_0xb91a('0x11')]);}logger[_0xb91a('0xf')](_0xb91a('0xa'),_0x512ab8,_0x4b3925[_0xb91a('0xf')][_0xb91a('0x11')]);return _0x5ae123(_0x4b3925['error']['message']);}else{logger[_0xb91a('0x9')](_0xb91a('0xa'),_0x512ab8,_0xb91a('0xb'));_0x5ae123(_0x4b3925[_0xb91a('0x12')][_0xb91a('0x11')]);}})['catch'](function(_0x742b6c){logger[_0xb91a('0xf')](_0xb91a('0xa'),_0x512ab8,_0x742b6c);_0x3ff640(_0x742b6c);});});}exports['CreateCmHopperHistory']=function(_0x3bdade){var _0x63b7d5=this;return new Promise(function(_0x15e54e,_0x41803a){return db[_0xb91a('0x13')]['create'](_0x3bdade[_0xb91a('0x14')],{'raw':_0x3bdade[_0xb91a('0x15')]?_0x3bdade[_0xb91a('0x15')][_0xb91a('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5e62b6){logger[_0xb91a('0x9')](_0xb91a('0x17'),_0x3bdade);logger[_0xb91a('0xc')]('CreateCmHopperHistory',_0x3bdade,JSON[_0xb91a('0xe')](_0x5e62b6));_0x15e54e(_0x5e62b6);})[_0xb91a('0x18')](function(_0x9cca7e){logger[_0xb91a('0xf')](_0xb91a('0x17'),_0x9cca7e[_0xb91a('0x11')],_0x3bdade);_0x41803a(_0x63b7d5[_0xb91a('0xf')](0x1f4,_0x9cca7e[_0xb91a('0x11')]));});});};exports[_0xb91a('0x19')]=function(_0x2a4a8b){var _0x78d92b=this;return new Promise(function(_0x52fd67,_0x1e001a){return db['CmHopperHistory'][_0xb91a('0x1a')]({'raw':_0x2a4a8b[_0xb91a('0x15')]?_0x2a4a8b[_0xb91a('0x15')][_0xb91a('0x16')]===undefined?!![]:![]:!![],'where':_0x2a4a8b[_0xb91a('0x15')]?_0x2a4a8b[_0xb91a('0x15')][_0xb91a('0x1b')]||null:null,'attributes':[[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')][_0xb91a('0x1e')]('id')),_0xb91a('0x1f')],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')](_0xb91a('0x21')))),_0xb91a('0x22')],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db['sequelize']['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')](_0xb91a('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x24'),db[_0xb91a('0x1c')]['fn']('IF',db['sequelize'][_0xb91a('0x20')](_0xb91a('0x25')))),'predictiveIntervalAvgHoldtime'],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x24'),db['sequelize']['fn']('IF',db['sequelize'][_0xb91a('0x20')](_0xb91a('0x26')))),'predictiveIntervalAvgTalktime']]})[_0xb91a('0x8')](function(_0x3edebe){logger['info'](_0xb91a('0x19'),_0x2a4a8b);logger[_0xb91a('0xc')](_0xb91a('0x19'),_0x2a4a8b,JSON['stringify'](_0x3edebe));_0x52fd67(_0x3edebe);})['catch'](function(_0x6d21ba){logger[_0xb91a('0xf')](_0xb91a('0x19'),_0x6d21ba[_0xb91a('0x11')],_0x2a4a8b);_0x1e001a(_0x78d92b[_0xb91a('0xf')](0x1f4,_0x6d21ba[_0xb91a('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x407c0d){var _0xdf6b24=this;return new Promise(function(_0x4b5ce8,_0x4a135c){return db[_0xb91a('0x13')][_0xb91a('0x1a')]({'raw':_0x407c0d['options']?_0x407c0d[_0xb91a('0x15')][_0xb91a('0x16')]===undefined?!![]:![]:!![],'where':_0x407c0d[_0xb91a('0x15')]?_0x407c0d[_0xb91a('0x15')][_0xb91a('0x1b')]||null:null,'attributes':[[_0xb91a('0x27'),'name'],[db[_0xb91a('0x1c')]['fn']('COUNT',db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')](_0xb91a('0x28')))),'outboundNoSuchCallsDay'],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')]['fn']('IF',db['sequelize'][_0xb91a('0x20')](_0xb91a('0x29')))),_0xb91a('0x2a')],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')](_0xb91a('0x21')))),_0xb91a('0x2b')],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db['sequelize']['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')]['literal'](_0xb91a('0x2c')))),_0xb91a('0x2d')],[db['sequelize']['fn'](_0xb91a('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xb91a('0x20')](_0xb91a('0x2e')))),_0xb91a('0x2f')],[db['sequelize']['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')]['literal'](_0xb91a('0x30')))),'outboundDropCallsDayCallersExit'],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0xb91a('0x31')],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db['sequelize']['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')](_0xb91a('0x32')))),_0xb91a('0x33')],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')](_0xb91a('0x34')))),_0xb91a('0x35')],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db['sequelize']['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xb91a('0x1c')]['fn']('COUNT',db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')](_0xb91a('0x36')))),_0xb91a('0x35')],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db[_0xb91a('0x1c')]['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')](_0xb91a('0x37')))),_0xb91a('0x38')]],'group':[_0xb91a('0x27')]})[_0xb91a('0x8')](function(_0x93fd8d){logger[_0xb91a('0x9')](_0xb91a('0x39'),_0x407c0d);logger[_0xb91a('0xc')](_0xb91a('0x39'),_0x407c0d,JSON['stringify'](_0x93fd8d));_0x4b5ce8(_0x93fd8d);})['catch'](function(_0x25a9aa){logger[_0xb91a('0xf')](_0xb91a('0x39'),_0x25a9aa[_0xb91a('0x11')],_0x407c0d);_0x4a135c(_0xdf6b24[_0xb91a('0xf')](0x1f4,_0x25a9aa[_0xb91a('0x11')]));});});};exports[_0xb91a('0x3a')]=function(_0x49831b){var _0x4fde30=this;return new Promise(function(_0x1e27ca,_0x9c1c19){return db[_0xb91a('0x13')][_0xb91a('0x1a')]({'raw':_0x49831b[_0xb91a('0x15')]?_0x49831b[_0xb91a('0x15')][_0xb91a('0x16')]===undefined?!![]:![]:!![],'where':_0x49831b[_0xb91a('0x15')]?_0x49831b[_0xb91a('0x15')][_0xb91a('0x1b')]||null:null,'attributes':[['campaign',_0xb91a('0x3b')],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db['sequelize'][_0xb91a('0x1e')]('id')),_0xb91a('0x3c')],[db[_0xb91a('0x1c')]['fn'](_0xb91a('0x1d'),db['sequelize']['fn']('IF',db[_0xb91a('0x1c')][_0xb91a('0x20')](_0xb91a('0x21')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0xb91a('0x8')](function(_0x3679e6){logger['info'](_0xb91a('0x3a'),_0x49831b);logger[_0xb91a('0xc')](_0xb91a('0x3a'),_0x49831b,JSON[_0xb91a('0xe')](_0x3679e6));_0x1e27ca(_0x3679e6);})[_0xb91a('0x18')](function(_0x58da6d){logger[_0xb91a('0xf')](_0xb91a('0x3a'),_0x58da6d['message'],_0x49831b);_0x9c1c19(_0x4fde30['error'](0x1f4,_0x58da6d['message']));});});}; \ No newline at end of file +var _0x9189=['`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','name','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','result','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal'];(function(_0x2d70ba,_0xc5bf90){var _0x1439db=function(_0x221c50){while(--_0x221c50){_0x2d70ba['push'](_0x2d70ba['shift']());}};_0x1439db(++_0xc5bf90);}(_0x9189,0x1b0));var _0x9918=function(_0xc8b08b,_0x25646f){_0xc8b08b=_0xc8b08b-0x0;var _0x397e55=_0x9189[_0xc8b08b];return _0x397e55;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9918('0x0'));var BPromise=require(_0x9918('0x1'));var rs=require(_0x9918('0x2'));var fs=require('fs');var Redis=require(_0x9918('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9918('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9918('0x5'));var jayson=require(_0x9918('0x6'));var client=jayson['client'][_0x9918('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3cb556,_0x7b8770,_0x5c926e){return new BPromise(function(_0x5a0552,_0x50a534){return client[_0x9918('0x8')](_0x3cb556,_0x5c926e)[_0x9918('0x9')](function(_0x553c75){logger[_0x9918('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x7b8770,_0x9918('0xb'));logger[_0x9918('0xc')](_0x9918('0xd'),_0x7b8770,_0x9918('0xb'),JSON[_0x9918('0xe')](_0x553c75));if(_0x553c75[_0x9918('0xf')]){if(_0x553c75[_0x9918('0xf')]['code']===0x1f4){logger[_0x9918('0xf')](_0x9918('0x10'),_0x7b8770,_0x553c75['error']['message']);return _0x50a534(_0x553c75[_0x9918('0xf')]['message']);}logger['error'](_0x9918('0x10'),_0x7b8770,_0x553c75[_0x9918('0xf')]['message']);return _0x5a0552(_0x553c75[_0x9918('0xf')]['message']);}else{logger[_0x9918('0xa')](_0x9918('0x10'),_0x7b8770,_0x9918('0xb'));_0x5a0552(_0x553c75[_0x9918('0x11')][_0x9918('0x12')]);}})[_0x9918('0x13')](function(_0x1a676f){logger[_0x9918('0xf')](_0x9918('0x10'),_0x7b8770,_0x1a676f);_0x50a534(_0x1a676f);});});}exports[_0x9918('0x14')]=function(_0x45f368){var _0x2a915c=this;return new Promise(function(_0x1a9452,_0x132c22){return db[_0x9918('0x15')][_0x9918('0x16')](_0x45f368[_0x9918('0x17')],{'raw':_0x45f368[_0x9918('0x18')]?_0x45f368[_0x9918('0x18')][_0x9918('0x19')]===undefined?!![]:![]:!![]})[_0x9918('0x9')](function(_0x20be15){logger[_0x9918('0xa')](_0x9918('0x14'),_0x45f368);logger[_0x9918('0xc')](_0x9918('0x14'),_0x45f368,JSON['stringify'](_0x20be15));_0x1a9452(_0x20be15);})[_0x9918('0x13')](function(_0x1f0bca){logger[_0x9918('0xf')]('CreateCmHopperHistory',_0x1f0bca[_0x9918('0x12')],_0x45f368);_0x132c22(_0x2a915c[_0x9918('0xf')](0x1f4,_0x1f0bca[_0x9918('0x12')]));});});};exports[_0x9918('0x1a')]=function(_0x44691e){var _0x19f897=this;return new Promise(function(_0x1bd2cd,_0x216cc1){return db[_0x9918('0x15')][_0x9918('0x1b')]({'raw':_0x44691e[_0x9918('0x18')]?_0x44691e[_0x9918('0x18')][_0x9918('0x19')]===undefined?!![]:![]:!![],'where':_0x44691e['options']?_0x44691e[_0x9918('0x18')][_0x9918('0x1c')]||null:null,'attributes':[[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')][_0x9918('0x1f')]('id')),_0x9918('0x20')],[db[_0x9918('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9918('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x9918('0x21')],[db['sequelize']['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x9918('0x22')))),_0x9918('0x23')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db['sequelize'][_0x9918('0x24')](_0x9918('0x25')))),_0x9918('0x26')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x27'),db['sequelize']['fn']('IF',db[_0x9918('0x1d')]['literal'](_0x9918('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x9918('0x1d')]['fn'](_0x9918('0x27'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')](_0x9918('0x29')))),_0x9918('0x2a')]]})[_0x9918('0x9')](function(_0x287459){logger['info'](_0x9918('0x1a'),_0x44691e);logger[_0x9918('0xc')](_0x9918('0x1a'),_0x44691e,JSON[_0x9918('0xe')](_0x287459));_0x1bd2cd(_0x287459);})[_0x9918('0x13')](function(_0x24e0f9){logger[_0x9918('0xf')](_0x9918('0x1a'),_0x24e0f9['message'],_0x44691e);_0x216cc1(_0x19f897['error'](0x1f4,_0x24e0f9[_0x9918('0x12')]));});});};exports[_0x9918('0x2b')]=function(_0x27ffb6){var _0xa43337=this;return new Promise(function(_0x58971e,_0x44e397){return db['CmHopperHistory'][_0x9918('0x1b')]({'raw':_0x27ffb6[_0x9918('0x18')]?_0x27ffb6[_0x9918('0x18')][_0x9918('0x19')]===undefined?!![]:![]:!![],'where':_0x27ffb6['options']?_0x27ffb6['options'][_0x9918('0x1c')]||null:null,'attributes':[[_0x9918('0x2c'),'name'],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x9918('0x2d')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')]('`state`\x20=\x203,\x201,\x20null'))),_0x9918('0x2e')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db['sequelize'][_0x9918('0x24')](_0x9918('0x2f')))),_0x9918('0x30')],[db[_0x9918('0x1d')]['fn']('COUNT',db[_0x9918('0x1d')]['fn']('IF',db['sequelize'][_0x9918('0x24')]('`state`\x20=\x205,\x201,\x20null'))),_0x9918('0x31')],[db[_0x9918('0x1d')]['fn']('COUNT',db[_0x9918('0x1d')]['fn']('IF',db['sequelize'][_0x9918('0x24')](_0x9918('0x32')))),_0x9918('0x33')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db['sequelize'][_0x9918('0x24')](_0x9918('0x34')))),'outboundDropCallsDayTimeout'],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9918('0x35')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')](_0x9918('0x36')))),_0x9918('0x37')],[db['sequelize']['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x9918('0x38')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db['sequelize']['fn']('IF',db[_0x9918('0x1d')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x9918('0x39')],[db['sequelize']['fn']('COUNT',db[_0x9918('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x9918('0x3a')))),_0x9918('0x3b')],[db[_0x9918('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x9918('0x24')](_0x9918('0x3c')))),_0x9918('0x3d')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')](_0x9918('0x3e')))),_0x9918('0x3b')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db['sequelize']['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')](_0x9918('0x3f')))),'outboundReCallsDay']],'group':[_0x9918('0x2c')]})[_0x9918('0x9')](function(_0x458c00){logger[_0x9918('0xa')](_0x9918('0x2b'),_0x27ffb6);logger[_0x9918('0xc')](_0x9918('0x2b'),_0x27ffb6,JSON['stringify'](_0x458c00));_0x58971e(_0x458c00);})['catch'](function(_0x30cde2){logger[_0x9918('0xf')]('GetVoiceQueueHopperHistory',_0x30cde2[_0x9918('0x12')],_0x27ffb6);_0x44e397(_0xa43337[_0x9918('0xf')](0x1f4,_0x30cde2[_0x9918('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x390d56){var _0x1ec4f0=this;return new Promise(function(_0x22b1b0,_0x16b75c){return db['CmHopperHistory'][_0x9918('0x1b')]({'raw':_0x390d56[_0x9918('0x18')]?_0x390d56[_0x9918('0x18')][_0x9918('0x19')]===undefined?!![]:![]:!![],'where':_0x390d56[_0x9918('0x18')]?_0x390d56[_0x9918('0x18')][_0x9918('0x1c')]||null:null,'attributes':[[_0x9918('0x2c'),_0x9918('0x40')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')][_0x9918('0x1f')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x9918('0x1e'),db['sequelize']['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')](_0x9918('0x2f')))),_0x9918('0x41')]],'group':['campaign']})[_0x9918('0x9')](function(_0x23a6be){logger[_0x9918('0xa')]('GetCampaignHopperHistory',_0x390d56);logger[_0x9918('0xc')]('GetCampaignHopperHistory',_0x390d56,JSON[_0x9918('0xe')](_0x23a6be));_0x22b1b0(_0x23a6be);})['catch'](function(_0x48c79e){logger[_0x9918('0xf')](_0x9918('0x42'),_0x48c79e[_0x9918('0x12')],_0x390d56);_0x16b75c(_0x1ec4f0[_0x9918('0xf')](0x1f4,_0x48c79e[_0x9918('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 281ba73..1c514ef 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 _0x7f94=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','show','post','update','exports','multer'];(function(_0xec1043,_0x2a0be1){var _0x2bbb3e=function(_0x16f50b){while(--_0x16f50b){_0xec1043['push'](_0xec1043['shift']());}};_0x2bbb3e(++_0x2a0be1);}(_0x7f94,0x65));var _0x47f9=function(_0x42cf14,_0x5c3697){_0x42cf14=_0x42cf14-0x0;var _0xa42bdb=_0x7f94[_0x42cf14];return _0xa42bdb;};'use strict';var multer=require(_0x47f9('0x0'));var util=require('util');var path=require(_0x47f9('0x1'));var timeout=require(_0x47f9('0x2'));var express=require(_0x47f9('0x3'));var router=express[_0x47f9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47f9('0x5'));var config=require(_0x47f9('0x6'));var controller=require(_0x47f9('0x7'));router[_0x47f9('0x8')]('/',auth[_0x47f9('0x9')](),controller[_0x47f9('0xa')]);router[_0x47f9('0x8')]('/describe',auth[_0x47f9('0x9')](),controller[_0x47f9('0xb')]);router[_0x47f9('0x8')](_0x47f9('0xc'),auth[_0x47f9('0x9')](),controller[_0x47f9('0xd')]);router[_0x47f9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x47f9('0x9')](),controller[_0x47f9('0xf')]);module[_0x47f9('0x10')]=router; \ No newline at end of file +var _0xde81=['get','isAuthenticated','index','/describe','describe','post','create','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0xc18c78,_0x6eda43){var _0x4e3578=function(_0x1c84ba){while(--_0x1c84ba){_0xc18c78['push'](_0xc18c78['shift']());}};_0x4e3578(++_0x6eda43);}(_0xde81,0x109));var _0x1de8=function(_0x98023f,_0x158398){_0x98023f=_0x98023f-0x0;var _0x2e33b3=_0xde81[_0x98023f];return _0x2e33b3;};'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'));var controller=require('./cmHopperHistory.controller');router[_0x1de8('0x7')]('/',auth[_0x1de8('0x8')](),controller[_0x1de8('0x9')]);router[_0x1de8('0x7')](_0x1de8('0xa'),auth[_0x1de8('0x8')](),controller[_0x1de8('0xb')]);router['get']('/:id',auth[_0x1de8('0x8')](),controller['show']);router[_0x1de8('0xc')]('/',auth[_0x1de8('0x8')](),controller[_0x1de8('0xd')]);router['put'](_0x1de8('0xe'),auth[_0x1de8('0x8')](),controller[_0x1de8('0xf')]);module[_0x1de8('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 3b27e56..c1f35db 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 _0x187d=['sequelize','STRING','name'];(function(_0x57003e,_0x2380b4){var _0x71ad7a=function(_0x5caa8d){while(--_0x5caa8d){_0x57003e['push'](_0x57003e['shift']());}};_0x71ad7a(++_0x2380b4);}(_0x187d,0x93));var _0xd187=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x187d[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require(_0xd187('0x0'));module['exports']={'name':{'type':Sequelize[_0xd187('0x1')],'unique':_0xd187('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd187('0x1')]},'dialPrefix':{'type':Sequelize[_0xd187('0x1')]}}; \ No newline at end of file +var _0x7da7=['exports','STRING','sequelize'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x7da7,0x10d));var _0x77da=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0x7da7[_0x1f0724];return _0x253ffb;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x77da('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index bfdfbd7..fcf4eb2 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 _0xd994=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','CmList','model','keys','dateStart','query','dateEnd','attributes','fields','length','limit','filters','add','day','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','describe','addDisposition','ListId','findOne','Disposition','intersection','hasOwnProperty','nolimit','order','sort','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','dataValues','message','Malformed\x20request\x20syntax','map','format','cf_%d','raw','getContacts','getContactsCsv','CmCustomField','CustomFields','rawAttributes','concat','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','Sequelize','TEXT','type','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','findAndCountAll','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User'];(function(_0x5c1726,_0x27281a){var _0x20f183=function(_0x4ce740){while(--_0x4ce740){_0x5c1726['push'](_0x5c1726['shift']());}};_0x20f183(++_0x27281a);}(_0xd994,0x11a));var _0x4d99=function(_0x1dd020,_0xd604b8){_0x1dd020=_0x1dd020-0x0;var _0x3558f3=_0xd994[_0x1dd020];return _0x3558f3;};'use strict';var pdf=require(_0x4d99('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4d99('0x1'));var zipdir=require(_0x4d99('0x2'));var jsonpatch=require(_0x4d99('0x3'));var rp=require(_0x4d99('0x4'));var moment=require(_0x4d99('0x5'));var BPromise=require(_0x4d99('0x6'));var Mustache=require(_0x4d99('0x7'));var util=require(_0x4d99('0x8'));var path=require(_0x4d99('0x9'));var sox=require(_0x4d99('0xa'));var csv=require(_0x4d99('0xb'));var ejs=require(_0x4d99('0xc'));var fs=require('fs');var _=require(_0x4d99('0xd'));var squel=require(_0x4d99('0xe'));var crypto=require(_0x4d99('0xf'));var jsforce=require(_0x4d99('0x10'));var deskjs=require(_0x4d99('0x11'));var toCsv=require(_0x4d99('0xb'));var querystring=require('querystring');var Papa=require(_0x4d99('0x12'));var Redis=require(_0x4d99('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x4d99('0x14'))(_0x4d99('0x15'));var utils=require(_0x4d99('0x16'));var config=require(_0x4d99('0x17'));var db=require(_0x4d99('0x18'))['db'];config[_0x4d99('0x19')]=_[_0x4d99('0x1a')](config[_0x4d99('0x19')],{'host':_0x4d99('0x1b'),'port':0x18eb});var socket=require(_0x4d99('0x1c'))(new Redis(config['redis']));require('./cmList.socket')[_0x4d99('0x1d')](socket);function respondWithStatusCode(_0x2f02c4,_0x5ec66b){_0x5ec66b=_0x5ec66b||0xcc;return function(_0x59ce5a){if(_0x59ce5a){return _0x2f02c4[_0x4d99('0x1e')](_0x5ec66b);}return _0x2f02c4[_0x4d99('0x1f')](_0x5ec66b)[_0x4d99('0x20')]();};}function respondWithResult(_0x4cc3fb,_0x5d9d9b){_0x5d9d9b=_0x5d9d9b||0xc8;return function(_0x1eb1f8){if(_0x1eb1f8){return _0x4cc3fb[_0x4d99('0x1f')](_0x5d9d9b)[_0x4d99('0x21')](_0x1eb1f8);}};}function respondWithFilteredResult(_0x3cee79,_0x6e0268){return function(_0x3d7151){if(_0x3d7151){var _0x3cc61d=_0x3d7151['count'],_0x93746b=_0x6e0268[_0x4d99('0x22')],_0x5056b2=_0x6e0268[_0x4d99('0x22')]+_0x6e0268['limit'],_0x259ae3;if(_0x5056b2>=_0x3cc61d){_0x5056b2=_0x3cc61d;_0x259ae3=0xc8;}else{_0x259ae3=0xce;}_0x3cee79[_0x4d99('0x1f')](_0x259ae3);return _0x3cee79[_0x4d99('0x23')](_0x4d99('0x24'),_0x93746b+'-'+_0x5056b2+'/'+_0x3cc61d)[_0x4d99('0x21')](_0x3d7151);}return null;};}function patchUpdates(_0x47c932){return function(_0x1e988b){try{jsonpatch['apply'](_0x1e988b,_0x47c932,!![]);}catch(_0x1cf742){return BPromise[_0x4d99('0x25')](_0x1cf742);}return _0x1e988b[_0x4d99('0x26')]();};}function saveUpdates(_0x215891,_0x29d68e){return function(_0x5052cc){if(_0x5052cc){return _0x5052cc[_0x4d99('0x27')](_0x215891)[_0x4d99('0x28')](function(_0x43a00a){return _0x43a00a;});}return null;};}function removeEntity(_0xa85a36,_0x155bc2){return function(_0x17f20c){if(_0x17f20c){return _0x17f20c[_0x4d99('0x29')]()[_0x4d99('0x28')](function(){var _0x12b3a9=_0x17f20c[_0x4d99('0x2a')]({'plain':!![]});var _0x88d2e=_0x4d99('0x2b');return db[_0x4d99('0x2c')]['destroy']({'where':{'type':_0x88d2e,'resourceId':_0x12b3a9['id']}})[_0x4d99('0x28')](function(){return _0x17f20c;});})[_0x4d99('0x28')](function(){_0xa85a36[_0x4d99('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x839b0e,_0x13ac7b){return function(_0x1f99c3){if(!_0x1f99c3){_0x839b0e[_0x4d99('0x1e')](0x194);}return _0x1f99c3;};}function handleError(_0x3bd6b8,_0x4e1a1a){_0x4e1a1a=_0x4e1a1a||0x1f4;return function(_0x2ce5a2){logger[_0x4d99('0x2d')](_0x2ce5a2[_0x4d99('0x2e')]);if(_0x2ce5a2[_0x4d99('0x2f')]){delete _0x2ce5a2[_0x4d99('0x2f')];}_0x3bd6b8[_0x4d99('0x1f')](_0x4e1a1a)['send'](_0x2ce5a2);};}exports['index']=function(_0x29b0c8,_0x1ab1bc){var _0x49ded2={},_0x3af92b={},_0x4dde41={'count':0x0,'rows':[]};var _0x544854=db[_0x4d99('0x30')]['rawAttributes'];_0x3af92b[_0x4d99('0x31')]=_[_0x4d99('0x32')](_0x544854);var _0x594dab={'dateStart':_0x29b0c8['query'][_0x4d99('0x33')],'dateEnd':_0x29b0c8[_0x4d99('0x34')][_0x4d99('0x35')]};delete _0x29b0c8['query'][_0x4d99('0x33')];delete _0x29b0c8[_0x4d99('0x34')][_0x4d99('0x35')];_0x3af92b[_0x4d99('0x34')]=_[_0x4d99('0x32')](_0x29b0c8[_0x4d99('0x34')]);_0x3af92b['filters']=_['intersection'](_0x3af92b[_0x4d99('0x31')],_0x3af92b[_0x4d99('0x34')]);_0x49ded2[_0x4d99('0x36')]=_['intersection'](_0x3af92b[_0x4d99('0x31')],qs[_0x4d99('0x37')](_0x29b0c8['query'][_0x4d99('0x37')]));_0x49ded2[_0x4d99('0x36')]=_0x49ded2[_0x4d99('0x36')][_0x4d99('0x38')]?_0x49ded2[_0x4d99('0x36')]:_0x3af92b[_0x4d99('0x31')];if(!_0x29b0c8[_0x4d99('0x34')]['hasOwnProperty']('nolimit')){_0x49ded2['limit']=qs['limit'](_0x29b0c8[_0x4d99('0x34')][_0x4d99('0x39')]);_0x49ded2[_0x4d99('0x22')]=qs[_0x4d99('0x22')](_0x29b0c8['query']['offset']);}_0x49ded2['order']=qs['sort'](_0x29b0c8[_0x4d99('0x34')]['sort']);_0x49ded2['where']=qs[_0x4d99('0x3a')](_['pick'](_0x29b0c8[_0x4d99('0x34')],_0x3af92b[_0x4d99('0x3a')]));if(_0x594dab[_0x4d99('0x33')]){if(_0x594dab['dateEnd']){_0x594dab[_0x4d99('0x35')]=moment(_0x594dab[_0x4d99('0x35')])[_0x4d99('0x3b')](0x1,'day');}else{_0x594dab[_0x4d99('0x35')]=moment(_0x594dab[_0x4d99('0x33')])[_0x4d99('0x3b')](0x1,_0x4d99('0x3c'));}_['merge'](_0x49ded2[_0x4d99('0x3d')],{'createdAt':{'$gte':_0x594dab[_0x4d99('0x33')],'$lte':_0x594dab['dateEnd']}});}if(_0x29b0c8[_0x4d99('0x34')][_0x4d99('0x3e')]){_0x49ded2[_0x4d99('0x3d')]=_['merge'](_0x49ded2['where'],{'$or':_['map'](_0x49ded2[_0x4d99('0x36')],function(_0x2606c4){var _0x260427={};_0x260427[_0x2606c4]={'$like':'%'+_0x29b0c8[_0x4d99('0x34')]['filter']+'%'};return _0x260427;})});}_0x49ded2=_[_0x4d99('0x3f')]({},_0x49ded2,_0x29b0c8[_0x4d99('0x40')]);var _0x4d23e9={'where':_0x49ded2['where']};return db['CmList'][_0x4d99('0x41')](_0x4d23e9)[_0x4d99('0x28')](function(_0x508644){_0x4dde41[_0x4d99('0x41')]=_0x508644;if(_0x29b0c8[_0x4d99('0x34')][_0x4d99('0x42')]){_0x49ded2[_0x4d99('0x43')]=[{'all':!![]}];}return db['CmList'][_0x4d99('0x44')](_0x49ded2);})['then'](function(_0x1ab795){_0x4dde41[_0x4d99('0x45')]=_0x1ab795;return _0x4dde41;})[_0x4d99('0x28')](respondWithFilteredResult(_0x1ab1bc,_0x49ded2))[_0x4d99('0x46')](handleError(_0x1ab1bc,null));};exports['show']=function(_0x1d059f,_0x5c3ed8){var _0x5a5304={'raw':![],'where':{'id':_0x1d059f[_0x4d99('0x47')]['id']}},_0x596568={};_0x596568[_0x4d99('0x31')]=_[_0x4d99('0x32')](db['CmList']['rawAttributes']);_0x596568[_0x4d99('0x34')]=_[_0x4d99('0x32')](_0x1d059f['query']);_0x596568[_0x4d99('0x3a')]=_['intersection'](_0x596568['model'],_0x596568[_0x4d99('0x34')]);_0x5a5304[_0x4d99('0x36')]=_['intersection'](_0x596568['model'],qs[_0x4d99('0x37')](_0x1d059f[_0x4d99('0x34')]['fields']));_0x5a5304[_0x4d99('0x36')]=_0x5a5304[_0x4d99('0x36')][_0x4d99('0x38')]?_0x5a5304['attributes']:_0x596568[_0x4d99('0x31')];if(_0x1d059f[_0x4d99('0x34')][_0x4d99('0x42')]){_0x5a5304[_0x4d99('0x43')]=[{'all':!![]}];}_0x5a5304=_[_0x4d99('0x3f')]({},_0x5a5304,_0x1d059f[_0x4d99('0x40')]);return db[_0x4d99('0x30')][_0x4d99('0x48')](_0x5a5304)[_0x4d99('0x28')](handleEntityNotFound(_0x5c3ed8,null))[_0x4d99('0x28')](respondWithResult(_0x5c3ed8,null))[_0x4d99('0x46')](handleError(_0x5c3ed8,null));};exports[_0x4d99('0x49')]=function(_0x56254c,_0xe6b847){return db[_0x4d99('0x30')][_0x4d99('0x49')](_0x56254c[_0x4d99('0x4a')],{})['then'](function(_0x27ba68){var _0x2927da=_0x56254c['user'][_0x4d99('0x2a')]({'plain':!![]});if(!_0x2927da)throw new Error(_0x4d99('0x4b'));if(_0x2927da['role']===_0x4d99('0x4c')){var _0x966e0b=_0x27ba68['get']({'plain':!![]});var _0x27a249=_0x4d99('0x2b');return db[_0x4d99('0x4d')]['find']({'where':{'name':_0x27a249,'userProfileId':_0x2927da['userProfileId']},'raw':!![]})[_0x4d99('0x28')](function(_0x54d559){if(_0x54d559&&_0x54d559['autoAssociation']===0x0){return db['UserProfileResource'][_0x4d99('0x49')]({'name':_0x966e0b[_0x4d99('0x2f')],'resourceId':_0x966e0b['id'],'type':_0x54d559[_0x4d99('0x2f')],'sectionId':_0x54d559['id']},{})[_0x4d99('0x28')](function(){return _0x27ba68;});}else{return _0x27ba68;}})[_0x4d99('0x46')](function(_0xe3801f){logger[_0x4d99('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe3801f);throw _0xe3801f;});}return _0x27ba68;})[_0x4d99('0x28')](respondWithResult(_0xe6b847,0xc9))[_0x4d99('0x46')](handleError(_0xe6b847,null));};exports[_0x4d99('0x27')]=function(_0x26af48,_0x21d820){if(_0x26af48[_0x4d99('0x4a')]['id']){delete _0x26af48[_0x4d99('0x4a')]['id'];}return db[_0x4d99('0x30')][_0x4d99('0x48')]({'where':{'id':_0x26af48[_0x4d99('0x47')]['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x21d820,null))[_0x4d99('0x28')](saveUpdates(_0x26af48['body'],null))['then'](respondWithResult(_0x21d820,null))['catch'](handleError(_0x21d820,null));};exports['destroy']=function(_0x58e578,_0x144dee){return db['CmList'][_0x4d99('0x48')]({'where':{'id':_0x58e578[_0x4d99('0x47')]['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x144dee,null))['then'](removeEntity(_0x144dee,null))[_0x4d99('0x46')](handleError(_0x144dee,null));};exports[_0x4d99('0x4e')]=function(_0x2d5348,_0x27ab55){return db[_0x4d99('0x30')]['describe']()[_0x4d99('0x28')](respondWithResult(_0x27ab55,null))[_0x4d99('0x46')](handleError(_0x27ab55,null));};exports[_0x4d99('0x4f')]=function(_0xc7af12,_0x22ef7b,_0x8023ac){if(_0xc7af12[_0x4d99('0x4a')]['id']){delete _0xc7af12['body']['id'];}return db['CmList'][_0x4d99('0x48')]({'where':{'id':_0xc7af12[_0x4d99('0x47')]['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x22ef7b,null))[_0x4d99('0x28')](function(_0xe54448){if(_0xe54448){_0xc7af12[_0x4d99('0x4a')][_0x4d99('0x50')]=_0xe54448['id'];return db['Disposition'][_0x4d99('0x49')](_0xc7af12[_0x4d99('0x4a')]);}})[_0x4d99('0x28')](respondWithResult(_0x22ef7b,null))[_0x4d99('0x46')](handleError(_0x22ef7b,null));};exports['getDispositions']=function(_0xc5fb39,_0x51b66d,_0x753174){var _0x6fb0df={'raw':![],'where':{}};var _0x417b32={};var _0x37bd27={'count':0x0,'rows':[]};return db[_0x4d99('0x30')][_0x4d99('0x51')]({'where':{'id':_0xc5fb39[_0x4d99('0x47')]['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x51b66d,null))[_0x4d99('0x28')](function(_0x13ccd6){if(_0x13ccd6){_0x417b32[_0x4d99('0x31')]=_[_0x4d99('0x32')](db[_0x4d99('0x52')]['rawAttributes']);_0x417b32['query']=_['keys'](_0xc5fb39[_0x4d99('0x34')]);_0x417b32[_0x4d99('0x3a')]=_[_0x4d99('0x53')](_0x417b32[_0x4d99('0x31')],_0x417b32[_0x4d99('0x34')]);_0x6fb0df[_0x4d99('0x36')]=_[_0x4d99('0x53')](_0x417b32[_0x4d99('0x31')],qs[_0x4d99('0x37')](_0xc5fb39[_0x4d99('0x34')][_0x4d99('0x37')]));_0x6fb0df[_0x4d99('0x36')]=_0x6fb0df[_0x4d99('0x36')][_0x4d99('0x38')]?_0x6fb0df['attributes']:_0x417b32[_0x4d99('0x31')];if(!_0xc5fb39['query'][_0x4d99('0x54')](_0x4d99('0x55'))){_0x6fb0df[_0x4d99('0x39')]=qs[_0x4d99('0x39')](_0xc5fb39[_0x4d99('0x34')]['limit']);_0x6fb0df[_0x4d99('0x22')]=qs[_0x4d99('0x22')](_0xc5fb39[_0x4d99('0x34')][_0x4d99('0x22')]);}_0x6fb0df[_0x4d99('0x56')]=qs[_0x4d99('0x57')](_0xc5fb39['query']['sort']);_0x6fb0df[_0x4d99('0x3d')]=qs[_0x4d99('0x3a')](_[_0x4d99('0x58')](_0xc5fb39[_0x4d99('0x34')],_0x417b32['filters']));_0x6fb0df[_0x4d99('0x3d')][_0x4d99('0x50')]=_0x13ccd6['id'];if(_0xc5fb39['query'][_0x4d99('0x3e')]){_0x6fb0df[_0x4d99('0x3d')]=_['merge'](_0x6fb0df['where'],{'$or':_['map'](_0x6fb0df[_0x4d99('0x36')],function(_0x3f3b19){var _0x2a2df8={};_0x2a2df8[_0x3f3b19]={'$like':'%'+_0xc5fb39['query']['filter']+'%'};return _0x2a2df8;})});}_0x6fb0df=_[_0x4d99('0x3f')]({},_0x6fb0df,_0xc5fb39['options']);return db[_0x4d99('0x52')][_0x4d99('0x41')]({'where':_0x6fb0df[_0x4d99('0x3d')]})[_0x4d99('0x28')](function(_0x3ad266){_0x37bd27['count']=_0x3ad266;if(_0xc5fb39[_0x4d99('0x34')][_0x4d99('0x42')]){_0x6fb0df[_0x4d99('0x43')]=[{'all':!![]}];}return db[_0x4d99('0x52')][_0x4d99('0x44')](_0x6fb0df);})[_0x4d99('0x28')](function(_0x1478dc){_0x37bd27[_0x4d99('0x45')]=_0x1478dc;return _0x37bd27;});}})[_0x4d99('0x28')](respondWithFilteredResult(_0x51b66d,_0x6fb0df))[_0x4d99('0x46')](handleError(_0x51b66d,null));};exports['removeDispositions']=function(_0x5cd59c,_0x444fe4,_0x2457bc){var _0x2fe7ae;return db[_0x4d99('0x30')][_0x4d99('0x48')]({'where':{'id':_0x5cd59c[_0x4d99('0x47')]['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x444fe4,null))[_0x4d99('0x28')](function(_0x112693){if(_0x112693){return _0x112693[_0x4d99('0x59')](_0x5cd59c[_0x4d99('0x34')][_0x4d99('0x5a')]);}})[_0x4d99('0x28')](respondWithStatusCode(_0x444fe4,null))[_0x4d99('0x46')](handleError(_0x444fe4,null));};exports[_0x4d99('0x5b')]=function(_0x36be96,_0x2904c1,_0x55a918){return db[_0x4d99('0x30')][_0x4d99('0x48')]({'where':{'id':_0x36be96[_0x4d99('0x47')]['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x2904c1,null))[_0x4d99('0x28')](function(_0x3951a9){if(_0x3951a9){var _0x3af210=[];var _0x226515={'success':[],'errors':[]};return db[_0x4d99('0x5c')][_0x4d99('0x4e')]()[_0x4d99('0x28')](function(_0x4a9ced){if(_0x36be96['body'][_0x4d99('0x5d')]&&_['isArray'](_0x36be96[_0x4d99('0x4a')][_0x4d99('0x5d')])){if(_0x36be96['body'][_0x4d99('0x5d')][_0x4d99('0x38')]){_0x36be96[_0x4d99('0x4a')]['tags']=_0x36be96[_0x4d99('0x4a')][_0x4d99('0x5d')]['join'](';')+';';}else{_0x36be96[_0x4d99('0x4a')][_0x4d99('0x5d')]=null;}}else{_0x36be96['body']['tags']=null;}if(_0x36be96[_0x4d99('0x4a')]&&_[_0x4d99('0x5e')](_0x36be96[_0x4d99('0x4a')])){for(var _0x40f963=0x0;_0x40f963<_0x36be96[_0x4d99('0x4a')][_0x4d99('0x38')];_0x40f963+=0x1){_0x36be96[_0x4d99('0x4a')][_0x40f963][_0x4d99('0x50')]=_0x36be96[_0x4d99('0x47')]['id'];_0x3af210[_0x4d99('0x5f')](_0x36be96[_0x4d99('0x4a')][_0x40f963]);}return BPromise[_0x4d99('0x60')](_0x3af210,function(_0x5b710d){return db[_0x4d99('0x5c')][_0x4d99('0x49')](_['omit'](_0x5b710d,[_0x4d99('0x5a'),'id'])||{},{'fields':_[_0x4d99('0x32')](_0x4a9ced),'raw':!![]})['then'](function(_0x47f2b9){_0x226515['success'][_0x4d99('0x5f')](_0x47f2b9[_0x4d99('0x61')]);})[_0x4d99('0x46')](function(_0x3c1b7f){_0x226515['errors'][_0x4d99('0x5f')]({'data':_0x5b710d,'error':_0x3c1b7f[_0x4d99('0x62')]});});})[_0x4d99('0x28')](function(_0x367432){return _0x226515;})[_0x4d99('0x46')](function(_0x20a143){return _0x20a143;});}else{_0x2904c1[_0x4d99('0x1f')](0x190)['json']({'message':_0x4d99('0x63')});}});}})[_0x4d99('0x28')](respondWithResult(_0x2904c1,null))[_0x4d99('0x46')](handleError(_0x2904c1,null));};exports['getContacts']=function(_0x4690ad,_0x7b3c1e,_0x31cfcc){var _0x4f582f;return db['CmList'][_0x4d99('0x48')]({'where':{'id':_0x4690ad[_0x4d99('0x47')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x4d99('0x28')](handleEntityNotFound(_0x7b3c1e,null))[_0x4d99('0x28')](function(_0x2f7182){if(_0x2f7182){_0x4f582f=_0x2f7182;return db[_0x4d99('0x5c')]['rawAttributes'];}})['then'](function(_0x11ad25){if(_0x11ad25){var _0x356c15={};var _0xeb865={};_0xeb865[_0x4d99('0x31')]=_['concat'](_[_0x4d99('0x32')](_0x11ad25),_[_0x4d99('0x64')](_0x4f582f['CustomFields'],function(_0x2767d0){return util[_0x4d99('0x65')](_0x4d99('0x66'),_0x2767d0['id']);}));_0xeb865[_0x4d99('0x34')]=_['keys'](_0x4690ad['query']);_0xeb865[_0x4d99('0x3a')]=_['intersection'](_0xeb865[_0x4d99('0x31')],_0xeb865[_0x4d99('0x34')]);_0x356c15[_0x4d99('0x36')]=_['intersection'](_0xeb865['model'],qs[_0x4d99('0x37')](_0x4690ad[_0x4d99('0x34')][_0x4d99('0x37')]));_0x356c15['attributes']=_0x356c15[_0x4d99('0x36')][_0x4d99('0x38')]?_0x356c15['attributes']:_0xeb865[_0x4d99('0x31')];if(!_0x4690ad['query'][_0x4d99('0x54')]('nolimit')){_0x356c15[_0x4d99('0x39')]=qs[_0x4d99('0x39')](_0x4690ad[_0x4d99('0x34')][_0x4d99('0x39')]);_0x356c15['offset']=qs[_0x4d99('0x22')](_0x4690ad['query'][_0x4d99('0x22')]);}_0x356c15[_0x4d99('0x56')]=qs['sort'](_0x4690ad[_0x4d99('0x34')][_0x4d99('0x57')]);_0x356c15[_0x4d99('0x3d')]=qs[_0x4d99('0x3a')](_[_0x4d99('0x58')](_0x4690ad[_0x4d99('0x34')],_0xeb865['filters']));_0x356c15[_0x4d99('0x67')]=!![];if(_0x4690ad[_0x4d99('0x34')][_0x4d99('0x3e')]){_0x356c15[_0x4d99('0x3d')]=_[_0x4d99('0x3f')](_0x356c15['where'],{'$or':_[_0x4d99('0x64')](_0x356c15['attributes'],function(_0x2db3e2){var _0x42f574={};_0x42f574[_0x2db3e2]={'$like':'%'+_0x4690ad[_0x4d99('0x34')][_0x4d99('0x3e')]+'%'};return _0x42f574;})});}_0x356c15=_[_0x4d99('0x3f')]({},_0x356c15,_0x4690ad[_0x4d99('0x40')]);return _0x4f582f[_0x4d99('0x68')](_0x356c15);}})[_0x4d99('0x28')](respondWithResult(_0x7b3c1e,null))[_0x4d99('0x46')](handleError(_0x7b3c1e,null));};exports[_0x4d99('0x69')]=function(_0x221291,_0x19e1ce,_0x4e88d7){var _0x2fcff6;return db['CmList'][_0x4d99('0x48')]({'where':{'id':_0x221291[_0x4d99('0x47')]['id']},'include':[{'model':db[_0x4d99('0x6a')],'as':_0x4d99('0x6b')}]})[_0x4d99('0x28')](handleEntityNotFound(_0x19e1ce,null))['then'](function(_0x1e950e){if(_0x1e950e){_0x2fcff6=_0x1e950e;return db[_0x4d99('0x5c')][_0x4d99('0x6c')];}})[_0x4d99('0x28')](function(_0x548cb3){if(_0x548cb3){var _0x273c3b={};var _0x4298b4={};_0x4298b4[_0x4d99('0x31')]=_[_0x4d99('0x6d')](_[_0x4d99('0x32')](_0x548cb3),_['map'](_0x2fcff6[_0x4d99('0x6b')],function(_0x4b7084){return util['format'](_0x4d99('0x66'),_0x4b7084['id']);}));_0x4298b4['query']=_[_0x4d99('0x32')](_0x221291[_0x4d99('0x34')]);_0x4298b4[_0x4d99('0x3a')]=_[_0x4d99('0x53')](_0x4298b4[_0x4d99('0x31')],_0x4298b4['query']);_0x273c3b[_0x4d99('0x36')]=_[_0x4d99('0x53')](_0x4298b4[_0x4d99('0x31')],qs[_0x4d99('0x37')](_0x221291['query'][_0x4d99('0x37')]));_0x273c3b[_0x4d99('0x36')]=_0x273c3b[_0x4d99('0x36')][_0x4d99('0x38')]?_0x273c3b[_0x4d99('0x36')]:_0x4298b4[_0x4d99('0x31')];if(!_0x221291['query'][_0x4d99('0x54')](_0x4d99('0x55'))){_0x273c3b['limit']=qs[_0x4d99('0x39')](_0x221291['query'][_0x4d99('0x39')]);_0x273c3b[_0x4d99('0x22')]=qs['offset'](_0x221291[_0x4d99('0x34')]['offset']);}_0x273c3b[_0x4d99('0x56')]=qs[_0x4d99('0x57')](_0x221291[_0x4d99('0x34')]['sort']);_0x273c3b[_0x4d99('0x3d')]=qs[_0x4d99('0x3a')](_['pick'](_0x221291[_0x4d99('0x34')],_0x4298b4[_0x4d99('0x3a')]));_0x273c3b[_0x4d99('0x67')]=!![];if(_0x221291['query']['filter']){_0x273c3b[_0x4d99('0x3d')]=_[_0x4d99('0x3f')](_0x273c3b[_0x4d99('0x3d')],{'$or':_['map'](_0x273c3b[_0x4d99('0x36')],function(_0x149f35){var _0x44c779={};_0x44c779[_0x149f35]={'$like':'%'+_0x221291[_0x4d99('0x34')][_0x4d99('0x3e')]+'%'};return _0x44c779;})});}_0x273c3b=_[_0x4d99('0x3f')]({},_0x273c3b,_0x221291[_0x4d99('0x40')]);return _0x2fcff6['getContacts'](_0x273c3b);}})[_0x4d99('0x28')](function(_0x17537f){if(!_[_0x4d99('0x6e')](_0x17537f)){var _0x5931c9=toCsv(_0x17537f);var _0x3e7469=Date['now']();fs[_0x4d99('0x6f')](util[_0x4d99('0x65')](_0x4d99('0x70'),_0x2fcff6['id'],_0x3e7469),_0x5931c9);_0x19e1ce[_0x4d99('0x71')](_0x4d99('0x72'),_0x4d99('0x73')+util['format'](_0x4d99('0x74'),_0x2fcff6['id'],_0x3e7469));_0x19e1ce[_0x4d99('0x71')](_0x4d99('0x75'),'text/csv');return _0x19e1ce[_0x4d99('0x76')](util[_0x4d99('0x65')](_0x4d99('0x70'),_0x2fcff6['id'],_0x3e7469));}else{return _0x19e1ce[_0x4d99('0x1e')](0xcc);}})[_0x4d99('0x46')](handleError(_0x19e1ce,null));};exports[_0x4d99('0x77')]=function(_0xf8c859,_0x39953a,_0x12f886){var _0x377fba;delete _0xf8c859[_0x4d99('0x4a')]['id'];return db[_0x4d99('0x30')][_0x4d99('0x51')]({'where':{'id':_0xf8c859[_0x4d99('0x47')]['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x39953a,null))[_0x4d99('0x28')](function(_0x3f5563){if(_0x3f5563){return db[_0x4d99('0x78')]['transaction'](function(_0x4f6c68){return db[_0x4d99('0x6a')][_0x4d99('0x49')](_0xf8c859['body'],{'transaction':_0x4f6c68})[_0x4d99('0x28')](function(_0x31a084){_0x377fba=_0x31a084;return _0x3f5563['addCustomFields'](_0x31a084,{'transaction':_0x4f6c68});})[_0x4d99('0x28')](function(){var _0x3ba18c={'type':db[_0x4d99('0x79')][_0x4d99('0x7a')],'transaction':_0x4f6c68};switch(_0xf8c859[_0x4d99('0x4a')][_0x4d99('0x7b')]){case _0x4d99('0x7c'):_0x3ba18c['type']=db[_0x4d99('0x79')]['TEXT'];break;case'number':_0x3ba18c[_0x4d99('0x7b')]=db[_0x4d99('0x79')][_0x4d99('0x7d')];break;case _0x4d99('0x7e'):_0x3ba18c[_0x4d99('0x7b')]=db[_0x4d99('0x79')][_0x4d99('0x7f')];_0x3ba18c[_0x4d99('0x80')]=![];break;default:}return db[_0x4d99('0x78')][_0x4d99('0x81')][_0x4d99('0x82')](_0x4d99('0x83'),util[_0x4d99('0x65')]('cf_%s',_0x377fba['id']),_0x3ba18c);})[_0x4d99('0x28')](function(){return _0x377fba;});});}})[_0x4d99('0x28')](respondWithResult(_0x39953a,null))[_0x4d99('0x46')](handleError(_0x39953a,null));};exports['getCustomFields']=function(_0xa6f339,_0x39a3aa,_0x407a25){var _0x571efd={};var _0x1153dc={};var _0x2c305d;var _0x47ab63;return db[_0x4d99('0x30')][_0x4d99('0x51')]({'where':{'id':_0xa6f339[_0x4d99('0x47')]['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x39a3aa,null))[_0x4d99('0x28')](function(_0x22aaed){if(_0x22aaed){_0x2c305d=_0x22aaed;_0x1153dc[_0x4d99('0x31')]=_['keys'](db[_0x4d99('0x6a')][_0x4d99('0x6c')]);_0x1153dc[_0x4d99('0x34')]=_[_0x4d99('0x32')](_0xa6f339['query']);_0x1153dc[_0x4d99('0x3a')]=_[_0x4d99('0x53')](_0x1153dc['model'],_0x1153dc[_0x4d99('0x34')]);_0x571efd[_0x4d99('0x36')]=_[_0x4d99('0x53')](_0x1153dc['model'],qs['fields'](_0xa6f339[_0x4d99('0x34')][_0x4d99('0x37')]));_0x571efd[_0x4d99('0x36')]=_0x571efd[_0x4d99('0x36')]['length']?_0x571efd['attributes']:_0x1153dc[_0x4d99('0x31')];_0x571efd[_0x4d99('0x56')]=qs[_0x4d99('0x57')](_0xa6f339[_0x4d99('0x34')][_0x4d99('0x57')]);_0x571efd['where']=qs['filters'](_[_0x4d99('0x58')](_0xa6f339['query'],_0x1153dc['filters']));_0x571efd[_0x4d99('0x3d')]=_[_0x4d99('0x3f')](_0x571efd[_0x4d99('0x3d')],{'$or':[{'ListId':_0x22aaed['id']},{'ListId':null}]});if(_0xa6f339[_0x4d99('0x34')][_0x4d99('0x3e')]){_0x571efd['where']=_[_0x4d99('0x3f')](_0x571efd[_0x4d99('0x3d')],{'$or':_[_0x4d99('0x64')](_0x571efd[_0x4d99('0x36')],function(_0x52e1a1){var _0x4a7a8f={};_0x4a7a8f[_0x52e1a1]={'$like':'%'+_0xa6f339[_0x4d99('0x34')][_0x4d99('0x3e')]+'%'};return _0x4a7a8f;})});}_0x571efd=_[_0x4d99('0x3f')]({},_0x571efd,_0xa6f339[_0x4d99('0x40')]);return db[_0x4d99('0x6a')][_0x4d99('0x84')](_0x571efd);}})[_0x4d99('0x28')](respondWithResult(_0x39a3aa,null))[_0x4d99('0x46')](handleError(_0x39a3aa,null));};exports['addAgents']=function(_0x4a5c4d,_0x217dd3,_0x393f12){return db[_0x4d99('0x30')][_0x4d99('0x48')]({'where':{'id':_0x4a5c4d['params']['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x217dd3,null))[_0x4d99('0x28')](function(_0x492345){if(_0x492345){return _0x492345['addAgents'](_0x4a5c4d[_0x4d99('0x4a')]['ids'],_[_0x4d99('0x85')](_0x4a5c4d[_0x4d99('0x4a')],['ids','id'])||{})[_0x4d99('0x86')](function(_0x176ea2){for(var _0x29dbf4=0x0;_0x29dbf4<_0x4a5c4d[_0x4d99('0x4a')]['ids'][_0x4d99('0x38')];_0x29dbf4+=0x1){socket[_0x4d99('0x87')](_0x4d99('0x88'),{'UserId':_0x4a5c4d[_0x4d99('0x4a')][_0x4d99('0x5a')][_0x29dbf4],'CmListId':_0x4a5c4d['params']['id']});}return _0x176ea2;});}})[_0x4d99('0x28')](respondWithResult(_0x217dd3,null))[_0x4d99('0x46')](handleError(_0x217dd3,null));};exports[_0x4d99('0x89')]=function(_0x14fff8,_0x1ff5c7,_0x3cdad9){var _0x3db499;return db[_0x4d99('0x30')][_0x4d99('0x48')]({'where':{'id':_0x14fff8[_0x4d99('0x47')]['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x1ff5c7,null))['then'](function(_0x14e320){if(_0x14e320){return _0x14e320[_0x4d99('0x89')](_0x14fff8[_0x4d99('0x34')][_0x4d99('0x5a')])[_0x4d99('0x28')](function(_0x500afc){if(_[_0x4d99('0x5e')](_0x14fff8[_0x4d99('0x34')][_0x4d99('0x5a')])){for(var _0x31bc57=0x0;_0x31bc57<_0x14fff8[_0x4d99('0x34')][_0x4d99('0x5a')][_0x4d99('0x38')];_0x31bc57+=0x1){socket[_0x4d99('0x87')](_0x4d99('0x8a'),{'UserId':_0x14fff8[_0x4d99('0x34')][_0x4d99('0x5a')][_0x31bc57],'CmListId':_0x14fff8['params']['id']});}}else{socket[_0x4d99('0x87')](_0x4d99('0x8a'),{'UserId':_0x14fff8[_0x4d99('0x34')][_0x4d99('0x5a')],'CmListId':_0x14fff8[_0x4d99('0x47')]['id']});}});}})[_0x4d99('0x28')](respondWithStatusCode(_0x1ff5c7,null))[_0x4d99('0x46')](handleError(_0x1ff5c7,null));};exports[_0x4d99('0x8b')]=function(_0x1f1fae,_0x28c35a,_0xdebfe0){var _0x318865={};var _0x570052={};var _0x5120cf;var _0x475826;return db['CmList'][_0x4d99('0x51')]({'where':{'id':_0x1f1fae[_0x4d99('0x47')]['id']}})[_0x4d99('0x28')](handleEntityNotFound(_0x28c35a,null))['then'](function(_0x24e9eb){if(_0x24e9eb){_0x5120cf=_0x24e9eb;_0x570052[_0x4d99('0x31')]=_[_0x4d99('0x32')](db[_0x4d99('0x8c')][_0x4d99('0x6c')]);_0x570052[_0x4d99('0x34')]=_[_0x4d99('0x32')](_0x1f1fae[_0x4d99('0x34')]);_0x570052[_0x4d99('0x3a')]=_[_0x4d99('0x53')](_0x570052['model'],_0x570052[_0x4d99('0x34')]);_0x318865[_0x4d99('0x36')]=_['intersection'](_0x570052['model'],qs[_0x4d99('0x37')](_0x1f1fae[_0x4d99('0x34')]['fields']));_0x318865[_0x4d99('0x36')]=_0x318865[_0x4d99('0x36')][_0x4d99('0x38')]?_0x318865[_0x4d99('0x36')]:_0x570052[_0x4d99('0x31')];_0x318865['order']=qs[_0x4d99('0x57')](_0x1f1fae[_0x4d99('0x34')][_0x4d99('0x57')]);_0x318865[_0x4d99('0x3d')]=qs['filters'](_[_0x4d99('0x58')](_0x1f1fae['query'],_0x570052[_0x4d99('0x3a')]));if(_0x1f1fae[_0x4d99('0x34')]['filter']){_0x318865[_0x4d99('0x3d')]=_['merge'](_0x318865['where'],{'$or':_[_0x4d99('0x64')](_0x318865[_0x4d99('0x36')],function(_0x26c280){var _0x4a0d36={};_0x4a0d36[_0x26c280]={'$like':'%'+_0x1f1fae['query'][_0x4d99('0x3e')]+'%'};return _0x4a0d36;})});}_0x318865=_[_0x4d99('0x3f')]({},_0x318865,_0x1f1fae[_0x4d99('0x40')]);return _0x5120cf[_0x4d99('0x8b')](_0x318865);}})[_0x4d99('0x28')](function(_0x297aaa){if(_0x297aaa){_0x475826=_0x297aaa[_0x4d99('0x38')];if(!_0x1f1fae[_0x4d99('0x34')][_0x4d99('0x54')](_0x4d99('0x55'))){_0x318865['limit']=qs[_0x4d99('0x39')](_0x1f1fae[_0x4d99('0x34')][_0x4d99('0x39')]);_0x318865[_0x4d99('0x22')]=qs[_0x4d99('0x22')](_0x1f1fae['query']['offset']);}return _0x5120cf[_0x4d99('0x8b')](_0x318865);}})[_0x4d99('0x28')](function(_0x71ec97){if(_0x71ec97){return _0x71ec97?{'count':_0x475826,'rows':_0x71ec97}:null;}})[_0x4d99('0x28')](respondWithResult(_0x28c35a,null))['catch'](handleError(_0x28c35a,null));}; \ No newline at end of file +var _0x93dc=['then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','add','day','merge','filter','map','options','CmList','includeAll','findAll','catch','show','params','include','create','body','user','role','Lists','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','rawAttributes','fields','pick','rows','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','success','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','raw','getContacts','getContactsCsv','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','download','findOne','transaction','addCustomFields','Sequelize','type','text','TEXT','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','cm_contacts','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./cmList.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','update'];(function(_0x600be4,_0xb61587){var _0x586ad5=function(_0x20aaa7){while(--_0x20aaa7){_0x600be4['push'](_0x600be4['shift']());}};_0x586ad5(++_0xb61587);}(_0x93dc,0x180));var _0xc93d=function(_0x7400eb,_0x1cfb43){_0x7400eb=_0x7400eb-0x0;var _0x2ec981=_0x93dc[_0x7400eb];return _0x2ec981;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc93d('0x0'));var rimraf=require(_0xc93d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc93d('0x2'));var moment=require(_0xc93d('0x3'));var BPromise=require(_0xc93d('0x4'));var Mustache=require(_0xc93d('0x5'));var util=require(_0xc93d('0x6'));var path=require(_0xc93d('0x7'));var sox=require(_0xc93d('0x8'));var csv=require('to-csv');var ejs=require(_0xc93d('0x9'));var fs=require('fs');var _=require(_0xc93d('0xa'));var squel=require('squel');var crypto=require(_0xc93d('0xb'));var jsforce=require(_0xc93d('0xc'));var deskjs=require(_0xc93d('0xd'));var toCsv=require(_0xc93d('0xe'));var querystring=require('querystring');var Papa=require(_0xc93d('0xf'));var Redis=require('ioredis');var qs=require(_0xc93d('0x10'));var logger=require(_0xc93d('0x11'))(_0xc93d('0x12'));var utils=require(_0xc93d('0x13'));var config=require(_0xc93d('0x14'));var db=require(_0xc93d('0x15'))['db'];config[_0xc93d('0x16')]=_['defaults'](config[_0xc93d('0x16')],{'host':_0xc93d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc93d('0x16')]));require(_0xc93d('0x18'))[_0xc93d('0x19')](socket);function respondWithStatusCode(_0x58c5ff,_0x1a8e52){_0x1a8e52=_0x1a8e52||0xcc;return function(_0x25f530){if(_0x25f530){return _0x58c5ff['sendStatus'](_0x1a8e52);}return _0x58c5ff[_0xc93d('0x1a')](_0x1a8e52)[_0xc93d('0x1b')]();};}function respondWithResult(_0x22026f,_0x255da9){_0x255da9=_0x255da9||0xc8;return function(_0xf4e3a1){if(_0xf4e3a1){return _0x22026f['status'](_0x255da9)[_0xc93d('0x1c')](_0xf4e3a1);}};}function respondWithFilteredResult(_0x388c0c,_0x15bea1){return function(_0x170f06){if(_0x170f06){var _0x11f497=_0x170f06[_0xc93d('0x1d')],_0x531d06=_0x15bea1[_0xc93d('0x1e')],_0x4e76cc=_0x15bea1[_0xc93d('0x1e')]+_0x15bea1['limit'],_0x283b36;if(_0x4e76cc>=_0x11f497){_0x4e76cc=_0x11f497;_0x283b36=0xc8;}else{_0x283b36=0xce;}_0x388c0c['status'](_0x283b36);return _0x388c0c[_0xc93d('0x1f')](_0xc93d('0x20'),_0x531d06+'-'+_0x4e76cc+'/'+_0x11f497)[_0xc93d('0x1c')](_0x170f06);}return null;};}function patchUpdates(_0x380eba){return function(_0x1a5734){try{jsonpatch[_0xc93d('0x21')](_0x1a5734,_0x380eba,!![]);}catch(_0x3b21be){return BPromise[_0xc93d('0x22')](_0x3b21be);}return _0x1a5734['save']();};}function saveUpdates(_0x203853,_0x352821){return function(_0x1e09d2){if(_0x1e09d2){return _0x1e09d2[_0xc93d('0x23')](_0x203853)[_0xc93d('0x24')](function(_0x488c71){return _0x488c71;});}return null;};}function removeEntity(_0x3ed851,_0x23ea0d){return function(_0x42456f){if(_0x42456f){return _0x42456f[_0xc93d('0x25')]()['then'](function(){var _0x235977=_0x42456f[_0xc93d('0x26')]({'plain':!![]});var _0x2d832c='Lists';return db[_0xc93d('0x27')][_0xc93d('0x25')]({'where':{'type':_0x2d832c,'resourceId':_0x235977['id']}})[_0xc93d('0x24')](function(){return _0x42456f;});})[_0xc93d('0x24')](function(){_0x3ed851[_0xc93d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ad518,_0x43b1ac){return function(_0x8b4f62){if(!_0x8b4f62){_0x2ad518[_0xc93d('0x28')](0x194);}return _0x8b4f62;};}function handleError(_0x30cb2c,_0x101eb7){_0x101eb7=_0x101eb7||0x1f4;return function(_0x557d32){logger[_0xc93d('0x29')](_0x557d32[_0xc93d('0x2a')]);if(_0x557d32[_0xc93d('0x2b')]){delete _0x557d32[_0xc93d('0x2b')];}_0x30cb2c[_0xc93d('0x1a')](_0x101eb7)['send'](_0x557d32);};}exports[_0xc93d('0x2c')]=function(_0x207abf,_0x17d56b){var _0x136d01={},_0x17137e={},_0x56658c={'count':0x0,'rows':[]};var _0x26d483=db['CmList']['rawAttributes'];_0x17137e[_0xc93d('0x2d')]=_['keys'](_0x26d483);var _0x2cd4fc={'dateStart':_0x207abf[_0xc93d('0x2e')][_0xc93d('0x2f')],'dateEnd':_0x207abf[_0xc93d('0x2e')]['dateEnd']};delete _0x207abf[_0xc93d('0x2e')][_0xc93d('0x2f')];delete _0x207abf[_0xc93d('0x2e')][_0xc93d('0x30')];_0x17137e[_0xc93d('0x2e')]=_[_0xc93d('0x31')](_0x207abf[_0xc93d('0x2e')]);_0x17137e[_0xc93d('0x32')]=_[_0xc93d('0x33')](_0x17137e[_0xc93d('0x2d')],_0x17137e[_0xc93d('0x2e')]);_0x136d01[_0xc93d('0x34')]=_[_0xc93d('0x33')](_0x17137e[_0xc93d('0x2d')],qs['fields'](_0x207abf[_0xc93d('0x2e')]['fields']));_0x136d01[_0xc93d('0x34')]=_0x136d01['attributes'][_0xc93d('0x35')]?_0x136d01[_0xc93d('0x34')]:_0x17137e[_0xc93d('0x2d')];if(!_0x207abf[_0xc93d('0x2e')][_0xc93d('0x36')](_0xc93d('0x37'))){_0x136d01[_0xc93d('0x38')]=qs[_0xc93d('0x38')](_0x207abf[_0xc93d('0x2e')][_0xc93d('0x38')]);_0x136d01[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x207abf['query'][_0xc93d('0x1e')]);}_0x136d01[_0xc93d('0x39')]=qs[_0xc93d('0x3a')](_0x207abf[_0xc93d('0x2e')][_0xc93d('0x3a')]);_0x136d01[_0xc93d('0x3b')]=qs[_0xc93d('0x32')](_['pick'](_0x207abf[_0xc93d('0x2e')],_0x17137e['filters']));if(_0x2cd4fc[_0xc93d('0x2f')]){if(_0x2cd4fc[_0xc93d('0x30')]){_0x2cd4fc[_0xc93d('0x30')]=moment(_0x2cd4fc[_0xc93d('0x30')])[_0xc93d('0x3c')](0x1,_0xc93d('0x3d'));}else{_0x2cd4fc[_0xc93d('0x30')]=moment(_0x2cd4fc['dateStart'])['add'](0x1,_0xc93d('0x3d'));}_[_0xc93d('0x3e')](_0x136d01[_0xc93d('0x3b')],{'createdAt':{'$gte':_0x2cd4fc[_0xc93d('0x2f')],'$lte':_0x2cd4fc['dateEnd']}});}if(_0x207abf[_0xc93d('0x2e')][_0xc93d('0x3f')]){_0x136d01[_0xc93d('0x3b')]=_[_0xc93d('0x3e')](_0x136d01[_0xc93d('0x3b')],{'$or':_[_0xc93d('0x40')](_0x136d01[_0xc93d('0x34')],function(_0x1b08fc){var _0x561e1b={};_0x561e1b[_0x1b08fc]={'$like':'%'+_0x207abf[_0xc93d('0x2e')]['filter']+'%'};return _0x561e1b;})});}_0x136d01=_[_0xc93d('0x3e')]({},_0x136d01,_0x207abf[_0xc93d('0x41')]);var _0x5aac35={'where':_0x136d01['where']};return db[_0xc93d('0x42')]['count'](_0x5aac35)[_0xc93d('0x24')](function(_0x2e8c75){_0x56658c[_0xc93d('0x1d')]=_0x2e8c75;if(_0x207abf[_0xc93d('0x2e')][_0xc93d('0x43')]){_0x136d01['include']=[{'all':!![]}];}return db[_0xc93d('0x42')][_0xc93d('0x44')](_0x136d01);})[_0xc93d('0x24')](function(_0x361933){_0x56658c['rows']=_0x361933;return _0x56658c;})['then'](respondWithFilteredResult(_0x17d56b,_0x136d01))[_0xc93d('0x45')](handleError(_0x17d56b,null));};exports[_0xc93d('0x46')]=function(_0x18ec20,_0xe1fde0){var _0x3e2cff={'raw':![],'where':{'id':_0x18ec20[_0xc93d('0x47')]['id']}},_0x1e0e6c={};_0x1e0e6c['model']=_[_0xc93d('0x31')](db['CmList']['rawAttributes']);_0x1e0e6c[_0xc93d('0x2e')]=_[_0xc93d('0x31')](_0x18ec20[_0xc93d('0x2e')]);_0x1e0e6c[_0xc93d('0x32')]=_['intersection'](_0x1e0e6c[_0xc93d('0x2d')],_0x1e0e6c[_0xc93d('0x2e')]);_0x3e2cff[_0xc93d('0x34')]=_['intersection'](_0x1e0e6c[_0xc93d('0x2d')],qs['fields'](_0x18ec20[_0xc93d('0x2e')]['fields']));_0x3e2cff[_0xc93d('0x34')]=_0x3e2cff[_0xc93d('0x34')][_0xc93d('0x35')]?_0x3e2cff[_0xc93d('0x34')]:_0x1e0e6c['model'];if(_0x18ec20[_0xc93d('0x2e')][_0xc93d('0x43')]){_0x3e2cff[_0xc93d('0x48')]=[{'all':!![]}];}_0x3e2cff=_[_0xc93d('0x3e')]({},_0x3e2cff,_0x18ec20['options']);return db[_0xc93d('0x42')]['find'](_0x3e2cff)[_0xc93d('0x24')](handleEntityNotFound(_0xe1fde0,null))[_0xc93d('0x24')](respondWithResult(_0xe1fde0,null))[_0xc93d('0x45')](handleError(_0xe1fde0,null));};exports[_0xc93d('0x49')]=function(_0x4863be,_0x50c332){return db['CmList'][_0xc93d('0x49')](_0x4863be[_0xc93d('0x4a')],{})['then'](function(_0x462383){var _0x25453a=_0x4863be[_0xc93d('0x4b')][_0xc93d('0x26')]({'plain':!![]});if(!_0x25453a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25453a[_0xc93d('0x4c')]===_0xc93d('0x4b')){var _0x5d4c4e=_0x462383[_0xc93d('0x26')]({'plain':!![]});var _0x1d243d=_0xc93d('0x4d');return db['UserProfileSection'][_0xc93d('0x4e')]({'where':{'name':_0x1d243d,'userProfileId':_0x25453a[_0xc93d('0x4f')]},'raw':!![]})[_0xc93d('0x24')](function(_0x429d9d){if(_0x429d9d&&_0x429d9d['autoAssociation']===0x0){return db[_0xc93d('0x27')][_0xc93d('0x49')]({'name':_0x5d4c4e['name'],'resourceId':_0x5d4c4e['id'],'type':_0x429d9d[_0xc93d('0x2b')],'sectionId':_0x429d9d['id']},{})['then'](function(){return _0x462383;});}else{return _0x462383;}})[_0xc93d('0x45')](function(_0x223bf3){logger[_0xc93d('0x29')](_0xc93d('0x50'),_0x223bf3);throw _0x223bf3;});}return _0x462383;})[_0xc93d('0x24')](respondWithResult(_0x50c332,0xc9))[_0xc93d('0x45')](handleError(_0x50c332,null));};exports['update']=function(_0x3eea60,_0x19cc2f){if(_0x3eea60[_0xc93d('0x4a')]['id']){delete _0x3eea60[_0xc93d('0x4a')]['id'];}return db[_0xc93d('0x42')][_0xc93d('0x4e')]({'where':{'id':_0x3eea60[_0xc93d('0x47')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x19cc2f,null))[_0xc93d('0x24')](saveUpdates(_0x3eea60[_0xc93d('0x4a')],null))[_0xc93d('0x24')](respondWithResult(_0x19cc2f,null))[_0xc93d('0x45')](handleError(_0x19cc2f,null));};exports[_0xc93d('0x25')]=function(_0x390129,_0x261571){return db[_0xc93d('0x42')][_0xc93d('0x4e')]({'where':{'id':_0x390129[_0xc93d('0x47')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x261571,null))[_0xc93d('0x24')](removeEntity(_0x261571,null))['catch'](handleError(_0x261571,null));};exports[_0xc93d('0x51')]=function(_0x37bb6c,_0x18becc){return db['CmList'][_0xc93d('0x51')]()[_0xc93d('0x24')](respondWithResult(_0x18becc,null))['catch'](handleError(_0x18becc,null));};exports[_0xc93d('0x52')]=function(_0x47e4ff,_0x482192,_0x510a3c){if(_0x47e4ff[_0xc93d('0x4a')]['id']){delete _0x47e4ff[_0xc93d('0x4a')]['id'];}return db[_0xc93d('0x42')][_0xc93d('0x4e')]({'where':{'id':_0x47e4ff[_0xc93d('0x47')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x482192,null))[_0xc93d('0x24')](function(_0x27ff63){if(_0x27ff63){_0x47e4ff[_0xc93d('0x4a')][_0xc93d('0x53')]=_0x27ff63['id'];return db[_0xc93d('0x54')][_0xc93d('0x49')](_0x47e4ff['body']);}})[_0xc93d('0x24')](respondWithResult(_0x482192,null))[_0xc93d('0x45')](handleError(_0x482192,null));};exports[_0xc93d('0x55')]=function(_0x5c6d5c,_0x501b5f,_0x28bfa4){var _0x2a9fab={'raw':![],'where':{}};var _0x23540e={};var _0x3de854={'count':0x0,'rows':[]};return db[_0xc93d('0x42')]['findOne']({'where':{'id':_0x5c6d5c[_0xc93d('0x47')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x501b5f,null))['then'](function(_0x450075){if(_0x450075){_0x23540e[_0xc93d('0x2d')]=_['keys'](db[_0xc93d('0x54')][_0xc93d('0x56')]);_0x23540e[_0xc93d('0x2e')]=_[_0xc93d('0x31')](_0x5c6d5c[_0xc93d('0x2e')]);_0x23540e['filters']=_[_0xc93d('0x33')](_0x23540e['model'],_0x23540e[_0xc93d('0x2e')]);_0x2a9fab[_0xc93d('0x34')]=_['intersection'](_0x23540e[_0xc93d('0x2d')],qs['fields'](_0x5c6d5c[_0xc93d('0x2e')][_0xc93d('0x57')]));_0x2a9fab[_0xc93d('0x34')]=_0x2a9fab[_0xc93d('0x34')][_0xc93d('0x35')]?_0x2a9fab[_0xc93d('0x34')]:_0x23540e[_0xc93d('0x2d')];if(!_0x5c6d5c[_0xc93d('0x2e')]['hasOwnProperty'](_0xc93d('0x37'))){_0x2a9fab[_0xc93d('0x38')]=qs['limit'](_0x5c6d5c[_0xc93d('0x2e')][_0xc93d('0x38')]);_0x2a9fab[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x5c6d5c['query'][_0xc93d('0x1e')]);}_0x2a9fab[_0xc93d('0x39')]=qs['sort'](_0x5c6d5c[_0xc93d('0x2e')][_0xc93d('0x3a')]);_0x2a9fab[_0xc93d('0x3b')]=qs[_0xc93d('0x32')](_[_0xc93d('0x58')](_0x5c6d5c[_0xc93d('0x2e')],_0x23540e[_0xc93d('0x32')]));_0x2a9fab[_0xc93d('0x3b')][_0xc93d('0x53')]=_0x450075['id'];if(_0x5c6d5c[_0xc93d('0x2e')][_0xc93d('0x3f')]){_0x2a9fab['where']=_[_0xc93d('0x3e')](_0x2a9fab[_0xc93d('0x3b')],{'$or':_[_0xc93d('0x40')](_0x2a9fab[_0xc93d('0x34')],function(_0x58c45c){var _0x31c169={};_0x31c169[_0x58c45c]={'$like':'%'+_0x5c6d5c[_0xc93d('0x2e')][_0xc93d('0x3f')]+'%'};return _0x31c169;})});}_0x2a9fab=_[_0xc93d('0x3e')]({},_0x2a9fab,_0x5c6d5c[_0xc93d('0x41')]);return db[_0xc93d('0x54')][_0xc93d('0x1d')]({'where':_0x2a9fab[_0xc93d('0x3b')]})['then'](function(_0x322e1b){_0x3de854[_0xc93d('0x1d')]=_0x322e1b;if(_0x5c6d5c[_0xc93d('0x2e')][_0xc93d('0x43')]){_0x2a9fab[_0xc93d('0x48')]=[{'all':!![]}];}return db[_0xc93d('0x54')][_0xc93d('0x44')](_0x2a9fab);})[_0xc93d('0x24')](function(_0x30e24f){_0x3de854[_0xc93d('0x59')]=_0x30e24f;return _0x3de854;});}})[_0xc93d('0x24')](respondWithFilteredResult(_0x501b5f,_0x2a9fab))['catch'](handleError(_0x501b5f,null));};exports[_0xc93d('0x5a')]=function(_0x30c609,_0x52d6fd,_0x1501c9){var _0x51bfb6;return db[_0xc93d('0x42')]['find']({'where':{'id':_0x30c609['params']['id']}})['then'](handleEntityNotFound(_0x52d6fd,null))['then'](function(_0x489932){if(_0x489932){return _0x489932[_0xc93d('0x5a')](_0x30c609[_0xc93d('0x2e')][_0xc93d('0x5b')]);}})[_0xc93d('0x24')](respondWithStatusCode(_0x52d6fd,null))[_0xc93d('0x45')](handleError(_0x52d6fd,null));};exports['addContacts']=function(_0x5004fc,_0x1038d7,_0x3b9a02){return db[_0xc93d('0x42')][_0xc93d('0x4e')]({'where':{'id':_0x5004fc[_0xc93d('0x47')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x1038d7,null))[_0xc93d('0x24')](function(_0x4d3372){if(_0x4d3372){var _0x477be4=[];var _0x4c5d0b={'success':[],'errors':[]};return db[_0xc93d('0x5c')]['describe']()[_0xc93d('0x24')](function(_0x4d5cc6){if(_0x5004fc[_0xc93d('0x4a')][_0xc93d('0x5d')]&&_[_0xc93d('0x5e')](_0x5004fc['body'][_0xc93d('0x5d')])){if(_0x5004fc['body']['tags']['length']){_0x5004fc[_0xc93d('0x4a')][_0xc93d('0x5d')]=_0x5004fc[_0xc93d('0x4a')]['tags'][_0xc93d('0x5f')](';')+';';}else{_0x5004fc[_0xc93d('0x4a')]['tags']=null;}}else{_0x5004fc['body'][_0xc93d('0x5d')]=null;}if(_0x5004fc[_0xc93d('0x4a')]&&_['isArray'](_0x5004fc[_0xc93d('0x4a')])){for(var _0x1262e0=0x0;_0x1262e0<_0x5004fc['body']['length'];_0x1262e0+=0x1){_0x5004fc['body'][_0x1262e0][_0xc93d('0x53')]=_0x5004fc[_0xc93d('0x47')]['id'];_0x477be4[_0xc93d('0x60')](_0x5004fc['body'][_0x1262e0]);}return BPromise[_0xc93d('0x61')](_0x477be4,function(_0x136c34){return db[_0xc93d('0x5c')]['create'](_[_0xc93d('0x62')](_0x136c34,[_0xc93d('0x5b'),'id'])||{},{'fields':_[_0xc93d('0x31')](_0x4d5cc6),'raw':!![]})[_0xc93d('0x24')](function(_0x4a4bf6){_0x4c5d0b[_0xc93d('0x63')][_0xc93d('0x60')](_0x4a4bf6['dataValues']);})[_0xc93d('0x45')](function(_0x277964){_0x4c5d0b['errors'][_0xc93d('0x60')]({'data':_0x136c34,'error':_0x277964['message']});});})[_0xc93d('0x24')](function(_0x2c7dba){return _0x4c5d0b;})['catch'](function(_0xa7f963){return _0xa7f963;});}else{_0x1038d7[_0xc93d('0x1a')](0x190)[_0xc93d('0x1c')]({'message':_0xc93d('0x64')});}});}})['then'](respondWithResult(_0x1038d7,null))[_0xc93d('0x45')](handleError(_0x1038d7,null));};exports['getContacts']=function(_0x23ffcc,_0x132019,_0x2290bd){var _0x3cb581;return db[_0xc93d('0x42')][_0xc93d('0x4e')]({'where':{'id':_0x23ffcc[_0xc93d('0x47')]['id']},'include':[{'model':db[_0xc93d('0x65')],'as':_0xc93d('0x66')}]})[_0xc93d('0x24')](handleEntityNotFound(_0x132019,null))[_0xc93d('0x24')](function(_0xa65c85){if(_0xa65c85){_0x3cb581=_0xa65c85;return db[_0xc93d('0x5c')][_0xc93d('0x56')];}})[_0xc93d('0x24')](function(_0x386179){if(_0x386179){var _0x2264ca={};var _0x3bb49a={};_0x3bb49a[_0xc93d('0x2d')]=_[_0xc93d('0x67')](_[_0xc93d('0x31')](_0x386179),_[_0xc93d('0x40')](_0x3cb581[_0xc93d('0x66')],function(_0x5a21f1){return util['format']('cf_%d',_0x5a21f1['id']);}));_0x3bb49a[_0xc93d('0x2e')]=_[_0xc93d('0x31')](_0x23ffcc['query']);_0x3bb49a[_0xc93d('0x32')]=_[_0xc93d('0x33')](_0x3bb49a['model'],_0x3bb49a['query']);_0x2264ca[_0xc93d('0x34')]=_[_0xc93d('0x33')](_0x3bb49a[_0xc93d('0x2d')],qs['fields'](_0x23ffcc['query'][_0xc93d('0x57')]));_0x2264ca['attributes']=_0x2264ca[_0xc93d('0x34')][_0xc93d('0x35')]?_0x2264ca[_0xc93d('0x34')]:_0x3bb49a[_0xc93d('0x2d')];if(!_0x23ffcc['query']['hasOwnProperty']('nolimit')){_0x2264ca['limit']=qs['limit'](_0x23ffcc['query'][_0xc93d('0x38')]);_0x2264ca[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x23ffcc[_0xc93d('0x2e')][_0xc93d('0x1e')]);}_0x2264ca['order']=qs['sort'](_0x23ffcc[_0xc93d('0x2e')][_0xc93d('0x3a')]);_0x2264ca[_0xc93d('0x3b')]=qs['filters'](_['pick'](_0x23ffcc[_0xc93d('0x2e')],_0x3bb49a[_0xc93d('0x32')]));_0x2264ca[_0xc93d('0x68')]=!![];if(_0x23ffcc['query'][_0xc93d('0x3f')]){_0x2264ca[_0xc93d('0x3b')]=_[_0xc93d('0x3e')](_0x2264ca[_0xc93d('0x3b')],{'$or':_['map'](_0x2264ca[_0xc93d('0x34')],function(_0x4c800e){var _0x5d1589={};_0x5d1589[_0x4c800e]={'$like':'%'+_0x23ffcc['query'][_0xc93d('0x3f')]+'%'};return _0x5d1589;})});}_0x2264ca=_[_0xc93d('0x3e')]({},_0x2264ca,_0x23ffcc[_0xc93d('0x41')]);return _0x3cb581[_0xc93d('0x69')](_0x2264ca);}})[_0xc93d('0x24')](respondWithResult(_0x132019,null))[_0xc93d('0x45')](handleError(_0x132019,null));};exports[_0xc93d('0x6a')]=function(_0x56a211,_0x1973ea,_0x180829){var _0x127c5d;return db[_0xc93d('0x42')][_0xc93d('0x4e')]({'where':{'id':_0x56a211[_0xc93d('0x47')]['id']},'include':[{'model':db[_0xc93d('0x65')],'as':_0xc93d('0x66')}]})[_0xc93d('0x24')](handleEntityNotFound(_0x1973ea,null))['then'](function(_0x170a32){if(_0x170a32){_0x127c5d=_0x170a32;return db[_0xc93d('0x5c')]['rawAttributes'];}})[_0xc93d('0x24')](function(_0x3dc2db){if(_0x3dc2db){var _0x67ece4={};var _0x5e823a={};_0x5e823a[_0xc93d('0x2d')]=_[_0xc93d('0x67')](_['keys'](_0x3dc2db),_[_0xc93d('0x40')](_0x127c5d[_0xc93d('0x66')],function(_0x4602f6){return util[_0xc93d('0x6b')]('cf_%d',_0x4602f6['id']);}));_0x5e823a[_0xc93d('0x2e')]=_[_0xc93d('0x31')](_0x56a211[_0xc93d('0x2e')]);_0x5e823a['filters']=_[_0xc93d('0x33')](_0x5e823a['model'],_0x5e823a['query']);_0x67ece4[_0xc93d('0x34')]=_[_0xc93d('0x33')](_0x5e823a['model'],qs[_0xc93d('0x57')](_0x56a211[_0xc93d('0x2e')]['fields']));_0x67ece4['attributes']=_0x67ece4[_0xc93d('0x34')][_0xc93d('0x35')]?_0x67ece4[_0xc93d('0x34')]:_0x5e823a[_0xc93d('0x2d')];if(!_0x56a211[_0xc93d('0x2e')]['hasOwnProperty'](_0xc93d('0x37'))){_0x67ece4[_0xc93d('0x38')]=qs[_0xc93d('0x38')](_0x56a211[_0xc93d('0x2e')][_0xc93d('0x38')]);_0x67ece4[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x56a211[_0xc93d('0x2e')][_0xc93d('0x1e')]);}_0x67ece4[_0xc93d('0x39')]=qs['sort'](_0x56a211['query']['sort']);_0x67ece4['where']=qs[_0xc93d('0x32')](_['pick'](_0x56a211[_0xc93d('0x2e')],_0x5e823a[_0xc93d('0x32')]));_0x67ece4[_0xc93d('0x68')]=!![];if(_0x56a211['query']['filter']){_0x67ece4['where']=_[_0xc93d('0x3e')](_0x67ece4[_0xc93d('0x3b')],{'$or':_['map'](_0x67ece4['attributes'],function(_0x13c7c7){var _0x204bbc={};_0x204bbc[_0x13c7c7]={'$like':'%'+_0x56a211['query']['filter']+'%'};return _0x204bbc;})});}_0x67ece4=_[_0xc93d('0x3e')]({},_0x67ece4,_0x56a211[_0xc93d('0x41')]);return _0x127c5d[_0xc93d('0x69')](_0x67ece4);}})[_0xc93d('0x24')](function(_0x38a1e0){if(!_[_0xc93d('0x6c')](_0x38a1e0)){var _0x215a8f=toCsv(_0x38a1e0);var _0x5bad02=Date[_0xc93d('0x6d')]();fs[_0xc93d('0x6e')](util['format'](_0xc93d('0x6f'),_0x127c5d['id'],_0x5bad02),_0x215a8f);_0x1973ea[_0xc93d('0x70')](_0xc93d('0x71'),_0xc93d('0x72')+util[_0xc93d('0x6b')](_0xc93d('0x73'),_0x127c5d['id'],_0x5bad02));_0x1973ea[_0xc93d('0x70')]('Content-type','text/csv');return _0x1973ea[_0xc93d('0x74')](util[_0xc93d('0x6b')](_0xc93d('0x6f'),_0x127c5d['id'],_0x5bad02));}else{return _0x1973ea['sendStatus'](0xcc);}})['catch'](handleError(_0x1973ea,null));};exports['addCustomField']=function(_0x384244,_0x4ebd6b,_0x10b7d1){var _0x129b24;delete _0x384244['body']['id'];return db[_0xc93d('0x42')][_0xc93d('0x75')]({'where':{'id':_0x384244[_0xc93d('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ebd6b,null))['then'](function(_0x7b2a18){if(_0x7b2a18){return db['sequelize'][_0xc93d('0x76')](function(_0x405a05){return db['CmCustomField'][_0xc93d('0x49')](_0x384244['body'],{'transaction':_0x405a05})[_0xc93d('0x24')](function(_0x35e4e4){_0x129b24=_0x35e4e4;return _0x7b2a18[_0xc93d('0x77')](_0x35e4e4,{'transaction':_0x405a05});})['then'](function(){var _0x16b27e={'type':db[_0xc93d('0x78')]['TEXT'],'transaction':_0x405a05};switch(_0x384244['body'][_0xc93d('0x79')]){case _0xc93d('0x7a'):_0x16b27e[_0xc93d('0x79')]=db[_0xc93d('0x78')][_0xc93d('0x7b')];break;case _0xc93d('0x7c'):_0x16b27e['type']=db[_0xc93d('0x78')][_0xc93d('0x7d')];break;case'switch':_0x16b27e[_0xc93d('0x79')]=db[_0xc93d('0x78')][_0xc93d('0x7e')];_0x16b27e[_0xc93d('0x7f')]=![];break;default:}return db[_0xc93d('0x80')][_0xc93d('0x81')]['addColumn'](_0xc93d('0x82'),util[_0xc93d('0x6b')]('cf_%s',_0x129b24['id']),_0x16b27e);})[_0xc93d('0x24')](function(){return _0x129b24;});});}})[_0xc93d('0x24')](respondWithResult(_0x4ebd6b,null))['catch'](handleError(_0x4ebd6b,null));};exports[_0xc93d('0x83')]=function(_0x3f32ce,_0x532288,_0x2f8ab1){var _0xe67509={};var _0x534a7e={};var _0xcb4456;var _0x52d217;return db[_0xc93d('0x42')][_0xc93d('0x75')]({'where':{'id':_0x3f32ce[_0xc93d('0x47')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x532288,null))[_0xc93d('0x24')](function(_0x1d5638){if(_0x1d5638){_0xcb4456=_0x1d5638;_0x534a7e['model']=_[_0xc93d('0x31')](db[_0xc93d('0x65')]['rawAttributes']);_0x534a7e[_0xc93d('0x2e')]=_[_0xc93d('0x31')](_0x3f32ce[_0xc93d('0x2e')]);_0x534a7e[_0xc93d('0x32')]=_[_0xc93d('0x33')](_0x534a7e[_0xc93d('0x2d')],_0x534a7e[_0xc93d('0x2e')]);_0xe67509[_0xc93d('0x34')]=_[_0xc93d('0x33')](_0x534a7e[_0xc93d('0x2d')],qs[_0xc93d('0x57')](_0x3f32ce['query']['fields']));_0xe67509['attributes']=_0xe67509['attributes'][_0xc93d('0x35')]?_0xe67509[_0xc93d('0x34')]:_0x534a7e[_0xc93d('0x2d')];_0xe67509['order']=qs['sort'](_0x3f32ce[_0xc93d('0x2e')][_0xc93d('0x3a')]);_0xe67509[_0xc93d('0x3b')]=qs[_0xc93d('0x32')](_[_0xc93d('0x58')](_0x3f32ce[_0xc93d('0x2e')],_0x534a7e[_0xc93d('0x32')]));_0xe67509[_0xc93d('0x3b')]=_[_0xc93d('0x3e')](_0xe67509[_0xc93d('0x3b')],{'$or':[{'ListId':_0x1d5638['id']},{'ListId':null}]});if(_0x3f32ce[_0xc93d('0x2e')]['filter']){_0xe67509[_0xc93d('0x3b')]=_[_0xc93d('0x3e')](_0xe67509[_0xc93d('0x3b')],{'$or':_[_0xc93d('0x40')](_0xe67509[_0xc93d('0x34')],function(_0x97aff8){var _0x134a1d={};_0x134a1d[_0x97aff8]={'$like':'%'+_0x3f32ce['query'][_0xc93d('0x3f')]+'%'};return _0x134a1d;})});}_0xe67509=_[_0xc93d('0x3e')]({},_0xe67509,_0x3f32ce[_0xc93d('0x41')]);return db[_0xc93d('0x65')][_0xc93d('0x84')](_0xe67509);}})[_0xc93d('0x24')](respondWithResult(_0x532288,null))[_0xc93d('0x45')](handleError(_0x532288,null));};exports[_0xc93d('0x85')]=function(_0x50aeea,_0x4b7209,_0xaddafb){return db['CmList'][_0xc93d('0x4e')]({'where':{'id':_0x50aeea[_0xc93d('0x47')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x4b7209,null))[_0xc93d('0x24')](function(_0x2e5571){if(_0x2e5571){return _0x2e5571['addAgents'](_0x50aeea[_0xc93d('0x4a')]['ids'],_[_0xc93d('0x62')](_0x50aeea['body'],[_0xc93d('0x5b'),'id'])||{})['spread'](function(_0x3f7ac1){for(var _0x69d066=0x0;_0x69d066<_0x50aeea[_0xc93d('0x4a')]['ids']['length'];_0x69d066+=0x1){socket[_0xc93d('0x86')](_0xc93d('0x87'),{'UserId':_0x50aeea['body'][_0xc93d('0x5b')][_0x69d066],'CmListId':_0x50aeea[_0xc93d('0x47')]['id']});}return _0x3f7ac1;});}})[_0xc93d('0x24')](respondWithResult(_0x4b7209,null))[_0xc93d('0x45')](handleError(_0x4b7209,null));};exports[_0xc93d('0x88')]=function(_0x3de60b,_0x1aa418,_0x4818ef){var _0x5698f4;return db[_0xc93d('0x42')][_0xc93d('0x4e')]({'where':{'id':_0x3de60b[_0xc93d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1aa418,null))['then'](function(_0x1d7ea6){if(_0x1d7ea6){return _0x1d7ea6[_0xc93d('0x88')](_0x3de60b[_0xc93d('0x2e')][_0xc93d('0x5b')])[_0xc93d('0x24')](function(_0x2f99e4){if(_[_0xc93d('0x5e')](_0x3de60b['query']['ids'])){for(var _0x3210f9=0x0;_0x3210f9<_0x3de60b[_0xc93d('0x2e')][_0xc93d('0x5b')][_0xc93d('0x35')];_0x3210f9+=0x1){socket[_0xc93d('0x86')](_0xc93d('0x89'),{'UserId':_0x3de60b[_0xc93d('0x2e')][_0xc93d('0x5b')][_0x3210f9],'CmListId':_0x3de60b[_0xc93d('0x47')]['id']});}}else{socket[_0xc93d('0x86')](_0xc93d('0x89'),{'UserId':_0x3de60b[_0xc93d('0x2e')]['ids'],'CmListId':_0x3de60b['params']['id']});}});}})[_0xc93d('0x24')](respondWithStatusCode(_0x1aa418,null))[_0xc93d('0x45')](handleError(_0x1aa418,null));};exports['getAgents']=function(_0x3296c4,_0x5ce41c,_0x4e8dc1){var _0x36433d={};var _0x4f202c={};var _0x57d23e;var _0x5768c4;return db[_0xc93d('0x42')][_0xc93d('0x75')]({'where':{'id':_0x3296c4['params']['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x5ce41c,null))['then'](function(_0x164603){if(_0x164603){_0x57d23e=_0x164603;_0x4f202c['model']=_['keys'](db[_0xc93d('0x8a')][_0xc93d('0x56')]);_0x4f202c[_0xc93d('0x2e')]=_[_0xc93d('0x31')](_0x3296c4[_0xc93d('0x2e')]);_0x4f202c[_0xc93d('0x32')]=_[_0xc93d('0x33')](_0x4f202c[_0xc93d('0x2d')],_0x4f202c[_0xc93d('0x2e')]);_0x36433d[_0xc93d('0x34')]=_[_0xc93d('0x33')](_0x4f202c[_0xc93d('0x2d')],qs['fields'](_0x3296c4['query']['fields']));_0x36433d[_0xc93d('0x34')]=_0x36433d[_0xc93d('0x34')][_0xc93d('0x35')]?_0x36433d[_0xc93d('0x34')]:_0x4f202c[_0xc93d('0x2d')];_0x36433d[_0xc93d('0x39')]=qs['sort'](_0x3296c4['query']['sort']);_0x36433d[_0xc93d('0x3b')]=qs[_0xc93d('0x32')](_[_0xc93d('0x58')](_0x3296c4[_0xc93d('0x2e')],_0x4f202c[_0xc93d('0x32')]));if(_0x3296c4[_0xc93d('0x2e')][_0xc93d('0x3f')]){_0x36433d[_0xc93d('0x3b')]=_[_0xc93d('0x3e')](_0x36433d[_0xc93d('0x3b')],{'$or':_['map'](_0x36433d[_0xc93d('0x34')],function(_0xba4b1d){var _0x487534={};_0x487534[_0xba4b1d]={'$like':'%'+_0x3296c4[_0xc93d('0x2e')]['filter']+'%'};return _0x487534;})});}_0x36433d=_['merge']({},_0x36433d,_0x3296c4[_0xc93d('0x41')]);return _0x57d23e[_0xc93d('0x8b')](_0x36433d);}})[_0xc93d('0x24')](function(_0x2d1421){if(_0x2d1421){_0x5768c4=_0x2d1421['length'];if(!_0x3296c4[_0xc93d('0x2e')][_0xc93d('0x36')](_0xc93d('0x37'))){_0x36433d[_0xc93d('0x38')]=qs['limit'](_0x3296c4[_0xc93d('0x2e')]['limit']);_0x36433d[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x3296c4[_0xc93d('0x2e')][_0xc93d('0x1e')]);}return _0x57d23e[_0xc93d('0x8b')](_0x36433d);}})['then'](function(_0x482c14){if(_0x482c14){return _0x482c14?{'count':_0x5768c4,'rows':_0x482c14}:null;}})[_0xc93d('0x24')](respondWithResult(_0x5ce41c,null))['catch'](handleError(_0x5ce41c,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 34bada8..52d2cb2 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 _0xc1ae=['events','../../mysqldb','CmList','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x509467,_0x46eee0){var _0x1cd9d8=function(_0x52f9b7){while(--_0x52f9b7){_0x509467['push'](_0x509467['shift']());}};_0x1cd9d8(++_0x46eee0);}(_0xc1ae,0x1b8));var _0xec1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1ae[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xec1a('0x0'));var CmList=require(_0xec1a('0x1'))['db'][_0xec1a('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xec1a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xec1a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x31768e){return function(_0x4893e2,_0x4e9829,_0x24ccc3){CmListEvents[_0xec1a('0x5')](_0x31768e+':'+_0x4893e2['id'],_0x4893e2);CmListEvents['emit'](_0x31768e,_0x4893e2);_0x24ccc3(null);};}for(var e in events){if(events[_0xec1a('0x6')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xec1a('0x7')]=CmListEvents; \ No newline at end of file +var _0x3fb9=['events','../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x351a4d,_0x2d27f2){var _0x24b38c=function(_0x195c60){while(--_0x195c60){_0x351a4d['push'](_0x351a4d['shift']());}};_0x24b38c(++_0x2d27f2);}(_0x3fb9,0xb0));var _0x93fb=function(_0x3537b2,_0x4ddc62){_0x3537b2=_0x3537b2-0x0;var _0x28b332=_0x3fb9[_0x3537b2];return _0x28b332;};'use strict';var EventEmitter=require(_0x93fb('0x0'));var CmList=require(_0x93fb('0x1'))['db'][_0x93fb('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x93fb('0x3')](0x0);var events={'afterCreate':_0x93fb('0x4'),'afterUpdate':_0x93fb('0x5'),'afterDestroy':_0x93fb('0x6')};function emitEvent(_0xcb8984){return function(_0x9e6ee9,_0x538081,_0xf39095){CmListEvents['emit'](_0xcb8984+':'+_0x9e6ee9['id'],_0x9e6ee9);CmListEvents[_0x93fb('0x7')](_0xcb8984,_0x9e6ee9);_0xf39095(null);};}for(var e in events){if(events[_0x93fb('0x8')](e)){var event=events[e];CmList[_0x93fb('0x9')](e,emitEvent(event));}}module[_0x93fb('0xa')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 6cb17a7..4d7b147 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 _0x852d=['../../config/logger','moment','bluebird','request-promise','./cmList.attributes','exports','define','CmList','lodash'];(function(_0x1ac2d8,_0x2096a7){var _0x253151=function(_0x3399d3){while(--_0x3399d3){_0x1ac2d8['push'](_0x1ac2d8['shift']());}};_0x253151(++_0x2096a7);}(_0x852d,0xaa));var _0xd852=function(_0x8fad42,_0x4f7616){_0x8fad42=_0x8fad42-0x0;var _0xed300d=_0x852d[_0x8fad42];return _0xed300d;};'use strict';var _=require(_0xd852('0x0'));var util=require('util');var logger=require(_0xd852('0x1'))('api');var moment=require(_0xd852('0x2'));var BPromise=require(_0xd852('0x3'));var rp=require(_0xd852('0x4'));var attributes=require(_0xd852('0x5'));module[_0xd852('0x6')]=function(_0x42b5a1,_0x1b99ee){return _0x42b5a1[_0xd852('0x7')](_0xd852('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe763=['request-promise','CmList','cm_lists','lodash','util','../../config/logger','api','bluebird'];(function(_0x56b085,_0x4a4ce3){var _0x88b4e4=function(_0xe7d4a7){while(--_0xe7d4a7){_0x56b085['push'](_0x56b085['shift']());}};_0x88b4e4(++_0x4a4ce3);}(_0xe763,0xc3));var _0x3e76=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0xe763[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0x3e76('0x0'));var util=require(_0x3e76('0x1'));var logger=require(_0x3e76('0x2'))(_0x3e76('0x3'));var moment=require('moment');var BPromise=require(_0x3e76('0x4'));var rp=require(_0x3e76('0x5'));var attributes=require('./cmList.attributes');module['exports']=function(_0x3bcd33,_0x1511ae){return _0x3bcd33['define'](_0x3e76('0x6'),attributes,{'tableName':_0x3e76('0x7'),'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 768d1cf..382f353 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 _0x65d5=['info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','then'];(function(_0x1e0144,_0x1528e3){var _0x172a14=function(_0x3ab22e){while(--_0x3ab22e){_0x1e0144['push'](_0x1e0144['shift']());}};_0x172a14(++_0x1528e3);}(_0x65d5,0x133));var _0x565d=function(_0x5aa9ad,_0x463f02){_0x5aa9ad=_0x5aa9ad-0x0;var _0x53a6e6=_0x65d5[_0x5aa9ad];return _0x53a6e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x565d('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x565d('0x1'));var db=require(_0x565d('0x2'))['db'];var utils=require(_0x565d('0x3'));var logger=require(_0x565d('0x4'))(_0x565d('0x5'));var config=require(_0x565d('0x6'));var jayson=require(_0x565d('0x7'));var client=jayson[_0x565d('0x8')][_0x565d('0x9')]({'port':0x232a});config['redis']=_[_0x565d('0xa')](config[_0x565d('0xb')],{'host':_0x565d('0xc'),'port':0x18eb});var socket=require(_0x565d('0xd'))(new Redis(config['redis']));require(_0x565d('0xe'))[_0x565d('0xf')](socket);function respondWithRpcPromise(_0x48252b,_0x806563,_0x1604db){return new BPromise(function(_0x1f5fbb,_0xb9ae21){return client['request'](_0x48252b,_0x1604db)[_0x565d('0x10')](function(_0x444414){logger[_0x565d('0x11')](_0x565d('0x12'),_0x806563,_0x565d('0x13'));logger['debug'](_0x565d('0x14'),_0x806563,'request\x20sent',JSON[_0x565d('0x15')](_0x444414));if(_0x444414[_0x565d('0x16')]){if(_0x444414[_0x565d('0x16')][_0x565d('0x17')]===0x1f4){logger[_0x565d('0x16')](_0x565d('0x12'),_0x806563,_0x444414[_0x565d('0x16')]['message']);return _0xb9ae21(_0x444414['error'][_0x565d('0x18')]);}logger[_0x565d('0x16')](_0x565d('0x12'),_0x806563,_0x444414[_0x565d('0x16')][_0x565d('0x18')]);return _0x1f5fbb(_0x444414[_0x565d('0x16')][_0x565d('0x18')]);}else{logger[_0x565d('0x11')](_0x565d('0x12'),_0x806563,'request\x20sent');_0x1f5fbb(_0x444414[_0x565d('0x19')][_0x565d('0x18')]);}})[_0x565d('0x1a')](function(_0x55661d){logger[_0x565d('0x16')](_0x565d('0x12'),_0x806563,_0x55661d);_0xb9ae21(_0x55661d);});});} \ No newline at end of file +var _0xfff2=['CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','request','then'];(function(_0x1ed52e,_0x3733a5){var _0x5c0197=function(_0x3ae33d){while(--_0x3ae33d){_0x1ed52e['push'](_0x1ed52e['shift']());}};_0x5c0197(++_0x3733a5);}(_0xfff2,0xfb));var _0x2fff=function(_0x316872,_0x37d674){_0x316872=_0x316872-0x0;var _0x219ea2=_0xfff2[_0x316872];return _0x219ea2;};'use strict';var _=require(_0x2fff('0x0'));var util=require(_0x2fff('0x1'));var moment=require(_0x2fff('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fff('0x3'));var fs=require('fs');var Redis=require(_0x2fff('0x4'));var db=require(_0x2fff('0x5'))['db'];var utils=require(_0x2fff('0x6'));var logger=require(_0x2fff('0x7'))(_0x2fff('0x8'));var config=require(_0x2fff('0x9'));var jayson=require(_0x2fff('0xa'));var client=jayson[_0x2fff('0xb')][_0x2fff('0xc')]({'port':0x232a});config[_0x2fff('0xd')]=_['defaults'](config[_0x2fff('0xd')],{'host':_0x2fff('0xe'),'port':0x18eb});var socket=require(_0x2fff('0xf'))(new Redis(config[_0x2fff('0xd')]));require(_0x2fff('0x10'))['register'](socket);function respondWithRpcPromise(_0x5102c3,_0x2193d9,_0x1c9865){return new BPromise(function(_0x5e805e,_0x168299){return client[_0x2fff('0x11')](_0x5102c3,_0x1c9865)[_0x2fff('0x12')](function(_0x2f3406){logger['info'](_0x2fff('0x13'),_0x2193d9,_0x2fff('0x14'));logger['debug'](_0x2fff('0x15'),_0x2193d9,'request\x20sent',JSON[_0x2fff('0x16')](_0x2f3406));if(_0x2f3406[_0x2fff('0x17')]){if(_0x2f3406['error'][_0x2fff('0x18')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x2193d9,_0x2f3406[_0x2fff('0x17')][_0x2fff('0x19')]);return _0x168299(_0x2f3406[_0x2fff('0x17')]['message']);}logger['error'](_0x2fff('0x13'),_0x2193d9,_0x2f3406[_0x2fff('0x17')][_0x2fff('0x19')]);return _0x5e805e(_0x2f3406[_0x2fff('0x17')][_0x2fff('0x19')]);}else{logger[_0x2fff('0x1a')](_0x2fff('0x13'),_0x2193d9,_0x2fff('0x14'));_0x5e805e(_0x2f3406['result'][_0x2fff('0x19')]);}})['catch'](function(_0x98bd1e){logger[_0x2fff('0x17')]('CmList,\x20%s,\x20%s',_0x2193d9,_0x98bd1e);_0x168299(_0x98bd1e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 81fcdb3..4c09c7a 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 _0x7605=['remove','update','emit','removeListener','register','cmList:','./cmList.events','save'];(function(_0x21058f,_0x342d79){var _0x31255f=function(_0x28b998){while(--_0x28b998){_0x21058f['push'](_0x21058f['shift']());}};_0x31255f(++_0x342d79);}(_0x7605,0xce));var _0x5760=function(_0x394814,_0x188d0a){_0x394814=_0x394814-0x0;var _0x2ba4c1=_0x7605[_0x394814];return _0x2ba4c1;};'use strict';var CmListEvents=require(_0x5760('0x0'));var events=[_0x5760('0x1'),_0x5760('0x2'),_0x5760('0x3')];function createListener(_0x3597dd,_0x1a3a5e){return function(_0x20a6e3){_0x1a3a5e[_0x5760('0x4')](_0x3597dd,_0x20a6e3);};}function removeListener(_0x4406f9,_0xc74778){return function(){CmListEvents[_0x5760('0x5')](_0x4406f9,_0xc74778);};}exports[_0x5760('0x6')]=function(_0x3e86c2){for(var _0x307f82=0x0,_0x12d827=events['length'];_0x307f82<_0x12d827;_0x307f82++){var _0x25225d=events[_0x307f82];var _0x6c79fe=createListener(_0x5760('0x7')+_0x25225d,_0x3e86c2);CmListEvents['on'](_0x25225d,_0x6c79fe);}}; \ No newline at end of file +var _0x9112=['save','remove','update','emit','removeListener','length'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x9112,0x1bc));var _0x2911=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9112[_0x57b54c];return _0x59cc19;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x2911('0x0'),_0x2911('0x1'),_0x2911('0x2')];function createListener(_0x521204,_0x21b816){return function(_0x437891){_0x21b816[_0x2911('0x3')](_0x521204,_0x437891);};}function removeListener(_0x9bc86c,_0x1ee0ad){return function(){CmListEvents[_0x2911('0x4')](_0x9bc86c,_0x1ee0ad);};}exports['register']=function(_0x376979){for(var _0x4d9291=0x0,_0x2ac765=events[_0x2911('0x5')];_0x4d9291<_0x2ac765;_0x4d9291++){var _0x2c0822=events[_0x4d9291];var _0x517047=createListener('cmList:'+_0x2c0822,_0x376979);CmListEvents['on'](_0x2c0822,_0x517047);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c04da04..1cec26a 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 _0x6dc8=['express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','create','addDisposition','/:id/contacts','addContacts','addCustomField','put','update','delete','destroy','removeDispositions','/:id/users','removeAgents','exports','multer','path','connect-timeout'];(function(_0xe73db,_0x1b44bc){var _0x2e0a57=function(_0x135d40){while(--_0x135d40){_0xe73db['push'](_0xe73db['shift']());}};_0x2e0a57(++_0x1b44bc);}(_0x6dc8,0x168));var _0x86dc=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x6dc8[_0x5ff517];return _0x19a245;};'use strict';var multer=require(_0x86dc('0x0'));var util=require('util');var path=require(_0x86dc('0x1'));var timeout=require(_0x86dc('0x2'));var express=require(_0x86dc('0x3'));var router=express[_0x86dc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x86dc('0x5'));var config=require(_0x86dc('0x6'));var controller=require(_0x86dc('0x7'));router[_0x86dc('0x8')]('/',auth[_0x86dc('0x9')](),controller[_0x86dc('0xa')]);router[_0x86dc('0x8')](_0x86dc('0xb'),auth[_0x86dc('0x9')](),controller['describe']);router[_0x86dc('0x8')](_0x86dc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x86dc('0x8')](_0x86dc('0xd'),auth[_0x86dc('0x9')](),controller[_0x86dc('0xe')]);router['get']('/:id/contacts',auth[_0x86dc('0x9')](),controller['getContacts']);router[_0x86dc('0x8')](_0x86dc('0xf'),auth['isAuthenticated'](),controller[_0x86dc('0x10')]);router[_0x86dc('0x8')](_0x86dc('0x11'),auth[_0x86dc('0x9')](),controller[_0x86dc('0x12')]);router[_0x86dc('0x8')]('/:id/users',auth[_0x86dc('0x9')](),controller['getAgents']);router[_0x86dc('0x13')]('/',auth[_0x86dc('0x9')](),controller[_0x86dc('0x14')]);router[_0x86dc('0x13')](_0x86dc('0xd'),auth[_0x86dc('0x9')](),controller[_0x86dc('0x15')]);router[_0x86dc('0x13')](_0x86dc('0x16'),auth[_0x86dc('0x9')](),controller[_0x86dc('0x17')]);router[_0x86dc('0x13')](_0x86dc('0x11'),auth['isAuthenticated'](),controller[_0x86dc('0x18')]);router['post']('/:id/users',auth[_0x86dc('0x9')](),controller['addAgents']);router[_0x86dc('0x19')](_0x86dc('0xc'),auth['isAuthenticated'](),controller[_0x86dc('0x1a')]);router[_0x86dc('0x1b')](_0x86dc('0xc'),auth['isAuthenticated'](),controller[_0x86dc('0x1c')]);router[_0x86dc('0x1b')](_0x86dc('0xd'),auth[_0x86dc('0x9')](),controller[_0x86dc('0x1d')]);router[_0x86dc('0x1b')](_0x86dc('0x1e'),auth['isAuthenticated'](),controller[_0x86dc('0x1f')]);module[_0x86dc('0x20')]=router; \ No newline at end of file +var _0x7734=['create','addDisposition','addContacts','addCustomField','put','update','delete','destroy','removeDispositions','removeAgents','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x7734,0xca));var _0x4773=function(_0x45e6fe,_0x15cd5d){_0x45e6fe=_0x45e6fe-0x0;var _0x52dd1c=_0x7734[_0x45e6fe];return _0x52dd1c;};'use strict';var multer=require('multer');var util=require(_0x4773('0x0'));var path=require('path');var timeout=require(_0x4773('0x1'));var express=require(_0x4773('0x2'));var router=express['Router']();var auth=require(_0x4773('0x3'));var interaction=require(_0x4773('0x4'));var config=require(_0x4773('0x5'));var controller=require('./cmList.controller');router[_0x4773('0x6')]('/',auth['isAuthenticated'](),controller[_0x4773('0x7')]);router['get'](_0x4773('0x8'),auth[_0x4773('0x9')](),controller[_0x4773('0xa')]);router[_0x4773('0x6')](_0x4773('0xb'),auth[_0x4773('0x9')](),controller[_0x4773('0xc')]);router[_0x4773('0x6')](_0x4773('0xd'),auth[_0x4773('0x9')](),controller[_0x4773('0xe')]);router[_0x4773('0x6')](_0x4773('0xf'),auth[_0x4773('0x9')](),controller['getContacts']);router[_0x4773('0x6')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x4773('0x10')]);router[_0x4773('0x6')](_0x4773('0x11'),auth['isAuthenticated'](),controller[_0x4773('0x12')]);router[_0x4773('0x6')](_0x4773('0x13'),auth['isAuthenticated'](),controller[_0x4773('0x14')]);router[_0x4773('0x15')]('/',auth[_0x4773('0x9')](),controller[_0x4773('0x16')]);router[_0x4773('0x15')]('/:id/dispositions',auth[_0x4773('0x9')](),controller[_0x4773('0x17')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0x4773('0x18')]);router[_0x4773('0x15')](_0x4773('0x11'),auth[_0x4773('0x9')](),controller[_0x4773('0x19')]);router['post']('/:id/users',auth[_0x4773('0x9')](),controller['addAgents']);router[_0x4773('0x1a')]('/:id',auth[_0x4773('0x9')](),controller[_0x4773('0x1b')]);router[_0x4773('0x1c')]('/:id',auth[_0x4773('0x9')](),controller[_0x4773('0x1d')]);router['delete'](_0x4773('0xd'),auth[_0x4773('0x9')](),controller[_0x4773('0x1e')]);router['delete']('/:id/users',auth[_0x4773('0x9')](),controller[_0x4773('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a35d8f5..ae53400 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 _0x036a=['VIRTUAL','getDataValue','STRING','sequelize'];(function(_0x2c0963,_0x297774){var _0x51e459=function(_0x193c8d){while(--_0x193c8d){_0x2c0963['push'](_0x2c0963['shift']());}};_0x51e459(++_0x297774);}(_0x036a,0x9b));var _0xa036=function(_0x13c3e2,_0x4bd48a){_0x13c3e2=_0x13c3e2-0x0;var _0x5c6c17=_0x036a[_0x13c3e2];return _0x5c6c17;};'use strict';var Sequelize=require(_0xa036('0x0'));module['exports']={'name':{'type':Sequelize[_0xa036('0x1')],'get':function(_0x5bac27){return this[_0xa036('0x2')]('field');}},'field':{'type':Sequelize[_0xa036('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xa036('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb546=['STRING','sequelize','exports','getDataValue','field'];(function(_0x2e682d,_0x247a0e){var _0x224737=function(_0x4f7339){while(--_0x4f7339){_0x2e682d['push'](_0x2e682d['shift']());}};_0x224737(++_0x247a0e);}(_0xb546,0x97));var _0x6b54=function(_0x1bd7b7,_0x18e7c4){_0x1bd7b7=_0x1bd7b7-0x0;var _0x46a408=_0xb546[_0x1bd7b7];return _0x46a408;};'use strict';var Sequelize=require(_0x6b54('0x0'));module[_0x6b54('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3a9d8c){return this[_0x6b54('0x2')](_0x6b54('0x3'));}},'field':{'type':Sequelize[_0x6b54('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x6b54('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x6b54('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 90c7dfa..eb41d71 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 _0xcce8=['offset','limit','status','set','Content-Range','apply','save','then','error','stack','name','send','update','body','Condition','destroy','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x4d4bfb,_0x363bed){var _0x32ef22=function(_0x10dcbe){while(--_0x10dcbe){_0x4d4bfb['push'](_0x4d4bfb['shift']());}};_0x32ef22(++_0x363bed);}(_0xcce8,0x130));var _0x8cce=function(_0x228592,_0x19c5ca){_0x228592=_0x228592-0x0;var _0x2324bb=_0xcce8[_0x228592];return _0x2324bb;};'use strict';var pdf=require(_0x8cce('0x0'));var emlformat=require(_0x8cce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8cce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cce('0x3'));var moment=require(_0x8cce('0x4'));var BPromise=require(_0x8cce('0x5'));var Mustache=require('mustache');var util=require(_0x8cce('0x6'));var path=require(_0x8cce('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8cce('0x8'));var fs=require('fs');var _=require(_0x8cce('0x9'));var squel=require(_0x8cce('0xa'));var crypto=require(_0x8cce('0xb'));var jsforce=require(_0x8cce('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8cce('0xd'));var Papa=require(_0x8cce('0xe'));var Redis=require(_0x8cce('0xf'));var qs=require(_0x8cce('0x10'));var logger=require(_0x8cce('0x11'))(_0x8cce('0x12'));var utils=require(_0x8cce('0x13'));var config=require(_0x8cce('0x14'));var db=require(_0x8cce('0x15'))['db'];function respondWithStatusCode(_0xf28752,_0x2f55e9){_0x2f55e9=_0x2f55e9||0xcc;return function(_0x3fb537){if(_0x3fb537){return _0xf28752[_0x8cce('0x16')](_0x2f55e9);}return _0xf28752['status'](_0x2f55e9)[_0x8cce('0x17')]();};}function respondWithResult(_0x2a471c,_0x4234c0){_0x4234c0=_0x4234c0||0xc8;return function(_0x21e478){if(_0x21e478){return _0x2a471c['status'](_0x4234c0)['json'](_0x21e478);}};}function respondWithFilteredResult(_0x59a55c,_0x14f94b){return function(_0x1ce428){if(_0x1ce428){var _0x3ac5b8=_0x1ce428['count'],_0x496196=_0x14f94b['offset'],_0x311bca=_0x14f94b[_0x8cce('0x18')]+_0x14f94b[_0x8cce('0x19')],_0x589562;if(_0x311bca>=_0x3ac5b8){_0x311bca=_0x3ac5b8;_0x589562=0xc8;}else{_0x589562=0xce;}_0x59a55c[_0x8cce('0x1a')](_0x589562);return _0x59a55c[_0x8cce('0x1b')](_0x8cce('0x1c'),_0x496196+'-'+_0x311bca+'/'+_0x3ac5b8)['json'](_0x1ce428);}return null;};}function patchUpdates(_0x74cd2a){return function(_0x33feb0){try{jsonpatch[_0x8cce('0x1d')](_0x33feb0,_0x74cd2a,!![]);}catch(_0x13eab1){return BPromise['reject'](_0x13eab1);}return _0x33feb0[_0x8cce('0x1e')]();};}function saveUpdates(_0x5f0b31,_0x3a9608){return function(_0x5ee292){if(_0x5ee292){return _0x5ee292['update'](_0x5f0b31)[_0x8cce('0x1f')](function(_0x4b59ae){return _0x4b59ae;});}return null;};}function removeEntity(_0x26e468,_0x16dd61){return function(_0x5b7ce7){if(_0x5b7ce7){return _0x5b7ce7['destroy']()[_0x8cce('0x1f')](function(){_0x26e468[_0x8cce('0x1a')](0xcc)[_0x8cce('0x17')]();});}};}function handleEntityNotFound(_0x1d9d20,_0xdaa1b7){return function(_0x2be88f){if(!_0x2be88f){_0x1d9d20[_0x8cce('0x16')](0x194);}return _0x2be88f;};}function handleError(_0x5b0fff,_0x44d083){_0x44d083=_0x44d083||0x1f4;return function(_0x161f8c){logger[_0x8cce('0x20')](_0x161f8c[_0x8cce('0x21')]);if(_0x161f8c[_0x8cce('0x22')]){delete _0x161f8c[_0x8cce('0x22')];}_0x5b0fff[_0x8cce('0x1a')](_0x44d083)[_0x8cce('0x23')](_0x161f8c);};}exports[_0x8cce('0x24')]=function(_0x506213,_0x20240f){if(_0x506213['body']['id']){delete _0x506213[_0x8cce('0x25')]['id'];}return db[_0x8cce('0x26')]['find']({'where':{'id':_0x506213['params']['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x20240f,null))[_0x8cce('0x1f')](saveUpdates(_0x506213[_0x8cce('0x25')],null))[_0x8cce('0x1f')](respondWithResult(_0x20240f,null))['catch'](handleError(_0x20240f,null));};exports[_0x8cce('0x27')]=function(_0x2d565b,_0x7575a6){return db['Condition']['find']({'where':{'id':_0x2d565b[_0x8cce('0x28')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x7575a6,null))[_0x8cce('0x1f')](removeEntity(_0x7575a6,null))['catch'](handleError(_0x7575a6,null));}; \ No newline at end of file +var _0x7bdd=['end','json','count','offset','apply','reject','update','destroy','then','error','send','body','Condition','find','catch','params','html-pdf','eml-format','rimraf','request-promise','moment','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','status'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x7bdd,0x1f1));var _0xd7bd=function(_0x47beca,_0x1891d6){_0x47beca=_0x47beca-0x0;var _0x9e3685=_0x7bdd[_0x47beca];return _0x9e3685;};'use strict';var pdf=require(_0xd7bd('0x0'));var emlformat=require(_0xd7bd('0x1'));var rimraf=require(_0xd7bd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd7bd('0x3'));var moment=require(_0xd7bd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd7bd('0x5'));var path=require('path');var sox=require(_0xd7bd('0x6'));var csv=require('to-csv');var ejs=require(_0xd7bd('0x7'));var fs=require('fs');var _=require(_0xd7bd('0x8'));var squel=require(_0xd7bd('0x9'));var crypto=require('crypto');var jsforce=require(_0xd7bd('0xa'));var deskjs=require(_0xd7bd('0xb'));var toCsv=require(_0xd7bd('0xc'));var querystring=require(_0xd7bd('0xd'));var Papa=require(_0xd7bd('0xe'));var Redis=require(_0xd7bd('0xf'));var qs=require(_0xd7bd('0x10'));var logger=require(_0xd7bd('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd7bd('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48b8ee,_0x270b31){_0x270b31=_0x270b31||0xcc;return function(_0x247cda){if(_0x247cda){return _0x48b8ee[_0xd7bd('0x13')](_0x270b31);}return _0x48b8ee[_0xd7bd('0x14')](_0x270b31)[_0xd7bd('0x15')]();};}function respondWithResult(_0x3cc758,_0x201e28){_0x201e28=_0x201e28||0xc8;return function(_0x24f62b){if(_0x24f62b){return _0x3cc758[_0xd7bd('0x14')](_0x201e28)[_0xd7bd('0x16')](_0x24f62b);}};}function respondWithFilteredResult(_0x43349e,_0xe75902){return function(_0xe9f575){if(_0xe9f575){var _0x5307c2=_0xe9f575[_0xd7bd('0x17')],_0x3957cf=_0xe75902[_0xd7bd('0x18')],_0x4e0360=_0xe75902[_0xd7bd('0x18')]+_0xe75902['limit'],_0x2637c5;if(_0x4e0360>=_0x5307c2){_0x4e0360=_0x5307c2;_0x2637c5=0xc8;}else{_0x2637c5=0xce;}_0x43349e[_0xd7bd('0x14')](_0x2637c5);return _0x43349e['set']('Content-Range',_0x3957cf+'-'+_0x4e0360+'/'+_0x5307c2)[_0xd7bd('0x16')](_0xe9f575);}return null;};}function patchUpdates(_0x136695){return function(_0x3d74ec){try{jsonpatch[_0xd7bd('0x19')](_0x3d74ec,_0x136695,!![]);}catch(_0x290919){return BPromise[_0xd7bd('0x1a')](_0x290919);}return _0x3d74ec['save']();};}function saveUpdates(_0x1918c7,_0x536b9b){return function(_0x3e69f8){if(_0x3e69f8){return _0x3e69f8[_0xd7bd('0x1b')](_0x1918c7)['then'](function(_0x289aa4){return _0x289aa4;});}return null;};}function removeEntity(_0x1b9e9a,_0x38e8d7){return function(_0x29f4b1){if(_0x29f4b1){return _0x29f4b1[_0xd7bd('0x1c')]()[_0xd7bd('0x1d')](function(){_0x1b9e9a[_0xd7bd('0x14')](0xcc)[_0xd7bd('0x15')]();});}};}function handleEntityNotFound(_0x21d4cb,_0xf6c4fe){return function(_0x1680c0){if(!_0x1680c0){_0x21d4cb[_0xd7bd('0x13')](0x194);}return _0x1680c0;};}function handleError(_0x21c25a,_0x3d9d82){_0x3d9d82=_0x3d9d82||0x1f4;return function(_0x152ce7){logger[_0xd7bd('0x1e')](_0x152ce7['stack']);if(_0x152ce7['name']){delete _0x152ce7['name'];}_0x21c25a[_0xd7bd('0x14')](_0x3d9d82)[_0xd7bd('0x1f')](_0x152ce7);};}exports['update']=function(_0xcbd717,_0x43ff28){if(_0xcbd717[_0xd7bd('0x20')]['id']){delete _0xcbd717['body']['id'];}return db[_0xd7bd('0x21')][_0xd7bd('0x22')]({'where':{'id':_0xcbd717['params']['id']}})['then'](handleEntityNotFound(_0x43ff28,null))[_0xd7bd('0x1d')](saveUpdates(_0xcbd717['body'],null))[_0xd7bd('0x1d')](respondWithResult(_0x43ff28,null))[_0xd7bd('0x23')](handleError(_0x43ff28,null));};exports[_0xd7bd('0x1c')]=function(_0x37a83e,_0x3b7106){return db[_0xd7bd('0x21')][_0xd7bd('0x22')]({'where':{'id':_0x37a83e[_0xd7bd('0x24')]['id']}})[_0xd7bd('0x1d')](handleEntityNotFound(_0x3b7106,null))[_0xd7bd('0x1d')](removeEntity(_0x3b7106,null))['catch'](handleError(_0x3b7106,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index cc87de4..18e968b 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 _0x8365=['util','../../config/logger','api','moment','bluebird','request-promise','exports','Condition','tools_conditions','lodash'];(function(_0x47f8d9,_0x4822b6){var _0x34d746=function(_0x5f5cbb){while(--_0x5f5cbb){_0x47f8d9['push'](_0x47f8d9['shift']());}};_0x34d746(++_0x4822b6);}(_0x8365,0xbd));var _0x5836=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x8365[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x5836('0x0'));var util=require(_0x5836('0x1'));var logger=require(_0x5836('0x2'))(_0x5836('0x3'));var moment=require(_0x5836('0x4'));var BPromise=require(_0x5836('0x5'));var rp=require(_0x5836('0x6'));var attributes=require('./condition.attributes');module[_0x5836('0x7')]=function(_0x323901,_0x415500){return _0x323901['define'](_0x5836('0x8'),attributes,{'tableName':_0x5836('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b9e=['api','moment','bluebird','request-promise','exports','define','tools_conditions','lodash','util','../../config/logger'];(function(_0x246d03,_0x31054c){var _0x1bb7f4=function(_0x53ec2b){while(--_0x53ec2b){_0x246d03['push'](_0x246d03['shift']());}};_0x1bb7f4(++_0x31054c);}(_0x9b9e,0x197));var _0xe9b9=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9b9e[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xe9b9('0x0'));var util=require(_0xe9b9('0x1'));var logger=require(_0xe9b9('0x2'))(_0xe9b9('0x3'));var moment=require(_0xe9b9('0x4'));var BPromise=require(_0xe9b9('0x5'));var rp=require(_0xe9b9('0x6'));var attributes=require('./condition.attributes');module[_0xe9b9('0x7')]=function(_0xd2b23,_0x3b2e77){return _0xd2b23[_0xe9b9('0x8')]('Condition',attributes,{'tableName':_0xe9b9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index c2bd40b..c1a1627 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 _0xefc2=['catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result'];(function(_0x564845,_0x422e0a){var _0x3ddb33=function(_0x1a82e2){while(--_0x1a82e2){_0x564845['push'](_0x564845['shift']());}};_0x3ddb33(++_0x422e0a);}(_0xefc2,0x1cd));var _0x2efc=function(_0x41335a,_0x3a5942){_0x41335a=_0x41335a-0x0;var _0xe3483=_0xefc2[_0x41335a];return _0xe3483;};'use strict';var _=require(_0x2efc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2efc('0x1'));var rs=require(_0x2efc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2efc('0x3'))['db'];var utils=require(_0x2efc('0x4'));var logger=require(_0x2efc('0x5'))('rpc');var config=require(_0x2efc('0x6'));var jayson=require(_0x2efc('0x7'));var client=jayson[_0x2efc('0x8')][_0x2efc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdf41eb,_0x176a3e,_0x1c871c){return new BPromise(function(_0x4e3832,_0x193364){return client['request'](_0xdf41eb,_0x1c871c)[_0x2efc('0xa')](function(_0x465134){logger['info']('Condition,\x20%s,\x20%s',_0x176a3e,_0x2efc('0xb'));logger['debug'](_0x2efc('0xc'),_0x176a3e,_0x2efc('0xb'),JSON[_0x2efc('0xd')](_0x465134));if(_0x465134[_0x2efc('0xe')]){if(_0x465134[_0x2efc('0xe')][_0x2efc('0xf')]===0x1f4){logger[_0x2efc('0xe')](_0x2efc('0x10'),_0x176a3e,_0x465134[_0x2efc('0xe')][_0x2efc('0x11')]);return _0x193364(_0x465134[_0x2efc('0xe')]['message']);}logger[_0x2efc('0xe')](_0x2efc('0x10'),_0x176a3e,_0x465134[_0x2efc('0xe')]['message']);return _0x4e3832(_0x465134[_0x2efc('0xe')][_0x2efc('0x11')]);}else{logger['info'](_0x2efc('0x10'),_0x176a3e,_0x2efc('0xb'));_0x4e3832(_0x465134[_0x2efc('0x12')][_0x2efc('0x11')]);}})[_0x2efc('0x13')](function(_0x211ba1){logger[_0x2efc('0xe')]('Condition,\x20%s,\x20%s',_0x176a3e,_0x211ba1);_0x193364(_0x211ba1);});});} \ No newline at end of file +var _0xa901=['../../config/logger','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0xa901,0x177));var _0x1a90=function(_0x797cf6,_0x123170){_0x797cf6=_0x797cf6-0x0;var _0x1521f2=_0xa901[_0x797cf6];return _0x1521f2;};'use strict';var _=require(_0x1a90('0x0'));var util=require(_0x1a90('0x1'));var moment=require('moment');var BPromise=require(_0x1a90('0x2'));var rs=require(_0x1a90('0x3'));var fs=require('fs');var Redis=require(_0x1a90('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a90('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1a90('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x48fe1b,_0x4d65b7,_0x57ecc8){return new BPromise(function(_0x500303,_0x2d64e7){return client[_0x1a90('0x7')](_0x48fe1b,_0x57ecc8)[_0x1a90('0x8')](function(_0x573380){logger[_0x1a90('0x9')](_0x1a90('0xa'),_0x4d65b7,_0x1a90('0xb'));logger[_0x1a90('0xc')](_0x1a90('0xd'),_0x4d65b7,_0x1a90('0xb'),JSON[_0x1a90('0xe')](_0x573380));if(_0x573380[_0x1a90('0xf')]){if(_0x573380[_0x1a90('0xf')][_0x1a90('0x10')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x4d65b7,_0x573380['error'][_0x1a90('0x11')]);return _0x2d64e7(_0x573380[_0x1a90('0xf')][_0x1a90('0x11')]);}logger[_0x1a90('0xf')]('Condition,\x20%s,\x20%s',_0x4d65b7,_0x573380[_0x1a90('0xf')]['message']);return _0x500303(_0x573380['error'][_0x1a90('0x11')]);}else{logger[_0x1a90('0x9')](_0x1a90('0xa'),_0x4d65b7,_0x1a90('0xb'));_0x500303(_0x573380['result']['message']);}})[_0x1a90('0x12')](function(_0x3a6ddc){logger[_0x1a90('0xf')](_0x1a90('0xa'),_0x4d65b7,_0x3a6ddc);_0x2d64e7(_0x3a6ddc);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 7c9ab6b..9124c85 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 _0x1409=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','exports','multer','util','connect-timeout'];(function(_0x56d3cf,_0x20787b){var _0x5881e6=function(_0x2bd2cc){while(--_0x2bd2cc){_0x56d3cf['push'](_0x56d3cf['shift']());}};_0x5881e6(++_0x20787b);}(_0x1409,0xf9));var _0x9140=function(_0x4842a2,_0x10a4fb){_0x4842a2=_0x4842a2-0x0;var _0x2e9cf4=_0x1409[_0x4842a2];return _0x2e9cf4;};'use strict';var multer=require(_0x9140('0x0'));var util=require(_0x9140('0x1'));var path=require('path');var timeout=require(_0x9140('0x2'));var express=require(_0x9140('0x3'));var router=express['Router']();var auth=require(_0x9140('0x4'));var interaction=require(_0x9140('0x5'));var config=require(_0x9140('0x6'));var controller=require(_0x9140('0x7'));router['put'](_0x9140('0x8'),auth[_0x9140('0x9')](),controller[_0x9140('0xa')]);router['delete'](_0x9140('0x8'),auth[_0x9140('0x9')](),controller['destroy']);module[_0x9140('0xb')]=router; \ No newline at end of file +var _0x90d3=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x362ad7,_0x948800){var _0x54703b=function(_0x4153b8){while(--_0x4153b8){_0x362ad7['push'](_0x362ad7['shift']());}};_0x54703b(++_0x948800);}(_0x90d3,0x71));var _0x390d=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x90d3[_0x1780f8];return _0x33a410;};'use strict';var multer=require(_0x390d('0x0'));var util=require(_0x390d('0x1'));var path=require(_0x390d('0x2'));var timeout=require('connect-timeout');var express=require(_0x390d('0x3'));var router=express[_0x390d('0x4')]();var auth=require(_0x390d('0x5'));var interaction=require(_0x390d('0x6'));var config=require(_0x390d('0x7'));var controller=require(_0x390d('0x8'));router[_0x390d('0x9')](_0x390d('0xa'),auth[_0x390d('0xb')](),controller[_0x390d('0xc')]);router[_0x390d('0xd')](_0x390d('0xa'),auth['isAuthenticated'](),controller[_0x390d('0xe')]);module[_0x390d('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5e7f509..1c67231 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 _0x99ee=['STRING','name','sequelize','exports'];(function(_0x499d3e,_0x30b7a0){var _0x42dc97=function(_0x2d3381){while(--_0x2d3381){_0x499d3e['push'](_0x499d3e['shift']());}};_0x42dc97(++_0x30b7a0);}(_0x99ee,0x15e));var _0xe99e=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x99ee[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0xe99e('0x0'));module[_0xe99e('0x1')]={'name':{'type':Sequelize[_0xe99e('0x2')],'allowNull':![],'unique':_0xe99e('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1aed=['exports','STRING','sequelize'];(function(_0x67d080,_0x3c2b31){var _0x1ba06e=function(_0x262a8d){while(--_0x262a8d){_0x67d080['push'](_0x67d080['shift']());}};_0x1ba06e(++_0x3c2b31);}(_0x1aed,0x125));var _0xd1ae=function(_0x318d03,_0x28a574){_0x318d03=_0x318d03-0x0;var _0x5870d0=_0x1aed[_0x318d03];return _0x5870d0;};'use strict';var Sequelize=require(_0xd1ae('0x0'));module[_0xd1ae('0x1')]={'name':{'type':Sequelize[_0xd1ae('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xd1ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index dff9b3c..6d992ab 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 _0x112a=['pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','pick','getItems','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','Dashboard','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','day','add','merge','map','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','type','iframe','attrUrl','attrs','https://','custom','attrPath','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart'];(function(_0x5bd437,_0x2b4007){var _0x2e110b=function(_0x5a7e28){while(--_0x5a7e28){_0x5bd437['push'](_0x5bd437['shift']());}};_0x2e110b(++_0x2b4007);}(_0x112a,0x115));var _0xa112=function(_0x15861c,_0xc95e11){_0x15861c=_0x15861c-0x0;var _0x513bc2=_0x112a[_0x15861c];return _0x513bc2;};'use strict';var pdf=require(_0xa112('0x0'));var emlformat=require(_0xa112('0x1'));var rimraf=require(_0xa112('0x2'));var zipdir=require(_0xa112('0x3'));var jsonpatch=require(_0xa112('0x4'));var rp=require(_0xa112('0x5'));var moment=require(_0xa112('0x6'));var BPromise=require(_0xa112('0x7'));var Mustache=require(_0xa112('0x8'));var util=require(_0xa112('0x9'));var path=require(_0xa112('0xa'));var sox=require(_0xa112('0xb'));var csv=require(_0xa112('0xc'));var ejs=require(_0xa112('0xd'));var fs=require('fs');var _=require(_0xa112('0xe'));var squel=require(_0xa112('0xf'));var crypto=require(_0xa112('0x10'));var jsforce=require(_0xa112('0x11'));var deskjs=require(_0xa112('0x12'));var toCsv=require(_0xa112('0xc'));var querystring=require(_0xa112('0x13'));var Papa=require(_0xa112('0x14'));var Redis=require(_0xa112('0x15'));var qs=require('../../components/parsers/qs');var logger=require(_0xa112('0x16'))('api');var utils=require(_0xa112('0x17'));var config=require(_0xa112('0x18'));var db=require(_0xa112('0x19'))['db'];config[_0xa112('0x1a')]=_[_0xa112('0x1b')](config[_0xa112('0x1a')],{'host':_0xa112('0x1c'),'port':0x18eb});var socket=require(_0xa112('0x1d'))(new Redis(config[_0xa112('0x1a')]));require(_0xa112('0x1e'))[_0xa112('0x1f')](socket);function respondWithStatusCode(_0x2a137f,_0x3b5319){_0x3b5319=_0x3b5319||0xcc;return function(_0x9e770c){if(_0x9e770c){return _0x2a137f['sendStatus'](_0x3b5319);}return _0x2a137f[_0xa112('0x20')](_0x3b5319)[_0xa112('0x21')]();};}function respondWithResult(_0x2d04da,_0x355af1){_0x355af1=_0x355af1||0xc8;return function(_0x3271ff){if(_0x3271ff){return _0x2d04da[_0xa112('0x20')](_0x355af1)[_0xa112('0x22')](_0x3271ff);}};}function respondWithFilteredResult(_0x177d59,_0x10a9f5){return function(_0x2a0959){if(_0x2a0959){var _0x24cee9=_0x2a0959[_0xa112('0x23')],_0xae390f=_0x10a9f5[_0xa112('0x24')],_0x40ee4e=_0x10a9f5[_0xa112('0x24')]+_0x10a9f5[_0xa112('0x25')],_0x4c129f;if(_0x40ee4e>=_0x24cee9){_0x40ee4e=_0x24cee9;_0x4c129f=0xc8;}else{_0x4c129f=0xce;}_0x177d59[_0xa112('0x20')](_0x4c129f);return _0x177d59[_0xa112('0x26')](_0xa112('0x27'),_0xae390f+'-'+_0x40ee4e+'/'+_0x24cee9)[_0xa112('0x22')](_0x2a0959);}return null;};}function patchUpdates(_0x39df31){return function(_0x2a7071){try{jsonpatch['apply'](_0x2a7071,_0x39df31,!![]);}catch(_0x55d05c){return BPromise[_0xa112('0x28')](_0x55d05c);}return _0x2a7071[_0xa112('0x29')]();};}function saveUpdates(_0x504500,_0x35b39c){return function(_0x2003ec){if(_0x2003ec){return _0x2003ec[_0xa112('0x2a')](_0x504500)[_0xa112('0x2b')](function(_0x55a0d9){return _0x55a0d9;});}return null;};}function removeEntity(_0xf6a48d,_0x9fc99){return function(_0x196d8b){if(_0x196d8b){return _0x196d8b[_0xa112('0x2c')]()['then'](function(){var _0x49ec06=_0x196d8b['get']({'plain':!![]});var _0x27a849='CustomDashboards';return db[_0xa112('0x2d')][_0xa112('0x2c')]({'where':{'type':_0x27a849,'resourceId':_0x49ec06['id']}})[_0xa112('0x2b')](function(){return _0x196d8b;});})['then'](function(){_0xf6a48d[_0xa112('0x20')](0xcc)[_0xa112('0x21')]();});}};}function handleEntityNotFound(_0x4f68c2,_0x52a3c0){return function(_0x4cd0e8){if(!_0x4cd0e8){_0x4f68c2[_0xa112('0x2e')](0x194);}return _0x4cd0e8;};}function handleError(_0x139d00,_0x48fb0a){_0x48fb0a=_0x48fb0a||0x1f4;return function(_0x3b6bf4){logger[_0xa112('0x2f')](_0x3b6bf4[_0xa112('0x30')]);if(_0x3b6bf4[_0xa112('0x31')]){delete _0x3b6bf4[_0xa112('0x31')];}_0x139d00['status'](_0x48fb0a)[_0xa112('0x32')](_0x3b6bf4);};}exports[_0xa112('0x33')]=function(_0x5e6cc2,_0x3046bf){var _0x2ad5a7={},_0xc95dfa={},_0xbe1ac7={'count':0x0,'rows':[]};var _0x2faba8=db[_0xa112('0x34')][_0xa112('0x35')];_0xc95dfa['model']=_['keys'](_0x2faba8);var _0x41c39d={'dateStart':_0x5e6cc2[_0xa112('0x36')][_0xa112('0x37')],'dateEnd':_0x5e6cc2['query'][_0xa112('0x38')]};delete _0x5e6cc2[_0xa112('0x36')][_0xa112('0x37')];delete _0x5e6cc2['query'][_0xa112('0x38')];_0xc95dfa[_0xa112('0x36')]=_[_0xa112('0x39')](_0x5e6cc2[_0xa112('0x36')]);_0xc95dfa[_0xa112('0x3a')]=_[_0xa112('0x3b')](_0xc95dfa[_0xa112('0x3c')],_0xc95dfa[_0xa112('0x36')]);_0x2ad5a7[_0xa112('0x3d')]=_[_0xa112('0x3b')](_0xc95dfa[_0xa112('0x3c')],qs[_0xa112('0x3e')](_0x5e6cc2[_0xa112('0x36')][_0xa112('0x3e')]));_0x2ad5a7[_0xa112('0x3d')]=_0x2ad5a7[_0xa112('0x3d')][_0xa112('0x3f')]?_0x2ad5a7[_0xa112('0x3d')]:_0xc95dfa[_0xa112('0x3c')];if(!_0x5e6cc2['query'][_0xa112('0x40')](_0xa112('0x41'))){_0x2ad5a7['limit']=qs[_0xa112('0x25')](_0x5e6cc2[_0xa112('0x36')]['limit']);_0x2ad5a7['offset']=qs[_0xa112('0x24')](_0x5e6cc2[_0xa112('0x36')][_0xa112('0x24')]);}_0x2ad5a7[_0xa112('0x42')]=qs[_0xa112('0x43')](_0x5e6cc2['query'][_0xa112('0x43')]);_0x2ad5a7[_0xa112('0x44')]=qs[_0xa112('0x3a')](_['pick'](_0x5e6cc2[_0xa112('0x36')],_0xc95dfa[_0xa112('0x3a')]));if(_0x41c39d['dateStart']){if(_0x41c39d[_0xa112('0x38')]){_0x41c39d['dateEnd']=moment(_0x41c39d[_0xa112('0x38')])['add'](0x1,_0xa112('0x45'));}else{_0x41c39d['dateEnd']=moment(_0x41c39d['dateStart'])[_0xa112('0x46')](0x1,_0xa112('0x45'));}_[_0xa112('0x47')](_0x2ad5a7[_0xa112('0x44')],{'createdAt':{'$gte':_0x41c39d[_0xa112('0x37')],'$lte':_0x41c39d['dateEnd']}});}if(_0x5e6cc2[_0xa112('0x36')]['filter']){_0x2ad5a7[_0xa112('0x44')]=_['merge'](_0x2ad5a7[_0xa112('0x44')],{'$or':_[_0xa112('0x48')](_0x2ad5a7['attributes'],function(_0x510aae){var _0x515ad6={};_0x515ad6[_0x510aae]={'$like':'%'+_0x5e6cc2['query'][_0xa112('0x49')]+'%'};return _0x515ad6;})});}_0x2ad5a7=_['merge']({},_0x2ad5a7,_0x5e6cc2['options']);var _0x4a83e0={'where':_0x2ad5a7[_0xa112('0x44')]};return db['Dashboard']['count'](_0x4a83e0)[_0xa112('0x2b')](function(_0x4c1563){_0xbe1ac7[_0xa112('0x23')]=_0x4c1563;if(_0x5e6cc2[_0xa112('0x36')][_0xa112('0x4a')]){_0x2ad5a7[_0xa112('0x4b')]=[{'all':!![]}];}return db[_0xa112('0x34')][_0xa112('0x4c')](_0x2ad5a7);})[_0xa112('0x2b')](function(_0x3b9953){_0xbe1ac7[_0xa112('0x4d')]=_0x3b9953;return _0xbe1ac7;})[_0xa112('0x2b')](respondWithFilteredResult(_0x3046bf,_0x2ad5a7))[_0xa112('0x4e')](handleError(_0x3046bf,null));};exports[_0xa112('0x4f')]=function(_0x4a5ecc,_0x54f0c9){var _0x3c1267={'raw':![],'where':{'id':_0x4a5ecc[_0xa112('0x50')]['id']}},_0x22256b={};_0x22256b[_0xa112('0x3c')]=_['keys'](db[_0xa112('0x34')]['rawAttributes']);_0x22256b[_0xa112('0x36')]=_[_0xa112('0x39')](_0x4a5ecc[_0xa112('0x36')]);_0x22256b[_0xa112('0x3a')]=_['intersection'](_0x22256b['model'],_0x22256b[_0xa112('0x36')]);_0x3c1267[_0xa112('0x3d')]=_[_0xa112('0x3b')](_0x22256b[_0xa112('0x3c')],qs[_0xa112('0x3e')](_0x4a5ecc[_0xa112('0x36')][_0xa112('0x3e')]));_0x3c1267[_0xa112('0x3d')]=_0x3c1267[_0xa112('0x3d')][_0xa112('0x3f')]?_0x3c1267[_0xa112('0x3d')]:_0x22256b[_0xa112('0x3c')];if(_0x4a5ecc[_0xa112('0x36')][_0xa112('0x4a')]){_0x3c1267[_0xa112('0x4b')]=[{'all':!![]}];}_0x3c1267=_['merge']({},_0x3c1267,_0x4a5ecc['options']);return db[_0xa112('0x34')][_0xa112('0x51')](_0x3c1267)['then'](handleEntityNotFound(_0x54f0c9,null))[_0xa112('0x2b')](respondWithResult(_0x54f0c9,null))[_0xa112('0x4e')](handleError(_0x54f0c9,null));};exports[_0xa112('0x52')]=function(_0x26c7ec,_0x4ad225){return db[_0xa112('0x34')][_0xa112('0x52')](_0x26c7ec[_0xa112('0x53')],{})[_0xa112('0x2b')](function(_0x38daad){var _0x1df3b2=_0x26c7ec[_0xa112('0x54')][_0xa112('0x55')]({'plain':!![]});if(!_0x1df3b2)throw new Error(_0xa112('0x56'));if(_0x1df3b2[_0xa112('0x57')]===_0xa112('0x54')){var _0x185786=_0x38daad[_0xa112('0x55')]({'plain':!![]});var _0x10534e=_0xa112('0x58');return db[_0xa112('0x59')]['find']({'where':{'name':_0x10534e,'userProfileId':_0x1df3b2[_0xa112('0x5a')]},'raw':!![]})[_0xa112('0x2b')](function(_0x439f91){if(_0x439f91&&_0x439f91[_0xa112('0x5b')]===0x0){return db[_0xa112('0x2d')][_0xa112('0x52')]({'name':_0x185786[_0xa112('0x31')],'resourceId':_0x185786['id'],'type':_0x439f91[_0xa112('0x31')],'sectionId':_0x439f91['id']},{})[_0xa112('0x2b')](function(){return _0x38daad;});}else{return _0x38daad;}})['catch'](function(_0x1d38ac){logger['error'](_0xa112('0x5c'),_0x1d38ac);throw _0x1d38ac;});}return _0x38daad;})['then'](respondWithResult(_0x4ad225,0xc9))[_0xa112('0x4e')](handleError(_0x4ad225,null));};exports[_0xa112('0x5d')]=function(_0x323024,_0x30e4ae){var _0x49fd7c={'raw':![],'where':{'id':_0x323024[_0xa112('0x50')]['id']}},_0x3f7252={};_0x3f7252[_0xa112('0x3c')]=_['keys'](db[_0xa112('0x34')][_0xa112('0x35')]);_0x49fd7c[_0xa112('0x3d')]=_[_0xa112('0x3b')](_0x3f7252[_0xa112('0x3c')],qs['fields'](_0x323024['query'][_0xa112('0x3e')]));_0x49fd7c[_0xa112('0x3d')]=_0x49fd7c[_0xa112('0x3d')][_0xa112('0x3f')]?_0x49fd7c[_0xa112('0x3d')]:_0x3f7252[_0xa112('0x3c')];if(_0x323024[_0xa112('0x36')][_0xa112('0x4a')]){_0x49fd7c[_0xa112('0x4b')]=[{'all':!![]}];}_0x49fd7c=_[_0xa112('0x47')]({},_0x49fd7c,_0x323024[_0xa112('0x5e')]);return db[_0xa112('0x34')][_0xa112('0x51')](_0x49fd7c)[_0xa112('0x2b')](handleEntityNotFound(_0x30e4ae,null))[_0xa112('0x2b')](function(_0x23c235){if(_0x23c235){var _0x537473=_0x23c235[_0xa112('0x55')]({'plain':!![]});_0x537473=qs[_0xa112('0x5f')](_0x537473,['id',_0xa112('0x60'),_0xa112('0x61')]);_0x323024[_0xa112('0x53')]=_[_0xa112('0x5f')](_0x323024['body'],['id',_0xa112('0x60'),_0xa112('0x61')]);return db[_0xa112('0x34')][_0xa112('0x52')](_['merge'](_0x537473,_0x323024[_0xa112('0x53')]),{'include':_0x323024[_0xa112('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0xa112('0x2b')](function(_0x3cbde4){var _0x52e94c=_0x323024[_0xa112('0x54')]['get']({'plain':!![]});if(!_0x52e94c)throw new Error(_0xa112('0x56'));if(_0x52e94c[_0xa112('0x57')]==='user'){var _0x393667=_0x3cbde4[_0xa112('0x55')]({'plain':!![]});var _0x589ec8=_0xa112('0x58');return db[_0xa112('0x59')]['find']({'where':{'name':_0x589ec8,'userProfileId':_0x52e94c['userProfileId']},'raw':!![]})[_0xa112('0x2b')](function(_0x105512){if(_0x105512&&_0x105512[_0xa112('0x5b')]===0x0){return db['UserProfileResource'][_0xa112('0x52')]({'name':_0x393667[_0xa112('0x31')],'resourceId':_0x393667['id'],'type':_0x105512[_0xa112('0x31')],'sectionId':_0x105512['id']},{})[_0xa112('0x2b')](function(){return _0x3cbde4;});}else{return _0x3cbde4;}})[_0xa112('0x4e')](function(_0x4db287){logger[_0xa112('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4db287);throw _0x4db287;});}return _0x3cbde4;});}})[_0xa112('0x2b')](respondWithResult(_0x30e4ae,0xc9))['catch'](handleError(_0x30e4ae,null));};exports[_0xa112('0x2a')]=function(_0x49cfdb,_0x55604d){if(_0x49cfdb['body']['id']){delete _0x49cfdb[_0xa112('0x53')]['id'];}return db[_0xa112('0x34')][_0xa112('0x51')]({'where':{'id':_0x49cfdb[_0xa112('0x50')]['id']}})[_0xa112('0x2b')](handleEntityNotFound(_0x55604d,null))['then'](saveUpdates(_0x49cfdb[_0xa112('0x53')],null))[_0xa112('0x2b')](respondWithResult(_0x55604d,null))[_0xa112('0x4e')](handleError(_0x55604d,null));};exports[_0xa112('0x2c')]=function(_0x563600,_0x4025c0){return db[_0xa112('0x34')][_0xa112('0x51')]({'where':{'id':_0x563600[_0xa112('0x50')]['id']}})['then'](handleEntityNotFound(_0x4025c0,null))[_0xa112('0x2b')](removeEntity(_0x4025c0,null))['catch'](handleError(_0x4025c0,null));};function widgetAttributes(_0x4bdecd){try{switch(_0x4bdecd[_0xa112('0x62')]){case _0xa112('0x63'):return[{'name':_0xa112('0x64'),'value':_0x4bdecd['attrUrl']||(_0x4bdecd['attrs']&&_0x4bdecd[_0xa112('0x65')][0x0]?_0x4bdecd[_0xa112('0x65')][0x0]['value']:undefined)||_0xa112('0x66')}];case _0xa112('0x67'):return[{'name':_0xa112('0x68'),'value':_0x4bdecd[_0xa112('0x68')]||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x0]?_0x4bdecd[_0xa112('0x65')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xa112('0x69'),'value':_0x4bdecd[_0xa112('0x69')]||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x0]?_0x4bdecd[_0xa112('0x65')][0x0][_0xa112('0x6a')]:undefined)||_0xa112('0x6b')},{'name':_0xa112('0x6c'),'value':_0x4bdecd['attrTimezone']||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x1]?_0x4bdecd[_0xa112('0x65')][0x1]['value']:undefined)||_0xa112('0x6d')},{'name':_0xa112('0x6e'),'value':_0x4bdecd['attrFontSize']||(_0x4bdecd['attrs']&&_0x4bdecd[_0xa112('0x65')][0x2]?_0x4bdecd[_0xa112('0x65')][0x2][_0xa112('0x6a')]:undefined)||0xc}];case _0xa112('0x6f'):return[{'name':'attrMetric','value':_0x4bdecd[_0xa112('0x70')]||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x0]?_0x4bdecd[_0xa112('0x65')][0x0][_0xa112('0x6a')]:undefined)||_0xa112('0x71')},{'name':_0xa112('0x72'),'value':_0x4bdecd['attrVoiceQueues']||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x1]?_0x4bdecd[_0xa112('0x65')][0x1]['value']:undefined)||[]},{'name':_0xa112('0x6e'),'value':_0x4bdecd[_0xa112('0x6e')]||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x2]?_0x4bdecd['attrs'][0x2]['value']:undefined)||0x14}];case _0xa112('0x73'):case _0xa112('0x74'):return[{'name':_0xa112('0x75'),'value':_0x4bdecd[_0xa112('0x75')]||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x0]?_0x4bdecd[_0xa112('0x65')][0x0][_0xa112('0x6a')]:undefined)||_0xa112('0x71')},{'name':'attrSerie2','value':_0x4bdecd[_0xa112('0x76')]||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x1]?_0x4bdecd[_0xa112('0x65')][0x1]['value']:undefined)||null},{'name':_0xa112('0x77'),'value':_0x4bdecd[_0xa112('0x77')]||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x2]?_0x4bdecd['attrs'][0x2][_0xa112('0x6a')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4bdecd[_0xa112('0x72')]||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x3]?_0x4bdecd[_0xa112('0x65')][0x3][_0xa112('0x6a')]:undefined)||[]}];case _0xa112('0x78'):return[{'name':_0xa112('0x79'),'type':_0x4bdecd[_0xa112('0x7a')]||null,'value':_0x4bdecd['attrReport']||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x0]?_0x4bdecd['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4bdecd[_0xa112('0x7b')]||(_0x4bdecd[_0xa112('0x65')]&&_0x4bdecd[_0xa112('0x65')][0x1]?_0x4bdecd[_0xa112('0x65')][0x1][_0xa112('0x6a')]:undefined)||0x0}];default:return[];}}catch(_0x4e618c){logger[_0xa112('0x2f')](_0xa112('0x7c'),JSON[_0xa112('0x7d')](_0x4e618c));return[];}}exports[_0xa112('0x7e')]=function(_0x146863,_0x2f952d,_0x4f18bb){if(_0x146863[_0xa112('0x53')]['id']){delete _0x146863[_0xa112('0x53')]['id'];}return db[_0xa112('0x34')][_0xa112('0x51')]({'where':{'id':_0x146863[_0xa112('0x50')]['id']}})[_0xa112('0x2b')](handleEntityNotFound(_0x2f952d,null))[_0xa112('0x2b')](function(_0x4519cf){if(_0x4519cf){_0x146863[_0xa112('0x53')]['DashboardId']=_0x4519cf['id'];_0x146863['body'][_0xa112('0x65')]=widgetAttributes(_0x146863[_0xa112('0x53')]);return db[_0xa112('0x7f')][_0xa112('0x52')](_0x146863[_0xa112('0x53')]);}})[_0xa112('0x2b')](respondWithResult(_0x2f952d,null))[_0xa112('0x4e')](handleError(_0x2f952d,null));};exports['getItems']=function(_0x5c0b3f,_0xfeeccf,_0x117985){var _0x4b9efb={};var _0x2d007b={};var _0x16ed0a;var _0x3e4ad7;return db[_0xa112('0x34')][_0xa112('0x80')]({'where':{'id':_0x5c0b3f[_0xa112('0x50')]['id']}})['then'](handleEntityNotFound(_0xfeeccf,null))[_0xa112('0x2b')](function(_0x101b36){if(_0x101b36){_0x16ed0a=_0x101b36;_0x2d007b[_0xa112('0x3c')]=_[_0xa112('0x39')](db[_0xa112('0x7f')][_0xa112('0x35')]);_0x2d007b[_0xa112('0x36')]=_[_0xa112('0x39')](_0x5c0b3f['query']);_0x2d007b['filters']=_[_0xa112('0x3b')](_0x2d007b['model'],_0x2d007b[_0xa112('0x36')]);_0x4b9efb[_0xa112('0x3d')]=_[_0xa112('0x3b')](_0x2d007b['model'],qs['fields'](_0x5c0b3f[_0xa112('0x36')][_0xa112('0x3e')]));_0x4b9efb[_0xa112('0x3d')]=_0x4b9efb[_0xa112('0x3d')]['length']?_0x4b9efb[_0xa112('0x3d')]:_0x2d007b[_0xa112('0x3c')];_0x4b9efb[_0xa112('0x42')]=qs['sort'](_0x5c0b3f[_0xa112('0x36')][_0xa112('0x43')]);_0x4b9efb['where']=qs[_0xa112('0x3a')](_[_0xa112('0x81')](_0x5c0b3f[_0xa112('0x36')],_0x2d007b[_0xa112('0x3a')]));if(_0x5c0b3f[_0xa112('0x36')][_0xa112('0x49')]){_0x4b9efb[_0xa112('0x44')]=_[_0xa112('0x47')](_0x4b9efb[_0xa112('0x44')],{'$or':_[_0xa112('0x48')](_0x4b9efb[_0xa112('0x3d')],function(_0xaff31f){var _0x482948={};_0x482948[_0xaff31f]={'$like':'%'+_0x5c0b3f[_0xa112('0x36')][_0xa112('0x49')]+'%'};return _0x482948;})});}_0x4b9efb=_[_0xa112('0x47')]({},_0x4b9efb,_0x5c0b3f[_0xa112('0x5e')]);return _0x16ed0a[_0xa112('0x82')](_0x4b9efb);}})['then'](function(_0x475f88){if(_0x475f88){_0x3e4ad7=_0x475f88['length'];if(!_0x5c0b3f['query'][_0xa112('0x40')](_0xa112('0x41'))){_0x4b9efb[_0xa112('0x25')]=qs[_0xa112('0x25')](_0x5c0b3f[_0xa112('0x36')][_0xa112('0x25')]);_0x4b9efb[_0xa112('0x24')]=qs[_0xa112('0x24')](_0x5c0b3f[_0xa112('0x36')]['offset']);}return _0x16ed0a[_0xa112('0x82')](_0x4b9efb);}})[_0xa112('0x2b')](function(_0x1b518b){if(_0x1b518b){return _0x1b518b?{'count':_0x3e4ad7,'rows':_0x1b518b}:null;}})[_0xa112('0x2b')](respondWithResult(_0xfeeccf,null))[_0xa112('0x4e')](handleError(_0xfeeccf,null));}; \ No newline at end of file +var _0xbfa6=['to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./dashboard.socket','register','sendStatus','end','status','json','count','offset','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','Dashboard','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','add','day','merge','where','map','filter','options','include','rows','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','body','updatedAt','CustomDashboards','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','html-pdf','eml-format','request-promise','moment','bluebird','util','path','sox'];(function(_0x2f3846,_0x5321ba){var _0x204bd6=function(_0x1e7131){while(--_0x1e7131){_0x2f3846['push'](_0x2f3846['shift']());}};_0x204bd6(++_0x5321ba);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x4fb5ce,_0x3a79f9){_0x4fb5ce=_0x4fb5ce-0x0;var _0x3c07b5=_0xbfa6[_0x4fb5ce];return _0x3c07b5;};'use strict';var pdf=require(_0x6bfa('0x0'));var emlformat=require(_0x6bfa('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bfa('0x2'));var moment=require(_0x6bfa('0x3'));var BPromise=require(_0x6bfa('0x4'));var Mustache=require('mustache');var util=require(_0x6bfa('0x5'));var path=require(_0x6bfa('0x6'));var sox=require(_0x6bfa('0x7'));var csv=require(_0x6bfa('0x8'));var ejs=require(_0x6bfa('0x9'));var fs=require('fs');var _=require(_0x6bfa('0xa'));var squel=require(_0x6bfa('0xb'));var crypto=require('crypto');var jsforce=require(_0x6bfa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6bfa('0x8'));var querystring=require(_0x6bfa('0xd'));var Papa=require(_0x6bfa('0xe'));var Redis=require(_0x6bfa('0xf'));var qs=require(_0x6bfa('0x10'));var logger=require(_0x6bfa('0x11'))(_0x6bfa('0x12'));var utils=require(_0x6bfa('0x13'));var config=require(_0x6bfa('0x14'));var db=require(_0x6bfa('0x15'))['db'];config['redis']=_[_0x6bfa('0x16')](config[_0x6bfa('0x17')],{'host':_0x6bfa('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6bfa('0x17')]));require(_0x6bfa('0x19'))[_0x6bfa('0x1a')](socket);function respondWithStatusCode(_0x279ebd,_0x2e8b3c){_0x2e8b3c=_0x2e8b3c||0xcc;return function(_0x5d2c05){if(_0x5d2c05){return _0x279ebd[_0x6bfa('0x1b')](_0x2e8b3c);}return _0x279ebd['status'](_0x2e8b3c)[_0x6bfa('0x1c')]();};}function respondWithResult(_0x255c89,_0x18512b){_0x18512b=_0x18512b||0xc8;return function(_0x305210){if(_0x305210){return _0x255c89[_0x6bfa('0x1d')](_0x18512b)[_0x6bfa('0x1e')](_0x305210);}};}function respondWithFilteredResult(_0x331351,_0x1c82da){return function(_0x118f06){if(_0x118f06){var _0x5e8b88=_0x118f06[_0x6bfa('0x1f')],_0xe94ad2=_0x1c82da[_0x6bfa('0x20')],_0x49a835=_0x1c82da[_0x6bfa('0x20')]+_0x1c82da['limit'],_0x1b4c11;if(_0x49a835>=_0x5e8b88){_0x49a835=_0x5e8b88;_0x1b4c11=0xc8;}else{_0x1b4c11=0xce;}_0x331351['status'](_0x1b4c11);return _0x331351['set']('Content-Range',_0xe94ad2+'-'+_0x49a835+'/'+_0x5e8b88)[_0x6bfa('0x1e')](_0x118f06);}return null;};}function patchUpdates(_0x5f27b6){return function(_0x410b56){try{jsonpatch[_0x6bfa('0x21')](_0x410b56,_0x5f27b6,!![]);}catch(_0x26f925){return BPromise[_0x6bfa('0x22')](_0x26f925);}return _0x410b56[_0x6bfa('0x23')]();};}function saveUpdates(_0x97d6ef,_0x4d4625){return function(_0x241318){if(_0x241318){return _0x241318[_0x6bfa('0x24')](_0x97d6ef)[_0x6bfa('0x25')](function(_0x3728fa){return _0x3728fa;});}return null;};}function removeEntity(_0x201c56,_0xa24a21){return function(_0x213602){if(_0x213602){return _0x213602[_0x6bfa('0x26')]()[_0x6bfa('0x25')](function(){var _0x4db75d=_0x213602[_0x6bfa('0x27')]({'plain':!![]});var _0xa68566='CustomDashboards';return db[_0x6bfa('0x28')][_0x6bfa('0x26')]({'where':{'type':_0xa68566,'resourceId':_0x4db75d['id']}})[_0x6bfa('0x25')](function(){return _0x213602;});})[_0x6bfa('0x25')](function(){_0x201c56[_0x6bfa('0x1d')](0xcc)[_0x6bfa('0x1c')]();});}};}function handleEntityNotFound(_0x47bab5,_0x4c0b26){return function(_0xccc232){if(!_0xccc232){_0x47bab5[_0x6bfa('0x1b')](0x194);}return _0xccc232;};}function handleError(_0xcf2b43,_0x2b0171){_0x2b0171=_0x2b0171||0x1f4;return function(_0x4291e6){logger[_0x6bfa('0x29')](_0x4291e6[_0x6bfa('0x2a')]);if(_0x4291e6[_0x6bfa('0x2b')]){delete _0x4291e6[_0x6bfa('0x2b')];}_0xcf2b43[_0x6bfa('0x1d')](_0x2b0171)[_0x6bfa('0x2c')](_0x4291e6);};}exports['index']=function(_0x13ff32,_0x1bf435){var _0x5633d0={},_0x340eaa={},_0x498683={'count':0x0,'rows':[]};var _0x15cd72=db[_0x6bfa('0x2d')][_0x6bfa('0x2e')];_0x340eaa[_0x6bfa('0x2f')]=_[_0x6bfa('0x30')](_0x15cd72);var _0x23ab8a={'dateStart':_0x13ff32['query'][_0x6bfa('0x31')],'dateEnd':_0x13ff32[_0x6bfa('0x32')][_0x6bfa('0x33')]};delete _0x13ff32[_0x6bfa('0x32')][_0x6bfa('0x31')];delete _0x13ff32[_0x6bfa('0x32')][_0x6bfa('0x33')];_0x340eaa[_0x6bfa('0x32')]=_[_0x6bfa('0x30')](_0x13ff32['query']);_0x340eaa[_0x6bfa('0x34')]=_[_0x6bfa('0x35')](_0x340eaa['model'],_0x340eaa[_0x6bfa('0x32')]);_0x5633d0['attributes']=_[_0x6bfa('0x35')](_0x340eaa[_0x6bfa('0x2f')],qs[_0x6bfa('0x36')](_0x13ff32['query'][_0x6bfa('0x36')]));_0x5633d0[_0x6bfa('0x37')]=_0x5633d0[_0x6bfa('0x37')][_0x6bfa('0x38')]?_0x5633d0['attributes']:_0x340eaa[_0x6bfa('0x2f')];if(!_0x13ff32[_0x6bfa('0x32')][_0x6bfa('0x39')](_0x6bfa('0x3a'))){_0x5633d0[_0x6bfa('0x3b')]=qs[_0x6bfa('0x3b')](_0x13ff32['query'][_0x6bfa('0x3b')]);_0x5633d0[_0x6bfa('0x20')]=qs[_0x6bfa('0x20')](_0x13ff32[_0x6bfa('0x32')][_0x6bfa('0x20')]);}_0x5633d0[_0x6bfa('0x3c')]=qs[_0x6bfa('0x3d')](_0x13ff32['query']['sort']);_0x5633d0['where']=qs[_0x6bfa('0x34')](_['pick'](_0x13ff32[_0x6bfa('0x32')],_0x340eaa[_0x6bfa('0x34')]));if(_0x23ab8a[_0x6bfa('0x31')]){if(_0x23ab8a['dateEnd']){_0x23ab8a[_0x6bfa('0x33')]=moment(_0x23ab8a[_0x6bfa('0x33')])[_0x6bfa('0x3e')](0x1,'day');}else{_0x23ab8a[_0x6bfa('0x33')]=moment(_0x23ab8a[_0x6bfa('0x31')])[_0x6bfa('0x3e')](0x1,_0x6bfa('0x3f'));}_[_0x6bfa('0x40')](_0x5633d0[_0x6bfa('0x41')],{'createdAt':{'$gte':_0x23ab8a[_0x6bfa('0x31')],'$lte':_0x23ab8a[_0x6bfa('0x33')]}});}if(_0x13ff32[_0x6bfa('0x32')]['filter']){_0x5633d0[_0x6bfa('0x41')]=_[_0x6bfa('0x40')](_0x5633d0[_0x6bfa('0x41')],{'$or':_[_0x6bfa('0x42')](_0x5633d0['attributes'],function(_0x1fa551){var _0x3def7e={};_0x3def7e[_0x1fa551]={'$like':'%'+_0x13ff32['query'][_0x6bfa('0x43')]+'%'};return _0x3def7e;})});}_0x5633d0=_['merge']({},_0x5633d0,_0x13ff32[_0x6bfa('0x44')]);var _0x56acf1={'where':_0x5633d0[_0x6bfa('0x41')]};return db['Dashboard'][_0x6bfa('0x1f')](_0x56acf1)[_0x6bfa('0x25')](function(_0x2282bc){_0x498683['count']=_0x2282bc;if(_0x13ff32[_0x6bfa('0x32')]['includeAll']){_0x5633d0[_0x6bfa('0x45')]=[{'all':!![]}];}return db[_0x6bfa('0x2d')]['findAll'](_0x5633d0);})[_0x6bfa('0x25')](function(_0x5b2aa8){_0x498683[_0x6bfa('0x46')]=_0x5b2aa8;return _0x498683;})[_0x6bfa('0x25')](respondWithFilteredResult(_0x1bf435,_0x5633d0))[_0x6bfa('0x47')](handleError(_0x1bf435,null));};exports[_0x6bfa('0x48')]=function(_0x2f5c7a,_0x28f6f9){var _0x3d6851={'raw':![],'where':{'id':_0x2f5c7a[_0x6bfa('0x49')]['id']}},_0x2e7caa={};_0x2e7caa[_0x6bfa('0x2f')]=_[_0x6bfa('0x30')](db[_0x6bfa('0x2d')]['rawAttributes']);_0x2e7caa['query']=_['keys'](_0x2f5c7a[_0x6bfa('0x32')]);_0x2e7caa[_0x6bfa('0x34')]=_[_0x6bfa('0x35')](_0x2e7caa['model'],_0x2e7caa[_0x6bfa('0x32')]);_0x3d6851[_0x6bfa('0x37')]=_[_0x6bfa('0x35')](_0x2e7caa['model'],qs[_0x6bfa('0x36')](_0x2f5c7a[_0x6bfa('0x32')]['fields']));_0x3d6851['attributes']=_0x3d6851[_0x6bfa('0x37')][_0x6bfa('0x38')]?_0x3d6851[_0x6bfa('0x37')]:_0x2e7caa[_0x6bfa('0x2f')];if(_0x2f5c7a[_0x6bfa('0x32')][_0x6bfa('0x4a')]){_0x3d6851[_0x6bfa('0x45')]=[{'all':!![]}];}_0x3d6851=_[_0x6bfa('0x40')]({},_0x3d6851,_0x2f5c7a[_0x6bfa('0x44')]);return db[_0x6bfa('0x2d')][_0x6bfa('0x4b')](_0x3d6851)[_0x6bfa('0x25')](handleEntityNotFound(_0x28f6f9,null))[_0x6bfa('0x25')](respondWithResult(_0x28f6f9,null))[_0x6bfa('0x47')](handleError(_0x28f6f9,null));};exports[_0x6bfa('0x4c')]=function(_0x2f1c73,_0x2c4147){return db[_0x6bfa('0x2d')][_0x6bfa('0x4c')](_0x2f1c73['body'],{})[_0x6bfa('0x25')](function(_0x404656){var _0x66b086=_0x2f1c73['user'][_0x6bfa('0x27')]({'plain':!![]});if(!_0x66b086)throw new Error(_0x6bfa('0x4d'));if(_0x66b086['role']===_0x6bfa('0x4e')){var _0x4f3f49=_0x404656['get']({'plain':!![]});var _0x4500af='CustomDashboards';return db[_0x6bfa('0x4f')][_0x6bfa('0x4b')]({'where':{'name':_0x4500af,'userProfileId':_0x66b086[_0x6bfa('0x50')]},'raw':!![]})['then'](function(_0x5ba114){if(_0x5ba114&&_0x5ba114[_0x6bfa('0x51')]===0x0){return db['UserProfileResource'][_0x6bfa('0x4c')]({'name':_0x4f3f49[_0x6bfa('0x2b')],'resourceId':_0x4f3f49['id'],'type':_0x5ba114['name'],'sectionId':_0x5ba114['id']},{})['then'](function(){return _0x404656;});}else{return _0x404656;}})[_0x6bfa('0x47')](function(_0x28e541){logger[_0x6bfa('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28e541);throw _0x28e541;});}return _0x404656;})['then'](respondWithResult(_0x2c4147,0xc9))[_0x6bfa('0x47')](handleError(_0x2c4147,null));};exports[_0x6bfa('0x52')]=function(_0x1d5a1b,_0xc60f88){var _0x22a859={'raw':![],'where':{'id':_0x1d5a1b[_0x6bfa('0x49')]['id']}},_0x243f8c={};_0x243f8c[_0x6bfa('0x2f')]=_[_0x6bfa('0x30')](db[_0x6bfa('0x2d')][_0x6bfa('0x2e')]);_0x22a859[_0x6bfa('0x37')]=_['intersection'](_0x243f8c[_0x6bfa('0x2f')],qs['fields'](_0x1d5a1b['query'][_0x6bfa('0x36')]));_0x22a859[_0x6bfa('0x37')]=_0x22a859[_0x6bfa('0x37')][_0x6bfa('0x38')]?_0x22a859['attributes']:_0x243f8c[_0x6bfa('0x2f')];if(_0x1d5a1b['query'][_0x6bfa('0x4a')]){_0x22a859[_0x6bfa('0x45')]=[{'all':!![]}];}_0x22a859=_[_0x6bfa('0x40')]({},_0x22a859,_0x1d5a1b['options']);return db[_0x6bfa('0x2d')]['find'](_0x22a859)['then'](handleEntityNotFound(_0xc60f88,null))[_0x6bfa('0x25')](function(_0x78a9c3){if(_0x78a9c3){var _0x26aecf=_0x78a9c3['get']({'plain':!![]});_0x26aecf=qs[_0x6bfa('0x53')](_0x26aecf,['id',_0x6bfa('0x54'),'updatedAt']);_0x1d5a1b[_0x6bfa('0x55')]=_[_0x6bfa('0x53')](_0x1d5a1b['body'],['id',_0x6bfa('0x54'),_0x6bfa('0x56')]);return db[_0x6bfa('0x2d')][_0x6bfa('0x4c')](_[_0x6bfa('0x40')](_0x26aecf,_0x1d5a1b['body']),{'include':_0x1d5a1b[_0x6bfa('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0x6bfa('0x25')](function(_0x2ccbf1){var _0x3567ee=_0x1d5a1b[_0x6bfa('0x4e')][_0x6bfa('0x27')]({'plain':!![]});if(!_0x3567ee)throw new Error(_0x6bfa('0x4d'));if(_0x3567ee['role']===_0x6bfa('0x4e')){var _0x120dbc=_0x2ccbf1[_0x6bfa('0x27')]({'plain':!![]});var _0x176c2b=_0x6bfa('0x57');return db[_0x6bfa('0x4f')]['find']({'where':{'name':_0x176c2b,'userProfileId':_0x3567ee[_0x6bfa('0x50')]},'raw':!![]})[_0x6bfa('0x25')](function(_0x2b8814){if(_0x2b8814&&_0x2b8814[_0x6bfa('0x51')]===0x0){return db[_0x6bfa('0x28')][_0x6bfa('0x4c')]({'name':_0x120dbc[_0x6bfa('0x2b')],'resourceId':_0x120dbc['id'],'type':_0x2b8814[_0x6bfa('0x2b')],'sectionId':_0x2b8814['id']},{})[_0x6bfa('0x25')](function(){return _0x2ccbf1;});}else{return _0x2ccbf1;}})['catch'](function(_0x2aeb97){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aeb97);throw _0x2aeb97;});}return _0x2ccbf1;});}})[_0x6bfa('0x25')](respondWithResult(_0xc60f88,0xc9))[_0x6bfa('0x47')](handleError(_0xc60f88,null));};exports[_0x6bfa('0x24')]=function(_0x167312,_0x827f6d){if(_0x167312[_0x6bfa('0x55')]['id']){delete _0x167312[_0x6bfa('0x55')]['id'];}return db[_0x6bfa('0x2d')]['find']({'where':{'id':_0x167312[_0x6bfa('0x49')]['id']}})[_0x6bfa('0x25')](handleEntityNotFound(_0x827f6d,null))[_0x6bfa('0x25')](saveUpdates(_0x167312[_0x6bfa('0x55')],null))[_0x6bfa('0x25')](respondWithResult(_0x827f6d,null))['catch'](handleError(_0x827f6d,null));};exports[_0x6bfa('0x26')]=function(_0x40cc4f,_0x4bac8d){return db['Dashboard'][_0x6bfa('0x4b')]({'where':{'id':_0x40cc4f[_0x6bfa('0x49')]['id']}})[_0x6bfa('0x25')](handleEntityNotFound(_0x4bac8d,null))['then'](removeEntity(_0x4bac8d,null))[_0x6bfa('0x47')](handleError(_0x4bac8d,null));};function widgetAttributes(_0x194267){try{switch(_0x194267['type']){case _0x6bfa('0x58'):return[{'name':_0x6bfa('0x59'),'value':_0x194267[_0x6bfa('0x59')]||(_0x194267[_0x6bfa('0x5a')]&&_0x194267[_0x6bfa('0x5a')][0x0]?_0x194267[_0x6bfa('0x5a')][0x0][_0x6bfa('0x5b')]:undefined)||_0x6bfa('0x5c')}];case _0x6bfa('0x5d'):return[{'name':'attrPath','value':_0x194267[_0x6bfa('0x5e')]||(_0x194267[_0x6bfa('0x5a')]&&_0x194267[_0x6bfa('0x5a')][0x0]?_0x194267[_0x6bfa('0x5a')][0x0][_0x6bfa('0x5b')]:undefined)||''}];case _0x6bfa('0x5f'):return[{'name':'attrHourFormat','value':_0x194267['attrHourFormat']||(_0x194267[_0x6bfa('0x5a')]&&_0x194267[_0x6bfa('0x5a')][0x0]?_0x194267['attrs'][0x0][_0x6bfa('0x5b')]:undefined)||_0x6bfa('0x60')},{'name':_0x6bfa('0x61'),'value':_0x194267['attrTimezone']||(_0x194267[_0x6bfa('0x5a')]&&_0x194267['attrs'][0x1]?_0x194267['attrs'][0x1]['value']:undefined)||_0x6bfa('0x62')},{'name':_0x6bfa('0x63'),'value':_0x194267['attrFontSize']||(_0x194267[_0x6bfa('0x5a')]&&_0x194267[_0x6bfa('0x5a')][0x2]?_0x194267['attrs'][0x2]['value']:undefined)||0xc}];case _0x6bfa('0x64'):return[{'name':_0x6bfa('0x65'),'value':_0x194267[_0x6bfa('0x65')]||(_0x194267[_0x6bfa('0x5a')]&&_0x194267[_0x6bfa('0x5a')][0x0]?_0x194267['attrs'][0x0][_0x6bfa('0x5b')]:undefined)||_0x6bfa('0x66')},{'name':'attrVoiceQueues','value':_0x194267[_0x6bfa('0x67')]||(_0x194267[_0x6bfa('0x5a')]&&_0x194267['attrs'][0x1]?_0x194267[_0x6bfa('0x5a')][0x1][_0x6bfa('0x5b')]:undefined)||[]},{'name':_0x6bfa('0x63'),'value':_0x194267['attrFontSize']||(_0x194267[_0x6bfa('0x5a')]&&_0x194267[_0x6bfa('0x5a')][0x2]?_0x194267[_0x6bfa('0x5a')][0x2][_0x6bfa('0x5b')]:undefined)||0x14}];case _0x6bfa('0x68'):case _0x6bfa('0x69'):return[{'name':_0x6bfa('0x6a'),'value':_0x194267[_0x6bfa('0x6a')]||(_0x194267['attrs']&&_0x194267[_0x6bfa('0x5a')][0x0]?_0x194267['attrs'][0x0][_0x6bfa('0x5b')]:undefined)||_0x6bfa('0x66')},{'name':_0x6bfa('0x6b'),'value':_0x194267[_0x6bfa('0x6b')]||(_0x194267[_0x6bfa('0x5a')]&&_0x194267[_0x6bfa('0x5a')][0x1]?_0x194267[_0x6bfa('0x5a')][0x1][_0x6bfa('0x5b')]:undefined)||null},{'name':_0x6bfa('0x6c'),'value':_0x194267[_0x6bfa('0x6c')]||(_0x194267[_0x6bfa('0x5a')]&&_0x194267[_0x6bfa('0x5a')][0x2]?_0x194267[_0x6bfa('0x5a')][0x2][_0x6bfa('0x5b')]:undefined)||null},{'name':_0x6bfa('0x67'),'value':_0x194267[_0x6bfa('0x67')]||(_0x194267[_0x6bfa('0x5a')]&&_0x194267[_0x6bfa('0x5a')][0x3]?_0x194267[_0x6bfa('0x5a')][0x3][_0x6bfa('0x5b')]:undefined)||[]}];case _0x6bfa('0x6d'):return[{'name':_0x6bfa('0x6e'),'type':_0x194267['reportType']||null,'value':_0x194267['attrReport']||(_0x194267['attrs']&&_0x194267['attrs'][0x0]?_0x194267[_0x6bfa('0x5a')][0x0][_0x6bfa('0x5b')]:undefined)||null},{'name':_0x6bfa('0x6f'),'value':_0x194267[_0x6bfa('0x6f')]||(_0x194267['attrs']&&_0x194267[_0x6bfa('0x5a')][0x1]?_0x194267[_0x6bfa('0x5a')][0x1][_0x6bfa('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x3a22fb){logger['error'](_0x6bfa('0x70'),JSON[_0x6bfa('0x71')](_0x3a22fb));return[];}}exports[_0x6bfa('0x72')]=function(_0x28c8da,_0x9db255,_0x40677e){if(_0x28c8da[_0x6bfa('0x55')]['id']){delete _0x28c8da[_0x6bfa('0x55')]['id'];}return db[_0x6bfa('0x2d')][_0x6bfa('0x4b')]({'where':{'id':_0x28c8da['params']['id']}})[_0x6bfa('0x25')](handleEntityNotFound(_0x9db255,null))['then'](function(_0x31924e){if(_0x31924e){_0x28c8da[_0x6bfa('0x55')][_0x6bfa('0x73')]=_0x31924e['id'];_0x28c8da[_0x6bfa('0x55')][_0x6bfa('0x5a')]=widgetAttributes(_0x28c8da['body']);return db[_0x6bfa('0x74')][_0x6bfa('0x4c')](_0x28c8da[_0x6bfa('0x55')]);}})[_0x6bfa('0x25')](respondWithResult(_0x9db255,null))[_0x6bfa('0x47')](handleError(_0x9db255,null));};exports['getItems']=function(_0x34c5a9,_0x5bf359,_0x1c6fa5){var _0x3587c4={};var _0x16532d={};var _0x35ee87;var _0x47a508;return db[_0x6bfa('0x2d')]['findOne']({'where':{'id':_0x34c5a9['params']['id']}})['then'](handleEntityNotFound(_0x5bf359,null))[_0x6bfa('0x25')](function(_0x430204){if(_0x430204){_0x35ee87=_0x430204;_0x16532d[_0x6bfa('0x2f')]=_['keys'](db[_0x6bfa('0x74')]['rawAttributes']);_0x16532d['query']=_[_0x6bfa('0x30')](_0x34c5a9[_0x6bfa('0x32')]);_0x16532d[_0x6bfa('0x34')]=_['intersection'](_0x16532d[_0x6bfa('0x2f')],_0x16532d[_0x6bfa('0x32')]);_0x3587c4[_0x6bfa('0x37')]=_[_0x6bfa('0x35')](_0x16532d[_0x6bfa('0x2f')],qs['fields'](_0x34c5a9['query']['fields']));_0x3587c4[_0x6bfa('0x37')]=_0x3587c4[_0x6bfa('0x37')][_0x6bfa('0x38')]?_0x3587c4['attributes']:_0x16532d[_0x6bfa('0x2f')];_0x3587c4[_0x6bfa('0x3c')]=qs[_0x6bfa('0x3d')](_0x34c5a9['query']['sort']);_0x3587c4[_0x6bfa('0x41')]=qs[_0x6bfa('0x34')](_['pick'](_0x34c5a9[_0x6bfa('0x32')],_0x16532d[_0x6bfa('0x34')]));if(_0x34c5a9[_0x6bfa('0x32')][_0x6bfa('0x43')]){_0x3587c4[_0x6bfa('0x41')]=_[_0x6bfa('0x40')](_0x3587c4['where'],{'$or':_[_0x6bfa('0x42')](_0x3587c4[_0x6bfa('0x37')],function(_0x5aff1f){var _0x2a05fa={};_0x2a05fa[_0x5aff1f]={'$like':'%'+_0x34c5a9[_0x6bfa('0x32')][_0x6bfa('0x43')]+'%'};return _0x2a05fa;})});}_0x3587c4=_[_0x6bfa('0x40')]({},_0x3587c4,_0x34c5a9[_0x6bfa('0x44')]);return _0x35ee87[_0x6bfa('0x75')](_0x3587c4);}})[_0x6bfa('0x25')](function(_0x5574b9){if(_0x5574b9){_0x47a508=_0x5574b9['length'];if(!_0x34c5a9[_0x6bfa('0x32')][_0x6bfa('0x39')]('nolimit')){_0x3587c4['limit']=qs[_0x6bfa('0x3b')](_0x34c5a9[_0x6bfa('0x32')][_0x6bfa('0x3b')]);_0x3587c4[_0x6bfa('0x20')]=qs['offset'](_0x34c5a9[_0x6bfa('0x32')][_0x6bfa('0x20')]);}return _0x35ee87[_0x6bfa('0x75')](_0x3587c4);}})[_0x6bfa('0x25')](function(_0x21a051){if(_0x21a051){return _0x21a051?{'count':_0x47a508,'rows':_0x21a051}:null;}})[_0x6bfa('0x25')](respondWithResult(_0x5bf359,null))[_0x6bfa('0x47')](handleError(_0x5bf359,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 21a3a20..0fe7940 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 _0x9e88=['emit','hasOwnProperty','hook','events','Dashboard','setMaxListeners','save','update'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9e88,0x123));var _0x89e8=function(_0x2839bd,_0x211d10){_0x2839bd=_0x2839bd-0x0;var _0x55c926=_0x9e88[_0x2839bd];return _0x55c926;};'use strict';var EventEmitter=require(_0x89e8('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x89e8('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x89e8('0x2')](0x0);var events={'afterCreate':_0x89e8('0x3'),'afterUpdate':_0x89e8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20479c){return function(_0x5a82d2,_0x2862ea,_0x1c4983){DashboardEvents['emit'](_0x20479c+':'+_0x5a82d2['id'],_0x5a82d2);DashboardEvents[_0x89e8('0x5')](_0x20479c,_0x5a82d2);_0x1c4983(null);};}for(var e in events){if(events[_0x89e8('0x6')](e)){var event=events[e];Dashboard[_0x89e8('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x5a6d=['Dashboard','setMaxListeners','remove','emit','events'];(function(_0x34bf03,_0x7ebc65){var _0x478925=function(_0x46508c){while(--_0x46508c){_0x34bf03['push'](_0x34bf03['shift']());}};_0x478925(++_0x7ebc65);}(_0x5a6d,0x194));var _0xd5a6=function(_0x3c6b4b,_0x25f668){_0x3c6b4b=_0x3c6b4b-0x0;var _0x5acab0=_0x5a6d[_0x3c6b4b];return _0x5acab0;};'use strict';var EventEmitter=require(_0xd5a6('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xd5a6('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd5a6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd5a6('0x3')};function emitEvent(_0x63bbad){return function(_0xb6f05b,_0x3529bd,_0xd0a188){DashboardEvents['emit'](_0x63bbad+':'+_0xb6f05b['id'],_0xb6f05b);DashboardEvents[_0xd5a6('0x4')](_0x63bbad,_0xb6f05b);_0xd0a188(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index aafabd4..4b77e48 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 _0x55c3=['moment','bluebird','request-promise','./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55c3,0x189));var _0x355c=function(_0x4802af,_0x32579c){_0x4802af=_0x4802af-0x0;var _0x25769f=_0x55c3[_0x4802af];return _0x25769f;};'use strict';var _=require('lodash');var util=require(_0x355c('0x0'));var logger=require(_0x355c('0x1'))(_0x355c('0x2'));var moment=require(_0x355c('0x3'));var BPromise=require(_0x355c('0x4'));var rp=require(_0x355c('0x5'));var attributes=require(_0x355c('0x6'));module[_0x355c('0x7')]=function(_0x1655c1,_0x1c7a4f){return _0x1655c1[_0x355c('0x8')](_0x355c('0x9'),attributes,{'tableName':_0x355c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7177=['./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','../../config/logger','moment','bluebird'];(function(_0x5af459,_0x45d683){var _0x5ac0ae=function(_0x5dfbed){while(--_0x5dfbed){_0x5af459['push'](_0x5af459['shift']());}};_0x5ac0ae(++_0x45d683);}(_0x7177,0x101));var _0x7717=function(_0x80bea0,_0x4c30f4){_0x80bea0=_0x80bea0-0x0;var _0x50fb90=_0x7177[_0x80bea0];return _0x50fb90;};'use strict';var _=require(_0x7717('0x0'));var util=require('util');var logger=require(_0x7717('0x1'))('api');var moment=require(_0x7717('0x2'));var BPromise=require(_0x7717('0x3'));var rp=require('request-promise');var attributes=require(_0x7717('0x4'));module[_0x7717('0x5')]=function(_0x5bee5c,_0x34b5d6){return _0x5bee5c[_0x7717('0x6')](_0x7717('0x7'),attributes,{'tableName':_0x7717('0x8'),'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 f15a035..c520108 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 _0xab30=['Dashboard,\x20%s,\x20%s','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','./dashboard.socket','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x51b3fd,_0x5a7fff){var _0x547c1b=function(_0x1e8dbd){while(--_0x1e8dbd){_0x51b3fd['push'](_0x51b3fd['shift']());}};_0x547c1b(++_0x5a7fff);}(_0xab30,0x1ce));var _0x0ab3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xab30[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0ab3('0x0'));var util=require(_0x0ab3('0x1'));var moment=require('moment');var BPromise=require(_0x0ab3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ab3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ab3('0x4'))(_0x0ab3('0x5'));var config=require(_0x0ab3('0x6'));var jayson=require(_0x0ab3('0x7'));var client=jayson['client'][_0x0ab3('0x8')]({'port':0x232a});config['redis']=_[_0x0ab3('0x9')](config[_0x0ab3('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ab3('0xa')]));require(_0x0ab3('0xb'))['register'](socket);function respondWithRpcPromise(_0x479e05,_0x18bb37,_0x17ab6b){return new BPromise(function(_0xc28503,_0x4599b6){return client[_0x0ab3('0xc')](_0x479e05,_0x17ab6b)[_0x0ab3('0xd')](function(_0x4a4c0c){logger[_0x0ab3('0xe')]('Dashboard,\x20%s,\x20%s',_0x18bb37,_0x0ab3('0xf'));logger[_0x0ab3('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x18bb37,_0x0ab3('0xf'),JSON[_0x0ab3('0x11')](_0x4a4c0c));if(_0x4a4c0c[_0x0ab3('0x12')]){if(_0x4a4c0c[_0x0ab3('0x12')][_0x0ab3('0x13')]===0x1f4){logger[_0x0ab3('0x12')]('Dashboard,\x20%s,\x20%s',_0x18bb37,_0x4a4c0c['error'][_0x0ab3('0x14')]);return _0x4599b6(_0x4a4c0c[_0x0ab3('0x12')][_0x0ab3('0x14')]);}logger[_0x0ab3('0x12')](_0x0ab3('0x15'),_0x18bb37,_0x4a4c0c[_0x0ab3('0x12')][_0x0ab3('0x14')]);return _0xc28503(_0x4a4c0c[_0x0ab3('0x12')][_0x0ab3('0x14')]);}else{logger[_0x0ab3('0xe')](_0x0ab3('0x15'),_0x18bb37,'request\x20sent');_0xc28503(_0x4a4c0c['result'][_0x0ab3('0x14')]);}})[_0x0ab3('0x16')](function(_0x9c3b93){logger['error'](_0x0ab3('0x15'),_0x18bb37,_0x9c3b93);_0x4599b6(_0x9c3b93);});});} \ No newline at end of file +var _0xf41f=['redis','localhost','socket.io-emitter','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x59b873,_0x44f1aa){var _0x562197=function(_0x270e40){while(--_0x270e40){_0x59b873['push'](_0x59b873['shift']());}};_0x562197(++_0x44f1aa);}(_0xf41f,0x11d));var _0xff41=function(_0x216314,_0x580d79){_0x216314=_0x216314-0x0;var _0xe4a5c7=_0xf41f[_0x216314];return _0xe4a5c7;};'use strict';var _=require(_0xff41('0x0'));var util=require(_0xff41('0x1'));var moment=require(_0xff41('0x2'));var BPromise=require(_0xff41('0x3'));var rs=require(_0xff41('0x4'));var fs=require('fs');var Redis=require(_0xff41('0x5'));var db=require(_0xff41('0x6'))['db'];var utils=require(_0xff41('0x7'));var logger=require(_0xff41('0x8'))('rpc');var config=require(_0xff41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff41('0xa')][_0xff41('0xb')]({'port':0x232a});config[_0xff41('0xc')]=_['defaults'](config[_0xff41('0xc')],{'host':_0xff41('0xd'),'port':0x18eb});var socket=require(_0xff41('0xe'))(new Redis(config[_0xff41('0xc')]));require('./dashboard.socket')[_0xff41('0xf')](socket);function respondWithRpcPromise(_0x3eace7,_0xd5bc12,_0x276a27){return new BPromise(function(_0x1dedf5,_0x164f11){return client[_0xff41('0x10')](_0x3eace7,_0x276a27)['then'](function(_0x8cc37d){logger[_0xff41('0x11')](_0xff41('0x12'),_0xd5bc12,_0xff41('0x13'));logger[_0xff41('0x14')](_0xff41('0x15'),_0xd5bc12,_0xff41('0x13'),JSON['stringify'](_0x8cc37d));if(_0x8cc37d[_0xff41('0x16')]){if(_0x8cc37d['error'][_0xff41('0x17')]===0x1f4){logger['error'](_0xff41('0x12'),_0xd5bc12,_0x8cc37d['error']['message']);return _0x164f11(_0x8cc37d['error'][_0xff41('0x18')]);}logger[_0xff41('0x16')](_0xff41('0x12'),_0xd5bc12,_0x8cc37d[_0xff41('0x16')]['message']);return _0x1dedf5(_0x8cc37d[_0xff41('0x16')]['message']);}else{logger[_0xff41('0x11')]('Dashboard,\x20%s,\x20%s',_0xd5bc12,'request\x20sent');_0x1dedf5(_0x8cc37d[_0xff41('0x19')][_0xff41('0x18')]);}})[_0xff41('0x1a')](function(_0x1ebb2f){logger['error'](_0xff41('0x12'),_0xd5bc12,_0x1ebb2f);_0x164f11(_0x1ebb2f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index c2f6f55..478ce46 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 _0x0ac9=['update','emit','register','length','./dashboard.events','save','remove'];(function(_0x266b37,_0x47f360){var _0x4f4fb6=function(_0x164618){while(--_0x164618){_0x266b37['push'](_0x266b37['shift']());}};_0x4f4fb6(++_0x47f360);}(_0x0ac9,0x162));var _0x90ac=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0x0ac9[_0x1034ca];return _0x1a023a;};'use strict';var DashboardEvents=require(_0x90ac('0x0'));var events=[_0x90ac('0x1'),_0x90ac('0x2'),_0x90ac('0x3')];function createListener(_0x23fc26,_0x4642f9){return function(_0x127505){_0x4642f9[_0x90ac('0x4')](_0x23fc26,_0x127505);};}function removeListener(_0x4b5d2f,_0x33b11e){return function(){DashboardEvents['removeListener'](_0x4b5d2f,_0x33b11e);};}exports[_0x90ac('0x5')]=function(_0x222f71){for(var _0xcd996e=0x0,_0x3ac329=events[_0x90ac('0x6')];_0xcd996e<_0x3ac329;_0xcd996e++){var _0x73ae05=events[_0xcd996e];var _0x56dea0=createListener('dashboard:'+_0x73ae05,_0x222f71);DashboardEvents['on'](_0x73ae05,_0x56dea0);}}; \ No newline at end of file +var _0x9ee1=['update','emit','removeListener','register','dashboard:','./dashboard.events','save','remove'];(function(_0x22134e,_0x53d31c){var _0x362bad=function(_0x2074f0){while(--_0x2074f0){_0x22134e['push'](_0x22134e['shift']());}};_0x362bad(++_0x53d31c);}(_0x9ee1,0xfd));var _0x19ee=function(_0x522d4e,_0x49ba43){_0x522d4e=_0x522d4e-0x0;var _0x4c018d=_0x9ee1[_0x522d4e];return _0x4c018d;};'use strict';var DashboardEvents=require(_0x19ee('0x0'));var events=[_0x19ee('0x1'),_0x19ee('0x2'),_0x19ee('0x3')];function createListener(_0x3e144f,_0x2df13b){return function(_0x8baff9){_0x2df13b[_0x19ee('0x4')](_0x3e144f,_0x8baff9);};}function removeListener(_0x49662d,_0x999b92){return function(){DashboardEvents[_0x19ee('0x5')](_0x49662d,_0x999b92);};}exports[_0x19ee('0x6')]=function(_0x473b6d){for(var _0x57e44c=0x0,_0x36e69f=events['length'];_0x57e44c<_0x36e69f;_0x57e44c++){var _0x5e8219=events[_0x57e44c];var _0x3d970d=createListener(_0x19ee('0x7')+_0x5e8219,_0x473b6d);DashboardEvents['on'](_0x5e8219,_0x3d970d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index a539834..6ea3e08 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 _0xf8f1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','show','/:id/items','getItems','create','post','/:id/clone','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf8f1,0x1e1));var _0x1f8f=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0xf8f1[_0x47e7dd];return _0x38501f;};'use strict';var multer=require(_0x1f8f('0x0'));var util=require(_0x1f8f('0x1'));var path=require(_0x1f8f('0x2'));var timeout=require(_0x1f8f('0x3'));var express=require(_0x1f8f('0x4'));var router=express[_0x1f8f('0x5')]();var auth=require(_0x1f8f('0x6'));var interaction=require(_0x1f8f('0x7'));var config=require('../../config/environment');var controller=require(_0x1f8f('0x8'));router[_0x1f8f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1f8f('0x9')]('/:id',auth[_0x1f8f('0xa')](),controller[_0x1f8f('0xb')]);router['get'](_0x1f8f('0xc'),auth['isAuthenticated'](),controller[_0x1f8f('0xd')]);router['post']('/',auth[_0x1f8f('0xa')](),controller[_0x1f8f('0xe')]);router[_0x1f8f('0xf')](_0x1f8f('0x10'),auth[_0x1f8f('0xa')](),controller['clone']);router[_0x1f8f('0xf')](_0x1f8f('0xc'),auth[_0x1f8f('0xa')](),controller['addItem']);router[_0x1f8f('0x11')](_0x1f8f('0x12'),auth['isAuthenticated'](),controller[_0x1f8f('0x13')]);router[_0x1f8f('0x14')]('/:id',auth[_0x1f8f('0xa')](),controller[_0x1f8f('0x15')]);module['exports']=router; \ No newline at end of file +var _0x83b2=['isAuthenticated','/:id','show','/:id/items','getItems','create','post','/:id/clone','clone','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x83b2,0x77));var _0x283b=function(_0x3a6ca1,_0x525bd5){_0x3a6ca1=_0x3a6ca1-0x0;var _0xb552b=_0x83b2[_0x3a6ca1];return _0xb552b;};'use strict';var multer=require('multer');var util=require(_0x283b('0x0'));var path=require('path');var timeout=require(_0x283b('0x1'));var express=require(_0x283b('0x2'));var router=express[_0x283b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x283b('0x4'));var config=require(_0x283b('0x5'));var controller=require('./dashboard.controller');router[_0x283b('0x6')]('/',auth[_0x283b('0x7')](),controller['index']);router[_0x283b('0x6')](_0x283b('0x8'),auth[_0x283b('0x7')](),controller[_0x283b('0x9')]);router[_0x283b('0x6')](_0x283b('0xa'),auth[_0x283b('0x7')](),controller[_0x283b('0xb')]);router['post']('/',auth[_0x283b('0x7')](),controller[_0x283b('0xc')]);router[_0x283b('0xd')](_0x283b('0xe'),auth['isAuthenticated'](),controller[_0x283b('0xf')]);router['post'](_0x283b('0xa'),auth[_0x283b('0x7')](),controller['addItem']);router[_0x283b('0x10')](_0x283b('0x8'),auth[_0x283b('0x7')](),controller[_0x283b('0x11')]);router[_0x283b('0x12')](_0x283b('0x8'),auth[_0x283b('0x7')](),controller[_0x283b('0x13')]);module[_0x283b('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 b2ecd78..e34b0bd 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 _0x0900=['#2196f3','squel','lodash','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x0900,0x17a));var _0x0090=function(_0x46d274,_0x543bde){_0x46d274=_0x46d274-0x0;var _0x48c259=_0x0900[_0x46d274];return _0x48c259;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x0090('0x0'));var _=require(_0x0090('0x1'));module[_0x0090('0x2')]={'title':{'type':Sequelize[_0x0090('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0090('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0090('0x4')](_0x0090('0x5')),'get':function(){try{return JSON['parse'](this[_0x0090('0x6')](_0x0090('0x7')));}catch(_0x7d0405){return[];}},'set':function(_0x2e9591){try{this[_0x0090('0x8')]('attrs',JSON[_0x0090('0x9')](_0x2e9591));}catch(_0x4725bd){this[_0x0090('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x0090('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0090('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x0090('0x3')],'allowNull':![],'defaultValue':_0x0090('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x0090('0x3')],'allowNull':![],'defaultValue':_0x0090('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3fc0=['#ffffff','sequelize','squel','exports','STRING','TEXT','long','setDataValue','attrs','stringify','INTEGER'];(function(_0x5c9d9f,_0x4bf54b){var _0xfe6db4=function(_0x29d897){while(--_0x29d897){_0x5c9d9f['push'](_0x5c9d9f['shift']());}};_0xfe6db4(++_0x4bf54b);}(_0x3fc0,0x14b));var _0x03fc=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x3fc0[_0x3b96cf];return _0x2e315a;};'use strict';var Sequelize=require(_0x03fc('0x0'));var squel=require(_0x03fc('0x1'));var _=require('lodash');module[_0x03fc('0x2')]={'title':{'type':Sequelize[_0x03fc('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x03fc('0x4')](_0x03fc('0x5')),'get':function(){try{return JSON['parse'](this['getDataValue']('attrs'));}catch(_0x4c1570){return[];}},'set':function(_0x5cf972){try{this[_0x03fc('0x6')](_0x03fc('0x7'),JSON['stringify'](_0x5cf972));}catch(_0x5e3da1){this[_0x03fc('0x6')]('attrs',JSON[_0x03fc('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x03fc('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x03fc('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x03fc('0x9')]},'col':{'type':Sequelize[_0x03fc('0x9')]},'background':{'type':Sequelize[_0x03fc('0x3')],'allowNull':![],'defaultValue':_0x03fc('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x03fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index af28d46..8feaf4f 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(_0xbc7f5a,_0x3056fe){var _0x4c0f5f=function(_0x15e1ee){while(--_0x15e1ee){_0xbc7f5a['push'](_0xbc7f5a['shift']());}};_0x4c0f5f(++_0x3056fe);}(_0xb10b,0x12a));var _0xbb10=function(_0x18a529,_0x2bea53){_0x18a529=_0x18a529-0x0;var _0x216fb8=_0xb10b[_0x18a529];return _0x216fb8;};'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(_0x4a271b,_0x5ad91d){var _0x388bfc=function(_0x27fe49){while(--_0x27fe49){_0x4a271b['push'](_0x4a271b['shift']());}};_0x388bfc(++_0x5ad91d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 861e6b5..6d0fa8c 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 _0xe160=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x2ea20d,_0x5e8e3c){var _0x3ba66a=function(_0x164ca6){while(--_0x164ca6){_0x2ea20d['push'](_0x2ea20d['shift']());}};_0x3ba66a(++_0x5e8e3c);}(_0xe160,0x12f));var _0x0e16=function(_0x2ad000,_0x4ba78b){_0x2ad000=_0x2ad000-0x0;var _0x9498c=_0xe160[_0x2ad000];return _0x9498c;};'use strict';var EventEmitter=require(_0x0e16('0x0'));var DashboardItem=require(_0x0e16('0x1'))['db'][_0x0e16('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0e16('0x3')](0x0);var events={'afterCreate':_0x0e16('0x4'),'afterUpdate':_0x0e16('0x5'),'afterDestroy':_0x0e16('0x6')};function emitEvent(_0x2b6f55){return function(_0x39183f,_0x322072,_0x25e7ee){DashboardItemEvents[_0x0e16('0x7')](_0x2b6f55+':'+_0x39183f['id'],_0x39183f);DashboardItemEvents[_0x0e16('0x7')](_0x2b6f55,_0x39183f);_0x25e7ee(null);};}for(var e in events){if(events[_0x0e16('0x8')](e)){var event=events[e];DashboardItem[_0x0e16('0x9')](e,emitEvent(event));}}module[_0x0e16('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0xe821=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','save'];(function(_0x269ff1,_0x266db5){var _0x1bf13c=function(_0x344ab9){while(--_0x344ab9){_0x269ff1['push'](_0x269ff1['shift']());}};_0x1bf13c(++_0x266db5);}(_0xe821,0x1c8));var _0x1e82=function(_0x56ec8e,_0x50229e){_0x56ec8e=_0x56ec8e-0x0;var _0x5b7811=_0xe821[_0x56ec8e];return _0x5b7811;};'use strict';var EventEmitter=require(_0x1e82('0x0'));var DashboardItem=require(_0x1e82('0x1'))['db'][_0x1e82('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e82('0x3'),'afterUpdate':_0x1e82('0x4'),'afterDestroy':_0x1e82('0x5')};function emitEvent(_0x16cb51){return function(_0x3e12f8,_0x17764f,_0x187ebe){DashboardItemEvents[_0x1e82('0x6')](_0x16cb51+':'+_0x3e12f8['id'],_0x3e12f8);DashboardItemEvents['emit'](_0x16cb51,_0x3e12f8);_0x187ebe(null);};}for(var e in events){if(events[_0x1e82('0x7')](e)){var event=events[e];DashboardItem[_0x1e82('0x8')](e,emitEvent(event));}}module[_0x1e82('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e8cc987..3f338f0 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(_0x3aab24,_0x39137c){var _0x640a57=function(_0x11ea38){while(--_0x11ea38){_0x3aab24['push'](_0x3aab24['shift']());}};_0x640a57(++_0x39137c);}(_0x7a54,0x106));var _0x47a5=function(_0x4eee35,_0xbe978){_0x4eee35=_0x4eee35-0x0;var _0x1b7b10=_0x7a54[_0x4eee35];return _0x1b7b10;};'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(_0x263a8a,_0x5c088d){var _0x226a79=function(_0x53a7d1){while(--_0x53a7d1){_0x263a8a['push'](_0x263a8a['shift']());}};_0x226a79(++_0x5c088d);}(_0x7a54,0x106));var _0x47a5=function(_0x3df1b5,_0x2a8962){_0x3df1b5=_0x3df1b5-0x0;var _0x136275=_0x7a54[_0x3df1b5];return _0x136275;};'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 8bc1bfe..6bd48b6 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 _0x6528=['error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4ff7d2,_0x25629b){var _0x6df362=function(_0x497b1b){while(--_0x497b1b){_0x4ff7d2['push'](_0x4ff7d2['shift']());}};_0x6df362(++_0x25629b);}(_0x6528,0x171));var _0x8652=function(_0x41a86d,_0x1819bc){_0x41a86d=_0x41a86d-0x0;var _0x1bf9e9=_0x6528[_0x41a86d];return _0x1bf9e9;};'use strict';var _=require(_0x8652('0x0'));var util=require(_0x8652('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8652('0x2'));var fs=require('fs');var Redis=require(_0x8652('0x3'));var db=require(_0x8652('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8652('0x5'))('rpc');var config=require(_0x8652('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8652('0x7')][_0x8652('0x8')]({'port':0x232a});config[_0x8652('0x9')]=_[_0x8652('0xa')](config[_0x8652('0x9')],{'host':_0x8652('0xb'),'port':0x18eb});var socket=require(_0x8652('0xc'))(new Redis(config[_0x8652('0x9')]));require(_0x8652('0xd'))['register'](socket);function respondWithRpcPromise(_0x143d76,_0x4855d4,_0x3b07ea){return new BPromise(function(_0x367f56,_0x3d8f67){return client['request'](_0x143d76,_0x3b07ea)[_0x8652('0xe')](function(_0x5ae80d){logger[_0x8652('0xf')](_0x8652('0x10'),_0x4855d4,_0x8652('0x11'));logger[_0x8652('0x12')](_0x8652('0x13'),_0x4855d4,_0x8652('0x11'),JSON[_0x8652('0x14')](_0x5ae80d));if(_0x5ae80d[_0x8652('0x15')]){if(_0x5ae80d[_0x8652('0x15')][_0x8652('0x16')]===0x1f4){logger['error'](_0x8652('0x10'),_0x4855d4,_0x5ae80d[_0x8652('0x15')]['message']);return _0x3d8f67(_0x5ae80d[_0x8652('0x15')][_0x8652('0x17')]);}logger[_0x8652('0x15')](_0x8652('0x10'),_0x4855d4,_0x5ae80d[_0x8652('0x15')][_0x8652('0x17')]);return _0x367f56(_0x5ae80d[_0x8652('0x15')][_0x8652('0x17')]);}else{logger['info'](_0x8652('0x10'),_0x4855d4,'request\x20sent');_0x367f56(_0x5ae80d[_0x8652('0x18')][_0x8652('0x17')]);}})[_0x8652('0x19')](function(_0x4696e1){logger['error'](_0x8652('0x10'),_0x4855d4,_0x4696e1);_0x3d8f67(_0x4696e1);});});} \ No newline at end of file +var _0xea6d=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request'];(function(_0x317339,_0x3734bd){var _0x295c49=function(_0x4dd481){while(--_0x4dd481){_0x317339['push'](_0x317339['shift']());}};_0x295c49(++_0x3734bd);}(_0xea6d,0x1ef));var _0xdea6=function(_0x212588,_0x2e76d8){_0x212588=_0x212588-0x0;var _0x365f74=_0xea6d[_0x212588];return _0x365f74;};'use strict';var _=require('lodash');var util=require(_0xdea6('0x0'));var moment=require('moment');var BPromise=require(_0xdea6('0x1'));var rs=require(_0xdea6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdea6('0x3'))['db'];var utils=require(_0xdea6('0x4'));var logger=require(_0xdea6('0x5'))(_0xdea6('0x6'));var config=require(_0xdea6('0x7'));var jayson=require(_0xdea6('0x8'));var client=jayson[_0xdea6('0x9')][_0xdea6('0xa')]({'port':0x232a});config[_0xdea6('0xb')]=_[_0xdea6('0xc')](config[_0xdea6('0xb')],{'host':_0xdea6('0xd'),'port':0x18eb});var socket=require(_0xdea6('0xe'))(new Redis(config[_0xdea6('0xb')]));require(_0xdea6('0xf'))[_0xdea6('0x10')](socket);function respondWithRpcPromise(_0x3e1715,_0x16813a,_0x32860c){return new BPromise(function(_0x148fb2,_0x45dab3){return client[_0xdea6('0x11')](_0x3e1715,_0x32860c)[_0xdea6('0x12')](function(_0x1e5e4e){logger[_0xdea6('0x13')](_0xdea6('0x14'),_0x16813a,_0xdea6('0x15'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x16813a,_0xdea6('0x15'),JSON[_0xdea6('0x16')](_0x1e5e4e));if(_0x1e5e4e[_0xdea6('0x17')]){if(_0x1e5e4e[_0xdea6('0x17')][_0xdea6('0x18')]===0x1f4){logger[_0xdea6('0x17')](_0xdea6('0x14'),_0x16813a,_0x1e5e4e[_0xdea6('0x17')][_0xdea6('0x19')]);return _0x45dab3(_0x1e5e4e[_0xdea6('0x17')][_0xdea6('0x19')]);}logger[_0xdea6('0x17')](_0xdea6('0x14'),_0x16813a,_0x1e5e4e[_0xdea6('0x17')]['message']);return _0x148fb2(_0x1e5e4e['error'][_0xdea6('0x19')]);}else{logger[_0xdea6('0x13')](_0xdea6('0x14'),_0x16813a,_0xdea6('0x15'));_0x148fb2(_0x1e5e4e['result'][_0xdea6('0x19')]);}})[_0xdea6('0x1a')](function(_0x4ebcf9){logger['error'](_0xdea6('0x14'),_0x16813a,_0x4ebcf9);_0x45dab3(_0x4ebcf9);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index ebcf864..5feee4e 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 _0x34e8=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0x34e8,0x12c));var _0x834e=function(_0x3325e6,_0x5a53ed){_0x3325e6=_0x3325e6-0x0;var _0x4e2671=_0x34e8[_0x3325e6];return _0x4e2671;};'use strict';var DashboardItemEvents=require(_0x834e('0x0'));var events=[_0x834e('0x1'),_0x834e('0x2'),_0x834e('0x3')];function createListener(_0x530939,_0x832422){return function(_0x21e2e0){_0x832422[_0x834e('0x4')](_0x530939,_0x21e2e0);};}function removeListener(_0x31bf20,_0x289ef2){return function(){DashboardItemEvents[_0x834e('0x5')](_0x31bf20,_0x289ef2);};}exports[_0x834e('0x6')]=function(_0x4a2018){for(var _0x858aa1=0x0,_0x52056d=events[_0x834e('0x7')];_0x858aa1<_0x52056d;_0x858aa1++){var _0x3cc2e3=events[_0x858aa1];var _0x3a3ef6=createListener(_0x834e('0x8')+_0x3cc2e3,_0x4a2018);DashboardItemEvents['on'](_0x3cc2e3,_0x3a3ef6);}}; \ No newline at end of file +var _0x34e8=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x34e8,0x12c));var _0x834e=function(_0x34f782,_0x21a29e){_0x34f782=_0x34f782-0x0;var _0x4fb169=_0x34e8[_0x34f782];return _0x4fb169;};'use strict';var DashboardItemEvents=require(_0x834e('0x0'));var events=[_0x834e('0x1'),_0x834e('0x2'),_0x834e('0x3')];function createListener(_0x530939,_0x832422){return function(_0x21e2e0){_0x832422[_0x834e('0x4')](_0x530939,_0x21e2e0);};}function removeListener(_0x31bf20,_0x289ef2){return function(){DashboardItemEvents[_0x834e('0x5')](_0x31bf20,_0x289ef2);};}exports[_0x834e('0x6')]=function(_0x4a2018){for(var _0x858aa1=0x0,_0x52056d=events[_0x834e('0x7')];_0x858aa1<_0x52056d;_0x858aa1++){var _0x3cc2e3=events[_0x858aa1];var _0x3a3ef6=createListener(_0x834e('0x8')+_0x3cc2e3,_0x4a2018);DashboardItemEvents['on'](_0x3cc2e3,_0x3a3ef6);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 0cd5eac..170d45b 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 _0xadf4=['./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4cd7f0,_0x1fb81e){var _0x1bd898=function(_0x5ba797){while(--_0x5ba797){_0x4cd7f0['push'](_0x4cd7f0['shift']());}};_0x1bd898(++_0x1fb81e);}(_0xadf4,0x71));var _0x4adf=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0xadf4[_0x13b392];return _0x39db24;};'use strict';var multer=require(_0x4adf('0x0'));var util=require(_0x4adf('0x1'));var path=require(_0x4adf('0x2'));var timeout=require('connect-timeout');var express=require(_0x4adf('0x3'));var router=express['Router']();var auth=require(_0x4adf('0x4'));var interaction=require(_0x4adf('0x5'));var config=require('../../config/environment');var controller=require(_0x4adf('0x6'));router[_0x4adf('0x7')](_0x4adf('0x8'),auth[_0x4adf('0x9')](),controller[_0x4adf('0xa')]);router[_0x4adf('0xb')]('/',auth[_0x4adf('0x9')](),controller[_0x4adf('0xc')]);router[_0x4adf('0xd')](_0x4adf('0x8'),auth['isAuthenticated'](),controller[_0x4adf('0xe')]);router[_0x4adf('0xf')](_0x4adf('0x8'),auth[_0x4adf('0x9')](),controller[_0x4adf('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3ac1=['/:id','show','post','create','put','delete','isAuthenticated','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get'];(function(_0x32b684,_0x323963){var _0x16540f=function(_0x71b2d1){while(--_0x71b2d1){_0x32b684['push'](_0x32b684['shift']());}};_0x16540f(++_0x323963);}(_0x3ac1,0xd9));var _0x13ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x13ac('0x0'));var util=require(_0x13ac('0x1'));var path=require(_0x13ac('0x2'));var timeout=require(_0x13ac('0x3'));var express=require(_0x13ac('0x4'));var router=express['Router']();var auth=require(_0x13ac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x13ac('0x6'));var controller=require('./dashboardItem.controller');router[_0x13ac('0x7')](_0x13ac('0x8'),auth['isAuthenticated'](),controller[_0x13ac('0x9')]);router[_0x13ac('0xa')]('/',auth['isAuthenticated'](),controller[_0x13ac('0xb')]);router[_0x13ac('0xc')](_0x13ac('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x13ac('0xd')](_0x13ac('0x8'),auth[_0x13ac('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index bdc4772..be0ffce 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 _0xf113=['sequelize','exports','STRING'];(function(_0x5bbf70,_0x2f58b3){var _0x397a54=function(_0x4b1bc7){while(--_0x4b1bc7){_0x5bbf70['push'](_0x5bbf70['shift']());}};_0x397a54(++_0x2f58b3);}(_0xf113,0x144));var _0x3f11=function(_0x288920,_0x4ea8a6){_0x288920=_0x288920-0x0;var _0x2f40fd=_0xf113[_0x288920];return _0x2f40fd;};'use strict';var Sequelize=require(_0x3f11('0x0'));module[_0x3f11('0x1')]={'name':{'type':Sequelize[_0x3f11('0x2')],'allowNull':![]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'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 5f794f6..ee164ec 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 _0xbd5a=['filter','map','options','Disposition','findAll','rows','catch','show','params','keys','length','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','model','dateStart','query','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','add','day','merge'];(function(_0x54881c,_0x27751f){var _0x2037aa=function(_0x514821){while(--_0x514821){_0x54881c['push'](_0x54881c['shift']());}};_0x2037aa(++_0x27751f);}(_0xbd5a,0x19a));var _0xabd5=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xbd5a[_0x4709c0];return _0x13348b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xabd5('0x0'));var rimraf=require(_0xabd5('0x1'));var zipdir=require(_0xabd5('0x2'));var jsonpatch=require(_0xabd5('0x3'));var rp=require(_0xabd5('0x4'));var moment=require('moment');var BPromise=require(_0xabd5('0x5'));var Mustache=require(_0xabd5('0x6'));var util=require('util');var path=require('path');var sox=require(_0xabd5('0x7'));var csv=require(_0xabd5('0x8'));var ejs=require(_0xabd5('0x9'));var fs=require('fs');var _=require(_0xabd5('0xa'));var squel=require(_0xabd5('0xb'));var crypto=require('crypto');var jsforce=require(_0xabd5('0xc'));var deskjs=require(_0xabd5('0xd'));var toCsv=require(_0xabd5('0x8'));var querystring=require(_0xabd5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xabd5('0xf'));var logger=require(_0xabd5('0x10'))(_0xabd5('0x11'));var utils=require(_0xabd5('0x12'));var config=require(_0xabd5('0x13'));var db=require(_0xabd5('0x14'))['db'];function respondWithStatusCode(_0x33eb78,_0x105310){_0x105310=_0x105310||0xcc;return function(_0x3e3e5f){if(_0x3e3e5f){return _0x33eb78['sendStatus'](_0x105310);}return _0x33eb78[_0xabd5('0x15')](_0x105310)[_0xabd5('0x16')]();};}function respondWithResult(_0x137e49,_0xaf6b3a){_0xaf6b3a=_0xaf6b3a||0xc8;return function(_0x5cd1d6){if(_0x5cd1d6){return _0x137e49[_0xabd5('0x15')](_0xaf6b3a)['json'](_0x5cd1d6);}};}function respondWithFilteredResult(_0x52e123,_0x244af6){return function(_0x279274){if(_0x279274){var _0x3491db=_0x279274[_0xabd5('0x17')],_0x2e6321=_0x244af6[_0xabd5('0x18')],_0x4826ba=_0x244af6['offset']+_0x244af6[_0xabd5('0x19')],_0x1ea600;if(_0x4826ba>=_0x3491db){_0x4826ba=_0x3491db;_0x1ea600=0xc8;}else{_0x1ea600=0xce;}_0x52e123[_0xabd5('0x15')](_0x1ea600);return _0x52e123[_0xabd5('0x1a')](_0xabd5('0x1b'),_0x2e6321+'-'+_0x4826ba+'/'+_0x3491db)[_0xabd5('0x1c')](_0x279274);}return null;};}function patchUpdates(_0x32b90f){return function(_0x47033f){try{jsonpatch['apply'](_0x47033f,_0x32b90f,!![]);}catch(_0x28b825){return BPromise[_0xabd5('0x1d')](_0x28b825);}return _0x47033f[_0xabd5('0x1e')]();};}function saveUpdates(_0x289ecb,_0x12ef41){return function(_0x447553){if(_0x447553){return _0x447553[_0xabd5('0x1f')](_0x289ecb)[_0xabd5('0x20')](function(_0x16eeeb){return _0x16eeeb;});}return null;};}function removeEntity(_0x2cfa83,_0x4accd5){return function(_0x405ce4){if(_0x405ce4){return _0x405ce4['destroy']()[_0xabd5('0x20')](function(){var _0x267ce4=_0x405ce4[_0xabd5('0x21')]({'plain':!![]});var _0x52595f=_0xabd5('0x22');return db[_0xabd5('0x23')]['destroy']({'where':{'type':_0x52595f,'resourceId':_0x267ce4['id']}})[_0xabd5('0x20')](function(){return _0x405ce4;});})[_0xabd5('0x20')](function(){_0x2cfa83[_0xabd5('0x15')](0xcc)[_0xabd5('0x16')]();});}};}function handleEntityNotFound(_0x4e3a10,_0x9d2aba){return function(_0x1b9790){if(!_0x1b9790){_0x4e3a10[_0xabd5('0x24')](0x194);}return _0x1b9790;};}function handleError(_0x4a1f24,_0x4c26d1){_0x4c26d1=_0x4c26d1||0x1f4;return function(_0x85626e){logger[_0xabd5('0x25')](_0x85626e[_0xabd5('0x26')]);if(_0x85626e[_0xabd5('0x27')]){delete _0x85626e['name'];}_0x4a1f24[_0xabd5('0x15')](_0x4c26d1)[_0xabd5('0x28')](_0x85626e);};}exports[_0xabd5('0x29')]=function(_0x41232b,_0x4ccb97){var _0x1ec318={},_0x5b8ba8={},_0x3d5be4={'count':0x0,'rows':[]};var _0x226ccb=db['Disposition'][_0xabd5('0x2a')];_0x5b8ba8[_0xabd5('0x2b')]=_['keys'](_0x226ccb);var _0x2c22b7={'dateStart':_0x41232b['query'][_0xabd5('0x2c')],'dateEnd':_0x41232b[_0xabd5('0x2d')][_0xabd5('0x2e')]};delete _0x41232b[_0xabd5('0x2d')][_0xabd5('0x2c')];delete _0x41232b[_0xabd5('0x2d')][_0xabd5('0x2e')];_0x5b8ba8[_0xabd5('0x2d')]=_['keys'](_0x41232b[_0xabd5('0x2d')]);_0x5b8ba8['filters']=_[_0xabd5('0x2f')](_0x5b8ba8[_0xabd5('0x2b')],_0x5b8ba8[_0xabd5('0x2d')]);_0x1ec318[_0xabd5('0x30')]=_[_0xabd5('0x2f')](_0x5b8ba8[_0xabd5('0x2b')],qs[_0xabd5('0x31')](_0x41232b[_0xabd5('0x2d')][_0xabd5('0x31')]));_0x1ec318[_0xabd5('0x30')]=_0x1ec318[_0xabd5('0x30')]['length']?_0x1ec318[_0xabd5('0x30')]:_0x5b8ba8[_0xabd5('0x2b')];if(!_0x41232b[_0xabd5('0x2d')][_0xabd5('0x32')](_0xabd5('0x33'))){_0x1ec318[_0xabd5('0x19')]=qs['limit'](_0x41232b['query'][_0xabd5('0x19')]);_0x1ec318[_0xabd5('0x18')]=qs['offset'](_0x41232b[_0xabd5('0x2d')]['offset']);}_0x1ec318[_0xabd5('0x34')]=qs['sort'](_0x41232b[_0xabd5('0x2d')]['sort']);_0x1ec318[_0xabd5('0x35')]=qs[_0xabd5('0x36')](_['pick'](_0x41232b[_0xabd5('0x2d')],_0x5b8ba8[_0xabd5('0x36')]));if(_0x2c22b7[_0xabd5('0x2c')]){if(_0x2c22b7[_0xabd5('0x2e')]){_0x2c22b7[_0xabd5('0x2e')]=moment(_0x2c22b7[_0xabd5('0x2e')])[_0xabd5('0x37')](0x1,_0xabd5('0x38'));}else{_0x2c22b7['dateEnd']=moment(_0x2c22b7['dateStart'])[_0xabd5('0x37')](0x1,'day');}_[_0xabd5('0x39')](_0x1ec318[_0xabd5('0x35')],{'createdAt':{'$gte':_0x2c22b7[_0xabd5('0x2c')],'$lte':_0x2c22b7[_0xabd5('0x2e')]}});}if(_0x41232b[_0xabd5('0x2d')][_0xabd5('0x3a')]){_0x1ec318['where']=_[_0xabd5('0x39')](_0x1ec318[_0xabd5('0x35')],{'$or':_[_0xabd5('0x3b')](_0x1ec318['attributes'],function(_0x444338){var _0x398794={};_0x398794[_0x444338]={'$like':'%'+_0x41232b[_0xabd5('0x2d')][_0xabd5('0x3a')]+'%'};return _0x398794;})});}_0x1ec318=_[_0xabd5('0x39')]({},_0x1ec318,_0x41232b[_0xabd5('0x3c')]);var _0x49da2d={'where':_0x1ec318[_0xabd5('0x35')]};return db['Disposition'][_0xabd5('0x17')](_0x49da2d)[_0xabd5('0x20')](function(_0x44bcbb){_0x3d5be4[_0xabd5('0x17')]=_0x44bcbb;if(_0x41232b['query']['includeAll']){_0x1ec318['include']=[{'all':!![]}];}return db[_0xabd5('0x3d')][_0xabd5('0x3e')](_0x1ec318);})[_0xabd5('0x20')](function(_0x44bb0f){_0x3d5be4[_0xabd5('0x3f')]=_0x44bb0f;return _0x3d5be4;})[_0xabd5('0x20')](respondWithFilteredResult(_0x4ccb97,_0x1ec318))[_0xabd5('0x40')](handleError(_0x4ccb97,null));};exports[_0xabd5('0x41')]=function(_0x1e2722,_0x1095b4){var _0xbd04cf={'raw':!![],'where':{'id':_0x1e2722[_0xabd5('0x42')]['id']}},_0x556128={};_0x556128[_0xabd5('0x2b')]=_['keys'](db[_0xabd5('0x3d')][_0xabd5('0x2a')]);_0x556128['query']=_[_0xabd5('0x43')](_0x1e2722[_0xabd5('0x2d')]);_0x556128['filters']=_[_0xabd5('0x2f')](_0x556128['model'],_0x556128[_0xabd5('0x2d')]);_0xbd04cf[_0xabd5('0x30')]=_[_0xabd5('0x2f')](_0x556128['model'],qs[_0xabd5('0x31')](_0x1e2722[_0xabd5('0x2d')]['fields']));_0xbd04cf[_0xabd5('0x30')]=_0xbd04cf[_0xabd5('0x30')][_0xabd5('0x44')]?_0xbd04cf[_0xabd5('0x30')]:_0x556128[_0xabd5('0x2b')];if(_0x1e2722['query']['includeAll']){_0xbd04cf['include']=[{'all':!![]}];}_0xbd04cf=_[_0xabd5('0x39')]({},_0xbd04cf,_0x1e2722[_0xabd5('0x3c')]);return db['Disposition'][_0xabd5('0x45')](_0xbd04cf)[_0xabd5('0x20')](handleEntityNotFound(_0x1095b4,null))[_0xabd5('0x20')](respondWithResult(_0x1095b4,null))[_0xabd5('0x40')](handleError(_0x1095b4,null));};exports[_0xabd5('0x46')]=function(_0x198329,_0x357eb8){return db[_0xabd5('0x3d')][_0xabd5('0x46')](_0x198329[_0xabd5('0x47')],{})[_0xabd5('0x20')](function(_0x37c28d){var _0xcdc11e=_0x198329[_0xabd5('0x48')]['get']({'plain':!![]});if(!_0xcdc11e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcdc11e[_0xabd5('0x49')]===_0xabd5('0x48')){var _0x29fe96=_0x37c28d['get']({'plain':!![]});var _0x2fd001=_0xabd5('0x22');return db[_0xabd5('0x4a')][_0xabd5('0x45')]({'where':{'name':_0x2fd001,'userProfileId':_0xcdc11e[_0xabd5('0x4b')]},'raw':!![]})[_0xabd5('0x20')](function(_0x4d9034){if(_0x4d9034&&_0x4d9034['autoAssociation']===0x0){return db[_0xabd5('0x23')][_0xabd5('0x46')]({'name':_0x29fe96[_0xabd5('0x27')],'resourceId':_0x29fe96['id'],'type':_0x4d9034[_0xabd5('0x27')],'sectionId':_0x4d9034['id']},{})[_0xabd5('0x20')](function(){return _0x37c28d;});}else{return _0x37c28d;}})[_0xabd5('0x40')](function(_0x1ca468){logger['error'](_0xabd5('0x4c'),_0x1ca468);throw _0x1ca468;});}return _0x37c28d;})['then'](respondWithResult(_0x357eb8,0xc9))['catch'](handleError(_0x357eb8,null));};exports[_0xabd5('0x1f')]=function(_0x48fb32,_0x1ba3ac){if(_0x48fb32[_0xabd5('0x47')]['id']){delete _0x48fb32[_0xabd5('0x47')]['id'];}return db[_0xabd5('0x3d')][_0xabd5('0x45')]({'where':{'id':_0x48fb32['params']['id']}})[_0xabd5('0x20')](handleEntityNotFound(_0x1ba3ac,null))[_0xabd5('0x20')](saveUpdates(_0x48fb32[_0xabd5('0x47')],null))[_0xabd5('0x20')](respondWithResult(_0x1ba3ac,null))[_0xabd5('0x40')](handleError(_0x1ba3ac,null));};exports[_0xabd5('0x4d')]=function(_0x1236a0,_0x5b6657){return db[_0xabd5('0x3d')]['find']({'where':{'id':_0x1236a0[_0xabd5('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b6657,null))[_0xabd5('0x20')](removeEntity(_0x5b6657,null))[_0xabd5('0x40')](handleError(_0x5b6657,null));}; \ No newline at end of file +var _0x6490=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','Dispositions','error','stack','send','index','Disposition','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','add','day','merge','where','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name','html-pdf','eml-format','request-promise','moment','mustache','util','sox','to-csv','lodash','squel'];(function(_0xb18175,_0x2f7cd3){var _0x5542d6=function(_0x1922c2){while(--_0x1922c2){_0xb18175['push'](_0xb18175['shift']());}};_0x5542d6(++_0x2f7cd3);}(_0x6490,0x132));var _0x0649=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x6490[_0x3054be];return _0x3df150;};'use strict';var pdf=require(_0x0649('0x0'));var emlformat=require(_0x0649('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0649('0x2'));var moment=require(_0x0649('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0649('0x4'));var util=require(_0x0649('0x5'));var path=require('path');var sox=require(_0x0649('0x6'));var csv=require(_0x0649('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0649('0x8'));var squel=require(_0x0649('0x9'));var crypto=require(_0x0649('0xa'));var jsforce=require(_0x0649('0xb'));var deskjs=require(_0x0649('0xc'));var toCsv=require(_0x0649('0x7'));var querystring=require(_0x0649('0xd'));var Papa=require(_0x0649('0xe'));var Redis=require(_0x0649('0xf'));var qs=require(_0x0649('0x10'));var logger=require('../../config/logger')(_0x0649('0x11'));var utils=require(_0x0649('0x12'));var config=require(_0x0649('0x13'));var db=require(_0x0649('0x14'))['db'];function respondWithStatusCode(_0x2554cc,_0x12eb36){_0x12eb36=_0x12eb36||0xcc;return function(_0x29981d){if(_0x29981d){return _0x2554cc[_0x0649('0x15')](_0x12eb36);}return _0x2554cc['status'](_0x12eb36)[_0x0649('0x16')]();};}function respondWithResult(_0xf183fc,_0x3d0161){_0x3d0161=_0x3d0161||0xc8;return function(_0xaa26b9){if(_0xaa26b9){return _0xf183fc[_0x0649('0x17')](_0x3d0161)[_0x0649('0x18')](_0xaa26b9);}};}function respondWithFilteredResult(_0x85e123,_0x4e416e){return function(_0x4baa56){if(_0x4baa56){var _0x3cc840=_0x4baa56[_0x0649('0x19')],_0x3d0bce=_0x4e416e['offset'],_0x19b245=_0x4e416e[_0x0649('0x1a')]+_0x4e416e[_0x0649('0x1b')],_0x3fbe8f;if(_0x19b245>=_0x3cc840){_0x19b245=_0x3cc840;_0x3fbe8f=0xc8;}else{_0x3fbe8f=0xce;}_0x85e123[_0x0649('0x17')](_0x3fbe8f);return _0x85e123[_0x0649('0x1c')](_0x0649('0x1d'),_0x3d0bce+'-'+_0x19b245+'/'+_0x3cc840)[_0x0649('0x18')](_0x4baa56);}return null;};}function patchUpdates(_0xe9b267){return function(_0x1b5344){try{jsonpatch[_0x0649('0x1e')](_0x1b5344,_0xe9b267,!![]);}catch(_0x16ac01){return BPromise['reject'](_0x16ac01);}return _0x1b5344['save']();};}function saveUpdates(_0x1d8d3d,_0x337ff2){return function(_0x2a0b12){if(_0x2a0b12){return _0x2a0b12[_0x0649('0x1f')](_0x1d8d3d)[_0x0649('0x20')](function(_0x264617){return _0x264617;});}return null;};}function removeEntity(_0x2fa165,_0x2f3b5a){return function(_0x1044b5){if(_0x1044b5){return _0x1044b5[_0x0649('0x21')]()[_0x0649('0x20')](function(){var _0x3681c7=_0x1044b5[_0x0649('0x22')]({'plain':!![]});var _0x2400e5=_0x0649('0x23');return db['UserProfileResource'][_0x0649('0x21')]({'where':{'type':_0x2400e5,'resourceId':_0x3681c7['id']}})[_0x0649('0x20')](function(){return _0x1044b5;});})[_0x0649('0x20')](function(){_0x2fa165[_0x0649('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x394ebd,_0x30fd02){return function(_0x14aaa1){if(!_0x14aaa1){_0x394ebd['sendStatus'](0x194);}return _0x14aaa1;};}function handleError(_0x3ff3a1,_0x39b980){_0x39b980=_0x39b980||0x1f4;return function(_0x3499aa){logger[_0x0649('0x24')](_0x3499aa[_0x0649('0x25')]);if(_0x3499aa['name']){delete _0x3499aa['name'];}_0x3ff3a1[_0x0649('0x17')](_0x39b980)[_0x0649('0x26')](_0x3499aa);};}exports[_0x0649('0x27')]=function(_0x1c3c94,_0x45c032){var _0x1afc63={},_0x5c66f9={},_0x3261d8={'count':0x0,'rows':[]};var _0x113fe3=db[_0x0649('0x28')]['rawAttributes'];_0x5c66f9[_0x0649('0x29')]=_[_0x0649('0x2a')](_0x113fe3);var _0x9cd703={'dateStart':_0x1c3c94[_0x0649('0x2b')][_0x0649('0x2c')],'dateEnd':_0x1c3c94[_0x0649('0x2b')][_0x0649('0x2d')]};delete _0x1c3c94[_0x0649('0x2b')][_0x0649('0x2c')];delete _0x1c3c94[_0x0649('0x2b')][_0x0649('0x2d')];_0x5c66f9[_0x0649('0x2b')]=_['keys'](_0x1c3c94[_0x0649('0x2b')]);_0x5c66f9[_0x0649('0x2e')]=_['intersection'](_0x5c66f9[_0x0649('0x29')],_0x5c66f9[_0x0649('0x2b')]);_0x1afc63[_0x0649('0x2f')]=_[_0x0649('0x30')](_0x5c66f9['model'],qs['fields'](_0x1c3c94[_0x0649('0x2b')][_0x0649('0x31')]));_0x1afc63[_0x0649('0x2f')]=_0x1afc63[_0x0649('0x2f')][_0x0649('0x32')]?_0x1afc63[_0x0649('0x2f')]:_0x5c66f9[_0x0649('0x29')];if(!_0x1c3c94[_0x0649('0x2b')][_0x0649('0x33')](_0x0649('0x34'))){_0x1afc63['limit']=qs['limit'](_0x1c3c94[_0x0649('0x2b')][_0x0649('0x1b')]);_0x1afc63[_0x0649('0x1a')]=qs[_0x0649('0x1a')](_0x1c3c94['query'][_0x0649('0x1a')]);}_0x1afc63[_0x0649('0x35')]=qs[_0x0649('0x36')](_0x1c3c94[_0x0649('0x2b')][_0x0649('0x36')]);_0x1afc63['where']=qs[_0x0649('0x2e')](_['pick'](_0x1c3c94['query'],_0x5c66f9['filters']));if(_0x9cd703[_0x0649('0x2c')]){if(_0x9cd703['dateEnd']){_0x9cd703[_0x0649('0x2d')]=moment(_0x9cd703[_0x0649('0x2d')])[_0x0649('0x37')](0x1,_0x0649('0x38'));}else{_0x9cd703[_0x0649('0x2d')]=moment(_0x9cd703[_0x0649('0x2c')])['add'](0x1,_0x0649('0x38'));}_[_0x0649('0x39')](_0x1afc63[_0x0649('0x3a')],{'createdAt':{'$gte':_0x9cd703[_0x0649('0x2c')],'$lte':_0x9cd703['dateEnd']}});}if(_0x1c3c94[_0x0649('0x2b')]['filter']){_0x1afc63[_0x0649('0x3a')]=_[_0x0649('0x39')](_0x1afc63[_0x0649('0x3a')],{'$or':_['map'](_0x1afc63['attributes'],function(_0x58d477){var _0x34ffec={};_0x34ffec[_0x58d477]={'$like':'%'+_0x1c3c94[_0x0649('0x2b')]['filter']+'%'};return _0x34ffec;})});}_0x1afc63=_['merge']({},_0x1afc63,_0x1c3c94[_0x0649('0x3b')]);var _0xd7841f={'where':_0x1afc63['where']};return db[_0x0649('0x28')][_0x0649('0x19')](_0xd7841f)[_0x0649('0x20')](function(_0x32fddb){_0x3261d8[_0x0649('0x19')]=_0x32fddb;if(_0x1c3c94['query'][_0x0649('0x3c')]){_0x1afc63[_0x0649('0x3d')]=[{'all':!![]}];}return db[_0x0649('0x28')][_0x0649('0x3e')](_0x1afc63);})[_0x0649('0x20')](function(_0x535120){_0x3261d8[_0x0649('0x3f')]=_0x535120;return _0x3261d8;})['then'](respondWithFilteredResult(_0x45c032,_0x1afc63))[_0x0649('0x40')](handleError(_0x45c032,null));};exports[_0x0649('0x41')]=function(_0x514710,_0x4a23a2){var _0x50d2fb={'raw':!![],'where':{'id':_0x514710[_0x0649('0x42')]['id']}},_0x54caeb={};_0x54caeb[_0x0649('0x29')]=_[_0x0649('0x2a')](db['Disposition'][_0x0649('0x43')]);_0x54caeb['query']=_[_0x0649('0x2a')](_0x514710['query']);_0x54caeb[_0x0649('0x2e')]=_[_0x0649('0x30')](_0x54caeb['model'],_0x54caeb[_0x0649('0x2b')]);_0x50d2fb[_0x0649('0x2f')]=_['intersection'](_0x54caeb[_0x0649('0x29')],qs[_0x0649('0x31')](_0x514710[_0x0649('0x2b')]['fields']));_0x50d2fb[_0x0649('0x2f')]=_0x50d2fb[_0x0649('0x2f')][_0x0649('0x32')]?_0x50d2fb[_0x0649('0x2f')]:_0x54caeb[_0x0649('0x29')];if(_0x514710[_0x0649('0x2b')]['includeAll']){_0x50d2fb[_0x0649('0x3d')]=[{'all':!![]}];}_0x50d2fb=_['merge']({},_0x50d2fb,_0x514710[_0x0649('0x3b')]);return db[_0x0649('0x28')][_0x0649('0x44')](_0x50d2fb)[_0x0649('0x20')](handleEntityNotFound(_0x4a23a2,null))[_0x0649('0x20')](respondWithResult(_0x4a23a2,null))['catch'](handleError(_0x4a23a2,null));};exports[_0x0649('0x45')]=function(_0x5d88d5,_0x4e6e55){return db[_0x0649('0x28')]['create'](_0x5d88d5[_0x0649('0x46')],{})[_0x0649('0x20')](function(_0x254819){var _0x1605d0=_0x5d88d5[_0x0649('0x47')]['get']({'plain':!![]});if(!_0x1605d0)throw new Error(_0x0649('0x48'));if(_0x1605d0[_0x0649('0x49')]===_0x0649('0x47')){var _0x951cbb=_0x254819['get']({'plain':!![]});var _0x354d70=_0x0649('0x23');return db[_0x0649('0x4a')][_0x0649('0x44')]({'where':{'name':_0x354d70,'userProfileId':_0x1605d0[_0x0649('0x4b')]},'raw':!![]})[_0x0649('0x20')](function(_0x4d1a4c){if(_0x4d1a4c&&_0x4d1a4c[_0x0649('0x4c')]===0x0){return db[_0x0649('0x4d')][_0x0649('0x45')]({'name':_0x951cbb[_0x0649('0x4e')],'resourceId':_0x951cbb['id'],'type':_0x4d1a4c['name'],'sectionId':_0x4d1a4c['id']},{})[_0x0649('0x20')](function(){return _0x254819;});}else{return _0x254819;}})['catch'](function(_0x20501d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20501d);throw _0x20501d;});}return _0x254819;})['then'](respondWithResult(_0x4e6e55,0xc9))[_0x0649('0x40')](handleError(_0x4e6e55,null));};exports[_0x0649('0x1f')]=function(_0x2e8d8a,_0x30b21a){if(_0x2e8d8a[_0x0649('0x46')]['id']){delete _0x2e8d8a[_0x0649('0x46')]['id'];}return db[_0x0649('0x28')]['find']({'where':{'id':_0x2e8d8a[_0x0649('0x42')]['id']}})[_0x0649('0x20')](handleEntityNotFound(_0x30b21a,null))[_0x0649('0x20')](saveUpdates(_0x2e8d8a[_0x0649('0x46')],null))['then'](respondWithResult(_0x30b21a,null))[_0x0649('0x40')](handleError(_0x30b21a,null));};exports['destroy']=function(_0x412b9b,_0x513560){return db[_0x0649('0x28')][_0x0649('0x44')]({'where':{'id':_0x412b9b[_0x0649('0x42')]['id']}})[_0x0649('0x20')](handleEntityNotFound(_0x513560,null))[_0x0649('0x20')](removeEntity(_0x513560,null))['catch'](handleError(_0x513560,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 282ef96..a46a989 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 _0x5f66=['FaxAccountId','OpenchannelAccountId','util','api','moment','bluebird','request-promise','./disposition.attributes','define','Disposition','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax'];(function(_0x4b5409,_0x472b71){var _0x90b623=function(_0x596445){while(--_0x596445){_0x4b5409['push'](_0x4b5409['shift']());}};_0x90b623(++_0x472b71);}(_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':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x65f6('0x8'),_0x65f6('0x9')]},{'unique':!![],'name':_0x65f6('0xa'),'fields':[_0x65f6('0x8'),_0x65f6('0xb')]},{'unique':!![],'name':_0x65f6('0xc'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x65f6('0xd'),'fields':[_0x65f6('0x8'),_0x65f6('0xe')]},{'unique':!![],'name':_0x65f6('0xf'),'fields':['name',_0x65f6('0x10')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0x65f6('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['Disposition','tools_dispositions','name_voice','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','lodash','../../config/logger','moment','bluebird','request-promise','./disposition.attributes','exports','define'];(function(_0x297ec5,_0x860cf4){var _0x367d44=function(_0x1d96b3){while(--_0x1d96b3){_0x297ec5['push'](_0x297ec5['shift']());}};_0x367d44(++_0x860cf4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x0b0e[_0x5627e1];return _0x2f013f;};'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':[{'unique':!![],'name':_0xe0b0('0xa'),'fields':['name','ListId']},{'unique':!![],'name':_0xe0b0('0xb'),'fields':[_0xe0b0('0xc'),_0xe0b0('0xd')]},{'unique':!![],'name':_0xe0b0('0xe'),'fields':['name',_0xe0b0('0xf')]},{'unique':!![],'name':_0xe0b0('0x10'),'fields':['name',_0xe0b0('0x11')]},{'unique':!![],'name':_0xe0b0('0x12'),'fields':['name',_0xe0b0('0x13')]},{'unique':!![],'name':_0xe0b0('0x14'),'fields':[_0xe0b0('0xc'),'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 0b9d51a..1fa197b 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 _0xd101=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x26bd50,_0x46b714){var _0x65c376=function(_0x5bedf8){while(--_0x5bedf8){_0x26bd50['push'](_0x26bd50['shift']());}};_0x65c376(++_0x46b714);}(_0xd101,0xc1));var _0x1d10=function(_0x36f7ba,_0x5f1665){_0x36f7ba=_0x36f7ba-0x0;var _0x50bab7=_0xd101[_0x36f7ba];return _0x50bab7;};'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 +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x53ec,0x192));var _0xc53e=function(_0x3f4568,_0x9eb0ee){_0x3f4568=_0x3f4568-0x0;var _0xee2340=_0x53ec[_0x3f4568];return _0xee2340;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Disposition,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 197b61a..65b3c2e 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 _0xbd01=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports'];(function(_0x20b1a6,_0x436c30){var _0x2ab37a=function(_0x8fd1cd){while(--_0x8fd1cd){_0x20b1a6['push'](_0x20b1a6['shift']());}};_0x2ab37a(++_0x436c30);}(_0xbd01,0xa2));var _0x1bd0=function(_0x37e6f7,_0x260a68){_0x37e6f7=_0x37e6f7-0x0;var _0x4d6eeb=_0xbd01[_0x37e6f7];return _0x4d6eeb;};'use strict';var multer=require(_0x1bd0('0x0'));var util=require(_0x1bd0('0x1'));var path=require(_0x1bd0('0x2'));var timeout=require(_0x1bd0('0x3'));var express=require(_0x1bd0('0x4'));var router=express[_0x1bd0('0x5')]();var auth=require(_0x1bd0('0x6'));var interaction=require(_0x1bd0('0x7'));var config=require(_0x1bd0('0x8'));var controller=require('./disposition.controller');router[_0x1bd0('0x9')]('/',auth[_0x1bd0('0xa')](),controller[_0x1bd0('0xb')]);router[_0x1bd0('0x9')](_0x1bd0('0xc'),auth[_0x1bd0('0xa')](),controller['show']);router[_0x1bd0('0xd')]('/',auth[_0x1bd0('0xa')](),controller[_0x1bd0('0xe')]);router['put'](_0x1bd0('0xc'),auth[_0x1bd0('0xa')](),controller['update']);router[_0x1bd0('0xf')](_0x1bd0('0xc'),auth[_0x1bd0('0xa')](),controller[_0x1bd0('0x10')]);module[_0x1bd0('0x11')]=router; \ No newline at end of file +var _0x90b8=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','post','isAuthenticated','put','/:id','update','util','path'];(function(_0x31fae3,_0x2bc2f2){var _0x453cc4=function(_0x1944d6){while(--_0x1944d6){_0x31fae3['push'](_0x31fae3['shift']());}};_0x453cc4(++_0x2bc2f2);}(_0x90b8,0x129));var _0x890b=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0x90b8[_0x390733];return _0x33beb9;};'use strict';var multer=require('multer');var util=require(_0x890b('0x0'));var path=require(_0x890b('0x1'));var timeout=require('connect-timeout');var express=require(_0x890b('0x2'));var router=express['Router']();var auth=require(_0x890b('0x3'));var interaction=require(_0x890b('0x4'));var config=require(_0x890b('0x5'));var controller=require(_0x890b('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x890b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x890b('0x8')]('/',auth[_0x890b('0x9')](),controller['create']);router[_0x890b('0xa')](_0x890b('0xb'),auth['isAuthenticated'](),controller[_0x890b('0xc')]);router['delete'](_0x890b('0xb'),auth[_0x890b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 15983b9..7bff597 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 _0xb027=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb027,0x111));var _0x7b02=function(_0x2a2f8b,_0x4300d2){_0x2a2f8b=_0x2a2f8b-0x0;var _0x3a6017=_0xb027[_0x2a2f8b];return _0x3a6017;};'use strict';var Sequelize=require(_0x7b02('0x0'));module[_0x7b02('0x1')]={'name':{'type':Sequelize[_0x7b02('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7b02('0x2')]},'ecm':{'type':Sequelize[_0x7b02('0x3')]('yes','no'),'defaultValue':_0x7b02('0x4')},'headerinfo':{'type':Sequelize[_0x7b02('0x2')],'defaultValue':_0x7b02('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x7b02('0x6')},'minrate':{'type':Sequelize[_0x7b02('0x3')](_0x7b02('0x7'),_0x7b02('0x8'),'7200',_0x7b02('0x9'),_0x7b02('0xa'),_0x7b02('0xb')),'defaultValue':_0x7b02('0x8')},'maxrate':{'type':Sequelize[_0x7b02('0x3')]('2400',_0x7b02('0x8'),_0x7b02('0xc'),'9600','12000',_0x7b02('0xb')),'defaultValue':_0x7b02('0xb')},'modem':{'type':Sequelize[_0x7b02('0x2')],'defaultValue':_0x7b02('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7b02('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7b02('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7b02('0x3')](_0x7b02('0xf'),_0x7b02('0x10'),_0x7b02('0x11'),'KHOMP'),'defaultValue':_0x7b02('0xf')},'key':{'type':Sequelize[_0x7b02('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7b02('0x12')],'defaultValue':function(){return _0x7b02('0x13');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7b02('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7b02('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7b02('0xe')],'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 _0x47c7=['4800','7200','9600','12000','14400','2400','INTEGER','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','exports','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x47c7,0x1f3));var _0x747c=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x47c7[_0x164af1];return _0x5d81a2;};'use strict';var Sequelize=require('sequelize');module[_0x747c('0x0')]={'name':{'type':Sequelize[_0x747c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x747c('0x1')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x747c('0x2')},'headerinfo':{'type':Sequelize[_0x747c('0x1')],'defaultValue':_0x747c('0x3')},'localstationid':{'type':Sequelize[_0x747c('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x747c('0x4')]('2400',_0x747c('0x5'),_0x747c('0x6'),_0x747c('0x7'),_0x747c('0x8'),_0x747c('0x9')),'defaultValue':_0x747c('0x5')},'maxrate':{'type':Sequelize[_0x747c('0x4')](_0x747c('0xa'),_0x747c('0x5'),_0x747c('0x6'),_0x747c('0x7'),_0x747c('0x8'),_0x747c('0x9')),'defaultValue':_0x747c('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x747c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x747c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x747c('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x747c('0x4')]('SIP','IAX',_0x747c('0xc'),_0x747c('0xd')),'defaultValue':_0x747c('0xe')},'key':{'type':Sequelize[_0x747c('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x747c('0xf')],'defaultValue':function(){return _0x747c('0x10');}},'notificationSound':{'type':Sequelize[_0x747c('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x747c('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x747c('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x747c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x747c('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x747c('0xb')],'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 c2806a7..34bdeaf 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 _0x05d5=['papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','get','FaxAccounts','UserProfileResource','stack','name','send','index','FaxAccount','query','dateEnd','dateStart','keys','intersection','model','fields','attributes','length','limit','sort','pick','filters','add','day','merge','filter','where','map','options','includeAll','include','findAll','show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','params','destroy','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','order','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','omit','FaxInteraction','Contact','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','type','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','hasOwnProperty','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Set','Wait','ReceiveFax','addAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','List','CmContact','Contacts','DESC','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1f1a63,_0x3b5924){var _0x21492a=function(_0x56c789){while(--_0x56c789){_0x1f1a63['push'](_0x1f1a63['shift']());}};_0x21492a(++_0x3b5924);}(_0x05d5,0x16e));var _0x505d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x05d5[_0x432682];return _0x463d05;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x505d('0x0'));var rimraf=require(_0x505d('0x1'));var zipdir=require(_0x505d('0x2'));var jsonpatch=require(_0x505d('0x3'));var rp=require(_0x505d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x505d('0x5'));var path=require(_0x505d('0x6'));var sox=require(_0x505d('0x7'));var csv=require(_0x505d('0x8'));var ejs=require(_0x505d('0x9'));var fs=require('fs');var _=require(_0x505d('0xa'));var squel=require(_0x505d('0xb'));var crypto=require(_0x505d('0xc'));var jsforce=require(_0x505d('0xd'));var deskjs=require(_0x505d('0xe'));var toCsv=require(_0x505d('0x8'));var querystring=require(_0x505d('0xf'));var Papa=require(_0x505d('0x10'));var Redis=require(_0x505d('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x505d('0x12'))(_0x505d('0x13'));var utils=require(_0x505d('0x14'));var config=require(_0x505d('0x15'));var db=require('../../mysqldb')['db'];config[_0x505d('0x16')]=_[_0x505d('0x17')](config[_0x505d('0x16')],{'host':_0x505d('0x18'),'port':0x18eb});var socket=require(_0x505d('0x19'))(new Redis(config[_0x505d('0x16')]));require(_0x505d('0x1a'))[_0x505d('0x1b')](socket);var jayson=require(_0x505d('0x1c'));var client=jayson[_0x505d('0x1d')][_0x505d('0x1e')]({'port':0x232c});var client9002=jayson[_0x505d('0x1d')][_0x505d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2e1f4f,_0x4bdd6a,_0x289ff3,_0x3cf960){return new BPromise(function(_0x1f92a2,_0x4236c){var _0x4b6195=_0x3cf960||client;return _0x4b6195['request'](_0x2e1f4f,_0x289ff3)[_0x505d('0x1f')](function(_0x5ec12a){logger[_0x505d('0x20')](_0x505d('0x21'),_0x4bdd6a,_0x505d('0x22'));logger[_0x505d('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4bdd6a,'request\x20sent',JSON['stringify'](_0x5ec12a));if(_0x5ec12a[_0x505d('0x24')]){if(_0x5ec12a[_0x505d('0x24')][_0x505d('0x25')]===0x1f4){logger[_0x505d('0x24')]('FaxAccount,\x20%s,\x20%s',_0x4bdd6a,_0x5ec12a['error'][_0x505d('0x26')]);return _0x4236c(_0x5ec12a[_0x505d('0x24')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x4bdd6a,_0x5ec12a[_0x505d('0x24')][_0x505d('0x26')]);return _0x1f92a2(_0x5ec12a[_0x505d('0x24')][_0x505d('0x26')]);}else{logger[_0x505d('0x20')](_0x505d('0x21'),_0x4bdd6a,_0x505d('0x22'));_0x1f92a2(_0x5ec12a[_0x505d('0x27')]['message']);}})[_0x505d('0x28')](function(_0x152afb){logger[_0x505d('0x24')]('FaxAccount,\x20%s,\x20%s',_0x4bdd6a,_0x152afb);_0x4236c(_0x152afb);});});}function respondWithStatusCode(_0x16bd5b,_0x3efd2b){_0x3efd2b=_0x3efd2b||0xcc;return function(_0x1640f0){if(_0x1640f0){return _0x16bd5b[_0x505d('0x29')](_0x3efd2b);}return _0x16bd5b[_0x505d('0x2a')](_0x3efd2b)[_0x505d('0x2b')]();};}function respondWithResult(_0x15fa2b,_0x367b9a){_0x367b9a=_0x367b9a||0xc8;return function(_0x30fbd2){if(_0x30fbd2){return _0x15fa2b[_0x505d('0x2a')](_0x367b9a)['json'](_0x30fbd2);}};}function respondWithFilteredResult(_0x22a407,_0x819f0d){return function(_0x143088){if(_0x143088){var _0x4cd1b1=_0x143088[_0x505d('0x2c')],_0x28f211=_0x819f0d[_0x505d('0x2d')],_0x51406d=_0x819f0d[_0x505d('0x2d')]+_0x819f0d['limit'],_0x4d4f93;if(_0x51406d>=_0x4cd1b1){_0x51406d=_0x4cd1b1;_0x4d4f93=0xc8;}else{_0x4d4f93=0xce;}_0x22a407['status'](_0x4d4f93);return _0x22a407[_0x505d('0x2e')](_0x505d('0x2f'),_0x28f211+'-'+_0x51406d+'/'+_0x4cd1b1)[_0x505d('0x30')](_0x143088);}return null;};}function patchUpdates(_0x50a414){return function(_0x1b8380){try{jsonpatch[_0x505d('0x31')](_0x1b8380,_0x50a414,!![]);}catch(_0x4b2e0a){return BPromise[_0x505d('0x32')](_0x4b2e0a);}return _0x1b8380['save']();};}function saveUpdates(_0x342125,_0x4111b0){return function(_0x13b0be){if(_0x13b0be){return _0x13b0be['update'](_0x342125)['then'](function(_0x115494){return _0x115494;});}return null;};}function removeEntity(_0x313f1c,_0x56ef6d){return function(_0x338648){if(_0x338648){return _0x338648['destroy']()['then'](function(){var _0x3b2538=_0x338648[_0x505d('0x33')]({'plain':!![]});var _0x188153=_0x505d('0x34');return db[_0x505d('0x35')]['destroy']({'where':{'type':_0x188153,'resourceId':_0x3b2538['id']}})[_0x505d('0x1f')](function(){return _0x338648;});})[_0x505d('0x1f')](function(){_0x313f1c[_0x505d('0x2a')](0xcc)[_0x505d('0x2b')]();});}};}function handleEntityNotFound(_0x5f298c,_0xb4d442){return function(_0x599633){if(!_0x599633){_0x5f298c[_0x505d('0x29')](0x194);}return _0x599633;};}function handleError(_0x29e797,_0x9e7b05){_0x9e7b05=_0x9e7b05||0x1f4;return function(_0x549e80){logger[_0x505d('0x24')](_0x549e80[_0x505d('0x36')]);if(_0x549e80['name']){delete _0x549e80[_0x505d('0x37')];}_0x29e797['status'](_0x9e7b05)[_0x505d('0x38')](_0x549e80);};}exports[_0x505d('0x39')]=function(_0x56d9be,_0x5f03d2){var _0x5edcf2={},_0xdecd01={},_0x190eec={'count':0x0,'rows':[]};var _0x274d0b=db[_0x505d('0x3a')]['rawAttributes'];_0xdecd01['model']=_['keys'](_0x274d0b);var _0x135d24={'dateStart':_0x56d9be[_0x505d('0x3b')]['dateStart'],'dateEnd':_0x56d9be[_0x505d('0x3b')][_0x505d('0x3c')]};delete _0x56d9be['query'][_0x505d('0x3d')];delete _0x56d9be[_0x505d('0x3b')][_0x505d('0x3c')];_0xdecd01[_0x505d('0x3b')]=_[_0x505d('0x3e')](_0x56d9be[_0x505d('0x3b')]);_0xdecd01['filters']=_[_0x505d('0x3f')](_0xdecd01[_0x505d('0x40')],_0xdecd01[_0x505d('0x3b')]);_0x5edcf2['attributes']=_[_0x505d('0x3f')](_0xdecd01[_0x505d('0x40')],qs['fields'](_0x56d9be[_0x505d('0x3b')][_0x505d('0x41')]));_0x5edcf2[_0x505d('0x42')]=_0x5edcf2[_0x505d('0x42')][_0x505d('0x43')]?_0x5edcf2[_0x505d('0x42')]:_0xdecd01[_0x505d('0x40')];if(!_0x56d9be[_0x505d('0x3b')]['hasOwnProperty']('nolimit')){_0x5edcf2['limit']=qs[_0x505d('0x44')](_0x56d9be[_0x505d('0x3b')][_0x505d('0x44')]);_0x5edcf2[_0x505d('0x2d')]=qs[_0x505d('0x2d')](_0x56d9be[_0x505d('0x3b')][_0x505d('0x2d')]);}_0x5edcf2['order']=qs[_0x505d('0x45')](_0x56d9be['query'][_0x505d('0x45')]);_0x5edcf2['where']=qs['filters'](_[_0x505d('0x46')](_0x56d9be[_0x505d('0x3b')],_0xdecd01[_0x505d('0x47')]));if(_0x135d24[_0x505d('0x3d')]){if(_0x135d24['dateEnd']){_0x135d24['dateEnd']=moment(_0x135d24[_0x505d('0x3c')])[_0x505d('0x48')](0x1,_0x505d('0x49'));}else{_0x135d24[_0x505d('0x3c')]=moment(_0x135d24[_0x505d('0x3d')])['add'](0x1,'day');}_[_0x505d('0x4a')](_0x5edcf2['where'],{'createdAt':{'$gte':_0x135d24[_0x505d('0x3d')],'$lte':_0x135d24[_0x505d('0x3c')]}});}if(_0x56d9be[_0x505d('0x3b')][_0x505d('0x4b')]){_0x5edcf2[_0x505d('0x4c')]=_[_0x505d('0x4a')](_0x5edcf2[_0x505d('0x4c')],{'$or':_[_0x505d('0x4d')](_0x5edcf2[_0x505d('0x42')],function(_0x224d84){var _0x5089a9={};_0x5089a9[_0x224d84]={'$like':'%'+_0x56d9be[_0x505d('0x3b')][_0x505d('0x4b')]+'%'};return _0x5089a9;})});}_0x5edcf2=_[_0x505d('0x4a')]({},_0x5edcf2,_0x56d9be[_0x505d('0x4e')]);var _0x5b95f6={'where':_0x5edcf2[_0x505d('0x4c')]};return db[_0x505d('0x3a')][_0x505d('0x2c')](_0x5b95f6)[_0x505d('0x1f')](function(_0x56b00b){_0x190eec['count']=_0x56b00b;if(_0x56d9be['query'][_0x505d('0x4f')]){_0x5edcf2[_0x505d('0x50')]=[{'all':!![]}];}return db[_0x505d('0x3a')][_0x505d('0x51')](_0x5edcf2);})[_0x505d('0x1f')](function(_0x237981){_0x190eec['rows']=_0x237981;return _0x190eec;})[_0x505d('0x1f')](respondWithFilteredResult(_0x5f03d2,_0x5edcf2))['catch'](handleError(_0x5f03d2,null));};exports[_0x505d('0x52')]=function(_0x1d17cf,_0x135053){var _0x14ab9e={'raw':![],'where':{'id':_0x1d17cf['params']['id']}},_0x483af1={};_0x483af1[_0x505d('0x40')]=_[_0x505d('0x3e')](db['FaxAccount'][_0x505d('0x53')]);_0x483af1['query']=_['keys'](_0x1d17cf[_0x505d('0x3b')]);_0x483af1[_0x505d('0x47')]=_['intersection'](_0x483af1['model'],_0x483af1[_0x505d('0x3b')]);_0x14ab9e[_0x505d('0x42')]=_[_0x505d('0x3f')](_0x483af1[_0x505d('0x40')],qs['fields'](_0x1d17cf[_0x505d('0x3b')]['fields']));_0x14ab9e[_0x505d('0x42')]=_0x14ab9e[_0x505d('0x42')][_0x505d('0x43')]?_0x14ab9e[_0x505d('0x42')]:_0x483af1['model'];if(_0x1d17cf[_0x505d('0x3b')][_0x505d('0x4f')]){_0x14ab9e[_0x505d('0x50')]=[{'all':!![]}];}_0x14ab9e=_[_0x505d('0x4a')]({},_0x14ab9e,_0x1d17cf[_0x505d('0x4e')]);return db[_0x505d('0x3a')]['find'](_0x14ab9e)[_0x505d('0x1f')](handleEntityNotFound(_0x135053,null))[_0x505d('0x1f')](respondWithResult(_0x135053,null))[_0x505d('0x28')](handleError(_0x135053,null));};exports['create']=function(_0x50a938,_0x213c2a){return db[_0x505d('0x3a')][_0x505d('0x54')](_0x50a938[_0x505d('0x55')],{})[_0x505d('0x1f')](function(_0x14ea39){var _0x43ec5e=_0x50a938[_0x505d('0x56')][_0x505d('0x33')]({'plain':!![]});if(!_0x43ec5e)throw new Error(_0x505d('0x57'));if(_0x43ec5e[_0x505d('0x58')]===_0x505d('0x56')){var _0x2f0aa0=_0x14ea39['get']({'plain':!![]});var _0x480313=_0x505d('0x34');return db[_0x505d('0x59')][_0x505d('0x5a')]({'where':{'name':_0x480313,'userProfileId':_0x43ec5e[_0x505d('0x5b')]},'raw':!![]})[_0x505d('0x1f')](function(_0x50304f){if(_0x50304f&&_0x50304f['autoAssociation']===0x0){return db[_0x505d('0x35')][_0x505d('0x54')]({'name':_0x2f0aa0[_0x505d('0x37')],'resourceId':_0x2f0aa0['id'],'type':_0x50304f['name'],'sectionId':_0x50304f['id']},{})[_0x505d('0x1f')](function(){return _0x14ea39;});}else{return _0x14ea39;}})[_0x505d('0x28')](function(_0x5f23b6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f23b6);throw _0x5f23b6;});}return _0x14ea39;})[_0x505d('0x1f')](respondWithResult(_0x213c2a,0xc9))['catch'](handleError(_0x213c2a,null));};exports[_0x505d('0x5c')]=function(_0x4db194,_0x5c0bed){if(_0x4db194['body']['id']){delete _0x4db194[_0x505d('0x55')]['id'];}return db[_0x505d('0x3a')][_0x505d('0x5a')]({'where':{'id':_0x4db194[_0x505d('0x5d')]['id']}})[_0x505d('0x1f')](handleEntityNotFound(_0x5c0bed,null))[_0x505d('0x1f')](saveUpdates(_0x4db194[_0x505d('0x55')],null))[_0x505d('0x1f')](respondWithResult(_0x5c0bed,null))[_0x505d('0x28')](handleError(_0x5c0bed,null));};exports[_0x505d('0x5e')]=function(_0x45a568,_0x9f7285){return db['FaxAccount'][_0x505d('0x5a')]({'where':{'id':_0x45a568[_0x505d('0x5d')]['id']}})[_0x505d('0x1f')](handleEntityNotFound(_0x9f7285,null))[_0x505d('0x1f')](removeEntity(_0x9f7285,null))[_0x505d('0x28')](handleError(_0x9f7285,null));};exports[_0x505d('0x5f')]=function(_0x3b5c60,_0x43143e){return db['FaxAccount']['describe']()[_0x505d('0x1f')](respondWithResult(_0x43143e,null))['catch'](handleError(_0x43143e,null));};exports[_0x505d('0x60')]=function(_0x5aa966,_0x1a76cb,_0x2f025e){if(_0x5aa966['body']['id']){delete _0x5aa966[_0x505d('0x55')]['id'];}return db[_0x505d('0x3a')][_0x505d('0x5a')]({'where':{'id':_0x5aa966[_0x505d('0x5d')]['id']}})[_0x505d('0x1f')](handleEntityNotFound(_0x1a76cb,null))['then'](function(_0x16dfc9){if(_0x16dfc9){_0x5aa966[_0x505d('0x55')][_0x505d('0x61')]=_0x16dfc9['id'];return db[_0x505d('0x62')][_0x505d('0x54')](_0x5aa966[_0x505d('0x55')]);}})[_0x505d('0x1f')](respondWithResult(_0x1a76cb,null))['catch'](handleError(_0x1a76cb,null));};exports[_0x505d('0x63')]=function(_0x4e9dae,_0x17fb42,_0x11a8ab){var _0x43b183={'raw':![],'where':{}};var _0x3d4951={};var _0x2dc83c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x505d('0x64')]({'where':{'id':_0x4e9dae['params']['id']}})[_0x505d('0x1f')](handleEntityNotFound(_0x17fb42,null))[_0x505d('0x1f')](function(_0x58e19d){if(_0x58e19d){_0x3d4951[_0x505d('0x40')]=_['keys'](db['Disposition'][_0x505d('0x53')]);_0x3d4951[_0x505d('0x3b')]=_[_0x505d('0x3e')](_0x4e9dae[_0x505d('0x3b')]);_0x3d4951[_0x505d('0x47')]=_[_0x505d('0x3f')](_0x3d4951['model'],_0x3d4951[_0x505d('0x3b')]);_0x43b183[_0x505d('0x42')]=_[_0x505d('0x3f')](_0x3d4951[_0x505d('0x40')],qs[_0x505d('0x41')](_0x4e9dae[_0x505d('0x3b')][_0x505d('0x41')]));_0x43b183[_0x505d('0x42')]=_0x43b183[_0x505d('0x42')][_0x505d('0x43')]?_0x43b183[_0x505d('0x42')]:_0x3d4951['model'];if(!_0x4e9dae['query']['hasOwnProperty'](_0x505d('0x65'))){_0x43b183['limit']=qs[_0x505d('0x44')](_0x4e9dae[_0x505d('0x3b')][_0x505d('0x44')]);_0x43b183[_0x505d('0x2d')]=qs[_0x505d('0x2d')](_0x4e9dae[_0x505d('0x3b')][_0x505d('0x2d')]);}_0x43b183[_0x505d('0x66')]=qs[_0x505d('0x45')](_0x4e9dae['query'][_0x505d('0x45')]);_0x43b183[_0x505d('0x4c')]=qs[_0x505d('0x47')](_['pick'](_0x4e9dae[_0x505d('0x3b')],_0x3d4951[_0x505d('0x47')]));_0x43b183['where'][_0x505d('0x61')]=_0x58e19d['id'];if(_0x4e9dae[_0x505d('0x3b')][_0x505d('0x4b')]){_0x43b183[_0x505d('0x4c')]=_[_0x505d('0x4a')](_0x43b183[_0x505d('0x4c')],{'$or':_['map'](_0x43b183[_0x505d('0x42')],function(_0x20278c){var _0x5d4345={};_0x5d4345[_0x20278c]={'$like':'%'+_0x4e9dae[_0x505d('0x3b')][_0x505d('0x4b')]+'%'};return _0x5d4345;})});}_0x43b183=_[_0x505d('0x4a')]({},_0x43b183,_0x4e9dae[_0x505d('0x4e')]);return db[_0x505d('0x62')]['count']({'where':_0x43b183['where']})['then'](function(_0x69fe76){_0x2dc83c[_0x505d('0x2c')]=_0x69fe76;if(_0x4e9dae[_0x505d('0x3b')][_0x505d('0x4f')]){_0x43b183[_0x505d('0x50')]=[{'all':!![]}];}return db['Disposition'][_0x505d('0x51')](_0x43b183);})[_0x505d('0x1f')](function(_0x302fc9){_0x2dc83c[_0x505d('0x67')]=_0x302fc9;return _0x2dc83c;});}})['then'](respondWithFilteredResult(_0x17fb42,_0x43b183))[_0x505d('0x28')](handleError(_0x17fb42,null));};exports['removeDispositions']=function(_0x2be959,_0x3d2597,_0x183470){var _0x8baffb;return db[_0x505d('0x3a')]['find']({'where':{'id':_0x2be959[_0x505d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3d2597,null))[_0x505d('0x1f')](function(_0x556492){if(_0x556492){return _0x556492[_0x505d('0x68')](_0x2be959[_0x505d('0x3b')][_0x505d('0x69')]);}})[_0x505d('0x1f')](respondWithStatusCode(_0x3d2597,null))[_0x505d('0x28')](handleError(_0x3d2597,null));};exports[_0x505d('0x6a')]=function(_0x39658c,_0x343088,_0x4b8575){if(_0x39658c[_0x505d('0x55')]['id']){delete _0x39658c[_0x505d('0x55')]['id'];}return db[_0x505d('0x3a')][_0x505d('0x5a')]({'where':{'id':_0x39658c[_0x505d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x343088,null))[_0x505d('0x1f')](function(_0x3b1d7a){if(_0x3b1d7a){_0x39658c[_0x505d('0x55')][_0x505d('0x61')]=_0x3b1d7a['id'];return db['CannedAnswer']['create'](_0x39658c[_0x505d('0x55')]);}})[_0x505d('0x1f')](respondWithResult(_0x343088,null))[_0x505d('0x28')](handleError(_0x343088,null));};exports[_0x505d('0x6b')]=function(_0x19fd6f,_0x1946a5,_0x675c7f){var _0x448204={'raw':![],'where':{}};var _0x5b8526={};var _0x20f09c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x505d('0x64')]({'where':{'id':_0x19fd6f[_0x505d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1946a5,null))['then'](function(_0x648306){if(_0x648306){_0x5b8526[_0x505d('0x40')]=_['keys'](db[_0x505d('0x6c')][_0x505d('0x53')]);_0x5b8526[_0x505d('0x3b')]=_[_0x505d('0x3e')](_0x19fd6f['query']);_0x5b8526[_0x505d('0x47')]=_['intersection'](_0x5b8526['model'],_0x5b8526[_0x505d('0x3b')]);_0x448204['attributes']=_[_0x505d('0x3f')](_0x5b8526['model'],qs['fields'](_0x19fd6f[_0x505d('0x3b')]['fields']));_0x448204[_0x505d('0x42')]=_0x448204[_0x505d('0x42')]['length']?_0x448204[_0x505d('0x42')]:_0x5b8526[_0x505d('0x40')];if(!_0x19fd6f['query']['hasOwnProperty']('nolimit')){_0x448204[_0x505d('0x44')]=qs[_0x505d('0x44')](_0x19fd6f[_0x505d('0x3b')][_0x505d('0x44')]);_0x448204[_0x505d('0x2d')]=qs['offset'](_0x19fd6f['query'][_0x505d('0x2d')]);}_0x448204[_0x505d('0x66')]=qs['sort'](_0x19fd6f[_0x505d('0x3b')]['sort']);_0x448204[_0x505d('0x4c')]=qs['filters'](_[_0x505d('0x46')](_0x19fd6f[_0x505d('0x3b')],_0x5b8526[_0x505d('0x47')]));_0x448204['where']['FaxAccountId']=_0x648306['id'];if(_0x19fd6f[_0x505d('0x3b')][_0x505d('0x4b')]){_0x448204[_0x505d('0x4c')]=_[_0x505d('0x4a')](_0x448204['where'],{'$or':_[_0x505d('0x4d')](_0x448204[_0x505d('0x42')],function(_0x22dbc1){var _0xc12b3c={};_0xc12b3c[_0x22dbc1]={'$like':'%'+_0x19fd6f[_0x505d('0x3b')][_0x505d('0x4b')]+'%'};return _0xc12b3c;})});}_0x448204=_[_0x505d('0x4a')]({},_0x448204,_0x19fd6f[_0x505d('0x4e')]);return db[_0x505d('0x6c')]['count']({'where':_0x448204[_0x505d('0x4c')]})[_0x505d('0x1f')](function(_0x3086bd){_0x20f09c['count']=_0x3086bd;if(_0x19fd6f[_0x505d('0x3b')][_0x505d('0x4f')]){_0x448204[_0x505d('0x50')]=[{'all':!![]}];}return db[_0x505d('0x6c')]['findAll'](_0x448204);})[_0x505d('0x1f')](function(_0x36ad63){_0x20f09c[_0x505d('0x67')]=_0x36ad63;return _0x20f09c;});}})[_0x505d('0x1f')](respondWithFilteredResult(_0x1946a5,_0x448204))[_0x505d('0x28')](handleError(_0x1946a5,null));};exports[_0x505d('0x6d')]=function(_0x1a2255,_0x1a59f7,_0x7b6c9f){var _0x30bfc6;return db[_0x505d('0x3a')]['find']({'where':{'id':_0x1a2255[_0x505d('0x5d')]['id']}})[_0x505d('0x1f')](handleEntityNotFound(_0x1a59f7,null))[_0x505d('0x1f')](function(_0x584530){if(_0x584530){return _0x584530[_0x505d('0x6d')](_0x1a2255[_0x505d('0x3b')][_0x505d('0x69')]);}})['then'](respondWithStatusCode(_0x1a59f7,null))[_0x505d('0x28')](handleError(_0x1a59f7,null));};exports['addInteraction']=function(_0x4b8806,_0x272ae7,_0x2d84b1){return db['FaxInteraction'][_0x505d('0x5a')]({'where':{'id':_0x4b8806[_0x505d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x272ae7,null))[_0x505d('0x1f')](function(_0x4971c2){if(_0x4971c2){return _0x4971c2['addInteraction'](_0x4b8806['body']['ids'],_[_0x505d('0x6e')](_0x4b8806[_0x505d('0x55')],[_0x505d('0x69'),'id'])||{});}})[_0x505d('0x1f')](respondWithResult(_0x272ae7,null))[_0x505d('0x28')](handleError(_0x272ae7,null));};exports['getInteractions']=function(_0x41e1ed,_0x4356e5,_0x24b8bc){var _0x3a9697={'raw':![],'where':{}};var _0x527816={};var _0x371ef1={'count':0x0,'rows':[]};return db[_0x505d('0x3a')]['findOne']({'where':{'id':_0x41e1ed['params']['id']}})[_0x505d('0x1f')](handleEntityNotFound(_0x4356e5,null))[_0x505d('0x1f')](function(_0x1b9cd4){if(_0x1b9cd4){_0x527816['model']=_[_0x505d('0x3e')](db['FaxInteraction']['rawAttributes']);_0x527816[_0x505d('0x3b')]=_[_0x505d('0x3e')](_0x41e1ed[_0x505d('0x3b')]);_0x527816[_0x505d('0x47')]=_[_0x505d('0x3f')](_0x527816[_0x505d('0x40')],_0x527816[_0x505d('0x3b')]);_0x3a9697[_0x505d('0x42')]=_[_0x505d('0x3f')](_0x527816[_0x505d('0x40')],qs[_0x505d('0x41')](_0x41e1ed[_0x505d('0x3b')]['fields']));_0x3a9697[_0x505d('0x42')]=_0x3a9697[_0x505d('0x42')][_0x505d('0x43')]?_0x3a9697[_0x505d('0x42')]:_0x527816['model'];if(!_0x41e1ed['query']['hasOwnProperty'](_0x505d('0x65'))){_0x3a9697['limit']=qs[_0x505d('0x44')](_0x41e1ed[_0x505d('0x3b')][_0x505d('0x44')]);_0x3a9697[_0x505d('0x2d')]=qs['offset'](_0x41e1ed[_0x505d('0x3b')][_0x505d('0x2d')]);}_0x3a9697[_0x505d('0x66')]=qs[_0x505d('0x45')](_0x41e1ed[_0x505d('0x3b')][_0x505d('0x45')]);_0x3a9697['where']=qs['filters'](_[_0x505d('0x46')](_0x41e1ed[_0x505d('0x3b')],_0x527816[_0x505d('0x47')]));_0x3a9697[_0x505d('0x4c')][_0x505d('0x61')]=_0x1b9cd4['id'];if(_0x41e1ed[_0x505d('0x3b')]['filter']){_0x3a9697[_0x505d('0x4c')]=_[_0x505d('0x4a')](_0x3a9697[_0x505d('0x4c')],{'$or':_[_0x505d('0x4d')](_0x3a9697[_0x505d('0x42')],function(_0x1ca635){var _0x3aeca8={};_0x3aeca8[_0x1ca635]={'$like':'%'+_0x41e1ed[_0x505d('0x3b')][_0x505d('0x4b')]+'%'};return _0x3aeca8;})});}_0x3a9697=_['merge']({},_0x3a9697,_0x41e1ed[_0x505d('0x4e')]);return db[_0x505d('0x6f')][_0x505d('0x2c')]({'where':_0x3a9697['where']})[_0x505d('0x1f')](function(_0x5c1985){_0x371ef1[_0x505d('0x2c')]=_0x5c1985;if(_0x41e1ed[_0x505d('0x3b')][_0x505d('0x4f')]){_0x3a9697[_0x505d('0x50')]=[{'model':db['CmContact'],'as':_0x505d('0x70'),'required':![]},{'model':db['User'],'as':_0x505d('0x71'),'attributes':['name',_0x505d('0x72'),'internal'],'required':![]},{'model':db[_0x505d('0x73')],'as':_0x505d('0x74'),'attributes':['id',_0x505d('0x37'),'color'],'where':_0x41e1ed[_0x505d('0x3b')]['tag']?{'id':_0x41e1ed['query']['tag']}:undefined,'required':_0x41e1ed[_0x505d('0x3b')][_0x505d('0x75')]?!![]:![]}];}return db['FaxInteraction'][_0x505d('0x51')](_0x3a9697);})['then'](function(_0x2cf71a){_0x371ef1['rows']=_0x2cf71a;return _0x371ef1;});}})[_0x505d('0x1f')](respondWithFilteredResult(_0x4356e5,_0x3a9697))[_0x505d('0x28')](handleError(_0x4356e5,null));};exports[_0x505d('0x76')]=function(_0xf7babf,_0x54f665,_0xecb30c){return db[_0x505d('0x3a')][_0x505d('0x64')]({'where':{'id':_0xf7babf[_0x505d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x54f665,null))[_0x505d('0x1f')](function(_0x340456){if(_0x340456){return db[_0x505d('0x77')][_0x505d('0x78')](function(_0x331be3){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0xf7babf['params']['id']},'transaction':_0x331be3})[_0x505d('0x1f')](function(_0x2eb53a){var _0x42821c=_[_0x505d('0x4d')](_0xf7babf[_0x505d('0x55')],function(_0x4aae8d){_0x4aae8d[_0x505d('0x61')]=_0xf7babf[_0x505d('0x5d')]['id'];return _0x4aae8d;});return db[_0x505d('0x79')][_0x505d('0x7a')](_0x42821c,{'transaction':_0x331be3});});})[_0x505d('0x1f')](function(){return db[_0x505d('0x79')][_0x505d('0x7b')]({'where':{'FaxAccountId':_0xf7babf[_0x505d('0x5d')]['id']},'order':_0x505d('0x7c')});});}})[_0x505d('0x1f')](respondWithResult(_0x54f665,null))[_0x505d('0x28')](handleError(_0x54f665,null));};exports[_0x505d('0x7d')]=function(_0x3799ea,_0x5e21d6,_0xd01a6){var _0x503c48={};var _0x38de62={};var _0x18ae67;var _0x5d3982;return db[_0x505d('0x3a')]['findOne']({'where':{'id':_0x3799ea[_0x505d('0x5d')]['id']}})[_0x505d('0x1f')](handleEntityNotFound(_0x5e21d6,null))[_0x505d('0x1f')](function(_0x3e666f){if(_0x3e666f){_0x18ae67=_0x3e666f;_0x38de62[_0x505d('0x40')]=_[_0x505d('0x3e')](db[_0x505d('0x79')][_0x505d('0x53')]);_0x38de62[_0x505d('0x3b')]=_[_0x505d('0x3e')](_0x3799ea['query']);_0x38de62['filters']=_['intersection'](_0x38de62['model'],_0x38de62[_0x505d('0x3b')]);_0x503c48[_0x505d('0x42')]=_[_0x505d('0x3f')](_0x38de62[_0x505d('0x40')],qs[_0x505d('0x41')](_0x3799ea[_0x505d('0x3b')][_0x505d('0x41')]));_0x503c48[_0x505d('0x42')]=_0x503c48[_0x505d('0x42')]['length']?_0x503c48[_0x505d('0x42')]:_0x38de62[_0x505d('0x40')];_0x503c48['order']=qs['sort'](_0x3799ea[_0x505d('0x3b')][_0x505d('0x45')]);_0x503c48['where']=qs[_0x505d('0x47')](_['pick'](_0x3799ea[_0x505d('0x3b')],_0x38de62[_0x505d('0x47')]));if(_0x3799ea[_0x505d('0x3b')][_0x505d('0x4b')]){_0x503c48[_0x505d('0x4c')]=_[_0x505d('0x4a')](_0x503c48[_0x505d('0x4c')],{'$or':_[_0x505d('0x4d')](_0x503c48['attributes'],function(_0xad5670){var _0x5d622c={};_0x5d622c[_0xad5670]={'$like':'%'+_0x3799ea[_0x505d('0x3b')][_0x505d('0x4b')]+'%'};return _0x5d622c;})});}_0x503c48=_['merge']({},_0x503c48,_0x3799ea['options']);return _0x18ae67['getApplications'](_0x503c48);}})[_0x505d('0x1f')](function(_0x17466e){if(_0x17466e){_0x5d3982=_0x17466e[_0x505d('0x43')];if(!_0x3799ea[_0x505d('0x3b')]['hasOwnProperty'](_0x505d('0x65'))){_0x503c48['limit']=qs[_0x505d('0x44')](_0x3799ea[_0x505d('0x3b')]['limit']);_0x503c48['offset']=qs['offset'](_0x3799ea[_0x505d('0x3b')][_0x505d('0x2d')]);}return _0x18ae67[_0x505d('0x7d')](_0x503c48);}})['then'](function(_0x400ba0){if(_0x400ba0){return _0x400ba0?{'count':_0x5d3982,'rows':_0x400ba0}:null;}})[_0x505d('0x1f')](respondWithResult(_0x5e21d6,null))[_0x505d('0x28')](handleError(_0x5e21d6,null));};function Extension(_0x38cfd1,_0x56557d,_0x92e78d,_0xc814f2){this[_0x505d('0x7e')]=_0x505d('0x7f');this[_0x505d('0x80')]=_0x38cfd1[_0x505d('0x81')];this[_0x505d('0x82')]=_0xc814f2;this[_0x505d('0x83')]=_0x505d('0x84');this['description']=_0x505d('0x85');this[_0x505d('0x61')]=_0x38cfd1['id'];this[_0x505d('0x7c')]=_0x56557d;this[_0x505d('0x86')]=_0x92e78d;}function createExtensionsReciveFax(_0x3a5f20){var _0x238a58=0x1;var _0x5f04e9=[];_0x5f04e9[_0x505d('0x87')](new Extension(_0x3a5f20,_0x238a58,'',_0x505d('0x88')));_0x238a58+=0x1;_0x5f04e9[_0x505d('0x87')](new Extension(_0x3a5f20,_0x238a58,_0x505d('0x89'),'Set'));_0x238a58+=0x1;for(var _0x79691b in _0x3a5f20){if(_0x3a5f20[_0x505d('0x8a')](_0x79691b)&&(_0x79691b==='ecm'||_0x79691b==='localstationid'||_0x79691b==='gateway'||_0x79691b===_0x505d('0x8b')||_0x79691b===_0x505d('0x8c')||_0x79691b===_0x505d('0x8d')||_0x79691b===_0x505d('0x8e')||_0x79691b===_0x505d('0x8f')||_0x79691b==='t38timeout')){_0x5f04e9['push'](new Extension(_0x3a5f20,_0x238a58,_0x505d('0x90')+_0x79691b+')='+_0x3a5f20[_0x79691b],_0x505d('0x91')));_0x238a58+=0x1;}}_0x5f04e9['push'](new Extension(_0x3a5f20,_0x238a58,'6',_0x505d('0x92')));_0x238a58+=0x1;_0x5f04e9['push'](new Extension(_0x3a5f20,_0x238a58,'/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',_0x505d('0x93')));_0x238a58=0x0;return _0x5f04e9;}exports[_0x505d('0x94')]=function(_0x292ffe,_0x4a032c,_0x567191){var _0x2d1ccc;return db[_0x505d('0x77')]['transaction'](function(_0x1a7820){return db[_0x505d('0x3a')][_0x505d('0x54')](_0x292ffe[_0x505d('0x55')],{'transaction':_0x1a7820})[_0x505d('0x1f')](function(_0x30621a){_0x2d1ccc=_0x30621a[_0x505d('0x33')]({'plain':!![]});return db[_0x505d('0x95')][_0x505d('0x7a')](createExtensionsReciveFax(_0x2d1ccc),{'transaction':_0x1a7820});});})[_0x505d('0x1f')](function(){return _0x2d1ccc;})['then'](respondWithResult(_0x4a032c,null))[_0x505d('0x28')](handleError(_0x4a032c,null));};exports['updateAccountApplications']=function(_0x300ac3,_0x14599a,_0x54b9aa){var _0x5deac6;return db['sequelize'][_0x505d('0x78')](function(_0x4008f0){return db[_0x505d('0x3a')][_0x505d('0x5c')](_0x300ac3['body'],{'where':{'id':_0x300ac3['body']['id']},'transaction':_0x4008f0})['then'](function(_0x4c09c0){return db[_0x505d('0x95')][_0x505d('0x5e')]({'where':{'FaxAccountId':_0x300ac3['body']['id']},'transaction':_0x4008f0})['then'](function(_0x116917){return db[_0x505d('0x95')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x300ac3[_0x505d('0x55')],[_0x505d('0x96'),_0x505d('0x97'),_0x505d('0x98'),_0x505d('0x99'),_0x505d('0x9a'),_0x505d('0x9b')])),{'transaction':_0x4008f0});});});})['then'](function(){return db[_0x505d('0x3a')][_0x505d('0x9c')](_0x300ac3[_0x505d('0x55')]['id']);})[_0x505d('0x1f')](respondWithResult(_0x14599a,null))[_0x505d('0x28')](handleError(_0x14599a,null));};exports[_0x505d('0x9d')]=function(_0x142399,_0x173ad3,_0x1dff83){var _0xc5c69c={'raw':!![],'where':{}};var _0x3d7a91={};var _0x93380b={'count':0x0,'rows':[]};return db[_0x505d('0x3a')][_0x505d('0x64')]({'where':{'id':_0x142399['params']['id']}})['then'](handleEntityNotFound(_0x173ad3,null))[_0x505d('0x1f')](function(_0x460672){if(_0x460672){_0x3d7a91[_0x505d('0x40')]=_[_0x505d('0x3e')](db[_0x505d('0x9e')][_0x505d('0x53')]);_0x3d7a91[_0x505d('0x3b')]=_['keys'](_0x142399[_0x505d('0x3b')]);_0x3d7a91[_0x505d('0x47')]=_[_0x505d('0x3f')](_0x3d7a91[_0x505d('0x40')],_0x3d7a91[_0x505d('0x3b')]);_0xc5c69c[_0x505d('0x42')]=_[_0x505d('0x3f')](_0x3d7a91['model'],qs[_0x505d('0x41')](_0x142399[_0x505d('0x3b')][_0x505d('0x41')]));_0xc5c69c[_0x505d('0x42')]=_0xc5c69c[_0x505d('0x42')][_0x505d('0x43')]?_0xc5c69c[_0x505d('0x42')]:_0x3d7a91[_0x505d('0x40')];if(!_0x142399[_0x505d('0x3b')][_0x505d('0x8a')](_0x505d('0x65'))){_0xc5c69c[_0x505d('0x44')]=qs[_0x505d('0x44')](_0x142399[_0x505d('0x3b')][_0x505d('0x44')]);_0xc5c69c[_0x505d('0x2d')]=qs[_0x505d('0x2d')](_0x142399[_0x505d('0x3b')][_0x505d('0x2d')]);}_0xc5c69c[_0x505d('0x66')]=qs[_0x505d('0x45')](_0x142399[_0x505d('0x3b')]['sort']);_0xc5c69c[_0x505d('0x4c')]=qs['filters'](_[_0x505d('0x46')](_0x142399[_0x505d('0x3b')],_0x3d7a91[_0x505d('0x47')]));_0xc5c69c['where'][_0x505d('0x61')]=_0x460672['id'];if(_0x142399['query'][_0x505d('0x4b')]){_0xc5c69c[_0x505d('0x4c')]=_['merge'](_0xc5c69c['where'],{'$or':_[_0x505d('0x4d')](_0xc5c69c[_0x505d('0x42')],function(_0x1810d0){var _0x34d087={};_0x34d087[_0x1810d0]={'$like':'%'+_0x142399[_0x505d('0x3b')]['filter']+'%'};return _0x34d087;})});}if(_0x142399[_0x505d('0x3b')][_0x505d('0x9f')]){var _0x1ebea7=_0x142399[_0x505d('0x3b')][_0x505d('0x9f')]['split'](',');var _0x276f93={};_0x276f93[_0x1ebea7[0x0]]={'$gte':moment(_0x1ebea7[0x1])[_0x505d('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0xc5c69c[_0x505d('0x4c')]=_['merge'](_0xc5c69c[_0x505d('0x4c')],_0x276f93);}_0xc5c69c=_[_0x505d('0x4a')]({},_0xc5c69c,_0x142399[_0x505d('0x4e')]);return db[_0x505d('0x9e')]['count']({'where':_0xc5c69c[_0x505d('0x4c')]})[_0x505d('0x1f')](function(_0x3e547b){_0x93380b[_0x505d('0x2c')]=_0x3e547b;if(_0x142399[_0x505d('0x3b')][_0x505d('0x4f')]){_0xc5c69c[_0x505d('0x50')]=[{'all':!![]}];}return db[_0x505d('0x9e')][_0x505d('0x51')](_0xc5c69c);})[_0x505d('0x1f')](function(_0x5eaa4d){_0x93380b[_0x505d('0x67')]=_0x5eaa4d;return _0x93380b;});}})[_0x505d('0x1f')](respondWithFilteredResult(_0x173ad3,_0xc5c69c))[_0x505d('0x28')](handleError(_0x173ad3,null));};exports[_0x505d('0x38')]=function(_0x2b1ee1,_0x1f6d3e,_0x11cdef){var _0x4bf538,_0x35762c={},_0x197d26;if(_0x2b1ee1[_0x505d('0x55')]['to']){_0x197d26=_0x2b1ee1[_0x505d('0x55')]['to'][0x0];}return db[_0x505d('0x3a')]['find']({'where':{'id':_0x2b1ee1[_0x505d('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x505d('0xa1'),'include':[{'model':db[_0x505d('0xa2')],'as':_0x505d('0xa3'),'where':{'fax':_0x197d26},'limit':0x1,'order':[['updatedAt',_0x505d('0xa4')]]}]}]})[_0x505d('0x1f')](handleEntityNotFound(_0x1f6d3e,null))[_0x505d('0x1f')](function(_0x3ea133){_0x4bf538=_0x3ea133;if(_0x2b1ee1['body']['attachments']&&_0x2b1ee1[_0x505d('0x55')][_0x505d('0xa5')]['length']){for(var _0x5aae2b=0x0;_0x5aae2b<_0x2b1ee1[_0x505d('0x55')]['attachments'][_0x505d('0x43')];_0x5aae2b+=0x1){_0x2b1ee1[_0x505d('0x55')][_0x505d('0xa5')][_0x5aae2b]={'filename':_0x2b1ee1[_0x505d('0x55')][_0x505d('0xa5')][_0x5aae2b][_0x505d('0x37')],'id':_0x2b1ee1[_0x505d('0x55')][_0x505d('0xa5')][_0x5aae2b]['id'],'path':path['join'](config[_0x505d('0xa6')],'server/files/attachments',_0x2b1ee1[_0x505d('0x55')]['attachments'][_0x5aae2b][_0x505d('0xa7')])};}}return respondWithRpcPromise(_0x505d('0xa8'),_0x505d('0xa8'),{'FaxAccountId':_[_0x505d('0xa9')](_0x2b1ee1['params']['id'])?undefined:_0x2b1ee1[_0x505d('0x5d')]['id'],'path':_['isNil'](_0x2b1ee1['body'][_0x505d('0xa5')][0x0]['path'])?undefined:_0x2b1ee1['body'][_0x505d('0xa5')][0x0]['path'],'fax':_['isNil'](_0x2b1ee1[_0x505d('0x55')]['to'][0x0])?undefined:_0x2b1ee1[_0x505d('0x55')]['to'][0x0]},client9002);})[_0x505d('0x1f')](function(){if(_0x4bf538){if(_[_0x505d('0xa9')](_0x2b1ee1['body']['from'])){_0x2b1ee1['body'][_0x505d('0xaa')]=util[_0x505d('0xa0')](_0x505d('0xab'),_0x4bf538[_0x505d('0x37')],_0x4bf538[_0x505d('0xac')]);}if(_0x4bf538[_0x505d('0xa1')]){if(_0x4bf538[_0x505d('0xa1')][_0x505d('0xa3')][_0x505d('0x43')]){return _0x4bf538['List'][_0x505d('0xa3')][0x0];}else{return db[_0x505d('0xa2')][_0x505d('0x54')](_[_0x505d('0x17')](_0x2b1ee1[_0x505d('0x55')],{'firstName':_0x2b1ee1[_0x505d('0x55')]['to'][0x0],'phone':_0x2b1ee1[_0x505d('0x55')]['to'][0x0],'fax':_0x2b1ee1[_0x505d('0x55')]['to'][0x0],'ListId':_0x4bf538[_0x505d('0x9b')]}));}}else{throw new Error(_0x505d('0xad'));}}else{throw new Error(_0x505d('0xae'));}})[_0x505d('0x1f')](function(_0x4cd101){if(_0x4cd101){return db[_0x505d('0x6f')][_0x505d('0x5a')]({'where':{'ContactId':_0x4cd101['id'],'closed':![],'FaxAccountId':_0x4bf538['id']}})['then'](function(_0x2777c6){if(_0x2777c6){return[_0x2777c6,![]];}return db[_0x505d('0x6f')]['create']({'UserId':_0x2b1ee1['user']['id'],'ContactId':_0x4cd101['id'],'FaxAccountId':_0x4bf538['id'],'fax':_0x2b1ee1['body']['to'][0x0],'firstMsgDirection':_0x505d('0xaf'),'Messages':[_[_0x505d('0x4a')](_0x2b1ee1['body'],{'read':![],'body':_0x2b1ee1[_0x505d('0x55')]['attachments'][0x0]['filename'],'FaxAccountId':_0x4bf538['id'],'UserId':_0x2b1ee1[_0x505d('0x56')]['id'],'ContactId':_0x4cd101['id'],'AttachmentId':_0x2b1ee1[_0x505d('0x55')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x505d('0x9e')],'as':_0x505d('0xb0')}]})['then'](function(_0x53e0e0){return[_0x53e0e0,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x505d('0xb1')](function(_0x4007d4,_0x394324){if(_0x394324){return _0x4007d4;}return db[_0x505d('0x9e')]['create']({'direction':_0x505d('0xaf'),'read':![],'body':_0x2b1ee1[_0x505d('0x55')][_0x505d('0xa5')][0x0][_0x505d('0xb2')],'FaxAccountId':_0x4bf538['id'],'FaxInteractionId':_0x4007d4['id'],'UserId':_0x2b1ee1['user']['id'],'ContactId':_0x4007d4[_0x505d('0xb3')],'AttachmentId':_0x2b1ee1[_0x505d('0x55')][_0x505d('0xa5')][0x0]['id']})[_0x505d('0x1f')](function(_0x298987){_0x4007d4[_0x505d('0xb4')]['Messages']=[];_0x4007d4[_0x505d('0xb4')][_0x505d('0xb0')]['push'](_0x298987[_0x505d('0xb4')]);return _0x4007d4;});})['then'](function(_0xcfd3d4){respondWithRpcPromise(_0x505d('0xb5'),_0x505d('0xb5'),{'FaxAccountId':_[_0x505d('0xa9')](_0x2b1ee1[_0x505d('0x5d')]['id'])?undefined:_0x2b1ee1[_0x505d('0x5d')]['id'],'path':_[_0x505d('0xa9')](_0x2b1ee1[_0x505d('0x55')][_0x505d('0xa5')][0x0][_0x505d('0x6')])?undefined:_0x2b1ee1['body'][_0x505d('0xa5')][0x0][_0x505d('0x6')],'fax':_['isNil'](_0x2b1ee1['body']['to'][0x0])?undefined:_0x2b1ee1[_0x505d('0x55')]['to'][0x0],'AttachmentId':_0x2b1ee1['body']['attachments'][0x0]['id']},client9002)[_0x505d('0x1f')](function(_0x46f4b3){logger[_0x505d('0x20')](_0x505d('0xb6'),_0x46f4b3);})['catch'](function(_0x55d118){logger[_0x505d('0x20')](_0x505d('0xb6'),_0x55d118);});return _0xcfd3d4;})['then'](respondWithResult(_0x1f6d3e,null))[_0x505d('0x28')](handleError(_0x1f6d3e,null));};exports[_0x505d('0xb7')]=function(_0x277728,_0x20b36c,_0x2b2756){return db[_0x505d('0x3a')]['find']({'where':{'id':_0x277728[_0x505d('0x5d')]['id']}})[_0x505d('0x1f')](handleEntityNotFound(_0x20b36c,null))['then'](function(_0x165509){if(_0x165509){return _0x165509[_0x505d('0xb7')](_0x277728[_0x505d('0x55')][_0x505d('0x69')],_[_0x505d('0x6e')](_0x277728[_0x505d('0x55')],[_0x505d('0x69'),'id'])||{})['spread'](function(_0x586ccb){for(var _0x18f3f2=0x0;_0x18f3f2<_0x277728['body'][_0x505d('0x69')]['length'];_0x18f3f2+=0x1){socket[_0x505d('0xb8')](_0x505d('0xb9'),{'UserId':_0x277728[_0x505d('0x55')]['ids'][_0x18f3f2],'FaxAccountId':_0x277728[_0x505d('0x5d')]['id']});}return _0x586ccb;});}})['then'](respondWithResult(_0x20b36c,null))[_0x505d('0x28')](handleError(_0x20b36c,null));};exports[_0x505d('0xba')]=function(_0x25f89a,_0x321dd5,_0x11ad9b){var _0x9419f6;return db['FaxAccount'][_0x505d('0x5a')]({'where':{'id':_0x25f89a[_0x505d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x321dd5,null))[_0x505d('0x1f')](function(_0x40b3b9){if(_0x40b3b9){return _0x40b3b9['removeAgents'](_0x25f89a[_0x505d('0x3b')]['ids'])['then'](function(_0x74074){if(_[_0x505d('0xbb')](_0x25f89a[_0x505d('0x3b')][_0x505d('0x69')])){for(var _0x2640e7=0x0;_0x2640e7<_0x25f89a['query']['ids']['length'];_0x2640e7+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':_0x25f89a['query']['ids'][_0x2640e7],'FaxAccountId':_0x25f89a[_0x505d('0x5d')]['id']});}}else{socket['emit'](_0x505d('0xbc'),{'UserId':_0x25f89a[_0x505d('0x3b')][_0x505d('0x69')],'FaxAccountId':_0x25f89a['params']['id']});}});}})[_0x505d('0x1f')](respondWithStatusCode(_0x321dd5,null))['catch'](handleError(_0x321dd5,null));};exports[_0x505d('0xbd')]=function(_0x4899b9,_0x2d9c32,_0x28f6a5){var _0x1d8046={};var _0x43db32={};var _0x10c661;var _0x426008;return db[_0x505d('0x3a')]['findOne']({'where':{'id':_0x4899b9[_0x505d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2d9c32,null))['then'](function(_0x58fb43){if(_0x58fb43){_0x10c661=_0x58fb43;_0x43db32[_0x505d('0x40')]=_['keys'](db[_0x505d('0xbe')][_0x505d('0x53')]);_0x43db32[_0x505d('0x3b')]=_[_0x505d('0x3e')](_0x4899b9['query']);_0x43db32[_0x505d('0x47')]=_[_0x505d('0x3f')](_0x43db32[_0x505d('0x40')],_0x43db32[_0x505d('0x3b')]);_0x1d8046[_0x505d('0x42')]=_[_0x505d('0x3f')](_0x43db32['model'],qs['fields'](_0x4899b9['query'][_0x505d('0x41')]));_0x1d8046[_0x505d('0x42')]=_0x1d8046[_0x505d('0x42')][_0x505d('0x43')]?_0x1d8046[_0x505d('0x42')]:_0x43db32[_0x505d('0x40')];_0x1d8046['order']=qs['sort'](_0x4899b9[_0x505d('0x3b')]['sort']);_0x1d8046[_0x505d('0x4c')]=qs['filters'](_[_0x505d('0x46')](_0x4899b9[_0x505d('0x3b')],_0x43db32[_0x505d('0x47')]));if(_0x4899b9[_0x505d('0x3b')][_0x505d('0x4b')]){_0x1d8046['where']=_['merge'](_0x1d8046[_0x505d('0x4c')],{'$or':_[_0x505d('0x4d')](_0x1d8046[_0x505d('0x42')],function(_0x1b9c1b){var _0x1a8e50={};_0x1a8e50[_0x1b9c1b]={'$like':'%'+_0x4899b9[_0x505d('0x3b')][_0x505d('0x4b')]+'%'};return _0x1a8e50;})});}_0x1d8046=_[_0x505d('0x4a')]({},_0x1d8046,_0x4899b9[_0x505d('0x4e')]);return _0x10c661['getAgents'](_0x1d8046);}})[_0x505d('0x1f')](function(_0xb816d6){if(_0xb816d6){_0x426008=_0xb816d6[_0x505d('0x43')];if(!_0x4899b9[_0x505d('0x3b')][_0x505d('0x8a')](_0x505d('0x65'))){_0x1d8046[_0x505d('0x44')]=qs['limit'](_0x4899b9['query'][_0x505d('0x44')]);_0x1d8046[_0x505d('0x2d')]=qs[_0x505d('0x2d')](_0x4899b9['query'][_0x505d('0x2d')]);}return _0x10c661[_0x505d('0xbd')](_0x1d8046);}})['then'](function(_0x41c4de){if(_0x41c4de){return _0x41c4de?{'count':_0x426008,'rows':_0x41c4de}:null;}})[_0x505d('0x1f')](respondWithResult(_0x2d9c32,null))['catch'](handleError(_0x2d9c32,null));}; \ No newline at end of file +var _0xa846=['includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','system','appdata','Answer','push','Set','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','/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','transaction','updateAccountApplications','VoiceExtension','omit','tech','key','updatedAt','TrunkId','ListId','findById','FaxMessage','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','user','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','reject','save','get','UserProfileResource','stack','name','index','FaxAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','day','add','merge','filter','map','options','include','findAll','rows','show'];(function(_0x308a8a,_0x5d44fd){var _0x3139c2=function(_0x16ad07){while(--_0x16ad07){_0x308a8a['push'](_0x308a8a['shift']());}};_0x3139c2(++_0x5d44fd);}(_0xa846,0x12a));var _0x6a84=function(_0x16fb98,_0x4edc1d){_0x16fb98=_0x16fb98-0x0;var _0x352f25=_0xa846[_0x16fb98];return _0x352f25;};'use strict';var pdf=require(_0x6a84('0x0'));var emlformat=require(_0x6a84('0x1'));var rimraf=require(_0x6a84('0x2'));var zipdir=require(_0x6a84('0x3'));var jsonpatch=require(_0x6a84('0x4'));var rp=require(_0x6a84('0x5'));var moment=require(_0x6a84('0x6'));var BPromise=require(_0x6a84('0x7'));var Mustache=require(_0x6a84('0x8'));var util=require(_0x6a84('0x9'));var path=require('path');var sox=require(_0x6a84('0xa'));var csv=require(_0x6a84('0xb'));var ejs=require(_0x6a84('0xc'));var fs=require('fs');var _=require(_0x6a84('0xd'));var squel=require(_0x6a84('0xe'));var crypto=require(_0x6a84('0xf'));var jsforce=require(_0x6a84('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a84('0x11'));var Papa=require(_0x6a84('0x12'));var Redis=require('ioredis');var qs=require(_0x6a84('0x13'));var logger=require('../../config/logger')(_0x6a84('0x14'));var utils=require(_0x6a84('0x15'));var config=require('../../config/environment');var db=require(_0x6a84('0x16'))['db'];config[_0x6a84('0x17')]=_[_0x6a84('0x18')](config['redis'],{'host':_0x6a84('0x19'),'port':0x18eb});var socket=require(_0x6a84('0x1a'))(new Redis(config[_0x6a84('0x17')]));require(_0x6a84('0x1b'))[_0x6a84('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6a84('0x1d')][_0x6a84('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30f3c2,_0x5d6c90,_0x1355ed,_0x13cb5a){return new BPromise(function(_0x4f7ec3,_0x595e95){var _0x4ec217=_0x13cb5a||client;return _0x4ec217[_0x6a84('0x1f')](_0x30f3c2,_0x1355ed)[_0x6a84('0x20')](function(_0x368732){logger[_0x6a84('0x21')]('FaxAccount,\x20%s,\x20%s',_0x5d6c90,_0x6a84('0x22'));logger[_0x6a84('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5d6c90,'request\x20sent',JSON[_0x6a84('0x24')](_0x368732));if(_0x368732[_0x6a84('0x25')]){if(_0x368732[_0x6a84('0x25')][_0x6a84('0x26')]===0x1f4){logger[_0x6a84('0x25')](_0x6a84('0x27'),_0x5d6c90,_0x368732['error'][_0x6a84('0x28')]);return _0x595e95(_0x368732[_0x6a84('0x25')][_0x6a84('0x28')]);}logger[_0x6a84('0x25')](_0x6a84('0x27'),_0x5d6c90,_0x368732['error'][_0x6a84('0x28')]);return _0x4f7ec3(_0x368732[_0x6a84('0x25')][_0x6a84('0x28')]);}else{logger[_0x6a84('0x21')](_0x6a84('0x27'),_0x5d6c90,_0x6a84('0x22'));_0x4f7ec3(_0x368732[_0x6a84('0x29')][_0x6a84('0x28')]);}})[_0x6a84('0x2a')](function(_0xc37686){logger[_0x6a84('0x25')](_0x6a84('0x27'),_0x5d6c90,_0xc37686);_0x595e95(_0xc37686);});});}function respondWithStatusCode(_0x262535,_0x15c1dc){_0x15c1dc=_0x15c1dc||0xcc;return function(_0x2282a7){if(_0x2282a7){return _0x262535[_0x6a84('0x2b')](_0x15c1dc);}return _0x262535[_0x6a84('0x2c')](_0x15c1dc)[_0x6a84('0x2d')]();};}function respondWithResult(_0x28a760,_0x5477f9){_0x5477f9=_0x5477f9||0xc8;return function(_0xf198f6){if(_0xf198f6){return _0x28a760[_0x6a84('0x2c')](_0x5477f9)[_0x6a84('0x2e')](_0xf198f6);}};}function respondWithFilteredResult(_0x192096,_0x46b625){return function(_0x49d721){if(_0x49d721){var _0x4373e1=_0x49d721[_0x6a84('0x2f')],_0x405c1d=_0x46b625[_0x6a84('0x30')],_0x1cc405=_0x46b625['offset']+_0x46b625['limit'],_0x5bb271;if(_0x1cc405>=_0x4373e1){_0x1cc405=_0x4373e1;_0x5bb271=0xc8;}else{_0x5bb271=0xce;}_0x192096[_0x6a84('0x2c')](_0x5bb271);return _0x192096[_0x6a84('0x31')]('Content-Range',_0x405c1d+'-'+_0x1cc405+'/'+_0x4373e1)[_0x6a84('0x2e')](_0x49d721);}return null;};}function patchUpdates(_0x21b703){return function(_0x103d7f){try{jsonpatch['apply'](_0x103d7f,_0x21b703,!![]);}catch(_0x491cd8){return BPromise[_0x6a84('0x32')](_0x491cd8);}return _0x103d7f[_0x6a84('0x33')]();};}function saveUpdates(_0x23ba5b,_0xc37d70){return function(_0x4a4898){if(_0x4a4898){return _0x4a4898['update'](_0x23ba5b)[_0x6a84('0x20')](function(_0x2990d8){return _0x2990d8;});}return null;};}function removeEntity(_0x18b5c4,_0xad5299){return function(_0x3de4cf){if(_0x3de4cf){return _0x3de4cf['destroy']()[_0x6a84('0x20')](function(){var _0x50b8ac=_0x3de4cf[_0x6a84('0x34')]({'plain':!![]});var _0x23bda3='FaxAccounts';return db[_0x6a84('0x35')]['destroy']({'where':{'type':_0x23bda3,'resourceId':_0x50b8ac['id']}})['then'](function(){return _0x3de4cf;});})['then'](function(){_0x18b5c4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40a2c0,_0x135c32){return function(_0x468af7){if(!_0x468af7){_0x40a2c0[_0x6a84('0x2b')](0x194);}return _0x468af7;};}function handleError(_0x2a78e7,_0x253f1b){_0x253f1b=_0x253f1b||0x1f4;return function(_0x284070){logger[_0x6a84('0x25')](_0x284070[_0x6a84('0x36')]);if(_0x284070['name']){delete _0x284070[_0x6a84('0x37')];}_0x2a78e7['status'](_0x253f1b)['send'](_0x284070);};}exports[_0x6a84('0x38')]=function(_0x537fb2,_0x4fc3e8){var _0x15c224={},_0x3dcfed={},_0x108b05={'count':0x0,'rows':[]};var _0x1e4c8b=db[_0x6a84('0x39')][_0x6a84('0x3a')];_0x3dcfed[_0x6a84('0x3b')]=_[_0x6a84('0x3c')](_0x1e4c8b);var _0x3ee72f={'dateStart':_0x537fb2[_0x6a84('0x3d')][_0x6a84('0x3e')],'dateEnd':_0x537fb2[_0x6a84('0x3d')][_0x6a84('0x3f')]};delete _0x537fb2[_0x6a84('0x3d')][_0x6a84('0x3e')];delete _0x537fb2[_0x6a84('0x3d')][_0x6a84('0x3f')];_0x3dcfed['query']=_['keys'](_0x537fb2[_0x6a84('0x3d')]);_0x3dcfed[_0x6a84('0x40')]=_[_0x6a84('0x41')](_0x3dcfed[_0x6a84('0x3b')],_0x3dcfed[_0x6a84('0x3d')]);_0x15c224[_0x6a84('0x42')]=_['intersection'](_0x3dcfed['model'],qs[_0x6a84('0x43')](_0x537fb2[_0x6a84('0x3d')][_0x6a84('0x43')]));_0x15c224[_0x6a84('0x42')]=_0x15c224[_0x6a84('0x42')][_0x6a84('0x44')]?_0x15c224[_0x6a84('0x42')]:_0x3dcfed[_0x6a84('0x3b')];if(!_0x537fb2[_0x6a84('0x3d')]['hasOwnProperty'](_0x6a84('0x45'))){_0x15c224[_0x6a84('0x46')]=qs[_0x6a84('0x46')](_0x537fb2[_0x6a84('0x3d')][_0x6a84('0x46')]);_0x15c224[_0x6a84('0x30')]=qs[_0x6a84('0x30')](_0x537fb2[_0x6a84('0x3d')]['offset']);}_0x15c224['order']=qs[_0x6a84('0x47')](_0x537fb2[_0x6a84('0x3d')][_0x6a84('0x47')]);_0x15c224[_0x6a84('0x48')]=qs[_0x6a84('0x40')](_[_0x6a84('0x49')](_0x537fb2[_0x6a84('0x3d')],_0x3dcfed[_0x6a84('0x40')]));if(_0x3ee72f[_0x6a84('0x3e')]){if(_0x3ee72f[_0x6a84('0x3f')]){_0x3ee72f[_0x6a84('0x3f')]=moment(_0x3ee72f[_0x6a84('0x3f')])['add'](0x1,_0x6a84('0x4a'));}else{_0x3ee72f[_0x6a84('0x3f')]=moment(_0x3ee72f[_0x6a84('0x3e')])[_0x6a84('0x4b')](0x1,'day');}_[_0x6a84('0x4c')](_0x15c224['where'],{'createdAt':{'$gte':_0x3ee72f[_0x6a84('0x3e')],'$lte':_0x3ee72f['dateEnd']}});}if(_0x537fb2[_0x6a84('0x3d')][_0x6a84('0x4d')]){_0x15c224[_0x6a84('0x48')]=_['merge'](_0x15c224[_0x6a84('0x48')],{'$or':_[_0x6a84('0x4e')](_0x15c224['attributes'],function(_0x59703c){var _0x209f63={};_0x209f63[_0x59703c]={'$like':'%'+_0x537fb2[_0x6a84('0x3d')][_0x6a84('0x4d')]+'%'};return _0x209f63;})});}_0x15c224=_['merge']({},_0x15c224,_0x537fb2[_0x6a84('0x4f')]);var _0x2e1a69={'where':_0x15c224[_0x6a84('0x48')]};return db[_0x6a84('0x39')][_0x6a84('0x2f')](_0x2e1a69)['then'](function(_0x56957c){_0x108b05[_0x6a84('0x2f')]=_0x56957c;if(_0x537fb2['query']['includeAll']){_0x15c224[_0x6a84('0x50')]=[{'all':!![]}];}return db[_0x6a84('0x39')][_0x6a84('0x51')](_0x15c224);})[_0x6a84('0x20')](function(_0x44a15e){_0x108b05[_0x6a84('0x52')]=_0x44a15e;return _0x108b05;})[_0x6a84('0x20')](respondWithFilteredResult(_0x4fc3e8,_0x15c224))[_0x6a84('0x2a')](handleError(_0x4fc3e8,null));};exports[_0x6a84('0x53')]=function(_0xc54f1c,_0x5975e5){var _0x4255b9={'raw':![],'where':{'id':_0xc54f1c['params']['id']}},_0x526207={};_0x526207[_0x6a84('0x3b')]=_[_0x6a84('0x3c')](db[_0x6a84('0x39')][_0x6a84('0x3a')]);_0x526207[_0x6a84('0x3d')]=_['keys'](_0xc54f1c['query']);_0x526207[_0x6a84('0x40')]=_[_0x6a84('0x41')](_0x526207[_0x6a84('0x3b')],_0x526207[_0x6a84('0x3d')]);_0x4255b9[_0x6a84('0x42')]=_[_0x6a84('0x41')](_0x526207['model'],qs[_0x6a84('0x43')](_0xc54f1c[_0x6a84('0x3d')]['fields']));_0x4255b9[_0x6a84('0x42')]=_0x4255b9[_0x6a84('0x42')][_0x6a84('0x44')]?_0x4255b9[_0x6a84('0x42')]:_0x526207[_0x6a84('0x3b')];if(_0xc54f1c[_0x6a84('0x3d')][_0x6a84('0x54')]){_0x4255b9[_0x6a84('0x50')]=[{'all':!![]}];}_0x4255b9=_[_0x6a84('0x4c')]({},_0x4255b9,_0xc54f1c[_0x6a84('0x4f')]);return db[_0x6a84('0x39')][_0x6a84('0x55')](_0x4255b9)['then'](handleEntityNotFound(_0x5975e5,null))[_0x6a84('0x20')](respondWithResult(_0x5975e5,null))[_0x6a84('0x2a')](handleError(_0x5975e5,null));};exports['create']=function(_0x946b0a,_0x45425b){return db[_0x6a84('0x39')][_0x6a84('0x56')](_0x946b0a[_0x6a84('0x57')],{})[_0x6a84('0x20')](function(_0x1bab4b){var _0x445b52=_0x946b0a['user'][_0x6a84('0x34')]({'plain':!![]});if(!_0x445b52)throw new Error(_0x6a84('0x58'));if(_0x445b52[_0x6a84('0x59')]==='user'){var _0x5b0419=_0x1bab4b[_0x6a84('0x34')]({'plain':!![]});var _0x35562b=_0x6a84('0x5a');return db[_0x6a84('0x5b')][_0x6a84('0x55')]({'where':{'name':_0x35562b,'userProfileId':_0x445b52[_0x6a84('0x5c')]},'raw':!![]})[_0x6a84('0x20')](function(_0x65f2c){if(_0x65f2c&&_0x65f2c[_0x6a84('0x5d')]===0x0){return db[_0x6a84('0x35')]['create']({'name':_0x5b0419[_0x6a84('0x37')],'resourceId':_0x5b0419['id'],'type':_0x65f2c['name'],'sectionId':_0x65f2c['id']},{})[_0x6a84('0x20')](function(){return _0x1bab4b;});}else{return _0x1bab4b;}})[_0x6a84('0x2a')](function(_0x127fd6){logger[_0x6a84('0x25')](_0x6a84('0x5e'),_0x127fd6);throw _0x127fd6;});}return _0x1bab4b;})['then'](respondWithResult(_0x45425b,0xc9))[_0x6a84('0x2a')](handleError(_0x45425b,null));};exports[_0x6a84('0x5f')]=function(_0x399071,_0x1795ca){if(_0x399071[_0x6a84('0x57')]['id']){delete _0x399071['body']['id'];}return db[_0x6a84('0x39')][_0x6a84('0x55')]({'where':{'id':_0x399071[_0x6a84('0x60')]['id']}})['then'](handleEntityNotFound(_0x1795ca,null))['then'](saveUpdates(_0x399071[_0x6a84('0x57')],null))[_0x6a84('0x20')](respondWithResult(_0x1795ca,null))[_0x6a84('0x2a')](handleError(_0x1795ca,null));};exports[_0x6a84('0x61')]=function(_0x5712aa,_0x317b5f){return db[_0x6a84('0x39')][_0x6a84('0x55')]({'where':{'id':_0x5712aa[_0x6a84('0x60')]['id']}})[_0x6a84('0x20')](handleEntityNotFound(_0x317b5f,null))[_0x6a84('0x20')](removeEntity(_0x317b5f,null))[_0x6a84('0x2a')](handleError(_0x317b5f,null));};exports[_0x6a84('0x62')]=function(_0x2e75aa,_0x160a25){return db[_0x6a84('0x39')]['describe']()[_0x6a84('0x20')](respondWithResult(_0x160a25,null))[_0x6a84('0x2a')](handleError(_0x160a25,null));};exports[_0x6a84('0x63')]=function(_0x4b86e1,_0x590db6,_0x3b5268){if(_0x4b86e1['body']['id']){delete _0x4b86e1['body']['id'];}return db[_0x6a84('0x39')][_0x6a84('0x55')]({'where':{'id':_0x4b86e1['params']['id']}})[_0x6a84('0x20')](handleEntityNotFound(_0x590db6,null))[_0x6a84('0x20')](function(_0xf83392){if(_0xf83392){_0x4b86e1[_0x6a84('0x57')][_0x6a84('0x64')]=_0xf83392['id'];return db[_0x6a84('0x65')][_0x6a84('0x56')](_0x4b86e1['body']);}})['then'](respondWithResult(_0x590db6,null))[_0x6a84('0x2a')](handleError(_0x590db6,null));};exports[_0x6a84('0x66')]=function(_0x4c12c5,_0x2eb55c,_0x5fe2a7){var _0x5d5697={'raw':![],'where':{}};var _0xe4f85f={};var _0x3eae85={'count':0x0,'rows':[]};return db[_0x6a84('0x39')][_0x6a84('0x67')]({'where':{'id':_0x4c12c5[_0x6a84('0x60')]['id']}})[_0x6a84('0x20')](handleEntityNotFound(_0x2eb55c,null))[_0x6a84('0x20')](function(_0x4822ad){if(_0x4822ad){_0xe4f85f['model']=_[_0x6a84('0x3c')](db[_0x6a84('0x65')][_0x6a84('0x3a')]);_0xe4f85f[_0x6a84('0x3d')]=_[_0x6a84('0x3c')](_0x4c12c5[_0x6a84('0x3d')]);_0xe4f85f[_0x6a84('0x40')]=_['intersection'](_0xe4f85f['model'],_0xe4f85f[_0x6a84('0x3d')]);_0x5d5697['attributes']=_[_0x6a84('0x41')](_0xe4f85f[_0x6a84('0x3b')],qs['fields'](_0x4c12c5[_0x6a84('0x3d')][_0x6a84('0x43')]));_0x5d5697['attributes']=_0x5d5697['attributes'][_0x6a84('0x44')]?_0x5d5697[_0x6a84('0x42')]:_0xe4f85f[_0x6a84('0x3b')];if(!_0x4c12c5[_0x6a84('0x3d')]['hasOwnProperty'](_0x6a84('0x45'))){_0x5d5697[_0x6a84('0x46')]=qs[_0x6a84('0x46')](_0x4c12c5['query'][_0x6a84('0x46')]);_0x5d5697[_0x6a84('0x30')]=qs['offset'](_0x4c12c5[_0x6a84('0x3d')][_0x6a84('0x30')]);}_0x5d5697[_0x6a84('0x68')]=qs[_0x6a84('0x47')](_0x4c12c5[_0x6a84('0x3d')][_0x6a84('0x47')]);_0x5d5697['where']=qs[_0x6a84('0x40')](_[_0x6a84('0x49')](_0x4c12c5[_0x6a84('0x3d')],_0xe4f85f[_0x6a84('0x40')]));_0x5d5697[_0x6a84('0x48')][_0x6a84('0x64')]=_0x4822ad['id'];if(_0x4c12c5['query'][_0x6a84('0x4d')]){_0x5d5697[_0x6a84('0x48')]=_[_0x6a84('0x4c')](_0x5d5697[_0x6a84('0x48')],{'$or':_['map'](_0x5d5697[_0x6a84('0x42')],function(_0x580725){var _0x5cc7ca={};_0x5cc7ca[_0x580725]={'$like':'%'+_0x4c12c5[_0x6a84('0x3d')][_0x6a84('0x4d')]+'%'};return _0x5cc7ca;})});}_0x5d5697=_['merge']({},_0x5d5697,_0x4c12c5[_0x6a84('0x4f')]);return db[_0x6a84('0x65')][_0x6a84('0x2f')]({'where':_0x5d5697['where']})[_0x6a84('0x20')](function(_0x3693a6){_0x3eae85['count']=_0x3693a6;if(_0x4c12c5[_0x6a84('0x3d')]['includeAll']){_0x5d5697[_0x6a84('0x50')]=[{'all':!![]}];}return db['Disposition'][_0x6a84('0x51')](_0x5d5697);})[_0x6a84('0x20')](function(_0x44aee4){_0x3eae85['rows']=_0x44aee4;return _0x3eae85;});}})[_0x6a84('0x20')](respondWithFilteredResult(_0x2eb55c,_0x5d5697))[_0x6a84('0x2a')](handleError(_0x2eb55c,null));};exports[_0x6a84('0x69')]=function(_0x62494a,_0x23192a,_0x286276){var _0x5791ca;return db[_0x6a84('0x39')]['find']({'where':{'id':_0x62494a['params']['id']}})[_0x6a84('0x20')](handleEntityNotFound(_0x23192a,null))[_0x6a84('0x20')](function(_0x3dd770){if(_0x3dd770){return _0x3dd770[_0x6a84('0x69')](_0x62494a[_0x6a84('0x3d')][_0x6a84('0x6a')]);}})[_0x6a84('0x20')](respondWithStatusCode(_0x23192a,null))[_0x6a84('0x2a')](handleError(_0x23192a,null));};exports['addAnswer']=function(_0x31e114,_0x192592,_0x34809b){if(_0x31e114[_0x6a84('0x57')]['id']){delete _0x31e114[_0x6a84('0x57')]['id'];}return db[_0x6a84('0x39')][_0x6a84('0x55')]({'where':{'id':_0x31e114['params']['id']}})['then'](handleEntityNotFound(_0x192592,null))[_0x6a84('0x20')](function(_0x396dd2){if(_0x396dd2){_0x31e114[_0x6a84('0x57')]['FaxAccountId']=_0x396dd2['id'];return db[_0x6a84('0x6b')][_0x6a84('0x56')](_0x31e114[_0x6a84('0x57')]);}})['then'](respondWithResult(_0x192592,null))[_0x6a84('0x2a')](handleError(_0x192592,null));};exports[_0x6a84('0x6c')]=function(_0x46ec79,_0x528f47,_0x1a19f2){var _0xf46f3e={'raw':![],'where':{}};var _0x21c03c={};var _0x317acf={'count':0x0,'rows':[]};return db[_0x6a84('0x39')][_0x6a84('0x67')]({'where':{'id':_0x46ec79['params']['id']}})[_0x6a84('0x20')](handleEntityNotFound(_0x528f47,null))['then'](function(_0x2f5037){if(_0x2f5037){_0x21c03c['model']=_[_0x6a84('0x3c')](db['CannedAnswer'][_0x6a84('0x3a')]);_0x21c03c[_0x6a84('0x3d')]=_['keys'](_0x46ec79[_0x6a84('0x3d')]);_0x21c03c[_0x6a84('0x40')]=_[_0x6a84('0x41')](_0x21c03c[_0x6a84('0x3b')],_0x21c03c[_0x6a84('0x3d')]);_0xf46f3e[_0x6a84('0x42')]=_[_0x6a84('0x41')](_0x21c03c[_0x6a84('0x3b')],qs['fields'](_0x46ec79[_0x6a84('0x3d')][_0x6a84('0x43')]));_0xf46f3e[_0x6a84('0x42')]=_0xf46f3e['attributes'][_0x6a84('0x44')]?_0xf46f3e[_0x6a84('0x42')]:_0x21c03c[_0x6a84('0x3b')];if(!_0x46ec79[_0x6a84('0x3d')][_0x6a84('0x6d')](_0x6a84('0x45'))){_0xf46f3e[_0x6a84('0x46')]=qs['limit'](_0x46ec79[_0x6a84('0x3d')]['limit']);_0xf46f3e[_0x6a84('0x30')]=qs['offset'](_0x46ec79['query'][_0x6a84('0x30')]);}_0xf46f3e[_0x6a84('0x68')]=qs[_0x6a84('0x47')](_0x46ec79[_0x6a84('0x3d')][_0x6a84('0x47')]);_0xf46f3e[_0x6a84('0x48')]=qs['filters'](_[_0x6a84('0x49')](_0x46ec79[_0x6a84('0x3d')],_0x21c03c[_0x6a84('0x40')]));_0xf46f3e['where'][_0x6a84('0x64')]=_0x2f5037['id'];if(_0x46ec79['query'][_0x6a84('0x4d')]){_0xf46f3e[_0x6a84('0x48')]=_[_0x6a84('0x4c')](_0xf46f3e[_0x6a84('0x48')],{'$or':_[_0x6a84('0x4e')](_0xf46f3e[_0x6a84('0x42')],function(_0x37ce1e){var _0x16e745={};_0x16e745[_0x37ce1e]={'$like':'%'+_0x46ec79['query']['filter']+'%'};return _0x16e745;})});}_0xf46f3e=_[_0x6a84('0x4c')]({},_0xf46f3e,_0x46ec79['options']);return db['CannedAnswer'][_0x6a84('0x2f')]({'where':_0xf46f3e[_0x6a84('0x48')]})[_0x6a84('0x20')](function(_0xe64d1f){_0x317acf[_0x6a84('0x2f')]=_0xe64d1f;if(_0x46ec79[_0x6a84('0x3d')][_0x6a84('0x54')]){_0xf46f3e[_0x6a84('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6a84('0x51')](_0xf46f3e);})[_0x6a84('0x20')](function(_0x15ed46){_0x317acf['rows']=_0x15ed46;return _0x317acf;});}})[_0x6a84('0x20')](respondWithFilteredResult(_0x528f47,_0xf46f3e))[_0x6a84('0x2a')](handleError(_0x528f47,null));};exports['removeAnswers']=function(_0x46a727,_0x5a9235,_0x35fc07){var _0xbc14e6;return db[_0x6a84('0x39')]['find']({'where':{'id':_0x46a727[_0x6a84('0x60')]['id']}})[_0x6a84('0x20')](handleEntityNotFound(_0x5a9235,null))[_0x6a84('0x20')](function(_0x213ee5){if(_0x213ee5){return _0x213ee5[_0x6a84('0x6e')](_0x46a727[_0x6a84('0x3d')][_0x6a84('0x6a')]);}})[_0x6a84('0x20')](respondWithStatusCode(_0x5a9235,null))[_0x6a84('0x2a')](handleError(_0x5a9235,null));};exports[_0x6a84('0x6f')]=function(_0x5a76ad,_0x457a97,_0xe66653){return db[_0x6a84('0x70')][_0x6a84('0x55')]({'where':{'id':_0x5a76ad[_0x6a84('0x60')]['id']}})[_0x6a84('0x20')](handleEntityNotFound(_0x457a97,null))[_0x6a84('0x20')](function(_0x47d4fa){if(_0x47d4fa){return _0x47d4fa[_0x6a84('0x6f')](_0x5a76ad[_0x6a84('0x57')]['ids'],_['omit'](_0x5a76ad[_0x6a84('0x57')],[_0x6a84('0x6a'),'id'])||{});}})[_0x6a84('0x20')](respondWithResult(_0x457a97,null))[_0x6a84('0x2a')](handleError(_0x457a97,null));};exports[_0x6a84('0x71')]=function(_0x4eb6e1,_0x5501ad,_0x826c26){var _0x452004={'raw':![],'where':{}};var _0x4a2272={};var _0x4af7f5={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6a84('0x67')]({'where':{'id':_0x4eb6e1['params']['id']}})['then'](handleEntityNotFound(_0x5501ad,null))[_0x6a84('0x20')](function(_0x5db367){if(_0x5db367){_0x4a2272['model']=_['keys'](db[_0x6a84('0x70')]['rawAttributes']);_0x4a2272[_0x6a84('0x3d')]=_[_0x6a84('0x3c')](_0x4eb6e1['query']);_0x4a2272[_0x6a84('0x40')]=_[_0x6a84('0x41')](_0x4a2272[_0x6a84('0x3b')],_0x4a2272['query']);_0x452004['attributes']=_[_0x6a84('0x41')](_0x4a2272[_0x6a84('0x3b')],qs[_0x6a84('0x43')](_0x4eb6e1[_0x6a84('0x3d')][_0x6a84('0x43')]));_0x452004[_0x6a84('0x42')]=_0x452004[_0x6a84('0x42')][_0x6a84('0x44')]?_0x452004[_0x6a84('0x42')]:_0x4a2272[_0x6a84('0x3b')];if(!_0x4eb6e1['query'][_0x6a84('0x6d')](_0x6a84('0x45'))){_0x452004[_0x6a84('0x46')]=qs['limit'](_0x4eb6e1[_0x6a84('0x3d')][_0x6a84('0x46')]);_0x452004[_0x6a84('0x30')]=qs[_0x6a84('0x30')](_0x4eb6e1[_0x6a84('0x3d')][_0x6a84('0x30')]);}_0x452004[_0x6a84('0x68')]=qs[_0x6a84('0x47')](_0x4eb6e1[_0x6a84('0x3d')][_0x6a84('0x47')]);_0x452004[_0x6a84('0x48')]=qs[_0x6a84('0x40')](_[_0x6a84('0x49')](_0x4eb6e1[_0x6a84('0x3d')],_0x4a2272[_0x6a84('0x40')]));_0x452004['where']['FaxAccountId']=_0x5db367['id'];if(_0x4eb6e1[_0x6a84('0x3d')][_0x6a84('0x4d')]){_0x452004[_0x6a84('0x48')]=_[_0x6a84('0x4c')](_0x452004['where'],{'$or':_[_0x6a84('0x4e')](_0x452004[_0x6a84('0x42')],function(_0x55c323){var _0x20e0a4={};_0x20e0a4[_0x55c323]={'$like':'%'+_0x4eb6e1[_0x6a84('0x3d')][_0x6a84('0x4d')]+'%'};return _0x20e0a4;})});}_0x452004=_[_0x6a84('0x4c')]({},_0x452004,_0x4eb6e1[_0x6a84('0x4f')]);return db[_0x6a84('0x70')]['count']({'where':_0x452004[_0x6a84('0x48')]})[_0x6a84('0x20')](function(_0x52688f){_0x4af7f5['count']=_0x52688f;if(_0x4eb6e1[_0x6a84('0x3d')]['includeAll']){_0x452004['include']=[{'model':db[_0x6a84('0x72')],'as':_0x6a84('0x73'),'required':![]},{'model':db[_0x6a84('0x74')],'as':_0x6a84('0x75'),'attributes':[_0x6a84('0x37'),_0x6a84('0x76'),_0x6a84('0x77')],'required':![]},{'model':db[_0x6a84('0x78')],'as':_0x6a84('0x79'),'attributes':['id',_0x6a84('0x37'),_0x6a84('0x7a')],'where':_0x4eb6e1[_0x6a84('0x3d')]['tag']?{'id':_0x4eb6e1[_0x6a84('0x3d')]['tag']}:undefined,'required':_0x4eb6e1[_0x6a84('0x3d')]['tag']?!![]:![]}];}return db[_0x6a84('0x70')][_0x6a84('0x51')](_0x452004);})['then'](function(_0x539b5a){_0x4af7f5[_0x6a84('0x52')]=_0x539b5a;return _0x4af7f5;});}})['then'](respondWithFilteredResult(_0x5501ad,_0x452004))[_0x6a84('0x2a')](handleError(_0x5501ad,null));};exports['addApplications']=function(_0x298f8c,_0x523ef7,_0x532c80){return db['FaxAccount'][_0x6a84('0x67')]({'where':{'id':_0x298f8c[_0x6a84('0x60')]['id']}})[_0x6a84('0x20')](handleEntityNotFound(_0x523ef7,null))[_0x6a84('0x20')](function(_0x285b3b){if(_0x285b3b){return db[_0x6a84('0x7b')]['transaction'](function(_0x4252dc){return db[_0x6a84('0x7c')][_0x6a84('0x61')]({'where':{'FaxAccountId':_0x298f8c[_0x6a84('0x60')]['id']},'transaction':_0x4252dc})[_0x6a84('0x20')](function(_0x4b5790){var _0x174de0=_[_0x6a84('0x4e')](_0x298f8c[_0x6a84('0x57')],function(_0x26d7ae){_0x26d7ae['FaxAccountId']=_0x298f8c[_0x6a84('0x60')]['id'];return _0x26d7ae;});return db[_0x6a84('0x7c')][_0x6a84('0x7d')](_0x174de0,{'transaction':_0x4252dc});});})[_0x6a84('0x20')](function(){return db[_0x6a84('0x7c')][_0x6a84('0x7e')]({'where':{'FaxAccountId':_0x298f8c['params']['id']},'order':_0x6a84('0x7f')});});}})['then'](respondWithResult(_0x523ef7,null))[_0x6a84('0x2a')](handleError(_0x523ef7,null));};exports[_0x6a84('0x80')]=function(_0x5f096d,_0x2e1c28,_0x425360){var _0x1681b6={};var _0x74eefa={};var _0x24ef05;var _0x319ae5;return db[_0x6a84('0x39')][_0x6a84('0x67')]({'where':{'id':_0x5f096d['params']['id']}})['then'](handleEntityNotFound(_0x2e1c28,null))[_0x6a84('0x20')](function(_0x1826db){if(_0x1826db){_0x24ef05=_0x1826db;_0x74eefa[_0x6a84('0x3b')]=_['keys'](db[_0x6a84('0x7c')][_0x6a84('0x3a')]);_0x74eefa[_0x6a84('0x3d')]=_['keys'](_0x5f096d['query']);_0x74eefa['filters']=_['intersection'](_0x74eefa[_0x6a84('0x3b')],_0x74eefa[_0x6a84('0x3d')]);_0x1681b6[_0x6a84('0x42')]=_[_0x6a84('0x41')](_0x74eefa[_0x6a84('0x3b')],qs[_0x6a84('0x43')](_0x5f096d[_0x6a84('0x3d')]['fields']));_0x1681b6[_0x6a84('0x42')]=_0x1681b6[_0x6a84('0x42')]['length']?_0x1681b6[_0x6a84('0x42')]:_0x74eefa[_0x6a84('0x3b')];_0x1681b6[_0x6a84('0x68')]=qs['sort'](_0x5f096d[_0x6a84('0x3d')][_0x6a84('0x47')]);_0x1681b6[_0x6a84('0x48')]=qs[_0x6a84('0x40')](_[_0x6a84('0x49')](_0x5f096d[_0x6a84('0x3d')],_0x74eefa['filters']));if(_0x5f096d[_0x6a84('0x3d')][_0x6a84('0x4d')]){_0x1681b6['where']=_[_0x6a84('0x4c')](_0x1681b6[_0x6a84('0x48')],{'$or':_[_0x6a84('0x4e')](_0x1681b6[_0x6a84('0x42')],function(_0x9e99ef){var _0x3e4341={};_0x3e4341[_0x9e99ef]={'$like':'%'+_0x5f096d['query'][_0x6a84('0x4d')]+'%'};return _0x3e4341;})});}_0x1681b6=_[_0x6a84('0x4c')]({},_0x1681b6,_0x5f096d[_0x6a84('0x4f')]);return _0x24ef05['getApplications'](_0x1681b6);}})[_0x6a84('0x20')](function(_0x1be194){if(_0x1be194){_0x319ae5=_0x1be194[_0x6a84('0x44')];if(!_0x5f096d[_0x6a84('0x3d')][_0x6a84('0x6d')](_0x6a84('0x45'))){_0x1681b6[_0x6a84('0x46')]=qs[_0x6a84('0x46')](_0x5f096d[_0x6a84('0x3d')][_0x6a84('0x46')]);_0x1681b6['offset']=qs[_0x6a84('0x30')](_0x5f096d[_0x6a84('0x3d')][_0x6a84('0x30')]);}return _0x24ef05[_0x6a84('0x80')](_0x1681b6);}})[_0x6a84('0x20')](function(_0x203b71){if(_0x203b71){return _0x203b71?{'count':_0x319ae5,'rows':_0x203b71}:null;}})['then'](respondWithResult(_0x2e1c28,null))[_0x6a84('0x2a')](handleError(_0x2e1c28,null));};function Extension(_0x3c1306,_0x20c49e,_0x158a3b,_0x45b5ef){this[_0x6a84('0x81')]='from-voip-provider';this[_0x6a84('0x82')]=_0x3c1306[_0x6a84('0x83')];this['app']=_0x45b5ef;this['type']=_0x6a84('0x84');this['description']='Fax\x20Extension';this[_0x6a84('0x64')]=_0x3c1306['id'];this['priority']=_0x20c49e;this[_0x6a84('0x85')]=_0x158a3b;}function createExtensionsReciveFax(_0x35deda){var _0x48d1ac=0x1;var _0xa3fbb9=[];_0xa3fbb9['push'](new Extension(_0x35deda,_0x48d1ac,'',_0x6a84('0x86')));_0x48d1ac+=0x1;_0xa3fbb9[_0x6a84('0x87')](new Extension(_0x35deda,_0x48d1ac,'CDR(type)=inbound-fax',_0x6a84('0x88')));_0x48d1ac+=0x1;for(var _0x41fb88 in _0x35deda){if(_0x35deda[_0x6a84('0x6d')](_0x41fb88)&&(_0x41fb88==='ecm'||_0x41fb88===_0x6a84('0x83')||_0x41fb88===_0x6a84('0x89')||_0x41fb88===_0x6a84('0x8a')||_0x41fb88===_0x6a84('0x8b')||_0x41fb88==='maxrate'||_0x41fb88===_0x6a84('0x8c')||_0x41fb88===_0x6a84('0x8d')||_0x41fb88===_0x6a84('0x8e'))){_0xa3fbb9[_0x6a84('0x87')](new Extension(_0x35deda,_0x48d1ac,'FAXOPT('+_0x41fb88+')='+_0x35deda[_0x41fb88],_0x6a84('0x88')));_0x48d1ac+=0x1;}}_0xa3fbb9[_0x6a84('0x87')](new Extension(_0x35deda,_0x48d1ac,'6','Wait'));_0x48d1ac+=0x1;_0xa3fbb9['push'](new Extension(_0x35deda,_0x48d1ac,_0x6a84('0x8f'),_0x6a84('0x90')));_0x48d1ac=0x0;return _0xa3fbb9;}exports['addAccountApplications']=function(_0x363b13,_0x36bff9,_0x4d8f10){var _0x535f80;return db[_0x6a84('0x7b')][_0x6a84('0x91')](function(_0x1764cf){return db[_0x6a84('0x39')][_0x6a84('0x56')](_0x363b13[_0x6a84('0x57')],{'transaction':_0x1764cf})['then'](function(_0x34b8ef){_0x535f80=_0x34b8ef['get']({'plain':!![]});return db['VoiceExtension'][_0x6a84('0x7d')](createExtensionsReciveFax(_0x535f80),{'transaction':_0x1764cf});});})['then'](function(){return _0x535f80;})[_0x6a84('0x20')](respondWithResult(_0x36bff9,null))[_0x6a84('0x2a')](handleError(_0x36bff9,null));};exports[_0x6a84('0x92')]=function(_0xcb7cf5,_0x36fe4f,_0x4faf80){var _0x8193a3;return db['sequelize'][_0x6a84('0x91')](function(_0x20af1b){return db[_0x6a84('0x39')][_0x6a84('0x5f')](_0xcb7cf5[_0x6a84('0x57')],{'where':{'id':_0xcb7cf5[_0x6a84('0x57')]['id']},'transaction':_0x20af1b})['then'](function(_0x41b682){return db[_0x6a84('0x93')]['destroy']({'where':{'FaxAccountId':_0xcb7cf5['body']['id']},'transaction':_0x20af1b})['then'](function(_0x301a57){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x6a84('0x94')](_0xcb7cf5[_0x6a84('0x57')],[_0x6a84('0x95'),_0x6a84('0x96'),'createdAt',_0x6a84('0x97'),_0x6a84('0x98'),_0x6a84('0x99')])),{'transaction':_0x20af1b});});});})[_0x6a84('0x20')](function(){return db['FaxAccount'][_0x6a84('0x9a')](_0xcb7cf5[_0x6a84('0x57')]['id']);})[_0x6a84('0x20')](respondWithResult(_0x36fe4f,null))['catch'](handleError(_0x36fe4f,null));};exports['getMessages']=function(_0x5ba9b4,_0x3f1e73,_0x2dd5b7){var _0x11b6a0={'raw':!![],'where':{}};var _0x4da675={};var _0x42b3c3={'count':0x0,'rows':[]};return db[_0x6a84('0x39')]['findOne']({'where':{'id':_0x5ba9b4[_0x6a84('0x60')]['id']}})[_0x6a84('0x20')](handleEntityNotFound(_0x3f1e73,null))[_0x6a84('0x20')](function(_0x3d2c54){if(_0x3d2c54){_0x4da675[_0x6a84('0x3b')]=_[_0x6a84('0x3c')](db[_0x6a84('0x9b')]['rawAttributes']);_0x4da675[_0x6a84('0x3d')]=_[_0x6a84('0x3c')](_0x5ba9b4[_0x6a84('0x3d')]);_0x4da675[_0x6a84('0x40')]=_[_0x6a84('0x41')](_0x4da675['model'],_0x4da675[_0x6a84('0x3d')]);_0x11b6a0[_0x6a84('0x42')]=_['intersection'](_0x4da675[_0x6a84('0x3b')],qs[_0x6a84('0x43')](_0x5ba9b4['query'][_0x6a84('0x43')]));_0x11b6a0[_0x6a84('0x42')]=_0x11b6a0[_0x6a84('0x42')][_0x6a84('0x44')]?_0x11b6a0[_0x6a84('0x42')]:_0x4da675[_0x6a84('0x3b')];if(!_0x5ba9b4[_0x6a84('0x3d')][_0x6a84('0x6d')](_0x6a84('0x45'))){_0x11b6a0['limit']=qs['limit'](_0x5ba9b4['query'][_0x6a84('0x46')]);_0x11b6a0[_0x6a84('0x30')]=qs['offset'](_0x5ba9b4['query']['offset']);}_0x11b6a0[_0x6a84('0x68')]=qs['sort'](_0x5ba9b4[_0x6a84('0x3d')][_0x6a84('0x47')]);_0x11b6a0[_0x6a84('0x48')]=qs[_0x6a84('0x40')](_[_0x6a84('0x49')](_0x5ba9b4['query'],_0x4da675[_0x6a84('0x40')]));_0x11b6a0[_0x6a84('0x48')][_0x6a84('0x64')]=_0x3d2c54['id'];if(_0x5ba9b4[_0x6a84('0x3d')][_0x6a84('0x4d')]){_0x11b6a0[_0x6a84('0x48')]=_[_0x6a84('0x4c')](_0x11b6a0['where'],{'$or':_[_0x6a84('0x4e')](_0x11b6a0[_0x6a84('0x42')],function(_0x1680c5){var _0x5dfc4a={};_0x5dfc4a[_0x1680c5]={'$like':'%'+_0x5ba9b4[_0x6a84('0x3d')]['filter']+'%'};return _0x5dfc4a;})});}if(_0x5ba9b4[_0x6a84('0x3d')]['$gte']){var _0xcbf277=_0x5ba9b4['query']['$gte'][_0x6a84('0x9c')](',');var _0x31f667={};_0x31f667[_0xcbf277[0x0]]={'$gte':moment(_0xcbf277[0x1])['format'](_0x6a84('0x9d'))};_0x11b6a0[_0x6a84('0x48')]=_[_0x6a84('0x4c')](_0x11b6a0[_0x6a84('0x48')],_0x31f667);}_0x11b6a0=_[_0x6a84('0x4c')]({},_0x11b6a0,_0x5ba9b4[_0x6a84('0x4f')]);return db['FaxMessage'][_0x6a84('0x2f')]({'where':_0x11b6a0['where']})[_0x6a84('0x20')](function(_0x5c2d1c){_0x42b3c3['count']=_0x5c2d1c;if(_0x5ba9b4['query'][_0x6a84('0x54')]){_0x11b6a0['include']=[{'all':!![]}];}return db['FaxMessage'][_0x6a84('0x51')](_0x11b6a0);})[_0x6a84('0x20')](function(_0x2d13bc){_0x42b3c3[_0x6a84('0x52')]=_0x2d13bc;return _0x42b3c3;});}})[_0x6a84('0x20')](respondWithFilteredResult(_0x3f1e73,_0x11b6a0))[_0x6a84('0x2a')](handleError(_0x3f1e73,null));};exports['send']=function(_0x5d9769,_0x782d4d,_0x7e0cc2){var _0xfb8080,_0x484203={},_0x2d6061;if(_0x5d9769[_0x6a84('0x57')]['to']){_0x2d6061=_0x5d9769[_0x6a84('0x57')]['to'][0x0];}return db[_0x6a84('0x39')][_0x6a84('0x55')]({'where':{'id':_0x5d9769[_0x6a84('0x60')]['id']},'include':[{'model':db[_0x6a84('0x9e')],'as':_0x6a84('0x9f'),'include':[{'model':db[_0x6a84('0x72')],'as':_0x6a84('0xa0'),'where':{'fax':_0x2d6061},'limit':0x1,'order':[[_0x6a84('0x97'),_0x6a84('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x782d4d,null))[_0x6a84('0x20')](function(_0x46cf04){_0xfb8080=_0x46cf04;if(_0x5d9769[_0x6a84('0x57')]['attachments']&&_0x5d9769[_0x6a84('0x57')]['attachments'][_0x6a84('0x44')]){for(var _0x5e3217=0x0;_0x5e3217<_0x5d9769['body'][_0x6a84('0xa2')][_0x6a84('0x44')];_0x5e3217+=0x1){_0x5d9769[_0x6a84('0x57')][_0x6a84('0xa2')][_0x5e3217]={'filename':_0x5d9769[_0x6a84('0x57')][_0x6a84('0xa2')][_0x5e3217]['name'],'id':_0x5d9769[_0x6a84('0x57')][_0x6a84('0xa2')][_0x5e3217]['id'],'path':path['join'](config[_0x6a84('0xa3')],_0x6a84('0xa4'),_0x5d9769[_0x6a84('0x57')]['attachments'][_0x5e3217][_0x6a84('0xa5')])};}}return respondWithRpcPromise('CheckAfterSend',_0x6a84('0xa6'),{'FaxAccountId':_[_0x6a84('0xa7')](_0x5d9769['params']['id'])?undefined:_0x5d9769[_0x6a84('0x60')]['id'],'path':_[_0x6a84('0xa7')](_0x5d9769[_0x6a84('0x57')][_0x6a84('0xa2')][0x0]['path'])?undefined:_0x5d9769[_0x6a84('0x57')][_0x6a84('0xa2')][0x0][_0x6a84('0xa8')],'fax':_[_0x6a84('0xa7')](_0x5d9769[_0x6a84('0x57')]['to'][0x0])?undefined:_0x5d9769[_0x6a84('0x57')]['to'][0x0]},client9002);})['then'](function(){if(_0xfb8080){if(_['isNil'](_0x5d9769[_0x6a84('0x57')][_0x6a84('0xa9')])){_0x5d9769['body']['from']=util[_0x6a84('0xaa')](_0x6a84('0xab'),_0xfb8080[_0x6a84('0x37')],_0xfb8080['fax']);}if(_0xfb8080['List']){if(_0xfb8080['List'][_0x6a84('0xa0')]['length']){return _0xfb8080[_0x6a84('0x9f')][_0x6a84('0xa0')][0x0];}else{return db['CmContact'][_0x6a84('0x56')](_[_0x6a84('0x18')](_0x5d9769[_0x6a84('0x57')],{'firstName':_0x5d9769[_0x6a84('0x57')]['to'][0x0],'phone':_0x5d9769[_0x6a84('0x57')]['to'][0x0],'fax':_0x5d9769[_0x6a84('0x57')]['to'][0x0],'ListId':_0xfb8080[_0x6a84('0x99')]}));}}else{throw new Error(_0x6a84('0xac'));}}else{throw new Error(_0x6a84('0xad'));}})[_0x6a84('0x20')](function(_0x2b7c3b){if(_0x2b7c3b){return db[_0x6a84('0x70')][_0x6a84('0x55')]({'where':{'ContactId':_0x2b7c3b['id'],'closed':![],'FaxAccountId':_0xfb8080['id']}})[_0x6a84('0x20')](function(_0x4a07bf){if(_0x4a07bf){return[_0x4a07bf,![]];}return db[_0x6a84('0x70')][_0x6a84('0x56')]({'UserId':_0x5d9769[_0x6a84('0xae')]['id'],'ContactId':_0x2b7c3b['id'],'FaxAccountId':_0xfb8080['id'],'fax':_0x5d9769['body']['to'][0x0],'firstMsgDirection':_0x6a84('0xaf'),'Messages':[_[_0x6a84('0x4c')](_0x5d9769['body'],{'read':![],'body':_0x5d9769[_0x6a84('0x57')][_0x6a84('0xa2')][0x0]['filename'],'FaxAccountId':_0xfb8080['id'],'UserId':_0x5d9769[_0x6a84('0xae')]['id'],'ContactId':_0x2b7c3b['id'],'AttachmentId':_0x5d9769['body'][_0x6a84('0xa2')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x6a84('0xb0')}]})[_0x6a84('0x20')](function(_0x152cbb){return[_0x152cbb,!![]];});});}else{throw new Error(_0x6a84('0xb1'));}})['spread'](function(_0x5655e0,_0x1c768b){if(_0x1c768b){return _0x5655e0;}return db['FaxMessage'][_0x6a84('0x56')]({'direction':'out','read':![],'body':_0x5d9769[_0x6a84('0x57')][_0x6a84('0xa2')][0x0][_0x6a84('0xb2')],'FaxAccountId':_0xfb8080['id'],'FaxInteractionId':_0x5655e0['id'],'UserId':_0x5d9769[_0x6a84('0xae')]['id'],'ContactId':_0x5655e0[_0x6a84('0xb3')],'AttachmentId':_0x5d9769[_0x6a84('0x57')][_0x6a84('0xa2')][0x0]['id']})['then'](function(_0x1e392e){_0x5655e0[_0x6a84('0xb4')][_0x6a84('0xb0')]=[];_0x5655e0['dataValues'][_0x6a84('0xb0')][_0x6a84('0x87')](_0x1e392e['dataValues']);return _0x5655e0;});})[_0x6a84('0x20')](function(_0x2007c7){respondWithRpcPromise(_0x6a84('0xb5'),_0x6a84('0xb5'),{'FaxAccountId':_['isNil'](_0x5d9769[_0x6a84('0x60')]['id'])?undefined:_0x5d9769[_0x6a84('0x60')]['id'],'path':_[_0x6a84('0xa7')](_0x5d9769[_0x6a84('0x57')][_0x6a84('0xa2')][0x0]['path'])?undefined:_0x5d9769[_0x6a84('0x57')]['attachments'][0x0][_0x6a84('0xa8')],'fax':_[_0x6a84('0xa7')](_0x5d9769[_0x6a84('0x57')]['to'][0x0])?undefined:_0x5d9769['body']['to'][0x0],'AttachmentId':_0x5d9769[_0x6a84('0x57')]['attachments'][0x0]['id']},client9002)['then'](function(_0x3f7619){logger[_0x6a84('0x21')](_0x6a84('0xb6'),_0x3f7619);})[_0x6a84('0x2a')](function(_0x4c2b9b){logger[_0x6a84('0x21')](_0x6a84('0xb6'),_0x4c2b9b);});return _0x2007c7;})['then'](respondWithResult(_0x782d4d,null))[_0x6a84('0x2a')](handleError(_0x782d4d,null));};exports['addAgents']=function(_0x5719a7,_0xbfc3b0,_0x423a6d){return db[_0x6a84('0x39')][_0x6a84('0x55')]({'where':{'id':_0x5719a7[_0x6a84('0x60')]['id']}})[_0x6a84('0x20')](handleEntityNotFound(_0xbfc3b0,null))['then'](function(_0x3e00eb){if(_0x3e00eb){return _0x3e00eb[_0x6a84('0xb7')](_0x5719a7['body'][_0x6a84('0x6a')],_[_0x6a84('0x94')](_0x5719a7['body'],['ids','id'])||{})[_0x6a84('0xb8')](function(_0x190f3a){for(var _0x4aa11c=0x0;_0x4aa11c<_0x5719a7[_0x6a84('0x57')]['ids']['length'];_0x4aa11c+=0x1){socket[_0x6a84('0xb9')](_0x6a84('0xba'),{'UserId':_0x5719a7[_0x6a84('0x57')][_0x6a84('0x6a')][_0x4aa11c],'FaxAccountId':_0x5719a7[_0x6a84('0x60')]['id']});}return _0x190f3a;});}})[_0x6a84('0x20')](respondWithResult(_0xbfc3b0,null))[_0x6a84('0x2a')](handleError(_0xbfc3b0,null));};exports[_0x6a84('0xbb')]=function(_0x2ffc33,_0x3f12f8,_0x9ddb61){var _0x132e03;return db['FaxAccount'][_0x6a84('0x55')]({'where':{'id':_0x2ffc33['params']['id']}})['then'](handleEntityNotFound(_0x3f12f8,null))[_0x6a84('0x20')](function(_0x4bc0ed){if(_0x4bc0ed){return _0x4bc0ed[_0x6a84('0xbb')](_0x2ffc33['query'][_0x6a84('0x6a')])['then'](function(_0x1041bb){if(_[_0x6a84('0xbc')](_0x2ffc33[_0x6a84('0x3d')]['ids'])){for(var _0x3a4fa9=0x0;_0x3a4fa9<_0x2ffc33[_0x6a84('0x3d')]['ids'][_0x6a84('0x44')];_0x3a4fa9+=0x1){socket[_0x6a84('0xb9')](_0x6a84('0xbd'),{'UserId':_0x2ffc33[_0x6a84('0x3d')][_0x6a84('0x6a')][_0x3a4fa9],'FaxAccountId':_0x2ffc33[_0x6a84('0x60')]['id']});}}else{socket[_0x6a84('0xb9')](_0x6a84('0xbd'),{'UserId':_0x2ffc33[_0x6a84('0x3d')]['ids'],'FaxAccountId':_0x2ffc33[_0x6a84('0x60')]['id']});}});}})[_0x6a84('0x20')](respondWithStatusCode(_0x3f12f8,null))[_0x6a84('0x2a')](handleError(_0x3f12f8,null));};exports[_0x6a84('0xbe')]=function(_0x380d5b,_0x83f5c2,_0x527274){var _0x469c63={};var _0x57b5cc={};var _0x439079;var _0x50e90b;return db[_0x6a84('0x39')][_0x6a84('0x67')]({'where':{'id':_0x380d5b[_0x6a84('0x60')]['id']}})['then'](handleEntityNotFound(_0x83f5c2,null))[_0x6a84('0x20')](function(_0x409216){if(_0x409216){_0x439079=_0x409216;_0x57b5cc[_0x6a84('0x3b')]=_['keys'](db[_0x6a84('0x74')][_0x6a84('0x3a')]);_0x57b5cc[_0x6a84('0x3d')]=_['keys'](_0x380d5b[_0x6a84('0x3d')]);_0x57b5cc[_0x6a84('0x40')]=_[_0x6a84('0x41')](_0x57b5cc[_0x6a84('0x3b')],_0x57b5cc[_0x6a84('0x3d')]);_0x469c63['attributes']=_[_0x6a84('0x41')](_0x57b5cc[_0x6a84('0x3b')],qs[_0x6a84('0x43')](_0x380d5b[_0x6a84('0x3d')][_0x6a84('0x43')]));_0x469c63['attributes']=_0x469c63[_0x6a84('0x42')]['length']?_0x469c63[_0x6a84('0x42')]:_0x57b5cc['model'];_0x469c63[_0x6a84('0x68')]=qs['sort'](_0x380d5b[_0x6a84('0x3d')]['sort']);_0x469c63[_0x6a84('0x48')]=qs[_0x6a84('0x40')](_[_0x6a84('0x49')](_0x380d5b[_0x6a84('0x3d')],_0x57b5cc[_0x6a84('0x40')]));if(_0x380d5b['query'][_0x6a84('0x4d')]){_0x469c63[_0x6a84('0x48')]=_[_0x6a84('0x4c')](_0x469c63[_0x6a84('0x48')],{'$or':_[_0x6a84('0x4e')](_0x469c63['attributes'],function(_0x46dc4f){var _0xb54841={};_0xb54841[_0x46dc4f]={'$like':'%'+_0x380d5b[_0x6a84('0x3d')][_0x6a84('0x4d')]+'%'};return _0xb54841;})});}_0x469c63=_[_0x6a84('0x4c')]({},_0x469c63,_0x380d5b['options']);return _0x439079[_0x6a84('0xbe')](_0x469c63);}})[_0x6a84('0x20')](function(_0x36a9fd){if(_0x36a9fd){_0x50e90b=_0x36a9fd[_0x6a84('0x44')];if(!_0x380d5b['query'][_0x6a84('0x6d')](_0x6a84('0x45'))){_0x469c63[_0x6a84('0x46')]=qs[_0x6a84('0x46')](_0x380d5b[_0x6a84('0x3d')]['limit']);_0x469c63[_0x6a84('0x30')]=qs[_0x6a84('0x30')](_0x380d5b[_0x6a84('0x3d')]['offset']);}return _0x439079[_0x6a84('0xbe')](_0x469c63);}})[_0x6a84('0x20')](function(_0x36fe17){if(_0x36fe17){return _0x36fe17?{'count':_0x50e90b,'rows':_0x36fe17}:null;}})[_0x6a84('0x20')](respondWithResult(_0x83f5c2,null))['catch'](handleError(_0x83f5c2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f7162ad..a7d97e7 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 _0x81ce=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x3786dd,_0x5777fc){var _0x4c7a8e=function(_0x119047){while(--_0x119047){_0x3786dd['push'](_0x3786dd['shift']());}};_0x4c7a8e(++_0x5777fc);}(_0x81ce,0x137));var _0xe81c=function(_0x3d8778,_0x1fa476){_0x3d8778=_0x3d8778-0x0;var _0x2cdc24=_0x81ce[_0x3d8778];return _0x2cdc24;};'use strict';var EventEmitter=require(_0xe81c('0x0'));var FaxAccount=require(_0xe81c('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe81c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe81c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1067f2){return function(_0x474748,_0x20a3c6,_0x3ffbe1){FaxAccountEvents[_0xe81c('0x4')](_0x1067f2+':'+_0x474748['id'],_0x474748);FaxAccountEvents['emit'](_0x1067f2,_0x474748);_0x3ffbe1(null);};}for(var e in events){if(events[_0xe81c('0x5')](e)){var event=events[e];FaxAccount[_0xe81c('0x6')](e,emitEvent(event));}}module[_0xe81c('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xac07=['remove','emit','hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners','save'];(function(_0x4ca26d,_0xda63ac){var _0x481f28=function(_0x363b56){while(--_0x363b56){_0x4ca26d['push'](_0x4ca26d['shift']());}};_0x481f28(++_0xda63ac);}(_0xac07,0x140));var _0x7ac0=function(_0xb10c60,_0x4e6a27){_0xb10c60=_0xb10c60-0x0;var _0x5adcf0=_0xac07[_0xb10c60];return _0x5adcf0;};'use strict';var EventEmitter=require(_0x7ac0('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x7ac0('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x7ac0('0x2')](0x0);var events={'afterCreate':_0x7ac0('0x3'),'afterUpdate':'update','afterDestroy':_0x7ac0('0x4')};function emitEvent(_0x77d928){return function(_0x468be3,_0x1424a7,_0x2a57de){FaxAccountEvents[_0x7ac0('0x5')](_0x77d928+':'+_0x468be3['id'],_0x468be3);FaxAccountEvents[_0x7ac0('0x5')](_0x77d928,_0x468be3);_0x2a57de(null);};}for(var e in events){if(events[_0x7ac0('0x6')](e)){var event=events[e];FaxAccount[_0x7ac0('0x7')](e,emitEvent(event));}}module[_0x7ac0('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index af6294e..40ef4d7 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 _0xb58b=['FaxAccount','util','../../config/logger','api','bluebird','request-promise','exports','define'];(function(_0x4ec692,_0x43f0a4){var _0x1e9b44=function(_0xe040b9){while(--_0xe040b9){_0x4ec692['push'](_0x4ec692['shift']());}};_0x1e9b44(++_0x43f0a4);}(_0xb58b,0x1f1));var _0xbb58=function(_0x593c84,_0x2dcc2a){_0x593c84=_0x593c84-0x0;var _0x2c939d=_0xb58b[_0x593c84];return _0x2c939d;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var moment=require('moment');var BPromise=require(_0xbb58('0x3'));var rp=require(_0xbb58('0x4'));var attributes=require('./faxAccount.attributes');module[_0xbb58('0x5')]=function(_0x546510,_0x2edb10){return _0x546510[_0xbb58('0x6')](_0xbb58('0x7'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9da2=['api','moment','bluebird','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','../../config/logger'];(function(_0x496a84,_0x1267f1){var _0x5d195b=function(_0x5af401){while(--_0x5af401){_0x496a84['push'](_0x496a84['shift']());}};_0x5d195b(++_0x1267f1);}(_0x9da2,0x15b));var _0x29da=function(_0xc79e5,_0x4640d5){_0xc79e5=_0xc79e5-0x0;var _0x447a35=_0x9da2[_0xc79e5];return _0x447a35;};'use strict';var _=require(_0x29da('0x0'));var util=require(_0x29da('0x1'));var logger=require(_0x29da('0x2'))(_0x29da('0x3'));var moment=require(_0x29da('0x4'));var BPromise=require(_0x29da('0x5'));var rp=require('request-promise');var attributes=require(_0x29da('0x6'));module['exports']=function(_0x2be939,_0x566063){return _0x2be939[_0x29da('0x7')](_0x29da('0x8'),attributes,{'tableName':_0x29da('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 ae444d8..8d17721 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 _0x874e=['FaxInteraction','Contact\x20not\x20found','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','name','unshift','waitForTheAssignedAgent','startRouting','Start','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','findAll','options','attributes','limit','map','include','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','keys','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','List','Contacts','Applications','get','account','applications','orderBy','priority','length','defaults','ListId','create','contact'];(function(_0x4cfbf3,_0x826dd0){var _0x12aba4=function(_0x5d2eb4){while(--_0x5d2eb4){_0x4cfbf3['push'](_0x4cfbf3['shift']());}};_0x12aba4(++_0x826dd0);}(_0x874e,0xb9));var _0xe874=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x874e[_0x548627];return _0x844a84;};'use strict';var _=require(_0xe874('0x0'));var util=require('util');var moment=require(_0xe874('0x1'));var BPromise=require('bluebird');var rs=require(_0xe874('0x2'));var fs=require('fs');var Redis=require(_0xe874('0x3'));var db=require(_0xe874('0x4'))['db'];var utils=require(_0xe874('0x5'));var logger=require(_0xe874('0x6'))(_0xe874('0x7'));var config=require(_0xe874('0x8'));var jayson=require(_0xe874('0x9'));var client=jayson['client'][_0xe874('0xa')]({'port':0x232c});config[_0xe874('0xb')]=_['defaults'](config[_0xe874('0xb')],{'host':_0xe874('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe874('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x27d170,_0x1e4472,_0xa510a7){return new BPromise(function(_0x1682cf,_0x377900){return client[_0xe874('0xd')](_0x27d170,_0xa510a7)[_0xe874('0xe')](function(_0xdd64bf){logger[_0xe874('0xf')]('FaxAccount,\x20%s,\x20%s',_0x1e4472,_0xe874('0x10'));logger[_0xe874('0x11')](_0xe874('0x12'),_0x1e4472,_0xe874('0x10'),JSON[_0xe874('0x13')](_0xdd64bf));if(_0xdd64bf[_0xe874('0x14')]){if(_0xdd64bf[_0xe874('0x14')]['code']===0x1f4){logger[_0xe874('0x14')](_0xe874('0x15'),_0x1e4472,_0xdd64bf[_0xe874('0x14')][_0xe874('0x16')]);return _0x377900(_0xdd64bf[_0xe874('0x14')]['message']);}logger[_0xe874('0x14')]('FaxAccount,\x20%s,\x20%s',_0x1e4472,_0xdd64bf['error'][_0xe874('0x16')]);return _0x1682cf(_0xdd64bf['error'][_0xe874('0x16')]);}else{logger['info'](_0xe874('0x15'),_0x1e4472,_0xe874('0x10'));_0x1682cf(_0xdd64bf[_0xe874('0x17')][_0xe874('0x16')]);}})[_0xe874('0x18')](function(_0x2f2257){logger[_0xe874('0x14')](_0xe874('0x15'),_0x1e4472,_0x2f2257);_0x377900(_0x2f2257);});});}exports[_0xe874('0x19')]=function(_0x374b0c){var _0x522359=this;return new Promise(function(_0x5ce2ae,_0x241d62){return db['FaxAccount'][_0xe874('0x1a')]({'raw':_0x374b0c[_0xe874('0x1b')]?_0x374b0c[_0xe874('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x374b0c[_0xe874('0x1b')]?_0x374b0c[_0xe874('0x1b')]['where']||null:null,'attributes':_0x374b0c['options']?_0x374b0c[_0xe874('0x1b')][_0xe874('0x1c')]||null:null,'limit':_0x374b0c[_0xe874('0x1b')]?_0x374b0c[_0xe874('0x1b')][_0xe874('0x1d')]||null:null,'include':_0x374b0c[_0xe874('0x1b')]?_0x374b0c[_0xe874('0x1b')]['include']?_[_0xe874('0x1e')](_0x374b0c[_0xe874('0x1b')][_0xe874('0x1f')],function(_0x14c1a9){return{'model':db[_0x14c1a9[_0xe874('0x20')]],'as':_0x14c1a9['as'],'attributes':_0x14c1a9[_0xe874('0x1c')],'include':_0x14c1a9['include']?_[_0xe874('0x1e')](_0x14c1a9[_0xe874('0x1f')],function(_0x45edd0){return{'model':db[_0x45edd0[_0xe874('0x20')]],'as':_0x45edd0['as'],'attributes':_0x45edd0['attributes'],'include':_0x45edd0[_0xe874('0x1f')]?_['map'](_0x45edd0[_0xe874('0x1f')],function(_0x29dbb6){return{'model':db[_0x29dbb6['model']],'as':_0x29dbb6['as'],'attributes':_0x29dbb6[_0xe874('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe874('0xe')](function(_0x54ff76){logger['info'](_0xe874('0x19'),_0x374b0c);logger['debug'](_0xe874('0x19'),_0x374b0c,JSON[_0xe874('0x13')](_0x54ff76));_0x5ce2ae(_0x54ff76);})[_0xe874('0x18')](function(_0x23b3ca){logger[_0xe874('0x14')](_0xe874('0x19'),_0x23b3ca[_0xe874('0x16')],_0x374b0c);_0x241d62(_0x522359[_0xe874('0x14')](0x1f4,_0x23b3ca[_0xe874('0x16')]));});});};exports[_0xe874('0x21')]=function(_0x385468,_0x50c4a8,_0x188553){var _0x2f4c41=this;return new Promise(function(_0x3f225c,_0x4949e0){var _0x3f486a={'body':_0x385468[_0xe874('0x22')],'channel':_0xe874('0x23')};var _0x5daf90=[];var _0x5c41b4=[];var _0x367dc9={};return db[_0xe874('0x24')][_0xe874('0x25')]()[_0xe874('0xe')](function(_0x4ddb52){if(!_0x4ddb52){throw new db[(_0xe874('0x26'))][(_0xe874('0x27'))](_0xe874('0x28'));}_0x5daf90=_[_0xe874('0x29')](_['keys'](_0x4ddb52),['createdAt',_0xe874('0x2a')]);_0x5c41b4=_['difference'](_[_0xe874('0x2b')](_0x4ddb52),['createdAt',_0xe874('0x2a'),'CompanyId','ListId']);if(_0x385468[_0xe874('0x22')]['id']){delete _0x385468[_0xe874('0x22')]['id'];}if(_[_0xe874('0x2c')](_0x385468[_0xe874('0x22')][_0xe874('0x2d')])){throw new db[(_0xe874('0x26'))]['ValidationError'](_0xe874('0x2e'));}if(_[_0xe874('0x2c')](_0x385468[_0xe874('0x22')][_0xe874('0x22')])||_0x385468['body'][_0xe874('0x22')]===''){throw new db[(_0xe874('0x26'))][(_0xe874('0x27'))](_0xe874('0x2f'));}if(_[_0xe874('0x2c')](_0x385468[_0xe874('0x22')]['mapKey'])){throw new db[(_0xe874('0x26'))][(_0xe874('0x27'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5c41b4);}if(!_[_0xe874('0x30')](_0x5c41b4,_0x385468[_0xe874('0x22')][_0xe874('0x31')])){throw new db[(_0xe874('0x26'))][(_0xe874('0x27'))](_0xe874('0x32')+_0x5c41b4);}_0x367dc9[_0x385468[_0xe874('0x22')]['mapKey']]=_0x385468[_0xe874('0x22')][_0xe874('0x2d')];})[_0xe874('0xe')](function(){return db[_0xe874('0x33')][_0xe874('0x34')]({'where':{'id':_0x385468['account']['id']},'include':[{'model':db[_0xe874('0x35')],'as':_0xe874('0x36'),'include':[{'model':db[_0xe874('0x24')],'as':_0xe874('0x37'),'where':_0x367dc9,'limit':0x1,'order':[[_0xe874('0x2a'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0xe874('0x38')}]});})[_0xe874('0xe')](function(_0x2ce295){if(_0x2ce295&&_0x2ce295[_0xe874('0x36')]){var _0x4f364c=_0x2ce295[_0xe874('0x39')]({'plain':!![]});_0x3f486a[_0xe874('0x3a')]=_0x4f364c;_0x3f486a[_0xe874('0x3b')]=_0x4f364c[_0xe874('0x38')];_0x3f486a['list']=_0x4f364c['List'];_0x3f486a['applications']=_[_0xe874('0x3c')](_0x3f486a[_0xe874('0x3b')],[_0xe874('0x3d')],['asc']);if(_0x3f486a['account']['Applications']){delete _0x3f486a[_0xe874('0x3a')][_0xe874('0x38')];}if(_0x3f486a[_0xe874('0x3a')][_0xe874('0x36')]&&_0x3f486a[_0xe874('0x3a')][_0xe874('0x36')][_0xe874('0x37')][_0xe874('0x3e')]){return _0x3f486a[_0xe874('0x3a')][_0xe874('0x36')][_0xe874('0x37')][0x0];}var _0x4bc72b=_[_0xe874('0x3f')](_0x385468['body'],{'firstName':_0x385468['body'][_0xe874('0x2d')],'ListId':_0x4f364c[_0xe874('0x40')]});_0x4bc72b[_0x385468[_0xe874('0x22')]['mapKey']]=_0x385468[_0xe874('0x22')][_0xe874('0x2d')];return db[_0xe874('0x24')][_0xe874('0x41')](_0x4bc72b,{'fields':_0x5daf90,'raw':!![]});}})['then'](function(_0x4a085a){_0x3f486a[_0xe874('0x42')]=_0x4a085a;if(_0x4a085a){var _0x274394={'ContactId':_0x4a085a['id'],'FaxAccountId':_0x385468[_0xe874('0x3a')]['id'],'fax':_0x4a085a[_0xe874('0x23')]};return db[_0xe874('0x43')][_0xe874('0x34')]({'where':{'ContactId':_0x4a085a['id'],'closed':![],'FaxAccountId':_0x385468[_0xe874('0x3a')]['id']}})[_0xe874('0xe')](function(_0xd8b313){if(_0xd8b313){return[_0xd8b313,![]];}return db['FaxInteraction']['create'](_0x274394)[_0xe874('0xe')](function(_0x31beb3){return[_0x31beb3,!![]];});});}else{throw new Error(_0xe874('0x44'));}})['spread'](function(_0x4a4e6e,_0x39d022){var _0x39a3ee=_0x4a4e6e[_0xe874('0x39')]({'plain':!![]});if(_0x39d022){if(_0x3f486a[_0xe874('0x3a')][_0xe874('0x45')]){_0x3f486a[_0xe874('0x3b')][_0xe874('0x46')]({'id':0x0,'priority':_0x3f486a[_0xe874('0x3b')]['length']+0x1,'app':'close','appdata':_0xe874('0x47'),'interval':_0xe874('0x48')});}_0x39a3ee[_0xe874('0x49')]=!![];}else{_0x39a3ee['created']=![];}_0x3f486a['interaction']=_0x39a3ee;return db[_0xe874('0x4a')][_0xe874('0x41')]({'body':_0x385468['body'][_0xe874('0x22')],'FaxAccountId':_0x385468['account']['id'],'FaxInteractionId':_0x4a4e6e['id'],'direction':'in','ContactId':_0x4a4e6e[_0xe874('0x4b')],'AttachmentId':_0x385468['body']['AttachmentId']});})[_0xe874('0xe')](function(_0x315869){_0x3f486a[_0xe874('0x16')]=_0x315869;if(_0x3f486a[_0xe874('0x4c')][_0xe874('0x4d')]){return db[_0xe874('0x4e')]['find']({'attributes':['id',_0xe874('0x4f')],'where':{'id':_0x3f486a[_0xe874('0x4c')][_0xe874('0x4d')]}})['then'](function(_0x47de2b){if(_0x47de2b){_0x3f486a[_0xe874('0x3b')][_0xe874('0x50')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x47de2b[_0xe874('0x4f')]+','+(_0x3f486a[_0xe874('0x3a')][_0xe874('0x51')]||0xa),'interval':_0xe874('0x48')});}return respondWithRpcPromise('Start',_0xe874('0x52'),_0x3f486a);});}return respondWithRpcPromise(_0xe874('0x53'),_0xe874('0x52'),_0x3f486a);})[_0xe874('0xe')](function(_0x506cf3){_0x3f225c(_0x506cf3);})[_0xe874('0x18')](function(_0x576de){_0x4949e0(_0x2f4c41[_0xe874('0x14')](0x1f4,_0x576de[_0xe874('0x16')]));});});}; \ No newline at end of file +var _0xcc5b=['DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','Contacts','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','find','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','code','error','message','GetFaxAccount','FaxAccount','findAll','options','where','attributes','include','map','model','then','stringify','catch','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List'];(function(_0x21ca75,_0xfc8555){var _0x36d028=function(_0x55d4e3){while(--_0x55d4e3){_0x21ca75['push'](_0x21ca75['shift']());}};_0x36d028(++_0xfc8555);}(_0xcc5b,0x1e3));var _0xbcc5=function(_0x4423be,_0x75320c){_0x4423be=_0x4423be-0x0;var _0x6af202=_0xcc5b[_0x4423be];return _0x6af202;};'use strict';var _=require(_0xbcc5('0x0'));var util=require(_0xbcc5('0x1'));var moment=require('moment');var BPromise=require(_0xbcc5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbcc5('0x4'))('rpc');var config=require(_0xbcc5('0x5'));var jayson=require(_0xbcc5('0x6'));var client=jayson[_0xbcc5('0x7')][_0xbcc5('0x8')]({'port':0x232c});config[_0xbcc5('0x9')]=_[_0xbcc5('0xa')](config[_0xbcc5('0x9')],{'host':_0xbcc5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbcc5('0x9')]));require(_0xbcc5('0xc'))['register'](socket);function respondWithRpcPromise(_0x41d524,_0x32d82f,_0x240635){return new BPromise(function(_0x24b253,_0x303062){return client[_0xbcc5('0xd')](_0x41d524,_0x240635)['then'](function(_0x48b246){logger[_0xbcc5('0xe')](_0xbcc5('0xf'),_0x32d82f,_0xbcc5('0x10'));logger[_0xbcc5('0x11')](_0xbcc5('0x12'),_0x32d82f,_0xbcc5('0x10'),JSON['stringify'](_0x48b246));if(_0x48b246['error']){if(_0x48b246['error'][_0xbcc5('0x13')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x32d82f,_0x48b246[_0xbcc5('0x14')]['message']);return _0x303062(_0x48b246[_0xbcc5('0x14')][_0xbcc5('0x15')]);}logger[_0xbcc5('0x14')](_0xbcc5('0xf'),_0x32d82f,_0x48b246['error'][_0xbcc5('0x15')]);return _0x24b253(_0x48b246[_0xbcc5('0x14')]['message']);}else{logger[_0xbcc5('0xe')](_0xbcc5('0xf'),_0x32d82f,_0xbcc5('0x10'));_0x24b253(_0x48b246['result'][_0xbcc5('0x15')]);}})['catch'](function(_0x3c856b){logger[_0xbcc5('0x14')](_0xbcc5('0xf'),_0x32d82f,_0x3c856b);_0x303062(_0x3c856b);});});}exports[_0xbcc5('0x16')]=function(_0x5148ea){var _0x510b40=this;return new Promise(function(_0x4e04fa,_0x559ec8){return db[_0xbcc5('0x17')][_0xbcc5('0x18')]({'raw':_0x5148ea[_0xbcc5('0x19')]?_0x5148ea[_0xbcc5('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5148ea[_0xbcc5('0x19')]?_0x5148ea['options'][_0xbcc5('0x1a')]||null:null,'attributes':_0x5148ea[_0xbcc5('0x19')]?_0x5148ea[_0xbcc5('0x19')][_0xbcc5('0x1b')]||null:null,'limit':_0x5148ea[_0xbcc5('0x19')]?_0x5148ea[_0xbcc5('0x19')]['limit']||null:null,'include':_0x5148ea[_0xbcc5('0x19')]?_0x5148ea[_0xbcc5('0x19')][_0xbcc5('0x1c')]?_[_0xbcc5('0x1d')](_0x5148ea[_0xbcc5('0x19')][_0xbcc5('0x1c')],function(_0x41fc86){return{'model':db[_0x41fc86[_0xbcc5('0x1e')]],'as':_0x41fc86['as'],'attributes':_0x41fc86[_0xbcc5('0x1b')],'include':_0x41fc86['include']?_[_0xbcc5('0x1d')](_0x41fc86[_0xbcc5('0x1c')],function(_0x8334a){return{'model':db[_0x8334a[_0xbcc5('0x1e')]],'as':_0x8334a['as'],'attributes':_0x8334a[_0xbcc5('0x1b')],'include':_0x8334a[_0xbcc5('0x1c')]?_[_0xbcc5('0x1d')](_0x8334a[_0xbcc5('0x1c')],function(_0x247d59){return{'model':db[_0x247d59[_0xbcc5('0x1e')]],'as':_0x247d59['as'],'attributes':_0x247d59[_0xbcc5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbcc5('0x1f')](function(_0x3e789b){logger[_0xbcc5('0xe')]('GetFaxAccount',_0x5148ea);logger[_0xbcc5('0x11')](_0xbcc5('0x16'),_0x5148ea,JSON[_0xbcc5('0x20')](_0x3e789b));_0x4e04fa(_0x3e789b);})[_0xbcc5('0x21')](function(_0x4b1a37){logger[_0xbcc5('0x14')]('GetFaxAccount',_0x4b1a37[_0xbcc5('0x15')],_0x5148ea);_0x559ec8(_0x510b40[_0xbcc5('0x14')](0x1f4,_0x4b1a37['message']));});});};exports[_0xbcc5('0x22')]=function(_0x3e5726,_0x55ee6a,_0x63aefe){var _0x34a805=this;return new Promise(function(_0x59d8c4,_0x28e47b){var _0x466759={'body':_0x3e5726['body'],'channel':_0xbcc5('0x23')};var _0x43a179=[];var _0xf96856=[];var _0x3ad8a5={};return db[_0xbcc5('0x24')][_0xbcc5('0x25')]()['then'](function(_0x3d08a1){if(!_0x3d08a1){throw new db[(_0xbcc5('0x26'))][(_0xbcc5('0x27'))](_0xbcc5('0x28'));}_0x43a179=_[_0xbcc5('0x29')](_[_0xbcc5('0x2a')](_0x3d08a1),['createdAt',_0xbcc5('0x2b')]);_0xf96856=_['difference'](_[_0xbcc5('0x2a')](_0x3d08a1),['createdAt',_0xbcc5('0x2b'),_0xbcc5('0x2c'),_0xbcc5('0x2d')]);if(_0x3e5726[_0xbcc5('0x2e')]['id']){delete _0x3e5726[_0xbcc5('0x2e')]['id'];}if(_['isNil'](_0x3e5726[_0xbcc5('0x2e')][_0xbcc5('0x2f')])){throw new db[(_0xbcc5('0x26'))][(_0xbcc5('0x27'))](_0xbcc5('0x30'));}if(_[_0xbcc5('0x31')](_0x3e5726[_0xbcc5('0x2e')]['body'])||_0x3e5726[_0xbcc5('0x2e')][_0xbcc5('0x2e')]===''){throw new db[(_0xbcc5('0x26'))][(_0xbcc5('0x27'))](_0xbcc5('0x32'));}if(_[_0xbcc5('0x31')](_0x3e5726[_0xbcc5('0x2e')][_0xbcc5('0x33')])){throw new db[(_0xbcc5('0x26'))][(_0xbcc5('0x27'))](_0xbcc5('0x34')+_0xf96856);}if(!_['includes'](_0xf96856,_0x3e5726[_0xbcc5('0x2e')][_0xbcc5('0x33')])){throw new db[(_0xbcc5('0x26'))]['ValidationError'](_0xbcc5('0x35')+_0xf96856);}_0x3ad8a5[_0x3e5726[_0xbcc5('0x2e')][_0xbcc5('0x33')]]=_0x3e5726['body'][_0xbcc5('0x2f')];})[_0xbcc5('0x1f')](function(){return db[_0xbcc5('0x17')]['find']({'where':{'id':_0x3e5726[_0xbcc5('0x36')]['id']},'include':[{'model':db[_0xbcc5('0x37')],'as':_0xbcc5('0x38'),'include':[{'model':db[_0xbcc5('0x24')],'as':'Contacts','where':_0x3ad8a5,'limit':0x1,'order':[[_0xbcc5('0x2b'),_0xbcc5('0x39')]]}]},{'model':db[_0xbcc5('0x3a')],'as':_0xbcc5('0x3b')}]});})[_0xbcc5('0x1f')](function(_0x2d0624){if(_0x2d0624&&_0x2d0624[_0xbcc5('0x38')]){var _0x213ecf=_0x2d0624[_0xbcc5('0x3c')]({'plain':!![]});_0x466759[_0xbcc5('0x36')]=_0x213ecf;_0x466759[_0xbcc5('0x3d')]=_0x213ecf['Applications'];_0x466759[_0xbcc5('0x3e')]=_0x213ecf[_0xbcc5('0x38')];_0x466759['applications']=_[_0xbcc5('0x3f')](_0x466759[_0xbcc5('0x3d')],[_0xbcc5('0x40')],[_0xbcc5('0x41')]);if(_0x466759[_0xbcc5('0x36')][_0xbcc5('0x3b')]){delete _0x466759[_0xbcc5('0x36')][_0xbcc5('0x3b')];}if(_0x466759[_0xbcc5('0x36')][_0xbcc5('0x38')]&&_0x466759['account'][_0xbcc5('0x38')][_0xbcc5('0x42')][_0xbcc5('0x43')]){return _0x466759[_0xbcc5('0x36')]['List'][_0xbcc5('0x42')][0x0];}var _0x1a2cdb=_[_0xbcc5('0xa')](_0x3e5726[_0xbcc5('0x2e')],{'firstName':_0x3e5726[_0xbcc5('0x2e')][_0xbcc5('0x2f')],'ListId':_0x213ecf[_0xbcc5('0x2d')]});_0x1a2cdb[_0x3e5726[_0xbcc5('0x2e')][_0xbcc5('0x33')]]=_0x3e5726['body']['from'];return db[_0xbcc5('0x24')][_0xbcc5('0x44')](_0x1a2cdb,{'fields':_0x43a179,'raw':!![]});}})['then'](function(_0x215177){_0x466759[_0xbcc5('0x45')]=_0x215177;if(_0x215177){var _0x27adc7={'ContactId':_0x215177['id'],'FaxAccountId':_0x3e5726[_0xbcc5('0x36')]['id'],'fax':_0x215177['fax']};return db[_0xbcc5('0x46')]['find']({'where':{'ContactId':_0x215177['id'],'closed':![],'FaxAccountId':_0x3e5726[_0xbcc5('0x36')]['id']}})[_0xbcc5('0x1f')](function(_0x287a98){if(_0x287a98){return[_0x287a98,![]];}return db[_0xbcc5('0x46')][_0xbcc5('0x44')](_0x27adc7)['then'](function(_0xfee6c1){return[_0xfee6c1,!![]];});});}else{throw new Error(_0xbcc5('0x47'));}})[_0xbcc5('0x48')](function(_0x26cfd9,_0x461445){var _0x54e61e=_0x26cfd9[_0xbcc5('0x3c')]({'plain':!![]});if(_0x461445){if(_0x466759[_0xbcc5('0x36')]['autoclose']){_0x466759[_0xbcc5('0x3d')][_0xbcc5('0x49')]({'id':0x0,'priority':_0x466759[_0xbcc5('0x3d')][_0xbcc5('0x43')]+0x1,'app':'close','appdata':_0xbcc5('0x4a'),'interval':_0xbcc5('0x4b')});}_0x54e61e[_0xbcc5('0x4c')]=!![];}else{_0x54e61e[_0xbcc5('0x4c')]=![];}_0x466759[_0xbcc5('0x4d')]=_0x54e61e;return db[_0xbcc5('0x4e')][_0xbcc5('0x44')]({'body':_0x3e5726['body'][_0xbcc5('0x2e')],'FaxAccountId':_0x3e5726[_0xbcc5('0x36')]['id'],'FaxInteractionId':_0x26cfd9['id'],'direction':'in','ContactId':_0x26cfd9[_0xbcc5('0x4f')],'AttachmentId':_0x3e5726['body'][_0xbcc5('0x50')]});})['then'](function(_0x384c6a){_0x466759[_0xbcc5('0x15')]=_0x384c6a;if(_0x466759['interaction'][_0xbcc5('0x51')]){return db[_0xbcc5('0x52')][_0xbcc5('0x53')]({'attributes':['id',_0xbcc5('0x54')],'where':{'id':_0x466759['interaction'][_0xbcc5('0x51')]}})[_0xbcc5('0x1f')](function(_0x1c7694){if(_0x1c7694){_0x466759['applications'][_0xbcc5('0x55')]({'id':0x0,'priority':0x0,'app':_0xbcc5('0x56'),'appdata':_0x1c7694[_0xbcc5('0x54')]+','+(_0x466759[_0xbcc5('0x36')][_0xbcc5('0x57')]||0xa),'interval':_0xbcc5('0x4b')});}return respondWithRpcPromise(_0xbcc5('0x58'),_0xbcc5('0x59'),_0x466759);});}return respondWithRpcPromise('Start',_0xbcc5('0x59'),_0x466759);})[_0xbcc5('0x1f')](function(_0x1925d3){_0x59d8c4(_0x1925d3);})[_0xbcc5('0x21')](function(_0x11b495){_0x28e47b(_0x34a805['error'](0x1f4,_0x11b495[_0xbcc5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 7a360ac..133cda9 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 _0xeab6=['save','update','removeListener','faxAccount:','./faxAccount.events'];(function(_0x561eb7,_0x5279c3){var _0x97ec2=function(_0x52ecf9){while(--_0x52ecf9){_0x561eb7['push'](_0x561eb7['shift']());}};_0x97ec2(++_0x5279c3);}(_0xeab6,0x1a8));var _0x6eab=function(_0x3542dc,_0x1688a7){_0x3542dc=_0x3542dc-0x0;var _0x565444=_0xeab6[_0x3542dc];return _0x565444;};'use strict';var FaxAccountEvents=require(_0x6eab('0x0'));var events=[_0x6eab('0x1'),'remove',_0x6eab('0x2')];function createListener(_0x336d19,_0x19c79f){return function(_0x1e3c5c){_0x19c79f['emit'](_0x336d19,_0x1e3c5c);};}function removeListener(_0x42262f,_0x50f1ce){return function(){FaxAccountEvents[_0x6eab('0x3')](_0x42262f,_0x50f1ce);};}exports['register']=function(_0x26ad43){for(var _0xc6eb28=0x0,_0x1d757d=events['length'];_0xc6eb28<_0x1d757d;_0xc6eb28++){var _0x3dc36e=events[_0xc6eb28];var _0xa9abc1=createListener(_0x6eab('0x4')+_0x3dc36e,_0x26ad43);FaxAccountEvents['on'](_0x3dc36e,_0xa9abc1);}}; \ No newline at end of file +var _0x1a9c=['emit','removeListener','register','faxAccount:','./faxAccount.events'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x1a9c,0x1d0));var _0xc1a9=function(_0x35eb79,_0x4704aa){_0x35eb79=_0x35eb79-0x0;var _0xaa870a=_0x1a9c[_0x35eb79];return _0xaa870a;};'use strict';var FaxAccountEvents=require(_0xc1a9('0x0'));var events=['save','remove','update'];function createListener(_0xe29d4b,_0x1b7cbd){return function(_0x5becd2){_0x1b7cbd[_0xc1a9('0x1')](_0xe29d4b,_0x5becd2);};}function removeListener(_0x119e7a,_0x59f057){return function(){FaxAccountEvents[_0xc1a9('0x2')](_0x119e7a,_0x59f057);};}exports[_0xc1a9('0x3')]=function(_0x48c5e8){for(var _0x515849=0x0,_0x17e8fe=events['length'];_0x515849<_0x17e8fe;_0x515849++){var _0x211a31=events[_0x515849];var _0x53c4be=createListener(_0xc1a9('0x4')+_0x211a31,_0x48c5e8);FaxAccountEvents['on'](_0x211a31,_0x53c4be);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 2da301c..8a7c01c 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 _0x733a=['/:id/messages','getMessages','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','updateAccountApplications','/:id/send','/:id/users','addAgents','destroy','delete','removeDispositions','removeAnswers','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','getApplications'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x733a,0x1f4));var _0xa733=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x733a[_0x2d34d6];return _0x1d3d12;};'use strict';var multer=require(_0xa733('0x0'));var util=require('util');var path=require(_0xa733('0x1'));var timeout=require(_0xa733('0x2'));var express=require(_0xa733('0x3'));var router=express['Router']();var auth=require(_0xa733('0x4'));var interaction=require(_0xa733('0x5'));var config=require(_0xa733('0x6'));var controller=require(_0xa733('0x7'));router[_0xa733('0x8')]('/',auth[_0xa733('0x9')](),controller['index']);router[_0xa733('0x8')](_0xa733('0xa'),auth[_0xa733('0x9')](),controller[_0xa733('0xb')]);router[_0xa733('0x8')](_0xa733('0xc'),auth['isAuthenticated'](),controller[_0xa733('0xd')]);router['get'](_0xa733('0xe'),auth['isAuthenticated'](),controller[_0xa733('0xf')]);router[_0xa733('0x8')]('/:id/canned_answers',auth[_0xa733('0x9')](),controller[_0xa733('0x10')]);router['get'](_0xa733('0x11'),auth[_0xa733('0x9')](),controller[_0xa733('0x12')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xa733('0x13')]);router[_0xa733('0x8')](_0xa733('0x14'),auth[_0xa733('0x9')](),controller[_0xa733('0x15')]);router['get']('/:id/users',auth[_0xa733('0x9')](),controller[_0xa733('0x16')]);router[_0xa733('0x17')]('/',auth[_0xa733('0x9')](),controller['create']);router[_0xa733('0x17')](_0xa733('0xe'),auth[_0xa733('0x9')](),controller[_0xa733('0x18')]);router[_0xa733('0x17')](_0xa733('0x19'),auth[_0xa733('0x9')](),controller[_0xa733('0x1a')]);router[_0xa733('0x17')]('/:id/interactions',auth[_0xa733('0x9')](),controller[_0xa733('0x1b')]);router[_0xa733('0x17')](_0xa733('0x1c'),auth[_0xa733('0x9')](),controller[_0xa733('0x1d')]);router['post'](_0xa733('0x1e'),auth[_0xa733('0x9')](),controller['addAccountApplications']);router[_0xa733('0x17')]('/updateaccountapplications',auth[_0xa733('0x9')](),controller[_0xa733('0x1f')]);router['post'](_0xa733('0x20'),auth[_0xa733('0x9')](),controller['send']);router['post'](_0xa733('0x21'),auth[_0xa733('0x9')](),controller[_0xa733('0x22')]);router['put']('/:id',auth[_0xa733('0x9')](),controller['update']);router['delete'](_0xa733('0xc'),auth[_0xa733('0x9')](),controller[_0xa733('0x23')]);router[_0xa733('0x24')](_0xa733('0xe'),auth[_0xa733('0x9')](),controller[_0xa733('0x25')]);router[_0xa733('0x24')]('/:id/canned_answers',auth[_0xa733('0x9')](),controller[_0xa733('0x26')]);router[_0xa733('0x24')](_0xa733('0x21'),auth[_0xa733('0x9')](),controller['removeAgents']);module[_0xa733('0x27')]=router; \ No newline at end of file +var _0x0552=['getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x130419,_0x2314cb){var _0x4527d8=function(_0x299904){while(--_0x299904){_0x130419['push'](_0x130419['shift']());}};_0x4527d8(++_0x2314cb);}(_0x0552,0x11d));var _0x2055=function(_0xbd0204,_0x3c337b){_0xbd0204=_0xbd0204-0x0;var _0x3383f9=_0x0552[_0xbd0204];return _0x3383f9;};'use strict';var multer=require('multer');var util=require(_0x2055('0x0'));var path=require('path');var timeout=require(_0x2055('0x1'));var express=require(_0x2055('0x2'));var router=express[_0x2055('0x3')]();var auth=require(_0x2055('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2055('0x5'));var controller=require(_0x2055('0x6'));router['get']('/',auth[_0x2055('0x7')](),controller[_0x2055('0x8')]);router[_0x2055('0x9')]('/describe',auth[_0x2055('0x7')](),controller[_0x2055('0xa')]);router[_0x2055('0x9')](_0x2055('0xb'),auth[_0x2055('0x7')](),controller[_0x2055('0xc')]);router[_0x2055('0x9')](_0x2055('0xd'),auth[_0x2055('0x7')](),controller[_0x2055('0xe')]);router[_0x2055('0x9')](_0x2055('0xf'),auth[_0x2055('0x7')](),controller[_0x2055('0x10')]);router[_0x2055('0x9')](_0x2055('0x11'),auth[_0x2055('0x7')](),controller['getInteractions']);router['get'](_0x2055('0x12'),auth['isAuthenticated'](),controller[_0x2055('0x13')]);router[_0x2055('0x9')](_0x2055('0x14'),auth[_0x2055('0x7')](),controller[_0x2055('0x15')]);router[_0x2055('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x2055('0x16')]);router[_0x2055('0x17')]('/',auth[_0x2055('0x7')](),controller['create']);router[_0x2055('0x17')](_0x2055('0xd'),auth[_0x2055('0x7')](),controller[_0x2055('0x18')]);router[_0x2055('0x17')](_0x2055('0xf'),auth[_0x2055('0x7')](),controller[_0x2055('0x19')]);router['post'](_0x2055('0x11'),auth['isAuthenticated'](),controller[_0x2055('0x1a')]);router['post'](_0x2055('0x12'),auth[_0x2055('0x7')](),controller[_0x2055('0x1b')]);router[_0x2055('0x17')](_0x2055('0x1c'),auth[_0x2055('0x7')](),controller[_0x2055('0x1d')]);router[_0x2055('0x17')](_0x2055('0x1e'),auth['isAuthenticated'](),controller[_0x2055('0x1f')]);router[_0x2055('0x17')](_0x2055('0x20'),auth[_0x2055('0x7')](),controller[_0x2055('0x21')]);router[_0x2055('0x17')](_0x2055('0x22'),auth[_0x2055('0x7')](),controller[_0x2055('0x23')]);router[_0x2055('0x24')]('/:id',auth['isAuthenticated'](),controller[_0x2055('0x25')]);router[_0x2055('0x26')](_0x2055('0xb'),auth[_0x2055('0x7')](),controller[_0x2055('0x27')]);router['delete'](_0x2055('0xd'),auth[_0x2055('0x7')](),controller[_0x2055('0x28')]);router[_0x2055('0x26')](_0x2055('0xf'),auth[_0x2055('0x7')](),controller[_0x2055('0x29')]);router[_0x2055('0x26')](_0x2055('0x22'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x2055('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index f036124..6a60323 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 _0x578b=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x69e5cc,_0x8941c0){var _0x2a3d9f=function(_0x2ddb9a){while(--_0x2ddb9a){_0x69e5cc['push'](_0x69e5cc['shift']());}};_0x2a3d9f(++_0x8941c0);}(_0x578b,0x18d));var _0xb578=function(_0x152ef7,_0x221f4c){_0x152ef7=_0x152ef7-0x0;var _0x33b535=_0x578b[_0x152ef7];return _0x33b535;};'use strict';var Sequelize=require(_0xb578('0x0'));module[_0xb578('0x1')]={'priority':{'type':Sequelize[_0xb578('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb578('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xb578('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb578('0x4')}}; \ No newline at end of file +var _0x8967=['noop','*,*,*,*','sequelize','exports','STRING'];(function(_0x247a78,_0x367327){var _0x43ae03=function(_0x397868){while(--_0x397868){_0x247a78['push'](_0x247a78['shift']());}};_0x43ae03(++_0x367327);}(_0x8967,0xac));var _0x7896=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x8967[_0x1ac120];return _0x19b703;};'use strict';var Sequelize=require(_0x7896('0x0'));module[_0x7896('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7896('0x2')],'allowNull':![],'defaultValue':_0x7896('0x3')},'appdata':{'type':Sequelize[_0x7896('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x7896('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7896('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 776b628..e04d823 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 _0x5641=['query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','html-pdf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','FaxApplication','rawAttributes','model','keys'];(function(_0x26d2e3,_0x3db770){var _0x4395b7=function(_0x3fe490){while(--_0x3fe490){_0x26d2e3['push'](_0x26d2e3['shift']());}};_0x4395b7(++_0x3db770);}(_0x5641,0xa5));var _0x1564=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5641[_0x1035c1];return _0x308d67;};'use strict';var pdf=require(_0x1564('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1564('0x1'));var moment=require('moment');var BPromise=require(_0x1564('0x2'));var Mustache=require(_0x1564('0x3'));var util=require(_0x1564('0x4'));var path=require(_0x1564('0x5'));var sox=require(_0x1564('0x6'));var csv=require(_0x1564('0x7'));var ejs=require(_0x1564('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1564('0x9'));var crypto=require(_0x1564('0xa'));var jsforce=require(_0x1564('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1564('0x7'));var querystring=require(_0x1564('0xc'));var Papa=require(_0x1564('0xd'));var Redis=require(_0x1564('0xe'));var qs=require(_0x1564('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x1564('0x10'));var config=require(_0x1564('0x11'));var db=require(_0x1564('0x12'))['db'];function respondWithStatusCode(_0x26d0cd,_0x393e2f){_0x393e2f=_0x393e2f||0xcc;return function(_0x1d74a3){if(_0x1d74a3){return _0x26d0cd[_0x1564('0x13')](_0x393e2f);}return _0x26d0cd[_0x1564('0x14')](_0x393e2f)[_0x1564('0x15')]();};}function respondWithResult(_0x309fb1,_0x33af9a){_0x33af9a=_0x33af9a||0xc8;return function(_0x5d2aa4){if(_0x5d2aa4){return _0x309fb1['status'](_0x33af9a)[_0x1564('0x16')](_0x5d2aa4);}};}function respondWithFilteredResult(_0x32375f,_0x54ca30){return function(_0x300fb4){if(_0x300fb4){var _0x2bfcfd=_0x300fb4['count'],_0x1b521d=_0x54ca30[_0x1564('0x17')],_0x5ae73a=_0x54ca30[_0x1564('0x17')]+_0x54ca30[_0x1564('0x18')],_0x1ee5b6;if(_0x5ae73a>=_0x2bfcfd){_0x5ae73a=_0x2bfcfd;_0x1ee5b6=0xc8;}else{_0x1ee5b6=0xce;}_0x32375f[_0x1564('0x14')](_0x1ee5b6);return _0x32375f[_0x1564('0x19')](_0x1564('0x1a'),_0x1b521d+'-'+_0x5ae73a+'/'+_0x2bfcfd)['json'](_0x300fb4);}return null;};}function patchUpdates(_0x469266){return function(_0xb1b7ef){try{jsonpatch[_0x1564('0x1b')](_0xb1b7ef,_0x469266,!![]);}catch(_0x3eda45){return BPromise['reject'](_0x3eda45);}return _0xb1b7ef[_0x1564('0x1c')]();};}function saveUpdates(_0x57f7cc,_0x2d3b31){return function(_0x1cb660){if(_0x1cb660){return _0x1cb660[_0x1564('0x1d')](_0x57f7cc)[_0x1564('0x1e')](function(_0x3e8a7c){return _0x3e8a7c;});}return null;};}function removeEntity(_0x2b890a,_0x5df009){return function(_0x32dd2b){if(_0x32dd2b){return _0x32dd2b['destroy']()[_0x1564('0x1e')](function(){_0x2b890a[_0x1564('0x14')](0xcc)[_0x1564('0x15')]();});}};}function handleEntityNotFound(_0x31accb,_0x29b8a5){return function(_0x391840){if(!_0x391840){_0x31accb['sendStatus'](0x194);}return _0x391840;};}function handleError(_0x19e17d,_0x314a65){_0x314a65=_0x314a65||0x1f4;return function(_0x453d07){logger[_0x1564('0x1f')](_0x453d07[_0x1564('0x20')]);if(_0x453d07[_0x1564('0x21')]){delete _0x453d07[_0x1564('0x21')];}_0x19e17d['status'](_0x314a65)[_0x1564('0x22')](_0x453d07);};}exports['index']=function(_0xc57d0b,_0x23f897){var _0x1b7961={},_0x326af3={},_0x4ab728={'count':0x0,'rows':[]};var _0x8f0e0b=db[_0x1564('0x23')][_0x1564('0x24')];_0x326af3[_0x1564('0x25')]=_[_0x1564('0x26')](_0x8f0e0b);var _0x393ae1={'dateStart':_0xc57d0b[_0x1564('0x27')]['dateStart'],'dateEnd':_0xc57d0b['query'][_0x1564('0x28')]};delete _0xc57d0b[_0x1564('0x27')][_0x1564('0x29')];delete _0xc57d0b['query']['dateEnd'];_0x326af3[_0x1564('0x27')]=_[_0x1564('0x26')](_0xc57d0b[_0x1564('0x27')]);_0x326af3[_0x1564('0x2a')]=_[_0x1564('0x2b')](_0x326af3[_0x1564('0x25')],_0x326af3[_0x1564('0x27')]);_0x1b7961[_0x1564('0x2c')]=_['intersection'](_0x326af3['model'],qs[_0x1564('0x2d')](_0xc57d0b[_0x1564('0x27')][_0x1564('0x2d')]));_0x1b7961['attributes']=_0x1b7961[_0x1564('0x2c')][_0x1564('0x2e')]?_0x1b7961['attributes']:_0x326af3['model'];if(!_0xc57d0b['query'][_0x1564('0x2f')](_0x1564('0x30'))){_0x1b7961[_0x1564('0x18')]=qs[_0x1564('0x18')](_0xc57d0b[_0x1564('0x27')]['limit']);_0x1b7961['offset']=qs[_0x1564('0x17')](_0xc57d0b['query'][_0x1564('0x17')]);}_0x1b7961['order']=qs[_0x1564('0x31')](_0xc57d0b[_0x1564('0x27')][_0x1564('0x31')]);_0x1b7961[_0x1564('0x32')]=qs['filters'](_[_0x1564('0x33')](_0xc57d0b[_0x1564('0x27')],_0x326af3[_0x1564('0x2a')]));if(_0x393ae1['dateStart']){if(_0x393ae1[_0x1564('0x28')]){_0x393ae1[_0x1564('0x28')]=moment(_0x393ae1[_0x1564('0x28')])[_0x1564('0x34')](0x1,_0x1564('0x35'));}else{_0x393ae1['dateEnd']=moment(_0x393ae1[_0x1564('0x29')])[_0x1564('0x34')](0x1,_0x1564('0x35'));}_[_0x1564('0x36')](_0x1b7961['where'],{'createdAt':{'$gte':_0x393ae1[_0x1564('0x29')],'$lte':_0x393ae1[_0x1564('0x28')]}});}if(_0xc57d0b[_0x1564('0x27')][_0x1564('0x37')]){_0x1b7961['where']=_['merge'](_0x1b7961[_0x1564('0x32')],{'$or':_['map'](_0x1b7961[_0x1564('0x2c')],function(_0x57f743){var _0x14703a={};_0x14703a[_0x57f743]={'$like':'%'+_0xc57d0b[_0x1564('0x27')][_0x1564('0x37')]+'%'};return _0x14703a;})});}_0x1b7961=_[_0x1564('0x36')]({},_0x1b7961,_0xc57d0b['options']);var _0x4cc306={'where':_0x1b7961[_0x1564('0x32')]};return db[_0x1564('0x23')]['count'](_0x4cc306)['then'](function(_0x55134b){_0x4ab728[_0x1564('0x38')]=_0x55134b;if(_0xc57d0b['query'][_0x1564('0x39')]){_0x1b7961[_0x1564('0x3a')]=[{'all':!![]}];}return db[_0x1564('0x23')][_0x1564('0x3b')](_0x1b7961);})[_0x1564('0x1e')](function(_0x5164c7){_0x4ab728[_0x1564('0x3c')]=_0x5164c7;return _0x4ab728;})[_0x1564('0x1e')](respondWithFilteredResult(_0x23f897,_0x1b7961))[_0x1564('0x3d')](handleError(_0x23f897,null));};exports['show']=function(_0x6e33b7,_0x26c9a4){var _0x3eec1e={'raw':!![],'where':{'id':_0x6e33b7[_0x1564('0x3e')]['id']}},_0x385691={};_0x385691[_0x1564('0x25')]=_[_0x1564('0x26')](db[_0x1564('0x23')][_0x1564('0x24')]);_0x385691[_0x1564('0x27')]=_[_0x1564('0x26')](_0x6e33b7['query']);_0x385691[_0x1564('0x2a')]=_['intersection'](_0x385691[_0x1564('0x25')],_0x385691[_0x1564('0x27')]);_0x3eec1e[_0x1564('0x2c')]=_['intersection'](_0x385691[_0x1564('0x25')],qs[_0x1564('0x2d')](_0x6e33b7[_0x1564('0x27')]['fields']));_0x3eec1e[_0x1564('0x2c')]=_0x3eec1e[_0x1564('0x2c')][_0x1564('0x2e')]?_0x3eec1e[_0x1564('0x2c')]:_0x385691[_0x1564('0x25')];if(_0x6e33b7['query']['includeAll']){_0x3eec1e[_0x1564('0x3a')]=[{'all':!![]}];}_0x3eec1e=_['merge']({},_0x3eec1e,_0x6e33b7[_0x1564('0x3f')]);return db[_0x1564('0x23')][_0x1564('0x40')](_0x3eec1e)[_0x1564('0x1e')](handleEntityNotFound(_0x26c9a4,null))['then'](respondWithResult(_0x26c9a4,null))[_0x1564('0x3d')](handleError(_0x26c9a4,null));};exports[_0x1564('0x41')]=function(_0x4a6405,_0x2b699e){return db[_0x1564('0x23')][_0x1564('0x41')](_0x4a6405[_0x1564('0x42')],{})[_0x1564('0x1e')](respondWithResult(_0x2b699e,0xc9))[_0x1564('0x3d')](handleError(_0x2b699e,null));};exports['update']=function(_0x509fec,_0x4c3277){if(_0x509fec[_0x1564('0x42')]['id']){delete _0x509fec['body']['id'];}return db[_0x1564('0x23')][_0x1564('0x40')]({'where':{'id':_0x509fec[_0x1564('0x3e')]['id']}})[_0x1564('0x1e')](handleEntityNotFound(_0x4c3277,null))[_0x1564('0x1e')](saveUpdates(_0x509fec[_0x1564('0x42')],null))[_0x1564('0x1e')](respondWithResult(_0x4c3277,null))[_0x1564('0x3d')](handleError(_0x4c3277,null));};exports[_0x1564('0x43')]=function(_0x3f30e4,_0x5a41e1){return db[_0x1564('0x23')][_0x1564('0x40')]({'where':{'id':_0x3f30e4[_0x1564('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5a41e1,null))[_0x1564('0x1e')](removeEntity(_0x5a41e1,null))['catch'](handleError(_0x5a41e1,null));}; \ No newline at end of file +var _0x8f5d=['limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','add','day','merge','map','filter','options','include','findAll','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count'];(function(_0x1c4ab7,_0x392903){var _0x3842e7=function(_0x584ec5){while(--_0x584ec5){_0x1c4ab7['push'](_0x1c4ab7['shift']());}};_0x3842e7(++_0x392903);}(_0x8f5d,0xbb));var _0xd8f5=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x8f5d[_0x556927];return _0x5f1235;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd8f5('0x0'));var rimraf=require(_0xd8f5('0x1'));var zipdir=require(_0xd8f5('0x2'));var jsonpatch=require(_0xd8f5('0x3'));var rp=require('request-promise');var moment=require(_0xd8f5('0x4'));var BPromise=require(_0xd8f5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd8f5('0x6'));var sox=require(_0xd8f5('0x7'));var csv=require('to-csv');var ejs=require(_0xd8f5('0x8'));var fs=require('fs');var _=require(_0xd8f5('0x9'));var squel=require(_0xd8f5('0xa'));var crypto=require(_0xd8f5('0xb'));var jsforce=require(_0xd8f5('0xc'));var deskjs=require(_0xd8f5('0xd'));var toCsv=require(_0xd8f5('0xe'));var querystring=require(_0xd8f5('0xf'));var Papa=require('papaparse');var Redis=require(_0xd8f5('0x10'));var qs=require(_0xd8f5('0x11'));var logger=require(_0xd8f5('0x12'))('api');var utils=require(_0xd8f5('0x13'));var config=require(_0xd8f5('0x14'));var db=require(_0xd8f5('0x15'))['db'];function respondWithStatusCode(_0x36ae5e,_0x30dd8d){_0x30dd8d=_0x30dd8d||0xcc;return function(_0x2b4424){if(_0x2b4424){return _0x36ae5e[_0xd8f5('0x16')](_0x30dd8d);}return _0x36ae5e['status'](_0x30dd8d)['end']();};}function respondWithResult(_0x2d44e5,_0x405064){_0x405064=_0x405064||0xc8;return function(_0x180ffc){if(_0x180ffc){return _0x2d44e5[_0xd8f5('0x17')](_0x405064)[_0xd8f5('0x18')](_0x180ffc);}};}function respondWithFilteredResult(_0x1831ef,_0xf6e5d0){return function(_0x4366ed){if(_0x4366ed){var _0x3dca9a=_0x4366ed[_0xd8f5('0x19')],_0x892efc=_0xf6e5d0['offset'],_0xf07cb=_0xf6e5d0['offset']+_0xf6e5d0[_0xd8f5('0x1a')],_0x414dec;if(_0xf07cb>=_0x3dca9a){_0xf07cb=_0x3dca9a;_0x414dec=0xc8;}else{_0x414dec=0xce;}_0x1831ef[_0xd8f5('0x17')](_0x414dec);return _0x1831ef[_0xd8f5('0x1b')](_0xd8f5('0x1c'),_0x892efc+'-'+_0xf07cb+'/'+_0x3dca9a)[_0xd8f5('0x18')](_0x4366ed);}return null;};}function patchUpdates(_0x581a5c){return function(_0x42a7aa){try{jsonpatch[_0xd8f5('0x1d')](_0x42a7aa,_0x581a5c,!![]);}catch(_0x28e44e){return BPromise[_0xd8f5('0x1e')](_0x28e44e);}return _0x42a7aa[_0xd8f5('0x1f')]();};}function saveUpdates(_0x5eb37c,_0x4bf54b){return function(_0x516cf1){if(_0x516cf1){return _0x516cf1[_0xd8f5('0x20')](_0x5eb37c)[_0xd8f5('0x21')](function(_0x587931){return _0x587931;});}return null;};}function removeEntity(_0x498fb1,_0x3a5bbc){return function(_0x249d2c){if(_0x249d2c){return _0x249d2c[_0xd8f5('0x22')]()['then'](function(){_0x498fb1[_0xd8f5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d9a07,_0x1dd76f){return function(_0x2c9f75){if(!_0x2c9f75){_0x4d9a07[_0xd8f5('0x16')](0x194);}return _0x2c9f75;};}function handleError(_0x4a5583,_0xcead73){_0xcead73=_0xcead73||0x1f4;return function(_0x410b2d){logger[_0xd8f5('0x23')](_0x410b2d[_0xd8f5('0x24')]);if(_0x410b2d[_0xd8f5('0x25')]){delete _0x410b2d[_0xd8f5('0x25')];}_0x4a5583['status'](_0xcead73)[_0xd8f5('0x26')](_0x410b2d);};}exports[_0xd8f5('0x27')]=function(_0x4c7db7,_0x3b7e93){var _0x5da8d6={},_0xc480d7={},_0x4c507d={'count':0x0,'rows':[]};var _0x43aa2b=db[_0xd8f5('0x28')][_0xd8f5('0x29')];_0xc480d7[_0xd8f5('0x2a')]=_['keys'](_0x43aa2b);var _0x3594b6={'dateStart':_0x4c7db7[_0xd8f5('0x2b')][_0xd8f5('0x2c')],'dateEnd':_0x4c7db7[_0xd8f5('0x2b')][_0xd8f5('0x2d')]};delete _0x4c7db7['query'][_0xd8f5('0x2c')];delete _0x4c7db7[_0xd8f5('0x2b')]['dateEnd'];_0xc480d7[_0xd8f5('0x2b')]=_[_0xd8f5('0x2e')](_0x4c7db7['query']);_0xc480d7[_0xd8f5('0x2f')]=_[_0xd8f5('0x30')](_0xc480d7['model'],_0xc480d7[_0xd8f5('0x2b')]);_0x5da8d6[_0xd8f5('0x31')]=_[_0xd8f5('0x30')](_0xc480d7[_0xd8f5('0x2a')],qs[_0xd8f5('0x32')](_0x4c7db7['query'][_0xd8f5('0x32')]));_0x5da8d6[_0xd8f5('0x31')]=_0x5da8d6['attributes'][_0xd8f5('0x33')]?_0x5da8d6[_0xd8f5('0x31')]:_0xc480d7[_0xd8f5('0x2a')];if(!_0x4c7db7[_0xd8f5('0x2b')][_0xd8f5('0x34')](_0xd8f5('0x35'))){_0x5da8d6[_0xd8f5('0x1a')]=qs[_0xd8f5('0x1a')](_0x4c7db7['query']['limit']);_0x5da8d6[_0xd8f5('0x36')]=qs[_0xd8f5('0x36')](_0x4c7db7[_0xd8f5('0x2b')]['offset']);}_0x5da8d6['order']=qs['sort'](_0x4c7db7[_0xd8f5('0x2b')][_0xd8f5('0x37')]);_0x5da8d6[_0xd8f5('0x38')]=qs[_0xd8f5('0x2f')](_['pick'](_0x4c7db7[_0xd8f5('0x2b')],_0xc480d7[_0xd8f5('0x2f')]));if(_0x3594b6[_0xd8f5('0x2c')]){if(_0x3594b6[_0xd8f5('0x2d')]){_0x3594b6[_0xd8f5('0x2d')]=moment(_0x3594b6[_0xd8f5('0x2d')])[_0xd8f5('0x39')](0x1,_0xd8f5('0x3a'));}else{_0x3594b6[_0xd8f5('0x2d')]=moment(_0x3594b6[_0xd8f5('0x2c')])[_0xd8f5('0x39')](0x1,'day');}_[_0xd8f5('0x3b')](_0x5da8d6[_0xd8f5('0x38')],{'createdAt':{'$gte':_0x3594b6[_0xd8f5('0x2c')],'$lte':_0x3594b6[_0xd8f5('0x2d')]}});}if(_0x4c7db7['query']['filter']){_0x5da8d6[_0xd8f5('0x38')]=_[_0xd8f5('0x3b')](_0x5da8d6[_0xd8f5('0x38')],{'$or':_[_0xd8f5('0x3c')](_0x5da8d6[_0xd8f5('0x31')],function(_0x5a0261){var _0x2ee622={};_0x2ee622[_0x5a0261]={'$like':'%'+_0x4c7db7[_0xd8f5('0x2b')][_0xd8f5('0x3d')]+'%'};return _0x2ee622;})});}_0x5da8d6=_[_0xd8f5('0x3b')]({},_0x5da8d6,_0x4c7db7[_0xd8f5('0x3e')]);var _0x23ec66={'where':_0x5da8d6[_0xd8f5('0x38')]};return db['FaxApplication'][_0xd8f5('0x19')](_0x23ec66)[_0xd8f5('0x21')](function(_0x26171f){_0x4c507d['count']=_0x26171f;if(_0x4c7db7[_0xd8f5('0x2b')]['includeAll']){_0x5da8d6[_0xd8f5('0x3f')]=[{'all':!![]}];}return db['FaxApplication'][_0xd8f5('0x40')](_0x5da8d6);})[_0xd8f5('0x21')](function(_0x58cdeb){_0x4c507d['rows']=_0x58cdeb;return _0x4c507d;})[_0xd8f5('0x21')](respondWithFilteredResult(_0x3b7e93,_0x5da8d6))['catch'](handleError(_0x3b7e93,null));};exports[_0xd8f5('0x41')]=function(_0x26ba94,_0x3e4851){var _0x8e1893={'raw':!![],'where':{'id':_0x26ba94[_0xd8f5('0x42')]['id']}},_0x47417a={};_0x47417a[_0xd8f5('0x2a')]=_['keys'](db[_0xd8f5('0x28')]['rawAttributes']);_0x47417a['query']=_[_0xd8f5('0x2e')](_0x26ba94['query']);_0x47417a[_0xd8f5('0x2f')]=_['intersection'](_0x47417a[_0xd8f5('0x2a')],_0x47417a['query']);_0x8e1893[_0xd8f5('0x31')]=_[_0xd8f5('0x30')](_0x47417a[_0xd8f5('0x2a')],qs[_0xd8f5('0x32')](_0x26ba94[_0xd8f5('0x2b')][_0xd8f5('0x32')]));_0x8e1893[_0xd8f5('0x31')]=_0x8e1893[_0xd8f5('0x31')]['length']?_0x8e1893[_0xd8f5('0x31')]:_0x47417a[_0xd8f5('0x2a')];if(_0x26ba94[_0xd8f5('0x2b')]['includeAll']){_0x8e1893['include']=[{'all':!![]}];}_0x8e1893=_[_0xd8f5('0x3b')]({},_0x8e1893,_0x26ba94['options']);return db[_0xd8f5('0x28')][_0xd8f5('0x43')](_0x8e1893)[_0xd8f5('0x21')](handleEntityNotFound(_0x3e4851,null))[_0xd8f5('0x21')](respondWithResult(_0x3e4851,null))['catch'](handleError(_0x3e4851,null));};exports[_0xd8f5('0x44')]=function(_0x1e7dfd,_0x1413ff){return db[_0xd8f5('0x28')][_0xd8f5('0x44')](_0x1e7dfd[_0xd8f5('0x45')],{})['then'](respondWithResult(_0x1413ff,0xc9))[_0xd8f5('0x46')](handleError(_0x1413ff,null));};exports[_0xd8f5('0x20')]=function(_0x28e173,_0x502b23){if(_0x28e173[_0xd8f5('0x45')]['id']){delete _0x28e173[_0xd8f5('0x45')]['id'];}return db[_0xd8f5('0x28')][_0xd8f5('0x43')]({'where':{'id':_0x28e173[_0xd8f5('0x42')]['id']}})[_0xd8f5('0x21')](handleEntityNotFound(_0x502b23,null))[_0xd8f5('0x21')](saveUpdates(_0x28e173['body'],null))[_0xd8f5('0x21')](respondWithResult(_0x502b23,null))['catch'](handleError(_0x502b23,null));};exports[_0xd8f5('0x22')]=function(_0x1682ee,_0x561d99){return db[_0xd8f5('0x28')][_0xd8f5('0x43')]({'where':{'id':_0x1682ee[_0xd8f5('0x42')]['id']}})['then'](handleEntityNotFound(_0x561d99,null))[_0xd8f5('0x21')](removeEntity(_0x561d99,null))['catch'](handleError(_0x561d99,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 2256178..e7b7ec6 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 _0x77fd=['moment','request-promise','./faxApplication.attributes','fax_applications','lodash','util','../../config/logger','api'];(function(_0x5deea5,_0x230d81){var _0x3d1998=function(_0x39341d){while(--_0x39341d){_0x5deea5['push'](_0x5deea5['shift']());}};_0x3d1998(++_0x230d81);}(_0x77fd,0x154));var _0xd77f=function(_0x174d5a,_0x11331d){_0x174d5a=_0x174d5a-0x0;var _0x28c59a=_0x77fd[_0x174d5a];return _0x28c59a;};'use strict';var _=require(_0xd77f('0x0'));var util=require(_0xd77f('0x1'));var logger=require(_0xd77f('0x2'))(_0xd77f('0x3'));var moment=require(_0xd77f('0x4'));var BPromise=require('bluebird');var rp=require(_0xd77f('0x5'));var attributes=require(_0xd77f('0x6'));module['exports']=function(_0x2e665c,_0x5e5b9d){return _0x2e665c['define']('FaxApplication',attributes,{'tableName':_0xd77f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3145=['util','../../config/logger','api','request-promise','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','lodash'];(function(_0x431b5d,_0xc0425c){var _0x9ec455=function(_0x546fc2){while(--_0x546fc2){_0x431b5d['push'](_0x431b5d['shift']());}};_0x9ec455(++_0xc0425c);}(_0x3145,0xdb));var _0x5314=function(_0x3febf8,_0x8fce1f){_0x3febf8=_0x3febf8-0x0;var _0x5ad3ff=_0x3145[_0x3febf8];return _0x5ad3ff;};'use strict';var _=require(_0x5314('0x0'));var util=require(_0x5314('0x1'));var logger=require(_0x5314('0x2'))(_0x5314('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5314('0x4'));var attributes=require(_0x5314('0x5'));module[_0x5314('0x6')]=function(_0x6a7546,_0x6c7432){return _0x6a7546[_0x5314('0x7')](_0x5314('0x8'),attributes,{'tableName':_0x5314('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 b16c5b0..c6940d9 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 _0x9f27=['raw','options','where','attributes','limit','then','info','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','body'];(function(_0x22cd0c,_0x4040b6){var _0x439eba=function(_0x43c4a0){while(--_0x43c4a0){_0x22cd0c['push'](_0x22cd0c['shift']());}};_0x439eba(++_0x4040b6);}(_0x9f27,0xc8));var _0x79f2=function(_0x5de095,_0x34cd53){_0x5de095=_0x5de095-0x0;var _0x2613f7=_0x9f27[_0x5de095];return _0x2613f7;};'use strict';var _=require('lodash');var util=require(_0x79f2('0x0'));var moment=require(_0x79f2('0x1'));var BPromise=require(_0x79f2('0x2'));var rs=require(_0x79f2('0x3'));var fs=require('fs');var Redis=require(_0x79f2('0x4'));var db=require(_0x79f2('0x5'))['db'];var utils=require(_0x79f2('0x6'));var logger=require(_0x79f2('0x7'))(_0x79f2('0x8'));var config=require(_0x79f2('0x9'));var jayson=require(_0x79f2('0xa'));var client=jayson['client'][_0x79f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x506516,_0x369ba7,_0x520530){return new BPromise(function(_0x130a21,_0x3d88d5){return client['request'](_0x506516,_0x520530)['then'](function(_0x17a84c){logger['info'](_0x79f2('0xc'),_0x369ba7,_0x79f2('0xd'));logger['debug'](_0x79f2('0xe'),_0x369ba7,_0x79f2('0xd'),JSON[_0x79f2('0xf')](_0x17a84c));if(_0x17a84c[_0x79f2('0x10')]){if(_0x17a84c[_0x79f2('0x10')][_0x79f2('0x11')]===0x1f4){logger[_0x79f2('0x10')]('FaxApplication,\x20%s,\x20%s',_0x369ba7,_0x17a84c[_0x79f2('0x10')][_0x79f2('0x12')]);return _0x3d88d5(_0x17a84c['error']['message']);}logger[_0x79f2('0x10')](_0x79f2('0xc'),_0x369ba7,_0x17a84c[_0x79f2('0x10')][_0x79f2('0x12')]);return _0x130a21(_0x17a84c[_0x79f2('0x10')][_0x79f2('0x12')]);}else{logger['info'](_0x79f2('0xc'),_0x369ba7,_0x79f2('0xd'));_0x130a21(_0x17a84c['result']['message']);}})[_0x79f2('0x13')](function(_0x56f897){logger[_0x79f2('0x10')](_0x79f2('0xc'),_0x369ba7,_0x56f897);_0x3d88d5(_0x56f897);});});}exports[_0x79f2('0x14')]=function(_0x166b09){var _0x32e596=this;return new Promise(function(_0x364953,_0x3074f4){return db[_0x79f2('0x15')][_0x79f2('0x16')](_0x166b09[_0x79f2('0x17')],{'raw':_0x166b09['options']?_0x166b09['options'][_0x79f2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x166b09[_0x79f2('0x19')]?_0x166b09[_0x79f2('0x19')][_0x79f2('0x1a')]||null:null,'attributes':_0x166b09[_0x79f2('0x19')]?_0x166b09['options'][_0x79f2('0x1b')]||null:null,'limit':_0x166b09[_0x79f2('0x19')]?_0x166b09[_0x79f2('0x19')][_0x79f2('0x1c')]||null:null})[_0x79f2('0x1d')](function(_0x2a05fe){logger[_0x79f2('0x1e')](_0x79f2('0x14'),_0x166b09);logger[_0x79f2('0x1f')](_0x79f2('0x14'),_0x166b09,JSON[_0x79f2('0xf')](_0x2a05fe));_0x364953(_0x2a05fe);})[_0x79f2('0x13')](function(_0x1526ed){logger['error'](_0x79f2('0x14'),_0x1526ed[_0x79f2('0x12')],_0x166b09);_0x3074f4(_0x32e596[_0x79f2('0x10')](0x1f4,_0x1526ed[_0x79f2('0x12')]));});});}; \ No newline at end of file +var _0x2b72=['http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','UpdateFaxApplication','update','options','where','attributes','limit','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x18ddec,_0x2e8025){var _0x2fdbe7=function(_0xd82ec9){while(--_0xd82ec9){_0x18ddec['push'](_0x18ddec['shift']());}};_0x2fdbe7(++_0x2e8025);}(_0x2b72,0x161));var _0x22b7=function(_0xa92d70,_0x3dee58){_0xa92d70=_0xa92d70-0x0;var _0x49b027=_0x2b72[_0xa92d70];return _0x49b027;};'use strict';var _=require('lodash');var util=require(_0x22b7('0x0'));var moment=require(_0x22b7('0x1'));var BPromise=require('bluebird');var rs=require(_0x22b7('0x2'));var fs=require('fs');var Redis=require(_0x22b7('0x3'));var db=require(_0x22b7('0x4'))['db'];var utils=require(_0x22b7('0x5'));var logger=require(_0x22b7('0x6'))(_0x22b7('0x7'));var config=require(_0x22b7('0x8'));var jayson=require(_0x22b7('0x9'));var client=jayson[_0x22b7('0xa')][_0x22b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a105e,_0x120a49,_0x47e7b9){return new BPromise(function(_0x56240a,_0x34a57e){return client['request'](_0x1a105e,_0x47e7b9)[_0x22b7('0xc')](function(_0x55c3e0){logger['info'](_0x22b7('0xd'),_0x120a49,_0x22b7('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x120a49,'request\x20sent',JSON[_0x22b7('0xf')](_0x55c3e0));if(_0x55c3e0[_0x22b7('0x10')]){if(_0x55c3e0[_0x22b7('0x10')][_0x22b7('0x11')]===0x1f4){logger[_0x22b7('0x10')]('FaxApplication,\x20%s,\x20%s',_0x120a49,_0x55c3e0['error'][_0x22b7('0x12')]);return _0x34a57e(_0x55c3e0[_0x22b7('0x10')][_0x22b7('0x12')]);}logger[_0x22b7('0x10')](_0x22b7('0xd'),_0x120a49,_0x55c3e0[_0x22b7('0x10')]['message']);return _0x56240a(_0x55c3e0[_0x22b7('0x10')][_0x22b7('0x12')]);}else{logger[_0x22b7('0x13')]('FaxApplication,\x20%s,\x20%s',_0x120a49,_0x22b7('0xe'));_0x56240a(_0x55c3e0[_0x22b7('0x14')][_0x22b7('0x12')]);}})['catch'](function(_0x5ae3df){logger[_0x22b7('0x10')](_0x22b7('0xd'),_0x120a49,_0x5ae3df);_0x34a57e(_0x5ae3df);});});}exports[_0x22b7('0x15')]=function(_0x118b3c){var _0x52ddbe=this;return new Promise(function(_0x5f23c8,_0x4e3f4b){return db['FaxApplication'][_0x22b7('0x16')](_0x118b3c['body'],{'raw':_0x118b3c[_0x22b7('0x17')]?_0x118b3c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x118b3c['options']?_0x118b3c['options'][_0x22b7('0x18')]||null:null,'attributes':_0x118b3c[_0x22b7('0x17')]?_0x118b3c[_0x22b7('0x17')][_0x22b7('0x19')]||null:null,'limit':_0x118b3c['options']?_0x118b3c[_0x22b7('0x17')][_0x22b7('0x1a')]||null:null})['then'](function(_0x1acdde){logger[_0x22b7('0x13')]('UpdateFaxApplication',_0x118b3c);logger['debug'](_0x22b7('0x15'),_0x118b3c,JSON[_0x22b7('0xf')](_0x1acdde));_0x5f23c8(_0x1acdde);})[_0x22b7('0x1b')](function(_0x4af0a8){logger[_0x22b7('0x10')](_0x22b7('0x15'),_0x4af0a8['message'],_0x118b3c);_0x4e3f4b(_0x52ddbe['error'](0x1f4,_0x4af0a8[_0x22b7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 1659674..eb08a62 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 _0xbb98=['../../config/environment','./faxApplication.controller','get','index','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x160732,_0x3657fa){var _0x3aabcf=function(_0x5e84dc){while(--_0x5e84dc){_0x160732['push'](_0x160732['shift']());}};_0x3aabcf(++_0x3657fa);}(_0xbb98,0x1d6));var _0x8bb9=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xbb98[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x8bb9('0x0'));var util=require(_0x8bb9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8bb9('0x2'));var router=express[_0x8bb9('0x3')]();var auth=require(_0x8bb9('0x4'));var interaction=require(_0x8bb9('0x5'));var config=require(_0x8bb9('0x6'));var controller=require(_0x8bb9('0x7'));router[_0x8bb9('0x8')]('/',auth['isAuthenticated'](),controller[_0x8bb9('0x9')]);router[_0x8bb9('0x8')]('/:id',auth[_0x8bb9('0xa')](),controller['show']);router['post']('/',auth[_0x8bb9('0xa')](),controller[_0x8bb9('0xb')]);router[_0x8bb9('0xc')](_0x8bb9('0xd'),auth['isAuthenticated'](),controller[_0x8bb9('0xe')]);router['delete'](_0x8bb9('0xd'),auth[_0x8bb9('0xa')](),controller[_0x8bb9('0xf')]);module[_0x8bb9('0x10')]=router; \ No newline at end of file +var _0xce37=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0xb2f1b1,_0x1b5ad4){var _0x42a67e=function(_0x5c0952){while(--_0x5c0952){_0xb2f1b1['push'](_0xb2f1b1['shift']());}};_0x42a67e(++_0x1b5ad4);}(_0xce37,0x13c));var _0x7ce3=function(_0x2ea8cb,_0x5a25d2){_0x2ea8cb=_0x2ea8cb-0x0;var _0x34712a=_0xce37[_0x2ea8cb];return _0x34712a;};'use strict';var multer=require(_0x7ce3('0x0'));var util=require(_0x7ce3('0x1'));var path=require('path');var timeout=require(_0x7ce3('0x2'));var express=require(_0x7ce3('0x3'));var router=express[_0x7ce3('0x4')]();var auth=require(_0x7ce3('0x5'));var interaction=require(_0x7ce3('0x6'));var config=require(_0x7ce3('0x7'));var controller=require(_0x7ce3('0x8'));router['get']('/',auth[_0x7ce3('0x9')](),controller[_0x7ce3('0xa')]);router[_0x7ce3('0xb')](_0x7ce3('0xc'),auth[_0x7ce3('0x9')](),controller[_0x7ce3('0xd')]);router[_0x7ce3('0xe')]('/',auth[_0x7ce3('0x9')](),controller[_0x7ce3('0xf')]);router[_0x7ce3('0x10')](_0x7ce3('0xc'),auth[_0x7ce3('0x9')](),controller['update']);router[_0x7ce3('0x11')](_0x7ce3('0xc'),auth['isAuthenticated'](),controller[_0x7ce3('0x12')]);module[_0x7ce3('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 9badaee..913a8fd 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 _0x1d28=['sequelize','BOOLEAN','DATE','STRING','out','ENUM'];(function(_0x2b8f90,_0x3a895e){var _0x54b694=function(_0x4ad0bc){while(--_0x4ad0bc){_0x2b8f90['push'](_0x2b8f90['shift']());}};_0x54b694(++_0x3a895e);}(_0x1d28,0x16e));var _0x81d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d28[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x81d2('0x0'));module['exports']={'closed':{'type':Sequelize[_0x81d2('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x81d2('0x2')]},'disposition':{'type':Sequelize[_0x81d2('0x3')]},'note':{'type':Sequelize[_0x81d2('0x3')]},'read1stAt':{'type':Sequelize[_0x81d2('0x2')]},'fax':{'type':Sequelize[_0x81d2('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x81d2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x81d2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x81d2('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6fff=['BOOLEAN','STRING','DATE','out','ENUM','exports'];(function(_0x54ca07,_0x132112){var _0x3d3b68=function(_0x496d64){while(--_0x496d64){_0x54ca07['push'](_0x54ca07['shift']());}};_0x3d3b68(++_0x132112);}(_0x6fff,0x77));var _0xf6ff=function(_0x471bb5,_0x59a10d){_0x471bb5=_0x471bb5-0x0;var _0x448cbd=_0x6fff[_0x471bb5];return _0x448cbd;};'use strict';var Sequelize=require('sequelize');module[_0xf6ff('0x0')]={'closed':{'type':Sequelize[_0xf6ff('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf6ff('0x2')]},'note':{'type':Sequelize[_0xf6ff('0x2')]},'read1stAt':{'type':Sequelize[_0xf6ff('0x3')]},'fax':{'type':Sequelize[_0xf6ff('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf6ff('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf6ff('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf6ff('0x5')]('in',_0xf6ff('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 da40b84..0daeb1f 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 _0xbcda=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','merge','filter','map','options','include','tag','push','FaxMessage','Messages','direction','read','includeAll','Users','fullname','CmContact','User','Owner','internal','FaxAccount','Account','createdAt','Tag','ThroughTags','findAll','rows','show','find','catch','create','update','body','params','describe','addMessage','omit','getMessages','findOne','FaxInteractionId','$gte','split','addTags','ids','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','server','files','attachments','tmp','join','format','interaction-%s.zip','Attachment','basename','createReadStream','createWriteStream','log','html-pdf','eml-format','rimraf','zip-dir','moment','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','json','then','destroy','error','name','send','index','FaxInteraction','rawAttributes','model','keys','dateStart','query','dateEnd'];(function(_0x41c924,_0xb26a44){var _0x357809=function(_0x227149){while(--_0x227149){_0x41c924['push'](_0x41c924['shift']());}};_0x357809(++_0xb26a44);}(_0xbcda,0xc3));var _0xabcd=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xbcda[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0xabcd('0x0'));var emlformat=require(_0xabcd('0x1'));var rimraf=require(_0xabcd('0x2'));var zipdir=require(_0xabcd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xabcd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xabcd('0x5'));var util=require(_0xabcd('0x6'));var path=require(_0xabcd('0x7'));var sox=require(_0xabcd('0x8'));var csv=require(_0xabcd('0x9'));var ejs=require(_0xabcd('0xa'));var fs=require('fs');var _=require(_0xabcd('0xb'));var squel=require(_0xabcd('0xc'));var crypto=require(_0xabcd('0xd'));var jsforce=require(_0xabcd('0xe'));var deskjs=require(_0xabcd('0xf'));var toCsv=require('to-csv');var querystring=require(_0xabcd('0x10'));var Papa=require(_0xabcd('0x11'));var Redis=require(_0xabcd('0x12'));var qs=require(_0xabcd('0x13'));var logger=require(_0xabcd('0x14'))(_0xabcd('0x15'));var utils=require('../../config/utils');var config=require(_0xabcd('0x16'));var db=require(_0xabcd('0x17'))['db'];config[_0xabcd('0x18')]=_[_0xabcd('0x19')](config[_0xabcd('0x18')],{'host':_0xabcd('0x1a'),'port':0x18eb});var socket=require(_0xabcd('0x1b'))(new Redis(config[_0xabcd('0x18')]));require('./faxInteraction.socket')[_0xabcd('0x1c')](socket);function respondWithStatusCode(_0x106691,_0x59ed31){_0x59ed31=_0x59ed31||0xcc;return function(_0x31ac0d){if(_0x31ac0d){return _0x106691[_0xabcd('0x1d')](_0x59ed31);}return _0x106691[_0xabcd('0x1e')](_0x59ed31)[_0xabcd('0x1f')]();};}function respondWithResult(_0x398e23,_0xb1b0e8){_0xb1b0e8=_0xb1b0e8||0xc8;return function(_0x532428){if(_0x532428){return _0x398e23[_0xabcd('0x1e')](_0xb1b0e8)['json'](_0x532428);}};}function respondWithFilteredResult(_0x252a43,_0x4abebd){return function(_0x3b3791){if(_0x3b3791){var _0x2ff21c=_0x3b3791[_0xabcd('0x20')],_0x56372a=_0x4abebd[_0xabcd('0x21')],_0xf72186=_0x4abebd['offset']+_0x4abebd[_0xabcd('0x22')],_0x2ab87e;if(_0xf72186>=_0x2ff21c){_0xf72186=_0x2ff21c;_0x2ab87e=0xc8;}else{_0x2ab87e=0xce;}_0x252a43[_0xabcd('0x1e')](_0x2ab87e);return _0x252a43['set']('Content-Range',_0x56372a+'-'+_0xf72186+'/'+_0x2ff21c)[_0xabcd('0x23')](_0x3b3791);}return null;};}function patchUpdates(_0x5dbb1a){return function(_0x728faf){try{jsonpatch['apply'](_0x728faf,_0x5dbb1a,!![]);}catch(_0x52dab0){return BPromise['reject'](_0x52dab0);}return _0x728faf['save']();};}function saveUpdates(_0x556833,_0x33618a){return function(_0x1aebbd){if(_0x1aebbd){return _0x1aebbd['update'](_0x556833)[_0xabcd('0x24')](function(_0x16048b){return _0x16048b;});}return null;};}function removeEntity(_0x53a887,_0x45f6de){return function(_0x34f325){if(_0x34f325){return _0x34f325[_0xabcd('0x25')]()[_0xabcd('0x24')](function(){_0x53a887['status'](0xcc)[_0xabcd('0x1f')]();});}};}function handleEntityNotFound(_0x3fdbaa,_0x43ef50){return function(_0x53e2c3){if(!_0x53e2c3){_0x3fdbaa[_0xabcd('0x1d')](0x194);}return _0x53e2c3;};}function handleError(_0x5eedfd,_0x4108f1){_0x4108f1=_0x4108f1||0x1f4;return function(_0x11de09){logger[_0xabcd('0x26')](_0x11de09['stack']);if(_0x11de09[_0xabcd('0x27')]){delete _0x11de09[_0xabcd('0x27')];}_0x5eedfd[_0xabcd('0x1e')](_0x4108f1)[_0xabcd('0x28')](_0x11de09);};}exports[_0xabcd('0x29')]=function(_0x31519e,_0x50bd0d){var _0x21a3e1={},_0x4ba1be={},_0x50cd17={'count':0x0,'rows':[]};var _0x5439a5=db[_0xabcd('0x2a')][_0xabcd('0x2b')];_0x4ba1be[_0xabcd('0x2c')]=_[_0xabcd('0x2d')](_0x5439a5);var _0x102528={'dateStart':_0x31519e['query'][_0xabcd('0x2e')],'dateEnd':_0x31519e[_0xabcd('0x2f')][_0xabcd('0x30')]};delete _0x31519e[_0xabcd('0x2f')]['dateStart'];delete _0x31519e[_0xabcd('0x2f')][_0xabcd('0x30')];_0x4ba1be[_0xabcd('0x2f')]=_['keys'](_0x31519e['query']);_0x4ba1be[_0xabcd('0x31')]=_[_0xabcd('0x32')](_0x4ba1be[_0xabcd('0x2c')],_0x4ba1be[_0xabcd('0x2f')]);_0x21a3e1[_0xabcd('0x33')]=_[_0xabcd('0x32')](_0x4ba1be[_0xabcd('0x2c')],qs[_0xabcd('0x34')](_0x31519e['query'][_0xabcd('0x34')]));_0x21a3e1['attributes']=_0x21a3e1['attributes'][_0xabcd('0x35')]?_0x21a3e1[_0xabcd('0x33')]:_0x4ba1be['model'];if(!_0x31519e[_0xabcd('0x2f')][_0xabcd('0x36')](_0xabcd('0x37'))){_0x21a3e1[_0xabcd('0x22')]=qs[_0xabcd('0x22')](_0x31519e[_0xabcd('0x2f')][_0xabcd('0x22')]);_0x21a3e1[_0xabcd('0x21')]=qs[_0xabcd('0x21')](_0x31519e[_0xabcd('0x2f')][_0xabcd('0x21')]);}_0x21a3e1[_0xabcd('0x38')]=qs[_0xabcd('0x39')](_0x31519e[_0xabcd('0x2f')][_0xabcd('0x39')]);_0x21a3e1[_0xabcd('0x3a')]=qs[_0xabcd('0x31')](_[_0xabcd('0x3b')](_0x31519e[_0xabcd('0x2f')],_0x4ba1be[_0xabcd('0x31')]));if(_0x102528['dateStart']){if(_0x102528[_0xabcd('0x30')]){_0x102528[_0xabcd('0x30')]=moment(_0x102528[_0xabcd('0x30')])[_0xabcd('0x3c')](0x1,'day');}else{_0x102528[_0xabcd('0x30')]=moment(_0x102528[_0xabcd('0x2e')])[_0xabcd('0x3c')](0x1,'day');}_[_0xabcd('0x3d')](_0x21a3e1['where'],{'createdAt':{'$gte':_0x102528['dateStart'],'$lte':_0x102528[_0xabcd('0x30')]}});}if(_0x31519e[_0xabcd('0x2f')][_0xabcd('0x3e')]){_0x21a3e1[_0xabcd('0x3a')]=_[_0xabcd('0x3d')](_0x21a3e1[_0xabcd('0x3a')],{'$or':_[_0xabcd('0x3f')](_0x21a3e1[_0xabcd('0x33')],function(_0x46ecfe){var _0x16b460={};_0x16b460[_0x46ecfe]={'$like':'%'+_0x31519e[_0xabcd('0x2f')]['filter']+'%'};return _0x16b460;})});}_0x21a3e1=_['merge']({},_0x21a3e1,_0x31519e[_0xabcd('0x40')]);var _0x5b4c2a={'where':_0x21a3e1[_0xabcd('0x3a')]};_0x5b4c2a[_0xabcd('0x41')]=[];if(_0x31519e[_0xabcd('0x2f')][_0xabcd('0x42')]){_0x5b4c2a[_0xabcd('0x41')][_0xabcd('0x43')]({'model':db['Tag'],'as':'Tags','attributes':['id'],'where':{'id':_0x31519e[_0xabcd('0x2f')][_0xabcd('0x42')]},'required':!![]});_0x5b4c2a['distinct']=!![];}if(_0x31519e['query']['read']){_0x5b4c2a['include'][_0xabcd('0x43')]({'model':db[_0xabcd('0x44')],'as':_0xabcd('0x45'),'attributes':['id',_0xabcd('0x46'),'createdAt',_0xabcd('0x47')],'where':{'direction':'in','read':_0x31519e[_0xabcd('0x2f')][_0xabcd('0x47')]||![]},'required':!![]});_0x5b4c2a['distinct']=!![];}return db[_0xabcd('0x2a')][_0xabcd('0x20')](_0x5b4c2a)['then'](function(_0x218afe){_0x50cd17[_0xabcd('0x20')]=_0x218afe;if(_0x31519e[_0xabcd('0x2f')][_0xabcd('0x48')]){_0x21a3e1[_0xabcd('0x41')]=[{'model':db['User'],'as':_0xabcd('0x49'),'required':![],'attributes':['id',_0xabcd('0x27'),_0xabcd('0x4a')]},{'model':db[_0xabcd('0x4b')],'as':'Contact','required':![]},{'model':db[_0xabcd('0x4c')],'as':_0xabcd('0x4d'),'attributes':[_0xabcd('0x27'),_0xabcd('0x4a'),_0xabcd('0x4e')],'required':![]},{'model':db[_0xabcd('0x4f')],'as':_0xabcd('0x50'),'attributes':[_0xabcd('0x27'),'key'],'required':![]},{'model':db[_0xabcd('0x44')],'as':_0xabcd('0x45'),'attributes':['id',_0xabcd('0x46'),_0xabcd('0x51'),_0xabcd('0x47')],'where':{'direction':'in','read':_0x31519e[_0xabcd('0x2f')][_0xabcd('0x47')]||![]},'required':_0x31519e['query'][_0xabcd('0x47')]||![]},{'model':db[_0xabcd('0x52')],'as':'Tags','attributes':['id','name','color'],'required':_0x31519e[_0xabcd('0x2f')][_0xabcd('0x42')]?!![]:![]},{'model':db['Tag'],'as':_0xabcd('0x53'),'attributes':['id',_0xabcd('0x27'),'color'],'through':_0x31519e[_0xabcd('0x2f')][_0xabcd('0x42')]?{'attributes':[],'where':{'TagId':_0x31519e['query'][_0xabcd('0x42')]||undefined}}:{},'required':_0x31519e[_0xabcd('0x2f')][_0xabcd('0x42')]?!![]:![]}];}return db['FaxInteraction'][_0xabcd('0x54')](_0x21a3e1);})[_0xabcd('0x24')](function(_0x579ec0){_0x50cd17[_0xabcd('0x55')]=_0x579ec0;return _0x50cd17;})['then'](respondWithFilteredResult(_0x50bd0d,_0x21a3e1))['catch'](handleError(_0x50bd0d,null));};exports[_0xabcd('0x56')]=function(_0x29721d,_0x1a5b8b){var _0x4a729d={'raw':![],'where':{'id':_0x29721d['params']['id']}},_0x3b8fd4={};_0x3b8fd4['model']=_[_0xabcd('0x2d')](db[_0xabcd('0x2a')][_0xabcd('0x2b')]);_0x3b8fd4['query']=_[_0xabcd('0x2d')](_0x29721d['query']);_0x3b8fd4[_0xabcd('0x31')]=_[_0xabcd('0x32')](_0x3b8fd4['model'],_0x3b8fd4[_0xabcd('0x2f')]);_0x4a729d[_0xabcd('0x33')]=_[_0xabcd('0x32')](_0x3b8fd4[_0xabcd('0x2c')],qs[_0xabcd('0x34')](_0x29721d[_0xabcd('0x2f')][_0xabcd('0x34')]));_0x4a729d[_0xabcd('0x33')]=_0x4a729d[_0xabcd('0x33')][_0xabcd('0x35')]?_0x4a729d[_0xabcd('0x33')]:_0x3b8fd4['model'];if(_0x29721d[_0xabcd('0x2f')][_0xabcd('0x48')]){_0x4a729d['include']=[{'all':!![]}];}_0x4a729d=_['merge']({},_0x4a729d,_0x29721d[_0xabcd('0x40')]);return db[_0xabcd('0x2a')][_0xabcd('0x57')](_0x4a729d)[_0xabcd('0x24')](handleEntityNotFound(_0x1a5b8b,null))[_0xabcd('0x24')](respondWithResult(_0x1a5b8b,null))[_0xabcd('0x58')](handleError(_0x1a5b8b,null));};exports[_0xabcd('0x59')]=function(_0x4acb03,_0x35b8b5){return db[_0xabcd('0x2a')][_0xabcd('0x59')](_0x4acb03['body'],{})['then'](respondWithResult(_0x35b8b5,0xc9))['catch'](handleError(_0x35b8b5,null));};exports[_0xabcd('0x5a')]=function(_0x4f1083,_0x22313f){if(_0x4f1083[_0xabcd('0x5b')]['id']){delete _0x4f1083[_0xabcd('0x5b')]['id'];}return db[_0xabcd('0x2a')][_0xabcd('0x57')]({'where':{'id':_0x4f1083[_0xabcd('0x5c')]['id']}})[_0xabcd('0x24')](handleEntityNotFound(_0x22313f,null))[_0xabcd('0x24')](saveUpdates(_0x4f1083['body'],null))[_0xabcd('0x24')](respondWithResult(_0x22313f,null))[_0xabcd('0x58')](handleError(_0x22313f,null));};exports[_0xabcd('0x25')]=function(_0x52efbd,_0x54bed3){return db['FaxInteraction'][_0xabcd('0x57')]({'where':{'id':_0x52efbd[_0xabcd('0x5c')]['id']}})[_0xabcd('0x24')](handleEntityNotFound(_0x54bed3,null))[_0xabcd('0x24')](removeEntity(_0x54bed3,null))[_0xabcd('0x58')](handleError(_0x54bed3,null));};exports['describe']=function(_0x5e37ca,_0x542ffb){return db[_0xabcd('0x2a')][_0xabcd('0x5d')]()[_0xabcd('0x24')](respondWithResult(_0x542ffb,null))[_0xabcd('0x58')](handleError(_0x542ffb,null));};exports[_0xabcd('0x5e')]=function(_0x55bf88,_0x1c5937,_0x46d47f){return db[_0xabcd('0x44')][_0xabcd('0x57')]({'where':{'id':_0x55bf88['params']['id']}})[_0xabcd('0x24')](handleEntityNotFound(_0x1c5937,null))[_0xabcd('0x24')](function(_0x267816){if(_0x267816){return _0x267816[_0xabcd('0x5e')](_0x55bf88[_0xabcd('0x5b')]['ids'],_[_0xabcd('0x5f')](_0x55bf88[_0xabcd('0x5b')],['ids','id'])||{});}})[_0xabcd('0x24')](respondWithResult(_0x1c5937,null))[_0xabcd('0x58')](handleError(_0x1c5937,null));};exports[_0xabcd('0x60')]=function(_0x3973c0,_0x400d65,_0x18d0ea){var _0x3bf220={'raw':![],'where':{}};var _0x326b3b={};var _0x12a524={'count':0x0,'rows':[]};return db[_0xabcd('0x2a')][_0xabcd('0x61')]({'where':{'id':_0x3973c0[_0xabcd('0x5c')]['id']}})['then'](handleEntityNotFound(_0x400d65,null))[_0xabcd('0x24')](function(_0x400d9d){if(_0x400d9d){_0x326b3b[_0xabcd('0x2c')]=_[_0xabcd('0x2d')](db['FaxMessage'][_0xabcd('0x2b')]);_0x326b3b[_0xabcd('0x2f')]=_[_0xabcd('0x2d')](_0x3973c0['query']);_0x326b3b[_0xabcd('0x31')]=_[_0xabcd('0x32')](_0x326b3b[_0xabcd('0x2c')],_0x326b3b[_0xabcd('0x2f')]);_0x3bf220['attributes']=_['intersection'](_0x326b3b[_0xabcd('0x2c')],qs[_0xabcd('0x34')](_0x3973c0[_0xabcd('0x2f')][_0xabcd('0x34')]));_0x3bf220[_0xabcd('0x33')]=_0x3bf220[_0xabcd('0x33')][_0xabcd('0x35')]?_0x3bf220[_0xabcd('0x33')]:_0x326b3b['model'];if(!_0x3973c0[_0xabcd('0x2f')][_0xabcd('0x36')]('nolimit')){_0x3bf220['limit']=qs['limit'](_0x3973c0[_0xabcd('0x2f')][_0xabcd('0x22')]);_0x3bf220[_0xabcd('0x21')]=qs[_0xabcd('0x21')](_0x3973c0[_0xabcd('0x2f')]['offset']);}_0x3bf220[_0xabcd('0x38')]=qs[_0xabcd('0x39')](_0x3973c0['query'][_0xabcd('0x39')]);_0x3bf220['where']=qs['filters'](_[_0xabcd('0x3b')](_0x3973c0[_0xabcd('0x2f')],_0x326b3b[_0xabcd('0x31')]));_0x3bf220[_0xabcd('0x3a')][_0xabcd('0x62')]=_0x400d9d['id'];if(_0x3973c0[_0xabcd('0x2f')]['filter']){_0x3bf220['where']=_[_0xabcd('0x3d')](_0x3bf220['where'],{'$or':_[_0xabcd('0x3f')](_0x3bf220[_0xabcd('0x33')],function(_0x4e0e30){var _0x22a50c={};_0x22a50c[_0x4e0e30]={'$like':'%'+_0x3973c0[_0xabcd('0x2f')][_0xabcd('0x3e')]+'%'};return _0x22a50c;})});}if(_0x3973c0[_0xabcd('0x2f')][_0xabcd('0x63')]){var _0x57284f=_0x3973c0[_0xabcd('0x2f')]['$gte'][_0xabcd('0x64')](',');var _0x31471d={};_0x31471d[_0x57284f[0x0]]={'$gte':moment(_0x57284f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3bf220['where']=_[_0xabcd('0x3d')](_0x3bf220[_0xabcd('0x3a')],_0x31471d);}_0x3bf220=_[_0xabcd('0x3d')]({},_0x3bf220,_0x3973c0[_0xabcd('0x40')]);return db[_0xabcd('0x44')]['count']({'where':_0x3bf220[_0xabcd('0x3a')]})['then'](function(_0x18baa1){_0x12a524[_0xabcd('0x20')]=_0x18baa1;if(_0x3973c0['query'][_0xabcd('0x48')]){_0x3bf220[_0xabcd('0x41')]=[{'all':!![]}];}return db['FaxMessage'][_0xabcd('0x54')](_0x3bf220);})['then'](function(_0xcc5182){_0x12a524[_0xabcd('0x55')]=_0xcc5182;return _0x12a524;});}})[_0xabcd('0x24')](respondWithFilteredResult(_0x400d65,_0x3bf220))[_0xabcd('0x58')](handleError(_0x400d65,null));};exports[_0xabcd('0x65')]=function(_0x1654cb,_0x166869,_0x27a076){return db[_0xabcd('0x2a')][_0xabcd('0x57')]({'where':{'id':_0x1654cb[_0xabcd('0x5c')]['id']}})[_0xabcd('0x24')](handleEntityNotFound(_0x166869,null))['then'](function(_0x547340){if(_0x547340){return _0x547340['setTags'](_0x1654cb[_0xabcd('0x5b')][_0xabcd('0x66')],_['omit'](_0x1654cb[_0xabcd('0x5b')],[_0xabcd('0x66'),'id'])||{})['spread'](function(){return db[_0xabcd('0x52')][_0xabcd('0x54')]({'attributes':['id',_0xabcd('0x27'),_0xabcd('0x67')],'where':{'id':_0x1654cb[_0xabcd('0x5b')]['ids']}});})[_0xabcd('0x24')](function(_0x339c27){socket[_0xabcd('0x68')](_0xabcd('0x69'),{'id':Number(_0x1654cb[_0xabcd('0x5c')]['id']),'tags':_0x339c27||[]});return{'id':Number(_0x1654cb[_0xabcd('0x5c')]['id']),'tags':_0x339c27||[]};});}})[_0xabcd('0x24')](respondWithResult(_0x166869,null))['catch'](handleError(_0x166869,null));};exports[_0xabcd('0x6a')]=function(_0x205af7,_0x2b2362,_0x7e5f3e){var _0x149dd2;return db[_0xabcd('0x2a')][_0xabcd('0x57')]({'where':{'id':_0x205af7[_0xabcd('0x5c')]['id']}})[_0xabcd('0x24')](handleEntityNotFound(_0x2b2362,null))['then'](function(_0x3a4bb5){if(_0x3a4bb5){return _0x3a4bb5[_0xabcd('0x6a')](_0x205af7['query']['ids']);}})[_0xabcd('0x24')](respondWithStatusCode(_0x2b2362,null))[_0xabcd('0x58')](handleError(_0x2b2362,null));};exports[_0xabcd('0x6b')]=function(_0x1c4d01,_0x237633){var _0x2e80cb=moment()[_0xabcd('0x6c')]()[_0xabcd('0x6d')]();var _0x170a83=path['join'](config['root'],_0xabcd('0x6e'),_0xabcd('0x6f'),_0xabcd('0x70'));var _0x434769=path['join'](config['root'],_0xabcd('0x6e'),_0xabcd('0x6f'),_0xabcd('0x71'));var _0x548a89=path[_0xabcd('0x72')](_0x434769,_0x2e80cb);var _0x40685d=util[_0xabcd('0x73')](_0xabcd('0x74'),_0x2e80cb);var _0x1521c4=path[_0xabcd('0x72')](_0x434769,_0x40685d);var _0x304bfe=![];return db[_0xabcd('0x2a')][_0xabcd('0x57')]({'where':{'id':_0x1c4d01['params']['id']}})[_0xabcd('0x24')](handleEntityNotFound(_0x237633,null))['then'](function(_0xae8ab8){if(_0xae8ab8){return _0xae8ab8[_0xabcd('0x60')]({'attributes':['id',_0xabcd('0x5b'),'createdAt'],'include':[{'model':db[_0xabcd('0x75')],'as':_0xabcd('0x75')}]});}return[];})['then'](function(_0x5d2f17){_0x304bfe=_0x5d2f17[_0xabcd('0x35')];if(_0x5d2f17['length']){fs['mkdirSync'](_0x548a89);for(var _0x1ccd67=0x0;_0x1ccd67<_0x5d2f17[_0xabcd('0x35')];_0x1ccd67++){var _0xe83c24=_0x5d2f17[_0x1ccd67];var _0x2b8bce=_0xe83c24['Attachment'];if(_0x2b8bce){var _0x3165e9=path['join'](_0x170a83,_0x2b8bce[_0xabcd('0x76')]);if(fs['existsSync'](_0x3165e9)){fs[_0xabcd('0x77')](_0x3165e9)['pipe'](fs[_0xabcd('0x78')](path['join'](_0x548a89,_0x2b8bce['basename'])));}}}}})['then'](function(){if(_0x304bfe){return new BPromise(function(_0x920ed6,_0x4bf945){zipdir(_0x548a89,{'saveTo':_0x1521c4},function(_0x32bb78,_0x2a4aba){if(_0x32bb78)return _0x4bf945(_0x32bb78);return _0x920ed6(_0x2a4aba);});});}})[_0xabcd('0x24')](function(){if(_0x304bfe){return new BPromise(function(_0x37da09,_0x31436e){rimraf(_0x548a89,function(_0x46904b){if(_0x46904b)_0x31436e(_0x46904b);return _0x37da09();});});}})[_0xabcd('0x24')](function(){if(_0x304bfe){return _0x237633[_0xabcd('0x6b')](_0x1521c4,_0x40685d,function(_0x41e909){if(_0x41e909){console[_0xabcd('0x79')]('err',_0x41e909);}else{fs['unlinkSync'](_0x1521c4);}});}else{return _0x237633[_0xabcd('0x1d')](0xc8);}})[_0xabcd('0x58')](handleError(_0x237633,null));}; \ No newline at end of file +var _0x0f96=['Tags','ThroughTags','color','findAll','rows','show','params','fields','find','create','body','catch','addMessage','ids','omit','findOne','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','emit','faxInteractionTags:save','removeTags','toString','root','server','files','tmp','format','join','getMessages','Attachment','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','update','then','end','error','stack','name','FaxInteraction','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','limit','order','sort','pick','add','day','merge','filter','where','options','include','tag','push','Tag','FaxMessage','Messages','direction','createdAt','read','distinct','includeAll','User','Users','fullname','CmContact','Contact','Owner','internal','FaxAccount','Account','key'];(function(_0x1b8829,_0xf3999d){var _0x3aa936=function(_0x599421){while(--_0x599421){_0x1b8829['push'](_0x1b8829['shift']());}};_0x3aa936(++_0xf3999d);}(_0x0f96,0x125));var _0x60f9=function(_0x55246b,_0x37d4e1){_0x55246b=_0x55246b-0x0;var _0x101838=_0x0f96[_0x55246b];return _0x101838;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x60f9('0x0'));var jsonpatch=require(_0x60f9('0x1'));var rp=require(_0x60f9('0x2'));var moment=require(_0x60f9('0x3'));var BPromise=require(_0x60f9('0x4'));var Mustache=require(_0x60f9('0x5'));var util=require('util');var path=require('path');var sox=require(_0x60f9('0x6'));var csv=require(_0x60f9('0x7'));var ejs=require(_0x60f9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x60f9('0x9'));var deskjs=require(_0x60f9('0xa'));var toCsv=require(_0x60f9('0x7'));var querystring=require(_0x60f9('0xb'));var Papa=require(_0x60f9('0xc'));var Redis=require(_0x60f9('0xd'));var qs=require(_0x60f9('0xe'));var logger=require(_0x60f9('0xf'))(_0x60f9('0x10'));var utils=require('../../config/utils');var config=require(_0x60f9('0x11'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x60f9('0x12')](config[_0x60f9('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x60f9('0x14'))(new Redis(config[_0x60f9('0x13')]));require(_0x60f9('0x15'))[_0x60f9('0x16')](socket);function respondWithStatusCode(_0x23328f,_0xf4ef8b){_0xf4ef8b=_0xf4ef8b||0xcc;return function(_0x32dcb0){if(_0x32dcb0){return _0x23328f[_0x60f9('0x17')](_0xf4ef8b);}return _0x23328f[_0x60f9('0x18')](_0xf4ef8b)['end']();};}function respondWithResult(_0x5acc4e,_0x162dbc){_0x162dbc=_0x162dbc||0xc8;return function(_0x552acf){if(_0x552acf){return _0x5acc4e[_0x60f9('0x18')](_0x162dbc)['json'](_0x552acf);}};}function respondWithFilteredResult(_0x1fa53a,_0x3fda5f){return function(_0x5abdde){if(_0x5abdde){var _0x4bd993=_0x5abdde[_0x60f9('0x19')],_0x45b839=_0x3fda5f[_0x60f9('0x1a')],_0x9c0df6=_0x3fda5f[_0x60f9('0x1a')]+_0x3fda5f['limit'],_0x56b600;if(_0x9c0df6>=_0x4bd993){_0x9c0df6=_0x4bd993;_0x56b600=0xc8;}else{_0x56b600=0xce;}_0x1fa53a['status'](_0x56b600);return _0x1fa53a[_0x60f9('0x1b')](_0x60f9('0x1c'),_0x45b839+'-'+_0x9c0df6+'/'+_0x4bd993)[_0x60f9('0x1d')](_0x5abdde);}return null;};}function patchUpdates(_0x1d1b56){return function(_0x3cb389){try{jsonpatch[_0x60f9('0x1e')](_0x3cb389,_0x1d1b56,!![]);}catch(_0x35bb4e){return BPromise[_0x60f9('0x1f')](_0x35bb4e);}return _0x3cb389['save']();};}function saveUpdates(_0x59b143,_0x583e90){return function(_0x35bad6){if(_0x35bad6){return _0x35bad6[_0x60f9('0x20')](_0x59b143)['then'](function(_0x18b189){return _0x18b189;});}return null;};}function removeEntity(_0xd1520a,_0x2c8037){return function(_0x52473d){if(_0x52473d){return _0x52473d['destroy']()[_0x60f9('0x21')](function(){_0xd1520a[_0x60f9('0x18')](0xcc)[_0x60f9('0x22')]();});}};}function handleEntityNotFound(_0x3006a0,_0x449601){return function(_0x85ef88){if(!_0x85ef88){_0x3006a0['sendStatus'](0x194);}return _0x85ef88;};}function handleError(_0x2448b4,_0x4e78f4){_0x4e78f4=_0x4e78f4||0x1f4;return function(_0x2b045a){logger[_0x60f9('0x23')](_0x2b045a[_0x60f9('0x24')]);if(_0x2b045a[_0x60f9('0x25')]){delete _0x2b045a[_0x60f9('0x25')];}_0x2448b4[_0x60f9('0x18')](_0x4e78f4)['send'](_0x2b045a);};}exports['index']=function(_0x590916,_0x3122ea){var _0x283b80={},_0x18fbbe={},_0x587e29={'count':0x0,'rows':[]};var _0x12eda1=db[_0x60f9('0x26')][_0x60f9('0x27')];_0x18fbbe['model']=_['keys'](_0x12eda1);var _0x2431b8={'dateStart':_0x590916[_0x60f9('0x28')][_0x60f9('0x29')],'dateEnd':_0x590916['query'][_0x60f9('0x2a')]};delete _0x590916[_0x60f9('0x28')][_0x60f9('0x29')];delete _0x590916[_0x60f9('0x28')][_0x60f9('0x2a')];_0x18fbbe[_0x60f9('0x28')]=_[_0x60f9('0x2b')](_0x590916[_0x60f9('0x28')]);_0x18fbbe[_0x60f9('0x2c')]=_[_0x60f9('0x2d')](_0x18fbbe['model'],_0x18fbbe['query']);_0x283b80[_0x60f9('0x2e')]=_['intersection'](_0x18fbbe[_0x60f9('0x2f')],qs['fields'](_0x590916[_0x60f9('0x28')]['fields']));_0x283b80[_0x60f9('0x2e')]=_0x283b80['attributes'][_0x60f9('0x30')]?_0x283b80[_0x60f9('0x2e')]:_0x18fbbe[_0x60f9('0x2f')];if(!_0x590916[_0x60f9('0x28')][_0x60f9('0x31')](_0x60f9('0x32'))){_0x283b80[_0x60f9('0x33')]=qs['limit'](_0x590916[_0x60f9('0x28')][_0x60f9('0x33')]);_0x283b80['offset']=qs['offset'](_0x590916[_0x60f9('0x28')][_0x60f9('0x1a')]);}_0x283b80[_0x60f9('0x34')]=qs[_0x60f9('0x35')](_0x590916[_0x60f9('0x28')][_0x60f9('0x35')]);_0x283b80['where']=qs[_0x60f9('0x2c')](_[_0x60f9('0x36')](_0x590916[_0x60f9('0x28')],_0x18fbbe['filters']));if(_0x2431b8[_0x60f9('0x29')]){if(_0x2431b8[_0x60f9('0x2a')]){_0x2431b8[_0x60f9('0x2a')]=moment(_0x2431b8['dateEnd'])[_0x60f9('0x37')](0x1,_0x60f9('0x38'));}else{_0x2431b8[_0x60f9('0x2a')]=moment(_0x2431b8[_0x60f9('0x29')])[_0x60f9('0x37')](0x1,_0x60f9('0x38'));}_[_0x60f9('0x39')](_0x283b80['where'],{'createdAt':{'$gte':_0x2431b8[_0x60f9('0x29')],'$lte':_0x2431b8[_0x60f9('0x2a')]}});}if(_0x590916[_0x60f9('0x28')][_0x60f9('0x3a')]){_0x283b80[_0x60f9('0x3b')]=_[_0x60f9('0x39')](_0x283b80[_0x60f9('0x3b')],{'$or':_['map'](_0x283b80[_0x60f9('0x2e')],function(_0x3a1a04){var _0x122cde={};_0x122cde[_0x3a1a04]={'$like':'%'+_0x590916[_0x60f9('0x28')][_0x60f9('0x3a')]+'%'};return _0x122cde;})});}_0x283b80=_[_0x60f9('0x39')]({},_0x283b80,_0x590916[_0x60f9('0x3c')]);var _0x2bbd09={'where':_0x283b80[_0x60f9('0x3b')]};_0x2bbd09[_0x60f9('0x3d')]=[];if(_0x590916['query'][_0x60f9('0x3e')]){_0x2bbd09[_0x60f9('0x3d')][_0x60f9('0x3f')]({'model':db[_0x60f9('0x40')],'as':'Tags','attributes':['id'],'where':{'id':_0x590916[_0x60f9('0x28')]['tag']},'required':!![]});_0x2bbd09['distinct']=!![];}if(_0x590916[_0x60f9('0x28')]['read']){_0x2bbd09['include'][_0x60f9('0x3f')]({'model':db[_0x60f9('0x41')],'as':_0x60f9('0x42'),'attributes':['id',_0x60f9('0x43'),_0x60f9('0x44'),_0x60f9('0x45')],'where':{'direction':'in','read':_0x590916[_0x60f9('0x28')][_0x60f9('0x45')]||![]},'required':!![]});_0x2bbd09[_0x60f9('0x46')]=!![];}return db['FaxInteraction']['count'](_0x2bbd09)[_0x60f9('0x21')](function(_0x84cba4){_0x587e29[_0x60f9('0x19')]=_0x84cba4;if(_0x590916[_0x60f9('0x28')][_0x60f9('0x47')]){_0x283b80[_0x60f9('0x3d')]=[{'model':db[_0x60f9('0x48')],'as':_0x60f9('0x49'),'required':![],'attributes':['id',_0x60f9('0x25'),_0x60f9('0x4a')]},{'model':db[_0x60f9('0x4b')],'as':_0x60f9('0x4c'),'required':![]},{'model':db[_0x60f9('0x48')],'as':_0x60f9('0x4d'),'attributes':['name',_0x60f9('0x4a'),_0x60f9('0x4e')],'required':![]},{'model':db[_0x60f9('0x4f')],'as':_0x60f9('0x50'),'attributes':[_0x60f9('0x25'),_0x60f9('0x51')],'required':![]},{'model':db[_0x60f9('0x41')],'as':_0x60f9('0x42'),'attributes':['id',_0x60f9('0x43'),_0x60f9('0x44'),'read'],'where':{'direction':'in','read':_0x590916[_0x60f9('0x28')][_0x60f9('0x45')]||![]},'required':_0x590916['query'][_0x60f9('0x45')]||![]},{'model':db[_0x60f9('0x40')],'as':_0x60f9('0x52'),'attributes':['id','name','color'],'required':_0x590916[_0x60f9('0x28')][_0x60f9('0x3e')]?!![]:![]},{'model':db[_0x60f9('0x40')],'as':_0x60f9('0x53'),'attributes':['id',_0x60f9('0x25'),_0x60f9('0x54')],'through':_0x590916[_0x60f9('0x28')][_0x60f9('0x3e')]?{'attributes':[],'where':{'TagId':_0x590916['query'][_0x60f9('0x3e')]||undefined}}:{},'required':_0x590916['query'][_0x60f9('0x3e')]?!![]:![]}];}return db['FaxInteraction'][_0x60f9('0x55')](_0x283b80);})[_0x60f9('0x21')](function(_0x475888){_0x587e29[_0x60f9('0x56')]=_0x475888;return _0x587e29;})[_0x60f9('0x21')](respondWithFilteredResult(_0x3122ea,_0x283b80))['catch'](handleError(_0x3122ea,null));};exports[_0x60f9('0x57')]=function(_0x39e9bf,_0xcdc453){var _0xe24b1e={'raw':![],'where':{'id':_0x39e9bf[_0x60f9('0x58')]['id']}},_0x55e6a4={};_0x55e6a4[_0x60f9('0x2f')]=_['keys'](db[_0x60f9('0x26')]['rawAttributes']);_0x55e6a4[_0x60f9('0x28')]=_[_0x60f9('0x2b')](_0x39e9bf[_0x60f9('0x28')]);_0x55e6a4['filters']=_[_0x60f9('0x2d')](_0x55e6a4[_0x60f9('0x2f')],_0x55e6a4['query']);_0xe24b1e[_0x60f9('0x2e')]=_[_0x60f9('0x2d')](_0x55e6a4[_0x60f9('0x2f')],qs[_0x60f9('0x59')](_0x39e9bf[_0x60f9('0x28')][_0x60f9('0x59')]));_0xe24b1e[_0x60f9('0x2e')]=_0xe24b1e['attributes'][_0x60f9('0x30')]?_0xe24b1e[_0x60f9('0x2e')]:_0x55e6a4[_0x60f9('0x2f')];if(_0x39e9bf[_0x60f9('0x28')][_0x60f9('0x47')]){_0xe24b1e[_0x60f9('0x3d')]=[{'all':!![]}];}_0xe24b1e=_[_0x60f9('0x39')]({},_0xe24b1e,_0x39e9bf[_0x60f9('0x3c')]);return db[_0x60f9('0x26')][_0x60f9('0x5a')](_0xe24b1e)[_0x60f9('0x21')](handleEntityNotFound(_0xcdc453,null))[_0x60f9('0x21')](respondWithResult(_0xcdc453,null))['catch'](handleError(_0xcdc453,null));};exports[_0x60f9('0x5b')]=function(_0x5712c7,_0x36c5a1){return db[_0x60f9('0x26')][_0x60f9('0x5b')](_0x5712c7[_0x60f9('0x5c')],{})[_0x60f9('0x21')](respondWithResult(_0x36c5a1,0xc9))[_0x60f9('0x5d')](handleError(_0x36c5a1,null));};exports['update']=function(_0x34ceea,_0x318982){if(_0x34ceea[_0x60f9('0x5c')]['id']){delete _0x34ceea[_0x60f9('0x5c')]['id'];}return db[_0x60f9('0x26')][_0x60f9('0x5a')]({'where':{'id':_0x34ceea[_0x60f9('0x58')]['id']}})['then'](handleEntityNotFound(_0x318982,null))['then'](saveUpdates(_0x34ceea[_0x60f9('0x5c')],null))[_0x60f9('0x21')](respondWithResult(_0x318982,null))[_0x60f9('0x5d')](handleError(_0x318982,null));};exports['destroy']=function(_0x1421e3,_0x5df4c8){return db['FaxInteraction'][_0x60f9('0x5a')]({'where':{'id':_0x1421e3[_0x60f9('0x58')]['id']}})['then'](handleEntityNotFound(_0x5df4c8,null))[_0x60f9('0x21')](removeEntity(_0x5df4c8,null))[_0x60f9('0x5d')](handleError(_0x5df4c8,null));};exports['describe']=function(_0x3cc523,_0xc426d0){return db[_0x60f9('0x26')]['describe']()[_0x60f9('0x21')](respondWithResult(_0xc426d0,null))[_0x60f9('0x5d')](handleError(_0xc426d0,null));};exports[_0x60f9('0x5e')]=function(_0x3ed012,_0x56faff,_0x9ab982){return db[_0x60f9('0x41')][_0x60f9('0x5a')]({'where':{'id':_0x3ed012[_0x60f9('0x58')]['id']}})[_0x60f9('0x21')](handleEntityNotFound(_0x56faff,null))[_0x60f9('0x21')](function(_0x31d62d){if(_0x31d62d){return _0x31d62d[_0x60f9('0x5e')](_0x3ed012[_0x60f9('0x5c')][_0x60f9('0x5f')],_[_0x60f9('0x60')](_0x3ed012[_0x60f9('0x5c')],[_0x60f9('0x5f'),'id'])||{});}})[_0x60f9('0x21')](respondWithResult(_0x56faff,null))[_0x60f9('0x5d')](handleError(_0x56faff,null));};exports['getMessages']=function(_0x3f37f9,_0x45b76d,_0x3f238e){var _0xf231ca={'raw':![],'where':{}};var _0x3e11fd={};var _0x475c12={'count':0x0,'rows':[]};return db[_0x60f9('0x26')][_0x60f9('0x61')]({'where':{'id':_0x3f37f9[_0x60f9('0x58')]['id']}})[_0x60f9('0x21')](handleEntityNotFound(_0x45b76d,null))[_0x60f9('0x21')](function(_0x1dbc3a){if(_0x1dbc3a){_0x3e11fd['model']=_[_0x60f9('0x2b')](db[_0x60f9('0x41')][_0x60f9('0x27')]);_0x3e11fd[_0x60f9('0x28')]=_[_0x60f9('0x2b')](_0x3f37f9[_0x60f9('0x28')]);_0x3e11fd['filters']=_[_0x60f9('0x2d')](_0x3e11fd['model'],_0x3e11fd['query']);_0xf231ca[_0x60f9('0x2e')]=_[_0x60f9('0x2d')](_0x3e11fd[_0x60f9('0x2f')],qs['fields'](_0x3f37f9[_0x60f9('0x28')][_0x60f9('0x59')]));_0xf231ca['attributes']=_0xf231ca[_0x60f9('0x2e')]['length']?_0xf231ca[_0x60f9('0x2e')]:_0x3e11fd[_0x60f9('0x2f')];if(!_0x3f37f9[_0x60f9('0x28')]['hasOwnProperty'](_0x60f9('0x32'))){_0xf231ca[_0x60f9('0x33')]=qs[_0x60f9('0x33')](_0x3f37f9[_0x60f9('0x28')][_0x60f9('0x33')]);_0xf231ca['offset']=qs['offset'](_0x3f37f9['query']['offset']);}_0xf231ca[_0x60f9('0x34')]=qs[_0x60f9('0x35')](_0x3f37f9[_0x60f9('0x28')]['sort']);_0xf231ca['where']=qs[_0x60f9('0x2c')](_[_0x60f9('0x36')](_0x3f37f9[_0x60f9('0x28')],_0x3e11fd['filters']));_0xf231ca['where']['FaxInteractionId']=_0x1dbc3a['id'];if(_0x3f37f9[_0x60f9('0x28')]['filter']){_0xf231ca[_0x60f9('0x3b')]=_[_0x60f9('0x39')](_0xf231ca[_0x60f9('0x3b')],{'$or':_[_0x60f9('0x62')](_0xf231ca[_0x60f9('0x2e')],function(_0x46e341){var _0x192032={};_0x192032[_0x46e341]={'$like':'%'+_0x3f37f9['query']['filter']+'%'};return _0x192032;})});}if(_0x3f37f9['query'][_0x60f9('0x63')]){var _0x3e71cd=_0x3f37f9[_0x60f9('0x28')]['$gte'][_0x60f9('0x64')](',');var _0x129731={};_0x129731[_0x3e71cd[0x0]]={'$gte':moment(_0x3e71cd[0x1])['format'](_0x60f9('0x65'))};_0xf231ca[_0x60f9('0x3b')]=_[_0x60f9('0x39')](_0xf231ca[_0x60f9('0x3b')],_0x129731);}_0xf231ca=_[_0x60f9('0x39')]({},_0xf231ca,_0x3f37f9[_0x60f9('0x3c')]);return db[_0x60f9('0x41')][_0x60f9('0x19')]({'where':_0xf231ca['where']})[_0x60f9('0x21')](function(_0x18ecc3){_0x475c12[_0x60f9('0x19')]=_0x18ecc3;if(_0x3f37f9[_0x60f9('0x28')]['includeAll']){_0xf231ca[_0x60f9('0x3d')]=[{'all':!![]}];}return db[_0x60f9('0x41')][_0x60f9('0x55')](_0xf231ca);})['then'](function(_0xebcc78){_0x475c12[_0x60f9('0x56')]=_0xebcc78;return _0x475c12;});}})['then'](respondWithFilteredResult(_0x45b76d,_0xf231ca))[_0x60f9('0x5d')](handleError(_0x45b76d,null));};exports[_0x60f9('0x66')]=function(_0x1e8108,_0x18f0f7,_0x54842f){return db[_0x60f9('0x26')]['find']({'where':{'id':_0x1e8108[_0x60f9('0x58')]['id']}})[_0x60f9('0x21')](handleEntityNotFound(_0x18f0f7,null))[_0x60f9('0x21')](function(_0x37fe51){if(_0x37fe51){return _0x37fe51[_0x60f9('0x67')](_0x1e8108[_0x60f9('0x5c')][_0x60f9('0x5f')],_[_0x60f9('0x60')](_0x1e8108[_0x60f9('0x5c')],['ids','id'])||{})['spread'](function(){return db[_0x60f9('0x40')][_0x60f9('0x55')]({'attributes':['id',_0x60f9('0x25'),_0x60f9('0x54')],'where':{'id':_0x1e8108[_0x60f9('0x5c')][_0x60f9('0x5f')]}});})[_0x60f9('0x21')](function(_0x403a5d){socket[_0x60f9('0x68')](_0x60f9('0x69'),{'id':Number(_0x1e8108[_0x60f9('0x58')]['id']),'tags':_0x403a5d||[]});return{'id':Number(_0x1e8108[_0x60f9('0x58')]['id']),'tags':_0x403a5d||[]};});}})[_0x60f9('0x21')](respondWithResult(_0x18f0f7,null))['catch'](handleError(_0x18f0f7,null));};exports[_0x60f9('0x6a')]=function(_0xe2166c,_0x29ad4c,_0x58175a){var _0x2c3b5d;return db['FaxInteraction'][_0x60f9('0x5a')]({'where':{'id':_0xe2166c[_0x60f9('0x58')]['id']}})[_0x60f9('0x21')](handleEntityNotFound(_0x29ad4c,null))[_0x60f9('0x21')](function(_0x3c7301){if(_0x3c7301){return _0x3c7301[_0x60f9('0x6a')](_0xe2166c[_0x60f9('0x28')]['ids']);}})[_0x60f9('0x21')](respondWithStatusCode(_0x29ad4c,null))[_0x60f9('0x5d')](handleError(_0x29ad4c,null));};exports['download']=function(_0x273fc2,_0x2efd16){var _0x47be74=moment()['unix']()[_0x60f9('0x6b')]();var _0x113f38=path['join'](config[_0x60f9('0x6c')],_0x60f9('0x6d'),_0x60f9('0x6e'),'attachments');var _0x5b35df=path['join'](config['root'],_0x60f9('0x6d'),_0x60f9('0x6e'),_0x60f9('0x6f'));var _0x529760=path['join'](_0x5b35df,_0x47be74);var _0x2d93cf=util[_0x60f9('0x70')]('interaction-%s.zip',_0x47be74);var _0x307a47=path[_0x60f9('0x71')](_0x5b35df,_0x2d93cf);var _0x4c71de=![];return db[_0x60f9('0x26')][_0x60f9('0x5a')]({'where':{'id':_0x273fc2[_0x60f9('0x58')]['id']}})[_0x60f9('0x21')](handleEntityNotFound(_0x2efd16,null))['then'](function(_0x547336){if(_0x547336){return _0x547336[_0x60f9('0x72')]({'attributes':['id','body',_0x60f9('0x44')],'include':[{'model':db[_0x60f9('0x73')],'as':_0x60f9('0x73')}]});}return[];})[_0x60f9('0x21')](function(_0xa464ec){_0x4c71de=_0xa464ec[_0x60f9('0x30')];if(_0xa464ec[_0x60f9('0x30')]){fs[_0x60f9('0x74')](_0x529760);for(var _0x42fc14=0x0;_0x42fc14<_0xa464ec['length'];_0x42fc14++){var _0x47bca4=_0xa464ec[_0x42fc14];var _0xf825c9=_0x47bca4[_0x60f9('0x73')];if(_0xf825c9){var _0x57ef8c=path[_0x60f9('0x71')](_0x113f38,_0xf825c9[_0x60f9('0x75')]);if(fs[_0x60f9('0x76')](_0x57ef8c)){fs[_0x60f9('0x77')](_0x57ef8c)[_0x60f9('0x78')](fs[_0x60f9('0x79')](path['join'](_0x529760,_0xf825c9[_0x60f9('0x75')])));}}}}})[_0x60f9('0x21')](function(){if(_0x4c71de){return new BPromise(function(_0x4ae404,_0x142ee1){zipdir(_0x529760,{'saveTo':_0x307a47},function(_0x8c9c98,_0x4d5cb1){if(_0x8c9c98)return _0x142ee1(_0x8c9c98);return _0x4ae404(_0x4d5cb1);});});}})[_0x60f9('0x21')](function(){if(_0x4c71de){return new BPromise(function(_0x1ebefb,_0x517d6e){rimraf(_0x529760,function(_0x3edf13){if(_0x3edf13)_0x517d6e(_0x3edf13);return _0x1ebefb();});});}})[_0x60f9('0x21')](function(){if(_0x4c71de){return _0x2efd16['download'](_0x307a47,_0x2d93cf,function(_0x2db8cc){if(_0x2db8cc){console[_0x60f9('0x7a')](_0x60f9('0x7b'),_0x2db8cc);}else{fs[_0x60f9('0x7c')](_0x307a47);}});}else{return _0x2efd16[_0x60f9('0x17')](0xc8);}})[_0x60f9('0x5d')](handleError(_0x2efd16,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 15c729b..13c8d20 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 _0xc788=['FaxInteraction','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1aba9c,_0x465976){var _0x414891=function(_0x179f91){while(--_0x179f91){_0x1aba9c['push'](_0x1aba9c['shift']());}};_0x414891(++_0x465976);}(_0xc788,0xc4));var _0x8c78=function(_0x3ca829,_0xc55f17){_0x3ca829=_0x3ca829-0x0;var _0x3b416b=_0xc788[_0x3ca829];return _0x3b416b;};'use strict';var EventEmitter=require(_0x8c78('0x0'));var FaxInteraction=require(_0x8c78('0x1'))['db'][_0x8c78('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8c78('0x3'),'afterDestroy':_0x8c78('0x4')};function emitEvent(_0x23eec0){return function(_0x1d0670,_0x386f0a,_0x5498f9){FaxInteractionEvents[_0x8c78('0x5')](_0x23eec0+':'+_0x1d0670['id'],_0x1d0670);FaxInteractionEvents[_0x8c78('0x5')](_0x23eec0,_0x1d0670);_0x5498f9(null);};}for(var e in events){if(events[_0x8c78('0x6')](e)){var event=events[e];FaxInteraction[_0x8c78('0x7')](e,emitEvent(event));}}module[_0x8c78('0x8')]=FaxInteractionEvents; \ No newline at end of file +var _0x7462=['events','../../mysqldb','save','emit','hasOwnProperty','hook','exports'];(function(_0x34c21e,_0xe461f6){var _0x2a1ccb=function(_0x2e603a){while(--_0x2e603a){_0x34c21e['push'](_0x34c21e['shift']());}};_0x2a1ccb(++_0xe461f6);}(_0x7462,0x165));var _0x2746=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0x7462[_0x4e170e];return _0x338291;};'use strict';var EventEmitter=require(_0x2746('0x0'));var FaxInteraction=require(_0x2746('0x1'))['db']['FaxInteraction'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2746('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3a2c7f){return function(_0x2274b7,_0x57c788,_0x2afbbd){FaxInteractionEvents[_0x2746('0x3')](_0x3a2c7f+':'+_0x2274b7['id'],_0x2274b7);FaxInteractionEvents[_0x2746('0x3')](_0x3a2c7f,_0x2274b7);_0x2afbbd(null);};}for(var e in events){if(events[_0x2746('0x4')](e)){var event=events[e];FaxInteraction[_0x2746('0x5')](e,emitEvent(event));}}module[_0x2746('0x6')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 743ff0c..0fd3a8b 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 _0x7d1f=['fax_interactions','util','../../config/logger','api','moment','bluebird','request-promise','./faxInteraction.attributes','exports','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7d1f,0x17d));var _0xf7d1=function(_0x279c52,_0x5150a6){_0x279c52=_0x279c52-0x0;var _0x423761=_0x7d1f[_0x279c52];return _0x423761;};'use strict';var _=require('lodash');var util=require(_0xf7d1('0x0'));var logger=require(_0xf7d1('0x1'))(_0xf7d1('0x2'));var moment=require(_0xf7d1('0x3'));var BPromise=require(_0xf7d1('0x4'));var rp=require(_0xf7d1('0x5'));var attributes=require(_0xf7d1('0x6'));module[_0xf7d1('0x7')]=function(_0x1d2572,_0x58fbe4){return _0x1d2572[_0xf7d1('0x8')]('FaxInteraction',attributes,{'tableName':_0xf7d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e8e=['request-promise','exports','define','FaxInteraction','lodash','util','../../config/logger','api','moment'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x0e8e,0x79));var _0xe0e8=function(_0x18192b,_0x4f36ce){_0x18192b=_0x18192b-0x0;var _0x1756f5=_0x0e8e[_0x18192b];return _0x1756f5;};'use strict';var _=require(_0xe0e8('0x0'));var util=require(_0xe0e8('0x1'));var logger=require(_0xe0e8('0x2'))(_0xe0e8('0x3'));var moment=require(_0xe0e8('0x4'));var BPromise=require('bluebird');var rp=require(_0xe0e8('0x5'));var attributes=require('./faxInteraction.attributes');module[_0xe0e8('0x6')]=function(_0x34bfd7,_0x3304c7){return _0x34bfd7[_0xe0e8('0x7')](_0xe0e8('0x8'),attributes,{'tableName':'fax_interactions','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 73a5ad8..fac6d3e 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 _0xde6f=['http','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','FaxInteraction','body','options','where','attributes','limit','UpdateFaxInteraction','debug','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x4a0ada,_0x1cc777){var _0x4fbaff=function(_0xe1df5a){while(--_0xe1df5a){_0x4a0ada['push'](_0x4a0ada['shift']());}};_0x4fbaff(++_0x1cc777);}(_0xde6f,0x11c));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfde6('0x0'));var util=require(_0xfde6('0x1'));var moment=require(_0xfde6('0x2'));var BPromise=require('bluebird');var rs=require(_0xfde6('0x3'));var fs=require('fs');var Redis=require(_0xfde6('0x4'));var db=require(_0xfde6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfde6('0x6'))(_0xfde6('0x7'));var config=require(_0xfde6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfde6('0x9')][_0xfde6('0xa')]({'port':0x232a});config['redis']=_[_0xfde6('0xb')](config[_0xfde6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfde6('0xd'))(new Redis(config[_0xfde6('0xc')]));require(_0xfde6('0xe'))[_0xfde6('0xf')](socket);function respondWithRpcPromise(_0x368289,_0x5c97d8,_0xedefa){return new BPromise(function(_0x1cab3b,_0x4e72d0){return client[_0xfde6('0x10')](_0x368289,_0xedefa)[_0xfde6('0x11')](function(_0x2200c5){logger[_0xfde6('0x12')](_0xfde6('0x13'),_0x5c97d8,'request\x20sent');logger['debug'](_0xfde6('0x14'),_0x5c97d8,'request\x20sent',JSON[_0xfde6('0x15')](_0x2200c5));if(_0x2200c5['error']){if(_0x2200c5[_0xfde6('0x16')][_0xfde6('0x17')]===0x1f4){logger[_0xfde6('0x16')](_0xfde6('0x13'),_0x5c97d8,_0x2200c5[_0xfde6('0x16')][_0xfde6('0x18')]);return _0x4e72d0(_0x2200c5[_0xfde6('0x16')]['message']);}logger['error'](_0xfde6('0x13'),_0x5c97d8,_0x2200c5[_0xfde6('0x16')][_0xfde6('0x18')]);return _0x1cab3b(_0x2200c5[_0xfde6('0x16')][_0xfde6('0x18')]);}else{logger[_0xfde6('0x12')](_0xfde6('0x13'),_0x5c97d8,_0xfde6('0x19'));_0x1cab3b(_0x2200c5[_0xfde6('0x1a')][_0xfde6('0x18')]);}})[_0xfde6('0x1b')](function(_0x5edf8f){logger[_0xfde6('0x16')](_0xfde6('0x13'),_0x5c97d8,_0x5edf8f);_0x4e72d0(_0x5edf8f);});});}exports['UpdateFaxInteraction']=function(_0x2e161){var _0x3cf3c3=this;return new Promise(function(_0x24f2e3,_0xc7839d){return db[_0xfde6('0x1c')]['update'](_0x2e161[_0xfde6('0x1d')],{'raw':_0x2e161[_0xfde6('0x1e')]?_0x2e161[_0xfde6('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e161['options']?_0x2e161[_0xfde6('0x1e')][_0xfde6('0x1f')]||null:null,'attributes':_0x2e161[_0xfde6('0x1e')]?_0x2e161[_0xfde6('0x1e')][_0xfde6('0x20')]||null:null,'limit':_0x2e161['options']?_0x2e161[_0xfde6('0x1e')][_0xfde6('0x21')]||null:null})[_0xfde6('0x11')](function(_0x4efe3e){logger[_0xfde6('0x12')](_0xfde6('0x22'),_0x2e161);logger[_0xfde6('0x23')]('UpdateFaxInteraction',_0x2e161,JSON['stringify'](_0x4efe3e));_0x24f2e3(_0x4efe3e);})[_0xfde6('0x1b')](function(_0x1bf06b){logger[_0xfde6('0x16')](_0xfde6('0x22'),_0x1bf06b[_0xfde6('0x18')],_0x2e161);_0xc7839d(_0x3cf3c3[_0xfde6('0x16')](0x1f4,_0x1bf06b['message']));});});};exports[_0xfde6('0x24')]=function(_0x3121ef){return new Promise(function(_0x1db185,_0x18c7d4){return db[_0xfde6('0x1c')][_0xfde6('0x25')]({'where':_0x3121ef[_0xfde6('0x1e')]?_0x3121ef[_0xfde6('0x1e')]['where']||null:null})[_0xfde6('0x11')](function(_0x8dd2c4){if(_0x8dd2c4){return _0x8dd2c4['addTags'](_0x3121ef[_0xfde6('0x1d')][_0xfde6('0x26')],_[_0xfde6('0x27')](_0x3121ef[_0xfde6('0x1d')],[_0xfde6('0x26'),'id'])||{});}})[_0xfde6('0x28')](function(_0x537278){logger[_0xfde6('0x12')]('AddTags',_0x3121ef);logger[_0xfde6('0x23')](_0xfde6('0x29'),_0x3121ef,JSON[_0xfde6('0x15')](_0x537278));_0x1db185(_0x537278);})[_0xfde6('0x1b')](function(_0x43c034){logger[_0xfde6('0x16')](_0xfde6('0x29'),_0x43c034[_0xfde6('0x18')],_0x3121ef);_0x18c7d4(_this[_0xfde6('0x16')](0x1f4,_0x43c034[_0xfde6('0x18')]));});});}; \ No newline at end of file +var _0x3838=['AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','then'];(function(_0x188faa,_0x4b2e6b){var _0x5615d0=function(_0x13ea35){while(--_0x13ea35){_0x188faa['push'](_0x188faa['shift']());}};_0x5615d0(++_0x4b2e6b);}(_0x3838,0x109));var _0x8383=function(_0x21f086,_0x1e6177){_0x21f086=_0x21f086-0x0;var _0x1acda5=_0x3838[_0x21f086];return _0x1acda5;};'use strict';var _=require('lodash');var util=require(_0x8383('0x0'));var moment=require(_0x8383('0x1'));var BPromise=require('bluebird');var rs=require(_0x8383('0x2'));var fs=require('fs');var Redis=require(_0x8383('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8383('0x4'));var logger=require('../../config/logger')(_0x8383('0x5'));var config=require(_0x8383('0x6'));var jayson=require(_0x8383('0x7'));var client=jayson[_0x8383('0x8')][_0x8383('0x9')]({'port':0x232a});config[_0x8383('0xa')]=_[_0x8383('0xb')](config[_0x8383('0xa')],{'host':_0x8383('0xc'),'port':0x18eb});var socket=require(_0x8383('0xd'))(new Redis(config[_0x8383('0xa')]));require(_0x8383('0xe'))[_0x8383('0xf')](socket);function respondWithRpcPromise(_0x5f2794,_0x753433,_0x367dcb){return new BPromise(function(_0x287034,_0x216870){return client[_0x8383('0x10')](_0x5f2794,_0x367dcb)['then'](function(_0x2b5039){logger[_0x8383('0x11')](_0x8383('0x12'),_0x753433,'request\x20sent');logger[_0x8383('0x13')](_0x8383('0x14'),_0x753433,_0x8383('0x15'),JSON[_0x8383('0x16')](_0x2b5039));if(_0x2b5039['error']){if(_0x2b5039[_0x8383('0x17')][_0x8383('0x18')]===0x1f4){logger[_0x8383('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x753433,_0x2b5039[_0x8383('0x17')][_0x8383('0x19')]);return _0x216870(_0x2b5039['error'][_0x8383('0x19')]);}logger[_0x8383('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x753433,_0x2b5039['error'][_0x8383('0x19')]);return _0x287034(_0x2b5039['error'][_0x8383('0x19')]);}else{logger[_0x8383('0x11')](_0x8383('0x12'),_0x753433,'request\x20sent');_0x287034(_0x2b5039['result']['message']);}})[_0x8383('0x1a')](function(_0x39f8bf){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x753433,_0x39f8bf);_0x216870(_0x39f8bf);});});}exports[_0x8383('0x1b')]=function(_0x188156){var _0x5b6767=this;return new Promise(function(_0xd2ec32,_0x49b0b4){return db[_0x8383('0x1c')][_0x8383('0x1d')](_0x188156[_0x8383('0x1e')],{'raw':_0x188156[_0x8383('0x1f')]?_0x188156[_0x8383('0x1f')][_0x8383('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x188156[_0x8383('0x1f')]?_0x188156['options']['where']||null:null,'attributes':_0x188156[_0x8383('0x1f')]?_0x188156[_0x8383('0x1f')][_0x8383('0x21')]||null:null,'limit':_0x188156['options']?_0x188156[_0x8383('0x1f')][_0x8383('0x22')]||null:null})[_0x8383('0x23')](function(_0x3f5f49){logger[_0x8383('0x11')](_0x8383('0x1b'),_0x188156);logger['debug'](_0x8383('0x1b'),_0x188156,JSON['stringify'](_0x3f5f49));_0xd2ec32(_0x3f5f49);})['catch'](function(_0x56874e){logger[_0x8383('0x17')](_0x8383('0x1b'),_0x56874e[_0x8383('0x19')],_0x188156);_0x49b0b4(_0x5b6767['error'](0x1f4,_0x56874e[_0x8383('0x19')]));});});};exports[_0x8383('0x24')]=function(_0x5ae5e3){return new Promise(function(_0x477a5c,_0x2ad781){return db[_0x8383('0x1c')][_0x8383('0x25')]({'where':_0x5ae5e3[_0x8383('0x1f')]?_0x5ae5e3[_0x8383('0x1f')]['where']||null:null})[_0x8383('0x23')](function(_0xb2f0b5){if(_0xb2f0b5){return _0xb2f0b5[_0x8383('0x26')](_0x5ae5e3[_0x8383('0x1e')][_0x8383('0x27')],_[_0x8383('0x28')](_0x5ae5e3[_0x8383('0x1e')],[_0x8383('0x27'),'id'])||{});}})[_0x8383('0x29')](function(_0xe0e991){logger[_0x8383('0x11')](_0x8383('0x2a'),_0x5ae5e3);logger[_0x8383('0x13')]('AddTags',_0x5ae5e3,JSON['stringify'](_0xe0e991));_0x477a5c(_0xe0e991);})[_0x8383('0x1a')](function(_0x158d90){logger['error'](_0x8383('0x2a'),_0x158d90[_0x8383('0x19')],_0x5ae5e3);_0x2ad781(_this[_0x8383('0x17')](0x1f4,_0x158d90[_0x8383('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f8aadd1..71ebcea 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 _0x1d0a=['emit','removeListener','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x1d0a,0x10c));var _0xa1d0=function(_0x3bb9a0,_0x487264){_0x3bb9a0=_0x3bb9a0-0x0;var _0x4bda1b=_0x1d0a[_0x3bb9a0];return _0x4bda1b;};'use strict';var FaxInteractionEvents=require(_0xa1d0('0x0'));var events=[_0xa1d0('0x1'),_0xa1d0('0x2'),_0xa1d0('0x3')];function createListener(_0x5d98d1,_0x2bb5ac){return function(_0x3f173e){_0x2bb5ac[_0xa1d0('0x4')](_0x5d98d1,_0x3f173e);};}function removeListener(_0x1669e5,_0x8c5e10){return function(){FaxInteractionEvents[_0xa1d0('0x5')](_0x1669e5,_0x8c5e10);};}exports['register']=function(_0x21d475){for(var _0xaf68ae=0x0,_0x39eca1=events[_0xa1d0('0x6')];_0xaf68ae<_0x39eca1;_0xaf68ae++){var _0x31155d=events[_0xaf68ae];var _0x203d4c=createListener(_0xa1d0('0x7')+_0x31155d,_0x21d475);FaxInteractionEvents['on'](_0x31155d,_0x203d4c);}}; \ No newline at end of file +var _0x97b1=['update','emit','register','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x97b1,0x11d));var _0x197b=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0x97b1[_0x207a02];return _0xd995c3;};'use strict';var FaxInteractionEvents=require(_0x197b('0x0'));var events=[_0x197b('0x1'),_0x197b('0x2'),_0x197b('0x3')];function createListener(_0xe16851,_0x24e649){return function(_0xaa54db){_0x24e649[_0x197b('0x4')](_0xe16851,_0xaa54db);};}function removeListener(_0x1c5008,_0x4ea893){return function(){FaxInteractionEvents['removeListener'](_0x1c5008,_0x4ea893);};}exports[_0x197b('0x5')]=function(_0x5a9d8d){for(var _0x5c9327=0x0,_0x531b4b=events[_0x197b('0x6')];_0x5c9327<_0x531b4b;_0x5c9327++){var _0x49f95f=events[_0x5c9327];var _0x572e15=createListener(_0x197b('0x7')+_0x49f95f,_0x5a9d8d);FaxInteractionEvents['on'](_0x49f95f,_0x572e15);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 8bdac1e..ccc86cd 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 _0x20a1=['faxinteraction:addtags','addTags','put','tracked','fax','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','connect-timeout','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags'];(function(_0xea3e0e,_0x404f70){var _0x307a03=function(_0x264cab){while(--_0x264cab){_0xea3e0e['push'](_0xea3e0e['shift']());}};_0x307a03(++_0x404f70);}(_0x20a1,0x18a));var _0x120a=function(_0x3852dd,_0x4f3e39){_0x3852dd=_0x3852dd-0x0;var _0x346573=_0x20a1[_0x3852dd];return _0x346573;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x120a('0x0'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x120a('0x1'));router[_0x120a('0x2')]('/',auth[_0x120a('0x3')](),controller[_0x120a('0x4')]);router[_0x120a('0x2')]('/describe',auth[_0x120a('0x3')](),controller[_0x120a('0x5')]);router[_0x120a('0x2')](_0x120a('0x6'),auth['isAuthenticated'](),controller['show']);router[_0x120a('0x2')](_0x120a('0x7'),auth['isAuthenticated'](),controller[_0x120a('0x8')]);router[_0x120a('0x2')](_0x120a('0x9'),auth[_0x120a('0x3')](),controller['download']);router[_0x120a('0xa')]('/',auth[_0x120a('0x3')](),controller[_0x120a('0xb')]);router[_0x120a('0xa')](_0x120a('0x7'),auth['isAuthenticated'](),controller[_0x120a('0xc')]);router['post'](_0x120a('0xd'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x120a('0xe')),controller[_0x120a('0xf')]);router[_0x120a('0x10')](_0x120a('0x6'),auth[_0x120a('0x3')](),interaction[_0x120a('0x11')](_0x120a('0x12'),_0x120a('0x13')),controller[_0x120a('0x14')]);router[_0x120a('0x15')](_0x120a('0x6'),auth[_0x120a('0x3')](),interaction['tracked'](_0x120a('0x12'),_0x120a('0x16')),controller['destroy']);router[_0x120a('0x15')](_0x120a('0xd'),auth[_0x120a('0x3')](),controller[_0x120a('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0f6e=['describe','/:id','show','/:id/messages','/:id/download','download','post','create','tracked','fax','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x37dae5,_0x44cc6c){var _0x52da05=function(_0x4c3982){while(--_0x4c3982){_0x37dae5['push'](_0x37dae5['shift']());}};_0x52da05(++_0x44cc6c);}(_0x0f6e,0x8b));var _0xe0f6=function(_0x4e4253,_0x411609){_0x4e4253=_0x4e4253-0x0;var _0x52767f=_0x0f6e[_0x4e4253];return _0x52767f;};'use strict';var multer=require(_0xe0f6('0x0'));var util=require(_0xe0f6('0x1'));var path=require(_0xe0f6('0x2'));var timeout=require(_0xe0f6('0x3'));var express=require('express');var router=express[_0xe0f6('0x4')]();var auth=require(_0xe0f6('0x5'));var interaction=require(_0xe0f6('0x6'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0xe0f6('0x7')]('/',auth[_0xe0f6('0x8')](),controller[_0xe0f6('0x9')]);router[_0xe0f6('0x7')](_0xe0f6('0xa'),auth[_0xe0f6('0x8')](),controller[_0xe0f6('0xb')]);router['get'](_0xe0f6('0xc'),auth[_0xe0f6('0x8')](),controller[_0xe0f6('0xd')]);router[_0xe0f6('0x7')](_0xe0f6('0xe'),auth[_0xe0f6('0x8')](),controller['getMessages']);router['get'](_0xe0f6('0xf'),auth[_0xe0f6('0x8')](),controller[_0xe0f6('0x10')]);router[_0xe0f6('0x11')]('/',auth[_0xe0f6('0x8')](),controller[_0xe0f6('0x12')]);router[_0xe0f6('0x11')](_0xe0f6('0xe'),auth[_0xe0f6('0x8')](),controller['addMessage']);router['post']('/:id/tags',auth[_0xe0f6('0x8')](),interaction[_0xe0f6('0x13')](_0xe0f6('0x14'),'faxinteraction:addtags'),controller['addTags']);router[_0xe0f6('0x15')](_0xe0f6('0xc'),auth[_0xe0f6('0x8')](),interaction[_0xe0f6('0x13')](_0xe0f6('0x14'),_0xe0f6('0x16')),controller[_0xe0f6('0x17')]);router[_0xe0f6('0x18')](_0xe0f6('0xc'),auth[_0xe0f6('0x8')](),interaction['tracked'](_0xe0f6('0x14'),_0xe0f6('0x19')),controller[_0xe0f6('0x1a')]);router[_0xe0f6('0x18')](_0xe0f6('0x1b'),auth[_0xe0f6('0x8')](),controller[_0xe0f6('0x1c')]);module[_0xe0f6('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 4e65c53..c1407c0 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 _0x027e=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0xb89a60,_0x131471){var _0x40ea50=function(_0x542b8b){while(--_0x542b8b){_0xb89a60['push'](_0xb89a60['shift']());}};_0x40ea50(++_0x131471);}(_0x027e,0x192));var _0xe027=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x027e[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require(_0xe027('0x0'));module[_0xe027('0x1')]={'body':{'type':Sequelize[_0xe027('0x2')](_0xe027('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe027('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe027('0x5')]('in',_0xe027('0x6')),'defaultValue':_0xe027('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe027('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe027('0x7')]}}; \ No newline at end of file +var _0xc480=['ENUM','DATE','sequelize','exports','BOOLEAN'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0xc480,0xcf));var _0x0c48=function(_0x14dfe1,_0x5ee494){_0x14dfe1=_0x14dfe1-0x0;var _0xcec290=_0xc480[_0x14dfe1];return _0xcec290;};'use strict';var Sequelize=require(_0x0c48('0x0'));module[_0x0c48('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0c48('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0c48('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x0c48('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 656125f..9ef1075 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 _0x909b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','then','stack','name','send','index','FaxMessage','rawAttributes','model','keys','query','dateStart','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','dateEnd','add','day','merge','where','map','filter','includeAll','include','show','params','options','find','body','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','../../config/logger','fax','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','Attachment','SendFax','isNil','FaxAccountId','basename','AttachmentId','download','join','server','files','attachments'];(function(_0x3801cd,_0x1e1269){var _0xa6d61c=function(_0x4cbdac){while(--_0x4cbdac){_0x3801cd['push'](_0x3801cd['shift']());}};_0xa6d61c(++_0x1e1269);}(_0x909b,0x18c));var _0xb909=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x909b[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb909('0x0'));var rimraf=require(_0xb909('0x1'));var zipdir=require(_0xb909('0x2'));var jsonpatch=require(_0xb909('0x3'));var rp=require(_0xb909('0x4'));var moment=require(_0xb909('0x5'));var BPromise=require(_0xb909('0x6'));var Mustache=require(_0xb909('0x7'));var util=require(_0xb909('0x8'));var path=require(_0xb909('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb909('0xa'));var squel=require(_0xb909('0xb'));var crypto=require(_0xb909('0xc'));var jsforce=require(_0xb909('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb909('0xe'));var querystring=require(_0xb909('0xf'));var Papa=require(_0xb909('0x10'));var Redis=require(_0xb909('0x11'));var qs=require(_0xb909('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb909('0x13'))['db'];config[_0xb909('0x14')]=_[_0xb909('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb909('0x16'))(new Redis(config[_0xb909('0x14')]));require('./faxMessage.socket')[_0xb909('0x17')](socket);var jayson=require(_0xb909('0x18'));var client=jayson[_0xb909('0x19')]['http']({'port':0x232c});var client9002=jayson[_0xb909('0x19')][_0xb909('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x53d839,_0x51a6e8,_0x51db6a,_0x1791cf){return new BPromise(function(_0x1bc937,_0x12316f){var _0x67de87=_0x1791cf||client;return _0x67de87[_0xb909('0x1b')](_0x53d839,_0x51db6a)['then'](function(_0x3ce598){logger[_0xb909('0x1c')](_0xb909('0x1d'),_0x51a6e8,'request\x20sent');logger[_0xb909('0x1e')](_0xb909('0x1f'),_0x51a6e8,_0xb909('0x20'),JSON[_0xb909('0x21')](_0x3ce598));if(_0x3ce598['error']){if(_0x3ce598['error'][_0xb909('0x22')]===0x1f4){logger[_0xb909('0x23')](_0xb909('0x1d'),_0x51a6e8,_0x3ce598[_0xb909('0x23')][_0xb909('0x24')]);return _0x12316f(_0x3ce598['error'][_0xb909('0x24')]);}logger['error'](_0xb909('0x1d'),_0x51a6e8,_0x3ce598[_0xb909('0x23')]['message']);return _0x1bc937(_0x3ce598[_0xb909('0x23')][_0xb909('0x24')]);}else{logger['info'](_0xb909('0x1d'),_0x51a6e8,_0xb909('0x20'));_0x1bc937(_0x3ce598[_0xb909('0x25')][_0xb909('0x24')]);}})[_0xb909('0x26')](function(_0x209d8f){logger[_0xb909('0x23')](_0xb909('0x1d'),_0x51a6e8,_0x209d8f);_0x12316f(_0x209d8f);});});}function respondWithStatusCode(_0xc62259,_0x42b641){_0x42b641=_0x42b641||0xcc;return function(_0x950c1f){if(_0x950c1f){return _0xc62259[_0xb909('0x27')](_0x42b641);}return _0xc62259[_0xb909('0x28')](_0x42b641)[_0xb909('0x29')]();};}function respondWithResult(_0x476487,_0x53c2fd){_0x53c2fd=_0x53c2fd||0xc8;return function(_0x1fabee){if(_0x1fabee){return _0x476487[_0xb909('0x28')](_0x53c2fd)[_0xb909('0x2a')](_0x1fabee);}};}function respondWithFilteredResult(_0x17f6d5,_0x4815a7){return function(_0x3c57b9){if(_0x3c57b9){var _0x548b63=_0x3c57b9[_0xb909('0x2b')],_0x4c1e22=_0x4815a7[_0xb909('0x2c')],_0x42c827=_0x4815a7[_0xb909('0x2c')]+_0x4815a7[_0xb909('0x2d')],_0x599e05;if(_0x42c827>=_0x548b63){_0x42c827=_0x548b63;_0x599e05=0xc8;}else{_0x599e05=0xce;}_0x17f6d5[_0xb909('0x28')](_0x599e05);return _0x17f6d5['set']('Content-Range',_0x4c1e22+'-'+_0x42c827+'/'+_0x548b63)[_0xb909('0x2a')](_0x3c57b9);}return null;};}function patchUpdates(_0x4136f5){return function(_0x1ee02a){try{jsonpatch[_0xb909('0x2e')](_0x1ee02a,_0x4136f5,!![]);}catch(_0x1d0bac){return BPromise[_0xb909('0x2f')](_0x1d0bac);}return _0x1ee02a[_0xb909('0x30')]();};}function saveUpdates(_0x4739b2,_0x24041c){return function(_0x4ad00e){if(_0x4ad00e){return _0x4ad00e[_0xb909('0x31')](_0x4739b2)['then'](function(_0x3af10a){return _0x3af10a;});}return null;};}function removeEntity(_0x33aa41,_0x4cd6ae){return function(_0x1b05b7){if(_0x1b05b7){return _0x1b05b7[_0xb909('0x32')]()[_0xb909('0x33')](function(){_0x33aa41[_0xb909('0x28')](0xcc)[_0xb909('0x29')]();});}};}function handleEntityNotFound(_0xf5e2a1,_0x4b6411){return function(_0x2eb2d9){if(!_0x2eb2d9){_0xf5e2a1['sendStatus'](0x194);}return _0x2eb2d9;};}function handleError(_0x3199ec,_0x8f504d){_0x8f504d=_0x8f504d||0x1f4;return function(_0x3ce604){logger[_0xb909('0x23')](_0x3ce604[_0xb909('0x34')]);if(_0x3ce604[_0xb909('0x35')]){delete _0x3ce604['name'];}_0x3199ec[_0xb909('0x28')](_0x8f504d)[_0xb909('0x36')](_0x3ce604);};}exports[_0xb909('0x37')]=function(_0x4eedea,_0x139cc0){var _0x5d984d={},_0x4c8d90={},_0x371ed5={'count':0x0,'rows':[]};var _0x58f938=db[_0xb909('0x38')][_0xb909('0x39')];_0x4c8d90[_0xb909('0x3a')]=_[_0xb909('0x3b')](_0x58f938);var _0x2b770f={'dateStart':_0x4eedea[_0xb909('0x3c')][_0xb909('0x3d')],'dateEnd':_0x4eedea[_0xb909('0x3c')]['dateEnd']};delete _0x4eedea[_0xb909('0x3c')][_0xb909('0x3d')];delete _0x4eedea['query']['dateEnd'];_0x4c8d90[_0xb909('0x3c')]=_[_0xb909('0x3b')](_0x4eedea[_0xb909('0x3c')]);_0x4c8d90['filters']=_[_0xb909('0x3e')](_0x4c8d90['model'],_0x4c8d90[_0xb909('0x3c')]);_0x5d984d['attributes']=_['intersection'](_0x4c8d90[_0xb909('0x3a')],qs[_0xb909('0x3f')](_0x4eedea[_0xb909('0x3c')]['fields']));_0x5d984d['attributes']=_0x5d984d[_0xb909('0x40')][_0xb909('0x41')]?_0x5d984d[_0xb909('0x40')]:_0x4c8d90[_0xb909('0x3a')];if(!_0x4eedea[_0xb909('0x3c')]['hasOwnProperty'](_0xb909('0x42'))){_0x5d984d[_0xb909('0x2d')]=qs[_0xb909('0x2d')](_0x4eedea[_0xb909('0x3c')]['limit']);_0x5d984d['offset']=qs[_0xb909('0x2c')](_0x4eedea[_0xb909('0x3c')]['offset']);}_0x5d984d[_0xb909('0x43')]=qs[_0xb909('0x44')](_0x4eedea[_0xb909('0x3c')][_0xb909('0x44')]);_0x5d984d['where']=qs[_0xb909('0x45')](_[_0xb909('0x46')](_0x4eedea[_0xb909('0x3c')],_0x4c8d90[_0xb909('0x45')]));if(_0x2b770f[_0xb909('0x3d')]){if(_0x2b770f[_0xb909('0x47')]){_0x2b770f['dateEnd']=moment(_0x2b770f[_0xb909('0x47')])[_0xb909('0x48')](0x1,_0xb909('0x49'));}else{_0x2b770f[_0xb909('0x47')]=moment(_0x2b770f[_0xb909('0x3d')])[_0xb909('0x48')](0x1,'day');}_[_0xb909('0x4a')](_0x5d984d[_0xb909('0x4b')],{'createdAt':{'$gte':_0x2b770f['dateStart'],'$lte':_0x2b770f['dateEnd']}});}if(_0x4eedea['query']['filter']){_0x5d984d[_0xb909('0x4b')]=_['merge'](_0x5d984d[_0xb909('0x4b')],{'$or':_[_0xb909('0x4c')](_0x5d984d[_0xb909('0x40')],function(_0x354464){var _0x4738c8={};_0x4738c8[_0x354464]={'$like':'%'+_0x4eedea[_0xb909('0x3c')][_0xb909('0x4d')]+'%'};return _0x4738c8;})});}_0x5d984d=_[_0xb909('0x4a')]({},_0x5d984d,_0x4eedea['options']);var _0xbf5cdc={'where':_0x5d984d[_0xb909('0x4b')]};return db[_0xb909('0x38')][_0xb909('0x2b')](_0xbf5cdc)[_0xb909('0x33')](function(_0x4e86bd){_0x371ed5[_0xb909('0x2b')]=_0x4e86bd;if(_0x4eedea[_0xb909('0x3c')][_0xb909('0x4e')]){_0x5d984d[_0xb909('0x4f')]=[{'all':!![]}];}return db[_0xb909('0x38')]['findAll'](_0x5d984d);})[_0xb909('0x33')](function(_0x17a3cf){_0x371ed5['rows']=_0x17a3cf;return _0x371ed5;})[_0xb909('0x33')](respondWithFilteredResult(_0x139cc0,_0x5d984d))[_0xb909('0x26')](handleError(_0x139cc0,null));};exports[_0xb909('0x50')]=function(_0x18ea18,_0x4538e9){var _0x10f405={'raw':!![],'where':{'id':_0x18ea18[_0xb909('0x51')]['id']}},_0x5eec46={};_0x5eec46[_0xb909('0x3a')]=_[_0xb909('0x3b')](db['FaxMessage'][_0xb909('0x39')]);_0x5eec46[_0xb909('0x3c')]=_[_0xb909('0x3b')](_0x18ea18[_0xb909('0x3c')]);_0x5eec46['filters']=_[_0xb909('0x3e')](_0x5eec46['model'],_0x5eec46[_0xb909('0x3c')]);_0x10f405[_0xb909('0x40')]=_['intersection'](_0x5eec46[_0xb909('0x3a')],qs[_0xb909('0x3f')](_0x18ea18[_0xb909('0x3c')][_0xb909('0x3f')]));_0x10f405[_0xb909('0x40')]=_0x10f405['attributes'][_0xb909('0x41')]?_0x10f405[_0xb909('0x40')]:_0x5eec46[_0xb909('0x3a')];if(_0x18ea18[_0xb909('0x3c')][_0xb909('0x4e')]){_0x10f405[_0xb909('0x4f')]=[{'all':!![]}];}_0x10f405=_[_0xb909('0x4a')]({},_0x10f405,_0x18ea18[_0xb909('0x52')]);return db[_0xb909('0x38')][_0xb909('0x53')](_0x10f405)[_0xb909('0x33')](handleEntityNotFound(_0x4538e9,null))[_0xb909('0x33')](respondWithResult(_0x4538e9,null))['catch'](handleError(_0x4538e9,null));};exports[_0xb909('0x31')]=function(_0x5dd7aa,_0x51cc4b){if(_0x5dd7aa['body']['id']){delete _0x5dd7aa['body']['id'];}return db[_0xb909('0x38')][_0xb909('0x53')]({'where':{'id':_0x5dd7aa[_0xb909('0x51')]['id']}})['then'](handleEntityNotFound(_0x51cc4b,null))[_0xb909('0x33')](saveUpdates(_0x5dd7aa[_0xb909('0x54')],null))[_0xb909('0x33')](respondWithResult(_0x51cc4b,null))['catch'](handleError(_0x51cc4b,null));};exports[_0xb909('0x32')]=function(_0x2152f6,_0x534173){return db[_0xb909('0x38')][_0xb909('0x53')]({'where':{'id':_0x2152f6[_0xb909('0x51')]['id']}})[_0xb909('0x33')](handleEntityNotFound(_0x534173,null))[_0xb909('0x33')](removeEntity(_0x534173,null))[_0xb909('0x26')](handleError(_0x534173,null));};exports[_0xb909('0x55')]=function(_0x4f3833,_0x1fab9f){return db[_0xb909('0x38')][_0xb909('0x55')]()['then'](respondWithResult(_0x1fab9f,null))['catch'](handleError(_0x1fab9f,null));};var interaction_log=require('../../config/logger')(_0xb909('0x56'));exports['accept']=function(_0x3e1283,_0x102b3d,_0x27a7c7){var _0x582963={'channel':'fax'};if(_0x3e1283[_0xb909('0x54')]['id']){delete _0x3e1283['body']['id'];}_0x3e1283[_0xb909('0x54')][_0xb909('0x57')]=!![];_0x3e1283['body'][_0xb909('0x58')]=moment()[_0xb909('0x59')](_0xb909('0x5a'));_0x3e1283[_0xb909('0x54')][_0xb909('0x5b')]=_0x3e1283[_0xb909('0x54')][_0xb909('0x5b')]||_0x3e1283[_0xb909('0x5c')]['id'];return db[_0xb909('0x38')]['find']({'where':{'id':_0x3e1283['params']['id'],'UserId':null},'include':[{'model':db[_0xb909('0x5d')],'as':_0xb909('0x5e')}]})['then'](handleEntityNotFound(_0x102b3d,null))['then'](saveUpdates(_0x3e1283[_0xb909('0x54')],null))[_0xb909('0x33')](function(_0x307043){if(_0x307043){_0x582963[_0xb909('0x24')]=_0x307043[_0xb909('0x5f')]({'plain':!![]});return db[_0xb909('0x60')]['find']({'where':{'id':_0x307043[_0xb909('0x61')]}});}return null;})[_0xb909('0x33')](handleEntityNotFound(_0x102b3d,null))[_0xb909('0x33')](function(_0x4fdac4){if(_0x4fdac4){return _0x4fdac4['update']({'UserId':_0x3e1283[_0xb909('0x54')][_0xb909('0x5b')],'read1stAt':_['isNil'](_0x4fdac4[_0xb909('0x62')])?moment()[_0xb909('0x59')](_0xb909('0x5a')):undefined});}return null;})['then'](function(_0xc70c6a){if(_0xc70c6a){_0x582963['interaction']=_0xc70c6a[_0xb909('0x5f')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e1283[_0xb909('0x5c')]['id'],_0x3e1283['user'][_0xb909('0x35')],_0x3e1283[_0xb909('0x5c')][_0xb909('0x63')],_0x582963[_0xb909('0x64')]['id'],_0x3e1283[_0xb909('0x54')]?JSON[_0xb909('0x21')](_0x3e1283[_0xb909('0x54')]):_0xb909('0x65'));return respondWithRpcPromise(_0xb909('0x66'),_0xb909('0x67'),_0x582963);}return null;})[_0xb909('0x33')](function(_0x41c3ca){if(_0x41c3ca){if(_0x3e1283[_0xb909('0x54')]['manual']){_0x582963[_0xb909('0x24')][_0xb909('0x68')]=util[_0xb909('0x59')](_0xb909('0x69'),_0x3e1283[_0xb909('0x5c')]['name']);_0x582963[_0xb909('0x24')]['channel']=_0x582963[_0xb909('0x6a')];_0x582963[_0xb909('0x24')][_0xb909('0x6b')]=_0xb909('0x6c');return respondWithRpcPromise(_0xb909('0x6d'),_0xb909('0x6d'),{'event':_0xb909('0x6e'),'message':_0x582963[_0xb909('0x24')]},client9002)[_0xb909('0x33')](function(){return _0x582963;});}return _0x582963;}return null;})['then'](respondWithResult(_0x102b3d,null))['catch'](handleError(_0x102b3d,null));};var interaction_log=require(_0xb909('0x6f'))(_0xb909('0x56'));exports['reject']=function(_0x52b30f,_0x1b3e30,_0x97ad11){var _0x413dcc={'agent':{},'channel':_0xb909('0x70')};if(_0x52b30f[_0xb909('0x54')]['id']){delete _0x52b30f[_0xb909('0x54')]['id'];}_0x52b30f[_0xb909('0x54')][_0xb909('0x5b')]=_0x52b30f[_0xb909('0x54')][_0xb909('0x5b')]||_0x52b30f[_0xb909('0x5c')]['id'];_0x413dcc[_0xb909('0x71')]['id']=_0x52b30f[_0xb909('0x54')][_0xb909('0x5b')];return db[_0xb909('0x38')][_0xb909('0x53')]({'where':{'id':_0x52b30f[_0xb909('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1b3e30,null))[_0xb909('0x33')](function(_0x41de5a){if(_0x41de5a){_0x413dcc['message']=_0x41de5a[_0xb909('0x5f')]({'plain':!![]});return db[_0xb909('0x60')][_0xb909('0x53')]({'where':{'id':_0x41de5a[_0xb909('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x1b3e30,null))['then'](function(_0x18eb38){if(_0x18eb38){_0x413dcc[_0xb909('0x64')]=_0x18eb38['get']({'plain':!![]});interaction_log[_0xb909('0x1c')](_0xb909('0x72'),_0x52b30f[_0xb909('0x5c')]['id'],_0x52b30f['user']['name'],_0x52b30f[_0xb909('0x5c')][_0xb909('0x63')],_0x413dcc[_0xb909('0x64')]['id'],_0x52b30f[_0xb909('0x54')]?JSON['stringify'](_0x52b30f['body']):_0xb909('0x65'));return respondWithRpcPromise(_0xb909('0x73'),_0xb909('0x74'),_0x413dcc);}return null;})[_0xb909('0x33')](function(_0x2a571b){if(_0x2a571b){_0x2a571b[_0xb909('0x24')][_0xb909('0x68')]=util[_0xb909('0x59')](_0xb909('0x69'),_0x52b30f[_0xb909('0x5c')]['name']);_0x2a571b[_0xb909('0x24')][_0xb909('0x6a')]=_0x413dcc[_0xb909('0x6a')];_0x2a571b[_0xb909('0x24')]['event']=_0xb909('0x2f');respondWithRpcPromise(_0xb909('0x6d'),_0xb909('0x6d'),{'event':_0xb909('0x75'),'message':_0x2a571b[_0xb909('0x24')]},client9002);return _0x413dcc;}return null;})[_0xb909('0x33')](respondWithResult(_0x1b3e30,null))['catch'](handleError(_0x1b3e30,null));};exports['create']=function(_0x45a5cb,_0x2092e0){var _0x3b16cd;return db[_0xb909('0x38')][_0xb909('0x76')](_0x45a5cb[_0xb909('0x54')],{})[_0xb909('0x33')](function(_0x447f9d){_0x3b16cd=_0x447f9d;return db['CmContact'][_0xb909('0x77')]({'where':{'id':_0x3b16cd[_0xb909('0x78')]}});})[_0xb909('0x33')](function(_0x5a6ef0){if(_['isNil'](_0x5a6ef0)){return;}else{_0x3b16cd['fax']=_0x5a6ef0[_0xb909('0x70')];return db[_0xb909('0x79')][_0xb909('0x77')]({'where':{'id':_0x3b16cd['AttachmentId']}});}})[_0xb909('0x33')](function(_0x154001){return respondWithRpcPromise('SendFax',_0xb909('0x7a'),{'FaxAccountId':_[_0xb909('0x7b')](_0x45a5cb[_0xb909('0x54')])?undefined:_0x45a5cb[_0xb909('0x54')][_0xb909('0x7c')],'path':_[_0xb909('0x7b')](_0x154001)?undefined:util[_0xb909('0x59')]('/var/opt/motion2/server/files/attachments/%s',_0x154001[_0xb909('0x7d')]),'fax':_['isNil'](_0x3b16cd[_0xb909('0x70')])?undefined:_0x3b16cd[_0xb909('0x70')],'AttachmentId':_0x3b16cd[_0xb909('0x7e')]},client9002);})['then'](respondWithResult(_0x2092e0,0xc9))[_0xb909('0x26')](handleError(_0x2092e0,null));};exports[_0xb909('0x7f')]=function(_0x2a8214,_0x6dce71){var _0xb09ddb=path[_0xb909('0x80')](config['root'],_0xb909('0x81'),_0xb909('0x82'),_0xb909('0x83'));return db[_0xb909('0x38')]['find']({'where':{'id':_0x2a8214[_0xb909('0x51')]['id']},'include':[{'model':db[_0xb909('0x79')],'as':'Attachment'}]})[_0xb909('0x33')](handleEntityNotFound(_0x6dce71,null))[_0xb909('0x33')](function(_0x316ae3){if(_0x316ae3){return _0x6dce71[_0xb909('0x7f')](path[_0xb909('0x80')](_0xb09ddb,_0x316ae3[_0xb909('0x79')]['basename']));}})[_0xb909('0x26')](handleError(_0x6dce71,null));}; \ No newline at end of file +var _0x71cd=['fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','dateStart','add','day','merge','filter','where','options','include','show','params','body','find','describe','fax-interactions','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteractionId','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','FaxInteraction','rejectMessage','rejectmessage','create','ContactId','isNil','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','files','attachments','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','limit','set','json','apply','reject','save','update','destroy','stack','name','send','FaxMessage','model','keys','query','dateEnd','filters','attributes','intersection'];(function(_0x1a185d,_0x2bd9ff){var _0x3feb30=function(_0x126011){while(--_0x126011){_0x1a185d['push'](_0x1a185d['shift']());}};_0x3feb30(++_0x2bd9ff);}(_0x71cd,0x1bd));var _0xd71c=function(_0x54c695,_0x5d6677){_0x54c695=_0x54c695-0x0;var _0x3ce06b=_0x71cd[_0x54c695];return _0x3ce06b;};'use strict';var pdf=require(_0xd71c('0x0'));var emlformat=require(_0xd71c('0x1'));var rimraf=require(_0xd71c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd71c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd71c('0x4'));var Mustache=require(_0xd71c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd71c('0x6'));var csv=require('to-csv');var ejs=require(_0xd71c('0x7'));var fs=require('fs');var _=require(_0xd71c('0x8'));var squel=require(_0xd71c('0x9'));var crypto=require(_0xd71c('0xa'));var jsforce=require(_0xd71c('0xb'));var deskjs=require(_0xd71c('0xc'));var toCsv=require(_0xd71c('0xd'));var querystring=require(_0xd71c('0xe'));var Papa=require(_0xd71c('0xf'));var Redis=require(_0xd71c('0x10'));var qs=require(_0xd71c('0x11'));var logger=require(_0xd71c('0x12'))('api');var utils=require(_0xd71c('0x13'));var config=require(_0xd71c('0x14'));var db=require(_0xd71c('0x15'))['db'];config[_0xd71c('0x16')]=_[_0xd71c('0x17')](config[_0xd71c('0x16')],{'host':_0xd71c('0x18'),'port':0x18eb});var socket=require(_0xd71c('0x19'))(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);var jayson=require(_0xd71c('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xd71c('0x1b')][_0xd71c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2c62b8,_0x595ebf,_0xe6b3e3,_0x43c226){return new BPromise(function(_0x406133,_0x2d95eb){var _0x38d0e1=_0x43c226||client;return _0x38d0e1[_0xd71c('0x1d')](_0x2c62b8,_0xe6b3e3)[_0xd71c('0x1e')](function(_0x999968){logger[_0xd71c('0x1f')](_0xd71c('0x20'),_0x595ebf,_0xd71c('0x21'));logger['debug'](_0xd71c('0x22'),_0x595ebf,_0xd71c('0x21'),JSON['stringify'](_0x999968));if(_0x999968[_0xd71c('0x23')]){if(_0x999968[_0xd71c('0x23')][_0xd71c('0x24')]===0x1f4){logger['error'](_0xd71c('0x20'),_0x595ebf,_0x999968[_0xd71c('0x23')]['message']);return _0x2d95eb(_0x999968[_0xd71c('0x23')][_0xd71c('0x25')]);}logger[_0xd71c('0x23')](_0xd71c('0x20'),_0x595ebf,_0x999968['error']['message']);return _0x406133(_0x999968['error']['message']);}else{logger[_0xd71c('0x1f')](_0xd71c('0x20'),_0x595ebf,_0xd71c('0x21'));_0x406133(_0x999968[_0xd71c('0x26')]['message']);}})[_0xd71c('0x27')](function(_0x41be3e){logger[_0xd71c('0x23')](_0xd71c('0x20'),_0x595ebf,_0x41be3e);_0x2d95eb(_0x41be3e);});});}function respondWithStatusCode(_0x5f15c7,_0x338e80){_0x338e80=_0x338e80||0xcc;return function(_0x2589b9){if(_0x2589b9){return _0x5f15c7[_0xd71c('0x28')](_0x338e80);}return _0x5f15c7[_0xd71c('0x29')](_0x338e80)[_0xd71c('0x2a')]();};}function respondWithResult(_0x16e77e,_0xb82557){_0xb82557=_0xb82557||0xc8;return function(_0x446974){if(_0x446974){return _0x16e77e[_0xd71c('0x29')](_0xb82557)['json'](_0x446974);}};}function respondWithFilteredResult(_0x1412c8,_0x565af2){return function(_0x6a7e57){if(_0x6a7e57){var _0x4d7972=_0x6a7e57[_0xd71c('0x2b')],_0x1e5121=_0x565af2['offset'],_0x2472b3=_0x565af2['offset']+_0x565af2[_0xd71c('0x2c')],_0x23d9af;if(_0x2472b3>=_0x4d7972){_0x2472b3=_0x4d7972;_0x23d9af=0xc8;}else{_0x23d9af=0xce;}_0x1412c8[_0xd71c('0x29')](_0x23d9af);return _0x1412c8[_0xd71c('0x2d')]('Content-Range',_0x1e5121+'-'+_0x2472b3+'/'+_0x4d7972)[_0xd71c('0x2e')](_0x6a7e57);}return null;};}function patchUpdates(_0x44738d){return function(_0x22bcdc){try{jsonpatch[_0xd71c('0x2f')](_0x22bcdc,_0x44738d,!![]);}catch(_0x3ad75e){return BPromise[_0xd71c('0x30')](_0x3ad75e);}return _0x22bcdc[_0xd71c('0x31')]();};}function saveUpdates(_0x72d57b,_0x20bd6c){return function(_0x468a32){if(_0x468a32){return _0x468a32[_0xd71c('0x32')](_0x72d57b)[_0xd71c('0x1e')](function(_0x28fddc){return _0x28fddc;});}return null;};}function removeEntity(_0x3cd660,_0x8a71fc){return function(_0x3493fb){if(_0x3493fb){return _0x3493fb[_0xd71c('0x33')]()[_0xd71c('0x1e')](function(){_0x3cd660[_0xd71c('0x29')](0xcc)[_0xd71c('0x2a')]();});}};}function handleEntityNotFound(_0x1572e5,_0x53dfe0){return function(_0x4310c9){if(!_0x4310c9){_0x1572e5[_0xd71c('0x28')](0x194);}return _0x4310c9;};}function handleError(_0x5a5e8b,_0x5ca636){_0x5ca636=_0x5ca636||0x1f4;return function(_0x4496c3){logger[_0xd71c('0x23')](_0x4496c3[_0xd71c('0x34')]);if(_0x4496c3[_0xd71c('0x35')]){delete _0x4496c3['name'];}_0x5a5e8b[_0xd71c('0x29')](_0x5ca636)[_0xd71c('0x36')](_0x4496c3);};}exports['index']=function(_0x1a5d9c,_0x17437a){var _0x7457be={},_0x491dd2={},_0x308602={'count':0x0,'rows':[]};var _0x5caa89=db[_0xd71c('0x37')]['rawAttributes'];_0x491dd2[_0xd71c('0x38')]=_[_0xd71c('0x39')](_0x5caa89);var _0x576c8e={'dateStart':_0x1a5d9c['query']['dateStart'],'dateEnd':_0x1a5d9c[_0xd71c('0x3a')]['dateEnd']};delete _0x1a5d9c[_0xd71c('0x3a')]['dateStart'];delete _0x1a5d9c[_0xd71c('0x3a')][_0xd71c('0x3b')];_0x491dd2['query']=_[_0xd71c('0x39')](_0x1a5d9c['query']);_0x491dd2[_0xd71c('0x3c')]=_['intersection'](_0x491dd2['model'],_0x491dd2[_0xd71c('0x3a')]);_0x7457be[_0xd71c('0x3d')]=_[_0xd71c('0x3e')](_0x491dd2[_0xd71c('0x38')],qs['fields'](_0x1a5d9c[_0xd71c('0x3a')][_0xd71c('0x3f')]));_0x7457be[_0xd71c('0x3d')]=_0x7457be[_0xd71c('0x3d')][_0xd71c('0x40')]?_0x7457be[_0xd71c('0x3d')]:_0x491dd2[_0xd71c('0x38')];if(!_0x1a5d9c[_0xd71c('0x3a')][_0xd71c('0x41')](_0xd71c('0x42'))){_0x7457be[_0xd71c('0x2c')]=qs[_0xd71c('0x2c')](_0x1a5d9c[_0xd71c('0x3a')][_0xd71c('0x2c')]);_0x7457be[_0xd71c('0x43')]=qs['offset'](_0x1a5d9c['query'][_0xd71c('0x43')]);}_0x7457be[_0xd71c('0x44')]=qs['sort'](_0x1a5d9c['query'][_0xd71c('0x45')]);_0x7457be['where']=qs[_0xd71c('0x3c')](_[_0xd71c('0x46')](_0x1a5d9c['query'],_0x491dd2['filters']));if(_0x576c8e[_0xd71c('0x47')]){if(_0x576c8e[_0xd71c('0x3b')]){_0x576c8e[_0xd71c('0x3b')]=moment(_0x576c8e[_0xd71c('0x3b')])[_0xd71c('0x48')](0x1,_0xd71c('0x49'));}else{_0x576c8e[_0xd71c('0x3b')]=moment(_0x576c8e[_0xd71c('0x47')])[_0xd71c('0x48')](0x1,_0xd71c('0x49'));}_[_0xd71c('0x4a')](_0x7457be['where'],{'createdAt':{'$gte':_0x576c8e[_0xd71c('0x47')],'$lte':_0x576c8e[_0xd71c('0x3b')]}});}if(_0x1a5d9c['query'][_0xd71c('0x4b')]){_0x7457be[_0xd71c('0x4c')]=_[_0xd71c('0x4a')](_0x7457be[_0xd71c('0x4c')],{'$or':_['map'](_0x7457be[_0xd71c('0x3d')],function(_0x355cd8){var _0x4bfe73={};_0x4bfe73[_0x355cd8]={'$like':'%'+_0x1a5d9c['query'][_0xd71c('0x4b')]+'%'};return _0x4bfe73;})});}_0x7457be=_[_0xd71c('0x4a')]({},_0x7457be,_0x1a5d9c[_0xd71c('0x4d')]);var _0x15f0f8={'where':_0x7457be[_0xd71c('0x4c')]};return db[_0xd71c('0x37')][_0xd71c('0x2b')](_0x15f0f8)['then'](function(_0x1560f1){_0x308602[_0xd71c('0x2b')]=_0x1560f1;if(_0x1a5d9c['query']['includeAll']){_0x7457be[_0xd71c('0x4e')]=[{'all':!![]}];}return db[_0xd71c('0x37')]['findAll'](_0x7457be);})['then'](function(_0x3fe7c0){_0x308602['rows']=_0x3fe7c0;return _0x308602;})[_0xd71c('0x1e')](respondWithFilteredResult(_0x17437a,_0x7457be))[_0xd71c('0x27')](handleError(_0x17437a,null));};exports[_0xd71c('0x4f')]=function(_0x291dca,_0xc0a133){var _0x3ad678={'raw':!![],'where':{'id':_0x291dca[_0xd71c('0x50')]['id']}},_0x4b5848={};_0x4b5848[_0xd71c('0x38')]=_['keys'](db['FaxMessage']['rawAttributes']);_0x4b5848['query']=_[_0xd71c('0x39')](_0x291dca[_0xd71c('0x3a')]);_0x4b5848[_0xd71c('0x3c')]=_[_0xd71c('0x3e')](_0x4b5848['model'],_0x4b5848[_0xd71c('0x3a')]);_0x3ad678[_0xd71c('0x3d')]=_[_0xd71c('0x3e')](_0x4b5848[_0xd71c('0x38')],qs[_0xd71c('0x3f')](_0x291dca[_0xd71c('0x3a')]['fields']));_0x3ad678['attributes']=_0x3ad678[_0xd71c('0x3d')][_0xd71c('0x40')]?_0x3ad678[_0xd71c('0x3d')]:_0x4b5848['model'];if(_0x291dca[_0xd71c('0x3a')]['includeAll']){_0x3ad678[_0xd71c('0x4e')]=[{'all':!![]}];}_0x3ad678=_['merge']({},_0x3ad678,_0x291dca[_0xd71c('0x4d')]);return db[_0xd71c('0x37')]['find'](_0x3ad678)['then'](handleEntityNotFound(_0xc0a133,null))[_0xd71c('0x1e')](respondWithResult(_0xc0a133,null))['catch'](handleError(_0xc0a133,null));};exports[_0xd71c('0x32')]=function(_0x36b897,_0x4b0440){if(_0x36b897['body']['id']){delete _0x36b897[_0xd71c('0x51')]['id'];}return db[_0xd71c('0x37')][_0xd71c('0x52')]({'where':{'id':_0x36b897['params']['id']}})[_0xd71c('0x1e')](handleEntityNotFound(_0x4b0440,null))[_0xd71c('0x1e')](saveUpdates(_0x36b897['body'],null))[_0xd71c('0x1e')](respondWithResult(_0x4b0440,null))[_0xd71c('0x27')](handleError(_0x4b0440,null));};exports[_0xd71c('0x33')]=function(_0x442d2f,_0x2cf3b8){return db[_0xd71c('0x37')][_0xd71c('0x52')]({'where':{'id':_0x442d2f[_0xd71c('0x50')]['id']}})[_0xd71c('0x1e')](handleEntityNotFound(_0x2cf3b8,null))[_0xd71c('0x1e')](removeEntity(_0x2cf3b8,null))[_0xd71c('0x27')](handleError(_0x2cf3b8,null));};exports[_0xd71c('0x53')]=function(_0x17b793,_0x405b61){return db[_0xd71c('0x37')][_0xd71c('0x53')]()['then'](respondWithResult(_0x405b61,null))[_0xd71c('0x27')](handleError(_0x405b61,null));};var interaction_log=require(_0xd71c('0x12'))(_0xd71c('0x54'));exports['accept']=function(_0x1e8e0e,_0x52de6c,_0x1027ca){var _0x22316c={'channel':_0xd71c('0x55')};if(_0x1e8e0e[_0xd71c('0x51')]['id']){delete _0x1e8e0e[_0xd71c('0x51')]['id'];}_0x1e8e0e[_0xd71c('0x51')]['read']=!![];_0x1e8e0e[_0xd71c('0x51')][_0xd71c('0x56')]=moment()[_0xd71c('0x57')](_0xd71c('0x58'));_0x1e8e0e[_0xd71c('0x51')][_0xd71c('0x59')]=_0x1e8e0e['body'][_0xd71c('0x59')]||_0x1e8e0e[_0xd71c('0x5a')]['id'];return db[_0xd71c('0x37')][_0xd71c('0x52')]({'where':{'id':_0x1e8e0e['params']['id'],'UserId':null},'include':[{'model':db[_0xd71c('0x5b')],'as':'Contact'}]})[_0xd71c('0x1e')](handleEntityNotFound(_0x52de6c,null))[_0xd71c('0x1e')](saveUpdates(_0x1e8e0e[_0xd71c('0x51')],null))[_0xd71c('0x1e')](function(_0x393a85){if(_0x393a85){_0x22316c[_0xd71c('0x25')]=_0x393a85[_0xd71c('0x5c')]({'plain':!![]});return db['FaxInteraction'][_0xd71c('0x52')]({'where':{'id':_0x393a85[_0xd71c('0x5d')]}});}return null;})[_0xd71c('0x1e')](handleEntityNotFound(_0x52de6c,null))[_0xd71c('0x1e')](function(_0x2d074e){if(_0x2d074e){return _0x2d074e['update']({'UserId':_0x1e8e0e['body']['UserId'],'read1stAt':_['isNil'](_0x2d074e['read1stAt'])?moment()[_0xd71c('0x57')](_0xd71c('0x58')):undefined});}return null;})['then'](function(_0x209f00){if(_0x209f00){_0x22316c[_0xd71c('0x5e')]=_0x209f00[_0xd71c('0x5c')]({'plain':!![]});interaction_log[_0xd71c('0x1f')](_0xd71c('0x5f'),_0x1e8e0e[_0xd71c('0x5a')]['id'],_0x1e8e0e[_0xd71c('0x5a')][_0xd71c('0x35')],_0x1e8e0e[_0xd71c('0x5a')][_0xd71c('0x60')],_0x22316c[_0xd71c('0x5e')]['id'],_0x1e8e0e['body']?JSON[_0xd71c('0x61')](_0x1e8e0e[_0xd71c('0x51')]):_0xd71c('0x62'));return respondWithRpcPromise(_0xd71c('0x63'),_0xd71c('0x64'),_0x22316c);}return null;})[_0xd71c('0x1e')](function(_0x3f9fd3){if(_0x3f9fd3){if(_0x1e8e0e[_0xd71c('0x51')][_0xd71c('0x65')]){_0x22316c[_0xd71c('0x25')][_0xd71c('0x66')]=util[_0xd71c('0x57')](_0xd71c('0x67'),_0x1e8e0e[_0xd71c('0x5a')][_0xd71c('0x35')]);_0x22316c[_0xd71c('0x25')][_0xd71c('0x68')]=_0x22316c[_0xd71c('0x68')];_0x22316c[_0xd71c('0x25')][_0xd71c('0x69')]=_0xd71c('0x6a');return respondWithRpcPromise('EventManager',_0xd71c('0x6b'),{'event':_0xd71c('0x6c'),'message':_0x22316c[_0xd71c('0x25')]},client9002)[_0xd71c('0x1e')](function(){return _0x22316c;});}return _0x22316c;}return null;})[_0xd71c('0x1e')](respondWithResult(_0x52de6c,null))['catch'](handleError(_0x52de6c,null));};var interaction_log=require(_0xd71c('0x12'))(_0xd71c('0x54'));exports['reject']=function(_0x4c2e9b,_0x1bb907,_0x35a13b){var _0x1b40d1={'agent':{},'channel':_0xd71c('0x55')};if(_0x4c2e9b[_0xd71c('0x51')]['id']){delete _0x4c2e9b[_0xd71c('0x51')]['id'];}_0x4c2e9b['body'][_0xd71c('0x59')]=_0x4c2e9b[_0xd71c('0x51')][_0xd71c('0x59')]||_0x4c2e9b['user']['id'];_0x1b40d1['agent']['id']=_0x4c2e9b['body'][_0xd71c('0x59')];return db[_0xd71c('0x37')][_0xd71c('0x52')]({'where':{'id':_0x4c2e9b[_0xd71c('0x50')]['id'],'UserId':null}})[_0xd71c('0x1e')](handleEntityNotFound(_0x1bb907,null))['then'](function(_0x74bac){if(_0x74bac){_0x1b40d1[_0xd71c('0x25')]=_0x74bac[_0xd71c('0x5c')]({'plain':!![]});return db[_0xd71c('0x6d')][_0xd71c('0x52')]({'where':{'id':_0x74bac['FaxInteractionId']}});}return null;})[_0xd71c('0x1e')](handleEntityNotFound(_0x1bb907,null))[_0xd71c('0x1e')](function(_0x13bf48){if(_0x13bf48){_0x1b40d1[_0xd71c('0x5e')]=_0x13bf48[_0xd71c('0x5c')]({'plain':!![]});interaction_log[_0xd71c('0x1f')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c2e9b['user']['id'],_0x4c2e9b['user'][_0xd71c('0x35')],_0x4c2e9b['user'][_0xd71c('0x60')],_0x1b40d1[_0xd71c('0x5e')]['id'],_0x4c2e9b[_0xd71c('0x51')]?JSON[_0xd71c('0x61')](_0x4c2e9b[_0xd71c('0x51')]):'null');return respondWithRpcPromise('RejectMessage',_0xd71c('0x6e'),_0x1b40d1);}return null;})[_0xd71c('0x1e')](function(_0x48b422){if(_0x48b422){_0x48b422[_0xd71c('0x25')][_0xd71c('0x66')]=util['format'](_0xd71c('0x67'),_0x4c2e9b[_0xd71c('0x5a')]['name']);_0x48b422[_0xd71c('0x25')][_0xd71c('0x68')]=_0x1b40d1[_0xd71c('0x68')];_0x48b422[_0xd71c('0x25')]['event']=_0xd71c('0x30');respondWithRpcPromise(_0xd71c('0x6b'),_0xd71c('0x6b'),{'event':_0xd71c('0x6f'),'message':_0x48b422[_0xd71c('0x25')]},client9002);return _0x1b40d1;}return null;})[_0xd71c('0x1e')](respondWithResult(_0x1bb907,null))[_0xd71c('0x27')](handleError(_0x1bb907,null));};exports[_0xd71c('0x70')]=function(_0x4380d7,_0x2a545f){var _0x11df63;return db[_0xd71c('0x37')][_0xd71c('0x70')](_0x4380d7[_0xd71c('0x51')],{})[_0xd71c('0x1e')](function(_0x275b29){_0x11df63=_0x275b29;return db[_0xd71c('0x5b')]['findOne']({'where':{'id':_0x11df63[_0xd71c('0x71')]}});})['then'](function(_0x43b21c){if(_[_0xd71c('0x72')](_0x43b21c)){return;}else{_0x11df63[_0xd71c('0x55')]=_0x43b21c[_0xd71c('0x55')];return db[_0xd71c('0x73')][_0xd71c('0x74')]({'where':{'id':_0x11df63[_0xd71c('0x75')]}});}})['then'](function(_0xbfb4ea){return respondWithRpcPromise(_0xd71c('0x76'),_0xd71c('0x76'),{'FaxAccountId':_['isNil'](_0x4380d7[_0xd71c('0x51')])?undefined:_0x4380d7[_0xd71c('0x51')][_0xd71c('0x77')],'path':_[_0xd71c('0x72')](_0xbfb4ea)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0xbfb4ea[_0xd71c('0x78')]),'fax':_[_0xd71c('0x72')](_0x11df63[_0xd71c('0x55')])?undefined:_0x11df63[_0xd71c('0x55')],'AttachmentId':_0x11df63[_0xd71c('0x75')]},client9002);})[_0xd71c('0x1e')](respondWithResult(_0x2a545f,0xc9))['catch'](handleError(_0x2a545f,null));};exports[_0xd71c('0x79')]=function(_0x70eda9,_0x1c5bd2){var _0xccf95b=path[_0xd71c('0x7a')](config[_0xd71c('0x7b')],_0xd71c('0x7c'),_0xd71c('0x7d'),_0xd71c('0x7e'));return db[_0xd71c('0x37')][_0xd71c('0x52')]({'where':{'id':_0x70eda9[_0xd71c('0x50')]['id']},'include':[{'model':db[_0xd71c('0x73')],'as':_0xd71c('0x73')}]})['then'](handleEntityNotFound(_0x1c5bd2,null))[_0xd71c('0x1e')](function(_0x1bbe98){if(_0x1bbe98){return _0x1c5bd2[_0xd71c('0x79')](path[_0xd71c('0x7a')](_0xccf95b,_0x1bbe98[_0xd71c('0x73')][_0xd71c('0x78')]));}})[_0xd71c('0x27')](handleError(_0x1c5bd2,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 5c6ba83..715b461 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 _0x202a=['update','hasOwnProperty','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x202a,0xc0));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xa202('0x0'))['db'][_0xa202('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa202('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa202('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4878f5){return function(_0x595945,_0x32f8b7,_0x1ce932){FaxMessageEvents['emit'](_0x4878f5+':'+_0x595945['id'],_0x595945);FaxMessageEvents['emit'](_0x4878f5,_0x595945);_0x1ce932(null);};}for(var e in events){if(events[_0xa202('0x4')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xf23b=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit'];(function(_0x1344c5,_0x259d52){var _0x368923=function(_0x472123){while(--_0x472123){_0x1344c5['push'](_0x1344c5['shift']());}};_0x368923(++_0x259d52);}(_0xf23b,0xd4));var _0xbf23=function(_0xc12f2f,_0x5594f0){_0xc12f2f=_0xc12f2f-0x0;var _0x2ea148=_0xf23b[_0xc12f2f];return _0x2ea148;};'use strict';var EventEmitter=require(_0xbf23('0x0'));var FaxMessage=require(_0xbf23('0x1'))['db'][_0xbf23('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xbf23('0x3')](0x0);var events={'afterCreate':_0xbf23('0x4'),'afterUpdate':_0xbf23('0x5'),'afterDestroy':_0xbf23('0x6')};function emitEvent(_0x462fbf){return function(_0x29bfae,_0x493a25,_0x591f1c){FaxMessageEvents['emit'](_0x462fbf+':'+_0x29bfae['id'],_0x29bfae);FaxMessageEvents[_0xbf23('0x7')](_0x462fbf,_0x29bfae);_0x591f1c(null);};}for(var e in events){if(events[_0xbf23('0x8')](e)){var event=events[e];FaxMessage[_0xbf23('0x9')](e,emitEvent(event));}}module[_0xbf23('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 4deb264..228d1c1 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 _0xc42b=['createdAt','body','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','./faxMessage.attributes','define','fax_messages','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update'];(function(_0xf973b7,_0x46699f){var _0x499087=function(_0x45b42f){while(--_0x45b42f){_0xf973b7['push'](_0xf973b7['shift']());}};_0x499087(++_0x46699f);}(_0xc42b,0x14a));var _0xbc42=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc42b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbc42('0x0'))(_0xbc42('0x1'));var moment=require(_0xbc42('0x2'));var BPromise=require(_0xbc42('0x3'));var rp=require(_0xbc42('0x4'));var attributes=require(_0xbc42('0x5'));module['exports']=function(_0x46d5e0,_0x1d0c39){return _0x46d5e0[_0xbc42('0x6')]('FaxMessage',attributes,{'tableName':_0xbc42('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x8b2e49,_0x54a78d,_0x4d4773){var _0x113426=_0x46d5e0[_0xbc42('0x8')];var _0x2486b0=_0x8b2e49['get']({'plain':!![]});if(_0x2486b0[_0xbc42('0x9')]['toLowerCase']()==='in'||_0x2486b0[_0xbc42('0x9')][_0xbc42('0xa')]()===_0xbc42('0xb')&&!_0x2486b0[_0xbc42('0xc')]&&!_[_0xbc42('0xd')](_0x2486b0[_0xbc42('0xe')])){_0x113426[_0xbc42('0xf')][_0xbc42('0x10')]({'where':{'id':_0x2486b0[_0xbc42('0x11')]}})[_0xbc42('0x12')](function(_0x4b27c8){if(_0x4b27c8){_0x4b27c8[_0xbc42('0x13')]({'lastMsgAt':_0x2486b0[_0xbc42('0x14')],'lastMsgDirection':_0x2486b0[_0xbc42('0x9')][_0xbc42('0xa')](),'lastMsgBody':_0x2486b0[_0xbc42('0x15')]});}})['catch'](function(_0x3da9ef){console[_0xbc42('0x16')](_0x3da9ef);});}_0x4d4773();}},'charset':_0xbc42('0x17'),'collate':_0xbc42('0x18')});}; \ No newline at end of file +var _0x0643=['toLowerCase','out','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','body','utf8mb4','lodash','util','../../config/logger','api','request-promise','exports','define','FaxMessage','fax_messages','models','get','direction'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x0643,0x17b));var _0x3064=function(_0x4c4965,_0xc6bdc6){_0x4c4965=_0x4c4965-0x0;var _0x541394=_0x0643[_0x4c4965];return _0x541394;};'use strict';var _=require(_0x3064('0x0'));var util=require(_0x3064('0x1'));var logger=require(_0x3064('0x2'))(_0x3064('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3064('0x4'));var attributes=require('./faxMessage.attributes');module[_0x3064('0x5')]=function(_0x5451a4,_0x28bab0){return _0x5451a4[_0x3064('0x6')](_0x3064('0x7'),attributes,{'tableName':_0x3064('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3029b0,_0x52f484,_0x272ba8){var _0x5d0b64=_0x5451a4[_0x3064('0x9')];var _0x546271=_0x3029b0[_0x3064('0xa')]({'plain':!![]});if(_0x546271[_0x3064('0xb')][_0x3064('0xc')]()==='in'||_0x546271[_0x3064('0xb')][_0x3064('0xc')]()===_0x3064('0xd')&&!_0x546271['secret']&&!_[_0x3064('0xe')](_0x546271[_0x3064('0xf')])){_0x5d0b64[_0x3064('0x10')]['findOne']({'where':{'id':_0x546271[_0x3064('0x11')]}})[_0x3064('0x12')](function(_0x18338b){if(_0x18338b){_0x18338b[_0x3064('0x13')]({'lastMsgAt':_0x546271[_0x3064('0x14')],'lastMsgDirection':_0x546271[_0x3064('0xb')][_0x3064('0xc')](),'lastMsgBody':_0x546271[_0x3064('0x15')]});}})['catch'](function(_0x3b82ad){console['error'](_0x3b82ad);});}_0x272ba8();}},'charset':_0x3064('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 86922de..e56693d 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 _0x7a2d=['options','CreateFaxMessage','catch','update','body','raw','where','attributes','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','FaxMessage'];(function(_0x57a22c,_0x5e97e1){var _0x733312=function(_0x19783a){while(--_0x19783a){_0x57a22c['push'](_0x57a22c['shift']());}};_0x733312(++_0x5e97e1);}(_0x7a2d,0x142));var _0xd7a2=function(_0x215fb6,_0x523c3d){_0x215fb6=_0x215fb6-0x0;var _0x19e25f=_0x7a2d[_0x215fb6];return _0x19e25f;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var moment=require(_0xd7a2('0x2'));var BPromise=require(_0xd7a2('0x3'));var rs=require(_0xd7a2('0x4'));var fs=require('fs');var Redis=require(_0xd7a2('0x5'));var db=require(_0xd7a2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd7a2('0x7'));var config=require(_0xd7a2('0x8'));var jayson=require(_0xd7a2('0x9'));var client=jayson[_0xd7a2('0xa')]['http']({'port':0x232a});config[_0xd7a2('0xb')]=_[_0xd7a2('0xc')](config[_0xd7a2('0xb')],{'host':_0xd7a2('0xd'),'port':0x18eb});var socket=require(_0xd7a2('0xe'))(new Redis(config[_0xd7a2('0xb')]));require(_0xd7a2('0xf'))[_0xd7a2('0x10')](socket);function respondWithRpcPromise(_0x104013,_0x503b42,_0x2890bf){return new BPromise(function(_0x319795,_0xe6e4b9){return client[_0xd7a2('0x11')](_0x104013,_0x2890bf)[_0xd7a2('0x12')](function(_0x358c39){logger[_0xd7a2('0x13')]('FaxMessage,\x20%s,\x20%s',_0x503b42,'request\x20sent');logger[_0xd7a2('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x503b42,_0xd7a2('0x15'),JSON[_0xd7a2('0x16')](_0x358c39));if(_0x358c39[_0xd7a2('0x17')]){if(_0x358c39[_0xd7a2('0x17')][_0xd7a2('0x18')]===0x1f4){logger[_0xd7a2('0x17')](_0xd7a2('0x19'),_0x503b42,_0x358c39[_0xd7a2('0x17')][_0xd7a2('0x1a')]);return _0xe6e4b9(_0x358c39[_0xd7a2('0x17')][_0xd7a2('0x1a')]);}logger['error'](_0xd7a2('0x19'),_0x503b42,_0x358c39['error']['message']);return _0x319795(_0x358c39[_0xd7a2('0x17')][_0xd7a2('0x1a')]);}else{logger[_0xd7a2('0x13')](_0xd7a2('0x19'),_0x503b42,_0xd7a2('0x15'));_0x319795(_0x358c39[_0xd7a2('0x1b')]['message']);}})['catch'](function(_0x436fff){logger[_0xd7a2('0x17')](_0xd7a2('0x19'),_0x503b42,_0x436fff);_0xe6e4b9(_0x436fff);});});}exports['CreateFaxMessage']=function(_0x4d3b44){var _0x115bb6=this;return new Promise(function(_0x5d455b,_0x4f885a){return db[_0xd7a2('0x1c')]['create'](_0x4d3b44['body'],{'raw':_0x4d3b44[_0xd7a2('0x1d')]?_0x4d3b44['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x21da02){logger[_0xd7a2('0x13')](_0xd7a2('0x1e'),_0x4d3b44);logger[_0xd7a2('0x14')](_0xd7a2('0x1e'),_0x4d3b44,JSON[_0xd7a2('0x16')](_0x21da02));_0x5d455b(_0x21da02);})[_0xd7a2('0x1f')](function(_0x2e3ac6){logger[_0xd7a2('0x17')](_0xd7a2('0x1e'),_0x2e3ac6[_0xd7a2('0x1a')],_0x4d3b44);_0x4f885a(_0x115bb6[_0xd7a2('0x17')](0x1f4,_0x2e3ac6[_0xd7a2('0x1a')]));});});};exports['UpdateFaxMessage']=function(_0x47cfb5){var _0x11a498=this;return new Promise(function(_0x52b1b4,_0x41e24b){return db['FaxMessage'][_0xd7a2('0x20')](_0x47cfb5[_0xd7a2('0x21')],{'raw':_0x47cfb5[_0xd7a2('0x1d')]?_0x47cfb5[_0xd7a2('0x1d')][_0xd7a2('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47cfb5[_0xd7a2('0x1d')]?_0x47cfb5[_0xd7a2('0x1d')][_0xd7a2('0x23')]||null:null,'attributes':_0x47cfb5[_0xd7a2('0x1d')]?_0x47cfb5[_0xd7a2('0x1d')][_0xd7a2('0x24')]||null:null,'limit':_0x47cfb5[_0xd7a2('0x1d')]?_0x47cfb5[_0xd7a2('0x1d')][_0xd7a2('0x25')]||null:null})[_0xd7a2('0x12')](function(_0x5b5a49){logger[_0xd7a2('0x13')](_0xd7a2('0x26'),_0x47cfb5);logger['debug'](_0xd7a2('0x26'),_0x47cfb5,JSON[_0xd7a2('0x16')](_0x5b5a49));_0x52b1b4(_0x5b5a49);})['catch'](function(_0x33fe22){logger[_0xd7a2('0x17')](_0xd7a2('0x26'),_0x33fe22['message'],_0x47cfb5);_0x41e24b(_0x11a498[_0xd7a2('0x17')](0x1f4,_0x33fe22[_0xd7a2('0x1a')]));});});}; \ No newline at end of file +var _0x1670=['CreateFaxMessage','FaxMessage','create','options','raw','UpdateFaxMessage','update','body','where','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x51e395,_0x5bfe2c){var _0x12ccef=function(_0x2ed6d1){while(--_0x2ed6d1){_0x51e395['push'](_0x51e395['shift']());}};_0x12ccef(++_0x5bfe2c);}(_0x1670,0x9a));var _0x0167=function(_0x4a2854,_0x3a0b75){_0x4a2854=_0x4a2854-0x0;var _0xaf21e=_0x1670[_0x4a2854];return _0xaf21e;};'use strict';var _=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var moment=require('moment');var BPromise=require(_0x0167('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0167('0x3'));var db=require(_0x0167('0x4'))['db'];var utils=require(_0x0167('0x5'));var logger=require(_0x0167('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0167('0x7'));var client=jayson[_0x0167('0x8')][_0x0167('0x9')]({'port':0x232a});config[_0x0167('0xa')]=_[_0x0167('0xb')](config[_0x0167('0xa')],{'host':_0x0167('0xc'),'port':0x18eb});var socket=require(_0x0167('0xd'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x0167('0xe')](socket);function respondWithRpcPromise(_0x178f5f,_0x2b88ec,_0x1632d4){return new BPromise(function(_0x338288,_0x364dc7){return client[_0x0167('0xf')](_0x178f5f,_0x1632d4)[_0x0167('0x10')](function(_0x257ed6){logger[_0x0167('0x11')](_0x0167('0x12'),_0x2b88ec,_0x0167('0x13'));logger[_0x0167('0x14')](_0x0167('0x15'),_0x2b88ec,'request\x20sent',JSON[_0x0167('0x16')](_0x257ed6));if(_0x257ed6['error']){if(_0x257ed6[_0x0167('0x17')]['code']===0x1f4){logger[_0x0167('0x17')](_0x0167('0x12'),_0x2b88ec,_0x257ed6[_0x0167('0x17')]['message']);return _0x364dc7(_0x257ed6['error']['message']);}logger[_0x0167('0x17')](_0x0167('0x12'),_0x2b88ec,_0x257ed6['error'][_0x0167('0x18')]);return _0x338288(_0x257ed6['error']['message']);}else{logger[_0x0167('0x11')]('FaxMessage,\x20%s,\x20%s',_0x2b88ec,_0x0167('0x13'));_0x338288(_0x257ed6['result'][_0x0167('0x18')]);}})[_0x0167('0x19')](function(_0x170207){logger[_0x0167('0x17')](_0x0167('0x12'),_0x2b88ec,_0x170207);_0x364dc7(_0x170207);});});}exports[_0x0167('0x1a')]=function(_0xa384d9){var _0x3cd14f=this;return new Promise(function(_0x35ed6a,_0x7c626){return db[_0x0167('0x1b')][_0x0167('0x1c')](_0xa384d9['body'],{'raw':_0xa384d9[_0x0167('0x1d')]?_0xa384d9[_0x0167('0x1d')][_0x0167('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2f69c3){logger[_0x0167('0x11')](_0x0167('0x1a'),_0xa384d9);logger[_0x0167('0x14')]('CreateFaxMessage',_0xa384d9,JSON[_0x0167('0x16')](_0x2f69c3));_0x35ed6a(_0x2f69c3);})['catch'](function(_0x19e191){logger[_0x0167('0x17')](_0x0167('0x1a'),_0x19e191[_0x0167('0x18')],_0xa384d9);_0x7c626(_0x3cd14f[_0x0167('0x17')](0x1f4,_0x19e191[_0x0167('0x18')]));});});};exports[_0x0167('0x1f')]=function(_0x5e886c){var _0x358b97=this;return new Promise(function(_0x436865,_0x23a863){return db['FaxMessage'][_0x0167('0x20')](_0x5e886c[_0x0167('0x21')],{'raw':_0x5e886c['options']?_0x5e886c[_0x0167('0x1d')][_0x0167('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e886c['options']?_0x5e886c[_0x0167('0x1d')][_0x0167('0x22')]||null:null,'attributes':_0x5e886c[_0x0167('0x1d')]?_0x5e886c['options'][_0x0167('0x23')]||null:null,'limit':_0x5e886c[_0x0167('0x1d')]?_0x5e886c['options']['limit']||null:null})[_0x0167('0x10')](function(_0x124763){logger[_0x0167('0x11')](_0x0167('0x1f'),_0x5e886c);logger['debug']('UpdateFaxMessage',_0x5e886c,JSON[_0x0167('0x16')](_0x124763));_0x436865(_0x124763);})['catch'](function(_0x4b42a2){logger[_0x0167('0x17')](_0x0167('0x1f'),_0x4b42a2[_0x0167('0x18')],_0x5e886c);_0x23a863(_0x358b97[_0x0167('0x17')](0x1f4,_0x4b42a2[_0x0167('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 9b31646..b5bc0ac 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 _0xad36=['remove','update','emit','register','save'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0xad36,0x11c));var _0x6ad3=function(_0x5afa34,_0x963350){_0x5afa34=_0x5afa34-0x0;var _0xd60265=_0xad36[_0x5afa34];return _0xd60265;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x6ad3('0x0'),_0x6ad3('0x1'),_0x6ad3('0x2')];function createListener(_0x1164e0,_0x32fb2f){return function(_0x35a0ee){_0x32fb2f[_0x6ad3('0x3')](_0x1164e0,_0x35a0ee);};}function removeListener(_0x17a9b2,_0x3d8fee){return function(){FaxMessageEvents['removeListener'](_0x17a9b2,_0x3d8fee);};}exports[_0x6ad3('0x4')]=function(_0x3d669f){for(var _0x3c3041=0x0,_0xb38339=events['length'];_0x3c3041<_0xb38339;_0x3c3041++){var _0x5693c1=events[_0x3c3041];var _0x50913c=createListener('faxMessage:'+_0x5693c1,_0x3d669f);FaxMessageEvents['on'](_0x5693c1,_0x50913c);}}; \ No newline at end of file +var _0xc3a8=['faxMessage:','./faxMessage.events','save','remove','emit','register','length'];(function(_0x5d284b,_0x40dc6b){var _0x457354=function(_0x33e40d){while(--_0x33e40d){_0x5d284b['push'](_0x5d284b['shift']());}};_0x457354(++_0x40dc6b);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x2bfa06,_0x351e03){_0x2bfa06=_0x2bfa06-0x0;var _0x58811b=_0xc3a8[_0x2bfa06];return _0x58811b;};'use strict';var FaxMessageEvents=require(_0x8c3a('0x0'));var events=[_0x8c3a('0x1'),_0x8c3a('0x2'),'update'];function createListener(_0x1790e6,_0x5b6a76){return function(_0x3142c7){_0x5b6a76[_0x8c3a('0x3')](_0x1790e6,_0x3142c7);};}function removeListener(_0x3585d1,_0x1d993b){return function(){FaxMessageEvents['removeListener'](_0x3585d1,_0x1d993b);};}exports[_0x8c3a('0x4')]=function(_0x2477f9){for(var _0x18a92a=0x0,_0x170999=events[_0x8c3a('0x5')];_0x18a92a<_0x170999;_0x18a92a++){var _0x37047e=events[_0x18a92a];var _0x58a9b0=createListener(_0x8c3a('0x6')+_0x37047e,_0x2477f9);FaxMessageEvents['on'](_0x37047e,_0x58a9b0);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index a7a951d..c9fd029 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 _0x82c4=['tracked','fax','faxmessage:create','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post'];(function(_0x3c90ba,_0x5e7820){var _0x2ebaa1=function(_0x1a8b48){while(--_0x1a8b48){_0x3c90ba['push'](_0x3c90ba['shift']());}};_0x2ebaa1(++_0x5e7820);}(_0x82c4,0x1ca));var _0x482c=function(_0x3aee25,_0x49e288){_0x3aee25=_0x3aee25-0x0;var _0x3b0442=_0x82c4[_0x3aee25];return _0x3b0442;};'use strict';var multer=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var path=require(_0x482c('0x2'));var timeout=require(_0x482c('0x3'));var express=require(_0x482c('0x4'));var router=express[_0x482c('0x5')]();var auth=require(_0x482c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x482c('0x7'));var controller=require('./faxMessage.controller');router[_0x482c('0x8')]('/',auth['isAuthenticated'](),controller[_0x482c('0x9')]);router['get'](_0x482c('0xa'),auth[_0x482c('0xb')](),controller[_0x482c('0xc')]);router[_0x482c('0x8')](_0x482c('0xd'),auth['isAuthenticated'](),controller[_0x482c('0xe')]);router[_0x482c('0x8')](_0x482c('0xf'),auth[_0x482c('0xb')](),controller[_0x482c('0x10')]);router[_0x482c('0x11')]('/',auth['isAuthenticated'](),interaction[_0x482c('0x12')](_0x482c('0x13'),_0x482c('0x14')),controller['create']);router[_0x482c('0x15')](_0x482c('0xd'),auth[_0x482c('0xb')](),controller['update']);router['put'](_0x482c('0x16'),auth[_0x482c('0xb')](),controller['accept']);router['put'](_0x482c('0x17'),auth[_0x482c('0xb')](),controller[_0x482c('0x18')]);router[_0x482c('0x19')](_0x482c('0xd'),auth[_0x482c('0xb')](),controller[_0x482c('0x1a')]);module[_0x482c('0x1b')]=router; \ No newline at end of file +var _0x5fab=['fax','faxmessage:create','create','put','/:id','update','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','show','download','post','tracked'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x5fab,0x177));var _0xb5fa=function(_0x162b38,_0x543c5c){_0x162b38=_0x162b38-0x0;var _0x4d04a0=_0x5fab[_0x162b38];return _0x4d04a0;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var controller=require(_0xb5fa('0x8'));router[_0xb5fa('0x9')]('/',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xb')]);router['get']('/describe',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0x9')]('/:id',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xd')]);router[_0xb5fa('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xb5fa('0xe')]);router[_0xb5fa('0xf')]('/',auth[_0xb5fa('0xa')](),interaction[_0xb5fa('0x10')](_0xb5fa('0x11'),_0xb5fa('0x12')),controller[_0xb5fa('0x13')]);router[_0xb5fa('0x14')](_0xb5fa('0x15'),auth['isAuthenticated'](),controller[_0xb5fa('0x16')]);router[_0xb5fa('0x14')]('/:id/accept',auth[_0xb5fa('0xa')](),controller['accept']);router[_0xb5fa('0x14')](_0xb5fa('0x17'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x18')]);router[_0xb5fa('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xb5fa('0x1a')]);module[_0xb5fa('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index f1b5a57..9b87538 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 _0xa998=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0xa998,0x64));var _0x8a99=function(_0xf1df69,_0x222196){_0xf1df69=_0xf1df69-0x0;var _0x4dc9dd=_0xa998[_0xf1df69];return _0x4dc9dd;};'use strict';var Sequelize=require(_0x8a99('0x0'));module[_0x8a99('0x1')]={'name':{'type':Sequelize[_0x8a99('0x2')],'unique':_0x8a99('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8a99('0x2')]},'timeout':{'type':Sequelize[_0x8a99('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8a99('0x5')](_0x8a99('0x6'),'beepall',_0x8a99('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x8a99('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x910a=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x343081,_0x310c64){var _0x3a0e5b=function(_0x1650d9){while(--_0x1650d9){_0x343081['push'](_0x343081['shift']());}};_0x3a0e5b(++_0x310c64);}(_0x910a,0x180));var _0xa910=function(_0x401f6e,_0x4c523c){_0x401f6e=_0x401f6e-0x0;var _0x3d3748=_0x910a[_0x401f6e];return _0x3d3748;};'use strict';var Sequelize=require(_0xa910('0x0'));module[_0xa910('0x1')]={'name':{'type':Sequelize[_0xa910('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa910('0x2')]},'timeout':{'type':Sequelize[_0xa910('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa910('0x4')](_0xa910('0x5'),'beepall',_0xa910('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa910('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 a5487ee..13e0deb 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 _0xd395=['query','dateStart','dateEnd','filters','intersection','attributes','fields','length','offset','order','sort','where','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','User','findAndCountAll','UserId','agent','createdAt','%s/%s','faxPause','updatedAt','getTeams','Team','pick','addTeams','Agents','union','addAgents','penalty','ids','removeTeams','spread','emit','userFaxQueue:save','removeAgents','isArray','userFaxQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./faxQueue.socket','sendStatus','status','end','count','limit','set','Content-Range','reject','update','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','index','FaxQueue','rawAttributes','model','keys'];(function(_0x5cb0d1,_0x59091e){var _0x5b62f5=function(_0x39674a){while(--_0x39674a){_0x5cb0d1['push'](_0x5cb0d1['shift']());}};_0x5b62f5(++_0x59091e);}(_0xd395,0x186));var _0x5d39=function(_0x264f53,_0x6981f){_0x264f53=_0x264f53-0x0;var _0x47f814=_0xd395[_0x264f53];return _0x47f814;};'use strict';var pdf=require(_0x5d39('0x0'));var emlformat=require(_0x5d39('0x1'));var rimraf=require(_0x5d39('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d39('0x3'));var rp=require('request-promise');var moment=require(_0x5d39('0x4'));var BPromise=require(_0x5d39('0x5'));var Mustache=require(_0x5d39('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5d39('0x7'));var csv=require('to-csv');var ejs=require(_0x5d39('0x8'));var fs=require('fs');var _=require(_0x5d39('0x9'));var squel=require('squel');var crypto=require(_0x5d39('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5d39('0xb'));var toCsv=require(_0x5d39('0xc'));var querystring=require(_0x5d39('0xd'));var Papa=require(_0x5d39('0xe'));var Redis=require(_0x5d39('0xf'));var qs=require(_0x5d39('0x10'));var logger=require('../../config/logger')(_0x5d39('0x11'));var utils=require(_0x5d39('0x12'));var config=require(_0x5d39('0x13'));var db=require(_0x5d39('0x14'))['db'];config['redis']=_[_0x5d39('0x15')](config[_0x5d39('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d39('0x17'))['register'](socket);function respondWithStatusCode(_0x54256d,_0x313cd6){_0x313cd6=_0x313cd6||0xcc;return function(_0x19815c){if(_0x19815c){return _0x54256d[_0x5d39('0x18')](_0x313cd6);}return _0x54256d[_0x5d39('0x19')](_0x313cd6)[_0x5d39('0x1a')]();};}function respondWithResult(_0x7ed378,_0xa20667){_0xa20667=_0xa20667||0xc8;return function(_0x33002a){if(_0x33002a){return _0x7ed378[_0x5d39('0x19')](_0xa20667)['json'](_0x33002a);}};}function respondWithFilteredResult(_0x521a43,_0x566fb9){return function(_0xdca1){if(_0xdca1){var _0x4f1520=_0xdca1[_0x5d39('0x1b')],_0x599e4b=_0x566fb9['offset'],_0x28d5d4=_0x566fb9['offset']+_0x566fb9[_0x5d39('0x1c')],_0x144cf7;if(_0x28d5d4>=_0x4f1520){_0x28d5d4=_0x4f1520;_0x144cf7=0xc8;}else{_0x144cf7=0xce;}_0x521a43['status'](_0x144cf7);return _0x521a43[_0x5d39('0x1d')](_0x5d39('0x1e'),_0x599e4b+'-'+_0x28d5d4+'/'+_0x4f1520)['json'](_0xdca1);}return null;};}function patchUpdates(_0x207efc){return function(_0x556ec4){try{jsonpatch['apply'](_0x556ec4,_0x207efc,!![]);}catch(_0x3e7e23){return BPromise[_0x5d39('0x1f')](_0x3e7e23);}return _0x556ec4['save']();};}function saveUpdates(_0x335417,_0x5bc3e4){return function(_0x1970dc){if(_0x1970dc){return _0x1970dc[_0x5d39('0x20')](_0x335417)['then'](function(_0x142e76){return _0x142e76;});}return null;};}function removeEntity(_0x641a25,_0x529b41){return function(_0x26df89){if(_0x26df89){return _0x26df89[_0x5d39('0x21')]()[_0x5d39('0x22')](function(){var _0x35fd1d=_0x26df89[_0x5d39('0x23')]({'plain':!![]});var _0x2bd29c=_0x5d39('0x24');return db[_0x5d39('0x25')][_0x5d39('0x21')]({'where':{'type':_0x2bd29c,'resourceId':_0x35fd1d['id']}})[_0x5d39('0x22')](function(){return _0x26df89;});})['then'](function(){_0x641a25[_0x5d39('0x19')](0xcc)[_0x5d39('0x1a')]();});}};}function handleEntityNotFound(_0x4c23c8,_0x1340de){return function(_0x280fa0){if(!_0x280fa0){_0x4c23c8[_0x5d39('0x18')](0x194);}return _0x280fa0;};}function handleError(_0x4b6bc4,_0x4f6fc1){_0x4f6fc1=_0x4f6fc1||0x1f4;return function(_0x20027b){logger[_0x5d39('0x26')](_0x20027b[_0x5d39('0x27')]);if(_0x20027b[_0x5d39('0x28')]){delete _0x20027b[_0x5d39('0x28')];}_0x4b6bc4[_0x5d39('0x19')](_0x4f6fc1)['send'](_0x20027b);};}exports[_0x5d39('0x29')]=function(_0x30236d,_0x35bf2e){var _0x5ac7d6={},_0x3e5322={},_0xf06da5={'count':0x0,'rows':[]};var _0x1812c7=db[_0x5d39('0x2a')][_0x5d39('0x2b')];_0x3e5322[_0x5d39('0x2c')]=_[_0x5d39('0x2d')](_0x1812c7);var _0x5206ef={'dateStart':_0x30236d[_0x5d39('0x2e')][_0x5d39('0x2f')],'dateEnd':_0x30236d[_0x5d39('0x2e')][_0x5d39('0x30')]};delete _0x30236d[_0x5d39('0x2e')]['dateStart'];delete _0x30236d[_0x5d39('0x2e')]['dateEnd'];_0x3e5322[_0x5d39('0x2e')]=_[_0x5d39('0x2d')](_0x30236d['query']);_0x3e5322[_0x5d39('0x31')]=_[_0x5d39('0x32')](_0x3e5322['model'],_0x3e5322['query']);_0x5ac7d6[_0x5d39('0x33')]=_[_0x5d39('0x32')](_0x3e5322[_0x5d39('0x2c')],qs['fields'](_0x30236d['query'][_0x5d39('0x34')]));_0x5ac7d6[_0x5d39('0x33')]=_0x5ac7d6[_0x5d39('0x33')][_0x5d39('0x35')]?_0x5ac7d6[_0x5d39('0x33')]:_0x3e5322['model'];if(!_0x30236d['query']['hasOwnProperty']('nolimit')){_0x5ac7d6['limit']=qs['limit'](_0x30236d[_0x5d39('0x2e')][_0x5d39('0x1c')]);_0x5ac7d6[_0x5d39('0x36')]=qs['offset'](_0x30236d[_0x5d39('0x2e')][_0x5d39('0x36')]);}_0x5ac7d6[_0x5d39('0x37')]=qs[_0x5d39('0x38')](_0x30236d[_0x5d39('0x2e')][_0x5d39('0x38')]);_0x5ac7d6[_0x5d39('0x39')]=qs[_0x5d39('0x31')](_['pick'](_0x30236d[_0x5d39('0x2e')],_0x3e5322[_0x5d39('0x31')]));if(_0x5206ef[_0x5d39('0x2f')]){if(_0x5206ef[_0x5d39('0x30')]){_0x5206ef[_0x5d39('0x30')]=moment(_0x5206ef[_0x5d39('0x30')])[_0x5d39('0x3a')](0x1,_0x5d39('0x3b'));}else{_0x5206ef[_0x5d39('0x30')]=moment(_0x5206ef['dateStart'])['add'](0x1,_0x5d39('0x3b'));}_[_0x5d39('0x3c')](_0x5ac7d6[_0x5d39('0x39')],{'createdAt':{'$gte':_0x5206ef[_0x5d39('0x2f')],'$lte':_0x5206ef['dateEnd']}});}if(_0x30236d[_0x5d39('0x2e')][_0x5d39('0x3d')]){_0x5ac7d6['where']=_['merge'](_0x5ac7d6['where'],{'$or':_[_0x5d39('0x3e')](_0x5ac7d6[_0x5d39('0x33')],function(_0x2d78ec){var _0x41ce00={};_0x41ce00[_0x2d78ec]={'$like':'%'+_0x30236d['query'][_0x5d39('0x3d')]+'%'};return _0x41ce00;})});}_0x5ac7d6=_[_0x5d39('0x3c')]({},_0x5ac7d6,_0x30236d[_0x5d39('0x3f')]);var _0x313080={'where':_0x5ac7d6[_0x5d39('0x39')]};return db[_0x5d39('0x2a')][_0x5d39('0x1b')](_0x313080)[_0x5d39('0x22')](function(_0x495c54){_0xf06da5['count']=_0x495c54;if(_0x30236d[_0x5d39('0x2e')][_0x5d39('0x40')]){_0x5ac7d6[_0x5d39('0x41')]=[{'all':!![]}];}return db[_0x5d39('0x2a')][_0x5d39('0x42')](_0x5ac7d6);})[_0x5d39('0x22')](function(_0xb470db){_0xf06da5[_0x5d39('0x43')]=_0xb470db;return _0xf06da5;})[_0x5d39('0x22')](respondWithFilteredResult(_0x35bf2e,_0x5ac7d6))['catch'](handleError(_0x35bf2e,null));};exports[_0x5d39('0x44')]=function(_0x653b18,_0xb29714){var _0x27780e={'raw':!![],'where':{'id':_0x653b18[_0x5d39('0x45')]['id']}},_0x5c7002={};_0x5c7002[_0x5d39('0x2c')]=_['keys'](db['FaxQueue'][_0x5d39('0x2b')]);_0x5c7002[_0x5d39('0x2e')]=_['keys'](_0x653b18[_0x5d39('0x2e')]);_0x5c7002[_0x5d39('0x31')]=_['intersection'](_0x5c7002['model'],_0x5c7002[_0x5d39('0x2e')]);_0x27780e[_0x5d39('0x33')]=_['intersection'](_0x5c7002[_0x5d39('0x2c')],qs[_0x5d39('0x34')](_0x653b18[_0x5d39('0x2e')][_0x5d39('0x34')]));_0x27780e[_0x5d39('0x33')]=_0x27780e['attributes'][_0x5d39('0x35')]?_0x27780e[_0x5d39('0x33')]:_0x5c7002['model'];if(_0x653b18['query'][_0x5d39('0x40')]){_0x27780e[_0x5d39('0x41')]=[{'all':!![]}];}_0x27780e=_[_0x5d39('0x3c')]({},_0x27780e,_0x653b18[_0x5d39('0x3f')]);return db['FaxQueue'][_0x5d39('0x46')](_0x27780e)[_0x5d39('0x22')](handleEntityNotFound(_0xb29714,null))[_0x5d39('0x22')](respondWithResult(_0xb29714,null))[_0x5d39('0x47')](handleError(_0xb29714,null));};exports[_0x5d39('0x48')]=function(_0x230220,_0x8854d5){return db[_0x5d39('0x2a')][_0x5d39('0x48')](_0x230220[_0x5d39('0x49')],{})[_0x5d39('0x22')](function(_0x33e414){var _0xfa738d=_0x230220['user']['get']({'plain':!![]});if(!_0xfa738d)throw new Error(_0x5d39('0x4a'));if(_0xfa738d[_0x5d39('0x4b')]==='user'){var _0x47a8cf=_0x33e414[_0x5d39('0x23')]({'plain':!![]});var _0xaaace2=_0x5d39('0x24');return db[_0x5d39('0x4c')]['find']({'where':{'name':_0xaaace2,'userProfileId':_0xfa738d[_0x5d39('0x4d')]},'raw':!![]})['then'](function(_0x4ff9f9){if(_0x4ff9f9&&_0x4ff9f9['autoAssociation']===0x0){return db[_0x5d39('0x25')]['create']({'name':_0x47a8cf[_0x5d39('0x28')],'resourceId':_0x47a8cf['id'],'type':_0x4ff9f9['name'],'sectionId':_0x4ff9f9['id']},{})['then'](function(){return _0x33e414;});}else{return _0x33e414;}})[_0x5d39('0x47')](function(_0x3860a6){logger[_0x5d39('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3860a6);throw _0x3860a6;});}return _0x33e414;})[_0x5d39('0x22')](respondWithResult(_0x8854d5,0xc9))['catch'](handleError(_0x8854d5,null));};exports[_0x5d39('0x20')]=function(_0x1363cf,_0x3d3443){if(_0x1363cf[_0x5d39('0x49')]['id']){delete _0x1363cf['body']['id'];}return db['FaxQueue'][_0x5d39('0x46')]({'where':{'id':_0x1363cf[_0x5d39('0x45')]['id']}})[_0x5d39('0x22')](handleEntityNotFound(_0x3d3443,null))[_0x5d39('0x22')](saveUpdates(_0x1363cf[_0x5d39('0x49')],null))['then'](respondWithResult(_0x3d3443,null))['catch'](handleError(_0x3d3443,null));};exports['destroy']=function(_0x3e19a2,_0x47bd8a){return db['FaxQueue'][_0x5d39('0x46')]({'where':{'id':_0x3e19a2['params']['id']}})['then'](handleEntityNotFound(_0x47bd8a,null))[_0x5d39('0x22')](removeEntity(_0x47bd8a,null))[_0x5d39('0x47')](handleError(_0x47bd8a,null));};exports[_0x5d39('0x4e')]=function(_0x113f07,_0x1df426){return db[_0x5d39('0x2a')][_0x5d39('0x4e')]()[_0x5d39('0x22')](respondWithResult(_0x1df426,null))[_0x5d39('0x47')](handleError(_0x1df426,null));};exports[_0x5d39('0x4f')]=function(_0x367bce,_0xb2c288,_0x351102){var _0x1f6cf6={'raw':!![],'where':{}},_0x265b88={},_0x1017fd;return db[_0x5d39('0x2a')][_0x5d39('0x50')]({'where':{'id':_0x367bce['params']['id']}})[_0x5d39('0x22')](handleEntityNotFound(_0xb2c288,null))[_0x5d39('0x22')](function(_0x54cca8){if(_0x54cca8){_0x1017fd=_0x54cca8['get']({'plain':!![]});_0x265b88[_0x5d39('0x2c')]=_['keys'](db[_0x5d39('0x51')][_0x5d39('0x2b')]);_0x265b88[_0x5d39('0x2e')]=_[_0x5d39('0x2d')](_0x367bce['query']);_0x265b88[_0x5d39('0x31')]=_['intersection'](_0x265b88[_0x5d39('0x2c')],_0x265b88[_0x5d39('0x2e')]);_0x1f6cf6[_0x5d39('0x33')]=_['intersection'](_0x265b88['model'],qs[_0x5d39('0x34')](_0x367bce[_0x5d39('0x2e')][_0x5d39('0x34')]));_0x1f6cf6['attributes']=_0x1f6cf6[_0x5d39('0x33')][_0x5d39('0x35')]?_0x1f6cf6[_0x5d39('0x33')]:_0x265b88[_0x5d39('0x2c')];if(!_0x367bce['query'][_0x5d39('0x52')](_0x5d39('0x53'))){_0x1f6cf6[_0x5d39('0x1c')]=qs['limit'](_0x367bce['query'][_0x5d39('0x1c')]);_0x1f6cf6['offset']=qs['offset'](_0x367bce[_0x5d39('0x2e')]['offset']);}_0x1f6cf6[_0x5d39('0x37')]=qs[_0x5d39('0x38')](_0x367bce['query']['sort']);_0x1f6cf6[_0x5d39('0x39')]=qs['filters'](_['pick'](_0x367bce[_0x5d39('0x2e')],_0x265b88[_0x5d39('0x31')]));_0x1f6cf6['where']['FaxQueueId']=_0x54cca8['id'];if(_0x367bce[_0x5d39('0x2e')][_0x5d39('0x3d')]){_0x1f6cf6[_0x5d39('0x39')]=_[_0x5d39('0x3c')](_0x1f6cf6[_0x5d39('0x39')],{'$or':_[_0x5d39('0x3e')](_0x1f6cf6[_0x5d39('0x33')],function(_0x4d4fef){var _0x53bec8={};_0x53bec8[_0x4d4fef]={'$like':'%'+_0x367bce[_0x5d39('0x2e')]['filter']+'%'};return _0x53bec8;})});}_0x1f6cf6=_[_0x5d39('0x3c')]({},_0x1f6cf6,_0x367bce[_0x5d39('0x3f')]);return db[_0x5d39('0x51')][_0x5d39('0x42')](_0x1f6cf6);}})[_0x5d39('0x22')](function(_0x2aa3ee){if(_0x2aa3ee){return db[_0x5d39('0x54')][_0x5d39('0x55')]({'where':{'id':_[_0x5d39('0x3e')](_0x2aa3ee,_0x5d39('0x56')),'role':_0x5d39('0x57')},'attributes':['id',_0x5d39('0x28'),'faxPause','updatedAt',_0x5d39('0x58')]});}})[_0x5d39('0x22')](function(_0x1a34a8){if(_0x1a34a8){return{'count':_0x1a34a8[_0x5d39('0x1b')],'rows':_[_0x5d39('0x3e')](_0x1a34a8[_0x5d39('0x43')],function(_0x51d85c){return{'membername':_0x51d85c[_0x5d39('0x28')],'UserId':_0x51d85c['id'],'queue_name':_0x1017fd[_0x5d39('0x28')],'FaxQueueId':_0x1017fd['id'],'interface':util['format'](_0x5d39('0x59'),'SIP',_0x51d85c[_0x5d39('0x28')]),'penalty':0x0,'paused':_0x51d85c[_0x5d39('0x5a')],'createdAt':_0x51d85c[_0x5d39('0x58')],'updatedAt':_0x51d85c[_0x5d39('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5d39('0x22')](respondWithFilteredResult(_0xb2c288,_0x1f6cf6))[_0x5d39('0x47')](handleError(_0xb2c288,null));};exports[_0x5d39('0x5c')]=function(_0x53b522,_0x49aef8,_0x59c444){var _0x290110={};var _0x23f967={};var _0x4ab6f4;var _0x1e3459;return db[_0x5d39('0x2a')]['findOne']({'where':{'id':_0x53b522[_0x5d39('0x45')]['id']}})['then'](handleEntityNotFound(_0x49aef8,null))[_0x5d39('0x22')](function(_0x357b96){if(_0x357b96){_0x4ab6f4=_0x357b96;_0x23f967[_0x5d39('0x2c')]=_[_0x5d39('0x2d')](db[_0x5d39('0x5d')][_0x5d39('0x2b')]);_0x23f967['query']=_[_0x5d39('0x2d')](_0x53b522['query']);_0x23f967[_0x5d39('0x31')]=_['intersection'](_0x23f967[_0x5d39('0x2c')],_0x23f967[_0x5d39('0x2e')]);_0x290110[_0x5d39('0x33')]=_[_0x5d39('0x32')](_0x23f967[_0x5d39('0x2c')],qs[_0x5d39('0x34')](_0x53b522[_0x5d39('0x2e')][_0x5d39('0x34')]));_0x290110[_0x5d39('0x33')]=_0x290110[_0x5d39('0x33')]['length']?_0x290110[_0x5d39('0x33')]:_0x23f967[_0x5d39('0x2c')];_0x290110['order']=qs[_0x5d39('0x38')](_0x53b522[_0x5d39('0x2e')][_0x5d39('0x38')]);_0x290110[_0x5d39('0x39')]=qs['filters'](_[_0x5d39('0x5e')](_0x53b522[_0x5d39('0x2e')],_0x23f967['filters']));if(_0x53b522['query'][_0x5d39('0x3d')]){_0x290110['where']=_['merge'](_0x290110['where'],{'$or':_['map'](_0x290110[_0x5d39('0x33')],function(_0x47379d){var _0x1f0395={};_0x1f0395[_0x47379d]={'$like':'%'+_0x53b522[_0x5d39('0x2e')][_0x5d39('0x3d')]+'%'};return _0x1f0395;})});}_0x290110=_[_0x5d39('0x3c')]({},_0x290110,_0x53b522[_0x5d39('0x3f')]);return _0x4ab6f4[_0x5d39('0x5c')](_0x290110);}})[_0x5d39('0x22')](function(_0x3490c6){if(_0x3490c6){_0x1e3459=_0x3490c6['length'];if(!_0x53b522[_0x5d39('0x2e')][_0x5d39('0x52')]('nolimit')){_0x290110[_0x5d39('0x1c')]=qs['limit'](_0x53b522[_0x5d39('0x2e')][_0x5d39('0x1c')]);_0x290110['offset']=qs['offset'](_0x53b522['query'][_0x5d39('0x36')]);}return _0x4ab6f4[_0x5d39('0x5c')](_0x290110);}})[_0x5d39('0x22')](function(_0x4b1190){if(_0x4b1190){return _0x4b1190?{'count':_0x1e3459,'rows':_0x4b1190}:null;}})[_0x5d39('0x22')](respondWithResult(_0x49aef8,null))[_0x5d39('0x47')](handleError(_0x49aef8,null));};exports[_0x5d39('0x5f')]=function(_0x4ee4a7,_0x1a0142,_0x4f7143){var _0x1b8b98=[];var _0x48a2fa;return db[_0x5d39('0x5d')][_0x5d39('0x42')]({'where':{'id':_0x4ee4a7['body']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5d39('0x60'),'attributes':['id'],'raw':!![]}]})[_0x5d39('0x22')](function(_0x25a41e){if(_0x25a41e){for(var _0x8af5de=0x0;_0x8af5de<_0x25a41e[_0x5d39('0x35')];_0x8af5de+=0x1){for(var _0x2f386c=0x0;_0x2f386c<_0x25a41e[_0x8af5de]['Agents']['length'];_0x2f386c+=0x1){_0x1b8b98=_[_0x5d39('0x61')](_0x1b8b98,[_0x25a41e[_0x8af5de][_0x5d39('0x60')][_0x2f386c]['id']]);}}return _0x1b8b98;}})[_0x5d39('0x22')](function(_0x4ee7cf){if(_0x4ee7cf){return db['FaxQueue'][_0x5d39('0x46')]({'where':{'id':_0x4ee4a7[_0x5d39('0x45')]['id']}});}})[_0x5d39('0x22')](function(_0x3de766){if(_0x3de766){_0x48a2fa=_0x3de766;return _0x48a2fa[_0x5d39('0x62')](_0x1b8b98,{'penalty':_0x4ee4a7['body'][_0x5d39('0x63')]});}})[_0x5d39('0x22')](function(_0x22cd9f){if(_0x22cd9f){return _0x48a2fa['addTeams'](_0x4ee4a7['body'][_0x5d39('0x64')]);}})[_0x5d39('0x22')](handleEntityNotFound(_0x1a0142,null))[_0x5d39('0x22')](respondWithStatusCode(_0x1a0142,null))[_0x5d39('0x47')](handleError(_0x1a0142,null));};exports[_0x5d39('0x65')]=function(_0x376073,_0x1b69e7,_0x433835){var _0x3db3a4=[];var _0x4a66b1;return db[_0x5d39('0x5d')][_0x5d39('0x42')]({'where':{'id':_0x376073['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5d39('0x22')](function(_0xf8e454){if(_0xf8e454){for(var _0x3166f4=0x0;_0x3166f4<_0xf8e454[_0x5d39('0x35')];_0x3166f4+=0x1){for(var _0x4aa322=0x0;_0x4aa322<_0xf8e454[_0x3166f4][_0x5d39('0x60')][_0x5d39('0x35')];_0x4aa322+=0x1){_0x3db3a4=_['union'](_0x3db3a4,[_0xf8e454[_0x3166f4][_0x5d39('0x60')][_0x4aa322]['id']]);}}return _0x3db3a4;}})[_0x5d39('0x22')](function(_0x363d93){if(_0x363d93){return db[_0x5d39('0x2a')][_0x5d39('0x46')]({'where':{'id':_0x376073['params']['id']}});}})[_0x5d39('0x22')](function(_0x5e6a14){if(_0x5e6a14){_0x4a66b1=_0x5e6a14;return _0x4a66b1['removeAgents'](_0x3db3a4);}})['then'](function(_0x13f457){if(_0x4a66b1){return _0x4a66b1[_0x5d39('0x65')](_0x376073['query']['ids']);}})[_0x5d39('0x22')](handleEntityNotFound(_0x1b69e7,null))[_0x5d39('0x22')](respondWithStatusCode(_0x1b69e7,null))[_0x5d39('0x47')](handleError(_0x1b69e7,null));};exports[_0x5d39('0x62')]=function(_0x33311e,_0x582558,_0x1319db){return db[_0x5d39('0x2a')][_0x5d39('0x46')]({'where':{'id':_0x33311e[_0x5d39('0x45')]['id']}})['then'](handleEntityNotFound(_0x582558,null))['then'](function(_0x295af4){if(_0x295af4){return _0x295af4[_0x5d39('0x62')](_0x33311e[_0x5d39('0x49')][_0x5d39('0x64')],_['omit'](_0x33311e[_0x5d39('0x49')],[_0x5d39('0x64'),'id'])||{})[_0x5d39('0x66')](function(_0x34d0f5){for(var _0x56ce86=0x0;_0x56ce86<_0x33311e[_0x5d39('0x49')][_0x5d39('0x64')]['length'];_0x56ce86+=0x1){socket[_0x5d39('0x67')](_0x5d39('0x68'),{'UserId':_0x33311e[_0x5d39('0x49')]['ids'][_0x56ce86],'FaxQueueId':_0x33311e['params']['id']});}return _0x34d0f5;});}})[_0x5d39('0x22')](respondWithResult(_0x582558,null))[_0x5d39('0x47')](handleError(_0x582558,null));};exports[_0x5d39('0x69')]=function(_0x24dff6,_0x1e55e8,_0x278a7c){var _0x289698;return db[_0x5d39('0x2a')][_0x5d39('0x46')]({'where':{'id':_0x24dff6[_0x5d39('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e55e8,null))['then'](function(_0x3a0341){if(_0x3a0341){return _0x3a0341[_0x5d39('0x69')](_0x24dff6[_0x5d39('0x2e')][_0x5d39('0x64')])[_0x5d39('0x22')](function(_0x24dce1){if(_[_0x5d39('0x6a')](_0x24dff6[_0x5d39('0x2e')]['ids'])){for(var _0x30e068=0x0;_0x30e068<_0x24dff6[_0x5d39('0x2e')][_0x5d39('0x64')][_0x5d39('0x35')];_0x30e068+=0x1){socket[_0x5d39('0x67')]('userFaxQueue:remove',{'UserId':_0x24dff6[_0x5d39('0x2e')]['ids'][_0x30e068],'FaxQueueId':_0x24dff6[_0x5d39('0x45')]['id']});}}else{socket['emit'](_0x5d39('0x6b'),{'UserId':_0x24dff6['query'][_0x5d39('0x64')],'FaxQueueId':_0x24dff6[_0x5d39('0x45')]['id']});}});}})[_0x5d39('0x22')](respondWithStatusCode(_0x1e55e8,null))[_0x5d39('0x47')](handleError(_0x1e55e8,null));};exports[_0x5d39('0x6c')]=function(_0x7b7151,_0x13eb9b,_0x50cc40){var _0x57b14b={};var _0x39b5f2={};var _0x285d9d;var _0x574cc9;return db[_0x5d39('0x2a')][_0x5d39('0x50')]({'where':{'id':_0x7b7151[_0x5d39('0x45')]['id']}})['then'](handleEntityNotFound(_0x13eb9b,null))['then'](function(_0x5f476f){if(_0x5f476f){_0x285d9d=_0x5f476f;_0x39b5f2['model']=_[_0x5d39('0x2d')](db[_0x5d39('0x54')][_0x5d39('0x2b')]);_0x39b5f2[_0x5d39('0x2e')]=_['keys'](_0x7b7151['query']);_0x39b5f2['filters']=_[_0x5d39('0x32')](_0x39b5f2[_0x5d39('0x2c')],_0x39b5f2[_0x5d39('0x2e')]);_0x57b14b[_0x5d39('0x33')]=_[_0x5d39('0x32')](_0x39b5f2[_0x5d39('0x2c')],qs[_0x5d39('0x34')](_0x7b7151[_0x5d39('0x2e')][_0x5d39('0x34')]));_0x57b14b['attributes']=_0x57b14b[_0x5d39('0x33')][_0x5d39('0x35')]?_0x57b14b[_0x5d39('0x33')]:_0x39b5f2[_0x5d39('0x2c')];_0x57b14b['order']=qs[_0x5d39('0x38')](_0x7b7151[_0x5d39('0x2e')][_0x5d39('0x38')]);_0x57b14b[_0x5d39('0x39')]=qs[_0x5d39('0x31')](_[_0x5d39('0x5e')](_0x7b7151[_0x5d39('0x2e')],_0x39b5f2['filters']));if(_0x7b7151[_0x5d39('0x2e')]['filter']){_0x57b14b[_0x5d39('0x39')]=_[_0x5d39('0x3c')](_0x57b14b['where'],{'$or':_[_0x5d39('0x3e')](_0x57b14b[_0x5d39('0x33')],function(_0x2ab69c){var _0x124d0b={};_0x124d0b[_0x2ab69c]={'$like':'%'+_0x7b7151['query'][_0x5d39('0x3d')]+'%'};return _0x124d0b;})});}_0x57b14b=_[_0x5d39('0x3c')]({},_0x57b14b,_0x7b7151[_0x5d39('0x3f')]);return _0x285d9d[_0x5d39('0x6c')](_0x57b14b);}})[_0x5d39('0x22')](function(_0x122078){if(_0x122078){_0x574cc9=_0x122078[_0x5d39('0x35')];if(!_0x7b7151['query'][_0x5d39('0x52')]('nolimit')){_0x57b14b[_0x5d39('0x1c')]=qs[_0x5d39('0x1c')](_0x7b7151[_0x5d39('0x2e')]['limit']);_0x57b14b[_0x5d39('0x36')]=qs['offset'](_0x7b7151[_0x5d39('0x2e')][_0x5d39('0x36')]);}return _0x285d9d[_0x5d39('0x6c')](_0x57b14b);}})[_0x5d39('0x22')](function(_0x4f9444){if(_0x4f9444){return _0x4f9444?{'count':_0x574cc9,'rows':_0x4f9444}:null;}})[_0x5d39('0x22')](respondWithResult(_0x13eb9b,null))[_0x5d39('0x47')](handleError(_0x13eb9b,null));}; \ No newline at end of file +var _0x646b=['penalty','removeTeams','removeAgents','omit','spread','userFaxQueue:save','emit','userFaxQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','end','error','stack','name','send','rawAttributes','query','dateEnd','dateStart','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','day','merge','filter','FaxQueue','includeAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','FaxQueueId','options','UserFaxQueue','findAll','User','findAndCountAll','map','UserId','agent','faxPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','union','addAgents'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x646b,0x76));var _0xb646=function(_0x1c5385,_0x3aba1a){_0x1c5385=_0x1c5385-0x0;var _0x478ddb=_0x646b[_0x1c5385];return _0x478ddb;};'use strict';var pdf=require(_0xb646('0x0'));var emlformat=require(_0xb646('0x1'));var rimraf=require(_0xb646('0x2'));var zipdir=require(_0xb646('0x3'));var jsonpatch=require(_0xb646('0x4'));var rp=require('request-promise');var moment=require(_0xb646('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb646('0x6'));var path=require(_0xb646('0x7'));var sox=require('sox');var csv=require(_0xb646('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb646('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb646('0xa'));var toCsv=require(_0xb646('0x8'));var querystring=require('querystring');var Papa=require(_0xb646('0xb'));var Redis=require(_0xb646('0xc'));var qs=require(_0xb646('0xd'));var logger=require(_0xb646('0xe'))(_0xb646('0xf'));var utils=require(_0xb646('0x10'));var config=require(_0xb646('0x11'));var db=require('../../mysqldb')['db'];config[_0xb646('0x12')]=_[_0xb646('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb646('0x14'))(new Redis(config['redis']));require(_0xb646('0x15'))['register'](socket);function respondWithStatusCode(_0x4aa253,_0x947351){_0x947351=_0x947351||0xcc;return function(_0x1e83d6){if(_0x1e83d6){return _0x4aa253[_0xb646('0x16')](_0x947351);}return _0x4aa253[_0xb646('0x17')](_0x947351)['end']();};}function respondWithResult(_0xf20bfd,_0x25f4f4){_0x25f4f4=_0x25f4f4||0xc8;return function(_0xfb17b6){if(_0xfb17b6){return _0xf20bfd['status'](_0x25f4f4)[_0xb646('0x18')](_0xfb17b6);}};}function respondWithFilteredResult(_0x386e5c,_0x36d647){return function(_0x5baa5f){if(_0x5baa5f){var _0x5a4192=_0x5baa5f[_0xb646('0x19')],_0x36089b=_0x36d647[_0xb646('0x1a')],_0x346fbf=_0x36d647[_0xb646('0x1a')]+_0x36d647['limit'],_0xa9f694;if(_0x346fbf>=_0x5a4192){_0x346fbf=_0x5a4192;_0xa9f694=0xc8;}else{_0xa9f694=0xce;}_0x386e5c['status'](_0xa9f694);return _0x386e5c[_0xb646('0x1b')](_0xb646('0x1c'),_0x36089b+'-'+_0x346fbf+'/'+_0x5a4192)['json'](_0x5baa5f);}return null;};}function patchUpdates(_0x33c1d6){return function(_0x183e57){try{jsonpatch['apply'](_0x183e57,_0x33c1d6,!![]);}catch(_0x34d1dc){return BPromise[_0xb646('0x1d')](_0x34d1dc);}return _0x183e57[_0xb646('0x1e')]();};}function saveUpdates(_0x1c56fd,_0x5d3209){return function(_0x2d0f37){if(_0x2d0f37){return _0x2d0f37[_0xb646('0x1f')](_0x1c56fd)[_0xb646('0x20')](function(_0x46955c){return _0x46955c;});}return null;};}function removeEntity(_0x429a65,_0x1e02d2){return function(_0xb62ba){if(_0xb62ba){return _0xb62ba['destroy']()[_0xb646('0x20')](function(){var _0x1b19e8=_0xb62ba[_0xb646('0x21')]({'plain':!![]});var _0xa4e700=_0xb646('0x22');return db[_0xb646('0x23')][_0xb646('0x24')]({'where':{'type':_0xa4e700,'resourceId':_0x1b19e8['id']}})[_0xb646('0x20')](function(){return _0xb62ba;});})['then'](function(){_0x429a65[_0xb646('0x17')](0xcc)[_0xb646('0x25')]();});}};}function handleEntityNotFound(_0x338ff5,_0x411a47){return function(_0x5edac0){if(!_0x5edac0){_0x338ff5[_0xb646('0x16')](0x194);}return _0x5edac0;};}function handleError(_0x5ed778,_0x3c1916){_0x3c1916=_0x3c1916||0x1f4;return function(_0x58811f){logger[_0xb646('0x26')](_0x58811f[_0xb646('0x27')]);if(_0x58811f[_0xb646('0x28')]){delete _0x58811f[_0xb646('0x28')];}_0x5ed778[_0xb646('0x17')](_0x3c1916)[_0xb646('0x29')](_0x58811f);};}exports['index']=function(_0x25476b,_0x1e6f83){var _0x1c0889={},_0x184915={},_0x24c0d1={'count':0x0,'rows':[]};var _0x280272=db['FaxQueue'][_0xb646('0x2a')];_0x184915['model']=_['keys'](_0x280272);var _0x1a8cbd={'dateStart':_0x25476b[_0xb646('0x2b')]['dateStart'],'dateEnd':_0x25476b[_0xb646('0x2b')][_0xb646('0x2c')]};delete _0x25476b[_0xb646('0x2b')][_0xb646('0x2d')];delete _0x25476b[_0xb646('0x2b')][_0xb646('0x2c')];_0x184915[_0xb646('0x2b')]=_[_0xb646('0x2e')](_0x25476b['query']);_0x184915[_0xb646('0x2f')]=_[_0xb646('0x30')](_0x184915[_0xb646('0x31')],_0x184915[_0xb646('0x2b')]);_0x1c0889[_0xb646('0x32')]=_[_0xb646('0x30')](_0x184915[_0xb646('0x31')],qs[_0xb646('0x33')](_0x25476b['query']['fields']));_0x1c0889[_0xb646('0x32')]=_0x1c0889[_0xb646('0x32')][_0xb646('0x34')]?_0x1c0889[_0xb646('0x32')]:_0x184915[_0xb646('0x31')];if(!_0x25476b[_0xb646('0x2b')][_0xb646('0x35')](_0xb646('0x36'))){_0x1c0889[_0xb646('0x37')]=qs['limit'](_0x25476b[_0xb646('0x2b')][_0xb646('0x37')]);_0x1c0889[_0xb646('0x1a')]=qs[_0xb646('0x1a')](_0x25476b['query'][_0xb646('0x1a')]);}_0x1c0889[_0xb646('0x38')]=qs[_0xb646('0x39')](_0x25476b['query']['sort']);_0x1c0889[_0xb646('0x3a')]=qs['filters'](_[_0xb646('0x3b')](_0x25476b[_0xb646('0x2b')],_0x184915['filters']));if(_0x1a8cbd[_0xb646('0x2d')]){if(_0x1a8cbd[_0xb646('0x2c')]){_0x1a8cbd[_0xb646('0x2c')]=moment(_0x1a8cbd[_0xb646('0x2c')])['add'](0x1,_0xb646('0x3c'));}else{_0x1a8cbd[_0xb646('0x2c')]=moment(_0x1a8cbd[_0xb646('0x2d')])['add'](0x1,_0xb646('0x3c'));}_[_0xb646('0x3d')](_0x1c0889[_0xb646('0x3a')],{'createdAt':{'$gte':_0x1a8cbd['dateStart'],'$lte':_0x1a8cbd[_0xb646('0x2c')]}});}if(_0x25476b[_0xb646('0x2b')][_0xb646('0x3e')]){_0x1c0889[_0xb646('0x3a')]=_['merge'](_0x1c0889[_0xb646('0x3a')],{'$or':_['map'](_0x1c0889[_0xb646('0x32')],function(_0x348c91){var _0x4f3652={};_0x4f3652[_0x348c91]={'$like':'%'+_0x25476b['query'][_0xb646('0x3e')]+'%'};return _0x4f3652;})});}_0x1c0889=_[_0xb646('0x3d')]({},_0x1c0889,_0x25476b['options']);var _0x3f458b={'where':_0x1c0889[_0xb646('0x3a')]};return db[_0xb646('0x3f')]['count'](_0x3f458b)[_0xb646('0x20')](function(_0x4c3732){_0x24c0d1[_0xb646('0x19')]=_0x4c3732;if(_0x25476b['query'][_0xb646('0x40')]){_0x1c0889['include']=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x1c0889);})[_0xb646('0x20')](function(_0x43c2a1){_0x24c0d1[_0xb646('0x41')]=_0x43c2a1;return _0x24c0d1;})[_0xb646('0x20')](respondWithFilteredResult(_0x1e6f83,_0x1c0889))[_0xb646('0x42')](handleError(_0x1e6f83,null));};exports[_0xb646('0x43')]=function(_0x2c15b0,_0x1143ef){var _0x25cb58={'raw':!![],'where':{'id':_0x2c15b0[_0xb646('0x44')]['id']}},_0x4c34cd={};_0x4c34cd['model']=_[_0xb646('0x2e')](db['FaxQueue'][_0xb646('0x2a')]);_0x4c34cd[_0xb646('0x2b')]=_[_0xb646('0x2e')](_0x2c15b0[_0xb646('0x2b')]);_0x4c34cd['filters']=_['intersection'](_0x4c34cd[_0xb646('0x31')],_0x4c34cd[_0xb646('0x2b')]);_0x25cb58[_0xb646('0x32')]=_[_0xb646('0x30')](_0x4c34cd[_0xb646('0x31')],qs['fields'](_0x2c15b0[_0xb646('0x2b')]['fields']));_0x25cb58[_0xb646('0x32')]=_0x25cb58[_0xb646('0x32')][_0xb646('0x34')]?_0x25cb58['attributes']:_0x4c34cd[_0xb646('0x31')];if(_0x2c15b0[_0xb646('0x2b')][_0xb646('0x40')]){_0x25cb58[_0xb646('0x45')]=[{'all':!![]}];}_0x25cb58=_['merge']({},_0x25cb58,_0x2c15b0['options']);return db[_0xb646('0x3f')][_0xb646('0x46')](_0x25cb58)['then'](handleEntityNotFound(_0x1143ef,null))[_0xb646('0x20')](respondWithResult(_0x1143ef,null))[_0xb646('0x42')](handleError(_0x1143ef,null));};exports[_0xb646('0x47')]=function(_0x3a6106,_0x4d57ec){return db['FaxQueue'][_0xb646('0x47')](_0x3a6106['body'],{})['then'](function(_0x315510){var _0x155cb4=_0x3a6106[_0xb646('0x48')][_0xb646('0x21')]({'plain':!![]});if(!_0x155cb4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x155cb4['role']==='user'){var _0x1d826a=_0x315510['get']({'plain':!![]});var _0x2172b0=_0xb646('0x22');return db['UserProfileSection'][_0xb646('0x46')]({'where':{'name':_0x2172b0,'userProfileId':_0x155cb4['userProfileId']},'raw':!![]})[_0xb646('0x20')](function(_0x1bc6a2){if(_0x1bc6a2&&_0x1bc6a2['autoAssociation']===0x0){return db[_0xb646('0x23')][_0xb646('0x47')]({'name':_0x1d826a[_0xb646('0x28')],'resourceId':_0x1d826a['id'],'type':_0x1bc6a2['name'],'sectionId':_0x1bc6a2['id']},{})[_0xb646('0x20')](function(){return _0x315510;});}else{return _0x315510;}})['catch'](function(_0xe1a3a3){logger['error'](_0xb646('0x49'),_0xe1a3a3);throw _0xe1a3a3;});}return _0x315510;})[_0xb646('0x20')](respondWithResult(_0x4d57ec,0xc9))['catch'](handleError(_0x4d57ec,null));};exports[_0xb646('0x1f')]=function(_0x1c6fb3,_0x39eafd){if(_0x1c6fb3[_0xb646('0x4a')]['id']){delete _0x1c6fb3[_0xb646('0x4a')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x1c6fb3['params']['id']}})['then'](handleEntityNotFound(_0x39eafd,null))[_0xb646('0x20')](saveUpdates(_0x1c6fb3[_0xb646('0x4a')],null))['then'](respondWithResult(_0x39eafd,null))['catch'](handleError(_0x39eafd,null));};exports[_0xb646('0x24')]=function(_0x13680b,_0x5ca443){return db['FaxQueue'][_0xb646('0x46')]({'where':{'id':_0x13680b[_0xb646('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ca443,null))['then'](removeEntity(_0x5ca443,null))['catch'](handleError(_0x5ca443,null));};exports['describe']=function(_0xe12d80,_0x37409e){return db[_0xb646('0x3f')][_0xb646('0x4b')]()[_0xb646('0x20')](respondWithResult(_0x37409e,null))[_0xb646('0x42')](handleError(_0x37409e,null));};exports[_0xb646('0x4c')]=function(_0x3b9212,_0x4e58aa,_0x50f4c8){var _0x2610c4={'raw':!![],'where':{}},_0x3aafdb={},_0x30363b;return db[_0xb646('0x3f')][_0xb646('0x4d')]({'where':{'id':_0x3b9212[_0xb646('0x44')]['id']}})[_0xb646('0x20')](handleEntityNotFound(_0x4e58aa,null))['then'](function(_0x4bbde0){if(_0x4bbde0){_0x30363b=_0x4bbde0[_0xb646('0x21')]({'plain':!![]});_0x3aafdb[_0xb646('0x31')]=_['keys'](db['UserFaxQueue'][_0xb646('0x2a')]);_0x3aafdb['query']=_[_0xb646('0x2e')](_0x3b9212[_0xb646('0x2b')]);_0x3aafdb[_0xb646('0x2f')]=_[_0xb646('0x30')](_0x3aafdb[_0xb646('0x31')],_0x3aafdb[_0xb646('0x2b')]);_0x2610c4[_0xb646('0x32')]=_[_0xb646('0x30')](_0x3aafdb[_0xb646('0x31')],qs[_0xb646('0x33')](_0x3b9212['query']['fields']));_0x2610c4['attributes']=_0x2610c4[_0xb646('0x32')][_0xb646('0x34')]?_0x2610c4[_0xb646('0x32')]:_0x3aafdb[_0xb646('0x31')];if(!_0x3b9212[_0xb646('0x2b')][_0xb646('0x35')]('nolimit')){_0x2610c4['limit']=qs[_0xb646('0x37')](_0x3b9212[_0xb646('0x2b')][_0xb646('0x37')]);_0x2610c4['offset']=qs['offset'](_0x3b9212[_0xb646('0x2b')][_0xb646('0x1a')]);}_0x2610c4[_0xb646('0x38')]=qs[_0xb646('0x39')](_0x3b9212['query'][_0xb646('0x39')]);_0x2610c4[_0xb646('0x3a')]=qs[_0xb646('0x2f')](_[_0xb646('0x3b')](_0x3b9212[_0xb646('0x2b')],_0x3aafdb[_0xb646('0x2f')]));_0x2610c4['where'][_0xb646('0x4e')]=_0x4bbde0['id'];if(_0x3b9212[_0xb646('0x2b')][_0xb646('0x3e')]){_0x2610c4[_0xb646('0x3a')]=_['merge'](_0x2610c4[_0xb646('0x3a')],{'$or':_['map'](_0x2610c4[_0xb646('0x32')],function(_0x5134c1){var _0x29f153={};_0x29f153[_0x5134c1]={'$like':'%'+_0x3b9212[_0xb646('0x2b')]['filter']+'%'};return _0x29f153;})});}_0x2610c4=_[_0xb646('0x3d')]({},_0x2610c4,_0x3b9212[_0xb646('0x4f')]);return db[_0xb646('0x50')][_0xb646('0x51')](_0x2610c4);}})[_0xb646('0x20')](function(_0x1888a7){if(_0x1888a7){return db[_0xb646('0x52')][_0xb646('0x53')]({'where':{'id':_[_0xb646('0x54')](_0x1888a7,_0xb646('0x55')),'role':_0xb646('0x56')},'attributes':['id','name',_0xb646('0x57'),'updatedAt','createdAt']});}})[_0xb646('0x20')](function(_0x1f9c72){if(_0x1f9c72){return{'count':_0x1f9c72['count'],'rows':_[_0xb646('0x54')](_0x1f9c72[_0xb646('0x41')],function(_0x131406){return{'membername':_0x131406['name'],'UserId':_0x131406['id'],'queue_name':_0x30363b[_0xb646('0x28')],'FaxQueueId':_0x30363b['id'],'interface':util[_0xb646('0x58')](_0xb646('0x59'),_0xb646('0x5a'),_0x131406['name']),'penalty':0x0,'paused':_0x131406[_0xb646('0x57')],'createdAt':_0x131406[_0xb646('0x5b')],'updatedAt':_0x131406[_0xb646('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4e58aa,_0x2610c4))[_0xb646('0x42')](handleError(_0x4e58aa,null));};exports[_0xb646('0x5d')]=function(_0x27a0dd,_0x10d071,_0xf6fda3){var _0x12fc82={};var _0x3f87e4={};var _0x1ba713;var _0x5172b2;return db[_0xb646('0x3f')][_0xb646('0x4d')]({'where':{'id':_0x27a0dd[_0xb646('0x44')]['id']}})['then'](handleEntityNotFound(_0x10d071,null))[_0xb646('0x20')](function(_0x290884){if(_0x290884){_0x1ba713=_0x290884;_0x3f87e4['model']=_[_0xb646('0x2e')](db[_0xb646('0x5e')][_0xb646('0x2a')]);_0x3f87e4[_0xb646('0x2b')]=_[_0xb646('0x2e')](_0x27a0dd[_0xb646('0x2b')]);_0x3f87e4[_0xb646('0x2f')]=_[_0xb646('0x30')](_0x3f87e4['model'],_0x3f87e4[_0xb646('0x2b')]);_0x12fc82[_0xb646('0x32')]=_[_0xb646('0x30')](_0x3f87e4[_0xb646('0x31')],qs['fields'](_0x27a0dd[_0xb646('0x2b')][_0xb646('0x33')]));_0x12fc82['attributes']=_0x12fc82[_0xb646('0x32')][_0xb646('0x34')]?_0x12fc82['attributes']:_0x3f87e4[_0xb646('0x31')];_0x12fc82[_0xb646('0x38')]=qs[_0xb646('0x39')](_0x27a0dd[_0xb646('0x2b')][_0xb646('0x39')]);_0x12fc82[_0xb646('0x3a')]=qs[_0xb646('0x2f')](_[_0xb646('0x3b')](_0x27a0dd[_0xb646('0x2b')],_0x3f87e4[_0xb646('0x2f')]));if(_0x27a0dd[_0xb646('0x2b')][_0xb646('0x3e')]){_0x12fc82[_0xb646('0x3a')]=_[_0xb646('0x3d')](_0x12fc82[_0xb646('0x3a')],{'$or':_['map'](_0x12fc82[_0xb646('0x32')],function(_0x5651c1){var _0x19d85d={};_0x19d85d[_0x5651c1]={'$like':'%'+_0x27a0dd['query'][_0xb646('0x3e')]+'%'};return _0x19d85d;})});}_0x12fc82=_['merge']({},_0x12fc82,_0x27a0dd['options']);return _0x1ba713['getTeams'](_0x12fc82);}})[_0xb646('0x20')](function(_0x162d99){if(_0x162d99){_0x5172b2=_0x162d99[_0xb646('0x34')];if(!_0x27a0dd['query'][_0xb646('0x35')](_0xb646('0x36'))){_0x12fc82['limit']=qs[_0xb646('0x37')](_0x27a0dd[_0xb646('0x2b')][_0xb646('0x37')]);_0x12fc82[_0xb646('0x1a')]=qs[_0xb646('0x1a')](_0x27a0dd[_0xb646('0x2b')]['offset']);}return _0x1ba713[_0xb646('0x5d')](_0x12fc82);}})[_0xb646('0x20')](function(_0x56ce0b){if(_0x56ce0b){return _0x56ce0b?{'count':_0x5172b2,'rows':_0x56ce0b}:null;}})[_0xb646('0x20')](respondWithResult(_0x10d071,null))[_0xb646('0x42')](handleError(_0x10d071,null));};exports[_0xb646('0x5f')]=function(_0x4ecb2a,_0x3b3974,_0xf6a593){var _0xdbaefd=[];var _0x243f56;return db['Team']['findAll']({'where':{'id':_0x4ecb2a['body'][_0xb646('0x60')]},'attributes':['id'],'include':[{'model':db[_0xb646('0x52')],'as':_0xb646('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb646('0x20')](function(_0x4da4b4){if(_0x4da4b4){for(var _0x4a8fe7=0x0;_0x4a8fe7<_0x4da4b4[_0xb646('0x34')];_0x4a8fe7+=0x1){for(var _0x2cf937=0x0;_0x2cf937<_0x4da4b4[_0x4a8fe7]['Agents'][_0xb646('0x34')];_0x2cf937+=0x1){_0xdbaefd=_[_0xb646('0x62')](_0xdbaefd,[_0x4da4b4[_0x4a8fe7][_0xb646('0x61')][_0x2cf937]['id']]);}}return _0xdbaefd;}})[_0xb646('0x20')](function(_0x3bf61e){if(_0x3bf61e){return db['FaxQueue'][_0xb646('0x46')]({'where':{'id':_0x4ecb2a[_0xb646('0x44')]['id']}});}})[_0xb646('0x20')](function(_0x3ae65e){if(_0x3ae65e){_0x243f56=_0x3ae65e;return _0x243f56[_0xb646('0x63')](_0xdbaefd,{'penalty':_0x4ecb2a[_0xb646('0x4a')][_0xb646('0x64')]});}})[_0xb646('0x20')](function(_0x2d59a1){if(_0x2d59a1){return _0x243f56[_0xb646('0x5f')](_0x4ecb2a[_0xb646('0x4a')]['ids']);}})['then'](handleEntityNotFound(_0x3b3974,null))['then'](respondWithStatusCode(_0x3b3974,null))[_0xb646('0x42')](handleError(_0x3b3974,null));};exports[_0xb646('0x65')]=function(_0x361257,_0x59ce81,_0x570271){var _0x96d20=[];var _0x2a4f27;return db[_0xb646('0x5e')]['findAll']({'where':{'id':_0x361257[_0xb646('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb646('0x52')],'as':_0xb646('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb646('0x20')](function(_0x234728){if(_0x234728){for(var _0x299aae=0x0;_0x299aae<_0x234728[_0xb646('0x34')];_0x299aae+=0x1){for(var _0x500258=0x0;_0x500258<_0x234728[_0x299aae][_0xb646('0x61')][_0xb646('0x34')];_0x500258+=0x1){_0x96d20=_[_0xb646('0x62')](_0x96d20,[_0x234728[_0x299aae][_0xb646('0x61')][_0x500258]['id']]);}}return _0x96d20;}})[_0xb646('0x20')](function(_0x13de81){if(_0x13de81){return db[_0xb646('0x3f')][_0xb646('0x46')]({'where':{'id':_0x361257[_0xb646('0x44')]['id']}});}})[_0xb646('0x20')](function(_0xd4be5){if(_0xd4be5){_0x2a4f27=_0xd4be5;return _0x2a4f27[_0xb646('0x66')](_0x96d20);}})[_0xb646('0x20')](function(_0x5b21fb){if(_0x2a4f27){return _0x2a4f27['removeTeams'](_0x361257[_0xb646('0x2b')][_0xb646('0x60')]);}})[_0xb646('0x20')](handleEntityNotFound(_0x59ce81,null))['then'](respondWithStatusCode(_0x59ce81,null))[_0xb646('0x42')](handleError(_0x59ce81,null));};exports[_0xb646('0x63')]=function(_0x5b43b3,_0x2329e1,_0x3f8cb3){return db[_0xb646('0x3f')][_0xb646('0x46')]({'where':{'id':_0x5b43b3['params']['id']}})[_0xb646('0x20')](handleEntityNotFound(_0x2329e1,null))[_0xb646('0x20')](function(_0x1c865a){if(_0x1c865a){return _0x1c865a['addAgents'](_0x5b43b3['body'][_0xb646('0x60')],_[_0xb646('0x67')](_0x5b43b3[_0xb646('0x4a')],[_0xb646('0x60'),'id'])||{})[_0xb646('0x68')](function(_0x1decbf){for(var _0x4d2ffd=0x0;_0x4d2ffd<_0x5b43b3[_0xb646('0x4a')][_0xb646('0x60')][_0xb646('0x34')];_0x4d2ffd+=0x1){socket['emit'](_0xb646('0x69'),{'UserId':_0x5b43b3[_0xb646('0x4a')][_0xb646('0x60')][_0x4d2ffd],'FaxQueueId':_0x5b43b3[_0xb646('0x44')]['id']});}return _0x1decbf;});}})[_0xb646('0x20')](respondWithResult(_0x2329e1,null))['catch'](handleError(_0x2329e1,null));};exports[_0xb646('0x66')]=function(_0x3910fc,_0xc0b3fd,_0x176394){var _0x122625;return db[_0xb646('0x3f')]['find']({'where':{'id':_0x3910fc['params']['id']}})[_0xb646('0x20')](handleEntityNotFound(_0xc0b3fd,null))['then'](function(_0x3d0574){if(_0x3d0574){return _0x3d0574[_0xb646('0x66')](_0x3910fc[_0xb646('0x2b')][_0xb646('0x60')])[_0xb646('0x20')](function(_0x29f4d8){if(_['isArray'](_0x3910fc[_0xb646('0x2b')][_0xb646('0x60')])){for(var _0x59b3cc=0x0;_0x59b3cc<_0x3910fc[_0xb646('0x2b')][_0xb646('0x60')][_0xb646('0x34')];_0x59b3cc+=0x1){socket[_0xb646('0x6a')](_0xb646('0x6b'),{'UserId':_0x3910fc['query'][_0xb646('0x60')][_0x59b3cc],'FaxQueueId':_0x3910fc[_0xb646('0x44')]['id']});}}else{socket['emit'](_0xb646('0x6b'),{'UserId':_0x3910fc[_0xb646('0x2b')][_0xb646('0x60')],'FaxQueueId':_0x3910fc[_0xb646('0x44')]['id']});}});}})[_0xb646('0x20')](respondWithStatusCode(_0xc0b3fd,null))[_0xb646('0x42')](handleError(_0xc0b3fd,null));};exports[_0xb646('0x6c')]=function(_0x481705,_0xec0b91,_0x52d782){var _0x48d6a3={};var _0x3c4416={};var _0x3e0bcf;var _0x4c1213;return db[_0xb646('0x3f')][_0xb646('0x4d')]({'where':{'id':_0x481705['params']['id']}})[_0xb646('0x20')](handleEntityNotFound(_0xec0b91,null))[_0xb646('0x20')](function(_0x5df44d){if(_0x5df44d){_0x3e0bcf=_0x5df44d;_0x3c4416[_0xb646('0x31')]=_['keys'](db[_0xb646('0x52')][_0xb646('0x2a')]);_0x3c4416['query']=_['keys'](_0x481705['query']);_0x3c4416[_0xb646('0x2f')]=_[_0xb646('0x30')](_0x3c4416['model'],_0x3c4416[_0xb646('0x2b')]);_0x48d6a3[_0xb646('0x32')]=_[_0xb646('0x30')](_0x3c4416[_0xb646('0x31')],qs[_0xb646('0x33')](_0x481705['query'][_0xb646('0x33')]));_0x48d6a3['attributes']=_0x48d6a3['attributes']['length']?_0x48d6a3['attributes']:_0x3c4416[_0xb646('0x31')];_0x48d6a3[_0xb646('0x38')]=qs[_0xb646('0x39')](_0x481705[_0xb646('0x2b')][_0xb646('0x39')]);_0x48d6a3['where']=qs[_0xb646('0x2f')](_[_0xb646('0x3b')](_0x481705['query'],_0x3c4416[_0xb646('0x2f')]));if(_0x481705[_0xb646('0x2b')][_0xb646('0x3e')]){_0x48d6a3['where']=_[_0xb646('0x3d')](_0x48d6a3[_0xb646('0x3a')],{'$or':_[_0xb646('0x54')](_0x48d6a3[_0xb646('0x32')],function(_0x1dbb3a){var _0x278430={};_0x278430[_0x1dbb3a]={'$like':'%'+_0x481705[_0xb646('0x2b')][_0xb646('0x3e')]+'%'};return _0x278430;})});}_0x48d6a3=_[_0xb646('0x3d')]({},_0x48d6a3,_0x481705[_0xb646('0x4f')]);return _0x3e0bcf[_0xb646('0x6c')](_0x48d6a3);}})[_0xb646('0x20')](function(_0x193afa){if(_0x193afa){_0x4c1213=_0x193afa[_0xb646('0x34')];if(!_0x481705[_0xb646('0x2b')][_0xb646('0x35')](_0xb646('0x36'))){_0x48d6a3[_0xb646('0x37')]=qs['limit'](_0x481705['query'][_0xb646('0x37')]);_0x48d6a3[_0xb646('0x1a')]=qs[_0xb646('0x1a')](_0x481705[_0xb646('0x2b')][_0xb646('0x1a')]);}return _0x3e0bcf[_0xb646('0x6c')](_0x48d6a3);}})[_0xb646('0x20')](function(_0x458fb5){if(_0x458fb5){return _0x458fb5?{'count':_0x4c1213,'rows':_0x458fb5}:null;}})[_0xb646('0x20')](respondWithResult(_0xec0b91,null))[_0xb646('0x42')](handleError(_0xec0b91,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 3a7215b..e022427 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 _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','save','update'];(function(_0x39049c,_0x2bfdfb){var _0x34d42e=function(_0x4e33c5){while(--_0x4e33c5){_0x39049c['push'](_0x39049c['shift']());}};_0x34d42e(++_0x2bfdfb);}(_0x54ef,0x112));var _0xf54e=function(_0x3ba46a,_0x22e112){_0x3ba46a=_0x3ba46a-0x0;var _0x3974b0=_0x54ef[_0x3ba46a];return _0x3974b0;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var FaxQueue=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){FaxQueueEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);FaxQueueEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];FaxQueue[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x84ab=['../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','exports','events'];(function(_0x20366a,_0x3e0034){var _0x1e18a0=function(_0x1f763a){while(--_0x1f763a){_0x20366a['push'](_0x20366a['shift']());}};_0x1e18a0(++_0x3e0034);}(_0x84ab,0x12f));var _0xb84a=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x84ab[_0x466af7];return _0x348c96;};'use strict';var EventEmitter=require(_0xb84a('0x0'));var FaxQueue=require(_0xb84a('0x1'))['db'][_0xb84a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb84a('0x3')](0x0);var events={'afterCreate':_0xb84a('0x4'),'afterUpdate':'update','afterDestroy':_0xb84a('0x5')};function emitEvent(_0x18a4a5){return function(_0x47b8e3,_0x9d3a00,_0xe72ccd){FaxQueueEvents[_0xb84a('0x6')](_0x18a4a5+':'+_0x47b8e3['id'],_0x47b8e3);FaxQueueEvents['emit'](_0x18a4a5,_0x47b8e3);_0xe72ccd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xb84a('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 956e5a8..f48f9af 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 _0x0d96=['request-promise','exports','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0d96,0x67));var _0x60d9=function(_0x5cf6e4,_0x3327ef){_0x5cf6e4=_0x5cf6e4-0x0;var _0x29f410=_0x0d96[_0x5cf6e4];return _0x29f410;};'use strict';var _=require(_0x60d9('0x0'));var util=require('util');var logger=require(_0x60d9('0x1'))(_0x60d9('0x2'));var moment=require(_0x60d9('0x3'));var BPromise=require(_0x60d9('0x4'));var rp=require(_0x60d9('0x5'));var attributes=require('./faxQueue.attributes');module[_0x60d9('0x6')]=function(_0x2c9c17,_0x189015){return _0x2c9c17['define'](_0x60d9('0x7'),attributes,{'tableName':_0x60d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb68=['bluebird','request-promise','./faxQueue.attributes','FaxQueue','fax_queues','lodash','../../config/logger','api','moment'];(function(_0x4a627f,_0x3428ae){var _0x154550=function(_0x13a443){while(--_0x13a443){_0x4a627f['push'](_0x4a627f['shift']());}};_0x154550(++_0x3428ae);}(_0xbb68,0x15b));var _0x8bb6=function(_0x3ace2e,_0xfe9333){_0x3ace2e=_0x3ace2e-0x0;var _0x2bfc0e=_0xbb68[_0x3ace2e];return _0x2bfc0e;};'use strict';var _=require(_0x8bb6('0x0'));var util=require('util');var logger=require(_0x8bb6('0x1'))(_0x8bb6('0x2'));var moment=require(_0x8bb6('0x3'));var BPromise=require(_0x8bb6('0x4'));var rp=require(_0x8bb6('0x5'));var attributes=require(_0x8bb6('0x6'));module['exports']=function(_0xf2d5c7,_0x12da5b){return _0xf2d5c7['define'](_0x8bb6('0x7'),attributes,{'tableName':_0x8bb6('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 66bb040..da1bfd5 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 _0xc90f=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','FaxQueue','findAll','options','raw','attributes','limit','map','include','model','then','GetFaxQueue','stringify','find','ShowFaxQueue'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xc90f,0x1a2));var _0xfc90=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xc90f[_0x5834bc];return _0x3e183a;};'use strict';var _=require('lodash');var util=require(_0xfc90('0x0'));var moment=require(_0xfc90('0x1'));var BPromise=require(_0xfc90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc90('0x3'));var db=require(_0xfc90('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc90('0x5'))('rpc');var config=require(_0xfc90('0x6'));var jayson=require(_0xfc90('0x7'));var client=jayson[_0xfc90('0x8')]['http']({'port':0x232a});config[_0xfc90('0x9')]=_[_0xfc90('0xa')](config['redis'],{'host':_0xfc90('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc90('0x9')]));require(_0xfc90('0xc'))[_0xfc90('0xd')](socket);function respondWithRpcPromise(_0x5f3e41,_0x41cbd0,_0xaa534f){return new BPromise(function(_0x3dde14,_0x241177){return client[_0xfc90('0xe')](_0x5f3e41,_0xaa534f)['then'](function(_0x31c852){logger[_0xfc90('0xf')](_0xfc90('0x10'),_0x41cbd0,_0xfc90('0x11'));logger[_0xfc90('0x12')](_0xfc90('0x13'),_0x41cbd0,_0xfc90('0x11'),JSON['stringify'](_0x31c852));if(_0x31c852[_0xfc90('0x14')]){if(_0x31c852[_0xfc90('0x14')]['code']===0x1f4){logger[_0xfc90('0x14')](_0xfc90('0x10'),_0x41cbd0,_0x31c852[_0xfc90('0x14')][_0xfc90('0x15')]);return _0x241177(_0x31c852[_0xfc90('0x14')]['message']);}logger[_0xfc90('0x14')]('FaxQueue,\x20%s,\x20%s',_0x41cbd0,_0x31c852[_0xfc90('0x14')]['message']);return _0x3dde14(_0x31c852[_0xfc90('0x14')][_0xfc90('0x15')]);}else{logger[_0xfc90('0xf')]('FaxQueue,\x20%s,\x20%s',_0x41cbd0,_0xfc90('0x11'));_0x3dde14(_0x31c852[_0xfc90('0x16')]['message']);}})[_0xfc90('0x17')](function(_0x353f7f){logger[_0xfc90('0x14')]('FaxQueue,\x20%s,\x20%s',_0x41cbd0,_0x353f7f);_0x241177(_0x353f7f);});});}exports['GetFaxQueue']=function(_0x206adb){var _0x2021f2=this;return new Promise(function(_0x3009d7,_0x124e33){return db[_0xfc90('0x18')][_0xfc90('0x19')]({'raw':_0x206adb['options']?_0x206adb[_0xfc90('0x1a')][_0xfc90('0x1b')]===undefined?!![]:![]:!![],'where':_0x206adb[_0xfc90('0x1a')]?_0x206adb[_0xfc90('0x1a')]['where']||null:null,'attributes':_0x206adb['options']?_0x206adb[_0xfc90('0x1a')][_0xfc90('0x1c')]||null:null,'limit':_0x206adb[_0xfc90('0x1a')]?_0x206adb[_0xfc90('0x1a')][_0xfc90('0x1d')]||null:null,'include':_0x206adb[_0xfc90('0x1a')]?_0x206adb[_0xfc90('0x1a')]['include']?_[_0xfc90('0x1e')](_0x206adb[_0xfc90('0x1a')][_0xfc90('0x1f')],function(_0x36bd87){return{'model':db[_0x36bd87['model']],'as':_0x36bd87['as'],'attributes':_0x36bd87[_0xfc90('0x1c')],'include':_0x36bd87[_0xfc90('0x1f')]?_[_0xfc90('0x1e')](_0x36bd87[_0xfc90('0x1f')],function(_0x20ca6d){return{'model':db[_0x20ca6d[_0xfc90('0x20')]],'as':_0x20ca6d['as'],'attributes':_0x20ca6d[_0xfc90('0x1c')],'include':_0x20ca6d[_0xfc90('0x1f')]?_[_0xfc90('0x1e')](_0x20ca6d['include'],function(_0x4761c8){return{'model':db[_0x4761c8[_0xfc90('0x20')]],'as':_0x4761c8['as'],'attributes':_0x4761c8[_0xfc90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfc90('0x21')](function(_0x213445){logger[_0xfc90('0xf')](_0xfc90('0x22'),_0x206adb);logger[_0xfc90('0x12')](_0xfc90('0x22'),_0x206adb,JSON[_0xfc90('0x23')](_0x213445));_0x3009d7(_0x213445);})[_0xfc90('0x17')](function(_0x302e8e){logger[_0xfc90('0x14')](_0xfc90('0x22'),_0x302e8e[_0xfc90('0x15')],_0x206adb);_0x124e33(_0x2021f2['error'](0x1f4,_0x302e8e['message']));});});};exports['ShowFaxQueue']=function(_0x2a3b8b){var _0x3f11c6=this;return new Promise(function(_0x32a418,_0x2cb7ae){return db[_0xfc90('0x18')][_0xfc90('0x24')]({'raw':_0x2a3b8b[_0xfc90('0x1a')]?_0x2a3b8b['options'][_0xfc90('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a3b8b[_0xfc90('0x1a')]?_0x2a3b8b[_0xfc90('0x1a')]['where']||null:null,'attributes':_0x2a3b8b['options']?_0x2a3b8b[_0xfc90('0x1a')][_0xfc90('0x1c')]||null:null,'include':_0x2a3b8b[_0xfc90('0x1a')]?_0x2a3b8b[_0xfc90('0x1a')][_0xfc90('0x1f')]?_[_0xfc90('0x1e')](_0x2a3b8b[_0xfc90('0x1a')]['include'],function(_0x32c7cf){return{'model':db[_0x32c7cf['model']],'as':_0x32c7cf['as'],'attributes':_0x32c7cf[_0xfc90('0x1c')],'include':_0x32c7cf[_0xfc90('0x1f')]?_[_0xfc90('0x1e')](_0x32c7cf[_0xfc90('0x1f')],function(_0x4ce999){return{'model':db[_0x4ce999[_0xfc90('0x20')]],'as':_0x4ce999['as'],'attributes':_0x4ce999[_0xfc90('0x1c')],'include':_0x4ce999[_0xfc90('0x1f')]?_[_0xfc90('0x1e')](_0x4ce999[_0xfc90('0x1f')],function(_0x3bc59f){return{'model':db[_0x3bc59f[_0xfc90('0x20')]],'as':_0x3bc59f['as'],'attributes':_0x3bc59f['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc90('0x21')](function(_0x2512c9){logger[_0xfc90('0xf')](_0xfc90('0x25'),_0x2a3b8b);logger[_0xfc90('0x12')]('ShowFaxQueue',_0x2a3b8b,JSON[_0xfc90('0x23')](_0x2512c9));_0x32a418(_0x2512c9);})[_0xfc90('0x17')](function(_0x3b01a7){logger[_0xfc90('0x14')]('ShowFaxQueue',_0x3b01a7[_0xfc90('0x15')],_0x2a3b8b);_0x2cb7ae(_0x3f11c6[_0xfc90('0x14')](0x1f4,_0x3b01a7[_0xfc90('0x15')]));});});}; \ No newline at end of file +var _0xae49=['options','raw','where','include','map','model','attributes','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','request\x20sent','stringify','error','FaxQueue,\x20%s,\x20%s','message','info','result','catch','FaxQueue','findAll'];(function(_0x1ba303,_0x1638c5){var _0x45a904=function(_0x164080){while(--_0x164080){_0x1ba303['push'](_0x1ba303['shift']());}};_0x45a904(++_0x1638c5);}(_0xae49,0x1cd));var _0x9ae4=function(_0x193bb6,_0x3cb2ec){_0x193bb6=_0x193bb6-0x0;var _0x5a267=_0xae49[_0x193bb6];return _0x5a267;};'use strict';var _=require(_0x9ae4('0x0'));var util=require(_0x9ae4('0x1'));var moment=require(_0x9ae4('0x2'));var BPromise=require(_0x9ae4('0x3'));var rs=require(_0x9ae4('0x4'));var fs=require('fs');var Redis=require(_0x9ae4('0x5'));var db=require(_0x9ae4('0x6'))['db'];var utils=require(_0x9ae4('0x7'));var logger=require(_0x9ae4('0x8'))(_0x9ae4('0x9'));var config=require(_0x9ae4('0xa'));var jayson=require(_0x9ae4('0xb'));var client=jayson['client'][_0x9ae4('0xc')]({'port':0x232a});config[_0x9ae4('0xd')]=_[_0x9ae4('0xe')](config[_0x9ae4('0xd')],{'host':_0x9ae4('0xf'),'port':0x18eb});var socket=require(_0x9ae4('0x10'))(new Redis(config['redis']));require(_0x9ae4('0x11'))[_0x9ae4('0x12')](socket);function respondWithRpcPromise(_0x5d82c3,_0x20f6dd,_0x29667c){return new BPromise(function(_0x323e53,_0x5a71f2){return client[_0x9ae4('0x13')](_0x5d82c3,_0x29667c)[_0x9ae4('0x14')](function(_0x3c2a89){logger['info']('FaxQueue,\x20%s,\x20%s',_0x20f6dd,_0x9ae4('0x15'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x20f6dd,_0x9ae4('0x15'),JSON[_0x9ae4('0x16')](_0x3c2a89));if(_0x3c2a89[_0x9ae4('0x17')]){if(_0x3c2a89[_0x9ae4('0x17')]['code']===0x1f4){logger[_0x9ae4('0x17')](_0x9ae4('0x18'),_0x20f6dd,_0x3c2a89[_0x9ae4('0x17')][_0x9ae4('0x19')]);return _0x5a71f2(_0x3c2a89[_0x9ae4('0x17')][_0x9ae4('0x19')]);}logger[_0x9ae4('0x17')]('FaxQueue,\x20%s,\x20%s',_0x20f6dd,_0x3c2a89['error'][_0x9ae4('0x19')]);return _0x323e53(_0x3c2a89['error'][_0x9ae4('0x19')]);}else{logger[_0x9ae4('0x1a')]('FaxQueue,\x20%s,\x20%s',_0x20f6dd,'request\x20sent');_0x323e53(_0x3c2a89[_0x9ae4('0x1b')][_0x9ae4('0x19')]);}})[_0x9ae4('0x1c')](function(_0x149de6){logger['error'](_0x9ae4('0x18'),_0x20f6dd,_0x149de6);_0x5a71f2(_0x149de6);});});}exports['GetFaxQueue']=function(_0x3da4d2){var _0x27ffbe=this;return new Promise(function(_0x4bfc55,_0x1c24d4){return db[_0x9ae4('0x1d')][_0x9ae4('0x1e')]({'raw':_0x3da4d2[_0x9ae4('0x1f')]?_0x3da4d2[_0x9ae4('0x1f')][_0x9ae4('0x20')]===undefined?!![]:![]:!![],'where':_0x3da4d2[_0x9ae4('0x1f')]?_0x3da4d2[_0x9ae4('0x1f')][_0x9ae4('0x21')]||null:null,'attributes':_0x3da4d2['options']?_0x3da4d2[_0x9ae4('0x1f')]['attributes']||null:null,'limit':_0x3da4d2[_0x9ae4('0x1f')]?_0x3da4d2[_0x9ae4('0x1f')]['limit']||null:null,'include':_0x3da4d2['options']?_0x3da4d2[_0x9ae4('0x1f')][_0x9ae4('0x22')]?_[_0x9ae4('0x23')](_0x3da4d2[_0x9ae4('0x1f')][_0x9ae4('0x22')],function(_0x370110){return{'model':db[_0x370110[_0x9ae4('0x24')]],'as':_0x370110['as'],'attributes':_0x370110['attributes'],'include':_0x370110[_0x9ae4('0x22')]?_[_0x9ae4('0x23')](_0x370110[_0x9ae4('0x22')],function(_0x28e99e){return{'model':db[_0x28e99e[_0x9ae4('0x24')]],'as':_0x28e99e['as'],'attributes':_0x28e99e[_0x9ae4('0x25')],'include':_0x28e99e['include']?_[_0x9ae4('0x23')](_0x28e99e[_0x9ae4('0x22')],function(_0x5689ac){return{'model':db[_0x5689ac[_0x9ae4('0x24')]],'as':_0x5689ac['as'],'attributes':_0x5689ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ae4('0x14')](function(_0x26176a){logger[_0x9ae4('0x1a')](_0x9ae4('0x26'),_0x3da4d2);logger['debug']('GetFaxQueue',_0x3da4d2,JSON[_0x9ae4('0x16')](_0x26176a));_0x4bfc55(_0x26176a);})[_0x9ae4('0x1c')](function(_0x9885eb){logger[_0x9ae4('0x17')](_0x9ae4('0x26'),_0x9885eb[_0x9ae4('0x19')],_0x3da4d2);_0x1c24d4(_0x27ffbe[_0x9ae4('0x17')](0x1f4,_0x9885eb[_0x9ae4('0x19')]));});});};exports[_0x9ae4('0x27')]=function(_0x1fbbc6){var _0x3449d2=this;return new Promise(function(_0x591a00,_0x282226){return db['FaxQueue'][_0x9ae4('0x28')]({'raw':_0x1fbbc6[_0x9ae4('0x1f')]?_0x1fbbc6['options'][_0x9ae4('0x20')]===undefined?!![]:![]:!![],'where':_0x1fbbc6[_0x9ae4('0x1f')]?_0x1fbbc6[_0x9ae4('0x1f')][_0x9ae4('0x21')]||null:null,'attributes':_0x1fbbc6['options']?_0x1fbbc6['options'][_0x9ae4('0x25')]||null:null,'include':_0x1fbbc6[_0x9ae4('0x1f')]?_0x1fbbc6['options'][_0x9ae4('0x22')]?_[_0x9ae4('0x23')](_0x1fbbc6[_0x9ae4('0x1f')]['include'],function(_0x5f3660){return{'model':db[_0x5f3660[_0x9ae4('0x24')]],'as':_0x5f3660['as'],'attributes':_0x5f3660[_0x9ae4('0x25')],'include':_0x5f3660[_0x9ae4('0x22')]?_[_0x9ae4('0x23')](_0x5f3660['include'],function(_0x2e6127){return{'model':db[_0x2e6127[_0x9ae4('0x24')]],'as':_0x2e6127['as'],'attributes':_0x2e6127[_0x9ae4('0x25')],'include':_0x2e6127['include']?_[_0x9ae4('0x23')](_0x2e6127[_0x9ae4('0x22')],function(_0x35fe16){return{'model':db[_0x35fe16[_0x9ae4('0x24')]],'as':_0x35fe16['as'],'attributes':_0x35fe16['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ae4('0x14')](function(_0x174f52){logger[_0x9ae4('0x1a')]('ShowFaxQueue',_0x1fbbc6);logger['debug'](_0x9ae4('0x27'),_0x1fbbc6,JSON['stringify'](_0x174f52));_0x591a00(_0x174f52);})[_0x9ae4('0x1c')](function(_0x5b8abe){logger[_0x9ae4('0x17')](_0x9ae4('0x27'),_0x5b8abe[_0x9ae4('0x19')],_0x1fbbc6);_0x282226(_0x3449d2[_0x9ae4('0x17')](0x1f4,_0x5b8abe['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 98eabf9..638adf8 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 _0x736a=['register','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x736a,0x18e));var _0xa736=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x736a[_0x31ced5];return _0x10d9e5;};'use strict';var FaxQueueEvents=require(_0xa736('0x0'));var events=[_0xa736('0x1'),_0xa736('0x2'),_0xa736('0x3')];function createListener(_0x2f97d0,_0x1d15ee){return function(_0x2300a5){_0x1d15ee['emit'](_0x2f97d0,_0x2300a5);};}function removeListener(_0x42a0a5,_0x4e6b06){return function(){FaxQueueEvents['removeListener'](_0x42a0a5,_0x4e6b06);};}exports[_0xa736('0x4')]=function(_0x21d676){for(var _0x51dbe9=0x0,_0x5acb54=events['length'];_0x51dbe9<_0x5acb54;_0x51dbe9++){var _0x3d7527=events[_0x51dbe9];var _0x5b0b70=createListener(_0xa736('0x5')+_0x3d7527,_0x21d676);FaxQueueEvents['on'](_0x3d7527,_0x5b0b70);}}; \ No newline at end of file +var _0x94d9=['faxQueue:','./faxQueue.events','update','emit','length'];(function(_0x1191d0,_0x1a18c5){var _0x1fa320=function(_0x52bcfd){while(--_0x52bcfd){_0x1191d0['push'](_0x1191d0['shift']());}};_0x1fa320(++_0x1a18c5);}(_0x94d9,0xa1));var _0x994d=function(_0x3e5c7f,_0x264abb){_0x3e5c7f=_0x3e5c7f-0x0;var _0x8ce1b7=_0x94d9[_0x3e5c7f];return _0x8ce1b7;};'use strict';var FaxQueueEvents=require(_0x994d('0x0'));var events=['save','remove',_0x994d('0x1')];function createListener(_0x394cf4,_0x52c798){return function(_0x185af8){_0x52c798[_0x994d('0x2')](_0x394cf4,_0x185af8);};}function removeListener(_0xd91b4f,_0x4aced4){return function(){FaxQueueEvents['removeListener'](_0xd91b4f,_0x4aced4);};}exports['register']=function(_0x17209e){for(var _0x22e38b=0x0,_0x5af4b3=events[_0x994d('0x3')];_0x22e38b<_0x5af4b3;_0x22e38b++){var _0x28110a=events[_0x22e38b];var _0x5ac4b1=createListener(_0x994d('0x4')+_0x28110a,_0x17209e);FaxQueueEvents['on'](_0x28110a,_0x5ac4b1);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6cbb992..a80fd02 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 _0x8d4f=['../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','getTeams','/:id/users','create','post','/:id/teams','addTeams','addAgents','put','/:id','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x523855,_0x2e3564){var _0x547160=function(_0x21e43d){while(--_0x21e43d){_0x523855['push'](_0x523855['shift']());}};_0x547160(++_0x2e3564);}(_0x8d4f,0x157));var _0xf8d4=function(_0x16bb1c,_0x58f468){_0x16bb1c=_0x16bb1c-0x0;var _0xace56c=_0x8d4f[_0x16bb1c];return _0xace56c;};'use strict';var multer=require(_0xf8d4('0x0'));var util=require(_0xf8d4('0x1'));var path=require('path');var timeout=require(_0xf8d4('0x2'));var express=require(_0xf8d4('0x3'));var router=express[_0xf8d4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf8d4('0x5'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xf8d4('0x6')]('/',auth['isAuthenticated'](),controller[_0xf8d4('0x7')]);router['get'](_0xf8d4('0x8'),auth[_0xf8d4('0x9')](),controller[_0xf8d4('0xa')]);router[_0xf8d4('0x6')]('/:id',auth[_0xf8d4('0x9')](),controller[_0xf8d4('0xb')]);router[_0xf8d4('0x6')](_0xf8d4('0xc'),auth[_0xf8d4('0x9')](),controller[_0xf8d4('0xd')]);router[_0xf8d4('0x6')]('/:id/teams',auth[_0xf8d4('0x9')](),controller[_0xf8d4('0xe')]);router[_0xf8d4('0x6')](_0xf8d4('0xf'),auth[_0xf8d4('0x9')](),controller['getAgents']);router['post']('/',auth[_0xf8d4('0x9')](),controller[_0xf8d4('0x10')]);router[_0xf8d4('0x11')](_0xf8d4('0x12'),auth[_0xf8d4('0x9')](),controller[_0xf8d4('0x13')]);router[_0xf8d4('0x11')](_0xf8d4('0xf'),auth[_0xf8d4('0x9')](),controller[_0xf8d4('0x14')]);router[_0xf8d4('0x15')](_0xf8d4('0x16'),auth[_0xf8d4('0x9')](),controller[_0xf8d4('0x17')]);router['delete'](_0xf8d4('0x16'),auth['isAuthenticated'](),controller[_0xf8d4('0x18')]);router['delete'](_0xf8d4('0x12'),auth['isAuthenticated'](),controller[_0xf8d4('0x19')]);router[_0xf8d4('0x1a')](_0xf8d4('0xf'),auth[_0xf8d4('0x9')](),controller[_0xf8d4('0x1b')]);module[_0xf8d4('0x1c')]=router; \ No newline at end of file +var _0x7f25=['getMembers','/:id/teams','/:id/users','getAgents','post','create','put','delete','destroy','removeTeams','removeAgents','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members'];(function(_0x1d2479,_0x311e00){var _0x1f4d43=function(_0xbe7d){while(--_0xbe7d){_0x1d2479['push'](_0x1d2479['shift']());}};_0x1f4d43(++_0x311e00);}(_0x7f25,0x177));var _0x57f2=function(_0x1a8ff0,_0x20788d){_0x1a8ff0=_0x1a8ff0-0x0;var _0x3588bf=_0x7f25[_0x1a8ff0];return _0x3588bf;};'use strict';var multer=require('multer');var util=require(_0x57f2('0x0'));var path=require(_0x57f2('0x1'));var timeout=require('connect-timeout');var express=require(_0x57f2('0x2'));var router=express[_0x57f2('0x3')]();var auth=require(_0x57f2('0x4'));var interaction=require(_0x57f2('0x5'));var config=require(_0x57f2('0x6'));var controller=require(_0x57f2('0x7'));router[_0x57f2('0x8')]('/',auth[_0x57f2('0x9')](),controller[_0x57f2('0xa')]);router[_0x57f2('0x8')](_0x57f2('0xb'),auth[_0x57f2('0x9')](),controller[_0x57f2('0xc')]);router[_0x57f2('0x8')](_0x57f2('0xd'),auth[_0x57f2('0x9')](),controller['show']);router[_0x57f2('0x8')](_0x57f2('0xe'),auth[_0x57f2('0x9')](),controller[_0x57f2('0xf')]);router[_0x57f2('0x8')](_0x57f2('0x10'),auth[_0x57f2('0x9')](),controller['getTeams']);router[_0x57f2('0x8')](_0x57f2('0x11'),auth['isAuthenticated'](),controller[_0x57f2('0x12')]);router[_0x57f2('0x13')]('/',auth[_0x57f2('0x9')](),controller[_0x57f2('0x14')]);router['post'](_0x57f2('0x10'),auth[_0x57f2('0x9')](),controller['addTeams']);router[_0x57f2('0x13')](_0x57f2('0x11'),auth[_0x57f2('0x9')](),controller['addAgents']);router[_0x57f2('0x15')]('/:id',auth[_0x57f2('0x9')](),controller['update']);router[_0x57f2('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x57f2('0x17')]);router[_0x57f2('0x16')]('/:id/teams',auth[_0x57f2('0x9')](),controller[_0x57f2('0x18')]);router[_0x57f2('0x16')](_0x57f2('0x11'),auth['isAuthenticated'](),controller[_0x57f2('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 542bd6b..65803bc 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 _0x899a=['moment','exports','STRING','DATE'];(function(_0x3f8700,_0x24b171){var _0x2d181b=function(_0x4aa6c3){while(--_0x4aa6c3){_0x3f8700['push'](_0x3f8700['shift']());}};_0x2d181b(++_0x24b171);}(_0x899a,0x1b0));var _0xa899=function(_0x2be7dd,_0x5bbbed){_0x2be7dd=_0x2be7dd-0x0;var _0x7ac863=_0x899a[_0x2be7dd];return _0x7ac863;};'use strict';var moment=require(_0xa899('0x0'));var Sequelize=require('sequelize');module[_0xa899('0x1')]={'uniqueid':{'type':Sequelize[_0xa899('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa899('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa899('0x3')]},'acceptAt':{'type':Sequelize[_0xa899('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb09e=['STRING','DATE','moment','sequelize','exports'];(function(_0x2bf0f0,_0x54ac85){var _0x1a872f=function(_0x38c9f7){while(--_0x38c9f7){_0x2bf0f0['push'](_0x2bf0f0['shift']());}};_0x1a872f(++_0x54ac85);}(_0xb09e,0x1ab));var _0xeb09=function(_0x7479f1,_0x527047){_0x7479f1=_0x7479f1-0x0;var _0x1f6202=_0xb09e[_0x7479f1];return _0x1f6202;};'use strict';var moment=require(_0xeb09('0x0'));var Sequelize=require(_0xeb09('0x1'));module[_0xeb09('0x2')]={'uniqueid':{'type':Sequelize[_0xeb09('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xeb09('0x3')]},'joinAt':{'type':Sequelize[_0xeb09('0x4')]},'leaveAt':{'type':Sequelize[_0xeb09('0x4')]},'acceptAt':{'type':Sequelize[_0xeb09('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xeb09('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index d30499c..663caac 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 _0x9234=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','add','day','merge','filter','map','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs'];(function(_0x40dfbb,_0x43fbd5){var _0x5bb15b=function(_0x4a2980){while(--_0x4a2980){_0x40dfbb['push'](_0x40dfbb['shift']());}};_0x5bb15b(++_0x43fbd5);}(_0x9234,0xd1));var _0x4923=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x9234[_0x166d93];return _0xba708;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4923('0x0'));var rimraf=require(_0x4923('0x1'));var zipdir=require(_0x4923('0x2'));var jsonpatch=require(_0x4923('0x3'));var rp=require(_0x4923('0x4'));var moment=require(_0x4923('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4923('0x6'));var path=require(_0x4923('0x7'));var sox=require('sox');var csv=require(_0x4923('0x8'));var ejs=require(_0x4923('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4923('0xa'));var crypto=require(_0x4923('0xb'));var jsforce=require(_0x4923('0xc'));var deskjs=require(_0x4923('0xd'));var toCsv=require(_0x4923('0x8'));var querystring=require('querystring');var Papa=require(_0x4923('0xe'));var Redis=require(_0x4923('0xf'));var qs=require(_0x4923('0x10'));var logger=require(_0x4923('0x11'))('api');var utils=require(_0x4923('0x12'));var config=require(_0x4923('0x13'));var db=require(_0x4923('0x14'))['db'];function respondWithStatusCode(_0x13dd9e,_0x34bcf2){_0x34bcf2=_0x34bcf2||0xcc;return function(_0x703c53){if(_0x703c53){return _0x13dd9e[_0x4923('0x15')](_0x34bcf2);}return _0x13dd9e['status'](_0x34bcf2)[_0x4923('0x16')]();};}function respondWithResult(_0x10498c,_0x3433ae){_0x3433ae=_0x3433ae||0xc8;return function(_0x4b2e8f){if(_0x4b2e8f){return _0x10498c[_0x4923('0x17')](_0x3433ae)['json'](_0x4b2e8f);}};}function respondWithFilteredResult(_0x5110af,_0x3bb899){return function(_0x5d8a47){if(_0x5d8a47){var _0x497a40=_0x5d8a47[_0x4923('0x18')],_0x2e178b=_0x3bb899[_0x4923('0x19')],_0x55f475=_0x3bb899[_0x4923('0x19')]+_0x3bb899['limit'],_0x2731e6;if(_0x55f475>=_0x497a40){_0x55f475=_0x497a40;_0x2731e6=0xc8;}else{_0x2731e6=0xce;}_0x5110af[_0x4923('0x17')](_0x2731e6);return _0x5110af[_0x4923('0x1a')](_0x4923('0x1b'),_0x2e178b+'-'+_0x55f475+'/'+_0x497a40)[_0x4923('0x1c')](_0x5d8a47);}return null;};}function patchUpdates(_0x4dd222){return function(_0x1f79a9){try{jsonpatch['apply'](_0x1f79a9,_0x4dd222,!![]);}catch(_0x1886a3){return BPromise[_0x4923('0x1d')](_0x1886a3);}return _0x1f79a9[_0x4923('0x1e')]();};}function saveUpdates(_0x101757,_0x1de798){return function(_0x4b8c8b){if(_0x4b8c8b){return _0x4b8c8b['update'](_0x101757)[_0x4923('0x1f')](function(_0x3b5d05){return _0x3b5d05;});}return null;};}function removeEntity(_0x585702,_0x560d20){return function(_0x301dc0){if(_0x301dc0){return _0x301dc0[_0x4923('0x20')]()[_0x4923('0x1f')](function(){_0x585702[_0x4923('0x17')](0xcc)[_0x4923('0x16')]();});}};}function handleEntityNotFound(_0x48efb6,_0x3017a4){return function(_0x360ddf){if(!_0x360ddf){_0x48efb6[_0x4923('0x15')](0x194);}return _0x360ddf;};}function handleError(_0x5060e4,_0x116118){_0x116118=_0x116118||0x1f4;return function(_0x289c53){logger[_0x4923('0x21')](_0x289c53[_0x4923('0x22')]);if(_0x289c53[_0x4923('0x23')]){delete _0x289c53[_0x4923('0x23')];}_0x5060e4['status'](_0x116118)[_0x4923('0x24')](_0x289c53);};}exports[_0x4923('0x25')]=function(_0xd6dcbb,_0x4c242c){var _0x524d18={},_0x520d06={},_0x104937={'count':0x0,'rows':[]};var _0x319239=db[_0x4923('0x26')][_0x4923('0x27')];_0x520d06[_0x4923('0x28')]=_[_0x4923('0x29')](_0x319239);var _0x37af8e={'dateStart':_0xd6dcbb[_0x4923('0x2a')][_0x4923('0x2b')],'dateEnd':_0xd6dcbb['query']['dateEnd']};delete _0xd6dcbb[_0x4923('0x2a')][_0x4923('0x2b')];delete _0xd6dcbb[_0x4923('0x2a')][_0x4923('0x2c')];_0x520d06[_0x4923('0x2a')]=_[_0x4923('0x29')](_0xd6dcbb[_0x4923('0x2a')]);_0x520d06[_0x4923('0x2d')]=_[_0x4923('0x2e')](_0x520d06[_0x4923('0x28')],_0x520d06[_0x4923('0x2a')]);_0x524d18[_0x4923('0x2f')]=_['intersection'](_0x520d06[_0x4923('0x28')],qs[_0x4923('0x30')](_0xd6dcbb[_0x4923('0x2a')]['fields']));_0x524d18[_0x4923('0x2f')]=_0x524d18[_0x4923('0x2f')][_0x4923('0x31')]?_0x524d18[_0x4923('0x2f')]:_0x520d06[_0x4923('0x28')];if(!_0xd6dcbb[_0x4923('0x2a')][_0x4923('0x32')]('nolimit')){_0x524d18[_0x4923('0x33')]=qs['limit'](_0xd6dcbb[_0x4923('0x2a')]['limit']);_0x524d18[_0x4923('0x19')]=qs[_0x4923('0x19')](_0xd6dcbb[_0x4923('0x2a')][_0x4923('0x19')]);}_0x524d18[_0x4923('0x34')]=qs[_0x4923('0x35')](_0xd6dcbb[_0x4923('0x2a')][_0x4923('0x35')]);_0x524d18[_0x4923('0x36')]=qs['filters'](_[_0x4923('0x37')](_0xd6dcbb[_0x4923('0x2a')],_0x520d06['filters']));if(_0x37af8e[_0x4923('0x2b')]){if(_0x37af8e['dateEnd']){_0x37af8e[_0x4923('0x2c')]=moment(_0x37af8e[_0x4923('0x2c')])[_0x4923('0x38')](0x1,_0x4923('0x39'));}else{_0x37af8e['dateEnd']=moment(_0x37af8e[_0x4923('0x2b')])[_0x4923('0x38')](0x1,_0x4923('0x39'));}_[_0x4923('0x3a')](_0x524d18[_0x4923('0x36')],{'createdAt':{'$gte':_0x37af8e['dateStart'],'$lte':_0x37af8e[_0x4923('0x2c')]}});}if(_0xd6dcbb[_0x4923('0x2a')][_0x4923('0x3b')]){_0x524d18['where']=_[_0x4923('0x3a')](_0x524d18['where'],{'$or':_[_0x4923('0x3c')](_0x524d18[_0x4923('0x2f')],function(_0x151a76){var _0xd755a9={};_0xd755a9[_0x151a76]={'$like':'%'+_0xd6dcbb[_0x4923('0x2a')][_0x4923('0x3b')]+'%'};return _0xd755a9;})});}_0x524d18=_['merge']({},_0x524d18,_0xd6dcbb['options']);var _0x23536f={'where':_0x524d18[_0x4923('0x36')]};return db[_0x4923('0x26')][_0x4923('0x18')](_0x23536f)[_0x4923('0x1f')](function(_0x4c115e){_0x104937[_0x4923('0x18')]=_0x4c115e;if(_0xd6dcbb[_0x4923('0x2a')][_0x4923('0x3d')]){_0x524d18[_0x4923('0x3e')]=[{'all':!![]}];}return db[_0x4923('0x26')][_0x4923('0x3f')](_0x524d18);})[_0x4923('0x1f')](function(_0x4668db){_0x104937[_0x4923('0x40')]=_0x4668db;return _0x104937;})[_0x4923('0x1f')](respondWithFilteredResult(_0x4c242c,_0x524d18))[_0x4923('0x41')](handleError(_0x4c242c,null));};exports[_0x4923('0x42')]=function(_0x20a3d1,_0x286a54){var _0x27dd28={'raw':!![],'where':{'id':_0x20a3d1['params']['id']}},_0x3e365f={};_0x3e365f['model']=_['keys'](db[_0x4923('0x26')][_0x4923('0x27')]);_0x3e365f[_0x4923('0x2a')]=_['keys'](_0x20a3d1[_0x4923('0x2a')]);_0x3e365f['filters']=_[_0x4923('0x2e')](_0x3e365f[_0x4923('0x28')],_0x3e365f[_0x4923('0x2a')]);_0x27dd28[_0x4923('0x2f')]=_[_0x4923('0x2e')](_0x3e365f[_0x4923('0x28')],qs[_0x4923('0x30')](_0x20a3d1[_0x4923('0x2a')][_0x4923('0x30')]));_0x27dd28[_0x4923('0x2f')]=_0x27dd28[_0x4923('0x2f')][_0x4923('0x31')]?_0x27dd28['attributes']:_0x3e365f[_0x4923('0x28')];if(_0x20a3d1['query'][_0x4923('0x3d')]){_0x27dd28[_0x4923('0x3e')]=[{'all':!![]}];}_0x27dd28=_['merge']({},_0x27dd28,_0x20a3d1[_0x4923('0x43')]);return db[_0x4923('0x26')][_0x4923('0x44')](_0x27dd28)[_0x4923('0x1f')](handleEntityNotFound(_0x286a54,null))[_0x4923('0x1f')](respondWithResult(_0x286a54,null))[_0x4923('0x41')](handleError(_0x286a54,null));};exports[_0x4923('0x45')]=function(_0x46f27d,_0x2f2c86){return db[_0x4923('0x26')]['create'](_0x46f27d[_0x4923('0x46')],{})[_0x4923('0x1f')](respondWithResult(_0x2f2c86,0xc9))[_0x4923('0x41')](handleError(_0x2f2c86,null));};exports['update']=function(_0x1ea21f,_0x491fa1){if(_0x1ea21f['body']['id']){delete _0x1ea21f[_0x4923('0x46')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x1ea21f['params']['id']}})['then'](handleEntityNotFound(_0x491fa1,null))[_0x4923('0x1f')](saveUpdates(_0x1ea21f[_0x4923('0x46')],null))[_0x4923('0x1f')](respondWithResult(_0x491fa1,null))[_0x4923('0x41')](handleError(_0x491fa1,null));};exports[_0x4923('0x20')]=function(_0x16649a,_0xe36bd0){return db[_0x4923('0x26')][_0x4923('0x44')]({'where':{'id':_0x16649a[_0x4923('0x47')]['id']}})[_0x4923('0x1f')](handleEntityNotFound(_0xe36bd0,null))[_0x4923('0x1f')](removeEntity(_0xe36bd0,null))[_0x4923('0x41')](handleError(_0xe36bd0,null));};exports[_0x4923('0x48')]=function(_0x4569ca,_0x539e3a){return db['FaxQueueReport'][_0x4923('0x48')]()[_0x4923('0x1f')](respondWithResult(_0x539e3a,null))[_0x4923('0x41')](handleError(_0x539e3a,null));}; \ No newline at end of file +var _0xc308=['querystring','ioredis','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','options','FaxQueueReport','include','findAll','rows','show','find','catch','create','body','destroy','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0xc308,0x15c));var _0x8c30=function(_0x1e271f,_0xf14504){_0x1e271f=_0x1e271f-0x0;var _0x2b2ac5=_0xc308[_0x1e271f];return _0x2b2ac5;};'use strict';var pdf=require(_0x8c30('0x0'));var emlformat=require(_0x8c30('0x1'));var rimraf=require(_0x8c30('0x2'));var zipdir=require(_0x8c30('0x3'));var jsonpatch=require(_0x8c30('0x4'));var rp=require(_0x8c30('0x5'));var moment=require(_0x8c30('0x6'));var BPromise=require(_0x8c30('0x7'));var Mustache=require(_0x8c30('0x8'));var util=require(_0x8c30('0x9'));var path=require('path');var sox=require(_0x8c30('0xa'));var csv=require(_0x8c30('0xb'));var ejs=require(_0x8c30('0xc'));var fs=require('fs');var _=require(_0x8c30('0xd'));var squel=require('squel');var crypto=require(_0x8c30('0xe'));var jsforce=require(_0x8c30('0xf'));var deskjs=require(_0x8c30('0x10'));var toCsv=require(_0x8c30('0xb'));var querystring=require(_0x8c30('0x11'));var Papa=require('papaparse');var Redis=require(_0x8c30('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x8c30('0x13'))('api');var utils=require(_0x8c30('0x14'));var config=require('../../config/environment');var db=require(_0x8c30('0x15'))['db'];function respondWithStatusCode(_0x2e5e91,_0x33f536){_0x33f536=_0x33f536||0xcc;return function(_0x54f244){if(_0x54f244){return _0x2e5e91[_0x8c30('0x16')](_0x33f536);}return _0x2e5e91['status'](_0x33f536)[_0x8c30('0x17')]();};}function respondWithResult(_0x40bf2d,_0x489c22){_0x489c22=_0x489c22||0xc8;return function(_0x4a5732){if(_0x4a5732){return _0x40bf2d[_0x8c30('0x18')](_0x489c22)['json'](_0x4a5732);}};}function respondWithFilteredResult(_0x1dd333,_0x207962){return function(_0x329ec8){if(_0x329ec8){var _0x5b8321=_0x329ec8[_0x8c30('0x19')],_0x3f4a6e=_0x207962['offset'],_0xdaad9a=_0x207962[_0x8c30('0x1a')]+_0x207962[_0x8c30('0x1b')],_0x1c8c0c;if(_0xdaad9a>=_0x5b8321){_0xdaad9a=_0x5b8321;_0x1c8c0c=0xc8;}else{_0x1c8c0c=0xce;}_0x1dd333[_0x8c30('0x18')](_0x1c8c0c);return _0x1dd333[_0x8c30('0x1c')](_0x8c30('0x1d'),_0x3f4a6e+'-'+_0xdaad9a+'/'+_0x5b8321)['json'](_0x329ec8);}return null;};}function patchUpdates(_0x364042){return function(_0x1bf1d7){try{jsonpatch[_0x8c30('0x1e')](_0x1bf1d7,_0x364042,!![]);}catch(_0x2bcd21){return BPromise[_0x8c30('0x1f')](_0x2bcd21);}return _0x1bf1d7[_0x8c30('0x20')]();};}function saveUpdates(_0x1b6e1d,_0x4a4eb5){return function(_0x1796a0){if(_0x1796a0){return _0x1796a0[_0x8c30('0x21')](_0x1b6e1d)[_0x8c30('0x22')](function(_0x2909ae){return _0x2909ae;});}return null;};}function removeEntity(_0x525060,_0x303a2d){return function(_0xe95bc1){if(_0xe95bc1){return _0xe95bc1['destroy']()[_0x8c30('0x22')](function(){_0x525060[_0x8c30('0x18')](0xcc)[_0x8c30('0x17')]();});}};}function handleEntityNotFound(_0x43baec,_0x359a3b){return function(_0x128047){if(!_0x128047){_0x43baec[_0x8c30('0x16')](0x194);}return _0x128047;};}function handleError(_0x4081b5,_0x2d2adb){_0x2d2adb=_0x2d2adb||0x1f4;return function(_0x802144){logger[_0x8c30('0x23')](_0x802144[_0x8c30('0x24')]);if(_0x802144[_0x8c30('0x25')]){delete _0x802144['name'];}_0x4081b5['status'](_0x2d2adb)[_0x8c30('0x26')](_0x802144);};}exports['index']=function(_0x286a7d,_0x3af818){var _0x5e397b={},_0x52d611={},_0xc2d120={'count':0x0,'rows':[]};var _0x356746=db['FaxQueueReport'][_0x8c30('0x27')];_0x52d611[_0x8c30('0x28')]=_['keys'](_0x356746);var _0xbc8fd8={'dateStart':_0x286a7d[_0x8c30('0x29')][_0x8c30('0x2a')],'dateEnd':_0x286a7d[_0x8c30('0x29')][_0x8c30('0x2b')]};delete _0x286a7d[_0x8c30('0x29')][_0x8c30('0x2a')];delete _0x286a7d[_0x8c30('0x29')][_0x8c30('0x2b')];_0x52d611[_0x8c30('0x29')]=_[_0x8c30('0x2c')](_0x286a7d[_0x8c30('0x29')]);_0x52d611[_0x8c30('0x2d')]=_[_0x8c30('0x2e')](_0x52d611['model'],_0x52d611[_0x8c30('0x29')]);_0x5e397b[_0x8c30('0x2f')]=_['intersection'](_0x52d611[_0x8c30('0x28')],qs[_0x8c30('0x30')](_0x286a7d[_0x8c30('0x29')]['fields']));_0x5e397b['attributes']=_0x5e397b[_0x8c30('0x2f')][_0x8c30('0x31')]?_0x5e397b[_0x8c30('0x2f')]:_0x52d611[_0x8c30('0x28')];if(!_0x286a7d[_0x8c30('0x29')][_0x8c30('0x32')](_0x8c30('0x33'))){_0x5e397b[_0x8c30('0x1b')]=qs[_0x8c30('0x1b')](_0x286a7d['query']['limit']);_0x5e397b[_0x8c30('0x1a')]=qs[_0x8c30('0x1a')](_0x286a7d['query'][_0x8c30('0x1a')]);}_0x5e397b[_0x8c30('0x34')]=qs[_0x8c30('0x35')](_0x286a7d['query']['sort']);_0x5e397b[_0x8c30('0x36')]=qs[_0x8c30('0x2d')](_['pick'](_0x286a7d[_0x8c30('0x29')],_0x52d611[_0x8c30('0x2d')]));if(_0xbc8fd8[_0x8c30('0x2a')]){if(_0xbc8fd8['dateEnd']){_0xbc8fd8[_0x8c30('0x2b')]=moment(_0xbc8fd8[_0x8c30('0x2b')])[_0x8c30('0x37')](0x1,_0x8c30('0x38'));}else{_0xbc8fd8['dateEnd']=moment(_0xbc8fd8[_0x8c30('0x2a')])[_0x8c30('0x37')](0x1,'day');}_[_0x8c30('0x39')](_0x5e397b['where'],{'createdAt':{'$gte':_0xbc8fd8[_0x8c30('0x2a')],'$lte':_0xbc8fd8[_0x8c30('0x2b')]}});}if(_0x286a7d[_0x8c30('0x29')][_0x8c30('0x3a')]){_0x5e397b[_0x8c30('0x36')]=_[_0x8c30('0x39')](_0x5e397b[_0x8c30('0x36')],{'$or':_[_0x8c30('0x3b')](_0x5e397b[_0x8c30('0x2f')],function(_0x4b9561){var _0x4dcb5f={};_0x4dcb5f[_0x4b9561]={'$like':'%'+_0x286a7d[_0x8c30('0x29')][_0x8c30('0x3a')]+'%'};return _0x4dcb5f;})});}_0x5e397b=_[_0x8c30('0x39')]({},_0x5e397b,_0x286a7d[_0x8c30('0x3c')]);var _0x2a3944={'where':_0x5e397b[_0x8c30('0x36')]};return db[_0x8c30('0x3d')][_0x8c30('0x19')](_0x2a3944)[_0x8c30('0x22')](function(_0xfe4a5c){_0xc2d120[_0x8c30('0x19')]=_0xfe4a5c;if(_0x286a7d[_0x8c30('0x29')]['includeAll']){_0x5e397b[_0x8c30('0x3e')]=[{'all':!![]}];}return db[_0x8c30('0x3d')][_0x8c30('0x3f')](_0x5e397b);})['then'](function(_0x2da676){_0xc2d120[_0x8c30('0x40')]=_0x2da676;return _0xc2d120;})[_0x8c30('0x22')](respondWithFilteredResult(_0x3af818,_0x5e397b))['catch'](handleError(_0x3af818,null));};exports[_0x8c30('0x41')]=function(_0x108b5c,_0x5d13db){var _0x1b1db2={'raw':!![],'where':{'id':_0x108b5c['params']['id']}},_0x33a027={};_0x33a027[_0x8c30('0x28')]=_[_0x8c30('0x2c')](db[_0x8c30('0x3d')][_0x8c30('0x27')]);_0x33a027[_0x8c30('0x29')]=_[_0x8c30('0x2c')](_0x108b5c[_0x8c30('0x29')]);_0x33a027[_0x8c30('0x2d')]=_[_0x8c30('0x2e')](_0x33a027[_0x8c30('0x28')],_0x33a027[_0x8c30('0x29')]);_0x1b1db2['attributes']=_[_0x8c30('0x2e')](_0x33a027['model'],qs[_0x8c30('0x30')](_0x108b5c[_0x8c30('0x29')][_0x8c30('0x30')]));_0x1b1db2[_0x8c30('0x2f')]=_0x1b1db2[_0x8c30('0x2f')][_0x8c30('0x31')]?_0x1b1db2[_0x8c30('0x2f')]:_0x33a027[_0x8c30('0x28')];if(_0x108b5c[_0x8c30('0x29')]['includeAll']){_0x1b1db2[_0x8c30('0x3e')]=[{'all':!![]}];}_0x1b1db2=_[_0x8c30('0x39')]({},_0x1b1db2,_0x108b5c['options']);return db[_0x8c30('0x3d')][_0x8c30('0x42')](_0x1b1db2)[_0x8c30('0x22')](handleEntityNotFound(_0x5d13db,null))['then'](respondWithResult(_0x5d13db,null))[_0x8c30('0x43')](handleError(_0x5d13db,null));};exports[_0x8c30('0x44')]=function(_0x4cfcd2,_0x4b295a){return db[_0x8c30('0x3d')][_0x8c30('0x44')](_0x4cfcd2[_0x8c30('0x45')],{})[_0x8c30('0x22')](respondWithResult(_0x4b295a,0xc9))[_0x8c30('0x43')](handleError(_0x4b295a,null));};exports[_0x8c30('0x21')]=function(_0x154c7e,_0x1ead25){if(_0x154c7e[_0x8c30('0x45')]['id']){delete _0x154c7e[_0x8c30('0x45')]['id'];}return db[_0x8c30('0x3d')][_0x8c30('0x42')]({'where':{'id':_0x154c7e['params']['id']}})[_0x8c30('0x22')](handleEntityNotFound(_0x1ead25,null))[_0x8c30('0x22')](saveUpdates(_0x154c7e[_0x8c30('0x45')],null))[_0x8c30('0x22')](respondWithResult(_0x1ead25,null))[_0x8c30('0x43')](handleError(_0x1ead25,null));};exports[_0x8c30('0x46')]=function(_0x42bac7,_0xe7fb76){return db[_0x8c30('0x3d')][_0x8c30('0x42')]({'where':{'id':_0x42bac7[_0x8c30('0x47')]['id']}})[_0x8c30('0x22')](handleEntityNotFound(_0xe7fb76,null))[_0x8c30('0x22')](removeEntity(_0xe7fb76,null))[_0x8c30('0x43')](handleError(_0xe7fb76,null));};exports[_0x8c30('0x48')]=function(_0x649701,_0x110ec8){return db[_0x8c30('0x3d')][_0x8c30('0x48')]()[_0x8c30('0x22')](respondWithResult(_0x110ec8,null))[_0x8c30('0x43')](handleError(_0x110ec8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 28a4b2d..f073d58 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 _0xf133=['api','moment','request-promise','exports','define','FaxQueueReport','uniqueid','util'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xf133,0x9f));var _0x3f13=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xf133[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require(_0x3f13('0x0'));var logger=require('../../config/logger')(_0x3f13('0x1'));var moment=require(_0x3f13('0x2'));var BPromise=require('bluebird');var rp=require(_0x3f13('0x3'));var attributes=require('./faxQueueReport.attributes');module[_0x3f13('0x4')]=function(_0x4390d2,_0x377e6d){return _0x4390d2[_0x3f13('0x5')](_0x3f13('0x6'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x3f13('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9fc0=['../../config/logger','api','moment','bluebird','request-promise','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util'];(function(_0x4e4070,_0x699370){var _0x500ae2=function(_0x42f9c6){while(--_0x42f9c6){_0x4e4070['push'](_0x4e4070['shift']());}};_0x500ae2(++_0x699370);}(_0x9fc0,0xca));var _0x09fc=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x9fc0[_0x561f25];return _0x150e4c;};'use strict';var _=require(_0x09fc('0x0'));var util=require(_0x09fc('0x1'));var logger=require(_0x09fc('0x2'))(_0x09fc('0x3'));var moment=require(_0x09fc('0x4'));var BPromise=require(_0x09fc('0x5'));var rp=require(_0x09fc('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0x09fc('0x7')]=function(_0x3762c8,_0x474ede){return _0x3762c8[_0x09fc('0x8')](_0x09fc('0x9'),attributes,{'tableName':_0x09fc('0xa'),'paranoid':![],'indexes':[{'name':_0x09fc('0xb'),'fields':[_0x09fc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 28f58d1..16b9576 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 _0x0c71=['create','body','options','raw','info','debug','UpdateFaxQueueReport','FaxQueueReport','update','where','limit','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x0c71,0xfb));var _0x10c7=function(_0x32054a,_0x5093bf){_0x32054a=_0x32054a-0x0;var _0x5f13b3=_0x0c71[_0x32054a];return _0x5f13b3;};'use strict';var _=require('lodash');var util=require(_0x10c7('0x0'));var moment=require('moment');var BPromise=require(_0x10c7('0x1'));var rs=require(_0x10c7('0x2'));var fs=require('fs');var Redis=require(_0x10c7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x10c7('0x4'))('rpc');var config=require(_0x10c7('0x5'));var jayson=require(_0x10c7('0x6'));var client=jayson[_0x10c7('0x7')][_0x10c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbe32,_0xd955fc,_0x4d8fc8){return new BPromise(function(_0x3cbcd7,_0x221c8f){return client['request'](_0x2dbe32,_0x4d8fc8)[_0x10c7('0x9')](function(_0x566146){logger['info'](_0x10c7('0xa'),_0xd955fc,_0x10c7('0xb'));logger['debug'](_0x10c7('0xc'),_0xd955fc,_0x10c7('0xb'),JSON[_0x10c7('0xd')](_0x566146));if(_0x566146[_0x10c7('0xe')]){if(_0x566146[_0x10c7('0xe')][_0x10c7('0xf')]===0x1f4){logger[_0x10c7('0xe')](_0x10c7('0xa'),_0xd955fc,_0x566146[_0x10c7('0xe')][_0x10c7('0x10')]);return _0x221c8f(_0x566146['error'][_0x10c7('0x10')]);}logger[_0x10c7('0xe')](_0x10c7('0xa'),_0xd955fc,_0x566146[_0x10c7('0xe')][_0x10c7('0x10')]);return _0x3cbcd7(_0x566146[_0x10c7('0xe')][_0x10c7('0x10')]);}else{logger['info'](_0x10c7('0xa'),_0xd955fc,_0x10c7('0xb'));_0x3cbcd7(_0x566146['result'][_0x10c7('0x10')]);}})[_0x10c7('0x11')](function(_0xbfd3a4){logger[_0x10c7('0xe')](_0x10c7('0xa'),_0xd955fc,_0xbfd3a4);_0x221c8f(_0xbfd3a4);});});}exports[_0x10c7('0x12')]=function(_0x3168e1){var _0x1bd968=this;return new Promise(function(_0x2ecb76,_0x4ce96d){return db['FaxQueueReport'][_0x10c7('0x13')](_0x3168e1[_0x10c7('0x14')],{'raw':_0x3168e1['options']?_0x3168e1[_0x10c7('0x15')][_0x10c7('0x16')]===undefined?!![]:![]:!![]})[_0x10c7('0x9')](function(_0x5373cf){logger[_0x10c7('0x17')]('CreateFaxQueueReport',_0x3168e1);logger[_0x10c7('0x18')](_0x10c7('0x12'),_0x3168e1,JSON[_0x10c7('0xd')](_0x5373cf));_0x2ecb76(_0x5373cf);})['catch'](function(_0x29a2e5){logger[_0x10c7('0xe')](_0x10c7('0x12'),_0x29a2e5[_0x10c7('0x10')],_0x3168e1);_0x4ce96d(_0x1bd968[_0x10c7('0xe')](0x1f4,_0x29a2e5[_0x10c7('0x10')]));});});};exports[_0x10c7('0x19')]=function(_0x308e3a){var _0x33b697=this;return new Promise(function(_0x3cd18a,_0x6a062b){return db[_0x10c7('0x1a')][_0x10c7('0x1b')](_0x308e3a[_0x10c7('0x14')],{'raw':_0x308e3a[_0x10c7('0x15')]?_0x308e3a[_0x10c7('0x15')][_0x10c7('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x308e3a[_0x10c7('0x15')]?_0x308e3a[_0x10c7('0x15')][_0x10c7('0x1c')]||null:null,'attributes':_0x308e3a['options']?_0x308e3a['options']['attributes']||null:null,'limit':_0x308e3a[_0x10c7('0x15')]?_0x308e3a[_0x10c7('0x15')][_0x10c7('0x1d')]||null:null})[_0x10c7('0x9')](function(_0x27ac7e){logger[_0x10c7('0x17')]('UpdateFaxQueueReport',_0x308e3a);logger[_0x10c7('0x18')]('UpdateFaxQueueReport',_0x308e3a,JSON[_0x10c7('0xd')](_0x27ac7e));_0x3cd18a(_0x27ac7e);})['catch'](function(_0x3731a1){logger[_0x10c7('0xe')]('UpdateFaxQueueReport',_0x3731a1[_0x10c7('0x10')],_0x308e3a);_0x6a062b(_0x33b697[_0x10c7('0xe')](0x1f4,_0x3731a1[_0x10c7('0x10')]));});});}; \ No newline at end of file +var _0x56bd=['limit','info','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','where'];(function(_0x51ae12,_0x50b8db){var _0x52120b=function(_0x236d49){while(--_0x236d49){_0x51ae12['push'](_0x51ae12['shift']());}};_0x52120b(++_0x50b8db);}(_0x56bd,0xe9));var _0xd56b=function(_0x2873ce,_0x4e9549){_0x2873ce=_0x2873ce-0x0;var _0x2e9605=_0x56bd[_0x2873ce];return _0x2e9605;};'use strict';var _=require('lodash');var util=require(_0xd56b('0x0'));var moment=require(_0xd56b('0x1'));var BPromise=require(_0xd56b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd56b('0x3'));var db=require(_0xd56b('0x4'))['db'];var utils=require(_0xd56b('0x5'));var logger=require(_0xd56b('0x6'))('rpc');var config=require(_0xd56b('0x7'));var jayson=require(_0xd56b('0x8'));var client=jayson[_0xd56b('0x9')][_0xd56b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17864e,_0x442791,_0x20d1b1){return new BPromise(function(_0x50ad75,_0x670d9b){return client[_0xd56b('0xb')](_0x17864e,_0x20d1b1)[_0xd56b('0xc')](function(_0x13447e){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x442791,_0xd56b('0xd'));logger[_0xd56b('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x442791,_0xd56b('0xd'),JSON[_0xd56b('0xf')](_0x13447e));if(_0x13447e[_0xd56b('0x10')]){if(_0x13447e[_0xd56b('0x10')][_0xd56b('0x11')]===0x1f4){logger[_0xd56b('0x10')](_0xd56b('0x12'),_0x442791,_0x13447e[_0xd56b('0x10')][_0xd56b('0x13')]);return _0x670d9b(_0x13447e[_0xd56b('0x10')][_0xd56b('0x13')]);}logger[_0xd56b('0x10')](_0xd56b('0x12'),_0x442791,_0x13447e[_0xd56b('0x10')][_0xd56b('0x13')]);return _0x50ad75(_0x13447e['error'][_0xd56b('0x13')]);}else{logger['info'](_0xd56b('0x12'),_0x442791,_0xd56b('0xd'));_0x50ad75(_0x13447e[_0xd56b('0x14')][_0xd56b('0x13')]);}})[_0xd56b('0x15')](function(_0x472e7e){logger[_0xd56b('0x10')](_0xd56b('0x12'),_0x442791,_0x472e7e);_0x670d9b(_0x472e7e);});});}exports[_0xd56b('0x16')]=function(_0x180a1d){var _0x147e48=this;return new Promise(function(_0x5f3ea8,_0x5370df){return db['FaxQueueReport'][_0xd56b('0x17')](_0x180a1d[_0xd56b('0x18')],{'raw':_0x180a1d[_0xd56b('0x19')]?_0x180a1d[_0xd56b('0x19')][_0xd56b('0x1a')]===undefined?!![]:![]:!![]})[_0xd56b('0xc')](function(_0x477212){logger['info'](_0xd56b('0x16'),_0x180a1d);logger[_0xd56b('0xe')](_0xd56b('0x16'),_0x180a1d,JSON[_0xd56b('0xf')](_0x477212));_0x5f3ea8(_0x477212);})[_0xd56b('0x15')](function(_0x32160b){logger['error']('CreateFaxQueueReport',_0x32160b[_0xd56b('0x13')],_0x180a1d);_0x5370df(_0x147e48[_0xd56b('0x10')](0x1f4,_0x32160b['message']));});});};exports[_0xd56b('0x1b')]=function(_0x5c9cfe){var _0xdaf42a=this;return new Promise(function(_0x543aaf,_0xc9027d){return db[_0xd56b('0x1c')][_0xd56b('0x1d')](_0x5c9cfe['body'],{'raw':_0x5c9cfe[_0xd56b('0x19')]?_0x5c9cfe[_0xd56b('0x19')][_0xd56b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c9cfe[_0xd56b('0x19')]?_0x5c9cfe[_0xd56b('0x19')][_0xd56b('0x1e')]||null:null,'attributes':_0x5c9cfe[_0xd56b('0x19')]?_0x5c9cfe['options']['attributes']||null:null,'limit':_0x5c9cfe[_0xd56b('0x19')]?_0x5c9cfe[_0xd56b('0x19')][_0xd56b('0x1f')]||null:null})[_0xd56b('0xc')](function(_0x45a45d){logger[_0xd56b('0x20')](_0xd56b('0x1b'),_0x5c9cfe);logger[_0xd56b('0xe')](_0xd56b('0x1b'),_0x5c9cfe,JSON[_0xd56b('0xf')](_0x45a45d));_0x543aaf(_0x45a45d);})[_0xd56b('0x15')](function(_0x8737b4){logger['error']('UpdateFaxQueueReport',_0x8737b4[_0xd56b('0x13')],_0x5c9cfe);_0xc9027d(_0xdaf42a['error'](0x1f4,_0x8737b4['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 6ab7292..62b14a6 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 _0xc707=['delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x4c96d2,_0x51ab9f){var _0x681efc=function(_0x4405ec){while(--_0x4405ec){_0x4c96d2['push'](_0x4c96d2['shift']());}};_0x681efc(++_0x51ab9f);}(_0xc707,0xf2));var _0x7c70=function(_0x4ea728,_0x3ba8a8){_0x4ea728=_0x4ea728-0x0;var _0x290764=_0xc707[_0x4ea728];return _0x290764;};'use strict';var multer=require(_0x7c70('0x0'));var util=require(_0x7c70('0x1'));var path=require(_0x7c70('0x2'));var timeout=require(_0x7c70('0x3'));var express=require('express');var router=express[_0x7c70('0x4')]();var auth=require(_0x7c70('0x5'));var interaction=require(_0x7c70('0x6'));var config=require(_0x7c70('0x7'));var controller=require('./faxQueueReport.controller');router[_0x7c70('0x8')]('/',auth['isAuthenticated'](),controller[_0x7c70('0x9')]);router[_0x7c70('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7c70('0xa')]);router[_0x7c70('0x8')](_0x7c70('0xb'),auth[_0x7c70('0xc')](),controller[_0x7c70('0xd')]);router[_0x7c70('0xe')]('/',auth[_0x7c70('0xc')](),controller[_0x7c70('0xf')]);router[_0x7c70('0x10')](_0x7c70('0xb'),auth[_0x7c70('0xc')](),controller[_0x7c70('0x11')]);router[_0x7c70('0x12')]('/:id',auth[_0x7c70('0xc')](),controller[_0x7c70('0x13')]);module['exports']=router; \ No newline at end of file +var _0xca8c=['destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete'];(function(_0x46ee3c,_0x52fde4){var _0x43d025=function(_0x3b5715){while(--_0x3b5715){_0x46ee3c['push'](_0x46ee3c['shift']());}};_0x43d025(++_0x52fde4);}(_0xca8c,0x11f));var _0xcca8=function(_0x4959a6,_0x56f5eb){_0x4959a6=_0x4959a6-0x0;var _0x152564=_0xca8c[_0x4959a6];return _0x152564;};'use strict';var multer=require(_0xcca8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcca8('0x1'));var express=require(_0xcca8('0x2'));var router=express[_0xcca8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcca8('0x4'));var config=require(_0xcca8('0x5'));var controller=require(_0xcca8('0x6'));router[_0xcca8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcca8('0x7')](_0xcca8('0x8'),auth[_0xcca8('0x9')](),controller[_0xcca8('0xa')]);router['get'](_0xcca8('0xb'),auth[_0xcca8('0x9')](),controller['show']);router[_0xcca8('0xc')]('/',auth['isAuthenticated'](),controller[_0xcca8('0xd')]);router[_0xcca8('0xe')](_0xcca8('0xb'),auth[_0xcca8('0x9')](),controller[_0xcca8('0xf')]);router[_0xcca8('0x10')](_0xcca8('0xb'),auth[_0xcca8('0x9')](),controller[_0xcca8('0x11')]);module[_0xcca8('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index f4c46c9..f74c400 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 _0x5e0e=['agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x4cdd9d,_0x1366fc){var _0x4d9969=function(_0xa6b55d){while(--_0xa6b55d){_0x4cdd9d['push'](_0x4cdd9d['shift']());}};_0x4d9969(++_0x1366fc);}(_0x5e0e,0x11b));var _0xe5e0=function(_0xacc118,_0x3aa0d1){_0xacc118=_0xacc118-0x0;var _0x51c83d=_0x5e0e[_0xacc118];return _0x51c83d;};'use strict';var moment=require(_0xe5e0('0x0'));var Sequelize=require(_0xe5e0('0x1'));module[_0xe5e0('0x2')]={'uniqueid':{'type':Sequelize[_0xe5e0('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe5e0('0x4')]('account',_0xe5e0('0x5'),_0xe5e0('0x6')),'allowNull':![],'defaultValue':_0xe5e0('0x6')},'transferredAt':{'type':Sequelize[_0xe5e0('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xe5e0('0x8')]}}; \ No newline at end of file +var _0x4c2b=['ENUM','account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x4c2b,0x1be));var _0xb4c2=function(_0x2d6a86,_0xafc6cb){_0x2d6a86=_0x2d6a86-0x0;var _0x126e21=_0x4c2b[_0x2d6a86];return _0x126e21;};'use strict';var moment=require(_0xb4c2('0x0'));var Sequelize=require(_0xb4c2('0x1'));module[_0xb4c2('0x2')]={'uniqueid':{'type':Sequelize[_0xb4c2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb4c2('0x4')](_0xb4c2('0x5'),_0xb4c2('0x6'),'queue'),'allowNull':![],'defaultValue':_0xb4c2('0x7')},'transferredAt':{'type':Sequelize[_0xb4c2('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xb4c2('0x9')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index fcce451..2f93250 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 _0x549f=['include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','error','stack','name','send','FaxTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','add','day','merge','filter','options'];(function(_0x3a9c20,_0x4124b7){var _0x21aa7d=function(_0x252fe6){while(--_0x252fe6){_0x3a9c20['push'](_0x3a9c20['shift']());}};_0x21aa7d(++_0x4124b7);}(_0x549f,0x9d));var _0xf549=function(_0x2d2ec3,_0x59ee82){_0x2d2ec3=_0x2d2ec3-0x0;var _0x5038e6=_0x549f[_0x2d2ec3];return _0x5038e6;};'use strict';var pdf=require(_0xf549('0x0'));var emlformat=require(_0xf549('0x1'));var rimraf=require(_0xf549('0x2'));var zipdir=require(_0xf549('0x3'));var jsonpatch=require(_0xf549('0x4'));var rp=require(_0xf549('0x5'));var moment=require('moment');var BPromise=require(_0xf549('0x6'));var Mustache=require(_0xf549('0x7'));var util=require(_0xf549('0x8'));var path=require('path');var sox=require(_0xf549('0x9'));var csv=require('to-csv');var ejs=require(_0xf549('0xa'));var fs=require('fs');var _=require(_0xf549('0xb'));var squel=require(_0xf549('0xc'));var crypto=require(_0xf549('0xd'));var jsforce=require(_0xf549('0xe'));var deskjs=require(_0xf549('0xf'));var toCsv=require(_0xf549('0x10'));var querystring=require(_0xf549('0x11'));var Papa=require(_0xf549('0x12'));var Redis=require(_0xf549('0x13'));var qs=require(_0xf549('0x14'));var logger=require(_0xf549('0x15'))('api');var utils=require(_0xf549('0x16'));var config=require(_0xf549('0x17'));var db=require(_0xf549('0x18'))['db'];function respondWithStatusCode(_0x2a0504,_0x2c8c28){_0x2c8c28=_0x2c8c28||0xcc;return function(_0x5e46c9){if(_0x5e46c9){return _0x2a0504[_0xf549('0x19')](_0x2c8c28);}return _0x2a0504[_0xf549('0x1a')](_0x2c8c28)[_0xf549('0x1b')]();};}function respondWithResult(_0x1dc299,_0x35ac09){_0x35ac09=_0x35ac09||0xc8;return function(_0x21d8e2){if(_0x21d8e2){return _0x1dc299[_0xf549('0x1a')](_0x35ac09)[_0xf549('0x1c')](_0x21d8e2);}};}function respondWithFilteredResult(_0x3e136d,_0x1a50c2){return function(_0xbf43e){if(_0xbf43e){var _0x20a06f=_0xbf43e[_0xf549('0x1d')],_0xa138fd=_0x1a50c2[_0xf549('0x1e')],_0x13319c=_0x1a50c2['offset']+_0x1a50c2[_0xf549('0x1f')],_0x16205f;if(_0x13319c>=_0x20a06f){_0x13319c=_0x20a06f;_0x16205f=0xc8;}else{_0x16205f=0xce;}_0x3e136d['status'](_0x16205f);return _0x3e136d[_0xf549('0x20')](_0xf549('0x21'),_0xa138fd+'-'+_0x13319c+'/'+_0x20a06f)[_0xf549('0x1c')](_0xbf43e);}return null;};}function patchUpdates(_0x490b77){return function(_0x4018e0){try{jsonpatch['apply'](_0x4018e0,_0x490b77,!![]);}catch(_0x11afdb){return BPromise['reject'](_0x11afdb);}return _0x4018e0['save']();};}function saveUpdates(_0x21c917,_0x120e22){return function(_0x178b4a){if(_0x178b4a){return _0x178b4a[_0xf549('0x22')](_0x21c917)[_0xf549('0x23')](function(_0x1dc490){return _0x1dc490;});}return null;};}function removeEntity(_0x22d40d,_0x253823){return function(_0x54f394){if(_0x54f394){return _0x54f394[_0xf549('0x24')]()['then'](function(){_0x22d40d[_0xf549('0x1a')](0xcc)[_0xf549('0x1b')]();});}};}function handleEntityNotFound(_0x259c00,_0x11274e){return function(_0xe69c6f){if(!_0xe69c6f){_0x259c00[_0xf549('0x19')](0x194);}return _0xe69c6f;};}function handleError(_0x171316,_0x1bcc09){_0x1bcc09=_0x1bcc09||0x1f4;return function(_0x35bc6c){logger[_0xf549('0x25')](_0x35bc6c[_0xf549('0x26')]);if(_0x35bc6c[_0xf549('0x27')]){delete _0x35bc6c['name'];}_0x171316[_0xf549('0x1a')](_0x1bcc09)[_0xf549('0x28')](_0x35bc6c);};}exports['index']=function(_0x3210ef,_0x9f14ca){var _0x42fed7={},_0x559e2b={},_0x26560c={'count':0x0,'rows':[]};var _0x34a9f6=db[_0xf549('0x29')][_0xf549('0x2a')];_0x559e2b[_0xf549('0x2b')]=_[_0xf549('0x2c')](_0x34a9f6);var _0x3bc1b9={'dateStart':_0x3210ef[_0xf549('0x2d')][_0xf549('0x2e')],'dateEnd':_0x3210ef['query'][_0xf549('0x2f')]};delete _0x3210ef[_0xf549('0x2d')][_0xf549('0x2e')];delete _0x3210ef['query']['dateEnd'];_0x559e2b[_0xf549('0x2d')]=_['keys'](_0x3210ef[_0xf549('0x2d')]);_0x559e2b[_0xf549('0x30')]=_['intersection'](_0x559e2b[_0xf549('0x2b')],_0x559e2b[_0xf549('0x2d')]);_0x42fed7['attributes']=_[_0xf549('0x31')](_0x559e2b['model'],qs[_0xf549('0x32')](_0x3210ef[_0xf549('0x2d')][_0xf549('0x32')]));_0x42fed7[_0xf549('0x33')]=_0x42fed7[_0xf549('0x33')][_0xf549('0x34')]?_0x42fed7[_0xf549('0x33')]:_0x559e2b['model'];if(!_0x3210ef[_0xf549('0x2d')][_0xf549('0x35')](_0xf549('0x36'))){_0x42fed7['limit']=qs[_0xf549('0x1f')](_0x3210ef[_0xf549('0x2d')]['limit']);_0x42fed7['offset']=qs[_0xf549('0x1e')](_0x3210ef[_0xf549('0x2d')][_0xf549('0x1e')]);}_0x42fed7['order']=qs['sort'](_0x3210ef['query'][_0xf549('0x37')]);_0x42fed7[_0xf549('0x38')]=qs['filters'](_['pick'](_0x3210ef[_0xf549('0x2d')],_0x559e2b[_0xf549('0x30')]));if(_0x3bc1b9[_0xf549('0x2e')]){if(_0x3bc1b9[_0xf549('0x2f')]){_0x3bc1b9[_0xf549('0x2f')]=moment(_0x3bc1b9[_0xf549('0x2f')])[_0xf549('0x39')](0x1,_0xf549('0x3a'));}else{_0x3bc1b9['dateEnd']=moment(_0x3bc1b9[_0xf549('0x2e')])[_0xf549('0x39')](0x1,_0xf549('0x3a'));}_[_0xf549('0x3b')](_0x42fed7[_0xf549('0x38')],{'createdAt':{'$gte':_0x3bc1b9[_0xf549('0x2e')],'$lte':_0x3bc1b9['dateEnd']}});}if(_0x3210ef['query'][_0xf549('0x3c')]){_0x42fed7[_0xf549('0x38')]=_[_0xf549('0x3b')](_0x42fed7[_0xf549('0x38')],{'$or':_['map'](_0x42fed7['attributes'],function(_0xc53439){var _0x9033a6={};_0x9033a6[_0xc53439]={'$like':'%'+_0x3210ef[_0xf549('0x2d')][_0xf549('0x3c')]+'%'};return _0x9033a6;})});}_0x42fed7=_['merge']({},_0x42fed7,_0x3210ef[_0xf549('0x3d')]);var _0x20a51d={'where':_0x42fed7[_0xf549('0x38')]};return db[_0xf549('0x29')]['count'](_0x20a51d)[_0xf549('0x23')](function(_0x5f322f){_0x26560c[_0xf549('0x1d')]=_0x5f322f;if(_0x3210ef['query']['includeAll']){_0x42fed7[_0xf549('0x3e')]=[{'all':!![]}];}return db[_0xf549('0x29')][_0xf549('0x3f')](_0x42fed7);})[_0xf549('0x23')](function(_0x179c5f){_0x26560c[_0xf549('0x40')]=_0x179c5f;return _0x26560c;})[_0xf549('0x23')](respondWithFilteredResult(_0x9f14ca,_0x42fed7))[_0xf549('0x41')](handleError(_0x9f14ca,null));};exports[_0xf549('0x42')]=function(_0x198688,_0x34b09a){var _0x6c40f={'raw':!![],'where':{'id':_0x198688[_0xf549('0x43')]['id']}},_0x272073={};_0x272073[_0xf549('0x2b')]=_[_0xf549('0x2c')](db[_0xf549('0x29')]['rawAttributes']);_0x272073[_0xf549('0x2d')]=_[_0xf549('0x2c')](_0x198688[_0xf549('0x2d')]);_0x272073[_0xf549('0x30')]=_['intersection'](_0x272073['model'],_0x272073[_0xf549('0x2d')]);_0x6c40f['attributes']=_['intersection'](_0x272073['model'],qs[_0xf549('0x32')](_0x198688[_0xf549('0x2d')][_0xf549('0x32')]));_0x6c40f[_0xf549('0x33')]=_0x6c40f[_0xf549('0x33')][_0xf549('0x34')]?_0x6c40f[_0xf549('0x33')]:_0x272073['model'];if(_0x198688[_0xf549('0x2d')][_0xf549('0x44')]){_0x6c40f[_0xf549('0x3e')]=[{'all':!![]}];}_0x6c40f=_[_0xf549('0x3b')]({},_0x6c40f,_0x198688[_0xf549('0x3d')]);return db[_0xf549('0x29')]['find'](_0x6c40f)[_0xf549('0x23')](handleEntityNotFound(_0x34b09a,null))['then'](respondWithResult(_0x34b09a,null))[_0xf549('0x41')](handleError(_0x34b09a,null));};exports[_0xf549('0x45')]=function(_0x5ae03d,_0x27da7c){return db['FaxTransferReport'][_0xf549('0x45')](_0x5ae03d[_0xf549('0x46')],{})[_0xf549('0x23')](respondWithResult(_0x27da7c,0xc9))[_0xf549('0x41')](handleError(_0x27da7c,null));};exports[_0xf549('0x22')]=function(_0x1c346d,_0x387975){if(_0x1c346d['body']['id']){delete _0x1c346d[_0xf549('0x46')]['id'];}return db[_0xf549('0x29')][_0xf549('0x47')]({'where':{'id':_0x1c346d[_0xf549('0x43')]['id']}})[_0xf549('0x23')](handleEntityNotFound(_0x387975,null))[_0xf549('0x23')](saveUpdates(_0x1c346d[_0xf549('0x46')],null))[_0xf549('0x23')](respondWithResult(_0x387975,null))[_0xf549('0x41')](handleError(_0x387975,null));};exports[_0xf549('0x24')]=function(_0x326f88,_0x246799){return db[_0xf549('0x29')][_0xf549('0x47')]({'where':{'id':_0x326f88[_0xf549('0x43')]['id']}})[_0xf549('0x23')](handleEntityNotFound(_0x246799,null))[_0xf549('0x23')](removeEntity(_0x246799,null))[_0xf549('0x41')](handleError(_0x246799,null));};exports['describe']=function(_0xdb60f2,_0x3408cb){return db[_0xf549('0x29')][_0xf549('0x48')]()['then'](respondWithResult(_0x3408cb,null))[_0xf549('0x41')](handleError(_0x3408cb,null));}; \ No newline at end of file +var _0x1479=['squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','query','dateStart','dateEnd','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','add','day','merge','filter','options','FaxTransferReport','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1479,0xcf));var _0x9147=function(_0x15308,_0x3139d6){_0x15308=_0x15308-0x0;var _0x435890=_0x1479[_0x15308];return _0x435890;};'use strict';var pdf=require(_0x9147('0x0'));var emlformat=require(_0x9147('0x1'));var rimraf=require(_0x9147('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9147('0x3'));var rp=require(_0x9147('0x4'));var moment=require(_0x9147('0x5'));var BPromise=require(_0x9147('0x6'));var Mustache=require(_0x9147('0x7'));var util=require(_0x9147('0x8'));var path=require(_0x9147('0x9'));var sox=require(_0x9147('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9147('0xb'));var squel=require(_0x9147('0xc'));var crypto=require(_0x9147('0xd'));var jsforce=require(_0x9147('0xe'));var deskjs=require(_0x9147('0xf'));var toCsv=require(_0x9147('0x10'));var querystring=require('querystring');var Papa=require(_0x9147('0x11'));var Redis=require(_0x9147('0x12'));var qs=require(_0x9147('0x13'));var logger=require(_0x9147('0x14'))('api');var utils=require(_0x9147('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47ac18,_0x4656fd){_0x4656fd=_0x4656fd||0xcc;return function(_0x4df986){if(_0x4df986){return _0x47ac18[_0x9147('0x16')](_0x4656fd);}return _0x47ac18[_0x9147('0x17')](_0x4656fd)[_0x9147('0x18')]();};}function respondWithResult(_0x569aa2,_0x14a0f7){_0x14a0f7=_0x14a0f7||0xc8;return function(_0x2240c8){if(_0x2240c8){return _0x569aa2['status'](_0x14a0f7)[_0x9147('0x19')](_0x2240c8);}};}function respondWithFilteredResult(_0x3815dc,_0x22a52f){return function(_0x119cec){if(_0x119cec){var _0x400f88=_0x119cec[_0x9147('0x1a')],_0x26ab5c=_0x22a52f[_0x9147('0x1b')],_0x123632=_0x22a52f[_0x9147('0x1b')]+_0x22a52f['limit'],_0x3424ec;if(_0x123632>=_0x400f88){_0x123632=_0x400f88;_0x3424ec=0xc8;}else{_0x3424ec=0xce;}_0x3815dc['status'](_0x3424ec);return _0x3815dc[_0x9147('0x1c')](_0x9147('0x1d'),_0x26ab5c+'-'+_0x123632+'/'+_0x400f88)['json'](_0x119cec);}return null;};}function patchUpdates(_0xe0f03){return function(_0x55336e){try{jsonpatch[_0x9147('0x1e')](_0x55336e,_0xe0f03,!![]);}catch(_0x15cd0e){return BPromise[_0x9147('0x1f')](_0x15cd0e);}return _0x55336e[_0x9147('0x20')]();};}function saveUpdates(_0x4756b1,_0x123361){return function(_0x53e2dc){if(_0x53e2dc){return _0x53e2dc['update'](_0x4756b1)[_0x9147('0x21')](function(_0x2b8022){return _0x2b8022;});}return null;};}function removeEntity(_0x533332,_0x35735d){return function(_0x1542c2){if(_0x1542c2){return _0x1542c2[_0x9147('0x22')]()[_0x9147('0x21')](function(){_0x533332['status'](0xcc)[_0x9147('0x18')]();});}};}function handleEntityNotFound(_0x8e12d0,_0x6dcb2c){return function(_0x3e82b2){if(!_0x3e82b2){_0x8e12d0[_0x9147('0x16')](0x194);}return _0x3e82b2;};}function handleError(_0x389ef2,_0x40eb51){_0x40eb51=_0x40eb51||0x1f4;return function(_0x10b0d5){logger[_0x9147('0x23')](_0x10b0d5[_0x9147('0x24')]);if(_0x10b0d5['name']){delete _0x10b0d5[_0x9147('0x25')];}_0x389ef2[_0x9147('0x17')](_0x40eb51)[_0x9147('0x26')](_0x10b0d5);};}exports[_0x9147('0x27')]=function(_0xf777eb,_0x51041c){var _0x1cfb4e={},_0x3213ec={},_0x36e4ac={'count':0x0,'rows':[]};var _0x4876a3=db['FaxTransferReport']['rawAttributes'];_0x3213ec['model']=_['keys'](_0x4876a3);var _0x52e69d={'dateStart':_0xf777eb[_0x9147('0x28')][_0x9147('0x29')],'dateEnd':_0xf777eb[_0x9147('0x28')][_0x9147('0x2a')]};delete _0xf777eb[_0x9147('0x28')][_0x9147('0x29')];delete _0xf777eb[_0x9147('0x28')][_0x9147('0x2a')];_0x3213ec[_0x9147('0x28')]=_['keys'](_0xf777eb[_0x9147('0x28')]);_0x3213ec[_0x9147('0x2b')]=_['intersection'](_0x3213ec[_0x9147('0x2c')],_0x3213ec[_0x9147('0x28')]);_0x1cfb4e[_0x9147('0x2d')]=_[_0x9147('0x2e')](_0x3213ec['model'],qs[_0x9147('0x2f')](_0xf777eb[_0x9147('0x28')][_0x9147('0x2f')]));_0x1cfb4e['attributes']=_0x1cfb4e[_0x9147('0x2d')][_0x9147('0x30')]?_0x1cfb4e[_0x9147('0x2d')]:_0x3213ec[_0x9147('0x2c')];if(!_0xf777eb[_0x9147('0x28')][_0x9147('0x31')]('nolimit')){_0x1cfb4e[_0x9147('0x32')]=qs[_0x9147('0x32')](_0xf777eb[_0x9147('0x28')][_0x9147('0x32')]);_0x1cfb4e['offset']=qs['offset'](_0xf777eb['query'][_0x9147('0x1b')]);}_0x1cfb4e[_0x9147('0x33')]=qs[_0x9147('0x34')](_0xf777eb['query']['sort']);_0x1cfb4e[_0x9147('0x35')]=qs['filters'](_[_0x9147('0x36')](_0xf777eb['query'],_0x3213ec[_0x9147('0x2b')]));if(_0x52e69d[_0x9147('0x29')]){if(_0x52e69d[_0x9147('0x2a')]){_0x52e69d['dateEnd']=moment(_0x52e69d[_0x9147('0x2a')])[_0x9147('0x37')](0x1,_0x9147('0x38'));}else{_0x52e69d['dateEnd']=moment(_0x52e69d[_0x9147('0x29')])['add'](0x1,_0x9147('0x38'));}_[_0x9147('0x39')](_0x1cfb4e[_0x9147('0x35')],{'createdAt':{'$gte':_0x52e69d[_0x9147('0x29')],'$lte':_0x52e69d['dateEnd']}});}if(_0xf777eb[_0x9147('0x28')][_0x9147('0x3a')]){_0x1cfb4e[_0x9147('0x35')]=_[_0x9147('0x39')](_0x1cfb4e[_0x9147('0x35')],{'$or':_['map'](_0x1cfb4e[_0x9147('0x2d')],function(_0x287028){var _0x312782={};_0x312782[_0x287028]={'$like':'%'+_0xf777eb[_0x9147('0x28')][_0x9147('0x3a')]+'%'};return _0x312782;})});}_0x1cfb4e=_[_0x9147('0x39')]({},_0x1cfb4e,_0xf777eb[_0x9147('0x3b')]);var _0xb447e3={'where':_0x1cfb4e[_0x9147('0x35')]};return db[_0x9147('0x3c')][_0x9147('0x1a')](_0xb447e3)[_0x9147('0x21')](function(_0x1c3386){_0x36e4ac[_0x9147('0x1a')]=_0x1c3386;if(_0xf777eb['query'][_0x9147('0x3d')]){_0x1cfb4e[_0x9147('0x3e')]=[{'all':!![]}];}return db[_0x9147('0x3c')][_0x9147('0x3f')](_0x1cfb4e);})[_0x9147('0x21')](function(_0x3bc165){_0x36e4ac[_0x9147('0x40')]=_0x3bc165;return _0x36e4ac;})[_0x9147('0x21')](respondWithFilteredResult(_0x51041c,_0x1cfb4e))[_0x9147('0x41')](handleError(_0x51041c,null));};exports['show']=function(_0xadcff6,_0x41c091){var _0x598bc8={'raw':!![],'where':{'id':_0xadcff6[_0x9147('0x42')]['id']}},_0x13317a={};_0x13317a[_0x9147('0x2c')]=_[_0x9147('0x43')](db[_0x9147('0x3c')][_0x9147('0x44')]);_0x13317a[_0x9147('0x28')]=_[_0x9147('0x43')](_0xadcff6[_0x9147('0x28')]);_0x13317a[_0x9147('0x2b')]=_[_0x9147('0x2e')](_0x13317a[_0x9147('0x2c')],_0x13317a['query']);_0x598bc8[_0x9147('0x2d')]=_[_0x9147('0x2e')](_0x13317a['model'],qs[_0x9147('0x2f')](_0xadcff6[_0x9147('0x28')][_0x9147('0x2f')]));_0x598bc8[_0x9147('0x2d')]=_0x598bc8['attributes']['length']?_0x598bc8[_0x9147('0x2d')]:_0x13317a[_0x9147('0x2c')];if(_0xadcff6[_0x9147('0x28')][_0x9147('0x3d')]){_0x598bc8['include']=[{'all':!![]}];}_0x598bc8=_[_0x9147('0x39')]({},_0x598bc8,_0xadcff6[_0x9147('0x3b')]);return db[_0x9147('0x3c')]['find'](_0x598bc8)[_0x9147('0x21')](handleEntityNotFound(_0x41c091,null))[_0x9147('0x21')](respondWithResult(_0x41c091,null))[_0x9147('0x41')](handleError(_0x41c091,null));};exports['create']=function(_0x47b777,_0x142073){return db[_0x9147('0x3c')][_0x9147('0x45')](_0x47b777[_0x9147('0x46')],{})['then'](respondWithResult(_0x142073,0xc9))[_0x9147('0x41')](handleError(_0x142073,null));};exports['update']=function(_0x115c71,_0x318fed){if(_0x115c71[_0x9147('0x46')]['id']){delete _0x115c71['body']['id'];}return db[_0x9147('0x3c')][_0x9147('0x47')]({'where':{'id':_0x115c71[_0x9147('0x42')]['id']}})[_0x9147('0x21')](handleEntityNotFound(_0x318fed,null))['then'](saveUpdates(_0x115c71[_0x9147('0x46')],null))['then'](respondWithResult(_0x318fed,null))['catch'](handleError(_0x318fed,null));};exports[_0x9147('0x22')]=function(_0x58e3b7,_0x52f951){return db[_0x9147('0x3c')][_0x9147('0x47')]({'where':{'id':_0x58e3b7[_0x9147('0x42')]['id']}})[_0x9147('0x21')](handleEntityNotFound(_0x52f951,null))[_0x9147('0x21')](removeEntity(_0x52f951,null))[_0x9147('0x41')](handleError(_0x52f951,null));};exports[_0x9147('0x48')]=function(_0x5ce7e9,_0x3cb653){return db[_0x9147('0x3c')][_0x9147('0x48')]()[_0x9147('0x21')](respondWithResult(_0x3cb653,null))[_0x9147('0x41')](handleError(_0x3cb653,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 56995f8..8f2967a 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 _0x77de=['bluebird','./faxTransferReport.attributes','exports','uniqueid','lodash','../../config/logger'];(function(_0x6170b7,_0x3edff5){var _0x34842c=function(_0x2d066e){while(--_0x2d066e){_0x6170b7['push'](_0x6170b7['shift']());}};_0x34842c(++_0x3edff5);}(_0x77de,0x17e));var _0xe77d=function(_0x115621,_0x341cde){_0x115621=_0x115621-0x0;var _0x5ef5ce=_0x77de[_0x115621];return _0x5ef5ce;};'use strict';var _=require(_0xe77d('0x0'));var util=require('util');var logger=require(_0xe77d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe77d('0x2'));var rp=require('request-promise');var attributes=require(_0xe77d('0x3'));module[_0xe77d('0x4')]=function(_0x21af1e,_0x29ea2b){return _0x21af1e['define']('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xe77d('0x5'),'fields':[_0xe77d('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc0d=['moment','request-promise','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xfc0d,0x104));var _0xdfc0=function(_0x5a93d9,_0x246b9b){_0x5a93d9=_0x5a93d9-0x0;var _0x56b33e=_0xfc0d[_0x5a93d9];return _0x56b33e;};'use strict';var _=require(_0xdfc0('0x0'));var util=require(_0xdfc0('0x1'));var logger=require(_0xdfc0('0x2'))(_0xdfc0('0x3'));var moment=require(_0xdfc0('0x4'));var BPromise=require('bluebird');var rp=require(_0xdfc0('0x5'));var attributes=require(_0xdfc0('0x6'));module['exports']=function(_0x8e5faa,_0x439ada){return _0x8e5faa[_0xdfc0('0x7')](_0xdfc0('0x8'),attributes,{'tableName':_0xdfc0('0x9'),'paranoid':![],'indexes':[{'name':_0xdfc0('0xa'),'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 da6f7af..3efd3b8 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 _0x1e50=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment'];(function(_0x7f746b,_0x394196){var _0x1b71d9=function(_0x44e04c){while(--_0x44e04c){_0x7f746b['push'](_0x7f746b['shift']());}};_0x1b71d9(++_0x394196);}(_0x1e50,0x19c));var _0x01e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e50[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x01e5('0x0'));var moment=require(_0x01e5('0x1'));var BPromise=require(_0x01e5('0x2'));var rs=require(_0x01e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01e5('0x4'))['db'];var utils=require(_0x01e5('0x5'));var logger=require(_0x01e5('0x6'))(_0x01e5('0x7'));var config=require(_0x01e5('0x8'));var jayson=require(_0x01e5('0x9'));var client=jayson[_0x01e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8182,_0xe23ef9,_0x3e47ce){return new BPromise(function(_0x390589,_0x29eca5){return client[_0x01e5('0xb')](_0x3f8182,_0x3e47ce)[_0x01e5('0xc')](function(_0x29a828){logger[_0x01e5('0xd')](_0x01e5('0xe'),_0xe23ef9,_0x01e5('0xf'));logger[_0x01e5('0x10')](_0x01e5('0x11'),_0xe23ef9,'request\x20sent',JSON[_0x01e5('0x12')](_0x29a828));if(_0x29a828[_0x01e5('0x13')]){if(_0x29a828[_0x01e5('0x13')][_0x01e5('0x14')]===0x1f4){logger[_0x01e5('0x13')](_0x01e5('0xe'),_0xe23ef9,_0x29a828[_0x01e5('0x13')][_0x01e5('0x15')]);return _0x29eca5(_0x29a828[_0x01e5('0x13')][_0x01e5('0x15')]);}logger[_0x01e5('0x13')](_0x01e5('0xe'),_0xe23ef9,_0x29a828[_0x01e5('0x13')][_0x01e5('0x15')]);return _0x390589(_0x29a828[_0x01e5('0x13')]['message']);}else{logger[_0x01e5('0xd')](_0x01e5('0xe'),_0xe23ef9,_0x01e5('0xf'));_0x390589(_0x29a828[_0x01e5('0x16')][_0x01e5('0x15')]);}})['catch'](function(_0x43327e){logger[_0x01e5('0x13')](_0x01e5('0xe'),_0xe23ef9,_0x43327e);_0x29eca5(_0x43327e);});});} \ No newline at end of file +var _0xd44e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x2cae28,_0x2d8ce7){var _0xaed4ab=function(_0x33acf9){while(--_0x33acf9){_0x2cae28['push'](_0x2cae28['shift']());}};_0xaed4ab(++_0x2d8ce7);}(_0xd44e,0x194));var _0xed44=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd44e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed44('0x0'));var BPromise=require(_0xed44('0x1'));var rs=require(_0xed44('0x2'));var fs=require('fs');var Redis=require(_0xed44('0x3'));var db=require(_0xed44('0x4'))['db'];var utils=require(_0xed44('0x5'));var logger=require(_0xed44('0x6'))(_0xed44('0x7'));var config=require(_0xed44('0x8'));var jayson=require(_0xed44('0x9'));var client=jayson['client'][_0xed44('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50db07,_0x1905d8,_0x13d30f){return new BPromise(function(_0x319713,_0x39e480){return client[_0xed44('0xb')](_0x50db07,_0x13d30f)[_0xed44('0xc')](function(_0x27735b){logger[_0xed44('0xd')](_0xed44('0xe'),_0x1905d8,_0xed44('0xf'));logger[_0xed44('0x10')](_0xed44('0x11'),_0x1905d8,_0xed44('0xf'),JSON[_0xed44('0x12')](_0x27735b));if(_0x27735b[_0xed44('0x13')]){if(_0x27735b[_0xed44('0x13')][_0xed44('0x14')]===0x1f4){logger[_0xed44('0x13')](_0xed44('0xe'),_0x1905d8,_0x27735b['error'][_0xed44('0x15')]);return _0x39e480(_0x27735b['error'][_0xed44('0x15')]);}logger[_0xed44('0x13')](_0xed44('0xe'),_0x1905d8,_0x27735b[_0xed44('0x13')][_0xed44('0x15')]);return _0x319713(_0x27735b[_0xed44('0x13')][_0xed44('0x15')]);}else{logger[_0xed44('0xd')](_0xed44('0xe'),_0x1905d8,_0xed44('0xf'));_0x319713(_0x27735b[_0xed44('0x16')][_0xed44('0x15')]);}})[_0xed44('0x17')](function(_0x530181){logger[_0xed44('0x13')](_0xed44('0xe'),_0x1905d8,_0x530181);_0x39e480(_0x530181);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index d9d9dda..4ef42c0 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 _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x53eac1,_0xa638db){var _0x285f52=function(_0x361af6){while(--_0x361af6){_0x53eac1['push'](_0x53eac1['shift']());}};_0x285f52(++_0xa638db);}(_0x34e8,0x12c));var _0x834e=function(_0xe670bd,_0x5bf6a1){_0xe670bd=_0xe670bd-0x0;var _0x55a10a=_0x34e8[_0xe670bd];return _0x55a10a;};'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')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x10')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x11')]);router[_0x834e('0x12')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0e85=['../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0e85,0x7c));var _0x50e8=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0e85[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x50e8('0x4'));var controller=require('./faxTransferReport.controller');router[_0x50e8('0x5')]('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0x7')]);router[_0x50e8('0x5')]('/describe',auth[_0x50e8('0x6')](),controller[_0x50e8('0x8')]);router[_0x50e8('0x5')](_0x50e8('0x9'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xa')]);router['post']('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0xb')]);router[_0x50e8('0xc')](_0x50e8('0x9'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xd')]);router[_0x50e8('0xe')](_0x50e8('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x50e8('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index a13a25c..178851a 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 _0x3320=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x3320,0x87));var _0x0332=function(_0x2c29c1,_0x44e05e){_0x2c29c1=_0x2c29c1-0x0;var _0x23ab89=_0x3320[_0x2c29c1];return _0x23ab89;};'use strict';var multer=require(_0x0332('0x0'));var util=require(_0x0332('0x1'));var path=require(_0x0332('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0332('0x3'));var interaction=require(_0x0332('0x4'));var config=require(_0x0332('0x5'));var controller=require(_0x0332('0x6'));router[_0x0332('0x7')]('/',auth[_0x0332('0x8')](),controller[_0x0332('0x9')]);router[_0x0332('0x7')]('/:id',auth[_0x0332('0x8')](),controller[_0x0332('0xa')]);router[_0x0332('0x7')](_0x0332('0xb'),auth[_0x0332('0x8')](),controller[_0x0332('0xc')]);router[_0x0332('0x7')](_0x0332('0xd'),auth[_0x0332('0x8')](),controller[_0x0332('0xe')]);router[_0x0332('0xf')]('/',auth[_0x0332('0x8')](),controller[_0x0332('0x10')]);router['post'](_0x0332('0xb'),auth[_0x0332('0x8')](),controller[_0x0332('0x11')]);router['put'](_0x0332('0x12'),auth[_0x0332('0x8')](),controller[_0x0332('0x13')]);router[_0x0332('0x14')]('/:id',auth[_0x0332('0x8')](),controller[_0x0332('0x15')]);module[_0x0332('0x16')]=router; \ No newline at end of file +var _0xcdb3=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2e5834,_0x543a64){var _0x30d87e=function(_0xfb3884){while(--_0xfb3884){_0x2e5834['push'](_0x2e5834['shift']());}};_0x30d87e(++_0x543a64);}(_0xcdb3,0x68));var _0x3cdb=function(_0xbb8a19,_0x2d8c7f){_0xbb8a19=_0xbb8a19-0x0;var _0x2f4ee0=_0xcdb3[_0xbb8a19];return _0x2f4ee0;};'use strict';var multer=require('multer');var util=require(_0x3cdb('0x0'));var path=require('path');var timeout=require(_0x3cdb('0x1'));var express=require('express');var router=express[_0x3cdb('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x3cdb('0x3'));var config=require(_0x3cdb('0x4'));var controller=require('./intDeskAccount.controller');router[_0x3cdb('0x5')]('/',auth[_0x3cdb('0x6')](),controller[_0x3cdb('0x7')]);router[_0x3cdb('0x5')]('/:id',auth[_0x3cdb('0x6')](),controller['show']);router['get'](_0x3cdb('0x8'),auth[_0x3cdb('0x6')](),controller['getConfigurations']);router[_0x3cdb('0x5')](_0x3cdb('0x9'),auth['isAuthenticated'](),controller[_0x3cdb('0xa')]);router[_0x3cdb('0xb')]('/',auth[_0x3cdb('0x6')](),controller[_0x3cdb('0xc')]);router[_0x3cdb('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x3cdb('0xd')]);router['put'](_0x3cdb('0xe'),auth['isAuthenticated'](),controller[_0x3cdb('0xf')]);router['delete'](_0x3cdb('0xe'),auth[_0x3cdb('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 397600d..6a0c507 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 _0x264b=['exports','STRING','basic','ENUM','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x264b,0x9a));var _0xb264=function(_0x44e5cb,_0x19b7ae){_0x44e5cb=_0x44e5cb-0x0;var _0x2019b1=_0x264b[_0x44e5cb];return _0x2019b1;};'use strict';var Sequelize=require(_0xb264('0x0'));module[_0xb264('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb264('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xb264('0x3')),'defaultValue':_0xb264('0x3')},'password':{'type':Sequelize[_0xb264('0x2')]},'consumerKey':{'type':Sequelize[_0xb264('0x2')]},'consumerSecret':{'type':Sequelize[_0xb264('0x2')]},'token':{'type':Sequelize[_0xb264('0x2')]},'tokenSecret':{'type':Sequelize[_0xb264('0x2')]},'serverUrl':{'type':Sequelize[_0xb264('0x2')]},'type':{'type':Sequelize[_0xb264('0x4')]('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x916b=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x916b,0x122));var _0xb916=function(_0x440951,_0x5b2798){_0x440951=_0x440951-0x0;var _0x24f90f=_0x916b[_0x440951];return _0x24f90f;};'use strict';var Sequelize=require(_0xb916('0x0'));module[_0xb916('0x1')]={'name':{'type':Sequelize[_0xb916('0x2')]},'description':{'type':Sequelize[_0xb916('0x2')]},'username':{'type':Sequelize[_0xb916('0x2')]},'remoteUri':{'type':Sequelize[_0xb916('0x2')]},'authType':{'type':Sequelize[_0xb916('0x3')](_0xb916('0x4')),'defaultValue':_0xb916('0x4')},'password':{'type':Sequelize[_0xb916('0x2')]},'consumerKey':{'type':Sequelize[_0xb916('0x2')]},'consumerSecret':{'type':Sequelize[_0xb916('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xb916('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb916('0x3')](_0xb916('0x5'),_0xb916('0x6')),'defaultValue':_0xb916('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 5354044..57deafc 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 _0x7d25=['token','tokenSecret','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','map','_embedded','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','DeskAccount','rawAttributes','model','dateStart','query','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','includeAll','include','findAll','rows','show','params','options','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','type','getDescriptions','DeskConfiguration','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerSecret'];(function(_0xfc37c3,_0x5a3934){var _0x1149c7=function(_0x2087e0){while(--_0x2087e0){_0xfc37c3['push'](_0xfc37c3['shift']());}};_0x1149c7(++_0x5a3934);}(_0x7d25,0x8a));var _0x57d2=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x7d25[_0x7e2eb0];return _0xd92de4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x57d2('0x0'));var rimraf=require(_0x57d2('0x1'));var zipdir=require(_0x57d2('0x2'));var jsonpatch=require(_0x57d2('0x3'));var rp=require(_0x57d2('0x4'));var moment=require(_0x57d2('0x5'));var BPromise=require(_0x57d2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x57d2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0x7'));var querystring=require('querystring');var Papa=require(_0x57d2('0xb'));var Redis=require(_0x57d2('0xc'));var qs=require(_0x57d2('0xd'));var logger=require('../../config/logger')(_0x57d2('0xe'));var utils=require(_0x57d2('0xf'));var config=require(_0x57d2('0x10'));var db=require(_0x57d2('0x11'))['db'];var integrations=require(_0x57d2('0x12'));var jayson=require(_0x57d2('0x13'));var client=jayson[_0x57d2('0x14')][_0x57d2('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x43d7fb,_0x32c33a,_0x28428b,_0x3181ad){return new BPromise(function(_0x6940ef,_0x229734){var _0x1ba57e=_0x3181ad||client;return _0x1ba57e[_0x57d2('0x16')](_0x43d7fb,_0x28428b)['then'](function(_0x5b940e){logger[_0x57d2('0x17')](_0x57d2('0x18'),_0x32c33a,'request\x20sent');logger[_0x57d2('0x19')](_0x57d2('0x1a'),_0x32c33a,'request\x20sent',JSON[_0x57d2('0x1b')](_0x5b940e));if(_0x5b940e['error']){if(_0x5b940e[_0x57d2('0x1c')]['code']===0x1f4){logger[_0x57d2('0x1c')](_0x57d2('0x18'),_0x32c33a,_0x5b940e[_0x57d2('0x1c')]['message']);return _0x229734(_0x5b940e['error'][_0x57d2('0x1d')]);}logger[_0x57d2('0x1c')](_0x57d2('0x18'),_0x32c33a,_0x5b940e[_0x57d2('0x1c')]['message']);return _0x6940ef(_0x5b940e[_0x57d2('0x1c')][_0x57d2('0x1d')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x32c33a,_0x57d2('0x1e'));_0x6940ef(_0x5b940e[_0x57d2('0x1f')][_0x57d2('0x1d')]);}})[_0x57d2('0x20')](function(_0x386196){logger[_0x57d2('0x1c')](_0x57d2('0x18'),_0x32c33a,_0x386196);_0x229734(_0x386196);});});}function respondWithStatusCode(_0x31d2cf,_0x112fbe){_0x112fbe=_0x112fbe||0xcc;return function(_0x26718e){if(_0x26718e){return _0x31d2cf[_0x57d2('0x21')](_0x112fbe);}return _0x31d2cf[_0x57d2('0x22')](_0x112fbe)[_0x57d2('0x23')]();};}function respondWithResult(_0x473df2,_0x5327ea){_0x5327ea=_0x5327ea||0xc8;return function(_0x424ddc){if(_0x424ddc){return _0x473df2[_0x57d2('0x22')](_0x5327ea)[_0x57d2('0x24')](_0x424ddc);}};}function respondWithFilteredResult(_0x452d5e,_0x4363b3){return function(_0x5058be){if(_0x5058be){var _0x1d203c=_0x5058be[_0x57d2('0x25')],_0x608b10=_0x4363b3[_0x57d2('0x26')],_0x995928=_0x4363b3[_0x57d2('0x26')]+_0x4363b3['limit'],_0x16ee2f;if(_0x995928>=_0x1d203c){_0x995928=_0x1d203c;_0x16ee2f=0xc8;}else{_0x16ee2f=0xce;}_0x452d5e[_0x57d2('0x22')](_0x16ee2f);return _0x452d5e[_0x57d2('0x27')](_0x57d2('0x28'),_0x608b10+'-'+_0x995928+'/'+_0x1d203c)[_0x57d2('0x24')](_0x5058be);}return null;};}function patchUpdates(_0x1957a6){return function(_0x7c33f3){try{jsonpatch[_0x57d2('0x29')](_0x7c33f3,_0x1957a6,!![]);}catch(_0x1d3a3a){return BPromise[_0x57d2('0x2a')](_0x1d3a3a);}return _0x7c33f3[_0x57d2('0x2b')]();};}function saveUpdates(_0x574589,_0x4e9178){return function(_0x3da926){if(_0x3da926){return _0x3da926[_0x57d2('0x2c')](_0x574589)[_0x57d2('0x2d')](function(_0x484597){return _0x484597;});}return null;};}function removeEntity(_0x1d7fe7,_0x1fa0aa){return function(_0x21152e){if(_0x21152e){return _0x21152e[_0x57d2('0x2e')]()[_0x57d2('0x2d')](function(){_0x1d7fe7[_0x57d2('0x22')](0xcc)[_0x57d2('0x23')]();});}};}function handleEntityNotFound(_0x36c0d7,_0x319fcf){return function(_0x581cf7){if(!_0x581cf7){_0x36c0d7[_0x57d2('0x21')](0x194);}return _0x581cf7;};}function handleError(_0x213c99,_0x4f5923){_0x4f5923=_0x4f5923||0x1f4;return function(_0xcf7e0e){logger[_0x57d2('0x1c')](_0xcf7e0e['stack']);if(_0xcf7e0e[_0x57d2('0x2f')]){delete _0xcf7e0e[_0x57d2('0x2f')];}_0x213c99[_0x57d2('0x22')](_0x4f5923)[_0x57d2('0x30')](_0xcf7e0e);};}exports[_0x57d2('0x31')]=function(_0x5184d9,_0x4c14df){var _0x581ebc={},_0x5001c5={},_0x371939={'count':0x0,'rows':[]};var _0x39f54b=db[_0x57d2('0x32')][_0x57d2('0x33')];_0x5001c5[_0x57d2('0x34')]=_['keys'](_0x39f54b);var _0x375a83={'dateStart':_0x5184d9['query'][_0x57d2('0x35')],'dateEnd':_0x5184d9[_0x57d2('0x36')][_0x57d2('0x37')]};delete _0x5184d9['query'][_0x57d2('0x35')];delete _0x5184d9[_0x57d2('0x36')]['dateEnd'];_0x5001c5[_0x57d2('0x36')]=_[_0x57d2('0x38')](_0x5184d9[_0x57d2('0x36')]);_0x5001c5[_0x57d2('0x39')]=_[_0x57d2('0x3a')](_0x5001c5[_0x57d2('0x34')],_0x5001c5['query']);_0x581ebc[_0x57d2('0x3b')]=_['intersection'](_0x5001c5[_0x57d2('0x34')],qs[_0x57d2('0x3c')](_0x5184d9[_0x57d2('0x36')][_0x57d2('0x3c')]));_0x581ebc[_0x57d2('0x3b')]=_0x581ebc['attributes'][_0x57d2('0x3d')]?_0x581ebc[_0x57d2('0x3b')]:_0x5001c5['model'];if(!_0x5184d9[_0x57d2('0x36')][_0x57d2('0x3e')](_0x57d2('0x3f'))){_0x581ebc['limit']=qs[_0x57d2('0x40')](_0x5184d9[_0x57d2('0x36')][_0x57d2('0x40')]);_0x581ebc[_0x57d2('0x26')]=qs['offset'](_0x5184d9['query'][_0x57d2('0x26')]);}_0x581ebc[_0x57d2('0x41')]=qs[_0x57d2('0x42')](_0x5184d9['query']['sort']);_0x581ebc[_0x57d2('0x43')]=qs['filters'](_[_0x57d2('0x44')](_0x5184d9[_0x57d2('0x36')],_0x5001c5[_0x57d2('0x39')]));if(_0x375a83[_0x57d2('0x35')]){if(_0x375a83[_0x57d2('0x37')]){_0x375a83['dateEnd']=moment(_0x375a83[_0x57d2('0x37')])[_0x57d2('0x45')](0x1,'day');}else{_0x375a83[_0x57d2('0x37')]=moment(_0x375a83['dateStart'])[_0x57d2('0x45')](0x1,_0x57d2('0x46'));}_[_0x57d2('0x47')](_0x581ebc[_0x57d2('0x43')],{'createdAt':{'$gte':_0x375a83['dateStart'],'$lte':_0x375a83['dateEnd']}});}if(_0x5184d9[_0x57d2('0x36')]['filter']){_0x581ebc['where']=_[_0x57d2('0x47')](_0x581ebc['where'],{'$or':_['map'](_0x581ebc[_0x57d2('0x3b')],function(_0x5180c3){var _0x3cddfd={};_0x3cddfd[_0x5180c3]={'$like':'%'+_0x5184d9['query'][_0x57d2('0x48')]+'%'};return _0x3cddfd;})});}_0x581ebc=_['merge']({},_0x581ebc,_0x5184d9['options']);var _0x1090de={'where':_0x581ebc[_0x57d2('0x43')]};return db[_0x57d2('0x32')][_0x57d2('0x25')](_0x1090de)[_0x57d2('0x2d')](function(_0x198623){_0x371939['count']=_0x198623;if(_0x5184d9[_0x57d2('0x36')][_0x57d2('0x49')]){_0x581ebc[_0x57d2('0x4a')]=[{'all':!![]}];}return db[_0x57d2('0x32')][_0x57d2('0x4b')](_0x581ebc);})[_0x57d2('0x2d')](function(_0x69ebf7){_0x371939[_0x57d2('0x4c')]=_0x69ebf7;return _0x371939;})['then'](respondWithFilteredResult(_0x4c14df,_0x581ebc))[_0x57d2('0x20')](handleError(_0x4c14df,null));};exports[_0x57d2('0x4d')]=function(_0x57c5d1,_0x3f9a3f){var _0x5b06f7={'raw':![],'where':{'id':_0x57c5d1[_0x57d2('0x4e')]['id']}},_0x59a6eb={};_0x59a6eb[_0x57d2('0x34')]=_[_0x57d2('0x38')](db[_0x57d2('0x32')]['rawAttributes']);_0x59a6eb[_0x57d2('0x36')]=_[_0x57d2('0x38')](_0x57c5d1['query']);_0x59a6eb['filters']=_[_0x57d2('0x3a')](_0x59a6eb[_0x57d2('0x34')],_0x59a6eb[_0x57d2('0x36')]);_0x5b06f7[_0x57d2('0x3b')]=_[_0x57d2('0x3a')](_0x59a6eb[_0x57d2('0x34')],qs['fields'](_0x57c5d1['query']['fields']));_0x5b06f7[_0x57d2('0x3b')]=_0x5b06f7['attributes'][_0x57d2('0x3d')]?_0x5b06f7[_0x57d2('0x3b')]:_0x59a6eb['model'];if(_0x57c5d1[_0x57d2('0x36')][_0x57d2('0x49')]){_0x5b06f7[_0x57d2('0x4a')]=[{'all':!![]}];}_0x5b06f7=_['merge']({},_0x5b06f7,_0x57c5d1[_0x57d2('0x4f')]);return db[_0x57d2('0x32')][_0x57d2('0x50')](_0x5b06f7)[_0x57d2('0x2d')](handleEntityNotFound(_0x3f9a3f,null))[_0x57d2('0x2d')](respondWithResult(_0x3f9a3f,null))[_0x57d2('0x20')](handleError(_0x3f9a3f,null));};exports[_0x57d2('0x51')]=function(_0x2b93c4,_0x183ae8){return db['DeskAccount'][_0x57d2('0x51')](_0x2b93c4[_0x57d2('0x52')],{})[_0x57d2('0x2d')](respondWithResult(_0x183ae8,0xc9))['catch'](handleError(_0x183ae8,null));};exports[_0x57d2('0x2c')]=function(_0x3b12c9,_0x52ad94){if(_0x3b12c9['body']['id']){delete _0x3b12c9['body']['id'];}return db['DeskAccount'][_0x57d2('0x50')]({'where':{'id':_0x3b12c9['params']['id']}})[_0x57d2('0x2d')](handleEntityNotFound(_0x52ad94,null))['then'](saveUpdates(_0x3b12c9[_0x57d2('0x52')],null))['then'](respondWithResult(_0x52ad94,null))[_0x57d2('0x20')](handleError(_0x52ad94,null));};exports[_0x57d2('0x2e')]=function(_0x1a051a,_0x54640d){return db['DeskAccount'][_0x57d2('0x50')]({'where':{'id':_0x1a051a[_0x57d2('0x4e')]['id']}})[_0x57d2('0x2d')](handleEntityNotFound(_0x54640d,null))[_0x57d2('0x2d')](removeEntity(_0x54640d,null))[_0x57d2('0x20')](handleError(_0x54640d,null));};exports[_0x57d2('0x53')]=function(_0x4a2208,_0x58301e,_0x2040c0){var _0x6951d8={};var _0x2606ef={};var _0xf6d1bd;var _0x586f33;return db['DeskAccount'][_0x57d2('0x54')]({'where':{'id':_0x4a2208[_0x57d2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x58301e,null))[_0x57d2('0x2d')](function(_0x28fcdb){if(_0x28fcdb){_0xf6d1bd=_0x28fcdb;_0x2606ef[_0x57d2('0x34')]=_[_0x57d2('0x38')](db['DeskConfiguration']['rawAttributes']);_0x2606ef['query']=_['keys'](_0x4a2208[_0x57d2('0x36')]);_0x2606ef[_0x57d2('0x39')]=_[_0x57d2('0x3a')](_0x2606ef[_0x57d2('0x34')],_0x2606ef[_0x57d2('0x36')]);_0x6951d8[_0x57d2('0x3b')]=_[_0x57d2('0x3a')](_0x2606ef['model'],qs[_0x57d2('0x3c')](_0x4a2208['query'][_0x57d2('0x3c')]));_0x6951d8['attributes']=_0x6951d8[_0x57d2('0x3b')][_0x57d2('0x3d')]?_0x6951d8[_0x57d2('0x3b')]:_0x2606ef[_0x57d2('0x34')];_0x6951d8[_0x57d2('0x41')]=qs[_0x57d2('0x42')](_0x4a2208['query'][_0x57d2('0x42')]);_0x6951d8[_0x57d2('0x43')]=qs[_0x57d2('0x39')](_[_0x57d2('0x44')](_0x4a2208[_0x57d2('0x36')],_0x2606ef[_0x57d2('0x39')]));if(_0x4a2208[_0x57d2('0x36')][_0x57d2('0x48')]){_0x6951d8[_0x57d2('0x43')]=_['merge'](_0x6951d8[_0x57d2('0x43')],{'$or':_['map'](_0x6951d8['attributes'],function(_0x4b41a2){var _0x270de8={};_0x270de8[_0x4b41a2]={'$like':'%'+_0x4a2208['query'][_0x57d2('0x48')]+'%'};return _0x270de8;})});}_0x6951d8=_[_0x57d2('0x47')]({},_0x6951d8,_0x4a2208['options']);return _0xf6d1bd[_0x57d2('0x53')](_0x6951d8);}})[_0x57d2('0x2d')](function(_0x3ea517){if(_0x3ea517){_0x586f33=_0x3ea517[_0x57d2('0x3d')];if(!_0x4a2208['query'][_0x57d2('0x3e')](_0x57d2('0x3f'))){_0x6951d8['limit']=qs['limit'](_0x4a2208[_0x57d2('0x36')][_0x57d2('0x40')]);_0x6951d8['offset']=qs[_0x57d2('0x26')](_0x4a2208[_0x57d2('0x36')][_0x57d2('0x26')]);}return _0xf6d1bd[_0x57d2('0x53')](_0x6951d8);}})[_0x57d2('0x2d')](function(_0x3899b8){if(_0x3899b8){return _0x3899b8?{'count':_0x586f33,'rows':_0x3899b8}:null;}})[_0x57d2('0x2d')](respondWithResult(_0x58301e,null))[_0x57d2('0x20')](handleError(_0x58301e,null));};exports[_0x57d2('0x55')]=function(_0x3bec6f,_0x22f977,_0x1d7850){if(_0x3bec6f[_0x57d2('0x52')]['id']){delete _0x3bec6f['body']['id'];}return db[_0x57d2('0x32')][_0x57d2('0x54')]({'where':{'id':_0x3bec6f[_0x57d2('0x4e')]['id']}})[_0x57d2('0x2d')](handleEntityNotFound(_0x22f977,null))[_0x57d2('0x2d')](function(_0x2583d4){if(_0x2583d4){_0x3bec6f[_0x57d2('0x52')][_0x57d2('0x56')]=_0x2583d4['id'];_0x3bec6f[_0x57d2('0x52')][_0x57d2('0x57')]=integrations[_0x57d2('0x58')](_0x3bec6f[_0x57d2('0x52')][_0x57d2('0x59')],_0x3bec6f[_0x57d2('0x52')][_0x57d2('0x5a')]);_0x3bec6f[_0x57d2('0x52')]['Descriptions']=integrations[_0x57d2('0x5b')](_0x3bec6f[_0x57d2('0x52')]['channel'],_0x3bec6f[_0x57d2('0x52')][_0x57d2('0x5a')]);return db[_0x57d2('0x5c')][_0x57d2('0x51')](_0x3bec6f['body'],{'include':[{'model':db[_0x57d2('0x5d')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x57d2('0x5e')}]});}return null;})['then'](respondWithResult(_0x22f977,null))[_0x57d2('0x20')](handleError(_0x22f977,null));};exports[_0x57d2('0x5f')]=function(_0x199995,_0x31fa1b,_0x4ea1b4){var _0xd0191b=[{'name':_0x57d2('0x60'),'label':_0x57d2('0x60'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];return db[_0x57d2('0x32')][_0x57d2('0x54')]({'where':{'id':_0x199995[_0x57d2('0x4e')]['id']},'attributes':['id',_0x57d2('0x61'),_0x57d2('0x62'),_0x57d2('0x63'),_0x57d2('0x64'),'consumerKey',_0x57d2('0x65'),_0x57d2('0x66'),_0x57d2('0x67')]})[_0x57d2('0x2d')](handleEntityNotFound(_0x31fa1b,null))[_0x57d2('0x2d')](function(_0x1375fa){if(_0x1375fa){var _0x3052a3={'method':_0x57d2('0x68'),'uri':util[_0x57d2('0x69')](_0x57d2('0x6a'),_0x1375fa[_0x57d2('0x61')]),'headers':{'Content-Type':_0x57d2('0x6b'),'Accept':'application/json'},'json':!![]};if(_0x1375fa['authType']===_0x57d2('0x6c')){_0x3052a3[_0x57d2('0x6d')][_0x57d2('0x6e')]=util[_0x57d2('0x69')](_0x57d2('0x6f'),new Buffer(util['format']('%s:%s',_0x1375fa[_0x57d2('0x63')],_0x1375fa[_0x57d2('0x64')]))[_0x57d2('0x70')](_0x57d2('0x71')));}return rp(_0x3052a3)[_0x57d2('0x2d')](function(_0x41376b){return _0xd0191b['concat'](_[_0x57d2('0x72')](_0x41376b[_0x57d2('0x73')]['entries'],function(_0x4913c0){return{'id':_0x4913c0['name'],'name':_0x4913c0['name'],'type':_0x4913c0[_0x57d2('0x5a')],'active':_0x4913c0['active'],'label':_0x4913c0[_0x57d2('0x74')],'custom':!![]};}));});}})['then'](function(_0x404eee){return{'count':_0x404eee[_0x57d2('0x3d')],'rows':_0x404eee};})[_0x57d2('0x2d')](respondWithResult(_0x31fa1b,null))[_0x57d2('0x20')](function(_0x4d9291){var _0x57da59=_0x199995[_0x57d2('0x36')][_0x57d2('0x75')]?0x1f4:_0x4d9291[_0x57d2('0x76')]||0x1f4;logger['error'](_0x57d2('0x77'),_0x57d2('0x5f'),_0x57da59,JSON[_0x57d2('0x1b')](_0x4d9291));delete _0x4d9291[_0x57d2('0x2f')];if(_0x57da59===0x191){_0x57da59=0x190;}_0x31fa1b[_0x57d2('0x22')](_0x57da59)[_0x57d2('0x30')](_0x199995[_0x57d2('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4d9291['statusCode']}:_0x4d9291);});}; \ No newline at end of file +var _0x5423=['statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','DeskAccount','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','catch','show','params','create','body','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','type','Descriptions','DeskConfiguration','DeskField','getFields','priority','findOne','remoteUri','authType','username','password','consumerKey','consumerSecret','token','GET','format','%s/custom_fields','application/json','headers','%s:%s','toString','base64','concat','entries','active','label','test'];(function(_0x42f442,_0x2d6289){var _0x365ef7=function(_0x1c5420){while(--_0x1c5420){_0x42f442['push'](_0x42f442['shift']());}};_0x365ef7(++_0x2d6289);}(_0x5423,0xe3));var _0x3542=function(_0x3616cd,_0x179c32){_0x3616cd=_0x3616cd-0x0;var _0x2ee87b=_0x5423[_0x3616cd];return _0x2ee87b;};'use strict';var pdf=require(_0x3542('0x0'));var emlformat=require(_0x3542('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3542('0x2'));var jsonpatch=require(_0x3542('0x3'));var rp=require('request-promise');var moment=require(_0x3542('0x4'));var BPromise=require(_0x3542('0x5'));var Mustache=require(_0x3542('0x6'));var util=require(_0x3542('0x7'));var path=require('path');var sox=require(_0x3542('0x8'));var csv=require(_0x3542('0x9'));var ejs=require(_0x3542('0xa'));var fs=require('fs');var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x9'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x3542('0x10'))(_0x3542('0x11'));var utils=require('../../config/utils');var config=require(_0x3542('0x12'));var db=require(_0x3542('0x13'))['db'];var integrations=require(_0x3542('0x14'));var jayson=require(_0x3542('0x15'));var client=jayson[_0x3542('0x16')][_0x3542('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1cf710,_0x43e977,_0x4ee86,_0x1a9062){return new BPromise(function(_0x7488d8,_0x14d7c3){var _0x15863d=_0x1a9062||client;return _0x15863d['request'](_0x1cf710,_0x4ee86)[_0x3542('0x18')](function(_0x4fb366){logger[_0x3542('0x19')](_0x3542('0x1a'),_0x43e977,_0x3542('0x1b'));logger['debug'](_0x3542('0x1c'),_0x43e977,_0x3542('0x1b'),JSON[_0x3542('0x1d')](_0x4fb366));if(_0x4fb366['error']){if(_0x4fb366[_0x3542('0x1e')][_0x3542('0x1f')]===0x1f4){logger[_0x3542('0x1e')](_0x3542('0x1a'),_0x43e977,_0x4fb366['error'][_0x3542('0x20')]);return _0x14d7c3(_0x4fb366['error'][_0x3542('0x20')]);}logger[_0x3542('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x43e977,_0x4fb366[_0x3542('0x1e')][_0x3542('0x20')]);return _0x7488d8(_0x4fb366[_0x3542('0x1e')][_0x3542('0x20')]);}else{logger[_0x3542('0x19')]('DeskAccount,\x20%s,\x20%s',_0x43e977,'request\x20sent');_0x7488d8(_0x4fb366['result'][_0x3542('0x20')]);}})['catch'](function(_0x1d5488){logger['error'](_0x3542('0x1a'),_0x43e977,_0x1d5488);_0x14d7c3(_0x1d5488);});});}function respondWithStatusCode(_0x55774d,_0x4ccefa){_0x4ccefa=_0x4ccefa||0xcc;return function(_0x3eacd0){if(_0x3eacd0){return _0x55774d[_0x3542('0x21')](_0x4ccefa);}return _0x55774d['status'](_0x4ccefa)['end']();};}function respondWithResult(_0x3fc964,_0x5123f0){_0x5123f0=_0x5123f0||0xc8;return function(_0x160caa){if(_0x160caa){return _0x3fc964[_0x3542('0x22')](_0x5123f0)[_0x3542('0x23')](_0x160caa);}};}function respondWithFilteredResult(_0x2f2e63,_0x298763){return function(_0xf1f7d0){if(_0xf1f7d0){var _0x412184=_0xf1f7d0[_0x3542('0x24')],_0x1e156e=_0x298763[_0x3542('0x25')],_0x18dc6c=_0x298763[_0x3542('0x25')]+_0x298763[_0x3542('0x26')],_0x2841a1;if(_0x18dc6c>=_0x412184){_0x18dc6c=_0x412184;_0x2841a1=0xc8;}else{_0x2841a1=0xce;}_0x2f2e63[_0x3542('0x22')](_0x2841a1);return _0x2f2e63[_0x3542('0x27')](_0x3542('0x28'),_0x1e156e+'-'+_0x18dc6c+'/'+_0x412184)[_0x3542('0x23')](_0xf1f7d0);}return null;};}function patchUpdates(_0x3bd666){return function(_0x5590a2){try{jsonpatch[_0x3542('0x29')](_0x5590a2,_0x3bd666,!![]);}catch(_0x35bbc9){return BPromise[_0x3542('0x2a')](_0x35bbc9);}return _0x5590a2['save']();};}function saveUpdates(_0x402c97,_0xc6f23b){return function(_0x2e883a){if(_0x2e883a){return _0x2e883a[_0x3542('0x2b')](_0x402c97)['then'](function(_0x5a274b){return _0x5a274b;});}return null;};}function removeEntity(_0x20c4b9,_0x326498){return function(_0xd19bf4){if(_0xd19bf4){return _0xd19bf4[_0x3542('0x2c')]()[_0x3542('0x18')](function(){_0x20c4b9[_0x3542('0x22')](0xcc)[_0x3542('0x2d')]();});}};}function handleEntityNotFound(_0x49b18a,_0x4b5338){return function(_0x27ec86){if(!_0x27ec86){_0x49b18a['sendStatus'](0x194);}return _0x27ec86;};}function handleError(_0x4ec0c1,_0x2902b8){_0x2902b8=_0x2902b8||0x1f4;return function(_0x500398){logger['error'](_0x500398[_0x3542('0x2e')]);if(_0x500398[_0x3542('0x2f')]){delete _0x500398[_0x3542('0x2f')];}_0x4ec0c1['status'](_0x2902b8)[_0x3542('0x30')](_0x500398);};}exports['index']=function(_0x15ae5a,_0x25591b){var _0x561fd0={},_0x3a0027={},_0x487514={'count':0x0,'rows':[]};var _0x204e5e=db[_0x3542('0x31')][_0x3542('0x32')];_0x3a0027['model']=_[_0x3542('0x33')](_0x204e5e);var _0x546c5f={'dateStart':_0x15ae5a[_0x3542('0x34')][_0x3542('0x35')],'dateEnd':_0x15ae5a[_0x3542('0x34')][_0x3542('0x36')]};delete _0x15ae5a[_0x3542('0x34')][_0x3542('0x35')];delete _0x15ae5a[_0x3542('0x34')][_0x3542('0x36')];_0x3a0027[_0x3542('0x34')]=_[_0x3542('0x33')](_0x15ae5a[_0x3542('0x34')]);_0x3a0027[_0x3542('0x37')]=_[_0x3542('0x38')](_0x3a0027['model'],_0x3a0027[_0x3542('0x34')]);_0x561fd0['attributes']=_['intersection'](_0x3a0027[_0x3542('0x39')],qs[_0x3542('0x3a')](_0x15ae5a[_0x3542('0x34')][_0x3542('0x3a')]));_0x561fd0[_0x3542('0x3b')]=_0x561fd0[_0x3542('0x3b')][_0x3542('0x3c')]?_0x561fd0[_0x3542('0x3b')]:_0x3a0027['model'];if(!_0x15ae5a[_0x3542('0x34')]['hasOwnProperty'](_0x3542('0x3d'))){_0x561fd0[_0x3542('0x26')]=qs['limit'](_0x15ae5a[_0x3542('0x34')][_0x3542('0x26')]);_0x561fd0['offset']=qs[_0x3542('0x25')](_0x15ae5a[_0x3542('0x34')]['offset']);}_0x561fd0[_0x3542('0x3e')]=qs[_0x3542('0x3f')](_0x15ae5a[_0x3542('0x34')][_0x3542('0x3f')]);_0x561fd0[_0x3542('0x40')]=qs[_0x3542('0x37')](_[_0x3542('0x41')](_0x15ae5a['query'],_0x3a0027['filters']));if(_0x546c5f[_0x3542('0x35')]){if(_0x546c5f[_0x3542('0x36')]){_0x546c5f[_0x3542('0x36')]=moment(_0x546c5f[_0x3542('0x36')])[_0x3542('0x42')](0x1,'day');}else{_0x546c5f[_0x3542('0x36')]=moment(_0x546c5f['dateStart'])[_0x3542('0x42')](0x1,_0x3542('0x43'));}_[_0x3542('0x44')](_0x561fd0['where'],{'createdAt':{'$gte':_0x546c5f[_0x3542('0x35')],'$lte':_0x546c5f[_0x3542('0x36')]}});}if(_0x15ae5a['query'][_0x3542('0x45')]){_0x561fd0[_0x3542('0x40')]=_[_0x3542('0x44')](_0x561fd0[_0x3542('0x40')],{'$or':_[_0x3542('0x46')](_0x561fd0[_0x3542('0x3b')],function(_0x2da4f4){var _0x3c9918={};_0x3c9918[_0x2da4f4]={'$like':'%'+_0x15ae5a['query']['filter']+'%'};return _0x3c9918;})});}_0x561fd0=_['merge']({},_0x561fd0,_0x15ae5a[_0x3542('0x47')]);var _0x3b48a4={'where':_0x561fd0[_0x3542('0x40')]};return db[_0x3542('0x31')][_0x3542('0x24')](_0x3b48a4)[_0x3542('0x18')](function(_0x7dbe54){_0x487514['count']=_0x7dbe54;if(_0x15ae5a[_0x3542('0x34')][_0x3542('0x48')]){_0x561fd0[_0x3542('0x49')]=[{'all':!![]}];}return db[_0x3542('0x31')]['findAll'](_0x561fd0);})[_0x3542('0x18')](function(_0x1d8184){_0x487514['rows']=_0x1d8184;return _0x487514;})['then'](respondWithFilteredResult(_0x25591b,_0x561fd0))[_0x3542('0x4a')](handleError(_0x25591b,null));};exports[_0x3542('0x4b')]=function(_0x18bd0d,_0x44a577){var _0x244f3a={'raw':![],'where':{'id':_0x18bd0d[_0x3542('0x4c')]['id']}},_0x1a2ecf={};_0x1a2ecf['model']=_[_0x3542('0x33')](db[_0x3542('0x31')][_0x3542('0x32')]);_0x1a2ecf[_0x3542('0x34')]=_[_0x3542('0x33')](_0x18bd0d[_0x3542('0x34')]);_0x1a2ecf[_0x3542('0x37')]=_[_0x3542('0x38')](_0x1a2ecf[_0x3542('0x39')],_0x1a2ecf['query']);_0x244f3a['attributes']=_[_0x3542('0x38')](_0x1a2ecf['model'],qs['fields'](_0x18bd0d['query'][_0x3542('0x3a')]));_0x244f3a[_0x3542('0x3b')]=_0x244f3a[_0x3542('0x3b')]['length']?_0x244f3a[_0x3542('0x3b')]:_0x1a2ecf[_0x3542('0x39')];if(_0x18bd0d['query'][_0x3542('0x48')]){_0x244f3a[_0x3542('0x49')]=[{'all':!![]}];}_0x244f3a=_[_0x3542('0x44')]({},_0x244f3a,_0x18bd0d[_0x3542('0x47')]);return db[_0x3542('0x31')]['find'](_0x244f3a)[_0x3542('0x18')](handleEntityNotFound(_0x44a577,null))[_0x3542('0x18')](respondWithResult(_0x44a577,null))[_0x3542('0x4a')](handleError(_0x44a577,null));};exports[_0x3542('0x4d')]=function(_0xbf9a5,_0x532ab9){return db['DeskAccount'][_0x3542('0x4d')](_0xbf9a5[_0x3542('0x4e')],{})[_0x3542('0x18')](respondWithResult(_0x532ab9,0xc9))['catch'](handleError(_0x532ab9,null));};exports[_0x3542('0x2b')]=function(_0x30ed1a,_0x274722){if(_0x30ed1a[_0x3542('0x4e')]['id']){delete _0x30ed1a[_0x3542('0x4e')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x30ed1a[_0x3542('0x4c')]['id']}})['then'](handleEntityNotFound(_0x274722,null))[_0x3542('0x18')](saveUpdates(_0x30ed1a[_0x3542('0x4e')],null))['then'](respondWithResult(_0x274722,null))[_0x3542('0x4a')](handleError(_0x274722,null));};exports[_0x3542('0x2c')]=function(_0x265b79,_0x26227b){return db[_0x3542('0x31')]['find']({'where':{'id':_0x265b79['params']['id']}})[_0x3542('0x18')](handleEntityNotFound(_0x26227b,null))['then'](removeEntity(_0x26227b,null))[_0x3542('0x4a')](handleError(_0x26227b,null));};exports[_0x3542('0x4f')]=function(_0x219922,_0x5e353c,_0xd9c90c){var _0x1f8ddb={};var _0x17c8f7={};var _0x3c3220;var _0x1bf743;return db[_0x3542('0x31')]['findOne']({'where':{'id':_0x219922[_0x3542('0x4c')]['id']}})[_0x3542('0x18')](handleEntityNotFound(_0x5e353c,null))[_0x3542('0x18')](function(_0x411de1){if(_0x411de1){_0x3c3220=_0x411de1;_0x17c8f7[_0x3542('0x39')]=_[_0x3542('0x33')](db['DeskConfiguration'][_0x3542('0x32')]);_0x17c8f7[_0x3542('0x34')]=_[_0x3542('0x33')](_0x219922[_0x3542('0x34')]);_0x17c8f7['filters']=_[_0x3542('0x38')](_0x17c8f7[_0x3542('0x39')],_0x17c8f7['query']);_0x1f8ddb['attributes']=_[_0x3542('0x38')](_0x17c8f7['model'],qs[_0x3542('0x3a')](_0x219922['query']['fields']));_0x1f8ddb[_0x3542('0x3b')]=_0x1f8ddb[_0x3542('0x3b')][_0x3542('0x3c')]?_0x1f8ddb[_0x3542('0x3b')]:_0x17c8f7[_0x3542('0x39')];_0x1f8ddb[_0x3542('0x3e')]=qs[_0x3542('0x3f')](_0x219922['query'][_0x3542('0x3f')]);_0x1f8ddb[_0x3542('0x40')]=qs[_0x3542('0x37')](_[_0x3542('0x41')](_0x219922[_0x3542('0x34')],_0x17c8f7['filters']));if(_0x219922[_0x3542('0x34')][_0x3542('0x45')]){_0x1f8ddb[_0x3542('0x40')]=_[_0x3542('0x44')](_0x1f8ddb[_0x3542('0x40')],{'$or':_[_0x3542('0x46')](_0x1f8ddb[_0x3542('0x3b')],function(_0x498b22){var _0x3410dd={};_0x3410dd[_0x498b22]={'$like':'%'+_0x219922['query'][_0x3542('0x45')]+'%'};return _0x3410dd;})});}_0x1f8ddb=_[_0x3542('0x44')]({},_0x1f8ddb,_0x219922[_0x3542('0x47')]);return _0x3c3220[_0x3542('0x4f')](_0x1f8ddb);}})['then'](function(_0x47c624){if(_0x47c624){_0x1bf743=_0x47c624['length'];if(!_0x219922[_0x3542('0x34')][_0x3542('0x50')](_0x3542('0x3d'))){_0x1f8ddb[_0x3542('0x26')]=qs[_0x3542('0x26')](_0x219922[_0x3542('0x34')][_0x3542('0x26')]);_0x1f8ddb[_0x3542('0x25')]=qs[_0x3542('0x25')](_0x219922['query'][_0x3542('0x25')]);}return _0x3c3220[_0x3542('0x4f')](_0x1f8ddb);}})[_0x3542('0x18')](function(_0x2d41dc){if(_0x2d41dc){return _0x2d41dc?{'count':_0x1bf743,'rows':_0x2d41dc}:null;}})[_0x3542('0x18')](respondWithResult(_0x5e353c,null))['catch'](handleError(_0x5e353c,null));};exports['addConfiguration']=function(_0x51b83c,_0x2accb8,_0x52c26d){if(_0x51b83c[_0x3542('0x4e')]['id']){delete _0x51b83c['body']['id'];}return db[_0x3542('0x31')]['findOne']({'where':{'id':_0x51b83c[_0x3542('0x4c')]['id']}})[_0x3542('0x18')](handleEntityNotFound(_0x2accb8,null))['then'](function(_0x5e3d4e){if(_0x5e3d4e){_0x51b83c['body'][_0x3542('0x51')]=_0x5e3d4e['id'];_0x51b83c['body'][_0x3542('0x52')]=integrations[_0x3542('0x53')](_0x51b83c['body'][_0x3542('0x54')],_0x51b83c[_0x3542('0x4e')][_0x3542('0x55')]);_0x51b83c['body'][_0x3542('0x56')]=integrations['getDescriptions'](_0x51b83c[_0x3542('0x4e')]['channel'],_0x51b83c[_0x3542('0x4e')][_0x3542('0x55')]);return db[_0x3542('0x57')]['create'](_0x51b83c[_0x3542('0x4e')],{'include':[{'model':db[_0x3542('0x58')],'as':_0x3542('0x52')},{'model':db[_0x3542('0x58')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2accb8,null))[_0x3542('0x4a')](handleError(_0x2accb8,null));};exports[_0x3542('0x59')]=function(_0x40ee94,_0xaa97d5,_0x191fdd){var _0x33c517=[{'name':_0x3542('0x5a'),'label':_0x3542('0x5a'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];return db[_0x3542('0x31')][_0x3542('0x5b')]({'where':{'id':_0x40ee94[_0x3542('0x4c')]['id']},'attributes':['id',_0x3542('0x5c'),_0x3542('0x5d'),_0x3542('0x5e'),_0x3542('0x5f'),_0x3542('0x60'),_0x3542('0x61'),_0x3542('0x62'),'tokenSecret']})[_0x3542('0x18')](handleEntityNotFound(_0xaa97d5,null))[_0x3542('0x18')](function(_0x5ca834){if(_0x5ca834){var _0x5149ab={'method':_0x3542('0x63'),'uri':util[_0x3542('0x64')](_0x3542('0x65'),_0x5ca834[_0x3542('0x5c')]),'headers':{'Content-Type':'application/json','Accept':_0x3542('0x66')},'json':!![]};if(_0x5ca834[_0x3542('0x5d')]==='basic'){_0x5149ab[_0x3542('0x67')]['Authorization']=util[_0x3542('0x64')]('Basic\x20%s',new Buffer(util[_0x3542('0x64')](_0x3542('0x68'),_0x5ca834[_0x3542('0x5e')],_0x5ca834[_0x3542('0x5f')]))[_0x3542('0x69')](_0x3542('0x6a')));}return rp(_0x5149ab)[_0x3542('0x18')](function(_0x59e3bc){return _0x33c517[_0x3542('0x6b')](_['map'](_0x59e3bc['_embedded'][_0x3542('0x6c')],function(_0x1a9a73){return{'id':_0x1a9a73[_0x3542('0x2f')],'name':_0x1a9a73[_0x3542('0x2f')],'type':_0x1a9a73['type'],'active':_0x1a9a73[_0x3542('0x6d')],'label':_0x1a9a73[_0x3542('0x6e')],'custom':!![]};}));});}})[_0x3542('0x18')](function(_0xcc8e59){return{'count':_0xcc8e59[_0x3542('0x3c')],'rows':_0xcc8e59};})[_0x3542('0x18')](respondWithResult(_0xaa97d5,null))[_0x3542('0x4a')](function(_0x3b6eb5){var _0x46396d=_0x40ee94[_0x3542('0x34')]['test']?0x1f4:_0x3b6eb5['statusCode']||0x1f4;logger[_0x3542('0x1e')]('getFields,\x20%s,\x20%s,\x20%s',_0x3542('0x59'),_0x46396d,JSON[_0x3542('0x1d')](_0x3b6eb5));delete _0x3b6eb5[_0x3542('0x2f')];if(_0x46396d===0x191){_0x46396d=0x190;}_0xaa97d5['status'](_0x46396d)[_0x3542('0x30')](_0x40ee94[_0x3542('0x34')][_0x3542('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x3b6eb5[_0x3542('0x70')]}:_0x3b6eb5);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f4a9e39..af07eda 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 _0x1fcc=['bluebird','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','api','moment'];(function(_0x42db9f,_0xb51d40){var _0xe18e5e=function(_0x314ace){while(--_0x314ace){_0x42db9f['push'](_0x42db9f['shift']());}};_0xe18e5e(++_0xb51d40);}(_0x1fcc,0x125));var _0xc1fc=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x1fcc[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xc1fc('0x0'));var util=require(_0xc1fc('0x1'));var logger=require('../../config/logger')(_0xc1fc('0x2'));var moment=require(_0xc1fc('0x3'));var BPromise=require(_0xc1fc('0x4'));var rp=require(_0xc1fc('0x5'));var attributes=require(_0xc1fc('0x6'));var integrations=require(_0xc1fc('0x7'));module[_0xc1fc('0x8')]=function(_0x51605f,_0x205d03){return _0x51605f[_0xc1fc('0x9')](_0xc1fc('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9eb=['../../config/logger','api','moment','bluebird','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','util'];(function(_0x4839d0,_0x3dcaa2){var _0x42223c=function(_0x1a0560){while(--_0x1a0560){_0x4839d0['push'](_0x4839d0['shift']());}};_0x42223c(++_0x3dcaa2);}(_0xd9eb,0xca));var _0xbd9e=function(_0x5dbb2,_0x1e3317){_0x5dbb2=_0x5dbb2-0x0;var _0x4ba922=_0xd9eb[_0x5dbb2];return _0x4ba922;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var logger=require(_0xbd9e('0x2'))(_0xbd9e('0x3'));var moment=require(_0xbd9e('0x4'));var BPromise=require(_0xbd9e('0x5'));var rp=require(_0xbd9e('0x6'));var attributes=require(_0xbd9e('0x7'));var integrations=require(_0xbd9e('0x8'));module[_0xbd9e('0x9')]=function(_0x365865,_0xf09b45){return _0x365865[_0xbd9e('0xa')]('DeskAccount',attributes,{'tableName':_0xbd9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 40c1e19..98e427d 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 _0xd664=['rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetDeskAccount','catch','find','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x2f470f,_0x167e3f){var _0x396ca5=function(_0x2f3ea1){while(--_0x2f3ea1){_0x2f470f['push'](_0x2f470f['shift']());}};_0x396ca5(++_0x167e3f);}(_0xd664,0xa5));var _0x4d66=function(_0x3af359,_0x207995){_0x3af359=_0x3af359-0x0;var _0x443024=_0xd664[_0x3af359];return _0x443024;};'use strict';var _=require(_0x4d66('0x0'));var util=require(_0x4d66('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d66('0x2'));var db=require(_0x4d66('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d66('0x4'))(_0x4d66('0x5'));var config=require(_0x4d66('0x6'));var jayson=require(_0x4d66('0x7'));var client=jayson[_0x4d66('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3853,_0x2b7a3b,_0x2f85c8){return new BPromise(function(_0x5d913c,_0x92cbea){return client[_0x4d66('0x9')](_0x1b3853,_0x2f85c8)[_0x4d66('0xa')](function(_0xcea314){logger[_0x4d66('0xb')](_0x4d66('0xc'),_0x2b7a3b,'request\x20sent');logger[_0x4d66('0xd')](_0x4d66('0xe'),_0x2b7a3b,_0x4d66('0xf'),JSON[_0x4d66('0x10')](_0xcea314));if(_0xcea314[_0x4d66('0x11')]){if(_0xcea314[_0x4d66('0x11')][_0x4d66('0x12')]===0x1f4){logger[_0x4d66('0x11')](_0x4d66('0xc'),_0x2b7a3b,_0xcea314[_0x4d66('0x11')][_0x4d66('0x13')]);return _0x92cbea(_0xcea314[_0x4d66('0x11')][_0x4d66('0x13')]);}logger[_0x4d66('0x11')]('DeskAccount,\x20%s,\x20%s',_0x2b7a3b,_0xcea314[_0x4d66('0x11')]['message']);return _0x5d913c(_0xcea314[_0x4d66('0x11')][_0x4d66('0x13')]);}else{logger[_0x4d66('0xb')]('DeskAccount,\x20%s,\x20%s',_0x2b7a3b,_0x4d66('0xf'));_0x5d913c(_0xcea314[_0x4d66('0x14')][_0x4d66('0x13')]);}})['catch'](function(_0xbd27f2){logger[_0x4d66('0x11')](_0x4d66('0xc'),_0x2b7a3b,_0xbd27f2);_0x92cbea(_0xbd27f2);});});}exports['GetDeskAccount']=function(_0x2c621a){var _0x2e5fb3=this;return new Promise(function(_0x152c7f,_0x10d696){return db[_0x4d66('0x15')][_0x4d66('0x16')]({'raw':_0x2c621a[_0x4d66('0x17')]?_0x2c621a[_0x4d66('0x17')][_0x4d66('0x18')]===undefined?!![]:![]:!![],'where':_0x2c621a['options']?_0x2c621a[_0x4d66('0x17')][_0x4d66('0x19')]||null:null,'attributes':_0x2c621a[_0x4d66('0x17')]?_0x2c621a[_0x4d66('0x17')][_0x4d66('0x1a')]||null:null,'limit':_0x2c621a['options']?_0x2c621a[_0x4d66('0x17')][_0x4d66('0x1b')]||null:null,'include':_0x2c621a[_0x4d66('0x17')]?_0x2c621a[_0x4d66('0x17')]['include']?_[_0x4d66('0x1c')](_0x2c621a[_0x4d66('0x17')][_0x4d66('0x1d')],function(_0x2e3393){return{'model':db[_0x2e3393['model']],'as':_0x2e3393['as'],'attributes':_0x2e3393[_0x4d66('0x1a')],'include':_0x2e3393[_0x4d66('0x1d')]?_['map'](_0x2e3393['include'],function(_0x3266aa){return{'model':db[_0x3266aa['model']],'as':_0x3266aa['as'],'attributes':_0x3266aa[_0x4d66('0x1a')],'include':_0x3266aa['include']?_['map'](_0x3266aa[_0x4d66('0x1d')],function(_0x5063ba){return{'model':db[_0x5063ba[_0x4d66('0x1e')]],'as':_0x5063ba['as'],'attributes':_0x5063ba['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d66('0xa')](function(_0x25943e){logger[_0x4d66('0xb')](_0x4d66('0x1f'),_0x2c621a);logger['debug'](_0x4d66('0x1f'),_0x2c621a,JSON[_0x4d66('0x10')](_0x25943e));_0x152c7f(_0x25943e);})[_0x4d66('0x20')](function(_0x1043fa){logger[_0x4d66('0x11')]('GetDeskAccount',_0x1043fa['message'],_0x2c621a);_0x10d696(_0x2e5fb3['error'](0x1f4,_0x1043fa['message']));});});};exports['ShowDeskAccount']=function(_0x14abf6){var _0x48a524=this;return new Promise(function(_0x3d1c3e,_0x354c47){return db[_0x4d66('0x15')][_0x4d66('0x21')]({'raw':_0x14abf6[_0x4d66('0x17')]?_0x14abf6[_0x4d66('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x14abf6[_0x4d66('0x17')]?_0x14abf6[_0x4d66('0x17')][_0x4d66('0x19')]||null:null,'attributes':_0x14abf6[_0x4d66('0x17')]?_0x14abf6[_0x4d66('0x17')][_0x4d66('0x1a')]||null:null,'include':_0x14abf6[_0x4d66('0x17')]?_0x14abf6[_0x4d66('0x17')][_0x4d66('0x1d')]?_[_0x4d66('0x1c')](_0x14abf6[_0x4d66('0x17')][_0x4d66('0x1d')],function(_0x1a25ff){return{'model':db[_0x1a25ff['model']],'as':_0x1a25ff['as'],'attributes':_0x1a25ff[_0x4d66('0x1a')],'include':_0x1a25ff[_0x4d66('0x1d')]?_['map'](_0x1a25ff[_0x4d66('0x1d')],function(_0x4b18f7){return{'model':db[_0x4b18f7['model']],'as':_0x4b18f7['as'],'attributes':_0x4b18f7['attributes'],'include':_0x4b18f7[_0x4d66('0x1d')]?_[_0x4d66('0x1c')](_0x4b18f7[_0x4d66('0x1d')],function(_0xf0d5eb){return{'model':db[_0xf0d5eb[_0x4d66('0x1e')]],'as':_0xf0d5eb['as'],'attributes':_0xf0d5eb[_0x4d66('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4d66('0xa')](function(_0x383978){logger[_0x4d66('0xb')]('ShowDeskAccount',_0x14abf6);logger['debug']('ShowDeskAccount',_0x14abf6,JSON[_0x4d66('0x10')](_0x383978));_0x3d1c3e(_0x383978);})[_0x4d66('0x20')](function(_0x1965b3){logger[_0x4d66('0x11')]('ShowDeskAccount',_0x1965b3['message'],_0x14abf6);_0x354c47(_0x48a524[_0x4d66('0x11')](0x1f4,_0x1965b3[_0x4d66('0x13')]));});});}; \ No newline at end of file +var _0xe195=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','DeskAccount','findAll','options','raw','limit','include','map','model','attributes','then','info','GetDeskAccount','ShowDeskAccount','find','moment'];(function(_0x5c5cfa,_0x37d7c7){var _0x2c64a2=function(_0x48af81){while(--_0x48af81){_0x5c5cfa['push'](_0x5c5cfa['shift']());}};_0x2c64a2(++_0x37d7c7);}(_0xe195,0x1c6));var _0x5e19=function(_0x28926b,_0x44abbd){_0x28926b=_0x28926b-0x0;var _0x461040=_0xe195[_0x28926b];return _0x461040;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e19('0x0'));var BPromise=require(_0x5e19('0x1'));var rs=require(_0x5e19('0x2'));var fs=require('fs');var Redis=require(_0x5e19('0x3'));var db=require(_0x5e19('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e19('0x5'))(_0x5e19('0x6'));var config=require(_0x5e19('0x7'));var jayson=require(_0x5e19('0x8'));var client=jayson[_0x5e19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ca278,_0x50b913,_0x1e40c4){return new BPromise(function(_0x21e440,_0x377428){return client[_0x5e19('0xa')](_0x2ca278,_0x1e40c4)['then'](function(_0x3a1974){logger['info'](_0x5e19('0xb'),_0x50b913,_0x5e19('0xc'));logger[_0x5e19('0xd')](_0x5e19('0xe'),_0x50b913,_0x5e19('0xc'),JSON[_0x5e19('0xf')](_0x3a1974));if(_0x3a1974[_0x5e19('0x10')]){if(_0x3a1974['error'][_0x5e19('0x11')]===0x1f4){logger[_0x5e19('0x10')](_0x5e19('0xb'),_0x50b913,_0x3a1974[_0x5e19('0x10')][_0x5e19('0x12')]);return _0x377428(_0x3a1974['error'][_0x5e19('0x12')]);}logger[_0x5e19('0x10')]('DeskAccount,\x20%s,\x20%s',_0x50b913,_0x3a1974[_0x5e19('0x10')][_0x5e19('0x12')]);return _0x21e440(_0x3a1974[_0x5e19('0x10')]['message']);}else{logger['info'](_0x5e19('0xb'),_0x50b913,'request\x20sent');_0x21e440(_0x3a1974[_0x5e19('0x13')][_0x5e19('0x12')]);}})[_0x5e19('0x14')](function(_0x5e72a3){logger['error']('DeskAccount,\x20%s,\x20%s',_0x50b913,_0x5e72a3);_0x377428(_0x5e72a3);});});}exports['GetDeskAccount']=function(_0x1feaa0){var _0x33f4c0=this;return new Promise(function(_0x5982d0,_0x75e4ac){return db[_0x5e19('0x15')][_0x5e19('0x16')]({'raw':_0x1feaa0[_0x5e19('0x17')]?_0x1feaa0[_0x5e19('0x17')][_0x5e19('0x18')]===undefined?!![]:![]:!![],'where':_0x1feaa0[_0x5e19('0x17')]?_0x1feaa0[_0x5e19('0x17')]['where']||null:null,'attributes':_0x1feaa0[_0x5e19('0x17')]?_0x1feaa0[_0x5e19('0x17')]['attributes']||null:null,'limit':_0x1feaa0[_0x5e19('0x17')]?_0x1feaa0[_0x5e19('0x17')][_0x5e19('0x19')]||null:null,'include':_0x1feaa0[_0x5e19('0x17')]?_0x1feaa0[_0x5e19('0x17')][_0x5e19('0x1a')]?_[_0x5e19('0x1b')](_0x1feaa0[_0x5e19('0x17')]['include'],function(_0x1f57bf){return{'model':db[_0x1f57bf[_0x5e19('0x1c')]],'as':_0x1f57bf['as'],'attributes':_0x1f57bf[_0x5e19('0x1d')],'include':_0x1f57bf[_0x5e19('0x1a')]?_[_0x5e19('0x1b')](_0x1f57bf['include'],function(_0x6f4ea0){return{'model':db[_0x6f4ea0[_0x5e19('0x1c')]],'as':_0x6f4ea0['as'],'attributes':_0x6f4ea0[_0x5e19('0x1d')],'include':_0x6f4ea0[_0x5e19('0x1a')]?_[_0x5e19('0x1b')](_0x6f4ea0[_0x5e19('0x1a')],function(_0x425abb){return{'model':db[_0x425abb[_0x5e19('0x1c')]],'as':_0x425abb['as'],'attributes':_0x425abb[_0x5e19('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e19('0x1e')](function(_0x248568){logger[_0x5e19('0x1f')](_0x5e19('0x20'),_0x1feaa0);logger[_0x5e19('0xd')]('GetDeskAccount',_0x1feaa0,JSON[_0x5e19('0xf')](_0x248568));_0x5982d0(_0x248568);})['catch'](function(_0x49b50d){logger[_0x5e19('0x10')](_0x5e19('0x20'),_0x49b50d[_0x5e19('0x12')],_0x1feaa0);_0x75e4ac(_0x33f4c0[_0x5e19('0x10')](0x1f4,_0x49b50d[_0x5e19('0x12')]));});});};exports[_0x5e19('0x21')]=function(_0x460b20){var _0x5a74d3=this;return new Promise(function(_0x3f76cc,_0x42cc7b){return db['DeskAccount'][_0x5e19('0x22')]({'raw':_0x460b20['options']?_0x460b20['options']['raw']===undefined?!![]:![]:!![],'where':_0x460b20[_0x5e19('0x17')]?_0x460b20[_0x5e19('0x17')]['where']||null:null,'attributes':_0x460b20['options']?_0x460b20[_0x5e19('0x17')][_0x5e19('0x1d')]||null:null,'include':_0x460b20[_0x5e19('0x17')]?_0x460b20[_0x5e19('0x17')][_0x5e19('0x1a')]?_[_0x5e19('0x1b')](_0x460b20[_0x5e19('0x17')][_0x5e19('0x1a')],function(_0x9a16){return{'model':db[_0x9a16[_0x5e19('0x1c')]],'as':_0x9a16['as'],'attributes':_0x9a16['attributes'],'include':_0x9a16['include']?_[_0x5e19('0x1b')](_0x9a16['include'],function(_0x3bd8b4){return{'model':db[_0x3bd8b4[_0x5e19('0x1c')]],'as':_0x3bd8b4['as'],'attributes':_0x3bd8b4[_0x5e19('0x1d')],'include':_0x3bd8b4[_0x5e19('0x1a')]?_[_0x5e19('0x1b')](_0x3bd8b4[_0x5e19('0x1a')],function(_0x2cd9fb){return{'model':db[_0x2cd9fb[_0x5e19('0x1c')]],'as':_0x2cd9fb['as'],'attributes':_0x2cd9fb[_0x5e19('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xecc0bb){logger[_0x5e19('0x1f')](_0x5e19('0x21'),_0x460b20);logger[_0x5e19('0xd')](_0x5e19('0x21'),_0x460b20,JSON[_0x5e19('0xf')](_0xecc0bb));_0x3f76cc(_0xecc0bb);})['catch'](function(_0x53d0fa){logger[_0x5e19('0x10')]('ShowDeskAccount',_0x53d0fa[_0x5e19('0x12')],_0x460b20);_0x42cc7b(_0x5a74d3[_0x5e19('0x10')](0x1f4,_0x53d0fa[_0x5e19('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 47870d8..ff77328 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 _0x3279=['getDescriptions','/:id/tags','post','create','setTags','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3279,0x9a));var _0x9327=function(_0x194c7c,_0x5599db){_0x194c7c=_0x194c7c-0x0;var _0x4a08db=_0x3279[_0x194c7c];return _0x4a08db;};'use strict';var multer=require(_0x9327('0x0'));var util=require(_0x9327('0x1'));var path=require(_0x9327('0x2'));var timeout=require(_0x9327('0x3'));var express=require(_0x9327('0x4'));var router=express[_0x9327('0x5')]();var auth=require(_0x9327('0x6'));var interaction=require(_0x9327('0x7'));var config=require(_0x9327('0x8'));var controller=require(_0x9327('0x9'));router['get']('/',auth[_0x9327('0xa')](),controller[_0x9327('0xb')]);router[_0x9327('0xc')](_0x9327('0xd'),auth[_0x9327('0xa')](),controller[_0x9327('0xe')]);router[_0x9327('0xc')](_0x9327('0xf'),auth['isAuthenticated'](),controller[_0x9327('0x10')]);router['get'](_0x9327('0x11'),auth['isAuthenticated'](),controller[_0x9327('0x12')]);router[_0x9327('0xc')](_0x9327('0x13'),auth[_0x9327('0xa')](),controller[_0x9327('0x14')]);router[_0x9327('0xc')](_0x9327('0x15'),auth[_0x9327('0xa')](),controller['getTags']);router[_0x9327('0x16')]('/',auth[_0x9327('0xa')](),controller[_0x9327('0x17')]);router[_0x9327('0x16')](_0x9327('0x15'),auth['isAuthenticated'](),controller[_0x9327('0x18')]);router['put'](_0x9327('0xd'),auth['isAuthenticated'](),controller[_0x9327('0x19')]);router[_0x9327('0x1a')](_0x9327('0xd'),auth[_0x9327('0xa')](),controller[_0x9327('0x1b')]);module[_0x9327('0x1c')]=router; \ No newline at end of file +var _0xae94=['post','create','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x44508f,_0x3d2edc){var _0x3cc7b9=function(_0x362c76){while(--_0x362c76){_0x44508f['push'](_0x44508f['shift']());}};_0x3cc7b9(++_0x3d2edc);}(_0xae94,0x8f));var _0x4ae9=function(_0x38185b,_0x55fb75){_0x38185b=_0x38185b-0x0;var _0xd2cb77=_0xae94[_0x38185b];return _0xd2cb77;};'use strict';var multer=require(_0x4ae9('0x0'));var util=require(_0x4ae9('0x1'));var path=require(_0x4ae9('0x2'));var timeout=require(_0x4ae9('0x3'));var express=require('express');var router=express[_0x4ae9('0x4')]();var auth=require(_0x4ae9('0x5'));var interaction=require(_0x4ae9('0x6'));var config=require('../../config/environment');var controller=require(_0x4ae9('0x7'));router[_0x4ae9('0x8')]('/',auth[_0x4ae9('0x9')](),controller[_0x4ae9('0xa')]);router[_0x4ae9('0x8')]('/:id',auth[_0x4ae9('0x9')](),controller['show']);router[_0x4ae9('0x8')](_0x4ae9('0xb'),auth[_0x4ae9('0x9')](),controller[_0x4ae9('0xc')]);router[_0x4ae9('0x8')](_0x4ae9('0xd'),auth['isAuthenticated'](),controller[_0x4ae9('0xe')]);router[_0x4ae9('0x8')](_0x4ae9('0xf'),auth[_0x4ae9('0x9')](),controller[_0x4ae9('0x10')]);router[_0x4ae9('0x8')](_0x4ae9('0x11'),auth[_0x4ae9('0x9')](),controller[_0x4ae9('0x12')]);router[_0x4ae9('0x13')]('/',auth[_0x4ae9('0x9')](),controller[_0x4ae9('0x14')]);router[_0x4ae9('0x13')](_0x4ae9('0x11'),auth[_0x4ae9('0x9')](),controller[_0x4ae9('0x15')]);router[_0x4ae9('0x16')](_0x4ae9('0x17'),auth[_0x4ae9('0x9')](),controller[_0x4ae9('0x18')]);router['delete'](_0x4ae9('0x17'),auth[_0x4ae9('0x9')](),controller[_0x4ae9('0x19')]);module[_0x4ae9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index fdafb32..567153a 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 _0x64a6=['exports','STRING','sequelize'];(function(_0x1498b6,_0x4d0c84){var _0x32c2f3=function(_0x2eaf7d){while(--_0x2eaf7d){_0x1498b6['push'](_0x1498b6['shift']());}};_0x32c2f3(++_0x4d0c84);}(_0x64a6,0x10a));var _0x664a=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x64a6[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x664a('0x0'));module[_0x664a('0x1')]={'name':{'type':Sequelize[_0x664a('0x2')]},'description':{'type':Sequelize[_0x664a('0x2')]}}; \ No newline at end of file +var _0xe052=['sequelize','exports','STRING'];(function(_0x25446b,_0x5d05aa){var _0x11409e=function(_0x605863){while(--_0x605863){_0x25446b['push'](_0x25446b['shift']());}};_0x11409e(++_0x5d05aa);}(_0xe052,0x114));var _0x2e05=function(_0x1de865,_0x520f6d){_0x1de865=_0x1de865-0x0;var _0x42206f=_0xe052[_0x1de865];return _0x42206f;};'use strict';var Sequelize=require(_0x2e05('0x0'));module[_0x2e05('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2e05('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f55536c..4c939cf 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 _0xc0d8=['destroy','sendStatus','stack','name','send','index','rawAttributes','model','keys','dateStart','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','dateEnd','add','day','merge','where','filter','options','DeskConfiguration','includeAll','include','findAll','rows','show','params','find','body','getFields','findOne','DeskField','order','map','nolimit','getSubjects','getDescriptions','getTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','then','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','DeskConfiguration,\x20%s,\x20%s','info','result','catch','end','status','count','offset','limit','Content-Range','json','apply','save','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc0d8,0x131));var _0x8c0d=function(_0x3ca87c,_0x403f21){_0x3ca87c=_0x3ca87c-0x0;var _0x46afdd=_0xc0d8[_0x3ca87c];return _0x46afdd;};'use strict';var pdf=require(_0x8c0d('0x0'));var emlformat=require(_0x8c0d('0x1'));var rimraf=require(_0x8c0d('0x2'));var zipdir=require(_0x8c0d('0x3'));var jsonpatch=require(_0x8c0d('0x4'));var rp=require(_0x8c0d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8c0d('0x6'));var path=require(_0x8c0d('0x7'));var sox=require(_0x8c0d('0x8'));var csv=require('to-csv');var ejs=require(_0x8c0d('0x9'));var fs=require('fs');var _=require(_0x8c0d('0xa'));var squel=require(_0x8c0d('0xb'));var crypto=require(_0x8c0d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8c0d('0xd'));var toCsv=require(_0x8c0d('0xe'));var querystring=require(_0x8c0d('0xf'));var Papa=require(_0x8c0d('0x10'));var Redis=require(_0x8c0d('0x11'));var qs=require(_0x8c0d('0x12'));var logger=require(_0x8c0d('0x13'))(_0x8c0d('0x14'));var utils=require(_0x8c0d('0x15'));var config=require(_0x8c0d('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x61ba0d,_0x502c9f,_0x2a11bf,_0x1ca043){return new BPromise(function(_0x35cd26,_0xcc0c50){var _0x5d635d=_0x1ca043||client;return _0x5d635d['request'](_0x61ba0d,_0x2a11bf)[_0x8c0d('0x17')](function(_0x5c972e){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x502c9f,_0x8c0d('0x18'));logger['debug'](_0x8c0d('0x19'),_0x502c9f,_0x8c0d('0x18'),JSON['stringify'](_0x5c972e));if(_0x5c972e[_0x8c0d('0x1a')]){if(_0x5c972e[_0x8c0d('0x1a')][_0x8c0d('0x1b')]===0x1f4){logger[_0x8c0d('0x1a')]('DeskConfiguration,\x20%s,\x20%s',_0x502c9f,_0x5c972e[_0x8c0d('0x1a')][_0x8c0d('0x1c')]);return _0xcc0c50(_0x5c972e['error'][_0x8c0d('0x1c')]);}logger[_0x8c0d('0x1a')](_0x8c0d('0x1d'),_0x502c9f,_0x5c972e[_0x8c0d('0x1a')][_0x8c0d('0x1c')]);return _0x35cd26(_0x5c972e[_0x8c0d('0x1a')][_0x8c0d('0x1c')]);}else{logger[_0x8c0d('0x1e')](_0x8c0d('0x1d'),_0x502c9f,_0x8c0d('0x18'));_0x35cd26(_0x5c972e[_0x8c0d('0x1f')][_0x8c0d('0x1c')]);}})[_0x8c0d('0x20')](function(_0x19fcf4){logger[_0x8c0d('0x1a')](_0x8c0d('0x1d'),_0x502c9f,_0x19fcf4);_0xcc0c50(_0x19fcf4);});});}function respondWithStatusCode(_0x3c61b5,_0x5dc9f0){_0x5dc9f0=_0x5dc9f0||0xcc;return function(_0x32a67c){if(_0x32a67c){return _0x3c61b5['sendStatus'](_0x5dc9f0);}return _0x3c61b5['status'](_0x5dc9f0)[_0x8c0d('0x21')]();};}function respondWithResult(_0x35ba36,_0x39ba59){_0x39ba59=_0x39ba59||0xc8;return function(_0x5a8c11){if(_0x5a8c11){return _0x35ba36[_0x8c0d('0x22')](_0x39ba59)['json'](_0x5a8c11);}};}function respondWithFilteredResult(_0x579471,_0x5621ff){return function(_0xfb3c2c){if(_0xfb3c2c){var _0x1336c7=_0xfb3c2c[_0x8c0d('0x23')],_0x40c662=_0x5621ff[_0x8c0d('0x24')],_0x6b59ee=_0x5621ff['offset']+_0x5621ff[_0x8c0d('0x25')],_0x224c54;if(_0x6b59ee>=_0x1336c7){_0x6b59ee=_0x1336c7;_0x224c54=0xc8;}else{_0x224c54=0xce;}_0x579471['status'](_0x224c54);return _0x579471['set'](_0x8c0d('0x26'),_0x40c662+'-'+_0x6b59ee+'/'+_0x1336c7)[_0x8c0d('0x27')](_0xfb3c2c);}return null;};}function patchUpdates(_0x59dc4a){return function(_0x2e8341){try{jsonpatch[_0x8c0d('0x28')](_0x2e8341,_0x59dc4a,!![]);}catch(_0x2d65b5){return BPromise['reject'](_0x2d65b5);}return _0x2e8341[_0x8c0d('0x29')]();};}function saveUpdates(_0x57c962,_0x5e20d9){return function(_0x2c6744){if(_0x2c6744){return _0x2c6744[_0x8c0d('0x2a')](_0x57c962)[_0x8c0d('0x17')](function(_0x5ca683){return _0x5ca683;});}return null;};}function removeEntity(_0x500d15,_0x1af55b){return function(_0xee9531){if(_0xee9531){return _0xee9531[_0x8c0d('0x2b')]()['then'](function(){_0x500d15[_0x8c0d('0x22')](0xcc)[_0x8c0d('0x21')]();});}};}function handleEntityNotFound(_0x1e61be,_0x250ce5){return function(_0x3156b4){if(!_0x3156b4){_0x1e61be[_0x8c0d('0x2c')](0x194);}return _0x3156b4;};}function handleError(_0x54a448,_0x1980bf){_0x1980bf=_0x1980bf||0x1f4;return function(_0x44de58){logger[_0x8c0d('0x1a')](_0x44de58[_0x8c0d('0x2d')]);if(_0x44de58[_0x8c0d('0x2e')]){delete _0x44de58[_0x8c0d('0x2e')];}_0x54a448['status'](_0x1980bf)[_0x8c0d('0x2f')](_0x44de58);};}exports[_0x8c0d('0x30')]=function(_0x218cd9,_0x47776f){var _0x220248={},_0xce1e1e={},_0x3985f1={'count':0x0,'rows':[]};var _0x5b009e=db['DeskConfiguration'][_0x8c0d('0x31')];_0xce1e1e[_0x8c0d('0x32')]=_[_0x8c0d('0x33')](_0x5b009e);var _0x54adbf={'dateStart':_0x218cd9['query'][_0x8c0d('0x34')],'dateEnd':_0x218cd9[_0x8c0d('0x35')]['dateEnd']};delete _0x218cd9[_0x8c0d('0x35')][_0x8c0d('0x34')];delete _0x218cd9[_0x8c0d('0x35')]['dateEnd'];_0xce1e1e['query']=_[_0x8c0d('0x33')](_0x218cd9[_0x8c0d('0x35')]);_0xce1e1e['filters']=_[_0x8c0d('0x36')](_0xce1e1e['model'],_0xce1e1e[_0x8c0d('0x35')]);_0x220248[_0x8c0d('0x37')]=_[_0x8c0d('0x36')](_0xce1e1e[_0x8c0d('0x32')],qs[_0x8c0d('0x38')](_0x218cd9[_0x8c0d('0x35')][_0x8c0d('0x38')]));_0x220248[_0x8c0d('0x37')]=_0x220248['attributes'][_0x8c0d('0x39')]?_0x220248[_0x8c0d('0x37')]:_0xce1e1e[_0x8c0d('0x32')];if(!_0x218cd9['query'][_0x8c0d('0x3a')]('nolimit')){_0x220248[_0x8c0d('0x25')]=qs[_0x8c0d('0x25')](_0x218cd9[_0x8c0d('0x35')][_0x8c0d('0x25')]);_0x220248[_0x8c0d('0x24')]=qs[_0x8c0d('0x24')](_0x218cd9[_0x8c0d('0x35')][_0x8c0d('0x24')]);}_0x220248['order']=qs[_0x8c0d('0x3b')](_0x218cd9[_0x8c0d('0x35')][_0x8c0d('0x3b')]);_0x220248['where']=qs[_0x8c0d('0x3c')](_[_0x8c0d('0x3d')](_0x218cd9[_0x8c0d('0x35')],_0xce1e1e[_0x8c0d('0x3c')]));if(_0x54adbf[_0x8c0d('0x34')]){if(_0x54adbf[_0x8c0d('0x3e')]){_0x54adbf[_0x8c0d('0x3e')]=moment(_0x54adbf[_0x8c0d('0x3e')])[_0x8c0d('0x3f')](0x1,_0x8c0d('0x40'));}else{_0x54adbf[_0x8c0d('0x3e')]=moment(_0x54adbf[_0x8c0d('0x34')])[_0x8c0d('0x3f')](0x1,'day');}_[_0x8c0d('0x41')](_0x220248[_0x8c0d('0x42')],{'createdAt':{'$gte':_0x54adbf['dateStart'],'$lte':_0x54adbf['dateEnd']}});}if(_0x218cd9[_0x8c0d('0x35')][_0x8c0d('0x43')]){_0x220248[_0x8c0d('0x42')]=_[_0x8c0d('0x41')](_0x220248['where'],{'$or':_['map'](_0x220248[_0x8c0d('0x37')],function(_0x33dad3){var _0x3c2c2a={};_0x3c2c2a[_0x33dad3]={'$like':'%'+_0x218cd9[_0x8c0d('0x35')][_0x8c0d('0x43')]+'%'};return _0x3c2c2a;})});}_0x220248=_[_0x8c0d('0x41')]({},_0x220248,_0x218cd9[_0x8c0d('0x44')]);var _0xb91c3e={'where':_0x220248['where']};return db[_0x8c0d('0x45')][_0x8c0d('0x23')](_0xb91c3e)[_0x8c0d('0x17')](function(_0x3386ac){_0x3985f1['count']=_0x3386ac;if(_0x218cd9['query'][_0x8c0d('0x46')]){_0x220248[_0x8c0d('0x47')]=[{'all':!![]}];}return db[_0x8c0d('0x45')][_0x8c0d('0x48')](_0x220248);})['then'](function(_0x4a3c19){_0x3985f1[_0x8c0d('0x49')]=_0x4a3c19;return _0x3985f1;})['then'](respondWithFilteredResult(_0x47776f,_0x220248))[_0x8c0d('0x20')](handleError(_0x47776f,null));};exports[_0x8c0d('0x4a')]=function(_0x1368e0,_0x2dc467){var _0x5a5aa8={'raw':![],'where':{'id':_0x1368e0[_0x8c0d('0x4b')]['id']}},_0x49f7f7={};_0x49f7f7[_0x8c0d('0x32')]=_[_0x8c0d('0x33')](db['DeskConfiguration'][_0x8c0d('0x31')]);_0x49f7f7['query']=_[_0x8c0d('0x33')](_0x1368e0['query']);_0x49f7f7[_0x8c0d('0x3c')]=_[_0x8c0d('0x36')](_0x49f7f7['model'],_0x49f7f7['query']);_0x5a5aa8[_0x8c0d('0x37')]=_[_0x8c0d('0x36')](_0x49f7f7[_0x8c0d('0x32')],qs['fields'](_0x1368e0['query'][_0x8c0d('0x38')]));_0x5a5aa8[_0x8c0d('0x37')]=_0x5a5aa8[_0x8c0d('0x37')][_0x8c0d('0x39')]?_0x5a5aa8[_0x8c0d('0x37')]:_0x49f7f7[_0x8c0d('0x32')];if(_0x1368e0[_0x8c0d('0x35')][_0x8c0d('0x46')]){_0x5a5aa8[_0x8c0d('0x47')]=[{'all':!![]}];}_0x5a5aa8=_[_0x8c0d('0x41')]({},_0x5a5aa8,_0x1368e0['options']);return db[_0x8c0d('0x45')][_0x8c0d('0x4c')](_0x5a5aa8)[_0x8c0d('0x17')](handleEntityNotFound(_0x2dc467,null))[_0x8c0d('0x17')](respondWithResult(_0x2dc467,null))[_0x8c0d('0x20')](handleError(_0x2dc467,null));};exports['create']=function(_0x309a0e,_0x957e78){return db[_0x8c0d('0x45')]['create'](_0x309a0e['body'],{})[_0x8c0d('0x17')](respondWithResult(_0x957e78,0xc9))[_0x8c0d('0x20')](handleError(_0x957e78,null));};exports[_0x8c0d('0x2a')]=function(_0x1e2a7a,_0x107411){if(_0x1e2a7a['body']['id']){delete _0x1e2a7a[_0x8c0d('0x4d')]['id'];}return db[_0x8c0d('0x45')]['find']({'where':{'id':_0x1e2a7a[_0x8c0d('0x4b')]['id']}})[_0x8c0d('0x17')](handleEntityNotFound(_0x107411,null))['then'](saveUpdates(_0x1e2a7a[_0x8c0d('0x4d')],null))[_0x8c0d('0x17')](respondWithResult(_0x107411,null))[_0x8c0d('0x20')](handleError(_0x107411,null));};exports[_0x8c0d('0x2b')]=function(_0x158ac2,_0x107850){return db[_0x8c0d('0x45')]['find']({'where':{'id':_0x158ac2['params']['id']}})[_0x8c0d('0x17')](handleEntityNotFound(_0x107850,null))[_0x8c0d('0x17')](removeEntity(_0x107850,null))[_0x8c0d('0x20')](handleError(_0x107850,null));};exports[_0x8c0d('0x4e')]=function(_0x43ea5e,_0x26064b,_0xecf1b4){var _0xef8231={};var _0x1d7775={};var _0x410580;var _0xa06d2f;return db['DeskConfiguration'][_0x8c0d('0x4f')]({'where':{'id':_0x43ea5e['params']['id']}})['then'](handleEntityNotFound(_0x26064b,null))[_0x8c0d('0x17')](function(_0x5b8296){if(_0x5b8296){_0x410580=_0x5b8296;_0x1d7775[_0x8c0d('0x32')]=_[_0x8c0d('0x33')](db[_0x8c0d('0x50')][_0x8c0d('0x31')]);_0x1d7775[_0x8c0d('0x35')]=_['keys'](_0x43ea5e[_0x8c0d('0x35')]);_0x1d7775[_0x8c0d('0x3c')]=_[_0x8c0d('0x36')](_0x1d7775[_0x8c0d('0x32')],_0x1d7775[_0x8c0d('0x35')]);_0xef8231['attributes']=_[_0x8c0d('0x36')](_0x1d7775[_0x8c0d('0x32')],qs[_0x8c0d('0x38')](_0x43ea5e[_0x8c0d('0x35')][_0x8c0d('0x38')]));_0xef8231[_0x8c0d('0x37')]=_0xef8231[_0x8c0d('0x37')][_0x8c0d('0x39')]?_0xef8231[_0x8c0d('0x37')]:_0x1d7775[_0x8c0d('0x32')];_0xef8231[_0x8c0d('0x51')]=qs[_0x8c0d('0x3b')](_0x43ea5e[_0x8c0d('0x35')][_0x8c0d('0x3b')]);_0xef8231[_0x8c0d('0x42')]=qs[_0x8c0d('0x3c')](_[_0x8c0d('0x3d')](_0x43ea5e[_0x8c0d('0x35')],_0x1d7775['filters']));if(_0x43ea5e[_0x8c0d('0x35')][_0x8c0d('0x43')]){_0xef8231[_0x8c0d('0x42')]=_[_0x8c0d('0x41')](_0xef8231['where'],{'$or':_[_0x8c0d('0x52')](_0xef8231[_0x8c0d('0x37')],function(_0x23c365){var _0x1faa08={};_0x1faa08[_0x23c365]={'$like':'%'+_0x43ea5e[_0x8c0d('0x35')][_0x8c0d('0x43')]+'%'};return _0x1faa08;})});}_0xef8231=_[_0x8c0d('0x41')]({},_0xef8231,_0x43ea5e[_0x8c0d('0x44')]);return _0x410580[_0x8c0d('0x4e')](_0xef8231);}})[_0x8c0d('0x17')](function(_0x4cef06){if(_0x4cef06){_0xa06d2f=_0x4cef06[_0x8c0d('0x39')];if(!_0x43ea5e[_0x8c0d('0x35')][_0x8c0d('0x3a')](_0x8c0d('0x53'))){_0xef8231[_0x8c0d('0x25')]=qs[_0x8c0d('0x25')](_0x43ea5e[_0x8c0d('0x35')][_0x8c0d('0x25')]);_0xef8231[_0x8c0d('0x24')]=qs[_0x8c0d('0x24')](_0x43ea5e['query']['offset']);}return _0x410580[_0x8c0d('0x4e')](_0xef8231);}})[_0x8c0d('0x17')](function(_0xbb3c7e){if(_0xbb3c7e){return _0xbb3c7e?{'count':_0xa06d2f,'rows':_0xbb3c7e}:null;}})[_0x8c0d('0x17')](respondWithResult(_0x26064b,null))[_0x8c0d('0x20')](handleError(_0x26064b,null));};exports[_0x8c0d('0x54')]=function(_0xb72228,_0x59612d,_0x4e6cd6){var _0xf89d3a={};var _0x1d2780={};var _0x3bf7ec;var _0x13a92d;return db['DeskConfiguration'][_0x8c0d('0x4f')]({'where':{'id':_0xb72228['params']['id']}})['then'](handleEntityNotFound(_0x59612d,null))['then'](function(_0xd1965b){if(_0xd1965b){_0x3bf7ec=_0xd1965b;_0x1d2780[_0x8c0d('0x32')]=_['keys'](db[_0x8c0d('0x50')][_0x8c0d('0x31')]);_0x1d2780[_0x8c0d('0x35')]=_[_0x8c0d('0x33')](_0xb72228[_0x8c0d('0x35')]);_0x1d2780[_0x8c0d('0x3c')]=_[_0x8c0d('0x36')](_0x1d2780['model'],_0x1d2780['query']);_0xf89d3a[_0x8c0d('0x37')]=_[_0x8c0d('0x36')](_0x1d2780[_0x8c0d('0x32')],qs[_0x8c0d('0x38')](_0xb72228[_0x8c0d('0x35')]['fields']));_0xf89d3a[_0x8c0d('0x37')]=_0xf89d3a[_0x8c0d('0x37')][_0x8c0d('0x39')]?_0xf89d3a[_0x8c0d('0x37')]:_0x1d2780[_0x8c0d('0x32')];_0xf89d3a['order']=qs[_0x8c0d('0x3b')](_0xb72228['query'][_0x8c0d('0x3b')]);_0xf89d3a[_0x8c0d('0x42')]=qs[_0x8c0d('0x3c')](_[_0x8c0d('0x3d')](_0xb72228[_0x8c0d('0x35')],_0x1d2780['filters']));if(_0xb72228[_0x8c0d('0x35')][_0x8c0d('0x43')]){_0xf89d3a[_0x8c0d('0x42')]=_['merge'](_0xf89d3a['where'],{'$or':_['map'](_0xf89d3a[_0x8c0d('0x37')],function(_0x34475b){var _0x45804b={};_0x45804b[_0x34475b]={'$like':'%'+_0xb72228[_0x8c0d('0x35')]['filter']+'%'};return _0x45804b;})});}_0xf89d3a=_[_0x8c0d('0x41')]({},_0xf89d3a,_0xb72228['options']);return _0x3bf7ec['getSubjects'](_0xf89d3a);}})['then'](function(_0xe49912){if(_0xe49912){_0x13a92d=_0xe49912[_0x8c0d('0x39')];if(!_0xb72228['query'][_0x8c0d('0x3a')]('nolimit')){_0xf89d3a[_0x8c0d('0x25')]=qs[_0x8c0d('0x25')](_0xb72228[_0x8c0d('0x35')][_0x8c0d('0x25')]);_0xf89d3a[_0x8c0d('0x24')]=qs['offset'](_0xb72228['query'][_0x8c0d('0x24')]);}return _0x3bf7ec['getSubjects'](_0xf89d3a);}})['then'](function(_0x3e9ab6){if(_0x3e9ab6){return _0x3e9ab6?{'count':_0x13a92d,'rows':_0x3e9ab6}:null;}})[_0x8c0d('0x17')](respondWithResult(_0x59612d,null))[_0x8c0d('0x20')](handleError(_0x59612d,null));};exports['getDescriptions']=function(_0x4c5295,_0x4f65f0,_0x58404b){var _0xc0be8b={};var _0x29ff1a={};var _0x306e35;var _0x3d94ce;return db['DeskConfiguration'][_0x8c0d('0x4f')]({'where':{'id':_0x4c5295['params']['id']}})[_0x8c0d('0x17')](handleEntityNotFound(_0x4f65f0,null))[_0x8c0d('0x17')](function(_0xd17762){if(_0xd17762){_0x306e35=_0xd17762;_0x29ff1a[_0x8c0d('0x32')]=_[_0x8c0d('0x33')](db[_0x8c0d('0x50')][_0x8c0d('0x31')]);_0x29ff1a[_0x8c0d('0x35')]=_[_0x8c0d('0x33')](_0x4c5295[_0x8c0d('0x35')]);_0x29ff1a[_0x8c0d('0x3c')]=_['intersection'](_0x29ff1a[_0x8c0d('0x32')],_0x29ff1a[_0x8c0d('0x35')]);_0xc0be8b[_0x8c0d('0x37')]=_['intersection'](_0x29ff1a[_0x8c0d('0x32')],qs['fields'](_0x4c5295[_0x8c0d('0x35')][_0x8c0d('0x38')]));_0xc0be8b[_0x8c0d('0x37')]=_0xc0be8b[_0x8c0d('0x37')][_0x8c0d('0x39')]?_0xc0be8b[_0x8c0d('0x37')]:_0x29ff1a[_0x8c0d('0x32')];_0xc0be8b['order']=qs[_0x8c0d('0x3b')](_0x4c5295[_0x8c0d('0x35')][_0x8c0d('0x3b')]);_0xc0be8b[_0x8c0d('0x42')]=qs[_0x8c0d('0x3c')](_[_0x8c0d('0x3d')](_0x4c5295[_0x8c0d('0x35')],_0x29ff1a['filters']));if(_0x4c5295[_0x8c0d('0x35')][_0x8c0d('0x43')]){_0xc0be8b['where']=_['merge'](_0xc0be8b['where'],{'$or':_[_0x8c0d('0x52')](_0xc0be8b[_0x8c0d('0x37')],function(_0x188248){var _0x1a114a={};_0x1a114a[_0x188248]={'$like':'%'+_0x4c5295[_0x8c0d('0x35')][_0x8c0d('0x43')]+'%'};return _0x1a114a;})});}_0xc0be8b=_['merge']({},_0xc0be8b,_0x4c5295[_0x8c0d('0x44')]);return _0x306e35[_0x8c0d('0x55')](_0xc0be8b);}})[_0x8c0d('0x17')](function(_0x501af4){if(_0x501af4){_0x3d94ce=_0x501af4[_0x8c0d('0x39')];if(!_0x4c5295[_0x8c0d('0x35')][_0x8c0d('0x3a')](_0x8c0d('0x53'))){_0xc0be8b[_0x8c0d('0x25')]=qs['limit'](_0x4c5295[_0x8c0d('0x35')][_0x8c0d('0x25')]);_0xc0be8b[_0x8c0d('0x24')]=qs['offset'](_0x4c5295[_0x8c0d('0x35')][_0x8c0d('0x24')]);}return _0x306e35['getDescriptions'](_0xc0be8b);}})[_0x8c0d('0x17')](function(_0x425ce0){if(_0x425ce0){return _0x425ce0?{'count':_0x3d94ce,'rows':_0x425ce0}:null;}})[_0x8c0d('0x17')](respondWithResult(_0x4f65f0,null))[_0x8c0d('0x20')](handleError(_0x4f65f0,null));};exports[_0x8c0d('0x56')]=function(_0x125eef,_0x25849b,_0x259a26){var _0x1a2a11={};var _0x3c4259={};var _0x570924;var _0x3a4d4c;return db['DeskConfiguration'][_0x8c0d('0x4f')]({'where':{'id':_0x125eef['params']['id']}})['then'](handleEntityNotFound(_0x25849b,null))['then'](function(_0xcd00f0){if(_0xcd00f0){_0x570924=_0xcd00f0;_0x3c4259[_0x8c0d('0x32')]=_[_0x8c0d('0x33')](db['Tag'][_0x8c0d('0x31')]);_0x3c4259['query']=_[_0x8c0d('0x33')](_0x125eef[_0x8c0d('0x35')]);_0x3c4259[_0x8c0d('0x3c')]=_[_0x8c0d('0x36')](_0x3c4259[_0x8c0d('0x32')],_0x3c4259[_0x8c0d('0x35')]);_0x1a2a11[_0x8c0d('0x37')]=_[_0x8c0d('0x36')](_0x3c4259[_0x8c0d('0x32')],qs[_0x8c0d('0x38')](_0x125eef['query'][_0x8c0d('0x38')]));_0x1a2a11['attributes']=_0x1a2a11[_0x8c0d('0x37')][_0x8c0d('0x39')]?_0x1a2a11[_0x8c0d('0x37')]:_0x3c4259[_0x8c0d('0x32')];_0x1a2a11['order']=qs[_0x8c0d('0x3b')](_0x125eef[_0x8c0d('0x35')][_0x8c0d('0x3b')]);_0x1a2a11['where']=qs[_0x8c0d('0x3c')](_[_0x8c0d('0x3d')](_0x125eef[_0x8c0d('0x35')],_0x3c4259[_0x8c0d('0x3c')]));if(_0x125eef[_0x8c0d('0x35')][_0x8c0d('0x43')]){_0x1a2a11[_0x8c0d('0x42')]=_[_0x8c0d('0x41')](_0x1a2a11[_0x8c0d('0x42')],{'$or':_[_0x8c0d('0x52')](_0x1a2a11[_0x8c0d('0x37')],function(_0x119c62){var _0x1b34c1={};_0x1b34c1[_0x119c62]={'$like':'%'+_0x125eef[_0x8c0d('0x35')][_0x8c0d('0x43')]+'%'};return _0x1b34c1;})});}_0x1a2a11=_['merge']({},_0x1a2a11,_0x125eef[_0x8c0d('0x44')]);return _0x570924[_0x8c0d('0x56')](_0x1a2a11);}})[_0x8c0d('0x17')](function(_0xade378){if(_0xade378){_0x3a4d4c=_0xade378[_0x8c0d('0x39')];if(!_0x125eef[_0x8c0d('0x35')][_0x8c0d('0x3a')](_0x8c0d('0x53'))){_0x1a2a11[_0x8c0d('0x25')]=qs['limit'](_0x125eef[_0x8c0d('0x35')]['limit']);_0x1a2a11[_0x8c0d('0x24')]=qs[_0x8c0d('0x24')](_0x125eef['query'][_0x8c0d('0x24')]);}return _0x570924[_0x8c0d('0x56')](_0x1a2a11);}})['then'](function(_0x599ebf){if(_0x599ebf){return _0x599ebf?{'count':_0x3a4d4c,'rows':_0x599ebf}:null;}})[_0x8c0d('0x17')](respondWithResult(_0x25849b,null))[_0x8c0d('0x20')](handleError(_0x25849b,null));};exports['setTags']=function(_0x12e876,_0x4c0aca,_0x3609e7){if(_0x12e876[_0x8c0d('0x4d')]['id']){delete _0x12e876['body']['id'];}return db[_0x8c0d('0x45')][_0x8c0d('0x4f')]({'where':{'id':_0x12e876[_0x8c0d('0x4b')]['id']}})[_0x8c0d('0x17')](handleEntityNotFound(_0x4c0aca,null))[_0x8c0d('0x17')](function(_0x5a5425){if(_0x5a5425){return _0x5a5425['setTags'](_0x12e876[_0x8c0d('0x4d')]['ids']||[]);}return null;})[_0x8c0d('0x17')](respondWithResult(_0x4c0aca,null))[_0x8c0d('0x20')](handleError(_0x4c0aca,null));}; \ No newline at end of file +var _0x595e=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','json','offset','Content-Range','apply','reject','save','destroy','end','name','send','index','DeskConfiguration','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','limit','order','sort','pick','add','day','where','filter','map','merge','options','count','include','rows','show','includeAll','create','body','find','params','DeskField','length','getFields','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir'];(function(_0x2d246d,_0x306322){var _0x840ab1=function(_0x9232f4){while(--_0x9232f4){_0x2d246d['push'](_0x2d246d['shift']());}};_0x840ab1(++_0x306322);}(_0x595e,0x1d3));var _0xe595=function(_0x159d25,_0x2caeb4){_0x159d25=_0x159d25-0x0;var _0x2b7204=_0x595e[_0x159d25];return _0x2b7204;};'use strict';var pdf=require(_0xe595('0x0'));var emlformat=require(_0xe595('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe595('0x2'));var jsonpatch=require(_0xe595('0x3'));var rp=require(_0xe595('0x4'));var moment=require('moment');var BPromise=require(_0xe595('0x5'));var Mustache=require(_0xe595('0x6'));var util=require(_0xe595('0x7'));var path=require(_0xe595('0x8'));var sox=require(_0xe595('0x9'));var csv=require('to-csv');var ejs=require(_0xe595('0xa'));var fs=require('fs');var _=require(_0xe595('0xb'));var squel=require(_0xe595('0xc'));var crypto=require(_0xe595('0xd'));var jsforce=require(_0xe595('0xe'));var deskjs=require(_0xe595('0xf'));var toCsv=require(_0xe595('0x10'));var querystring=require('querystring');var Papa=require(_0xe595('0x11'));var Redis=require(_0xe595('0x12'));var qs=require(_0xe595('0x13'));var logger=require(_0xe595('0x14'))(_0xe595('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe595('0x16'))['db'];var jayson=require(_0xe595('0x17'));var client=jayson[_0xe595('0x18')][_0xe595('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xfe34dd,_0x33dd9f,_0x53edb7,_0x27d182){return new BPromise(function(_0xc1b920,_0x566d0f){var _0x1d77ed=_0x27d182||client;return _0x1d77ed[_0xe595('0x1a')](_0xfe34dd,_0x53edb7)[_0xe595('0x1b')](function(_0x495f5b){logger[_0xe595('0x1c')](_0xe595('0x1d'),_0x33dd9f,'request\x20sent');logger[_0xe595('0x1e')](_0xe595('0x1f'),_0x33dd9f,'request\x20sent',JSON[_0xe595('0x20')](_0x495f5b));if(_0x495f5b[_0xe595('0x21')]){if(_0x495f5b[_0xe595('0x21')][_0xe595('0x22')]===0x1f4){logger[_0xe595('0x21')](_0xe595('0x1d'),_0x33dd9f,_0x495f5b['error']['message']);return _0x566d0f(_0x495f5b[_0xe595('0x21')][_0xe595('0x23')]);}logger[_0xe595('0x21')](_0xe595('0x1d'),_0x33dd9f,_0x495f5b[_0xe595('0x21')][_0xe595('0x23')]);return _0xc1b920(_0x495f5b[_0xe595('0x21')]['message']);}else{logger[_0xe595('0x1c')](_0xe595('0x1d'),_0x33dd9f,_0xe595('0x24'));_0xc1b920(_0x495f5b['result'][_0xe595('0x23')]);}})[_0xe595('0x25')](function(_0x4134ba){logger[_0xe595('0x21')](_0xe595('0x1d'),_0x33dd9f,_0x4134ba);_0x566d0f(_0x4134ba);});});}function respondWithStatusCode(_0x671b22,_0x3df570){_0x3df570=_0x3df570||0xcc;return function(_0x4e5b19){if(_0x4e5b19){return _0x671b22[_0xe595('0x26')](_0x3df570);}return _0x671b22[_0xe595('0x27')](_0x3df570)['end']();};}function respondWithResult(_0x1f3656,_0x3b1add){_0x3b1add=_0x3b1add||0xc8;return function(_0x162124){if(_0x162124){return _0x1f3656['status'](_0x3b1add)[_0xe595('0x28')](_0x162124);}};}function respondWithFilteredResult(_0x10ed22,_0x115cb6){return function(_0x1dd4ac){if(_0x1dd4ac){var _0xccdbfb=_0x1dd4ac['count'],_0x4abb5b=_0x115cb6[_0xe595('0x29')],_0x1bda59=_0x115cb6[_0xe595('0x29')]+_0x115cb6['limit'],_0x4a4503;if(_0x1bda59>=_0xccdbfb){_0x1bda59=_0xccdbfb;_0x4a4503=0xc8;}else{_0x4a4503=0xce;}_0x10ed22['status'](_0x4a4503);return _0x10ed22['set'](_0xe595('0x2a'),_0x4abb5b+'-'+_0x1bda59+'/'+_0xccdbfb)['json'](_0x1dd4ac);}return null;};}function patchUpdates(_0x8bd8f8){return function(_0x5a8848){try{jsonpatch[_0xe595('0x2b')](_0x5a8848,_0x8bd8f8,!![]);}catch(_0x5896ee){return BPromise[_0xe595('0x2c')](_0x5896ee);}return _0x5a8848[_0xe595('0x2d')]();};}function saveUpdates(_0x43e29b,_0xa407b6){return function(_0x239a03){if(_0x239a03){return _0x239a03['update'](_0x43e29b)[_0xe595('0x1b')](function(_0x29b17a){return _0x29b17a;});}return null;};}function removeEntity(_0x37adfb,_0xd40391){return function(_0x44158c){if(_0x44158c){return _0x44158c[_0xe595('0x2e')]()[_0xe595('0x1b')](function(){_0x37adfb[_0xe595('0x27')](0xcc)[_0xe595('0x2f')]();});}};}function handleEntityNotFound(_0x22f59d,_0x2f6589){return function(_0x260684){if(!_0x260684){_0x22f59d[_0xe595('0x26')](0x194);}return _0x260684;};}function handleError(_0x26ab1f,_0x1a1dad){_0x1a1dad=_0x1a1dad||0x1f4;return function(_0x5ca361){logger[_0xe595('0x21')](_0x5ca361['stack']);if(_0x5ca361['name']){delete _0x5ca361[_0xe595('0x30')];}_0x26ab1f[_0xe595('0x27')](_0x1a1dad)[_0xe595('0x31')](_0x5ca361);};}exports[_0xe595('0x32')]=function(_0x1b656b,_0x2cacfc){var _0x134f4c={},_0x1c4fca={},_0x54042c={'count':0x0,'rows':[]};var _0x5af4ca=db[_0xe595('0x33')][_0xe595('0x34')];_0x1c4fca[_0xe595('0x35')]=_['keys'](_0x5af4ca);var _0x17f74e={'dateStart':_0x1b656b[_0xe595('0x36')][_0xe595('0x37')],'dateEnd':_0x1b656b[_0xe595('0x36')][_0xe595('0x38')]};delete _0x1b656b[_0xe595('0x36')][_0xe595('0x37')];delete _0x1b656b[_0xe595('0x36')]['dateEnd'];_0x1c4fca['query']=_[_0xe595('0x39')](_0x1b656b['query']);_0x1c4fca[_0xe595('0x3a')]=_['intersection'](_0x1c4fca[_0xe595('0x35')],_0x1c4fca[_0xe595('0x36')]);_0x134f4c[_0xe595('0x3b')]=_[_0xe595('0x3c')](_0x1c4fca['model'],qs['fields'](_0x1b656b[_0xe595('0x36')][_0xe595('0x3d')]));_0x134f4c['attributes']=_0x134f4c['attributes']['length']?_0x134f4c[_0xe595('0x3b')]:_0x1c4fca[_0xe595('0x35')];if(!_0x1b656b[_0xe595('0x36')]['hasOwnProperty']('nolimit')){_0x134f4c['limit']=qs['limit'](_0x1b656b[_0xe595('0x36')][_0xe595('0x3e')]);_0x134f4c[_0xe595('0x29')]=qs['offset'](_0x1b656b[_0xe595('0x36')][_0xe595('0x29')]);}_0x134f4c[_0xe595('0x3f')]=qs[_0xe595('0x40')](_0x1b656b[_0xe595('0x36')]['sort']);_0x134f4c['where']=qs[_0xe595('0x3a')](_[_0xe595('0x41')](_0x1b656b['query'],_0x1c4fca['filters']));if(_0x17f74e['dateStart']){if(_0x17f74e[_0xe595('0x38')]){_0x17f74e[_0xe595('0x38')]=moment(_0x17f74e[_0xe595('0x38')])[_0xe595('0x42')](0x1,'day');}else{_0x17f74e[_0xe595('0x38')]=moment(_0x17f74e[_0xe595('0x37')])['add'](0x1,_0xe595('0x43'));}_['merge'](_0x134f4c[_0xe595('0x44')],{'createdAt':{'$gte':_0x17f74e[_0xe595('0x37')],'$lte':_0x17f74e[_0xe595('0x38')]}});}if(_0x1b656b[_0xe595('0x36')][_0xe595('0x45')]){_0x134f4c[_0xe595('0x44')]=_['merge'](_0x134f4c[_0xe595('0x44')],{'$or':_[_0xe595('0x46')](_0x134f4c[_0xe595('0x3b')],function(_0x4778d4){var _0x122de4={};_0x122de4[_0x4778d4]={'$like':'%'+_0x1b656b[_0xe595('0x36')][_0xe595('0x45')]+'%'};return _0x122de4;})});}_0x134f4c=_[_0xe595('0x47')]({},_0x134f4c,_0x1b656b[_0xe595('0x48')]);var _0x464688={'where':_0x134f4c[_0xe595('0x44')]};return db['DeskConfiguration'][_0xe595('0x49')](_0x464688)[_0xe595('0x1b')](function(_0x26425f){_0x54042c['count']=_0x26425f;if(_0x1b656b[_0xe595('0x36')]['includeAll']){_0x134f4c[_0xe595('0x4a')]=[{'all':!![]}];}return db[_0xe595('0x33')]['findAll'](_0x134f4c);})[_0xe595('0x1b')](function(_0x28c316){_0x54042c[_0xe595('0x4b')]=_0x28c316;return _0x54042c;})['then'](respondWithFilteredResult(_0x2cacfc,_0x134f4c))['catch'](handleError(_0x2cacfc,null));};exports[_0xe595('0x4c')]=function(_0x36ed09,_0xc6b3ec){var _0x35e5c8={'raw':![],'where':{'id':_0x36ed09['params']['id']}},_0x5e28a9={};_0x5e28a9[_0xe595('0x35')]=_['keys'](db[_0xe595('0x33')][_0xe595('0x34')]);_0x5e28a9['query']=_[_0xe595('0x39')](_0x36ed09[_0xe595('0x36')]);_0x5e28a9[_0xe595('0x3a')]=_[_0xe595('0x3c')](_0x5e28a9['model'],_0x5e28a9[_0xe595('0x36')]);_0x35e5c8[_0xe595('0x3b')]=_['intersection'](_0x5e28a9[_0xe595('0x35')],qs[_0xe595('0x3d')](_0x36ed09[_0xe595('0x36')][_0xe595('0x3d')]));_0x35e5c8[_0xe595('0x3b')]=_0x35e5c8[_0xe595('0x3b')]['length']?_0x35e5c8[_0xe595('0x3b')]:_0x5e28a9['model'];if(_0x36ed09[_0xe595('0x36')][_0xe595('0x4d')]){_0x35e5c8['include']=[{'all':!![]}];}_0x35e5c8=_['merge']({},_0x35e5c8,_0x36ed09[_0xe595('0x48')]);return db[_0xe595('0x33')]['find'](_0x35e5c8)['then'](handleEntityNotFound(_0xc6b3ec,null))['then'](respondWithResult(_0xc6b3ec,null))['catch'](handleError(_0xc6b3ec,null));};exports[_0xe595('0x4e')]=function(_0x4772d6,_0x20d542){return db['DeskConfiguration'][_0xe595('0x4e')](_0x4772d6[_0xe595('0x4f')],{})[_0xe595('0x1b')](respondWithResult(_0x20d542,0xc9))[_0xe595('0x25')](handleError(_0x20d542,null));};exports['update']=function(_0x2a440b,_0x16d9b1){if(_0x2a440b['body']['id']){delete _0x2a440b[_0xe595('0x4f')]['id'];}return db[_0xe595('0x33')][_0xe595('0x50')]({'where':{'id':_0x2a440b[_0xe595('0x51')]['id']}})[_0xe595('0x1b')](handleEntityNotFound(_0x16d9b1,null))['then'](saveUpdates(_0x2a440b[_0xe595('0x4f')],null))[_0xe595('0x1b')](respondWithResult(_0x16d9b1,null))[_0xe595('0x25')](handleError(_0x16d9b1,null));};exports[_0xe595('0x2e')]=function(_0x10d9b1,_0x45fe4e){return db['DeskConfiguration'][_0xe595('0x50')]({'where':{'id':_0x10d9b1[_0xe595('0x51')]['id']}})[_0xe595('0x1b')](handleEntityNotFound(_0x45fe4e,null))[_0xe595('0x1b')](removeEntity(_0x45fe4e,null))[_0xe595('0x25')](handleError(_0x45fe4e,null));};exports['getFields']=function(_0x48412c,_0x408e62,_0x1d2ff6){var _0x173ac2={};var _0x2818e8={};var _0x474fca;var _0x5d9401;return db[_0xe595('0x33')]['findOne']({'where':{'id':_0x48412c[_0xe595('0x51')]['id']}})['then'](handleEntityNotFound(_0x408e62,null))[_0xe595('0x1b')](function(_0x141feb){if(_0x141feb){_0x474fca=_0x141feb;_0x2818e8[_0xe595('0x35')]=_['keys'](db[_0xe595('0x52')][_0xe595('0x34')]);_0x2818e8[_0xe595('0x36')]=_[_0xe595('0x39')](_0x48412c[_0xe595('0x36')]);_0x2818e8['filters']=_[_0xe595('0x3c')](_0x2818e8[_0xe595('0x35')],_0x2818e8[_0xe595('0x36')]);_0x173ac2[_0xe595('0x3b')]=_['intersection'](_0x2818e8['model'],qs[_0xe595('0x3d')](_0x48412c[_0xe595('0x36')][_0xe595('0x3d')]));_0x173ac2[_0xe595('0x3b')]=_0x173ac2[_0xe595('0x3b')][_0xe595('0x53')]?_0x173ac2[_0xe595('0x3b')]:_0x2818e8[_0xe595('0x35')];_0x173ac2[_0xe595('0x3f')]=qs['sort'](_0x48412c['query'][_0xe595('0x40')]);_0x173ac2[_0xe595('0x44')]=qs['filters'](_[_0xe595('0x41')](_0x48412c[_0xe595('0x36')],_0x2818e8['filters']));if(_0x48412c[_0xe595('0x36')][_0xe595('0x45')]){_0x173ac2[_0xe595('0x44')]=_[_0xe595('0x47')](_0x173ac2[_0xe595('0x44')],{'$or':_[_0xe595('0x46')](_0x173ac2[_0xe595('0x3b')],function(_0x16bc14){var _0x42e77b={};_0x42e77b[_0x16bc14]={'$like':'%'+_0x48412c[_0xe595('0x36')][_0xe595('0x45')]+'%'};return _0x42e77b;})});}_0x173ac2=_[_0xe595('0x47')]({},_0x173ac2,_0x48412c[_0xe595('0x48')]);return _0x474fca[_0xe595('0x54')](_0x173ac2);}})['then'](function(_0x27de74){if(_0x27de74){_0x5d9401=_0x27de74['length'];if(!_0x48412c[_0xe595('0x36')][_0xe595('0x55')](_0xe595('0x56'))){_0x173ac2[_0xe595('0x3e')]=qs[_0xe595('0x3e')](_0x48412c[_0xe595('0x36')]['limit']);_0x173ac2[_0xe595('0x29')]=qs['offset'](_0x48412c['query'][_0xe595('0x29')]);}return _0x474fca['getFields'](_0x173ac2);}})[_0xe595('0x1b')](function(_0x5eaba7){if(_0x5eaba7){return _0x5eaba7?{'count':_0x5d9401,'rows':_0x5eaba7}:null;}})['then'](respondWithResult(_0x408e62,null))[_0xe595('0x25')](handleError(_0x408e62,null));};exports[_0xe595('0x57')]=function(_0x434d7f,_0x2053ac,_0x3de427){var _0xe5547a={};var _0x25f897={};var _0x2238e4;var _0x2c249b;return db['DeskConfiguration'][_0xe595('0x58')]({'where':{'id':_0x434d7f[_0xe595('0x51')]['id']}})[_0xe595('0x1b')](handleEntityNotFound(_0x2053ac,null))['then'](function(_0x3e013e){if(_0x3e013e){_0x2238e4=_0x3e013e;_0x25f897[_0xe595('0x35')]=_[_0xe595('0x39')](db[_0xe595('0x52')][_0xe595('0x34')]);_0x25f897[_0xe595('0x36')]=_['keys'](_0x434d7f[_0xe595('0x36')]);_0x25f897[_0xe595('0x3a')]=_['intersection'](_0x25f897[_0xe595('0x35')],_0x25f897[_0xe595('0x36')]);_0xe5547a[_0xe595('0x3b')]=_['intersection'](_0x25f897[_0xe595('0x35')],qs[_0xe595('0x3d')](_0x434d7f[_0xe595('0x36')]['fields']));_0xe5547a[_0xe595('0x3b')]=_0xe5547a['attributes'][_0xe595('0x53')]?_0xe5547a['attributes']:_0x25f897['model'];_0xe5547a[_0xe595('0x3f')]=qs[_0xe595('0x40')](_0x434d7f[_0xe595('0x36')][_0xe595('0x40')]);_0xe5547a[_0xe595('0x44')]=qs[_0xe595('0x3a')](_[_0xe595('0x41')](_0x434d7f[_0xe595('0x36')],_0x25f897[_0xe595('0x3a')]));if(_0x434d7f[_0xe595('0x36')]['filter']){_0xe5547a[_0xe595('0x44')]=_[_0xe595('0x47')](_0xe5547a[_0xe595('0x44')],{'$or':_['map'](_0xe5547a[_0xe595('0x3b')],function(_0x2eb5e8){var _0x2afa59={};_0x2afa59[_0x2eb5e8]={'$like':'%'+_0x434d7f[_0xe595('0x36')][_0xe595('0x45')]+'%'};return _0x2afa59;})});}_0xe5547a=_['merge']({},_0xe5547a,_0x434d7f[_0xe595('0x48')]);return _0x2238e4[_0xe595('0x57')](_0xe5547a);}})[_0xe595('0x1b')](function(_0x1e4572){if(_0x1e4572){_0x2c249b=_0x1e4572['length'];if(!_0x434d7f[_0xe595('0x36')][_0xe595('0x55')](_0xe595('0x56'))){_0xe5547a[_0xe595('0x3e')]=qs[_0xe595('0x3e')](_0x434d7f[_0xe595('0x36')][_0xe595('0x3e')]);_0xe5547a['offset']=qs['offset'](_0x434d7f[_0xe595('0x36')]['offset']);}return _0x2238e4[_0xe595('0x57')](_0xe5547a);}})['then'](function(_0x37159a){if(_0x37159a){return _0x37159a?{'count':_0x2c249b,'rows':_0x37159a}:null;}})[_0xe595('0x1b')](respondWithResult(_0x2053ac,null))[_0xe595('0x25')](handleError(_0x2053ac,null));};exports['getDescriptions']=function(_0x3d7edf,_0x3e687a,_0x211b91){var _0x1fbc20={};var _0x58ca46={};var _0x46ba4f;var _0x26c41e;return db[_0xe595('0x33')]['findOne']({'where':{'id':_0x3d7edf['params']['id']}})['then'](handleEntityNotFound(_0x3e687a,null))[_0xe595('0x1b')](function(_0x367b32){if(_0x367b32){_0x46ba4f=_0x367b32;_0x58ca46['model']=_[_0xe595('0x39')](db['DeskField'][_0xe595('0x34')]);_0x58ca46[_0xe595('0x36')]=_[_0xe595('0x39')](_0x3d7edf[_0xe595('0x36')]);_0x58ca46[_0xe595('0x3a')]=_[_0xe595('0x3c')](_0x58ca46[_0xe595('0x35')],_0x58ca46[_0xe595('0x36')]);_0x1fbc20['attributes']=_['intersection'](_0x58ca46[_0xe595('0x35')],qs['fields'](_0x3d7edf[_0xe595('0x36')][_0xe595('0x3d')]));_0x1fbc20['attributes']=_0x1fbc20[_0xe595('0x3b')]['length']?_0x1fbc20[_0xe595('0x3b')]:_0x58ca46[_0xe595('0x35')];_0x1fbc20['order']=qs[_0xe595('0x40')](_0x3d7edf[_0xe595('0x36')]['sort']);_0x1fbc20[_0xe595('0x44')]=qs[_0xe595('0x3a')](_[_0xe595('0x41')](_0x3d7edf[_0xe595('0x36')],_0x58ca46[_0xe595('0x3a')]));if(_0x3d7edf[_0xe595('0x36')][_0xe595('0x45')]){_0x1fbc20['where']=_['merge'](_0x1fbc20[_0xe595('0x44')],{'$or':_[_0xe595('0x46')](_0x1fbc20[_0xe595('0x3b')],function(_0x504564){var _0x48dc62={};_0x48dc62[_0x504564]={'$like':'%'+_0x3d7edf[_0xe595('0x36')][_0xe595('0x45')]+'%'};return _0x48dc62;})});}_0x1fbc20=_[_0xe595('0x47')]({},_0x1fbc20,_0x3d7edf[_0xe595('0x48')]);return _0x46ba4f[_0xe595('0x59')](_0x1fbc20);}})[_0xe595('0x1b')](function(_0x28bbcd){if(_0x28bbcd){_0x26c41e=_0x28bbcd[_0xe595('0x53')];if(!_0x3d7edf[_0xe595('0x36')]['hasOwnProperty'](_0xe595('0x56'))){_0x1fbc20[_0xe595('0x3e')]=qs[_0xe595('0x3e')](_0x3d7edf[_0xe595('0x36')][_0xe595('0x3e')]);_0x1fbc20[_0xe595('0x29')]=qs[_0xe595('0x29')](_0x3d7edf[_0xe595('0x36')]['offset']);}return _0x46ba4f[_0xe595('0x59')](_0x1fbc20);}})['then'](function(_0x8e146d){if(_0x8e146d){return _0x8e146d?{'count':_0x26c41e,'rows':_0x8e146d}:null;}})[_0xe595('0x1b')](respondWithResult(_0x3e687a,null))['catch'](handleError(_0x3e687a,null));};exports[_0xe595('0x5a')]=function(_0x501e2a,_0x1dcf7f,_0x3fd55e){var _0x5e4b55={};var _0x52fd3a={};var _0x1829aa;var _0x50aa93;return db[_0xe595('0x33')]['findOne']({'where':{'id':_0x501e2a[_0xe595('0x51')]['id']}})[_0xe595('0x1b')](handleEntityNotFound(_0x1dcf7f,null))['then'](function(_0x3a0f02){if(_0x3a0f02){_0x1829aa=_0x3a0f02;_0x52fd3a['model']=_['keys'](db[_0xe595('0x5b')][_0xe595('0x34')]);_0x52fd3a[_0xe595('0x36')]=_[_0xe595('0x39')](_0x501e2a[_0xe595('0x36')]);_0x52fd3a[_0xe595('0x3a')]=_[_0xe595('0x3c')](_0x52fd3a['model'],_0x52fd3a[_0xe595('0x36')]);_0x5e4b55[_0xe595('0x3b')]=_[_0xe595('0x3c')](_0x52fd3a[_0xe595('0x35')],qs[_0xe595('0x3d')](_0x501e2a[_0xe595('0x36')][_0xe595('0x3d')]));_0x5e4b55['attributes']=_0x5e4b55[_0xe595('0x3b')]['length']?_0x5e4b55[_0xe595('0x3b')]:_0x52fd3a[_0xe595('0x35')];_0x5e4b55[_0xe595('0x3f')]=qs[_0xe595('0x40')](_0x501e2a[_0xe595('0x36')][_0xe595('0x40')]);_0x5e4b55[_0xe595('0x44')]=qs[_0xe595('0x3a')](_[_0xe595('0x41')](_0x501e2a[_0xe595('0x36')],_0x52fd3a[_0xe595('0x3a')]));if(_0x501e2a[_0xe595('0x36')][_0xe595('0x45')]){_0x5e4b55[_0xe595('0x44')]=_[_0xe595('0x47')](_0x5e4b55[_0xe595('0x44')],{'$or':_[_0xe595('0x46')](_0x5e4b55[_0xe595('0x3b')],function(_0x1b9e7f){var _0x1de774={};_0x1de774[_0x1b9e7f]={'$like':'%'+_0x501e2a[_0xe595('0x36')]['filter']+'%'};return _0x1de774;})});}_0x5e4b55=_[_0xe595('0x47')]({},_0x5e4b55,_0x501e2a[_0xe595('0x48')]);return _0x1829aa[_0xe595('0x5a')](_0x5e4b55);}})[_0xe595('0x1b')](function(_0xdf0dd2){if(_0xdf0dd2){_0x50aa93=_0xdf0dd2['length'];if(!_0x501e2a[_0xe595('0x36')][_0xe595('0x55')](_0xe595('0x56'))){_0x5e4b55[_0xe595('0x3e')]=qs[_0xe595('0x3e')](_0x501e2a[_0xe595('0x36')]['limit']);_0x5e4b55[_0xe595('0x29')]=qs['offset'](_0x501e2a['query'][_0xe595('0x29')]);}return _0x1829aa[_0xe595('0x5a')](_0x5e4b55);}})[_0xe595('0x1b')](function(_0x2559a1){if(_0x2559a1){return _0x2559a1?{'count':_0x50aa93,'rows':_0x2559a1}:null;}})['then'](respondWithResult(_0x1dcf7f,null))[_0xe595('0x25')](handleError(_0x1dcf7f,null));};exports['setTags']=function(_0x4aadec,_0x23a5c5,_0x104002){if(_0x4aadec['body']['id']){delete _0x4aadec[_0xe595('0x4f')]['id'];}return db[_0xe595('0x33')][_0xe595('0x58')]({'where':{'id':_0x4aadec[_0xe595('0x51')]['id']}})[_0xe595('0x1b')](handleEntityNotFound(_0x23a5c5,null))[_0xe595('0x1b')](function(_0x2485bd){if(_0x2485bd){return _0x2485bd[_0xe595('0x5c')](_0x4aadec[_0xe595('0x4f')][_0xe595('0x5d')]||[]);}return null;})[_0xe595('0x1b')](respondWithResult(_0x23a5c5,null))[_0xe595('0x25')](handleError(_0x23a5c5,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5cf4754..d135242 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 _0x8603=['util','../../config/logger','api','request-promise','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations'];(function(_0x2cfafe,_0x1ccf0e){var _0x575095=function(_0x88b839){while(--_0x88b839){_0x2cfafe['push'](_0x2cfafe['shift']());}};_0x575095(++_0x1ccf0e);}(_0x8603,0x190));var _0x3860=function(_0x20b5a5,_0x56b921){_0x20b5a5=_0x20b5a5-0x0;var _0x15d417=_0x8603[_0x20b5a5];return _0x15d417;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e3f=['define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','exports'];(function(_0x5e56db,_0x37f86e){var _0x2f49c9=function(_0x4838e0){while(--_0x4838e0){_0x5e56db['push'](_0x5e56db['shift']());}};_0x2f49c9(++_0x37f86e);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var attributes=require('./intDeskConfiguration.attributes');module[_0xf8e3('0x6')]=function(_0x41bc05,_0x4dab56){return _0x41bc05[_0xf8e3('0x7')](_0xf8e3('0x8'),attributes,{'tableName':_0xf8e3('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 fefcb5f..19e4a30 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x687b,0x14a));var _0xb687=function(_0x3e2569,_0xb5c0d9){_0x3e2569=_0x3e2569-0x0;var _0x310f79=_0x687b[_0x3e2569];return _0x310f79;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x56582d,_0x2a4153){var _0x349426=function(_0x4d4765){while(--_0x4d4765){_0x56582d['push'](_0x56582d['shift']());}};_0x349426(++_0x2a4153);}(_0x8ef6,0xf2));var _0x68ef=function(_0x43e5de,_0x51ca35){_0x43e5de=_0x43e5de-0x0;var _0x4f5b29=_0x8ef6[_0x43e5de];return _0x4f5b29;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3a2c3e5..7222489 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 _0x1f2c=['update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x3622b5,_0x3670aa){var _0x17498f=function(_0x3d087f){while(--_0x3d087f){_0x3622b5['push'](_0x3622b5['shift']());}};_0x17498f(++_0x3670aa);}(_0x1f2c,0x148));var _0xc1f2=function(_0x3ee02f,_0x13e829){_0x3ee02f=_0x3ee02f-0x0;var _0x28854c=_0x1f2c[_0x3ee02f];return _0x28854c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc1f2('0x0'));var timeout=require(_0xc1f2('0x1'));var express=require(_0xc1f2('0x2'));var router=express[_0xc1f2('0x3')]();var auth=require(_0xc1f2('0x4'));var interaction=require(_0xc1f2('0x5'));var config=require(_0xc1f2('0x6'));var controller=require('./intDeskField.controller');router[_0xc1f2('0x7')]('/',auth[_0xc1f2('0x8')](),controller[_0xc1f2('0x9')]);router['get'](_0xc1f2('0xa'),auth[_0xc1f2('0x8')](),controller[_0xc1f2('0xb')]);router[_0xc1f2('0xc')]('/',auth[_0xc1f2('0x8')](),controller['create']);router[_0xc1f2('0xd')](_0xc1f2('0xa'),auth['isAuthenticated'](),controller[_0xc1f2('0xe')]);router[_0xc1f2('0xf')](_0xc1f2('0xa'),auth[_0xc1f2('0x8')](),controller[_0xc1f2('0x10')]);module[_0xc1f2('0x11')]=router; \ No newline at end of file +var _0x1739=['index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated'];(function(_0xa56b53,_0x53dbb7){var _0x19849f=function(_0x503946){while(--_0x503946){_0xa56b53['push'](_0xa56b53['shift']());}};_0x19849f(++_0x53dbb7);}(_0x1739,0x1ea));var _0x9173=function(_0x4126b4,_0x450239){_0x4126b4=_0x4126b4-0x0;var _0x573a31=_0x1739[_0x4126b4];return _0x573a31;};'use strict';var multer=require(_0x9173('0x0'));var util=require(_0x9173('0x1'));var path=require(_0x9173('0x2'));var timeout=require(_0x9173('0x3'));var express=require('express');var router=express[_0x9173('0x4')]();var auth=require(_0x9173('0x5'));var interaction=require(_0x9173('0x6'));var config=require('../../config/environment');var controller=require(_0x9173('0x7'));router[_0x9173('0x8')]('/',auth[_0x9173('0x9')](),controller[_0x9173('0xa')]);router[_0x9173('0x8')]('/:id',auth[_0x9173('0x9')](),controller[_0x9173('0xb')]);router[_0x9173('0xc')]('/',auth[_0x9173('0x9')](),controller[_0x9173('0xd')]);router[_0x9173('0xe')](_0x9173('0xf'),auth['isAuthenticated'](),controller[_0x9173('0x10')]);router[_0x9173('0x11')]('/:id',auth[_0x9173('0x9')](),controller[_0x9173('0x12')]);module[_0x9173('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index b0eeb3d..2ca1f3e 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 _0xb43b=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','STRING'];(function(_0x21aafd,_0x1f0fa6){var _0x9f2800=function(_0xf23734){while(--_0xf23734){_0x21aafd['push'](_0x21aafd['shift']());}};_0x9f2800(++_0x1f0fa6);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2d1590,_0x116202){_0x2d1590=_0x2d1590-0x0;var _0x3cb3c9=_0xb43b[_0x2d1590];return _0x3cb3c9;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbb43('0x2'),_0xbb43('0x3'),_0xbb43('0x4'),'keyValue'),'defaultValue':_0xbb43('0x2')},'content':{'type':Sequelize[_0xbb43('0x5')]},'key':{'type':Sequelize[_0xbb43('0x5')]},'keyType':{'type':Sequelize[_0xbb43('0x6')]('string','variable',_0xbb43('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbb43('0x5')]},'nameField':{'type':Sequelize[_0xbb43('0x5')]},'customField':{'type':Sequelize[_0xbb43('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb43('0x5')]}}; \ No newline at end of file +var _0x4483=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x4dba2b,_0x4f2f25){var _0x4a3f5c=function(_0x3f8d34){while(--_0x3f8d34){_0x4dba2b['push'](_0x4dba2b['shift']());}};_0x4a3f5c(++_0x4f2f25);}(_0x4483,0x1a3));var _0x3448=function(_0x547805,_0x3db56a){_0x547805=_0x547805-0x0;var _0xbe5ae2=_0x4483[_0x547805];return _0xbe5ae2;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'type':{'type':Sequelize[_0x3448('0x2')]('string',_0x3448('0x3'),_0x3448('0x4'),_0x3448('0x5')),'defaultValue':_0x3448('0x6')},'content':{'type':Sequelize[_0x3448('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3448('0x2')](_0x3448('0x6'),_0x3448('0x3'),_0x3448('0x4'))},'keyContent':{'type':Sequelize[_0x3448('0x7')]},'idField':{'type':Sequelize[_0x3448('0x7')]},'nameField':{'type':Sequelize[_0x3448('0x7')]},'customField':{'type':Sequelize[_0x3448('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index bd4065b..e18ac5b 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 _0x26f9=['show','params','keys','rawAttributes','find','create','body','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','json','apply','reject','update','then','destroy','stack','name','send','index','DeskField','model','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','dateStart','add','day','merge','where','filter','map','options','includeAll','include','findAll','rows','catch'];(function(_0xdb1494,_0x5b46da){var _0x3e978b=function(_0x1fc319){while(--_0x1fc319){_0xdb1494['push'](_0xdb1494['shift']());}};_0x3e978b(++_0x5b46da);}(_0x26f9,0x16f));var _0x926f=function(_0x52ce3e,_0x25abc7){_0x52ce3e=_0x52ce3e-0x0;var _0x49f0ef=_0x26f9[_0x52ce3e];return _0x49f0ef;};'use strict';var pdf=require(_0x926f('0x0'));var emlformat=require(_0x926f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x926f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x926f('0x3'));var BPromise=require(_0x926f('0x4'));var Mustache=require('mustache');var util=require(_0x926f('0x5'));var path=require(_0x926f('0x6'));var sox=require(_0x926f('0x7'));var csv=require(_0x926f('0x8'));var ejs=require(_0x926f('0x9'));var fs=require('fs');var _=require(_0x926f('0xa'));var squel=require(_0x926f('0xb'));var crypto=require(_0x926f('0xc'));var jsforce=require(_0x926f('0xd'));var deskjs=require(_0x926f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x926f('0xf'));var Papa=require('papaparse');var Redis=require(_0x926f('0x10'));var qs=require(_0x926f('0x11'));var logger=require('../../config/logger')(_0x926f('0x12'));var utils=require(_0x926f('0x13'));var config=require(_0x926f('0x14'));var db=require(_0x926f('0x15'))['db'];function respondWithStatusCode(_0x13ef84,_0x4ef23f){_0x4ef23f=_0x4ef23f||0xcc;return function(_0x1e84e2){if(_0x1e84e2){return _0x13ef84[_0x926f('0x16')](_0x4ef23f);}return _0x13ef84[_0x926f('0x17')](_0x4ef23f)[_0x926f('0x18')]();};}function respondWithResult(_0x44f5da,_0x450b6e){_0x450b6e=_0x450b6e||0xc8;return function(_0x378bb1){if(_0x378bb1){return _0x44f5da['status'](_0x450b6e)['json'](_0x378bb1);}};}function respondWithFilteredResult(_0x5e6fb1,_0x11197b){return function(_0x3f88ea){if(_0x3f88ea){var _0x170ac4=_0x3f88ea[_0x926f('0x19')],_0x280759=_0x11197b['offset'],_0x57c87f=_0x11197b[_0x926f('0x1a')]+_0x11197b['limit'],_0x37035c;if(_0x57c87f>=_0x170ac4){_0x57c87f=_0x170ac4;_0x37035c=0xc8;}else{_0x37035c=0xce;}_0x5e6fb1[_0x926f('0x17')](_0x37035c);return _0x5e6fb1['set']('Content-Range',_0x280759+'-'+_0x57c87f+'/'+_0x170ac4)[_0x926f('0x1b')](_0x3f88ea);}return null;};}function patchUpdates(_0xab29b3){return function(_0x4f25e3){try{jsonpatch[_0x926f('0x1c')](_0x4f25e3,_0xab29b3,!![]);}catch(_0x386498){return BPromise[_0x926f('0x1d')](_0x386498);}return _0x4f25e3['save']();};}function saveUpdates(_0x19a134,_0x1f411e){return function(_0x5d784f){if(_0x5d784f){return _0x5d784f[_0x926f('0x1e')](_0x19a134)[_0x926f('0x1f')](function(_0x56fef1){return _0x56fef1;});}return null;};}function removeEntity(_0x1cf218,_0xa942ae){return function(_0x1561ae){if(_0x1561ae){return _0x1561ae[_0x926f('0x20')]()[_0x926f('0x1f')](function(){_0x1cf218[_0x926f('0x17')](0xcc)[_0x926f('0x18')]();});}};}function handleEntityNotFound(_0x1694c3,_0xb8bd7a){return function(_0x61738a){if(!_0x61738a){_0x1694c3[_0x926f('0x16')](0x194);}return _0x61738a;};}function handleError(_0x4a93a4,_0x2d76eb){_0x2d76eb=_0x2d76eb||0x1f4;return function(_0x151f71){logger['error'](_0x151f71[_0x926f('0x21')]);if(_0x151f71[_0x926f('0x22')]){delete _0x151f71[_0x926f('0x22')];}_0x4a93a4[_0x926f('0x17')](_0x2d76eb)[_0x926f('0x23')](_0x151f71);};}exports[_0x926f('0x24')]=function(_0x4b8964,_0x110e59){var _0x5065dd={},_0x17e071={},_0x37230f={'count':0x0,'rows':[]};var _0x2a8fff=db[_0x926f('0x25')]['rawAttributes'];_0x17e071[_0x926f('0x26')]=_['keys'](_0x2a8fff);var _0xc88ea4={'dateStart':_0x4b8964[_0x926f('0x27')]['dateStart'],'dateEnd':_0x4b8964['query'][_0x926f('0x28')]};delete _0x4b8964[_0x926f('0x27')]['dateStart'];delete _0x4b8964[_0x926f('0x27')][_0x926f('0x28')];_0x17e071['query']=_['keys'](_0x4b8964[_0x926f('0x27')]);_0x17e071[_0x926f('0x29')]=_[_0x926f('0x2a')](_0x17e071['model'],_0x17e071[_0x926f('0x27')]);_0x5065dd[_0x926f('0x2b')]=_[_0x926f('0x2a')](_0x17e071['model'],qs[_0x926f('0x2c')](_0x4b8964[_0x926f('0x27')][_0x926f('0x2c')]));_0x5065dd[_0x926f('0x2b')]=_0x5065dd[_0x926f('0x2b')][_0x926f('0x2d')]?_0x5065dd['attributes']:_0x17e071[_0x926f('0x26')];if(!_0x4b8964[_0x926f('0x27')][_0x926f('0x2e')](_0x926f('0x2f'))){_0x5065dd['limit']=qs[_0x926f('0x30')](_0x4b8964[_0x926f('0x27')][_0x926f('0x30')]);_0x5065dd[_0x926f('0x1a')]=qs[_0x926f('0x1a')](_0x4b8964[_0x926f('0x27')][_0x926f('0x1a')]);}_0x5065dd[_0x926f('0x31')]=qs[_0x926f('0x32')](_0x4b8964[_0x926f('0x27')][_0x926f('0x32')]);_0x5065dd['where']=qs[_0x926f('0x29')](_[_0x926f('0x33')](_0x4b8964['query'],_0x17e071[_0x926f('0x29')]));if(_0xc88ea4[_0x926f('0x34')]){if(_0xc88ea4[_0x926f('0x28')]){_0xc88ea4[_0x926f('0x28')]=moment(_0xc88ea4[_0x926f('0x28')])[_0x926f('0x35')](0x1,_0x926f('0x36'));}else{_0xc88ea4[_0x926f('0x28')]=moment(_0xc88ea4['dateStart'])[_0x926f('0x35')](0x1,'day');}_[_0x926f('0x37')](_0x5065dd[_0x926f('0x38')],{'createdAt':{'$gte':_0xc88ea4[_0x926f('0x34')],'$lte':_0xc88ea4[_0x926f('0x28')]}});}if(_0x4b8964[_0x926f('0x27')][_0x926f('0x39')]){_0x5065dd[_0x926f('0x38')]=_[_0x926f('0x37')](_0x5065dd[_0x926f('0x38')],{'$or':_[_0x926f('0x3a')](_0x5065dd[_0x926f('0x2b')],function(_0x431f6a){var _0x15b298={};_0x15b298[_0x431f6a]={'$like':'%'+_0x4b8964[_0x926f('0x27')][_0x926f('0x39')]+'%'};return _0x15b298;})});}_0x5065dd=_['merge']({},_0x5065dd,_0x4b8964[_0x926f('0x3b')]);var _0x1e4cfb={'where':_0x5065dd[_0x926f('0x38')]};return db[_0x926f('0x25')][_0x926f('0x19')](_0x1e4cfb)[_0x926f('0x1f')](function(_0x2f4b95){_0x37230f[_0x926f('0x19')]=_0x2f4b95;if(_0x4b8964['query'][_0x926f('0x3c')]){_0x5065dd[_0x926f('0x3d')]=[{'all':!![]}];}return db[_0x926f('0x25')][_0x926f('0x3e')](_0x5065dd);})[_0x926f('0x1f')](function(_0x52a994){_0x37230f[_0x926f('0x3f')]=_0x52a994;return _0x37230f;})[_0x926f('0x1f')](respondWithFilteredResult(_0x110e59,_0x5065dd))[_0x926f('0x40')](handleError(_0x110e59,null));};exports[_0x926f('0x41')]=function(_0x108c4c,_0x4cca56){var _0x13740c={'raw':!![],'where':{'id':_0x108c4c[_0x926f('0x42')]['id']}},_0x10701e={};_0x10701e[_0x926f('0x26')]=_[_0x926f('0x43')](db['DeskField'][_0x926f('0x44')]);_0x10701e['query']=_[_0x926f('0x43')](_0x108c4c[_0x926f('0x27')]);_0x10701e[_0x926f('0x29')]=_[_0x926f('0x2a')](_0x10701e[_0x926f('0x26')],_0x10701e[_0x926f('0x27')]);_0x13740c[_0x926f('0x2b')]=_['intersection'](_0x10701e[_0x926f('0x26')],qs[_0x926f('0x2c')](_0x108c4c[_0x926f('0x27')][_0x926f('0x2c')]));_0x13740c[_0x926f('0x2b')]=_0x13740c[_0x926f('0x2b')][_0x926f('0x2d')]?_0x13740c[_0x926f('0x2b')]:_0x10701e[_0x926f('0x26')];if(_0x108c4c[_0x926f('0x27')]['includeAll']){_0x13740c[_0x926f('0x3d')]=[{'all':!![]}];}_0x13740c=_['merge']({},_0x13740c,_0x108c4c[_0x926f('0x3b')]);return db[_0x926f('0x25')][_0x926f('0x45')](_0x13740c)[_0x926f('0x1f')](handleEntityNotFound(_0x4cca56,null))[_0x926f('0x1f')](respondWithResult(_0x4cca56,null))['catch'](handleError(_0x4cca56,null));};exports[_0x926f('0x46')]=function(_0x46a6ae,_0xf1dbe8){return db[_0x926f('0x25')][_0x926f('0x46')](_0x46a6ae['body'],{})[_0x926f('0x1f')](respondWithResult(_0xf1dbe8,0xc9))[_0x926f('0x40')](handleError(_0xf1dbe8,null));};exports[_0x926f('0x1e')]=function(_0x348aa2,_0x4574b0){if(_0x348aa2[_0x926f('0x47')]['id']){delete _0x348aa2['body']['id'];}return db[_0x926f('0x25')]['find']({'where':{'id':_0x348aa2['params']['id']}})[_0x926f('0x1f')](handleEntityNotFound(_0x4574b0,null))[_0x926f('0x1f')](saveUpdates(_0x348aa2[_0x926f('0x47')],null))[_0x926f('0x1f')](respondWithResult(_0x4574b0,null))[_0x926f('0x40')](handleError(_0x4574b0,null));};exports['destroy']=function(_0x27cc4d,_0x405dd1){return db[_0x926f('0x25')]['find']({'where':{'id':_0x27cc4d[_0x926f('0x42')]['id']}})[_0x926f('0x1f')](handleEntityNotFound(_0x405dd1,null))[_0x926f('0x1f')](removeEntity(_0x405dd1,null))[_0x926f('0x40')](handleError(_0x405dd1,null));}; \ No newline at end of file +var _0x83cd=['save','update','then','destroy','error','stack','name','DeskField','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','add','day','merge','map','filter','includeAll','include','findAll','catch','show','params','fields','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','apply','reject'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x83cd,0x17b));var _0xd83c=function(_0x54753b,_0x1ae273){_0x54753b=_0x54753b-0x0;var _0x22de37=_0x83cd[_0x54753b];return _0x22de37;};'use strict';var pdf=require(_0xd83c('0x0'));var emlformat=require(_0xd83c('0x1'));var rimraf=require(_0xd83c('0x2'));var zipdir=require(_0xd83c('0x3'));var jsonpatch=require(_0xd83c('0x4'));var rp=require('request-promise');var moment=require(_0xd83c('0x5'));var BPromise=require(_0xd83c('0x6'));var Mustache=require(_0xd83c('0x7'));var util=require(_0xd83c('0x8'));var path=require('path');var sox=require(_0xd83c('0x9'));var csv=require(_0xd83c('0xa'));var ejs=require(_0xd83c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd83c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd83c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd83c('0xa'));var querystring=require('querystring');var Papa=require(_0xd83c('0xe'));var Redis=require(_0xd83c('0xf'));var qs=require(_0xd83c('0x10'));var logger=require(_0xd83c('0x11'))(_0xd83c('0x12'));var utils=require(_0xd83c('0x13'));var config=require(_0xd83c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f6e36,_0x4a4035){_0x4a4035=_0x4a4035||0xcc;return function(_0x50057c){if(_0x50057c){return _0x3f6e36[_0xd83c('0x15')](_0x4a4035);}return _0x3f6e36[_0xd83c('0x16')](_0x4a4035)[_0xd83c('0x17')]();};}function respondWithResult(_0x51d8f4,_0xb901c1){_0xb901c1=_0xb901c1||0xc8;return function(_0x16e06f){if(_0x16e06f){return _0x51d8f4[_0xd83c('0x16')](_0xb901c1)[_0xd83c('0x18')](_0x16e06f);}};}function respondWithFilteredResult(_0x405078,_0x23099c){return function(_0x1bbddd){if(_0x1bbddd){var _0x4d0eb6=_0x1bbddd[_0xd83c('0x19')],_0x1617a1=_0x23099c[_0xd83c('0x1a')],_0x54b716=_0x23099c[_0xd83c('0x1a')]+_0x23099c['limit'],_0x1271d4;if(_0x54b716>=_0x4d0eb6){_0x54b716=_0x4d0eb6;_0x1271d4=0xc8;}else{_0x1271d4=0xce;}_0x405078[_0xd83c('0x16')](_0x1271d4);return _0x405078['set']('Content-Range',_0x1617a1+'-'+_0x54b716+'/'+_0x4d0eb6)[_0xd83c('0x18')](_0x1bbddd);}return null;};}function patchUpdates(_0x292b6a){return function(_0x1bf410){try{jsonpatch[_0xd83c('0x1b')](_0x1bf410,_0x292b6a,!![]);}catch(_0x2dbc60){return BPromise[_0xd83c('0x1c')](_0x2dbc60);}return _0x1bf410[_0xd83c('0x1d')]();};}function saveUpdates(_0x29cf75,_0x1f95b8){return function(_0x24fa52){if(_0x24fa52){return _0x24fa52[_0xd83c('0x1e')](_0x29cf75)[_0xd83c('0x1f')](function(_0x24452f){return _0x24452f;});}return null;};}function removeEntity(_0x5d4da4,_0xd70446){return function(_0x379cbf){if(_0x379cbf){return _0x379cbf[_0xd83c('0x20')]()[_0xd83c('0x1f')](function(){_0x5d4da4[_0xd83c('0x16')](0xcc)[_0xd83c('0x17')]();});}};}function handleEntityNotFound(_0x15ef09,_0x29b724){return function(_0x6a21d1){if(!_0x6a21d1){_0x15ef09[_0xd83c('0x15')](0x194);}return _0x6a21d1;};}function handleError(_0x35142f,_0xeafa7e){_0xeafa7e=_0xeafa7e||0x1f4;return function(_0x328aea){logger[_0xd83c('0x21')](_0x328aea[_0xd83c('0x22')]);if(_0x328aea[_0xd83c('0x23')]){delete _0x328aea['name'];}_0x35142f[_0xd83c('0x16')](_0xeafa7e)['send'](_0x328aea);};}exports['index']=function(_0x58029a,_0x392e05){var _0x5a842a={},_0x1a7f08={},_0x339ff9={'count':0x0,'rows':[]};var _0x539a6a=db[_0xd83c('0x24')][_0xd83c('0x25')];_0x1a7f08[_0xd83c('0x26')]=_['keys'](_0x539a6a);var _0x1e3f30={'dateStart':_0x58029a[_0xd83c('0x27')][_0xd83c('0x28')],'dateEnd':_0x58029a['query'][_0xd83c('0x29')]};delete _0x58029a[_0xd83c('0x27')][_0xd83c('0x28')];delete _0x58029a['query'][_0xd83c('0x29')];_0x1a7f08[_0xd83c('0x27')]=_[_0xd83c('0x2a')](_0x58029a[_0xd83c('0x27')]);_0x1a7f08[_0xd83c('0x2b')]=_[_0xd83c('0x2c')](_0x1a7f08[_0xd83c('0x26')],_0x1a7f08['query']);_0x5a842a[_0xd83c('0x2d')]=_[_0xd83c('0x2c')](_0x1a7f08[_0xd83c('0x26')],qs['fields'](_0x58029a[_0xd83c('0x27')]['fields']));_0x5a842a['attributes']=_0x5a842a[_0xd83c('0x2d')][_0xd83c('0x2e')]?_0x5a842a[_0xd83c('0x2d')]:_0x1a7f08[_0xd83c('0x26')];if(!_0x58029a[_0xd83c('0x27')][_0xd83c('0x2f')](_0xd83c('0x30'))){_0x5a842a[_0xd83c('0x31')]=qs[_0xd83c('0x31')](_0x58029a[_0xd83c('0x27')][_0xd83c('0x31')]);_0x5a842a['offset']=qs['offset'](_0x58029a['query'][_0xd83c('0x1a')]);}_0x5a842a['order']=qs[_0xd83c('0x32')](_0x58029a[_0xd83c('0x27')]['sort']);_0x5a842a[_0xd83c('0x33')]=qs[_0xd83c('0x2b')](_['pick'](_0x58029a['query'],_0x1a7f08[_0xd83c('0x2b')]));if(_0x1e3f30[_0xd83c('0x28')]){if(_0x1e3f30['dateEnd']){_0x1e3f30['dateEnd']=moment(_0x1e3f30['dateEnd'])[_0xd83c('0x34')](0x1,_0xd83c('0x35'));}else{_0x1e3f30[_0xd83c('0x29')]=moment(_0x1e3f30[_0xd83c('0x28')])[_0xd83c('0x34')](0x1,_0xd83c('0x35'));}_[_0xd83c('0x36')](_0x5a842a['where'],{'createdAt':{'$gte':_0x1e3f30['dateStart'],'$lte':_0x1e3f30[_0xd83c('0x29')]}});}if(_0x58029a[_0xd83c('0x27')]['filter']){_0x5a842a['where']=_[_0xd83c('0x36')](_0x5a842a[_0xd83c('0x33')],{'$or':_[_0xd83c('0x37')](_0x5a842a[_0xd83c('0x2d')],function(_0x16ebff){var _0x19113e={};_0x19113e[_0x16ebff]={'$like':'%'+_0x58029a[_0xd83c('0x27')][_0xd83c('0x38')]+'%'};return _0x19113e;})});}_0x5a842a=_[_0xd83c('0x36')]({},_0x5a842a,_0x58029a['options']);var _0x2f0d88={'where':_0x5a842a[_0xd83c('0x33')]};return db[_0xd83c('0x24')]['count'](_0x2f0d88)[_0xd83c('0x1f')](function(_0x1a2537){_0x339ff9['count']=_0x1a2537;if(_0x58029a[_0xd83c('0x27')][_0xd83c('0x39')]){_0x5a842a[_0xd83c('0x3a')]=[{'all':!![]}];}return db['DeskField'][_0xd83c('0x3b')](_0x5a842a);})[_0xd83c('0x1f')](function(_0x1a58c9){_0x339ff9['rows']=_0x1a58c9;return _0x339ff9;})[_0xd83c('0x1f')](respondWithFilteredResult(_0x392e05,_0x5a842a))[_0xd83c('0x3c')](handleError(_0x392e05,null));};exports[_0xd83c('0x3d')]=function(_0x7cf5cc,_0xdd461c){var _0x327a5f={'raw':!![],'where':{'id':_0x7cf5cc[_0xd83c('0x3e')]['id']}},_0x11f8d1={};_0x11f8d1[_0xd83c('0x26')]=_[_0xd83c('0x2a')](db[_0xd83c('0x24')][_0xd83c('0x25')]);_0x11f8d1['query']=_[_0xd83c('0x2a')](_0x7cf5cc[_0xd83c('0x27')]);_0x11f8d1[_0xd83c('0x2b')]=_[_0xd83c('0x2c')](_0x11f8d1['model'],_0x11f8d1[_0xd83c('0x27')]);_0x327a5f[_0xd83c('0x2d')]=_[_0xd83c('0x2c')](_0x11f8d1[_0xd83c('0x26')],qs[_0xd83c('0x3f')](_0x7cf5cc[_0xd83c('0x27')][_0xd83c('0x3f')]));_0x327a5f['attributes']=_0x327a5f['attributes'][_0xd83c('0x2e')]?_0x327a5f[_0xd83c('0x2d')]:_0x11f8d1[_0xd83c('0x26')];if(_0x7cf5cc[_0xd83c('0x27')][_0xd83c('0x39')]){_0x327a5f[_0xd83c('0x3a')]=[{'all':!![]}];}_0x327a5f=_[_0xd83c('0x36')]({},_0x327a5f,_0x7cf5cc[_0xd83c('0x40')]);return db[_0xd83c('0x24')]['find'](_0x327a5f)[_0xd83c('0x1f')](handleEntityNotFound(_0xdd461c,null))[_0xd83c('0x1f')](respondWithResult(_0xdd461c,null))[_0xd83c('0x3c')](handleError(_0xdd461c,null));};exports[_0xd83c('0x41')]=function(_0x28d951,_0x4fd4c4){return db[_0xd83c('0x24')][_0xd83c('0x41')](_0x28d951[_0xd83c('0x42')],{})[_0xd83c('0x1f')](respondWithResult(_0x4fd4c4,0xc9))['catch'](handleError(_0x4fd4c4,null));};exports['update']=function(_0x2b3a0d,_0x5c57a0){if(_0x2b3a0d[_0xd83c('0x42')]['id']){delete _0x2b3a0d['body']['id'];}return db[_0xd83c('0x24')][_0xd83c('0x43')]({'where':{'id':_0x2b3a0d[_0xd83c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5c57a0,null))[_0xd83c('0x1f')](saveUpdates(_0x2b3a0d[_0xd83c('0x42')],null))['then'](respondWithResult(_0x5c57a0,null))[_0xd83c('0x3c')](handleError(_0x5c57a0,null));};exports[_0xd83c('0x20')]=function(_0x593686,_0x406316){return db[_0xd83c('0x24')][_0xd83c('0x43')]({'where':{'id':_0x593686['params']['id']}})[_0xd83c('0x1f')](handleEntityNotFound(_0x406316,null))[_0xd83c('0x1f')](removeEntity(_0x406316,null))['catch'](handleError(_0x406316,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d5ecfdf..5c605f5 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 _0x5178=['int_desk_fields','util','../../config/logger','api','moment','bluebird','exports','define'];(function(_0x3e39e6,_0x3488e6){var _0x2e737b=function(_0x3332c5){while(--_0x3332c5){_0x3e39e6['push'](_0x3e39e6['shift']());}};_0x2e737b(++_0x3488e6);}(_0x5178,0x171));var _0x8517=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5178[_0x618414];return _0x21c19a;};'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('./intDeskField.attributes');module[_0x8517('0x5')]=function(_0x221184,_0x4ccd73){return _0x221184[_0x8517('0x6')]('DeskField',attributes,{'tableName':_0x8517('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5178=['int_desk_fields','util','../../config/logger','api','moment','bluebird','exports','define'];(function(_0x218886,_0x48af8e){var _0x528b5b=function(_0x1328a2){while(--_0x1328a2){_0x218886['push'](_0x218886['shift']());}};_0x528b5b(++_0x48af8e);}(_0x5178,0x171));var _0x8517=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5178[_0x6c993a];return _0x27f547;};'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('./intDeskField.attributes');module[_0x8517('0x5')]=function(_0x221184,_0x4ccd73){return _0x221184[_0x8517('0x6')]('DeskField',attributes,{'tableName':_0x8517('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 2c7c39f..c0a396d 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 _0xec56=['http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xec56,0x1bd));var _0x6ec5=function(_0x1d27b9,_0x4b16fc){_0x1d27b9=_0x1d27b9-0x0;var _0x28dc2b=_0xec56[_0x1d27b9];return _0x28dc2b;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ec5('0x1'));var rs=require(_0x6ec5('0x2'));var fs=require('fs');var Redis=require(_0x6ec5('0x3'));var db=require(_0x6ec5('0x4'))['db'];var utils=require(_0x6ec5('0x5'));var logger=require(_0x6ec5('0x6'))(_0x6ec5('0x7'));var config=require(_0x6ec5('0x8'));var jayson=require(_0x6ec5('0x9'));var client=jayson[_0x6ec5('0xa')][_0x6ec5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb683,_0x35be4e,_0x1f59cd){return new BPromise(function(_0x3dd891,_0x225d2f){return client[_0x6ec5('0xc')](_0x3bb683,_0x1f59cd)[_0x6ec5('0xd')](function(_0x3ff17c){logger['info'](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));logger[_0x6ec5('0x10')](_0x6ec5('0x11'),_0x35be4e,_0x6ec5('0xf'),JSON[_0x6ec5('0x12')](_0x3ff17c));if(_0x3ff17c[_0x6ec5('0x13')]){if(_0x3ff17c['error'][_0x6ec5('0x14')]===0x1f4){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);return _0x225d2f(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}logger[_0x6ec5('0x13')]('DeskField,\x20%s,\x20%s',_0x35be4e,_0x3ff17c[_0x6ec5('0x13')]['message']);return _0x3dd891(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}else{logger[_0x6ec5('0x16')](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));_0x3dd891(_0x3ff17c['result'][_0x6ec5('0x15')]);}})[_0x6ec5('0x17')](function(_0x125ae6){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x125ae6);_0x225d2f(_0x125ae6);});});} \ No newline at end of file +var _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x46c4bb,_0x5deb94){var _0x25d570=function(_0x46542b){while(--_0x46542b){_0x46c4bb['push'](_0x46c4bb['shift']());}};_0x25d570(++_0x5deb94);}(_0x9f62,0x154));var _0x29f6=function(_0x18ae44,_0x5a9eca){_0x18ae44=_0x18ae44-0x0;var _0x3af028=_0x9f62[_0x18ae44];return _0x3af028;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('DeskField,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a732862..362c955 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 _0x921e=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration'];(function(_0x26a818,_0x40708a){var _0x5d8ca0=function(_0x3cc7ed){while(--_0x3cc7ed){_0x26a818['push'](_0x26a818['shift']());}};_0x5d8ca0(++_0x40708a);}(_0x921e,0x175));var _0xe921=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x921e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe921('0x0'));var util=require('util');var path=require(_0xe921('0x1'));var timeout=require(_0xe921('0x2'));var express=require(_0xe921('0x3'));var router=express[_0xe921('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe921('0x5'));var config=require(_0xe921('0x6'));var controller=require(_0xe921('0x7'));router[_0xe921('0x8')]('/',auth[_0xe921('0x9')](),controller[_0xe921('0xa')]);router[_0xe921('0x8')](_0xe921('0xb'),auth[_0xe921('0x9')](),controller[_0xe921('0xc')]);router['get'](_0xe921('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xe921('0x8')](_0xe921('0xe'),auth[_0xe921('0x9')](),controller['getFields']);router[_0xe921('0xf')]('/',auth[_0xe921('0x9')](),controller[_0xe921('0x10')]);router['post'](_0xe921('0xd'),auth['isAuthenticated'](),controller[_0xe921('0x11')]);router[_0xe921('0x12')](_0xe921('0xb'),auth['isAuthenticated'](),controller[_0xe921('0x13')]);router[_0xe921('0x14')]('/:id',auth[_0xe921('0x9')](),controller[_0xe921('0x15')]);module[_0xe921('0x16')]=router; \ No newline at end of file +var _0x5c92=['delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id/configurations','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x4a32b5,_0x29ad5e){var _0x184477=function(_0x4d9e33){while(--_0x4d9e33){_0x4a32b5['push'](_0x4a32b5['shift']());}};_0x184477(++_0x29ad5e);}(_0x5c92,0xb6));var _0x25c9=function(_0x2af912,_0x363496){_0x2af912=_0x2af912-0x0;var _0x1e97fb=_0x5c92[_0x2af912];return _0x1e97fb;};'use strict';var multer=require(_0x25c9('0x0'));var util=require('util');var path=require(_0x25c9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x25c9('0x2')]();var auth=require(_0x25c9('0x3'));var interaction=require(_0x25c9('0x4'));var config=require(_0x25c9('0x5'));var controller=require(_0x25c9('0x6'));router['get']('/',auth[_0x25c9('0x7')](),controller[_0x25c9('0x8')]);router[_0x25c9('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x25c9('0x9')](_0x25c9('0xa'),auth[_0x25c9('0x7')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x25c9('0x7')](),controller[_0x25c9('0xb')]);router[_0x25c9('0xc')]('/',auth[_0x25c9('0x7')](),controller[_0x25c9('0xd')]);router[_0x25c9('0xc')](_0x25c9('0xa'),auth['isAuthenticated'](),controller[_0x25c9('0xe')]);router[_0x25c9('0xf')](_0x25c9('0x10'),auth[_0x25c9('0x7')](),controller[_0x25c9('0x11')]);router[_0x25c9('0x12')](_0x25c9('0x10'),auth[_0x25c9('0x7')](),controller[_0x25c9('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d7198fa..3737b8e 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 _0x1c3b=['remoteUri','sequelize','exports','STRING','username'];(function(_0x848cf6,_0x14e807){var _0x3e389b=function(_0x332fd4){while(--_0x332fd4){_0x848cf6['push'](_0x848cf6['shift']());}};_0x3e389b(++_0x14e807);}(_0x1c3b,0xab));var _0xb1c3=function(_0x144be6,_0xedf6f9){_0x144be6=_0x144be6-0x0;var _0x3722c6=_0x1c3b[_0x144be6];return _0x3722c6;};'use strict';var Sequelize=require(_0xb1c3('0x0'));module[_0xb1c3('0x1')]={'name':{'type':Sequelize[_0xb1c3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xb1c3('0x3')},'apiKey':{'type':Sequelize[_0xb1c3('0x2')]},'remoteUri':{'type':Sequelize[_0xb1c3('0x2')],'unique':_0xb1c3('0x4')},'serverUrl':{'type':Sequelize[_0xb1c3('0x2')]}}; \ No newline at end of file +var _0xc651=['remoteUri','sequelize','exports','STRING','username'];(function(_0xbecd3d,_0x127cf3){var _0x3882fa=function(_0x221d46){while(--_0x221d46){_0xbecd3d['push'](_0xbecd3d['shift']());}};_0x3882fa(++_0x127cf3);}(_0xc651,0x10a));var _0x1c65=function(_0x4e6466,_0x3ba16e){_0x4e6466=_0x4e6466-0x0;var _0x95181=_0xc651[_0x4e6466];return _0x95181;};'use strict';var Sequelize=require(_0x1c65('0x0'));module[_0x1c65('0x1')]={'name':{'type':Sequelize[_0x1c65('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x1c65('0x3')},'apiKey':{'type':Sequelize[_0x1c65('0x2')]},'remoteUri':{'type':Sequelize[_0x1c65('0x2')],'unique':_0x1c65('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 584cb6f..d329121 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 _0x8512=['default','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','end','name','index','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','day','merge','filter','map','options','include','FreshdeskAccount','findAll','rows','show','params','includeAll','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','AccountId','getSubjects','channel','type','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64','description','priority','source','group','company','includes'];(function(_0x212f21,_0x27fae3){var _0x7c3995=function(_0x21af6e){while(--_0x21af6e){_0x212f21['push'](_0x212f21['shift']());}};_0x7c3995(++_0x27fae3);}(_0x8512,0x16c));var _0x2851=function(_0x174cda,_0x37c6a7){_0x174cda=_0x174cda-0x0;var _0xa7bfa9=_0x8512[_0x174cda];return _0xa7bfa9;};'use strict';var pdf=require(_0x2851('0x0'));var emlformat=require(_0x2851('0x1'));var rimraf=require(_0x2851('0x2'));var zipdir=require(_0x2851('0x3'));var jsonpatch=require(_0x2851('0x4'));var rp=require(_0x2851('0x5'));var moment=require(_0x2851('0x6'));var BPromise=require(_0x2851('0x7'));var Mustache=require(_0x2851('0x8'));var util=require(_0x2851('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x2851('0xa'));var ejs=require(_0x2851('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2851('0xc'));var crypto=require(_0x2851('0xd'));var jsforce=require(_0x2851('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2851('0xa'));var querystring=require(_0x2851('0xf'));var Papa=require(_0x2851('0x10'));var Redis=require(_0x2851('0x11'));var qs=require(_0x2851('0x12'));var logger=require(_0x2851('0x13'))(_0x2851('0x14'));var utils=require('../../config/utils');var config=require(_0x2851('0x15'));var db=require(_0x2851('0x16'))['db'];var integrations=require(_0x2851('0x17'));var jayson=require(_0x2851('0x18'));var client=jayson[_0x2851('0x19')][_0x2851('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2a93ad,_0x105d51,_0x1f452b,_0x371a75){return new BPromise(function(_0x2f9c2a,_0x8d4a65){var _0x4e1ae0=_0x371a75||client;return _0x4e1ae0[_0x2851('0x1b')](_0x2a93ad,_0x1f452b)[_0x2851('0x1c')](function(_0x2ba535){logger[_0x2851('0x1d')](_0x2851('0x1e'),_0x105d51,_0x2851('0x1f'));logger[_0x2851('0x20')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x105d51,'request\x20sent',JSON['stringify'](_0x2ba535));if(_0x2ba535[_0x2851('0x21')]){if(_0x2ba535[_0x2851('0x21')][_0x2851('0x22')]===0x1f4){logger[_0x2851('0x21')](_0x2851('0x1e'),_0x105d51,_0x2ba535[_0x2851('0x21')][_0x2851('0x23')]);return _0x8d4a65(_0x2ba535[_0x2851('0x21')][_0x2851('0x23')]);}logger[_0x2851('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x105d51,_0x2ba535[_0x2851('0x21')][_0x2851('0x23')]);return _0x2f9c2a(_0x2ba535[_0x2851('0x21')][_0x2851('0x23')]);}else{logger[_0x2851('0x1d')](_0x2851('0x1e'),_0x105d51,_0x2851('0x1f'));_0x2f9c2a(_0x2ba535[_0x2851('0x24')][_0x2851('0x23')]);}})[_0x2851('0x25')](function(_0x3b52fa){logger[_0x2851('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x105d51,_0x3b52fa);_0x8d4a65(_0x3b52fa);});});}function respondWithStatusCode(_0x2c95ac,_0x517310){_0x517310=_0x517310||0xcc;return function(_0x468344){if(_0x468344){return _0x2c95ac[_0x2851('0x26')](_0x517310);}return _0x2c95ac['status'](_0x517310)['end']();};}function respondWithResult(_0x4ee8a6,_0x1a6452){_0x1a6452=_0x1a6452||0xc8;return function(_0xf530ee){if(_0xf530ee){return _0x4ee8a6[_0x2851('0x27')](_0x1a6452)[_0x2851('0x28')](_0xf530ee);}};}function respondWithFilteredResult(_0x61328c,_0x1d4d1c){return function(_0x23e69f){if(_0x23e69f){var _0x144d72=_0x23e69f[_0x2851('0x29')],_0x38d218=_0x1d4d1c[_0x2851('0x2a')],_0x3d676e=_0x1d4d1c[_0x2851('0x2a')]+_0x1d4d1c[_0x2851('0x2b')],_0x3c87ca;if(_0x3d676e>=_0x144d72){_0x3d676e=_0x144d72;_0x3c87ca=0xc8;}else{_0x3c87ca=0xce;}_0x61328c[_0x2851('0x27')](_0x3c87ca);return _0x61328c[_0x2851('0x2c')](_0x2851('0x2d'),_0x38d218+'-'+_0x3d676e+'/'+_0x144d72)[_0x2851('0x28')](_0x23e69f);}return null;};}function patchUpdates(_0x3417ff){return function(_0x33b0ad){try{jsonpatch[_0x2851('0x2e')](_0x33b0ad,_0x3417ff,!![]);}catch(_0x50b4ad){return BPromise['reject'](_0x50b4ad);}return _0x33b0ad['save']();};}function saveUpdates(_0x10b7b6,_0x35f99b){return function(_0x5cdf8f){if(_0x5cdf8f){return _0x5cdf8f['update'](_0x10b7b6)[_0x2851('0x1c')](function(_0xa171e7){return _0xa171e7;});}return null;};}function removeEntity(_0x1a9039,_0x308963){return function(_0x2c23d2){if(_0x2c23d2){return _0x2c23d2['destroy']()[_0x2851('0x1c')](function(){_0x1a9039['status'](0xcc)[_0x2851('0x2f')]();});}};}function handleEntityNotFound(_0xa0f02,_0x209ff1){return function(_0x55a826){if(!_0x55a826){_0xa0f02[_0x2851('0x26')](0x194);}return _0x55a826;};}function handleError(_0xed458d,_0x222be1){_0x222be1=_0x222be1||0x1f4;return function(_0x51515e){logger[_0x2851('0x21')](_0x51515e['stack']);if(_0x51515e[_0x2851('0x30')]){delete _0x51515e[_0x2851('0x30')];}_0xed458d[_0x2851('0x27')](_0x222be1)['send'](_0x51515e);};}exports[_0x2851('0x31')]=function(_0x4f07e3,_0x1a10bd){var _0x3dc185={},_0x5863b6={},_0x4e2f89={'count':0x0,'rows':[]};var _0x16cff1=db['FreshdeskAccount'][_0x2851('0x32')];_0x5863b6[_0x2851('0x33')]=_[_0x2851('0x34')](_0x16cff1);var _0x14677e={'dateStart':_0x4f07e3['query'][_0x2851('0x35')],'dateEnd':_0x4f07e3['query'][_0x2851('0x36')]};delete _0x4f07e3[_0x2851('0x37')][_0x2851('0x35')];delete _0x4f07e3[_0x2851('0x37')][_0x2851('0x36')];_0x5863b6[_0x2851('0x37')]=_[_0x2851('0x34')](_0x4f07e3['query']);_0x5863b6[_0x2851('0x38')]=_[_0x2851('0x39')](_0x5863b6[_0x2851('0x33')],_0x5863b6['query']);_0x3dc185[_0x2851('0x3a')]=_['intersection'](_0x5863b6['model'],qs['fields'](_0x4f07e3[_0x2851('0x37')][_0x2851('0x3b')]));_0x3dc185[_0x2851('0x3a')]=_0x3dc185[_0x2851('0x3a')][_0x2851('0x3c')]?_0x3dc185[_0x2851('0x3a')]:_0x5863b6[_0x2851('0x33')];if(!_0x4f07e3[_0x2851('0x37')]['hasOwnProperty'](_0x2851('0x3d'))){_0x3dc185['limit']=qs['limit'](_0x4f07e3[_0x2851('0x37')][_0x2851('0x2b')]);_0x3dc185[_0x2851('0x2a')]=qs[_0x2851('0x2a')](_0x4f07e3[_0x2851('0x37')][_0x2851('0x2a')]);}_0x3dc185[_0x2851('0x3e')]=qs[_0x2851('0x3f')](_0x4f07e3['query'][_0x2851('0x3f')]);_0x3dc185[_0x2851('0x40')]=qs[_0x2851('0x38')](_[_0x2851('0x41')](_0x4f07e3[_0x2851('0x37')],_0x5863b6['filters']));if(_0x14677e[_0x2851('0x35')]){if(_0x14677e[_0x2851('0x36')]){_0x14677e[_0x2851('0x36')]=moment(_0x14677e['dateEnd'])['add'](0x1,'day');}else{_0x14677e['dateEnd']=moment(_0x14677e[_0x2851('0x35')])['add'](0x1,_0x2851('0x42'));}_[_0x2851('0x43')](_0x3dc185[_0x2851('0x40')],{'createdAt':{'$gte':_0x14677e[_0x2851('0x35')],'$lte':_0x14677e[_0x2851('0x36')]}});}if(_0x4f07e3[_0x2851('0x37')][_0x2851('0x44')]){_0x3dc185[_0x2851('0x40')]=_[_0x2851('0x43')](_0x3dc185[_0x2851('0x40')],{'$or':_[_0x2851('0x45')](_0x3dc185[_0x2851('0x3a')],function(_0x1bb9e8){var _0x11dee9={};_0x11dee9[_0x1bb9e8]={'$like':'%'+_0x4f07e3['query']['filter']+'%'};return _0x11dee9;})});}_0x3dc185=_['merge']({},_0x3dc185,_0x4f07e3[_0x2851('0x46')]);var _0x154203={'where':_0x3dc185[_0x2851('0x40')]};return db['FreshdeskAccount'][_0x2851('0x29')](_0x154203)['then'](function(_0x5b1e17){_0x4e2f89['count']=_0x5b1e17;if(_0x4f07e3[_0x2851('0x37')]['includeAll']){_0x3dc185[_0x2851('0x47')]=[{'all':!![]}];}return db[_0x2851('0x48')][_0x2851('0x49')](_0x3dc185);})['then'](function(_0x299903){_0x4e2f89[_0x2851('0x4a')]=_0x299903;return _0x4e2f89;})[_0x2851('0x1c')](respondWithFilteredResult(_0x1a10bd,_0x3dc185))['catch'](handleError(_0x1a10bd,null));};exports[_0x2851('0x4b')]=function(_0x3d229a,_0x675df1){var _0xcad432={'raw':![],'where':{'id':_0x3d229a[_0x2851('0x4c')]['id']}},_0x20e773={};_0x20e773[_0x2851('0x33')]=_['keys'](db[_0x2851('0x48')][_0x2851('0x32')]);_0x20e773[_0x2851('0x37')]=_[_0x2851('0x34')](_0x3d229a['query']);_0x20e773[_0x2851('0x38')]=_['intersection'](_0x20e773[_0x2851('0x33')],_0x20e773[_0x2851('0x37')]);_0xcad432[_0x2851('0x3a')]=_['intersection'](_0x20e773[_0x2851('0x33')],qs[_0x2851('0x3b')](_0x3d229a['query'][_0x2851('0x3b')]));_0xcad432['attributes']=_0xcad432[_0x2851('0x3a')]['length']?_0xcad432[_0x2851('0x3a')]:_0x20e773[_0x2851('0x33')];if(_0x3d229a[_0x2851('0x37')][_0x2851('0x4d')]){_0xcad432[_0x2851('0x47')]=[{'all':!![]}];}_0xcad432=_['merge']({},_0xcad432,_0x3d229a[_0x2851('0x46')]);return db[_0x2851('0x48')][_0x2851('0x4e')](_0xcad432)[_0x2851('0x1c')](handleEntityNotFound(_0x675df1,null))[_0x2851('0x1c')](respondWithResult(_0x675df1,null))[_0x2851('0x25')](handleError(_0x675df1,null));};exports[_0x2851('0x4f')]=function(_0x2b556e,_0x1825f6){return db[_0x2851('0x48')]['create'](_0x2b556e[_0x2851('0x50')],{})[_0x2851('0x1c')](respondWithResult(_0x1825f6,0xc9))[_0x2851('0x25')](handleError(_0x1825f6,null));};exports[_0x2851('0x51')]=function(_0x15a26b,_0x4a6aa7){if(_0x15a26b[_0x2851('0x50')]['id']){delete _0x15a26b['body']['id'];}return db[_0x2851('0x48')][_0x2851('0x4e')]({'where':{'id':_0x15a26b[_0x2851('0x4c')]['id']}})[_0x2851('0x1c')](handleEntityNotFound(_0x4a6aa7,null))[_0x2851('0x1c')](saveUpdates(_0x15a26b[_0x2851('0x50')],null))['then'](respondWithResult(_0x4a6aa7,null))[_0x2851('0x25')](handleError(_0x4a6aa7,null));};exports['destroy']=function(_0x1933e5,_0x2a0e55){return db[_0x2851('0x48')]['find']({'where':{'id':_0x1933e5['params']['id']}})[_0x2851('0x1c')](handleEntityNotFound(_0x2a0e55,null))[_0x2851('0x1c')](removeEntity(_0x2a0e55,null))['catch'](handleError(_0x2a0e55,null));};exports[_0x2851('0x52')]=function(_0x28cda4,_0x5ae338,_0x27863f){var _0x186b83={};var _0x30187e={};var _0x5b7009;var _0x275afd;return db[_0x2851('0x48')][_0x2851('0x53')]({'where':{'id':_0x28cda4[_0x2851('0x4c')]['id']}})[_0x2851('0x1c')](handleEntityNotFound(_0x5ae338,null))[_0x2851('0x1c')](function(_0x47a30f){if(_0x47a30f){_0x5b7009=_0x47a30f;_0x30187e['model']=_['keys'](db[_0x2851('0x54')][_0x2851('0x32')]);_0x30187e[_0x2851('0x37')]=_[_0x2851('0x34')](_0x28cda4[_0x2851('0x37')]);_0x30187e[_0x2851('0x38')]=_['intersection'](_0x30187e[_0x2851('0x33')],_0x30187e[_0x2851('0x37')]);_0x186b83[_0x2851('0x3a')]=_[_0x2851('0x39')](_0x30187e[_0x2851('0x33')],qs['fields'](_0x28cda4['query']['fields']));_0x186b83[_0x2851('0x3a')]=_0x186b83[_0x2851('0x3a')][_0x2851('0x3c')]?_0x186b83[_0x2851('0x3a')]:_0x30187e[_0x2851('0x33')];_0x186b83['order']=qs[_0x2851('0x3f')](_0x28cda4['query'][_0x2851('0x3f')]);_0x186b83[_0x2851('0x40')]=qs[_0x2851('0x38')](_[_0x2851('0x41')](_0x28cda4['query'],_0x30187e[_0x2851('0x38')]));if(_0x28cda4[_0x2851('0x37')]['filter']){_0x186b83[_0x2851('0x40')]=_[_0x2851('0x43')](_0x186b83[_0x2851('0x40')],{'$or':_['map'](_0x186b83[_0x2851('0x3a')],function(_0x130e97){var _0x424535={};_0x424535[_0x130e97]={'$like':'%'+_0x28cda4[_0x2851('0x37')][_0x2851('0x44')]+'%'};return _0x424535;})});}_0x186b83=_['merge']({},_0x186b83,_0x28cda4[_0x2851('0x46')]);return _0x5b7009['getConfigurations'](_0x186b83);}})['then'](function(_0x154eb8){if(_0x154eb8){_0x275afd=_0x154eb8[_0x2851('0x3c')];if(!_0x28cda4[_0x2851('0x37')][_0x2851('0x55')](_0x2851('0x3d'))){_0x186b83[_0x2851('0x2b')]=qs[_0x2851('0x2b')](_0x28cda4[_0x2851('0x37')]['limit']);_0x186b83[_0x2851('0x2a')]=qs[_0x2851('0x2a')](_0x28cda4[_0x2851('0x37')]['offset']);}return _0x5b7009[_0x2851('0x52')](_0x186b83);}})[_0x2851('0x1c')](function(_0x5b28c9){if(_0x5b28c9){return _0x5b28c9?{'count':_0x275afd,'rows':_0x5b28c9}:null;}})[_0x2851('0x1c')](respondWithResult(_0x5ae338,null))['catch'](handleError(_0x5ae338,null));};exports['addConfiguration']=function(_0xe0d84f,_0xe357eb,_0x4816e4){if(_0xe0d84f[_0x2851('0x50')]['id']){delete _0xe0d84f[_0x2851('0x50')]['id'];}return db['FreshdeskAccount'][_0x2851('0x53')]({'where':{'id':_0xe0d84f[_0x2851('0x4c')]['id']}})['then'](handleEntityNotFound(_0xe357eb,null))['then'](function(_0x251299){if(_0x251299){_0xe0d84f[_0x2851('0x50')][_0x2851('0x56')]=_0x251299['id'];_0xe0d84f[_0x2851('0x50')]['Subjects']=integrations[_0x2851('0x57')](_0xe0d84f[_0x2851('0x50')][_0x2851('0x58')],_0xe0d84f[_0x2851('0x50')][_0x2851('0x59')]);_0xe0d84f['body']['Descriptions']=integrations[_0x2851('0x5a')](_0xe0d84f[_0x2851('0x50')]['channel'],_0xe0d84f[_0x2851('0x50')][_0x2851('0x59')]);return db[_0x2851('0x54')][_0x2851('0x4f')](_0xe0d84f[_0x2851('0x50')],{'include':[{'model':db[_0x2851('0x5b')],'as':'Subjects'},{'model':db[_0x2851('0x5b')],'as':_0x2851('0x5c')}]});}return null;})[_0x2851('0x1c')](respondWithResult(_0xe357eb,null))[_0x2851('0x25')](handleError(_0xe357eb,null));};exports[_0x2851('0x5d')]=function(_0x5d5897,_0x1b7bf4,_0x5c9078){return db[_0x2851('0x48')][_0x2851('0x53')]({'where':{'id':_0x5d5897[_0x2851('0x4c')]['id']},'attributes':['id',_0x2851('0x5e'),_0x2851('0x5f')]})[_0x2851('0x1c')](handleEntityNotFound(_0x1b7bf4,null))[_0x2851('0x1c')](function(_0x5f11e4){if(_0x5f11e4){return rp({'method':'GET','uri':util['format']('%s%s',_0x5f11e4[_0x2851('0x5e')],_0x2851('0x60')),'headers':{'Authorization':util[_0x2851('0x61')](_0x2851('0x62'),new Buffer(util['format'](_0x2851('0x63'),_0x5f11e4[_0x2851('0x5f')]))[_0x2851('0x64')](_0x2851('0x65')))},'json':!![]});}})[_0x2851('0x1c')](function(_0x144ffa){if(_0x144ffa){var _0x9f32f6=['requester','subject','agent',_0x2851('0x66'),_0x2851('0x27'),_0x2851('0x67'),'group',_0x2851('0x68'),'ticket_type',_0x2851('0x69'),_0x2851('0x6a')];_['remove'](_0x144ffa,function(_0x31ca19){return _0x9f32f6[_0x2851('0x6b')](_0x31ca19[_0x2851('0x30')])||!_0x31ca19[_0x2851('0x6c')]&&_0x31ca19[_0x2851('0x59')]!=='custom_text';});return{'count':_0x144ffa[_0x2851('0x3c')],'rows':_['map'](_0x144ffa,function(_0x5b6404){return{'id':_0x5b6404[_0x2851('0x30')],'name':_0x5b6404[_0x2851('0x6d')],'custom':!_0x5b6404[_0x2851('0x6c')],'options':_0x5b6404[_0x2851('0x6e')]?_['map'](_0x5b6404[_0x2851('0x6e')],function(_0x2d0a25){return{'name':_[_0x2851('0x6f')](_0x2d0a25),'value':_0x2d0a25};}):[]};})};}})[_0x2851('0x1c')](respondWithResult(_0x1b7bf4,null))[_0x2851('0x25')](function(_0x37df01){var _0x208a5b=_0x5d5897[_0x2851('0x37')][_0x2851('0x70')]?0x1f4:_0x37df01['statusCode']||0x1f4;logger['error'](_0x2851('0x71'),_0x2851('0x5d'),_0x208a5b,JSON[_0x2851('0x72')](_0x37df01));delete _0x37df01[_0x2851('0x30')];if(_0x208a5b===0x191){_0x208a5b=0x190;}_0x1b7bf4[_0x2851('0x27')](_0x208a5b)[_0x2851('0x73')](_0x5d5897[_0x2851('0x37')][_0x2851('0x70')]?{'message':_0x2851('0x74'),'statusCode':_0x37df01[_0x2851('0x75')]}:_0x37df01);});}; \ No newline at end of file +var _0xff05=['papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','end','stack','name','send','index','FreshdeskAccount','model','dateEnd','query','dateStart','keys','intersection','attributes','fields','nolimit','sort','where','filters','add','day','merge','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','update','destroy','params','getConfigurations','findOne','pick','hasOwnProperty','AccountId','Subjects','getSubjects','type','channel','FreshdeskConfiguration','FreshdeskField','Descriptions','apiKey','GET','format','%s%s','remoteUri','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','map','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff05,0x165));var _0x5ff0=function(_0xb1c29b,_0x43daf4){_0xb1c29b=_0xb1c29b-0x0;var _0xe9fc80=_0xff05[_0xb1c29b];return _0xe9fc80;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5ff0('0x0'));var rp=require(_0x5ff0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5ff0('0x2'));var util=require(_0x5ff0('0x3'));var path=require(_0x5ff0('0x4'));var sox=require(_0x5ff0('0x5'));var csv=require(_0x5ff0('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ff0('0x7'));var squel=require('squel');var crypto=require(_0x5ff0('0x8'));var jsforce=require(_0x5ff0('0x9'));var deskjs=require(_0x5ff0('0xa'));var toCsv=require(_0x5ff0('0x6'));var querystring=require(_0x5ff0('0xb'));var Papa=require(_0x5ff0('0xc'));var Redis=require('ioredis');var qs=require(_0x5ff0('0xd'));var logger=require('../../config/logger')(_0x5ff0('0xe'));var utils=require(_0x5ff0('0xf'));var config=require('../../config/environment');var db=require(_0x5ff0('0x10'))['db'];var integrations=require(_0x5ff0('0x11'));var jayson=require(_0x5ff0('0x12'));var client=jayson[_0x5ff0('0x13')][_0x5ff0('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x1dd5d6,_0xdfcde8,_0x54032a,_0x3570f2){return new BPromise(function(_0x8a77f9,_0x4c0dba){var _0x556411=_0x3570f2||client;return _0x556411[_0x5ff0('0x15')](_0x1dd5d6,_0x54032a)[_0x5ff0('0x16')](function(_0x16bc7){logger[_0x5ff0('0x17')](_0x5ff0('0x18'),_0xdfcde8,_0x5ff0('0x19'));logger[_0x5ff0('0x1a')](_0x5ff0('0x1b'),_0xdfcde8,_0x5ff0('0x19'),JSON['stringify'](_0x16bc7));if(_0x16bc7[_0x5ff0('0x1c')]){if(_0x16bc7[_0x5ff0('0x1c')][_0x5ff0('0x1d')]===0x1f4){logger[_0x5ff0('0x1c')](_0x5ff0('0x18'),_0xdfcde8,_0x16bc7['error'][_0x5ff0('0x1e')]);return _0x4c0dba(_0x16bc7[_0x5ff0('0x1c')][_0x5ff0('0x1e')]);}logger[_0x5ff0('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0xdfcde8,_0x16bc7[_0x5ff0('0x1c')][_0x5ff0('0x1e')]);return _0x8a77f9(_0x16bc7['error'][_0x5ff0('0x1e')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xdfcde8,_0x5ff0('0x19'));_0x8a77f9(_0x16bc7[_0x5ff0('0x1f')]['message']);}})['catch'](function(_0x564e10){logger[_0x5ff0('0x1c')](_0x5ff0('0x18'),_0xdfcde8,_0x564e10);_0x4c0dba(_0x564e10);});});}function respondWithStatusCode(_0x584993,_0x525fd1){_0x525fd1=_0x525fd1||0xcc;return function(_0x3482a1){if(_0x3482a1){return _0x584993[_0x5ff0('0x20')](_0x525fd1);}return _0x584993[_0x5ff0('0x21')](_0x525fd1)['end']();};}function respondWithResult(_0x1d335f,_0x8efbbe){_0x8efbbe=_0x8efbbe||0xc8;return function(_0x24b7ab){if(_0x24b7ab){return _0x1d335f['status'](_0x8efbbe)[_0x5ff0('0x22')](_0x24b7ab);}};}function respondWithFilteredResult(_0x3239c8,_0x3e21c5){return function(_0x38a1b5){if(_0x38a1b5){var _0x33e386=_0x38a1b5[_0x5ff0('0x23')],_0x35e010=_0x3e21c5[_0x5ff0('0x24')],_0x5b4d80=_0x3e21c5[_0x5ff0('0x24')]+_0x3e21c5[_0x5ff0('0x25')],_0x1d51e4;if(_0x5b4d80>=_0x33e386){_0x5b4d80=_0x33e386;_0x1d51e4=0xc8;}else{_0x1d51e4=0xce;}_0x3239c8[_0x5ff0('0x21')](_0x1d51e4);return _0x3239c8[_0x5ff0('0x26')](_0x5ff0('0x27'),_0x35e010+'-'+_0x5b4d80+'/'+_0x33e386)[_0x5ff0('0x22')](_0x38a1b5);}return null;};}function patchUpdates(_0x4938aa){return function(_0x58ab33){try{jsonpatch[_0x5ff0('0x28')](_0x58ab33,_0x4938aa,!![]);}catch(_0x4269c8){return BPromise[_0x5ff0('0x29')](_0x4269c8);}return _0x58ab33['save']();};}function saveUpdates(_0x2722c2,_0x4ed735){return function(_0x1fbc42){if(_0x1fbc42){return _0x1fbc42['update'](_0x2722c2)[_0x5ff0('0x16')](function(_0x168b5a){return _0x168b5a;});}return null;};}function removeEntity(_0x5f113c,_0x103927){return function(_0x355696){if(_0x355696){return _0x355696['destroy']()[_0x5ff0('0x16')](function(){_0x5f113c['status'](0xcc)[_0x5ff0('0x2a')]();});}};}function handleEntityNotFound(_0x496d47,_0x1db002){return function(_0x290b39){if(!_0x290b39){_0x496d47[_0x5ff0('0x20')](0x194);}return _0x290b39;};}function handleError(_0x552e22,_0x439001){_0x439001=_0x439001||0x1f4;return function(_0x15d19d){logger['error'](_0x15d19d[_0x5ff0('0x2b')]);if(_0x15d19d[_0x5ff0('0x2c')]){delete _0x15d19d[_0x5ff0('0x2c')];}_0x552e22[_0x5ff0('0x21')](_0x439001)[_0x5ff0('0x2d')](_0x15d19d);};}exports[_0x5ff0('0x2e')]=function(_0x3285fb,_0x39d00b){var _0x44093f={},_0x4763a0={},_0x299405={'count':0x0,'rows':[]};var _0x18f517=db[_0x5ff0('0x2f')]['rawAttributes'];_0x4763a0[_0x5ff0('0x30')]=_['keys'](_0x18f517);var _0x80635b={'dateStart':_0x3285fb['query']['dateStart'],'dateEnd':_0x3285fb['query'][_0x5ff0('0x31')]};delete _0x3285fb[_0x5ff0('0x32')][_0x5ff0('0x33')];delete _0x3285fb[_0x5ff0('0x32')]['dateEnd'];_0x4763a0[_0x5ff0('0x32')]=_[_0x5ff0('0x34')](_0x3285fb[_0x5ff0('0x32')]);_0x4763a0['filters']=_[_0x5ff0('0x35')](_0x4763a0[_0x5ff0('0x30')],_0x4763a0[_0x5ff0('0x32')]);_0x44093f[_0x5ff0('0x36')]=_[_0x5ff0('0x35')](_0x4763a0[_0x5ff0('0x30')],qs[_0x5ff0('0x37')](_0x3285fb[_0x5ff0('0x32')][_0x5ff0('0x37')]));_0x44093f[_0x5ff0('0x36')]=_0x44093f[_0x5ff0('0x36')]['length']?_0x44093f['attributes']:_0x4763a0[_0x5ff0('0x30')];if(!_0x3285fb[_0x5ff0('0x32')]['hasOwnProperty'](_0x5ff0('0x38'))){_0x44093f[_0x5ff0('0x25')]=qs[_0x5ff0('0x25')](_0x3285fb[_0x5ff0('0x32')][_0x5ff0('0x25')]);_0x44093f['offset']=qs['offset'](_0x3285fb[_0x5ff0('0x32')]['offset']);}_0x44093f['order']=qs[_0x5ff0('0x39')](_0x3285fb[_0x5ff0('0x32')][_0x5ff0('0x39')]);_0x44093f[_0x5ff0('0x3a')]=qs[_0x5ff0('0x3b')](_['pick'](_0x3285fb[_0x5ff0('0x32')],_0x4763a0[_0x5ff0('0x3b')]));if(_0x80635b[_0x5ff0('0x33')]){if(_0x80635b[_0x5ff0('0x31')]){_0x80635b[_0x5ff0('0x31')]=moment(_0x80635b[_0x5ff0('0x31')])[_0x5ff0('0x3c')](0x1,_0x5ff0('0x3d'));}else{_0x80635b[_0x5ff0('0x31')]=moment(_0x80635b[_0x5ff0('0x33')])['add'](0x1,'day');}_[_0x5ff0('0x3e')](_0x44093f['where'],{'createdAt':{'$gte':_0x80635b['dateStart'],'$lte':_0x80635b['dateEnd']}});}if(_0x3285fb[_0x5ff0('0x32')][_0x5ff0('0x3f')]){_0x44093f[_0x5ff0('0x3a')]=_[_0x5ff0('0x3e')](_0x44093f['where'],{'$or':_['map'](_0x44093f['attributes'],function(_0x198f3a){var _0x5115ac={};_0x5115ac[_0x198f3a]={'$like':'%'+_0x3285fb['query'][_0x5ff0('0x3f')]+'%'};return _0x5115ac;})});}_0x44093f=_['merge']({},_0x44093f,_0x3285fb[_0x5ff0('0x40')]);var _0x97802d={'where':_0x44093f['where']};return db['FreshdeskAccount']['count'](_0x97802d)['then'](function(_0xca9dbf){_0x299405[_0x5ff0('0x23')]=_0xca9dbf;if(_0x3285fb[_0x5ff0('0x32')][_0x5ff0('0x41')]){_0x44093f[_0x5ff0('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x5ff0('0x43')](_0x44093f);})[_0x5ff0('0x16')](function(_0x1fce4a){_0x299405[_0x5ff0('0x44')]=_0x1fce4a;return _0x299405;})[_0x5ff0('0x16')](respondWithFilteredResult(_0x39d00b,_0x44093f))[_0x5ff0('0x45')](handleError(_0x39d00b,null));};exports[_0x5ff0('0x46')]=function(_0x1d9b04,_0x11c239){var _0x3428f3={'raw':![],'where':{'id':_0x1d9b04['params']['id']}},_0x1305a3={};_0x1305a3[_0x5ff0('0x30')]=_[_0x5ff0('0x34')](db[_0x5ff0('0x2f')][_0x5ff0('0x47')]);_0x1305a3[_0x5ff0('0x32')]=_[_0x5ff0('0x34')](_0x1d9b04[_0x5ff0('0x32')]);_0x1305a3[_0x5ff0('0x3b')]=_[_0x5ff0('0x35')](_0x1305a3[_0x5ff0('0x30')],_0x1305a3[_0x5ff0('0x32')]);_0x3428f3['attributes']=_[_0x5ff0('0x35')](_0x1305a3[_0x5ff0('0x30')],qs[_0x5ff0('0x37')](_0x1d9b04['query'][_0x5ff0('0x37')]));_0x3428f3[_0x5ff0('0x36')]=_0x3428f3[_0x5ff0('0x36')][_0x5ff0('0x48')]?_0x3428f3['attributes']:_0x1305a3[_0x5ff0('0x30')];if(_0x1d9b04[_0x5ff0('0x32')][_0x5ff0('0x41')]){_0x3428f3[_0x5ff0('0x42')]=[{'all':!![]}];}_0x3428f3=_[_0x5ff0('0x3e')]({},_0x3428f3,_0x1d9b04[_0x5ff0('0x40')]);return db[_0x5ff0('0x2f')][_0x5ff0('0x49')](_0x3428f3)[_0x5ff0('0x16')](handleEntityNotFound(_0x11c239,null))['then'](respondWithResult(_0x11c239,null))[_0x5ff0('0x45')](handleError(_0x11c239,null));};exports[_0x5ff0('0x4a')]=function(_0x32a64,_0x58f6bc){return db[_0x5ff0('0x2f')][_0x5ff0('0x4a')](_0x32a64[_0x5ff0('0x4b')],{})['then'](respondWithResult(_0x58f6bc,0xc9))[_0x5ff0('0x45')](handleError(_0x58f6bc,null));};exports[_0x5ff0('0x4c')]=function(_0x3e0873,_0x2ae14a){if(_0x3e0873[_0x5ff0('0x4b')]['id']){delete _0x3e0873['body']['id'];}return db[_0x5ff0('0x2f')]['find']({'where':{'id':_0x3e0873['params']['id']}})[_0x5ff0('0x16')](handleEntityNotFound(_0x2ae14a,null))[_0x5ff0('0x16')](saveUpdates(_0x3e0873[_0x5ff0('0x4b')],null))['then'](respondWithResult(_0x2ae14a,null))[_0x5ff0('0x45')](handleError(_0x2ae14a,null));};exports[_0x5ff0('0x4d')]=function(_0x126a5e,_0x2e6cce){return db[_0x5ff0('0x2f')][_0x5ff0('0x49')]({'where':{'id':_0x126a5e[_0x5ff0('0x4e')]['id']}})[_0x5ff0('0x16')](handleEntityNotFound(_0x2e6cce,null))[_0x5ff0('0x16')](removeEntity(_0x2e6cce,null))[_0x5ff0('0x45')](handleError(_0x2e6cce,null));};exports[_0x5ff0('0x4f')]=function(_0x595896,_0x4b8984,_0x3404c9){var _0x4fa19c={};var _0x43bed8={};var _0x2a6201;var _0x249e64;return db[_0x5ff0('0x2f')][_0x5ff0('0x50')]({'where':{'id':_0x595896['params']['id']}})[_0x5ff0('0x16')](handleEntityNotFound(_0x4b8984,null))[_0x5ff0('0x16')](function(_0x48cb3b){if(_0x48cb3b){_0x2a6201=_0x48cb3b;_0x43bed8[_0x5ff0('0x30')]=_[_0x5ff0('0x34')](db['FreshdeskConfiguration']['rawAttributes']);_0x43bed8[_0x5ff0('0x32')]=_[_0x5ff0('0x34')](_0x595896['query']);_0x43bed8['filters']=_[_0x5ff0('0x35')](_0x43bed8['model'],_0x43bed8['query']);_0x4fa19c['attributes']=_[_0x5ff0('0x35')](_0x43bed8[_0x5ff0('0x30')],qs[_0x5ff0('0x37')](_0x595896[_0x5ff0('0x32')][_0x5ff0('0x37')]));_0x4fa19c[_0x5ff0('0x36')]=_0x4fa19c[_0x5ff0('0x36')][_0x5ff0('0x48')]?_0x4fa19c['attributes']:_0x43bed8[_0x5ff0('0x30')];_0x4fa19c['order']=qs[_0x5ff0('0x39')](_0x595896[_0x5ff0('0x32')][_0x5ff0('0x39')]);_0x4fa19c['where']=qs[_0x5ff0('0x3b')](_[_0x5ff0('0x51')](_0x595896['query'],_0x43bed8['filters']));if(_0x595896['query'][_0x5ff0('0x3f')]){_0x4fa19c[_0x5ff0('0x3a')]=_['merge'](_0x4fa19c[_0x5ff0('0x3a')],{'$or':_['map'](_0x4fa19c[_0x5ff0('0x36')],function(_0x21b9b4){var _0x1ce771={};_0x1ce771[_0x21b9b4]={'$like':'%'+_0x595896[_0x5ff0('0x32')][_0x5ff0('0x3f')]+'%'};return _0x1ce771;})});}_0x4fa19c=_[_0x5ff0('0x3e')]({},_0x4fa19c,_0x595896[_0x5ff0('0x40')]);return _0x2a6201[_0x5ff0('0x4f')](_0x4fa19c);}})[_0x5ff0('0x16')](function(_0x43e6f7){if(_0x43e6f7){_0x249e64=_0x43e6f7[_0x5ff0('0x48')];if(!_0x595896['query'][_0x5ff0('0x52')](_0x5ff0('0x38'))){_0x4fa19c[_0x5ff0('0x25')]=qs[_0x5ff0('0x25')](_0x595896['query'][_0x5ff0('0x25')]);_0x4fa19c[_0x5ff0('0x24')]=qs[_0x5ff0('0x24')](_0x595896[_0x5ff0('0x32')][_0x5ff0('0x24')]);}return _0x2a6201['getConfigurations'](_0x4fa19c);}})[_0x5ff0('0x16')](function(_0x220b08){if(_0x220b08){return _0x220b08?{'count':_0x249e64,'rows':_0x220b08}:null;}})[_0x5ff0('0x16')](respondWithResult(_0x4b8984,null))[_0x5ff0('0x45')](handleError(_0x4b8984,null));};exports['addConfiguration']=function(_0x8aeba,_0x503c1,_0x2f4944){if(_0x8aeba[_0x5ff0('0x4b')]['id']){delete _0x8aeba[_0x5ff0('0x4b')]['id'];}return db[_0x5ff0('0x2f')][_0x5ff0('0x50')]({'where':{'id':_0x8aeba['params']['id']}})[_0x5ff0('0x16')](handleEntityNotFound(_0x503c1,null))['then'](function(_0x9965ec){if(_0x9965ec){_0x8aeba[_0x5ff0('0x4b')][_0x5ff0('0x53')]=_0x9965ec['id'];_0x8aeba[_0x5ff0('0x4b')][_0x5ff0('0x54')]=integrations[_0x5ff0('0x55')](_0x8aeba[_0x5ff0('0x4b')]['channel'],_0x8aeba[_0x5ff0('0x4b')][_0x5ff0('0x56')]);_0x8aeba[_0x5ff0('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x8aeba[_0x5ff0('0x4b')][_0x5ff0('0x57')],_0x8aeba[_0x5ff0('0x4b')][_0x5ff0('0x56')]);return db[_0x5ff0('0x58')][_0x5ff0('0x4a')](_0x8aeba['body'],{'include':[{'model':db[_0x5ff0('0x59')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x5ff0('0x5a')}]});}return null;})[_0x5ff0('0x16')](respondWithResult(_0x503c1,null))[_0x5ff0('0x45')](handleError(_0x503c1,null));};exports['getFields']=function(_0x1ac609,_0x55b7b6,_0x1a6d41){return db[_0x5ff0('0x2f')][_0x5ff0('0x50')]({'where':{'id':_0x1ac609['params']['id']},'attributes':['id','remoteUri',_0x5ff0('0x5b')]})[_0x5ff0('0x16')](handleEntityNotFound(_0x55b7b6,null))[_0x5ff0('0x16')](function(_0x3aa7d8){if(_0x3aa7d8){return rp({'method':_0x5ff0('0x5c'),'uri':util[_0x5ff0('0x5d')](_0x5ff0('0x5e'),_0x3aa7d8[_0x5ff0('0x5f')],_0x5ff0('0x60')),'headers':{'Authorization':util[_0x5ff0('0x5d')](_0x5ff0('0x61'),new Buffer(util['format'](_0x5ff0('0x62'),_0x3aa7d8[_0x5ff0('0x5b')]))[_0x5ff0('0x63')](_0x5ff0('0x64')))},'json':!![]});}})[_0x5ff0('0x16')](function(_0x34b804){if(_0x34b804){var _0x4738d2=[_0x5ff0('0x65'),_0x5ff0('0x66'),_0x5ff0('0x67'),_0x5ff0('0x68'),_0x5ff0('0x21'),_0x5ff0('0x69'),_0x5ff0('0x6a'),_0x5ff0('0x6b'),_0x5ff0('0x6c'),'group',_0x5ff0('0x6d')];_[_0x5ff0('0x6e')](_0x34b804,function(_0x2f8852){return _0x4738d2[_0x5ff0('0x6f')](_0x2f8852[_0x5ff0('0x2c')])||!_0x2f8852[_0x5ff0('0x70')]&&_0x2f8852['type']!==_0x5ff0('0x71');});return{'count':_0x34b804[_0x5ff0('0x48')],'rows':_[_0x5ff0('0x72')](_0x34b804,function(_0x552000){return{'id':_0x552000['name'],'name':_0x552000[_0x5ff0('0x73')],'custom':!_0x552000['default'],'options':_0x552000[_0x5ff0('0x74')]?_['map'](_0x552000['choices'],function(_0x1fb287){return{'name':_[_0x5ff0('0x75')](_0x1fb287),'value':_0x1fb287};}):[]};})};}})['then'](respondWithResult(_0x55b7b6,null))[_0x5ff0('0x45')](function(_0x223c93){var _0x5576f7=_0x1ac609[_0x5ff0('0x32')]['test']?0x1f4:_0x223c93[_0x5ff0('0x76')]||0x1f4;logger[_0x5ff0('0x1c')](_0x5ff0('0x77'),_0x5ff0('0x78'),_0x5576f7,JSON[_0x5ff0('0x79')](_0x223c93));delete _0x223c93[_0x5ff0('0x2c')];if(_0x5576f7===0x191){_0x5576f7=0x190;}_0x55b7b6['status'](_0x5576f7)[_0x5ff0('0x2d')](_0x1ac609[_0x5ff0('0x32')]['test']?{'message':_0x5ff0('0x7a'),'statusCode':_0x223c93['statusCode']}:_0x223c93);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 724eb32..1e153c9 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 _0x8db0=['bluebird','./intFreshdeskAccount.attributes','FreshdeskAccount','lodash','util','api','moment'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0x8db0,0x65));var _0x08db=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0x8db0[_0x59eacf];return _0x5d74f2;};'use strict';var _=require(_0x08db('0x0'));var util=require(_0x08db('0x1'));var logger=require('../../config/logger')(_0x08db('0x2'));var moment=require(_0x08db('0x3'));var BPromise=require(_0x08db('0x4'));var rp=require('request-promise');var attributes=require(_0x08db('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5a7ee4,_0x218333){return _0x5a7ee4['define'](_0x08db('0x6'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25a3=['define','lodash','util','../../config/logger','moment','request-promise','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0x25a3,0x121));var _0x325a=function(_0x13b061,_0x429b15){_0x13b061=_0x13b061-0x0;var _0x4a9a34=_0x25a3[_0x13b061];return _0x4a9a34;};'use strict';var _=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var logger=require(_0x325a('0x2'))('api');var moment=require(_0x325a('0x3'));var BPromise=require('bluebird');var rp=require(_0x325a('0x4'));var attributes=require(_0x325a('0x5'));var integrations=require(_0x325a('0x6'));module['exports']=function(_0x3c04ea,_0x35dea7){return _0x3c04ea[_0x325a('0x7')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','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 f01c2c1..0d4b328 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 _0x3311=['attributes','limit','include','map','model','ShowFreshdeskAccount','find','where','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw'];(function(_0x3e3028,_0x30b94f){var _0x41b942=function(_0x7a0c51){while(--_0x7a0c51){_0x3e3028['push'](_0x3e3028['shift']());}};_0x41b942(++_0x30b94f);}(_0x3311,0x17f));var _0x1331=function(_0x41ea94,_0x19f5c4){_0x41ea94=_0x41ea94-0x0;var _0x1d3faa=_0x3311[_0x41ea94];return _0x1d3faa;};'use strict';var _=require(_0x1331('0x0'));var util=require(_0x1331('0x1'));var moment=require('moment');var BPromise=require(_0x1331('0x2'));var rs=require(_0x1331('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1331('0x4'))['db'];var utils=require(_0x1331('0x5'));var logger=require('../../config/logger')(_0x1331('0x6'));var config=require('../../config/environment');var jayson=require(_0x1331('0x7'));var client=jayson['client'][_0x1331('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55d6f2,_0x2ef23a,_0x9ae683){return new BPromise(function(_0x86ff6e,_0x353043){return client[_0x1331('0x9')](_0x55d6f2,_0x9ae683)[_0x1331('0xa')](function(_0x215949){logger['info'](_0x1331('0xb'),_0x2ef23a,_0x1331('0xc'));logger[_0x1331('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2ef23a,_0x1331('0xc'),JSON['stringify'](_0x215949));if(_0x215949[_0x1331('0xe')]){if(_0x215949[_0x1331('0xe')][_0x1331('0xf')]===0x1f4){logger['error'](_0x1331('0xb'),_0x2ef23a,_0x215949[_0x1331('0xe')][_0x1331('0x10')]);return _0x353043(_0x215949['error'][_0x1331('0x10')]);}logger[_0x1331('0xe')](_0x1331('0xb'),_0x2ef23a,_0x215949[_0x1331('0xe')][_0x1331('0x10')]);return _0x86ff6e(_0x215949[_0x1331('0xe')][_0x1331('0x10')]);}else{logger[_0x1331('0x11')](_0x1331('0xb'),_0x2ef23a,_0x1331('0xc'));_0x86ff6e(_0x215949[_0x1331('0x12')]['message']);}})[_0x1331('0x13')](function(_0x233367){logger[_0x1331('0xe')](_0x1331('0xb'),_0x2ef23a,_0x233367);_0x353043(_0x233367);});});}exports[_0x1331('0x14')]=function(_0x3a9aa3){var _0x4f096=this;return new Promise(function(_0x296434,_0x173b54){return db[_0x1331('0x15')][_0x1331('0x16')]({'raw':_0x3a9aa3['options']?_0x3a9aa3[_0x1331('0x17')][_0x1331('0x18')]===undefined?!![]:![]:!![],'where':_0x3a9aa3[_0x1331('0x17')]?_0x3a9aa3['options']['where']||null:null,'attributes':_0x3a9aa3[_0x1331('0x17')]?_0x3a9aa3['options'][_0x1331('0x19')]||null:null,'limit':_0x3a9aa3[_0x1331('0x17')]?_0x3a9aa3[_0x1331('0x17')][_0x1331('0x1a')]||null:null,'include':_0x3a9aa3[_0x1331('0x17')]?_0x3a9aa3[_0x1331('0x17')][_0x1331('0x1b')]?_[_0x1331('0x1c')](_0x3a9aa3[_0x1331('0x17')][_0x1331('0x1b')],function(_0x4da9ef){return{'model':db[_0x4da9ef[_0x1331('0x1d')]],'as':_0x4da9ef['as'],'attributes':_0x4da9ef['attributes'],'include':_0x4da9ef[_0x1331('0x1b')]?_[_0x1331('0x1c')](_0x4da9ef['include'],function(_0x3c94b5){return{'model':db[_0x3c94b5[_0x1331('0x1d')]],'as':_0x3c94b5['as'],'attributes':_0x3c94b5[_0x1331('0x19')],'include':_0x3c94b5[_0x1331('0x1b')]?_['map'](_0x3c94b5[_0x1331('0x1b')],function(_0x9ed8ea){return{'model':db[_0x9ed8ea[_0x1331('0x1d')]],'as':_0x9ed8ea['as'],'attributes':_0x9ed8ea[_0x1331('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8c015){logger[_0x1331('0x11')](_0x1331('0x14'),_0x3a9aa3);logger['debug'](_0x1331('0x14'),_0x3a9aa3,JSON['stringify'](_0x8c015));_0x296434(_0x8c015);})[_0x1331('0x13')](function(_0x532ab9){logger[_0x1331('0xe')](_0x1331('0x14'),_0x532ab9[_0x1331('0x10')],_0x3a9aa3);_0x173b54(_0x4f096['error'](0x1f4,_0x532ab9[_0x1331('0x10')]));});});};exports[_0x1331('0x1e')]=function(_0x4fe07f){var _0x33b055=this;return new Promise(function(_0x512aeb,_0x12af02){return db['FreshdeskAccount'][_0x1331('0x1f')]({'raw':_0x4fe07f[_0x1331('0x17')]?_0x4fe07f[_0x1331('0x17')][_0x1331('0x18')]===undefined?!![]:![]:!![],'where':_0x4fe07f['options']?_0x4fe07f[_0x1331('0x17')][_0x1331('0x20')]||null:null,'attributes':_0x4fe07f['options']?_0x4fe07f['options']['attributes']||null:null,'include':_0x4fe07f['options']?_0x4fe07f['options'][_0x1331('0x1b')]?_[_0x1331('0x1c')](_0x4fe07f['options']['include'],function(_0x5b6928){return{'model':db[_0x5b6928[_0x1331('0x1d')]],'as':_0x5b6928['as'],'attributes':_0x5b6928['attributes'],'include':_0x5b6928[_0x1331('0x1b')]?_[_0x1331('0x1c')](_0x5b6928[_0x1331('0x1b')],function(_0x5cb41c){return{'model':db[_0x5cb41c['model']],'as':_0x5cb41c['as'],'attributes':_0x5cb41c['attributes'],'include':_0x5cb41c[_0x1331('0x1b')]?_[_0x1331('0x1c')](_0x5cb41c[_0x1331('0x1b')],function(_0x2a6196){return{'model':db[_0x2a6196['model']],'as':_0x2a6196['as'],'attributes':_0x2a6196['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48956e){logger[_0x1331('0x11')]('ShowFreshdeskAccount',_0x4fe07f);logger[_0x1331('0xd')](_0x1331('0x1e'),_0x4fe07f,JSON[_0x1331('0x21')](_0x48956e));_0x512aeb(_0x48956e);})[_0x1331('0x13')](function(_0x3a0de6){logger[_0x1331('0xe')](_0x1331('0x1e'),_0x3a0de6[_0x1331('0x10')],_0x4fe07f);_0x12af02(_0x33b055[_0x1331('0xe')](0x1f4,_0x3a0de6['message']));});});}; \ No newline at end of file +var _0xf1e6=['http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3775ff,_0x54dab5){var _0x51f88c=function(_0x23c097){while(--_0x23c097){_0x3775ff['push'](_0x3775ff['shift']());}};_0x51f88c(++_0x54dab5);}(_0xf1e6,0x1bd));var _0x6f1e=function(_0x430b31,_0x25d328){_0x430b31=_0x430b31-0x0;var _0x35f74a=_0xf1e6[_0x430b31];return _0x35f74a;};'use strict';var _=require(_0x6f1e('0x0'));var util=require(_0x6f1e('0x1'));var moment=require('moment');var BPromise=require(_0x6f1e('0x2'));var rs=require(_0x6f1e('0x3'));var fs=require('fs');var Redis=require(_0x6f1e('0x4'));var db=require(_0x6f1e('0x5'))['db'];var utils=require(_0x6f1e('0x6'));var logger=require(_0x6f1e('0x7'))('rpc');var config=require(_0x6f1e('0x8'));var jayson=require(_0x6f1e('0x9'));var client=jayson['client'][_0x6f1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55844b,_0x27962a,_0x3f9ba7){return new BPromise(function(_0x22c53a,_0x286d4d){return client[_0x6f1e('0xb')](_0x55844b,_0x3f9ba7)[_0x6f1e('0xc')](function(_0x38761b){logger[_0x6f1e('0xd')](_0x6f1e('0xe'),_0x27962a,_0x6f1e('0xf'));logger[_0x6f1e('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x27962a,'request\x20sent',JSON[_0x6f1e('0x11')](_0x38761b));if(_0x38761b[_0x6f1e('0x12')]){if(_0x38761b[_0x6f1e('0x12')][_0x6f1e('0x13')]===0x1f4){logger[_0x6f1e('0x12')](_0x6f1e('0xe'),_0x27962a,_0x38761b['error'][_0x6f1e('0x14')]);return _0x286d4d(_0x38761b['error']['message']);}logger[_0x6f1e('0x12')](_0x6f1e('0xe'),_0x27962a,_0x38761b['error'][_0x6f1e('0x14')]);return _0x22c53a(_0x38761b['error'][_0x6f1e('0x14')]);}else{logger['info'](_0x6f1e('0xe'),_0x27962a,'request\x20sent');_0x22c53a(_0x38761b[_0x6f1e('0x15')][_0x6f1e('0x14')]);}})[_0x6f1e('0x16')](function(_0x4e47f0){logger['error'](_0x6f1e('0xe'),_0x27962a,_0x4e47f0);_0x286d4d(_0x4e47f0);});});}exports[_0x6f1e('0x17')]=function(_0x51cb36){var _0x58e1a6=this;return new Promise(function(_0x17179b,_0x5623aa){return db[_0x6f1e('0x18')][_0x6f1e('0x19')]({'raw':_0x51cb36[_0x6f1e('0x1a')]?_0x51cb36[_0x6f1e('0x1a')][_0x6f1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x51cb36['options']?_0x51cb36[_0x6f1e('0x1a')][_0x6f1e('0x1c')]||null:null,'attributes':_0x51cb36[_0x6f1e('0x1a')]?_0x51cb36['options'][_0x6f1e('0x1d')]||null:null,'limit':_0x51cb36[_0x6f1e('0x1a')]?_0x51cb36[_0x6f1e('0x1a')][_0x6f1e('0x1e')]||null:null,'include':_0x51cb36['options']?_0x51cb36['options']['include']?_[_0x6f1e('0x1f')](_0x51cb36[_0x6f1e('0x1a')][_0x6f1e('0x20')],function(_0x53aed2){return{'model':db[_0x53aed2['model']],'as':_0x53aed2['as'],'attributes':_0x53aed2[_0x6f1e('0x1d')],'include':_0x53aed2[_0x6f1e('0x20')]?_[_0x6f1e('0x1f')](_0x53aed2[_0x6f1e('0x20')],function(_0x499826){return{'model':db[_0x499826[_0x6f1e('0x21')]],'as':_0x499826['as'],'attributes':_0x499826[_0x6f1e('0x1d')],'include':_0x499826['include']?_[_0x6f1e('0x1f')](_0x499826[_0x6f1e('0x20')],function(_0x5f59a4){return{'model':db[_0x5f59a4[_0x6f1e('0x21')]],'as':_0x5f59a4['as'],'attributes':_0x5f59a4[_0x6f1e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f1e('0xc')](function(_0x278048){logger['info'](_0x6f1e('0x17'),_0x51cb36);logger[_0x6f1e('0x10')]('GetFreshdeskAccount',_0x51cb36,JSON[_0x6f1e('0x11')](_0x278048));_0x17179b(_0x278048);})[_0x6f1e('0x16')](function(_0xd4331c){logger[_0x6f1e('0x12')]('GetFreshdeskAccount',_0xd4331c['message'],_0x51cb36);_0x5623aa(_0x58e1a6[_0x6f1e('0x12')](0x1f4,_0xd4331c[_0x6f1e('0x14')]));});});};exports[_0x6f1e('0x22')]=function(_0x4f3527){var _0x2e8adc=this;return new Promise(function(_0x250f88,_0x5c92b2){return db[_0x6f1e('0x18')]['find']({'raw':_0x4f3527[_0x6f1e('0x1a')]?_0x4f3527[_0x6f1e('0x1a')][_0x6f1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f3527[_0x6f1e('0x1a')]?_0x4f3527[_0x6f1e('0x1a')][_0x6f1e('0x1c')]||null:null,'attributes':_0x4f3527[_0x6f1e('0x1a')]?_0x4f3527[_0x6f1e('0x1a')][_0x6f1e('0x1d')]||null:null,'include':_0x4f3527[_0x6f1e('0x1a')]?_0x4f3527[_0x6f1e('0x1a')]['include']?_[_0x6f1e('0x1f')](_0x4f3527[_0x6f1e('0x1a')][_0x6f1e('0x20')],function(_0x24bb87){return{'model':db[_0x24bb87[_0x6f1e('0x21')]],'as':_0x24bb87['as'],'attributes':_0x24bb87[_0x6f1e('0x1d')],'include':_0x24bb87['include']?_[_0x6f1e('0x1f')](_0x24bb87['include'],function(_0x4148fe){return{'model':db[_0x4148fe[_0x6f1e('0x21')]],'as':_0x4148fe['as'],'attributes':_0x4148fe['attributes'],'include':_0x4148fe[_0x6f1e('0x20')]?_[_0x6f1e('0x1f')](_0x4148fe[_0x6f1e('0x20')],function(_0x224496){return{'model':db[_0x224496[_0x6f1e('0x21')]],'as':_0x224496['as'],'attributes':_0x224496[_0x6f1e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f1e('0xc')](function(_0x47b6cd){logger[_0x6f1e('0xd')](_0x6f1e('0x22'),_0x4f3527);logger['debug'](_0x6f1e('0x22'),_0x4f3527,JSON['stringify'](_0x47b6cd));_0x250f88(_0x47b6cd);})[_0x6f1e('0x16')](function(_0x580ea8){logger[_0x6f1e('0x12')](_0x6f1e('0x22'),_0x580ea8[_0x6f1e('0x14')],_0x4f3527);_0x5c92b2(_0x2e8adc['error'](0x1f4,_0x580ea8[_0x6f1e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 43e46f8..eba1b03 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 _0x84ab=['isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get'];(function(_0x5abd00,_0x2fbdca){var _0x1a13fa=function(_0x1ac63b){while(--_0x1ac63b){_0x5abd00['push'](_0x5abd00['shift']());}};_0x1a13fa(++_0x2fbdca);}(_0x84ab,0x12f));var _0xb84a=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x84ab[_0x1e05c1];return _0x15f1ca;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var auth=require(_0xb84a('0x5'));var interaction=require(_0xb84a('0x6'));var config=require('../../config/environment');var controller=require(_0xb84a('0x7'));router[_0xb84a('0x8')]('/',auth[_0xb84a('0x9')](),controller['index']);router['get']('/:id',auth[_0xb84a('0x9')](),controller['show']);router[_0xb84a('0x8')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router['get'](_0xb84a('0xc'),auth[_0xb84a('0x9')](),controller[_0xb84a('0xd')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xb84a('0xe')]);router[_0xb84a('0x8')](_0xb84a('0xf'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x10')]);router['post']('/',auth[_0xb84a('0x9')](),controller[_0xb84a('0x11')]);router[_0xb84a('0x12')](_0xb84a('0xf'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x13')]);router[_0xb84a('0x14')](_0xb84a('0x15'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x16')]);router[_0xb84a('0x17')](_0xb84a('0x15'),auth['isAuthenticated'](),controller[_0xb84a('0x18')]);module[_0xb84a('0x19')]=router; \ No newline at end of file +var _0xb458=['../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x8c87e5,_0x45b967){var _0x3ec9e6=function(_0x24b0f2){while(--_0x24b0f2){_0x8c87e5['push'](_0x8c87e5['shift']());}};_0x3ec9e6(++_0x45b967);}(_0xb458,0x103));var _0x8b45=function(_0x26931e,_0x16f950){_0x26931e=_0x26931e-0x0;var _0x36bb27=_0xb458[_0x26931e];return _0x36bb27;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var auth=require(_0x8b45('0x4'));var interaction=require(_0x8b45('0x5'));var config=require(_0x8b45('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x8b45('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8b45('0x7')](_0x8b45('0x8'),auth[_0x8b45('0x9')](),controller[_0x8b45('0xa')]);router[_0x8b45('0x7')]('/:id/fields',auth[_0x8b45('0x9')](),controller[_0x8b45('0xb')]);router[_0x8b45('0x7')](_0x8b45('0xc'),auth[_0x8b45('0x9')](),controller['getSubjects']);router[_0x8b45('0x7')](_0x8b45('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x8b45('0x9')](),controller[_0x8b45('0xe')]);router[_0x8b45('0xf')]('/',auth['isAuthenticated'](),controller[_0x8b45('0x10')]);router[_0x8b45('0xf')](_0x8b45('0x11'),auth[_0x8b45('0x9')](),controller[_0x8b45('0x12')]);router[_0x8b45('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8b45('0x14')]);router[_0x8b45('0x15')](_0x8b45('0x8'),auth[_0x8b45('0x9')](),controller[_0x8b45('0x16')]);module[_0x8b45('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 224d199..9d5d7f4 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 _0x5a77=['STRING','sequelize','exports'];(function(_0x18c54b,_0x580a48){var _0x40408e=function(_0x91f7a8){while(--_0x91f7a8){_0x18c54b['push'](_0x18c54b['shift']());}};_0x40408e(++_0x580a48);}(_0x5a77,0x1c9));var _0x75a7=function(_0x58e5c4,_0xa11977){_0x58e5c4=_0x58e5c4-0x0;var _0x33f747=_0x5a77[_0x58e5c4];return _0x33f747;};'use strict';var Sequelize=require(_0x75a7('0x0'));module[_0x75a7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x75a7('0x2')]}}; \ No newline at end of file +var _0x7292=['exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7292,0x152));var _0x2729=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7292[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require('sequelize');module[_0x2729('0x0')]={'name':{'type':Sequelize[_0x2729('0x1')]},'description':{'type':Sequelize[_0x2729('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index d906a0c..849e8f0 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 _0xce27=['body','getFields','findOne','FreshdeskField','order','map','getSubjects','getDescriptions','getTags','hasOwnProperty','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','FreshdeskConfiguration','rawAttributes','model','keys','query','dateEnd','dateStart','filters','attributes','intersection','fields','nolimit','limit','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','show','params','length','find','create'];(function(_0x3df9db,_0x3e727b){var _0x4f09b3=function(_0x4101f3){while(--_0x4101f3){_0x3df9db['push'](_0x3df9db['shift']());}};_0x4f09b3(++_0x3e727b);}(_0xce27,0xca));var _0x7ce2=function(_0x3fd9fb,_0x58129d){_0x3fd9fb=_0x3fd9fb-0x0;var _0x33ff31=_0xce27[_0x3fd9fb];return _0x33ff31;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7ce2('0x0'));var zipdir=require(_0x7ce2('0x1'));var jsonpatch=require(_0x7ce2('0x2'));var rp=require(_0x7ce2('0x3'));var moment=require('moment');var BPromise=require(_0x7ce2('0x4'));var Mustache=require('mustache');var util=require(_0x7ce2('0x5'));var path=require(_0x7ce2('0x6'));var sox=require(_0x7ce2('0x7'));var csv=require(_0x7ce2('0x8'));var ejs=require(_0x7ce2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7ce2('0xa'));var crypto=require(_0x7ce2('0xb'));var jsforce=require(_0x7ce2('0xc'));var deskjs=require(_0x7ce2('0xd'));var toCsv=require(_0x7ce2('0x8'));var querystring=require(_0x7ce2('0xe'));var Papa=require(_0x7ce2('0xf'));var Redis=require('ioredis');var qs=require(_0x7ce2('0x10'));var logger=require('../../config/logger')(_0x7ce2('0x11'));var utils=require(_0x7ce2('0x12'));var config=require(_0x7ce2('0x13'));var db=require(_0x7ce2('0x14'))['db'];var jayson=require(_0x7ce2('0x15'));var client=jayson[_0x7ce2('0x16')][_0x7ce2('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x527ac3,_0x479255,_0x59daa8,_0x385e58){return new BPromise(function(_0x2ae5d3,_0x5161f7){var _0x2ea1e6=_0x385e58||client;return _0x2ea1e6[_0x7ce2('0x18')](_0x527ac3,_0x59daa8)[_0x7ce2('0x19')](function(_0x16f56c){logger[_0x7ce2('0x1a')](_0x7ce2('0x1b'),_0x479255,_0x7ce2('0x1c'));logger[_0x7ce2('0x1d')](_0x7ce2('0x1e'),_0x479255,_0x7ce2('0x1c'),JSON[_0x7ce2('0x1f')](_0x16f56c));if(_0x16f56c['error']){if(_0x16f56c[_0x7ce2('0x20')][_0x7ce2('0x21')]===0x1f4){logger[_0x7ce2('0x20')](_0x7ce2('0x1b'),_0x479255,_0x16f56c[_0x7ce2('0x20')][_0x7ce2('0x22')]);return _0x5161f7(_0x16f56c[_0x7ce2('0x20')][_0x7ce2('0x22')]);}logger['error'](_0x7ce2('0x1b'),_0x479255,_0x16f56c[_0x7ce2('0x20')]['message']);return _0x2ae5d3(_0x16f56c['error'][_0x7ce2('0x22')]);}else{logger[_0x7ce2('0x1a')](_0x7ce2('0x1b'),_0x479255,_0x7ce2('0x1c'));_0x2ae5d3(_0x16f56c['result'][_0x7ce2('0x22')]);}})[_0x7ce2('0x23')](function(_0x3cdc4a){logger[_0x7ce2('0x20')](_0x7ce2('0x1b'),_0x479255,_0x3cdc4a);_0x5161f7(_0x3cdc4a);});});}function respondWithStatusCode(_0x527ef4,_0x4422f8){_0x4422f8=_0x4422f8||0xcc;return function(_0x41d1a2){if(_0x41d1a2){return _0x527ef4[_0x7ce2('0x24')](_0x4422f8);}return _0x527ef4['status'](_0x4422f8)[_0x7ce2('0x25')]();};}function respondWithResult(_0x971f7e,_0x1de46c){_0x1de46c=_0x1de46c||0xc8;return function(_0x5a4f0e){if(_0x5a4f0e){return _0x971f7e[_0x7ce2('0x26')](_0x1de46c)[_0x7ce2('0x27')](_0x5a4f0e);}};}function respondWithFilteredResult(_0x460662,_0x13acf0){return function(_0x1a7a96){if(_0x1a7a96){var _0x4a1621=_0x1a7a96[_0x7ce2('0x28')],_0x1a56cb=_0x13acf0[_0x7ce2('0x29')],_0x5e64b2=_0x13acf0[_0x7ce2('0x29')]+_0x13acf0['limit'],_0x3b46dd;if(_0x5e64b2>=_0x4a1621){_0x5e64b2=_0x4a1621;_0x3b46dd=0xc8;}else{_0x3b46dd=0xce;}_0x460662[_0x7ce2('0x26')](_0x3b46dd);return _0x460662[_0x7ce2('0x2a')](_0x7ce2('0x2b'),_0x1a56cb+'-'+_0x5e64b2+'/'+_0x4a1621)['json'](_0x1a7a96);}return null;};}function patchUpdates(_0x30959d){return function(_0x580063){try{jsonpatch[_0x7ce2('0x2c')](_0x580063,_0x30959d,!![]);}catch(_0x5d8b25){return BPromise[_0x7ce2('0x2d')](_0x5d8b25);}return _0x580063[_0x7ce2('0x2e')]();};}function saveUpdates(_0x3259e6,_0x9fc2ba){return function(_0x402347){if(_0x402347){return _0x402347[_0x7ce2('0x2f')](_0x3259e6)[_0x7ce2('0x19')](function(_0x1deb27){return _0x1deb27;});}return null;};}function removeEntity(_0x44d29e,_0x32aee9){return function(_0x3fde29){if(_0x3fde29){return _0x3fde29[_0x7ce2('0x30')]()[_0x7ce2('0x19')](function(){_0x44d29e[_0x7ce2('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x108cad,_0x16fe74){return function(_0x17cb34){if(!_0x17cb34){_0x108cad['sendStatus'](0x194);}return _0x17cb34;};}function handleError(_0x23a622,_0x53364c){_0x53364c=_0x53364c||0x1f4;return function(_0x504d6f){logger[_0x7ce2('0x20')](_0x504d6f[_0x7ce2('0x31')]);if(_0x504d6f['name']){delete _0x504d6f[_0x7ce2('0x32')];}_0x23a622['status'](_0x53364c)[_0x7ce2('0x33')](_0x504d6f);};}exports[_0x7ce2('0x34')]=function(_0x579c4f,_0x1c75d5){var _0x639054={},_0x454ac2={},_0x4d30d5={'count':0x0,'rows':[]};var _0x43950f=db[_0x7ce2('0x35')][_0x7ce2('0x36')];_0x454ac2[_0x7ce2('0x37')]=_[_0x7ce2('0x38')](_0x43950f);var _0x66a1e0={'dateStart':_0x579c4f[_0x7ce2('0x39')]['dateStart'],'dateEnd':_0x579c4f[_0x7ce2('0x39')][_0x7ce2('0x3a')]};delete _0x579c4f['query'][_0x7ce2('0x3b')];delete _0x579c4f[_0x7ce2('0x39')][_0x7ce2('0x3a')];_0x454ac2['query']=_[_0x7ce2('0x38')](_0x579c4f[_0x7ce2('0x39')]);_0x454ac2[_0x7ce2('0x3c')]=_['intersection'](_0x454ac2['model'],_0x454ac2[_0x7ce2('0x39')]);_0x639054[_0x7ce2('0x3d')]=_[_0x7ce2('0x3e')](_0x454ac2['model'],qs[_0x7ce2('0x3f')](_0x579c4f[_0x7ce2('0x39')][_0x7ce2('0x3f')]));_0x639054[_0x7ce2('0x3d')]=_0x639054[_0x7ce2('0x3d')]['length']?_0x639054['attributes']:_0x454ac2[_0x7ce2('0x37')];if(!_0x579c4f[_0x7ce2('0x39')]['hasOwnProperty'](_0x7ce2('0x40'))){_0x639054[_0x7ce2('0x41')]=qs[_0x7ce2('0x41')](_0x579c4f[_0x7ce2('0x39')][_0x7ce2('0x41')]);_0x639054[_0x7ce2('0x29')]=qs[_0x7ce2('0x29')](_0x579c4f[_0x7ce2('0x39')][_0x7ce2('0x29')]);}_0x639054['order']=qs['sort'](_0x579c4f['query'][_0x7ce2('0x42')]);_0x639054[_0x7ce2('0x43')]=qs[_0x7ce2('0x3c')](_[_0x7ce2('0x44')](_0x579c4f['query'],_0x454ac2[_0x7ce2('0x3c')]));if(_0x66a1e0[_0x7ce2('0x3b')]){if(_0x66a1e0[_0x7ce2('0x3a')]){_0x66a1e0['dateEnd']=moment(_0x66a1e0[_0x7ce2('0x3a')])[_0x7ce2('0x45')](0x1,_0x7ce2('0x46'));}else{_0x66a1e0[_0x7ce2('0x3a')]=moment(_0x66a1e0[_0x7ce2('0x3b')])[_0x7ce2('0x45')](0x1,_0x7ce2('0x46'));}_[_0x7ce2('0x47')](_0x639054[_0x7ce2('0x43')],{'createdAt':{'$gte':_0x66a1e0['dateStart'],'$lte':_0x66a1e0[_0x7ce2('0x3a')]}});}if(_0x579c4f['query'][_0x7ce2('0x48')]){_0x639054['where']=_[_0x7ce2('0x47')](_0x639054[_0x7ce2('0x43')],{'$or':_['map'](_0x639054[_0x7ce2('0x3d')],function(_0x3fcb3d){var _0x4b5e92={};_0x4b5e92[_0x3fcb3d]={'$like':'%'+_0x579c4f[_0x7ce2('0x39')][_0x7ce2('0x48')]+'%'};return _0x4b5e92;})});}_0x639054=_[_0x7ce2('0x47')]({},_0x639054,_0x579c4f[_0x7ce2('0x49')]);var _0xe54bc7={'where':_0x639054[_0x7ce2('0x43')]};return db['FreshdeskConfiguration'][_0x7ce2('0x28')](_0xe54bc7)[_0x7ce2('0x19')](function(_0x148750){_0x4d30d5[_0x7ce2('0x28')]=_0x148750;if(_0x579c4f['query'][_0x7ce2('0x4a')]){_0x639054[_0x7ce2('0x4b')]=[{'all':!![]}];}return db[_0x7ce2('0x35')][_0x7ce2('0x4c')](_0x639054);})[_0x7ce2('0x19')](function(_0x50f482){_0x4d30d5[_0x7ce2('0x4d')]=_0x50f482;return _0x4d30d5;})[_0x7ce2('0x19')](respondWithFilteredResult(_0x1c75d5,_0x639054))[_0x7ce2('0x23')](handleError(_0x1c75d5,null));};exports[_0x7ce2('0x4e')]=function(_0x3e1372,_0x8cbbbc){var _0x2aba88={'raw':![],'where':{'id':_0x3e1372[_0x7ce2('0x4f')]['id']}},_0xe5e1ab={};_0xe5e1ab[_0x7ce2('0x37')]=_[_0x7ce2('0x38')](db['FreshdeskConfiguration'][_0x7ce2('0x36')]);_0xe5e1ab[_0x7ce2('0x39')]=_[_0x7ce2('0x38')](_0x3e1372[_0x7ce2('0x39')]);_0xe5e1ab[_0x7ce2('0x3c')]=_[_0x7ce2('0x3e')](_0xe5e1ab[_0x7ce2('0x37')],_0xe5e1ab[_0x7ce2('0x39')]);_0x2aba88['attributes']=_[_0x7ce2('0x3e')](_0xe5e1ab[_0x7ce2('0x37')],qs['fields'](_0x3e1372['query'][_0x7ce2('0x3f')]));_0x2aba88[_0x7ce2('0x3d')]=_0x2aba88[_0x7ce2('0x3d')][_0x7ce2('0x50')]?_0x2aba88[_0x7ce2('0x3d')]:_0xe5e1ab[_0x7ce2('0x37')];if(_0x3e1372[_0x7ce2('0x39')][_0x7ce2('0x4a')]){_0x2aba88['include']=[{'all':!![]}];}_0x2aba88=_['merge']({},_0x2aba88,_0x3e1372['options']);return db[_0x7ce2('0x35')][_0x7ce2('0x51')](_0x2aba88)[_0x7ce2('0x19')](handleEntityNotFound(_0x8cbbbc,null))[_0x7ce2('0x19')](respondWithResult(_0x8cbbbc,null))[_0x7ce2('0x23')](handleError(_0x8cbbbc,null));};exports[_0x7ce2('0x52')]=function(_0x466000,_0x5504a){return db[_0x7ce2('0x35')][_0x7ce2('0x52')](_0x466000[_0x7ce2('0x53')],{})[_0x7ce2('0x19')](respondWithResult(_0x5504a,0xc9))['catch'](handleError(_0x5504a,null));};exports[_0x7ce2('0x2f')]=function(_0x4ab96a,_0x814913){if(_0x4ab96a[_0x7ce2('0x53')]['id']){delete _0x4ab96a[_0x7ce2('0x53')]['id'];}return db[_0x7ce2('0x35')][_0x7ce2('0x51')]({'where':{'id':_0x4ab96a[_0x7ce2('0x4f')]['id']}})[_0x7ce2('0x19')](handleEntityNotFound(_0x814913,null))[_0x7ce2('0x19')](saveUpdates(_0x4ab96a[_0x7ce2('0x53')],null))[_0x7ce2('0x19')](respondWithResult(_0x814913,null))[_0x7ce2('0x23')](handleError(_0x814913,null));};exports['destroy']=function(_0x57b3ab,_0x24adb1){return db[_0x7ce2('0x35')][_0x7ce2('0x51')]({'where':{'id':_0x57b3ab['params']['id']}})[_0x7ce2('0x19')](handleEntityNotFound(_0x24adb1,null))[_0x7ce2('0x19')](removeEntity(_0x24adb1,null))[_0x7ce2('0x23')](handleError(_0x24adb1,null));};exports[_0x7ce2('0x54')]=function(_0xb19068,_0x259d57,_0x4512a6){var _0x366fd0={};var _0x21f7fa={};var _0x2f0bba;var _0x4b6c30;return db['FreshdeskConfiguration'][_0x7ce2('0x55')]({'where':{'id':_0xb19068[_0x7ce2('0x4f')]['id']}})[_0x7ce2('0x19')](handleEntityNotFound(_0x259d57,null))['then'](function(_0x26ca85){if(_0x26ca85){_0x2f0bba=_0x26ca85;_0x21f7fa['model']=_[_0x7ce2('0x38')](db[_0x7ce2('0x56')][_0x7ce2('0x36')]);_0x21f7fa[_0x7ce2('0x39')]=_[_0x7ce2('0x38')](_0xb19068[_0x7ce2('0x39')]);_0x21f7fa[_0x7ce2('0x3c')]=_[_0x7ce2('0x3e')](_0x21f7fa[_0x7ce2('0x37')],_0x21f7fa[_0x7ce2('0x39')]);_0x366fd0[_0x7ce2('0x3d')]=_[_0x7ce2('0x3e')](_0x21f7fa['model'],qs[_0x7ce2('0x3f')](_0xb19068[_0x7ce2('0x39')][_0x7ce2('0x3f')]));_0x366fd0[_0x7ce2('0x3d')]=_0x366fd0[_0x7ce2('0x3d')]['length']?_0x366fd0[_0x7ce2('0x3d')]:_0x21f7fa['model'];_0x366fd0[_0x7ce2('0x57')]=qs['sort'](_0xb19068['query'][_0x7ce2('0x42')]);_0x366fd0[_0x7ce2('0x43')]=qs[_0x7ce2('0x3c')](_['pick'](_0xb19068[_0x7ce2('0x39')],_0x21f7fa[_0x7ce2('0x3c')]));if(_0xb19068[_0x7ce2('0x39')][_0x7ce2('0x48')]){_0x366fd0[_0x7ce2('0x43')]=_[_0x7ce2('0x47')](_0x366fd0[_0x7ce2('0x43')],{'$or':_[_0x7ce2('0x58')](_0x366fd0[_0x7ce2('0x3d')],function(_0x3c5060){var _0x398eb3={};_0x398eb3[_0x3c5060]={'$like':'%'+_0xb19068[_0x7ce2('0x39')][_0x7ce2('0x48')]+'%'};return _0x398eb3;})});}_0x366fd0=_['merge']({},_0x366fd0,_0xb19068[_0x7ce2('0x49')]);return _0x2f0bba[_0x7ce2('0x54')](_0x366fd0);}})['then'](function(_0x31ccb5){if(_0x31ccb5){_0x4b6c30=_0x31ccb5[_0x7ce2('0x50')];if(!_0xb19068[_0x7ce2('0x39')]['hasOwnProperty'](_0x7ce2('0x40'))){_0x366fd0['limit']=qs['limit'](_0xb19068[_0x7ce2('0x39')][_0x7ce2('0x41')]);_0x366fd0[_0x7ce2('0x29')]=qs['offset'](_0xb19068[_0x7ce2('0x39')][_0x7ce2('0x29')]);}return _0x2f0bba[_0x7ce2('0x54')](_0x366fd0);}})['then'](function(_0x476a07){if(_0x476a07){return _0x476a07?{'count':_0x4b6c30,'rows':_0x476a07}:null;}})[_0x7ce2('0x19')](respondWithResult(_0x259d57,null))['catch'](handleError(_0x259d57,null));};exports['getSubjects']=function(_0x3382ea,_0x2ecba0,_0x47b542){var _0x1a946a={};var _0x1c2d85={};var _0xa966ce;var _0x263920;return db[_0x7ce2('0x35')]['findOne']({'where':{'id':_0x3382ea['params']['id']}})[_0x7ce2('0x19')](handleEntityNotFound(_0x2ecba0,null))[_0x7ce2('0x19')](function(_0x5c9c39){if(_0x5c9c39){_0xa966ce=_0x5c9c39;_0x1c2d85[_0x7ce2('0x37')]=_[_0x7ce2('0x38')](db[_0x7ce2('0x56')][_0x7ce2('0x36')]);_0x1c2d85[_0x7ce2('0x39')]=_[_0x7ce2('0x38')](_0x3382ea[_0x7ce2('0x39')]);_0x1c2d85[_0x7ce2('0x3c')]=_['intersection'](_0x1c2d85['model'],_0x1c2d85['query']);_0x1a946a[_0x7ce2('0x3d')]=_[_0x7ce2('0x3e')](_0x1c2d85[_0x7ce2('0x37')],qs[_0x7ce2('0x3f')](_0x3382ea['query'][_0x7ce2('0x3f')]));_0x1a946a['attributes']=_0x1a946a[_0x7ce2('0x3d')][_0x7ce2('0x50')]?_0x1a946a[_0x7ce2('0x3d')]:_0x1c2d85[_0x7ce2('0x37')];_0x1a946a['order']=qs[_0x7ce2('0x42')](_0x3382ea[_0x7ce2('0x39')][_0x7ce2('0x42')]);_0x1a946a[_0x7ce2('0x43')]=qs[_0x7ce2('0x3c')](_['pick'](_0x3382ea[_0x7ce2('0x39')],_0x1c2d85[_0x7ce2('0x3c')]));if(_0x3382ea['query']['filter']){_0x1a946a[_0x7ce2('0x43')]=_[_0x7ce2('0x47')](_0x1a946a[_0x7ce2('0x43')],{'$or':_[_0x7ce2('0x58')](_0x1a946a[_0x7ce2('0x3d')],function(_0x141ef1){var _0x466c0b={};_0x466c0b[_0x141ef1]={'$like':'%'+_0x3382ea[_0x7ce2('0x39')][_0x7ce2('0x48')]+'%'};return _0x466c0b;})});}_0x1a946a=_[_0x7ce2('0x47')]({},_0x1a946a,_0x3382ea[_0x7ce2('0x49')]);return _0xa966ce[_0x7ce2('0x59')](_0x1a946a);}})['then'](function(_0x10ff27){if(_0x10ff27){_0x263920=_0x10ff27['length'];if(!_0x3382ea['query']['hasOwnProperty'](_0x7ce2('0x40'))){_0x1a946a[_0x7ce2('0x41')]=qs[_0x7ce2('0x41')](_0x3382ea[_0x7ce2('0x39')][_0x7ce2('0x41')]);_0x1a946a[_0x7ce2('0x29')]=qs[_0x7ce2('0x29')](_0x3382ea[_0x7ce2('0x39')][_0x7ce2('0x29')]);}return _0xa966ce[_0x7ce2('0x59')](_0x1a946a);}})[_0x7ce2('0x19')](function(_0x511aa6){if(_0x511aa6){return _0x511aa6?{'count':_0x263920,'rows':_0x511aa6}:null;}})[_0x7ce2('0x19')](respondWithResult(_0x2ecba0,null))[_0x7ce2('0x23')](handleError(_0x2ecba0,null));};exports[_0x7ce2('0x5a')]=function(_0xc6ccf9,_0xdc7b64,_0x459104){var _0x352897={};var _0xaff461={};var _0x10f550;var _0x129762;return db[_0x7ce2('0x35')][_0x7ce2('0x55')]({'where':{'id':_0xc6ccf9[_0x7ce2('0x4f')]['id']}})[_0x7ce2('0x19')](handleEntityNotFound(_0xdc7b64,null))['then'](function(_0x2ebf1f){if(_0x2ebf1f){_0x10f550=_0x2ebf1f;_0xaff461['model']=_['keys'](db[_0x7ce2('0x56')]['rawAttributes']);_0xaff461[_0x7ce2('0x39')]=_[_0x7ce2('0x38')](_0xc6ccf9['query']);_0xaff461[_0x7ce2('0x3c')]=_[_0x7ce2('0x3e')](_0xaff461[_0x7ce2('0x37')],_0xaff461[_0x7ce2('0x39')]);_0x352897['attributes']=_['intersection'](_0xaff461[_0x7ce2('0x37')],qs[_0x7ce2('0x3f')](_0xc6ccf9[_0x7ce2('0x39')][_0x7ce2('0x3f')]));_0x352897[_0x7ce2('0x3d')]=_0x352897['attributes'][_0x7ce2('0x50')]?_0x352897[_0x7ce2('0x3d')]:_0xaff461[_0x7ce2('0x37')];_0x352897['order']=qs['sort'](_0xc6ccf9[_0x7ce2('0x39')][_0x7ce2('0x42')]);_0x352897[_0x7ce2('0x43')]=qs[_0x7ce2('0x3c')](_[_0x7ce2('0x44')](_0xc6ccf9[_0x7ce2('0x39')],_0xaff461[_0x7ce2('0x3c')]));if(_0xc6ccf9[_0x7ce2('0x39')][_0x7ce2('0x48')]){_0x352897[_0x7ce2('0x43')]=_[_0x7ce2('0x47')](_0x352897[_0x7ce2('0x43')],{'$or':_['map'](_0x352897['attributes'],function(_0x647beb){var _0x10d59b={};_0x10d59b[_0x647beb]={'$like':'%'+_0xc6ccf9['query'][_0x7ce2('0x48')]+'%'};return _0x10d59b;})});}_0x352897=_[_0x7ce2('0x47')]({},_0x352897,_0xc6ccf9[_0x7ce2('0x49')]);return _0x10f550[_0x7ce2('0x5a')](_0x352897);}})[_0x7ce2('0x19')](function(_0x172a2d){if(_0x172a2d){_0x129762=_0x172a2d[_0x7ce2('0x50')];if(!_0xc6ccf9[_0x7ce2('0x39')]['hasOwnProperty'](_0x7ce2('0x40'))){_0x352897[_0x7ce2('0x41')]=qs[_0x7ce2('0x41')](_0xc6ccf9['query'][_0x7ce2('0x41')]);_0x352897[_0x7ce2('0x29')]=qs[_0x7ce2('0x29')](_0xc6ccf9[_0x7ce2('0x39')][_0x7ce2('0x29')]);}return _0x10f550['getDescriptions'](_0x352897);}})['then'](function(_0x4630e1){if(_0x4630e1){return _0x4630e1?{'count':_0x129762,'rows':_0x4630e1}:null;}})['then'](respondWithResult(_0xdc7b64,null))[_0x7ce2('0x23')](handleError(_0xdc7b64,null));};exports[_0x7ce2('0x5b')]=function(_0x58ff38,_0x3f5c64,_0x5985c8){var _0x3844c5={};var _0x245c9a={};var _0x2c39db;var _0x5cd900;return db['FreshdeskConfiguration'][_0x7ce2('0x55')]({'where':{'id':_0x58ff38[_0x7ce2('0x4f')]['id']}})[_0x7ce2('0x19')](handleEntityNotFound(_0x3f5c64,null))[_0x7ce2('0x19')](function(_0x4b9254){if(_0x4b9254){_0x2c39db=_0x4b9254;_0x245c9a[_0x7ce2('0x37')]=_[_0x7ce2('0x38')](db['Tag'][_0x7ce2('0x36')]);_0x245c9a[_0x7ce2('0x39')]=_['keys'](_0x58ff38[_0x7ce2('0x39')]);_0x245c9a['filters']=_['intersection'](_0x245c9a[_0x7ce2('0x37')],_0x245c9a[_0x7ce2('0x39')]);_0x3844c5[_0x7ce2('0x3d')]=_[_0x7ce2('0x3e')](_0x245c9a['model'],qs[_0x7ce2('0x3f')](_0x58ff38['query'][_0x7ce2('0x3f')]));_0x3844c5['attributes']=_0x3844c5['attributes'][_0x7ce2('0x50')]?_0x3844c5[_0x7ce2('0x3d')]:_0x245c9a[_0x7ce2('0x37')];_0x3844c5[_0x7ce2('0x57')]=qs['sort'](_0x58ff38[_0x7ce2('0x39')][_0x7ce2('0x42')]);_0x3844c5[_0x7ce2('0x43')]=qs[_0x7ce2('0x3c')](_[_0x7ce2('0x44')](_0x58ff38['query'],_0x245c9a[_0x7ce2('0x3c')]));if(_0x58ff38[_0x7ce2('0x39')][_0x7ce2('0x48')]){_0x3844c5[_0x7ce2('0x43')]=_[_0x7ce2('0x47')](_0x3844c5[_0x7ce2('0x43')],{'$or':_['map'](_0x3844c5[_0x7ce2('0x3d')],function(_0xf8ee97){var _0xde405={};_0xde405[_0xf8ee97]={'$like':'%'+_0x58ff38[_0x7ce2('0x39')][_0x7ce2('0x48')]+'%'};return _0xde405;})});}_0x3844c5=_[_0x7ce2('0x47')]({},_0x3844c5,_0x58ff38[_0x7ce2('0x49')]);return _0x2c39db['getTags'](_0x3844c5);}})[_0x7ce2('0x19')](function(_0x6640dc){if(_0x6640dc){_0x5cd900=_0x6640dc[_0x7ce2('0x50')];if(!_0x58ff38[_0x7ce2('0x39')][_0x7ce2('0x5c')]('nolimit')){_0x3844c5[_0x7ce2('0x41')]=qs[_0x7ce2('0x41')](_0x58ff38['query']['limit']);_0x3844c5[_0x7ce2('0x29')]=qs[_0x7ce2('0x29')](_0x58ff38[_0x7ce2('0x39')][_0x7ce2('0x29')]);}return _0x2c39db[_0x7ce2('0x5b')](_0x3844c5);}})[_0x7ce2('0x19')](function(_0x3558e1){if(_0x3558e1){return _0x3558e1?{'count':_0x5cd900,'rows':_0x3558e1}:null;}})['then'](respondWithResult(_0x3f5c64,null))[_0x7ce2('0x23')](handleError(_0x3f5c64,null));};exports['setTags']=function(_0x3fca0a,_0x39053e,_0x2e3f0f){if(_0x3fca0a['body']['id']){delete _0x3fca0a['body']['id'];}return db[_0x7ce2('0x35')][_0x7ce2('0x55')]({'where':{'id':_0x3fca0a[_0x7ce2('0x4f')]['id']}})[_0x7ce2('0x19')](handleEntityNotFound(_0x39053e,null))[_0x7ce2('0x19')](function(_0x487103){if(_0x487103){return _0x487103[_0x7ce2('0x5d')](_0x3fca0a[_0x7ce2('0x53')][_0x7ce2('0x5e')]||[]);}return null;})[_0x7ce2('0x19')](respondWithResult(_0x39053e,null))[_0x7ce2('0x23')](handleError(_0x39053e,null));}; \ No newline at end of file +var _0xb3e4=['sendStatus','stack','name','send','FreshdeskConfiguration','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','map','filter','options','includeAll','findAll','rows','show','rawAttributes','include','create','body','find','params','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','status','end','count','offset','limit','set','json','apply','save','update','destroy'];(function(_0x1b4353,_0x45d808){var _0x52c83b=function(_0x14ec30){while(--_0x14ec30){_0x1b4353['push'](_0x1b4353['shift']());}};_0x52c83b(++_0x45d808);}(_0xb3e4,0x19e));var _0x4b3e=function(_0x45a67c,_0x3853c9){_0x45a67c=_0x45a67c-0x0;var _0x2533ea=_0xb3e4[_0x45a67c];return _0x2533ea;};'use strict';var pdf=require(_0x4b3e('0x0'));var emlformat=require(_0x4b3e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4b3e('0x2'));var rp=require(_0x4b3e('0x3'));var moment=require(_0x4b3e('0x4'));var BPromise=require(_0x4b3e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4b3e('0x6'));var sox=require('sox');var csv=require(_0x4b3e('0x7'));var ejs=require(_0x4b3e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4b3e('0x9'));var crypto=require(_0x4b3e('0xa'));var jsforce=require(_0x4b3e('0xb'));var deskjs=require(_0x4b3e('0xc'));var toCsv=require(_0x4b3e('0x7'));var querystring=require(_0x4b3e('0xd'));var Papa=require(_0x4b3e('0xe'));var Redis=require('ioredis');var qs=require(_0x4b3e('0xf'));var logger=require(_0x4b3e('0x10'))(_0x4b3e('0x11'));var utils=require(_0x4b3e('0x12'));var config=require(_0x4b3e('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4b3e('0x14'));var client=jayson[_0x4b3e('0x15')][_0x4b3e('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x4a6330,_0x3385eb,_0x169f1c,_0x48220c){return new BPromise(function(_0x53f011,_0x180cea){var _0x2c85ee=_0x48220c||client;return _0x2c85ee[_0x4b3e('0x17')](_0x4a6330,_0x169f1c)[_0x4b3e('0x18')](function(_0x572a21){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3385eb,_0x4b3e('0x19'));logger['debug'](_0x4b3e('0x1a'),_0x3385eb,_0x4b3e('0x19'),JSON[_0x4b3e('0x1b')](_0x572a21));if(_0x572a21['error']){if(_0x572a21[_0x4b3e('0x1c')][_0x4b3e('0x1d')]===0x1f4){logger['error'](_0x4b3e('0x1e'),_0x3385eb,_0x572a21[_0x4b3e('0x1c')][_0x4b3e('0x1f')]);return _0x180cea(_0x572a21[_0x4b3e('0x1c')][_0x4b3e('0x1f')]);}logger[_0x4b3e('0x1c')](_0x4b3e('0x1e'),_0x3385eb,_0x572a21[_0x4b3e('0x1c')][_0x4b3e('0x1f')]);return _0x53f011(_0x572a21['error'][_0x4b3e('0x1f')]);}else{logger[_0x4b3e('0x20')](_0x4b3e('0x1e'),_0x3385eb,_0x4b3e('0x19'));_0x53f011(_0x572a21[_0x4b3e('0x21')][_0x4b3e('0x1f')]);}})[_0x4b3e('0x22')](function(_0x13c4e0){logger[_0x4b3e('0x1c')](_0x4b3e('0x1e'),_0x3385eb,_0x13c4e0);_0x180cea(_0x13c4e0);});});}function respondWithStatusCode(_0x20c10b,_0x4ea545){_0x4ea545=_0x4ea545||0xcc;return function(_0x74803e){if(_0x74803e){return _0x20c10b['sendStatus'](_0x4ea545);}return _0x20c10b[_0x4b3e('0x23')](_0x4ea545)[_0x4b3e('0x24')]();};}function respondWithResult(_0x229a4d,_0x15f3fc){_0x15f3fc=_0x15f3fc||0xc8;return function(_0x18da70){if(_0x18da70){return _0x229a4d[_0x4b3e('0x23')](_0x15f3fc)['json'](_0x18da70);}};}function respondWithFilteredResult(_0x1728ff,_0x1db86b){return function(_0x48a5d8){if(_0x48a5d8){var _0x362071=_0x48a5d8[_0x4b3e('0x25')],_0x2fa4fe=_0x1db86b[_0x4b3e('0x26')],_0x183be4=_0x1db86b[_0x4b3e('0x26')]+_0x1db86b[_0x4b3e('0x27')],_0x39d85d;if(_0x183be4>=_0x362071){_0x183be4=_0x362071;_0x39d85d=0xc8;}else{_0x39d85d=0xce;}_0x1728ff[_0x4b3e('0x23')](_0x39d85d);return _0x1728ff[_0x4b3e('0x28')]('Content-Range',_0x2fa4fe+'-'+_0x183be4+'/'+_0x362071)[_0x4b3e('0x29')](_0x48a5d8);}return null;};}function patchUpdates(_0x42de72){return function(_0x46643a){try{jsonpatch[_0x4b3e('0x2a')](_0x46643a,_0x42de72,!![]);}catch(_0x5caf9a){return BPromise['reject'](_0x5caf9a);}return _0x46643a[_0x4b3e('0x2b')]();};}function saveUpdates(_0x5b5111,_0x212e90){return function(_0x16016d){if(_0x16016d){return _0x16016d[_0x4b3e('0x2c')](_0x5b5111)['then'](function(_0x1a0d79){return _0x1a0d79;});}return null;};}function removeEntity(_0x2c6509,_0x333bc5){return function(_0x1b0369){if(_0x1b0369){return _0x1b0369[_0x4b3e('0x2d')]()[_0x4b3e('0x18')](function(){_0x2c6509['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b6eea,_0x546cb6){return function(_0x5d57ca){if(!_0x5d57ca){_0x3b6eea[_0x4b3e('0x2e')](0x194);}return _0x5d57ca;};}function handleError(_0x16db33,_0x13b3e2){_0x13b3e2=_0x13b3e2||0x1f4;return function(_0x1d3660){logger['error'](_0x1d3660[_0x4b3e('0x2f')]);if(_0x1d3660[_0x4b3e('0x30')]){delete _0x1d3660[_0x4b3e('0x30')];}_0x16db33[_0x4b3e('0x23')](_0x13b3e2)[_0x4b3e('0x31')](_0x1d3660);};}exports['index']=function(_0x352bf6,_0x2469e5){var _0x18102d={},_0xa7fe11={},_0x120517={'count':0x0,'rows':[]};var _0x4a3afa=db[_0x4b3e('0x32')]['rawAttributes'];_0xa7fe11[_0x4b3e('0x33')]=_['keys'](_0x4a3afa);var _0x292c8b={'dateStart':_0x352bf6[_0x4b3e('0x34')][_0x4b3e('0x35')],'dateEnd':_0x352bf6[_0x4b3e('0x34')][_0x4b3e('0x36')]};delete _0x352bf6[_0x4b3e('0x34')]['dateStart'];delete _0x352bf6['query'][_0x4b3e('0x36')];_0xa7fe11['query']=_[_0x4b3e('0x37')](_0x352bf6['query']);_0xa7fe11[_0x4b3e('0x38')]=_[_0x4b3e('0x39')](_0xa7fe11['model'],_0xa7fe11[_0x4b3e('0x34')]);_0x18102d[_0x4b3e('0x3a')]=_[_0x4b3e('0x39')](_0xa7fe11[_0x4b3e('0x33')],qs[_0x4b3e('0x3b')](_0x352bf6[_0x4b3e('0x34')]['fields']));_0x18102d[_0x4b3e('0x3a')]=_0x18102d[_0x4b3e('0x3a')][_0x4b3e('0x3c')]?_0x18102d[_0x4b3e('0x3a')]:_0xa7fe11[_0x4b3e('0x33')];if(!_0x352bf6['query'][_0x4b3e('0x3d')](_0x4b3e('0x3e'))){_0x18102d['limit']=qs[_0x4b3e('0x27')](_0x352bf6[_0x4b3e('0x34')][_0x4b3e('0x27')]);_0x18102d['offset']=qs[_0x4b3e('0x26')](_0x352bf6['query'][_0x4b3e('0x26')]);}_0x18102d[_0x4b3e('0x3f')]=qs[_0x4b3e('0x40')](_0x352bf6[_0x4b3e('0x34')]['sort']);_0x18102d[_0x4b3e('0x41')]=qs[_0x4b3e('0x38')](_[_0x4b3e('0x42')](_0x352bf6[_0x4b3e('0x34')],_0xa7fe11[_0x4b3e('0x38')]));if(_0x292c8b['dateStart']){if(_0x292c8b[_0x4b3e('0x36')]){_0x292c8b['dateEnd']=moment(_0x292c8b[_0x4b3e('0x36')])[_0x4b3e('0x43')](0x1,_0x4b3e('0x44'));}else{_0x292c8b[_0x4b3e('0x36')]=moment(_0x292c8b[_0x4b3e('0x35')])['add'](0x1,_0x4b3e('0x44'));}_[_0x4b3e('0x45')](_0x18102d[_0x4b3e('0x41')],{'createdAt':{'$gte':_0x292c8b[_0x4b3e('0x35')],'$lte':_0x292c8b['dateEnd']}});}if(_0x352bf6['query']['filter']){_0x18102d[_0x4b3e('0x41')]=_[_0x4b3e('0x45')](_0x18102d[_0x4b3e('0x41')],{'$or':_[_0x4b3e('0x46')](_0x18102d['attributes'],function(_0x3026e8){var _0x4146cd={};_0x4146cd[_0x3026e8]={'$like':'%'+_0x352bf6[_0x4b3e('0x34')][_0x4b3e('0x47')]+'%'};return _0x4146cd;})});}_0x18102d=_[_0x4b3e('0x45')]({},_0x18102d,_0x352bf6[_0x4b3e('0x48')]);var _0x5937d4={'where':_0x18102d[_0x4b3e('0x41')]};return db[_0x4b3e('0x32')]['count'](_0x5937d4)['then'](function(_0x244a07){_0x120517[_0x4b3e('0x25')]=_0x244a07;if(_0x352bf6[_0x4b3e('0x34')][_0x4b3e('0x49')]){_0x18102d['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x4b3e('0x4a')](_0x18102d);})['then'](function(_0x34b9e7){_0x120517[_0x4b3e('0x4b')]=_0x34b9e7;return _0x120517;})['then'](respondWithFilteredResult(_0x2469e5,_0x18102d))[_0x4b3e('0x22')](handleError(_0x2469e5,null));};exports[_0x4b3e('0x4c')]=function(_0x1c9e29,_0x69cbb8){var _0x44ba1b={'raw':![],'where':{'id':_0x1c9e29['params']['id']}},_0x21cfb3={};_0x21cfb3[_0x4b3e('0x33')]=_[_0x4b3e('0x37')](db[_0x4b3e('0x32')][_0x4b3e('0x4d')]);_0x21cfb3[_0x4b3e('0x34')]=_[_0x4b3e('0x37')](_0x1c9e29[_0x4b3e('0x34')]);_0x21cfb3[_0x4b3e('0x38')]=_[_0x4b3e('0x39')](_0x21cfb3[_0x4b3e('0x33')],_0x21cfb3[_0x4b3e('0x34')]);_0x44ba1b[_0x4b3e('0x3a')]=_[_0x4b3e('0x39')](_0x21cfb3['model'],qs[_0x4b3e('0x3b')](_0x1c9e29[_0x4b3e('0x34')][_0x4b3e('0x3b')]));_0x44ba1b[_0x4b3e('0x3a')]=_0x44ba1b[_0x4b3e('0x3a')][_0x4b3e('0x3c')]?_0x44ba1b[_0x4b3e('0x3a')]:_0x21cfb3['model'];if(_0x1c9e29[_0x4b3e('0x34')][_0x4b3e('0x49')]){_0x44ba1b[_0x4b3e('0x4e')]=[{'all':!![]}];}_0x44ba1b=_['merge']({},_0x44ba1b,_0x1c9e29[_0x4b3e('0x48')]);return db[_0x4b3e('0x32')]['find'](_0x44ba1b)['then'](handleEntityNotFound(_0x69cbb8,null))[_0x4b3e('0x18')](respondWithResult(_0x69cbb8,null))[_0x4b3e('0x22')](handleError(_0x69cbb8,null));};exports['create']=function(_0x206ed0,_0x4991d5){return db['FreshdeskConfiguration'][_0x4b3e('0x4f')](_0x206ed0[_0x4b3e('0x50')],{})[_0x4b3e('0x18')](respondWithResult(_0x4991d5,0xc9))['catch'](handleError(_0x4991d5,null));};exports[_0x4b3e('0x2c')]=function(_0x342b00,_0x71309b){if(_0x342b00[_0x4b3e('0x50')]['id']){delete _0x342b00[_0x4b3e('0x50')]['id'];}return db[_0x4b3e('0x32')][_0x4b3e('0x51')]({'where':{'id':_0x342b00[_0x4b3e('0x52')]['id']}})[_0x4b3e('0x18')](handleEntityNotFound(_0x71309b,null))[_0x4b3e('0x18')](saveUpdates(_0x342b00['body'],null))[_0x4b3e('0x18')](respondWithResult(_0x71309b,null))[_0x4b3e('0x22')](handleError(_0x71309b,null));};exports[_0x4b3e('0x2d')]=function(_0x110ff9,_0x52b85c){return db[_0x4b3e('0x32')][_0x4b3e('0x51')]({'where':{'id':_0x110ff9[_0x4b3e('0x52')]['id']}})[_0x4b3e('0x18')](handleEntityNotFound(_0x52b85c,null))[_0x4b3e('0x18')](removeEntity(_0x52b85c,null))[_0x4b3e('0x22')](handleError(_0x52b85c,null));};exports[_0x4b3e('0x53')]=function(_0x2ce79c,_0x4edf50,_0x1f1535){var _0x17d7a6={};var _0x45f1a9={};var _0x21a9c9;var _0x274e95;return db[_0x4b3e('0x32')][_0x4b3e('0x54')]({'where':{'id':_0x2ce79c[_0x4b3e('0x52')]['id']}})[_0x4b3e('0x18')](handleEntityNotFound(_0x4edf50,null))[_0x4b3e('0x18')](function(_0x343513){if(_0x343513){_0x21a9c9=_0x343513;_0x45f1a9[_0x4b3e('0x33')]=_['keys'](db[_0x4b3e('0x55')][_0x4b3e('0x4d')]);_0x45f1a9[_0x4b3e('0x34')]=_[_0x4b3e('0x37')](_0x2ce79c['query']);_0x45f1a9[_0x4b3e('0x38')]=_[_0x4b3e('0x39')](_0x45f1a9['model'],_0x45f1a9['query']);_0x17d7a6[_0x4b3e('0x3a')]=_[_0x4b3e('0x39')](_0x45f1a9[_0x4b3e('0x33')],qs[_0x4b3e('0x3b')](_0x2ce79c[_0x4b3e('0x34')][_0x4b3e('0x3b')]));_0x17d7a6[_0x4b3e('0x3a')]=_0x17d7a6[_0x4b3e('0x3a')][_0x4b3e('0x3c')]?_0x17d7a6['attributes']:_0x45f1a9[_0x4b3e('0x33')];_0x17d7a6[_0x4b3e('0x3f')]=qs[_0x4b3e('0x40')](_0x2ce79c[_0x4b3e('0x34')][_0x4b3e('0x40')]);_0x17d7a6[_0x4b3e('0x41')]=qs[_0x4b3e('0x38')](_[_0x4b3e('0x42')](_0x2ce79c[_0x4b3e('0x34')],_0x45f1a9[_0x4b3e('0x38')]));if(_0x2ce79c['query'][_0x4b3e('0x47')]){_0x17d7a6[_0x4b3e('0x41')]=_[_0x4b3e('0x45')](_0x17d7a6[_0x4b3e('0x41')],{'$or':_['map'](_0x17d7a6[_0x4b3e('0x3a')],function(_0x2d6599){var _0x433449={};_0x433449[_0x2d6599]={'$like':'%'+_0x2ce79c[_0x4b3e('0x34')][_0x4b3e('0x47')]+'%'};return _0x433449;})});}_0x17d7a6=_[_0x4b3e('0x45')]({},_0x17d7a6,_0x2ce79c[_0x4b3e('0x48')]);return _0x21a9c9[_0x4b3e('0x53')](_0x17d7a6);}})[_0x4b3e('0x18')](function(_0x3968b3){if(_0x3968b3){_0x274e95=_0x3968b3[_0x4b3e('0x3c')];if(!_0x2ce79c['query'][_0x4b3e('0x3d')](_0x4b3e('0x3e'))){_0x17d7a6[_0x4b3e('0x27')]=qs['limit'](_0x2ce79c[_0x4b3e('0x34')][_0x4b3e('0x27')]);_0x17d7a6['offset']=qs[_0x4b3e('0x26')](_0x2ce79c[_0x4b3e('0x34')]['offset']);}return _0x21a9c9[_0x4b3e('0x53')](_0x17d7a6);}})[_0x4b3e('0x18')](function(_0xdae7){if(_0xdae7){return _0xdae7?{'count':_0x274e95,'rows':_0xdae7}:null;}})['then'](respondWithResult(_0x4edf50,null))[_0x4b3e('0x22')](handleError(_0x4edf50,null));};exports[_0x4b3e('0x56')]=function(_0x33feaf,_0x83ebf9,_0x5816f3){var _0x388ffa={};var _0x3c30bd={};var _0x5beaeb;var _0x378354;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x33feaf[_0x4b3e('0x52')]['id']}})[_0x4b3e('0x18')](handleEntityNotFound(_0x83ebf9,null))[_0x4b3e('0x18')](function(_0x2f3358){if(_0x2f3358){_0x5beaeb=_0x2f3358;_0x3c30bd[_0x4b3e('0x33')]=_[_0x4b3e('0x37')](db[_0x4b3e('0x55')][_0x4b3e('0x4d')]);_0x3c30bd[_0x4b3e('0x34')]=_['keys'](_0x33feaf[_0x4b3e('0x34')]);_0x3c30bd[_0x4b3e('0x38')]=_[_0x4b3e('0x39')](_0x3c30bd['model'],_0x3c30bd[_0x4b3e('0x34')]);_0x388ffa[_0x4b3e('0x3a')]=_[_0x4b3e('0x39')](_0x3c30bd[_0x4b3e('0x33')],qs[_0x4b3e('0x3b')](_0x33feaf['query'][_0x4b3e('0x3b')]));_0x388ffa[_0x4b3e('0x3a')]=_0x388ffa[_0x4b3e('0x3a')][_0x4b3e('0x3c')]?_0x388ffa['attributes']:_0x3c30bd[_0x4b3e('0x33')];_0x388ffa[_0x4b3e('0x3f')]=qs[_0x4b3e('0x40')](_0x33feaf[_0x4b3e('0x34')][_0x4b3e('0x40')]);_0x388ffa[_0x4b3e('0x41')]=qs[_0x4b3e('0x38')](_[_0x4b3e('0x42')](_0x33feaf[_0x4b3e('0x34')],_0x3c30bd[_0x4b3e('0x38')]));if(_0x33feaf[_0x4b3e('0x34')][_0x4b3e('0x47')]){_0x388ffa[_0x4b3e('0x41')]=_['merge'](_0x388ffa['where'],{'$or':_[_0x4b3e('0x46')](_0x388ffa[_0x4b3e('0x3a')],function(_0x2e624c){var _0x29bd44={};_0x29bd44[_0x2e624c]={'$like':'%'+_0x33feaf[_0x4b3e('0x34')][_0x4b3e('0x47')]+'%'};return _0x29bd44;})});}_0x388ffa=_[_0x4b3e('0x45')]({},_0x388ffa,_0x33feaf['options']);return _0x5beaeb[_0x4b3e('0x56')](_0x388ffa);}})[_0x4b3e('0x18')](function(_0x90302f){if(_0x90302f){_0x378354=_0x90302f['length'];if(!_0x33feaf['query'][_0x4b3e('0x3d')](_0x4b3e('0x3e'))){_0x388ffa[_0x4b3e('0x27')]=qs[_0x4b3e('0x27')](_0x33feaf[_0x4b3e('0x34')][_0x4b3e('0x27')]);_0x388ffa[_0x4b3e('0x26')]=qs[_0x4b3e('0x26')](_0x33feaf[_0x4b3e('0x34')]['offset']);}return _0x5beaeb[_0x4b3e('0x56')](_0x388ffa);}})['then'](function(_0x8c8cc5){if(_0x8c8cc5){return _0x8c8cc5?{'count':_0x378354,'rows':_0x8c8cc5}:null;}})[_0x4b3e('0x18')](respondWithResult(_0x83ebf9,null))[_0x4b3e('0x22')](handleError(_0x83ebf9,null));};exports[_0x4b3e('0x57')]=function(_0x609da,_0x3f6650,_0x329696){var _0x55c49c={};var _0x2f3159={};var _0x55d4a0;var _0x28e2a3;return db[_0x4b3e('0x32')][_0x4b3e('0x54')]({'where':{'id':_0x609da[_0x4b3e('0x52')]['id']}})[_0x4b3e('0x18')](handleEntityNotFound(_0x3f6650,null))[_0x4b3e('0x18')](function(_0x2bba5f){if(_0x2bba5f){_0x55d4a0=_0x2bba5f;_0x2f3159[_0x4b3e('0x33')]=_['keys'](db[_0x4b3e('0x55')]['rawAttributes']);_0x2f3159[_0x4b3e('0x34')]=_[_0x4b3e('0x37')](_0x609da[_0x4b3e('0x34')]);_0x2f3159[_0x4b3e('0x38')]=_[_0x4b3e('0x39')](_0x2f3159[_0x4b3e('0x33')],_0x2f3159[_0x4b3e('0x34')]);_0x55c49c[_0x4b3e('0x3a')]=_[_0x4b3e('0x39')](_0x2f3159[_0x4b3e('0x33')],qs[_0x4b3e('0x3b')](_0x609da[_0x4b3e('0x34')][_0x4b3e('0x3b')]));_0x55c49c[_0x4b3e('0x3a')]=_0x55c49c['attributes']['length']?_0x55c49c['attributes']:_0x2f3159[_0x4b3e('0x33')];_0x55c49c['order']=qs[_0x4b3e('0x40')](_0x609da[_0x4b3e('0x34')][_0x4b3e('0x40')]);_0x55c49c[_0x4b3e('0x41')]=qs[_0x4b3e('0x38')](_[_0x4b3e('0x42')](_0x609da[_0x4b3e('0x34')],_0x2f3159[_0x4b3e('0x38')]));if(_0x609da[_0x4b3e('0x34')][_0x4b3e('0x47')]){_0x55c49c['where']=_[_0x4b3e('0x45')](_0x55c49c[_0x4b3e('0x41')],{'$or':_[_0x4b3e('0x46')](_0x55c49c[_0x4b3e('0x3a')],function(_0x11c20d){var _0x2f80a0={};_0x2f80a0[_0x11c20d]={'$like':'%'+_0x609da[_0x4b3e('0x34')][_0x4b3e('0x47')]+'%'};return _0x2f80a0;})});}_0x55c49c=_[_0x4b3e('0x45')]({},_0x55c49c,_0x609da[_0x4b3e('0x48')]);return _0x55d4a0[_0x4b3e('0x57')](_0x55c49c);}})[_0x4b3e('0x18')](function(_0x48d730){if(_0x48d730){_0x28e2a3=_0x48d730[_0x4b3e('0x3c')];if(!_0x609da[_0x4b3e('0x34')][_0x4b3e('0x3d')](_0x4b3e('0x3e'))){_0x55c49c[_0x4b3e('0x27')]=qs[_0x4b3e('0x27')](_0x609da[_0x4b3e('0x34')]['limit']);_0x55c49c['offset']=qs['offset'](_0x609da[_0x4b3e('0x34')]['offset']);}return _0x55d4a0['getDescriptions'](_0x55c49c);}})[_0x4b3e('0x18')](function(_0x51d119){if(_0x51d119){return _0x51d119?{'count':_0x28e2a3,'rows':_0x51d119}:null;}})[_0x4b3e('0x18')](respondWithResult(_0x3f6650,null))[_0x4b3e('0x22')](handleError(_0x3f6650,null));};exports['getTags']=function(_0x455383,_0x1a473f,_0x5d0863){var _0x92e954={};var _0x12b0f0={};var _0x31ba62;var _0x56a18d;return db['FreshdeskConfiguration'][_0x4b3e('0x54')]({'where':{'id':_0x455383[_0x4b3e('0x52')]['id']}})[_0x4b3e('0x18')](handleEntityNotFound(_0x1a473f,null))[_0x4b3e('0x18')](function(_0x5e6dac){if(_0x5e6dac){_0x31ba62=_0x5e6dac;_0x12b0f0['model']=_['keys'](db[_0x4b3e('0x58')][_0x4b3e('0x4d')]);_0x12b0f0['query']=_[_0x4b3e('0x37')](_0x455383[_0x4b3e('0x34')]);_0x12b0f0[_0x4b3e('0x38')]=_['intersection'](_0x12b0f0[_0x4b3e('0x33')],_0x12b0f0[_0x4b3e('0x34')]);_0x92e954[_0x4b3e('0x3a')]=_['intersection'](_0x12b0f0['model'],qs[_0x4b3e('0x3b')](_0x455383[_0x4b3e('0x34')]['fields']));_0x92e954[_0x4b3e('0x3a')]=_0x92e954[_0x4b3e('0x3a')][_0x4b3e('0x3c')]?_0x92e954[_0x4b3e('0x3a')]:_0x12b0f0[_0x4b3e('0x33')];_0x92e954[_0x4b3e('0x3f')]=qs[_0x4b3e('0x40')](_0x455383[_0x4b3e('0x34')]['sort']);_0x92e954[_0x4b3e('0x41')]=qs['filters'](_[_0x4b3e('0x42')](_0x455383[_0x4b3e('0x34')],_0x12b0f0[_0x4b3e('0x38')]));if(_0x455383[_0x4b3e('0x34')][_0x4b3e('0x47')]){_0x92e954['where']=_['merge'](_0x92e954[_0x4b3e('0x41')],{'$or':_[_0x4b3e('0x46')](_0x92e954[_0x4b3e('0x3a')],function(_0x56b516){var _0x3a5a36={};_0x3a5a36[_0x56b516]={'$like':'%'+_0x455383[_0x4b3e('0x34')][_0x4b3e('0x47')]+'%'};return _0x3a5a36;})});}_0x92e954=_['merge']({},_0x92e954,_0x455383[_0x4b3e('0x48')]);return _0x31ba62[_0x4b3e('0x59')](_0x92e954);}})[_0x4b3e('0x18')](function(_0x58bede){if(_0x58bede){_0x56a18d=_0x58bede[_0x4b3e('0x3c')];if(!_0x455383[_0x4b3e('0x34')][_0x4b3e('0x3d')](_0x4b3e('0x3e'))){_0x92e954[_0x4b3e('0x27')]=qs[_0x4b3e('0x27')](_0x455383[_0x4b3e('0x34')][_0x4b3e('0x27')]);_0x92e954[_0x4b3e('0x26')]=qs[_0x4b3e('0x26')](_0x455383[_0x4b3e('0x34')][_0x4b3e('0x26')]);}return _0x31ba62['getTags'](_0x92e954);}})[_0x4b3e('0x18')](function(_0x46110a){if(_0x46110a){return _0x46110a?{'count':_0x56a18d,'rows':_0x46110a}:null;}})['then'](respondWithResult(_0x1a473f,null))['catch'](handleError(_0x1a473f,null));};exports['setTags']=function(_0xa7b126,_0x5f110e,_0x1aa0a1){if(_0xa7b126[_0x4b3e('0x50')]['id']){delete _0xa7b126['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xa7b126[_0x4b3e('0x52')]['id']}})[_0x4b3e('0x18')](handleEntityNotFound(_0x5f110e,null))[_0x4b3e('0x18')](function(_0x2d34e3){if(_0x2d34e3){return _0x2d34e3[_0x4b3e('0x5a')](_0xa7b126[_0x4b3e('0x50')][_0x4b3e('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x5f110e,null))[_0x4b3e('0x22')](handleError(_0x5f110e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3e16c76..a40de06 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 _0x294b=['./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x35dedc,_0xcd39b8){var _0x3a58ee=function(_0x30e9ef){while(--_0x30e9ef){_0x35dedc['push'](_0x35dedc['shift']());}};_0x3a58ee(++_0xcd39b8);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var util=require('util');var logger=require(_0xb294('0x1'))(_0xb294('0x2'));var moment=require(_0xb294('0x3'));var BPromise=require(_0xb294('0x4'));var rp=require(_0xb294('0x5'));var attributes=require(_0xb294('0x6'));module['exports']=function(_0x5c0237,_0xba5c68){return _0x5c0237[_0xb294('0x7')](_0xb294('0x8'),attributes,{'tableName':_0xb294('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc716=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x205a5c,_0x54a331){var _0x2433f2=function(_0x4d19db){while(--_0x4d19db){_0x205a5c['push'](_0x205a5c['shift']());}};_0x2433f2(++_0x54a331);}(_0xc716,0x16c));var _0x6c71=function(_0x5eb770,_0x502fd6){_0x5eb770=_0x5eb770-0x0;var _0x267a7d=_0xc716[_0x5eb770];return _0x267a7d;};'use strict';var _=require(_0x6c71('0x0'));var util=require('util');var logger=require(_0x6c71('0x1'))(_0x6c71('0x2'));var moment=require(_0x6c71('0x3'));var BPromise=require(_0x6c71('0x4'));var rp=require(_0x6c71('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x6c71('0x6')]=function(_0x58da58,_0x1a1ca1){return _0x58da58[_0x6c71('0x7')](_0x6c71('0x8'),attributes,{'tableName':_0x6c71('0x9'),'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 0a04563..891e56c 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 _0x6e15=['../../config/logger','rpc','../../config/environment','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','info','lodash','util','bluebird','../../mysqldb'];(function(_0x46905d,_0x3293d5){var _0xf0a065=function(_0x4dacb7){while(--_0x4dacb7){_0x46905d['push'](_0x46905d['shift']());}};_0xf0a065(++_0x3293d5);}(_0x6e15,0x164));var _0x56e1=function(_0x3aa93a,_0x1ea286){_0x3aa93a=_0x3aa93a-0x0;var _0x63af60=_0x6e15[_0x3aa93a];return _0x63af60;};'use strict';var _=require(_0x56e1('0x0'));var util=require(_0x56e1('0x1'));var moment=require('moment');var BPromise=require(_0x56e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56e1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x56e1('0x4'))(_0x56e1('0x5'));var config=require(_0x56e1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x56e1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e14aa,_0x57146c,_0x101de9){return new BPromise(function(_0x4a4478,_0x4495ac){return client[_0x56e1('0x8')](_0x4e14aa,_0x101de9)[_0x56e1('0x9')](function(_0x542e57){logger['info'](_0x56e1('0xa'),_0x57146c,_0x56e1('0xb'));logger[_0x56e1('0xc')](_0x56e1('0xd'),_0x57146c,'request\x20sent',JSON['stringify'](_0x542e57));if(_0x542e57['error']){if(_0x542e57['error'][_0x56e1('0xe')]===0x1f4){logger[_0x56e1('0xf')](_0x56e1('0xa'),_0x57146c,_0x542e57[_0x56e1('0xf')]['message']);return _0x4495ac(_0x542e57[_0x56e1('0xf')]['message']);}logger[_0x56e1('0xf')](_0x56e1('0xa'),_0x57146c,_0x542e57['error'][_0x56e1('0x10')]);return _0x4a4478(_0x542e57['error'][_0x56e1('0x10')]);}else{logger[_0x56e1('0x11')](_0x56e1('0xa'),_0x57146c,_0x56e1('0xb'));_0x4a4478(_0x542e57['result'][_0x56e1('0x10')]);}})['catch'](function(_0x3287d9){logger['error'](_0x56e1('0xa'),_0x57146c,_0x3287d9);_0x4495ac(_0x3287d9);});});} \ No newline at end of file +var _0xccf6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x1f270b,_0x557444){var _0x3da136=function(_0x6da69c){while(--_0x6da69c){_0x1f270b['push'](_0x1f270b['shift']());}};_0x3da136(++_0x557444);}(_0xccf6,0x185));var _0x6ccf=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xccf6[_0x585d81];return _0x1aca0d;};'use strict';var _=require(_0x6ccf('0x0'));var util=require(_0x6ccf('0x1'));var moment=require(_0x6ccf('0x2'));var BPromise=require(_0x6ccf('0x3'));var rs=require(_0x6ccf('0x4'));var fs=require('fs');var Redis=require(_0x6ccf('0x5'));var db=require(_0x6ccf('0x6'))['db'];var utils=require(_0x6ccf('0x7'));var logger=require('../../config/logger')(_0x6ccf('0x8'));var config=require(_0x6ccf('0x9'));var jayson=require(_0x6ccf('0xa'));var client=jayson['client'][_0x6ccf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e8998,_0x6b8780,_0x243e95){return new BPromise(function(_0xf7aab4,_0x2ca5ab){return client[_0x6ccf('0xc')](_0x3e8998,_0x243e95)[_0x6ccf('0xd')](function(_0x244286){logger[_0x6ccf('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x6b8780,_0x6ccf('0xf'));logger[_0x6ccf('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x6b8780,_0x6ccf('0xf'),JSON[_0x6ccf('0x11')](_0x244286));if(_0x244286[_0x6ccf('0x12')]){if(_0x244286['error'][_0x6ccf('0x13')]===0x1f4){logger[_0x6ccf('0x12')](_0x6ccf('0x14'),_0x6b8780,_0x244286['error'][_0x6ccf('0x15')]);return _0x2ca5ab(_0x244286[_0x6ccf('0x12')][_0x6ccf('0x15')]);}logger[_0x6ccf('0x12')](_0x6ccf('0x14'),_0x6b8780,_0x244286['error']['message']);return _0xf7aab4(_0x244286[_0x6ccf('0x12')]['message']);}else{logger['info'](_0x6ccf('0x14'),_0x6b8780,_0x6ccf('0xf'));_0xf7aab4(_0x244286['result'][_0x6ccf('0x15')]);}})[_0x6ccf('0x16')](function(_0x17c107){logger[_0x6ccf('0x12')](_0x6ccf('0x14'),_0x6b8780,_0x17c107);_0x2ca5ab(_0x17c107);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index a1aeeae..f9de9c8 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 _0x18cb=['express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','multer','util','path','connect-timeout'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x18cb,0xe6));var _0xb18c=function(_0x1f2703,_0x2190c2){_0x1f2703=_0x1f2703-0x0;var _0xb9ac9d=_0x18cb[_0x1f2703];return _0xb9ac9d;};'use strict';var multer=require(_0xb18c('0x0'));var util=require(_0xb18c('0x1'));var path=require(_0xb18c('0x2'));var timeout=require(_0xb18c('0x3'));var express=require(_0xb18c('0x4'));var router=express[_0xb18c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb18c('0x6'));var config=require(_0xb18c('0x7'));var controller=require(_0xb18c('0x8'));router[_0xb18c('0x9')]('/',auth['isAuthenticated'](),controller[_0xb18c('0xa')]);router[_0xb18c('0x9')](_0xb18c('0xb'),auth[_0xb18c('0xc')](),controller[_0xb18c('0xd')]);router[_0xb18c('0xe')]('/',auth[_0xb18c('0xc')](),controller[_0xb18c('0xf')]);router[_0xb18c('0x10')]('/:id',auth[_0xb18c('0xc')](),controller[_0xb18c('0x11')]);router['delete'](_0xb18c('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x682f=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','multer','util','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x682f,0x1eb));var _0xf682=function(_0x34b8d1,_0x5dc7e1){_0x34b8d1=_0x34b8d1-0x0;var _0x19a3c2=_0x682f[_0x34b8d1];return _0x19a3c2;};'use strict';var multer=require(_0xf682('0x0'));var util=require(_0xf682('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf682('0x2'));var router=express[_0xf682('0x3')]();var auth=require(_0xf682('0x4'));var interaction=require(_0xf682('0x5'));var config=require(_0xf682('0x6'));var controller=require(_0xf682('0x7'));router[_0xf682('0x8')]('/',auth[_0xf682('0x9')](),controller[_0xf682('0xa')]);router['get'](_0xf682('0xb'),auth[_0xf682('0x9')](),controller[_0xf682('0xc')]);router[_0xf682('0xd')]('/',auth[_0xf682('0x9')](),controller[_0xf682('0xe')]);router['put'](_0xf682('0xb'),auth[_0xf682('0x9')](),controller['update']);router[_0xf682('0xf')](_0xf682('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a00bbce..019ce9a 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 _0x9354=['variable','customVariable','keyValue','string','STRING','BOOLEAN','exports','ENUM'];(function(_0x18d16f,_0x4f84c9){var _0x2bc5b8=function(_0x53e284){while(--_0x53e284){_0x18d16f['push'](_0x18d16f['shift']());}};_0x2bc5b8(++_0x4f84c9);}(_0x9354,0x96));var _0x4935=function(_0x7c9fba,_0x10b015){_0x7c9fba=_0x7c9fba-0x0;var _0x5cceed=_0x9354[_0x7c9fba];return _0x5cceed;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'type':{'type':Sequelize[_0x4935('0x1')]('string',_0x4935('0x2'),_0x4935('0x3'),_0x4935('0x4')),'defaultValue':_0x4935('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4935('0x6')]},'keyType':{'type':Sequelize[_0x4935('0x1')](_0x4935('0x5'),_0x4935('0x2'),_0x4935('0x3'))},'keyContent':{'type':Sequelize[_0x4935('0x6')]},'idField':{'type':Sequelize[_0x4935('0x6')]},'nameField':{'type':Sequelize[_0x4935('0x6')]},'customField':{'type':Sequelize[_0x4935('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcb91=['string','variable','customVariable','STRING','BOOLEAN','ENUM'];(function(_0xf1b8c4,_0x4be71c){var _0x31d43e=function(_0x3cfb11){while(--_0x3cfb11){_0xf1b8c4['push'](_0xf1b8c4['shift']());}};_0x31d43e(++_0x4be71c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0xcb91[_0x1c5950];return _0x2b720a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),_0x1cb9('0x2'),_0x1cb9('0x3'),'keyValue'),'defaultValue':_0x1cb9('0x1')},'content':{'type':Sequelize[_0x1cb9('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),'variable',_0x1cb9('0x3'))},'keyContent':{'type':Sequelize[_0x1cb9('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1cb9('0x4')]},'customField':{'type':Sequelize[_0x1cb9('0x5')],'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 7b71f20..372fed9 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 _0xf3cd=['then','destroy','sendStatus','error','stack','name','send','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','add','day','merge','filter','options','FreshdeskField','include','findAll','catch','show','params','includeAll','create','body','find','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'];(function(_0xb1b6d5,_0x1239bd){var _0x57f289=function(_0x279f0d){while(--_0x279f0d){_0xb1b6d5['push'](_0xb1b6d5['shift']());}};_0x57f289(++_0x1239bd);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4dcecc,_0x3865b9){_0x4dcecc=_0x4dcecc-0x0;var _0x2aa658=_0xf3cd[_0x4dcecc];return _0x2aa658;};'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['FreshdeskField'][_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['FreshdeskField']['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['FreshdeskField'][_0xdf3c('0x47')]({'where':{'id':_0x3b17d9[_0xdf3c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c1a24,null))[_0xdf3c('0x22')](removeEntity(_0x4c1a24,null))[_0xdf3c('0x41')](handleError(_0x4c1a24,null));}; \ No newline at end of file +var _0x9bde=['where','pick','day','merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','FreshdeskField','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4595c8,_0x126b6b){var _0x32829d=function(_0x2bff37){while(--_0x2bff37){_0x4595c8['push'](_0x4595c8['shift']());}};_0x32829d(++_0x126b6b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x27e6e3,_0x31f795){_0x27e6e3=_0x27e6e3-0x0;var _0x406c95=_0x9bde[_0x27e6e3];return _0x406c95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe9bd('0x13'));var utils=require(_0xe9bd('0x14'));var config=require(_0xe9bd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12c96e,_0x9eca50){_0x9eca50=_0x9eca50||0xcc;return function(_0x3339f9){if(_0x3339f9){return _0x12c96e[_0xe9bd('0x16')](_0x9eca50);}return _0x12c96e['status'](_0x9eca50)[_0xe9bd('0x17')]();};}function respondWithResult(_0x4ac319,_0x220d07){_0x220d07=_0x220d07||0xc8;return function(_0x429e88){if(_0x429e88){return _0x4ac319[_0xe9bd('0x18')](_0x220d07)['json'](_0x429e88);}};}function respondWithFilteredResult(_0x47ba5e,_0x46a95e){return function(_0x248818){if(_0x248818){var _0x3a9e5f=_0x248818[_0xe9bd('0x19')],_0x46a59b=_0x46a95e['offset'],_0x3360bd=_0x46a95e[_0xe9bd('0x1a')]+_0x46a95e[_0xe9bd('0x1b')],_0x389e7b;if(_0x3360bd>=_0x3a9e5f){_0x3360bd=_0x3a9e5f;_0x389e7b=0xc8;}else{_0x389e7b=0xce;}_0x47ba5e[_0xe9bd('0x18')](_0x389e7b);return _0x47ba5e['set'](_0xe9bd('0x1c'),_0x46a59b+'-'+_0x3360bd+'/'+_0x3a9e5f)[_0xe9bd('0x1d')](_0x248818);}return null;};}function patchUpdates(_0x34ba2b){return function(_0x330733){try{jsonpatch['apply'](_0x330733,_0x34ba2b,!![]);}catch(_0x20ec32){return BPromise['reject'](_0x20ec32);}return _0x330733[_0xe9bd('0x1e')]();};}function saveUpdates(_0x55b869,_0x26aa4a){return function(_0x417113){if(_0x417113){return _0x417113[_0xe9bd('0x1f')](_0x55b869)[_0xe9bd('0x20')](function(_0x1acb82){return _0x1acb82;});}return null;};}function removeEntity(_0x34ffed,_0x6593ce){return function(_0x49165b){if(_0x49165b){return _0x49165b[_0xe9bd('0x21')]()[_0xe9bd('0x20')](function(){_0x34ffed['status'](0xcc)[_0xe9bd('0x17')]();});}};}function handleEntityNotFound(_0x505c23,_0x238ab1){return function(_0x1b9cc9){if(!_0x1b9cc9){_0x505c23[_0xe9bd('0x16')](0x194);}return _0x1b9cc9;};}function handleError(_0xf02209,_0x5bc4bf){_0x5bc4bf=_0x5bc4bf||0x1f4;return function(_0x24cf25){logger[_0xe9bd('0x22')](_0x24cf25[_0xe9bd('0x23')]);if(_0x24cf25[_0xe9bd('0x24')]){delete _0x24cf25[_0xe9bd('0x24')];}_0xf02209[_0xe9bd('0x18')](_0x5bc4bf)[_0xe9bd('0x25')](_0x24cf25);};}exports[_0xe9bd('0x26')]=function(_0x1ae889,_0x5987af){var _0x3c211a={},_0x38fdfa={},_0x5ba1d6={'count':0x0,'rows':[]};var _0x3b13b7=db[_0xe9bd('0x27')][_0xe9bd('0x28')];_0x38fdfa[_0xe9bd('0x29')]=_[_0xe9bd('0x2a')](_0x3b13b7);var _0x183601={'dateStart':_0x1ae889['query']['dateStart'],'dateEnd':_0x1ae889[_0xe9bd('0x2b')]['dateEnd']};delete _0x1ae889[_0xe9bd('0x2b')][_0xe9bd('0x2c')];delete _0x1ae889[_0xe9bd('0x2b')][_0xe9bd('0x2d')];_0x38fdfa[_0xe9bd('0x2b')]=_['keys'](_0x1ae889['query']);_0x38fdfa[_0xe9bd('0x2e')]=_[_0xe9bd('0x2f')](_0x38fdfa[_0xe9bd('0x29')],_0x38fdfa[_0xe9bd('0x2b')]);_0x3c211a[_0xe9bd('0x30')]=_[_0xe9bd('0x2f')](_0x38fdfa[_0xe9bd('0x29')],qs[_0xe9bd('0x31')](_0x1ae889[_0xe9bd('0x2b')]['fields']));_0x3c211a[_0xe9bd('0x30')]=_0x3c211a[_0xe9bd('0x30')][_0xe9bd('0x32')]?_0x3c211a['attributes']:_0x38fdfa['model'];if(!_0x1ae889[_0xe9bd('0x2b')][_0xe9bd('0x33')](_0xe9bd('0x34'))){_0x3c211a[_0xe9bd('0x1b')]=qs[_0xe9bd('0x1b')](_0x1ae889[_0xe9bd('0x2b')][_0xe9bd('0x1b')]);_0x3c211a[_0xe9bd('0x1a')]=qs[_0xe9bd('0x1a')](_0x1ae889[_0xe9bd('0x2b')][_0xe9bd('0x1a')]);}_0x3c211a[_0xe9bd('0x35')]=qs[_0xe9bd('0x36')](_0x1ae889[_0xe9bd('0x2b')][_0xe9bd('0x36')]);_0x3c211a[_0xe9bd('0x37')]=qs[_0xe9bd('0x2e')](_[_0xe9bd('0x38')](_0x1ae889['query'],_0x38fdfa[_0xe9bd('0x2e')]));if(_0x183601[_0xe9bd('0x2c')]){if(_0x183601['dateEnd']){_0x183601[_0xe9bd('0x2d')]=moment(_0x183601[_0xe9bd('0x2d')])['add'](0x1,'day');}else{_0x183601[_0xe9bd('0x2d')]=moment(_0x183601[_0xe9bd('0x2c')])['add'](0x1,_0xe9bd('0x39'));}_[_0xe9bd('0x3a')](_0x3c211a[_0xe9bd('0x37')],{'createdAt':{'$gte':_0x183601['dateStart'],'$lte':_0x183601[_0xe9bd('0x2d')]}});}if(_0x1ae889['query'][_0xe9bd('0x3b')]){_0x3c211a[_0xe9bd('0x37')]=_[_0xe9bd('0x3a')](_0x3c211a[_0xe9bd('0x37')],{'$or':_['map'](_0x3c211a[_0xe9bd('0x30')],function(_0x3f0f87){var _0x327e1a={};_0x327e1a[_0x3f0f87]={'$like':'%'+_0x1ae889[_0xe9bd('0x2b')][_0xe9bd('0x3b')]+'%'};return _0x327e1a;})});}_0x3c211a=_[_0xe9bd('0x3a')]({},_0x3c211a,_0x1ae889[_0xe9bd('0x3c')]);var _0xacfd19={'where':_0x3c211a[_0xe9bd('0x37')]};return db[_0xe9bd('0x27')]['count'](_0xacfd19)['then'](function(_0xcf9a0c){_0x5ba1d6['count']=_0xcf9a0c;if(_0x1ae889[_0xe9bd('0x2b')][_0xe9bd('0x3d')]){_0x3c211a[_0xe9bd('0x3e')]=[{'all':!![]}];}return db['FreshdeskField'][_0xe9bd('0x3f')](_0x3c211a);})[_0xe9bd('0x20')](function(_0x1a2d94){_0x5ba1d6['rows']=_0x1a2d94;return _0x5ba1d6;})[_0xe9bd('0x20')](respondWithFilteredResult(_0x5987af,_0x3c211a))[_0xe9bd('0x40')](handleError(_0x5987af,null));};exports[_0xe9bd('0x41')]=function(_0x388132,_0x1e1b87){var _0x40f87c={'raw':!![],'where':{'id':_0x388132[_0xe9bd('0x42')]['id']}},_0x221be7={};_0x221be7[_0xe9bd('0x29')]=_[_0xe9bd('0x2a')](db[_0xe9bd('0x27')][_0xe9bd('0x28')]);_0x221be7[_0xe9bd('0x2b')]=_[_0xe9bd('0x2a')](_0x388132[_0xe9bd('0x2b')]);_0x221be7['filters']=_['intersection'](_0x221be7[_0xe9bd('0x29')],_0x221be7[_0xe9bd('0x2b')]);_0x40f87c[_0xe9bd('0x30')]=_['intersection'](_0x221be7['model'],qs[_0xe9bd('0x31')](_0x388132[_0xe9bd('0x2b')][_0xe9bd('0x31')]));_0x40f87c[_0xe9bd('0x30')]=_0x40f87c[_0xe9bd('0x30')][_0xe9bd('0x32')]?_0x40f87c[_0xe9bd('0x30')]:_0x221be7['model'];if(_0x388132[_0xe9bd('0x2b')]['includeAll']){_0x40f87c[_0xe9bd('0x3e')]=[{'all':!![]}];}_0x40f87c=_[_0xe9bd('0x3a')]({},_0x40f87c,_0x388132[_0xe9bd('0x3c')]);return db[_0xe9bd('0x27')][_0xe9bd('0x43')](_0x40f87c)['then'](handleEntityNotFound(_0x1e1b87,null))[_0xe9bd('0x20')](respondWithResult(_0x1e1b87,null))[_0xe9bd('0x40')](handleError(_0x1e1b87,null));};exports[_0xe9bd('0x44')]=function(_0x58dc3b,_0xff4e14){return db[_0xe9bd('0x27')][_0xe9bd('0x44')](_0x58dc3b['body'],{})[_0xe9bd('0x20')](respondWithResult(_0xff4e14,0xc9))[_0xe9bd('0x40')](handleError(_0xff4e14,null));};exports[_0xe9bd('0x1f')]=function(_0x10ec29,_0x1ee09c){if(_0x10ec29['body']['id']){delete _0x10ec29[_0xe9bd('0x45')]['id'];}return db['FreshdeskField'][_0xe9bd('0x43')]({'where':{'id':_0x10ec29[_0xe9bd('0x42')]['id']}})[_0xe9bd('0x20')](handleEntityNotFound(_0x1ee09c,null))[_0xe9bd('0x20')](saveUpdates(_0x10ec29[_0xe9bd('0x45')],null))['then'](respondWithResult(_0x1ee09c,null))[_0xe9bd('0x40')](handleError(_0x1ee09c,null));};exports['destroy']=function(_0x14eed2,_0x222427){return db['FreshdeskField']['find']({'where':{'id':_0x14eed2[_0xe9bd('0x42')]['id']}})['then'](handleEntityNotFound(_0x222427,null))[_0xe9bd('0x20')](removeEntity(_0x222427,null))['catch'](handleError(_0x222427,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 9481208..bbc5e1b 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 _0x1a85=['moment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','../../config/logger','api'];(function(_0x42c598,_0x9771ce){var _0x3a84ae=function(_0x37b688){while(--_0x37b688){_0x42c598['push'](_0x42c598['shift']());}};_0x3a84ae(++_0x9771ce);}(_0x1a85,0x178));var _0x51a8=function(_0x5393a6,_0x3c972d){_0x5393a6=_0x5393a6-0x0;var _0x477463=_0x1a85[_0x5393a6];return _0x477463;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x51a8('0x3'));module[_0x51a8('0x4')]=function(_0x99e371,_0x48a21b){return _0x99e371[_0x51a8('0x5')]('FreshdeskField',attributes,{'tableName':_0x51a8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fdc=['bluebird','request-promise','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','lodash','util','../../config/logger','api','moment'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x5fdc,0x127));var _0xc5fd=function(_0x40b1e8,_0x434edc){_0x40b1e8=_0x40b1e8-0x0;var _0x555575=_0x5fdc[_0x40b1e8];return _0x555575;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var logger=require(_0xc5fd('0x2'))(_0xc5fd('0x3'));var moment=require(_0xc5fd('0x4'));var BPromise=require(_0xc5fd('0x5'));var rp=require(_0xc5fd('0x6'));var attributes=require(_0xc5fd('0x7'));module[_0xc5fd('0x8')]=function(_0x1b6205,_0xca27a0){return _0x1b6205[_0xc5fd('0x9')](_0xc5fd('0xa'),attributes,{'tableName':_0xc5fd('0xb'),'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 31c15ac..522bd68 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 _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x432f9f,_0x4c52fb){var _0xd6bd91=function(_0x1dab48){while(--_0x1dab48){_0x432f9f['push'](_0x432f9f['shift']());}};_0xd6bd91(++_0x4c52fb);}(_0xda55,0x6d));var _0x5da5=function(_0x22b6a3,_0x1c3f7b){_0x22b6a3=_0x22b6a3-0x0;var _0x2d4f3b=_0xda55[_0x22b6a3];return _0x2d4f3b;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file +var _0x37f8=['catch','util','moment','bluebird','randomstring','../../mysqldb','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0x37f8,0xd2));var _0x837f=function(_0x4fdda3,_0x3ddde4){_0x4fdda3=_0x4fdda3-0x0;var _0x41900a=_0x37f8[_0x4fdda3];return _0x41900a;};'use strict';var _=require('lodash');var util=require(_0x837f('0x0'));var moment=require(_0x837f('0x1'));var BPromise=require(_0x837f('0x2'));var rs=require(_0x837f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x837f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x837f('0x5')][_0x837f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x224ad2,_0x40270f,_0x4111cb){return new BPromise(function(_0x25bbcb,_0x12c732){return client[_0x837f('0x7')](_0x224ad2,_0x4111cb)[_0x837f('0x8')](function(_0x2f1dc7){logger[_0x837f('0x9')](_0x837f('0xa'),_0x40270f,_0x837f('0xb'));logger[_0x837f('0xc')](_0x837f('0xd'),_0x40270f,'request\x20sent',JSON[_0x837f('0xe')](_0x2f1dc7));if(_0x2f1dc7[_0x837f('0xf')]){if(_0x2f1dc7[_0x837f('0xf')][_0x837f('0x10')]===0x1f4){logger[_0x837f('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x40270f,_0x2f1dc7['error'][_0x837f('0x11')]);return _0x12c732(_0x2f1dc7[_0x837f('0xf')][_0x837f('0x11')]);}logger[_0x837f('0xf')](_0x837f('0xa'),_0x40270f,_0x2f1dc7['error'][_0x837f('0x11')]);return _0x25bbcb(_0x2f1dc7[_0x837f('0xf')][_0x837f('0x11')]);}else{logger[_0x837f('0x9')](_0x837f('0xa'),_0x40270f,_0x837f('0xb'));_0x25bbcb(_0x2f1dc7['result'][_0x837f('0x11')]);}})[_0x837f('0x12')](function(_0x47bbe7){logger[_0x837f('0xf')](_0x837f('0xa'),_0x40270f,_0x47bbe7);_0x12c732(_0x47bbe7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 10c7e14..219abef 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 _0x799a=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','post','create','update','multer'];(function(_0x1dad3b,_0x5698a5){var _0xef5582=function(_0x143ea1){while(--_0x143ea1){_0x1dad3b['push'](_0x1dad3b['shift']());}};_0xef5582(++_0x5698a5);}(_0x799a,0x187));var _0xa799=function(_0x3f38b1,_0x5b69d3){_0x3f38b1=_0x3f38b1-0x0;var _0x29ad80=_0x799a[_0x3f38b1];return _0x29ad80;};'use strict';var multer=require(_0xa799('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa799('0x1'));var express=require('express');var router=express[_0xa799('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xa799('0x3'));var config=require(_0xa799('0x4'));var controller=require(_0xa799('0x5'));router[_0xa799('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa799('0x6')](_0xa799('0x7'),auth[_0xa799('0x8')](),controller[_0xa799('0x9')]);router[_0xa799('0x6')](_0xa799('0xa'),auth[_0xa799('0x8')](),controller['getConfigurations']);router[_0xa799('0x6')]('/:id/fields',auth[_0xa799('0x8')](),controller['getFields']);router[_0xa799('0xb')]('/',auth['isAuthenticated'](),controller[_0xa799('0xc')]);router[_0xa799('0xb')]('/:id/configurations',auth[_0xa799('0x8')](),controller['addConfiguration']);router['put'](_0xa799('0x7'),auth[_0xa799('0x8')](),controller[_0xa799('0xd')]);router['delete'](_0xa799('0x7'),auth[_0xa799('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8942=['/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0x8942,0x163));var _0x2894=function(_0x3050bc,_0x50e082){_0x3050bc=_0x3050bc-0x0;var _0x52557c=_0x8942[_0x3050bc];return _0x52557c;};'use strict';var multer=require(_0x2894('0x0'));var util=require(_0x2894('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2894('0x2'));var router=express[_0x2894('0x3')]();var auth=require(_0x2894('0x4'));var interaction=require(_0x2894('0x5'));var config=require(_0x2894('0x6'));var controller=require(_0x2894('0x7'));router[_0x2894('0x8')]('/',auth[_0x2894('0x9')](),controller[_0x2894('0xa')]);router[_0x2894('0x8')](_0x2894('0xb'),auth['isAuthenticated'](),controller[_0x2894('0xc')]);router[_0x2894('0x8')](_0x2894('0xd'),auth['isAuthenticated'](),controller[_0x2894('0xe')]);router[_0x2894('0x8')](_0x2894('0xf'),auth[_0x2894('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2894('0x10')]('/:id/configurations',auth[_0x2894('0x9')](),controller[_0x2894('0x11')]);router[_0x2894('0x12')](_0x2894('0xb'),auth[_0x2894('0x9')](),controller[_0x2894('0x13')]);router[_0x2894('0x14')](_0x2894('0xb'),auth[_0x2894('0x9')](),controller[_0x2894('0x15')]);module[_0x2894('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 525559d..89325f8 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 _0xdcb8=['ENUM','newTab','integrationTab','sequelize','STRING','username'];(function(_0xbe1b2d,_0xcae67c){var _0x1e38a3=function(_0x1726d7){while(--_0x1726d7){_0xbe1b2d['push'](_0xbe1b2d['shift']());}};_0x1e38a3(++_0xcae67c);}(_0xdcb8,0xb7));var _0x8dcb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xdcb8[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x8dcb('0x0'));module['exports']={'name':{'type':Sequelize[_0x8dcb('0x1')]},'description':{'type':Sequelize[_0x8dcb('0x1')]},'username':{'type':Sequelize[_0x8dcb('0x1')],'unique':_0x8dcb('0x2')},'remoteUri':{'type':Sequelize[_0x8dcb('0x1')]},'password':{'type':Sequelize[_0x8dcb('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x8dcb('0x1')]},'securityToken':{'type':Sequelize[_0x8dcb('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8dcb('0x3')]('integrationTab',_0x8dcb('0x4')),'defaultValue':_0x8dcb('0x5')}}; \ No newline at end of file +var _0xcefb=['STRING','ENUM','integrationTab','exports'];(function(_0x1b11fe,_0x6ce57){var _0xc3e99a=function(_0x15bbf9){while(--_0x15bbf9){_0x1b11fe['push'](_0x1b11fe['shift']());}};_0xc3e99a(++_0x6ce57);}(_0xcefb,0x1cb));var _0xbcef=function(_0x45a546,_0x11b6a6){_0x45a546=_0x45a546-0x0;var _0x3e5eac=_0xcefb[_0x45a546];return _0x3e5eac;};'use strict';var Sequelize=require('sequelize');module[_0xbcef('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbcef('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xbcef('0x1')]},'password':{'type':Sequelize[_0xbcef('0x1')]},'clientId':{'type':Sequelize[_0xbcef('0x1')]},'clientSecret':{'type':Sequelize[_0xbcef('0x1')]},'securityToken':{'type':Sequelize[_0xbcef('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbcef('0x2')](_0xbcef('0x3'),'newTab'),'defaultValue':_0xbcef('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 6c16f0e..75875b0 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 _0xb651=['remoteUri','clientId','clientSecret','username','password','Connection','login','concat','securityToken','sobject','Task','describe','CallDisposition','CallDurationInSeconds','IsArchived','Priority','Status','custom','includes','label','picklistValues','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','request','then','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','reject','update','end','stack','name','index','rawAttributes','model','query','dateEnd','dateStart','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','SalesforceAccount','count','includeAll','findAll','rows','include','find','create','body','destroy','params','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','type','SalesforceField','getFields'];(function(_0x350279,_0x5d8699){var _0x3f6950=function(_0x513eb9){while(--_0x513eb9){_0x350279['push'](_0x350279['shift']());}};_0x3f6950(++_0x5d8699);}(_0xb651,0x93));var _0x1b65=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xb651[_0x2070da];return _0x4f9fe1;};'use strict';var pdf=require(_0x1b65('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1b65('0x1'));var zipdir=require(_0x1b65('0x2'));var jsonpatch=require(_0x1b65('0x3'));var rp=require(_0x1b65('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b65('0x5'));var util=require('util');var path=require(_0x1b65('0x6'));var sox=require('sox');var csv=require(_0x1b65('0x7'));var ejs=require(_0x1b65('0x8'));var fs=require('fs');var _=require(_0x1b65('0x9'));var squel=require(_0x1b65('0xa'));var crypto=require(_0x1b65('0xb'));var jsforce=require(_0x1b65('0xc'));var deskjs=require(_0x1b65('0xd'));var toCsv=require(_0x1b65('0x7'));var querystring=require('querystring');var Papa=require(_0x1b65('0xe'));var Redis=require(_0x1b65('0xf'));var qs=require(_0x1b65('0x10'));var logger=require(_0x1b65('0x11'))('api');var utils=require(_0x1b65('0x12'));var config=require(_0x1b65('0x13'));var db=require(_0x1b65('0x14'))['db'];var integrations=require(_0x1b65('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x1b65('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2946f0,_0x321cfa,_0x5db4a9,_0x19a874){return new BPromise(function(_0x350b48,_0x5f06d0){var _0x115325=_0x19a874||client;return _0x115325[_0x1b65('0x17')](_0x2946f0,_0x5db4a9)[_0x1b65('0x18')](function(_0xbb0df8){logger[_0x1b65('0x19')]('SalesforceAccount,\x20%s,\x20%s',_0x321cfa,_0x1b65('0x1a'));logger['debug'](_0x1b65('0x1b'),_0x321cfa,_0x1b65('0x1a'),JSON[_0x1b65('0x1c')](_0xbb0df8));if(_0xbb0df8[_0x1b65('0x1d')]){if(_0xbb0df8[_0x1b65('0x1d')][_0x1b65('0x1e')]===0x1f4){logger[_0x1b65('0x1d')](_0x1b65('0x1f'),_0x321cfa,_0xbb0df8[_0x1b65('0x1d')][_0x1b65('0x20')]);return _0x5f06d0(_0xbb0df8[_0x1b65('0x1d')][_0x1b65('0x20')]);}logger[_0x1b65('0x1d')](_0x1b65('0x1f'),_0x321cfa,_0xbb0df8[_0x1b65('0x1d')]['message']);return _0x350b48(_0xbb0df8[_0x1b65('0x1d')][_0x1b65('0x20')]);}else{logger[_0x1b65('0x19')](_0x1b65('0x1f'),_0x321cfa,_0x1b65('0x1a'));_0x350b48(_0xbb0df8['result'][_0x1b65('0x20')]);}})[_0x1b65('0x21')](function(_0x4a3b56){logger[_0x1b65('0x1d')](_0x1b65('0x1f'),_0x321cfa,_0x4a3b56);_0x5f06d0(_0x4a3b56);});});}function respondWithStatusCode(_0x51c34d,_0x255fcf){_0x255fcf=_0x255fcf||0xcc;return function(_0x2e6d0d){if(_0x2e6d0d){return _0x51c34d[_0x1b65('0x22')](_0x255fcf);}return _0x51c34d[_0x1b65('0x23')](_0x255fcf)['end']();};}function respondWithResult(_0x72c34f,_0x3aceb9){_0x3aceb9=_0x3aceb9||0xc8;return function(_0x29a252){if(_0x29a252){return _0x72c34f['status'](_0x3aceb9)[_0x1b65('0x24')](_0x29a252);}};}function respondWithFilteredResult(_0x64c603,_0xd24a1f){return function(_0x2e4894){if(_0x2e4894){var _0xf93c37=_0x2e4894['count'],_0x48d072=_0xd24a1f[_0x1b65('0x25')],_0x5123cb=_0xd24a1f[_0x1b65('0x25')]+_0xd24a1f[_0x1b65('0x26')],_0x4244b6;if(_0x5123cb>=_0xf93c37){_0x5123cb=_0xf93c37;_0x4244b6=0xc8;}else{_0x4244b6=0xce;}_0x64c603[_0x1b65('0x23')](_0x4244b6);return _0x64c603[_0x1b65('0x27')](_0x1b65('0x28'),_0x48d072+'-'+_0x5123cb+'/'+_0xf93c37)['json'](_0x2e4894);}return null;};}function patchUpdates(_0x25d8b4){return function(_0x4ead13){try{jsonpatch['apply'](_0x4ead13,_0x25d8b4,!![]);}catch(_0x3df14d){return BPromise[_0x1b65('0x29')](_0x3df14d);}return _0x4ead13['save']();};}function saveUpdates(_0x2be91b,_0x40798a){return function(_0x15d345){if(_0x15d345){return _0x15d345[_0x1b65('0x2a')](_0x2be91b)['then'](function(_0x4b85f7){return _0x4b85f7;});}return null;};}function removeEntity(_0x56baa3,_0x36b70b){return function(_0x1ad09e){if(_0x1ad09e){return _0x1ad09e['destroy']()[_0x1b65('0x18')](function(){_0x56baa3['status'](0xcc)[_0x1b65('0x2b')]();});}};}function handleEntityNotFound(_0x4bc9fb,_0x723923){return function(_0x1e7f4f){if(!_0x1e7f4f){_0x4bc9fb[_0x1b65('0x22')](0x194);}return _0x1e7f4f;};}function handleError(_0x7eab61,_0x961ee2){_0x961ee2=_0x961ee2||0x1f4;return function(_0x53434e){logger[_0x1b65('0x1d')](_0x53434e[_0x1b65('0x2c')]);if(_0x53434e[_0x1b65('0x2d')]){delete _0x53434e[_0x1b65('0x2d')];}_0x7eab61[_0x1b65('0x23')](_0x961ee2)['send'](_0x53434e);};}exports[_0x1b65('0x2e')]=function(_0x409c0d,_0x464a9c){var _0x155eab={},_0xe89107={},_0x42f8a5={'count':0x0,'rows':[]};var _0x349b2d=db['SalesforceAccount'][_0x1b65('0x2f')];_0xe89107[_0x1b65('0x30')]=_['keys'](_0x349b2d);var _0x3a620d={'dateStart':_0x409c0d[_0x1b65('0x31')]['dateStart'],'dateEnd':_0x409c0d['query'][_0x1b65('0x32')]};delete _0x409c0d[_0x1b65('0x31')][_0x1b65('0x33')];delete _0x409c0d[_0x1b65('0x31')][_0x1b65('0x32')];_0xe89107['query']=_[_0x1b65('0x34')](_0x409c0d['query']);_0xe89107['filters']=_[_0x1b65('0x35')](_0xe89107[_0x1b65('0x30')],_0xe89107['query']);_0x155eab[_0x1b65('0x36')]=_['intersection'](_0xe89107[_0x1b65('0x30')],qs[_0x1b65('0x37')](_0x409c0d[_0x1b65('0x31')][_0x1b65('0x37')]));_0x155eab['attributes']=_0x155eab['attributes'][_0x1b65('0x38')]?_0x155eab[_0x1b65('0x36')]:_0xe89107['model'];if(!_0x409c0d['query'][_0x1b65('0x39')](_0x1b65('0x3a'))){_0x155eab['limit']=qs[_0x1b65('0x26')](_0x409c0d[_0x1b65('0x31')]['limit']);_0x155eab['offset']=qs['offset'](_0x409c0d[_0x1b65('0x31')][_0x1b65('0x25')]);}_0x155eab[_0x1b65('0x3b')]=qs[_0x1b65('0x3c')](_0x409c0d[_0x1b65('0x31')][_0x1b65('0x3c')]);_0x155eab[_0x1b65('0x3d')]=qs[_0x1b65('0x3e')](_[_0x1b65('0x3f')](_0x409c0d['query'],_0xe89107[_0x1b65('0x3e')]));if(_0x3a620d['dateStart']){if(_0x3a620d[_0x1b65('0x32')]){_0x3a620d['dateEnd']=moment(_0x3a620d['dateEnd'])[_0x1b65('0x40')](0x1,'day');}else{_0x3a620d[_0x1b65('0x32')]=moment(_0x3a620d[_0x1b65('0x33')])[_0x1b65('0x40')](0x1,_0x1b65('0x41'));}_[_0x1b65('0x42')](_0x155eab[_0x1b65('0x3d')],{'createdAt':{'$gte':_0x3a620d[_0x1b65('0x33')],'$lte':_0x3a620d[_0x1b65('0x32')]}});}if(_0x409c0d['query'][_0x1b65('0x43')]){_0x155eab[_0x1b65('0x3d')]=_[_0x1b65('0x42')](_0x155eab[_0x1b65('0x3d')],{'$or':_[_0x1b65('0x44')](_0x155eab['attributes'],function(_0x4fd9b3){var _0x24f3c9={};_0x24f3c9[_0x4fd9b3]={'$like':'%'+_0x409c0d[_0x1b65('0x31')][_0x1b65('0x43')]+'%'};return _0x24f3c9;})});}_0x155eab=_[_0x1b65('0x42')]({},_0x155eab,_0x409c0d[_0x1b65('0x45')]);var _0xdcc7d9={'where':_0x155eab[_0x1b65('0x3d')]};return db[_0x1b65('0x46')][_0x1b65('0x47')](_0xdcc7d9)[_0x1b65('0x18')](function(_0x57bdb1){_0x42f8a5[_0x1b65('0x47')]=_0x57bdb1;if(_0x409c0d['query'][_0x1b65('0x48')]){_0x155eab['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x1b65('0x49')](_0x155eab);})['then'](function(_0x4fdc51){_0x42f8a5[_0x1b65('0x4a')]=_0x4fdc51;return _0x42f8a5;})[_0x1b65('0x18')](respondWithFilteredResult(_0x464a9c,_0x155eab))[_0x1b65('0x21')](handleError(_0x464a9c,null));};exports['show']=function(_0x5842b2,_0x19a827){var _0x34d322={'raw':![],'where':{'id':_0x5842b2['params']['id']}},_0x11e60e={};_0x11e60e[_0x1b65('0x30')]=_['keys'](db[_0x1b65('0x46')]['rawAttributes']);_0x11e60e['query']=_['keys'](_0x5842b2[_0x1b65('0x31')]);_0x11e60e['filters']=_[_0x1b65('0x35')](_0x11e60e[_0x1b65('0x30')],_0x11e60e['query']);_0x34d322[_0x1b65('0x36')]=_[_0x1b65('0x35')](_0x11e60e['model'],qs[_0x1b65('0x37')](_0x5842b2[_0x1b65('0x31')]['fields']));_0x34d322[_0x1b65('0x36')]=_0x34d322[_0x1b65('0x36')][_0x1b65('0x38')]?_0x34d322['attributes']:_0x11e60e[_0x1b65('0x30')];if(_0x5842b2[_0x1b65('0x31')][_0x1b65('0x48')]){_0x34d322[_0x1b65('0x4b')]=[{'all':!![]}];}_0x34d322=_[_0x1b65('0x42')]({},_0x34d322,_0x5842b2[_0x1b65('0x45')]);return db['SalesforceAccount'][_0x1b65('0x4c')](_0x34d322)[_0x1b65('0x18')](handleEntityNotFound(_0x19a827,null))[_0x1b65('0x18')](respondWithResult(_0x19a827,null))[_0x1b65('0x21')](handleError(_0x19a827,null));};exports[_0x1b65('0x4d')]=function(_0x4b8ee2,_0x3e1e8b){return db[_0x1b65('0x46')][_0x1b65('0x4d')](_0x4b8ee2['body'],{})['then'](respondWithResult(_0x3e1e8b,0xc9))[_0x1b65('0x21')](handleError(_0x3e1e8b,null));};exports[_0x1b65('0x2a')]=function(_0x52ab51,_0xe30137){if(_0x52ab51[_0x1b65('0x4e')]['id']){delete _0x52ab51[_0x1b65('0x4e')]['id'];}return db[_0x1b65('0x46')][_0x1b65('0x4c')]({'where':{'id':_0x52ab51['params']['id']}})[_0x1b65('0x18')](handleEntityNotFound(_0xe30137,null))[_0x1b65('0x18')](saveUpdates(_0x52ab51['body'],null))[_0x1b65('0x18')](respondWithResult(_0xe30137,null))['catch'](handleError(_0xe30137,null));};exports[_0x1b65('0x4f')]=function(_0x58f421,_0x50dd7d){return db[_0x1b65('0x46')]['find']({'where':{'id':_0x58f421[_0x1b65('0x50')]['id']}})[_0x1b65('0x18')](handleEntityNotFound(_0x50dd7d,null))[_0x1b65('0x18')](removeEntity(_0x50dd7d,null))[_0x1b65('0x21')](handleError(_0x50dd7d,null));};exports[_0x1b65('0x51')]=function(_0x46ae17,_0x1f7ea7,_0x22ea03){var _0x338caf={};var _0x12cbd9={};var _0x4ec1e1;var _0x112dba;return db[_0x1b65('0x46')][_0x1b65('0x52')]({'where':{'id':_0x46ae17[_0x1b65('0x50')]['id']}})['then'](handleEntityNotFound(_0x1f7ea7,null))['then'](function(_0x360a76){if(_0x360a76){_0x4ec1e1=_0x360a76;_0x12cbd9['model']=_[_0x1b65('0x34')](db[_0x1b65('0x53')][_0x1b65('0x2f')]);_0x12cbd9[_0x1b65('0x31')]=_['keys'](_0x46ae17[_0x1b65('0x31')]);_0x12cbd9['filters']=_[_0x1b65('0x35')](_0x12cbd9[_0x1b65('0x30')],_0x12cbd9['query']);_0x338caf[_0x1b65('0x36')]=_['intersection'](_0x12cbd9[_0x1b65('0x30')],qs[_0x1b65('0x37')](_0x46ae17[_0x1b65('0x31')]['fields']));_0x338caf['attributes']=_0x338caf[_0x1b65('0x36')]['length']?_0x338caf[_0x1b65('0x36')]:_0x12cbd9[_0x1b65('0x30')];_0x338caf[_0x1b65('0x3b')]=qs[_0x1b65('0x3c')](_0x46ae17[_0x1b65('0x31')]['sort']);_0x338caf[_0x1b65('0x3d')]=qs[_0x1b65('0x3e')](_[_0x1b65('0x3f')](_0x46ae17[_0x1b65('0x31')],_0x12cbd9[_0x1b65('0x3e')]));if(_0x46ae17[_0x1b65('0x31')][_0x1b65('0x43')]){_0x338caf[_0x1b65('0x3d')]=_[_0x1b65('0x42')](_0x338caf['where'],{'$or':_[_0x1b65('0x44')](_0x338caf[_0x1b65('0x36')],function(_0x18bb26){var _0x5eff6d={};_0x5eff6d[_0x18bb26]={'$like':'%'+_0x46ae17[_0x1b65('0x31')][_0x1b65('0x43')]+'%'};return _0x5eff6d;})});}_0x338caf=_[_0x1b65('0x42')]({},_0x338caf,_0x46ae17[_0x1b65('0x45')]);return _0x4ec1e1[_0x1b65('0x51')](_0x338caf);}})[_0x1b65('0x18')](function(_0x2c829f){if(_0x2c829f){_0x112dba=_0x2c829f['length'];if(!_0x46ae17[_0x1b65('0x31')]['hasOwnProperty'](_0x1b65('0x3a'))){_0x338caf[_0x1b65('0x26')]=qs[_0x1b65('0x26')](_0x46ae17[_0x1b65('0x31')]['limit']);_0x338caf[_0x1b65('0x25')]=qs[_0x1b65('0x25')](_0x46ae17[_0x1b65('0x31')][_0x1b65('0x25')]);}return _0x4ec1e1[_0x1b65('0x51')](_0x338caf);}})[_0x1b65('0x18')](function(_0x9b4c90){if(_0x9b4c90){return _0x9b4c90?{'count':_0x112dba,'rows':_0x9b4c90}:null;}})[_0x1b65('0x18')](respondWithResult(_0x1f7ea7,null))[_0x1b65('0x21')](handleError(_0x1f7ea7,null));};exports[_0x1b65('0x54')]=function(_0xfa3b51,_0x24d6e1,_0x548add){if(_0xfa3b51[_0x1b65('0x4e')]['id']){delete _0xfa3b51[_0x1b65('0x4e')]['id'];}return db[_0x1b65('0x46')][_0x1b65('0x52')]({'where':{'id':_0xfa3b51['params']['id']}})['then'](handleEntityNotFound(_0x24d6e1,null))[_0x1b65('0x18')](function(_0x20f9bf){if(_0x20f9bf){_0xfa3b51['body'][_0x1b65('0x55')]=_0x20f9bf['id'];_0xfa3b51[_0x1b65('0x4e')][_0x1b65('0x56')]=integrations[_0x1b65('0x57')](_0xfa3b51[_0x1b65('0x4e')][_0x1b65('0x58')],_0xfa3b51['body']['type']);_0xfa3b51['body']['Descriptions']=integrations[_0x1b65('0x59')](_0xfa3b51[_0x1b65('0x4e')][_0x1b65('0x58')],_0xfa3b51['body'][_0x1b65('0x5a')]);return db['SalesforceConfiguration']['create'](_0xfa3b51[_0x1b65('0x4e')],{'include':[{'model':db[_0x1b65('0x5b')],'as':_0x1b65('0x56')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x24d6e1,null))['catch'](handleError(_0x24d6e1,null));};exports[_0x1b65('0x5c')]=function(_0x41cc3a,_0x3c012f,_0x4976d7){var _0x3c2635;return db[_0x1b65('0x46')][_0x1b65('0x52')]({'where':{'id':_0x41cc3a['params']['id']},'attributes':['id',_0x1b65('0x5d'),_0x1b65('0x5e'),_0x1b65('0x5f'),_0x1b65('0x60'),_0x1b65('0x61'),'securityToken']})[_0x1b65('0x18')](handleEntityNotFound(_0x3c012f,null))['then'](function(_0x502f5){if(_0x502f5){_0x3c2635=new jsforce[(_0x1b65('0x62'))]({'oauth2':{'loginUrl':_0x502f5[_0x1b65('0x5d')],'clientId':_0x502f5['clientId'],'clientSecret':_0x502f5['clientSecret']}});return _0x3c2635[_0x1b65('0x63')](_0x502f5[_0x1b65('0x60')],_0x502f5['password'][_0x1b65('0x64')](_0x502f5[_0x1b65('0x65')]));}})[_0x1b65('0x18')](function(_0x130a48){if(_0x130a48){return _0x3c2635[_0x1b65('0x66')](_0x1b65('0x67'))[_0x1b65('0x68')]();}})['then'](function(_0x4e2620){var _0x3d0cb3=[_0x1b65('0x69'),_0x1b65('0x6a'),'CallObject','CallType',_0x1b65('0x6b'),_0x1b65('0x6c'),_0x1b65('0x6d'),'Type'];if(_0x4e2620){_['remove'](_0x4e2620[_0x1b65('0x37')],function(_0x1837d0){return _0x1837d0[_0x1b65('0x6e')]===![]&&!_0x3d0cb3[_0x1b65('0x6f')](_0x1837d0[_0x1b65('0x2d')]);});return{'count':_0x4e2620[_0x1b65('0x37')][_0x1b65('0x38')],'rows':_[_0x1b65('0x44')](_0x4e2620[_0x1b65('0x37')],function(_0x298558){return{'id':_0x298558[_0x1b65('0x2d')],'name':_0x298558[_0x1b65('0x70')],'custom':_0x298558[_0x1b65('0x6e')],'options':_0x298558[_0x1b65('0x71')]?_['map'](_0x298558[_0x1b65('0x71')],function(_0x1ebb28){return{'name':_0x1ebb28[_0x1b65('0x70')],'value':_0x1ebb28[_0x1b65('0x72')]};}):[]};})};}})[_0x1b65('0x18')](respondWithResult(_0x3c012f,null))[_0x1b65('0x21')](function(_0x59154f){var _0x2d09ca=_0x41cc3a[_0x1b65('0x31')][_0x1b65('0x73')]?0x1f4:_0x59154f[_0x1b65('0x74')]||0x1f4;logger[_0x1b65('0x1d')](_0x1b65('0x75'),_0x1b65('0x5c'),_0x2d09ca,JSON[_0x1b65('0x1c')](_0x59154f));delete _0x59154f[_0x1b65('0x2d')];if(_0x2d09ca===0x191){_0x2d09ca=0x190;}_0x3c012f[_0x1b65('0x23')](_0x2d09ca)[_0x1b65('0x76')](_0x41cc3a[_0x1b65('0x31')][_0x1b65('0x73')]?{'message':_0x1b65('0x77'),'statusCode':_0x59154f['statusCode']}:_0x59154f);});}; \ No newline at end of file +var _0x4b94=['update','then','destroy','stack','name','send','index','SalesforceAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','options','count','findAll','show','params','includeAll','include','find','create','body','getConfigurations','SalesforceConfiguration','order','map','filter','findOne','AccountId','channel','type','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','remoteUri','clientSecret','password','securityToken','Connection','clientId','login','username','concat','sobject','Task','describe','CallDisposition','CallDurationInSeconds','Priority','Status','Type','custom','includes','label','picklistValues','test','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4b94,0x1b3));var _0x44b9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4b94[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x44b9('0x0'));var rimraf=require(_0x44b9('0x1'));var zipdir=require(_0x44b9('0x2'));var jsonpatch=require(_0x44b9('0x3'));var rp=require(_0x44b9('0x4'));var moment=require(_0x44b9('0x5'));var BPromise=require(_0x44b9('0x6'));var Mustache=require(_0x44b9('0x7'));var util=require(_0x44b9('0x8'));var path=require('path');var sox=require(_0x44b9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x44b9('0xa'));var crypto=require(_0x44b9('0xb'));var jsforce=require(_0x44b9('0xc'));var deskjs=require(_0x44b9('0xd'));var toCsv=require(_0x44b9('0xe'));var querystring=require('querystring');var Papa=require(_0x44b9('0xf'));var Redis=require('ioredis');var qs=require(_0x44b9('0x10'));var logger=require(_0x44b9('0x11'))(_0x44b9('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x44b9('0x13'))['db'];var integrations=require(_0x44b9('0x14'));var jayson=require(_0x44b9('0x15'));var client=jayson[_0x44b9('0x16')][_0x44b9('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x592fc6,_0xcf58af,_0x1d1087,_0x2d4092){return new BPromise(function(_0xa31e9e,_0x54b9f4){var _0x59395f=_0x2d4092||client;return _0x59395f[_0x44b9('0x18')](_0x592fc6,_0x1d1087)['then'](function(_0x4b3ad5){logger[_0x44b9('0x19')]('SalesforceAccount,\x20%s,\x20%s',_0xcf58af,'request\x20sent');logger[_0x44b9('0x1a')](_0x44b9('0x1b'),_0xcf58af,_0x44b9('0x1c'),JSON['stringify'](_0x4b3ad5));if(_0x4b3ad5[_0x44b9('0x1d')]){if(_0x4b3ad5[_0x44b9('0x1d')][_0x44b9('0x1e')]===0x1f4){logger['error'](_0x44b9('0x1f'),_0xcf58af,_0x4b3ad5[_0x44b9('0x1d')]['message']);return _0x54b9f4(_0x4b3ad5[_0x44b9('0x1d')]['message']);}logger['error'](_0x44b9('0x1f'),_0xcf58af,_0x4b3ad5['error'][_0x44b9('0x20')]);return _0xa31e9e(_0x4b3ad5['error']['message']);}else{logger[_0x44b9('0x19')](_0x44b9('0x1f'),_0xcf58af,_0x44b9('0x1c'));_0xa31e9e(_0x4b3ad5[_0x44b9('0x21')][_0x44b9('0x20')]);}})[_0x44b9('0x22')](function(_0x1cb697){logger[_0x44b9('0x1d')](_0x44b9('0x1f'),_0xcf58af,_0x1cb697);_0x54b9f4(_0x1cb697);});});}function respondWithStatusCode(_0x2361bf,_0x3d30f6){_0x3d30f6=_0x3d30f6||0xcc;return function(_0x51c1f8){if(_0x51c1f8){return _0x2361bf[_0x44b9('0x23')](_0x3d30f6);}return _0x2361bf['status'](_0x3d30f6)[_0x44b9('0x24')]();};}function respondWithResult(_0x33328a,_0x40beee){_0x40beee=_0x40beee||0xc8;return function(_0x516db1){if(_0x516db1){return _0x33328a[_0x44b9('0x25')](_0x40beee)[_0x44b9('0x26')](_0x516db1);}};}function respondWithFilteredResult(_0x42b127,_0x4c1e0a){return function(_0x1b884e){if(_0x1b884e){var _0x645ed8=_0x1b884e['count'],_0x29d635=_0x4c1e0a[_0x44b9('0x27')],_0x241577=_0x4c1e0a[_0x44b9('0x27')]+_0x4c1e0a[_0x44b9('0x28')],_0x59c1c7;if(_0x241577>=_0x645ed8){_0x241577=_0x645ed8;_0x59c1c7=0xc8;}else{_0x59c1c7=0xce;}_0x42b127['status'](_0x59c1c7);return _0x42b127[_0x44b9('0x29')](_0x44b9('0x2a'),_0x29d635+'-'+_0x241577+'/'+_0x645ed8)[_0x44b9('0x26')](_0x1b884e);}return null;};}function patchUpdates(_0x21fd30){return function(_0xcd8469){try{jsonpatch['apply'](_0xcd8469,_0x21fd30,!![]);}catch(_0x5a59a2){return BPromise[_0x44b9('0x2b')](_0x5a59a2);}return _0xcd8469[_0x44b9('0x2c')]();};}function saveUpdates(_0x12f708,_0x349e5c){return function(_0x3b09f0){if(_0x3b09f0){return _0x3b09f0[_0x44b9('0x2d')](_0x12f708)[_0x44b9('0x2e')](function(_0x3b28e6){return _0x3b28e6;});}return null;};}function removeEntity(_0x13d543,_0x51744b){return function(_0x591950){if(_0x591950){return _0x591950[_0x44b9('0x2f')]()['then'](function(){_0x13d543[_0x44b9('0x25')](0xcc)[_0x44b9('0x24')]();});}};}function handleEntityNotFound(_0x3f163a,_0x61dcac){return function(_0x2637af){if(!_0x2637af){_0x3f163a[_0x44b9('0x23')](0x194);}return _0x2637af;};}function handleError(_0xd162a3,_0xfc42a1){_0xfc42a1=_0xfc42a1||0x1f4;return function(_0x433175){logger[_0x44b9('0x1d')](_0x433175[_0x44b9('0x30')]);if(_0x433175[_0x44b9('0x31')]){delete _0x433175[_0x44b9('0x31')];}_0xd162a3[_0x44b9('0x25')](_0xfc42a1)[_0x44b9('0x32')](_0x433175);};}exports[_0x44b9('0x33')]=function(_0x1deade,_0x10c860){var _0x480dd1={},_0x2577ff={},_0x1ffb8f={'count':0x0,'rows':[]};var _0x97b0dc=db[_0x44b9('0x34')][_0x44b9('0x35')];_0x2577ff[_0x44b9('0x36')]=_[_0x44b9('0x37')](_0x97b0dc);var _0x135c35={'dateStart':_0x1deade[_0x44b9('0x38')][_0x44b9('0x39')],'dateEnd':_0x1deade[_0x44b9('0x38')][_0x44b9('0x3a')]};delete _0x1deade[_0x44b9('0x38')][_0x44b9('0x39')];delete _0x1deade['query'][_0x44b9('0x3a')];_0x2577ff[_0x44b9('0x38')]=_[_0x44b9('0x37')](_0x1deade['query']);_0x2577ff[_0x44b9('0x3b')]=_['intersection'](_0x2577ff[_0x44b9('0x36')],_0x2577ff[_0x44b9('0x38')]);_0x480dd1[_0x44b9('0x3c')]=_[_0x44b9('0x3d')](_0x2577ff[_0x44b9('0x36')],qs[_0x44b9('0x3e')](_0x1deade[_0x44b9('0x38')]['fields']));_0x480dd1['attributes']=_0x480dd1[_0x44b9('0x3c')][_0x44b9('0x3f')]?_0x480dd1[_0x44b9('0x3c')]:_0x2577ff[_0x44b9('0x36')];if(!_0x1deade['query'][_0x44b9('0x40')](_0x44b9('0x41'))){_0x480dd1[_0x44b9('0x28')]=qs['limit'](_0x1deade[_0x44b9('0x38')]['limit']);_0x480dd1[_0x44b9('0x27')]=qs[_0x44b9('0x27')](_0x1deade['query'][_0x44b9('0x27')]);}_0x480dd1['order']=qs[_0x44b9('0x42')](_0x1deade[_0x44b9('0x38')][_0x44b9('0x42')]);_0x480dd1[_0x44b9('0x43')]=qs['filters'](_[_0x44b9('0x44')](_0x1deade[_0x44b9('0x38')],_0x2577ff[_0x44b9('0x3b')]));if(_0x135c35[_0x44b9('0x39')]){if(_0x135c35[_0x44b9('0x3a')]){_0x135c35[_0x44b9('0x3a')]=moment(_0x135c35['dateEnd'])[_0x44b9('0x45')](0x1,_0x44b9('0x46'));}else{_0x135c35[_0x44b9('0x3a')]=moment(_0x135c35[_0x44b9('0x39')])['add'](0x1,_0x44b9('0x46'));}_[_0x44b9('0x47')](_0x480dd1[_0x44b9('0x43')],{'createdAt':{'$gte':_0x135c35[_0x44b9('0x39')],'$lte':_0x135c35[_0x44b9('0x3a')]}});}if(_0x1deade[_0x44b9('0x38')]['filter']){_0x480dd1['where']=_['merge'](_0x480dd1[_0x44b9('0x43')],{'$or':_['map'](_0x480dd1[_0x44b9('0x3c')],function(_0x51b560){var _0x2843bd={};_0x2843bd[_0x51b560]={'$like':'%'+_0x1deade[_0x44b9('0x38')]['filter']+'%'};return _0x2843bd;})});}_0x480dd1=_[_0x44b9('0x47')]({},_0x480dd1,_0x1deade[_0x44b9('0x48')]);var _0x4cc012={'where':_0x480dd1['where']};return db[_0x44b9('0x34')]['count'](_0x4cc012)[_0x44b9('0x2e')](function(_0x5019b8){_0x1ffb8f[_0x44b9('0x49')]=_0x5019b8;if(_0x1deade[_0x44b9('0x38')]['includeAll']){_0x480dd1['include']=[{'all':!![]}];}return db[_0x44b9('0x34')][_0x44b9('0x4a')](_0x480dd1);})['then'](function(_0x19eba1){_0x1ffb8f['rows']=_0x19eba1;return _0x1ffb8f;})[_0x44b9('0x2e')](respondWithFilteredResult(_0x10c860,_0x480dd1))[_0x44b9('0x22')](handleError(_0x10c860,null));};exports[_0x44b9('0x4b')]=function(_0xbc99f4,_0x96469c){var _0x19edf7={'raw':![],'where':{'id':_0xbc99f4[_0x44b9('0x4c')]['id']}},_0x27227d={};_0x27227d[_0x44b9('0x36')]=_[_0x44b9('0x37')](db[_0x44b9('0x34')]['rawAttributes']);_0x27227d[_0x44b9('0x38')]=_['keys'](_0xbc99f4['query']);_0x27227d[_0x44b9('0x3b')]=_[_0x44b9('0x3d')](_0x27227d['model'],_0x27227d[_0x44b9('0x38')]);_0x19edf7[_0x44b9('0x3c')]=_[_0x44b9('0x3d')](_0x27227d['model'],qs[_0x44b9('0x3e')](_0xbc99f4[_0x44b9('0x38')][_0x44b9('0x3e')]));_0x19edf7[_0x44b9('0x3c')]=_0x19edf7[_0x44b9('0x3c')][_0x44b9('0x3f')]?_0x19edf7['attributes']:_0x27227d[_0x44b9('0x36')];if(_0xbc99f4[_0x44b9('0x38')][_0x44b9('0x4d')]){_0x19edf7[_0x44b9('0x4e')]=[{'all':!![]}];}_0x19edf7=_['merge']({},_0x19edf7,_0xbc99f4[_0x44b9('0x48')]);return db[_0x44b9('0x34')][_0x44b9('0x4f')](_0x19edf7)[_0x44b9('0x2e')](handleEntityNotFound(_0x96469c,null))[_0x44b9('0x2e')](respondWithResult(_0x96469c,null))[_0x44b9('0x22')](handleError(_0x96469c,null));};exports[_0x44b9('0x50')]=function(_0x406648,_0x3fd7fc){return db['SalesforceAccount'][_0x44b9('0x50')](_0x406648[_0x44b9('0x51')],{})[_0x44b9('0x2e')](respondWithResult(_0x3fd7fc,0xc9))[_0x44b9('0x22')](handleError(_0x3fd7fc,null));};exports[_0x44b9('0x2d')]=function(_0x28c8b0,_0x857769){if(_0x28c8b0['body']['id']){delete _0x28c8b0['body']['id'];}return db['SalesforceAccount'][_0x44b9('0x4f')]({'where':{'id':_0x28c8b0[_0x44b9('0x4c')]['id']}})[_0x44b9('0x2e')](handleEntityNotFound(_0x857769,null))[_0x44b9('0x2e')](saveUpdates(_0x28c8b0['body'],null))[_0x44b9('0x2e')](respondWithResult(_0x857769,null))[_0x44b9('0x22')](handleError(_0x857769,null));};exports[_0x44b9('0x2f')]=function(_0x34c1ee,_0x5af16f){return db['SalesforceAccount'][_0x44b9('0x4f')]({'where':{'id':_0x34c1ee[_0x44b9('0x4c')]['id']}})[_0x44b9('0x2e')](handleEntityNotFound(_0x5af16f,null))[_0x44b9('0x2e')](removeEntity(_0x5af16f,null))[_0x44b9('0x22')](handleError(_0x5af16f,null));};exports[_0x44b9('0x52')]=function(_0xc79d32,_0x221045,_0x48af01){var _0x2ac542={};var _0x2f0686={};var _0x3db83b;var _0x42ea45;return db[_0x44b9('0x34')]['findOne']({'where':{'id':_0xc79d32[_0x44b9('0x4c')]['id']}})[_0x44b9('0x2e')](handleEntityNotFound(_0x221045,null))[_0x44b9('0x2e')](function(_0x5658e5){if(_0x5658e5){_0x3db83b=_0x5658e5;_0x2f0686[_0x44b9('0x36')]=_['keys'](db[_0x44b9('0x53')][_0x44b9('0x35')]);_0x2f0686['query']=_[_0x44b9('0x37')](_0xc79d32[_0x44b9('0x38')]);_0x2f0686['filters']=_[_0x44b9('0x3d')](_0x2f0686[_0x44b9('0x36')],_0x2f0686[_0x44b9('0x38')]);_0x2ac542[_0x44b9('0x3c')]=_[_0x44b9('0x3d')](_0x2f0686[_0x44b9('0x36')],qs[_0x44b9('0x3e')](_0xc79d32[_0x44b9('0x38')]['fields']));_0x2ac542['attributes']=_0x2ac542['attributes'][_0x44b9('0x3f')]?_0x2ac542[_0x44b9('0x3c')]:_0x2f0686[_0x44b9('0x36')];_0x2ac542[_0x44b9('0x54')]=qs[_0x44b9('0x42')](_0xc79d32[_0x44b9('0x38')][_0x44b9('0x42')]);_0x2ac542[_0x44b9('0x43')]=qs[_0x44b9('0x3b')](_[_0x44b9('0x44')](_0xc79d32['query'],_0x2f0686[_0x44b9('0x3b')]));if(_0xc79d32[_0x44b9('0x38')]['filter']){_0x2ac542[_0x44b9('0x43')]=_[_0x44b9('0x47')](_0x2ac542[_0x44b9('0x43')],{'$or':_[_0x44b9('0x55')](_0x2ac542[_0x44b9('0x3c')],function(_0x18d0fd){var _0x1863d2={};_0x1863d2[_0x18d0fd]={'$like':'%'+_0xc79d32['query'][_0x44b9('0x56')]+'%'};return _0x1863d2;})});}_0x2ac542=_[_0x44b9('0x47')]({},_0x2ac542,_0xc79d32[_0x44b9('0x48')]);return _0x3db83b[_0x44b9('0x52')](_0x2ac542);}})[_0x44b9('0x2e')](function(_0x50108c){if(_0x50108c){_0x42ea45=_0x50108c['length'];if(!_0xc79d32[_0x44b9('0x38')]['hasOwnProperty'](_0x44b9('0x41'))){_0x2ac542[_0x44b9('0x28')]=qs[_0x44b9('0x28')](_0xc79d32[_0x44b9('0x38')][_0x44b9('0x28')]);_0x2ac542['offset']=qs['offset'](_0xc79d32[_0x44b9('0x38')]['offset']);}return _0x3db83b[_0x44b9('0x52')](_0x2ac542);}})[_0x44b9('0x2e')](function(_0x51fd53){if(_0x51fd53){return _0x51fd53?{'count':_0x42ea45,'rows':_0x51fd53}:null;}})[_0x44b9('0x2e')](respondWithResult(_0x221045,null))[_0x44b9('0x22')](handleError(_0x221045,null));};exports['addConfiguration']=function(_0x13cb27,_0x3861f8,_0x5a49bb){if(_0x13cb27['body']['id']){delete _0x13cb27[_0x44b9('0x51')]['id'];}return db['SalesforceAccount'][_0x44b9('0x57')]({'where':{'id':_0x13cb27['params']['id']}})[_0x44b9('0x2e')](handleEntityNotFound(_0x3861f8,null))[_0x44b9('0x2e')](function(_0x2a1c20){if(_0x2a1c20){_0x13cb27['body'][_0x44b9('0x58')]=_0x2a1c20['id'];_0x13cb27[_0x44b9('0x51')]['Subjects']=integrations['getSubjects'](_0x13cb27[_0x44b9('0x51')][_0x44b9('0x59')],_0x13cb27['body'][_0x44b9('0x5a')]);_0x13cb27[_0x44b9('0x51')][_0x44b9('0x5b')]=integrations[_0x44b9('0x5c')](_0x13cb27[_0x44b9('0x51')][_0x44b9('0x59')],_0x13cb27[_0x44b9('0x51')][_0x44b9('0x5a')]);return db['SalesforceConfiguration']['create'](_0x13cb27[_0x44b9('0x51')],{'include':[{'model':db[_0x44b9('0x5d')],'as':_0x44b9('0x5e')},{'model':db[_0x44b9('0x5d')],'as':'Descriptions'}]});}return null;})[_0x44b9('0x2e')](respondWithResult(_0x3861f8,null))[_0x44b9('0x22')](handleError(_0x3861f8,null));};exports[_0x44b9('0x5f')]=function(_0x4d6967,_0x1455ea,_0x26c731){var _0x51b7b3;return db[_0x44b9('0x34')]['findOne']({'where':{'id':_0x4d6967[_0x44b9('0x4c')]['id']},'attributes':['id',_0x44b9('0x60'),'clientId',_0x44b9('0x61'),'username',_0x44b9('0x62'),_0x44b9('0x63')]})[_0x44b9('0x2e')](handleEntityNotFound(_0x1455ea,null))[_0x44b9('0x2e')](function(_0x23e5ca){if(_0x23e5ca){_0x51b7b3=new jsforce[(_0x44b9('0x64'))]({'oauth2':{'loginUrl':_0x23e5ca[_0x44b9('0x60')],'clientId':_0x23e5ca[_0x44b9('0x65')],'clientSecret':_0x23e5ca[_0x44b9('0x61')]}});return _0x51b7b3[_0x44b9('0x66')](_0x23e5ca[_0x44b9('0x67')],_0x23e5ca['password'][_0x44b9('0x68')](_0x23e5ca[_0x44b9('0x63')]));}})[_0x44b9('0x2e')](function(_0xeb1a54){if(_0xeb1a54){return _0x51b7b3[_0x44b9('0x69')](_0x44b9('0x6a'))[_0x44b9('0x6b')]();}})['then'](function(_0x5888d1){var _0x4ccae9=[_0x44b9('0x6c'),_0x44b9('0x6d'),'CallObject','CallType','IsArchived',_0x44b9('0x6e'),_0x44b9('0x6f'),_0x44b9('0x70')];if(_0x5888d1){_['remove'](_0x5888d1[_0x44b9('0x3e')],function(_0x1ff41e){return _0x1ff41e[_0x44b9('0x71')]===![]&&!_0x4ccae9[_0x44b9('0x72')](_0x1ff41e['name']);});return{'count':_0x5888d1[_0x44b9('0x3e')][_0x44b9('0x3f')],'rows':_[_0x44b9('0x55')](_0x5888d1[_0x44b9('0x3e')],function(_0x37496e){return{'id':_0x37496e['name'],'name':_0x37496e[_0x44b9('0x73')],'custom':_0x37496e[_0x44b9('0x71')],'options':_0x37496e[_0x44b9('0x74')]?_[_0x44b9('0x55')](_0x37496e['picklistValues'],function(_0x722753){return{'name':_0x722753[_0x44b9('0x73')],'value':_0x722753['value']};}):[]};})};}})[_0x44b9('0x2e')](respondWithResult(_0x1455ea,null))[_0x44b9('0x22')](function(_0x89bdd0){var _0x521d07=_0x4d6967[_0x44b9('0x38')][_0x44b9('0x75')]?0x1f4:_0x89bdd0['statusCode']||0x1f4;logger[_0x44b9('0x1d')](_0x44b9('0x76'),_0x44b9('0x5f'),_0x521d07,JSON[_0x44b9('0x77')](_0x89bdd0));delete _0x89bdd0[_0x44b9('0x31')];if(_0x521d07===0x191){_0x521d07=0x190;}_0x1455ea['status'](_0x521d07)[_0x44b9('0x32')](_0x4d6967[_0x44b9('0x38')][_0x44b9('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x89bdd0['statusCode']}:_0x89bdd0);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 2aacfb0..b62da96 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 _0xb4a0=['exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','../../components/integrations/configuration'];(function(_0xb98e6e,_0xe56cbc){var _0x26751c=function(_0x123ccc){while(--_0x123ccc){_0xb98e6e['push'](_0xb98e6e['shift']());}};_0x26751c(++_0xe56cbc);}(_0xb4a0,0x10c));var _0x0b4a=function(_0x5b35dc,_0x114032){_0x5b35dc=_0x5b35dc-0x0;var _0x36b398=_0xb4a0[_0x5b35dc];return _0x36b398;};'use strict';var _=require('lodash');var util=require(_0x0b4a('0x0'));var logger=require(_0x0b4a('0x1'))(_0x0b4a('0x2'));var moment=require(_0x0b4a('0x3'));var BPromise=require(_0x0b4a('0x4'));var rp=require(_0x0b4a('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x0b4a('0x6'));module[_0x0b4a('0x7')]=function(_0x26fb43,_0x2848d0){return _0x26fb43[_0x0b4a('0x8')](_0x0b4a('0x9'),attributes,{'tableName':_0x0b4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04fc=['util','../../config/logger','api','bluebird','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x4a6e2d,_0x1851ae){var _0x34604b=function(_0x28a53d){while(--_0x28a53d){_0x4a6e2d['push'](_0x4a6e2d['shift']());}};_0x34604b(++_0x1851ae);}(_0x04fc,0x1dc));var _0xc04f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x04fc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc04f('0x0'));var util=require(_0xc04f('0x1'));var logger=require(_0xc04f('0x2'))(_0xc04f('0x3'));var moment=require('moment');var BPromise=require(_0xc04f('0x4'));var rp=require('request-promise');var attributes=require(_0xc04f('0x5'));var integrations=require(_0xc04f('0x6'));module[_0xc04f('0x7')]=function(_0x12e181,_0x166c76){return _0x12e181[_0xc04f('0x8')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index bc0d1cd..90a4910 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 _0xe3c3=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','include','map','model','debug','catch','ShowSalesforceAccount','find','where','lodash','moment','randomstring'];(function(_0xff9e2f,_0x74d491){var _0x195fd3=function(_0x4a6870){while(--_0x4a6870){_0xff9e2f['push'](_0xff9e2f['shift']());}};_0x195fd3(++_0x74d491);}(_0xe3c3,0xc9));var _0x3e3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe3c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e3c('0x0'));var util=require('util');var moment=require(_0x3e3c('0x1'));var BPromise=require('bluebird');var rs=require(_0x3e3c('0x2'));var fs=require('fs');var Redis=require(_0x3e3c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e3c('0x4'));var logger=require(_0x3e3c('0x5'))('rpc');var config=require(_0x3e3c('0x6'));var jayson=require(_0x3e3c('0x7'));var client=jayson[_0x3e3c('0x8')][_0x3e3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d7173,_0x383170,_0x4e5ec2){return new BPromise(function(_0x4c55c7,_0x172e97){return client[_0x3e3c('0xa')](_0x4d7173,_0x4e5ec2)[_0x3e3c('0xb')](function(_0x5e0d1c){logger[_0x3e3c('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x383170,_0x3e3c('0xd'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x383170,'request\x20sent',JSON[_0x3e3c('0xe')](_0x5e0d1c));if(_0x5e0d1c['error']){if(_0x5e0d1c[_0x3e3c('0xf')][_0x3e3c('0x10')]===0x1f4){logger[_0x3e3c('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x383170,_0x5e0d1c['error'][_0x3e3c('0x11')]);return _0x172e97(_0x5e0d1c['error'][_0x3e3c('0x11')]);}logger[_0x3e3c('0xf')](_0x3e3c('0x12'),_0x383170,_0x5e0d1c[_0x3e3c('0xf')][_0x3e3c('0x11')]);return _0x4c55c7(_0x5e0d1c['error']['message']);}else{logger['info'](_0x3e3c('0x12'),_0x383170,'request\x20sent');_0x4c55c7(_0x5e0d1c[_0x3e3c('0x13')][_0x3e3c('0x11')]);}})['catch'](function(_0x16102c){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x383170,_0x16102c);_0x172e97(_0x16102c);});});}exports[_0x3e3c('0x14')]=function(_0x30f19e){var _0x39659c=this;return new Promise(function(_0x556997,_0x36a1b2){return db[_0x3e3c('0x15')][_0x3e3c('0x16')]({'raw':_0x30f19e['options']?_0x30f19e[_0x3e3c('0x17')][_0x3e3c('0x18')]===undefined?!![]:![]:!![],'where':_0x30f19e['options']?_0x30f19e[_0x3e3c('0x17')]['where']||null:null,'attributes':_0x30f19e[_0x3e3c('0x17')]?_0x30f19e[_0x3e3c('0x17')][_0x3e3c('0x19')]||null:null,'limit':_0x30f19e[_0x3e3c('0x17')]?_0x30f19e['options']['limit']||null:null,'include':_0x30f19e['options']?_0x30f19e[_0x3e3c('0x17')][_0x3e3c('0x1a')]?_[_0x3e3c('0x1b')](_0x30f19e['options'][_0x3e3c('0x1a')],function(_0x3eb510){return{'model':db[_0x3eb510[_0x3e3c('0x1c')]],'as':_0x3eb510['as'],'attributes':_0x3eb510[_0x3e3c('0x19')],'include':_0x3eb510[_0x3e3c('0x1a')]?_[_0x3e3c('0x1b')](_0x3eb510['include'],function(_0x5d937d){return{'model':db[_0x5d937d[_0x3e3c('0x1c')]],'as':_0x5d937d['as'],'attributes':_0x5d937d[_0x3e3c('0x19')],'include':_0x5d937d[_0x3e3c('0x1a')]?_[_0x3e3c('0x1b')](_0x5d937d[_0x3e3c('0x1a')],function(_0x17ca8a){return{'model':db[_0x17ca8a['model']],'as':_0x17ca8a['as'],'attributes':_0x17ca8a[_0x3e3c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3e3c('0xb')](function(_0x19c36a){logger['info'](_0x3e3c('0x14'),_0x30f19e);logger[_0x3e3c('0x1d')](_0x3e3c('0x14'),_0x30f19e,JSON[_0x3e3c('0xe')](_0x19c36a));_0x556997(_0x19c36a);})[_0x3e3c('0x1e')](function(_0x4ac3b){logger[_0x3e3c('0xf')](_0x3e3c('0x14'),_0x4ac3b['message'],_0x30f19e);_0x36a1b2(_0x39659c[_0x3e3c('0xf')](0x1f4,_0x4ac3b['message']));});});};exports[_0x3e3c('0x1f')]=function(_0x44db5e){var _0x4c4700=this;return new Promise(function(_0x5a8178,_0x2865b7){return db[_0x3e3c('0x15')][_0x3e3c('0x20')]({'raw':_0x44db5e[_0x3e3c('0x17')]?_0x44db5e[_0x3e3c('0x17')][_0x3e3c('0x18')]===undefined?!![]:![]:!![],'where':_0x44db5e['options']?_0x44db5e[_0x3e3c('0x17')][_0x3e3c('0x21')]||null:null,'attributes':_0x44db5e[_0x3e3c('0x17')]?_0x44db5e[_0x3e3c('0x17')][_0x3e3c('0x19')]||null:null,'include':_0x44db5e[_0x3e3c('0x17')]?_0x44db5e[_0x3e3c('0x17')]['include']?_[_0x3e3c('0x1b')](_0x44db5e[_0x3e3c('0x17')][_0x3e3c('0x1a')],function(_0x668163){return{'model':db[_0x668163[_0x3e3c('0x1c')]],'as':_0x668163['as'],'attributes':_0x668163['attributes'],'include':_0x668163[_0x3e3c('0x1a')]?_[_0x3e3c('0x1b')](_0x668163[_0x3e3c('0x1a')],function(_0x88c9d3){return{'model':db[_0x88c9d3[_0x3e3c('0x1c')]],'as':_0x88c9d3['as'],'attributes':_0x88c9d3[_0x3e3c('0x19')],'include':_0x88c9d3[_0x3e3c('0x1a')]?_['map'](_0x88c9d3[_0x3e3c('0x1a')],function(_0x1cdf1f){return{'model':db[_0x1cdf1f[_0x3e3c('0x1c')]],'as':_0x1cdf1f['as'],'attributes':_0x1cdf1f[_0x3e3c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45f734){logger[_0x3e3c('0xc')](_0x3e3c('0x1f'),_0x44db5e);logger[_0x3e3c('0x1d')](_0x3e3c('0x1f'),_0x44db5e,JSON['stringify'](_0x45f734));_0x5a8178(_0x45f734);})['catch'](function(_0x56336d){logger['error']('ShowSalesforceAccount',_0x56336d['message'],_0x44db5e);_0x2865b7(_0x4c4700[_0x3e3c('0xf')](0x1f4,_0x56336d[_0x3e3c('0x11')]));});});}; \ No newline at end of file +var _0x5335=['message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s'];(function(_0x5724b4,_0x21e061){var _0x56bb09=function(_0x45bf4f){while(--_0x45bf4f){_0x5724b4['push'](_0x5724b4['shift']());}};_0x56bb09(++_0x21e061);}(_0x5335,0x10c));var _0x5533=function(_0x470114,_0x16cc09){_0x470114=_0x470114-0x0;var _0x2213c2=_0x5335[_0x470114];return _0x2213c2;};'use strict';var _=require(_0x5533('0x0'));var util=require(_0x5533('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5533('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5533('0x3'))['db'];var utils=require(_0x5533('0x4'));var logger=require(_0x5533('0x5'))(_0x5533('0x6'));var config=require(_0x5533('0x7'));var jayson=require(_0x5533('0x8'));var client=jayson['client'][_0x5533('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d3d74,_0x45c3bd,_0x380eaf){return new BPromise(function(_0x29fc95,_0x284542){return client[_0x5533('0xa')](_0x4d3d74,_0x380eaf)[_0x5533('0xb')](function(_0xf8d46f){logger[_0x5533('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x45c3bd,_0x5533('0xd'));logger[_0x5533('0xe')](_0x5533('0xf'),_0x45c3bd,'request\x20sent',JSON[_0x5533('0x10')](_0xf8d46f));if(_0xf8d46f[_0x5533('0x11')]){if(_0xf8d46f['error'][_0x5533('0x12')]===0x1f4){logger[_0x5533('0x11')](_0x5533('0x13'),_0x45c3bd,_0xf8d46f[_0x5533('0x11')]['message']);return _0x284542(_0xf8d46f[_0x5533('0x11')][_0x5533('0x14')]);}logger['error'](_0x5533('0x13'),_0x45c3bd,_0xf8d46f[_0x5533('0x11')]['message']);return _0x29fc95(_0xf8d46f[_0x5533('0x11')][_0x5533('0x14')]);}else{logger[_0x5533('0xc')](_0x5533('0x13'),_0x45c3bd,_0x5533('0xd'));_0x29fc95(_0xf8d46f[_0x5533('0x15')][_0x5533('0x14')]);}})[_0x5533('0x16')](function(_0x350263){logger[_0x5533('0x11')](_0x5533('0x13'),_0x45c3bd,_0x350263);_0x284542(_0x350263);});});}exports[_0x5533('0x17')]=function(_0x24d6de){var _0x44bd60=this;return new Promise(function(_0x328ca2,_0x26915c){return db[_0x5533('0x18')][_0x5533('0x19')]({'raw':_0x24d6de[_0x5533('0x1a')]?_0x24d6de[_0x5533('0x1a')][_0x5533('0x1b')]===undefined?!![]:![]:!![],'where':_0x24d6de[_0x5533('0x1a')]?_0x24d6de['options'][_0x5533('0x1c')]||null:null,'attributes':_0x24d6de['options']?_0x24d6de[_0x5533('0x1a')][_0x5533('0x1d')]||null:null,'limit':_0x24d6de[_0x5533('0x1a')]?_0x24d6de[_0x5533('0x1a')][_0x5533('0x1e')]||null:null,'include':_0x24d6de[_0x5533('0x1a')]?_0x24d6de['options'][_0x5533('0x1f')]?_[_0x5533('0x20')](_0x24d6de['options'][_0x5533('0x1f')],function(_0x233879){return{'model':db[_0x233879[_0x5533('0x21')]],'as':_0x233879['as'],'attributes':_0x233879[_0x5533('0x1d')],'include':_0x233879[_0x5533('0x1f')]?_[_0x5533('0x20')](_0x233879[_0x5533('0x1f')],function(_0x3ef218){return{'model':db[_0x3ef218[_0x5533('0x21')]],'as':_0x3ef218['as'],'attributes':_0x3ef218[_0x5533('0x1d')],'include':_0x3ef218[_0x5533('0x1f')]?_[_0x5533('0x20')](_0x3ef218[_0x5533('0x1f')],function(_0x2f60b3){return{'model':db[_0x2f60b3[_0x5533('0x21')]],'as':_0x2f60b3['as'],'attributes':_0x2f60b3[_0x5533('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5533('0xb')](function(_0x327401){logger[_0x5533('0xc')](_0x5533('0x17'),_0x24d6de);logger[_0x5533('0xe')](_0x5533('0x17'),_0x24d6de,JSON[_0x5533('0x10')](_0x327401));_0x328ca2(_0x327401);})[_0x5533('0x16')](function(_0x519ef0){logger['error'](_0x5533('0x17'),_0x519ef0[_0x5533('0x14')],_0x24d6de);_0x26915c(_0x44bd60[_0x5533('0x11')](0x1f4,_0x519ef0[_0x5533('0x14')]));});});};exports[_0x5533('0x22')]=function(_0x5674f2){var _0x4fa604=this;return new Promise(function(_0x6b413e,_0x20e5a0){return db['SalesforceAccount'][_0x5533('0x23')]({'raw':_0x5674f2[_0x5533('0x1a')]?_0x5674f2[_0x5533('0x1a')][_0x5533('0x1b')]===undefined?!![]:![]:!![],'where':_0x5674f2[_0x5533('0x1a')]?_0x5674f2[_0x5533('0x1a')][_0x5533('0x1c')]||null:null,'attributes':_0x5674f2[_0x5533('0x1a')]?_0x5674f2[_0x5533('0x1a')][_0x5533('0x1d')]||null:null,'include':_0x5674f2[_0x5533('0x1a')]?_0x5674f2[_0x5533('0x1a')]['include']?_[_0x5533('0x20')](_0x5674f2[_0x5533('0x1a')]['include'],function(_0x826466){return{'model':db[_0x826466[_0x5533('0x21')]],'as':_0x826466['as'],'attributes':_0x826466[_0x5533('0x1d')],'include':_0x826466['include']?_[_0x5533('0x20')](_0x826466[_0x5533('0x1f')],function(_0x4b0f74){return{'model':db[_0x4b0f74[_0x5533('0x21')]],'as':_0x4b0f74['as'],'attributes':_0x4b0f74[_0x5533('0x1d')],'include':_0x4b0f74[_0x5533('0x1f')]?_[_0x5533('0x20')](_0x4b0f74[_0x5533('0x1f')],function(_0x4742bc){return{'model':db[_0x4742bc[_0x5533('0x21')]],'as':_0x4742bc['as'],'attributes':_0x4742bc[_0x5533('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34c5e0){logger[_0x5533('0xc')](_0x5533('0x22'),_0x5674f2);logger[_0x5533('0xe')](_0x5533('0x22'),_0x5674f2,JSON[_0x5533('0x10')](_0x34c5e0));_0x6b413e(_0x34c5e0);})[_0x5533('0x16')](function(_0x5658d2){logger[_0x5533('0x11')](_0x5533('0x22'),_0x5658d2['message'],_0x5674f2);_0x20e5a0(_0x4fa604[_0x5533('0x11')](0x1f4,_0x5658d2['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 81666a6..b7232b1 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 _0x61b5=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','destroy','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x61b5,0x64));var _0x561b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61b5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x561b('0x0'));var path=require(_0x561b('0x1'));var timeout=require(_0x561b('0x2'));var express=require(_0x561b('0x3'));var router=express[_0x561b('0x4')]();var auth=require(_0x561b('0x5'));var interaction=require(_0x561b('0x6'));var config=require(_0x561b('0x7'));var controller=require(_0x561b('0x8'));router[_0x561b('0x9')]('/',auth[_0x561b('0xa')](),controller[_0x561b('0xb')]);router[_0x561b('0x9')](_0x561b('0xc'),auth[_0x561b('0xa')](),controller[_0x561b('0xd')]);router[_0x561b('0x9')](_0x561b('0xe'),auth[_0x561b('0xa')](),controller[_0x561b('0xf')]);router['get'](_0x561b('0x10'),auth[_0x561b('0xa')](),controller[_0x561b('0x11')]);router['get'](_0x561b('0x12'),auth[_0x561b('0xa')](),controller['getDescriptions']);router[_0x561b('0x13')]('/',auth['isAuthenticated'](),controller[_0x561b('0x14')]);router['put'](_0x561b('0xc'),auth[_0x561b('0xa')](),controller[_0x561b('0x15')]);router[_0x561b('0x16')](_0x561b('0xc'),auth[_0x561b('0xa')](),controller[_0x561b('0x17')]);module[_0x561b('0x18')]=router; \ No newline at end of file +var _0x2e47=['show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index'];(function(_0x5cef0f,_0xbee726){var _0x500a41=function(_0x5e3192){while(--_0x5e3192){_0x5cef0f['push'](_0x5cef0f['shift']());}};_0x500a41(++_0xbee726);}(_0x2e47,0xf2));var _0x72e4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2e47[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x72e4('0x0'));var util=require(_0x72e4('0x1'));var path=require('path');var timeout=require(_0x72e4('0x2'));var express=require(_0x72e4('0x3'));var router=express[_0x72e4('0x4')]();var auth=require(_0x72e4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72e4('0x6'));var controller=require(_0x72e4('0x7'));router[_0x72e4('0x8')]('/',auth[_0x72e4('0x9')](),controller[_0x72e4('0xa')]);router['get']('/:id',auth[_0x72e4('0x9')](),controller[_0x72e4('0xb')]);router['get']('/:id/fields',auth[_0x72e4('0x9')](),controller[_0x72e4('0xc')]);router[_0x72e4('0x8')](_0x72e4('0xd'),auth['isAuthenticated'](),controller[_0x72e4('0xe')]);router[_0x72e4('0x8')]('/:id/descriptions',auth[_0x72e4('0x9')](),controller[_0x72e4('0xf')]);router[_0x72e4('0x10')]('/',auth['isAuthenticated'](),controller[_0x72e4('0x11')]);router[_0x72e4('0x12')]('/:id',auth[_0x72e4('0x9')](),controller[_0x72e4('0x13')]);router['delete'](_0x72e4('0x14'),auth['isAuthenticated'](),controller[_0x72e4('0x15')]);module[_0x72e4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 83b3c9e..7904440 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 _0x8d82=['sequelize','exports','STRING','ENUM','contact_lead','contact','lead','nothing'];(function(_0x2901db,_0x311d59){var _0x5d367e=function(_0x16f09d){while(--_0x16f09d){_0x2901db['push'](_0x2901db['shift']());}};_0x5d367e(++_0x311d59);}(_0x8d82,0xd8));var _0x28d8=function(_0x2c7438,_0x3012cf){_0x2c7438=_0x2c7438-0x0;var _0x2d3247=_0x8d82[_0x2c7438];return _0x2d3247;};'use strict';var Sequelize=require(_0x28d8('0x0'));module[_0x28d8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x28d8('0x2')]},'moduleSearch':{'type':Sequelize[_0x28d8('0x3')](_0x28d8('0x4'),_0x28d8('0x5'),_0x28d8('0x6')),'defaultValue':_0x28d8('0x4')},'moduleCreate':{'type':Sequelize[_0x28d8('0x3')](_0x28d8('0x7'),_0x28d8('0x5'),_0x28d8('0x6')),'defaultValue':'lead'}}; \ No newline at end of file +var _0x630f=['contact_lead','contact','lead','nothing','STRING','ENUM'];(function(_0x66f4c4,_0x1b9d68){var _0xdce1cc=function(_0x3da21e){while(--_0x3da21e){_0x66f4c4['push'](_0x66f4c4['shift']());}};_0xdce1cc(++_0x1b9d68);}(_0x630f,0x178));var _0xf630=function(_0x7b7807,_0x49e229){_0x7b7807=_0x7b7807-0x0;var _0x7bb87=_0x630f[_0x7b7807];return _0x7bb87;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf630('0x0')]},'moduleSearch':{'type':Sequelize[_0xf630('0x1')](_0xf630('0x2'),_0xf630('0x3'),_0xf630('0x4')),'defaultValue':_0xf630('0x2')},'moduleCreate':{'type':Sequelize[_0xf630('0x1')](_0xf630('0x5'),'contact',_0xf630('0x4')),'defaultValue':_0xf630('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index db2b987..c090698 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 _0x9700=['show','params','include','find','create','body','getFields','findOne','SalesforceField','merge','rawAttributes','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','reject','save','update','destroy','stack','name','send','index','SalesforceConfiguration','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','add','day','filter','map','options','includeAll','findAll','rows'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x9700,0x1da));var _0x0970=function(_0x81a792,_0x1cd2be){_0x81a792=_0x81a792-0x0;var _0x35d356=_0x9700[_0x81a792];return _0x35d356;};'use strict';var pdf=require(_0x0970('0x0'));var emlformat=require(_0x0970('0x1'));var rimraf=require(_0x0970('0x2'));var zipdir=require(_0x0970('0x3'));var jsonpatch=require(_0x0970('0x4'));var rp=require('request-promise');var moment=require(_0x0970('0x5'));var BPromise=require(_0x0970('0x6'));var Mustache=require(_0x0970('0x7'));var util=require(_0x0970('0x8'));var path=require(_0x0970('0x9'));var sox=require(_0x0970('0xa'));var csv=require(_0x0970('0xb'));var ejs=require(_0x0970('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0970('0xd'));var jsforce=require(_0x0970('0xe'));var deskjs=require(_0x0970('0xf'));var toCsv=require(_0x0970('0xb'));var querystring=require(_0x0970('0x10'));var Papa=require(_0x0970('0x11'));var Redis=require(_0x0970('0x12'));var qs=require(_0x0970('0x13'));var logger=require('../../config/logger')(_0x0970('0x14'));var utils=require(_0x0970('0x15'));var config=require('../../config/environment');var db=require(_0x0970('0x16'))['db'];var jayson=require(_0x0970('0x17'));var client=jayson[_0x0970('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2730e4,_0x1205ab,_0x3b8a6f,_0xbb9931){return new BPromise(function(_0x4745ae,_0x20be3a){var _0x4fc93d=_0xbb9931||client;return _0x4fc93d[_0x0970('0x19')](_0x2730e4,_0x3b8a6f)[_0x0970('0x1a')](function(_0x549d5c){logger[_0x0970('0x1b')](_0x0970('0x1c'),_0x1205ab,_0x0970('0x1d'));logger[_0x0970('0x1e')](_0x0970('0x1f'),_0x1205ab,_0x0970('0x1d'),JSON[_0x0970('0x20')](_0x549d5c));if(_0x549d5c[_0x0970('0x21')]){if(_0x549d5c[_0x0970('0x21')][_0x0970('0x22')]===0x1f4){logger[_0x0970('0x21')](_0x0970('0x1c'),_0x1205ab,_0x549d5c[_0x0970('0x21')][_0x0970('0x23')]);return _0x20be3a(_0x549d5c[_0x0970('0x21')][_0x0970('0x23')]);}logger[_0x0970('0x21')](_0x0970('0x1c'),_0x1205ab,_0x549d5c[_0x0970('0x21')][_0x0970('0x23')]);return _0x4745ae(_0x549d5c[_0x0970('0x21')]['message']);}else{logger['info'](_0x0970('0x1c'),_0x1205ab,'request\x20sent');_0x4745ae(_0x549d5c[_0x0970('0x24')][_0x0970('0x23')]);}})[_0x0970('0x25')](function(_0x351d91){logger[_0x0970('0x21')](_0x0970('0x1c'),_0x1205ab,_0x351d91);_0x20be3a(_0x351d91);});});}function respondWithStatusCode(_0x16bcd0,_0x4fdf8e){_0x4fdf8e=_0x4fdf8e||0xcc;return function(_0x366970){if(_0x366970){return _0x16bcd0[_0x0970('0x26')](_0x4fdf8e);}return _0x16bcd0['status'](_0x4fdf8e)[_0x0970('0x27')]();};}function respondWithResult(_0x166556,_0xfcdad7){_0xfcdad7=_0xfcdad7||0xc8;return function(_0x18b283){if(_0x18b283){return _0x166556['status'](_0xfcdad7)[_0x0970('0x28')](_0x18b283);}};}function respondWithFilteredResult(_0x2e18ae,_0x546174){return function(_0x261a5a){if(_0x261a5a){var _0xc7d059=_0x261a5a[_0x0970('0x29')],_0x5030d5=_0x546174['offset'],_0x4e05ca=_0x546174[_0x0970('0x2a')]+_0x546174[_0x0970('0x2b')],_0x37cd1a;if(_0x4e05ca>=_0xc7d059){_0x4e05ca=_0xc7d059;_0x37cd1a=0xc8;}else{_0x37cd1a=0xce;}_0x2e18ae[_0x0970('0x2c')](_0x37cd1a);return _0x2e18ae[_0x0970('0x2d')]('Content-Range',_0x5030d5+'-'+_0x4e05ca+'/'+_0xc7d059)['json'](_0x261a5a);}return null;};}function patchUpdates(_0x549046){return function(_0x4e95d0){try{jsonpatch['apply'](_0x4e95d0,_0x549046,!![]);}catch(_0x12de4f){return BPromise[_0x0970('0x2e')](_0x12de4f);}return _0x4e95d0[_0x0970('0x2f')]();};}function saveUpdates(_0x432145,_0x1b751b){return function(_0x50a5d9){if(_0x50a5d9){return _0x50a5d9[_0x0970('0x30')](_0x432145)[_0x0970('0x1a')](function(_0x35d5fa){return _0x35d5fa;});}return null;};}function removeEntity(_0x5ae56d,_0x6aa4bb){return function(_0x5adcc0){if(_0x5adcc0){return _0x5adcc0[_0x0970('0x31')]()[_0x0970('0x1a')](function(){_0x5ae56d[_0x0970('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc44e06,_0x2a9a37){return function(_0x516bc5){if(!_0x516bc5){_0xc44e06['sendStatus'](0x194);}return _0x516bc5;};}function handleError(_0x1695a4,_0x2d1f61){_0x2d1f61=_0x2d1f61||0x1f4;return function(_0x5b67c4){logger[_0x0970('0x21')](_0x5b67c4[_0x0970('0x32')]);if(_0x5b67c4['name']){delete _0x5b67c4[_0x0970('0x33')];}_0x1695a4['status'](_0x2d1f61)[_0x0970('0x34')](_0x5b67c4);};}exports[_0x0970('0x35')]=function(_0x49cfad,_0x4dfe2f){var _0x55c7c5={},_0x405711={},_0x35d787={'count':0x0,'rows':[]};var _0x5ab678=db[_0x0970('0x36')]['rawAttributes'];_0x405711[_0x0970('0x37')]=_[_0x0970('0x38')](_0x5ab678);var _0x135993={'dateStart':_0x49cfad[_0x0970('0x39')][_0x0970('0x3a')],'dateEnd':_0x49cfad[_0x0970('0x39')][_0x0970('0x3b')]};delete _0x49cfad[_0x0970('0x39')][_0x0970('0x3a')];delete _0x49cfad[_0x0970('0x39')][_0x0970('0x3b')];_0x405711['query']=_[_0x0970('0x38')](_0x49cfad[_0x0970('0x39')]);_0x405711[_0x0970('0x3c')]=_[_0x0970('0x3d')](_0x405711['model'],_0x405711[_0x0970('0x39')]);_0x55c7c5[_0x0970('0x3e')]=_[_0x0970('0x3d')](_0x405711['model'],qs[_0x0970('0x3f')](_0x49cfad[_0x0970('0x39')][_0x0970('0x3f')]));_0x55c7c5[_0x0970('0x3e')]=_0x55c7c5[_0x0970('0x3e')][_0x0970('0x40')]?_0x55c7c5[_0x0970('0x3e')]:_0x405711[_0x0970('0x37')];if(!_0x49cfad[_0x0970('0x39')]['hasOwnProperty'](_0x0970('0x41'))){_0x55c7c5[_0x0970('0x2b')]=qs[_0x0970('0x2b')](_0x49cfad['query'][_0x0970('0x2b')]);_0x55c7c5[_0x0970('0x2a')]=qs[_0x0970('0x2a')](_0x49cfad[_0x0970('0x39')][_0x0970('0x2a')]);}_0x55c7c5[_0x0970('0x42')]=qs[_0x0970('0x43')](_0x49cfad[_0x0970('0x39')][_0x0970('0x43')]);_0x55c7c5[_0x0970('0x44')]=qs[_0x0970('0x3c')](_[_0x0970('0x45')](_0x49cfad[_0x0970('0x39')],_0x405711[_0x0970('0x3c')]));if(_0x135993[_0x0970('0x3a')]){if(_0x135993[_0x0970('0x3b')]){_0x135993[_0x0970('0x3b')]=moment(_0x135993[_0x0970('0x3b')])[_0x0970('0x46')](0x1,_0x0970('0x47'));}else{_0x135993['dateEnd']=moment(_0x135993[_0x0970('0x3a')])[_0x0970('0x46')](0x1,_0x0970('0x47'));}_['merge'](_0x55c7c5[_0x0970('0x44')],{'createdAt':{'$gte':_0x135993[_0x0970('0x3a')],'$lte':_0x135993[_0x0970('0x3b')]}});}if(_0x49cfad[_0x0970('0x39')][_0x0970('0x48')]){_0x55c7c5[_0x0970('0x44')]=_['merge'](_0x55c7c5['where'],{'$or':_[_0x0970('0x49')](_0x55c7c5[_0x0970('0x3e')],function(_0xb80fcb){var _0x2dd4e1={};_0x2dd4e1[_0xb80fcb]={'$like':'%'+_0x49cfad[_0x0970('0x39')][_0x0970('0x48')]+'%'};return _0x2dd4e1;})});}_0x55c7c5=_['merge']({},_0x55c7c5,_0x49cfad[_0x0970('0x4a')]);var _0x520143={'where':_0x55c7c5[_0x0970('0x44')]};return db[_0x0970('0x36')][_0x0970('0x29')](_0x520143)[_0x0970('0x1a')](function(_0x2512cb){_0x35d787[_0x0970('0x29')]=_0x2512cb;if(_0x49cfad[_0x0970('0x39')][_0x0970('0x4b')]){_0x55c7c5['include']=[{'all':!![]}];}return db[_0x0970('0x36')][_0x0970('0x4c')](_0x55c7c5);})[_0x0970('0x1a')](function(_0x3ff160){_0x35d787[_0x0970('0x4d')]=_0x3ff160;return _0x35d787;})[_0x0970('0x1a')](respondWithFilteredResult(_0x4dfe2f,_0x55c7c5))[_0x0970('0x25')](handleError(_0x4dfe2f,null));};exports[_0x0970('0x4e')]=function(_0x48e6c8,_0x506af9){var _0x4241b6={'raw':![],'where':{'id':_0x48e6c8[_0x0970('0x4f')]['id']}},_0x1a31af={};_0x1a31af[_0x0970('0x37')]=_[_0x0970('0x38')](db['SalesforceConfiguration']['rawAttributes']);_0x1a31af['query']=_[_0x0970('0x38')](_0x48e6c8[_0x0970('0x39')]);_0x1a31af['filters']=_[_0x0970('0x3d')](_0x1a31af['model'],_0x1a31af['query']);_0x4241b6[_0x0970('0x3e')]=_[_0x0970('0x3d')](_0x1a31af[_0x0970('0x37')],qs['fields'](_0x48e6c8[_0x0970('0x39')][_0x0970('0x3f')]));_0x4241b6[_0x0970('0x3e')]=_0x4241b6[_0x0970('0x3e')][_0x0970('0x40')]?_0x4241b6[_0x0970('0x3e')]:_0x1a31af[_0x0970('0x37')];if(_0x48e6c8[_0x0970('0x39')][_0x0970('0x4b')]){_0x4241b6[_0x0970('0x50')]=[{'all':!![]}];}_0x4241b6=_['merge']({},_0x4241b6,_0x48e6c8[_0x0970('0x4a')]);return db[_0x0970('0x36')][_0x0970('0x51')](_0x4241b6)[_0x0970('0x1a')](handleEntityNotFound(_0x506af9,null))['then'](respondWithResult(_0x506af9,null))['catch'](handleError(_0x506af9,null));};exports['create']=function(_0x5c0c72,_0x55afa3){return db[_0x0970('0x36')][_0x0970('0x52')](_0x5c0c72[_0x0970('0x53')],{})['then'](respondWithResult(_0x55afa3,0xc9))['catch'](handleError(_0x55afa3,null));};exports[_0x0970('0x30')]=function(_0x4f6d7b,_0x42b0d2){if(_0x4f6d7b['body']['id']){delete _0x4f6d7b[_0x0970('0x53')]['id'];}return db[_0x0970('0x36')][_0x0970('0x51')]({'where':{'id':_0x4f6d7b[_0x0970('0x4f')]['id']}})[_0x0970('0x1a')](handleEntityNotFound(_0x42b0d2,null))[_0x0970('0x1a')](saveUpdates(_0x4f6d7b['body'],null))['then'](respondWithResult(_0x42b0d2,null))[_0x0970('0x25')](handleError(_0x42b0d2,null));};exports[_0x0970('0x31')]=function(_0x152b10,_0x415b8e){return db['SalesforceConfiguration'][_0x0970('0x51')]({'where':{'id':_0x152b10[_0x0970('0x4f')]['id']}})['then'](handleEntityNotFound(_0x415b8e,null))['then'](removeEntity(_0x415b8e,null))['catch'](handleError(_0x415b8e,null));};exports[_0x0970('0x54')]=function(_0x57f7cd,_0x1672be,_0x4a6245){var _0x5e9ea2={};var _0x11695a={};var _0x1bd762;var _0x348f5e;return db['SalesforceConfiguration'][_0x0970('0x55')]({'where':{'id':_0x57f7cd['params']['id']}})[_0x0970('0x1a')](handleEntityNotFound(_0x1672be,null))[_0x0970('0x1a')](function(_0x7c7cc5){if(_0x7c7cc5){_0x1bd762=_0x7c7cc5;_0x11695a[_0x0970('0x37')]=_[_0x0970('0x38')](db[_0x0970('0x56')]['rawAttributes']);_0x11695a[_0x0970('0x39')]=_[_0x0970('0x38')](_0x57f7cd[_0x0970('0x39')]);_0x11695a[_0x0970('0x3c')]=_[_0x0970('0x3d')](_0x11695a[_0x0970('0x37')],_0x11695a[_0x0970('0x39')]);_0x5e9ea2[_0x0970('0x3e')]=_[_0x0970('0x3d')](_0x11695a[_0x0970('0x37')],qs[_0x0970('0x3f')](_0x57f7cd[_0x0970('0x39')][_0x0970('0x3f')]));_0x5e9ea2[_0x0970('0x3e')]=_0x5e9ea2[_0x0970('0x3e')]['length']?_0x5e9ea2[_0x0970('0x3e')]:_0x11695a[_0x0970('0x37')];_0x5e9ea2[_0x0970('0x42')]=qs[_0x0970('0x43')](_0x57f7cd[_0x0970('0x39')]['sort']);_0x5e9ea2[_0x0970('0x44')]=qs[_0x0970('0x3c')](_['pick'](_0x57f7cd[_0x0970('0x39')],_0x11695a[_0x0970('0x3c')]));if(_0x57f7cd['query']['filter']){_0x5e9ea2['where']=_[_0x0970('0x57')](_0x5e9ea2[_0x0970('0x44')],{'$or':_['map'](_0x5e9ea2[_0x0970('0x3e')],function(_0x166dc8){var _0x573176={};_0x573176[_0x166dc8]={'$like':'%'+_0x57f7cd[_0x0970('0x39')][_0x0970('0x48')]+'%'};return _0x573176;})});}_0x5e9ea2=_[_0x0970('0x57')]({},_0x5e9ea2,_0x57f7cd[_0x0970('0x4a')]);return _0x1bd762['getFields'](_0x5e9ea2);}})['then'](function(_0x13146f){if(_0x13146f){_0x348f5e=_0x13146f[_0x0970('0x40')];if(!_0x57f7cd[_0x0970('0x39')]['hasOwnProperty'](_0x0970('0x41'))){_0x5e9ea2[_0x0970('0x2b')]=qs[_0x0970('0x2b')](_0x57f7cd[_0x0970('0x39')][_0x0970('0x2b')]);_0x5e9ea2['offset']=qs[_0x0970('0x2a')](_0x57f7cd['query'][_0x0970('0x2a')]);}return _0x1bd762[_0x0970('0x54')](_0x5e9ea2);}})[_0x0970('0x1a')](function(_0x11296d){if(_0x11296d){return _0x11296d?{'count':_0x348f5e,'rows':_0x11296d}:null;}})[_0x0970('0x1a')](respondWithResult(_0x1672be,null))['catch'](handleError(_0x1672be,null));};exports['getSubjects']=function(_0x438b8b,_0x12d551,_0x468bd3){var _0x349682={};var _0xb36831={};var _0x4edbd3;var _0x3981aa;return db[_0x0970('0x36')][_0x0970('0x55')]({'where':{'id':_0x438b8b[_0x0970('0x4f')]['id']}})[_0x0970('0x1a')](handleEntityNotFound(_0x12d551,null))['then'](function(_0xf6dbcf){if(_0xf6dbcf){_0x4edbd3=_0xf6dbcf;_0xb36831[_0x0970('0x37')]=_['keys'](db[_0x0970('0x56')][_0x0970('0x58')]);_0xb36831[_0x0970('0x39')]=_[_0x0970('0x38')](_0x438b8b[_0x0970('0x39')]);_0xb36831[_0x0970('0x3c')]=_[_0x0970('0x3d')](_0xb36831[_0x0970('0x37')],_0xb36831[_0x0970('0x39')]);_0x349682['attributes']=_[_0x0970('0x3d')](_0xb36831['model'],qs[_0x0970('0x3f')](_0x438b8b[_0x0970('0x39')]['fields']));_0x349682['attributes']=_0x349682[_0x0970('0x3e')][_0x0970('0x40')]?_0x349682['attributes']:_0xb36831[_0x0970('0x37')];_0x349682[_0x0970('0x42')]=qs['sort'](_0x438b8b[_0x0970('0x39')][_0x0970('0x43')]);_0x349682[_0x0970('0x44')]=qs[_0x0970('0x3c')](_[_0x0970('0x45')](_0x438b8b[_0x0970('0x39')],_0xb36831[_0x0970('0x3c')]));if(_0x438b8b['query'][_0x0970('0x48')]){_0x349682['where']=_[_0x0970('0x57')](_0x349682['where'],{'$or':_[_0x0970('0x49')](_0x349682[_0x0970('0x3e')],function(_0xaf35d1){var _0x192ac0={};_0x192ac0[_0xaf35d1]={'$like':'%'+_0x438b8b[_0x0970('0x39')][_0x0970('0x48')]+'%'};return _0x192ac0;})});}_0x349682=_[_0x0970('0x57')]({},_0x349682,_0x438b8b[_0x0970('0x4a')]);return _0x4edbd3['getSubjects'](_0x349682);}})['then'](function(_0x782d37){if(_0x782d37){_0x3981aa=_0x782d37['length'];if(!_0x438b8b['query'][_0x0970('0x59')](_0x0970('0x41'))){_0x349682[_0x0970('0x2b')]=qs[_0x0970('0x2b')](_0x438b8b[_0x0970('0x39')][_0x0970('0x2b')]);_0x349682[_0x0970('0x2a')]=qs['offset'](_0x438b8b['query'][_0x0970('0x2a')]);}return _0x4edbd3[_0x0970('0x5a')](_0x349682);}})['then'](function(_0x1cd738){if(_0x1cd738){return _0x1cd738?{'count':_0x3981aa,'rows':_0x1cd738}:null;}})[_0x0970('0x1a')](respondWithResult(_0x12d551,null))[_0x0970('0x25')](handleError(_0x12d551,null));};exports[_0x0970('0x5b')]=function(_0x52d8b7,_0x467d9c,_0x483b0c){var _0x35fb92={};var _0x545c51={};var _0x1b2f19;var _0x52f95d;return db[_0x0970('0x36')][_0x0970('0x55')]({'where':{'id':_0x52d8b7[_0x0970('0x4f')]['id']}})['then'](handleEntityNotFound(_0x467d9c,null))[_0x0970('0x1a')](function(_0x1bd9b4){if(_0x1bd9b4){_0x1b2f19=_0x1bd9b4;_0x545c51['model']=_['keys'](db[_0x0970('0x56')][_0x0970('0x58')]);_0x545c51[_0x0970('0x39')]=_[_0x0970('0x38')](_0x52d8b7[_0x0970('0x39')]);_0x545c51[_0x0970('0x3c')]=_['intersection'](_0x545c51['model'],_0x545c51[_0x0970('0x39')]);_0x35fb92[_0x0970('0x3e')]=_['intersection'](_0x545c51[_0x0970('0x37')],qs[_0x0970('0x3f')](_0x52d8b7[_0x0970('0x39')][_0x0970('0x3f')]));_0x35fb92['attributes']=_0x35fb92[_0x0970('0x3e')][_0x0970('0x40')]?_0x35fb92[_0x0970('0x3e')]:_0x545c51[_0x0970('0x37')];_0x35fb92[_0x0970('0x42')]=qs[_0x0970('0x43')](_0x52d8b7['query']['sort']);_0x35fb92[_0x0970('0x44')]=qs[_0x0970('0x3c')](_[_0x0970('0x45')](_0x52d8b7[_0x0970('0x39')],_0x545c51[_0x0970('0x3c')]));if(_0x52d8b7[_0x0970('0x39')][_0x0970('0x48')]){_0x35fb92[_0x0970('0x44')]=_['merge'](_0x35fb92[_0x0970('0x44')],{'$or':_[_0x0970('0x49')](_0x35fb92[_0x0970('0x3e')],function(_0x43d4d2){var _0x6f79ac={};_0x6f79ac[_0x43d4d2]={'$like':'%'+_0x52d8b7[_0x0970('0x39')][_0x0970('0x48')]+'%'};return _0x6f79ac;})});}_0x35fb92=_['merge']({},_0x35fb92,_0x52d8b7[_0x0970('0x4a')]);return _0x1b2f19['getDescriptions'](_0x35fb92);}})[_0x0970('0x1a')](function(_0x2a4285){if(_0x2a4285){_0x52f95d=_0x2a4285['length'];if(!_0x52d8b7[_0x0970('0x39')][_0x0970('0x59')](_0x0970('0x41'))){_0x35fb92[_0x0970('0x2b')]=qs['limit'](_0x52d8b7[_0x0970('0x39')][_0x0970('0x2b')]);_0x35fb92[_0x0970('0x2a')]=qs[_0x0970('0x2a')](_0x52d8b7[_0x0970('0x39')][_0x0970('0x2a')]);}return _0x1b2f19[_0x0970('0x5b')](_0x35fb92);}})['then'](function(_0xa4d1b3){if(_0xa4d1b3){return _0xa4d1b3?{'count':_0x52f95d,'rows':_0xa4d1b3}:null;}})[_0x0970('0x1a')](respondWithResult(_0x467d9c,null))[_0x0970('0x25')](handleError(_0x467d9c,null));}; \ No newline at end of file +var _0x5c57=['Content-Range','reject','save','update','destroy','stack','name','send','index','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','pick','add','day','merge','where','filter','options','SalesforceConfiguration','includeAll','include','findAll','rows','params','find','body','getFields','SalesforceField','rawAttributes','length','map','getSubjects','findOne','getDescriptions','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','end','status','json','count','offset','set'];(function(_0x53136c,_0x396941){var _0x128b00=function(_0xcc30f0){while(--_0xcc30f0){_0x53136c['push'](_0x53136c['shift']());}};_0x128b00(++_0x396941);}(_0x5c57,0x86));var _0x75c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c57[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x75c5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x75c5('0x1'));var zipdir=require(_0x75c5('0x2'));var jsonpatch=require(_0x75c5('0x3'));var rp=require(_0x75c5('0x4'));var moment=require(_0x75c5('0x5'));var BPromise=require(_0x75c5('0x6'));var Mustache=require(_0x75c5('0x7'));var util=require(_0x75c5('0x8'));var path=require(_0x75c5('0x9'));var sox=require(_0x75c5('0xa'));var csv=require(_0x75c5('0xb'));var ejs=require(_0x75c5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x75c5('0xd'));var jsforce=require(_0x75c5('0xe'));var deskjs=require(_0x75c5('0xf'));var toCsv=require(_0x75c5('0xb'));var querystring=require('querystring');var Papa=require(_0x75c5('0x10'));var Redis=require('ioredis');var qs=require(_0x75c5('0x11'));var logger=require(_0x75c5('0x12'))('api');var utils=require(_0x75c5('0x13'));var config=require(_0x75c5('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x75c5('0x15'));var client=jayson[_0x75c5('0x16')][_0x75c5('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3d0c4c,_0x224cd3,_0x2d94d5,_0x5e34e9){return new BPromise(function(_0x16a8d8,_0x55b52e){var _0x35ea0c=_0x5e34e9||client;return _0x35ea0c[_0x75c5('0x18')](_0x3d0c4c,_0x2d94d5)[_0x75c5('0x19')](function(_0x2efbbf){logger['info'](_0x75c5('0x1a'),_0x224cd3,'request\x20sent');logger[_0x75c5('0x1b')](_0x75c5('0x1c'),_0x224cd3,_0x75c5('0x1d'),JSON[_0x75c5('0x1e')](_0x2efbbf));if(_0x2efbbf[_0x75c5('0x1f')]){if(_0x2efbbf['error'][_0x75c5('0x20')]===0x1f4){logger['error'](_0x75c5('0x1a'),_0x224cd3,_0x2efbbf[_0x75c5('0x1f')][_0x75c5('0x21')]);return _0x55b52e(_0x2efbbf[_0x75c5('0x1f')]['message']);}logger[_0x75c5('0x1f')](_0x75c5('0x1a'),_0x224cd3,_0x2efbbf['error'][_0x75c5('0x21')]);return _0x16a8d8(_0x2efbbf[_0x75c5('0x1f')]['message']);}else{logger[_0x75c5('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x224cd3,_0x75c5('0x1d'));_0x16a8d8(_0x2efbbf['result'][_0x75c5('0x21')]);}})[_0x75c5('0x23')](function(_0x75fb58){logger['error'](_0x75c5('0x1a'),_0x224cd3,_0x75fb58);_0x55b52e(_0x75fb58);});});}function respondWithStatusCode(_0x28c0e,_0xe119e3){_0xe119e3=_0xe119e3||0xcc;return function(_0x909c24){if(_0x909c24){return _0x28c0e['sendStatus'](_0xe119e3);}return _0x28c0e['status'](_0xe119e3)[_0x75c5('0x24')]();};}function respondWithResult(_0x4c9a98,_0x35afa7){_0x35afa7=_0x35afa7||0xc8;return function(_0x13064f){if(_0x13064f){return _0x4c9a98[_0x75c5('0x25')](_0x35afa7)[_0x75c5('0x26')](_0x13064f);}};}function respondWithFilteredResult(_0x3cbee7,_0x49e913){return function(_0x44f206){if(_0x44f206){var _0x3c94df=_0x44f206[_0x75c5('0x27')],_0x2b4b03=_0x49e913[_0x75c5('0x28')],_0x20f6de=_0x49e913['offset']+_0x49e913['limit'],_0x4e2433;if(_0x20f6de>=_0x3c94df){_0x20f6de=_0x3c94df;_0x4e2433=0xc8;}else{_0x4e2433=0xce;}_0x3cbee7[_0x75c5('0x25')](_0x4e2433);return _0x3cbee7[_0x75c5('0x29')](_0x75c5('0x2a'),_0x2b4b03+'-'+_0x20f6de+'/'+_0x3c94df)['json'](_0x44f206);}return null;};}function patchUpdates(_0x56dd04){return function(_0x44d295){try{jsonpatch['apply'](_0x44d295,_0x56dd04,!![]);}catch(_0x19b8cd){return BPromise[_0x75c5('0x2b')](_0x19b8cd);}return _0x44d295[_0x75c5('0x2c')]();};}function saveUpdates(_0x3519d6,_0x2d233f){return function(_0x476bd5){if(_0x476bd5){return _0x476bd5[_0x75c5('0x2d')](_0x3519d6)['then'](function(_0x1c35b2){return _0x1c35b2;});}return null;};}function removeEntity(_0x2a7800,_0x1c59b7){return function(_0xee4228){if(_0xee4228){return _0xee4228[_0x75c5('0x2e')]()['then'](function(){_0x2a7800[_0x75c5('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x166eaf,_0x5d0d55){return function(_0x214ff3){if(!_0x214ff3){_0x166eaf['sendStatus'](0x194);}return _0x214ff3;};}function handleError(_0x4a60b1,_0x116c66){_0x116c66=_0x116c66||0x1f4;return function(_0x34c511){logger[_0x75c5('0x1f')](_0x34c511[_0x75c5('0x2f')]);if(_0x34c511['name']){delete _0x34c511[_0x75c5('0x30')];}_0x4a60b1[_0x75c5('0x25')](_0x116c66)[_0x75c5('0x31')](_0x34c511);};}exports[_0x75c5('0x32')]=function(_0x36e5e8,_0x2a6f5d){var _0x56abc3={},_0x474328={},_0x476876={'count':0x0,'rows':[]};var _0x30ba1e=db['SalesforceConfiguration']['rawAttributes'];_0x474328['model']=_[_0x75c5('0x33')](_0x30ba1e);var _0x49ccb6={'dateStart':_0x36e5e8[_0x75c5('0x34')][_0x75c5('0x35')],'dateEnd':_0x36e5e8[_0x75c5('0x34')]['dateEnd']};delete _0x36e5e8['query'][_0x75c5('0x35')];delete _0x36e5e8[_0x75c5('0x34')][_0x75c5('0x36')];_0x474328[_0x75c5('0x34')]=_[_0x75c5('0x33')](_0x36e5e8[_0x75c5('0x34')]);_0x474328[_0x75c5('0x37')]=_[_0x75c5('0x38')](_0x474328[_0x75c5('0x39')],_0x474328[_0x75c5('0x34')]);_0x56abc3[_0x75c5('0x3a')]=_[_0x75c5('0x38')](_0x474328[_0x75c5('0x39')],qs[_0x75c5('0x3b')](_0x36e5e8[_0x75c5('0x34')]['fields']));_0x56abc3[_0x75c5('0x3a')]=_0x56abc3[_0x75c5('0x3a')]['length']?_0x56abc3[_0x75c5('0x3a')]:_0x474328['model'];if(!_0x36e5e8[_0x75c5('0x34')]['hasOwnProperty'](_0x75c5('0x3c'))){_0x56abc3['limit']=qs['limit'](_0x36e5e8[_0x75c5('0x34')][_0x75c5('0x3d')]);_0x56abc3[_0x75c5('0x28')]=qs[_0x75c5('0x28')](_0x36e5e8[_0x75c5('0x34')][_0x75c5('0x28')]);}_0x56abc3[_0x75c5('0x3e')]=qs[_0x75c5('0x3f')](_0x36e5e8[_0x75c5('0x34')][_0x75c5('0x3f')]);_0x56abc3['where']=qs[_0x75c5('0x37')](_[_0x75c5('0x40')](_0x36e5e8[_0x75c5('0x34')],_0x474328['filters']));if(_0x49ccb6[_0x75c5('0x35')]){if(_0x49ccb6[_0x75c5('0x36')]){_0x49ccb6[_0x75c5('0x36')]=moment(_0x49ccb6[_0x75c5('0x36')])[_0x75c5('0x41')](0x1,_0x75c5('0x42'));}else{_0x49ccb6[_0x75c5('0x36')]=moment(_0x49ccb6[_0x75c5('0x35')])[_0x75c5('0x41')](0x1,_0x75c5('0x42'));}_[_0x75c5('0x43')](_0x56abc3['where'],{'createdAt':{'$gte':_0x49ccb6[_0x75c5('0x35')],'$lte':_0x49ccb6[_0x75c5('0x36')]}});}if(_0x36e5e8[_0x75c5('0x34')]['filter']){_0x56abc3[_0x75c5('0x44')]=_[_0x75c5('0x43')](_0x56abc3['where'],{'$or':_['map'](_0x56abc3[_0x75c5('0x3a')],function(_0x4eec84){var _0x2d83b5={};_0x2d83b5[_0x4eec84]={'$like':'%'+_0x36e5e8[_0x75c5('0x34')][_0x75c5('0x45')]+'%'};return _0x2d83b5;})});}_0x56abc3=_['merge']({},_0x56abc3,_0x36e5e8[_0x75c5('0x46')]);var _0xb5806c={'where':_0x56abc3[_0x75c5('0x44')]};return db[_0x75c5('0x47')][_0x75c5('0x27')](_0xb5806c)[_0x75c5('0x19')](function(_0x1df562){_0x476876[_0x75c5('0x27')]=_0x1df562;if(_0x36e5e8[_0x75c5('0x34')][_0x75c5('0x48')]){_0x56abc3[_0x75c5('0x49')]=[{'all':!![]}];}return db[_0x75c5('0x47')][_0x75c5('0x4a')](_0x56abc3);})[_0x75c5('0x19')](function(_0xa739e4){_0x476876[_0x75c5('0x4b')]=_0xa739e4;return _0x476876;})[_0x75c5('0x19')](respondWithFilteredResult(_0x2a6f5d,_0x56abc3))[_0x75c5('0x23')](handleError(_0x2a6f5d,null));};exports['show']=function(_0x2af3dd,_0x202bc0){var _0x27ca8d={'raw':![],'where':{'id':_0x2af3dd[_0x75c5('0x4c')]['id']}},_0x40f6b7={};_0x40f6b7[_0x75c5('0x39')]=_[_0x75c5('0x33')](db[_0x75c5('0x47')]['rawAttributes']);_0x40f6b7[_0x75c5('0x34')]=_[_0x75c5('0x33')](_0x2af3dd[_0x75c5('0x34')]);_0x40f6b7[_0x75c5('0x37')]=_['intersection'](_0x40f6b7[_0x75c5('0x39')],_0x40f6b7[_0x75c5('0x34')]);_0x27ca8d[_0x75c5('0x3a')]=_[_0x75c5('0x38')](_0x40f6b7[_0x75c5('0x39')],qs[_0x75c5('0x3b')](_0x2af3dd[_0x75c5('0x34')]['fields']));_0x27ca8d[_0x75c5('0x3a')]=_0x27ca8d['attributes']['length']?_0x27ca8d['attributes']:_0x40f6b7[_0x75c5('0x39')];if(_0x2af3dd[_0x75c5('0x34')][_0x75c5('0x48')]){_0x27ca8d[_0x75c5('0x49')]=[{'all':!![]}];}_0x27ca8d=_['merge']({},_0x27ca8d,_0x2af3dd[_0x75c5('0x46')]);return db[_0x75c5('0x47')][_0x75c5('0x4d')](_0x27ca8d)['then'](handleEntityNotFound(_0x202bc0,null))[_0x75c5('0x19')](respondWithResult(_0x202bc0,null))['catch'](handleError(_0x202bc0,null));};exports['create']=function(_0x2a7d7a,_0x16764e){return db[_0x75c5('0x47')]['create'](_0x2a7d7a[_0x75c5('0x4e')],{})['then'](respondWithResult(_0x16764e,0xc9))[_0x75c5('0x23')](handleError(_0x16764e,null));};exports['update']=function(_0x2f0383,_0x3bf806){if(_0x2f0383[_0x75c5('0x4e')]['id']){delete _0x2f0383[_0x75c5('0x4e')]['id'];}return db['SalesforceConfiguration'][_0x75c5('0x4d')]({'where':{'id':_0x2f0383[_0x75c5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3bf806,null))[_0x75c5('0x19')](saveUpdates(_0x2f0383[_0x75c5('0x4e')],null))[_0x75c5('0x19')](respondWithResult(_0x3bf806,null))[_0x75c5('0x23')](handleError(_0x3bf806,null));};exports[_0x75c5('0x2e')]=function(_0x4410bb,_0x5e32d1){return db[_0x75c5('0x47')]['find']({'where':{'id':_0x4410bb[_0x75c5('0x4c')]['id']}})[_0x75c5('0x19')](handleEntityNotFound(_0x5e32d1,null))['then'](removeEntity(_0x5e32d1,null))['catch'](handleError(_0x5e32d1,null));};exports[_0x75c5('0x4f')]=function(_0x3e2e66,_0x541a73,_0xe89083){var _0x5710e1={};var _0x35a60d={};var _0x4ba24a;var _0x433362;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3e2e66['params']['id']}})['then'](handleEntityNotFound(_0x541a73,null))[_0x75c5('0x19')](function(_0x127b96){if(_0x127b96){_0x4ba24a=_0x127b96;_0x35a60d[_0x75c5('0x39')]=_[_0x75c5('0x33')](db[_0x75c5('0x50')][_0x75c5('0x51')]);_0x35a60d['query']=_['keys'](_0x3e2e66[_0x75c5('0x34')]);_0x35a60d[_0x75c5('0x37')]=_[_0x75c5('0x38')](_0x35a60d[_0x75c5('0x39')],_0x35a60d[_0x75c5('0x34')]);_0x5710e1['attributes']=_[_0x75c5('0x38')](_0x35a60d[_0x75c5('0x39')],qs[_0x75c5('0x3b')](_0x3e2e66[_0x75c5('0x34')][_0x75c5('0x3b')]));_0x5710e1[_0x75c5('0x3a')]=_0x5710e1['attributes'][_0x75c5('0x52')]?_0x5710e1[_0x75c5('0x3a')]:_0x35a60d[_0x75c5('0x39')];_0x5710e1[_0x75c5('0x3e')]=qs[_0x75c5('0x3f')](_0x3e2e66[_0x75c5('0x34')][_0x75c5('0x3f')]);_0x5710e1[_0x75c5('0x44')]=qs[_0x75c5('0x37')](_[_0x75c5('0x40')](_0x3e2e66[_0x75c5('0x34')],_0x35a60d[_0x75c5('0x37')]));if(_0x3e2e66['query'][_0x75c5('0x45')]){_0x5710e1[_0x75c5('0x44')]=_[_0x75c5('0x43')](_0x5710e1[_0x75c5('0x44')],{'$or':_[_0x75c5('0x53')](_0x5710e1[_0x75c5('0x3a')],function(_0x5589fd){var _0x492a1d={};_0x492a1d[_0x5589fd]={'$like':'%'+_0x3e2e66['query'][_0x75c5('0x45')]+'%'};return _0x492a1d;})});}_0x5710e1=_['merge']({},_0x5710e1,_0x3e2e66[_0x75c5('0x46')]);return _0x4ba24a[_0x75c5('0x4f')](_0x5710e1);}})[_0x75c5('0x19')](function(_0x1a83d2){if(_0x1a83d2){_0x433362=_0x1a83d2[_0x75c5('0x52')];if(!_0x3e2e66[_0x75c5('0x34')]['hasOwnProperty'](_0x75c5('0x3c'))){_0x5710e1[_0x75c5('0x3d')]=qs[_0x75c5('0x3d')](_0x3e2e66[_0x75c5('0x34')][_0x75c5('0x3d')]);_0x5710e1[_0x75c5('0x28')]=qs[_0x75c5('0x28')](_0x3e2e66[_0x75c5('0x34')]['offset']);}return _0x4ba24a[_0x75c5('0x4f')](_0x5710e1);}})[_0x75c5('0x19')](function(_0x281b57){if(_0x281b57){return _0x281b57?{'count':_0x433362,'rows':_0x281b57}:null;}})[_0x75c5('0x19')](respondWithResult(_0x541a73,null))['catch'](handleError(_0x541a73,null));};exports[_0x75c5('0x54')]=function(_0x39aa44,_0x5e5df7,_0x1878ff){var _0x8c339c={};var _0x47af4b={};var _0x60e1bc;var _0x6a8454;return db[_0x75c5('0x47')][_0x75c5('0x55')]({'where':{'id':_0x39aa44['params']['id']}})['then'](handleEntityNotFound(_0x5e5df7,null))['then'](function(_0x413558){if(_0x413558){_0x60e1bc=_0x413558;_0x47af4b[_0x75c5('0x39')]=_['keys'](db['SalesforceField'][_0x75c5('0x51')]);_0x47af4b[_0x75c5('0x34')]=_['keys'](_0x39aa44[_0x75c5('0x34')]);_0x47af4b[_0x75c5('0x37')]=_['intersection'](_0x47af4b[_0x75c5('0x39')],_0x47af4b[_0x75c5('0x34')]);_0x8c339c[_0x75c5('0x3a')]=_['intersection'](_0x47af4b[_0x75c5('0x39')],qs['fields'](_0x39aa44['query']['fields']));_0x8c339c['attributes']=_0x8c339c['attributes'][_0x75c5('0x52')]?_0x8c339c['attributes']:_0x47af4b[_0x75c5('0x39')];_0x8c339c[_0x75c5('0x3e')]=qs[_0x75c5('0x3f')](_0x39aa44['query'][_0x75c5('0x3f')]);_0x8c339c[_0x75c5('0x44')]=qs[_0x75c5('0x37')](_[_0x75c5('0x40')](_0x39aa44[_0x75c5('0x34')],_0x47af4b[_0x75c5('0x37')]));if(_0x39aa44[_0x75c5('0x34')][_0x75c5('0x45')]){_0x8c339c[_0x75c5('0x44')]=_[_0x75c5('0x43')](_0x8c339c[_0x75c5('0x44')],{'$or':_[_0x75c5('0x53')](_0x8c339c['attributes'],function(_0xdc9767){var _0x29806b={};_0x29806b[_0xdc9767]={'$like':'%'+_0x39aa44[_0x75c5('0x34')][_0x75c5('0x45')]+'%'};return _0x29806b;})});}_0x8c339c=_['merge']({},_0x8c339c,_0x39aa44[_0x75c5('0x46')]);return _0x60e1bc['getSubjects'](_0x8c339c);}})[_0x75c5('0x19')](function(_0x3f6db4){if(_0x3f6db4){_0x6a8454=_0x3f6db4[_0x75c5('0x52')];if(!_0x39aa44[_0x75c5('0x34')]['hasOwnProperty']('nolimit')){_0x8c339c['limit']=qs[_0x75c5('0x3d')](_0x39aa44[_0x75c5('0x34')][_0x75c5('0x3d')]);_0x8c339c[_0x75c5('0x28')]=qs[_0x75c5('0x28')](_0x39aa44[_0x75c5('0x34')][_0x75c5('0x28')]);}return _0x60e1bc[_0x75c5('0x54')](_0x8c339c);}})['then'](function(_0x83075a){if(_0x83075a){return _0x83075a?{'count':_0x6a8454,'rows':_0x83075a}:null;}})['then'](respondWithResult(_0x5e5df7,null))[_0x75c5('0x23')](handleError(_0x5e5df7,null));};exports['getDescriptions']=function(_0x29daf0,_0x34ff6f,_0x522e69){var _0x57e224={};var _0x42f81a={};var _0x51e44e;var _0x2def0;return db[_0x75c5('0x47')][_0x75c5('0x55')]({'where':{'id':_0x29daf0[_0x75c5('0x4c')]['id']}})[_0x75c5('0x19')](handleEntityNotFound(_0x34ff6f,null))[_0x75c5('0x19')](function(_0x173db7){if(_0x173db7){_0x51e44e=_0x173db7;_0x42f81a['model']=_['keys'](db[_0x75c5('0x50')][_0x75c5('0x51')]);_0x42f81a[_0x75c5('0x34')]=_[_0x75c5('0x33')](_0x29daf0[_0x75c5('0x34')]);_0x42f81a[_0x75c5('0x37')]=_['intersection'](_0x42f81a[_0x75c5('0x39')],_0x42f81a[_0x75c5('0x34')]);_0x57e224[_0x75c5('0x3a')]=_['intersection'](_0x42f81a[_0x75c5('0x39')],qs[_0x75c5('0x3b')](_0x29daf0[_0x75c5('0x34')][_0x75c5('0x3b')]));_0x57e224[_0x75c5('0x3a')]=_0x57e224[_0x75c5('0x3a')][_0x75c5('0x52')]?_0x57e224[_0x75c5('0x3a')]:_0x42f81a[_0x75c5('0x39')];_0x57e224[_0x75c5('0x3e')]=qs[_0x75c5('0x3f')](_0x29daf0[_0x75c5('0x34')][_0x75c5('0x3f')]);_0x57e224[_0x75c5('0x44')]=qs[_0x75c5('0x37')](_[_0x75c5('0x40')](_0x29daf0[_0x75c5('0x34')],_0x42f81a['filters']));if(_0x29daf0['query']['filter']){_0x57e224[_0x75c5('0x44')]=_[_0x75c5('0x43')](_0x57e224[_0x75c5('0x44')],{'$or':_[_0x75c5('0x53')](_0x57e224['attributes'],function(_0x37d62e){var _0x10e6df={};_0x10e6df[_0x37d62e]={'$like':'%'+_0x29daf0[_0x75c5('0x34')][_0x75c5('0x45')]+'%'};return _0x10e6df;})});}_0x57e224=_[_0x75c5('0x43')]({},_0x57e224,_0x29daf0[_0x75c5('0x46')]);return _0x51e44e[_0x75c5('0x56')](_0x57e224);}})[_0x75c5('0x19')](function(_0x40f6c6){if(_0x40f6c6){_0x2def0=_0x40f6c6[_0x75c5('0x52')];if(!_0x29daf0['query'][_0x75c5('0x57')](_0x75c5('0x3c'))){_0x57e224[_0x75c5('0x3d')]=qs[_0x75c5('0x3d')](_0x29daf0['query'][_0x75c5('0x3d')]);_0x57e224[_0x75c5('0x28')]=qs['offset'](_0x29daf0[_0x75c5('0x34')][_0x75c5('0x28')]);}return _0x51e44e['getDescriptions'](_0x57e224);}})[_0x75c5('0x19')](function(_0x46dec2){if(_0x46dec2){return _0x46dec2?{'count':_0x2def0,'rows':_0x46dec2}:null;}})[_0x75c5('0x19')](respondWithResult(_0x34ff6f,null))['catch'](handleError(_0x34ff6f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index d424bab..281aca2 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 _0x02d9=['./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x02d9,0x1d7));var _0x902d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x02d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x902d('0x0'));var util=require(_0x902d('0x1'));var logger=require(_0x902d('0x2'))('api');var moment=require(_0x902d('0x3'));var BPromise=require(_0x902d('0x4'));var rp=require(_0x902d('0x5'));var attributes=require(_0x902d('0x6'));module[_0x902d('0x7')]=function(_0x34e626,_0x17f65b){return _0x34e626['define'](_0x902d('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x142c=['bluebird','request-promise','./intSalesforceConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x19a037,_0xc3f4ed){var _0x57018c=function(_0x456d75){while(--_0x456d75){_0x19a037['push'](_0x19a037['shift']());}};_0x57018c(++_0xc3f4ed);}(_0x142c,0x163));var _0xc142=function(_0x1dedc6,_0x527696){_0x1dedc6=_0x1dedc6-0x0;var _0x539c67=_0x142c[_0x1dedc6];return _0x539c67;};'use strict';var _=require(_0xc142('0x0'));var util=require(_0xc142('0x1'));var logger=require(_0xc142('0x2'))(_0xc142('0x3'));var moment=require(_0xc142('0x4'));var BPromise=require(_0xc142('0x5'));var rp=require(_0xc142('0x6'));var attributes=require(_0xc142('0x7'));module[_0xc142('0x8')]=function(_0x54c4f8,_0x5abcfc){return _0x54c4f8[_0xc142('0x9')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','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 fdf80e6..657c902 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x37ee41,_0x3c8556){var _0x28ca16=function(_0x4a2488){while(--_0x4a2488){_0x37ee41['push'](_0x37ee41['shift']());}};_0x28ca16(++_0x3c8556);}(_0xe14b,0x93));var _0xbe14=function(_0x5cb4c7,_0x11370d){_0x5cb4c7=_0x5cb4c7-0x0;var _0x4e1f99=_0xe14b[_0x5cb4c7];return _0x4e1f99;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x814b=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x814b,0x1a2));var _0xb814=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x814b[_0x36ed48];return _0x51c63a;};'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')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a047f86..efa1386 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 _0x90e6=['put','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0x90e6,0x1cb));var _0x690e=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x90e6[_0xf2662b];return _0x257dc7;};'use strict';var multer=require(_0x690e('0x0'));var util=require(_0x690e('0x1'));var path=require('path');var timeout=require(_0x690e('0x2'));var express=require(_0x690e('0x3'));var router=express[_0x690e('0x4')]();var auth=require(_0x690e('0x5'));var interaction=require(_0x690e('0x6'));var config=require(_0x690e('0x7'));var controller=require(_0x690e('0x8'));router[_0x690e('0x9')]('/',auth['isAuthenticated'](),controller[_0x690e('0xa')]);router[_0x690e('0x9')](_0x690e('0xb'),auth[_0x690e('0xc')](),controller[_0x690e('0xd')]);router[_0x690e('0xe')]('/',auth[_0x690e('0xc')](),controller[_0x690e('0xf')]);router[_0x690e('0x10')](_0x690e('0xb'),auth[_0x690e('0xc')](),controller[_0x690e('0x11')]);router['delete']('/:id',auth[_0x690e('0xc')](),controller[_0x690e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xfbf6=['/:id','show','post','create','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get'];(function(_0x30f1d8,_0x3d192a){var _0x385a47=function(_0x32083b){while(--_0x32083b){_0x30f1d8['push'](_0x30f1d8['shift']());}};_0x385a47(++_0x3d192a);}(_0xfbf6,0x13a));var _0x6fbf=function(_0x1252d9,_0xb59816){_0x1252d9=_0x1252d9-0x0;var _0x76c018=_0xfbf6[_0x1252d9];return _0x76c018;};'use strict';var multer=require('multer');var util=require(_0x6fbf('0x0'));var path=require(_0x6fbf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6fbf('0x2')]();var auth=require(_0x6fbf('0x3'));var interaction=require(_0x6fbf('0x4'));var config=require(_0x6fbf('0x5'));var controller=require(_0x6fbf('0x6'));router['get']('/',auth[_0x6fbf('0x7')](),controller[_0x6fbf('0x8')]);router[_0x6fbf('0x9')](_0x6fbf('0xa'),auth[_0x6fbf('0x7')](),controller[_0x6fbf('0xb')]);router[_0x6fbf('0xc')]('/',auth[_0x6fbf('0x7')](),controller[_0x6fbf('0xd')]);router['put'](_0x6fbf('0xa'),auth[_0x6fbf('0x7')](),controller[_0x6fbf('0xe')]);router[_0x6fbf('0xf')](_0x6fbf('0xa'),auth[_0x6fbf('0x7')](),controller[_0x6fbf('0x10')]);module[_0x6fbf('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 16f94a6..1f57bb0 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 _0xc45c=['keyValue','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x306619,_0x5eb989){var _0x413ed6=function(_0xf11ebc){while(--_0xf11ebc){_0x306619['push'](_0x306619['shift']());}};_0x413ed6(++_0x5eb989);}(_0xc45c,0x152));var _0xcc45=function(_0x38c5c2,_0x1b59f7){_0x38c5c2=_0x38c5c2-0x0;var _0x4bd2fb=_0xc45c[_0x38c5c2];return _0x4bd2fb;};'use strict';var Sequelize=require('sequelize');module[_0xcc45('0x0')]={'type':{'type':Sequelize[_0xcc45('0x1')](_0xcc45('0x2'),_0xcc45('0x3'),_0xcc45('0x4'),_0xcc45('0x5')),'defaultValue':_0xcc45('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcc45('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xcc45('0x3'),_0xcc45('0x4'))},'keyContent':{'type':Sequelize[_0xcc45('0x6')]},'idField':{'type':Sequelize[_0xcc45('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc71a=['variable','sequelize','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0x10ec0e,_0x43cd98){var _0x11a569=function(_0x170fed){while(--_0x170fed){_0x10ec0e['push'](_0x10ec0e['shift']());}};_0x11a569(++_0x43cd98);}(_0xc71a,0x89));var _0xac71=function(_0x16dd2d,_0x45d15b){_0x16dd2d=_0x16dd2d-0x0;var _0x47f6c5=_0xc71a[_0x16dd2d];return _0x47f6c5;};'use strict';var Sequelize=require(_0xac71('0x0'));module[_0xac71('0x1')]={'type':{'type':Sequelize[_0xac71('0x2')](_0xac71('0x3'),'variable',_0xac71('0x4'),_0xac71('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xac71('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xac71('0x2')](_0xac71('0x3'),_0xac71('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xac71('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xac71('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6c0c17f..7abb212 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 _0xdd82=['update','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','save','then','destroy','error','name','send','index','SalesforceField','rawAttributes','model','keys','query','dateEnd','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','add','day','dateStart','merge','map','filter','options','count','includeAll','include','rows','catch','show','params','create','body'];(function(_0x4301b4,_0x34b9b8){var _0x16e64e=function(_0x43f90e){while(--_0x43f90e){_0x4301b4['push'](_0x4301b4['shift']());}};_0x16e64e(++_0x34b9b8);}(_0xdd82,0x8e));var _0x2dd8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdd82[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x2dd8('0x0'));var emlformat=require(_0x2dd8('0x1'));var rimraf=require(_0x2dd8('0x2'));var zipdir=require(_0x2dd8('0x3'));var jsonpatch=require(_0x2dd8('0x4'));var rp=require(_0x2dd8('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2dd8('0x6'));var util=require(_0x2dd8('0x7'));var path=require(_0x2dd8('0x8'));var sox=require('sox');var csv=require(_0x2dd8('0x9'));var ejs=require(_0x2dd8('0xa'));var fs=require('fs');var _=require(_0x2dd8('0xb'));var squel=require(_0x2dd8('0xc'));var crypto=require(_0x2dd8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2dd8('0xe'));var toCsv=require(_0x2dd8('0x9'));var querystring=require(_0x2dd8('0xf'));var Papa=require(_0x2dd8('0x10'));var Redis=require(_0x2dd8('0x11'));var qs=require(_0x2dd8('0x12'));var logger=require('../../config/logger')(_0x2dd8('0x13'));var utils=require(_0x2dd8('0x14'));var config=require('../../config/environment');var db=require(_0x2dd8('0x15'))['db'];function respondWithStatusCode(_0x2dc331,_0x447236){_0x447236=_0x447236||0xcc;return function(_0x3c0119){if(_0x3c0119){return _0x2dc331[_0x2dd8('0x16')](_0x447236);}return _0x2dc331[_0x2dd8('0x17')](_0x447236)['end']();};}function respondWithResult(_0x5394e2,_0x1520eb){_0x1520eb=_0x1520eb||0xc8;return function(_0x182a3f){if(_0x182a3f){return _0x5394e2[_0x2dd8('0x17')](_0x1520eb)[_0x2dd8('0x18')](_0x182a3f);}};}function respondWithFilteredResult(_0x4d0aaf,_0x4edd53){return function(_0xe6c905){if(_0xe6c905){var _0x471bd7=_0xe6c905['count'],_0x18056b=_0x4edd53[_0x2dd8('0x19')],_0x4616c0=_0x4edd53['offset']+_0x4edd53['limit'],_0x5099f8;if(_0x4616c0>=_0x471bd7){_0x4616c0=_0x471bd7;_0x5099f8=0xc8;}else{_0x5099f8=0xce;}_0x4d0aaf[_0x2dd8('0x17')](_0x5099f8);return _0x4d0aaf[_0x2dd8('0x1a')](_0x2dd8('0x1b'),_0x18056b+'-'+_0x4616c0+'/'+_0x471bd7)[_0x2dd8('0x18')](_0xe6c905);}return null;};}function patchUpdates(_0x104b45){return function(_0x1ee08b){try{jsonpatch['apply'](_0x1ee08b,_0x104b45,!![]);}catch(_0x1dbab9){return BPromise['reject'](_0x1dbab9);}return _0x1ee08b[_0x2dd8('0x1c')]();};}function saveUpdates(_0x3103e4,_0x55412e){return function(_0x74f78b){if(_0x74f78b){return _0x74f78b['update'](_0x3103e4)[_0x2dd8('0x1d')](function(_0x3cbbf5){return _0x3cbbf5;});}return null;};}function removeEntity(_0x480022,_0x888d53){return function(_0x31f983){if(_0x31f983){return _0x31f983[_0x2dd8('0x1e')]()['then'](function(){_0x480022[_0x2dd8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4225ba,_0x1d84bc){return function(_0x2a9769){if(!_0x2a9769){_0x4225ba[_0x2dd8('0x16')](0x194);}return _0x2a9769;};}function handleError(_0x1749b8,_0x511b6c){_0x511b6c=_0x511b6c||0x1f4;return function(_0x3c1c35){logger[_0x2dd8('0x1f')](_0x3c1c35['stack']);if(_0x3c1c35[_0x2dd8('0x20')]){delete _0x3c1c35[_0x2dd8('0x20')];}_0x1749b8[_0x2dd8('0x17')](_0x511b6c)[_0x2dd8('0x21')](_0x3c1c35);};}exports[_0x2dd8('0x22')]=function(_0x401fb1,_0x49f72e){var _0xe96b9d={},_0x467038={},_0x6a78da={'count':0x0,'rows':[]};var _0x4de5ac=db[_0x2dd8('0x23')][_0x2dd8('0x24')];_0x467038[_0x2dd8('0x25')]=_[_0x2dd8('0x26')](_0x4de5ac);var _0x4515c6={'dateStart':_0x401fb1[_0x2dd8('0x27')]['dateStart'],'dateEnd':_0x401fb1['query'][_0x2dd8('0x28')]};delete _0x401fb1['query']['dateStart'];delete _0x401fb1[_0x2dd8('0x27')][_0x2dd8('0x28')];_0x467038['query']=_['keys'](_0x401fb1[_0x2dd8('0x27')]);_0x467038['filters']=_[_0x2dd8('0x29')](_0x467038[_0x2dd8('0x25')],_0x467038[_0x2dd8('0x27')]);_0xe96b9d['attributes']=_['intersection'](_0x467038['model'],qs[_0x2dd8('0x2a')](_0x401fb1[_0x2dd8('0x27')]['fields']));_0xe96b9d[_0x2dd8('0x2b')]=_0xe96b9d[_0x2dd8('0x2b')][_0x2dd8('0x2c')]?_0xe96b9d[_0x2dd8('0x2b')]:_0x467038[_0x2dd8('0x25')];if(!_0x401fb1[_0x2dd8('0x27')][_0x2dd8('0x2d')]('nolimit')){_0xe96b9d['limit']=qs[_0x2dd8('0x2e')](_0x401fb1['query'][_0x2dd8('0x2e')]);_0xe96b9d[_0x2dd8('0x19')]=qs[_0x2dd8('0x19')](_0x401fb1[_0x2dd8('0x27')][_0x2dd8('0x19')]);}_0xe96b9d[_0x2dd8('0x2f')]=qs[_0x2dd8('0x30')](_0x401fb1['query'][_0x2dd8('0x30')]);_0xe96b9d[_0x2dd8('0x31')]=qs[_0x2dd8('0x32')](_[_0x2dd8('0x33')](_0x401fb1[_0x2dd8('0x27')],_0x467038[_0x2dd8('0x32')]));if(_0x4515c6['dateStart']){if(_0x4515c6['dateEnd']){_0x4515c6['dateEnd']=moment(_0x4515c6[_0x2dd8('0x28')])[_0x2dd8('0x34')](0x1,_0x2dd8('0x35'));}else{_0x4515c6[_0x2dd8('0x28')]=moment(_0x4515c6[_0x2dd8('0x36')])[_0x2dd8('0x34')](0x1,'day');}_[_0x2dd8('0x37')](_0xe96b9d[_0x2dd8('0x31')],{'createdAt':{'$gte':_0x4515c6['dateStart'],'$lte':_0x4515c6['dateEnd']}});}if(_0x401fb1[_0x2dd8('0x27')]['filter']){_0xe96b9d[_0x2dd8('0x31')]=_['merge'](_0xe96b9d[_0x2dd8('0x31')],{'$or':_[_0x2dd8('0x38')](_0xe96b9d['attributes'],function(_0x338c79){var _0x479735={};_0x479735[_0x338c79]={'$like':'%'+_0x401fb1['query'][_0x2dd8('0x39')]+'%'};return _0x479735;})});}_0xe96b9d=_['merge']({},_0xe96b9d,_0x401fb1[_0x2dd8('0x3a')]);var _0x2f6965={'where':_0xe96b9d[_0x2dd8('0x31')]};return db[_0x2dd8('0x23')][_0x2dd8('0x3b')](_0x2f6965)[_0x2dd8('0x1d')](function(_0x51c5ec){_0x6a78da[_0x2dd8('0x3b')]=_0x51c5ec;if(_0x401fb1[_0x2dd8('0x27')][_0x2dd8('0x3c')]){_0xe96b9d[_0x2dd8('0x3d')]=[{'all':!![]}];}return db[_0x2dd8('0x23')]['findAll'](_0xe96b9d);})[_0x2dd8('0x1d')](function(_0x1cf424){_0x6a78da[_0x2dd8('0x3e')]=_0x1cf424;return _0x6a78da;})[_0x2dd8('0x1d')](respondWithFilteredResult(_0x49f72e,_0xe96b9d))[_0x2dd8('0x3f')](handleError(_0x49f72e,null));};exports[_0x2dd8('0x40')]=function(_0x1ace54,_0x516117){var _0x47a644={'raw':!![],'where':{'id':_0x1ace54[_0x2dd8('0x41')]['id']}},_0x1b3411={};_0x1b3411['model']=_['keys'](db[_0x2dd8('0x23')][_0x2dd8('0x24')]);_0x1b3411['query']=_[_0x2dd8('0x26')](_0x1ace54['query']);_0x1b3411[_0x2dd8('0x32')]=_[_0x2dd8('0x29')](_0x1b3411[_0x2dd8('0x25')],_0x1b3411[_0x2dd8('0x27')]);_0x47a644['attributes']=_[_0x2dd8('0x29')](_0x1b3411[_0x2dd8('0x25')],qs[_0x2dd8('0x2a')](_0x1ace54[_0x2dd8('0x27')][_0x2dd8('0x2a')]));_0x47a644[_0x2dd8('0x2b')]=_0x47a644[_0x2dd8('0x2b')][_0x2dd8('0x2c')]?_0x47a644[_0x2dd8('0x2b')]:_0x1b3411[_0x2dd8('0x25')];if(_0x1ace54[_0x2dd8('0x27')][_0x2dd8('0x3c')]){_0x47a644[_0x2dd8('0x3d')]=[{'all':!![]}];}_0x47a644=_[_0x2dd8('0x37')]({},_0x47a644,_0x1ace54[_0x2dd8('0x3a')]);return db['SalesforceField']['find'](_0x47a644)[_0x2dd8('0x1d')](handleEntityNotFound(_0x516117,null))[_0x2dd8('0x1d')](respondWithResult(_0x516117,null))[_0x2dd8('0x3f')](handleError(_0x516117,null));};exports['create']=function(_0x26c6b4,_0x528d04){return db['SalesforceField'][_0x2dd8('0x42')](_0x26c6b4[_0x2dd8('0x43')],{})[_0x2dd8('0x1d')](respondWithResult(_0x528d04,0xc9))[_0x2dd8('0x3f')](handleError(_0x528d04,null));};exports[_0x2dd8('0x44')]=function(_0x5c79d9,_0x2d9b0a){if(_0x5c79d9['body']['id']){delete _0x5c79d9[_0x2dd8('0x43')]['id'];}return db[_0x2dd8('0x23')][_0x2dd8('0x45')]({'where':{'id':_0x5c79d9[_0x2dd8('0x41')]['id']}})[_0x2dd8('0x1d')](handleEntityNotFound(_0x2d9b0a,null))[_0x2dd8('0x1d')](saveUpdates(_0x5c79d9[_0x2dd8('0x43')],null))[_0x2dd8('0x1d')](respondWithResult(_0x2d9b0a,null))[_0x2dd8('0x3f')](handleError(_0x2d9b0a,null));};exports[_0x2dd8('0x1e')]=function(_0x15fdaa,_0x3ca69e){return db['SalesforceField']['find']({'where':{'id':_0x15fdaa[_0x2dd8('0x41')]['id']}})[_0x2dd8('0x1d')](handleEntityNotFound(_0x3ca69e,null))[_0x2dd8('0x1d')](removeEntity(_0x3ca69e,null))[_0x2dd8('0x3f')](handleError(_0x3ca69e,null));}; \ No newline at end of file +var _0xcfce=['filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','day','add','filter','merge','options','includeAll','include','rows','show','length','find','catch','create','body','update','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','apply','then','end','sendStatus','error','stack','name','index','SalesforceField','rawAttributes','keys','query','dateStart','dateEnd'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcfce,0x15e));var _0xecfc=function(_0x5aa992,_0x559ebb){_0x5aa992=_0x5aa992-0x0;var _0x2e2d59=_0xcfce[_0x5aa992];return _0x2e2d59;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xecfc('0x0'));var jsonpatch=require(_0xecfc('0x1'));var rp=require(_0xecfc('0x2'));var moment=require(_0xecfc('0x3'));var BPromise=require(_0xecfc('0x4'));var Mustache=require(_0xecfc('0x5'));var util=require('util');var path=require(_0xecfc('0x6'));var sox=require(_0xecfc('0x7'));var csv=require(_0xecfc('0x8'));var ejs=require(_0xecfc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xecfc('0xa'));var crypto=require(_0xecfc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xecfc('0xc'));var toCsv=require(_0xecfc('0x8'));var querystring=require(_0xecfc('0xd'));var Papa=require(_0xecfc('0xe'));var Redis=require('ioredis');var qs=require(_0xecfc('0xf'));var logger=require(_0xecfc('0x10'))(_0xecfc('0x11'));var utils=require(_0xecfc('0x12'));var config=require(_0xecfc('0x13'));var db=require(_0xecfc('0x14'))['db'];function respondWithStatusCode(_0x3fb12e,_0x596b17){_0x596b17=_0x596b17||0xcc;return function(_0x54f188){if(_0x54f188){return _0x3fb12e['sendStatus'](_0x596b17);}return _0x3fb12e[_0xecfc('0x15')](_0x596b17)['end']();};}function respondWithResult(_0x41b6ef,_0x5e059a){_0x5e059a=_0x5e059a||0xc8;return function(_0x4485d4){if(_0x4485d4){return _0x41b6ef['status'](_0x5e059a)[_0xecfc('0x16')](_0x4485d4);}};}function respondWithFilteredResult(_0x4b2185,_0x5ed202){return function(_0x27fe2f){if(_0x27fe2f){var _0x1b7637=_0x27fe2f[_0xecfc('0x17')],_0x2c3fba=_0x5ed202[_0xecfc('0x18')],_0x1b9887=_0x5ed202[_0xecfc('0x18')]+_0x5ed202[_0xecfc('0x19')],_0x2bb086;if(_0x1b9887>=_0x1b7637){_0x1b9887=_0x1b7637;_0x2bb086=0xc8;}else{_0x2bb086=0xce;}_0x4b2185[_0xecfc('0x15')](_0x2bb086);return _0x4b2185['set']('Content-Range',_0x2c3fba+'-'+_0x1b9887+'/'+_0x1b7637)['json'](_0x27fe2f);}return null;};}function patchUpdates(_0x1bb07a){return function(_0x3ca23c){try{jsonpatch[_0xecfc('0x1a')](_0x3ca23c,_0x1bb07a,!![]);}catch(_0x1189f9){return BPromise['reject'](_0x1189f9);}return _0x3ca23c['save']();};}function saveUpdates(_0x4c4e11,_0x23f3a6){return function(_0x376b3b){if(_0x376b3b){return _0x376b3b['update'](_0x4c4e11)[_0xecfc('0x1b')](function(_0x152541){return _0x152541;});}return null;};}function removeEntity(_0x4eb450,_0x2be60a){return function(_0x66717b){if(_0x66717b){return _0x66717b['destroy']()['then'](function(){_0x4eb450[_0xecfc('0x15')](0xcc)[_0xecfc('0x1c')]();});}};}function handleEntityNotFound(_0x39539e,_0x22a3e7){return function(_0x5cf8c3){if(!_0x5cf8c3){_0x39539e[_0xecfc('0x1d')](0x194);}return _0x5cf8c3;};}function handleError(_0x14d62b,_0x1093ef){_0x1093ef=_0x1093ef||0x1f4;return function(_0xe7e70){logger[_0xecfc('0x1e')](_0xe7e70[_0xecfc('0x1f')]);if(_0xe7e70[_0xecfc('0x20')]){delete _0xe7e70[_0xecfc('0x20')];}_0x14d62b['status'](_0x1093ef)['send'](_0xe7e70);};}exports[_0xecfc('0x21')]=function(_0xb264f9,_0x3176ae){var _0x3a40b1={},_0x5d6763={},_0x53e191={'count':0x0,'rows':[]};var _0x4139a6=db[_0xecfc('0x22')][_0xecfc('0x23')];_0x5d6763['model']=_[_0xecfc('0x24')](_0x4139a6);var _0x4ecf43={'dateStart':_0xb264f9[_0xecfc('0x25')][_0xecfc('0x26')],'dateEnd':_0xb264f9['query'][_0xecfc('0x27')]};delete _0xb264f9['query'][_0xecfc('0x26')];delete _0xb264f9[_0xecfc('0x25')]['dateEnd'];_0x5d6763['query']=_[_0xecfc('0x24')](_0xb264f9[_0xecfc('0x25')]);_0x5d6763[_0xecfc('0x28')]=_['intersection'](_0x5d6763[_0xecfc('0x29')],_0x5d6763['query']);_0x3a40b1[_0xecfc('0x2a')]=_[_0xecfc('0x2b')](_0x5d6763[_0xecfc('0x29')],qs[_0xecfc('0x2c')](_0xb264f9[_0xecfc('0x25')]['fields']));_0x3a40b1[_0xecfc('0x2a')]=_0x3a40b1[_0xecfc('0x2a')]['length']?_0x3a40b1[_0xecfc('0x2a')]:_0x5d6763[_0xecfc('0x29')];if(!_0xb264f9[_0xecfc('0x25')][_0xecfc('0x2d')]('nolimit')){_0x3a40b1[_0xecfc('0x19')]=qs['limit'](_0xb264f9[_0xecfc('0x25')][_0xecfc('0x19')]);_0x3a40b1[_0xecfc('0x18')]=qs[_0xecfc('0x18')](_0xb264f9[_0xecfc('0x25')][_0xecfc('0x18')]);}_0x3a40b1[_0xecfc('0x2e')]=qs[_0xecfc('0x2f')](_0xb264f9[_0xecfc('0x25')][_0xecfc('0x2f')]);_0x3a40b1[_0xecfc('0x30')]=qs[_0xecfc('0x28')](_['pick'](_0xb264f9[_0xecfc('0x25')],_0x5d6763[_0xecfc('0x28')]));if(_0x4ecf43['dateStart']){if(_0x4ecf43['dateEnd']){_0x4ecf43[_0xecfc('0x27')]=moment(_0x4ecf43[_0xecfc('0x27')])['add'](0x1,_0xecfc('0x31'));}else{_0x4ecf43[_0xecfc('0x27')]=moment(_0x4ecf43[_0xecfc('0x26')])[_0xecfc('0x32')](0x1,'day');}_['merge'](_0x3a40b1[_0xecfc('0x30')],{'createdAt':{'$gte':_0x4ecf43['dateStart'],'$lte':_0x4ecf43['dateEnd']}});}if(_0xb264f9['query'][_0xecfc('0x33')]){_0x3a40b1['where']=_[_0xecfc('0x34')](_0x3a40b1[_0xecfc('0x30')],{'$or':_['map'](_0x3a40b1[_0xecfc('0x2a')],function(_0x3de54a){var _0x4c93d2={};_0x4c93d2[_0x3de54a]={'$like':'%'+_0xb264f9[_0xecfc('0x25')][_0xecfc('0x33')]+'%'};return _0x4c93d2;})});}_0x3a40b1=_['merge']({},_0x3a40b1,_0xb264f9[_0xecfc('0x35')]);var _0x1d7f59={'where':_0x3a40b1['where']};return db[_0xecfc('0x22')][_0xecfc('0x17')](_0x1d7f59)[_0xecfc('0x1b')](function(_0x135429){_0x53e191[_0xecfc('0x17')]=_0x135429;if(_0xb264f9[_0xecfc('0x25')][_0xecfc('0x36')]){_0x3a40b1[_0xecfc('0x37')]=[{'all':!![]}];}return db[_0xecfc('0x22')]['findAll'](_0x3a40b1);})['then'](function(_0x3f6988){_0x53e191[_0xecfc('0x38')]=_0x3f6988;return _0x53e191;})[_0xecfc('0x1b')](respondWithFilteredResult(_0x3176ae,_0x3a40b1))['catch'](handleError(_0x3176ae,null));};exports[_0xecfc('0x39')]=function(_0x9743b,_0x1db2e3){var _0x5c1757={'raw':!![],'where':{'id':_0x9743b['params']['id']}},_0x927591={};_0x927591[_0xecfc('0x29')]=_[_0xecfc('0x24')](db['SalesforceField'][_0xecfc('0x23')]);_0x927591[_0xecfc('0x25')]=_[_0xecfc('0x24')](_0x9743b[_0xecfc('0x25')]);_0x927591[_0xecfc('0x28')]=_[_0xecfc('0x2b')](_0x927591[_0xecfc('0x29')],_0x927591['query']);_0x5c1757['attributes']=_[_0xecfc('0x2b')](_0x927591[_0xecfc('0x29')],qs[_0xecfc('0x2c')](_0x9743b['query']['fields']));_0x5c1757[_0xecfc('0x2a')]=_0x5c1757[_0xecfc('0x2a')][_0xecfc('0x3a')]?_0x5c1757['attributes']:_0x927591['model'];if(_0x9743b['query'][_0xecfc('0x36')]){_0x5c1757[_0xecfc('0x37')]=[{'all':!![]}];}_0x5c1757=_[_0xecfc('0x34')]({},_0x5c1757,_0x9743b[_0xecfc('0x35')]);return db[_0xecfc('0x22')][_0xecfc('0x3b')](_0x5c1757)[_0xecfc('0x1b')](handleEntityNotFound(_0x1db2e3,null))[_0xecfc('0x1b')](respondWithResult(_0x1db2e3,null))[_0xecfc('0x3c')](handleError(_0x1db2e3,null));};exports[_0xecfc('0x3d')]=function(_0x3f4b2d,_0x2040f5){return db[_0xecfc('0x22')]['create'](_0x3f4b2d[_0xecfc('0x3e')],{})['then'](respondWithResult(_0x2040f5,0xc9))['catch'](handleError(_0x2040f5,null));};exports[_0xecfc('0x3f')]=function(_0x374b86,_0xd89fa5){if(_0x374b86[_0xecfc('0x3e')]['id']){delete _0x374b86[_0xecfc('0x3e')]['id'];}return db[_0xecfc('0x22')][_0xecfc('0x3b')]({'where':{'id':_0x374b86['params']['id']}})[_0xecfc('0x1b')](handleEntityNotFound(_0xd89fa5,null))['then'](saveUpdates(_0x374b86[_0xecfc('0x3e')],null))[_0xecfc('0x1b')](respondWithResult(_0xd89fa5,null))[_0xecfc('0x3c')](handleError(_0xd89fa5,null));};exports[_0xecfc('0x40')]=function(_0x3122ff,_0x382fab){return db[_0xecfc('0x22')]['find']({'where':{'id':_0x3122ff['params']['id']}})['then'](handleEntityNotFound(_0x382fab,null))['then'](removeEntity(_0x382fab,null))[_0xecfc('0x3c')](handleError(_0x382fab,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7173201..5a9b1b5 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 _0xa8d6=['./intSalesforceField.attributes','exports','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5e2289,_0x3d18b8){var _0x6e025=function(_0x150480){while(--_0x150480){_0x5e2289['push'](_0x5e2289['shift']());}};_0x6e025(++_0x3d18b8);}(_0xa8d6,0x1f2));var _0x6a8d=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xa8d6[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x6a8d('0x0'));var logger=require(_0x6a8d('0x1'))(_0x6a8d('0x2'));var moment=require(_0x6a8d('0x3'));var BPromise=require(_0x6a8d('0x4'));var rp=require(_0x6a8d('0x5'));var attributes=require(_0x6a8d('0x6'));module[_0x6a8d('0x7')]=function(_0x4b49f3,_0x2027e6){return _0x4b49f3['define']('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd469=['int_salesforce_fields','lodash','../../config/logger','api','moment','exports','define','SalesforceField'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0xd469,0x169));var _0x9d46=function(_0x5deeef,_0xfdb95){_0x5deeef=_0x5deeef-0x0;var _0x4392b9=_0xd469[_0x5deeef];return _0x4392b9;};'use strict';var _=require(_0x9d46('0x0'));var util=require('util');var logger=require(_0x9d46('0x1'))(_0x9d46('0x2'));var moment=require(_0x9d46('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./intSalesforceField.attributes');module[_0x9d46('0x4')]=function(_0xfda7e6,_0x458d9c){return _0xfda7e6[_0x9d46('0x5')](_0x9d46('0x6'),attributes,{'tableName':_0x9d46('0x7'),'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 00a0b89..eb75eee 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 _0x1b4a=['client','http','request','then','SalesforceField,\x20%s,\x20%s','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x1b4a,0xda));var _0xa1b4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1b4a[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xa1b4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa1b4('0x1'));var fs=require('fs');var Redis=require(_0xa1b4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa1b4('0x3'));var logger=require('../../config/logger')(_0xa1b4('0x4'));var config=require(_0xa1b4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa1b4('0x6')][_0xa1b4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4bdeff,_0x117852,_0x576e4c){return new BPromise(function(_0x331828,_0x6e097){return client[_0xa1b4('0x8')](_0x4bdeff,_0x576e4c)[_0xa1b4('0x9')](function(_0x1ed3d8){logger['info'](_0xa1b4('0xa'),_0x117852,'request\x20sent');logger['debug'](_0xa1b4('0xb'),_0x117852,_0xa1b4('0xc'),JSON['stringify'](_0x1ed3d8));if(_0x1ed3d8['error']){if(_0x1ed3d8['error']['code']===0x1f4){logger[_0xa1b4('0xd')]('SalesforceField,\x20%s,\x20%s',_0x117852,_0x1ed3d8[_0xa1b4('0xd')][_0xa1b4('0xe')]);return _0x6e097(_0x1ed3d8[_0xa1b4('0xd')][_0xa1b4('0xe')]);}logger[_0xa1b4('0xd')](_0xa1b4('0xa'),_0x117852,_0x1ed3d8[_0xa1b4('0xd')][_0xa1b4('0xe')]);return _0x331828(_0x1ed3d8[_0xa1b4('0xd')][_0xa1b4('0xe')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x117852,_0xa1b4('0xc'));_0x331828(_0x1ed3d8['result'][_0xa1b4('0xe')]);}})[_0xa1b4('0xf')](function(_0x29432e){logger[_0xa1b4('0xd')](_0xa1b4('0xa'),_0x117852,_0x29432e);_0x6e097(_0x29432e);});});} \ No newline at end of file +var _0xd871=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0xd871,0x137));var _0x1d87=function(_0x14b331,_0x24d929){_0x14b331=_0x14b331-0x0;var _0x57e14e=_0xd871[_0x14b331];return _0x57e14e;};'use strict';var _=require(_0x1d87('0x0'));var util=require(_0x1d87('0x1'));var moment=require(_0x1d87('0x2'));var BPromise=require(_0x1d87('0x3'));var rs=require(_0x1d87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d87('0x5'))['db'];var utils=require(_0x1d87('0x6'));var logger=require(_0x1d87('0x7'))(_0x1d87('0x8'));var config=require(_0x1d87('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1d87('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44a856,_0x480e6e,_0x1992f7){return new BPromise(function(_0x2a2f90,_0x4728af){return client['request'](_0x44a856,_0x1992f7)['then'](function(_0x39b52a){logger[_0x1d87('0xb')](_0x1d87('0xc'),_0x480e6e,_0x1d87('0xd'));logger[_0x1d87('0xe')](_0x1d87('0xf'),_0x480e6e,_0x1d87('0xd'),JSON['stringify'](_0x39b52a));if(_0x39b52a['error']){if(_0x39b52a[_0x1d87('0x10')][_0x1d87('0x11')]===0x1f4){logger[_0x1d87('0x10')](_0x1d87('0xc'),_0x480e6e,_0x39b52a[_0x1d87('0x10')][_0x1d87('0x12')]);return _0x4728af(_0x39b52a['error']['message']);}logger[_0x1d87('0x10')](_0x1d87('0xc'),_0x480e6e,_0x39b52a[_0x1d87('0x10')]['message']);return _0x2a2f90(_0x39b52a[_0x1d87('0x10')][_0x1d87('0x12')]);}else{logger['info'](_0x1d87('0xc'),_0x480e6e,'request\x20sent');_0x2a2f90(_0x39b52a[_0x1d87('0x13')][_0x1d87('0x12')]);}})[_0x1d87('0x14')](function(_0x5948a3){logger['error']('SalesforceField,\x20%s,\x20%s',_0x480e6e,_0x5948a3);_0x4728af(_0x5948a3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e6e4ff6..9be9801 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 _0x39d5=['../../config/environment','get','/:id','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3892ec,_0x5f40af){var _0x5618ae=function(_0x10924a){while(--_0x10924a){_0x3892ec['push'](_0x3892ec['shift']());}};_0x5618ae(++_0x5f40af);}(_0x39d5,0x1ee));var _0x539d=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x39d5[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x539d('0x0'));var util=require('util');var path=require(_0x539d('0x1'));var timeout=require(_0x539d('0x2'));var express=require(_0x539d('0x3'));var router=express[_0x539d('0x4')]();var auth=require(_0x539d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x539d('0x6'));var controller=require('./intSugarcrmAccount.controller');router[_0x539d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x539d('0x7')](_0x539d('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x539d('0x7')](_0x539d('0x9'),auth[_0x539d('0xa')](),controller[_0x539d('0xb')]);router[_0x539d('0x7')](_0x539d('0xc'),auth[_0x539d('0xa')](),controller[_0x539d('0xd')]);router[_0x539d('0xe')]('/',auth[_0x539d('0xa')](),controller[_0x539d('0xf')]);router[_0x539d('0xe')](_0x539d('0x9'),auth[_0x539d('0xa')](),controller[_0x539d('0x10')]);router[_0x539d('0x11')](_0x539d('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x539d('0x12')](_0x539d('0x8'),auth['isAuthenticated'](),controller[_0x539d('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf8d7=['Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','isAuthenticated','index','/:id','show','getConfigurations','get','/:id/fields','post','/:id/configurations','addConfiguration','update','destroy','exports','util','path','express'];(function(_0x4db1d0,_0x581e03){var _0x4b85d6=function(_0x2cf6eb){while(--_0x2cf6eb){_0x4db1d0['push'](_0x4db1d0['shift']());}};_0x4b85d6(++_0x581e03);}(_0xf8d7,0x1dd));var _0x7f8d=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xf8d7[_0x4e93a9];return _0x43013c;};'use strict';var multer=require('multer');var util=require(_0x7f8d('0x0'));var path=require(_0x7f8d('0x1'));var timeout=require('connect-timeout');var express=require(_0x7f8d('0x2'));var router=express[_0x7f8d('0x3')]();var auth=require(_0x7f8d('0x4'));var interaction=require(_0x7f8d('0x5'));var config=require('../../config/environment');var controller=require(_0x7f8d('0x6'));router['get']('/',auth[_0x7f8d('0x7')](),controller[_0x7f8d('0x8')]);router['get'](_0x7f8d('0x9'),auth['isAuthenticated'](),controller[_0x7f8d('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x7f8d('0xb')]);router[_0x7f8d('0xc')](_0x7f8d('0xd'),auth[_0x7f8d('0x7')](),controller['getFields']);router[_0x7f8d('0xe')]('/',auth[_0x7f8d('0x7')](),controller['create']);router['post'](_0x7f8d('0xf'),auth[_0x7f8d('0x7')](),controller[_0x7f8d('0x10')]);router['put'](_0x7f8d('0x9'),auth['isAuthenticated'](),controller[_0x7f8d('0x11')]);router['delete'](_0x7f8d('0x9'),auth['isAuthenticated'](),controller[_0x7f8d('0x12')]);module[_0x7f8d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index cf95124..b4a4985 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 _0x4022=['STRING','remoteUri','sequelize','exports'];(function(_0x45e7e4,_0xd2f843){var _0x5a53a3=function(_0x2b0eb4){while(--_0x2b0eb4){_0x45e7e4['push'](_0x45e7e4['shift']());}};_0x5a53a3(++_0xd2f843);}(_0x4022,0x13e));var _0x2402=function(_0x392f1a,_0x1898dd){_0x392f1a=_0x392f1a-0x0;var _0x3d17f1=_0x4022[_0x392f1a];return _0x3d17f1;};'use strict';var Sequelize=require(_0x2402('0x0'));module[_0x2402('0x1')]={'name':{'type':Sequelize[_0x2402('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2402('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x2402('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2402('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2079=['STRING','remoteUri','sequelize','exports'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0x2079,0x1d2));var _0x9207=function(_0x399bb6,_0x229054){_0x399bb6=_0x399bb6-0x0;var _0x18f990=_0x2079[_0x399bb6];return _0x18f990;};'use strict';var Sequelize=require(_0x9207('0x0'));module[_0x9207('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9207('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x9207('0x2')]},'remoteUri':{'type':Sequelize[_0x9207('0x2')],'unique':_0x9207('0x3')},'serverUrl':{'type':Sequelize[_0x9207('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 20e2b38..cdf0b5c 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 _0xa9e0=['error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','set','Content-Range','apply','save','destroy','sendStatus','name','send','index','SugarcrmAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','add','day','merge','filter','map','options','includeAll','findAll','rows','params','intersection','body','find','findOne','getConfigurations','AccountId','Subjects','getSubjects','channel','type','Descriptions','SugarcrmConfiguration','create','SugarcrmField','getFields','username','password','remoteUri','POST','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','values','module_fields','label','endsWith','test','statusCode','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','client','http','request','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4a3bc7,_0x44918b){var _0x56545d=function(_0x32c03d){while(--_0x32c03d){_0x4a3bc7['push'](_0x4a3bc7['shift']());}};_0x56545d(++_0x44918b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var 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'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x13')][_0x0a9e('0x14')]({'port':0x232a});function respondWithRpcPromise(_0xd5b662,_0x26d672,_0x32d742,_0x69aeb7){return new BPromise(function(_0x5db4b0,_0x4283ce){var _0x239b12=_0x69aeb7||client;return _0x239b12[_0x0a9e('0x15')](_0xd5b662,_0x32d742)[_0x0a9e('0x16')](function(_0x44dcfd){logger[_0x0a9e('0x17')]('SugarcrmAccount,\x20%s,\x20%s',_0x26d672,_0x0a9e('0x18'));logger['debug'](_0x0a9e('0x19'),_0x26d672,'request\x20sent',JSON[_0x0a9e('0x1a')](_0x44dcfd));if(_0x44dcfd[_0x0a9e('0x1b')]){if(_0x44dcfd['error'][_0x0a9e('0x1c')]===0x1f4){logger['error'](_0x0a9e('0x1d'),_0x26d672,_0x44dcfd[_0x0a9e('0x1b')][_0x0a9e('0x1e')]);return _0x4283ce(_0x44dcfd[_0x0a9e('0x1b')][_0x0a9e('0x1e')]);}logger[_0x0a9e('0x1b')](_0x0a9e('0x1d'),_0x26d672,_0x44dcfd[_0x0a9e('0x1b')][_0x0a9e('0x1e')]);return _0x5db4b0(_0x44dcfd[_0x0a9e('0x1b')][_0x0a9e('0x1e')]);}else{logger[_0x0a9e('0x17')]('SugarcrmAccount,\x20%s,\x20%s',_0x26d672,_0x0a9e('0x18'));_0x5db4b0(_0x44dcfd[_0x0a9e('0x1f')]['message']);}})[_0x0a9e('0x20')](function(_0x5a09ef){logger['error'](_0x0a9e('0x1d'),_0x26d672,_0x5a09ef);_0x4283ce(_0x5a09ef);});});}function respondWithStatusCode(_0x432e56,_0x38e7c4){_0x38e7c4=_0x38e7c4||0xcc;return function(_0x30bae6){if(_0x30bae6){return _0x432e56['sendStatus'](_0x38e7c4);}return _0x432e56[_0x0a9e('0x21')](_0x38e7c4)[_0x0a9e('0x22')]();};}function respondWithResult(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0xc8;return function(_0x370d86){if(_0x370d86){return _0x3b45bc[_0x0a9e('0x21')](_0x4d00e6)[_0x0a9e('0x23')](_0x370d86);}};}function respondWithFilteredResult(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){var _0x3a8e58=_0x197ec0[_0x0a9e('0x24')],_0x40c424=_0x59181e['offset'],_0x33161b=_0x59181e[_0x0a9e('0x25')]+_0x59181e['limit'],_0x526cf3;if(_0x33161b>=_0x3a8e58){_0x33161b=_0x3a8e58;_0x526cf3=0xc8;}else{_0x526cf3=0xce;}_0x5ea472[_0x0a9e('0x21')](_0x526cf3);return _0x5ea472[_0x0a9e('0x26')](_0x0a9e('0x27'),_0x40c424+'-'+_0x33161b+'/'+_0x3a8e58)[_0x0a9e('0x23')](_0x197ec0);}return null;};}function patchUpdates(_0x140511){return function(_0x1538a4){try{jsonpatch[_0x0a9e('0x28')](_0x1538a4,_0x140511,!![]);}catch(_0x14de77){return BPromise['reject'](_0x14de77);}return _0x1538a4[_0x0a9e('0x29')]();};}function saveUpdates(_0x468813,_0x2b1f27){return function(_0x2ec755){if(_0x2ec755){return _0x2ec755['update'](_0x468813)[_0x0a9e('0x16')](function(_0x40e7a3){return _0x40e7a3;});}return null;};}function removeEntity(_0x1843b2,_0x824a4f){return function(_0x58b06f){if(_0x58b06f){return _0x58b06f[_0x0a9e('0x2a')]()[_0x0a9e('0x16')](function(){_0x1843b2[_0x0a9e('0x21')](0xcc)[_0x0a9e('0x22')]();});}};}function handleEntityNotFound(_0x540530,_0x426950){return function(_0x5d1e0e){if(!_0x5d1e0e){_0x540530[_0x0a9e('0x2b')](0x194);}return _0x5d1e0e;};}function handleError(_0x3ae878,_0x1122db){_0x1122db=_0x1122db||0x1f4;return function(_0x33bdb7){logger[_0x0a9e('0x1b')](_0x33bdb7['stack']);if(_0x33bdb7[_0x0a9e('0x2c')]){delete _0x33bdb7[_0x0a9e('0x2c')];}_0x3ae878[_0x0a9e('0x21')](_0x1122db)[_0x0a9e('0x2d')](_0x33bdb7);};}exports[_0x0a9e('0x2e')]=function(_0x409319,_0x332d35){var _0x39e565={},_0x5583a4={},_0x44295a={'count':0x0,'rows':[]};var _0x5e7238=db[_0x0a9e('0x2f')][_0x0a9e('0x30')];_0x5583a4[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5e7238);var _0x567193={'dateStart':_0x409319[_0x0a9e('0x33')][_0x0a9e('0x34')],'dateEnd':_0x409319[_0x0a9e('0x33')][_0x0a9e('0x35')]};delete _0x409319['query']['dateStart'];delete _0x409319[_0x0a9e('0x33')]['dateEnd'];_0x5583a4[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x409319[_0x0a9e('0x33')]);_0x5583a4[_0x0a9e('0x36')]=_['intersection'](_0x5583a4[_0x0a9e('0x31')],_0x5583a4[_0x0a9e('0x33')]);_0x39e565[_0x0a9e('0x37')]=_['intersection'](_0x5583a4[_0x0a9e('0x31')],qs[_0x0a9e('0x38')](_0x409319[_0x0a9e('0x33')]['fields']));_0x39e565['attributes']=_0x39e565[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x39e565['attributes']:_0x5583a4[_0x0a9e('0x31')];if(!_0x409319[_0x0a9e('0x33')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x39e565['limit']=qs['limit'](_0x409319[_0x0a9e('0x33')][_0x0a9e('0x3c')]);_0x39e565['offset']=qs[_0x0a9e('0x25')](_0x409319[_0x0a9e('0x33')][_0x0a9e('0x25')]);}_0x39e565['order']=qs[_0x0a9e('0x3d')](_0x409319[_0x0a9e('0x33')][_0x0a9e('0x3d')]);_0x39e565[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x3f')](_0x409319[_0x0a9e('0x33')],_0x5583a4[_0x0a9e('0x36')]));if(_0x567193[_0x0a9e('0x34')]){if(_0x567193[_0x0a9e('0x35')]){_0x567193[_0x0a9e('0x35')]=moment(_0x567193[_0x0a9e('0x35')])[_0x0a9e('0x40')](0x1,_0x0a9e('0x41'));}else{_0x567193[_0x0a9e('0x35')]=moment(_0x567193['dateStart'])['add'](0x1,_0x0a9e('0x41'));}_[_0x0a9e('0x42')](_0x39e565[_0x0a9e('0x3e')],{'createdAt':{'$gte':_0x567193[_0x0a9e('0x34')],'$lte':_0x567193[_0x0a9e('0x35')]}});}if(_0x409319[_0x0a9e('0x33')][_0x0a9e('0x43')]){_0x39e565[_0x0a9e('0x3e')]=_[_0x0a9e('0x42')](_0x39e565[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x44')](_0x39e565[_0x0a9e('0x37')],function(_0x5026aa){var _0x117c99={};_0x117c99[_0x5026aa]={'$like':'%'+_0x409319[_0x0a9e('0x33')][_0x0a9e('0x43')]+'%'};return _0x117c99;})});}_0x39e565=_[_0x0a9e('0x42')]({},_0x39e565,_0x409319[_0x0a9e('0x45')]);var _0xbe9d19={'where':_0x39e565[_0x0a9e('0x3e')]};return db[_0x0a9e('0x2f')]['count'](_0xbe9d19)[_0x0a9e('0x16')](function(_0x48fd45){_0x44295a[_0x0a9e('0x24')]=_0x48fd45;if(_0x409319[_0x0a9e('0x33')][_0x0a9e('0x46')]){_0x39e565['include']=[{'all':!![]}];}return db[_0x0a9e('0x2f')][_0x0a9e('0x47')](_0x39e565);})[_0x0a9e('0x16')](function(_0x34aa5a){_0x44295a[_0x0a9e('0x48')]=_0x34aa5a;return _0x44295a;})[_0x0a9e('0x16')](respondWithFilteredResult(_0x332d35,_0x39e565))[_0x0a9e('0x20')](handleError(_0x332d35,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':![],'where':{'id':_0x13f44d[_0x0a9e('0x49')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x2f')][_0x0a9e('0x30')]);_0x16f976['query']=_[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x33')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x33')]);_0x1b5e80[_0x0a9e('0x37')]=_[_0x0a9e('0x4a')](_0x16f976[_0x0a9e('0x31')],qs[_0x0a9e('0x38')](_0x13f44d[_0x0a9e('0x33')][_0x0a9e('0x38')]));_0x1b5e80[_0x0a9e('0x37')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x31')];if(_0x13f44d[_0x0a9e('0x33')][_0x0a9e('0x46')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x42')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x45')]);return db['SugarcrmAccount']['find'](_0x1b5e80)[_0x0a9e('0x16')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x20')](handleError(_0x1bde3c,null));};exports['create']=function(_0x2e5e62,_0x3c20b2){return db[_0x0a9e('0x2f')]['create'](_0x2e5e62[_0x0a9e('0x4b')],{})[_0x0a9e('0x16')](respondWithResult(_0x3c20b2,0xc9))['catch'](handleError(_0x3c20b2,null));};exports['update']=function(_0x128aa6,_0x3aedd0){if(_0x128aa6['body']['id']){delete _0x128aa6[_0x0a9e('0x4b')]['id'];}return db['SugarcrmAccount'][_0x0a9e('0x4c')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x16')](handleEntityNotFound(_0x3aedd0,null))['then'](saveUpdates(_0x128aa6['body'],null))['then'](respondWithResult(_0x3aedd0,null))[_0x0a9e('0x20')](handleError(_0x3aedd0,null));};exports['destroy']=function(_0x2f7092,_0x65432){return db[_0x0a9e('0x2f')][_0x0a9e('0x4c')]({'where':{'id':_0x2f7092[_0x0a9e('0x49')]['id']}})[_0x0a9e('0x16')](handleEntityNotFound(_0x65432,null))[_0x0a9e('0x16')](removeEntity(_0x65432,null))[_0x0a9e('0x20')](handleError(_0x65432,null));};exports['getConfigurations']=function(_0x1c693e,_0x121cef,_0x2642bb){var _0x30c491={};var _0xb83dfd={};var _0x156662;var _0x5d86e9;return db[_0x0a9e('0x2f')][_0x0a9e('0x4d')]({'where':{'id':_0x1c693e['params']['id']}})[_0x0a9e('0x16')](handleEntityNotFound(_0x121cef,null))['then'](function(_0x20c668){if(_0x20c668){_0x156662=_0x20c668;_0xb83dfd['model']=_['keys'](db['SugarcrmConfiguration'][_0x0a9e('0x30')]);_0xb83dfd['query']=_[_0x0a9e('0x32')](_0x1c693e[_0x0a9e('0x33')]);_0xb83dfd[_0x0a9e('0x36')]=_[_0x0a9e('0x4a')](_0xb83dfd[_0x0a9e('0x31')],_0xb83dfd[_0x0a9e('0x33')]);_0x30c491['attributes']=_[_0x0a9e('0x4a')](_0xb83dfd['model'],qs[_0x0a9e('0x38')](_0x1c693e[_0x0a9e('0x33')][_0x0a9e('0x38')]));_0x30c491['attributes']=_0x30c491[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x30c491[_0x0a9e('0x37')]:_0xb83dfd[_0x0a9e('0x31')];_0x30c491['order']=qs[_0x0a9e('0x3d')](_0x1c693e[_0x0a9e('0x33')]['sort']);_0x30c491[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x3f')](_0x1c693e[_0x0a9e('0x33')],_0xb83dfd[_0x0a9e('0x36')]));if(_0x1c693e['query'][_0x0a9e('0x43')]){_0x30c491[_0x0a9e('0x3e')]=_[_0x0a9e('0x42')](_0x30c491['where'],{'$or':_[_0x0a9e('0x44')](_0x30c491['attributes'],function(_0x5211e3){var _0x242745={};_0x242745[_0x5211e3]={'$like':'%'+_0x1c693e[_0x0a9e('0x33')][_0x0a9e('0x43')]+'%'};return _0x242745;})});}_0x30c491=_[_0x0a9e('0x42')]({},_0x30c491,_0x1c693e[_0x0a9e('0x45')]);return _0x156662[_0x0a9e('0x4e')](_0x30c491);}})[_0x0a9e('0x16')](function(_0x54a37d){if(_0x54a37d){_0x5d86e9=_0x54a37d[_0x0a9e('0x39')];if(!_0x1c693e[_0x0a9e('0x33')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x30c491[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3c')](_0x1c693e[_0x0a9e('0x33')][_0x0a9e('0x3c')]);_0x30c491[_0x0a9e('0x25')]=qs[_0x0a9e('0x25')](_0x1c693e['query'][_0x0a9e('0x25')]);}return _0x156662[_0x0a9e('0x4e')](_0x30c491);}})[_0x0a9e('0x16')](function(_0x4edbb0){if(_0x4edbb0){return _0x4edbb0?{'count':_0x5d86e9,'rows':_0x4edbb0}:null;}})[_0x0a9e('0x16')](respondWithResult(_0x121cef,null))[_0x0a9e('0x20')](handleError(_0x121cef,null));};exports['addConfiguration']=function(_0x83f0b2,_0x56e31e,_0x3ef315){if(_0x83f0b2[_0x0a9e('0x4b')]['id']){delete _0x83f0b2[_0x0a9e('0x4b')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x83f0b2['params']['id']}})[_0x0a9e('0x16')](handleEntityNotFound(_0x56e31e,null))[_0x0a9e('0x16')](function(_0x1104ad){if(_0x1104ad){_0x83f0b2[_0x0a9e('0x4b')][_0x0a9e('0x4f')]=_0x1104ad['id'];_0x83f0b2[_0x0a9e('0x4b')][_0x0a9e('0x50')]=integrations[_0x0a9e('0x51')](_0x83f0b2['body'][_0x0a9e('0x52')],_0x83f0b2[_0x0a9e('0x4b')][_0x0a9e('0x53')]);_0x83f0b2['body'][_0x0a9e('0x54')]=integrations['getDescriptions'](_0x83f0b2[_0x0a9e('0x4b')][_0x0a9e('0x52')],_0x83f0b2['body'][_0x0a9e('0x53')]);return db[_0x0a9e('0x55')][_0x0a9e('0x56')](_0x83f0b2[_0x0a9e('0x4b')],{'include':[{'model':db['SugarcrmField'],'as':_0x0a9e('0x50')},{'model':db[_0x0a9e('0x57')],'as':_0x0a9e('0x54')}]});}return null;})[_0x0a9e('0x16')](respondWithResult(_0x56e31e,null))['catch'](handleError(_0x56e31e,null));};exports[_0x0a9e('0x58')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f;return db[_0x0a9e('0x2f')][_0x0a9e('0x4d')]({'where':{'id':_0x3d91db[_0x0a9e('0x49')]['id']},'attributes':['id',_0x0a9e('0x59'),_0x0a9e('0x5a'),_0x0a9e('0x5b')]})[_0x0a9e('0x16')](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x16')](function(_0x1a7b03){if(_0x1a7b03){_0x4abc8f=_0x1a7b03[_0x0a9e('0x5b')];return rp({'method':_0x0a9e('0x5c'),'uri':util[_0x0a9e('0x5d')](_0x0a9e('0x5e'),_0x4abc8f,_0x0a9e('0x5f')),'json':!![],'form':{'method':'login','input_type':_0x0a9e('0x60'),'response_type':_0x0a9e('0x60'),'rest_data':JSON[_0x0a9e('0x1a')]({'user_auth':{'user_name':_0x1a7b03['username'],'password':_0x1a7b03[_0x0a9e('0x5a')],'encryption':_0x0a9e('0x61')},'application':_0x0a9e('0x62')})}});}})[_0x0a9e('0x16')](function(_0x56d650){if(_0x56d650){return rp({'method':'POST','uri':util[_0x0a9e('0x5d')](_0x0a9e('0x5e'),_0x4abc8f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0a9e('0x63'),'input_type':'JSON','response_type':_0x0a9e('0x60'),'rest_data':JSON[_0x0a9e('0x1a')]({'session':_0x56d650['id'],'module_name':'Calls'})}});}})[_0x0a9e('0x16')](function(_0x41cf12){if(_0x41cf12){var _0x2d2286=_[_0x0a9e('0x64')](_0x41cf12[_0x0a9e('0x65')]);return{'count':_0x2d2286[_0x0a9e('0x39')],'rows':_[_0x0a9e('0x44')](_0x2d2286,function(_0x482ca2){return{'id':_0x482ca2[_0x0a9e('0x2c')],'name':_0x482ca2[_0x0a9e('0x66')],'custom':_[_0x0a9e('0x67')](_0x482ca2[_0x0a9e('0x2c')],'_c')?!![]:![],'options':_0x482ca2['options']?_[_0x0a9e('0x44')](_[_0x0a9e('0x64')](_0x482ca2['options']),function(_0x1d6834){return{'name':_0x1d6834['value'],'value':_0x1d6834[_0x0a9e('0x2c')]};}):[]};})};}})[_0x0a9e('0x16')](respondWithResult(_0x2d5506,null))[_0x0a9e('0x20')](function(_0x385d52){var _0x5af453=_0x3d91db['query'][_0x0a9e('0x68')]?0x1f4:_0x385d52[_0x0a9e('0x69')]||0x1f4;logger[_0x0a9e('0x1b')]('getFields,\x20%s,\x20%s,\x20%s',_0x0a9e('0x58'),_0x5af453,JSON[_0x0a9e('0x1a')](_0x385d52));delete _0x385d52['name'];if(_0x5af453===0x191){_0x5af453=0x190;}_0x2d5506['status'](_0x5af453)[_0x0a9e('0x2d')](_0x3d91db['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x385d52[_0x0a9e('0x69')]}:_0x385d52);});}; \ No newline at end of file +var _0xa9e0=['error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','set','Content-Range','apply','save','destroy','sendStatus','name','send','index','SugarcrmAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','add','day','merge','filter','map','options','includeAll','findAll','rows','params','intersection','body','find','findOne','getConfigurations','AccountId','Subjects','getSubjects','channel','type','Descriptions','SugarcrmConfiguration','create','SugarcrmField','getFields','username','password','remoteUri','POST','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','values','module_fields','label','endsWith','test','statusCode','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','client','http','request','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1037aa,_0x4b1235){var _0x5e34a5=function(_0x3e34b2){while(--_0x3e34b2){_0x1037aa['push'](_0x1037aa['shift']());}};_0x5e34a5(++_0x4b1235);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x13')][_0x0a9e('0x14')]({'port':0x232a});function respondWithRpcPromise(_0xd5b662,_0x26d672,_0x32d742,_0x69aeb7){return new BPromise(function(_0x5db4b0,_0x4283ce){var _0x239b12=_0x69aeb7||client;return _0x239b12[_0x0a9e('0x15')](_0xd5b662,_0x32d742)[_0x0a9e('0x16')](function(_0x44dcfd){logger[_0x0a9e('0x17')]('SugarcrmAccount,\x20%s,\x20%s',_0x26d672,_0x0a9e('0x18'));logger['debug'](_0x0a9e('0x19'),_0x26d672,'request\x20sent',JSON[_0x0a9e('0x1a')](_0x44dcfd));if(_0x44dcfd[_0x0a9e('0x1b')]){if(_0x44dcfd['error'][_0x0a9e('0x1c')]===0x1f4){logger['error'](_0x0a9e('0x1d'),_0x26d672,_0x44dcfd[_0x0a9e('0x1b')][_0x0a9e('0x1e')]);return _0x4283ce(_0x44dcfd[_0x0a9e('0x1b')][_0x0a9e('0x1e')]);}logger[_0x0a9e('0x1b')](_0x0a9e('0x1d'),_0x26d672,_0x44dcfd[_0x0a9e('0x1b')][_0x0a9e('0x1e')]);return _0x5db4b0(_0x44dcfd[_0x0a9e('0x1b')][_0x0a9e('0x1e')]);}else{logger[_0x0a9e('0x17')]('SugarcrmAccount,\x20%s,\x20%s',_0x26d672,_0x0a9e('0x18'));_0x5db4b0(_0x44dcfd[_0x0a9e('0x1f')]['message']);}})[_0x0a9e('0x20')](function(_0x5a09ef){logger['error'](_0x0a9e('0x1d'),_0x26d672,_0x5a09ef);_0x4283ce(_0x5a09ef);});});}function respondWithStatusCode(_0x432e56,_0x38e7c4){_0x38e7c4=_0x38e7c4||0xcc;return function(_0x30bae6){if(_0x30bae6){return _0x432e56['sendStatus'](_0x38e7c4);}return _0x432e56[_0x0a9e('0x21')](_0x38e7c4)[_0x0a9e('0x22')]();};}function respondWithResult(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0xc8;return function(_0x370d86){if(_0x370d86){return _0x3b45bc[_0x0a9e('0x21')](_0x4d00e6)[_0x0a9e('0x23')](_0x370d86);}};}function respondWithFilteredResult(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){var _0x3a8e58=_0x197ec0[_0x0a9e('0x24')],_0x40c424=_0x59181e['offset'],_0x33161b=_0x59181e[_0x0a9e('0x25')]+_0x59181e['limit'],_0x526cf3;if(_0x33161b>=_0x3a8e58){_0x33161b=_0x3a8e58;_0x526cf3=0xc8;}else{_0x526cf3=0xce;}_0x5ea472[_0x0a9e('0x21')](_0x526cf3);return _0x5ea472[_0x0a9e('0x26')](_0x0a9e('0x27'),_0x40c424+'-'+_0x33161b+'/'+_0x3a8e58)[_0x0a9e('0x23')](_0x197ec0);}return null;};}function patchUpdates(_0x140511){return function(_0x1538a4){try{jsonpatch[_0x0a9e('0x28')](_0x1538a4,_0x140511,!![]);}catch(_0x14de77){return BPromise['reject'](_0x14de77);}return _0x1538a4[_0x0a9e('0x29')]();};}function saveUpdates(_0x468813,_0x2b1f27){return function(_0x2ec755){if(_0x2ec755){return _0x2ec755['update'](_0x468813)[_0x0a9e('0x16')](function(_0x40e7a3){return _0x40e7a3;});}return null;};}function removeEntity(_0x1843b2,_0x824a4f){return function(_0x58b06f){if(_0x58b06f){return _0x58b06f[_0x0a9e('0x2a')]()[_0x0a9e('0x16')](function(){_0x1843b2[_0x0a9e('0x21')](0xcc)[_0x0a9e('0x22')]();});}};}function handleEntityNotFound(_0x540530,_0x426950){return function(_0x5d1e0e){if(!_0x5d1e0e){_0x540530[_0x0a9e('0x2b')](0x194);}return _0x5d1e0e;};}function handleError(_0x3ae878,_0x1122db){_0x1122db=_0x1122db||0x1f4;return function(_0x33bdb7){logger[_0x0a9e('0x1b')](_0x33bdb7['stack']);if(_0x33bdb7[_0x0a9e('0x2c')]){delete _0x33bdb7[_0x0a9e('0x2c')];}_0x3ae878[_0x0a9e('0x21')](_0x1122db)[_0x0a9e('0x2d')](_0x33bdb7);};}exports[_0x0a9e('0x2e')]=function(_0x409319,_0x332d35){var _0x39e565={},_0x5583a4={},_0x44295a={'count':0x0,'rows':[]};var _0x5e7238=db[_0x0a9e('0x2f')][_0x0a9e('0x30')];_0x5583a4[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5e7238);var _0x567193={'dateStart':_0x409319[_0x0a9e('0x33')][_0x0a9e('0x34')],'dateEnd':_0x409319[_0x0a9e('0x33')][_0x0a9e('0x35')]};delete _0x409319['query']['dateStart'];delete _0x409319[_0x0a9e('0x33')]['dateEnd'];_0x5583a4[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x409319[_0x0a9e('0x33')]);_0x5583a4[_0x0a9e('0x36')]=_['intersection'](_0x5583a4[_0x0a9e('0x31')],_0x5583a4[_0x0a9e('0x33')]);_0x39e565[_0x0a9e('0x37')]=_['intersection'](_0x5583a4[_0x0a9e('0x31')],qs[_0x0a9e('0x38')](_0x409319[_0x0a9e('0x33')]['fields']));_0x39e565['attributes']=_0x39e565[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x39e565['attributes']:_0x5583a4[_0x0a9e('0x31')];if(!_0x409319[_0x0a9e('0x33')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x39e565['limit']=qs['limit'](_0x409319[_0x0a9e('0x33')][_0x0a9e('0x3c')]);_0x39e565['offset']=qs[_0x0a9e('0x25')](_0x409319[_0x0a9e('0x33')][_0x0a9e('0x25')]);}_0x39e565['order']=qs[_0x0a9e('0x3d')](_0x409319[_0x0a9e('0x33')][_0x0a9e('0x3d')]);_0x39e565[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x3f')](_0x409319[_0x0a9e('0x33')],_0x5583a4[_0x0a9e('0x36')]));if(_0x567193[_0x0a9e('0x34')]){if(_0x567193[_0x0a9e('0x35')]){_0x567193[_0x0a9e('0x35')]=moment(_0x567193[_0x0a9e('0x35')])[_0x0a9e('0x40')](0x1,_0x0a9e('0x41'));}else{_0x567193[_0x0a9e('0x35')]=moment(_0x567193['dateStart'])['add'](0x1,_0x0a9e('0x41'));}_[_0x0a9e('0x42')](_0x39e565[_0x0a9e('0x3e')],{'createdAt':{'$gte':_0x567193[_0x0a9e('0x34')],'$lte':_0x567193[_0x0a9e('0x35')]}});}if(_0x409319[_0x0a9e('0x33')][_0x0a9e('0x43')]){_0x39e565[_0x0a9e('0x3e')]=_[_0x0a9e('0x42')](_0x39e565[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x44')](_0x39e565[_0x0a9e('0x37')],function(_0x5026aa){var _0x117c99={};_0x117c99[_0x5026aa]={'$like':'%'+_0x409319[_0x0a9e('0x33')][_0x0a9e('0x43')]+'%'};return _0x117c99;})});}_0x39e565=_[_0x0a9e('0x42')]({},_0x39e565,_0x409319[_0x0a9e('0x45')]);var _0xbe9d19={'where':_0x39e565[_0x0a9e('0x3e')]};return db[_0x0a9e('0x2f')]['count'](_0xbe9d19)[_0x0a9e('0x16')](function(_0x48fd45){_0x44295a[_0x0a9e('0x24')]=_0x48fd45;if(_0x409319[_0x0a9e('0x33')][_0x0a9e('0x46')]){_0x39e565['include']=[{'all':!![]}];}return db[_0x0a9e('0x2f')][_0x0a9e('0x47')](_0x39e565);})[_0x0a9e('0x16')](function(_0x34aa5a){_0x44295a[_0x0a9e('0x48')]=_0x34aa5a;return _0x44295a;})[_0x0a9e('0x16')](respondWithFilteredResult(_0x332d35,_0x39e565))[_0x0a9e('0x20')](handleError(_0x332d35,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':![],'where':{'id':_0x13f44d[_0x0a9e('0x49')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x2f')][_0x0a9e('0x30')]);_0x16f976['query']=_[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x33')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x33')]);_0x1b5e80[_0x0a9e('0x37')]=_[_0x0a9e('0x4a')](_0x16f976[_0x0a9e('0x31')],qs[_0x0a9e('0x38')](_0x13f44d[_0x0a9e('0x33')][_0x0a9e('0x38')]));_0x1b5e80[_0x0a9e('0x37')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x31')];if(_0x13f44d[_0x0a9e('0x33')][_0x0a9e('0x46')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x42')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x45')]);return db['SugarcrmAccount']['find'](_0x1b5e80)[_0x0a9e('0x16')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x20')](handleError(_0x1bde3c,null));};exports['create']=function(_0x2e5e62,_0x3c20b2){return db[_0x0a9e('0x2f')]['create'](_0x2e5e62[_0x0a9e('0x4b')],{})[_0x0a9e('0x16')](respondWithResult(_0x3c20b2,0xc9))['catch'](handleError(_0x3c20b2,null));};exports['update']=function(_0x128aa6,_0x3aedd0){if(_0x128aa6['body']['id']){delete _0x128aa6[_0x0a9e('0x4b')]['id'];}return db['SugarcrmAccount'][_0x0a9e('0x4c')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x16')](handleEntityNotFound(_0x3aedd0,null))['then'](saveUpdates(_0x128aa6['body'],null))['then'](respondWithResult(_0x3aedd0,null))[_0x0a9e('0x20')](handleError(_0x3aedd0,null));};exports['destroy']=function(_0x2f7092,_0x65432){return db[_0x0a9e('0x2f')][_0x0a9e('0x4c')]({'where':{'id':_0x2f7092[_0x0a9e('0x49')]['id']}})[_0x0a9e('0x16')](handleEntityNotFound(_0x65432,null))[_0x0a9e('0x16')](removeEntity(_0x65432,null))[_0x0a9e('0x20')](handleError(_0x65432,null));};exports['getConfigurations']=function(_0x1c693e,_0x121cef,_0x2642bb){var _0x30c491={};var _0xb83dfd={};var _0x156662;var _0x5d86e9;return db[_0x0a9e('0x2f')][_0x0a9e('0x4d')]({'where':{'id':_0x1c693e['params']['id']}})[_0x0a9e('0x16')](handleEntityNotFound(_0x121cef,null))['then'](function(_0x20c668){if(_0x20c668){_0x156662=_0x20c668;_0xb83dfd['model']=_['keys'](db['SugarcrmConfiguration'][_0x0a9e('0x30')]);_0xb83dfd['query']=_[_0x0a9e('0x32')](_0x1c693e[_0x0a9e('0x33')]);_0xb83dfd[_0x0a9e('0x36')]=_[_0x0a9e('0x4a')](_0xb83dfd[_0x0a9e('0x31')],_0xb83dfd[_0x0a9e('0x33')]);_0x30c491['attributes']=_[_0x0a9e('0x4a')](_0xb83dfd['model'],qs[_0x0a9e('0x38')](_0x1c693e[_0x0a9e('0x33')][_0x0a9e('0x38')]));_0x30c491['attributes']=_0x30c491[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x30c491[_0x0a9e('0x37')]:_0xb83dfd[_0x0a9e('0x31')];_0x30c491['order']=qs[_0x0a9e('0x3d')](_0x1c693e[_0x0a9e('0x33')]['sort']);_0x30c491[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x3f')](_0x1c693e[_0x0a9e('0x33')],_0xb83dfd[_0x0a9e('0x36')]));if(_0x1c693e['query'][_0x0a9e('0x43')]){_0x30c491[_0x0a9e('0x3e')]=_[_0x0a9e('0x42')](_0x30c491['where'],{'$or':_[_0x0a9e('0x44')](_0x30c491['attributes'],function(_0x5211e3){var _0x242745={};_0x242745[_0x5211e3]={'$like':'%'+_0x1c693e[_0x0a9e('0x33')][_0x0a9e('0x43')]+'%'};return _0x242745;})});}_0x30c491=_[_0x0a9e('0x42')]({},_0x30c491,_0x1c693e[_0x0a9e('0x45')]);return _0x156662[_0x0a9e('0x4e')](_0x30c491);}})[_0x0a9e('0x16')](function(_0x54a37d){if(_0x54a37d){_0x5d86e9=_0x54a37d[_0x0a9e('0x39')];if(!_0x1c693e[_0x0a9e('0x33')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x30c491[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3c')](_0x1c693e[_0x0a9e('0x33')][_0x0a9e('0x3c')]);_0x30c491[_0x0a9e('0x25')]=qs[_0x0a9e('0x25')](_0x1c693e['query'][_0x0a9e('0x25')]);}return _0x156662[_0x0a9e('0x4e')](_0x30c491);}})[_0x0a9e('0x16')](function(_0x4edbb0){if(_0x4edbb0){return _0x4edbb0?{'count':_0x5d86e9,'rows':_0x4edbb0}:null;}})[_0x0a9e('0x16')](respondWithResult(_0x121cef,null))[_0x0a9e('0x20')](handleError(_0x121cef,null));};exports['addConfiguration']=function(_0x83f0b2,_0x56e31e,_0x3ef315){if(_0x83f0b2[_0x0a9e('0x4b')]['id']){delete _0x83f0b2[_0x0a9e('0x4b')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x83f0b2['params']['id']}})[_0x0a9e('0x16')](handleEntityNotFound(_0x56e31e,null))[_0x0a9e('0x16')](function(_0x1104ad){if(_0x1104ad){_0x83f0b2[_0x0a9e('0x4b')][_0x0a9e('0x4f')]=_0x1104ad['id'];_0x83f0b2[_0x0a9e('0x4b')][_0x0a9e('0x50')]=integrations[_0x0a9e('0x51')](_0x83f0b2['body'][_0x0a9e('0x52')],_0x83f0b2[_0x0a9e('0x4b')][_0x0a9e('0x53')]);_0x83f0b2['body'][_0x0a9e('0x54')]=integrations['getDescriptions'](_0x83f0b2[_0x0a9e('0x4b')][_0x0a9e('0x52')],_0x83f0b2['body'][_0x0a9e('0x53')]);return db[_0x0a9e('0x55')][_0x0a9e('0x56')](_0x83f0b2[_0x0a9e('0x4b')],{'include':[{'model':db['SugarcrmField'],'as':_0x0a9e('0x50')},{'model':db[_0x0a9e('0x57')],'as':_0x0a9e('0x54')}]});}return null;})[_0x0a9e('0x16')](respondWithResult(_0x56e31e,null))['catch'](handleError(_0x56e31e,null));};exports[_0x0a9e('0x58')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f;return db[_0x0a9e('0x2f')][_0x0a9e('0x4d')]({'where':{'id':_0x3d91db[_0x0a9e('0x49')]['id']},'attributes':['id',_0x0a9e('0x59'),_0x0a9e('0x5a'),_0x0a9e('0x5b')]})[_0x0a9e('0x16')](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x16')](function(_0x1a7b03){if(_0x1a7b03){_0x4abc8f=_0x1a7b03[_0x0a9e('0x5b')];return rp({'method':_0x0a9e('0x5c'),'uri':util[_0x0a9e('0x5d')](_0x0a9e('0x5e'),_0x4abc8f,_0x0a9e('0x5f')),'json':!![],'form':{'method':'login','input_type':_0x0a9e('0x60'),'response_type':_0x0a9e('0x60'),'rest_data':JSON[_0x0a9e('0x1a')]({'user_auth':{'user_name':_0x1a7b03['username'],'password':_0x1a7b03[_0x0a9e('0x5a')],'encryption':_0x0a9e('0x61')},'application':_0x0a9e('0x62')})}});}})[_0x0a9e('0x16')](function(_0x56d650){if(_0x56d650){return rp({'method':'POST','uri':util[_0x0a9e('0x5d')](_0x0a9e('0x5e'),_0x4abc8f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0a9e('0x63'),'input_type':'JSON','response_type':_0x0a9e('0x60'),'rest_data':JSON[_0x0a9e('0x1a')]({'session':_0x56d650['id'],'module_name':'Calls'})}});}})[_0x0a9e('0x16')](function(_0x41cf12){if(_0x41cf12){var _0x2d2286=_[_0x0a9e('0x64')](_0x41cf12[_0x0a9e('0x65')]);return{'count':_0x2d2286[_0x0a9e('0x39')],'rows':_[_0x0a9e('0x44')](_0x2d2286,function(_0x482ca2){return{'id':_0x482ca2[_0x0a9e('0x2c')],'name':_0x482ca2[_0x0a9e('0x66')],'custom':_[_0x0a9e('0x67')](_0x482ca2[_0x0a9e('0x2c')],'_c')?!![]:![],'options':_0x482ca2['options']?_[_0x0a9e('0x44')](_[_0x0a9e('0x64')](_0x482ca2['options']),function(_0x1d6834){return{'name':_0x1d6834['value'],'value':_0x1d6834[_0x0a9e('0x2c')]};}):[]};})};}})[_0x0a9e('0x16')](respondWithResult(_0x2d5506,null))[_0x0a9e('0x20')](function(_0x385d52){var _0x5af453=_0x3d91db['query'][_0x0a9e('0x68')]?0x1f4:_0x385d52[_0x0a9e('0x69')]||0x1f4;logger[_0x0a9e('0x1b')]('getFields,\x20%s,\x20%s,\x20%s',_0x0a9e('0x58'),_0x5af453,JSON[_0x0a9e('0x1a')](_0x385d52));delete _0x385d52['name'];if(_0x5af453===0x191){_0x5af453=0x190;}_0x2d5506['status'](_0x5af453)[_0x0a9e('0x2d')](_0x3d91db['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x385d52[_0x0a9e('0x69')]}:_0x385d52);});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 5acc405..c5152a2 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 _0xbb77=['util','../../config/logger','api','moment','bluebird','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbb77,0x168));var _0x7bb7=function(_0x5047c4,_0x4a35b5){_0x5047c4=_0x5047c4-0x0;var _0x3a7cd7=_0xbb77[_0x5047c4];return _0x3a7cd7;};'use strict';var _=require('lodash');var util=require(_0x7bb7('0x0'));var logger=require(_0x7bb7('0x1'))(_0x7bb7('0x2'));var moment=require(_0x7bb7('0x3'));var BPromise=require(_0x7bb7('0x4'));var rp=require('request-promise');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x7bb7('0x5'));module[_0x7bb7('0x6')]=function(_0x375b4a,_0x2a7c78){return _0x375b4a['define'](_0x7bb7('0x7'),attributes,{'tableName':_0x7bb7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7684=['bluebird','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api'];(function(_0x458829,_0x5dae88){var _0xc0a3c=function(_0x36e4e5){while(--_0x36e4e5){_0x458829['push'](_0x458829['shift']());}};_0xc0a3c(++_0x5dae88);}(_0x7684,0x167));var _0x4768=function(_0x17769b,_0x3a68b1){_0x17769b=_0x17769b-0x0;var _0x809e8a=_0x7684[_0x17769b];return _0x809e8a;};'use strict';var _=require(_0x4768('0x0'));var util=require(_0x4768('0x1'));var logger=require(_0x4768('0x2'))(_0x4768('0x3'));var moment=require('moment');var BPromise=require(_0x4768('0x4'));var rp=require('request-promise');var attributes=require(_0x4768('0x5'));var integrations=require(_0x4768('0x6'));module[_0x4768('0x7')]=function(_0x47866b,_0x219126){return _0x47866b[_0x4768('0x8')](_0x4768('0x9'),attributes,{'tableName':_0x4768('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 848ab7f..992f433 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 _0x0a09=['rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x0a09,0xd0));var _0x90a0=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0x0a09[_0x564821];return _0x2b604d;};'use strict';var _=require(_0x90a0('0x0'));var util=require(_0x90a0('0x1'));var moment=require(_0x90a0('0x2'));var BPromise=require(_0x90a0('0x3'));var rs=require(_0x90a0('0x4'));var fs=require('fs');var Redis=require(_0x90a0('0x5'));var db=require(_0x90a0('0x6'))['db'];var utils=require(_0x90a0('0x7'));var logger=require('../../config/logger')(_0x90a0('0x8'));var config=require(_0x90a0('0x9'));var jayson=require(_0x90a0('0xa'));var client=jayson['client'][_0x90a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ef49b,_0x293c55,_0x441cad){return new BPromise(function(_0x26019a,_0x23e9de){return client[_0x90a0('0xc')](_0x3ef49b,_0x441cad)[_0x90a0('0xd')](function(_0x5dfa4c){logger[_0x90a0('0xe')](_0x90a0('0xf'),_0x293c55,'request\x20sent');logger[_0x90a0('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x293c55,'request\x20sent',JSON[_0x90a0('0x11')](_0x5dfa4c));if(_0x5dfa4c['error']){if(_0x5dfa4c['error'][_0x90a0('0x12')]===0x1f4){logger['error'](_0x90a0('0xf'),_0x293c55,_0x5dfa4c[_0x90a0('0x13')][_0x90a0('0x14')]);return _0x23e9de(_0x5dfa4c['error'][_0x90a0('0x14')]);}logger[_0x90a0('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x293c55,_0x5dfa4c[_0x90a0('0x13')][_0x90a0('0x14')]);return _0x26019a(_0x5dfa4c[_0x90a0('0x13')]['message']);}else{logger[_0x90a0('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x293c55,_0x90a0('0x15'));_0x26019a(_0x5dfa4c[_0x90a0('0x16')]['message']);}})[_0x90a0('0x17')](function(_0x4efaf1){logger[_0x90a0('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x293c55,_0x4efaf1);_0x23e9de(_0x4efaf1);});});}exports[_0x90a0('0x18')]=function(_0x5dd859){var _0xbbd86e=this;return new Promise(function(_0x4dcf10,_0x2ee020){return db[_0x90a0('0x19')][_0x90a0('0x1a')]({'raw':_0x5dd859[_0x90a0('0x1b')]?_0x5dd859[_0x90a0('0x1b')][_0x90a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x5dd859[_0x90a0('0x1b')]?_0x5dd859[_0x90a0('0x1b')][_0x90a0('0x1d')]||null:null,'attributes':_0x5dd859['options']?_0x5dd859[_0x90a0('0x1b')][_0x90a0('0x1e')]||null:null,'limit':_0x5dd859[_0x90a0('0x1b')]?_0x5dd859[_0x90a0('0x1b')][_0x90a0('0x1f')]||null:null,'include':_0x5dd859[_0x90a0('0x1b')]?_0x5dd859[_0x90a0('0x1b')][_0x90a0('0x20')]?_['map'](_0x5dd859[_0x90a0('0x1b')][_0x90a0('0x20')],function(_0x494b45){return{'model':db[_0x494b45[_0x90a0('0x21')]],'as':_0x494b45['as'],'attributes':_0x494b45['attributes'],'include':_0x494b45['include']?_[_0x90a0('0x22')](_0x494b45['include'],function(_0x5ace31){return{'model':db[_0x5ace31[_0x90a0('0x21')]],'as':_0x5ace31['as'],'attributes':_0x5ace31[_0x90a0('0x1e')],'include':_0x5ace31['include']?_['map'](_0x5ace31[_0x90a0('0x20')],function(_0x10c786){return{'model':db[_0x10c786[_0x90a0('0x21')]],'as':_0x10c786['as'],'attributes':_0x10c786['attributes']};}):[]};}):[]};}):[]:[]})[_0x90a0('0xd')](function(_0x30104a){logger[_0x90a0('0xe')](_0x90a0('0x18'),_0x5dd859);logger[_0x90a0('0x10')](_0x90a0('0x18'),_0x5dd859,JSON[_0x90a0('0x11')](_0x30104a));_0x4dcf10(_0x30104a);})[_0x90a0('0x17')](function(_0x1b69bd){logger['error'](_0x90a0('0x18'),_0x1b69bd['message'],_0x5dd859);_0x2ee020(_0xbbd86e[_0x90a0('0x13')](0x1f4,_0x1b69bd[_0x90a0('0x14')]));});});};exports[_0x90a0('0x23')]=function(_0x8a72b4){var _0x4c0fc9=this;return new Promise(function(_0x397bd7,_0x4331d9){return db['SugarcrmAccount']['find']({'raw':_0x8a72b4['options']?_0x8a72b4['options'][_0x90a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x8a72b4[_0x90a0('0x1b')]?_0x8a72b4[_0x90a0('0x1b')][_0x90a0('0x1d')]||null:null,'attributes':_0x8a72b4[_0x90a0('0x1b')]?_0x8a72b4[_0x90a0('0x1b')][_0x90a0('0x1e')]||null:null,'include':_0x8a72b4[_0x90a0('0x1b')]?_0x8a72b4[_0x90a0('0x1b')]['include']?_[_0x90a0('0x22')](_0x8a72b4['options'][_0x90a0('0x20')],function(_0x39f0e2){return{'model':db[_0x39f0e2[_0x90a0('0x21')]],'as':_0x39f0e2['as'],'attributes':_0x39f0e2[_0x90a0('0x1e')],'include':_0x39f0e2[_0x90a0('0x20')]?_[_0x90a0('0x22')](_0x39f0e2[_0x90a0('0x20')],function(_0x217136){return{'model':db[_0x217136['model']],'as':_0x217136['as'],'attributes':_0x217136['attributes'],'include':_0x217136[_0x90a0('0x20')]?_['map'](_0x217136[_0x90a0('0x20')],function(_0x394de1){return{'model':db[_0x394de1[_0x90a0('0x21')]],'as':_0x394de1['as'],'attributes':_0x394de1[_0x90a0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x90a0('0xd')](function(_0x134822){logger[_0x90a0('0xe')]('ShowSugarcrmAccount',_0x8a72b4);logger[_0x90a0('0x10')]('ShowSugarcrmAccount',_0x8a72b4,JSON['stringify'](_0x134822));_0x397bd7(_0x134822);})[_0x90a0('0x17')](function(_0x45f81d){logger[_0x90a0('0x13')](_0x90a0('0x23'),_0x45f81d[_0x90a0('0x14')],_0x8a72b4);_0x4331d9(_0x4c0fc9[_0x90a0('0x13')](0x1f4,_0x45f81d['message']));});});}; \ No newline at end of file +var _0x157e=['then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','attributes','limit','map','include','model','ShowSugarcrmAccount','find','where','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x157e,0x7d));var _0xe157=function(_0x33b00c,_0x147745){_0x33b00c=_0x33b00c-0x0;var _0x5697dc=_0x157e[_0x33b00c];return _0x5697dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe157('0x0'));var BPromise=require(_0xe157('0x1'));var rs=require(_0xe157('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe157('0x3'))['db'];var utils=require(_0xe157('0x4'));var logger=require(_0xe157('0x5'))('rpc');var config=require(_0xe157('0x6'));var jayson=require(_0xe157('0x7'));var client=jayson[_0xe157('0x8')][_0xe157('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41465a,_0x1718cb,_0x382d8b){return new BPromise(function(_0x5cd409,_0x4fe153){return client[_0xe157('0xa')](_0x41465a,_0x382d8b)[_0xe157('0xb')](function(_0x2e9d34){logger[_0xe157('0xc')](_0xe157('0xd'),_0x1718cb,'request\x20sent');logger[_0xe157('0xe')](_0xe157('0xf'),_0x1718cb,_0xe157('0x10'),JSON[_0xe157('0x11')](_0x2e9d34));if(_0x2e9d34[_0xe157('0x12')]){if(_0x2e9d34[_0xe157('0x12')]['code']===0x1f4){logger[_0xe157('0x12')](_0xe157('0xd'),_0x1718cb,_0x2e9d34[_0xe157('0x12')][_0xe157('0x13')]);return _0x4fe153(_0x2e9d34[_0xe157('0x12')][_0xe157('0x13')]);}logger[_0xe157('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x1718cb,_0x2e9d34[_0xe157('0x12')]['message']);return _0x5cd409(_0x2e9d34[_0xe157('0x12')]['message']);}else{logger['info'](_0xe157('0xd'),_0x1718cb,_0xe157('0x10'));_0x5cd409(_0x2e9d34[_0xe157('0x14')]['message']);}})[_0xe157('0x15')](function(_0x34a9a2){logger[_0xe157('0x12')](_0xe157('0xd'),_0x1718cb,_0x34a9a2);_0x4fe153(_0x34a9a2);});});}exports[_0xe157('0x16')]=function(_0x2ee9b6){var _0x1f3244=this;return new Promise(function(_0x39f099,_0x42d922){return db[_0xe157('0x17')]['findAll']({'raw':_0x2ee9b6[_0xe157('0x18')]?_0x2ee9b6['options'][_0xe157('0x19')]===undefined?!![]:![]:!![],'where':_0x2ee9b6['options']?_0x2ee9b6[_0xe157('0x18')]['where']||null:null,'attributes':_0x2ee9b6[_0xe157('0x18')]?_0x2ee9b6[_0xe157('0x18')][_0xe157('0x1a')]||null:null,'limit':_0x2ee9b6['options']?_0x2ee9b6[_0xe157('0x18')][_0xe157('0x1b')]||null:null,'include':_0x2ee9b6[_0xe157('0x18')]?_0x2ee9b6[_0xe157('0x18')]['include']?_[_0xe157('0x1c')](_0x2ee9b6[_0xe157('0x18')][_0xe157('0x1d')],function(_0x6dda03){return{'model':db[_0x6dda03[_0xe157('0x1e')]],'as':_0x6dda03['as'],'attributes':_0x6dda03[_0xe157('0x1a')],'include':_0x6dda03['include']?_[_0xe157('0x1c')](_0x6dda03[_0xe157('0x1d')],function(_0x1f9d74){return{'model':db[_0x1f9d74[_0xe157('0x1e')]],'as':_0x1f9d74['as'],'attributes':_0x1f9d74[_0xe157('0x1a')],'include':_0x1f9d74['include']?_[_0xe157('0x1c')](_0x1f9d74[_0xe157('0x1d')],function(_0x184d52){return{'model':db[_0x184d52['model']],'as':_0x184d52['as'],'attributes':_0x184d52[_0xe157('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe157('0xb')](function(_0x53d3b5){logger[_0xe157('0xc')](_0xe157('0x16'),_0x2ee9b6);logger[_0xe157('0xe')](_0xe157('0x16'),_0x2ee9b6,JSON['stringify'](_0x53d3b5));_0x39f099(_0x53d3b5);})[_0xe157('0x15')](function(_0x3aac43){logger['error'](_0xe157('0x16'),_0x3aac43[_0xe157('0x13')],_0x2ee9b6);_0x42d922(_0x1f3244[_0xe157('0x12')](0x1f4,_0x3aac43[_0xe157('0x13')]));});});};exports[_0xe157('0x1f')]=function(_0x1c7f8c){var _0x4366e2=this;return new Promise(function(_0x492d81,_0x41787f){return db[_0xe157('0x17')][_0xe157('0x20')]({'raw':_0x1c7f8c['options']?_0x1c7f8c[_0xe157('0x18')][_0xe157('0x19')]===undefined?!![]:![]:!![],'where':_0x1c7f8c['options']?_0x1c7f8c[_0xe157('0x18')][_0xe157('0x21')]||null:null,'attributes':_0x1c7f8c[_0xe157('0x18')]?_0x1c7f8c[_0xe157('0x18')][_0xe157('0x1a')]||null:null,'include':_0x1c7f8c[_0xe157('0x18')]?_0x1c7f8c[_0xe157('0x18')][_0xe157('0x1d')]?_[_0xe157('0x1c')](_0x1c7f8c['options'][_0xe157('0x1d')],function(_0x52a502){return{'model':db[_0x52a502[_0xe157('0x1e')]],'as':_0x52a502['as'],'attributes':_0x52a502[_0xe157('0x1a')],'include':_0x52a502[_0xe157('0x1d')]?_[_0xe157('0x1c')](_0x52a502[_0xe157('0x1d')],function(_0x204ae9){return{'model':db[_0x204ae9[_0xe157('0x1e')]],'as':_0x204ae9['as'],'attributes':_0x204ae9[_0xe157('0x1a')],'include':_0x204ae9[_0xe157('0x1d')]?_['map'](_0x204ae9[_0xe157('0x1d')],function(_0x2211f3){return{'model':db[_0x2211f3[_0xe157('0x1e')]],'as':_0x2211f3['as'],'attributes':_0x2211f3[_0xe157('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe157('0xb')](function(_0x209c07){logger[_0xe157('0xc')](_0xe157('0x1f'),_0x1c7f8c);logger['debug'](_0xe157('0x1f'),_0x1c7f8c,JSON[_0xe157('0x11')](_0x209c07));_0x492d81(_0x209c07);})['catch'](function(_0x332411){logger[_0xe157('0x12')](_0xe157('0x1f'),_0x332411['message'],_0x1c7f8c);_0x41787f(_0x4366e2[_0xe157('0x12')](0x1f4,_0x332411[_0xe157('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 2871d2c..4b7ecac 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 _0x76a3=['/:id/subjects','/:id/descriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','index','get','/:id','isAuthenticated','/:id/fields','getFields'];(function(_0x50e0f9,_0x54c3db){var _0x4d42ea=function(_0x236bc5){while(--_0x236bc5){_0x50e0f9['push'](_0x50e0f9['shift']());}};_0x4d42ea(++_0x54c3db);}(_0x76a3,0xf8));var _0x376a=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x76a3[_0x2706da];return _0x3ba87e;};'use strict';var multer=require(_0x376a('0x0'));var util=require(_0x376a('0x1'));var path=require(_0x376a('0x2'));var timeout=require(_0x376a('0x3'));var express=require(_0x376a('0x4'));var router=express[_0x376a('0x5')]();var auth=require(_0x376a('0x6'));var interaction=require(_0x376a('0x7'));var config=require(_0x376a('0x8'));var controller=require(_0x376a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x376a('0xa')]);router[_0x376a('0xb')](_0x376a('0xc'),auth[_0x376a('0xd')](),controller['show']);router[_0x376a('0xb')](_0x376a('0xe'),auth[_0x376a('0xd')](),controller[_0x376a('0xf')]);router[_0x376a('0xb')](_0x376a('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x376a('0x11'),auth[_0x376a('0xd')](),controller['getDescriptions']);router[_0x376a('0x12')]('/',auth['isAuthenticated'](),controller[_0x376a('0x13')]);router[_0x376a('0x14')]('/:id',auth[_0x376a('0xd')](),controller[_0x376a('0x15')]);router[_0x376a('0x16')]('/:id',auth[_0x376a('0xd')](),controller['destroy']);module[_0x376a('0x17')]=router; \ No newline at end of file +var _0x1fd2=['getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','/:id/fields'];(function(_0x5212bd,_0x1f2973){var _0x37d0bf=function(_0x489b98){while(--_0x489b98){_0x5212bd['push'](_0x5212bd['shift']());}};_0x37d0bf(++_0x1f2973);}(_0x1fd2,0x184));var _0x21fd=function(_0x14333b,_0x2c5a67){_0x14333b=_0x14333b-0x0;var _0x3131db=_0x1fd2[_0x14333b];return _0x3131db;};'use strict';var multer=require('multer');var util=require(_0x21fd('0x0'));var path=require(_0x21fd('0x1'));var timeout=require('connect-timeout');var express=require(_0x21fd('0x2'));var router=express[_0x21fd('0x3')]();var auth=require(_0x21fd('0x4'));var interaction=require(_0x21fd('0x5'));var config=require('../../config/environment');var controller=require(_0x21fd('0x6'));router[_0x21fd('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x21fd('0x7')](_0x21fd('0x8'),auth[_0x21fd('0x9')](),controller['show']);router[_0x21fd('0x7')](_0x21fd('0xa'),auth[_0x21fd('0x9')](),controller[_0x21fd('0xb')]);router[_0x21fd('0x7')](_0x21fd('0xc'),auth[_0x21fd('0x9')](),controller['getSubjects']);router[_0x21fd('0x7')](_0x21fd('0xd'),auth[_0x21fd('0x9')](),controller['getDescriptions']);router[_0x21fd('0xe')]('/',auth[_0x21fd('0x9')](),controller[_0x21fd('0xf')]);router[_0x21fd('0x10')](_0x21fd('0x8'),auth[_0x21fd('0x9')](),controller[_0x21fd('0x11')]);router[_0x21fd('0x12')](_0x21fd('0x8'),auth[_0x21fd('0x9')](),controller[_0x21fd('0x13')]);module[_0x21fd('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index e013088..2e97881 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 _0xdcb2=['exports','STRING','sequelize'];(function(_0x564523,_0x5db1c8){var _0x404d2a=function(_0x346236){while(--_0x346236){_0x564523['push'](_0x564523['shift']());}};_0x404d2a(++_0x5db1c8);}(_0xdcb2,0x137));var _0x2dcb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdcb2[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x2dcb('0x0'));module[_0x2dcb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2dcb('0x2')]}}; \ No newline at end of file +var _0xa0a6=['STRING','sequelize'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xa0a6,0x125));var _0x6a0a=function(_0x2b44cb,_0x522c39){_0x2b44cb=_0x2b44cb-0x0;var _0x339ad2=_0xa0a6[_0x2b44cb];return _0x339ad2;};'use strict';var Sequelize=require(_0x6a0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a0a('0x1')]},'description':{'type':Sequelize[_0x6a0a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6d8d078..03c4ca0 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 _0x47ea=['set','Content-Range','apply','reject','destroy','stack','name','send','index','SugarcrmConfiguration','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','add','day','merge','where','filter','map','options','includeAll','findAll','rows','catch','length','include','find','create','update','body','params','getFields','findOne','SugarcrmField','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','result','sendStatus','status','end','json','count','offset','limit'];(function(_0x1ad48b,_0x2ca9c3){var _0xe307c1=function(_0x4d8c4b){while(--_0x4d8c4b){_0x1ad48b['push'](_0x1ad48b['shift']());}};_0xe307c1(++_0x2ca9c3);}(_0x47ea,0x138));var _0xa47e=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x47ea[_0x2d994d];return _0xd54be4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa47e('0x0'));var rimraf=require(_0xa47e('0x1'));var zipdir=require(_0xa47e('0x2'));var jsonpatch=require(_0xa47e('0x3'));var rp=require(_0xa47e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa47e('0x5'));var util=require(_0xa47e('0x6'));var path=require(_0xa47e('0x7'));var sox=require(_0xa47e('0x8'));var csv=require('to-csv');var ejs=require(_0xa47e('0x9'));var fs=require('fs');var _=require(_0xa47e('0xa'));var squel=require('squel');var crypto=require(_0xa47e('0xb'));var jsforce=require(_0xa47e('0xc'));var deskjs=require(_0xa47e('0xd'));var toCsv=require(_0xa47e('0xe'));var querystring=require('querystring');var Papa=require(_0xa47e('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa47e('0x10'))('api');var utils=require(_0xa47e('0x11'));var config=require(_0xa47e('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa47e('0x13'));var client=jayson[_0xa47e('0x14')][_0xa47e('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1c579e,_0x3a8e87,_0x6efd50,_0x283be4){return new BPromise(function(_0xeed636,_0x4997c4){var _0x10f1a3=_0x283be4||client;return _0x10f1a3[_0xa47e('0x16')](_0x1c579e,_0x6efd50)[_0xa47e('0x17')](function(_0x26e59e){logger[_0xa47e('0x18')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3a8e87,'request\x20sent');logger[_0xa47e('0x19')](_0xa47e('0x1a'),_0x3a8e87,_0xa47e('0x1b'),JSON['stringify'](_0x26e59e));if(_0x26e59e[_0xa47e('0x1c')]){if(_0x26e59e['error'][_0xa47e('0x1d')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3a8e87,_0x26e59e[_0xa47e('0x1c')]['message']);return _0x4997c4(_0x26e59e['error'][_0xa47e('0x1e')]);}logger[_0xa47e('0x1c')](_0xa47e('0x1f'),_0x3a8e87,_0x26e59e['error'][_0xa47e('0x1e')]);return _0xeed636(_0x26e59e[_0xa47e('0x1c')][_0xa47e('0x1e')]);}else{logger[_0xa47e('0x18')](_0xa47e('0x1f'),_0x3a8e87,_0xa47e('0x1b'));_0xeed636(_0x26e59e[_0xa47e('0x20')]['message']);}})['catch'](function(_0x2dbedf){logger['error'](_0xa47e('0x1f'),_0x3a8e87,_0x2dbedf);_0x4997c4(_0x2dbedf);});});}function respondWithStatusCode(_0x248fcd,_0x2c7d01){_0x2c7d01=_0x2c7d01||0xcc;return function(_0x1b3210){if(_0x1b3210){return _0x248fcd[_0xa47e('0x21')](_0x2c7d01);}return _0x248fcd[_0xa47e('0x22')](_0x2c7d01)[_0xa47e('0x23')]();};}function respondWithResult(_0x17b3ad,_0x5df017){_0x5df017=_0x5df017||0xc8;return function(_0x417f1e){if(_0x417f1e){return _0x17b3ad[_0xa47e('0x22')](_0x5df017)[_0xa47e('0x24')](_0x417f1e);}};}function respondWithFilteredResult(_0x12a6a3,_0x4264fb){return function(_0x308b81){if(_0x308b81){var _0x495927=_0x308b81[_0xa47e('0x25')],_0x393fce=_0x4264fb[_0xa47e('0x26')],_0x572c49=_0x4264fb[_0xa47e('0x26')]+_0x4264fb[_0xa47e('0x27')],_0x4fd775;if(_0x572c49>=_0x495927){_0x572c49=_0x495927;_0x4fd775=0xc8;}else{_0x4fd775=0xce;}_0x12a6a3[_0xa47e('0x22')](_0x4fd775);return _0x12a6a3[_0xa47e('0x28')](_0xa47e('0x29'),_0x393fce+'-'+_0x572c49+'/'+_0x495927)[_0xa47e('0x24')](_0x308b81);}return null;};}function patchUpdates(_0x3a9cbb){return function(_0x21f6d2){try{jsonpatch[_0xa47e('0x2a')](_0x21f6d2,_0x3a9cbb,!![]);}catch(_0x4ec3a6){return BPromise[_0xa47e('0x2b')](_0x4ec3a6);}return _0x21f6d2['save']();};}function saveUpdates(_0x4f0fe6,_0x4f0215){return function(_0x36a327){if(_0x36a327){return _0x36a327['update'](_0x4f0fe6)[_0xa47e('0x17')](function(_0xad81c9){return _0xad81c9;});}return null;};}function removeEntity(_0x3613a5,_0x2e9ffc){return function(_0x21247d){if(_0x21247d){return _0x21247d[_0xa47e('0x2c')]()['then'](function(){_0x3613a5[_0xa47e('0x22')](0xcc)[_0xa47e('0x23')]();});}};}function handleEntityNotFound(_0x51bec4,_0x2d3260){return function(_0x95b8d4){if(!_0x95b8d4){_0x51bec4[_0xa47e('0x21')](0x194);}return _0x95b8d4;};}function handleError(_0x3f62b0,_0x186958){_0x186958=_0x186958||0x1f4;return function(_0x40e8ac){logger[_0xa47e('0x1c')](_0x40e8ac[_0xa47e('0x2d')]);if(_0x40e8ac[_0xa47e('0x2e')]){delete _0x40e8ac['name'];}_0x3f62b0['status'](_0x186958)[_0xa47e('0x2f')](_0x40e8ac);};}exports[_0xa47e('0x30')]=function(_0x38cf82,_0x37d2d7){var _0x14edfb={},_0x2a9946={},_0x2b0085={'count':0x0,'rows':[]};var _0x574e3c=db[_0xa47e('0x31')][_0xa47e('0x32')];_0x2a9946[_0xa47e('0x33')]=_[_0xa47e('0x34')](_0x574e3c);var _0x19735e={'dateStart':_0x38cf82['query'][_0xa47e('0x35')],'dateEnd':_0x38cf82['query'][_0xa47e('0x36')]};delete _0x38cf82[_0xa47e('0x37')][_0xa47e('0x35')];delete _0x38cf82[_0xa47e('0x37')]['dateEnd'];_0x2a9946[_0xa47e('0x37')]=_[_0xa47e('0x34')](_0x38cf82[_0xa47e('0x37')]);_0x2a9946[_0xa47e('0x38')]=_[_0xa47e('0x39')](_0x2a9946['model'],_0x2a9946[_0xa47e('0x37')]);_0x14edfb['attributes']=_[_0xa47e('0x39')](_0x2a9946[_0xa47e('0x33')],qs[_0xa47e('0x3a')](_0x38cf82[_0xa47e('0x37')][_0xa47e('0x3a')]));_0x14edfb[_0xa47e('0x3b')]=_0x14edfb['attributes']['length']?_0x14edfb[_0xa47e('0x3b')]:_0x2a9946[_0xa47e('0x33')];if(!_0x38cf82[_0xa47e('0x37')][_0xa47e('0x3c')]('nolimit')){_0x14edfb[_0xa47e('0x27')]=qs['limit'](_0x38cf82[_0xa47e('0x37')][_0xa47e('0x27')]);_0x14edfb['offset']=qs['offset'](_0x38cf82[_0xa47e('0x37')][_0xa47e('0x26')]);}_0x14edfb[_0xa47e('0x3d')]=qs[_0xa47e('0x3e')](_0x38cf82[_0xa47e('0x37')][_0xa47e('0x3e')]);_0x14edfb['where']=qs[_0xa47e('0x38')](_['pick'](_0x38cf82[_0xa47e('0x37')],_0x2a9946['filters']));if(_0x19735e[_0xa47e('0x35')]){if(_0x19735e[_0xa47e('0x36')]){_0x19735e[_0xa47e('0x36')]=moment(_0x19735e[_0xa47e('0x36')])[_0xa47e('0x3f')](0x1,_0xa47e('0x40'));}else{_0x19735e['dateEnd']=moment(_0x19735e['dateStart'])[_0xa47e('0x3f')](0x1,'day');}_[_0xa47e('0x41')](_0x14edfb[_0xa47e('0x42')],{'createdAt':{'$gte':_0x19735e[_0xa47e('0x35')],'$lte':_0x19735e[_0xa47e('0x36')]}});}if(_0x38cf82[_0xa47e('0x37')][_0xa47e('0x43')]){_0x14edfb[_0xa47e('0x42')]=_['merge'](_0x14edfb[_0xa47e('0x42')],{'$or':_[_0xa47e('0x44')](_0x14edfb['attributes'],function(_0x4d57f3){var _0x3f82c9={};_0x3f82c9[_0x4d57f3]={'$like':'%'+_0x38cf82['query'][_0xa47e('0x43')]+'%'};return _0x3f82c9;})});}_0x14edfb=_['merge']({},_0x14edfb,_0x38cf82[_0xa47e('0x45')]);var _0x27dfe0={'where':_0x14edfb[_0xa47e('0x42')]};return db[_0xa47e('0x31')][_0xa47e('0x25')](_0x27dfe0)[_0xa47e('0x17')](function(_0x2f22a3){_0x2b0085[_0xa47e('0x25')]=_0x2f22a3;if(_0x38cf82[_0xa47e('0x37')][_0xa47e('0x46')]){_0x14edfb['include']=[{'all':!![]}];}return db[_0xa47e('0x31')][_0xa47e('0x47')](_0x14edfb);})[_0xa47e('0x17')](function(_0x402df8){_0x2b0085[_0xa47e('0x48')]=_0x402df8;return _0x2b0085;})[_0xa47e('0x17')](respondWithFilteredResult(_0x37d2d7,_0x14edfb))[_0xa47e('0x49')](handleError(_0x37d2d7,null));};exports['show']=function(_0x279985,_0x4c8c26){var _0x383ad0={'raw':![],'where':{'id':_0x279985['params']['id']}},_0x3daf1b={};_0x3daf1b['model']=_[_0xa47e('0x34')](db['SugarcrmConfiguration'][_0xa47e('0x32')]);_0x3daf1b['query']=_[_0xa47e('0x34')](_0x279985[_0xa47e('0x37')]);_0x3daf1b[_0xa47e('0x38')]=_[_0xa47e('0x39')](_0x3daf1b[_0xa47e('0x33')],_0x3daf1b[_0xa47e('0x37')]);_0x383ad0[_0xa47e('0x3b')]=_[_0xa47e('0x39')](_0x3daf1b[_0xa47e('0x33')],qs[_0xa47e('0x3a')](_0x279985['query']['fields']));_0x383ad0['attributes']=_0x383ad0[_0xa47e('0x3b')][_0xa47e('0x4a')]?_0x383ad0[_0xa47e('0x3b')]:_0x3daf1b['model'];if(_0x279985[_0xa47e('0x37')][_0xa47e('0x46')]){_0x383ad0[_0xa47e('0x4b')]=[{'all':!![]}];}_0x383ad0=_[_0xa47e('0x41')]({},_0x383ad0,_0x279985[_0xa47e('0x45')]);return db[_0xa47e('0x31')][_0xa47e('0x4c')](_0x383ad0)[_0xa47e('0x17')](handleEntityNotFound(_0x4c8c26,null))[_0xa47e('0x17')](respondWithResult(_0x4c8c26,null))[_0xa47e('0x49')](handleError(_0x4c8c26,null));};exports[_0xa47e('0x4d')]=function(_0x436ff4,_0x3419ce){return db[_0xa47e('0x31')]['create'](_0x436ff4['body'],{})[_0xa47e('0x17')](respondWithResult(_0x3419ce,0xc9))[_0xa47e('0x49')](handleError(_0x3419ce,null));};exports[_0xa47e('0x4e')]=function(_0x30fdac,_0xfd5359){if(_0x30fdac[_0xa47e('0x4f')]['id']){delete _0x30fdac[_0xa47e('0x4f')]['id'];}return db[_0xa47e('0x31')][_0xa47e('0x4c')]({'where':{'id':_0x30fdac[_0xa47e('0x50')]['id']}})[_0xa47e('0x17')](handleEntityNotFound(_0xfd5359,null))[_0xa47e('0x17')](saveUpdates(_0x30fdac[_0xa47e('0x4f')],null))['then'](respondWithResult(_0xfd5359,null))['catch'](handleError(_0xfd5359,null));};exports[_0xa47e('0x2c')]=function(_0x591746,_0x29ee41){return db[_0xa47e('0x31')][_0xa47e('0x4c')]({'where':{'id':_0x591746['params']['id']}})[_0xa47e('0x17')](handleEntityNotFound(_0x29ee41,null))[_0xa47e('0x17')](removeEntity(_0x29ee41,null))['catch'](handleError(_0x29ee41,null));};exports[_0xa47e('0x51')]=function(_0x43b0ec,_0x3b5206,_0x4e59a7){var _0x38491b={};var _0x271c30={};var _0x2760ce;var _0x46475f;return db[_0xa47e('0x31')][_0xa47e('0x52')]({'where':{'id':_0x43b0ec['params']['id']}})[_0xa47e('0x17')](handleEntityNotFound(_0x3b5206,null))['then'](function(_0x57eacd){if(_0x57eacd){_0x2760ce=_0x57eacd;_0x271c30['model']=_[_0xa47e('0x34')](db[_0xa47e('0x53')][_0xa47e('0x32')]);_0x271c30['query']=_['keys'](_0x43b0ec[_0xa47e('0x37')]);_0x271c30[_0xa47e('0x38')]=_['intersection'](_0x271c30[_0xa47e('0x33')],_0x271c30[_0xa47e('0x37')]);_0x38491b['attributes']=_[_0xa47e('0x39')](_0x271c30[_0xa47e('0x33')],qs[_0xa47e('0x3a')](_0x43b0ec[_0xa47e('0x37')][_0xa47e('0x3a')]));_0x38491b[_0xa47e('0x3b')]=_0x38491b[_0xa47e('0x3b')][_0xa47e('0x4a')]?_0x38491b[_0xa47e('0x3b')]:_0x271c30[_0xa47e('0x33')];_0x38491b[_0xa47e('0x3d')]=qs[_0xa47e('0x3e')](_0x43b0ec[_0xa47e('0x37')]['sort']);_0x38491b['where']=qs[_0xa47e('0x38')](_[_0xa47e('0x54')](_0x43b0ec[_0xa47e('0x37')],_0x271c30['filters']));if(_0x43b0ec[_0xa47e('0x37')][_0xa47e('0x43')]){_0x38491b['where']=_[_0xa47e('0x41')](_0x38491b[_0xa47e('0x42')],{'$or':_[_0xa47e('0x44')](_0x38491b[_0xa47e('0x3b')],function(_0x18f231){var _0x2c7fea={};_0x2c7fea[_0x18f231]={'$like':'%'+_0x43b0ec['query'][_0xa47e('0x43')]+'%'};return _0x2c7fea;})});}_0x38491b=_[_0xa47e('0x41')]({},_0x38491b,_0x43b0ec[_0xa47e('0x45')]);return _0x2760ce['getFields'](_0x38491b);}})[_0xa47e('0x17')](function(_0x2c8fbb){if(_0x2c8fbb){_0x46475f=_0x2c8fbb[_0xa47e('0x4a')];if(!_0x43b0ec[_0xa47e('0x37')][_0xa47e('0x3c')](_0xa47e('0x55'))){_0x38491b['limit']=qs[_0xa47e('0x27')](_0x43b0ec['query']['limit']);_0x38491b[_0xa47e('0x26')]=qs[_0xa47e('0x26')](_0x43b0ec['query'][_0xa47e('0x26')]);}return _0x2760ce[_0xa47e('0x51')](_0x38491b);}})[_0xa47e('0x17')](function(_0x445992){if(_0x445992){return _0x445992?{'count':_0x46475f,'rows':_0x445992}:null;}})[_0xa47e('0x17')](respondWithResult(_0x3b5206,null))[_0xa47e('0x49')](handleError(_0x3b5206,null));};exports[_0xa47e('0x56')]=function(_0x18d2b0,_0x6f5577,_0x57dabd){var _0x56c2a7={};var _0x5f07cc={};var _0x435867;var _0x5ad448;return db['SugarcrmConfiguration'][_0xa47e('0x52')]({'where':{'id':_0x18d2b0[_0xa47e('0x50')]['id']}})[_0xa47e('0x17')](handleEntityNotFound(_0x6f5577,null))[_0xa47e('0x17')](function(_0xf56e18){if(_0xf56e18){_0x435867=_0xf56e18;_0x5f07cc[_0xa47e('0x33')]=_[_0xa47e('0x34')](db[_0xa47e('0x53')][_0xa47e('0x32')]);_0x5f07cc[_0xa47e('0x37')]=_[_0xa47e('0x34')](_0x18d2b0[_0xa47e('0x37')]);_0x5f07cc['filters']=_[_0xa47e('0x39')](_0x5f07cc[_0xa47e('0x33')],_0x5f07cc[_0xa47e('0x37')]);_0x56c2a7[_0xa47e('0x3b')]=_['intersection'](_0x5f07cc[_0xa47e('0x33')],qs[_0xa47e('0x3a')](_0x18d2b0[_0xa47e('0x37')]['fields']));_0x56c2a7['attributes']=_0x56c2a7['attributes']['length']?_0x56c2a7[_0xa47e('0x3b')]:_0x5f07cc[_0xa47e('0x33')];_0x56c2a7[_0xa47e('0x3d')]=qs['sort'](_0x18d2b0['query']['sort']);_0x56c2a7[_0xa47e('0x42')]=qs['filters'](_[_0xa47e('0x54')](_0x18d2b0[_0xa47e('0x37')],_0x5f07cc[_0xa47e('0x38')]));if(_0x18d2b0[_0xa47e('0x37')][_0xa47e('0x43')]){_0x56c2a7[_0xa47e('0x42')]=_[_0xa47e('0x41')](_0x56c2a7['where'],{'$or':_['map'](_0x56c2a7['attributes'],function(_0x40e2da){var _0x411b81={};_0x411b81[_0x40e2da]={'$like':'%'+_0x18d2b0['query'][_0xa47e('0x43')]+'%'};return _0x411b81;})});}_0x56c2a7=_[_0xa47e('0x41')]({},_0x56c2a7,_0x18d2b0[_0xa47e('0x45')]);return _0x435867[_0xa47e('0x56')](_0x56c2a7);}})[_0xa47e('0x17')](function(_0x57aba6){if(_0x57aba6){_0x5ad448=_0x57aba6[_0xa47e('0x4a')];if(!_0x18d2b0[_0xa47e('0x37')][_0xa47e('0x3c')]('nolimit')){_0x56c2a7[_0xa47e('0x27')]=qs[_0xa47e('0x27')](_0x18d2b0['query'][_0xa47e('0x27')]);_0x56c2a7['offset']=qs[_0xa47e('0x26')](_0x18d2b0[_0xa47e('0x37')][_0xa47e('0x26')]);}return _0x435867[_0xa47e('0x56')](_0x56c2a7);}})[_0xa47e('0x17')](function(_0x3dad50){if(_0x3dad50){return _0x3dad50?{'count':_0x5ad448,'rows':_0x3dad50}:null;}})[_0xa47e('0x17')](respondWithResult(_0x6f5577,null))['catch'](handleError(_0x6f5577,null));};exports[_0xa47e('0x57')]=function(_0x1df4f9,_0x4905e1,_0x447390){var _0x382dae={};var _0x2e9b73={};var _0x5e83c2;var _0x1a68ae;return db[_0xa47e('0x31')]['findOne']({'where':{'id':_0x1df4f9[_0xa47e('0x50')]['id']}})[_0xa47e('0x17')](handleEntityNotFound(_0x4905e1,null))[_0xa47e('0x17')](function(_0x213f2e){if(_0x213f2e){_0x5e83c2=_0x213f2e;_0x2e9b73[_0xa47e('0x33')]=_[_0xa47e('0x34')](db['SugarcrmField'][_0xa47e('0x32')]);_0x2e9b73[_0xa47e('0x37')]=_[_0xa47e('0x34')](_0x1df4f9[_0xa47e('0x37')]);_0x2e9b73[_0xa47e('0x38')]=_[_0xa47e('0x39')](_0x2e9b73['model'],_0x2e9b73[_0xa47e('0x37')]);_0x382dae[_0xa47e('0x3b')]=_[_0xa47e('0x39')](_0x2e9b73[_0xa47e('0x33')],qs[_0xa47e('0x3a')](_0x1df4f9[_0xa47e('0x37')]['fields']));_0x382dae[_0xa47e('0x3b')]=_0x382dae[_0xa47e('0x3b')]['length']?_0x382dae[_0xa47e('0x3b')]:_0x2e9b73[_0xa47e('0x33')];_0x382dae[_0xa47e('0x3d')]=qs[_0xa47e('0x3e')](_0x1df4f9[_0xa47e('0x37')][_0xa47e('0x3e')]);_0x382dae[_0xa47e('0x42')]=qs[_0xa47e('0x38')](_['pick'](_0x1df4f9[_0xa47e('0x37')],_0x2e9b73[_0xa47e('0x38')]));if(_0x1df4f9[_0xa47e('0x37')][_0xa47e('0x43')]){_0x382dae[_0xa47e('0x42')]=_['merge'](_0x382dae[_0xa47e('0x42')],{'$or':_[_0xa47e('0x44')](_0x382dae['attributes'],function(_0x415ec8){var _0x3c8d36={};_0x3c8d36[_0x415ec8]={'$like':'%'+_0x1df4f9[_0xa47e('0x37')][_0xa47e('0x43')]+'%'};return _0x3c8d36;})});}_0x382dae=_[_0xa47e('0x41')]({},_0x382dae,_0x1df4f9['options']);return _0x5e83c2[_0xa47e('0x57')](_0x382dae);}})[_0xa47e('0x17')](function(_0x597270){if(_0x597270){_0x1a68ae=_0x597270[_0xa47e('0x4a')];if(!_0x1df4f9[_0xa47e('0x37')][_0xa47e('0x3c')](_0xa47e('0x55'))){_0x382dae[_0xa47e('0x27')]=qs[_0xa47e('0x27')](_0x1df4f9['query'][_0xa47e('0x27')]);_0x382dae[_0xa47e('0x26')]=qs[_0xa47e('0x26')](_0x1df4f9['query'][_0xa47e('0x26')]);}return _0x5e83c2[_0xa47e('0x57')](_0x382dae);}})['then'](function(_0x9c5127){if(_0x9c5127){return _0x9c5127?{'count':_0x1a68ae,'rows':_0x9c5127}:null;}})[_0xa47e('0x17')](respondWithResult(_0x4905e1,null))[_0xa47e('0x49')](handleError(_0x4905e1,null));}; \ No newline at end of file +var _0x3362=['filter','options','rows','params','includeAll','include','find','create','body','destroy','findOne','SugarcrmField','length','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','stack','name','send','index','SugarcrmConfiguration','rawAttributes','model','dateStart','dateEnd','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','map'];(function(_0xe50abc,_0x52e9fd){var _0x2bb64c=function(_0x4eb87c){while(--_0x4eb87c){_0xe50abc['push'](_0xe50abc['shift']());}};_0x2bb64c(++_0x52e9fd);}(_0x3362,0x121));var _0x2336=function(_0x4abd2f,_0x1fe461){_0x4abd2f=_0x4abd2f-0x0;var _0x25e823=_0x3362[_0x4abd2f];return _0x25e823;};'use strict';var pdf=require(_0x2336('0x0'));var emlformat=require(_0x2336('0x1'));var rimraf=require(_0x2336('0x2'));var zipdir=require(_0x2336('0x3'));var jsonpatch=require(_0x2336('0x4'));var rp=require(_0x2336('0x5'));var moment=require('moment');var BPromise=require(_0x2336('0x6'));var Mustache=require(_0x2336('0x7'));var util=require(_0x2336('0x8'));var path=require('path');var sox=require(_0x2336('0x9'));var csv=require(_0x2336('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2336('0xb'));var crypto=require(_0x2336('0xc'));var jsforce=require(_0x2336('0xd'));var deskjs=require(_0x2336('0xe'));var toCsv=require(_0x2336('0xa'));var querystring=require(_0x2336('0xf'));var Papa=require('papaparse');var Redis=require(_0x2336('0x10'));var qs=require(_0x2336('0x11'));var logger=require(_0x2336('0x12'))(_0x2336('0x13'));var utils=require('../../config/utils');var config=require(_0x2336('0x14'));var db=require(_0x2336('0x15'))['db'];var jayson=require(_0x2336('0x16'));var client=jayson[_0x2336('0x17')][_0x2336('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x358581,_0x59d468,_0x464567,_0x565891){return new BPromise(function(_0x351a48,_0x4a6d76){var _0x3d7669=_0x565891||client;return _0x3d7669[_0x2336('0x19')](_0x358581,_0x464567)[_0x2336('0x1a')](function(_0x20932a){logger[_0x2336('0x1b')](_0x2336('0x1c'),_0x59d468,_0x2336('0x1d'));logger[_0x2336('0x1e')](_0x2336('0x1f'),_0x59d468,_0x2336('0x1d'),JSON[_0x2336('0x20')](_0x20932a));if(_0x20932a[_0x2336('0x21')]){if(_0x20932a[_0x2336('0x21')][_0x2336('0x22')]===0x1f4){logger[_0x2336('0x21')](_0x2336('0x1c'),_0x59d468,_0x20932a[_0x2336('0x21')][_0x2336('0x23')]);return _0x4a6d76(_0x20932a['error'][_0x2336('0x23')]);}logger['error'](_0x2336('0x1c'),_0x59d468,_0x20932a[_0x2336('0x21')][_0x2336('0x23')]);return _0x351a48(_0x20932a['error'][_0x2336('0x23')]);}else{logger[_0x2336('0x1b')](_0x2336('0x1c'),_0x59d468,_0x2336('0x1d'));_0x351a48(_0x20932a[_0x2336('0x24')][_0x2336('0x23')]);}})[_0x2336('0x25')](function(_0x4fd5bb){logger[_0x2336('0x21')](_0x2336('0x1c'),_0x59d468,_0x4fd5bb);_0x4a6d76(_0x4fd5bb);});});}function respondWithStatusCode(_0x1a3369,_0x79ea22){_0x79ea22=_0x79ea22||0xcc;return function(_0x379fc8){if(_0x379fc8){return _0x1a3369[_0x2336('0x26')](_0x79ea22);}return _0x1a3369[_0x2336('0x27')](_0x79ea22)[_0x2336('0x28')]();};}function respondWithResult(_0x3c052d,_0x563c8d){_0x563c8d=_0x563c8d||0xc8;return function(_0x587f66){if(_0x587f66){return _0x3c052d['status'](_0x563c8d)[_0x2336('0x29')](_0x587f66);}};}function respondWithFilteredResult(_0x4c8a79,_0x183a88){return function(_0x4d1fbc){if(_0x4d1fbc){var _0x2e50b2=_0x4d1fbc[_0x2336('0x2a')],_0x139ce7=_0x183a88[_0x2336('0x2b')],_0xd14883=_0x183a88[_0x2336('0x2b')]+_0x183a88[_0x2336('0x2c')],_0x35b016;if(_0xd14883>=_0x2e50b2){_0xd14883=_0x2e50b2;_0x35b016=0xc8;}else{_0x35b016=0xce;}_0x4c8a79[_0x2336('0x27')](_0x35b016);return _0x4c8a79[_0x2336('0x2d')](_0x2336('0x2e'),_0x139ce7+'-'+_0xd14883+'/'+_0x2e50b2)[_0x2336('0x29')](_0x4d1fbc);}return null;};}function patchUpdates(_0xd12cbf){return function(_0x4034ed){try{jsonpatch[_0x2336('0x2f')](_0x4034ed,_0xd12cbf,!![]);}catch(_0xac860b){return BPromise['reject'](_0xac860b);}return _0x4034ed[_0x2336('0x30')]();};}function saveUpdates(_0x3be20f,_0x389880){return function(_0x202865){if(_0x202865){return _0x202865[_0x2336('0x31')](_0x3be20f)[_0x2336('0x1a')](function(_0x28f2b3){return _0x28f2b3;});}return null;};}function removeEntity(_0x3a25a0,_0x1e7101){return function(_0x70bb86){if(_0x70bb86){return _0x70bb86['destroy']()[_0x2336('0x1a')](function(){_0x3a25a0[_0x2336('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bbcd7,_0x39d080){return function(_0x42dcea){if(!_0x42dcea){_0x1bbcd7[_0x2336('0x26')](0x194);}return _0x42dcea;};}function handleError(_0x3ffa8f,_0x2ff602){_0x2ff602=_0x2ff602||0x1f4;return function(_0x46236e){logger['error'](_0x46236e[_0x2336('0x32')]);if(_0x46236e[_0x2336('0x33')]){delete _0x46236e['name'];}_0x3ffa8f[_0x2336('0x27')](_0x2ff602)[_0x2336('0x34')](_0x46236e);};}exports[_0x2336('0x35')]=function(_0x51c08b,_0x4163cf){var _0x505437={},_0x32167d={},_0x53b421={'count':0x0,'rows':[]};var _0x41992f=db[_0x2336('0x36')][_0x2336('0x37')];_0x32167d[_0x2336('0x38')]=_['keys'](_0x41992f);var _0xff2ea3={'dateStart':_0x51c08b['query'][_0x2336('0x39')],'dateEnd':_0x51c08b['query'][_0x2336('0x3a')]};delete _0x51c08b[_0x2336('0x3b')][_0x2336('0x39')];delete _0x51c08b[_0x2336('0x3b')][_0x2336('0x3a')];_0x32167d['query']=_[_0x2336('0x3c')](_0x51c08b['query']);_0x32167d[_0x2336('0x3d')]=_[_0x2336('0x3e')](_0x32167d[_0x2336('0x38')],_0x32167d[_0x2336('0x3b')]);_0x505437[_0x2336('0x3f')]=_[_0x2336('0x3e')](_0x32167d['model'],qs[_0x2336('0x40')](_0x51c08b[_0x2336('0x3b')]['fields']));_0x505437[_0x2336('0x3f')]=_0x505437[_0x2336('0x3f')]['length']?_0x505437[_0x2336('0x3f')]:_0x32167d[_0x2336('0x38')];if(!_0x51c08b[_0x2336('0x3b')][_0x2336('0x41')](_0x2336('0x42'))){_0x505437[_0x2336('0x2c')]=qs[_0x2336('0x2c')](_0x51c08b[_0x2336('0x3b')]['limit']);_0x505437[_0x2336('0x2b')]=qs[_0x2336('0x2b')](_0x51c08b[_0x2336('0x3b')][_0x2336('0x2b')]);}_0x505437[_0x2336('0x43')]=qs[_0x2336('0x44')](_0x51c08b[_0x2336('0x3b')][_0x2336('0x44')]);_0x505437['where']=qs[_0x2336('0x3d')](_[_0x2336('0x45')](_0x51c08b[_0x2336('0x3b')],_0x32167d['filters']));if(_0xff2ea3[_0x2336('0x39')]){if(_0xff2ea3[_0x2336('0x3a')]){_0xff2ea3[_0x2336('0x3a')]=moment(_0xff2ea3['dateEnd'])['add'](0x1,'day');}else{_0xff2ea3['dateEnd']=moment(_0xff2ea3[_0x2336('0x39')])[_0x2336('0x46')](0x1,_0x2336('0x47'));}_[_0x2336('0x48')](_0x505437[_0x2336('0x49')],{'createdAt':{'$gte':_0xff2ea3[_0x2336('0x39')],'$lte':_0xff2ea3[_0x2336('0x3a')]}});}if(_0x51c08b['query']['filter']){_0x505437[_0x2336('0x49')]=_[_0x2336('0x48')](_0x505437[_0x2336('0x49')],{'$or':_[_0x2336('0x4a')](_0x505437[_0x2336('0x3f')],function(_0x5b835b){var _0x1cb3c3={};_0x1cb3c3[_0x5b835b]={'$like':'%'+_0x51c08b[_0x2336('0x3b')][_0x2336('0x4b')]+'%'};return _0x1cb3c3;})});}_0x505437=_[_0x2336('0x48')]({},_0x505437,_0x51c08b[_0x2336('0x4c')]);var _0x556177={'where':_0x505437[_0x2336('0x49')]};return db[_0x2336('0x36')][_0x2336('0x2a')](_0x556177)[_0x2336('0x1a')](function(_0x3ad25f){_0x53b421['count']=_0x3ad25f;if(_0x51c08b[_0x2336('0x3b')]['includeAll']){_0x505437['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x505437);})[_0x2336('0x1a')](function(_0x2a82c5){_0x53b421[_0x2336('0x4d')]=_0x2a82c5;return _0x53b421;})[_0x2336('0x1a')](respondWithFilteredResult(_0x4163cf,_0x505437))[_0x2336('0x25')](handleError(_0x4163cf,null));};exports['show']=function(_0x450e6f,_0x5d086f){var _0x2996bd={'raw':![],'where':{'id':_0x450e6f[_0x2336('0x4e')]['id']}},_0x2a0880={};_0x2a0880[_0x2336('0x38')]=_['keys'](db[_0x2336('0x36')]['rawAttributes']);_0x2a0880['query']=_['keys'](_0x450e6f['query']);_0x2a0880[_0x2336('0x3d')]=_[_0x2336('0x3e')](_0x2a0880[_0x2336('0x38')],_0x2a0880[_0x2336('0x3b')]);_0x2996bd[_0x2336('0x3f')]=_[_0x2336('0x3e')](_0x2a0880[_0x2336('0x38')],qs[_0x2336('0x40')](_0x450e6f[_0x2336('0x3b')]['fields']));_0x2996bd[_0x2336('0x3f')]=_0x2996bd[_0x2336('0x3f')]['length']?_0x2996bd[_0x2336('0x3f')]:_0x2a0880[_0x2336('0x38')];if(_0x450e6f[_0x2336('0x3b')][_0x2336('0x4f')]){_0x2996bd[_0x2336('0x50')]=[{'all':!![]}];}_0x2996bd=_[_0x2336('0x48')]({},_0x2996bd,_0x450e6f['options']);return db[_0x2336('0x36')][_0x2336('0x51')](_0x2996bd)[_0x2336('0x1a')](handleEntityNotFound(_0x5d086f,null))[_0x2336('0x1a')](respondWithResult(_0x5d086f,null))[_0x2336('0x25')](handleError(_0x5d086f,null));};exports[_0x2336('0x52')]=function(_0x5d7e65,_0x532adf){return db['SugarcrmConfiguration']['create'](_0x5d7e65[_0x2336('0x53')],{})[_0x2336('0x1a')](respondWithResult(_0x532adf,0xc9))['catch'](handleError(_0x532adf,null));};exports[_0x2336('0x31')]=function(_0x167e15,_0x303012){if(_0x167e15['body']['id']){delete _0x167e15['body']['id'];}return db[_0x2336('0x36')][_0x2336('0x51')]({'where':{'id':_0x167e15[_0x2336('0x4e')]['id']}})[_0x2336('0x1a')](handleEntityNotFound(_0x303012,null))[_0x2336('0x1a')](saveUpdates(_0x167e15[_0x2336('0x53')],null))[_0x2336('0x1a')](respondWithResult(_0x303012,null))[_0x2336('0x25')](handleError(_0x303012,null));};exports[_0x2336('0x54')]=function(_0xff4bd5,_0x2c15da){return db['SugarcrmConfiguration'][_0x2336('0x51')]({'where':{'id':_0xff4bd5[_0x2336('0x4e')]['id']}})[_0x2336('0x1a')](handleEntityNotFound(_0x2c15da,null))[_0x2336('0x1a')](removeEntity(_0x2c15da,null))[_0x2336('0x25')](handleError(_0x2c15da,null));};exports['getFields']=function(_0x275241,_0x363971,_0x271681){var _0xe5041d={};var _0x1181fb={};var _0x2f25ed;var _0x37c3d5;return db[_0x2336('0x36')][_0x2336('0x55')]({'where':{'id':_0x275241['params']['id']}})[_0x2336('0x1a')](handleEntityNotFound(_0x363971,null))[_0x2336('0x1a')](function(_0x3ca52f){if(_0x3ca52f){_0x2f25ed=_0x3ca52f;_0x1181fb[_0x2336('0x38')]=_[_0x2336('0x3c')](db[_0x2336('0x56')]['rawAttributes']);_0x1181fb[_0x2336('0x3b')]=_['keys'](_0x275241[_0x2336('0x3b')]);_0x1181fb['filters']=_[_0x2336('0x3e')](_0x1181fb[_0x2336('0x38')],_0x1181fb[_0x2336('0x3b')]);_0xe5041d['attributes']=_['intersection'](_0x1181fb[_0x2336('0x38')],qs[_0x2336('0x40')](_0x275241[_0x2336('0x3b')][_0x2336('0x40')]));_0xe5041d[_0x2336('0x3f')]=_0xe5041d['attributes'][_0x2336('0x57')]?_0xe5041d[_0x2336('0x3f')]:_0x1181fb[_0x2336('0x38')];_0xe5041d['order']=qs[_0x2336('0x44')](_0x275241['query'][_0x2336('0x44')]);_0xe5041d['where']=qs['filters'](_[_0x2336('0x45')](_0x275241['query'],_0x1181fb[_0x2336('0x3d')]));if(_0x275241[_0x2336('0x3b')][_0x2336('0x4b')]){_0xe5041d[_0x2336('0x49')]=_['merge'](_0xe5041d[_0x2336('0x49')],{'$or':_['map'](_0xe5041d[_0x2336('0x3f')],function(_0x3d07d8){var _0x853d37={};_0x853d37[_0x3d07d8]={'$like':'%'+_0x275241[_0x2336('0x3b')][_0x2336('0x4b')]+'%'};return _0x853d37;})});}_0xe5041d=_['merge']({},_0xe5041d,_0x275241['options']);return _0x2f25ed['getFields'](_0xe5041d);}})[_0x2336('0x1a')](function(_0x12fab4){if(_0x12fab4){_0x37c3d5=_0x12fab4[_0x2336('0x57')];if(!_0x275241[_0x2336('0x3b')][_0x2336('0x41')](_0x2336('0x42'))){_0xe5041d[_0x2336('0x2c')]=qs['limit'](_0x275241[_0x2336('0x3b')][_0x2336('0x2c')]);_0xe5041d[_0x2336('0x2b')]=qs[_0x2336('0x2b')](_0x275241[_0x2336('0x3b')]['offset']);}return _0x2f25ed[_0x2336('0x58')](_0xe5041d);}})[_0x2336('0x1a')](function(_0x28cbbe){if(_0x28cbbe){return _0x28cbbe?{'count':_0x37c3d5,'rows':_0x28cbbe}:null;}})[_0x2336('0x1a')](respondWithResult(_0x363971,null))[_0x2336('0x25')](handleError(_0x363971,null));};exports[_0x2336('0x59')]=function(_0x224a35,_0x5e68aa,_0x1ecb97){var _0x886f40={};var _0x1a798d={};var _0x526cb4;var _0x340f8c;return db['SugarcrmConfiguration'][_0x2336('0x55')]({'where':{'id':_0x224a35['params']['id']}})[_0x2336('0x1a')](handleEntityNotFound(_0x5e68aa,null))[_0x2336('0x1a')](function(_0x3ec5b2){if(_0x3ec5b2){_0x526cb4=_0x3ec5b2;_0x1a798d[_0x2336('0x38')]=_[_0x2336('0x3c')](db[_0x2336('0x56')]['rawAttributes']);_0x1a798d[_0x2336('0x3b')]=_[_0x2336('0x3c')](_0x224a35[_0x2336('0x3b')]);_0x1a798d[_0x2336('0x3d')]=_[_0x2336('0x3e')](_0x1a798d[_0x2336('0x38')],_0x1a798d[_0x2336('0x3b')]);_0x886f40[_0x2336('0x3f')]=_[_0x2336('0x3e')](_0x1a798d[_0x2336('0x38')],qs[_0x2336('0x40')](_0x224a35['query'][_0x2336('0x40')]));_0x886f40[_0x2336('0x3f')]=_0x886f40[_0x2336('0x3f')][_0x2336('0x57')]?_0x886f40[_0x2336('0x3f')]:_0x1a798d[_0x2336('0x38')];_0x886f40[_0x2336('0x43')]=qs[_0x2336('0x44')](_0x224a35['query'][_0x2336('0x44')]);_0x886f40[_0x2336('0x49')]=qs[_0x2336('0x3d')](_[_0x2336('0x45')](_0x224a35[_0x2336('0x3b')],_0x1a798d[_0x2336('0x3d')]));if(_0x224a35['query']['filter']){_0x886f40['where']=_['merge'](_0x886f40[_0x2336('0x49')],{'$or':_[_0x2336('0x4a')](_0x886f40[_0x2336('0x3f')],function(_0x54ae3e){var _0x53ad80={};_0x53ad80[_0x54ae3e]={'$like':'%'+_0x224a35[_0x2336('0x3b')]['filter']+'%'};return _0x53ad80;})});}_0x886f40=_[_0x2336('0x48')]({},_0x886f40,_0x224a35[_0x2336('0x4c')]);return _0x526cb4[_0x2336('0x59')](_0x886f40);}})['then'](function(_0x5e9bf6){if(_0x5e9bf6){_0x340f8c=_0x5e9bf6[_0x2336('0x57')];if(!_0x224a35[_0x2336('0x3b')]['hasOwnProperty'](_0x2336('0x42'))){_0x886f40[_0x2336('0x2c')]=qs[_0x2336('0x2c')](_0x224a35[_0x2336('0x3b')][_0x2336('0x2c')]);_0x886f40['offset']=qs[_0x2336('0x2b')](_0x224a35['query'][_0x2336('0x2b')]);}return _0x526cb4[_0x2336('0x59')](_0x886f40);}})['then'](function(_0x2f4f05){if(_0x2f4f05){return _0x2f4f05?{'count':_0x340f8c,'rows':_0x2f4f05}:null;}})['then'](respondWithResult(_0x5e68aa,null))[_0x2336('0x25')](handleError(_0x5e68aa,null));};exports[_0x2336('0x5a')]=function(_0x473491,_0x7f5aa5,_0x51fdfc){var _0x28484c={};var _0x186d32={};var _0x231eb2;var _0x18e010;return db['SugarcrmConfiguration'][_0x2336('0x55')]({'where':{'id':_0x473491['params']['id']}})[_0x2336('0x1a')](handleEntityNotFound(_0x7f5aa5,null))['then'](function(_0x341ab0){if(_0x341ab0){_0x231eb2=_0x341ab0;_0x186d32[_0x2336('0x38')]=_['keys'](db[_0x2336('0x56')][_0x2336('0x37')]);_0x186d32[_0x2336('0x3b')]=_['keys'](_0x473491[_0x2336('0x3b')]);_0x186d32[_0x2336('0x3d')]=_[_0x2336('0x3e')](_0x186d32[_0x2336('0x38')],_0x186d32[_0x2336('0x3b')]);_0x28484c[_0x2336('0x3f')]=_['intersection'](_0x186d32[_0x2336('0x38')],qs['fields'](_0x473491['query'][_0x2336('0x40')]));_0x28484c[_0x2336('0x3f')]=_0x28484c['attributes']['length']?_0x28484c['attributes']:_0x186d32[_0x2336('0x38')];_0x28484c[_0x2336('0x43')]=qs[_0x2336('0x44')](_0x473491[_0x2336('0x3b')]['sort']);_0x28484c['where']=qs['filters'](_[_0x2336('0x45')](_0x473491['query'],_0x186d32[_0x2336('0x3d')]));if(_0x473491[_0x2336('0x3b')][_0x2336('0x4b')]){_0x28484c[_0x2336('0x49')]=_[_0x2336('0x48')](_0x28484c[_0x2336('0x49')],{'$or':_[_0x2336('0x4a')](_0x28484c[_0x2336('0x3f')],function(_0x2a1e79){var _0x3d2c66={};_0x3d2c66[_0x2a1e79]={'$like':'%'+_0x473491[_0x2336('0x3b')]['filter']+'%'};return _0x3d2c66;})});}_0x28484c=_[_0x2336('0x48')]({},_0x28484c,_0x473491['options']);return _0x231eb2[_0x2336('0x5a')](_0x28484c);}})['then'](function(_0x35549c){if(_0x35549c){_0x18e010=_0x35549c['length'];if(!_0x473491[_0x2336('0x3b')]['hasOwnProperty'](_0x2336('0x42'))){_0x28484c[_0x2336('0x2c')]=qs[_0x2336('0x2c')](_0x473491[_0x2336('0x3b')][_0x2336('0x2c')]);_0x28484c[_0x2336('0x2b')]=qs[_0x2336('0x2b')](_0x473491[_0x2336('0x3b')]['offset']);}return _0x231eb2[_0x2336('0x5a')](_0x28484c);}})[_0x2336('0x1a')](function(_0xc3108a){if(_0xc3108a){return _0xc3108a?{'count':_0x18e010,'rows':_0xc3108a}:null;}})[_0x2336('0x1a')](respondWithResult(_0x7f5aa5,null))[_0x2336('0x25')](handleError(_0x7f5aa5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2274d1b..21c4c96 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 _0xcf37=['bluebird','./intSugarcrmConfiguration.attributes','exports','define','util','../../config/logger','api','moment'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xcf37,0xdc));var _0x7cf3=function(_0xd2fb63,_0x45d9a0){_0xd2fb63=_0xd2fb63-0x0;var _0x32fc33=_0xcf37[_0xd2fb63];return _0x32fc33;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var logger=require(_0x7cf3('0x1'))(_0x7cf3('0x2'));var moment=require(_0x7cf3('0x3'));var BPromise=require(_0x7cf3('0x4'));var rp=require('request-promise');var attributes=require(_0x7cf3('0x5'));module[_0x7cf3('0x6')]=function(_0x3a015f,_0x265afb){return _0x3a015f[_0x7cf3('0x7')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34f0=['lodash','util','api','bluebird','request-promise','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x34f0,0x13b));var _0x034f=function(_0x5c0016,_0x3c16a6){_0x5c0016=_0x5c0016-0x0;var _0x584f1f=_0x34f0[_0x5c0016];return _0x584f1f;};'use strict';var _=require(_0x034f('0x0'));var util=require(_0x034f('0x1'));var logger=require('../../config/logger')(_0x034f('0x2'));var moment=require('moment');var BPromise=require(_0x034f('0x3'));var rp=require(_0x034f('0x4'));var attributes=require(_0x034f('0x5'));module[_0x034f('0x6')]=function(_0x2bd6d1,_0x5011cd){return _0x2bd6d1[_0x034f('0x7')](_0x034f('0x8'),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 9899475..14382c7 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 _0x6dcd=['rpc','../../config/environment','jayson/promise','client','http','then','info','debug','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3acdcb,_0x3d59ae){var _0x357b56=function(_0x502dd6){while(--_0x502dd6){_0x3acdcb['push'](_0x3acdcb['shift']());}};_0x357b56(++_0x3d59ae);}(_0x6dcd,0xc0));var _0xd6dc=function(_0x105954,_0x169ddb){_0x105954=_0x105954-0x0;var _0xcd4216=_0x6dcd[_0x105954];return _0xcd4216;};'use strict';var _=require('lodash');var util=require(_0xd6dc('0x0'));var moment=require('moment');var BPromise=require(_0xd6dc('0x1'));var rs=require(_0xd6dc('0x2'));var fs=require('fs');var Redis=require(_0xd6dc('0x3'));var db=require(_0xd6dc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6dc('0x5'))(_0xd6dc('0x6'));var config=require(_0xd6dc('0x7'));var jayson=require(_0xd6dc('0x8'));var client=jayson[_0xd6dc('0x9')][_0xd6dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10bd50,_0x635c18,_0x1a0f46){return new BPromise(function(_0x2d956a,_0x4c52b1){return client['request'](_0x10bd50,_0x1a0f46)[_0xd6dc('0xb')](function(_0x482683){logger[_0xd6dc('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x635c18,'request\x20sent');logger[_0xd6dc('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x635c18,'request\x20sent',JSON[_0xd6dc('0xe')](_0x482683));if(_0x482683['error']){if(_0x482683[_0xd6dc('0xf')][_0xd6dc('0x10')]===0x1f4){logger[_0xd6dc('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x635c18,_0x482683[_0xd6dc('0xf')]['message']);return _0x4c52b1(_0x482683[_0xd6dc('0xf')][_0xd6dc('0x11')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x635c18,_0x482683[_0xd6dc('0xf')][_0xd6dc('0x11')]);return _0x2d956a(_0x482683[_0xd6dc('0xf')][_0xd6dc('0x11')]);}else{logger[_0xd6dc('0xc')](_0xd6dc('0x12'),_0x635c18,_0xd6dc('0x13'));_0x2d956a(_0x482683[_0xd6dc('0x14')][_0xd6dc('0x11')]);}})[_0xd6dc('0x15')](function(_0x4f4960){logger[_0xd6dc('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x635c18,_0x4f4960);_0x4c52b1(_0x4f4960);});});} \ No newline at end of file +var _0xc2b5=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0xc2b5,0x14b));var _0x5c2b=function(_0x46f609,_0x54b538){_0x46f609=_0x46f609-0x0;var _0x42c672=_0xc2b5[_0x46f609];return _0x42c672;};'use strict';var _=require(_0x5c2b('0x0'));var util=require(_0x5c2b('0x1'));var moment=require(_0x5c2b('0x2'));var BPromise=require(_0x5c2b('0x3'));var rs=require(_0x5c2b('0x4'));var fs=require('fs');var Redis=require(_0x5c2b('0x5'));var db=require(_0x5c2b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c2b('0x7'))(_0x5c2b('0x8'));var config=require('../../config/environment');var jayson=require(_0x5c2b('0x9'));var client=jayson[_0x5c2b('0xa')][_0x5c2b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d30d2,_0x29e856,_0x44a13b){return new BPromise(function(_0x2c4314,_0x104ac5){return client[_0x5c2b('0xc')](_0x5d30d2,_0x44a13b)['then'](function(_0x2b8c35){logger['info'](_0x5c2b('0xd'),_0x29e856,_0x5c2b('0xe'));logger[_0x5c2b('0xf')](_0x5c2b('0x10'),_0x29e856,_0x5c2b('0xe'),JSON[_0x5c2b('0x11')](_0x2b8c35));if(_0x2b8c35[_0x5c2b('0x12')]){if(_0x2b8c35[_0x5c2b('0x12')]['code']===0x1f4){logger[_0x5c2b('0x12')](_0x5c2b('0xd'),_0x29e856,_0x2b8c35[_0x5c2b('0x12')]['message']);return _0x104ac5(_0x2b8c35[_0x5c2b('0x12')]['message']);}logger[_0x5c2b('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x29e856,_0x2b8c35[_0x5c2b('0x12')][_0x5c2b('0x13')]);return _0x2c4314(_0x2b8c35[_0x5c2b('0x12')]['message']);}else{logger[_0x5c2b('0x14')](_0x5c2b('0xd'),_0x29e856,_0x5c2b('0xe'));_0x2c4314(_0x2b8c35[_0x5c2b('0x15')][_0x5c2b('0x13')]);}})[_0x5c2b('0x16')](function(_0x2fed46){logger[_0x5c2b('0x12')](_0x5c2b('0xd'),_0x29e856,_0x2fed46);_0x104ac5(_0x2fed46);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c062955..ce35c80 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 _0x56cc=['connect-timeout','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4d94a4,_0x3e6dba){var _0x5f31e3=function(_0x5bd0d1){while(--_0x5bd0d1){_0x4d94a4['push'](_0x4d94a4['shift']());}};_0x5f31e3(++_0x3e6dba);}(_0x56cc,0x184));var _0xc56c=function(_0x5b97b6,_0xfbf2aa){_0x5b97b6=_0x5b97b6-0x0;var _0x409c9d=_0x56cc[_0x5b97b6];return _0x409c9d;};'use strict';var multer=require(_0xc56c('0x0'));var util=require(_0xc56c('0x1'));var path=require(_0xc56c('0x2'));var timeout=require(_0xc56c('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc56c('0x4'));router[_0xc56c('0x5')]('/',auth['isAuthenticated'](),controller[_0xc56c('0x6')]);router['get'](_0xc56c('0x7'),auth[_0xc56c('0x8')](),controller[_0xc56c('0x9')]);router[_0xc56c('0xa')]('/',auth[_0xc56c('0x8')](),controller[_0xc56c('0xb')]);router[_0xc56c('0xc')](_0xc56c('0x7'),auth[_0xc56c('0x8')](),controller[_0xc56c('0xd')]);router[_0xc56c('0xe')](_0xc56c('0x7'),auth[_0xc56c('0x8')](),controller[_0xc56c('0xf')]);module[_0xc56c('0x10')]=router; \ No newline at end of file +var _0x347d=['../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x347d,0x83));var _0xd347=function(_0x112052,_0x58385a){_0x112052=_0x112052-0x0;var _0x286d5=_0x347d[_0x112052];return _0x286d5;};'use strict';var multer=require(_0xd347('0x0'));var util=require('util');var path=require(_0xd347('0x1'));var timeout=require(_0xd347('0x2'));var express=require(_0xd347('0x3'));var router=express[_0xd347('0x4')]();var auth=require(_0xd347('0x5'));var interaction=require(_0xd347('0x6'));var config=require('../../config/environment');var controller=require(_0xd347('0x7'));router[_0xd347('0x8')]('/',auth[_0xd347('0x9')](),controller[_0xd347('0xa')]);router[_0xd347('0x8')](_0xd347('0xb'),auth[_0xd347('0x9')](),controller['show']);router[_0xd347('0xc')]('/',auth[_0xd347('0x9')](),controller[_0xd347('0xd')]);router['put']('/:id',auth[_0xd347('0x9')](),controller[_0xd347('0xe')]);router['delete'](_0xd347('0xb'),auth[_0xd347('0x9')](),controller[_0xd347('0xf')]);module[_0xd347('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index f1539e1..072dd4e 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(_0x1a425c,_0x4044e5){var _0x2e9688=function(_0x5f2f09){while(--_0x5f2f09){_0x1a425c['push'](_0x1a425c['shift']());}};_0x2e9688(++_0x4044e5);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x4d7906,_0x232f2e){_0x4d7906=_0x4d7906-0x0;var _0x245ef2=_0x6f7a[_0x4d7906];return _0x245ef2;};'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 _0x13f6=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports'];(function(_0x3a0c24,_0x5e57c7){var _0x182900=function(_0x33d266){while(--_0x33d266){_0x3a0c24['push'](_0x3a0c24['shift']());}};_0x182900(++_0x5e57c7);}(_0x13f6,0x124));var _0x613f=function(_0x304a70,_0x31fbed){_0x304a70=_0x304a70-0x0;var _0x2c8044=_0x13f6[_0x304a70];return _0x2c8044;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x613f('0x2'),_0x613f('0x3'),_0x613f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x613f('0x5')]},'key':{'type':Sequelize[_0x613f('0x5')]},'keyType':{'type':Sequelize[_0x613f('0x6')]('string',_0x613f('0x2'),_0x613f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x613f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c9d3a37..a9b78be 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 _0xa125=['../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','reject','save','update','then','end','error','name','send','index','SugarcrmField','rawAttributes','model','keys','dateStart','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','day','add','merge','filter','map','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa125,0x1a4));var _0x5a12=function(_0x3eb645,_0xcb40d){_0x3eb645=_0x3eb645-0x0;var _0x1e8d77=_0xa125[_0x3eb645];return _0x1e8d77;};'use strict';var pdf=require(_0x5a12('0x0'));var emlformat=require(_0x5a12('0x1'));var rimraf=require(_0x5a12('0x2'));var zipdir=require(_0x5a12('0x3'));var jsonpatch=require(_0x5a12('0x4'));var rp=require(_0x5a12('0x5'));var moment=require('moment');var BPromise=require(_0x5a12('0x6'));var Mustache=require(_0x5a12('0x7'));var util=require(_0x5a12('0x8'));var path=require('path');var sox=require(_0x5a12('0x9'));var csv=require(_0x5a12('0xa'));var ejs=require(_0x5a12('0xb'));var fs=require('fs');var _=require(_0x5a12('0xc'));var squel=require(_0x5a12('0xd'));var crypto=require('crypto');var jsforce=require(_0x5a12('0xe'));var deskjs=require(_0x5a12('0xf'));var toCsv=require(_0x5a12('0xa'));var querystring=require(_0x5a12('0x10'));var Papa=require(_0x5a12('0x11'));var Redis=require('ioredis');var qs=require(_0x5a12('0x12'));var logger=require(_0x5a12('0x13'))('api');var utils=require(_0x5a12('0x14'));var config=require(_0x5a12('0x15'));var db=require(_0x5a12('0x16'))['db'];function respondWithStatusCode(_0x40504f,_0x311153){_0x311153=_0x311153||0xcc;return function(_0x361975){if(_0x361975){return _0x40504f[_0x5a12('0x17')](_0x311153);}return _0x40504f[_0x5a12('0x18')](_0x311153)['end']();};}function respondWithResult(_0x31a836,_0x435e0c){_0x435e0c=_0x435e0c||0xc8;return function(_0x15b32b){if(_0x15b32b){return _0x31a836[_0x5a12('0x18')](_0x435e0c)[_0x5a12('0x19')](_0x15b32b);}};}function respondWithFilteredResult(_0x51e9be,_0xb2fa9b){return function(_0x4c8161){if(_0x4c8161){var _0x105fc9=_0x4c8161['count'],_0x5b861f=_0xb2fa9b[_0x5a12('0x1a')],_0x749bda=_0xb2fa9b[_0x5a12('0x1a')]+_0xb2fa9b[_0x5a12('0x1b')],_0x409505;if(_0x749bda>=_0x105fc9){_0x749bda=_0x105fc9;_0x409505=0xc8;}else{_0x409505=0xce;}_0x51e9be[_0x5a12('0x18')](_0x409505);return _0x51e9be[_0x5a12('0x1c')]('Content-Range',_0x5b861f+'-'+_0x749bda+'/'+_0x105fc9)[_0x5a12('0x19')](_0x4c8161);}return null;};}function patchUpdates(_0x2ed871){return function(_0x1b86d7){try{jsonpatch['apply'](_0x1b86d7,_0x2ed871,!![]);}catch(_0x2f9761){return BPromise[_0x5a12('0x1d')](_0x2f9761);}return _0x1b86d7[_0x5a12('0x1e')]();};}function saveUpdates(_0x396cf6,_0x5ec5a2){return function(_0x588556){if(_0x588556){return _0x588556[_0x5a12('0x1f')](_0x396cf6)[_0x5a12('0x20')](function(_0x441e96){return _0x441e96;});}return null;};}function removeEntity(_0x249870,_0x1f45fe){return function(_0x1c6917){if(_0x1c6917){return _0x1c6917['destroy']()[_0x5a12('0x20')](function(){_0x249870[_0x5a12('0x18')](0xcc)[_0x5a12('0x21')]();});}};}function handleEntityNotFound(_0x1687b2,_0x3adab1){return function(_0x172dc2){if(!_0x172dc2){_0x1687b2[_0x5a12('0x17')](0x194);}return _0x172dc2;};}function handleError(_0x3ea9fc,_0x2acd96){_0x2acd96=_0x2acd96||0x1f4;return function(_0x55e9a0){logger[_0x5a12('0x22')](_0x55e9a0['stack']);if(_0x55e9a0[_0x5a12('0x23')]){delete _0x55e9a0[_0x5a12('0x23')];}_0x3ea9fc[_0x5a12('0x18')](_0x2acd96)[_0x5a12('0x24')](_0x55e9a0);};}exports[_0x5a12('0x25')]=function(_0x2bffb0,_0x290f67){var _0x727e4d={},_0x58866c={},_0x9c1218={'count':0x0,'rows':[]};var _0x2dfb6f=db[_0x5a12('0x26')][_0x5a12('0x27')];_0x58866c[_0x5a12('0x28')]=_[_0x5a12('0x29')](_0x2dfb6f);var _0x495066={'dateStart':_0x2bffb0['query'][_0x5a12('0x2a')],'dateEnd':_0x2bffb0[_0x5a12('0x2b')]['dateEnd']};delete _0x2bffb0[_0x5a12('0x2b')][_0x5a12('0x2a')];delete _0x2bffb0[_0x5a12('0x2b')]['dateEnd'];_0x58866c[_0x5a12('0x2b')]=_[_0x5a12('0x29')](_0x2bffb0[_0x5a12('0x2b')]);_0x58866c[_0x5a12('0x2c')]=_[_0x5a12('0x2d')](_0x58866c[_0x5a12('0x28')],_0x58866c[_0x5a12('0x2b')]);_0x727e4d[_0x5a12('0x2e')]=_[_0x5a12('0x2d')](_0x58866c[_0x5a12('0x28')],qs[_0x5a12('0x2f')](_0x2bffb0[_0x5a12('0x2b')][_0x5a12('0x2f')]));_0x727e4d[_0x5a12('0x2e')]=_0x727e4d[_0x5a12('0x2e')][_0x5a12('0x30')]?_0x727e4d['attributes']:_0x58866c[_0x5a12('0x28')];if(!_0x2bffb0[_0x5a12('0x2b')][_0x5a12('0x31')](_0x5a12('0x32'))){_0x727e4d[_0x5a12('0x1b')]=qs[_0x5a12('0x1b')](_0x2bffb0[_0x5a12('0x2b')][_0x5a12('0x1b')]);_0x727e4d[_0x5a12('0x1a')]=qs['offset'](_0x2bffb0['query'][_0x5a12('0x1a')]);}_0x727e4d[_0x5a12('0x33')]=qs[_0x5a12('0x34')](_0x2bffb0[_0x5a12('0x2b')][_0x5a12('0x34')]);_0x727e4d[_0x5a12('0x35')]=qs[_0x5a12('0x2c')](_[_0x5a12('0x36')](_0x2bffb0[_0x5a12('0x2b')],_0x58866c[_0x5a12('0x2c')]));if(_0x495066[_0x5a12('0x2a')]){if(_0x495066['dateEnd']){_0x495066[_0x5a12('0x37')]=moment(_0x495066[_0x5a12('0x37')])['add'](0x1,_0x5a12('0x38'));}else{_0x495066[_0x5a12('0x37')]=moment(_0x495066[_0x5a12('0x2a')])[_0x5a12('0x39')](0x1,_0x5a12('0x38'));}_[_0x5a12('0x3a')](_0x727e4d[_0x5a12('0x35')],{'createdAt':{'$gte':_0x495066['dateStart'],'$lte':_0x495066['dateEnd']}});}if(_0x2bffb0[_0x5a12('0x2b')][_0x5a12('0x3b')]){_0x727e4d[_0x5a12('0x35')]=_[_0x5a12('0x3a')](_0x727e4d['where'],{'$or':_[_0x5a12('0x3c')](_0x727e4d[_0x5a12('0x2e')],function(_0x2427a3){var _0x3c129f={};_0x3c129f[_0x2427a3]={'$like':'%'+_0x2bffb0[_0x5a12('0x2b')][_0x5a12('0x3b')]+'%'};return _0x3c129f;})});}_0x727e4d=_['merge']({},_0x727e4d,_0x2bffb0[_0x5a12('0x3d')]);var _0x4f7cee={'where':_0x727e4d['where']};return db['SugarcrmField'][_0x5a12('0x3e')](_0x4f7cee)[_0x5a12('0x20')](function(_0x358d52){_0x9c1218['count']=_0x358d52;if(_0x2bffb0[_0x5a12('0x2b')][_0x5a12('0x3f')]){_0x727e4d['include']=[{'all':!![]}];}return db[_0x5a12('0x26')][_0x5a12('0x40')](_0x727e4d);})[_0x5a12('0x20')](function(_0x10a895){_0x9c1218[_0x5a12('0x41')]=_0x10a895;return _0x9c1218;})[_0x5a12('0x20')](respondWithFilteredResult(_0x290f67,_0x727e4d))[_0x5a12('0x42')](handleError(_0x290f67,null));};exports[_0x5a12('0x43')]=function(_0x565e54,_0x4b0874){var _0x3864df={'raw':!![],'where':{'id':_0x565e54[_0x5a12('0x44')]['id']}},_0x1fd560={};_0x1fd560[_0x5a12('0x28')]=_[_0x5a12('0x29')](db[_0x5a12('0x26')]['rawAttributes']);_0x1fd560[_0x5a12('0x2b')]=_[_0x5a12('0x29')](_0x565e54[_0x5a12('0x2b')]);_0x1fd560[_0x5a12('0x2c')]=_[_0x5a12('0x2d')](_0x1fd560[_0x5a12('0x28')],_0x1fd560[_0x5a12('0x2b')]);_0x3864df[_0x5a12('0x2e')]=_[_0x5a12('0x2d')](_0x1fd560[_0x5a12('0x28')],qs[_0x5a12('0x2f')](_0x565e54['query'][_0x5a12('0x2f')]));_0x3864df[_0x5a12('0x2e')]=_0x3864df[_0x5a12('0x2e')]['length']?_0x3864df['attributes']:_0x1fd560[_0x5a12('0x28')];if(_0x565e54[_0x5a12('0x2b')][_0x5a12('0x3f')]){_0x3864df[_0x5a12('0x45')]=[{'all':!![]}];}_0x3864df=_[_0x5a12('0x3a')]({},_0x3864df,_0x565e54[_0x5a12('0x3d')]);return db[_0x5a12('0x26')][_0x5a12('0x46')](_0x3864df)[_0x5a12('0x20')](handleEntityNotFound(_0x4b0874,null))[_0x5a12('0x20')](respondWithResult(_0x4b0874,null))[_0x5a12('0x42')](handleError(_0x4b0874,null));};exports[_0x5a12('0x47')]=function(_0x1a1206,_0x32fab6){return db[_0x5a12('0x26')][_0x5a12('0x47')](_0x1a1206[_0x5a12('0x48')],{})[_0x5a12('0x20')](respondWithResult(_0x32fab6,0xc9))['catch'](handleError(_0x32fab6,null));};exports[_0x5a12('0x1f')]=function(_0x548db8,_0x22d8af){if(_0x548db8[_0x5a12('0x48')]['id']){delete _0x548db8[_0x5a12('0x48')]['id'];}return db['SugarcrmField'][_0x5a12('0x46')]({'where':{'id':_0x548db8['params']['id']}})[_0x5a12('0x20')](handleEntityNotFound(_0x22d8af,null))[_0x5a12('0x20')](saveUpdates(_0x548db8[_0x5a12('0x48')],null))[_0x5a12('0x20')](respondWithResult(_0x22d8af,null))['catch'](handleError(_0x22d8af,null));};exports['destroy']=function(_0x107d9e,_0x3ce014){return db[_0x5a12('0x26')][_0x5a12('0x46')]({'where':{'id':_0x107d9e[_0x5a12('0x44')]['id']}})[_0x5a12('0x20')](handleEntityNotFound(_0x3ce014,null))[_0x5a12('0x20')](removeEntity(_0x3ce014,null))['catch'](handleError(_0x3ce014,null));}; \ No newline at end of file +var _0x70d9=['moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','end','error','stack','name','send','SugarcrmField','rawAttributes','dateStart','query','dateEnd','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','add','day','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1ea463,_0x275058){var _0x5c256a=function(_0x211bf1){while(--_0x211bf1){_0x1ea463['push'](_0x1ea463['shift']());}};_0x5c256a(++_0x275058);}(_0x70d9,0x118));var _0x970d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x70d9[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x970d('0x0'));var rimraf=require(_0x970d('0x1'));var zipdir=require(_0x970d('0x2'));var jsonpatch=require(_0x970d('0x3'));var rp=require('request-promise');var moment=require(_0x970d('0x4'));var BPromise=require(_0x970d('0x5'));var Mustache=require(_0x970d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x970d('0x7'));var csv=require(_0x970d('0x8'));var ejs=require(_0x970d('0x9'));var fs=require('fs');var _=require(_0x970d('0xa'));var squel=require(_0x970d('0xb'));var crypto=require(_0x970d('0xc'));var jsforce=require(_0x970d('0xd'));var deskjs=require(_0x970d('0xe'));var toCsv=require(_0x970d('0x8'));var querystring=require(_0x970d('0xf'));var Papa=require(_0x970d('0x10'));var Redis=require(_0x970d('0x11'));var qs=require(_0x970d('0x12'));var logger=require(_0x970d('0x13'))(_0x970d('0x14'));var utils=require(_0x970d('0x15'));var config=require(_0x970d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db851,_0x4bffb1){_0x4bffb1=_0x4bffb1||0xcc;return function(_0x5e9fd7){if(_0x5e9fd7){return _0x4db851[_0x970d('0x17')](_0x4bffb1);}return _0x4db851[_0x970d('0x18')](_0x4bffb1)['end']();};}function respondWithResult(_0x25f37f,_0x4c6880){_0x4c6880=_0x4c6880||0xc8;return function(_0x4b67d4){if(_0x4b67d4){return _0x25f37f[_0x970d('0x18')](_0x4c6880)[_0x970d('0x19')](_0x4b67d4);}};}function respondWithFilteredResult(_0x443667,_0x1050fd){return function(_0x2008fd){if(_0x2008fd){var _0x1d62f4=_0x2008fd[_0x970d('0x1a')],_0x28cc45=_0x1050fd[_0x970d('0x1b')],_0x4a6456=_0x1050fd[_0x970d('0x1b')]+_0x1050fd[_0x970d('0x1c')],_0x50b2e1;if(_0x4a6456>=_0x1d62f4){_0x4a6456=_0x1d62f4;_0x50b2e1=0xc8;}else{_0x50b2e1=0xce;}_0x443667[_0x970d('0x18')](_0x50b2e1);return _0x443667[_0x970d('0x1d')]('Content-Range',_0x28cc45+'-'+_0x4a6456+'/'+_0x1d62f4)[_0x970d('0x19')](_0x2008fd);}return null;};}function patchUpdates(_0x19f2a0){return function(_0x13efbc){try{jsonpatch[_0x970d('0x1e')](_0x13efbc,_0x19f2a0,!![]);}catch(_0x330fd5){return BPromise[_0x970d('0x1f')](_0x330fd5);}return _0x13efbc['save']();};}function saveUpdates(_0xba91bc,_0x2b1112){return function(_0x121b19){if(_0x121b19){return _0x121b19[_0x970d('0x20')](_0xba91bc)[_0x970d('0x21')](function(_0x2ca0ea){return _0x2ca0ea;});}return null;};}function removeEntity(_0x4bc429,_0x523be0){return function(_0x4c763c){if(_0x4c763c){return _0x4c763c['destroy']()[_0x970d('0x21')](function(){_0x4bc429[_0x970d('0x18')](0xcc)[_0x970d('0x22')]();});}};}function handleEntityNotFound(_0x201ed7,_0x59ee45){return function(_0x26228d){if(!_0x26228d){_0x201ed7[_0x970d('0x17')](0x194);}return _0x26228d;};}function handleError(_0x584dd1,_0x1465bd){_0x1465bd=_0x1465bd||0x1f4;return function(_0x560ed9){logger[_0x970d('0x23')](_0x560ed9[_0x970d('0x24')]);if(_0x560ed9[_0x970d('0x25')]){delete _0x560ed9[_0x970d('0x25')];}_0x584dd1['status'](_0x1465bd)[_0x970d('0x26')](_0x560ed9);};}exports['index']=function(_0x3d3604,_0x7a517){var _0x1868b8={},_0x205376={},_0x2dfb6d={'count':0x0,'rows':[]};var _0x34738c=db[_0x970d('0x27')][_0x970d('0x28')];_0x205376['model']=_['keys'](_0x34738c);var _0x5135a7={'dateStart':_0x3d3604['query'][_0x970d('0x29')],'dateEnd':_0x3d3604[_0x970d('0x2a')][_0x970d('0x2b')]};delete _0x3d3604['query'][_0x970d('0x29')];delete _0x3d3604[_0x970d('0x2a')]['dateEnd'];_0x205376['query']=_[_0x970d('0x2c')](_0x3d3604[_0x970d('0x2a')]);_0x205376[_0x970d('0x2d')]=_[_0x970d('0x2e')](_0x205376[_0x970d('0x2f')],_0x205376['query']);_0x1868b8['attributes']=_[_0x970d('0x2e')](_0x205376[_0x970d('0x2f')],qs[_0x970d('0x30')](_0x3d3604[_0x970d('0x2a')][_0x970d('0x30')]));_0x1868b8[_0x970d('0x31')]=_0x1868b8[_0x970d('0x31')][_0x970d('0x32')]?_0x1868b8['attributes']:_0x205376[_0x970d('0x2f')];if(!_0x3d3604['query'][_0x970d('0x33')](_0x970d('0x34'))){_0x1868b8[_0x970d('0x1c')]=qs['limit'](_0x3d3604[_0x970d('0x2a')]['limit']);_0x1868b8['offset']=qs['offset'](_0x3d3604[_0x970d('0x2a')][_0x970d('0x1b')]);}_0x1868b8['order']=qs[_0x970d('0x35')](_0x3d3604[_0x970d('0x2a')]['sort']);_0x1868b8[_0x970d('0x36')]=qs['filters'](_['pick'](_0x3d3604['query'],_0x205376[_0x970d('0x2d')]));if(_0x5135a7[_0x970d('0x29')]){if(_0x5135a7[_0x970d('0x2b')]){_0x5135a7[_0x970d('0x2b')]=moment(_0x5135a7[_0x970d('0x2b')])[_0x970d('0x37')](0x1,_0x970d('0x38'));}else{_0x5135a7[_0x970d('0x2b')]=moment(_0x5135a7[_0x970d('0x29')])['add'](0x1,_0x970d('0x38'));}_['merge'](_0x1868b8[_0x970d('0x36')],{'createdAt':{'$gte':_0x5135a7[_0x970d('0x29')],'$lte':_0x5135a7['dateEnd']}});}if(_0x3d3604[_0x970d('0x2a')][_0x970d('0x39')]){_0x1868b8[_0x970d('0x36')]=_[_0x970d('0x3a')](_0x1868b8['where'],{'$or':_[_0x970d('0x3b')](_0x1868b8[_0x970d('0x31')],function(_0x41e6da){var _0x59d0af={};_0x59d0af[_0x41e6da]={'$like':'%'+_0x3d3604[_0x970d('0x2a')][_0x970d('0x39')]+'%'};return _0x59d0af;})});}_0x1868b8=_[_0x970d('0x3a')]({},_0x1868b8,_0x3d3604[_0x970d('0x3c')]);var _0xed74cd={'where':_0x1868b8['where']};return db[_0x970d('0x27')][_0x970d('0x1a')](_0xed74cd)[_0x970d('0x21')](function(_0x4efb47){_0x2dfb6d['count']=_0x4efb47;if(_0x3d3604[_0x970d('0x2a')][_0x970d('0x3d')]){_0x1868b8[_0x970d('0x3e')]=[{'all':!![]}];}return db['SugarcrmField'][_0x970d('0x3f')](_0x1868b8);})[_0x970d('0x21')](function(_0x1d1784){_0x2dfb6d[_0x970d('0x40')]=_0x1d1784;return _0x2dfb6d;})['then'](respondWithFilteredResult(_0x7a517,_0x1868b8))[_0x970d('0x41')](handleError(_0x7a517,null));};exports['show']=function(_0xdc73ab,_0x1b3b71){var _0x485144={'raw':!![],'where':{'id':_0xdc73ab[_0x970d('0x42')]['id']}},_0x459139={};_0x459139[_0x970d('0x2f')]=_[_0x970d('0x2c')](db[_0x970d('0x27')][_0x970d('0x28')]);_0x459139[_0x970d('0x2a')]=_[_0x970d('0x2c')](_0xdc73ab['query']);_0x459139['filters']=_[_0x970d('0x2e')](_0x459139[_0x970d('0x2f')],_0x459139[_0x970d('0x2a')]);_0x485144[_0x970d('0x31')]=_[_0x970d('0x2e')](_0x459139[_0x970d('0x2f')],qs['fields'](_0xdc73ab['query'][_0x970d('0x30')]));_0x485144['attributes']=_0x485144['attributes'][_0x970d('0x32')]?_0x485144[_0x970d('0x31')]:_0x459139[_0x970d('0x2f')];if(_0xdc73ab['query'][_0x970d('0x3d')]){_0x485144[_0x970d('0x3e')]=[{'all':!![]}];}_0x485144=_['merge']({},_0x485144,_0xdc73ab[_0x970d('0x3c')]);return db[_0x970d('0x27')][_0x970d('0x43')](_0x485144)[_0x970d('0x21')](handleEntityNotFound(_0x1b3b71,null))[_0x970d('0x21')](respondWithResult(_0x1b3b71,null))[_0x970d('0x41')](handleError(_0x1b3b71,null));};exports['create']=function(_0x3f84b5,_0x56d6b3){return db[_0x970d('0x27')][_0x970d('0x44')](_0x3f84b5['body'],{})[_0x970d('0x21')](respondWithResult(_0x56d6b3,0xc9))['catch'](handleError(_0x56d6b3,null));};exports[_0x970d('0x20')]=function(_0x165116,_0x18c4d2){if(_0x165116[_0x970d('0x45')]['id']){delete _0x165116['body']['id'];}return db[_0x970d('0x27')][_0x970d('0x43')]({'where':{'id':_0x165116[_0x970d('0x42')]['id']}})[_0x970d('0x21')](handleEntityNotFound(_0x18c4d2,null))['then'](saveUpdates(_0x165116['body'],null))[_0x970d('0x21')](respondWithResult(_0x18c4d2,null))['catch'](handleError(_0x18c4d2,null));};exports[_0x970d('0x46')]=function(_0x7bcde6,_0x4fd8bb){return db[_0x970d('0x27')][_0x970d('0x43')]({'where':{'id':_0x7bcde6[_0x970d('0x42')]['id']}})[_0x970d('0x21')](handleEntityNotFound(_0x4fd8bb,null))[_0x970d('0x21')](removeEntity(_0x4fd8bb,null))[_0x970d('0x41')](handleError(_0x4fd8bb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7b680b2..bfb328d 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 _0xd35b=['bluebird','request-promise','./intSugarcrmField.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0xd35b,0x109));var _0xbd35=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xd35b[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xbd35('0x0'));var util=require(_0xbd35('0x1'));var logger=require(_0xbd35('0x2'))(_0xbd35('0x3'));var moment=require(_0xbd35('0x4'));var BPromise=require(_0xbd35('0x5'));var rp=require(_0xbd35('0x6'));var attributes=require(_0xbd35('0x7'));module[_0xbd35('0x8')]=function(_0x4756da,_0xd31dea){return _0x4756da[_0xbd35('0x9')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08fd=['SugarcrmField','int_sugarcrm_fields','lodash','../../config/logger','moment','bluebird','request-promise','define'];(function(_0x3602be,_0x575f79){var _0x58f836=function(_0x5a0177){while(--_0x5a0177){_0x3602be['push'](_0x3602be['shift']());}};_0x58f836(++_0x575f79);}(_0x08fd,0x1f2));var _0xd08f=function(_0x23d1b5,_0xe3ce69){_0x23d1b5=_0x23d1b5-0x0;var _0x116f19=_0x08fd[_0x23d1b5];return _0x116f19;};'use strict';var _=require(_0xd08f('0x0'));var util=require('util');var logger=require(_0xd08f('0x1'))('api');var moment=require(_0xd08f('0x2'));var BPromise=require(_0xd08f('0x3'));var rp=require(_0xd08f('0x4'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x2ab3ed,_0x30a2f4){return _0x2ab3ed[_0xd08f('0x5')](_0xd08f('0x6'),attributes,{'tableName':_0xd08f('0x7'),'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 0cafdef..4e92222 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 _0x28a0=['then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request'];(function(_0x30a726,_0x461622){var _0x351753=function(_0x29ac4b){while(--_0x29ac4b){_0x30a726['push'](_0x30a726['shift']());}};_0x351753(++_0x461622);}(_0x28a0,0x155));var _0x028a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x28a0[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x028a('0x0'));var util=require('util');var moment=require(_0x028a('0x1'));var BPromise=require(_0x028a('0x2'));var rs=require(_0x028a('0x3'));var fs=require('fs');var Redis=require(_0x028a('0x4'));var db=require(_0x028a('0x5'))['db'];var utils=require(_0x028a('0x6'));var logger=require('../../config/logger')(_0x028a('0x7'));var config=require(_0x028a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x028a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa407f8,_0x543b4f,_0x23c8c5){return new BPromise(function(_0x51cdee,_0x2838bf){return client[_0x028a('0xa')](_0xa407f8,_0x23c8c5)[_0x028a('0xb')](function(_0x44f0f7){logger[_0x028a('0xc')](_0x028a('0xd'),_0x543b4f,'request\x20sent');logger[_0x028a('0xe')](_0x028a('0xf'),_0x543b4f,_0x028a('0x10'),JSON[_0x028a('0x11')](_0x44f0f7));if(_0x44f0f7['error']){if(_0x44f0f7[_0x028a('0x12')][_0x028a('0x13')]===0x1f4){logger[_0x028a('0x12')](_0x028a('0xd'),_0x543b4f,_0x44f0f7[_0x028a('0x12')]['message']);return _0x2838bf(_0x44f0f7[_0x028a('0x12')]['message']);}logger[_0x028a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x543b4f,_0x44f0f7['error'][_0x028a('0x14')]);return _0x51cdee(_0x44f0f7[_0x028a('0x12')]['message']);}else{logger[_0x028a('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x543b4f,_0x028a('0x10'));_0x51cdee(_0x44f0f7['result'][_0x028a('0x14')]);}})[_0x028a('0x15')](function(_0x5530a2){logger['error'](_0x028a('0xd'),_0x543b4f,_0x5530a2);_0x2838bf(_0x5530a2);});});} \ No newline at end of file +var _0x85c4=['randomstring','../../config/logger','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x20688f,_0x1a1dfa){var _0x2a32da=function(_0xaba780){while(--_0xaba780){_0x20688f['push'](_0x20688f['shift']());}};_0x2a32da(++_0x1a1dfa);}(_0x85c4,0x1af));var _0x485c=function(_0x360ec,_0x585d47){_0x360ec=_0x360ec-0x0;var _0xf03953=_0x85c4[_0x360ec];return _0xf03953;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x485c('0x0'));var BPromise=require('bluebird');var rs=require(_0x485c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x485c('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0x485c('0x3'));var client=jayson[_0x485c('0x4')][_0x485c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x68c073,_0x36c15d,_0x8076a8){return new BPromise(function(_0x129780,_0x3cf1f3){return client['request'](_0x68c073,_0x8076a8)[_0x485c('0x6')](function(_0x4222b4){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x36c15d,_0x485c('0x7'));logger[_0x485c('0x8')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x36c15d,_0x485c('0x7'),JSON[_0x485c('0x9')](_0x4222b4));if(_0x4222b4[_0x485c('0xa')]){if(_0x4222b4[_0x485c('0xa')][_0x485c('0xb')]===0x1f4){logger[_0x485c('0xa')](_0x485c('0xc'),_0x36c15d,_0x4222b4['error'][_0x485c('0xd')]);return _0x3cf1f3(_0x4222b4[_0x485c('0xa')][_0x485c('0xd')]);}logger['error'](_0x485c('0xc'),_0x36c15d,_0x4222b4[_0x485c('0xa')][_0x485c('0xd')]);return _0x129780(_0x4222b4[_0x485c('0xa')][_0x485c('0xd')]);}else{logger['info'](_0x485c('0xc'),_0x36c15d,_0x485c('0x7'));_0x129780(_0x4222b4[_0x485c('0xe')]['message']);}})[_0x485c('0xf')](function(_0x540f5c){logger['error'](_0x485c('0xc'),_0x36c15d,_0x540f5c);_0x3cf1f3(_0x540f5c);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f445e5c..1d5db6f 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 _0x453f=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','post','create','addConfiguration','update','delete','destroy','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x453f,0xe7));var _0xf453=function(_0x236615,_0x125e4b){_0x236615=_0x236615-0x0;var _0x309cee=_0x453f[_0x236615];return _0x309cee;};'use strict';var multer=require(_0xf453('0x0'));var util=require(_0xf453('0x1'));var path=require(_0xf453('0x2'));var timeout=require('connect-timeout');var express=require(_0xf453('0x3'));var router=express['Router']();var auth=require(_0xf453('0x4'));var interaction=require(_0xf453('0x5'));var config=require(_0xf453('0x6'));var controller=require(_0xf453('0x7'));router[_0xf453('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf453('0x9'),auth['isAuthenticated'](),controller[_0xf453('0xa')]);router['get'](_0xf453('0xb'),auth[_0xf453('0xc')](),controller[_0xf453('0xd')]);router[_0xf453('0x8')]('/:id/fields',auth[_0xf453('0xc')](),controller['getFields']);router[_0xf453('0xe')]('/',auth[_0xf453('0xc')](),controller[_0xf453('0xf')]);router[_0xf453('0xe')](_0xf453('0xb'),auth[_0xf453('0xc')](),controller[_0xf453('0x10')]);router['put'](_0xf453('0x9'),auth[_0xf453('0xc')](),controller[_0xf453('0x11')]);router[_0xf453('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf453('0x13')]);module[_0xf453('0x14')]=router; \ No newline at end of file +var _0xfddf=['post','create','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x22682f,_0x269be0){var _0x1054d1=function(_0x46803f){while(--_0x46803f){_0x22682f['push'](_0x22682f['shift']());}};_0x1054d1(++_0x269be0);}(_0xfddf,0x158));var _0xffdd=function(_0x54508f,_0x112b5a){_0x54508f=_0x54508f-0x0;var _0x3ddd0b=_0xfddf[_0x54508f];return _0x3ddd0b;};'use strict';var multer=require(_0xffdd('0x0'));var util=require(_0xffdd('0x1'));var path=require(_0xffdd('0x2'));var timeout=require(_0xffdd('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xffdd('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xffdd('0x5'));router[_0xffdd('0x6')]('/',auth[_0xffdd('0x7')](),controller[_0xffdd('0x8')]);router[_0xffdd('0x6')](_0xffdd('0x9'),auth[_0xffdd('0x7')](),controller[_0xffdd('0xa')]);router[_0xffdd('0x6')]('/:id/configurations',auth[_0xffdd('0x7')](),controller['getConfigurations']);router[_0xffdd('0x6')](_0xffdd('0xb'),auth[_0xffdd('0x7')](),controller[_0xffdd('0xc')]);router[_0xffdd('0xd')]('/',auth[_0xffdd('0x7')](),controller[_0xffdd('0xe')]);router[_0xffdd('0xd')](_0xffdd('0xf'),auth[_0xffdd('0x7')](),controller[_0xffdd('0x10')]);router[_0xffdd('0x11')](_0xffdd('0x9'),auth[_0xffdd('0x7')](),controller[_0xffdd('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xffdd('0x13')]);module[_0xffdd('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 505c49d..df2a985 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 _0xacce=['STRING','HelpDesk','sequelize'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xacce,0x188));var _0xeacc=function(_0x34ce79,_0x418548){_0x34ce79=_0x34ce79-0x0;var _0xbb5f98=_0xacce[_0x34ce79];return _0xbb5f98;};'use strict';var Sequelize=require(_0xeacc('0x0'));module['exports']={'name':{'type':Sequelize[_0xeacc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xeacc('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xeacc('0x1')],'allowNull':![],'defaultValue':_0xeacc('0x2')},'remoteUri':{'type':Sequelize[_0xeacc('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0xeacc('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2c42=['sequelize','exports','STRING'];(function(_0x1010ab,_0x26aa57){var _0x251870=function(_0x621d07){while(--_0x621d07){_0x1010ab['push'](_0x1010ab['shift']());}};_0x251870(++_0x26aa57);}(_0x2c42,0x7b));var _0x22c4=function(_0xf76595,_0x26a71b){_0xf76595=_0xf76595-0x0;var _0x374d5b=_0x2c42[_0xf76595];return _0x374d5b;};'use strict';var Sequelize=require(_0x22c4('0x0'));module[_0x22c4('0x1')]={'name':{'type':Sequelize[_0x22c4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x22c4('0x2')]},'username':{'type':Sequelize[_0x22c4('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x22c4('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x22c4('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f01dc91..1a8b3b8 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 _0x6c76=['cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','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','../../components/integrations/configuration','jayson/promise','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','VtigerAccount','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','filter','options','includeAll','include','rows','show','params','merge','find','create','body','getConfigurations','VtigerConfiguration','rawAttributes','pick','map','addConfiguration','findOne','Subjects','channel','type','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','reference','owner','remove','includes','editable','false','label'];(function(_0x493503,_0x351993){var _0x1986d0=function(_0x59a6a1){while(--_0x59a6a1){_0x493503['push'](_0x493503['shift']());}};_0x1986d0(++_0x351993);}(_0x6c76,0x184));var _0x66c7=function(_0x1e25d2,_0x2790a3){_0x1e25d2=_0x1e25d2-0x0;var _0x9e8cb4=_0x6c76[_0x1e25d2];return _0x9e8cb4;};'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'];var integrations=require(_0x66c7('0x13'));var jayson=require(_0x66c7('0x14'));var client=jayson[_0x66c7('0x15')][_0x66c7('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x5176a3,_0x18c309,_0x760e36,_0x35cbc2){return new BPromise(function(_0xea3f56,_0x4f6c91){var _0x1e91d1=_0x35cbc2||client;return _0x1e91d1[_0x66c7('0x17')](_0x5176a3,_0x760e36)[_0x66c7('0x18')](function(_0x6400fe){logger['info'](_0x66c7('0x19'),_0x18c309,'request\x20sent');logger[_0x66c7('0x1a')](_0x66c7('0x1b'),_0x18c309,_0x66c7('0x1c'),JSON[_0x66c7('0x1d')](_0x6400fe));if(_0x6400fe[_0x66c7('0x1e')]){if(_0x6400fe['error']['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x18c309,_0x6400fe[_0x66c7('0x1e')][_0x66c7('0x1f')]);return _0x4f6c91(_0x6400fe['error']['message']);}logger[_0x66c7('0x1e')](_0x66c7('0x19'),_0x18c309,_0x6400fe[_0x66c7('0x1e')][_0x66c7('0x1f')]);return _0xea3f56(_0x6400fe['error']['message']);}else{logger[_0x66c7('0x20')](_0x66c7('0x19'),_0x18c309,_0x66c7('0x1c'));_0xea3f56(_0x6400fe[_0x66c7('0x21')][_0x66c7('0x1f')]);}})[_0x66c7('0x22')](function(_0x4804cf){logger[_0x66c7('0x1e')](_0x66c7('0x19'),_0x18c309,_0x4804cf);_0x4f6c91(_0x4804cf);});});}function respondWithStatusCode(_0x4a2b90,_0x7462f1){_0x7462f1=_0x7462f1||0xcc;return function(_0x8b96b1){if(_0x8b96b1){return _0x4a2b90[_0x66c7('0x23')](_0x7462f1);}return _0x4a2b90[_0x66c7('0x24')](_0x7462f1)['end']();};}function respondWithResult(_0x2736df,_0x42ca37){_0x42ca37=_0x42ca37||0xc8;return function(_0x5b28e6){if(_0x5b28e6){return _0x2736df[_0x66c7('0x24')](_0x42ca37)[_0x66c7('0x25')](_0x5b28e6);}};}function respondWithFilteredResult(_0x2bb86d,_0x2ef6a2){return function(_0x2af0a3){if(_0x2af0a3){var _0x54d45d=_0x2af0a3[_0x66c7('0x26')],_0x5bc4e6=_0x2ef6a2['offset'],_0x4e514a=_0x2ef6a2[_0x66c7('0x27')]+_0x2ef6a2[_0x66c7('0x28')],_0x2dd131;if(_0x4e514a>=_0x54d45d){_0x4e514a=_0x54d45d;_0x2dd131=0xc8;}else{_0x2dd131=0xce;}_0x2bb86d[_0x66c7('0x24')](_0x2dd131);return _0x2bb86d[_0x66c7('0x29')](_0x66c7('0x2a'),_0x5bc4e6+'-'+_0x4e514a+'/'+_0x54d45d)[_0x66c7('0x25')](_0x2af0a3);}return null;};}function patchUpdates(_0x570f0d){return function(_0xccefb2){try{jsonpatch[_0x66c7('0x2b')](_0xccefb2,_0x570f0d,!![]);}catch(_0xc4b2bf){return BPromise[_0x66c7('0x2c')](_0xc4b2bf);}return _0xccefb2[_0x66c7('0x2d')]();};}function saveUpdates(_0x592f0e,_0x263b48){return function(_0x4f1a34){if(_0x4f1a34){return _0x4f1a34[_0x66c7('0x2e')](_0x592f0e)['then'](function(_0x296875){return _0x296875;});}return null;};}function removeEntity(_0x45619c,_0x29f292){return function(_0x2b492d){if(_0x2b492d){return _0x2b492d[_0x66c7('0x2f')]()[_0x66c7('0x18')](function(){_0x45619c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x367e49,_0x12e7c6){return function(_0x827cbc){if(!_0x827cbc){_0x367e49[_0x66c7('0x23')](0x194);}return _0x827cbc;};}function handleError(_0x344345,_0x131f24){_0x131f24=_0x131f24||0x1f4;return function(_0x44dcde){logger[_0x66c7('0x1e')](_0x44dcde[_0x66c7('0x30')]);if(_0x44dcde[_0x66c7('0x31')]){delete _0x44dcde[_0x66c7('0x31')];}_0x344345[_0x66c7('0x24')](_0x131f24)['send'](_0x44dcde);};}exports['index']=function(_0x446bd8,_0x13e7a2){var _0x367ad5={},_0x1b2849={},_0x45050c={'count':0x0,'rows':[]};var _0x2bf7c2=db[_0x66c7('0x32')]['rawAttributes'];_0x1b2849[_0x66c7('0x33')]=_[_0x66c7('0x34')](_0x2bf7c2);var _0x2484d3={'dateStart':_0x446bd8[_0x66c7('0x35')][_0x66c7('0x36')],'dateEnd':_0x446bd8[_0x66c7('0x35')][_0x66c7('0x37')]};delete _0x446bd8[_0x66c7('0x35')][_0x66c7('0x36')];delete _0x446bd8[_0x66c7('0x35')][_0x66c7('0x37')];_0x1b2849['query']=_['keys'](_0x446bd8[_0x66c7('0x35')]);_0x1b2849[_0x66c7('0x38')]=_[_0x66c7('0x39')](_0x1b2849['model'],_0x1b2849['query']);_0x367ad5[_0x66c7('0x3a')]=_[_0x66c7('0x39')](_0x1b2849['model'],qs[_0x66c7('0x3b')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x3b')]));_0x367ad5['attributes']=_0x367ad5[_0x66c7('0x3a')][_0x66c7('0x3c')]?_0x367ad5[_0x66c7('0x3a')]:_0x1b2849[_0x66c7('0x33')];if(!_0x446bd8[_0x66c7('0x35')][_0x66c7('0x3d')](_0x66c7('0x3e'))){_0x367ad5[_0x66c7('0x28')]=qs[_0x66c7('0x28')](_0x446bd8['query'][_0x66c7('0x28')]);_0x367ad5[_0x66c7('0x27')]=qs[_0x66c7('0x27')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x27')]);}_0x367ad5[_0x66c7('0x3f')]=qs[_0x66c7('0x40')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x40')]);_0x367ad5[_0x66c7('0x41')]=qs['filters'](_['pick'](_0x446bd8['query'],_0x1b2849[_0x66c7('0x38')]));if(_0x2484d3[_0x66c7('0x36')]){if(_0x2484d3['dateEnd']){_0x2484d3['dateEnd']=moment(_0x2484d3[_0x66c7('0x37')])[_0x66c7('0x42')](0x1,_0x66c7('0x43'));}else{_0x2484d3[_0x66c7('0x37')]=moment(_0x2484d3[_0x66c7('0x36')])['add'](0x1,_0x66c7('0x43'));}_['merge'](_0x367ad5['where'],{'createdAt':{'$gte':_0x2484d3[_0x66c7('0x36')],'$lte':_0x2484d3[_0x66c7('0x37')]}});}if(_0x446bd8[_0x66c7('0x35')][_0x66c7('0x44')]){_0x367ad5['where']=_['merge'](_0x367ad5[_0x66c7('0x41')],{'$or':_['map'](_0x367ad5['attributes'],function(_0x1ec272){var _0x230f28={};_0x230f28[_0x1ec272]={'$like':'%'+_0x446bd8[_0x66c7('0x35')][_0x66c7('0x44')]+'%'};return _0x230f28;})});}_0x367ad5=_['merge']({},_0x367ad5,_0x446bd8[_0x66c7('0x45')]);var _0x108a92={'where':_0x367ad5[_0x66c7('0x41')]};return db['VtigerAccount'][_0x66c7('0x26')](_0x108a92)[_0x66c7('0x18')](function(_0x88fe1e){_0x45050c[_0x66c7('0x26')]=_0x88fe1e;if(_0x446bd8[_0x66c7('0x35')][_0x66c7('0x46')]){_0x367ad5[_0x66c7('0x47')]=[{'all':!![]}];}return db[_0x66c7('0x32')]['findAll'](_0x367ad5);})[_0x66c7('0x18')](function(_0x12d377){_0x45050c[_0x66c7('0x48')]=_0x12d377;return _0x45050c;})[_0x66c7('0x18')](respondWithFilteredResult(_0x13e7a2,_0x367ad5))[_0x66c7('0x22')](handleError(_0x13e7a2,null));};exports[_0x66c7('0x49')]=function(_0x2cd0c6,_0x12d063){var _0x1b3dc2={'raw':![],'where':{'id':_0x2cd0c6[_0x66c7('0x4a')]['id']}},_0x2d8eeb={};_0x2d8eeb[_0x66c7('0x33')]=_[_0x66c7('0x34')](db[_0x66c7('0x32')]['rawAttributes']);_0x2d8eeb[_0x66c7('0x35')]=_[_0x66c7('0x34')](_0x2cd0c6[_0x66c7('0x35')]);_0x2d8eeb[_0x66c7('0x38')]=_['intersection'](_0x2d8eeb[_0x66c7('0x33')],_0x2d8eeb[_0x66c7('0x35')]);_0x1b3dc2['attributes']=_[_0x66c7('0x39')](_0x2d8eeb[_0x66c7('0x33')],qs[_0x66c7('0x3b')](_0x2cd0c6[_0x66c7('0x35')][_0x66c7('0x3b')]));_0x1b3dc2[_0x66c7('0x3a')]=_0x1b3dc2[_0x66c7('0x3a')]['length']?_0x1b3dc2[_0x66c7('0x3a')]:_0x2d8eeb[_0x66c7('0x33')];if(_0x2cd0c6['query'][_0x66c7('0x46')]){_0x1b3dc2[_0x66c7('0x47')]=[{'all':!![]}];}_0x1b3dc2=_[_0x66c7('0x4b')]({},_0x1b3dc2,_0x2cd0c6['options']);return db[_0x66c7('0x32')][_0x66c7('0x4c')](_0x1b3dc2)[_0x66c7('0x18')](handleEntityNotFound(_0x12d063,null))[_0x66c7('0x18')](respondWithResult(_0x12d063,null))[_0x66c7('0x22')](handleError(_0x12d063,null));};exports[_0x66c7('0x4d')]=function(_0x1d8313,_0x21b298){return db['VtigerAccount'][_0x66c7('0x4d')](_0x1d8313[_0x66c7('0x4e')],{})['then'](respondWithResult(_0x21b298,0xc9))[_0x66c7('0x22')](handleError(_0x21b298,null));};exports[_0x66c7('0x2e')]=function(_0x26336e,_0x577d19){if(_0x26336e['body']['id']){delete _0x26336e[_0x66c7('0x4e')]['id'];}return db['VtigerAccount'][_0x66c7('0x4c')]({'where':{'id':_0x26336e[_0x66c7('0x4a')]['id']}})[_0x66c7('0x18')](handleEntityNotFound(_0x577d19,null))[_0x66c7('0x18')](saveUpdates(_0x26336e[_0x66c7('0x4e')],null))[_0x66c7('0x18')](respondWithResult(_0x577d19,null))['catch'](handleError(_0x577d19,null));};exports['destroy']=function(_0x477e46,_0x3c3c63){return db['VtigerAccount']['find']({'where':{'id':_0x477e46[_0x66c7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c3c63,null))[_0x66c7('0x18')](removeEntity(_0x3c3c63,null))[_0x66c7('0x22')](handleError(_0x3c3c63,null));};exports[_0x66c7('0x4f')]=function(_0x290738,_0x5c3717,_0x3b26ac){var _0x1dc6e6={};var _0x2443cb={};var _0x2659f5;var _0x73dc15;return db[_0x66c7('0x32')]['findOne']({'where':{'id':_0x290738[_0x66c7('0x4a')]['id']}})[_0x66c7('0x18')](handleEntityNotFound(_0x5c3717,null))[_0x66c7('0x18')](function(_0x5352ec){if(_0x5352ec){_0x2659f5=_0x5352ec;_0x2443cb[_0x66c7('0x33')]=_['keys'](db[_0x66c7('0x50')][_0x66c7('0x51')]);_0x2443cb[_0x66c7('0x35')]=_[_0x66c7('0x34')](_0x290738[_0x66c7('0x35')]);_0x2443cb[_0x66c7('0x38')]=_['intersection'](_0x2443cb[_0x66c7('0x33')],_0x2443cb[_0x66c7('0x35')]);_0x1dc6e6[_0x66c7('0x3a')]=_[_0x66c7('0x39')](_0x2443cb[_0x66c7('0x33')],qs['fields'](_0x290738[_0x66c7('0x35')][_0x66c7('0x3b')]));_0x1dc6e6[_0x66c7('0x3a')]=_0x1dc6e6[_0x66c7('0x3a')][_0x66c7('0x3c')]?_0x1dc6e6[_0x66c7('0x3a')]:_0x2443cb[_0x66c7('0x33')];_0x1dc6e6[_0x66c7('0x3f')]=qs[_0x66c7('0x40')](_0x290738[_0x66c7('0x35')][_0x66c7('0x40')]);_0x1dc6e6[_0x66c7('0x41')]=qs['filters'](_[_0x66c7('0x52')](_0x290738[_0x66c7('0x35')],_0x2443cb[_0x66c7('0x38')]));if(_0x290738[_0x66c7('0x35')][_0x66c7('0x44')]){_0x1dc6e6[_0x66c7('0x41')]=_[_0x66c7('0x4b')](_0x1dc6e6['where'],{'$or':_[_0x66c7('0x53')](_0x1dc6e6[_0x66c7('0x3a')],function(_0x17ae53){var _0x217ccf={};_0x217ccf[_0x17ae53]={'$like':'%'+_0x290738[_0x66c7('0x35')][_0x66c7('0x44')]+'%'};return _0x217ccf;})});}_0x1dc6e6=_[_0x66c7('0x4b')]({},_0x1dc6e6,_0x290738[_0x66c7('0x45')]);return _0x2659f5[_0x66c7('0x4f')](_0x1dc6e6);}})[_0x66c7('0x18')](function(_0x21eb0a){if(_0x21eb0a){_0x73dc15=_0x21eb0a[_0x66c7('0x3c')];if(!_0x290738[_0x66c7('0x35')][_0x66c7('0x3d')](_0x66c7('0x3e'))){_0x1dc6e6[_0x66c7('0x28')]=qs['limit'](_0x290738[_0x66c7('0x35')][_0x66c7('0x28')]);_0x1dc6e6[_0x66c7('0x27')]=qs[_0x66c7('0x27')](_0x290738[_0x66c7('0x35')][_0x66c7('0x27')]);}return _0x2659f5[_0x66c7('0x4f')](_0x1dc6e6);}})[_0x66c7('0x18')](function(_0x134adb){if(_0x134adb){return _0x134adb?{'count':_0x73dc15,'rows':_0x134adb}:null;}})[_0x66c7('0x18')](respondWithResult(_0x5c3717,null))[_0x66c7('0x22')](handleError(_0x5c3717,null));};exports[_0x66c7('0x54')]=function(_0x2476e6,_0x23ec65,_0x3263ab){if(_0x2476e6[_0x66c7('0x4e')]['id']){delete _0x2476e6[_0x66c7('0x4e')]['id'];}return db['VtigerAccount'][_0x66c7('0x55')]({'where':{'id':_0x2476e6[_0x66c7('0x4a')]['id']}})[_0x66c7('0x18')](handleEntityNotFound(_0x23ec65,null))[_0x66c7('0x18')](function(_0x3ccac2){if(_0x3ccac2){_0x2476e6[_0x66c7('0x4e')]['AccountId']=_0x3ccac2['id'];_0x2476e6['body'][_0x66c7('0x56')]=integrations['getSubjects'](_0x2476e6[_0x66c7('0x4e')][_0x66c7('0x57')],_0x2476e6[_0x66c7('0x4e')][_0x66c7('0x58')]);_0x2476e6[_0x66c7('0x4e')][_0x66c7('0x59')]=integrations[_0x66c7('0x5a')](_0x2476e6[_0x66c7('0x4e')][_0x66c7('0x57')],_0x2476e6[_0x66c7('0x4e')][_0x66c7('0x58')]);return db[_0x66c7('0x50')]['create'](_0x2476e6[_0x66c7('0x4e')],{'include':[{'model':db[_0x66c7('0x5b')],'as':_0x66c7('0x56')},{'model':db[_0x66c7('0x5b')],'as':'Descriptions'}]});}return null;})[_0x66c7('0x18')](respondWithResult(_0x23ec65,null))[_0x66c7('0x22')](handleError(_0x23ec65,null));};var md5=require('md5');exports[_0x66c7('0x5c')]=function(_0x3a4fe1,_0x3f25c0,_0x2fadf8){var _0x41282b=null;var _0x375c97=null;var _0x580212=null;var _0x517610=null;return db[_0x66c7('0x32')]['findOne']({'where':{'id':_0x3a4fe1['params']['id']},'attributes':['id',_0x66c7('0x31'),_0x66c7('0x5d'),_0x66c7('0x5e'),_0x66c7('0x5f'),_0x66c7('0x60'),_0x66c7('0x61'),_0x66c7('0x62')]})[_0x66c7('0x18')](handleEntityNotFound(_0x3f25c0,null))['then'](function(_0x3a216e){if(_0x3a216e){_0x41282b=_0x3a216e[_0x66c7('0x5d')];_0x375c97=_0x3a216e[_0x66c7('0x62')];_0x580212=_0x3a216e[_0x66c7('0x5f')];_0x517610=util[_0x66c7('0x63')](_0x66c7('0x64'),_0x3a216e[_0x66c7('0x60')]);var _0x44a672={'method':_0x66c7('0x65'),'uri':_0x517610,'qs':{'operation':_0x66c7('0x66'),'username':_0x3a216e[_0x66c7('0x5d')]},'json':!![]};return rp(_0x44a672);}})[_0x66c7('0x18')](function(_0x256731){if(_0x256731[_0x66c7('0x67')]){var _0x19a425={'method':_0x66c7('0x68'),'uri':_0x517610,'form':{'operation':_0x66c7('0x69'),'username':_0x41282b,'accessKey':md5(_0x256731[_0x66c7('0x21')][_0x66c7('0x6a')]+_0x375c97)},'json':!![]};return rp(_0x19a425);}})[_0x66c7('0x18')](function(_0x2e2648){if(_0x2e2648[_0x66c7('0x67')]){var _0x227dc1={'method':_0x66c7('0x65'),'uri':_0x517610,'qs':{'operation':_0x66c7('0x6b'),'username':_0x41282b,'sessionName':_0x2e2648[_0x66c7('0x21')][_0x66c7('0x6c')],'elementType':_0x580212},'json':!![]};return rp(_0x227dc1);}})['then'](function(_0xb40f34){if(_0xb40f34[_0x66c7('0x67')]){var _0x94bae8=['autogenerated',_0x66c7('0x6d'),_0x66c7('0x6e')];_[_0x66c7('0x6f')](_0xb40f34['result'][_0x66c7('0x3b')],function(_0x12994c){return _0x94bae8[_0x66c7('0x70')](_0x12994c['type'][_0x66c7('0x31')]);});_[_0x66c7('0x6f')](_0xb40f34[_0x66c7('0x21')][_0x66c7('0x3b')],function(_0x4d9143){return _0x4d9143[_0x66c7('0x71')]===_0x66c7('0x72');});return{'count':_0xb40f34[_0x66c7('0x21')][_0x66c7('0x3b')]['length'],'rows':_['map'](_0xb40f34[_0x66c7('0x21')][_0x66c7('0x3b')],function(_0x45ccdf){return{'id':_0x45ccdf[_0x66c7('0x31')],'name':_0x45ccdf[_0x66c7('0x73')],'custom':_['startsWith'](_0x45ccdf[_0x66c7('0x31')],_0x66c7('0x74'))?!![]:![],'options':_0x45ccdf[_0x66c7('0x58')][_0x66c7('0x31')]===_0x66c7('0x75')&&_0x45ccdf['type'][_0x66c7('0x76')][_0x66c7('0x3c')]>0x0?_[_0x66c7('0x53')](_0x45ccdf[_0x66c7('0x58')][_0x66c7('0x76')],function(_0x4310e6){return{'name':_0x4310e6[_0x66c7('0x73')],'value':_0x4310e6[_0x66c7('0x77')]};}):[]};})};}})['then'](respondWithResult(_0x3f25c0,null))[_0x66c7('0x22')](function(_0x3c073e){console[_0x66c7('0x78')]('vTiger\x20error:\x20'+_0x3c073e);var _0x2cf267=_0x3a4fe1[_0x66c7('0x35')][_0x66c7('0x79')]?0x1f4:_0x3c073e[_0x66c7('0x7a')]||0x1f4;logger[_0x66c7('0x1e')](_0x66c7('0x7b'),_0x66c7('0x5c'),_0x2cf267,JSON[_0x66c7('0x1d')](_0x3c073e));delete _0x3c073e['name'];if(_0x2cf267===0x191){_0x2cf267=0x190;}_0x3f25c0[_0x66c7('0x24')](_0x2cf267)[_0x66c7('0x7c')](_0x3a4fe1[_0x66c7('0x35')][_0x66c7('0x79')]?{'message':_0x66c7('0x7d'),'statusCode':_0x3c073e[_0x66c7('0x7a')]}:_0x3c073e);});}; \ No newline at end of file +var _0xfd28=['end','status','json','offset','limit','Content-Range','apply','reject','update','name','index','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','dateEnd','add','day','merge','filter','options','count','includeAll','include','VtigerAccount','findAll','rows','show','fields','find','create','body','destroy','params','findOne','VtigerConfiguration','order','map','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','getDescriptions','channel','type','VtigerField','Descriptions','md5','getFields','username','moduleName','remoteUri','accessKey','format','POST','login','token','success','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/environment','../../components/integrations/configuration','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xfd28,0x148));var _0x8fd2=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0xfd28[_0x5dfc2a];return _0x3f1a71;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8fd2('0x0'));var rimraf=require(_0x8fd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fd2('0x2'));var rp=require('request-promise');var moment=require(_0x8fd2('0x3'));var BPromise=require(_0x8fd2('0x4'));var Mustache=require(_0x8fd2('0x5'));var util=require('util');var path=require(_0x8fd2('0x6'));var sox=require(_0x8fd2('0x7'));var csv=require(_0x8fd2('0x8'));var ejs=require(_0x8fd2('0x9'));var fs=require('fs');var _=require(_0x8fd2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8fd2('0xb'));var deskjs=require(_0x8fd2('0xc'));var toCsv=require(_0x8fd2('0x8'));var querystring=require('querystring');var Papa=require(_0x8fd2('0xd'));var Redis=require('ioredis');var qs=require(_0x8fd2('0xe'));var logger=require('../../config/logger')(_0x8fd2('0xf'));var utils=require('../../config/utils');var config=require(_0x8fd2('0x10'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8fd2('0x11'));var jayson=require('jayson/promise');var client=jayson[_0x8fd2('0x12')][_0x8fd2('0x13')]({'port':0x232a});function respondWithRpcPromise(_0xfd78d,_0xa6d7ca,_0x17ad4c,_0xe9ec20){return new BPromise(function(_0x1e214c,_0xf22ae){var _0x2b152c=_0xe9ec20||client;return _0x2b152c[_0x8fd2('0x14')](_0xfd78d,_0x17ad4c)[_0x8fd2('0x15')](function(_0x6b8ef){logger[_0x8fd2('0x16')](_0x8fd2('0x17'),_0xa6d7ca,_0x8fd2('0x18'));logger['debug'](_0x8fd2('0x19'),_0xa6d7ca,'request\x20sent',JSON['stringify'](_0x6b8ef));if(_0x6b8ef['error']){if(_0x6b8ef[_0x8fd2('0x1a')][_0x8fd2('0x1b')]===0x1f4){logger[_0x8fd2('0x1a')](_0x8fd2('0x17'),_0xa6d7ca,_0x6b8ef['error'][_0x8fd2('0x1c')]);return _0xf22ae(_0x6b8ef[_0x8fd2('0x1a')][_0x8fd2('0x1c')]);}logger[_0x8fd2('0x1a')](_0x8fd2('0x17'),_0xa6d7ca,_0x6b8ef['error']['message']);return _0x1e214c(_0x6b8ef[_0x8fd2('0x1a')]['message']);}else{logger[_0x8fd2('0x16')]('VtigerAccount,\x20%s,\x20%s',_0xa6d7ca,_0x8fd2('0x18'));_0x1e214c(_0x6b8ef[_0x8fd2('0x1d')]['message']);}})[_0x8fd2('0x1e')](function(_0x4c2be8){logger[_0x8fd2('0x1a')](_0x8fd2('0x17'),_0xa6d7ca,_0x4c2be8);_0xf22ae(_0x4c2be8);});});}function respondWithStatusCode(_0x4e0dc4,_0x1c925c){_0x1c925c=_0x1c925c||0xcc;return function(_0x2a9c3c){if(_0x2a9c3c){return _0x4e0dc4[_0x8fd2('0x1f')](_0x1c925c);}return _0x4e0dc4['status'](_0x1c925c)[_0x8fd2('0x20')]();};}function respondWithResult(_0x3b9e2f,_0x27d03b){_0x27d03b=_0x27d03b||0xc8;return function(_0x4742cf){if(_0x4742cf){return _0x3b9e2f[_0x8fd2('0x21')](_0x27d03b)[_0x8fd2('0x22')](_0x4742cf);}};}function respondWithFilteredResult(_0x2c2850,_0x398925){return function(_0x1456b4){if(_0x1456b4){var _0xbc5945=_0x1456b4['count'],_0x3392fb=_0x398925['offset'],_0x1f3237=_0x398925[_0x8fd2('0x23')]+_0x398925[_0x8fd2('0x24')],_0x3f16a3;if(_0x1f3237>=_0xbc5945){_0x1f3237=_0xbc5945;_0x3f16a3=0xc8;}else{_0x3f16a3=0xce;}_0x2c2850[_0x8fd2('0x21')](_0x3f16a3);return _0x2c2850['set'](_0x8fd2('0x25'),_0x3392fb+'-'+_0x1f3237+'/'+_0xbc5945)[_0x8fd2('0x22')](_0x1456b4);}return null;};}function patchUpdates(_0x27b256){return function(_0x960869){try{jsonpatch[_0x8fd2('0x26')](_0x960869,_0x27b256,!![]);}catch(_0x4745bf){return BPromise[_0x8fd2('0x27')](_0x4745bf);}return _0x960869['save']();};}function saveUpdates(_0xe76676,_0x13c9b9){return function(_0x818f61){if(_0x818f61){return _0x818f61[_0x8fd2('0x28')](_0xe76676)[_0x8fd2('0x15')](function(_0x3ea575){return _0x3ea575;});}return null;};}function removeEntity(_0x39df3a,_0x4f6b7b){return function(_0x5b992a){if(_0x5b992a){return _0x5b992a['destroy']()[_0x8fd2('0x15')](function(){_0x39df3a[_0x8fd2('0x21')](0xcc)[_0x8fd2('0x20')]();});}};}function handleEntityNotFound(_0xe4987b,_0x5a0b3b){return function(_0x548d16){if(!_0x548d16){_0xe4987b[_0x8fd2('0x1f')](0x194);}return _0x548d16;};}function handleError(_0x3629fe,_0x42d5cf){_0x42d5cf=_0x42d5cf||0x1f4;return function(_0x18fe4e){logger[_0x8fd2('0x1a')](_0x18fe4e['stack']);if(_0x18fe4e[_0x8fd2('0x29')]){delete _0x18fe4e['name'];}_0x3629fe[_0x8fd2('0x21')](_0x42d5cf)['send'](_0x18fe4e);};}exports[_0x8fd2('0x2a')]=function(_0x4d9faa,_0x134420){var _0x3449b1={},_0x39092e={},_0x52422c={'count':0x0,'rows':[]};var _0x339291=db['VtigerAccount'][_0x8fd2('0x2b')];_0x39092e[_0x8fd2('0x2c')]=_[_0x8fd2('0x2d')](_0x339291);var _0x5aaaed={'dateStart':_0x4d9faa[_0x8fd2('0x2e')][_0x8fd2('0x2f')],'dateEnd':_0x4d9faa[_0x8fd2('0x2e')]['dateEnd']};delete _0x4d9faa[_0x8fd2('0x2e')][_0x8fd2('0x2f')];delete _0x4d9faa[_0x8fd2('0x2e')]['dateEnd'];_0x39092e[_0x8fd2('0x2e')]=_[_0x8fd2('0x2d')](_0x4d9faa['query']);_0x39092e[_0x8fd2('0x30')]=_[_0x8fd2('0x31')](_0x39092e[_0x8fd2('0x2c')],_0x39092e[_0x8fd2('0x2e')]);_0x3449b1[_0x8fd2('0x32')]=_[_0x8fd2('0x31')](_0x39092e[_0x8fd2('0x2c')],qs['fields'](_0x4d9faa[_0x8fd2('0x2e')]['fields']));_0x3449b1['attributes']=_0x3449b1[_0x8fd2('0x32')][_0x8fd2('0x33')]?_0x3449b1[_0x8fd2('0x32')]:_0x39092e[_0x8fd2('0x2c')];if(!_0x4d9faa[_0x8fd2('0x2e')][_0x8fd2('0x34')]('nolimit')){_0x3449b1['limit']=qs[_0x8fd2('0x24')](_0x4d9faa['query']['limit']);_0x3449b1[_0x8fd2('0x23')]=qs[_0x8fd2('0x23')](_0x4d9faa[_0x8fd2('0x2e')][_0x8fd2('0x23')]);}_0x3449b1['order']=qs[_0x8fd2('0x35')](_0x4d9faa[_0x8fd2('0x2e')][_0x8fd2('0x35')]);_0x3449b1[_0x8fd2('0x36')]=qs[_0x8fd2('0x30')](_[_0x8fd2('0x37')](_0x4d9faa[_0x8fd2('0x2e')],_0x39092e['filters']));if(_0x5aaaed[_0x8fd2('0x2f')]){if(_0x5aaaed[_0x8fd2('0x38')]){_0x5aaaed[_0x8fd2('0x38')]=moment(_0x5aaaed[_0x8fd2('0x38')])[_0x8fd2('0x39')](0x1,_0x8fd2('0x3a'));}else{_0x5aaaed[_0x8fd2('0x38')]=moment(_0x5aaaed['dateStart'])[_0x8fd2('0x39')](0x1,_0x8fd2('0x3a'));}_[_0x8fd2('0x3b')](_0x3449b1[_0x8fd2('0x36')],{'createdAt':{'$gte':_0x5aaaed[_0x8fd2('0x2f')],'$lte':_0x5aaaed[_0x8fd2('0x38')]}});}if(_0x4d9faa[_0x8fd2('0x2e')]['filter']){_0x3449b1[_0x8fd2('0x36')]=_['merge'](_0x3449b1[_0x8fd2('0x36')],{'$or':_['map'](_0x3449b1[_0x8fd2('0x32')],function(_0xe511dd){var _0x2a39ac={};_0x2a39ac[_0xe511dd]={'$like':'%'+_0x4d9faa['query'][_0x8fd2('0x3c')]+'%'};return _0x2a39ac;})});}_0x3449b1=_[_0x8fd2('0x3b')]({},_0x3449b1,_0x4d9faa[_0x8fd2('0x3d')]);var _0x4a5a8d={'where':_0x3449b1[_0x8fd2('0x36')]};return db['VtigerAccount'][_0x8fd2('0x3e')](_0x4a5a8d)[_0x8fd2('0x15')](function(_0x3d408b){_0x52422c[_0x8fd2('0x3e')]=_0x3d408b;if(_0x4d9faa[_0x8fd2('0x2e')][_0x8fd2('0x3f')]){_0x3449b1[_0x8fd2('0x40')]=[{'all':!![]}];}return db[_0x8fd2('0x41')][_0x8fd2('0x42')](_0x3449b1);})[_0x8fd2('0x15')](function(_0x19847c){_0x52422c[_0x8fd2('0x43')]=_0x19847c;return _0x52422c;})[_0x8fd2('0x15')](respondWithFilteredResult(_0x134420,_0x3449b1))[_0x8fd2('0x1e')](handleError(_0x134420,null));};exports[_0x8fd2('0x44')]=function(_0x459c68,_0x385a95){var _0x2a2c69={'raw':![],'where':{'id':_0x459c68['params']['id']}},_0x2fdbe5={};_0x2fdbe5['model']=_[_0x8fd2('0x2d')](db[_0x8fd2('0x41')][_0x8fd2('0x2b')]);_0x2fdbe5['query']=_['keys'](_0x459c68[_0x8fd2('0x2e')]);_0x2fdbe5['filters']=_[_0x8fd2('0x31')](_0x2fdbe5[_0x8fd2('0x2c')],_0x2fdbe5[_0x8fd2('0x2e')]);_0x2a2c69['attributes']=_[_0x8fd2('0x31')](_0x2fdbe5[_0x8fd2('0x2c')],qs['fields'](_0x459c68[_0x8fd2('0x2e')][_0x8fd2('0x45')]));_0x2a2c69[_0x8fd2('0x32')]=_0x2a2c69['attributes'][_0x8fd2('0x33')]?_0x2a2c69[_0x8fd2('0x32')]:_0x2fdbe5[_0x8fd2('0x2c')];if(_0x459c68[_0x8fd2('0x2e')][_0x8fd2('0x3f')]){_0x2a2c69[_0x8fd2('0x40')]=[{'all':!![]}];}_0x2a2c69=_['merge']({},_0x2a2c69,_0x459c68['options']);return db[_0x8fd2('0x41')][_0x8fd2('0x46')](_0x2a2c69)['then'](handleEntityNotFound(_0x385a95,null))[_0x8fd2('0x15')](respondWithResult(_0x385a95,null))['catch'](handleError(_0x385a95,null));};exports['create']=function(_0x2ef7e6,_0x1eca98){return db[_0x8fd2('0x41')][_0x8fd2('0x47')](_0x2ef7e6[_0x8fd2('0x48')],{})[_0x8fd2('0x15')](respondWithResult(_0x1eca98,0xc9))['catch'](handleError(_0x1eca98,null));};exports[_0x8fd2('0x28')]=function(_0x1a2ffc,_0x2ece02){if(_0x1a2ffc[_0x8fd2('0x48')]['id']){delete _0x1a2ffc[_0x8fd2('0x48')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x1a2ffc['params']['id']}})['then'](handleEntityNotFound(_0x2ece02,null))['then'](saveUpdates(_0x1a2ffc[_0x8fd2('0x48')],null))[_0x8fd2('0x15')](respondWithResult(_0x2ece02,null))[_0x8fd2('0x1e')](handleError(_0x2ece02,null));};exports[_0x8fd2('0x49')]=function(_0x21696c,_0x25abdc){return db[_0x8fd2('0x41')]['find']({'where':{'id':_0x21696c[_0x8fd2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x25abdc,null))[_0x8fd2('0x15')](removeEntity(_0x25abdc,null))[_0x8fd2('0x1e')](handleError(_0x25abdc,null));};exports['getConfigurations']=function(_0x52006b,_0x3baa83,_0x470466){var _0x2e45e6={};var _0x30a952={};var _0x37ddfa;var _0x5476ca;return db[_0x8fd2('0x41')][_0x8fd2('0x4b')]({'where':{'id':_0x52006b[_0x8fd2('0x4a')]['id']}})[_0x8fd2('0x15')](handleEntityNotFound(_0x3baa83,null))['then'](function(_0x9c5a26){if(_0x9c5a26){_0x37ddfa=_0x9c5a26;_0x30a952[_0x8fd2('0x2c')]=_[_0x8fd2('0x2d')](db[_0x8fd2('0x4c')]['rawAttributes']);_0x30a952['query']=_['keys'](_0x52006b[_0x8fd2('0x2e')]);_0x30a952[_0x8fd2('0x30')]=_[_0x8fd2('0x31')](_0x30a952[_0x8fd2('0x2c')],_0x30a952[_0x8fd2('0x2e')]);_0x2e45e6['attributes']=_[_0x8fd2('0x31')](_0x30a952[_0x8fd2('0x2c')],qs['fields'](_0x52006b[_0x8fd2('0x2e')][_0x8fd2('0x45')]));_0x2e45e6[_0x8fd2('0x32')]=_0x2e45e6[_0x8fd2('0x32')][_0x8fd2('0x33')]?_0x2e45e6['attributes']:_0x30a952[_0x8fd2('0x2c')];_0x2e45e6[_0x8fd2('0x4d')]=qs[_0x8fd2('0x35')](_0x52006b[_0x8fd2('0x2e')][_0x8fd2('0x35')]);_0x2e45e6[_0x8fd2('0x36')]=qs[_0x8fd2('0x30')](_[_0x8fd2('0x37')](_0x52006b[_0x8fd2('0x2e')],_0x30a952[_0x8fd2('0x30')]));if(_0x52006b[_0x8fd2('0x2e')][_0x8fd2('0x3c')]){_0x2e45e6[_0x8fd2('0x36')]=_['merge'](_0x2e45e6[_0x8fd2('0x36')],{'$or':_[_0x8fd2('0x4e')](_0x2e45e6['attributes'],function(_0x5c497e){var _0x553fa1={};_0x553fa1[_0x5c497e]={'$like':'%'+_0x52006b[_0x8fd2('0x2e')][_0x8fd2('0x3c')]+'%'};return _0x553fa1;})});}_0x2e45e6=_[_0x8fd2('0x3b')]({},_0x2e45e6,_0x52006b[_0x8fd2('0x3d')]);return _0x37ddfa[_0x8fd2('0x4f')](_0x2e45e6);}})[_0x8fd2('0x15')](function(_0x52a332){if(_0x52a332){_0x5476ca=_0x52a332[_0x8fd2('0x33')];if(!_0x52006b[_0x8fd2('0x2e')]['hasOwnProperty'](_0x8fd2('0x50'))){_0x2e45e6['limit']=qs[_0x8fd2('0x24')](_0x52006b[_0x8fd2('0x2e')][_0x8fd2('0x24')]);_0x2e45e6[_0x8fd2('0x23')]=qs[_0x8fd2('0x23')](_0x52006b['query'][_0x8fd2('0x23')]);}return _0x37ddfa[_0x8fd2('0x4f')](_0x2e45e6);}})['then'](function(_0x2e0cc2){if(_0x2e0cc2){return _0x2e0cc2?{'count':_0x5476ca,'rows':_0x2e0cc2}:null;}})['then'](respondWithResult(_0x3baa83,null))['catch'](handleError(_0x3baa83,null));};exports[_0x8fd2('0x51')]=function(_0x1d36d2,_0x52a7f6,_0x3080c0){if(_0x1d36d2[_0x8fd2('0x48')]['id']){delete _0x1d36d2[_0x8fd2('0x48')]['id'];}return db['VtigerAccount'][_0x8fd2('0x4b')]({'where':{'id':_0x1d36d2[_0x8fd2('0x4a')]['id']}})[_0x8fd2('0x15')](handleEntityNotFound(_0x52a7f6,null))[_0x8fd2('0x15')](function(_0x234800){if(_0x234800){_0x1d36d2[_0x8fd2('0x48')][_0x8fd2('0x52')]=_0x234800['id'];_0x1d36d2['body']['Subjects']=integrations[_0x8fd2('0x53')](_0x1d36d2[_0x8fd2('0x48')]['channel'],_0x1d36d2['body']['type']);_0x1d36d2['body']['Descriptions']=integrations[_0x8fd2('0x54')](_0x1d36d2[_0x8fd2('0x48')][_0x8fd2('0x55')],_0x1d36d2[_0x8fd2('0x48')][_0x8fd2('0x56')]);return db['VtigerConfiguration'][_0x8fd2('0x47')](_0x1d36d2[_0x8fd2('0x48')],{'include':[{'model':db[_0x8fd2('0x57')],'as':'Subjects'},{'model':db[_0x8fd2('0x57')],'as':_0x8fd2('0x58')}]});}return null;})['then'](respondWithResult(_0x52a7f6,null))[_0x8fd2('0x1e')](handleError(_0x52a7f6,null));};var md5=require(_0x8fd2('0x59'));exports[_0x8fd2('0x5a')]=function(_0x2af76d,_0x34c59e,_0x2fb611){var _0xbeb55a=null;var _0x5f5487=null;var _0x26f8b9=null;var _0xb59500=null;return db[_0x8fd2('0x41')][_0x8fd2('0x4b')]({'where':{'id':_0x2af76d[_0x8fd2('0x4a')]['id']},'attributes':['id',_0x8fd2('0x29'),_0x8fd2('0x5b'),'description',_0x8fd2('0x5c'),_0x8fd2('0x5d'),'serverUrl',_0x8fd2('0x5e')]})[_0x8fd2('0x15')](handleEntityNotFound(_0x34c59e,null))[_0x8fd2('0x15')](function(_0x131ee8){if(_0x131ee8){_0xbeb55a=_0x131ee8[_0x8fd2('0x5b')];_0x5f5487=_0x131ee8[_0x8fd2('0x5e')];_0x26f8b9=_0x131ee8[_0x8fd2('0x5c')];_0xb59500=util[_0x8fd2('0x5f')]('%s/webservice.php',_0x131ee8[_0x8fd2('0x5d')]);var _0x5891bb={'method':'GET','uri':_0xb59500,'qs':{'operation':'getchallenge','username':_0x131ee8[_0x8fd2('0x5b')]},'json':!![]};return rp(_0x5891bb);}})['then'](function(_0x2d78ab){if(_0x2d78ab['success']){var _0x5afb15={'method':_0x8fd2('0x60'),'uri':_0xb59500,'form':{'operation':_0x8fd2('0x61'),'username':_0xbeb55a,'accessKey':md5(_0x2d78ab['result'][_0x8fd2('0x62')]+_0x5f5487)},'json':!![]};return rp(_0x5afb15);}})[_0x8fd2('0x15')](function(_0x114d12){if(_0x114d12[_0x8fd2('0x63')]){var _0x570b06={'method':'GET','uri':_0xb59500,'qs':{'operation':_0x8fd2('0x64'),'username':_0xbeb55a,'sessionName':_0x114d12['result'][_0x8fd2('0x65')],'elementType':_0x26f8b9},'json':!![]};return rp(_0x570b06);}})[_0x8fd2('0x15')](function(_0x52b6a2){if(_0x52b6a2[_0x8fd2('0x63')]){var _0xc60005=[_0x8fd2('0x66'),_0x8fd2('0x67'),_0x8fd2('0x68')];_[_0x8fd2('0x69')](_0x52b6a2[_0x8fd2('0x1d')]['fields'],function(_0x2f959a){return _0xc60005[_0x8fd2('0x6a')](_0x2f959a[_0x8fd2('0x56')][_0x8fd2('0x29')]);});_['remove'](_0x52b6a2[_0x8fd2('0x1d')][_0x8fd2('0x45')],function(_0x33cdb7){return _0x33cdb7[_0x8fd2('0x6b')]==='false';});return{'count':_0x52b6a2['result'][_0x8fd2('0x45')]['length'],'rows':_['map'](_0x52b6a2[_0x8fd2('0x1d')]['fields'],function(_0x5d4b1e){return{'id':_0x5d4b1e[_0x8fd2('0x29')],'name':_0x5d4b1e[_0x8fd2('0x6c')],'custom':_[_0x8fd2('0x6d')](_0x5d4b1e[_0x8fd2('0x29')],_0x8fd2('0x6e'))?!![]:![],'options':_0x5d4b1e[_0x8fd2('0x56')][_0x8fd2('0x29')]==='picklist'&&_0x5d4b1e[_0x8fd2('0x56')][_0x8fd2('0x6f')][_0x8fd2('0x33')]>0x0?_[_0x8fd2('0x4e')](_0x5d4b1e['type'][_0x8fd2('0x6f')],function(_0x5086c4){return{'name':_0x5086c4['label'],'value':_0x5086c4[_0x8fd2('0x70')]};}):[]};})};}})[_0x8fd2('0x15')](respondWithResult(_0x34c59e,null))[_0x8fd2('0x1e')](function(_0x1f369e){console[_0x8fd2('0x71')](_0x8fd2('0x72')+_0x1f369e);var _0x27e71f=_0x2af76d[_0x8fd2('0x2e')]['test']?0x1f4:_0x1f369e['statusCode']||0x1f4;logger[_0x8fd2('0x1a')](_0x8fd2('0x73'),_0x8fd2('0x5a'),_0x27e71f,JSON[_0x8fd2('0x74')](_0x1f369e));delete _0x1f369e['name'];if(_0x27e71f===0x191){_0x27e71f=0x190;}_0x34c59e[_0x8fd2('0x21')](_0x27e71f)[_0x8fd2('0x75')](_0x2af76d['query'][_0x8fd2('0x76')]?{'message':_0x8fd2('0x77'),'statusCode':_0x1f369e['statusCode']}:_0x1f369e);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 4e019e5..9a30521 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 _0x3fe2=['request-promise','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0x3fe2,0x125));var _0x23fe=function(_0x2e0657,_0x9b9a99){_0x2e0657=_0x2e0657-0x0;var _0x2798f0=_0x3fe2[_0x2e0657];return _0x2798f0;};'use strict';var _=require(_0x23fe('0x0'));var util=require(_0x23fe('0x1'));var logger=require(_0x23fe('0x2'))(_0x23fe('0x3'));var moment=require(_0x23fe('0x4'));var BPromise=require(_0x23fe('0x5'));var rp=require(_0x23fe('0x6'));var attributes=require(_0x23fe('0x7'));var integrations=require(_0x23fe('0x8'));module[_0x23fe('0x9')]=function(_0x31d67f,_0x17b01d){return _0x31d67f[_0x23fe('0xa')](_0x23fe('0xb'),attributes,{'tableName':_0x23fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa14a=['util','../../config/logger','moment','request-promise','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xa14a,0x1a1));var _0xaa14=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa14a[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xaa14('0x0'));var util=require(_0xaa14('0x1'));var logger=require(_0xaa14('0x2'))('api');var moment=require(_0xaa14('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa14('0x4'));var attributes=require(_0xaa14('0x5'));var integrations=require(_0xaa14('0x6'));module[_0xaa14('0x7')]=function(_0x35fb5d,_0xa8eb80){return _0x35fb5d[_0xaa14('0x8')](_0xaa14('0x9'),attributes,{'tableName':_0xaa14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 267eb8f..023891b 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 _0x8e8c=['result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','map','model','include','then','debug','stringify','find','ShowVtigerAccount','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','VtigerAccount,\x20%s,\x20%s','message'];(function(_0x5572b3,_0x592d22){var _0x32cd80=function(_0x178460){while(--_0x178460){_0x5572b3['push'](_0x5572b3['shift']());}};_0x32cd80(++_0x592d22);}(_0x8e8c,0x143));var _0xc8e8=function(_0x53a11c,_0x393441){_0x53a11c=_0x53a11c-0x0;var _0x2680d5=_0x8e8c[_0x53a11c];return _0x2680d5;};'use strict';var _=require('lodash');var util=require(_0xc8e8('0x0'));var moment=require(_0xc8e8('0x1'));var BPromise=require('bluebird');var rs=require(_0xc8e8('0x2'));var fs=require('fs');var Redis=require(_0xc8e8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8e8('0x4'));var logger=require(_0xc8e8('0x5'))(_0xc8e8('0x6'));var config=require(_0xc8e8('0x7'));var jayson=require(_0xc8e8('0x8'));var client=jayson['client'][_0xc8e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x204d1a,_0x386460,_0x364861){return new BPromise(function(_0x55e674,_0x1d93e8){return client[_0xc8e8('0xa')](_0x204d1a,_0x364861)['then'](function(_0x5d29e6){logger[_0xc8e8('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x386460,_0xc8e8('0xc'));logger['debug'](_0xc8e8('0xd'),_0x386460,_0xc8e8('0xc'),JSON['stringify'](_0x5d29e6));if(_0x5d29e6[_0xc8e8('0xe')]){if(_0x5d29e6['error']['code']===0x1f4){logger[_0xc8e8('0xe')](_0xc8e8('0xf'),_0x386460,_0x5d29e6['error'][_0xc8e8('0x10')]);return _0x1d93e8(_0x5d29e6[_0xc8e8('0xe')][_0xc8e8('0x10')]);}logger[_0xc8e8('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x386460,_0x5d29e6['error']['message']);return _0x55e674(_0x5d29e6['error'][_0xc8e8('0x10')]);}else{logger[_0xc8e8('0xb')](_0xc8e8('0xf'),_0x386460,_0xc8e8('0xc'));_0x55e674(_0x5d29e6[_0xc8e8('0x11')][_0xc8e8('0x10')]);}})[_0xc8e8('0x12')](function(_0x6b76bf){logger[_0xc8e8('0xe')](_0xc8e8('0xf'),_0x386460,_0x6b76bf);_0x1d93e8(_0x6b76bf);});});}exports[_0xc8e8('0x13')]=function(_0x476828){var _0x206e4b=this;return new Promise(function(_0x463ca7,_0x1c368e){return db[_0xc8e8('0x14')][_0xc8e8('0x15')]({'raw':_0x476828[_0xc8e8('0x16')]?_0x476828[_0xc8e8('0x16')][_0xc8e8('0x17')]===undefined?!![]:![]:!![],'where':_0x476828[_0xc8e8('0x16')]?_0x476828[_0xc8e8('0x16')][_0xc8e8('0x18')]||null:null,'attributes':_0x476828[_0xc8e8('0x16')]?_0x476828[_0xc8e8('0x16')][_0xc8e8('0x19')]||null:null,'limit':_0x476828['options']?_0x476828[_0xc8e8('0x16')]['limit']||null:null,'include':_0x476828['options']?_0x476828[_0xc8e8('0x16')]['include']?_[_0xc8e8('0x1a')](_0x476828['options']['include'],function(_0x12759d){return{'model':db[_0x12759d[_0xc8e8('0x1b')]],'as':_0x12759d['as'],'attributes':_0x12759d['attributes'],'include':_0x12759d[_0xc8e8('0x1c')]?_['map'](_0x12759d['include'],function(_0x3bf236){return{'model':db[_0x3bf236[_0xc8e8('0x1b')]],'as':_0x3bf236['as'],'attributes':_0x3bf236['attributes'],'include':_0x3bf236[_0xc8e8('0x1c')]?_[_0xc8e8('0x1a')](_0x3bf236[_0xc8e8('0x1c')],function(_0x3cb531){return{'model':db[_0x3cb531['model']],'as':_0x3cb531['as'],'attributes':_0x3cb531[_0xc8e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc8e8('0x1d')](function(_0x32ee4b){logger[_0xc8e8('0xb')](_0xc8e8('0x13'),_0x476828);logger[_0xc8e8('0x1e')](_0xc8e8('0x13'),_0x476828,JSON[_0xc8e8('0x1f')](_0x32ee4b));_0x463ca7(_0x32ee4b);})[_0xc8e8('0x12')](function(_0x2e4e12){logger['error'](_0xc8e8('0x13'),_0x2e4e12[_0xc8e8('0x10')],_0x476828);_0x1c368e(_0x206e4b[_0xc8e8('0xe')](0x1f4,_0x2e4e12[_0xc8e8('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x54d75d){var _0x34045b=this;return new Promise(function(_0x2ec8b8,_0x35bbfc){return db[_0xc8e8('0x14')][_0xc8e8('0x20')]({'raw':_0x54d75d[_0xc8e8('0x16')]?_0x54d75d[_0xc8e8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x54d75d[_0xc8e8('0x16')]?_0x54d75d[_0xc8e8('0x16')][_0xc8e8('0x18')]||null:null,'attributes':_0x54d75d['options']?_0x54d75d[_0xc8e8('0x16')]['attributes']||null:null,'include':_0x54d75d[_0xc8e8('0x16')]?_0x54d75d['options'][_0xc8e8('0x1c')]?_[_0xc8e8('0x1a')](_0x54d75d[_0xc8e8('0x16')]['include'],function(_0x4b60ff){return{'model':db[_0x4b60ff['model']],'as':_0x4b60ff['as'],'attributes':_0x4b60ff[_0xc8e8('0x19')],'include':_0x4b60ff[_0xc8e8('0x1c')]?_[_0xc8e8('0x1a')](_0x4b60ff[_0xc8e8('0x1c')],function(_0x356421){return{'model':db[_0x356421[_0xc8e8('0x1b')]],'as':_0x356421['as'],'attributes':_0x356421[_0xc8e8('0x19')],'include':_0x356421['include']?_[_0xc8e8('0x1a')](_0x356421[_0xc8e8('0x1c')],function(_0x18ae2c){return{'model':db[_0x18ae2c['model']],'as':_0x18ae2c['as'],'attributes':_0x18ae2c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc8e8('0x1d')](function(_0x1aade1){logger[_0xc8e8('0xb')]('ShowVtigerAccount',_0x54d75d);logger['debug']('ShowVtigerAccount',_0x54d75d,JSON[_0xc8e8('0x1f')](_0x1aade1));_0x2ec8b8(_0x1aade1);})[_0xc8e8('0x12')](function(_0x3c37ec){logger['error'](_0xc8e8('0x21'),_0x3c37ec[_0xc8e8('0x10')],_0x54d75d);_0x35bbfc(_0x34045b[_0xc8e8('0xe')](0x1f4,_0x3c37ec['message']));});});}; \ No newline at end of file +var _0x77d5=['message','result','GetVtigerAccount','findAll','options','attributes','include','map','catch','ShowVtigerAccount','VtigerAccount','raw','where','model','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b70fb,_0x3bda6f){var _0x397fb3=function(_0x44395a){while(--_0x44395a){_0x5b70fb['push'](_0x5b70fb['shift']());}};_0x397fb3(++_0x3bda6f);}(_0x77d5,0x11e));var _0x577d=function(_0x3c6599,_0x503e7b){_0x3c6599=_0x3c6599-0x0;var _0x350f1c=_0x77d5[_0x3c6599];return _0x350f1c;};'use strict';var _=require(_0x577d('0x0'));var util=require(_0x577d('0x1'));var moment=require(_0x577d('0x2'));var BPromise=require(_0x577d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x577d('0x4'));var logger=require('../../config/logger')(_0x577d('0x5'));var config=require(_0x577d('0x6'));var jayson=require(_0x577d('0x7'));var client=jayson[_0x577d('0x8')][_0x577d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9628,_0x395976,_0x2ca412){return new BPromise(function(_0x52914c,_0x28ba59){return client[_0x577d('0xa')](_0x3b9628,_0x2ca412)[_0x577d('0xb')](function(_0x55b95f){logger[_0x577d('0xc')](_0x577d('0xd'),_0x395976,_0x577d('0xe'));logger[_0x577d('0xf')](_0x577d('0x10'),_0x395976,_0x577d('0xe'),JSON[_0x577d('0x11')](_0x55b95f));if(_0x55b95f['error']){if(_0x55b95f[_0x577d('0x12')][_0x577d('0x13')]===0x1f4){logger[_0x577d('0x12')](_0x577d('0xd'),_0x395976,_0x55b95f['error'][_0x577d('0x14')]);return _0x28ba59(_0x55b95f[_0x577d('0x12')]['message']);}logger[_0x577d('0x12')](_0x577d('0xd'),_0x395976,_0x55b95f[_0x577d('0x12')][_0x577d('0x14')]);return _0x52914c(_0x55b95f[_0x577d('0x12')][_0x577d('0x14')]);}else{logger['info'](_0x577d('0xd'),_0x395976,_0x577d('0xe'));_0x52914c(_0x55b95f[_0x577d('0x15')][_0x577d('0x14')]);}})['catch'](function(_0x58fd3d){logger[_0x577d('0x12')](_0x577d('0xd'),_0x395976,_0x58fd3d);_0x28ba59(_0x58fd3d);});});}exports[_0x577d('0x16')]=function(_0x366ba1){var _0x36857a=this;return new Promise(function(_0xa32488,_0x17bf57){return db['VtigerAccount'][_0x577d('0x17')]({'raw':_0x366ba1[_0x577d('0x18')]?_0x366ba1['options']['raw']===undefined?!![]:![]:!![],'where':_0x366ba1['options']?_0x366ba1[_0x577d('0x18')]['where']||null:null,'attributes':_0x366ba1[_0x577d('0x18')]?_0x366ba1['options'][_0x577d('0x19')]||null:null,'limit':_0x366ba1[_0x577d('0x18')]?_0x366ba1[_0x577d('0x18')]['limit']||null:null,'include':_0x366ba1['options']?_0x366ba1['options'][_0x577d('0x1a')]?_['map'](_0x366ba1[_0x577d('0x18')][_0x577d('0x1a')],function(_0x415e29){return{'model':db[_0x415e29['model']],'as':_0x415e29['as'],'attributes':_0x415e29[_0x577d('0x19')],'include':_0x415e29[_0x577d('0x1a')]?_[_0x577d('0x1b')](_0x415e29[_0x577d('0x1a')],function(_0x144b75){return{'model':db[_0x144b75['model']],'as':_0x144b75['as'],'attributes':_0x144b75[_0x577d('0x19')],'include':_0x144b75[_0x577d('0x1a')]?_['map'](_0x144b75['include'],function(_0x425e27){return{'model':db[_0x425e27['model']],'as':_0x425e27['as'],'attributes':_0x425e27[_0x577d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x577d('0xb')](function(_0x12ef25){logger[_0x577d('0xc')]('GetVtigerAccount',_0x366ba1);logger[_0x577d('0xf')]('GetVtigerAccount',_0x366ba1,JSON['stringify'](_0x12ef25));_0xa32488(_0x12ef25);})[_0x577d('0x1c')](function(_0xf5277e){logger['error'](_0x577d('0x16'),_0xf5277e['message'],_0x366ba1);_0x17bf57(_0x36857a['error'](0x1f4,_0xf5277e[_0x577d('0x14')]));});});};exports[_0x577d('0x1d')]=function(_0x500a97){var _0x95e25a=this;return new Promise(function(_0x19d271,_0x448476){return db[_0x577d('0x1e')]['find']({'raw':_0x500a97['options']?_0x500a97[_0x577d('0x18')][_0x577d('0x1f')]===undefined?!![]:![]:!![],'where':_0x500a97['options']?_0x500a97['options'][_0x577d('0x20')]||null:null,'attributes':_0x500a97['options']?_0x500a97['options']['attributes']||null:null,'include':_0x500a97[_0x577d('0x18')]?_0x500a97[_0x577d('0x18')][_0x577d('0x1a')]?_[_0x577d('0x1b')](_0x500a97['options'][_0x577d('0x1a')],function(_0x4bb3b0){return{'model':db[_0x4bb3b0[_0x577d('0x21')]],'as':_0x4bb3b0['as'],'attributes':_0x4bb3b0[_0x577d('0x19')],'include':_0x4bb3b0[_0x577d('0x1a')]?_['map'](_0x4bb3b0['include'],function(_0x5b7f27){return{'model':db[_0x5b7f27['model']],'as':_0x5b7f27['as'],'attributes':_0x5b7f27[_0x577d('0x19')],'include':_0x5b7f27[_0x577d('0x1a')]?_[_0x577d('0x1b')](_0x5b7f27['include'],function(_0x535e48){return{'model':db[_0x535e48['model']],'as':_0x535e48['as'],'attributes':_0x535e48[_0x577d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24a2b1){logger[_0x577d('0xc')](_0x577d('0x1d'),_0x500a97);logger[_0x577d('0xf')](_0x577d('0x1d'),_0x500a97,JSON[_0x577d('0x11')](_0x24a2b1));_0x19d271(_0x24a2b1);})['catch'](function(_0x466e66){logger[_0x577d('0x12')]('ShowVtigerAccount',_0x466e66['message'],_0x500a97);_0x448476(_0x95e25a[_0x577d('0x12')](0x1f4,_0x466e66[_0x577d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index f7dc54c..1e029dc 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file +var _0xb7e7=['create','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0xb7e7,0x121));var _0x7b7e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb7e7[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['getSubjects']);router[_0x7b7e('0x6')](_0x7b7e('0xc'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index fa65e41..7a91e9d 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 _0x673f=['sequelize','exports','STRING'];(function(_0x2c8310,_0xca370b){var _0x3d5238=function(_0x1feef1){while(--_0x1feef1){_0x2c8310['push'](_0x2c8310['shift']());}};_0x3d5238(++_0xca370b);}(_0x673f,0x7b));var _0xf673=function(_0x270c5c,_0x2ce83e){_0x270c5c=_0x270c5c-0x0;var _0x2b30e4=_0x673f[_0x270c5c];return _0x2b30e4;};'use strict';var Sequelize=require(_0xf673('0x0'));module[_0xf673('0x1')]={'name':{'type':Sequelize[_0xf673('0x2')]},'description':{'type':Sequelize[_0xf673('0x2')]}}; \ No newline at end of file +var _0x29d2=['sequelize','STRING'];(function(_0x2d4beb,_0xc4e79e){var _0x3b8020=function(_0x315c7e){while(--_0x315c7e){_0x2d4beb['push'](_0x2d4beb['shift']());}};_0x3b8020(++_0xc4e79e);}(_0x29d2,0xb2));var _0x229d=function(_0x3390c4,_0x4a23ca){_0x3390c4=_0x3390c4-0x0;var _0x214582=_0x29d2[_0x3390c4];return _0x214582;};'use strict';var Sequelize=require(_0x229d('0x0'));module['exports']={'name':{'type':Sequelize[_0x229d('0x1')]},'description':{'type':Sequelize[_0x229d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 1015375..aa549ce 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 _0x8ca7=['options','includeAll','include','findAll','show','params','find','create','body','findOne','VtigerField','sort','getFields','order','getSubjects','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','ejs','lodash','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','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','VtigerConfiguration','rawAttributes','model','dateStart','query','dateEnd','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','add','day','merge','filter','map'];(function(_0x545390,_0x5a8b85){var _0x4eca8a=function(_0x1ad17b){while(--_0x1ad17b){_0x545390['push'](_0x545390['shift']());}};_0x4eca8a(++_0x5a8b85);}(_0x8ca7,0x67));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x78ca('0x0'));var emlformat=require(_0x78ca('0x1'));var rimraf=require(_0x78ca('0x2'));var zipdir=require(_0x78ca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x78ca('0x4'));var BPromise=require(_0x78ca('0x5'));var Mustache=require(_0x78ca('0x6'));var util=require('util');var path=require('path');var sox=require(_0x78ca('0x7'));var csv=require('to-csv');var ejs=require(_0x78ca('0x8'));var fs=require('fs');var _=require(_0x78ca('0x9'));var squel=require(_0x78ca('0xa'));var crypto=require(_0x78ca('0xb'));var jsforce=require(_0x78ca('0xc'));var deskjs=require(_0x78ca('0xd'));var toCsv=require(_0x78ca('0xe'));var querystring=require(_0x78ca('0xf'));var Papa=require(_0x78ca('0x10'));var Redis=require(_0x78ca('0x11'));var qs=require(_0x78ca('0x12'));var logger=require(_0x78ca('0x13'))(_0x78ca('0x14'));var utils=require(_0x78ca('0x15'));var config=require(_0x78ca('0x16'));var db=require(_0x78ca('0x17'))['db'];var jayson=require(_0x78ca('0x18'));var client=jayson[_0x78ca('0x19')][_0x78ca('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x177eb0,_0x5b77bc,_0x575bd5,_0x1da82f){return new BPromise(function(_0x1d067b,_0xec0cf){var _0x5075a3=_0x1da82f||client;return _0x5075a3[_0x78ca('0x1b')](_0x177eb0,_0x575bd5)[_0x78ca('0x1c')](function(_0x1ae142){logger[_0x78ca('0x1d')](_0x78ca('0x1e'),_0x5b77bc,_0x78ca('0x1f'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x5b77bc,'request\x20sent',JSON['stringify'](_0x1ae142));if(_0x1ae142[_0x78ca('0x20')]){if(_0x1ae142[_0x78ca('0x20')]['code']===0x1f4){logger['error'](_0x78ca('0x1e'),_0x5b77bc,_0x1ae142[_0x78ca('0x20')]['message']);return _0xec0cf(_0x1ae142[_0x78ca('0x20')][_0x78ca('0x21')]);}logger[_0x78ca('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x5b77bc,_0x1ae142[_0x78ca('0x20')][_0x78ca('0x21')]);return _0x1d067b(_0x1ae142[_0x78ca('0x20')][_0x78ca('0x21')]);}else{logger[_0x78ca('0x1d')]('VtigerConfiguration,\x20%s,\x20%s',_0x5b77bc,_0x78ca('0x1f'));_0x1d067b(_0x1ae142[_0x78ca('0x22')][_0x78ca('0x21')]);}})[_0x78ca('0x23')](function(_0x342688){logger['error'](_0x78ca('0x1e'),_0x5b77bc,_0x342688);_0xec0cf(_0x342688);});});}function respondWithStatusCode(_0x5b1f9c,_0xe7e10e){_0xe7e10e=_0xe7e10e||0xcc;return function(_0x297785){if(_0x297785){return _0x5b1f9c[_0x78ca('0x24')](_0xe7e10e);}return _0x5b1f9c['status'](_0xe7e10e)[_0x78ca('0x25')]();};}function respondWithResult(_0x30255c,_0x2bd20e){_0x2bd20e=_0x2bd20e||0xc8;return function(_0x49c272){if(_0x49c272){return _0x30255c[_0x78ca('0x26')](_0x2bd20e)[_0x78ca('0x27')](_0x49c272);}};}function respondWithFilteredResult(_0x41cbf2,_0xf91276){return function(_0x565e02){if(_0x565e02){var _0x4159cf=_0x565e02[_0x78ca('0x28')],_0x330628=_0xf91276[_0x78ca('0x29')],_0x45c372=_0xf91276[_0x78ca('0x29')]+_0xf91276[_0x78ca('0x2a')],_0x1d29c7;if(_0x45c372>=_0x4159cf){_0x45c372=_0x4159cf;_0x1d29c7=0xc8;}else{_0x1d29c7=0xce;}_0x41cbf2[_0x78ca('0x26')](_0x1d29c7);return _0x41cbf2[_0x78ca('0x2b')](_0x78ca('0x2c'),_0x330628+'-'+_0x45c372+'/'+_0x4159cf)[_0x78ca('0x27')](_0x565e02);}return null;};}function patchUpdates(_0x2e5924){return function(_0x1c6151){try{jsonpatch[_0x78ca('0x2d')](_0x1c6151,_0x2e5924,!![]);}catch(_0x2a8abc){return BPromise[_0x78ca('0x2e')](_0x2a8abc);}return _0x1c6151[_0x78ca('0x2f')]();};}function saveUpdates(_0x9a8f2a,_0x4fb71f){return function(_0x23d67b){if(_0x23d67b){return _0x23d67b[_0x78ca('0x30')](_0x9a8f2a)[_0x78ca('0x1c')](function(_0x1605fd){return _0x1605fd;});}return null;};}function removeEntity(_0x3c24de,_0x1ab322){return function(_0x59a8a0){if(_0x59a8a0){return _0x59a8a0[_0x78ca('0x31')]()[_0x78ca('0x1c')](function(){_0x3c24de[_0x78ca('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41aeb5,_0x254e20){return function(_0x1628e2){if(!_0x1628e2){_0x41aeb5[_0x78ca('0x24')](0x194);}return _0x1628e2;};}function handleError(_0x2fd427,_0x227281){_0x227281=_0x227281||0x1f4;return function(_0x92e355){logger['error'](_0x92e355[_0x78ca('0x32')]);if(_0x92e355[_0x78ca('0x33')]){delete _0x92e355[_0x78ca('0x33')];}_0x2fd427[_0x78ca('0x26')](_0x227281)['send'](_0x92e355);};}exports['index']=function(_0x1955a4,_0x235bcd){var _0x318216={},_0x154ac7={},_0x1eab4e={'count':0x0,'rows':[]};var _0x447eec=db[_0x78ca('0x34')][_0x78ca('0x35')];_0x154ac7[_0x78ca('0x36')]=_['keys'](_0x447eec);var _0x1a136b={'dateStart':_0x1955a4['query'][_0x78ca('0x37')],'dateEnd':_0x1955a4[_0x78ca('0x38')][_0x78ca('0x39')]};delete _0x1955a4[_0x78ca('0x38')][_0x78ca('0x37')];delete _0x1955a4[_0x78ca('0x38')][_0x78ca('0x39')];_0x154ac7['query']=_[_0x78ca('0x3a')](_0x1955a4[_0x78ca('0x38')]);_0x154ac7[_0x78ca('0x3b')]=_['intersection'](_0x154ac7[_0x78ca('0x36')],_0x154ac7['query']);_0x318216[_0x78ca('0x3c')]=_[_0x78ca('0x3d')](_0x154ac7[_0x78ca('0x36')],qs['fields'](_0x1955a4[_0x78ca('0x38')][_0x78ca('0x3e')]));_0x318216[_0x78ca('0x3c')]=_0x318216[_0x78ca('0x3c')][_0x78ca('0x3f')]?_0x318216[_0x78ca('0x3c')]:_0x154ac7[_0x78ca('0x36')];if(!_0x1955a4['query'][_0x78ca('0x40')](_0x78ca('0x41'))){_0x318216[_0x78ca('0x2a')]=qs[_0x78ca('0x2a')](_0x1955a4[_0x78ca('0x38')][_0x78ca('0x2a')]);_0x318216['offset']=qs[_0x78ca('0x29')](_0x1955a4['query'][_0x78ca('0x29')]);}_0x318216['order']=qs['sort'](_0x1955a4['query']['sort']);_0x318216[_0x78ca('0x42')]=qs[_0x78ca('0x3b')](_[_0x78ca('0x43')](_0x1955a4[_0x78ca('0x38')],_0x154ac7[_0x78ca('0x3b')]));if(_0x1a136b[_0x78ca('0x37')]){if(_0x1a136b[_0x78ca('0x39')]){_0x1a136b[_0x78ca('0x39')]=moment(_0x1a136b[_0x78ca('0x39')])[_0x78ca('0x44')](0x1,_0x78ca('0x45'));}else{_0x1a136b[_0x78ca('0x39')]=moment(_0x1a136b[_0x78ca('0x37')])[_0x78ca('0x44')](0x1,_0x78ca('0x45'));}_[_0x78ca('0x46')](_0x318216['where'],{'createdAt':{'$gte':_0x1a136b[_0x78ca('0x37')],'$lte':_0x1a136b[_0x78ca('0x39')]}});}if(_0x1955a4[_0x78ca('0x38')][_0x78ca('0x47')]){_0x318216[_0x78ca('0x42')]=_[_0x78ca('0x46')](_0x318216[_0x78ca('0x42')],{'$or':_[_0x78ca('0x48')](_0x318216[_0x78ca('0x3c')],function(_0x1f657c){var _0x26ef4e={};_0x26ef4e[_0x1f657c]={'$like':'%'+_0x1955a4['query'][_0x78ca('0x47')]+'%'};return _0x26ef4e;})});}_0x318216=_[_0x78ca('0x46')]({},_0x318216,_0x1955a4[_0x78ca('0x49')]);var _0x5646bc={'where':_0x318216['where']};return db[_0x78ca('0x34')][_0x78ca('0x28')](_0x5646bc)[_0x78ca('0x1c')](function(_0x2ab58f){_0x1eab4e[_0x78ca('0x28')]=_0x2ab58f;if(_0x1955a4['query'][_0x78ca('0x4a')]){_0x318216[_0x78ca('0x4b')]=[{'all':!![]}];}return db[_0x78ca('0x34')][_0x78ca('0x4c')](_0x318216);})[_0x78ca('0x1c')](function(_0x3f07fa){_0x1eab4e['rows']=_0x3f07fa;return _0x1eab4e;})[_0x78ca('0x1c')](respondWithFilteredResult(_0x235bcd,_0x318216))[_0x78ca('0x23')](handleError(_0x235bcd,null));};exports[_0x78ca('0x4d')]=function(_0x3f67a1,_0x516d36){var _0x57ec46={'raw':![],'where':{'id':_0x3f67a1[_0x78ca('0x4e')]['id']}},_0x2002d9={};_0x2002d9['model']=_[_0x78ca('0x3a')](db['VtigerConfiguration']['rawAttributes']);_0x2002d9['query']=_['keys'](_0x3f67a1['query']);_0x2002d9[_0x78ca('0x3b')]=_[_0x78ca('0x3d')](_0x2002d9['model'],_0x2002d9[_0x78ca('0x38')]);_0x57ec46[_0x78ca('0x3c')]=_['intersection'](_0x2002d9[_0x78ca('0x36')],qs[_0x78ca('0x3e')](_0x3f67a1[_0x78ca('0x38')][_0x78ca('0x3e')]));_0x57ec46[_0x78ca('0x3c')]=_0x57ec46[_0x78ca('0x3c')][_0x78ca('0x3f')]?_0x57ec46[_0x78ca('0x3c')]:_0x2002d9[_0x78ca('0x36')];if(_0x3f67a1[_0x78ca('0x38')][_0x78ca('0x4a')]){_0x57ec46[_0x78ca('0x4b')]=[{'all':!![]}];}_0x57ec46=_[_0x78ca('0x46')]({},_0x57ec46,_0x3f67a1[_0x78ca('0x49')]);return db[_0x78ca('0x34')][_0x78ca('0x4f')](_0x57ec46)[_0x78ca('0x1c')](handleEntityNotFound(_0x516d36,null))[_0x78ca('0x1c')](respondWithResult(_0x516d36,null))[_0x78ca('0x23')](handleError(_0x516d36,null));};exports['create']=function(_0x555aa0,_0x3a2768){return db[_0x78ca('0x34')][_0x78ca('0x50')](_0x555aa0['body'],{})[_0x78ca('0x1c')](respondWithResult(_0x3a2768,0xc9))[_0x78ca('0x23')](handleError(_0x3a2768,null));};exports[_0x78ca('0x30')]=function(_0x4e72e5,_0x5a18fc){if(_0x4e72e5['body']['id']){delete _0x4e72e5[_0x78ca('0x51')]['id'];}return db[_0x78ca('0x34')][_0x78ca('0x4f')]({'where':{'id':_0x4e72e5['params']['id']}})['then'](handleEntityNotFound(_0x5a18fc,null))[_0x78ca('0x1c')](saveUpdates(_0x4e72e5[_0x78ca('0x51')],null))[_0x78ca('0x1c')](respondWithResult(_0x5a18fc,null))[_0x78ca('0x23')](handleError(_0x5a18fc,null));};exports[_0x78ca('0x31')]=function(_0x21687f,_0x584f9a){return db[_0x78ca('0x34')][_0x78ca('0x4f')]({'where':{'id':_0x21687f[_0x78ca('0x4e')]['id']}})[_0x78ca('0x1c')](handleEntityNotFound(_0x584f9a,null))[_0x78ca('0x1c')](removeEntity(_0x584f9a,null))[_0x78ca('0x23')](handleError(_0x584f9a,null));};exports['getFields']=function(_0x98e31f,_0x2a608b,_0x3a6b46){var _0x2c3cc5={};var _0x4146be={};var _0x43e6ff;var _0x44fb10;return db[_0x78ca('0x34')][_0x78ca('0x52')]({'where':{'id':_0x98e31f[_0x78ca('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2a608b,null))[_0x78ca('0x1c')](function(_0x53b304){if(_0x53b304){_0x43e6ff=_0x53b304;_0x4146be[_0x78ca('0x36')]=_[_0x78ca('0x3a')](db[_0x78ca('0x53')]['rawAttributes']);_0x4146be[_0x78ca('0x38')]=_[_0x78ca('0x3a')](_0x98e31f[_0x78ca('0x38')]);_0x4146be[_0x78ca('0x3b')]=_[_0x78ca('0x3d')](_0x4146be['model'],_0x4146be[_0x78ca('0x38')]);_0x2c3cc5[_0x78ca('0x3c')]=_['intersection'](_0x4146be[_0x78ca('0x36')],qs[_0x78ca('0x3e')](_0x98e31f[_0x78ca('0x38')][_0x78ca('0x3e')]));_0x2c3cc5[_0x78ca('0x3c')]=_0x2c3cc5['attributes'][_0x78ca('0x3f')]?_0x2c3cc5['attributes']:_0x4146be[_0x78ca('0x36')];_0x2c3cc5['order']=qs[_0x78ca('0x54')](_0x98e31f['query'][_0x78ca('0x54')]);_0x2c3cc5[_0x78ca('0x42')]=qs[_0x78ca('0x3b')](_[_0x78ca('0x43')](_0x98e31f[_0x78ca('0x38')],_0x4146be[_0x78ca('0x3b')]));if(_0x98e31f[_0x78ca('0x38')][_0x78ca('0x47')]){_0x2c3cc5[_0x78ca('0x42')]=_[_0x78ca('0x46')](_0x2c3cc5[_0x78ca('0x42')],{'$or':_[_0x78ca('0x48')](_0x2c3cc5[_0x78ca('0x3c')],function(_0x1ffdf4){var _0x55e461={};_0x55e461[_0x1ffdf4]={'$like':'%'+_0x98e31f[_0x78ca('0x38')]['filter']+'%'};return _0x55e461;})});}_0x2c3cc5=_[_0x78ca('0x46')]({},_0x2c3cc5,_0x98e31f[_0x78ca('0x49')]);return _0x43e6ff[_0x78ca('0x55')](_0x2c3cc5);}})[_0x78ca('0x1c')](function(_0x2521ab){if(_0x2521ab){_0x44fb10=_0x2521ab['length'];if(!_0x98e31f[_0x78ca('0x38')][_0x78ca('0x40')](_0x78ca('0x41'))){_0x2c3cc5['limit']=qs[_0x78ca('0x2a')](_0x98e31f['query'][_0x78ca('0x2a')]);_0x2c3cc5[_0x78ca('0x29')]=qs[_0x78ca('0x29')](_0x98e31f[_0x78ca('0x38')][_0x78ca('0x29')]);}return _0x43e6ff[_0x78ca('0x55')](_0x2c3cc5);}})[_0x78ca('0x1c')](function(_0x36bc69){if(_0x36bc69){return _0x36bc69?{'count':_0x44fb10,'rows':_0x36bc69}:null;}})['then'](respondWithResult(_0x2a608b,null))[_0x78ca('0x23')](handleError(_0x2a608b,null));};exports['getSubjects']=function(_0x47c56e,_0x1f3fe1,_0x295715){var _0x242887={};var _0x404eae={};var _0x379e42;var _0x2d9cb4;return db[_0x78ca('0x34')][_0x78ca('0x52')]({'where':{'id':_0x47c56e['params']['id']}})['then'](handleEntityNotFound(_0x1f3fe1,null))[_0x78ca('0x1c')](function(_0x4b2960){if(_0x4b2960){_0x379e42=_0x4b2960;_0x404eae['model']=_['keys'](db[_0x78ca('0x53')][_0x78ca('0x35')]);_0x404eae[_0x78ca('0x38')]=_[_0x78ca('0x3a')](_0x47c56e[_0x78ca('0x38')]);_0x404eae[_0x78ca('0x3b')]=_['intersection'](_0x404eae[_0x78ca('0x36')],_0x404eae[_0x78ca('0x38')]);_0x242887[_0x78ca('0x3c')]=_['intersection'](_0x404eae[_0x78ca('0x36')],qs[_0x78ca('0x3e')](_0x47c56e[_0x78ca('0x38')][_0x78ca('0x3e')]));_0x242887[_0x78ca('0x3c')]=_0x242887[_0x78ca('0x3c')]['length']?_0x242887[_0x78ca('0x3c')]:_0x404eae['model'];_0x242887[_0x78ca('0x56')]=qs['sort'](_0x47c56e['query'][_0x78ca('0x54')]);_0x242887[_0x78ca('0x42')]=qs[_0x78ca('0x3b')](_[_0x78ca('0x43')](_0x47c56e['query'],_0x404eae['filters']));if(_0x47c56e['query'][_0x78ca('0x47')]){_0x242887['where']=_[_0x78ca('0x46')](_0x242887[_0x78ca('0x42')],{'$or':_[_0x78ca('0x48')](_0x242887[_0x78ca('0x3c')],function(_0x29c28f){var _0x150e91={};_0x150e91[_0x29c28f]={'$like':'%'+_0x47c56e['query'][_0x78ca('0x47')]+'%'};return _0x150e91;})});}_0x242887=_['merge']({},_0x242887,_0x47c56e[_0x78ca('0x49')]);return _0x379e42[_0x78ca('0x57')](_0x242887);}})['then'](function(_0x1493ac){if(_0x1493ac){_0x2d9cb4=_0x1493ac['length'];if(!_0x47c56e[_0x78ca('0x38')][_0x78ca('0x40')]('nolimit')){_0x242887['limit']=qs['limit'](_0x47c56e['query'][_0x78ca('0x2a')]);_0x242887[_0x78ca('0x29')]=qs[_0x78ca('0x29')](_0x47c56e['query'][_0x78ca('0x29')]);}return _0x379e42[_0x78ca('0x57')](_0x242887);}})['then'](function(_0x6fd0aa){if(_0x6fd0aa){return _0x6fd0aa?{'count':_0x2d9cb4,'rows':_0x6fd0aa}:null;}})[_0x78ca('0x1c')](respondWithResult(_0x1f3fe1,null))[_0x78ca('0x23')](handleError(_0x1f3fe1,null));};exports['getDescriptions']=function(_0x1a2b9f,_0x545915,_0x5e6293){var _0x2b612c={};var _0x2f8a77={};var _0x4bc523;var _0x477320;return db[_0x78ca('0x34')]['findOne']({'where':{'id':_0x1a2b9f[_0x78ca('0x4e')]['id']}})[_0x78ca('0x1c')](handleEntityNotFound(_0x545915,null))[_0x78ca('0x1c')](function(_0x3cc32c){if(_0x3cc32c){_0x4bc523=_0x3cc32c;_0x2f8a77[_0x78ca('0x36')]=_['keys'](db['VtigerField']['rawAttributes']);_0x2f8a77[_0x78ca('0x38')]=_[_0x78ca('0x3a')](_0x1a2b9f[_0x78ca('0x38')]);_0x2f8a77['filters']=_['intersection'](_0x2f8a77[_0x78ca('0x36')],_0x2f8a77['query']);_0x2b612c[_0x78ca('0x3c')]=_[_0x78ca('0x3d')](_0x2f8a77[_0x78ca('0x36')],qs['fields'](_0x1a2b9f['query']['fields']));_0x2b612c[_0x78ca('0x3c')]=_0x2b612c[_0x78ca('0x3c')]['length']?_0x2b612c[_0x78ca('0x3c')]:_0x2f8a77[_0x78ca('0x36')];_0x2b612c[_0x78ca('0x56')]=qs[_0x78ca('0x54')](_0x1a2b9f['query'][_0x78ca('0x54')]);_0x2b612c[_0x78ca('0x42')]=qs[_0x78ca('0x3b')](_[_0x78ca('0x43')](_0x1a2b9f['query'],_0x2f8a77[_0x78ca('0x3b')]));if(_0x1a2b9f[_0x78ca('0x38')][_0x78ca('0x47')]){_0x2b612c['where']=_[_0x78ca('0x46')](_0x2b612c[_0x78ca('0x42')],{'$or':_['map'](_0x2b612c['attributes'],function(_0x20444d){var _0x46c881={};_0x46c881[_0x20444d]={'$like':'%'+_0x1a2b9f[_0x78ca('0x38')][_0x78ca('0x47')]+'%'};return _0x46c881;})});}_0x2b612c=_['merge']({},_0x2b612c,_0x1a2b9f[_0x78ca('0x49')]);return _0x4bc523['getDescriptions'](_0x2b612c);}})['then'](function(_0x1294bf){if(_0x1294bf){_0x477320=_0x1294bf[_0x78ca('0x3f')];if(!_0x1a2b9f['query'][_0x78ca('0x40')](_0x78ca('0x41'))){_0x2b612c[_0x78ca('0x2a')]=qs[_0x78ca('0x2a')](_0x1a2b9f['query'][_0x78ca('0x2a')]);_0x2b612c[_0x78ca('0x29')]=qs[_0x78ca('0x29')](_0x1a2b9f[_0x78ca('0x38')]['offset']);}return _0x4bc523['getDescriptions'](_0x2b612c);}})[_0x78ca('0x1c')](function(_0x420050){if(_0x420050){return _0x420050?{'count':_0x477320,'rows':_0x420050}:null;}})[_0x78ca('0x1c')](respondWithResult(_0x545915,null))['catch'](handleError(_0x545915,null));}; \ No newline at end of file +var _0xa084=['filters','model','intersection','fields','attributes','length','nolimit','order','sort','pick','day','add','merge','where','filter','map','options','includeAll','include','rows','params','find','create','body','destroy','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','stack','name','send','index','VtigerConfiguration','rawAttributes','keys','query','dateStart','dateEnd'];(function(_0x34fe8d,_0x398741){var _0x163766=function(_0xe5c66d){while(--_0xe5c66d){_0x34fe8d['push'](_0x34fe8d['shift']());}};_0x163766(++_0x398741);}(_0xa084,0x74));var _0x4a08=function(_0x4ff76e,_0x3eac87){_0x4ff76e=_0x4ff76e-0x0;var _0x3bbff5=_0xa084[_0x4ff76e];return _0x3bbff5;};'use strict';var pdf=require(_0x4a08('0x0'));var emlformat=require(_0x4a08('0x1'));var rimraf=require(_0x4a08('0x2'));var zipdir=require(_0x4a08('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a08('0x4'));var moment=require(_0x4a08('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4a08('0x6'));var util=require('util');var path=require(_0x4a08('0x7'));var sox=require(_0x4a08('0x8'));var csv=require(_0x4a08('0x9'));var ejs=require(_0x4a08('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4a08('0xb'));var crypto=require('crypto');var jsforce=require(_0x4a08('0xc'));var deskjs=require(_0x4a08('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4a08('0xe'));var Papa=require('papaparse');var Redis=require(_0x4a08('0xf'));var qs=require(_0x4a08('0x10'));var logger=require(_0x4a08('0x11'))(_0x4a08('0x12'));var utils=require(_0x4a08('0x13'));var config=require(_0x4a08('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x4a08('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1496d8,_0x2a202e,_0x378577,_0x227533){return new BPromise(function(_0x390282,_0x450932){var _0x2409fe=_0x227533||client;return _0x2409fe[_0x4a08('0x16')](_0x1496d8,_0x378577)[_0x4a08('0x17')](function(_0x3ad2c7){logger[_0x4a08('0x18')](_0x4a08('0x19'),_0x2a202e,_0x4a08('0x1a'));logger[_0x4a08('0x1b')](_0x4a08('0x1c'),_0x2a202e,'request\x20sent',JSON['stringify'](_0x3ad2c7));if(_0x3ad2c7['error']){if(_0x3ad2c7[_0x4a08('0x1d')][_0x4a08('0x1e')]===0x1f4){logger['error'](_0x4a08('0x19'),_0x2a202e,_0x3ad2c7[_0x4a08('0x1d')]['message']);return _0x450932(_0x3ad2c7[_0x4a08('0x1d')][_0x4a08('0x1f')]);}logger[_0x4a08('0x1d')]('VtigerConfiguration,\x20%s,\x20%s',_0x2a202e,_0x3ad2c7[_0x4a08('0x1d')][_0x4a08('0x1f')]);return _0x390282(_0x3ad2c7[_0x4a08('0x1d')]['message']);}else{logger[_0x4a08('0x18')](_0x4a08('0x19'),_0x2a202e,_0x4a08('0x1a'));_0x390282(_0x3ad2c7[_0x4a08('0x20')][_0x4a08('0x1f')]);}})[_0x4a08('0x21')](function(_0x151be9){logger[_0x4a08('0x1d')](_0x4a08('0x19'),_0x2a202e,_0x151be9);_0x450932(_0x151be9);});});}function respondWithStatusCode(_0x462631,_0x4479e2){_0x4479e2=_0x4479e2||0xcc;return function(_0x10a322){if(_0x10a322){return _0x462631[_0x4a08('0x22')](_0x4479e2);}return _0x462631[_0x4a08('0x23')](_0x4479e2)[_0x4a08('0x24')]();};}function respondWithResult(_0x4e3520,_0x418442){_0x418442=_0x418442||0xc8;return function(_0x408113){if(_0x408113){return _0x4e3520[_0x4a08('0x23')](_0x418442)[_0x4a08('0x25')](_0x408113);}};}function respondWithFilteredResult(_0x199d32,_0x48d6cd){return function(_0x2c241a){if(_0x2c241a){var _0x5ea3e9=_0x2c241a[_0x4a08('0x26')],_0x36fcd6=_0x48d6cd[_0x4a08('0x27')],_0x58eb46=_0x48d6cd['offset']+_0x48d6cd[_0x4a08('0x28')],_0x5189f8;if(_0x58eb46>=_0x5ea3e9){_0x58eb46=_0x5ea3e9;_0x5189f8=0xc8;}else{_0x5189f8=0xce;}_0x199d32['status'](_0x5189f8);return _0x199d32['set'](_0x4a08('0x29'),_0x36fcd6+'-'+_0x58eb46+'/'+_0x5ea3e9)['json'](_0x2c241a);}return null;};}function patchUpdates(_0x12eeb7){return function(_0x5403da){try{jsonpatch['apply'](_0x5403da,_0x12eeb7,!![]);}catch(_0x1a435a){return BPromise[_0x4a08('0x2a')](_0x1a435a);}return _0x5403da['save']();};}function saveUpdates(_0x1bc36e,_0x564767){return function(_0x1bfd6c){if(_0x1bfd6c){return _0x1bfd6c[_0x4a08('0x2b')](_0x1bc36e)[_0x4a08('0x17')](function(_0xd60f4c){return _0xd60f4c;});}return null;};}function removeEntity(_0x4711c1,_0x3579f4){return function(_0x5ba4ac){if(_0x5ba4ac){return _0x5ba4ac['destroy']()[_0x4a08('0x17')](function(){_0x4711c1['status'](0xcc)[_0x4a08('0x24')]();});}};}function handleEntityNotFound(_0x2733d0,_0x271cf2){return function(_0x3df2ef){if(!_0x3df2ef){_0x2733d0[_0x4a08('0x22')](0x194);}return _0x3df2ef;};}function handleError(_0x5aeef6,_0x3a1ad4){_0x3a1ad4=_0x3a1ad4||0x1f4;return function(_0x5cbef4){logger['error'](_0x5cbef4[_0x4a08('0x2c')]);if(_0x5cbef4[_0x4a08('0x2d')]){delete _0x5cbef4[_0x4a08('0x2d')];}_0x5aeef6['status'](_0x3a1ad4)[_0x4a08('0x2e')](_0x5cbef4);};}exports[_0x4a08('0x2f')]=function(_0x49024f,_0x302140){var _0x2f50af={},_0x2ddb2a={},_0xb22268={'count':0x0,'rows':[]};var _0x3c08da=db[_0x4a08('0x30')][_0x4a08('0x31')];_0x2ddb2a['model']=_[_0x4a08('0x32')](_0x3c08da);var _0x501858={'dateStart':_0x49024f[_0x4a08('0x33')][_0x4a08('0x34')],'dateEnd':_0x49024f['query'][_0x4a08('0x35')]};delete _0x49024f[_0x4a08('0x33')][_0x4a08('0x34')];delete _0x49024f[_0x4a08('0x33')][_0x4a08('0x35')];_0x2ddb2a[_0x4a08('0x33')]=_[_0x4a08('0x32')](_0x49024f[_0x4a08('0x33')]);_0x2ddb2a[_0x4a08('0x36')]=_['intersection'](_0x2ddb2a[_0x4a08('0x37')],_0x2ddb2a['query']);_0x2f50af['attributes']=_[_0x4a08('0x38')](_0x2ddb2a[_0x4a08('0x37')],qs[_0x4a08('0x39')](_0x49024f['query'][_0x4a08('0x39')]));_0x2f50af[_0x4a08('0x3a')]=_0x2f50af[_0x4a08('0x3a')][_0x4a08('0x3b')]?_0x2f50af['attributes']:_0x2ddb2a['model'];if(!_0x49024f[_0x4a08('0x33')]['hasOwnProperty'](_0x4a08('0x3c'))){_0x2f50af[_0x4a08('0x28')]=qs['limit'](_0x49024f['query'][_0x4a08('0x28')]);_0x2f50af['offset']=qs[_0x4a08('0x27')](_0x49024f['query'][_0x4a08('0x27')]);}_0x2f50af[_0x4a08('0x3d')]=qs[_0x4a08('0x3e')](_0x49024f[_0x4a08('0x33')][_0x4a08('0x3e')]);_0x2f50af['where']=qs[_0x4a08('0x36')](_[_0x4a08('0x3f')](_0x49024f[_0x4a08('0x33')],_0x2ddb2a[_0x4a08('0x36')]));if(_0x501858[_0x4a08('0x34')]){if(_0x501858[_0x4a08('0x35')]){_0x501858[_0x4a08('0x35')]=moment(_0x501858[_0x4a08('0x35')])['add'](0x1,_0x4a08('0x40'));}else{_0x501858[_0x4a08('0x35')]=moment(_0x501858[_0x4a08('0x34')])[_0x4a08('0x41')](0x1,'day');}_[_0x4a08('0x42')](_0x2f50af[_0x4a08('0x43')],{'createdAt':{'$gte':_0x501858[_0x4a08('0x34')],'$lte':_0x501858[_0x4a08('0x35')]}});}if(_0x49024f['query'][_0x4a08('0x44')]){_0x2f50af[_0x4a08('0x43')]=_[_0x4a08('0x42')](_0x2f50af['where'],{'$or':_[_0x4a08('0x45')](_0x2f50af[_0x4a08('0x3a')],function(_0x33d4d3){var _0x4e379c={};_0x4e379c[_0x33d4d3]={'$like':'%'+_0x49024f[_0x4a08('0x33')]['filter']+'%'};return _0x4e379c;})});}_0x2f50af=_[_0x4a08('0x42')]({},_0x2f50af,_0x49024f[_0x4a08('0x46')]);var _0x2d270d={'where':_0x2f50af['where']};return db[_0x4a08('0x30')][_0x4a08('0x26')](_0x2d270d)[_0x4a08('0x17')](function(_0x48f226){_0xb22268[_0x4a08('0x26')]=_0x48f226;if(_0x49024f[_0x4a08('0x33')][_0x4a08('0x47')]){_0x2f50af[_0x4a08('0x48')]=[{'all':!![]}];}return db[_0x4a08('0x30')]['findAll'](_0x2f50af);})[_0x4a08('0x17')](function(_0x4b3c4d){_0xb22268[_0x4a08('0x49')]=_0x4b3c4d;return _0xb22268;})[_0x4a08('0x17')](respondWithFilteredResult(_0x302140,_0x2f50af))[_0x4a08('0x21')](handleError(_0x302140,null));};exports['show']=function(_0x3e3ec9,_0x4fc7d0){var _0x2838c4={'raw':![],'where':{'id':_0x3e3ec9[_0x4a08('0x4a')]['id']}},_0x485090={};_0x485090[_0x4a08('0x37')]=_[_0x4a08('0x32')](db['VtigerConfiguration'][_0x4a08('0x31')]);_0x485090[_0x4a08('0x33')]=_[_0x4a08('0x32')](_0x3e3ec9['query']);_0x485090[_0x4a08('0x36')]=_['intersection'](_0x485090['model'],_0x485090[_0x4a08('0x33')]);_0x2838c4[_0x4a08('0x3a')]=_[_0x4a08('0x38')](_0x485090[_0x4a08('0x37')],qs[_0x4a08('0x39')](_0x3e3ec9[_0x4a08('0x33')][_0x4a08('0x39')]));_0x2838c4[_0x4a08('0x3a')]=_0x2838c4[_0x4a08('0x3a')]['length']?_0x2838c4['attributes']:_0x485090['model'];if(_0x3e3ec9[_0x4a08('0x33')][_0x4a08('0x47')]){_0x2838c4[_0x4a08('0x48')]=[{'all':!![]}];}_0x2838c4=_[_0x4a08('0x42')]({},_0x2838c4,_0x3e3ec9['options']);return db[_0x4a08('0x30')][_0x4a08('0x4b')](_0x2838c4)[_0x4a08('0x17')](handleEntityNotFound(_0x4fc7d0,null))[_0x4a08('0x17')](respondWithResult(_0x4fc7d0,null))['catch'](handleError(_0x4fc7d0,null));};exports[_0x4a08('0x4c')]=function(_0x20e6fa,_0x40789c){return db[_0x4a08('0x30')]['create'](_0x20e6fa['body'],{})['then'](respondWithResult(_0x40789c,0xc9))['catch'](handleError(_0x40789c,null));};exports[_0x4a08('0x2b')]=function(_0x44289e,_0x406931){if(_0x44289e[_0x4a08('0x4d')]['id']){delete _0x44289e[_0x4a08('0x4d')]['id'];}return db['VtigerConfiguration'][_0x4a08('0x4b')]({'where':{'id':_0x44289e['params']['id']}})['then'](handleEntityNotFound(_0x406931,null))['then'](saveUpdates(_0x44289e[_0x4a08('0x4d')],null))[_0x4a08('0x17')](respondWithResult(_0x406931,null))[_0x4a08('0x21')](handleError(_0x406931,null));};exports[_0x4a08('0x4e')]=function(_0x41a8b9,_0x2c4c1f){return db[_0x4a08('0x30')][_0x4a08('0x4b')]({'where':{'id':_0x41a8b9['params']['id']}})[_0x4a08('0x17')](handleEntityNotFound(_0x2c4c1f,null))[_0x4a08('0x17')](removeEntity(_0x2c4c1f,null))[_0x4a08('0x21')](handleError(_0x2c4c1f,null));};exports[_0x4a08('0x4f')]=function(_0x56a643,_0x211a98,_0x4dd8ad){var _0x16a49e={};var _0x58cf02={};var _0x5edf4c;var _0x867dba;return db[_0x4a08('0x30')][_0x4a08('0x50')]({'where':{'id':_0x56a643[_0x4a08('0x4a')]['id']}})[_0x4a08('0x17')](handleEntityNotFound(_0x211a98,null))[_0x4a08('0x17')](function(_0x53b157){if(_0x53b157){_0x5edf4c=_0x53b157;_0x58cf02[_0x4a08('0x37')]=_['keys'](db[_0x4a08('0x51')][_0x4a08('0x31')]);_0x58cf02[_0x4a08('0x33')]=_['keys'](_0x56a643[_0x4a08('0x33')]);_0x58cf02['filters']=_[_0x4a08('0x38')](_0x58cf02[_0x4a08('0x37')],_0x58cf02[_0x4a08('0x33')]);_0x16a49e[_0x4a08('0x3a')]=_[_0x4a08('0x38')](_0x58cf02['model'],qs[_0x4a08('0x39')](_0x56a643[_0x4a08('0x33')][_0x4a08('0x39')]));_0x16a49e['attributes']=_0x16a49e[_0x4a08('0x3a')][_0x4a08('0x3b')]?_0x16a49e[_0x4a08('0x3a')]:_0x58cf02['model'];_0x16a49e[_0x4a08('0x3d')]=qs['sort'](_0x56a643[_0x4a08('0x33')][_0x4a08('0x3e')]);_0x16a49e[_0x4a08('0x43')]=qs[_0x4a08('0x36')](_[_0x4a08('0x3f')](_0x56a643[_0x4a08('0x33')],_0x58cf02[_0x4a08('0x36')]));if(_0x56a643[_0x4a08('0x33')]['filter']){_0x16a49e[_0x4a08('0x43')]=_[_0x4a08('0x42')](_0x16a49e['where'],{'$or':_[_0x4a08('0x45')](_0x16a49e[_0x4a08('0x3a')],function(_0xaa7376){var _0x17faeb={};_0x17faeb[_0xaa7376]={'$like':'%'+_0x56a643[_0x4a08('0x33')][_0x4a08('0x44')]+'%'};return _0x17faeb;})});}_0x16a49e=_['merge']({},_0x16a49e,_0x56a643[_0x4a08('0x46')]);return _0x5edf4c[_0x4a08('0x4f')](_0x16a49e);}})['then'](function(_0xd238de){if(_0xd238de){_0x867dba=_0xd238de[_0x4a08('0x3b')];if(!_0x56a643[_0x4a08('0x33')][_0x4a08('0x52')](_0x4a08('0x3c'))){_0x16a49e[_0x4a08('0x28')]=qs[_0x4a08('0x28')](_0x56a643[_0x4a08('0x33')]['limit']);_0x16a49e['offset']=qs[_0x4a08('0x27')](_0x56a643[_0x4a08('0x33')][_0x4a08('0x27')]);}return _0x5edf4c[_0x4a08('0x4f')](_0x16a49e);}})[_0x4a08('0x17')](function(_0x4f7fe4){if(_0x4f7fe4){return _0x4f7fe4?{'count':_0x867dba,'rows':_0x4f7fe4}:null;}})[_0x4a08('0x17')](respondWithResult(_0x211a98,null))[_0x4a08('0x21')](handleError(_0x211a98,null));};exports[_0x4a08('0x53')]=function(_0x5bba13,_0x194010,_0x2b5eda){var _0x241280={};var _0x1d7e38={};var _0x2252c5;var _0x3fc899;return db[_0x4a08('0x30')][_0x4a08('0x50')]({'where':{'id':_0x5bba13[_0x4a08('0x4a')]['id']}})[_0x4a08('0x17')](handleEntityNotFound(_0x194010,null))[_0x4a08('0x17')](function(_0x5a3a17){if(_0x5a3a17){_0x2252c5=_0x5a3a17;_0x1d7e38['model']=_[_0x4a08('0x32')](db[_0x4a08('0x51')]['rawAttributes']);_0x1d7e38[_0x4a08('0x33')]=_[_0x4a08('0x32')](_0x5bba13[_0x4a08('0x33')]);_0x1d7e38[_0x4a08('0x36')]=_[_0x4a08('0x38')](_0x1d7e38['model'],_0x1d7e38['query']);_0x241280[_0x4a08('0x3a')]=_['intersection'](_0x1d7e38['model'],qs[_0x4a08('0x39')](_0x5bba13[_0x4a08('0x33')]['fields']));_0x241280[_0x4a08('0x3a')]=_0x241280[_0x4a08('0x3a')][_0x4a08('0x3b')]?_0x241280[_0x4a08('0x3a')]:_0x1d7e38[_0x4a08('0x37')];_0x241280[_0x4a08('0x3d')]=qs[_0x4a08('0x3e')](_0x5bba13['query'][_0x4a08('0x3e')]);_0x241280[_0x4a08('0x43')]=qs['filters'](_[_0x4a08('0x3f')](_0x5bba13[_0x4a08('0x33')],_0x1d7e38['filters']));if(_0x5bba13['query'][_0x4a08('0x44')]){_0x241280[_0x4a08('0x43')]=_[_0x4a08('0x42')](_0x241280[_0x4a08('0x43')],{'$or':_['map'](_0x241280['attributes'],function(_0x191b47){var _0x233932={};_0x233932[_0x191b47]={'$like':'%'+_0x5bba13[_0x4a08('0x33')][_0x4a08('0x44')]+'%'};return _0x233932;})});}_0x241280=_['merge']({},_0x241280,_0x5bba13[_0x4a08('0x46')]);return _0x2252c5['getSubjects'](_0x241280);}})[_0x4a08('0x17')](function(_0x1eb89a){if(_0x1eb89a){_0x3fc899=_0x1eb89a[_0x4a08('0x3b')];if(!_0x5bba13[_0x4a08('0x33')][_0x4a08('0x52')](_0x4a08('0x3c'))){_0x241280['limit']=qs[_0x4a08('0x28')](_0x5bba13[_0x4a08('0x33')]['limit']);_0x241280['offset']=qs['offset'](_0x5bba13[_0x4a08('0x33')][_0x4a08('0x27')]);}return _0x2252c5[_0x4a08('0x53')](_0x241280);}})[_0x4a08('0x17')](function(_0xccfb7f){if(_0xccfb7f){return _0xccfb7f?{'count':_0x3fc899,'rows':_0xccfb7f}:null;}})['then'](respondWithResult(_0x194010,null))[_0x4a08('0x21')](handleError(_0x194010,null));};exports[_0x4a08('0x54')]=function(_0x188ecd,_0x46eb9b,_0x1a0d30){var _0x5a3f9c={};var _0x18abfb={};var _0xc35605;var _0x521756;return db[_0x4a08('0x30')][_0x4a08('0x50')]({'where':{'id':_0x188ecd['params']['id']}})[_0x4a08('0x17')](handleEntityNotFound(_0x46eb9b,null))['then'](function(_0x2175ee){if(_0x2175ee){_0xc35605=_0x2175ee;_0x18abfb[_0x4a08('0x37')]=_[_0x4a08('0x32')](db['VtigerField']['rawAttributes']);_0x18abfb['query']=_[_0x4a08('0x32')](_0x188ecd[_0x4a08('0x33')]);_0x18abfb[_0x4a08('0x36')]=_['intersection'](_0x18abfb['model'],_0x18abfb[_0x4a08('0x33')]);_0x5a3f9c['attributes']=_['intersection'](_0x18abfb[_0x4a08('0x37')],qs[_0x4a08('0x39')](_0x188ecd[_0x4a08('0x33')][_0x4a08('0x39')]));_0x5a3f9c[_0x4a08('0x3a')]=_0x5a3f9c[_0x4a08('0x3a')][_0x4a08('0x3b')]?_0x5a3f9c['attributes']:_0x18abfb['model'];_0x5a3f9c[_0x4a08('0x3d')]=qs[_0x4a08('0x3e')](_0x188ecd[_0x4a08('0x33')][_0x4a08('0x3e')]);_0x5a3f9c[_0x4a08('0x43')]=qs[_0x4a08('0x36')](_[_0x4a08('0x3f')](_0x188ecd[_0x4a08('0x33')],_0x18abfb[_0x4a08('0x36')]));if(_0x188ecd['query']['filter']){_0x5a3f9c['where']=_[_0x4a08('0x42')](_0x5a3f9c[_0x4a08('0x43')],{'$or':_['map'](_0x5a3f9c[_0x4a08('0x3a')],function(_0x4b1a72){var _0xfe5074={};_0xfe5074[_0x4b1a72]={'$like':'%'+_0x188ecd['query'][_0x4a08('0x44')]+'%'};return _0xfe5074;})});}_0x5a3f9c=_[_0x4a08('0x42')]({},_0x5a3f9c,_0x188ecd[_0x4a08('0x46')]);return _0xc35605[_0x4a08('0x54')](_0x5a3f9c);}})[_0x4a08('0x17')](function(_0x88b183){if(_0x88b183){_0x521756=_0x88b183['length'];if(!_0x188ecd[_0x4a08('0x33')][_0x4a08('0x52')](_0x4a08('0x3c'))){_0x5a3f9c[_0x4a08('0x28')]=qs['limit'](_0x188ecd[_0x4a08('0x33')][_0x4a08('0x28')]);_0x5a3f9c[_0x4a08('0x27')]=qs[_0x4a08('0x27')](_0x188ecd[_0x4a08('0x33')][_0x4a08('0x27')]);}return _0xc35605[_0x4a08('0x54')](_0x5a3f9c);}})[_0x4a08('0x17')](function(_0x5a150d){if(_0x5a150d){return _0x5a150d?{'count':_0x521756,'rows':_0x5a150d}:null;}})[_0x4a08('0x17')](respondWithResult(_0x46eb9b,null))['catch'](handleError(_0x46eb9b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index dbeffa4..9fa0a8a 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 _0xef10=['bluebird','request-promise','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util'];(function(_0x58d085,_0x103939){var _0x55a8a4=function(_0x167fe9){while(--_0x167fe9){_0x58d085['push'](_0x58d085['shift']());}};_0x55a8a4(++_0x103939);}(_0xef10,0x8f));var _0x0ef1=function(_0x575258,_0x2f2ab1){_0x575258=_0x575258-0x0;var _0x10d650=_0xef10[_0x575258];return _0x10d650;};'use strict';var _=require('lodash');var util=require(_0x0ef1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0ef1('0x1'));var rp=require(_0x0ef1('0x2'));var attributes=require(_0x0ef1('0x3'));module[_0x0ef1('0x4')]=function(_0x4169ae,_0x4cc03c){return _0x4169ae[_0x0ef1('0x5')](_0x0ef1('0x6'),attributes,{'tableName':_0x0ef1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63f9=['request-promise','exports','int_vtiger_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x63f9,0xcb));var _0x963f=function(_0x427ffd,_0x1f7916){_0x427ffd=_0x427ffd-0x0;var _0x77b266=_0x63f9[_0x427ffd];return _0x77b266;};'use strict';var _=require(_0x963f('0x0'));var util=require(_0x963f('0x1'));var logger=require(_0x963f('0x2'))('api');var moment=require(_0x963f('0x3'));var BPromise=require(_0x963f('0x4'));var rp=require(_0x963f('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x963f('0x6')]=function(_0x5beb36,_0xc964eb){return _0x5beb36['define']('VtigerConfiguration',attributes,{'tableName':_0x963f('0x7'),'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 a2bf8a3..1b8c5d4 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 _0x3dde=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3dde,0x198));var _0xe3dd=function(_0x3929e2,_0x4291e0){_0x3929e2=_0x3929e2-0x0;var _0x290b5f=_0x3dde[_0x3929e2];return _0x290b5f;};'use strict';var _=require('lodash');var util=require(_0xe3dd('0x0'));var moment=require(_0xe3dd('0x1'));var BPromise=require(_0xe3dd('0x2'));var rs=require(_0xe3dd('0x3'));var fs=require('fs');var Redis=require(_0xe3dd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe3dd('0x5'))(_0xe3dd('0x6'));var config=require(_0xe3dd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe3dd('0x8')][_0xe3dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x266236,_0x20cf8c,_0x178086){return new BPromise(function(_0x451e96,_0x5ba46a){return client[_0xe3dd('0xa')](_0x266236,_0x178086)[_0xe3dd('0xb')](function(_0x5dd703){logger[_0xe3dd('0xc')](_0xe3dd('0xd'),_0x20cf8c,_0xe3dd('0xe'));logger[_0xe3dd('0xf')](_0xe3dd('0x10'),_0x20cf8c,_0xe3dd('0xe'),JSON['stringify'](_0x5dd703));if(_0x5dd703[_0xe3dd('0x11')]){if(_0x5dd703['error'][_0xe3dd('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x20cf8c,_0x5dd703[_0xe3dd('0x11')][_0xe3dd('0x13')]);return _0x5ba46a(_0x5dd703[_0xe3dd('0x11')][_0xe3dd('0x13')]);}logger[_0xe3dd('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x20cf8c,_0x5dd703[_0xe3dd('0x11')][_0xe3dd('0x13')]);return _0x451e96(_0x5dd703[_0xe3dd('0x11')][_0xe3dd('0x13')]);}else{logger[_0xe3dd('0xc')](_0xe3dd('0xd'),_0x20cf8c,_0xe3dd('0xe'));_0x451e96(_0x5dd703['result'][_0xe3dd('0x13')]);}})[_0xe3dd('0x14')](function(_0x5b42f7){logger[_0xe3dd('0x11')](_0xe3dd('0xd'),_0x20cf8c,_0x5b42f7);_0x5ba46a(_0x5b42f7);});});} \ No newline at end of file +var _0x2bd4=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x55ca59,_0x30b9c0){var _0x4c8262=function(_0x3415c1){while(--_0x3415c1){_0x55ca59['push'](_0x55ca59['shift']());}};_0x4c8262(++_0x30b9c0);}(_0x2bd4,0x1cb));var _0x42bd=function(_0xd66c7f,_0x22a15e){_0xd66c7f=_0xd66c7f-0x0;var _0x4a7352=_0x2bd4[_0xd66c7f];return _0x4a7352;};'use strict';var _=require(_0x42bd('0x0'));var util=require(_0x42bd('0x1'));var moment=require(_0x42bd('0x2'));var BPromise=require(_0x42bd('0x3'));var rs=require(_0x42bd('0x4'));var fs=require('fs');var Redis=require(_0x42bd('0x5'));var db=require(_0x42bd('0x6'))['db'];var utils=require(_0x42bd('0x7'));var logger=require('../../config/logger')(_0x42bd('0x8'));var config=require(_0x42bd('0x9'));var jayson=require(_0x42bd('0xa'));var client=jayson[_0x42bd('0xb')][_0x42bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c42a1,_0xa31b06,_0x2b6c9e){return new BPromise(function(_0x2da8d1,_0x1d52be){return client['request'](_0x3c42a1,_0x2b6c9e)[_0x42bd('0xd')](function(_0xda2a30){logger[_0x42bd('0xe')](_0x42bd('0xf'),_0xa31b06,_0x42bd('0x10'));logger[_0x42bd('0x11')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xa31b06,'request\x20sent',JSON[_0x42bd('0x12')](_0xda2a30));if(_0xda2a30['error']){if(_0xda2a30[_0x42bd('0x13')][_0x42bd('0x14')]===0x1f4){logger[_0x42bd('0x13')](_0x42bd('0xf'),_0xa31b06,_0xda2a30[_0x42bd('0x13')]['message']);return _0x1d52be(_0xda2a30['error']['message']);}logger['error'](_0x42bd('0xf'),_0xa31b06,_0xda2a30[_0x42bd('0x13')][_0x42bd('0x15')]);return _0x2da8d1(_0xda2a30[_0x42bd('0x13')][_0x42bd('0x15')]);}else{logger['info'](_0x42bd('0xf'),_0xa31b06,_0x42bd('0x10'));_0x2da8d1(_0xda2a30[_0x42bd('0x16')][_0x42bd('0x15')]);}})[_0x42bd('0x17')](function(_0x4afbd2){logger[_0x42bd('0x13')](_0x42bd('0xf'),_0xa31b06,_0x4afbd2);_0x1d52be(_0x4afbd2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5c49f42..83823f0 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 _0x96e6=['show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./intVtigerField.controller','get','index','/:id','isAuthenticated'];(function(_0x34348d,_0x40a646){var _0xcdc8c9=function(_0xa9488b){while(--_0xa9488b){_0x34348d['push'](_0x34348d['shift']());}};_0xcdc8c9(++_0x40a646);}(_0x96e6,0x14b));var _0x696e=function(_0x5ecc3f,_0x95de31){_0x5ecc3f=_0x5ecc3f-0x0;var _0x57953a=_0x96e6[_0x5ecc3f];return _0x57953a;};'use strict';var multer=require('multer');var util=require(_0x696e('0x0'));var path=require(_0x696e('0x1'));var timeout=require(_0x696e('0x2'));var express=require(_0x696e('0x3'));var router=express[_0x696e('0x4')]();var auth=require(_0x696e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x696e('0x6'));router[_0x696e('0x7')]('/',auth['isAuthenticated'](),controller[_0x696e('0x8')]);router[_0x696e('0x7')](_0x696e('0x9'),auth[_0x696e('0xa')](),controller[_0x696e('0xb')]);router[_0x696e('0xc')]('/',auth[_0x696e('0xa')](),controller[_0x696e('0xd')]);router[_0x696e('0xe')]('/:id',auth[_0x696e('0xa')](),controller['update']);router[_0x696e('0xf')](_0x696e('0x9'),auth[_0x696e('0xa')](),controller[_0x696e('0x10')]);module[_0x696e('0x11')]=router; \ No newline at end of file +var _0x803c=['destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','/:id','update','delete'];(function(_0x547fe0,_0x5d104a){var _0x2c80c4=function(_0x53c7b9){while(--_0x53c7b9){_0x547fe0['push'](_0x547fe0['shift']());}};_0x2c80c4(++_0x5d104a);}(_0x803c,0x1f2));var _0xc803=function(_0x56fb83,_0x4acf2d){_0x56fb83=_0x56fb83-0x0;var _0x2dbab0=_0x803c[_0x56fb83];return _0x2dbab0;};'use strict';var multer=require(_0xc803('0x0'));var util=require('util');var path=require(_0xc803('0x1'));var timeout=require(_0xc803('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xc803('0x3'));var interaction=require(_0xc803('0x4'));var config=require(_0xc803('0x5'));var controller=require('./intVtigerField.controller');router[_0xc803('0x6')]('/',auth[_0xc803('0x7')](),controller[_0xc803('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc803('0x9')]);router[_0xc803('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc803('0xb'),auth[_0xc803('0x7')](),controller[_0xc803('0xc')]);router[_0xc803('0xd')](_0xc803('0xb'),auth[_0xc803('0x7')](),controller[_0xc803('0xe')]);module[_0xc803('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a189671..4792df4 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 _0xd8b0=['keyValue','string','STRING','variable','BOOLEAN','sequelize','exports','customVariable'];(function(_0x55a656,_0x45f479){var _0x1474bd=function(_0x509e85){while(--_0x509e85){_0x55a656['push'](_0x55a656['shift']());}};_0x1474bd(++_0x45f479);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'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 _0x5b02=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','STRING','variable'];(function(_0x28ce2f,_0x46de6b){var _0x296571=function(_0x367589){while(--_0x367589){_0x28ce2f['push'](_0x28ce2f['shift']());}};_0x296571(++_0x46de6b);}(_0x5b02,0xe9));var _0x25b0=function(_0x528fc7,_0x242e77){_0x528fc7=_0x528fc7-0x0;var _0x1ef0bd=_0x5b02[_0x528fc7];return _0x1ef0bd;};'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/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index fb2cfc7..0dd3ef6 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 _0xae87=['stack','name','index','VtigerField','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','count','includeAll','include','rows','catch','show','params','find','update','body','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','api','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','destroy','then','error'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xae87,0x69));var _0x7ae8=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0xae87[_0x3a16d4];return _0x31ea9c;};'use strict';var pdf=require(_0x7ae8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7ae8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ae8('0x2'));var rp=require('request-promise');var moment=require(_0x7ae8('0x3'));var BPromise=require(_0x7ae8('0x4'));var Mustache=require(_0x7ae8('0x5'));var util=require(_0x7ae8('0x6'));var path=require('path');var sox=require(_0x7ae8('0x7'));var csv=require(_0x7ae8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ae8('0x9'));var squel=require(_0x7ae8('0xa'));var crypto=require('crypto');var jsforce=require(_0x7ae8('0xb'));var deskjs=require(_0x7ae8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7ae8('0xd'));var Papa=require(_0x7ae8('0xe'));var Redis=require(_0x7ae8('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7ae8('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7ae8('0x11'))['db'];function respondWithStatusCode(_0x545fae,_0x59e72a){_0x59e72a=_0x59e72a||0xcc;return function(_0x3693c7){if(_0x3693c7){return _0x545fae[_0x7ae8('0x12')](_0x59e72a);}return _0x545fae['status'](_0x59e72a)[_0x7ae8('0x13')]();};}function respondWithResult(_0x38d3b2,_0x5d6fb5){_0x5d6fb5=_0x5d6fb5||0xc8;return function(_0x1e90fd){if(_0x1e90fd){return _0x38d3b2[_0x7ae8('0x14')](_0x5d6fb5)[_0x7ae8('0x15')](_0x1e90fd);}};}function respondWithFilteredResult(_0x536fed,_0x19f7ff){return function(_0x2929f0){if(_0x2929f0){var _0x4ee5c3=_0x2929f0['count'],_0x2b937a=_0x19f7ff[_0x7ae8('0x16')],_0x1c33b8=_0x19f7ff[_0x7ae8('0x16')]+_0x19f7ff[_0x7ae8('0x17')],_0xd40172;if(_0x1c33b8>=_0x4ee5c3){_0x1c33b8=_0x4ee5c3;_0xd40172=0xc8;}else{_0xd40172=0xce;}_0x536fed[_0x7ae8('0x14')](_0xd40172);return _0x536fed[_0x7ae8('0x18')](_0x7ae8('0x19'),_0x2b937a+'-'+_0x1c33b8+'/'+_0x4ee5c3)['json'](_0x2929f0);}return null;};}function patchUpdates(_0x279c99){return function(_0x4c5345){try{jsonpatch[_0x7ae8('0x1a')](_0x4c5345,_0x279c99,!![]);}catch(_0x4b183b){return BPromise[_0x7ae8('0x1b')](_0x4b183b);}return _0x4c5345['save']();};}function saveUpdates(_0x2e58d3,_0x1c21d6){return function(_0x53d5de){if(_0x53d5de){return _0x53d5de['update'](_0x2e58d3)['then'](function(_0xcac2dc){return _0xcac2dc;});}return null;};}function removeEntity(_0x63982a,_0x45e16f){return function(_0x512b70){if(_0x512b70){return _0x512b70[_0x7ae8('0x1c')]()[_0x7ae8('0x1d')](function(){_0x63982a[_0x7ae8('0x14')](0xcc)[_0x7ae8('0x13')]();});}};}function handleEntityNotFound(_0x10411e,_0x1bcb01){return function(_0x489490){if(!_0x489490){_0x10411e['sendStatus'](0x194);}return _0x489490;};}function handleError(_0xb3706f,_0x30060b){_0x30060b=_0x30060b||0x1f4;return function(_0x9ac5e4){logger[_0x7ae8('0x1e')](_0x9ac5e4[_0x7ae8('0x1f')]);if(_0x9ac5e4[_0x7ae8('0x20')]){delete _0x9ac5e4['name'];}_0xb3706f['status'](_0x30060b)['send'](_0x9ac5e4);};}exports[_0x7ae8('0x21')]=function(_0x4e6aa7,_0x5c12a2){var _0x183cbd={},_0x59251a={},_0x128267={'count':0x0,'rows':[]};var _0x57cd24=db[_0x7ae8('0x22')][_0x7ae8('0x23')];_0x59251a[_0x7ae8('0x24')]=_[_0x7ae8('0x25')](_0x57cd24);var _0x51f2c5={'dateStart':_0x4e6aa7[_0x7ae8('0x26')][_0x7ae8('0x27')],'dateEnd':_0x4e6aa7[_0x7ae8('0x26')][_0x7ae8('0x28')]};delete _0x4e6aa7[_0x7ae8('0x26')][_0x7ae8('0x27')];delete _0x4e6aa7['query'][_0x7ae8('0x28')];_0x59251a[_0x7ae8('0x26')]=_[_0x7ae8('0x25')](_0x4e6aa7['query']);_0x59251a['filters']=_[_0x7ae8('0x29')](_0x59251a[_0x7ae8('0x24')],_0x59251a[_0x7ae8('0x26')]);_0x183cbd[_0x7ae8('0x2a')]=_[_0x7ae8('0x29')](_0x59251a[_0x7ae8('0x24')],qs[_0x7ae8('0x2b')](_0x4e6aa7['query'][_0x7ae8('0x2b')]));_0x183cbd[_0x7ae8('0x2a')]=_0x183cbd[_0x7ae8('0x2a')][_0x7ae8('0x2c')]?_0x183cbd[_0x7ae8('0x2a')]:_0x59251a[_0x7ae8('0x24')];if(!_0x4e6aa7[_0x7ae8('0x26')][_0x7ae8('0x2d')](_0x7ae8('0x2e'))){_0x183cbd[_0x7ae8('0x17')]=qs[_0x7ae8('0x17')](_0x4e6aa7['query']['limit']);_0x183cbd[_0x7ae8('0x16')]=qs['offset'](_0x4e6aa7[_0x7ae8('0x26')][_0x7ae8('0x16')]);}_0x183cbd[_0x7ae8('0x2f')]=qs[_0x7ae8('0x30')](_0x4e6aa7['query'][_0x7ae8('0x30')]);_0x183cbd[_0x7ae8('0x31')]=qs[_0x7ae8('0x32')](_[_0x7ae8('0x33')](_0x4e6aa7[_0x7ae8('0x26')],_0x59251a[_0x7ae8('0x32')]));if(_0x51f2c5[_0x7ae8('0x27')]){if(_0x51f2c5['dateEnd']){_0x51f2c5['dateEnd']=moment(_0x51f2c5[_0x7ae8('0x28')])[_0x7ae8('0x34')](0x1,_0x7ae8('0x35'));}else{_0x51f2c5[_0x7ae8('0x28')]=moment(_0x51f2c5[_0x7ae8('0x27')])[_0x7ae8('0x34')](0x1,_0x7ae8('0x35'));}_[_0x7ae8('0x36')](_0x183cbd['where'],{'createdAt':{'$gte':_0x51f2c5[_0x7ae8('0x27')],'$lte':_0x51f2c5['dateEnd']}});}if(_0x4e6aa7[_0x7ae8('0x26')][_0x7ae8('0x37')]){_0x183cbd[_0x7ae8('0x31')]=_[_0x7ae8('0x36')](_0x183cbd[_0x7ae8('0x31')],{'$or':_[_0x7ae8('0x38')](_0x183cbd[_0x7ae8('0x2a')],function(_0x525df4){var _0x291060={};_0x291060[_0x525df4]={'$like':'%'+_0x4e6aa7[_0x7ae8('0x26')]['filter']+'%'};return _0x291060;})});}_0x183cbd=_[_0x7ae8('0x36')]({},_0x183cbd,_0x4e6aa7[_0x7ae8('0x39')]);var _0x23fc07={'where':_0x183cbd['where']};return db[_0x7ae8('0x22')][_0x7ae8('0x3a')](_0x23fc07)['then'](function(_0x4271d8){_0x128267[_0x7ae8('0x3a')]=_0x4271d8;if(_0x4e6aa7[_0x7ae8('0x26')][_0x7ae8('0x3b')]){_0x183cbd[_0x7ae8('0x3c')]=[{'all':!![]}];}return db[_0x7ae8('0x22')]['findAll'](_0x183cbd);})['then'](function(_0x9d4c12){_0x128267[_0x7ae8('0x3d')]=_0x9d4c12;return _0x128267;})['then'](respondWithFilteredResult(_0x5c12a2,_0x183cbd))[_0x7ae8('0x3e')](handleError(_0x5c12a2,null));};exports[_0x7ae8('0x3f')]=function(_0x38b5de,_0x612b16){var _0x12b032={'raw':!![],'where':{'id':_0x38b5de[_0x7ae8('0x40')]['id']}},_0x11a606={};_0x11a606[_0x7ae8('0x24')]=_['keys'](db[_0x7ae8('0x22')][_0x7ae8('0x23')]);_0x11a606[_0x7ae8('0x26')]=_[_0x7ae8('0x25')](_0x38b5de[_0x7ae8('0x26')]);_0x11a606[_0x7ae8('0x32')]=_['intersection'](_0x11a606[_0x7ae8('0x24')],_0x11a606[_0x7ae8('0x26')]);_0x12b032[_0x7ae8('0x2a')]=_['intersection'](_0x11a606['model'],qs['fields'](_0x38b5de[_0x7ae8('0x26')][_0x7ae8('0x2b')]));_0x12b032[_0x7ae8('0x2a')]=_0x12b032[_0x7ae8('0x2a')][_0x7ae8('0x2c')]?_0x12b032[_0x7ae8('0x2a')]:_0x11a606['model'];if(_0x38b5de[_0x7ae8('0x26')]['includeAll']){_0x12b032[_0x7ae8('0x3c')]=[{'all':!![]}];}_0x12b032=_[_0x7ae8('0x36')]({},_0x12b032,_0x38b5de[_0x7ae8('0x39')]);return db[_0x7ae8('0x22')][_0x7ae8('0x41')](_0x12b032)['then'](handleEntityNotFound(_0x612b16,null))['then'](respondWithResult(_0x612b16,null))[_0x7ae8('0x3e')](handleError(_0x612b16,null));};exports['create']=function(_0x27211a,_0x36809f){return db[_0x7ae8('0x22')]['create'](_0x27211a['body'],{})[_0x7ae8('0x1d')](respondWithResult(_0x36809f,0xc9))[_0x7ae8('0x3e')](handleError(_0x36809f,null));};exports[_0x7ae8('0x42')]=function(_0x2498c2,_0x1ebaf5){if(_0x2498c2[_0x7ae8('0x43')]['id']){delete _0x2498c2[_0x7ae8('0x43')]['id'];}return db[_0x7ae8('0x22')][_0x7ae8('0x41')]({'where':{'id':_0x2498c2[_0x7ae8('0x40')]['id']}})[_0x7ae8('0x1d')](handleEntityNotFound(_0x1ebaf5,null))['then'](saveUpdates(_0x2498c2[_0x7ae8('0x43')],null))['then'](respondWithResult(_0x1ebaf5,null))[_0x7ae8('0x3e')](handleError(_0x1ebaf5,null));};exports[_0x7ae8('0x1c')]=function(_0x277c69,_0x26e036){return db['VtigerField'][_0x7ae8('0x41')]({'where':{'id':_0x277c69[_0x7ae8('0x40')]['id']}})['then'](handleEntityNotFound(_0x26e036,null))[_0x7ae8('0x1d')](removeEntity(_0x26e036,null))[_0x7ae8('0x3e')](handleError(_0x26e036,null));}; \ No newline at end of file +var _0xd47d=['params','find','create','update','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','querystring','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','destroy','then','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','VtigerField','includeAll','include','findAll','catch'];(function(_0x396ec0,_0x21dd9d){var _0x5a497f=function(_0x3645b0){while(--_0x3645b0){_0x396ec0['push'](_0x396ec0['shift']());}};_0x5a497f(++_0x21dd9d);}(_0xd47d,0x1d3));var _0xdd47=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0xd47d[_0xb7b878];return _0x3c84b9;};'use strict';var pdf=require(_0xdd47('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdd47('0x1'));var zipdir=require(_0xdd47('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd47('0x3'));var moment=require(_0xdd47('0x4'));var BPromise=require(_0xdd47('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdd47('0x6'));var sox=require('sox');var csv=require(_0xdd47('0x7'));var ejs=require(_0xdd47('0x8'));var fs=require('fs');var _=require(_0xdd47('0x9'));var squel=require(_0xdd47('0xa'));var crypto=require(_0xdd47('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdd47('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xdd47('0xd'));var logger=require('../../config/logger')(_0xdd47('0xe'));var utils=require(_0xdd47('0xf'));var config=require(_0xdd47('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x201b27,_0x49795a){_0x49795a=_0x49795a||0xcc;return function(_0x382004){if(_0x382004){return _0x201b27[_0xdd47('0x11')](_0x49795a);}return _0x201b27[_0xdd47('0x12')](_0x49795a)[_0xdd47('0x13')]();};}function respondWithResult(_0x592aaf,_0x539a31){_0x539a31=_0x539a31||0xc8;return function(_0x50434b){if(_0x50434b){return _0x592aaf[_0xdd47('0x12')](_0x539a31)[_0xdd47('0x14')](_0x50434b);}};}function respondWithFilteredResult(_0x22cd02,_0x5d5ec6){return function(_0x4d789a){if(_0x4d789a){var _0x5788ab=_0x4d789a[_0xdd47('0x15')],_0xe00fc7=_0x5d5ec6[_0xdd47('0x16')],_0x3de8be=_0x5d5ec6[_0xdd47('0x16')]+_0x5d5ec6[_0xdd47('0x17')],_0x2bb321;if(_0x3de8be>=_0x5788ab){_0x3de8be=_0x5788ab;_0x2bb321=0xc8;}else{_0x2bb321=0xce;}_0x22cd02[_0xdd47('0x12')](_0x2bb321);return _0x22cd02[_0xdd47('0x18')](_0xdd47('0x19'),_0xe00fc7+'-'+_0x3de8be+'/'+_0x5788ab)[_0xdd47('0x14')](_0x4d789a);}return null;};}function patchUpdates(_0x512782){return function(_0x307a61){try{jsonpatch['apply'](_0x307a61,_0x512782,!![]);}catch(_0x877fc1){return BPromise['reject'](_0x877fc1);}return _0x307a61[_0xdd47('0x1a')]();};}function saveUpdates(_0x357a87,_0x163cb7){return function(_0x116b0e){if(_0x116b0e){return _0x116b0e['update'](_0x357a87)['then'](function(_0x25e355){return _0x25e355;});}return null;};}function removeEntity(_0x3cc4f7,_0xc704db){return function(_0x333776){if(_0x333776){return _0x333776[_0xdd47('0x1b')]()[_0xdd47('0x1c')](function(){_0x3cc4f7[_0xdd47('0x12')](0xcc)[_0xdd47('0x13')]();});}};}function handleEntityNotFound(_0x3caeb3,_0x2130b2){return function(_0x1ce366){if(!_0x1ce366){_0x3caeb3[_0xdd47('0x11')](0x194);}return _0x1ce366;};}function handleError(_0x208097,_0x4666f7){_0x4666f7=_0x4666f7||0x1f4;return function(_0x817b03){logger[_0xdd47('0x1d')](_0x817b03[_0xdd47('0x1e')]);if(_0x817b03[_0xdd47('0x1f')]){delete _0x817b03[_0xdd47('0x1f')];}_0x208097['status'](_0x4666f7)[_0xdd47('0x20')](_0x817b03);};}exports[_0xdd47('0x21')]=function(_0x401f2c,_0x209a15){var _0x5af29f={},_0x5cf139={},_0x47e921={'count':0x0,'rows':[]};var _0x4de63c=db['VtigerField'][_0xdd47('0x22')];_0x5cf139[_0xdd47('0x23')]=_[_0xdd47('0x24')](_0x4de63c);var _0x2637c5={'dateStart':_0x401f2c[_0xdd47('0x25')][_0xdd47('0x26')],'dateEnd':_0x401f2c['query'][_0xdd47('0x27')]};delete _0x401f2c[_0xdd47('0x25')][_0xdd47('0x26')];delete _0x401f2c['query'][_0xdd47('0x27')];_0x5cf139['query']=_[_0xdd47('0x24')](_0x401f2c[_0xdd47('0x25')]);_0x5cf139[_0xdd47('0x28')]=_['intersection'](_0x5cf139[_0xdd47('0x23')],_0x5cf139['query']);_0x5af29f[_0xdd47('0x29')]=_[_0xdd47('0x2a')](_0x5cf139['model'],qs[_0xdd47('0x2b')](_0x401f2c[_0xdd47('0x25')][_0xdd47('0x2b')]));_0x5af29f[_0xdd47('0x29')]=_0x5af29f[_0xdd47('0x29')][_0xdd47('0x2c')]?_0x5af29f[_0xdd47('0x29')]:_0x5cf139[_0xdd47('0x23')];if(!_0x401f2c[_0xdd47('0x25')][_0xdd47('0x2d')](_0xdd47('0x2e'))){_0x5af29f[_0xdd47('0x17')]=qs[_0xdd47('0x17')](_0x401f2c[_0xdd47('0x25')][_0xdd47('0x17')]);_0x5af29f['offset']=qs[_0xdd47('0x16')](_0x401f2c['query'][_0xdd47('0x16')]);}_0x5af29f[_0xdd47('0x2f')]=qs['sort'](_0x401f2c[_0xdd47('0x25')][_0xdd47('0x30')]);_0x5af29f[_0xdd47('0x31')]=qs[_0xdd47('0x28')](_[_0xdd47('0x32')](_0x401f2c[_0xdd47('0x25')],_0x5cf139[_0xdd47('0x28')]));if(_0x2637c5[_0xdd47('0x26')]){if(_0x2637c5[_0xdd47('0x27')]){_0x2637c5[_0xdd47('0x27')]=moment(_0x2637c5['dateEnd'])[_0xdd47('0x33')](0x1,_0xdd47('0x34'));}else{_0x2637c5[_0xdd47('0x27')]=moment(_0x2637c5[_0xdd47('0x26')])['add'](0x1,_0xdd47('0x34'));}_[_0xdd47('0x35')](_0x5af29f['where'],{'createdAt':{'$gte':_0x2637c5['dateStart'],'$lte':_0x2637c5[_0xdd47('0x27')]}});}if(_0x401f2c[_0xdd47('0x25')][_0xdd47('0x36')]){_0x5af29f[_0xdd47('0x31')]=_[_0xdd47('0x35')](_0x5af29f['where'],{'$or':_['map'](_0x5af29f[_0xdd47('0x29')],function(_0x50b413){var _0x236e27={};_0x236e27[_0x50b413]={'$like':'%'+_0x401f2c[_0xdd47('0x25')][_0xdd47('0x36')]+'%'};return _0x236e27;})});}_0x5af29f=_[_0xdd47('0x35')]({},_0x5af29f,_0x401f2c[_0xdd47('0x37')]);var _0x2cbd52={'where':_0x5af29f[_0xdd47('0x31')]};return db[_0xdd47('0x38')][_0xdd47('0x15')](_0x2cbd52)['then'](function(_0x39da69){_0x47e921[_0xdd47('0x15')]=_0x39da69;if(_0x401f2c[_0xdd47('0x25')][_0xdd47('0x39')]){_0x5af29f[_0xdd47('0x3a')]=[{'all':!![]}];}return db['VtigerField'][_0xdd47('0x3b')](_0x5af29f);})[_0xdd47('0x1c')](function(_0x1f6de1){_0x47e921['rows']=_0x1f6de1;return _0x47e921;})[_0xdd47('0x1c')](respondWithFilteredResult(_0x209a15,_0x5af29f))[_0xdd47('0x3c')](handleError(_0x209a15,null));};exports['show']=function(_0x4170b7,_0x392d91){var _0x5bf051={'raw':!![],'where':{'id':_0x4170b7[_0xdd47('0x3d')]['id']}},_0x5a3256={};_0x5a3256[_0xdd47('0x23')]=_[_0xdd47('0x24')](db['VtigerField'][_0xdd47('0x22')]);_0x5a3256[_0xdd47('0x25')]=_[_0xdd47('0x24')](_0x4170b7[_0xdd47('0x25')]);_0x5a3256[_0xdd47('0x28')]=_[_0xdd47('0x2a')](_0x5a3256[_0xdd47('0x23')],_0x5a3256['query']);_0x5bf051[_0xdd47('0x29')]=_[_0xdd47('0x2a')](_0x5a3256[_0xdd47('0x23')],qs[_0xdd47('0x2b')](_0x4170b7[_0xdd47('0x25')][_0xdd47('0x2b')]));_0x5bf051[_0xdd47('0x29')]=_0x5bf051[_0xdd47('0x29')][_0xdd47('0x2c')]?_0x5bf051['attributes']:_0x5a3256['model'];if(_0x4170b7[_0xdd47('0x25')][_0xdd47('0x39')]){_0x5bf051[_0xdd47('0x3a')]=[{'all':!![]}];}_0x5bf051=_[_0xdd47('0x35')]({},_0x5bf051,_0x4170b7[_0xdd47('0x37')]);return db[_0xdd47('0x38')][_0xdd47('0x3e')](_0x5bf051)[_0xdd47('0x1c')](handleEntityNotFound(_0x392d91,null))['then'](respondWithResult(_0x392d91,null))[_0xdd47('0x3c')](handleError(_0x392d91,null));};exports[_0xdd47('0x3f')]=function(_0x38b92b,_0x6a32fa){return db[_0xdd47('0x38')]['create'](_0x38b92b['body'],{})['then'](respondWithResult(_0x6a32fa,0xc9))[_0xdd47('0x3c')](handleError(_0x6a32fa,null));};exports[_0xdd47('0x40')]=function(_0x55c43d,_0x121775){if(_0x55c43d[_0xdd47('0x41')]['id']){delete _0x55c43d[_0xdd47('0x41')]['id'];}return db[_0xdd47('0x38')]['find']({'where':{'id':_0x55c43d[_0xdd47('0x3d')]['id']}})['then'](handleEntityNotFound(_0x121775,null))[_0xdd47('0x1c')](saveUpdates(_0x55c43d['body'],null))['then'](respondWithResult(_0x121775,null))[_0xdd47('0x3c')](handleError(_0x121775,null));};exports[_0xdd47('0x1b')]=function(_0x4c1d15,_0x3ca525){return db[_0xdd47('0x38')][_0xdd47('0x3e')]({'where':{'id':_0x4c1d15[_0xdd47('0x3d')]['id']}})[_0xdd47('0x1c')](handleEntityNotFound(_0x3ca525,null))[_0xdd47('0x1c')](removeEntity(_0x3ca525,null))[_0xdd47('0x3c')](handleError(_0x3ca525,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 2d2aae8..f3cf845 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 _0x8f8b=['moment','bluebird','request-promise','./intVtigerField.attributes','exports','define','VtigerField','../../config/logger','api'];(function(_0x1c0ada,_0x727580){var _0x9d7e65=function(_0x3ecf17){while(--_0x3ecf17){_0x1c0ada['push'](_0x1c0ada['shift']());}};_0x9d7e65(++_0x727580);}(_0x8f8b,0x127));var _0xb8f8=function(_0x306ac6,_0x8e5862){_0x306ac6=_0x306ac6-0x0;var _0x1f035f=_0x8f8b[_0x306ac6];return _0x1f035f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb8f8('0x0'))(_0xb8f8('0x1'));var moment=require(_0xb8f8('0x2'));var BPromise=require(_0xb8f8('0x3'));var rp=require(_0xb8f8('0x4'));var attributes=require(_0xb8f8('0x5'));module[_0xb8f8('0x6')]=function(_0x5d5bae,_0x2d2fce){return _0x5d5bae[_0xb8f8('0x7')](_0xb8f8('0x8'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd5a=['./intVtigerField.attributes','exports','define','VtigerField','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27d424,_0x4f3600){var _0x18de6a=function(_0x3b44b6){while(--_0x3b44b6){_0x27d424['push'](_0x27d424['shift']());}};_0x18de6a(++_0x4f3600);}(_0xdd5a,0x18a));var _0xadd5=function(_0x36d609,_0xbac0d5){_0x36d609=_0x36d609-0x0;var _0xf687fc=_0xdd5a[_0x36d609];return _0xf687fc;};'use strict';var _=require(_0xadd5('0x0'));var util=require('util');var logger=require(_0xadd5('0x1'))(_0xadd5('0x2'));var moment=require(_0xadd5('0x3'));var BPromise=require(_0xadd5('0x4'));var rp=require(_0xadd5('0x5'));var attributes=require(_0xadd5('0x6'));module[_0xadd5('0x7')]=function(_0x4d1cc7,_0x26175c){return _0x4d1cc7[_0xadd5('0x8')](_0xadd5('0x9'),attributes,{'tableName':'int_vtiger_fields','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 bccdc0d..45542ea 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 _0x08c9=['message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x216a1e,_0x34a601){var _0x18d053=function(_0x339f54){while(--_0x339f54){_0x216a1e['push'](_0x216a1e['shift']());}};_0x18d053(++_0x34a601);}(_0x08c9,0x127));var _0x908c=function(_0x565d18,_0x150e74){_0x565d18=_0x565d18-0x0;var _0x4bd347=_0x08c9[_0x565d18];return _0x4bd347;};'use strict';var _=require(_0x908c('0x0'));var util=require(_0x908c('0x1'));var moment=require(_0x908c('0x2'));var BPromise=require(_0x908c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x908c('0x4'));var db=require(_0x908c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x908c('0x6'))(_0x908c('0x7'));var config=require(_0x908c('0x8'));var jayson=require(_0x908c('0x9'));var client=jayson[_0x908c('0xa')][_0x908c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x345498,_0x39cbbb,_0x264159){return new BPromise(function(_0xfd3747,_0x269be8){return client[_0x908c('0xc')](_0x345498,_0x264159)['then'](function(_0x1c585e){logger[_0x908c('0xd')](_0x908c('0xe'),_0x39cbbb,_0x908c('0xf'));logger[_0x908c('0x10')](_0x908c('0x11'),_0x39cbbb,'request\x20sent',JSON['stringify'](_0x1c585e));if(_0x1c585e[_0x908c('0x12')]){if(_0x1c585e[_0x908c('0x12')][_0x908c('0x13')]===0x1f4){logger['error'](_0x908c('0xe'),_0x39cbbb,_0x1c585e[_0x908c('0x12')][_0x908c('0x14')]);return _0x269be8(_0x1c585e[_0x908c('0x12')]['message']);}logger['error'](_0x908c('0xe'),_0x39cbbb,_0x1c585e[_0x908c('0x12')]['message']);return _0xfd3747(_0x1c585e[_0x908c('0x12')][_0x908c('0x14')]);}else{logger[_0x908c('0xd')]('VtigerField,\x20%s,\x20%s',_0x39cbbb,_0x908c('0xf'));_0xfd3747(_0x1c585e['result'][_0x908c('0x14')]);}})['catch'](function(_0x2cf162){logger[_0x908c('0x12')]('VtigerField,\x20%s,\x20%s',_0x39cbbb,_0x2cf162);_0x269be8(_0x2cf162);});});} \ No newline at end of file +var _0x2f30=['request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','VtigerField,\x20%s,\x20%s'];(function(_0x2cacd6,_0x137f8f){var _0x14693e=function(_0x38f82a){while(--_0x38f82a){_0x2cacd6['push'](_0x2cacd6['shift']());}};_0x14693e(++_0x137f8f);}(_0x2f30,0x145));var _0x02f3=function(_0x43dc94,_0x2978c5){_0x43dc94=_0x43dc94-0x0;var _0x11b842=_0x2f30[_0x43dc94];return _0x11b842;};'use strict';var _=require('lodash');var util=require(_0x02f3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x02f3('0x1'));var fs=require('fs');var Redis=require(_0x02f3('0x2'));var db=require(_0x02f3('0x3'))['db'];var utils=require(_0x02f3('0x4'));var logger=require(_0x02f3('0x5'))('rpc');var config=require(_0x02f3('0x6'));var jayson=require(_0x02f3('0x7'));var client=jayson[_0x02f3('0x8')][_0x02f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x288de8,_0x55ab2e,_0x31d9ac){return new BPromise(function(_0x53294e,_0x8537ad){return client['request'](_0x288de8,_0x31d9ac)['then'](function(_0x4df486){logger['info'](_0x02f3('0xa'),_0x55ab2e,_0x02f3('0xb'));logger[_0x02f3('0xc')](_0x02f3('0xd'),_0x55ab2e,'request\x20sent',JSON[_0x02f3('0xe')](_0x4df486));if(_0x4df486[_0x02f3('0xf')]){if(_0x4df486['error'][_0x02f3('0x10')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x55ab2e,_0x4df486[_0x02f3('0xf')][_0x02f3('0x11')]);return _0x8537ad(_0x4df486[_0x02f3('0xf')]['message']);}logger[_0x02f3('0xf')](_0x02f3('0xa'),_0x55ab2e,_0x4df486[_0x02f3('0xf')][_0x02f3('0x11')]);return _0x53294e(_0x4df486['error'][_0x02f3('0x11')]);}else{logger[_0x02f3('0x12')](_0x02f3('0xa'),_0x55ab2e,'request\x20sent');_0x53294e(_0x4df486[_0x02f3('0x13')]['message']);}})[_0x02f3('0x14')](function(_0x113c64){logger[_0x02f3('0xf')]('VtigerField,\x20%s,\x20%s',_0x55ab2e,_0x113c64);_0x8537ad(_0x113c64);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index a9adcd8..c1697e3 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 _0x7293=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update'];(function(_0x3fdf96,_0x7c9d){var _0x3dca08=function(_0x22ff70){while(--_0x22ff70){_0x3fdf96['push'](_0x3fdf96['shift']());}};_0x3dca08(++_0x7c9d);}(_0x7293,0x1cf));var _0x3729=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7293[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x3729('0x0'));var util=require(_0x3729('0x1'));var path=require('path');var timeout=require(_0x3729('0x2'));var express=require(_0x3729('0x3'));var router=express['Router']();var auth=require(_0x3729('0x4'));var interaction=require(_0x3729('0x5'));var config=require(_0x3729('0x6'));var controller=require(_0x3729('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3729('0x8')]);router[_0x3729('0x9')](_0x3729('0xa'),auth[_0x3729('0xb')](),controller[_0x3729('0xc')]);router['get'](_0x3729('0xd'),auth[_0x3729('0xb')](),controller[_0x3729('0xe')]);router[_0x3729('0x9')](_0x3729('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x3729('0x10')]('/',auth[_0x3729('0xb')](),controller[_0x3729('0x11')]);router[_0x3729('0x10')]('/:id/configurations',auth[_0x3729('0xb')](),controller[_0x3729('0x12')]);router['put'](_0x3729('0xa'),auth[_0x3729('0xb')](),controller[_0x3729('0x13')]);router[_0x3729('0x14')](_0x3729('0xa'),auth['isAuthenticated'](),controller[_0x3729('0x15')]);module[_0x3729('0x16')]=router; \ No newline at end of file +var _0xb124=['get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','Router','./intZendeskAccount.controller'];(function(_0x5df245,_0x2ef682){var _0x207b88=function(_0x460d96){while(--_0x460d96){_0x5df245['push'](_0x5df245['shift']());}};_0x207b88(++_0x2ef682);}(_0xb124,0xd7));var _0x4b12=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xb124[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x4b12('0x0'));var util=require(_0x4b12('0x1'));var path=require('path');var timeout=require(_0x4b12('0x2'));var express=require('express');var router=express[_0x4b12('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4b12('0x4'));router[_0x4b12('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4b12('0x6'),auth[_0x4b12('0x7')](),controller[_0x4b12('0x8')]);router['get']('/:id/configurations',auth[_0x4b12('0x7')](),controller[_0x4b12('0x9')]);router[_0x4b12('0x5')](_0x4b12('0xa'),auth[_0x4b12('0x7')](),controller[_0x4b12('0xb')]);router[_0x4b12('0xc')]('/',auth[_0x4b12('0x7')](),controller[_0x4b12('0xd')]);router[_0x4b12('0xc')](_0x4b12('0xe'),auth[_0x4b12('0x7')](),controller[_0x4b12('0xf')]);router[_0x4b12('0x10')](_0x4b12('0x6'),auth['isAuthenticated'](),controller[_0x4b12('0x11')]);router[_0x4b12('0x12')](_0x4b12('0x6'),auth[_0x4b12('0x7')](),controller[_0x4b12('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 064d008..8c3c276 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 _0xc74e=['token','password','integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xc74e,0x82));var _0xec74=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc74e[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xec74('0x0'));module['exports']={'name':{'type':Sequelize[_0xec74('0x1')]},'description':{'type':Sequelize[_0xec74('0x1')]},'username':{'type':Sequelize[_0xec74('0x1')],'unique':_0xec74('0x2')},'password':{'type':Sequelize[_0xec74('0x1')]},'token':{'type':Sequelize[_0xec74('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xec74('0x3')},'authType':{'type':Sequelize[_0xec74('0x4')]('password',_0xec74('0x5')),'defaultValue':_0xec74('0x6')},'serverUrl':{'type':Sequelize[_0xec74('0x1')]},'type':{'type':Sequelize[_0xec74('0x4')](_0xec74('0x7'),_0xec74('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xb3e9=['STRING','username','ENUM','token','integrationTab','sequelize'];(function(_0x26dd96,_0x1e70a6){var _0x1aa18f=function(_0x1e846){while(--_0x1e846){_0x26dd96['push'](_0x26dd96['shift']());}};_0x1aa18f(++_0x1e70a6);}(_0xb3e9,0x1eb));var _0x9b3e=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb3e9[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0x9b3e('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b3e('0x1')]},'description':{'type':Sequelize[_0x9b3e('0x1')]},'username':{'type':Sequelize[_0x9b3e('0x1')],'unique':_0x9b3e('0x2')},'password':{'type':Sequelize[_0x9b3e('0x1')]},'token':{'type':Sequelize[_0x9b3e('0x1')]},'remoteUri':{'type':Sequelize[_0x9b3e('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x9b3e('0x3')]('password',_0x9b3e('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x9b3e('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9133938..79fd4bb 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 _0x17ba=['findAll','rows','show','rawAttributes','include','find','update','body','params','getConfigurations','sort','hasOwnProperty','getSubjects','channel','getDescriptions','type','ZendeskConfiguration','create','ZendeskField','getFields','username','password','authType','remoteUri','GET','format','%s%s','ticket_fields','headers','%s:%s','toString','base64','token','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','position','title','system_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','ZendeskAccount,\x20%s,\x20%s','message','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','index','ZendeskAccount','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','nolimit','limit','order','where','filters','pick','add','day','merge','filter','map','options','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17ba,0xab));var _0xa17b=function(_0x4aa7db,_0x248fac){_0x4aa7db=_0x4aa7db-0x0;var _0x29ee30=_0x17ba[_0x4aa7db];return _0x29ee30;};'use strict';var pdf=require(_0xa17b('0x0'));var emlformat=require(_0xa17b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa17b('0x2'));var jsonpatch=require(_0xa17b('0x3'));var rp=require(_0xa17b('0x4'));var moment=require(_0xa17b('0x5'));var BPromise=require(_0xa17b('0x6'));var Mustache=require(_0xa17b('0x7'));var util=require(_0xa17b('0x8'));var path=require(_0xa17b('0x9'));var sox=require(_0xa17b('0xa'));var csv=require(_0xa17b('0xb'));var ejs=require(_0xa17b('0xc'));var fs=require('fs');var _=require(_0xa17b('0xd'));var squel=require(_0xa17b('0xe'));var crypto=require(_0xa17b('0xf'));var jsforce=require(_0xa17b('0x10'));var deskjs=require(_0xa17b('0x11'));var toCsv=require(_0xa17b('0xb'));var querystring=require(_0xa17b('0x12'));var Papa=require(_0xa17b('0x13'));var Redis=require('ioredis');var qs=require(_0xa17b('0x14'));var logger=require(_0xa17b('0x15'))(_0xa17b('0x16'));var utils=require(_0xa17b('0x17'));var config=require(_0xa17b('0x18'));var db=require(_0xa17b('0x19'))['db'];var integrations=require(_0xa17b('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0xa17b('0x1b')][_0xa17b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3c3a8a,_0x52b7aa,_0x3abc59,_0x3d7d46){return new BPromise(function(_0x30236c,_0xeeacaa){var _0x4a222e=_0x3d7d46||client;return _0x4a222e[_0xa17b('0x1d')](_0x3c3a8a,_0x3abc59)['then'](function(_0x25f18a){logger[_0xa17b('0x1e')]('ZendeskAccount,\x20%s,\x20%s',_0x52b7aa,_0xa17b('0x1f'));logger[_0xa17b('0x20')](_0xa17b('0x21'),_0x52b7aa,_0xa17b('0x1f'),JSON['stringify'](_0x25f18a));if(_0x25f18a[_0xa17b('0x22')]){if(_0x25f18a['error']['code']===0x1f4){logger['error'](_0xa17b('0x23'),_0x52b7aa,_0x25f18a[_0xa17b('0x22')]['message']);return _0xeeacaa(_0x25f18a[_0xa17b('0x22')][_0xa17b('0x24')]);}logger[_0xa17b('0x22')](_0xa17b('0x23'),_0x52b7aa,_0x25f18a[_0xa17b('0x22')][_0xa17b('0x24')]);return _0x30236c(_0x25f18a[_0xa17b('0x22')]['message']);}else{logger[_0xa17b('0x1e')](_0xa17b('0x23'),_0x52b7aa,_0xa17b('0x1f'));_0x30236c(_0x25f18a['result'][_0xa17b('0x24')]);}})[_0xa17b('0x25')](function(_0x24d305){logger[_0xa17b('0x22')](_0xa17b('0x23'),_0x52b7aa,_0x24d305);_0xeeacaa(_0x24d305);});});}function respondWithStatusCode(_0x3daef4,_0x52309c){_0x52309c=_0x52309c||0xcc;return function(_0x3df11f){if(_0x3df11f){return _0x3daef4['sendStatus'](_0x52309c);}return _0x3daef4[_0xa17b('0x26')](_0x52309c)[_0xa17b('0x27')]();};}function respondWithResult(_0x4ba608,_0x491764){_0x491764=_0x491764||0xc8;return function(_0x2a298c){if(_0x2a298c){return _0x4ba608[_0xa17b('0x26')](_0x491764)[_0xa17b('0x28')](_0x2a298c);}};}function respondWithFilteredResult(_0x98f802,_0x3c32a5){return function(_0x3a64f5){if(_0x3a64f5){var _0x4cd38e=_0x3a64f5[_0xa17b('0x29')],_0x47aff8=_0x3c32a5['offset'],_0x5c98fe=_0x3c32a5[_0xa17b('0x2a')]+_0x3c32a5['limit'],_0x4aad82;if(_0x5c98fe>=_0x4cd38e){_0x5c98fe=_0x4cd38e;_0x4aad82=0xc8;}else{_0x4aad82=0xce;}_0x98f802[_0xa17b('0x26')](_0x4aad82);return _0x98f802[_0xa17b('0x2b')](_0xa17b('0x2c'),_0x47aff8+'-'+_0x5c98fe+'/'+_0x4cd38e)[_0xa17b('0x28')](_0x3a64f5);}return null;};}function patchUpdates(_0x346cc2){return function(_0x3ccdb8){try{jsonpatch[_0xa17b('0x2d')](_0x3ccdb8,_0x346cc2,!![]);}catch(_0x366b47){return BPromise[_0xa17b('0x2e')](_0x366b47);}return _0x3ccdb8[_0xa17b('0x2f')]();};}function saveUpdates(_0xe84db5,_0x573585){return function(_0x57a2c4){if(_0x57a2c4){return _0x57a2c4['update'](_0xe84db5)[_0xa17b('0x30')](function(_0x11070a){return _0x11070a;});}return null;};}function removeEntity(_0x46b841,_0x2888b8){return function(_0x16dd1f){if(_0x16dd1f){return _0x16dd1f[_0xa17b('0x31')]()[_0xa17b('0x30')](function(){_0x46b841[_0xa17b('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e33bf,_0x4da126){return function(_0x34f901){if(!_0x34f901){_0x1e33bf[_0xa17b('0x32')](0x194);}return _0x34f901;};}function handleError(_0x198ceb,_0x3bde6d){_0x3bde6d=_0x3bde6d||0x1f4;return function(_0x4ec38d){logger[_0xa17b('0x22')](_0x4ec38d['stack']);if(_0x4ec38d[_0xa17b('0x33')]){delete _0x4ec38d[_0xa17b('0x33')];}_0x198ceb[_0xa17b('0x26')](_0x3bde6d)[_0xa17b('0x34')](_0x4ec38d);};}exports[_0xa17b('0x35')]=function(_0x52d775,_0x2db32a){var _0x5bb6a4={},_0x1ff7da={},_0x5a0b00={'count':0x0,'rows':[]};var _0x449faa=db[_0xa17b('0x36')]['rawAttributes'];_0x1ff7da[_0xa17b('0x37')]=_[_0xa17b('0x38')](_0x449faa);var _0x487e9a={'dateStart':_0x52d775[_0xa17b('0x39')][_0xa17b('0x3a')],'dateEnd':_0x52d775[_0xa17b('0x39')][_0xa17b('0x3b')]};delete _0x52d775[_0xa17b('0x39')]['dateStart'];delete _0x52d775[_0xa17b('0x39')]['dateEnd'];_0x1ff7da[_0xa17b('0x39')]=_['keys'](_0x52d775[_0xa17b('0x39')]);_0x1ff7da['filters']=_[_0xa17b('0x3c')](_0x1ff7da['model'],_0x1ff7da[_0xa17b('0x39')]);_0x5bb6a4['attributes']=_[_0xa17b('0x3c')](_0x1ff7da[_0xa17b('0x37')],qs[_0xa17b('0x3d')](_0x52d775[_0xa17b('0x39')][_0xa17b('0x3d')]));_0x5bb6a4[_0xa17b('0x3e')]=_0x5bb6a4[_0xa17b('0x3e')][_0xa17b('0x3f')]?_0x5bb6a4['attributes']:_0x1ff7da[_0xa17b('0x37')];if(!_0x52d775[_0xa17b('0x39')]['hasOwnProperty'](_0xa17b('0x40'))){_0x5bb6a4[_0xa17b('0x41')]=qs[_0xa17b('0x41')](_0x52d775[_0xa17b('0x39')][_0xa17b('0x41')]);_0x5bb6a4[_0xa17b('0x2a')]=qs['offset'](_0x52d775[_0xa17b('0x39')][_0xa17b('0x2a')]);}_0x5bb6a4[_0xa17b('0x42')]=qs['sort'](_0x52d775['query']['sort']);_0x5bb6a4[_0xa17b('0x43')]=qs[_0xa17b('0x44')](_[_0xa17b('0x45')](_0x52d775[_0xa17b('0x39')],_0x1ff7da[_0xa17b('0x44')]));if(_0x487e9a[_0xa17b('0x3a')]){if(_0x487e9a[_0xa17b('0x3b')]){_0x487e9a[_0xa17b('0x3b')]=moment(_0x487e9a[_0xa17b('0x3b')])[_0xa17b('0x46')](0x1,_0xa17b('0x47'));}else{_0x487e9a[_0xa17b('0x3b')]=moment(_0x487e9a['dateStart'])[_0xa17b('0x46')](0x1,_0xa17b('0x47'));}_[_0xa17b('0x48')](_0x5bb6a4[_0xa17b('0x43')],{'createdAt':{'$gte':_0x487e9a[_0xa17b('0x3a')],'$lte':_0x487e9a[_0xa17b('0x3b')]}});}if(_0x52d775['query'][_0xa17b('0x49')]){_0x5bb6a4[_0xa17b('0x43')]=_[_0xa17b('0x48')](_0x5bb6a4[_0xa17b('0x43')],{'$or':_[_0xa17b('0x4a')](_0x5bb6a4['attributes'],function(_0x27ff13){var _0x21a61e={};_0x21a61e[_0x27ff13]={'$like':'%'+_0x52d775[_0xa17b('0x39')][_0xa17b('0x49')]+'%'};return _0x21a61e;})});}_0x5bb6a4=_['merge']({},_0x5bb6a4,_0x52d775[_0xa17b('0x4b')]);var _0x318e0b={'where':_0x5bb6a4[_0xa17b('0x43')]};return db[_0xa17b('0x36')][_0xa17b('0x29')](_0x318e0b)[_0xa17b('0x30')](function(_0x342f6f){_0x5a0b00['count']=_0x342f6f;if(_0x52d775[_0xa17b('0x39')][_0xa17b('0x4c')]){_0x5bb6a4['include']=[{'all':!![]}];}return db[_0xa17b('0x36')][_0xa17b('0x4d')](_0x5bb6a4);})[_0xa17b('0x30')](function(_0x5d381a){_0x5a0b00[_0xa17b('0x4e')]=_0x5d381a;return _0x5a0b00;})[_0xa17b('0x30')](respondWithFilteredResult(_0x2db32a,_0x5bb6a4))['catch'](handleError(_0x2db32a,null));};exports[_0xa17b('0x4f')]=function(_0xe85fa,_0x529953){var _0x2950ee={'raw':![],'where':{'id':_0xe85fa['params']['id']}},_0x347436={};_0x347436[_0xa17b('0x37')]=_[_0xa17b('0x38')](db[_0xa17b('0x36')][_0xa17b('0x50')]);_0x347436[_0xa17b('0x39')]=_[_0xa17b('0x38')](_0xe85fa[_0xa17b('0x39')]);_0x347436['filters']=_[_0xa17b('0x3c')](_0x347436[_0xa17b('0x37')],_0x347436[_0xa17b('0x39')]);_0x2950ee[_0xa17b('0x3e')]=_[_0xa17b('0x3c')](_0x347436[_0xa17b('0x37')],qs[_0xa17b('0x3d')](_0xe85fa[_0xa17b('0x39')][_0xa17b('0x3d')]));_0x2950ee[_0xa17b('0x3e')]=_0x2950ee[_0xa17b('0x3e')][_0xa17b('0x3f')]?_0x2950ee[_0xa17b('0x3e')]:_0x347436['model'];if(_0xe85fa[_0xa17b('0x39')][_0xa17b('0x4c')]){_0x2950ee[_0xa17b('0x51')]=[{'all':!![]}];}_0x2950ee=_[_0xa17b('0x48')]({},_0x2950ee,_0xe85fa[_0xa17b('0x4b')]);return db[_0xa17b('0x36')][_0xa17b('0x52')](_0x2950ee)[_0xa17b('0x30')](handleEntityNotFound(_0x529953,null))[_0xa17b('0x30')](respondWithResult(_0x529953,null))['catch'](handleError(_0x529953,null));};exports['create']=function(_0x2a870d,_0x1ae9cb){return db['ZendeskAccount']['create'](_0x2a870d['body'],{})[_0xa17b('0x30')](respondWithResult(_0x1ae9cb,0xc9))[_0xa17b('0x25')](handleError(_0x1ae9cb,null));};exports[_0xa17b('0x53')]=function(_0x5c6a15,_0x301019){if(_0x5c6a15[_0xa17b('0x54')]['id']){delete _0x5c6a15['body']['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x5c6a15['params']['id']}})['then'](handleEntityNotFound(_0x301019,null))[_0xa17b('0x30')](saveUpdates(_0x5c6a15[_0xa17b('0x54')],null))[_0xa17b('0x30')](respondWithResult(_0x301019,null))[_0xa17b('0x25')](handleError(_0x301019,null));};exports[_0xa17b('0x31')]=function(_0x273671,_0x3270a0){return db['ZendeskAccount'][_0xa17b('0x52')]({'where':{'id':_0x273671[_0xa17b('0x55')]['id']}})[_0xa17b('0x30')](handleEntityNotFound(_0x3270a0,null))[_0xa17b('0x30')](removeEntity(_0x3270a0,null))[_0xa17b('0x25')](handleError(_0x3270a0,null));};exports[_0xa17b('0x56')]=function(_0x2ff5d1,_0x307727,_0x24f4aa){var _0xdf9263={};var _0x3d9a89={};var _0xef6b2e;var _0x558ef5;return db[_0xa17b('0x36')]['findOne']({'where':{'id':_0x2ff5d1[_0xa17b('0x55')]['id']}})[_0xa17b('0x30')](handleEntityNotFound(_0x307727,null))[_0xa17b('0x30')](function(_0x2ac414){if(_0x2ac414){_0xef6b2e=_0x2ac414;_0x3d9a89['model']=_[_0xa17b('0x38')](db['ZendeskConfiguration'][_0xa17b('0x50')]);_0x3d9a89['query']=_['keys'](_0x2ff5d1[_0xa17b('0x39')]);_0x3d9a89[_0xa17b('0x44')]=_['intersection'](_0x3d9a89[_0xa17b('0x37')],_0x3d9a89[_0xa17b('0x39')]);_0xdf9263['attributes']=_['intersection'](_0x3d9a89[_0xa17b('0x37')],qs[_0xa17b('0x3d')](_0x2ff5d1['query'][_0xa17b('0x3d')]));_0xdf9263[_0xa17b('0x3e')]=_0xdf9263['attributes'][_0xa17b('0x3f')]?_0xdf9263[_0xa17b('0x3e')]:_0x3d9a89[_0xa17b('0x37')];_0xdf9263[_0xa17b('0x42')]=qs[_0xa17b('0x57')](_0x2ff5d1['query'][_0xa17b('0x57')]);_0xdf9263[_0xa17b('0x43')]=qs[_0xa17b('0x44')](_[_0xa17b('0x45')](_0x2ff5d1[_0xa17b('0x39')],_0x3d9a89[_0xa17b('0x44')]));if(_0x2ff5d1[_0xa17b('0x39')][_0xa17b('0x49')]){_0xdf9263[_0xa17b('0x43')]=_[_0xa17b('0x48')](_0xdf9263['where'],{'$or':_[_0xa17b('0x4a')](_0xdf9263[_0xa17b('0x3e')],function(_0x47b7c7){var _0x5f5964={};_0x5f5964[_0x47b7c7]={'$like':'%'+_0x2ff5d1[_0xa17b('0x39')][_0xa17b('0x49')]+'%'};return _0x5f5964;})});}_0xdf9263=_[_0xa17b('0x48')]({},_0xdf9263,_0x2ff5d1[_0xa17b('0x4b')]);return _0xef6b2e[_0xa17b('0x56')](_0xdf9263);}})['then'](function(_0xf8ae5e){if(_0xf8ae5e){_0x558ef5=_0xf8ae5e[_0xa17b('0x3f')];if(!_0x2ff5d1[_0xa17b('0x39')][_0xa17b('0x58')]('nolimit')){_0xdf9263[_0xa17b('0x41')]=qs['limit'](_0x2ff5d1[_0xa17b('0x39')][_0xa17b('0x41')]);_0xdf9263[_0xa17b('0x2a')]=qs[_0xa17b('0x2a')](_0x2ff5d1[_0xa17b('0x39')]['offset']);}return _0xef6b2e[_0xa17b('0x56')](_0xdf9263);}})[_0xa17b('0x30')](function(_0x41d0ec){if(_0x41d0ec){return _0x41d0ec?{'count':_0x558ef5,'rows':_0x41d0ec}:null;}})[_0xa17b('0x30')](respondWithResult(_0x307727,null))[_0xa17b('0x25')](handleError(_0x307727,null));};exports['addConfiguration']=function(_0x3ef178,_0x36fc22,_0x5502a7){if(_0x3ef178[_0xa17b('0x54')]['id']){delete _0x3ef178[_0xa17b('0x54')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x3ef178[_0xa17b('0x55')]['id']}})[_0xa17b('0x30')](handleEntityNotFound(_0x36fc22,null))[_0xa17b('0x30')](function(_0x4eaec5){if(_0x4eaec5){_0x3ef178['body']['AccountId']=_0x4eaec5['id'];_0x3ef178[_0xa17b('0x54')]['Subjects']=integrations[_0xa17b('0x59')](_0x3ef178[_0xa17b('0x54')][_0xa17b('0x5a')],_0x3ef178[_0xa17b('0x54')]['type']);_0x3ef178['body']['Descriptions']=integrations[_0xa17b('0x5b')](_0x3ef178[_0xa17b('0x54')][_0xa17b('0x5a')],_0x3ef178[_0xa17b('0x54')][_0xa17b('0x5c')]);return db[_0xa17b('0x5d')][_0xa17b('0x5e')](_0x3ef178[_0xa17b('0x54')],{'include':[{'model':db[_0xa17b('0x5f')],'as':'Subjects'},{'model':db[_0xa17b('0x5f')],'as':'Descriptions'}]});}return null;})[_0xa17b('0x30')](respondWithResult(_0x36fc22,null))['catch'](handleError(_0x36fc22,null));};exports[_0xa17b('0x60')]=function(_0x2348f5,_0x96cafa,_0x5e1f15){return db[_0xa17b('0x36')]['findOne']({'where':{'id':_0x2348f5[_0xa17b('0x55')]['id']},'attributes':['id',_0xa17b('0x61'),_0xa17b('0x62'),'token',_0xa17b('0x63'),_0xa17b('0x64')]})[_0xa17b('0x30')](handleEntityNotFound(_0x96cafa,null))[_0xa17b('0x30')](function(_0x330476){if(_0x330476){var _0x576e36={'method':_0xa17b('0x65'),'uri':util[_0xa17b('0x66')](_0xa17b('0x67'),_0x330476[_0xa17b('0x64')],_0xa17b('0x68')),'json':!![]};switch(_0x330476['authType']){case _0xa17b('0x62'):_0x576e36[_0xa17b('0x69')]={'Authorization':util[_0xa17b('0x66')]('Basic\x20%s',new Buffer(util[_0xa17b('0x66')](_0xa17b('0x6a'),_0x330476[_0xa17b('0x61')],_0x330476[_0xa17b('0x62')]))[_0xa17b('0x6b')](_0xa17b('0x6c')))};break;case _0xa17b('0x6d'):_0x576e36[_0xa17b('0x69')]={'Authorization':util[_0xa17b('0x66')](_0xa17b('0x6e'),new Buffer(util['format'](_0xa17b('0x6f'),_0x330476['username'],_0x330476['token']))[_0xa17b('0x6b')](_0xa17b('0x6c')))};break;default:throw new db[(_0xa17b('0x70'))]['ValidationError'](_0xa17b('0x71'));}return rp(_0x576e36);}})[_0xa17b('0x30')](function(_0xe14809){if(_0xe14809){var _0x28360a=[_0xa17b('0x72'),_0xa17b('0x73'),_0xa17b('0x74'),_0xa17b('0x75')];_['remove'](_0xe14809['ticket_fields'],function(_0x353c2d){return _0x28360a['includes'](_0x353c2d[_0xa17b('0x5c')]);});return{'count':_0xe14809['ticket_fields']['length'],'rows':_[_0xa17b('0x4a')](_0xe14809['ticket_fields'],function(_0xb8b877){return{'id':_0xb8b877['id'],'name':_0xb8b877[_0xa17b('0x76')]>0x7?_0xb8b877[_0xa17b('0x77')]:_0xb8b877[_0xa17b('0x5c')],'custom':_0xb8b877[_0xa17b('0x76')]>0x7?!![]:![],'options':_0xb8b877[_0xa17b('0x78')]?_0xb8b877[_0xa17b('0x78')]:[]};})};}})[_0xa17b('0x30')](respondWithResult(_0x96cafa,null))[_0xa17b('0x25')](function(_0x3e7ea3){var _0x30d570=_0x2348f5[_0xa17b('0x39')][_0xa17b('0x79')]?0x1f4:_0x3e7ea3[_0xa17b('0x7a')]||0x1f4;logger[_0xa17b('0x22')](_0xa17b('0x7b'),'getFields',_0x30d570,JSON['stringify'](_0x3e7ea3));delete _0x3e7ea3['name'];if(_0x30d570===0x191){_0x30d570=0x190;}_0x96cafa[_0xa17b('0x26')](_0x30d570)['send'](_0x2348f5[_0xa17b('0x39')][_0xa17b('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x3e7ea3[_0xa17b('0x7a')]}:_0x3e7ea3);});}; \ No newline at end of file +var _0x7119=['reject','stack','name','send','index','ZendeskAccount','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','day','merge','where','filter','map','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','destroy','pick','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','password','token','remoteUri','GET','%s%s','ticket_fields','authType','headers','Basic\x20%s','format','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','position','title','system_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskAccount,\x20%s,\x20%s','message','result','status','end','json','offset','Content-Range','apply'];(function(_0x3e8039,_0x272ad7){var _0xf5ce7b=function(_0x331809){while(--_0x331809){_0x3e8039['push'](_0x3e8039['shift']());}};_0xf5ce7b(++_0x272ad7);}(_0x7119,0x1c7));var _0x9711=function(_0x377743,_0x584cab){_0x377743=_0x377743-0x0;var _0x30ae30=_0x7119[_0x377743];return _0x30ae30;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9711('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9711('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9711('0x2'));var moment=require(_0x9711('0x3'));var BPromise=require(_0x9711('0x4'));var Mustache=require(_0x9711('0x5'));var util=require('util');var path=require(_0x9711('0x6'));var sox=require(_0x9711('0x7'));var csv=require(_0x9711('0x8'));var ejs=require(_0x9711('0x9'));var fs=require('fs');var _=require(_0x9711('0xa'));var squel=require('squel');var crypto=require(_0x9711('0xb'));var jsforce=require(_0x9711('0xc'));var deskjs=require(_0x9711('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9711('0xe'));var Papa=require('papaparse');var Redis=require(_0x9711('0xf'));var qs=require(_0x9711('0x10'));var logger=require(_0x9711('0x11'))('api');var utils=require(_0x9711('0x12'));var config=require(_0x9711('0x13'));var db=require(_0x9711('0x14'))['db'];var integrations=require(_0x9711('0x15'));var jayson=require(_0x9711('0x16'));var client=jayson[_0x9711('0x17')][_0x9711('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x13525d,_0xdcc5ec,_0x33249b,_0x46f80a){return new BPromise(function(_0x5af4de,_0x5532b2){var _0x2c4fc0=_0x46f80a||client;return _0x2c4fc0[_0x9711('0x19')](_0x13525d,_0x33249b)[_0x9711('0x1a')](function(_0x323979){logger[_0x9711('0x1b')]('ZendeskAccount,\x20%s,\x20%s',_0xdcc5ec,_0x9711('0x1c'));logger['debug'](_0x9711('0x1d'),_0xdcc5ec,_0x9711('0x1c'),JSON[_0x9711('0x1e')](_0x323979));if(_0x323979[_0x9711('0x1f')]){if(_0x323979[_0x9711('0x1f')]['code']===0x1f4){logger['error'](_0x9711('0x20'),_0xdcc5ec,_0x323979[_0x9711('0x1f')][_0x9711('0x21')]);return _0x5532b2(_0x323979[_0x9711('0x1f')][_0x9711('0x21')]);}logger['error'](_0x9711('0x20'),_0xdcc5ec,_0x323979[_0x9711('0x1f')][_0x9711('0x21')]);return _0x5af4de(_0x323979[_0x9711('0x1f')]['message']);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0xdcc5ec,_0x9711('0x1c'));_0x5af4de(_0x323979[_0x9711('0x22')][_0x9711('0x21')]);}})['catch'](function(_0x3f3aa2){logger[_0x9711('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0xdcc5ec,_0x3f3aa2);_0x5532b2(_0x3f3aa2);});});}function respondWithStatusCode(_0x3de529,_0x5944a3){_0x5944a3=_0x5944a3||0xcc;return function(_0x2dbb58){if(_0x2dbb58){return _0x3de529['sendStatus'](_0x5944a3);}return _0x3de529[_0x9711('0x23')](_0x5944a3)[_0x9711('0x24')]();};}function respondWithResult(_0x5c64db,_0x45b401){_0x45b401=_0x45b401||0xc8;return function(_0x3b04f9){if(_0x3b04f9){return _0x5c64db[_0x9711('0x23')](_0x45b401)[_0x9711('0x25')](_0x3b04f9);}};}function respondWithFilteredResult(_0x4d2438,_0x50726b){return function(_0x42e919){if(_0x42e919){var _0x1be579=_0x42e919['count'],_0x5e3eda=_0x50726b[_0x9711('0x26')],_0x4d16e5=_0x50726b[_0x9711('0x26')]+_0x50726b['limit'],_0x493297;if(_0x4d16e5>=_0x1be579){_0x4d16e5=_0x1be579;_0x493297=0xc8;}else{_0x493297=0xce;}_0x4d2438[_0x9711('0x23')](_0x493297);return _0x4d2438['set'](_0x9711('0x27'),_0x5e3eda+'-'+_0x4d16e5+'/'+_0x1be579)[_0x9711('0x25')](_0x42e919);}return null;};}function patchUpdates(_0x5eff02){return function(_0x3fc5bb){try{jsonpatch[_0x9711('0x28')](_0x3fc5bb,_0x5eff02,!![]);}catch(_0x3c6da4){return BPromise[_0x9711('0x29')](_0x3c6da4);}return _0x3fc5bb['save']();};}function saveUpdates(_0x716c38,_0x346b70){return function(_0x211ae1){if(_0x211ae1){return _0x211ae1['update'](_0x716c38)[_0x9711('0x1a')](function(_0x143eb6){return _0x143eb6;});}return null;};}function removeEntity(_0x2e793f,_0x1c761a){return function(_0x47f8fc){if(_0x47f8fc){return _0x47f8fc['destroy']()[_0x9711('0x1a')](function(){_0x2e793f[_0x9711('0x23')](0xcc)[_0x9711('0x24')]();});}};}function handleEntityNotFound(_0x1f8af0,_0x51bac1){return function(_0x5d2f13){if(!_0x5d2f13){_0x1f8af0['sendStatus'](0x194);}return _0x5d2f13;};}function handleError(_0x4a04f9,_0x5e9670){_0x5e9670=_0x5e9670||0x1f4;return function(_0x420062){logger[_0x9711('0x1f')](_0x420062[_0x9711('0x2a')]);if(_0x420062[_0x9711('0x2b')]){delete _0x420062[_0x9711('0x2b')];}_0x4a04f9[_0x9711('0x23')](_0x5e9670)[_0x9711('0x2c')](_0x420062);};}exports[_0x9711('0x2d')]=function(_0x12ed4d,_0x1d38a9){var _0x4a526f={},_0xd18f44={},_0x3d2977={'count':0x0,'rows':[]};var _0x196efd=db[_0x9711('0x2e')][_0x9711('0x2f')];_0xd18f44[_0x9711('0x30')]=_[_0x9711('0x31')](_0x196efd);var _0x4c78b6={'dateStart':_0x12ed4d[_0x9711('0x32')][_0x9711('0x33')],'dateEnd':_0x12ed4d[_0x9711('0x32')][_0x9711('0x34')]};delete _0x12ed4d[_0x9711('0x32')][_0x9711('0x33')];delete _0x12ed4d[_0x9711('0x32')][_0x9711('0x34')];_0xd18f44[_0x9711('0x32')]=_[_0x9711('0x31')](_0x12ed4d[_0x9711('0x32')]);_0xd18f44['filters']=_[_0x9711('0x35')](_0xd18f44[_0x9711('0x30')],_0xd18f44[_0x9711('0x32')]);_0x4a526f['attributes']=_[_0x9711('0x35')](_0xd18f44['model'],qs[_0x9711('0x36')](_0x12ed4d[_0x9711('0x32')]['fields']));_0x4a526f[_0x9711('0x37')]=_0x4a526f[_0x9711('0x37')][_0x9711('0x38')]?_0x4a526f[_0x9711('0x37')]:_0xd18f44['model'];if(!_0x12ed4d[_0x9711('0x32')][_0x9711('0x39')](_0x9711('0x3a'))){_0x4a526f[_0x9711('0x3b')]=qs['limit'](_0x12ed4d['query']['limit']);_0x4a526f[_0x9711('0x26')]=qs['offset'](_0x12ed4d[_0x9711('0x32')][_0x9711('0x26')]);}_0x4a526f[_0x9711('0x3c')]=qs[_0x9711('0x3d')](_0x12ed4d[_0x9711('0x32')][_0x9711('0x3d')]);_0x4a526f['where']=qs[_0x9711('0x3e')](_['pick'](_0x12ed4d[_0x9711('0x32')],_0xd18f44[_0x9711('0x3e')]));if(_0x4c78b6[_0x9711('0x33')]){if(_0x4c78b6[_0x9711('0x34')]){_0x4c78b6[_0x9711('0x34')]=moment(_0x4c78b6[_0x9711('0x34')])['add'](0x1,_0x9711('0x3f'));}else{_0x4c78b6[_0x9711('0x34')]=moment(_0x4c78b6['dateStart'])['add'](0x1,_0x9711('0x3f'));}_[_0x9711('0x40')](_0x4a526f[_0x9711('0x41')],{'createdAt':{'$gte':_0x4c78b6[_0x9711('0x33')],'$lte':_0x4c78b6[_0x9711('0x34')]}});}if(_0x12ed4d[_0x9711('0x32')][_0x9711('0x42')]){_0x4a526f[_0x9711('0x41')]=_[_0x9711('0x40')](_0x4a526f[_0x9711('0x41')],{'$or':_[_0x9711('0x43')](_0x4a526f[_0x9711('0x37')],function(_0x41328e){var _0x5dde1e={};_0x5dde1e[_0x41328e]={'$like':'%'+_0x12ed4d['query'][_0x9711('0x42')]+'%'};return _0x5dde1e;})});}_0x4a526f=_[_0x9711('0x40')]({},_0x4a526f,_0x12ed4d[_0x9711('0x44')]);var _0x4fdca9={'where':_0x4a526f[_0x9711('0x41')]};return db[_0x9711('0x2e')][_0x9711('0x45')](_0x4fdca9)[_0x9711('0x1a')](function(_0xe00316){_0x3d2977[_0x9711('0x45')]=_0xe00316;if(_0x12ed4d['query'][_0x9711('0x46')]){_0x4a526f['include']=[{'all':!![]}];}return db[_0x9711('0x2e')][_0x9711('0x47')](_0x4a526f);})[_0x9711('0x1a')](function(_0x115930){_0x3d2977[_0x9711('0x48')]=_0x115930;return _0x3d2977;})[_0x9711('0x1a')](respondWithFilteredResult(_0x1d38a9,_0x4a526f))[_0x9711('0x49')](handleError(_0x1d38a9,null));};exports[_0x9711('0x4a')]=function(_0x5aecd2,_0x152426){var _0x28a0c3={'raw':![],'where':{'id':_0x5aecd2[_0x9711('0x4b')]['id']}},_0xac802f={};_0xac802f[_0x9711('0x30')]=_[_0x9711('0x31')](db[_0x9711('0x2e')]['rawAttributes']);_0xac802f[_0x9711('0x32')]=_[_0x9711('0x31')](_0x5aecd2[_0x9711('0x32')]);_0xac802f[_0x9711('0x3e')]=_[_0x9711('0x35')](_0xac802f['model'],_0xac802f[_0x9711('0x32')]);_0x28a0c3[_0x9711('0x37')]=_['intersection'](_0xac802f[_0x9711('0x30')],qs['fields'](_0x5aecd2[_0x9711('0x32')][_0x9711('0x36')]));_0x28a0c3['attributes']=_0x28a0c3[_0x9711('0x37')][_0x9711('0x38')]?_0x28a0c3[_0x9711('0x37')]:_0xac802f[_0x9711('0x30')];if(_0x5aecd2[_0x9711('0x32')][_0x9711('0x46')]){_0x28a0c3[_0x9711('0x4c')]=[{'all':!![]}];}_0x28a0c3=_[_0x9711('0x40')]({},_0x28a0c3,_0x5aecd2[_0x9711('0x44')]);return db[_0x9711('0x2e')][_0x9711('0x4d')](_0x28a0c3)[_0x9711('0x1a')](handleEntityNotFound(_0x152426,null))[_0x9711('0x1a')](respondWithResult(_0x152426,null))[_0x9711('0x49')](handleError(_0x152426,null));};exports['create']=function(_0x1e9c70,_0x137ba9){return db['ZendeskAccount'][_0x9711('0x4e')](_0x1e9c70[_0x9711('0x4f')],{})[_0x9711('0x1a')](respondWithResult(_0x137ba9,0xc9))['catch'](handleError(_0x137ba9,null));};exports[_0x9711('0x50')]=function(_0x4a0cb1,_0x386647){if(_0x4a0cb1[_0x9711('0x4f')]['id']){delete _0x4a0cb1['body']['id'];}return db['ZendeskAccount'][_0x9711('0x4d')]({'where':{'id':_0x4a0cb1[_0x9711('0x4b')]['id']}})[_0x9711('0x1a')](handleEntityNotFound(_0x386647,null))[_0x9711('0x1a')](saveUpdates(_0x4a0cb1['body'],null))[_0x9711('0x1a')](respondWithResult(_0x386647,null))[_0x9711('0x49')](handleError(_0x386647,null));};exports[_0x9711('0x51')]=function(_0x65c98d,_0x8721ca){return db['ZendeskAccount'][_0x9711('0x4d')]({'where':{'id':_0x65c98d[_0x9711('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8721ca,null))['then'](removeEntity(_0x8721ca,null))[_0x9711('0x49')](handleError(_0x8721ca,null));};exports['getConfigurations']=function(_0x1af416,_0x4ee031,_0x161974){var _0x1fe636={};var _0xc4f16d={};var _0xdb6575;var _0x36b503;return db[_0x9711('0x2e')]['findOne']({'where':{'id':_0x1af416[_0x9711('0x4b')]['id']}})[_0x9711('0x1a')](handleEntityNotFound(_0x4ee031,null))[_0x9711('0x1a')](function(_0x2dbdaa){if(_0x2dbdaa){_0xdb6575=_0x2dbdaa;_0xc4f16d[_0x9711('0x30')]=_[_0x9711('0x31')](db['ZendeskConfiguration'][_0x9711('0x2f')]);_0xc4f16d[_0x9711('0x32')]=_[_0x9711('0x31')](_0x1af416[_0x9711('0x32')]);_0xc4f16d[_0x9711('0x3e')]=_[_0x9711('0x35')](_0xc4f16d[_0x9711('0x30')],_0xc4f16d['query']);_0x1fe636['attributes']=_[_0x9711('0x35')](_0xc4f16d[_0x9711('0x30')],qs['fields'](_0x1af416[_0x9711('0x32')]['fields']));_0x1fe636[_0x9711('0x37')]=_0x1fe636[_0x9711('0x37')][_0x9711('0x38')]?_0x1fe636[_0x9711('0x37')]:_0xc4f16d[_0x9711('0x30')];_0x1fe636[_0x9711('0x3c')]=qs[_0x9711('0x3d')](_0x1af416[_0x9711('0x32')]['sort']);_0x1fe636[_0x9711('0x41')]=qs['filters'](_[_0x9711('0x52')](_0x1af416[_0x9711('0x32')],_0xc4f16d[_0x9711('0x3e')]));if(_0x1af416[_0x9711('0x32')][_0x9711('0x42')]){_0x1fe636['where']=_[_0x9711('0x40')](_0x1fe636[_0x9711('0x41')],{'$or':_[_0x9711('0x43')](_0x1fe636['attributes'],function(_0x253196){var _0x477666={};_0x477666[_0x253196]={'$like':'%'+_0x1af416['query'][_0x9711('0x42')]+'%'};return _0x477666;})});}_0x1fe636=_[_0x9711('0x40')]({},_0x1fe636,_0x1af416[_0x9711('0x44')]);return _0xdb6575[_0x9711('0x53')](_0x1fe636);}})['then'](function(_0x16627e){if(_0x16627e){_0x36b503=_0x16627e['length'];if(!_0x1af416[_0x9711('0x32')]['hasOwnProperty']('nolimit')){_0x1fe636[_0x9711('0x3b')]=qs[_0x9711('0x3b')](_0x1af416[_0x9711('0x32')][_0x9711('0x3b')]);_0x1fe636['offset']=qs[_0x9711('0x26')](_0x1af416[_0x9711('0x32')][_0x9711('0x26')]);}return _0xdb6575[_0x9711('0x53')](_0x1fe636);}})[_0x9711('0x1a')](function(_0x50134a){if(_0x50134a){return _0x50134a?{'count':_0x36b503,'rows':_0x50134a}:null;}})[_0x9711('0x1a')](respondWithResult(_0x4ee031,null))[_0x9711('0x49')](handleError(_0x4ee031,null));};exports[_0x9711('0x54')]=function(_0x1d64db,_0x355833,_0x3abef4){if(_0x1d64db[_0x9711('0x4f')]['id']){delete _0x1d64db[_0x9711('0x4f')]['id'];}return db[_0x9711('0x2e')][_0x9711('0x55')]({'where':{'id':_0x1d64db[_0x9711('0x4b')]['id']}})[_0x9711('0x1a')](handleEntityNotFound(_0x355833,null))[_0x9711('0x1a')](function(_0x6c64a5){if(_0x6c64a5){_0x1d64db[_0x9711('0x4f')][_0x9711('0x56')]=_0x6c64a5['id'];_0x1d64db[_0x9711('0x4f')][_0x9711('0x57')]=integrations[_0x9711('0x58')](_0x1d64db[_0x9711('0x4f')]['channel'],_0x1d64db[_0x9711('0x4f')][_0x9711('0x59')]);_0x1d64db[_0x9711('0x4f')][_0x9711('0x5a')]=integrations[_0x9711('0x5b')](_0x1d64db[_0x9711('0x4f')][_0x9711('0x5c')],_0x1d64db[_0x9711('0x4f')][_0x9711('0x59')]);return db['ZendeskConfiguration'][_0x9711('0x4e')](_0x1d64db[_0x9711('0x4f')],{'include':[{'model':db[_0x9711('0x5d')],'as':_0x9711('0x57')},{'model':db[_0x9711('0x5d')],'as':_0x9711('0x5a')}]});}return null;})['then'](respondWithResult(_0x355833,null))[_0x9711('0x49')](handleError(_0x355833,null));};exports[_0x9711('0x5e')]=function(_0x16ea4c,_0x4908d0,_0x6c958f){return db[_0x9711('0x2e')]['findOne']({'where':{'id':_0x16ea4c[_0x9711('0x4b')]['id']},'attributes':['id',_0x9711('0x5f'),_0x9711('0x60'),_0x9711('0x61'),'authType',_0x9711('0x62')]})[_0x9711('0x1a')](handleEntityNotFound(_0x4908d0,null))['then'](function(_0x192268){if(_0x192268){var _0x44d1b2={'method':_0x9711('0x63'),'uri':util['format'](_0x9711('0x64'),_0x192268[_0x9711('0x62')],_0x9711('0x65')),'json':!![]};switch(_0x192268[_0x9711('0x66')]){case'password':_0x44d1b2[_0x9711('0x67')]={'Authorization':util['format'](_0x9711('0x68'),new Buffer(util[_0x9711('0x69')](_0x9711('0x6a'),_0x192268[_0x9711('0x5f')],_0x192268[_0x9711('0x60')]))[_0x9711('0x6b')](_0x9711('0x6c')))};break;case _0x9711('0x61'):_0x44d1b2[_0x9711('0x67')]={'Authorization':util['format'](_0x9711('0x68'),new Buffer(util[_0x9711('0x69')](_0x9711('0x6d'),_0x192268[_0x9711('0x5f')],_0x192268[_0x9711('0x61')]))[_0x9711('0x6b')](_0x9711('0x6c')))};break;default:throw new db[(_0x9711('0x6e'))][(_0x9711('0x6f'))](_0x9711('0x70'));}return rp(_0x44d1b2);}})[_0x9711('0x1a')](function(_0x2dea53){if(_0x2dea53){var _0x2f017a=[_0x9711('0x71'),_0x9711('0x72'),'group',_0x9711('0x73')];_[_0x9711('0x74')](_0x2dea53[_0x9711('0x65')],function(_0x30e475){return _0x2f017a['includes'](_0x30e475[_0x9711('0x59')]);});return{'count':_0x2dea53['ticket_fields']['length'],'rows':_[_0x9711('0x43')](_0x2dea53[_0x9711('0x65')],function(_0x4f7050){return{'id':_0x4f7050['id'],'name':_0x4f7050[_0x9711('0x75')]>0x7?_0x4f7050[_0x9711('0x76')]:_0x4f7050[_0x9711('0x59')],'custom':_0x4f7050[_0x9711('0x75')]>0x7?!![]:![],'options':_0x4f7050[_0x9711('0x77')]?_0x4f7050[_0x9711('0x77')]:[]};})};}})[_0x9711('0x1a')](respondWithResult(_0x4908d0,null))[_0x9711('0x49')](function(_0x3a4d8d){var _0x40cf21=_0x16ea4c[_0x9711('0x32')][_0x9711('0x78')]?0x1f4:_0x3a4d8d[_0x9711('0x79')]||0x1f4;logger[_0x9711('0x1f')](_0x9711('0x7a'),'getFields',_0x40cf21,JSON[_0x9711('0x1e')](_0x3a4d8d));delete _0x3a4d8d['name'];if(_0x40cf21===0x191){_0x40cf21=0x190;}_0x4908d0['status'](_0x40cf21)[_0x9711('0x2c')](_0x16ea4c[_0x9711('0x32')][_0x9711('0x78')]?{'message':_0x9711('0x7b'),'statusCode':_0x3a4d8d['statusCode']}:_0x3a4d8d);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index ef1bb99..4553d8b 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 _0x648b=['moment','bluebird','request-promise','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api'];(function(_0x59522a,_0x14d1e5){var _0x30f09d=function(_0x5cab74){while(--_0x5cab74){_0x59522a['push'](_0x59522a['shift']());}};_0x30f09d(++_0x14d1e5);}(_0x648b,0xb8));var _0xb648=function(_0x3d6234,_0x7702ba){_0x3d6234=_0x3d6234-0x0;var _0x4614c=_0x648b[_0x3d6234];return _0x4614c;};'use strict';var _=require('lodash');var util=require(_0xb648('0x0'));var logger=require(_0xb648('0x1'))(_0xb648('0x2'));var moment=require(_0xb648('0x3'));var BPromise=require(_0xb648('0x4'));var rp=require(_0xb648('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xb648('0x6'));module[_0xb648('0x7')]=function(_0x5165b1,_0x2f45eb){return _0x5165b1[_0xb648('0x8')](_0xb648('0x9'),attributes,{'tableName':_0xb648('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe573=['int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise','../../components/integrations/configuration','exports','ZendeskAccount'];(function(_0xfa6229,_0x5f527d){var _0x4fab62=function(_0x59f172){while(--_0x59f172){_0xfa6229['push'](_0xfa6229['shift']());}};_0x4fab62(++_0x5f527d);}(_0xe573,0xab));var _0x3e57=function(_0x12b391,_0x4e16e6){_0x12b391=_0x12b391-0x0;var _0x286cad=_0xe573[_0x12b391];return _0x286cad;};'use strict';var _=require(_0x3e57('0x0'));var util=require(_0x3e57('0x1'));var logger=require('../../config/logger')(_0x3e57('0x2'));var moment=require(_0x3e57('0x3'));var BPromise=require(_0x3e57('0x4'));var rp=require(_0x3e57('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x3e57('0x6'));module[_0x3e57('0x7')]=function(_0x30a41b,_0x3600b7){return _0x30a41b['define'](_0x3e57('0x8'),attributes,{'tableName':_0x3e57('0x9'),'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 7ccdb31..e649a5b 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 _0x4300=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetZendeskAccount','options','raw','attributes','limit','include','map','model','catch','ZendeskAccount','find','ShowZendeskAccount','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x13f2eb,_0x49f4a0){var _0xfd6c33=function(_0x451536){while(--_0x451536){_0x13f2eb['push'](_0x13f2eb['shift']());}};_0xfd6c33(++_0x49f4a0);}(_0x4300,0x1a6));var _0x0430=function(_0x45eb08,_0x1b2743){_0x45eb08=_0x45eb08-0x0;var _0x5ca8ac=_0x4300[_0x45eb08];return _0x5ca8ac;};'use strict';var _=require(_0x0430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0430('0x1'));var db=require(_0x0430('0x2'))['db'];var utils=require(_0x0430('0x3'));var logger=require(_0x0430('0x4'))(_0x0430('0x5'));var config=require('../../config/environment');var jayson=require(_0x0430('0x6'));var client=jayson['client'][_0x0430('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b03ef,_0x2388b9,_0xc83312){return new BPromise(function(_0x408b14,_0x31964e){return client[_0x0430('0x8')](_0x5b03ef,_0xc83312)[_0x0430('0x9')](function(_0x3a9dc1){logger[_0x0430('0xa')](_0x0430('0xb'),_0x2388b9,'request\x20sent');logger[_0x0430('0xc')](_0x0430('0xd'),_0x2388b9,_0x0430('0xe'),JSON[_0x0430('0xf')](_0x3a9dc1));if(_0x3a9dc1[_0x0430('0x10')]){if(_0x3a9dc1[_0x0430('0x10')][_0x0430('0x11')]===0x1f4){logger[_0x0430('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x2388b9,_0x3a9dc1['error'][_0x0430('0x12')]);return _0x31964e(_0x3a9dc1[_0x0430('0x10')][_0x0430('0x12')]);}logger[_0x0430('0x10')](_0x0430('0xb'),_0x2388b9,_0x3a9dc1[_0x0430('0x10')][_0x0430('0x12')]);return _0x408b14(_0x3a9dc1['error'][_0x0430('0x12')]);}else{logger[_0x0430('0xa')](_0x0430('0xb'),_0x2388b9,_0x0430('0xe'));_0x408b14(_0x3a9dc1['result']['message']);}})['catch'](function(_0x54fbf8){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2388b9,_0x54fbf8);_0x31964e(_0x54fbf8);});});}exports[_0x0430('0x13')]=function(_0x2f23b9){var _0x391791=this;return new Promise(function(_0xd33c3c,_0x15d020){return db['ZendeskAccount']['findAll']({'raw':_0x2f23b9[_0x0430('0x14')]?_0x2f23b9[_0x0430('0x14')][_0x0430('0x15')]===undefined?!![]:![]:!![],'where':_0x2f23b9[_0x0430('0x14')]?_0x2f23b9['options']['where']||null:null,'attributes':_0x2f23b9[_0x0430('0x14')]?_0x2f23b9[_0x0430('0x14')][_0x0430('0x16')]||null:null,'limit':_0x2f23b9[_0x0430('0x14')]?_0x2f23b9[_0x0430('0x14')][_0x0430('0x17')]||null:null,'include':_0x2f23b9['options']?_0x2f23b9[_0x0430('0x14')][_0x0430('0x18')]?_[_0x0430('0x19')](_0x2f23b9[_0x0430('0x14')]['include'],function(_0x188b12){return{'model':db[_0x188b12[_0x0430('0x1a')]],'as':_0x188b12['as'],'attributes':_0x188b12[_0x0430('0x16')],'include':_0x188b12[_0x0430('0x18')]?_[_0x0430('0x19')](_0x188b12[_0x0430('0x18')],function(_0x345b8c){return{'model':db[_0x345b8c[_0x0430('0x1a')]],'as':_0x345b8c['as'],'attributes':_0x345b8c[_0x0430('0x16')],'include':_0x345b8c['include']?_[_0x0430('0x19')](_0x345b8c['include'],function(_0x5a79d6){return{'model':db[_0x5a79d6[_0x0430('0x1a')]],'as':_0x5a79d6['as'],'attributes':_0x5a79d6[_0x0430('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d302b){logger[_0x0430('0xa')](_0x0430('0x13'),_0x2f23b9);logger[_0x0430('0xc')](_0x0430('0x13'),_0x2f23b9,JSON[_0x0430('0xf')](_0x2d302b));_0xd33c3c(_0x2d302b);})[_0x0430('0x1b')](function(_0xd6b31a){logger[_0x0430('0x10')]('GetZendeskAccount',_0xd6b31a['message'],_0x2f23b9);_0x15d020(_0x391791['error'](0x1f4,_0xd6b31a[_0x0430('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x41645c){var _0x4bd1cf=this;return new Promise(function(_0x52d382,_0x3175f9){return db[_0x0430('0x1c')][_0x0430('0x1d')]({'raw':_0x41645c[_0x0430('0x14')]?_0x41645c['options']['raw']===undefined?!![]:![]:!![],'where':_0x41645c[_0x0430('0x14')]?_0x41645c[_0x0430('0x14')]['where']||null:null,'attributes':_0x41645c['options']?_0x41645c[_0x0430('0x14')][_0x0430('0x16')]||null:null,'include':_0x41645c[_0x0430('0x14')]?_0x41645c[_0x0430('0x14')][_0x0430('0x18')]?_[_0x0430('0x19')](_0x41645c[_0x0430('0x14')][_0x0430('0x18')],function(_0x4011bf){return{'model':db[_0x4011bf['model']],'as':_0x4011bf['as'],'attributes':_0x4011bf[_0x0430('0x16')],'include':_0x4011bf[_0x0430('0x18')]?_[_0x0430('0x19')](_0x4011bf['include'],function(_0x3bd146){return{'model':db[_0x3bd146['model']],'as':_0x3bd146['as'],'attributes':_0x3bd146[_0x0430('0x16')],'include':_0x3bd146['include']?_['map'](_0x3bd146[_0x0430('0x18')],function(_0x38e33b){return{'model':db[_0x38e33b[_0x0430('0x1a')]],'as':_0x38e33b['as'],'attributes':_0x38e33b[_0x0430('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0430('0x9')](function(_0x2aeb9c){logger['info'](_0x0430('0x1e'),_0x41645c);logger[_0x0430('0xc')](_0x0430('0x1e'),_0x41645c,JSON[_0x0430('0xf')](_0x2aeb9c));_0x52d382(_0x2aeb9c);})[_0x0430('0x1b')](function(_0x41490f){logger[_0x0430('0x10')](_0x0430('0x1e'),_0x41490f[_0x0430('0x12')],_0x41645c);_0x3175f9(_0x4bd1cf[_0x0430('0x10')](0x1f4,_0x41490f['message']));});});}; \ No newline at end of file +var _0x2738=['ZendeskAccount','findAll','options','attributes','limit','include','map','model','GetZendeskAccount','ShowZendeskAccount','find','raw','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','catch'];(function(_0x4c79db,_0x293d8f){var _0x8cc87d=function(_0x2cb98c){while(--_0x2cb98c){_0x4c79db['push'](_0x4c79db['shift']());}};_0x8cc87d(++_0x293d8f);}(_0x2738,0x1db));var _0x8273=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x2738[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x8273('0x0'));var util=require(_0x8273('0x1'));var moment=require('moment');var BPromise=require(_0x8273('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8273('0x3'));var db=require(_0x8273('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8273('0x5'))(_0x8273('0x6'));var config=require(_0x8273('0x7'));var jayson=require(_0x8273('0x8'));var client=jayson[_0x8273('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41f37c,_0xde69b2,_0x30827f){return new BPromise(function(_0x23374d,_0x11ea5b){return client['request'](_0x41f37c,_0x30827f)[_0x8273('0xa')](function(_0x306f8d){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0xde69b2,_0x8273('0xb'));logger[_0x8273('0xc')](_0x8273('0xd'),_0xde69b2,_0x8273('0xb'),JSON[_0x8273('0xe')](_0x306f8d));if(_0x306f8d[_0x8273('0xf')]){if(_0x306f8d[_0x8273('0xf')][_0x8273('0x10')]===0x1f4){logger[_0x8273('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0xde69b2,_0x306f8d['error']['message']);return _0x11ea5b(_0x306f8d['error'][_0x8273('0x11')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0xde69b2,_0x306f8d[_0x8273('0xf')][_0x8273('0x11')]);return _0x23374d(_0x306f8d[_0x8273('0xf')][_0x8273('0x11')]);}else{logger['info'](_0x8273('0x12'),_0xde69b2,_0x8273('0xb'));_0x23374d(_0x306f8d['result'][_0x8273('0x11')]);}})[_0x8273('0x13')](function(_0x5e7b3e){logger[_0x8273('0xf')](_0x8273('0x12'),_0xde69b2,_0x5e7b3e);_0x11ea5b(_0x5e7b3e);});});}exports['GetZendeskAccount']=function(_0x15357e){var _0x122173=this;return new Promise(function(_0x53a3cf,_0x1b7f6e){return db[_0x8273('0x14')][_0x8273('0x15')]({'raw':_0x15357e['options']?_0x15357e[_0x8273('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x15357e[_0x8273('0x16')]?_0x15357e['options']['where']||null:null,'attributes':_0x15357e[_0x8273('0x16')]?_0x15357e['options'][_0x8273('0x17')]||null:null,'limit':_0x15357e[_0x8273('0x16')]?_0x15357e['options'][_0x8273('0x18')]||null:null,'include':_0x15357e[_0x8273('0x16')]?_0x15357e[_0x8273('0x16')][_0x8273('0x19')]?_[_0x8273('0x1a')](_0x15357e['options'][_0x8273('0x19')],function(_0x4a5cf7){return{'model':db[_0x4a5cf7[_0x8273('0x1b')]],'as':_0x4a5cf7['as'],'attributes':_0x4a5cf7[_0x8273('0x17')],'include':_0x4a5cf7[_0x8273('0x19')]?_[_0x8273('0x1a')](_0x4a5cf7[_0x8273('0x19')],function(_0x231f33){return{'model':db[_0x231f33[_0x8273('0x1b')]],'as':_0x231f33['as'],'attributes':_0x231f33['attributes'],'include':_0x231f33[_0x8273('0x19')]?_[_0x8273('0x1a')](_0x231f33['include'],function(_0x24b324){return{'model':db[_0x24b324[_0x8273('0x1b')]],'as':_0x24b324['as'],'attributes':_0x24b324['attributes']};}):[]};}):[]};}):[]:[]})[_0x8273('0xa')](function(_0x5927f0){logger['info']('GetZendeskAccount',_0x15357e);logger[_0x8273('0xc')](_0x8273('0x1c'),_0x15357e,JSON[_0x8273('0xe')](_0x5927f0));_0x53a3cf(_0x5927f0);})['catch'](function(_0x51031f){logger[_0x8273('0xf')]('GetZendeskAccount',_0x51031f[_0x8273('0x11')],_0x15357e);_0x1b7f6e(_0x122173[_0x8273('0xf')](0x1f4,_0x51031f[_0x8273('0x11')]));});});};exports[_0x8273('0x1d')]=function(_0x1641e0){var _0x183b5e=this;return new Promise(function(_0x203d6d,_0x3dc076){return db[_0x8273('0x14')][_0x8273('0x1e')]({'raw':_0x1641e0[_0x8273('0x16')]?_0x1641e0[_0x8273('0x16')][_0x8273('0x1f')]===undefined?!![]:![]:!![],'where':_0x1641e0['options']?_0x1641e0[_0x8273('0x16')][_0x8273('0x20')]||null:null,'attributes':_0x1641e0[_0x8273('0x16')]?_0x1641e0[_0x8273('0x16')]['attributes']||null:null,'include':_0x1641e0[_0x8273('0x16')]?_0x1641e0[_0x8273('0x16')][_0x8273('0x19')]?_[_0x8273('0x1a')](_0x1641e0['options'][_0x8273('0x19')],function(_0x588c68){return{'model':db[_0x588c68[_0x8273('0x1b')]],'as':_0x588c68['as'],'attributes':_0x588c68[_0x8273('0x17')],'include':_0x588c68[_0x8273('0x19')]?_[_0x8273('0x1a')](_0x588c68[_0x8273('0x19')],function(_0x441413){return{'model':db[_0x441413[_0x8273('0x1b')]],'as':_0x441413['as'],'attributes':_0x441413['attributes'],'include':_0x441413['include']?_['map'](_0x441413[_0x8273('0x19')],function(_0x296895){return{'model':db[_0x296895[_0x8273('0x1b')]],'as':_0x296895['as'],'attributes':_0x296895[_0x8273('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8273('0xa')](function(_0x5db9c7){logger['info']('ShowZendeskAccount',_0x1641e0);logger[_0x8273('0xc')](_0x8273('0x1d'),_0x1641e0,JSON[_0x8273('0xe')](_0x5db9c7));_0x203d6d(_0x5db9c7);})[_0x8273('0x13')](function(_0x4fc6fe){logger[_0x8273('0xf')](_0x8273('0x1d'),_0x4fc6fe[_0x8273('0x11')],_0x1641e0);_0x3dc076(_0x183b5e[_0x8273('0xf')](0x1f4,_0x4fc6fe[_0x8273('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index c96fdc2..8b6b7df 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 _0x8e73=['/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index'];(function(_0xbd9ca3,_0x54c8a7){var _0x5e9a19=function(_0x414c49){while(--_0x414c49){_0xbd9ca3['push'](_0xbd9ca3['shift']());}};_0x5e9a19(++_0x54c8a7);}(_0x8e73,0x113));var _0x38e7=function(_0x1df210,_0x410367){_0x1df210=_0x1df210-0x0;var _0x42daa8=_0x8e73[_0x1df210];return _0x42daa8;};'use strict';var multer=require(_0x38e7('0x0'));var util=require(_0x38e7('0x1'));var path=require('path');var timeout=require(_0x38e7('0x2'));var express=require(_0x38e7('0x3'));var router=express[_0x38e7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x38e7('0x5'));var config=require(_0x38e7('0x6'));var controller=require(_0x38e7('0x7'));router[_0x38e7('0x8')]('/',auth[_0x38e7('0x9')](),controller[_0x38e7('0xa')]);router[_0x38e7('0x8')](_0x38e7('0xb'),auth[_0x38e7('0x9')](),controller[_0x38e7('0xc')]);router[_0x38e7('0x8')]('/:id/fields',auth[_0x38e7('0x9')](),controller['getFields']);router['get'](_0x38e7('0xd'),auth[_0x38e7('0x9')](),controller[_0x38e7('0xe')]);router[_0x38e7('0x8')](_0x38e7('0xf'),auth[_0x38e7('0x9')](),controller[_0x38e7('0x10')]);router[_0x38e7('0x8')](_0x38e7('0x11'),auth[_0x38e7('0x9')](),controller[_0x38e7('0x12')]);router[_0x38e7('0x13')]('/',auth[_0x38e7('0x9')](),controller[_0x38e7('0x14')]);router[_0x38e7('0x13')]('/:id/tags',auth[_0x38e7('0x9')](),controller['setTags']);router[_0x38e7('0x15')](_0x38e7('0xb'),auth['isAuthenticated'](),controller[_0x38e7('0x16')]);router[_0x38e7('0x17')](_0x38e7('0xb'),auth[_0x38e7('0x9')](),controller[_0x38e7('0x18')]);module[_0x38e7('0x19')]=router; \ No newline at end of file +var _0xd39b=['get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getTags','post','create','/:id/tags','/:id','delete','destroy','multer','path','connect-timeout','express','Router','../../config/environment','./intZendeskConfiguration.controller'];(function(_0x535db7,_0x1fcf20){var _0x1b54ad=function(_0x2c8ab3){while(--_0x2c8ab3){_0x535db7['push'](_0x535db7['shift']());}};_0x1b54ad(++_0x1fcf20);}(_0xd39b,0x1c5));var _0xbd39=function(_0xef745f,_0x346eeb){_0xef745f=_0xef745f-0x0;var _0x5d0498=_0xd39b[_0xef745f];return _0x5d0498;};'use strict';var multer=require(_0xbd39('0x0'));var util=require('util');var path=require(_0xbd39('0x1'));var timeout=require(_0xbd39('0x2'));var express=require(_0xbd39('0x3'));var router=express[_0xbd39('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd39('0x5'));var controller=require(_0xbd39('0x6'));router[_0xbd39('0x7')]('/',auth[_0xbd39('0x8')](),controller['index']);router[_0xbd39('0x7')]('/:id',auth[_0xbd39('0x8')](),controller[_0xbd39('0x9')]);router[_0xbd39('0x7')](_0xbd39('0xa'),auth[_0xbd39('0x8')](),controller[_0xbd39('0xb')]);router['get'](_0xbd39('0xc'),auth[_0xbd39('0x8')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xbd39('0x7')]('/:id/tags',auth['isAuthenticated'](),controller[_0xbd39('0xd')]);router[_0xbd39('0xe')]('/',auth['isAuthenticated'](),controller[_0xbd39('0xf')]);router[_0xbd39('0xe')](_0xbd39('0x10'),auth[_0xbd39('0x8')](),controller['setTags']);router['put'](_0xbd39('0x11'),auth[_0xbd39('0x8')](),controller['update']);router[_0xbd39('0x12')](_0xbd39('0x11'),auth[_0xbd39('0x8')](),controller[_0xbd39('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 5761547..3dc9352 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 _0x4b56=['exports','STRING'];(function(_0x3175c4,_0x26aaf3){var _0x2a6185=function(_0x5562d2){while(--_0x5562d2){_0x3175c4['push'](_0x3175c4['shift']());}};_0x2a6185(++_0x26aaf3);}(_0x4b56,0xb0));var _0x64b5=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0x4b56[_0x1e6659];return _0x4d16e4;};'use strict';var Sequelize=require('sequelize');module[_0x64b5('0x0')]={'name':{'type':Sequelize[_0x64b5('0x1')]},'description':{'type':Sequelize[_0x64b5('0x1')]}}; \ No newline at end of file +var _0xc93e=['STRING','sequelize'];(function(_0xd40536,_0xd6f24){var _0x4ac571=function(_0x42863a){while(--_0x42863a){_0xd40536['push'](_0xd40536['shift']());}};_0x4ac571(++_0xd6f24);}(_0xc93e,0x121));var _0xec93=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0xc93e[_0x3005d5];return _0x547c7e;};'use strict';var Sequelize=require(_0xec93('0x0'));module['exports']={'name':{'type':Sequelize[_0xec93('0x1')]},'description':{'type':Sequelize[_0xec93('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index c4875cf..e975366 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 _0xe7cf=['filter','merge','map','options','ZendeskConfiguration','findAll','rows','show','params','includeAll','include','find','create','body','getFields','findOne','ZendeskField','sort','pick','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','end','sendStatus','stack','name','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','add','day'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe7cf,0x190));var _0xfe7c=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0xe7cf[_0x256d6a];return _0x460058;};'use strict';var pdf=require(_0xfe7c('0x0'));var emlformat=require(_0xfe7c('0x1'));var rimraf=require(_0xfe7c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe7c('0x3'));var rp=require(_0xfe7c('0x4'));var moment=require(_0xfe7c('0x5'));var BPromise=require(_0xfe7c('0x6'));var Mustache=require(_0xfe7c('0x7'));var util=require(_0xfe7c('0x8'));var path=require(_0xfe7c('0x9'));var sox=require(_0xfe7c('0xa'));var csv=require('to-csv');var ejs=require(_0xfe7c('0xb'));var fs=require('fs');var _=require(_0xfe7c('0xc'));var squel=require(_0xfe7c('0xd'));var crypto=require(_0xfe7c('0xe'));var jsforce=require(_0xfe7c('0xf'));var deskjs=require(_0xfe7c('0x10'));var toCsv=require(_0xfe7c('0x11'));var querystring=require(_0xfe7c('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xfe7c('0x13'));var logger=require(_0xfe7c('0x14'))(_0xfe7c('0x15'));var utils=require(_0xfe7c('0x16'));var config=require('../../config/environment');var db=require(_0xfe7c('0x17'))['db'];var jayson=require(_0xfe7c('0x18'));var client=jayson[_0xfe7c('0x19')][_0xfe7c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x198235,_0x55c0eb,_0x48d8dd,_0xfac382){return new BPromise(function(_0x459e66,_0x43d28b){var _0x3a24eb=_0xfac382||client;return _0x3a24eb[_0xfe7c('0x1b')](_0x198235,_0x48d8dd)[_0xfe7c('0x1c')](function(_0x6cf90){logger[_0xfe7c('0x1d')](_0xfe7c('0x1e'),_0x55c0eb,_0xfe7c('0x1f'));logger[_0xfe7c('0x20')](_0xfe7c('0x21'),_0x55c0eb,_0xfe7c('0x1f'),JSON['stringify'](_0x6cf90));if(_0x6cf90[_0xfe7c('0x22')]){if(_0x6cf90[_0xfe7c('0x22')][_0xfe7c('0x23')]===0x1f4){logger['error'](_0xfe7c('0x1e'),_0x55c0eb,_0x6cf90['error']['message']);return _0x43d28b(_0x6cf90[_0xfe7c('0x22')]['message']);}logger['error'](_0xfe7c('0x1e'),_0x55c0eb,_0x6cf90['error']['message']);return _0x459e66(_0x6cf90['error']['message']);}else{logger[_0xfe7c('0x1d')](_0xfe7c('0x1e'),_0x55c0eb,'request\x20sent');_0x459e66(_0x6cf90['result'][_0xfe7c('0x24')]);}})[_0xfe7c('0x25')](function(_0x4f440b){logger[_0xfe7c('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x55c0eb,_0x4f440b);_0x43d28b(_0x4f440b);});});}function respondWithStatusCode(_0x45dae3,_0x3fcc7c){_0x3fcc7c=_0x3fcc7c||0xcc;return function(_0x2032ff){if(_0x2032ff){return _0x45dae3['sendStatus'](_0x3fcc7c);}return _0x45dae3[_0xfe7c('0x26')](_0x3fcc7c)['end']();};}function respondWithResult(_0x315913,_0x45142b){_0x45142b=_0x45142b||0xc8;return function(_0x2ebad1){if(_0x2ebad1){return _0x315913['status'](_0x45142b)['json'](_0x2ebad1);}};}function respondWithFilteredResult(_0x48ea2e,_0x8a0962){return function(_0x38bb19){if(_0x38bb19){var _0x7f3a05=_0x38bb19[_0xfe7c('0x27')],_0x29c94c=_0x8a0962[_0xfe7c('0x28')],_0x59828e=_0x8a0962['offset']+_0x8a0962[_0xfe7c('0x29')],_0xc8242a;if(_0x59828e>=_0x7f3a05){_0x59828e=_0x7f3a05;_0xc8242a=0xc8;}else{_0xc8242a=0xce;}_0x48ea2e['status'](_0xc8242a);return _0x48ea2e[_0xfe7c('0x2a')](_0xfe7c('0x2b'),_0x29c94c+'-'+_0x59828e+'/'+_0x7f3a05)[_0xfe7c('0x2c')](_0x38bb19);}return null;};}function patchUpdates(_0x32e0ea){return function(_0x22ea37){try{jsonpatch[_0xfe7c('0x2d')](_0x22ea37,_0x32e0ea,!![]);}catch(_0x3d3bfe){return BPromise['reject'](_0x3d3bfe);}return _0x22ea37[_0xfe7c('0x2e')]();};}function saveUpdates(_0x2f1d7b,_0x350792){return function(_0x20e65e){if(_0x20e65e){return _0x20e65e[_0xfe7c('0x2f')](_0x2f1d7b)[_0xfe7c('0x1c')](function(_0x3aec0e){return _0x3aec0e;});}return null;};}function removeEntity(_0x22856f,_0x5ec62){return function(_0x4923c9){if(_0x4923c9){return _0x4923c9[_0xfe7c('0x30')]()['then'](function(){_0x22856f[_0xfe7c('0x26')](0xcc)[_0xfe7c('0x31')]();});}};}function handleEntityNotFound(_0x21df77,_0x390e85){return function(_0x320363){if(!_0x320363){_0x21df77[_0xfe7c('0x32')](0x194);}return _0x320363;};}function handleError(_0x2e5ac2,_0x21e068){_0x21e068=_0x21e068||0x1f4;return function(_0x312adb){logger[_0xfe7c('0x22')](_0x312adb[_0xfe7c('0x33')]);if(_0x312adb[_0xfe7c('0x34')]){delete _0x312adb['name'];}_0x2e5ac2[_0xfe7c('0x26')](_0x21e068)['send'](_0x312adb);};}exports['index']=function(_0xdba506,_0x21ecce){var _0x39cd4b={},_0x120364={},_0x38eca7={'count':0x0,'rows':[]};var _0x87bb10=db['ZendeskConfiguration'][_0xfe7c('0x35')];_0x120364[_0xfe7c('0x36')]=_[_0xfe7c('0x37')](_0x87bb10);var _0x1e8202={'dateStart':_0xdba506[_0xfe7c('0x38')][_0xfe7c('0x39')],'dateEnd':_0xdba506[_0xfe7c('0x38')][_0xfe7c('0x3a')]};delete _0xdba506[_0xfe7c('0x38')][_0xfe7c('0x39')];delete _0xdba506[_0xfe7c('0x38')][_0xfe7c('0x3a')];_0x120364[_0xfe7c('0x38')]=_[_0xfe7c('0x37')](_0xdba506['query']);_0x120364[_0xfe7c('0x3b')]=_['intersection'](_0x120364['model'],_0x120364['query']);_0x39cd4b['attributes']=_[_0xfe7c('0x3c')](_0x120364[_0xfe7c('0x36')],qs['fields'](_0xdba506[_0xfe7c('0x38')][_0xfe7c('0x3d')]));_0x39cd4b['attributes']=_0x39cd4b[_0xfe7c('0x3e')][_0xfe7c('0x3f')]?_0x39cd4b['attributes']:_0x120364[_0xfe7c('0x36')];if(!_0xdba506['query'][_0xfe7c('0x40')](_0xfe7c('0x41'))){_0x39cd4b[_0xfe7c('0x29')]=qs[_0xfe7c('0x29')](_0xdba506[_0xfe7c('0x38')][_0xfe7c('0x29')]);_0x39cd4b[_0xfe7c('0x28')]=qs[_0xfe7c('0x28')](_0xdba506[_0xfe7c('0x38')][_0xfe7c('0x28')]);}_0x39cd4b[_0xfe7c('0x42')]=qs['sort'](_0xdba506[_0xfe7c('0x38')]['sort']);_0x39cd4b[_0xfe7c('0x43')]=qs['filters'](_['pick'](_0xdba506[_0xfe7c('0x38')],_0x120364[_0xfe7c('0x3b')]));if(_0x1e8202[_0xfe7c('0x39')]){if(_0x1e8202[_0xfe7c('0x3a')]){_0x1e8202[_0xfe7c('0x3a')]=moment(_0x1e8202[_0xfe7c('0x3a')])[_0xfe7c('0x44')](0x1,_0xfe7c('0x45'));}else{_0x1e8202[_0xfe7c('0x3a')]=moment(_0x1e8202[_0xfe7c('0x39')])[_0xfe7c('0x44')](0x1,'day');}_['merge'](_0x39cd4b[_0xfe7c('0x43')],{'createdAt':{'$gte':_0x1e8202[_0xfe7c('0x39')],'$lte':_0x1e8202['dateEnd']}});}if(_0xdba506[_0xfe7c('0x38')][_0xfe7c('0x46')]){_0x39cd4b[_0xfe7c('0x43')]=_[_0xfe7c('0x47')](_0x39cd4b[_0xfe7c('0x43')],{'$or':_[_0xfe7c('0x48')](_0x39cd4b[_0xfe7c('0x3e')],function(_0x2d28f7){var _0x44227a={};_0x44227a[_0x2d28f7]={'$like':'%'+_0xdba506[_0xfe7c('0x38')][_0xfe7c('0x46')]+'%'};return _0x44227a;})});}_0x39cd4b=_['merge']({},_0x39cd4b,_0xdba506[_0xfe7c('0x49')]);var _0x31c0e2={'where':_0x39cd4b['where']};return db['ZendeskConfiguration'][_0xfe7c('0x27')](_0x31c0e2)[_0xfe7c('0x1c')](function(_0x3229a3){_0x38eca7[_0xfe7c('0x27')]=_0x3229a3;if(_0xdba506['query']['includeAll']){_0x39cd4b['include']=[{'all':!![]}];}return db[_0xfe7c('0x4a')][_0xfe7c('0x4b')](_0x39cd4b);})[_0xfe7c('0x1c')](function(_0x382d4b){_0x38eca7[_0xfe7c('0x4c')]=_0x382d4b;return _0x38eca7;})[_0xfe7c('0x1c')](respondWithFilteredResult(_0x21ecce,_0x39cd4b))[_0xfe7c('0x25')](handleError(_0x21ecce,null));};exports[_0xfe7c('0x4d')]=function(_0x3b2d6a,_0x495118){var _0x55c16d={'raw':![],'where':{'id':_0x3b2d6a[_0xfe7c('0x4e')]['id']}},_0x1fa862={};_0x1fa862[_0xfe7c('0x36')]=_[_0xfe7c('0x37')](db[_0xfe7c('0x4a')]['rawAttributes']);_0x1fa862[_0xfe7c('0x38')]=_['keys'](_0x3b2d6a[_0xfe7c('0x38')]);_0x1fa862['filters']=_[_0xfe7c('0x3c')](_0x1fa862[_0xfe7c('0x36')],_0x1fa862[_0xfe7c('0x38')]);_0x55c16d[_0xfe7c('0x3e')]=_[_0xfe7c('0x3c')](_0x1fa862[_0xfe7c('0x36')],qs[_0xfe7c('0x3d')](_0x3b2d6a[_0xfe7c('0x38')][_0xfe7c('0x3d')]));_0x55c16d[_0xfe7c('0x3e')]=_0x55c16d[_0xfe7c('0x3e')][_0xfe7c('0x3f')]?_0x55c16d['attributes']:_0x1fa862[_0xfe7c('0x36')];if(_0x3b2d6a[_0xfe7c('0x38')][_0xfe7c('0x4f')]){_0x55c16d[_0xfe7c('0x50')]=[{'all':!![]}];}_0x55c16d=_[_0xfe7c('0x47')]({},_0x55c16d,_0x3b2d6a['options']);return db[_0xfe7c('0x4a')][_0xfe7c('0x51')](_0x55c16d)[_0xfe7c('0x1c')](handleEntityNotFound(_0x495118,null))[_0xfe7c('0x1c')](respondWithResult(_0x495118,null))[_0xfe7c('0x25')](handleError(_0x495118,null));};exports['create']=function(_0x52566e,_0x107452){return db['ZendeskConfiguration'][_0xfe7c('0x52')](_0x52566e[_0xfe7c('0x53')],{})['then'](respondWithResult(_0x107452,0xc9))[_0xfe7c('0x25')](handleError(_0x107452,null));};exports[_0xfe7c('0x2f')]=function(_0x449ade,_0x23b74c){if(_0x449ade[_0xfe7c('0x53')]['id']){delete _0x449ade['body']['id'];}return db['ZendeskConfiguration'][_0xfe7c('0x51')]({'where':{'id':_0x449ade[_0xfe7c('0x4e')]['id']}})[_0xfe7c('0x1c')](handleEntityNotFound(_0x23b74c,null))[_0xfe7c('0x1c')](saveUpdates(_0x449ade['body'],null))[_0xfe7c('0x1c')](respondWithResult(_0x23b74c,null))[_0xfe7c('0x25')](handleError(_0x23b74c,null));};exports[_0xfe7c('0x30')]=function(_0x235f5a,_0x40d4db){return db[_0xfe7c('0x4a')][_0xfe7c('0x51')]({'where':{'id':_0x235f5a[_0xfe7c('0x4e')]['id']}})[_0xfe7c('0x1c')](handleEntityNotFound(_0x40d4db,null))[_0xfe7c('0x1c')](removeEntity(_0x40d4db,null))[_0xfe7c('0x25')](handleError(_0x40d4db,null));};exports[_0xfe7c('0x54')]=function(_0x35ffe7,_0x46dc14,_0xded43e){var _0x364722={};var _0x400de0={};var _0xfd4b3d;var _0x3f8b6f;return db[_0xfe7c('0x4a')][_0xfe7c('0x55')]({'where':{'id':_0x35ffe7[_0xfe7c('0x4e')]['id']}})[_0xfe7c('0x1c')](handleEntityNotFound(_0x46dc14,null))[_0xfe7c('0x1c')](function(_0x534f1e){if(_0x534f1e){_0xfd4b3d=_0x534f1e;_0x400de0[_0xfe7c('0x36')]=_[_0xfe7c('0x37')](db[_0xfe7c('0x56')]['rawAttributes']);_0x400de0[_0xfe7c('0x38')]=_['keys'](_0x35ffe7[_0xfe7c('0x38')]);_0x400de0[_0xfe7c('0x3b')]=_[_0xfe7c('0x3c')](_0x400de0[_0xfe7c('0x36')],_0x400de0['query']);_0x364722[_0xfe7c('0x3e')]=_[_0xfe7c('0x3c')](_0x400de0[_0xfe7c('0x36')],qs[_0xfe7c('0x3d')](_0x35ffe7[_0xfe7c('0x38')][_0xfe7c('0x3d')]));_0x364722[_0xfe7c('0x3e')]=_0x364722['attributes'][_0xfe7c('0x3f')]?_0x364722[_0xfe7c('0x3e')]:_0x400de0['model'];_0x364722[_0xfe7c('0x42')]=qs[_0xfe7c('0x57')](_0x35ffe7['query'][_0xfe7c('0x57')]);_0x364722[_0xfe7c('0x43')]=qs['filters'](_[_0xfe7c('0x58')](_0x35ffe7['query'],_0x400de0[_0xfe7c('0x3b')]));if(_0x35ffe7['query'][_0xfe7c('0x46')]){_0x364722[_0xfe7c('0x43')]=_['merge'](_0x364722[_0xfe7c('0x43')],{'$or':_['map'](_0x364722['attributes'],function(_0x23207b){var _0x42066c={};_0x42066c[_0x23207b]={'$like':'%'+_0x35ffe7[_0xfe7c('0x38')][_0xfe7c('0x46')]+'%'};return _0x42066c;})});}_0x364722=_[_0xfe7c('0x47')]({},_0x364722,_0x35ffe7[_0xfe7c('0x49')]);return _0xfd4b3d[_0xfe7c('0x54')](_0x364722);}})[_0xfe7c('0x1c')](function(_0x2ad9e1){if(_0x2ad9e1){_0x3f8b6f=_0x2ad9e1[_0xfe7c('0x3f')];if(!_0x35ffe7[_0xfe7c('0x38')][_0xfe7c('0x40')](_0xfe7c('0x41'))){_0x364722[_0xfe7c('0x29')]=qs['limit'](_0x35ffe7[_0xfe7c('0x38')][_0xfe7c('0x29')]);_0x364722[_0xfe7c('0x28')]=qs[_0xfe7c('0x28')](_0x35ffe7[_0xfe7c('0x38')]['offset']);}return _0xfd4b3d[_0xfe7c('0x54')](_0x364722);}})['then'](function(_0x4058ba){if(_0x4058ba){return _0x4058ba?{'count':_0x3f8b6f,'rows':_0x4058ba}:null;}})['then'](respondWithResult(_0x46dc14,null))[_0xfe7c('0x25')](handleError(_0x46dc14,null));};exports[_0xfe7c('0x59')]=function(_0x394a7b,_0x518c9e,_0xed62e4){var _0x1dd949={};var _0x50842c={};var _0x5eea97;var _0x548318;return db[_0xfe7c('0x4a')][_0xfe7c('0x55')]({'where':{'id':_0x394a7b[_0xfe7c('0x4e')]['id']}})[_0xfe7c('0x1c')](handleEntityNotFound(_0x518c9e,null))['then'](function(_0x20f20c){if(_0x20f20c){_0x5eea97=_0x20f20c;_0x50842c[_0xfe7c('0x36')]=_[_0xfe7c('0x37')](db[_0xfe7c('0x56')][_0xfe7c('0x35')]);_0x50842c[_0xfe7c('0x38')]=_[_0xfe7c('0x37')](_0x394a7b['query']);_0x50842c[_0xfe7c('0x3b')]=_[_0xfe7c('0x3c')](_0x50842c['model'],_0x50842c[_0xfe7c('0x38')]);_0x1dd949[_0xfe7c('0x3e')]=_[_0xfe7c('0x3c')](_0x50842c[_0xfe7c('0x36')],qs[_0xfe7c('0x3d')](_0x394a7b[_0xfe7c('0x38')][_0xfe7c('0x3d')]));_0x1dd949[_0xfe7c('0x3e')]=_0x1dd949[_0xfe7c('0x3e')]['length']?_0x1dd949[_0xfe7c('0x3e')]:_0x50842c[_0xfe7c('0x36')];_0x1dd949['order']=qs[_0xfe7c('0x57')](_0x394a7b['query'][_0xfe7c('0x57')]);_0x1dd949[_0xfe7c('0x43')]=qs[_0xfe7c('0x3b')](_[_0xfe7c('0x58')](_0x394a7b[_0xfe7c('0x38')],_0x50842c[_0xfe7c('0x3b')]));if(_0x394a7b['query'][_0xfe7c('0x46')]){_0x1dd949[_0xfe7c('0x43')]=_[_0xfe7c('0x47')](_0x1dd949[_0xfe7c('0x43')],{'$or':_['map'](_0x1dd949[_0xfe7c('0x3e')],function(_0x3e48fd){var _0x26eeb4={};_0x26eeb4[_0x3e48fd]={'$like':'%'+_0x394a7b['query'][_0xfe7c('0x46')]+'%'};return _0x26eeb4;})});}_0x1dd949=_[_0xfe7c('0x47')]({},_0x1dd949,_0x394a7b['options']);return _0x5eea97[_0xfe7c('0x59')](_0x1dd949);}})[_0xfe7c('0x1c')](function(_0x5eb59e){if(_0x5eb59e){_0x548318=_0x5eb59e[_0xfe7c('0x3f')];if(!_0x394a7b['query'][_0xfe7c('0x40')](_0xfe7c('0x41'))){_0x1dd949['limit']=qs['limit'](_0x394a7b[_0xfe7c('0x38')][_0xfe7c('0x29')]);_0x1dd949['offset']=qs[_0xfe7c('0x28')](_0x394a7b[_0xfe7c('0x38')][_0xfe7c('0x28')]);}return _0x5eea97[_0xfe7c('0x59')](_0x1dd949);}})['then'](function(_0x5401e2){if(_0x5401e2){return _0x5401e2?{'count':_0x548318,'rows':_0x5401e2}:null;}})[_0xfe7c('0x1c')](respondWithResult(_0x518c9e,null))[_0xfe7c('0x25')](handleError(_0x518c9e,null));};exports[_0xfe7c('0x5a')]=function(_0x5e38de,_0x2df517,_0x1b3e4c){var _0x19fbbd={};var _0x75785d={};var _0x384185;var _0x502fc8;return db[_0xfe7c('0x4a')][_0xfe7c('0x55')]({'where':{'id':_0x5e38de[_0xfe7c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2df517,null))[_0xfe7c('0x1c')](function(_0x13ce97){if(_0x13ce97){_0x384185=_0x13ce97;_0x75785d[_0xfe7c('0x36')]=_['keys'](db[_0xfe7c('0x56')][_0xfe7c('0x35')]);_0x75785d[_0xfe7c('0x38')]=_['keys'](_0x5e38de[_0xfe7c('0x38')]);_0x75785d[_0xfe7c('0x3b')]=_[_0xfe7c('0x3c')](_0x75785d['model'],_0x75785d[_0xfe7c('0x38')]);_0x19fbbd[_0xfe7c('0x3e')]=_['intersection'](_0x75785d[_0xfe7c('0x36')],qs[_0xfe7c('0x3d')](_0x5e38de[_0xfe7c('0x38')]['fields']));_0x19fbbd[_0xfe7c('0x3e')]=_0x19fbbd['attributes'][_0xfe7c('0x3f')]?_0x19fbbd['attributes']:_0x75785d[_0xfe7c('0x36')];_0x19fbbd[_0xfe7c('0x42')]=qs[_0xfe7c('0x57')](_0x5e38de['query'][_0xfe7c('0x57')]);_0x19fbbd['where']=qs['filters'](_[_0xfe7c('0x58')](_0x5e38de[_0xfe7c('0x38')],_0x75785d[_0xfe7c('0x3b')]));if(_0x5e38de[_0xfe7c('0x38')][_0xfe7c('0x46')]){_0x19fbbd[_0xfe7c('0x43')]=_[_0xfe7c('0x47')](_0x19fbbd[_0xfe7c('0x43')],{'$or':_[_0xfe7c('0x48')](_0x19fbbd[_0xfe7c('0x3e')],function(_0x1a0a0a){var _0xaa1318={};_0xaa1318[_0x1a0a0a]={'$like':'%'+_0x5e38de['query'][_0xfe7c('0x46')]+'%'};return _0xaa1318;})});}_0x19fbbd=_[_0xfe7c('0x47')]({},_0x19fbbd,_0x5e38de['options']);return _0x384185[_0xfe7c('0x5a')](_0x19fbbd);}})[_0xfe7c('0x1c')](function(_0x859555){if(_0x859555){_0x502fc8=_0x859555['length'];if(!_0x5e38de[_0xfe7c('0x38')][_0xfe7c('0x40')](_0xfe7c('0x41'))){_0x19fbbd[_0xfe7c('0x29')]=qs[_0xfe7c('0x29')](_0x5e38de[_0xfe7c('0x38')][_0xfe7c('0x29')]);_0x19fbbd[_0xfe7c('0x28')]=qs[_0xfe7c('0x28')](_0x5e38de[_0xfe7c('0x38')][_0xfe7c('0x28')]);}return _0x384185[_0xfe7c('0x5a')](_0x19fbbd);}})[_0xfe7c('0x1c')](function(_0xfbd819){if(_0xfbd819){return _0xfbd819?{'count':_0x502fc8,'rows':_0xfbd819}:null;}})['then'](respondWithResult(_0x2df517,null))[_0xfe7c('0x25')](handleError(_0x2df517,null));};exports[_0xfe7c('0x5b')]=function(_0x162b70,_0x57f546,_0x2c9a87){var _0x6a75ab={};var _0x18b112={};var _0x5972de;var _0x434693;return db[_0xfe7c('0x4a')][_0xfe7c('0x55')]({'where':{'id':_0x162b70[_0xfe7c('0x4e')]['id']}})[_0xfe7c('0x1c')](handleEntityNotFound(_0x57f546,null))['then'](function(_0x187524){if(_0x187524){_0x5972de=_0x187524;_0x18b112[_0xfe7c('0x36')]=_['keys'](db['Tag'][_0xfe7c('0x35')]);_0x18b112[_0xfe7c('0x38')]=_[_0xfe7c('0x37')](_0x162b70[_0xfe7c('0x38')]);_0x18b112[_0xfe7c('0x3b')]=_['intersection'](_0x18b112[_0xfe7c('0x36')],_0x18b112['query']);_0x6a75ab[_0xfe7c('0x3e')]=_[_0xfe7c('0x3c')](_0x18b112[_0xfe7c('0x36')],qs['fields'](_0x162b70[_0xfe7c('0x38')][_0xfe7c('0x3d')]));_0x6a75ab[_0xfe7c('0x3e')]=_0x6a75ab[_0xfe7c('0x3e')][_0xfe7c('0x3f')]?_0x6a75ab[_0xfe7c('0x3e')]:_0x18b112[_0xfe7c('0x36')];_0x6a75ab[_0xfe7c('0x42')]=qs['sort'](_0x162b70['query'][_0xfe7c('0x57')]);_0x6a75ab[_0xfe7c('0x43')]=qs[_0xfe7c('0x3b')](_[_0xfe7c('0x58')](_0x162b70['query'],_0x18b112['filters']));if(_0x162b70['query'][_0xfe7c('0x46')]){_0x6a75ab['where']=_[_0xfe7c('0x47')](_0x6a75ab[_0xfe7c('0x43')],{'$or':_[_0xfe7c('0x48')](_0x6a75ab[_0xfe7c('0x3e')],function(_0x59cb86){var _0x10d562={};_0x10d562[_0x59cb86]={'$like':'%'+_0x162b70[_0xfe7c('0x38')]['filter']+'%'};return _0x10d562;})});}_0x6a75ab=_[_0xfe7c('0x47')]({},_0x6a75ab,_0x162b70['options']);return _0x5972de[_0xfe7c('0x5b')](_0x6a75ab);}})[_0xfe7c('0x1c')](function(_0x5c78c3){if(_0x5c78c3){_0x434693=_0x5c78c3[_0xfe7c('0x3f')];if(!_0x162b70[_0xfe7c('0x38')]['hasOwnProperty'](_0xfe7c('0x41'))){_0x6a75ab[_0xfe7c('0x29')]=qs[_0xfe7c('0x29')](_0x162b70['query'][_0xfe7c('0x29')]);_0x6a75ab[_0xfe7c('0x28')]=qs[_0xfe7c('0x28')](_0x162b70[_0xfe7c('0x38')][_0xfe7c('0x28')]);}return _0x5972de[_0xfe7c('0x5b')](_0x6a75ab);}})[_0xfe7c('0x1c')](function(_0x116d2a){if(_0x116d2a){return _0x116d2a?{'count':_0x434693,'rows':_0x116d2a}:null;}})[_0xfe7c('0x1c')](respondWithResult(_0x57f546,null))[_0xfe7c('0x25')](handleError(_0x57f546,null));};exports[_0xfe7c('0x5c')]=function(_0x41e18c,_0x4d29cf,_0x569c27){if(_0x41e18c[_0xfe7c('0x53')]['id']){delete _0x41e18c[_0xfe7c('0x53')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x41e18c[_0xfe7c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d29cf,null))['then'](function(_0x4d94cf){if(_0x4d94cf){return _0x4d94cf[_0xfe7c('0x5c')](_0x41e18c[_0xfe7c('0x53')][_0xfe7c('0x5d')]||[]);}return null;})['then'](respondWithResult(_0x4d29cf,null))[_0xfe7c('0x25')](handleError(_0x4d29cf,null));}; \ No newline at end of file +var _0x0e60=['send','index','ZendeskConfiguration','keys','query','dateStart','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','find','body','update','params','getFields','ZendeskField','rawAttributes','getSubjects','findOne','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','jayson/promise','client','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name'];(function(_0x4ce302,_0x13f899){var _0x22ac01=function(_0x188166){while(--_0x188166){_0x4ce302['push'](_0x4ce302['shift']());}};_0x22ac01(++_0x13f899);}(_0x0e60,0x146));var _0x00e6=function(_0x23c7db,_0x20fa72){_0x23c7db=_0x23c7db-0x0;var _0x5a7641=_0x0e60[_0x23c7db];return _0x5a7641;};'use strict';var pdf=require(_0x00e6('0x0'));var emlformat=require(_0x00e6('0x1'));var rimraf=require(_0x00e6('0x2'));var zipdir=require(_0x00e6('0x3'));var jsonpatch=require(_0x00e6('0x4'));var rp=require(_0x00e6('0x5'));var moment=require('moment');var BPromise=require(_0x00e6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x00e6('0x7'));var sox=require(_0x00e6('0x8'));var csv=require(_0x00e6('0x9'));var ejs=require(_0x00e6('0xa'));var fs=require('fs');var _=require(_0x00e6('0xb'));var squel=require(_0x00e6('0xc'));var crypto=require(_0x00e6('0xd'));var jsforce=require(_0x00e6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x00e6('0x9'));var querystring=require(_0x00e6('0xf'));var Papa=require(_0x00e6('0x10'));var Redis=require(_0x00e6('0x11'));var qs=require(_0x00e6('0x12'));var logger=require('../../config/logger')(_0x00e6('0x13'));var utils=require(_0x00e6('0x14'));var config=require(_0x00e6('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x00e6('0x16'));var client=jayson[_0x00e6('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b2c36,_0x2a9b3b,_0x161789,_0x6f5abe){return new BPromise(function(_0x4d0890,_0x2f1887){var _0x1bf449=_0x6f5abe||client;return _0x1bf449[_0x00e6('0x18')](_0x2b2c36,_0x161789)['then'](function(_0x44f9da){logger[_0x00e6('0x19')](_0x00e6('0x1a'),_0x2a9b3b,_0x00e6('0x1b'));logger[_0x00e6('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2a9b3b,_0x00e6('0x1b'),JSON[_0x00e6('0x1d')](_0x44f9da));if(_0x44f9da[_0x00e6('0x1e')]){if(_0x44f9da[_0x00e6('0x1e')][_0x00e6('0x1f')]===0x1f4){logger[_0x00e6('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2a9b3b,_0x44f9da[_0x00e6('0x1e')][_0x00e6('0x20')]);return _0x2f1887(_0x44f9da[_0x00e6('0x1e')]['message']);}logger[_0x00e6('0x1e')](_0x00e6('0x1a'),_0x2a9b3b,_0x44f9da[_0x00e6('0x1e')][_0x00e6('0x20')]);return _0x4d0890(_0x44f9da[_0x00e6('0x1e')][_0x00e6('0x20')]);}else{logger[_0x00e6('0x19')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2a9b3b,_0x00e6('0x1b'));_0x4d0890(_0x44f9da[_0x00e6('0x21')][_0x00e6('0x20')]);}})[_0x00e6('0x22')](function(_0x135675){logger[_0x00e6('0x1e')](_0x00e6('0x1a'),_0x2a9b3b,_0x135675);_0x2f1887(_0x135675);});});}function respondWithStatusCode(_0x4c3db7,_0x526600){_0x526600=_0x526600||0xcc;return function(_0x329f7e){if(_0x329f7e){return _0x4c3db7['sendStatus'](_0x526600);}return _0x4c3db7[_0x00e6('0x23')](_0x526600)[_0x00e6('0x24')]();};}function respondWithResult(_0x3a3370,_0x4117f9){_0x4117f9=_0x4117f9||0xc8;return function(_0x524b48){if(_0x524b48){return _0x3a3370[_0x00e6('0x23')](_0x4117f9)[_0x00e6('0x25')](_0x524b48);}};}function respondWithFilteredResult(_0x49ca2b,_0x35f3a1){return function(_0x173702){if(_0x173702){var _0x3f5c16=_0x173702[_0x00e6('0x26')],_0x1e6d02=_0x35f3a1['offset'],_0x45d2c1=_0x35f3a1[_0x00e6('0x27')]+_0x35f3a1['limit'],_0x13391a;if(_0x45d2c1>=_0x3f5c16){_0x45d2c1=_0x3f5c16;_0x13391a=0xc8;}else{_0x13391a=0xce;}_0x49ca2b[_0x00e6('0x23')](_0x13391a);return _0x49ca2b[_0x00e6('0x28')](_0x00e6('0x29'),_0x1e6d02+'-'+_0x45d2c1+'/'+_0x3f5c16)[_0x00e6('0x25')](_0x173702);}return null;};}function patchUpdates(_0x673c1){return function(_0x5e3182){try{jsonpatch[_0x00e6('0x2a')](_0x5e3182,_0x673c1,!![]);}catch(_0x22c30e){return BPromise[_0x00e6('0x2b')](_0x22c30e);}return _0x5e3182[_0x00e6('0x2c')]();};}function saveUpdates(_0x256bb1,_0x50efc9){return function(_0x3c680b){if(_0x3c680b){return _0x3c680b['update'](_0x256bb1)[_0x00e6('0x2d')](function(_0x12e875){return _0x12e875;});}return null;};}function removeEntity(_0xbd7be8,_0x5794a2){return function(_0x9f831d){if(_0x9f831d){return _0x9f831d[_0x00e6('0x2e')]()[_0x00e6('0x2d')](function(){_0xbd7be8[_0x00e6('0x23')](0xcc)[_0x00e6('0x24')]();});}};}function handleEntityNotFound(_0x5aea3d,_0x14a9e2){return function(_0x174bcd){if(!_0x174bcd){_0x5aea3d[_0x00e6('0x2f')](0x194);}return _0x174bcd;};}function handleError(_0x1eaccc,_0x42fbea){_0x42fbea=_0x42fbea||0x1f4;return function(_0x3a4395){logger[_0x00e6('0x1e')](_0x3a4395[_0x00e6('0x30')]);if(_0x3a4395[_0x00e6('0x31')]){delete _0x3a4395[_0x00e6('0x31')];}_0x1eaccc[_0x00e6('0x23')](_0x42fbea)[_0x00e6('0x32')](_0x3a4395);};}exports[_0x00e6('0x33')]=function(_0x28064e,_0x367dca){var _0x4d95c8={},_0x22a0bc={},_0x483224={'count':0x0,'rows':[]};var _0x208efd=db[_0x00e6('0x34')]['rawAttributes'];_0x22a0bc['model']=_[_0x00e6('0x35')](_0x208efd);var _0x591658={'dateStart':_0x28064e[_0x00e6('0x36')][_0x00e6('0x37')],'dateEnd':_0x28064e[_0x00e6('0x36')]['dateEnd']};delete _0x28064e[_0x00e6('0x36')][_0x00e6('0x37')];delete _0x28064e[_0x00e6('0x36')]['dateEnd'];_0x22a0bc['query']=_[_0x00e6('0x35')](_0x28064e[_0x00e6('0x36')]);_0x22a0bc[_0x00e6('0x38')]=_[_0x00e6('0x39')](_0x22a0bc['model'],_0x22a0bc[_0x00e6('0x36')]);_0x4d95c8[_0x00e6('0x3a')]=_[_0x00e6('0x39')](_0x22a0bc[_0x00e6('0x3b')],qs[_0x00e6('0x3c')](_0x28064e['query']['fields']));_0x4d95c8[_0x00e6('0x3a')]=_0x4d95c8[_0x00e6('0x3a')][_0x00e6('0x3d')]?_0x4d95c8[_0x00e6('0x3a')]:_0x22a0bc[_0x00e6('0x3b')];if(!_0x28064e[_0x00e6('0x36')][_0x00e6('0x3e')](_0x00e6('0x3f'))){_0x4d95c8[_0x00e6('0x40')]=qs['limit'](_0x28064e[_0x00e6('0x36')][_0x00e6('0x40')]);_0x4d95c8[_0x00e6('0x27')]=qs[_0x00e6('0x27')](_0x28064e[_0x00e6('0x36')][_0x00e6('0x27')]);}_0x4d95c8[_0x00e6('0x41')]=qs[_0x00e6('0x42')](_0x28064e[_0x00e6('0x36')][_0x00e6('0x42')]);_0x4d95c8[_0x00e6('0x43')]=qs[_0x00e6('0x38')](_[_0x00e6('0x44')](_0x28064e[_0x00e6('0x36')],_0x22a0bc[_0x00e6('0x38')]));if(_0x591658[_0x00e6('0x37')]){if(_0x591658[_0x00e6('0x45')]){_0x591658[_0x00e6('0x45')]=moment(_0x591658[_0x00e6('0x45')])[_0x00e6('0x46')](0x1,'day');}else{_0x591658[_0x00e6('0x45')]=moment(_0x591658['dateStart'])[_0x00e6('0x46')](0x1,_0x00e6('0x47'));}_[_0x00e6('0x48')](_0x4d95c8[_0x00e6('0x43')],{'createdAt':{'$gte':_0x591658[_0x00e6('0x37')],'$lte':_0x591658[_0x00e6('0x45')]}});}if(_0x28064e[_0x00e6('0x36')][_0x00e6('0x49')]){_0x4d95c8[_0x00e6('0x43')]=_[_0x00e6('0x48')](_0x4d95c8[_0x00e6('0x43')],{'$or':_[_0x00e6('0x4a')](_0x4d95c8[_0x00e6('0x3a')],function(_0x5a20eb){var _0x54d1b8={};_0x54d1b8[_0x5a20eb]={'$like':'%'+_0x28064e[_0x00e6('0x36')][_0x00e6('0x49')]+'%'};return _0x54d1b8;})});}_0x4d95c8=_['merge']({},_0x4d95c8,_0x28064e[_0x00e6('0x4b')]);var _0x3dfd44={'where':_0x4d95c8['where']};return db[_0x00e6('0x34')][_0x00e6('0x26')](_0x3dfd44)[_0x00e6('0x2d')](function(_0x16121d){_0x483224[_0x00e6('0x26')]=_0x16121d;if(_0x28064e[_0x00e6('0x36')][_0x00e6('0x4c')]){_0x4d95c8[_0x00e6('0x4d')]=[{'all':!![]}];}return db[_0x00e6('0x34')][_0x00e6('0x4e')](_0x4d95c8);})[_0x00e6('0x2d')](function(_0x3eab6e){_0x483224[_0x00e6('0x4f')]=_0x3eab6e;return _0x483224;})[_0x00e6('0x2d')](respondWithFilteredResult(_0x367dca,_0x4d95c8))[_0x00e6('0x22')](handleError(_0x367dca,null));};exports[_0x00e6('0x50')]=function(_0x268dce,_0x2b7cb4){var _0x59d90c={'raw':![],'where':{'id':_0x268dce['params']['id']}},_0x2a76fb={};_0x2a76fb['model']=_[_0x00e6('0x35')](db['ZendeskConfiguration']['rawAttributes']);_0x2a76fb[_0x00e6('0x36')]=_[_0x00e6('0x35')](_0x268dce[_0x00e6('0x36')]);_0x2a76fb[_0x00e6('0x38')]=_[_0x00e6('0x39')](_0x2a76fb[_0x00e6('0x3b')],_0x2a76fb[_0x00e6('0x36')]);_0x59d90c[_0x00e6('0x3a')]=_[_0x00e6('0x39')](_0x2a76fb[_0x00e6('0x3b')],qs[_0x00e6('0x3c')](_0x268dce['query'][_0x00e6('0x3c')]));_0x59d90c[_0x00e6('0x3a')]=_0x59d90c[_0x00e6('0x3a')]['length']?_0x59d90c[_0x00e6('0x3a')]:_0x2a76fb[_0x00e6('0x3b')];if(_0x268dce[_0x00e6('0x36')][_0x00e6('0x4c')]){_0x59d90c['include']=[{'all':!![]}];}_0x59d90c=_['merge']({},_0x59d90c,_0x268dce[_0x00e6('0x4b')]);return db[_0x00e6('0x34')][_0x00e6('0x51')](_0x59d90c)['then'](handleEntityNotFound(_0x2b7cb4,null))[_0x00e6('0x2d')](respondWithResult(_0x2b7cb4,null))[_0x00e6('0x22')](handleError(_0x2b7cb4,null));};exports['create']=function(_0x23098f,_0x5550ab){return db['ZendeskConfiguration']['create'](_0x23098f[_0x00e6('0x52')],{})[_0x00e6('0x2d')](respondWithResult(_0x5550ab,0xc9))[_0x00e6('0x22')](handleError(_0x5550ab,null));};exports[_0x00e6('0x53')]=function(_0x57c771,_0x2e1629){if(_0x57c771['body']['id']){delete _0x57c771['body']['id'];}return db[_0x00e6('0x34')][_0x00e6('0x51')]({'where':{'id':_0x57c771[_0x00e6('0x54')]['id']}})[_0x00e6('0x2d')](handleEntityNotFound(_0x2e1629,null))[_0x00e6('0x2d')](saveUpdates(_0x57c771[_0x00e6('0x52')],null))[_0x00e6('0x2d')](respondWithResult(_0x2e1629,null))[_0x00e6('0x22')](handleError(_0x2e1629,null));};exports['destroy']=function(_0x75aca4,_0x2a3b68){return db[_0x00e6('0x34')][_0x00e6('0x51')]({'where':{'id':_0x75aca4[_0x00e6('0x54')]['id']}})[_0x00e6('0x2d')](handleEntityNotFound(_0x2a3b68,null))['then'](removeEntity(_0x2a3b68,null))[_0x00e6('0x22')](handleError(_0x2a3b68,null));};exports[_0x00e6('0x55')]=function(_0x2c0997,_0x275fa3,_0xa1100f){var _0xf40bbb={};var _0x2985de={};var _0x1f93fd;var _0xb3925f;return db[_0x00e6('0x34')]['findOne']({'where':{'id':_0x2c0997[_0x00e6('0x54')]['id']}})[_0x00e6('0x2d')](handleEntityNotFound(_0x275fa3,null))[_0x00e6('0x2d')](function(_0x135f88){if(_0x135f88){_0x1f93fd=_0x135f88;_0x2985de[_0x00e6('0x3b')]=_[_0x00e6('0x35')](db[_0x00e6('0x56')][_0x00e6('0x57')]);_0x2985de[_0x00e6('0x36')]=_[_0x00e6('0x35')](_0x2c0997['query']);_0x2985de[_0x00e6('0x38')]=_[_0x00e6('0x39')](_0x2985de[_0x00e6('0x3b')],_0x2985de['query']);_0xf40bbb[_0x00e6('0x3a')]=_['intersection'](_0x2985de[_0x00e6('0x3b')],qs[_0x00e6('0x3c')](_0x2c0997['query'][_0x00e6('0x3c')]));_0xf40bbb[_0x00e6('0x3a')]=_0xf40bbb[_0x00e6('0x3a')][_0x00e6('0x3d')]?_0xf40bbb[_0x00e6('0x3a')]:_0x2985de[_0x00e6('0x3b')];_0xf40bbb[_0x00e6('0x41')]=qs['sort'](_0x2c0997[_0x00e6('0x36')][_0x00e6('0x42')]);_0xf40bbb[_0x00e6('0x43')]=qs[_0x00e6('0x38')](_['pick'](_0x2c0997[_0x00e6('0x36')],_0x2985de[_0x00e6('0x38')]));if(_0x2c0997[_0x00e6('0x36')][_0x00e6('0x49')]){_0xf40bbb['where']=_[_0x00e6('0x48')](_0xf40bbb[_0x00e6('0x43')],{'$or':_[_0x00e6('0x4a')](_0xf40bbb[_0x00e6('0x3a')],function(_0x24a0cc){var _0x38ccf5={};_0x38ccf5[_0x24a0cc]={'$like':'%'+_0x2c0997[_0x00e6('0x36')][_0x00e6('0x49')]+'%'};return _0x38ccf5;})});}_0xf40bbb=_[_0x00e6('0x48')]({},_0xf40bbb,_0x2c0997[_0x00e6('0x4b')]);return _0x1f93fd['getFields'](_0xf40bbb);}})[_0x00e6('0x2d')](function(_0x2f1ffa){if(_0x2f1ffa){_0xb3925f=_0x2f1ffa[_0x00e6('0x3d')];if(!_0x2c0997[_0x00e6('0x36')][_0x00e6('0x3e')](_0x00e6('0x3f'))){_0xf40bbb['limit']=qs[_0x00e6('0x40')](_0x2c0997['query'][_0x00e6('0x40')]);_0xf40bbb[_0x00e6('0x27')]=qs[_0x00e6('0x27')](_0x2c0997[_0x00e6('0x36')][_0x00e6('0x27')]);}return _0x1f93fd[_0x00e6('0x55')](_0xf40bbb);}})['then'](function(_0x3a399d){if(_0x3a399d){return _0x3a399d?{'count':_0xb3925f,'rows':_0x3a399d}:null;}})[_0x00e6('0x2d')](respondWithResult(_0x275fa3,null))['catch'](handleError(_0x275fa3,null));};exports[_0x00e6('0x58')]=function(_0x31f2ca,_0x2eff09,_0x1c2fc9){var _0x11c6b1={};var _0x2bafae={};var _0x3fd44e;var _0x218961;return db[_0x00e6('0x34')][_0x00e6('0x59')]({'where':{'id':_0x31f2ca['params']['id']}})['then'](handleEntityNotFound(_0x2eff09,null))[_0x00e6('0x2d')](function(_0x4676c6){if(_0x4676c6){_0x3fd44e=_0x4676c6;_0x2bafae['model']=_[_0x00e6('0x35')](db['ZendeskField']['rawAttributes']);_0x2bafae[_0x00e6('0x36')]=_[_0x00e6('0x35')](_0x31f2ca[_0x00e6('0x36')]);_0x2bafae[_0x00e6('0x38')]=_[_0x00e6('0x39')](_0x2bafae[_0x00e6('0x3b')],_0x2bafae['query']);_0x11c6b1[_0x00e6('0x3a')]=_[_0x00e6('0x39')](_0x2bafae[_0x00e6('0x3b')],qs['fields'](_0x31f2ca['query'][_0x00e6('0x3c')]));_0x11c6b1[_0x00e6('0x3a')]=_0x11c6b1['attributes'][_0x00e6('0x3d')]?_0x11c6b1['attributes']:_0x2bafae['model'];_0x11c6b1['order']=qs[_0x00e6('0x42')](_0x31f2ca[_0x00e6('0x36')]['sort']);_0x11c6b1['where']=qs[_0x00e6('0x38')](_['pick'](_0x31f2ca[_0x00e6('0x36')],_0x2bafae[_0x00e6('0x38')]));if(_0x31f2ca[_0x00e6('0x36')][_0x00e6('0x49')]){_0x11c6b1[_0x00e6('0x43')]=_[_0x00e6('0x48')](_0x11c6b1[_0x00e6('0x43')],{'$or':_[_0x00e6('0x4a')](_0x11c6b1[_0x00e6('0x3a')],function(_0x10e82c){var _0xb6c3a7={};_0xb6c3a7[_0x10e82c]={'$like':'%'+_0x31f2ca[_0x00e6('0x36')][_0x00e6('0x49')]+'%'};return _0xb6c3a7;})});}_0x11c6b1=_[_0x00e6('0x48')]({},_0x11c6b1,_0x31f2ca[_0x00e6('0x4b')]);return _0x3fd44e[_0x00e6('0x58')](_0x11c6b1);}})['then'](function(_0xa48568){if(_0xa48568){_0x218961=_0xa48568[_0x00e6('0x3d')];if(!_0x31f2ca[_0x00e6('0x36')][_0x00e6('0x3e')]('nolimit')){_0x11c6b1[_0x00e6('0x40')]=qs['limit'](_0x31f2ca[_0x00e6('0x36')]['limit']);_0x11c6b1[_0x00e6('0x27')]=qs['offset'](_0x31f2ca['query'][_0x00e6('0x27')]);}return _0x3fd44e[_0x00e6('0x58')](_0x11c6b1);}})[_0x00e6('0x2d')](function(_0x12e616){if(_0x12e616){return _0x12e616?{'count':_0x218961,'rows':_0x12e616}:null;}})['then'](respondWithResult(_0x2eff09,null))['catch'](handleError(_0x2eff09,null));};exports['getDescriptions']=function(_0x4e5cfd,_0x123a26,_0x301f00){var _0x875bea={};var _0x13a5b0={};var _0x139639;var _0x1203ab;return db[_0x00e6('0x34')][_0x00e6('0x59')]({'where':{'id':_0x4e5cfd[_0x00e6('0x54')]['id']}})[_0x00e6('0x2d')](handleEntityNotFound(_0x123a26,null))['then'](function(_0x46d63f){if(_0x46d63f){_0x139639=_0x46d63f;_0x13a5b0['model']=_[_0x00e6('0x35')](db[_0x00e6('0x56')]['rawAttributes']);_0x13a5b0[_0x00e6('0x36')]=_['keys'](_0x4e5cfd['query']);_0x13a5b0[_0x00e6('0x38')]=_[_0x00e6('0x39')](_0x13a5b0[_0x00e6('0x3b')],_0x13a5b0[_0x00e6('0x36')]);_0x875bea[_0x00e6('0x3a')]=_[_0x00e6('0x39')](_0x13a5b0[_0x00e6('0x3b')],qs[_0x00e6('0x3c')](_0x4e5cfd[_0x00e6('0x36')][_0x00e6('0x3c')]));_0x875bea[_0x00e6('0x3a')]=_0x875bea['attributes'][_0x00e6('0x3d')]?_0x875bea[_0x00e6('0x3a')]:_0x13a5b0['model'];_0x875bea['order']=qs[_0x00e6('0x42')](_0x4e5cfd['query'][_0x00e6('0x42')]);_0x875bea['where']=qs[_0x00e6('0x38')](_[_0x00e6('0x44')](_0x4e5cfd[_0x00e6('0x36')],_0x13a5b0[_0x00e6('0x38')]));if(_0x4e5cfd['query'][_0x00e6('0x49')]){_0x875bea[_0x00e6('0x43')]=_[_0x00e6('0x48')](_0x875bea[_0x00e6('0x43')],{'$or':_[_0x00e6('0x4a')](_0x875bea[_0x00e6('0x3a')],function(_0x4909d8){var _0x5d3d89={};_0x5d3d89[_0x4909d8]={'$like':'%'+_0x4e5cfd[_0x00e6('0x36')][_0x00e6('0x49')]+'%'};return _0x5d3d89;})});}_0x875bea=_[_0x00e6('0x48')]({},_0x875bea,_0x4e5cfd[_0x00e6('0x4b')]);return _0x139639[_0x00e6('0x5a')](_0x875bea);}})['then'](function(_0x3e00d2){if(_0x3e00d2){_0x1203ab=_0x3e00d2[_0x00e6('0x3d')];if(!_0x4e5cfd[_0x00e6('0x36')][_0x00e6('0x3e')](_0x00e6('0x3f'))){_0x875bea[_0x00e6('0x40')]=qs[_0x00e6('0x40')](_0x4e5cfd[_0x00e6('0x36')]['limit']);_0x875bea[_0x00e6('0x27')]=qs[_0x00e6('0x27')](_0x4e5cfd['query'][_0x00e6('0x27')]);}return _0x139639[_0x00e6('0x5a')](_0x875bea);}})[_0x00e6('0x2d')](function(_0x15b9c0){if(_0x15b9c0){return _0x15b9c0?{'count':_0x1203ab,'rows':_0x15b9c0}:null;}})['then'](respondWithResult(_0x123a26,null))['catch'](handleError(_0x123a26,null));};exports[_0x00e6('0x5b')]=function(_0x24a5df,_0x1dd4f5,_0x3ca10f){var _0x5ee73c={};var _0x132c5c={};var _0x22bd70;var _0x2aec54;return db[_0x00e6('0x34')][_0x00e6('0x59')]({'where':{'id':_0x24a5df[_0x00e6('0x54')]['id']}})[_0x00e6('0x2d')](handleEntityNotFound(_0x1dd4f5,null))['then'](function(_0x2fd56c){if(_0x2fd56c){_0x22bd70=_0x2fd56c;_0x132c5c[_0x00e6('0x3b')]=_[_0x00e6('0x35')](db['Tag'][_0x00e6('0x57')]);_0x132c5c[_0x00e6('0x36')]=_[_0x00e6('0x35')](_0x24a5df[_0x00e6('0x36')]);_0x132c5c[_0x00e6('0x38')]=_['intersection'](_0x132c5c[_0x00e6('0x3b')],_0x132c5c[_0x00e6('0x36')]);_0x5ee73c['attributes']=_[_0x00e6('0x39')](_0x132c5c['model'],qs[_0x00e6('0x3c')](_0x24a5df['query'][_0x00e6('0x3c')]));_0x5ee73c[_0x00e6('0x3a')]=_0x5ee73c[_0x00e6('0x3a')][_0x00e6('0x3d')]?_0x5ee73c[_0x00e6('0x3a')]:_0x132c5c[_0x00e6('0x3b')];_0x5ee73c['order']=qs['sort'](_0x24a5df[_0x00e6('0x36')][_0x00e6('0x42')]);_0x5ee73c[_0x00e6('0x43')]=qs[_0x00e6('0x38')](_[_0x00e6('0x44')](_0x24a5df['query'],_0x132c5c[_0x00e6('0x38')]));if(_0x24a5df[_0x00e6('0x36')][_0x00e6('0x49')]){_0x5ee73c[_0x00e6('0x43')]=_[_0x00e6('0x48')](_0x5ee73c['where'],{'$or':_['map'](_0x5ee73c[_0x00e6('0x3a')],function(_0x38ead3){var _0xfa43d6={};_0xfa43d6[_0x38ead3]={'$like':'%'+_0x24a5df['query'][_0x00e6('0x49')]+'%'};return _0xfa43d6;})});}_0x5ee73c=_[_0x00e6('0x48')]({},_0x5ee73c,_0x24a5df[_0x00e6('0x4b')]);return _0x22bd70[_0x00e6('0x5b')](_0x5ee73c);}})[_0x00e6('0x2d')](function(_0x422159){if(_0x422159){_0x2aec54=_0x422159[_0x00e6('0x3d')];if(!_0x24a5df[_0x00e6('0x36')]['hasOwnProperty']('nolimit')){_0x5ee73c[_0x00e6('0x40')]=qs[_0x00e6('0x40')](_0x24a5df[_0x00e6('0x36')][_0x00e6('0x40')]);_0x5ee73c[_0x00e6('0x27')]=qs['offset'](_0x24a5df[_0x00e6('0x36')][_0x00e6('0x27')]);}return _0x22bd70[_0x00e6('0x5b')](_0x5ee73c);}})[_0x00e6('0x2d')](function(_0x38e44c){if(_0x38e44c){return _0x38e44c?{'count':_0x2aec54,'rows':_0x38e44c}:null;}})[_0x00e6('0x2d')](respondWithResult(_0x1dd4f5,null))[_0x00e6('0x22')](handleError(_0x1dd4f5,null));};exports[_0x00e6('0x5c')]=function(_0x2b41ae,_0x29c78b,_0x3c6532){if(_0x2b41ae[_0x00e6('0x52')]['id']){delete _0x2b41ae[_0x00e6('0x52')]['id'];}return db[_0x00e6('0x34')][_0x00e6('0x59')]({'where':{'id':_0x2b41ae[_0x00e6('0x54')]['id']}})[_0x00e6('0x2d')](handleEntityNotFound(_0x29c78b,null))['then'](function(_0x15f619){if(_0x15f619){return _0x15f619['setTags'](_0x2b41ae[_0x00e6('0x52')][_0x00e6('0x5d')]||[]);}return null;})[_0x00e6('0x2d')](respondWithResult(_0x29c78b,null))[_0x00e6('0x22')](handleError(_0x29c78b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 79ff9f5..2abe2e3 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 _0xbb79=['bluebird','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbb79,0x1d9));var _0x9bb7=function(_0x5b093c,_0x150ce1){_0x5b093c=_0x5b093c-0x0;var _0x4e025a=_0xbb79[_0x5b093c];return _0x4e025a;};'use strict';var _=require(_0x9bb7('0x0'));var util=require(_0x9bb7('0x1'));var logger=require(_0x9bb7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9bb7('0x3'));var rp=require('request-promise');var attributes=require(_0x9bb7('0x4'));module['exports']=function(_0x131c65,_0x30044d){return _0x131c65[_0x9bb7('0x5')]('ZendeskConfiguration',attributes,{'tableName':_0x9bb7('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacb2=['util','../../config/logger','api','moment','bluebird','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x47d5ca,_0x341796){var _0xd9de9a=function(_0x29bf5a){while(--_0x29bf5a){_0x47d5ca['push'](_0x47d5ca['shift']());}};_0xd9de9a(++_0x341796);}(_0xacb2,0x95));var _0x2acb=function(_0x287c3a,_0x1b39e0){_0x287c3a=_0x287c3a-0x0;var _0x129cfd=_0xacb2[_0x287c3a];return _0x129cfd;};'use strict';var _=require(_0x2acb('0x0'));var util=require(_0x2acb('0x1'));var logger=require(_0x2acb('0x2'))(_0x2acb('0x3'));var moment=require(_0x2acb('0x4'));var BPromise=require(_0x2acb('0x5'));var rp=require('request-promise');var attributes=require(_0x2acb('0x6'));module['exports']=function(_0x481fd0,_0x2bdf6e){return _0x481fd0[_0x2acb('0x7')](_0x2acb('0x8'),attributes,{'tableName':_0x2acb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 7d54f68..916e51e 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 _0x8adb=['then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','request'];(function(_0x4a2268,_0x2c6a30){var _0x57f41a=function(_0x19274e){while(--_0x19274e){_0x4a2268['push'](_0x4a2268['shift']());}};_0x57f41a(++_0x2c6a30);}(_0x8adb,0x6f));var _0xb8ad=function(_0x5f5046,_0x4a598c){_0x5f5046=_0x5f5046-0x0;var _0x5e7f95=_0x8adb[_0x5f5046];return _0x5e7f95;};'use strict';var _=require(_0xb8ad('0x0'));var util=require('util');var moment=require(_0xb8ad('0x1'));var BPromise=require(_0xb8ad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8ad('0x3'));var db=require(_0xb8ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8ad('0x5'));var config=require(_0xb8ad('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x531d48,_0x3449c9,_0x269ee1){return new BPromise(function(_0x45fc0f,_0xca29f0){return client[_0xb8ad('0x7')](_0x531d48,_0x269ee1)[_0xb8ad('0x8')](function(_0x1c78aa){logger[_0xb8ad('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3449c9,_0xb8ad('0xa'));logger['debug'](_0xb8ad('0xb'),_0x3449c9,'request\x20sent',JSON[_0xb8ad('0xc')](_0x1c78aa));if(_0x1c78aa[_0xb8ad('0xd')]){if(_0x1c78aa[_0xb8ad('0xd')]['code']===0x1f4){logger[_0xb8ad('0xd')](_0xb8ad('0xe'),_0x3449c9,_0x1c78aa['error'][_0xb8ad('0xf')]);return _0xca29f0(_0x1c78aa[_0xb8ad('0xd')]['message']);}logger[_0xb8ad('0xd')](_0xb8ad('0xe'),_0x3449c9,_0x1c78aa[_0xb8ad('0xd')][_0xb8ad('0xf')]);return _0x45fc0f(_0x1c78aa[_0xb8ad('0xd')]['message']);}else{logger[_0xb8ad('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3449c9,'request\x20sent');_0x45fc0f(_0x1c78aa['result']['message']);}})[_0xb8ad('0x10')](function(_0x4f7adc){logger[_0xb8ad('0xd')](_0xb8ad('0xe'),_0x3449c9,_0x4f7adc);_0xca29f0(_0x4f7adc);});});} \ No newline at end of file +var _0x273b=['ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x273b,0x68));var _0xb273=function(_0x5d7ed1,_0x3c2dc2){_0x5d7ed1=_0x5d7ed1-0x0;var _0x542749=_0x273b[_0x5d7ed1];return _0x542749;};'use strict';var _=require(_0xb273('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb273('0x1'));var fs=require('fs');var Redis=require(_0xb273('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb273('0x3'));var logger=require(_0xb273('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb273('0x5'));var client=jayson[_0xb273('0x6')][_0xb273('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ce917,_0x28e1d9,_0x247f6b){return new BPromise(function(_0x580193,_0x26d145){return client[_0xb273('0x8')](_0x4ce917,_0x247f6b)['then'](function(_0x4cd304){logger[_0xb273('0x9')](_0xb273('0xa'),_0x28e1d9,'request\x20sent');logger[_0xb273('0xb')](_0xb273('0xc'),_0x28e1d9,'request\x20sent',JSON['stringify'](_0x4cd304));if(_0x4cd304['error']){if(_0x4cd304[_0xb273('0xd')][_0xb273('0xe')]===0x1f4){logger[_0xb273('0xd')](_0xb273('0xa'),_0x28e1d9,_0x4cd304[_0xb273('0xd')][_0xb273('0xf')]);return _0x26d145(_0x4cd304['error']['message']);}logger[_0xb273('0xd')](_0xb273('0xa'),_0x28e1d9,_0x4cd304['error'][_0xb273('0xf')]);return _0x580193(_0x4cd304[_0xb273('0xd')][_0xb273('0xf')]);}else{logger[_0xb273('0x9')](_0xb273('0xa'),_0x28e1d9,_0xb273('0x10'));_0x580193(_0x4cd304[_0xb273('0x11')][_0xb273('0xf')]);}})[_0xb273('0x12')](function(_0x55f6bf){logger['error'](_0xb273('0xa'),_0x28e1d9,_0x55f6bf);_0x26d145(_0x55f6bf);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 74ec7d9..635afe4 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(_0xf7e0ab,_0x846144){var _0x26e664=function(_0x5cf76b){while(--_0x5cf76b){_0xf7e0ab['push'](_0xf7e0ab['shift']());}};_0x26e664(++_0x846144);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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(_0x54b866,_0x4015db){var _0xa569b7=function(_0x5068ae){while(--_0x5068ae){_0x54b866['push'](_0x54b866['shift']());}};_0xa569b7(++_0x4015db);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 d37750a..529688b 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 _0x4522=['STRING','customVariable','BOOLEAN','ENUM','string','variable','keyValue'];(function(_0x299995,_0x54a9c4){var _0x2cc68b=function(_0x4e8705){while(--_0x4e8705){_0x299995['push'](_0x299995['shift']());}};_0x2cc68b(++_0x54a9c4);}(_0x4522,0x1a0));var _0x2452=function(_0x4e05c9,_0x2b3b5f){_0x4e05c9=_0x4e05c9-0x0;var _0x457b53=_0x4522[_0x4e05c9];return _0x457b53;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2452('0x0')](_0x2452('0x1'),_0x2452('0x2'),'customVariable',_0x2452('0x3')),'defaultValue':_0x2452('0x1')},'content':{'type':Sequelize[_0x2452('0x4')]},'key':{'type':Sequelize[_0x2452('0x4')]},'keyType':{'type':Sequelize[_0x2452('0x0')](_0x2452('0x1'),_0x2452('0x2'),_0x2452('0x5'))},'keyContent':{'type':Sequelize[_0x2452('0x4')]},'idField':{'type':Sequelize[_0x2452('0x4')]},'nameField':{'type':Sequelize[_0x2452('0x4')]},'customField':{'type':Sequelize[_0x2452('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2452('0x4')]}}; \ No newline at end of file +var _0x9348=['exports','ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x489273,_0x134129){var _0x2b4c30=function(_0x14ce7f){while(--_0x14ce7f){_0x489273['push'](_0x489273['shift']());}};_0x2b4c30(++_0x134129);}(_0x9348,0x10d));var _0x8934=function(_0x2ce6bc,_0x4837c3){_0x2ce6bc=_0x2ce6bc-0x0;var _0x457921=_0x9348[_0x2ce6bc];return _0x457921;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'type':{'type':Sequelize[_0x8934('0x2')](_0x8934('0x3'),_0x8934('0x4'),'customVariable',_0x8934('0x5')),'defaultValue':_0x8934('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8934('0x6')]},'keyType':{'type':Sequelize[_0x8934('0x2')](_0x8934('0x3'),_0x8934('0x4'),_0x8934('0x7'))},'keyContent':{'type':Sequelize[_0x8934('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8934('0x6')]},'customField':{'type':Sequelize[_0x8934('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8934('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 96919bc..c95ec4d 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 _0x8583=['path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','ZendeskField','keys','query','dateEnd','dateStart','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','where','filters','pick','add','day','merge','filter','map','includeAll','include','findAll','catch','params','rawAttributes','options','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x26af06,_0x438299){var _0x25e31d=function(_0x56799d){while(--_0x56799d){_0x26af06['push'](_0x26af06['shift']());}};_0x25e31d(++_0x438299);}(_0x8583,0x10d));var _0x3858=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8583[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x3858('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3858('0x1'));var jsonpatch=require(_0x3858('0x2'));var rp=require(_0x3858('0x3'));var moment=require('moment');var BPromise=require(_0x3858('0x4'));var Mustache=require(_0x3858('0x5'));var util=require(_0x3858('0x6'));var path=require(_0x3858('0x7'));var sox=require(_0x3858('0x8'));var csv=require(_0x3858('0x9'));var ejs=require(_0x3858('0xa'));var fs=require('fs');var _=require(_0x3858('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3858('0xc'));var deskjs=require(_0x3858('0xd'));var toCsv=require(_0x3858('0x9'));var querystring=require(_0x3858('0xe'));var Papa=require(_0x3858('0xf'));var Redis=require(_0x3858('0x10'));var qs=require(_0x3858('0x11'));var logger=require(_0x3858('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x3858('0x13'));var db=require(_0x3858('0x14'))['db'];function respondWithStatusCode(_0x17a080,_0x329a4f){_0x329a4f=_0x329a4f||0xcc;return function(_0x259a0a){if(_0x259a0a){return _0x17a080[_0x3858('0x15')](_0x329a4f);}return _0x17a080[_0x3858('0x16')](_0x329a4f)[_0x3858('0x17')]();};}function respondWithResult(_0x4ec8cb,_0x16dee3){_0x16dee3=_0x16dee3||0xc8;return function(_0x21c682){if(_0x21c682){return _0x4ec8cb[_0x3858('0x16')](_0x16dee3)[_0x3858('0x18')](_0x21c682);}};}function respondWithFilteredResult(_0x423734,_0x768675){return function(_0x117426){if(_0x117426){var _0x3a1177=_0x117426[_0x3858('0x19')],_0x2d7f3e=_0x768675[_0x3858('0x1a')],_0xbdac18=_0x768675[_0x3858('0x1a')]+_0x768675[_0x3858('0x1b')],_0x521959;if(_0xbdac18>=_0x3a1177){_0xbdac18=_0x3a1177;_0x521959=0xc8;}else{_0x521959=0xce;}_0x423734[_0x3858('0x16')](_0x521959);return _0x423734[_0x3858('0x1c')](_0x3858('0x1d'),_0x2d7f3e+'-'+_0xbdac18+'/'+_0x3a1177)['json'](_0x117426);}return null;};}function patchUpdates(_0x5a6fc8){return function(_0x3032cd){try{jsonpatch['apply'](_0x3032cd,_0x5a6fc8,!![]);}catch(_0x1b4687){return BPromise[_0x3858('0x1e')](_0x1b4687);}return _0x3032cd[_0x3858('0x1f')]();};}function saveUpdates(_0x27b2f9,_0x5a841e){return function(_0x2021ca){if(_0x2021ca){return _0x2021ca[_0x3858('0x20')](_0x27b2f9)[_0x3858('0x21')](function(_0x43a2d5){return _0x43a2d5;});}return null;};}function removeEntity(_0xe89849,_0x3865df){return function(_0xf10b70){if(_0xf10b70){return _0xf10b70[_0x3858('0x22')]()[_0x3858('0x21')](function(){_0xe89849['status'](0xcc)[_0x3858('0x17')]();});}};}function handleEntityNotFound(_0x3d2b02,_0x4838e9){return function(_0x2ff395){if(!_0x2ff395){_0x3d2b02[_0x3858('0x15')](0x194);}return _0x2ff395;};}function handleError(_0x3aa45b,_0x37e14f){_0x37e14f=_0x37e14f||0x1f4;return function(_0x2696a0){logger[_0x3858('0x23')](_0x2696a0[_0x3858('0x24')]);if(_0x2696a0[_0x3858('0x25')]){delete _0x2696a0['name'];}_0x3aa45b[_0x3858('0x16')](_0x37e14f)['send'](_0x2696a0);};}exports[_0x3858('0x26')]=function(_0x2cc0ce,_0x3cbf46){var _0x2b18c2={},_0x2a7374={},_0x2c4e7b={'count':0x0,'rows':[]};var _0x176b4c=db[_0x3858('0x27')]['rawAttributes'];_0x2a7374['model']=_[_0x3858('0x28')](_0x176b4c);var _0x4f1ee3={'dateStart':_0x2cc0ce[_0x3858('0x29')]['dateStart'],'dateEnd':_0x2cc0ce[_0x3858('0x29')][_0x3858('0x2a')]};delete _0x2cc0ce[_0x3858('0x29')][_0x3858('0x2b')];delete _0x2cc0ce['query']['dateEnd'];_0x2a7374[_0x3858('0x29')]=_['keys'](_0x2cc0ce[_0x3858('0x29')]);_0x2a7374['filters']=_['intersection'](_0x2a7374['model'],_0x2a7374[_0x3858('0x29')]);_0x2b18c2[_0x3858('0x2c')]=_[_0x3858('0x2d')](_0x2a7374[_0x3858('0x2e')],qs[_0x3858('0x2f')](_0x2cc0ce['query'][_0x3858('0x2f')]));_0x2b18c2[_0x3858('0x2c')]=_0x2b18c2[_0x3858('0x2c')][_0x3858('0x30')]?_0x2b18c2[_0x3858('0x2c')]:_0x2a7374['model'];if(!_0x2cc0ce[_0x3858('0x29')][_0x3858('0x31')](_0x3858('0x32'))){_0x2b18c2[_0x3858('0x1b')]=qs[_0x3858('0x1b')](_0x2cc0ce['query']['limit']);_0x2b18c2[_0x3858('0x1a')]=qs[_0x3858('0x1a')](_0x2cc0ce['query']['offset']);}_0x2b18c2['order']=qs['sort'](_0x2cc0ce[_0x3858('0x29')]['sort']);_0x2b18c2[_0x3858('0x33')]=qs[_0x3858('0x34')](_[_0x3858('0x35')](_0x2cc0ce[_0x3858('0x29')],_0x2a7374[_0x3858('0x34')]));if(_0x4f1ee3[_0x3858('0x2b')]){if(_0x4f1ee3['dateEnd']){_0x4f1ee3[_0x3858('0x2a')]=moment(_0x4f1ee3['dateEnd'])[_0x3858('0x36')](0x1,_0x3858('0x37'));}else{_0x4f1ee3[_0x3858('0x2a')]=moment(_0x4f1ee3[_0x3858('0x2b')])[_0x3858('0x36')](0x1,_0x3858('0x37'));}_[_0x3858('0x38')](_0x2b18c2[_0x3858('0x33')],{'createdAt':{'$gte':_0x4f1ee3[_0x3858('0x2b')],'$lte':_0x4f1ee3[_0x3858('0x2a')]}});}if(_0x2cc0ce['query'][_0x3858('0x39')]){_0x2b18c2[_0x3858('0x33')]=_['merge'](_0x2b18c2[_0x3858('0x33')],{'$or':_[_0x3858('0x3a')](_0x2b18c2[_0x3858('0x2c')],function(_0x45159c){var _0x2d0964={};_0x2d0964[_0x45159c]={'$like':'%'+_0x2cc0ce[_0x3858('0x29')][_0x3858('0x39')]+'%'};return _0x2d0964;})});}_0x2b18c2=_[_0x3858('0x38')]({},_0x2b18c2,_0x2cc0ce['options']);var _0x2b9d37={'where':_0x2b18c2[_0x3858('0x33')]};return db[_0x3858('0x27')][_0x3858('0x19')](_0x2b9d37)[_0x3858('0x21')](function(_0x308ce5){_0x2c4e7b[_0x3858('0x19')]=_0x308ce5;if(_0x2cc0ce[_0x3858('0x29')][_0x3858('0x3b')]){_0x2b18c2[_0x3858('0x3c')]=[{'all':!![]}];}return db[_0x3858('0x27')][_0x3858('0x3d')](_0x2b18c2);})[_0x3858('0x21')](function(_0xc97b33){_0x2c4e7b['rows']=_0xc97b33;return _0x2c4e7b;})[_0x3858('0x21')](respondWithFilteredResult(_0x3cbf46,_0x2b18c2))[_0x3858('0x3e')](handleError(_0x3cbf46,null));};exports['show']=function(_0x3c94dd,_0x2d981c){var _0x57beb1={'raw':!![],'where':{'id':_0x3c94dd[_0x3858('0x3f')]['id']}},_0x5995c6={};_0x5995c6[_0x3858('0x2e')]=_[_0x3858('0x28')](db['ZendeskField'][_0x3858('0x40')]);_0x5995c6[_0x3858('0x29')]=_[_0x3858('0x28')](_0x3c94dd[_0x3858('0x29')]);_0x5995c6[_0x3858('0x34')]=_[_0x3858('0x2d')](_0x5995c6[_0x3858('0x2e')],_0x5995c6[_0x3858('0x29')]);_0x57beb1['attributes']=_[_0x3858('0x2d')](_0x5995c6['model'],qs[_0x3858('0x2f')](_0x3c94dd['query'][_0x3858('0x2f')]));_0x57beb1[_0x3858('0x2c')]=_0x57beb1['attributes'][_0x3858('0x30')]?_0x57beb1[_0x3858('0x2c')]:_0x5995c6[_0x3858('0x2e')];if(_0x3c94dd[_0x3858('0x29')][_0x3858('0x3b')]){_0x57beb1['include']=[{'all':!![]}];}_0x57beb1=_[_0x3858('0x38')]({},_0x57beb1,_0x3c94dd[_0x3858('0x41')]);return db[_0x3858('0x27')][_0x3858('0x42')](_0x57beb1)[_0x3858('0x21')](handleEntityNotFound(_0x2d981c,null))[_0x3858('0x21')](respondWithResult(_0x2d981c,null))[_0x3858('0x3e')](handleError(_0x2d981c,null));};exports[_0x3858('0x43')]=function(_0x445214,_0x53256e){return db[_0x3858('0x27')]['create'](_0x445214[_0x3858('0x44')],{})[_0x3858('0x21')](respondWithResult(_0x53256e,0xc9))[_0x3858('0x3e')](handleError(_0x53256e,null));};exports[_0x3858('0x20')]=function(_0x285677,_0x56c962){if(_0x285677[_0x3858('0x44')]['id']){delete _0x285677['body']['id'];}return db[_0x3858('0x27')][_0x3858('0x42')]({'where':{'id':_0x285677[_0x3858('0x3f')]['id']}})['then'](handleEntityNotFound(_0x56c962,null))['then'](saveUpdates(_0x285677['body'],null))[_0x3858('0x21')](respondWithResult(_0x56c962,null))[_0x3858('0x3e')](handleError(_0x56c962,null));};exports[_0x3858('0x22')]=function(_0x2bf52f,_0x5e59c3){return db['ZendeskField'][_0x3858('0x42')]({'where':{'id':_0x2bf52f[_0x3858('0x3f')]['id']}})[_0x3858('0x21')](handleEntityNotFound(_0x5e59c3,null))[_0x3858('0x21')](removeEntity(_0x5e59c3,null))[_0x3858('0x3e')](handleError(_0x5e59c3,null));}; \ No newline at end of file +var _0x55e5=['update','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','add','day','merge','where','map','filter','options','count','includeAll','include','findAll','catch','show','params','ZendeskField','create','body'];(function(_0x3020ea,_0x2c71f6){var _0x2a8cc0=function(_0x16a1ec){while(--_0x16a1ec){_0x3020ea['push'](_0x3020ea['shift']());}};_0x2a8cc0(++_0x2c71f6);}(_0x55e5,0x165));var _0x555e=function(_0xc870e0,_0x3d7664){_0xc870e0=_0xc870e0-0x0;var _0x53acf7=_0x55e5[_0xc870e0];return _0x53acf7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x555e('0x0'));var rimraf=require(_0x555e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x555e('0x2'));var moment=require(_0x555e('0x3'));var BPromise=require(_0x555e('0x4'));var Mustache=require(_0x555e('0x5'));var util=require(_0x555e('0x6'));var path=require('path');var sox=require(_0x555e('0x7'));var csv=require(_0x555e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x555e('0x9'));var crypto=require(_0x555e('0xa'));var jsforce=require(_0x555e('0xb'));var deskjs=require(_0x555e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x555e('0xd'));var Papa=require(_0x555e('0xe'));var Redis=require('ioredis');var qs=require(_0x555e('0xf'));var logger=require(_0x555e('0x10'))(_0x555e('0x11'));var utils=require(_0x555e('0x12'));var config=require(_0x555e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x178861,_0x5db32d){_0x5db32d=_0x5db32d||0xcc;return function(_0x245a14){if(_0x245a14){return _0x178861['sendStatus'](_0x5db32d);}return _0x178861[_0x555e('0x14')](_0x5db32d)[_0x555e('0x15')]();};}function respondWithResult(_0x35162a,_0x4df995){_0x4df995=_0x4df995||0xc8;return function(_0x2e1d48){if(_0x2e1d48){return _0x35162a[_0x555e('0x14')](_0x4df995)[_0x555e('0x16')](_0x2e1d48);}};}function respondWithFilteredResult(_0x1a31ab,_0x5d29b5){return function(_0x283f6d){if(_0x283f6d){var _0xf84d2c=_0x283f6d['count'],_0x4a24b3=_0x5d29b5['offset'],_0xfcaf92=_0x5d29b5['offset']+_0x5d29b5[_0x555e('0x17')],_0x19a515;if(_0xfcaf92>=_0xf84d2c){_0xfcaf92=_0xf84d2c;_0x19a515=0xc8;}else{_0x19a515=0xce;}_0x1a31ab[_0x555e('0x14')](_0x19a515);return _0x1a31ab['set'](_0x555e('0x18'),_0x4a24b3+'-'+_0xfcaf92+'/'+_0xf84d2c)['json'](_0x283f6d);}return null;};}function patchUpdates(_0x2e0541){return function(_0x1a3566){try{jsonpatch[_0x555e('0x19')](_0x1a3566,_0x2e0541,!![]);}catch(_0x3cb31b){return BPromise[_0x555e('0x1a')](_0x3cb31b);}return _0x1a3566[_0x555e('0x1b')]();};}function saveUpdates(_0x338c4a,_0x164dcc){return function(_0x580b0f){if(_0x580b0f){return _0x580b0f['update'](_0x338c4a)[_0x555e('0x1c')](function(_0x525250){return _0x525250;});}return null;};}function removeEntity(_0x20948b,_0x188d5a){return function(_0x43f084){if(_0x43f084){return _0x43f084[_0x555e('0x1d')]()[_0x555e('0x1c')](function(){_0x20948b[_0x555e('0x14')](0xcc)[_0x555e('0x15')]();});}};}function handleEntityNotFound(_0xb8db92,_0x3d4736){return function(_0x52c831){if(!_0x52c831){_0xb8db92[_0x555e('0x1e')](0x194);}return _0x52c831;};}function handleError(_0x511e94,_0x3bb3be){_0x3bb3be=_0x3bb3be||0x1f4;return function(_0x3123b9){logger[_0x555e('0x1f')](_0x3123b9[_0x555e('0x20')]);if(_0x3123b9[_0x555e('0x21')]){delete _0x3123b9[_0x555e('0x21')];}_0x511e94[_0x555e('0x14')](_0x3bb3be)[_0x555e('0x22')](_0x3123b9);};}exports[_0x555e('0x23')]=function(_0x3b98ca,_0x3426be){var _0x4dbf61={},_0x95cecf={},_0xd0d553={'count':0x0,'rows':[]};var _0x5b3f69=db['ZendeskField'][_0x555e('0x24')];_0x95cecf[_0x555e('0x25')]=_[_0x555e('0x26')](_0x5b3f69);var _0x10a9b3={'dateStart':_0x3b98ca[_0x555e('0x27')][_0x555e('0x28')],'dateEnd':_0x3b98ca[_0x555e('0x27')][_0x555e('0x29')]};delete _0x3b98ca[_0x555e('0x27')][_0x555e('0x28')];delete _0x3b98ca['query']['dateEnd'];_0x95cecf[_0x555e('0x27')]=_[_0x555e('0x26')](_0x3b98ca[_0x555e('0x27')]);_0x95cecf[_0x555e('0x2a')]=_[_0x555e('0x2b')](_0x95cecf[_0x555e('0x25')],_0x95cecf['query']);_0x4dbf61[_0x555e('0x2c')]=_['intersection'](_0x95cecf[_0x555e('0x25')],qs[_0x555e('0x2d')](_0x3b98ca[_0x555e('0x27')][_0x555e('0x2d')]));_0x4dbf61[_0x555e('0x2c')]=_0x4dbf61[_0x555e('0x2c')][_0x555e('0x2e')]?_0x4dbf61[_0x555e('0x2c')]:_0x95cecf[_0x555e('0x25')];if(!_0x3b98ca[_0x555e('0x27')][_0x555e('0x2f')](_0x555e('0x30'))){_0x4dbf61[_0x555e('0x17')]=qs[_0x555e('0x17')](_0x3b98ca[_0x555e('0x27')][_0x555e('0x17')]);_0x4dbf61[_0x555e('0x31')]=qs['offset'](_0x3b98ca[_0x555e('0x27')][_0x555e('0x31')]);}_0x4dbf61['order']=qs['sort'](_0x3b98ca[_0x555e('0x27')][_0x555e('0x32')]);_0x4dbf61['where']=qs[_0x555e('0x2a')](_[_0x555e('0x33')](_0x3b98ca[_0x555e('0x27')],_0x95cecf[_0x555e('0x2a')]));if(_0x10a9b3[_0x555e('0x28')]){if(_0x10a9b3[_0x555e('0x29')]){_0x10a9b3[_0x555e('0x29')]=moment(_0x10a9b3[_0x555e('0x29')])[_0x555e('0x34')](0x1,_0x555e('0x35'));}else{_0x10a9b3[_0x555e('0x29')]=moment(_0x10a9b3[_0x555e('0x28')])['add'](0x1,_0x555e('0x35'));}_[_0x555e('0x36')](_0x4dbf61[_0x555e('0x37')],{'createdAt':{'$gte':_0x10a9b3[_0x555e('0x28')],'$lte':_0x10a9b3['dateEnd']}});}if(_0x3b98ca[_0x555e('0x27')]['filter']){_0x4dbf61[_0x555e('0x37')]=_[_0x555e('0x36')](_0x4dbf61[_0x555e('0x37')],{'$or':_[_0x555e('0x38')](_0x4dbf61[_0x555e('0x2c')],function(_0x1a0db9){var _0x524a9f={};_0x524a9f[_0x1a0db9]={'$like':'%'+_0x3b98ca[_0x555e('0x27')][_0x555e('0x39')]+'%'};return _0x524a9f;})});}_0x4dbf61=_[_0x555e('0x36')]({},_0x4dbf61,_0x3b98ca[_0x555e('0x3a')]);var _0x484c35={'where':_0x4dbf61[_0x555e('0x37')]};return db['ZendeskField'][_0x555e('0x3b')](_0x484c35)['then'](function(_0x309588){_0xd0d553[_0x555e('0x3b')]=_0x309588;if(_0x3b98ca[_0x555e('0x27')][_0x555e('0x3c')]){_0x4dbf61[_0x555e('0x3d')]=[{'all':!![]}];}return db['ZendeskField'][_0x555e('0x3e')](_0x4dbf61);})[_0x555e('0x1c')](function(_0x49c7c1){_0xd0d553['rows']=_0x49c7c1;return _0xd0d553;})['then'](respondWithFilteredResult(_0x3426be,_0x4dbf61))[_0x555e('0x3f')](handleError(_0x3426be,null));};exports[_0x555e('0x40')]=function(_0x40da7d,_0x426b46){var _0x2e2b6b={'raw':!![],'where':{'id':_0x40da7d[_0x555e('0x41')]['id']}},_0x3abd25={};_0x3abd25[_0x555e('0x25')]=_[_0x555e('0x26')](db[_0x555e('0x42')][_0x555e('0x24')]);_0x3abd25[_0x555e('0x27')]=_['keys'](_0x40da7d[_0x555e('0x27')]);_0x3abd25[_0x555e('0x2a')]=_[_0x555e('0x2b')](_0x3abd25['model'],_0x3abd25[_0x555e('0x27')]);_0x2e2b6b[_0x555e('0x2c')]=_[_0x555e('0x2b')](_0x3abd25[_0x555e('0x25')],qs[_0x555e('0x2d')](_0x40da7d[_0x555e('0x27')][_0x555e('0x2d')]));_0x2e2b6b[_0x555e('0x2c')]=_0x2e2b6b[_0x555e('0x2c')][_0x555e('0x2e')]?_0x2e2b6b['attributes']:_0x3abd25[_0x555e('0x25')];if(_0x40da7d[_0x555e('0x27')][_0x555e('0x3c')]){_0x2e2b6b[_0x555e('0x3d')]=[{'all':!![]}];}_0x2e2b6b=_[_0x555e('0x36')]({},_0x2e2b6b,_0x40da7d['options']);return db['ZendeskField']['find'](_0x2e2b6b)[_0x555e('0x1c')](handleEntityNotFound(_0x426b46,null))['then'](respondWithResult(_0x426b46,null))[_0x555e('0x3f')](handleError(_0x426b46,null));};exports[_0x555e('0x43')]=function(_0x3c6804,_0x4144ed){return db[_0x555e('0x42')][_0x555e('0x43')](_0x3c6804[_0x555e('0x44')],{})[_0x555e('0x1c')](respondWithResult(_0x4144ed,0xc9))[_0x555e('0x3f')](handleError(_0x4144ed,null));};exports[_0x555e('0x45')]=function(_0xf3f073,_0x33a3ae){if(_0xf3f073[_0x555e('0x44')]['id']){delete _0xf3f073[_0x555e('0x44')]['id'];}return db[_0x555e('0x42')][_0x555e('0x46')]({'where':{'id':_0xf3f073[_0x555e('0x41')]['id']}})[_0x555e('0x1c')](handleEntityNotFound(_0x33a3ae,null))[_0x555e('0x1c')](saveUpdates(_0xf3f073[_0x555e('0x44')],null))[_0x555e('0x1c')](respondWithResult(_0x33a3ae,null))[_0x555e('0x3f')](handleError(_0x33a3ae,null));};exports['destroy']=function(_0x2d6dc9,_0x4dbb55){return db[_0x555e('0x42')][_0x555e('0x46')]({'where':{'id':_0x2d6dc9[_0x555e('0x41')]['id']}})[_0x555e('0x1c')](handleEntityNotFound(_0x4dbb55,null))[_0x555e('0x1c')](removeEntity(_0x4dbb55,null))[_0x555e('0x3f')](handleError(_0x4dbb55,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 65b09f0..75a7a38 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 _0xc0c0=['exports','define','int_zendesk_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZendeskField.attributes'];(function(_0x340d96,_0x4ed878){var _0x28f85e=function(_0x11e4ac){while(--_0x11e4ac){_0x340d96['push'](_0x340d96['shift']());}};_0x28f85e(++_0x4ed878);}(_0xc0c0,0x184));var _0x0c0c=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xc0c0[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x0c0c('0x0'));var util=require(_0x0c0c('0x1'));var logger=require(_0x0c0c('0x2'))(_0x0c0c('0x3'));var moment=require(_0x0c0c('0x4'));var BPromise=require(_0x0c0c('0x5'));var rp=require(_0x0c0c('0x6'));var attributes=require(_0x0c0c('0x7'));module[_0x0c0c('0x8')]=function(_0x1573fe,_0x4b5ea8){return _0x1573fe[_0x0c0c('0x9')]('ZendeskField',attributes,{'tableName':_0x0c0c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cad=['request-promise','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32f9c5,_0x3997a7){var _0xe6df66=function(_0x4e061a){while(--_0x4e061a){_0x32f9c5['push'](_0x32f9c5['shift']());}};_0xe6df66(++_0x3997a7);}(_0x2cad,0x89));var _0xd2ca=function(_0x3d21ea,_0x597e98){_0x3d21ea=_0x3d21ea-0x0;var _0xfc3a63=_0x2cad[_0x3d21ea];return _0xfc3a63;};'use strict';var _=require(_0xd2ca('0x0'));var util=require(_0xd2ca('0x1'));var logger=require(_0xd2ca('0x2'))(_0xd2ca('0x3'));var moment=require(_0xd2ca('0x4'));var BPromise=require(_0xd2ca('0x5'));var rp=require(_0xd2ca('0x6'));var attributes=require(_0xd2ca('0x7'));module['exports']=function(_0x30abc3,_0xd8134c){return _0x30abc3[_0xd2ca('0x8')](_0xd2ca('0x9'),attributes,{'tableName':_0xd2ca('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 b1801a8..5bc5ad8 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 _0xfc03=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x5eaf60,_0x2d63a8){var _0x4365c2=function(_0x5a50f7){while(--_0x5a50f7){_0x5eaf60['push'](_0x5eaf60['shift']());}};_0x4365c2(++_0x2d63a8);}(_0xfc03,0x16f));var _0x3fc0=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xfc03[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x3fc0('0x0'));var util=require('util');var moment=require(_0x3fc0('0x1'));var BPromise=require(_0x3fc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fc0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fc0('0x4'));var logger=require(_0x3fc0('0x5'))(_0x3fc0('0x6'));var config=require(_0x3fc0('0x7'));var jayson=require(_0x3fc0('0x8'));var client=jayson[_0x3fc0('0x9')][_0x3fc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeeb912,_0x55eac5,_0x2fb1a6){return new BPromise(function(_0x5f52b5,_0x1369ac){return client[_0x3fc0('0xb')](_0xeeb912,_0x2fb1a6)[_0x3fc0('0xc')](function(_0x392999){logger['info'](_0x3fc0('0xd'),_0x55eac5,_0x3fc0('0xe'));logger[_0x3fc0('0xf')](_0x3fc0('0x10'),_0x55eac5,_0x3fc0('0xe'),JSON['stringify'](_0x392999));if(_0x392999[_0x3fc0('0x11')]){if(_0x392999[_0x3fc0('0x11')][_0x3fc0('0x12')]===0x1f4){logger['error'](_0x3fc0('0xd'),_0x55eac5,_0x392999['error'][_0x3fc0('0x13')]);return _0x1369ac(_0x392999[_0x3fc0('0x11')]['message']);}logger[_0x3fc0('0x11')](_0x3fc0('0xd'),_0x55eac5,_0x392999[_0x3fc0('0x11')]['message']);return _0x5f52b5(_0x392999[_0x3fc0('0x11')][_0x3fc0('0x13')]);}else{logger[_0x3fc0('0x14')](_0x3fc0('0xd'),_0x55eac5,'request\x20sent');_0x5f52b5(_0x392999[_0x3fc0('0x15')][_0x3fc0('0x13')]);}})[_0x3fc0('0x16')](function(_0x5b59f1){logger[_0x3fc0('0x11')]('ZendeskField,\x20%s,\x20%s',_0x55eac5,_0x5b59f1);_0x1369ac(_0x5b59f1);});});} \ No newline at end of file +var _0x3c81=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2b972b,_0x4c4fc0){var _0x1ae7e8=function(_0x1abce3){while(--_0x1abce3){_0x2b972b['push'](_0x2b972b['shift']());}};_0x1ae7e8(++_0x4c4fc0);}(_0x3c81,0x102));var _0x13c8=function(_0x535ba2,_0x8057e0){_0x535ba2=_0x535ba2-0x0;var _0x34899e=_0x3c81[_0x535ba2];return _0x34899e;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('ZendeskField,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 4cede1f..11be51b 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 _0x8f4c=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','get','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','/:id','delete'];(function(_0x316769,_0x494558){var _0x580c0d=function(_0x17b8e6){while(--_0x17b8e6){_0x316769['push'](_0x316769['shift']());}};_0x580c0d(++_0x494558);}(_0x8f4c,0x113));var _0xc8f4=function(_0x116549,_0x210e8b){_0x116549=_0x116549-0x0;var _0x1321e5=_0x8f4c[_0x116549];return _0x1321e5;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc8f4('0x6'));var config=require(_0xc8f4('0x7'));var controller=require(_0xc8f4('0x8'));router['get']('/',auth[_0xc8f4('0x9')](),controller['index']);router['get']('/:id',auth[_0xc8f4('0x9')](),controller['show']);router[_0xc8f4('0xa')](_0xc8f4('0xb'),auth[_0xc8f4('0x9')](),controller[_0xc8f4('0xc')]);router[_0xc8f4('0xa')]('/:id/fields',auth[_0xc8f4('0x9')](),controller[_0xc8f4('0xd')]);router[_0xc8f4('0xe')]('/',auth[_0xc8f4('0x9')](),controller['create']);router[_0xc8f4('0xe')]('/:id/configurations',auth[_0xc8f4('0x9')](),controller[_0xc8f4('0xf')]);router[_0xc8f4('0x10')](_0xc8f4('0x11'),auth[_0xc8f4('0x9')](),controller['update']);router[_0xc8f4('0x12')](_0xc8f4('0x11'),auth[_0xc8f4('0x9')](),controller[_0xc8f4('0x13')]);module[_0xc8f4('0x14')]=router; \ No newline at end of file +var _0x2547=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','post','create','put','update','delete','/:id','destroy','exports','util'];(function(_0x5509ab,_0x5aa186){var _0x17c108=function(_0x2efcc9){while(--_0x2efcc9){_0x5509ab['push'](_0x5509ab['shift']());}};_0x17c108(++_0x5aa186);}(_0x2547,0x1cd));var _0x7254=function(_0x42e125,_0x594c33){_0x42e125=_0x42e125-0x0;var _0x3aaf42=_0x2547[_0x42e125];return _0x3aaf42;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./intZohoAccount.controller');router[_0x7254('0x8')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xa')]);router[_0x7254('0x8')]('/:id',auth[_0x7254('0x9')](),controller[_0x7254('0xb')]);router[_0x7254('0x8')]('/:id/configurations',auth[_0x7254('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x7254('0x9')](),controller[_0x7254('0xc')]);router[_0x7254('0xd')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xe')]);router[_0x7254('0xd')]('/:id/configurations',auth[_0x7254('0x9')](),controller['addConfiguration']);router[_0x7254('0xf')]('/:id',auth[_0x7254('0x9')](),controller[_0x7254('0x10')]);router[_0x7254('0x11')](_0x7254('0x12'),auth[_0x7254('0x9')](),controller[_0x7254('0x13')]);module[_0x7254('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 103bbd7..09821ab 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 _0x8917=['exports','STRING','sequelize'];(function(_0xbbcf3b,_0x256443){var _0x66ff00=function(_0x31b650){while(--_0x31b650){_0xbbcf3b['push'](_0xbbcf3b['shift']());}};_0x66ff00(++_0x256443);}(_0x8917,0x15b));var _0x7891=function(_0x155703,_0x450d83){_0x155703=_0x155703-0x0;var _0x112268=_0x8917[_0x155703];return _0x112268;};'use strict';var Sequelize=require(_0x7891('0x0'));module[_0x7891('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7891('0x2')]},'authToken':{'type':Sequelize[_0x7891('0x2')]},'host':{'type':Sequelize[_0x7891('0x2')]},'serverUrl':{'type':Sequelize[_0x7891('0x2')]}}; \ No newline at end of file +var _0x7482=['sequelize','STRING'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x7482,0x1a4));var _0x2748=function(_0x526219,_0x4348d9){_0x526219=_0x526219-0x0;var _0x8bf5c1=_0x7482[_0x526219];return _0x8bf5c1;};'use strict';var Sequelize=require(_0x2748('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2748('0x1')]},'authToken':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2748('0x1')]},'serverUrl':{'type':Sequelize[_0x2748('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a933693..1acf3e0 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 _0x49ca=['http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','sendStatus','stack','name','send','ZohoAccount','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','add','day','merge','where','filter','map','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','update','body','destroy','getConfigurations','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','ZohoField','getFields','authToken','format','https://crm.%s/crm/private/json/Calls/getFields','host','crmapi','response','Calls','section','includes','label','true','val','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x49ca,0x129));var _0xa49c=function(_0x1b0601,_0x553222){_0x1b0601=_0x1b0601-0x0;var _0x40dbdc=_0x49ca[_0x1b0601];return _0x40dbdc;};'use strict';var pdf=require(_0xa49c('0x0'));var emlformat=require(_0xa49c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa49c('0x2'));var rp=require(_0xa49c('0x3'));var moment=require(_0xa49c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa49c('0x5'));var path=require(_0xa49c('0x6'));var sox=require(_0xa49c('0x7'));var csv=require('to-csv');var ejs=require(_0xa49c('0x8'));var fs=require('fs');var _=require(_0xa49c('0x9'));var squel=require('squel');var crypto=require(_0xa49c('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa49c('0xb'));var querystring=require('querystring');var Papa=require(_0xa49c('0xc'));var Redis=require('ioredis');var qs=require(_0xa49c('0xd'));var logger=require(_0xa49c('0xe'))(_0xa49c('0xf'));var utils=require(_0xa49c('0x10'));var config=require('../../config/environment');var db=require(_0xa49c('0x11'))['db'];var integrations=require(_0xa49c('0x12'));var jayson=require(_0xa49c('0x13'));var client=jayson[_0xa49c('0x14')][_0xa49c('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x353d62,_0x47d600,_0x2b4e97,_0x1f7e54){return new BPromise(function(_0x4761bb,_0x459a62){var _0x2111c7=_0x1f7e54||client;return _0x2111c7[_0xa49c('0x16')](_0x353d62,_0x2b4e97)[_0xa49c('0x17')](function(_0x3e48a5){logger[_0xa49c('0x18')](_0xa49c('0x19'),_0x47d600,_0xa49c('0x1a'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x47d600,_0xa49c('0x1a'),JSON[_0xa49c('0x1b')](_0x3e48a5));if(_0x3e48a5['error']){if(_0x3e48a5['error'][_0xa49c('0x1c')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x47d600,_0x3e48a5['error'][_0xa49c('0x1d')]);return _0x459a62(_0x3e48a5[_0xa49c('0x1e')][_0xa49c('0x1d')]);}logger[_0xa49c('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x47d600,_0x3e48a5[_0xa49c('0x1e')][_0xa49c('0x1d')]);return _0x4761bb(_0x3e48a5['error'][_0xa49c('0x1d')]);}else{logger[_0xa49c('0x18')](_0xa49c('0x19'),_0x47d600,_0xa49c('0x1a'));_0x4761bb(_0x3e48a5['result'][_0xa49c('0x1d')]);}})['catch'](function(_0x3bfed8){logger[_0xa49c('0x1e')](_0xa49c('0x19'),_0x47d600,_0x3bfed8);_0x459a62(_0x3bfed8);});});}function respondWithStatusCode(_0x46426b,_0x4c62b1){_0x4c62b1=_0x4c62b1||0xcc;return function(_0xe63220){if(_0xe63220){return _0x46426b['sendStatus'](_0x4c62b1);}return _0x46426b[_0xa49c('0x1f')](_0x4c62b1)[_0xa49c('0x20')]();};}function respondWithResult(_0x863cc5,_0x4eaa60){_0x4eaa60=_0x4eaa60||0xc8;return function(_0x4a757f){if(_0x4a757f){return _0x863cc5[_0xa49c('0x1f')](_0x4eaa60)[_0xa49c('0x21')](_0x4a757f);}};}function respondWithFilteredResult(_0x128dc4,_0x240ef1){return function(_0x5440ae){if(_0x5440ae){var _0x5ca6b4=_0x5440ae[_0xa49c('0x22')],_0x9e9065=_0x240ef1[_0xa49c('0x23')],_0x46cdd1=_0x240ef1['offset']+_0x240ef1[_0xa49c('0x24')],_0x5de20b;if(_0x46cdd1>=_0x5ca6b4){_0x46cdd1=_0x5ca6b4;_0x5de20b=0xc8;}else{_0x5de20b=0xce;}_0x128dc4['status'](_0x5de20b);return _0x128dc4[_0xa49c('0x25')](_0xa49c('0x26'),_0x9e9065+'-'+_0x46cdd1+'/'+_0x5ca6b4)[_0xa49c('0x21')](_0x5440ae);}return null;};}function patchUpdates(_0x5f23e){return function(_0x482d59){try{jsonpatch[_0xa49c('0x27')](_0x482d59,_0x5f23e,!![]);}catch(_0x297151){return BPromise[_0xa49c('0x28')](_0x297151);}return _0x482d59[_0xa49c('0x29')]();};}function saveUpdates(_0x241f9c,_0x365021){return function(_0x31aca9){if(_0x31aca9){return _0x31aca9['update'](_0x241f9c)[_0xa49c('0x17')](function(_0x1515d8){return _0x1515d8;});}return null;};}function removeEntity(_0x4a4c88,_0x580432){return function(_0xe97c13){if(_0xe97c13){return _0xe97c13['destroy']()[_0xa49c('0x17')](function(){_0x4a4c88[_0xa49c('0x1f')](0xcc)[_0xa49c('0x20')]();});}};}function handleEntityNotFound(_0x421931,_0x1cec74){return function(_0x495cd0){if(!_0x495cd0){_0x421931[_0xa49c('0x2a')](0x194);}return _0x495cd0;};}function handleError(_0x427fb5,_0x38f3d9){_0x38f3d9=_0x38f3d9||0x1f4;return function(_0xae0d80){logger['error'](_0xae0d80[_0xa49c('0x2b')]);if(_0xae0d80[_0xa49c('0x2c')]){delete _0xae0d80[_0xa49c('0x2c')];}_0x427fb5['status'](_0x38f3d9)[_0xa49c('0x2d')](_0xae0d80);};}exports['index']=function(_0x5cab2b,_0x2fba37){var _0x1219fa={},_0x33015c={},_0x288aad={'count':0x0,'rows':[]};var _0x52bb22=db[_0xa49c('0x2e')]['rawAttributes'];_0x33015c[_0xa49c('0x2f')]=_[_0xa49c('0x30')](_0x52bb22);var _0x334422={'dateStart':_0x5cab2b['query'][_0xa49c('0x31')],'dateEnd':_0x5cab2b[_0xa49c('0x32')][_0xa49c('0x33')]};delete _0x5cab2b['query'][_0xa49c('0x31')];delete _0x5cab2b[_0xa49c('0x32')]['dateEnd'];_0x33015c['query']=_['keys'](_0x5cab2b[_0xa49c('0x32')]);_0x33015c[_0xa49c('0x34')]=_[_0xa49c('0x35')](_0x33015c[_0xa49c('0x2f')],_0x33015c[_0xa49c('0x32')]);_0x1219fa[_0xa49c('0x36')]=_[_0xa49c('0x35')](_0x33015c[_0xa49c('0x2f')],qs[_0xa49c('0x37')](_0x5cab2b[_0xa49c('0x32')][_0xa49c('0x37')]));_0x1219fa[_0xa49c('0x36')]=_0x1219fa[_0xa49c('0x36')][_0xa49c('0x38')]?_0x1219fa[_0xa49c('0x36')]:_0x33015c[_0xa49c('0x2f')];if(!_0x5cab2b[_0xa49c('0x32')]['hasOwnProperty'](_0xa49c('0x39'))){_0x1219fa[_0xa49c('0x24')]=qs[_0xa49c('0x24')](_0x5cab2b[_0xa49c('0x32')][_0xa49c('0x24')]);_0x1219fa['offset']=qs[_0xa49c('0x23')](_0x5cab2b[_0xa49c('0x32')][_0xa49c('0x23')]);}_0x1219fa[_0xa49c('0x3a')]=qs[_0xa49c('0x3b')](_0x5cab2b[_0xa49c('0x32')]['sort']);_0x1219fa['where']=qs[_0xa49c('0x34')](_[_0xa49c('0x3c')](_0x5cab2b[_0xa49c('0x32')],_0x33015c[_0xa49c('0x34')]));if(_0x334422[_0xa49c('0x31')]){if(_0x334422['dateEnd']){_0x334422[_0xa49c('0x33')]=moment(_0x334422[_0xa49c('0x33')])[_0xa49c('0x3d')](0x1,_0xa49c('0x3e'));}else{_0x334422[_0xa49c('0x33')]=moment(_0x334422[_0xa49c('0x31')])['add'](0x1,_0xa49c('0x3e'));}_[_0xa49c('0x3f')](_0x1219fa[_0xa49c('0x40')],{'createdAt':{'$gte':_0x334422['dateStart'],'$lte':_0x334422[_0xa49c('0x33')]}});}if(_0x5cab2b['query'][_0xa49c('0x41')]){_0x1219fa[_0xa49c('0x40')]=_['merge'](_0x1219fa[_0xa49c('0x40')],{'$or':_[_0xa49c('0x42')](_0x1219fa['attributes'],function(_0x1551ae){var _0x2fab29={};_0x2fab29[_0x1551ae]={'$like':'%'+_0x5cab2b[_0xa49c('0x32')][_0xa49c('0x41')]+'%'};return _0x2fab29;})});}_0x1219fa=_[_0xa49c('0x3f')]({},_0x1219fa,_0x5cab2b['options']);var _0x3b87b5={'where':_0x1219fa['where']};return db['ZohoAccount'][_0xa49c('0x22')](_0x3b87b5)['then'](function(_0x146ccd){_0x288aad[_0xa49c('0x22')]=_0x146ccd;if(_0x5cab2b[_0xa49c('0x32')]['includeAll']){_0x1219fa['include']=[{'all':!![]}];}return db[_0xa49c('0x2e')][_0xa49c('0x43')](_0x1219fa);})['then'](function(_0x4b5ac1){_0x288aad[_0xa49c('0x44')]=_0x4b5ac1;return _0x288aad;})[_0xa49c('0x17')](respondWithFilteredResult(_0x2fba37,_0x1219fa))[_0xa49c('0x45')](handleError(_0x2fba37,null));};exports[_0xa49c('0x46')]=function(_0x3e80b2,_0x3c8aaf){var _0xe217d6={'raw':![],'where':{'id':_0x3e80b2[_0xa49c('0x47')]['id']}},_0x5ea7ae={};_0x5ea7ae[_0xa49c('0x2f')]=_['keys'](db[_0xa49c('0x2e')][_0xa49c('0x48')]);_0x5ea7ae[_0xa49c('0x32')]=_[_0xa49c('0x30')](_0x3e80b2[_0xa49c('0x32')]);_0x5ea7ae[_0xa49c('0x34')]=_[_0xa49c('0x35')](_0x5ea7ae['model'],_0x5ea7ae[_0xa49c('0x32')]);_0xe217d6[_0xa49c('0x36')]=_['intersection'](_0x5ea7ae[_0xa49c('0x2f')],qs['fields'](_0x3e80b2[_0xa49c('0x32')][_0xa49c('0x37')]));_0xe217d6[_0xa49c('0x36')]=_0xe217d6['attributes']['length']?_0xe217d6[_0xa49c('0x36')]:_0x5ea7ae['model'];if(_0x3e80b2[_0xa49c('0x32')][_0xa49c('0x49')]){_0xe217d6[_0xa49c('0x4a')]=[{'all':!![]}];}_0xe217d6=_[_0xa49c('0x3f')]({},_0xe217d6,_0x3e80b2['options']);return db[_0xa49c('0x2e')][_0xa49c('0x4b')](_0xe217d6)[_0xa49c('0x17')](handleEntityNotFound(_0x3c8aaf,null))[_0xa49c('0x17')](respondWithResult(_0x3c8aaf,null))['catch'](handleError(_0x3c8aaf,null));};exports[_0xa49c('0x4c')]=function(_0x2db8b1,_0x4e6405){return db[_0xa49c('0x2e')][_0xa49c('0x4c')](_0x2db8b1['body'],{})[_0xa49c('0x17')](respondWithResult(_0x4e6405,0xc9))[_0xa49c('0x45')](handleError(_0x4e6405,null));};exports[_0xa49c('0x4d')]=function(_0x1f27ff,_0x4805e2){if(_0x1f27ff[_0xa49c('0x4e')]['id']){delete _0x1f27ff[_0xa49c('0x4e')]['id'];}return db[_0xa49c('0x2e')][_0xa49c('0x4b')]({'where':{'id':_0x1f27ff[_0xa49c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4805e2,null))[_0xa49c('0x17')](saveUpdates(_0x1f27ff[_0xa49c('0x4e')],null))[_0xa49c('0x17')](respondWithResult(_0x4805e2,null))['catch'](handleError(_0x4805e2,null));};exports[_0xa49c('0x4f')]=function(_0x5cfbf4,_0x18b5d2){return db['ZohoAccount']['find']({'where':{'id':_0x5cfbf4['params']['id']}})[_0xa49c('0x17')](handleEntityNotFound(_0x18b5d2,null))[_0xa49c('0x17')](removeEntity(_0x18b5d2,null))[_0xa49c('0x45')](handleError(_0x18b5d2,null));};exports[_0xa49c('0x50')]=function(_0x504355,_0x2ed3ed,_0x13f2cc){var _0x39efad={};var _0x2ed672={};var _0x234d0c;var _0x473431;return db[_0xa49c('0x2e')][_0xa49c('0x51')]({'where':{'id':_0x504355[_0xa49c('0x47')]['id']}})[_0xa49c('0x17')](handleEntityNotFound(_0x2ed3ed,null))[_0xa49c('0x17')](function(_0x54b2e0){if(_0x54b2e0){_0x234d0c=_0x54b2e0;_0x2ed672['model']=_[_0xa49c('0x30')](db['ZohoConfiguration'][_0xa49c('0x48')]);_0x2ed672['query']=_[_0xa49c('0x30')](_0x504355[_0xa49c('0x32')]);_0x2ed672[_0xa49c('0x34')]=_[_0xa49c('0x35')](_0x2ed672[_0xa49c('0x2f')],_0x2ed672[_0xa49c('0x32')]);_0x39efad['attributes']=_[_0xa49c('0x35')](_0x2ed672[_0xa49c('0x2f')],qs[_0xa49c('0x37')](_0x504355[_0xa49c('0x32')][_0xa49c('0x37')]));_0x39efad[_0xa49c('0x36')]=_0x39efad['attributes'][_0xa49c('0x38')]?_0x39efad[_0xa49c('0x36')]:_0x2ed672[_0xa49c('0x2f')];_0x39efad[_0xa49c('0x3a')]=qs[_0xa49c('0x3b')](_0x504355[_0xa49c('0x32')][_0xa49c('0x3b')]);_0x39efad['where']=qs[_0xa49c('0x34')](_['pick'](_0x504355[_0xa49c('0x32')],_0x2ed672[_0xa49c('0x34')]));if(_0x504355[_0xa49c('0x32')][_0xa49c('0x41')]){_0x39efad['where']=_[_0xa49c('0x3f')](_0x39efad['where'],{'$or':_[_0xa49c('0x42')](_0x39efad[_0xa49c('0x36')],function(_0x32a49c){var _0x388227={};_0x388227[_0x32a49c]={'$like':'%'+_0x504355[_0xa49c('0x32')][_0xa49c('0x41')]+'%'};return _0x388227;})});}_0x39efad=_[_0xa49c('0x3f')]({},_0x39efad,_0x504355['options']);return _0x234d0c[_0xa49c('0x50')](_0x39efad);}})[_0xa49c('0x17')](function(_0x286181){if(_0x286181){_0x473431=_0x286181[_0xa49c('0x38')];if(!_0x504355['query']['hasOwnProperty'](_0xa49c('0x39'))){_0x39efad[_0xa49c('0x24')]=qs[_0xa49c('0x24')](_0x504355[_0xa49c('0x32')][_0xa49c('0x24')]);_0x39efad[_0xa49c('0x23')]=qs[_0xa49c('0x23')](_0x504355['query'][_0xa49c('0x23')]);}return _0x234d0c['getConfigurations'](_0x39efad);}})[_0xa49c('0x17')](function(_0x33119b){if(_0x33119b){return _0x33119b?{'count':_0x473431,'rows':_0x33119b}:null;}})[_0xa49c('0x17')](respondWithResult(_0x2ed3ed,null))['catch'](handleError(_0x2ed3ed,null));};exports['addConfiguration']=function(_0x1903c3,_0x54c1c9,_0x3a4cf5){if(_0x1903c3[_0xa49c('0x4e')]['id']){delete _0x1903c3[_0xa49c('0x4e')]['id'];}return db[_0xa49c('0x2e')][_0xa49c('0x51')]({'where':{'id':_0x1903c3['params']['id']}})[_0xa49c('0x17')](handleEntityNotFound(_0x54c1c9,null))['then'](function(_0x59c86e){if(_0x59c86e){_0x1903c3[_0xa49c('0x4e')][_0xa49c('0x52')]=_0x59c86e['id'];_0x1903c3[_0xa49c('0x4e')][_0xa49c('0x53')]=integrations[_0xa49c('0x54')](_0x1903c3['body']['channel'],_0x1903c3[_0xa49c('0x4e')][_0xa49c('0x55')]);_0x1903c3[_0xa49c('0x4e')][_0xa49c('0x56')]=integrations[_0xa49c('0x57')](_0x1903c3['body'][_0xa49c('0x58')],_0x1903c3[_0xa49c('0x4e')][_0xa49c('0x55')]);return db['ZohoConfiguration']['create'](_0x1903c3['body'],{'include':[{'model':db['ZohoField'],'as':_0xa49c('0x53')},{'model':db[_0xa49c('0x59')],'as':_0xa49c('0x56')}]});}return null;})[_0xa49c('0x17')](respondWithResult(_0x54c1c9,null))['catch'](handleError(_0x54c1c9,null));};exports[_0xa49c('0x5a')]=function(_0x264da1,_0x17b880,_0x4da0ad){return db['ZohoAccount']['findOne']({'where':{'id':_0x264da1[_0xa49c('0x47')]['id']},'attributes':['id','host',_0xa49c('0x5b')]})[_0xa49c('0x17')](handleEntityNotFound(_0x17b880,null))['then'](function(_0x3ae67a){if(_0x3ae67a){return rp({'method':'GET','uri':util[_0xa49c('0x5c')](_0xa49c('0x5d'),_0x3ae67a[_0xa49c('0x5e')]),'qs':{'authtoken':_0x3ae67a[_0xa49c('0x5b')],'scope':_0xa49c('0x5f')},'json':!![]});}})[_0xa49c('0x17')](function(_0x52cd3b){if(_0x52cd3b){if(_0x52cd3b[_0xa49c('0x60')]&&_0x52cd3b[_0xa49c('0x60')][_0xa49c('0x1e')]){throw new Error(_0x52cd3b[_0xa49c('0x60')][_0xa49c('0x1e')][_0xa49c('0x1d')]);}var _0x2dcb3d=[];if(_0x52cd3b[_0xa49c('0x61')]&&_0x52cd3b[_0xa49c('0x61')][_0xa49c('0x62')]){if(_0x52cd3b[_0xa49c('0x61')][_0xa49c('0x62')]['FL']){var _0x31020f=['Call\x20Purpose'];for(var _0x1bead6=0x0,_0x53735f=_0x52cd3b[_0xa49c('0x61')]['section']['FL'][_0xa49c('0x38')];_0x1bead6<_0x53735f;_0x1bead6++){if(_[_0xa49c('0x63')](_0x31020f,_0x52cd3b[_0xa49c('0x61')][_0xa49c('0x62')]['FL'][_0x1bead6]['dv'])){_0x2dcb3d['push']({'id':_0x52cd3b[_0xa49c('0x61')]['section']['FL'][_0x1bead6]['dv'],'name':_0x52cd3b['Calls'][_0xa49c('0x62')]['FL'][_0x1bead6][_0xa49c('0x64')],'custom':_0x52cd3b['Calls']['section']['FL'][_0x1bead6]['customfield']===_0xa49c('0x65')?!![]:![],'options':_0x52cd3b[_0xa49c('0x61')]['section']['FL'][_0x1bead6][_0xa49c('0x55')]==='Pick\x20List'&&_0x52cd3b[_0xa49c('0x61')][_0xa49c('0x62')]['FL'][_0x1bead6][_0xa49c('0x66')]?_[_0xa49c('0x42')](_0x52cd3b[_0xa49c('0x61')]['section']['FL'][_0x1bead6][_0xa49c('0x66')],function(_0x29352f){return{'name':_0x29352f,'value':_0x29352f};}):[]});}}}}return{'count':_0x2dcb3d[_0xa49c('0x38')],'rows':_0x2dcb3d};}})['then'](respondWithResult(_0x17b880,null))[_0xa49c('0x45')](function(_0x249f0d){var _0x1f4d41=_0x264da1[_0xa49c('0x32')]['test']?0x1f4:_0x249f0d[_0xa49c('0x67')]||0x1f4;logger[_0xa49c('0x1e')](_0xa49c('0x68'),_0xa49c('0x5a'),_0x1f4d41,JSON[_0xa49c('0x1b')](_0x249f0d));delete _0x249f0d[_0xa49c('0x2c')];if(_0x1f4d41===0x191){_0x1f4d41=0x190;}_0x17b880[_0xa49c('0x1f')](_0x1f4d41)['send'](_0x264da1[_0xa49c('0x32')]['test']?{'message':_0xa49c('0x69'),'statusCode':_0x249f0d[_0xa49c('0x67')]}:_0x249f0d);});}; \ No newline at end of file +var _0x44f1=['Descriptions','host','authToken','format','https://crm.%s/crm/private/json/Calls/getFields','crmapi','response','section','Calls','Call\x20Purpose','includes','push','label','customfield','true','Pick\x20List','val','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','destroy','name','send','index','ZohoAccount','rawAttributes','model','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','map','options','includeAll','include','findAll','params','keys','find','catch','create','body','getConfigurations','ZohoConfiguration','order','filter','addConfiguration','findOne','AccountId','getSubjects','channel','type','ZohoField','Subjects'];(function(_0x19dcc8,_0x4bae0e){var _0x2810f4=function(_0x507cf4){while(--_0x507cf4){_0x19dcc8['push'](_0x19dcc8['shift']());}};_0x2810f4(++_0x4bae0e);}(_0x44f1,0x169));var _0x144f=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x44f1[_0x110c3d];return _0x226d67;};'use strict';var pdf=require(_0x144f('0x0'));var emlformat=require(_0x144f('0x1'));var rimraf=require(_0x144f('0x2'));var zipdir=require(_0x144f('0x3'));var jsonpatch=require(_0x144f('0x4'));var rp=require(_0x144f('0x5'));var moment=require(_0x144f('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x144f('0x7'));var path=require(_0x144f('0x8'));var sox=require('sox');var csv=require(_0x144f('0x9'));var ejs=require(_0x144f('0xa'));var fs=require('fs');var _=require(_0x144f('0xb'));var squel=require(_0x144f('0xc'));var crypto=require(_0x144f('0xd'));var jsforce=require(_0x144f('0xe'));var deskjs=require(_0x144f('0xf'));var toCsv=require(_0x144f('0x9'));var querystring=require('querystring');var Papa=require(_0x144f('0x10'));var Redis=require(_0x144f('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x144f('0x12'))(_0x144f('0x13'));var utils=require('../../config/utils');var config=require(_0x144f('0x14'));var db=require(_0x144f('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x144f('0x16'));var client=jayson[_0x144f('0x17')][_0x144f('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x49f9b1,_0x3211b1,_0x510c98,_0x2c1d65){return new BPromise(function(_0x2074a6,_0x184936){var _0x4ecd7e=_0x2c1d65||client;return _0x4ecd7e[_0x144f('0x19')](_0x49f9b1,_0x510c98)[_0x144f('0x1a')](function(_0x4f50cc){logger[_0x144f('0x1b')](_0x144f('0x1c'),_0x3211b1,_0x144f('0x1d'));logger[_0x144f('0x1e')](_0x144f('0x1f'),_0x3211b1,'request\x20sent',JSON[_0x144f('0x20')](_0x4f50cc));if(_0x4f50cc[_0x144f('0x21')]){if(_0x4f50cc[_0x144f('0x21')][_0x144f('0x22')]===0x1f4){logger['error'](_0x144f('0x1c'),_0x3211b1,_0x4f50cc['error'][_0x144f('0x23')]);return _0x184936(_0x4f50cc['error'][_0x144f('0x23')]);}logger[_0x144f('0x21')](_0x144f('0x1c'),_0x3211b1,_0x4f50cc[_0x144f('0x21')][_0x144f('0x23')]);return _0x2074a6(_0x4f50cc[_0x144f('0x21')][_0x144f('0x23')]);}else{logger[_0x144f('0x1b')]('ZohoAccount,\x20%s,\x20%s',_0x3211b1,_0x144f('0x1d'));_0x2074a6(_0x4f50cc[_0x144f('0x24')][_0x144f('0x23')]);}})['catch'](function(_0x568450){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3211b1,_0x568450);_0x184936(_0x568450);});});}function respondWithStatusCode(_0x36bed2,_0xff9098){_0xff9098=_0xff9098||0xcc;return function(_0x16b6c8){if(_0x16b6c8){return _0x36bed2[_0x144f('0x25')](_0xff9098);}return _0x36bed2[_0x144f('0x26')](_0xff9098)[_0x144f('0x27')]();};}function respondWithResult(_0x342f97,_0x52b6e7){_0x52b6e7=_0x52b6e7||0xc8;return function(_0x3497b7){if(_0x3497b7){return _0x342f97[_0x144f('0x26')](_0x52b6e7)[_0x144f('0x28')](_0x3497b7);}};}function respondWithFilteredResult(_0x9a117f,_0x534197){return function(_0x567879){if(_0x567879){var _0x4bf073=_0x567879[_0x144f('0x29')],_0x1d9260=_0x534197[_0x144f('0x2a')],_0x1d7f56=_0x534197[_0x144f('0x2a')]+_0x534197['limit'],_0x1ccbd2;if(_0x1d7f56>=_0x4bf073){_0x1d7f56=_0x4bf073;_0x1ccbd2=0xc8;}else{_0x1ccbd2=0xce;}_0x9a117f[_0x144f('0x26')](_0x1ccbd2);return _0x9a117f[_0x144f('0x2b')](_0x144f('0x2c'),_0x1d9260+'-'+_0x1d7f56+'/'+_0x4bf073)[_0x144f('0x28')](_0x567879);}return null;};}function patchUpdates(_0x246300){return function(_0xd2eb29){try{jsonpatch[_0x144f('0x2d')](_0xd2eb29,_0x246300,!![]);}catch(_0x3f39c6){return BPromise['reject'](_0x3f39c6);}return _0xd2eb29['save']();};}function saveUpdates(_0x4c837e,_0x21e518){return function(_0x46176f){if(_0x46176f){return _0x46176f['update'](_0x4c837e)[_0x144f('0x1a')](function(_0x2277ca){return _0x2277ca;});}return null;};}function removeEntity(_0x2471a2,_0x7c31db){return function(_0x28596f){if(_0x28596f){return _0x28596f[_0x144f('0x2e')]()[_0x144f('0x1a')](function(){_0x2471a2[_0x144f('0x26')](0xcc)[_0x144f('0x27')]();});}};}function handleEntityNotFound(_0x26c713,_0x4fdee7){return function(_0x54269f){if(!_0x54269f){_0x26c713[_0x144f('0x25')](0x194);}return _0x54269f;};}function handleError(_0x4b7106,_0x2cb9e7){_0x2cb9e7=_0x2cb9e7||0x1f4;return function(_0x47f8af){logger[_0x144f('0x21')](_0x47f8af['stack']);if(_0x47f8af[_0x144f('0x2f')]){delete _0x47f8af[_0x144f('0x2f')];}_0x4b7106[_0x144f('0x26')](_0x2cb9e7)[_0x144f('0x30')](_0x47f8af);};}exports[_0x144f('0x31')]=function(_0x1e9e1e,_0x213128){var _0x2613b3={},_0x3719f2={},_0x79ff99={'count':0x0,'rows':[]};var _0x173de5=db[_0x144f('0x32')][_0x144f('0x33')];_0x3719f2[_0x144f('0x34')]=_['keys'](_0x173de5);var _0x4e4fab={'dateStart':_0x1e9e1e['query'][_0x144f('0x35')],'dateEnd':_0x1e9e1e[_0x144f('0x36')][_0x144f('0x37')]};delete _0x1e9e1e[_0x144f('0x36')][_0x144f('0x35')];delete _0x1e9e1e[_0x144f('0x36')][_0x144f('0x37')];_0x3719f2[_0x144f('0x36')]=_['keys'](_0x1e9e1e[_0x144f('0x36')]);_0x3719f2[_0x144f('0x38')]=_[_0x144f('0x39')](_0x3719f2[_0x144f('0x34')],_0x3719f2[_0x144f('0x36')]);_0x2613b3[_0x144f('0x3a')]=_[_0x144f('0x39')](_0x3719f2[_0x144f('0x34')],qs[_0x144f('0x3b')](_0x1e9e1e[_0x144f('0x36')]['fields']));_0x2613b3[_0x144f('0x3a')]=_0x2613b3['attributes'][_0x144f('0x3c')]?_0x2613b3[_0x144f('0x3a')]:_0x3719f2[_0x144f('0x34')];if(!_0x1e9e1e[_0x144f('0x36')][_0x144f('0x3d')](_0x144f('0x3e'))){_0x2613b3['limit']=qs[_0x144f('0x3f')](_0x1e9e1e[_0x144f('0x36')][_0x144f('0x3f')]);_0x2613b3[_0x144f('0x2a')]=qs[_0x144f('0x2a')](_0x1e9e1e[_0x144f('0x36')][_0x144f('0x2a')]);}_0x2613b3['order']=qs['sort'](_0x1e9e1e[_0x144f('0x36')][_0x144f('0x40')]);_0x2613b3[_0x144f('0x41')]=qs['filters'](_[_0x144f('0x42')](_0x1e9e1e['query'],_0x3719f2['filters']));if(_0x4e4fab['dateStart']){if(_0x4e4fab[_0x144f('0x37')]){_0x4e4fab[_0x144f('0x37')]=moment(_0x4e4fab[_0x144f('0x37')])['add'](0x1,'day');}else{_0x4e4fab[_0x144f('0x37')]=moment(_0x4e4fab[_0x144f('0x35')])['add'](0x1,'day');}_[_0x144f('0x43')](_0x2613b3[_0x144f('0x41')],{'createdAt':{'$gte':_0x4e4fab['dateStart'],'$lte':_0x4e4fab['dateEnd']}});}if(_0x1e9e1e[_0x144f('0x36')]['filter']){_0x2613b3[_0x144f('0x41')]=_[_0x144f('0x43')](_0x2613b3[_0x144f('0x41')],{'$or':_[_0x144f('0x44')](_0x2613b3[_0x144f('0x3a')],function(_0x3639c1){var _0x17a2d5={};_0x17a2d5[_0x3639c1]={'$like':'%'+_0x1e9e1e[_0x144f('0x36')]['filter']+'%'};return _0x17a2d5;})});}_0x2613b3=_[_0x144f('0x43')]({},_0x2613b3,_0x1e9e1e[_0x144f('0x45')]);var _0x2fca98={'where':_0x2613b3['where']};return db[_0x144f('0x32')][_0x144f('0x29')](_0x2fca98)[_0x144f('0x1a')](function(_0x156f05){_0x79ff99[_0x144f('0x29')]=_0x156f05;if(_0x1e9e1e[_0x144f('0x36')][_0x144f('0x46')]){_0x2613b3[_0x144f('0x47')]=[{'all':!![]}];}return db[_0x144f('0x32')][_0x144f('0x48')](_0x2613b3);})[_0x144f('0x1a')](function(_0x89545c){_0x79ff99['rows']=_0x89545c;return _0x79ff99;})['then'](respondWithFilteredResult(_0x213128,_0x2613b3))['catch'](handleError(_0x213128,null));};exports['show']=function(_0x2677af,_0x238155){var _0x49a3f8={'raw':![],'where':{'id':_0x2677af[_0x144f('0x49')]['id']}},_0x511ec4={};_0x511ec4['model']=_[_0x144f('0x4a')](db[_0x144f('0x32')][_0x144f('0x33')]);_0x511ec4[_0x144f('0x36')]=_[_0x144f('0x4a')](_0x2677af[_0x144f('0x36')]);_0x511ec4['filters']=_[_0x144f('0x39')](_0x511ec4[_0x144f('0x34')],_0x511ec4[_0x144f('0x36')]);_0x49a3f8[_0x144f('0x3a')]=_[_0x144f('0x39')](_0x511ec4[_0x144f('0x34')],qs['fields'](_0x2677af[_0x144f('0x36')][_0x144f('0x3b')]));_0x49a3f8[_0x144f('0x3a')]=_0x49a3f8[_0x144f('0x3a')][_0x144f('0x3c')]?_0x49a3f8['attributes']:_0x511ec4[_0x144f('0x34')];if(_0x2677af[_0x144f('0x36')][_0x144f('0x46')]){_0x49a3f8['include']=[{'all':!![]}];}_0x49a3f8=_[_0x144f('0x43')]({},_0x49a3f8,_0x2677af[_0x144f('0x45')]);return db[_0x144f('0x32')][_0x144f('0x4b')](_0x49a3f8)[_0x144f('0x1a')](handleEntityNotFound(_0x238155,null))['then'](respondWithResult(_0x238155,null))[_0x144f('0x4c')](handleError(_0x238155,null));};exports[_0x144f('0x4d')]=function(_0x133e89,_0x486f2d){return db['ZohoAccount'][_0x144f('0x4d')](_0x133e89[_0x144f('0x4e')],{})[_0x144f('0x1a')](respondWithResult(_0x486f2d,0xc9))[_0x144f('0x4c')](handleError(_0x486f2d,null));};exports['update']=function(_0x109559,_0x518dfe){if(_0x109559[_0x144f('0x4e')]['id']){delete _0x109559['body']['id'];}return db[_0x144f('0x32')][_0x144f('0x4b')]({'where':{'id':_0x109559[_0x144f('0x49')]['id']}})[_0x144f('0x1a')](handleEntityNotFound(_0x518dfe,null))[_0x144f('0x1a')](saveUpdates(_0x109559[_0x144f('0x4e')],null))[_0x144f('0x1a')](respondWithResult(_0x518dfe,null))[_0x144f('0x4c')](handleError(_0x518dfe,null));};exports[_0x144f('0x2e')]=function(_0x11778b,_0x5499bd){return db[_0x144f('0x32')][_0x144f('0x4b')]({'where':{'id':_0x11778b[_0x144f('0x49')]['id']}})[_0x144f('0x1a')](handleEntityNotFound(_0x5499bd,null))['then'](removeEntity(_0x5499bd,null))[_0x144f('0x4c')](handleError(_0x5499bd,null));};exports[_0x144f('0x4f')]=function(_0x512aba,_0x3f65da,_0x355264){var _0x30a6de={};var _0x241893={};var _0x597be8;var _0x4ad1f8;return db[_0x144f('0x32')]['findOne']({'where':{'id':_0x512aba[_0x144f('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f65da,null))['then'](function(_0x1e18dc){if(_0x1e18dc){_0x597be8=_0x1e18dc;_0x241893[_0x144f('0x34')]=_['keys'](db[_0x144f('0x50')][_0x144f('0x33')]);_0x241893[_0x144f('0x36')]=_['keys'](_0x512aba[_0x144f('0x36')]);_0x241893[_0x144f('0x38')]=_['intersection'](_0x241893[_0x144f('0x34')],_0x241893['query']);_0x30a6de[_0x144f('0x3a')]=_['intersection'](_0x241893['model'],qs[_0x144f('0x3b')](_0x512aba[_0x144f('0x36')][_0x144f('0x3b')]));_0x30a6de[_0x144f('0x3a')]=_0x30a6de[_0x144f('0x3a')]['length']?_0x30a6de[_0x144f('0x3a')]:_0x241893[_0x144f('0x34')];_0x30a6de[_0x144f('0x51')]=qs[_0x144f('0x40')](_0x512aba[_0x144f('0x36')]['sort']);_0x30a6de[_0x144f('0x41')]=qs[_0x144f('0x38')](_['pick'](_0x512aba['query'],_0x241893[_0x144f('0x38')]));if(_0x512aba['query'][_0x144f('0x52')]){_0x30a6de[_0x144f('0x41')]=_[_0x144f('0x43')](_0x30a6de[_0x144f('0x41')],{'$or':_[_0x144f('0x44')](_0x30a6de[_0x144f('0x3a')],function(_0x4a7205){var _0x515204={};_0x515204[_0x4a7205]={'$like':'%'+_0x512aba[_0x144f('0x36')][_0x144f('0x52')]+'%'};return _0x515204;})});}_0x30a6de=_[_0x144f('0x43')]({},_0x30a6de,_0x512aba[_0x144f('0x45')]);return _0x597be8[_0x144f('0x4f')](_0x30a6de);}})[_0x144f('0x1a')](function(_0x3f265c){if(_0x3f265c){_0x4ad1f8=_0x3f265c['length'];if(!_0x512aba['query'][_0x144f('0x3d')](_0x144f('0x3e'))){_0x30a6de[_0x144f('0x3f')]=qs[_0x144f('0x3f')](_0x512aba[_0x144f('0x36')]['limit']);_0x30a6de[_0x144f('0x2a')]=qs[_0x144f('0x2a')](_0x512aba['query'][_0x144f('0x2a')]);}return _0x597be8[_0x144f('0x4f')](_0x30a6de);}})[_0x144f('0x1a')](function(_0x52f8ef){if(_0x52f8ef){return _0x52f8ef?{'count':_0x4ad1f8,'rows':_0x52f8ef}:null;}})[_0x144f('0x1a')](respondWithResult(_0x3f65da,null))[_0x144f('0x4c')](handleError(_0x3f65da,null));};exports[_0x144f('0x53')]=function(_0x33cbe2,_0x29caf2,_0x3c1783){if(_0x33cbe2[_0x144f('0x4e')]['id']){delete _0x33cbe2[_0x144f('0x4e')]['id'];}return db['ZohoAccount'][_0x144f('0x54')]({'where':{'id':_0x33cbe2['params']['id']}})['then'](handleEntityNotFound(_0x29caf2,null))[_0x144f('0x1a')](function(_0x3f89e1){if(_0x3f89e1){_0x33cbe2[_0x144f('0x4e')][_0x144f('0x55')]=_0x3f89e1['id'];_0x33cbe2['body']['Subjects']=integrations[_0x144f('0x56')](_0x33cbe2['body'][_0x144f('0x57')],_0x33cbe2[_0x144f('0x4e')][_0x144f('0x58')]);_0x33cbe2[_0x144f('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x33cbe2[_0x144f('0x4e')][_0x144f('0x57')],_0x33cbe2[_0x144f('0x4e')][_0x144f('0x58')]);return db[_0x144f('0x50')][_0x144f('0x4d')](_0x33cbe2['body'],{'include':[{'model':db[_0x144f('0x59')],'as':_0x144f('0x5a')},{'model':db['ZohoField'],'as':_0x144f('0x5b')}]});}return null;})['then'](respondWithResult(_0x29caf2,null))[_0x144f('0x4c')](handleError(_0x29caf2,null));};exports['getFields']=function(_0x233629,_0x57e197,_0x3da6ab){return db[_0x144f('0x32')][_0x144f('0x54')]({'where':{'id':_0x233629[_0x144f('0x49')]['id']},'attributes':['id',_0x144f('0x5c'),_0x144f('0x5d')]})[_0x144f('0x1a')](handleEntityNotFound(_0x57e197,null))[_0x144f('0x1a')](function(_0x5afff1){if(_0x5afff1){return rp({'method':'GET','uri':util[_0x144f('0x5e')](_0x144f('0x5f'),_0x5afff1[_0x144f('0x5c')]),'qs':{'authtoken':_0x5afff1[_0x144f('0x5d')],'scope':_0x144f('0x60')},'json':!![]});}})[_0x144f('0x1a')](function(_0x534391){if(_0x534391){if(_0x534391[_0x144f('0x61')]&&_0x534391[_0x144f('0x61')][_0x144f('0x21')]){throw new Error(_0x534391[_0x144f('0x61')][_0x144f('0x21')][_0x144f('0x23')]);}var _0x7bb4a7=[];if(_0x534391['Calls']&&_0x534391['Calls'][_0x144f('0x62')]){if(_0x534391[_0x144f('0x63')][_0x144f('0x62')]['FL']){var _0x1abcd1=[_0x144f('0x64')];for(var _0x4e8188=0x0,_0x2dd300=_0x534391[_0x144f('0x63')][_0x144f('0x62')]['FL'][_0x144f('0x3c')];_0x4e8188<_0x2dd300;_0x4e8188++){if(_[_0x144f('0x65')](_0x1abcd1,_0x534391[_0x144f('0x63')]['section']['FL'][_0x4e8188]['dv'])){_0x7bb4a7[_0x144f('0x66')]({'id':_0x534391[_0x144f('0x63')][_0x144f('0x62')]['FL'][_0x4e8188]['dv'],'name':_0x534391['Calls'][_0x144f('0x62')]['FL'][_0x4e8188][_0x144f('0x67')],'custom':_0x534391[_0x144f('0x63')]['section']['FL'][_0x4e8188][_0x144f('0x68')]===_0x144f('0x69')?!![]:![],'options':_0x534391[_0x144f('0x63')][_0x144f('0x62')]['FL'][_0x4e8188]['type']===_0x144f('0x6a')&&_0x534391['Calls']['section']['FL'][_0x4e8188][_0x144f('0x6b')]?_[_0x144f('0x44')](_0x534391[_0x144f('0x63')]['section']['FL'][_0x4e8188]['val'],function(_0x4c5202){return{'name':_0x4c5202,'value':_0x4c5202};}):[]});}}}}return{'count':_0x7bb4a7['length'],'rows':_0x7bb4a7};}})[_0x144f('0x1a')](respondWithResult(_0x57e197,null))[_0x144f('0x4c')](function(_0x159f1f){var _0x2cf8a1=_0x233629[_0x144f('0x36')][_0x144f('0x6c')]?0x1f4:_0x159f1f[_0x144f('0x6d')]||0x1f4;logger[_0x144f('0x21')](_0x144f('0x6e'),_0x144f('0x6f'),_0x2cf8a1,JSON[_0x144f('0x20')](_0x159f1f));delete _0x159f1f['name'];if(_0x2cf8a1===0x191){_0x2cf8a1=0x190;}_0x57e197['status'](_0x2cf8a1)[_0x144f('0x30')](_0x233629[_0x144f('0x36')][_0x144f('0x6c')]?{'message':_0x144f('0x70'),'statusCode':_0x159f1f[_0x144f('0x6d')]}:_0x159f1f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ce7a295..aefa17e 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 _0xeb7a=['int_zoho_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','./intZohoAccount.attributes','define','ZohoAccount'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xeb7a,0x14b));var _0xaeb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb7a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaeb7('0x0'));var util=require('util');var logger=require(_0xaeb7('0x1'))(_0xaeb7('0x2'));var moment=require(_0xaeb7('0x3'));var BPromise=require(_0xaeb7('0x4'));var rp=require(_0xaeb7('0x5'));var attributes=require(_0xaeb7('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x575587,_0x2c50b8){return _0x575587[_0xaeb7('0x7')](_0xaeb7('0x8'),attributes,{'tableName':_0xaeb7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebb5=['bluebird','request-promise','./intZohoAccount.attributes','exports','define','ZohoAccount','lodash','../../config/logger','moment'];(function(_0x4da0d8,_0x27c7ba){var _0x4bc13b=function(_0x5db2e7){while(--_0x5db2e7){_0x4da0d8['push'](_0x4da0d8['shift']());}};_0x4bc13b(++_0x27c7ba);}(_0xebb5,0x1b6));var _0x5ebb=function(_0x213f58,_0x150c52){_0x213f58=_0x213f58-0x0;var _0x3c24d6=_0xebb5[_0x213f58];return _0x3c24d6;};'use strict';var _=require(_0x5ebb('0x0'));var util=require('util');var logger=require(_0x5ebb('0x1'))('api');var moment=require(_0x5ebb('0x2'));var BPromise=require(_0x5ebb('0x3'));var rp=require(_0x5ebb('0x4'));var attributes=require(_0x5ebb('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x5ebb('0x6')]=function(_0x2d9bd7,_0x187c9c){return _0x2d9bd7[_0x5ebb('0x7')](_0x5ebb('0x8'),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 f964a56..155514c 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 _0xc526=['findAll','options','where','attributes','limit','include','map','model','then','ShowZohoAccount','ZohoAccount','find','raw','util','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZohoAccount'];(function(_0x5e5ba8,_0x5fd1e6){var _0x72b765=function(_0x4d3270){while(--_0x4d3270){_0x5e5ba8['push'](_0x5e5ba8['shift']());}};_0x72b765(++_0x5fd1e6);}(_0xc526,0x124));var _0x6c52=function(_0x9d352d,_0x4be5bb){_0x9d352d=_0x9d352d-0x0;var _0x4d8dc1=_0xc526[_0x9d352d];return _0x4d8dc1;};'use strict';var _=require('lodash');var util=require(_0x6c52('0x0'));var moment=require('moment');var BPromise=require(_0x6c52('0x1'));var rs=require(_0x6c52('0x2'));var fs=require('fs');var Redis=require(_0x6c52('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c52('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6c52('0x5'));var client=jayson[_0x6c52('0x6')][_0x6c52('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x130ce8,_0x51b6d1,_0x3d4473){return new BPromise(function(_0x2ce9b3,_0x2bdf36){return client['request'](_0x130ce8,_0x3d4473)['then'](function(_0x3309bb){logger[_0x6c52('0x8')](_0x6c52('0x9'),_0x51b6d1,_0x6c52('0xa'));logger[_0x6c52('0xb')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x51b6d1,_0x6c52('0xa'),JSON[_0x6c52('0xc')](_0x3309bb));if(_0x3309bb[_0x6c52('0xd')]){if(_0x3309bb['error'][_0x6c52('0xe')]===0x1f4){logger['error'](_0x6c52('0x9'),_0x51b6d1,_0x3309bb[_0x6c52('0xd')][_0x6c52('0xf')]);return _0x2bdf36(_0x3309bb[_0x6c52('0xd')][_0x6c52('0xf')]);}logger[_0x6c52('0xd')](_0x6c52('0x9'),_0x51b6d1,_0x3309bb[_0x6c52('0xd')][_0x6c52('0xf')]);return _0x2ce9b3(_0x3309bb[_0x6c52('0xd')][_0x6c52('0xf')]);}else{logger[_0x6c52('0x8')](_0x6c52('0x9'),_0x51b6d1,_0x6c52('0xa'));_0x2ce9b3(_0x3309bb['result']['message']);}})[_0x6c52('0x10')](function(_0x5c5c28){logger[_0x6c52('0xd')](_0x6c52('0x9'),_0x51b6d1,_0x5c5c28);_0x2bdf36(_0x5c5c28);});});}exports[_0x6c52('0x11')]=function(_0x50aad9){var _0x5dd95b=this;return new Promise(function(_0x493e9e,_0x4e1a83){return db['ZohoAccount'][_0x6c52('0x12')]({'raw':_0x50aad9[_0x6c52('0x13')]?_0x50aad9[_0x6c52('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x50aad9[_0x6c52('0x13')]?_0x50aad9[_0x6c52('0x13')][_0x6c52('0x14')]||null:null,'attributes':_0x50aad9[_0x6c52('0x13')]?_0x50aad9['options'][_0x6c52('0x15')]||null:null,'limit':_0x50aad9[_0x6c52('0x13')]?_0x50aad9[_0x6c52('0x13')][_0x6c52('0x16')]||null:null,'include':_0x50aad9[_0x6c52('0x13')]?_0x50aad9['options'][_0x6c52('0x17')]?_[_0x6c52('0x18')](_0x50aad9[_0x6c52('0x13')][_0x6c52('0x17')],function(_0x176c2f){return{'model':db[_0x176c2f[_0x6c52('0x19')]],'as':_0x176c2f['as'],'attributes':_0x176c2f['attributes'],'include':_0x176c2f[_0x6c52('0x17')]?_['map'](_0x176c2f[_0x6c52('0x17')],function(_0x2c3273){return{'model':db[_0x2c3273['model']],'as':_0x2c3273['as'],'attributes':_0x2c3273['attributes'],'include':_0x2c3273['include']?_['map'](_0x2c3273['include'],function(_0x8a3495){return{'model':db[_0x8a3495[_0x6c52('0x19')]],'as':_0x8a3495['as'],'attributes':_0x8a3495[_0x6c52('0x15')]};}):[]};}):[]};}):[]:[]})[_0x6c52('0x1a')](function(_0x39672c){logger[_0x6c52('0x8')](_0x6c52('0x11'),_0x50aad9);logger[_0x6c52('0xb')](_0x6c52('0x11'),_0x50aad9,JSON[_0x6c52('0xc')](_0x39672c));_0x493e9e(_0x39672c);})['catch'](function(_0x4c7edb){logger[_0x6c52('0xd')](_0x6c52('0x11'),_0x4c7edb[_0x6c52('0xf')],_0x50aad9);_0x4e1a83(_0x5dd95b[_0x6c52('0xd')](0x1f4,_0x4c7edb[_0x6c52('0xf')]));});});};exports[_0x6c52('0x1b')]=function(_0x255faf){var _0x2ae667=this;return new Promise(function(_0x432c32,_0x25d90c){return db[_0x6c52('0x1c')][_0x6c52('0x1d')]({'raw':_0x255faf['options']?_0x255faf[_0x6c52('0x13')][_0x6c52('0x1e')]===undefined?!![]:![]:!![],'where':_0x255faf[_0x6c52('0x13')]?_0x255faf['options']['where']||null:null,'attributes':_0x255faf[_0x6c52('0x13')]?_0x255faf[_0x6c52('0x13')][_0x6c52('0x15')]||null:null,'include':_0x255faf[_0x6c52('0x13')]?_0x255faf[_0x6c52('0x13')][_0x6c52('0x17')]?_['map'](_0x255faf[_0x6c52('0x13')][_0x6c52('0x17')],function(_0x158d19){return{'model':db[_0x158d19[_0x6c52('0x19')]],'as':_0x158d19['as'],'attributes':_0x158d19[_0x6c52('0x15')],'include':_0x158d19[_0x6c52('0x17')]?_['map'](_0x158d19['include'],function(_0x273960){return{'model':db[_0x273960[_0x6c52('0x19')]],'as':_0x273960['as'],'attributes':_0x273960[_0x6c52('0x15')],'include':_0x273960[_0x6c52('0x17')]?_[_0x6c52('0x18')](_0x273960[_0x6c52('0x17')],function(_0x4af8aa){return{'model':db[_0x4af8aa[_0x6c52('0x19')]],'as':_0x4af8aa['as'],'attributes':_0x4af8aa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b3766){logger[_0x6c52('0x8')](_0x6c52('0x1b'),_0x255faf);logger[_0x6c52('0xb')](_0x6c52('0x1b'),_0x255faf,JSON[_0x6c52('0xc')](_0x4b3766));_0x432c32(_0x4b3766);})['catch'](function(_0xbec9de){logger[_0x6c52('0xd')](_0x6c52('0x1b'),_0xbec9de[_0x6c52('0xf')],_0x255faf);_0x25d90c(_0x2ae667['error'](0x1f4,_0xbec9de[_0x6c52('0xf')]));});});}; \ No newline at end of file +var _0x5522=['catch','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0x5522,0x1bd));var _0x2552=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5522[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x2552('0x0'));var util=require(_0x2552('0x1'));var moment=require(_0x2552('0x2'));var BPromise=require(_0x2552('0x3'));var rs=require(_0x2552('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2552('0x5'))['db'];var utils=require(_0x2552('0x6'));var logger=require(_0x2552('0x7'))('rpc');var config=require(_0x2552('0x8'));var jayson=require(_0x2552('0x9'));var client=jayson['client'][_0x2552('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b8d88,_0x3810df,_0xdba28f){return new BPromise(function(_0x8357e1,_0x35730f){return client[_0x2552('0xb')](_0x1b8d88,_0xdba28f)[_0x2552('0xc')](function(_0x8b43e0){logger[_0x2552('0xd')](_0x2552('0xe'),_0x3810df,'request\x20sent');logger[_0x2552('0xf')](_0x2552('0x10'),_0x3810df,_0x2552('0x11'),JSON[_0x2552('0x12')](_0x8b43e0));if(_0x8b43e0[_0x2552('0x13')]){if(_0x8b43e0['error'][_0x2552('0x14')]===0x1f4){logger[_0x2552('0x13')](_0x2552('0xe'),_0x3810df,_0x8b43e0[_0x2552('0x13')][_0x2552('0x15')]);return _0x35730f(_0x8b43e0[_0x2552('0x13')][_0x2552('0x15')]);}logger[_0x2552('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x3810df,_0x8b43e0[_0x2552('0x13')][_0x2552('0x15')]);return _0x8357e1(_0x8b43e0[_0x2552('0x13')][_0x2552('0x15')]);}else{logger[_0x2552('0xd')](_0x2552('0xe'),_0x3810df,_0x2552('0x11'));_0x8357e1(_0x8b43e0[_0x2552('0x16')][_0x2552('0x15')]);}})[_0x2552('0x17')](function(_0x498866){logger['error'](_0x2552('0xe'),_0x3810df,_0x498866);_0x35730f(_0x498866);});});}exports['GetZohoAccount']=function(_0x45de77){var _0x596edf=this;return new Promise(function(_0x5beec8,_0x34ac3a){return db[_0x2552('0x18')][_0x2552('0x19')]({'raw':_0x45de77[_0x2552('0x1a')]?_0x45de77[_0x2552('0x1a')][_0x2552('0x1b')]===undefined?!![]:![]:!![],'where':_0x45de77[_0x2552('0x1a')]?_0x45de77['options'][_0x2552('0x1c')]||null:null,'attributes':_0x45de77['options']?_0x45de77[_0x2552('0x1a')][_0x2552('0x1d')]||null:null,'limit':_0x45de77['options']?_0x45de77[_0x2552('0x1a')][_0x2552('0x1e')]||null:null,'include':_0x45de77[_0x2552('0x1a')]?_0x45de77['options'][_0x2552('0x1f')]?_[_0x2552('0x20')](_0x45de77['options'][_0x2552('0x1f')],function(_0x3ea83d){return{'model':db[_0x3ea83d[_0x2552('0x21')]],'as':_0x3ea83d['as'],'attributes':_0x3ea83d['attributes'],'include':_0x3ea83d[_0x2552('0x1f')]?_[_0x2552('0x20')](_0x3ea83d[_0x2552('0x1f')],function(_0x147c62){return{'model':db[_0x147c62[_0x2552('0x21')]],'as':_0x147c62['as'],'attributes':_0x147c62['attributes'],'include':_0x147c62['include']?_[_0x2552('0x20')](_0x147c62[_0x2552('0x1f')],function(_0x3ff48a){return{'model':db[_0x3ff48a[_0x2552('0x21')]],'as':_0x3ff48a['as'],'attributes':_0x3ff48a[_0x2552('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2552('0xc')](function(_0x27ba54){logger['info'](_0x2552('0x22'),_0x45de77);logger[_0x2552('0xf')]('GetZohoAccount',_0x45de77,JSON[_0x2552('0x12')](_0x27ba54));_0x5beec8(_0x27ba54);})[_0x2552('0x17')](function(_0x4551f0){logger[_0x2552('0x13')](_0x2552('0x22'),_0x4551f0[_0x2552('0x15')],_0x45de77);_0x34ac3a(_0x596edf[_0x2552('0x13')](0x1f4,_0x4551f0[_0x2552('0x15')]));});});};exports[_0x2552('0x23')]=function(_0x1dae94){var _0x19772c=this;return new Promise(function(_0xb640f5,_0x2f7d2c){return db['ZohoAccount']['find']({'raw':_0x1dae94[_0x2552('0x1a')]?_0x1dae94[_0x2552('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1dae94[_0x2552('0x1a')]?_0x1dae94[_0x2552('0x1a')][_0x2552('0x1c')]||null:null,'attributes':_0x1dae94[_0x2552('0x1a')]?_0x1dae94[_0x2552('0x1a')][_0x2552('0x1d')]||null:null,'include':_0x1dae94[_0x2552('0x1a')]?_0x1dae94[_0x2552('0x1a')]['include']?_['map'](_0x1dae94['options']['include'],function(_0xfb781d){return{'model':db[_0xfb781d['model']],'as':_0xfb781d['as'],'attributes':_0xfb781d[_0x2552('0x1d')],'include':_0xfb781d[_0x2552('0x1f')]?_['map'](_0xfb781d[_0x2552('0x1f')],function(_0x24c3a9){return{'model':db[_0x24c3a9[_0x2552('0x21')]],'as':_0x24c3a9['as'],'attributes':_0x24c3a9['attributes'],'include':_0x24c3a9[_0x2552('0x1f')]?_[_0x2552('0x20')](_0x24c3a9[_0x2552('0x1f')],function(_0x5cffe7){return{'model':db[_0x5cffe7[_0x2552('0x21')]],'as':_0x5cffe7['as'],'attributes':_0x5cffe7[_0x2552('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2552('0xc')](function(_0xba9482){logger[_0x2552('0xd')](_0x2552('0x23'),_0x1dae94);logger['debug']('ShowZohoAccount',_0x1dae94,JSON[_0x2552('0x12')](_0xba9482));_0xb640f5(_0xba9482);})['catch'](function(_0x25ec79){logger[_0x2552('0x13')](_0x2552('0x23'),_0x25ec79['message'],_0x1dae94);_0x2f7d2c(_0x19772c[_0x2552('0x13')](0x1f4,_0x25ec79[_0x2552('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index f114427..ffde70e 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 _0xed01=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x439c7a,_0x77d22f){var _0xc957b1=function(_0x596498){while(--_0x596498){_0x439c7a['push'](_0x439c7a['shift']());}};_0xc957b1(++_0x77d22f);}(_0xed01,0xd0));var _0x1ed0=function(_0x24a711,_0x2c44e7){_0x24a711=_0x24a711-0x0;var _0x24dad5=_0xed01[_0x24a711];return _0x24dad5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1ed0('0x0'));var timeout=require(_0x1ed0('0x1'));var express=require(_0x1ed0('0x2'));var router=express[_0x1ed0('0x3')]();var auth=require(_0x1ed0('0x4'));var interaction=require(_0x1ed0('0x5'));var config=require(_0x1ed0('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x1ed0('0x7')]('/',auth[_0x1ed0('0x8')](),controller[_0x1ed0('0x9')]);router[_0x1ed0('0x7')](_0x1ed0('0xa'),auth[_0x1ed0('0x8')](),controller[_0x1ed0('0xb')]);router[_0x1ed0('0x7')](_0x1ed0('0xc'),auth[_0x1ed0('0x8')](),controller[_0x1ed0('0xd')]);router[_0x1ed0('0x7')](_0x1ed0('0xe'),auth[_0x1ed0('0x8')](),controller[_0x1ed0('0xf')]);router[_0x1ed0('0x7')](_0x1ed0('0x10'),auth['isAuthenticated'](),controller[_0x1ed0('0x11')]);router[_0x1ed0('0x12')]('/',auth['isAuthenticated'](),controller[_0x1ed0('0x13')]);router[_0x1ed0('0x14')](_0x1ed0('0xa'),auth[_0x1ed0('0x8')](),controller[_0x1ed0('0x15')]);router[_0x1ed0('0x16')](_0x1ed0('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1ed0('0x17')]=router; \ No newline at end of file +var _0x6453=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x453a31,_0x153ff6){var _0xf77abf=function(_0x147fb7){while(--_0x147fb7){_0x453a31['push'](_0x453a31['shift']());}};_0xf77abf(++_0x153ff6);}(_0x6453,0x88));var _0x3645=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0x6453[_0x305b20];return _0x26d64a;};'use strict';var multer=require(_0x3645('0x0'));var util=require(_0x3645('0x1'));var path=require('path');var timeout=require(_0x3645('0x2'));var express=require(_0x3645('0x3'));var router=express[_0x3645('0x4')]();var auth=require(_0x3645('0x5'));var interaction=require(_0x3645('0x6'));var config=require(_0x3645('0x7'));var controller=require(_0x3645('0x8'));router[_0x3645('0x9')]('/',auth[_0x3645('0xa')](),controller[_0x3645('0xb')]);router[_0x3645('0x9')](_0x3645('0xc'),auth[_0x3645('0xa')](),controller[_0x3645('0xd')]);router[_0x3645('0x9')](_0x3645('0xe'),auth[_0x3645('0xa')](),controller[_0x3645('0xf')]);router[_0x3645('0x9')](_0x3645('0x10'),auth[_0x3645('0xa')](),controller[_0x3645('0x11')]);router['get'](_0x3645('0x12'),auth[_0x3645('0xa')](),controller[_0x3645('0x13')]);router['post']('/',auth[_0x3645('0xa')](),controller[_0x3645('0x14')]);router[_0x3645('0x15')]('/:id',auth[_0x3645('0xa')](),controller[_0x3645('0x16')]);router['delete'](_0x3645('0xc'),auth[_0x3645('0xa')](),controller[_0x3645('0x17')]);module[_0x3645('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index aad1e30..f70f9bd 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 _0x70f8=['sequelize','exports','STRING'];(function(_0x40a531,_0x5bbb1c){var _0x17c9e8=function(_0x43993d){while(--_0x43993d){_0x40a531['push'](_0x40a531['shift']());}};_0x17c9e8(++_0x5bbb1c);}(_0x70f8,0x18f));var _0x870f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x70f8[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x870f('0x0'));module[_0x870f('0x1')]={'name':{'type':Sequelize[_0x870f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x724d=['STRING','sequelize','exports'];(function(_0x4ec528,_0x2fd913){var _0x1c8246=function(_0x23cfa8){while(--_0x23cfa8){_0x4ec528['push'](_0x4ec528['shift']());}};_0x1c8246(++_0x2fd913);}(_0x724d,0x130));var _0xd724=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0x724d[_0x291f8b];return _0x275171;};'use strict';var Sequelize=require(_0xd724('0x0'));module[_0xd724('0x1')]={'name':{'type':Sequelize[_0xd724('0x2')]},'description':{'type':Sequelize[_0xd724('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 047813a..85337ff 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 _0xbb98=['to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','update','destroy','sendStatus','stack','name','send','rawAttributes','keys','query','dateEnd','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','dateStart','add','day','merge','filter','options','ZohoConfiguration','findAll','rows','includeAll','include','create','body','find','params','getFields','ZohoField','map','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','sox'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xbb98,0x140));var _0x8bb9=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0xbb98[_0x22dac7];return _0x3e6cfa;};'use strict';var pdf=require(_0x8bb9('0x0'));var emlformat=require(_0x8bb9('0x1'));var rimraf=require(_0x8bb9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8bb9('0x3'));var moment=require(_0x8bb9('0x4'));var BPromise=require(_0x8bb9('0x5'));var Mustache=require('mustache');var util=require(_0x8bb9('0x6'));var path=require('path');var sox=require(_0x8bb9('0x7'));var csv=require(_0x8bb9('0x8'));var ejs=require(_0x8bb9('0x9'));var fs=require('fs');var _=require(_0x8bb9('0xa'));var squel=require(_0x8bb9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8bb9('0xc'));var toCsv=require(_0x8bb9('0x8'));var querystring=require(_0x8bb9('0xd'));var Papa=require(_0x8bb9('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8bb9('0xf'));var utils=require(_0x8bb9('0x10'));var config=require(_0x8bb9('0x11'));var db=require(_0x8bb9('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x8bb9('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x4d2118,_0x280ac5,_0x26448a,_0x498d60){return new BPromise(function(_0x61bf4a,_0x1d33ec){var _0x4fa737=_0x498d60||client;return _0x4fa737[_0x8bb9('0x14')](_0x4d2118,_0x26448a)[_0x8bb9('0x15')](function(_0x16098a){logger[_0x8bb9('0x16')](_0x8bb9('0x17'),_0x280ac5,_0x8bb9('0x18'));logger[_0x8bb9('0x19')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x280ac5,_0x8bb9('0x18'),JSON['stringify'](_0x16098a));if(_0x16098a[_0x8bb9('0x1a')]){if(_0x16098a[_0x8bb9('0x1a')][_0x8bb9('0x1b')]===0x1f4){logger[_0x8bb9('0x1a')](_0x8bb9('0x17'),_0x280ac5,_0x16098a[_0x8bb9('0x1a')][_0x8bb9('0x1c')]);return _0x1d33ec(_0x16098a[_0x8bb9('0x1a')][_0x8bb9('0x1c')]);}logger['error'](_0x8bb9('0x17'),_0x280ac5,_0x16098a[_0x8bb9('0x1a')]['message']);return _0x61bf4a(_0x16098a[_0x8bb9('0x1a')][_0x8bb9('0x1c')]);}else{logger[_0x8bb9('0x16')](_0x8bb9('0x17'),_0x280ac5,_0x8bb9('0x18'));_0x61bf4a(_0x16098a[_0x8bb9('0x1d')][_0x8bb9('0x1c')]);}})[_0x8bb9('0x1e')](function(_0x39849b){logger[_0x8bb9('0x1a')](_0x8bb9('0x17'),_0x280ac5,_0x39849b);_0x1d33ec(_0x39849b);});});}function respondWithStatusCode(_0x24d33a,_0x5092d7){_0x5092d7=_0x5092d7||0xcc;return function(_0x54205e){if(_0x54205e){return _0x24d33a['sendStatus'](_0x5092d7);}return _0x24d33a[_0x8bb9('0x1f')](_0x5092d7)[_0x8bb9('0x20')]();};}function respondWithResult(_0x361da8,_0x5d604b){_0x5d604b=_0x5d604b||0xc8;return function(_0x2c5321){if(_0x2c5321){return _0x361da8['status'](_0x5d604b)[_0x8bb9('0x21')](_0x2c5321);}};}function respondWithFilteredResult(_0x22ae53,_0x200e83){return function(_0x2ee44e){if(_0x2ee44e){var _0x1e16a7=_0x2ee44e[_0x8bb9('0x22')],_0x499661=_0x200e83[_0x8bb9('0x23')],_0x2dcaf9=_0x200e83[_0x8bb9('0x23')]+_0x200e83[_0x8bb9('0x24')],_0x2b45b0;if(_0x2dcaf9>=_0x1e16a7){_0x2dcaf9=_0x1e16a7;_0x2b45b0=0xc8;}else{_0x2b45b0=0xce;}_0x22ae53[_0x8bb9('0x1f')](_0x2b45b0);return _0x22ae53[_0x8bb9('0x25')](_0x8bb9('0x26'),_0x499661+'-'+_0x2dcaf9+'/'+_0x1e16a7)[_0x8bb9('0x21')](_0x2ee44e);}return null;};}function patchUpdates(_0x1f9c21){return function(_0x25f538){try{jsonpatch['apply'](_0x25f538,_0x1f9c21,!![]);}catch(_0x3c4522){return BPromise['reject'](_0x3c4522);}return _0x25f538['save']();};}function saveUpdates(_0x25123c,_0x8018f2){return function(_0x5b45f8){if(_0x5b45f8){return _0x5b45f8[_0x8bb9('0x27')](_0x25123c)['then'](function(_0x124894){return _0x124894;});}return null;};}function removeEntity(_0x3f39ce,_0x45f0fc){return function(_0x1e1984){if(_0x1e1984){return _0x1e1984[_0x8bb9('0x28')]()[_0x8bb9('0x15')](function(){_0x3f39ce[_0x8bb9('0x1f')](0xcc)[_0x8bb9('0x20')]();});}};}function handleEntityNotFound(_0xb03d53,_0x46c45f){return function(_0x16b709){if(!_0x16b709){_0xb03d53[_0x8bb9('0x29')](0x194);}return _0x16b709;};}function handleError(_0x4f5242,_0x548cdf){_0x548cdf=_0x548cdf||0x1f4;return function(_0x5dd6c7){logger['error'](_0x5dd6c7[_0x8bb9('0x2a')]);if(_0x5dd6c7[_0x8bb9('0x2b')]){delete _0x5dd6c7[_0x8bb9('0x2b')];}_0x4f5242['status'](_0x548cdf)[_0x8bb9('0x2c')](_0x5dd6c7);};}exports['index']=function(_0x464587,_0x2ea5ab){var _0x3bf33d={},_0x14fb72={},_0x1af845={'count':0x0,'rows':[]};var _0x26f428=db['ZohoConfiguration'][_0x8bb9('0x2d')];_0x14fb72['model']=_[_0x8bb9('0x2e')](_0x26f428);var _0x3b15f1={'dateStart':_0x464587[_0x8bb9('0x2f')]['dateStart'],'dateEnd':_0x464587[_0x8bb9('0x2f')][_0x8bb9('0x30')]};delete _0x464587[_0x8bb9('0x2f')]['dateStart'];delete _0x464587['query'][_0x8bb9('0x30')];_0x14fb72[_0x8bb9('0x2f')]=_[_0x8bb9('0x2e')](_0x464587[_0x8bb9('0x2f')]);_0x14fb72['filters']=_[_0x8bb9('0x31')](_0x14fb72['model'],_0x14fb72[_0x8bb9('0x2f')]);_0x3bf33d[_0x8bb9('0x32')]=_['intersection'](_0x14fb72[_0x8bb9('0x33')],qs[_0x8bb9('0x34')](_0x464587['query'][_0x8bb9('0x34')]));_0x3bf33d['attributes']=_0x3bf33d[_0x8bb9('0x32')][_0x8bb9('0x35')]?_0x3bf33d[_0x8bb9('0x32')]:_0x14fb72[_0x8bb9('0x33')];if(!_0x464587['query'][_0x8bb9('0x36')](_0x8bb9('0x37'))){_0x3bf33d[_0x8bb9('0x24')]=qs['limit'](_0x464587[_0x8bb9('0x2f')][_0x8bb9('0x24')]);_0x3bf33d['offset']=qs[_0x8bb9('0x23')](_0x464587[_0x8bb9('0x2f')][_0x8bb9('0x23')]);}_0x3bf33d[_0x8bb9('0x38')]=qs['sort'](_0x464587[_0x8bb9('0x2f')][_0x8bb9('0x39')]);_0x3bf33d[_0x8bb9('0x3a')]=qs[_0x8bb9('0x3b')](_[_0x8bb9('0x3c')](_0x464587['query'],_0x14fb72[_0x8bb9('0x3b')]));if(_0x3b15f1[_0x8bb9('0x3d')]){if(_0x3b15f1[_0x8bb9('0x30')]){_0x3b15f1[_0x8bb9('0x30')]=moment(_0x3b15f1[_0x8bb9('0x30')])[_0x8bb9('0x3e')](0x1,_0x8bb9('0x3f'));}else{_0x3b15f1[_0x8bb9('0x30')]=moment(_0x3b15f1[_0x8bb9('0x3d')])[_0x8bb9('0x3e')](0x1,_0x8bb9('0x3f'));}_[_0x8bb9('0x40')](_0x3bf33d[_0x8bb9('0x3a')],{'createdAt':{'$gte':_0x3b15f1[_0x8bb9('0x3d')],'$lte':_0x3b15f1[_0x8bb9('0x30')]}});}if(_0x464587[_0x8bb9('0x2f')][_0x8bb9('0x41')]){_0x3bf33d['where']=_[_0x8bb9('0x40')](_0x3bf33d[_0x8bb9('0x3a')],{'$or':_['map'](_0x3bf33d[_0x8bb9('0x32')],function(_0x55b6f1){var _0x3eb03c={};_0x3eb03c[_0x55b6f1]={'$like':'%'+_0x464587[_0x8bb9('0x2f')][_0x8bb9('0x41')]+'%'};return _0x3eb03c;})});}_0x3bf33d=_[_0x8bb9('0x40')]({},_0x3bf33d,_0x464587[_0x8bb9('0x42')]);var _0x589911={'where':_0x3bf33d['where']};return db['ZohoConfiguration'][_0x8bb9('0x22')](_0x589911)['then'](function(_0x32cc95){_0x1af845[_0x8bb9('0x22')]=_0x32cc95;if(_0x464587[_0x8bb9('0x2f')]['includeAll']){_0x3bf33d['include']=[{'all':!![]}];}return db[_0x8bb9('0x43')][_0x8bb9('0x44')](_0x3bf33d);})[_0x8bb9('0x15')](function(_0x4dff52){_0x1af845[_0x8bb9('0x45')]=_0x4dff52;return _0x1af845;})['then'](respondWithFilteredResult(_0x2ea5ab,_0x3bf33d))['catch'](handleError(_0x2ea5ab,null));};exports['show']=function(_0x18083b,_0x1f9b4d){var _0x329d38={'raw':![],'where':{'id':_0x18083b['params']['id']}},_0xa12a37={};_0xa12a37[_0x8bb9('0x33')]=_[_0x8bb9('0x2e')](db[_0x8bb9('0x43')][_0x8bb9('0x2d')]);_0xa12a37['query']=_[_0x8bb9('0x2e')](_0x18083b[_0x8bb9('0x2f')]);_0xa12a37[_0x8bb9('0x3b')]=_['intersection'](_0xa12a37['model'],_0xa12a37['query']);_0x329d38[_0x8bb9('0x32')]=_[_0x8bb9('0x31')](_0xa12a37[_0x8bb9('0x33')],qs[_0x8bb9('0x34')](_0x18083b[_0x8bb9('0x2f')][_0x8bb9('0x34')]));_0x329d38[_0x8bb9('0x32')]=_0x329d38[_0x8bb9('0x32')][_0x8bb9('0x35')]?_0x329d38['attributes']:_0xa12a37[_0x8bb9('0x33')];if(_0x18083b[_0x8bb9('0x2f')][_0x8bb9('0x46')]){_0x329d38[_0x8bb9('0x47')]=[{'all':!![]}];}_0x329d38=_[_0x8bb9('0x40')]({},_0x329d38,_0x18083b[_0x8bb9('0x42')]);return db[_0x8bb9('0x43')]['find'](_0x329d38)[_0x8bb9('0x15')](handleEntityNotFound(_0x1f9b4d,null))[_0x8bb9('0x15')](respondWithResult(_0x1f9b4d,null))['catch'](handleError(_0x1f9b4d,null));};exports[_0x8bb9('0x48')]=function(_0xad8c63,_0x3c6c3c){return db[_0x8bb9('0x43')][_0x8bb9('0x48')](_0xad8c63[_0x8bb9('0x49')],{})[_0x8bb9('0x15')](respondWithResult(_0x3c6c3c,0xc9))[_0x8bb9('0x1e')](handleError(_0x3c6c3c,null));};exports[_0x8bb9('0x27')]=function(_0x1df881,_0x330fbe){if(_0x1df881[_0x8bb9('0x49')]['id']){delete _0x1df881[_0x8bb9('0x49')]['id'];}return db[_0x8bb9('0x43')][_0x8bb9('0x4a')]({'where':{'id':_0x1df881[_0x8bb9('0x4b')]['id']}})[_0x8bb9('0x15')](handleEntityNotFound(_0x330fbe,null))[_0x8bb9('0x15')](saveUpdates(_0x1df881[_0x8bb9('0x49')],null))[_0x8bb9('0x15')](respondWithResult(_0x330fbe,null))[_0x8bb9('0x1e')](handleError(_0x330fbe,null));};exports[_0x8bb9('0x28')]=function(_0x201164,_0x2e7c05){return db[_0x8bb9('0x43')][_0x8bb9('0x4a')]({'where':{'id':_0x201164['params']['id']}})[_0x8bb9('0x15')](handleEntityNotFound(_0x2e7c05,null))[_0x8bb9('0x15')](removeEntity(_0x2e7c05,null))['catch'](handleError(_0x2e7c05,null));};exports[_0x8bb9('0x4c')]=function(_0x3c388f,_0x2de822,_0x526f9f){var _0x381600={};var _0x4be62d={};var _0x330acb;var _0xefa87e;return db[_0x8bb9('0x43')]['findOne']({'where':{'id':_0x3c388f['params']['id']}})[_0x8bb9('0x15')](handleEntityNotFound(_0x2de822,null))[_0x8bb9('0x15')](function(_0xb07a35){if(_0xb07a35){_0x330acb=_0xb07a35;_0x4be62d[_0x8bb9('0x33')]=_[_0x8bb9('0x2e')](db[_0x8bb9('0x4d')][_0x8bb9('0x2d')]);_0x4be62d[_0x8bb9('0x2f')]=_[_0x8bb9('0x2e')](_0x3c388f['query']);_0x4be62d[_0x8bb9('0x3b')]=_[_0x8bb9('0x31')](_0x4be62d[_0x8bb9('0x33')],_0x4be62d[_0x8bb9('0x2f')]);_0x381600[_0x8bb9('0x32')]=_[_0x8bb9('0x31')](_0x4be62d['model'],qs['fields'](_0x3c388f['query']['fields']));_0x381600[_0x8bb9('0x32')]=_0x381600[_0x8bb9('0x32')][_0x8bb9('0x35')]?_0x381600[_0x8bb9('0x32')]:_0x4be62d[_0x8bb9('0x33')];_0x381600[_0x8bb9('0x38')]=qs[_0x8bb9('0x39')](_0x3c388f[_0x8bb9('0x2f')][_0x8bb9('0x39')]);_0x381600[_0x8bb9('0x3a')]=qs[_0x8bb9('0x3b')](_[_0x8bb9('0x3c')](_0x3c388f['query'],_0x4be62d[_0x8bb9('0x3b')]));if(_0x3c388f[_0x8bb9('0x2f')][_0x8bb9('0x41')]){_0x381600[_0x8bb9('0x3a')]=_['merge'](_0x381600[_0x8bb9('0x3a')],{'$or':_[_0x8bb9('0x4e')](_0x381600['attributes'],function(_0x511c88){var _0x1f123d={};_0x1f123d[_0x511c88]={'$like':'%'+_0x3c388f[_0x8bb9('0x2f')][_0x8bb9('0x41')]+'%'};return _0x1f123d;})});}_0x381600=_[_0x8bb9('0x40')]({},_0x381600,_0x3c388f[_0x8bb9('0x42')]);return _0x330acb['getFields'](_0x381600);}})['then'](function(_0x3c2884){if(_0x3c2884){_0xefa87e=_0x3c2884[_0x8bb9('0x35')];if(!_0x3c388f[_0x8bb9('0x2f')][_0x8bb9('0x36')](_0x8bb9('0x37'))){_0x381600['limit']=qs['limit'](_0x3c388f[_0x8bb9('0x2f')][_0x8bb9('0x24')]);_0x381600[_0x8bb9('0x23')]=qs[_0x8bb9('0x23')](_0x3c388f['query'][_0x8bb9('0x23')]);}return _0x330acb['getFields'](_0x381600);}})[_0x8bb9('0x15')](function(_0x12e334){if(_0x12e334){return _0x12e334?{'count':_0xefa87e,'rows':_0x12e334}:null;}})[_0x8bb9('0x15')](respondWithResult(_0x2de822,null))['catch'](handleError(_0x2de822,null));};exports[_0x8bb9('0x4f')]=function(_0x26f0cb,_0x1d9693,_0x27308f){var _0x567b64={};var _0x104ae7={};var _0x4ab310;var _0x1eb577;return db[_0x8bb9('0x43')][_0x8bb9('0x50')]({'where':{'id':_0x26f0cb[_0x8bb9('0x4b')]['id']}})[_0x8bb9('0x15')](handleEntityNotFound(_0x1d9693,null))[_0x8bb9('0x15')](function(_0x470fd6){if(_0x470fd6){_0x4ab310=_0x470fd6;_0x104ae7[_0x8bb9('0x33')]=_[_0x8bb9('0x2e')](db['ZohoField'][_0x8bb9('0x2d')]);_0x104ae7[_0x8bb9('0x2f')]=_[_0x8bb9('0x2e')](_0x26f0cb['query']);_0x104ae7[_0x8bb9('0x3b')]=_[_0x8bb9('0x31')](_0x104ae7[_0x8bb9('0x33')],_0x104ae7['query']);_0x567b64[_0x8bb9('0x32')]=_[_0x8bb9('0x31')](_0x104ae7[_0x8bb9('0x33')],qs[_0x8bb9('0x34')](_0x26f0cb[_0x8bb9('0x2f')][_0x8bb9('0x34')]));_0x567b64['attributes']=_0x567b64['attributes'][_0x8bb9('0x35')]?_0x567b64[_0x8bb9('0x32')]:_0x104ae7['model'];_0x567b64['order']=qs['sort'](_0x26f0cb[_0x8bb9('0x2f')][_0x8bb9('0x39')]);_0x567b64[_0x8bb9('0x3a')]=qs['filters'](_[_0x8bb9('0x3c')](_0x26f0cb['query'],_0x104ae7[_0x8bb9('0x3b')]));if(_0x26f0cb[_0x8bb9('0x2f')][_0x8bb9('0x41')]){_0x567b64[_0x8bb9('0x3a')]=_[_0x8bb9('0x40')](_0x567b64['where'],{'$or':_[_0x8bb9('0x4e')](_0x567b64[_0x8bb9('0x32')],function(_0x8d3459){var _0x2efd62={};_0x2efd62[_0x8d3459]={'$like':'%'+_0x26f0cb['query'][_0x8bb9('0x41')]+'%'};return _0x2efd62;})});}_0x567b64=_[_0x8bb9('0x40')]({},_0x567b64,_0x26f0cb[_0x8bb9('0x42')]);return _0x4ab310[_0x8bb9('0x4f')](_0x567b64);}})[_0x8bb9('0x15')](function(_0x243d6e){if(_0x243d6e){_0x1eb577=_0x243d6e['length'];if(!_0x26f0cb[_0x8bb9('0x2f')][_0x8bb9('0x36')]('nolimit')){_0x567b64[_0x8bb9('0x24')]=qs[_0x8bb9('0x24')](_0x26f0cb[_0x8bb9('0x2f')][_0x8bb9('0x24')]);_0x567b64['offset']=qs[_0x8bb9('0x23')](_0x26f0cb[_0x8bb9('0x2f')][_0x8bb9('0x23')]);}return _0x4ab310[_0x8bb9('0x4f')](_0x567b64);}})['then'](function(_0x535d4e){if(_0x535d4e){return _0x535d4e?{'count':_0x1eb577,'rows':_0x535d4e}:null;}})[_0x8bb9('0x15')](respondWithResult(_0x1d9693,null))[_0x8bb9('0x1e')](handleError(_0x1d9693,null));};exports['getDescriptions']=function(_0x52a682,_0x4a9508,_0x1be2c0){var _0x12e93e={};var _0x35b522={};var _0x2f8a47;var _0x3c2e68;return db['ZohoConfiguration'][_0x8bb9('0x50')]({'where':{'id':_0x52a682[_0x8bb9('0x4b')]['id']}})[_0x8bb9('0x15')](handleEntityNotFound(_0x4a9508,null))[_0x8bb9('0x15')](function(_0x5af6e8){if(_0x5af6e8){_0x2f8a47=_0x5af6e8;_0x35b522[_0x8bb9('0x33')]=_[_0x8bb9('0x2e')](db[_0x8bb9('0x4d')][_0x8bb9('0x2d')]);_0x35b522[_0x8bb9('0x2f')]=_['keys'](_0x52a682['query']);_0x35b522['filters']=_[_0x8bb9('0x31')](_0x35b522[_0x8bb9('0x33')],_0x35b522[_0x8bb9('0x2f')]);_0x12e93e[_0x8bb9('0x32')]=_['intersection'](_0x35b522[_0x8bb9('0x33')],qs[_0x8bb9('0x34')](_0x52a682[_0x8bb9('0x2f')][_0x8bb9('0x34')]));_0x12e93e[_0x8bb9('0x32')]=_0x12e93e[_0x8bb9('0x32')]['length']?_0x12e93e[_0x8bb9('0x32')]:_0x35b522[_0x8bb9('0x33')];_0x12e93e[_0x8bb9('0x38')]=qs['sort'](_0x52a682[_0x8bb9('0x2f')][_0x8bb9('0x39')]);_0x12e93e[_0x8bb9('0x3a')]=qs['filters'](_[_0x8bb9('0x3c')](_0x52a682['query'],_0x35b522[_0x8bb9('0x3b')]));if(_0x52a682['query'][_0x8bb9('0x41')]){_0x12e93e['where']=_[_0x8bb9('0x40')](_0x12e93e[_0x8bb9('0x3a')],{'$or':_[_0x8bb9('0x4e')](_0x12e93e[_0x8bb9('0x32')],function(_0x42f196){var _0x26aef8={};_0x26aef8[_0x42f196]={'$like':'%'+_0x52a682[_0x8bb9('0x2f')][_0x8bb9('0x41')]+'%'};return _0x26aef8;})});}_0x12e93e=_[_0x8bb9('0x40')]({},_0x12e93e,_0x52a682['options']);return _0x2f8a47[_0x8bb9('0x51')](_0x12e93e);}})[_0x8bb9('0x15')](function(_0x102d2b){if(_0x102d2b){_0x3c2e68=_0x102d2b[_0x8bb9('0x35')];if(!_0x52a682[_0x8bb9('0x2f')]['hasOwnProperty'](_0x8bb9('0x37'))){_0x12e93e[_0x8bb9('0x24')]=qs[_0x8bb9('0x24')](_0x52a682['query'][_0x8bb9('0x24')]);_0x12e93e[_0x8bb9('0x23')]=qs['offset'](_0x52a682[_0x8bb9('0x2f')][_0x8bb9('0x23')]);}return _0x2f8a47[_0x8bb9('0x51')](_0x12e93e);}})['then'](function(_0xad693c){if(_0xad693c){return _0xad693c?{'count':_0x3c2e68,'rows':_0xad693c}:null;}})[_0x8bb9('0x15')](respondWithResult(_0x4a9508,null))[_0x8bb9('0x1e')](handleError(_0x4a9508,null));}; \ No newline at end of file +var _0x5654=['destroy','findOne','ZohoField','map','getFields','nolimit','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','count','limit','set','Content-Range','apply','save','update','sendStatus','stack','name','send','index','ZohoConfiguration','rawAttributes','model','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','day','add','merge','where','filter','options','include','findAll','show','keys','find','create','body','params'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x5654,0x10e));var _0x4565=function(_0x5abfbc,_0x4fa659){_0x5abfbc=_0x5abfbc-0x0;var _0x4419ca=_0x5654[_0x5abfbc];return _0x4419ca;};'use strict';var pdf=require(_0x4565('0x0'));var emlformat=require(_0x4565('0x1'));var rimraf=require(_0x4565('0x2'));var zipdir=require(_0x4565('0x3'));var jsonpatch=require(_0x4565('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4565('0x5'));var Mustache=require('mustache');var util=require(_0x4565('0x6'));var path=require(_0x4565('0x7'));var sox=require(_0x4565('0x8'));var csv=require(_0x4565('0x9'));var ejs=require(_0x4565('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4565('0xb'));var crypto=require(_0x4565('0xc'));var jsforce=require(_0x4565('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4565('0x9'));var querystring=require('querystring');var Papa=require(_0x4565('0xe'));var Redis=require(_0x4565('0xf'));var qs=require(_0x4565('0x10'));var logger=require(_0x4565('0x11'))(_0x4565('0x12'));var utils=require('../../config/utils');var config=require(_0x4565('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4565('0x14'));var client=jayson[_0x4565('0x15')][_0x4565('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x49c273,_0x483d5a,_0x36ee0c,_0x57b6d5){return new BPromise(function(_0x380143,_0x14b612){var _0x5ede22=_0x57b6d5||client;return _0x5ede22['request'](_0x49c273,_0x36ee0c)[_0x4565('0x17')](function(_0x1008be){logger[_0x4565('0x18')](_0x4565('0x19'),_0x483d5a,'request\x20sent');logger['debug'](_0x4565('0x1a'),_0x483d5a,_0x4565('0x1b'),JSON[_0x4565('0x1c')](_0x1008be));if(_0x1008be[_0x4565('0x1d')]){if(_0x1008be[_0x4565('0x1d')][_0x4565('0x1e')]===0x1f4){logger[_0x4565('0x1d')](_0x4565('0x19'),_0x483d5a,_0x1008be['error'][_0x4565('0x1f')]);return _0x14b612(_0x1008be['error'][_0x4565('0x1f')]);}logger['error'](_0x4565('0x19'),_0x483d5a,_0x1008be[_0x4565('0x1d')][_0x4565('0x1f')]);return _0x380143(_0x1008be['error'][_0x4565('0x1f')]);}else{logger[_0x4565('0x18')](_0x4565('0x19'),_0x483d5a,_0x4565('0x1b'));_0x380143(_0x1008be[_0x4565('0x20')][_0x4565('0x1f')]);}})[_0x4565('0x21')](function(_0x347634){logger[_0x4565('0x1d')](_0x4565('0x19'),_0x483d5a,_0x347634);_0x14b612(_0x347634);});});}function respondWithStatusCode(_0x2ccdee,_0x21d836){_0x21d836=_0x21d836||0xcc;return function(_0x48bdc3){if(_0x48bdc3){return _0x2ccdee['sendStatus'](_0x21d836);}return _0x2ccdee['status'](_0x21d836)[_0x4565('0x22')]();};}function respondWithResult(_0x47e05e,_0x1d9aff){_0x1d9aff=_0x1d9aff||0xc8;return function(_0x2a2164){if(_0x2a2164){return _0x47e05e[_0x4565('0x23')](_0x1d9aff)[_0x4565('0x24')](_0x2a2164);}};}function respondWithFilteredResult(_0x56d177,_0x42ba9b){return function(_0x5993f0){if(_0x5993f0){var _0x1cbdfa=_0x5993f0[_0x4565('0x25')],_0x4dc5c3=_0x42ba9b['offset'],_0x346c0b=_0x42ba9b['offset']+_0x42ba9b[_0x4565('0x26')],_0x46b49d;if(_0x346c0b>=_0x1cbdfa){_0x346c0b=_0x1cbdfa;_0x46b49d=0xc8;}else{_0x46b49d=0xce;}_0x56d177['status'](_0x46b49d);return _0x56d177[_0x4565('0x27')](_0x4565('0x28'),_0x4dc5c3+'-'+_0x346c0b+'/'+_0x1cbdfa)[_0x4565('0x24')](_0x5993f0);}return null;};}function patchUpdates(_0x40db39){return function(_0x49ac79){try{jsonpatch[_0x4565('0x29')](_0x49ac79,_0x40db39,!![]);}catch(_0x5c9d7e){return BPromise['reject'](_0x5c9d7e);}return _0x49ac79[_0x4565('0x2a')]();};}function saveUpdates(_0x353c3f,_0x27d831){return function(_0x56c518){if(_0x56c518){return _0x56c518[_0x4565('0x2b')](_0x353c3f)[_0x4565('0x17')](function(_0x7ff342){return _0x7ff342;});}return null;};}function removeEntity(_0x36ca53,_0x3b6a2c){return function(_0x3ddb1a){if(_0x3ddb1a){return _0x3ddb1a['destroy']()[_0x4565('0x17')](function(){_0x36ca53[_0x4565('0x23')](0xcc)[_0x4565('0x22')]();});}};}function handleEntityNotFound(_0x3fc282,_0x451aa8){return function(_0x3c2f12){if(!_0x3c2f12){_0x3fc282[_0x4565('0x2c')](0x194);}return _0x3c2f12;};}function handleError(_0xe1420a,_0x1e689f){_0x1e689f=_0x1e689f||0x1f4;return function(_0x4e7021){logger['error'](_0x4e7021[_0x4565('0x2d')]);if(_0x4e7021[_0x4565('0x2e')]){delete _0x4e7021[_0x4565('0x2e')];}_0xe1420a[_0x4565('0x23')](_0x1e689f)[_0x4565('0x2f')](_0x4e7021);};}exports[_0x4565('0x30')]=function(_0x2ae231,_0x58f483){var _0x12cb1d={},_0x570c67={},_0x4c3830={'count':0x0,'rows':[]};var _0x903afd=db[_0x4565('0x31')][_0x4565('0x32')];_0x570c67[_0x4565('0x33')]=_['keys'](_0x903afd);var _0x22c26c={'dateStart':_0x2ae231[_0x4565('0x34')][_0x4565('0x35')],'dateEnd':_0x2ae231[_0x4565('0x34')][_0x4565('0x36')]};delete _0x2ae231['query']['dateStart'];delete _0x2ae231[_0x4565('0x34')][_0x4565('0x36')];_0x570c67[_0x4565('0x34')]=_['keys'](_0x2ae231[_0x4565('0x34')]);_0x570c67[_0x4565('0x37')]=_[_0x4565('0x38')](_0x570c67[_0x4565('0x33')],_0x570c67[_0x4565('0x34')]);_0x12cb1d[_0x4565('0x39')]=_['intersection'](_0x570c67['model'],qs[_0x4565('0x3a')](_0x2ae231[_0x4565('0x34')][_0x4565('0x3a')]));_0x12cb1d[_0x4565('0x39')]=_0x12cb1d[_0x4565('0x39')][_0x4565('0x3b')]?_0x12cb1d[_0x4565('0x39')]:_0x570c67['model'];if(!_0x2ae231[_0x4565('0x34')][_0x4565('0x3c')]('nolimit')){_0x12cb1d[_0x4565('0x26')]=qs[_0x4565('0x26')](_0x2ae231['query']['limit']);_0x12cb1d[_0x4565('0x3d')]=qs[_0x4565('0x3d')](_0x2ae231[_0x4565('0x34')][_0x4565('0x3d')]);}_0x12cb1d[_0x4565('0x3e')]=qs[_0x4565('0x3f')](_0x2ae231['query'][_0x4565('0x3f')]);_0x12cb1d['where']=qs[_0x4565('0x37')](_['pick'](_0x2ae231[_0x4565('0x34')],_0x570c67[_0x4565('0x37')]));if(_0x22c26c[_0x4565('0x35')]){if(_0x22c26c['dateEnd']){_0x22c26c[_0x4565('0x36')]=moment(_0x22c26c[_0x4565('0x36')])['add'](0x1,_0x4565('0x40'));}else{_0x22c26c[_0x4565('0x36')]=moment(_0x22c26c['dateStart'])[_0x4565('0x41')](0x1,_0x4565('0x40'));}_[_0x4565('0x42')](_0x12cb1d[_0x4565('0x43')],{'createdAt':{'$gte':_0x22c26c[_0x4565('0x35')],'$lte':_0x22c26c[_0x4565('0x36')]}});}if(_0x2ae231[_0x4565('0x34')][_0x4565('0x44')]){_0x12cb1d['where']=_[_0x4565('0x42')](_0x12cb1d[_0x4565('0x43')],{'$or':_['map'](_0x12cb1d['attributes'],function(_0x5c3af3){var _0x599d0c={};_0x599d0c[_0x5c3af3]={'$like':'%'+_0x2ae231[_0x4565('0x34')][_0x4565('0x44')]+'%'};return _0x599d0c;})});}_0x12cb1d=_[_0x4565('0x42')]({},_0x12cb1d,_0x2ae231[_0x4565('0x45')]);var _0x358071={'where':_0x12cb1d[_0x4565('0x43')]};return db[_0x4565('0x31')][_0x4565('0x25')](_0x358071)[_0x4565('0x17')](function(_0x563d76){_0x4c3830[_0x4565('0x25')]=_0x563d76;if(_0x2ae231['query']['includeAll']){_0x12cb1d[_0x4565('0x46')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x4565('0x47')](_0x12cb1d);})[_0x4565('0x17')](function(_0x978d1c){_0x4c3830['rows']=_0x978d1c;return _0x4c3830;})[_0x4565('0x17')](respondWithFilteredResult(_0x58f483,_0x12cb1d))['catch'](handleError(_0x58f483,null));};exports[_0x4565('0x48')]=function(_0x57d537,_0x525b4d){var _0x5beb71={'raw':![],'where':{'id':_0x57d537['params']['id']}},_0x1d4ef1={};_0x1d4ef1['model']=_[_0x4565('0x49')](db[_0x4565('0x31')][_0x4565('0x32')]);_0x1d4ef1[_0x4565('0x34')]=_['keys'](_0x57d537[_0x4565('0x34')]);_0x1d4ef1[_0x4565('0x37')]=_['intersection'](_0x1d4ef1[_0x4565('0x33')],_0x1d4ef1[_0x4565('0x34')]);_0x5beb71['attributes']=_[_0x4565('0x38')](_0x1d4ef1[_0x4565('0x33')],qs[_0x4565('0x3a')](_0x57d537[_0x4565('0x34')][_0x4565('0x3a')]));_0x5beb71['attributes']=_0x5beb71['attributes'][_0x4565('0x3b')]?_0x5beb71[_0x4565('0x39')]:_0x1d4ef1[_0x4565('0x33')];if(_0x57d537['query']['includeAll']){_0x5beb71[_0x4565('0x46')]=[{'all':!![]}];}_0x5beb71=_[_0x4565('0x42')]({},_0x5beb71,_0x57d537[_0x4565('0x45')]);return db['ZohoConfiguration'][_0x4565('0x4a')](_0x5beb71)[_0x4565('0x17')](handleEntityNotFound(_0x525b4d,null))['then'](respondWithResult(_0x525b4d,null))[_0x4565('0x21')](handleError(_0x525b4d,null));};exports['create']=function(_0x3f2fbe,_0x573557){return db[_0x4565('0x31')][_0x4565('0x4b')](_0x3f2fbe[_0x4565('0x4c')],{})['then'](respondWithResult(_0x573557,0xc9))[_0x4565('0x21')](handleError(_0x573557,null));};exports[_0x4565('0x2b')]=function(_0x448d1f,_0x1f2daf){if(_0x448d1f['body']['id']){delete _0x448d1f[_0x4565('0x4c')]['id'];}return db[_0x4565('0x31')][_0x4565('0x4a')]({'where':{'id':_0x448d1f[_0x4565('0x4d')]['id']}})[_0x4565('0x17')](handleEntityNotFound(_0x1f2daf,null))[_0x4565('0x17')](saveUpdates(_0x448d1f[_0x4565('0x4c')],null))[_0x4565('0x17')](respondWithResult(_0x1f2daf,null))['catch'](handleError(_0x1f2daf,null));};exports[_0x4565('0x4e')]=function(_0xb79b18,_0xc345f6){return db['ZohoConfiguration'][_0x4565('0x4a')]({'where':{'id':_0xb79b18[_0x4565('0x4d')]['id']}})[_0x4565('0x17')](handleEntityNotFound(_0xc345f6,null))['then'](removeEntity(_0xc345f6,null))[_0x4565('0x21')](handleError(_0xc345f6,null));};exports['getFields']=function(_0x27fb04,_0x2624bb,_0x2faa1a){var _0x6f4b66={};var _0x5beeb={};var _0x24576e;var _0x10bb79;return db['ZohoConfiguration'][_0x4565('0x4f')]({'where':{'id':_0x27fb04[_0x4565('0x4d')]['id']}})[_0x4565('0x17')](handleEntityNotFound(_0x2624bb,null))[_0x4565('0x17')](function(_0x48066a){if(_0x48066a){_0x24576e=_0x48066a;_0x5beeb['model']=_['keys'](db[_0x4565('0x50')][_0x4565('0x32')]);_0x5beeb['query']=_['keys'](_0x27fb04[_0x4565('0x34')]);_0x5beeb[_0x4565('0x37')]=_[_0x4565('0x38')](_0x5beeb[_0x4565('0x33')],_0x5beeb[_0x4565('0x34')]);_0x6f4b66['attributes']=_[_0x4565('0x38')](_0x5beeb[_0x4565('0x33')],qs[_0x4565('0x3a')](_0x27fb04[_0x4565('0x34')][_0x4565('0x3a')]));_0x6f4b66[_0x4565('0x39')]=_0x6f4b66[_0x4565('0x39')][_0x4565('0x3b')]?_0x6f4b66[_0x4565('0x39')]:_0x5beeb[_0x4565('0x33')];_0x6f4b66[_0x4565('0x3e')]=qs[_0x4565('0x3f')](_0x27fb04[_0x4565('0x34')][_0x4565('0x3f')]);_0x6f4b66[_0x4565('0x43')]=qs['filters'](_['pick'](_0x27fb04[_0x4565('0x34')],_0x5beeb[_0x4565('0x37')]));if(_0x27fb04['query'][_0x4565('0x44')]){_0x6f4b66[_0x4565('0x43')]=_['merge'](_0x6f4b66['where'],{'$or':_[_0x4565('0x51')](_0x6f4b66[_0x4565('0x39')],function(_0x20ffd7){var _0x496c34={};_0x496c34[_0x20ffd7]={'$like':'%'+_0x27fb04['query'][_0x4565('0x44')]+'%'};return _0x496c34;})});}_0x6f4b66=_[_0x4565('0x42')]({},_0x6f4b66,_0x27fb04[_0x4565('0x45')]);return _0x24576e[_0x4565('0x52')](_0x6f4b66);}})['then'](function(_0x3cb2fd){if(_0x3cb2fd){_0x10bb79=_0x3cb2fd[_0x4565('0x3b')];if(!_0x27fb04[_0x4565('0x34')][_0x4565('0x3c')](_0x4565('0x53'))){_0x6f4b66[_0x4565('0x26')]=qs['limit'](_0x27fb04[_0x4565('0x34')][_0x4565('0x26')]);_0x6f4b66[_0x4565('0x3d')]=qs['offset'](_0x27fb04['query'][_0x4565('0x3d')]);}return _0x24576e[_0x4565('0x52')](_0x6f4b66);}})['then'](function(_0x588d6d){if(_0x588d6d){return _0x588d6d?{'count':_0x10bb79,'rows':_0x588d6d}:null;}})[_0x4565('0x17')](respondWithResult(_0x2624bb,null))[_0x4565('0x21')](handleError(_0x2624bb,null));};exports['getSubjects']=function(_0x314a33,_0x3d3017,_0x58410e){var _0x11b6fc={};var _0x255b7d={};var _0x31f59e;var _0x280fa2;return db[_0x4565('0x31')][_0x4565('0x4f')]({'where':{'id':_0x314a33['params']['id']}})[_0x4565('0x17')](handleEntityNotFound(_0x3d3017,null))[_0x4565('0x17')](function(_0x65c748){if(_0x65c748){_0x31f59e=_0x65c748;_0x255b7d[_0x4565('0x33')]=_[_0x4565('0x49')](db[_0x4565('0x50')][_0x4565('0x32')]);_0x255b7d['query']=_[_0x4565('0x49')](_0x314a33['query']);_0x255b7d[_0x4565('0x37')]=_[_0x4565('0x38')](_0x255b7d[_0x4565('0x33')],_0x255b7d[_0x4565('0x34')]);_0x11b6fc[_0x4565('0x39')]=_['intersection'](_0x255b7d[_0x4565('0x33')],qs[_0x4565('0x3a')](_0x314a33[_0x4565('0x34')][_0x4565('0x3a')]));_0x11b6fc[_0x4565('0x39')]=_0x11b6fc[_0x4565('0x39')][_0x4565('0x3b')]?_0x11b6fc[_0x4565('0x39')]:_0x255b7d['model'];_0x11b6fc['order']=qs['sort'](_0x314a33[_0x4565('0x34')][_0x4565('0x3f')]);_0x11b6fc['where']=qs[_0x4565('0x37')](_[_0x4565('0x54')](_0x314a33[_0x4565('0x34')],_0x255b7d[_0x4565('0x37')]));if(_0x314a33['query'][_0x4565('0x44')]){_0x11b6fc[_0x4565('0x43')]=_[_0x4565('0x42')](_0x11b6fc['where'],{'$or':_[_0x4565('0x51')](_0x11b6fc[_0x4565('0x39')],function(_0x1a6a5e){var _0x1d1ca8={};_0x1d1ca8[_0x1a6a5e]={'$like':'%'+_0x314a33[_0x4565('0x34')][_0x4565('0x44')]+'%'};return _0x1d1ca8;})});}_0x11b6fc=_['merge']({},_0x11b6fc,_0x314a33['options']);return _0x31f59e[_0x4565('0x55')](_0x11b6fc);}})[_0x4565('0x17')](function(_0x451e12){if(_0x451e12){_0x280fa2=_0x451e12[_0x4565('0x3b')];if(!_0x314a33['query']['hasOwnProperty'](_0x4565('0x53'))){_0x11b6fc[_0x4565('0x26')]=qs[_0x4565('0x26')](_0x314a33['query'][_0x4565('0x26')]);_0x11b6fc[_0x4565('0x3d')]=qs['offset'](_0x314a33[_0x4565('0x34')][_0x4565('0x3d')]);}return _0x31f59e[_0x4565('0x55')](_0x11b6fc);}})['then'](function(_0x489294){if(_0x489294){return _0x489294?{'count':_0x280fa2,'rows':_0x489294}:null;}})['then'](respondWithResult(_0x3d3017,null))[_0x4565('0x21')](handleError(_0x3d3017,null));};exports[_0x4565('0x56')]=function(_0x4b646f,_0x12ab92,_0x22c5ee){var _0x458242={};var _0x3cfbf6={};var _0xeaa4b3;var _0x3f4e36;return db[_0x4565('0x31')][_0x4565('0x4f')]({'where':{'id':_0x4b646f[_0x4565('0x4d')]['id']}})[_0x4565('0x17')](handleEntityNotFound(_0x12ab92,null))[_0x4565('0x17')](function(_0x395c28){if(_0x395c28){_0xeaa4b3=_0x395c28;_0x3cfbf6['model']=_[_0x4565('0x49')](db[_0x4565('0x50')][_0x4565('0x32')]);_0x3cfbf6[_0x4565('0x34')]=_[_0x4565('0x49')](_0x4b646f[_0x4565('0x34')]);_0x3cfbf6[_0x4565('0x37')]=_['intersection'](_0x3cfbf6[_0x4565('0x33')],_0x3cfbf6['query']);_0x458242['attributes']=_[_0x4565('0x38')](_0x3cfbf6[_0x4565('0x33')],qs['fields'](_0x4b646f[_0x4565('0x34')][_0x4565('0x3a')]));_0x458242[_0x4565('0x39')]=_0x458242[_0x4565('0x39')][_0x4565('0x3b')]?_0x458242['attributes']:_0x3cfbf6[_0x4565('0x33')];_0x458242['order']=qs['sort'](_0x4b646f[_0x4565('0x34')][_0x4565('0x3f')]);_0x458242[_0x4565('0x43')]=qs[_0x4565('0x37')](_[_0x4565('0x54')](_0x4b646f[_0x4565('0x34')],_0x3cfbf6[_0x4565('0x37')]));if(_0x4b646f['query'][_0x4565('0x44')]){_0x458242[_0x4565('0x43')]=_['merge'](_0x458242[_0x4565('0x43')],{'$or':_[_0x4565('0x51')](_0x458242[_0x4565('0x39')],function(_0xd6d764){var _0x3a5ac8={};_0x3a5ac8[_0xd6d764]={'$like':'%'+_0x4b646f['query'][_0x4565('0x44')]+'%'};return _0x3a5ac8;})});}_0x458242=_['merge']({},_0x458242,_0x4b646f[_0x4565('0x45')]);return _0xeaa4b3[_0x4565('0x56')](_0x458242);}})[_0x4565('0x17')](function(_0x4e677f){if(_0x4e677f){_0x3f4e36=_0x4e677f[_0x4565('0x3b')];if(!_0x4b646f['query'][_0x4565('0x3c')](_0x4565('0x53'))){_0x458242[_0x4565('0x26')]=qs[_0x4565('0x26')](_0x4b646f['query'][_0x4565('0x26')]);_0x458242[_0x4565('0x3d')]=qs[_0x4565('0x3d')](_0x4b646f[_0x4565('0x34')][_0x4565('0x3d')]);}return _0xeaa4b3[_0x4565('0x56')](_0x458242);}})[_0x4565('0x17')](function(_0x18e316){if(_0x18e316){return _0x18e316?{'count':_0x3f4e36,'rows':_0x18e316}:null;}})['then'](respondWithResult(_0x12ab92,null))[_0x4565('0x21')](handleError(_0x12ab92,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c88fb56..5a8d69d 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 _0x495e=['api','moment','bluebird','request-promise','exports','define','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0x36058e,_0xf19ada){var _0x46a42b=function(_0x5534bb){while(--_0x5534bb){_0x36058e['push'](_0x36058e['shift']());}};_0x46a42b(++_0xf19ada);}(_0x495e,0xfb));var _0xe495=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0x495e[_0x71b765];return _0x34cb24;};'use strict';var _=require(_0xe495('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe495('0x1'));var moment=require(_0xe495('0x2'));var BPromise=require(_0xe495('0x3'));var rp=require(_0xe495('0x4'));var attributes=require('./intZohoConfiguration.attributes');module[_0xe495('0x5')]=function(_0x442101,_0x254b8c){return _0x442101[_0xe495('0x6')](_0xe495('0x7'),attributes,{'tableName':_0xe495('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecd9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x4efdd6,_0x12d954){var _0x2d717b=function(_0x16c266){while(--_0x16c266){_0x4efdd6['push'](_0x4efdd6['shift']());}};_0x2d717b(++_0x12d954);}(_0xecd9,0x13f));var _0x9ecd=function(_0xefeb90,_0x413599){_0xefeb90=_0xefeb90-0x0;var _0x1a6912=_0xecd9[_0xefeb90];return _0x1a6912;};'use strict';var _=require(_0x9ecd('0x0'));var util=require(_0x9ecd('0x1'));var logger=require(_0x9ecd('0x2'))(_0x9ecd('0x3'));var moment=require(_0x9ecd('0x4'));var BPromise=require(_0x9ecd('0x5'));var rp=require(_0x9ecd('0x6'));var attributes=require(_0x9ecd('0x7'));module['exports']=function(_0x5e6bf1,_0xfc95e6){return _0x5e6bf1[_0x9ecd('0x8')](_0x9ecd('0x9'),attributes,{'tableName':_0x9ecd('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 387c771..7826ba9 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 _0xb584=['jayson/promise','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x4f955b,_0x525f53){var _0x46240a=function(_0x1f5126){while(--_0x1f5126){_0x4f955b['push'](_0x4f955b['shift']());}};_0x46240a(++_0x525f53);}(_0xb584,0x91));var _0x4b58=function(_0x3abf08,_0x23e505){_0x3abf08=_0x3abf08-0x0;var _0x1dbb00=_0xb584[_0x3abf08];return _0x1dbb00;};'use strict';var _=require('lodash');var util=require(_0x4b58('0x0'));var moment=require(_0x4b58('0x1'));var BPromise=require(_0x4b58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b58('0x3'));var db=require(_0x4b58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b58('0x5'))('rpc');var config=require(_0x4b58('0x6'));var jayson=require(_0x4b58('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x644285,_0x1fca1e,_0x4bf774){return new BPromise(function(_0x2d13a9,_0x123422){return client[_0x4b58('0x8')](_0x644285,_0x4bf774)['then'](function(_0x435f6){logger[_0x4b58('0x9')](_0x4b58('0xa'),_0x1fca1e,_0x4b58('0xb'));logger[_0x4b58('0xc')](_0x4b58('0xd'),_0x1fca1e,_0x4b58('0xb'),JSON[_0x4b58('0xe')](_0x435f6));if(_0x435f6['error']){if(_0x435f6[_0x4b58('0xf')][_0x4b58('0x10')]===0x1f4){logger[_0x4b58('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x1fca1e,_0x435f6[_0x4b58('0xf')][_0x4b58('0x11')]);return _0x123422(_0x435f6[_0x4b58('0xf')][_0x4b58('0x11')]);}logger[_0x4b58('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x1fca1e,_0x435f6[_0x4b58('0xf')]['message']);return _0x2d13a9(_0x435f6['error'][_0x4b58('0x11')]);}else{logger[_0x4b58('0x9')](_0x4b58('0xa'),_0x1fca1e,'request\x20sent');_0x2d13a9(_0x435f6['result'][_0x4b58('0x11')]);}})[_0x4b58('0x12')](function(_0x1531bf){logger[_0x4b58('0xf')](_0x4b58('0xa'),_0x1fca1e,_0x1531bf);_0x123422(_0x1531bf);});});} \ No newline at end of file +var _0xbee1=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b84a8,_0xd456ed){var _0x2c020d=function(_0x46b9e3){while(--_0x46b9e3){_0x3b84a8['push'](_0x3b84a8['shift']());}};_0x2c020d(++_0xd456ed);}(_0xbee1,0x16a));var _0x1bee=function(_0x341f9c,_0x337de4){_0x341f9c=_0x341f9c-0x0;var _0x549803=_0xbee1[_0x341f9c];return _0x549803;};'use strict';var _=require('lodash');var util=require(_0x1bee('0x0'));var moment=require(_0x1bee('0x1'));var BPromise=require(_0x1bee('0x2'));var rs=require(_0x1bee('0x3'));var fs=require('fs');var Redis=require(_0x1bee('0x4'));var db=require(_0x1bee('0x5'))['db'];var utils=require(_0x1bee('0x6'));var logger=require(_0x1bee('0x7'))(_0x1bee('0x8'));var config=require(_0x1bee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1bee('0xa')][_0x1bee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd2f5cd,_0x2c2ee4,_0x421770){return new BPromise(function(_0x35fe16,_0xeccf6c){return client[_0x1bee('0xc')](_0xd2f5cd,_0x421770)['then'](function(_0x56d217){logger[_0x1bee('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x2c2ee4,_0x1bee('0xe'));logger[_0x1bee('0xf')](_0x1bee('0x10'),_0x2c2ee4,'request\x20sent',JSON[_0x1bee('0x11')](_0x56d217));if(_0x56d217[_0x1bee('0x12')]){if(_0x56d217['error'][_0x1bee('0x13')]===0x1f4){logger[_0x1bee('0x12')](_0x1bee('0x14'),_0x2c2ee4,_0x56d217[_0x1bee('0x12')][_0x1bee('0x15')]);return _0xeccf6c(_0x56d217[_0x1bee('0x12')][_0x1bee('0x15')]);}logger[_0x1bee('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x2c2ee4,_0x56d217[_0x1bee('0x12')][_0x1bee('0x15')]);return _0x35fe16(_0x56d217['error'][_0x1bee('0x15')]);}else{logger['info'](_0x1bee('0x14'),_0x2c2ee4,_0x1bee('0xe'));_0x35fe16(_0x56d217['result'][_0x1bee('0x15')]);}})[_0x1bee('0x16')](function(_0x2b3bc1){logger['error'](_0x1bee('0x14'),_0x2c2ee4,_0x2b3bc1);_0xeccf6c(_0x2b3bc1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 909e70b..5287090 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 _0xfbf7=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x400f11,_0x5e438d){var _0x3f53da=function(_0x499b82){while(--_0x499b82){_0x400f11['push'](_0x400f11['shift']());}};_0x3f53da(++_0x5e438d);}(_0xfbf7,0x6e));var _0x7fbf=function(_0x2f4154,_0x35c7c8){_0x2f4154=_0x2f4154-0x0;var _0x30d41b=_0xfbf7[_0x2f4154];return _0x30d41b;};'use strict';var multer=require(_0x7fbf('0x0'));var util=require(_0x7fbf('0x1'));var path=require(_0x7fbf('0x2'));var timeout=require(_0x7fbf('0x3'));var express=require(_0x7fbf('0x4'));var router=express[_0x7fbf('0x5')]();var auth=require(_0x7fbf('0x6'));var interaction=require(_0x7fbf('0x7'));var config=require(_0x7fbf('0x8'));var controller=require('./intZohoField.controller');router[_0x7fbf('0x9')]('/',auth[_0x7fbf('0xa')](),controller[_0x7fbf('0xb')]);router['get'](_0x7fbf('0xc'),auth['isAuthenticated'](),controller[_0x7fbf('0xd')]);router['post']('/',auth[_0x7fbf('0xa')](),controller[_0x7fbf('0xe')]);router[_0x7fbf('0xf')](_0x7fbf('0xc'),auth[_0x7fbf('0xa')](),controller['update']);router[_0x7fbf('0x10')](_0x7fbf('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7fbf('0x11')]=router; \ No newline at end of file +var _0x7345=['show','create','put','/:id','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0x3f01d0,_0x11b322){var _0x1ca2d7=function(_0x24e88b){while(--_0x24e88b){_0x3f01d0['push'](_0x3f01d0['shift']());}};_0x1ca2d7(++_0x11b322);}(_0x7345,0x104));var _0x5734=function(_0x3f308a,_0x49de83){_0x3f308a=_0x3f308a-0x0;var _0x439a3c=_0x7345[_0x3f308a];return _0x439a3c;};'use strict';var multer=require(_0x5734('0x0'));var util=require(_0x5734('0x1'));var path=require('path');var timeout=require(_0x5734('0x2'));var express=require('express');var router=express[_0x5734('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5734('0x4'));var config=require(_0x5734('0x5'));var controller=require(_0x5734('0x6'));router[_0x5734('0x7')]('/',auth[_0x5734('0x8')](),controller[_0x5734('0x9')]);router[_0x5734('0x7')]('/:id',auth[_0x5734('0x8')](),controller[_0x5734('0xa')]);router['post']('/',auth[_0x5734('0x8')](),controller[_0x5734('0xb')]);router[_0x5734('0xc')](_0x5734('0xd'),auth[_0x5734('0x8')](),controller['update']);router['delete']('/:id',auth[_0x5734('0x8')](),controller[_0x5734('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 4c02baa..96e3a47 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 _0x13f6=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports'];(function(_0x4cb181,_0x42ce65){var _0x2a2be3=function(_0x4d80c7){while(--_0x4d80c7){_0x4cb181['push'](_0x4cb181['shift']());}};_0x2a2be3(++_0x42ce65);}(_0x13f6,0x124));var _0x613f=function(_0x1fdd7e,_0x164d5d){_0x1fdd7e=_0x1fdd7e-0x0;var _0x55cb10=_0x13f6[_0x1fdd7e];return _0x55cb10;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x613f('0x2'),_0x613f('0x3'),_0x613f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x613f('0x5')]},'key':{'type':Sequelize[_0x613f('0x5')]},'keyType':{'type':Sequelize[_0x613f('0x6')]('string',_0x613f('0x2'),_0x613f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x613f('0x5')]}}; \ No newline at end of file +var _0x6c76=['customVariable','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6c76,0x184));var _0x66c7=function(_0x4b5aa0,_0x325a12){_0x4b5aa0=_0x4b5aa0-0x0;var _0x15f896=_0x6c76[_0x4b5aa0];return _0x15f896;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'type':{'type':Sequelize[_0x66c7('0x2')]('string',_0x66c7('0x3'),_0x66c7('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x66c7('0x5')]},'key':{'type':Sequelize[_0x66c7('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x66c7('0x6'),_0x66c7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x66c7('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x66c7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x66c7('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a61791e..4bcb397 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 _0x063a=['params','intersection','options','create','body','html-pdf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../config/logger','api','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','save','then','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','map','merge','ZohoField','includeAll','include','rows','catch','show'];(function(_0x4c10ba,_0x21f2b9){var _0x52dfa1=function(_0x1a80df){while(--_0x1a80df){_0x4c10ba['push'](_0x4c10ba['shift']());}};_0x52dfa1(++_0x21f2b9);}(_0x063a,0xc8));var _0xa063=function(_0x39e894,_0x2f9ebf){_0x39e894=_0x39e894-0x0;var _0x375dcd=_0x063a[_0x39e894];return _0x375dcd;};'use strict';var pdf=require(_0xa063('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa063('0x1'));var rp=require(_0xa063('0x2'));var moment=require(_0xa063('0x3'));var BPromise=require(_0xa063('0x4'));var Mustache=require('mustache');var util=require(_0xa063('0x5'));var path=require(_0xa063('0x6'));var sox=require('sox');var csv=require(_0xa063('0x7'));var ejs=require(_0xa063('0x8'));var fs=require('fs');var _=require(_0xa063('0x9'));var squel=require(_0xa063('0xa'));var crypto=require(_0xa063('0xb'));var jsforce=require(_0xa063('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa063('0x7'));var querystring=require('querystring');var Papa=require(_0xa063('0xd'));var Redis=require(_0xa063('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xa063('0xf'))(_0xa063('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa063('0x11'))['db'];function respondWithStatusCode(_0x383e89,_0x497ce1){_0x497ce1=_0x497ce1||0xcc;return function(_0x2f61d9){if(_0x2f61d9){return _0x383e89[_0xa063('0x12')](_0x497ce1);}return _0x383e89['status'](_0x497ce1)[_0xa063('0x13')]();};}function respondWithResult(_0x2befee,_0x131de7){_0x131de7=_0x131de7||0xc8;return function(_0x1d2483){if(_0x1d2483){return _0x2befee[_0xa063('0x14')](_0x131de7)['json'](_0x1d2483);}};}function respondWithFilteredResult(_0x2f2ee1,_0x2ede45){return function(_0x3e172f){if(_0x3e172f){var _0xca411=_0x3e172f[_0xa063('0x15')],_0x2c2855=_0x2ede45[_0xa063('0x16')],_0x4dcf2a=_0x2ede45[_0xa063('0x16')]+_0x2ede45[_0xa063('0x17')],_0x3ae7a7;if(_0x4dcf2a>=_0xca411){_0x4dcf2a=_0xca411;_0x3ae7a7=0xc8;}else{_0x3ae7a7=0xce;}_0x2f2ee1['status'](_0x3ae7a7);return _0x2f2ee1['set'](_0xa063('0x18'),_0x2c2855+'-'+_0x4dcf2a+'/'+_0xca411)[_0xa063('0x19')](_0x3e172f);}return null;};}function patchUpdates(_0x40bc5d){return function(_0xccc232){try{jsonpatch[_0xa063('0x1a')](_0xccc232,_0x40bc5d,!![]);}catch(_0x5d7f08){return BPromise['reject'](_0x5d7f08);}return _0xccc232[_0xa063('0x1b')]();};}function saveUpdates(_0x27ff0d,_0x3afd86){return function(_0x44cfca){if(_0x44cfca){return _0x44cfca['update'](_0x27ff0d)[_0xa063('0x1c')](function(_0x597ad3){return _0x597ad3;});}return null;};}function removeEntity(_0x4e7a56,_0xf6523){return function(_0x77daed){if(_0x77daed){return _0x77daed['destroy']()[_0xa063('0x1c')](function(){_0x4e7a56[_0xa063('0x14')](0xcc)[_0xa063('0x13')]();});}};}function handleEntityNotFound(_0x23ac53,_0x309d06){return function(_0x480f96){if(!_0x480f96){_0x23ac53['sendStatus'](0x194);}return _0x480f96;};}function handleError(_0x311462,_0x432fb5){_0x432fb5=_0x432fb5||0x1f4;return function(_0x5b557e){logger['error'](_0x5b557e[_0xa063('0x1d')]);if(_0x5b557e['name']){delete _0x5b557e[_0xa063('0x1e')];}_0x311462['status'](_0x432fb5)[_0xa063('0x1f')](_0x5b557e);};}exports[_0xa063('0x20')]=function(_0x344261,_0xdbaed0){var _0x496d82={},_0x4fb10d={},_0x489bda={'count':0x0,'rows':[]};var _0x155932=db['ZohoField'][_0xa063('0x21')];_0x4fb10d[_0xa063('0x22')]=_[_0xa063('0x23')](_0x155932);var _0x43e684={'dateStart':_0x344261[_0xa063('0x24')][_0xa063('0x25')],'dateEnd':_0x344261['query'][_0xa063('0x26')]};delete _0x344261[_0xa063('0x24')]['dateStart'];delete _0x344261[_0xa063('0x24')]['dateEnd'];_0x4fb10d[_0xa063('0x24')]=_[_0xa063('0x23')](_0x344261[_0xa063('0x24')]);_0x4fb10d[_0xa063('0x27')]=_['intersection'](_0x4fb10d[_0xa063('0x22')],_0x4fb10d[_0xa063('0x24')]);_0x496d82['attributes']=_['intersection'](_0x4fb10d[_0xa063('0x22')],qs[_0xa063('0x28')](_0x344261[_0xa063('0x24')]['fields']));_0x496d82[_0xa063('0x29')]=_0x496d82['attributes'][_0xa063('0x2a')]?_0x496d82[_0xa063('0x29')]:_0x4fb10d[_0xa063('0x22')];if(!_0x344261[_0xa063('0x24')][_0xa063('0x2b')](_0xa063('0x2c'))){_0x496d82['limit']=qs['limit'](_0x344261[_0xa063('0x24')]['limit']);_0x496d82[_0xa063('0x16')]=qs[_0xa063('0x16')](_0x344261['query'][_0xa063('0x16')]);}_0x496d82[_0xa063('0x2d')]=qs[_0xa063('0x2e')](_0x344261[_0xa063('0x24')][_0xa063('0x2e')]);_0x496d82[_0xa063('0x2f')]=qs[_0xa063('0x27')](_[_0xa063('0x30')](_0x344261[_0xa063('0x24')],_0x4fb10d[_0xa063('0x27')]));if(_0x43e684[_0xa063('0x25')]){if(_0x43e684['dateEnd']){_0x43e684[_0xa063('0x26')]=moment(_0x43e684[_0xa063('0x26')])[_0xa063('0x31')](0x1,_0xa063('0x32'));}else{_0x43e684[_0xa063('0x26')]=moment(_0x43e684[_0xa063('0x25')])[_0xa063('0x31')](0x1,_0xa063('0x32'));}_['merge'](_0x496d82[_0xa063('0x2f')],{'createdAt':{'$gte':_0x43e684['dateStart'],'$lte':_0x43e684['dateEnd']}});}if(_0x344261[_0xa063('0x24')][_0xa063('0x33')]){_0x496d82[_0xa063('0x2f')]=_['merge'](_0x496d82[_0xa063('0x2f')],{'$or':_[_0xa063('0x34')](_0x496d82[_0xa063('0x29')],function(_0xcb1bb){var _0x40757f={};_0x40757f[_0xcb1bb]={'$like':'%'+_0x344261[_0xa063('0x24')][_0xa063('0x33')]+'%'};return _0x40757f;})});}_0x496d82=_[_0xa063('0x35')]({},_0x496d82,_0x344261['options']);var _0x4357c9={'where':_0x496d82[_0xa063('0x2f')]};return db[_0xa063('0x36')][_0xa063('0x15')](_0x4357c9)[_0xa063('0x1c')](function(_0x10ca2d){_0x489bda['count']=_0x10ca2d;if(_0x344261[_0xa063('0x24')][_0xa063('0x37')]){_0x496d82[_0xa063('0x38')]=[{'all':!![]}];}return db[_0xa063('0x36')]['findAll'](_0x496d82);})[_0xa063('0x1c')](function(_0x1df1d9){_0x489bda[_0xa063('0x39')]=_0x1df1d9;return _0x489bda;})['then'](respondWithFilteredResult(_0xdbaed0,_0x496d82))[_0xa063('0x3a')](handleError(_0xdbaed0,null));};exports[_0xa063('0x3b')]=function(_0x36b29f,_0x39cea4){var _0x17a617={'raw':!![],'where':{'id':_0x36b29f[_0xa063('0x3c')]['id']}},_0x95a205={};_0x95a205[_0xa063('0x22')]=_[_0xa063('0x23')](db[_0xa063('0x36')][_0xa063('0x21')]);_0x95a205['query']=_[_0xa063('0x23')](_0x36b29f[_0xa063('0x24')]);_0x95a205[_0xa063('0x27')]=_[_0xa063('0x3d')](_0x95a205[_0xa063('0x22')],_0x95a205[_0xa063('0x24')]);_0x17a617[_0xa063('0x29')]=_[_0xa063('0x3d')](_0x95a205['model'],qs[_0xa063('0x28')](_0x36b29f[_0xa063('0x24')][_0xa063('0x28')]));_0x17a617[_0xa063('0x29')]=_0x17a617[_0xa063('0x29')][_0xa063('0x2a')]?_0x17a617['attributes']:_0x95a205['model'];if(_0x36b29f['query'][_0xa063('0x37')]){_0x17a617['include']=[{'all':!![]}];}_0x17a617=_[_0xa063('0x35')]({},_0x17a617,_0x36b29f[_0xa063('0x3e')]);return db['ZohoField']['find'](_0x17a617)[_0xa063('0x1c')](handleEntityNotFound(_0x39cea4,null))['then'](respondWithResult(_0x39cea4,null))[_0xa063('0x3a')](handleError(_0x39cea4,null));};exports[_0xa063('0x3f')]=function(_0x351dc0,_0x46db78){return db[_0xa063('0x36')][_0xa063('0x3f')](_0x351dc0[_0xa063('0x40')],{})[_0xa063('0x1c')](respondWithResult(_0x46db78,0xc9))[_0xa063('0x3a')](handleError(_0x46db78,null));};exports['update']=function(_0x5113e6,_0x424f99){if(_0x5113e6['body']['id']){delete _0x5113e6['body']['id'];}return db[_0xa063('0x36')]['find']({'where':{'id':_0x5113e6[_0xa063('0x3c')]['id']}})[_0xa063('0x1c')](handleEntityNotFound(_0x424f99,null))[_0xa063('0x1c')](saveUpdates(_0x5113e6[_0xa063('0x40')],null))['then'](respondWithResult(_0x424f99,null))['catch'](handleError(_0x424f99,null));};exports['destroy']=function(_0xa51899,_0x30037c){return db[_0xa063('0x36')]['find']({'where':{'id':_0xa51899[_0xa063('0x3c')]['id']}})[_0xa063('0x1c')](handleEntityNotFound(_0x30037c,null))[_0xa063('0x1c')](removeEntity(_0x30037c,null))[_0xa063('0x3a')](handleError(_0x30037c,null));}; \ No newline at end of file +var _0xc88c=['status','count','offset','limit','Content-Range','json','reject','save','update','then','end','error','stack','name','send','index','ZohoField','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','add','day','merge','filter','options','includeAll','include','rows','catch','show','length','create','body','params','find','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x1bc989,_0x3937b0){var _0x4c6d68=function(_0x3ff714){while(--_0x3ff714){_0x1bc989['push'](_0x1bc989['shift']());}};_0x4c6d68(++_0x3937b0);}(_0xc88c,0xb4));var _0xcc88=function(_0x6801b,_0x2ee2c6){_0x6801b=_0x6801b-0x0;var _0x2ebae6=_0xc88c[_0x6801b];return _0x2ebae6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcc88('0x0'));var rimraf=require(_0xcc88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcc88('0x2'));var moment=require(_0xcc88('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc88('0x4'));var util=require(_0xcc88('0x5'));var path=require(_0xcc88('0x6'));var sox=require('sox');var csv=require(_0xcc88('0x7'));var ejs=require(_0xcc88('0x8'));var fs=require('fs');var _=require(_0xcc88('0x9'));var squel=require(_0xcc88('0xa'));var crypto=require('crypto');var jsforce=require(_0xcc88('0xb'));var deskjs=require(_0xcc88('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcc88('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xcc88('0xe'));var logger=require(_0xcc88('0xf'))(_0xcc88('0x10'));var utils=require(_0xcc88('0x11'));var config=require(_0xcc88('0x12'));var db=require(_0xcc88('0x13'))['db'];function respondWithStatusCode(_0x5a257b,_0x7e4348){_0x7e4348=_0x7e4348||0xcc;return function(_0x5ec502){if(_0x5ec502){return _0x5a257b[_0xcc88('0x14')](_0x7e4348);}return _0x5a257b[_0xcc88('0x15')](_0x7e4348)['end']();};}function respondWithResult(_0x25d501,_0x523f3f){_0x523f3f=_0x523f3f||0xc8;return function(_0x32f755){if(_0x32f755){return _0x25d501[_0xcc88('0x15')](_0x523f3f)['json'](_0x32f755);}};}function respondWithFilteredResult(_0x26faa5,_0x502caa){return function(_0x29b820){if(_0x29b820){var _0x6c466a=_0x29b820[_0xcc88('0x16')],_0x498880=_0x502caa[_0xcc88('0x17')],_0x3cc241=_0x502caa[_0xcc88('0x17')]+_0x502caa[_0xcc88('0x18')],_0x35a472;if(_0x3cc241>=_0x6c466a){_0x3cc241=_0x6c466a;_0x35a472=0xc8;}else{_0x35a472=0xce;}_0x26faa5[_0xcc88('0x15')](_0x35a472);return _0x26faa5['set'](_0xcc88('0x19'),_0x498880+'-'+_0x3cc241+'/'+_0x6c466a)[_0xcc88('0x1a')](_0x29b820);}return null;};}function patchUpdates(_0x2f09a7){return function(_0x2ce293){try{jsonpatch['apply'](_0x2ce293,_0x2f09a7,!![]);}catch(_0x49e0ac){return BPromise[_0xcc88('0x1b')](_0x49e0ac);}return _0x2ce293[_0xcc88('0x1c')]();};}function saveUpdates(_0x2ca832,_0x369a0d){return function(_0x22b0c9){if(_0x22b0c9){return _0x22b0c9[_0xcc88('0x1d')](_0x2ca832)[_0xcc88('0x1e')](function(_0x1face7){return _0x1face7;});}return null;};}function removeEntity(_0x53f331,_0x5dc0ae){return function(_0x54e010){if(_0x54e010){return _0x54e010['destroy']()[_0xcc88('0x1e')](function(){_0x53f331[_0xcc88('0x15')](0xcc)[_0xcc88('0x1f')]();});}};}function handleEntityNotFound(_0x265da6,_0xdb8706){return function(_0x237dcf){if(!_0x237dcf){_0x265da6[_0xcc88('0x14')](0x194);}return _0x237dcf;};}function handleError(_0x2dc901,_0x63a020){_0x63a020=_0x63a020||0x1f4;return function(_0x1162f1){logger[_0xcc88('0x20')](_0x1162f1[_0xcc88('0x21')]);if(_0x1162f1[_0xcc88('0x22')]){delete _0x1162f1['name'];}_0x2dc901[_0xcc88('0x15')](_0x63a020)[_0xcc88('0x23')](_0x1162f1);};}exports[_0xcc88('0x24')]=function(_0x17fe10,_0xcfe72d){var _0x278359={},_0x1f6c34={},_0x53a4d3={'count':0x0,'rows':[]};var _0x20919f=db[_0xcc88('0x25')][_0xcc88('0x26')];_0x1f6c34[_0xcc88('0x27')]=_['keys'](_0x20919f);var _0x3b31c0={'dateStart':_0x17fe10[_0xcc88('0x28')][_0xcc88('0x29')],'dateEnd':_0x17fe10[_0xcc88('0x28')][_0xcc88('0x2a')]};delete _0x17fe10['query']['dateStart'];delete _0x17fe10[_0xcc88('0x28')][_0xcc88('0x2a')];_0x1f6c34[_0xcc88('0x28')]=_[_0xcc88('0x2b')](_0x17fe10['query']);_0x1f6c34[_0xcc88('0x2c')]=_[_0xcc88('0x2d')](_0x1f6c34[_0xcc88('0x27')],_0x1f6c34['query']);_0x278359['attributes']=_[_0xcc88('0x2d')](_0x1f6c34[_0xcc88('0x27')],qs[_0xcc88('0x2e')](_0x17fe10['query'][_0xcc88('0x2e')]));_0x278359[_0xcc88('0x2f')]=_0x278359[_0xcc88('0x2f')]['length']?_0x278359[_0xcc88('0x2f')]:_0x1f6c34[_0xcc88('0x27')];if(!_0x17fe10['query'][_0xcc88('0x30')]('nolimit')){_0x278359[_0xcc88('0x18')]=qs[_0xcc88('0x18')](_0x17fe10['query'][_0xcc88('0x18')]);_0x278359[_0xcc88('0x17')]=qs['offset'](_0x17fe10[_0xcc88('0x28')][_0xcc88('0x17')]);}_0x278359[_0xcc88('0x31')]=qs[_0xcc88('0x32')](_0x17fe10['query'][_0xcc88('0x32')]);_0x278359[_0xcc88('0x33')]=qs[_0xcc88('0x2c')](_['pick'](_0x17fe10[_0xcc88('0x28')],_0x1f6c34[_0xcc88('0x2c')]));if(_0x3b31c0[_0xcc88('0x29')]){if(_0x3b31c0[_0xcc88('0x2a')]){_0x3b31c0[_0xcc88('0x2a')]=moment(_0x3b31c0['dateEnd'])[_0xcc88('0x34')](0x1,_0xcc88('0x35'));}else{_0x3b31c0[_0xcc88('0x2a')]=moment(_0x3b31c0[_0xcc88('0x29')])['add'](0x1,'day');}_[_0xcc88('0x36')](_0x278359[_0xcc88('0x33')],{'createdAt':{'$gte':_0x3b31c0[_0xcc88('0x29')],'$lte':_0x3b31c0['dateEnd']}});}if(_0x17fe10['query'][_0xcc88('0x37')]){_0x278359['where']=_[_0xcc88('0x36')](_0x278359['where'],{'$or':_['map'](_0x278359[_0xcc88('0x2f')],function(_0x246ddb){var _0x3a9f6d={};_0x3a9f6d[_0x246ddb]={'$like':'%'+_0x17fe10[_0xcc88('0x28')][_0xcc88('0x37')]+'%'};return _0x3a9f6d;})});}_0x278359=_[_0xcc88('0x36')]({},_0x278359,_0x17fe10[_0xcc88('0x38')]);var _0x2177bf={'where':_0x278359['where']};return db[_0xcc88('0x25')][_0xcc88('0x16')](_0x2177bf)['then'](function(_0x3e3965){_0x53a4d3[_0xcc88('0x16')]=_0x3e3965;if(_0x17fe10[_0xcc88('0x28')][_0xcc88('0x39')]){_0x278359[_0xcc88('0x3a')]=[{'all':!![]}];}return db[_0xcc88('0x25')]['findAll'](_0x278359);})['then'](function(_0x1f0bc3){_0x53a4d3[_0xcc88('0x3b')]=_0x1f0bc3;return _0x53a4d3;})[_0xcc88('0x1e')](respondWithFilteredResult(_0xcfe72d,_0x278359))[_0xcc88('0x3c')](handleError(_0xcfe72d,null));};exports[_0xcc88('0x3d')]=function(_0x18f909,_0x4d3579){var _0x1eb824={'raw':!![],'where':{'id':_0x18f909['params']['id']}},_0x1aa62f={};_0x1aa62f[_0xcc88('0x27')]=_[_0xcc88('0x2b')](db[_0xcc88('0x25')]['rawAttributes']);_0x1aa62f[_0xcc88('0x28')]=_['keys'](_0x18f909[_0xcc88('0x28')]);_0x1aa62f[_0xcc88('0x2c')]=_['intersection'](_0x1aa62f[_0xcc88('0x27')],_0x1aa62f['query']);_0x1eb824[_0xcc88('0x2f')]=_[_0xcc88('0x2d')](_0x1aa62f[_0xcc88('0x27')],qs[_0xcc88('0x2e')](_0x18f909[_0xcc88('0x28')][_0xcc88('0x2e')]));_0x1eb824[_0xcc88('0x2f')]=_0x1eb824[_0xcc88('0x2f')][_0xcc88('0x3e')]?_0x1eb824['attributes']:_0x1aa62f[_0xcc88('0x27')];if(_0x18f909['query'][_0xcc88('0x39')]){_0x1eb824[_0xcc88('0x3a')]=[{'all':!![]}];}_0x1eb824=_[_0xcc88('0x36')]({},_0x1eb824,_0x18f909['options']);return db[_0xcc88('0x25')]['find'](_0x1eb824)[_0xcc88('0x1e')](handleEntityNotFound(_0x4d3579,null))['then'](respondWithResult(_0x4d3579,null))[_0xcc88('0x3c')](handleError(_0x4d3579,null));};exports['create']=function(_0x482dcd,_0x5b7cf0){return db['ZohoField'][_0xcc88('0x3f')](_0x482dcd[_0xcc88('0x40')],{})['then'](respondWithResult(_0x5b7cf0,0xc9))[_0xcc88('0x3c')](handleError(_0x5b7cf0,null));};exports[_0xcc88('0x1d')]=function(_0x30654d,_0x4a15fe){if(_0x30654d[_0xcc88('0x40')]['id']){delete _0x30654d[_0xcc88('0x40')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x30654d[_0xcc88('0x41')]['id']}})['then'](handleEntityNotFound(_0x4a15fe,null))['then'](saveUpdates(_0x30654d[_0xcc88('0x40')],null))[_0xcc88('0x1e')](respondWithResult(_0x4a15fe,null))[_0xcc88('0x3c')](handleError(_0x4a15fe,null));};exports['destroy']=function(_0x5ec449,_0x323223){return db[_0xcc88('0x25')][_0xcc88('0x42')]({'where':{'id':_0x5ec449[_0xcc88('0x41')]['id']}})[_0xcc88('0x1e')](handleEntityNotFound(_0x323223,null))[_0xcc88('0x1e')](removeEntity(_0x323223,null))['catch'](handleError(_0x323223,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index c74f735..573a1a8 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 _0xc6bf=['int_zoho_fields','util','../../config/logger','api','moment','bluebird','request-promise','./intZohoField.attributes','exports','ZohoField'];(function(_0x27f451,_0x416258){var _0x5c4871=function(_0xda1dde){while(--_0xda1dde){_0x27f451['push'](_0x27f451['shift']());}};_0x5c4871(++_0x416258);}(_0xc6bf,0x1af));var _0xfc6b=function(_0x6edc85,_0x2c7710){_0x6edc85=_0x6edc85-0x0;var _0x4631a9=_0xc6bf[_0x6edc85];return _0x4631a9;};'use strict';var _=require('lodash');var util=require(_0xfc6b('0x0'));var logger=require(_0xfc6b('0x1'))(_0xfc6b('0x2'));var moment=require(_0xfc6b('0x3'));var BPromise=require(_0xfc6b('0x4'));var rp=require(_0xfc6b('0x5'));var attributes=require(_0xfc6b('0x6'));module[_0xfc6b('0x7')]=function(_0x36e27a,_0x701db9){return _0x36e27a['define'](_0xfc6b('0x8'),attributes,{'tableName':_0xfc6b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdff7=['request-promise','exports','define','int_zoho_fields','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0xdff7,0x90));var _0x7dff=function(_0x78231f,_0x36ad6e){_0x78231f=_0x78231f-0x0;var _0x21855c=_0xdff7[_0x78231f];return _0x21855c;};'use strict';var _=require(_0x7dff('0x0'));var util=require(_0x7dff('0x1'));var logger=require(_0x7dff('0x2'))(_0x7dff('0x3'));var moment=require(_0x7dff('0x4'));var BPromise=require(_0x7dff('0x5'));var rp=require(_0x7dff('0x6'));var attributes=require('./intZohoField.attributes');module[_0x7dff('0x7')]=function(_0x5cf5a7,_0x140ec2){return _0x5cf5a7[_0x7dff('0x8')]('ZohoField',attributes,{'tableName':_0x7dff('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 4d6d377..fa13dcf 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 _0x6681=['../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','ZohoField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x441563,_0x1d4a28){var _0x2369ec=function(_0x1f97ba){while(--_0x1f97ba){_0x441563['push'](_0x441563['shift']());}};_0x2369ec(++_0x1d4a28);}(_0x6681,0xec));var _0x1668=function(_0x5ac734,_0xc057aa){_0x5ac734=_0x5ac734-0x0;var _0x467b6d=_0x6681[_0x5ac734];return _0x467b6d;};'use strict';var _=require('lodash');var util=require(_0x1668('0x0'));var moment=require('moment');var BPromise=require(_0x1668('0x1'));var rs=require(_0x1668('0x2'));var fs=require('fs');var Redis=require(_0x1668('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1668('0x4'))(_0x1668('0x5'));var config=require(_0x1668('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1668('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x226744,_0x1f1375,_0x20c692){return new BPromise(function(_0x2f7162,_0x129dbc){return client[_0x1668('0x8')](_0x226744,_0x20c692)[_0x1668('0x9')](function(_0x5f4c95){logger[_0x1668('0xa')]('ZohoField,\x20%s,\x20%s',_0x1f1375,_0x1668('0xb'));logger[_0x1668('0xc')](_0x1668('0xd'),_0x1f1375,_0x1668('0xb'),JSON[_0x1668('0xe')](_0x5f4c95));if(_0x5f4c95[_0x1668('0xf')]){if(_0x5f4c95[_0x1668('0xf')]['code']===0x1f4){logger[_0x1668('0xf')](_0x1668('0x10'),_0x1f1375,_0x5f4c95['error']['message']);return _0x129dbc(_0x5f4c95[_0x1668('0xf')]['message']);}logger['error']('ZohoField,\x20%s,\x20%s',_0x1f1375,_0x5f4c95['error'][_0x1668('0x11')]);return _0x2f7162(_0x5f4c95[_0x1668('0xf')]['message']);}else{logger[_0x1668('0xa')](_0x1668('0x10'),_0x1f1375,_0x1668('0xb'));_0x2f7162(_0x5f4c95[_0x1668('0x12')][_0x1668('0x11')]);}})[_0x1668('0x13')](function(_0x46e798){logger[_0x1668('0xf')](_0x1668('0x10'),_0x1f1375,_0x46e798);_0x129dbc(_0x46e798);});});} \ No newline at end of file +var _0x9862=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','ZohoField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x3ba4b4,_0x5a063f){var _0x4d6834=function(_0x506962){while(--_0x506962){_0x3ba4b4['push'](_0x3ba4b4['shift']());}};_0x4d6834(++_0x5a063f);}(_0x9862,0x164));var _0x2986=function(_0x5768c8,_0x56f75d){_0x5768c8=_0x5768c8-0x0;var _0x58b8ba=_0x9862[_0x5768c8];return _0x58b8ba;};'use strict';var _=require(_0x2986('0x0'));var util=require(_0x2986('0x1'));var moment=require(_0x2986('0x2'));var BPromise=require(_0x2986('0x3'));var rs=require(_0x2986('0x4'));var fs=require('fs');var Redis=require(_0x2986('0x5'));var db=require(_0x2986('0x6'))['db'];var utils=require(_0x2986('0x7'));var logger=require(_0x2986('0x8'))(_0x2986('0x9'));var config=require(_0x2986('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2986('0xb')][_0x2986('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x261e28,_0x44a38c,_0x64acc3){return new BPromise(function(_0x120dca,_0x25f1a7){return client[_0x2986('0xd')](_0x261e28,_0x64acc3)[_0x2986('0xe')](function(_0x3a28a0){logger[_0x2986('0xf')]('ZohoField,\x20%s,\x20%s',_0x44a38c,_0x2986('0x10'));logger[_0x2986('0x11')](_0x2986('0x12'),_0x44a38c,_0x2986('0x10'),JSON['stringify'](_0x3a28a0));if(_0x3a28a0[_0x2986('0x13')]){if(_0x3a28a0[_0x2986('0x13')][_0x2986('0x14')]===0x1f4){logger[_0x2986('0x13')](_0x2986('0x15'),_0x44a38c,_0x3a28a0[_0x2986('0x13')][_0x2986('0x16')]);return _0x25f1a7(_0x3a28a0[_0x2986('0x13')]['message']);}logger[_0x2986('0x13')](_0x2986('0x15'),_0x44a38c,_0x3a28a0[_0x2986('0x13')][_0x2986('0x16')]);return _0x120dca(_0x3a28a0['error'][_0x2986('0x16')]);}else{logger[_0x2986('0xf')]('ZohoField,\x20%s,\x20%s',_0x44a38c,_0x2986('0x10'));_0x120dca(_0x3a28a0[_0x2986('0x17')][_0x2986('0x16')]);}})['catch'](function(_0x49710f){logger['error'](_0x2986('0x15'),_0x44a38c,_0x49710f);_0x25f1a7(_0x49710f);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 9b7e27f..7c50c6d 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 _0xbc48=['../../config/environment','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x48a96c,_0x1da284){var _0x3f4266=function(_0x2bac94){while(--_0x2bac94){_0x48a96c['push'](_0x48a96c['shift']());}};_0x3f4266(++_0x1da284);}(_0xbc48,0x111));var _0x8bc4=function(_0x55d2dc,_0x52f56d){_0x55d2dc=_0x55d2dc-0x0;var _0x2fabee=_0xbc48[_0x55d2dc];return _0x2fabee;};'use strict';var multer=require(_0x8bc4('0x0'));var util=require(_0x8bc4('0x1'));var path=require(_0x8bc4('0x2'));var timeout=require(_0x8bc4('0x3'));var express=require('express');var router=express[_0x8bc4('0x4')]();var auth=require(_0x8bc4('0x5'));var interaction=require(_0x8bc4('0x6'));var config=require(_0x8bc4('0x7'));module['exports']=router; \ No newline at end of file +var _0xe928=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x57e51,_0x27de3a){var _0x17c798=function(_0xf60782){while(--_0xf60782){_0x57e51['push'](_0x57e51['shift']());}};_0x17c798(++_0x27de3a);}(_0xe928,0x145));var _0x8e92=function(_0x149882,_0x39b6be){_0x149882=_0x149882-0x0;var _0x43c6ee=_0xe928[_0x149882];return _0x43c6ee;};'use strict';var multer=require(_0x8e92('0x0'));var util=require(_0x8e92('0x1'));var path=require(_0x8e92('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e92('0x3'));var router=express['Router']();var auth=require(_0x8e92('0x4'));var interaction=require(_0x8e92('0x5'));var config=require(_0x8e92('0x6'));module[_0x8e92('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index a30a970..d6f88df 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 _0xa8d1=['exports','STRING','unique_name_and_version','app.js','BOOLEAN'];(function(_0x2eebfa,_0x2b23fd){var _0xdb8044=function(_0x3f11e0){while(--_0x3f11e0){_0x2eebfa['push'](_0x2eebfa['shift']());}};_0xdb8044(++_0x2b23fd);}(_0xa8d1,0x1d1));var _0x1a8d=function(_0x8b97b4,_0x382038){_0x8b97b4=_0x8b97b4-0x0;var _0x2ed10e=_0xa8d1[_0x8b97b4];return _0x2ed10e;};'use strict';var Sequelize=require('sequelize');module[_0x1a8d('0x0')]={'name':{'type':Sequelize[_0x1a8d('0x1')],'allowNull':![],'unique':_0x1a8d('0x2')},'version':{'type':Sequelize[_0x1a8d('0x1')],'allowNull':![],'unique':_0x1a8d('0x2')},'main':{'type':Sequelize[_0x1a8d('0x1')],'defaultValue':_0x1a8d('0x3')},'filename':{'type':Sequelize[_0x1a8d('0x1')]},'path':{'type':Sequelize[_0x1a8d('0x1')]},'type':{'type':Sequelize[_0x1a8d('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x1a8d('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x1a8d('0x1')]},'logo':{'type':Sequelize[_0x1a8d('0x1')]},'state':{'type':Sequelize[_0x1a8d('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x1a8d('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x1a8d('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x05b2=['STRING','unique_name_and_version','app.js','INTEGER','sequelize','exports'];(function(_0x114e37,_0x2fd5a6){var _0x13d988=function(_0xb59bc7){while(--_0xb59bc7){_0x114e37['push'](_0x114e37['shift']());}};_0x13d988(++_0x2fd5a6);}(_0x05b2,0xc4));var _0x205b=function(_0x354cdf,_0x2f68c6){_0x354cdf=_0x354cdf-0x0;var _0x4a1c47=_0x05b2[_0x354cdf];return _0x4a1c47;};'use strict';var Sequelize=require(_0x205b('0x0'));module[_0x205b('0x1')]={'name':{'type':Sequelize[_0x205b('0x2')],'allowNull':![],'unique':_0x205b('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x205b('0x2')],'defaultValue':_0x205b('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x205b('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x205b('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x205b('0x2')]},'logo':{'type':Sequelize[_0x205b('0x2')]},'state':{'type':Sequelize[_0x205b('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x205b('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x205b('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 6bf31b5..517c990 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 _0x7d9a=['filter','merge','map','then','includeAll','catch','show','params','length','options','find','create','body','destroy','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','stack','name','send','Integration','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day'];(function(_0x49dd92,_0x3c0967){var _0x7dae53=function(_0x26ef90){while(--_0x26ef90){_0x49dd92['push'](_0x49dd92['shift']());}};_0x7dae53(++_0x3c0967);}(_0x7d9a,0x1be));var _0xa7d9=function(_0x1c247f,_0x63599f){_0x1c247f=_0x1c247f-0x0;var _0x70aacc=_0x7d9a[_0x1c247f];return _0x70aacc;};'use strict';var pdf=require(_0xa7d9('0x0'));var emlformat=require(_0xa7d9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa7d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa7d9('0x3'));var BPromise=require(_0xa7d9('0x4'));var Mustache=require(_0xa7d9('0x5'));var util=require(_0xa7d9('0x6'));var path=require(_0xa7d9('0x7'));var sox=require(_0xa7d9('0x8'));var csv=require(_0xa7d9('0x9'));var ejs=require(_0xa7d9('0xa'));var fs=require('fs');var _=require(_0xa7d9('0xb'));var squel=require(_0xa7d9('0xc'));var crypto=require(_0xa7d9('0xd'));var jsforce=require(_0xa7d9('0xe'));var deskjs=require(_0xa7d9('0xf'));var toCsv=require(_0xa7d9('0x9'));var querystring=require(_0xa7d9('0x10'));var Papa=require(_0xa7d9('0x11'));var Redis=require('ioredis');var qs=require(_0xa7d9('0x12'));var logger=require(_0xa7d9('0x13'))(_0xa7d9('0x14'));var utils=require(_0xa7d9('0x15'));var config=require(_0xa7d9('0x16'));var db=require(_0xa7d9('0x17'))['db'];function respondWithStatusCode(_0x3796a7,_0x3594a2){_0x3594a2=_0x3594a2||0xcc;return function(_0x2bcf85){if(_0x2bcf85){return _0x3796a7[_0xa7d9('0x18')](_0x3594a2);}return _0x3796a7[_0xa7d9('0x19')](_0x3594a2)[_0xa7d9('0x1a')]();};}function respondWithResult(_0x19853a,_0x15e577){_0x15e577=_0x15e577||0xc8;return function(_0x567ce3){if(_0x567ce3){return _0x19853a[_0xa7d9('0x19')](_0x15e577)[_0xa7d9('0x1b')](_0x567ce3);}};}function respondWithFilteredResult(_0x46e2d2,_0x576135){return function(_0x15e511){if(_0x15e511){var _0x10dcb2=_0x15e511[_0xa7d9('0x1c')],_0x557983=_0x576135[_0xa7d9('0x1d')],_0x50840d=_0x576135[_0xa7d9('0x1d')]+_0x576135['limit'],_0x25e54f;if(_0x50840d>=_0x10dcb2){_0x50840d=_0x10dcb2;_0x25e54f=0xc8;}else{_0x25e54f=0xce;}_0x46e2d2[_0xa7d9('0x19')](_0x25e54f);return _0x46e2d2[_0xa7d9('0x1e')](_0xa7d9('0x1f'),_0x557983+'-'+_0x50840d+'/'+_0x10dcb2)[_0xa7d9('0x1b')](_0x15e511);}return null;};}function patchUpdates(_0x242224){return function(_0x310adf){try{jsonpatch[_0xa7d9('0x20')](_0x310adf,_0x242224,!![]);}catch(_0x5086a9){return BPromise['reject'](_0x5086a9);}return _0x310adf[_0xa7d9('0x21')]();};}function saveUpdates(_0x21c876,_0x1fad36){return function(_0x472ad7){if(_0x472ad7){return _0x472ad7[_0xa7d9('0x22')](_0x21c876)['then'](function(_0x4a1f5d){return _0x4a1f5d;});}return null;};}function removeEntity(_0x4e7543,_0x3ba58f){return function(_0x2a1727){if(_0x2a1727){return _0x2a1727['destroy']()['then'](function(){_0x4e7543['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ef2a5,_0x287e77){return function(_0x50bfaf){if(!_0x50bfaf){_0x4ef2a5[_0xa7d9('0x18')](0x194);}return _0x50bfaf;};}function handleError(_0x1f9453,_0x3862a1){_0x3862a1=_0x3862a1||0x1f4;return function(_0x19a206){logger['error'](_0x19a206[_0xa7d9('0x23')]);if(_0x19a206[_0xa7d9('0x24')]){delete _0x19a206[_0xa7d9('0x24')];}_0x1f9453[_0xa7d9('0x19')](_0x3862a1)[_0xa7d9('0x25')](_0x19a206);};}exports['index']=function(_0x149fb4,_0x579e38){var _0xc5b4b5={},_0x56c637={},_0x490005={'count':0x0,'rows':[]};var _0x506380=db[_0xa7d9('0x26')][_0xa7d9('0x27')];_0x56c637[_0xa7d9('0x28')]=_[_0xa7d9('0x29')](_0x506380);var _0x5a4e3a={'dateStart':_0x149fb4[_0xa7d9('0x2a')][_0xa7d9('0x2b')],'dateEnd':_0x149fb4['query'][_0xa7d9('0x2c')]};delete _0x149fb4[_0xa7d9('0x2a')][_0xa7d9('0x2b')];delete _0x149fb4[_0xa7d9('0x2a')][_0xa7d9('0x2c')];_0x56c637[_0xa7d9('0x2a')]=_[_0xa7d9('0x29')](_0x149fb4['query']);_0x56c637[_0xa7d9('0x2d')]=_[_0xa7d9('0x2e')](_0x56c637['model'],_0x56c637[_0xa7d9('0x2a')]);_0xc5b4b5['attributes']=_[_0xa7d9('0x2e')](_0x56c637[_0xa7d9('0x28')],qs[_0xa7d9('0x2f')](_0x149fb4[_0xa7d9('0x2a')][_0xa7d9('0x2f')]));_0xc5b4b5[_0xa7d9('0x30')]=_0xc5b4b5[_0xa7d9('0x30')]['length']?_0xc5b4b5[_0xa7d9('0x30')]:_0x56c637['model'];if(!_0x149fb4[_0xa7d9('0x2a')][_0xa7d9('0x31')](_0xa7d9('0x32'))){_0xc5b4b5['limit']=qs[_0xa7d9('0x33')](_0x149fb4[_0xa7d9('0x2a')]['limit']);_0xc5b4b5[_0xa7d9('0x1d')]=qs[_0xa7d9('0x1d')](_0x149fb4['query'][_0xa7d9('0x1d')]);}_0xc5b4b5[_0xa7d9('0x34')]=qs[_0xa7d9('0x35')](_0x149fb4[_0xa7d9('0x2a')]['sort']);_0xc5b4b5[_0xa7d9('0x36')]=qs[_0xa7d9('0x2d')](_[_0xa7d9('0x37')](_0x149fb4[_0xa7d9('0x2a')],_0x56c637['filters']));if(_0x5a4e3a[_0xa7d9('0x2b')]){if(_0x5a4e3a[_0xa7d9('0x2c')]){_0x5a4e3a[_0xa7d9('0x2c')]=moment(_0x5a4e3a['dateEnd'])[_0xa7d9('0x38')](0x1,'day');}else{_0x5a4e3a['dateEnd']=moment(_0x5a4e3a[_0xa7d9('0x2b')])[_0xa7d9('0x38')](0x1,_0xa7d9('0x39'));}_['merge'](_0xc5b4b5[_0xa7d9('0x36')],{'createdAt':{'$gte':_0x5a4e3a[_0xa7d9('0x2b')],'$lte':_0x5a4e3a[_0xa7d9('0x2c')]}});}if(_0x149fb4[_0xa7d9('0x2a')][_0xa7d9('0x3a')]){_0xc5b4b5[_0xa7d9('0x36')]=_[_0xa7d9('0x3b')](_0xc5b4b5['where'],{'$or':_[_0xa7d9('0x3c')](_0xc5b4b5[_0xa7d9('0x30')],function(_0x5dc42e){var _0x1ee124={};_0x1ee124[_0x5dc42e]={'$like':'%'+_0x149fb4['query']['filter']+'%'};return _0x1ee124;})});}_0xc5b4b5=_[_0xa7d9('0x3b')]({},_0xc5b4b5,_0x149fb4['options']);var _0x381c40={'where':_0xc5b4b5[_0xa7d9('0x36')]};return db['Integration'][_0xa7d9('0x1c')](_0x381c40)[_0xa7d9('0x3d')](function(_0x34500d){_0x490005['count']=_0x34500d;if(_0x149fb4[_0xa7d9('0x2a')][_0xa7d9('0x3e')]){_0xc5b4b5['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0xc5b4b5);})['then'](function(_0x290b4f){_0x490005['rows']=_0x290b4f;return _0x490005;})['then'](respondWithFilteredResult(_0x579e38,_0xc5b4b5))[_0xa7d9('0x3f')](handleError(_0x579e38,null));};exports[_0xa7d9('0x40')]=function(_0x59cd05,_0x3adfbf){var _0x463f9d={'raw':![],'where':{'id':_0x59cd05[_0xa7d9('0x41')]['id']}},_0x34d61e={};_0x34d61e['model']=_['keys'](db[_0xa7d9('0x26')][_0xa7d9('0x27')]);_0x34d61e[_0xa7d9('0x2a')]=_['keys'](_0x59cd05[_0xa7d9('0x2a')]);_0x34d61e[_0xa7d9('0x2d')]=_['intersection'](_0x34d61e['model'],_0x34d61e[_0xa7d9('0x2a')]);_0x463f9d[_0xa7d9('0x30')]=_[_0xa7d9('0x2e')](_0x34d61e[_0xa7d9('0x28')],qs[_0xa7d9('0x2f')](_0x59cd05['query'][_0xa7d9('0x2f')]));_0x463f9d[_0xa7d9('0x30')]=_0x463f9d[_0xa7d9('0x30')][_0xa7d9('0x42')]?_0x463f9d['attributes']:_0x34d61e[_0xa7d9('0x28')];if(_0x59cd05[_0xa7d9('0x2a')][_0xa7d9('0x3e')]){_0x463f9d['include']=[{'all':!![]}];}_0x463f9d=_[_0xa7d9('0x3b')]({},_0x463f9d,_0x59cd05[_0xa7d9('0x43')]);return db[_0xa7d9('0x26')][_0xa7d9('0x44')](_0x463f9d)[_0xa7d9('0x3d')](handleEntityNotFound(_0x3adfbf,null))[_0xa7d9('0x3d')](respondWithResult(_0x3adfbf,null))[_0xa7d9('0x3f')](handleError(_0x3adfbf,null));};exports[_0xa7d9('0x45')]=function(_0x41a648,_0x3023aa){return db[_0xa7d9('0x26')][_0xa7d9('0x45')](_0x41a648[_0xa7d9('0x46')],{})[_0xa7d9('0x3d')](respondWithResult(_0x3023aa,0xc9))[_0xa7d9('0x3f')](handleError(_0x3023aa,null));};exports[_0xa7d9('0x22')]=function(_0x1805be,_0xa0e536){if(_0x1805be['body']['id']){delete _0x1805be[_0xa7d9('0x46')]['id'];}return db['Integration']['find']({'where':{'id':_0x1805be['params']['id']}})[_0xa7d9('0x3d')](handleEntityNotFound(_0xa0e536,null))['then'](saveUpdates(_0x1805be['body'],null))[_0xa7d9('0x3d')](respondWithResult(_0xa0e536,null))[_0xa7d9('0x3f')](handleError(_0xa0e536,null));};exports[_0xa7d9('0x47')]=function(_0x41cb2e,_0xe88cc2){return db[_0xa7d9('0x26')]['find']({'where':{'id':_0x41cb2e[_0xa7d9('0x41')]['id']}})[_0xa7d9('0x3d')](handleEntityNotFound(_0xe88cc2,null))['then'](removeEntity(_0xe88cc2,null))['catch'](handleError(_0xe88cc2,null));}; \ No newline at end of file +var _0x6dec=['json','count','offset','limit','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','Integration','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','add','day','merge','map','options','include','findAll','rows','show','includeAll','find','catch','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','end','status'];(function(_0x2e9c41,_0x14069a){var _0x279de2=function(_0x180bfa){while(--_0x180bfa){_0x2e9c41['push'](_0x2e9c41['shift']());}};_0x279de2(++_0x14069a);}(_0x6dec,0x10e));var _0xc6de=function(_0x295797,_0x3c55c9){_0x295797=_0x295797-0x0;var _0x401796=_0x6dec[_0x295797];return _0x401796;};'use strict';var pdf=require(_0xc6de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc6de('0x1'));var zipdir=require(_0xc6de('0x2'));var jsonpatch=require(_0xc6de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6de('0x4'));var Mustache=require(_0xc6de('0x5'));var util=require(_0xc6de('0x6'));var path=require(_0xc6de('0x7'));var sox=require(_0xc6de('0x8'));var csv=require(_0xc6de('0x9'));var ejs=require(_0xc6de('0xa'));var fs=require('fs');var _=require(_0xc6de('0xb'));var squel=require(_0xc6de('0xc'));var crypto=require(_0xc6de('0xd'));var jsforce=require(_0xc6de('0xe'));var deskjs=require(_0xc6de('0xf'));var toCsv=require(_0xc6de('0x9'));var querystring=require(_0xc6de('0x10'));var Papa=require(_0xc6de('0x11'));var Redis=require(_0xc6de('0x12'));var qs=require(_0xc6de('0x13'));var logger=require('../../config/logger')(_0xc6de('0x14'));var utils=require(_0xc6de('0x15'));var config=require(_0xc6de('0x16'));var db=require(_0xc6de('0x17'))['db'];function respondWithStatusCode(_0x25f3e9,_0x57d4ae){_0x57d4ae=_0x57d4ae||0xcc;return function(_0x230a02){if(_0x230a02){return _0x25f3e9['sendStatus'](_0x57d4ae);}return _0x25f3e9['status'](_0x57d4ae)[_0xc6de('0x18')]();};}function respondWithResult(_0x62c56d,_0x2101d5){_0x2101d5=_0x2101d5||0xc8;return function(_0x227289){if(_0x227289){return _0x62c56d[_0xc6de('0x19')](_0x2101d5)[_0xc6de('0x1a')](_0x227289);}};}function respondWithFilteredResult(_0x236d06,_0x526079){return function(_0x73cdb9){if(_0x73cdb9){var _0x42dc26=_0x73cdb9[_0xc6de('0x1b')],_0xf6398c=_0x526079[_0xc6de('0x1c')],_0x2d3109=_0x526079[_0xc6de('0x1c')]+_0x526079[_0xc6de('0x1d')],_0x53fba0;if(_0x2d3109>=_0x42dc26){_0x2d3109=_0x42dc26;_0x53fba0=0xc8;}else{_0x53fba0=0xce;}_0x236d06['status'](_0x53fba0);return _0x236d06['set']('Content-Range',_0xf6398c+'-'+_0x2d3109+'/'+_0x42dc26)['json'](_0x73cdb9);}return null;};}function patchUpdates(_0x1d85fc){return function(_0x66e8e6){try{jsonpatch[_0xc6de('0x1e')](_0x66e8e6,_0x1d85fc,!![]);}catch(_0x12412c){return BPromise[_0xc6de('0x1f')](_0x12412c);}return _0x66e8e6[_0xc6de('0x20')]();};}function saveUpdates(_0x5a03c2,_0x1ab220){return function(_0x352af8){if(_0x352af8){return _0x352af8[_0xc6de('0x21')](_0x5a03c2)['then'](function(_0x4189d3){return _0x4189d3;});}return null;};}function removeEntity(_0x26a170,_0x5d311e){return function(_0x241a80){if(_0x241a80){return _0x241a80[_0xc6de('0x22')]()[_0xc6de('0x23')](function(){_0x26a170['status'](0xcc)[_0xc6de('0x18')]();});}};}function handleEntityNotFound(_0x31d8c0,_0x5a504e){return function(_0x57343e){if(!_0x57343e){_0x31d8c0[_0xc6de('0x24')](0x194);}return _0x57343e;};}function handleError(_0x1d0725,_0x4f5222){_0x4f5222=_0x4f5222||0x1f4;return function(_0xa26ad5){logger[_0xc6de('0x25')](_0xa26ad5[_0xc6de('0x26')]);if(_0xa26ad5['name']){delete _0xa26ad5[_0xc6de('0x27')];}_0x1d0725['status'](_0x4f5222)[_0xc6de('0x28')](_0xa26ad5);};}exports[_0xc6de('0x29')]=function(_0x2c1d86,_0x225eb2){var _0x231d6a={},_0x56526b={},_0x125648={'count':0x0,'rows':[]};var _0x3c737f=db[_0xc6de('0x2a')][_0xc6de('0x2b')];_0x56526b[_0xc6de('0x2c')]=_['keys'](_0x3c737f);var _0x44399b={'dateStart':_0x2c1d86[_0xc6de('0x2d')][_0xc6de('0x2e')],'dateEnd':_0x2c1d86[_0xc6de('0x2d')][_0xc6de('0x2f')]};delete _0x2c1d86[_0xc6de('0x2d')][_0xc6de('0x2e')];delete _0x2c1d86['query'][_0xc6de('0x2f')];_0x56526b[_0xc6de('0x2d')]=_[_0xc6de('0x30')](_0x2c1d86[_0xc6de('0x2d')]);_0x56526b['filters']=_[_0xc6de('0x31')](_0x56526b[_0xc6de('0x2c')],_0x56526b[_0xc6de('0x2d')]);_0x231d6a[_0xc6de('0x32')]=_[_0xc6de('0x31')](_0x56526b[_0xc6de('0x2c')],qs[_0xc6de('0x33')](_0x2c1d86[_0xc6de('0x2d')][_0xc6de('0x33')]));_0x231d6a[_0xc6de('0x32')]=_0x231d6a[_0xc6de('0x32')][_0xc6de('0x34')]?_0x231d6a['attributes']:_0x56526b['model'];if(!_0x2c1d86[_0xc6de('0x2d')]['hasOwnProperty'](_0xc6de('0x35'))){_0x231d6a[_0xc6de('0x1d')]=qs[_0xc6de('0x1d')](_0x2c1d86[_0xc6de('0x2d')]['limit']);_0x231d6a[_0xc6de('0x1c')]=qs[_0xc6de('0x1c')](_0x2c1d86[_0xc6de('0x2d')]['offset']);}_0x231d6a[_0xc6de('0x36')]=qs[_0xc6de('0x37')](_0x2c1d86[_0xc6de('0x2d')][_0xc6de('0x37')]);_0x231d6a[_0xc6de('0x38')]=qs['filters'](_[_0xc6de('0x39')](_0x2c1d86['query'],_0x56526b[_0xc6de('0x3a')]));if(_0x44399b[_0xc6de('0x2e')]){if(_0x44399b[_0xc6de('0x2f')]){_0x44399b[_0xc6de('0x2f')]=moment(_0x44399b['dateEnd'])[_0xc6de('0x3b')](0x1,_0xc6de('0x3c'));}else{_0x44399b[_0xc6de('0x2f')]=moment(_0x44399b[_0xc6de('0x2e')])[_0xc6de('0x3b')](0x1,_0xc6de('0x3c'));}_[_0xc6de('0x3d')](_0x231d6a[_0xc6de('0x38')],{'createdAt':{'$gte':_0x44399b[_0xc6de('0x2e')],'$lte':_0x44399b[_0xc6de('0x2f')]}});}if(_0x2c1d86['query']['filter']){_0x231d6a['where']=_[_0xc6de('0x3d')](_0x231d6a[_0xc6de('0x38')],{'$or':_[_0xc6de('0x3e')](_0x231d6a[_0xc6de('0x32')],function(_0x364de0){var _0x12413e={};_0x12413e[_0x364de0]={'$like':'%'+_0x2c1d86['query']['filter']+'%'};return _0x12413e;})});}_0x231d6a=_[_0xc6de('0x3d')]({},_0x231d6a,_0x2c1d86[_0xc6de('0x3f')]);var _0x382e75={'where':_0x231d6a[_0xc6de('0x38')]};return db[_0xc6de('0x2a')][_0xc6de('0x1b')](_0x382e75)[_0xc6de('0x23')](function(_0x352c18){_0x125648['count']=_0x352c18;if(_0x2c1d86[_0xc6de('0x2d')]['includeAll']){_0x231d6a[_0xc6de('0x40')]=[{'all':!![]}];}return db[_0xc6de('0x2a')][_0xc6de('0x41')](_0x231d6a);})[_0xc6de('0x23')](function(_0x516e1e){_0x125648[_0xc6de('0x42')]=_0x516e1e;return _0x125648;})[_0xc6de('0x23')](respondWithFilteredResult(_0x225eb2,_0x231d6a))['catch'](handleError(_0x225eb2,null));};exports[_0xc6de('0x43')]=function(_0x25c8f2,_0x3aa29b){var _0x4bcda6={'raw':![],'where':{'id':_0x25c8f2['params']['id']}},_0x4ffc61={};_0x4ffc61['model']=_[_0xc6de('0x30')](db[_0xc6de('0x2a')][_0xc6de('0x2b')]);_0x4ffc61[_0xc6de('0x2d')]=_['keys'](_0x25c8f2['query']);_0x4ffc61['filters']=_[_0xc6de('0x31')](_0x4ffc61[_0xc6de('0x2c')],_0x4ffc61[_0xc6de('0x2d')]);_0x4bcda6[_0xc6de('0x32')]=_[_0xc6de('0x31')](_0x4ffc61[_0xc6de('0x2c')],qs[_0xc6de('0x33')](_0x25c8f2[_0xc6de('0x2d')][_0xc6de('0x33')]));_0x4bcda6[_0xc6de('0x32')]=_0x4bcda6['attributes']['length']?_0x4bcda6['attributes']:_0x4ffc61[_0xc6de('0x2c')];if(_0x25c8f2['query'][_0xc6de('0x44')]){_0x4bcda6[_0xc6de('0x40')]=[{'all':!![]}];}_0x4bcda6=_[_0xc6de('0x3d')]({},_0x4bcda6,_0x25c8f2[_0xc6de('0x3f')]);return db[_0xc6de('0x2a')][_0xc6de('0x45')](_0x4bcda6)['then'](handleEntityNotFound(_0x3aa29b,null))['then'](respondWithResult(_0x3aa29b,null))[_0xc6de('0x46')](handleError(_0x3aa29b,null));};exports['create']=function(_0xf32fa8,_0x5372da){return db['Integration'][_0xc6de('0x47')](_0xf32fa8[_0xc6de('0x48')],{})[_0xc6de('0x23')](respondWithResult(_0x5372da,0xc9))['catch'](handleError(_0x5372da,null));};exports[_0xc6de('0x21')]=function(_0x9bbdd7,_0x1797e0){if(_0x9bbdd7['body']['id']){delete _0x9bbdd7[_0xc6de('0x48')]['id'];}return db[_0xc6de('0x2a')][_0xc6de('0x45')]({'where':{'id':_0x9bbdd7[_0xc6de('0x49')]['id']}})[_0xc6de('0x23')](handleEntityNotFound(_0x1797e0,null))['then'](saveUpdates(_0x9bbdd7['body'],null))[_0xc6de('0x23')](respondWithResult(_0x1797e0,null))['catch'](handleError(_0x1797e0,null));};exports['destroy']=function(_0x8a22be,_0x3498c1){return db[_0xc6de('0x2a')][_0xc6de('0x45')]({'where':{'id':_0x8a22be[_0xc6de('0x49')]['id']}})[_0xc6de('0x23')](handleEntityNotFound(_0x3498c1,null))[_0xc6de('0x23')](removeEntity(_0x3498c1,null))[_0xc6de('0x46')](handleError(_0x3498c1,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index ee9c539..c5053a0 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 _0x524e=['api','moment','bluebird','request-promise','./integration.attributes','exports','define','integrations','../../config/logger'];(function(_0x38330e,_0x7f6ac8){var _0x5ef01c=function(_0x57a6d9){while(--_0x57a6d9){_0x38330e['push'](_0x38330e['shift']());}};_0x5ef01c(++_0x7f6ac8);}(_0x524e,0x15e));var _0xe524=function(_0x3664c5,_0x1990dd){_0x3664c5=_0x3664c5-0x0;var _0x588dba=_0x524e[_0x3664c5];return _0x588dba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var attributes=require(_0xe524('0x5'));module[_0xe524('0x6')]=function(_0x32c90b,_0x10d37a){return _0x32c90b[_0xe524('0x7')]('Integration',attributes,{'tableName':_0xe524('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['Integration','integrations','lodash','util','../../config/logger','api','moment','exports','define'];(function(_0x1bc52e,_0x375f9d){var _0x315208=function(_0x577ab8){while(--_0x577ab8){_0x1bc52e['push'](_0x1bc52e['shift']());}};_0x315208(++_0x375f9d);}(_0xba34,0x119));var _0x4ba3=function(_0x4ae404,_0xd76a82){_0x4ae404=_0x4ae404-0x0;var _0x421b6d=_0xba34[_0x4ae404];return _0x421b6d;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./integration.attributes');module[_0x4ba3('0x5')]=function(_0x2947f2,_0x278101){return _0x2947f2[_0x4ba3('0x6')](_0x4ba3('0x7'),attributes,{'tableName':_0x4ba3('0x8'),'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 afa6af8..54ea50f 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 _0xbae1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xbae1,0x91));var _0x1bae=function(_0x40fdca,_0x2fe232){_0x40fdca=_0x40fdca-0x0;var _0x1858da=_0xbae1[_0x40fdca];return _0x1858da;};'use strict';var _=require(_0x1bae('0x0'));var util=require(_0x1bae('0x1'));var moment=require(_0x1bae('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bae('0x3'));var fs=require('fs');var Redis=require(_0x1bae('0x4'));var db=require(_0x1bae('0x5'))['db'];var utils=require(_0x1bae('0x6'));var logger=require(_0x1bae('0x7'))(_0x1bae('0x8'));var config=require(_0x1bae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1bae('0xa')][_0x1bae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x319923,_0xd506ec,_0x5248cb){return new BPromise(function(_0x326c91,_0x332d25){return client[_0x1bae('0xc')](_0x319923,_0x5248cb)[_0x1bae('0xd')](function(_0x4df01e){logger[_0x1bae('0xe')](_0x1bae('0xf'),_0xd506ec,_0x1bae('0x10'));logger[_0x1bae('0x11')](_0x1bae('0x12'),_0xd506ec,_0x1bae('0x10'),JSON[_0x1bae('0x13')](_0x4df01e));if(_0x4df01e[_0x1bae('0x14')]){if(_0x4df01e[_0x1bae('0x14')][_0x1bae('0x15')]===0x1f4){logger['error'](_0x1bae('0xf'),_0xd506ec,_0x4df01e[_0x1bae('0x14')][_0x1bae('0x16')]);return _0x332d25(_0x4df01e[_0x1bae('0x14')]['message']);}logger[_0x1bae('0x14')](_0x1bae('0xf'),_0xd506ec,_0x4df01e['error'][_0x1bae('0x16')]);return _0x326c91(_0x4df01e[_0x1bae('0x14')][_0x1bae('0x16')]);}else{logger[_0x1bae('0xe')](_0x1bae('0xf'),_0xd506ec,_0x1bae('0x10'));_0x326c91(_0x4df01e[_0x1bae('0x17')][_0x1bae('0x16')]);}})[_0x1bae('0x18')](function(_0x5b9efd){logger[_0x1bae('0x14')]('Integration,\x20%s,\x20%s',_0xd506ec,_0x5b9efd);_0x332d25(_0x5b9efd);});});} \ No newline at end of file +var _0xef4c=['stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x36be81,_0x5660ab){var _0x5e2513=function(_0x1985f3){while(--_0x1985f3){_0x36be81['push'](_0x36be81['shift']());}};_0x5e2513(++_0x5660ab);}(_0xef4c,0xde));var _0xcef4=function(_0x23cea8,_0xf2c23e){_0x23cea8=_0x23cea8-0x0;var _0x4636e7=_0xef4c[_0x23cea8];return _0x4636e7;};'use strict';var _=require(_0xcef4('0x0'));var util=require(_0xcef4('0x1'));var moment=require(_0xcef4('0x2'));var BPromise=require(_0xcef4('0x3'));var rs=require(_0xcef4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcef4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcef4('0x6'))(_0xcef4('0x7'));var config=require(_0xcef4('0x8'));var jayson=require(_0xcef4('0x9'));var client=jayson['client'][_0xcef4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d9a14,_0x319862,_0x19d179){return new BPromise(function(_0x1f7e99,_0x2b32d1){return client[_0xcef4('0xb')](_0x4d9a14,_0x19d179)[_0xcef4('0xc')](function(_0x6811c){logger[_0xcef4('0xd')](_0xcef4('0xe'),_0x319862,'request\x20sent');logger[_0xcef4('0xf')](_0xcef4('0x10'),_0x319862,_0xcef4('0x11'),JSON[_0xcef4('0x12')](_0x6811c));if(_0x6811c['error']){if(_0x6811c['error'][_0xcef4('0x13')]===0x1f4){logger[_0xcef4('0x14')](_0xcef4('0xe'),_0x319862,_0x6811c[_0xcef4('0x14')]['message']);return _0x2b32d1(_0x6811c[_0xcef4('0x14')][_0xcef4('0x15')]);}logger['error']('Integration,\x20%s,\x20%s',_0x319862,_0x6811c[_0xcef4('0x14')][_0xcef4('0x15')]);return _0x1f7e99(_0x6811c[_0xcef4('0x14')][_0xcef4('0x15')]);}else{logger[_0xcef4('0xd')](_0xcef4('0xe'),_0x319862,_0xcef4('0x11'));_0x1f7e99(_0x6811c[_0xcef4('0x16')][_0xcef4('0x15')]);}})[_0xcef4('0x17')](function(_0x1997e6){logger[_0xcef4('0x14')](_0xcef4('0xe'),_0x319862,_0x1997e6);_0x2b32d1(_0x1997e6);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 5d28e80..15dfddd 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 _0x47e1=['../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x47e1,0x76));var _0x147e=function(_0x46d1bc,_0x9e5835){_0x46d1bc=_0x46d1bc-0x0;var _0x4eb59d=_0x47e1[_0x46d1bc];return _0x4eb59d;};'use strict';var multer=require(_0x147e('0x0'));var util=require(_0x147e('0x1'));var path=require(_0x147e('0x2'));var timeout=require(_0x147e('0x3'));var express=require(_0x147e('0x4'));var router=express[_0x147e('0x5')]();var auth=require(_0x147e('0x6'));var interaction=require(_0x147e('0x7'));var config=require(_0x147e('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x147e('0x9')](),controller[_0x147e('0xa')]);router[_0x147e('0xb')]('/describe',auth[_0x147e('0x9')](),controller[_0x147e('0xc')]);router[_0x147e('0xb')](_0x147e('0xd'),auth[_0x147e('0x9')](),controller[_0x147e('0xe')]);router[_0x147e('0xf')]('/',auth[_0x147e('0x9')](),controller[_0x147e('0x10')]);router[_0x147e('0x11')](_0x147e('0xd'),auth[_0x147e('0x9')](),controller[_0x147e('0x12')]);router[_0x147e('0x13')]('/:id',auth[_0x147e('0x9')](),controller[_0x147e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1799=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x1799,0x19d));var _0x9179=function(_0x4840ad,_0x288724){_0x4840ad=_0x4840ad-0x0;var _0x1af893=_0x1799[_0x4840ad];return _0x1af893;};'use strict';var multer=require(_0x9179('0x0'));var util=require('util');var path=require(_0x9179('0x1'));var timeout=require(_0x9179('0x2'));var express=require(_0x9179('0x3'));var router=express[_0x9179('0x4')]();var auth=require(_0x9179('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9179('0x6'));var controller=require('./integrationReport.controller');router[_0x9179('0x7')]('/',auth[_0x9179('0x8')](),controller['index']);router[_0x9179('0x7')](_0x9179('0x9'),auth[_0x9179('0x8')](),controller['describe']);router[_0x9179('0x7')](_0x9179('0xa'),auth[_0x9179('0x8')](),controller[_0x9179('0xb')]);router[_0x9179('0xc')]('/',auth[_0x9179('0x8')](),controller[_0x9179('0xd')]);router[_0x9179('0xe')]('/:id',auth[_0x9179('0x8')](),controller[_0x9179('0xf')]);router[_0x9179('0x10')](_0x9179('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9179('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4226fba..ff53610 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 _0x779a=['BOOLEAN','TEXT','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x4e9bef,_0x320024){var _0x2e5552=function(_0x1e17d4){while(--_0x1e17d4){_0x4e9bef['push'](_0x4e9bef['shift']());}};_0x2e5552(++_0x320024);}(_0x779a,0x1c3));var _0xa779=function(_0x98b09a,_0x12906b){_0x98b09a=_0x98b09a-0x0;var _0x13a15c=_0x779a[_0x98b09a];return _0x13a15c;};'use strict';var Sequelize=require(_0xa779('0x0'));module[_0xa779('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xa779('0x2')]},'exitStatus':{'type':Sequelize[_0xa779('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xa779('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa779('0x2')]},'calleridnum':{'type':Sequelize[_0xa779('0x2')]},'calleridname':{'type':Sequelize[_0xa779('0x2')]},'queue':{'type':Sequelize[_0xa779('0x2')]},'interface':{'type':Sequelize[_0xa779('0x2')]},'membername':{'type':Sequelize[_0xa779('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa779('0x4')]},'agentconnectAt':{'type':Sequelize[_0xa779('0x4')]},'holdtime':{'type':Sequelize[_0xa779('0x3')]},'agentcomplete':{'type':Sequelize[_0xa779('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa779('0x4')]},'talktime':{'type':Sequelize[_0xa779('0x3')]},'agentacw':{'type':Sequelize[_0xa779('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa779('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xa779('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa779('0x4')]},'agentdump':{'type':Sequelize[_0xa779('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa779('0x4')]},'lastevent':{'type':Sequelize[_0xa779('0x2')]},'channel':{'type':Sequelize[_0xa779('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa779('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa779('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa779('0x2')]},'priority':{'type':Sequelize[_0xa779('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa779('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa779('0x2')]},'destcalleridname':{'type':Sequelize[_0xa779('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa779('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xa779('0x2')]},'destlanguage':{'type':Sequelize[_0xa779('0x2')]},'destaccountcode':{'type':Sequelize[_0xa779('0x2')]},'destcontext':{'type':Sequelize[_0xa779('0x2')]},'destexten':{'type':Sequelize[_0xa779('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xa779('0x2')]},'messageId':{'type':Sequelize[_0xa779('0x2')]},'inReplyTo':{'type':Sequelize[_0xa779('0x2')]},'subject':{'type':Sequelize[_0xa779('0x2')]},'from':{'type':Sequelize[_0xa779('0x2')]},'to':{'type':Sequelize[_0xa779('0x2')]},'cc':{'type':Sequelize[_0xa779('0x2')]},'attachment':{'type':Sequelize[_0xa779('0x6')]},'html':{'type':Sequelize[_0xa779('0x6')]},'text':{'type':Sequelize[_0xa779('0x6')]},'status':{'type':Sequelize['ENUM']('SENT','SENDING','RECEIVED',_0xa779('0x7'))},'url':{'type':Sequelize[_0xa779('0x2')]},'app':{'type':Sequelize[_0xa779('0x2')]},'appdata':{'type':Sequelize[_0xa779('0x2')]},'projectId':{'type':Sequelize[_0xa779('0x3')]}}; \ No newline at end of file +var _0x140f=['DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x4ed711,_0xb06091){var _0xe0e482=function(_0x1a9394){while(--_0x1a9394){_0x4ed711['push'](_0x4ed711['shift']());}};_0xe0e482(++_0xb06091);}(_0x140f,0xac));var _0xf140=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0x140f[_0x57d370];return _0x550fd2;};'use strict';var Sequelize=require(_0xf140('0x0'));module[_0xf140('0x1')]={'integration':{'type':Sequelize[_0xf140('0x2')]},'eventChannel':{'type':Sequelize[_0xf140('0x2')]},'exitStatus':{'type':Sequelize[_0xf140('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xf140('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf140('0x2')]},'calleridnum':{'type':Sequelize[_0xf140('0x2')]},'calleridname':{'type':Sequelize[_0xf140('0x2')]},'queue':{'type':Sequelize[_0xf140('0x2')]},'interface':{'type':Sequelize[_0xf140('0x2')]},'membername':{'type':Sequelize[_0xf140('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf140('0x4')]},'agentconnectAt':{'type':Sequelize[_0xf140('0x4')]},'holdtime':{'type':Sequelize[_0xf140('0x3')]},'agentcomplete':{'type':Sequelize[_0xf140('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf140('0x4')]},'talktime':{'type':Sequelize[_0xf140('0x3')]},'agentacw':{'type':Sequelize[_0xf140('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf140('0x3')]},'reason':{'type':Sequelize[_0xf140('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xf140('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf140('0x4')]},'agentdump':{'type':Sequelize[_0xf140('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf140('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf140('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf140('0x2')]},'connectedlinename':{'type':Sequelize[_0xf140('0x2')]},'language':{'type':Sequelize[_0xf140('0x2')]},'accountcode':{'type':Sequelize[_0xf140('0x2')]},'context':{'type':Sequelize[_0xf140('0x2')]},'exten':{'type':Sequelize[_0xf140('0x2')]},'priority':{'type':Sequelize[_0xf140('0x2')]},'destchannel':{'type':Sequelize[_0xf140('0x2')]},'destchannelstate':{'type':Sequelize[_0xf140('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xf140('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf140('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf140('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf140('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xf140('0x2')]},'destuniqueid':{'type':Sequelize[_0xf140('0x2')]},'messageId':{'type':Sequelize[_0xf140('0x2')]},'inReplyTo':{'type':Sequelize[_0xf140('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xf140('0x2')]},'to':{'type':Sequelize[_0xf140('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xf140('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xf140('0x6')]},'status':{'type':Sequelize['ENUM'](_0xf140('0x7'),_0xf140('0x8'),_0xf140('0x9'),_0xf140('0xa'))},'url':{'type':Sequelize[_0xf140('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xf140('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index ecb355c..8dbf545 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 _0x11ac=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','IntegrationReport','rawAttributes','model','dateStart','query','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','day','where','filter','merge','map','options','includeAll','include','rows','show','params','keys','find','catch','create','body','describe','html-pdf','eml-format'];(function(_0x4ccd84,_0x25ff58){var _0x48b2e9=function(_0x3d9b8f){while(--_0x3d9b8f){_0x4ccd84['push'](_0x4ccd84['shift']());}};_0x48b2e9(++_0x25ff58);}(_0x11ac,0x8a));var _0xc11a=function(_0x330702,_0x6f0230){_0x330702=_0x330702-0x0;var _0x23c84b=_0x11ac[_0x330702];return _0x23c84b;};'use strict';var pdf=require(_0xc11a('0x0'));var emlformat=require(_0xc11a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc11a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc11a('0x3'));var moment=require(_0xc11a('0x4'));var BPromise=require(_0xc11a('0x5'));var Mustache=require(_0xc11a('0x6'));var util=require(_0xc11a('0x7'));var path=require(_0xc11a('0x8'));var sox=require(_0xc11a('0x9'));var csv=require(_0xc11a('0xa'));var ejs=require(_0xc11a('0xb'));var fs=require('fs');var _=require(_0xc11a('0xc'));var squel=require(_0xc11a('0xd'));var crypto=require('crypto');var jsforce=require(_0xc11a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc11a('0xa'));var querystring=require(_0xc11a('0xf'));var Papa=require('papaparse');var Redis=require(_0xc11a('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xc11a('0x11'))(_0xc11a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc11a('0x13'))['db'];function respondWithStatusCode(_0xdbc78c,_0x50a159){_0x50a159=_0x50a159||0xcc;return function(_0x5d5187){if(_0x5d5187){return _0xdbc78c['sendStatus'](_0x50a159);}return _0xdbc78c[_0xc11a('0x14')](_0x50a159)[_0xc11a('0x15')]();};}function respondWithResult(_0x53f58b,_0x16215d){_0x16215d=_0x16215d||0xc8;return function(_0x1238a3){if(_0x1238a3){return _0x53f58b[_0xc11a('0x14')](_0x16215d)[_0xc11a('0x16')](_0x1238a3);}};}function respondWithFilteredResult(_0x30ff06,_0x1b43c9){return function(_0x56992c){if(_0x56992c){var _0x3e6ad0=_0x56992c[_0xc11a('0x17')],_0x238da2=_0x1b43c9['offset'],_0x22b4b8=_0x1b43c9[_0xc11a('0x18')]+_0x1b43c9[_0xc11a('0x19')],_0x4b1b3c;if(_0x22b4b8>=_0x3e6ad0){_0x22b4b8=_0x3e6ad0;_0x4b1b3c=0xc8;}else{_0x4b1b3c=0xce;}_0x30ff06[_0xc11a('0x14')](_0x4b1b3c);return _0x30ff06[_0xc11a('0x1a')](_0xc11a('0x1b'),_0x238da2+'-'+_0x22b4b8+'/'+_0x3e6ad0)[_0xc11a('0x16')](_0x56992c);}return null;};}function patchUpdates(_0x4d6577){return function(_0x11b03d){try{jsonpatch[_0xc11a('0x1c')](_0x11b03d,_0x4d6577,!![]);}catch(_0x5db9f7){return BPromise[_0xc11a('0x1d')](_0x5db9f7);}return _0x11b03d[_0xc11a('0x1e')]();};}function saveUpdates(_0x5efee6,_0x3f16a2){return function(_0x170ee9){if(_0x170ee9){return _0x170ee9[_0xc11a('0x1f')](_0x5efee6)[_0xc11a('0x20')](function(_0x3e6dce){return _0x3e6dce;});}return null;};}function removeEntity(_0x2e620a,_0x6c4597){return function(_0x2284bf){if(_0x2284bf){return _0x2284bf[_0xc11a('0x21')]()[_0xc11a('0x20')](function(){_0x2e620a[_0xc11a('0x14')](0xcc)[_0xc11a('0x15')]();});}};}function handleEntityNotFound(_0xbce604,_0x4e8714){return function(_0x1d6e7a){if(!_0x1d6e7a){_0xbce604['sendStatus'](0x194);}return _0x1d6e7a;};}function handleError(_0x2ab036,_0x6b00cb){_0x6b00cb=_0x6b00cb||0x1f4;return function(_0x2bd1a6){logger[_0xc11a('0x22')](_0x2bd1a6['stack']);if(_0x2bd1a6[_0xc11a('0x23')]){delete _0x2bd1a6[_0xc11a('0x23')];}_0x2ab036['status'](_0x6b00cb)[_0xc11a('0x24')](_0x2bd1a6);};}exports[_0xc11a('0x25')]=function(_0x59a49c,_0x9fecd7){var _0x2424a4={},_0x48e221={},_0x333300={'count':0x0,'rows':[]};var _0x296be2=db[_0xc11a('0x26')][_0xc11a('0x27')];_0x48e221[_0xc11a('0x28')]=_['keys'](_0x296be2);var _0x1beea2={'dateStart':_0x59a49c['query'][_0xc11a('0x29')],'dateEnd':_0x59a49c[_0xc11a('0x2a')][_0xc11a('0x2b')]};delete _0x59a49c[_0xc11a('0x2a')][_0xc11a('0x29')];delete _0x59a49c[_0xc11a('0x2a')]['dateEnd'];_0x48e221[_0xc11a('0x2a')]=_['keys'](_0x59a49c[_0xc11a('0x2a')]);_0x48e221['filters']=_[_0xc11a('0x2c')](_0x48e221[_0xc11a('0x28')],_0x48e221[_0xc11a('0x2a')]);_0x2424a4[_0xc11a('0x2d')]=_[_0xc11a('0x2c')](_0x48e221[_0xc11a('0x28')],qs[_0xc11a('0x2e')](_0x59a49c[_0xc11a('0x2a')][_0xc11a('0x2e')]));_0x2424a4[_0xc11a('0x2d')]=_0x2424a4[_0xc11a('0x2d')][_0xc11a('0x2f')]?_0x2424a4[_0xc11a('0x2d')]:_0x48e221['model'];if(!_0x59a49c[_0xc11a('0x2a')][_0xc11a('0x30')](_0xc11a('0x31'))){_0x2424a4[_0xc11a('0x19')]=qs[_0xc11a('0x19')](_0x59a49c[_0xc11a('0x2a')]['limit']);_0x2424a4[_0xc11a('0x18')]=qs[_0xc11a('0x18')](_0x59a49c[_0xc11a('0x2a')][_0xc11a('0x18')]);}_0x2424a4[_0xc11a('0x32')]=qs[_0xc11a('0x33')](_0x59a49c['query'][_0xc11a('0x33')]);_0x2424a4['where']=qs[_0xc11a('0x34')](_['pick'](_0x59a49c[_0xc11a('0x2a')],_0x48e221[_0xc11a('0x34')]));if(_0x1beea2[_0xc11a('0x29')]){if(_0x1beea2[_0xc11a('0x2b')]){_0x1beea2[_0xc11a('0x2b')]=moment(_0x1beea2[_0xc11a('0x2b')])['add'](0x1,'day');}else{_0x1beea2[_0xc11a('0x2b')]=moment(_0x1beea2[_0xc11a('0x29')])['add'](0x1,_0xc11a('0x35'));}_['merge'](_0x2424a4[_0xc11a('0x36')],{'createdAt':{'$gte':_0x1beea2['dateStart'],'$lte':_0x1beea2[_0xc11a('0x2b')]}});}if(_0x59a49c[_0xc11a('0x2a')][_0xc11a('0x37')]){_0x2424a4[_0xc11a('0x36')]=_[_0xc11a('0x38')](_0x2424a4[_0xc11a('0x36')],{'$or':_[_0xc11a('0x39')](_0x2424a4[_0xc11a('0x2d')],function(_0x50328f){var _0x4d9da9={};_0x4d9da9[_0x50328f]={'$like':'%'+_0x59a49c[_0xc11a('0x2a')][_0xc11a('0x37')]+'%'};return _0x4d9da9;})});}_0x2424a4=_[_0xc11a('0x38')]({},_0x2424a4,_0x59a49c[_0xc11a('0x3a')]);var _0x5570c6={'where':_0x2424a4[_0xc11a('0x36')]};return db['IntegrationReport']['count'](_0x5570c6)['then'](function(_0x405954){_0x333300[_0xc11a('0x17')]=_0x405954;if(_0x59a49c[_0xc11a('0x2a')][_0xc11a('0x3b')]){_0x2424a4[_0xc11a('0x3c')]=[{'all':!![]}];}return db[_0xc11a('0x26')]['findAll'](_0x2424a4);})[_0xc11a('0x20')](function(_0x851817){_0x333300[_0xc11a('0x3d')]=_0x851817;return _0x333300;})[_0xc11a('0x20')](respondWithFilteredResult(_0x9fecd7,_0x2424a4))['catch'](handleError(_0x9fecd7,null));};exports[_0xc11a('0x3e')]=function(_0x2b26d1,_0x29136e){var _0x33704f={'raw':![],'where':{'id':_0x2b26d1[_0xc11a('0x3f')]['id']}},_0x4d5838={};_0x4d5838[_0xc11a('0x28')]=_[_0xc11a('0x40')](db['IntegrationReport'][_0xc11a('0x27')]);_0x4d5838['query']=_['keys'](_0x2b26d1[_0xc11a('0x2a')]);_0x4d5838[_0xc11a('0x34')]=_[_0xc11a('0x2c')](_0x4d5838['model'],_0x4d5838[_0xc11a('0x2a')]);_0x33704f['attributes']=_[_0xc11a('0x2c')](_0x4d5838['model'],qs[_0xc11a('0x2e')](_0x2b26d1[_0xc11a('0x2a')][_0xc11a('0x2e')]));_0x33704f[_0xc11a('0x2d')]=_0x33704f['attributes']['length']?_0x33704f[_0xc11a('0x2d')]:_0x4d5838['model'];if(_0x2b26d1['query'][_0xc11a('0x3b')]){_0x33704f[_0xc11a('0x3c')]=[{'all':!![]}];}_0x33704f=_[_0xc11a('0x38')]({},_0x33704f,_0x2b26d1['options']);return db[_0xc11a('0x26')][_0xc11a('0x41')](_0x33704f)['then'](handleEntityNotFound(_0x29136e,null))[_0xc11a('0x20')](respondWithResult(_0x29136e,null))[_0xc11a('0x42')](handleError(_0x29136e,null));};exports[_0xc11a('0x43')]=function(_0x24b25f,_0x4ae4c3){return db['IntegrationReport'][_0xc11a('0x43')](_0x24b25f['body'],{})[_0xc11a('0x20')](respondWithResult(_0x4ae4c3,0xc9))[_0xc11a('0x42')](handleError(_0x4ae4c3,null));};exports[_0xc11a('0x1f')]=function(_0x2b5851,_0x427805){if(_0x2b5851[_0xc11a('0x44')]['id']){delete _0x2b5851[_0xc11a('0x44')]['id'];}return db[_0xc11a('0x26')][_0xc11a('0x41')]({'where':{'id':_0x2b5851[_0xc11a('0x3f')]['id']}})[_0xc11a('0x20')](handleEntityNotFound(_0x427805,null))[_0xc11a('0x20')](saveUpdates(_0x2b5851['body'],null))[_0xc11a('0x20')](respondWithResult(_0x427805,null))[_0xc11a('0x42')](handleError(_0x427805,null));};exports['destroy']=function(_0x270c70,_0xe92d02){return db[_0xc11a('0x26')][_0xc11a('0x41')]({'where':{'id':_0x270c70['params']['id']}})[_0xc11a('0x20')](handleEntityNotFound(_0xe92d02,null))[_0xc11a('0x20')](removeEntity(_0xe92d02,null))[_0xc11a('0x42')](handleError(_0xe92d02,null));};exports['describe']=function(_0x2612c5,_0x14d21f){return db['IntegrationReport'][_0xc11a('0x45')]()[_0xc11a('0x20')](respondWithResult(_0x14d21f,null))[_0xc11a('0x42')](handleError(_0x14d21f,null));}; \ No newline at end of file +var _0xfabe=['desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','IntegrationReport','rawAttributes','keys','query','dateStart','dateEnd','filters','attributes','model','fields','length','order','sort','pick','add','day','merge','where','filter','map','options','includeAll','include','findAll','catch','show','intersection','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','jsforce'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfabe,0x1eb));var _0xefab=function(_0x4d70ca,_0x513560){_0x4d70ca=_0x4d70ca-0x0;var _0x1f9040=_0xfabe[_0x4d70ca];return _0x1f9040;};'use strict';var pdf=require(_0xefab('0x0'));var emlformat=require(_0xefab('0x1'));var rimraf=require(_0xefab('0x2'));var zipdir=require(_0xefab('0x3'));var jsonpatch=require(_0xefab('0x4'));var rp=require(_0xefab('0x5'));var moment=require('moment');var BPromise=require(_0xefab('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xefab('0x7'));var sox=require(_0xefab('0x8'));var csv=require(_0xefab('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xefab('0xa'));var squel=require(_0xefab('0xb'));var crypto=require('crypto');var jsforce=require(_0xefab('0xc'));var deskjs=require(_0xefab('0xd'));var toCsv=require(_0xefab('0x9'));var querystring=require('querystring');var Papa=require(_0xefab('0xe'));var Redis=require(_0xefab('0xf'));var qs=require(_0xefab('0x10'));var logger=require('../../config/logger')(_0xefab('0x11'));var utils=require(_0xefab('0x12'));var config=require(_0xefab('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f0d5d,_0x114d6f){_0x114d6f=_0x114d6f||0xcc;return function(_0x5e8cb5){if(_0x5e8cb5){return _0x1f0d5d['sendStatus'](_0x114d6f);}return _0x1f0d5d[_0xefab('0x14')](_0x114d6f)['end']();};}function respondWithResult(_0x427120,_0x526238){_0x526238=_0x526238||0xc8;return function(_0xea5408){if(_0xea5408){return _0x427120[_0xefab('0x14')](_0x526238)[_0xefab('0x15')](_0xea5408);}};}function respondWithFilteredResult(_0x1221ca,_0x143b90){return function(_0x42db76){if(_0x42db76){var _0x2ac1b9=_0x42db76[_0xefab('0x16')],_0x25cb38=_0x143b90['offset'],_0x1df515=_0x143b90[_0xefab('0x17')]+_0x143b90[_0xefab('0x18')],_0x34806;if(_0x1df515>=_0x2ac1b9){_0x1df515=_0x2ac1b9;_0x34806=0xc8;}else{_0x34806=0xce;}_0x1221ca[_0xefab('0x14')](_0x34806);return _0x1221ca[_0xefab('0x19')](_0xefab('0x1a'),_0x25cb38+'-'+_0x1df515+'/'+_0x2ac1b9)[_0xefab('0x15')](_0x42db76);}return null;};}function patchUpdates(_0x1934de){return function(_0x660f8e){try{jsonpatch[_0xefab('0x1b')](_0x660f8e,_0x1934de,!![]);}catch(_0x5a69ae){return BPromise[_0xefab('0x1c')](_0x5a69ae);}return _0x660f8e[_0xefab('0x1d')]();};}function saveUpdates(_0x47dc36,_0x258edb){return function(_0x219c9b){if(_0x219c9b){return _0x219c9b[_0xefab('0x1e')](_0x47dc36)[_0xefab('0x1f')](function(_0x367dc2){return _0x367dc2;});}return null;};}function removeEntity(_0xc4d7b3,_0x4d140d){return function(_0x3dd709){if(_0x3dd709){return _0x3dd709[_0xefab('0x20')]()['then'](function(){_0xc4d7b3[_0xefab('0x14')](0xcc)[_0xefab('0x21')]();});}};}function handleEntityNotFound(_0x3d303d,_0x48d683){return function(_0x469c18){if(!_0x469c18){_0x3d303d[_0xefab('0x22')](0x194);}return _0x469c18;};}function handleError(_0x423c3b,_0xd009d7){_0xd009d7=_0xd009d7||0x1f4;return function(_0x5a5908){logger[_0xefab('0x23')](_0x5a5908[_0xefab('0x24')]);if(_0x5a5908[_0xefab('0x25')]){delete _0x5a5908[_0xefab('0x25')];}_0x423c3b['status'](_0xd009d7)[_0xefab('0x26')](_0x5a5908);};}exports[_0xefab('0x27')]=function(_0x2e1827,_0x28ece9){var _0xa78144={},_0x279d69={},_0x70ccf2={'count':0x0,'rows':[]};var _0xc0c520=db[_0xefab('0x28')][_0xefab('0x29')];_0x279d69['model']=_[_0xefab('0x2a')](_0xc0c520);var _0x16e08b={'dateStart':_0x2e1827[_0xefab('0x2b')][_0xefab('0x2c')],'dateEnd':_0x2e1827[_0xefab('0x2b')][_0xefab('0x2d')]};delete _0x2e1827['query']['dateStart'];delete _0x2e1827[_0xefab('0x2b')][_0xefab('0x2d')];_0x279d69[_0xefab('0x2b')]=_['keys'](_0x2e1827['query']);_0x279d69[_0xefab('0x2e')]=_['intersection'](_0x279d69['model'],_0x279d69[_0xefab('0x2b')]);_0xa78144[_0xefab('0x2f')]=_['intersection'](_0x279d69[_0xefab('0x30')],qs[_0xefab('0x31')](_0x2e1827[_0xefab('0x2b')]['fields']));_0xa78144[_0xefab('0x2f')]=_0xa78144['attributes'][_0xefab('0x32')]?_0xa78144[_0xefab('0x2f')]:_0x279d69[_0xefab('0x30')];if(!_0x2e1827[_0xefab('0x2b')]['hasOwnProperty']('nolimit')){_0xa78144['limit']=qs['limit'](_0x2e1827[_0xefab('0x2b')][_0xefab('0x18')]);_0xa78144[_0xefab('0x17')]=qs[_0xefab('0x17')](_0x2e1827['query'][_0xefab('0x17')]);}_0xa78144[_0xefab('0x33')]=qs['sort'](_0x2e1827['query'][_0xefab('0x34')]);_0xa78144['where']=qs[_0xefab('0x2e')](_[_0xefab('0x35')](_0x2e1827[_0xefab('0x2b')],_0x279d69[_0xefab('0x2e')]));if(_0x16e08b[_0xefab('0x2c')]){if(_0x16e08b[_0xefab('0x2d')]){_0x16e08b[_0xefab('0x2d')]=moment(_0x16e08b[_0xefab('0x2d')])[_0xefab('0x36')](0x1,'day');}else{_0x16e08b[_0xefab('0x2d')]=moment(_0x16e08b[_0xefab('0x2c')])[_0xefab('0x36')](0x1,_0xefab('0x37'));}_[_0xefab('0x38')](_0xa78144[_0xefab('0x39')],{'createdAt':{'$gte':_0x16e08b[_0xefab('0x2c')],'$lte':_0x16e08b['dateEnd']}});}if(_0x2e1827['query'][_0xefab('0x3a')]){_0xa78144[_0xefab('0x39')]=_[_0xefab('0x38')](_0xa78144['where'],{'$or':_[_0xefab('0x3b')](_0xa78144[_0xefab('0x2f')],function(_0x463a0a){var _0x414c24={};_0x414c24[_0x463a0a]={'$like':'%'+_0x2e1827[_0xefab('0x2b')][_0xefab('0x3a')]+'%'};return _0x414c24;})});}_0xa78144=_['merge']({},_0xa78144,_0x2e1827[_0xefab('0x3c')]);var _0xe01abd={'where':_0xa78144['where']};return db[_0xefab('0x28')]['count'](_0xe01abd)[_0xefab('0x1f')](function(_0x31a8d8){_0x70ccf2[_0xefab('0x16')]=_0x31a8d8;if(_0x2e1827[_0xefab('0x2b')][_0xefab('0x3d')]){_0xa78144[_0xefab('0x3e')]=[{'all':!![]}];}return db[_0xefab('0x28')][_0xefab('0x3f')](_0xa78144);})[_0xefab('0x1f')](function(_0x254c95){_0x70ccf2['rows']=_0x254c95;return _0x70ccf2;})[_0xefab('0x1f')](respondWithFilteredResult(_0x28ece9,_0xa78144))[_0xefab('0x40')](handleError(_0x28ece9,null));};exports[_0xefab('0x41')]=function(_0x3168d7,_0x186100){var _0xb6df6f={'raw':![],'where':{'id':_0x3168d7['params']['id']}},_0x2d4754={};_0x2d4754[_0xefab('0x30')]=_['keys'](db[_0xefab('0x28')]['rawAttributes']);_0x2d4754['query']=_[_0xefab('0x2a')](_0x3168d7[_0xefab('0x2b')]);_0x2d4754[_0xefab('0x2e')]=_[_0xefab('0x42')](_0x2d4754[_0xefab('0x30')],_0x2d4754['query']);_0xb6df6f[_0xefab('0x2f')]=_['intersection'](_0x2d4754[_0xefab('0x30')],qs[_0xefab('0x31')](_0x3168d7[_0xefab('0x2b')][_0xefab('0x31')]));_0xb6df6f['attributes']=_0xb6df6f[_0xefab('0x2f')][_0xefab('0x32')]?_0xb6df6f[_0xefab('0x2f')]:_0x2d4754[_0xefab('0x30')];if(_0x3168d7[_0xefab('0x2b')][_0xefab('0x3d')]){_0xb6df6f[_0xefab('0x3e')]=[{'all':!![]}];}_0xb6df6f=_[_0xefab('0x38')]({},_0xb6df6f,_0x3168d7['options']);return db[_0xefab('0x28')]['find'](_0xb6df6f)[_0xefab('0x1f')](handleEntityNotFound(_0x186100,null))[_0xefab('0x1f')](respondWithResult(_0x186100,null))['catch'](handleError(_0x186100,null));};exports['create']=function(_0x2848a1,_0x57167e){return db['IntegrationReport'][_0xefab('0x43')](_0x2848a1['body'],{})[_0xefab('0x1f')](respondWithResult(_0x57167e,0xc9))[_0xefab('0x40')](handleError(_0x57167e,null));};exports[_0xefab('0x1e')]=function(_0x441f0c,_0x529879){if(_0x441f0c[_0xefab('0x44')]['id']){delete _0x441f0c['body']['id'];}return db[_0xefab('0x28')][_0xefab('0x45')]({'where':{'id':_0x441f0c[_0xefab('0x46')]['id']}})[_0xefab('0x1f')](handleEntityNotFound(_0x529879,null))['then'](saveUpdates(_0x441f0c['body'],null))[_0xefab('0x1f')](respondWithResult(_0x529879,null))[_0xefab('0x40')](handleError(_0x529879,null));};exports[_0xefab('0x20')]=function(_0xdc192e,_0x4dbb2f){return db[_0xefab('0x28')]['find']({'where':{'id':_0xdc192e['params']['id']}})['then'](handleEntityNotFound(_0x4dbb2f,null))['then'](removeEntity(_0x4dbb2f,null))[_0xefab('0x40')](handleError(_0x4dbb2f,null));};exports[_0xefab('0x47')]=function(_0x51153c,_0x26229c){return db[_0xefab('0x28')][_0xefab('0x47')]()[_0xefab('0x1f')](respondWithResult(_0x26229c,null))[_0xefab('0x40')](handleError(_0x26229c,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index da3cc62..170974c 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 _0xc7a3=['../../config/logger','api','moment','bluebird','request-promise','exports','define','IntegrationReport','report_integration','util'];(function(_0x56c7c0,_0x463d97){var _0x666b9a=function(_0x56e4a5){while(--_0x56e4a5){_0x56c7c0['push'](_0x56c7c0['shift']());}};_0x666b9a(++_0x463d97);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x182ba6,_0x4e11b1){_0x182ba6=_0x182ba6-0x0;var _0x3f4068=_0xc7a3[_0x182ba6];return _0x3f4068;};'use strict';var _=require('lodash');var util=require(_0x3c7a('0x0'));var logger=require(_0x3c7a('0x1'))(_0x3c7a('0x2'));var moment=require(_0x3c7a('0x3'));var BPromise=require(_0x3c7a('0x4'));var rp=require(_0x3c7a('0x5'));var attributes=require('./integrationReport.attributes');module[_0x3c7a('0x6')]=function(_0x3e1c47,_0x5b06db){return _0x3e1c47[_0x3c7a('0x7')](_0x3c7a('0x8'),attributes,{'tableName':_0x3c7a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc949=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird'];(function(_0x439e36,_0x7ddcf){var _0x43252b=function(_0x48d72a){while(--_0x48d72a){_0x439e36['push'](_0x439e36['shift']());}};_0x43252b(++_0x7ddcf);}(_0xc949,0x181));var _0x9c94=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc949[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x9c94('0x0'));var util=require('util');var logger=require(_0x9c94('0x1'))(_0x9c94('0x2'));var moment=require(_0x9c94('0x3'));var BPromise=require(_0x9c94('0x4'));var rp=require('request-promise');var attributes=require(_0x9c94('0x5'));module[_0x9c94('0x6')]=function(_0x528a17,_0x405fe2){return _0x528a17[_0x9c94('0x7')](_0x9c94('0x8'),attributes,{'tableName':_0x9c94('0x9'),'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 e055844..fcfe00a 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 _0xc774=['error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x176308,_0x5b4d58){var _0x545160=function(_0x3a52a3){while(--_0x3a52a3){_0x176308['push'](_0x176308['shift']());}};_0x545160(++_0x5b4d58);}(_0xc774,0x166));var _0x4c77=function(_0x33231e,_0x442180){_0x33231e=_0x33231e-0x0;var _0x2d017b=_0xc774[_0x33231e];return _0x2d017b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c77('0x0'));var BPromise=require(_0x4c77('0x1'));var rs=require(_0x4c77('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c77('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c77('0x4'))(_0x4c77('0x5'));var config=require(_0x4c77('0x6'));var jayson=require(_0x4c77('0x7'));var client=jayson[_0x4c77('0x8')][_0x4c77('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bb305,_0x5ce3f4,_0x395794){return new BPromise(function(_0x3d1de8,_0x4dbeb0){return client[_0x4c77('0xa')](_0x2bb305,_0x395794)['then'](function(_0x3edd51){logger[_0x4c77('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x5ce3f4,_0x4c77('0xc'));logger[_0x4c77('0xd')](_0x4c77('0xe'),_0x5ce3f4,_0x4c77('0xc'),JSON[_0x4c77('0xf')](_0x3edd51));if(_0x3edd51[_0x4c77('0x10')]){if(_0x3edd51['error'][_0x4c77('0x11')]===0x1f4){logger[_0x4c77('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x5ce3f4,_0x3edd51[_0x4c77('0x10')][_0x4c77('0x12')]);return _0x4dbeb0(_0x3edd51[_0x4c77('0x10')][_0x4c77('0x12')]);}logger[_0x4c77('0x10')](_0x4c77('0x13'),_0x5ce3f4,_0x3edd51[_0x4c77('0x10')]['message']);return _0x3d1de8(_0x3edd51[_0x4c77('0x10')]['message']);}else{logger[_0x4c77('0xb')](_0x4c77('0x13'),_0x5ce3f4,'request\x20sent');_0x3d1de8(_0x3edd51[_0x4c77('0x14')][_0x4c77('0x12')]);}})[_0x4c77('0x15')](function(_0x547891){logger['error'](_0x4c77('0x13'),_0x5ce3f4,_0x547891);_0x4dbeb0(_0x547891);});});} \ No newline at end of file +var _0x1862=['request\x20sent','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','IntegrationReport,\x20%s,\x20%s,\x20%s'];(function(_0x19a9e7,_0x44d70c){var _0x230a00=function(_0x29fb1f){while(--_0x29fb1f){_0x19a9e7['push'](_0x19a9e7['shift']());}};_0x230a00(++_0x44d70c);}(_0x1862,0x91));var _0x2186=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1862[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2186('0x0'));var util=require(_0x2186('0x1'));var moment=require('moment');var BPromise=require(_0x2186('0x2'));var rs=require(_0x2186('0x3'));var fs=require('fs');var Redis=require(_0x2186('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2186('0x5'))(_0x2186('0x6'));var config=require(_0x2186('0x7'));var jayson=require(_0x2186('0x8'));var client=jayson[_0x2186('0x9')][_0x2186('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35e39d,_0x480007,_0x4e7b3f){return new BPromise(function(_0x5160eb,_0x1eb807){return client[_0x2186('0xb')](_0x35e39d,_0x4e7b3f)[_0x2186('0xc')](function(_0x579634){logger[_0x2186('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x480007,'request\x20sent');logger[_0x2186('0xe')](_0x2186('0xf'),_0x480007,_0x2186('0x10'),JSON[_0x2186('0x11')](_0x579634));if(_0x579634['error']){if(_0x579634[_0x2186('0x12')][_0x2186('0x13')]===0x1f4){logger[_0x2186('0x12')](_0x2186('0x14'),_0x480007,_0x579634['error'][_0x2186('0x15')]);return _0x1eb807(_0x579634[_0x2186('0x12')][_0x2186('0x15')]);}logger[_0x2186('0x12')](_0x2186('0x14'),_0x480007,_0x579634[_0x2186('0x12')]['message']);return _0x5160eb(_0x579634[_0x2186('0x12')][_0x2186('0x15')]);}else{logger[_0x2186('0xd')](_0x2186('0x14'),_0x480007,_0x2186('0x10'));_0x5160eb(_0x579634[_0x2186('0x16')][_0x2186('0x15')]);}})['catch'](function(_0x2e7b5e){logger[_0x2186('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x480007,_0x2e7b5e);_0x1eb807(_0x2e7b5e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1add03b..3d7c3ee 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 _0xde4d=['create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','isAuthenticated','get','show','/:id/sub_intervals','post'];(function(_0x4487d0,_0x24d772){var _0x1fa825=function(_0x55e7d0){while(--_0x55e7d0){_0x4487d0['push'](_0x4487d0['shift']());}};_0x1fa825(++_0x24d772);}(_0xde4d,0xf1));var _0xdde4=function(_0x4c7bbd,_0x5617f9){_0x4c7bbd=_0x4c7bbd-0x0;var _0x38e260=_0xde4d[_0x4c7bbd];return _0x38e260;};'use strict';var multer=require(_0xdde4('0x0'));var util=require(_0xdde4('0x1'));var path=require(_0xdde4('0x2'));var timeout=require(_0xdde4('0x3'));var express=require(_0xdde4('0x4'));var router=express[_0xdde4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./interval.controller');router['get']('/',auth[_0xdde4('0x6')](),controller['index']);router[_0xdde4('0x7')]('/:id',auth[_0xdde4('0x6')](),controller[_0xdde4('0x8')]);router[_0xdde4('0x7')](_0xdde4('0x9'),auth[_0xdde4('0x6')](),controller['getIntervals']);router[_0xdde4('0xa')]('/',auth['isAuthenticated'](),controller[_0xdde4('0xb')]);router[_0xdde4('0xa')](_0xdde4('0x9'),auth[_0xdde4('0x6')](),controller[_0xdde4('0xc')]);router['post'](_0xdde4('0xd'),auth['isAuthenticated'](),controller[_0xdde4('0xe')]);router[_0xdde4('0xf')](_0xdde4('0x10'),auth[_0xdde4('0x6')](),controller[_0xdde4('0x11')]);router[_0xdde4('0x12')](_0xdde4('0x10'),auth[_0xdde4('0x6')](),controller[_0xdde4('0x13')]);module[_0xdde4('0x14')]=router; \ No newline at end of file +var _0x3ce9=['show','getIntervals','post','put','/:id','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index'];(function(_0x45e351,_0x234f5d){var _0x32453b=function(_0x16c8a5){while(--_0x16c8a5){_0x45e351['push'](_0x45e351['shift']());}};_0x32453b(++_0x234f5d);}(_0x3ce9,0x85));var _0x93ce=function(_0x11e4f0,_0x23750b){_0x11e4f0=_0x11e4f0-0x0;var _0x504bbb=_0x3ce9[_0x11e4f0];return _0x504bbb;};'use strict';var multer=require(_0x93ce('0x0'));var util=require('util');var path=require(_0x93ce('0x1'));var timeout=require(_0x93ce('0x2'));var express=require(_0x93ce('0x3'));var router=express[_0x93ce('0x4')]();var auth=require(_0x93ce('0x5'));var interaction=require(_0x93ce('0x6'));var config=require('../../config/environment');var controller=require(_0x93ce('0x7'));router[_0x93ce('0x8')]('/',auth[_0x93ce('0x9')](),controller[_0x93ce('0xa')]);router[_0x93ce('0x8')]('/:id',auth[_0x93ce('0x9')](),controller[_0x93ce('0xb')]);router['get']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x93ce('0xc')]);router['post']('/',auth[_0x93ce('0x9')](),controller['create']);router[_0x93ce('0xd')]('/:id/sub_intervals',auth[_0x93ce('0x9')](),controller['addInterval']);router['post']('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller['addIntervals']);router[_0x93ce('0xe')](_0x93ce('0xf'),auth[_0x93ce('0x9')](),controller['update']);router[_0x93ce('0x10')]('/:id',auth[_0x93ce('0x9')](),controller[_0x93ce('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 91f2833..e42a6fb 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 _0xf01c=['sequelize','exports','STRING'];(function(_0x568de5,_0x124beb){var _0x3043c9=function(_0x9fe3b7){while(--_0x9fe3b7){_0x568de5['push'](_0x568de5['shift']());}};_0x3043c9(++_0x124beb);}(_0xf01c,0x165));var _0xcf01=function(_0x3d29db,_0x418bec){_0x3d29db=_0x3d29db-0x0;var _0x492f1=_0xf01c[_0x3d29db];return _0x492f1;};'use strict';var Sequelize=require(_0xcf01('0x0'));module[_0xcf01('0x1')]={'name':{'type':Sequelize[_0xcf01('0x2')]},'description':{'type':Sequelize[_0xcf01('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x3ec3=['STRING','sequelize','exports'];(function(_0x5d3c2f,_0x30ab41){var _0x4f0dd8=function(_0x58cc22){while(--_0x58cc22){_0x5d3c2f['push'](_0x5d3c2f['shift']());}};_0x4f0dd8(++_0x30ab41);}(_0x3ec3,0x148));var _0x33ec=function(_0x4c6cf1,_0x453d0d){_0x4c6cf1=_0x4c6cf1-0x0;var _0x56e813=_0x3ec3[_0x4c6cf1];return _0x56e813;};'use strict';var Sequelize=require(_0x33ec('0x0'));module[_0x33ec('0x1')]={'name':{'type':Sequelize[_0x33ec('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x33ec('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 50722d8..8139d4a 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 _0x0e16=['sendStatus','error','name','index','Interval','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','order','where','pick','add','day','filter','map','merge','options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','IntervalId','findOne','length','getIntervals','addIntervals','sequelize','transaction','bulkCreate','findAll','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/parsers/qs','../../config/environment','../../mysqldb','../../components/extensions/rewrite','end','status','json','count','offset','limit','set','Content-Range','then','destroy','get','Intervals','UserProfileResource'];(function(_0x41595b,_0x510bfa){var _0xa0f49e=function(_0x80f397){while(--_0x80f397){_0x41595b['push'](_0x41595b['shift']());}};_0xa0f49e(++_0x510bfa);}(_0x0e16,0x1bc));var _0x60e1=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x0e16[_0x376b45];return _0x2341b3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x60e1('0x0'));var rp=require(_0x60e1('0x1'));var moment=require(_0x60e1('0x2'));var BPromise=require(_0x60e1('0x3'));var Mustache=require('mustache');var util=require(_0x60e1('0x4'));var path=require(_0x60e1('0x5'));var sox=require(_0x60e1('0x6'));var csv=require(_0x60e1('0x7'));var ejs=require(_0x60e1('0x8'));var fs=require('fs');var _=require(_0x60e1('0x9'));var squel=require('squel');var crypto=require(_0x60e1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x60e1('0x7'));var querystring=require(_0x60e1('0xb'));var Papa=require(_0x60e1('0xc'));var Redis=require('ioredis');var qs=require(_0x60e1('0xd'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x60e1('0xe'));var db=require(_0x60e1('0xf'))['db'];var extensions=require(_0x60e1('0x10'));function respondWithStatusCode(_0x55cb4a,_0x3b837a){_0x3b837a=_0x3b837a||0xcc;return function(_0x3fbe28){if(_0x3fbe28){return _0x55cb4a['sendStatus'](_0x3b837a);}return _0x55cb4a['status'](_0x3b837a)[_0x60e1('0x11')]();};}function respondWithResult(_0x196152,_0x58b25e){_0x58b25e=_0x58b25e||0xc8;return function(_0x1fb88d){if(_0x1fb88d){return _0x196152[_0x60e1('0x12')](_0x58b25e)[_0x60e1('0x13')](_0x1fb88d);}};}function respondWithFilteredResult(_0x3a2262,_0x530ecc){return function(_0x3df72f){if(_0x3df72f){var _0x5273c1=_0x3df72f[_0x60e1('0x14')],_0x1e3ccc=_0x530ecc['offset'],_0x540058=_0x530ecc[_0x60e1('0x15')]+_0x530ecc[_0x60e1('0x16')],_0x4883b3;if(_0x540058>=_0x5273c1){_0x540058=_0x5273c1;_0x4883b3=0xc8;}else{_0x4883b3=0xce;}_0x3a2262[_0x60e1('0x12')](_0x4883b3);return _0x3a2262[_0x60e1('0x17')](_0x60e1('0x18'),_0x1e3ccc+'-'+_0x540058+'/'+_0x5273c1)[_0x60e1('0x13')](_0x3df72f);}return null;};}function patchUpdates(_0x4b3d2c){return function(_0x1da31c){try{jsonpatch['apply'](_0x1da31c,_0x4b3d2c,!![]);}catch(_0x57ecda){return BPromise['reject'](_0x57ecda);}return _0x1da31c['save']();};}function saveUpdates(_0x3e0f9f,_0x247191){return function(_0x265761){if(_0x265761){return _0x265761['update'](_0x3e0f9f)[_0x60e1('0x19')](function(_0x2fac6f){return _0x2fac6f;});}return null;};}function removeEntity(_0x56d9fc,_0x4c6393){return function(_0x482f73){if(_0x482f73){return _0x482f73[_0x60e1('0x1a')]()[_0x60e1('0x19')](function(){var _0x436d6a=_0x482f73[_0x60e1('0x1b')]({'plain':!![]});var _0x55892c=_0x60e1('0x1c');return db[_0x60e1('0x1d')][_0x60e1('0x1a')]({'where':{'type':_0x55892c,'resourceId':_0x436d6a['id']}})[_0x60e1('0x19')](function(){return _0x482f73;});})['then'](function(){_0x56d9fc[_0x60e1('0x12')](0xcc)[_0x60e1('0x11')]();});}};}function handleEntityNotFound(_0x3b7776,_0x29c671){return function(_0xc80f4f){if(!_0xc80f4f){_0x3b7776[_0x60e1('0x1e')](0x194);}return _0xc80f4f;};}function handleError(_0x2fbed0,_0x4fbfd0){_0x4fbfd0=_0x4fbfd0||0x1f4;return function(_0x38106d){logger[_0x60e1('0x1f')](_0x38106d['stack']);if(_0x38106d['name']){delete _0x38106d[_0x60e1('0x20')];}_0x2fbed0['status'](_0x4fbfd0)['send'](_0x38106d);};}exports[_0x60e1('0x21')]=function(_0x3d55cf,_0x17f611){var _0x1721e1={},_0x2cc99b={},_0x58a48a={'count':0x0,'rows':[]};var _0x341db2=db[_0x60e1('0x22')][_0x60e1('0x23')];_0x2cc99b['model']=_[_0x60e1('0x24')](_0x341db2);var _0x5e56c1={'dateStart':_0x3d55cf[_0x60e1('0x25')][_0x60e1('0x26')],'dateEnd':_0x3d55cf[_0x60e1('0x25')][_0x60e1('0x27')]};delete _0x3d55cf[_0x60e1('0x25')][_0x60e1('0x26')];delete _0x3d55cf[_0x60e1('0x25')][_0x60e1('0x27')];_0x2cc99b['query']=_[_0x60e1('0x24')](_0x3d55cf['query']);_0x2cc99b[_0x60e1('0x28')]=_[_0x60e1('0x29')](_0x2cc99b[_0x60e1('0x2a')],_0x2cc99b[_0x60e1('0x25')]);_0x1721e1[_0x60e1('0x2b')]=_['intersection'](_0x2cc99b[_0x60e1('0x2a')],qs['fields'](_0x3d55cf[_0x60e1('0x25')][_0x60e1('0x2c')]));_0x1721e1['attributes']=_0x1721e1[_0x60e1('0x2b')]['length']?_0x1721e1['attributes']:_0x2cc99b[_0x60e1('0x2a')];if(!_0x3d55cf['query'][_0x60e1('0x2d')]('nolimit')){_0x1721e1[_0x60e1('0x16')]=qs[_0x60e1('0x16')](_0x3d55cf[_0x60e1('0x25')]['limit']);_0x1721e1[_0x60e1('0x15')]=qs[_0x60e1('0x15')](_0x3d55cf['query'][_0x60e1('0x15')]);}_0x1721e1[_0x60e1('0x2e')]=qs['sort'](_0x3d55cf[_0x60e1('0x25')]['sort']);_0x1721e1[_0x60e1('0x2f')]=qs[_0x60e1('0x28')](_[_0x60e1('0x30')](_0x3d55cf['query'],_0x2cc99b[_0x60e1('0x28')]));if(_0x5e56c1['dateStart']){if(_0x5e56c1[_0x60e1('0x27')]){_0x5e56c1[_0x60e1('0x27')]=moment(_0x5e56c1[_0x60e1('0x27')])[_0x60e1('0x31')](0x1,_0x60e1('0x32'));}else{_0x5e56c1['dateEnd']=moment(_0x5e56c1['dateStart'])[_0x60e1('0x31')](0x1,'day');}_['merge'](_0x1721e1['where'],{'createdAt':{'$gte':_0x5e56c1['dateStart'],'$lte':_0x5e56c1['dateEnd']}});}if(_0x3d55cf[_0x60e1('0x25')][_0x60e1('0x33')]){_0x1721e1[_0x60e1('0x2f')]=_['merge'](_0x1721e1[_0x60e1('0x2f')],{'$or':_[_0x60e1('0x34')](_0x1721e1[_0x60e1('0x2b')],function(_0x398dc5){var _0x2ede3e={};_0x2ede3e[_0x398dc5]={'$like':'%'+_0x3d55cf[_0x60e1('0x25')][_0x60e1('0x33')]+'%'};return _0x2ede3e;})});}_0x1721e1=_[_0x60e1('0x35')]({},_0x1721e1,_0x3d55cf[_0x60e1('0x36')]);var _0x4c61d5={'where':_0x1721e1['where']};return db['Interval'][_0x60e1('0x14')](_0x4c61d5)['then'](function(_0x6a2c15){_0x58a48a['count']=_0x6a2c15;if(_0x3d55cf[_0x60e1('0x25')][_0x60e1('0x37')]){_0x1721e1[_0x60e1('0x38')]=[{'all':!![]}];}return db[_0x60e1('0x22')]['findAll'](_0x1721e1);})[_0x60e1('0x19')](function(_0x1f5b19){_0x58a48a[_0x60e1('0x39')]=_0x1f5b19;return _0x58a48a;})[_0x60e1('0x19')](respondWithFilteredResult(_0x17f611,_0x1721e1))['catch'](handleError(_0x17f611,null));};exports[_0x60e1('0x3a')]=function(_0x458283,_0x1bf379){var _0x59d4a9={'raw':!![],'where':{'id':_0x458283[_0x60e1('0x3b')]['id']}},_0x2f8b87={};_0x2f8b87['model']=_[_0x60e1('0x24')](db[_0x60e1('0x22')][_0x60e1('0x23')]);_0x2f8b87[_0x60e1('0x25')]=_['keys'](_0x458283[_0x60e1('0x25')]);_0x2f8b87[_0x60e1('0x28')]=_[_0x60e1('0x29')](_0x2f8b87[_0x60e1('0x2a')],_0x2f8b87[_0x60e1('0x25')]);_0x59d4a9[_0x60e1('0x2b')]=_[_0x60e1('0x29')](_0x2f8b87[_0x60e1('0x2a')],qs[_0x60e1('0x2c')](_0x458283[_0x60e1('0x25')][_0x60e1('0x2c')]));_0x59d4a9['attributes']=_0x59d4a9[_0x60e1('0x2b')]['length']?_0x59d4a9[_0x60e1('0x2b')]:_0x2f8b87[_0x60e1('0x2a')];if(_0x458283['query'][_0x60e1('0x37')]){_0x59d4a9['include']=[{'all':!![]}];}_0x59d4a9=_[_0x60e1('0x35')]({},_0x59d4a9,_0x458283[_0x60e1('0x36')]);return db[_0x60e1('0x22')][_0x60e1('0x3c')](_0x59d4a9)[_0x60e1('0x19')](handleEntityNotFound(_0x1bf379,null))[_0x60e1('0x19')](respondWithResult(_0x1bf379,null))[_0x60e1('0x3d')](handleError(_0x1bf379,null));};exports[_0x60e1('0x3e')]=function(_0x4b6883,_0x1b6227){return db[_0x60e1('0x22')][_0x60e1('0x3e')](_0x4b6883[_0x60e1('0x3f')],{})[_0x60e1('0x19')](function(_0x46285f){var _0x3896e3=_0x4b6883[_0x60e1('0x40')][_0x60e1('0x1b')]({'plain':!![]});if(!_0x3896e3)throw new Error(_0x60e1('0x41'));if(_0x3896e3[_0x60e1('0x42')]===_0x60e1('0x40')){var _0x20b65f=_0x46285f[_0x60e1('0x1b')]({'plain':!![]});var _0x1f973f=_0x60e1('0x1c');return db['UserProfileSection'][_0x60e1('0x3c')]({'where':{'name':_0x1f973f,'userProfileId':_0x3896e3[_0x60e1('0x43')]},'raw':!![]})[_0x60e1('0x19')](function(_0x13e059){if(_0x13e059&&_0x13e059[_0x60e1('0x44')]===0x0){return db[_0x60e1('0x1d')]['create']({'name':_0x20b65f['name'],'resourceId':_0x20b65f['id'],'type':_0x13e059['name'],'sectionId':_0x13e059['id']},{})[_0x60e1('0x19')](function(){return _0x46285f;});}else{return _0x46285f;}})[_0x60e1('0x3d')](function(_0x482f7d){logger[_0x60e1('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x482f7d);throw _0x482f7d;});}return _0x46285f;})[_0x60e1('0x19')](respondWithResult(_0x1b6227,0xc9))['catch'](handleError(_0x1b6227,null));};exports[_0x60e1('0x45')]=function(_0x35531a,_0x5a26c4){if(_0x35531a[_0x60e1('0x3f')]['id']){delete _0x35531a['body']['id'];}return db[_0x60e1('0x22')]['find']({'where':{'id':_0x35531a[_0x60e1('0x3b')]['id']}})[_0x60e1('0x19')](handleEntityNotFound(_0x5a26c4,null))[_0x60e1('0x19')](saveUpdates(_0x35531a[_0x60e1('0x3f')],null))['then'](respondWithResult(_0x5a26c4,null))['catch'](handleError(_0x5a26c4,null));};exports['destroy']=function(_0x133e09,_0x5f333e){return db['Interval'][_0x60e1('0x3c')]({'where':{'id':_0x133e09[_0x60e1('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5f333e,null))[_0x60e1('0x19')](removeEntity(_0x5f333e,null))[_0x60e1('0x3d')](handleError(_0x5f333e,null));};exports['addInterval']=function(_0x1d6c89,_0x2a9cf8,_0x5e81c3){if(_0x1d6c89[_0x60e1('0x3f')]['id']){delete _0x1d6c89[_0x60e1('0x3f')]['id'];}return db['Interval'][_0x60e1('0x3c')]({'where':{'id':_0x1d6c89['params']['id']}})[_0x60e1('0x19')](handleEntityNotFound(_0x2a9cf8,null))['then'](function(_0x39dd17){if(_0x39dd17){_0x1d6c89['body'][_0x60e1('0x46')]=_0x39dd17['id'];return db[_0x60e1('0x22')][_0x60e1('0x3e')](_0x1d6c89[_0x60e1('0x3f')]);}})['then'](respondWithResult(_0x2a9cf8,null))[_0x60e1('0x3d')](handleError(_0x2a9cf8,null));};exports['getIntervals']=function(_0x1fa85a,_0x177087,_0x51698f){var _0x51fc63={};var _0x27b613={};var _0x26bec0;var _0x3d3442;return db['Interval'][_0x60e1('0x47')]({'where':{'id':_0x1fa85a[_0x60e1('0x3b')]['id']}})[_0x60e1('0x19')](handleEntityNotFound(_0x177087,null))[_0x60e1('0x19')](function(_0x318ef3){if(_0x318ef3){_0x26bec0=_0x318ef3;_0x27b613[_0x60e1('0x2a')]=_[_0x60e1('0x24')](db[_0x60e1('0x22')]['rawAttributes']);_0x27b613[_0x60e1('0x25')]=_[_0x60e1('0x24')](_0x1fa85a['query']);_0x27b613[_0x60e1('0x28')]=_[_0x60e1('0x29')](_0x27b613[_0x60e1('0x2a')],_0x27b613[_0x60e1('0x25')]);_0x51fc63['attributes']=_[_0x60e1('0x29')](_0x27b613[_0x60e1('0x2a')],qs['fields'](_0x1fa85a[_0x60e1('0x25')][_0x60e1('0x2c')]));_0x51fc63[_0x60e1('0x2b')]=_0x51fc63[_0x60e1('0x2b')][_0x60e1('0x48')]?_0x51fc63[_0x60e1('0x2b')]:_0x27b613[_0x60e1('0x2a')];_0x51fc63['order']=qs['sort'](_0x1fa85a[_0x60e1('0x25')]['sort']);_0x51fc63['where']=qs['filters'](_['pick'](_0x1fa85a[_0x60e1('0x25')],_0x27b613[_0x60e1('0x28')]));if(_0x1fa85a[_0x60e1('0x25')][_0x60e1('0x33')]){_0x51fc63[_0x60e1('0x2f')]=_[_0x60e1('0x35')](_0x51fc63['where'],{'$or':_['map'](_0x51fc63['attributes'],function(_0x2a88b9){var _0x5410b9={};_0x5410b9[_0x2a88b9]={'$like':'%'+_0x1fa85a['query']['filter']+'%'};return _0x5410b9;})});}_0x51fc63=_[_0x60e1('0x35')]({},_0x51fc63,_0x1fa85a[_0x60e1('0x36')]);return _0x26bec0[_0x60e1('0x49')](_0x51fc63);}})[_0x60e1('0x19')](function(_0x40d942){if(_0x40d942){_0x3d3442=_0x40d942[_0x60e1('0x48')];if(!_0x1fa85a[_0x60e1('0x25')][_0x60e1('0x2d')]('nolimit')){_0x51fc63['limit']=qs['limit'](_0x1fa85a[_0x60e1('0x25')][_0x60e1('0x16')]);_0x51fc63[_0x60e1('0x15')]=qs[_0x60e1('0x15')](_0x1fa85a[_0x60e1('0x25')][_0x60e1('0x15')]);}return _0x26bec0[_0x60e1('0x49')](_0x51fc63);}})[_0x60e1('0x19')](function(_0x3dbf69){if(_0x3dbf69){return _0x3dbf69?{'count':_0x3d3442,'rows':_0x3dbf69}:null;}})[_0x60e1('0x19')](respondWithResult(_0x177087,null))[_0x60e1('0x3d')](handleError(_0x177087,null));};exports[_0x60e1('0x4a')]=function(_0x57e9df,_0x5da487,_0x1ad06c){return db['Interval'][_0x60e1('0x47')]({'where':{'id':_0x57e9df[_0x60e1('0x3b')]['id']}})[_0x60e1('0x19')](handleEntityNotFound(_0x5da487,null))[_0x60e1('0x19')](function(_0x22e055){if(_0x22e055){return db[_0x60e1('0x4b')][_0x60e1('0x4c')](function(_0x4a3e4a){return db[_0x60e1('0x22')][_0x60e1('0x1a')]({'where':{'IntervalId':_0x57e9df[_0x60e1('0x3b')]['id']},'transaction':_0x4a3e4a})[_0x60e1('0x19')](function(_0x48acc5){var _0x49f28c=_[_0x60e1('0x34')](_0x57e9df[_0x60e1('0x3f')],function(_0x4362ae){delete _0x4362ae['id'];_0x4362ae[_0x60e1('0x46')]=_0x57e9df[_0x60e1('0x3b')]['id'];return _0x4362ae;});return db[_0x60e1('0x22')][_0x60e1('0x4d')](_0x49f28c,{'transaction':_0x4a3e4a});});})[_0x60e1('0x19')](function(){return db['Interval'][_0x60e1('0x4e')]({'where':{'IntervalId':_0x57e9df[_0x60e1('0x3b')]['id']}});});}})['then'](respondWithResult(_0x5da487,null))[_0x60e1('0x3d')](handleError(_0x5da487,null));}; \ No newline at end of file +var _0xa953=['pick','getIntervals','addIntervals','sequelize','transaction','IntervalId','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','then','Intervals','UserProfileResource','destroy','error','name','send','index','Interval','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','add','day','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','findOne'];(function(_0xc220b1,_0x2ab233){var _0x29c73c=function(_0x144716){while(--_0x144716){_0xc220b1['push'](_0xc220b1['shift']());}};_0x29c73c(++_0x2ab233);}(_0xa953,0x11a));var _0x3a95=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xa953[_0x13ce0c];return _0x4388fb;};'use strict';var pdf=require(_0x3a95('0x0'));var emlformat=require(_0x3a95('0x1'));var rimraf=require(_0x3a95('0x2'));var zipdir=require(_0x3a95('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a95('0x4'));var moment=require(_0x3a95('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3a95('0x6'));var util=require(_0x3a95('0x7'));var path=require('path');var sox=require(_0x3a95('0x8'));var csv=require('to-csv');var ejs=require(_0x3a95('0x9'));var fs=require('fs');var _=require(_0x3a95('0xa'));var squel=require(_0x3a95('0xb'));var crypto=require(_0x3a95('0xc'));var jsforce=require(_0x3a95('0xd'));var deskjs=require(_0x3a95('0xe'));var toCsv=require(_0x3a95('0xf'));var querystring=require(_0x3a95('0x10'));var Papa=require(_0x3a95('0x11'));var Redis=require(_0x3a95('0x12'));var qs=require(_0x3a95('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3a95('0x14'));var config=require(_0x3a95('0x15'));var db=require(_0x3a95('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xdc535f,_0x1560f9){_0x1560f9=_0x1560f9||0xcc;return function(_0x41e980){if(_0x41e980){return _0xdc535f[_0x3a95('0x17')](_0x1560f9);}return _0xdc535f[_0x3a95('0x18')](_0x1560f9)[_0x3a95('0x19')]();};}function respondWithResult(_0x2c679a,_0x456423){_0x456423=_0x456423||0xc8;return function(_0x17b966){if(_0x17b966){return _0x2c679a['status'](_0x456423)['json'](_0x17b966);}};}function respondWithFilteredResult(_0xdb40f9,_0x2a1227){return function(_0x270778){if(_0x270778){var _0x2cc4ce=_0x270778[_0x3a95('0x1a')],_0x362394=_0x2a1227[_0x3a95('0x1b')],_0x1707d2=_0x2a1227[_0x3a95('0x1b')]+_0x2a1227[_0x3a95('0x1c')],_0x2680ed;if(_0x1707d2>=_0x2cc4ce){_0x1707d2=_0x2cc4ce;_0x2680ed=0xc8;}else{_0x2680ed=0xce;}_0xdb40f9[_0x3a95('0x18')](_0x2680ed);return _0xdb40f9[_0x3a95('0x1d')](_0x3a95('0x1e'),_0x362394+'-'+_0x1707d2+'/'+_0x2cc4ce)[_0x3a95('0x1f')](_0x270778);}return null;};}function patchUpdates(_0x1d51c5){return function(_0xcf669f){try{jsonpatch[_0x3a95('0x20')](_0xcf669f,_0x1d51c5,!![]);}catch(_0x522c20){return BPromise['reject'](_0x522c20);}return _0xcf669f[_0x3a95('0x21')]();};}function saveUpdates(_0x7e3f55,_0x1b0bb2){return function(_0x2c86a6){if(_0x2c86a6){return _0x2c86a6['update'](_0x7e3f55)[_0x3a95('0x22')](function(_0x1c6242){return _0x1c6242;});}return null;};}function removeEntity(_0x4f2926,_0x12fc8b){return function(_0x551446){if(_0x551446){return _0x551446['destroy']()[_0x3a95('0x22')](function(){var _0x5225d8=_0x551446['get']({'plain':!![]});var _0x2958c4=_0x3a95('0x23');return db[_0x3a95('0x24')][_0x3a95('0x25')]({'where':{'type':_0x2958c4,'resourceId':_0x5225d8['id']}})[_0x3a95('0x22')](function(){return _0x551446;});})[_0x3a95('0x22')](function(){_0x4f2926[_0x3a95('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e07af,_0x4545c2){return function(_0x5d131a){if(!_0x5d131a){_0x3e07af[_0x3a95('0x17')](0x194);}return _0x5d131a;};}function handleError(_0x312379,_0x414bce){_0x414bce=_0x414bce||0x1f4;return function(_0x297e92){logger[_0x3a95('0x26')](_0x297e92['stack']);if(_0x297e92[_0x3a95('0x27')]){delete _0x297e92[_0x3a95('0x27')];}_0x312379[_0x3a95('0x18')](_0x414bce)[_0x3a95('0x28')](_0x297e92);};}exports[_0x3a95('0x29')]=function(_0x119485,_0x1e6a24){var _0x3ded40={},_0xd1def6={},_0x226600={'count':0x0,'rows':[]};var _0x1a2cb7=db[_0x3a95('0x2a')][_0x3a95('0x2b')];_0xd1def6[_0x3a95('0x2c')]=_['keys'](_0x1a2cb7);var _0x3498d5={'dateStart':_0x119485[_0x3a95('0x2d')][_0x3a95('0x2e')],'dateEnd':_0x119485[_0x3a95('0x2d')][_0x3a95('0x2f')]};delete _0x119485[_0x3a95('0x2d')][_0x3a95('0x2e')];delete _0x119485[_0x3a95('0x2d')]['dateEnd'];_0xd1def6['query']=_[_0x3a95('0x30')](_0x119485['query']);_0xd1def6[_0x3a95('0x31')]=_[_0x3a95('0x32')](_0xd1def6[_0x3a95('0x2c')],_0xd1def6[_0x3a95('0x2d')]);_0x3ded40['attributes']=_[_0x3a95('0x32')](_0xd1def6[_0x3a95('0x2c')],qs['fields'](_0x119485[_0x3a95('0x2d')][_0x3a95('0x33')]));_0x3ded40[_0x3a95('0x34')]=_0x3ded40['attributes'][_0x3a95('0x35')]?_0x3ded40['attributes']:_0xd1def6[_0x3a95('0x2c')];if(!_0x119485['query'][_0x3a95('0x36')](_0x3a95('0x37'))){_0x3ded40['limit']=qs[_0x3a95('0x1c')](_0x119485[_0x3a95('0x2d')][_0x3a95('0x1c')]);_0x3ded40[_0x3a95('0x1b')]=qs['offset'](_0x119485[_0x3a95('0x2d')]['offset']);}_0x3ded40[_0x3a95('0x38')]=qs[_0x3a95('0x39')](_0x119485[_0x3a95('0x2d')][_0x3a95('0x39')]);_0x3ded40[_0x3a95('0x3a')]=qs['filters'](_['pick'](_0x119485['query'],_0xd1def6[_0x3a95('0x31')]));if(_0x3498d5[_0x3a95('0x2e')]){if(_0x3498d5['dateEnd']){_0x3498d5[_0x3a95('0x2f')]=moment(_0x3498d5['dateEnd'])[_0x3a95('0x3b')](0x1,_0x3a95('0x3c'));}else{_0x3498d5[_0x3a95('0x2f')]=moment(_0x3498d5[_0x3a95('0x2e')])[_0x3a95('0x3b')](0x1,_0x3a95('0x3c'));}_['merge'](_0x3ded40[_0x3a95('0x3a')],{'createdAt':{'$gte':_0x3498d5['dateStart'],'$lte':_0x3498d5[_0x3a95('0x2f')]}});}if(_0x119485[_0x3a95('0x2d')][_0x3a95('0x3d')]){_0x3ded40[_0x3a95('0x3a')]=_[_0x3a95('0x3e')](_0x3ded40[_0x3a95('0x3a')],{'$or':_[_0x3a95('0x3f')](_0x3ded40['attributes'],function(_0x164615){var _0x4dcd50={};_0x4dcd50[_0x164615]={'$like':'%'+_0x119485[_0x3a95('0x2d')][_0x3a95('0x3d')]+'%'};return _0x4dcd50;})});}_0x3ded40=_[_0x3a95('0x3e')]({},_0x3ded40,_0x119485[_0x3a95('0x40')]);var _0x36c21e={'where':_0x3ded40[_0x3a95('0x3a')]};return db[_0x3a95('0x2a')][_0x3a95('0x1a')](_0x36c21e)['then'](function(_0x2d544f){_0x226600['count']=_0x2d544f;if(_0x119485[_0x3a95('0x2d')][_0x3a95('0x41')]){_0x3ded40[_0x3a95('0x42')]=[{'all':!![]}];}return db[_0x3a95('0x2a')][_0x3a95('0x43')](_0x3ded40);})[_0x3a95('0x22')](function(_0x5bb16d){_0x226600[_0x3a95('0x44')]=_0x5bb16d;return _0x226600;})['then'](respondWithFilteredResult(_0x1e6a24,_0x3ded40))[_0x3a95('0x45')](handleError(_0x1e6a24,null));};exports[_0x3a95('0x46')]=function(_0x526e58,_0x2bf114){var _0x1878cf={'raw':!![],'where':{'id':_0x526e58['params']['id']}},_0x572790={};_0x572790[_0x3a95('0x2c')]=_[_0x3a95('0x30')](db[_0x3a95('0x2a')][_0x3a95('0x2b')]);_0x572790[_0x3a95('0x2d')]=_['keys'](_0x526e58['query']);_0x572790[_0x3a95('0x31')]=_[_0x3a95('0x32')](_0x572790[_0x3a95('0x2c')],_0x572790[_0x3a95('0x2d')]);_0x1878cf[_0x3a95('0x34')]=_[_0x3a95('0x32')](_0x572790[_0x3a95('0x2c')],qs['fields'](_0x526e58[_0x3a95('0x2d')]['fields']));_0x1878cf[_0x3a95('0x34')]=_0x1878cf['attributes'][_0x3a95('0x35')]?_0x1878cf['attributes']:_0x572790[_0x3a95('0x2c')];if(_0x526e58['query'][_0x3a95('0x41')]){_0x1878cf[_0x3a95('0x42')]=[{'all':!![]}];}_0x1878cf=_[_0x3a95('0x3e')]({},_0x1878cf,_0x526e58[_0x3a95('0x40')]);return db[_0x3a95('0x2a')]['find'](_0x1878cf)[_0x3a95('0x22')](handleEntityNotFound(_0x2bf114,null))[_0x3a95('0x22')](respondWithResult(_0x2bf114,null))[_0x3a95('0x45')](handleError(_0x2bf114,null));};exports['create']=function(_0x2c8de9,_0x4fdec7){return db[_0x3a95('0x2a')][_0x3a95('0x47')](_0x2c8de9[_0x3a95('0x48')],{})[_0x3a95('0x22')](function(_0x50a073){var _0x2c9fef=_0x2c8de9[_0x3a95('0x49')][_0x3a95('0x4a')]({'plain':!![]});if(!_0x2c9fef)throw new Error(_0x3a95('0x4b'));if(_0x2c9fef[_0x3a95('0x4c')]==='user'){var _0x57dfb1=_0x50a073[_0x3a95('0x4a')]({'plain':!![]});var _0x225fab=_0x3a95('0x23');return db[_0x3a95('0x4d')][_0x3a95('0x4e')]({'where':{'name':_0x225fab,'userProfileId':_0x2c9fef[_0x3a95('0x4f')]},'raw':!![]})[_0x3a95('0x22')](function(_0xf99fb1){if(_0xf99fb1&&_0xf99fb1[_0x3a95('0x50')]===0x0){return db['UserProfileResource'][_0x3a95('0x47')]({'name':_0x57dfb1[_0x3a95('0x27')],'resourceId':_0x57dfb1['id'],'type':_0xf99fb1['name'],'sectionId':_0xf99fb1['id']},{})[_0x3a95('0x22')](function(){return _0x50a073;});}else{return _0x50a073;}})['catch'](function(_0x3a5367){logger['error'](_0x3a95('0x51'),_0x3a5367);throw _0x3a5367;});}return _0x50a073;})[_0x3a95('0x22')](respondWithResult(_0x4fdec7,0xc9))['catch'](handleError(_0x4fdec7,null));};exports[_0x3a95('0x52')]=function(_0x31d10d,_0x101adc){if(_0x31d10d['body']['id']){delete _0x31d10d[_0x3a95('0x48')]['id'];}return db[_0x3a95('0x2a')][_0x3a95('0x4e')]({'where':{'id':_0x31d10d[_0x3a95('0x53')]['id']}})[_0x3a95('0x22')](handleEntityNotFound(_0x101adc,null))['then'](saveUpdates(_0x31d10d[_0x3a95('0x48')],null))[_0x3a95('0x22')](respondWithResult(_0x101adc,null))[_0x3a95('0x45')](handleError(_0x101adc,null));};exports[_0x3a95('0x25')]=function(_0x5a8ad4,_0x46acb5){return db['Interval'][_0x3a95('0x4e')]({'where':{'id':_0x5a8ad4[_0x3a95('0x53')]['id']}})[_0x3a95('0x22')](handleEntityNotFound(_0x46acb5,null))[_0x3a95('0x22')](removeEntity(_0x46acb5,null))[_0x3a95('0x45')](handleError(_0x46acb5,null));};exports[_0x3a95('0x54')]=function(_0x57982b,_0x32bd51,_0x98f4c9){if(_0x57982b[_0x3a95('0x48')]['id']){delete _0x57982b[_0x3a95('0x48')]['id'];}return db['Interval']['find']({'where':{'id':_0x57982b[_0x3a95('0x53')]['id']}})[_0x3a95('0x22')](handleEntityNotFound(_0x32bd51,null))[_0x3a95('0x22')](function(_0x469352){if(_0x469352){_0x57982b[_0x3a95('0x48')]['IntervalId']=_0x469352['id'];return db[_0x3a95('0x2a')][_0x3a95('0x47')](_0x57982b['body']);}})[_0x3a95('0x22')](respondWithResult(_0x32bd51,null))['catch'](handleError(_0x32bd51,null));};exports['getIntervals']=function(_0x15c193,_0x178669,_0x196259){var _0x8c5350={};var _0x241494={};var _0x1661c0;var _0x3d5afc;return db[_0x3a95('0x2a')][_0x3a95('0x55')]({'where':{'id':_0x15c193['params']['id']}})['then'](handleEntityNotFound(_0x178669,null))[_0x3a95('0x22')](function(_0x336af9){if(_0x336af9){_0x1661c0=_0x336af9;_0x241494['model']=_[_0x3a95('0x30')](db[_0x3a95('0x2a')][_0x3a95('0x2b')]);_0x241494[_0x3a95('0x2d')]=_[_0x3a95('0x30')](_0x15c193['query']);_0x241494[_0x3a95('0x31')]=_[_0x3a95('0x32')](_0x241494['model'],_0x241494[_0x3a95('0x2d')]);_0x8c5350[_0x3a95('0x34')]=_[_0x3a95('0x32')](_0x241494[_0x3a95('0x2c')],qs[_0x3a95('0x33')](_0x15c193[_0x3a95('0x2d')][_0x3a95('0x33')]));_0x8c5350[_0x3a95('0x34')]=_0x8c5350['attributes']['length']?_0x8c5350['attributes']:_0x241494[_0x3a95('0x2c')];_0x8c5350['order']=qs[_0x3a95('0x39')](_0x15c193[_0x3a95('0x2d')][_0x3a95('0x39')]);_0x8c5350[_0x3a95('0x3a')]=qs[_0x3a95('0x31')](_[_0x3a95('0x56')](_0x15c193[_0x3a95('0x2d')],_0x241494['filters']));if(_0x15c193[_0x3a95('0x2d')][_0x3a95('0x3d')]){_0x8c5350[_0x3a95('0x3a')]=_[_0x3a95('0x3e')](_0x8c5350[_0x3a95('0x3a')],{'$or':_[_0x3a95('0x3f')](_0x8c5350[_0x3a95('0x34')],function(_0x2c0907){var _0x10cb75={};_0x10cb75[_0x2c0907]={'$like':'%'+_0x15c193[_0x3a95('0x2d')][_0x3a95('0x3d')]+'%'};return _0x10cb75;})});}_0x8c5350=_['merge']({},_0x8c5350,_0x15c193[_0x3a95('0x40')]);return _0x1661c0[_0x3a95('0x57')](_0x8c5350);}})['then'](function(_0x2639b5){if(_0x2639b5){_0x3d5afc=_0x2639b5[_0x3a95('0x35')];if(!_0x15c193[_0x3a95('0x2d')][_0x3a95('0x36')](_0x3a95('0x37'))){_0x8c5350[_0x3a95('0x1c')]=qs[_0x3a95('0x1c')](_0x15c193['query']['limit']);_0x8c5350['offset']=qs[_0x3a95('0x1b')](_0x15c193[_0x3a95('0x2d')]['offset']);}return _0x1661c0[_0x3a95('0x57')](_0x8c5350);}})['then'](function(_0x3243b4){if(_0x3243b4){return _0x3243b4?{'count':_0x3d5afc,'rows':_0x3243b4}:null;}})[_0x3a95('0x22')](respondWithResult(_0x178669,null))['catch'](handleError(_0x178669,null));};exports[_0x3a95('0x58')]=function(_0x303b24,_0x2c5e6f,_0x2a3e9f){return db['Interval'][_0x3a95('0x55')]({'where':{'id':_0x303b24['params']['id']}})[_0x3a95('0x22')](handleEntityNotFound(_0x2c5e6f,null))[_0x3a95('0x22')](function(_0x3dcae3){if(_0x3dcae3){return db[_0x3a95('0x59')][_0x3a95('0x5a')](function(_0x4fb9c2){return db['Interval'][_0x3a95('0x25')]({'where':{'IntervalId':_0x303b24[_0x3a95('0x53')]['id']},'transaction':_0x4fb9c2})[_0x3a95('0x22')](function(_0x3fb00a){var _0x97beb0=_[_0x3a95('0x3f')](_0x303b24[_0x3a95('0x48')],function(_0x586989){delete _0x586989['id'];_0x586989[_0x3a95('0x5b')]=_0x303b24[_0x3a95('0x53')]['id'];return _0x586989;});return db['Interval']['bulkCreate'](_0x97beb0,{'transaction':_0x4fb9c2});});})[_0x3a95('0x22')](function(){return db[_0x3a95('0x2a')][_0x3a95('0x43')]({'where':{'IntervalId':_0x303b24['params']['id']}});});}})['then'](respondWithResult(_0x2c5e6f,null))[_0x3a95('0x45')](handleError(_0x2c5e6f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index c68a49e..d26694c 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 _0xd4f2=['tools_intervals','rewrite','lodash','util','bluebird','request-promise','./interval.attributes','define','Interval'];(function(_0x50648c,_0x95ac4f){var _0x7e3403=function(_0x585095){while(--_0x585095){_0x50648c['push'](_0x50648c['shift']());}};_0x7e3403(++_0x95ac4f);}(_0xd4f2,0xa4));var _0x2d4f=function(_0x53b0e7,_0x314ab6){_0x53b0e7=_0x53b0e7-0x0;var _0x22c9fb=_0xd4f2[_0x53b0e7];return _0x22c9fb;};'use strict';var _=require(_0x2d4f('0x0'));var util=require(_0x2d4f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2d4f('0x2'));var rp=require(_0x2d4f('0x3'));var attributes=require(_0x2d4f('0x4'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x252b02,_0x817fb9){return _0x252b02[_0x2d4f('0x5')](_0x2d4f('0x6'),attributes,{'tableName':_0x2d4f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x39263a,_0x6befab){extensions[_0x2d4f('0x8')](_0x252b02,_0x39263a);},'afterBulkCreate':function(_0x400615,_0x48788a,_0x53959a){_0x53959a();extensions['rewrite'](_0x252b02,_0x400615[0x0]);},'afterUpdate':function(_0x11575c,_0x153935){extensions[_0x2d4f('0x8')](_0x252b02,_0x11575c);},'afterDestroy':function(_0x538b21,_0x26d400){extensions[_0x2d4f('0x8')](_0x252b02,_0x538b21);}}});}; \ No newline at end of file +var _0x5b47=['tools_intervals','rewrite','lodash','../../config/logger','api','bluebird','request-promise','../../components/extensions/rewrite','define','Interval'];(function(_0x1778a1,_0x50cba4){var _0x1b9222=function(_0x1f49ad){while(--_0x1f49ad){_0x1778a1['push'](_0x1778a1['shift']());}};_0x1b9222(++_0x50cba4);}(_0x5b47,0xca));var _0x75b4=function(_0x3a3094,_0x5af682){_0x3a3094=_0x3a3094-0x0;var _0x22b89d=_0x5b47[_0x3a3094];return _0x22b89d;};'use strict';var _=require(_0x75b4('0x0'));var util=require('util');var logger=require(_0x75b4('0x1'))(_0x75b4('0x2'));var moment=require('moment');var BPromise=require(_0x75b4('0x3'));var rp=require(_0x75b4('0x4'));var attributes=require('./interval.attributes');var extensions=require(_0x75b4('0x5'));module['exports']=function(_0x1ba041,_0x29c2f3){return _0x1ba041[_0x75b4('0x6')](_0x75b4('0x7'),attributes,{'tableName':_0x75b4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e181d,_0x28a851){extensions[_0x75b4('0x9')](_0x1ba041,_0x4e181d);},'afterBulkCreate':function(_0x503200,_0x568911,_0x572720){_0x572720();extensions[_0x75b4('0x9')](_0x1ba041,_0x503200[0x0]);},'afterUpdate':function(_0x42eafd,_0x5b72a9){extensions['rewrite'](_0x1ba041,_0x42eafd);},'afterDestroy':function(_0x5492e5,_0xb224c){extensions[_0x75b4('0x9')](_0x1ba041,_0x5492e5);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7ddfadb..85f1955 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 _0x5089=['ShowInterval','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Interval','findAll','raw','options','attributes','limit','map','include','model','then','info','GetInterval'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5089,0x1bb));var _0x9508=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0x5089[_0x190681];return _0x4f2ada;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var moment=require('moment');var BPromise=require(_0x9508('0x2'));var rs=require(_0x9508('0x3'));var fs=require('fs');var Redis=require(_0x9508('0x4'));var db=require(_0x9508('0x5'))['db'];var utils=require(_0x9508('0x6'));var logger=require('../../config/logger')(_0x9508('0x7'));var config=require('../../config/environment');var jayson=require(_0x9508('0x8'));var client=jayson[_0x9508('0x9')][_0x9508('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ab3c6,_0x1dc04c,_0x42d13a){return new BPromise(function(_0x55a5de,_0x14dae7){return client[_0x9508('0xb')](_0x4ab3c6,_0x42d13a)['then'](function(_0x342ddd){logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));logger[_0x9508('0xe')](_0x9508('0xf'),_0x1dc04c,_0x9508('0xd'),JSON[_0x9508('0x10')](_0x342ddd));if(_0x342ddd['error']){if(_0x342ddd[_0x9508('0x11')]['code']===0x1f4){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x342ddd['error'][_0x9508('0x12')]);return _0x14dae7(_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);}logger[_0x9508('0x11')]('Interval,\x20%s,\x20%s',_0x1dc04c,_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);return _0x55a5de(_0x342ddd['error'][_0x9508('0x12')]);}else{logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));_0x55a5de(_0x342ddd[_0x9508('0x13')][_0x9508('0x12')]);}})[_0x9508('0x14')](function(_0x343802){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x343802);_0x14dae7(_0x343802);});});}exports['GetInterval']=function(_0x22ba9c){var _0x378749=this;return new Promise(function(_0xfcc29d,_0x1ba7e6){return db[_0x9508('0x15')][_0x9508('0x16')]({'raw':_0x22ba9c['options']?_0x22ba9c['options'][_0x9508('0x17')]===undefined?!![]:![]:!![],'where':_0x22ba9c['options']?_0x22ba9c[_0x9508('0x18')]['where']||null:null,'attributes':_0x22ba9c[_0x9508('0x18')]?_0x22ba9c[_0x9508('0x18')][_0x9508('0x19')]||null:null,'limit':_0x22ba9c[_0x9508('0x18')]?_0x22ba9c[_0x9508('0x18')][_0x9508('0x1a')]||null:null,'include':_0x22ba9c[_0x9508('0x18')]?_0x22ba9c['options']['include']?_[_0x9508('0x1b')](_0x22ba9c[_0x9508('0x18')][_0x9508('0x1c')],function(_0xf70830){return{'model':db[_0xf70830[_0x9508('0x1d')]],'as':_0xf70830['as'],'attributes':_0xf70830[_0x9508('0x19')],'include':_0xf70830['include']?_['map'](_0xf70830[_0x9508('0x1c')],function(_0x55cc4d){return{'model':db[_0x55cc4d['model']],'as':_0x55cc4d['as'],'attributes':_0x55cc4d[_0x9508('0x19')],'include':_0x55cc4d['include']?_['map'](_0x55cc4d[_0x9508('0x1c')],function(_0x30da92){return{'model':db[_0x30da92['model']],'as':_0x30da92['as'],'attributes':_0x30da92[_0x9508('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9508('0x1e')](function(_0x22b2e2){logger[_0x9508('0x1f')](_0x9508('0x20'),_0x22ba9c);logger[_0x9508('0xe')](_0x9508('0x20'),_0x22ba9c,JSON[_0x9508('0x10')](_0x22b2e2));_0xfcc29d(_0x22b2e2);})[_0x9508('0x14')](function(_0x24df6){logger[_0x9508('0x11')]('GetInterval',_0x24df6[_0x9508('0x12')],_0x22ba9c);_0x1ba7e6(_0x378749[_0x9508('0x11')](0x1f4,_0x24df6[_0x9508('0x12')]));});});};exports['ShowInterval']=function(_0x3438da){var _0x38686a=this;return new Promise(function(_0x5e1d31,_0x3334d4){return db[_0x9508('0x15')]['find']({'raw':_0x3438da[_0x9508('0x18')]?_0x3438da[_0x9508('0x18')][_0x9508('0x17')]===undefined?!![]:![]:!![],'where':_0x3438da[_0x9508('0x18')]?_0x3438da['options']['where']||null:null,'attributes':_0x3438da[_0x9508('0x18')]?_0x3438da[_0x9508('0x18')][_0x9508('0x19')]||null:null,'include':_0x3438da['options']?_0x3438da['options'][_0x9508('0x1c')]?_[_0x9508('0x1b')](_0x3438da[_0x9508('0x18')][_0x9508('0x1c')],function(_0xc4ae52){return{'model':db[_0xc4ae52[_0x9508('0x1d')]],'as':_0xc4ae52['as'],'attributes':_0xc4ae52[_0x9508('0x19')],'include':_0xc4ae52[_0x9508('0x1c')]?_[_0x9508('0x1b')](_0xc4ae52[_0x9508('0x1c')],function(_0x4a34d2){return{'model':db[_0x4a34d2[_0x9508('0x1d')]],'as':_0x4a34d2['as'],'attributes':_0x4a34d2[_0x9508('0x19')],'include':_0x4a34d2['include']?_[_0x9508('0x1b')](_0x4a34d2[_0x9508('0x1c')],function(_0x3f69b1){return{'model':db[_0x3f69b1[_0x9508('0x1d')]],'as':_0x3f69b1['as'],'attributes':_0x3f69b1[_0x9508('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9508('0x1e')](function(_0x33e17c){logger[_0x9508('0x1f')](_0x9508('0x21'),_0x3438da);logger[_0x9508('0xe')](_0x9508('0x21'),_0x3438da,JSON['stringify'](_0x33e17c));_0x5e1d31(_0x33e17c);})[_0x9508('0x14')](function(_0x5b690e){logger[_0x9508('0x11')](_0x9508('0x21'),_0x5b690e[_0x9508('0x12')],_0x3438da);_0x3334d4(_0x38686a['error'](0x1f4,_0x5b690e['message']));});});}; \ No newline at end of file +var _0x24ca=['code','message','result','catch','GetInterval','Interval','findAll','options','where','attributes','limit','include','model','map','debug','ShowInterval','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x8d77d8,_0x2623b6){var _0x13f643=function(_0x2ce7c9){while(--_0x2ce7c9){_0x8d77d8['push'](_0x8d77d8['shift']());}};_0x13f643(++_0x2623b6);}(_0x24ca,0x8c));var _0xa24c=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x24ca[_0xf48cce];return _0x2a5c38;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa24c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var utils=require(_0xa24c('0x4'));var logger=require('../../config/logger')(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var jayson=require(_0xa24c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52147a,_0x2288d4,_0x3c10d9){return new BPromise(function(_0x1218ea,_0x3c3959){return client[_0xa24c('0x8')](_0x52147a,_0x3c10d9)[_0xa24c('0x9')](function(_0x5bedc6){logger[_0xa24c('0xa')](_0xa24c('0xb'),_0x2288d4,_0xa24c('0xc'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x2288d4,_0xa24c('0xc'),JSON[_0xa24c('0xd')](_0x5bedc6));if(_0x5bedc6[_0xa24c('0xe')]){if(_0x5bedc6[_0xa24c('0xe')][_0xa24c('0xf')]===0x1f4){logger[_0xa24c('0xe')]('Interval,\x20%s,\x20%s',_0x2288d4,_0x5bedc6['error']['message']);return _0x3c3959(_0x5bedc6[_0xa24c('0xe')][_0xa24c('0x10')]);}logger[_0xa24c('0xe')](_0xa24c('0xb'),_0x2288d4,_0x5bedc6[_0xa24c('0xe')]['message']);return _0x1218ea(_0x5bedc6[_0xa24c('0xe')]['message']);}else{logger['info']('Interval,\x20%s,\x20%s',_0x2288d4,_0xa24c('0xc'));_0x1218ea(_0x5bedc6[_0xa24c('0x11')][_0xa24c('0x10')]);}})[_0xa24c('0x12')](function(_0x204e7a){logger[_0xa24c('0xe')](_0xa24c('0xb'),_0x2288d4,_0x204e7a);_0x3c3959(_0x204e7a);});});}exports[_0xa24c('0x13')]=function(_0x14f0aa){var _0x117177=this;return new Promise(function(_0x1970fc,_0x1a667b){return db[_0xa24c('0x14')][_0xa24c('0x15')]({'raw':_0x14f0aa['options']?_0x14f0aa[_0xa24c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x14f0aa[_0xa24c('0x16')]?_0x14f0aa[_0xa24c('0x16')][_0xa24c('0x17')]||null:null,'attributes':_0x14f0aa[_0xa24c('0x16')]?_0x14f0aa[_0xa24c('0x16')][_0xa24c('0x18')]||null:null,'limit':_0x14f0aa[_0xa24c('0x16')]?_0x14f0aa[_0xa24c('0x16')][_0xa24c('0x19')]||null:null,'include':_0x14f0aa[_0xa24c('0x16')]?_0x14f0aa[_0xa24c('0x16')]['include']?_['map'](_0x14f0aa[_0xa24c('0x16')][_0xa24c('0x1a')],function(_0x316a68){return{'model':db[_0x316a68[_0xa24c('0x1b')]],'as':_0x316a68['as'],'attributes':_0x316a68[_0xa24c('0x18')],'include':_0x316a68[_0xa24c('0x1a')]?_[_0xa24c('0x1c')](_0x316a68[_0xa24c('0x1a')],function(_0x304d6c){return{'model':db[_0x304d6c['model']],'as':_0x304d6c['as'],'attributes':_0x304d6c[_0xa24c('0x18')],'include':_0x304d6c['include']?_[_0xa24c('0x1c')](_0x304d6c[_0xa24c('0x1a')],function(_0x471421){return{'model':db[_0x471421[_0xa24c('0x1b')]],'as':_0x471421['as'],'attributes':_0x471421['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c86c6){logger['info'](_0xa24c('0x13'),_0x14f0aa);logger[_0xa24c('0x1d')](_0xa24c('0x13'),_0x14f0aa,JSON[_0xa24c('0xd')](_0x4c86c6));_0x1970fc(_0x4c86c6);})[_0xa24c('0x12')](function(_0x5361d4){logger['error'](_0xa24c('0x13'),_0x5361d4[_0xa24c('0x10')],_0x14f0aa);_0x1a667b(_0x117177[_0xa24c('0xe')](0x1f4,_0x5361d4[_0xa24c('0x10')]));});});};exports[_0xa24c('0x1e')]=function(_0x3f7102){var _0xc0db8f=this;return new Promise(function(_0x1e30a9,_0x29f539){return db[_0xa24c('0x14')]['find']({'raw':_0x3f7102[_0xa24c('0x16')]?_0x3f7102[_0xa24c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3f7102[_0xa24c('0x16')]?_0x3f7102[_0xa24c('0x16')][_0xa24c('0x17')]||null:null,'attributes':_0x3f7102[_0xa24c('0x16')]?_0x3f7102[_0xa24c('0x16')][_0xa24c('0x18')]||null:null,'include':_0x3f7102[_0xa24c('0x16')]?_0x3f7102[_0xa24c('0x16')][_0xa24c('0x1a')]?_[_0xa24c('0x1c')](_0x3f7102['options']['include'],function(_0x52e39b){return{'model':db[_0x52e39b[_0xa24c('0x1b')]],'as':_0x52e39b['as'],'attributes':_0x52e39b['attributes'],'include':_0x52e39b[_0xa24c('0x1a')]?_[_0xa24c('0x1c')](_0x52e39b[_0xa24c('0x1a')],function(_0x4b8627){return{'model':db[_0x4b8627[_0xa24c('0x1b')]],'as':_0x4b8627['as'],'attributes':_0x4b8627[_0xa24c('0x18')],'include':_0x4b8627[_0xa24c('0x1a')]?_['map'](_0x4b8627[_0xa24c('0x1a')],function(_0x16835f){return{'model':db[_0x16835f['model']],'as':_0x16835f['as'],'attributes':_0x16835f[_0xa24c('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa24c('0x9')](function(_0xd837dc){logger['info'](_0xa24c('0x1e'),_0x3f7102);logger[_0xa24c('0x1d')](_0xa24c('0x1e'),_0x3f7102,JSON[_0xa24c('0xd')](_0xd837dc));_0x1e30a9(_0xd837dc);})[_0xa24c('0x12')](function(_0x4a9d2d){logger[_0xa24c('0xe')](_0xa24c('0x1e'),_0x4a9d2d['message'],_0x3f7102);_0x29f539(_0xc0db8f[_0xa24c('0xe')](0x1f4,_0x4a9d2d[_0xa24c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 1bde6b2..4520338 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x46f74b,_0x50458e){var _0x5df6b4=function(_0x5e7d66){while(--_0x5e7d66){_0x46f74b['push'](_0x46f74b['shift']());}};_0x5df6b4(++_0x50458e);}(_0xadb5,0xad));var _0x5adb=function(_0x2709b1,_0x33e8b1){_0x2709b1=_0x2709b1-0x0;var _0x44ba8f=_0xadb5[_0x2709b1];return _0x44ba8f;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x52f73e,_0x1a0adf){var _0x3c7432=function(_0x475d61){while(--_0x475d61){_0x52f73e['push'](_0x52f73e['shift']());}};_0x3c7432(++_0x1a0adf);}(_0xadb5,0xad));var _0x5adb=function(_0x992a45,_0x91f5a4){_0x992a45=_0x992a45-0x0;var _0x58e7e5=_0xadb5[_0x992a45];return _0x58e7e5;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index eb7b3d0..415139f 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 _0xa9e0=['Basic\x20','toString','base64','utf8','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','connection','remoteAddress','socket','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json'];(function(_0x4a2ff1,_0x13de3b){var _0x106aa7=function(_0x433dca){while(--_0x433dca){_0x4a2ff1['push'](_0x4a2ff1['shift']());}};_0x106aa7(++_0x13de3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var BPromise=require(_0x0a9e('0x0'));var https=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var USERNAME='support';var PASSWORD=_0x0a9e('0x3');function openIssue(_0x4ce2f1,_0x333808){var _0x432180={'fields':{'project':{'key':_0x4ce2f1[_0x0a9e('0x4')]||_0x0a9e('0x5')},'summary':(_0x4ce2f1[_0x0a9e('0x6')]||'Report')+_0x0a9e('0x7')+_0x4ce2f1['ip'],'description':_0x4ce2f1[_0x0a9e('0x8')]||JSON[_0x0a9e('0x9')](_0x4ce2f1),'issuetype':{'name':_0x4ce2f1['issuetype']||'Bug'}}};_0x432180[_0x0a9e('0xa')]['customfield_11500']=_0x4ce2f1['email'];_0x432180[_0x0a9e('0xa')][_0x0a9e('0xb')]=_0x4ce2f1[_0x0a9e('0xc')];_0x432180[_0x0a9e('0xa')][_0x0a9e('0xd')]=_0x4ce2f1[_0x0a9e('0xe')];_0x432180['fields']['customfield_11503']=_0x4ce2f1['name'];_0x432180['fields'][_0x0a9e('0xf')]=_0x4ce2f1[_0x0a9e('0x10')];_0x432180[_0x0a9e('0xa')][_0x0a9e('0x11')]=_0x4ce2f1['ip'];var _0x32d742={'host':_0x0a9e('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0a9e('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x0a9e('0x14'),'Authorization':_0x0a9e('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x0a9e('0x16')](_0x0a9e('0x17'))}};var _0x4d5611=JSON['stringify'](_0x432180);var _0x22dccb=https['request'](_0x32d742,function(_0x1985b6){_0x1985b6['setEncoding'](_0x0a9e('0x18'));var _0x12066b='';_0x1985b6['on']('data',function(_0x225616){_0x12066b+=_0x225616;});_0x1985b6['on']('end',function(){if(_0x333808){return _0x333808[_0x0a9e('0x19')](_0x1985b6[_0x0a9e('0x1a')])[_0x0a9e('0x1b')](JSON[_0x0a9e('0x1c')](_0x12066b));}});});_0x22dccb['on'](_0x0a9e('0x1d'),function(_0x2eb11f){if(_0x333808){return _0x333808[_0x0a9e('0x19')](0x1f4)[_0x0a9e('0x1b')]({'errors':[{'message':_0x0a9e('0x1e'),'type':_0x0a9e('0x1f')}]});}});_0x22dccb[_0x0a9e('0x20')](_0x4d5611);_0x22dccb[_0x0a9e('0x21')]();}exports['openIssue']=openIssue;exports[_0x0a9e('0x22')]=function(_0x155cce,_0x53682f){_0x155cce[_0x0a9e('0x23')]['ip']=_0x155cce['headers']['x-forwarded-for']||_0x155cce[_0x0a9e('0x24')][_0x0a9e('0x25')]||_0x155cce[_0x0a9e('0x26')][_0x0a9e('0x25')]||_0x155cce['connection'][_0x0a9e('0x26')][_0x0a9e('0x25')];return openIssue(_0x155cce[_0x0a9e('0x23')],_0x53682f);}; \ No newline at end of file +var _0xcb91=['summary','\x20from\x20','description','issuetype','Bug','customfield_11500','customfield_11501','oldToken','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','stringify','setEncoding','utf8','data','end','status','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','x-forwarded-for','connection','remoteAddress','socket','body','../../config/logger','api','support','3eAmWpBVP0','MOTGUI'];(function(_0x2d9922,_0x59fd51){var _0xaecfe=function(_0x58aafd){while(--_0x58aafd){_0x2d9922['push'](_0x2d9922['shift']());}};_0xaecfe(++_0x59fd51);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xcb91[_0x31ced5];return _0x10d9e5;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var USERNAME=_0x1cb9('0x2');var PASSWORD=_0x1cb9('0x3');function openIssue(_0x4c37e8,_0x8c392f){var _0x2c17b8={'fields':{'project':{'key':_0x4c37e8['key']||_0x1cb9('0x4')},'summary':(_0x4c37e8[_0x1cb9('0x5')]||'Report')+_0x1cb9('0x6')+_0x4c37e8['ip'],'description':_0x4c37e8[_0x1cb9('0x7')]||JSON['stringify'](_0x4c37e8),'issuetype':{'name':_0x4c37e8[_0x1cb9('0x8')]||_0x1cb9('0x9')}}};_0x2c17b8['fields'][_0x1cb9('0xa')]=_0x4c37e8['email'];_0x2c17b8['fields'][_0x1cb9('0xb')]=_0x4c37e8[_0x1cb9('0xc')];_0x2c17b8[_0x1cb9('0xd')][_0x1cb9('0xe')]=_0x4c37e8[_0x1cb9('0xf')];_0x2c17b8['fields'][_0x1cb9('0x10')]=_0x4c37e8[_0x1cb9('0x11')];_0x2c17b8[_0x1cb9('0xd')][_0x1cb9('0x12')]=_0x4c37e8[_0x1cb9('0x13')];_0x2c17b8['fields']['customfield_10102']=_0x4c37e8['ip'];var _0x59dec3={'host':_0x1cb9('0x14'),'port':0x1bb,'path':_0x1cb9('0x15'),'method':_0x1cb9('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x1cb9('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x1cb9('0x18')](_0x1cb9('0x19'))}};var _0x1b3cd7=JSON[_0x1cb9('0x1a')](_0x2c17b8);var _0x3e2d11=https['request'](_0x59dec3,function(_0x5572cb){_0x5572cb[_0x1cb9('0x1b')](_0x1cb9('0x1c'));var _0x3904b7='';_0x5572cb['on'](_0x1cb9('0x1d'),function(_0x3e21e0){_0x3904b7+=_0x3e21e0;});_0x5572cb['on'](_0x1cb9('0x1e'),function(){if(_0x8c392f){return _0x8c392f[_0x1cb9('0x1f')](_0x5572cb['statusCode'])['json'](JSON[_0x1cb9('0x20')](_0x3904b7));}});});_0x3e2d11['on'](_0x1cb9('0x21'),function(_0x2b2669){if(_0x8c392f){return _0x8c392f[_0x1cb9('0x1f')](0x1f4)[_0x1cb9('0x22')]({'errors':[{'message':_0x1cb9('0x23'),'type':_0x1cb9('0x24')}]});}});_0x3e2d11['write'](_0x1b3cd7);_0x3e2d11['end']();}exports[_0x1cb9('0x25')]=openIssue;exports['send']=function(_0x4750b1,_0x2265ea){_0x4750b1['body']['ip']=_0x4750b1['headers'][_0x1cb9('0x26')]||_0x4750b1[_0x1cb9('0x27')][_0x1cb9('0x28')]||_0x4750b1[_0x1cb9('0x29')][_0x1cb9('0x28')]||_0x4750b1[_0x1cb9('0x27')]['socket']['remoteAddress'];return openIssue(_0x4750b1[_0x1cb9('0x2a')],_0x2265ea);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 55a1f41..f8f1777 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 _0xf3a3=['exports','multer','path','express','Router','../../config/environment','./jscriptyAnswerReport.controller','index','/describe','describe','get','/:id','post','isAuthenticated','create','update','destroy'];(function(_0x1941c5,_0x1c8797){var _0x322687=function(_0x529656){while(--_0x529656){_0x1941c5['push'](_0x1941c5['shift']());}};_0x322687(++_0x1c8797);}(_0xf3a3,0xef));var _0x3f3a=function(_0x49b73b,_0x49456b){_0x49b73b=_0x49b73b-0x0;var _0x391e11=_0xf3a3[_0x49b73b];return _0x391e11;};'use strict';var multer=require(_0x3f3a('0x0'));var util=require('util');var path=require(_0x3f3a('0x1'));var timeout=require('connect-timeout');var express=require(_0x3f3a('0x2'));var router=express[_0x3f3a('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3f3a('0x4'));var controller=require(_0x3f3a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x3f3a('0x6')]);router['get'](_0x3f3a('0x7'),auth['isAuthenticated'](),controller[_0x3f3a('0x8')]);router[_0x3f3a('0x9')](_0x3f3a('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3f3a('0xb')]('/',auth[_0x3f3a('0xc')](),controller[_0x3f3a('0xd')]);router['put']('/:id',auth[_0x3f3a('0xc')](),controller[_0x3f3a('0xe')]);router['delete'](_0x3f3a('0xa'),auth[_0x3f3a('0xc')](),controller[_0x3f3a('0xf')]);module[_0x3f3a('0x10')]=router; \ No newline at end of file +var _0x0569=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0x1dd080,_0x52e2f9){var _0x599c97=function(_0x7b6cb9){while(--_0x7b6cb9){_0x1dd080['push'](_0x1dd080['shift']());}};_0x599c97(++_0x52e2f9);}(_0x0569,0x166));var _0x9056=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x0569[_0x17928f];return _0x500b63;};'use strict';var multer=require(_0x9056('0x0'));var util=require(_0x9056('0x1'));var path=require('path');var timeout=require(_0x9056('0x2'));var express=require(_0x9056('0x3'));var router=express[_0x9056('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9056('0x5'));var config=require(_0x9056('0x6'));var controller=require(_0x9056('0x7'));router[_0x9056('0x8')]('/',auth[_0x9056('0x9')](),controller[_0x9056('0xa')]);router[_0x9056('0x8')](_0x9056('0xb'),auth['isAuthenticated'](),controller[_0x9056('0xc')]);router[_0x9056('0x8')](_0x9056('0xd'),auth[_0x9056('0x9')](),controller[_0x9056('0xe')]);router['post']('/',auth[_0x9056('0x9')](),controller[_0x9056('0xf')]);router[_0x9056('0x10')](_0x9056('0xd'),auth[_0x9056('0x9')](),controller[_0x9056('0x11')]);router[_0x9056('0x12')](_0x9056('0xd'),auth[_0x9056('0x9')](),controller[_0x9056('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index c0f4b60..346fc33 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 _0x1306=['STRING','TEXT','long','sequelize','exports'];(function(_0x47edf2,_0x422b3f){var _0x56bbe7=function(_0x849758){while(--_0x849758){_0x47edf2['push'](_0x47edf2['shift']());}};_0x56bbe7(++_0x422b3f);}(_0x1306,0x17a));var _0x6130=function(_0x55d30e,_0x306498){_0x55d30e=_0x55d30e-0x0;var _0x358e7b=_0x1306[_0x55d30e];return _0x358e7b;};'use strict';var Sequelize=require(_0x6130('0x0'));module[_0x6130('0x1')]={'question':{'type':Sequelize[_0x6130('0x2')]},'answer':{'type':Sequelize[_0x6130('0x3')](_0x6130('0x4'))},'membername':{'type':Sequelize[_0x6130('0x2')]},'projectname':{'type':Sequelize[_0x6130('0x2')]},'queue':{'type':Sequelize[_0x6130('0x2')]},'uniqueid':{'type':Sequelize[_0x6130('0x2')]},'calleridname':{'type':Sequelize[_0x6130('0x2')]},'calleridnum':{'type':Sequelize[_0x6130('0x2')]},'questionId':{'type':Sequelize[_0x6130('0x2')]}}; \ No newline at end of file +var _0x4345=['exports','TEXT','long','STRING','sequelize'];(function(_0x17d8ef,_0x57ef81){var _0x47197f=function(_0x45aca3){while(--_0x45aca3){_0x17d8ef['push'](_0x17d8ef['shift']());}};_0x47197f(++_0x57ef81);}(_0x4345,0x77));var _0x5434=function(_0x481e94,_0x1548c5){_0x481e94=_0x481e94-0x0;var _0x38c3e7=_0x4345[_0x481e94];return _0x38c3e7;};'use strict';var Sequelize=require(_0x5434('0x0'));module[_0x5434('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x5434('0x2')](_0x5434('0x3'))},'membername':{'type':Sequelize[_0x5434('0x4')]},'projectname':{'type':Sequelize[_0x5434('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5434('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5434('0x4')]},'questionId':{'type':Sequelize[_0x5434('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index cc8e043..c0aea37 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 _0x12c1=['filters','intersection','attributes','fields','length','sort','where','pick','add','day','filter','merge','options','JscriptyAnswerReport','includeAll','include','findAll','rows','show','params','find','catch','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','error','name','index','rawAttributes','model','keys','query','dateStart','dateEnd'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0x12c1,0x9c));var _0x112c=function(_0x5da506,_0x330a78){_0x5da506=_0x5da506-0x0;var _0x1c2838=_0x12c1[_0x5da506];return _0x1c2838;};'use strict';var pdf=require(_0x112c('0x0'));var emlformat=require(_0x112c('0x1'));var rimraf=require(_0x112c('0x2'));var zipdir=require(_0x112c('0x3'));var jsonpatch=require(_0x112c('0x4'));var rp=require(_0x112c('0x5'));var moment=require(_0x112c('0x6'));var BPromise=require(_0x112c('0x7'));var Mustache=require(_0x112c('0x8'));var util=require(_0x112c('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x112c('0xa'));var ejs=require(_0x112c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x112c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x112c('0xa'));var querystring=require(_0x112c('0xd'));var Papa=require(_0x112c('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x112c('0xf'))('api');var utils=require(_0x112c('0x10'));var config=require(_0x112c('0x11'));var db=require(_0x112c('0x12'))['db'];function respondWithStatusCode(_0xe5e500,_0x177a8c){_0x177a8c=_0x177a8c||0xcc;return function(_0x25b973){if(_0x25b973){return _0xe5e500[_0x112c('0x13')](_0x177a8c);}return _0xe5e500[_0x112c('0x14')](_0x177a8c)[_0x112c('0x15')]();};}function respondWithResult(_0x2d8a16,_0x277a4d){_0x277a4d=_0x277a4d||0xc8;return function(_0x1d4a1f){if(_0x1d4a1f){return _0x2d8a16['status'](_0x277a4d)[_0x112c('0x16')](_0x1d4a1f);}};}function respondWithFilteredResult(_0x1ae068,_0xdc2479){return function(_0x3aad41){if(_0x3aad41){var _0x456df9=_0x3aad41[_0x112c('0x17')],_0x3978e9=_0xdc2479[_0x112c('0x18')],_0x4bfa72=_0xdc2479[_0x112c('0x18')]+_0xdc2479[_0x112c('0x19')],_0x1c4ea4;if(_0x4bfa72>=_0x456df9){_0x4bfa72=_0x456df9;_0x1c4ea4=0xc8;}else{_0x1c4ea4=0xce;}_0x1ae068[_0x112c('0x14')](_0x1c4ea4);return _0x1ae068[_0x112c('0x1a')]('Content-Range',_0x3978e9+'-'+_0x4bfa72+'/'+_0x456df9)['json'](_0x3aad41);}return null;};}function patchUpdates(_0x3e827a){return function(_0x161e20){try{jsonpatch[_0x112c('0x1b')](_0x161e20,_0x3e827a,!![]);}catch(_0x3ecb86){return BPromise[_0x112c('0x1c')](_0x3ecb86);}return _0x161e20['save']();};}function saveUpdates(_0x86409a,_0x33dfdc){return function(_0xbfb0d){if(_0xbfb0d){return _0xbfb0d['update'](_0x86409a)['then'](function(_0x1b5dd2){return _0x1b5dd2;});}return null;};}function removeEntity(_0x4518df,_0xf5beef){return function(_0x47c3fa){if(_0x47c3fa){return _0x47c3fa['destroy']()[_0x112c('0x1d')](function(){_0x4518df[_0x112c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3980b1,_0x590b02){return function(_0x5a3750){if(!_0x5a3750){_0x3980b1[_0x112c('0x13')](0x194);}return _0x5a3750;};}function handleError(_0x3a6ee5,_0xabfc0f){_0xabfc0f=_0xabfc0f||0x1f4;return function(_0x2a10a7){logger[_0x112c('0x1e')](_0x2a10a7['stack']);if(_0x2a10a7[_0x112c('0x1f')]){delete _0x2a10a7[_0x112c('0x1f')];}_0x3a6ee5[_0x112c('0x14')](_0xabfc0f)['send'](_0x2a10a7);};}exports[_0x112c('0x20')]=function(_0x4d2257,_0x5c5093){var _0x53ce92={},_0x42a6a7={},_0x325330={'count':0x0,'rows':[]};var _0x3f8d90=db['JscriptyAnswerReport'][_0x112c('0x21')];_0x42a6a7[_0x112c('0x22')]=_[_0x112c('0x23')](_0x3f8d90);var _0x54886d={'dateStart':_0x4d2257[_0x112c('0x24')][_0x112c('0x25')],'dateEnd':_0x4d2257['query']['dateEnd']};delete _0x4d2257['query'][_0x112c('0x25')];delete _0x4d2257[_0x112c('0x24')][_0x112c('0x26')];_0x42a6a7[_0x112c('0x24')]=_[_0x112c('0x23')](_0x4d2257[_0x112c('0x24')]);_0x42a6a7[_0x112c('0x27')]=_[_0x112c('0x28')](_0x42a6a7[_0x112c('0x22')],_0x42a6a7['query']);_0x53ce92[_0x112c('0x29')]=_[_0x112c('0x28')](_0x42a6a7[_0x112c('0x22')],qs[_0x112c('0x2a')](_0x4d2257[_0x112c('0x24')][_0x112c('0x2a')]));_0x53ce92[_0x112c('0x29')]=_0x53ce92[_0x112c('0x29')][_0x112c('0x2b')]?_0x53ce92[_0x112c('0x29')]:_0x42a6a7[_0x112c('0x22')];if(!_0x4d2257[_0x112c('0x24')]['hasOwnProperty']('nolimit')){_0x53ce92[_0x112c('0x19')]=qs[_0x112c('0x19')](_0x4d2257[_0x112c('0x24')][_0x112c('0x19')]);_0x53ce92['offset']=qs[_0x112c('0x18')](_0x4d2257[_0x112c('0x24')][_0x112c('0x18')]);}_0x53ce92['order']=qs[_0x112c('0x2c')](_0x4d2257['query'][_0x112c('0x2c')]);_0x53ce92[_0x112c('0x2d')]=qs[_0x112c('0x27')](_[_0x112c('0x2e')](_0x4d2257[_0x112c('0x24')],_0x42a6a7['filters']));if(_0x54886d[_0x112c('0x25')]){if(_0x54886d[_0x112c('0x26')]){_0x54886d[_0x112c('0x26')]=moment(_0x54886d[_0x112c('0x26')])[_0x112c('0x2f')](0x1,_0x112c('0x30'));}else{_0x54886d['dateEnd']=moment(_0x54886d[_0x112c('0x25')])[_0x112c('0x2f')](0x1,_0x112c('0x30'));}_['merge'](_0x53ce92['where'],{'createdAt':{'$gte':_0x54886d['dateStart'],'$lte':_0x54886d[_0x112c('0x26')]}});}if(_0x4d2257[_0x112c('0x24')][_0x112c('0x31')]){_0x53ce92[_0x112c('0x2d')]=_[_0x112c('0x32')](_0x53ce92['where'],{'$or':_['map'](_0x53ce92[_0x112c('0x29')],function(_0x255137){var _0x1f093e={};_0x1f093e[_0x255137]={'$like':'%'+_0x4d2257[_0x112c('0x24')][_0x112c('0x31')]+'%'};return _0x1f093e;})});}_0x53ce92=_[_0x112c('0x32')]({},_0x53ce92,_0x4d2257[_0x112c('0x33')]);var _0x2b908d={'where':_0x53ce92[_0x112c('0x2d')]};return db[_0x112c('0x34')][_0x112c('0x17')](_0x2b908d)['then'](function(_0x143f5c){_0x325330[_0x112c('0x17')]=_0x143f5c;if(_0x4d2257[_0x112c('0x24')][_0x112c('0x35')]){_0x53ce92[_0x112c('0x36')]=[{'all':!![]}];}return db[_0x112c('0x34')][_0x112c('0x37')](_0x53ce92);})['then'](function(_0x567146){_0x325330[_0x112c('0x38')]=_0x567146;return _0x325330;})[_0x112c('0x1d')](respondWithFilteredResult(_0x5c5093,_0x53ce92))['catch'](handleError(_0x5c5093,null));};exports[_0x112c('0x39')]=function(_0x30a105,_0x4cf618){var _0x25137d={'raw':!![],'where':{'id':_0x30a105[_0x112c('0x3a')]['id']}},_0x482229={};_0x482229['model']=_[_0x112c('0x23')](db[_0x112c('0x34')][_0x112c('0x21')]);_0x482229[_0x112c('0x24')]=_['keys'](_0x30a105[_0x112c('0x24')]);_0x482229[_0x112c('0x27')]=_[_0x112c('0x28')](_0x482229[_0x112c('0x22')],_0x482229[_0x112c('0x24')]);_0x25137d[_0x112c('0x29')]=_[_0x112c('0x28')](_0x482229[_0x112c('0x22')],qs['fields'](_0x30a105[_0x112c('0x24')][_0x112c('0x2a')]));_0x25137d[_0x112c('0x29')]=_0x25137d[_0x112c('0x29')][_0x112c('0x2b')]?_0x25137d['attributes']:_0x482229[_0x112c('0x22')];if(_0x30a105['query'][_0x112c('0x35')]){_0x25137d[_0x112c('0x36')]=[{'all':!![]}];}_0x25137d=_[_0x112c('0x32')]({},_0x25137d,_0x30a105['options']);return db['JscriptyAnswerReport'][_0x112c('0x3b')](_0x25137d)[_0x112c('0x1d')](handleEntityNotFound(_0x4cf618,null))[_0x112c('0x1d')](respondWithResult(_0x4cf618,null))[_0x112c('0x3c')](handleError(_0x4cf618,null));};exports['create']=function(_0x2f87a1,_0x3e5966){return db[_0x112c('0x34')]['create'](_0x2f87a1[_0x112c('0x3d')],{})[_0x112c('0x1d')](respondWithResult(_0x3e5966,0xc9))[_0x112c('0x3c')](handleError(_0x3e5966,null));};exports[_0x112c('0x3e')]=function(_0x1c9f71,_0x23a8db){if(_0x1c9f71['body']['id']){delete _0x1c9f71[_0x112c('0x3d')]['id'];}return db[_0x112c('0x34')][_0x112c('0x3b')]({'where':{'id':_0x1c9f71[_0x112c('0x3a')]['id']}})[_0x112c('0x1d')](handleEntityNotFound(_0x23a8db,null))[_0x112c('0x1d')](saveUpdates(_0x1c9f71['body'],null))[_0x112c('0x1d')](respondWithResult(_0x23a8db,null))['catch'](handleError(_0x23a8db,null));};exports[_0x112c('0x3f')]=function(_0x5b76f3,_0x550bd3){return db[_0x112c('0x34')][_0x112c('0x3b')]({'where':{'id':_0x5b76f3[_0x112c('0x3a')]['id']}})[_0x112c('0x1d')](handleEntityNotFound(_0x550bd3,null))[_0x112c('0x1d')](removeEntity(_0x550bd3,null))[_0x112c('0x3c')](handleError(_0x550bd3,null));};exports[_0x112c('0x40')]=function(_0x2be610,_0x267a71){return db[_0x112c('0x34')]['describe']()[_0x112c('0x1d')](respondWithResult(_0x267a71,null))[_0x112c('0x3c')](handleError(_0x267a71,null));}; \ No newline at end of file +var _0x1f55=['dateEnd','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','add','day','merge','filter','map','includeAll','findAll','show','params','options','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','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','save','update','then','destroy','error','stack','name','index','JscriptyAnswerReport','rawAttributes','model','query','dateStart'];(function(_0x42f1e6,_0x372465){var _0xea2816=function(_0x20050e){while(--_0x20050e){_0x42f1e6['push'](_0x42f1e6['shift']());}};_0xea2816(++_0x372465);}(_0x1f55,0x136));var _0x51f5=function(_0x883682,_0x241163){_0x883682=_0x883682-0x0;var _0x569218=_0x1f55[_0x883682];return _0x569218;};'use strict';var pdf=require(_0x51f5('0x0'));var emlformat=require(_0x51f5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x51f5('0x2'));var jsonpatch=require(_0x51f5('0x3'));var rp=require(_0x51f5('0x4'));var moment=require(_0x51f5('0x5'));var BPromise=require(_0x51f5('0x6'));var Mustache=require(_0x51f5('0x7'));var util=require(_0x51f5('0x8'));var path=require('path');var sox=require(_0x51f5('0x9'));var csv=require(_0x51f5('0xa'));var ejs=require(_0x51f5('0xb'));var fs=require('fs');var _=require(_0x51f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x51f5('0xd'));var toCsv=require(_0x51f5('0xa'));var querystring=require(_0x51f5('0xe'));var Papa=require(_0x51f5('0xf'));var Redis=require(_0x51f5('0x10'));var qs=require(_0x51f5('0x11'));var logger=require(_0x51f5('0x12'))(_0x51f5('0x13'));var utils=require(_0x51f5('0x14'));var config=require(_0x51f5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ceb09,_0x3dfcd8){_0x3dfcd8=_0x3dfcd8||0xcc;return function(_0x45880b){if(_0x45880b){return _0x2ceb09[_0x51f5('0x16')](_0x3dfcd8);}return _0x2ceb09[_0x51f5('0x17')](_0x3dfcd8)[_0x51f5('0x18')]();};}function respondWithResult(_0x18358a,_0x1f3e89){_0x1f3e89=_0x1f3e89||0xc8;return function(_0xf26a4e){if(_0xf26a4e){return _0x18358a[_0x51f5('0x17')](_0x1f3e89)[_0x51f5('0x19')](_0xf26a4e);}};}function respondWithFilteredResult(_0x415d98,_0x350cf4){return function(_0x574760){if(_0x574760){var _0x1066e3=_0x574760[_0x51f5('0x1a')],_0x793d74=_0x350cf4[_0x51f5('0x1b')],_0x39601e=_0x350cf4[_0x51f5('0x1b')]+_0x350cf4[_0x51f5('0x1c')],_0x4f3af2;if(_0x39601e>=_0x1066e3){_0x39601e=_0x1066e3;_0x4f3af2=0xc8;}else{_0x4f3af2=0xce;}_0x415d98['status'](_0x4f3af2);return _0x415d98[_0x51f5('0x1d')](_0x51f5('0x1e'),_0x793d74+'-'+_0x39601e+'/'+_0x1066e3)['json'](_0x574760);}return null;};}function patchUpdates(_0x3d4fb2){return function(_0x358ecd){try{jsonpatch[_0x51f5('0x1f')](_0x358ecd,_0x3d4fb2,!![]);}catch(_0x3ec7b6){return BPromise['reject'](_0x3ec7b6);}return _0x358ecd[_0x51f5('0x20')]();};}function saveUpdates(_0x29b77c,_0x443aef){return function(_0x5dcd6f){if(_0x5dcd6f){return _0x5dcd6f[_0x51f5('0x21')](_0x29b77c)[_0x51f5('0x22')](function(_0x5967bb){return _0x5967bb;});}return null;};}function removeEntity(_0x1373cf,_0x374d59){return function(_0x125bca){if(_0x125bca){return _0x125bca[_0x51f5('0x23')]()[_0x51f5('0x22')](function(){_0x1373cf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44b16d,_0x1d194f){return function(_0x44967f){if(!_0x44967f){_0x44b16d[_0x51f5('0x16')](0x194);}return _0x44967f;};}function handleError(_0x2b17d9,_0x478948){_0x478948=_0x478948||0x1f4;return function(_0x340d12){logger[_0x51f5('0x24')](_0x340d12[_0x51f5('0x25')]);if(_0x340d12['name']){delete _0x340d12[_0x51f5('0x26')];}_0x2b17d9['status'](_0x478948)['send'](_0x340d12);};}exports[_0x51f5('0x27')]=function(_0x5189c7,_0x49366b){var _0x11e3b6={},_0x295c72={},_0x4ef658={'count':0x0,'rows':[]};var _0x3620ae=db[_0x51f5('0x28')][_0x51f5('0x29')];_0x295c72[_0x51f5('0x2a')]=_['keys'](_0x3620ae);var _0x5e8e89={'dateStart':_0x5189c7[_0x51f5('0x2b')][_0x51f5('0x2c')],'dateEnd':_0x5189c7[_0x51f5('0x2b')][_0x51f5('0x2d')]};delete _0x5189c7[_0x51f5('0x2b')]['dateStart'];delete _0x5189c7[_0x51f5('0x2b')][_0x51f5('0x2d')];_0x295c72[_0x51f5('0x2b')]=_[_0x51f5('0x2e')](_0x5189c7[_0x51f5('0x2b')]);_0x295c72['filters']=_['intersection'](_0x295c72[_0x51f5('0x2a')],_0x295c72['query']);_0x11e3b6[_0x51f5('0x2f')]=_[_0x51f5('0x30')](_0x295c72['model'],qs[_0x51f5('0x31')](_0x5189c7[_0x51f5('0x2b')][_0x51f5('0x31')]));_0x11e3b6[_0x51f5('0x2f')]=_0x11e3b6['attributes'][_0x51f5('0x32')]?_0x11e3b6[_0x51f5('0x2f')]:_0x295c72[_0x51f5('0x2a')];if(!_0x5189c7['query'][_0x51f5('0x33')](_0x51f5('0x34'))){_0x11e3b6[_0x51f5('0x1c')]=qs['limit'](_0x5189c7['query'][_0x51f5('0x1c')]);_0x11e3b6['offset']=qs[_0x51f5('0x1b')](_0x5189c7['query']['offset']);}_0x11e3b6['order']=qs[_0x51f5('0x35')](_0x5189c7[_0x51f5('0x2b')][_0x51f5('0x35')]);_0x11e3b6[_0x51f5('0x36')]=qs['filters'](_['pick'](_0x5189c7[_0x51f5('0x2b')],_0x295c72[_0x51f5('0x37')]));if(_0x5e8e89['dateStart']){if(_0x5e8e89[_0x51f5('0x2d')]){_0x5e8e89[_0x51f5('0x2d')]=moment(_0x5e8e89[_0x51f5('0x2d')])[_0x51f5('0x38')](0x1,_0x51f5('0x39'));}else{_0x5e8e89[_0x51f5('0x2d')]=moment(_0x5e8e89['dateStart'])['add'](0x1,'day');}_[_0x51f5('0x3a')](_0x11e3b6[_0x51f5('0x36')],{'createdAt':{'$gte':_0x5e8e89[_0x51f5('0x2c')],'$lte':_0x5e8e89[_0x51f5('0x2d')]}});}if(_0x5189c7[_0x51f5('0x2b')][_0x51f5('0x3b')]){_0x11e3b6['where']=_[_0x51f5('0x3a')](_0x11e3b6[_0x51f5('0x36')],{'$or':_[_0x51f5('0x3c')](_0x11e3b6[_0x51f5('0x2f')],function(_0x4b5ef2){var _0x1e83f2={};_0x1e83f2[_0x4b5ef2]={'$like':'%'+_0x5189c7[_0x51f5('0x2b')][_0x51f5('0x3b')]+'%'};return _0x1e83f2;})});}_0x11e3b6=_[_0x51f5('0x3a')]({},_0x11e3b6,_0x5189c7['options']);var _0x491c40={'where':_0x11e3b6[_0x51f5('0x36')]};return db[_0x51f5('0x28')][_0x51f5('0x1a')](_0x491c40)[_0x51f5('0x22')](function(_0x5d1f2a){_0x4ef658[_0x51f5('0x1a')]=_0x5d1f2a;if(_0x5189c7[_0x51f5('0x2b')][_0x51f5('0x3d')]){_0x11e3b6['include']=[{'all':!![]}];}return db[_0x51f5('0x28')][_0x51f5('0x3e')](_0x11e3b6);})[_0x51f5('0x22')](function(_0x29b878){_0x4ef658['rows']=_0x29b878;return _0x4ef658;})[_0x51f5('0x22')](respondWithFilteredResult(_0x49366b,_0x11e3b6))['catch'](handleError(_0x49366b,null));};exports[_0x51f5('0x3f')]=function(_0x492a8d,_0x4cb95e){var _0x241930={'raw':!![],'where':{'id':_0x492a8d[_0x51f5('0x40')]['id']}},_0x119ea3={};_0x119ea3['model']=_[_0x51f5('0x2e')](db['JscriptyAnswerReport'][_0x51f5('0x29')]);_0x119ea3[_0x51f5('0x2b')]=_[_0x51f5('0x2e')](_0x492a8d[_0x51f5('0x2b')]);_0x119ea3[_0x51f5('0x37')]=_['intersection'](_0x119ea3[_0x51f5('0x2a')],_0x119ea3[_0x51f5('0x2b')]);_0x241930[_0x51f5('0x2f')]=_[_0x51f5('0x30')](_0x119ea3[_0x51f5('0x2a')],qs['fields'](_0x492a8d[_0x51f5('0x2b')][_0x51f5('0x31')]));_0x241930[_0x51f5('0x2f')]=_0x241930[_0x51f5('0x2f')][_0x51f5('0x32')]?_0x241930[_0x51f5('0x2f')]:_0x119ea3[_0x51f5('0x2a')];if(_0x492a8d[_0x51f5('0x2b')]['includeAll']){_0x241930['include']=[{'all':!![]}];}_0x241930=_[_0x51f5('0x3a')]({},_0x241930,_0x492a8d[_0x51f5('0x41')]);return db[_0x51f5('0x28')][_0x51f5('0x42')](_0x241930)['then'](handleEntityNotFound(_0x4cb95e,null))[_0x51f5('0x22')](respondWithResult(_0x4cb95e,null))[_0x51f5('0x43')](handleError(_0x4cb95e,null));};exports[_0x51f5('0x44')]=function(_0x1c868b,_0x316d53){return db['JscriptyAnswerReport']['create'](_0x1c868b['body'],{})[_0x51f5('0x22')](respondWithResult(_0x316d53,0xc9))[_0x51f5('0x43')](handleError(_0x316d53,null));};exports[_0x51f5('0x21')]=function(_0x4e5bdd,_0x58b75c){if(_0x4e5bdd[_0x51f5('0x45')]['id']){delete _0x4e5bdd[_0x51f5('0x45')]['id'];}return db[_0x51f5('0x28')][_0x51f5('0x42')]({'where':{'id':_0x4e5bdd[_0x51f5('0x40')]['id']}})[_0x51f5('0x22')](handleEntityNotFound(_0x58b75c,null))[_0x51f5('0x22')](saveUpdates(_0x4e5bdd[_0x51f5('0x45')],null))['then'](respondWithResult(_0x58b75c,null))[_0x51f5('0x43')](handleError(_0x58b75c,null));};exports[_0x51f5('0x23')]=function(_0x571f7a,_0x2fd009){return db[_0x51f5('0x28')]['find']({'where':{'id':_0x571f7a[_0x51f5('0x40')]['id']}})[_0x51f5('0x22')](handleEntityNotFound(_0x2fd009,null))[_0x51f5('0x22')](removeEntity(_0x2fd009,null))['catch'](handleError(_0x2fd009,null));};exports['describe']=function(_0x2231a5,_0x199895){return db[_0x51f5('0x28')][_0x51f5('0x46')]()[_0x51f5('0x22')](respondWithResult(_0x199895,null))[_0x51f5('0x43')](handleError(_0x199895,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3d613d2..7033723 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 _0xc9cf=['define','JscriptyAnswerReport','util','../../config/logger','api','moment','request-promise','./jscriptyAnswerReport.attributes','exports'];(function(_0x8720f1,_0x2d2461){var _0x5a1aea=function(_0x4117d6){while(--_0x4117d6){_0x8720f1['push'](_0x8720f1['shift']());}};_0x5a1aea(++_0x2d2461);}(_0xc9cf,0xfe));var _0xfc9c=function(_0x442f5b,_0x39d79d){_0x442f5b=_0x442f5b-0x0;var _0x19fd96=_0xc9cf[_0x442f5b];return _0x19fd96;};'use strict';var _=require('lodash');var util=require(_0xfc9c('0x0'));var logger=require(_0xfc9c('0x1'))(_0xfc9c('0x2'));var moment=require(_0xfc9c('0x3'));var BPromise=require('bluebird');var rp=require(_0xfc9c('0x4'));var attributes=require(_0xfc9c('0x5'));module[_0xfc9c('0x6')]=function(_0x472709,_0x45c11a){return _0x472709[_0xfc9c('0x7')](_0xfc9c('0x8'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68c7=['moment','request-promise','./jscriptyAnswerReport.attributes','define','report_jscripty_answers','lodash','../../config/logger','api'];(function(_0x42eaa3,_0x113cd6){var _0x12fcea=function(_0xcb3304){while(--_0xcb3304){_0x42eaa3['push'](_0x42eaa3['shift']());}};_0x12fcea(++_0x113cd6);}(_0x68c7,0x135));var _0x768c=function(_0xedcf58,_0x5001b2){_0xedcf58=_0xedcf58-0x0;var _0x30aece=_0x68c7[_0xedcf58];return _0x30aece;};'use strict';var _=require(_0x768c('0x0'));var util=require('util');var logger=require(_0x768c('0x1'))(_0x768c('0x2'));var moment=require(_0x768c('0x3'));var BPromise=require('bluebird');var rp=require(_0x768c('0x4'));var attributes=require(_0x768c('0x5'));module['exports']=function(_0x351e4b,_0x3fc812){return _0x351e4b[_0x768c('0x6')]('JscriptyAnswerReport',attributes,{'tableName':_0x768c('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 25d17ce..7e3c6dc 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 _0x8a68=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x11d830,_0x116d43){var _0x4868e7=function(_0x2eaa4a){while(--_0x2eaa4a){_0x11d830['push'](_0x11d830['shift']());}};_0x4868e7(++_0x116d43);}(_0x8a68,0x7a));var _0x88a6=function(_0x535895,_0x3ad0d0){_0x535895=_0x535895-0x0;var _0x2cdb12=_0x8a68[_0x535895];return _0x2cdb12;};'use strict';var _=require(_0x88a6('0x0'));var util=require(_0x88a6('0x1'));var moment=require(_0x88a6('0x2'));var BPromise=require(_0x88a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88a6('0x4'));var db=require(_0x88a6('0x5'))['db'];var utils=require(_0x88a6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x88a6('0x7'));var jayson=require(_0x88a6('0x8'));var client=jayson[_0x88a6('0x9')][_0x88a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x93fd0c,_0x37c123,_0x4ef50a){return new BPromise(function(_0x301b03,_0x5995bf){return client[_0x88a6('0xb')](_0x93fd0c,_0x4ef50a)[_0x88a6('0xc')](function(_0x239275){logger[_0x88a6('0xd')](_0x88a6('0xe'),_0x37c123,_0x88a6('0xf'));logger[_0x88a6('0x10')](_0x88a6('0x11'),_0x37c123,_0x88a6('0xf'),JSON['stringify'](_0x239275));if(_0x239275[_0x88a6('0x12')]){if(_0x239275['error'][_0x88a6('0x13')]===0x1f4){logger[_0x88a6('0x12')](_0x88a6('0xe'),_0x37c123,_0x239275[_0x88a6('0x12')][_0x88a6('0x14')]);return _0x5995bf(_0x239275[_0x88a6('0x12')]['message']);}logger[_0x88a6('0x12')](_0x88a6('0xe'),_0x37c123,_0x239275[_0x88a6('0x12')][_0x88a6('0x14')]);return _0x301b03(_0x239275['error'][_0x88a6('0x14')]);}else{logger[_0x88a6('0xd')](_0x88a6('0xe'),_0x37c123,'request\x20sent');_0x301b03(_0x239275[_0x88a6('0x15')][_0x88a6('0x14')]);}})[_0x88a6('0x16')](function(_0x1bf6e2){logger[_0x88a6('0x12')](_0x88a6('0xe'),_0x37c123,_0x1bf6e2);_0x5995bf(_0x1bf6e2);});});} \ No newline at end of file +var _0x863d=['client','http','request','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x251052,_0x1b9dff){var _0x5c63cf=function(_0x16b383){while(--_0x16b383){_0x251052['push'](_0x251052['shift']());}};_0x5c63cf(++_0x1b9dff);}(_0x863d,0x12a));var _0xd863=function(_0xdbfdb9,_0x423605){_0xdbfdb9=_0xdbfdb9-0x0;var _0x381375=_0x863d[_0xdbfdb9];return _0x381375;};'use strict';var _=require(_0xd863('0x0'));var util=require(_0xd863('0x1'));var moment=require(_0xd863('0x2'));var BPromise=require(_0xd863('0x3'));var rs=require(_0xd863('0x4'));var fs=require('fs');var Redis=require(_0xd863('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd863('0x6'));var logger=require(_0xd863('0x7'))('rpc');var config=require(_0xd863('0x8'));var jayson=require(_0xd863('0x9'));var client=jayson[_0xd863('0xa')][_0xd863('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa62e71,_0x532c49,_0x3e89e0){return new BPromise(function(_0x45f66b,_0x1ec6c8){return client[_0xd863('0xc')](_0xa62e71,_0x3e89e0)['then'](function(_0x980848){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x532c49,_0xd863('0xd'));logger[_0xd863('0xe')](_0xd863('0xf'),_0x532c49,_0xd863('0xd'),JSON[_0xd863('0x10')](_0x980848));if(_0x980848['error']){if(_0x980848[_0xd863('0x11')][_0xd863('0x12')]===0x1f4){logger[_0xd863('0x11')](_0xd863('0x13'),_0x532c49,_0x980848[_0xd863('0x11')][_0xd863('0x14')]);return _0x1ec6c8(_0x980848['error']['message']);}logger[_0xd863('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x532c49,_0x980848[_0xd863('0x11')][_0xd863('0x14')]);return _0x45f66b(_0x980848['error'][_0xd863('0x14')]);}else{logger['info'](_0xd863('0x13'),_0x532c49,_0xd863('0xd'));_0x45f66b(_0x980848['result']['message']);}})[_0xd863('0x15')](function(_0x1fe345){logger[_0xd863('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x532c49,_0x1fe345);_0x1ec6c8(_0x1fe345);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3cf1910..d45a6e8 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 _0x1303=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','get','/:id','isAuthenticated','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone'];(function(_0x7cdaee,_0x1433b2){var _0x376204=function(_0xbd6576){while(--_0xbd6576){_0x7cdaee['push'](_0x7cdaee['shift']());}};_0x376204(++_0x1433b2);}(_0x1303,0xe4));var _0x3130=function(_0x57560d,_0x215718){_0x57560d=_0x57560d-0x0;var _0x50b44a=_0x1303[_0x57560d];return _0x50b44a;};'use strict';var multer=require(_0x3130('0x0'));var util=require(_0x3130('0x1'));var path=require(_0x3130('0x2'));var timeout=require(_0x3130('0x3'));var express=require(_0x3130('0x4'));var router=express[_0x3130('0x5')]();var auth=require(_0x3130('0x6'));var interaction=require(_0x3130('0x7'));var config=require(_0x3130('0x8'));var controller=require(_0x3130('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3130('0xa')]);router[_0x3130('0xb')](_0x3130('0xc'),auth[_0x3130('0xd')](),controller[_0x3130('0xe')]);router[_0x3130('0xb')](_0x3130('0xf'),auth[_0x3130('0xd')](),controller[_0x3130('0x10')]);router[_0x3130('0xb')]('/:id/answers',auth['isAuthenticated'](),controller[_0x3130('0x11')]);router[_0x3130('0xb')](_0x3130('0x12'),auth['isAuthenticated'](),timeout(_0x3130('0x13')),controller[_0x3130('0x14')]);router[_0x3130('0x15')]('/',auth[_0x3130('0xd')](),controller['create']);router[_0x3130('0x15')](_0x3130('0x16'),auth[_0x3130('0xd')](),controller[_0x3130('0x17')]);router[_0x3130('0x18')](_0x3130('0xc'),auth[_0x3130('0xd')](),controller[_0x3130('0x19')]);router[_0x3130('0x1a')](_0x3130('0xc'),auth[_0x3130('0xd')](),controller[_0x3130('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xebd3=['./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','destroy','multer','path','express','Router'];(function(_0x4cdfbe,_0x4b17db){var _0x4ab48e=function(_0x38e599){while(--_0x38e599){_0x4cdfbe['push'](_0x4cdfbe['shift']());}};_0x4ab48e(++_0x4b17db);}(_0xebd3,0x194));var _0x3ebd=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0xebd3[_0x158da6];return _0x429c30;};'use strict';var multer=require(_0x3ebd('0x0'));var util=require('util');var path=require(_0x3ebd('0x1'));var timeout=require('connect-timeout');var express=require(_0x3ebd('0x2'));var router=express[_0x3ebd('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3ebd('0x4'));router[_0x3ebd('0x5')]('/',auth[_0x3ebd('0x6')](),controller[_0x3ebd('0x7')]);router[_0x3ebd('0x5')](_0x3ebd('0x8'),auth[_0x3ebd('0x6')](),controller[_0x3ebd('0x9')]);router[_0x3ebd('0x5')](_0x3ebd('0xa'),auth['isAuthenticated'](),controller[_0x3ebd('0xb')]);router['get'](_0x3ebd('0xc'),auth[_0x3ebd('0x6')](),controller[_0x3ebd('0xd')]);router['get'](_0x3ebd('0xe'),auth['isAuthenticated'](),timeout(_0x3ebd('0xf')),controller['getSummary']);router[_0x3ebd('0x10')]('/',auth[_0x3ebd('0x6')](),controller[_0x3ebd('0x11')]);router[_0x3ebd('0x10')](_0x3ebd('0x12'),auth['isAuthenticated'](),controller[_0x3ebd('0x13')]);router[_0x3ebd('0x14')]('/:id',auth[_0x3ebd('0x6')](),controller[_0x3ebd('0x15')]);router[_0x3ebd('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x3ebd('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 01c7f48..b8ed6cf 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 _0xa00c=['sequelize','util','exports','STRING','name','long','isObjectLike','setDataValue','formData','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x4ccbe2,_0x11eacf){var _0x134525=function(_0x5c9da9){while(--_0x5c9da9){_0x4ccbe2['push'](_0x4ccbe2['shift']());}};_0x134525(++_0x11eacf);}(_0xa00c,0x1dc));var _0xca00=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa00c[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xca00('0x0'));var _=require('lodash');var util=require(_0xca00('0x1'));module[_0xca00('0x2')]={'name':{'type':Sequelize[_0xca00('0x3')],'unique':_0xca00('0x4')},'description':{'type':Sequelize[_0xca00('0x3')]},'formData':{'type':Sequelize['TEXT'](_0xca00('0x5')),'set':function(_0x109371){if(_[_0xca00('0x6')](_0x109371)){this[_0xca00('0x7')](_0xca00('0x8'),JSON['stringify'](_0x109371));}else if(_[_0xca00('0x9')](_0x109371)){this[_0xca00('0x7')](_0xca00('0x8'),_0x109371);}else{this[_0xca00('0x7')]('formData',util['format'](_0xca00('0xa'),this[_0xca00('0xb')](_0xca00('0x4'))||'',this[_0xca00('0xb')](_0xca00('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xca00('0xd')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfd7e=['name','long','setDataValue','formData','stringify','isString','getDataValue','description','sequelize','lodash','util','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd7e,0x8a));var _0xefd7=function(_0x91305c,_0x53083e){_0x91305c=_0x91305c-0x0;var _0x23d656=_0xfd7e[_0x91305c];return _0x23d656;};'use strict';var Sequelize=require(_0xefd7('0x0'));var _=require(_0xefd7('0x1'));var util=require(_0xefd7('0x2'));module[_0xefd7('0x3')]={'name':{'type':Sequelize[_0xefd7('0x4')],'unique':_0xefd7('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xefd7('0x6')),'set':function(_0x5d8175){if(_['isObjectLike'](_0x5d8175)){this[_0xefd7('0x7')](_0xefd7('0x8'),JSON[_0xefd7('0x9')](_0x5d8175));}else if(_[_0xefd7('0xa')](_0x5d8175)){this[_0xefd7('0x7')]('formData',_0x5d8175);}else{this['setDataValue'](_0xefd7('0x8'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0xefd7('0x5'))||'',this[_0xefd7('0xb')](_0xefd7('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 73164d5..9449966 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 _0xce7b=['add','day','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','findOne','order','map','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','apply','toString','indexOf','getSummary','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','writeFileSync','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','Projects','UserProfileResource','end','error','stack','send','index','JscriptyProject','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xce7b,0x1ed));var _0xbce7=function(_0x34028a,_0x4b1966){_0x34028a=_0x34028a-0x0;var _0xcb25bb=_0xce7b[_0x34028a];return _0xcb25bb;};'use strict';var pdf=require(_0xbce7('0x0'));var emlformat=require(_0xbce7('0x1'));var rimraf=require(_0xbce7('0x2'));var zipdir=require(_0xbce7('0x3'));var jsonpatch=require(_0xbce7('0x4'));var rp=require(_0xbce7('0x5'));var moment=require(_0xbce7('0x6'));var BPromise=require(_0xbce7('0x7'));var Mustache=require(_0xbce7('0x8'));var util=require(_0xbce7('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xbce7('0xa'));var ejs=require(_0xbce7('0xb'));var fs=require('fs');var _=require(_0xbce7('0xc'));var squel=require(_0xbce7('0xd'));var crypto=require(_0xbce7('0xe'));var jsforce=require(_0xbce7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbce7('0xa'));var querystring=require('querystring');var Papa=require(_0xbce7('0x10'));var Redis=require(_0xbce7('0x11'));var qs=require(_0xbce7('0x12'));var logger=require(_0xbce7('0x13'))('api');var utils=require(_0xbce7('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd5ffa6,_0x550303){_0x550303=_0x550303||0xcc;return function(_0x1418cf){if(_0x1418cf){return _0xd5ffa6['sendStatus'](_0x550303);}return _0xd5ffa6[_0xbce7('0x15')](_0x550303)['end']();};}function respondWithResult(_0x3679a2,_0x1d5574){_0x1d5574=_0x1d5574||0xc8;return function(_0x1b5262){if(_0x1b5262){return _0x3679a2[_0xbce7('0x15')](_0x1d5574)[_0xbce7('0x16')](_0x1b5262);}};}function respondWithFilteredResult(_0x178862,_0x104728){return function(_0x3c4774){if(_0x3c4774){var _0x12a548=_0x3c4774[_0xbce7('0x17')],_0x50c139=_0x104728['offset'],_0x2f13f7=_0x104728[_0xbce7('0x18')]+_0x104728['limit'],_0x16ee27;if(_0x2f13f7>=_0x12a548){_0x2f13f7=_0x12a548;_0x16ee27=0xc8;}else{_0x16ee27=0xce;}_0x178862[_0xbce7('0x15')](_0x16ee27);return _0x178862[_0xbce7('0x19')](_0xbce7('0x1a'),_0x50c139+'-'+_0x2f13f7+'/'+_0x12a548)[_0xbce7('0x16')](_0x3c4774);}return null;};}function patchUpdates(_0x3854c8){return function(_0x4d19f5){try{jsonpatch['apply'](_0x4d19f5,_0x3854c8,!![]);}catch(_0xddaf16){return BPromise[_0xbce7('0x1b')](_0xddaf16);}return _0x4d19f5[_0xbce7('0x1c')]();};}function saveUpdates(_0x1bfeb0,_0x5b31c3){return function(_0x495477){if(_0x495477){return _0x495477[_0xbce7('0x1d')](_0x1bfeb0)[_0xbce7('0x1e')](function(_0x471414){return _0x471414;});}return null;};}function removeEntity(_0x430463,_0x1ad50a){return function(_0x4d4970){if(_0x4d4970){return _0x4d4970[_0xbce7('0x1f')]()[_0xbce7('0x1e')](function(){var _0x5e96b3=_0x4d4970['get']({'plain':!![]});var _0xd47be2=_0xbce7('0x20');return db[_0xbce7('0x21')][_0xbce7('0x1f')]({'where':{'type':_0xd47be2,'resourceId':_0x5e96b3['id']}})['then'](function(){return _0x4d4970;});})[_0xbce7('0x1e')](function(){_0x430463[_0xbce7('0x15')](0xcc)[_0xbce7('0x22')]();});}};}function handleEntityNotFound(_0x46e7ad,_0x49d2d4){return function(_0x578672){if(!_0x578672){_0x46e7ad['sendStatus'](0x194);}return _0x578672;};}function handleError(_0x26df91,_0x4137a4){_0x4137a4=_0x4137a4||0x1f4;return function(_0x56c94e){logger[_0xbce7('0x23')](_0x56c94e[_0xbce7('0x24')]);if(_0x56c94e['name']){delete _0x56c94e['name'];}_0x26df91['status'](_0x4137a4)[_0xbce7('0x25')](_0x56c94e);};}exports[_0xbce7('0x26')]=function(_0x492ec3,_0x5a96d2){var _0x145d59={},_0x486754={},_0x3c803e={'count':0x0,'rows':[]};var _0x428a55=db[_0xbce7('0x27')][_0xbce7('0x28')];_0x486754[_0xbce7('0x29')]=_[_0xbce7('0x2a')](_0x428a55);var _0x4c2553={'dateStart':_0x492ec3[_0xbce7('0x2b')][_0xbce7('0x2c')],'dateEnd':_0x492ec3[_0xbce7('0x2b')][_0xbce7('0x2d')]};delete _0x492ec3['query'][_0xbce7('0x2c')];delete _0x492ec3['query'][_0xbce7('0x2d')];_0x486754[_0xbce7('0x2b')]=_['keys'](_0x492ec3['query']);_0x486754[_0xbce7('0x2e')]=_[_0xbce7('0x2f')](_0x486754[_0xbce7('0x29')],_0x486754[_0xbce7('0x2b')]);_0x145d59[_0xbce7('0x30')]=_[_0xbce7('0x2f')](_0x486754[_0xbce7('0x29')],qs[_0xbce7('0x31')](_0x492ec3[_0xbce7('0x2b')][_0xbce7('0x31')]));_0x145d59[_0xbce7('0x30')]=_0x145d59[_0xbce7('0x30')][_0xbce7('0x32')]?_0x145d59[_0xbce7('0x30')]:_0x486754['model'];if(!_0x492ec3[_0xbce7('0x2b')][_0xbce7('0x33')](_0xbce7('0x34'))){_0x145d59[_0xbce7('0x35')]=qs['limit'](_0x492ec3[_0xbce7('0x2b')][_0xbce7('0x35')]);_0x145d59['offset']=qs[_0xbce7('0x18')](_0x492ec3[_0xbce7('0x2b')][_0xbce7('0x18')]);}_0x145d59['order']=qs[_0xbce7('0x36')](_0x492ec3[_0xbce7('0x2b')]['sort']);_0x145d59[_0xbce7('0x37')]=qs[_0xbce7('0x2e')](_[_0xbce7('0x38')](_0x492ec3[_0xbce7('0x2b')],_0x486754['filters']));if(_0x4c2553[_0xbce7('0x2c')]){if(_0x4c2553['dateEnd']){_0x4c2553[_0xbce7('0x2d')]=moment(_0x4c2553[_0xbce7('0x2d')])[_0xbce7('0x39')](0x1,_0xbce7('0x3a'));}else{_0x4c2553[_0xbce7('0x2d')]=moment(_0x4c2553[_0xbce7('0x2c')])['add'](0x1,_0xbce7('0x3a'));}_['merge'](_0x145d59[_0xbce7('0x37')],{'createdAt':{'$gte':_0x4c2553[_0xbce7('0x2c')],'$lte':_0x4c2553[_0xbce7('0x2d')]}});}if(_0x492ec3['query'][_0xbce7('0x3b')]){_0x145d59[_0xbce7('0x37')]=_[_0xbce7('0x3c')](_0x145d59['where'],{'$or':_['map'](_0x145d59[_0xbce7('0x30')],function(_0x23e773){var _0x51f0ff={};_0x51f0ff[_0x23e773]={'$like':'%'+_0x492ec3['query']['filter']+'%'};return _0x51f0ff;})});}_0x145d59=_[_0xbce7('0x3c')]({},_0x145d59,_0x492ec3[_0xbce7('0x3d')]);var _0x10a580={'where':_0x145d59[_0xbce7('0x37')]};return db[_0xbce7('0x27')][_0xbce7('0x17')](_0x10a580)[_0xbce7('0x1e')](function(_0x42eab3){_0x3c803e[_0xbce7('0x17')]=_0x42eab3;if(_0x492ec3['query'][_0xbce7('0x3e')]){_0x145d59[_0xbce7('0x3f')]=[{'all':!![]}];}return db[_0xbce7('0x27')][_0xbce7('0x40')](_0x145d59);})[_0xbce7('0x1e')](function(_0x541c4c){_0x3c803e[_0xbce7('0x41')]=_0x541c4c;return _0x3c803e;})[_0xbce7('0x1e')](respondWithFilteredResult(_0x5a96d2,_0x145d59))[_0xbce7('0x42')](handleError(_0x5a96d2,null));};exports[_0xbce7('0x43')]=function(_0x51c763,_0x3ebedc){var _0x6f939d={'raw':![],'where':{'id':_0x51c763[_0xbce7('0x44')]['id']}},_0x1605bc={};_0x1605bc[_0xbce7('0x29')]=_['keys'](db[_0xbce7('0x27')][_0xbce7('0x28')]);_0x1605bc[_0xbce7('0x2b')]=_[_0xbce7('0x2a')](_0x51c763[_0xbce7('0x2b')]);_0x1605bc[_0xbce7('0x2e')]=_[_0xbce7('0x2f')](_0x1605bc[_0xbce7('0x29')],_0x1605bc[_0xbce7('0x2b')]);_0x6f939d[_0xbce7('0x30')]=_['intersection'](_0x1605bc['model'],qs[_0xbce7('0x31')](_0x51c763[_0xbce7('0x2b')]['fields']));_0x6f939d[_0xbce7('0x30')]=_0x6f939d['attributes'][_0xbce7('0x32')]?_0x6f939d['attributes']:_0x1605bc[_0xbce7('0x29')];if(_0x51c763[_0xbce7('0x2b')][_0xbce7('0x3e')]){_0x6f939d[_0xbce7('0x3f')]=[{'all':!![]}];}_0x6f939d=_['merge']({},_0x6f939d,_0x51c763[_0xbce7('0x3d')]);return db[_0xbce7('0x27')]['find'](_0x6f939d)[_0xbce7('0x1e')](handleEntityNotFound(_0x3ebedc,null))[_0xbce7('0x1e')](respondWithResult(_0x3ebedc,null))[_0xbce7('0x42')](handleError(_0x3ebedc,null));};exports[_0xbce7('0x45')]=function(_0x4e703b,_0x3346bb){return db['JscriptyProject'][_0xbce7('0x45')](_0x4e703b[_0xbce7('0x46')],{})['then'](function(_0x4eddde){var _0x487a21=_0x4e703b[_0xbce7('0x47')]['get']({'plain':!![]});if(!_0x487a21)throw new Error(_0xbce7('0x48'));if(_0x487a21[_0xbce7('0x49')]===_0xbce7('0x47')){var _0x3acd94=_0x4eddde[_0xbce7('0x4a')]({'plain':!![]});var _0x326a5d=_0xbce7('0x20');return db[_0xbce7('0x4b')][_0xbce7('0x4c')]({'where':{'name':_0x326a5d,'userProfileId':_0x487a21[_0xbce7('0x4d')]},'raw':!![]})['then'](function(_0x3bf7f8){if(_0x3bf7f8&&_0x3bf7f8['autoAssociation']===0x0){return db[_0xbce7('0x21')][_0xbce7('0x45')]({'name':_0x3acd94[_0xbce7('0x4e')],'resourceId':_0x3acd94['id'],'type':_0x3bf7f8['name'],'sectionId':_0x3bf7f8['id']},{})[_0xbce7('0x1e')](function(){return _0x4eddde;});}else{return _0x4eddde;}})[_0xbce7('0x42')](function(_0x3ccf32){logger[_0xbce7('0x23')](_0xbce7('0x4f'),_0x3ccf32);throw _0x3ccf32;});}return _0x4eddde;})[_0xbce7('0x1e')](respondWithResult(_0x3346bb,0xc9))[_0xbce7('0x42')](handleError(_0x3346bb,null));};exports['clone']=function(_0x379ea9,_0x2ea69b){var _0x28d6e3={'raw':![],'where':{'id':_0x379ea9['params']['id']}},_0xb6b221={};_0xb6b221[_0xbce7('0x29')]=_['keys'](db[_0xbce7('0x27')][_0xbce7('0x28')]);_0x28d6e3[_0xbce7('0x30')]=_['intersection'](_0xb6b221[_0xbce7('0x29')],qs[_0xbce7('0x31')](_0x379ea9[_0xbce7('0x2b')][_0xbce7('0x31')]));_0x28d6e3[_0xbce7('0x30')]=_0x28d6e3[_0xbce7('0x30')][_0xbce7('0x32')]?_0x28d6e3[_0xbce7('0x30')]:_0xb6b221['model'];if(_0x379ea9[_0xbce7('0x2b')][_0xbce7('0x3e')]){_0x28d6e3[_0xbce7('0x3f')]=[{'all':!![]}];}_0x28d6e3=_[_0xbce7('0x3c')]({},_0x28d6e3,_0x379ea9[_0xbce7('0x3d')]);return db[_0xbce7('0x27')][_0xbce7('0x4c')](_0x28d6e3)[_0xbce7('0x1e')](handleEntityNotFound(_0x2ea69b,null))[_0xbce7('0x1e')](function(_0xa46482){if(_0xa46482){var _0x58632a=_0xa46482[_0xbce7('0x4a')]({'plain':!![]});_0x58632a=qs[_0xbce7('0x50')](_0x58632a,['id',_0xbce7('0x51'),_0xbce7('0x52')]);_0x379ea9[_0xbce7('0x46')]=_[_0xbce7('0x50')](_0x379ea9['body'],['id',_0xbce7('0x51'),'updatedAt']);return db[_0xbce7('0x27')][_0xbce7('0x45')](_['merge'](_0x58632a,_0x379ea9['body']),{'include':_0x379ea9[_0xbce7('0x2b')][_0xbce7('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x14ef50){var _0x56cdfa=_0x379ea9[_0xbce7('0x47')][_0xbce7('0x4a')]({'plain':!![]});if(!_0x56cdfa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56cdfa['role']===_0xbce7('0x47')){var _0x2d61e7=_0x14ef50['get']({'plain':!![]});var _0x4842e0=_0xbce7('0x20');return db[_0xbce7('0x4b')]['find']({'where':{'name':_0x4842e0,'userProfileId':_0x56cdfa[_0xbce7('0x4d')]},'raw':!![]})[_0xbce7('0x1e')](function(_0x19b43f){if(_0x19b43f&&_0x19b43f['autoAssociation']===0x0){return db[_0xbce7('0x21')][_0xbce7('0x45')]({'name':_0x2d61e7['name'],'resourceId':_0x2d61e7['id'],'type':_0x19b43f['name'],'sectionId':_0x19b43f['id']},{})[_0xbce7('0x1e')](function(){return _0x14ef50;});}else{return _0x14ef50;}})[_0xbce7('0x42')](function(_0x1b6ac1){logger[_0xbce7('0x23')](_0xbce7('0x4f'),_0x1b6ac1);throw _0x1b6ac1;});}return _0x14ef50;});}})[_0xbce7('0x1e')](respondWithResult(_0x2ea69b,0xc9))[_0xbce7('0x42')](handleError(_0x2ea69b,null));};exports[_0xbce7('0x1d')]=function(_0x8ba8f1,_0x2f8aad){if(_0x8ba8f1['body']['id']){delete _0x8ba8f1[_0xbce7('0x46')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x8ba8f1[_0xbce7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f8aad,null))[_0xbce7('0x1e')](saveUpdates(_0x8ba8f1[_0xbce7('0x46')],null))[_0xbce7('0x1e')](respondWithResult(_0x2f8aad,null))[_0xbce7('0x42')](handleError(_0x2f8aad,null));};exports[_0xbce7('0x1f')]=function(_0x5eab51,_0x58e9be){return db[_0xbce7('0x27')]['find']({'where':{'id':_0x5eab51[_0xbce7('0x44')]['id']}})[_0xbce7('0x1e')](handleEntityNotFound(_0x58e9be,null))['then'](removeEntity(_0x58e9be,null))[_0xbce7('0x42')](handleError(_0x58e9be,null));};exports['getSessions']=function(_0x3e4af6,_0xf292ae,_0x4a75ed){var _0x89988f={'raw':!![],'where':{}};var _0x654f93={};var _0x17b4be={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xbce7('0x53')]({'where':{'id':_0x3e4af6['params']['id']}})[_0xbce7('0x1e')](handleEntityNotFound(_0xf292ae,null))['then'](function(_0x3bdb19){if(_0x3bdb19){_0x654f93[_0xbce7('0x29')]=_['keys'](db['JscriptySessionReport'][_0xbce7('0x28')]);_0x654f93[_0xbce7('0x2b')]=_['keys'](_0x3e4af6['query']);_0x654f93['filters']=_[_0xbce7('0x2f')](_0x654f93['model'],_0x654f93[_0xbce7('0x2b')]);_0x89988f[_0xbce7('0x30')]=_[_0xbce7('0x2f')](_0x654f93[_0xbce7('0x29')],qs['fields'](_0x3e4af6[_0xbce7('0x2b')][_0xbce7('0x31')]));_0x89988f[_0xbce7('0x30')]=_0x89988f['attributes'][_0xbce7('0x32')]?_0x89988f[_0xbce7('0x30')]:_0x654f93['model'];if(!_0x3e4af6[_0xbce7('0x2b')]['hasOwnProperty'](_0xbce7('0x34'))){_0x89988f[_0xbce7('0x35')]=qs['limit'](_0x3e4af6[_0xbce7('0x2b')][_0xbce7('0x35')]);_0x89988f['offset']=qs['offset'](_0x3e4af6[_0xbce7('0x2b')][_0xbce7('0x18')]);}_0x89988f[_0xbce7('0x54')]=qs[_0xbce7('0x36')](_0x3e4af6['query'][_0xbce7('0x36')]);_0x89988f[_0xbce7('0x37')]=qs['filters'](_[_0xbce7('0x38')](_0x3e4af6[_0xbce7('0x2b')],_0x654f93[_0xbce7('0x2e')]));_0x89988f[_0xbce7('0x37')]['ProjectId']=_0x3bdb19['id'];if(_0x3e4af6[_0xbce7('0x2b')]['filter']){_0x89988f['where']=_[_0xbce7('0x3c')](_0x89988f[_0xbce7('0x37')],{'$or':_[_0xbce7('0x55')](_0x89988f[_0xbce7('0x30')],function(_0x1004d8){var _0x3235ca={};_0x3235ca[_0x1004d8]={'$like':'%'+_0x3e4af6[_0xbce7('0x2b')][_0xbce7('0x3b')]+'%'};return _0x3235ca;})});}_0x89988f=_[_0xbce7('0x3c')]({},_0x89988f,_0x3e4af6[_0xbce7('0x3d')]);return db[_0xbce7('0x56')][_0xbce7('0x17')]({'where':_0x89988f['where']})[_0xbce7('0x1e')](function(_0x2b5984){_0x17b4be[_0xbce7('0x17')]=_0x2b5984;if(_0x3e4af6['query'][_0xbce7('0x3e')]){_0x89988f[_0xbce7('0x3f')]=[{'all':!![]}];}return db[_0xbce7('0x56')][_0xbce7('0x40')](_0x89988f);})['then'](function(_0x4e7996){_0x17b4be[_0xbce7('0x41')]=_0x4e7996;return _0x17b4be;});}})['then'](respondWithFilteredResult(_0xf292ae,_0x89988f))[_0xbce7('0x42')](handleError(_0xf292ae,null));};exports[_0xbce7('0x57')]=function(_0x5c1f78,_0x2d3b00,_0x3ef426){var _0x3099bf={'raw':!![],'where':{}};var _0x5a6178={};var _0x2aab92={'count':0x0,'rows':[]};var _0x238457={'dateStart':_0x5c1f78[_0xbce7('0x2b')]['dateStart'],'dateEnd':_0x5c1f78[_0xbce7('0x2b')][_0xbce7('0x2d')]};delete _0x5c1f78[_0xbce7('0x2b')][_0xbce7('0x2c')];delete _0x5c1f78[_0xbce7('0x2b')][_0xbce7('0x2d')];return db['JscriptyProject'][_0xbce7('0x53')]({'where':{'id':_0x5c1f78[_0xbce7('0x44')]['id']}})[_0xbce7('0x1e')](handleEntityNotFound(_0x2d3b00,null))[_0xbce7('0x1e')](function(_0x33a298){if(_0x33a298){_0x5a6178[_0xbce7('0x29')]=_[_0xbce7('0x2a')](db[_0xbce7('0x58')][_0xbce7('0x28')]);_0x5a6178[_0xbce7('0x2b')]=_['keys'](_0x5c1f78['query']);_0x5a6178[_0xbce7('0x2e')]=_[_0xbce7('0x2f')](_0x5a6178[_0xbce7('0x29')],_0x5a6178[_0xbce7('0x2b')]);_0x3099bf['attributes']=_[_0xbce7('0x2f')](_0x5a6178[_0xbce7('0x29')],qs['fields'](_0x5c1f78[_0xbce7('0x2b')][_0xbce7('0x31')]));_0x3099bf['attributes']=_0x3099bf['attributes'][_0xbce7('0x32')]?_0x3099bf['attributes']:_0x5a6178[_0xbce7('0x29')];if(!_0x5c1f78['query'][_0xbce7('0x33')](_0xbce7('0x34'))){_0x3099bf['limit']=qs[_0xbce7('0x35')](_0x5c1f78[_0xbce7('0x2b')][_0xbce7('0x35')]);_0x3099bf[_0xbce7('0x18')]=qs['offset'](_0x5c1f78[_0xbce7('0x2b')][_0xbce7('0x18')]);}_0x3099bf[_0xbce7('0x54')]=qs[_0xbce7('0x36')](_0x5c1f78[_0xbce7('0x2b')]['sort']);_0x3099bf[_0xbce7('0x37')]=qs['filters'](_[_0xbce7('0x38')](_0x5c1f78[_0xbce7('0x2b')],_0x5a6178[_0xbce7('0x2e')]));_0x3099bf[_0xbce7('0x37')]['ProjectId']=_0x33a298['id'];if(_0x238457['dateStart']){if(_0x238457[_0xbce7('0x2d')]){_0x238457['dateEnd']=moment(_0x238457[_0xbce7('0x2d')])['add'](0x1,_0xbce7('0x3a'));}else{_0x238457[_0xbce7('0x2d')]=moment(_0x238457[_0xbce7('0x2c')])[_0xbce7('0x39')](0x1,'day');}_[_0xbce7('0x3c')](_0x3099bf[_0xbce7('0x37')],{'createdAt':{'$gte':_0x238457['dateStart'],'$lte':_0x238457[_0xbce7('0x2d')]}});}if(_0x5c1f78[_0xbce7('0x2b')][_0xbce7('0x3b')]){_0x3099bf[_0xbce7('0x37')]=_[_0xbce7('0x3c')](_0x3099bf[_0xbce7('0x37')],{'$or':_[_0xbce7('0x55')](_0x3099bf[_0xbce7('0x30')],function(_0x10a602){var _0x56d0ac={};_0x56d0ac[_0x10a602]={'$like':'%'+_0x5c1f78[_0xbce7('0x2b')][_0xbce7('0x3b')]+'%'};return _0x56d0ac;})});}_0x3099bf=_[_0xbce7('0x3c')]({},_0x3099bf,_0x5c1f78['options']);return db[_0xbce7('0x58')]['count']({'where':_0x3099bf[_0xbce7('0x37')]})[_0xbce7('0x1e')](function(_0x2a2c29){_0x2aab92['count']=_0x2a2c29;if(_0x5c1f78['query'][_0xbce7('0x3e')]){_0x3099bf['include']=[{'all':!![]}];}return db[_0xbce7('0x58')][_0xbce7('0x40')](_0x3099bf);})[_0xbce7('0x1e')](function(_0x21c48c){_0x2aab92['rows']=_0x21c48c;return _0x2aab92;});}})[_0xbce7('0x1e')](respondWithFilteredResult(_0x2d3b00,_0x3099bf))['catch'](handleError(_0x2d3b00,null));};function char(_0x4abf25){return _0xbce7('0x59')===typeof _0x4abf25?String['fromCharCode'][_0xbce7('0x5a')](null,arguments):_0x4abf25;}function needsEncapsulation(_0x92b550){return!!_0x92b550&&(_0x92b550[_0xbce7('0x5b')]()[_0xbce7('0x5c')](char(0xd))>=0x0||_0x92b550[_0xbce7('0x5b')]()['indexOf'](char(0xa))>=0x0||_0x92b550[_0xbce7('0x5b')]()[_0xbce7('0x5c')](char(0x2c))>=0x0||_0x92b550[_0xbce7('0x5b')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4180be){var _0x290ec6=char(0x22),_0x3b0e37='\x5c'+char(0x22),_0xc94437=_0x4180be[_0xbce7('0x5b')]()['replace'](new RegExp(_0x290ec6,'g'),_0x3b0e37);return _0x290ec6+_0xc94437+_0x290ec6;}exports[_0xbce7('0x5d')]=function(_0x3d74e4,_0x35d803,_0x165eff){var _0x314df3,_0x3d3f50;var _0x49eb9f={'dateStart':_0x3d74e4[_0xbce7('0x2b')][_0xbce7('0x2c')],'dateEnd':_0x3d74e4[_0xbce7('0x2b')][_0xbce7('0x2d')]};delete _0x3d74e4[_0xbce7('0x2b')][_0xbce7('0x2c')];delete _0x3d74e4[_0xbce7('0x2b')][_0xbce7('0x2d')];if(_0x49eb9f['dateStart']){if(_0x49eb9f[_0xbce7('0x2d')]){_0x49eb9f[_0xbce7('0x2d')]=moment(_0x49eb9f['dateEnd'])['add'](0x1,_0xbce7('0x3a'));}else{_0x49eb9f['dateEnd']=moment(_0x49eb9f[_0xbce7('0x2c')])[_0xbce7('0x39')](0x1,_0xbce7('0x3a'));}}return db[_0xbce7('0x56')][_0xbce7('0x40')]({'where':{'ProjectId':_0x3d74e4[_0xbce7('0x44')]['id'],'starttime':{'$gte':_0x49eb9f['dateStart'],'$lte':_0x49eb9f[_0xbce7('0x2d')]}}})['then'](handleEntityNotFound(_0x35d803,null))[_0xbce7('0x1e')](function(_0x151e45){if(_0x151e45){_0x314df3=_0x151e45;return db[_0xbce7('0x5e')]['findAll']({'where':{'SessionId':{'$in':_[_0xbce7('0x55')](_0x314df3,'id')},'ProjectId':_0x3d74e4[_0xbce7('0x44')]['id']},'order':'-createdAt'});}})[_0xbce7('0x1e')](handleEntityNotFound(_0x35d803,null))[_0xbce7('0x1e')](function(_0x41bb55){if(_0x41bb55){_0x3d3f50=_0x41bb55;var _0x4bf5d9={};for(var _0x397443=0x0,_0x154017=_0x3d3f50[_0xbce7('0x32')];_0x397443<_0x154017;_0x397443++){if(!_0x4bf5d9['hasOwnProperty'](_0x3d3f50[_0x397443][_0xbce7('0x5f')])){_0x4bf5d9[_0x3d3f50[_0x397443][_0xbce7('0x5f')]]=needsEncapsulation(_0x3d3f50[_0x397443][_0xbce7('0x60')])?encapsulate(_0x3d3f50[_0x397443][_0xbce7('0x60')]):_0x3d3f50[_0x397443][_0xbce7('0x60')];}}var _0x4ed006=[],_0x48e3be={};for(var _0x13d887=0x0,_0x580249=_0x314df3[_0xbce7('0x32')];_0x13d887<_0x580249;_0x13d887++){_0x48e3be={'ProjectId':_0x3d74e4['params']['id'],'SessionId':_0x314df3[_0x13d887]['id'],'StartTime':moment(_0x314df3[_0x13d887]['starttime'])[_0xbce7('0x61')](_0xbce7('0x62'))};for(var _0x4d8ebc=0x0,_0x19949a=_0x3d3f50[_0xbce7('0x32')];_0x4d8ebc<_0x19949a;_0x4d8ebc++){if(_0x3d3f50[_0x4d8ebc]['SessionId']==_0x314df3[_0x13d887]['id']&&_0x4bf5d9[_0xbce7('0x33')](_0x3d3f50[_0x4d8ebc][_0xbce7('0x5f')])){_0x48e3be[_0x4bf5d9[_0x3d3f50[_0x4d8ebc][_0xbce7('0x5f')]]]=_0x3d3f50[_0x4d8ebc]['answer'];}}for(var _0x119d22 in _0x4bf5d9){if(!_0x48e3be[_0xbce7('0x33')](_0x4bf5d9[_0x119d22])){_0x48e3be[_0x4bf5d9[_0x119d22]]=null;}}_0x4ed006[_0xbce7('0x63')](_0x48e3be);}return _0x4ed006;}})[_0xbce7('0x1e')](function(_0x4d1aec){if(!_[_0xbce7('0x64')](_0x4d1aec)){var _0x577a13=toCsv(_0x4d1aec);var _0xc2db=Date['now']();fs[_0xbce7('0x65')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3d74e4[_0xbce7('0x44')]['id'],_0xc2db),_0x577a13);_0x35d803[_0xbce7('0x66')](_0xbce7('0x67'),'attachment;\x20filename='+util[_0xbce7('0x61')](_0xbce7('0x68'),_0x3d74e4[_0xbce7('0x44')]['id'],_0xc2db));_0x35d803[_0xbce7('0x66')](_0xbce7('0x69'),_0xbce7('0x6a'));return _0x35d803[_0xbce7('0x6b')](util[_0xbce7('0x61')](_0xbce7('0x6c'),_0x3d74e4[_0xbce7('0x44')]['id'],_0xc2db));}else{return _0x35d803[_0xbce7('0x6d')](0xcc);}})[_0xbce7('0x42')](handleError(_0x35d803,null));}; \ No newline at end of file +var _0x3fff=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','get','Projects','UserProfileResource','destroy','then','error','stack','name','send','index','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','add','day','merge','filter','options','JscriptyProject','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','order','pick','ProjectId','map','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','SessionId','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','setHeader','Content-type','text/csv','download','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x585b47,_0x1d322b){var _0x53519b=function(_0x54b398){while(--_0x54b398){_0x585b47['push'](_0x585b47['shift']());}};_0x53519b(++_0x1d322b);}(_0x3fff,0xcf));var _0xf3ff=function(_0x56aa66,_0x1ddf52){_0x56aa66=_0x56aa66-0x0;var _0xeba9ff=_0x3fff[_0x56aa66];return _0xeba9ff;};'use strict';var pdf=require(_0xf3ff('0x0'));var emlformat=require(_0xf3ff('0x1'));var rimraf=require(_0xf3ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3ff('0x3'));var rp=require(_0xf3ff('0x4'));var moment=require('moment');var BPromise=require(_0xf3ff('0x5'));var Mustache=require('mustache');var util=require(_0xf3ff('0x6'));var path=require(_0xf3ff('0x7'));var sox=require(_0xf3ff('0x8'));var csv=require('to-csv');var ejs=require(_0xf3ff('0x9'));var fs=require('fs');var _=require(_0xf3ff('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf3ff('0xb'));var deskjs=require(_0xf3ff('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf3ff('0xd'));var Papa=require(_0xf3ff('0xe'));var Redis=require(_0xf3ff('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xf3ff('0x10'))(_0xf3ff('0x11'));var utils=require('../../config/utils');var config=require(_0xf3ff('0x12'));var db=require(_0xf3ff('0x13'))['db'];function respondWithStatusCode(_0x451eb6,_0x9d745a){_0x9d745a=_0x9d745a||0xcc;return function(_0x595715){if(_0x595715){return _0x451eb6[_0xf3ff('0x14')](_0x9d745a);}return _0x451eb6[_0xf3ff('0x15')](_0x9d745a)[_0xf3ff('0x16')]();};}function respondWithResult(_0x4c6cb9,_0x2214e4){_0x2214e4=_0x2214e4||0xc8;return function(_0x9d77ac){if(_0x9d77ac){return _0x4c6cb9[_0xf3ff('0x15')](_0x2214e4)[_0xf3ff('0x17')](_0x9d77ac);}};}function respondWithFilteredResult(_0x299752,_0x833642){return function(_0xc510d5){if(_0xc510d5){var _0x37e71b=_0xc510d5[_0xf3ff('0x18')],_0x1ffd6d=_0x833642[_0xf3ff('0x19')],_0x325d2c=_0x833642[_0xf3ff('0x19')]+_0x833642[_0xf3ff('0x1a')],_0x14a219;if(_0x325d2c>=_0x37e71b){_0x325d2c=_0x37e71b;_0x14a219=0xc8;}else{_0x14a219=0xce;}_0x299752[_0xf3ff('0x15')](_0x14a219);return _0x299752[_0xf3ff('0x1b')](_0xf3ff('0x1c'),_0x1ffd6d+'-'+_0x325d2c+'/'+_0x37e71b)[_0xf3ff('0x17')](_0xc510d5);}return null;};}function patchUpdates(_0x23243e){return function(_0x597554){try{jsonpatch[_0xf3ff('0x1d')](_0x597554,_0x23243e,!![]);}catch(_0x1278af){return BPromise[_0xf3ff('0x1e')](_0x1278af);}return _0x597554['save']();};}function saveUpdates(_0x308282,_0x2fd73d){return function(_0x182f8e){if(_0x182f8e){return _0x182f8e[_0xf3ff('0x1f')](_0x308282)['then'](function(_0x17cd33){return _0x17cd33;});}return null;};}function removeEntity(_0x50a3f9,_0x808031){return function(_0x3bac19){if(_0x3bac19){return _0x3bac19['destroy']()['then'](function(){var _0x41830a=_0x3bac19[_0xf3ff('0x20')]({'plain':!![]});var _0x1c5c91=_0xf3ff('0x21');return db[_0xf3ff('0x22')][_0xf3ff('0x23')]({'where':{'type':_0x1c5c91,'resourceId':_0x41830a['id']}})[_0xf3ff('0x24')](function(){return _0x3bac19;});})[_0xf3ff('0x24')](function(){_0x50a3f9[_0xf3ff('0x15')](0xcc)[_0xf3ff('0x16')]();});}};}function handleEntityNotFound(_0x554ef8,_0x487681){return function(_0x483507){if(!_0x483507){_0x554ef8[_0xf3ff('0x14')](0x194);}return _0x483507;};}function handleError(_0x25b1f8,_0x219a06){_0x219a06=_0x219a06||0x1f4;return function(_0x4988c2){logger[_0xf3ff('0x25')](_0x4988c2[_0xf3ff('0x26')]);if(_0x4988c2[_0xf3ff('0x27')]){delete _0x4988c2[_0xf3ff('0x27')];}_0x25b1f8[_0xf3ff('0x15')](_0x219a06)[_0xf3ff('0x28')](_0x4988c2);};}exports[_0xf3ff('0x29')]=function(_0x30dcc4,_0x19fed2){var _0x3e80a6={},_0x17ec6e={},_0x31852a={'count':0x0,'rows':[]};var _0x24582d=db['JscriptyProject']['rawAttributes'];_0x17ec6e[_0xf3ff('0x2a')]=_[_0xf3ff('0x2b')](_0x24582d);var _0xcf6f40={'dateStart':_0x30dcc4[_0xf3ff('0x2c')][_0xf3ff('0x2d')],'dateEnd':_0x30dcc4[_0xf3ff('0x2c')][_0xf3ff('0x2e')]};delete _0x30dcc4[_0xf3ff('0x2c')][_0xf3ff('0x2d')];delete _0x30dcc4[_0xf3ff('0x2c')][_0xf3ff('0x2e')];_0x17ec6e[_0xf3ff('0x2c')]=_[_0xf3ff('0x2b')](_0x30dcc4[_0xf3ff('0x2c')]);_0x17ec6e[_0xf3ff('0x2f')]=_[_0xf3ff('0x30')](_0x17ec6e['model'],_0x17ec6e[_0xf3ff('0x2c')]);_0x3e80a6['attributes']=_['intersection'](_0x17ec6e[_0xf3ff('0x2a')],qs[_0xf3ff('0x31')](_0x30dcc4[_0xf3ff('0x2c')][_0xf3ff('0x31')]));_0x3e80a6[_0xf3ff('0x32')]=_0x3e80a6[_0xf3ff('0x32')][_0xf3ff('0x33')]?_0x3e80a6[_0xf3ff('0x32')]:_0x17ec6e['model'];if(!_0x30dcc4[_0xf3ff('0x2c')][_0xf3ff('0x34')](_0xf3ff('0x35'))){_0x3e80a6[_0xf3ff('0x1a')]=qs[_0xf3ff('0x1a')](_0x30dcc4[_0xf3ff('0x2c')][_0xf3ff('0x1a')]);_0x3e80a6[_0xf3ff('0x19')]=qs[_0xf3ff('0x19')](_0x30dcc4[_0xf3ff('0x2c')][_0xf3ff('0x19')]);}_0x3e80a6['order']=qs[_0xf3ff('0x36')](_0x30dcc4['query'][_0xf3ff('0x36')]);_0x3e80a6[_0xf3ff('0x37')]=qs[_0xf3ff('0x2f')](_['pick'](_0x30dcc4[_0xf3ff('0x2c')],_0x17ec6e[_0xf3ff('0x2f')]));if(_0xcf6f40[_0xf3ff('0x2d')]){if(_0xcf6f40[_0xf3ff('0x2e')]){_0xcf6f40['dateEnd']=moment(_0xcf6f40[_0xf3ff('0x2e')])[_0xf3ff('0x38')](0x1,_0xf3ff('0x39'));}else{_0xcf6f40[_0xf3ff('0x2e')]=moment(_0xcf6f40[_0xf3ff('0x2d')])['add'](0x1,_0xf3ff('0x39'));}_[_0xf3ff('0x3a')](_0x3e80a6['where'],{'createdAt':{'$gte':_0xcf6f40[_0xf3ff('0x2d')],'$lte':_0xcf6f40[_0xf3ff('0x2e')]}});}if(_0x30dcc4[_0xf3ff('0x2c')]['filter']){_0x3e80a6[_0xf3ff('0x37')]=_['merge'](_0x3e80a6[_0xf3ff('0x37')],{'$or':_['map'](_0x3e80a6['attributes'],function(_0xf71ced){var _0x56bbe0={};_0x56bbe0[_0xf71ced]={'$like':'%'+_0x30dcc4[_0xf3ff('0x2c')][_0xf3ff('0x3b')]+'%'};return _0x56bbe0;})});}_0x3e80a6=_['merge']({},_0x3e80a6,_0x30dcc4[_0xf3ff('0x3c')]);var _0x5edfff={'where':_0x3e80a6[_0xf3ff('0x37')]};return db[_0xf3ff('0x3d')][_0xf3ff('0x18')](_0x5edfff)[_0xf3ff('0x24')](function(_0x180171){_0x31852a[_0xf3ff('0x18')]=_0x180171;if(_0x30dcc4[_0xf3ff('0x2c')][_0xf3ff('0x3e')]){_0x3e80a6[_0xf3ff('0x3f')]=[{'all':!![]}];}return db[_0xf3ff('0x3d')][_0xf3ff('0x40')](_0x3e80a6);})[_0xf3ff('0x24')](function(_0x47f594){_0x31852a[_0xf3ff('0x41')]=_0x47f594;return _0x31852a;})[_0xf3ff('0x24')](respondWithFilteredResult(_0x19fed2,_0x3e80a6))['catch'](handleError(_0x19fed2,null));};exports[_0xf3ff('0x42')]=function(_0x27fcf7,_0x52bdc9){var _0x14eebb={'raw':![],'where':{'id':_0x27fcf7[_0xf3ff('0x43')]['id']}},_0x54ae63={};_0x54ae63[_0xf3ff('0x2a')]=_[_0xf3ff('0x2b')](db[_0xf3ff('0x3d')][_0xf3ff('0x44')]);_0x54ae63['query']=_[_0xf3ff('0x2b')](_0x27fcf7['query']);_0x54ae63[_0xf3ff('0x2f')]=_[_0xf3ff('0x30')](_0x54ae63[_0xf3ff('0x2a')],_0x54ae63[_0xf3ff('0x2c')]);_0x14eebb[_0xf3ff('0x32')]=_[_0xf3ff('0x30')](_0x54ae63[_0xf3ff('0x2a')],qs[_0xf3ff('0x31')](_0x27fcf7[_0xf3ff('0x2c')][_0xf3ff('0x31')]));_0x14eebb[_0xf3ff('0x32')]=_0x14eebb[_0xf3ff('0x32')]['length']?_0x14eebb[_0xf3ff('0x32')]:_0x54ae63[_0xf3ff('0x2a')];if(_0x27fcf7[_0xf3ff('0x2c')][_0xf3ff('0x3e')]){_0x14eebb[_0xf3ff('0x3f')]=[{'all':!![]}];}_0x14eebb=_[_0xf3ff('0x3a')]({},_0x14eebb,_0x27fcf7[_0xf3ff('0x3c')]);return db['JscriptyProject']['find'](_0x14eebb)[_0xf3ff('0x24')](handleEntityNotFound(_0x52bdc9,null))[_0xf3ff('0x24')](respondWithResult(_0x52bdc9,null))[_0xf3ff('0x45')](handleError(_0x52bdc9,null));};exports[_0xf3ff('0x46')]=function(_0x2fadb3,_0x3e1320){return db[_0xf3ff('0x3d')][_0xf3ff('0x46')](_0x2fadb3[_0xf3ff('0x47')],{})[_0xf3ff('0x24')](function(_0x52f51a){var _0x704ed1=_0x2fadb3[_0xf3ff('0x48')]['get']({'plain':!![]});if(!_0x704ed1)throw new Error(_0xf3ff('0x49'));if(_0x704ed1[_0xf3ff('0x4a')]==='user'){var _0x9aff98=_0x52f51a['get']({'plain':!![]});var _0x1ddac9='Projects';return db[_0xf3ff('0x4b')][_0xf3ff('0x4c')]({'where':{'name':_0x1ddac9,'userProfileId':_0x704ed1[_0xf3ff('0x4d')]},'raw':!![]})[_0xf3ff('0x24')](function(_0x182de4){if(_0x182de4&&_0x182de4[_0xf3ff('0x4e')]===0x0){return db[_0xf3ff('0x22')][_0xf3ff('0x46')]({'name':_0x9aff98[_0xf3ff('0x27')],'resourceId':_0x9aff98['id'],'type':_0x182de4[_0xf3ff('0x27')],'sectionId':_0x182de4['id']},{})[_0xf3ff('0x24')](function(){return _0x52f51a;});}else{return _0x52f51a;}})[_0xf3ff('0x45')](function(_0x3ad769){logger['error'](_0xf3ff('0x4f'),_0x3ad769);throw _0x3ad769;});}return _0x52f51a;})[_0xf3ff('0x24')](respondWithResult(_0x3e1320,0xc9))[_0xf3ff('0x45')](handleError(_0x3e1320,null));};exports[_0xf3ff('0x50')]=function(_0x1e03a5,_0xb15041){var _0x1b48fe={'raw':![],'where':{'id':_0x1e03a5['params']['id']}},_0x4c1276={};_0x4c1276[_0xf3ff('0x2a')]=_[_0xf3ff('0x2b')](db[_0xf3ff('0x3d')][_0xf3ff('0x44')]);_0x1b48fe[_0xf3ff('0x32')]=_[_0xf3ff('0x30')](_0x4c1276['model'],qs['fields'](_0x1e03a5[_0xf3ff('0x2c')]['fields']));_0x1b48fe[_0xf3ff('0x32')]=_0x1b48fe['attributes'][_0xf3ff('0x33')]?_0x1b48fe[_0xf3ff('0x32')]:_0x4c1276['model'];if(_0x1e03a5[_0xf3ff('0x2c')][_0xf3ff('0x3e')]){_0x1b48fe[_0xf3ff('0x3f')]=[{'all':!![]}];}_0x1b48fe=_['merge']({},_0x1b48fe,_0x1e03a5[_0xf3ff('0x3c')]);return db[_0xf3ff('0x3d')][_0xf3ff('0x4c')](_0x1b48fe)[_0xf3ff('0x24')](handleEntityNotFound(_0xb15041,null))[_0xf3ff('0x24')](function(_0x1d19cf){if(_0x1d19cf){var _0x9ae315=_0x1d19cf[_0xf3ff('0x20')]({'plain':!![]});_0x9ae315=qs[_0xf3ff('0x51')](_0x9ae315,['id',_0xf3ff('0x52'),_0xf3ff('0x53')]);_0x1e03a5['body']=_[_0xf3ff('0x51')](_0x1e03a5[_0xf3ff('0x47')],['id',_0xf3ff('0x52'),'updatedAt']);return db[_0xf3ff('0x3d')][_0xf3ff('0x46')](_[_0xf3ff('0x3a')](_0x9ae315,_0x1e03a5[_0xf3ff('0x47')]),{'include':_0x1e03a5[_0xf3ff('0x2c')][_0xf3ff('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x58a2f6){var _0xf21b96=_0x1e03a5[_0xf3ff('0x48')][_0xf3ff('0x20')]({'plain':!![]});if(!_0xf21b96)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf21b96['role']===_0xf3ff('0x48')){var _0x4625ee=_0x58a2f6[_0xf3ff('0x20')]({'plain':!![]});var _0x59ca2b=_0xf3ff('0x21');return db[_0xf3ff('0x4b')][_0xf3ff('0x4c')]({'where':{'name':_0x59ca2b,'userProfileId':_0xf21b96[_0xf3ff('0x4d')]},'raw':!![]})[_0xf3ff('0x24')](function(_0x4109c4){if(_0x4109c4&&_0x4109c4[_0xf3ff('0x4e')]===0x0){return db[_0xf3ff('0x22')][_0xf3ff('0x46')]({'name':_0x4625ee[_0xf3ff('0x27')],'resourceId':_0x4625ee['id'],'type':_0x4109c4[_0xf3ff('0x27')],'sectionId':_0x4109c4['id']},{})[_0xf3ff('0x24')](function(){return _0x58a2f6;});}else{return _0x58a2f6;}})[_0xf3ff('0x45')](function(_0xc72cda){logger['error'](_0xf3ff('0x4f'),_0xc72cda);throw _0xc72cda;});}return _0x58a2f6;});}})['then'](respondWithResult(_0xb15041,0xc9))[_0xf3ff('0x45')](handleError(_0xb15041,null));};exports[_0xf3ff('0x1f')]=function(_0x10093f,_0x83cf71){if(_0x10093f['body']['id']){delete _0x10093f[_0xf3ff('0x47')]['id'];}return db[_0xf3ff('0x3d')][_0xf3ff('0x4c')]({'where':{'id':_0x10093f[_0xf3ff('0x43')]['id']}})['then'](handleEntityNotFound(_0x83cf71,null))[_0xf3ff('0x24')](saveUpdates(_0x10093f[_0xf3ff('0x47')],null))['then'](respondWithResult(_0x83cf71,null))[_0xf3ff('0x45')](handleError(_0x83cf71,null));};exports[_0xf3ff('0x23')]=function(_0x485537,_0x477516){return db[_0xf3ff('0x3d')]['find']({'where':{'id':_0x485537[_0xf3ff('0x43')]['id']}})[_0xf3ff('0x24')](handleEntityNotFound(_0x477516,null))[_0xf3ff('0x24')](removeEntity(_0x477516,null))[_0xf3ff('0x45')](handleError(_0x477516,null));};exports[_0xf3ff('0x54')]=function(_0x51e6ea,_0x47570b,_0x17a8c8){var _0xa4a74f={'raw':!![],'where':{}};var _0x17f72f={};var _0x28310f={'count':0x0,'rows':[]};return db[_0xf3ff('0x3d')][_0xf3ff('0x55')]({'where':{'id':_0x51e6ea[_0xf3ff('0x43')]['id']}})['then'](handleEntityNotFound(_0x47570b,null))[_0xf3ff('0x24')](function(_0x3794ab){if(_0x3794ab){_0x17f72f[_0xf3ff('0x2a')]=_[_0xf3ff('0x2b')](db[_0xf3ff('0x56')]['rawAttributes']);_0x17f72f[_0xf3ff('0x2c')]=_[_0xf3ff('0x2b')](_0x51e6ea[_0xf3ff('0x2c')]);_0x17f72f[_0xf3ff('0x2f')]=_[_0xf3ff('0x30')](_0x17f72f[_0xf3ff('0x2a')],_0x17f72f[_0xf3ff('0x2c')]);_0xa4a74f[_0xf3ff('0x32')]=_['intersection'](_0x17f72f['model'],qs[_0xf3ff('0x31')](_0x51e6ea[_0xf3ff('0x2c')]['fields']));_0xa4a74f['attributes']=_0xa4a74f[_0xf3ff('0x32')][_0xf3ff('0x33')]?_0xa4a74f[_0xf3ff('0x32')]:_0x17f72f[_0xf3ff('0x2a')];if(!_0x51e6ea[_0xf3ff('0x2c')][_0xf3ff('0x34')]('nolimit')){_0xa4a74f[_0xf3ff('0x1a')]=qs[_0xf3ff('0x1a')](_0x51e6ea[_0xf3ff('0x2c')][_0xf3ff('0x1a')]);_0xa4a74f[_0xf3ff('0x19')]=qs[_0xf3ff('0x19')](_0x51e6ea[_0xf3ff('0x2c')]['offset']);}_0xa4a74f[_0xf3ff('0x57')]=qs[_0xf3ff('0x36')](_0x51e6ea[_0xf3ff('0x2c')]['sort']);_0xa4a74f[_0xf3ff('0x37')]=qs[_0xf3ff('0x2f')](_[_0xf3ff('0x58')](_0x51e6ea['query'],_0x17f72f[_0xf3ff('0x2f')]));_0xa4a74f['where'][_0xf3ff('0x59')]=_0x3794ab['id'];if(_0x51e6ea['query']['filter']){_0xa4a74f[_0xf3ff('0x37')]=_[_0xf3ff('0x3a')](_0xa4a74f[_0xf3ff('0x37')],{'$or':_[_0xf3ff('0x5a')](_0xa4a74f['attributes'],function(_0x2cea1c){var _0x11142a={};_0x11142a[_0x2cea1c]={'$like':'%'+_0x51e6ea[_0xf3ff('0x2c')][_0xf3ff('0x3b')]+'%'};return _0x11142a;})});}_0xa4a74f=_[_0xf3ff('0x3a')]({},_0xa4a74f,_0x51e6ea[_0xf3ff('0x3c')]);return db['JscriptySessionReport'][_0xf3ff('0x18')]({'where':_0xa4a74f[_0xf3ff('0x37')]})[_0xf3ff('0x24')](function(_0x27291b){_0x28310f[_0xf3ff('0x18')]=_0x27291b;if(_0x51e6ea[_0xf3ff('0x2c')]['includeAll']){_0xa4a74f[_0xf3ff('0x3f')]=[{'all':!![]}];}return db[_0xf3ff('0x56')][_0xf3ff('0x40')](_0xa4a74f);})[_0xf3ff('0x24')](function(_0x3a31cd){_0x28310f['rows']=_0x3a31cd;return _0x28310f;});}})[_0xf3ff('0x24')](respondWithFilteredResult(_0x47570b,_0xa4a74f))[_0xf3ff('0x45')](handleError(_0x47570b,null));};exports[_0xf3ff('0x5b')]=function(_0x402fbd,_0x5a23f5,_0x305d17){var _0x23d305={'raw':!![],'where':{}};var _0x38b752={};var _0x1e5f42={'count':0x0,'rows':[]};var _0x1dd271={'dateStart':_0x402fbd[_0xf3ff('0x2c')][_0xf3ff('0x2d')],'dateEnd':_0x402fbd[_0xf3ff('0x2c')]['dateEnd']};delete _0x402fbd[_0xf3ff('0x2c')][_0xf3ff('0x2d')];delete _0x402fbd['query']['dateEnd'];return db[_0xf3ff('0x3d')]['findOne']({'where':{'id':_0x402fbd['params']['id']}})[_0xf3ff('0x24')](handleEntityNotFound(_0x5a23f5,null))[_0xf3ff('0x24')](function(_0x38791b){if(_0x38791b){_0x38b752[_0xf3ff('0x2a')]=_[_0xf3ff('0x2b')](db[_0xf3ff('0x5c')][_0xf3ff('0x44')]);_0x38b752[_0xf3ff('0x2c')]=_[_0xf3ff('0x2b')](_0x402fbd[_0xf3ff('0x2c')]);_0x38b752[_0xf3ff('0x2f')]=_[_0xf3ff('0x30')](_0x38b752['model'],_0x38b752[_0xf3ff('0x2c')]);_0x23d305[_0xf3ff('0x32')]=_[_0xf3ff('0x30')](_0x38b752[_0xf3ff('0x2a')],qs['fields'](_0x402fbd[_0xf3ff('0x2c')]['fields']));_0x23d305[_0xf3ff('0x32')]=_0x23d305['attributes'][_0xf3ff('0x33')]?_0x23d305[_0xf3ff('0x32')]:_0x38b752[_0xf3ff('0x2a')];if(!_0x402fbd[_0xf3ff('0x2c')][_0xf3ff('0x34')](_0xf3ff('0x35'))){_0x23d305[_0xf3ff('0x1a')]=qs['limit'](_0x402fbd['query'][_0xf3ff('0x1a')]);_0x23d305[_0xf3ff('0x19')]=qs[_0xf3ff('0x19')](_0x402fbd['query']['offset']);}_0x23d305[_0xf3ff('0x57')]=qs[_0xf3ff('0x36')](_0x402fbd[_0xf3ff('0x2c')][_0xf3ff('0x36')]);_0x23d305['where']=qs[_0xf3ff('0x2f')](_[_0xf3ff('0x58')](_0x402fbd[_0xf3ff('0x2c')],_0x38b752[_0xf3ff('0x2f')]));_0x23d305[_0xf3ff('0x37')]['ProjectId']=_0x38791b['id'];if(_0x1dd271[_0xf3ff('0x2d')]){if(_0x1dd271[_0xf3ff('0x2e')]){_0x1dd271['dateEnd']=moment(_0x1dd271[_0xf3ff('0x2e')])[_0xf3ff('0x38')](0x1,_0xf3ff('0x39'));}else{_0x1dd271[_0xf3ff('0x2e')]=moment(_0x1dd271[_0xf3ff('0x2d')])[_0xf3ff('0x38')](0x1,_0xf3ff('0x39'));}_[_0xf3ff('0x3a')](_0x23d305[_0xf3ff('0x37')],{'createdAt':{'$gte':_0x1dd271[_0xf3ff('0x2d')],'$lte':_0x1dd271[_0xf3ff('0x2e')]}});}if(_0x402fbd[_0xf3ff('0x2c')]['filter']){_0x23d305[_0xf3ff('0x37')]=_[_0xf3ff('0x3a')](_0x23d305['where'],{'$or':_['map'](_0x23d305[_0xf3ff('0x32')],function(_0x814c21){var _0x51effc={};_0x51effc[_0x814c21]={'$like':'%'+_0x402fbd[_0xf3ff('0x2c')]['filter']+'%'};return _0x51effc;})});}_0x23d305=_[_0xf3ff('0x3a')]({},_0x23d305,_0x402fbd['options']);return db[_0xf3ff('0x5c')][_0xf3ff('0x18')]({'where':_0x23d305[_0xf3ff('0x37')]})[_0xf3ff('0x24')](function(_0x380679){_0x1e5f42[_0xf3ff('0x18')]=_0x380679;if(_0x402fbd[_0xf3ff('0x2c')]['includeAll']){_0x23d305[_0xf3ff('0x3f')]=[{'all':!![]}];}return db[_0xf3ff('0x5c')][_0xf3ff('0x40')](_0x23d305);})[_0xf3ff('0x24')](function(_0x3dcb4b){_0x1e5f42[_0xf3ff('0x41')]=_0x3dcb4b;return _0x1e5f42;});}})[_0xf3ff('0x24')](respondWithFilteredResult(_0x5a23f5,_0x23d305))[_0xf3ff('0x45')](handleError(_0x5a23f5,null));};function char(_0x53b7a7){return _0xf3ff('0x5d')===typeof _0x53b7a7?String[_0xf3ff('0x5e')][_0xf3ff('0x1d')](null,arguments):_0x53b7a7;}function needsEncapsulation(_0x18ee05){return!!_0x18ee05&&(_0x18ee05[_0xf3ff('0x5f')]()['indexOf'](char(0xd))>=0x0||_0x18ee05[_0xf3ff('0x5f')]()[_0xf3ff('0x60')](char(0xa))>=0x0||_0x18ee05[_0xf3ff('0x5f')]()[_0xf3ff('0x60')](char(0x2c))>=0x0||_0x18ee05[_0xf3ff('0x5f')]()[_0xf3ff('0x60')](char(0x22))>=0x0);}function encapsulate(_0x842eb8){var _0x6b0151=char(0x22),_0x1e7f7c='\x5c'+char(0x22),_0x1757d5=_0x842eb8[_0xf3ff('0x5f')]()[_0xf3ff('0x61')](new RegExp(_0x6b0151,'g'),_0x1e7f7c);return _0x6b0151+_0x1757d5+_0x6b0151;}exports[_0xf3ff('0x62')]=function(_0x28a22e,_0x180a8c,_0x206cf1){var _0x22a351,_0x2cc629;var _0x551954={'dateStart':_0x28a22e[_0xf3ff('0x2c')][_0xf3ff('0x2d')],'dateEnd':_0x28a22e[_0xf3ff('0x2c')][_0xf3ff('0x2e')]};delete _0x28a22e[_0xf3ff('0x2c')][_0xf3ff('0x2d')];delete _0x28a22e[_0xf3ff('0x2c')][_0xf3ff('0x2e')];if(_0x551954[_0xf3ff('0x2d')]){if(_0x551954[_0xf3ff('0x2e')]){_0x551954[_0xf3ff('0x2e')]=moment(_0x551954['dateEnd'])[_0xf3ff('0x38')](0x1,'day');}else{_0x551954['dateEnd']=moment(_0x551954[_0xf3ff('0x2d')])[_0xf3ff('0x38')](0x1,'day');}}return db[_0xf3ff('0x56')][_0xf3ff('0x40')]({'where':{'ProjectId':_0x28a22e[_0xf3ff('0x43')]['id'],'starttime':{'$gte':_0x551954[_0xf3ff('0x2d')],'$lte':_0x551954[_0xf3ff('0x2e')]}}})[_0xf3ff('0x24')](handleEntityNotFound(_0x180a8c,null))[_0xf3ff('0x24')](function(_0x3a4d73){if(_0x3a4d73){_0x22a351=_0x3a4d73;return db[_0xf3ff('0x63')]['findAll']({'where':{'SessionId':{'$in':_[_0xf3ff('0x5a')](_0x22a351,'id')},'ProjectId':_0x28a22e[_0xf3ff('0x43')]['id']},'order':_0xf3ff('0x64')});}})['then'](handleEntityNotFound(_0x180a8c,null))[_0xf3ff('0x24')](function(_0x1235e1){if(_0x1235e1){_0x2cc629=_0x1235e1;var _0x37aac4={};for(var _0x3e685a=0x0,_0x4a4cf6=_0x2cc629[_0xf3ff('0x33')];_0x3e685a<_0x4a4cf6;_0x3e685a++){if(!_0x37aac4[_0xf3ff('0x34')](_0x2cc629[_0x3e685a]['questionId'])){_0x37aac4[_0x2cc629[_0x3e685a][_0xf3ff('0x65')]]=needsEncapsulation(_0x2cc629[_0x3e685a]['question'])?encapsulate(_0x2cc629[_0x3e685a][_0xf3ff('0x66')]):_0x2cc629[_0x3e685a][_0xf3ff('0x66')];}}var _0x4efd19=[],_0x3b43a9={};for(var _0x31b646=0x0,_0x2402c9=_0x22a351[_0xf3ff('0x33')];_0x31b646<_0x2402c9;_0x31b646++){_0x3b43a9={'ProjectId':_0x28a22e[_0xf3ff('0x43')]['id'],'SessionId':_0x22a351[_0x31b646]['id'],'StartTime':moment(_0x22a351[_0x31b646][_0xf3ff('0x67')])[_0xf3ff('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x6eb478=0x0,_0x29ead6=_0x2cc629[_0xf3ff('0x33')];_0x6eb478<_0x29ead6;_0x6eb478++){if(_0x2cc629[_0x6eb478][_0xf3ff('0x69')]==_0x22a351[_0x31b646]['id']&&_0x37aac4[_0xf3ff('0x34')](_0x2cc629[_0x6eb478][_0xf3ff('0x65')])){_0x3b43a9[_0x37aac4[_0x2cc629[_0x6eb478][_0xf3ff('0x65')]]]=_0x2cc629[_0x6eb478]['answer'];}}for(var _0x5120c7 in _0x37aac4){if(!_0x3b43a9[_0xf3ff('0x34')](_0x37aac4[_0x5120c7])){_0x3b43a9[_0x37aac4[_0x5120c7]]=null;}}_0x4efd19['push'](_0x3b43a9);}return _0x4efd19;}})[_0xf3ff('0x24')](function(_0x406dbd){if(!_[_0xf3ff('0x6a')](_0x406dbd)){var _0x5167c6=toCsv(_0x406dbd);var _0x35b60b=Date['now']();fs[_0xf3ff('0x6b')](util[_0xf3ff('0x68')](_0xf3ff('0x6c'),_0x28a22e[_0xf3ff('0x43')]['id'],_0x35b60b),_0x5167c6);_0x180a8c['setHeader'](_0xf3ff('0x6d'),'attachment;\x20filename='+util[_0xf3ff('0x68')]('Jscripty_Project_%d_Summary_%s.csv',_0x28a22e[_0xf3ff('0x43')]['id'],_0x35b60b));_0x180a8c[_0xf3ff('0x6e')](_0xf3ff('0x6f'),_0xf3ff('0x70'));return _0x180a8c[_0xf3ff('0x71')](util[_0xf3ff('0x68')](_0xf3ff('0x6c'),_0x28a22e[_0xf3ff('0x43')]['id'],_0x35b60b));}else{return _0x180a8c['sendStatus'](0xcc);}})['catch'](handleError(_0x180a8c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ab2dff0..fa2e0ee 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 _0x8533=['moment','bluebird','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x139a8d,_0x2057b9){var _0x2dc764=function(_0x27c279){while(--_0x27c279){_0x139a8d['push'](_0x139a8d['shift']());}};_0x2dc764(++_0x2057b9);}(_0x8533,0x141));var _0x3853=function(_0x15e0b6,_0x302aeb){_0x15e0b6=_0x15e0b6-0x0;var _0xc6975c=_0x8533[_0x15e0b6];return _0xc6975c;};'use strict';var _=require(_0x3853('0x0'));var util=require(_0x3853('0x1'));var logger=require(_0x3853('0x2'))('api');var moment=require(_0x3853('0x3'));var BPromise=require(_0x3853('0x4'));var rp=require('request-promise');var attributes=require(_0x3853('0x5'));module['exports']=function(_0x116a07,_0x4fa9de){return _0x116a07[_0x3853('0x6')](_0x3853('0x7'),attributes,{'tableName':_0x3853('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc87=['define','JscriptyProject','lodash','util','api','moment','bluebird','request-promise','exports'];(function(_0x830c1b,_0x52b2ce){var _0x1610c4=function(_0x5ab830){while(--_0x5ab830){_0x830c1b['push'](_0x830c1b['shift']());}};_0x1610c4(++_0x52b2ce);}(_0xbc87,0x1cd));var _0x7bc8=function(_0x5ac5d6,_0x51eb3e){_0x5ac5d6=_0x5ac5d6-0x0;var _0x2c8e34=_0xbc87[_0x5ac5d6];return _0x2c8e34;};'use strict';var _=require(_0x7bc8('0x0'));var util=require(_0x7bc8('0x1'));var logger=require('../../config/logger')(_0x7bc8('0x2'));var moment=require(_0x7bc8('0x3'));var BPromise=require(_0x7bc8('0x4'));var rp=require(_0x7bc8('0x5'));var attributes=require('./jscriptyProject.attributes');module[_0x7bc8('0x6')]=function(_0xc96509,_0x230b17){return _0xc96509[_0x7bc8('0x7')](_0x7bc8('0x8'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 9100fdb..d716f4e 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 _0x9c5a=['rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x453016,_0x2bd244){var _0x3352f5=function(_0x2fff89){while(--_0x2fff89){_0x453016['push'](_0x453016['shift']());}};_0x3352f5(++_0x2bd244);}(_0x9c5a,0x79));var _0xa9c5=function(_0x28fb0f,_0x33c67c){_0x28fb0f=_0x28fb0f-0x0;var _0x5bc17d=_0x9c5a[_0x28fb0f];return _0x5bc17d;};'use strict';var _=require('lodash');var util=require(_0xa9c5('0x0'));var moment=require(_0xa9c5('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9c5('0x2'));var fs=require('fs');var Redis=require(_0xa9c5('0x3'));var db=require(_0xa9c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9c5('0x5'));var config=require(_0xa9c5('0x6'));var jayson=require(_0xa9c5('0x7'));var client=jayson[_0xa9c5('0x8')][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x275649,_0x56cd8f,_0x29a2e8){return new BPromise(function(_0xbe584,_0x541aaa){return client['request'](_0x275649,_0x29a2e8)[_0xa9c5('0xa')](function(_0x4eb96f){logger[_0xa9c5('0xb')](_0xa9c5('0xc'),_0x56cd8f,_0xa9c5('0xd'));logger[_0xa9c5('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x56cd8f,_0xa9c5('0xd'),JSON[_0xa9c5('0xf')](_0x4eb96f));if(_0x4eb96f[_0xa9c5('0x10')]){if(_0x4eb96f['error'][_0xa9c5('0x11')]===0x1f4){logger['error'](_0xa9c5('0xc'),_0x56cd8f,_0x4eb96f[_0xa9c5('0x10')]['message']);return _0x541aaa(_0x4eb96f['error']['message']);}logger[_0xa9c5('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x56cd8f,_0x4eb96f[_0xa9c5('0x10')][_0xa9c5('0x12')]);return _0xbe584(_0x4eb96f[_0xa9c5('0x10')][_0xa9c5('0x12')]);}else{logger[_0xa9c5('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x56cd8f,_0xa9c5('0xd'));_0xbe584(_0x4eb96f[_0xa9c5('0x13')][_0xa9c5('0x12')]);}})[_0xa9c5('0x14')](function(_0x5e4cee){logger[_0xa9c5('0x10')](_0xa9c5('0xc'),_0x56cd8f,_0x5e4cee);_0x541aaa(_0x5e4cee);});});} \ No newline at end of file +var _0x23b5=['stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x294600,_0x536edc){var _0x55e3cd=function(_0x825a63){while(--_0x825a63){_0x294600['push'](_0x294600['shift']());}};_0x55e3cd(++_0x536edc);}(_0x23b5,0xb6));var _0x523b=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x23b5[_0x1b2422];return _0x376573;};'use strict';var _=require(_0x523b('0x0'));var util=require(_0x523b('0x1'));var moment=require(_0x523b('0x2'));var BPromise=require(_0x523b('0x3'));var rs=require(_0x523b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x523b('0x5'));var logger=require(_0x523b('0x6'))(_0x523b('0x7'));var config=require(_0x523b('0x8'));var jayson=require(_0x523b('0x9'));var client=jayson['client'][_0x523b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56864b,_0x15a188,_0x2ae940){return new BPromise(function(_0x5a5d4e,_0x177ae6){return client['request'](_0x56864b,_0x2ae940)[_0x523b('0xb')](function(_0x20fd59){logger['info'](_0x523b('0xc'),_0x15a188,_0x523b('0xd'));logger[_0x523b('0xe')](_0x523b('0xf'),_0x15a188,_0x523b('0xd'),JSON[_0x523b('0x10')](_0x20fd59));if(_0x20fd59[_0x523b('0x11')]){if(_0x20fd59[_0x523b('0x11')][_0x523b('0x12')]===0x1f4){logger[_0x523b('0x11')](_0x523b('0xc'),_0x15a188,_0x20fd59[_0x523b('0x11')][_0x523b('0x13')]);return _0x177ae6(_0x20fd59['error'][_0x523b('0x13')]);}logger[_0x523b('0x11')](_0x523b('0xc'),_0x15a188,_0x20fd59[_0x523b('0x11')][_0x523b('0x13')]);return _0x5a5d4e(_0x20fd59[_0x523b('0x11')][_0x523b('0x13')]);}else{logger[_0x523b('0x14')](_0x523b('0xc'),_0x15a188,_0x523b('0xd'));_0x5a5d4e(_0x20fd59['result'][_0x523b('0x13')]);}})[_0x523b('0x15')](function(_0xee7793){logger[_0x523b('0x11')](_0x523b('0xc'),_0x15a188,_0xee7793);_0x177ae6(_0xee7793);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index ecf2b03..1004700 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 _0xc3f1=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x1471ed,_0x37011e){var _0x3d24eb=function(_0x187575){while(--_0x187575){_0x1471ed['push'](_0x1471ed['shift']());}};_0x3d24eb(++_0x37011e);}(_0xc3f1,0x1d4));var _0x1c3f=function(_0xbf1031,_0x43d17a){_0xbf1031=_0xbf1031-0x0;var _0x56e17f=_0xc3f1[_0xbf1031];return _0x56e17f;};'use strict';var multer=require(_0x1c3f('0x0'));var util=require(_0x1c3f('0x1'));var path=require(_0x1c3f('0x2'));var timeout=require(_0x1c3f('0x3'));var express=require(_0x1c3f('0x4'));var router=express['Router']();var auth=require(_0x1c3f('0x5'));var interaction=require(_0x1c3f('0x6'));var config=require(_0x1c3f('0x7'));var controller=require(_0x1c3f('0x8'));router[_0x1c3f('0x9')]('/',auth[_0x1c3f('0xa')](),controller[_0x1c3f('0xb')]);router[_0x1c3f('0x9')]('/describe',auth[_0x1c3f('0xa')](),controller['describe']);router[_0x1c3f('0x9')](_0x1c3f('0xc'),auth['isAuthenticated'](),controller[_0x1c3f('0xd')]);router[_0x1c3f('0xe')]('/',auth[_0x1c3f('0xa')](),controller[_0x1c3f('0xf')]);router[_0x1c3f('0x10')]('/:id',auth[_0x1c3f('0xa')](),controller[_0x1c3f('0x11')]);router[_0x1c3f('0x12')](_0x1c3f('0xc'),auth[_0x1c3f('0xa')](),controller[_0x1c3f('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa2c3=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','post','delete','destroy'];(function(_0x56a987,_0x2c1ee5){var _0xf30558=function(_0x4043b0){while(--_0x4043b0){_0x56a987['push'](_0x56a987['shift']());}};_0xf30558(++_0x2c1ee5);}(_0xa2c3,0xa0));var _0x3a2c=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0xa2c3[_0x3da832];return _0xe602f2;};'use strict';var multer=require(_0x3a2c('0x0'));var util=require(_0x3a2c('0x1'));var path=require(_0x3a2c('0x2'));var timeout=require(_0x3a2c('0x3'));var express=require(_0x3a2c('0x4'));var router=express['Router']();var auth=require(_0x3a2c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3a2c('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x3a2c('0x7')]('/',auth['isAuthenticated'](),controller[_0x3a2c('0x8')]);router[_0x3a2c('0x7')]('/describe',auth[_0x3a2c('0x9')](),controller[_0x3a2c('0xa')]);router['get'](_0x3a2c('0xb'),auth[_0x3a2c('0x9')](),controller[_0x3a2c('0xc')]);router[_0x3a2c('0xd')]('/',auth[_0x3a2c('0x9')](),controller['create']);router['put'](_0x3a2c('0xb'),auth[_0x3a2c('0x9')](),controller['update']);router[_0x3a2c('0xe')](_0x3a2c('0xb'),auth['isAuthenticated'](),controller[_0x3a2c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index af50157..35b1e88 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 _0x3cd1=['TEXT','long','exports','STRING'];(function(_0x319fc1,_0x29179b){var _0xb768af=function(_0x3509ac){while(--_0x3509ac){_0x319fc1['push'](_0x319fc1['shift']());}};_0xb768af(++_0x29179b);}(_0x3cd1,0x112));var _0x13cd=function(_0x591483,_0x2a82fb){_0x591483=_0x591483-0x0;var _0x31d6ea=_0x3cd1[_0x591483];return _0x31d6ea;};'use strict';var Sequelize=require('sequelize');module[_0x13cd('0x0')]={'question':{'type':Sequelize[_0x13cd('0x1')]},'answer':{'type':Sequelize[_0x13cd('0x2')](_0x13cd('0x3'))},'membername':{'type':Sequelize[_0x13cd('0x1')]},'projectname':{'type':Sequelize[_0x13cd('0x1')]},'queue':{'type':Sequelize[_0x13cd('0x1')]},'uniqueid':{'type':Sequelize[_0x13cd('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x13cd('0x1')]},'questionId':{'type':Sequelize[_0x13cd('0x1')]}}; \ No newline at end of file +var _0xf2a6=['long','STRING','sequelize'];(function(_0x17fb24,_0x311e37){var _0x31823e=function(_0x88a201){while(--_0x88a201){_0x17fb24['push'](_0x17fb24['shift']());}};_0x31823e(++_0x311e37);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x3081e0,_0x4007cd){_0x3081e0=_0x3081e0-0x0;var _0x3f0e70=_0xf2a6[_0x3081e0];return _0x3f0e70;};'use strict';var Sequelize=require(_0x6f2a('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0x6f2a('0x1'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x6f2a('0x2')]},'queue':{'type':Sequelize[_0x6f2a('0x2')]},'uniqueid':{'type':Sequelize[_0x6f2a('0x2')]},'calleridname':{'type':Sequelize[_0x6f2a('0x2')]},'calleridnum':{'type':Sequelize[_0x6f2a('0x2')]},'questionId':{'type':Sequelize[_0x6f2a('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index b0dd4fb..b16002c 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 _0x5eb8=['index','JscriptyQuestionReport','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','day','filter','merge','count','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','apply','reject','save','update','destroy','then','error','stack','name','send'];(function(_0x27c558,_0x2f0519){var _0x232dab=function(_0x35444a){while(--_0x35444a){_0x27c558['push'](_0x27c558['shift']());}};_0x232dab(++_0x2f0519);}(_0x5eb8,0xb0));var _0x85eb=function(_0x48a836,_0xa1d010){_0x48a836=_0x48a836-0x0;var _0x249dc8=_0x5eb8[_0x48a836];return _0x249dc8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x85eb('0x0'));var zipdir=require(_0x85eb('0x1'));var jsonpatch=require(_0x85eb('0x2'));var rp=require(_0x85eb('0x3'));var moment=require(_0x85eb('0x4'));var BPromise=require(_0x85eb('0x5'));var Mustache=require(_0x85eb('0x6'));var util=require(_0x85eb('0x7'));var path=require(_0x85eb('0x8'));var sox=require(_0x85eb('0x9'));var csv=require(_0x85eb('0xa'));var ejs=require(_0x85eb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0xa'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var qs=require(_0x85eb('0x11'));var logger=require(_0x85eb('0x12'))(_0x85eb('0x13'));var utils=require(_0x85eb('0x14'));var config=require(_0x85eb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x163f32,_0x478710){_0x478710=_0x478710||0xcc;return function(_0x5c52a4){if(_0x5c52a4){return _0x163f32[_0x85eb('0x16')](_0x478710);}return _0x163f32[_0x85eb('0x17')](_0x478710)[_0x85eb('0x18')]();};}function respondWithResult(_0x259f72,_0x4db167){_0x4db167=_0x4db167||0xc8;return function(_0x548628){if(_0x548628){return _0x259f72[_0x85eb('0x17')](_0x4db167)['json'](_0x548628);}};}function respondWithFilteredResult(_0x18ca53,_0x23a82a){return function(_0x600a7f){if(_0x600a7f){var _0x1604ba=_0x600a7f['count'],_0x183b0c=_0x23a82a[_0x85eb('0x19')],_0x49efdf=_0x23a82a[_0x85eb('0x19')]+_0x23a82a[_0x85eb('0x1a')],_0x2e5c0a;if(_0x49efdf>=_0x1604ba){_0x49efdf=_0x1604ba;_0x2e5c0a=0xc8;}else{_0x2e5c0a=0xce;}_0x18ca53[_0x85eb('0x17')](_0x2e5c0a);return _0x18ca53['set']('Content-Range',_0x183b0c+'-'+_0x49efdf+'/'+_0x1604ba)['json'](_0x600a7f);}return null;};}function patchUpdates(_0xe198ca){return function(_0x39ca96){try{jsonpatch[_0x85eb('0x1b')](_0x39ca96,_0xe198ca,!![]);}catch(_0x2e986c){return BPromise[_0x85eb('0x1c')](_0x2e986c);}return _0x39ca96[_0x85eb('0x1d')]();};}function saveUpdates(_0x5acd3d,_0x24cf28){return function(_0x7244fc){if(_0x7244fc){return _0x7244fc[_0x85eb('0x1e')](_0x5acd3d)['then'](function(_0x4b4b38){return _0x4b4b38;});}return null;};}function removeEntity(_0x48bd86,_0x55b9e4){return function(_0x244667){if(_0x244667){return _0x244667[_0x85eb('0x1f')]()[_0x85eb('0x20')](function(){_0x48bd86[_0x85eb('0x17')](0xcc)[_0x85eb('0x18')]();});}};}function handleEntityNotFound(_0x3fc6da,_0x5c9895){return function(_0x5491d5){if(!_0x5491d5){_0x3fc6da['sendStatus'](0x194);}return _0x5491d5;};}function handleError(_0x298e84,_0x1426c8){_0x1426c8=_0x1426c8||0x1f4;return function(_0x3f7a4d){logger[_0x85eb('0x21')](_0x3f7a4d[_0x85eb('0x22')]);if(_0x3f7a4d[_0x85eb('0x23')]){delete _0x3f7a4d['name'];}_0x298e84[_0x85eb('0x17')](_0x1426c8)[_0x85eb('0x24')](_0x3f7a4d);};}exports[_0x85eb('0x25')]=function(_0x30e766,_0x3e2326){var _0x57a03c={},_0x2e5aa3={},_0x792d3a={'count':0x0,'rows':[]};var _0x291557=db[_0x85eb('0x26')][_0x85eb('0x27')];_0x2e5aa3[_0x85eb('0x28')]=_['keys'](_0x291557);var _0x562792={'dateStart':_0x30e766[_0x85eb('0x29')]['dateStart'],'dateEnd':_0x30e766[_0x85eb('0x29')]['dateEnd']};delete _0x30e766[_0x85eb('0x29')][_0x85eb('0x2a')];delete _0x30e766[_0x85eb('0x29')][_0x85eb('0x2b')];_0x2e5aa3[_0x85eb('0x29')]=_[_0x85eb('0x2c')](_0x30e766[_0x85eb('0x29')]);_0x2e5aa3['filters']=_[_0x85eb('0x2d')](_0x2e5aa3[_0x85eb('0x28')],_0x2e5aa3['query']);_0x57a03c[_0x85eb('0x2e')]=_['intersection'](_0x2e5aa3['model'],qs[_0x85eb('0x2f')](_0x30e766[_0x85eb('0x29')][_0x85eb('0x2f')]));_0x57a03c[_0x85eb('0x2e')]=_0x57a03c[_0x85eb('0x2e')][_0x85eb('0x30')]?_0x57a03c[_0x85eb('0x2e')]:_0x2e5aa3[_0x85eb('0x28')];if(!_0x30e766[_0x85eb('0x29')][_0x85eb('0x31')]('nolimit')){_0x57a03c[_0x85eb('0x1a')]=qs[_0x85eb('0x1a')](_0x30e766['query']['limit']);_0x57a03c[_0x85eb('0x19')]=qs[_0x85eb('0x19')](_0x30e766[_0x85eb('0x29')][_0x85eb('0x19')]);}_0x57a03c[_0x85eb('0x32')]=qs[_0x85eb('0x33')](_0x30e766[_0x85eb('0x29')][_0x85eb('0x33')]);_0x57a03c[_0x85eb('0x34')]=qs[_0x85eb('0x35')](_[_0x85eb('0x36')](_0x30e766[_0x85eb('0x29')],_0x2e5aa3[_0x85eb('0x35')]));if(_0x562792[_0x85eb('0x2a')]){if(_0x562792['dateEnd']){_0x562792[_0x85eb('0x2b')]=moment(_0x562792[_0x85eb('0x2b')])['add'](0x1,'day');}else{_0x562792[_0x85eb('0x2b')]=moment(_0x562792[_0x85eb('0x2a')])['add'](0x1,_0x85eb('0x37'));}_['merge'](_0x57a03c[_0x85eb('0x34')],{'createdAt':{'$gte':_0x562792['dateStart'],'$lte':_0x562792[_0x85eb('0x2b')]}});}if(_0x30e766['query'][_0x85eb('0x38')]){_0x57a03c['where']=_[_0x85eb('0x39')](_0x57a03c[_0x85eb('0x34')],{'$or':_['map'](_0x57a03c[_0x85eb('0x2e')],function(_0x5a1c15){var _0x2a6baa={};_0x2a6baa[_0x5a1c15]={'$like':'%'+_0x30e766[_0x85eb('0x29')]['filter']+'%'};return _0x2a6baa;})});}_0x57a03c=_[_0x85eb('0x39')]({},_0x57a03c,_0x30e766['options']);var _0x5495cf={'where':_0x57a03c[_0x85eb('0x34')]};return db['JscriptyQuestionReport'][_0x85eb('0x3a')](_0x5495cf)[_0x85eb('0x20')](function(_0x5da012){_0x792d3a['count']=_0x5da012;if(_0x30e766[_0x85eb('0x29')][_0x85eb('0x3b')]){_0x57a03c['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x85eb('0x3c')](_0x57a03c);})[_0x85eb('0x20')](function(_0x2211f9){_0x792d3a[_0x85eb('0x3d')]=_0x2211f9;return _0x792d3a;})[_0x85eb('0x20')](respondWithFilteredResult(_0x3e2326,_0x57a03c))['catch'](handleError(_0x3e2326,null));};exports[_0x85eb('0x3e')]=function(_0x1681fc,_0x208c27){var _0x3b096b={'raw':!![],'where':{'id':_0x1681fc[_0x85eb('0x3f')]['id']}},_0x2ed39d={};_0x2ed39d[_0x85eb('0x28')]=_[_0x85eb('0x2c')](db[_0x85eb('0x26')]['rawAttributes']);_0x2ed39d[_0x85eb('0x29')]=_[_0x85eb('0x2c')](_0x1681fc['query']);_0x2ed39d[_0x85eb('0x35')]=_[_0x85eb('0x2d')](_0x2ed39d[_0x85eb('0x28')],_0x2ed39d[_0x85eb('0x29')]);_0x3b096b[_0x85eb('0x2e')]=_[_0x85eb('0x2d')](_0x2ed39d['model'],qs[_0x85eb('0x2f')](_0x1681fc[_0x85eb('0x29')][_0x85eb('0x2f')]));_0x3b096b[_0x85eb('0x2e')]=_0x3b096b[_0x85eb('0x2e')][_0x85eb('0x30')]?_0x3b096b[_0x85eb('0x2e')]:_0x2ed39d[_0x85eb('0x28')];if(_0x1681fc['query'][_0x85eb('0x3b')]){_0x3b096b[_0x85eb('0x40')]=[{'all':!![]}];}_0x3b096b=_[_0x85eb('0x39')]({},_0x3b096b,_0x1681fc[_0x85eb('0x41')]);return db[_0x85eb('0x26')][_0x85eb('0x42')](_0x3b096b)[_0x85eb('0x20')](handleEntityNotFound(_0x208c27,null))[_0x85eb('0x20')](respondWithResult(_0x208c27,null))[_0x85eb('0x43')](handleError(_0x208c27,null));};exports[_0x85eb('0x44')]=function(_0x32b20f,_0x11c682){return db['JscriptyQuestionReport'][_0x85eb('0x44')](_0x32b20f[_0x85eb('0x45')],{})[_0x85eb('0x20')](respondWithResult(_0x11c682,0xc9))['catch'](handleError(_0x11c682,null));};exports[_0x85eb('0x1e')]=function(_0x30f921,_0x2cf928){if(_0x30f921[_0x85eb('0x45')]['id']){delete _0x30f921[_0x85eb('0x45')]['id'];}return db['JscriptyQuestionReport'][_0x85eb('0x42')]({'where':{'id':_0x30f921[_0x85eb('0x3f')]['id']}})[_0x85eb('0x20')](handleEntityNotFound(_0x2cf928,null))['then'](saveUpdates(_0x30f921[_0x85eb('0x45')],null))[_0x85eb('0x20')](respondWithResult(_0x2cf928,null))[_0x85eb('0x43')](handleError(_0x2cf928,null));};exports['destroy']=function(_0x56f510,_0x2299d7){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x56f510[_0x85eb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2299d7,null))[_0x85eb('0x20')](removeEntity(_0x2299d7,null))[_0x85eb('0x43')](handleError(_0x2299d7,null));};exports['describe']=function(_0x4abe5e,_0x27ce2a){return db[_0x85eb('0x26')][_0x85eb('0x46')]()[_0x85eb('0x20')](respondWithResult(_0x27ce2a,null))[_0x85eb('0x43')](handleError(_0x27ce2a,null));}; \ No newline at end of file +var _0xe706=['day','merge','filter','map','options','includeAll','include','findAll','rows','params','find','create','body','catch','describe','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','sendStatus','status','end','count','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','JscriptyQuestionReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','add'];(function(_0x262934,_0x496a82){var _0x1a200e=function(_0x2c5ec1){while(--_0x2c5ec1){_0x262934['push'](_0x262934['shift']());}};_0x1a200e(++_0x496a82);}(_0xe706,0xa3));var _0x6e70=function(_0x2b85d5,_0x3115b7){_0x2b85d5=_0x2b85d5-0x0;var _0xe8c96f=_0xe706[_0x2b85d5];return _0xe8c96f;};'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'];function respondWithStatusCode(_0x47f6b2,_0x3594c1){_0x3594c1=_0x3594c1||0xcc;return function(_0x15a1a5){if(_0x15a1a5){return _0x47f6b2[_0x6e70('0x1a')](_0x3594c1);}return _0x47f6b2[_0x6e70('0x1b')](_0x3594c1)[_0x6e70('0x1c')]();};}function respondWithResult(_0x310eb7,_0xa1eb74){_0xa1eb74=_0xa1eb74||0xc8;return function(_0x181005){if(_0x181005){return _0x310eb7['status'](_0xa1eb74)['json'](_0x181005);}};}function respondWithFilteredResult(_0x48bc72,_0x257e81){return function(_0x5a37a6){if(_0x5a37a6){var _0x53aed0=_0x5a37a6[_0x6e70('0x1d')],_0x304716=_0x257e81['offset'],_0x22c50c=_0x257e81[_0x6e70('0x1e')]+_0x257e81[_0x6e70('0x1f')],_0x5d9263;if(_0x22c50c>=_0x53aed0){_0x22c50c=_0x53aed0;_0x5d9263=0xc8;}else{_0x5d9263=0xce;}_0x48bc72['status'](_0x5d9263);return _0x48bc72['set'](_0x6e70('0x20'),_0x304716+'-'+_0x22c50c+'/'+_0x53aed0)['json'](_0x5a37a6);}return null;};}function patchUpdates(_0x28a21f){return function(_0x173afe){try{jsonpatch['apply'](_0x173afe,_0x28a21f,!![]);}catch(_0x497d61){return BPromise[_0x6e70('0x21')](_0x497d61);}return _0x173afe[_0x6e70('0x22')]();};}function saveUpdates(_0x2368eb,_0x3a9978){return function(_0x3af484){if(_0x3af484){return _0x3af484[_0x6e70('0x23')](_0x2368eb)[_0x6e70('0x24')](function(_0x44a49f){return _0x44a49f;});}return null;};}function removeEntity(_0x29326f,_0xb29a2a){return function(_0x4a0cfe){if(_0x4a0cfe){return _0x4a0cfe[_0x6e70('0x25')]()[_0x6e70('0x24')](function(){_0x29326f[_0x6e70('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ccd87,_0xa5d49){return function(_0x3337a6){if(!_0x3337a6){_0x3ccd87['sendStatus'](0x194);}return _0x3337a6;};}function handleError(_0x10fc91,_0x538b9c){_0x538b9c=_0x538b9c||0x1f4;return function(_0x50aec2){logger['error'](_0x50aec2[_0x6e70('0x26')]);if(_0x50aec2[_0x6e70('0x27')]){delete _0x50aec2['name'];}_0x10fc91[_0x6e70('0x1b')](_0x538b9c)[_0x6e70('0x28')](_0x50aec2);};}exports['index']=function(_0x338ad6,_0x67fb43){var _0x2bb231={},_0x4a67ac={},_0x54a5fe={'count':0x0,'rows':[]};var _0x2c4d37=db[_0x6e70('0x29')][_0x6e70('0x2a')];_0x4a67ac[_0x6e70('0x2b')]=_[_0x6e70('0x2c')](_0x2c4d37);var _0x5d772a={'dateStart':_0x338ad6[_0x6e70('0x2d')][_0x6e70('0x2e')],'dateEnd':_0x338ad6[_0x6e70('0x2d')][_0x6e70('0x2f')]};delete _0x338ad6[_0x6e70('0x2d')][_0x6e70('0x2e')];delete _0x338ad6[_0x6e70('0x2d')][_0x6e70('0x2f')];_0x4a67ac[_0x6e70('0x2d')]=_[_0x6e70('0x2c')](_0x338ad6['query']);_0x4a67ac[_0x6e70('0x30')]=_['intersection'](_0x4a67ac[_0x6e70('0x2b')],_0x4a67ac['query']);_0x2bb231[_0x6e70('0x31')]=_[_0x6e70('0x32')](_0x4a67ac[_0x6e70('0x2b')],qs['fields'](_0x338ad6[_0x6e70('0x2d')][_0x6e70('0x33')]));_0x2bb231['attributes']=_0x2bb231[_0x6e70('0x31')][_0x6e70('0x34')]?_0x2bb231['attributes']:_0x4a67ac[_0x6e70('0x2b')];if(!_0x338ad6[_0x6e70('0x2d')][_0x6e70('0x35')](_0x6e70('0x36'))){_0x2bb231[_0x6e70('0x1f')]=qs[_0x6e70('0x1f')](_0x338ad6[_0x6e70('0x2d')][_0x6e70('0x1f')]);_0x2bb231[_0x6e70('0x1e')]=qs[_0x6e70('0x1e')](_0x338ad6['query'][_0x6e70('0x1e')]);}_0x2bb231['order']=qs[_0x6e70('0x37')](_0x338ad6[_0x6e70('0x2d')][_0x6e70('0x37')]);_0x2bb231[_0x6e70('0x38')]=qs[_0x6e70('0x30')](_[_0x6e70('0x39')](_0x338ad6[_0x6e70('0x2d')],_0x4a67ac[_0x6e70('0x30')]));if(_0x5d772a[_0x6e70('0x2e')]){if(_0x5d772a[_0x6e70('0x2f')]){_0x5d772a[_0x6e70('0x2f')]=moment(_0x5d772a[_0x6e70('0x2f')])[_0x6e70('0x3a')](0x1,'day');}else{_0x5d772a['dateEnd']=moment(_0x5d772a['dateStart'])[_0x6e70('0x3a')](0x1,_0x6e70('0x3b'));}_[_0x6e70('0x3c')](_0x2bb231[_0x6e70('0x38')],{'createdAt':{'$gte':_0x5d772a[_0x6e70('0x2e')],'$lte':_0x5d772a[_0x6e70('0x2f')]}});}if(_0x338ad6['query'][_0x6e70('0x3d')]){_0x2bb231[_0x6e70('0x38')]=_[_0x6e70('0x3c')](_0x2bb231[_0x6e70('0x38')],{'$or':_[_0x6e70('0x3e')](_0x2bb231[_0x6e70('0x31')],function(_0x246e61){var _0x16fc7d={};_0x16fc7d[_0x246e61]={'$like':'%'+_0x338ad6['query'][_0x6e70('0x3d')]+'%'};return _0x16fc7d;})});}_0x2bb231=_[_0x6e70('0x3c')]({},_0x2bb231,_0x338ad6[_0x6e70('0x3f')]);var _0x31cad2={'where':_0x2bb231[_0x6e70('0x38')]};return db[_0x6e70('0x29')][_0x6e70('0x1d')](_0x31cad2)['then'](function(_0x56ea6e){_0x54a5fe['count']=_0x56ea6e;if(_0x338ad6[_0x6e70('0x2d')][_0x6e70('0x40')]){_0x2bb231[_0x6e70('0x41')]=[{'all':!![]}];}return db[_0x6e70('0x29')][_0x6e70('0x42')](_0x2bb231);})['then'](function(_0x225d44){_0x54a5fe[_0x6e70('0x43')]=_0x225d44;return _0x54a5fe;})[_0x6e70('0x24')](respondWithFilteredResult(_0x67fb43,_0x2bb231))['catch'](handleError(_0x67fb43,null));};exports['show']=function(_0x52fc8f,_0x1ddf52){var _0x5cca5b={'raw':!![],'where':{'id':_0x52fc8f[_0x6e70('0x44')]['id']}},_0x42f49a={};_0x42f49a[_0x6e70('0x2b')]=_[_0x6e70('0x2c')](db['JscriptyQuestionReport'][_0x6e70('0x2a')]);_0x42f49a['query']=_[_0x6e70('0x2c')](_0x52fc8f[_0x6e70('0x2d')]);_0x42f49a[_0x6e70('0x30')]=_[_0x6e70('0x32')](_0x42f49a['model'],_0x42f49a[_0x6e70('0x2d')]);_0x5cca5b[_0x6e70('0x31')]=_[_0x6e70('0x32')](_0x42f49a[_0x6e70('0x2b')],qs[_0x6e70('0x33')](_0x52fc8f[_0x6e70('0x2d')][_0x6e70('0x33')]));_0x5cca5b['attributes']=_0x5cca5b[_0x6e70('0x31')][_0x6e70('0x34')]?_0x5cca5b[_0x6e70('0x31')]:_0x42f49a[_0x6e70('0x2b')];if(_0x52fc8f[_0x6e70('0x2d')][_0x6e70('0x40')]){_0x5cca5b[_0x6e70('0x41')]=[{'all':!![]}];}_0x5cca5b=_['merge']({},_0x5cca5b,_0x52fc8f[_0x6e70('0x3f')]);return db['JscriptyQuestionReport'][_0x6e70('0x45')](_0x5cca5b)[_0x6e70('0x24')](handleEntityNotFound(_0x1ddf52,null))['then'](respondWithResult(_0x1ddf52,null))['catch'](handleError(_0x1ddf52,null));};exports[_0x6e70('0x46')]=function(_0x25a208,_0x18fa40){return db['JscriptyQuestionReport']['create'](_0x25a208[_0x6e70('0x47')],{})[_0x6e70('0x24')](respondWithResult(_0x18fa40,0xc9))[_0x6e70('0x48')](handleError(_0x18fa40,null));};exports[_0x6e70('0x23')]=function(_0x2e25d5,_0x340674){if(_0x2e25d5['body']['id']){delete _0x2e25d5[_0x6e70('0x47')]['id'];}return db[_0x6e70('0x29')][_0x6e70('0x45')]({'where':{'id':_0x2e25d5[_0x6e70('0x44')]['id']}})[_0x6e70('0x24')](handleEntityNotFound(_0x340674,null))['then'](saveUpdates(_0x2e25d5['body'],null))[_0x6e70('0x24')](respondWithResult(_0x340674,null))[_0x6e70('0x48')](handleError(_0x340674,null));};exports[_0x6e70('0x25')]=function(_0x15f994,_0x810e6a){return db['JscriptyQuestionReport'][_0x6e70('0x45')]({'where':{'id':_0x15f994[_0x6e70('0x44')]['id']}})[_0x6e70('0x24')](handleEntityNotFound(_0x810e6a,null))[_0x6e70('0x24')](removeEntity(_0x810e6a,null))[_0x6e70('0x48')](handleError(_0x810e6a,null));};exports['describe']=function(_0x1142cd,_0x1dd242){return db[_0x6e70('0x29')][_0x6e70('0x49')]()[_0x6e70('0x24')](respondWithResult(_0x1dd242,null))[_0x6e70('0x48')](handleError(_0x1dd242,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index bb8434c..c6cfa6a 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 _0x6947=['JscriptyQuestionReport','report_jscripty_questions','util','api','moment','bluebird','request-promise','define'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x6947,0x72));var _0x7694=function(_0x174661,_0x3ab583){_0x174661=_0x174661-0x0;var _0x18cce9=_0x6947[_0x174661];return _0x18cce9;};'use strict';var _=require('lodash');var util=require(_0x7694('0x0'));var logger=require('../../config/logger')(_0x7694('0x1'));var moment=require(_0x7694('0x2'));var BPromise=require(_0x7694('0x3'));var rp=require(_0x7694('0x4'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x916214,_0x19c519){return _0x916214[_0x7694('0x5')](_0x7694('0x6'),attributes,{'tableName':_0x7694('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bf9=['define','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','./jscriptyQuestionReport.attributes','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1bf9,0x188));var _0x91bf=function(_0x45fa48,_0x2de625){_0x45fa48=_0x45fa48-0x0;var _0x2d7a0c=_0x1bf9[_0x45fa48];return _0x2d7a0c;};'use strict';var _=require(_0x91bf('0x0'));var util=require('util');var logger=require(_0x91bf('0x1'))(_0x91bf('0x2'));var moment=require(_0x91bf('0x3'));var BPromise=require(_0x91bf('0x4'));var rp=require(_0x91bf('0x5'));var attributes=require(_0x91bf('0x6'));module[_0x91bf('0x7')]=function(_0x4e2683,_0x17c1cf){return _0x4e2683[_0x91bf('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0x91bf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 7958904..90669cc 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 _0xc493=['http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x2d32be,_0x289db3){var _0x529255=function(_0x49a033){while(--_0x49a033){_0x2d32be['push'](_0x2d32be['shift']());}};_0x529255(++_0x289db3);}(_0xc493,0x1eb));var _0x3c49=function(_0xcaa995,_0x215477){_0xcaa995=_0xcaa995-0x0;var _0x4d6865=_0xc493[_0xcaa995];return _0x4d6865;};'use strict';var _=require(_0x3c49('0x0'));var util=require('util');var moment=require(_0x3c49('0x1'));var BPromise=require(_0x3c49('0x2'));var rs=require(_0x3c49('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c49('0x4'))['db'];var utils=require(_0x3c49('0x5'));var logger=require(_0x3c49('0x6'))(_0x3c49('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c49('0x8')][_0x3c49('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2226d3,_0x5a2b7a,_0x1a3604){return new BPromise(function(_0x55ee48,_0x542b41){return client[_0x3c49('0xa')](_0x2226d3,_0x1a3604)['then'](function(_0x426c4c){logger[_0x3c49('0xb')](_0x3c49('0xc'),_0x5a2b7a,'request\x20sent');logger[_0x3c49('0xd')](_0x3c49('0xe'),_0x5a2b7a,_0x3c49('0xf'),JSON[_0x3c49('0x10')](_0x426c4c));if(_0x426c4c[_0x3c49('0x11')]){if(_0x426c4c[_0x3c49('0x11')]['code']===0x1f4){logger[_0x3c49('0x11')](_0x3c49('0xc'),_0x5a2b7a,_0x426c4c[_0x3c49('0x11')]['message']);return _0x542b41(_0x426c4c[_0x3c49('0x11')]['message']);}logger[_0x3c49('0x11')](_0x3c49('0xc'),_0x5a2b7a,_0x426c4c[_0x3c49('0x11')][_0x3c49('0x12')]);return _0x55ee48(_0x426c4c[_0x3c49('0x11')]['message']);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5a2b7a,_0x3c49('0xf'));_0x55ee48(_0x426c4c['result']['message']);}})[_0x3c49('0x13')](function(_0x3f817d){logger[_0x3c49('0x11')](_0x3c49('0xc'),_0x5a2b7a,_0x3f817d);_0x542b41(_0x3f817d);});});} \ No newline at end of file +var _0xeb68=['JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1ab897,_0x1200ff){var _0x28d5a1=function(_0x355783){while(--_0x355783){_0x1ab897['push'](_0x1ab897['shift']());}};_0x28d5a1(++_0x1200ff);}(_0xeb68,0x1be));var _0x8eb6=function(_0x575a38,_0x2e83d7){_0x575a38=_0x575a38-0x0;var _0x5a7bdd=_0xeb68[_0x575a38];return _0x5a7bdd;};'use strict';var _=require(_0x8eb6('0x0'));var util=require(_0x8eb6('0x1'));var moment=require(_0x8eb6('0x2'));var BPromise=require(_0x8eb6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8eb6('0x4'));var db=require(_0x8eb6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8eb6('0x6'))(_0x8eb6('0x7'));var config=require(_0x8eb6('0x8'));var jayson=require(_0x8eb6('0x9'));var client=jayson[_0x8eb6('0xa')][_0x8eb6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x964a75,_0x456056,_0x3aab44){return new BPromise(function(_0x5c523e,_0x1342a2){return client[_0x8eb6('0xc')](_0x964a75,_0x3aab44)['then'](function(_0x393405){logger[_0x8eb6('0xd')](_0x8eb6('0xe'),_0x456056,'request\x20sent');logger[_0x8eb6('0xf')](_0x8eb6('0x10'),_0x456056,_0x8eb6('0x11'),JSON[_0x8eb6('0x12')](_0x393405));if(_0x393405[_0x8eb6('0x13')]){if(_0x393405[_0x8eb6('0x13')][_0x8eb6('0x14')]===0x1f4){logger['error'](_0x8eb6('0xe'),_0x456056,_0x393405['error'][_0x8eb6('0x15')]);return _0x1342a2(_0x393405[_0x8eb6('0x13')][_0x8eb6('0x15')]);}logger[_0x8eb6('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x456056,_0x393405[_0x8eb6('0x13')][_0x8eb6('0x15')]);return _0x5c523e(_0x393405['error']['message']);}else{logger[_0x8eb6('0xd')](_0x8eb6('0xe'),_0x456056,'request\x20sent');_0x5c523e(_0x393405[_0x8eb6('0x16')]['message']);}})['catch'](function(_0x141b9c){logger[_0x8eb6('0x13')](_0x8eb6('0xe'),_0x456056,_0x141b9c);_0x1342a2(_0x141b9c);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index b7d7447..b21401e 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 _0x0016=['/:id/questions','getQuestions','post','create','delete','exports','multer','express','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x53331c,_0x908b8f){var _0x5ddbb8=function(_0x28b807){while(--_0x28b807){_0x53331c['push'](_0x53331c['shift']());}};_0x5ddbb8(++_0x908b8f);}(_0x0016,0x146));var _0x6001=function(_0x53ddab,_0x4ada9d){_0x53ddab=_0x53ddab-0x0;var _0x5819ac=_0x0016[_0x53ddab];return _0x5819ac;};'use strict';var multer=require(_0x6001('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6001('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6001('0x2'));var config=require('../../config/environment');var controller=require(_0x6001('0x3'));router[_0x6001('0x4')]('/',auth[_0x6001('0x5')](),controller[_0x6001('0x6')]);router['get'](_0x6001('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x6001('0x4')](_0x6001('0x8'),auth[_0x6001('0x5')](),controller[_0x6001('0x9')]);router[_0x6001('0x4')](_0x6001('0xa'),auth[_0x6001('0x5')](),controller[_0x6001('0xb')]);router[_0x6001('0xc')]('/',auth[_0x6001('0x5')](),controller[_0x6001('0xd')]);router['put'](_0x6001('0x8'),auth[_0x6001('0x5')](),controller['update']);router[_0x6001('0xe')](_0x6001('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x6001('0xf')]=router; \ No newline at end of file +var _0x318a=['/:id/questions','post','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x318a,0xea));var _0xa318=function(_0x3c1f89,_0x269707){_0x3c1f89=_0x3c1f89-0x0;var _0x2da64a=_0x318a[_0x3c1f89];return _0x2da64a;};'use strict';var multer=require(_0xa318('0x0'));var util=require(_0xa318('0x1'));var path=require(_0xa318('0x2'));var timeout=require(_0xa318('0x3'));var express=require(_0xa318('0x4'));var router=express[_0xa318('0x5')]();var auth=require(_0xa318('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa318('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0xa318('0x8')]('/',auth[_0xa318('0x9')](),controller['index']);router[_0xa318('0x8')](_0xa318('0xa'),auth[_0xa318('0x9')](),controller[_0xa318('0xb')]);router['get']('/:id',auth[_0xa318('0x9')](),controller[_0xa318('0xc')]);router['get'](_0xa318('0xd'),auth[_0xa318('0x9')](),controller['getQuestions']);router[_0xa318('0xe')]('/',auth[_0xa318('0x9')](),controller['create']);router[_0xa318('0xf')](_0xa318('0x10'),auth[_0xa318('0x9')](),controller[_0xa318('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa318('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 6f7c43b..64e43e2 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 _0xe1fe=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x36a47b,_0x4a2c4d){var _0x4f6711=function(_0x3d54f4){while(--_0x3d54f4){_0x36a47b['push'](_0x36a47b['shift']());}};_0x4f6711(++_0x4a2c4d);}(_0xe1fe,0x1c3));var _0xee1f=function(_0x3bc659,_0x449d31){_0x3bc659=_0x3bc659-0x0;var _0x18276d=_0xe1fe[_0x3bc659];return _0x18276d;};'use strict';var moment=require(_0xee1f('0x0'));var Sequelize=require(_0xee1f('0x1'));module[_0xee1f('0x2')]={'starttime':{'type':Sequelize[_0xee1f('0x3')],'set':function(_0x38043f){this[_0xee1f('0x4')]('starttime',_0x38043f);this['setDataValue'](_0xee1f('0x5'),moment()[_0xee1f('0x6')](_0xee1f('0x7')));}},'endtime':{'type':Sequelize[_0xee1f('0x3')]},'membername':{'type':Sequelize[_0xee1f('0x8')]},'projectname':{'type':Sequelize[_0xee1f('0x8')]},'queue':{'type':Sequelize[_0xee1f('0x8')]},'uniqueid':{'type':Sequelize[_0xee1f('0x8')]},'calleridname':{'type':Sequelize[_0xee1f('0x8')]},'calleridnum':{'type':Sequelize[_0xee1f('0x8')]},'completed':{'type':Sequelize[_0xee1f('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x7dce=['sequelize','exports','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN'];(function(_0x1f9c24,_0x2e3c22){var _0x4ae65c=function(_0x43908d){while(--_0x43908d){_0x1f9c24['push'](_0x1f9c24['shift']());}};_0x4ae65c(++_0x2e3c22);}(_0x7dce,0x99));var _0xe7dc=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x7dce[_0x3cea78];return _0x33b66b;};'use strict';var moment=require('moment');var Sequelize=require(_0xe7dc('0x0'));module[_0xe7dc('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4022df){this[_0xe7dc('0x2')](_0xe7dc('0x3'),_0x4022df);this['setDataValue']('endtime',moment()[_0xe7dc('0x4')](_0xe7dc('0x5')));}},'endtime':{'type':Sequelize[_0xe7dc('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xe7dc('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe7dc('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xe7dc('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index fb67152..fb02a5a 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 _0x538c=['fast-json-patch','request-promise','moment','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','limit','status','set','Content-Range','reject','save','update','then','stack','name','index','JscriptySessionReport','rawAttributes','model','query','dateEnd','dateStart','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','count','include','findAll','catch','find','create','body','params','destroy','describe','getQuestions','JscriptyQuestionReport','includeAll','rows','html-pdf','eml-format'];(function(_0x3e1829,_0xc8ccda){var _0x129345=function(_0x2357c0){while(--_0x2357c0){_0x3e1829['push'](_0x3e1829['shift']());}};_0x129345(++_0xc8ccda);}(_0x538c,0xd6));var _0xc538=function(_0x567d0e,_0x4a3ab9){_0x567d0e=_0x567d0e-0x0;var _0x46e7c2=_0x538c[_0x567d0e];return _0x46e7c2;};'use strict';var pdf=require(_0xc538('0x0'));var emlformat=require(_0xc538('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc538('0x2'));var rp=require(_0xc538('0x3'));var moment=require(_0xc538('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc538('0x5'));var path=require(_0xc538('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc538('0x7'));var fs=require('fs');var _=require(_0xc538('0x8'));var squel=require('squel');var crypto=require(_0xc538('0x9'));var jsforce=require(_0xc538('0xa'));var deskjs=require(_0xc538('0xb'));var toCsv=require(_0xc538('0xc'));var querystring=require(_0xc538('0xd'));var Papa=require(_0xc538('0xe'));var Redis=require(_0xc538('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc538('0x10'));var utils=require(_0xc538('0x11'));var config=require(_0xc538('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b7555,_0x4dc37e){_0x4dc37e=_0x4dc37e||0xcc;return function(_0x41605c){if(_0x41605c){return _0x3b7555[_0xc538('0x13')](_0x4dc37e);}return _0x3b7555['status'](_0x4dc37e)[_0xc538('0x14')]();};}function respondWithResult(_0x246e27,_0x126f24){_0x126f24=_0x126f24||0xc8;return function(_0x3edec0){if(_0x3edec0){return _0x246e27['status'](_0x126f24)[_0xc538('0x15')](_0x3edec0);}};}function respondWithFilteredResult(_0x2045a7,_0x5837f9){return function(_0x14e0d8){if(_0x14e0d8){var _0x1459d3=_0x14e0d8['count'],_0x2a99eb=_0x5837f9[_0xc538('0x16')],_0x5d3ef1=_0x5837f9['offset']+_0x5837f9[_0xc538('0x17')],_0x17eb37;if(_0x5d3ef1>=_0x1459d3){_0x5d3ef1=_0x1459d3;_0x17eb37=0xc8;}else{_0x17eb37=0xce;}_0x2045a7[_0xc538('0x18')](_0x17eb37);return _0x2045a7[_0xc538('0x19')](_0xc538('0x1a'),_0x2a99eb+'-'+_0x5d3ef1+'/'+_0x1459d3)['json'](_0x14e0d8);}return null;};}function patchUpdates(_0x4beee4){return function(_0x43494c){try{jsonpatch['apply'](_0x43494c,_0x4beee4,!![]);}catch(_0x4824fb){return BPromise[_0xc538('0x1b')](_0x4824fb);}return _0x43494c[_0xc538('0x1c')]();};}function saveUpdates(_0x5252e1,_0x1d255c){return function(_0x36e67a){if(_0x36e67a){return _0x36e67a[_0xc538('0x1d')](_0x5252e1)[_0xc538('0x1e')](function(_0x1e65ac){return _0x1e65ac;});}return null;};}function removeEntity(_0x44d7bd,_0x4bd2b3){return function(_0x21d388){if(_0x21d388){return _0x21d388['destroy']()[_0xc538('0x1e')](function(){_0x44d7bd[_0xc538('0x18')](0xcc)[_0xc538('0x14')]();});}};}function handleEntityNotFound(_0x267ac0,_0x28451d){return function(_0x42cac2){if(!_0x42cac2){_0x267ac0[_0xc538('0x13')](0x194);}return _0x42cac2;};}function handleError(_0x4537bb,_0x3e0d76){_0x3e0d76=_0x3e0d76||0x1f4;return function(_0x341150){logger['error'](_0x341150[_0xc538('0x1f')]);if(_0x341150[_0xc538('0x20')]){delete _0x341150[_0xc538('0x20')];}_0x4537bb['status'](_0x3e0d76)['send'](_0x341150);};}exports[_0xc538('0x21')]=function(_0xcad937,_0x1bcfbb){var _0x515d9c={},_0x520af4={},_0x162e63={'count':0x0,'rows':[]};var _0x17a0b8=db[_0xc538('0x22')][_0xc538('0x23')];_0x520af4[_0xc538('0x24')]=_['keys'](_0x17a0b8);var _0x38e407={'dateStart':_0xcad937[_0xc538('0x25')]['dateStart'],'dateEnd':_0xcad937[_0xc538('0x25')][_0xc538('0x26')]};delete _0xcad937[_0xc538('0x25')][_0xc538('0x27')];delete _0xcad937['query'][_0xc538('0x26')];_0x520af4['query']=_[_0xc538('0x28')](_0xcad937[_0xc538('0x25')]);_0x520af4[_0xc538('0x29')]=_[_0xc538('0x2a')](_0x520af4[_0xc538('0x24')],_0x520af4[_0xc538('0x25')]);_0x515d9c['attributes']=_['intersection'](_0x520af4[_0xc538('0x24')],qs['fields'](_0xcad937[_0xc538('0x25')][_0xc538('0x2b')]));_0x515d9c[_0xc538('0x2c')]=_0x515d9c[_0xc538('0x2c')][_0xc538('0x2d')]?_0x515d9c[_0xc538('0x2c')]:_0x520af4[_0xc538('0x24')];if(!_0xcad937[_0xc538('0x25')][_0xc538('0x2e')](_0xc538('0x2f'))){_0x515d9c[_0xc538('0x17')]=qs[_0xc538('0x17')](_0xcad937['query']['limit']);_0x515d9c[_0xc538('0x16')]=qs['offset'](_0xcad937[_0xc538('0x25')][_0xc538('0x16')]);}_0x515d9c[_0xc538('0x30')]=qs[_0xc538('0x31')](_0xcad937[_0xc538('0x25')][_0xc538('0x31')]);_0x515d9c[_0xc538('0x32')]=qs['filters'](_[_0xc538('0x33')](_0xcad937[_0xc538('0x25')],_0x520af4['filters']));if(_0x38e407['dateStart']){if(_0x38e407[_0xc538('0x26')]){_0x38e407['dateEnd']=moment(_0x38e407[_0xc538('0x26')])['add'](0x1,'day');}else{_0x38e407[_0xc538('0x26')]=moment(_0x38e407[_0xc538('0x27')])[_0xc538('0x34')](0x1,_0xc538('0x35'));}_[_0xc538('0x36')](_0x515d9c[_0xc538('0x32')],{'createdAt':{'$gte':_0x38e407[_0xc538('0x27')],'$lte':_0x38e407[_0xc538('0x26')]}});}if(_0xcad937['query'][_0xc538('0x37')]){_0x515d9c['where']=_[_0xc538('0x36')](_0x515d9c[_0xc538('0x32')],{'$or':_[_0xc538('0x38')](_0x515d9c['attributes'],function(_0x4b9c27){var _0x3f592b={};_0x3f592b[_0x4b9c27]={'$like':'%'+_0xcad937[_0xc538('0x25')]['filter']+'%'};return _0x3f592b;})});}_0x515d9c=_[_0xc538('0x36')]({},_0x515d9c,_0xcad937[_0xc538('0x39')]);var _0x59656e={'where':_0x515d9c[_0xc538('0x32')]};return db[_0xc538('0x22')][_0xc538('0x3a')](_0x59656e)[_0xc538('0x1e')](function(_0x42659d){_0x162e63[_0xc538('0x3a')]=_0x42659d;if(_0xcad937[_0xc538('0x25')]['includeAll']){_0x515d9c[_0xc538('0x3b')]=[{'all':!![]}];}return db[_0xc538('0x22')][_0xc538('0x3c')](_0x515d9c);})[_0xc538('0x1e')](function(_0x3e239c){_0x162e63['rows']=_0x3e239c;return _0x162e63;})[_0xc538('0x1e')](respondWithFilteredResult(_0x1bcfbb,_0x515d9c))[_0xc538('0x3d')](handleError(_0x1bcfbb,null));};exports['show']=function(_0x3ea2b8,_0x119e0d){var _0x1b368b={'raw':!![],'where':{'id':_0x3ea2b8['params']['id']}},_0x24cb4a={};_0x24cb4a[_0xc538('0x24')]=_[_0xc538('0x28')](db[_0xc538('0x22')][_0xc538('0x23')]);_0x24cb4a[_0xc538('0x25')]=_['keys'](_0x3ea2b8[_0xc538('0x25')]);_0x24cb4a[_0xc538('0x29')]=_['intersection'](_0x24cb4a['model'],_0x24cb4a['query']);_0x1b368b['attributes']=_[_0xc538('0x2a')](_0x24cb4a[_0xc538('0x24')],qs[_0xc538('0x2b')](_0x3ea2b8[_0xc538('0x25')]['fields']));_0x1b368b[_0xc538('0x2c')]=_0x1b368b[_0xc538('0x2c')][_0xc538('0x2d')]?_0x1b368b['attributes']:_0x24cb4a[_0xc538('0x24')];if(_0x3ea2b8[_0xc538('0x25')]['includeAll']){_0x1b368b[_0xc538('0x3b')]=[{'all':!![]}];}_0x1b368b=_[_0xc538('0x36')]({},_0x1b368b,_0x3ea2b8['options']);return db[_0xc538('0x22')][_0xc538('0x3e')](_0x1b368b)[_0xc538('0x1e')](handleEntityNotFound(_0x119e0d,null))[_0xc538('0x1e')](respondWithResult(_0x119e0d,null))[_0xc538('0x3d')](handleError(_0x119e0d,null));};exports[_0xc538('0x3f')]=function(_0x29e020,_0x5b81f1){return db[_0xc538('0x22')][_0xc538('0x3f')](_0x29e020['body'],{})[_0xc538('0x1e')](respondWithResult(_0x5b81f1,0xc9))[_0xc538('0x3d')](handleError(_0x5b81f1,null));};exports[_0xc538('0x1d')]=function(_0x4715b2,_0x1c9b5a){if(_0x4715b2[_0xc538('0x40')]['id']){delete _0x4715b2[_0xc538('0x40')]['id'];}return db[_0xc538('0x22')][_0xc538('0x3e')]({'where':{'id':_0x4715b2[_0xc538('0x41')]['id']}})['then'](handleEntityNotFound(_0x1c9b5a,null))['then'](saveUpdates(_0x4715b2[_0xc538('0x40')],null))['then'](respondWithResult(_0x1c9b5a,null))[_0xc538('0x3d')](handleError(_0x1c9b5a,null));};exports[_0xc538('0x42')]=function(_0x24f95a,_0x955f01){return db[_0xc538('0x22')][_0xc538('0x3e')]({'where':{'id':_0x24f95a[_0xc538('0x41')]['id']}})['then'](handleEntityNotFound(_0x955f01,null))['then'](removeEntity(_0x955f01,null))[_0xc538('0x3d')](handleError(_0x955f01,null));};exports['describe']=function(_0x4fec8e,_0xf79ffd){return db[_0xc538('0x22')][_0xc538('0x43')]()[_0xc538('0x1e')](respondWithResult(_0xf79ffd,null))[_0xc538('0x3d')](handleError(_0xf79ffd,null));};exports[_0xc538('0x44')]=function(_0x1433de,_0x30a1db,_0x38711c){var _0x489c68={'raw':!![],'where':{}};var _0x2d5d9b={};var _0x2db98c={'count':0x0,'rows':[]};return db[_0xc538('0x22')]['findOne']({'where':{'id':_0x1433de[_0xc538('0x41')]['id']}})['then'](handleEntityNotFound(_0x30a1db,null))[_0xc538('0x1e')](function(_0x301352){if(_0x301352){_0x2d5d9b['model']=_[_0xc538('0x28')](db[_0xc538('0x45')][_0xc538('0x23')]);_0x2d5d9b[_0xc538('0x25')]=_[_0xc538('0x28')](_0x1433de[_0xc538('0x25')]);_0x2d5d9b[_0xc538('0x29')]=_[_0xc538('0x2a')](_0x2d5d9b[_0xc538('0x24')],_0x2d5d9b[_0xc538('0x25')]);_0x489c68[_0xc538('0x2c')]=_['intersection'](_0x2d5d9b['model'],qs[_0xc538('0x2b')](_0x1433de[_0xc538('0x25')][_0xc538('0x2b')]));_0x489c68[_0xc538('0x2c')]=_0x489c68[_0xc538('0x2c')]['length']?_0x489c68[_0xc538('0x2c')]:_0x2d5d9b[_0xc538('0x24')];if(!_0x1433de['query'][_0xc538('0x2e')](_0xc538('0x2f'))){_0x489c68[_0xc538('0x17')]=qs['limit'](_0x1433de[_0xc538('0x25')]['limit']);_0x489c68['offset']=qs['offset'](_0x1433de[_0xc538('0x25')][_0xc538('0x16')]);}_0x489c68[_0xc538('0x30')]=qs[_0xc538('0x31')](_0x1433de[_0xc538('0x25')][_0xc538('0x31')]);_0x489c68[_0xc538('0x32')]=qs[_0xc538('0x29')](_['pick'](_0x1433de[_0xc538('0x25')],_0x2d5d9b[_0xc538('0x29')]));_0x489c68[_0xc538('0x32')]['SessionId']=_0x301352['id'];if(_0x1433de[_0xc538('0x25')][_0xc538('0x37')]){_0x489c68['where']=_[_0xc538('0x36')](_0x489c68[_0xc538('0x32')],{'$or':_[_0xc538('0x38')](_0x489c68[_0xc538('0x2c')],function(_0x5bf226){var _0x375a5a={};_0x375a5a[_0x5bf226]={'$like':'%'+_0x1433de['query']['filter']+'%'};return _0x375a5a;})});}_0x489c68=_[_0xc538('0x36')]({},_0x489c68,_0x1433de[_0xc538('0x39')]);return db[_0xc538('0x45')][_0xc538('0x3a')]({'where':_0x489c68[_0xc538('0x32')]})['then'](function(_0x207ffa){_0x2db98c[_0xc538('0x3a')]=_0x207ffa;if(_0x1433de[_0xc538('0x25')][_0xc538('0x46')]){_0x489c68[_0xc538('0x3b')]=[{'all':!![]}];}return db[_0xc538('0x45')][_0xc538('0x3c')](_0x489c68);})[_0xc538('0x1e')](function(_0x304136){_0x2db98c[_0xc538('0x47')]=_0x304136;return _0x2db98c;});}})[_0xc538('0x1e')](respondWithFilteredResult(_0x30a1db,_0x489c68))[_0xc538('0x3d')](handleError(_0x30a1db,null));}; \ No newline at end of file +var _0x7de5=['util','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','getQuestions','nolimit','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3da647,_0xa1a501){var _0x2e91a2=function(_0x34a811){while(--_0x34a811){_0x3da647['push'](_0x3da647['shift']());}};_0x2e91a2(++_0xa1a501);}(_0x7de5,0x96));var _0x57de=function(_0x1654e,_0x31262b){_0x1654e=_0x1654e-0x0;var _0x544920=_0x7de5[_0x1654e];return _0x544920;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x57de('0x0'));var rimraf=require(_0x57de('0x1'));var zipdir=require(_0x57de('0x2'));var jsonpatch=require(_0x57de('0x3'));var rp=require(_0x57de('0x4'));var moment=require(_0x57de('0x5'));var BPromise=require(_0x57de('0x6'));var Mustache=require(_0x57de('0x7'));var util=require(_0x57de('0x8'));var path=require('path');var sox=require(_0x57de('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x57de('0xa'));var squel=require(_0x57de('0xb'));var crypto=require('crypto');var jsforce=require(_0x57de('0xc'));var deskjs=require(_0x57de('0xd'));var toCsv=require(_0x57de('0xe'));var querystring=require(_0x57de('0xf'));var Papa=require(_0x57de('0x10'));var Redis=require('ioredis');var qs=require(_0x57de('0x11'));var logger=require(_0x57de('0x12'))(_0x57de('0x13'));var utils=require(_0x57de('0x14'));var config=require(_0x57de('0x15'));var db=require(_0x57de('0x16'))['db'];function respondWithStatusCode(_0x3c7c31,_0x1878a1){_0x1878a1=_0x1878a1||0xcc;return function(_0x5eab7f){if(_0x5eab7f){return _0x3c7c31[_0x57de('0x17')](_0x1878a1);}return _0x3c7c31[_0x57de('0x18')](_0x1878a1)['end']();};}function respondWithResult(_0x253ee1,_0x2206f5){_0x2206f5=_0x2206f5||0xc8;return function(_0x59fe56){if(_0x59fe56){return _0x253ee1[_0x57de('0x18')](_0x2206f5)['json'](_0x59fe56);}};}function respondWithFilteredResult(_0x97a760,_0x4a109b){return function(_0x396691){if(_0x396691){var _0x185f89=_0x396691[_0x57de('0x19')],_0x9b8f52=_0x4a109b[_0x57de('0x1a')],_0x1b13d7=_0x4a109b['offset']+_0x4a109b[_0x57de('0x1b')],_0x5b6eef;if(_0x1b13d7>=_0x185f89){_0x1b13d7=_0x185f89;_0x5b6eef=0xc8;}else{_0x5b6eef=0xce;}_0x97a760[_0x57de('0x18')](_0x5b6eef);return _0x97a760[_0x57de('0x1c')](_0x57de('0x1d'),_0x9b8f52+'-'+_0x1b13d7+'/'+_0x185f89)[_0x57de('0x1e')](_0x396691);}return null;};}function patchUpdates(_0x58c012){return function(_0x206b05){try{jsonpatch[_0x57de('0x1f')](_0x206b05,_0x58c012,!![]);}catch(_0xd8f807){return BPromise[_0x57de('0x20')](_0xd8f807);}return _0x206b05[_0x57de('0x21')]();};}function saveUpdates(_0x349129,_0x2caae8){return function(_0x31169e){if(_0x31169e){return _0x31169e['update'](_0x349129)[_0x57de('0x22')](function(_0x1d3e5d){return _0x1d3e5d;});}return null;};}function removeEntity(_0x449462,_0x4ab441){return function(_0x2f9d92){if(_0x2f9d92){return _0x2f9d92[_0x57de('0x23')]()[_0x57de('0x22')](function(){_0x449462[_0x57de('0x18')](0xcc)[_0x57de('0x24')]();});}};}function handleEntityNotFound(_0x468e09,_0x14b9ba){return function(_0x1c0b78){if(!_0x1c0b78){_0x468e09[_0x57de('0x17')](0x194);}return _0x1c0b78;};}function handleError(_0x5caada,_0x3757f3){_0x3757f3=_0x3757f3||0x1f4;return function(_0x3b8a7c){logger[_0x57de('0x25')](_0x3b8a7c[_0x57de('0x26')]);if(_0x3b8a7c[_0x57de('0x27')]){delete _0x3b8a7c[_0x57de('0x27')];}_0x5caada[_0x57de('0x18')](_0x3757f3)['send'](_0x3b8a7c);};}exports[_0x57de('0x28')]=function(_0x43ebcf,_0x294f98){var _0x3bc57f={},_0x4c3f03={},_0x4a8c24={'count':0x0,'rows':[]};var _0x1e7f19=db['JscriptySessionReport'][_0x57de('0x29')];_0x4c3f03[_0x57de('0x2a')]=_['keys'](_0x1e7f19);var _0x1470e0={'dateStart':_0x43ebcf[_0x57de('0x2b')][_0x57de('0x2c')],'dateEnd':_0x43ebcf['query'][_0x57de('0x2d')]};delete _0x43ebcf[_0x57de('0x2b')]['dateStart'];delete _0x43ebcf['query'][_0x57de('0x2d')];_0x4c3f03[_0x57de('0x2b')]=_[_0x57de('0x2e')](_0x43ebcf[_0x57de('0x2b')]);_0x4c3f03[_0x57de('0x2f')]=_[_0x57de('0x30')](_0x4c3f03[_0x57de('0x2a')],_0x4c3f03['query']);_0x3bc57f[_0x57de('0x31')]=_[_0x57de('0x30')](_0x4c3f03[_0x57de('0x2a')],qs['fields'](_0x43ebcf[_0x57de('0x2b')][_0x57de('0x32')]));_0x3bc57f[_0x57de('0x31')]=_0x3bc57f[_0x57de('0x31')]['length']?_0x3bc57f[_0x57de('0x31')]:_0x4c3f03[_0x57de('0x2a')];if(!_0x43ebcf[_0x57de('0x2b')][_0x57de('0x33')]('nolimit')){_0x3bc57f['limit']=qs[_0x57de('0x1b')](_0x43ebcf[_0x57de('0x2b')]['limit']);_0x3bc57f['offset']=qs['offset'](_0x43ebcf[_0x57de('0x2b')][_0x57de('0x1a')]);}_0x3bc57f[_0x57de('0x34')]=qs[_0x57de('0x35')](_0x43ebcf['query'][_0x57de('0x35')]);_0x3bc57f[_0x57de('0x36')]=qs[_0x57de('0x2f')](_[_0x57de('0x37')](_0x43ebcf[_0x57de('0x2b')],_0x4c3f03[_0x57de('0x2f')]));if(_0x1470e0['dateStart']){if(_0x1470e0[_0x57de('0x2d')]){_0x1470e0['dateEnd']=moment(_0x1470e0[_0x57de('0x2d')])['add'](0x1,'day');}else{_0x1470e0[_0x57de('0x2d')]=moment(_0x1470e0['dateStart'])[_0x57de('0x38')](0x1,_0x57de('0x39'));}_[_0x57de('0x3a')](_0x3bc57f[_0x57de('0x36')],{'createdAt':{'$gte':_0x1470e0[_0x57de('0x2c')],'$lte':_0x1470e0[_0x57de('0x2d')]}});}if(_0x43ebcf[_0x57de('0x2b')][_0x57de('0x3b')]){_0x3bc57f[_0x57de('0x36')]=_['merge'](_0x3bc57f['where'],{'$or':_[_0x57de('0x3c')](_0x3bc57f[_0x57de('0x31')],function(_0x4e89d8){var _0x4944ec={};_0x4944ec[_0x4e89d8]={'$like':'%'+_0x43ebcf['query']['filter']+'%'};return _0x4944ec;})});}_0x3bc57f=_[_0x57de('0x3a')]({},_0x3bc57f,_0x43ebcf[_0x57de('0x3d')]);var _0x45b578={'where':_0x3bc57f[_0x57de('0x36')]};return db[_0x57de('0x3e')][_0x57de('0x19')](_0x45b578)[_0x57de('0x22')](function(_0x4aee3b){_0x4a8c24[_0x57de('0x19')]=_0x4aee3b;if(_0x43ebcf[_0x57de('0x2b')][_0x57de('0x3f')]){_0x3bc57f[_0x57de('0x40')]=[{'all':!![]}];}return db[_0x57de('0x3e')][_0x57de('0x41')](_0x3bc57f);})[_0x57de('0x22')](function(_0x54c624){_0x4a8c24[_0x57de('0x42')]=_0x54c624;return _0x4a8c24;})[_0x57de('0x22')](respondWithFilteredResult(_0x294f98,_0x3bc57f))[_0x57de('0x43')](handleError(_0x294f98,null));};exports[_0x57de('0x44')]=function(_0x3b3603,_0xc54aae){var _0x240979={'raw':!![],'where':{'id':_0x3b3603[_0x57de('0x45')]['id']}},_0x1be60d={};_0x1be60d[_0x57de('0x2a')]=_[_0x57de('0x2e')](db[_0x57de('0x3e')][_0x57de('0x29')]);_0x1be60d[_0x57de('0x2b')]=_['keys'](_0x3b3603[_0x57de('0x2b')]);_0x1be60d[_0x57de('0x2f')]=_[_0x57de('0x30')](_0x1be60d[_0x57de('0x2a')],_0x1be60d[_0x57de('0x2b')]);_0x240979[_0x57de('0x31')]=_[_0x57de('0x30')](_0x1be60d[_0x57de('0x2a')],qs['fields'](_0x3b3603[_0x57de('0x2b')][_0x57de('0x32')]));_0x240979[_0x57de('0x31')]=_0x240979[_0x57de('0x31')]['length']?_0x240979[_0x57de('0x31')]:_0x1be60d[_0x57de('0x2a')];if(_0x3b3603['query'][_0x57de('0x3f')]){_0x240979[_0x57de('0x40')]=[{'all':!![]}];}_0x240979=_[_0x57de('0x3a')]({},_0x240979,_0x3b3603[_0x57de('0x3d')]);return db[_0x57de('0x3e')][_0x57de('0x46')](_0x240979)[_0x57de('0x22')](handleEntityNotFound(_0xc54aae,null))[_0x57de('0x22')](respondWithResult(_0xc54aae,null))[_0x57de('0x43')](handleError(_0xc54aae,null));};exports[_0x57de('0x47')]=function(_0x650494,_0x4e4bb2){return db[_0x57de('0x3e')][_0x57de('0x47')](_0x650494[_0x57de('0x48')],{})['then'](respondWithResult(_0x4e4bb2,0xc9))[_0x57de('0x43')](handleError(_0x4e4bb2,null));};exports[_0x57de('0x49')]=function(_0x5a34f4,_0x2a5e8e){if(_0x5a34f4[_0x57de('0x48')]['id']){delete _0x5a34f4[_0x57de('0x48')]['id'];}return db[_0x57de('0x3e')][_0x57de('0x46')]({'where':{'id':_0x5a34f4['params']['id']}})[_0x57de('0x22')](handleEntityNotFound(_0x2a5e8e,null))[_0x57de('0x22')](saveUpdates(_0x5a34f4[_0x57de('0x48')],null))['then'](respondWithResult(_0x2a5e8e,null))[_0x57de('0x43')](handleError(_0x2a5e8e,null));};exports[_0x57de('0x23')]=function(_0x161c9b,_0x1bd47e){return db['JscriptySessionReport'][_0x57de('0x46')]({'where':{'id':_0x161c9b['params']['id']}})[_0x57de('0x22')](handleEntityNotFound(_0x1bd47e,null))[_0x57de('0x22')](removeEntity(_0x1bd47e,null))['catch'](handleError(_0x1bd47e,null));};exports[_0x57de('0x4a')]=function(_0x927d0e,_0x3407b8){return db[_0x57de('0x3e')][_0x57de('0x4a')]()[_0x57de('0x22')](respondWithResult(_0x3407b8,null))[_0x57de('0x43')](handleError(_0x3407b8,null));};exports[_0x57de('0x4b')]=function(_0x37b9de,_0x50e02d,_0x281ae9){var _0x9f8baa={'raw':!![],'where':{}};var _0x2c3682={};var _0x1c0f76={'count':0x0,'rows':[]};return db[_0x57de('0x3e')]['findOne']({'where':{'id':_0x37b9de['params']['id']}})[_0x57de('0x22')](handleEntityNotFound(_0x50e02d,null))[_0x57de('0x22')](function(_0x1d24f3){if(_0x1d24f3){_0x2c3682[_0x57de('0x2a')]=_[_0x57de('0x2e')](db['JscriptyQuestionReport'][_0x57de('0x29')]);_0x2c3682[_0x57de('0x2b')]=_[_0x57de('0x2e')](_0x37b9de[_0x57de('0x2b')]);_0x2c3682[_0x57de('0x2f')]=_[_0x57de('0x30')](_0x2c3682[_0x57de('0x2a')],_0x2c3682['query']);_0x9f8baa[_0x57de('0x31')]=_['intersection'](_0x2c3682['model'],qs[_0x57de('0x32')](_0x37b9de[_0x57de('0x2b')][_0x57de('0x32')]));_0x9f8baa['attributes']=_0x9f8baa['attributes']['length']?_0x9f8baa[_0x57de('0x31')]:_0x2c3682['model'];if(!_0x37b9de[_0x57de('0x2b')][_0x57de('0x33')](_0x57de('0x4c'))){_0x9f8baa[_0x57de('0x1b')]=qs[_0x57de('0x1b')](_0x37b9de[_0x57de('0x2b')][_0x57de('0x1b')]);_0x9f8baa[_0x57de('0x1a')]=qs[_0x57de('0x1a')](_0x37b9de[_0x57de('0x2b')]['offset']);}_0x9f8baa[_0x57de('0x34')]=qs[_0x57de('0x35')](_0x37b9de[_0x57de('0x2b')]['sort']);_0x9f8baa['where']=qs[_0x57de('0x2f')](_[_0x57de('0x37')](_0x37b9de[_0x57de('0x2b')],_0x2c3682['filters']));_0x9f8baa['where'][_0x57de('0x4d')]=_0x1d24f3['id'];if(_0x37b9de[_0x57de('0x2b')][_0x57de('0x3b')]){_0x9f8baa['where']=_[_0x57de('0x3a')](_0x9f8baa[_0x57de('0x36')],{'$or':_[_0x57de('0x3c')](_0x9f8baa[_0x57de('0x31')],function(_0xb48cbc){var _0x2bf315={};_0x2bf315[_0xb48cbc]={'$like':'%'+_0x37b9de[_0x57de('0x2b')][_0x57de('0x3b')]+'%'};return _0x2bf315;})});}_0x9f8baa=_[_0x57de('0x3a')]({},_0x9f8baa,_0x37b9de[_0x57de('0x3d')]);return db['JscriptyQuestionReport'][_0x57de('0x19')]({'where':_0x9f8baa['where']})[_0x57de('0x22')](function(_0x2706e0){_0x1c0f76[_0x57de('0x19')]=_0x2706e0;if(_0x37b9de[_0x57de('0x2b')][_0x57de('0x3f')]){_0x9f8baa['include']=[{'all':!![]}];}return db[_0x57de('0x4e')][_0x57de('0x41')](_0x9f8baa);})[_0x57de('0x22')](function(_0x2c5a2d){_0x1c0f76['rows']=_0x2c5a2d;return _0x1c0f76;});}})[_0x57de('0x22')](respondWithFilteredResult(_0x50e02d,_0x9f8baa))[_0x57de('0x43')](handleError(_0x50e02d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 84558b3..6420a9b 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 _0x07c0=['request-promise','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','api','moment','bluebird'];(function(_0x4d35fc,_0x188228){var _0x371c8d=function(_0x11c4bd){while(--_0x11c4bd){_0x4d35fc['push'](_0x4d35fc['shift']());}};_0x371c8d(++_0x188228);}(_0x07c0,0x181));var _0x007c=function(_0x5f0a85,_0x517151){_0x5f0a85=_0x5f0a85-0x0;var _0x3ccda7=_0x07c0[_0x5f0a85];return _0x3ccda7;};'use strict';var _=require(_0x007c('0x0'));var util=require(_0x007c('0x1'));var logger=require('../../config/logger')(_0x007c('0x2'));var moment=require(_0x007c('0x3'));var BPromise=require(_0x007c('0x4'));var rp=require(_0x007c('0x5'));var attributes=require('./jscriptySessionReport.attributes');module[_0x007c('0x6')]=function(_0x2e147f,_0x3992ae){return _0x2e147f[_0x007c('0x7')](_0x007c('0x8'),attributes,{'tableName':_0x007c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcb0=['bluebird','request-promise','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment'];(function(_0x353d60,_0x10f0a5){var _0x304dd5=function(_0x5d9b32){while(--_0x5d9b32){_0x353d60['push'](_0x353d60['shift']());}};_0x304dd5(++_0x10f0a5);}(_0xfcb0,0x1f3));var _0x0fcb=function(_0x19e61b,_0x5a9a6c){_0x19e61b=_0x19e61b-0x0;var _0x34a9e9=_0xfcb0[_0x19e61b];return _0x34a9e9;};'use strict';var _=require(_0x0fcb('0x0'));var util=require(_0x0fcb('0x1'));var logger=require(_0x0fcb('0x2'))(_0x0fcb('0x3'));var moment=require(_0x0fcb('0x4'));var BPromise=require(_0x0fcb('0x5'));var rp=require(_0x0fcb('0x6'));var attributes=require(_0x0fcb('0x7'));module[_0x0fcb('0x8')]=function(_0x110c79,_0x1ee388){return _0x110c79[_0x0fcb('0x9')](_0x0fcb('0xa'),attributes,{'tableName':_0x0fcb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index dbd90f6..b7b9128 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 _0x0272=['../../config/utils','../../config/logger','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x0272,0x15a));var _0x2027=function(_0x4b84d1,_0x592325){_0x4b84d1=_0x4b84d1-0x0;var _0x1dcae3=_0x0272[_0x4b84d1];return _0x1dcae3;};'use strict';var _=require(_0x2027('0x0'));var util=require(_0x2027('0x1'));var moment=require('moment');var BPromise=require(_0x2027('0x2'));var rs=require(_0x2027('0x3'));var fs=require('fs');var Redis=require(_0x2027('0x4'));var db=require(_0x2027('0x5'))['db'];var utils=require(_0x2027('0x6'));var logger=require(_0x2027('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2027('0x8'));var client=jayson[_0x2027('0x9')][_0x2027('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54a8f1,_0x5cd8f3,_0x56c261){return new BPromise(function(_0x2ac3bd,_0x4eb86c){return client[_0x2027('0xb')](_0x54a8f1,_0x56c261)['then'](function(_0x2f549d){logger[_0x2027('0xc')](_0x2027('0xd'),_0x5cd8f3,_0x2027('0xe'));logger['debug'](_0x2027('0xf'),_0x5cd8f3,_0x2027('0xe'),JSON[_0x2027('0x10')](_0x2f549d));if(_0x2f549d[_0x2027('0x11')]){if(_0x2f549d[_0x2027('0x11')][_0x2027('0x12')]===0x1f4){logger['error'](_0x2027('0xd'),_0x5cd8f3,_0x2f549d[_0x2027('0x11')]['message']);return _0x4eb86c(_0x2f549d[_0x2027('0x11')][_0x2027('0x13')]);}logger[_0x2027('0x11')](_0x2027('0xd'),_0x5cd8f3,_0x2f549d['error'][_0x2027('0x13')]);return _0x2ac3bd(_0x2f549d['error'][_0x2027('0x13')]);}else{logger[_0x2027('0xc')](_0x2027('0xd'),_0x5cd8f3,_0x2027('0xe'));_0x2ac3bd(_0x2f549d[_0x2027('0x14')][_0x2027('0x13')]);}})[_0x2027('0x15')](function(_0x4e8bc8){logger[_0x2027('0x11')](_0x2027('0xd'),_0x5cd8f3,_0x4e8bc8);_0x4eb86c(_0x4e8bc8);});});} \ No newline at end of file +var _0x4753=['lodash','util','moment','randomstring','ioredis','../../config/utils','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4a705c,_0x5196c3){var _0x3e1195=function(_0x519726){while(--_0x519726){_0x4a705c['push'](_0x4a705c['shift']());}};_0x3e1195(++_0x5196c3);}(_0x4753,0x1f4));var _0x3475=function(_0x14a653,_0x260e92){_0x14a653=_0x14a653-0x0;var _0x11ca33=_0x4753[_0x14a653];return _0x11ca33;};'use strict';var _=require(_0x3475('0x0'));var util=require(_0x3475('0x1'));var moment=require(_0x3475('0x2'));var BPromise=require('bluebird');var rs=require(_0x3475('0x3'));var fs=require('fs');var Redis=require(_0x3475('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3475('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3475('0x6')][_0x3475('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48c6af,_0x820cbe,_0x157c1e){return new BPromise(function(_0x409bfc,_0x1d021b){return client[_0x3475('0x8')](_0x48c6af,_0x157c1e)[_0x3475('0x9')](function(_0x2c4cd7){logger[_0x3475('0xa')](_0x3475('0xb'),_0x820cbe,_0x3475('0xc'));logger['debug'](_0x3475('0xd'),_0x820cbe,_0x3475('0xc'),JSON[_0x3475('0xe')](_0x2c4cd7));if(_0x2c4cd7['error']){if(_0x2c4cd7[_0x3475('0xf')][_0x3475('0x10')]===0x1f4){logger['error'](_0x3475('0xb'),_0x820cbe,_0x2c4cd7['error'][_0x3475('0x11')]);return _0x1d021b(_0x2c4cd7[_0x3475('0xf')][_0x3475('0x11')]);}logger['error'](_0x3475('0xb'),_0x820cbe,_0x2c4cd7[_0x3475('0xf')][_0x3475('0x11')]);return _0x409bfc(_0x2c4cd7[_0x3475('0xf')]['message']);}else{logger[_0x3475('0xa')]('JscriptySessionReport,\x20%s,\x20%s',_0x820cbe,'request\x20sent');_0x409bfc(_0x2c4cd7[_0x3475('0x12')][_0x3475('0x11')]);}})[_0x3475('0x13')](function(_0x1e0c0a){logger[_0x3475('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x820cbe,_0x1e0c0a);_0x1d021b(_0x1e0c0a);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7b7007e..dfde476 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 _0x1f20=['put','/:id','isAuthenticated','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./license.controller','get','index'];(function(_0x5f5cce,_0x138cc5){var _0x705ecf=function(_0x28bc5d){while(--_0x28bc5d){_0x5f5cce['push'](_0x5f5cce['shift']());}};_0x705ecf(++_0x138cc5);}(_0x1f20,0x1b7));var _0x01f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1f20[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x01f2('0x0'));var util=require(_0x01f2('0x1'));var path=require('path');var timeout=require(_0x01f2('0x2'));var express=require(_0x01f2('0x3'));var router=express['Router']();var auth=require(_0x01f2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x01f2('0x5'));var controller=require(_0x01f2('0x6'));router[_0x01f2('0x7')]('/',controller[_0x01f2('0x8')]);router[_0x01f2('0x9')](_0x01f2('0xa'),auth[_0x01f2('0xb')](),controller[_0x01f2('0xc')]);module[_0x01f2('0xd')]=router; \ No newline at end of file +var _0xfbf4=['./license.controller','get','put','/:id','isAuthenticated','update','exports','multer','connect-timeout','Router','../../components/auth/service'];(function(_0xaa0ef9,_0x161c65){var _0x2f650c=function(_0x3b9489){while(--_0x3b9489){_0xaa0ef9['push'](_0xaa0ef9['shift']());}};_0x2f650c(++_0x161c65);}(_0xfbf4,0x6a));var _0x4fbf=function(_0x3a6e6a,_0x4d0fec){_0x3a6e6a=_0x3a6e6a-0x0;var _0x2fbd5d=_0xfbf4[_0x3a6e6a];return _0x2fbd5d;};'use strict';var multer=require(_0x4fbf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4fbf('0x1'));var express=require('express');var router=express[_0x4fbf('0x2')]();var auth=require(_0x4fbf('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4fbf('0x4'));router[_0x4fbf('0x5')]('/',controller['index']);router[_0x4fbf('0x6')](_0x4fbf('0x7'),auth[_0x4fbf('0x8')](),controller[_0x4fbf('0x9')]);module[_0x4fbf('0xa')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 26a286b..407f093 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 _0xc6c8=['INTEGER','sequelize','TEXT','STRING'];(function(_0x282f3a,_0x2b5322){var _0x969a69=function(_0x4e10e7){while(--_0x4e10e7){_0x282f3a['push'](_0x282f3a['shift']());}};_0x969a69(++_0x2b5322);}(_0xc6c8,0x12d));var _0x8c6c=function(_0x559c96,_0x42a792){_0x559c96=_0x559c96-0x0;var _0x257d18=_0xc6c8[_0x559c96];return _0x257d18;};'use strict';var Sequelize=require(_0x8c6c('0x0'));module['exports']={'license':{'type':Sequelize[_0x8c6c('0x1')]},'data1':{'type':Sequelize[_0x8c6c('0x2')]},'data2':{'type':Sequelize[_0x8c6c('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x8c6c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6dfd=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0xaeaf14,_0x23530b){var _0x477c2c=function(_0x1532b4){while(--_0x1532b4){_0xaeaf14['push'](_0xaeaf14['shift']());}};_0x477c2c(++_0x23530b);}(_0x6dfd,0x7a));var _0xd6df=function(_0x58da8d,_0x462e9d){_0x58da8d=_0x58da8d-0x0;var _0x549771=_0x6dfd[_0x58da8d];return _0x549771;};'use strict';var Sequelize=require(_0xd6df('0x0'));module[_0xd6df('0x1')]={'license':{'type':Sequelize[_0xd6df('0x2')]},'data1':{'type':Sequelize[_0xd6df('0x3')]},'data2':{'type':Sequelize[_0xd6df('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xd6df('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 88165a7..f029bf2 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 _0xacf4=['options','getLicense','catch','body','find','params','checkLicense','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','merge'];(function(_0x4c1a4d,_0x11ff24){var _0x46ce9f=function(_0x447691){while(--_0x447691){_0x4c1a4d['push'](_0x4c1a4d['shift']());}};_0x46ce9f(++_0x11ff24);}(_0xacf4,0xe7));var _0x4acf=function(_0x3f2d35,_0x36db80){_0x3f2d35=_0x3f2d35-0x0;var _0x572caa=_0xacf4[_0x3f2d35];return _0x572caa;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4acf('0x0'));var zipdir=require(_0x4acf('0x1'));var jsonpatch=require(_0x4acf('0x2'));var rp=require(_0x4acf('0x3'));var moment=require(_0x4acf('0x4'));var BPromise=require(_0x4acf('0x5'));var Mustache=require(_0x4acf('0x6'));var util=require('util');var path=require(_0x4acf('0x7'));var sox=require(_0x4acf('0x8'));var csv=require('to-csv');var ejs=require(_0x4acf('0x9'));var fs=require('fs');var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var qs=require(_0x4acf('0x10'));var logger=require(_0x4acf('0x11'))('api');var utils=require(_0x4acf('0x12'));var config=require(_0x4acf('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f22d9,_0x1fe474){_0x1fe474=_0x1fe474||0xcc;return function(_0x540c8f){if(_0x540c8f){return _0x5f22d9['sendStatus'](_0x1fe474);}return _0x5f22d9[_0x4acf('0x14')](_0x1fe474)[_0x4acf('0x15')]();};}function respondWithResult(_0x3734e1,_0x32dc33){_0x32dc33=_0x32dc33||0xc8;return function(_0x18629e){if(_0x18629e){return _0x3734e1[_0x4acf('0x14')](_0x32dc33)[_0x4acf('0x16')](_0x18629e);}};}function respondWithFilteredResult(_0x15386a,_0x2025ca){return function(_0x312bb5){if(_0x312bb5){var _0x2741d3=_0x312bb5[_0x4acf('0x17')],_0x5f0260=_0x2025ca[_0x4acf('0x18')],_0x1b584a=_0x2025ca[_0x4acf('0x18')]+_0x2025ca['limit'],_0x57d8e0;if(_0x1b584a>=_0x2741d3){_0x1b584a=_0x2741d3;_0x57d8e0=0xc8;}else{_0x57d8e0=0xce;}_0x15386a['status'](_0x57d8e0);return _0x15386a[_0x4acf('0x19')](_0x4acf('0x1a'),_0x5f0260+'-'+_0x1b584a+'/'+_0x2741d3)[_0x4acf('0x16')](_0x312bb5);}return null;};}function patchUpdates(_0x4b1d93){return function(_0x2a678b){try{jsonpatch[_0x4acf('0x1b')](_0x2a678b,_0x4b1d93,!![]);}catch(_0x30d289){return BPromise[_0x4acf('0x1c')](_0x30d289);}return _0x2a678b[_0x4acf('0x1d')]();};}function saveUpdates(_0x21e385,_0x2049ba){return function(_0x16ae40){if(_0x16ae40){return _0x16ae40[_0x4acf('0x1e')](_0x21e385)[_0x4acf('0x1f')](function(_0x1a3118){return _0x1a3118;});}return null;};}function removeEntity(_0x5f0284,_0x28d698){return function(_0x6bd89){if(_0x6bd89){return _0x6bd89['destroy']()[_0x4acf('0x1f')](function(){_0x5f0284[_0x4acf('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b26ac,_0x34d154){return function(_0x433b7a){if(!_0x433b7a){_0x3b26ac[_0x4acf('0x20')](0x194);}return _0x433b7a;};}function handleError(_0x53885f,_0x1a2286){_0x1a2286=_0x1a2286||0x1f4;return function(_0x12e717){logger['error'](_0x12e717[_0x4acf('0x21')]);if(_0x12e717[_0x4acf('0x22')]){delete _0x12e717['name'];}_0x53885f[_0x4acf('0x14')](_0x1a2286)[_0x4acf('0x23')](_0x12e717);};}var utilLicense=require(_0x4acf('0x24'));exports[_0x4acf('0x25')]=function(_0x571a30,_0x50236d){var _0x17a756={'raw':!![],'where':{'id':0x1}},_0x3f548a={};_0x3f548a[_0x4acf('0x26')]=_[_0x4acf('0x27')](db[_0x4acf('0x28')][_0x4acf('0x29')]);_0x3f548a[_0x4acf('0x2a')]=_[_0x4acf('0x27')](_0x571a30[_0x4acf('0x2a')]);_0x3f548a[_0x4acf('0x2b')]=_['intersection'](_0x3f548a[_0x4acf('0x26')],_0x3f548a[_0x4acf('0x2a')]);_0x17a756[_0x4acf('0x2c')]=_[_0x4acf('0x2d')](_0x3f548a[_0x4acf('0x26')],qs[_0x4acf('0x2e')](_0x571a30[_0x4acf('0x2a')]['fields']));_0x17a756[_0x4acf('0x2c')]=_0x17a756[_0x4acf('0x2c')][_0x4acf('0x2f')]?_0x17a756['attributes']:_0x3f548a[_0x4acf('0x26')];_0x17a756=_[_0x4acf('0x30')]({},_0x17a756,_0x571a30[_0x4acf('0x31')]);return utilLicense[_0x4acf('0x32')](_0x17a756)['then'](respondWithResult(_0x50236d,null))[_0x4acf('0x33')](handleError(_0x50236d,null));};exports[_0x4acf('0x1e')]=function(_0x3f9990,_0x5e2332){if(_0x3f9990[_0x4acf('0x34')]['id']){delete _0x3f9990[_0x4acf('0x34')]['id'];}return db[_0x4acf('0x28')][_0x4acf('0x35')]({'where':{'id':_0x3f9990[_0x4acf('0x36')]['id']}})[_0x4acf('0x1f')](handleEntityNotFound(_0x5e2332,null))['then'](function(_0x3f7e01){var _0x25748e=_0x3f7e01['get']({'plain':!![]});return utilLicense[_0x4acf('0x37')](_0x25748e,_0x3f9990['body']['key']);})['then'](function(_0x4bd85c){if(!_0x4bd85c['demo']){return saveUpdates(_0x3f9990['body'],null);}return _0x4bd85c;})['then'](respondWithResult(_0x5e2332,null))[_0x4acf('0x33')](handleError(_0x5e2332,null));}; \ No newline at end of file +var _0x0adf=['length','merge','options','getLicense','body','params','get','checkLicense','key','demo','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','reject','save','update','then','error','stack','name','../../config/license/util','index','keys','License','rawAttributes','query','filters','intersection','model','attributes'];(function(_0x417b1a,_0x3cfce5){var _0x1e41af=function(_0xe2e44e){while(--_0xe2e44e){_0x417b1a['push'](_0x417b1a['shift']());}};_0x1e41af(++_0x3cfce5);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x270458,_0x2790d1){_0x270458=_0x270458-0x0;var _0x153abf=_0x0adf[_0x270458];return _0x153abf;};'use strict';var pdf=require(_0xf0ad('0x0'));var emlformat=require(_0xf0ad('0x1'));var rimraf=require(_0xf0ad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0ad('0x3'));var rp=require(_0xf0ad('0x4'));var moment=require(_0xf0ad('0x5'));var BPromise=require(_0xf0ad('0x6'));var Mustache=require(_0xf0ad('0x7'));var util=require(_0xf0ad('0x8'));var path=require(_0xf0ad('0x9'));var sox=require('sox');var csv=require(_0xf0ad('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf0ad('0xb'));var squel=require(_0xf0ad('0xc'));var crypto=require(_0xf0ad('0xd'));var jsforce=require(_0xf0ad('0xe'));var deskjs=require(_0xf0ad('0xf'));var toCsv=require(_0xf0ad('0xa'));var querystring=require(_0xf0ad('0x10'));var Papa=require('papaparse');var Redis=require(_0xf0ad('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0xf0ad('0x12'))(_0xf0ad('0x13'));var utils=require(_0xf0ad('0x14'));var config=require(_0xf0ad('0x15'));var db=require(_0xf0ad('0x16'))['db'];function respondWithStatusCode(_0x4f2b79,_0x59b1a5){_0x59b1a5=_0x59b1a5||0xcc;return function(_0x13ed94){if(_0x13ed94){return _0x4f2b79[_0xf0ad('0x17')](_0x59b1a5);}return _0x4f2b79[_0xf0ad('0x18')](_0x59b1a5)[_0xf0ad('0x19')]();};}function respondWithResult(_0x597c40,_0x3540d1){_0x3540d1=_0x3540d1||0xc8;return function(_0x198cd8){if(_0x198cd8){return _0x597c40['status'](_0x3540d1)['json'](_0x198cd8);}};}function respondWithFilteredResult(_0x5332e9,_0x221d7b){return function(_0x513237){if(_0x513237){var _0x1dad7b=_0x513237[_0xf0ad('0x1a')],_0x313ad6=_0x221d7b['offset'],_0xfa544c=_0x221d7b[_0xf0ad('0x1b')]+_0x221d7b[_0xf0ad('0x1c')],_0xfa829e;if(_0xfa544c>=_0x1dad7b){_0xfa544c=_0x1dad7b;_0xfa829e=0xc8;}else{_0xfa829e=0xce;}_0x5332e9[_0xf0ad('0x18')](_0xfa829e);return _0x5332e9[_0xf0ad('0x1d')]('Content-Range',_0x313ad6+'-'+_0xfa544c+'/'+_0x1dad7b)['json'](_0x513237);}return null;};}function patchUpdates(_0x2466e8){return function(_0x46fb20){try{jsonpatch['apply'](_0x46fb20,_0x2466e8,!![]);}catch(_0x32d05c){return BPromise[_0xf0ad('0x1e')](_0x32d05c);}return _0x46fb20[_0xf0ad('0x1f')]();};}function saveUpdates(_0x411e7b,_0x4cc08a){return function(_0x57c570){if(_0x57c570){return _0x57c570[_0xf0ad('0x20')](_0x411e7b)[_0xf0ad('0x21')](function(_0x37b968){return _0x37b968;});}return null;};}function removeEntity(_0x20c5f3,_0x2ac8ba){return function(_0x22d50f){if(_0x22d50f){return _0x22d50f['destroy']()[_0xf0ad('0x21')](function(){_0x20c5f3[_0xf0ad('0x18')](0xcc)[_0xf0ad('0x19')]();});}};}function handleEntityNotFound(_0x3ece1e,_0x29d647){return function(_0x88b47b){if(!_0x88b47b){_0x3ece1e[_0xf0ad('0x17')](0x194);}return _0x88b47b;};}function handleError(_0x276322,_0x3fc97e){_0x3fc97e=_0x3fc97e||0x1f4;return function(_0x112f20){logger[_0xf0ad('0x22')](_0x112f20[_0xf0ad('0x23')]);if(_0x112f20[_0xf0ad('0x24')]){delete _0x112f20[_0xf0ad('0x24')];}_0x276322[_0xf0ad('0x18')](_0x3fc97e)['send'](_0x112f20);};}var utilLicense=require(_0xf0ad('0x25'));exports[_0xf0ad('0x26')]=function(_0x248794,_0x7377d7){var _0x28c280={'raw':!![],'where':{'id':0x1}},_0x30f8ee={};_0x30f8ee['model']=_[_0xf0ad('0x27')](db[_0xf0ad('0x28')][_0xf0ad('0x29')]);_0x30f8ee[_0xf0ad('0x2a')]=_[_0xf0ad('0x27')](_0x248794[_0xf0ad('0x2a')]);_0x30f8ee[_0xf0ad('0x2b')]=_[_0xf0ad('0x2c')](_0x30f8ee[_0xf0ad('0x2d')],_0x30f8ee[_0xf0ad('0x2a')]);_0x28c280[_0xf0ad('0x2e')]=_['intersection'](_0x30f8ee[_0xf0ad('0x2d')],qs['fields'](_0x248794[_0xf0ad('0x2a')]['fields']));_0x28c280[_0xf0ad('0x2e')]=_0x28c280[_0xf0ad('0x2e')][_0xf0ad('0x2f')]?_0x28c280[_0xf0ad('0x2e')]:_0x30f8ee[_0xf0ad('0x2d')];_0x28c280=_[_0xf0ad('0x30')]({},_0x28c280,_0x248794[_0xf0ad('0x31')]);return utilLicense[_0xf0ad('0x32')](_0x28c280)['then'](respondWithResult(_0x7377d7,null))['catch'](handleError(_0x7377d7,null));};exports[_0xf0ad('0x20')]=function(_0x113bf2,_0xd608bf){if(_0x113bf2[_0xf0ad('0x33')]['id']){delete _0x113bf2['body']['id'];}return db[_0xf0ad('0x28')]['find']({'where':{'id':_0x113bf2[_0xf0ad('0x34')]['id']}})['then'](handleEntityNotFound(_0xd608bf,null))[_0xf0ad('0x21')](function(_0x4846b1){var _0x3d9e48=_0x4846b1[_0xf0ad('0x35')]({'plain':!![]});return utilLicense[_0xf0ad('0x36')](_0x3d9e48,_0x113bf2[_0xf0ad('0x33')][_0xf0ad('0x37')]);})[_0xf0ad('0x21')](function(_0x25cca0){if(!_0x25cca0[_0xf0ad('0x38')]){return saveUpdates(_0x113bf2['body'],null);}return _0x25cca0;})[_0xf0ad('0x21')](respondWithResult(_0xd608bf,null))['catch'](handleError(_0xd608bf,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 2f2920a..a051df8 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 _0x52b2=['moment','bluebird','./license.attributes','exports','define','license','lodash','util','../../config/logger','api'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x52b2,0x11e));var _0x252b=function(_0x484fc8,_0x1c5901){_0x484fc8=_0x484fc8-0x0;var _0x59cedf=_0x52b2[_0x484fc8];return _0x59cedf;};'use strict';var _=require(_0x252b('0x0'));var util=require(_0x252b('0x1'));var logger=require(_0x252b('0x2'))(_0x252b('0x3'));var moment=require(_0x252b('0x4'));var BPromise=require(_0x252b('0x5'));var rp=require('request-promise');var attributes=require(_0x252b('0x6'));module[_0x252b('0x7')]=function(_0x3d1a7c,_0x1bccec){return _0x3d1a7c[_0x252b('0x8')]('License',attributes,{'tableName':_0x252b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fdb=['moment','bluebird','request-promise','./license.attributes','exports','License','lodash','util','../../config/logger','api'];(function(_0x5b2e2c,_0x7c10d8){var _0xc21107=function(_0x219a3d){while(--_0x219a3d){_0x5b2e2c['push'](_0x5b2e2c['shift']());}};_0xc21107(++_0x7c10d8);}(_0x4fdb,0x9c));var _0xb4fd=function(_0xde049e,_0x2c789a){_0xde049e=_0xde049e-0x0;var _0x3e27be=_0x4fdb[_0xde049e];return _0x3e27be;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var attributes=require(_0xb4fd('0x7'));module[_0xb4fd('0x8')]=function(_0x5b73bb,_0x308de6){return _0x5b73bb['define'](_0xb4fd('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index d8aaff4..aef97a3 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 _0x52b8=['client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x52b8,0x1d9));var _0x852b=function(_0x44c12d,_0x40a33a){_0x44c12d=_0x44c12d-0x0;var _0x49955a=_0x52b8[_0x44c12d];return _0x49955a;};'use strict';var _=require(_0x852b('0x0'));var util=require('util');var moment=require(_0x852b('0x1'));var BPromise=require(_0x852b('0x2'));var rs=require(_0x852b('0x3'));var fs=require('fs');var Redis=require(_0x852b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x852b('0x5'));var logger=require(_0x852b('0x6'))(_0x852b('0x7'));var config=require(_0x852b('0x8'));var jayson=require(_0x852b('0x9'));var client=jayson[_0x852b('0xa')][_0x852b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c46b1,_0x5b363f,_0x503ceb){return new BPromise(function(_0x1d9ff9,_0x261281){return client['request'](_0x5c46b1,_0x503ceb)[_0x852b('0xc')](function(_0xe89b07){logger[_0x852b('0xd')](_0x852b('0xe'),_0x5b363f,_0x852b('0xf'));logger[_0x852b('0x10')](_0x852b('0x11'),_0x5b363f,_0x852b('0xf'),JSON[_0x852b('0x12')](_0xe89b07));if(_0xe89b07[_0x852b('0x13')]){if(_0xe89b07[_0x852b('0x13')]['code']===0x1f4){logger[_0x852b('0x13')](_0x852b('0xe'),_0x5b363f,_0xe89b07[_0x852b('0x13')][_0x852b('0x14')]);return _0x261281(_0xe89b07['error'][_0x852b('0x14')]);}logger[_0x852b('0x13')](_0x852b('0xe'),_0x5b363f,_0xe89b07[_0x852b('0x13')][_0x852b('0x14')]);return _0x1d9ff9(_0xe89b07[_0x852b('0x13')][_0x852b('0x14')]);}else{logger['info'](_0x852b('0xe'),_0x5b363f,'request\x20sent');_0x1d9ff9(_0xe89b07[_0x852b('0x15')][_0x852b('0x14')]);}})[_0x852b('0x16')](function(_0x4b853d){logger[_0x852b('0x13')](_0x852b('0xe'),_0x5b363f,_0x4b853d);_0x261281(_0x4b853d);});});} \ No newline at end of file +var _0xd6c8=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0xd6c8,0x74));var _0x8d6c=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0xd6c8[_0x1314d4];return _0x584ba5;};'use strict';var _=require(_0x8d6c('0x0'));var util=require(_0x8d6c('0x1'));var moment=require(_0x8d6c('0x2'));var BPromise=require(_0x8d6c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d6c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d6c('0x5'));var logger=require(_0x8d6c('0x6'))(_0x8d6c('0x7'));var config=require(_0x8d6c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8d6c('0x9')][_0x8d6c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39407a,_0x2f0ed5,_0x2abb7d){return new BPromise(function(_0x24ac55,_0x18142d){return client[_0x8d6c('0xb')](_0x39407a,_0x2abb7d)[_0x8d6c('0xc')](function(_0x216f9f){logger[_0x8d6c('0xd')]('License,\x20%s,\x20%s',_0x2f0ed5,_0x8d6c('0xe'));logger[_0x8d6c('0xf')](_0x8d6c('0x10'),_0x2f0ed5,_0x8d6c('0xe'),JSON[_0x8d6c('0x11')](_0x216f9f));if(_0x216f9f[_0x8d6c('0x12')]){if(_0x216f9f[_0x8d6c('0x12')][_0x8d6c('0x13')]===0x1f4){logger[_0x8d6c('0x12')](_0x8d6c('0x14'),_0x2f0ed5,_0x216f9f['error'][_0x8d6c('0x15')]);return _0x18142d(_0x216f9f[_0x8d6c('0x12')]['message']);}logger[_0x8d6c('0x12')](_0x8d6c('0x14'),_0x2f0ed5,_0x216f9f[_0x8d6c('0x12')][_0x8d6c('0x15')]);return _0x24ac55(_0x216f9f[_0x8d6c('0x12')][_0x8d6c('0x15')]);}else{logger[_0x8d6c('0xd')](_0x8d6c('0x14'),_0x2f0ed5,_0x8d6c('0xe'));_0x24ac55(_0x216f9f[_0x8d6c('0x16')][_0x8d6c('0x15')]);}})[_0x8d6c('0x17')](function(_0x3248b3){logger[_0x8d6c('0x12')]('License,\x20%s,\x20%s',_0x2f0ed5,_0x3248b3);_0x18142d(_0x3248b3);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 428e63f..fd406c1 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 _0x9957=['update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','/:id/users','getAgents','post','/:id/in_servers','addImap','addSmtp','/:id/interactions','addInteraction','/:id/send','send','addAgents'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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('./mailAccount.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('0x8')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x8')]('/:id/in_servers',auth[_0x7995('0x9')](),controller[_0x7995('0x12')]);router[_0x7995('0x8')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x7995('0x15')]);router[_0x7995('0x8')](_0x7995('0x16'),auth[_0x7995('0x9')](),controller[_0x7995('0x17')]);router[_0x7995('0x8')](_0x7995('0x18'),auth[_0x7995('0x9')](),controller['getMessages']);router[_0x7995('0x8')]('/:id/verify',auth[_0x7995('0x9')](),controller[_0x7995('0x19')]);router[_0x7995('0x8')](_0x7995('0x1a'),auth[_0x7995('0x9')](),controller[_0x7995('0x1b')]);router['post']('/:id/dispositions',auth[_0x7995('0x9')](),controller['addDisposition']);router['post'](_0x7995('0x10'),auth[_0x7995('0x9')](),controller['addAnswer']);router[_0x7995('0x1c')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7995('0x1c')](_0x7995('0x1d'),auth[_0x7995('0x9')](),controller[_0x7995('0x1e')]);router[_0x7995('0x1c')](_0x7995('0x13'),auth['isAuthenticated'](),controller[_0x7995('0x1f')]);router[_0x7995('0x1c')](_0x7995('0x20'),auth[_0x7995('0x9')](),controller[_0x7995('0x21')]);router[_0x7995('0x1c')](_0x7995('0x16'),auth[_0x7995('0x9')](),controller['addApplications']);router[_0x7995('0x1c')](_0x7995('0x22'),auth[_0x7995('0x9')](),controller[_0x7995('0x23')]);router[_0x7995('0x1c')](_0x7995('0x1a'),auth['isAuthenticated'](),controller[_0x7995('0x24')]);router['put'](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x25')]);router[_0x7995('0x26')](_0x7995('0xe'),auth['isAuthenticated'](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x10'),auth[_0x7995('0x9')](),controller[_0x7995('0x28')]);router['delete']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x7995('0x29')]);router[_0x7995('0x26')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x2a')]);router[_0x7995('0x26')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x2b')]);router['delete'](_0x7995('0x1a'),auth[_0x7995('0x9')](),controller[_0x7995('0x2c')]);module[_0x7995('0x2d')]=router; \ No newline at end of file +var _0xa9e0=['removeImap','removeSmtp','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addSmtp','addInteraction','addApplications','send','put','delete','removeDispositions','removeAnswers','/:id/in_servers'];(function(_0x482b4c,_0x35e8c6){var _0x3f1903=function(_0xc3bdc5){while(--_0xc3bdc5){_0x482b4c['push'](_0x482b4c['shift']());}};_0x3f1903(++_0x35e8c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/in_servers',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['getApplications']);router[_0x0a9e('0x7')]('/:id/messages',auth[_0x0a9e('0x8')](),controller['getMessages']);router[_0x0a9e('0x7')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x18')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')]('/:id/in_servers',auth[_0x0a9e('0x8')](),controller['addImap']);router['post'](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/interactions',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1d')]);router[_0x0a9e('0x18')](_0x0a9e('0x13'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1e')]);router[_0x0a9e('0x18')]('/:id/send',auth['isAuthenticated'](),controller[_0x0a9e('0x1f')]);router[_0x0a9e('0x18')](_0x0a9e('0x16'),auth[_0x0a9e('0x8')](),controller['addAgents']);router[_0x0a9e('0x20')]('/:id',auth[_0x0a9e('0x8')](),controller['update']);router[_0x0a9e('0x21')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x22')]);router[_0x0a9e('0x21')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x23')]);router['delete'](_0x0a9e('0x24'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')]('/:id/out_servers',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x26')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x21')](_0x0a9e('0x16'),auth[_0x0a9e('0x8')](),controller['removeAgents']);module[_0x0a9e('0x28')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 8bfd41b..99d5667 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 _0x13c0=['UNSIGNED','sequelize','exports','STRING','TEXT','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x2d69e1,_0x43f881){var _0x9b5140=function(_0x374b86){while(--_0x374b86){_0x2d69e1['push'](_0x2d69e1['shift']());}};_0x9b5140(++_0x43f881);}(_0x13c0,0x79));var _0x013c=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x13c0[_0x3a6efd];return _0x487b9a;};'use strict';var Sequelize=require(_0x013c('0x0'));module[_0x013c('0x1')]={'description':{'type':Sequelize[_0x013c('0x2')]},'name':{'type':Sequelize[_0x013c('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x013c('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x013c('0x3')]},'markAsUnread':{'type':Sequelize[_0x013c('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x013c('0x2')],'allowNull':![],'defaultValue':_0x013c('0x5')},'fontSize':{'type':Sequelize[_0x013c('0x6')](0x2)[_0x013c('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x013c('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x013c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x013c('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x013c('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x013c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x5b05=['INTEGER','exports','STRING','BOOLEAN','TEXT','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5b05,0x190));var _0x55b0=function(_0x3d9095,_0x49ecbe){_0x3d9095=_0x3d9095-0x0;var _0x164ec9=_0x5b05[_0x3d9095];return _0x164ec9;};'use strict';var Sequelize=require('sequelize');module[_0x55b0('0x0')]={'description':{'type':Sequelize[_0x55b0('0x1')]},'name':{'type':Sequelize[_0x55b0('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x55b0('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x55b0('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x55b0('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x55b0('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x55b0('0x3')]},'markAsUnread':{'type':Sequelize[_0x55b0('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x55b0('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x55b0('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x55b0('0x3')],'defaultValue':function(){return _0x55b0('0x5');}},'notificationSound':{'type':Sequelize[_0x55b0('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x55b0('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x55b0('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x55b0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x55b0('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x55b0('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 a185b3f..988434b 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 _0x2ab3=['papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','destroy','get','UserProfileResource','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','MailAccount','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','add','day','merge','filter','options','include','findAll','show','params','intersection','includeAll','find','update','body','describe','addDisposition','MailAccountId','Disposition','create','length','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','map','removeAnswers','key','email','ListId','active','description','isNil','cservice','cauthentication','user','pass','authentication','host','port','service','cuser','password','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailAccounts','userProfileId','autoAssociation','getImap','addImap','setImap','getSmtp','addInteraction','omit','getInteractions','MailInteraction','order','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','from','attachments','join','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2ab3,0x162));var _0x32ab=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x2ab3[_0x424501];return _0xb719af;};'use strict';var pdf=require(_0x32ab('0x0'));var emlformat=require(_0x32ab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x32ab('0x2'));var jsonpatch=require(_0x32ab('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x32ab('0x4'));var Mustache=require(_0x32ab('0x5'));var util=require(_0x32ab('0x6'));var path=require(_0x32ab('0x7'));var sox=require('sox');var csv=require(_0x32ab('0x8'));var ejs=require(_0x32ab('0x9'));var fs=require('fs');var _=require(_0x32ab('0xa'));var squel=require(_0x32ab('0xb'));var crypto=require(_0x32ab('0xc'));var jsforce=require(_0x32ab('0xd'));var deskjs=require(_0x32ab('0xe'));var toCsv=require(_0x32ab('0x8'));var querystring=require(_0x32ab('0xf'));var Papa=require(_0x32ab('0x10'));var Redis=require(_0x32ab('0x11'));var qs=require(_0x32ab('0x12'));var logger=require(_0x32ab('0x13'))('api');var utils=require(_0x32ab('0x14'));var config=require(_0x32ab('0x15'));var db=require('../../mysqldb')['db'];config[_0x32ab('0x16')]=_[_0x32ab('0x17')](config[_0x32ab('0x16')],{'host':_0x32ab('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32ab('0x16')]));require(_0x32ab('0x19'))[_0x32ab('0x1a')](socket);var jayson=require(_0x32ab('0x1b'));var client=jayson[_0x32ab('0x1c')][_0x32ab('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x58e9c5,_0x41b207,_0x4aab7c,_0x11fb65){return new BPromise(function(_0x36405e,_0x558672){var _0x23bf84=_0x11fb65||client;return _0x23bf84[_0x32ab('0x1e')](_0x58e9c5,_0x4aab7c)[_0x32ab('0x1f')](function(_0x164530){logger[_0x32ab('0x20')]('MailAccount,\x20%s,\x20%s',_0x41b207,_0x32ab('0x21'));logger[_0x32ab('0x22')](_0x32ab('0x23'),_0x41b207,'request\x20sent',JSON['stringify'](_0x164530));if(_0x164530['error']){if(_0x164530[_0x32ab('0x24')][_0x32ab('0x25')]===0x1f4){logger[_0x32ab('0x24')](_0x32ab('0x26'),_0x41b207,_0x164530[_0x32ab('0x24')][_0x32ab('0x27')]);return _0x558672(_0x164530[_0x32ab('0x24')][_0x32ab('0x27')]);}logger[_0x32ab('0x24')](_0x32ab('0x26'),_0x41b207,_0x164530[_0x32ab('0x24')][_0x32ab('0x27')]);return _0x36405e(_0x164530[_0x32ab('0x24')][_0x32ab('0x27')]);}else{logger[_0x32ab('0x20')](_0x32ab('0x26'),_0x41b207,_0x32ab('0x21'));_0x36405e(_0x164530[_0x32ab('0x28')][_0x32ab('0x27')]);}})[_0x32ab('0x29')](function(_0xd63e6){logger[_0x32ab('0x24')](_0x32ab('0x26'),_0x41b207,_0xd63e6);_0x558672(_0xd63e6);});});}function respondWithStatusCode(_0x15bc04,_0x3ac70c){_0x3ac70c=_0x3ac70c||0xcc;return function(_0x45c56f){if(_0x45c56f){return _0x15bc04[_0x32ab('0x2a')](_0x3ac70c);}return _0x15bc04[_0x32ab('0x2b')](_0x3ac70c)[_0x32ab('0x2c')]();};}function respondWithResult(_0x1694d8,_0x46ecd3){_0x46ecd3=_0x46ecd3||0xc8;return function(_0x58e54b){if(_0x58e54b){return _0x1694d8[_0x32ab('0x2b')](_0x46ecd3)['json'](_0x58e54b);}};}function respondWithFilteredResult(_0x19e306,_0x25e54){return function(_0x117a31){if(_0x117a31){var _0x3119d4=_0x117a31[_0x32ab('0x2d')],_0x46ba72=_0x25e54['offset'],_0x266ad3=_0x25e54[_0x32ab('0x2e')]+_0x25e54[_0x32ab('0x2f')],_0xc72ed;if(_0x266ad3>=_0x3119d4){_0x266ad3=_0x3119d4;_0xc72ed=0xc8;}else{_0xc72ed=0xce;}_0x19e306[_0x32ab('0x2b')](_0xc72ed);return _0x19e306[_0x32ab('0x30')](_0x32ab('0x31'),_0x46ba72+'-'+_0x266ad3+'/'+_0x3119d4)['json'](_0x117a31);}return null;};}function patchUpdates(_0x431b0e){return function(_0x44f492){try{jsonpatch['apply'](_0x44f492,_0x431b0e,!![]);}catch(_0x213da9){return BPromise[_0x32ab('0x32')](_0x213da9);}return _0x44f492[_0x32ab('0x33')]();};}function saveUpdates(_0x5e16bd,_0x3ea93f){return function(_0x10ba1e){if(_0x10ba1e){return _0x10ba1e['update'](_0x5e16bd)[_0x32ab('0x1f')](function(_0x406270){return _0x406270;});}return null;};}function removeEntity(_0x4dea3c,_0x2aeeed){return function(_0x46f697){if(_0x46f697){return _0x46f697[_0x32ab('0x34')]()[_0x32ab('0x1f')](function(){var _0x135a78=_0x46f697[_0x32ab('0x35')]({'plain':!![]});var _0x4e30a4='MailAccounts';return db[_0x32ab('0x36')][_0x32ab('0x34')]({'where':{'type':_0x4e30a4,'resourceId':_0x135a78['id']}})[_0x32ab('0x1f')](function(){return _0x46f697;});})[_0x32ab('0x1f')](function(){_0x4dea3c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c836c,_0x557a7c){return function(_0x109f3e){if(!_0x109f3e){_0x3c836c[_0x32ab('0x2a')](0x194);}return _0x109f3e;};}function handleError(_0x5307a1,_0x14e8cb){_0x14e8cb=_0x14e8cb||0x1f4;return function(_0xf4c877){logger[_0x32ab('0x24')](_0xf4c877['stack']);if(_0xf4c877['name']){delete _0xf4c877[_0x32ab('0x37')];}_0x5307a1[_0x32ab('0x2b')](_0x14e8cb)[_0x32ab('0x38')](_0xf4c877);};}exports[_0x32ab('0x39')]=function(_0x529ec8,_0x354c76){var _0x4b7a35={'include':[{'model':db[_0x32ab('0x3a')],'as':_0x32ab('0x3b')},{'model':db[_0x32ab('0x3c')],'as':_0x32ab('0x3d')}]},_0x2706ff={},_0x3380ff={'count':0x0,'rows':[]};var _0x23a037=db[_0x32ab('0x3e')][_0x32ab('0x3f')];_0x2706ff[_0x32ab('0x40')]=_[_0x32ab('0x41')](_0x23a037);var _0x1600f2={'dateStart':_0x529ec8[_0x32ab('0x42')][_0x32ab('0x43')],'dateEnd':_0x529ec8[_0x32ab('0x42')][_0x32ab('0x44')]};delete _0x529ec8[_0x32ab('0x42')][_0x32ab('0x43')];delete _0x529ec8[_0x32ab('0x42')][_0x32ab('0x44')];_0x2706ff[_0x32ab('0x42')]=_[_0x32ab('0x41')](_0x529ec8[_0x32ab('0x42')]);_0x2706ff['filters']=_['intersection'](_0x2706ff['model'],_0x2706ff[_0x32ab('0x42')]);_0x4b7a35[_0x32ab('0x45')]=_['intersection'](_0x2706ff['model'],qs[_0x32ab('0x46')](_0x529ec8[_0x32ab('0x42')][_0x32ab('0x46')]));_0x4b7a35[_0x32ab('0x45')]=_0x4b7a35[_0x32ab('0x45')]['length']?_0x4b7a35[_0x32ab('0x45')]:_0x2706ff['model'];if(!_0x529ec8[_0x32ab('0x42')][_0x32ab('0x47')](_0x32ab('0x48'))){_0x4b7a35[_0x32ab('0x2f')]=qs[_0x32ab('0x2f')](_0x529ec8[_0x32ab('0x42')][_0x32ab('0x2f')]);_0x4b7a35[_0x32ab('0x2e')]=qs[_0x32ab('0x2e')](_0x529ec8[_0x32ab('0x42')][_0x32ab('0x2e')]);}_0x4b7a35['order']=qs['sort'](_0x529ec8[_0x32ab('0x42')][_0x32ab('0x49')]);_0x4b7a35[_0x32ab('0x4a')]=qs[_0x32ab('0x4b')](_[_0x32ab('0x4c')](_0x529ec8[_0x32ab('0x42')],_0x2706ff['filters']));if(_0x1600f2[_0x32ab('0x43')]){if(_0x1600f2[_0x32ab('0x44')]){_0x1600f2[_0x32ab('0x44')]=moment(_0x1600f2[_0x32ab('0x44')])[_0x32ab('0x4d')](0x1,_0x32ab('0x4e'));}else{_0x1600f2['dateEnd']=moment(_0x1600f2[_0x32ab('0x43')])[_0x32ab('0x4d')](0x1,_0x32ab('0x4e'));}_[_0x32ab('0x4f')](_0x4b7a35[_0x32ab('0x4a')],{'createdAt':{'$gte':_0x1600f2['dateStart'],'$lte':_0x1600f2[_0x32ab('0x44')]}});}if(_0x529ec8[_0x32ab('0x42')][_0x32ab('0x50')]){_0x4b7a35[_0x32ab('0x4a')]=_[_0x32ab('0x4f')](_0x4b7a35[_0x32ab('0x4a')],{'$or':_['map'](_0x4b7a35['attributes'],function(_0x39125b){var _0x2194ef={};_0x2194ef[_0x39125b]={'$like':'%'+_0x529ec8[_0x32ab('0x42')][_0x32ab('0x50')]+'%'};return _0x2194ef;})});}_0x4b7a35=_[_0x32ab('0x4f')]({},_0x4b7a35,_0x529ec8[_0x32ab('0x51')]);var _0x3eb597={'where':_0x4b7a35['where']};return db[_0x32ab('0x3e')][_0x32ab('0x2d')](_0x3eb597)[_0x32ab('0x1f')](function(_0xe7c569){_0x3380ff['count']=_0xe7c569;if(_0x529ec8[_0x32ab('0x42')]['includeAll']){_0x4b7a35[_0x32ab('0x52')]=[{'all':!![]}];}return db[_0x32ab('0x3e')][_0x32ab('0x53')](_0x4b7a35);})['then'](function(_0x29c1ca){_0x3380ff['rows']=_0x29c1ca;return _0x3380ff;})['then'](respondWithFilteredResult(_0x354c76,_0x4b7a35))[_0x32ab('0x29')](handleError(_0x354c76,null));};exports[_0x32ab('0x54')]=function(_0x755873,_0x2afd44){var _0x4fca20={'raw':![],'where':{'id':_0x755873[_0x32ab('0x55')]['id']},'include':[{'model':db[_0x32ab('0x3a')],'as':_0x32ab('0x3b')},{'model':db[_0x32ab('0x3c')],'as':_0x32ab('0x3d')}]},_0x37e799={};_0x37e799[_0x32ab('0x40')]=_['keys'](db[_0x32ab('0x3e')]['rawAttributes']);_0x37e799[_0x32ab('0x42')]=_['keys'](_0x755873['query']);_0x37e799[_0x32ab('0x4b')]=_['intersection'](_0x37e799[_0x32ab('0x40')],_0x37e799[_0x32ab('0x42')]);_0x4fca20['attributes']=_[_0x32ab('0x56')](_0x37e799[_0x32ab('0x40')],qs['fields'](_0x755873[_0x32ab('0x42')][_0x32ab('0x46')]));_0x4fca20['attributes']=_0x4fca20[_0x32ab('0x45')]['length']?_0x4fca20[_0x32ab('0x45')]:_0x37e799[_0x32ab('0x40')];if(_0x755873[_0x32ab('0x42')][_0x32ab('0x57')]){_0x4fca20[_0x32ab('0x52')]=[{'all':!![]}];}_0x4fca20=_[_0x32ab('0x4f')]({},_0x4fca20,_0x755873[_0x32ab('0x51')]);return db['MailAccount'][_0x32ab('0x58')](_0x4fca20)[_0x32ab('0x1f')](handleEntityNotFound(_0x2afd44,null))[_0x32ab('0x1f')](respondWithResult(_0x2afd44,null))['catch'](handleError(_0x2afd44,null));};exports[_0x32ab('0x59')]=function(_0x3d50ca,_0x107328){if(_0x3d50ca[_0x32ab('0x5a')]['id']){delete _0x3d50ca[_0x32ab('0x5a')]['id'];}return db[_0x32ab('0x3e')][_0x32ab('0x58')]({'where':{'id':_0x3d50ca[_0x32ab('0x55')]['id']},'include':[{'model':db[_0x32ab('0x3a')],'as':_0x32ab('0x3b')},{'model':db[_0x32ab('0x3c')],'as':_0x32ab('0x3d')}]})[_0x32ab('0x1f')](handleEntityNotFound(_0x107328,null))['then'](saveUpdates(_0x3d50ca[_0x32ab('0x5a')],null))['then'](function(_0x311f03){if(_0x311f03&&_0x3d50ca[_0x32ab('0x5a')]['Imap']){return db[_0x32ab('0x3a')][_0x32ab('0x59')](_0x3d50ca[_0x32ab('0x5a')]['Imap'],{'where':{'MailAccountId':_0x311f03['id']}})[_0x32ab('0x1f')](function(){return _0x311f03;});}return _0x311f03;})['then'](function(_0x3b1293){if(_0x3b1293&&_0x3d50ca[_0x32ab('0x5a')][_0x32ab('0x3d')]){return db[_0x32ab('0x3c')][_0x32ab('0x59')](_0x3d50ca[_0x32ab('0x5a')][_0x32ab('0x3d')],{'where':{'MailAccountId':_0x3b1293['id']}})['then'](function(){return _0x3b1293;});}return _0x3b1293;})[_0x32ab('0x1f')](respondWithResult(_0x107328,null))['catch'](handleError(_0x107328,null));};exports['describe']=function(_0x7d2be4,_0x15e23f){return db['MailAccount'][_0x32ab('0x5b')]()['then'](respondWithResult(_0x15e23f,null))[_0x32ab('0x29')](handleError(_0x15e23f,null));};exports[_0x32ab('0x5c')]=function(_0x1f2dd1,_0x416ae2,_0x46255f){if(_0x1f2dd1[_0x32ab('0x5a')]['id']){delete _0x1f2dd1['body']['id'];}return db[_0x32ab('0x3e')]['find']({'where':{'id':_0x1f2dd1[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x416ae2,null))[_0x32ab('0x1f')](function(_0x4073d6){if(_0x4073d6){_0x1f2dd1['body'][_0x32ab('0x5d')]=_0x4073d6['id'];return db[_0x32ab('0x5e')][_0x32ab('0x5f')](_0x1f2dd1[_0x32ab('0x5a')]);}})[_0x32ab('0x1f')](respondWithResult(_0x416ae2,null))[_0x32ab('0x29')](handleError(_0x416ae2,null));};exports['getDispositions']=function(_0x1c0182,_0x20619a,_0x14ecf2){var _0x3ab9d1={'raw':![],'where':{}};var _0x53415a={};var _0xd024d6={'count':0x0,'rows':[]};return db[_0x32ab('0x3e')]['findOne']({'where':{'id':_0x1c0182[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x20619a,null))[_0x32ab('0x1f')](function(_0x1f26c4){if(_0x1f26c4){_0x53415a['model']=_['keys'](db['Disposition'][_0x32ab('0x3f')]);_0x53415a[_0x32ab('0x42')]=_[_0x32ab('0x41')](_0x1c0182[_0x32ab('0x42')]);_0x53415a[_0x32ab('0x4b')]=_[_0x32ab('0x56')](_0x53415a[_0x32ab('0x40')],_0x53415a['query']);_0x3ab9d1['attributes']=_[_0x32ab('0x56')](_0x53415a['model'],qs[_0x32ab('0x46')](_0x1c0182[_0x32ab('0x42')]['fields']));_0x3ab9d1[_0x32ab('0x45')]=_0x3ab9d1[_0x32ab('0x45')][_0x32ab('0x60')]?_0x3ab9d1[_0x32ab('0x45')]:_0x53415a[_0x32ab('0x40')];if(!_0x1c0182[_0x32ab('0x42')][_0x32ab('0x47')](_0x32ab('0x48'))){_0x3ab9d1[_0x32ab('0x2f')]=qs[_0x32ab('0x2f')](_0x1c0182['query']['limit']);_0x3ab9d1['offset']=qs['offset'](_0x1c0182[_0x32ab('0x42')][_0x32ab('0x2e')]);}_0x3ab9d1['order']=qs[_0x32ab('0x49')](_0x1c0182[_0x32ab('0x42')][_0x32ab('0x49')]);_0x3ab9d1[_0x32ab('0x4a')]=qs[_0x32ab('0x4b')](_[_0x32ab('0x4c')](_0x1c0182[_0x32ab('0x42')],_0x53415a['filters']));_0x3ab9d1[_0x32ab('0x4a')][_0x32ab('0x5d')]=_0x1f26c4['id'];if(_0x1c0182[_0x32ab('0x42')][_0x32ab('0x50')]){_0x3ab9d1['where']=_[_0x32ab('0x4f')](_0x3ab9d1[_0x32ab('0x4a')],{'$or':_['map'](_0x3ab9d1[_0x32ab('0x45')],function(_0x67cb9e){var _0x3e02c2={};_0x3e02c2[_0x67cb9e]={'$like':'%'+_0x1c0182[_0x32ab('0x42')]['filter']+'%'};return _0x3e02c2;})});}_0x3ab9d1=_[_0x32ab('0x4f')]({},_0x3ab9d1,_0x1c0182[_0x32ab('0x51')]);return db['Disposition']['count']({'where':_0x3ab9d1['where']})[_0x32ab('0x1f')](function(_0x1ac896){_0xd024d6[_0x32ab('0x2d')]=_0x1ac896;if(_0x1c0182['query'][_0x32ab('0x57')]){_0x3ab9d1['include']=[{'all':!![]}];}return db[_0x32ab('0x5e')][_0x32ab('0x53')](_0x3ab9d1);})[_0x32ab('0x1f')](function(_0x28e744){_0xd024d6[_0x32ab('0x61')]=_0x28e744;return _0xd024d6;});}})[_0x32ab('0x1f')](respondWithFilteredResult(_0x20619a,_0x3ab9d1))[_0x32ab('0x29')](handleError(_0x20619a,null));};exports[_0x32ab('0x62')]=function(_0x400694,_0x218832,_0x45173f){var _0x2d264e;return db[_0x32ab('0x3e')]['find']({'where':{'id':_0x400694[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x218832,null))[_0x32ab('0x1f')](function(_0xcbdf72){if(_0xcbdf72){return _0xcbdf72[_0x32ab('0x62')](_0x400694['query'][_0x32ab('0x63')]);}})[_0x32ab('0x1f')](respondWithStatusCode(_0x218832,null))[_0x32ab('0x29')](handleError(_0x218832,null));};exports[_0x32ab('0x64')]=function(_0x52cc65,_0x393366,_0x84b1be){if(_0x52cc65['body']['id']){delete _0x52cc65[_0x32ab('0x5a')]['id'];}return db[_0x32ab('0x3e')]['find']({'where':{'id':_0x52cc65[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x393366,null))[_0x32ab('0x1f')](function(_0x403042){if(_0x403042){_0x52cc65['body'][_0x32ab('0x5d')]=_0x403042['id'];return db[_0x32ab('0x65')][_0x32ab('0x5f')](_0x52cc65[_0x32ab('0x5a')]);}})[_0x32ab('0x1f')](respondWithResult(_0x393366,null))['catch'](handleError(_0x393366,null));};exports[_0x32ab('0x66')]=function(_0x1843d4,_0x50c744,_0x4e6856){var _0x70b291={'raw':![],'where':{}};var _0x1a91e2={};var _0xc3a754={'count':0x0,'rows':[]};return db[_0x32ab('0x3e')][_0x32ab('0x67')]({'where':{'id':_0x1843d4[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x50c744,null))[_0x32ab('0x1f')](function(_0x381eaa){if(_0x381eaa){_0x1a91e2['model']=_[_0x32ab('0x41')](db['CannedAnswer'][_0x32ab('0x3f')]);_0x1a91e2[_0x32ab('0x42')]=_[_0x32ab('0x41')](_0x1843d4[_0x32ab('0x42')]);_0x1a91e2['filters']=_[_0x32ab('0x56')](_0x1a91e2[_0x32ab('0x40')],_0x1a91e2[_0x32ab('0x42')]);_0x70b291[_0x32ab('0x45')]=_[_0x32ab('0x56')](_0x1a91e2[_0x32ab('0x40')],qs['fields'](_0x1843d4[_0x32ab('0x42')]['fields']));_0x70b291[_0x32ab('0x45')]=_0x70b291['attributes']['length']?_0x70b291['attributes']:_0x1a91e2[_0x32ab('0x40')];if(!_0x1843d4[_0x32ab('0x42')]['hasOwnProperty'](_0x32ab('0x48'))){_0x70b291['limit']=qs[_0x32ab('0x2f')](_0x1843d4[_0x32ab('0x42')][_0x32ab('0x2f')]);_0x70b291[_0x32ab('0x2e')]=qs[_0x32ab('0x2e')](_0x1843d4[_0x32ab('0x42')][_0x32ab('0x2e')]);}_0x70b291['order']=qs['sort'](_0x1843d4[_0x32ab('0x42')]['sort']);_0x70b291['where']=qs[_0x32ab('0x4b')](_[_0x32ab('0x4c')](_0x1843d4[_0x32ab('0x42')],_0x1a91e2[_0x32ab('0x4b')]));_0x70b291[_0x32ab('0x4a')][_0x32ab('0x5d')]=_0x381eaa['id'];if(_0x1843d4[_0x32ab('0x42')][_0x32ab('0x50')]){_0x70b291[_0x32ab('0x4a')]=_[_0x32ab('0x4f')](_0x70b291['where'],{'$or':_[_0x32ab('0x68')](_0x70b291['attributes'],function(_0x1414e8){var _0x240513={};_0x240513[_0x1414e8]={'$like':'%'+_0x1843d4['query'][_0x32ab('0x50')]+'%'};return _0x240513;})});}_0x70b291=_[_0x32ab('0x4f')]({},_0x70b291,_0x1843d4[_0x32ab('0x51')]);return db['CannedAnswer'][_0x32ab('0x2d')]({'where':_0x70b291[_0x32ab('0x4a')]})['then'](function(_0x5ec9a1){_0xc3a754[_0x32ab('0x2d')]=_0x5ec9a1;if(_0x1843d4[_0x32ab('0x42')][_0x32ab('0x57')]){_0x70b291[_0x32ab('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x70b291);})[_0x32ab('0x1f')](function(_0x26de82){_0xc3a754['rows']=_0x26de82;return _0xc3a754;});}})[_0x32ab('0x1f')](respondWithFilteredResult(_0x50c744,_0x70b291))['catch'](handleError(_0x50c744,null));};exports[_0x32ab('0x69')]=function(_0x237286,_0x13ea92,_0x4f5233){var _0x1d1a2e;return db[_0x32ab('0x3e')][_0x32ab('0x58')]({'where':{'id':_0x237286[_0x32ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x13ea92,null))[_0x32ab('0x1f')](function(_0x50f68a){if(_0x50f68a){return _0x50f68a[_0x32ab('0x69')](_0x237286[_0x32ab('0x42')]['ids']);}})[_0x32ab('0x1f')](respondWithStatusCode(_0x13ea92,null))['catch'](handleError(_0x13ea92,null));};exports[_0x32ab('0x5f')]=function(_0x19c9ca,_0x1c4678){var _0x3b90b8={'name':_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x37')],'key':_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x6a')],'email':_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x6b')],'ListId':_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x6c')],'active':!_['isNil'](_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x6d')])?_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x6d')]:!![],'description':_0x19c9ca['body'][_0x32ab('0x6e')]||null,'Imap':{},'Smtp':{}};if(_[_0x32ab('0x6f')](_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x70')])){if(_0x19c9ca['body'][_0x32ab('0x71')]){_0x3b90b8[_0x32ab('0x3b')][_0x32ab('0x72')]=_0x3b90b8[_0x32ab('0x3d')][_0x32ab('0x72')]=_0x19c9ca[_0x32ab('0x5a')]['cuser'];_0x3b90b8[_0x32ab('0x3b')]['password']=_0x3b90b8[_0x32ab('0x3d')][_0x32ab('0x73')]=_0x19c9ca[_0x32ab('0x5a')]['cpassword'];}else{_0x3b90b8[_0x32ab('0x3b')][_0x32ab('0x74')]=_0x3b90b8[_0x32ab('0x3d')][_0x32ab('0x74')]=![];}_0x3b90b8[_0x32ab('0x3b')][_0x32ab('0x75')]=_0x19c9ca['body'][_0x32ab('0x3b')]['host'];_0x3b90b8[_0x32ab('0x3b')][_0x32ab('0x76')]=_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x3b')][_0x32ab('0x76')];_0x3b90b8[_0x32ab('0x3d')][_0x32ab('0x75')]=_0x19c9ca['body'][_0x32ab('0x3d')][_0x32ab('0x75')];_0x3b90b8[_0x32ab('0x3d')][_0x32ab('0x76')]=_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x3d')][_0x32ab('0x76')];}else{_0x3b90b8[_0x32ab('0x3b')][_0x32ab('0x77')]=_0x3b90b8[_0x32ab('0x3d')]['service']=_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x70')];_0x3b90b8[_0x32ab('0x3b')]['user']=_0x3b90b8[_0x32ab('0x3d')][_0x32ab('0x72')]=_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x78')];_0x3b90b8['Imap'][_0x32ab('0x79')]=_0x3b90b8[_0x32ab('0x3d')][_0x32ab('0x73')]=_0x19c9ca[_0x32ab('0x5a')][_0x32ab('0x7a')];}return db[_0x32ab('0x3e')][_0x32ab('0x5f')](_0x3b90b8,{'include':[{'model':db['MailServerOut'],'as':_0x32ab('0x3d')},{'model':db[_0x32ab('0x3a')],'as':_0x32ab('0x3b')}]})[_0x32ab('0x1f')](function(_0x261c28){var _0x50d4d1=_0x19c9ca[_0x32ab('0x72')][_0x32ab('0x35')]({'plain':!![]});if(!_0x50d4d1)throw new Error(_0x32ab('0x7b'));if(_0x50d4d1['role']==='user'){var _0x1aa00f=_0x261c28[_0x32ab('0x35')]({'plain':!![]});return db['UserProfileSection'][_0x32ab('0x58')]({'where':{'name':_0x32ab('0x7c'),'userProfileId':_0x50d4d1[_0x32ab('0x7d')]},'raw':!![]})[_0x32ab('0x1f')](function(_0x4c9367){if(_0x4c9367&&_0x4c9367[_0x32ab('0x7e')]===0x0){return db['UserProfileResource'][_0x32ab('0x5f')]({'name':_0x1aa00f['name'],'resourceId':_0x1aa00f['id'],'type':_0x4c9367[_0x32ab('0x37')],'sectionId':_0x4c9367['id']},{})['then'](function(){return _0x261c28;});}else{return _0x261c28;}})[_0x32ab('0x29')](function(_0x4af1ef){logger[_0x32ab('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4af1ef);throw _0x4af1ef;});}return _0x261c28;})['then'](respondWithResult(_0x1c4678,0xc9))[_0x32ab('0x29')](handleError(_0x1c4678,null));};exports[_0x32ab('0x7f')]=function(_0x3c5f62,_0x5c2146,_0x22aefd){return db['MailAccount'][_0x32ab('0x67')]({'where':{'id':_0x3c5f62[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x5c2146,null))['then'](function(_0x404fa5){if(_0x404fa5){return _0x404fa5['getImap']();}return null;})[_0x32ab('0x1f')](respondWithResult(_0x5c2146,null))[_0x32ab('0x29')](handleError(_0x5c2146,null));};exports[_0x32ab('0x80')]=function(_0x10fcb0,_0x3abf17,_0x30f940){if(_0x10fcb0['body']['id']){delete _0x10fcb0[_0x32ab('0x5a')]['id'];}return db[_0x32ab('0x3e')]['find']({'where':{'id':_0x10fcb0[_0x32ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x3abf17,null))[_0x32ab('0x1f')](function(_0x4c219b){if(_0x4c219b){_0x10fcb0[_0x32ab('0x5a')][_0x32ab('0x5d')]=_0x4c219b['id'];return db[_0x32ab('0x3a')]['create'](_0x10fcb0[_0x32ab('0x5a')]);}})[_0x32ab('0x1f')](respondWithResult(_0x3abf17,null))[_0x32ab('0x29')](handleError(_0x3abf17,null));};exports['removeImap']=function(_0x3b2c66,_0x34802f,_0x45a0b1){return db[_0x32ab('0x3e')][_0x32ab('0x67')]({'where':{'id':_0x3b2c66['params']['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x34802f,null))[_0x32ab('0x1f')](function(_0x1c9cc0){if(_0x1c9cc0){return _0x1c9cc0[_0x32ab('0x81')](null);}return null;})[_0x32ab('0x1f')](respondWithStatusCode(_0x34802f,null))[_0x32ab('0x29')](handleError(_0x34802f,null));};exports[_0x32ab('0x82')]=function(_0x3ac6dd,_0x2a39e5,_0x13ec51){return db['MailAccount'][_0x32ab('0x67')]({'where':{'id':_0x3ac6dd['params']['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x2a39e5,null))['then'](function(_0x4151d4){if(_0x4151d4){return _0x4151d4[_0x32ab('0x82')]();}return null;})['then'](respondWithResult(_0x2a39e5,null))[_0x32ab('0x29')](handleError(_0x2a39e5,null));};exports['addSmtp']=function(_0x14d7a9,_0x314c24,_0x44f9ce){if(_0x14d7a9['body']['id']){delete _0x14d7a9[_0x32ab('0x5a')]['id'];}return db[_0x32ab('0x3e')][_0x32ab('0x58')]({'where':{'id':_0x14d7a9[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x314c24,null))[_0x32ab('0x1f')](function(_0x5a2074){if(_0x5a2074){_0x14d7a9[_0x32ab('0x5a')]['MailAccountId']=_0x5a2074['id'];return db[_0x32ab('0x3c')][_0x32ab('0x5f')](_0x14d7a9['body']);}})[_0x32ab('0x1f')](respondWithResult(_0x314c24,null))[_0x32ab('0x29')](handleError(_0x314c24,null));};exports['removeSmtp']=function(_0x52affd,_0x4eb7f3,_0x4a069e){return db[_0x32ab('0x3e')][_0x32ab('0x67')]({'where':{'id':_0x52affd[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x4eb7f3,null))['then'](function(_0x1a9f2e){if(_0x1a9f2e){return _0x1a9f2e['setSmtp'](null);}return null;})[_0x32ab('0x1f')](respondWithStatusCode(_0x4eb7f3,null))[_0x32ab('0x29')](handleError(_0x4eb7f3,null));};exports[_0x32ab('0x83')]=function(_0x25c2ee,_0x1a64eb,_0x3eb63c){return db['MailInteraction'][_0x32ab('0x58')]({'where':{'id':_0x25c2ee[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x1a64eb,null))[_0x32ab('0x1f')](function(_0x40fd4e){if(_0x40fd4e){return _0x40fd4e['addInteraction'](_0x25c2ee[_0x32ab('0x5a')][_0x32ab('0x63')],_[_0x32ab('0x84')](_0x25c2ee[_0x32ab('0x5a')],['ids','id'])||{});}})[_0x32ab('0x1f')](respondWithResult(_0x1a64eb,null))[_0x32ab('0x29')](handleError(_0x1a64eb,null));};exports[_0x32ab('0x85')]=function(_0x41e2b2,_0x632a31,_0x4d9dac){var _0x32a218={'raw':![],'where':{}};var _0x3e5ff4={};var _0x376bc0={'count':0x0,'rows':[]};return db[_0x32ab('0x3e')][_0x32ab('0x67')]({'where':{'id':_0x41e2b2['params']['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x632a31,null))[_0x32ab('0x1f')](function(_0x3f65ac){if(_0x3f65ac){_0x3e5ff4['model']=_[_0x32ab('0x41')](db[_0x32ab('0x86')][_0x32ab('0x3f')]);_0x3e5ff4[_0x32ab('0x42')]=_[_0x32ab('0x41')](_0x41e2b2['query']);_0x3e5ff4[_0x32ab('0x4b')]=_[_0x32ab('0x56')](_0x3e5ff4[_0x32ab('0x40')],_0x3e5ff4[_0x32ab('0x42')]);_0x32a218[_0x32ab('0x45')]=_[_0x32ab('0x56')](_0x3e5ff4[_0x32ab('0x40')],qs[_0x32ab('0x46')](_0x41e2b2[_0x32ab('0x42')]['fields']));_0x32a218[_0x32ab('0x45')]=_0x32a218[_0x32ab('0x45')][_0x32ab('0x60')]?_0x32a218[_0x32ab('0x45')]:_0x3e5ff4[_0x32ab('0x40')];if(!_0x41e2b2['query'][_0x32ab('0x47')](_0x32ab('0x48'))){_0x32a218['limit']=qs[_0x32ab('0x2f')](_0x41e2b2[_0x32ab('0x42')][_0x32ab('0x2f')]);_0x32a218[_0x32ab('0x2e')]=qs[_0x32ab('0x2e')](_0x41e2b2[_0x32ab('0x42')][_0x32ab('0x2e')]);}_0x32a218[_0x32ab('0x87')]=qs[_0x32ab('0x49')](_0x41e2b2['query'][_0x32ab('0x49')]);_0x32a218[_0x32ab('0x4a')]=qs['filters'](_[_0x32ab('0x4c')](_0x41e2b2['query'],_0x3e5ff4[_0x32ab('0x4b')]));_0x32a218[_0x32ab('0x4a')][_0x32ab('0x5d')]=_0x3f65ac['id'];if(_0x41e2b2['query'][_0x32ab('0x50')]){_0x32a218[_0x32ab('0x4a')]=_[_0x32ab('0x4f')](_0x32a218['where'],{'$or':_[_0x32ab('0x68')](_0x32a218[_0x32ab('0x45')],function(_0x11432e){var _0x159812={};_0x159812[_0x11432e]={'$like':'%'+_0x41e2b2[_0x32ab('0x42')][_0x32ab('0x50')]+'%'};return _0x159812;})});}_0x32a218=_[_0x32ab('0x4f')]({},_0x32a218,_0x41e2b2['options']);return db[_0x32ab('0x86')][_0x32ab('0x2d')]({'where':_0x32a218[_0x32ab('0x4a')]})[_0x32ab('0x1f')](function(_0x1772dd){_0x376bc0[_0x32ab('0x2d')]=_0x1772dd;if(_0x41e2b2[_0x32ab('0x42')][_0x32ab('0x57')]){_0x32a218[_0x32ab('0x52')]=[{'model':db[_0x32ab('0x88')],'as':'Contact','required':![]},{'model':db[_0x32ab('0x89')],'as':_0x32ab('0x8a'),'attributes':[_0x32ab('0x37'),_0x32ab('0x8b'),_0x32ab('0x8c')],'required':![]},{'model':db[_0x32ab('0x8d')],'as':_0x32ab('0x8e'),'attributes':['id',_0x32ab('0x37'),_0x32ab('0x8f')],'where':_0x41e2b2[_0x32ab('0x42')][_0x32ab('0x90')]?{'id':_0x41e2b2['query'][_0x32ab('0x90')]}:undefined,'required':_0x41e2b2[_0x32ab('0x42')]['tag']?!![]:![]}];}return db[_0x32ab('0x86')]['findAll'](_0x32a218);})[_0x32ab('0x1f')](function(_0x34b9bf){_0x376bc0[_0x32ab('0x61')]=_0x34b9bf;return _0x376bc0;});}})[_0x32ab('0x1f')](respondWithFilteredResult(_0x632a31,_0x32a218))[_0x32ab('0x29')](handleError(_0x632a31,null));};exports['addApplications']=function(_0xe4154f,_0x9efc0f,_0x2957fa){return db[_0x32ab('0x3e')]['findOne']({'where':{'id':_0xe4154f[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x9efc0f,null))[_0x32ab('0x1f')](function(_0x260ca8){if(_0x260ca8){return db[_0x32ab('0x91')][_0x32ab('0x92')](function(_0x2070c6){return db[_0x32ab('0x93')][_0x32ab('0x34')]({'where':{'MailAccountId':_0xe4154f['params']['id']},'transaction':_0x2070c6})[_0x32ab('0x1f')](function(_0x2eb907){var _0x517558=_[_0x32ab('0x68')](_0xe4154f[_0x32ab('0x5a')],function(_0x42ffde){_0x42ffde[_0x32ab('0x5d')]=_0xe4154f[_0x32ab('0x55')]['id'];return _0x42ffde;});return db[_0x32ab('0x93')][_0x32ab('0x94')](_0x517558,{'transaction':_0x2070c6});});})['then'](function(){return db[_0x32ab('0x93')]['findAndCountAll']({'where':{'MailAccountId':_0xe4154f[_0x32ab('0x55')]['id']},'order':_0x32ab('0x95')});});}})[_0x32ab('0x1f')](respondWithResult(_0x9efc0f,null))[_0x32ab('0x29')](handleError(_0x9efc0f,null));};exports[_0x32ab('0x96')]=function(_0x5284d7,_0x6d4fe2,_0x235d63){var _0x18a374={};var _0x6ba25d={};var _0x5ab1a2;var _0xced16c;return db[_0x32ab('0x3e')][_0x32ab('0x67')]({'where':{'id':_0x5284d7[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x6d4fe2,null))[_0x32ab('0x1f')](function(_0x1e5c16){if(_0x1e5c16){_0x5ab1a2=_0x1e5c16;_0x6ba25d[_0x32ab('0x40')]=_['keys'](db[_0x32ab('0x93')][_0x32ab('0x3f')]);_0x6ba25d[_0x32ab('0x42')]=_[_0x32ab('0x41')](_0x5284d7[_0x32ab('0x42')]);_0x6ba25d[_0x32ab('0x4b')]=_[_0x32ab('0x56')](_0x6ba25d[_0x32ab('0x40')],_0x6ba25d[_0x32ab('0x42')]);_0x18a374['attributes']=_[_0x32ab('0x56')](_0x6ba25d['model'],qs[_0x32ab('0x46')](_0x5284d7[_0x32ab('0x42')][_0x32ab('0x46')]));_0x18a374[_0x32ab('0x45')]=_0x18a374['attributes'][_0x32ab('0x60')]?_0x18a374[_0x32ab('0x45')]:_0x6ba25d['model'];_0x18a374[_0x32ab('0x87')]=qs['sort'](_0x5284d7[_0x32ab('0x42')][_0x32ab('0x49')]);_0x18a374[_0x32ab('0x4a')]=qs[_0x32ab('0x4b')](_[_0x32ab('0x4c')](_0x5284d7[_0x32ab('0x42')],_0x6ba25d[_0x32ab('0x4b')]));if(_0x5284d7[_0x32ab('0x42')][_0x32ab('0x50')]){_0x18a374[_0x32ab('0x4a')]=_[_0x32ab('0x4f')](_0x18a374[_0x32ab('0x4a')],{'$or':_[_0x32ab('0x68')](_0x18a374[_0x32ab('0x45')],function(_0x2e0a13){var _0x52649b={};_0x52649b[_0x2e0a13]={'$like':'%'+_0x5284d7[_0x32ab('0x42')]['filter']+'%'};return _0x52649b;})});}_0x18a374=_['merge']({},_0x18a374,_0x5284d7[_0x32ab('0x51')]);return _0x5ab1a2[_0x32ab('0x96')](_0x18a374);}})[_0x32ab('0x1f')](function(_0x176b7a){if(_0x176b7a){_0xced16c=_0x176b7a[_0x32ab('0x60')];if(!_0x5284d7[_0x32ab('0x42')][_0x32ab('0x47')](_0x32ab('0x48'))){_0x18a374['limit']=qs[_0x32ab('0x2f')](_0x5284d7['query'][_0x32ab('0x2f')]);_0x18a374[_0x32ab('0x2e')]=qs[_0x32ab('0x2e')](_0x5284d7[_0x32ab('0x42')][_0x32ab('0x2e')]);}return _0x5ab1a2['getApplications'](_0x18a374);}})['then'](function(_0x7228c3){if(_0x7228c3){return _0x7228c3?{'count':_0xced16c,'rows':_0x7228c3}:null;}})[_0x32ab('0x1f')](respondWithResult(_0x6d4fe2,null))[_0x32ab('0x29')](handleError(_0x6d4fe2,null));};exports[_0x32ab('0x97')]=function(_0x3a7b5e,_0x71288,_0x379477){var _0x1974e5={'raw':!![],'where':{}};var _0x3affae={};var _0x39b21d={'count':0x0,'rows':[]};return db[_0x32ab('0x3e')][_0x32ab('0x67')]({'where':{'id':_0x3a7b5e[_0x32ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x71288,null))[_0x32ab('0x1f')](function(_0x37ca9e){if(_0x37ca9e){_0x3affae[_0x32ab('0x40')]=_['keys'](db[_0x32ab('0x98')][_0x32ab('0x3f')]);_0x3affae['query']=_['keys'](_0x3a7b5e[_0x32ab('0x42')]);_0x3affae[_0x32ab('0x4b')]=_[_0x32ab('0x56')](_0x3affae['model'],_0x3affae['query']);_0x1974e5[_0x32ab('0x45')]=_[_0x32ab('0x56')](_0x3affae['model'],qs['fields'](_0x3a7b5e['query'][_0x32ab('0x46')]));_0x1974e5[_0x32ab('0x45')]=_0x1974e5['attributes'][_0x32ab('0x60')]?_0x1974e5['attributes']:_0x3affae[_0x32ab('0x40')];if(!_0x3a7b5e[_0x32ab('0x42')][_0x32ab('0x47')](_0x32ab('0x48'))){_0x1974e5[_0x32ab('0x2f')]=qs[_0x32ab('0x2f')](_0x3a7b5e[_0x32ab('0x42')]['limit']);_0x1974e5[_0x32ab('0x2e')]=qs['offset'](_0x3a7b5e['query']['offset']);}_0x1974e5[_0x32ab('0x87')]=qs['sort'](_0x3a7b5e['query']['sort']);_0x1974e5[_0x32ab('0x4a')]=qs[_0x32ab('0x4b')](_[_0x32ab('0x4c')](_0x3a7b5e['query'],_0x3affae[_0x32ab('0x4b')]));_0x1974e5[_0x32ab('0x4a')][_0x32ab('0x5d')]=_0x37ca9e['id'];if(_0x3a7b5e[_0x32ab('0x42')][_0x32ab('0x50')]){_0x1974e5[_0x32ab('0x4a')]=_[_0x32ab('0x4f')](_0x1974e5[_0x32ab('0x4a')],{'$or':_['map'](_0x1974e5[_0x32ab('0x45')],function(_0x3f0d46){var _0x3da0f3={};_0x3da0f3[_0x3f0d46]={'$like':'%'+_0x3a7b5e[_0x32ab('0x42')][_0x32ab('0x50')]+'%'};return _0x3da0f3;})});}if(_0x3a7b5e[_0x32ab('0x42')]['$gte']){var _0x2e4b9b=_0x3a7b5e[_0x32ab('0x42')]['$gte'][_0x32ab('0x99')](',');var _0x58a0cf={};_0x58a0cf[_0x2e4b9b[0x0]]={'$gte':moment(_0x2e4b9b[0x1])[_0x32ab('0x9a')](_0x32ab('0x9b'))};_0x1974e5[_0x32ab('0x4a')]=_[_0x32ab('0x4f')](_0x1974e5[_0x32ab('0x4a')],_0x58a0cf);}_0x1974e5=_[_0x32ab('0x4f')]({},_0x1974e5,_0x3a7b5e[_0x32ab('0x51')]);return db[_0x32ab('0x98')]['count']({'where':_0x1974e5[_0x32ab('0x4a')]})[_0x32ab('0x1f')](function(_0x5f3547){_0x39b21d[_0x32ab('0x2d')]=_0x5f3547;if(_0x3a7b5e[_0x32ab('0x42')][_0x32ab('0x57')]){_0x1974e5['include']=[{'all':!![]}];}return db[_0x32ab('0x98')]['findAll'](_0x1974e5);})[_0x32ab('0x1f')](function(_0x4bb40b){_0x39b21d[_0x32ab('0x61')]=_0x4bb40b;return _0x39b21d;});}})[_0x32ab('0x1f')](respondWithFilteredResult(_0x71288,_0x1974e5))['catch'](handleError(_0x71288,null));};exports[_0x32ab('0x38')]=function(_0x325c37,_0x3a5f5c,_0x4b253f){var _0x55ea41,_0x1f9b77={},_0x3182e5;if(_0x325c37['body']['to']){_0x3182e5=_0x325c37[_0x32ab('0x5a')]['to'][_0x32ab('0x99')](',')[0x0];}return db[_0x32ab('0x3e')][_0x32ab('0x58')]({'where':{'id':_0x325c37['params']['id']},'include':[{'model':db[_0x32ab('0x9c')],'as':_0x32ab('0x9d'),'include':[{'model':db[_0x32ab('0x88')],'as':'Contacts','where':{'email':_0x3182e5},'limit':0x1,'order':[[_0x32ab('0x9e'),_0x32ab('0x9f')]]}]},{'model':db['MailServerOut'],'as':_0x32ab('0x3d'),'raw':!![]}]})['then'](handleEntityNotFound(_0x3a5f5c,null))[_0x32ab('0x1f')](function(_0x4b4a69){if(_0x4b4a69){_0x55ea41=_0x4b4a69;if(_0x4b4a69['Smtp']){if(_[_0x32ab('0x6f')](_0x325c37[_0x32ab('0x5a')][_0x32ab('0xa0')])){_0x325c37[_0x32ab('0x5a')]['from']=util[_0x32ab('0x9a')]('%s\x20<%s>',_0x4b4a69[_0x32ab('0x37')],_0x4b4a69[_0x32ab('0x6b')]||_0x4b4a69[_0x32ab('0x3d')][_0x32ab('0x72')]);}if(_0x325c37[_0x32ab('0x5a')][_0x32ab('0xa1')]&&_0x325c37['body'][_0x32ab('0xa1')][_0x32ab('0x60')]){for(var _0x4f74c4=0x0;_0x4f74c4<_0x325c37[_0x32ab('0x5a')][_0x32ab('0xa1')][_0x32ab('0x60')];_0x4f74c4+=0x1){_0x325c37[_0x32ab('0x5a')][_0x32ab('0xa1')][_0x4f74c4]={'filename':_0x325c37['body'][_0x32ab('0xa1')][_0x4f74c4][_0x32ab('0x37')],'path':path[_0x32ab('0xa2')](config['root'],_0x32ab('0xa3'),_0x325c37[_0x32ab('0x5a')][_0x32ab('0xa1')][_0x4f74c4][_0x32ab('0xa4')])};}}var _0x1e850e={'tls':{'rejectUnauthorized':![]}};if(_[_0x32ab('0x6f')](_0x4b4a69[_0x32ab('0x3d')][_0x32ab('0x77')])){if(_0x4b4a69[_0x32ab('0x3d')][_0x32ab('0x74')]){_0x1e850e[_0x32ab('0xa5')]={'user':_0x4b4a69[_0x32ab('0x3d')]['user'],'pass':_0x4b4a69[_0x32ab('0x3d')][_0x32ab('0x73')]};}_0x1e850e[_0x32ab('0x75')]=_0x4b4a69[_0x32ab('0x3d')]['host'];_0x1e850e['port']=_0x4b4a69[_0x32ab('0x3d')][_0x32ab('0x76')];_0x1e850e[_0x32ab('0xa6')]=_0x4b4a69[_0x32ab('0x3d')][_0x32ab('0xa6')];}else{_0x1e850e[_0x32ab('0x77')]=_0x4b4a69['Smtp'][_0x32ab('0x77')];_0x1e850e['auth']={'user':_0x4b4a69[_0x32ab('0x3d')][_0x32ab('0x72')],'pass':_0x4b4a69[_0x32ab('0x3d')][_0x32ab('0x73')]};}return respondWithRpcPromise('SendMail',_0x32ab('0xa7'),{'account':_0x1e850e,'message':_0x325c37[_0x32ab('0x5a')]});}else{throw new Error(_0x32ab('0xa8'));}}})['then'](function(_0x1ff020){if(_0x1ff020){_0x1f9b77=_0x1ff020;if(_0x55ea41[_0x32ab('0x9d')]){if(_0x55ea41['List'][_0x32ab('0xa9')]['length']){return _0x55ea41[_0x32ab('0x9d')][_0x32ab('0xa9')][0x0];}else{return db[_0x32ab('0x88')][_0x32ab('0x5f')](_[_0x32ab('0x17')](_0x325c37[_0x32ab('0x5a')],{'firstName':_0x325c37[_0x32ab('0x5a')]['to'],'email':_0x325c37[_0x32ab('0x5a')]['to'],'phone':_0x325c37[_0x32ab('0x5a')]['to'],'ListId':_0x55ea41['ListId']}));}}else{throw new Error(_0x32ab('0xa8'));}}})['then'](function(_0x216a4e){if(_0x216a4e){var _0x45d553={'UserId':_0x325c37[_0x32ab('0x72')]['id'],'ContactId':_0x216a4e['id'],'MailAccountId':_0x55ea41['id'],'inReplyTo':_0x1f9b77[_0x32ab('0xaa')],'to':_0x325c37[_0x32ab('0x5a')][_0x32ab('0xa0')],'cc':_0x325c37[_0x32ab('0x5a')]['cc'],'subject':_0x325c37[_0x32ab('0x5a')][_0x32ab('0xab')],'attach':_0x325c37['body'][_0x32ab('0xac')],'firstMsgDirection':_0x32ab('0xad'),'lastMsgAt':moment()[_0x32ab('0x9a')](_0x32ab('0x9b')),'lastMsgDirection':_0x32ab('0xad'),'lastMsgBody':_0x325c37[_0x32ab('0x5a')][_0x32ab('0x5a')],'Messages':[_[_0x32ab('0x4f')](_0x325c37['body'],{'messageId':_0x1f9b77[_0x32ab('0xaa')],'sentAt':moment()[_0x32ab('0x9a')](_0x32ab('0x9b')),'read':!![],'MailAccountId':_0x55ea41['id'],'UserId':_0x325c37[_0x32ab('0x72')]['id'],'ContactId':_0x216a4e['id']})]};if(_0x325c37['body']['Interaction']){_0x45d553=_[_0x32ab('0x4f')](_0x45d553,_0x325c37['body'][_0x32ab('0xae')]);}return db[_0x32ab('0x86')]['create'](_0x45d553,{'include':[{'model':db[_0x32ab('0x98')],'as':'Messages'}]});}})[_0x32ab('0x1f')](respondWithResult(_0x3a5f5c,null))[_0x32ab('0x29')](handleError(_0x3a5f5c,null));};exports[_0x32ab('0xaf')]=function(_0x9e3a10,_0x529b2f,_0x1d9594){return db[_0x32ab('0x3e')][_0x32ab('0x58')]({'where':{'id':_0x9e3a10[_0x32ab('0x55')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x32ab('0x3d'),'raw':!![]}]})[_0x32ab('0x1f')](handleEntityNotFound(_0x529b2f,null))[_0x32ab('0x1f')](function(_0x34bae3){if(_0x34bae3&&_0x34bae3[_0x32ab('0x3d')]){var _0x2c9b2a={'id':_0x34bae3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x34bae3[_0x32ab('0x3d')][_0x32ab('0x77')]){_0x2c9b2a[_0x32ab('0x77')]=_0x34bae3[_0x32ab('0x3d')][_0x32ab('0x77')];}else{_0x2c9b2a['host']=_0x34bae3[_0x32ab('0x3d')][_0x32ab('0x75')];_0x2c9b2a[_0x32ab('0x76')]=_0x34bae3[_0x32ab('0x3d')][_0x32ab('0x76')];_0x2c9b2a[_0x32ab('0xa6')]=_0x34bae3[_0x32ab('0x3d')]['secure'];}if(_0x34bae3[_0x32ab('0x3d')][_0x32ab('0x74')]){_0x2c9b2a[_0x32ab('0xa5')]={'user':_0x34bae3[_0x32ab('0x3d')][_0x32ab('0x72')],'pass':_0x34bae3[_0x32ab('0x3d')]['pass']};}return respondWithRpcPromise(_0x32ab('0xb0'),'verifySmtp',{'account':_0x2c9b2a});}})[_0x32ab('0x1f')](respondWithResult(_0x529b2f,null))[_0x32ab('0x29')](handleError(_0x529b2f,null));};exports[_0x32ab('0x34')]=function(_0x29cb52,_0x2d4c39){return db['MailAccount'][_0x32ab('0x58')]({'where':{'id':_0x29cb52[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x2d4c39,null))['then'](function(_0x44a9b4){if(_0x44a9b4&&_0x44a9b4[_0x32ab('0x77')]){throw new db['Sequelize']['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x44a9b4;})[_0x32ab('0x1f')](removeEntity(_0x2d4c39,null))['catch'](handleError(_0x2d4c39,null));};exports[_0x32ab('0xb1')]=function(_0x4c4eac,_0x41e0f7,_0x43324a){return db[_0x32ab('0x3e')][_0x32ab('0x58')]({'where':{'id':_0x4c4eac[_0x32ab('0x55')]['id']}})[_0x32ab('0x1f')](handleEntityNotFound(_0x41e0f7,null))['then'](function(_0x2edf85){if(_0x2edf85){return _0x2edf85[_0x32ab('0xb1')](_0x4c4eac[_0x32ab('0x5a')][_0x32ab('0x63')],_[_0x32ab('0x84')](_0x4c4eac[_0x32ab('0x5a')],[_0x32ab('0x63'),'id'])||{})[_0x32ab('0xb2')](function(_0x350c9a){for(var _0x574b49=0x0;_0x574b49<_0x4c4eac[_0x32ab('0x5a')][_0x32ab('0x63')][_0x32ab('0x60')];_0x574b49+=0x1){socket['emit'](_0x32ab('0xb3'),{'UserId':_0x4c4eac[_0x32ab('0x5a')][_0x32ab('0x63')][_0x574b49],'MailAccountId':_0x4c4eac['params']['id']});}return _0x350c9a;});}})[_0x32ab('0x1f')](respondWithResult(_0x41e0f7,null))['catch'](handleError(_0x41e0f7,null));};exports['removeAgents']=function(_0x565a9f,_0x5b0127,_0x2e3999){var _0x47d077;return db[_0x32ab('0x3e')][_0x32ab('0x58')]({'where':{'id':_0x565a9f[_0x32ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x5b0127,null))[_0x32ab('0x1f')](function(_0x5f29c4){if(_0x5f29c4){return _0x5f29c4[_0x32ab('0xb4')](_0x565a9f[_0x32ab('0x42')][_0x32ab('0x63')])[_0x32ab('0x1f')](function(_0x5c07e9){if(_[_0x32ab('0xb5')](_0x565a9f[_0x32ab('0x42')][_0x32ab('0x63')])){for(var _0x1c2660=0x0;_0x1c2660<_0x565a9f['query'][_0x32ab('0x63')][_0x32ab('0x60')];_0x1c2660+=0x1){socket[_0x32ab('0xb6')](_0x32ab('0xb7'),{'UserId':_0x565a9f[_0x32ab('0x42')][_0x32ab('0x63')][_0x1c2660],'MailAccountId':_0x565a9f['params']['id']});}}else{socket[_0x32ab('0xb6')](_0x32ab('0xb7'),{'UserId':_0x565a9f[_0x32ab('0x42')][_0x32ab('0x63')],'MailAccountId':_0x565a9f[_0x32ab('0x55')]['id']});}});}})[_0x32ab('0x1f')](respondWithStatusCode(_0x5b0127,null))[_0x32ab('0x29')](handleError(_0x5b0127,null));};exports['getAgents']=function(_0x456b2f,_0x226bba,_0x5d04cd){var _0x30355f={};var _0x590f00={};var _0x48d58d;var _0xcafe33;return db['MailAccount'][_0x32ab('0x67')]({'where':{'id':_0x456b2f['params']['id']}})['then'](handleEntityNotFound(_0x226bba,null))[_0x32ab('0x1f')](function(_0x2ced49){if(_0x2ced49){_0x48d58d=_0x2ced49;_0x590f00[_0x32ab('0x40')]=_[_0x32ab('0x41')](db[_0x32ab('0x89')]['rawAttributes']);_0x590f00[_0x32ab('0x42')]=_[_0x32ab('0x41')](_0x456b2f['query']);_0x590f00[_0x32ab('0x4b')]=_[_0x32ab('0x56')](_0x590f00['model'],_0x590f00[_0x32ab('0x42')]);_0x30355f[_0x32ab('0x45')]=_['intersection'](_0x590f00[_0x32ab('0x40')],qs[_0x32ab('0x46')](_0x456b2f['query'][_0x32ab('0x46')]));_0x30355f[_0x32ab('0x45')]=_0x30355f[_0x32ab('0x45')]['length']?_0x30355f[_0x32ab('0x45')]:_0x590f00[_0x32ab('0x40')];_0x30355f['order']=qs['sort'](_0x456b2f['query'][_0x32ab('0x49')]);_0x30355f['where']=qs[_0x32ab('0x4b')](_['pick'](_0x456b2f['query'],_0x590f00[_0x32ab('0x4b')]));if(_0x456b2f[_0x32ab('0x42')]['filter']){_0x30355f[_0x32ab('0x4a')]=_[_0x32ab('0x4f')](_0x30355f['where'],{'$or':_[_0x32ab('0x68')](_0x30355f['attributes'],function(_0x5df83f){var _0x42a7f5={};_0x42a7f5[_0x5df83f]={'$like':'%'+_0x456b2f[_0x32ab('0x42')][_0x32ab('0x50')]+'%'};return _0x42a7f5;})});}_0x30355f=_[_0x32ab('0x4f')]({},_0x30355f,_0x456b2f[_0x32ab('0x51')]);return _0x48d58d[_0x32ab('0xb8')](_0x30355f);}})[_0x32ab('0x1f')](function(_0x173413){if(_0x173413){_0xcafe33=_0x173413[_0x32ab('0x60')];if(!_0x456b2f[_0x32ab('0x42')]['hasOwnProperty'](_0x32ab('0x48'))){_0x30355f['limit']=qs[_0x32ab('0x2f')](_0x456b2f[_0x32ab('0x42')]['limit']);_0x30355f['offset']=qs[_0x32ab('0x2e')](_0x456b2f['query'][_0x32ab('0x2e')]);}return _0x48d58d['getAgents'](_0x30355f);}})[_0x32ab('0x1f')](function(_0x5a6728){if(_0x5a6728){return _0x5a6728?{'count':_0xcafe33,'rows':_0x5a6728}:null;}})[_0x32ab('0x1f')](respondWithResult(_0x226bba,null))[_0x32ab('0x29')](handleError(_0x226bba,null));}; \ No newline at end of file +var _0x0fda=['offset','limit','set','Content-Range','json','apply','reject','save','destroy','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','MailAccount','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','map','filter','options','count','includeAll','include','findAll','rows','show','rawAttributes','find','catch','update','body','describe','addDisposition','params','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','getAnswers','CannedAnswer','nolimit','key','email','ListId','isNil','active','description','cauthentication','user','cuser','pass','authentication','host','port','cservice','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','getImap','addImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','service','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','client','http','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end'];(function(_0xc71584,_0x14dab0){var _0x254531=function(_0x49ecbd){while(--_0x49ecbd){_0xc71584['push'](_0xc71584['shift']());}};_0x254531(++_0x14dab0);}(_0x0fda,0x96));var _0xa0fd=function(_0x4818ef,_0x2fb6bf){_0x4818ef=_0x4818ef-0x0;var _0x3fdd01=_0x0fda[_0x4818ef];return _0x3fdd01;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa0fd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa0fd('0x1'));var moment=require(_0xa0fd('0x2'));var BPromise=require(_0xa0fd('0x3'));var Mustache=require(_0xa0fd('0x4'));var util=require('util');var path=require(_0xa0fd('0x5'));var sox=require(_0xa0fd('0x6'));var csv=require('to-csv');var ejs=require(_0xa0fd('0x7'));var fs=require('fs');var _=require(_0xa0fd('0x8'));var squel=require(_0xa0fd('0x9'));var crypto=require(_0xa0fd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa0fd('0xb'));var toCsv=require(_0xa0fd('0xc'));var querystring=require(_0xa0fd('0xd'));var Papa=require('papaparse');var Redis=require(_0xa0fd('0xe'));var qs=require(_0xa0fd('0xf'));var logger=require(_0xa0fd('0x10'))(_0xa0fd('0x11'));var utils=require('../../config/utils');var config=require(_0xa0fd('0x12'));var db=require(_0xa0fd('0x13'))['db'];config[_0xa0fd('0x14')]=_[_0xa0fd('0x15')](config[_0xa0fd('0x14')],{'host':_0xa0fd('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0fd('0x14')]));require(_0xa0fd('0x17'))[_0xa0fd('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa0fd('0x19')][_0xa0fd('0x1a')]({'port':0x232b});function respondWithRpcPromise(_0x1a9d4a,_0x5f4139,_0x352ee7,_0x300c1c){return new BPromise(function(_0x2914f6,_0x5abe9c){var _0x341dea=_0x300c1c||client;return _0x341dea['request'](_0x1a9d4a,_0x352ee7)[_0xa0fd('0x1b')](function(_0x82313f){logger[_0xa0fd('0x1c')]('MailAccount,\x20%s,\x20%s',_0x5f4139,'request\x20sent');logger[_0xa0fd('0x1d')](_0xa0fd('0x1e'),_0x5f4139,_0xa0fd('0x1f'),JSON[_0xa0fd('0x20')](_0x82313f));if(_0x82313f['error']){if(_0x82313f['error'][_0xa0fd('0x21')]===0x1f4){logger[_0xa0fd('0x22')](_0xa0fd('0x23'),_0x5f4139,_0x82313f[_0xa0fd('0x22')][_0xa0fd('0x24')]);return _0x5abe9c(_0x82313f['error'][_0xa0fd('0x24')]);}logger['error'](_0xa0fd('0x23'),_0x5f4139,_0x82313f['error'][_0xa0fd('0x24')]);return _0x2914f6(_0x82313f[_0xa0fd('0x22')][_0xa0fd('0x24')]);}else{logger['info'](_0xa0fd('0x23'),_0x5f4139,_0xa0fd('0x1f'));_0x2914f6(_0x82313f[_0xa0fd('0x25')][_0xa0fd('0x24')]);}})['catch'](function(_0x283905){logger[_0xa0fd('0x22')]('MailAccount,\x20%s,\x20%s',_0x5f4139,_0x283905);_0x5abe9c(_0x283905);});});}function respondWithStatusCode(_0x31dc55,_0x3e6d30){_0x3e6d30=_0x3e6d30||0xcc;return function(_0x486c9b){if(_0x486c9b){return _0x31dc55[_0xa0fd('0x26')](_0x3e6d30);}return _0x31dc55[_0xa0fd('0x27')](_0x3e6d30)[_0xa0fd('0x28')]();};}function respondWithResult(_0x365d01,_0x1ece6b){_0x1ece6b=_0x1ece6b||0xc8;return function(_0x562ddc){if(_0x562ddc){return _0x365d01[_0xa0fd('0x27')](_0x1ece6b)['json'](_0x562ddc);}};}function respondWithFilteredResult(_0x186890,_0x55508e){return function(_0x13b62a){if(_0x13b62a){var _0x208336=_0x13b62a['count'],_0x4e9587=_0x55508e['offset'],_0x5b796f=_0x55508e[_0xa0fd('0x29')]+_0x55508e[_0xa0fd('0x2a')],_0x2a43a3;if(_0x5b796f>=_0x208336){_0x5b796f=_0x208336;_0x2a43a3=0xc8;}else{_0x2a43a3=0xce;}_0x186890['status'](_0x2a43a3);return _0x186890[_0xa0fd('0x2b')](_0xa0fd('0x2c'),_0x4e9587+'-'+_0x5b796f+'/'+_0x208336)[_0xa0fd('0x2d')](_0x13b62a);}return null;};}function patchUpdates(_0x309ae9){return function(_0x1a09d3){try{jsonpatch[_0xa0fd('0x2e')](_0x1a09d3,_0x309ae9,!![]);}catch(_0x3910cb){return BPromise[_0xa0fd('0x2f')](_0x3910cb);}return _0x1a09d3[_0xa0fd('0x30')]();};}function saveUpdates(_0x4cb0d1,_0x16a78a){return function(_0x531aab){if(_0x531aab){return _0x531aab['update'](_0x4cb0d1)['then'](function(_0x9de57d){return _0x9de57d;});}return null;};}function removeEntity(_0x11257c,_0x43b1aa){return function(_0x33abcb){if(_0x33abcb){return _0x33abcb[_0xa0fd('0x31')]()[_0xa0fd('0x1b')](function(){var _0x379c37=_0x33abcb['get']({'plain':!![]});var _0x5ce8cd='MailAccounts';return db[_0xa0fd('0x32')][_0xa0fd('0x31')]({'where':{'type':_0x5ce8cd,'resourceId':_0x379c37['id']}})[_0xa0fd('0x1b')](function(){return _0x33abcb;});})[_0xa0fd('0x1b')](function(){_0x11257c[_0xa0fd('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3802ef,_0x16e2c6){return function(_0x3ef53d){if(!_0x3ef53d){_0x3802ef[_0xa0fd('0x26')](0x194);}return _0x3ef53d;};}function handleError(_0x442f6b,_0x384beb){_0x384beb=_0x384beb||0x1f4;return function(_0x110c7c){logger[_0xa0fd('0x22')](_0x110c7c[_0xa0fd('0x33')]);if(_0x110c7c['name']){delete _0x110c7c[_0xa0fd('0x34')];}_0x442f6b['status'](_0x384beb)[_0xa0fd('0x35')](_0x110c7c);};}exports[_0xa0fd('0x36')]=function(_0x883901,_0x28c821){var _0x39214b={'include':[{'model':db[_0xa0fd('0x37')],'as':_0xa0fd('0x38')},{'model':db[_0xa0fd('0x39')],'as':_0xa0fd('0x3a')}]},_0x4fa846={},_0x55e84c={'count':0x0,'rows':[]};var _0x1836f2=db[_0xa0fd('0x3b')]['rawAttributes'];_0x4fa846[_0xa0fd('0x3c')]=_['keys'](_0x1836f2);var _0x29c662={'dateStart':_0x883901[_0xa0fd('0x3d')][_0xa0fd('0x3e')],'dateEnd':_0x883901[_0xa0fd('0x3d')][_0xa0fd('0x3f')]};delete _0x883901[_0xa0fd('0x3d')][_0xa0fd('0x3e')];delete _0x883901[_0xa0fd('0x3d')][_0xa0fd('0x3f')];_0x4fa846[_0xa0fd('0x3d')]=_[_0xa0fd('0x40')](_0x883901[_0xa0fd('0x3d')]);_0x4fa846['filters']=_[_0xa0fd('0x41')](_0x4fa846[_0xa0fd('0x3c')],_0x4fa846[_0xa0fd('0x3d')]);_0x39214b[_0xa0fd('0x42')]=_[_0xa0fd('0x41')](_0x4fa846[_0xa0fd('0x3c')],qs[_0xa0fd('0x43')](_0x883901['query'][_0xa0fd('0x43')]));_0x39214b[_0xa0fd('0x42')]=_0x39214b[_0xa0fd('0x42')][_0xa0fd('0x44')]?_0x39214b[_0xa0fd('0x42')]:_0x4fa846[_0xa0fd('0x3c')];if(!_0x883901[_0xa0fd('0x3d')][_0xa0fd('0x45')]('nolimit')){_0x39214b[_0xa0fd('0x2a')]=qs[_0xa0fd('0x2a')](_0x883901[_0xa0fd('0x3d')][_0xa0fd('0x2a')]);_0x39214b['offset']=qs['offset'](_0x883901[_0xa0fd('0x3d')][_0xa0fd('0x29')]);}_0x39214b[_0xa0fd('0x46')]=qs['sort'](_0x883901[_0xa0fd('0x3d')][_0xa0fd('0x47')]);_0x39214b[_0xa0fd('0x48')]=qs[_0xa0fd('0x49')](_[_0xa0fd('0x4a')](_0x883901['query'],_0x4fa846[_0xa0fd('0x49')]));if(_0x29c662['dateStart']){if(_0x29c662[_0xa0fd('0x3f')]){_0x29c662[_0xa0fd('0x3f')]=moment(_0x29c662[_0xa0fd('0x3f')])[_0xa0fd('0x4b')](0x1,'day');}else{_0x29c662[_0xa0fd('0x3f')]=moment(_0x29c662[_0xa0fd('0x3e')])[_0xa0fd('0x4b')](0x1,_0xa0fd('0x4c'));}_[_0xa0fd('0x4d')](_0x39214b['where'],{'createdAt':{'$gte':_0x29c662[_0xa0fd('0x3e')],'$lte':_0x29c662[_0xa0fd('0x3f')]}});}if(_0x883901[_0xa0fd('0x3d')]['filter']){_0x39214b[_0xa0fd('0x48')]=_[_0xa0fd('0x4d')](_0x39214b[_0xa0fd('0x48')],{'$or':_[_0xa0fd('0x4e')](_0x39214b[_0xa0fd('0x42')],function(_0x44bf4c){var _0x422445={};_0x422445[_0x44bf4c]={'$like':'%'+_0x883901[_0xa0fd('0x3d')][_0xa0fd('0x4f')]+'%'};return _0x422445;})});}_0x39214b=_[_0xa0fd('0x4d')]({},_0x39214b,_0x883901[_0xa0fd('0x50')]);var _0x291dce={'where':_0x39214b[_0xa0fd('0x48')]};return db['MailAccount'][_0xa0fd('0x51')](_0x291dce)[_0xa0fd('0x1b')](function(_0x5c6b56){_0x55e84c['count']=_0x5c6b56;if(_0x883901['query'][_0xa0fd('0x52')]){_0x39214b[_0xa0fd('0x53')]=[{'all':!![]}];}return db['MailAccount'][_0xa0fd('0x54')](_0x39214b);})['then'](function(_0x4a10b4){_0x55e84c[_0xa0fd('0x55')]=_0x4a10b4;return _0x55e84c;})[_0xa0fd('0x1b')](respondWithFilteredResult(_0x28c821,_0x39214b))['catch'](handleError(_0x28c821,null));};exports[_0xa0fd('0x56')]=function(_0x5d8c02,_0x4cb83f){var _0x5484d7={'raw':![],'where':{'id':_0x5d8c02['params']['id']},'include':[{'model':db[_0xa0fd('0x37')],'as':_0xa0fd('0x38')},{'model':db['MailServerOut'],'as':_0xa0fd('0x3a')}]},_0x2c278b={};_0x2c278b[_0xa0fd('0x3c')]=_[_0xa0fd('0x40')](db[_0xa0fd('0x3b')][_0xa0fd('0x57')]);_0x2c278b[_0xa0fd('0x3d')]=_[_0xa0fd('0x40')](_0x5d8c02[_0xa0fd('0x3d')]);_0x2c278b[_0xa0fd('0x49')]=_[_0xa0fd('0x41')](_0x2c278b['model'],_0x2c278b['query']);_0x5484d7[_0xa0fd('0x42')]=_[_0xa0fd('0x41')](_0x2c278b[_0xa0fd('0x3c')],qs[_0xa0fd('0x43')](_0x5d8c02['query'][_0xa0fd('0x43')]));_0x5484d7[_0xa0fd('0x42')]=_0x5484d7[_0xa0fd('0x42')][_0xa0fd('0x44')]?_0x5484d7['attributes']:_0x2c278b[_0xa0fd('0x3c')];if(_0x5d8c02[_0xa0fd('0x3d')]['includeAll']){_0x5484d7['include']=[{'all':!![]}];}_0x5484d7=_[_0xa0fd('0x4d')]({},_0x5484d7,_0x5d8c02[_0xa0fd('0x50')]);return db[_0xa0fd('0x3b')][_0xa0fd('0x58')](_0x5484d7)[_0xa0fd('0x1b')](handleEntityNotFound(_0x4cb83f,null))[_0xa0fd('0x1b')](respondWithResult(_0x4cb83f,null))[_0xa0fd('0x59')](handleError(_0x4cb83f,null));};exports[_0xa0fd('0x5a')]=function(_0x377746,_0x4761b9){if(_0x377746[_0xa0fd('0x5b')]['id']){delete _0x377746[_0xa0fd('0x5b')]['id'];}return db[_0xa0fd('0x3b')]['find']({'where':{'id':_0x377746['params']['id']},'include':[{'model':db[_0xa0fd('0x37')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0xa0fd('0x1b')](handleEntityNotFound(_0x4761b9,null))[_0xa0fd('0x1b')](saveUpdates(_0x377746[_0xa0fd('0x5b')],null))[_0xa0fd('0x1b')](function(_0x27a4dc){if(_0x27a4dc&&_0x377746[_0xa0fd('0x5b')][_0xa0fd('0x38')]){return db[_0xa0fd('0x37')][_0xa0fd('0x5a')](_0x377746[_0xa0fd('0x5b')]['Imap'],{'where':{'MailAccountId':_0x27a4dc['id']}})[_0xa0fd('0x1b')](function(){return _0x27a4dc;});}return _0x27a4dc;})[_0xa0fd('0x1b')](function(_0x3d0257){if(_0x3d0257&&_0x377746[_0xa0fd('0x5b')][_0xa0fd('0x3a')]){return db['MailServerOut'][_0xa0fd('0x5a')](_0x377746['body'][_0xa0fd('0x3a')],{'where':{'MailAccountId':_0x3d0257['id']}})[_0xa0fd('0x1b')](function(){return _0x3d0257;});}return _0x3d0257;})['then'](respondWithResult(_0x4761b9,null))[_0xa0fd('0x59')](handleError(_0x4761b9,null));};exports[_0xa0fd('0x5c')]=function(_0x228356,_0x5bd76f){return db[_0xa0fd('0x3b')][_0xa0fd('0x5c')]()[_0xa0fd('0x1b')](respondWithResult(_0x5bd76f,null))[_0xa0fd('0x59')](handleError(_0x5bd76f,null));};exports[_0xa0fd('0x5d')]=function(_0x2af33d,_0x4405aa,_0x53aff7){if(_0x2af33d[_0xa0fd('0x5b')]['id']){delete _0x2af33d['body']['id'];}return db['MailAccount'][_0xa0fd('0x58')]({'where':{'id':_0x2af33d[_0xa0fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4405aa,null))[_0xa0fd('0x1b')](function(_0x3642c1){if(_0x3642c1){_0x2af33d['body'][_0xa0fd('0x5f')]=_0x3642c1['id'];return db[_0xa0fd('0x60')][_0xa0fd('0x61')](_0x2af33d[_0xa0fd('0x5b')]);}})[_0xa0fd('0x1b')](respondWithResult(_0x4405aa,null))['catch'](handleError(_0x4405aa,null));};exports[_0xa0fd('0x62')]=function(_0x2c694b,_0x56b0d3,_0x1869f9){var _0x3d3b1e={'raw':![],'where':{}};var _0x27ea8f={};var _0x478fac={'count':0x0,'rows':[]};return db[_0xa0fd('0x3b')][_0xa0fd('0x63')]({'where':{'id':_0x2c694b[_0xa0fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x56b0d3,null))[_0xa0fd('0x1b')](function(_0x18eef4){if(_0x18eef4){_0x27ea8f['model']=_[_0xa0fd('0x40')](db['Disposition'][_0xa0fd('0x57')]);_0x27ea8f[_0xa0fd('0x3d')]=_[_0xa0fd('0x40')](_0x2c694b[_0xa0fd('0x3d')]);_0x27ea8f[_0xa0fd('0x49')]=_['intersection'](_0x27ea8f['model'],_0x27ea8f[_0xa0fd('0x3d')]);_0x3d3b1e[_0xa0fd('0x42')]=_['intersection'](_0x27ea8f['model'],qs[_0xa0fd('0x43')](_0x2c694b[_0xa0fd('0x3d')][_0xa0fd('0x43')]));_0x3d3b1e[_0xa0fd('0x42')]=_0x3d3b1e['attributes']['length']?_0x3d3b1e[_0xa0fd('0x42')]:_0x27ea8f['model'];if(!_0x2c694b[_0xa0fd('0x3d')][_0xa0fd('0x45')]('nolimit')){_0x3d3b1e[_0xa0fd('0x2a')]=qs[_0xa0fd('0x2a')](_0x2c694b[_0xa0fd('0x3d')][_0xa0fd('0x2a')]);_0x3d3b1e['offset']=qs[_0xa0fd('0x29')](_0x2c694b[_0xa0fd('0x3d')][_0xa0fd('0x29')]);}_0x3d3b1e['order']=qs['sort'](_0x2c694b[_0xa0fd('0x3d')]['sort']);_0x3d3b1e[_0xa0fd('0x48')]=qs[_0xa0fd('0x49')](_['pick'](_0x2c694b[_0xa0fd('0x3d')],_0x27ea8f['filters']));_0x3d3b1e[_0xa0fd('0x48')][_0xa0fd('0x5f')]=_0x18eef4['id'];if(_0x2c694b[_0xa0fd('0x3d')][_0xa0fd('0x4f')]){_0x3d3b1e[_0xa0fd('0x48')]=_[_0xa0fd('0x4d')](_0x3d3b1e[_0xa0fd('0x48')],{'$or':_[_0xa0fd('0x4e')](_0x3d3b1e['attributes'],function(_0x187af0){var _0x460a5b={};_0x460a5b[_0x187af0]={'$like':'%'+_0x2c694b['query'][_0xa0fd('0x4f')]+'%'};return _0x460a5b;})});}_0x3d3b1e=_['merge']({},_0x3d3b1e,_0x2c694b[_0xa0fd('0x50')]);return db['Disposition']['count']({'where':_0x3d3b1e['where']})['then'](function(_0x4404f1){_0x478fac[_0xa0fd('0x51')]=_0x4404f1;if(_0x2c694b[_0xa0fd('0x3d')][_0xa0fd('0x52')]){_0x3d3b1e[_0xa0fd('0x53')]=[{'all':!![]}];}return db[_0xa0fd('0x60')][_0xa0fd('0x54')](_0x3d3b1e);})['then'](function(_0x367890){_0x478fac['rows']=_0x367890;return _0x478fac;});}})[_0xa0fd('0x1b')](respondWithFilteredResult(_0x56b0d3,_0x3d3b1e))[_0xa0fd('0x59')](handleError(_0x56b0d3,null));};exports[_0xa0fd('0x64')]=function(_0x40161e,_0x168cc0,_0x2c7acd){var _0x1552d6;return db[_0xa0fd('0x3b')][_0xa0fd('0x58')]({'where':{'id':_0x40161e[_0xa0fd('0x5e')]['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x168cc0,null))['then'](function(_0x374d1b){if(_0x374d1b){return _0x374d1b['removeDispositions'](_0x40161e[_0xa0fd('0x3d')][_0xa0fd('0x65')]);}})[_0xa0fd('0x1b')](respondWithStatusCode(_0x168cc0,null))[_0xa0fd('0x59')](handleError(_0x168cc0,null));};exports['addAnswer']=function(_0x2e4f4c,_0x1dba4b,_0x3444c2){if(_0x2e4f4c['body']['id']){delete _0x2e4f4c['body']['id'];}return db[_0xa0fd('0x3b')][_0xa0fd('0x58')]({'where':{'id':_0x2e4f4c[_0xa0fd('0x5e')]['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x1dba4b,null))[_0xa0fd('0x1b')](function(_0x199e55){if(_0x199e55){_0x2e4f4c[_0xa0fd('0x5b')][_0xa0fd('0x5f')]=_0x199e55['id'];return db['CannedAnswer'][_0xa0fd('0x61')](_0x2e4f4c['body']);}})[_0xa0fd('0x1b')](respondWithResult(_0x1dba4b,null))[_0xa0fd('0x59')](handleError(_0x1dba4b,null));};exports[_0xa0fd('0x66')]=function(_0x5ad2ab,_0x4567b8,_0x4ccbea){var _0x39fdbc={'raw':![],'where':{}};var _0x55ea33={};var _0x553850={'count':0x0,'rows':[]};return db[_0xa0fd('0x3b')]['findOne']({'where':{'id':_0x5ad2ab[_0xa0fd('0x5e')]['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x4567b8,null))[_0xa0fd('0x1b')](function(_0x1cb503){if(_0x1cb503){_0x55ea33[_0xa0fd('0x3c')]=_['keys'](db[_0xa0fd('0x67')][_0xa0fd('0x57')]);_0x55ea33['query']=_['keys'](_0x5ad2ab[_0xa0fd('0x3d')]);_0x55ea33[_0xa0fd('0x49')]=_[_0xa0fd('0x41')](_0x55ea33[_0xa0fd('0x3c')],_0x55ea33[_0xa0fd('0x3d')]);_0x39fdbc['attributes']=_[_0xa0fd('0x41')](_0x55ea33['model'],qs[_0xa0fd('0x43')](_0x5ad2ab[_0xa0fd('0x3d')][_0xa0fd('0x43')]));_0x39fdbc[_0xa0fd('0x42')]=_0x39fdbc[_0xa0fd('0x42')][_0xa0fd('0x44')]?_0x39fdbc[_0xa0fd('0x42')]:_0x55ea33['model'];if(!_0x5ad2ab[_0xa0fd('0x3d')][_0xa0fd('0x45')](_0xa0fd('0x68'))){_0x39fdbc[_0xa0fd('0x2a')]=qs[_0xa0fd('0x2a')](_0x5ad2ab['query'][_0xa0fd('0x2a')]);_0x39fdbc[_0xa0fd('0x29')]=qs[_0xa0fd('0x29')](_0x5ad2ab[_0xa0fd('0x3d')][_0xa0fd('0x29')]);}_0x39fdbc['order']=qs[_0xa0fd('0x47')](_0x5ad2ab['query'][_0xa0fd('0x47')]);_0x39fdbc[_0xa0fd('0x48')]=qs[_0xa0fd('0x49')](_[_0xa0fd('0x4a')](_0x5ad2ab['query'],_0x55ea33[_0xa0fd('0x49')]));_0x39fdbc[_0xa0fd('0x48')][_0xa0fd('0x5f')]=_0x1cb503['id'];if(_0x5ad2ab[_0xa0fd('0x3d')][_0xa0fd('0x4f')]){_0x39fdbc[_0xa0fd('0x48')]=_[_0xa0fd('0x4d')](_0x39fdbc[_0xa0fd('0x48')],{'$or':_[_0xa0fd('0x4e')](_0x39fdbc[_0xa0fd('0x42')],function(_0x481279){var _0x27bd5c={};_0x27bd5c[_0x481279]={'$like':'%'+_0x5ad2ab[_0xa0fd('0x3d')]['filter']+'%'};return _0x27bd5c;})});}_0x39fdbc=_[_0xa0fd('0x4d')]({},_0x39fdbc,_0x5ad2ab[_0xa0fd('0x50')]);return db[_0xa0fd('0x67')]['count']({'where':_0x39fdbc[_0xa0fd('0x48')]})['then'](function(_0x2529dc){_0x553850[_0xa0fd('0x51')]=_0x2529dc;if(_0x5ad2ab['query'][_0xa0fd('0x52')]){_0x39fdbc[_0xa0fd('0x53')]=[{'all':!![]}];}return db[_0xa0fd('0x67')][_0xa0fd('0x54')](_0x39fdbc);})['then'](function(_0x2a3570){_0x553850['rows']=_0x2a3570;return _0x553850;});}})[_0xa0fd('0x1b')](respondWithFilteredResult(_0x4567b8,_0x39fdbc))[_0xa0fd('0x59')](handleError(_0x4567b8,null));};exports['removeAnswers']=function(_0x3a8311,_0x246214,_0x1a32ee){var _0x533618;return db[_0xa0fd('0x3b')]['find']({'where':{'id':_0x3a8311['params']['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x246214,null))['then'](function(_0x21aebc){if(_0x21aebc){return _0x21aebc['removeAnswers'](_0x3a8311['query'][_0xa0fd('0x65')]);}})[_0xa0fd('0x1b')](respondWithStatusCode(_0x246214,null))['catch'](handleError(_0x246214,null));};exports['create']=function(_0x45a7a9,_0x5cc9e6){var _0x70f5c1={'name':_0x45a7a9['body'][_0xa0fd('0x34')],'key':_0x45a7a9[_0xa0fd('0x5b')][_0xa0fd('0x69')],'email':_0x45a7a9['body'][_0xa0fd('0x6a')],'ListId':_0x45a7a9[_0xa0fd('0x5b')][_0xa0fd('0x6b')],'active':!_[_0xa0fd('0x6c')](_0x45a7a9[_0xa0fd('0x5b')][_0xa0fd('0x6d')])?_0x45a7a9[_0xa0fd('0x5b')]['active']:!![],'description':_0x45a7a9['body'][_0xa0fd('0x6e')]||null,'Imap':{},'Smtp':{}};if(_[_0xa0fd('0x6c')](_0x45a7a9[_0xa0fd('0x5b')]['cservice'])){if(_0x45a7a9[_0xa0fd('0x5b')][_0xa0fd('0x6f')]){_0x70f5c1[_0xa0fd('0x38')][_0xa0fd('0x70')]=_0x70f5c1[_0xa0fd('0x3a')][_0xa0fd('0x70')]=_0x45a7a9[_0xa0fd('0x5b')][_0xa0fd('0x71')];_0x70f5c1[_0xa0fd('0x38')]['password']=_0x70f5c1[_0xa0fd('0x3a')][_0xa0fd('0x72')]=_0x45a7a9[_0xa0fd('0x5b')]['cpassword'];}else{_0x70f5c1[_0xa0fd('0x38')][_0xa0fd('0x73')]=_0x70f5c1['Smtp'][_0xa0fd('0x73')]=![];}_0x70f5c1[_0xa0fd('0x38')]['host']=_0x45a7a9[_0xa0fd('0x5b')][_0xa0fd('0x38')][_0xa0fd('0x74')];_0x70f5c1['Imap']['port']=_0x45a7a9[_0xa0fd('0x5b')][_0xa0fd('0x38')][_0xa0fd('0x75')];_0x70f5c1['Smtp'][_0xa0fd('0x74')]=_0x45a7a9[_0xa0fd('0x5b')]['Smtp'][_0xa0fd('0x74')];_0x70f5c1[_0xa0fd('0x3a')][_0xa0fd('0x75')]=_0x45a7a9[_0xa0fd('0x5b')][_0xa0fd('0x3a')][_0xa0fd('0x75')];}else{_0x70f5c1['Imap']['service']=_0x70f5c1['Smtp']['service']=_0x45a7a9[_0xa0fd('0x5b')][_0xa0fd('0x76')];_0x70f5c1[_0xa0fd('0x38')][_0xa0fd('0x70')]=_0x70f5c1['Smtp'][_0xa0fd('0x70')]=_0x45a7a9[_0xa0fd('0x5b')]['cuser'];_0x70f5c1['Imap'][_0xa0fd('0x77')]=_0x70f5c1['Smtp'][_0xa0fd('0x72')]=_0x45a7a9[_0xa0fd('0x5b')]['cpassword'];}return db[_0xa0fd('0x3b')][_0xa0fd('0x61')](_0x70f5c1,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xa0fd('0x37')],'as':'Imap'}]})[_0xa0fd('0x1b')](function(_0x141838){var _0x2b2011=_0x45a7a9[_0xa0fd('0x70')]['get']({'plain':!![]});if(!_0x2b2011)throw new Error(_0xa0fd('0x78'));if(_0x2b2011[_0xa0fd('0x79')]===_0xa0fd('0x70')){var _0x780a44=_0x141838['get']({'plain':!![]});return db[_0xa0fd('0x7a')][_0xa0fd('0x58')]({'where':{'name':_0xa0fd('0x7b'),'userProfileId':_0x2b2011[_0xa0fd('0x7c')]},'raw':!![]})[_0xa0fd('0x1b')](function(_0x18246a){if(_0x18246a&&_0x18246a[_0xa0fd('0x7d')]===0x0){return db[_0xa0fd('0x32')]['create']({'name':_0x780a44[_0xa0fd('0x34')],'resourceId':_0x780a44['id'],'type':_0x18246a['name'],'sectionId':_0x18246a['id']},{})[_0xa0fd('0x1b')](function(){return _0x141838;});}else{return _0x141838;}})[_0xa0fd('0x59')](function(_0x25249c){logger[_0xa0fd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25249c);throw _0x25249c;});}return _0x141838;})[_0xa0fd('0x1b')](respondWithResult(_0x5cc9e6,0xc9))[_0xa0fd('0x59')](handleError(_0x5cc9e6,null));};exports[_0xa0fd('0x7e')]=function(_0x8df61e,_0x3eb27d,_0x7cf845){return db[_0xa0fd('0x3b')][_0xa0fd('0x63')]({'where':{'id':_0x8df61e[_0xa0fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3eb27d,null))[_0xa0fd('0x1b')](function(_0x2c8de4){if(_0x2c8de4){return _0x2c8de4[_0xa0fd('0x7e')]();}return null;})['then'](respondWithResult(_0x3eb27d,null))[_0xa0fd('0x59')](handleError(_0x3eb27d,null));};exports[_0xa0fd('0x7f')]=function(_0x3799ae,_0x2e62af,_0x52614e){if(_0x3799ae[_0xa0fd('0x5b')]['id']){delete _0x3799ae['body']['id'];}return db['MailAccount'][_0xa0fd('0x58')]({'where':{'id':_0x3799ae[_0xa0fd('0x5e')]['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x2e62af,null))['then'](function(_0x39d9d8){if(_0x39d9d8){_0x3799ae[_0xa0fd('0x5b')][_0xa0fd('0x5f')]=_0x39d9d8['id'];return db[_0xa0fd('0x37')][_0xa0fd('0x61')](_0x3799ae['body']);}})[_0xa0fd('0x1b')](respondWithResult(_0x2e62af,null))['catch'](handleError(_0x2e62af,null));};exports[_0xa0fd('0x80')]=function(_0x59b070,_0x15dc4a,_0x43fd74){return db['MailAccount']['findOne']({'where':{'id':_0x59b070[_0xa0fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x15dc4a,null))[_0xa0fd('0x1b')](function(_0x56f539){if(_0x56f539){return _0x56f539['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x15dc4a,null))[_0xa0fd('0x59')](handleError(_0x15dc4a,null));};exports[_0xa0fd('0x81')]=function(_0x33d8c0,_0x2eabe8,_0x38d0ff){return db[_0xa0fd('0x3b')][_0xa0fd('0x63')]({'where':{'id':_0x33d8c0[_0xa0fd('0x5e')]['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x2eabe8,null))['then'](function(_0x1068fe){if(_0x1068fe){return _0x1068fe[_0xa0fd('0x81')]();}return null;})['then'](respondWithResult(_0x2eabe8,null))[_0xa0fd('0x59')](handleError(_0x2eabe8,null));};exports[_0xa0fd('0x82')]=function(_0xb5f02,_0x376217,_0x2384e9){if(_0xb5f02[_0xa0fd('0x5b')]['id']){delete _0xb5f02[_0xa0fd('0x5b')]['id'];}return db[_0xa0fd('0x3b')][_0xa0fd('0x58')]({'where':{'id':_0xb5f02['params']['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x376217,null))['then'](function(_0x57d3f9){if(_0x57d3f9){_0xb5f02['body'][_0xa0fd('0x5f')]=_0x57d3f9['id'];return db[_0xa0fd('0x39')]['create'](_0xb5f02[_0xa0fd('0x5b')]);}})[_0xa0fd('0x1b')](respondWithResult(_0x376217,null))[_0xa0fd('0x59')](handleError(_0x376217,null));};exports['removeSmtp']=function(_0x2f4c77,_0x2e4419,_0x44ef1d){return db[_0xa0fd('0x3b')][_0xa0fd('0x63')]({'where':{'id':_0x2f4c77[_0xa0fd('0x5e')]['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x2e4419,null))['then'](function(_0x650891){if(_0x650891){return _0x650891[_0xa0fd('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x2e4419,null))[_0xa0fd('0x59')](handleError(_0x2e4419,null));};exports[_0xa0fd('0x84')]=function(_0x2a2ad5,_0xeab492,_0xc7f2d6){return db[_0xa0fd('0x85')][_0xa0fd('0x58')]({'where':{'id':_0x2a2ad5[_0xa0fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0xeab492,null))[_0xa0fd('0x1b')](function(_0x5ccf21){if(_0x5ccf21){return _0x5ccf21[_0xa0fd('0x84')](_0x2a2ad5[_0xa0fd('0x5b')][_0xa0fd('0x65')],_[_0xa0fd('0x86')](_0x2a2ad5[_0xa0fd('0x5b')],[_0xa0fd('0x65'),'id'])||{});}})[_0xa0fd('0x1b')](respondWithResult(_0xeab492,null))['catch'](handleError(_0xeab492,null));};exports['getInteractions']=function(_0x1aac39,_0xc34c59,_0x11d174){var _0x5bb535={'raw':![],'where':{}};var _0x2ecfb6={};var _0x2c4501={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1aac39[_0xa0fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0xc34c59,null))[_0xa0fd('0x1b')](function(_0x2148ef){if(_0x2148ef){_0x2ecfb6[_0xa0fd('0x3c')]=_['keys'](db['MailInteraction'][_0xa0fd('0x57')]);_0x2ecfb6['query']=_['keys'](_0x1aac39['query']);_0x2ecfb6[_0xa0fd('0x49')]=_['intersection'](_0x2ecfb6['model'],_0x2ecfb6[_0xa0fd('0x3d')]);_0x5bb535['attributes']=_[_0xa0fd('0x41')](_0x2ecfb6[_0xa0fd('0x3c')],qs[_0xa0fd('0x43')](_0x1aac39[_0xa0fd('0x3d')][_0xa0fd('0x43')]));_0x5bb535[_0xa0fd('0x42')]=_0x5bb535['attributes'][_0xa0fd('0x44')]?_0x5bb535['attributes']:_0x2ecfb6['model'];if(!_0x1aac39[_0xa0fd('0x3d')][_0xa0fd('0x45')](_0xa0fd('0x68'))){_0x5bb535['limit']=qs[_0xa0fd('0x2a')](_0x1aac39[_0xa0fd('0x3d')][_0xa0fd('0x2a')]);_0x5bb535[_0xa0fd('0x29')]=qs[_0xa0fd('0x29')](_0x1aac39[_0xa0fd('0x3d')]['offset']);}_0x5bb535[_0xa0fd('0x46')]=qs[_0xa0fd('0x47')](_0x1aac39[_0xa0fd('0x3d')][_0xa0fd('0x47')]);_0x5bb535[_0xa0fd('0x48')]=qs[_0xa0fd('0x49')](_['pick'](_0x1aac39[_0xa0fd('0x3d')],_0x2ecfb6[_0xa0fd('0x49')]));_0x5bb535['where']['MailAccountId']=_0x2148ef['id'];if(_0x1aac39['query'][_0xa0fd('0x4f')]){_0x5bb535['where']=_[_0xa0fd('0x4d')](_0x5bb535[_0xa0fd('0x48')],{'$or':_[_0xa0fd('0x4e')](_0x5bb535['attributes'],function(_0x1de48b){var _0x46d713={};_0x46d713[_0x1de48b]={'$like':'%'+_0x1aac39[_0xa0fd('0x3d')][_0xa0fd('0x4f')]+'%'};return _0x46d713;})});}_0x5bb535=_[_0xa0fd('0x4d')]({},_0x5bb535,_0x1aac39[_0xa0fd('0x50')]);return db[_0xa0fd('0x85')]['count']({'where':_0x5bb535['where']})[_0xa0fd('0x1b')](function(_0x4610ce){_0x2c4501[_0xa0fd('0x51')]=_0x4610ce;if(_0x1aac39[_0xa0fd('0x3d')][_0xa0fd('0x52')]){_0x5bb535[_0xa0fd('0x53')]=[{'model':db[_0xa0fd('0x87')],'as':_0xa0fd('0x88'),'required':![]},{'model':db[_0xa0fd('0x89')],'as':_0xa0fd('0x8a'),'attributes':['name',_0xa0fd('0x8b'),_0xa0fd('0x8c')],'required':![]},{'model':db[_0xa0fd('0x8d')],'as':_0xa0fd('0x8e'),'attributes':['id','name','color'],'where':_0x1aac39[_0xa0fd('0x3d')][_0xa0fd('0x8f')]?{'id':_0x1aac39[_0xa0fd('0x3d')]['tag']}:undefined,'required':_0x1aac39[_0xa0fd('0x3d')]['tag']?!![]:![]}];}return db[_0xa0fd('0x85')][_0xa0fd('0x54')](_0x5bb535);})[_0xa0fd('0x1b')](function(_0x5d44d9){_0x2c4501['rows']=_0x5d44d9;return _0x2c4501;});}})[_0xa0fd('0x1b')](respondWithFilteredResult(_0xc34c59,_0x5bb535))[_0xa0fd('0x59')](handleError(_0xc34c59,null));};exports[_0xa0fd('0x90')]=function(_0x4e9156,_0xd3e364,_0x1be491){return db[_0xa0fd('0x3b')][_0xa0fd('0x63')]({'where':{'id':_0x4e9156[_0xa0fd('0x5e')]['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0xd3e364,null))[_0xa0fd('0x1b')](function(_0x40db66){if(_0x40db66){return db[_0xa0fd('0x91')][_0xa0fd('0x92')](function(_0x54b290){return db[_0xa0fd('0x93')]['destroy']({'where':{'MailAccountId':_0x4e9156[_0xa0fd('0x5e')]['id']},'transaction':_0x54b290})['then'](function(_0x12ee35){var _0x5a162a=_[_0xa0fd('0x4e')](_0x4e9156['body'],function(_0x2008b4){_0x2008b4['MailAccountId']=_0x4e9156[_0xa0fd('0x5e')]['id'];return _0x2008b4;});return db[_0xa0fd('0x93')][_0xa0fd('0x94')](_0x5a162a,{'transaction':_0x54b290});});})[_0xa0fd('0x1b')](function(){return db['MailApplication'][_0xa0fd('0x95')]({'where':{'MailAccountId':_0x4e9156['params']['id']},'order':'priority'});});}})[_0xa0fd('0x1b')](respondWithResult(_0xd3e364,null))['catch'](handleError(_0xd3e364,null));};exports['getApplications']=function(_0x21c441,_0x2c8dad,_0x415c54){var _0x20de77={};var _0x1c9be6={};var _0x5f0fdc;var _0x5cb1d9;return db['MailAccount']['findOne']({'where':{'id':_0x21c441[_0xa0fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2c8dad,null))['then'](function(_0x407c7b){if(_0x407c7b){_0x5f0fdc=_0x407c7b;_0x1c9be6[_0xa0fd('0x3c')]=_['keys'](db[_0xa0fd('0x93')][_0xa0fd('0x57')]);_0x1c9be6[_0xa0fd('0x3d')]=_[_0xa0fd('0x40')](_0x21c441[_0xa0fd('0x3d')]);_0x1c9be6[_0xa0fd('0x49')]=_[_0xa0fd('0x41')](_0x1c9be6[_0xa0fd('0x3c')],_0x1c9be6[_0xa0fd('0x3d')]);_0x20de77[_0xa0fd('0x42')]=_[_0xa0fd('0x41')](_0x1c9be6[_0xa0fd('0x3c')],qs[_0xa0fd('0x43')](_0x21c441[_0xa0fd('0x3d')][_0xa0fd('0x43')]));_0x20de77[_0xa0fd('0x42')]=_0x20de77[_0xa0fd('0x42')][_0xa0fd('0x44')]?_0x20de77[_0xa0fd('0x42')]:_0x1c9be6[_0xa0fd('0x3c')];_0x20de77[_0xa0fd('0x46')]=qs['sort'](_0x21c441[_0xa0fd('0x3d')]['sort']);_0x20de77[_0xa0fd('0x48')]=qs[_0xa0fd('0x49')](_[_0xa0fd('0x4a')](_0x21c441[_0xa0fd('0x3d')],_0x1c9be6[_0xa0fd('0x49')]));if(_0x21c441['query'][_0xa0fd('0x4f')]){_0x20de77[_0xa0fd('0x48')]=_[_0xa0fd('0x4d')](_0x20de77[_0xa0fd('0x48')],{'$or':_['map'](_0x20de77['attributes'],function(_0x3fdd39){var _0x16d814={};_0x16d814[_0x3fdd39]={'$like':'%'+_0x21c441[_0xa0fd('0x3d')]['filter']+'%'};return _0x16d814;})});}_0x20de77=_[_0xa0fd('0x4d')]({},_0x20de77,_0x21c441['options']);return _0x5f0fdc['getApplications'](_0x20de77);}})[_0xa0fd('0x1b')](function(_0x38d8e8){if(_0x38d8e8){_0x5cb1d9=_0x38d8e8['length'];if(!_0x21c441[_0xa0fd('0x3d')][_0xa0fd('0x45')]('nolimit')){_0x20de77['limit']=qs[_0xa0fd('0x2a')](_0x21c441[_0xa0fd('0x3d')]['limit']);_0x20de77[_0xa0fd('0x29')]=qs[_0xa0fd('0x29')](_0x21c441['query'][_0xa0fd('0x29')]);}return _0x5f0fdc[_0xa0fd('0x96')](_0x20de77);}})[_0xa0fd('0x1b')](function(_0x335b8c){if(_0x335b8c){return _0x335b8c?{'count':_0x5cb1d9,'rows':_0x335b8c}:null;}})[_0xa0fd('0x1b')](respondWithResult(_0x2c8dad,null))[_0xa0fd('0x59')](handleError(_0x2c8dad,null));};exports[_0xa0fd('0x97')]=function(_0x14050f,_0x2f4f39,_0xcc0edc){var _0x301bc0={'raw':!![],'where':{}};var _0x58e6a4={};var _0x37bca7={'count':0x0,'rows':[]};return db[_0xa0fd('0x3b')][_0xa0fd('0x63')]({'where':{'id':_0x14050f[_0xa0fd('0x5e')]['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x2f4f39,null))[_0xa0fd('0x1b')](function(_0x4c7175){if(_0x4c7175){_0x58e6a4['model']=_[_0xa0fd('0x40')](db[_0xa0fd('0x98')][_0xa0fd('0x57')]);_0x58e6a4[_0xa0fd('0x3d')]=_[_0xa0fd('0x40')](_0x14050f[_0xa0fd('0x3d')]);_0x58e6a4[_0xa0fd('0x49')]=_[_0xa0fd('0x41')](_0x58e6a4[_0xa0fd('0x3c')],_0x58e6a4[_0xa0fd('0x3d')]);_0x301bc0['attributes']=_['intersection'](_0x58e6a4[_0xa0fd('0x3c')],qs['fields'](_0x14050f[_0xa0fd('0x3d')]['fields']));_0x301bc0['attributes']=_0x301bc0[_0xa0fd('0x42')][_0xa0fd('0x44')]?_0x301bc0['attributes']:_0x58e6a4[_0xa0fd('0x3c')];if(!_0x14050f[_0xa0fd('0x3d')][_0xa0fd('0x45')](_0xa0fd('0x68'))){_0x301bc0['limit']=qs[_0xa0fd('0x2a')](_0x14050f['query']['limit']);_0x301bc0[_0xa0fd('0x29')]=qs[_0xa0fd('0x29')](_0x14050f[_0xa0fd('0x3d')][_0xa0fd('0x29')]);}_0x301bc0[_0xa0fd('0x46')]=qs[_0xa0fd('0x47')](_0x14050f[_0xa0fd('0x3d')][_0xa0fd('0x47')]);_0x301bc0[_0xa0fd('0x48')]=qs['filters'](_[_0xa0fd('0x4a')](_0x14050f['query'],_0x58e6a4[_0xa0fd('0x49')]));_0x301bc0['where'][_0xa0fd('0x5f')]=_0x4c7175['id'];if(_0x14050f[_0xa0fd('0x3d')][_0xa0fd('0x4f')]){_0x301bc0[_0xa0fd('0x48')]=_[_0xa0fd('0x4d')](_0x301bc0[_0xa0fd('0x48')],{'$or':_[_0xa0fd('0x4e')](_0x301bc0[_0xa0fd('0x42')],function(_0x15399c){var _0x4a12f1={};_0x4a12f1[_0x15399c]={'$like':'%'+_0x14050f[_0xa0fd('0x3d')][_0xa0fd('0x4f')]+'%'};return _0x4a12f1;})});}if(_0x14050f[_0xa0fd('0x3d')][_0xa0fd('0x99')]){var _0x2640f3=_0x14050f['query']['$gte'][_0xa0fd('0x9a')](',');var _0x350ea8={};_0x350ea8[_0x2640f3[0x0]]={'$gte':moment(_0x2640f3[0x1])[_0xa0fd('0x9b')](_0xa0fd('0x9c'))};_0x301bc0[_0xa0fd('0x48')]=_[_0xa0fd('0x4d')](_0x301bc0['where'],_0x350ea8);}_0x301bc0=_[_0xa0fd('0x4d')]({},_0x301bc0,_0x14050f[_0xa0fd('0x50')]);return db[_0xa0fd('0x98')][_0xa0fd('0x51')]({'where':_0x301bc0['where']})[_0xa0fd('0x1b')](function(_0x30b290){_0x37bca7[_0xa0fd('0x51')]=_0x30b290;if(_0x14050f[_0xa0fd('0x3d')][_0xa0fd('0x52')]){_0x301bc0['include']=[{'all':!![]}];}return db['MailMessage'][_0xa0fd('0x54')](_0x301bc0);})[_0xa0fd('0x1b')](function(_0x197742){_0x37bca7[_0xa0fd('0x55')]=_0x197742;return _0x37bca7;});}})['then'](respondWithFilteredResult(_0x2f4f39,_0x301bc0))[_0xa0fd('0x59')](handleError(_0x2f4f39,null));};exports[_0xa0fd('0x35')]=function(_0x17382b,_0x959c3,_0x346418){var _0x3d2d2d,_0x47f107={},_0x3fd75e;if(_0x17382b[_0xa0fd('0x5b')]['to']){_0x3fd75e=_0x17382b[_0xa0fd('0x5b')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xa0fd('0x58')]({'where':{'id':_0x17382b[_0xa0fd('0x5e')]['id']},'include':[{'model':db[_0xa0fd('0x9d')],'as':_0xa0fd('0x9e'),'include':[{'model':db[_0xa0fd('0x87')],'as':_0xa0fd('0x9f'),'where':{'email':_0x3fd75e},'limit':0x1,'order':[[_0xa0fd('0xa0'),_0xa0fd('0xa1')]]}]},{'model':db[_0xa0fd('0x39')],'as':'Smtp','raw':!![]}]})[_0xa0fd('0x1b')](handleEntityNotFound(_0x959c3,null))[_0xa0fd('0x1b')](function(_0x32c3c1){if(_0x32c3c1){_0x3d2d2d=_0x32c3c1;if(_0x32c3c1[_0xa0fd('0x3a')]){if(_[_0xa0fd('0x6c')](_0x17382b[_0xa0fd('0x5b')][_0xa0fd('0xa2')])){_0x17382b[_0xa0fd('0x5b')]['from']=util[_0xa0fd('0x9b')]('%s\x20<%s>',_0x32c3c1[_0xa0fd('0x34')],_0x32c3c1[_0xa0fd('0x6a')]||_0x32c3c1[_0xa0fd('0x3a')]['user']);}if(_0x17382b[_0xa0fd('0x5b')][_0xa0fd('0xa3')]&&_0x17382b[_0xa0fd('0x5b')][_0xa0fd('0xa3')][_0xa0fd('0x44')]){for(var _0x149193=0x0;_0x149193<_0x17382b['body'][_0xa0fd('0xa3')]['length'];_0x149193+=0x1){_0x17382b[_0xa0fd('0x5b')][_0xa0fd('0xa3')][_0x149193]={'filename':_0x17382b[_0xa0fd('0x5b')]['attachments'][_0x149193][_0xa0fd('0x34')],'path':path[_0xa0fd('0xa4')](config[_0xa0fd('0xa5')],_0xa0fd('0xa6'),_0x17382b[_0xa0fd('0x5b')][_0xa0fd('0xa3')][_0x149193][_0xa0fd('0xa7')])};}}var _0x69ec1b={'tls':{'rejectUnauthorized':![]}};if(_[_0xa0fd('0x6c')](_0x32c3c1[_0xa0fd('0x3a')][_0xa0fd('0xa8')])){if(_0x32c3c1[_0xa0fd('0x3a')][_0xa0fd('0x73')]){_0x69ec1b[_0xa0fd('0xa9')]={'user':_0x32c3c1[_0xa0fd('0x3a')][_0xa0fd('0x70')],'pass':_0x32c3c1['Smtp'][_0xa0fd('0x72')]};}_0x69ec1b['host']=_0x32c3c1[_0xa0fd('0x3a')][_0xa0fd('0x74')];_0x69ec1b[_0xa0fd('0x75')]=_0x32c3c1[_0xa0fd('0x3a')][_0xa0fd('0x75')];_0x69ec1b[_0xa0fd('0xaa')]=_0x32c3c1[_0xa0fd('0x3a')][_0xa0fd('0xaa')];}else{_0x69ec1b['service']=_0x32c3c1[_0xa0fd('0x3a')][_0xa0fd('0xa8')];_0x69ec1b['auth']={'user':_0x32c3c1[_0xa0fd('0x3a')][_0xa0fd('0x70')],'pass':_0x32c3c1[_0xa0fd('0x3a')][_0xa0fd('0x72')]};}return respondWithRpcPromise(_0xa0fd('0xab'),_0xa0fd('0xac'),{'account':_0x69ec1b,'message':_0x17382b[_0xa0fd('0x5b')]});}else{throw new Error('List\x20not\x20found');}}})[_0xa0fd('0x1b')](function(_0x5a7998){if(_0x5a7998){_0x47f107=_0x5a7998;if(_0x3d2d2d['List']){if(_0x3d2d2d[_0xa0fd('0x9e')][_0xa0fd('0x9f')][_0xa0fd('0x44')]){return _0x3d2d2d[_0xa0fd('0x9e')][_0xa0fd('0x9f')][0x0];}else{return db[_0xa0fd('0x87')][_0xa0fd('0x61')](_['defaults'](_0x17382b[_0xa0fd('0x5b')],{'firstName':_0x17382b['body']['to'],'email':_0x17382b[_0xa0fd('0x5b')]['to'],'phone':_0x17382b[_0xa0fd('0x5b')]['to'],'ListId':_0x3d2d2d[_0xa0fd('0x6b')]}));}}else{throw new Error(_0xa0fd('0xad'));}}})[_0xa0fd('0x1b')](function(_0x11db9b){if(_0x11db9b){var _0x3b943f={'UserId':_0x17382b[_0xa0fd('0x70')]['id'],'ContactId':_0x11db9b['id'],'MailAccountId':_0x3d2d2d['id'],'inReplyTo':_0x47f107[_0xa0fd('0xae')],'to':_0x17382b[_0xa0fd('0x5b')]['from'],'cc':_0x17382b[_0xa0fd('0x5b')]['cc'],'subject':_0x17382b['body'][_0xa0fd('0xaf')],'attach':_0x17382b['body'][_0xa0fd('0xb0')],'firstMsgDirection':_0xa0fd('0xb1'),'lastMsgAt':moment()[_0xa0fd('0x9b')](_0xa0fd('0x9c')),'lastMsgDirection':'out','lastMsgBody':_0x17382b['body']['body'],'Messages':[_[_0xa0fd('0x4d')](_0x17382b['body'],{'messageId':_0x47f107[_0xa0fd('0xae')],'sentAt':moment()[_0xa0fd('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3d2d2d['id'],'UserId':_0x17382b['user']['id'],'ContactId':_0x11db9b['id']})]};if(_0x17382b[_0xa0fd('0x5b')][_0xa0fd('0xb2')]){_0x3b943f=_[_0xa0fd('0x4d')](_0x3b943f,_0x17382b[_0xa0fd('0x5b')][_0xa0fd('0xb2')]);}return db[_0xa0fd('0x85')]['create'](_0x3b943f,{'include':[{'model':db['MailMessage'],'as':_0xa0fd('0xb3')}]});}})[_0xa0fd('0x1b')](respondWithResult(_0x959c3,null))[_0xa0fd('0x59')](handleError(_0x959c3,null));};exports[_0xa0fd('0xb4')]=function(_0x2a2aa0,_0x1f5b0d,_0x26b742){return db['MailAccount'][_0xa0fd('0x58')]({'where':{'id':_0x2a2aa0[_0xa0fd('0x5e')]['id']},'include':[{'model':db[_0xa0fd('0x39')],'as':_0xa0fd('0x3a'),'raw':!![]}]})['then'](handleEntityNotFound(_0x1f5b0d,null))[_0xa0fd('0x1b')](function(_0x144964){if(_0x144964&&_0x144964[_0xa0fd('0x3a')]){var _0x53fbe9={'id':_0x144964['id'],'tls':{'rejectUnauthorized':![]}};if(_0x144964[_0xa0fd('0x3a')]['service']){_0x53fbe9[_0xa0fd('0xa8')]=_0x144964[_0xa0fd('0x3a')][_0xa0fd('0xa8')];}else{_0x53fbe9['host']=_0x144964[_0xa0fd('0x3a')][_0xa0fd('0x74')];_0x53fbe9[_0xa0fd('0x75')]=_0x144964[_0xa0fd('0x3a')][_0xa0fd('0x75')];_0x53fbe9[_0xa0fd('0xaa')]=_0x144964[_0xa0fd('0x3a')][_0xa0fd('0xaa')];}if(_0x144964[_0xa0fd('0x3a')][_0xa0fd('0x73')]){_0x53fbe9['auth']={'user':_0x144964['Smtp'][_0xa0fd('0x70')],'pass':_0x144964[_0xa0fd('0x3a')][_0xa0fd('0x72')]};}return respondWithRpcPromise(_0xa0fd('0xb5'),'verifySmtp',{'account':_0x53fbe9});}})[_0xa0fd('0x1b')](respondWithResult(_0x1f5b0d,null))[_0xa0fd('0x59')](handleError(_0x1f5b0d,null));};exports['destroy']=function(_0x294c89,_0x1f1b74){return db[_0xa0fd('0x3b')][_0xa0fd('0x58')]({'where':{'id':_0x294c89['params']['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x1f1b74,null))[_0xa0fd('0x1b')](function(_0x59a1cf){if(_0x59a1cf&&_0x59a1cf[_0xa0fd('0xa8')]){throw new db[(_0xa0fd('0xb6'))]['ValidationError'](_0xa0fd('0xb7'));}return _0x59a1cf;})[_0xa0fd('0x1b')](removeEntity(_0x1f1b74,null))['catch'](handleError(_0x1f1b74,null));};exports[_0xa0fd('0xb8')]=function(_0x2e7180,_0x4982ba,_0x384f63){return db[_0xa0fd('0x3b')][_0xa0fd('0x58')]({'where':{'id':_0x2e7180[_0xa0fd('0x5e')]['id']}})[_0xa0fd('0x1b')](handleEntityNotFound(_0x4982ba,null))[_0xa0fd('0x1b')](function(_0x19c314){if(_0x19c314){return _0x19c314['addAgents'](_0x2e7180['body'][_0xa0fd('0x65')],_[_0xa0fd('0x86')](_0x2e7180[_0xa0fd('0x5b')],[_0xa0fd('0x65'),'id'])||{})['spread'](function(_0x378003){for(var _0x2ad7d5=0x0;_0x2ad7d5<_0x2e7180[_0xa0fd('0x5b')][_0xa0fd('0x65')][_0xa0fd('0x44')];_0x2ad7d5+=0x1){socket[_0xa0fd('0xb9')](_0xa0fd('0xba'),{'UserId':_0x2e7180['body'][_0xa0fd('0x65')][_0x2ad7d5],'MailAccountId':_0x2e7180[_0xa0fd('0x5e')]['id']});}return _0x378003;});}})[_0xa0fd('0x1b')](respondWithResult(_0x4982ba,null))[_0xa0fd('0x59')](handleError(_0x4982ba,null));};exports['removeAgents']=function(_0xf4360d,_0x1b70fd,_0xf4a001){var _0x339782;return db[_0xa0fd('0x3b')]['find']({'where':{'id':_0xf4360d[_0xa0fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1b70fd,null))[_0xa0fd('0x1b')](function(_0x281491){if(_0x281491){return _0x281491[_0xa0fd('0xbb')](_0xf4360d[_0xa0fd('0x3d')]['ids'])[_0xa0fd('0x1b')](function(_0x335476){if(_[_0xa0fd('0xbc')](_0xf4360d[_0xa0fd('0x3d')][_0xa0fd('0x65')])){for(var _0xcc8bff=0x0;_0xcc8bff<_0xf4360d[_0xa0fd('0x3d')][_0xa0fd('0x65')][_0xa0fd('0x44')];_0xcc8bff+=0x1){socket[_0xa0fd('0xb9')](_0xa0fd('0xbd'),{'UserId':_0xf4360d[_0xa0fd('0x3d')]['ids'][_0xcc8bff],'MailAccountId':_0xf4360d['params']['id']});}}else{socket[_0xa0fd('0xb9')](_0xa0fd('0xbd'),{'UserId':_0xf4360d[_0xa0fd('0x3d')][_0xa0fd('0x65')],'MailAccountId':_0xf4360d[_0xa0fd('0x5e')]['id']});}});}})[_0xa0fd('0x1b')](respondWithStatusCode(_0x1b70fd,null))[_0xa0fd('0x59')](handleError(_0x1b70fd,null));};exports['getAgents']=function(_0x2026a6,_0x4fb574,_0x22ec71){var _0x3bb4b8={};var _0x2f9201={};var _0x58661e;var _0x2f64e5;return db[_0xa0fd('0x3b')][_0xa0fd('0x63')]({'where':{'id':_0x2026a6['params']['id']}})['then'](handleEntityNotFound(_0x4fb574,null))['then'](function(_0x3d29d2){if(_0x3d29d2){_0x58661e=_0x3d29d2;_0x2f9201['model']=_['keys'](db[_0xa0fd('0x89')]['rawAttributes']);_0x2f9201[_0xa0fd('0x3d')]=_[_0xa0fd('0x40')](_0x2026a6[_0xa0fd('0x3d')]);_0x2f9201[_0xa0fd('0x49')]=_[_0xa0fd('0x41')](_0x2f9201[_0xa0fd('0x3c')],_0x2f9201[_0xa0fd('0x3d')]);_0x3bb4b8[_0xa0fd('0x42')]=_[_0xa0fd('0x41')](_0x2f9201[_0xa0fd('0x3c')],qs['fields'](_0x2026a6[_0xa0fd('0x3d')][_0xa0fd('0x43')]));_0x3bb4b8[_0xa0fd('0x42')]=_0x3bb4b8['attributes'][_0xa0fd('0x44')]?_0x3bb4b8[_0xa0fd('0x42')]:_0x2f9201['model'];_0x3bb4b8['order']=qs['sort'](_0x2026a6[_0xa0fd('0x3d')][_0xa0fd('0x47')]);_0x3bb4b8[_0xa0fd('0x48')]=qs[_0xa0fd('0x49')](_[_0xa0fd('0x4a')](_0x2026a6[_0xa0fd('0x3d')],_0x2f9201[_0xa0fd('0x49')]));if(_0x2026a6[_0xa0fd('0x3d')][_0xa0fd('0x4f')]){_0x3bb4b8[_0xa0fd('0x48')]=_[_0xa0fd('0x4d')](_0x3bb4b8[_0xa0fd('0x48')],{'$or':_['map'](_0x3bb4b8[_0xa0fd('0x42')],function(_0x1d0ac4){var _0x41ee17={};_0x41ee17[_0x1d0ac4]={'$like':'%'+_0x2026a6[_0xa0fd('0x3d')][_0xa0fd('0x4f')]+'%'};return _0x41ee17;})});}_0x3bb4b8=_['merge']({},_0x3bb4b8,_0x2026a6[_0xa0fd('0x50')]);return _0x58661e[_0xa0fd('0xbe')](_0x3bb4b8);}})[_0xa0fd('0x1b')](function(_0x4b9a25){if(_0x4b9a25){_0x2f64e5=_0x4b9a25[_0xa0fd('0x44')];if(!_0x2026a6['query']['hasOwnProperty'](_0xa0fd('0x68'))){_0x3bb4b8[_0xa0fd('0x2a')]=qs[_0xa0fd('0x2a')](_0x2026a6[_0xa0fd('0x3d')]['limit']);_0x3bb4b8[_0xa0fd('0x29')]=qs[_0xa0fd('0x29')](_0x2026a6['query'][_0xa0fd('0x29')]);}return _0x58661e[_0xa0fd('0xbe')](_0x3bb4b8);}})[_0xa0fd('0x1b')](function(_0x1773f8){if(_0x1773f8){return _0x1773f8?{'count':_0x2f64e5,'rows':_0x1773f8}:null;}})[_0xa0fd('0x1b')](respondWithResult(_0x4fb574,null))[_0xa0fd('0x59')](handleError(_0x4fb574,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9d63b12..e4b233a 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 _0x29ba=['hook','exports','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x29ba,0xda));var _0xa29b=function(_0x80bea0,_0x4c30f4){_0x80bea0=_0x80bea0-0x0;var _0x50fb90=_0x29ba[_0x80bea0];return _0x50fb90;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xa29b('0x0'))['db'][_0xa29b('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa29b('0x2')](0x0);var events={'afterCreate':_0xa29b('0x3'),'afterUpdate':_0xa29b('0x4'),'afterDestroy':_0xa29b('0x5')};function emitEvent(_0x36b7ab){return function(_0x429cc1,_0x46ea31,_0x22daa7){MailAccountEvents[_0xa29b('0x6')](_0x36b7ab+':'+_0x429cc1['id'],_0x429cc1);MailAccountEvents[_0xa29b('0x6')](_0x36b7ab,_0x429cc1);_0x22daa7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xa29b('0x7')](e,emitEvent(event));}}module[_0xa29b('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x8dfb=['events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x57966a,_0x477964){var _0x191765=function(_0x106a01){while(--_0x106a01){_0x57966a['push'](_0x57966a['shift']());}};_0x191765(++_0x477964);}(_0x8dfb,0x1e6));var _0xb8df=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x8dfb[_0xe501ff];return _0x17135d;};'use strict';var EventEmitter=require(_0xb8df('0x0'));var MailAccount=require(_0xb8df('0x1'))['db'][_0xb8df('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb8df('0x3')](0x0);var events={'afterCreate':_0xb8df('0x4'),'afterUpdate':'update','afterDestroy':_0xb8df('0x5')};function emitEvent(_0x3ee2c8){return function(_0x54b61e,_0x2f3fc0,_0xf36c8d){MailAccountEvents[_0xb8df('0x6')](_0x3ee2c8+':'+_0x54b61e['id'],_0x54b61e);MailAccountEvents[_0xb8df('0x6')](_0x3ee2c8,_0x54b61e);_0xf36c8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xb8df('0x7')](e,emitEvent(event));}}module[_0xb8df('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f07c991..4093e4b 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 _0x53a8=['../../config/logger','api','moment','bluebird','request-promise','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x53a8,0x175));var _0x853a=function(_0x4a9a95,_0x55ea4a){_0x4a9a95=_0x4a9a95-0x0;var _0x1eff22=_0x53a8[_0x4a9a95];return _0x1eff22;};'use strict';var _=require('lodash');var util=require(_0x853a('0x0'));var logger=require(_0x853a('0x1'))(_0x853a('0x2'));var moment=require(_0x853a('0x3'));var BPromise=require(_0x853a('0x4'));var rp=require(_0x853a('0x5'));var attributes=require(_0x853a('0x6'));module[_0x853a('0x7')]=function(_0x445654,_0x254af0){return _0x445654[_0x853a('0x8')](_0x853a('0x9'),attributes,{'tableName':_0x853a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd36=['util','../../config/logger','api','moment','./mailAccount.attributes','define','MailAccount','lodash'];(function(_0x1aa656,_0x262cec){var _0x1f427b=function(_0x59d790){while(--_0x59d790){_0x1aa656['push'](_0x1aa656['shift']());}};_0x1f427b(++_0x262cec);}(_0xcd36,0x14f));var _0x6cd3=function(_0x189668,_0x8cb536){_0x189668=_0x189668-0x0;var _0x2fdaa7=_0xcd36[_0x189668];return _0x2fdaa7;};'use strict';var _=require(_0x6cd3('0x0'));var util=require(_0x6cd3('0x1'));var logger=require(_0x6cd3('0x2'))(_0x6cd3('0x3'));var moment=require(_0x6cd3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x6cd3('0x5'));module['exports']=function(_0x4a91b8,_0x1506d8){return _0x4a91b8[_0x6cd3('0x6')](_0x6cd3('0x7'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index ea06d65..e42c606 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 _0x9cac=['User','name','unshift','waitForTheAssignedAgent','Start','startRouting','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowMailAccount','find','NotifyMailAccount','body','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','List\x20not\x20found','contact','messageId','subject','MailInteraction','Messages','inReplyTo','create','spread','update','attach','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','attachments','originTo','bcc','Attachment','Attachments','UserId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9cac,0xd8));var _0xc9ca=function(_0x4803e6,_0x470a5c){_0x4803e6=_0x4803e6-0x0;var _0x32c793=_0x9cac[_0x4803e6];return _0x32c793;};'use strict';var _=require('lodash');var util=require(_0xc9ca('0x0'));var moment=require(_0xc9ca('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9ca('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc9ca('0x3'))(_0xc9ca('0x4'));var config=require(_0xc9ca('0x5'));var jayson=require(_0xc9ca('0x6'));var client=jayson[_0xc9ca('0x7')][_0xc9ca('0x8')]({'port':0x232c});config[_0xc9ca('0x9')]=_[_0xc9ca('0xa')](config[_0xc9ca('0x9')],{'host':_0xc9ca('0xb'),'port':0x18eb});var socket=require(_0xc9ca('0xc'))(new Redis(config['redis']));require(_0xc9ca('0xd'))[_0xc9ca('0xe')](socket);function respondWithRpcPromise(_0x32bbbe,_0x72c029,_0x3b1436){return new BPromise(function(_0x11480c,_0x22404e){return client[_0xc9ca('0xf')](_0x32bbbe,_0x3b1436)['then'](function(_0x447ea7){logger[_0xc9ca('0x10')]('MailAccount,\x20%s,\x20%s',_0x72c029,'request\x20sent');logger[_0xc9ca('0x11')](_0xc9ca('0x12'),_0x72c029,_0xc9ca('0x13'),JSON[_0xc9ca('0x14')](_0x447ea7));if(_0x447ea7['error']){if(_0x447ea7[_0xc9ca('0x15')][_0xc9ca('0x16')]===0x1f4){logger[_0xc9ca('0x15')](_0xc9ca('0x17'),_0x72c029,_0x447ea7[_0xc9ca('0x15')][_0xc9ca('0x18')]);return _0x22404e(_0x447ea7[_0xc9ca('0x15')][_0xc9ca('0x18')]);}logger['error'](_0xc9ca('0x17'),_0x72c029,_0x447ea7[_0xc9ca('0x15')][_0xc9ca('0x18')]);return _0x11480c(_0x447ea7[_0xc9ca('0x15')][_0xc9ca('0x18')]);}else{logger[_0xc9ca('0x10')](_0xc9ca('0x17'),_0x72c029,_0xc9ca('0x13'));_0x11480c(_0x447ea7[_0xc9ca('0x19')][_0xc9ca('0x18')]);}})[_0xc9ca('0x1a')](function(_0x55e04f){logger['error'](_0xc9ca('0x17'),_0x72c029,_0x55e04f);_0x22404e(_0x55e04f);});});}exports[_0xc9ca('0x1b')]=function(_0xc5a8d2){var _0x40a39e=this;return new Promise(function(_0x45b520,_0x56c730){return db[_0xc9ca('0x1c')][_0xc9ca('0x1d')]({'raw':_0xc5a8d2['options']?_0xc5a8d2[_0xc9ca('0x1e')][_0xc9ca('0x1f')]===undefined?!![]:![]:!![],'where':_0xc5a8d2[_0xc9ca('0x1e')]?_0xc5a8d2[_0xc9ca('0x1e')][_0xc9ca('0x20')]||null:null,'attributes':_0xc5a8d2[_0xc9ca('0x1e')]?_0xc5a8d2[_0xc9ca('0x1e')][_0xc9ca('0x21')]||null:null,'limit':_0xc5a8d2[_0xc9ca('0x1e')]?_0xc5a8d2[_0xc9ca('0x1e')][_0xc9ca('0x22')]||null:null,'include':_0xc5a8d2[_0xc9ca('0x1e')]?_0xc5a8d2[_0xc9ca('0x1e')]['include']?_[_0xc9ca('0x23')](_0xc5a8d2['options'][_0xc9ca('0x24')],function(_0x500f47){return{'model':db[_0x500f47[_0xc9ca('0x25')]],'as':_0x500f47['as'],'attributes':_0x500f47[_0xc9ca('0x21')],'include':_0x500f47['include']?_[_0xc9ca('0x23')](_0x500f47[_0xc9ca('0x24')],function(_0x4ede2a){return{'model':db[_0x4ede2a[_0xc9ca('0x25')]],'as':_0x4ede2a['as'],'attributes':_0x4ede2a[_0xc9ca('0x21')],'include':_0x4ede2a[_0xc9ca('0x24')]?_[_0xc9ca('0x23')](_0x4ede2a[_0xc9ca('0x24')],function(_0x16a10c){return{'model':db[_0x16a10c[_0xc9ca('0x25')]],'as':_0x16a10c['as'],'attributes':_0x16a10c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9ca('0x26')](function(_0x4815fe){logger[_0xc9ca('0x10')]('GetMailAccount',_0xc5a8d2);logger[_0xc9ca('0x11')](_0xc9ca('0x1b'),_0xc5a8d2,JSON[_0xc9ca('0x14')](_0x4815fe));_0x45b520(_0x4815fe);})[_0xc9ca('0x1a')](function(_0x168f38){logger[_0xc9ca('0x15')](_0xc9ca('0x1b'),_0x168f38[_0xc9ca('0x18')],_0xc5a8d2);_0x56c730(_0x40a39e[_0xc9ca('0x15')](0x1f4,_0x168f38[_0xc9ca('0x18')]));});});};exports[_0xc9ca('0x27')]=function(_0x4bda82){var _0x3d3ab=this;return new Promise(function(_0x100f45,_0x1b6aac){return db['MailAccount'][_0xc9ca('0x28')]({'raw':_0x4bda82[_0xc9ca('0x1e')]?_0x4bda82['options'][_0xc9ca('0x1f')]===undefined?!![]:![]:!![],'where':_0x4bda82[_0xc9ca('0x1e')]?_0x4bda82['options'][_0xc9ca('0x20')]||null:null,'attributes':_0x4bda82[_0xc9ca('0x1e')]?_0x4bda82['options']['attributes']||null:null,'include':_0x4bda82['options']?_0x4bda82[_0xc9ca('0x1e')][_0xc9ca('0x24')]?_[_0xc9ca('0x23')](_0x4bda82['options'][_0xc9ca('0x24')],function(_0x338226){return{'model':db[_0x338226[_0xc9ca('0x25')]],'as':_0x338226['as'],'attributes':_0x338226['attributes'],'include':_0x338226[_0xc9ca('0x24')]?_['map'](_0x338226[_0xc9ca('0x24')],function(_0x935052){return{'model':db[_0x935052[_0xc9ca('0x25')]],'as':_0x935052['as'],'attributes':_0x935052[_0xc9ca('0x21')],'include':_0x935052[_0xc9ca('0x24')]?_['map'](_0x935052[_0xc9ca('0x24')],function(_0x322987){return{'model':db[_0x322987['model']],'as':_0x322987['as'],'attributes':_0x322987[_0xc9ca('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc9ca('0x26')](function(_0x53e747){logger['info'](_0xc9ca('0x27'),_0x4bda82);logger[_0xc9ca('0x11')](_0xc9ca('0x27'),_0x4bda82,JSON[_0xc9ca('0x14')](_0x53e747));_0x100f45(_0x53e747);})[_0xc9ca('0x1a')](function(_0x55f129){logger[_0xc9ca('0x15')](_0xc9ca('0x27'),_0x55f129[_0xc9ca('0x18')],_0x4bda82);_0x1b6aac(_0x3d3ab[_0xc9ca('0x15')](0x1f4,_0x55f129[_0xc9ca('0x18')]));});});};exports[_0xc9ca('0x29')]=function(_0x57967d){var _0x5233b4=this;return new Promise(function(_0x1a07e0,_0x59c5cb){var _0x2deafb={'body':_0x57967d[_0xc9ca('0x2a')],'channel':'mail'};var _0x460524=_[_0xc9ca('0x2b')](_[_0xc9ca('0x2c')](db['CmContact'][_0xc9ca('0x2d')]),[_0xc9ca('0x2e'),_0xc9ca('0x2f'),_0xc9ca('0x30'),'ListId']);var _0x553151=![];if(_0x57967d[_0xc9ca('0x2a')]['id']){delete _0x57967d[_0xc9ca('0x2a')]['id'];}if(_[_0xc9ca('0x31')](_0x57967d['body'][_0xc9ca('0x32')])){return _0x59c5cb(_0x5233b4[_0xc9ca('0x15')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xc9ca('0x31')](_0x57967d['body'][_0xc9ca('0x2a')])||_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x2a')]===''){return _0x59c5cb(_0x5233b4[_0xc9ca('0x15')](0x1f4,_0xc9ca('0x33')));}if(_[_0xc9ca('0x31')](_0x57967d[_0xc9ca('0x2a')]['mapKey'])){return _0x59c5cb(_0x5233b4[_0xc9ca('0x15')](0x1f4,_0xc9ca('0x34')+_0x460524));}if(!_[_0xc9ca('0x35')](_0x460524,_0x57967d['body'][_0xc9ca('0x36')])){return _0x59c5cb(_0x5233b4[_0xc9ca('0x15')](0x1f4,_0xc9ca('0x37')+_0x460524));}var _0xfa8f5e={};_0xfa8f5e[_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x36')]]=_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x32')];return db[_0xc9ca('0x1c')]['find']({'where':{'id':_0x57967d[_0xc9ca('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0xc9ca('0x39'),'include':[{'model':db[_0xc9ca('0x3a')],'as':_0xc9ca('0x3b'),'where':_0xfa8f5e,'limit':0x1,'order':[[_0xc9ca('0x2f'),_0xc9ca('0x3c')]]}]},{'model':db[_0xc9ca('0x3d')],'as':_0xc9ca('0x3e')},{'model':db[_0xc9ca('0x3f')],'as':_0xc9ca('0x40')}]})[_0xc9ca('0x26')](function(_0x971faf){if(_0x971faf&&_0x971faf[_0xc9ca('0x39')]){var _0x67dee7=_0x971faf[_0xc9ca('0x41')]({'plain':!![]});_0x2deafb[_0xc9ca('0x38')]=_[_0xc9ca('0x42')](_0x67dee7,[_0xc9ca('0x3e'),_0xc9ca('0x39')]);_0x2deafb[_0xc9ca('0x43')]=_0x67dee7['Applications'];_0x2deafb[_0xc9ca('0x44')]=_0x67dee7[_0xc9ca('0x39')];_0x2deafb[_0xc9ca('0x43')]=_[_0xc9ca('0x45')](_0x2deafb[_0xc9ca('0x43')],[_0xc9ca('0x46')],[_0xc9ca('0x47')]);if(_0x2deafb[_0xc9ca('0x38')]&&_0x2deafb[_0xc9ca('0x38')]['autoclose']){_0x2deafb[_0xc9ca('0x43')][_0xc9ca('0x48')]({'id':0x0,'priority':_0x2deafb[_0xc9ca('0x43')][_0xc9ca('0x49')]+0x1,'app':_0xc9ca('0x4a'),'appdata':_0xc9ca('0x4b'),'interval':_0xc9ca('0x4c')});}if(_0x2deafb[_0xc9ca('0x38')]['Applications']){delete _0x2deafb['account']['Applications'];}if(_0x2deafb[_0xc9ca('0x38')][_0xc9ca('0x39')]){delete _0x2deafb['account']['List'];}if(_0x67dee7['List'][_0xc9ca('0x3b')][_0xc9ca('0x49')]){return _0x67dee7[_0xc9ca('0x39')][_0xc9ca('0x3b')][0x0];}var _0x3c998b=_[_0xc9ca('0xa')](_0x57967d[_0xc9ca('0x2a')],{'firstName':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x32')],'ListId':_0x67dee7['ListId']});_0x3c998b[_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x36')]]=_0x57967d[_0xc9ca('0x2a')]['from'];return db[_0xc9ca('0x3a')]['create'](_0x3c998b);}else{throw new Error(_0xc9ca('0x4d'));}})[_0xc9ca('0x26')](function(_0x57bcdf){_0x2deafb[_0xc9ca('0x4e')]=_0x57bcdf;if(_0x57bcdf){if(!_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')][_0xc9ca('0x4f')]){_0x57967d['body']['message'][_0xc9ca('0x4f')]=rs['generate']()+'\x20'+_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')]['from'];}var _0x447646={'ContactId':_0x57bcdf['id'],'MailAccountId':_0x57967d[_0xc9ca('0x38')]['id'],'inReplyTo':_0x57967d['body'][_0xc9ca('0x18')][_0xc9ca('0x4f')],'to':_0x57967d['body'][_0xc9ca('0x18')][_0xc9ca('0x32')],'cc':_0x57967d['body'][_0xc9ca('0x18')]['cc'],'subject':_0x57967d[_0xc9ca('0x2a')]['message'][_0xc9ca('0x50')],'attach':_0x57967d['body'][_0xc9ca('0x18')]['attach'],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x57967d[_0xc9ca('0x2a')]['body']};return db[_0xc9ca('0x51')][_0xc9ca('0x28')]({'where':{'closed':![],'MailAccountId':_0x57967d[_0xc9ca('0x38')]['id']},'include':[{'model':db['MailMessage'],'as':_0xc9ca('0x52'),'attributes':[_0xc9ca('0x4f')],'where':{'messageId':_0x57967d[_0xc9ca('0x2a')]['message'][_0xc9ca('0x53')]}}]})[_0xc9ca('0x26')](function(_0x2a87ff){if(_0x2a87ff){return[_0x2a87ff,![]];}return db[_0xc9ca('0x51')][_0xc9ca('0x54')](_0x447646)[_0xc9ca('0x26')](function(_0x5a3c42){return[_0x5a3c42,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc9ca('0x55')](function(_0x32a51e,_0x43eb36){if(_0x32a51e){_0x553151=_0x43eb36;if(!_0x43eb36){return _0x32a51e[_0xc9ca('0x56')]({'inReplyTo':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')][_0xc9ca('0x4f')],'to':_0x57967d['body'][_0xc9ca('0x18')][_0xc9ca('0x32')],'cc':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')]['cc'],'subject':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')][_0xc9ca('0x50')],'attach':_0x32a51e['attach']?_0x32a51e[_0xc9ca('0x57')]:_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')][_0xc9ca('0x57')],'substatus':null,'substatusAt':moment()[_0xc9ca('0x58')](_0xc9ca('0x59')),'lastMsgAt':moment()['format'](_0xc9ca('0x59')),'lastMsgDirection':'in','lastMsgBody':_0x57967d[_0xc9ca('0x2a')]['body']});}else{return _0x32a51e;}}})[_0xc9ca('0x26')](function(_0x22ab10){_0x2deafb[_0xc9ca('0x5a')]=_0x22ab10[_0xc9ca('0x41')]({'plain':!![]});_0x2deafb[_0xc9ca('0x5a')][_0xc9ca('0x5b')]=_0x553151;return db[_0xc9ca('0x5c')]['create']({'body':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x2a')],'MailAccountId':_0x57967d[_0xc9ca('0x38')]['id'],'MailInteractionId':_0x22ab10['id'],'direction':'in','ContactId':_0x2deafb[_0xc9ca('0x4e')]['id'],'messageId':_0x57967d['body'][_0xc9ca('0x18')]['messageId'],'from':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')][_0xc9ca('0x32')],'to':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')]['to'],'cc':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')]['cc'],'subject':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')][_0xc9ca('0x50')],'attach':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')][_0xc9ca('0x57')],'Attachments':_0x57967d['body'][_0xc9ca('0x18')][_0xc9ca('0x5d')],'originTo':_0x57967d['body'][_0xc9ca('0x18')][_0xc9ca('0x5e')],'originCc':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')]['originCc'],'bcc':_0x57967d[_0xc9ca('0x2a')][_0xc9ca('0x18')][_0xc9ca('0x5f')]},{'include':[{'model':db[_0xc9ca('0x60')],'as':_0xc9ca('0x61')}]});})[_0xc9ca('0x26')](function(_0x2f0ed6){_0x2deafb[_0xc9ca('0x18')]=_0x2f0ed6;if(_0x2deafb['interaction'][_0xc9ca('0x62')]){return db[_0xc9ca('0x63')][_0xc9ca('0x28')]({'attributes':['id',_0xc9ca('0x64')],'where':{'id':_0x2deafb[_0xc9ca('0x5a')][_0xc9ca('0x62')]}})[_0xc9ca('0x26')](function(_0x3dd3ad){if(_0x3dd3ad){_0x2deafb['applications'][_0xc9ca('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3dd3ad[_0xc9ca('0x64')]+','+(_0x2deafb[_0xc9ca('0x38')][_0xc9ca('0x66')]||0xa),'interval':_0xc9ca('0x4c')});}return respondWithRpcPromise(_0xc9ca('0x67'),_0xc9ca('0x68'),_0x2deafb);});}return respondWithRpcPromise('Start',_0xc9ca('0x68'),_0x2deafb);})[_0xc9ca('0x26')](function(_0x3273dd){_0x1a07e0(_0x3273dd);})['catch'](function(_0x38ef22){_0x59c5cb(_0x5233b4['error'](0x1f4,_0x38ef22[_0xc9ca('0x18')]));});});}; \ No newline at end of file +var _0x7d8a=['MailAccount,\x20%s,\x20%s','message','catch','GetMailAccount','findAll','options','raw','where','attributes','include','model','map','ShowMailAccount','MailAccount','find','body','mail','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','omit','applications','list','orderBy','priority','asc','account','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','subject','attach','format','interaction','get','created','originTo','originCc','bcc','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xb7b354,_0x338a3d){var _0x3150d2=function(_0x4fa1ad){while(--_0x4fa1ad){_0xb7b354['push'](_0xb7b354['shift']());}};_0x3150d2(++_0x338a3d);}(_0x7d8a,0xb6));var _0xa7d8=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x7d8a[_0x2c1dcd];return _0x158ce5;};'use strict';var _=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var moment=require(_0xa7d8('0x2'));var BPromise=require('bluebird');var rs=require(_0xa7d8('0x3'));var fs=require('fs');var Redis=require(_0xa7d8('0x4'));var db=require(_0xa7d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7d8('0x6'))(_0xa7d8('0x7'));var config=require('../../config/environment');var jayson=require(_0xa7d8('0x8'));var client=jayson[_0xa7d8('0x9')][_0xa7d8('0xa')]({'port':0x232c});config['redis']=_[_0xa7d8('0xb')](config[_0xa7d8('0xc')],{'host':_0xa7d8('0xd'),'port':0x18eb});var socket=require(_0xa7d8('0xe'))(new Redis(config[_0xa7d8('0xc')]));require(_0xa7d8('0xf'))[_0xa7d8('0x10')](socket);function respondWithRpcPromise(_0x2e7edc,_0xcf6c4c,_0x28ff7e){return new BPromise(function(_0x5d63ea,_0x24682c){return client[_0xa7d8('0x11')](_0x2e7edc,_0x28ff7e)[_0xa7d8('0x12')](function(_0x238155){logger[_0xa7d8('0x13')]('MailAccount,\x20%s,\x20%s',_0xcf6c4c,'request\x20sent');logger[_0xa7d8('0x14')](_0xa7d8('0x15'),_0xcf6c4c,_0xa7d8('0x16'),JSON[_0xa7d8('0x17')](_0x238155));if(_0x238155[_0xa7d8('0x18')]){if(_0x238155[_0xa7d8('0x18')][_0xa7d8('0x19')]===0x1f4){logger['error'](_0xa7d8('0x1a'),_0xcf6c4c,_0x238155[_0xa7d8('0x18')][_0xa7d8('0x1b')]);return _0x24682c(_0x238155[_0xa7d8('0x18')][_0xa7d8('0x1b')]);}logger[_0xa7d8('0x18')](_0xa7d8('0x1a'),_0xcf6c4c,_0x238155[_0xa7d8('0x18')][_0xa7d8('0x1b')]);return _0x5d63ea(_0x238155[_0xa7d8('0x18')][_0xa7d8('0x1b')]);}else{logger[_0xa7d8('0x13')]('MailAccount,\x20%s,\x20%s',_0xcf6c4c,_0xa7d8('0x16'));_0x5d63ea(_0x238155['result'][_0xa7d8('0x1b')]);}})[_0xa7d8('0x1c')](function(_0x3f91c4){logger[_0xa7d8('0x18')](_0xa7d8('0x1a'),_0xcf6c4c,_0x3f91c4);_0x24682c(_0x3f91c4);});});}exports[_0xa7d8('0x1d')]=function(_0x25b8a2){var _0x1cf7e2=this;return new Promise(function(_0x29b5d4,_0x2e513f){return db['MailAccount'][_0xa7d8('0x1e')]({'raw':_0x25b8a2['options']?_0x25b8a2[_0xa7d8('0x1f')][_0xa7d8('0x20')]===undefined?!![]:![]:!![],'where':_0x25b8a2[_0xa7d8('0x1f')]?_0x25b8a2[_0xa7d8('0x1f')][_0xa7d8('0x21')]||null:null,'attributes':_0x25b8a2['options']?_0x25b8a2[_0xa7d8('0x1f')][_0xa7d8('0x22')]||null:null,'limit':_0x25b8a2[_0xa7d8('0x1f')]?_0x25b8a2[_0xa7d8('0x1f')]['limit']||null:null,'include':_0x25b8a2['options']?_0x25b8a2[_0xa7d8('0x1f')][_0xa7d8('0x23')]?_['map'](_0x25b8a2[_0xa7d8('0x1f')]['include'],function(_0x3f45f4){return{'model':db[_0x3f45f4[_0xa7d8('0x24')]],'as':_0x3f45f4['as'],'attributes':_0x3f45f4[_0xa7d8('0x22')],'include':_0x3f45f4['include']?_[_0xa7d8('0x25')](_0x3f45f4[_0xa7d8('0x23')],function(_0x4dd218){return{'model':db[_0x4dd218[_0xa7d8('0x24')]],'as':_0x4dd218['as'],'attributes':_0x4dd218[_0xa7d8('0x22')],'include':_0x4dd218[_0xa7d8('0x23')]?_[_0xa7d8('0x25')](_0x4dd218[_0xa7d8('0x23')],function(_0x50196d){return{'model':db[_0x50196d['model']],'as':_0x50196d['as'],'attributes':_0x50196d[_0xa7d8('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa7d8('0x12')](function(_0x559237){logger[_0xa7d8('0x13')](_0xa7d8('0x1d'),_0x25b8a2);logger[_0xa7d8('0x14')](_0xa7d8('0x1d'),_0x25b8a2,JSON['stringify'](_0x559237));_0x29b5d4(_0x559237);})[_0xa7d8('0x1c')](function(_0x4e8876){logger['error'](_0xa7d8('0x1d'),_0x4e8876[_0xa7d8('0x1b')],_0x25b8a2);_0x2e513f(_0x1cf7e2[_0xa7d8('0x18')](0x1f4,_0x4e8876['message']));});});};exports[_0xa7d8('0x26')]=function(_0x4d0275){var _0x27f7f8=this;return new Promise(function(_0x47fd8c,_0x5286a5){return db[_0xa7d8('0x27')][_0xa7d8('0x28')]({'raw':_0x4d0275[_0xa7d8('0x1f')]?_0x4d0275['options'][_0xa7d8('0x20')]===undefined?!![]:![]:!![],'where':_0x4d0275[_0xa7d8('0x1f')]?_0x4d0275[_0xa7d8('0x1f')]['where']||null:null,'attributes':_0x4d0275[_0xa7d8('0x1f')]?_0x4d0275[_0xa7d8('0x1f')][_0xa7d8('0x22')]||null:null,'include':_0x4d0275[_0xa7d8('0x1f')]?_0x4d0275[_0xa7d8('0x1f')][_0xa7d8('0x23')]?_[_0xa7d8('0x25')](_0x4d0275[_0xa7d8('0x1f')][_0xa7d8('0x23')],function(_0x3294e1){return{'model':db[_0x3294e1['model']],'as':_0x3294e1['as'],'attributes':_0x3294e1[_0xa7d8('0x22')],'include':_0x3294e1[_0xa7d8('0x23')]?_['map'](_0x3294e1['include'],function(_0x513e71){return{'model':db[_0x513e71[_0xa7d8('0x24')]],'as':_0x513e71['as'],'attributes':_0x513e71[_0xa7d8('0x22')],'include':_0x513e71[_0xa7d8('0x23')]?_['map'](_0x513e71[_0xa7d8('0x23')],function(_0x20bebd){return{'model':db[_0x20bebd[_0xa7d8('0x24')]],'as':_0x20bebd['as'],'attributes':_0x20bebd[_0xa7d8('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa7d8('0x12')](function(_0x3472ea){logger[_0xa7d8('0x13')]('ShowMailAccount',_0x4d0275);logger[_0xa7d8('0x14')](_0xa7d8('0x26'),_0x4d0275,JSON[_0xa7d8('0x17')](_0x3472ea));_0x47fd8c(_0x3472ea);})['catch'](function(_0x303418){logger['error'](_0xa7d8('0x26'),_0x303418['message'],_0x4d0275);_0x5286a5(_0x27f7f8[_0xa7d8('0x18')](0x1f4,_0x303418[_0xa7d8('0x1b')]));});});};exports['NotifyMailAccount']=function(_0x1fbdaf){var _0x5c760c=this;return new Promise(function(_0x16cf61,_0x1692e1){var _0x1a9fc6={'body':_0x1fbdaf[_0xa7d8('0x29')],'channel':_0xa7d8('0x2a')};var _0x1ae683=_['difference'](_[_0xa7d8('0x2b')](db[_0xa7d8('0x2c')][_0xa7d8('0x2d')]),['createdAt',_0xa7d8('0x2e'),_0xa7d8('0x2f'),_0xa7d8('0x30')]);var _0x9cb9be=![];if(_0x1fbdaf[_0xa7d8('0x29')]['id']){delete _0x1fbdaf[_0xa7d8('0x29')]['id'];}if(_['isNil'](_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x31')])){return _0x1692e1(_0x5c760c[_0xa7d8('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa7d8('0x32')](_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x29')])||_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x29')]===''){return _0x1692e1(_0x5c760c['error'](0x1f4,_0xa7d8('0x33')));}if(_[_0xa7d8('0x32')](_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x34')])){return _0x1692e1(_0x5c760c['error'](0x1f4,_0xa7d8('0x35')+_0x1ae683));}if(!_['includes'](_0x1ae683,_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x34')])){return _0x1692e1(_0x5c760c[_0xa7d8('0x18')](0x1f4,_0xa7d8('0x36')+_0x1ae683));}var _0x19707a={};_0x19707a[_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x34')]]=_0x1fbdaf[_0xa7d8('0x29')]['from'];return db['MailAccount'][_0xa7d8('0x28')]({'where':{'id':_0x1fbdaf['account']['id']},'include':[{'model':db[_0xa7d8('0x37')],'as':_0xa7d8('0x38'),'include':[{'model':db[_0xa7d8('0x2c')],'as':_0xa7d8('0x39'),'where':_0x19707a,'limit':0x1,'order':[[_0xa7d8('0x2e'),_0xa7d8('0x3a')]]}]},{'model':db[_0xa7d8('0x3b')],'as':_0xa7d8('0x3c')},{'model':db[_0xa7d8('0x3d')],'as':_0xa7d8('0x3e')}]})[_0xa7d8('0x12')](function(_0x30226d){if(_0x30226d&&_0x30226d['List']){var _0x7cebfd=_0x30226d['get']({'plain':!![]});_0x1a9fc6['account']=_[_0xa7d8('0x3f')](_0x7cebfd,[_0xa7d8('0x3c'),_0xa7d8('0x38')]);_0x1a9fc6[_0xa7d8('0x40')]=_0x7cebfd[_0xa7d8('0x3c')];_0x1a9fc6[_0xa7d8('0x41')]=_0x7cebfd[_0xa7d8('0x38')];_0x1a9fc6[_0xa7d8('0x40')]=_[_0xa7d8('0x42')](_0x1a9fc6[_0xa7d8('0x40')],[_0xa7d8('0x43')],[_0xa7d8('0x44')]);if(_0x1a9fc6[_0xa7d8('0x45')]&&_0x1a9fc6['account'][_0xa7d8('0x46')]){_0x1a9fc6[_0xa7d8('0x40')][_0xa7d8('0x47')]({'id':0x0,'priority':_0x1a9fc6[_0xa7d8('0x40')][_0xa7d8('0x48')]+0x1,'app':_0xa7d8('0x49'),'appdata':'autoclose','interval':_0xa7d8('0x4a')});}if(_0x1a9fc6[_0xa7d8('0x45')][_0xa7d8('0x3c')]){delete _0x1a9fc6[_0xa7d8('0x45')][_0xa7d8('0x3c')];}if(_0x1a9fc6['account'][_0xa7d8('0x38')]){delete _0x1a9fc6[_0xa7d8('0x45')]['List'];}if(_0x7cebfd['List'][_0xa7d8('0x39')][_0xa7d8('0x48')]){return _0x7cebfd['List'][_0xa7d8('0x39')][0x0];}var _0x197b23=_[_0xa7d8('0xb')](_0x1fbdaf['body'],{'firstName':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x31')],'ListId':_0x7cebfd['ListId']});_0x197b23[_0x1fbdaf['body']['mapKey']]=_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x31')];return db[_0xa7d8('0x2c')][_0xa7d8('0x4b')](_0x197b23);}else{throw new Error(_0xa7d8('0x4c'));}})[_0xa7d8('0x12')](function(_0x55d3b6){_0x1a9fc6[_0xa7d8('0x4d')]=_0x55d3b6;if(_0x55d3b6){if(!_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')][_0xa7d8('0x4e')]){_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')][_0xa7d8('0x4e')]=rs['generate']()+'\x20'+_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')][_0xa7d8('0x31')];}var _0x2fb053={'ContactId':_0x55d3b6['id'],'MailAccountId':_0x1fbdaf[_0xa7d8('0x45')]['id'],'inReplyTo':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')]['messageId'],'to':_0x1fbdaf['body'][_0xa7d8('0x1b')][_0xa7d8('0x31')],'cc':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')]['cc'],'subject':_0x1fbdaf[_0xa7d8('0x29')]['message']['subject'],'attach':_0x1fbdaf['body']['message']['attach'],'lastMsgAt':moment()['format'](_0xa7d8('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x29')]};return db[_0xa7d8('0x50')][_0xa7d8('0x28')]({'where':{'closed':![],'MailAccountId':_0x1fbdaf[_0xa7d8('0x45')]['id']},'include':[{'model':db[_0xa7d8('0x51')],'as':_0xa7d8('0x52'),'attributes':[_0xa7d8('0x4e')],'where':{'messageId':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')][_0xa7d8('0x53')]}}]})[_0xa7d8('0x12')](function(_0x1f2380){if(_0x1f2380){return[_0x1f2380,![]];}return db[_0xa7d8('0x50')][_0xa7d8('0x4b')](_0x2fb053)[_0xa7d8('0x12')](function(_0xa6042c){return[_0xa6042c,!![]];});});}else{throw new Error(_0xa7d8('0x54'));}})['spread'](function(_0x48d12f,_0x1d829f){if(_0x48d12f){_0x9cb9be=_0x1d829f;if(!_0x1d829f){return _0x48d12f[_0xa7d8('0x55')]({'inReplyTo':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')][_0xa7d8('0x4e')],'to':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')]['from'],'cc':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')]['cc'],'subject':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')][_0xa7d8('0x56')],'attach':_0x48d12f['attach']?_0x48d12f[_0xa7d8('0x57')]:_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')][_0xa7d8('0x57')],'substatus':null,'substatusAt':moment()[_0xa7d8('0x58')](_0xa7d8('0x4f')),'lastMsgAt':moment()['format'](_0xa7d8('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x29')]});}else{return _0x48d12f;}}})[_0xa7d8('0x12')](function(_0x5dbe28){_0x1a9fc6[_0xa7d8('0x59')]=_0x5dbe28[_0xa7d8('0x5a')]({'plain':!![]});_0x1a9fc6[_0xa7d8('0x59')][_0xa7d8('0x5b')]=_0x9cb9be;return db['MailMessage']['create']({'body':_0x1fbdaf['body'][_0xa7d8('0x29')],'MailAccountId':_0x1fbdaf[_0xa7d8('0x45')]['id'],'MailInteractionId':_0x5dbe28['id'],'direction':'in','ContactId':_0x1a9fc6['contact']['id'],'messageId':_0x1fbdaf[_0xa7d8('0x29')]['message'][_0xa7d8('0x4e')],'from':_0x1fbdaf['body'][_0xa7d8('0x1b')][_0xa7d8('0x31')],'to':_0x1fbdaf['body'][_0xa7d8('0x1b')]['to'],'cc':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')]['cc'],'subject':_0x1fbdaf['body'][_0xa7d8('0x1b')][_0xa7d8('0x56')],'attach':_0x1fbdaf['body'][_0xa7d8('0x1b')][_0xa7d8('0x57')],'Attachments':_0x1fbdaf['body'][_0xa7d8('0x1b')]['attachments'],'originTo':_0x1fbdaf['body'][_0xa7d8('0x1b')][_0xa7d8('0x5c')],'originCc':_0x1fbdaf[_0xa7d8('0x29')][_0xa7d8('0x1b')][_0xa7d8('0x5d')],'bcc':_0x1fbdaf[_0xa7d8('0x29')]['message'][_0xa7d8('0x5e')]},{'include':[{'model':db['Attachment'],'as':_0xa7d8('0x5f')}]});})[_0xa7d8('0x12')](function(_0x44c39f){_0x1a9fc6[_0xa7d8('0x1b')]=_0x44c39f;if(_0x1a9fc6[_0xa7d8('0x59')]['UserId']){return db[_0xa7d8('0x60')][_0xa7d8('0x28')]({'attributes':['id',_0xa7d8('0x61')],'where':{'id':_0x1a9fc6[_0xa7d8('0x59')][_0xa7d8('0x62')]}})['then'](function(_0xf9773c){if(_0xf9773c){_0x1a9fc6['applications'][_0xa7d8('0x63')]({'id':0x0,'priority':0x0,'app':_0xa7d8('0x64'),'appdata':_0xf9773c['name']+','+(_0x1a9fc6['account'][_0xa7d8('0x65')]||0xa),'interval':_0xa7d8('0x4a')});}return respondWithRpcPromise(_0xa7d8('0x66'),_0xa7d8('0x67'),_0x1a9fc6);});}return respondWithRpcPromise(_0xa7d8('0x66'),_0xa7d8('0x67'),_0x1a9fc6);})[_0xa7d8('0x12')](function(_0x5b8ab2){_0x16cf61(_0x5b8ab2);})[_0xa7d8('0x1c')](function(_0x202716){_0x1692e1(_0x5c760c[_0xa7d8('0x18')](0x1f4,_0x202716[_0xa7d8('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 013cb48..b774bfe 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 _0xa9c1=['length','save','removeListener','register'];(function(_0x41638f,_0x1cc24a){var _0x1104d8=function(_0x46681f){while(--_0x46681f){_0x41638f['push'](_0x41638f['shift']());}};_0x1104d8(++_0x1cc24a);}(_0xa9c1,0x14d));var _0x1a9c=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9c1[_0x3e112d];return _0x531c31;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x1a9c('0x0'),'remove','update'];function createListener(_0x170d43,_0x363a04){return function(_0x14e3fb){_0x363a04['emit'](_0x170d43,_0x14e3fb);};}function removeListener(_0xe071c4,_0x442711){return function(){MailAccountEvents[_0x1a9c('0x1')](_0xe071c4,_0x442711);};}exports[_0x1a9c('0x2')]=function(_0x2a052a){for(var _0x39f765=0x0,_0x14f1f1=events[_0x1a9c('0x3')];_0x39f765<_0x14f1f1;_0x39f765++){var _0x5957a5=events[_0x39f765];var _0x53188f=createListener('mailAccount:'+_0x5957a5,_0x2a052a);MailAccountEvents['on'](_0x5957a5,_0x53188f);}}; \ No newline at end of file +var _0xe9e4=['register','length','./mailAccount.events','save','remove','emit'];(function(_0x31bf1b,_0x36de1a){var _0x26ecbd=function(_0x219d04){while(--_0x219d04){_0x31bf1b['push'](_0x31bf1b['shift']());}};_0x26ecbd(++_0x36de1a);}(_0xe9e4,0xec));var _0x4e9e=function(_0x1ce64e,_0x4106c0){_0x1ce64e=_0x1ce64e-0x0;var _0x4632f7=_0xe9e4[_0x1ce64e];return _0x4632f7;};'use strict';var MailAccountEvents=require(_0x4e9e('0x0'));var events=[_0x4e9e('0x1'),_0x4e9e('0x2'),'update'];function createListener(_0x4facd8,_0x48034d){return function(_0x3b4c96){_0x48034d[_0x4e9e('0x3')](_0x4facd8,_0x3b4c96);};}function removeListener(_0x3a22a5,_0x24c03d){return function(){MailAccountEvents['removeListener'](_0x3a22a5,_0x24c03d);};}exports[_0x4e9e('0x4')]=function(_0x58b2b3){for(var _0x432cf4=0x0,_0x33c388=events[_0x4e9e('0x5')];_0x432cf4<_0x33c388;_0x432cf4++){var _0x55c2c6=events[_0x432cf4];var _0xc28a7f=createListener('mailAccount:'+_0x55c2c6,_0x58b2b3);MailAccountEvents['on'](_0x55c2c6,_0xc28a7f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8ee1ce3..6c33165 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 _0x4fef=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer'];(function(_0x13a217,_0x4b140f){var _0x227779=function(_0x592e3d){while(--_0x592e3d){_0x13a217['push'](_0x13a217['shift']());}};_0x227779(++_0x4b140f);}(_0x4fef,0x10f));var _0xf4fe=function(_0x41010c,_0x34db14){_0x41010c=_0x41010c-0x0;var _0x5d8a0e=_0x4fef[_0x41010c];return _0x5d8a0e;};'use strict';var multer=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var path=require('path');var timeout=require(_0xf4fe('0x2'));var express=require('express');var router=express[_0xf4fe('0x3')]();var auth=require(_0xf4fe('0x4'));var interaction=require(_0xf4fe('0x5'));var config=require(_0xf4fe('0x6'));var controller=require(_0xf4fe('0x7'));router[_0xf4fe('0x8')](_0xf4fe('0x9'),auth[_0xf4fe('0xa')](),controller['show']);router[_0xf4fe('0xb')](_0xf4fe('0x9'),auth['isAuthenticated'](),controller[_0xf4fe('0xc')]);router[_0xf4fe('0xd')](_0xf4fe('0x9'),auth[_0xf4fe('0xa')](),controller[_0xf4fe('0xe')]);module[_0xf4fe('0xf')]=router; \ No newline at end of file +var _0x6f7f=['express','Router','../../components/interaction/service','./mailApplication.controller','get','/:id','show','isAuthenticated','update','delete','exports','util','path','connect-timeout'];(function(_0x5793e1,_0x5f2966){var _0x43ea8f=function(_0x5aa1b2){while(--_0x5aa1b2){_0x5793e1['push'](_0x5793e1['shift']());}};_0x43ea8f(++_0x5f2966);}(_0x6f7f,0x177));var _0xf6f7=function(_0x54ef48,_0x151509){_0x54ef48=_0x54ef48-0x0;var _0x49e574=_0x6f7f[_0x54ef48];return _0x49e574;};'use strict';var multer=require('multer');var util=require(_0xf6f7('0x0'));var path=require(_0xf6f7('0x1'));var timeout=require(_0xf6f7('0x2'));var express=require(_0xf6f7('0x3'));var router=express[_0xf6f7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf6f7('0x5'));var config=require('../../config/environment');var controller=require(_0xf6f7('0x6'));router[_0xf6f7('0x7')](_0xf6f7('0x8'),auth['isAuthenticated'](),controller[_0xf6f7('0x9')]);router['put'](_0xf6f7('0x8'),auth[_0xf6f7('0xa')](),controller[_0xf6f7('0xb')]);router[_0xf6f7('0xc')](_0xf6f7('0x8'),auth[_0xf6f7('0xa')](),controller['destroy']);module[_0xf6f7('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 433272c..350db75 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 _0xa705=['*,*,*,*','INTEGER','noop','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa705,0x11d));var _0x5a70=function(_0x2140b8,_0x5541cb){_0x2140b8=_0x2140b8-0x0;var _0x1d8591=_0xa705[_0x2140b8];return _0x1d8591;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x5a70('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5a70('0x1')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x5a70('0x2')]},'interval':{'type':Sequelize[_0x5a70('0x2')],'defaultValue':_0x5a70('0x3')}}; \ No newline at end of file +var _0x26b3=['sequelize','INTEGER','STRING','noop','*,*,*,*'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x26b3,0x87));var _0x326b=function(_0x204c81,_0x4a951b){_0x204c81=_0x204c81-0x0;var _0x515269=_0x26b3[_0x204c81];return _0x515269;};'use strict';var Sequelize=require(_0x326b('0x0'));module['exports']={'priority':{'type':Sequelize[_0x326b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x326b('0x2')],'allowNull':![],'defaultValue':_0x326b('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x326b('0x2')]},'interval':{'type':Sequelize[_0x326b('0x2')],'defaultValue':_0x326b('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 68b8818..22ebcc2 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 _0x833b=['zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','apply','reject','update','destroy','then','stack','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','merge','catch','body','find','eml-format'];(function(_0x348c0a,_0x59e439){var _0x127a77=function(_0x4ad2bf){while(--_0x4ad2bf){_0x348c0a['push'](_0x348c0a['shift']());}};_0x127a77(++_0x59e439);}(_0x833b,0x131));var _0xb833=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x833b[_0x556927];return _0x5f1235;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb833('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb833('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb833('0x2'));var moment=require('moment');var BPromise=require(_0xb833('0x3'));var Mustache=require(_0xb833('0x4'));var util=require(_0xb833('0x5'));var path=require(_0xb833('0x6'));var sox=require(_0xb833('0x7'));var csv=require(_0xb833('0x8'));var ejs=require(_0xb833('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb833('0xa'));var crypto=require(_0xb833('0xb'));var jsforce=require(_0xb833('0xc'));var deskjs=require(_0xb833('0xd'));var toCsv=require(_0xb833('0x8'));var querystring=require(_0xb833('0xe'));var Papa=require(_0xb833('0xf'));var Redis=require('ioredis');var qs=require(_0xb833('0x10'));var logger=require('../../config/logger')(_0xb833('0x11'));var utils=require(_0xb833('0x12'));var config=require(_0xb833('0x13'));var db=require(_0xb833('0x14'))['db'];function respondWithStatusCode(_0x492017,_0x55e1b1){_0x55e1b1=_0x55e1b1||0xcc;return function(_0x329a47){if(_0x329a47){return _0x492017[_0xb833('0x15')](_0x55e1b1);}return _0x492017['status'](_0x55e1b1)[_0xb833('0x16')]();};}function respondWithResult(_0x5e79a0,_0x103b28){_0x103b28=_0x103b28||0xc8;return function(_0x1622a8){if(_0x1622a8){return _0x5e79a0[_0xb833('0x17')](_0x103b28)[_0xb833('0x18')](_0x1622a8);}};}function respondWithFilteredResult(_0x2f08cb,_0x42a8ac){return function(_0x26e8c1){if(_0x26e8c1){var _0x17d742=_0x26e8c1['count'],_0x58d9b6=_0x42a8ac['offset'],_0x30bdae=_0x42a8ac[_0xb833('0x19')]+_0x42a8ac['limit'],_0x371871;if(_0x30bdae>=_0x17d742){_0x30bdae=_0x17d742;_0x371871=0xc8;}else{_0x371871=0xce;}_0x2f08cb[_0xb833('0x17')](_0x371871);return _0x2f08cb[_0xb833('0x1a')]('Content-Range',_0x58d9b6+'-'+_0x30bdae+'/'+_0x17d742)[_0xb833('0x18')](_0x26e8c1);}return null;};}function patchUpdates(_0x174724){return function(_0x5798e2){try{jsonpatch[_0xb833('0x1b')](_0x5798e2,_0x174724,!![]);}catch(_0x3bfb12){return BPromise[_0xb833('0x1c')](_0x3bfb12);}return _0x5798e2['save']();};}function saveUpdates(_0x302c83,_0x3beb25){return function(_0x1fbc56){if(_0x1fbc56){return _0x1fbc56[_0xb833('0x1d')](_0x302c83)['then'](function(_0x5e4bc5){return _0x5e4bc5;});}return null;};}function removeEntity(_0x3bf6f2,_0x2706d4){return function(_0xb20878){if(_0xb20878){return _0xb20878[_0xb833('0x1e')]()[_0xb833('0x1f')](function(){_0x3bf6f2[_0xb833('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c9765,_0x57defe){return function(_0x50c037){if(!_0x50c037){_0x2c9765['sendStatus'](0x194);}return _0x50c037;};}function handleError(_0x2fa0d0,_0x9e7cdb){_0x9e7cdb=_0x9e7cdb||0x1f4;return function(_0x2e11d0){logger['error'](_0x2e11d0[_0xb833('0x20')]);if(_0x2e11d0[_0xb833('0x21')]){delete _0x2e11d0['name'];}_0x2fa0d0[_0xb833('0x17')](_0x9e7cdb)[_0xb833('0x22')](_0x2e11d0);};}exports['show']=function(_0x372488,_0x5d05ba){var _0xc7d7={'raw':!![],'where':{'id':_0x372488[_0xb833('0x23')]['id']}},_0x46101f={};_0x46101f['model']=_[_0xb833('0x24')](db[_0xb833('0x25')][_0xb833('0x26')]);_0x46101f['query']=_[_0xb833('0x24')](_0x372488[_0xb833('0x27')]);_0x46101f[_0xb833('0x28')]=_['intersection'](_0x46101f['model'],_0x46101f[_0xb833('0x27')]);_0xc7d7['attributes']=_[_0xb833('0x29')](_0x46101f[_0xb833('0x2a')],qs[_0xb833('0x2b')](_0x372488[_0xb833('0x27')][_0xb833('0x2b')]));_0xc7d7[_0xb833('0x2c')]=_0xc7d7['attributes']['length']?_0xc7d7[_0xb833('0x2c')]:_0x46101f[_0xb833('0x2a')];if(_0x372488[_0xb833('0x27')][_0xb833('0x2d')]){_0xc7d7[_0xb833('0x2e')]=[{'all':!![]}];}_0xc7d7=_[_0xb833('0x2f')]({},_0xc7d7,_0x372488['options']);return db['MailApplication']['find'](_0xc7d7)[_0xb833('0x1f')](handleEntityNotFound(_0x5d05ba,null))[_0xb833('0x1f')](respondWithResult(_0x5d05ba,null))[_0xb833('0x30')](handleError(_0x5d05ba,null));};exports[_0xb833('0x1d')]=function(_0x2b2ff2,_0x3c13fc){if(_0x2b2ff2[_0xb833('0x31')]['id']){delete _0x2b2ff2[_0xb833('0x31')]['id'];}return db[_0xb833('0x25')][_0xb833('0x32')]({'where':{'id':_0x2b2ff2[_0xb833('0x23')]['id']}})[_0xb833('0x1f')](handleEntityNotFound(_0x3c13fc,null))[_0xb833('0x1f')](saveUpdates(_0x2b2ff2['body'],null))[_0xb833('0x1f')](respondWithResult(_0x3c13fc,null))['catch'](handleError(_0x3c13fc,null));};exports[_0xb833('0x1e')]=function(_0x59555b,_0x31846a){return db['MailApplication'][_0xb833('0x32')]({'where':{'id':_0x59555b[_0xb833('0x23')]['id']}})[_0xb833('0x1f')](handleEntityNotFound(_0x31846a,null))[_0xb833('0x1f')](removeEntity(_0x31846a,null))['catch'](handleError(_0x31846a,null));}; \ No newline at end of file +var _0x5e14=['model','keys','MailApplication','rawAttributes','filters','intersection','query','attributes','fields','includeAll','options','find','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','show','params'];(function(_0x64757a,_0x511794){var _0x1c8dd1=function(_0x2912d9){while(--_0x2912d9){_0x64757a['push'](_0x64757a['shift']());}};_0x1c8dd1(++_0x511794);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x45e1('0x0'));var emlformat=require(_0x45e1('0x1'));var rimraf=require(_0x45e1('0x2'));var zipdir=require(_0x45e1('0x3'));var jsonpatch=require(_0x45e1('0x4'));var rp=require(_0x45e1('0x5'));var moment=require(_0x45e1('0x6'));var BPromise=require(_0x45e1('0x7'));var Mustache=require(_0x45e1('0x8'));var util=require(_0x45e1('0x9'));var path=require(_0x45e1('0xa'));var sox=require(_0x45e1('0xb'));var csv=require(_0x45e1('0xc'));var ejs=require(_0x45e1('0xd'));var fs=require('fs');var _=require(_0x45e1('0xe'));var squel=require(_0x45e1('0xf'));var crypto=require(_0x45e1('0x10'));var jsforce=require(_0x45e1('0x11'));var deskjs=require(_0x45e1('0x12'));var toCsv=require(_0x45e1('0xc'));var querystring=require(_0x45e1('0x13'));var Papa=require(_0x45e1('0x14'));var Redis=require('ioredis');var qs=require(_0x45e1('0x15'));var logger=require(_0x45e1('0x16'))(_0x45e1('0x17'));var utils=require('../../config/utils');var config=require(_0x45e1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39e656,_0x257ac8){_0x257ac8=_0x257ac8||0xcc;return function(_0x32b6b9){if(_0x32b6b9){return _0x39e656[_0x45e1('0x19')](_0x257ac8);}return _0x39e656[_0x45e1('0x1a')](_0x257ac8)[_0x45e1('0x1b')]();};}function respondWithResult(_0x2ab53e,_0x59e307){_0x59e307=_0x59e307||0xc8;return function(_0xfcb873){if(_0xfcb873){return _0x2ab53e[_0x45e1('0x1a')](_0x59e307)[_0x45e1('0x1c')](_0xfcb873);}};}function respondWithFilteredResult(_0x370297,_0x4364a0){return function(_0x235cb9){if(_0x235cb9){var _0x35cce5=_0x235cb9['count'],_0x4c2344=_0x4364a0['offset'],_0x5d9dba=_0x4364a0['offset']+_0x4364a0[_0x45e1('0x1d')],_0x2de680;if(_0x5d9dba>=_0x35cce5){_0x5d9dba=_0x35cce5;_0x2de680=0xc8;}else{_0x2de680=0xce;}_0x370297[_0x45e1('0x1a')](_0x2de680);return _0x370297[_0x45e1('0x1e')](_0x45e1('0x1f'),_0x4c2344+'-'+_0x5d9dba+'/'+_0x35cce5)[_0x45e1('0x1c')](_0x235cb9);}return null;};}function patchUpdates(_0xb67f34){return function(_0x4aea60){try{jsonpatch[_0x45e1('0x20')](_0x4aea60,_0xb67f34,!![]);}catch(_0x5e76dd){return BPromise[_0x45e1('0x21')](_0x5e76dd);}return _0x4aea60['save']();};}function saveUpdates(_0x3134f4,_0x23b670){return function(_0x1f2c01){if(_0x1f2c01){return _0x1f2c01[_0x45e1('0x22')](_0x3134f4)[_0x45e1('0x23')](function(_0x4f4884){return _0x4f4884;});}return null;};}function removeEntity(_0x34d043,_0x43cc42){return function(_0x44d900){if(_0x44d900){return _0x44d900[_0x45e1('0x24')]()[_0x45e1('0x23')](function(){_0x34d043[_0x45e1('0x1a')](0xcc)[_0x45e1('0x1b')]();});}};}function handleEntityNotFound(_0x2bdd53,_0x4515a9){return function(_0x68a3b){if(!_0x68a3b){_0x2bdd53[_0x45e1('0x19')](0x194);}return _0x68a3b;};}function handleError(_0x51fb60,_0x3847dd){_0x3847dd=_0x3847dd||0x1f4;return function(_0x81ea3c){logger[_0x45e1('0x25')](_0x81ea3c[_0x45e1('0x26')]);if(_0x81ea3c[_0x45e1('0x27')]){delete _0x81ea3c[_0x45e1('0x27')];}_0x51fb60[_0x45e1('0x1a')](_0x3847dd)[_0x45e1('0x28')](_0x81ea3c);};}exports[_0x45e1('0x29')]=function(_0x353eb6,_0x3889bf){var _0x668f14={'raw':!![],'where':{'id':_0x353eb6[_0x45e1('0x2a')]['id']}},_0x284695={};_0x284695[_0x45e1('0x2b')]=_[_0x45e1('0x2c')](db[_0x45e1('0x2d')][_0x45e1('0x2e')]);_0x284695['query']=_[_0x45e1('0x2c')](_0x353eb6['query']);_0x284695[_0x45e1('0x2f')]=_[_0x45e1('0x30')](_0x284695['model'],_0x284695[_0x45e1('0x31')]);_0x668f14[_0x45e1('0x32')]=_[_0x45e1('0x30')](_0x284695[_0x45e1('0x2b')],qs[_0x45e1('0x33')](_0x353eb6[_0x45e1('0x31')][_0x45e1('0x33')]));_0x668f14['attributes']=_0x668f14[_0x45e1('0x32')]['length']?_0x668f14[_0x45e1('0x32')]:_0x284695[_0x45e1('0x2b')];if(_0x353eb6[_0x45e1('0x31')][_0x45e1('0x34')]){_0x668f14['include']=[{'all':!![]}];}_0x668f14=_['merge']({},_0x668f14,_0x353eb6[_0x45e1('0x35')]);return db['MailApplication'][_0x45e1('0x36')](_0x668f14)[_0x45e1('0x23')](handleEntityNotFound(_0x3889bf,null))[_0x45e1('0x23')](respondWithResult(_0x3889bf,null))['catch'](handleError(_0x3889bf,null));};exports[_0x45e1('0x22')]=function(_0x3ffeb4,_0x41d382){if(_0x3ffeb4[_0x45e1('0x37')]['id']){delete _0x3ffeb4[_0x45e1('0x37')]['id'];}return db['MailApplication'][_0x45e1('0x36')]({'where':{'id':_0x3ffeb4[_0x45e1('0x2a')]['id']}})[_0x45e1('0x23')](handleEntityNotFound(_0x41d382,null))['then'](saveUpdates(_0x3ffeb4['body'],null))[_0x45e1('0x23')](respondWithResult(_0x41d382,null))[_0x45e1('0x38')](handleError(_0x41d382,null));};exports['destroy']=function(_0x5e846f,_0x3bf693){return db[_0x45e1('0x2d')]['find']({'where':{'id':_0x5e846f[_0x45e1('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3bf693,null))[_0x45e1('0x23')](removeEntity(_0x3bf693,null))[_0x45e1('0x38')](handleError(_0x3bf693,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 26df35c..bc8d99a 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 _0x3f0a=['mail_applications','lodash','api','moment','bluebird','request-promise','./mailApplication.attributes','define','MailApplication'];(function(_0x46cd97,_0x1d7f12){var _0x4eeb8a=function(_0x46d6bf){while(--_0x46d6bf){_0x46cd97['push'](_0x46cd97['shift']());}};_0x4eeb8a(++_0x1d7f12);}(_0x3f0a,0x172));var _0xa3f0=function(_0x4360c0,_0x2a3e87){_0x4360c0=_0x4360c0-0x0;var _0x3d1443=_0x3f0a[_0x4360c0];return _0x3d1443;};'use strict';var _=require(_0xa3f0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa3f0('0x1'));var moment=require(_0xa3f0('0x2'));var BPromise=require(_0xa3f0('0x3'));var rp=require(_0xa3f0('0x4'));var attributes=require(_0xa3f0('0x5'));module['exports']=function(_0x3d6526,_0x447101){return _0x3d6526[_0xa3f0('0x6')](_0xa3f0('0x7'),attributes,{'tableName':_0xa3f0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad24=['request-promise','define','mail_applications','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1726f2,_0x128b97){var _0x3feba4=function(_0x22708a){while(--_0x22708a){_0x1726f2['push'](_0x1726f2['shift']());}};_0x3feba4(++_0x128b97);}(_0xad24,0x1ce));var _0x4ad2=function(_0x400726,_0x37d818){_0x400726=_0x400726-0x0;var _0xf921df=_0xad24[_0x400726];return _0xf921df;};'use strict';var _=require(_0x4ad2('0x0'));var util=require(_0x4ad2('0x1'));var logger=require(_0x4ad2('0x2'))(_0x4ad2('0x3'));var moment=require(_0x4ad2('0x4'));var BPromise=require(_0x4ad2('0x5'));var rp=require(_0x4ad2('0x6'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x12e8b6,_0x56c49a){return _0x12e8b6[_0x4ad2('0x7')]('MailApplication',attributes,{'tableName':_0x4ad2('0x8'),'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 5c89cb7..ec47da9 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(_0x867e62,_0x2fd73e){var _0x42a59d=function(_0x371bd8){while(--_0x371bd8){_0x867e62['push'](_0x867e62['shift']());}};_0x42a59d(++_0x2fd73e);}(_0x7a54,0x106));var _0x47a5=function(_0x35af3b,_0x29d594){_0x35af3b=_0x35af3b-0x0;var _0x8ce92b=_0x7a54[_0x35af3b];return _0x8ce92b;};'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 _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(_0x4483f2,_0x5f003f){var _0xded9f7=function(_0x11b7ff){while(--_0x11b7ff){_0x4483f2['push'](_0x4483f2['shift']());}};_0xded9f7(++_0x5f003f);}(_0x7a54,0x106));var _0x47a5=function(_0x4fbc24,_0x322aff){_0x4fbc24=_0x4fbc24-0x0;var _0xde379d=_0x7a54[_0x4fbc24];return _0xde379d;};'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 diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 00019de..2805826 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 _0x0a68=['/:id','mail','mailinteraction:destroy','destroy','/:id/tags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete'];(function(_0x4b1f77,_0x46d6ef){var _0x519687=function(_0x2febc8){while(--_0x2febc8){_0x4b1f77['push'](_0x4b1f77['shift']());}};_0x519687(++_0x46d6ef);}(_0x0a68,0x12f));var _0x80a6=function(_0x5ce8c9,_0x4efbce){_0x5ce8c9=_0x5ce8c9-0x0;var _0x328229=_0x0a68[_0x5ce8c9];return _0x328229;};'use strict';var multer=require(_0x80a6('0x0'));var util=require('util');var path=require(_0x80a6('0x1'));var timeout=require(_0x80a6('0x2'));var express=require(_0x80a6('0x3'));var router=express[_0x80a6('0x4')]();var auth=require(_0x80a6('0x5'));var interaction=require(_0x80a6('0x6'));var config=require(_0x80a6('0x7'));var controller=require('./mailInteraction.controller');router[_0x80a6('0x8')]('/',auth[_0x80a6('0x9')](),controller[_0x80a6('0xa')]);router['get']('/describe',auth[_0x80a6('0x9')](),controller[_0x80a6('0xb')]);router[_0x80a6('0x8')]('/:id',auth[_0x80a6('0x9')](),controller[_0x80a6('0xc')]);router[_0x80a6('0x8')](_0x80a6('0xd'),auth[_0x80a6('0x9')](),controller[_0x80a6('0xe')]);router[_0x80a6('0x8')](_0x80a6('0xf'),auth[_0x80a6('0x9')](),controller[_0x80a6('0x10')]);router[_0x80a6('0x11')]('/',auth['isAuthenticated'](),controller[_0x80a6('0x12')]);router[_0x80a6('0x11')](_0x80a6('0xd'),auth[_0x80a6('0x9')](),controller[_0x80a6('0x13')]);router[_0x80a6('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x80a6('0x14')]('mail',_0x80a6('0x15')),controller[_0x80a6('0x16')]);router[_0x80a6('0x17')]('/:id',auth[_0x80a6('0x9')](),interaction[_0x80a6('0x14')]('mail',_0x80a6('0x18')),controller[_0x80a6('0x19')]);router[_0x80a6('0x1a')](_0x80a6('0x1b'),auth['isAuthenticated'](),interaction[_0x80a6('0x14')](_0x80a6('0x1c'),_0x80a6('0x1d')),controller[_0x80a6('0x1e')]);router['delete'](_0x80a6('0x1f'),auth[_0x80a6('0x9')](),controller['removeTags']);module[_0x80a6('0x20')]=router; \ No newline at end of file +var _0x30d3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','addTags','update','delete','mailinteraction:destroy','exports','path','connect-timeout','express'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x30d3,0x9f));var _0x330d=function(_0x2b4fd3,_0x14a632){_0x2b4fd3=_0x2b4fd3-0x0;var _0x160585=_0x30d3[_0x2b4fd3];return _0x160585;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x330d('0x0'));var timeout=require(_0x330d('0x1'));var express=require(_0x330d('0x2'));var router=express[_0x330d('0x3')]();var auth=require(_0x330d('0x4'));var interaction=require(_0x330d('0x5'));var config=require(_0x330d('0x6'));var controller=require('./mailInteraction.controller');router[_0x330d('0x7')]('/',auth[_0x330d('0x8')](),controller[_0x330d('0x9')]);router[_0x330d('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x330d('0xa')]);router[_0x330d('0x7')](_0x330d('0xb'),auth[_0x330d('0x8')](),controller['show']);router['get'](_0x330d('0xc'),auth[_0x330d('0x8')](),controller[_0x330d('0xd')]);router[_0x330d('0x7')](_0x330d('0xe'),auth[_0x330d('0x8')](),controller[_0x330d('0xf')]);router['post']('/',auth[_0x330d('0x8')](),controller[_0x330d('0x10')]);router[_0x330d('0x11')]('/:id/messages',auth[_0x330d('0x8')](),controller[_0x330d('0x12')]);router[_0x330d('0x11')](_0x330d('0x13'),auth['isAuthenticated'](),interaction[_0x330d('0x14')](_0x330d('0x15'),'mailinteraction:addtags'),controller[_0x330d('0x16')]);router['put'](_0x330d('0xb'),auth[_0x330d('0x8')](),interaction[_0x330d('0x14')]('mail','mailinteraction:update'),controller[_0x330d('0x17')]);router[_0x330d('0x18')](_0x330d('0xb'),auth['isAuthenticated'](),interaction['tracked']('mail',_0x330d('0x19')),controller['destroy']);router['delete'](_0x330d('0x13'),auth[_0x330d('0x8')](),controller['removeTags']);module[_0x330d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index b4af71f..2a0e4e9 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 _0xa0d2=['out','long','fromString','lastMsgBody','split','slice','join','sequelize','html-to-text','iconv','exports','DATE','STRING','TEXT','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','BOOLEAN','ENUM'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0xa0d2,0x1d2));var _0x2a0d=function(_0xa131d5,_0x2c625c){_0xa131d5=_0xa131d5-0x0;var _0x5cce43=_0xa0d2[_0xa131d5];return _0x5cce43;};'use strict';var Sequelize=require(_0x2a0d('0x0'));var htmlToText=require(_0x2a0d('0x1'));var iconv=require(_0x2a0d('0x2'));module[_0x2a0d('0x3')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2a0d('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2a0d('0x5')]},'inReplyTo':{'type':Sequelize[_0x2a0d('0x5')](0xbe)},'to':{'type':Sequelize[_0x2a0d('0x5')]},'cc':{'type':Sequelize[_0x2a0d('0x6')]('long')},'subject':{'type':Sequelize['TEXT']('')+_0x2a0d('0x7')},'attach':{'type':Sequelize[_0x2a0d('0x8')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x2a0d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2a0d('0x9')]('in',_0x2a0d('0xa')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2a0d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2a0d('0x9')]('in',_0x2a0d('0xa')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x2a0d('0x6')](_0x2a0d('0xb'))+_0x2a0d('0x7'),'get':function(){try{return this['getDataValue']('lastMsgBody')?htmlToText[_0x2a0d('0xc')](this['getDataValue'](_0x2a0d('0xd')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x2a0d('0xe')]('\x0a')[_0x2a0d('0xf')](0x0,0x6)[_0x2a0d('0x10')]('\x0a'):null;}catch(_0x2368de){return null;}}}}; \ No newline at end of file +var _0xf414=['DATE','out','ENUM','getDataValue','split','sequelize','exports','BOOLEAN','STRING','long','TEXT','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci'];(function(_0x4ebd7d,_0x56564c){var _0xf32b82=function(_0x148a34){while(--_0x148a34){_0x4ebd7d['push'](_0x4ebd7d['shift']());}};_0xf32b82(++_0x56564c);}(_0xf414,0x179));var _0x4f41=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xf414[_0x20ef64];return _0x3707d8;};'use strict';var Sequelize=require(_0x4f41('0x0'));var htmlToText=require('html-to-text');var iconv=require('iconv');module[_0x4f41('0x1')]={'closed':{'type':Sequelize[_0x4f41('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4f41('0x3')]},'inReplyTo':{'type':Sequelize[_0x4f41('0x3')](0xbe)},'to':{'type':Sequelize[_0x4f41('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x4f41('0x4'))},'subject':{'type':Sequelize[_0x4f41('0x5')]('')+_0x4f41('0x6')},'attach':{'type':Sequelize[_0x4f41('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4f41('0x7')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x4f41('0x7')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4f41('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4f41('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x4f41('0x9')]('in',_0x4f41('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x4f41('0x4'))+_0x4f41('0x6'),'get':function(){try{return this['getDataValue']('lastMsgBody')?htmlToText['fromString'](this[_0x4f41('0xa')]('lastMsgBody'),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x4f41('0xb')]('\x0a')['slice'](0x0,0x6)['join']('\x0a'):null;}catch(_0x4ae6b7){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 5d3d0a6..ac10322 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 _0xf6ed=['filter','map','tag','include','push','Tag','Tags','distinct','read','MailMessage','Messages','direction','createdAt','count','includeAll','User','Users','fullname','CmContact','Contact','Owner','internal','Account','key','email','color','ThroughTags','rows','catch','show','rawAttributes','options','find','create','body','params','describe','ids','omit','getMessages','findOne','sort','pick','MailInteractionId','$gte','format','findAll','spread','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','server','files','attachments','root','tmp','from','subject','Attachment','Attachments','mkdirSync','each','basename','existsSync','type','build','writeFileSync','message%d.eml','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','redis','localhost','./mailInteraction.socket','register','status','json','offset','limit','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','MailInteraction','model','dateStart','query','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','add','day','merge'];(function(_0x1e69e3,_0x11b169){var _0x39e642=function(_0x13708d){while(--_0x13708d){_0x1e69e3['push'](_0x1e69e3['shift']());}};_0x39e642(++_0x11b169);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x1ca5c1,_0x13ee6f){_0x1ca5c1=_0x1ca5c1-0x0;var _0x172fc2=_0xf6ed[_0x1ca5c1];return _0x172fc2;};'use strict';var pdf=require(_0xdf6e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdf6e('0x1'));var zipdir=require(_0xdf6e('0x2'));var jsonpatch=require(_0xdf6e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf6e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdf6e('0x5'));var sox=require('sox');var csv=require(_0xdf6e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdf6e('0x7'));var squel=require(_0xdf6e('0x8'));var crypto=require(_0xdf6e('0x9'));var jsforce=require(_0xdf6e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xdf6e('0x6'));var querystring=require(_0xdf6e('0xb'));var Papa=require(_0xdf6e('0xc'));var Redis=require(_0xdf6e('0xd'));var qs=require(_0xdf6e('0xe'));var logger=require('../../config/logger')(_0xdf6e('0xf'));var utils=require('../../config/utils');var config=require(_0xdf6e('0x10'));var db=require('../../mysqldb')['db'];config[_0xdf6e('0x11')]=_['defaults'](config[_0xdf6e('0x11')],{'host':_0xdf6e('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf6e('0x11')]));require(_0xdf6e('0x13'))[_0xdf6e('0x14')](socket);function respondWithStatusCode(_0x182299,_0xf884ba){_0xf884ba=_0xf884ba||0xcc;return function(_0x1aaa3b){if(_0x1aaa3b){return _0x182299['sendStatus'](_0xf884ba);}return _0x182299[_0xdf6e('0x15')](_0xf884ba)['end']();};}function respondWithResult(_0x425393,_0x3c4c8c){_0x3c4c8c=_0x3c4c8c||0xc8;return function(_0x45a3f1){if(_0x45a3f1){return _0x425393[_0xdf6e('0x15')](_0x3c4c8c)[_0xdf6e('0x16')](_0x45a3f1);}};}function respondWithFilteredResult(_0xa41255,_0x3eb3d3){return function(_0x495aed){if(_0x495aed){var _0x8c6c36=_0x495aed['count'],_0x50f7dc=_0x3eb3d3['offset'],_0x1f98ca=_0x3eb3d3[_0xdf6e('0x17')]+_0x3eb3d3[_0xdf6e('0x18')],_0x40a854;if(_0x1f98ca>=_0x8c6c36){_0x1f98ca=_0x8c6c36;_0x40a854=0xc8;}else{_0x40a854=0xce;}_0xa41255[_0xdf6e('0x15')](_0x40a854);return _0xa41255['set'](_0xdf6e('0x19'),_0x50f7dc+'-'+_0x1f98ca+'/'+_0x8c6c36)[_0xdf6e('0x16')](_0x495aed);}return null;};}function patchUpdates(_0x15282f){return function(_0x27e7e5){try{jsonpatch[_0xdf6e('0x1a')](_0x27e7e5,_0x15282f,!![]);}catch(_0x359100){return BPromise['reject'](_0x359100);}return _0x27e7e5[_0xdf6e('0x1b')]();};}function saveUpdates(_0x1dbe4a,_0x28957d){return function(_0x57955e){if(_0x57955e){return _0x57955e[_0xdf6e('0x1c')](_0x1dbe4a)['then'](function(_0x30af87){return _0x30af87;});}return null;};}function removeEntity(_0xfddaf6,_0x5abd60){return function(_0xb553d1){if(_0xb553d1){return _0xb553d1[_0xdf6e('0x1d')]()[_0xdf6e('0x1e')](function(){_0xfddaf6[_0xdf6e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe58f,_0x71f2a0){return function(_0x4d7e48){if(!_0x4d7e48){_0x4fe58f[_0xdf6e('0x1f')](0x194);}return _0x4d7e48;};}function handleError(_0xf10cda,_0x70ef58){_0x70ef58=_0x70ef58||0x1f4;return function(_0x3404d3){logger['error'](_0x3404d3[_0xdf6e('0x20')]);if(_0x3404d3[_0xdf6e('0x21')]){delete _0x3404d3[_0xdf6e('0x21')];}_0xf10cda['status'](_0x70ef58)[_0xdf6e('0x22')](_0x3404d3);};}exports[_0xdf6e('0x23')]=function(_0x2d198d,_0x43816c){var _0x5c75f3={},_0x1ef42a={},_0x2ed48e={'count':0x0,'rows':[]};var _0x533a8c=db[_0xdf6e('0x24')]['rawAttributes'];_0x1ef42a[_0xdf6e('0x25')]=_['keys'](_0x533a8c);var _0x4478ca={'dateStart':_0x2d198d['query'][_0xdf6e('0x26')],'dateEnd':_0x2d198d[_0xdf6e('0x27')]['dateEnd']};delete _0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x26')];delete _0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x28')];_0x1ef42a['query']=_[_0xdf6e('0x29')](_0x2d198d[_0xdf6e('0x27')]);_0x1ef42a[_0xdf6e('0x2a')]=_[_0xdf6e('0x2b')](_0x1ef42a[_0xdf6e('0x25')],_0x1ef42a[_0xdf6e('0x27')]);_0x5c75f3[_0xdf6e('0x2c')]=_[_0xdf6e('0x2b')](_0x1ef42a['model'],qs['fields'](_0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x2d')]));_0x5c75f3['attributes']=_0x5c75f3['attributes'][_0xdf6e('0x2e')]?_0x5c75f3[_0xdf6e('0x2c')]:_0x1ef42a[_0xdf6e('0x25')];if(!_0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x2f')](_0xdf6e('0x30'))){_0x5c75f3[_0xdf6e('0x18')]=qs[_0xdf6e('0x18')](_0x2d198d[_0xdf6e('0x27')]['limit']);_0x5c75f3['offset']=qs[_0xdf6e('0x17')](_0x2d198d['query'][_0xdf6e('0x17')]);}_0x5c75f3[_0xdf6e('0x31')]=qs['sort'](_0x2d198d[_0xdf6e('0x27')]['sort']);_0x5c75f3[_0xdf6e('0x32')]=qs[_0xdf6e('0x2a')](_['pick'](_0x2d198d[_0xdf6e('0x27')],_0x1ef42a['filters']));if(_0x4478ca[_0xdf6e('0x26')]){if(_0x4478ca[_0xdf6e('0x28')]){_0x4478ca[_0xdf6e('0x28')]=moment(_0x4478ca['dateEnd'])[_0xdf6e('0x33')](0x1,_0xdf6e('0x34'));}else{_0x4478ca[_0xdf6e('0x28')]=moment(_0x4478ca[_0xdf6e('0x26')])[_0xdf6e('0x33')](0x1,'day');}_[_0xdf6e('0x35')](_0x5c75f3[_0xdf6e('0x32')],{'createdAt':{'$gte':_0x4478ca[_0xdf6e('0x26')],'$lte':_0x4478ca[_0xdf6e('0x28')]}});}if(_0x2d198d['query'][_0xdf6e('0x36')]){_0x5c75f3[_0xdf6e('0x32')]=_[_0xdf6e('0x35')](_0x5c75f3[_0xdf6e('0x32')],{'$or':_[_0xdf6e('0x37')](_0x5c75f3[_0xdf6e('0x2c')],function(_0x47c4a2){var _0x45491e={};_0x45491e[_0x47c4a2]={'$like':'%'+_0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x36')]+'%'};return _0x45491e;})});}_0x5c75f3=_[_0xdf6e('0x35')]({},_0x5c75f3,_0x2d198d['options']);var _0x73fc52={'where':_0x5c75f3[_0xdf6e('0x32')]};_0x73fc52['include']=[];if(_0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x38')]){_0x73fc52[_0xdf6e('0x39')][_0xdf6e('0x3a')]({'model':db[_0xdf6e('0x3b')],'as':_0xdf6e('0x3c'),'attributes':['id'],'where':{'id':_0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x38')]},'required':!![]});_0x73fc52[_0xdf6e('0x3d')]=!![];}if(_0x2d198d['query'][_0xdf6e('0x3e')]){_0x73fc52[_0xdf6e('0x39')][_0xdf6e('0x3a')]({'model':db[_0xdf6e('0x3f')],'as':_0xdf6e('0x40'),'attributes':['id',_0xdf6e('0x41'),_0xdf6e('0x42'),'read'],'where':{'direction':'in','read':_0x2d198d[_0xdf6e('0x27')]['read']||![]},'required':!![]});_0x73fc52[_0xdf6e('0x3d')]=!![];}return db[_0xdf6e('0x24')][_0xdf6e('0x43')](_0x73fc52)[_0xdf6e('0x1e')](function(_0x5cc75a){_0x2ed48e[_0xdf6e('0x43')]=_0x5cc75a;if(_0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x44')]){_0x5c75f3['include']=[{'model':db[_0xdf6e('0x45')],'as':_0xdf6e('0x46'),'required':![],'attributes':['id',_0xdf6e('0x21'),_0xdf6e('0x47')]},{'model':db[_0xdf6e('0x48')],'as':_0xdf6e('0x49'),'required':![]},{'model':db[_0xdf6e('0x45')],'as':_0xdf6e('0x4a'),'attributes':[_0xdf6e('0x21'),'fullname',_0xdf6e('0x4b')],'required':![]},{'model':db['MailAccount'],'as':_0xdf6e('0x4c'),'attributes':[_0xdf6e('0x21'),_0xdf6e('0x4d'),_0xdf6e('0x4e')],'required':![]},{'model':db[_0xdf6e('0x3f')],'as':'Messages','attributes':['id','direction','createdAt','read'],'where':{'direction':'in','read':_0x2d198d['query'][_0xdf6e('0x3e')]||![]},'required':_0x2d198d[_0xdf6e('0x27')]['read']||![]},{'model':db[_0xdf6e('0x3b')],'as':_0xdf6e('0x3c'),'attributes':['id',_0xdf6e('0x21'),_0xdf6e('0x4f')],'required':_0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x38')]?!![]:![]},{'model':db['Tag'],'as':_0xdf6e('0x50'),'attributes':['id',_0xdf6e('0x21'),'color'],'through':_0x2d198d[_0xdf6e('0x27')]['tag']?{'attributes':[],'where':{'TagId':_0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x38')]||undefined}}:{},'required':_0x2d198d[_0xdf6e('0x27')][_0xdf6e('0x38')]?!![]:![]}];}return db[_0xdf6e('0x24')]['findAll'](_0x5c75f3);})[_0xdf6e('0x1e')](function(_0x38bc6d){_0x2ed48e[_0xdf6e('0x51')]=_0x38bc6d;return _0x2ed48e;})[_0xdf6e('0x1e')](respondWithFilteredResult(_0x43816c,_0x5c75f3))[_0xdf6e('0x52')](handleError(_0x43816c,null));};exports[_0xdf6e('0x53')]=function(_0xab99d8,_0x8cb048){var _0x48f0a6={'raw':![],'where':{'id':_0xab99d8['params']['id']}},_0x2da2df={};_0x2da2df[_0xdf6e('0x25')]=_[_0xdf6e('0x29')](db[_0xdf6e('0x24')][_0xdf6e('0x54')]);_0x2da2df[_0xdf6e('0x27')]=_['keys'](_0xab99d8[_0xdf6e('0x27')]);_0x2da2df[_0xdf6e('0x2a')]=_['intersection'](_0x2da2df[_0xdf6e('0x25')],_0x2da2df[_0xdf6e('0x27')]);_0x48f0a6['attributes']=_[_0xdf6e('0x2b')](_0x2da2df[_0xdf6e('0x25')],qs['fields'](_0xab99d8[_0xdf6e('0x27')]['fields']));_0x48f0a6[_0xdf6e('0x2c')]=_0x48f0a6['attributes']['length']?_0x48f0a6[_0xdf6e('0x2c')]:_0x2da2df['model'];if(_0xab99d8[_0xdf6e('0x27')][_0xdf6e('0x44')]){_0x48f0a6[_0xdf6e('0x39')]=[{'all':!![]}];}_0x48f0a6=_[_0xdf6e('0x35')]({},_0x48f0a6,_0xab99d8[_0xdf6e('0x55')]);return db[_0xdf6e('0x24')][_0xdf6e('0x56')](_0x48f0a6)['then'](handleEntityNotFound(_0x8cb048,null))['then'](respondWithResult(_0x8cb048,null))[_0xdf6e('0x52')](handleError(_0x8cb048,null));};exports[_0xdf6e('0x57')]=function(_0x111539,_0x354392){return db['MailInteraction']['create'](_0x111539[_0xdf6e('0x58')],{})[_0xdf6e('0x1e')](respondWithResult(_0x354392,0xc9))[_0xdf6e('0x52')](handleError(_0x354392,null));};exports[_0xdf6e('0x1c')]=function(_0x49c347,_0x2d81d4){if(_0x49c347[_0xdf6e('0x58')]['id']){delete _0x49c347[_0xdf6e('0x58')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x49c347[_0xdf6e('0x59')]['id']}})[_0xdf6e('0x1e')](handleEntityNotFound(_0x2d81d4,null))[_0xdf6e('0x1e')](saveUpdates(_0x49c347[_0xdf6e('0x58')],null))[_0xdf6e('0x1e')](respondWithResult(_0x2d81d4,null))['catch'](handleError(_0x2d81d4,null));};exports[_0xdf6e('0x1d')]=function(_0x537b7a,_0x5907b1){return db[_0xdf6e('0x24')][_0xdf6e('0x56')]({'where':{'id':_0x537b7a[_0xdf6e('0x59')]['id']}})[_0xdf6e('0x1e')](handleEntityNotFound(_0x5907b1,null))['then'](removeEntity(_0x5907b1,null))[_0xdf6e('0x52')](handleError(_0x5907b1,null));};exports[_0xdf6e('0x5a')]=function(_0x12e3fa,_0x473db0){return db[_0xdf6e('0x24')][_0xdf6e('0x5a')]()['then'](respondWithResult(_0x473db0,null))[_0xdf6e('0x52')](handleError(_0x473db0,null));};exports['addMessage']=function(_0x3e11f0,_0x2cb068,_0x1d1511){return db[_0xdf6e('0x3f')]['find']({'where':{'id':_0x3e11f0['params']['id']}})[_0xdf6e('0x1e')](handleEntityNotFound(_0x2cb068,null))[_0xdf6e('0x1e')](function(_0x1f8cc0){if(_0x1f8cc0){return _0x1f8cc0['addMessage'](_0x3e11f0[_0xdf6e('0x58')][_0xdf6e('0x5b')],_[_0xdf6e('0x5c')](_0x3e11f0['body'],['ids','id'])||{});}})[_0xdf6e('0x1e')](respondWithResult(_0x2cb068,null))[_0xdf6e('0x52')](handleError(_0x2cb068,null));};exports[_0xdf6e('0x5d')]=function(_0x4c3305,_0x4800c1,_0xd081f4){var _0x3887eb={'raw':![],'where':{}};var _0x3a2914={};var _0x17c8e0={'count':0x0,'rows':[]};return db[_0xdf6e('0x24')][_0xdf6e('0x5e')]({'where':{'id':_0x4c3305[_0xdf6e('0x59')]['id']}})[_0xdf6e('0x1e')](handleEntityNotFound(_0x4800c1,null))[_0xdf6e('0x1e')](function(_0x443ff5){if(_0x443ff5){_0x3a2914['model']=_['keys'](db[_0xdf6e('0x3f')][_0xdf6e('0x54')]);_0x3a2914[_0xdf6e('0x27')]=_[_0xdf6e('0x29')](_0x4c3305[_0xdf6e('0x27')]);_0x3a2914[_0xdf6e('0x2a')]=_[_0xdf6e('0x2b')](_0x3a2914[_0xdf6e('0x25')],_0x3a2914['query']);_0x3887eb[_0xdf6e('0x2c')]=_[_0xdf6e('0x2b')](_0x3a2914[_0xdf6e('0x25')],qs[_0xdf6e('0x2d')](_0x4c3305[_0xdf6e('0x27')][_0xdf6e('0x2d')]));_0x3887eb[_0xdf6e('0x2c')]=_0x3887eb[_0xdf6e('0x2c')][_0xdf6e('0x2e')]?_0x3887eb[_0xdf6e('0x2c')]:_0x3a2914[_0xdf6e('0x25')];if(!_0x4c3305[_0xdf6e('0x27')]['hasOwnProperty'](_0xdf6e('0x30'))){_0x3887eb['limit']=qs[_0xdf6e('0x18')](_0x4c3305[_0xdf6e('0x27')][_0xdf6e('0x18')]);_0x3887eb[_0xdf6e('0x17')]=qs[_0xdf6e('0x17')](_0x4c3305['query'][_0xdf6e('0x17')]);}_0x3887eb[_0xdf6e('0x31')]=qs['sort'](_0x4c3305[_0xdf6e('0x27')][_0xdf6e('0x5f')]);_0x3887eb[_0xdf6e('0x32')]=qs['filters'](_[_0xdf6e('0x60')](_0x4c3305[_0xdf6e('0x27')],_0x3a2914[_0xdf6e('0x2a')]));_0x3887eb[_0xdf6e('0x32')][_0xdf6e('0x61')]=_0x443ff5['id'];if(_0x4c3305['query'][_0xdf6e('0x36')]){_0x3887eb['where']=_[_0xdf6e('0x35')](_0x3887eb['where'],{'$or':_[_0xdf6e('0x37')](_0x3887eb[_0xdf6e('0x2c')],function(_0x2bd4ae){var _0x5cdba7={};_0x5cdba7[_0x2bd4ae]={'$like':'%'+_0x4c3305[_0xdf6e('0x27')][_0xdf6e('0x36')]+'%'};return _0x5cdba7;})});}if(_0x4c3305[_0xdf6e('0x27')]['$gte']){var _0x2e355a=_0x4c3305['query'][_0xdf6e('0x62')]['split'](',');var _0x1afec7={};_0x1afec7[_0x2e355a[0x0]]={'$gte':moment(_0x2e355a[0x1])[_0xdf6e('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3887eb[_0xdf6e('0x32')]=_[_0xdf6e('0x35')](_0x3887eb[_0xdf6e('0x32')],_0x1afec7);}_0x3887eb=_[_0xdf6e('0x35')]({},_0x3887eb,_0x4c3305[_0xdf6e('0x55')]);return db[_0xdf6e('0x3f')][_0xdf6e('0x43')]({'where':_0x3887eb['where']})['then'](function(_0x56db82){_0x17c8e0['count']=_0x56db82;if(_0x4c3305[_0xdf6e('0x27')][_0xdf6e('0x44')]){_0x3887eb[_0xdf6e('0x39')]=[{'all':!![]}];}return db[_0xdf6e('0x3f')][_0xdf6e('0x64')](_0x3887eb);})['then'](function(_0x3fbe1a){_0x17c8e0['rows']=_0x3fbe1a;return _0x17c8e0;});}})[_0xdf6e('0x1e')](respondWithFilteredResult(_0x4800c1,_0x3887eb))[_0xdf6e('0x52')](handleError(_0x4800c1,null));};exports['addTags']=function(_0x3735b9,_0x4646e7,_0x2b62e2){return db[_0xdf6e('0x24')][_0xdf6e('0x56')]({'where':{'id':_0x3735b9['params']['id']}})[_0xdf6e('0x1e')](handleEntityNotFound(_0x4646e7,null))[_0xdf6e('0x1e')](function(_0x2554b5){if(_0x2554b5){return _0x2554b5['setTags'](_0x3735b9[_0xdf6e('0x58')][_0xdf6e('0x5b')],_[_0xdf6e('0x5c')](_0x3735b9[_0xdf6e('0x58')],[_0xdf6e('0x5b'),'id'])||{})[_0xdf6e('0x65')](function(){return db[_0xdf6e('0x3b')][_0xdf6e('0x64')]({'attributes':['id',_0xdf6e('0x21'),_0xdf6e('0x4f')],'where':{'id':_0x3735b9[_0xdf6e('0x58')][_0xdf6e('0x5b')]}});})[_0xdf6e('0x1e')](function(_0xb53022){socket[_0xdf6e('0x66')](_0xdf6e('0x67'),{'id':Number(_0x3735b9['params']['id']),'tags':_0xb53022||[]});return{'id':Number(_0x3735b9[_0xdf6e('0x59')]['id']),'tags':_0xb53022||[]};});}})['then'](respondWithResult(_0x4646e7,null))[_0xdf6e('0x52')](handleError(_0x4646e7,null));};exports[_0xdf6e('0x68')]=function(_0xd590e,_0x17154b,_0xdba92c){var _0x384445;return db[_0xdf6e('0x24')][_0xdf6e('0x56')]({'where':{'id':_0xd590e[_0xdf6e('0x59')]['id']}})['then'](handleEntityNotFound(_0x17154b,null))[_0xdf6e('0x1e')](function(_0xc7320d){if(_0xc7320d){return _0xc7320d[_0xdf6e('0x68')](_0xd590e[_0xdf6e('0x27')][_0xdf6e('0x5b')]);}})[_0xdf6e('0x1e')](respondWithStatusCode(_0x17154b,null))['catch'](handleError(_0x17154b,null));};exports[_0xdf6e('0x69')]=function(_0x5595c3,_0x2c0029){var _0x1a1efb=moment()[_0xdf6e('0x6a')]()[_0xdf6e('0x6b')]();var _0x442a77=path[_0xdf6e('0x6c')](config['root'],_0xdf6e('0x6d'),_0xdf6e('0x6e'),_0xdf6e('0x6f'));var _0x59a3c7=path[_0xdf6e('0x6c')](config[_0xdf6e('0x70')],_0xdf6e('0x6d'),'files',_0xdf6e('0x71'));var _0x1460f9=path['join'](_0x59a3c7,_0x1a1efb);var _0x52db01=util['format']('interaction-%s.zip',_0x1a1efb);var _0x385633=path[_0xdf6e('0x6c')](_0x59a3c7,_0x52db01);var _0xd8270=![];return db[_0xdf6e('0x24')]['find']({'where':{'id':_0x5595c3[_0xdf6e('0x59')]['id']}})[_0xdf6e('0x1e')](handleEntityNotFound(_0x2c0029,null))[_0xdf6e('0x1e')](function(_0x514d3f){if(_0x514d3f){return _0x514d3f[_0xdf6e('0x5d')]({'attributes':['id',_0xdf6e('0x58'),_0xdf6e('0x72'),'to','cc',_0xdf6e('0x73'),_0xdf6e('0x42')],'where':{'secret':![]},'include':_0x5595c3[_0xdf6e('0x27')][_0xdf6e('0x6f')]?[{'model':db[_0xdf6e('0x74')],'as':_0xdf6e('0x75')}]:undefined,'order':qs[_0xdf6e('0x5f')]('id')});}return[];})[_0xdf6e('0x1e')](function(_0x47abc4){_0xd8270=_0x47abc4[_0xdf6e('0x2e')];if(_0x47abc4[_0xdf6e('0x2e')]){fs[_0xdf6e('0x76')](_0x1460f9);return BPromise[_0xdf6e('0x77')](_0x47abc4,function(_0x367b31,_0x111581){var _0x573e5e=_0x367b31;var _0x1f20ed={'from':_0x573e5e[_0xdf6e('0x72')],'to':_0x573e5e['to'],'subject':_0x573e5e[_0xdf6e('0x73')],'html':_0x573e5e[_0xdf6e('0x58')],'attachments':[]};return new BPromise(function(_0x51db5f,_0x20ca1d){if(_0x367b31[_0xdf6e('0x75')]){for(var _0xed00e0=0x0;_0xed00e0<_0x367b31[_0xdf6e('0x75')][_0xdf6e('0x2e')];_0xed00e0++){var _0x5d4bff=_0x367b31['Attachments'][_0xed00e0];var _0x17b7c9=path[_0xdf6e('0x6c')](_0x442a77,_0x5d4bff[_0xdf6e('0x78')]);if(fs[_0xdf6e('0x79')](_0x17b7c9)){_0x1f20ed[_0xdf6e('0x6f')][_0xdf6e('0x3a')]({'name':_0x5d4bff['name'],'contentType':_0x5d4bff[_0xdf6e('0x7a')],'data':fs['readFileSync'](_0x17b7c9)});}}}emlformat[_0xdf6e('0x7b')](_0x1f20ed,function(_0x25eb26,_0x58e3d7){if(_0x25eb26)return _0x20ca1d(_0x25eb26);fs[_0xdf6e('0x7c')](path['join'](_0x1460f9,util[_0xdf6e('0x63')](_0xdf6e('0x7d'),_0x111581)),_0x58e3d7);return _0x51db5f(_0x58e3d7);});});});}})['then'](function(){if(_0xd8270){return new BPromise(function(_0x5c4815,_0x5b678a){zipdir(_0x1460f9,{'saveTo':_0x385633},function(_0x150104,_0x1ef3ec){if(_0x150104)return _0x5b678a(_0x150104);return _0x5c4815(_0x1ef3ec);});});}})['then'](function(){if(_0xd8270){return new BPromise(function(_0x308477,_0xefb9db){rimraf(_0x1460f9,function(_0x4900d8){if(_0x4900d8)_0xefb9db(_0x4900d8);return _0x308477();});});}})[_0xdf6e('0x1e')](function(){if(_0xd8270){return _0x2c0029[_0xdf6e('0x69')](_0x385633,_0x52db01,function(_0x3080d9){if(_0x3080d9){console[_0xdf6e('0x7e')](_0xdf6e('0x7f'),_0x3080d9);}else{fs[_0xdf6e('0x80')](_0x385633);}});}else{return _0x2c0029[_0xdf6e('0x1f')](0xc8);}})[_0xdf6e('0x52')](handleError(_0x2c0029,null));}; \ No newline at end of file +var _0x0a6b=['YYYY-MM-DD\x20HH:mm:ss','spread','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','tmp','from','subject','Attachments','length','mkdirSync','each','basename','readFileSync','build','message%d.eml','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','pick','add','day','merge','filter','options','include','push','Tag','Tags','distinct','MailMessage','createdAt','read','MailInteraction','includeAll','User','Users','Contact','Owner','fullname','internal','Account','key','Messages','color','tag','ThroughTags','findAll','rows','catch','params','find','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','rawAttributes','order','MailInteractionId','$gte','split','format'];(function(_0x590439,_0x4d6de1){var _0x354ea2=function(_0x5b1957){while(--_0x5b1957){_0x590439['push'](_0x590439['shift']());}};_0x354ea2(++_0x4d6de1);}(_0x0a6b,0x120));var _0xb0a6=function(_0x4c4e19,_0x4c2dea){_0x4c4e19=_0x4c4e19-0x0;var _0x3cdcbb=_0x0a6b[_0x4c4e19];return _0x3cdcbb;};'use strict';var pdf=require(_0xb0a6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb0a6('0x1'));var zipdir=require(_0xb0a6('0x2'));var jsonpatch=require(_0xb0a6('0x3'));var rp=require(_0xb0a6('0x4'));var moment=require(_0xb0a6('0x5'));var BPromise=require(_0xb0a6('0x6'));var Mustache=require(_0xb0a6('0x7'));var util=require(_0xb0a6('0x8'));var path=require(_0xb0a6('0x9'));var sox=require(_0xb0a6('0xa'));var csv=require('to-csv');var ejs=require(_0xb0a6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb0a6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb0a6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb0a6('0xe'));var Papa=require(_0xb0a6('0xf'));var Redis=require('ioredis');var qs=require(_0xb0a6('0x10'));var logger=require(_0xb0a6('0x11'))('api');var utils=require(_0xb0a6('0x12'));var config=require(_0xb0a6('0x13'));var db=require(_0xb0a6('0x14'))['db'];config[_0xb0a6('0x15')]=_[_0xb0a6('0x16')](config[_0xb0a6('0x15')],{'host':_0xb0a6('0x17'),'port':0x18eb});var socket=require(_0xb0a6('0x18'))(new Redis(config['redis']));require(_0xb0a6('0x19'))[_0xb0a6('0x1a')](socket);function respondWithStatusCode(_0x3db39b,_0x27edeb){_0x27edeb=_0x27edeb||0xcc;return function(_0x9e2fda){if(_0x9e2fda){return _0x3db39b['sendStatus'](_0x27edeb);}return _0x3db39b[_0xb0a6('0x1b')](_0x27edeb)[_0xb0a6('0x1c')]();};}function respondWithResult(_0x520af3,_0x14b116){_0x14b116=_0x14b116||0xc8;return function(_0x5d0759){if(_0x5d0759){return _0x520af3['status'](_0x14b116)[_0xb0a6('0x1d')](_0x5d0759);}};}function respondWithFilteredResult(_0x3728e8,_0xdb9ffb){return function(_0x2ef938){if(_0x2ef938){var _0xeb25ec=_0x2ef938[_0xb0a6('0x1e')],_0x1aa140=_0xdb9ffb[_0xb0a6('0x1f')],_0x3fd186=_0xdb9ffb[_0xb0a6('0x1f')]+_0xdb9ffb['limit'],_0x1bd5ed;if(_0x3fd186>=_0xeb25ec){_0x3fd186=_0xeb25ec;_0x1bd5ed=0xc8;}else{_0x1bd5ed=0xce;}_0x3728e8['status'](_0x1bd5ed);return _0x3728e8[_0xb0a6('0x20')](_0xb0a6('0x21'),_0x1aa140+'-'+_0x3fd186+'/'+_0xeb25ec)['json'](_0x2ef938);}return null;};}function patchUpdates(_0xd99d59){return function(_0x5571c7){try{jsonpatch[_0xb0a6('0x22')](_0x5571c7,_0xd99d59,!![]);}catch(_0x2077b5){return BPromise[_0xb0a6('0x23')](_0x2077b5);}return _0x5571c7[_0xb0a6('0x24')]();};}function saveUpdates(_0x4a6499,_0x535eee){return function(_0x5e9765){if(_0x5e9765){return _0x5e9765[_0xb0a6('0x25')](_0x4a6499)[_0xb0a6('0x26')](function(_0xf6e364){return _0xf6e364;});}return null;};}function removeEntity(_0x4df01b,_0xb99553){return function(_0x48f165){if(_0x48f165){return _0x48f165['destroy']()[_0xb0a6('0x26')](function(){_0x4df01b[_0xb0a6('0x1b')](0xcc)[_0xb0a6('0x1c')]();});}};}function handleEntityNotFound(_0x2e5101,_0x34032c){return function(_0x49f704){if(!_0x49f704){_0x2e5101[_0xb0a6('0x27')](0x194);}return _0x49f704;};}function handleError(_0xf0d5f1,_0x3ddd44){_0x3ddd44=_0x3ddd44||0x1f4;return function(_0x5f4f30){logger[_0xb0a6('0x28')](_0x5f4f30[_0xb0a6('0x29')]);if(_0x5f4f30['name']){delete _0x5f4f30[_0xb0a6('0x2a')];}_0xf0d5f1[_0xb0a6('0x1b')](_0x3ddd44)['send'](_0x5f4f30);};}exports['index']=function(_0x543c33,_0x5e6012){var _0x384522={},_0x37aca3={},_0x41b0f9={'count':0x0,'rows':[]};var _0x158ae9=db['MailInteraction']['rawAttributes'];_0x37aca3[_0xb0a6('0x2b')]=_[_0xb0a6('0x2c')](_0x158ae9);var _0x57d22c={'dateStart':_0x543c33[_0xb0a6('0x2d')][_0xb0a6('0x2e')],'dateEnd':_0x543c33['query'][_0xb0a6('0x2f')]};delete _0x543c33[_0xb0a6('0x2d')][_0xb0a6('0x2e')];delete _0x543c33[_0xb0a6('0x2d')]['dateEnd'];_0x37aca3[_0xb0a6('0x2d')]=_[_0xb0a6('0x2c')](_0x543c33['query']);_0x37aca3['filters']=_[_0xb0a6('0x30')](_0x37aca3[_0xb0a6('0x2b')],_0x37aca3[_0xb0a6('0x2d')]);_0x384522['attributes']=_[_0xb0a6('0x30')](_0x37aca3[_0xb0a6('0x2b')],qs[_0xb0a6('0x31')](_0x543c33[_0xb0a6('0x2d')][_0xb0a6('0x31')]));_0x384522['attributes']=_0x384522[_0xb0a6('0x32')]['length']?_0x384522[_0xb0a6('0x32')]:_0x37aca3['model'];if(!_0x543c33[_0xb0a6('0x2d')][_0xb0a6('0x33')](_0xb0a6('0x34'))){_0x384522[_0xb0a6('0x35')]=qs[_0xb0a6('0x35')](_0x543c33[_0xb0a6('0x2d')][_0xb0a6('0x35')]);_0x384522[_0xb0a6('0x1f')]=qs[_0xb0a6('0x1f')](_0x543c33[_0xb0a6('0x2d')]['offset']);}_0x384522['order']=qs[_0xb0a6('0x36')](_0x543c33['query'][_0xb0a6('0x36')]);_0x384522[_0xb0a6('0x37')]=qs[_0xb0a6('0x38')](_[_0xb0a6('0x39')](_0x543c33['query'],_0x37aca3[_0xb0a6('0x38')]));if(_0x57d22c[_0xb0a6('0x2e')]){if(_0x57d22c['dateEnd']){_0x57d22c[_0xb0a6('0x2f')]=moment(_0x57d22c[_0xb0a6('0x2f')])[_0xb0a6('0x3a')](0x1,_0xb0a6('0x3b'));}else{_0x57d22c['dateEnd']=moment(_0x57d22c[_0xb0a6('0x2e')])['add'](0x1,_0xb0a6('0x3b'));}_[_0xb0a6('0x3c')](_0x384522['where'],{'createdAt':{'$gte':_0x57d22c[_0xb0a6('0x2e')],'$lte':_0x57d22c['dateEnd']}});}if(_0x543c33[_0xb0a6('0x2d')]['filter']){_0x384522[_0xb0a6('0x37')]=_[_0xb0a6('0x3c')](_0x384522[_0xb0a6('0x37')],{'$or':_['map'](_0x384522[_0xb0a6('0x32')],function(_0x496f44){var _0x2b367c={};_0x2b367c[_0x496f44]={'$like':'%'+_0x543c33[_0xb0a6('0x2d')][_0xb0a6('0x3d')]+'%'};return _0x2b367c;})});}_0x384522=_[_0xb0a6('0x3c')]({},_0x384522,_0x543c33[_0xb0a6('0x3e')]);var _0x1c8d91={'where':_0x384522[_0xb0a6('0x37')]};_0x1c8d91['include']=[];if(_0x543c33[_0xb0a6('0x2d')]['tag']){_0x1c8d91[_0xb0a6('0x3f')][_0xb0a6('0x40')]({'model':db[_0xb0a6('0x41')],'as':_0xb0a6('0x42'),'attributes':['id'],'where':{'id':_0x543c33['query']['tag']},'required':!![]});_0x1c8d91[_0xb0a6('0x43')]=!![];}if(_0x543c33[_0xb0a6('0x2d')]['read']){_0x1c8d91['include'][_0xb0a6('0x40')]({'model':db[_0xb0a6('0x44')],'as':'Messages','attributes':['id','direction',_0xb0a6('0x45'),_0xb0a6('0x46')],'where':{'direction':'in','read':_0x543c33[_0xb0a6('0x2d')][_0xb0a6('0x46')]||![]},'required':!![]});_0x1c8d91[_0xb0a6('0x43')]=!![];}return db[_0xb0a6('0x47')][_0xb0a6('0x1e')](_0x1c8d91)['then'](function(_0x52db6f){_0x41b0f9[_0xb0a6('0x1e')]=_0x52db6f;if(_0x543c33['query'][_0xb0a6('0x48')]){_0x384522['include']=[{'model':db[_0xb0a6('0x49')],'as':_0xb0a6('0x4a'),'required':![],'attributes':['id',_0xb0a6('0x2a'),'fullname']},{'model':db['CmContact'],'as':_0xb0a6('0x4b'),'required':![]},{'model':db[_0xb0a6('0x49')],'as':_0xb0a6('0x4c'),'attributes':['name',_0xb0a6('0x4d'),_0xb0a6('0x4e')],'required':![]},{'model':db['MailAccount'],'as':_0xb0a6('0x4f'),'attributes':[_0xb0a6('0x2a'),_0xb0a6('0x50'),'email'],'required':![]},{'model':db[_0xb0a6('0x44')],'as':_0xb0a6('0x51'),'attributes':['id','direction',_0xb0a6('0x45'),_0xb0a6('0x46')],'where':{'direction':'in','read':_0x543c33['query'][_0xb0a6('0x46')]||![]},'required':_0x543c33['query']['read']||![]},{'model':db[_0xb0a6('0x41')],'as':_0xb0a6('0x42'),'attributes':['id',_0xb0a6('0x2a'),_0xb0a6('0x52')],'required':_0x543c33[_0xb0a6('0x2d')][_0xb0a6('0x53')]?!![]:![]},{'model':db[_0xb0a6('0x41')],'as':_0xb0a6('0x54'),'attributes':['id',_0xb0a6('0x2a'),_0xb0a6('0x52')],'through':_0x543c33[_0xb0a6('0x2d')][_0xb0a6('0x53')]?{'attributes':[],'where':{'TagId':_0x543c33['query'][_0xb0a6('0x53')]||undefined}}:{},'required':_0x543c33[_0xb0a6('0x2d')][_0xb0a6('0x53')]?!![]:![]}];}return db['MailInteraction'][_0xb0a6('0x55')](_0x384522);})[_0xb0a6('0x26')](function(_0x442a48){_0x41b0f9[_0xb0a6('0x56')]=_0x442a48;return _0x41b0f9;})['then'](respondWithFilteredResult(_0x5e6012,_0x384522))[_0xb0a6('0x57')](handleError(_0x5e6012,null));};exports['show']=function(_0x2f9cda,_0x5da513){var _0x1a35d6={'raw':![],'where':{'id':_0x2f9cda[_0xb0a6('0x58')]['id']}},_0x3b6c6e={};_0x3b6c6e[_0xb0a6('0x2b')]=_[_0xb0a6('0x2c')](db[_0xb0a6('0x47')]['rawAttributes']);_0x3b6c6e[_0xb0a6('0x2d')]=_[_0xb0a6('0x2c')](_0x2f9cda['query']);_0x3b6c6e[_0xb0a6('0x38')]=_[_0xb0a6('0x30')](_0x3b6c6e[_0xb0a6('0x2b')],_0x3b6c6e['query']);_0x1a35d6[_0xb0a6('0x32')]=_['intersection'](_0x3b6c6e[_0xb0a6('0x2b')],qs[_0xb0a6('0x31')](_0x2f9cda[_0xb0a6('0x2d')][_0xb0a6('0x31')]));_0x1a35d6[_0xb0a6('0x32')]=_0x1a35d6[_0xb0a6('0x32')]['length']?_0x1a35d6['attributes']:_0x3b6c6e['model'];if(_0x2f9cda[_0xb0a6('0x2d')][_0xb0a6('0x48')]){_0x1a35d6[_0xb0a6('0x3f')]=[{'all':!![]}];}_0x1a35d6=_[_0xb0a6('0x3c')]({},_0x1a35d6,_0x2f9cda[_0xb0a6('0x3e')]);return db[_0xb0a6('0x47')][_0xb0a6('0x59')](_0x1a35d6)[_0xb0a6('0x26')](handleEntityNotFound(_0x5da513,null))[_0xb0a6('0x26')](respondWithResult(_0x5da513,null))[_0xb0a6('0x57')](handleError(_0x5da513,null));};exports['create']=function(_0x4cf73a,_0x56d83a){return db[_0xb0a6('0x47')][_0xb0a6('0x5a')](_0x4cf73a[_0xb0a6('0x5b')],{})[_0xb0a6('0x26')](respondWithResult(_0x56d83a,0xc9))['catch'](handleError(_0x56d83a,null));};exports[_0xb0a6('0x25')]=function(_0x4d2734,_0x323abd){if(_0x4d2734['body']['id']){delete _0x4d2734[_0xb0a6('0x5b')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x4d2734[_0xb0a6('0x58')]['id']}})[_0xb0a6('0x26')](handleEntityNotFound(_0x323abd,null))[_0xb0a6('0x26')](saveUpdates(_0x4d2734['body'],null))['then'](respondWithResult(_0x323abd,null))[_0xb0a6('0x57')](handleError(_0x323abd,null));};exports[_0xb0a6('0x5c')]=function(_0x64b032,_0x3fb30d){return db[_0xb0a6('0x47')][_0xb0a6('0x59')]({'where':{'id':_0x64b032[_0xb0a6('0x58')]['id']}})[_0xb0a6('0x26')](handleEntityNotFound(_0x3fb30d,null))[_0xb0a6('0x26')](removeEntity(_0x3fb30d,null))[_0xb0a6('0x57')](handleError(_0x3fb30d,null));};exports['describe']=function(_0xd4be77,_0x1cc4f2){return db[_0xb0a6('0x47')][_0xb0a6('0x5d')]()[_0xb0a6('0x26')](respondWithResult(_0x1cc4f2,null))[_0xb0a6('0x57')](handleError(_0x1cc4f2,null));};exports[_0xb0a6('0x5e')]=function(_0x52f8ed,_0x206700,_0x7ccdf8){return db[_0xb0a6('0x44')][_0xb0a6('0x59')]({'where':{'id':_0x52f8ed[_0xb0a6('0x58')]['id']}})[_0xb0a6('0x26')](handleEntityNotFound(_0x206700,null))[_0xb0a6('0x26')](function(_0x13bb4d){if(_0x13bb4d){return _0x13bb4d['addMessage'](_0x52f8ed[_0xb0a6('0x5b')][_0xb0a6('0x5f')],_[_0xb0a6('0x60')](_0x52f8ed[_0xb0a6('0x5b')],[_0xb0a6('0x5f'),'id'])||{});}})[_0xb0a6('0x26')](respondWithResult(_0x206700,null))[_0xb0a6('0x57')](handleError(_0x206700,null));};exports[_0xb0a6('0x61')]=function(_0x2f8b01,_0x4e4cba,_0x283e5f){var _0x40f96a={'raw':![],'where':{}};var _0x3fbdc7={};var _0x4523cc={'count':0x0,'rows':[]};return db['MailInteraction'][_0xb0a6('0x62')]({'where':{'id':_0x2f8b01[_0xb0a6('0x58')]['id']}})[_0xb0a6('0x26')](handleEntityNotFound(_0x4e4cba,null))['then'](function(_0x110e81){if(_0x110e81){_0x3fbdc7[_0xb0a6('0x2b')]=_[_0xb0a6('0x2c')](db[_0xb0a6('0x44')][_0xb0a6('0x63')]);_0x3fbdc7[_0xb0a6('0x2d')]=_['keys'](_0x2f8b01[_0xb0a6('0x2d')]);_0x3fbdc7[_0xb0a6('0x38')]=_[_0xb0a6('0x30')](_0x3fbdc7[_0xb0a6('0x2b')],_0x3fbdc7[_0xb0a6('0x2d')]);_0x40f96a[_0xb0a6('0x32')]=_[_0xb0a6('0x30')](_0x3fbdc7['model'],qs[_0xb0a6('0x31')](_0x2f8b01['query'][_0xb0a6('0x31')]));_0x40f96a['attributes']=_0x40f96a['attributes']['length']?_0x40f96a[_0xb0a6('0x32')]:_0x3fbdc7[_0xb0a6('0x2b')];if(!_0x2f8b01[_0xb0a6('0x2d')][_0xb0a6('0x33')](_0xb0a6('0x34'))){_0x40f96a[_0xb0a6('0x35')]=qs[_0xb0a6('0x35')](_0x2f8b01[_0xb0a6('0x2d')]['limit']);_0x40f96a['offset']=qs[_0xb0a6('0x1f')](_0x2f8b01[_0xb0a6('0x2d')][_0xb0a6('0x1f')]);}_0x40f96a[_0xb0a6('0x64')]=qs[_0xb0a6('0x36')](_0x2f8b01[_0xb0a6('0x2d')]['sort']);_0x40f96a[_0xb0a6('0x37')]=qs[_0xb0a6('0x38')](_[_0xb0a6('0x39')](_0x2f8b01['query'],_0x3fbdc7['filters']));_0x40f96a[_0xb0a6('0x37')][_0xb0a6('0x65')]=_0x110e81['id'];if(_0x2f8b01[_0xb0a6('0x2d')][_0xb0a6('0x3d')]){_0x40f96a['where']=_[_0xb0a6('0x3c')](_0x40f96a[_0xb0a6('0x37')],{'$or':_['map'](_0x40f96a[_0xb0a6('0x32')],function(_0x5aad8f){var _0x2b0fad={};_0x2b0fad[_0x5aad8f]={'$like':'%'+_0x2f8b01[_0xb0a6('0x2d')]['filter']+'%'};return _0x2b0fad;})});}if(_0x2f8b01[_0xb0a6('0x2d')][_0xb0a6('0x66')]){var _0x37c66c=_0x2f8b01[_0xb0a6('0x2d')][_0xb0a6('0x66')][_0xb0a6('0x67')](',');var _0x1e9ad4={};_0x1e9ad4[_0x37c66c[0x0]]={'$gte':moment(_0x37c66c[0x1])[_0xb0a6('0x68')](_0xb0a6('0x69'))};_0x40f96a[_0xb0a6('0x37')]=_['merge'](_0x40f96a[_0xb0a6('0x37')],_0x1e9ad4);}_0x40f96a=_[_0xb0a6('0x3c')]({},_0x40f96a,_0x2f8b01['options']);return db[_0xb0a6('0x44')][_0xb0a6('0x1e')]({'where':_0x40f96a['where']})[_0xb0a6('0x26')](function(_0xc4c6fe){_0x4523cc[_0xb0a6('0x1e')]=_0xc4c6fe;if(_0x2f8b01[_0xb0a6('0x2d')][_0xb0a6('0x48')]){_0x40f96a[_0xb0a6('0x3f')]=[{'all':!![]}];}return db[_0xb0a6('0x44')]['findAll'](_0x40f96a);})['then'](function(_0x7bb748){_0x4523cc[_0xb0a6('0x56')]=_0x7bb748;return _0x4523cc;});}})['then'](respondWithFilteredResult(_0x4e4cba,_0x40f96a))[_0xb0a6('0x57')](handleError(_0x4e4cba,null));};exports['addTags']=function(_0x3025fd,_0x1db940,_0x38af99){return db['MailInteraction'][_0xb0a6('0x59')]({'where':{'id':_0x3025fd[_0xb0a6('0x58')]['id']}})[_0xb0a6('0x26')](handleEntityNotFound(_0x1db940,null))[_0xb0a6('0x26')](function(_0x48545b){if(_0x48545b){return _0x48545b['setTags'](_0x3025fd[_0xb0a6('0x5b')][_0xb0a6('0x5f')],_[_0xb0a6('0x60')](_0x3025fd[_0xb0a6('0x5b')],['ids','id'])||{})[_0xb0a6('0x6a')](function(){return db[_0xb0a6('0x41')][_0xb0a6('0x55')]({'attributes':['id',_0xb0a6('0x2a'),_0xb0a6('0x52')],'where':{'id':_0x3025fd['body'][_0xb0a6('0x5f')]}});})[_0xb0a6('0x26')](function(_0x32d481){socket[_0xb0a6('0x6b')](_0xb0a6('0x6c'),{'id':Number(_0x3025fd[_0xb0a6('0x58')]['id']),'tags':_0x32d481||[]});return{'id':Number(_0x3025fd[_0xb0a6('0x58')]['id']),'tags':_0x32d481||[]};});}})[_0xb0a6('0x26')](respondWithResult(_0x1db940,null))['catch'](handleError(_0x1db940,null));};exports['removeTags']=function(_0x48a5a7,_0x24aacb,_0x11b4a0){var _0x3bc406;return db['MailInteraction'][_0xb0a6('0x59')]({'where':{'id':_0x48a5a7[_0xb0a6('0x58')]['id']}})[_0xb0a6('0x26')](handleEntityNotFound(_0x24aacb,null))['then'](function(_0x5119b6){if(_0x5119b6){return _0x5119b6[_0xb0a6('0x6d')](_0x48a5a7[_0xb0a6('0x2d')][_0xb0a6('0x5f')]);}})['then'](respondWithStatusCode(_0x24aacb,null))['catch'](handleError(_0x24aacb,null));};exports[_0xb0a6('0x6e')]=function(_0x3653ca,_0x18967d){var _0x2b6b3b=moment()[_0xb0a6('0x6f')]()[_0xb0a6('0x70')]();var _0x5ec6d6=path[_0xb0a6('0x71')](config[_0xb0a6('0x72')],_0xb0a6('0x73'),_0xb0a6('0x74'),_0xb0a6('0x75'));var _0x31cd15=path[_0xb0a6('0x71')](config['root'],_0xb0a6('0x73'),_0xb0a6('0x74'),_0xb0a6('0x76'));var _0x2a553f=path['join'](_0x31cd15,_0x2b6b3b);var _0x27a6e8=util[_0xb0a6('0x68')]('interaction-%s.zip',_0x2b6b3b);var _0x12b0a9=path[_0xb0a6('0x71')](_0x31cd15,_0x27a6e8);var _0x525c79=![];return db[_0xb0a6('0x47')][_0xb0a6('0x59')]({'where':{'id':_0x3653ca[_0xb0a6('0x58')]['id']}})[_0xb0a6('0x26')](handleEntityNotFound(_0x18967d,null))[_0xb0a6('0x26')](function(_0xd518e3){if(_0xd518e3){return _0xd518e3['getMessages']({'attributes':['id',_0xb0a6('0x5b'),_0xb0a6('0x77'),'to','cc',_0xb0a6('0x78'),'createdAt'],'where':{'secret':![]},'include':_0x3653ca[_0xb0a6('0x2d')][_0xb0a6('0x75')]?[{'model':db['Attachment'],'as':_0xb0a6('0x79')}]:undefined,'order':qs[_0xb0a6('0x36')]('id')});}return[];})[_0xb0a6('0x26')](function(_0x4588a7){_0x525c79=_0x4588a7[_0xb0a6('0x7a')];if(_0x4588a7[_0xb0a6('0x7a')]){fs[_0xb0a6('0x7b')](_0x2a553f);return BPromise[_0xb0a6('0x7c')](_0x4588a7,function(_0x9c3235,_0x155ae4){var _0x365159=_0x9c3235;var _0x39ba4b={'from':_0x365159[_0xb0a6('0x77')],'to':_0x365159['to'],'subject':_0x365159[_0xb0a6('0x78')],'html':_0x365159['body'],'attachments':[]};return new BPromise(function(_0x45e819,_0x5db01e){if(_0x9c3235[_0xb0a6('0x79')]){for(var _0x3bc076=0x0;_0x3bc076<_0x9c3235[_0xb0a6('0x79')]['length'];_0x3bc076++){var _0x21bd2b=_0x9c3235[_0xb0a6('0x79')][_0x3bc076];var _0x3137f6=path['join'](_0x5ec6d6,_0x21bd2b[_0xb0a6('0x7d')]);if(fs['existsSync'](_0x3137f6)){_0x39ba4b[_0xb0a6('0x75')]['push']({'name':_0x21bd2b['name'],'contentType':_0x21bd2b['type'],'data':fs[_0xb0a6('0x7e')](_0x3137f6)});}}}emlformat[_0xb0a6('0x7f')](_0x39ba4b,function(_0x4fdc89,_0x3ea771){if(_0x4fdc89)return _0x5db01e(_0x4fdc89);fs['writeFileSync'](path['join'](_0x2a553f,util[_0xb0a6('0x68')](_0xb0a6('0x80'),_0x155ae4)),_0x3ea771);return _0x45e819(_0x3ea771);});});});}})['then'](function(){if(_0x525c79){return new BPromise(function(_0x31ff57,_0x56d824){zipdir(_0x2a553f,{'saveTo':_0x12b0a9},function(_0x29f694,_0x22d1d1){if(_0x29f694)return _0x56d824(_0x29f694);return _0x31ff57(_0x22d1d1);});});}})[_0xb0a6('0x26')](function(){if(_0x525c79){return new BPromise(function(_0x489515,_0x65eb6a){rimraf(_0x2a553f,function(_0x42e93d){if(_0x42e93d)_0x65eb6a(_0x42e93d);return _0x489515();});});}})[_0xb0a6('0x26')](function(){if(_0x525c79){return _0x18967d[_0xb0a6('0x6e')](_0x12b0a9,_0x27a6e8,function(_0x27c935){if(_0x27c935){console[_0xb0a6('0x81')]('err',_0x27c935);}else{fs[_0xb0a6('0x82')](_0x12b0a9);}});}else{return _0x18967d['sendStatus'](0xc8);}})[_0xb0a6('0x57')](handleError(_0x18967d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a11fa44..bb21ba8 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 _0x96a6=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96a6,0xce));var _0x696a=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x96a6[_0x4243a3];return _0x1b2a33;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x696a('0x0'))['db'][_0x696a('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x696a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x696a('0x3')};function emitEvent(_0x3cc9cd){return function(_0x2d55c8,_0x215c99,_0x5389f6){MailInteractionEvents['emit'](_0x3cc9cd+':'+_0x2d55c8['id'],_0x2d55c8);MailInteractionEvents[_0x696a('0x4')](_0x3cc9cd,_0x2d55c8);_0x5389f6(null);};}for(var e in events){if(events[_0x696a('0x5')](e)){var event=events[e];MailInteraction[_0x696a('0x6')](e,emitEvent(event));}}module[_0x696a('0x7')]=MailInteractionEvents; \ No newline at end of file +var _0x87f4=['../../mysqldb','MailInteraction','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1e2cb5,_0x2bb2d8){var _0x411fa6=function(_0x280ff2){while(--_0x280ff2){_0x1e2cb5['push'](_0x1e2cb5['shift']());}};_0x411fa6(++_0x2bb2d8);}(_0x87f4,0xcf));var _0x487f=function(_0x294b7a,_0x51b167){_0x294b7a=_0x294b7a-0x0;var _0x30d2a3=_0x87f4[_0x294b7a];return _0x30d2a3;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x487f('0x0'))['db'][_0x487f('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x487f('0x2')](0x0);var events={'afterCreate':_0x487f('0x3'),'afterUpdate':'update','afterDestroy':_0x487f('0x4')};function emitEvent(_0xa2129d){return function(_0x25e980,_0x2aec26,_0x46725f){MailInteractionEvents[_0x487f('0x5')](_0xa2129d+':'+_0x25e980['id'],_0x25e980);MailInteractionEvents[_0x487f('0x5')](_0xa2129d,_0x25e980);_0x46725f(null);};}for(var e in events){if(events[_0x487f('0x6')](e)){var event=events[e];MailInteraction[_0x487f('0x7')](e,emitEvent(event));}}module[_0x487f('0x8')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 704c0f8..1a7d45f 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 _0xea04=['request-promise','./mailInteraction.attributes','exports','define','MailInteraction','lodash','util','../../config/logger','api','bluebird'];(function(_0x3899da,_0x371b8f){var _0x59923e=function(_0x52bff8){while(--_0x52bff8){_0x3899da['push'](_0x3899da['shift']());}};_0x59923e(++_0x371b8f);}(_0xea04,0x1d1));var _0x4ea0=function(_0x20118a,_0x3dbdf3){_0x20118a=_0x20118a-0x0;var _0x538b5f=_0xea04[_0x20118a];return _0x538b5f;};'use strict';var _=require(_0x4ea0('0x0'));var util=require(_0x4ea0('0x1'));var logger=require(_0x4ea0('0x2'))(_0x4ea0('0x3'));var moment=require('moment');var BPromise=require(_0x4ea0('0x4'));var rp=require(_0x4ea0('0x5'));var attributes=require(_0x4ea0('0x6'));module[_0x4ea0('0x7')]=function(_0x354404,_0x522d4e){return _0x354404[_0x4ea0('0x8')](_0x4ea0('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe397=['define','mail_interactions','lodash','util','../../config/logger','moment','bluebird','request-promise','./mailInteraction.attributes','exports'];(function(_0x49a2c3,_0x5a02e6){var _0x1d7778=function(_0xf1a790){while(--_0xf1a790){_0x49a2c3['push'](_0x49a2c3['shift']());}};_0x1d7778(++_0x5a02e6);}(_0xe397,0xac));var _0x7e39=function(_0x10c8d2,_0x23e0d4){_0x10c8d2=_0x10c8d2-0x0;var _0x521419=_0xe397[_0x10c8d2];return _0x521419;};'use strict';var _=require(_0x7e39('0x0'));var util=require(_0x7e39('0x1'));var logger=require(_0x7e39('0x2'))('api');var moment=require(_0x7e39('0x3'));var BPromise=require(_0x7e39('0x4'));var rp=require(_0x7e39('0x5'));var attributes=require(_0x7e39('0x6'));module[_0x7e39('0x7')]=function(_0x3ef9d0,_0x4b1081){return _0x3ef9d0[_0x7e39('0x8')]('MailInteraction',attributes,{'tableName':_0x7e39('0x9'),'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 4cf6cd7..af49482 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 _0x44c2=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','socket.io-emitter','redis','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags'];(function(_0x42be47,_0x40c821){var _0x21de76=function(_0x1a2f14){while(--_0x1a2f14){_0x42be47['push'](_0x42be47['shift']());}};_0x21de76(++_0x40c821);}(_0x44c2,0x100));var _0x244c=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x44c2[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x244c('0x0'));var util=require(_0x244c('0x1'));var moment=require(_0x244c('0x2'));var BPromise=require(_0x244c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x244c('0x4'));var db=require(_0x244c('0x5'))['db'];var utils=require(_0x244c('0x6'));var logger=require(_0x244c('0x7'))(_0x244c('0x8'));var config=require(_0x244c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x244c('0xa')]({'port':0x232a});config['redis']=_[_0x244c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x244c('0xc'))(new Redis(config[_0x244c('0xd')]));require('./mailInteraction.socket')[_0x244c('0xe')](socket);function respondWithRpcPromise(_0x5b873e,_0x519feb,_0x10a810){return new BPromise(function(_0x4d7289,_0x16c6f9){return client['request'](_0x5b873e,_0x10a810)[_0x244c('0xf')](function(_0x53c038){logger['info'](_0x244c('0x10'),_0x519feb,_0x244c('0x11'));logger[_0x244c('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x519feb,_0x244c('0x11'),JSON[_0x244c('0x13')](_0x53c038));if(_0x53c038[_0x244c('0x14')]){if(_0x53c038[_0x244c('0x14')][_0x244c('0x15')]===0x1f4){logger[_0x244c('0x14')](_0x244c('0x10'),_0x519feb,_0x53c038['error'][_0x244c('0x16')]);return _0x16c6f9(_0x53c038['error']['message']);}logger[_0x244c('0x14')](_0x244c('0x10'),_0x519feb,_0x53c038[_0x244c('0x14')][_0x244c('0x16')]);return _0x4d7289(_0x53c038['error'][_0x244c('0x16')]);}else{logger[_0x244c('0x17')](_0x244c('0x10'),_0x519feb,_0x244c('0x11'));_0x4d7289(_0x53c038[_0x244c('0x18')]['message']);}})[_0x244c('0x19')](function(_0x2af7eb){logger[_0x244c('0x14')]('MailInteraction,\x20%s,\x20%s',_0x519feb,_0x2af7eb);_0x16c6f9(_0x2af7eb);});});}exports['UpdateMailInteraction']=function(_0x4c7095){var _0x330719=this;return new Promise(function(_0x1d9711,_0x1ad17c){return db[_0x244c('0x1a')][_0x244c('0x1b')](_0x4c7095[_0x244c('0x1c')],{'raw':_0x4c7095['options']?_0x4c7095[_0x244c('0x1d')][_0x244c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c7095[_0x244c('0x1d')]?_0x4c7095['options'][_0x244c('0x1f')]||null:null,'attributes':_0x4c7095['options']?_0x4c7095['options'][_0x244c('0x20')]||null:null,'limit':_0x4c7095[_0x244c('0x1d')]?_0x4c7095['options'][_0x244c('0x21')]||null:null})[_0x244c('0xf')](function(_0x2147bf){logger[_0x244c('0x17')]('UpdateMailInteraction',_0x4c7095);logger[_0x244c('0x12')](_0x244c('0x22'),_0x4c7095,JSON[_0x244c('0x13')](_0x2147bf));_0x1d9711(_0x2147bf);})[_0x244c('0x19')](function(_0x40adde){logger['error']('UpdateMailInteraction',_0x40adde[_0x244c('0x16')],_0x4c7095);_0x1ad17c(_0x330719[_0x244c('0x14')](0x1f4,_0x40adde[_0x244c('0x16')]));});});};exports[_0x244c('0x23')]=function(_0x1edb58){return new Promise(function(_0x3fbf1e,_0x301111){return db[_0x244c('0x1a')][_0x244c('0x24')]({'where':_0x1edb58[_0x244c('0x1d')]?_0x1edb58['options']['where']||null:null})[_0x244c('0xf')](function(_0x27bcfe){if(_0x27bcfe){return _0x27bcfe[_0x244c('0x25')](_0x1edb58[_0x244c('0x1c')][_0x244c('0x26')],_[_0x244c('0x27')](_0x1edb58['body'],[_0x244c('0x26'),'id'])||{});}})[_0x244c('0x28')](function(_0x445a14){logger[_0x244c('0x17')](_0x244c('0x29'),_0x1edb58);logger[_0x244c('0x12')](_0x244c('0x29'),_0x1edb58,JSON[_0x244c('0x13')](_0x445a14));_0x3fbf1e(_0x445a14);})[_0x244c('0x19')](function(_0x349152){logger[_0x244c('0x14')](_0x244c('0x29'),_0x349152['message'],_0x1edb58);_0x301111(_this[_0x244c('0x14')](0x1f4,_0x349152[_0x244c('0x16')]));});});}; \ No newline at end of file +var _0x39c7=['AddTagsToMailInteraction','find','where','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','attributes','limit','stringify'];(function(_0x4f2ed2,_0x3389c9){var _0x5acadf=function(_0x5502f7){while(--_0x5502f7){_0x4f2ed2['push'](_0x4f2ed2['shift']());}};_0x5acadf(++_0x3389c9);}(_0x39c7,0x85));var _0x739c=function(_0x3f389f,_0x3f29e0){_0x3f389f=_0x3f389f-0x0;var _0x1f8796=_0x39c7[_0x3f389f];return _0x1f8796;};'use strict';var _=require('lodash');var util=require(_0x739c('0x0'));var moment=require(_0x739c('0x1'));var BPromise=require(_0x739c('0x2'));var rs=require(_0x739c('0x3'));var fs=require('fs');var Redis=require(_0x739c('0x4'));var db=require(_0x739c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x739c('0x6'))(_0x739c('0x7'));var config=require(_0x739c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x739c('0x9')]({'port':0x232a});config[_0x739c('0xa')]=_['defaults'](config['redis'],{'host':_0x739c('0xb'),'port':0x18eb});var socket=require(_0x739c('0xc'))(new Redis(config['redis']));require(_0x739c('0xd'))[_0x739c('0xe')](socket);function respondWithRpcPromise(_0x5a2a66,_0x530e42,_0xd334){return new BPromise(function(_0xed987a,_0x2a31bd){return client[_0x739c('0xf')](_0x5a2a66,_0xd334)[_0x739c('0x10')](function(_0x17ceae){logger[_0x739c('0x11')](_0x739c('0x12'),_0x530e42,_0x739c('0x13'));logger[_0x739c('0x14')](_0x739c('0x15'),_0x530e42,_0x739c('0x13'),JSON['stringify'](_0x17ceae));if(_0x17ceae[_0x739c('0x16')]){if(_0x17ceae[_0x739c('0x16')][_0x739c('0x17')]===0x1f4){logger[_0x739c('0x16')](_0x739c('0x12'),_0x530e42,_0x17ceae[_0x739c('0x16')][_0x739c('0x18')]);return _0x2a31bd(_0x17ceae[_0x739c('0x16')][_0x739c('0x18')]);}logger[_0x739c('0x16')]('MailInteraction,\x20%s,\x20%s',_0x530e42,_0x17ceae['error'][_0x739c('0x18')]);return _0xed987a(_0x17ceae[_0x739c('0x16')][_0x739c('0x18')]);}else{logger['info'](_0x739c('0x12'),_0x530e42,_0x739c('0x13'));_0xed987a(_0x17ceae[_0x739c('0x19')][_0x739c('0x18')]);}})[_0x739c('0x1a')](function(_0x5e412f){logger[_0x739c('0x16')](_0x739c('0x12'),_0x530e42,_0x5e412f);_0x2a31bd(_0x5e412f);});});}exports[_0x739c('0x1b')]=function(_0x4fc201){var _0x6554ff=this;return new Promise(function(_0x48fc13,_0x4a02b9){return db[_0x739c('0x1c')]['update'](_0x4fc201[_0x739c('0x1d')],{'raw':_0x4fc201[_0x739c('0x1e')]?_0x4fc201['options'][_0x739c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fc201['options']?_0x4fc201[_0x739c('0x1e')]['where']||null:null,'attributes':_0x4fc201[_0x739c('0x1e')]?_0x4fc201[_0x739c('0x1e')][_0x739c('0x20')]||null:null,'limit':_0x4fc201[_0x739c('0x1e')]?_0x4fc201[_0x739c('0x1e')][_0x739c('0x21')]||null:null})[_0x739c('0x10')](function(_0xd4fcb0){logger['info'](_0x739c('0x1b'),_0x4fc201);logger[_0x739c('0x14')]('UpdateMailInteraction',_0x4fc201,JSON[_0x739c('0x22')](_0xd4fcb0));_0x48fc13(_0xd4fcb0);})['catch'](function(_0x4ca46a){logger[_0x739c('0x16')](_0x739c('0x1b'),_0x4ca46a[_0x739c('0x18')],_0x4fc201);_0x4a02b9(_0x6554ff[_0x739c('0x16')](0x1f4,_0x4ca46a[_0x739c('0x18')]));});});};exports[_0x739c('0x23')]=function(_0x45a9be){return new Promise(function(_0x4b105e,_0x28d7a9){return db[_0x739c('0x1c')][_0x739c('0x24')]({'where':_0x45a9be[_0x739c('0x1e')]?_0x45a9be[_0x739c('0x1e')][_0x739c('0x25')]||null:null})[_0x739c('0x10')](function(_0x5635b2){if(_0x5635b2){return _0x5635b2['addTags'](_0x45a9be['body']['ids'],_[_0x739c('0x26')](_0x45a9be[_0x739c('0x1d')],[_0x739c('0x27'),'id'])||{});}})[_0x739c('0x28')](function(_0x22ad22){logger[_0x739c('0x11')](_0x739c('0x29'),_0x45a9be);logger[_0x739c('0x14')](_0x739c('0x29'),_0x45a9be,JSON[_0x739c('0x22')](_0x22ad22));_0x4b105e(_0x22ad22);})[_0x739c('0x1a')](function(_0xac8767){logger[_0x739c('0x16')](_0x739c('0x29'),_0xac8767[_0x739c('0x18')],_0x45a9be);_0x28d7a9(_this[_0x739c('0x16')](0x1f4,_0xac8767[_0x739c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6dc3b8f..9a4dddf 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 _0x207e=['remove','update','removeListener','register','length','mailInteraction:','save'];(function(_0x291104,_0x5e5f90){var _0x5b553a=function(_0x4761ab){while(--_0x4761ab){_0x291104['push'](_0x291104['shift']());}};_0x5b553a(++_0x5e5f90);}(_0x207e,0x19c));var _0xe207=function(_0x2edc03,_0x257c20){_0x2edc03=_0x2edc03-0x0;var _0xd2d157=_0x207e[_0x2edc03];return _0xd2d157;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xe207('0x0'),_0xe207('0x1'),_0xe207('0x2')];function createListener(_0x174a4e,_0x222172){return function(_0x7af053){_0x222172['emit'](_0x174a4e,_0x7af053);};}function removeListener(_0x302805,_0x3116dc){return function(){MailInteractionEvents[_0xe207('0x3')](_0x302805,_0x3116dc);};}exports[_0xe207('0x4')]=function(_0x3b5b27){for(var _0x29ea11=0x0,_0x3e2d7d=events[_0xe207('0x5')];_0x29ea11<_0x3e2d7d;_0x29ea11++){var _0x1e37b2=events[_0x29ea11];var _0x4799c9=createListener(_0xe207('0x6')+_0x1e37b2,_0x3b5b27);MailInteractionEvents['on'](_0x1e37b2,_0x4799c9);}}; \ No newline at end of file +var _0xc08a=['register','mailInteraction:','./mailInteraction.events','update','emit'];(function(_0x22eb95,_0x2d5ed7){var _0x4c1093=function(_0x325d11){while(--_0x325d11){_0x22eb95['push'](_0x22eb95['shift']());}};_0x4c1093(++_0x2d5ed7);}(_0xc08a,0x142));var _0xac08=function(_0x3b9195,_0x68c34e){_0x3b9195=_0x3b9195-0x0;var _0x4b1a36=_0xc08a[_0x3b9195];return _0x4b1a36;};'use strict';var MailInteractionEvents=require(_0xac08('0x0'));var events=['save','remove',_0xac08('0x1')];function createListener(_0x35049e,_0x4ebdf1){return function(_0x2c4a24){_0x4ebdf1[_0xac08('0x2')](_0x35049e,_0x2c4a24);};}function removeListener(_0x2dbf2c,_0x2a16f5){return function(){MailInteractionEvents['removeListener'](_0x2dbf2c,_0x2a16f5);};}exports[_0xac08('0x3')]=function(_0x1ec386){for(var _0x36f5dc=0x0,_0x2ca022=events['length'];_0x36f5dc<_0x2ca022;_0x36f5dc++){var _0x5982e4=events[_0x36f5dc];var _0x1bffad=createListener(_0xac08('0x4')+_0x5982e4,_0x1ec386);MailInteractionEvents['on'](_0x5982e4,_0x1bffad);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index dd373ff..2a73cd8 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 _0x207c=['put','/:id/accept','accept','reject','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','/describe','isAuthenticated','/:id','/:id/download','download','post','create'];(function(_0x1f3473,_0x46225f){var _0x24c055=function(_0x513d2d){while(--_0x513d2d){_0x1f3473['push'](_0x1f3473['shift']());}};_0x24c055(++_0x46225f);}(_0x207c,0x1e8));var _0xc207=function(_0x322efb,_0x539552){_0x322efb=_0x322efb-0x0;var _0x4245ca=_0x207c[_0x322efb];return _0x4245ca;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var auth=require(_0xc207('0x5'));var interaction=require(_0xc207('0x6'));var config=require('../../config/environment');var controller=require(_0xc207('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc207('0x8')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['describe']);router[_0xc207('0x8')](_0xc207('0xb'),auth[_0xc207('0xa')](),controller['show']);router[_0xc207('0x8')](_0xc207('0xc'),auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0xe')]('/',auth[_0xc207('0xa')](),interaction['tracked']('mail','mailmessage:create'),controller[_0xc207('0xf')]);router['put'](_0xc207('0xb'),auth[_0xc207('0xa')](),controller['update']);router[_0xc207('0x10')](_0xc207('0x11'),auth[_0xc207('0xa')](),controller[_0xc207('0x12')]);router[_0xc207('0x10')]('/:id/reject',auth[_0xc207('0xa')](),controller[_0xc207('0x13')]);router[_0xc207('0x14')](_0xc207('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeec6=['get','index','isAuthenticated','describe','/:id','show','/:id/download','tracked','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller'];(function(_0x122fa3,_0x2b398a){var _0x5624af=function(_0x3dce58){while(--_0x3dce58){_0x122fa3['push'](_0x122fa3['shift']());}};_0x5624af(++_0x2b398a);}(_0xeec6,0x1c2));var _0x6eec=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0xeec6[_0x32b993];return _0x482780;};'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['download']);router['post']('/',auth[_0x6eec('0xb')](),interaction[_0x6eec('0x10')]('mail','mailmessage:create'),controller[_0x6eec('0x11')]);router['put'](_0x6eec('0xd'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x12')]);router[_0x6eec('0x13')](_0x6eec('0x14'),auth['isAuthenticated'](),controller[_0x6eec('0x15')]);router[_0x6eec('0x13')](_0x6eec('0x16'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x17')]);router[_0x6eec('0x18')](_0x6eec('0xd'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x19')]);module[_0x6eec('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c8cf6b5..eade677 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 _0x2188=['long','ENUM','out','STRING','DATE','INTEGER','sequelize','TEXT'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x2188,0x1d6));var _0x8218=function(_0x6b4dab,_0x1f1c9a){_0x6b4dab=_0x6b4dab-0x0;var _0x42e1e2=_0x2188[_0x6b4dab];return _0x42e1e2;};'use strict';var Sequelize=require(_0x8218('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x8218('0x1')](_0x8218('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8218('0x3')]('in','out'),'defaultValue':_0x8218('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8218('0x5')](0xbe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x8218('0x2'))},'cc':{'type':Sequelize[_0x8218('0x1')](_0x8218('0x2'))},'bcc':{'type':Sequelize[_0x8218('0x1')](_0x8218('0x2'))},'subject':{'type':Sequelize[_0x8218('0x1')]},'sentAt':{'type':Sequelize[_0x8218('0x6')]},'attach':{'type':Sequelize[_0x8218('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8218('0x6')]},'originTo':{'type':Sequelize[_0x8218('0x1')](_0x8218('0x2'))},'originCc':{'type':Sequelize['TEXT'](_0x8218('0x2'))}}; \ No newline at end of file +var _0xbdf4=['exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','lodash'];(function(_0xb91b78,_0xb3890d){var _0x1bc3e8=function(_0xb70afb){while(--_0xb70afb){_0xb91b78['push'](_0xb91b78['shift']());}};_0x1bc3e8(++_0xb3890d);}(_0xbdf4,0x199));var _0x4bdf=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xbdf4[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4bdf('0x0'));module[_0x4bdf('0x1')]={'body':{'type':Sequelize[_0x4bdf('0x2')](_0x4bdf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4bdf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4bdf('0x5')]('in',_0x4bdf('0x6')),'defaultValue':_0x4bdf('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4bdf('0x7')](0xbe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x4bdf('0x2')](_0x4bdf('0x3'))},'cc':{'type':Sequelize[_0x4bdf('0x2')](_0x4bdf('0x3'))},'bcc':{'type':Sequelize[_0x4bdf('0x2')]('long')},'subject':{'type':Sequelize[_0x4bdf('0x2')]},'sentAt':{'type':Sequelize[_0x4bdf('0x8')]},'attach':{'type':Sequelize[_0x4bdf('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4bdf('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4bdf('0x8')]},'originTo':{'type':Sequelize[_0x4bdf('0x2')](_0x4bdf('0x3'))},'originCc':{'type':Sequelize[_0x4bdf('0x2')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6a04755..3bf42a1 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 _0x1663=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','client','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','json','offset','limit','set','Content-Range','reject','save','destroy','end','stack','send','MailMessage','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','add','day','merge','filter','map','count','include','findAll','rows','show','params','length','options','update','body','find','describe','create','direction','out','MailAccount','MailAccountId','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','pass','service','attachments','name','join','server/files/attachments','SendMail','messageId','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','MailInteraction','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','agent','MailInteractionId','RejectMessage','rejectMessage','download','unix','root','server','tmp','files','message-%s.eml','from','createdAt','Attachment','subject','Attachments','push','readFileSync','build','writeFileSync','err','unlinkSync','eml-format','zip-dir','request-promise'];(function(_0x581bdf,_0x11d27f){var _0x44e862=function(_0x2f14f9){while(--_0x2f14f9){_0x581bdf['push'](_0x581bdf['shift']());}};_0x44e862(++_0x11d27f);}(_0x1663,0x95));var _0x3166=function(_0x203b16,_0x418af6){_0x203b16=_0x203b16-0x0;var _0x5c8785=_0x1663[_0x203b16];return _0x5c8785;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3166('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3166('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3166('0x2'));var moment=require(_0x3166('0x3'));var BPromise=require(_0x3166('0x4'));var Mustache=require(_0x3166('0x5'));var util=require(_0x3166('0x6'));var path=require(_0x3166('0x7'));var sox=require(_0x3166('0x8'));var csv=require(_0x3166('0x9'));var ejs=require(_0x3166('0xa'));var fs=require('fs');var _=require(_0x3166('0xb'));var squel=require(_0x3166('0xc'));var crypto=require(_0x3166('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3166('0x9'));var querystring=require(_0x3166('0xe'));var Papa=require(_0x3166('0xf'));var Redis=require('ioredis');var qs=require(_0x3166('0x10'));var logger=require(_0x3166('0x11'))(_0x3166('0x12'));var utils=require(_0x3166('0x13'));var config=require('../../config/environment');var db=require(_0x3166('0x14'))['db'];config[_0x3166('0x15')]=_['defaults'](config['redis'],{'host':_0x3166('0x16'),'port':0x18eb});var socket=require(_0x3166('0x17'))(new Redis(config[_0x3166('0x15')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x3166('0x18'));var client=jayson['client'][_0x3166('0x19')]({'port':0x232c});var client9003=jayson[_0x3166('0x1a')]['http']({'port':0x232b});var client9002=jayson[_0x3166('0x1a')][_0x3166('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5745a9,_0x1d1ad4,_0x45cc46,_0x572f51){return new BPromise(function(_0x4a40f0,_0x5489b1){var _0x3603e8=_0x572f51||client;return _0x3603e8['request'](_0x5745a9,_0x45cc46)[_0x3166('0x1b')](function(_0x8e7cb5){logger[_0x3166('0x1c')](_0x3166('0x1d'),_0x1d1ad4,_0x3166('0x1e'));logger[_0x3166('0x1f')](_0x3166('0x20'),_0x1d1ad4,_0x3166('0x1e'),JSON[_0x3166('0x21')](_0x8e7cb5));if(_0x8e7cb5[_0x3166('0x22')]){if(_0x8e7cb5[_0x3166('0x22')][_0x3166('0x23')]===0x1f4){logger[_0x3166('0x22')](_0x3166('0x1d'),_0x1d1ad4,_0x8e7cb5[_0x3166('0x22')][_0x3166('0x24')]);return _0x5489b1(_0x8e7cb5[_0x3166('0x22')][_0x3166('0x24')]);}logger['error'](_0x3166('0x1d'),_0x1d1ad4,_0x8e7cb5[_0x3166('0x22')][_0x3166('0x24')]);return _0x4a40f0(_0x8e7cb5['error']['message']);}else{logger[_0x3166('0x1c')](_0x3166('0x1d'),_0x1d1ad4,_0x3166('0x1e'));_0x4a40f0(_0x8e7cb5[_0x3166('0x25')]['message']);}})[_0x3166('0x26')](function(_0x306d30){logger[_0x3166('0x22')](_0x3166('0x1d'),_0x1d1ad4,_0x306d30);_0x5489b1(_0x306d30);});});}function respondWithStatusCode(_0x54e340,_0x5c9971){_0x5c9971=_0x5c9971||0xcc;return function(_0x45084a){if(_0x45084a){return _0x54e340[_0x3166('0x27')](_0x5c9971);}return _0x54e340[_0x3166('0x28')](_0x5c9971)['end']();};}function respondWithResult(_0x58c00d,_0x5caa79){_0x5caa79=_0x5caa79||0xc8;return function(_0x525f15){if(_0x525f15){return _0x58c00d[_0x3166('0x28')](_0x5caa79)[_0x3166('0x29')](_0x525f15);}};}function respondWithFilteredResult(_0x14bd96,_0x5ab02e){return function(_0x1e7655){if(_0x1e7655){var _0x10f164=_0x1e7655['count'],_0x2f8312=_0x5ab02e[_0x3166('0x2a')],_0x159f94=_0x5ab02e[_0x3166('0x2a')]+_0x5ab02e[_0x3166('0x2b')],_0x2a87d9;if(_0x159f94>=_0x10f164){_0x159f94=_0x10f164;_0x2a87d9=0xc8;}else{_0x2a87d9=0xce;}_0x14bd96[_0x3166('0x28')](_0x2a87d9);return _0x14bd96[_0x3166('0x2c')](_0x3166('0x2d'),_0x2f8312+'-'+_0x159f94+'/'+_0x10f164)[_0x3166('0x29')](_0x1e7655);}return null;};}function patchUpdates(_0x2e7b29){return function(_0x1a28ee){try{jsonpatch['apply'](_0x1a28ee,_0x2e7b29,!![]);}catch(_0x3d1ba7){return BPromise[_0x3166('0x2e')](_0x3d1ba7);}return _0x1a28ee[_0x3166('0x2f')]();};}function saveUpdates(_0x33a489,_0x1af8ad){return function(_0x2cdac5){if(_0x2cdac5){return _0x2cdac5['update'](_0x33a489)[_0x3166('0x1b')](function(_0x1b7ab8){return _0x1b7ab8;});}return null;};}function removeEntity(_0x3b067a,_0x50e714){return function(_0x1a64af){if(_0x1a64af){return _0x1a64af[_0x3166('0x30')]()[_0x3166('0x1b')](function(){_0x3b067a[_0x3166('0x28')](0xcc)[_0x3166('0x31')]();});}};}function handleEntityNotFound(_0x25cd33,_0x452f06){return function(_0x117a98){if(!_0x117a98){_0x25cd33['sendStatus'](0x194);}return _0x117a98;};}function handleError(_0x3411b2,_0x565fea){_0x565fea=_0x565fea||0x1f4;return function(_0x449f88){logger[_0x3166('0x22')](_0x449f88[_0x3166('0x32')]);if(_0x449f88['name']){delete _0x449f88['name'];}_0x3411b2['status'](_0x565fea)[_0x3166('0x33')](_0x449f88);};}exports['index']=function(_0x40f386,_0x23ce11){var _0x531372={},_0x15d5dc={},_0x89c676={'count':0x0,'rows':[]};var _0x4236d2=db[_0x3166('0x34')][_0x3166('0x35')];_0x15d5dc[_0x3166('0x36')]=_[_0x3166('0x37')](_0x4236d2);var _0x2c0380={'dateStart':_0x40f386[_0x3166('0x38')][_0x3166('0x39')],'dateEnd':_0x40f386['query'][_0x3166('0x3a')]};delete _0x40f386[_0x3166('0x38')][_0x3166('0x39')];delete _0x40f386[_0x3166('0x38')][_0x3166('0x3a')];_0x15d5dc[_0x3166('0x38')]=_[_0x3166('0x37')](_0x40f386[_0x3166('0x38')]);_0x15d5dc['filters']=_[_0x3166('0x3b')](_0x15d5dc[_0x3166('0x36')],_0x15d5dc[_0x3166('0x38')]);_0x531372['attributes']=_[_0x3166('0x3b')](_0x15d5dc['model'],qs[_0x3166('0x3c')](_0x40f386[_0x3166('0x38')][_0x3166('0x3c')]));_0x531372[_0x3166('0x3d')]=_0x531372[_0x3166('0x3d')]['length']?_0x531372[_0x3166('0x3d')]:_0x15d5dc[_0x3166('0x36')];if(!_0x40f386[_0x3166('0x38')][_0x3166('0x3e')]('nolimit')){_0x531372[_0x3166('0x2b')]=qs[_0x3166('0x2b')](_0x40f386['query'][_0x3166('0x2b')]);_0x531372[_0x3166('0x2a')]=qs[_0x3166('0x2a')](_0x40f386['query'][_0x3166('0x2a')]);}_0x531372['order']=qs[_0x3166('0x3f')](_0x40f386[_0x3166('0x38')][_0x3166('0x3f')]);_0x531372[_0x3166('0x40')]=qs[_0x3166('0x41')](_[_0x3166('0x42')](_0x40f386[_0x3166('0x38')],_0x15d5dc['filters']));if(_0x2c0380[_0x3166('0x39')]){if(_0x2c0380[_0x3166('0x3a')]){_0x2c0380['dateEnd']=moment(_0x2c0380[_0x3166('0x3a')])[_0x3166('0x43')](0x1,_0x3166('0x44'));}else{_0x2c0380[_0x3166('0x3a')]=moment(_0x2c0380[_0x3166('0x39')])[_0x3166('0x43')](0x1,_0x3166('0x44'));}_[_0x3166('0x45')](_0x531372[_0x3166('0x40')],{'createdAt':{'$gte':_0x2c0380[_0x3166('0x39')],'$lte':_0x2c0380[_0x3166('0x3a')]}});}if(_0x40f386[_0x3166('0x38')][_0x3166('0x46')]){_0x531372[_0x3166('0x40')]=_['merge'](_0x531372[_0x3166('0x40')],{'$or':_[_0x3166('0x47')](_0x531372['attributes'],function(_0x18f460){var _0x2bb7f0={};_0x2bb7f0[_0x18f460]={'$like':'%'+_0x40f386[_0x3166('0x38')][_0x3166('0x46')]+'%'};return _0x2bb7f0;})});}_0x531372=_[_0x3166('0x45')]({},_0x531372,_0x40f386['options']);var _0x3cee2d={'where':_0x531372[_0x3166('0x40')]};return db[_0x3166('0x34')][_0x3166('0x48')](_0x3cee2d)[_0x3166('0x1b')](function(_0x237b5b){_0x89c676[_0x3166('0x48')]=_0x237b5b;if(_0x40f386[_0x3166('0x38')]['includeAll']){_0x531372[_0x3166('0x49')]=[{'all':!![]}];}return db[_0x3166('0x34')][_0x3166('0x4a')](_0x531372);})[_0x3166('0x1b')](function(_0x325b6c){_0x89c676[_0x3166('0x4b')]=_0x325b6c;return _0x89c676;})[_0x3166('0x1b')](respondWithFilteredResult(_0x23ce11,_0x531372))[_0x3166('0x26')](handleError(_0x23ce11,null));};exports[_0x3166('0x4c')]=function(_0x4b4d4b,_0x897dc1){var _0x1268b3={'raw':!![],'where':{'id':_0x4b4d4b[_0x3166('0x4d')]['id']}},_0x162c5f={};_0x162c5f['model']=_[_0x3166('0x37')](db[_0x3166('0x34')][_0x3166('0x35')]);_0x162c5f[_0x3166('0x38')]=_[_0x3166('0x37')](_0x4b4d4b[_0x3166('0x38')]);_0x162c5f[_0x3166('0x41')]=_[_0x3166('0x3b')](_0x162c5f[_0x3166('0x36')],_0x162c5f[_0x3166('0x38')]);_0x1268b3[_0x3166('0x3d')]=_[_0x3166('0x3b')](_0x162c5f[_0x3166('0x36')],qs[_0x3166('0x3c')](_0x4b4d4b['query'][_0x3166('0x3c')]));_0x1268b3[_0x3166('0x3d')]=_0x1268b3[_0x3166('0x3d')][_0x3166('0x4e')]?_0x1268b3[_0x3166('0x3d')]:_0x162c5f['model'];if(_0x4b4d4b[_0x3166('0x38')]['includeAll']){_0x1268b3[_0x3166('0x49')]=[{'all':!![]}];}_0x1268b3=_[_0x3166('0x45')]({},_0x1268b3,_0x4b4d4b[_0x3166('0x4f')]);return db['MailMessage']['find'](_0x1268b3)[_0x3166('0x1b')](handleEntityNotFound(_0x897dc1,null))['then'](respondWithResult(_0x897dc1,null))[_0x3166('0x26')](handleError(_0x897dc1,null));};exports[_0x3166('0x50')]=function(_0x11d91e,_0x29d6f2){if(_0x11d91e['body']['id']){delete _0x11d91e[_0x3166('0x51')]['id'];}return db[_0x3166('0x34')][_0x3166('0x52')]({'where':{'id':_0x11d91e[_0x3166('0x4d')]['id']}})[_0x3166('0x1b')](handleEntityNotFound(_0x29d6f2,null))['then'](saveUpdates(_0x11d91e['body'],null))[_0x3166('0x1b')](respondWithResult(_0x29d6f2,null))['catch'](handleError(_0x29d6f2,null));};exports[_0x3166('0x30')]=function(_0x1c17ba,_0x4f1f69){return db[_0x3166('0x34')][_0x3166('0x52')]({'where':{'id':_0x1c17ba[_0x3166('0x4d')]['id']}})[_0x3166('0x1b')](handleEntityNotFound(_0x4f1f69,null))['then'](removeEntity(_0x4f1f69,null))[_0x3166('0x26')](handleError(_0x4f1f69,null));};exports[_0x3166('0x53')]=function(_0x54546c,_0x48e747){return db[_0x3166('0x34')][_0x3166('0x53')]()[_0x3166('0x1b')](respondWithResult(_0x48e747,null))[_0x3166('0x26')](handleError(_0x48e747,null));};exports[_0x3166('0x54')]=function(_0x2ec45d,_0x30c23f){return db[_0x3166('0x34')][_0x3166('0x54')](_0x2ec45d[_0x3166('0x51')])['then'](function(_0x135d36){if(_0x135d36){if(_0x135d36[_0x3166('0x55')]===_0x3166('0x56')&&!_0x135d36['secret']){return db[_0x3166('0x57')]['findOne']({'where':{'id':_0x135d36[_0x3166('0x58')]},'include':[{'model':db[_0x3166('0x59')],'as':_0x3166('0x5a'),'raw':!![]}]})[_0x3166('0x1b')](function(_0x42d322){if(_0x42d322&&_0x42d322[_0x3166('0x5a')]){var _0x37806a={'tls':{'rejectUnauthorized':![]}};if(_[_0x3166('0x5b')](_0x42d322[_0x3166('0x5a')]['service'])){_0x37806a[_0x3166('0x5c')]=_0x42d322[_0x3166('0x5a')]['host'];_0x37806a[_0x3166('0x5d')]=_0x42d322[_0x3166('0x5a')][_0x3166('0x5d')];_0x37806a[_0x3166('0x5e')]=_0x42d322[_0x3166('0x5a')][_0x3166('0x5e')];if(_0x42d322[_0x3166('0x5a')][_0x3166('0x5f')]){_0x37806a[_0x3166('0x60')]={'user':_0x42d322[_0x3166('0x5a')][_0x3166('0x61')],'pass':_0x42d322[_0x3166('0x5a')][_0x3166('0x62')]};}}else{_0x37806a[_0x3166('0x63')]=_0x42d322['Smtp']['service'];_0x37806a['auth']={'user':_0x42d322[_0x3166('0x5a')][_0x3166('0x61')],'pass':_0x42d322[_0x3166('0x5a')][_0x3166('0x62')]};_0x37806a[_0x3166('0x5e')]=_0x42d322[_0x3166('0x5a')][_0x3166('0x5e')];}if(_0x2ec45d[_0x3166('0x51')][_0x3166('0x64')]&&_0x2ec45d[_0x3166('0x51')]['attachments'][_0x3166('0x4e')]){for(var _0x2f09a0=0x0;_0x2f09a0<_0x2ec45d['body'][_0x3166('0x64')][_0x3166('0x4e')];_0x2f09a0+=0x1){_0x2ec45d[_0x3166('0x51')][_0x3166('0x64')][_0x2f09a0]={'filename':_0x2ec45d[_0x3166('0x51')][_0x3166('0x64')][_0x2f09a0][_0x3166('0x65')],'path':path[_0x3166('0x66')](config['root'],_0x3166('0x67'),_0x2ec45d[_0x3166('0x51')]['attachments'][_0x2f09a0]['basename'])};}}return{'account':_0x37806a,'message':_0x2ec45d[_0x3166('0x51')]};}})[_0x3166('0x1b')](function(_0x16d35c){if(_0x16d35c){return respondWithRpcPromise(_0x3166('0x68'),'sendMail',_0x16d35c,client9003)[_0x3166('0x1b')](function(_0x221868){return _0x135d36[_0x3166('0x50')]({'read':!![],'messageId':_0x221868[_0x3166('0x69')],'sentAt':moment()[_0x3166('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x3166('0x26')](function(_0x1f2bb4){logger[_0x3166('0x22')]('%s',JSON['stringify'](_0x1f2bb4));return _0x135d36;});}return _0x135d36;});}return _0x135d36;}})[_0x3166('0x1b')](respondWithResult(_0x30c23f,0xc9))['catch'](handleError(_0x30c23f,null));};var interaction_log=require(_0x3166('0x11'))('mail-interactions');exports[_0x3166('0x6b')]=function(_0x253530,_0x2498bd,_0xfd2f8b){var _0x5af662={'channel':_0x3166('0x6c')};if(_0x253530[_0x3166('0x51')]['id']){delete _0x253530[_0x3166('0x51')]['id'];}_0x253530['body'][_0x3166('0x6d')]=!![];_0x253530[_0x3166('0x51')][_0x3166('0x6e')]=moment()[_0x3166('0x6a')](_0x3166('0x6f'));_0x253530[_0x3166('0x51')][_0x3166('0x70')]=_0x253530[_0x3166('0x51')]['UserId']||_0x253530[_0x3166('0x61')]['id'];return db[_0x3166('0x34')][_0x3166('0x52')]({'where':{'id':_0x253530[_0x3166('0x4d')]['id'],'UserId':null},'include':[{'model':db[_0x3166('0x71')],'as':_0x3166('0x72')}]})[_0x3166('0x1b')](handleEntityNotFound(_0x2498bd,null))[_0x3166('0x1b')](saveUpdates(_0x253530[_0x3166('0x51')],null))[_0x3166('0x1b')](function(_0x5d95b5){if(_0x5d95b5){_0x5af662[_0x3166('0x24')]=_0x5d95b5['get']({'plain':!![]});return db[_0x3166('0x73')][_0x3166('0x52')]({'where':{'id':_0x5d95b5['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2498bd,null))[_0x3166('0x1b')](function(_0x1dc026){if(_0x1dc026){return _0x1dc026[_0x3166('0x50')]({'UserId':_0x253530['body'][_0x3166('0x70')],'read1stAt':_[_0x3166('0x5b')](_0x1dc026[_0x3166('0x74')])?moment()[_0x3166('0x6a')](_0x3166('0x6f')):undefined});}return null;})[_0x3166('0x1b')](function(_0x4c7a62){if(_0x4c7a62){_0x5af662[_0x3166('0x75')]=_0x4c7a62[_0x3166('0x76')]({'plain':!![]});interaction_log[_0x3166('0x1c')](_0x3166('0x77'),_0x253530['user']['id'],_0x253530['user'][_0x3166('0x65')],_0x253530[_0x3166('0x61')][_0x3166('0x78')],_0x5af662[_0x3166('0x75')]['id'],_0x253530[_0x3166('0x51')]?JSON[_0x3166('0x21')](_0x253530[_0x3166('0x51')]):_0x3166('0x79'));return respondWithRpcPromise('AcceptMessage',_0x3166('0x7a'),_0x5af662);}return null;})['then'](function(_0x4db484){if(_0x4db484){if(_0x253530[_0x3166('0x51')]['manual']){_0x5af662['message'][_0x3166('0x7b')]=util[_0x3166('0x6a')](_0x3166('0x7c'),_0x253530[_0x3166('0x61')][_0x3166('0x65')]);_0x5af662[_0x3166('0x24')][_0x3166('0x7d')]=_0x5af662['channel'];_0x5af662[_0x3166('0x24')][_0x3166('0x7e')]='accept';return respondWithRpcPromise(_0x3166('0x7f'),_0x3166('0x7f'),{'event':_0x3166('0x80'),'message':_0x5af662[_0x3166('0x24')]},client9002)[_0x3166('0x1b')](function(){return _0x5af662;});}return _0x5af662;}return null;})[_0x3166('0x1b')](respondWithResult(_0x2498bd,null))[_0x3166('0x26')](handleError(_0x2498bd,null));};var interaction_log=require('../../config/logger')(_0x3166('0x81'));exports[_0x3166('0x2e')]=function(_0x2c9eb1,_0x4b3f48,_0x2f6086){var _0x39ecc6={'agent':{},'channel':_0x3166('0x6c')};if(_0x2c9eb1[_0x3166('0x51')]['id']){delete _0x2c9eb1['body']['id'];}_0x2c9eb1[_0x3166('0x51')][_0x3166('0x70')]=_0x2c9eb1[_0x3166('0x51')][_0x3166('0x70')]||_0x2c9eb1['user']['id'];_0x39ecc6[_0x3166('0x82')]['id']=_0x2c9eb1['body'][_0x3166('0x70')];return db['MailMessage']['find']({'where':{'id':_0x2c9eb1[_0x3166('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4b3f48,null))[_0x3166('0x1b')](function(_0x53a557){if(_0x53a557){_0x39ecc6[_0x3166('0x24')]=_0x53a557['get']({'plain':!![]});return db[_0x3166('0x73')][_0x3166('0x52')]({'where':{'id':_0x53a557[_0x3166('0x83')]}});}return null;})[_0x3166('0x1b')](handleEntityNotFound(_0x4b3f48,null))[_0x3166('0x1b')](function(_0x236b9d){if(_0x236b9d){_0x39ecc6['interaction']=_0x236b9d['get']({'plain':!![]});interaction_log[_0x3166('0x1c')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c9eb1['user']['id'],_0x2c9eb1['user']['name'],_0x2c9eb1[_0x3166('0x61')]['role'],_0x39ecc6[_0x3166('0x75')]['id'],_0x2c9eb1[_0x3166('0x51')]?JSON[_0x3166('0x21')](_0x2c9eb1[_0x3166('0x51')]):_0x3166('0x79'));return respondWithRpcPromise(_0x3166('0x84'),_0x3166('0x85'),_0x39ecc6);}return null;})[_0x3166('0x1b')](function(_0x28adac){if(_0x28adac){_0x28adac[_0x3166('0x24')][_0x3166('0x7b')]=util['format'](_0x3166('0x7c'),_0x2c9eb1[_0x3166('0x61')][_0x3166('0x65')]);_0x28adac[_0x3166('0x24')][_0x3166('0x7d')]=_0x39ecc6[_0x3166('0x7d')];_0x28adac[_0x3166('0x24')][_0x3166('0x7e')]=_0x3166('0x2e');respondWithRpcPromise(_0x3166('0x7f'),_0x3166('0x7f'),{'event':'rejectmessage','message':_0x28adac[_0x3166('0x24')]},client9002);return _0x39ecc6;}return null;})['then'](respondWithResult(_0x4b3f48,null))[_0x3166('0x26')](handleError(_0x4b3f48,null));};exports[_0x3166('0x86')]=function(_0x107c14,_0x56b48d){var _0x3a0293=moment()[_0x3166('0x87')]()['toString']();var _0x6a0606=path[_0x3166('0x66')](config[_0x3166('0x88')],_0x3166('0x89'),'files',_0x3166('0x8a'));var _0x2e9dea=path[_0x3166('0x66')](config[_0x3166('0x88')],'server',_0x3166('0x8b'),_0x3166('0x64'));var _0x2ef36e=util[_0x3166('0x6a')](_0x3166('0x8c'),_0x3a0293);return db[_0x3166('0x34')][_0x3166('0x52')]({'where':{'id':_0x107c14[_0x3166('0x4d')]['id']},'attributes':['id',_0x3166('0x51'),_0x3166('0x8d'),'to','cc','subject',_0x3166('0x8e')],'include':_0x107c14[_0x3166('0x38')][_0x3166('0x64')]?[{'model':db[_0x3166('0x8f')],'as':'Attachments'}]:undefined})[_0x3166('0x1b')](handleEntityNotFound(_0x56b48d,null))[_0x3166('0x1b')](function(_0xe37385){if(_0xe37385){var _0x2d41b5=_0xe37385;var _0x40dc7c={'from':_0x2d41b5[_0x3166('0x8d')],'to':_0x2d41b5['to'],'subject':_0x2d41b5[_0x3166('0x90')],'html':_0x2d41b5[_0x3166('0x51')],'attachments':[]};return new BPromise(function(_0x2652c4,_0x589d2d){if(_0xe37385[_0x3166('0x91')]){for(var _0x5d659e=0x0;_0x5d659e<_0xe37385['Attachments']['length'];_0x5d659e++){var _0x5401fa=_0xe37385[_0x3166('0x91')][_0x5d659e];var _0x3f8ae9=path[_0x3166('0x66')](_0x2e9dea,_0x5401fa['basename']);if(fs['existsSync'](_0x3f8ae9)){_0x40dc7c[_0x3166('0x64')][_0x3166('0x92')]({'name':_0x5401fa['name'],'contentType':_0x5401fa['type'],'data':fs[_0x3166('0x93')](_0x3f8ae9)});}}}emlformat[_0x3166('0x94')](_0x40dc7c,function(_0x3a9662,_0x12b010){if(_0x3a9662)return _0x589d2d(_0x3a9662);fs[_0x3166('0x95')](path[_0x3166('0x66')](_0x6a0606,_0x2ef36e),_0x12b010);return _0x2652c4(_0x12b010);});});}})[_0x3166('0x1b')](function(_0x464bf4){if(_0x464bf4){return _0x56b48d[_0x3166('0x86')](path[_0x3166('0x66')](_0x6a0606,_0x2ef36e),_0x2ef36e,function(_0x30c9a3){if(_0x30c9a3){console['log'](_0x3166('0x96'),_0x30c9a3);}else{fs[_0x3166('0x97')](path[_0x3166('0x66')](_0x6a0606,_0x2ef36e));}});}})[_0x3166('0x26')](handleError(_0x56b48d,null));}; \ No newline at end of file +var _0x1985=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','destroy','then','end','stack','name','MailMessage','model','keys','query','dateStart','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','dateEnd','add','day','merge','map','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','body','find','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','SendMail','update','messageId','stringify','mail-interactions','mail','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','subject','Attachment','Attachments','basename','push','type','build','writeFileSync','log','err','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0xcc2db9,_0x3e9eb0){var _0x3385a5=function(_0x1e83fa){while(--_0x1e83fa){_0xcc2db9['push'](_0xcc2db9['shift']());}};_0x3385a5(++_0x3e9eb0);}(_0x1985,0x138));var _0x5198=function(_0x12a2f8,_0x46e9cd){_0x12a2f8=_0x12a2f8-0x0;var _0x1f9362=_0x1985[_0x12a2f8];return _0x1f9362;};'use strict';var pdf=require(_0x5198('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5198('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5198('0x2'));var rp=require(_0x5198('0x3'));var moment=require(_0x5198('0x4'));var BPromise=require(_0x5198('0x5'));var Mustache=require(_0x5198('0x6'));var util=require('util');var path=require(_0x5198('0x7'));var sox=require(_0x5198('0x8'));var csv=require(_0x5198('0x9'));var ejs=require(_0x5198('0xa'));var fs=require('fs');var _=require(_0x5198('0xb'));var squel=require(_0x5198('0xc'));var crypto=require(_0x5198('0xd'));var jsforce=require(_0x5198('0xe'));var deskjs=require(_0x5198('0xf'));var toCsv=require(_0x5198('0x9'));var querystring=require(_0x5198('0x10'));var Papa=require(_0x5198('0x11'));var Redis=require('ioredis');var qs=require(_0x5198('0x12'));var logger=require(_0x5198('0x13'))(_0x5198('0x14'));var utils=require(_0x5198('0x15'));var config=require(_0x5198('0x16'));var db=require(_0x5198('0x17'))['db'];config[_0x5198('0x18')]=_[_0x5198('0x19')](config[_0x5198('0x18')],{'host':_0x5198('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5198('0x1b'))[_0x5198('0x1c')](socket);var jayson=require(_0x5198('0x1d'));var client=jayson[_0x5198('0x1e')]['http']({'port':0x232c});var client9003=jayson[_0x5198('0x1e')]['http']({'port':0x232b});var client9002=jayson[_0x5198('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x269c05,_0x3effdb,_0x5b7146,_0x175532){return new BPromise(function(_0x50e61b,_0xd3671){var _0xfb7f40=_0x175532||client;return _0xfb7f40[_0x5198('0x1f')](_0x269c05,_0x5b7146)['then'](function(_0x32898b){logger['info'](_0x5198('0x20'),_0x3effdb,_0x5198('0x21'));logger[_0x5198('0x22')](_0x5198('0x23'),_0x3effdb,_0x5198('0x21'),JSON['stringify'](_0x32898b));if(_0x32898b['error']){if(_0x32898b[_0x5198('0x24')]['code']===0x1f4){logger[_0x5198('0x24')](_0x5198('0x20'),_0x3effdb,_0x32898b['error'][_0x5198('0x25')]);return _0xd3671(_0x32898b[_0x5198('0x24')]['message']);}logger[_0x5198('0x24')]('MailMessage,\x20%s,\x20%s',_0x3effdb,_0x32898b['error']['message']);return _0x50e61b(_0x32898b[_0x5198('0x24')]['message']);}else{logger[_0x5198('0x26')](_0x5198('0x20'),_0x3effdb,'request\x20sent');_0x50e61b(_0x32898b[_0x5198('0x27')][_0x5198('0x25')]);}})[_0x5198('0x28')](function(_0x3beb08){logger[_0x5198('0x24')](_0x5198('0x20'),_0x3effdb,_0x3beb08);_0xd3671(_0x3beb08);});});}function respondWithStatusCode(_0x1eb7d6,_0x4fb715){_0x4fb715=_0x4fb715||0xcc;return function(_0x2cdd45){if(_0x2cdd45){return _0x1eb7d6[_0x5198('0x29')](_0x4fb715);}return _0x1eb7d6['status'](_0x4fb715)['end']();};}function respondWithResult(_0x3a2b0f,_0x16a93f){_0x16a93f=_0x16a93f||0xc8;return function(_0x2e5f30){if(_0x2e5f30){return _0x3a2b0f[_0x5198('0x2a')](_0x16a93f)[_0x5198('0x2b')](_0x2e5f30);}};}function respondWithFilteredResult(_0x366cb0,_0x5d30c9){return function(_0xe9b771){if(_0xe9b771){var _0x43072b=_0xe9b771[_0x5198('0x2c')],_0x3fa178=_0x5d30c9[_0x5198('0x2d')],_0x300649=_0x5d30c9['offset']+_0x5d30c9[_0x5198('0x2e')],_0x290af7;if(_0x300649>=_0x43072b){_0x300649=_0x43072b;_0x290af7=0xc8;}else{_0x290af7=0xce;}_0x366cb0['status'](_0x290af7);return _0x366cb0[_0x5198('0x2f')]('Content-Range',_0x3fa178+'-'+_0x300649+'/'+_0x43072b)['json'](_0xe9b771);}return null;};}function patchUpdates(_0x375056){return function(_0x2ac5d2){try{jsonpatch[_0x5198('0x30')](_0x2ac5d2,_0x375056,!![]);}catch(_0x1600a3){return BPromise[_0x5198('0x31')](_0x1600a3);}return _0x2ac5d2[_0x5198('0x32')]();};}function saveUpdates(_0x278ca5,_0x5ed285){return function(_0x4ed80b){if(_0x4ed80b){return _0x4ed80b['update'](_0x278ca5)['then'](function(_0x23ce34){return _0x23ce34;});}return null;};}function removeEntity(_0x368119,_0x33628b){return function(_0x63451){if(_0x63451){return _0x63451[_0x5198('0x33')]()[_0x5198('0x34')](function(){_0x368119[_0x5198('0x2a')](0xcc)[_0x5198('0x35')]();});}};}function handleEntityNotFound(_0x547a2e,_0x3d3811){return function(_0x5f561b){if(!_0x5f561b){_0x547a2e['sendStatus'](0x194);}return _0x5f561b;};}function handleError(_0x4647ae,_0x454464){_0x454464=_0x454464||0x1f4;return function(_0x72ceb8){logger[_0x5198('0x24')](_0x72ceb8[_0x5198('0x36')]);if(_0x72ceb8[_0x5198('0x37')]){delete _0x72ceb8[_0x5198('0x37')];}_0x4647ae[_0x5198('0x2a')](_0x454464)['send'](_0x72ceb8);};}exports['index']=function(_0x1dce0f,_0x455671){var _0x10afd5={},_0x3d9a7d={},_0x43f46f={'count':0x0,'rows':[]};var _0x2b95df=db[_0x5198('0x38')]['rawAttributes'];_0x3d9a7d[_0x5198('0x39')]=_[_0x5198('0x3a')](_0x2b95df);var _0x43458f={'dateStart':_0x1dce0f[_0x5198('0x3b')][_0x5198('0x3c')],'dateEnd':_0x1dce0f[_0x5198('0x3b')]['dateEnd']};delete _0x1dce0f[_0x5198('0x3b')][_0x5198('0x3c')];delete _0x1dce0f[_0x5198('0x3b')]['dateEnd'];_0x3d9a7d[_0x5198('0x3b')]=_[_0x5198('0x3a')](_0x1dce0f[_0x5198('0x3b')]);_0x3d9a7d[_0x5198('0x3d')]=_['intersection'](_0x3d9a7d[_0x5198('0x39')],_0x3d9a7d[_0x5198('0x3b')]);_0x10afd5[_0x5198('0x3e')]=_['intersection'](_0x3d9a7d[_0x5198('0x39')],qs['fields'](_0x1dce0f[_0x5198('0x3b')][_0x5198('0x3f')]));_0x10afd5['attributes']=_0x10afd5[_0x5198('0x3e')]['length']?_0x10afd5[_0x5198('0x3e')]:_0x3d9a7d[_0x5198('0x39')];if(!_0x1dce0f['query'][_0x5198('0x40')]('nolimit')){_0x10afd5['limit']=qs[_0x5198('0x2e')](_0x1dce0f['query'][_0x5198('0x2e')]);_0x10afd5['offset']=qs['offset'](_0x1dce0f['query'][_0x5198('0x2d')]);}_0x10afd5[_0x5198('0x41')]=qs[_0x5198('0x42')](_0x1dce0f[_0x5198('0x3b')]['sort']);_0x10afd5[_0x5198('0x43')]=qs['filters'](_[_0x5198('0x44')](_0x1dce0f[_0x5198('0x3b')],_0x3d9a7d[_0x5198('0x3d')]));if(_0x43458f[_0x5198('0x3c')]){if(_0x43458f[_0x5198('0x45')]){_0x43458f['dateEnd']=moment(_0x43458f[_0x5198('0x45')])[_0x5198('0x46')](0x1,'day');}else{_0x43458f[_0x5198('0x45')]=moment(_0x43458f[_0x5198('0x3c')])[_0x5198('0x46')](0x1,_0x5198('0x47'));}_[_0x5198('0x48')](_0x10afd5[_0x5198('0x43')],{'createdAt':{'$gte':_0x43458f[_0x5198('0x3c')],'$lte':_0x43458f[_0x5198('0x45')]}});}if(_0x1dce0f['query']['filter']){_0x10afd5['where']=_[_0x5198('0x48')](_0x10afd5[_0x5198('0x43')],{'$or':_[_0x5198('0x49')](_0x10afd5[_0x5198('0x3e')],function(_0x381f23){var _0x166121={};_0x166121[_0x381f23]={'$like':'%'+_0x1dce0f[_0x5198('0x3b')][_0x5198('0x4a')]+'%'};return _0x166121;})});}_0x10afd5=_['merge']({},_0x10afd5,_0x1dce0f[_0x5198('0x4b')]);var _0x485ef2={'where':_0x10afd5[_0x5198('0x43')]};return db[_0x5198('0x38')][_0x5198('0x2c')](_0x485ef2)[_0x5198('0x34')](function(_0x415105){_0x43f46f[_0x5198('0x2c')]=_0x415105;if(_0x1dce0f[_0x5198('0x3b')][_0x5198('0x4c')]){_0x10afd5[_0x5198('0x4d')]=[{'all':!![]}];}return db[_0x5198('0x38')][_0x5198('0x4e')](_0x10afd5);})[_0x5198('0x34')](function(_0x5f5510){_0x43f46f[_0x5198('0x4f')]=_0x5f5510;return _0x43f46f;})['then'](respondWithFilteredResult(_0x455671,_0x10afd5))[_0x5198('0x28')](handleError(_0x455671,null));};exports[_0x5198('0x50')]=function(_0x1f1998,_0x5780e2){var _0x19fcd1={'raw':!![],'where':{'id':_0x1f1998[_0x5198('0x51')]['id']}},_0x8ecb39={};_0x8ecb39[_0x5198('0x39')]=_[_0x5198('0x3a')](db[_0x5198('0x38')][_0x5198('0x52')]);_0x8ecb39[_0x5198('0x3b')]=_[_0x5198('0x3a')](_0x1f1998['query']);_0x8ecb39['filters']=_[_0x5198('0x53')](_0x8ecb39[_0x5198('0x39')],_0x8ecb39[_0x5198('0x3b')]);_0x19fcd1[_0x5198('0x3e')]=_[_0x5198('0x53')](_0x8ecb39[_0x5198('0x39')],qs[_0x5198('0x3f')](_0x1f1998['query'][_0x5198('0x3f')]));_0x19fcd1[_0x5198('0x3e')]=_0x19fcd1[_0x5198('0x3e')]['length']?_0x19fcd1[_0x5198('0x3e')]:_0x8ecb39[_0x5198('0x39')];if(_0x1f1998['query'][_0x5198('0x4c')]){_0x19fcd1[_0x5198('0x4d')]=[{'all':!![]}];}_0x19fcd1=_[_0x5198('0x48')]({},_0x19fcd1,_0x1f1998[_0x5198('0x4b')]);return db['MailMessage']['find'](_0x19fcd1)['then'](handleEntityNotFound(_0x5780e2,null))[_0x5198('0x34')](respondWithResult(_0x5780e2,null))[_0x5198('0x28')](handleError(_0x5780e2,null));};exports['update']=function(_0x33b583,_0x5efb67){if(_0x33b583[_0x5198('0x54')]['id']){delete _0x33b583[_0x5198('0x54')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x33b583[_0x5198('0x51')]['id']}})['then'](handleEntityNotFound(_0x5efb67,null))[_0x5198('0x34')](saveUpdates(_0x33b583[_0x5198('0x54')],null))[_0x5198('0x34')](respondWithResult(_0x5efb67,null))[_0x5198('0x28')](handleError(_0x5efb67,null));};exports[_0x5198('0x33')]=function(_0x597b05,_0x32b864){return db[_0x5198('0x38')][_0x5198('0x55')]({'where':{'id':_0x597b05['params']['id']}})[_0x5198('0x34')](handleEntityNotFound(_0x32b864,null))['then'](removeEntity(_0x32b864,null))[_0x5198('0x28')](handleError(_0x32b864,null));};exports[_0x5198('0x56')]=function(_0x5d3a6d,_0x3c994a){return db[_0x5198('0x38')][_0x5198('0x56')]()[_0x5198('0x34')](respondWithResult(_0x3c994a,null))[_0x5198('0x28')](handleError(_0x3c994a,null));};exports[_0x5198('0x57')]=function(_0x1ffe4e,_0x567554){return db[_0x5198('0x38')][_0x5198('0x57')](_0x1ffe4e[_0x5198('0x54')])[_0x5198('0x34')](function(_0x9ea8b5){if(_0x9ea8b5){if(_0x9ea8b5[_0x5198('0x58')]===_0x5198('0x59')&&!_0x9ea8b5[_0x5198('0x5a')]){return db[_0x5198('0x5b')][_0x5198('0x5c')]({'where':{'id':_0x9ea8b5[_0x5198('0x5d')]},'include':[{'model':db[_0x5198('0x5e')],'as':'Smtp','raw':!![]}]})[_0x5198('0x34')](function(_0x375089){if(_0x375089&&_0x375089[_0x5198('0x5f')]){var _0x48690e={'tls':{'rejectUnauthorized':![]}};if(_[_0x5198('0x60')](_0x375089['Smtp'][_0x5198('0x61')])){_0x48690e[_0x5198('0x62')]=_0x375089[_0x5198('0x5f')][_0x5198('0x62')];_0x48690e[_0x5198('0x63')]=_0x375089[_0x5198('0x5f')][_0x5198('0x63')];_0x48690e['secure']=_0x375089[_0x5198('0x5f')][_0x5198('0x64')];if(_0x375089[_0x5198('0x5f')][_0x5198('0x65')]){_0x48690e[_0x5198('0x66')]={'user':_0x375089['Smtp'][_0x5198('0x67')],'pass':_0x375089[_0x5198('0x5f')][_0x5198('0x68')]};}}else{_0x48690e[_0x5198('0x61')]=_0x375089[_0x5198('0x5f')][_0x5198('0x61')];_0x48690e['auth']={'user':_0x375089[_0x5198('0x5f')][_0x5198('0x67')],'pass':_0x375089[_0x5198('0x5f')]['pass']};_0x48690e[_0x5198('0x64')]=_0x375089[_0x5198('0x5f')][_0x5198('0x64')];}if(_0x1ffe4e['body'][_0x5198('0x69')]&&_0x1ffe4e[_0x5198('0x54')][_0x5198('0x69')]['length']){for(var _0x586eb7=0x0;_0x586eb7<_0x1ffe4e[_0x5198('0x54')]['attachments']['length'];_0x586eb7+=0x1){_0x1ffe4e[_0x5198('0x54')][_0x5198('0x69')][_0x586eb7]={'filename':_0x1ffe4e[_0x5198('0x54')]['attachments'][_0x586eb7][_0x5198('0x37')],'path':path[_0x5198('0x6a')](config[_0x5198('0x6b')],'server/files/attachments',_0x1ffe4e[_0x5198('0x54')][_0x5198('0x69')][_0x586eb7]['basename'])};}}return{'account':_0x48690e,'message':_0x1ffe4e[_0x5198('0x54')]};}})[_0x5198('0x34')](function(_0x5871c5){if(_0x5871c5){return respondWithRpcPromise(_0x5198('0x6c'),'sendMail',_0x5871c5,client9003)[_0x5198('0x34')](function(_0x2f2384){return _0x9ea8b5[_0x5198('0x6d')]({'read':!![],'messageId':_0x2f2384[_0x5198('0x6e')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x5198('0x28')](function(_0x5d9f69){logger['error']('%s',JSON[_0x5198('0x6f')](_0x5d9f69));return _0x9ea8b5;});}return _0x9ea8b5;});}return _0x9ea8b5;}})[_0x5198('0x34')](respondWithResult(_0x567554,0xc9))[_0x5198('0x28')](handleError(_0x567554,null));};var interaction_log=require('../../config/logger')(_0x5198('0x70'));exports['accept']=function(_0xc64dd2,_0x3c0793,_0x51bd01){var _0x5752d2={'channel':_0x5198('0x71')};if(_0xc64dd2[_0x5198('0x54')]['id']){delete _0xc64dd2[_0x5198('0x54')]['id'];}_0xc64dd2[_0x5198('0x54')][_0x5198('0x72')]=!![];_0xc64dd2[_0x5198('0x54')]['readAt']=moment()[_0x5198('0x73')](_0x5198('0x74'));_0xc64dd2[_0x5198('0x54')][_0x5198('0x75')]=_0xc64dd2[_0x5198('0x54')][_0x5198('0x75')]||_0xc64dd2[_0x5198('0x67')]['id'];return db[_0x5198('0x38')][_0x5198('0x55')]({'where':{'id':_0xc64dd2[_0x5198('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x5198('0x76')],'as':_0x5198('0x77')}]})[_0x5198('0x34')](handleEntityNotFound(_0x3c0793,null))[_0x5198('0x34')](saveUpdates(_0xc64dd2[_0x5198('0x54')],null))[_0x5198('0x34')](function(_0x155758){if(_0x155758){_0x5752d2[_0x5198('0x25')]=_0x155758[_0x5198('0x78')]({'plain':!![]});return db[_0x5198('0x79')][_0x5198('0x55')]({'where':{'id':_0x155758[_0x5198('0x7a')]}});}return null;})['then'](handleEntityNotFound(_0x3c0793,null))['then'](function(_0x314de0){if(_0x314de0){return _0x314de0[_0x5198('0x6d')]({'UserId':_0xc64dd2[_0x5198('0x54')]['UserId'],'read1stAt':_[_0x5198('0x60')](_0x314de0[_0x5198('0x7b')])?moment()[_0x5198('0x73')](_0x5198('0x74')):undefined});}return null;})[_0x5198('0x34')](function(_0x103987){if(_0x103987){_0x5752d2[_0x5198('0x7c')]=_0x103987[_0x5198('0x78')]({'plain':!![]});interaction_log[_0x5198('0x26')](_0x5198('0x7d'),_0xc64dd2[_0x5198('0x67')]['id'],_0xc64dd2[_0x5198('0x67')][_0x5198('0x37')],_0xc64dd2[_0x5198('0x67')][_0x5198('0x7e')],_0x5752d2['interaction']['id'],_0xc64dd2[_0x5198('0x54')]?JSON[_0x5198('0x6f')](_0xc64dd2[_0x5198('0x54')]):'null');return respondWithRpcPromise(_0x5198('0x7f'),'acceptMessage',_0x5752d2);}return null;})['then'](function(_0x5865c8){if(_0x5865c8){if(_0xc64dd2[_0x5198('0x54')][_0x5198('0x80')]){_0x5752d2[_0x5198('0x25')][_0x5198('0x81')]=util[_0x5198('0x73')](_0x5198('0x82'),_0xc64dd2[_0x5198('0x67')][_0x5198('0x37')]);_0x5752d2['message'][_0x5198('0x83')]=_0x5752d2['channel'];_0x5752d2['message'][_0x5198('0x84')]=_0x5198('0x85');return respondWithRpcPromise(_0x5198('0x86'),_0x5198('0x86'),{'event':_0x5198('0x87'),'message':_0x5752d2[_0x5198('0x25')]},client9002)[_0x5198('0x34')](function(){return _0x5752d2;});}return _0x5752d2;}return null;})[_0x5198('0x34')](respondWithResult(_0x3c0793,null))[_0x5198('0x28')](handleError(_0x3c0793,null));};var interaction_log=require(_0x5198('0x13'))('mail-interactions');exports['reject']=function(_0x5723b5,_0x56cccd,_0x49baf5){var _0x4263f5={'agent':{},'channel':'mail'};if(_0x5723b5['body']['id']){delete _0x5723b5['body']['id'];}_0x5723b5[_0x5198('0x54')][_0x5198('0x75')]=_0x5723b5[_0x5198('0x54')]['UserId']||_0x5723b5['user']['id'];_0x4263f5[_0x5198('0x88')]['id']=_0x5723b5['body'][_0x5198('0x75')];return db[_0x5198('0x38')][_0x5198('0x55')]({'where':{'id':_0x5723b5[_0x5198('0x51')]['id'],'UserId':null}})[_0x5198('0x34')](handleEntityNotFound(_0x56cccd,null))[_0x5198('0x34')](function(_0x4859f5){if(_0x4859f5){_0x4263f5[_0x5198('0x25')]=_0x4859f5[_0x5198('0x78')]({'plain':!![]});return db[_0x5198('0x79')][_0x5198('0x55')]({'where':{'id':_0x4859f5['MailInteractionId']}});}return null;})[_0x5198('0x34')](handleEntityNotFound(_0x56cccd,null))['then'](function(_0x49b7ac){if(_0x49b7ac){_0x4263f5[_0x5198('0x7c')]=_0x49b7ac[_0x5198('0x78')]({'plain':!![]});interaction_log['info'](_0x5198('0x89'),_0x5723b5[_0x5198('0x67')]['id'],_0x5723b5['user']['name'],_0x5723b5['user'][_0x5198('0x7e')],_0x4263f5[_0x5198('0x7c')]['id'],_0x5723b5[_0x5198('0x54')]?JSON[_0x5198('0x6f')](_0x5723b5['body']):_0x5198('0x8a'));return respondWithRpcPromise(_0x5198('0x8b'),_0x5198('0x8c'),_0x4263f5);}return null;})[_0x5198('0x34')](function(_0x4089c1){if(_0x4089c1){_0x4089c1[_0x5198('0x25')]['interface']=util['format'](_0x5198('0x82'),_0x5723b5['user'][_0x5198('0x37')]);_0x4089c1[_0x5198('0x25')][_0x5198('0x83')]=_0x4263f5[_0x5198('0x83')];_0x4089c1[_0x5198('0x25')]['event']=_0x5198('0x31');respondWithRpcPromise('EventManager',_0x5198('0x86'),{'event':_0x5198('0x8d'),'message':_0x4089c1['message']},client9002);return _0x4263f5;}return null;})[_0x5198('0x34')](respondWithResult(_0x56cccd,null))[_0x5198('0x28')](handleError(_0x56cccd,null));};exports[_0x5198('0x8e')]=function(_0x25847d,_0x1dd5aa){var _0x558180=moment()[_0x5198('0x8f')]()[_0x5198('0x90')]();var _0x1b102c=path['join'](config[_0x5198('0x6b')],_0x5198('0x91'),_0x5198('0x92'),_0x5198('0x93'));var _0x53209b=path['join'](config['root'],_0x5198('0x91'),'files',_0x5198('0x69'));var _0x124867=util[_0x5198('0x73')](_0x5198('0x94'),_0x558180);return db[_0x5198('0x38')]['find']({'where':{'id':_0x25847d[_0x5198('0x51')]['id']},'attributes':['id',_0x5198('0x54'),_0x5198('0x95'),'to','cc',_0x5198('0x96'),'createdAt'],'include':_0x25847d['query']['attachments']?[{'model':db[_0x5198('0x97')],'as':'Attachments'}]:undefined})[_0x5198('0x34')](handleEntityNotFound(_0x1dd5aa,null))[_0x5198('0x34')](function(_0x2b4ffb){if(_0x2b4ffb){var _0x47978e=_0x2b4ffb;var _0x71f2b5={'from':_0x47978e['from'],'to':_0x47978e['to'],'subject':_0x47978e[_0x5198('0x96')],'html':_0x47978e[_0x5198('0x54')],'attachments':[]};return new BPromise(function(_0x3f6985,_0x527f49){if(_0x2b4ffb[_0x5198('0x98')]){for(var _0x4fdeb0=0x0;_0x4fdeb0<_0x2b4ffb[_0x5198('0x98')]['length'];_0x4fdeb0++){var _0x383495=_0x2b4ffb[_0x5198('0x98')][_0x4fdeb0];var _0x5b414e=path[_0x5198('0x6a')](_0x53209b,_0x383495[_0x5198('0x99')]);if(fs['existsSync'](_0x5b414e)){_0x71f2b5[_0x5198('0x69')][_0x5198('0x9a')]({'name':_0x383495[_0x5198('0x37')],'contentType':_0x383495[_0x5198('0x9b')],'data':fs['readFileSync'](_0x5b414e)});}}}emlformat[_0x5198('0x9c')](_0x71f2b5,function(_0x2ea89d,_0x1392a1){if(_0x2ea89d)return _0x527f49(_0x2ea89d);fs[_0x5198('0x9d')](path[_0x5198('0x6a')](_0x1b102c,_0x124867),_0x1392a1);return _0x3f6985(_0x1392a1);});});}})[_0x5198('0x34')](function(_0x2f0fc0){if(_0x2f0fc0){return _0x1dd5aa['download'](path[_0x5198('0x6a')](_0x1b102c,_0x124867),_0x124867,function(_0x99e62a){if(_0x99e62a){console[_0x5198('0x9e')](_0x5198('0x9f'),_0x99e62a);}else{fs['unlinkSync'](path[_0x5198('0x6a')](_0x1b102c,_0x124867));}});}})[_0x5198('0x28')](handleError(_0x1dd5aa,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3799261..5e6e947 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 _0xfc65=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x34b863,_0x572731){var _0x42e135=function(_0x40949b){while(--_0x40949b){_0x34b863['push'](_0x34b863['shift']());}};_0x42e135(++_0x572731);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x40678,_0x3f44df){_0x40678=_0x40678-0x0;var _0x4a11f7=_0xfc65[_0x40678];return _0x4a11f7;};'use strict';var EventEmitter=require(_0x5fc6('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5fc6('0x1')](0x0);var events={'afterCreate':_0x5fc6('0x2'),'afterUpdate':_0x5fc6('0x3'),'afterDestroy':_0x5fc6('0x4')};function emitEvent(_0x3c542a){return function(_0x34b758,_0x22a8ad,_0xcdd520){MailMessageEvents[_0x5fc6('0x5')](_0x3c542a+':'+_0x34b758['id'],_0x34b758);MailMessageEvents[_0x5fc6('0x5')](_0x3c542a,_0x34b758);_0xcdd520(null);};}for(var e in events){if(events[_0x5fc6('0x6')](e)){var event=events[e];MailMessage[_0x5fc6('0x7')](e,emitEvent(event));}}module[_0x5fc6('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x24ce=['hasOwnProperty','hook','../../mysqldb','MailMessage','setMaxListeners','save','emit'];(function(_0x4307f6,_0x3d1c43){var _0x339eab=function(_0x739744){while(--_0x739744){_0x4307f6['push'](_0x4307f6['shift']());}};_0x339eab(++_0x3d1c43);}(_0x24ce,0x1de));var _0xe24c=function(_0x12cacf,_0x598877){_0x12cacf=_0x12cacf-0x0;var _0x2daf9f=_0x24ce[_0x12cacf];return _0x2daf9f;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe24c('0x0'))['db'][_0xe24c('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe24c('0x2')](0x0);var events={'afterCreate':_0xe24c('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2da6e1){return function(_0x48f802,_0x4d6727,_0x33d18c){MailMessageEvents[_0xe24c('0x4')](_0x2da6e1+':'+_0x48f802['id'],_0x48f802);MailMessageEvents[_0xe24c('0x4')](_0x2da6e1,_0x48f802);_0x33d18c(null);};}for(var e in events){if(events[_0xe24c('0x5')](e)){var event=events[e];MailMessage[_0xe24c('0x6')](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 8d3d447..8650e17 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 _0x38b2=['MailMessage','mail_messages','messageId','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','exports','define'];(function(_0x144d4c,_0x1595d3){var _0x44c349=function(_0x4e7dba){while(--_0x4e7dba){_0x144d4c['push'](_0x144d4c['shift']());}};_0x44c349(++_0x1595d3);}(_0x38b2,0xf6));var _0x238b=function(_0x13686f,_0x1cd284){_0x13686f=_0x13686f-0x0;var _0x22d8f9=_0x38b2[_0x13686f];return _0x22d8f9;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var logger=require(_0x238b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x238b('0x3'));var rp=require(_0x238b('0x4'));var attributes=require('./mailMessage.attributes');module[_0x238b('0x5')]=function(_0x4c4f0e,_0x44ddd2){return _0x4c4f0e[_0x238b('0x6')](_0x238b('0x7'),attributes,{'tableName':_0x238b('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x238b('0x9')]}],'timestamps':!![],'charset':_0x238b('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1fbb=['util','../../config/logger','api','bluebird','request-promise','./mailMessage.attributes','exports','define','messageId','utf8mb4_unicode_ci','lodash'];(function(_0x4d7c80,_0x2af89b){var _0x24fcb6=function(_0x3cc104){while(--_0x3cc104){_0x4d7c80['push'](_0x4d7c80['shift']());}};_0x24fcb6(++_0x2af89b);}(_0x1fbb,0x99));var _0xb1fb=function(_0x1a6410,_0x4668c9){_0x1a6410=_0x1a6410-0x0;var _0x30bea2=_0x1fbb[_0x1a6410];return _0x30bea2;};'use strict';var _=require(_0xb1fb('0x0'));var util=require(_0xb1fb('0x1'));var logger=require(_0xb1fb('0x2'))(_0xb1fb('0x3'));var moment=require('moment');var BPromise=require(_0xb1fb('0x4'));var rp=require(_0xb1fb('0x5'));var attributes=require(_0xb1fb('0x6'));module[_0xb1fb('0x7')]=function(_0x398f66,_0x4aacbf){return _0x398f66[_0xb1fb('0x8')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xb1fb('0x9'),'fields':['messageId']}],'timestamps':!![],'charset':'utf8mb4','collate':_0xb1fb('0xa')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index ae999dd..3c65d2c 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 _0x23f4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateMailMessage','create','body','options','raw','catch','util','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x23f4,0x1ee));var _0x423f=function(_0x201bcc,_0x368381){_0x201bcc=_0x201bcc-0x0;var _0x1ef6c2=_0x23f4[_0x201bcc];return _0x1ef6c2;};'use strict';var _=require('lodash');var util=require(_0x423f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x423f('0x1'));var fs=require('fs');var Redis=require(_0x423f('0x2'));var db=require(_0x423f('0x3'))['db'];var utils=require(_0x423f('0x4'));var logger=require(_0x423f('0x5'))(_0x423f('0x6'));var config=require(_0x423f('0x7'));var jayson=require(_0x423f('0x8'));var client=jayson[_0x423f('0x9')]['http']({'port':0x232a});config[_0x423f('0xa')]=_[_0x423f('0xb')](config['redis'],{'host':_0x423f('0xc'),'port':0x18eb});var socket=require(_0x423f('0xd'))(new Redis(config[_0x423f('0xa')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4b8a90,_0x4143a0,_0x481c41){return new BPromise(function(_0xa0d3a5,_0x7c905f){return client[_0x423f('0xe')](_0x4b8a90,_0x481c41)[_0x423f('0xf')](function(_0x56dec1){logger[_0x423f('0x10')](_0x423f('0x11'),_0x4143a0,_0x423f('0x12'));logger[_0x423f('0x13')](_0x423f('0x14'),_0x4143a0,'request\x20sent',JSON[_0x423f('0x15')](_0x56dec1));if(_0x56dec1[_0x423f('0x16')]){if(_0x56dec1[_0x423f('0x16')][_0x423f('0x17')]===0x1f4){logger[_0x423f('0x16')](_0x423f('0x11'),_0x4143a0,_0x56dec1[_0x423f('0x16')][_0x423f('0x18')]);return _0x7c905f(_0x56dec1[_0x423f('0x16')][_0x423f('0x18')]);}logger[_0x423f('0x16')](_0x423f('0x11'),_0x4143a0,_0x56dec1[_0x423f('0x16')][_0x423f('0x18')]);return _0xa0d3a5(_0x56dec1[_0x423f('0x16')][_0x423f('0x18')]);}else{logger[_0x423f('0x10')](_0x423f('0x11'),_0x4143a0,_0x423f('0x12'));_0xa0d3a5(_0x56dec1['result'][_0x423f('0x18')]);}})['catch'](function(_0x504d8b){logger[_0x423f('0x16')]('MailMessage,\x20%s,\x20%s',_0x4143a0,_0x504d8b);_0x7c905f(_0x504d8b);});});}exports[_0x423f('0x19')]=function(_0xd7b80e){var _0x4f6960=this;return new Promise(function(_0x45b46d,_0x1fc317){return db['MailMessage'][_0x423f('0x1a')](_0xd7b80e[_0x423f('0x1b')],{'raw':_0xd7b80e['options']?_0xd7b80e[_0x423f('0x1c')][_0x423f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x54f47){logger['info'](_0x423f('0x19'),_0xd7b80e);logger[_0x423f('0x13')](_0x423f('0x19'),_0xd7b80e,JSON[_0x423f('0x15')](_0x54f47));_0x45b46d(_0x54f47);})[_0x423f('0x1e')](function(_0x39e72d){logger[_0x423f('0x16')](_0x423f('0x19'),_0x39e72d[_0x423f('0x18')],_0xd7b80e);_0x1fc317(_0x4f6960[_0x423f('0x16')](0x1f4,_0x39e72d[_0x423f('0x18')]));});});}; \ No newline at end of file +var _0xdf98=['CreateMailMessage','create','body','options','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch'];(function(_0x47b90e,_0x871f48){var _0x6e7394=function(_0x3ad789){while(--_0x3ad789){_0x47b90e['push'](_0x47b90e['shift']());}};_0x6e7394(++_0x871f48);}(_0xdf98,0xcf));var _0x8df9=function(_0x2a8444,_0xb5ee31){_0x2a8444=_0x2a8444-0x0;var _0x53c724=_0xdf98[_0x2a8444];return _0x53c724;};'use strict';var _=require(_0x8df9('0x0'));var util=require('util');var moment=require(_0x8df9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8df9('0x2'));var db=require(_0x8df9('0x3'))['db'];var utils=require(_0x8df9('0x4'));var logger=require(_0x8df9('0x5'))(_0x8df9('0x6'));var config=require(_0x8df9('0x7'));var jayson=require(_0x8df9('0x8'));var client=jayson[_0x8df9('0x9')][_0x8df9('0xa')]({'port':0x232a});config['redis']=_[_0x8df9('0xb')](config[_0x8df9('0xc')],{'host':_0x8df9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8df9('0xe'))['register'](socket);function respondWithRpcPromise(_0x46553c,_0x3aab11,_0x1ead69){return new BPromise(function(_0xa5abd2,_0x1a97bf){return client[_0x8df9('0xf')](_0x46553c,_0x1ead69)[_0x8df9('0x10')](function(_0x41d4da){logger['info'](_0x8df9('0x11'),_0x3aab11,_0x8df9('0x12'));logger[_0x8df9('0x13')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x3aab11,_0x8df9('0x12'),JSON[_0x8df9('0x14')](_0x41d4da));if(_0x41d4da[_0x8df9('0x15')]){if(_0x41d4da[_0x8df9('0x15')]['code']===0x1f4){logger['error'](_0x8df9('0x11'),_0x3aab11,_0x41d4da[_0x8df9('0x15')][_0x8df9('0x16')]);return _0x1a97bf(_0x41d4da['error'][_0x8df9('0x16')]);}logger['error'](_0x8df9('0x11'),_0x3aab11,_0x41d4da['error'][_0x8df9('0x16')]);return _0xa5abd2(_0x41d4da[_0x8df9('0x15')][_0x8df9('0x16')]);}else{logger[_0x8df9('0x17')](_0x8df9('0x11'),_0x3aab11,_0x8df9('0x12'));_0xa5abd2(_0x41d4da['result']['message']);}})[_0x8df9('0x18')](function(_0x52030a){logger['error'](_0x8df9('0x11'),_0x3aab11,_0x52030a);_0x1a97bf(_0x52030a);});});}exports[_0x8df9('0x19')]=function(_0x3c4b85){var _0x412015=this;return new Promise(function(_0x10b440,_0xd73eb3){return db['MailMessage'][_0x8df9('0x1a')](_0x3c4b85[_0x8df9('0x1b')],{'raw':_0x3c4b85[_0x8df9('0x1c')]?_0x3c4b85['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4a6748){logger['info'](_0x8df9('0x19'),_0x3c4b85);logger[_0x8df9('0x13')](_0x8df9('0x19'),_0x3c4b85,JSON[_0x8df9('0x14')](_0x4a6748));_0x10b440(_0x4a6748);})[_0x8df9('0x18')](function(_0x1f9edd){logger[_0x8df9('0x15')](_0x8df9('0x19'),_0x1f9edd['message'],_0x3c4b85);_0xd73eb3(_0x412015[_0x8df9('0x15')](0x1f4,_0x1f9edd[_0x8df9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 09abc3b..7486073 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 _0xcdac=['removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','emit'];(function(_0x236e4b,_0x136c92){var _0x5cce4e=function(_0x4c29eb){while(--_0x4c29eb){_0x236e4b['push'](_0x236e4b['shift']());}};_0x5cce4e(++_0x136c92);}(_0xcdac,0x6c));var _0xccda=function(_0x13418d,_0x854c05){_0x13418d=_0x13418d-0x0;var _0x334a6a=_0xcdac[_0x13418d];return _0x334a6a;};'use strict';var MailMessageEvents=require(_0xccda('0x0'));var events=[_0xccda('0x1'),_0xccda('0x2'),'update'];function createListener(_0x2cc406,_0x48a545){return function(_0x16b89f){_0x48a545[_0xccda('0x3')](_0x2cc406,_0x16b89f);};}function removeListener(_0x1b89ee,_0xa28cc0){return function(){MailMessageEvents[_0xccda('0x4')](_0x1b89ee,_0xa28cc0);};}exports[_0xccda('0x5')]=function(_0x35ce01){for(var _0x9b25ce=0x0,_0x554525=events[_0xccda('0x6')];_0x9b25ce<_0x554525;_0x9b25ce++){var _0x231161=events[_0x9b25ce];var _0x470deb=createListener(_0xccda('0x7')+_0x231161,_0x35ce01);MailMessageEvents['on'](_0x231161,_0x470deb);}}; \ No newline at end of file +var _0x53e1=['update','emit','length','mailMessage:','./mailMessage.events','remove'];(function(_0x4d08b1,_0x1ada94){var _0x1795d0=function(_0x19bc63){while(--_0x19bc63){_0x4d08b1['push'](_0x4d08b1['shift']());}};_0x1795d0(++_0x1ada94);}(_0x53e1,0x8e));var _0x153e=function(_0x11ba83,_0xd5611a){_0x11ba83=_0x11ba83-0x0;var _0x3f3925=_0x53e1[_0x11ba83];return _0x3f3925;};'use strict';var MailMessageEvents=require(_0x153e('0x0'));var events=['save',_0x153e('0x1'),_0x153e('0x2')];function createListener(_0x51e90f,_0x7cb713){return function(_0x542a49){_0x7cb713[_0x153e('0x3')](_0x51e90f,_0x542a49);};}function removeListener(_0x297e5,_0x51ce28){return function(){MailMessageEvents['removeListener'](_0x297e5,_0x51ce28);};}exports['register']=function(_0x3bc691){for(var _0x100ab5=0x0,_0x1e5034=events[_0x153e('0x4')];_0x100ab5<_0x1e5034;_0x100ab5++){var _0x3ee094=events[_0x100ab5];var _0xb5eb2c=createListener(_0x153e('0x5')+_0x3ee094,_0x3bc691);MailMessageEvents['on'](_0x3ee094,_0xb5eb2c);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e2bdc4b..0f0ed4f 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 _0x80ec=['getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','delete','removeTeams','exports','multer','path','connect-timeout','Router','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x80ec,0x9a));var _0xc80e=function(_0x3f0b55,_0x4a4462){_0x3f0b55=_0x3f0b55-0x0;var _0x3acd80=_0x80ec[_0x3f0b55];return _0x3acd80;};'use strict';var multer=require(_0xc80e('0x0'));var util=require('util');var path=require(_0xc80e('0x1'));var timeout=require(_0xc80e('0x2'));var express=require('express');var router=express[_0xc80e('0x3')]();var auth=require(_0xc80e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc80e('0x5'));router[_0xc80e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xc80e('0x7')](),controller[_0xc80e('0x8')]);router[_0xc80e('0x6')](_0xc80e('0x9'),auth[_0xc80e('0x7')](),controller[_0xc80e('0xa')]);router[_0xc80e('0x6')](_0xc80e('0xb'),auth[_0xc80e('0x7')](),controller[_0xc80e('0xc')]);router[_0xc80e('0x6')](_0xc80e('0xd'),auth[_0xc80e('0x7')](),controller[_0xc80e('0xe')]);router[_0xc80e('0x6')](_0xc80e('0xf'),auth[_0xc80e('0x7')](),controller[_0xc80e('0x10')]);router[_0xc80e('0x11')]('/',auth['isAuthenticated'](),controller[_0xc80e('0x12')]);router[_0xc80e('0x11')](_0xc80e('0xd'),auth[_0xc80e('0x7')](),controller[_0xc80e('0x13')]);router[_0xc80e('0x11')](_0xc80e('0xf'),auth[_0xc80e('0x7')](),controller[_0xc80e('0x14')]);router['put'](_0xc80e('0x9'),auth[_0xc80e('0x7')](),controller['update']);router[_0xc80e('0x15')](_0xc80e('0x9'),auth[_0xc80e('0x7')](),controller['destroy']);router[_0xc80e('0x15')](_0xc80e('0xd'),auth[_0xc80e('0x7')](),controller[_0xc80e('0x16')]);router[_0xc80e('0x15')](_0xc80e('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xc80e('0x17')]=router; \ No newline at end of file +var _0x4ea3=['isAuthenticated','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe'];(function(_0x18600a,_0x3756de){var _0x211bc0=function(_0x1b3c0){while(--_0x1b3c0){_0x18600a['push'](_0x18600a['shift']());}};_0x211bc0(++_0x3756de);}(_0x4ea3,0x7d));var _0x34ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ea3[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x34ea('0x0'));var path=require('path');var timeout=require(_0x34ea('0x1'));var express=require(_0x34ea('0x2'));var router=express[_0x34ea('0x3')]();var auth=require(_0x34ea('0x4'));var interaction=require(_0x34ea('0x5'));var config=require(_0x34ea('0x6'));var controller=require('./mailQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x34ea('0x7')]);router[_0x34ea('0x8')](_0x34ea('0x9'),auth[_0x34ea('0xa')](),controller['describe']);router['get'](_0x34ea('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x34ea('0x8')](_0x34ea('0xc'),auth[_0x34ea('0xa')](),controller['getMembers']);router[_0x34ea('0x8')](_0x34ea('0xd'),auth[_0x34ea('0xa')](),controller[_0x34ea('0xe')]);router[_0x34ea('0x8')](_0x34ea('0xf'),auth[_0x34ea('0xa')](),controller[_0x34ea('0x10')]);router[_0x34ea('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x34ea('0x11')](_0x34ea('0xd'),auth[_0x34ea('0xa')](),controller[_0x34ea('0x12')]);router['post']('/:id/users',auth[_0x34ea('0xa')](),controller[_0x34ea('0x13')]);router[_0x34ea('0x14')](_0x34ea('0xb'),auth[_0x34ea('0xa')](),controller[_0x34ea('0x15')]);router['delete'](_0x34ea('0xb'),auth[_0x34ea('0xa')](),controller[_0x34ea('0x16')]);router[_0x34ea('0x17')](_0x34ea('0xd'),auth['isAuthenticated'](),controller[_0x34ea('0x18')]);router[_0x34ea('0x17')](_0x34ea('0xf'),auth['isAuthenticated'](),controller[_0x34ea('0x19')]);module[_0x34ea('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f7252e8..84231fe 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 _0x7f15=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x16491a,_0x54405e){var _0x1c8afb=function(_0x7e24a1){while(--_0x7e24a1){_0x16491a['push'](_0x16491a['shift']());}};_0x1c8afb(++_0x54405e);}(_0x7f15,0x1f3));var _0x57f1=function(_0x2b842e,_0x3e7370){_0x2b842e=_0x2b842e-0x0;var _0xd0c58c=_0x7f15[_0x2b842e];return _0xd0c58c;};'use strict';var Sequelize=require(_0x57f1('0x0'));module['exports']={'name':{'type':Sequelize[_0x57f1('0x1')],'unique':_0x57f1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x57f1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x57f1('0x4')](_0x57f1('0x5'),_0x57f1('0x6'),_0x57f1('0x7'))}}; \ No newline at end of file +var _0xfe7d=['roundrobin','sequelize','exports','name','INTEGER','ENUM','beepall'];(function(_0x56e643,_0x39e6c7){var _0x1f12b8=function(_0x378f1a){while(--_0x378f1a){_0x56e643['push'](_0x56e643['shift']());}};_0x1f12b8(++_0x39e6c7);}(_0xfe7d,0x1e4));var _0xdfe7=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xfe7d[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xdfe7('0x0'));module[_0xdfe7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdfe7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdfe7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdfe7('0x4')]('rrmemory',_0xdfe7('0x5'),_0xdfe7('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 0a4cadb..a07688f 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 _0xd213=['querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','index','MailQueue','rawAttributes','keys','query','dateStart','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','merge','filter','map','options','includeAll','include','findAll','rows','catch','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','length','MailQueueId','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','ids','Agents','addAgents','penalty','addTeams','union','removeTeams','omit','spread','emit','removeAgents','userMailQueue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd213,0xd8));var _0x3d21=function(_0x5ab7fa,_0x2abea4){_0x5ab7fa=_0x5ab7fa-0x0;var _0x4a9012=_0xd213[_0x5ab7fa];return _0x4a9012;};'use strict';var pdf=require(_0x3d21('0x0'));var emlformat=require(_0x3d21('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3d21('0x2'));var jsonpatch=require(_0x3d21('0x3'));var rp=require(_0x3d21('0x4'));var moment=require('moment');var BPromise=require(_0x3d21('0x5'));var Mustache=require(_0x3d21('0x6'));var util=require(_0x3d21('0x7'));var path=require(_0x3d21('0x8'));var sox=require(_0x3d21('0x9'));var csv=require(_0x3d21('0xa'));var ejs=require(_0x3d21('0xb'));var fs=require('fs');var _=require(_0x3d21('0xc'));var squel=require(_0x3d21('0xd'));var crypto=require('crypto');var jsforce=require(_0x3d21('0xe'));var deskjs=require(_0x3d21('0xf'));var toCsv=require(_0x3d21('0xa'));var querystring=require(_0x3d21('0x10'));var Papa=require(_0x3d21('0x11'));var Redis=require('ioredis');var qs=require(_0x3d21('0x12'));var logger=require(_0x3d21('0x13'))(_0x3d21('0x14'));var utils=require(_0x3d21('0x15'));var config=require(_0x3d21('0x16'));var db=require('../../mysqldb')['db'];config[_0x3d21('0x17')]=_[_0x3d21('0x18')](config[_0x3d21('0x17')],{'host':_0x3d21('0x19'),'port':0x18eb});var socket=require(_0x3d21('0x1a'))(new Redis(config['redis']));require(_0x3d21('0x1b'))[_0x3d21('0x1c')](socket);function respondWithStatusCode(_0x18c5d8,_0x433d67){_0x433d67=_0x433d67||0xcc;return function(_0x4ecd83){if(_0x4ecd83){return _0x18c5d8[_0x3d21('0x1d')](_0x433d67);}return _0x18c5d8['status'](_0x433d67)[_0x3d21('0x1e')]();};}function respondWithResult(_0xf06f95,_0x67b4fc){_0x67b4fc=_0x67b4fc||0xc8;return function(_0x530192){if(_0x530192){return _0xf06f95['status'](_0x67b4fc)[_0x3d21('0x1f')](_0x530192);}};}function respondWithFilteredResult(_0x304d4e,_0x16f64b){return function(_0x1f265f){if(_0x1f265f){var _0x10d7c0=_0x1f265f[_0x3d21('0x20')],_0x536f30=_0x16f64b[_0x3d21('0x21')],_0x2c8065=_0x16f64b[_0x3d21('0x21')]+_0x16f64b[_0x3d21('0x22')],_0x2ef54c;if(_0x2c8065>=_0x10d7c0){_0x2c8065=_0x10d7c0;_0x2ef54c=0xc8;}else{_0x2ef54c=0xce;}_0x304d4e[_0x3d21('0x23')](_0x2ef54c);return _0x304d4e[_0x3d21('0x24')](_0x3d21('0x25'),_0x536f30+'-'+_0x2c8065+'/'+_0x10d7c0)[_0x3d21('0x1f')](_0x1f265f);}return null;};}function patchUpdates(_0x15c0a3){return function(_0x5a1441){try{jsonpatch['apply'](_0x5a1441,_0x15c0a3,!![]);}catch(_0x4bdf88){return BPromise[_0x3d21('0x26')](_0x4bdf88);}return _0x5a1441['save']();};}function saveUpdates(_0x2b8f90,_0x5590b1){return function(_0x3e93c4){if(_0x3e93c4){return _0x3e93c4[_0x3d21('0x27')](_0x2b8f90)[_0x3d21('0x28')](function(_0x32765b){return _0x32765b;});}return null;};}function removeEntity(_0x5bc589,_0x33e48e){return function(_0x1d9a32){if(_0x1d9a32){return _0x1d9a32[_0x3d21('0x29')]()[_0x3d21('0x28')](function(){var _0x109a57=_0x1d9a32[_0x3d21('0x2a')]({'plain':!![]});var _0x20c0c3=_0x3d21('0x2b');return db[_0x3d21('0x2c')][_0x3d21('0x29')]({'where':{'type':_0x20c0c3,'resourceId':_0x109a57['id']}})[_0x3d21('0x28')](function(){return _0x1d9a32;});})[_0x3d21('0x28')](function(){_0x5bc589[_0x3d21('0x23')](0xcc)[_0x3d21('0x1e')]();});}};}function handleEntityNotFound(_0x5be112,_0x265fbc){return function(_0x3b4536){if(!_0x3b4536){_0x5be112[_0x3d21('0x1d')](0x194);}return _0x3b4536;};}function handleError(_0x5d9163,_0x1789d3){_0x1789d3=_0x1789d3||0x1f4;return function(_0x5b580a){logger[_0x3d21('0x2d')](_0x5b580a[_0x3d21('0x2e')]);if(_0x5b580a['name']){delete _0x5b580a[_0x3d21('0x2f')];}_0x5d9163[_0x3d21('0x23')](_0x1789d3)[_0x3d21('0x30')](_0x5b580a);};}exports[_0x3d21('0x31')]=function(_0x44766a,_0x37f44c){var _0x1489b2={},_0x14758f={},_0x109a56={'count':0x0,'rows':[]};var _0x14dfb1=db[_0x3d21('0x32')][_0x3d21('0x33')];_0x14758f['model']=_[_0x3d21('0x34')](_0x14dfb1);var _0x5c40cf={'dateStart':_0x44766a[_0x3d21('0x35')][_0x3d21('0x36')],'dateEnd':_0x44766a[_0x3d21('0x35')]['dateEnd']};delete _0x44766a['query'][_0x3d21('0x36')];delete _0x44766a['query']['dateEnd'];_0x14758f['query']=_[_0x3d21('0x34')](_0x44766a[_0x3d21('0x35')]);_0x14758f[_0x3d21('0x37')]=_[_0x3d21('0x38')](_0x14758f[_0x3d21('0x39')],_0x14758f[_0x3d21('0x35')]);_0x1489b2[_0x3d21('0x3a')]=_[_0x3d21('0x38')](_0x14758f[_0x3d21('0x39')],qs['fields'](_0x44766a[_0x3d21('0x35')][_0x3d21('0x3b')]));_0x1489b2['attributes']=_0x1489b2['attributes']['length']?_0x1489b2['attributes']:_0x14758f[_0x3d21('0x39')];if(!_0x44766a[_0x3d21('0x35')][_0x3d21('0x3c')](_0x3d21('0x3d'))){_0x1489b2[_0x3d21('0x22')]=qs['limit'](_0x44766a[_0x3d21('0x35')]['limit']);_0x1489b2[_0x3d21('0x21')]=qs[_0x3d21('0x21')](_0x44766a[_0x3d21('0x35')][_0x3d21('0x21')]);}_0x1489b2[_0x3d21('0x3e')]=qs['sort'](_0x44766a['query'][_0x3d21('0x3f')]);_0x1489b2[_0x3d21('0x40')]=qs['filters'](_[_0x3d21('0x41')](_0x44766a[_0x3d21('0x35')],_0x14758f[_0x3d21('0x37')]));if(_0x5c40cf['dateStart']){if(_0x5c40cf[_0x3d21('0x42')]){_0x5c40cf[_0x3d21('0x42')]=moment(_0x5c40cf[_0x3d21('0x42')])['add'](0x1,'day');}else{_0x5c40cf['dateEnd']=moment(_0x5c40cf['dateStart'])[_0x3d21('0x43')](0x1,'day');}_[_0x3d21('0x44')](_0x1489b2[_0x3d21('0x40')],{'createdAt':{'$gte':_0x5c40cf['dateStart'],'$lte':_0x5c40cf['dateEnd']}});}if(_0x44766a[_0x3d21('0x35')][_0x3d21('0x45')]){_0x1489b2['where']=_[_0x3d21('0x44')](_0x1489b2[_0x3d21('0x40')],{'$or':_[_0x3d21('0x46')](_0x1489b2[_0x3d21('0x3a')],function(_0x56ab8f){var _0x83259d={};_0x83259d[_0x56ab8f]={'$like':'%'+_0x44766a['query'][_0x3d21('0x45')]+'%'};return _0x83259d;})});}_0x1489b2=_[_0x3d21('0x44')]({},_0x1489b2,_0x44766a[_0x3d21('0x47')]);var _0x590eb8={'where':_0x1489b2[_0x3d21('0x40')]};return db['MailQueue']['count'](_0x590eb8)[_0x3d21('0x28')](function(_0x4a61f2){_0x109a56[_0x3d21('0x20')]=_0x4a61f2;if(_0x44766a[_0x3d21('0x35')][_0x3d21('0x48')]){_0x1489b2[_0x3d21('0x49')]=[{'all':!![]}];}return db[_0x3d21('0x32')][_0x3d21('0x4a')](_0x1489b2);})[_0x3d21('0x28')](function(_0x36d9dd){_0x109a56[_0x3d21('0x4b')]=_0x36d9dd;return _0x109a56;})[_0x3d21('0x28')](respondWithFilteredResult(_0x37f44c,_0x1489b2))[_0x3d21('0x4c')](handleError(_0x37f44c,null));};exports['show']=function(_0x5b4db5,_0x2f781b){var _0x13cbc1={'raw':!![],'where':{'id':_0x5b4db5[_0x3d21('0x4d')]['id']}},_0x3d56f2={};_0x3d56f2[_0x3d21('0x39')]=_['keys'](db[_0x3d21('0x32')][_0x3d21('0x33')]);_0x3d56f2['query']=_['keys'](_0x5b4db5[_0x3d21('0x35')]);_0x3d56f2[_0x3d21('0x37')]=_[_0x3d21('0x38')](_0x3d56f2[_0x3d21('0x39')],_0x3d56f2[_0x3d21('0x35')]);_0x13cbc1[_0x3d21('0x3a')]=_[_0x3d21('0x38')](_0x3d56f2['model'],qs[_0x3d21('0x3b')](_0x5b4db5['query'][_0x3d21('0x3b')]));_0x13cbc1[_0x3d21('0x3a')]=_0x13cbc1[_0x3d21('0x3a')]['length']?_0x13cbc1[_0x3d21('0x3a')]:_0x3d56f2[_0x3d21('0x39')];if(_0x5b4db5[_0x3d21('0x35')][_0x3d21('0x48')]){_0x13cbc1[_0x3d21('0x49')]=[{'all':!![]}];}_0x13cbc1=_[_0x3d21('0x44')]({},_0x13cbc1,_0x5b4db5[_0x3d21('0x47')]);return db[_0x3d21('0x32')][_0x3d21('0x4e')](_0x13cbc1)[_0x3d21('0x28')](handleEntityNotFound(_0x2f781b,null))[_0x3d21('0x28')](respondWithResult(_0x2f781b,null))['catch'](handleError(_0x2f781b,null));};exports['create']=function(_0x455472,_0x3579ef){return db[_0x3d21('0x32')]['create'](_0x455472[_0x3d21('0x4f')],{})[_0x3d21('0x28')](function(_0x48d869){var _0x55245f=_0x455472['user'][_0x3d21('0x2a')]({'plain':!![]});if(!_0x55245f)throw new Error(_0x3d21('0x50'));if(_0x55245f[_0x3d21('0x51')]===_0x3d21('0x52')){var _0x18ef30=_0x48d869['get']({'plain':!![]});var _0x192516='MailQueues';return db[_0x3d21('0x53')][_0x3d21('0x4e')]({'where':{'name':_0x192516,'userProfileId':_0x55245f['userProfileId']},'raw':!![]})[_0x3d21('0x28')](function(_0x13a70f){if(_0x13a70f&&_0x13a70f[_0x3d21('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x18ef30[_0x3d21('0x2f')],'resourceId':_0x18ef30['id'],'type':_0x13a70f[_0x3d21('0x2f')],'sectionId':_0x13a70f['id']},{})['then'](function(){return _0x48d869;});}else{return _0x48d869;}})[_0x3d21('0x4c')](function(_0x3f358d){logger[_0x3d21('0x2d')](_0x3d21('0x55'),_0x3f358d);throw _0x3f358d;});}return _0x48d869;})[_0x3d21('0x28')](respondWithResult(_0x3579ef,0xc9))[_0x3d21('0x4c')](handleError(_0x3579ef,null));};exports[_0x3d21('0x27')]=function(_0x98210b,_0x126909){if(_0x98210b[_0x3d21('0x4f')]['id']){delete _0x98210b['body']['id'];}return db[_0x3d21('0x32')][_0x3d21('0x4e')]({'where':{'id':_0x98210b[_0x3d21('0x4d')]['id']}})[_0x3d21('0x28')](handleEntityNotFound(_0x126909,null))[_0x3d21('0x28')](saveUpdates(_0x98210b[_0x3d21('0x4f')],null))[_0x3d21('0x28')](respondWithResult(_0x126909,null))[_0x3d21('0x4c')](handleError(_0x126909,null));};exports[_0x3d21('0x29')]=function(_0x2ec049,_0x53fc1b){return db[_0x3d21('0x32')][_0x3d21('0x4e')]({'where':{'id':_0x2ec049['params']['id']}})[_0x3d21('0x28')](handleEntityNotFound(_0x53fc1b,null))[_0x3d21('0x28')](removeEntity(_0x53fc1b,null))[_0x3d21('0x4c')](handleError(_0x53fc1b,null));};exports[_0x3d21('0x56')]=function(_0x239d45,_0x59dd02){return db[_0x3d21('0x32')]['describe']()[_0x3d21('0x28')](respondWithResult(_0x59dd02,null))[_0x3d21('0x4c')](handleError(_0x59dd02,null));};exports[_0x3d21('0x57')]=function(_0x40e7e0,_0x390910,_0x1400f7){var _0x55827c={'raw':!![],'where':{}},_0x5ec549={},_0x4d3eff;return db['MailQueue']['findOne']({'where':{'id':_0x40e7e0[_0x3d21('0x4d')]['id']}})['then'](handleEntityNotFound(_0x390910,null))[_0x3d21('0x28')](function(_0x2d5f0d){if(_0x2d5f0d){_0x4d3eff=_0x2d5f0d[_0x3d21('0x2a')]({'plain':!![]});_0x5ec549[_0x3d21('0x39')]=_['keys'](db[_0x3d21('0x58')][_0x3d21('0x33')]);_0x5ec549[_0x3d21('0x35')]=_[_0x3d21('0x34')](_0x40e7e0[_0x3d21('0x35')]);_0x5ec549[_0x3d21('0x37')]=_[_0x3d21('0x38')](_0x5ec549[_0x3d21('0x39')],_0x5ec549['query']);_0x55827c[_0x3d21('0x3a')]=_[_0x3d21('0x38')](_0x5ec549[_0x3d21('0x39')],qs[_0x3d21('0x3b')](_0x40e7e0[_0x3d21('0x35')][_0x3d21('0x3b')]));_0x55827c[_0x3d21('0x3a')]=_0x55827c[_0x3d21('0x3a')][_0x3d21('0x59')]?_0x55827c[_0x3d21('0x3a')]:_0x5ec549['model'];if(!_0x40e7e0[_0x3d21('0x35')][_0x3d21('0x3c')]('nolimit')){_0x55827c[_0x3d21('0x22')]=qs['limit'](_0x40e7e0['query']['limit']);_0x55827c[_0x3d21('0x21')]=qs['offset'](_0x40e7e0[_0x3d21('0x35')][_0x3d21('0x21')]);}_0x55827c[_0x3d21('0x3e')]=qs['sort'](_0x40e7e0[_0x3d21('0x35')][_0x3d21('0x3f')]);_0x55827c[_0x3d21('0x40')]=qs['filters'](_[_0x3d21('0x41')](_0x40e7e0[_0x3d21('0x35')],_0x5ec549['filters']));_0x55827c['where'][_0x3d21('0x5a')]=_0x2d5f0d['id'];if(_0x40e7e0[_0x3d21('0x35')][_0x3d21('0x45')]){_0x55827c['where']=_[_0x3d21('0x44')](_0x55827c['where'],{'$or':_['map'](_0x55827c['attributes'],function(_0x3ebe85){var _0x7acd31={};_0x7acd31[_0x3ebe85]={'$like':'%'+_0x40e7e0[_0x3d21('0x35')]['filter']+'%'};return _0x7acd31;})});}_0x55827c=_[_0x3d21('0x44')]({},_0x55827c,_0x40e7e0['options']);return db[_0x3d21('0x58')][_0x3d21('0x4a')](_0x55827c);}})[_0x3d21('0x28')](function(_0x257da2){if(_0x257da2){return db[_0x3d21('0x5b')][_0x3d21('0x5c')]({'where':{'id':_[_0x3d21('0x46')](_0x257da2,'UserId'),'role':_0x3d21('0x5d')},'attributes':['id','name',_0x3d21('0x5e'),_0x3d21('0x5f'),_0x3d21('0x60')]});}})['then'](function(_0x42fdcc){if(_0x42fdcc){return{'count':_0x42fdcc[_0x3d21('0x20')],'rows':_[_0x3d21('0x46')](_0x42fdcc[_0x3d21('0x4b')],function(_0x45deb9){return{'membername':_0x45deb9[_0x3d21('0x2f')],'UserId':_0x45deb9['id'],'queue_name':_0x4d3eff['name'],'MailQueueId':_0x4d3eff['id'],'interface':util[_0x3d21('0x61')](_0x3d21('0x62'),_0x3d21('0x63'),_0x45deb9[_0x3d21('0x2f')]),'penalty':0x0,'paused':_0x45deb9[_0x3d21('0x5e')],'createdAt':_0x45deb9[_0x3d21('0x60')],'updatedAt':_0x45deb9[_0x3d21('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x390910,_0x55827c))[_0x3d21('0x4c')](handleError(_0x390910,null));};exports[_0x3d21('0x64')]=function(_0x545e49,_0x4875eb,_0x4c8d98){var _0xc04bf1={};var _0x542736={};var _0x2cb8cf;var _0xf4e0a1;return db[_0x3d21('0x32')][_0x3d21('0x65')]({'where':{'id':_0x545e49[_0x3d21('0x4d')]['id']}})[_0x3d21('0x28')](handleEntityNotFound(_0x4875eb,null))[_0x3d21('0x28')](function(_0x5c8773){if(_0x5c8773){_0x2cb8cf=_0x5c8773;_0x542736[_0x3d21('0x39')]=_['keys'](db[_0x3d21('0x66')][_0x3d21('0x33')]);_0x542736[_0x3d21('0x35')]=_['keys'](_0x545e49[_0x3d21('0x35')]);_0x542736[_0x3d21('0x37')]=_['intersection'](_0x542736[_0x3d21('0x39')],_0x542736[_0x3d21('0x35')]);_0xc04bf1['attributes']=_[_0x3d21('0x38')](_0x542736[_0x3d21('0x39')],qs[_0x3d21('0x3b')](_0x545e49['query'][_0x3d21('0x3b')]));_0xc04bf1[_0x3d21('0x3a')]=_0xc04bf1['attributes']['length']?_0xc04bf1['attributes']:_0x542736[_0x3d21('0x39')];_0xc04bf1[_0x3d21('0x3e')]=qs[_0x3d21('0x3f')](_0x545e49[_0x3d21('0x35')][_0x3d21('0x3f')]);_0xc04bf1[_0x3d21('0x40')]=qs[_0x3d21('0x37')](_[_0x3d21('0x41')](_0x545e49[_0x3d21('0x35')],_0x542736['filters']));if(_0x545e49[_0x3d21('0x35')][_0x3d21('0x45')]){_0xc04bf1[_0x3d21('0x40')]=_[_0x3d21('0x44')](_0xc04bf1['where'],{'$or':_[_0x3d21('0x46')](_0xc04bf1[_0x3d21('0x3a')],function(_0x2a88b5){var _0x8b5b3={};_0x8b5b3[_0x2a88b5]={'$like':'%'+_0x545e49[_0x3d21('0x35')][_0x3d21('0x45')]+'%'};return _0x8b5b3;})});}_0xc04bf1=_[_0x3d21('0x44')]({},_0xc04bf1,_0x545e49[_0x3d21('0x47')]);return _0x2cb8cf[_0x3d21('0x64')](_0xc04bf1);}})['then'](function(_0x487801){if(_0x487801){_0xf4e0a1=_0x487801[_0x3d21('0x59')];if(!_0x545e49[_0x3d21('0x35')][_0x3d21('0x3c')](_0x3d21('0x3d'))){_0xc04bf1['limit']=qs[_0x3d21('0x22')](_0x545e49[_0x3d21('0x35')]['limit']);_0xc04bf1[_0x3d21('0x21')]=qs[_0x3d21('0x21')](_0x545e49[_0x3d21('0x35')][_0x3d21('0x21')]);}return _0x2cb8cf['getTeams'](_0xc04bf1);}})[_0x3d21('0x28')](function(_0x359754){if(_0x359754){return _0x359754?{'count':_0xf4e0a1,'rows':_0x359754}:null;}})[_0x3d21('0x28')](respondWithResult(_0x4875eb,null))['catch'](handleError(_0x4875eb,null));};exports['addTeams']=function(_0x4bab30,_0x3ef6e4,_0x80a122){var _0x32568e=[];var _0x26a1d2;return db[_0x3d21('0x66')]['findAll']({'where':{'id':_0x4bab30[_0x3d21('0x4f')][_0x3d21('0x67')]},'attributes':['id'],'include':[{'model':db[_0x3d21('0x5b')],'as':_0x3d21('0x68'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x1e41af){if(_0x1e41af){for(var _0x48105e=0x0;_0x48105e<_0x1e41af[_0x3d21('0x59')];_0x48105e+=0x1){for(var _0x15a376=0x0;_0x15a376<_0x1e41af[_0x48105e][_0x3d21('0x68')][_0x3d21('0x59')];_0x15a376+=0x1){_0x32568e=_['union'](_0x32568e,[_0x1e41af[_0x48105e][_0x3d21('0x68')][_0x15a376]['id']]);}}return _0x32568e;}})[_0x3d21('0x28')](function(_0x3d021d){if(_0x3d021d){return db[_0x3d21('0x32')][_0x3d21('0x4e')]({'where':{'id':_0x4bab30[_0x3d21('0x4d')]['id']}});}})['then'](function(_0xa393e3){if(_0xa393e3){_0x26a1d2=_0xa393e3;return _0x26a1d2[_0x3d21('0x69')](_0x32568e,{'penalty':_0x4bab30[_0x3d21('0x4f')][_0x3d21('0x6a')]});}})[_0x3d21('0x28')](function(_0xc25a64){if(_0xc25a64){return _0x26a1d2[_0x3d21('0x6b')](_0x4bab30[_0x3d21('0x4f')]['ids']);}})[_0x3d21('0x28')](handleEntityNotFound(_0x3ef6e4,null))[_0x3d21('0x28')](respondWithStatusCode(_0x3ef6e4,null))[_0x3d21('0x4c')](handleError(_0x3ef6e4,null));};exports['removeTeams']=function(_0xca5951,_0xf9108d,_0x98e07e){var _0x2051dc=[];var _0x1ebb8a;return db[_0x3d21('0x66')][_0x3d21('0x4a')]({'where':{'id':_0xca5951[_0x3d21('0x35')][_0x3d21('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3d21('0x68'),'attributes':['id'],'raw':!![]}]})[_0x3d21('0x28')](function(_0x5d5f32){if(_0x5d5f32){for(var _0x163d83=0x0;_0x163d83<_0x5d5f32[_0x3d21('0x59')];_0x163d83+=0x1){for(var _0x4a1f5c=0x0;_0x4a1f5c<_0x5d5f32[_0x163d83][_0x3d21('0x68')][_0x3d21('0x59')];_0x4a1f5c+=0x1){_0x2051dc=_[_0x3d21('0x6c')](_0x2051dc,[_0x5d5f32[_0x163d83][_0x3d21('0x68')][_0x4a1f5c]['id']]);}}return _0x2051dc;}})[_0x3d21('0x28')](function(_0x5e01eb){if(_0x5e01eb){return db['MailQueue'][_0x3d21('0x4e')]({'where':{'id':_0xca5951[_0x3d21('0x4d')]['id']}});}})[_0x3d21('0x28')](function(_0xe1ed45){if(_0xe1ed45){_0x1ebb8a=_0xe1ed45;return _0x1ebb8a['removeAgents'](_0x2051dc);}})['then'](function(_0x3d61af){if(_0x1ebb8a){return _0x1ebb8a[_0x3d21('0x6d')](_0xca5951[_0x3d21('0x35')][_0x3d21('0x67')]);}})['then'](handleEntityNotFound(_0xf9108d,null))[_0x3d21('0x28')](respondWithStatusCode(_0xf9108d,null))[_0x3d21('0x4c')](handleError(_0xf9108d,null));};exports[_0x3d21('0x69')]=function(_0x4f8604,_0x48463e,_0x373b00){return db['MailQueue'][_0x3d21('0x4e')]({'where':{'id':_0x4f8604['params']['id']}})[_0x3d21('0x28')](handleEntityNotFound(_0x48463e,null))['then'](function(_0x55f044){if(_0x55f044){return _0x55f044['addAgents'](_0x4f8604[_0x3d21('0x4f')][_0x3d21('0x67')],_[_0x3d21('0x6e')](_0x4f8604[_0x3d21('0x4f')],[_0x3d21('0x67'),'id'])||{})[_0x3d21('0x6f')](function(_0x2eeb92){for(var _0x2a0fe6=0x0;_0x2a0fe6<_0x4f8604['body']['ids'][_0x3d21('0x59')];_0x2a0fe6+=0x1){socket[_0x3d21('0x70')]('userMailQueue:save',{'UserId':_0x4f8604[_0x3d21('0x4f')]['ids'][_0x2a0fe6],'MailQueueId':_0x4f8604[_0x3d21('0x4d')]['id']});}return _0x2eeb92;});}})[_0x3d21('0x28')](respondWithResult(_0x48463e,null))[_0x3d21('0x4c')](handleError(_0x48463e,null));};exports[_0x3d21('0x71')]=function(_0x229595,_0x585068,_0x54f30d){var _0x16b3c1;return db[_0x3d21('0x32')]['find']({'where':{'id':_0x229595['params']['id']}})[_0x3d21('0x28')](handleEntityNotFound(_0x585068,null))['then'](function(_0x30ad28){if(_0x30ad28){return _0x30ad28[_0x3d21('0x71')](_0x229595[_0x3d21('0x35')][_0x3d21('0x67')])[_0x3d21('0x28')](function(_0x885a68){if(_['isArray'](_0x229595[_0x3d21('0x35')][_0x3d21('0x67')])){for(var _0x1e8d8a=0x0;_0x1e8d8a<_0x229595[_0x3d21('0x35')][_0x3d21('0x67')][_0x3d21('0x59')];_0x1e8d8a+=0x1){socket[_0x3d21('0x70')]('userMailQueue:remove',{'UserId':_0x229595[_0x3d21('0x35')][_0x3d21('0x67')][_0x1e8d8a],'MailQueueId':_0x229595[_0x3d21('0x4d')]['id']});}}else{socket['emit'](_0x3d21('0x72'),{'UserId':_0x229595[_0x3d21('0x35')][_0x3d21('0x67')],'MailQueueId':_0x229595[_0x3d21('0x4d')]['id']});}});}})[_0x3d21('0x28')](respondWithStatusCode(_0x585068,null))[_0x3d21('0x4c')](handleError(_0x585068,null));};exports[_0x3d21('0x73')]=function(_0x5e9d4e,_0x16eb27,_0xd12c49){var _0x449198={};var _0x539f9a={};var _0x59b925;var _0x27ef16;return db[_0x3d21('0x32')][_0x3d21('0x65')]({'where':{'id':_0x5e9d4e[_0x3d21('0x4d')]['id']}})[_0x3d21('0x28')](handleEntityNotFound(_0x16eb27,null))[_0x3d21('0x28')](function(_0x1db45a){if(_0x1db45a){_0x59b925=_0x1db45a;_0x539f9a[_0x3d21('0x39')]=_[_0x3d21('0x34')](db[_0x3d21('0x5b')][_0x3d21('0x33')]);_0x539f9a[_0x3d21('0x35')]=_[_0x3d21('0x34')](_0x5e9d4e[_0x3d21('0x35')]);_0x539f9a[_0x3d21('0x37')]=_[_0x3d21('0x38')](_0x539f9a[_0x3d21('0x39')],_0x539f9a['query']);_0x449198[_0x3d21('0x3a')]=_[_0x3d21('0x38')](_0x539f9a[_0x3d21('0x39')],qs[_0x3d21('0x3b')](_0x5e9d4e['query'][_0x3d21('0x3b')]));_0x449198['attributes']=_0x449198[_0x3d21('0x3a')][_0x3d21('0x59')]?_0x449198[_0x3d21('0x3a')]:_0x539f9a['model'];_0x449198[_0x3d21('0x3e')]=qs['sort'](_0x5e9d4e[_0x3d21('0x35')][_0x3d21('0x3f')]);_0x449198['where']=qs[_0x3d21('0x37')](_[_0x3d21('0x41')](_0x5e9d4e['query'],_0x539f9a[_0x3d21('0x37')]));if(_0x5e9d4e[_0x3d21('0x35')]['filter']){_0x449198[_0x3d21('0x40')]=_['merge'](_0x449198[_0x3d21('0x40')],{'$or':_['map'](_0x449198['attributes'],function(_0x3513b8){var _0x4d2f51={};_0x4d2f51[_0x3513b8]={'$like':'%'+_0x5e9d4e['query'][_0x3d21('0x45')]+'%'};return _0x4d2f51;})});}_0x449198=_['merge']({},_0x449198,_0x5e9d4e['options']);return _0x59b925[_0x3d21('0x73')](_0x449198);}})[_0x3d21('0x28')](function(_0x25bd75){if(_0x25bd75){_0x27ef16=_0x25bd75['length'];if(!_0x5e9d4e[_0x3d21('0x35')]['hasOwnProperty']('nolimit')){_0x449198['limit']=qs['limit'](_0x5e9d4e[_0x3d21('0x35')]['limit']);_0x449198[_0x3d21('0x21')]=qs[_0x3d21('0x21')](_0x5e9d4e[_0x3d21('0x35')][_0x3d21('0x21')]);}return _0x59b925[_0x3d21('0x73')](_0x449198);}})[_0x3d21('0x28')](function(_0x3739e9){if(_0x3739e9){return _0x3739e9?{'count':_0x27ef16,'rows':_0x3739e9}:null;}})[_0x3d21('0x28')](respondWithResult(_0x16eb27,null))[_0x3d21('0x4c')](handleError(_0x16eb27,null));}; \ No newline at end of file +var _0xe0e0=['bluebird','mustache','path','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','get','MailQueues','destroy','error','name','MailQueue','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','add','day','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','pick','MailQueueId','User','findAndCountAll','UserId','mailPause','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','addAgents','removeTeams','union','omit','spread','removeAgents','isArray','emit','userMailQueue:remove','getAgents','html-pdf','eml-format','fast-json-patch'];(function(_0x5ae927,_0x274c21){var _0x4fb2f1=function(_0x1b2eab){while(--_0x1b2eab){_0x5ae927['push'](_0x5ae927['shift']());}};_0x4fb2f1(++_0x274c21);}(_0xe0e0,0x69));var _0x0e0e=function(_0xfc0f6f,_0x3c40cb){_0xfc0f6f=_0xfc0f6f-0x0;var _0xef5e23=_0xe0e0[_0xfc0f6f];return _0xef5e23;};'use strict';var pdf=require(_0x0e0e('0x0'));var emlformat=require(_0x0e0e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e0e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0e0e('0x3'));var Mustache=require(_0x0e0e('0x4'));var util=require('util');var path=require(_0x0e0e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0e0e('0x6'));var fs=require('fs');var _=require(_0x0e0e('0x7'));var squel=require(_0x0e0e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0e0e('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x0e0e('0xa'));var querystring=require(_0x0e0e('0xb'));var Papa=require(_0x0e0e('0xc'));var Redis=require('ioredis');var qs=require(_0x0e0e('0xd'));var logger=require(_0x0e0e('0xe'))(_0x0e0e('0xf'));var utils=require(_0x0e0e('0x10'));var config=require('../../config/environment');var db=require(_0x0e0e('0x11'))['db'];config['redis']=_['defaults'](config[_0x0e0e('0x12')],{'host':_0x0e0e('0x13'),'port':0x18eb});var socket=require(_0x0e0e('0x14'))(new Redis(config[_0x0e0e('0x12')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0xee4c45,_0xc4d177){_0xc4d177=_0xc4d177||0xcc;return function(_0x51a6e5){if(_0x51a6e5){return _0xee4c45[_0x0e0e('0x15')](_0xc4d177);}return _0xee4c45[_0x0e0e('0x16')](_0xc4d177)[_0x0e0e('0x17')]();};}function respondWithResult(_0x37bd59,_0x38ee98){_0x38ee98=_0x38ee98||0xc8;return function(_0x10119c){if(_0x10119c){return _0x37bd59[_0x0e0e('0x16')](_0x38ee98)[_0x0e0e('0x18')](_0x10119c);}};}function respondWithFilteredResult(_0x2751fd,_0x280bf7){return function(_0x305994){if(_0x305994){var _0x40959a=_0x305994[_0x0e0e('0x19')],_0x44396c=_0x280bf7[_0x0e0e('0x1a')],_0x262749=_0x280bf7['offset']+_0x280bf7['limit'],_0x458e53;if(_0x262749>=_0x40959a){_0x262749=_0x40959a;_0x458e53=0xc8;}else{_0x458e53=0xce;}_0x2751fd[_0x0e0e('0x16')](_0x458e53);return _0x2751fd[_0x0e0e('0x1b')](_0x0e0e('0x1c'),_0x44396c+'-'+_0x262749+'/'+_0x40959a)['json'](_0x305994);}return null;};}function patchUpdates(_0xdf0ee1){return function(_0x4be010){try{jsonpatch[_0x0e0e('0x1d')](_0x4be010,_0xdf0ee1,!![]);}catch(_0x5b5539){return BPromise[_0x0e0e('0x1e')](_0x5b5539);}return _0x4be010['save']();};}function saveUpdates(_0x16e859,_0x41c4de){return function(_0x2274b7){if(_0x2274b7){return _0x2274b7[_0x0e0e('0x1f')](_0x16e859)[_0x0e0e('0x20')](function(_0x1307b3){return _0x1307b3;});}return null;};}function removeEntity(_0x5d06f9,_0x3d9cd7){return function(_0x4fb8ef){if(_0x4fb8ef){return _0x4fb8ef['destroy']()['then'](function(){var _0x528a70=_0x4fb8ef[_0x0e0e('0x21')]({'plain':!![]});var _0x241014=_0x0e0e('0x22');return db['UserProfileResource'][_0x0e0e('0x23')]({'where':{'type':_0x241014,'resourceId':_0x528a70['id']}})[_0x0e0e('0x20')](function(){return _0x4fb8ef;});})['then'](function(){_0x5d06f9[_0x0e0e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a06fb,_0x3bd99c){return function(_0x3e604d){if(!_0x3e604d){_0x1a06fb[_0x0e0e('0x15')](0x194);}return _0x3e604d;};}function handleError(_0x13c76c,_0x57119b){_0x57119b=_0x57119b||0x1f4;return function(_0x225f5f){logger[_0x0e0e('0x24')](_0x225f5f['stack']);if(_0x225f5f[_0x0e0e('0x25')]){delete _0x225f5f[_0x0e0e('0x25')];}_0x13c76c[_0x0e0e('0x16')](_0x57119b)['send'](_0x225f5f);};}exports['index']=function(_0x153976,_0x2f1bca){var _0x25721e={},_0x1699ef={},_0x3db648={'count':0x0,'rows':[]};var _0x370784=db[_0x0e0e('0x26')][_0x0e0e('0x27')];_0x1699ef['model']=_[_0x0e0e('0x28')](_0x370784);var _0x5035ec={'dateStart':_0x153976['query']['dateStart'],'dateEnd':_0x153976[_0x0e0e('0x29')][_0x0e0e('0x2a')]};delete _0x153976['query'][_0x0e0e('0x2b')];delete _0x153976[_0x0e0e('0x29')][_0x0e0e('0x2a')];_0x1699ef['query']=_[_0x0e0e('0x28')](_0x153976[_0x0e0e('0x29')]);_0x1699ef[_0x0e0e('0x2c')]=_[_0x0e0e('0x2d')](_0x1699ef[_0x0e0e('0x2e')],_0x1699ef[_0x0e0e('0x29')]);_0x25721e['attributes']=_[_0x0e0e('0x2d')](_0x1699ef[_0x0e0e('0x2e')],qs[_0x0e0e('0x2f')](_0x153976['query'][_0x0e0e('0x2f')]));_0x25721e['attributes']=_0x25721e[_0x0e0e('0x30')][_0x0e0e('0x31')]?_0x25721e['attributes']:_0x1699ef[_0x0e0e('0x2e')];if(!_0x153976['query'][_0x0e0e('0x32')](_0x0e0e('0x33'))){_0x25721e[_0x0e0e('0x34')]=qs[_0x0e0e('0x34')](_0x153976['query'][_0x0e0e('0x34')]);_0x25721e['offset']=qs['offset'](_0x153976[_0x0e0e('0x29')][_0x0e0e('0x1a')]);}_0x25721e[_0x0e0e('0x35')]=qs['sort'](_0x153976[_0x0e0e('0x29')][_0x0e0e('0x36')]);_0x25721e[_0x0e0e('0x37')]=qs['filters'](_['pick'](_0x153976[_0x0e0e('0x29')],_0x1699ef['filters']));if(_0x5035ec['dateStart']){if(_0x5035ec[_0x0e0e('0x2a')]){_0x5035ec[_0x0e0e('0x2a')]=moment(_0x5035ec[_0x0e0e('0x2a')])[_0x0e0e('0x38')](0x1,_0x0e0e('0x39'));}else{_0x5035ec['dateEnd']=moment(_0x5035ec[_0x0e0e('0x2b')])[_0x0e0e('0x38')](0x1,_0x0e0e('0x39'));}_['merge'](_0x25721e[_0x0e0e('0x37')],{'createdAt':{'$gte':_0x5035ec[_0x0e0e('0x2b')],'$lte':_0x5035ec[_0x0e0e('0x2a')]}});}if(_0x153976[_0x0e0e('0x29')][_0x0e0e('0x3a')]){_0x25721e[_0x0e0e('0x37')]=_[_0x0e0e('0x3b')](_0x25721e['where'],{'$or':_[_0x0e0e('0x3c')](_0x25721e[_0x0e0e('0x30')],function(_0x5e09d9){var _0xf06d07={};_0xf06d07[_0x5e09d9]={'$like':'%'+_0x153976[_0x0e0e('0x29')][_0x0e0e('0x3a')]+'%'};return _0xf06d07;})});}_0x25721e=_[_0x0e0e('0x3b')]({},_0x25721e,_0x153976[_0x0e0e('0x3d')]);var _0x275dff={'where':_0x25721e[_0x0e0e('0x37')]};return db[_0x0e0e('0x26')][_0x0e0e('0x19')](_0x275dff)['then'](function(_0x16a037){_0x3db648['count']=_0x16a037;if(_0x153976['query'][_0x0e0e('0x3e')]){_0x25721e[_0x0e0e('0x3f')]=[{'all':!![]}];}return db['MailQueue'][_0x0e0e('0x40')](_0x25721e);})[_0x0e0e('0x20')](function(_0x1fdf1c){_0x3db648[_0x0e0e('0x41')]=_0x1fdf1c;return _0x3db648;})[_0x0e0e('0x20')](respondWithFilteredResult(_0x2f1bca,_0x25721e))[_0x0e0e('0x42')](handleError(_0x2f1bca,null));};exports[_0x0e0e('0x43')]=function(_0x4b5221,_0xc03d7b){var _0x285655={'raw':!![],'where':{'id':_0x4b5221[_0x0e0e('0x44')]['id']}},_0x35e23a={};_0x35e23a['model']=_[_0x0e0e('0x28')](db[_0x0e0e('0x26')][_0x0e0e('0x27')]);_0x35e23a[_0x0e0e('0x29')]=_[_0x0e0e('0x28')](_0x4b5221[_0x0e0e('0x29')]);_0x35e23a[_0x0e0e('0x2c')]=_['intersection'](_0x35e23a['model'],_0x35e23a[_0x0e0e('0x29')]);_0x285655[_0x0e0e('0x30')]=_[_0x0e0e('0x2d')](_0x35e23a['model'],qs['fields'](_0x4b5221[_0x0e0e('0x29')][_0x0e0e('0x2f')]));_0x285655['attributes']=_0x285655[_0x0e0e('0x30')][_0x0e0e('0x31')]?_0x285655[_0x0e0e('0x30')]:_0x35e23a[_0x0e0e('0x2e')];if(_0x4b5221[_0x0e0e('0x29')]['includeAll']){_0x285655[_0x0e0e('0x3f')]=[{'all':!![]}];}_0x285655=_['merge']({},_0x285655,_0x4b5221[_0x0e0e('0x3d')]);return db[_0x0e0e('0x26')][_0x0e0e('0x45')](_0x285655)[_0x0e0e('0x20')](handleEntityNotFound(_0xc03d7b,null))['then'](respondWithResult(_0xc03d7b,null))[_0x0e0e('0x42')](handleError(_0xc03d7b,null));};exports[_0x0e0e('0x46')]=function(_0x40e6b3,_0x4cb9af){return db[_0x0e0e('0x26')]['create'](_0x40e6b3[_0x0e0e('0x47')],{})['then'](function(_0x3ef120){var _0xaf5f6a=_0x40e6b3['user'][_0x0e0e('0x21')]({'plain':!![]});if(!_0xaf5f6a)throw new Error(_0x0e0e('0x48'));if(_0xaf5f6a['role']===_0x0e0e('0x49')){var _0x57ab9e=_0x3ef120['get']({'plain':!![]});var _0x3dac4b='MailQueues';return db[_0x0e0e('0x4a')][_0x0e0e('0x45')]({'where':{'name':_0x3dac4b,'userProfileId':_0xaf5f6a[_0x0e0e('0x4b')]},'raw':!![]})['then'](function(_0x1142e2){if(_0x1142e2&&_0x1142e2[_0x0e0e('0x4c')]===0x0){return db[_0x0e0e('0x4d')][_0x0e0e('0x46')]({'name':_0x57ab9e['name'],'resourceId':_0x57ab9e['id'],'type':_0x1142e2[_0x0e0e('0x25')],'sectionId':_0x1142e2['id']},{})[_0x0e0e('0x20')](function(){return _0x3ef120;});}else{return _0x3ef120;}})['catch'](function(_0x2bfa57){logger[_0x0e0e('0x24')](_0x0e0e('0x4e'),_0x2bfa57);throw _0x2bfa57;});}return _0x3ef120;})[_0x0e0e('0x20')](respondWithResult(_0x4cb9af,0xc9))['catch'](handleError(_0x4cb9af,null));};exports[_0x0e0e('0x1f')]=function(_0x36919b,_0x31dd2c){if(_0x36919b[_0x0e0e('0x47')]['id']){delete _0x36919b[_0x0e0e('0x47')]['id'];}return db[_0x0e0e('0x26')]['find']({'where':{'id':_0x36919b[_0x0e0e('0x44')]['id']}})[_0x0e0e('0x20')](handleEntityNotFound(_0x31dd2c,null))[_0x0e0e('0x20')](saveUpdates(_0x36919b[_0x0e0e('0x47')],null))['then'](respondWithResult(_0x31dd2c,null))['catch'](handleError(_0x31dd2c,null));};exports[_0x0e0e('0x23')]=function(_0x3e6967,_0x45edd6){return db[_0x0e0e('0x26')][_0x0e0e('0x45')]({'where':{'id':_0x3e6967['params']['id']}})[_0x0e0e('0x20')](handleEntityNotFound(_0x45edd6,null))[_0x0e0e('0x20')](removeEntity(_0x45edd6,null))[_0x0e0e('0x42')](handleError(_0x45edd6,null));};exports[_0x0e0e('0x4f')]=function(_0x1bef51,_0x409c4e){return db[_0x0e0e('0x26')]['describe']()[_0x0e0e('0x20')](respondWithResult(_0x409c4e,null))[_0x0e0e('0x42')](handleError(_0x409c4e,null));};exports[_0x0e0e('0x50')]=function(_0x41b7c5,_0x2ee320,_0x55af74){var _0x46b4a7={'raw':!![],'where':{}},_0x1794a5={},_0x196a38;return db['MailQueue']['findOne']({'where':{'id':_0x41b7c5['params']['id']}})[_0x0e0e('0x20')](handleEntityNotFound(_0x2ee320,null))[_0x0e0e('0x20')](function(_0x441b33){if(_0x441b33){_0x196a38=_0x441b33['get']({'plain':!![]});_0x1794a5[_0x0e0e('0x2e')]=_[_0x0e0e('0x28')](db[_0x0e0e('0x51')][_0x0e0e('0x27')]);_0x1794a5[_0x0e0e('0x29')]=_[_0x0e0e('0x28')](_0x41b7c5[_0x0e0e('0x29')]);_0x1794a5[_0x0e0e('0x2c')]=_[_0x0e0e('0x2d')](_0x1794a5['model'],_0x1794a5[_0x0e0e('0x29')]);_0x46b4a7[_0x0e0e('0x30')]=_[_0x0e0e('0x2d')](_0x1794a5['model'],qs['fields'](_0x41b7c5[_0x0e0e('0x29')][_0x0e0e('0x2f')]));_0x46b4a7[_0x0e0e('0x30')]=_0x46b4a7[_0x0e0e('0x30')][_0x0e0e('0x31')]?_0x46b4a7[_0x0e0e('0x30')]:_0x1794a5['model'];if(!_0x41b7c5['query'][_0x0e0e('0x32')](_0x0e0e('0x33'))){_0x46b4a7[_0x0e0e('0x34')]=qs['limit'](_0x41b7c5[_0x0e0e('0x29')][_0x0e0e('0x34')]);_0x46b4a7['offset']=qs[_0x0e0e('0x1a')](_0x41b7c5[_0x0e0e('0x29')][_0x0e0e('0x1a')]);}_0x46b4a7['order']=qs[_0x0e0e('0x36')](_0x41b7c5['query'][_0x0e0e('0x36')]);_0x46b4a7['where']=qs[_0x0e0e('0x2c')](_[_0x0e0e('0x52')](_0x41b7c5[_0x0e0e('0x29')],_0x1794a5[_0x0e0e('0x2c')]));_0x46b4a7[_0x0e0e('0x37')][_0x0e0e('0x53')]=_0x441b33['id'];if(_0x41b7c5[_0x0e0e('0x29')][_0x0e0e('0x3a')]){_0x46b4a7[_0x0e0e('0x37')]=_[_0x0e0e('0x3b')](_0x46b4a7['where'],{'$or':_[_0x0e0e('0x3c')](_0x46b4a7['attributes'],function(_0x5c6466){var _0x5c781b={};_0x5c781b[_0x5c6466]={'$like':'%'+_0x41b7c5[_0x0e0e('0x29')][_0x0e0e('0x3a')]+'%'};return _0x5c781b;})});}_0x46b4a7=_[_0x0e0e('0x3b')]({},_0x46b4a7,_0x41b7c5[_0x0e0e('0x3d')]);return db[_0x0e0e('0x51')]['findAll'](_0x46b4a7);}})[_0x0e0e('0x20')](function(_0x3555b2){if(_0x3555b2){return db[_0x0e0e('0x54')][_0x0e0e('0x55')]({'where':{'id':_[_0x0e0e('0x3c')](_0x3555b2,_0x0e0e('0x56')),'role':'agent'},'attributes':['id',_0x0e0e('0x25'),_0x0e0e('0x57'),'updatedAt','createdAt']});}})[_0x0e0e('0x20')](function(_0x16fdf0){if(_0x16fdf0){return{'count':_0x16fdf0['count'],'rows':_[_0x0e0e('0x3c')](_0x16fdf0[_0x0e0e('0x41')],function(_0x2c92a6){return{'membername':_0x2c92a6[_0x0e0e('0x25')],'UserId':_0x2c92a6['id'],'queue_name':_0x196a38[_0x0e0e('0x25')],'MailQueueId':_0x196a38['id'],'interface':util[_0x0e0e('0x58')](_0x0e0e('0x59'),_0x0e0e('0x5a'),_0x2c92a6['name']),'penalty':0x0,'paused':_0x2c92a6['mailPause'],'createdAt':_0x2c92a6[_0x0e0e('0x5b')],'updatedAt':_0x2c92a6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2ee320,_0x46b4a7))[_0x0e0e('0x42')](handleError(_0x2ee320,null));};exports[_0x0e0e('0x5c')]=function(_0x32548f,_0x59307f,_0x27cc8a){var _0x271d70={};var _0x2b005f={};var _0x5ebcfe;var _0x4641a6;return db[_0x0e0e('0x26')][_0x0e0e('0x5d')]({'where':{'id':_0x32548f['params']['id']}})[_0x0e0e('0x20')](handleEntityNotFound(_0x59307f,null))[_0x0e0e('0x20')](function(_0xc22fdb){if(_0xc22fdb){_0x5ebcfe=_0xc22fdb;_0x2b005f['model']=_[_0x0e0e('0x28')](db[_0x0e0e('0x5e')][_0x0e0e('0x27')]);_0x2b005f[_0x0e0e('0x29')]=_[_0x0e0e('0x28')](_0x32548f[_0x0e0e('0x29')]);_0x2b005f[_0x0e0e('0x2c')]=_['intersection'](_0x2b005f['model'],_0x2b005f[_0x0e0e('0x29')]);_0x271d70['attributes']=_[_0x0e0e('0x2d')](_0x2b005f[_0x0e0e('0x2e')],qs[_0x0e0e('0x2f')](_0x32548f[_0x0e0e('0x29')][_0x0e0e('0x2f')]));_0x271d70[_0x0e0e('0x30')]=_0x271d70[_0x0e0e('0x30')][_0x0e0e('0x31')]?_0x271d70[_0x0e0e('0x30')]:_0x2b005f[_0x0e0e('0x2e')];_0x271d70[_0x0e0e('0x35')]=qs['sort'](_0x32548f['query'][_0x0e0e('0x36')]);_0x271d70['where']=qs['filters'](_['pick'](_0x32548f[_0x0e0e('0x29')],_0x2b005f[_0x0e0e('0x2c')]));if(_0x32548f[_0x0e0e('0x29')][_0x0e0e('0x3a')]){_0x271d70[_0x0e0e('0x37')]=_[_0x0e0e('0x3b')](_0x271d70[_0x0e0e('0x37')],{'$or':_[_0x0e0e('0x3c')](_0x271d70['attributes'],function(_0x84e9c6){var _0x37462e={};_0x37462e[_0x84e9c6]={'$like':'%'+_0x32548f['query'][_0x0e0e('0x3a')]+'%'};return _0x37462e;})});}_0x271d70=_['merge']({},_0x271d70,_0x32548f[_0x0e0e('0x3d')]);return _0x5ebcfe[_0x0e0e('0x5c')](_0x271d70);}})[_0x0e0e('0x20')](function(_0x4760ea){if(_0x4760ea){_0x4641a6=_0x4760ea[_0x0e0e('0x31')];if(!_0x32548f[_0x0e0e('0x29')][_0x0e0e('0x32')]('nolimit')){_0x271d70['limit']=qs[_0x0e0e('0x34')](_0x32548f['query'][_0x0e0e('0x34')]);_0x271d70[_0x0e0e('0x1a')]=qs[_0x0e0e('0x1a')](_0x32548f[_0x0e0e('0x29')]['offset']);}return _0x5ebcfe[_0x0e0e('0x5c')](_0x271d70);}})[_0x0e0e('0x20')](function(_0x5b7c6a){if(_0x5b7c6a){return _0x5b7c6a?{'count':_0x4641a6,'rows':_0x5b7c6a}:null;}})[_0x0e0e('0x20')](respondWithResult(_0x59307f,null))['catch'](handleError(_0x59307f,null));};exports[_0x0e0e('0x5f')]=function(_0x166eec,_0x1aa547,_0xed441b){var _0xd92200=[];var _0x30ee55;return db['Team']['findAll']({'where':{'id':_0x166eec[_0x0e0e('0x47')][_0x0e0e('0x60')]},'attributes':['id'],'include':[{'model':db[_0x0e0e('0x54')],'as':_0x0e0e('0x61'),'attributes':['id'],'raw':!![]}]})[_0x0e0e('0x20')](function(_0x5ad776){if(_0x5ad776){for(var _0x4ef7c7=0x0;_0x4ef7c7<_0x5ad776[_0x0e0e('0x31')];_0x4ef7c7+=0x1){for(var _0x4bfa28=0x0;_0x4bfa28<_0x5ad776[_0x4ef7c7][_0x0e0e('0x61')][_0x0e0e('0x31')];_0x4bfa28+=0x1){_0xd92200=_['union'](_0xd92200,[_0x5ad776[_0x4ef7c7][_0x0e0e('0x61')][_0x4bfa28]['id']]);}}return _0xd92200;}})[_0x0e0e('0x20')](function(_0x519b0e){if(_0x519b0e){return db['MailQueue'][_0x0e0e('0x45')]({'where':{'id':_0x166eec['params']['id']}});}})['then'](function(_0x59896a){if(_0x59896a){_0x30ee55=_0x59896a;return _0x30ee55[_0x0e0e('0x62')](_0xd92200,{'penalty':_0x166eec[_0x0e0e('0x47')]['penalty']});}})['then'](function(_0x219b39){if(_0x219b39){return _0x30ee55['addTeams'](_0x166eec[_0x0e0e('0x47')]['ids']);}})[_0x0e0e('0x20')](handleEntityNotFound(_0x1aa547,null))['then'](respondWithStatusCode(_0x1aa547,null))[_0x0e0e('0x42')](handleError(_0x1aa547,null));};exports[_0x0e0e('0x63')]=function(_0x32e960,_0x15c95f,_0x174f96){var _0x272e4c=[];var _0x4c558a;return db[_0x0e0e('0x5e')][_0x0e0e('0x40')]({'where':{'id':_0x32e960[_0x0e0e('0x29')][_0x0e0e('0x60')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0e0e('0x61'),'attributes':['id'],'raw':!![]}]})[_0x0e0e('0x20')](function(_0x33c24c){if(_0x33c24c){for(var _0x1b1dd4=0x0;_0x1b1dd4<_0x33c24c[_0x0e0e('0x31')];_0x1b1dd4+=0x1){for(var _0x1a6688=0x0;_0x1a6688<_0x33c24c[_0x1b1dd4][_0x0e0e('0x61')]['length'];_0x1a6688+=0x1){_0x272e4c=_[_0x0e0e('0x64')](_0x272e4c,[_0x33c24c[_0x1b1dd4][_0x0e0e('0x61')][_0x1a6688]['id']]);}}return _0x272e4c;}})[_0x0e0e('0x20')](function(_0x560286){if(_0x560286){return db[_0x0e0e('0x26')][_0x0e0e('0x45')]({'where':{'id':_0x32e960['params']['id']}});}})[_0x0e0e('0x20')](function(_0x1c350a){if(_0x1c350a){_0x4c558a=_0x1c350a;return _0x4c558a['removeAgents'](_0x272e4c);}})['then'](function(_0x1743f1){if(_0x4c558a){return _0x4c558a[_0x0e0e('0x63')](_0x32e960[_0x0e0e('0x29')][_0x0e0e('0x60')]);}})[_0x0e0e('0x20')](handleEntityNotFound(_0x15c95f,null))[_0x0e0e('0x20')](respondWithStatusCode(_0x15c95f,null))[_0x0e0e('0x42')](handleError(_0x15c95f,null));};exports[_0x0e0e('0x62')]=function(_0x33e27,_0x5e9f25,_0x2cee4e){return db[_0x0e0e('0x26')][_0x0e0e('0x45')]({'where':{'id':_0x33e27['params']['id']}})['then'](handleEntityNotFound(_0x5e9f25,null))[_0x0e0e('0x20')](function(_0x3a7407){if(_0x3a7407){return _0x3a7407[_0x0e0e('0x62')](_0x33e27['body'][_0x0e0e('0x60')],_[_0x0e0e('0x65')](_0x33e27[_0x0e0e('0x47')],[_0x0e0e('0x60'),'id'])||{})[_0x0e0e('0x66')](function(_0xcf279f){for(var _0x16323e=0x0;_0x16323e<_0x33e27[_0x0e0e('0x47')][_0x0e0e('0x60')][_0x0e0e('0x31')];_0x16323e+=0x1){socket['emit']('userMailQueue:save',{'UserId':_0x33e27[_0x0e0e('0x47')][_0x0e0e('0x60')][_0x16323e],'MailQueueId':_0x33e27[_0x0e0e('0x44')]['id']});}return _0xcf279f;});}})[_0x0e0e('0x20')](respondWithResult(_0x5e9f25,null))[_0x0e0e('0x42')](handleError(_0x5e9f25,null));};exports['removeAgents']=function(_0x2764d3,_0x1fd2ea,_0x43aa53){var _0x39cd01;return db[_0x0e0e('0x26')][_0x0e0e('0x45')]({'where':{'id':_0x2764d3['params']['id']}})[_0x0e0e('0x20')](handleEntityNotFound(_0x1fd2ea,null))[_0x0e0e('0x20')](function(_0x51a7f8){if(_0x51a7f8){return _0x51a7f8[_0x0e0e('0x67')](_0x2764d3['query']['ids'])[_0x0e0e('0x20')](function(_0x42a197){if(_[_0x0e0e('0x68')](_0x2764d3[_0x0e0e('0x29')][_0x0e0e('0x60')])){for(var _0x2ebbc3=0x0;_0x2ebbc3<_0x2764d3[_0x0e0e('0x29')][_0x0e0e('0x60')][_0x0e0e('0x31')];_0x2ebbc3+=0x1){socket[_0x0e0e('0x69')](_0x0e0e('0x6a'),{'UserId':_0x2764d3[_0x0e0e('0x29')][_0x0e0e('0x60')][_0x2ebbc3],'MailQueueId':_0x2764d3[_0x0e0e('0x44')]['id']});}}else{socket[_0x0e0e('0x69')]('userMailQueue:remove',{'UserId':_0x2764d3['query']['ids'],'MailQueueId':_0x2764d3[_0x0e0e('0x44')]['id']});}});}})[_0x0e0e('0x20')](respondWithStatusCode(_0x1fd2ea,null))[_0x0e0e('0x42')](handleError(_0x1fd2ea,null));};exports[_0x0e0e('0x6b')]=function(_0x2771af,_0x3c9424,_0x40f4ee){var _0x36a8fd={};var _0x8ace2f={};var _0x596b14;var _0x10f2fa;return db['MailQueue'][_0x0e0e('0x5d')]({'where':{'id':_0x2771af[_0x0e0e('0x44')]['id']}})[_0x0e0e('0x20')](handleEntityNotFound(_0x3c9424,null))[_0x0e0e('0x20')](function(_0x2f5945){if(_0x2f5945){_0x596b14=_0x2f5945;_0x8ace2f[_0x0e0e('0x2e')]=_[_0x0e0e('0x28')](db[_0x0e0e('0x54')][_0x0e0e('0x27')]);_0x8ace2f['query']=_[_0x0e0e('0x28')](_0x2771af[_0x0e0e('0x29')]);_0x8ace2f[_0x0e0e('0x2c')]=_[_0x0e0e('0x2d')](_0x8ace2f[_0x0e0e('0x2e')],_0x8ace2f[_0x0e0e('0x29')]);_0x36a8fd['attributes']=_['intersection'](_0x8ace2f['model'],qs['fields'](_0x2771af[_0x0e0e('0x29')][_0x0e0e('0x2f')]));_0x36a8fd[_0x0e0e('0x30')]=_0x36a8fd[_0x0e0e('0x30')]['length']?_0x36a8fd[_0x0e0e('0x30')]:_0x8ace2f[_0x0e0e('0x2e')];_0x36a8fd['order']=qs['sort'](_0x2771af[_0x0e0e('0x29')][_0x0e0e('0x36')]);_0x36a8fd[_0x0e0e('0x37')]=qs[_0x0e0e('0x2c')](_['pick'](_0x2771af['query'],_0x8ace2f[_0x0e0e('0x2c')]));if(_0x2771af['query']['filter']){_0x36a8fd['where']=_[_0x0e0e('0x3b')](_0x36a8fd['where'],{'$or':_[_0x0e0e('0x3c')](_0x36a8fd[_0x0e0e('0x30')],function(_0x1f19f5){var _0x348c32={};_0x348c32[_0x1f19f5]={'$like':'%'+_0x2771af[_0x0e0e('0x29')]['filter']+'%'};return _0x348c32;})});}_0x36a8fd=_[_0x0e0e('0x3b')]({},_0x36a8fd,_0x2771af[_0x0e0e('0x3d')]);return _0x596b14['getAgents'](_0x36a8fd);}})[_0x0e0e('0x20')](function(_0x5f465e){if(_0x5f465e){_0x10f2fa=_0x5f465e[_0x0e0e('0x31')];if(!_0x2771af[_0x0e0e('0x29')]['hasOwnProperty'](_0x0e0e('0x33'))){_0x36a8fd[_0x0e0e('0x34')]=qs[_0x0e0e('0x34')](_0x2771af['query'][_0x0e0e('0x34')]);_0x36a8fd[_0x0e0e('0x1a')]=qs[_0x0e0e('0x1a')](_0x2771af[_0x0e0e('0x29')]['offset']);}return _0x596b14[_0x0e0e('0x6b')](_0x36a8fd);}})[_0x0e0e('0x20')](function(_0x9946f3){if(_0x9946f3){return _0x9946f3?{'count':_0x10f2fa,'rows':_0x9946f3}:null;}})[_0x0e0e('0x20')](respondWithResult(_0x3c9424,null))[_0x0e0e('0x42')](handleError(_0x3c9424,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 93d3152..1aae63a 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 _0xe024=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0xe024,0x122));var _0x4e02=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0xe024[_0x1fc18b];return _0x16a351;};'use strict';var EventEmitter=require(_0x4e02('0x0'));var MailQueue=require(_0x4e02('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4e02('0x2')](0x0);var events={'afterCreate':_0x4e02('0x3'),'afterUpdate':_0x4e02('0x4'),'afterDestroy':_0x4e02('0x5')};function emitEvent(_0x341357){return function(_0x4ac60a,_0x1ee6c0,_0x5c6547){MailQueueEvents[_0x4e02('0x6')](_0x341357+':'+_0x4ac60a['id'],_0x4ac60a);MailQueueEvents[_0x4e02('0x6')](_0x341357,_0x4ac60a);_0x5c6547(null);};}for(var e in events){if(events[_0x4e02('0x7')](e)){var event=events[e];MailQueue[_0x4e02('0x8')](e,emitEvent(event));}}module[_0x4e02('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x30ae=['exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x2aab3a,_0x36d682){var _0x45031b=function(_0x16db28){while(--_0x16db28){_0x2aab3a['push'](_0x2aab3a['shift']());}};_0x45031b(++_0x36d682);}(_0x30ae,0x119));var _0xe30a=function(_0x16c2da,_0x5272ce){_0x16c2da=_0x16c2da-0x0;var _0x35105e=_0x30ae[_0x16c2da];return _0x35105e;};'use strict';var EventEmitter=require(_0xe30a('0x0'));var MailQueue=require(_0xe30a('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe30a('0x2')](0x0);var events={'afterCreate':_0xe30a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc4243c){return function(_0x11bb2c,_0xfef320,_0x44ac8b){MailQueueEvents[_0xe30a('0x4')](_0xc4243c+':'+_0x11bb2c['id'],_0x11bb2c);MailQueueEvents[_0xe30a('0x4')](_0xc4243c,_0x11bb2c);_0x44ac8b(null);};}for(var e in events){if(events[_0xe30a('0x5')](e)){var event=events[e];MailQueue[_0xe30a('0x6')](e,emitEvent(event));}}module[_0xe30a('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 47b125d..08e361a 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 _0xf6e4=['lodash','../../config/logger','api','moment','./mailQueue.attributes','exports','define','mail_queues'];(function(_0x30e633,_0x1887cd){var _0x3a4d19=function(_0x15354a){while(--_0x15354a){_0x30e633['push'](_0x30e633['shift']());}};_0x3a4d19(++_0x1887cd);}(_0xf6e4,0x1e8));var _0x4f6e=function(_0x1714cf,_0x58f5cf){_0x1714cf=_0x1714cf-0x0;var _0x4d9bd9=_0xf6e4[_0x1714cf];return _0x4d9bd9;};'use strict';var _=require(_0x4f6e('0x0'));var util=require('util');var logger=require(_0x4f6e('0x1'))(_0x4f6e('0x2'));var moment=require(_0x4f6e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x4f6e('0x4'));module[_0x4f6e('0x5')]=function(_0x2b4c8d,_0x4fc003){return _0x2b4c8d[_0x4f6e('0x6')]('MailQueue',attributes,{'tableName':_0x4f6e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02f9=['MailQueue','mail_queues','util','../../config/logger','api','moment','request-promise','./mailQueue.attributes','exports','define'];(function(_0x3ee79f,_0x3785e7){var _0x2c6fe4=function(_0xdd61d){while(--_0xdd61d){_0x3ee79f['push'](_0x3ee79f['shift']());}};_0x2c6fe4(++_0x3785e7);}(_0x02f9,0xde));var _0x902f=function(_0x2a8972,_0x5058c7){_0x2a8972=_0x2a8972-0x0;var _0x13fc7a=_0x02f9[_0x2a8972];return _0x13fc7a;};'use strict';var _=require('lodash');var util=require(_0x902f('0x0'));var logger=require(_0x902f('0x1'))(_0x902f('0x2'));var moment=require(_0x902f('0x3'));var BPromise=require('bluebird');var rp=require(_0x902f('0x4'));var attributes=require(_0x902f('0x5'));module[_0x902f('0x6')]=function(_0x2c9308,_0xfce2c0){return _0x2c9308[_0x902f('0x7')](_0x902f('0x8'),attributes,{'tableName':_0x902f('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 32a0cbb..96fe63e 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 _0xf999=['ShowMailQueue','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','where','attributes','limit','include','map','model','then','GetMailQueue'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xf999,0x173));var _0x9f99=function(_0x5e59c2,_0x2ec577){_0x5e59c2=_0x5e59c2-0x0;var _0x56625f=_0xf999[_0x5e59c2];return _0x56625f;};'use strict';var _=require(_0x9f99('0x0'));var util=require(_0x9f99('0x1'));var moment=require('moment');var BPromise=require(_0x9f99('0x2'));var rs=require(_0x9f99('0x3'));var fs=require('fs');var Redis=require(_0x9f99('0x4'));var db=require(_0x9f99('0x5'))['db'];var utils=require(_0x9f99('0x6'));var logger=require(_0x9f99('0x7'))(_0x9f99('0x8'));var config=require(_0x9f99('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9f99('0xa')]['http']({'port':0x232a});config[_0x9f99('0xb')]=_[_0x9f99('0xc')](config[_0x9f99('0xb')],{'host':_0x9f99('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f99('0xb')]));require(_0x9f99('0xe'))[_0x9f99('0xf')](socket);function respondWithRpcPromise(_0x1278a1,_0x152b87,_0x540fd1){return new BPromise(function(_0x514c36,_0x3ae3ee){return client[_0x9f99('0x10')](_0x1278a1,_0x540fd1)['then'](function(_0x59fa07){logger[_0x9f99('0x11')](_0x9f99('0x12'),_0x152b87,_0x9f99('0x13'));logger[_0x9f99('0x14')](_0x9f99('0x15'),_0x152b87,_0x9f99('0x13'),JSON[_0x9f99('0x16')](_0x59fa07));if(_0x59fa07[_0x9f99('0x17')]){if(_0x59fa07[_0x9f99('0x17')][_0x9f99('0x18')]===0x1f4){logger[_0x9f99('0x17')]('MailQueue,\x20%s,\x20%s',_0x152b87,_0x59fa07['error']['message']);return _0x3ae3ee(_0x59fa07['error'][_0x9f99('0x19')]);}logger['error'](_0x9f99('0x12'),_0x152b87,_0x59fa07[_0x9f99('0x17')]['message']);return _0x514c36(_0x59fa07[_0x9f99('0x17')]['message']);}else{logger[_0x9f99('0x11')](_0x9f99('0x12'),_0x152b87,'request\x20sent');_0x514c36(_0x59fa07[_0x9f99('0x1a')][_0x9f99('0x19')]);}})[_0x9f99('0x1b')](function(_0x4d35f8){logger['error'](_0x9f99('0x12'),_0x152b87,_0x4d35f8);_0x3ae3ee(_0x4d35f8);});});}exports['GetMailQueue']=function(_0x4b15b7){var _0x3a4027=this;return new Promise(function(_0x6dcfb1,_0x32e2ed){return db[_0x9f99('0x1c')][_0x9f99('0x1d')]({'raw':_0x4b15b7[_0x9f99('0x1e')]?_0x4b15b7[_0x9f99('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4b15b7[_0x9f99('0x1e')]?_0x4b15b7['options'][_0x9f99('0x1f')]||null:null,'attributes':_0x4b15b7[_0x9f99('0x1e')]?_0x4b15b7['options'][_0x9f99('0x20')]||null:null,'limit':_0x4b15b7[_0x9f99('0x1e')]?_0x4b15b7[_0x9f99('0x1e')][_0x9f99('0x21')]||null:null,'include':_0x4b15b7[_0x9f99('0x1e')]?_0x4b15b7[_0x9f99('0x1e')][_0x9f99('0x22')]?_[_0x9f99('0x23')](_0x4b15b7[_0x9f99('0x1e')][_0x9f99('0x22')],function(_0x4ad4c9){return{'model':db[_0x4ad4c9[_0x9f99('0x24')]],'as':_0x4ad4c9['as'],'attributes':_0x4ad4c9['attributes'],'include':_0x4ad4c9[_0x9f99('0x22')]?_['map'](_0x4ad4c9[_0x9f99('0x22')],function(_0x5bb8b5){return{'model':db[_0x5bb8b5[_0x9f99('0x24')]],'as':_0x5bb8b5['as'],'attributes':_0x5bb8b5[_0x9f99('0x20')],'include':_0x5bb8b5[_0x9f99('0x22')]?_[_0x9f99('0x23')](_0x5bb8b5['include'],function(_0x44798e){return{'model':db[_0x44798e[_0x9f99('0x24')]],'as':_0x44798e['as'],'attributes':_0x44798e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f99('0x25')](function(_0xf46b92){logger[_0x9f99('0x11')]('GetMailQueue',_0x4b15b7);logger[_0x9f99('0x14')](_0x9f99('0x26'),_0x4b15b7,JSON[_0x9f99('0x16')](_0xf46b92));_0x6dcfb1(_0xf46b92);})['catch'](function(_0x270287){logger[_0x9f99('0x17')](_0x9f99('0x26'),_0x270287['message'],_0x4b15b7);_0x32e2ed(_0x3a4027[_0x9f99('0x17')](0x1f4,_0x270287[_0x9f99('0x19')]));});});};exports[_0x9f99('0x27')]=function(_0x9fcc76){var _0x5030ce=this;return new Promise(function(_0x2f6d1b,_0x4efd14){return db[_0x9f99('0x1c')]['find']({'raw':_0x9fcc76[_0x9f99('0x1e')]?_0x9fcc76[_0x9f99('0x1e')][_0x9f99('0x28')]===undefined?!![]:![]:!![],'where':_0x9fcc76['options']?_0x9fcc76['options'][_0x9f99('0x1f')]||null:null,'attributes':_0x9fcc76['options']?_0x9fcc76[_0x9f99('0x1e')][_0x9f99('0x20')]||null:null,'include':_0x9fcc76[_0x9f99('0x1e')]?_0x9fcc76[_0x9f99('0x1e')]['include']?_[_0x9f99('0x23')](_0x9fcc76['options'][_0x9f99('0x22')],function(_0x5b5104){return{'model':db[_0x5b5104[_0x9f99('0x24')]],'as':_0x5b5104['as'],'attributes':_0x5b5104[_0x9f99('0x20')],'include':_0x5b5104[_0x9f99('0x22')]?_[_0x9f99('0x23')](_0x5b5104[_0x9f99('0x22')],function(_0x2011ef){return{'model':db[_0x2011ef['model']],'as':_0x2011ef['as'],'attributes':_0x2011ef[_0x9f99('0x20')],'include':_0x2011ef['include']?_[_0x9f99('0x23')](_0x2011ef[_0x9f99('0x22')],function(_0x11ae94){return{'model':db[_0x11ae94[_0x9f99('0x24')]],'as':_0x11ae94['as'],'attributes':_0x11ae94[_0x9f99('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9f99('0x25')](function(_0x2939be){logger[_0x9f99('0x11')](_0x9f99('0x27'),_0x9fcc76);logger[_0x9f99('0x14')](_0x9f99('0x27'),_0x9fcc76,JSON[_0x9f99('0x16')](_0x2939be));_0x2f6d1b(_0x2939be);})['catch'](function(_0x2bb50b){logger[_0x9f99('0x17')](_0x9f99('0x27'),_0x2bb50b['message'],_0x9fcc76);_0x4efd14(_0x5030ce[_0x9f99('0x17')](0x1f4,_0x2bb50b[_0x9f99('0x19')]));});});}; \ No newline at end of file +var _0x5ecd=['error','code','message','GetMailQueue','options','raw','attributes','limit','include','map','model','debug','catch','MailQueue','find','where','ShowMailQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x40cfa3,_0x92e3cb){var _0x13d74a=function(_0x48dd19){while(--_0x48dd19){_0x40cfa3['push'](_0x40cfa3['shift']());}};_0x13d74a(++_0x92e3cb);}(_0x5ecd,0x1f1));var _0xd5ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ecd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5ec('0x0'));var util=require(_0xd5ec('0x1'));var moment=require('moment');var BPromise=require(_0xd5ec('0x2'));var rs=require(_0xd5ec('0x3'));var fs=require('fs');var Redis=require(_0xd5ec('0x4'));var db=require(_0xd5ec('0x5'))['db'];var utils=require(_0xd5ec('0x6'));var logger=require('../../config/logger')(_0xd5ec('0x7'));var config=require(_0xd5ec('0x8'));var jayson=require(_0xd5ec('0x9'));var client=jayson[_0xd5ec('0xa')][_0xd5ec('0xb')]({'port':0x232a});config[_0xd5ec('0xc')]=_['defaults'](config[_0xd5ec('0xc')],{'host':_0xd5ec('0xd'),'port':0x18eb});var socket=require(_0xd5ec('0xe'))(new Redis(config[_0xd5ec('0xc')]));require(_0xd5ec('0xf'))[_0xd5ec('0x10')](socket);function respondWithRpcPromise(_0xc6100b,_0x24841a,_0x359783){return new BPromise(function(_0x2c7729,_0x45b3a8){return client[_0xd5ec('0x11')](_0xc6100b,_0x359783)[_0xd5ec('0x12')](function(_0x21f6aa){logger[_0xd5ec('0x13')](_0xd5ec('0x14'),_0x24841a,_0xd5ec('0x15'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x24841a,_0xd5ec('0x15'),JSON[_0xd5ec('0x16')](_0x21f6aa));if(_0x21f6aa['error']){if(_0x21f6aa[_0xd5ec('0x17')][_0xd5ec('0x18')]===0x1f4){logger[_0xd5ec('0x17')]('MailQueue,\x20%s,\x20%s',_0x24841a,_0x21f6aa[_0xd5ec('0x17')][_0xd5ec('0x19')]);return _0x45b3a8(_0x21f6aa[_0xd5ec('0x17')][_0xd5ec('0x19')]);}logger[_0xd5ec('0x17')](_0xd5ec('0x14'),_0x24841a,_0x21f6aa['error'][_0xd5ec('0x19')]);return _0x2c7729(_0x21f6aa[_0xd5ec('0x17')][_0xd5ec('0x19')]);}else{logger[_0xd5ec('0x13')](_0xd5ec('0x14'),_0x24841a,_0xd5ec('0x15'));_0x2c7729(_0x21f6aa['result'][_0xd5ec('0x19')]);}})['catch'](function(_0x59b56f){logger[_0xd5ec('0x17')](_0xd5ec('0x14'),_0x24841a,_0x59b56f);_0x45b3a8(_0x59b56f);});});}exports[_0xd5ec('0x1a')]=function(_0x277f29){var _0x3aa80f=this;return new Promise(function(_0x544739,_0x37127a){return db['MailQueue']['findAll']({'raw':_0x277f29[_0xd5ec('0x1b')]?_0x277f29['options'][_0xd5ec('0x1c')]===undefined?!![]:![]:!![],'where':_0x277f29[_0xd5ec('0x1b')]?_0x277f29[_0xd5ec('0x1b')]['where']||null:null,'attributes':_0x277f29[_0xd5ec('0x1b')]?_0x277f29[_0xd5ec('0x1b')][_0xd5ec('0x1d')]||null:null,'limit':_0x277f29['options']?_0x277f29['options'][_0xd5ec('0x1e')]||null:null,'include':_0x277f29['options']?_0x277f29['options'][_0xd5ec('0x1f')]?_[_0xd5ec('0x20')](_0x277f29['options'][_0xd5ec('0x1f')],function(_0x10fd2d){return{'model':db[_0x10fd2d['model']],'as':_0x10fd2d['as'],'attributes':_0x10fd2d[_0xd5ec('0x1d')],'include':_0x10fd2d[_0xd5ec('0x1f')]?_[_0xd5ec('0x20')](_0x10fd2d[_0xd5ec('0x1f')],function(_0x445892){return{'model':db[_0x445892['model']],'as':_0x445892['as'],'attributes':_0x445892[_0xd5ec('0x1d')],'include':_0x445892['include']?_[_0xd5ec('0x20')](_0x445892[_0xd5ec('0x1f')],function(_0x39de17){return{'model':db[_0x39de17[_0xd5ec('0x21')]],'as':_0x39de17['as'],'attributes':_0x39de17[_0xd5ec('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3928e4){logger[_0xd5ec('0x13')](_0xd5ec('0x1a'),_0x277f29);logger[_0xd5ec('0x22')](_0xd5ec('0x1a'),_0x277f29,JSON[_0xd5ec('0x16')](_0x3928e4));_0x544739(_0x3928e4);})[_0xd5ec('0x23')](function(_0x1484ed){logger[_0xd5ec('0x17')](_0xd5ec('0x1a'),_0x1484ed[_0xd5ec('0x19')],_0x277f29);_0x37127a(_0x3aa80f[_0xd5ec('0x17')](0x1f4,_0x1484ed[_0xd5ec('0x19')]));});});};exports['ShowMailQueue']=function(_0x13cc66){var _0x2c7c82=this;return new Promise(function(_0x60da2e,_0x4f455f){return db[_0xd5ec('0x24')][_0xd5ec('0x25')]({'raw':_0x13cc66[_0xd5ec('0x1b')]?_0x13cc66['options'][_0xd5ec('0x1c')]===undefined?!![]:![]:!![],'where':_0x13cc66[_0xd5ec('0x1b')]?_0x13cc66[_0xd5ec('0x1b')][_0xd5ec('0x26')]||null:null,'attributes':_0x13cc66[_0xd5ec('0x1b')]?_0x13cc66[_0xd5ec('0x1b')][_0xd5ec('0x1d')]||null:null,'include':_0x13cc66[_0xd5ec('0x1b')]?_0x13cc66[_0xd5ec('0x1b')]['include']?_[_0xd5ec('0x20')](_0x13cc66['options'][_0xd5ec('0x1f')],function(_0x1788fb){return{'model':db[_0x1788fb[_0xd5ec('0x21')]],'as':_0x1788fb['as'],'attributes':_0x1788fb['attributes'],'include':_0x1788fb[_0xd5ec('0x1f')]?_['map'](_0x1788fb[_0xd5ec('0x1f')],function(_0x2c873b){return{'model':db[_0x2c873b['model']],'as':_0x2c873b['as'],'attributes':_0x2c873b[_0xd5ec('0x1d')],'include':_0x2c873b[_0xd5ec('0x1f')]?_[_0xd5ec('0x20')](_0x2c873b[_0xd5ec('0x1f')],function(_0x2b93bd){return{'model':db[_0x2b93bd[_0xd5ec('0x21')]],'as':_0x2b93bd['as'],'attributes':_0x2b93bd[_0xd5ec('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd5ec('0x12')](function(_0x2c3b64){logger[_0xd5ec('0x13')](_0xd5ec('0x27'),_0x13cc66);logger[_0xd5ec('0x22')](_0xd5ec('0x27'),_0x13cc66,JSON[_0xd5ec('0x16')](_0x2c3b64));_0x60da2e(_0x2c3b64);})['catch'](function(_0x186d7e){logger[_0xd5ec('0x17')](_0xd5ec('0x27'),_0x186d7e[_0xd5ec('0x19')],_0x13cc66);_0x4f455f(_0x2c7c82[_0xd5ec('0x17')](0x1f4,_0x186d7e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 95c229e..e075722 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 _0x0cde=['./mailQueue.events','save','remove','update','emit','removeListener','register','length','mailQueue:'];(function(_0x50b2ea,_0x52c92d){var _0x10f77f=function(_0x4d2bdd){while(--_0x4d2bdd){_0x50b2ea['push'](_0x50b2ea['shift']());}};_0x10f77f(++_0x52c92d);}(_0x0cde,0x120));var _0xe0cd=function(_0x459fd8,_0x5493f6){_0x459fd8=_0x459fd8-0x0;var _0x5e7a1c=_0x0cde[_0x459fd8];return _0x5e7a1c;};'use strict';var MailQueueEvents=require(_0xe0cd('0x0'));var events=[_0xe0cd('0x1'),_0xe0cd('0x2'),_0xe0cd('0x3')];function createListener(_0x31ed3d,_0x69bf6e){return function(_0x4ab9d6){_0x69bf6e[_0xe0cd('0x4')](_0x31ed3d,_0x4ab9d6);};}function removeListener(_0x1bda7c,_0x48df36){return function(){MailQueueEvents[_0xe0cd('0x5')](_0x1bda7c,_0x48df36);};}exports[_0xe0cd('0x6')]=function(_0x76ea36){for(var _0x3fcc39=0x0,_0x5303db=events[_0xe0cd('0x7')];_0x3fcc39<_0x5303db;_0x3fcc39++){var _0x26b01c=events[_0x3fcc39];var _0x3d120c=createListener(_0xe0cd('0x8')+_0x26b01c,_0x76ea36);MailQueueEvents['on'](_0x26b01c,_0x3d120c);}}; \ No newline at end of file +var _0x9df4=['mailQueue:','./mailQueue.events','remove','emit','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9df4,0x67));var _0x49df=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0x9df4[_0x277fa3];return _0x2e4520;};'use strict';var MailQueueEvents=require(_0x49df('0x0'));var events=['save',_0x49df('0x1'),'update'];function createListener(_0x4ac541,_0x3c3004){return function(_0x179d91){_0x3c3004[_0x49df('0x2')](_0x4ac541,_0x179d91);};}function removeListener(_0x4efe69,_0x5b9b5a){return function(){MailQueueEvents[_0x49df('0x3')](_0x4efe69,_0x5b9b5a);};}exports['register']=function(_0x32d708){for(var _0x2866=0x0,_0x59539a=events[_0x49df('0x4')];_0x2866<_0x59539a;_0x2866++){var _0x246d02=events[_0x2866];var _0x43c286=createListener(_0x49df('0x5')+_0x246d02,_0x32d708);MailQueueEvents['on'](_0x246d02,_0x43c286);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index be87502..1cb359a 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 _0x3d21=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete'];(function(_0x1302b2,_0x15843d){var _0xfb91c0=function(_0x2a8bac){while(--_0x2a8bac){_0x1302b2['push'](_0x1302b2['shift']());}};_0xfb91c0(++_0x15843d);}(_0x3d21,0x1ef));var _0x13d2=function(_0x334218,_0x3749b1){_0x334218=_0x334218-0x0;var _0x56f83d=_0x3d21[_0x334218];return _0x56f83d;};'use strict';var multer=require(_0x13d2('0x0'));var util=require(_0x13d2('0x1'));var path=require('path');var timeout=require(_0x13d2('0x2'));var express=require(_0x13d2('0x3'));var router=express[_0x13d2('0x4')]();var auth=require(_0x13d2('0x5'));var interaction=require(_0x13d2('0x6'));var config=require('../../config/environment');var controller=require(_0x13d2('0x7'));router[_0x13d2('0x8')]('/',auth[_0x13d2('0x9')](),controller[_0x13d2('0xa')]);router[_0x13d2('0x8')](_0x13d2('0xb'),auth['isAuthenticated'](),controller[_0x13d2('0xc')]);router['get'](_0x13d2('0xd'),auth[_0x13d2('0x9')](),controller[_0x13d2('0xe')]);router[_0x13d2('0xf')]('/',auth[_0x13d2('0x9')](),controller[_0x13d2('0x10')]);router['put'](_0x13d2('0xd'),auth[_0x13d2('0x9')](),controller['update']);router[_0x13d2('0x11')](_0x13d2('0xd'),auth[_0x13d2('0x9')](),controller['destroy']);module[_0x13d2('0x12')]=router; \ No newline at end of file +var _0x994a=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x22229d,_0x514d8f){var _0x1b2f49=function(_0xa0de7d){while(--_0xa0de7d){_0x22229d['push'](_0x22229d['shift']());}};_0x1b2f49(++_0x514d8f);}(_0x994a,0x163));var _0xa994=function(_0x469f6c,_0x1203b2){_0x469f6c=_0x469f6c-0x0;var _0x1e317c=_0x994a[_0x469f6c];return _0x1e317c;};'use strict';var multer=require(_0xa994('0x0'));var util=require(_0xa994('0x1'));var path=require(_0xa994('0x2'));var timeout=require(_0xa994('0x3'));var express=require(_0xa994('0x4'));var router=express[_0xa994('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa994('0x6'));var config=require(_0xa994('0x7'));var controller=require(_0xa994('0x8'));router[_0xa994('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa994('0xa'),auth[_0xa994('0xb')](),controller['describe']);router['get'](_0xa994('0xc'),auth[_0xa994('0xb')](),controller[_0xa994('0xd')]);router[_0xa994('0xe')]('/',auth[_0xa994('0xb')](),controller[_0xa994('0xf')]);router[_0xa994('0x10')](_0xa994('0xc'),auth[_0xa994('0xb')](),controller[_0xa994('0x11')]);router[_0xa994('0x12')](_0xa994('0xc'),auth[_0xa994('0xb')](),controller[_0xa994('0x13')]);module[_0xa994('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 2e00535..52a2e95 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 _0xf234=['exports','STRING','DATE'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xf234,0xd8));var _0x4f23=function(_0x53fa2c,_0x4c28d9){_0x53fa2c=_0x53fa2c-0x0;var _0xd17409=_0xf234[_0x53fa2c];return _0xd17409;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4f23('0x0')]={'uniqueid':{'type':Sequelize[_0x4f23('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4f23('0x1')]},'joinAt':{'type':Sequelize[_0x4f23('0x2')]},'leaveAt':{'type':Sequelize[_0x4f23('0x2')]},'acceptAt':{'type':Sequelize[_0x4f23('0x2')]},'exitAt':{'type':Sequelize[_0x4f23('0x2')]},'reason':{'type':Sequelize[_0x4f23('0x1')]}}; \ No newline at end of file +var _0x1faa=['DATE','moment','exports','STRING'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0x1faa,0x191));var _0xa1fa=function(_0x40c604,_0x123450){_0x40c604=_0x40c604-0x0;var _0x4c5616=_0x1faa[_0x40c604];return _0x4c5616;};'use strict';var moment=require(_0xa1fa('0x0'));var Sequelize=require('sequelize');module[_0xa1fa('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa1fa('0x2')]},'joinAt':{'type':Sequelize[_0xa1fa('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa1fa('0x3')]},'exitAt':{'type':Sequelize[_0xa1fa('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 1f7163d..b228e77 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 _0xaf81=['name','send','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','nolimit','sort','where','pick','add','day','merge','filter','map','options','MailQueueReport','count','includeAll','include','catch','find','create','body','params','describe','html-pdf','eml-format','zip-dir','request-promise','moment','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack'];(function(_0x35269a,_0x293397){var _0x1cb055=function(_0x4e8308){while(--_0x4e8308){_0x35269a['push'](_0x35269a['shift']());}};_0x1cb055(++_0x293397);}(_0xaf81,0x123));var _0x1af8=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xaf81[_0x1ddedd];return _0xa3e1ac;};'use strict';var pdf=require(_0x1af8('0x0'));var emlformat=require(_0x1af8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1af8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1af8('0x3'));var moment=require(_0x1af8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1af8('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1af8('0x6'));var ejs=require(_0x1af8('0x7'));var fs=require('fs');var _=require(_0x1af8('0x8'));var squel=require(_0x1af8('0x9'));var crypto=require('crypto');var jsforce=require(_0x1af8('0xa'));var deskjs=require(_0x1af8('0xb'));var toCsv=require(_0x1af8('0x6'));var querystring=require(_0x1af8('0xc'));var Papa=require('papaparse');var Redis=require(_0x1af8('0xd'));var qs=require(_0x1af8('0xe'));var logger=require(_0x1af8('0xf'))(_0x1af8('0x10'));var utils=require(_0x1af8('0x11'));var config=require(_0x1af8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27d10d,_0x5199b3){_0x5199b3=_0x5199b3||0xcc;return function(_0x5d6966){if(_0x5d6966){return _0x27d10d[_0x1af8('0x13')](_0x5199b3);}return _0x27d10d[_0x1af8('0x14')](_0x5199b3)[_0x1af8('0x15')]();};}function respondWithResult(_0x32cb8d,_0x313a0c){_0x313a0c=_0x313a0c||0xc8;return function(_0x1a685e){if(_0x1a685e){return _0x32cb8d[_0x1af8('0x14')](_0x313a0c)[_0x1af8('0x16')](_0x1a685e);}};}function respondWithFilteredResult(_0x4a12d4,_0x5dfd38){return function(_0x4dd917){if(_0x4dd917){var _0xd0a764=_0x4dd917['count'],_0x11a462=_0x5dfd38[_0x1af8('0x17')],_0x240e41=_0x5dfd38['offset']+_0x5dfd38[_0x1af8('0x18')],_0x36a471;if(_0x240e41>=_0xd0a764){_0x240e41=_0xd0a764;_0x36a471=0xc8;}else{_0x36a471=0xce;}_0x4a12d4[_0x1af8('0x14')](_0x36a471);return _0x4a12d4[_0x1af8('0x19')](_0x1af8('0x1a'),_0x11a462+'-'+_0x240e41+'/'+_0xd0a764)[_0x1af8('0x16')](_0x4dd917);}return null;};}function patchUpdates(_0x4196c8){return function(_0x50c7d7){try{jsonpatch['apply'](_0x50c7d7,_0x4196c8,!![]);}catch(_0x36f285){return BPromise[_0x1af8('0x1b')](_0x36f285);}return _0x50c7d7[_0x1af8('0x1c')]();};}function saveUpdates(_0x2c9ea3,_0x23c8dd){return function(_0x55ae0a){if(_0x55ae0a){return _0x55ae0a[_0x1af8('0x1d')](_0x2c9ea3)[_0x1af8('0x1e')](function(_0x459ac8){return _0x459ac8;});}return null;};}function removeEntity(_0xffd04c,_0x158487){return function(_0x18a5a3){if(_0x18a5a3){return _0x18a5a3[_0x1af8('0x1f')]()[_0x1af8('0x1e')](function(){_0xffd04c[_0x1af8('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x998f8f,_0x2b780d){return function(_0x5f1e5e){if(!_0x5f1e5e){_0x998f8f[_0x1af8('0x13')](0x194);}return _0x5f1e5e;};}function handleError(_0x22d68a,_0x27fd9d){_0x27fd9d=_0x27fd9d||0x1f4;return function(_0x90f0ee){logger[_0x1af8('0x20')](_0x90f0ee[_0x1af8('0x21')]);if(_0x90f0ee[_0x1af8('0x22')]){delete _0x90f0ee[_0x1af8('0x22')];}_0x22d68a[_0x1af8('0x14')](_0x27fd9d)[_0x1af8('0x23')](_0x90f0ee);};}exports['index']=function(_0x5d8992,_0x1e97e6){var _0x308878={},_0x4a3e8b={},_0x5671a1={'count':0x0,'rows':[]};var _0x3ce32a=db['MailQueueReport']['rawAttributes'];_0x4a3e8b[_0x1af8('0x24')]=_[_0x1af8('0x25')](_0x3ce32a);var _0x4a0cc4={'dateStart':_0x5d8992[_0x1af8('0x26')]['dateStart'],'dateEnd':_0x5d8992[_0x1af8('0x26')][_0x1af8('0x27')]};delete _0x5d8992[_0x1af8('0x26')][_0x1af8('0x28')];delete _0x5d8992[_0x1af8('0x26')][_0x1af8('0x27')];_0x4a3e8b[_0x1af8('0x26')]=_[_0x1af8('0x25')](_0x5d8992[_0x1af8('0x26')]);_0x4a3e8b[_0x1af8('0x29')]=_[_0x1af8('0x2a')](_0x4a3e8b[_0x1af8('0x24')],_0x4a3e8b[_0x1af8('0x26')]);_0x308878[_0x1af8('0x2b')]=_[_0x1af8('0x2a')](_0x4a3e8b['model'],qs['fields'](_0x5d8992[_0x1af8('0x26')][_0x1af8('0x2c')]));_0x308878[_0x1af8('0x2b')]=_0x308878['attributes']['length']?_0x308878[_0x1af8('0x2b')]:_0x4a3e8b[_0x1af8('0x24')];if(!_0x5d8992[_0x1af8('0x26')]['hasOwnProperty'](_0x1af8('0x2d'))){_0x308878['limit']=qs[_0x1af8('0x18')](_0x5d8992[_0x1af8('0x26')]['limit']);_0x308878['offset']=qs[_0x1af8('0x17')](_0x5d8992[_0x1af8('0x26')]['offset']);}_0x308878['order']=qs[_0x1af8('0x2e')](_0x5d8992[_0x1af8('0x26')][_0x1af8('0x2e')]);_0x308878[_0x1af8('0x2f')]=qs[_0x1af8('0x29')](_[_0x1af8('0x30')](_0x5d8992[_0x1af8('0x26')],_0x4a3e8b[_0x1af8('0x29')]));if(_0x4a0cc4[_0x1af8('0x28')]){if(_0x4a0cc4[_0x1af8('0x27')]){_0x4a0cc4[_0x1af8('0x27')]=moment(_0x4a0cc4[_0x1af8('0x27')])[_0x1af8('0x31')](0x1,_0x1af8('0x32'));}else{_0x4a0cc4['dateEnd']=moment(_0x4a0cc4['dateStart'])[_0x1af8('0x31')](0x1,_0x1af8('0x32'));}_[_0x1af8('0x33')](_0x308878['where'],{'createdAt':{'$gte':_0x4a0cc4[_0x1af8('0x28')],'$lte':_0x4a0cc4['dateEnd']}});}if(_0x5d8992[_0x1af8('0x26')][_0x1af8('0x34')]){_0x308878[_0x1af8('0x2f')]=_[_0x1af8('0x33')](_0x308878[_0x1af8('0x2f')],{'$or':_[_0x1af8('0x35')](_0x308878[_0x1af8('0x2b')],function(_0x1cb9aa){var _0x32e85e={};_0x32e85e[_0x1cb9aa]={'$like':'%'+_0x5d8992[_0x1af8('0x26')][_0x1af8('0x34')]+'%'};return _0x32e85e;})});}_0x308878=_['merge']({},_0x308878,_0x5d8992[_0x1af8('0x36')]);var _0x3d8fc7={'where':_0x308878['where']};return db[_0x1af8('0x37')][_0x1af8('0x38')](_0x3d8fc7)[_0x1af8('0x1e')](function(_0x558b9c){_0x5671a1['count']=_0x558b9c;if(_0x5d8992['query'][_0x1af8('0x39')]){_0x308878[_0x1af8('0x3a')]=[{'all':!![]}];}return db[_0x1af8('0x37')]['findAll'](_0x308878);})['then'](function(_0x10dfba){_0x5671a1['rows']=_0x10dfba;return _0x5671a1;})[_0x1af8('0x1e')](respondWithFilteredResult(_0x1e97e6,_0x308878))[_0x1af8('0x3b')](handleError(_0x1e97e6,null));};exports['show']=function(_0x13de65,_0x27e5fe){var _0x426c5c={'raw':!![],'where':{'id':_0x13de65['params']['id']}},_0x3ffa52={};_0x3ffa52[_0x1af8('0x24')]=_[_0x1af8('0x25')](db[_0x1af8('0x37')]['rawAttributes']);_0x3ffa52[_0x1af8('0x26')]=_[_0x1af8('0x25')](_0x13de65[_0x1af8('0x26')]);_0x3ffa52[_0x1af8('0x29')]=_[_0x1af8('0x2a')](_0x3ffa52[_0x1af8('0x24')],_0x3ffa52[_0x1af8('0x26')]);_0x426c5c[_0x1af8('0x2b')]=_[_0x1af8('0x2a')](_0x3ffa52['model'],qs[_0x1af8('0x2c')](_0x13de65['query'][_0x1af8('0x2c')]));_0x426c5c['attributes']=_0x426c5c[_0x1af8('0x2b')]['length']?_0x426c5c[_0x1af8('0x2b')]:_0x3ffa52['model'];if(_0x13de65[_0x1af8('0x26')][_0x1af8('0x39')]){_0x426c5c[_0x1af8('0x3a')]=[{'all':!![]}];}_0x426c5c=_[_0x1af8('0x33')]({},_0x426c5c,_0x13de65[_0x1af8('0x36')]);return db[_0x1af8('0x37')][_0x1af8('0x3c')](_0x426c5c)[_0x1af8('0x1e')](handleEntityNotFound(_0x27e5fe,null))[_0x1af8('0x1e')](respondWithResult(_0x27e5fe,null))['catch'](handleError(_0x27e5fe,null));};exports['create']=function(_0x8c1dd1,_0x1e3f38){return db[_0x1af8('0x37')][_0x1af8('0x3d')](_0x8c1dd1[_0x1af8('0x3e')],{})[_0x1af8('0x1e')](respondWithResult(_0x1e3f38,0xc9))[_0x1af8('0x3b')](handleError(_0x1e3f38,null));};exports[_0x1af8('0x1d')]=function(_0x44ff4d,_0x368895){if(_0x44ff4d[_0x1af8('0x3e')]['id']){delete _0x44ff4d[_0x1af8('0x3e')]['id'];}return db['MailQueueReport'][_0x1af8('0x3c')]({'where':{'id':_0x44ff4d[_0x1af8('0x3f')]['id']}})[_0x1af8('0x1e')](handleEntityNotFound(_0x368895,null))[_0x1af8('0x1e')](saveUpdates(_0x44ff4d[_0x1af8('0x3e')],null))['then'](respondWithResult(_0x368895,null))['catch'](handleError(_0x368895,null));};exports['destroy']=function(_0x399459,_0x5c484e){return db[_0x1af8('0x37')]['find']({'where':{'id':_0x399459[_0x1af8('0x3f')]['id']}})[_0x1af8('0x1e')](handleEntityNotFound(_0x5c484e,null))[_0x1af8('0x1e')](removeEntity(_0x5c484e,null))[_0x1af8('0x3b')](handleError(_0x5c484e,null));};exports[_0x1af8('0x40')]=function(_0x1832e3,_0x5df6ed){return db[_0x1af8('0x37')]['describe']()[_0x1af8('0x1e')](respondWithResult(_0x5df6ed,null))[_0x1af8('0x3b')](handleError(_0x5df6ed,null));}; \ No newline at end of file +var _0xa2bd=['rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','where','pick','filters','add','day','merge','filter','includeAll','include','findAll','catch','params','length','options','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','end','status','json','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','MailQueueReport'];(function(_0x5194ab,_0x3e615b){var _0x390479=function(_0x48a8df){while(--_0x48a8df){_0x5194ab['push'](_0x5194ab['shift']());}};_0x390479(++_0x3e615b);}(_0xa2bd,0x1b0));var _0xda2b=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xa2bd[_0xd2d54];return _0x78b113;};'use strict';var pdf=require(_0xda2b('0x0'));var emlformat=require(_0xda2b('0x1'));var rimraf=require(_0xda2b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda2b('0x3'));var rp=require(_0xda2b('0x4'));var moment=require('moment');var BPromise=require(_0xda2b('0x5'));var Mustache=require(_0xda2b('0x6'));var util=require(_0xda2b('0x7'));var path=require('path');var sox=require(_0xda2b('0x8'));var csv=require(_0xda2b('0x9'));var ejs=require(_0xda2b('0xa'));var fs=require('fs');var _=require(_0xda2b('0xb'));var squel=require(_0xda2b('0xc'));var crypto=require(_0xda2b('0xd'));var jsforce=require(_0xda2b('0xe'));var deskjs=require(_0xda2b('0xf'));var toCsv=require(_0xda2b('0x9'));var querystring=require(_0xda2b('0x10'));var Papa=require('papaparse');var Redis=require(_0xda2b('0x11'));var qs=require(_0xda2b('0x12'));var logger=require(_0xda2b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xda2b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3da295,_0x4f7169){_0x4f7169=_0x4f7169||0xcc;return function(_0x4f7d68){if(_0x4f7d68){return _0x3da295[_0xda2b('0x15')](_0x4f7169);}return _0x3da295['status'](_0x4f7169)[_0xda2b('0x16')]();};}function respondWithResult(_0x53465c,_0x2383bc){_0x2383bc=_0x2383bc||0xc8;return function(_0x1915c6){if(_0x1915c6){return _0x53465c[_0xda2b('0x17')](_0x2383bc)[_0xda2b('0x18')](_0x1915c6);}};}function respondWithFilteredResult(_0x8794d7,_0x3f621e){return function(_0x3a076e){if(_0x3a076e){var _0x57c95a=_0x3a076e[_0xda2b('0x19')],_0x3903fa=_0x3f621e[_0xda2b('0x1a')],_0x1a9216=_0x3f621e[_0xda2b('0x1a')]+_0x3f621e['limit'],_0x5cd95f;if(_0x1a9216>=_0x57c95a){_0x1a9216=_0x57c95a;_0x5cd95f=0xc8;}else{_0x5cd95f=0xce;}_0x8794d7[_0xda2b('0x17')](_0x5cd95f);return _0x8794d7['set'](_0xda2b('0x1b'),_0x3903fa+'-'+_0x1a9216+'/'+_0x57c95a)[_0xda2b('0x18')](_0x3a076e);}return null;};}function patchUpdates(_0x3cdad0){return function(_0x15c90c){try{jsonpatch[_0xda2b('0x1c')](_0x15c90c,_0x3cdad0,!![]);}catch(_0x400c6c){return BPromise['reject'](_0x400c6c);}return _0x15c90c[_0xda2b('0x1d')]();};}function saveUpdates(_0x349f29,_0x503c06){return function(_0x24b892){if(_0x24b892){return _0x24b892[_0xda2b('0x1e')](_0x349f29)[_0xda2b('0x1f')](function(_0x3e3e05){return _0x3e3e05;});}return null;};}function removeEntity(_0x214d03,_0x3092cb){return function(_0x678c00){if(_0x678c00){return _0x678c00[_0xda2b('0x20')]()[_0xda2b('0x1f')](function(){_0x214d03['status'](0xcc)[_0xda2b('0x16')]();});}};}function handleEntityNotFound(_0x1e0c36,_0x431da6){return function(_0x256e2c){if(!_0x256e2c){_0x1e0c36[_0xda2b('0x15')](0x194);}return _0x256e2c;};}function handleError(_0x4b6723,_0x11fb5b){_0x11fb5b=_0x11fb5b||0x1f4;return function(_0x23a26f){logger['error'](_0x23a26f[_0xda2b('0x21')]);if(_0x23a26f[_0xda2b('0x22')]){delete _0x23a26f['name'];}_0x4b6723[_0xda2b('0x17')](_0x11fb5b)[_0xda2b('0x23')](_0x23a26f);};}exports['index']=function(_0x33077a,_0x50161b){var _0xc2028a={},_0x2e8081={},_0x33b6ff={'count':0x0,'rows':[]};var _0x43e0b6=db[_0xda2b('0x24')][_0xda2b('0x25')];_0x2e8081[_0xda2b('0x26')]=_['keys'](_0x43e0b6);var _0x40618e={'dateStart':_0x33077a[_0xda2b('0x27')][_0xda2b('0x28')],'dateEnd':_0x33077a[_0xda2b('0x27')][_0xda2b('0x29')]};delete _0x33077a['query'][_0xda2b('0x28')];delete _0x33077a[_0xda2b('0x27')][_0xda2b('0x29')];_0x2e8081[_0xda2b('0x27')]=_[_0xda2b('0x2a')](_0x33077a[_0xda2b('0x27')]);_0x2e8081['filters']=_[_0xda2b('0x2b')](_0x2e8081[_0xda2b('0x26')],_0x2e8081[_0xda2b('0x27')]);_0xc2028a[_0xda2b('0x2c')]=_[_0xda2b('0x2b')](_0x2e8081[_0xda2b('0x26')],qs['fields'](_0x33077a[_0xda2b('0x27')][_0xda2b('0x2d')]));_0xc2028a['attributes']=_0xc2028a['attributes']['length']?_0xc2028a[_0xda2b('0x2c')]:_0x2e8081[_0xda2b('0x26')];if(!_0x33077a[_0xda2b('0x27')][_0xda2b('0x2e')](_0xda2b('0x2f'))){_0xc2028a[_0xda2b('0x30')]=qs['limit'](_0x33077a[_0xda2b('0x27')][_0xda2b('0x30')]);_0xc2028a['offset']=qs[_0xda2b('0x1a')](_0x33077a[_0xda2b('0x27')]['offset']);}_0xc2028a['order']=qs['sort'](_0x33077a['query']['sort']);_0xc2028a[_0xda2b('0x31')]=qs['filters'](_[_0xda2b('0x32')](_0x33077a['query'],_0x2e8081[_0xda2b('0x33')]));if(_0x40618e[_0xda2b('0x28')]){if(_0x40618e[_0xda2b('0x29')]){_0x40618e[_0xda2b('0x29')]=moment(_0x40618e[_0xda2b('0x29')])[_0xda2b('0x34')](0x1,_0xda2b('0x35'));}else{_0x40618e['dateEnd']=moment(_0x40618e[_0xda2b('0x28')])['add'](0x1,'day');}_[_0xda2b('0x36')](_0xc2028a['where'],{'createdAt':{'$gte':_0x40618e['dateStart'],'$lte':_0x40618e['dateEnd']}});}if(_0x33077a[_0xda2b('0x27')][_0xda2b('0x37')]){_0xc2028a['where']=_[_0xda2b('0x36')](_0xc2028a[_0xda2b('0x31')],{'$or':_['map'](_0xc2028a[_0xda2b('0x2c')],function(_0xca59cd){var _0x43d8a0={};_0x43d8a0[_0xca59cd]={'$like':'%'+_0x33077a[_0xda2b('0x27')][_0xda2b('0x37')]+'%'};return _0x43d8a0;})});}_0xc2028a=_['merge']({},_0xc2028a,_0x33077a['options']);var _0x49de9a={'where':_0xc2028a[_0xda2b('0x31')]};return db[_0xda2b('0x24')][_0xda2b('0x19')](_0x49de9a)[_0xda2b('0x1f')](function(_0x24fce3){_0x33b6ff[_0xda2b('0x19')]=_0x24fce3;if(_0x33077a[_0xda2b('0x27')][_0xda2b('0x38')]){_0xc2028a[_0xda2b('0x39')]=[{'all':!![]}];}return db[_0xda2b('0x24')][_0xda2b('0x3a')](_0xc2028a);})['then'](function(_0x1dc6ef){_0x33b6ff['rows']=_0x1dc6ef;return _0x33b6ff;})[_0xda2b('0x1f')](respondWithFilteredResult(_0x50161b,_0xc2028a))[_0xda2b('0x3b')](handleError(_0x50161b,null));};exports['show']=function(_0x114d09,_0x3fa130){var _0x378b37={'raw':!![],'where':{'id':_0x114d09[_0xda2b('0x3c')]['id']}},_0x2479df={};_0x2479df[_0xda2b('0x26')]=_['keys'](db[_0xda2b('0x24')][_0xda2b('0x25')]);_0x2479df['query']=_['keys'](_0x114d09[_0xda2b('0x27')]);_0x2479df[_0xda2b('0x33')]=_[_0xda2b('0x2b')](_0x2479df[_0xda2b('0x26')],_0x2479df['query']);_0x378b37[_0xda2b('0x2c')]=_[_0xda2b('0x2b')](_0x2479df['model'],qs['fields'](_0x114d09[_0xda2b('0x27')]['fields']));_0x378b37[_0xda2b('0x2c')]=_0x378b37[_0xda2b('0x2c')][_0xda2b('0x3d')]?_0x378b37[_0xda2b('0x2c')]:_0x2479df['model'];if(_0x114d09['query'][_0xda2b('0x38')]){_0x378b37[_0xda2b('0x39')]=[{'all':!![]}];}_0x378b37=_[_0xda2b('0x36')]({},_0x378b37,_0x114d09[_0xda2b('0x3e')]);return db['MailQueueReport'][_0xda2b('0x3f')](_0x378b37)['then'](handleEntityNotFound(_0x3fa130,null))[_0xda2b('0x1f')](respondWithResult(_0x3fa130,null))[_0xda2b('0x3b')](handleError(_0x3fa130,null));};exports[_0xda2b('0x40')]=function(_0x556c21,_0x5a9bfe){return db[_0xda2b('0x24')][_0xda2b('0x40')](_0x556c21[_0xda2b('0x41')],{})[_0xda2b('0x1f')](respondWithResult(_0x5a9bfe,0xc9))['catch'](handleError(_0x5a9bfe,null));};exports[_0xda2b('0x1e')]=function(_0x28d7ee,_0x20f86b){if(_0x28d7ee[_0xda2b('0x41')]['id']){delete _0x28d7ee[_0xda2b('0x41')]['id'];}return db['MailQueueReport'][_0xda2b('0x3f')]({'where':{'id':_0x28d7ee[_0xda2b('0x3c')]['id']}})[_0xda2b('0x1f')](handleEntityNotFound(_0x20f86b,null))[_0xda2b('0x1f')](saveUpdates(_0x28d7ee[_0xda2b('0x41')],null))['then'](respondWithResult(_0x20f86b,null))['catch'](handleError(_0x20f86b,null));};exports['destroy']=function(_0x490082,_0x21aa09){return db[_0xda2b('0x24')]['find']({'where':{'id':_0x490082['params']['id']}})[_0xda2b('0x1f')](handleEntityNotFound(_0x21aa09,null))[_0xda2b('0x1f')](removeEntity(_0x21aa09,null))[_0xda2b('0x3b')](handleError(_0x21aa09,null));};exports['describe']=function(_0xd44bbe,_0x35548f){return db[_0xda2b('0x24')][_0xda2b('0x42')]()[_0xda2b('0x1f')](respondWithResult(_0x35548f,null))[_0xda2b('0x3b')](handleError(_0x35548f,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0242ed2..532b70c 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 _0xea68=['./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x284752,_0x43c618){var _0x553ce9=function(_0x36202e){while(--_0x36202e){_0x284752['push'](_0x284752['shift']());}};_0x553ce9(++_0x43c618);}(_0xea68,0x7e));var _0x8ea6=function(_0x5b456d,_0x1537a9){_0x5b456d=_0x5b456d-0x0;var _0x12f5ec=_0xea68[_0x5b456d];return _0x12f5ec;};'use strict';var _=require(_0x8ea6('0x0'));var util=require(_0x8ea6('0x1'));var logger=require(_0x8ea6('0x2'))('api');var moment=require(_0x8ea6('0x3'));var BPromise=require(_0x8ea6('0x4'));var rp=require(_0x8ea6('0x5'));var attributes=require(_0x8ea6('0x6'));module['exports']=function(_0x1b1a26,_0x5fbdc3){return _0x1b1a26[_0x8ea6('0x7')](_0x8ea6('0x8'),attributes,{'tableName':_0x8ea6('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8ea6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x232f=['uniqueid','lodash','util','api','bluebird','request-promise','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x528d91,_0x36364e){var _0x26bd5a=function(_0x34e4a4){while(--_0x34e4a4){_0x528d91['push'](_0x528d91['shift']());}};_0x26bd5a(++_0x36364e);}(_0x232f,0x177));var _0xf232=function(_0x215ea3,_0x24d78){_0x215ea3=_0x215ea3-0x0;var _0x542d1d=_0x232f[_0x215ea3];return _0x542d1d;};'use strict';var _=require(_0xf232('0x0'));var util=require(_0xf232('0x1'));var logger=require('../../config/logger')(_0xf232('0x2'));var moment=require('moment');var BPromise=require(_0xf232('0x3'));var rp=require(_0xf232('0x4'));var attributes=require(_0xf232('0x5'));module[_0xf232('0x6')]=function(_0x4b56ad,_0x2d4a3d){return _0x4b56ad[_0xf232('0x7')](_0xf232('0x8'),attributes,{'tableName':_0xf232('0x9'),'paranoid':![],'indexes':[{'name':_0xf232('0xa'),'fields':[_0xf232('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 74ec668..4b76ab9 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 _0x6c13=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','MailQueueReport,\x20%s,\x20%s','message','result','catch','create','options','raw','CreateMailQueueReport','debug','UpdateMailQueueReport','MailQueueReport','body','limit','util','moment','bluebird'];(function(_0x7634c1,_0x520e9e){var _0x228414=function(_0x40bf20){while(--_0x40bf20){_0x7634c1['push'](_0x7634c1['shift']());}};_0x228414(++_0x520e9e);}(_0x6c13,0x10b));var _0x36c1=function(_0x522c6d,_0x4d250d){_0x522c6d=_0x522c6d-0x0;var _0x26300d=_0x6c13[_0x522c6d];return _0x26300d;};'use strict';var _=require('lodash');var util=require(_0x36c1('0x0'));var moment=require(_0x36c1('0x1'));var BPromise=require(_0x36c1('0x2'));var rs=require(_0x36c1('0x3'));var fs=require('fs');var Redis=require(_0x36c1('0x4'));var db=require(_0x36c1('0x5'))['db'];var utils=require(_0x36c1('0x6'));var logger=require('../../config/logger')(_0x36c1('0x7'));var config=require(_0x36c1('0x8'));var jayson=require(_0x36c1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeb4ab8,_0x132645,_0x1da6c5){return new BPromise(function(_0x542d0b,_0x147b8e){return client[_0x36c1('0xa')](_0xeb4ab8,_0x1da6c5)[_0x36c1('0xb')](function(_0x7375a3){logger[_0x36c1('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x132645,_0x36c1('0xd'));logger['debug'](_0x36c1('0xe'),_0x132645,_0x36c1('0xd'),JSON[_0x36c1('0xf')](_0x7375a3));if(_0x7375a3[_0x36c1('0x10')]){if(_0x7375a3['error']['code']===0x1f4){logger[_0x36c1('0x10')](_0x36c1('0x11'),_0x132645,_0x7375a3['error']['message']);return _0x147b8e(_0x7375a3['error'][_0x36c1('0x12')]);}logger[_0x36c1('0x10')](_0x36c1('0x11'),_0x132645,_0x7375a3['error']['message']);return _0x542d0b(_0x7375a3['error'][_0x36c1('0x12')]);}else{logger[_0x36c1('0xc')](_0x36c1('0x11'),_0x132645,_0x36c1('0xd'));_0x542d0b(_0x7375a3[_0x36c1('0x13')][_0x36c1('0x12')]);}})[_0x36c1('0x14')](function(_0x5e57e7){logger[_0x36c1('0x10')](_0x36c1('0x11'),_0x132645,_0x5e57e7);_0x147b8e(_0x5e57e7);});});}exports['CreateMailQueueReport']=function(_0x51a5f8){var _0x28177b=this;return new Promise(function(_0xea4579,_0x311f1f){return db['MailQueueReport'][_0x36c1('0x15')](_0x51a5f8['body'],{'raw':_0x51a5f8[_0x36c1('0x16')]?_0x51a5f8[_0x36c1('0x16')][_0x36c1('0x17')]===undefined?!![]:![]:!![]})[_0x36c1('0xb')](function(_0xe0b257){logger[_0x36c1('0xc')](_0x36c1('0x18'),_0x51a5f8);logger[_0x36c1('0x19')]('CreateMailQueueReport',_0x51a5f8,JSON[_0x36c1('0xf')](_0xe0b257));_0xea4579(_0xe0b257);})[_0x36c1('0x14')](function(_0x4de689){logger['error'](_0x36c1('0x18'),_0x4de689[_0x36c1('0x12')],_0x51a5f8);_0x311f1f(_0x28177b[_0x36c1('0x10')](0x1f4,_0x4de689[_0x36c1('0x12')]));});});};exports[_0x36c1('0x1a')]=function(_0x2df2d6){var _0x268dd1=this;return new Promise(function(_0x23642b,_0xd19dd1){return db[_0x36c1('0x1b')]['update'](_0x2df2d6[_0x36c1('0x1c')],{'raw':_0x2df2d6[_0x36c1('0x16')]?_0x2df2d6[_0x36c1('0x16')][_0x36c1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2df2d6[_0x36c1('0x16')]?_0x2df2d6[_0x36c1('0x16')]['where']||null:null,'attributes':_0x2df2d6['options']?_0x2df2d6[_0x36c1('0x16')]['attributes']||null:null,'limit':_0x2df2d6[_0x36c1('0x16')]?_0x2df2d6[_0x36c1('0x16')][_0x36c1('0x1d')]||null:null})[_0x36c1('0xb')](function(_0x9c7f20){logger[_0x36c1('0xc')](_0x36c1('0x1a'),_0x2df2d6);logger[_0x36c1('0x19')](_0x36c1('0x1a'),_0x2df2d6,JSON[_0x36c1('0xf')](_0x9c7f20));_0x23642b(_0x9c7f20);})[_0x36c1('0x14')](function(_0x1b1ddc){logger[_0x36c1('0x10')]('UpdateMailQueueReport',_0x1b1ddc[_0x36c1('0x12')],_0x2df2d6);_0xd19dd1(_0x268dd1['error'](0x1f4,_0x1b1ddc[_0x36c1('0x12')]));});});}; \ No newline at end of file +var _0x6731=['../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','create','options','CreateMailQueueReport','UpdateMailQueueReport','MailQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x573994,_0x2f5d36){var _0x30b464=function(_0x449e0a){while(--_0x449e0a){_0x573994['push'](_0x573994['shift']());}};_0x30b464(++_0x2f5d36);}(_0x6731,0x199));var _0x1673=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0x6731[_0x3b7b8a];return _0x441206;};'use strict';var _=require(_0x1673('0x0'));var util=require(_0x1673('0x1'));var moment=require(_0x1673('0x2'));var BPromise=require(_0x1673('0x3'));var rs=require(_0x1673('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1673('0x5'));var logger=require(_0x1673('0x6'))('rpc');var config=require(_0x1673('0x7'));var jayson=require(_0x1673('0x8'));var client=jayson[_0x1673('0x9')][_0x1673('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46aaee,_0x11952b,_0x32c3c6){return new BPromise(function(_0x4c3b9e,_0x19ff36){return client[_0x1673('0xb')](_0x46aaee,_0x32c3c6)[_0x1673('0xc')](function(_0x421f0f){logger['info'](_0x1673('0xd'),_0x11952b,'request\x20sent');logger[_0x1673('0xe')](_0x1673('0xf'),_0x11952b,_0x1673('0x10'),JSON[_0x1673('0x11')](_0x421f0f));if(_0x421f0f[_0x1673('0x12')]){if(_0x421f0f[_0x1673('0x12')]['code']===0x1f4){logger[_0x1673('0x12')](_0x1673('0xd'),_0x11952b,_0x421f0f[_0x1673('0x12')][_0x1673('0x13')]);return _0x19ff36(_0x421f0f[_0x1673('0x12')]['message']);}logger[_0x1673('0x12')](_0x1673('0xd'),_0x11952b,_0x421f0f['error']['message']);return _0x4c3b9e(_0x421f0f[_0x1673('0x12')][_0x1673('0x13')]);}else{logger[_0x1673('0x14')](_0x1673('0xd'),_0x11952b,_0x1673('0x10'));_0x4c3b9e(_0x421f0f['result'][_0x1673('0x13')]);}})[_0x1673('0x15')](function(_0x24f612){logger[_0x1673('0x12')](_0x1673('0xd'),_0x11952b,_0x24f612);_0x19ff36(_0x24f612);});});}exports['CreateMailQueueReport']=function(_0x45d41e){var _0x4b2232=this;return new Promise(function(_0x10eb11,_0x3b1b35){return db['MailQueueReport'][_0x1673('0x16')](_0x45d41e['body'],{'raw':_0x45d41e[_0x1673('0x17')]?_0x45d41e['options']['raw']===undefined?!![]:![]:!![]})[_0x1673('0xc')](function(_0x5cc40b){logger[_0x1673('0x14')]('CreateMailQueueReport',_0x45d41e);logger[_0x1673('0xe')](_0x1673('0x18'),_0x45d41e,JSON['stringify'](_0x5cc40b));_0x10eb11(_0x5cc40b);})[_0x1673('0x15')](function(_0x13180a){logger[_0x1673('0x12')](_0x1673('0x18'),_0x13180a[_0x1673('0x13')],_0x45d41e);_0x3b1b35(_0x4b2232[_0x1673('0x12')](0x1f4,_0x13180a[_0x1673('0x13')]));});});};exports[_0x1673('0x19')]=function(_0x1794e5){var _0x26c6e9=this;return new Promise(function(_0x55a495,_0x417b6a){return db[_0x1673('0x1a')][_0x1673('0x1b')](_0x1794e5['body'],{'raw':_0x1794e5[_0x1673('0x17')]?_0x1794e5[_0x1673('0x17')][_0x1673('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1794e5['options']?_0x1794e5[_0x1673('0x17')][_0x1673('0x1d')]||null:null,'attributes':_0x1794e5['options']?_0x1794e5[_0x1673('0x17')][_0x1673('0x1e')]||null:null,'limit':_0x1794e5[_0x1673('0x17')]?_0x1794e5[_0x1673('0x17')][_0x1673('0x1f')]||null:null})[_0x1673('0xc')](function(_0x4d7334){logger['info'](_0x1673('0x19'),_0x1794e5);logger[_0x1673('0xe')](_0x1673('0x19'),_0x1794e5,JSON[_0x1673('0x11')](_0x4d7334));_0x55a495(_0x4d7334);})[_0x1673('0x15')](function(_0x50b15f){logger[_0x1673('0x12')](_0x1673('0x19'),_0x50b15f['message'],_0x1794e5);_0x417b6a(_0x26c6e9[_0x1673('0x12')](0x1f4,_0x50b15f[_0x1673('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index cfbc2d0..76e8f4e 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 _0x8579=['connect-timeout','express','Router','../../components/auth/service','multer','util'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x8579,0x16c));var _0x9857=function(_0x18957c,_0x28e05b){_0x18957c=_0x18957c-0x0;var _0x568fb1=_0x8579[_0x18957c];return _0x568fb1;};'use strict';var multer=require(_0x9857('0x0'));var util=require(_0x9857('0x1'));var path=require('path');var timeout=require(_0x9857('0x2'));var express=require(_0x9857('0x3'));var router=express[_0x9857('0x4')]();var auth=require(_0x9857('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xd991=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x164424,_0x159ae3){var _0x25af19=function(_0x431ff9){while(--_0x431ff9){_0x164424['push'](_0x164424['shift']());}};_0x25af19(++_0x159ae3);}(_0xd991,0x115));var _0x1d99=function(_0x107f6b,_0x4b2d87){_0x107f6b=_0x107f6b-0x0;var _0x5e0763=_0xd991[_0x107f6b];return _0x5e0763;};'use strict';var multer=require(_0x1d99('0x0'));var util=require(_0x1d99('0x1'));var path=require(_0x1d99('0x2'));var timeout=require(_0x1d99('0x3'));var express=require(_0x1d99('0x4'));var router=express['Router']();var auth=require(_0x1d99('0x5'));var interaction=require(_0x1d99('0x6'));var config=require(_0x1d99('0x7'));module[_0x1d99('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index ccd3f71..e103294 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 _0x85b5=['INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x85b5,0x7f));var _0x585b=function(_0x6edf87,_0x1fd722){_0x6edf87=_0x6edf87-0x0;var _0x1618bd=_0x85b5[_0x6edf87];return _0x1618bd;};'use strict';var Sequelize=require(_0x585b('0x0'));module[_0x585b('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x585b('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x585b('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x585b('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x585b('0x2')],'defaultValue':_0x585b('0x4')},'connTimeout':{'type':Sequelize[_0x585b('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x585b('0x2')]}}; \ No newline at end of file +var _0xd547=['BOOLEAN','INTEGER','STRING'];(function(_0x36f93c,_0x694332){var _0x1efbe3=function(_0x547a7f){while(--_0x547a7f){_0x36f93c['push'](_0x36f93c['shift']());}};_0x1efbe3(++_0x694332);}(_0xd547,0x1c1));var _0x7d54=function(_0x1c05c0,_0x38e872){_0x1c05c0=_0x1c05c0-0x0;var _0x4b8d87=_0xd547[_0x1c05c0];return _0x4b8d87;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x7d54('0x0')]},'host':{'type':Sequelize[_0x7d54('0x0')]},'authentication':{'type':Sequelize[_0x7d54('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x7d54('0x0')],'unique':'username'},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x7d54('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7d54('0x0')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x7d54('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7d54('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x7d54('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 11eeb01..1607396 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 _0xaa88=['bluebird','request-promise','./mailServerIn.attributes','exports','mail_servers_in','lodash','util','../../config/logger','api'];(function(_0x3b84a8,_0xd456ed){var _0x2c020d=function(_0x46b9e3){while(--_0x46b9e3){_0x3b84a8['push'](_0x3b84a8['shift']());}};_0x2c020d(++_0xd456ed);}(_0xaa88,0x137));var _0x8aa8=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xaa88[_0x2a56ad];return _0x425175;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var attributes=require(_0x8aa8('0x6'));module[_0x8aa8('0x7')]=function(_0x3e3b70,_0x350e8b){return _0x3e3b70['define']('MailServerIn',attributes,{'tableName':_0x8aa8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58d6=['../../config/logger','moment','./mailServerIn.attributes','exports','MailServerIn','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x58d6,0x1d3));var _0x658d=function(_0x5466e0,_0x586206){_0x5466e0=_0x5466e0-0x0;var _0xf32c89=_0x58d6[_0x5466e0];return _0xf32c89;};'use strict';var _=require('lodash');var util=require(_0x658d('0x0'));var logger=require(_0x658d('0x1'))('api');var moment=require(_0x658d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x658d('0x3'));module[_0x658d('0x4')]=function(_0x226af6,_0x1f851f){return _0x226af6['define'](_0x658d('0x5'),attributes,{'tableName':'mail_servers_in','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 7c02034..95be45d 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 _0x027a=['raw','options','attributes','limit','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailServerIn,\x20%s,\x20%s','message','info','result','catch','GetMailServerIn','findAll'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x027a,0x1d6));var _0xa027=function(_0x511272,_0xdb5ec3){_0x511272=_0x511272-0x0;var _0x34def7=_0x027a[_0x511272];return _0x34def7;};'use strict';var _=require(_0xa027('0x0'));var util=require(_0xa027('0x1'));var moment=require(_0xa027('0x2'));var BPromise=require(_0xa027('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa027('0x4'));var db=require(_0xa027('0x5'))['db'];var utils=require(_0xa027('0x6'));var logger=require(_0xa027('0x7'))(_0xa027('0x8'));var config=require('../../config/environment');var jayson=require(_0xa027('0x9'));var client=jayson[_0xa027('0xa')][_0xa027('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57e365,_0x45d117,_0x3f33e3){return new BPromise(function(_0x465798,_0x2ba25e){return client[_0xa027('0xc')](_0x57e365,_0x3f33e3)['then'](function(_0xd91794){logger['info']('MailServerIn,\x20%s,\x20%s',_0x45d117,'request\x20sent');logger[_0xa027('0xd')](_0xa027('0xe'),_0x45d117,_0xa027('0xf'),JSON[_0xa027('0x10')](_0xd91794));if(_0xd91794['error']){if(_0xd91794['error']['code']===0x1f4){logger[_0xa027('0x11')](_0xa027('0x12'),_0x45d117,_0xd91794[_0xa027('0x11')][_0xa027('0x13')]);return _0x2ba25e(_0xd91794['error']['message']);}logger['error'](_0xa027('0x12'),_0x45d117,_0xd91794['error']['message']);return _0x465798(_0xd91794['error'][_0xa027('0x13')]);}else{logger[_0xa027('0x14')]('MailServerIn,\x20%s,\x20%s',_0x45d117,'request\x20sent');_0x465798(_0xd91794[_0xa027('0x15')][_0xa027('0x13')]);}})[_0xa027('0x16')](function(_0x3cabdc){logger[_0xa027('0x11')]('MailServerIn,\x20%s,\x20%s',_0x45d117,_0x3cabdc);_0x2ba25e(_0x3cabdc);});});}exports[_0xa027('0x17')]=function(_0x15d3a1){var _0x4be1a4=this;return new Promise(function(_0x30bead,_0x52c703){return db['MailServerIn'][_0xa027('0x18')]({'raw':_0x15d3a1['options']?_0x15d3a1['options'][_0xa027('0x19')]===undefined?!![]:![]:!![],'where':_0x15d3a1[_0xa027('0x1a')]?_0x15d3a1['options']['where']||null:null,'attributes':_0x15d3a1['options']?_0x15d3a1['options'][_0xa027('0x1b')]||null:null,'limit':_0x15d3a1[_0xa027('0x1a')]?_0x15d3a1[_0xa027('0x1a')][_0xa027('0x1c')]||null:null,'include':_0x15d3a1[_0xa027('0x1a')]?_0x15d3a1[_0xa027('0x1a')][_0xa027('0x1d')]?_[_0xa027('0x1e')](_0x15d3a1[_0xa027('0x1a')][_0xa027('0x1d')],function(_0x2c09d7){return{'model':db[_0x2c09d7[_0xa027('0x1f')]],'as':_0x2c09d7['as'],'attributes':_0x2c09d7['attributes'],'include':_0x2c09d7[_0xa027('0x1d')]?_['map'](_0x2c09d7[_0xa027('0x1d')],function(_0x1a6343){return{'model':db[_0x1a6343[_0xa027('0x1f')]],'as':_0x1a6343['as'],'attributes':_0x1a6343['attributes'],'include':_0x1a6343[_0xa027('0x1d')]?_[_0xa027('0x1e')](_0x1a6343[_0xa027('0x1d')],function(_0x11c22e){return{'model':db[_0x11c22e['model']],'as':_0x11c22e['as'],'attributes':_0x11c22e[_0xa027('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa027('0x20')](function(_0x247fce){logger[_0xa027('0x14')](_0xa027('0x17'),_0x15d3a1);logger[_0xa027('0xd')](_0xa027('0x17'),_0x15d3a1,JSON[_0xa027('0x10')](_0x247fce));_0x30bead(_0x247fce);})[_0xa027('0x16')](function(_0x3771a5){logger[_0xa027('0x11')](_0xa027('0x17'),_0x3771a5['message'],_0x15d3a1);_0x52c703(_0x4be1a4[_0xa027('0x11')](0x1f4,_0x3771a5[_0xa027('0x13')]));});});}; \ No newline at end of file +var _0xd1d8=['info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailServerIn','MailServerIn','options','raw','attributes','limit','include','model','map','then','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd1d8,0x1e3));var _0x8d1d=function(_0x175866,_0x1e48a6){_0x175866=_0x175866-0x0;var _0x4a561b=_0xd1d8[_0x175866];return _0x4a561b;};'use strict';var _=require(_0x8d1d('0x0'));var util=require(_0x8d1d('0x1'));var moment=require(_0x8d1d('0x2'));var BPromise=require(_0x8d1d('0x3'));var rs=require(_0x8d1d('0x4'));var fs=require('fs');var Redis=require(_0x8d1d('0x5'));var db=require(_0x8d1d('0x6'))['db'];var utils=require(_0x8d1d('0x7'));var logger=require(_0x8d1d('0x8'))('rpc');var config=require(_0x8d1d('0x9'));var jayson=require(_0x8d1d('0xa'));var client=jayson[_0x8d1d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f697b,_0x33287e,_0xaf23bd){return new BPromise(function(_0x1bfbf0,_0x2f3a32){return client['request'](_0x1f697b,_0xaf23bd)['then'](function(_0x1294c6){logger[_0x8d1d('0xc')](_0x8d1d('0xd'),_0x33287e,_0x8d1d('0xe'));logger[_0x8d1d('0xf')](_0x8d1d('0x10'),_0x33287e,_0x8d1d('0xe'),JSON['stringify'](_0x1294c6));if(_0x1294c6[_0x8d1d('0x11')]){if(_0x1294c6[_0x8d1d('0x11')][_0x8d1d('0x12')]===0x1f4){logger[_0x8d1d('0x11')](_0x8d1d('0xd'),_0x33287e,_0x1294c6[_0x8d1d('0x11')]['message']);return _0x2f3a32(_0x1294c6['error']['message']);}logger[_0x8d1d('0x11')]('MailServerIn,\x20%s,\x20%s',_0x33287e,_0x1294c6['error'][_0x8d1d('0x13')]);return _0x1bfbf0(_0x1294c6['error'][_0x8d1d('0x13')]);}else{logger[_0x8d1d('0xc')](_0x8d1d('0xd'),_0x33287e,_0x8d1d('0xe'));_0x1bfbf0(_0x1294c6[_0x8d1d('0x14')][_0x8d1d('0x13')]);}})['catch'](function(_0x28d7a0){logger['error'](_0x8d1d('0xd'),_0x33287e,_0x28d7a0);_0x2f3a32(_0x28d7a0);});});}exports[_0x8d1d('0x15')]=function(_0x3c1bc6){var _0x23dffe=this;return new Promise(function(_0x478451,_0x4df4e2){return db[_0x8d1d('0x16')]['findAll']({'raw':_0x3c1bc6[_0x8d1d('0x17')]?_0x3c1bc6[_0x8d1d('0x17')][_0x8d1d('0x18')]===undefined?!![]:![]:!![],'where':_0x3c1bc6[_0x8d1d('0x17')]?_0x3c1bc6['options']['where']||null:null,'attributes':_0x3c1bc6['options']?_0x3c1bc6[_0x8d1d('0x17')][_0x8d1d('0x19')]||null:null,'limit':_0x3c1bc6['options']?_0x3c1bc6[_0x8d1d('0x17')][_0x8d1d('0x1a')]||null:null,'include':_0x3c1bc6[_0x8d1d('0x17')]?_0x3c1bc6[_0x8d1d('0x17')][_0x8d1d('0x1b')]?_['map'](_0x3c1bc6[_0x8d1d('0x17')][_0x8d1d('0x1b')],function(_0x362fff){return{'model':db[_0x362fff[_0x8d1d('0x1c')]],'as':_0x362fff['as'],'attributes':_0x362fff[_0x8d1d('0x19')],'include':_0x362fff[_0x8d1d('0x1b')]?_[_0x8d1d('0x1d')](_0x362fff['include'],function(_0x29cbe7){return{'model':db[_0x29cbe7[_0x8d1d('0x1c')]],'as':_0x29cbe7['as'],'attributes':_0x29cbe7[_0x8d1d('0x19')],'include':_0x29cbe7[_0x8d1d('0x1b')]?_[_0x8d1d('0x1d')](_0x29cbe7['include'],function(_0xbb9479){return{'model':db[_0xbb9479[_0x8d1d('0x1c')]],'as':_0xbb9479['as'],'attributes':_0xbb9479[_0x8d1d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8d1d('0x1e')](function(_0x47ceb0){logger[_0x8d1d('0xc')]('GetMailServerIn',_0x3c1bc6);logger[_0x8d1d('0xf')]('GetMailServerIn',_0x3c1bc6,JSON[_0x8d1d('0x1f')](_0x47ceb0));_0x478451(_0x47ceb0);})[_0x8d1d('0x20')](function(_0x463a1e){logger[_0x8d1d('0x11')](_0x8d1d('0x15'),_0x463a1e[_0x8d1d('0x13')],_0x3c1bc6);_0x4df4e2(_0x23dffe[_0x8d1d('0x11')](0x1f4,_0x463a1e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 8444273..92cf4ea 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 _0xf5a6=['Router','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0xf5a6,0xeb));var _0x6f5a=function(_0x373262,_0x1fc95d){_0x373262=_0x373262-0x0;var _0xa0ed94=_0xf5a6[_0x373262];return _0xa0ed94;};'use strict';var multer=require(_0x6f5a('0x0'));var util=require(_0x6f5a('0x1'));var path=require(_0x6f5a('0x2'));var timeout=require(_0x6f5a('0x3'));var express=require(_0x6f5a('0x4'));var router=express[_0x6f5a('0x5')]();var auth=require(_0x6f5a('0x6'));var interaction=require(_0x6f5a('0x7'));var config=require('../../config/environment');var controller=require(_0x6f5a('0x8'));router[_0x6f5a('0x9')]('/',auth[_0x6f5a('0xa')](),controller[_0x6f5a('0xb')]);router[_0x6f5a('0x9')](_0x6f5a('0xc'),auth[_0x6f5a('0xa')](),controller['show']);router[_0x6f5a('0xd')]('/',auth[_0x6f5a('0xa')](),controller[_0x6f5a('0xe')]);router[_0x6f5a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6f5a('0x10')]);router[_0x6f5a('0x11')](_0x6f5a('0xc'),auth['isAuthenticated'](),controller[_0x6f5a('0x12')]);module[_0x6f5a('0x13')]=router; \ No newline at end of file +var _0x5c54=['index','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailServerOut.controller','isAuthenticated'];(function(_0x286849,_0x293753){var _0x4f7d7b=function(_0x28ae84){while(--_0x28ae84){_0x286849['push'](_0x286849['shift']());}};_0x4f7d7b(++_0x293753);}(_0x5c54,0x1cb));var _0x45c5=function(_0x1f94b9,_0x114b7f){_0x1f94b9=_0x1f94b9-0x0;var _0x51f36b=_0x5c54[_0x1f94b9];return _0x51f36b;};'use strict';var multer=require(_0x45c5('0x0'));var util=require(_0x45c5('0x1'));var path=require(_0x45c5('0x2'));var timeout=require(_0x45c5('0x3'));var express=require(_0x45c5('0x4'));var router=express['Router']();var auth=require(_0x45c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x45c5('0x6'));var controller=require(_0x45c5('0x7'));router['get']('/',auth[_0x45c5('0x8')](),controller[_0x45c5('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x45c5('0xa')]);router[_0x45c5('0xb')]('/',auth['isAuthenticated'](),controller[_0x45c5('0xc')]);router[_0x45c5('0xd')](_0x45c5('0xe'),auth[_0x45c5('0x8')](),controller[_0x45c5('0xf')]);router['delete'](_0x45c5('0xe'),auth[_0x45c5('0x8')](),controller[_0x45c5('0x10')]);module[_0x45c5('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 05fdb7e..cc04b22 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 _0x9138=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x372a4c,_0x347429){var _0x1242a1=function(_0x5009cb){while(--_0x5009cb){_0x372a4c['push'](_0x372a4c['shift']());}};_0x1242a1(++_0x347429);}(_0x9138,0x91));var _0x8913=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x9138[_0x234ae1];return _0x227ba0;};'use strict';var Sequelize=require(_0x8913('0x0'));module[_0x8913('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x8913('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x8913('0x2')]},'port':{'type':Sequelize[_0x8913('0x3')]},'secure':{'type':Sequelize[_0x8913('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x8913('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9495=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x9495,0x190));var _0x5949=function(_0x3bc3b4,_0x5acff4){_0x3bc3b4=_0x3bc3b4-0x0;var _0x4c546b=_0x9495[_0x3bc3b4];return _0x4c546b;};'use strict';var Sequelize=require(_0x5949('0x0'));module[_0x5949('0x1')]={'description':{'type':Sequelize[_0x5949('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x5949('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5949('0x3')]},'secure':{'type':Sequelize[_0x5949('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x5949('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 be6b313..b57eaab 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 _0x6adc=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','add','day','where','filter','merge','map','options','includeAll','include','rows','show','params','find','catch','create','body','update','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','reject','save','then','destroy','stack','name','send','MailServerOut','rawAttributes','model','keys','dateStart','query','dateEnd','filters'];(function(_0x120761,_0x1838dc){var _0x17a331=function(_0x353050){while(--_0x353050){_0x120761['push'](_0x120761['shift']());}};_0x17a331(++_0x1838dc);}(_0x6adc,0x1f4));var _0xc6ad=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0x6adc[_0x5311a1];return _0x2acb9f;};'use strict';var pdf=require(_0xc6ad('0x0'));var emlformat=require(_0xc6ad('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc6ad('0x2'));var rp=require(_0xc6ad('0x3'));var moment=require(_0xc6ad('0x4'));var BPromise=require(_0xc6ad('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc6ad('0x6'));var sox=require(_0xc6ad('0x7'));var csv=require(_0xc6ad('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc6ad('0x9'));var squel=require(_0xc6ad('0xa'));var crypto=require('crypto');var jsforce=require(_0xc6ad('0xb'));var deskjs=require(_0xc6ad('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc6ad('0xd'));var Papa=require(_0xc6ad('0xe'));var Redis=require('ioredis');var qs=require(_0xc6ad('0xf'));var logger=require(_0xc6ad('0x10'))(_0xc6ad('0x11'));var utils=require(_0xc6ad('0x12'));var config=require(_0xc6ad('0x13'));var db=require(_0xc6ad('0x14'))['db'];function respondWithStatusCode(_0x3f4d0c,_0x113cc4){_0x113cc4=_0x113cc4||0xcc;return function(_0x481df0){if(_0x481df0){return _0x3f4d0c[_0xc6ad('0x15')](_0x113cc4);}return _0x3f4d0c['status'](_0x113cc4)[_0xc6ad('0x16')]();};}function respondWithResult(_0x461b4e,_0x48c0f6){_0x48c0f6=_0x48c0f6||0xc8;return function(_0x1f2e54){if(_0x1f2e54){return _0x461b4e[_0xc6ad('0x17')](_0x48c0f6)[_0xc6ad('0x18')](_0x1f2e54);}};}function respondWithFilteredResult(_0x37fe9d,_0x1ce84a){return function(_0x3dc6d3){if(_0x3dc6d3){var _0x4caeca=_0x3dc6d3[_0xc6ad('0x19')],_0x502c37=_0x1ce84a['offset'],_0x5ac226=_0x1ce84a[_0xc6ad('0x1a')]+_0x1ce84a[_0xc6ad('0x1b')],_0x1be00a;if(_0x5ac226>=_0x4caeca){_0x5ac226=_0x4caeca;_0x1be00a=0xc8;}else{_0x1be00a=0xce;}_0x37fe9d[_0xc6ad('0x17')](_0x1be00a);return _0x37fe9d[_0xc6ad('0x1c')]('Content-Range',_0x502c37+'-'+_0x5ac226+'/'+_0x4caeca)[_0xc6ad('0x18')](_0x3dc6d3);}return null;};}function patchUpdates(_0x5968b6){return function(_0x50f212){try{jsonpatch['apply'](_0x50f212,_0x5968b6,!![]);}catch(_0x2171c3){return BPromise[_0xc6ad('0x1d')](_0x2171c3);}return _0x50f212[_0xc6ad('0x1e')]();};}function saveUpdates(_0x4cba9c,_0x2e5476){return function(_0x2ab451){if(_0x2ab451){return _0x2ab451['update'](_0x4cba9c)[_0xc6ad('0x1f')](function(_0x59e53a){return _0x59e53a;});}return null;};}function removeEntity(_0x587518,_0x1f5392){return function(_0xf8549f){if(_0xf8549f){return _0xf8549f[_0xc6ad('0x20')]()[_0xc6ad('0x1f')](function(){_0x587518[_0xc6ad('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28f64e,_0x45a3da){return function(_0x43026c){if(!_0x43026c){_0x28f64e['sendStatus'](0x194);}return _0x43026c;};}function handleError(_0x210abe,_0x385209){_0x385209=_0x385209||0x1f4;return function(_0x26fd7b){logger['error'](_0x26fd7b[_0xc6ad('0x21')]);if(_0x26fd7b[_0xc6ad('0x22')]){delete _0x26fd7b[_0xc6ad('0x22')];}_0x210abe[_0xc6ad('0x17')](_0x385209)[_0xc6ad('0x23')](_0x26fd7b);};}exports['index']=function(_0x5e6d81,_0x427ea8){var _0x2e657b={},_0x40cbeb={},_0x5cc4bf={'count':0x0,'rows':[]};var _0x1f7b7b=db[_0xc6ad('0x24')][_0xc6ad('0x25')];_0x40cbeb[_0xc6ad('0x26')]=_[_0xc6ad('0x27')](_0x1f7b7b);var _0x1bf3a6={'dateStart':_0x5e6d81['query'][_0xc6ad('0x28')],'dateEnd':_0x5e6d81['query']['dateEnd']};delete _0x5e6d81[_0xc6ad('0x29')][_0xc6ad('0x28')];delete _0x5e6d81[_0xc6ad('0x29')][_0xc6ad('0x2a')];_0x40cbeb[_0xc6ad('0x29')]=_[_0xc6ad('0x27')](_0x5e6d81['query']);_0x40cbeb[_0xc6ad('0x2b')]=_[_0xc6ad('0x2c')](_0x40cbeb['model'],_0x40cbeb['query']);_0x2e657b[_0xc6ad('0x2d')]=_['intersection'](_0x40cbeb[_0xc6ad('0x26')],qs['fields'](_0x5e6d81[_0xc6ad('0x29')][_0xc6ad('0x2e')]));_0x2e657b[_0xc6ad('0x2d')]=_0x2e657b[_0xc6ad('0x2d')]['length']?_0x2e657b[_0xc6ad('0x2d')]:_0x40cbeb[_0xc6ad('0x26')];if(!_0x5e6d81[_0xc6ad('0x29')][_0xc6ad('0x2f')](_0xc6ad('0x30'))){_0x2e657b[_0xc6ad('0x1b')]=qs[_0xc6ad('0x1b')](_0x5e6d81['query'][_0xc6ad('0x1b')]);_0x2e657b[_0xc6ad('0x1a')]=qs[_0xc6ad('0x1a')](_0x5e6d81[_0xc6ad('0x29')]['offset']);}_0x2e657b[_0xc6ad('0x31')]=qs[_0xc6ad('0x32')](_0x5e6d81[_0xc6ad('0x29')][_0xc6ad('0x32')]);_0x2e657b['where']=qs[_0xc6ad('0x2b')](_['pick'](_0x5e6d81[_0xc6ad('0x29')],_0x40cbeb[_0xc6ad('0x2b')]));if(_0x1bf3a6[_0xc6ad('0x28')]){if(_0x1bf3a6[_0xc6ad('0x2a')]){_0x1bf3a6[_0xc6ad('0x2a')]=moment(_0x1bf3a6['dateEnd'])[_0xc6ad('0x33')](0x1,_0xc6ad('0x34'));}else{_0x1bf3a6['dateEnd']=moment(_0x1bf3a6[_0xc6ad('0x28')])['add'](0x1,_0xc6ad('0x34'));}_['merge'](_0x2e657b[_0xc6ad('0x35')],{'createdAt':{'$gte':_0x1bf3a6[_0xc6ad('0x28')],'$lte':_0x1bf3a6[_0xc6ad('0x2a')]}});}if(_0x5e6d81[_0xc6ad('0x29')][_0xc6ad('0x36')]){_0x2e657b['where']=_[_0xc6ad('0x37')](_0x2e657b[_0xc6ad('0x35')],{'$or':_[_0xc6ad('0x38')](_0x2e657b['attributes'],function(_0x42136b){var _0x328abb={};_0x328abb[_0x42136b]={'$like':'%'+_0x5e6d81[_0xc6ad('0x29')][_0xc6ad('0x36')]+'%'};return _0x328abb;})});}_0x2e657b=_[_0xc6ad('0x37')]({},_0x2e657b,_0x5e6d81[_0xc6ad('0x39')]);var _0x50f4b6={'where':_0x2e657b[_0xc6ad('0x35')]};return db[_0xc6ad('0x24')][_0xc6ad('0x19')](_0x50f4b6)[_0xc6ad('0x1f')](function(_0x2d49aa){_0x5cc4bf[_0xc6ad('0x19')]=_0x2d49aa;if(_0x5e6d81['query'][_0xc6ad('0x3a')]){_0x2e657b[_0xc6ad('0x3b')]=[{'all':!![]}];}return db[_0xc6ad('0x24')]['findAll'](_0x2e657b);})[_0xc6ad('0x1f')](function(_0x5df418){_0x5cc4bf[_0xc6ad('0x3c')]=_0x5df418;return _0x5cc4bf;})[_0xc6ad('0x1f')](respondWithFilteredResult(_0x427ea8,_0x2e657b))['catch'](handleError(_0x427ea8,null));};exports[_0xc6ad('0x3d')]=function(_0x2a0714,_0x389b01){var _0x1f2896={'raw':!![],'where':{'id':_0x2a0714[_0xc6ad('0x3e')]['id']}},_0xfab81b={};_0xfab81b[_0xc6ad('0x26')]=_[_0xc6ad('0x27')](db['MailServerOut'][_0xc6ad('0x25')]);_0xfab81b[_0xc6ad('0x29')]=_[_0xc6ad('0x27')](_0x2a0714[_0xc6ad('0x29')]);_0xfab81b[_0xc6ad('0x2b')]=_[_0xc6ad('0x2c')](_0xfab81b[_0xc6ad('0x26')],_0xfab81b[_0xc6ad('0x29')]);_0x1f2896['attributes']=_[_0xc6ad('0x2c')](_0xfab81b['model'],qs[_0xc6ad('0x2e')](_0x2a0714[_0xc6ad('0x29')]['fields']));_0x1f2896[_0xc6ad('0x2d')]=_0x1f2896[_0xc6ad('0x2d')]['length']?_0x1f2896['attributes']:_0xfab81b[_0xc6ad('0x26')];if(_0x2a0714['query'][_0xc6ad('0x3a')]){_0x1f2896[_0xc6ad('0x3b')]=[{'all':!![]}];}_0x1f2896=_[_0xc6ad('0x37')]({},_0x1f2896,_0x2a0714[_0xc6ad('0x39')]);return db[_0xc6ad('0x24')][_0xc6ad('0x3f')](_0x1f2896)[_0xc6ad('0x1f')](handleEntityNotFound(_0x389b01,null))['then'](respondWithResult(_0x389b01,null))[_0xc6ad('0x40')](handleError(_0x389b01,null));};exports[_0xc6ad('0x41')]=function(_0xbef320,_0x57de92){return db[_0xc6ad('0x24')]['create'](_0xbef320[_0xc6ad('0x42')],{})[_0xc6ad('0x1f')](respondWithResult(_0x57de92,0xc9))['catch'](handleError(_0x57de92,null));};exports[_0xc6ad('0x43')]=function(_0x5a4244,_0x23d978){if(_0x5a4244[_0xc6ad('0x42')]['id']){delete _0x5a4244[_0xc6ad('0x42')]['id'];}return db[_0xc6ad('0x24')]['find']({'where':{'id':_0x5a4244[_0xc6ad('0x3e')]['id']}})[_0xc6ad('0x1f')](handleEntityNotFound(_0x23d978,null))[_0xc6ad('0x1f')](saveUpdates(_0x5a4244['body'],null))['then'](respondWithResult(_0x23d978,null))[_0xc6ad('0x40')](handleError(_0x23d978,null));};exports['destroy']=function(_0x29e2bd,_0x29999d){return db[_0xc6ad('0x24')][_0xc6ad('0x3f')]({'where':{'id':_0x29e2bd[_0xc6ad('0x3e')]['id']}})['then'](handleEntityNotFound(_0x29999d,null))[_0xc6ad('0x1f')](removeEntity(_0x29999d,null))[_0xc6ad('0x40')](handleError(_0x29999d,null));}; \ No newline at end of file +var _0x3e05=['json','reject','save','then','destroy','error','name','send','index','MailServerOut','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','filter','map','options','includeAll','include','rows','catch','params','find','create','update','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0x3e05,0x13e));var _0x53e0=function(_0x37de18,_0x40d85b){_0x37de18=_0x37de18-0x0;var _0x32576a=_0x3e05[_0x37de18];return _0x32576a;};'use strict';var pdf=require(_0x53e0('0x0'));var emlformat=require(_0x53e0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x53e0('0x2'));var jsonpatch=require(_0x53e0('0x3'));var rp=require('request-promise');var moment=require(_0x53e0('0x4'));var BPromise=require(_0x53e0('0x5'));var Mustache=require(_0x53e0('0x6'));var util=require(_0x53e0('0x7'));var path=require('path');var sox=require(_0x53e0('0x8'));var csv=require(_0x53e0('0x9'));var ejs=require(_0x53e0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x53e0('0xb'));var crypto=require(_0x53e0('0xc'));var jsforce=require(_0x53e0('0xd'));var deskjs=require(_0x53e0('0xe'));var toCsv=require(_0x53e0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x53e0('0xf'));var qs=require(_0x53e0('0x10'));var logger=require(_0x53e0('0x11'))(_0x53e0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x53e0('0x13'))['db'];function respondWithStatusCode(_0x3396fb,_0x12e8a5){_0x12e8a5=_0x12e8a5||0xcc;return function(_0xf0ba05){if(_0xf0ba05){return _0x3396fb[_0x53e0('0x14')](_0x12e8a5);}return _0x3396fb[_0x53e0('0x15')](_0x12e8a5)[_0x53e0('0x16')]();};}function respondWithResult(_0x4354c3,_0x1dd5ad){_0x1dd5ad=_0x1dd5ad||0xc8;return function(_0xaf12f0){if(_0xaf12f0){return _0x4354c3[_0x53e0('0x15')](_0x1dd5ad)['json'](_0xaf12f0);}};}function respondWithFilteredResult(_0x560dba,_0x2cf0d2){return function(_0x21e5f5){if(_0x21e5f5){var _0x5119f8=_0x21e5f5[_0x53e0('0x17')],_0x492de6=_0x2cf0d2['offset'],_0x3c0bb9=_0x2cf0d2[_0x53e0('0x18')]+_0x2cf0d2[_0x53e0('0x19')],_0x507dce;if(_0x3c0bb9>=_0x5119f8){_0x3c0bb9=_0x5119f8;_0x507dce=0xc8;}else{_0x507dce=0xce;}_0x560dba[_0x53e0('0x15')](_0x507dce);return _0x560dba['set'](_0x53e0('0x1a'),_0x492de6+'-'+_0x3c0bb9+'/'+_0x5119f8)[_0x53e0('0x1b')](_0x21e5f5);}return null;};}function patchUpdates(_0x56cf90){return function(_0x57a3b8){try{jsonpatch['apply'](_0x57a3b8,_0x56cf90,!![]);}catch(_0x85d990){return BPromise[_0x53e0('0x1c')](_0x85d990);}return _0x57a3b8[_0x53e0('0x1d')]();};}function saveUpdates(_0x35be56,_0x1f8037){return function(_0x479049){if(_0x479049){return _0x479049['update'](_0x35be56)[_0x53e0('0x1e')](function(_0x4bca82){return _0x4bca82;});}return null;};}function removeEntity(_0x287c6c,_0x4864d2){return function(_0x10f8ab){if(_0x10f8ab){return _0x10f8ab[_0x53e0('0x1f')]()[_0x53e0('0x1e')](function(){_0x287c6c[_0x53e0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead96,_0x41d2da){return function(_0x571c5e){if(!_0x571c5e){_0x2ead96[_0x53e0('0x14')](0x194);}return _0x571c5e;};}function handleError(_0x4a9d57,_0x46bf2a){_0x46bf2a=_0x46bf2a||0x1f4;return function(_0x45e598){logger[_0x53e0('0x20')](_0x45e598['stack']);if(_0x45e598[_0x53e0('0x21')]){delete _0x45e598[_0x53e0('0x21')];}_0x4a9d57[_0x53e0('0x15')](_0x46bf2a)[_0x53e0('0x22')](_0x45e598);};}exports[_0x53e0('0x23')]=function(_0x336c6a,_0x6de149){var _0x1e4ec4={},_0x7c60c9={},_0x1b46bd={'count':0x0,'rows':[]};var _0x102e62=db[_0x53e0('0x24')][_0x53e0('0x25')];_0x7c60c9[_0x53e0('0x26')]=_[_0x53e0('0x27')](_0x102e62);var _0x28e05f={'dateStart':_0x336c6a[_0x53e0('0x28')][_0x53e0('0x29')],'dateEnd':_0x336c6a['query'][_0x53e0('0x2a')]};delete _0x336c6a['query'][_0x53e0('0x29')];delete _0x336c6a[_0x53e0('0x28')][_0x53e0('0x2a')];_0x7c60c9[_0x53e0('0x28')]=_[_0x53e0('0x27')](_0x336c6a['query']);_0x7c60c9[_0x53e0('0x2b')]=_[_0x53e0('0x2c')](_0x7c60c9[_0x53e0('0x26')],_0x7c60c9[_0x53e0('0x28')]);_0x1e4ec4[_0x53e0('0x2d')]=_[_0x53e0('0x2c')](_0x7c60c9[_0x53e0('0x26')],qs[_0x53e0('0x2e')](_0x336c6a[_0x53e0('0x28')]['fields']));_0x1e4ec4[_0x53e0('0x2d')]=_0x1e4ec4[_0x53e0('0x2d')][_0x53e0('0x2f')]?_0x1e4ec4[_0x53e0('0x2d')]:_0x7c60c9['model'];if(!_0x336c6a[_0x53e0('0x28')][_0x53e0('0x30')](_0x53e0('0x31'))){_0x1e4ec4[_0x53e0('0x19')]=qs[_0x53e0('0x19')](_0x336c6a[_0x53e0('0x28')][_0x53e0('0x19')]);_0x1e4ec4[_0x53e0('0x18')]=qs['offset'](_0x336c6a[_0x53e0('0x28')][_0x53e0('0x18')]);}_0x1e4ec4[_0x53e0('0x32')]=qs[_0x53e0('0x33')](_0x336c6a[_0x53e0('0x28')]['sort']);_0x1e4ec4['where']=qs[_0x53e0('0x2b')](_[_0x53e0('0x34')](_0x336c6a['query'],_0x7c60c9[_0x53e0('0x2b')]));if(_0x28e05f['dateStart']){if(_0x28e05f[_0x53e0('0x2a')]){_0x28e05f[_0x53e0('0x2a')]=moment(_0x28e05f[_0x53e0('0x2a')])[_0x53e0('0x35')](0x1,_0x53e0('0x36'));}else{_0x28e05f[_0x53e0('0x2a')]=moment(_0x28e05f[_0x53e0('0x29')])['add'](0x1,'day');}_[_0x53e0('0x37')](_0x1e4ec4[_0x53e0('0x38')],{'createdAt':{'$gte':_0x28e05f[_0x53e0('0x29')],'$lte':_0x28e05f[_0x53e0('0x2a')]}});}if(_0x336c6a['query'][_0x53e0('0x39')]){_0x1e4ec4[_0x53e0('0x38')]=_[_0x53e0('0x37')](_0x1e4ec4[_0x53e0('0x38')],{'$or':_[_0x53e0('0x3a')](_0x1e4ec4[_0x53e0('0x2d')],function(_0xf1c9b4){var _0x581a77={};_0x581a77[_0xf1c9b4]={'$like':'%'+_0x336c6a[_0x53e0('0x28')][_0x53e0('0x39')]+'%'};return _0x581a77;})});}_0x1e4ec4=_[_0x53e0('0x37')]({},_0x1e4ec4,_0x336c6a[_0x53e0('0x3b')]);var _0x53c8ee={'where':_0x1e4ec4[_0x53e0('0x38')]};return db[_0x53e0('0x24')][_0x53e0('0x17')](_0x53c8ee)[_0x53e0('0x1e')](function(_0x39ade9){_0x1b46bd[_0x53e0('0x17')]=_0x39ade9;if(_0x336c6a['query'][_0x53e0('0x3c')]){_0x1e4ec4[_0x53e0('0x3d')]=[{'all':!![]}];}return db[_0x53e0('0x24')]['findAll'](_0x1e4ec4);})[_0x53e0('0x1e')](function(_0x50b4c1){_0x1b46bd[_0x53e0('0x3e')]=_0x50b4c1;return _0x1b46bd;})[_0x53e0('0x1e')](respondWithFilteredResult(_0x6de149,_0x1e4ec4))[_0x53e0('0x3f')](handleError(_0x6de149,null));};exports['show']=function(_0x108482,_0x1711cc){var _0x4d8687={'raw':!![],'where':{'id':_0x108482[_0x53e0('0x40')]['id']}},_0x251a4f={};_0x251a4f[_0x53e0('0x26')]=_['keys'](db[_0x53e0('0x24')][_0x53e0('0x25')]);_0x251a4f[_0x53e0('0x28')]=_['keys'](_0x108482['query']);_0x251a4f[_0x53e0('0x2b')]=_[_0x53e0('0x2c')](_0x251a4f[_0x53e0('0x26')],_0x251a4f[_0x53e0('0x28')]);_0x4d8687[_0x53e0('0x2d')]=_[_0x53e0('0x2c')](_0x251a4f[_0x53e0('0x26')],qs[_0x53e0('0x2e')](_0x108482[_0x53e0('0x28')][_0x53e0('0x2e')]));_0x4d8687[_0x53e0('0x2d')]=_0x4d8687['attributes'][_0x53e0('0x2f')]?_0x4d8687['attributes']:_0x251a4f[_0x53e0('0x26')];if(_0x108482[_0x53e0('0x28')][_0x53e0('0x3c')]){_0x4d8687[_0x53e0('0x3d')]=[{'all':!![]}];}_0x4d8687=_[_0x53e0('0x37')]({},_0x4d8687,_0x108482[_0x53e0('0x3b')]);return db[_0x53e0('0x24')][_0x53e0('0x41')](_0x4d8687)['then'](handleEntityNotFound(_0x1711cc,null))[_0x53e0('0x1e')](respondWithResult(_0x1711cc,null))[_0x53e0('0x3f')](handleError(_0x1711cc,null));};exports[_0x53e0('0x42')]=function(_0x5b830d,_0x360c48){return db[_0x53e0('0x24')][_0x53e0('0x42')](_0x5b830d['body'],{})[_0x53e0('0x1e')](respondWithResult(_0x360c48,0xc9))['catch'](handleError(_0x360c48,null));};exports[_0x53e0('0x43')]=function(_0x3e4f99,_0x36863b){if(_0x3e4f99[_0x53e0('0x44')]['id']){delete _0x3e4f99[_0x53e0('0x44')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x3e4f99[_0x53e0('0x40')]['id']}})[_0x53e0('0x1e')](handleEntityNotFound(_0x36863b,null))[_0x53e0('0x1e')](saveUpdates(_0x3e4f99[_0x53e0('0x44')],null))[_0x53e0('0x1e')](respondWithResult(_0x36863b,null))['catch'](handleError(_0x36863b,null));};exports[_0x53e0('0x1f')]=function(_0x188225,_0x1e6ecc){return db['MailServerOut'][_0x53e0('0x41')]({'where':{'id':_0x188225[_0x53e0('0x40')]['id']}})[_0x53e0('0x1e')](handleEntityNotFound(_0x1e6ecc,null))[_0x53e0('0x1e')](removeEntity(_0x1e6ecc,null))[_0x53e0('0x3f')](handleError(_0x1e6ecc,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index fa8dc54..db815b9 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 _0x06ae=['moment','bluebird','request-promise','./mailServerOut.attributes','exports','mail_servers_out','util','../../config/logger','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var logger=require(_0xe06a('0x1'))(_0xe06a('0x2'));var moment=require(_0xe06a('0x3'));var BPromise=require(_0xe06a('0x4'));var rp=require(_0xe06a('0x5'));var attributes=require(_0xe06a('0x6'));module[_0xe06a('0x7')]=function(_0x1e7706,_0x4de363){return _0x1e7706['define']('MailServerOut',attributes,{'tableName':_0xe06a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x978037,_0x731e6b){var _0xed75c9=function(_0xac16dd){while(--_0xac16dd){_0x978037['push'](_0x978037['shift']());}};_0xed75c9(++_0x731e6b);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var attributes=require(_0xae3d('0x7'));module[_0xae3d('0x8')]=function(_0x22bacf,_0x1b9397){return _0x22bacf[_0xae3d('0x9')](_0xae3d('0xa'),attributes,{'tableName':_0xae3d('0xb'),'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 b624a00..92b958c 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 _0x5b0c=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0xf5b251,_0x3263e9){var _0x585f7a=function(_0x3ba58e){while(--_0x3ba58e){_0xf5b251['push'](_0xf5b251['shift']());}};_0x585f7a(++_0x3263e9);}(_0x5b0c,0x104));var _0xc5b0=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x5b0c[_0x15ea09];return _0x3e9c78;};'use strict';var _=require(_0xc5b0('0x0'));var util=require(_0xc5b0('0x1'));var moment=require(_0xc5b0('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5b0('0x3'));var fs=require('fs');var Redis=require(_0xc5b0('0x4'));var db=require(_0xc5b0('0x5'))['db'];var utils=require(_0xc5b0('0x6'));var logger=require('../../config/logger')(_0xc5b0('0x7'));var config=require(_0xc5b0('0x8'));var jayson=require(_0xc5b0('0x9'));var client=jayson['client'][_0xc5b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ce07d,_0x2faaac,_0x2276dd){return new BPromise(function(_0x27bd07,_0x38e00f){return client[_0xc5b0('0xb')](_0x5ce07d,_0x2276dd)[_0xc5b0('0xc')](function(_0x3f7c3a){logger['info'](_0xc5b0('0xd'),_0x2faaac,_0xc5b0('0xe'));logger[_0xc5b0('0xf')](_0xc5b0('0x10'),_0x2faaac,_0xc5b0('0xe'),JSON[_0xc5b0('0x11')](_0x3f7c3a));if(_0x3f7c3a['error']){if(_0x3f7c3a[_0xc5b0('0x12')][_0xc5b0('0x13')]===0x1f4){logger[_0xc5b0('0x12')](_0xc5b0('0xd'),_0x2faaac,_0x3f7c3a[_0xc5b0('0x12')][_0xc5b0('0x14')]);return _0x38e00f(_0x3f7c3a[_0xc5b0('0x12')][_0xc5b0('0x14')]);}logger[_0xc5b0('0x12')](_0xc5b0('0xd'),_0x2faaac,_0x3f7c3a['error'][_0xc5b0('0x14')]);return _0x27bd07(_0x3f7c3a['error'][_0xc5b0('0x14')]);}else{logger[_0xc5b0('0x15')]('MailServerOut,\x20%s,\x20%s',_0x2faaac,_0xc5b0('0xe'));_0x27bd07(_0x3f7c3a[_0xc5b0('0x16')]['message']);}})[_0xc5b0('0x17')](function(_0x5e540e){logger[_0xc5b0('0x12')](_0xc5b0('0xd'),_0x2faaac,_0x5e540e);_0x38e00f(_0x5e540e);});});} \ No newline at end of file +var _0x9abc=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x50b95e,_0x369a15){var _0x488bd=function(_0x145498){while(--_0x145498){_0x50b95e['push'](_0x50b95e['shift']());}};_0x488bd(++_0x369a15);}(_0x9abc,0x83));var _0xc9ab=function(_0x39238d,_0xbe548e){_0x39238d=_0x39238d-0x0;var _0x2ccbc9=_0x9abc[_0x39238d];return _0x2ccbc9;};'use strict';var _=require(_0xc9ab('0x0'));var util=require(_0xc9ab('0x1'));var moment=require(_0xc9ab('0x2'));var BPromise=require(_0xc9ab('0x3'));var rs=require(_0xc9ab('0x4'));var fs=require('fs');var Redis=require(_0xc9ab('0x5'));var db=require(_0xc9ab('0x6'))['db'];var utils=require(_0xc9ab('0x7'));var logger=require(_0xc9ab('0x8'))(_0xc9ab('0x9'));var config=require(_0xc9ab('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc9ab('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fbda9,_0x2165bb,_0x350345){return new BPromise(function(_0x23146d,_0x1144df){return client[_0xc9ab('0xc')](_0x4fbda9,_0x350345)[_0xc9ab('0xd')](function(_0x490aec){logger[_0xc9ab('0xe')](_0xc9ab('0xf'),_0x2165bb,'request\x20sent');logger[_0xc9ab('0x10')](_0xc9ab('0x11'),_0x2165bb,_0xc9ab('0x12'),JSON[_0xc9ab('0x13')](_0x490aec));if(_0x490aec[_0xc9ab('0x14')]){if(_0x490aec[_0xc9ab('0x14')][_0xc9ab('0x15')]===0x1f4){logger[_0xc9ab('0x14')]('MailServerOut,\x20%s,\x20%s',_0x2165bb,_0x490aec[_0xc9ab('0x14')][_0xc9ab('0x16')]);return _0x1144df(_0x490aec['error']['message']);}logger[_0xc9ab('0x14')](_0xc9ab('0xf'),_0x2165bb,_0x490aec[_0xc9ab('0x14')][_0xc9ab('0x16')]);return _0x23146d(_0x490aec[_0xc9ab('0x14')][_0xc9ab('0x16')]);}else{logger['info'](_0xc9ab('0xf'),_0x2165bb,_0xc9ab('0x12'));_0x23146d(_0x490aec['result'][_0xc9ab('0x16')]);}})['catch'](function(_0xb47858){logger[_0xc9ab('0x14')](_0xc9ab('0xf'),_0x2165bb,_0xb47858);_0x1144df(_0xb47858);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index d7170eb..20f032b 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 _0x9dee=['index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated'];(function(_0x218c0c,_0x2b21e3){var _0xf0347d=function(_0xb3b51c){while(--_0xb3b51c){_0x218c0c['push'](_0x218c0c['shift']());}};_0xf0347d(++_0x2b21e3);}(_0x9dee,0x14f));var _0xe9de=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0x9dee[_0x35b7d4];return _0x4e8cee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe9de('0x0'));var timeout=require(_0xe9de('0x1'));var express=require(_0xe9de('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe9de('0x3'));var config=require(_0xe9de('0x4'));var controller=require(_0xe9de('0x5'));router['get']('/',auth[_0xe9de('0x6')](),controller[_0xe9de('0x7')]);router[_0xe9de('0x8')](_0xe9de('0x9'),auth[_0xe9de('0x6')](),controller[_0xe9de('0xa')]);router[_0xe9de('0x8')](_0xe9de('0xb'),auth['isAuthenticated'](),controller[_0xe9de('0xc')]);router[_0xe9de('0xd')]('/',auth['isAuthenticated'](),controller[_0xe9de('0xe')]);router[_0xe9de('0xf')](_0xe9de('0xb'),auth[_0xe9de('0x6')](),controller[_0xe9de('0x10')]);router[_0xe9de('0x11')](_0xe9de('0xb'),auth[_0xe9de('0x6')](),controller[_0xe9de('0x12')]);module['exports']=router; \ No newline at end of file +var _0x315b=['exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','destroy'];(function(_0x3d8ba1,_0x5ba1fd){var _0x87804e=function(_0x5bf2a7){while(--_0x5bf2a7){_0x3d8ba1['push'](_0x3d8ba1['shift']());}};_0x87804e(++_0x5ba1fd);}(_0x315b,0x1ee));var _0xb315=function(_0x335f70,_0x35650f){_0x335f70=_0x335f70-0x0;var _0x526ffb=_0x315b[_0x335f70];return _0x526ffb;};'use strict';var multer=require('multer');var util=require(_0xb315('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb315('0x1'));var router=express[_0xb315('0x2')]();var auth=require(_0xb315('0x3'));var interaction=require(_0xb315('0x4'));var config=require(_0xb315('0x5'));var controller=require(_0xb315('0x6'));router[_0xb315('0x7')]('/',auth[_0xb315('0x8')](),controller['index']);router['get'](_0xb315('0x9'),auth[_0xb315('0x8')](),controller[_0xb315('0xa')]);router['get'](_0xb315('0xb'),auth[_0xb315('0x8')](),controller['show']);router[_0xb315('0xc')]('/',auth[_0xb315('0x8')](),controller[_0xb315('0xd')]);router[_0xb315('0xe')]('/:id',auth[_0xb315('0x8')](),controller['update']);router['delete'](_0xb315('0xb'),auth[_0xb315('0x8')](),controller[_0xb315('0xf')]);module[_0xb315('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 9b8f545..ac3a35a 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 _0x0647=['name','sequelize','STRING'];(function(_0x1acc3f,_0x22cba4){var _0x9c5903=function(_0x3394ef){while(--_0x3394ef){_0x1acc3f['push'](_0x1acc3f['shift']());}};_0x9c5903(++_0x22cba4);}(_0x0647,0xd0));var _0x7064=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x0647[_0x2c7b86];return _0x256735;};'use strict';var Sequelize=require(_0x7064('0x0'));module['exports']={'name':{'type':Sequelize[_0x7064('0x1')],'unique':_0x7064('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7064('0x1')]}}; \ No newline at end of file +var _0x174b=['name','STRING','sequelize'];(function(_0x4a4f54,_0x37f8cc){var _0x3b8a0f=function(_0x150d87){while(--_0x150d87){_0x4a4f54['push'](_0x4a4f54['shift']());}};_0x3b8a0f(++_0x37f8cc);}(_0x174b,0x19d));var _0xb174=function(_0x1fff56,_0x1f2765){_0x1fff56=_0x1fff56-0x0;var _0x29b636=_0x174b[_0x1fff56];return _0x29b636;};'use strict';var Sequelize=require(_0xb174('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb174('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb174('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f9d1567..5ad4bb6 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 _0x4bec=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','send','index','MailSubstatus','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','add','day','merge','where','filter','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','html-pdf','eml-format'];(function(_0x5c49b3,_0x49b09a){var _0x7ec281=function(_0x4a39f3){while(--_0x4a39f3){_0x5c49b3['push'](_0x5c49b3['shift']());}};_0x7ec281(++_0x49b09a);}(_0x4bec,0x11e));var _0xc4be=function(_0x104874,_0x2f8033){_0x104874=_0x104874-0x0;var _0x14fcbd=_0x4bec[_0x104874];return _0x14fcbd;};'use strict';var pdf=require(_0xc4be('0x0'));var emlformat=require(_0xc4be('0x1'));var rimraf=require(_0xc4be('0x2'));var zipdir=require(_0xc4be('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4be('0x4'));var moment=require(_0xc4be('0x5'));var BPromise=require(_0xc4be('0x6'));var Mustache=require(_0xc4be('0x7'));var util=require(_0xc4be('0x8'));var path=require(_0xc4be('0x9'));var sox=require(_0xc4be('0xa'));var csv=require(_0xc4be('0xb'));var ejs=require(_0xc4be('0xc'));var fs=require('fs');var _=require(_0xc4be('0xd'));var squel=require(_0xc4be('0xe'));var crypto=require(_0xc4be('0xf'));var jsforce=require(_0xc4be('0x10'));var deskjs=require(_0xc4be('0x11'));var toCsv=require(_0xc4be('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xc4be('0x12'));var logger=require(_0xc4be('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc4be('0x14'));var db=require(_0xc4be('0x15'))['db'];function respondWithStatusCode(_0xc6ad64,_0x5976a1){_0x5976a1=_0x5976a1||0xcc;return function(_0x3df5f2){if(_0x3df5f2){return _0xc6ad64[_0xc4be('0x16')](_0x5976a1);}return _0xc6ad64[_0xc4be('0x17')](_0x5976a1)[_0xc4be('0x18')]();};}function respondWithResult(_0x1a2fa3,_0x48cca9){_0x48cca9=_0x48cca9||0xc8;return function(_0x3d53e4){if(_0x3d53e4){return _0x1a2fa3['status'](_0x48cca9)[_0xc4be('0x19')](_0x3d53e4);}};}function respondWithFilteredResult(_0x5ed00c,_0x508dfc){return function(_0x2f492e){if(_0x2f492e){var _0x104c5e=_0x2f492e[_0xc4be('0x1a')],_0x24f817=_0x508dfc['offset'],_0x308674=_0x508dfc[_0xc4be('0x1b')]+_0x508dfc[_0xc4be('0x1c')],_0x4a1957;if(_0x308674>=_0x104c5e){_0x308674=_0x104c5e;_0x4a1957=0xc8;}else{_0x4a1957=0xce;}_0x5ed00c[_0xc4be('0x17')](_0x4a1957);return _0x5ed00c['set'](_0xc4be('0x1d'),_0x24f817+'-'+_0x308674+'/'+_0x104c5e)[_0xc4be('0x19')](_0x2f492e);}return null;};}function patchUpdates(_0x357a1b){return function(_0x5616aa){try{jsonpatch[_0xc4be('0x1e')](_0x5616aa,_0x357a1b,!![]);}catch(_0x29d61f){return BPromise['reject'](_0x29d61f);}return _0x5616aa[_0xc4be('0x1f')]();};}function saveUpdates(_0x3297fd,_0x5ef42d){return function(_0x17eeed){if(_0x17eeed){return _0x17eeed[_0xc4be('0x20')](_0x3297fd)[_0xc4be('0x21')](function(_0x396c51){return _0x396c51;});}return null;};}function removeEntity(_0x5825d5,_0x1a6581){return function(_0xff5358){if(_0xff5358){return _0xff5358[_0xc4be('0x22')]()[_0xc4be('0x21')](function(){_0x5825d5[_0xc4be('0x17')](0xcc)[_0xc4be('0x18')]();});}};}function handleEntityNotFound(_0x474354,_0x5ac1be){return function(_0x3d50b5){if(!_0x3d50b5){_0x474354[_0xc4be('0x16')](0x194);}return _0x3d50b5;};}function handleError(_0x1052cd,_0x309fe8){_0x309fe8=_0x309fe8||0x1f4;return function(_0x459f1d){logger[_0xc4be('0x23')](_0x459f1d[_0xc4be('0x24')]);if(_0x459f1d['name']){delete _0x459f1d['name'];}_0x1052cd[_0xc4be('0x17')](_0x309fe8)[_0xc4be('0x25')](_0x459f1d);};}exports[_0xc4be('0x26')]=function(_0x3954f5,_0x43babf){var _0x362ed7={},_0x3cd464={},_0x518b8d={'count':0x0,'rows':[]};var _0x2a7b51=db[_0xc4be('0x27')]['rawAttributes'];_0x3cd464[_0xc4be('0x28')]=_[_0xc4be('0x29')](_0x2a7b51);var _0x2eb8b2={'dateStart':_0x3954f5[_0xc4be('0x2a')][_0xc4be('0x2b')],'dateEnd':_0x3954f5[_0xc4be('0x2a')][_0xc4be('0x2c')]};delete _0x3954f5[_0xc4be('0x2a')]['dateStart'];delete _0x3954f5['query'][_0xc4be('0x2c')];_0x3cd464[_0xc4be('0x2a')]=_[_0xc4be('0x29')](_0x3954f5[_0xc4be('0x2a')]);_0x3cd464['filters']=_[_0xc4be('0x2d')](_0x3cd464['model'],_0x3cd464[_0xc4be('0x2a')]);_0x362ed7['attributes']=_[_0xc4be('0x2d')](_0x3cd464[_0xc4be('0x28')],qs['fields'](_0x3954f5[_0xc4be('0x2a')][_0xc4be('0x2e')]));_0x362ed7['attributes']=_0x362ed7[_0xc4be('0x2f')][_0xc4be('0x30')]?_0x362ed7[_0xc4be('0x2f')]:_0x3cd464[_0xc4be('0x28')];if(!_0x3954f5['query'][_0xc4be('0x31')]('nolimit')){_0x362ed7['limit']=qs['limit'](_0x3954f5[_0xc4be('0x2a')][_0xc4be('0x1c')]);_0x362ed7[_0xc4be('0x1b')]=qs['offset'](_0x3954f5[_0xc4be('0x2a')]['offset']);}_0x362ed7[_0xc4be('0x32')]=qs['sort'](_0x3954f5[_0xc4be('0x2a')][_0xc4be('0x33')]);_0x362ed7['where']=qs[_0xc4be('0x34')](_['pick'](_0x3954f5[_0xc4be('0x2a')],_0x3cd464['filters']));if(_0x2eb8b2[_0xc4be('0x2b')]){if(_0x2eb8b2[_0xc4be('0x2c')]){_0x2eb8b2[_0xc4be('0x2c')]=moment(_0x2eb8b2['dateEnd'])[_0xc4be('0x35')](0x1,_0xc4be('0x36'));}else{_0x2eb8b2[_0xc4be('0x2c')]=moment(_0x2eb8b2[_0xc4be('0x2b')])[_0xc4be('0x35')](0x1,'day');}_[_0xc4be('0x37')](_0x362ed7[_0xc4be('0x38')],{'createdAt':{'$gte':_0x2eb8b2[_0xc4be('0x2b')],'$lte':_0x2eb8b2['dateEnd']}});}if(_0x3954f5[_0xc4be('0x2a')][_0xc4be('0x39')]){_0x362ed7[_0xc4be('0x38')]=_[_0xc4be('0x37')](_0x362ed7[_0xc4be('0x38')],{'$or':_[_0xc4be('0x3a')](_0x362ed7[_0xc4be('0x2f')],function(_0x19cc02){var _0xa591fb={};_0xa591fb[_0x19cc02]={'$like':'%'+_0x3954f5[_0xc4be('0x2a')][_0xc4be('0x39')]+'%'};return _0xa591fb;})});}_0x362ed7=_[_0xc4be('0x37')]({},_0x362ed7,_0x3954f5[_0xc4be('0x3b')]);var _0x4179fc={'where':_0x362ed7['where']};return db['MailSubstatus'][_0xc4be('0x1a')](_0x4179fc)[_0xc4be('0x21')](function(_0x17972e){_0x518b8d[_0xc4be('0x1a')]=_0x17972e;if(_0x3954f5['query'][_0xc4be('0x3c')]){_0x362ed7[_0xc4be('0x3d')]=[{'all':!![]}];}return db[_0xc4be('0x27')][_0xc4be('0x3e')](_0x362ed7);})[_0xc4be('0x21')](function(_0x246d2f){_0x518b8d[_0xc4be('0x3f')]=_0x246d2f;return _0x518b8d;})[_0xc4be('0x21')](respondWithFilteredResult(_0x43babf,_0x362ed7))[_0xc4be('0x40')](handleError(_0x43babf,null));};exports[_0xc4be('0x41')]=function(_0x1395c0,_0x4656c5){var _0x35c6cf={'raw':!![],'where':{'id':_0x1395c0['params']['id']}},_0x52f8a7={};_0x52f8a7[_0xc4be('0x28')]=_['keys'](db[_0xc4be('0x27')][_0xc4be('0x42')]);_0x52f8a7[_0xc4be('0x2a')]=_[_0xc4be('0x29')](_0x1395c0['query']);_0x52f8a7[_0xc4be('0x34')]=_['intersection'](_0x52f8a7[_0xc4be('0x28')],_0x52f8a7[_0xc4be('0x2a')]);_0x35c6cf[_0xc4be('0x2f')]=_['intersection'](_0x52f8a7[_0xc4be('0x28')],qs[_0xc4be('0x2e')](_0x1395c0['query'][_0xc4be('0x2e')]));_0x35c6cf[_0xc4be('0x2f')]=_0x35c6cf[_0xc4be('0x2f')][_0xc4be('0x30')]?_0x35c6cf['attributes']:_0x52f8a7[_0xc4be('0x28')];if(_0x1395c0[_0xc4be('0x2a')][_0xc4be('0x3c')]){_0x35c6cf[_0xc4be('0x3d')]=[{'all':!![]}];}_0x35c6cf=_[_0xc4be('0x37')]({},_0x35c6cf,_0x1395c0[_0xc4be('0x3b')]);return db['MailSubstatus'][_0xc4be('0x43')](_0x35c6cf)[_0xc4be('0x21')](handleEntityNotFound(_0x4656c5,null))[_0xc4be('0x21')](respondWithResult(_0x4656c5,null))[_0xc4be('0x40')](handleError(_0x4656c5,null));};exports[_0xc4be('0x44')]=function(_0xa0fa6a,_0x1b5609){return db[_0xc4be('0x27')][_0xc4be('0x44')](_0xa0fa6a['body'],{})[_0xc4be('0x21')](respondWithResult(_0x1b5609,0xc9))[_0xc4be('0x40')](handleError(_0x1b5609,null));};exports['update']=function(_0x21d85c,_0x173a13){if(_0x21d85c['body']['id']){delete _0x21d85c[_0xc4be('0x45')]['id'];}return db['MailSubstatus'][_0xc4be('0x43')]({'where':{'id':_0x21d85c[_0xc4be('0x46')]['id']}})[_0xc4be('0x21')](handleEntityNotFound(_0x173a13,null))['then'](saveUpdates(_0x21d85c[_0xc4be('0x45')],null))[_0xc4be('0x21')](respondWithResult(_0x173a13,null))[_0xc4be('0x40')](handleError(_0x173a13,null));};exports[_0xc4be('0x22')]=function(_0x30c24f,_0x2ddb90){return db[_0xc4be('0x27')][_0xc4be('0x43')]({'where':{'id':_0x30c24f['params']['id']}})[_0xc4be('0x21')](handleEntityNotFound(_0x2ddb90,null))[_0xc4be('0x21')](removeEntity(_0x2ddb90,null))['catch'](handleError(_0x2ddb90,null));};exports[_0xc4be('0x47')]=function(_0x579c3a,_0x182b8a){return db[_0xc4be('0x27')][_0xc4be('0x47')]()['then'](respondWithResult(_0x182b8a,null))[_0xc4be('0x40')](handleError(_0x182b8a,null));}; \ No newline at end of file +var _0x3f10=['json','count','offset','limit','Content-Range','apply','then','destroy','error','stack','name','index','rawAttributes','model','dateStart','query','dateEnd','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','options','includeAll','include','MailSubstatus','findAll','rows','catch','params','create','update','body','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3f10,0x6f));var _0x03f1=function(_0xf2aec1,_0x2811bf){_0xf2aec1=_0xf2aec1-0x0;var _0x386b79=_0x3f10[_0xf2aec1];return _0x386b79;};'use strict';var pdf=require(_0x03f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x03f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03f1('0x2'));var rp=require(_0x03f1('0x3'));var moment=require(_0x03f1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x03f1('0x5'));var util=require(_0x03f1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x03f1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x03f1('0x8'));var squel=require('squel');var crypto=require(_0x03f1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x03f1('0xa'));var toCsv=require(_0x03f1('0x7'));var querystring=require(_0x03f1('0xb'));var Papa=require(_0x03f1('0xc'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x03f1('0xd'))('api');var utils=require(_0x03f1('0xe'));var config=require(_0x03f1('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5abca8,_0xcf203c){_0xcf203c=_0xcf203c||0xcc;return function(_0x420b6f){if(_0x420b6f){return _0x5abca8[_0x03f1('0x10')](_0xcf203c);}return _0x5abca8[_0x03f1('0x11')](_0xcf203c)[_0x03f1('0x12')]();};}function respondWithResult(_0x3a70a1,_0x2f2dd5){_0x2f2dd5=_0x2f2dd5||0xc8;return function(_0xa59393){if(_0xa59393){return _0x3a70a1['status'](_0x2f2dd5)[_0x03f1('0x13')](_0xa59393);}};}function respondWithFilteredResult(_0x589206,_0x4d03f4){return function(_0x4138fe){if(_0x4138fe){var _0x5ae8cb=_0x4138fe[_0x03f1('0x14')],_0x1bb6ab=_0x4d03f4['offset'],_0x5059ef=_0x4d03f4[_0x03f1('0x15')]+_0x4d03f4[_0x03f1('0x16')],_0xfca5bf;if(_0x5059ef>=_0x5ae8cb){_0x5059ef=_0x5ae8cb;_0xfca5bf=0xc8;}else{_0xfca5bf=0xce;}_0x589206[_0x03f1('0x11')](_0xfca5bf);return _0x589206['set'](_0x03f1('0x17'),_0x1bb6ab+'-'+_0x5059ef+'/'+_0x5ae8cb)['json'](_0x4138fe);}return null;};}function patchUpdates(_0x31cb0a){return function(_0x572bf5){try{jsonpatch[_0x03f1('0x18')](_0x572bf5,_0x31cb0a,!![]);}catch(_0x17ba0e){return BPromise['reject'](_0x17ba0e);}return _0x572bf5['save']();};}function saveUpdates(_0x10f421,_0x5bf36b){return function(_0x5560d1){if(_0x5560d1){return _0x5560d1['update'](_0x10f421)[_0x03f1('0x19')](function(_0x6e873){return _0x6e873;});}return null;};}function removeEntity(_0x4ec3ef,_0x2c566f){return function(_0x1b3c17){if(_0x1b3c17){return _0x1b3c17[_0x03f1('0x1a')]()[_0x03f1('0x19')](function(){_0x4ec3ef[_0x03f1('0x11')](0xcc)[_0x03f1('0x12')]();});}};}function handleEntityNotFound(_0x3f4089,_0x43c791){return function(_0x5e9ff4){if(!_0x5e9ff4){_0x3f4089[_0x03f1('0x10')](0x194);}return _0x5e9ff4;};}function handleError(_0x1ae115,_0x2b3ddf){_0x2b3ddf=_0x2b3ddf||0x1f4;return function(_0x26c5bf){logger[_0x03f1('0x1b')](_0x26c5bf[_0x03f1('0x1c')]);if(_0x26c5bf[_0x03f1('0x1d')]){delete _0x26c5bf[_0x03f1('0x1d')];}_0x1ae115[_0x03f1('0x11')](_0x2b3ddf)['send'](_0x26c5bf);};}exports[_0x03f1('0x1e')]=function(_0x1a71a8,_0x3b3910){var _0x1ab6ad={},_0x3b5921={},_0x805507={'count':0x0,'rows':[]};var _0x3cadd9=db['MailSubstatus'][_0x03f1('0x1f')];_0x3b5921[_0x03f1('0x20')]=_['keys'](_0x3cadd9);var _0x580a56={'dateStart':_0x1a71a8['query'][_0x03f1('0x21')],'dateEnd':_0x1a71a8[_0x03f1('0x22')][_0x03f1('0x23')]};delete _0x1a71a8[_0x03f1('0x22')][_0x03f1('0x21')];delete _0x1a71a8[_0x03f1('0x22')]['dateEnd'];_0x3b5921['query']=_[_0x03f1('0x24')](_0x1a71a8[_0x03f1('0x22')]);_0x3b5921['filters']=_[_0x03f1('0x25')](_0x3b5921['model'],_0x3b5921[_0x03f1('0x22')]);_0x1ab6ad['attributes']=_['intersection'](_0x3b5921[_0x03f1('0x20')],qs[_0x03f1('0x26')](_0x1a71a8[_0x03f1('0x22')][_0x03f1('0x26')]));_0x1ab6ad[_0x03f1('0x27')]=_0x1ab6ad[_0x03f1('0x27')][_0x03f1('0x28')]?_0x1ab6ad['attributes']:_0x3b5921['model'];if(!_0x1a71a8[_0x03f1('0x22')][_0x03f1('0x29')](_0x03f1('0x2a'))){_0x1ab6ad[_0x03f1('0x16')]=qs['limit'](_0x1a71a8[_0x03f1('0x22')][_0x03f1('0x16')]);_0x1ab6ad[_0x03f1('0x15')]=qs['offset'](_0x1a71a8['query'][_0x03f1('0x15')]);}_0x1ab6ad[_0x03f1('0x2b')]=qs['sort'](_0x1a71a8[_0x03f1('0x22')][_0x03f1('0x2c')]);_0x1ab6ad[_0x03f1('0x2d')]=qs[_0x03f1('0x2e')](_[_0x03f1('0x2f')](_0x1a71a8[_0x03f1('0x22')],_0x3b5921['filters']));if(_0x580a56['dateStart']){if(_0x580a56[_0x03f1('0x23')]){_0x580a56['dateEnd']=moment(_0x580a56[_0x03f1('0x23')])[_0x03f1('0x30')](0x1,_0x03f1('0x31'));}else{_0x580a56[_0x03f1('0x23')]=moment(_0x580a56['dateStart'])['add'](0x1,_0x03f1('0x31'));}_[_0x03f1('0x32')](_0x1ab6ad[_0x03f1('0x2d')],{'createdAt':{'$gte':_0x580a56[_0x03f1('0x21')],'$lte':_0x580a56[_0x03f1('0x23')]}});}if(_0x1a71a8[_0x03f1('0x22')][_0x03f1('0x33')]){_0x1ab6ad['where']=_[_0x03f1('0x32')](_0x1ab6ad['where'],{'$or':_['map'](_0x1ab6ad[_0x03f1('0x27')],function(_0x22baa7){var _0x830dd8={};_0x830dd8[_0x22baa7]={'$like':'%'+_0x1a71a8['query'][_0x03f1('0x33')]+'%'};return _0x830dd8;})});}_0x1ab6ad=_['merge']({},_0x1ab6ad,_0x1a71a8[_0x03f1('0x34')]);var _0x16a234={'where':_0x1ab6ad['where']};return db['MailSubstatus'][_0x03f1('0x14')](_0x16a234)['then'](function(_0x593afc){_0x805507[_0x03f1('0x14')]=_0x593afc;if(_0x1a71a8[_0x03f1('0x22')][_0x03f1('0x35')]){_0x1ab6ad[_0x03f1('0x36')]=[{'all':!![]}];}return db[_0x03f1('0x37')][_0x03f1('0x38')](_0x1ab6ad);})[_0x03f1('0x19')](function(_0x4bd386){_0x805507[_0x03f1('0x39')]=_0x4bd386;return _0x805507;})[_0x03f1('0x19')](respondWithFilteredResult(_0x3b3910,_0x1ab6ad))[_0x03f1('0x3a')](handleError(_0x3b3910,null));};exports['show']=function(_0x26be75,_0x22c1f8){var _0x41031f={'raw':!![],'where':{'id':_0x26be75[_0x03f1('0x3b')]['id']}},_0x12e14f={};_0x12e14f[_0x03f1('0x20')]=_['keys'](db[_0x03f1('0x37')][_0x03f1('0x1f')]);_0x12e14f[_0x03f1('0x22')]=_[_0x03f1('0x24')](_0x26be75[_0x03f1('0x22')]);_0x12e14f['filters']=_['intersection'](_0x12e14f['model'],_0x12e14f[_0x03f1('0x22')]);_0x41031f[_0x03f1('0x27')]=_['intersection'](_0x12e14f[_0x03f1('0x20')],qs['fields'](_0x26be75[_0x03f1('0x22')][_0x03f1('0x26')]));_0x41031f[_0x03f1('0x27')]=_0x41031f[_0x03f1('0x27')][_0x03f1('0x28')]?_0x41031f[_0x03f1('0x27')]:_0x12e14f[_0x03f1('0x20')];if(_0x26be75['query'][_0x03f1('0x35')]){_0x41031f[_0x03f1('0x36')]=[{'all':!![]}];}_0x41031f=_['merge']({},_0x41031f,_0x26be75[_0x03f1('0x34')]);return db['MailSubstatus']['find'](_0x41031f)[_0x03f1('0x19')](handleEntityNotFound(_0x22c1f8,null))[_0x03f1('0x19')](respondWithResult(_0x22c1f8,null))[_0x03f1('0x3a')](handleError(_0x22c1f8,null));};exports[_0x03f1('0x3c')]=function(_0x517c5c,_0x5873de){return db['MailSubstatus'][_0x03f1('0x3c')](_0x517c5c['body'],{})[_0x03f1('0x19')](respondWithResult(_0x5873de,0xc9))[_0x03f1('0x3a')](handleError(_0x5873de,null));};exports[_0x03f1('0x3d')]=function(_0x17392a,_0xa115e8){if(_0x17392a[_0x03f1('0x3e')]['id']){delete _0x17392a[_0x03f1('0x3e')]['id'];}return db[_0x03f1('0x37')][_0x03f1('0x3f')]({'where':{'id':_0x17392a['params']['id']}})[_0x03f1('0x19')](handleEntityNotFound(_0xa115e8,null))['then'](saveUpdates(_0x17392a[_0x03f1('0x3e')],null))[_0x03f1('0x19')](respondWithResult(_0xa115e8,null))[_0x03f1('0x3a')](handleError(_0xa115e8,null));};exports[_0x03f1('0x1a')]=function(_0x44bfcf,_0x29ec98){return db[_0x03f1('0x37')][_0x03f1('0x3f')]({'where':{'id':_0x44bfcf[_0x03f1('0x3b')]['id']}})[_0x03f1('0x19')](handleEntityNotFound(_0x29ec98,null))[_0x03f1('0x19')](removeEntity(_0x29ec98,null))['catch'](handleError(_0x29ec98,null));};exports[_0x03f1('0x40')]=function(_0x499b62,_0x34ac4f){return db['MailSubstatus'][_0x03f1('0x40')]()[_0x03f1('0x19')](respondWithResult(_0x34ac4f,null))[_0x03f1('0x3a')](handleError(_0x34ac4f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 915388e..737e64a 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 _0x841e=['MailSubstatus','api','moment','bluebird','request-promise','./mailSubstatus.attributes','exports','define'];(function(_0x5dd8f7,_0x137c94){var _0x954018=function(_0x33c731){while(--_0x33c731){_0x5dd8f7['push'](_0x5dd8f7['shift']());}};_0x954018(++_0x137c94);}(_0x841e,0xa9));var _0xe841=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x841e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe841('0x0'));var moment=require(_0xe841('0x1'));var BPromise=require(_0xe841('0x2'));var rp=require(_0xe841('0x3'));var attributes=require(_0xe841('0x4'));module[_0xe841('0x5')]=function(_0x1c82ed,_0x140124){return _0x1c82ed[_0xe841('0x6')](_0xe841('0x7'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b36=['request-promise','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','api','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0b36,0x1bd));var _0x60b3=function(_0x17397c,_0x2e2208){_0x17397c=_0x17397c-0x0;var _0x58aa5f=_0x0b36[_0x17397c];return _0x58aa5f;};'use strict';var _=require(_0x60b3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x60b3('0x1'));var moment=require('moment');var BPromise=require(_0x60b3('0x2'));var rp=require(_0x60b3('0x3'));var attributes=require(_0x60b3('0x4'));module[_0x60b3('0x5')]=function(_0x30a91d,_0x3b669f){return _0x30a91d[_0x60b3('0x6')](_0x60b3('0x7'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a7185d7..eec47e0 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 _0x5732=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x206251,_0x6c4977){var _0x442b47=function(_0x1e4beb){while(--_0x1e4beb){_0x206251['push'](_0x206251['shift']());}};_0x442b47(++_0x6c4977);}(_0x5732,0x6e));var _0x2573=function(_0x288551,_0x5d8cf1){_0x288551=_0x288551-0x0;var _0x369eb0=_0x5732[_0x288551];return _0x369eb0;};'use strict';var _=require(_0x2573('0x0'));var util=require(_0x2573('0x1'));var moment=require('moment');var BPromise=require(_0x2573('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2573('0x3'));var db=require(_0x2573('0x4'))['db'];var utils=require(_0x2573('0x5'));var logger=require(_0x2573('0x6'))('rpc');var config=require(_0x2573('0x7'));var jayson=require(_0x2573('0x8'));var client=jayson['client'][_0x2573('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x267694,_0x2b29f9,_0x4f022e){return new BPromise(function(_0x3fe339,_0x528545){return client[_0x2573('0xa')](_0x267694,_0x4f022e)[_0x2573('0xb')](function(_0x3fb5b2){logger[_0x2573('0xc')](_0x2573('0xd'),_0x2b29f9,'request\x20sent');logger[_0x2573('0xe')](_0x2573('0xf'),_0x2b29f9,_0x2573('0x10'),JSON['stringify'](_0x3fb5b2));if(_0x3fb5b2[_0x2573('0x11')]){if(_0x3fb5b2[_0x2573('0x11')][_0x2573('0x12')]===0x1f4){logger[_0x2573('0x11')](_0x2573('0xd'),_0x2b29f9,_0x3fb5b2['error'][_0x2573('0x13')]);return _0x528545(_0x3fb5b2[_0x2573('0x11')][_0x2573('0x13')]);}logger[_0x2573('0x11')](_0x2573('0xd'),_0x2b29f9,_0x3fb5b2[_0x2573('0x11')]['message']);return _0x3fe339(_0x3fb5b2[_0x2573('0x11')][_0x2573('0x13')]);}else{logger[_0x2573('0xc')](_0x2573('0xd'),_0x2b29f9,_0x2573('0x10'));_0x3fe339(_0x3fb5b2[_0x2573('0x14')][_0x2573('0x13')]);}})[_0x2573('0x15')](function(_0x329008){logger[_0x2573('0x11')](_0x2573('0xd'),_0x2b29f9,_0x329008);_0x528545(_0x329008);});});} \ No newline at end of file +var _0xac05=['message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','MailSubstatus,\x20%s,\x20%s'];(function(_0x528c5b,_0x124692){var _0x398f8b=function(_0x58084f){while(--_0x58084f){_0x528c5b['push'](_0x528c5b['shift']());}};_0x398f8b(++_0x124692);}(_0xac05,0x16a));var _0x5ac0=function(_0x30e264,_0x248502){_0x30e264=_0x30e264-0x0;var _0x34a1bd=_0xac05[_0x30e264];return _0x34a1bd;};'use strict';var _=require('lodash');var util=require(_0x5ac0('0x0'));var moment=require(_0x5ac0('0x1'));var BPromise=require(_0x5ac0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac0('0x3'));var db=require(_0x5ac0('0x4'))['db'];var utils=require(_0x5ac0('0x5'));var logger=require(_0x5ac0('0x6'))(_0x5ac0('0x7'));var config=require(_0x5ac0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5ac0('0x9')][_0x5ac0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x182007,_0x3e9c32,_0x211bc3){return new BPromise(function(_0x401102,_0x5e50d7){return client[_0x5ac0('0xb')](_0x182007,_0x211bc3)['then'](function(_0x3a8169){logger[_0x5ac0('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x3e9c32,_0x5ac0('0xd'));logger[_0x5ac0('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x3e9c32,'request\x20sent',JSON[_0x5ac0('0xf')](_0x3a8169));if(_0x3a8169['error']){if(_0x3a8169[_0x5ac0('0x10')]['code']===0x1f4){logger[_0x5ac0('0x10')](_0x5ac0('0x11'),_0x3e9c32,_0x3a8169[_0x5ac0('0x10')][_0x5ac0('0x12')]);return _0x5e50d7(_0x3a8169[_0x5ac0('0x10')][_0x5ac0('0x12')]);}logger[_0x5ac0('0x10')](_0x5ac0('0x11'),_0x3e9c32,_0x3a8169[_0x5ac0('0x10')][_0x5ac0('0x12')]);return _0x401102(_0x3a8169[_0x5ac0('0x10')][_0x5ac0('0x12')]);}else{logger[_0x5ac0('0xc')](_0x5ac0('0x11'),_0x3e9c32,_0x5ac0('0xd'));_0x401102(_0x3a8169[_0x5ac0('0x13')]['message']);}})['catch'](function(_0x27c460){logger[_0x5ac0('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x3e9c32,_0x27c460);_0x5e50d7(_0x27c460);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e71055e..081de2f 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 _0xdf55=['post','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x4c4981,_0x178530){var _0x2dc9c1=function(_0x15e2fb){while(--_0x15e2fb){_0x4c4981['push'](_0x4c4981['shift']());}};_0x2dc9c1(++_0x178530);}(_0xdf55,0x83));var _0x5df5=function(_0x17262f,_0x3c7ef2){_0x17262f=_0x17262f-0x0;var _0x28d050=_0xdf55[_0x17262f];return _0x28d050;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var auth=require(_0x5df5('0x4'));var interaction=require(_0x5df5('0x5'));var config=require(_0x5df5('0x6'));var controller=require('./mailTransferReport.controller');router[_0x5df5('0x7')]('/',auth[_0x5df5('0x8')](),controller[_0x5df5('0x9')]);router[_0x5df5('0x7')](_0x5df5('0xa'),auth[_0x5df5('0x8')](),controller[_0x5df5('0xb')]);router[_0x5df5('0x7')]('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0xc')]);router[_0x5df5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5df5('0xe')]('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0xf')]);router['delete']('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0x10')]);module[_0x5df5('0x11')]=router; \ No newline at end of file +var _0x6f47=['/:id','show','post','put','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x1f7cd9,_0x7ee7b7){var _0x1800af=function(_0x8b6425){while(--_0x8b6425){_0x1f7cd9['push'](_0x1f7cd9['shift']());}};_0x1800af(++_0x7ee7b7);}(_0x6f47,0xc7));var _0x76f4=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x6f47[_0x13ea00];return _0x1f7347;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var auth=require(_0x76f4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x76f4('0x4'));var controller=require(_0x76f4('0x5'));router[_0x76f4('0x6')]('/',auth[_0x76f4('0x7')](),controller['index']);router[_0x76f4('0x6')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller['describe']);router[_0x76f4('0x6')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xa')]);router[_0x76f4('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x76f4('0xc')](_0x76f4('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x76f4('0xd')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xe')]);module[_0x76f4('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 655248e..ecc3daf 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 _0x5bfa=['ENUM','agent','queue','DATE','moment','exports','STRING'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x5bfa,0x66));var _0xa5bf=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x5bfa[_0x5e3701];return _0x345dcf;};'use strict';var moment=require(_0xa5bf('0x0'));var Sequelize=require('sequelize');module[_0xa5bf('0x1')]={'uniqueid':{'type':Sequelize[_0xa5bf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa5bf('0x3')]('account',_0xa5bf('0x4'),_0xa5bf('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xa5bf('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xad5e=['ENUM','account','agent','queue','DATE','NOW','exports','STRING'];(function(_0x30004a,_0xfaa0f4){var _0x3285ac=function(_0x228964){while(--_0x228964){_0x30004a['push'](_0x30004a['shift']());}};_0x3285ac(++_0xfaa0f4);}(_0xad5e,0xc6));var _0xead5=function(_0x135c14,_0x41c790){_0x135c14=_0x135c14-0x0;var _0x19e640=_0xad5e[_0x135c14];return _0x19e640;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xead5('0x0')]={'uniqueid':{'type':Sequelize[_0xead5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xead5('0x2')](_0xead5('0x3'),_0xead5('0x4'),_0xead5('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xead5('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xead5('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index cdd8884..1aaf12f 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 _0x804c=['attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','MailTransferReport','rawAttributes','model','keys','dateStart','query','dateEnd','intersection'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x804c,0xb4));var _0xc804=function(_0x59575a,_0x3f1b2d){_0x59575a=_0x59575a-0x0;var _0x4a4046=_0x804c[_0x59575a];return _0x4a4046;};'use strict';var pdf=require(_0xc804('0x0'));var emlformat=require(_0xc804('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc804('0x2'));var jsonpatch=require(_0xc804('0x3'));var rp=require(_0xc804('0x4'));var moment=require(_0xc804('0x5'));var BPromise=require(_0xc804('0x6'));var Mustache=require(_0xc804('0x7'));var util=require(_0xc804('0x8'));var path=require(_0xc804('0x9'));var sox=require(_0xc804('0xa'));var csv=require('to-csv');var ejs=require(_0xc804('0xb'));var fs=require('fs');var _=require(_0xc804('0xc'));var squel=require(_0xc804('0xd'));var crypto=require(_0xc804('0xe'));var jsforce=require(_0xc804('0xf'));var deskjs=require(_0xc804('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc804('0x11'));var Redis=require(_0xc804('0x12'));var qs=require(_0xc804('0x13'));var logger=require(_0xc804('0x14'))(_0xc804('0x15'));var utils=require(_0xc804('0x16'));var config=require(_0xc804('0x17'));var db=require(_0xc804('0x18'))['db'];function respondWithStatusCode(_0x490c13,_0x22b87c){_0x22b87c=_0x22b87c||0xcc;return function(_0xda4524){if(_0xda4524){return _0x490c13[_0xc804('0x19')](_0x22b87c);}return _0x490c13[_0xc804('0x1a')](_0x22b87c)[_0xc804('0x1b')]();};}function respondWithResult(_0x13c7ab,_0x813642){_0x813642=_0x813642||0xc8;return function(_0x356f7d){if(_0x356f7d){return _0x13c7ab[_0xc804('0x1a')](_0x813642)[_0xc804('0x1c')](_0x356f7d);}};}function respondWithFilteredResult(_0x25eb61,_0x789e52){return function(_0x366a34){if(_0x366a34){var _0x45049f=_0x366a34[_0xc804('0x1d')],_0x2c28c7=_0x789e52['offset'],_0x1a4db3=_0x789e52['offset']+_0x789e52[_0xc804('0x1e')],_0x46383e;if(_0x1a4db3>=_0x45049f){_0x1a4db3=_0x45049f;_0x46383e=0xc8;}else{_0x46383e=0xce;}_0x25eb61[_0xc804('0x1a')](_0x46383e);return _0x25eb61[_0xc804('0x1f')](_0xc804('0x20'),_0x2c28c7+'-'+_0x1a4db3+'/'+_0x45049f)['json'](_0x366a34);}return null;};}function patchUpdates(_0x528fcd){return function(_0x166024){try{jsonpatch[_0xc804('0x21')](_0x166024,_0x528fcd,!![]);}catch(_0x3703ea){return BPromise[_0xc804('0x22')](_0x3703ea);}return _0x166024[_0xc804('0x23')]();};}function saveUpdates(_0x47cfaa,_0x3ba36b){return function(_0x16be01){if(_0x16be01){return _0x16be01[_0xc804('0x24')](_0x47cfaa)[_0xc804('0x25')](function(_0x519d88){return _0x519d88;});}return null;};}function removeEntity(_0x3b843b,_0x58e930){return function(_0x2ebfb4){if(_0x2ebfb4){return _0x2ebfb4[_0xc804('0x26')]()[_0xc804('0x25')](function(){_0x3b843b['status'](0xcc)[_0xc804('0x1b')]();});}};}function handleEntityNotFound(_0x4dfe6c,_0x114184){return function(_0x449233){if(!_0x449233){_0x4dfe6c[_0xc804('0x19')](0x194);}return _0x449233;};}function handleError(_0x538c90,_0x3d5990){_0x3d5990=_0x3d5990||0x1f4;return function(_0x2cbd6a){logger[_0xc804('0x27')](_0x2cbd6a[_0xc804('0x28')]);if(_0x2cbd6a[_0xc804('0x29')]){delete _0x2cbd6a[_0xc804('0x29')];}_0x538c90[_0xc804('0x1a')](_0x3d5990)['send'](_0x2cbd6a);};}exports[_0xc804('0x2a')]=function(_0x5400fb,_0x31272f){var _0x49dba7={},_0x1be085={},_0x534e00={'count':0x0,'rows':[]};var _0x44f726=db[_0xc804('0x2b')][_0xc804('0x2c')];_0x1be085[_0xc804('0x2d')]=_[_0xc804('0x2e')](_0x44f726);var _0x5e8c77={'dateStart':_0x5400fb['query'][_0xc804('0x2f')],'dateEnd':_0x5400fb[_0xc804('0x30')]['dateEnd']};delete _0x5400fb[_0xc804('0x30')][_0xc804('0x2f')];delete _0x5400fb[_0xc804('0x30')][_0xc804('0x31')];_0x1be085['query']=_[_0xc804('0x2e')](_0x5400fb[_0xc804('0x30')]);_0x1be085['filters']=_[_0xc804('0x32')](_0x1be085[_0xc804('0x2d')],_0x1be085[_0xc804('0x30')]);_0x49dba7[_0xc804('0x33')]=_[_0xc804('0x32')](_0x1be085[_0xc804('0x2d')],qs[_0xc804('0x34')](_0x5400fb[_0xc804('0x30')]['fields']));_0x49dba7[_0xc804('0x33')]=_0x49dba7[_0xc804('0x33')][_0xc804('0x35')]?_0x49dba7[_0xc804('0x33')]:_0x1be085[_0xc804('0x2d')];if(!_0x5400fb[_0xc804('0x30')][_0xc804('0x36')](_0xc804('0x37'))){_0x49dba7['limit']=qs[_0xc804('0x1e')](_0x5400fb['query'][_0xc804('0x1e')]);_0x49dba7[_0xc804('0x38')]=qs[_0xc804('0x38')](_0x5400fb[_0xc804('0x30')][_0xc804('0x38')]);}_0x49dba7['order']=qs['sort'](_0x5400fb[_0xc804('0x30')][_0xc804('0x39')]);_0x49dba7[_0xc804('0x3a')]=qs[_0xc804('0x3b')](_['pick'](_0x5400fb[_0xc804('0x30')],_0x1be085[_0xc804('0x3b')]));if(_0x5e8c77[_0xc804('0x2f')]){if(_0x5e8c77[_0xc804('0x31')]){_0x5e8c77[_0xc804('0x31')]=moment(_0x5e8c77[_0xc804('0x31')])[_0xc804('0x3c')](0x1,'day');}else{_0x5e8c77[_0xc804('0x31')]=moment(_0x5e8c77[_0xc804('0x2f')])[_0xc804('0x3c')](0x1,_0xc804('0x3d'));}_[_0xc804('0x3e')](_0x49dba7[_0xc804('0x3a')],{'createdAt':{'$gte':_0x5e8c77['dateStart'],'$lte':_0x5e8c77[_0xc804('0x31')]}});}if(_0x5400fb[_0xc804('0x30')][_0xc804('0x3f')]){_0x49dba7[_0xc804('0x3a')]=_[_0xc804('0x3e')](_0x49dba7[_0xc804('0x3a')],{'$or':_[_0xc804('0x40')](_0x49dba7['attributes'],function(_0x432152){var _0x406d62={};_0x406d62[_0x432152]={'$like':'%'+_0x5400fb[_0xc804('0x30')]['filter']+'%'};return _0x406d62;})});}_0x49dba7=_[_0xc804('0x3e')]({},_0x49dba7,_0x5400fb[_0xc804('0x41')]);var _0x31a540={'where':_0x49dba7[_0xc804('0x3a')]};return db[_0xc804('0x2b')][_0xc804('0x1d')](_0x31a540)[_0xc804('0x25')](function(_0x2c06cd){_0x534e00[_0xc804('0x1d')]=_0x2c06cd;if(_0x5400fb[_0xc804('0x30')][_0xc804('0x42')]){_0x49dba7[_0xc804('0x43')]=[{'all':!![]}];}return db['MailTransferReport'][_0xc804('0x44')](_0x49dba7);})['then'](function(_0xda9ac3){_0x534e00[_0xc804('0x45')]=_0xda9ac3;return _0x534e00;})[_0xc804('0x25')](respondWithFilteredResult(_0x31272f,_0x49dba7))['catch'](handleError(_0x31272f,null));};exports[_0xc804('0x46')]=function(_0x3903ab,_0xd67cd4){var _0x49a584={'raw':!![],'where':{'id':_0x3903ab['params']['id']}},_0x32170f={};_0x32170f[_0xc804('0x2d')]=_[_0xc804('0x2e')](db[_0xc804('0x2b')][_0xc804('0x2c')]);_0x32170f['query']=_[_0xc804('0x2e')](_0x3903ab[_0xc804('0x30')]);_0x32170f['filters']=_[_0xc804('0x32')](_0x32170f[_0xc804('0x2d')],_0x32170f[_0xc804('0x30')]);_0x49a584[_0xc804('0x33')]=_[_0xc804('0x32')](_0x32170f[_0xc804('0x2d')],qs[_0xc804('0x34')](_0x3903ab[_0xc804('0x30')][_0xc804('0x34')]));_0x49a584[_0xc804('0x33')]=_0x49a584['attributes'][_0xc804('0x35')]?_0x49a584[_0xc804('0x33')]:_0x32170f[_0xc804('0x2d')];if(_0x3903ab[_0xc804('0x30')][_0xc804('0x42')]){_0x49a584[_0xc804('0x43')]=[{'all':!![]}];}_0x49a584=_[_0xc804('0x3e')]({},_0x49a584,_0x3903ab['options']);return db[_0xc804('0x2b')][_0xc804('0x47')](_0x49a584)['then'](handleEntityNotFound(_0xd67cd4,null))[_0xc804('0x25')](respondWithResult(_0xd67cd4,null))[_0xc804('0x48')](handleError(_0xd67cd4,null));};exports[_0xc804('0x49')]=function(_0x4fe3cf,_0x3fb6c8){return db[_0xc804('0x2b')][_0xc804('0x49')](_0x4fe3cf[_0xc804('0x4a')],{})['then'](respondWithResult(_0x3fb6c8,0xc9))[_0xc804('0x48')](handleError(_0x3fb6c8,null));};exports[_0xc804('0x24')]=function(_0xfba036,_0x3ef88f){if(_0xfba036[_0xc804('0x4a')]['id']){delete _0xfba036[_0xc804('0x4a')]['id'];}return db['MailTransferReport'][_0xc804('0x47')]({'where':{'id':_0xfba036[_0xc804('0x4b')]['id']}})[_0xc804('0x25')](handleEntityNotFound(_0x3ef88f,null))[_0xc804('0x25')](saveUpdates(_0xfba036[_0xc804('0x4a')],null))['then'](respondWithResult(_0x3ef88f,null))[_0xc804('0x48')](handleError(_0x3ef88f,null));};exports['destroy']=function(_0x1cdf34,_0x58eeac){return db[_0xc804('0x2b')][_0xc804('0x47')]({'where':{'id':_0x1cdf34[_0xc804('0x4b')]['id']}})[_0xc804('0x25')](handleEntityNotFound(_0x58eeac,null))[_0xc804('0x25')](removeEntity(_0x58eeac,null))[_0xc804('0x48')](handleError(_0x58eeac,null));};exports[_0xc804('0x4c')]=function(_0x3c10ae,_0x2eb6f9){return db[_0xc804('0x2b')]['describe']()[_0xc804('0x25')](respondWithResult(_0x2eb6f9,null))[_0xc804('0x48')](handleError(_0x2eb6f9,null));}; \ No newline at end of file +var _0x4a28=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','model','dateStart','query','dateEnd','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','add','day','where','filter','merge','map','MailTransferReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../config/logger','api'];(function(_0x39c964,_0x1ef640){var _0x3fe69c=function(_0x1c8fea){while(--_0x1c8fea){_0x39c964['push'](_0x39c964['shift']());}};_0x3fe69c(++_0x1ef640);}(_0x4a28,0x80));var _0x84a2=function(_0x2683b9,_0xd7fe2b){_0x2683b9=_0x2683b9-0x0;var _0x12e80b=_0x4a28[_0x2683b9];return _0x12e80b;};'use strict';var pdf=require(_0x84a2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x84a2('0x1'));var zipdir=require(_0x84a2('0x2'));var jsonpatch=require(_0x84a2('0x3'));var rp=require(_0x84a2('0x4'));var moment=require(_0x84a2('0x5'));var BPromise=require(_0x84a2('0x6'));var Mustache=require(_0x84a2('0x7'));var util=require(_0x84a2('0x8'));var path=require(_0x84a2('0x9'));var sox=require(_0x84a2('0xa'));var csv=require(_0x84a2('0xb'));var ejs=require(_0x84a2('0xc'));var fs=require('fs');var _=require(_0x84a2('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x84a2('0xe'));var toCsv=require(_0x84a2('0xb'));var querystring=require(_0x84a2('0xf'));var Papa=require(_0x84a2('0x10'));var Redis=require(_0x84a2('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x84a2('0x12'))(_0x84a2('0x13'));var utils=require(_0x84a2('0x14'));var config=require(_0x84a2('0x15'));var db=require(_0x84a2('0x16'))['db'];function respondWithStatusCode(_0x1ed538,_0x5a4ccb){_0x5a4ccb=_0x5a4ccb||0xcc;return function(_0x4fb352){if(_0x4fb352){return _0x1ed538[_0x84a2('0x17')](_0x5a4ccb);}return _0x1ed538[_0x84a2('0x18')](_0x5a4ccb)[_0x84a2('0x19')]();};}function respondWithResult(_0x68b05b,_0x2d92ce){_0x2d92ce=_0x2d92ce||0xc8;return function(_0x1ee3d9){if(_0x1ee3d9){return _0x68b05b['status'](_0x2d92ce)['json'](_0x1ee3d9);}};}function respondWithFilteredResult(_0x2aa0d4,_0x421530){return function(_0x29db25){if(_0x29db25){var _0x505725=_0x29db25[_0x84a2('0x1a')],_0x1fdd8d=_0x421530[_0x84a2('0x1b')],_0x496a1a=_0x421530[_0x84a2('0x1b')]+_0x421530[_0x84a2('0x1c')],_0x5a5aca;if(_0x496a1a>=_0x505725){_0x496a1a=_0x505725;_0x5a5aca=0xc8;}else{_0x5a5aca=0xce;}_0x2aa0d4[_0x84a2('0x18')](_0x5a5aca);return _0x2aa0d4[_0x84a2('0x1d')](_0x84a2('0x1e'),_0x1fdd8d+'-'+_0x496a1a+'/'+_0x505725)[_0x84a2('0x1f')](_0x29db25);}return null;};}function patchUpdates(_0x3b9707){return function(_0x5ede9a){try{jsonpatch[_0x84a2('0x20')](_0x5ede9a,_0x3b9707,!![]);}catch(_0x44ed64){return BPromise[_0x84a2('0x21')](_0x44ed64);}return _0x5ede9a[_0x84a2('0x22')]();};}function saveUpdates(_0x5373cb,_0x35eb2c){return function(_0x22ed6e){if(_0x22ed6e){return _0x22ed6e[_0x84a2('0x23')](_0x5373cb)[_0x84a2('0x24')](function(_0x174bd2){return _0x174bd2;});}return null;};}function removeEntity(_0x352bc5,_0x123d08){return function(_0x99af35){if(_0x99af35){return _0x99af35[_0x84a2('0x25')]()[_0x84a2('0x24')](function(){_0x352bc5[_0x84a2('0x18')](0xcc)[_0x84a2('0x19')]();});}};}function handleEntityNotFound(_0x38089d,_0x19e6f9){return function(_0x168ec3){if(!_0x168ec3){_0x38089d[_0x84a2('0x17')](0x194);}return _0x168ec3;};}function handleError(_0x3c13b8,_0x33f562){_0x33f562=_0x33f562||0x1f4;return function(_0x426fe0){logger[_0x84a2('0x26')](_0x426fe0['stack']);if(_0x426fe0[_0x84a2('0x27')]){delete _0x426fe0[_0x84a2('0x27')];}_0x3c13b8[_0x84a2('0x18')](_0x33f562)[_0x84a2('0x28')](_0x426fe0);};}exports[_0x84a2('0x29')]=function(_0x34078b,_0xfc1bfd){var _0x5983ff={},_0x4d5415={},_0x1e2079={'count':0x0,'rows':[]};var _0x13dccc=db['MailTransferReport']['rawAttributes'];_0x4d5415[_0x84a2('0x2a')]=_['keys'](_0x13dccc);var _0x25f17c={'dateStart':_0x34078b['query'][_0x84a2('0x2b')],'dateEnd':_0x34078b[_0x84a2('0x2c')][_0x84a2('0x2d')]};delete _0x34078b[_0x84a2('0x2c')]['dateStart'];delete _0x34078b[_0x84a2('0x2c')]['dateEnd'];_0x4d5415['query']=_[_0x84a2('0x2e')](_0x34078b['query']);_0x4d5415['filters']=_[_0x84a2('0x2f')](_0x4d5415[_0x84a2('0x2a')],_0x4d5415[_0x84a2('0x2c')]);_0x5983ff[_0x84a2('0x30')]=_[_0x84a2('0x2f')](_0x4d5415[_0x84a2('0x2a')],qs[_0x84a2('0x31')](_0x34078b[_0x84a2('0x2c')]['fields']));_0x5983ff['attributes']=_0x5983ff[_0x84a2('0x30')]['length']?_0x5983ff[_0x84a2('0x30')]:_0x4d5415['model'];if(!_0x34078b[_0x84a2('0x2c')][_0x84a2('0x32')](_0x84a2('0x33'))){_0x5983ff[_0x84a2('0x1c')]=qs[_0x84a2('0x1c')](_0x34078b[_0x84a2('0x2c')][_0x84a2('0x1c')]);_0x5983ff[_0x84a2('0x1b')]=qs[_0x84a2('0x1b')](_0x34078b[_0x84a2('0x2c')][_0x84a2('0x1b')]);}_0x5983ff[_0x84a2('0x34')]=qs[_0x84a2('0x35')](_0x34078b['query'][_0x84a2('0x35')]);_0x5983ff['where']=qs[_0x84a2('0x36')](_['pick'](_0x34078b[_0x84a2('0x2c')],_0x4d5415[_0x84a2('0x36')]));if(_0x25f17c[_0x84a2('0x2b')]){if(_0x25f17c[_0x84a2('0x2d')]){_0x25f17c[_0x84a2('0x2d')]=moment(_0x25f17c['dateEnd'])[_0x84a2('0x37')](0x1,_0x84a2('0x38'));}else{_0x25f17c[_0x84a2('0x2d')]=moment(_0x25f17c[_0x84a2('0x2b')])[_0x84a2('0x37')](0x1,_0x84a2('0x38'));}_['merge'](_0x5983ff[_0x84a2('0x39')],{'createdAt':{'$gte':_0x25f17c[_0x84a2('0x2b')],'$lte':_0x25f17c[_0x84a2('0x2d')]}});}if(_0x34078b[_0x84a2('0x2c')][_0x84a2('0x3a')]){_0x5983ff[_0x84a2('0x39')]=_[_0x84a2('0x3b')](_0x5983ff['where'],{'$or':_[_0x84a2('0x3c')](_0x5983ff[_0x84a2('0x30')],function(_0x346725){var _0x3cc98f={};_0x3cc98f[_0x346725]={'$like':'%'+_0x34078b[_0x84a2('0x2c')]['filter']+'%'};return _0x3cc98f;})});}_0x5983ff=_[_0x84a2('0x3b')]({},_0x5983ff,_0x34078b['options']);var _0x5eee10={'where':_0x5983ff[_0x84a2('0x39')]};return db[_0x84a2('0x3d')][_0x84a2('0x1a')](_0x5eee10)[_0x84a2('0x24')](function(_0x5dd4ca){_0x1e2079[_0x84a2('0x1a')]=_0x5dd4ca;if(_0x34078b[_0x84a2('0x2c')][_0x84a2('0x3e')]){_0x5983ff[_0x84a2('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0x84a2('0x40')](_0x5983ff);})[_0x84a2('0x24')](function(_0xaedf8e){_0x1e2079[_0x84a2('0x41')]=_0xaedf8e;return _0x1e2079;})[_0x84a2('0x24')](respondWithFilteredResult(_0xfc1bfd,_0x5983ff))[_0x84a2('0x42')](handleError(_0xfc1bfd,null));};exports[_0x84a2('0x43')]=function(_0x1ba39c,_0x16c71f){var _0xbb450e={'raw':!![],'where':{'id':_0x1ba39c[_0x84a2('0x44')]['id']}},_0x20e8a9={};_0x20e8a9['model']=_[_0x84a2('0x2e')](db[_0x84a2('0x3d')]['rawAttributes']);_0x20e8a9[_0x84a2('0x2c')]=_[_0x84a2('0x2e')](_0x1ba39c[_0x84a2('0x2c')]);_0x20e8a9[_0x84a2('0x36')]=_[_0x84a2('0x2f')](_0x20e8a9[_0x84a2('0x2a')],_0x20e8a9[_0x84a2('0x2c')]);_0xbb450e['attributes']=_[_0x84a2('0x2f')](_0x20e8a9[_0x84a2('0x2a')],qs[_0x84a2('0x31')](_0x1ba39c['query'][_0x84a2('0x31')]));_0xbb450e[_0x84a2('0x30')]=_0xbb450e[_0x84a2('0x30')]['length']?_0xbb450e[_0x84a2('0x30')]:_0x20e8a9[_0x84a2('0x2a')];if(_0x1ba39c[_0x84a2('0x2c')][_0x84a2('0x3e')]){_0xbb450e[_0x84a2('0x3f')]=[{'all':!![]}];}_0xbb450e=_[_0x84a2('0x3b')]({},_0xbb450e,_0x1ba39c[_0x84a2('0x45')]);return db[_0x84a2('0x3d')][_0x84a2('0x46')](_0xbb450e)[_0x84a2('0x24')](handleEntityNotFound(_0x16c71f,null))['then'](respondWithResult(_0x16c71f,null))[_0x84a2('0x42')](handleError(_0x16c71f,null));};exports[_0x84a2('0x47')]=function(_0xedb601,_0x3e359){return db[_0x84a2('0x3d')]['create'](_0xedb601['body'],{})[_0x84a2('0x24')](respondWithResult(_0x3e359,0xc9))['catch'](handleError(_0x3e359,null));};exports[_0x84a2('0x23')]=function(_0x17e988,_0x4183df){if(_0x17e988[_0x84a2('0x48')]['id']){delete _0x17e988[_0x84a2('0x48')]['id'];}return db[_0x84a2('0x3d')][_0x84a2('0x46')]({'where':{'id':_0x17e988[_0x84a2('0x44')]['id']}})[_0x84a2('0x24')](handleEntityNotFound(_0x4183df,null))[_0x84a2('0x24')](saveUpdates(_0x17e988[_0x84a2('0x48')],null))[_0x84a2('0x24')](respondWithResult(_0x4183df,null))['catch'](handleError(_0x4183df,null));};exports['destroy']=function(_0x2ed98d,_0x4fc957){return db[_0x84a2('0x3d')][_0x84a2('0x46')]({'where':{'id':_0x2ed98d['params']['id']}})[_0x84a2('0x24')](handleEntityNotFound(_0x4fc957,null))['then'](removeEntity(_0x4fc957,null))[_0x84a2('0x42')](handleError(_0x4fc957,null));};exports['describe']=function(_0x5401c6,_0x346d67){return db[_0x84a2('0x3d')][_0x84a2('0x49')]()[_0x84a2('0x24')](respondWithResult(_0x346d67,null))[_0x84a2('0x42')](handleError(_0x346d67,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index cdd738c..1f338b1 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 _0xdb8d=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','MailTransferReport'];(function(_0x784f1,_0x2a7db6){var _0xb72e6e=function(_0x254e0d){while(--_0x254e0d){_0x784f1['push'](_0x784f1['shift']());}};_0xb72e6e(++_0x2a7db6);}(_0xdb8d,0x136));var _0xddb8=function(_0x34a958,_0x38d1dc){_0x34a958=_0x34a958-0x0;var _0x5968f4=_0xdb8d[_0x34a958];return _0x5968f4;};'use strict';var _=require(_0xddb8('0x0'));var util=require(_0xddb8('0x1'));var logger=require(_0xddb8('0x2'))(_0xddb8('0x3'));var moment=require(_0xddb8('0x4'));var BPromise=require(_0xddb8('0x5'));var rp=require(_0xddb8('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0xddb8('0x7')]=function(_0x4d1b99,_0xd7f5ed){return _0x4d1b99['define'](_0xddb8('0x8'),attributes,{'tableName':_0xddb8('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xddb8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x202a=['moment','bluebird','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','api'];(function(_0x146efd,_0x3755a9){var _0x21d392=function(_0x6833d7){while(--_0x6833d7){_0x146efd['push'](_0x146efd['shift']());}};_0x21d392(++_0x3755a9);}(_0x202a,0xf8));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa202('0x0'));var logger=require('../../config/logger')(_0xa202('0x1'));var moment=require(_0xa202('0x2'));var BPromise=require(_0xa202('0x3'));var rp=require('request-promise');var attributes=require(_0xa202('0x4'));module[_0xa202('0x5')]=function(_0xe54961,_0x4b2e02){return _0xe54961[_0xa202('0x6')](_0xa202('0x7'),attributes,{'tableName':_0xa202('0x8'),'paranoid':![],'indexes':[{'name':_0xa202('0x9'),'fields':[_0xa202('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7c162f5..2f4507c 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 _0xde18=['code','message','info','request\x20sent','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0xde18,0x10d));var _0x8de1=function(_0x32d9a0,_0x4ecca6){_0x32d9a0=_0x32d9a0-0x0;var _0x49cc29=_0xde18[_0x32d9a0];return _0x49cc29;};'use strict';var _=require(_0x8de1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8de1('0x1'));var rs=require(_0x8de1('0x2'));var fs=require('fs');var Redis=require(_0x8de1('0x3'));var db=require(_0x8de1('0x4'))['db'];var utils=require(_0x8de1('0x5'));var logger=require(_0x8de1('0x6'))(_0x8de1('0x7'));var config=require(_0x8de1('0x8'));var jayson=require(_0x8de1('0x9'));var client=jayson[_0x8de1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c9beb,_0x4fc639,_0x271e29){return new BPromise(function(_0x240fc2,_0x4062ea){return client[_0x8de1('0xb')](_0x1c9beb,_0x271e29)[_0x8de1('0xc')](function(_0xc1f90e){logger['info'](_0x8de1('0xd'),_0x4fc639,'request\x20sent');logger[_0x8de1('0xe')](_0x8de1('0xf'),_0x4fc639,'request\x20sent',JSON['stringify'](_0xc1f90e));if(_0xc1f90e['error']){if(_0xc1f90e[_0x8de1('0x10')][_0x8de1('0x11')]===0x1f4){logger[_0x8de1('0x10')](_0x8de1('0xd'),_0x4fc639,_0xc1f90e[_0x8de1('0x10')][_0x8de1('0x12')]);return _0x4062ea(_0xc1f90e['error'][_0x8de1('0x12')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x4fc639,_0xc1f90e['error'][_0x8de1('0x12')]);return _0x240fc2(_0xc1f90e[_0x8de1('0x10')][_0x8de1('0x12')]);}else{logger[_0x8de1('0x13')](_0x8de1('0xd'),_0x4fc639,_0x8de1('0x14'));_0x240fc2(_0xc1f90e['result'][_0x8de1('0x12')]);}})[_0x8de1('0x15')](function(_0x4cc419){logger[_0x8de1('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x4fc639,_0x4cc419);_0x4062ea(_0x4cc419);});});} \ No newline at end of file +var _0xed80=['then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0xa93c3d,_0x31ce10){var _0x21a8fa=function(_0x43e44e){while(--_0x43e44e){_0xa93c3d['push'](_0xa93c3d['shift']());}};_0x21a8fa(++_0x31ce10);}(_0xed80,0x137));var _0x0ed8=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xed80[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x0ed8('0x0'));var util=require(_0x0ed8('0x1'));var moment=require(_0x0ed8('0x2'));var BPromise=require(_0x0ed8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ed8('0x4'));var db=require(_0x0ed8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ed8('0x6'))('rpc');var config=require(_0x0ed8('0x7'));var jayson=require(_0x0ed8('0x8'));var client=jayson[_0x0ed8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53ae53,_0x665b7f,_0x94eaba){return new BPromise(function(_0x4dd06f,_0x5a65fc){return client[_0x0ed8('0xa')](_0x53ae53,_0x94eaba)[_0x0ed8('0xb')](function(_0x259835){logger[_0x0ed8('0xc')](_0x0ed8('0xd'),_0x665b7f,'request\x20sent');logger[_0x0ed8('0xe')](_0x0ed8('0xf'),_0x665b7f,_0x0ed8('0x10'),JSON[_0x0ed8('0x11')](_0x259835));if(_0x259835['error']){if(_0x259835[_0x0ed8('0x12')][_0x0ed8('0x13')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x665b7f,_0x259835[_0x0ed8('0x12')]['message']);return _0x5a65fc(_0x259835[_0x0ed8('0x12')]['message']);}logger[_0x0ed8('0x12')](_0x0ed8('0xd'),_0x665b7f,_0x259835[_0x0ed8('0x12')][_0x0ed8('0x14')]);return _0x4dd06f(_0x259835[_0x0ed8('0x12')][_0x0ed8('0x14')]);}else{logger[_0x0ed8('0xc')](_0x0ed8('0xd'),_0x665b7f,_0x0ed8('0x10'));_0x4dd06f(_0x259835[_0x0ed8('0x15')]['message']);}})[_0x0ed8('0x16')](function(_0xcc8e0b){logger[_0x0ed8('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x665b7f,_0xcc8e0b);_0x5a65fc(_0xcc8e0b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index b4171bc..ca76168 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 _0x4a64=['show','post','put','/:id','delete','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x21ce32,_0x2ccd1c){var _0xd6b087=function(_0x58e475){while(--_0x58e475){_0x21ce32['push'](_0x21ce32['shift']());}};_0xd6b087(++_0x2ccd1c);}(_0x4a64,0x92));var _0x44a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a64[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x44a6('0x0'));var path=require('path');var timeout=require(_0x44a6('0x1'));var express=require('express');var router=express[_0x44a6('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x44a6('0x3'));var config=require(_0x44a6('0x4'));var controller=require('./memberReport.controller');router[_0x44a6('0x5')]('/',auth[_0x44a6('0x6')](),controller['index']);router[_0x44a6('0x5')](_0x44a6('0x7'),auth[_0x44a6('0x6')](),controller['describe']);router['get']('/:id',auth[_0x44a6('0x6')](),controller[_0x44a6('0x8')]);router[_0x44a6('0x9')]('/',auth[_0x44a6('0x6')](),controller['create']);router[_0x44a6('0xa')](_0x44a6('0xb'),auth[_0x44a6('0x6')](),controller['update']);router[_0x44a6('0xc')](_0x44a6('0xb'),auth[_0x44a6('0x6')](),controller['destroy']);module[_0x44a6('0xd')]=router; \ No newline at end of file +var _0x6885=['index','/:id','show','post','create','put','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x5d52d4,_0x514a1f){var _0x38336d=function(_0x125e0c){while(--_0x125e0c){_0x5d52d4['push'](_0x5d52d4['shift']());}};_0x38336d(++_0x514a1f);}(_0x6885,0x142));var _0x5688=function(_0x3a1ffb,_0x290044){_0x3a1ffb=_0x3a1ffb-0x0;var _0x863a81=_0x6885[_0x3a1ffb];return _0x863a81;};'use strict';var multer=require(_0x5688('0x0'));var util=require(_0x5688('0x1'));var path=require('path');var timeout=require(_0x5688('0x2'));var express=require(_0x5688('0x3'));var router=express['Router']();var auth=require(_0x5688('0x4'));var interaction=require(_0x5688('0x5'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x5688('0x6')]('/',auth[_0x5688('0x7')](),controller[_0x5688('0x8')]);router[_0x5688('0x6')]('/describe',auth[_0x5688('0x7')](),controller['describe']);router[_0x5688('0x6')](_0x5688('0x9'),auth[_0x5688('0x7')](),controller[_0x5688('0xa')]);router[_0x5688('0xb')]('/',auth[_0x5688('0x7')](),controller[_0x5688('0xc')]);router[_0x5688('0xd')](_0x5688('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5688('0x9'),auth[_0x5688('0x7')](),controller[_0x5688('0xe')]);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 d0e1929..faa7df2 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 _0x4d12=['talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]'];(function(_0x3f51ab,_0x1652e8){var _0x36fbf0=function(_0x4ad5ae){while(--_0x4ad5ae){_0x3f51ab['push'](_0x3f51ab['shift']());}};_0x36fbf0(++_0x1652e8);}(_0x4d12,0x151));var _0x24d1=function(_0x15ab0d,_0x12e4b2){_0x15ab0d=_0x15ab0d-0x0;var _0x5ed23f=_0x4d12[_0x15ab0d];return _0x5ed23f;};'use strict';var Sequelize=require(_0x24d1('0x0'));var moment=require(_0x24d1('0x1'));module[_0x24d1('0x2')]={'channel':{'type':Sequelize[_0x24d1('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x24d1('0x4')},'duration':{'type':Sequelize[_0x24d1('0x5')]},'enterAt':{'type':Sequelize[_0x24d1('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x493644){var _0x110e47=moment(_0x493644);var _0x1ef64d=moment(this[_0x24d1('0x7')](_0x24d1('0x8')));var _0x124058=_0x110e47[_0x24d1('0x9')](_0x1ef64d,_0x24d1('0xa'));this[_0x24d1('0xb')]('exitAt',_0x493644);this['setDataValue'](_0x24d1('0xc'),_0x124058||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x24d1('0xd')},'data2':{'type':Sequelize[_0x24d1('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x24d1('0xe')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x24d1('0x3')],'comment':_0x24d1('0xf')},'role':{'type':Sequelize[_0x24d1('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7043=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x43c334,_0x3fffba){var _0x1a1adc=function(_0x47376f){while(--_0x47376f){_0x43c334['push'](_0x43c334['shift']());}};_0x1a1adc(++_0x3fffba);}(_0x7043,0xfc));var _0x3704=function(_0x587f5a,_0x4aafbf){_0x587f5a=_0x587f5a-0x0;var _0x3d58e5=_0x7043[_0x587f5a];return _0x3d58e5;};'use strict';var Sequelize=require(_0x3704('0x0'));var moment=require(_0x3704('0x1'));module[_0x3704('0x2')]={'channel':{'type':Sequelize[_0x3704('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3704('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x3704('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x3704('0x5')]},'enterAt':{'type':Sequelize[_0x3704('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x55332d){var _0x263f40=moment(_0x55332d);var _0x34e856=moment(this[_0x3704('0x7')](_0x3704('0x8')));var _0x16af4f=_0x263f40['diff'](_0x34e856,_0x3704('0x9'));this[_0x3704('0xa')]('exitAt',_0x55332d);this[_0x3704('0xa')]('duration',_0x16af4f||null);}},'data1':{'type':Sequelize[_0x3704('0x3')],'comment':_0x3704('0xb')},'data2':{'type':Sequelize[_0x3704('0x3')],'comment':_0x3704('0xc')},'data3':{'type':Sequelize[_0x3704('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x3704('0x3')],'comment':_0x3704('0xd')},'data5':{'type':Sequelize[_0x3704('0x3')],'comment':_0x3704('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x3704('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 4be117b..65fca81 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 _0x6bc0=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','MemberReport','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','add','day','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x5cceb9,_0x9b3765){var _0x4b6a52=function(_0x130a6a){while(--_0x130a6a){_0x5cceb9['push'](_0x5cceb9['shift']());}};_0x4b6a52(++_0x9b3765);}(_0x6bc0,0x19d));var _0x06bc=function(_0x5dcf61,_0x586e05){_0x5dcf61=_0x5dcf61-0x0;var _0x3c3ac2=_0x6bc0[_0x5dcf61];return _0x3c3ac2;};'use strict';var pdf=require(_0x06bc('0x0'));var emlformat=require(_0x06bc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x06bc('0x2'));var jsonpatch=require(_0x06bc('0x3'));var rp=require(_0x06bc('0x4'));var moment=require('moment');var BPromise=require(_0x06bc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x06bc('0x6'));var sox=require(_0x06bc('0x7'));var csv=require(_0x06bc('0x8'));var ejs=require(_0x06bc('0x9'));var fs=require('fs');var _=require(_0x06bc('0xa'));var squel=require(_0x06bc('0xb'));var crypto=require('crypto');var jsforce=require(_0x06bc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x06bc('0xd'));var Papa=require(_0x06bc('0xe'));var Redis=require(_0x06bc('0xf'));var qs=require(_0x06bc('0x10'));var logger=require(_0x06bc('0x11'))('api');var utils=require(_0x06bc('0x12'));var config=require(_0x06bc('0x13'));var db=require(_0x06bc('0x14'))['db'];function respondWithStatusCode(_0x13c0ad,_0x5da320){_0x5da320=_0x5da320||0xcc;return function(_0x40507e){if(_0x40507e){return _0x13c0ad[_0x06bc('0x15')](_0x5da320);}return _0x13c0ad[_0x06bc('0x16')](_0x5da320)['end']();};}function respondWithResult(_0x537816,_0x3f4230){_0x3f4230=_0x3f4230||0xc8;return function(_0x4d3faa){if(_0x4d3faa){return _0x537816['status'](_0x3f4230)[_0x06bc('0x17')](_0x4d3faa);}};}function respondWithFilteredResult(_0x295367,_0x1d423c){return function(_0x2ea21c){if(_0x2ea21c){var _0x42b416=_0x2ea21c[_0x06bc('0x18')],_0x34121a=_0x1d423c[_0x06bc('0x19')],_0x3c2e4e=_0x1d423c[_0x06bc('0x19')]+_0x1d423c['limit'],_0xf6f566;if(_0x3c2e4e>=_0x42b416){_0x3c2e4e=_0x42b416;_0xf6f566=0xc8;}else{_0xf6f566=0xce;}_0x295367[_0x06bc('0x16')](_0xf6f566);return _0x295367[_0x06bc('0x1a')](_0x06bc('0x1b'),_0x34121a+'-'+_0x3c2e4e+'/'+_0x42b416)[_0x06bc('0x17')](_0x2ea21c);}return null;};}function patchUpdates(_0x27ddb3){return function(_0x22e416){try{jsonpatch['apply'](_0x22e416,_0x27ddb3,!![]);}catch(_0x27117e){return BPromise[_0x06bc('0x1c')](_0x27117e);}return _0x22e416[_0x06bc('0x1d')]();};}function saveUpdates(_0x53f90d,_0x3ea8d9){return function(_0x15fb91){if(_0x15fb91){return _0x15fb91['update'](_0x53f90d)[_0x06bc('0x1e')](function(_0x15c570){return _0x15c570;});}return null;};}function removeEntity(_0x44b88f,_0x152356){return function(_0x45323f){if(_0x45323f){return _0x45323f[_0x06bc('0x1f')]()[_0x06bc('0x1e')](function(){_0x44b88f[_0x06bc('0x16')](0xcc)[_0x06bc('0x20')]();});}};}function handleEntityNotFound(_0x198ffc,_0x1278e5){return function(_0xa2207){if(!_0xa2207){_0x198ffc[_0x06bc('0x15')](0x194);}return _0xa2207;};}function handleError(_0x2fbf42,_0x3bb252){_0x3bb252=_0x3bb252||0x1f4;return function(_0x4b55d9){logger[_0x06bc('0x21')](_0x4b55d9[_0x06bc('0x22')]);if(_0x4b55d9[_0x06bc('0x23')]){delete _0x4b55d9[_0x06bc('0x23')];}_0x2fbf42[_0x06bc('0x16')](_0x3bb252)[_0x06bc('0x24')](_0x4b55d9);};}exports[_0x06bc('0x25')]=function(_0x21bc54,_0x172242){var _0x3dbedd={},_0x58a097={},_0x25f5f3={'count':0x0,'rows':[]};var _0x56cdcb=db[_0x06bc('0x26')]['rawAttributes'];_0x58a097[_0x06bc('0x27')]=_[_0x06bc('0x28')](_0x56cdcb);var _0x4cc957={'dateStart':_0x21bc54[_0x06bc('0x29')][_0x06bc('0x2a')],'dateEnd':_0x21bc54[_0x06bc('0x29')][_0x06bc('0x2b')]};delete _0x21bc54[_0x06bc('0x29')][_0x06bc('0x2a')];delete _0x21bc54[_0x06bc('0x29')][_0x06bc('0x2b')];_0x58a097[_0x06bc('0x29')]=_['keys'](_0x21bc54[_0x06bc('0x29')]);_0x58a097[_0x06bc('0x2c')]=_[_0x06bc('0x2d')](_0x58a097[_0x06bc('0x27')],_0x58a097['query']);_0x3dbedd[_0x06bc('0x2e')]=_['intersection'](_0x58a097['model'],qs[_0x06bc('0x2f')](_0x21bc54[_0x06bc('0x29')][_0x06bc('0x2f')]));_0x3dbedd[_0x06bc('0x2e')]=_0x3dbedd['attributes'][_0x06bc('0x30')]?_0x3dbedd[_0x06bc('0x2e')]:_0x58a097[_0x06bc('0x27')];if(!_0x21bc54['query'][_0x06bc('0x31')]('nolimit')){_0x3dbedd['limit']=qs[_0x06bc('0x32')](_0x21bc54[_0x06bc('0x29')][_0x06bc('0x32')]);_0x3dbedd[_0x06bc('0x19')]=qs[_0x06bc('0x19')](_0x21bc54[_0x06bc('0x29')]['offset']);}_0x3dbedd[_0x06bc('0x33')]=qs[_0x06bc('0x34')](_0x21bc54[_0x06bc('0x29')][_0x06bc('0x34')]);_0x3dbedd[_0x06bc('0x35')]=qs[_0x06bc('0x2c')](_['pick'](_0x21bc54[_0x06bc('0x29')],_0x58a097['filters']));if(_0x4cc957[_0x06bc('0x2a')]){if(_0x4cc957['dateEnd']){_0x4cc957[_0x06bc('0x2b')]=moment(_0x4cc957[_0x06bc('0x2b')])[_0x06bc('0x36')](0x1,_0x06bc('0x37'));}else{_0x4cc957['dateEnd']=moment(_0x4cc957[_0x06bc('0x2a')])['add'](0x1,_0x06bc('0x37'));}_[_0x06bc('0x38')](_0x3dbedd[_0x06bc('0x35')],{'createdAt':{'$gte':_0x4cc957['dateStart'],'$lte':_0x4cc957[_0x06bc('0x2b')]}});}if(_0x21bc54['query']['filter']){_0x3dbedd[_0x06bc('0x35')]=_[_0x06bc('0x38')](_0x3dbedd[_0x06bc('0x35')],{'$or':_[_0x06bc('0x39')](_0x3dbedd[_0x06bc('0x2e')],function(_0x15904d){var _0x45a26d={};_0x45a26d[_0x15904d]={'$like':'%'+_0x21bc54['query'][_0x06bc('0x3a')]+'%'};return _0x45a26d;})});}_0x3dbedd=_[_0x06bc('0x38')]({},_0x3dbedd,_0x21bc54[_0x06bc('0x3b')]);var _0x14515c={'where':_0x3dbedd['where']};return db['MemberReport'][_0x06bc('0x18')](_0x14515c)[_0x06bc('0x1e')](function(_0x532c34){_0x25f5f3['count']=_0x532c34;if(_0x21bc54[_0x06bc('0x29')][_0x06bc('0x3c')]){_0x3dbedd[_0x06bc('0x3d')]=[{'all':!![]}];}return db[_0x06bc('0x26')][_0x06bc('0x3e')](_0x3dbedd);})['then'](function(_0x89d7d4){_0x25f5f3[_0x06bc('0x3f')]=_0x89d7d4;return _0x25f5f3;})[_0x06bc('0x1e')](respondWithFilteredResult(_0x172242,_0x3dbedd))[_0x06bc('0x40')](handleError(_0x172242,null));};exports[_0x06bc('0x41')]=function(_0x575fc7,_0x878f06){var _0x284296={'raw':!![],'where':{'id':_0x575fc7[_0x06bc('0x42')]['id']}},_0x224020={};_0x224020[_0x06bc('0x27')]=_[_0x06bc('0x28')](db[_0x06bc('0x26')][_0x06bc('0x43')]);_0x224020[_0x06bc('0x29')]=_[_0x06bc('0x28')](_0x575fc7['query']);_0x224020[_0x06bc('0x2c')]=_['intersection'](_0x224020[_0x06bc('0x27')],_0x224020['query']);_0x284296[_0x06bc('0x2e')]=_[_0x06bc('0x2d')](_0x224020[_0x06bc('0x27')],qs['fields'](_0x575fc7[_0x06bc('0x29')][_0x06bc('0x2f')]));_0x284296['attributes']=_0x284296[_0x06bc('0x2e')][_0x06bc('0x30')]?_0x284296[_0x06bc('0x2e')]:_0x224020[_0x06bc('0x27')];if(_0x575fc7[_0x06bc('0x29')][_0x06bc('0x3c')]){_0x284296[_0x06bc('0x3d')]=[{'all':!![]}];}_0x284296=_[_0x06bc('0x38')]({},_0x284296,_0x575fc7[_0x06bc('0x3b')]);return db[_0x06bc('0x26')][_0x06bc('0x44')](_0x284296)['then'](handleEntityNotFound(_0x878f06,null))[_0x06bc('0x1e')](respondWithResult(_0x878f06,null))['catch'](handleError(_0x878f06,null));};exports[_0x06bc('0x45')]=function(_0x1ca59b,_0x51ee15){return db[_0x06bc('0x26')][_0x06bc('0x45')](_0x1ca59b[_0x06bc('0x46')],{})[_0x06bc('0x1e')](respondWithResult(_0x51ee15,0xc9))[_0x06bc('0x40')](handleError(_0x51ee15,null));};exports['update']=function(_0x53c523,_0x846cd1){if(_0x53c523[_0x06bc('0x46')]['id']){delete _0x53c523['body']['id'];}return db[_0x06bc('0x26')][_0x06bc('0x44')]({'where':{'id':_0x53c523[_0x06bc('0x42')]['id']}})['then'](handleEntityNotFound(_0x846cd1,null))[_0x06bc('0x1e')](saveUpdates(_0x53c523['body'],null))[_0x06bc('0x1e')](respondWithResult(_0x846cd1,null))[_0x06bc('0x40')](handleError(_0x846cd1,null));};exports['destroy']=function(_0x4269f3,_0x37ffaf){return db[_0x06bc('0x26')]['find']({'where':{'id':_0x4269f3[_0x06bc('0x42')]['id']}})[_0x06bc('0x1e')](handleEntityNotFound(_0x37ffaf,null))[_0x06bc('0x1e')](removeEntity(_0x37ffaf,null))[_0x06bc('0x40')](handleError(_0x37ffaf,null));};exports[_0x06bc('0x47')]=function(_0x2bf3c0,_0x4f6570){return db[_0x06bc('0x26')]['describe']()[_0x06bc('0x1e')](respondWithResult(_0x4f6570,null))[_0x06bc('0x40')](handleError(_0x4f6570,null));}; \ No newline at end of file +var _0xc3ff=['options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','then','destroy','sendStatus','error','stack','name','send','index','MemberReport','rawAttributes','model','keys','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','dateStart','add','day','merge','filter','where','map','includeAll','include','findAll','rows','catch','show','params'];(function(_0x5d5177,_0x24d3c8){var _0x195c11=function(_0x5e4f32){while(--_0x5e4f32){_0x5d5177['push'](_0x5d5177['shift']());}};_0x195c11(++_0x24d3c8);}(_0xc3ff,0xde));var _0xfc3f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc3ff[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc3f('0x0'));var rimraf=require(_0xfc3f('0x1'));var zipdir=require(_0xfc3f('0x2'));var jsonpatch=require(_0xfc3f('0x3'));var rp=require(_0xfc3f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfc3f('0x5'));var util=require(_0xfc3f('0x6'));var path=require(_0xfc3f('0x7'));var sox=require(_0xfc3f('0x8'));var csv=require(_0xfc3f('0x9'));var ejs=require(_0xfc3f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfc3f('0xb'));var crypto=require(_0xfc3f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfc3f('0x9'));var querystring=require(_0xfc3f('0xd'));var Papa=require(_0xfc3f('0xe'));var Redis=require(_0xfc3f('0xf'));var qs=require(_0xfc3f('0x10'));var logger=require(_0xfc3f('0x11'))(_0xfc3f('0x12'));var utils=require(_0xfc3f('0x13'));var config=require(_0xfc3f('0x14'));var db=require(_0xfc3f('0x15'))['db'];function respondWithStatusCode(_0x8522a3,_0x420825){_0x420825=_0x420825||0xcc;return function(_0x511340){if(_0x511340){return _0x8522a3['sendStatus'](_0x420825);}return _0x8522a3[_0xfc3f('0x16')](_0x420825)[_0xfc3f('0x17')]();};}function respondWithResult(_0x41029f,_0x510041){_0x510041=_0x510041||0xc8;return function(_0x529e76){if(_0x529e76){return _0x41029f[_0xfc3f('0x16')](_0x510041)[_0xfc3f('0x18')](_0x529e76);}};}function respondWithFilteredResult(_0x10b6be,_0x5a3d29){return function(_0x747761){if(_0x747761){var _0x296665=_0x747761[_0xfc3f('0x19')],_0x246c6f=_0x5a3d29[_0xfc3f('0x1a')],_0x992006=_0x5a3d29[_0xfc3f('0x1a')]+_0x5a3d29[_0xfc3f('0x1b')],_0x39b1d9;if(_0x992006>=_0x296665){_0x992006=_0x296665;_0x39b1d9=0xc8;}else{_0x39b1d9=0xce;}_0x10b6be[_0xfc3f('0x16')](_0x39b1d9);return _0x10b6be['set']('Content-Range',_0x246c6f+'-'+_0x992006+'/'+_0x296665)[_0xfc3f('0x18')](_0x747761);}return null;};}function patchUpdates(_0x5e6e38){return function(_0x2cee4a){try{jsonpatch[_0xfc3f('0x1c')](_0x2cee4a,_0x5e6e38,!![]);}catch(_0x1544d9){return BPromise['reject'](_0x1544d9);}return _0x2cee4a['save']();};}function saveUpdates(_0x3b46e8,_0x2ce775){return function(_0x4c5e31){if(_0x4c5e31){return _0x4c5e31['update'](_0x3b46e8)[_0xfc3f('0x1d')](function(_0x2e7cd6){return _0x2e7cd6;});}return null;};}function removeEntity(_0x16ac15,_0x590eb1){return function(_0x3dbcde){if(_0x3dbcde){return _0x3dbcde[_0xfc3f('0x1e')]()[_0xfc3f('0x1d')](function(){_0x16ac15['status'](0xcc)[_0xfc3f('0x17')]();});}};}function handleEntityNotFound(_0x490863,_0x88289f){return function(_0x48a858){if(!_0x48a858){_0x490863[_0xfc3f('0x1f')](0x194);}return _0x48a858;};}function handleError(_0x142b00,_0x2d1fe0){_0x2d1fe0=_0x2d1fe0||0x1f4;return function(_0x55a168){logger[_0xfc3f('0x20')](_0x55a168[_0xfc3f('0x21')]);if(_0x55a168['name']){delete _0x55a168[_0xfc3f('0x22')];}_0x142b00[_0xfc3f('0x16')](_0x2d1fe0)[_0xfc3f('0x23')](_0x55a168);};}exports[_0xfc3f('0x24')]=function(_0x3c9dbd,_0x22f31d){var _0x2b7658={},_0x7a49aa={},_0x547685={'count':0x0,'rows':[]};var _0x3d3366=db[_0xfc3f('0x25')][_0xfc3f('0x26')];_0x7a49aa[_0xfc3f('0x27')]=_[_0xfc3f('0x28')](_0x3d3366);var _0x55288f={'dateStart':_0x3c9dbd[_0xfc3f('0x29')]['dateStart'],'dateEnd':_0x3c9dbd[_0xfc3f('0x29')]['dateEnd']};delete _0x3c9dbd['query']['dateStart'];delete _0x3c9dbd['query'][_0xfc3f('0x2a')];_0x7a49aa[_0xfc3f('0x29')]=_[_0xfc3f('0x28')](_0x3c9dbd[_0xfc3f('0x29')]);_0x7a49aa[_0xfc3f('0x2b')]=_[_0xfc3f('0x2c')](_0x7a49aa['model'],_0x7a49aa[_0xfc3f('0x29')]);_0x2b7658[_0xfc3f('0x2d')]=_[_0xfc3f('0x2c')](_0x7a49aa['model'],qs['fields'](_0x3c9dbd['query'][_0xfc3f('0x2e')]));_0x2b7658[_0xfc3f('0x2d')]=_0x2b7658['attributes'][_0xfc3f('0x2f')]?_0x2b7658[_0xfc3f('0x2d')]:_0x7a49aa[_0xfc3f('0x27')];if(!_0x3c9dbd[_0xfc3f('0x29')][_0xfc3f('0x30')](_0xfc3f('0x31'))){_0x2b7658['limit']=qs['limit'](_0x3c9dbd['query'][_0xfc3f('0x1b')]);_0x2b7658[_0xfc3f('0x1a')]=qs[_0xfc3f('0x1a')](_0x3c9dbd[_0xfc3f('0x29')][_0xfc3f('0x1a')]);}_0x2b7658[_0xfc3f('0x32')]=qs['sort'](_0x3c9dbd[_0xfc3f('0x29')][_0xfc3f('0x33')]);_0x2b7658['where']=qs[_0xfc3f('0x2b')](_['pick'](_0x3c9dbd[_0xfc3f('0x29')],_0x7a49aa[_0xfc3f('0x2b')]));if(_0x55288f[_0xfc3f('0x34')]){if(_0x55288f[_0xfc3f('0x2a')]){_0x55288f[_0xfc3f('0x2a')]=moment(_0x55288f[_0xfc3f('0x2a')])[_0xfc3f('0x35')](0x1,'day');}else{_0x55288f[_0xfc3f('0x2a')]=moment(_0x55288f['dateStart'])[_0xfc3f('0x35')](0x1,_0xfc3f('0x36'));}_[_0xfc3f('0x37')](_0x2b7658['where'],{'createdAt':{'$gte':_0x55288f[_0xfc3f('0x34')],'$lte':_0x55288f[_0xfc3f('0x2a')]}});}if(_0x3c9dbd[_0xfc3f('0x29')][_0xfc3f('0x38')]){_0x2b7658[_0xfc3f('0x39')]=_[_0xfc3f('0x37')](_0x2b7658[_0xfc3f('0x39')],{'$or':_[_0xfc3f('0x3a')](_0x2b7658[_0xfc3f('0x2d')],function(_0x826e50){var _0x59197b={};_0x59197b[_0x826e50]={'$like':'%'+_0x3c9dbd[_0xfc3f('0x29')]['filter']+'%'};return _0x59197b;})});}_0x2b7658=_['merge']({},_0x2b7658,_0x3c9dbd['options']);var _0x44f216={'where':_0x2b7658['where']};return db['MemberReport'][_0xfc3f('0x19')](_0x44f216)['then'](function(_0x1666d1){_0x547685[_0xfc3f('0x19')]=_0x1666d1;if(_0x3c9dbd[_0xfc3f('0x29')][_0xfc3f('0x3b')]){_0x2b7658[_0xfc3f('0x3c')]=[{'all':!![]}];}return db[_0xfc3f('0x25')][_0xfc3f('0x3d')](_0x2b7658);})[_0xfc3f('0x1d')](function(_0x46cfed){_0x547685[_0xfc3f('0x3e')]=_0x46cfed;return _0x547685;})[_0xfc3f('0x1d')](respondWithFilteredResult(_0x22f31d,_0x2b7658))[_0xfc3f('0x3f')](handleError(_0x22f31d,null));};exports[_0xfc3f('0x40')]=function(_0x4dfdbb,_0x4c61f4){var _0x315d79={'raw':!![],'where':{'id':_0x4dfdbb[_0xfc3f('0x41')]['id']}},_0xda7b79={};_0xda7b79[_0xfc3f('0x27')]=_['keys'](db[_0xfc3f('0x25')][_0xfc3f('0x26')]);_0xda7b79['query']=_[_0xfc3f('0x28')](_0x4dfdbb[_0xfc3f('0x29')]);_0xda7b79[_0xfc3f('0x2b')]=_[_0xfc3f('0x2c')](_0xda7b79[_0xfc3f('0x27')],_0xda7b79[_0xfc3f('0x29')]);_0x315d79[_0xfc3f('0x2d')]=_[_0xfc3f('0x2c')](_0xda7b79[_0xfc3f('0x27')],qs[_0xfc3f('0x2e')](_0x4dfdbb[_0xfc3f('0x29')]['fields']));_0x315d79['attributes']=_0x315d79[_0xfc3f('0x2d')][_0xfc3f('0x2f')]?_0x315d79[_0xfc3f('0x2d')]:_0xda7b79[_0xfc3f('0x27')];if(_0x4dfdbb[_0xfc3f('0x29')][_0xfc3f('0x3b')]){_0x315d79[_0xfc3f('0x3c')]=[{'all':!![]}];}_0x315d79=_[_0xfc3f('0x37')]({},_0x315d79,_0x4dfdbb[_0xfc3f('0x42')]);return db[_0xfc3f('0x25')][_0xfc3f('0x43')](_0x315d79)[_0xfc3f('0x1d')](handleEntityNotFound(_0x4c61f4,null))[_0xfc3f('0x1d')](respondWithResult(_0x4c61f4,null))[_0xfc3f('0x3f')](handleError(_0x4c61f4,null));};exports[_0xfc3f('0x44')]=function(_0x4835c5,_0x167d01){return db[_0xfc3f('0x25')]['create'](_0x4835c5[_0xfc3f('0x45')],{})[_0xfc3f('0x1d')](respondWithResult(_0x167d01,0xc9))[_0xfc3f('0x3f')](handleError(_0x167d01,null));};exports[_0xfc3f('0x46')]=function(_0x2a8094,_0x2dc58a){if(_0x2a8094[_0xfc3f('0x45')]['id']){delete _0x2a8094[_0xfc3f('0x45')]['id'];}return db[_0xfc3f('0x25')][_0xfc3f('0x43')]({'where':{'id':_0x2a8094[_0xfc3f('0x41')]['id']}})[_0xfc3f('0x1d')](handleEntityNotFound(_0x2dc58a,null))[_0xfc3f('0x1d')](saveUpdates(_0x2a8094[_0xfc3f('0x45')],null))[_0xfc3f('0x1d')](respondWithResult(_0x2dc58a,null))[_0xfc3f('0x3f')](handleError(_0x2dc58a,null));};exports[_0xfc3f('0x1e')]=function(_0x567e0d,_0x26f0c0){return db[_0xfc3f('0x25')][_0xfc3f('0x43')]({'where':{'id':_0x567e0d[_0xfc3f('0x41')]['id']}})['then'](handleEntityNotFound(_0x26f0c0,null))[_0xfc3f('0x1d')](removeEntity(_0x26f0c0,null))[_0xfc3f('0x3f')](handleError(_0x26f0c0,null));};exports[_0xfc3f('0x47')]=function(_0x3c61c7,_0x2aeea2){return db[_0xfc3f('0x25')][_0xfc3f('0x47')]()[_0xfc3f('0x1d')](respondWithResult(_0x2aeea2,null))[_0xfc3f('0x3f')](handleError(_0x2aeea2,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 88642d7..11c2df1 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 _0x7df6=['util','../../config/logger','api','bluebird','request-promise','define','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0x50dc60,_0x3095a1){var _0x59a04e=function(_0x16249b){while(--_0x16249b){_0x50dc60['push'](_0x50dc60['shift']());}};_0x59a04e(++_0x3095a1);}(_0x7df6,0xb3));var _0x67df=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0x7df6[_0x333714];return _0x4c211e;};'use strict';var _=require(_0x67df('0x0'));var util=require(_0x67df('0x1'));var logger=require(_0x67df('0x2'))(_0x67df('0x3'));var moment=require('moment');var BPromise=require(_0x67df('0x4'));var rp=require(_0x67df('0x5'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x4592bb,_0x24a75a){return _0x4592bb[_0x67df('0x6')](_0x67df('0x7'),attributes,{'tableName':_0x67df('0x8'),'paranoid':![],'indexes':[{'name':_0x67df('0x9'),'fields':[_0x67df('0xa'),_0x67df('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f17=['define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./memberReport.attributes','exports'];(function(_0x115e8f,_0x129f9b){var _0x1e7907=function(_0x13f584){while(--_0x13f584){_0x115e8f['push'](_0x115e8f['shift']());}};_0x1e7907(++_0x129f9b);}(_0x1f17,0x19b));var _0x71f1=function(_0x166e88,_0x1bae10){_0x166e88=_0x166e88-0x0;var _0x43ec68=_0x1f17[_0x166e88];return _0x43ec68;};'use strict';var _=require(_0x71f1('0x0'));var util=require(_0x71f1('0x1'));var logger=require(_0x71f1('0x2'))(_0x71f1('0x3'));var moment=require(_0x71f1('0x4'));var BPromise=require(_0x71f1('0x5'));var rp=require(_0x71f1('0x6'));var attributes=require(_0x71f1('0x7'));module[_0x71f1('0x8')]=function(_0x137408,_0x26c392){return _0x137408[_0x71f1('0x9')](_0x71f1('0xa'),attributes,{'tableName':_0x71f1('0xb'),'paranoid':![],'indexes':[{'name':_0x71f1('0xc'),'fields':[_0x71f1('0xd'),_0x71f1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7bc522e..d631eaa 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 _0x7885=['GetMemberReport','CreateMemberReport','create','body','UpdateMemberReport','MemberReport','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','map','include','model','info'];(function(_0x3edb98,_0x420e2a){var _0x26c208=function(_0x5bbee0){while(--_0x5bbee0){_0x3edb98['push'](_0x3edb98['shift']());}};_0x26c208(++_0x420e2a);}(_0x7885,0x1db));var _0x5788=function(_0x280d43,_0x5a7c7c){_0x280d43=_0x280d43-0x0;var _0x395f62=_0x7885[_0x280d43];return _0x395f62;};'use strict';var _=require(_0x5788('0x0'));var util=require('util');var moment=require(_0x5788('0x1'));var BPromise=require(_0x5788('0x2'));var rs=require(_0x5788('0x3'));var fs=require('fs');var Redis=require(_0x5788('0x4'));var db=require(_0x5788('0x5'))['db'];var utils=require(_0x5788('0x6'));var logger=require('../../config/logger')(_0x5788('0x7'));var config=require(_0x5788('0x8'));var jayson=require(_0x5788('0x9'));var client=jayson[_0x5788('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x397b07,_0x208bc6,_0x3f71bd){return new BPromise(function(_0x323fc6,_0x43540f){return client[_0x5788('0xb')](_0x397b07,_0x3f71bd)[_0x5788('0xc')](function(_0xcbf3c6){logger['info']('MemberReport,\x20%s,\x20%s',_0x208bc6,_0x5788('0xd'));logger[_0x5788('0xe')](_0x5788('0xf'),_0x208bc6,'request\x20sent',JSON[_0x5788('0x10')](_0xcbf3c6));if(_0xcbf3c6[_0x5788('0x11')]){if(_0xcbf3c6[_0x5788('0x11')][_0x5788('0x12')]===0x1f4){logger['error'](_0x5788('0x13'),_0x208bc6,_0xcbf3c6[_0x5788('0x11')][_0x5788('0x14')]);return _0x43540f(_0xcbf3c6[_0x5788('0x11')][_0x5788('0x14')]);}logger[_0x5788('0x11')](_0x5788('0x13'),_0x208bc6,_0xcbf3c6[_0x5788('0x11')][_0x5788('0x14')]);return _0x323fc6(_0xcbf3c6[_0x5788('0x11')][_0x5788('0x14')]);}else{logger['info'](_0x5788('0x13'),_0x208bc6,_0x5788('0xd'));_0x323fc6(_0xcbf3c6[_0x5788('0x15')][_0x5788('0x14')]);}})[_0x5788('0x16')](function(_0x88f453){logger[_0x5788('0x11')](_0x5788('0x13'),_0x208bc6,_0x88f453);_0x43540f(_0x88f453);});});}exports['GetMemberReport']=function(_0x48c55f){var _0x30c6e9=this;return new Promise(function(_0x20ee87,_0x267e3b){return db['MemberReport'][_0x5788('0x17')]({'raw':_0x48c55f[_0x5788('0x18')]?_0x48c55f['options'][_0x5788('0x19')]===undefined?!![]:![]:!![],'where':_0x48c55f[_0x5788('0x18')]?_0x48c55f[_0x5788('0x18')][_0x5788('0x1a')]||null:null,'attributes':_0x48c55f[_0x5788('0x18')]?_0x48c55f['options'][_0x5788('0x1b')]||null:null,'limit':_0x48c55f[_0x5788('0x18')]?_0x48c55f[_0x5788('0x18')]['limit']||null:null,'include':_0x48c55f['options']?_0x48c55f[_0x5788('0x18')]['include']?_[_0x5788('0x1c')](_0x48c55f[_0x5788('0x18')][_0x5788('0x1d')],function(_0x4c90fc){return{'model':db[_0x4c90fc[_0x5788('0x1e')]],'as':_0x4c90fc['as'],'attributes':_0x4c90fc[_0x5788('0x1b')],'include':_0x4c90fc[_0x5788('0x1d')]?_['map'](_0x4c90fc[_0x5788('0x1d')],function(_0x1fb0ce){return{'model':db[_0x1fb0ce[_0x5788('0x1e')]],'as':_0x1fb0ce['as'],'attributes':_0x1fb0ce[_0x5788('0x1b')],'include':_0x1fb0ce[_0x5788('0x1d')]?_[_0x5788('0x1c')](_0x1fb0ce[_0x5788('0x1d')],function(_0x4479d0){return{'model':db[_0x4479d0[_0x5788('0x1e')]],'as':_0x4479d0['as'],'attributes':_0x4479d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x5788('0xc')](function(_0x19fa6e){logger[_0x5788('0x1f')](_0x5788('0x20'),_0x48c55f);logger[_0x5788('0xe')](_0x5788('0x20'),_0x48c55f,JSON[_0x5788('0x10')](_0x19fa6e));_0x20ee87(_0x19fa6e);})[_0x5788('0x16')](function(_0x14f924){logger[_0x5788('0x11')]('GetMemberReport',_0x14f924['message'],_0x48c55f);_0x267e3b(_0x30c6e9[_0x5788('0x11')](0x1f4,_0x14f924[_0x5788('0x14')]));});});};exports[_0x5788('0x21')]=function(_0x551b55){var _0x2d1825=this;return new Promise(function(_0x5a3df3,_0x1c5ef0){return db['MemberReport'][_0x5788('0x22')](_0x551b55[_0x5788('0x23')],{'raw':_0x551b55[_0x5788('0x18')]?_0x551b55[_0x5788('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x54be0c){logger['info'](_0x5788('0x21'),_0x551b55);logger[_0x5788('0xe')](_0x5788('0x21'),_0x551b55,JSON[_0x5788('0x10')](_0x54be0c));_0x5a3df3(_0x54be0c);})[_0x5788('0x16')](function(_0x3a6a18){logger[_0x5788('0x11')](_0x5788('0x21'),_0x3a6a18[_0x5788('0x14')],_0x551b55);_0x1c5ef0(_0x2d1825['error'](0x1f4,_0x3a6a18['message']));});});};exports[_0x5788('0x24')]=function(_0x3b7e3b){var _0x2777bb=this;return new Promise(function(_0x256042,_0x70539c){return db[_0x5788('0x25')]['update'](_0x3b7e3b[_0x5788('0x23')],{'raw':_0x3b7e3b[_0x5788('0x18')]?_0x3b7e3b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b7e3b[_0x5788('0x18')]?_0x3b7e3b[_0x5788('0x18')][_0x5788('0x1a')]||null:null,'attributes':_0x3b7e3b[_0x5788('0x18')]?_0x3b7e3b['options']['attributes']||null:null,'limit':_0x3b7e3b['options']?_0x3b7e3b[_0x5788('0x18')][_0x5788('0x26')]||null:null})[_0x5788('0xc')](function(_0x2192c7){logger['info'](_0x5788('0x24'),_0x3b7e3b);logger[_0x5788('0xe')](_0x5788('0x24'),_0x3b7e3b,JSON[_0x5788('0x10')](_0x2192c7));_0x256042(_0x2192c7);})['catch'](function(_0x34a60f){logger['error'](_0x5788('0x24'),_0x34a60f[_0x5788('0x14')],_0x3b7e3b);_0x70539c(_0x2777bb[_0x5788('0x11')](0x1f4,_0x34a60f[_0x5788('0x14')]));});});}; \ No newline at end of file +var _0xbac8=['then','GetMemberReport','create','CreateMemberReport','UpdateMemberReport','body','lodash','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MemberReport','options','raw','where','attributes','limit','include','map','model'];(function(_0xb50cf4,_0x56076e){var _0x2291a6=function(_0x54b25b){while(--_0x54b25b){_0xb50cf4['push'](_0xb50cf4['shift']());}};_0x2291a6(++_0x56076e);}(_0xbac8,0x72));var _0x8bac=function(_0x3dd4da,_0x254082){_0x3dd4da=_0x3dd4da-0x0;var _0x17d48b=_0xbac8[_0x3dd4da];return _0x17d48b;};'use strict';var _=require(_0x8bac('0x0'));var util=require('util');var moment=require(_0x8bac('0x1'));var BPromise=require(_0x8bac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bac('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bac('0x4'))('rpc');var config=require(_0x8bac('0x5'));var jayson=require(_0x8bac('0x6'));var client=jayson[_0x8bac('0x7')][_0x8bac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5eeb19,_0x5f1f60,_0xae988e){return new BPromise(function(_0x18e722,_0x503688){return client[_0x8bac('0x9')](_0x5eeb19,_0xae988e)['then'](function(_0x5d13fb){logger['info'](_0x8bac('0xa'),_0x5f1f60,_0x8bac('0xb'));logger[_0x8bac('0xc')](_0x8bac('0xd'),_0x5f1f60,_0x8bac('0xb'),JSON[_0x8bac('0xe')](_0x5d13fb));if(_0x5d13fb[_0x8bac('0xf')]){if(_0x5d13fb[_0x8bac('0xf')][_0x8bac('0x10')]===0x1f4){logger[_0x8bac('0xf')]('MemberReport,\x20%s,\x20%s',_0x5f1f60,_0x5d13fb['error'][_0x8bac('0x11')]);return _0x503688(_0x5d13fb[_0x8bac('0xf')][_0x8bac('0x11')]);}logger[_0x8bac('0xf')]('MemberReport,\x20%s,\x20%s',_0x5f1f60,_0x5d13fb[_0x8bac('0xf')][_0x8bac('0x11')]);return _0x18e722(_0x5d13fb[_0x8bac('0xf')]['message']);}else{logger[_0x8bac('0x12')](_0x8bac('0xa'),_0x5f1f60,'request\x20sent');_0x18e722(_0x5d13fb[_0x8bac('0x13')][_0x8bac('0x11')]);}})[_0x8bac('0x14')](function(_0x509d7c){logger['error'](_0x8bac('0xa'),_0x5f1f60,_0x509d7c);_0x503688(_0x509d7c);});});}exports['GetMemberReport']=function(_0x42a168){var _0x581693=this;return new Promise(function(_0x4cd512,_0x2623ba){return db[_0x8bac('0x15')]['findAll']({'raw':_0x42a168[_0x8bac('0x16')]?_0x42a168[_0x8bac('0x16')][_0x8bac('0x17')]===undefined?!![]:![]:!![],'where':_0x42a168[_0x8bac('0x16')]?_0x42a168[_0x8bac('0x16')][_0x8bac('0x18')]||null:null,'attributes':_0x42a168[_0x8bac('0x16')]?_0x42a168['options'][_0x8bac('0x19')]||null:null,'limit':_0x42a168[_0x8bac('0x16')]?_0x42a168['options'][_0x8bac('0x1a')]||null:null,'include':_0x42a168['options']?_0x42a168[_0x8bac('0x16')][_0x8bac('0x1b')]?_[_0x8bac('0x1c')](_0x42a168['options']['include'],function(_0x10a498){return{'model':db[_0x10a498['model']],'as':_0x10a498['as'],'attributes':_0x10a498[_0x8bac('0x19')],'include':_0x10a498[_0x8bac('0x1b')]?_[_0x8bac('0x1c')](_0x10a498[_0x8bac('0x1b')],function(_0x122abf){return{'model':db[_0x122abf[_0x8bac('0x1d')]],'as':_0x122abf['as'],'attributes':_0x122abf['attributes'],'include':_0x122abf[_0x8bac('0x1b')]?_[_0x8bac('0x1c')](_0x122abf['include'],function(_0x157ddb){return{'model':db[_0x157ddb[_0x8bac('0x1d')]],'as':_0x157ddb['as'],'attributes':_0x157ddb[_0x8bac('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8bac('0x1e')](function(_0x216dfd){logger[_0x8bac('0x12')](_0x8bac('0x1f'),_0x42a168);logger[_0x8bac('0xc')]('GetMemberReport',_0x42a168,JSON[_0x8bac('0xe')](_0x216dfd));_0x4cd512(_0x216dfd);})[_0x8bac('0x14')](function(_0x597054){logger[_0x8bac('0xf')](_0x8bac('0x1f'),_0x597054[_0x8bac('0x11')],_0x42a168);_0x2623ba(_0x581693[_0x8bac('0xf')](0x1f4,_0x597054[_0x8bac('0x11')]));});});};exports['CreateMemberReport']=function(_0x45caaa){var _0x297b2d=this;return new Promise(function(_0x2b05c7,_0x337a9b){return db[_0x8bac('0x15')][_0x8bac('0x20')](_0x45caaa['body'],{'raw':_0x45caaa[_0x8bac('0x16')]?_0x45caaa[_0x8bac('0x16')][_0x8bac('0x17')]===undefined?!![]:![]:!![]})[_0x8bac('0x1e')](function(_0x31074a){logger[_0x8bac('0x12')](_0x8bac('0x21'),_0x45caaa);logger[_0x8bac('0xc')](_0x8bac('0x21'),_0x45caaa,JSON['stringify'](_0x31074a));_0x2b05c7(_0x31074a);})[_0x8bac('0x14')](function(_0x3daaef){logger['error'](_0x8bac('0x21'),_0x3daaef[_0x8bac('0x11')],_0x45caaa);_0x337a9b(_0x297b2d[_0x8bac('0xf')](0x1f4,_0x3daaef[_0x8bac('0x11')]));});});};exports[_0x8bac('0x22')]=function(_0x3183f5){var _0x41a64e=this;return new Promise(function(_0x7f0d38,_0x333e28){return db[_0x8bac('0x15')]['update'](_0x3183f5[_0x8bac('0x23')],{'raw':_0x3183f5[_0x8bac('0x16')]?_0x3183f5[_0x8bac('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3183f5[_0x8bac('0x16')]?_0x3183f5[_0x8bac('0x16')][_0x8bac('0x18')]||null:null,'attributes':_0x3183f5['options']?_0x3183f5[_0x8bac('0x16')][_0x8bac('0x19')]||null:null,'limit':_0x3183f5['options']?_0x3183f5['options'][_0x8bac('0x1a')]||null:null})[_0x8bac('0x1e')](function(_0x176711){logger[_0x8bac('0x12')]('UpdateMemberReport',_0x3183f5);logger[_0x8bac('0xc')](_0x8bac('0x22'),_0x3183f5,JSON['stringify'](_0x176711));_0x7f0d38(_0x176711);})['catch'](function(_0x979bb0){logger[_0x8bac('0xf')](_0x8bac('0x22'),_0x979bb0[_0x8bac('0x11')],_0x3183f5);_0x333e28(_0x41a64e['error'](0x1f4,_0x979bb0['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 539f280..619c099 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 _0xdc4e=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xdc4e,0x14f));var _0xedc4=function(_0x2dd8a0,_0x2a05af){_0x2dd8a0=_0x2dd8a0-0x0;var _0x201507=_0xdc4e[_0x2dd8a0];return _0x201507;};'use strict';var multer=require(_0xedc4('0x0'));var util=require('util');var path=require(_0xedc4('0x1'));var timeout=require(_0xedc4('0x2'));var express=require('express');var router=express[_0xedc4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xedc4('0x4'));var config=require(_0xedc4('0x5'));var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0xedc4('0x6')]=router; \ No newline at end of file +var _0xca35=['./migration.controller','get','index','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d40d5,_0x1ee7a0){var _0x28bdcb=function(_0x355f48){while(--_0x355f48){_0x1d40d5['push'](_0x1d40d5['shift']());}};_0x28bdcb(++_0x1ee7a0);}(_0xca35,0x193));var _0x5ca3=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xca35[_0x1b2422];return _0x376573;};'use strict';var multer=require(_0x5ca3('0x0'));var util=require('util');var path=require(_0x5ca3('0x1'));var timeout=require(_0x5ca3('0x2'));var express=require(_0x5ca3('0x3'));var router=express['Router']();var auth=require(_0x5ca3('0x4'));var interaction=require(_0x5ca3('0x5'));var config=require(_0x5ca3('0x6'));var controller=require(_0x5ca3('0x7'));router[_0x5ca3('0x8')]('/',controller[_0x5ca3('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 27b8aa7..9e91866 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 _0x8d84=['sequelize','exports'];(function(_0x2dbd12,_0x3eedd2){var _0x378a8=function(_0x3bc946){while(--_0x3bc946){_0x2dbd12['push'](_0x2dbd12['shift']());}};_0x378a8(++_0x3eedd2);}(_0x8d84,0x114));var _0x48d8=function(_0x3dcd05,_0x519bbe){_0x3dcd05=_0x3dcd05-0x0;var _0x237721=_0x8d84[_0x3dcd05];return _0x237721;};'use strict';var Sequelize=require(_0x48d8('0x0'));module[_0x48d8('0x1')]={'version':{'type':Sequelize['STRING'],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file +var _0x6a8a=['exports'];(function(_0x2f1f22,_0x3f43ae){var _0x4c49d7=function(_0x5e10e2){while(--_0x5e10e2){_0x2f1f22['push'](_0x2f1f22['shift']());}};_0x4c49d7(++_0x3f43ae);}(_0x6a8a,0x1e6));var _0xa6a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a8a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xa6a8('0x0')]={'version':{'type':Sequelize['STRING'],'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 077bb78..7f49930 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 _0xfc61=['squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','Migration','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','includeAll','include','rows','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','ejs','lodash'];(function(_0x3772a2,_0xd5e57d){var _0x3d1a63=function(_0x44eb28){while(--_0x44eb28){_0x3772a2['push'](_0x3772a2['shift']());}};_0x3d1a63(++_0xd5e57d);}(_0xfc61,0x78));var _0x1fc6=function(_0x55c536,_0x422419){_0x55c536=_0x55c536-0x0;var _0x8183a4=_0xfc61[_0x55c536];return _0x8183a4;};'use strict';var pdf=require(_0x1fc6('0x0'));var emlformat=require(_0x1fc6('0x1'));var rimraf=require(_0x1fc6('0x2'));var zipdir=require(_0x1fc6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1fc6('0x4'));var Mustache=require(_0x1fc6('0x5'));var util=require(_0x1fc6('0x6'));var path=require(_0x1fc6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1fc6('0x8'));var fs=require('fs');var _=require(_0x1fc6('0x9'));var squel=require(_0x1fc6('0xa'));var crypto=require(_0x1fc6('0xb'));var jsforce=require(_0x1fc6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1fc6('0xd'));var querystring=require(_0x1fc6('0xe'));var Papa=require(_0x1fc6('0xf'));var Redis=require(_0x1fc6('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x1fc6('0x11'))(_0x1fc6('0x12'));var utils=require('../../config/utils');var config=require(_0x1fc6('0x13'));var db=require(_0x1fc6('0x14'))['db'];function respondWithStatusCode(_0x2bc710,_0x251479){_0x251479=_0x251479||0xcc;return function(_0x573e4b){if(_0x573e4b){return _0x2bc710['sendStatus'](_0x251479);}return _0x2bc710[_0x1fc6('0x15')](_0x251479)[_0x1fc6('0x16')]();};}function respondWithResult(_0xa08740,_0x5e694d){_0x5e694d=_0x5e694d||0xc8;return function(_0x50e98e){if(_0x50e98e){return _0xa08740[_0x1fc6('0x15')](_0x5e694d)['json'](_0x50e98e);}};}function respondWithFilteredResult(_0x2833ef,_0x35ecb5){return function(_0x2e43f1){if(_0x2e43f1){var _0xe160d5=_0x2e43f1[_0x1fc6('0x17')],_0x2bcb91=_0x35ecb5['offset'],_0x624be2=_0x35ecb5[_0x1fc6('0x18')]+_0x35ecb5[_0x1fc6('0x19')],_0x324fa7;if(_0x624be2>=_0xe160d5){_0x624be2=_0xe160d5;_0x324fa7=0xc8;}else{_0x324fa7=0xce;}_0x2833ef[_0x1fc6('0x15')](_0x324fa7);return _0x2833ef[_0x1fc6('0x1a')](_0x1fc6('0x1b'),_0x2bcb91+'-'+_0x624be2+'/'+_0xe160d5)[_0x1fc6('0x1c')](_0x2e43f1);}return null;};}function patchUpdates(_0x3e9406){return function(_0x5f3b49){try{jsonpatch[_0x1fc6('0x1d')](_0x5f3b49,_0x3e9406,!![]);}catch(_0x318bb5){return BPromise[_0x1fc6('0x1e')](_0x318bb5);}return _0x5f3b49[_0x1fc6('0x1f')]();};}function saveUpdates(_0xbd94b,_0x376fd9){return function(_0x3fe3a8){if(_0x3fe3a8){return _0x3fe3a8['update'](_0xbd94b)['then'](function(_0x53b17d){return _0x53b17d;});}return null;};}function removeEntity(_0x37742e,_0x3ae4a3){return function(_0x514766){if(_0x514766){return _0x514766[_0x1fc6('0x20')]()[_0x1fc6('0x21')](function(){_0x37742e[_0x1fc6('0x15')](0xcc)[_0x1fc6('0x16')]();});}};}function handleEntityNotFound(_0xbd5b8,_0x421a6f){return function(_0x1209a4){if(!_0x1209a4){_0xbd5b8[_0x1fc6('0x22')](0x194);}return _0x1209a4;};}function handleError(_0x891eba,_0xc6965f){_0xc6965f=_0xc6965f||0x1f4;return function(_0x2465a4){logger[_0x1fc6('0x23')](_0x2465a4[_0x1fc6('0x24')]);if(_0x2465a4['name']){delete _0x2465a4[_0x1fc6('0x25')];}_0x891eba[_0x1fc6('0x15')](_0xc6965f)[_0x1fc6('0x26')](_0x2465a4);};}exports[_0x1fc6('0x27')]=function(_0x549d29,_0xac242c){var _0x42bd0d={},_0x3cb114={},_0x343b89={'count':0x0,'rows':[]};var _0x3de90e=db[_0x1fc6('0x28')][_0x1fc6('0x29')];_0x3cb114[_0x1fc6('0x2a')]=_[_0x1fc6('0x2b')](_0x3de90e);var _0x481c38={'dateStart':_0x549d29[_0x1fc6('0x2c')][_0x1fc6('0x2d')],'dateEnd':_0x549d29[_0x1fc6('0x2c')]['dateEnd']};delete _0x549d29[_0x1fc6('0x2c')][_0x1fc6('0x2d')];delete _0x549d29[_0x1fc6('0x2c')][_0x1fc6('0x2e')];_0x3cb114[_0x1fc6('0x2c')]=_[_0x1fc6('0x2b')](_0x549d29[_0x1fc6('0x2c')]);_0x3cb114[_0x1fc6('0x2f')]=_['intersection'](_0x3cb114[_0x1fc6('0x2a')],_0x3cb114[_0x1fc6('0x2c')]);_0x42bd0d[_0x1fc6('0x30')]=_[_0x1fc6('0x31')](_0x3cb114[_0x1fc6('0x2a')],qs[_0x1fc6('0x32')](_0x549d29[_0x1fc6('0x2c')]['fields']));_0x42bd0d[_0x1fc6('0x30')]=_0x42bd0d[_0x1fc6('0x30')][_0x1fc6('0x33')]?_0x42bd0d[_0x1fc6('0x30')]:_0x3cb114[_0x1fc6('0x2a')];if(!_0x549d29['query']['hasOwnProperty'](_0x1fc6('0x34'))){_0x42bd0d[_0x1fc6('0x19')]=qs[_0x1fc6('0x19')](_0x549d29[_0x1fc6('0x2c')]['limit']);_0x42bd0d[_0x1fc6('0x18')]=qs[_0x1fc6('0x18')](_0x549d29[_0x1fc6('0x2c')][_0x1fc6('0x18')]);}_0x42bd0d[_0x1fc6('0x35')]=qs['sort'](_0x549d29[_0x1fc6('0x2c')][_0x1fc6('0x36')]);_0x42bd0d[_0x1fc6('0x37')]=qs[_0x1fc6('0x2f')](_[_0x1fc6('0x38')](_0x549d29[_0x1fc6('0x2c')],_0x3cb114[_0x1fc6('0x2f')]));if(_0x481c38[_0x1fc6('0x2d')]){if(_0x481c38[_0x1fc6('0x2e')]){_0x481c38[_0x1fc6('0x2e')]=moment(_0x481c38[_0x1fc6('0x2e')])[_0x1fc6('0x39')](0x1,_0x1fc6('0x3a'));}else{_0x481c38[_0x1fc6('0x2e')]=moment(_0x481c38[_0x1fc6('0x2d')])[_0x1fc6('0x39')](0x1,_0x1fc6('0x3a'));}_[_0x1fc6('0x3b')](_0x42bd0d[_0x1fc6('0x37')],{'createdAt':{'$gte':_0x481c38['dateStart'],'$lte':_0x481c38[_0x1fc6('0x2e')]}});}if(_0x549d29[_0x1fc6('0x2c')][_0x1fc6('0x3c')]){_0x42bd0d[_0x1fc6('0x37')]=_['merge'](_0x42bd0d[_0x1fc6('0x37')],{'$or':_[_0x1fc6('0x3d')](_0x42bd0d[_0x1fc6('0x30')],function(_0x374b51){var _0x5cb94e={};_0x5cb94e[_0x374b51]={'$like':'%'+_0x549d29[_0x1fc6('0x2c')]['filter']+'%'};return _0x5cb94e;})});}_0x42bd0d=_[_0x1fc6('0x3b')]({},_0x42bd0d,_0x549d29['options']);var _0xee935e={'where':_0x42bd0d[_0x1fc6('0x37')]};return db[_0x1fc6('0x28')][_0x1fc6('0x17')](_0xee935e)[_0x1fc6('0x21')](function(_0x52e6bd){_0x343b89[_0x1fc6('0x17')]=_0x52e6bd;if(_0x549d29[_0x1fc6('0x2c')][_0x1fc6('0x3e')]){_0x42bd0d[_0x1fc6('0x3f')]=[{'all':!![]}];}return db[_0x1fc6('0x28')]['findAll'](_0x42bd0d);})[_0x1fc6('0x21')](function(_0x3e942d){_0x343b89[_0x1fc6('0x40')]=_0x3e942d;return _0x343b89;})[_0x1fc6('0x21')](respondWithFilteredResult(_0xac242c,_0x42bd0d))['catch'](handleError(_0xac242c,null));}; \ No newline at end of file +var _0xfecd=['map','Migration','include','findAll','then','rows','catch','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','sendStatus','error','stack','name','index','rawAttributes','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter'];(function(_0x13c174,_0xda25fe){var _0x160654=function(_0x1b6ac2){while(--_0x1b6ac2){_0x13c174['push'](_0x13c174['shift']());}};_0x160654(++_0xda25fe);}(_0xfecd,0x107));var _0xdfec=function(_0xe5f8e0,_0x3c6070){_0xe5f8e0=_0xe5f8e0-0x0;var _0x1058c3=_0xfecd[_0xe5f8e0];return _0x1058c3;};'use strict';var pdf=require(_0xdfec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdfec('0x1'));var zipdir=require(_0xdfec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfec('0x3'));var moment=require(_0xdfec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdfec('0x5'));var util=require('util');var path=require(_0xdfec('0x6'));var sox=require(_0xdfec('0x7'));var csv=require(_0xdfec('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdfec('0x9'));var squel=require(_0xdfec('0xa'));var crypto=require(_0xdfec('0xb'));var jsforce=require(_0xdfec('0xc'));var deskjs=require(_0xdfec('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfec('0xe'));var Papa=require(_0xdfec('0xf'));var Redis=require(_0xdfec('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xdfec('0x11'));var utils=require(_0xdfec('0x12'));var config=require('../../config/environment');var db=require(_0xdfec('0x13'))['db'];function respondWithStatusCode(_0x112dee,_0x4a0fef){_0x4a0fef=_0x4a0fef||0xcc;return function(_0x452860){if(_0x452860){return _0x112dee['sendStatus'](_0x4a0fef);}return _0x112dee[_0xdfec('0x14')](_0x4a0fef)[_0xdfec('0x15')]();};}function respondWithResult(_0x2384f5,_0x40bba3){_0x40bba3=_0x40bba3||0xc8;return function(_0x21f788){if(_0x21f788){return _0x2384f5[_0xdfec('0x14')](_0x40bba3)[_0xdfec('0x16')](_0x21f788);}};}function respondWithFilteredResult(_0x2ccc89,_0x4d7c6e){return function(_0x299e43){if(_0x299e43){var _0x1b904f=_0x299e43[_0xdfec('0x17')],_0x493d12=_0x4d7c6e[_0xdfec('0x18')],_0x420e3b=_0x4d7c6e[_0xdfec('0x18')]+_0x4d7c6e[_0xdfec('0x19')],_0x53ef23;if(_0x420e3b>=_0x1b904f){_0x420e3b=_0x1b904f;_0x53ef23=0xc8;}else{_0x53ef23=0xce;}_0x2ccc89['status'](_0x53ef23);return _0x2ccc89[_0xdfec('0x1a')](_0xdfec('0x1b'),_0x493d12+'-'+_0x420e3b+'/'+_0x1b904f)[_0xdfec('0x16')](_0x299e43);}return null;};}function patchUpdates(_0x144890){return function(_0x10c44c){try{jsonpatch['apply'](_0x10c44c,_0x144890,!![]);}catch(_0x4d3922){return BPromise[_0xdfec('0x1c')](_0x4d3922);}return _0x10c44c[_0xdfec('0x1d')]();};}function saveUpdates(_0x1d6def,_0x51aa7f){return function(_0x55c459){if(_0x55c459){return _0x55c459['update'](_0x1d6def)['then'](function(_0xce9faf){return _0xce9faf;});}return null;};}function removeEntity(_0x42858f,_0x577a69){return function(_0xfd3f31){if(_0xfd3f31){return _0xfd3f31[_0xdfec('0x1e')]()['then'](function(){_0x42858f[_0xdfec('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ede23,_0x1d8dd1){return function(_0x43d004){if(!_0x43d004){_0x2ede23[_0xdfec('0x1f')](0x194);}return _0x43d004;};}function handleError(_0x405aae,_0x3e29aa){_0x3e29aa=_0x3e29aa||0x1f4;return function(_0x412b26){logger[_0xdfec('0x20')](_0x412b26[_0xdfec('0x21')]);if(_0x412b26[_0xdfec('0x22')]){delete _0x412b26['name'];}_0x405aae[_0xdfec('0x14')](_0x3e29aa)['send'](_0x412b26);};}exports[_0xdfec('0x23')]=function(_0x21722a,_0x314f98){var _0x3b96f1={},_0xcf870a={},_0x13a2ad={'count':0x0,'rows':[]};var _0x4031ca=db['Migration'][_0xdfec('0x24')];_0xcf870a[_0xdfec('0x25')]=_['keys'](_0x4031ca);var _0x19a66a={'dateStart':_0x21722a['query']['dateStart'],'dateEnd':_0x21722a[_0xdfec('0x26')][_0xdfec('0x27')]};delete _0x21722a[_0xdfec('0x26')][_0xdfec('0x28')];delete _0x21722a[_0xdfec('0x26')][_0xdfec('0x27')];_0xcf870a[_0xdfec('0x26')]=_[_0xdfec('0x29')](_0x21722a[_0xdfec('0x26')]);_0xcf870a[_0xdfec('0x2a')]=_[_0xdfec('0x2b')](_0xcf870a[_0xdfec('0x25')],_0xcf870a['query']);_0x3b96f1[_0xdfec('0x2c')]=_[_0xdfec('0x2b')](_0xcf870a[_0xdfec('0x25')],qs[_0xdfec('0x2d')](_0x21722a[_0xdfec('0x26')][_0xdfec('0x2d')]));_0x3b96f1[_0xdfec('0x2c')]=_0x3b96f1[_0xdfec('0x2c')][_0xdfec('0x2e')]?_0x3b96f1['attributes']:_0xcf870a['model'];if(!_0x21722a[_0xdfec('0x26')][_0xdfec('0x2f')](_0xdfec('0x30'))){_0x3b96f1[_0xdfec('0x19')]=qs[_0xdfec('0x19')](_0x21722a[_0xdfec('0x26')]['limit']);_0x3b96f1['offset']=qs[_0xdfec('0x18')](_0x21722a[_0xdfec('0x26')][_0xdfec('0x18')]);}_0x3b96f1[_0xdfec('0x31')]=qs[_0xdfec('0x32')](_0x21722a[_0xdfec('0x26')][_0xdfec('0x32')]);_0x3b96f1[_0xdfec('0x33')]=qs[_0xdfec('0x2a')](_[_0xdfec('0x34')](_0x21722a[_0xdfec('0x26')],_0xcf870a['filters']));if(_0x19a66a[_0xdfec('0x28')]){if(_0x19a66a[_0xdfec('0x27')]){_0x19a66a[_0xdfec('0x27')]=moment(_0x19a66a['dateEnd'])[_0xdfec('0x35')](0x1,'day');}else{_0x19a66a[_0xdfec('0x27')]=moment(_0x19a66a[_0xdfec('0x28')])['add'](0x1,_0xdfec('0x36'));}_[_0xdfec('0x37')](_0x3b96f1[_0xdfec('0x33')],{'createdAt':{'$gte':_0x19a66a[_0xdfec('0x28')],'$lte':_0x19a66a[_0xdfec('0x27')]}});}if(_0x21722a[_0xdfec('0x26')][_0xdfec('0x38')]){_0x3b96f1[_0xdfec('0x33')]=_[_0xdfec('0x37')](_0x3b96f1[_0xdfec('0x33')],{'$or':_[_0xdfec('0x39')](_0x3b96f1[_0xdfec('0x2c')],function(_0x1301a3){var _0x534f8e={};_0x534f8e[_0x1301a3]={'$like':'%'+_0x21722a[_0xdfec('0x26')][_0xdfec('0x38')]+'%'};return _0x534f8e;})});}_0x3b96f1=_[_0xdfec('0x37')]({},_0x3b96f1,_0x21722a['options']);var _0x936257={'where':_0x3b96f1[_0xdfec('0x33')]};return db[_0xdfec('0x3a')]['count'](_0x936257)['then'](function(_0x17e656){_0x13a2ad[_0xdfec('0x17')]=_0x17e656;if(_0x21722a[_0xdfec('0x26')]['includeAll']){_0x3b96f1[_0xdfec('0x3b')]=[{'all':!![]}];}return db['Migration'][_0xdfec('0x3c')](_0x3b96f1);})[_0xdfec('0x3d')](function(_0x47dd3f){_0x13a2ad[_0xdfec('0x3e')]=_0x47dd3f;return _0x13a2ad;})[_0xdfec('0x3d')](respondWithFilteredResult(_0x314f98,_0x3b96f1))[_0xdfec('0x3f')](handleError(_0x314f98,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e7e2b6b..03d6e7a 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 _0xf5b6=['exports','migrations','../../config/logger','api','moment','bluebird','./migration.attributes'];(function(_0x7e1b6b,_0x4ad71d){var _0x2b086f=function(_0x5c24de){while(--_0x5c24de){_0x7e1b6b['push'](_0x7e1b6b['shift']());}};_0x2b086f(++_0x4ad71d);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x125135,_0x19736b){_0x125135=_0x125135-0x0;var _0x166e38=_0xf5b6[_0x125135];return _0x166e38;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f5b('0x0'))(_0x6f5b('0x1'));var moment=require(_0x6f5b('0x2'));var BPromise=require(_0x6f5b('0x3'));var rp=require('request-promise');var attributes=require(_0x6f5b('0x4'));module[_0x6f5b('0x5')]=function(_0x2dea52,_0x475ec4){return _0x2dea52['define']('Migration',attributes,{'tableName':_0x6f5b('0x6'),'paranoid':![],'indexes':[],'timestamps':![]});}; \ No newline at end of file +var _0x6faf=['moment','bluebird','request-promise','exports','Migration','migrations','util','../../config/logger','api'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6faf,0xf9));var _0xf6fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var logger=require(_0xf6fa('0x1'))(_0xf6fa('0x2'));var moment=require(_0xf6fa('0x3'));var BPromise=require(_0xf6fa('0x4'));var rp=require(_0xf6fa('0x5'));var attributes=require('./migration.attributes');module[_0xf6fa('0x6')]=function(_0x4c2fda,_0xed8c6b){return _0x4c2fda['define'](_0xf6fa('0x7'),attributes,{'tableName':_0xf6fa('0x8'),'paranoid':![],'indexes':[],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 8481c47..9787fe6 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 _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','Migration,\x20%s,\x20%s'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0xcca7,0x1aa));var _0x7cca=function(_0x927ac7,_0x2dfc73){_0x927ac7=_0x927ac7-0x0;var _0x3c742a=_0xcca7[_0x927ac7];return _0x3c742a;};'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')]('Migration,\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')]('Migration,\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 +var _0xf006=['code','message','result','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x68293d,_0x4f730a){var _0x25052d=function(_0x56df39){while(--_0x56df39){_0x68293d['push'](_0x68293d['shift']());}};_0x25052d(++_0x4f730a);}(_0xf006,0x146));var _0x6f00=function(_0x5d24a0,_0x112993){_0x5d24a0=_0x5d24a0-0x0;var _0x44e1f3=_0xf006[_0x5d24a0];return _0x44e1f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f00('0x0'));var BPromise=require(_0x6f00('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f00('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f00('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f00('0x4'));var jayson=require(_0x6f00('0x5'));var client=jayson[_0x6f00('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c29ff,_0x4f918f,_0x3875fb){return new BPromise(function(_0x3001b1,_0x185728){return client[_0x6f00('0x7')](_0x3c29ff,_0x3875fb)[_0x6f00('0x8')](function(_0x3001c6){logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));logger[_0x6f00('0xc')](_0x6f00('0xd'),_0x4f918f,_0x6f00('0xb'),JSON[_0x6f00('0xe')](_0x3001c6));if(_0x3001c6['error']){if(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x10')]===0x1f4){logger[_0x6f00('0xf')](_0x6f00('0xa'),_0x4f918f,_0x3001c6[_0x6f00('0xf')]['message']);return _0x185728(_0x3001c6[_0x6f00('0xf')]['message']);}logger[_0x6f00('0xf')]('Migration,\x20%s,\x20%s',_0x4f918f,_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);return _0x3001b1(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);}else{logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));_0x3001b1(_0x3001c6[_0x6f00('0x12')][_0x6f00('0x11')]);}})['catch'](function(_0x14b15d){logger['error']('Migration,\x20%s,\x20%s',_0x4f918f,_0x14b15d);_0x185728(_0x14b15d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 59a1917..627a146 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 _0xfa8d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x19f0d5,_0x11b2bc){var _0xb930b=function(_0x230e0a){while(--_0x230e0a){_0x19f0d5['push'](_0x19f0d5['shift']());}};_0xb930b(++_0x11b2bc);}(_0xfa8d,0x9d));var _0xdfa8=function(_0x34cc94,_0x4edddb){_0x34cc94=_0x34cc94-0x0;var _0x2dc1c2=_0xfa8d[_0x34cc94];return _0x2dc1c2;};'use strict';var multer=require(_0xdfa8('0x0'));var util=require(_0xdfa8('0x1'));var path=require(_0xdfa8('0x2'));var timeout=require(_0xdfa8('0x3'));var express=require(_0xdfa8('0x4'));var router=express[_0xdfa8('0x5')]();var auth=require(_0xdfa8('0x6'));var interaction=require(_0xdfa8('0x7'));var config=require(_0xdfa8('0x8'));var controller=require(_0xdfa8('0x9'));router[_0xdfa8('0xa')]('/',auth[_0xdfa8('0xb')](),controller[_0xdfa8('0xc')]);router['get'](_0xdfa8('0xd'),auth[_0xdfa8('0xb')](),controller[_0xdfa8('0xe')]);router['post']('/',auth[_0xdfa8('0xb')](),controller['create']);router['put'](_0xdfa8('0xd'),auth[_0xdfa8('0xb')](),controller[_0xdfa8('0xf')]);router[_0xdfa8('0x10')]('/:id',auth[_0xdfa8('0xb')](),controller[_0xdfa8('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe811=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./network.controller','get'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0xe811,0x1a8));var _0x1e81=function(_0x17f0ec,_0x738176){_0x17f0ec=_0x17f0ec-0x0;var _0x2867bd=_0xe811[_0x17f0ec];return _0x2867bd;};'use strict';var multer=require(_0x1e81('0x0'));var util=require(_0x1e81('0x1'));var path=require('path');var timeout=require(_0x1e81('0x2'));var express=require(_0x1e81('0x3'));var router=express['Router']();var auth=require(_0x1e81('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1e81('0x5'));var controller=require(_0x1e81('0x6'));router[_0x1e81('0x7')]('/',auth[_0x1e81('0x8')](),controller[_0x1e81('0x9')]);router[_0x1e81('0x7')](_0x1e81('0xa'),auth[_0x1e81('0x8')](),controller[_0x1e81('0xb')]);router[_0x1e81('0xc')]('/',auth[_0x1e81('0x8')](),controller[_0x1e81('0xd')]);router[_0x1e81('0xe')](_0x1e81('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1e81('0xf')]('/:id',auth[_0x1e81('0x8')](),controller[_0x1e81('0x10')]);module[_0x1e81('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 702874e..ecba49a 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 _0xd15b=['exports','ENUM','localnet','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd15b,0xa8));var _0xbd15=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd15b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xbd15('0x0')]={'type':{'type':Sequelize[_0xbd15('0x1')](_0xbd15('0x2'),'externip')},'value':{'type':Sequelize[_0xbd15('0x3')]}}; \ No newline at end of file +var _0xde01=['STRING','sequelize','exports','ENUM','localnet'];(function(_0x3512f1,_0x11630e){var _0x1267ef=function(_0x557001){while(--_0x557001){_0x3512f1['push'](_0x3512f1['shift']());}};_0x1267ef(++_0x11630e);}(_0xde01,0x187));var _0x1de0=function(_0x27f707,_0x444636){_0x27f707=_0x27f707-0x0;var _0x121701=_0xde01[_0x27f707];return _0x121701;};'use strict';var Sequelize=require(_0x1de0('0x0'));module[_0x1de0('0x1')]={'type':{'type':Sequelize[_0x1de0('0x2')](_0x1de0('0x3'),'externip')},'value':{'type':Sequelize[_0x1de0('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index d39e174..682a943 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 _0x8197=['destroy','stack','name','send','index','Network','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','add','day','merge','where','filter','map','includeAll','include','params','find','sequelize','create','body','type','readFileSync','join','root','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','transaction','utf8','writeFileSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x8197,0x1c0));var _0x7819=function(_0x4f24b5,_0x2e55f7){_0x4f24b5=_0x4f24b5-0x0;var _0x58ca9e=_0x8197[_0x4f24b5];return _0x58ca9e;};'use strict';var pdf=require(_0x7819('0x0'));var emlformat=require(_0x7819('0x1'));var rimraf=require(_0x7819('0x2'));var zipdir=require(_0x7819('0x3'));var jsonpatch=require(_0x7819('0x4'));var rp=require(_0x7819('0x5'));var moment=require(_0x7819('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7819('0x7'));var util=require(_0x7819('0x8'));var path=require(_0x7819('0x9'));var sox=require(_0x7819('0xa'));var csv=require(_0x7819('0xb'));var ejs=require(_0x7819('0xc'));var fs=require('fs');var _=require(_0x7819('0xd'));var squel=require(_0x7819('0xe'));var crypto=require(_0x7819('0xf'));var jsforce=require(_0x7819('0x10'));var deskjs=require(_0x7819('0x11'));var toCsv=require(_0x7819('0xb'));var querystring=require(_0x7819('0x12'));var Papa=require(_0x7819('0x13'));var Redis=require(_0x7819('0x14'));var qs=require(_0x7819('0x15'));var logger=require(_0x7819('0x16'))(_0x7819('0x17'));var utils=require(_0x7819('0x18'));var config=require(_0x7819('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7819('0x1a'));var client=jayson[_0x7819('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a8df,_0xcf4bb1,_0x200e76,_0x5e24a2){return new BPromise(function(_0x1bbadc,_0x424840){var _0x123c8a=_0x5e24a2||client;return _0x123c8a[_0x7819('0x1c')](_0x41a8df,_0x200e76)[_0x7819('0x1d')](function(_0x88a35){logger[_0x7819('0x1e')]('Network,\x20%s,\x20%s',_0xcf4bb1,_0x7819('0x1f'));logger[_0x7819('0x20')](_0x7819('0x21'),_0xcf4bb1,_0x7819('0x1f'),JSON['stringify'](_0x88a35));if(_0x88a35[_0x7819('0x22')]){if(_0x88a35[_0x7819('0x22')][_0x7819('0x23')]===0x1f4){logger[_0x7819('0x22')](_0x7819('0x24'),_0xcf4bb1,_0x88a35[_0x7819('0x22')]['message']);return _0x424840(_0x88a35[_0x7819('0x22')][_0x7819('0x25')]);}logger[_0x7819('0x22')](_0x7819('0x24'),_0xcf4bb1,_0x88a35['error'][_0x7819('0x25')]);return _0x1bbadc(_0x88a35[_0x7819('0x22')]['message']);}else{logger[_0x7819('0x1e')]('Network,\x20%s,\x20%s',_0xcf4bb1,_0x7819('0x1f'));_0x1bbadc(_0x88a35[_0x7819('0x26')][_0x7819('0x25')]);}})[_0x7819('0x27')](function(_0x5a3e54){logger['error'](_0x7819('0x24'),_0xcf4bb1,_0x5a3e54);_0x424840(_0x5a3e54);});});}function respondWithStatusCode(_0x566b40,_0x5f2c2a){_0x5f2c2a=_0x5f2c2a||0xcc;return function(_0x32d596){if(_0x32d596){return _0x566b40[_0x7819('0x28')](_0x5f2c2a);}return _0x566b40[_0x7819('0x29')](_0x5f2c2a)[_0x7819('0x2a')]();};}function respondWithResult(_0x10997b,_0xe9a9c3){_0xe9a9c3=_0xe9a9c3||0xc8;return function(_0x5a2d00){if(_0x5a2d00){return _0x10997b['status'](_0xe9a9c3)[_0x7819('0x2b')](_0x5a2d00);}};}function respondWithFilteredResult(_0x27600e,_0x2e88e2){return function(_0x3c469a){if(_0x3c469a){var _0x36233d=_0x3c469a[_0x7819('0x2c')],_0x9dfe75=_0x2e88e2[_0x7819('0x2d')],_0x1cc5ed=_0x2e88e2[_0x7819('0x2d')]+_0x2e88e2[_0x7819('0x2e')],_0x4a0c51;if(_0x1cc5ed>=_0x36233d){_0x1cc5ed=_0x36233d;_0x4a0c51=0xc8;}else{_0x4a0c51=0xce;}_0x27600e[_0x7819('0x29')](_0x4a0c51);return _0x27600e[_0x7819('0x2f')](_0x7819('0x30'),_0x9dfe75+'-'+_0x1cc5ed+'/'+_0x36233d)['json'](_0x3c469a);}return null;};}function patchUpdates(_0x92b3cc){return function(_0x35ca88){try{jsonpatch[_0x7819('0x31')](_0x35ca88,_0x92b3cc,!![]);}catch(_0x3478b8){return BPromise[_0x7819('0x32')](_0x3478b8);}return _0x35ca88['save']();};}function saveUpdates(_0x346d73,_0x2c0a38){return function(_0x74e67b){if(_0x74e67b){return _0x74e67b[_0x7819('0x33')](_0x346d73)[_0x7819('0x1d')](function(_0x5e0464){return _0x5e0464;});}return null;};}function removeEntity(_0x465666,_0x5cb118){return function(_0x2d8af8){if(_0x2d8af8){return _0x2d8af8[_0x7819('0x34')]()[_0x7819('0x1d')](function(){_0x465666[_0x7819('0x29')](0xcc)[_0x7819('0x2a')]();});}};}function handleEntityNotFound(_0x160b14,_0x2b4bbe){return function(_0x1215d9){if(!_0x1215d9){_0x160b14[_0x7819('0x28')](0x194);}return _0x1215d9;};}function handleError(_0x361c2c,_0x212352){_0x212352=_0x212352||0x1f4;return function(_0x4a96bf){logger[_0x7819('0x22')](_0x4a96bf[_0x7819('0x35')]);if(_0x4a96bf[_0x7819('0x36')]){delete _0x4a96bf[_0x7819('0x36')];}_0x361c2c[_0x7819('0x29')](_0x212352)[_0x7819('0x37')](_0x4a96bf);};}exports[_0x7819('0x38')]=function(_0x1227ca,_0x3b3499){var _0x33d32e={},_0x5d9cb1={},_0x565c1f={'count':0x0,'rows':[]};var _0x13a5d9=db[_0x7819('0x39')][_0x7819('0x3a')];_0x5d9cb1[_0x7819('0x3b')]=_[_0x7819('0x3c')](_0x13a5d9);var _0x55b023={'dateStart':_0x1227ca[_0x7819('0x3d')][_0x7819('0x3e')],'dateEnd':_0x1227ca[_0x7819('0x3d')]['dateEnd']};delete _0x1227ca[_0x7819('0x3d')][_0x7819('0x3e')];delete _0x1227ca['query'][_0x7819('0x3f')];_0x5d9cb1[_0x7819('0x3d')]=_['keys'](_0x1227ca[_0x7819('0x3d')]);_0x5d9cb1[_0x7819('0x40')]=_['intersection'](_0x5d9cb1[_0x7819('0x3b')],_0x5d9cb1[_0x7819('0x3d')]);_0x33d32e[_0x7819('0x41')]=_[_0x7819('0x42')](_0x5d9cb1['model'],qs['fields'](_0x1227ca[_0x7819('0x3d')][_0x7819('0x43')]));_0x33d32e[_0x7819('0x41')]=_0x33d32e['attributes'][_0x7819('0x44')]?_0x33d32e[_0x7819('0x41')]:_0x5d9cb1[_0x7819('0x3b')];if(!_0x1227ca[_0x7819('0x3d')][_0x7819('0x45')]('nolimit')){_0x33d32e[_0x7819('0x2e')]=qs['limit'](_0x1227ca[_0x7819('0x3d')][_0x7819('0x2e')]);_0x33d32e[_0x7819('0x2d')]=qs[_0x7819('0x2d')](_0x1227ca[_0x7819('0x3d')][_0x7819('0x2d')]);}_0x33d32e[_0x7819('0x46')]=qs[_0x7819('0x47')](_0x1227ca[_0x7819('0x3d')][_0x7819('0x47')]);_0x33d32e['where']=qs[_0x7819('0x40')](_[_0x7819('0x48')](_0x1227ca['query'],_0x5d9cb1[_0x7819('0x40')]));if(_0x55b023[_0x7819('0x3e')]){if(_0x55b023['dateEnd']){_0x55b023[_0x7819('0x3f')]=moment(_0x55b023[_0x7819('0x3f')])[_0x7819('0x49')](0x1,_0x7819('0x4a'));}else{_0x55b023[_0x7819('0x3f')]=moment(_0x55b023[_0x7819('0x3e')])[_0x7819('0x49')](0x1,'day');}_[_0x7819('0x4b')](_0x33d32e[_0x7819('0x4c')],{'createdAt':{'$gte':_0x55b023[_0x7819('0x3e')],'$lte':_0x55b023[_0x7819('0x3f')]}});}if(_0x1227ca[_0x7819('0x3d')][_0x7819('0x4d')]){_0x33d32e[_0x7819('0x4c')]=_[_0x7819('0x4b')](_0x33d32e['where'],{'$or':_[_0x7819('0x4e')](_0x33d32e[_0x7819('0x41')],function(_0x43a97a){var _0x4b86de={};_0x4b86de[_0x43a97a]={'$like':'%'+_0x1227ca[_0x7819('0x3d')]['filter']+'%'};return _0x4b86de;})});}_0x33d32e=_[_0x7819('0x4b')]({},_0x33d32e,_0x1227ca['options']);var _0x57a9f6={'where':_0x33d32e[_0x7819('0x4c')]};return db['Network'][_0x7819('0x2c')](_0x57a9f6)[_0x7819('0x1d')](function(_0x2932dc){_0x565c1f[_0x7819('0x2c')]=_0x2932dc;if(_0x1227ca[_0x7819('0x3d')][_0x7819('0x4f')]){_0x33d32e[_0x7819('0x50')]=[{'all':!![]}];}return db[_0x7819('0x39')]['findAll'](_0x33d32e);})[_0x7819('0x1d')](function(_0x537856){_0x565c1f['rows']=_0x537856;return _0x565c1f;})[_0x7819('0x1d')](respondWithFilteredResult(_0x3b3499,_0x33d32e))['catch'](handleError(_0x3b3499,null));};exports['show']=function(_0x3fb46f,_0x4a03f3){var _0x5b90b5={'raw':!![],'where':{'id':_0x3fb46f[_0x7819('0x51')]['id']}},_0x3ddcaa={};_0x3ddcaa['model']=_[_0x7819('0x3c')](db[_0x7819('0x39')][_0x7819('0x3a')]);_0x3ddcaa[_0x7819('0x3d')]=_[_0x7819('0x3c')](_0x3fb46f[_0x7819('0x3d')]);_0x3ddcaa[_0x7819('0x40')]=_[_0x7819('0x42')](_0x3ddcaa[_0x7819('0x3b')],_0x3ddcaa[_0x7819('0x3d')]);_0x5b90b5[_0x7819('0x41')]=_['intersection'](_0x3ddcaa[_0x7819('0x3b')],qs[_0x7819('0x43')](_0x3fb46f[_0x7819('0x3d')][_0x7819('0x43')]));_0x5b90b5[_0x7819('0x41')]=_0x5b90b5['attributes']['length']?_0x5b90b5[_0x7819('0x41')]:_0x3ddcaa[_0x7819('0x3b')];if(_0x3fb46f[_0x7819('0x3d')][_0x7819('0x4f')]){_0x5b90b5[_0x7819('0x50')]=[{'all':!![]}];}_0x5b90b5=_[_0x7819('0x4b')]({},_0x5b90b5,_0x3fb46f['options']);return db['Network'][_0x7819('0x52')](_0x5b90b5)[_0x7819('0x1d')](handleEntityNotFound(_0x4a03f3,null))[_0x7819('0x1d')](respondWithResult(_0x4a03f3,null))['catch'](handleError(_0x4a03f3,null));};exports['create']=function(_0xc3e469,_0x35acc9,_0x5b41c4){var _0x174688;return db[_0x7819('0x53')]['transaction'](function(_0x261362){return db['Network'][_0x7819('0x54')](_0xc3e469[_0x7819('0x55')],{'raw':!![]})[_0x7819('0x1d')](function(_0x28e3f1){_0x174688=_0x28e3f1;return db[_0x7819('0x39')]['findAll']({'where':{'type':_0xc3e469[_0x7819('0x55')][_0x7819('0x56')]},'raw':!![]});})['then'](function(_0x1ac916){var _0x543692=fs[_0x7819('0x57')](path[_0x7819('0x58')](config[_0x7819('0x59')],_0x7819('0x5a')),'utf8');var _0x269328=ejs[_0x7819('0x5b')](_0x543692,{'networks':_0x1ac916||[]});fs['writeFileSync'](util[_0x7819('0x5c')](_0x7819('0x5d'),_0xc3e469[_0x7819('0x55')][_0x7819('0x56')][_0x7819('0x5e')]()),_0x269328);})[_0x7819('0x1d')](function(){return respondWithRpcPromise(_0x7819('0x5f'),_0x7819('0x54'),{'module':_0x7819('0x60')});})[_0x7819('0x1d')](function(){return _0x174688;});})[_0x7819('0x1d')](respondWithResult(_0x35acc9,0xc9))['catch'](handleError(_0x35acc9,null));};exports[_0x7819('0x33')]=function(_0x2547be,_0x4015aa,_0x36b97a){var _0x29ca4c;return db[_0x7819('0x53')][_0x7819('0x61')](function(_0x5cf600){return db['Network'][_0x7819('0x52')]({'where':{'id':_0x2547be[_0x7819('0x51')]['id']}})[_0x7819('0x1d')](handleEntityNotFound(_0x4015aa,null))[_0x7819('0x1d')](saveUpdates(_0x2547be['body'],null))[_0x7819('0x1d')](function(_0x7813f5){if(_0x7813f5){_0x29ca4c=_0x7813f5;return db[_0x7819('0x39')]['findAll']({'where':{'type':_0x29ca4c['type']},'raw':!![]});}return null;})['then'](function(_0x3bc0b3){if(_0x3bc0b3){var _0x460d35=fs[_0x7819('0x57')](path['join'](config[_0x7819('0x59')],_0x7819('0x5a')),_0x7819('0x62'));var _0x20ced1=ejs[_0x7819('0x5b')](_0x460d35,{'networks':_0x3bc0b3||[]});fs['writeFileSync'](util[_0x7819('0x5c')](_0x7819('0x5d'),_0x29ca4c[_0x7819('0x56')][_0x7819('0x5e')]()),_0x20ced1);return respondWithRpcPromise('Reload',_0x7819('0x33'),{'module':_0x7819('0x60')});}return null;})[_0x7819('0x1d')](function(_0x4d8a69){if(_0x4d8a69){return _0x29ca4c;}return null;});})['then'](respondWithResult(_0x4015aa,null))['catch'](handleError(_0x4015aa,null));};exports[_0x7819('0x34')]=function(_0x4ed95b,_0xf55b8,_0x12549d){var _0x2b7ef0;return db[_0x7819('0x39')][_0x7819('0x52')]({'where':{'id':_0x4ed95b[_0x7819('0x51')]['id']}})['then'](function(_0x19229e){_0x2b7ef0=_0x19229e;return _0x19229e;})[_0x7819('0x1d')](handleEntityNotFound(_0xf55b8,null))[_0x7819('0x1d')](removeEntity(_0xf55b8,null))[_0x7819('0x1d')](function(){if(_0x2b7ef0){return db[_0x7819('0x39')]['findAll']({'where':{'type':_0x2b7ef0[_0x7819('0x56')]},'raw':!![]});}})[_0x7819('0x1d')](function(_0x4f50d1){if(_0x4f50d1){var _0x234cb4=fs[_0x7819('0x57')](path[_0x7819('0x58')](config[_0x7819('0x59')],_0x7819('0x5a')),_0x7819('0x62'));var _0x56e21d=ejs[_0x7819('0x5b')](_0x234cb4,{'networks':_0x4f50d1||[]});fs[_0x7819('0x63')](util[_0x7819('0x5c')](_0x7819('0x5d'),_0x2b7ef0['type'][_0x7819('0x5e')]()),_0x56e21d);return respondWithRpcPromise(_0x7819('0x5f'),_0x7819('0x34'),{'module':_0x7819('0x60')});}})[_0x7819('0x27')](handleError(_0xf55b8,null));}; \ No newline at end of file +var _0x757d=['sort','where','pick','add','day','merge','filter','map','options','Network','includeAll','findAll','show','include','find','create','body','type','readFileSync','join','server/files/templates/network.ejs','utf8','render','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','sequelize','transaction','params','root','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','query','dateStart','dateEnd','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x1de5e8,_0x20e744){var _0x5e1baf=function(_0x1c52a9){while(--_0x1c52a9){_0x1de5e8['push'](_0x1de5e8['shift']());}};_0x5e1baf(++_0x20e744);}(_0x757d,0x138));var _0xd757=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0x757d[_0x9b2bb0];return _0x2cdb3b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd757('0x0'));var zipdir=require(_0xd757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd757('0x2'));var Mustache=require(_0xd757('0x3'));var util=require(_0xd757('0x4'));var path=require(_0xd757('0x5'));var sox=require(_0xd757('0x6'));var csv=require(_0xd757('0x7'));var ejs=require(_0xd757('0x8'));var fs=require('fs');var _=require(_0xd757('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd757('0xa'));var deskjs=require(_0xd757('0xb'));var toCsv=require(_0xd757('0x7'));var querystring=require(_0xd757('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xd757('0xd'));var logger=require(_0xd757('0xe'))('api');var utils=require(_0xd757('0xf'));var config=require('../../config/environment');var db=require(_0xd757('0x10'))['db'];var jayson=require(_0xd757('0x11'));var client=jayson['client'][_0xd757('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x5a7749,_0x3038b6,_0x243d6b,_0x9fbcd){return new BPromise(function(_0x38d80e,_0x2ac3bb){var _0x2f495d=_0x9fbcd||client;return _0x2f495d[_0xd757('0x13')](_0x5a7749,_0x243d6b)[_0xd757('0x14')](function(_0xfb6487){logger[_0xd757('0x15')](_0xd757('0x16'),_0x3038b6,_0xd757('0x17'));logger[_0xd757('0x18')]('Network,\x20%s,\x20%s,\x20%s',_0x3038b6,_0xd757('0x17'),JSON[_0xd757('0x19')](_0xfb6487));if(_0xfb6487[_0xd757('0x1a')]){if(_0xfb6487['error']['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x3038b6,_0xfb6487[_0xd757('0x1a')][_0xd757('0x1b')]);return _0x2ac3bb(_0xfb6487[_0xd757('0x1a')]['message']);}logger[_0xd757('0x1a')](_0xd757('0x16'),_0x3038b6,_0xfb6487[_0xd757('0x1a')][_0xd757('0x1b')]);return _0x38d80e(_0xfb6487[_0xd757('0x1a')]['message']);}else{logger[_0xd757('0x15')](_0xd757('0x16'),_0x3038b6,_0xd757('0x17'));_0x38d80e(_0xfb6487['result']['message']);}})[_0xd757('0x1c')](function(_0xde8326){logger['error']('Network,\x20%s,\x20%s',_0x3038b6,_0xde8326);_0x2ac3bb(_0xde8326);});});}function respondWithStatusCode(_0x36247d,_0x30bce3){_0x30bce3=_0x30bce3||0xcc;return function(_0x4689f7){if(_0x4689f7){return _0x36247d[_0xd757('0x1d')](_0x30bce3);}return _0x36247d[_0xd757('0x1e')](_0x30bce3)[_0xd757('0x1f')]();};}function respondWithResult(_0x112b66,_0x34c38f){_0x34c38f=_0x34c38f||0xc8;return function(_0x2022a0){if(_0x2022a0){return _0x112b66[_0xd757('0x1e')](_0x34c38f)['json'](_0x2022a0);}};}function respondWithFilteredResult(_0x512909,_0x272f0e){return function(_0x330f20){if(_0x330f20){var _0x183074=_0x330f20[_0xd757('0x20')],_0x2d1ecd=_0x272f0e[_0xd757('0x21')],_0x5d79cc=_0x272f0e[_0xd757('0x21')]+_0x272f0e[_0xd757('0x22')],_0x288061;if(_0x5d79cc>=_0x183074){_0x5d79cc=_0x183074;_0x288061=0xc8;}else{_0x288061=0xce;}_0x512909[_0xd757('0x1e')](_0x288061);return _0x512909[_0xd757('0x23')](_0xd757('0x24'),_0x2d1ecd+'-'+_0x5d79cc+'/'+_0x183074)[_0xd757('0x25')](_0x330f20);}return null;};}function patchUpdates(_0x4630b4){return function(_0x23699b){try{jsonpatch[_0xd757('0x26')](_0x23699b,_0x4630b4,!![]);}catch(_0x188beb){return BPromise[_0xd757('0x27')](_0x188beb);}return _0x23699b[_0xd757('0x28')]();};}function saveUpdates(_0x354012,_0x203702){return function(_0x9af4ea){if(_0x9af4ea){return _0x9af4ea[_0xd757('0x29')](_0x354012)[_0xd757('0x14')](function(_0x517a0b){return _0x517a0b;});}return null;};}function removeEntity(_0x488ad2,_0x5d00a7){return function(_0x204e63){if(_0x204e63){return _0x204e63[_0xd757('0x2a')]()[_0xd757('0x14')](function(){_0x488ad2[_0xd757('0x1e')](0xcc)[_0xd757('0x1f')]();});}};}function handleEntityNotFound(_0x4261da,_0x184de4){return function(_0x5658e9){if(!_0x5658e9){_0x4261da['sendStatus'](0x194);}return _0x5658e9;};}function handleError(_0xe31291,_0x2c2066){_0x2c2066=_0x2c2066||0x1f4;return function(_0x34be69){logger[_0xd757('0x1a')](_0x34be69[_0xd757('0x2b')]);if(_0x34be69[_0xd757('0x2c')]){delete _0x34be69[_0xd757('0x2c')];}_0xe31291[_0xd757('0x1e')](_0x2c2066)[_0xd757('0x2d')](_0x34be69);};}exports[_0xd757('0x2e')]=function(_0x3cffe1,_0x5ba5b0){var _0x21c80d={},_0x580375={},_0x398c48={'count':0x0,'rows':[]};var _0x4bcd0e=db['Network'][_0xd757('0x2f')];_0x580375['model']=_['keys'](_0x4bcd0e);var _0x4e8ff4={'dateStart':_0x3cffe1[_0xd757('0x30')][_0xd757('0x31')],'dateEnd':_0x3cffe1[_0xd757('0x30')][_0xd757('0x32')]};delete _0x3cffe1[_0xd757('0x30')][_0xd757('0x31')];delete _0x3cffe1[_0xd757('0x30')][_0xd757('0x32')];_0x580375[_0xd757('0x30')]=_[_0xd757('0x33')](_0x3cffe1['query']);_0x580375[_0xd757('0x34')]=_['intersection'](_0x580375[_0xd757('0x35')],_0x580375[_0xd757('0x30')]);_0x21c80d[_0xd757('0x36')]=_[_0xd757('0x37')](_0x580375[_0xd757('0x35')],qs[_0xd757('0x38')](_0x3cffe1['query'][_0xd757('0x38')]));_0x21c80d[_0xd757('0x36')]=_0x21c80d[_0xd757('0x36')][_0xd757('0x39')]?_0x21c80d[_0xd757('0x36')]:_0x580375[_0xd757('0x35')];if(!_0x3cffe1[_0xd757('0x30')][_0xd757('0x3a')](_0xd757('0x3b'))){_0x21c80d[_0xd757('0x22')]=qs[_0xd757('0x22')](_0x3cffe1[_0xd757('0x30')][_0xd757('0x22')]);_0x21c80d['offset']=qs['offset'](_0x3cffe1[_0xd757('0x30')][_0xd757('0x21')]);}_0x21c80d['order']=qs[_0xd757('0x3c')](_0x3cffe1['query'][_0xd757('0x3c')]);_0x21c80d[_0xd757('0x3d')]=qs[_0xd757('0x34')](_[_0xd757('0x3e')](_0x3cffe1['query'],_0x580375[_0xd757('0x34')]));if(_0x4e8ff4[_0xd757('0x31')]){if(_0x4e8ff4[_0xd757('0x32')]){_0x4e8ff4[_0xd757('0x32')]=moment(_0x4e8ff4['dateEnd'])[_0xd757('0x3f')](0x1,_0xd757('0x40'));}else{_0x4e8ff4[_0xd757('0x32')]=moment(_0x4e8ff4[_0xd757('0x31')])['add'](0x1,_0xd757('0x40'));}_[_0xd757('0x41')](_0x21c80d[_0xd757('0x3d')],{'createdAt':{'$gte':_0x4e8ff4['dateStart'],'$lte':_0x4e8ff4[_0xd757('0x32')]}});}if(_0x3cffe1[_0xd757('0x30')][_0xd757('0x42')]){_0x21c80d[_0xd757('0x3d')]=_[_0xd757('0x41')](_0x21c80d[_0xd757('0x3d')],{'$or':_[_0xd757('0x43')](_0x21c80d[_0xd757('0x36')],function(_0x2c8f86){var _0x1ab6d6={};_0x1ab6d6[_0x2c8f86]={'$like':'%'+_0x3cffe1['query'][_0xd757('0x42')]+'%'};return _0x1ab6d6;})});}_0x21c80d=_[_0xd757('0x41')]({},_0x21c80d,_0x3cffe1[_0xd757('0x44')]);var _0x303861={'where':_0x21c80d[_0xd757('0x3d')]};return db[_0xd757('0x45')][_0xd757('0x20')](_0x303861)[_0xd757('0x14')](function(_0x3afa99){_0x398c48[_0xd757('0x20')]=_0x3afa99;if(_0x3cffe1[_0xd757('0x30')][_0xd757('0x46')]){_0x21c80d['include']=[{'all':!![]}];}return db[_0xd757('0x45')][_0xd757('0x47')](_0x21c80d);})['then'](function(_0x1f2a80){_0x398c48['rows']=_0x1f2a80;return _0x398c48;})['then'](respondWithFilteredResult(_0x5ba5b0,_0x21c80d))[_0xd757('0x1c')](handleError(_0x5ba5b0,null));};exports[_0xd757('0x48')]=function(_0x35092d,_0xa43bed){var _0x502a85={'raw':!![],'where':{'id':_0x35092d['params']['id']}},_0x1ccfe8={};_0x1ccfe8[_0xd757('0x35')]=_[_0xd757('0x33')](db['Network'][_0xd757('0x2f')]);_0x1ccfe8['query']=_[_0xd757('0x33')](_0x35092d[_0xd757('0x30')]);_0x1ccfe8[_0xd757('0x34')]=_[_0xd757('0x37')](_0x1ccfe8[_0xd757('0x35')],_0x1ccfe8['query']);_0x502a85['attributes']=_[_0xd757('0x37')](_0x1ccfe8[_0xd757('0x35')],qs[_0xd757('0x38')](_0x35092d[_0xd757('0x30')]['fields']));_0x502a85[_0xd757('0x36')]=_0x502a85['attributes'][_0xd757('0x39')]?_0x502a85[_0xd757('0x36')]:_0x1ccfe8[_0xd757('0x35')];if(_0x35092d['query'][_0xd757('0x46')]){_0x502a85[_0xd757('0x49')]=[{'all':!![]}];}_0x502a85=_[_0xd757('0x41')]({},_0x502a85,_0x35092d['options']);return db['Network'][_0xd757('0x4a')](_0x502a85)['then'](handleEntityNotFound(_0xa43bed,null))['then'](respondWithResult(_0xa43bed,null))[_0xd757('0x1c')](handleError(_0xa43bed,null));};exports['create']=function(_0x4a2385,_0x24287f,_0x1610be){var _0x109549;return db['sequelize']['transaction'](function(_0x3fb8aa){return db[_0xd757('0x45')][_0xd757('0x4b')](_0x4a2385[_0xd757('0x4c')],{'raw':!![]})['then'](function(_0x4b02a7){_0x109549=_0x4b02a7;return db[_0xd757('0x45')][_0xd757('0x47')]({'where':{'type':_0x4a2385[_0xd757('0x4c')][_0xd757('0x4d')]},'raw':!![]});})['then'](function(_0x4dde49){var _0x3d8f16=fs[_0xd757('0x4e')](path[_0xd757('0x4f')](config['root'],_0xd757('0x50')),_0xd757('0x51'));var _0x24f502=ejs[_0xd757('0x52')](_0x3d8f16,{'networks':_0x4dde49||[]});fs[_0xd757('0x53')](util[_0xd757('0x54')](_0xd757('0x55'),_0x4a2385[_0xd757('0x4c')][_0xd757('0x4d')][_0xd757('0x56')]()),_0x24f502);})[_0xd757('0x14')](function(){return respondWithRpcPromise(_0xd757('0x57'),_0xd757('0x4b'),{'module':_0xd757('0x58')});})['then'](function(){return _0x109549;});})[_0xd757('0x14')](respondWithResult(_0x24287f,0xc9))[_0xd757('0x1c')](handleError(_0x24287f,null));};exports['update']=function(_0x430412,_0x4ad010,_0x29b77e){var _0x53efd3;return db[_0xd757('0x59')][_0xd757('0x5a')](function(_0x3c7352){return db[_0xd757('0x45')][_0xd757('0x4a')]({'where':{'id':_0x430412[_0xd757('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4ad010,null))[_0xd757('0x14')](saveUpdates(_0x430412[_0xd757('0x4c')],null))['then'](function(_0x59c8a6){if(_0x59c8a6){_0x53efd3=_0x59c8a6;return db['Network'][_0xd757('0x47')]({'where':{'type':_0x53efd3[_0xd757('0x4d')]},'raw':!![]});}return null;})[_0xd757('0x14')](function(_0x3f6a21){if(_0x3f6a21){var _0x2ee507=fs[_0xd757('0x4e')](path['join'](config[_0xd757('0x5c')],_0xd757('0x50')),_0xd757('0x51'));var _0x1eecda=ejs[_0xd757('0x52')](_0x2ee507,{'networks':_0x3f6a21||[]});fs[_0xd757('0x53')](util[_0xd757('0x54')]('/etc/asterisk/sip_xcally_%s.conf',_0x53efd3[_0xd757('0x4d')][_0xd757('0x56')]()),_0x1eecda);return respondWithRpcPromise(_0xd757('0x57'),_0xd757('0x29'),{'module':_0xd757('0x58')});}return null;})['then'](function(_0x1c88a1){if(_0x1c88a1){return _0x53efd3;}return null;});})[_0xd757('0x14')](respondWithResult(_0x4ad010,null))[_0xd757('0x1c')](handleError(_0x4ad010,null));};exports[_0xd757('0x2a')]=function(_0x1aef07,_0x4b9d6c,_0x5f5cc7){var _0x2a64e6;return db['Network'][_0xd757('0x4a')]({'where':{'id':_0x1aef07['params']['id']}})['then'](function(_0x376f30){_0x2a64e6=_0x376f30;return _0x376f30;})['then'](handleEntityNotFound(_0x4b9d6c,null))[_0xd757('0x14')](removeEntity(_0x4b9d6c,null))[_0xd757('0x14')](function(){if(_0x2a64e6){return db['Network'][_0xd757('0x47')]({'where':{'type':_0x2a64e6[_0xd757('0x4d')]},'raw':!![]});}})[_0xd757('0x14')](function(_0x19b898){if(_0x19b898){var _0x39043a=fs[_0xd757('0x4e')](path[_0xd757('0x4f')](config[_0xd757('0x5c')],_0xd757('0x50')),_0xd757('0x51'));var _0x59681e=ejs[_0xd757('0x52')](_0x39043a,{'networks':_0x19b898||[]});fs[_0xd757('0x53')](util[_0xd757('0x54')](_0xd757('0x55'),_0x2a64e6[_0xd757('0x4d')]['toLowerCase']()),_0x59681e);return respondWithRpcPromise(_0xd757('0x57'),_0xd757('0x2a'),{'module':_0xd757('0x58')});}})['catch'](handleError(_0x4b9d6c,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 88bcea0..03711e4 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 _0xc597=['../../config/logger','moment','bluebird','request-promise','./network.attributes','define','network','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc597,0x193));var _0x7c59=function(_0x11de83,_0x49e1c1){_0x11de83=_0x11de83-0x0;var _0x45bdb0=_0xc597[_0x11de83];return _0x45bdb0;};'use strict';var _=require(_0x7c59('0x0'));var util=require(_0x7c59('0x1'));var logger=require(_0x7c59('0x2'))('api');var moment=require(_0x7c59('0x3'));var BPromise=require(_0x7c59('0x4'));var rp=require(_0x7c59('0x5'));var attributes=require(_0x7c59('0x6'));module['exports']=function(_0x2bf938,_0x336fa6){return _0x2bf938[_0x7c59('0x7')]('Network',attributes,{'tableName':_0x7c59('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6a9=['network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./network.attributes','exports','Network'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0xb6a9,0x18d));var _0x9b6a=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb6a9[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x9b6a('0x0'));var util=require(_0x9b6a('0x1'));var logger=require(_0x9b6a('0x2'))(_0x9b6a('0x3'));var moment=require(_0x9b6a('0x4'));var BPromise=require(_0x9b6a('0x5'));var rp=require(_0x9b6a('0x6'));var attributes=require(_0x9b6a('0x7'));module[_0x9b6a('0x8')]=function(_0x4b22bf,_0x429ead){return _0x4b22bf['define'](_0x9b6a('0x9'),attributes,{'tableName':_0x9b6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 98060ce..db33388 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 _0x8ca9=['info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then'];(function(_0xc87d7e,_0x47ae1d){var _0x125830=function(_0x1bdb38){while(--_0x1bdb38){_0xc87d7e['push'](_0xc87d7e['shift']());}};_0x125830(++_0x47ae1d);}(_0x8ca9,0x9c));var _0x98ca=function(_0x48ebb6,_0xfaa9c){_0x48ebb6=_0x48ebb6-0x0;var _0x1b1ed4=_0x8ca9[_0x48ebb6];return _0x1b1ed4;};'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 _0x7046=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5dbbc4,_0x2b18e8){var _0x3d1a19=function(_0x1f5b4d){while(--_0x1f5b4d){_0x5dbbc4['push'](_0x5dbbc4['shift']());}};_0x3d1a19(++_0x2b18e8);}(_0x7046,0x144));var _0x6704=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7046[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('Network,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 8bb87dc..fd9d1f6 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 _0x091e=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','addDisposition','post','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x86dc50,_0xb0c514){var _0x819ceb=function(_0x15323c){while(--_0x15323c){_0x86dc50['push'](_0x86dc50['shift']());}};_0x819ceb(++_0xb0c514);}(_0x091e,0xc1));var _0xe091=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x091e[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0xe091('0x0'));var util=require(_0xe091('0x1'));var path=require('path');var timeout=require(_0xe091('0x2'));var express=require(_0xe091('0x3'));var router=express[_0xe091('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe091('0x5'));var config=require(_0xe091('0x6'));var controller=require('./openchannelAccount.controller');router[_0xe091('0x7')]('/',auth[_0xe091('0x8')](),controller['index']);router['get'](_0xe091('0x9'),auth[_0xe091('0x8')](),controller[_0xe091('0xa')]);router[_0xe091('0x7')](_0xe091('0xb'),auth['isAuthenticated'](),controller[_0xe091('0xc')]);router['get'](_0xe091('0xd'),auth['isAuthenticated'](),controller[_0xe091('0xe')]);router['get'](_0xe091('0xf'),auth[_0xe091('0x8')](),controller[_0xe091('0x10')]);router[_0xe091('0x7')](_0xe091('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0xe091('0x7')](_0xe091('0x12'),auth['isAuthenticated'](),controller[_0xe091('0x13')]);router[_0xe091('0x7')](_0xe091('0x14'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xe091('0x8')](),controller['create']);router['post']('/:id/dispositions',auth[_0xe091('0x8')](),controller[_0xe091('0x15')]);router[_0xe091('0x16')](_0xe091('0xf'),auth[_0xe091('0x8')](),controller[_0xe091('0x17')]);router[_0xe091('0x16')](_0xe091('0x18'),controller[_0xe091('0x19')]);router[_0xe091('0x16')](_0xe091('0x11'),auth['isAuthenticated'](),controller[_0xe091('0x1a')]);router[_0xe091('0x16')](_0xe091('0x14'),auth[_0xe091('0x8')](),controller['addAgents']);router[_0xe091('0x16')](_0xe091('0x1b'),auth[_0xe091('0x8')](),controller[_0xe091('0x1c')]);router['put'](_0xe091('0xb'),auth[_0xe091('0x8')](),controller['update']);router[_0xe091('0x1d')]('/:id',auth[_0xe091('0x8')](),controller[_0xe091('0x1e')]);router[_0xe091('0x1d')](_0xe091('0xd'),auth[_0xe091('0x8')](),controller[_0xe091('0x1f')]);router['delete'](_0xe091('0xf'),auth[_0xe091('0x8')](),controller[_0xe091('0x20')]);router[_0xe091('0x1d')]('/:id/users',auth[_0xe091('0x8')](),controller[_0xe091('0x21')]);module['exports']=router; \ No newline at end of file +var _0x67cf=['index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/users','getAgents','post','create','addAnswer','addApplications','addAgents','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated'];(function(_0x6fc6d9,_0x3448c8){var _0x19f735=function(_0x542e6e){while(--_0x542e6e){_0x6fc6d9['push'](_0x6fc6d9['shift']());}};_0x19f735(++_0x3448c8);}(_0x67cf,0x10f));var _0xf67c=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x67cf[_0x5cbace];return _0x6de5b8;};'use strict';var multer=require('multer');var util=require(_0xf67c('0x0'));var path=require('path');var timeout=require(_0xf67c('0x1'));var express=require(_0xf67c('0x2'));var router=express[_0xf67c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf67c('0x4'));var config=require(_0xf67c('0x5'));var controller=require(_0xf67c('0x6'));router[_0xf67c('0x7')]('/',auth[_0xf67c('0x8')](),controller[_0xf67c('0x9')]);router[_0xf67c('0x7')](_0xf67c('0xa'),auth[_0xf67c('0x8')](),controller[_0xf67c('0xb')]);router[_0xf67c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xf67c('0xc')]);router[_0xf67c('0x7')](_0xf67c('0xd'),auth[_0xf67c('0x8')](),controller['getDispositions']);router['get'](_0xf67c('0xe'),auth[_0xf67c('0x8')](),controller[_0xf67c('0xf')]);router[_0xf67c('0x7')](_0xf67c('0x10'),auth[_0xf67c('0x8')](),controller['getApplications']);router[_0xf67c('0x7')](_0xf67c('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xf67c('0x7')](_0xf67c('0x12'),auth[_0xf67c('0x8')](),controller[_0xf67c('0x13')]);router[_0xf67c('0x14')]('/',auth['isAuthenticated'](),controller[_0xf67c('0x15')]);router['post'](_0xf67c('0xd'),auth[_0xf67c('0x8')](),controller['addDisposition']);router['post'](_0xf67c('0xe'),auth['isAuthenticated'](),controller[_0xf67c('0x16')]);router[_0xf67c('0x14')]('/:id/notify',controller['notify']);router[_0xf67c('0x14')]('/:id/applications',auth[_0xf67c('0x8')](),controller[_0xf67c('0x17')]);router['post'](_0xf67c('0x12'),auth[_0xf67c('0x8')](),controller[_0xf67c('0x18')]);router[_0xf67c('0x14')](_0xf67c('0x19'),auth[_0xf67c('0x8')](),controller[_0xf67c('0x1a')]);router[_0xf67c('0x1b')](_0xf67c('0x1c'),auth['isAuthenticated'](),controller[_0xf67c('0x1d')]);router[_0xf67c('0x1e')](_0xf67c('0x1c'),auth[_0xf67c('0x8')](),controller['destroy']);router['delete'](_0xf67c('0xd'),auth['isAuthenticated'](),controller[_0xf67c('0x1f')]);router['delete'](_0xf67c('0xe'),auth[_0xf67c('0x8')](),controller[_0xf67c('0x20')]);router['delete'](_0xf67c('0x12'),auth['isAuthenticated'](),controller[_0xf67c('0x21')]);module[_0xf67c('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 1946962..03ec0ce 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 _0x008c=['BOOLEAN','INTEGER','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x1bd948,_0xd2639c){var _0x5cccf9=function(_0x52c976){while(--_0x52c976){_0x1bd948['push'](_0x1bd948['shift']());}};_0x5cccf9(++_0xd2639c);}(_0x008c,0x188));var _0xc008=function(_0x35c8f5,_0x399f44){_0x35c8f5=_0x35c8f5-0x0;var _0xb5c718=_0x008c[_0x35c8f5];return _0xb5c718;};'use strict';var Sequelize=require(_0xc008('0x0'));var rs=require(_0xc008('0x1'));module[_0xc008('0x2')]={'name':{'type':Sequelize[_0xc008('0x3')],'unique':_0xc008('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xc008('0x3')],'defaultValue':function(){return rs[_0xc008('0x5')]();}},'replyUri':{'type':Sequelize[_0xc008('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc008('0x6')],'defaultValue':function(){return _0xc008('0x7');}},'notificationSound':{'type':Sequelize[_0xc008('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc008('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc008('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xc008('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc008('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x3e74=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','sequelize','exports','STRING','name','generate'];(function(_0x351cbd,_0x11342b){var _0x164e92=function(_0x559443){while(--_0x559443){_0x351cbd['push'](_0x351cbd['shift']());}};_0x164e92(++_0x11342b);}(_0x3e74,0x175));var _0x43e7=function(_0x327c07,_0x1e483d){_0x327c07=_0x327c07-0x0;var _0x44be5a=_0x3e74[_0x327c07];return _0x44be5a;};'use strict';var Sequelize=require(_0x43e7('0x0'));var rs=require('randomstring');module[_0x43e7('0x1')]={'name':{'type':Sequelize[_0x43e7('0x2')],'unique':_0x43e7('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x43e7('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x43e7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x43e7('0x5')],'defaultValue':function(){return _0x43e7('0x6');}},'notificationSound':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x43e7('0x2')]},'queueTransfer':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x43e7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x43e7('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 6fa3a52..1737773 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 _0x0952=['send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','pick','add','day','merge','map','options','includeAll','include','OpenchannelAccount','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','sort','filter','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','nolimit','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','orderBy','asc','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','addApplications','sequelize','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','redis','defaults','localhost','./openchannelAccount.socket','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','end','status','count','offset','set','Content-Range','json','apply','reject','update','destroy','get','OpenchannelAccounts','sendStatus','stack','name'];(function(_0x3000c3,_0x2f35b3){var _0x38a639=function(_0x6912a0){while(--_0x6912a0){_0x3000c3['push'](_0x3000c3['shift']());}};_0x38a639(++_0x2f35b3);}(_0x0952,0x86));var _0x2095=function(_0x434af6,_0x43d906){_0x434af6=_0x434af6-0x0;var _0xd05764=_0x0952[_0x434af6];return _0xd05764;};'use strict';var pdf=require(_0x2095('0x0'));var emlformat=require(_0x2095('0x1'));var rimraf=require(_0x2095('0x2'));var zipdir=require(_0x2095('0x3'));var jsonpatch=require(_0x2095('0x4'));var rp=require('request-promise');var moment=require(_0x2095('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2095('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2095('0x7'));var csv=require(_0x2095('0x8'));var ejs=require(_0x2095('0x9'));var fs=require('fs');var _=require(_0x2095('0xa'));var squel=require(_0x2095('0xb'));var crypto=require(_0x2095('0xc'));var jsforce=require(_0x2095('0xd'));var deskjs=require(_0x2095('0xe'));var toCsv=require(_0x2095('0x8'));var querystring=require(_0x2095('0xf'));var Papa=require(_0x2095('0x10'));var Redis=require('ioredis');var qs=require(_0x2095('0x11'));var logger=require('../../config/logger')(_0x2095('0x12'));var utils=require(_0x2095('0x13'));var config=require(_0x2095('0x14'));var db=require('../../mysqldb')['db'];config[_0x2095('0x15')]=_[_0x2095('0x16')](config[_0x2095('0x15')],{'host':_0x2095('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2095('0x15')]));require(_0x2095('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2095('0x19')]['http']({'port':0x232c});var client9002=jayson['client'][_0x2095('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x37dfbd,_0x42f33d,_0x126f68,_0x4acb23){return new BPromise(function(_0x29f796,_0x4e3a55){var _0x16789e=_0x4acb23||client;return _0x16789e[_0x2095('0x1b')](_0x37dfbd,_0x126f68)[_0x2095('0x1c')](function(_0x4b3931){logger[_0x2095('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x42f33d,_0x2095('0x1e'));logger[_0x2095('0x1f')](_0x2095('0x20'),_0x42f33d,_0x2095('0x1e'),JSON[_0x2095('0x21')](_0x4b3931));if(_0x4b3931[_0x2095('0x22')]){if(_0x4b3931[_0x2095('0x22')]['code']===0x1f4){logger[_0x2095('0x22')](_0x2095('0x23'),_0x42f33d,_0x4b3931[_0x2095('0x22')][_0x2095('0x24')]);return _0x4e3a55(_0x4b3931[_0x2095('0x22')][_0x2095('0x24')]);}logger[_0x2095('0x22')](_0x2095('0x23'),_0x42f33d,_0x4b3931[_0x2095('0x22')][_0x2095('0x24')]);return _0x29f796(_0x4b3931[_0x2095('0x22')][_0x2095('0x24')]);}else{logger[_0x2095('0x1d')](_0x2095('0x23'),_0x42f33d,_0x2095('0x1e'));_0x29f796(_0x4b3931[_0x2095('0x25')][_0x2095('0x24')]);}})['catch'](function(_0x3a434b){logger[_0x2095('0x22')](_0x2095('0x23'),_0x42f33d,_0x3a434b);_0x4e3a55(_0x3a434b);});});}function respondWithStatusCode(_0x476db9,_0x2bb4e8){_0x2bb4e8=_0x2bb4e8||0xcc;return function(_0x454238){if(_0x454238){return _0x476db9['sendStatus'](_0x2bb4e8);}return _0x476db9['status'](_0x2bb4e8)[_0x2095('0x26')]();};}function respondWithResult(_0x21c3e7,_0x2fbda0){_0x2fbda0=_0x2fbda0||0xc8;return function(_0x5e8237){if(_0x5e8237){return _0x21c3e7[_0x2095('0x27')](_0x2fbda0)['json'](_0x5e8237);}};}function respondWithFilteredResult(_0x5f1c63,_0x379cd1){return function(_0x17800a){if(_0x17800a){var _0x2f4702=_0x17800a[_0x2095('0x28')],_0x2ba147=_0x379cd1[_0x2095('0x29')],_0x402dfa=_0x379cd1[_0x2095('0x29')]+_0x379cd1['limit'],_0x2667c9;if(_0x402dfa>=_0x2f4702){_0x402dfa=_0x2f4702;_0x2667c9=0xc8;}else{_0x2667c9=0xce;}_0x5f1c63[_0x2095('0x27')](_0x2667c9);return _0x5f1c63[_0x2095('0x2a')](_0x2095('0x2b'),_0x2ba147+'-'+_0x402dfa+'/'+_0x2f4702)[_0x2095('0x2c')](_0x17800a);}return null;};}function patchUpdates(_0x2d5304){return function(_0x501f1f){try{jsonpatch[_0x2095('0x2d')](_0x501f1f,_0x2d5304,!![]);}catch(_0x141cc1){return BPromise[_0x2095('0x2e')](_0x141cc1);}return _0x501f1f['save']();};}function saveUpdates(_0x511009,_0x4ca6e7){return function(_0x4b5382){if(_0x4b5382){return _0x4b5382[_0x2095('0x2f')](_0x511009)[_0x2095('0x1c')](function(_0x489e1b){return _0x489e1b;});}return null;};}function removeEntity(_0x5ee91f,_0x148f95){return function(_0x15a09b){if(_0x15a09b){return _0x15a09b[_0x2095('0x30')]()[_0x2095('0x1c')](function(){var _0xb57c0b=_0x15a09b[_0x2095('0x31')]({'plain':!![]});var _0x2a6a08=_0x2095('0x32');return db['UserProfileResource'][_0x2095('0x30')]({'where':{'type':_0x2a6a08,'resourceId':_0xb57c0b['id']}})[_0x2095('0x1c')](function(){return _0x15a09b;});})[_0x2095('0x1c')](function(){_0x5ee91f['status'](0xcc)[_0x2095('0x26')]();});}};}function handleEntityNotFound(_0x394ad6,_0x4edb01){return function(_0x24ef66){if(!_0x24ef66){_0x394ad6[_0x2095('0x33')](0x194);}return _0x24ef66;};}function handleError(_0x1c6e1f,_0xa4807a){_0xa4807a=_0xa4807a||0x1f4;return function(_0x29a7b0){logger['error'](_0x29a7b0[_0x2095('0x34')]);if(_0x29a7b0[_0x2095('0x35')]){delete _0x29a7b0[_0x2095('0x35')];}_0x1c6e1f[_0x2095('0x27')](_0xa4807a)[_0x2095('0x36')](_0x29a7b0);};}exports[_0x2095('0x37')]=function(_0x593277,_0xd1853f){var _0x1b2648={},_0x482b9c={},_0x5ee0eb={'count':0x0,'rows':[]};var _0x97ac69=db['OpenchannelAccount'][_0x2095('0x38')];_0x482b9c[_0x2095('0x39')]=_[_0x2095('0x3a')](_0x97ac69);var _0x1196b4={'dateStart':_0x593277[_0x2095('0x3b')][_0x2095('0x3c')],'dateEnd':_0x593277[_0x2095('0x3b')][_0x2095('0x3d')]};delete _0x593277[_0x2095('0x3b')][_0x2095('0x3c')];delete _0x593277[_0x2095('0x3b')][_0x2095('0x3d')];_0x482b9c[_0x2095('0x3b')]=_[_0x2095('0x3a')](_0x593277[_0x2095('0x3b')]);_0x482b9c[_0x2095('0x3e')]=_[_0x2095('0x3f')](_0x482b9c[_0x2095('0x39')],_0x482b9c[_0x2095('0x3b')]);_0x1b2648[_0x2095('0x40')]=_['intersection'](_0x482b9c[_0x2095('0x39')],qs['fields'](_0x593277['query'][_0x2095('0x41')]));_0x1b2648['attributes']=_0x1b2648[_0x2095('0x40')][_0x2095('0x42')]?_0x1b2648[_0x2095('0x40')]:_0x482b9c['model'];if(!_0x593277[_0x2095('0x3b')][_0x2095('0x43')]('nolimit')){_0x1b2648[_0x2095('0x44')]=qs[_0x2095('0x44')](_0x593277[_0x2095('0x3b')][_0x2095('0x44')]);_0x1b2648['offset']=qs[_0x2095('0x29')](_0x593277[_0x2095('0x3b')]['offset']);}_0x1b2648[_0x2095('0x45')]=qs['sort'](_0x593277[_0x2095('0x3b')]['sort']);_0x1b2648[_0x2095('0x46')]=qs[_0x2095('0x3e')](_[_0x2095('0x47')](_0x593277[_0x2095('0x3b')],_0x482b9c[_0x2095('0x3e')]));if(_0x1196b4[_0x2095('0x3c')]){if(_0x1196b4[_0x2095('0x3d')]){_0x1196b4[_0x2095('0x3d')]=moment(_0x1196b4[_0x2095('0x3d')])[_0x2095('0x48')](0x1,_0x2095('0x49'));}else{_0x1196b4[_0x2095('0x3d')]=moment(_0x1196b4['dateStart'])[_0x2095('0x48')](0x1,'day');}_[_0x2095('0x4a')](_0x1b2648[_0x2095('0x46')],{'createdAt':{'$gte':_0x1196b4[_0x2095('0x3c')],'$lte':_0x1196b4[_0x2095('0x3d')]}});}if(_0x593277[_0x2095('0x3b')]['filter']){_0x1b2648[_0x2095('0x46')]=_['merge'](_0x1b2648[_0x2095('0x46')],{'$or':_[_0x2095('0x4b')](_0x1b2648[_0x2095('0x40')],function(_0x134f94){var _0x1338eb={};_0x1338eb[_0x134f94]={'$like':'%'+_0x593277[_0x2095('0x3b')]['filter']+'%'};return _0x1338eb;})});}_0x1b2648=_[_0x2095('0x4a')]({},_0x1b2648,_0x593277[_0x2095('0x4c')]);var _0x8614c5={'where':_0x1b2648[_0x2095('0x46')]};return db['OpenchannelAccount'][_0x2095('0x28')](_0x8614c5)['then'](function(_0x553976){_0x5ee0eb['count']=_0x553976;if(_0x593277[_0x2095('0x3b')][_0x2095('0x4d')]){_0x1b2648[_0x2095('0x4e')]=[{'all':!![]}];}return db[_0x2095('0x4f')][_0x2095('0x50')](_0x1b2648);})[_0x2095('0x1c')](function(_0x16eec8){_0x5ee0eb[_0x2095('0x51')]=_0x16eec8;return _0x5ee0eb;})[_0x2095('0x1c')](respondWithFilteredResult(_0xd1853f,_0x1b2648))[_0x2095('0x52')](handleError(_0xd1853f,null));};exports[_0x2095('0x53')]=function(_0x58ef7a,_0x21ca37){var _0x5c1e1f={'raw':![],'where':{'id':_0x58ef7a[_0x2095('0x54')]['id']}},_0x166f1a={};_0x166f1a[_0x2095('0x39')]=_[_0x2095('0x3a')](db[_0x2095('0x4f')]['rawAttributes']);_0x166f1a[_0x2095('0x3b')]=_[_0x2095('0x3a')](_0x58ef7a[_0x2095('0x3b')]);_0x166f1a[_0x2095('0x3e')]=_[_0x2095('0x3f')](_0x166f1a[_0x2095('0x39')],_0x166f1a[_0x2095('0x3b')]);_0x5c1e1f[_0x2095('0x40')]=_['intersection'](_0x166f1a[_0x2095('0x39')],qs['fields'](_0x58ef7a[_0x2095('0x3b')][_0x2095('0x41')]));_0x5c1e1f[_0x2095('0x40')]=_0x5c1e1f[_0x2095('0x40')][_0x2095('0x42')]?_0x5c1e1f[_0x2095('0x40')]:_0x166f1a[_0x2095('0x39')];if(_0x58ef7a[_0x2095('0x3b')][_0x2095('0x4d')]){_0x5c1e1f[_0x2095('0x4e')]=[{'all':!![]}];}_0x5c1e1f=_[_0x2095('0x4a')]({},_0x5c1e1f,_0x58ef7a[_0x2095('0x4c')]);return db[_0x2095('0x4f')][_0x2095('0x55')](_0x5c1e1f)[_0x2095('0x1c')](handleEntityNotFound(_0x21ca37,null))[_0x2095('0x1c')](respondWithResult(_0x21ca37,null))[_0x2095('0x52')](handleError(_0x21ca37,null));};exports[_0x2095('0x56')]=function(_0x356135,_0x2b6ca){return db['OpenchannelAccount'][_0x2095('0x56')](_0x356135['body'],{})[_0x2095('0x1c')](function(_0x224938){var _0x8f5905=_0x356135[_0x2095('0x57')][_0x2095('0x31')]({'plain':!![]});if(!_0x8f5905)throw new Error(_0x2095('0x58'));if(_0x8f5905[_0x2095('0x59')]===_0x2095('0x57')){var _0xacd2e5=_0x224938['get']({'plain':!![]});var _0x35256f='OpenchannelAccounts';return db['UserProfileSection'][_0x2095('0x55')]({'where':{'name':_0x35256f,'userProfileId':_0x8f5905['userProfileId']},'raw':!![]})['then'](function(_0x1be244){if(_0x1be244&&_0x1be244[_0x2095('0x5a')]===0x0){return db[_0x2095('0x5b')]['create']({'name':_0xacd2e5[_0x2095('0x35')],'resourceId':_0xacd2e5['id'],'type':_0x1be244[_0x2095('0x35')],'sectionId':_0x1be244['id']},{})[_0x2095('0x1c')](function(){return _0x224938;});}else{return _0x224938;}})[_0x2095('0x52')](function(_0x500283){logger[_0x2095('0x22')](_0x2095('0x5c'),_0x500283);throw _0x500283;});}return _0x224938;})['then'](respondWithResult(_0x2b6ca,0xc9))[_0x2095('0x52')](handleError(_0x2b6ca,null));};exports[_0x2095('0x2f')]=function(_0x2dee81,_0x15920f){if(_0x2dee81[_0x2095('0x5d')]['id']){delete _0x2dee81['body']['id'];}return db[_0x2095('0x4f')][_0x2095('0x55')]({'where':{'id':_0x2dee81[_0x2095('0x54')]['id']}})['then'](handleEntityNotFound(_0x15920f,null))[_0x2095('0x1c')](saveUpdates(_0x2dee81[_0x2095('0x5d')],null))['then'](respondWithResult(_0x15920f,null))[_0x2095('0x52')](handleError(_0x15920f,null));};exports['destroy']=function(_0x2d34d0,_0x568f3a){return db[_0x2095('0x4f')]['find']({'where':{'id':_0x2d34d0[_0x2095('0x54')]['id']}})['then'](handleEntityNotFound(_0x568f3a,null))[_0x2095('0x1c')](removeEntity(_0x568f3a,null))[_0x2095('0x52')](handleError(_0x568f3a,null));};exports[_0x2095('0x5e')]=function(_0x12b712,_0x233096){return db[_0x2095('0x4f')][_0x2095('0x5e')]()[_0x2095('0x1c')](respondWithResult(_0x233096,null))[_0x2095('0x52')](handleError(_0x233096,null));};exports[_0x2095('0x5f')]=function(_0x3c7298,_0x2dcfe5,_0x7faf8b){if(_0x3c7298['body']['id']){delete _0x3c7298[_0x2095('0x5d')]['id'];}return db[_0x2095('0x4f')]['find']({'where':{'id':_0x3c7298['params']['id']}})[_0x2095('0x1c')](handleEntityNotFound(_0x2dcfe5,null))[_0x2095('0x1c')](function(_0x4540fe){if(_0x4540fe){_0x3c7298['body'][_0x2095('0x60')]=_0x4540fe['id'];return db[_0x2095('0x61')][_0x2095('0x56')](_0x3c7298[_0x2095('0x5d')]);}})[_0x2095('0x1c')](respondWithResult(_0x2dcfe5,null))[_0x2095('0x52')](handleError(_0x2dcfe5,null));};exports[_0x2095('0x62')]=function(_0x2fb9d2,_0x2e87d4,_0x3b395c){var _0xb3bcb8={'raw':![],'where':{}};var _0x397d7f={};var _0x5851d8={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2095('0x63')]({'where':{'id':_0x2fb9d2[_0x2095('0x54')]['id']}})[_0x2095('0x1c')](handleEntityNotFound(_0x2e87d4,null))['then'](function(_0x22ed9d){if(_0x22ed9d){_0x397d7f[_0x2095('0x39')]=_[_0x2095('0x3a')](db[_0x2095('0x61')][_0x2095('0x38')]);_0x397d7f['query']=_[_0x2095('0x3a')](_0x2fb9d2[_0x2095('0x3b')]);_0x397d7f[_0x2095('0x3e')]=_[_0x2095('0x3f')](_0x397d7f[_0x2095('0x39')],_0x397d7f[_0x2095('0x3b')]);_0xb3bcb8[_0x2095('0x40')]=_[_0x2095('0x3f')](_0x397d7f[_0x2095('0x39')],qs[_0x2095('0x41')](_0x2fb9d2[_0x2095('0x3b')]['fields']));_0xb3bcb8[_0x2095('0x40')]=_0xb3bcb8[_0x2095('0x40')]['length']?_0xb3bcb8['attributes']:_0x397d7f['model'];if(!_0x2fb9d2[_0x2095('0x3b')][_0x2095('0x43')]('nolimit')){_0xb3bcb8[_0x2095('0x44')]=qs[_0x2095('0x44')](_0x2fb9d2[_0x2095('0x3b')]['limit']);_0xb3bcb8[_0x2095('0x29')]=qs[_0x2095('0x29')](_0x2fb9d2[_0x2095('0x3b')][_0x2095('0x29')]);}_0xb3bcb8[_0x2095('0x45')]=qs[_0x2095('0x64')](_0x2fb9d2[_0x2095('0x3b')][_0x2095('0x64')]);_0xb3bcb8['where']=qs[_0x2095('0x3e')](_['pick'](_0x2fb9d2[_0x2095('0x3b')],_0x397d7f[_0x2095('0x3e')]));_0xb3bcb8['where']['OpenchannelAccountId']=_0x22ed9d['id'];if(_0x2fb9d2['query']['filter']){_0xb3bcb8[_0x2095('0x46')]=_[_0x2095('0x4a')](_0xb3bcb8[_0x2095('0x46')],{'$or':_[_0x2095('0x4b')](_0xb3bcb8[_0x2095('0x40')],function(_0x57e485){var _0x47d55e={};_0x47d55e[_0x57e485]={'$like':'%'+_0x2fb9d2[_0x2095('0x3b')][_0x2095('0x65')]+'%'};return _0x47d55e;})});}_0xb3bcb8=_[_0x2095('0x4a')]({},_0xb3bcb8,_0x2fb9d2[_0x2095('0x4c')]);return db[_0x2095('0x61')][_0x2095('0x28')]({'where':_0xb3bcb8[_0x2095('0x46')]})[_0x2095('0x1c')](function(_0xda7067){_0x5851d8[_0x2095('0x28')]=_0xda7067;if(_0x2fb9d2['query']['includeAll']){_0xb3bcb8[_0x2095('0x4e')]=[{'all':!![]}];}return db['Disposition'][_0x2095('0x50')](_0xb3bcb8);})['then'](function(_0x29fa57){_0x5851d8[_0x2095('0x51')]=_0x29fa57;return _0x5851d8;});}})[_0x2095('0x1c')](respondWithFilteredResult(_0x2e87d4,_0xb3bcb8))[_0x2095('0x52')](handleError(_0x2e87d4,null));};exports['removeDispositions']=function(_0x406706,_0x3f3ea3,_0x323b21){var _0x2bd2ea;return db[_0x2095('0x4f')]['find']({'where':{'id':_0x406706[_0x2095('0x54')]['id']}})[_0x2095('0x1c')](handleEntityNotFound(_0x3f3ea3,null))[_0x2095('0x1c')](function(_0x54ff49){if(_0x54ff49){return _0x54ff49[_0x2095('0x66')](_0x406706[_0x2095('0x3b')][_0x2095('0x67')]);}})[_0x2095('0x1c')](respondWithStatusCode(_0x3f3ea3,null))[_0x2095('0x52')](handleError(_0x3f3ea3,null));};exports[_0x2095('0x68')]=function(_0x51302b,_0x3f216a,_0x2f5fc1){if(_0x51302b['body']['id']){delete _0x51302b[_0x2095('0x5d')]['id'];}return db[_0x2095('0x4f')][_0x2095('0x55')]({'where':{'id':_0x51302b[_0x2095('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f216a,null))['then'](function(_0x314e79){if(_0x314e79){_0x51302b[_0x2095('0x5d')][_0x2095('0x69')]=_0x314e79['id'];return db[_0x2095('0x6a')][_0x2095('0x56')](_0x51302b['body']);}})[_0x2095('0x1c')](respondWithResult(_0x3f216a,null))[_0x2095('0x52')](handleError(_0x3f216a,null));};exports[_0x2095('0x6b')]=function(_0x14ebb5,_0x488c3a,_0x59f18a){var _0x27e6a1={'raw':![],'where':{}};var _0x41dfed={};var _0x4d7c67={'count':0x0,'rows':[]};return db[_0x2095('0x4f')]['findOne']({'where':{'id':_0x14ebb5[_0x2095('0x54')]['id']}})[_0x2095('0x1c')](handleEntityNotFound(_0x488c3a,null))[_0x2095('0x1c')](function(_0x375158){if(_0x375158){_0x41dfed[_0x2095('0x39')]=_[_0x2095('0x3a')](db[_0x2095('0x6a')]['rawAttributes']);_0x41dfed[_0x2095('0x3b')]=_['keys'](_0x14ebb5[_0x2095('0x3b')]);_0x41dfed['filters']=_[_0x2095('0x3f')](_0x41dfed['model'],_0x41dfed[_0x2095('0x3b')]);_0x27e6a1[_0x2095('0x40')]=_[_0x2095('0x3f')](_0x41dfed['model'],qs[_0x2095('0x41')](_0x14ebb5['query'][_0x2095('0x41')]));_0x27e6a1[_0x2095('0x40')]=_0x27e6a1[_0x2095('0x40')][_0x2095('0x42')]?_0x27e6a1[_0x2095('0x40')]:_0x41dfed['model'];if(!_0x14ebb5[_0x2095('0x3b')][_0x2095('0x43')](_0x2095('0x6c'))){_0x27e6a1['limit']=qs[_0x2095('0x44')](_0x14ebb5[_0x2095('0x3b')][_0x2095('0x44')]);_0x27e6a1[_0x2095('0x29')]=qs[_0x2095('0x29')](_0x14ebb5[_0x2095('0x3b')][_0x2095('0x29')]);}_0x27e6a1[_0x2095('0x45')]=qs[_0x2095('0x64')](_0x14ebb5[_0x2095('0x3b')][_0x2095('0x64')]);_0x27e6a1[_0x2095('0x46')]=qs[_0x2095('0x3e')](_[_0x2095('0x47')](_0x14ebb5['query'],_0x41dfed[_0x2095('0x3e')]));_0x27e6a1[_0x2095('0x46')][_0x2095('0x69')]=_0x375158['id'];if(_0x14ebb5[_0x2095('0x3b')]['filter']){_0x27e6a1['where']=_[_0x2095('0x4a')](_0x27e6a1[_0x2095('0x46')],{'$or':_[_0x2095('0x4b')](_0x27e6a1[_0x2095('0x40')],function(_0x507c89){var _0x5a6d89={};_0x5a6d89[_0x507c89]={'$like':'%'+_0x14ebb5[_0x2095('0x3b')][_0x2095('0x65')]+'%'};return _0x5a6d89;})});}_0x27e6a1=_[_0x2095('0x4a')]({},_0x27e6a1,_0x14ebb5['options']);return db[_0x2095('0x6a')][_0x2095('0x28')]({'where':_0x27e6a1['where']})[_0x2095('0x1c')](function(_0x32a323){_0x4d7c67[_0x2095('0x28')]=_0x32a323;if(_0x14ebb5[_0x2095('0x3b')][_0x2095('0x4d')]){_0x27e6a1[_0x2095('0x4e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2095('0x50')](_0x27e6a1);})['then'](function(_0x13ae4a){_0x4d7c67['rows']=_0x13ae4a;return _0x4d7c67;});}})[_0x2095('0x1c')](respondWithFilteredResult(_0x488c3a,_0x27e6a1))['catch'](handleError(_0x488c3a,null));};exports[_0x2095('0x6d')]=function(_0x2a9f12,_0x5de409,_0x2b6ead){var _0x4c4e34;return db['OpenchannelAccount']['find']({'where':{'id':_0x2a9f12[_0x2095('0x54')]['id']}})['then'](handleEntityNotFound(_0x5de409,null))['then'](function(_0x95e72c){if(_0x95e72c){return _0x95e72c[_0x2095('0x6d')](_0x2a9f12['query'][_0x2095('0x67')]);}})[_0x2095('0x1c')](respondWithStatusCode(_0x5de409,null))[_0x2095('0x52')](handleError(_0x5de409,null));};exports[_0x2095('0x6e')]=function(_0x17233b,_0x11d50f,_0x5dfc4d){var _0x4afe2a={'body':_0x17233b[_0x2095('0x5d')],'channel':_0x2095('0x6f')};var _0x4ca35c=[];var _0x424e68=[];var _0x3fad56={};var _0xd64e55=![];return db[_0x2095('0x70')][_0x2095('0x5e')]()['then'](function(_0x2d7718){if(!_0x2d7718){throw new db['Sequelize']['ValidationError'](_0x2095('0x71'));}_0x4ca35c=_[_0x2095('0x72')](_[_0x2095('0x3a')](_0x2d7718),[_0x2095('0x73'),_0x2095('0x74')]);_0x424e68=_[_0x2095('0x72')](_[_0x2095('0x3a')](_0x2d7718),['createdAt',_0x2095('0x74'),_0x2095('0x75'),_0x2095('0x76')]);if(_0x17233b[_0x2095('0x5d')]['id']){delete _0x17233b[_0x2095('0x5d')]['id'];}if(_[_0x2095('0x77')](_0x17233b[_0x2095('0x5d')][_0x2095('0x78')])){throw new db['Sequelize'][(_0x2095('0x79'))](_0x2095('0x7a'));}if(_[_0x2095('0x77')](_0x17233b[_0x2095('0x5d')]['body'])||_0x17233b[_0x2095('0x5d')][_0x2095('0x5d')]===''){throw new db[(_0x2095('0x7b'))][(_0x2095('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2095('0x77')](_0x17233b[_0x2095('0x5d')]['mapKey'])){throw new db[(_0x2095('0x7b'))][(_0x2095('0x79'))](_0x2095('0x7c')+_0x424e68);}if(!_[_0x2095('0x7d')](_0x424e68,_0x17233b[_0x2095('0x5d')][_0x2095('0x7e')])){throw new db[(_0x2095('0x7b'))][(_0x2095('0x79'))](_0x2095('0x7f')+_0x424e68);}_0x3fad56[_0x17233b[_0x2095('0x5d')]['mapKey']]=_0x17233b['body']['from'];})[_0x2095('0x1c')](function(){return db['OpenchannelAccount'][_0x2095('0x55')]({'where':{'id':_0x17233b[_0x2095('0x54')]['id']},'include':[{'model':db[_0x2095('0x80')],'as':'List','include':[{'model':db[_0x2095('0x70')],'as':_0x2095('0x81'),'where':_0x3fad56,'limit':0x1,'order':[[_0x2095('0x74'),_0x2095('0x82')]]}]},{'model':db[_0x2095('0x83')],'as':_0x2095('0x84')}]});})[_0x2095('0x1c')](handleEntityNotFound(_0x11d50f,null))['then'](function(_0x550f29){if(_0x550f29&&_0x550f29[_0x2095('0x85')]){_0x4afe2a[_0x2095('0x86')]=_0x550f29;_0x4afe2a[_0x2095('0x87')]=_0x550f29[_0x2095('0x84')];_0x4afe2a['list']=_0x550f29[_0x2095('0x85')];_0x4afe2a[_0x2095('0x87')]=_[_0x2095('0x88')](_0x4afe2a[_0x2095('0x87')],['priority'],[_0x2095('0x89')]);if(_0x4afe2a[_0x2095('0x86')]['Applications']){delete _0x4afe2a['account'][_0x2095('0x84')];}if(_0x4afe2a['account'][_0x2095('0x85')]&&_0x4afe2a[_0x2095('0x86')][_0x2095('0x85')][_0x2095('0x81')][_0x2095('0x42')]){return _0x4afe2a[_0x2095('0x86')][_0x2095('0x85')]['Contacts'][0x0];}var _0x11351a=_[_0x2095('0x16')](_0x17233b['body'],{'firstName':_0x17233b[_0x2095('0x5d')][_0x2095('0x78')],'ListId':_0x550f29[_0x2095('0x76')]});_0x11351a[_0x17233b[_0x2095('0x5d')]['mapKey']]=_0x17233b[_0x2095('0x5d')]['from'];return db[_0x2095('0x70')][_0x2095('0x56')](_0x11351a,{'fields':_0x4ca35c,'raw':!![]});}})['then'](handleEntityNotFound(_0x11d50f,null))['then'](function(_0x191298){_0x4afe2a['contact']=_0x191298;if(_0x191298){var _0x4cc63a={'ContactId':_0x191298['id'],'OpenchannelAccountId':_0x17233b[_0x2095('0x54')]['id'],'from':(_0x191298['firstName']||'')+'\x20'+(_0x191298['lastName']||'')};var _0x42f176={'OpenchannelAccountId':_0x17233b[_0x2095('0x54')]['id'],'closed':![]};if(_0x17233b[_0x2095('0x5d')]['threadId']){_0x42f176[_0x2095('0x8a')]=_0x17233b['body'][_0x2095('0x8a')];return db[_0x2095('0x8b')][_0x2095('0x55')]({'where':_0x42f176})[_0x2095('0x1c')](function(_0x366b48){if(_0x366b48){return[_0x366b48,![]];}_0x4cc63a['threadId']=_0x17233b[_0x2095('0x5d')][_0x2095('0x8a')];_0x4cc63a[_0x2095('0x8c')]=_0x17233b[_0x2095('0x5d')][_0x2095('0x8c')];return db[_0x2095('0x8b')][_0x2095('0x56')](_0x4cc63a)['then'](function(_0x5428ce){return[_0x5428ce,!![]];});});}else{_0x42f176['threadId']=null;}_0x42f176[_0x2095('0x8d')]=_0x191298['id'];return db[_0x2095('0x8b')][_0x2095('0x55')]({'where':_0x42f176})[_0x2095('0x1c')](function(_0x460a56){if(_0x460a56){return[_0x460a56,![]];}return db[_0x2095('0x8b')][_0x2095('0x56')](_0x4cc63a)[_0x2095('0x1c')](function(_0x1a7035){return[_0x1a7035,!![]];});});}})[_0x2095('0x8e')](function(_0x395a67,_0x5cadb5){if(_0x395a67){_0xd64e55=_0x5cadb5;if(!_0x5cadb5){var _0x192e30={'from':(_0x4afe2a['contact'][_0x2095('0x8f')]||'')+'\x20'+(_0x4afe2a[_0x2095('0x90')]['lastName']||'')};if(_0x17233b[_0x2095('0x5d')][_0x2095('0x8a')]&&_0x17233b['body'][_0x2095('0x91')]&&_0x17233b['body'][_0x2095('0x8a')]!=_0x17233b[_0x2095('0x5d')][_0x2095('0x91')]){_0x192e30[_0x2095('0x8a')]=_0x17233b[_0x2095('0x5d')][_0x2095('0x91')];}return _0x395a67[_0x2095('0x2f')](_0x192e30);}else{return _0x395a67;}}})[_0x2095('0x1c')](function(_0x38326d){_0x4afe2a[_0x2095('0x92')]=_0x38326d['get']({'plain':!![]});_0x4afe2a[_0x2095('0x92')][_0x2095('0x93')]=_0xd64e55;if(_0x4afe2a['interaction'][_0x2095('0x93')]){if(_0x4afe2a[_0x2095('0x86')][_0x2095('0x94')]){_0x4afe2a[_0x2095('0x87')][_0x2095('0x95')]({'id':0x0,'priority':_0x4afe2a[_0x2095('0x87')][_0x2095('0x42')]+0x1,'app':_0x2095('0x96'),'appdata':_0x2095('0x97'),'interval':_0x2095('0x98')});}}return db[_0x2095('0x99')][_0x2095('0x56')]({'body':_0x17233b['body'][_0x2095('0x5d')],'OpenchannelAccountId':_0x17233b['params']['id'],'OpenchannelInteractionId':_0x38326d['id'],'direction':'in','ContactId':_0x4afe2a[_0x2095('0x90')]['id'],'AttachmentId':_0x17233b[_0x2095('0x5d')][_0x2095('0x9a')]});})[_0x2095('0x1c')](function(_0x1389f9){_0x4afe2a[_0x2095('0x24')]=_0x1389f9;if(_0x4afe2a[_0x2095('0x92')]['UserId']){return db[_0x2095('0x9b')][_0x2095('0x55')]({'attributes':['id','name'],'where':{'id':_0x4afe2a[_0x2095('0x92')][_0x2095('0x9c')]}})['then'](function(_0x44fd93){if(_0x44fd93){_0x4afe2a[_0x2095('0x87')][_0x2095('0x9d')]({'id':0x0,'priority':0x0,'app':_0x2095('0x9e'),'appdata':_0x44fd93[_0x2095('0x35')]+','+(_0x4afe2a[_0x2095('0x86')][_0x2095('0x9f')]||0xa),'interval':_0x2095('0x98')});_0x4afe2a[_0x2095('0xa0')]=![];}return respondWithRpcPromise(_0x2095('0xa1'),'startRouting',_0x4afe2a);});}return respondWithRpcPromise(_0x2095('0xa1'),'startRouting',_0x4afe2a);})[_0x2095('0x1c')](function(_0x480e64){respondWithRpcPromise(_0x2095('0xa2'),_0x2095('0xa2'),{'event':'notify','message':_0x480e64},client9002);return _0x480e64;})[_0x2095('0x1c')](respondWithResult(_0x11d50f,null))[_0x2095('0x52')](handleError(_0x11d50f,null));};exports[_0x2095('0xa3')]=function(_0x4afde6,_0xe029d8,_0x44eec5){return db[_0x2095('0x4f')]['findOne']({'where':{'id':_0x4afde6[_0x2095('0x54')]['id']}})['then'](handleEntityNotFound(_0xe029d8,null))[_0x2095('0x1c')](function(_0xd103b5){if(_0xd103b5){return db[_0x2095('0xa4')]['transaction'](function(_0x376c50){return db[_0x2095('0x83')]['destroy']({'where':{'OpenchannelAccountId':_0x4afde6[_0x2095('0x54')]['id']},'transaction':_0x376c50})[_0x2095('0x1c')](function(_0x3c33b6){var _0x4bbd3e=_['map'](_0x4afde6[_0x2095('0x5d')],function(_0x42ccd1){_0x42ccd1[_0x2095('0x69')]=_0x4afde6[_0x2095('0x54')]['id'];return _0x42ccd1;});return db[_0x2095('0x83')]['bulkCreate'](_0x4bbd3e,{'transaction':_0x376c50});});})['then'](function(){return db['OpenchannelApplication'][_0x2095('0xa5')]({'where':{'OpenchannelAccountId':_0x4afde6[_0x2095('0x54')]['id']},'order':_0x2095('0xa6')});});}})[_0x2095('0x1c')](respondWithResult(_0xe029d8,null))['catch'](handleError(_0xe029d8,null));};exports['getApplications']=function(_0x6d0970,_0x5e8e2a,_0x18ea91){var _0x4f1364={};var _0x3f3306={};var _0x3a293e;var _0x1a0236;return db[_0x2095('0x4f')][_0x2095('0x63')]({'where':{'id':_0x6d0970[_0x2095('0x54')]['id']}})['then'](handleEntityNotFound(_0x5e8e2a,null))['then'](function(_0x55bbf8){if(_0x55bbf8){_0x3a293e=_0x55bbf8;_0x3f3306[_0x2095('0x39')]=_[_0x2095('0x3a')](db[_0x2095('0x83')][_0x2095('0x38')]);_0x3f3306[_0x2095('0x3b')]=_[_0x2095('0x3a')](_0x6d0970['query']);_0x3f3306['filters']=_[_0x2095('0x3f')](_0x3f3306['model'],_0x3f3306[_0x2095('0x3b')]);_0x4f1364[_0x2095('0x40')]=_[_0x2095('0x3f')](_0x3f3306['model'],qs['fields'](_0x6d0970[_0x2095('0x3b')]['fields']));_0x4f1364[_0x2095('0x40')]=_0x4f1364[_0x2095('0x40')][_0x2095('0x42')]?_0x4f1364['attributes']:_0x3f3306['model'];_0x4f1364[_0x2095('0x45')]=qs[_0x2095('0x64')](_0x6d0970['query'][_0x2095('0x64')]);_0x4f1364['where']=qs['filters'](_[_0x2095('0x47')](_0x6d0970[_0x2095('0x3b')],_0x3f3306[_0x2095('0x3e')]));if(_0x6d0970[_0x2095('0x3b')][_0x2095('0x65')]){_0x4f1364[_0x2095('0x46')]=_['merge'](_0x4f1364[_0x2095('0x46')],{'$or':_['map'](_0x4f1364['attributes'],function(_0x397358){var _0x40e6d0={};_0x40e6d0[_0x397358]={'$like':'%'+_0x6d0970['query']['filter']+'%'};return _0x40e6d0;})});}_0x4f1364=_[_0x2095('0x4a')]({},_0x4f1364,_0x6d0970[_0x2095('0x4c')]);return _0x3a293e[_0x2095('0xa7')](_0x4f1364);}})[_0x2095('0x1c')](function(_0x213f3c){if(_0x213f3c){_0x1a0236=_0x213f3c[_0x2095('0x42')];if(!_0x6d0970[_0x2095('0x3b')][_0x2095('0x43')](_0x2095('0x6c'))){_0x4f1364[_0x2095('0x44')]=qs[_0x2095('0x44')](_0x6d0970[_0x2095('0x3b')][_0x2095('0x44')]);_0x4f1364[_0x2095('0x29')]=qs[_0x2095('0x29')](_0x6d0970[_0x2095('0x3b')]['offset']);}return _0x3a293e[_0x2095('0xa7')](_0x4f1364);}})['then'](function(_0x1233c4){if(_0x1233c4){return _0x1233c4?{'count':_0x1a0236,'rows':_0x1233c4}:null;}})[_0x2095('0x1c')](respondWithResult(_0x5e8e2a,null))[_0x2095('0x52')](handleError(_0x5e8e2a,null));};exports[_0x2095('0xa8')]=function(_0x4e110e,_0x3287ee,_0x4b8db2){var _0x52f62c={'raw':![],'where':{}};var _0xc7ce8f={};var _0x2b8b66={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2095('0x63')]({'where':{'id':_0x4e110e['params']['id']}})['then'](handleEntityNotFound(_0x3287ee,null))[_0x2095('0x1c')](function(_0x47c908){if(_0x47c908){_0xc7ce8f['model']=_[_0x2095('0x3a')](db['OpenchannelInteraction'][_0x2095('0x38')]);_0xc7ce8f['query']=_[_0x2095('0x3a')](_0x4e110e[_0x2095('0x3b')]);_0xc7ce8f[_0x2095('0x3e')]=_['intersection'](_0xc7ce8f[_0x2095('0x39')],_0xc7ce8f['query']);_0x52f62c[_0x2095('0x40')]=_[_0x2095('0x3f')](_0xc7ce8f[_0x2095('0x39')],qs[_0x2095('0x41')](_0x4e110e[_0x2095('0x3b')]['fields']));_0x52f62c['attributes']=_0x52f62c[_0x2095('0x40')][_0x2095('0x42')]?_0x52f62c[_0x2095('0x40')]:_0xc7ce8f[_0x2095('0x39')];if(!_0x4e110e['query'][_0x2095('0x43')](_0x2095('0x6c'))){_0x52f62c['limit']=qs[_0x2095('0x44')](_0x4e110e[_0x2095('0x3b')][_0x2095('0x44')]);_0x52f62c[_0x2095('0x29')]=qs[_0x2095('0x29')](_0x4e110e[_0x2095('0x3b')][_0x2095('0x29')]);}_0x52f62c['order']=qs['sort'](_0x4e110e['query'][_0x2095('0x64')]);_0x52f62c[_0x2095('0x46')]=qs[_0x2095('0x3e')](_['pick'](_0x4e110e[_0x2095('0x3b')],_0xc7ce8f['filters']));_0x52f62c[_0x2095('0x46')][_0x2095('0x69')]=_0x47c908['id'];if(_0x4e110e['query'][_0x2095('0x65')]){_0x52f62c[_0x2095('0x46')]=_[_0x2095('0x4a')](_0x52f62c['where'],{'$or':_[_0x2095('0x4b')](_0x52f62c[_0x2095('0x40')],function(_0x4f08be){var _0x2d0819={};_0x2d0819[_0x4f08be]={'$like':'%'+_0x4e110e['query'][_0x2095('0x65')]+'%'};return _0x2d0819;})});}_0x52f62c=_[_0x2095('0x4a')]({},_0x52f62c,_0x4e110e[_0x2095('0x4c')]);return db[_0x2095('0x8b')]['count']({'where':_0x52f62c[_0x2095('0x46')]})[_0x2095('0x1c')](function(_0xfae053){_0x2b8b66[_0x2095('0x28')]=_0xfae053;if(_0x4e110e[_0x2095('0x3b')][_0x2095('0x4d')]){_0x52f62c[_0x2095('0x4e')]=[{'model':db[_0x2095('0x70')],'as':_0x2095('0xa9'),'required':![]},{'model':db[_0x2095('0x9b')],'as':_0x2095('0xaa'),'attributes':[_0x2095('0x35'),_0x2095('0xab'),'internal'],'required':![]},{'model':db[_0x2095('0xac')],'as':_0x2095('0xad'),'attributes':['id',_0x2095('0x35'),_0x2095('0xae')],'where':_0x4e110e[_0x2095('0x3b')]['tag']?{'id':_0x4e110e[_0x2095('0x3b')][_0x2095('0xaf')]}:undefined,'required':_0x4e110e[_0x2095('0x3b')][_0x2095('0xaf')]?!![]:![]}];}return db[_0x2095('0x8b')][_0x2095('0x50')](_0x52f62c);})[_0x2095('0x1c')](function(_0x29b3a8){_0x2b8b66['rows']=_0x29b3a8;return _0x2b8b66;});}})[_0x2095('0x1c')](respondWithFilteredResult(_0x3287ee,_0x52f62c))[_0x2095('0x52')](handleError(_0x3287ee,null));};exports[_0x2095('0xb0')]=function(_0x121c23,_0x2a80cd,_0xc15162){return db['OpenchannelAccount'][_0x2095('0x55')]({'where':{'id':_0x121c23[_0x2095('0x54')]['id']}})['then'](handleEntityNotFound(_0x2a80cd,null))[_0x2095('0x1c')](function(_0x3ed2e5){if(_0x3ed2e5){return _0x3ed2e5[_0x2095('0xb0')](_0x121c23[_0x2095('0x5d')][_0x2095('0x67')],_[_0x2095('0xb1')](_0x121c23['body'],[_0x2095('0x67'),'id'])||{})[_0x2095('0x8e')](function(_0x4dce3d){for(var _0x587f37=0x0;_0x587f37<_0x121c23[_0x2095('0x5d')][_0x2095('0x67')][_0x2095('0x42')];_0x587f37+=0x1){socket[_0x2095('0xb2')](_0x2095('0xb3'),{'UserId':_0x121c23[_0x2095('0x5d')]['ids'][_0x587f37],'OpenchannelAccountId':_0x121c23[_0x2095('0x54')]['id']});}return _0x4dce3d;});}})['then'](respondWithResult(_0x2a80cd,null))[_0x2095('0x52')](handleError(_0x2a80cd,null));};exports[_0x2095('0xb4')]=function(_0x2cd1f8,_0x50a766,_0x48e94e){var _0x58a4d4;return db[_0x2095('0x4f')]['find']({'where':{'id':_0x2cd1f8['params']['id']}})[_0x2095('0x1c')](handleEntityNotFound(_0x50a766,null))[_0x2095('0x1c')](function(_0x1e2220){if(_0x1e2220){return _0x1e2220[_0x2095('0xb4')](_0x2cd1f8[_0x2095('0x3b')][_0x2095('0x67')])[_0x2095('0x1c')](function(_0x2992e8){if(_[_0x2095('0xb5')](_0x2cd1f8[_0x2095('0x3b')][_0x2095('0x67')])){for(var _0x5421dc=0x0;_0x5421dc<_0x2cd1f8[_0x2095('0x3b')][_0x2095('0x67')][_0x2095('0x42')];_0x5421dc+=0x1){socket['emit'](_0x2095('0xb6'),{'UserId':_0x2cd1f8['query'][_0x2095('0x67')][_0x5421dc],'OpenchannelAccountId':_0x2cd1f8[_0x2095('0x54')]['id']});}}else{socket['emit'](_0x2095('0xb6'),{'UserId':_0x2cd1f8[_0x2095('0x3b')][_0x2095('0x67')],'OpenchannelAccountId':_0x2cd1f8[_0x2095('0x54')]['id']});}});}})[_0x2095('0x1c')](respondWithStatusCode(_0x50a766,null))[_0x2095('0x52')](handleError(_0x50a766,null));};exports['getAgents']=function(_0x5808ef,_0x3701cd,_0x25dd8e){var _0x261b47={};var _0x3775ad={};var _0x294f73;var _0x2494cc;return db[_0x2095('0x4f')]['findOne']({'where':{'id':_0x5808ef[_0x2095('0x54')]['id']}})['then'](handleEntityNotFound(_0x3701cd,null))[_0x2095('0x1c')](function(_0x5be2de){if(_0x5be2de){_0x294f73=_0x5be2de;_0x3775ad[_0x2095('0x39')]=_['keys'](db[_0x2095('0x9b')][_0x2095('0x38')]);_0x3775ad['query']=_['keys'](_0x5808ef[_0x2095('0x3b')]);_0x3775ad[_0x2095('0x3e')]=_[_0x2095('0x3f')](_0x3775ad[_0x2095('0x39')],_0x3775ad[_0x2095('0x3b')]);_0x261b47[_0x2095('0x40')]=_['intersection'](_0x3775ad[_0x2095('0x39')],qs[_0x2095('0x41')](_0x5808ef[_0x2095('0x3b')][_0x2095('0x41')]));_0x261b47[_0x2095('0x40')]=_0x261b47[_0x2095('0x40')]['length']?_0x261b47[_0x2095('0x40')]:_0x3775ad['model'];_0x261b47['order']=qs[_0x2095('0x64')](_0x5808ef[_0x2095('0x3b')]['sort']);_0x261b47[_0x2095('0x46')]=qs[_0x2095('0x3e')](_[_0x2095('0x47')](_0x5808ef[_0x2095('0x3b')],_0x3775ad[_0x2095('0x3e')]));if(_0x5808ef[_0x2095('0x3b')][_0x2095('0x65')]){_0x261b47['where']=_[_0x2095('0x4a')](_0x261b47[_0x2095('0x46')],{'$or':_[_0x2095('0x4b')](_0x261b47[_0x2095('0x40')],function(_0xc02dd6){var _0x46564d={};_0x46564d[_0xc02dd6]={'$like':'%'+_0x5808ef[_0x2095('0x3b')][_0x2095('0x65')]+'%'};return _0x46564d;})});}_0x261b47=_[_0x2095('0x4a')]({},_0x261b47,_0x5808ef['options']);return _0x294f73[_0x2095('0xb7')](_0x261b47);}})[_0x2095('0x1c')](function(_0x44c348){if(_0x44c348){_0x2494cc=_0x44c348[_0x2095('0x42')];if(!_0x5808ef[_0x2095('0x3b')][_0x2095('0x43')](_0x2095('0x6c'))){_0x261b47[_0x2095('0x44')]=qs[_0x2095('0x44')](_0x5808ef['query'][_0x2095('0x44')]);_0x261b47[_0x2095('0x29')]=qs[_0x2095('0x29')](_0x5808ef[_0x2095('0x3b')][_0x2095('0x29')]);}return _0x294f73['getAgents'](_0x261b47);}})[_0x2095('0x1c')](function(_0x2ece5b){if(_0x2ece5b){return _0x2ece5b?{'count':_0x2494cc,'rows':_0x2ece5b}:null;}})['then'](respondWithResult(_0x3701cd,null))[_0x2095('0x52')](handleError(_0x3701cd,null));};exports['send']=function(_0x872330,_0x58bb81,_0x51584f){var _0x53da9e,_0x27d111,_0x229a4c;if(_['isNil'](_0x872330[_0x2095('0x5d')][_0x2095('0x5d')])||_0x872330['body'][_0x2095('0x5d')]===''){throw new db[(_0x2095('0x7b'))]['ValidationError'](_0x2095('0xb8'));}if(_[_0x2095('0x77')](_0x872330['body']['to'])){}_0x53da9e=_0x872330[_0x2095('0x5d')]['to'];return db[_0x2095('0x4f')][_0x2095('0x63')]({'where':{'id':_0x872330[_0x2095('0x54')]['id']}})[_0x2095('0x1c')](handleEntityNotFound(_0x58bb81,null))[_0x2095('0x1c')](function(_0x3cf406){if(_0x3cf406){return db['OpenchannelAccount'][_0x2095('0x55')]({'where':{'id':_0x3cf406['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2095('0x70')],'as':_0x2095('0x81'),'where':{[_0x3cf406['mapKey']]:_0x53da9e},'limit':0x1,'order':[[_0x2095('0x74'),_0x2095('0x82')]]}]}]})[_0x2095('0x1c')](handleEntityNotFound(_0x58bb81,null))[_0x2095('0x1c')](function(_0x35621e){if(_0x35621e&&_0x35621e[_0x2095('0x85')]){_0x27d111=_0x35621e['get']({'plain':!![]});if(_0x27d111[_0x2095('0x85')]&&_0x27d111['List'][_0x2095('0x81')][_0x2095('0x42')]){return _0x27d111[_0x2095('0x85')][_0x2095('0x81')][0x0];}return db[_0x2095('0x70')][_0x2095('0x56')](_['defaults'](_0x872330['body'],{'firstName':_0x53da9e,[_0x35621e[_0x2095('0x7e')]]:_0x53da9e,'phone':_0x53da9e,'ListId':_0x27d111['ListId']}));}})[_0x2095('0x1c')](handleEntityNotFound(_0x58bb81,null))[_0x2095('0x1c')](function(_0xe456f5){if(_0xe456f5){_0x229a4c=_0xe456f5;return db[_0x2095('0x8b')]['find']({'where':{'ContactId':_0x229a4c['id'],'closed':![],'OpenchannelAccountId':_0x27d111['id']}})[_0x2095('0x1c')](function(_0x233cb6){if(_0x233cb6){return[_0x233cb6,![]];}return db['OpenchannelInteraction'][_0x2095('0x56')]({'UserId':_0x872330[_0x2095('0x57')]['id'],'ContactId':_0x229a4c['id'],'OpenchannelAccountId':_0x27d111['id'],'lastMsgDirection':_0x2095('0xb9'),'Messages':[_[_0x2095('0x4a')](_0x872330['body'],{'read':![],'body':_0x872330['body'][_0x2095('0x5d')],'OpenchannelAccountId':_0x27d111['id'],'UserId':_0x872330[_0x2095('0x57')]['id'],'ContactId':_0x229a4c['id']})]},{'include':[{'model':db[_0x2095('0x99')],'as':_0x2095('0xba')}]})[_0x2095('0x1c')](function(_0x15a8cb){return[_0x15a8cb,!![]];});});}})['spread'](function(_0x158dbd,_0x3d8c8c){if(_0x3d8c8c){return _0x158dbd;}return db[_0x2095('0x99')]['create'](_[_0x2095('0x4a')](_0x872330['body'],{'read':![],'body':_0x872330[_0x2095('0x5d')][_0x2095('0x5d')],'OpenchannelAccountId':_0x27d111['id'],'OpenchannelInteractionId':_0x158dbd['id'],'UserId':_0x872330['user']['id'],'ContactId':_0x229a4c['id']}))[_0x2095('0x1c')](function(_0x41c085){_0x158dbd['dataValues'][_0x2095('0xba')]=[];_0x158dbd[_0x2095('0xbb')]['Messages'][_0x2095('0x95')](_0x41c085['dataValues']);return _0x158dbd;});});}})[_0x2095('0x1c')](respondWithResult(_0x58bb81,null))[_0x2095('0x52')](handleError(_0x58bb81,null));}; \ No newline at end of file +var _0x6530=['keys','query','dateStart','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','dateEnd','day','add','merge','filter','map','options','include','findAll','rows','catch','show','params','rawAttributes','filters','fields','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','Disposition','OpenchannelAccountId','includeAll','removeDispositions','CannedAnswer','getAnswers','pick','removeAnswers','ids','notify','openchannel','Sequelize','no\x20available\x20attributes','difference','updatedAt','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','bulkCreate','findAndCountAll','priority','getApplications','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','spread','dataValues','push','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','client','http','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','save','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','index','OpenchannelAccount','model'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x6530,0x134));var _0x0653=function(_0x2766cc,_0x246297){_0x2766cc=_0x2766cc-0x0;var _0x3dd08f=_0x6530[_0x2766cc];return _0x3dd08f;};'use strict';var pdf=require(_0x0653('0x0'));var emlformat=require(_0x0653('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0653('0x2'));var jsonpatch=require(_0x0653('0x3'));var rp=require(_0x0653('0x4'));var moment=require(_0x0653('0x5'));var BPromise=require(_0x0653('0x6'));var Mustache=require(_0x0653('0x7'));var util=require(_0x0653('0x8'));var path=require(_0x0653('0x9'));var sox=require(_0x0653('0xa'));var csv=require('to-csv');var ejs=require(_0x0653('0xb'));var fs=require('fs');var _=require(_0x0653('0xc'));var squel=require(_0x0653('0xd'));var crypto=require('crypto');var jsforce=require(_0x0653('0xe'));var deskjs=require(_0x0653('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0653('0x10'));var Redis=require(_0x0653('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x0653('0x12'))(_0x0653('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0653('0x14'))['db'];config[_0x0653('0x15')]=_[_0x0653('0x16')](config[_0x0653('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x0653('0x17'))(new Redis(config[_0x0653('0x15')]));require(_0x0653('0x18'))[_0x0653('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0653('0x1a')][_0x0653('0x1b')]({'port':0x232c});var client9002=jayson[_0x0653('0x1a')][_0x0653('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x395a9e,_0x33a8d7,_0x2ef0b6,_0x5052d3){return new BPromise(function(_0x34eb50,_0x22780f){var _0x4833fc=_0x5052d3||client;return _0x4833fc['request'](_0x395a9e,_0x2ef0b6)[_0x0653('0x1c')](function(_0x3825fc){logger[_0x0653('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x33a8d7,'request\x20sent');logger[_0x0653('0x1e')](_0x0653('0x1f'),_0x33a8d7,_0x0653('0x20'),JSON[_0x0653('0x21')](_0x3825fc));if(_0x3825fc[_0x0653('0x22')]){if(_0x3825fc[_0x0653('0x22')][_0x0653('0x23')]===0x1f4){logger['error'](_0x0653('0x24'),_0x33a8d7,_0x3825fc[_0x0653('0x22')][_0x0653('0x25')]);return _0x22780f(_0x3825fc[_0x0653('0x22')][_0x0653('0x25')]);}logger[_0x0653('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x33a8d7,_0x3825fc[_0x0653('0x22')][_0x0653('0x25')]);return _0x34eb50(_0x3825fc['error'][_0x0653('0x25')]);}else{logger['info'](_0x0653('0x24'),_0x33a8d7,_0x0653('0x20'));_0x34eb50(_0x3825fc[_0x0653('0x26')][_0x0653('0x25')]);}})['catch'](function(_0x14c37c){logger[_0x0653('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x33a8d7,_0x14c37c);_0x22780f(_0x14c37c);});});}function respondWithStatusCode(_0x331863,_0xf1f746){_0xf1f746=_0xf1f746||0xcc;return function(_0x20aa57){if(_0x20aa57){return _0x331863[_0x0653('0x27')](_0xf1f746);}return _0x331863[_0x0653('0x28')](_0xf1f746)[_0x0653('0x29')]();};}function respondWithResult(_0xad71b2,_0x4aee8a){_0x4aee8a=_0x4aee8a||0xc8;return function(_0x2291b4){if(_0x2291b4){return _0xad71b2['status'](_0x4aee8a)['json'](_0x2291b4);}};}function respondWithFilteredResult(_0xe3dac,_0x1f4a34){return function(_0x2d0f61){if(_0x2d0f61){var _0x1d65df=_0x2d0f61[_0x0653('0x2a')],_0xbaf65c=_0x1f4a34['offset'],_0x5c4e40=_0x1f4a34[_0x0653('0x2b')]+_0x1f4a34[_0x0653('0x2c')],_0x257bf9;if(_0x5c4e40>=_0x1d65df){_0x5c4e40=_0x1d65df;_0x257bf9=0xc8;}else{_0x257bf9=0xce;}_0xe3dac[_0x0653('0x28')](_0x257bf9);return _0xe3dac[_0x0653('0x2d')](_0x0653('0x2e'),_0xbaf65c+'-'+_0x5c4e40+'/'+_0x1d65df)['json'](_0x2d0f61);}return null;};}function patchUpdates(_0x4e0ae0){return function(_0x2f8d1f){try{jsonpatch['apply'](_0x2f8d1f,_0x4e0ae0,!![]);}catch(_0x3d1703){return BPromise['reject'](_0x3d1703);}return _0x2f8d1f[_0x0653('0x2f')]();};}function saveUpdates(_0x5f55f5,_0x2964c0){return function(_0x4c0cd5){if(_0x4c0cd5){return _0x4c0cd5[_0x0653('0x30')](_0x5f55f5)['then'](function(_0x2c5a1d){return _0x2c5a1d;});}return null;};}function removeEntity(_0x59c4b1,_0x5a7550){return function(_0x4ecabe){if(_0x4ecabe){return _0x4ecabe[_0x0653('0x31')]()[_0x0653('0x1c')](function(){var _0x50636c=_0x4ecabe['get']({'plain':!![]});var _0xccbb1d=_0x0653('0x32');return db[_0x0653('0x33')][_0x0653('0x31')]({'where':{'type':_0xccbb1d,'resourceId':_0x50636c['id']}})[_0x0653('0x1c')](function(){return _0x4ecabe;});})[_0x0653('0x1c')](function(){_0x59c4b1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47c407,_0x40799a){return function(_0x76c696){if(!_0x76c696){_0x47c407['sendStatus'](0x194);}return _0x76c696;};}function handleError(_0x1ea260,_0x110cf1){_0x110cf1=_0x110cf1||0x1f4;return function(_0x2977bf){logger['error'](_0x2977bf[_0x0653('0x34')]);if(_0x2977bf[_0x0653('0x35')]){delete _0x2977bf['name'];}_0x1ea260[_0x0653('0x28')](_0x110cf1)[_0x0653('0x36')](_0x2977bf);};}exports[_0x0653('0x37')]=function(_0x59655a,_0x5ca05e){var _0x1f58a7={},_0x2d47b9={},_0x12fba4={'count':0x0,'rows':[]};var _0x19f86c=db[_0x0653('0x38')]['rawAttributes'];_0x2d47b9[_0x0653('0x39')]=_[_0x0653('0x3a')](_0x19f86c);var _0x3f5456={'dateStart':_0x59655a[_0x0653('0x3b')][_0x0653('0x3c')],'dateEnd':_0x59655a[_0x0653('0x3b')]['dateEnd']};delete _0x59655a[_0x0653('0x3b')][_0x0653('0x3c')];delete _0x59655a['query']['dateEnd'];_0x2d47b9[_0x0653('0x3b')]=_[_0x0653('0x3a')](_0x59655a[_0x0653('0x3b')]);_0x2d47b9['filters']=_[_0x0653('0x3d')](_0x2d47b9[_0x0653('0x39')],_0x2d47b9['query']);_0x1f58a7['attributes']=_[_0x0653('0x3d')](_0x2d47b9['model'],qs['fields'](_0x59655a['query']['fields']));_0x1f58a7[_0x0653('0x3e')]=_0x1f58a7['attributes'][_0x0653('0x3f')]?_0x1f58a7[_0x0653('0x3e')]:_0x2d47b9[_0x0653('0x39')];if(!_0x59655a[_0x0653('0x3b')][_0x0653('0x40')](_0x0653('0x41'))){_0x1f58a7['limit']=qs['limit'](_0x59655a[_0x0653('0x3b')]['limit']);_0x1f58a7[_0x0653('0x2b')]=qs[_0x0653('0x2b')](_0x59655a[_0x0653('0x3b')][_0x0653('0x2b')]);}_0x1f58a7[_0x0653('0x42')]=qs[_0x0653('0x43')](_0x59655a[_0x0653('0x3b')][_0x0653('0x43')]);_0x1f58a7[_0x0653('0x44')]=qs['filters'](_['pick'](_0x59655a[_0x0653('0x3b')],_0x2d47b9['filters']));if(_0x3f5456[_0x0653('0x3c')]){if(_0x3f5456['dateEnd']){_0x3f5456[_0x0653('0x45')]=moment(_0x3f5456[_0x0653('0x45')])['add'](0x1,_0x0653('0x46'));}else{_0x3f5456[_0x0653('0x45')]=moment(_0x3f5456[_0x0653('0x3c')])[_0x0653('0x47')](0x1,'day');}_[_0x0653('0x48')](_0x1f58a7[_0x0653('0x44')],{'createdAt':{'$gte':_0x3f5456['dateStart'],'$lte':_0x3f5456['dateEnd']}});}if(_0x59655a[_0x0653('0x3b')][_0x0653('0x49')]){_0x1f58a7[_0x0653('0x44')]=_[_0x0653('0x48')](_0x1f58a7[_0x0653('0x44')],{'$or':_[_0x0653('0x4a')](_0x1f58a7[_0x0653('0x3e')],function(_0x471a05){var _0x364113={};_0x364113[_0x471a05]={'$like':'%'+_0x59655a[_0x0653('0x3b')][_0x0653('0x49')]+'%'};return _0x364113;})});}_0x1f58a7=_[_0x0653('0x48')]({},_0x1f58a7,_0x59655a[_0x0653('0x4b')]);var _0x52a88c={'where':_0x1f58a7[_0x0653('0x44')]};return db['OpenchannelAccount']['count'](_0x52a88c)[_0x0653('0x1c')](function(_0x2904a4){_0x12fba4[_0x0653('0x2a')]=_0x2904a4;if(_0x59655a[_0x0653('0x3b')]['includeAll']){_0x1f58a7[_0x0653('0x4c')]=[{'all':!![]}];}return db[_0x0653('0x38')][_0x0653('0x4d')](_0x1f58a7);})['then'](function(_0x546d8a){_0x12fba4[_0x0653('0x4e')]=_0x546d8a;return _0x12fba4;})[_0x0653('0x1c')](respondWithFilteredResult(_0x5ca05e,_0x1f58a7))[_0x0653('0x4f')](handleError(_0x5ca05e,null));};exports[_0x0653('0x50')]=function(_0x1efc8f,_0x5b86e7){var _0x39f493={'raw':![],'where':{'id':_0x1efc8f[_0x0653('0x51')]['id']}},_0x18e432={};_0x18e432['model']=_[_0x0653('0x3a')](db[_0x0653('0x38')][_0x0653('0x52')]);_0x18e432[_0x0653('0x3b')]=_[_0x0653('0x3a')](_0x1efc8f[_0x0653('0x3b')]);_0x18e432[_0x0653('0x53')]=_[_0x0653('0x3d')](_0x18e432['model'],_0x18e432[_0x0653('0x3b')]);_0x39f493[_0x0653('0x3e')]=_[_0x0653('0x3d')](_0x18e432[_0x0653('0x39')],qs[_0x0653('0x54')](_0x1efc8f[_0x0653('0x3b')]['fields']));_0x39f493[_0x0653('0x3e')]=_0x39f493[_0x0653('0x3e')]['length']?_0x39f493['attributes']:_0x18e432[_0x0653('0x39')];if(_0x1efc8f[_0x0653('0x3b')]['includeAll']){_0x39f493[_0x0653('0x4c')]=[{'all':!![]}];}_0x39f493=_[_0x0653('0x48')]({},_0x39f493,_0x1efc8f['options']);return db[_0x0653('0x38')][_0x0653('0x55')](_0x39f493)[_0x0653('0x1c')](handleEntityNotFound(_0x5b86e7,null))[_0x0653('0x1c')](respondWithResult(_0x5b86e7,null))[_0x0653('0x4f')](handleError(_0x5b86e7,null));};exports[_0x0653('0x56')]=function(_0x1c71eb,_0x2455d0){return db[_0x0653('0x38')]['create'](_0x1c71eb[_0x0653('0x57')],{})[_0x0653('0x1c')](function(_0x362ad5){var _0x5b15ed=_0x1c71eb[_0x0653('0x58')][_0x0653('0x59')]({'plain':!![]});if(!_0x5b15ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b15ed[_0x0653('0x5a')]===_0x0653('0x58')){var _0x1b90ec=_0x362ad5['get']({'plain':!![]});var _0x2be016=_0x0653('0x32');return db[_0x0653('0x5b')][_0x0653('0x55')]({'where':{'name':_0x2be016,'userProfileId':_0x5b15ed[_0x0653('0x5c')]},'raw':!![]})[_0x0653('0x1c')](function(_0x1d46e4){if(_0x1d46e4&&_0x1d46e4[_0x0653('0x5d')]===0x0){return db[_0x0653('0x33')]['create']({'name':_0x1b90ec[_0x0653('0x35')],'resourceId':_0x1b90ec['id'],'type':_0x1d46e4[_0x0653('0x35')],'sectionId':_0x1d46e4['id']},{})[_0x0653('0x1c')](function(){return _0x362ad5;});}else{return _0x362ad5;}})['catch'](function(_0x54795c){logger[_0x0653('0x22')](_0x0653('0x5e'),_0x54795c);throw _0x54795c;});}return _0x362ad5;})[_0x0653('0x1c')](respondWithResult(_0x2455d0,0xc9))[_0x0653('0x4f')](handleError(_0x2455d0,null));};exports[_0x0653('0x30')]=function(_0xd9204a,_0x1d2172){if(_0xd9204a['body']['id']){delete _0xd9204a[_0x0653('0x57')]['id'];}return db[_0x0653('0x38')][_0x0653('0x55')]({'where':{'id':_0xd9204a[_0x0653('0x51')]['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x1d2172,null))['then'](saveUpdates(_0xd9204a[_0x0653('0x57')],null))[_0x0653('0x1c')](respondWithResult(_0x1d2172,null))[_0x0653('0x4f')](handleError(_0x1d2172,null));};exports[_0x0653('0x31')]=function(_0x4c6620,_0x1cebfb){return db['OpenchannelAccount']['find']({'where':{'id':_0x4c6620[_0x0653('0x51')]['id']}})['then'](handleEntityNotFound(_0x1cebfb,null))[_0x0653('0x1c')](removeEntity(_0x1cebfb,null))['catch'](handleError(_0x1cebfb,null));};exports[_0x0653('0x5f')]=function(_0x4910ae,_0x262fc2){return db[_0x0653('0x38')][_0x0653('0x5f')]()[_0x0653('0x1c')](respondWithResult(_0x262fc2,null))[_0x0653('0x4f')](handleError(_0x262fc2,null));};exports[_0x0653('0x60')]=function(_0x42292e,_0x11a914,_0x25386b){if(_0x42292e[_0x0653('0x57')]['id']){delete _0x42292e[_0x0653('0x57')]['id'];}return db[_0x0653('0x38')]['find']({'where':{'id':_0x42292e[_0x0653('0x51')]['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x11a914,null))[_0x0653('0x1c')](function(_0x33c019){if(_0x33c019){_0x42292e[_0x0653('0x57')][_0x0653('0x61')]=_0x33c019['id'];return db['Disposition'][_0x0653('0x56')](_0x42292e[_0x0653('0x57')]);}})[_0x0653('0x1c')](respondWithResult(_0x11a914,null))[_0x0653('0x4f')](handleError(_0x11a914,null));};exports[_0x0653('0x62')]=function(_0x4d10c3,_0x2703cc,_0x4f7ec4){var _0x4907cc={'raw':![],'where':{}};var _0x605420={};var _0x298881={'count':0x0,'rows':[]};return db[_0x0653('0x38')][_0x0653('0x63')]({'where':{'id':_0x4d10c3['params']['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x2703cc,null))['then'](function(_0x527e91){if(_0x527e91){_0x605420['model']=_['keys'](db[_0x0653('0x64')]['rawAttributes']);_0x605420[_0x0653('0x3b')]=_[_0x0653('0x3a')](_0x4d10c3[_0x0653('0x3b')]);_0x605420['filters']=_[_0x0653('0x3d')](_0x605420[_0x0653('0x39')],_0x605420[_0x0653('0x3b')]);_0x4907cc[_0x0653('0x3e')]=_['intersection'](_0x605420[_0x0653('0x39')],qs[_0x0653('0x54')](_0x4d10c3[_0x0653('0x3b')][_0x0653('0x54')]));_0x4907cc['attributes']=_0x4907cc['attributes']['length']?_0x4907cc[_0x0653('0x3e')]:_0x605420[_0x0653('0x39')];if(!_0x4d10c3[_0x0653('0x3b')][_0x0653('0x40')](_0x0653('0x41'))){_0x4907cc[_0x0653('0x2c')]=qs[_0x0653('0x2c')](_0x4d10c3[_0x0653('0x3b')]['limit']);_0x4907cc[_0x0653('0x2b')]=qs[_0x0653('0x2b')](_0x4d10c3[_0x0653('0x3b')]['offset']);}_0x4907cc[_0x0653('0x42')]=qs[_0x0653('0x43')](_0x4d10c3[_0x0653('0x3b')][_0x0653('0x43')]);_0x4907cc[_0x0653('0x44')]=qs[_0x0653('0x53')](_['pick'](_0x4d10c3['query'],_0x605420[_0x0653('0x53')]));_0x4907cc[_0x0653('0x44')][_0x0653('0x65')]=_0x527e91['id'];if(_0x4d10c3['query'][_0x0653('0x49')]){_0x4907cc[_0x0653('0x44')]=_[_0x0653('0x48')](_0x4907cc[_0x0653('0x44')],{'$or':_[_0x0653('0x4a')](_0x4907cc[_0x0653('0x3e')],function(_0x46eaca){var _0x83eaa2={};_0x83eaa2[_0x46eaca]={'$like':'%'+_0x4d10c3[_0x0653('0x3b')][_0x0653('0x49')]+'%'};return _0x83eaa2;})});}_0x4907cc=_[_0x0653('0x48')]({},_0x4907cc,_0x4d10c3['options']);return db[_0x0653('0x64')][_0x0653('0x2a')]({'where':_0x4907cc['where']})[_0x0653('0x1c')](function(_0x1364d3){_0x298881['count']=_0x1364d3;if(_0x4d10c3[_0x0653('0x3b')][_0x0653('0x66')]){_0x4907cc[_0x0653('0x4c')]=[{'all':!![]}];}return db[_0x0653('0x64')][_0x0653('0x4d')](_0x4907cc);})['then'](function(_0x3b182f){_0x298881[_0x0653('0x4e')]=_0x3b182f;return _0x298881;});}})['then'](respondWithFilteredResult(_0x2703cc,_0x4907cc))[_0x0653('0x4f')](handleError(_0x2703cc,null));};exports[_0x0653('0x67')]=function(_0x803bb5,_0x2d42a0,_0x18652e){var _0x2f00f7;return db['OpenchannelAccount']['find']({'where':{'id':_0x803bb5[_0x0653('0x51')]['id']}})['then'](handleEntityNotFound(_0x2d42a0,null))['then'](function(_0x442c6b){if(_0x442c6b){return _0x442c6b[_0x0653('0x67')](_0x803bb5[_0x0653('0x3b')]['ids']);}})[_0x0653('0x1c')](respondWithStatusCode(_0x2d42a0,null))[_0x0653('0x4f')](handleError(_0x2d42a0,null));};exports['addAnswer']=function(_0x55fb4f,_0x4a3575,_0x3a6c6c){if(_0x55fb4f[_0x0653('0x57')]['id']){delete _0x55fb4f[_0x0653('0x57')]['id'];}return db[_0x0653('0x38')]['find']({'where':{'id':_0x55fb4f['params']['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x4a3575,null))[_0x0653('0x1c')](function(_0x390511){if(_0x390511){_0x55fb4f['body'][_0x0653('0x65')]=_0x390511['id'];return db[_0x0653('0x68')]['create'](_0x55fb4f['body']);}})['then'](respondWithResult(_0x4a3575,null))[_0x0653('0x4f')](handleError(_0x4a3575,null));};exports[_0x0653('0x69')]=function(_0xfbb8b9,_0x2cacfb,_0x208d31){var _0x49f48e={'raw':![],'where':{}};var _0x53bbb4={};var _0x424b8e={'count':0x0,'rows':[]};return db[_0x0653('0x38')][_0x0653('0x63')]({'where':{'id':_0xfbb8b9[_0x0653('0x51')]['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x2cacfb,null))['then'](function(_0x8feef2){if(_0x8feef2){_0x53bbb4[_0x0653('0x39')]=_[_0x0653('0x3a')](db[_0x0653('0x68')][_0x0653('0x52')]);_0x53bbb4[_0x0653('0x3b')]=_[_0x0653('0x3a')](_0xfbb8b9[_0x0653('0x3b')]);_0x53bbb4[_0x0653('0x53')]=_[_0x0653('0x3d')](_0x53bbb4['model'],_0x53bbb4[_0x0653('0x3b')]);_0x49f48e[_0x0653('0x3e')]=_[_0x0653('0x3d')](_0x53bbb4[_0x0653('0x39')],qs['fields'](_0xfbb8b9[_0x0653('0x3b')]['fields']));_0x49f48e[_0x0653('0x3e')]=_0x49f48e[_0x0653('0x3e')]['length']?_0x49f48e[_0x0653('0x3e')]:_0x53bbb4[_0x0653('0x39')];if(!_0xfbb8b9[_0x0653('0x3b')]['hasOwnProperty'](_0x0653('0x41'))){_0x49f48e[_0x0653('0x2c')]=qs[_0x0653('0x2c')](_0xfbb8b9[_0x0653('0x3b')][_0x0653('0x2c')]);_0x49f48e['offset']=qs[_0x0653('0x2b')](_0xfbb8b9[_0x0653('0x3b')]['offset']);}_0x49f48e[_0x0653('0x42')]=qs['sort'](_0xfbb8b9['query'][_0x0653('0x43')]);_0x49f48e[_0x0653('0x44')]=qs[_0x0653('0x53')](_[_0x0653('0x6a')](_0xfbb8b9[_0x0653('0x3b')],_0x53bbb4[_0x0653('0x53')]));_0x49f48e[_0x0653('0x44')][_0x0653('0x65')]=_0x8feef2['id'];if(_0xfbb8b9[_0x0653('0x3b')][_0x0653('0x49')]){_0x49f48e[_0x0653('0x44')]=_[_0x0653('0x48')](_0x49f48e[_0x0653('0x44')],{'$or':_['map'](_0x49f48e[_0x0653('0x3e')],function(_0x47cea4){var _0x1daa90={};_0x1daa90[_0x47cea4]={'$like':'%'+_0xfbb8b9[_0x0653('0x3b')]['filter']+'%'};return _0x1daa90;})});}_0x49f48e=_[_0x0653('0x48')]({},_0x49f48e,_0xfbb8b9[_0x0653('0x4b')]);return db['CannedAnswer']['count']({'where':_0x49f48e[_0x0653('0x44')]})[_0x0653('0x1c')](function(_0x4c22dc){_0x424b8e[_0x0653('0x2a')]=_0x4c22dc;if(_0xfbb8b9[_0x0653('0x3b')][_0x0653('0x66')]){_0x49f48e[_0x0653('0x4c')]=[{'all':!![]}];}return db[_0x0653('0x68')][_0x0653('0x4d')](_0x49f48e);})['then'](function(_0x1fa1e9){_0x424b8e[_0x0653('0x4e')]=_0x1fa1e9;return _0x424b8e;});}})[_0x0653('0x1c')](respondWithFilteredResult(_0x2cacfb,_0x49f48e))[_0x0653('0x4f')](handleError(_0x2cacfb,null));};exports[_0x0653('0x6b')]=function(_0x29daeb,_0x3ed4d4,_0x57fb75){var _0x58ca86;return db[_0x0653('0x38')][_0x0653('0x55')]({'where':{'id':_0x29daeb[_0x0653('0x51')]['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x3ed4d4,null))[_0x0653('0x1c')](function(_0x11a6b5){if(_0x11a6b5){return _0x11a6b5[_0x0653('0x6b')](_0x29daeb[_0x0653('0x3b')][_0x0653('0x6c')]);}})[_0x0653('0x1c')](respondWithStatusCode(_0x3ed4d4,null))[_0x0653('0x4f')](handleError(_0x3ed4d4,null));};exports[_0x0653('0x6d')]=function(_0x558da1,_0x579868,_0x4fde33){var _0x494127={'body':_0x558da1[_0x0653('0x57')],'channel':_0x0653('0x6e')};var _0x5ecaad=[];var _0x210b74=[];var _0x4f331e={};var _0x20f474=![];return db['CmContact'][_0x0653('0x5f')]()[_0x0653('0x1c')](function(_0x42c2a4){if(!_0x42c2a4){throw new db[(_0x0653('0x6f'))]['ValidationError'](_0x0653('0x70'));}_0x5ecaad=_[_0x0653('0x71')](_[_0x0653('0x3a')](_0x42c2a4),['createdAt',_0x0653('0x72')]);_0x210b74=_[_0x0653('0x71')](_['keys'](_0x42c2a4),['createdAt',_0x0653('0x72'),'CompanyId','ListId']);if(_0x558da1['body']['id']){delete _0x558da1[_0x0653('0x57')]['id'];}if(_[_0x0653('0x73')](_0x558da1[_0x0653('0x57')][_0x0653('0x74')])){throw new db[(_0x0653('0x6f'))][(_0x0653('0x75'))]('from\x20is\x20mandatory');}if(_[_0x0653('0x73')](_0x558da1[_0x0653('0x57')][_0x0653('0x57')])||_0x558da1[_0x0653('0x57')][_0x0653('0x57')]===''){throw new db[(_0x0653('0x6f'))][(_0x0653('0x75'))](_0x0653('0x76'));}if(_[_0x0653('0x73')](_0x558da1[_0x0653('0x57')]['mapKey'])){throw new db[(_0x0653('0x6f'))][(_0x0653('0x75'))](_0x0653('0x77')+_0x210b74);}if(!_[_0x0653('0x78')](_0x210b74,_0x558da1[_0x0653('0x57')][_0x0653('0x79')])){throw new db[(_0x0653('0x6f'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x210b74);}_0x4f331e[_0x558da1[_0x0653('0x57')][_0x0653('0x79')]]=_0x558da1[_0x0653('0x57')]['from'];})[_0x0653('0x1c')](function(){return db[_0x0653('0x38')][_0x0653('0x55')]({'where':{'id':_0x558da1['params']['id']},'include':[{'model':db['CmList'],'as':_0x0653('0x7a'),'include':[{'model':db[_0x0653('0x7b')],'as':_0x0653('0x7c'),'where':_0x4f331e,'limit':0x1,'order':[[_0x0653('0x72'),_0x0653('0x7d')]]}]},{'model':db[_0x0653('0x7e')],'as':_0x0653('0x7f')}]});})[_0x0653('0x1c')](handleEntityNotFound(_0x579868,null))[_0x0653('0x1c')](function(_0x198068){if(_0x198068&&_0x198068[_0x0653('0x7a')]){_0x494127[_0x0653('0x80')]=_0x198068;_0x494127[_0x0653('0x81')]=_0x198068[_0x0653('0x7f')];_0x494127[_0x0653('0x82')]=_0x198068[_0x0653('0x7a')];_0x494127[_0x0653('0x81')]=_[_0x0653('0x83')](_0x494127[_0x0653('0x81')],['priority'],[_0x0653('0x84')]);if(_0x494127['account'][_0x0653('0x7f')]){delete _0x494127[_0x0653('0x80')][_0x0653('0x7f')];}if(_0x494127[_0x0653('0x80')][_0x0653('0x7a')]&&_0x494127['account'][_0x0653('0x7a')][_0x0653('0x7c')][_0x0653('0x3f')]){return _0x494127[_0x0653('0x80')]['List'][_0x0653('0x7c')][0x0];}var _0x5c5d3d=_[_0x0653('0x16')](_0x558da1[_0x0653('0x57')],{'firstName':_0x558da1[_0x0653('0x57')][_0x0653('0x74')],'ListId':_0x198068[_0x0653('0x85')]});_0x5c5d3d[_0x558da1[_0x0653('0x57')]['mapKey']]=_0x558da1[_0x0653('0x57')]['from'];return db[_0x0653('0x7b')]['create'](_0x5c5d3d,{'fields':_0x5ecaad,'raw':!![]});}})[_0x0653('0x1c')](handleEntityNotFound(_0x579868,null))[_0x0653('0x1c')](function(_0x20b133){_0x494127[_0x0653('0x86')]=_0x20b133;if(_0x20b133){var _0x465f94={'ContactId':_0x20b133['id'],'OpenchannelAccountId':_0x558da1['params']['id'],'from':(_0x20b133[_0x0653('0x87')]||'')+'\x20'+(_0x20b133[_0x0653('0x88')]||'')};var _0x49a70d={'OpenchannelAccountId':_0x558da1[_0x0653('0x51')]['id'],'closed':![]};if(_0x558da1[_0x0653('0x57')][_0x0653('0x89')]){_0x49a70d['threadId']=_0x558da1['body']['threadId'];return db[_0x0653('0x8a')][_0x0653('0x55')]({'where':_0x49a70d})[_0x0653('0x1c')](function(_0x5e837d){if(_0x5e837d){return[_0x5e837d,![]];}_0x465f94[_0x0653('0x89')]=_0x558da1[_0x0653('0x57')][_0x0653('0x89')];_0x465f94[_0x0653('0x8b')]=_0x558da1[_0x0653('0x57')][_0x0653('0x8b')];return db[_0x0653('0x8a')][_0x0653('0x56')](_0x465f94)['then'](function(_0x25d55e){return[_0x25d55e,!![]];});});}else{_0x49a70d[_0x0653('0x89')]=null;}_0x49a70d[_0x0653('0x8c')]=_0x20b133['id'];return db['OpenchannelInteraction']['find']({'where':_0x49a70d})[_0x0653('0x1c')](function(_0x2a0e5d){if(_0x2a0e5d){return[_0x2a0e5d,![]];}return db[_0x0653('0x8a')]['create'](_0x465f94)['then'](function(_0x3d5734){return[_0x3d5734,!![]];});});}})['spread'](function(_0x5bba67,_0x5c2019){if(_0x5bba67){_0x20f474=_0x5c2019;if(!_0x5c2019){var _0x39b178={'from':(_0x494127[_0x0653('0x86')][_0x0653('0x87')]||'')+'\x20'+(_0x494127[_0x0653('0x86')][_0x0653('0x88')]||'')};if(_0x558da1[_0x0653('0x57')]['threadId']&&_0x558da1[_0x0653('0x57')][_0x0653('0x8d')]&&_0x558da1[_0x0653('0x57')]['threadId']!=_0x558da1['body']['messageId']){_0x39b178[_0x0653('0x89')]=_0x558da1[_0x0653('0x57')][_0x0653('0x8d')];}return _0x5bba67[_0x0653('0x30')](_0x39b178);}else{return _0x5bba67;}}})[_0x0653('0x1c')](function(_0x55e2d5){_0x494127[_0x0653('0x8e')]=_0x55e2d5[_0x0653('0x59')]({'plain':!![]});_0x494127[_0x0653('0x8e')][_0x0653('0x8f')]=_0x20f474;if(_0x494127[_0x0653('0x8e')][_0x0653('0x8f')]){if(_0x494127[_0x0653('0x80')]['autoclose']){_0x494127[_0x0653('0x81')]['push']({'id':0x0,'priority':_0x494127[_0x0653('0x81')][_0x0653('0x3f')]+0x1,'app':'close','appdata':_0x0653('0x90'),'interval':'*,*,*,*'});}}return db[_0x0653('0x91')][_0x0653('0x56')]({'body':_0x558da1[_0x0653('0x57')]['body'],'OpenchannelAccountId':_0x558da1[_0x0653('0x51')]['id'],'OpenchannelInteractionId':_0x55e2d5['id'],'direction':'in','ContactId':_0x494127[_0x0653('0x86')]['id'],'AttachmentId':_0x558da1[_0x0653('0x57')][_0x0653('0x92')]});})[_0x0653('0x1c')](function(_0x42870a){_0x494127[_0x0653('0x25')]=_0x42870a;if(_0x494127[_0x0653('0x8e')][_0x0653('0x93')]){return db[_0x0653('0x94')][_0x0653('0x55')]({'attributes':['id','name'],'where':{'id':_0x494127[_0x0653('0x8e')][_0x0653('0x93')]}})['then'](function(_0x24d1d3){if(_0x24d1d3){_0x494127[_0x0653('0x81')][_0x0653('0x95')]({'id':0x0,'priority':0x0,'app':_0x0653('0x96'),'appdata':_0x24d1d3[_0x0653('0x35')]+','+(_0x494127[_0x0653('0x80')][_0x0653('0x97')]||0xa),'interval':_0x0653('0x98')});_0x494127[_0x0653('0x99')]=![];}return respondWithRpcPromise(_0x0653('0x9a'),_0x0653('0x9b'),_0x494127);});}return respondWithRpcPromise(_0x0653('0x9a'),_0x0653('0x9b'),_0x494127);})['then'](function(_0x5e722f){respondWithRpcPromise('EventManager',_0x0653('0x9c'),{'event':'notify','message':_0x5e722f},client9002);return _0x5e722f;})[_0x0653('0x1c')](respondWithResult(_0x579868,null))['catch'](handleError(_0x579868,null));};exports[_0x0653('0x9d')]=function(_0x19df35,_0x1a33b3,_0x48a342){return db[_0x0653('0x38')][_0x0653('0x63')]({'where':{'id':_0x19df35[_0x0653('0x51')]['id']}})['then'](handleEntityNotFound(_0x1a33b3,null))[_0x0653('0x1c')](function(_0x3dfde5){if(_0x3dfde5){return db['sequelize']['transaction'](function(_0x438dc5){return db[_0x0653('0x7e')][_0x0653('0x31')]({'where':{'OpenchannelAccountId':_0x19df35[_0x0653('0x51')]['id']},'transaction':_0x438dc5})[_0x0653('0x1c')](function(_0x3ad180){var _0xd8ad06=_[_0x0653('0x4a')](_0x19df35[_0x0653('0x57')],function(_0x2ecb90){_0x2ecb90[_0x0653('0x65')]=_0x19df35[_0x0653('0x51')]['id'];return _0x2ecb90;});return db[_0x0653('0x7e')][_0x0653('0x9e')](_0xd8ad06,{'transaction':_0x438dc5});});})[_0x0653('0x1c')](function(){return db[_0x0653('0x7e')][_0x0653('0x9f')]({'where':{'OpenchannelAccountId':_0x19df35[_0x0653('0x51')]['id']},'order':_0x0653('0xa0')});});}})[_0x0653('0x1c')](respondWithResult(_0x1a33b3,null))[_0x0653('0x4f')](handleError(_0x1a33b3,null));};exports[_0x0653('0xa1')]=function(_0x273d1b,_0x3542c0,_0x1f8d9f){var _0x5bf991={};var _0x4df354={};var _0x174a98;var _0x3623f3;return db[_0x0653('0x38')][_0x0653('0x63')]({'where':{'id':_0x273d1b[_0x0653('0x51')]['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x3542c0,null))[_0x0653('0x1c')](function(_0x23f10b){if(_0x23f10b){_0x174a98=_0x23f10b;_0x4df354[_0x0653('0x39')]=_[_0x0653('0x3a')](db[_0x0653('0x7e')][_0x0653('0x52')]);_0x4df354[_0x0653('0x3b')]=_[_0x0653('0x3a')](_0x273d1b[_0x0653('0x3b')]);_0x4df354[_0x0653('0x53')]=_[_0x0653('0x3d')](_0x4df354[_0x0653('0x39')],_0x4df354[_0x0653('0x3b')]);_0x5bf991[_0x0653('0x3e')]=_[_0x0653('0x3d')](_0x4df354['model'],qs[_0x0653('0x54')](_0x273d1b[_0x0653('0x3b')][_0x0653('0x54')]));_0x5bf991[_0x0653('0x3e')]=_0x5bf991['attributes'][_0x0653('0x3f')]?_0x5bf991[_0x0653('0x3e')]:_0x4df354[_0x0653('0x39')];_0x5bf991['order']=qs[_0x0653('0x43')](_0x273d1b[_0x0653('0x3b')][_0x0653('0x43')]);_0x5bf991[_0x0653('0x44')]=qs[_0x0653('0x53')](_[_0x0653('0x6a')](_0x273d1b[_0x0653('0x3b')],_0x4df354[_0x0653('0x53')]));if(_0x273d1b[_0x0653('0x3b')][_0x0653('0x49')]){_0x5bf991[_0x0653('0x44')]=_['merge'](_0x5bf991[_0x0653('0x44')],{'$or':_[_0x0653('0x4a')](_0x5bf991['attributes'],function(_0x1043b3){var _0x4a693d={};_0x4a693d[_0x1043b3]={'$like':'%'+_0x273d1b[_0x0653('0x3b')][_0x0653('0x49')]+'%'};return _0x4a693d;})});}_0x5bf991=_[_0x0653('0x48')]({},_0x5bf991,_0x273d1b[_0x0653('0x4b')]);return _0x174a98['getApplications'](_0x5bf991);}})[_0x0653('0x1c')](function(_0xbc4c84){if(_0xbc4c84){_0x3623f3=_0xbc4c84[_0x0653('0x3f')];if(!_0x273d1b[_0x0653('0x3b')][_0x0653('0x40')](_0x0653('0x41'))){_0x5bf991[_0x0653('0x2c')]=qs[_0x0653('0x2c')](_0x273d1b[_0x0653('0x3b')][_0x0653('0x2c')]);_0x5bf991['offset']=qs[_0x0653('0x2b')](_0x273d1b['query'][_0x0653('0x2b')]);}return _0x174a98['getApplications'](_0x5bf991);}})[_0x0653('0x1c')](function(_0x112e9f){if(_0x112e9f){return _0x112e9f?{'count':_0x3623f3,'rows':_0x112e9f}:null;}})[_0x0653('0x1c')](respondWithResult(_0x3542c0,null))[_0x0653('0x4f')](handleError(_0x3542c0,null));};exports['getInteractions']=function(_0x47eb7e,_0x2979e5,_0x148d0e){var _0x5a8d11={'raw':![],'where':{}};var _0x4e7238={};var _0x452707={'count':0x0,'rows':[]};return db[_0x0653('0x38')][_0x0653('0x63')]({'where':{'id':_0x47eb7e[_0x0653('0x51')]['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x2979e5,null))[_0x0653('0x1c')](function(_0xc2712d){if(_0xc2712d){_0x4e7238[_0x0653('0x39')]=_[_0x0653('0x3a')](db[_0x0653('0x8a')][_0x0653('0x52')]);_0x4e7238[_0x0653('0x3b')]=_[_0x0653('0x3a')](_0x47eb7e[_0x0653('0x3b')]);_0x4e7238[_0x0653('0x53')]=_[_0x0653('0x3d')](_0x4e7238['model'],_0x4e7238[_0x0653('0x3b')]);_0x5a8d11[_0x0653('0x3e')]=_[_0x0653('0x3d')](_0x4e7238[_0x0653('0x39')],qs['fields'](_0x47eb7e[_0x0653('0x3b')]['fields']));_0x5a8d11[_0x0653('0x3e')]=_0x5a8d11[_0x0653('0x3e')][_0x0653('0x3f')]?_0x5a8d11[_0x0653('0x3e')]:_0x4e7238[_0x0653('0x39')];if(!_0x47eb7e['query'][_0x0653('0x40')](_0x0653('0x41'))){_0x5a8d11[_0x0653('0x2c')]=qs[_0x0653('0x2c')](_0x47eb7e['query']['limit']);_0x5a8d11['offset']=qs['offset'](_0x47eb7e['query'][_0x0653('0x2b')]);}_0x5a8d11['order']=qs['sort'](_0x47eb7e[_0x0653('0x3b')][_0x0653('0x43')]);_0x5a8d11['where']=qs['filters'](_[_0x0653('0x6a')](_0x47eb7e['query'],_0x4e7238['filters']));_0x5a8d11[_0x0653('0x44')][_0x0653('0x65')]=_0xc2712d['id'];if(_0x47eb7e[_0x0653('0x3b')][_0x0653('0x49')]){_0x5a8d11['where']=_[_0x0653('0x48')](_0x5a8d11[_0x0653('0x44')],{'$or':_[_0x0653('0x4a')](_0x5a8d11['attributes'],function(_0x35841c){var _0x3bf853={};_0x3bf853[_0x35841c]={'$like':'%'+_0x47eb7e['query'][_0x0653('0x49')]+'%'};return _0x3bf853;})});}_0x5a8d11=_[_0x0653('0x48')]({},_0x5a8d11,_0x47eb7e[_0x0653('0x4b')]);return db[_0x0653('0x8a')][_0x0653('0x2a')]({'where':_0x5a8d11[_0x0653('0x44')]})[_0x0653('0x1c')](function(_0x22d6f0){_0x452707[_0x0653('0x2a')]=_0x22d6f0;if(_0x47eb7e[_0x0653('0x3b')][_0x0653('0x66')]){_0x5a8d11['include']=[{'model':db[_0x0653('0x7b')],'as':_0x0653('0xa2'),'required':![]},{'model':db[_0x0653('0x94')],'as':'Owner','attributes':[_0x0653('0x35'),_0x0653('0xa3'),_0x0653('0xa4')],'required':![]},{'model':db[_0x0653('0xa5')],'as':_0x0653('0xa6'),'attributes':['id',_0x0653('0x35'),_0x0653('0xa7')],'where':_0x47eb7e[_0x0653('0x3b')][_0x0653('0xa8')]?{'id':_0x47eb7e[_0x0653('0x3b')][_0x0653('0xa8')]}:undefined,'required':_0x47eb7e[_0x0653('0x3b')][_0x0653('0xa8')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x5a8d11);})[_0x0653('0x1c')](function(_0x5e7465){_0x452707[_0x0653('0x4e')]=_0x5e7465;return _0x452707;});}})[_0x0653('0x1c')](respondWithFilteredResult(_0x2979e5,_0x5a8d11))[_0x0653('0x4f')](handleError(_0x2979e5,null));};exports[_0x0653('0xa9')]=function(_0x2f40da,_0x1221dd,_0x38d8d7){return db[_0x0653('0x38')][_0x0653('0x55')]({'where':{'id':_0x2f40da[_0x0653('0x51')]['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x1221dd,null))[_0x0653('0x1c')](function(_0x55617a){if(_0x55617a){return _0x55617a[_0x0653('0xa9')](_0x2f40da[_0x0653('0x57')][_0x0653('0x6c')],_[_0x0653('0xaa')](_0x2f40da[_0x0653('0x57')],[_0x0653('0x6c'),'id'])||{})['spread'](function(_0x5f482d){for(var _0x1e05b7=0x0;_0x1e05b7<_0x2f40da[_0x0653('0x57')]['ids'][_0x0653('0x3f')];_0x1e05b7+=0x1){socket['emit'](_0x0653('0xab'),{'UserId':_0x2f40da[_0x0653('0x57')][_0x0653('0x6c')][_0x1e05b7],'OpenchannelAccountId':_0x2f40da[_0x0653('0x51')]['id']});}return _0x5f482d;});}})[_0x0653('0x1c')](respondWithResult(_0x1221dd,null))[_0x0653('0x4f')](handleError(_0x1221dd,null));};exports[_0x0653('0xac')]=function(_0x44a823,_0x3834d7,_0x41b4b2){var _0x4cfdbc;return db['OpenchannelAccount']['find']({'where':{'id':_0x44a823[_0x0653('0x51')]['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x3834d7,null))[_0x0653('0x1c')](function(_0x374c88){if(_0x374c88){return _0x374c88['removeAgents'](_0x44a823[_0x0653('0x3b')][_0x0653('0x6c')])[_0x0653('0x1c')](function(_0x3dce6e){if(_[_0x0653('0xad')](_0x44a823[_0x0653('0x3b')][_0x0653('0x6c')])){for(var _0x236c7f=0x0;_0x236c7f<_0x44a823['query'][_0x0653('0x6c')][_0x0653('0x3f')];_0x236c7f+=0x1){socket[_0x0653('0xae')](_0x0653('0xaf'),{'UserId':_0x44a823[_0x0653('0x3b')][_0x0653('0x6c')][_0x236c7f],'OpenchannelAccountId':_0x44a823[_0x0653('0x51')]['id']});}}else{socket[_0x0653('0xae')](_0x0653('0xaf'),{'UserId':_0x44a823[_0x0653('0x3b')][_0x0653('0x6c')],'OpenchannelAccountId':_0x44a823['params']['id']});}});}})[_0x0653('0x1c')](respondWithStatusCode(_0x3834d7,null))[_0x0653('0x4f')](handleError(_0x3834d7,null));};exports['getAgents']=function(_0x4f7771,_0x3a7c3c,_0x181f87){var _0x3286ed={};var _0x3dab6f={};var _0x1eac5a;var _0x4cec69;return db['OpenchannelAccount'][_0x0653('0x63')]({'where':{'id':_0x4f7771[_0x0653('0x51')]['id']}})[_0x0653('0x1c')](handleEntityNotFound(_0x3a7c3c,null))[_0x0653('0x1c')](function(_0x20251b){if(_0x20251b){_0x1eac5a=_0x20251b;_0x3dab6f[_0x0653('0x39')]=_[_0x0653('0x3a')](db['User'][_0x0653('0x52')]);_0x3dab6f[_0x0653('0x3b')]=_['keys'](_0x4f7771[_0x0653('0x3b')]);_0x3dab6f[_0x0653('0x53')]=_[_0x0653('0x3d')](_0x3dab6f[_0x0653('0x39')],_0x3dab6f[_0x0653('0x3b')]);_0x3286ed['attributes']=_[_0x0653('0x3d')](_0x3dab6f[_0x0653('0x39')],qs[_0x0653('0x54')](_0x4f7771[_0x0653('0x3b')][_0x0653('0x54')]));_0x3286ed[_0x0653('0x3e')]=_0x3286ed[_0x0653('0x3e')][_0x0653('0x3f')]?_0x3286ed[_0x0653('0x3e')]:_0x3dab6f[_0x0653('0x39')];_0x3286ed['order']=qs[_0x0653('0x43')](_0x4f7771[_0x0653('0x3b')][_0x0653('0x43')]);_0x3286ed[_0x0653('0x44')]=qs[_0x0653('0x53')](_[_0x0653('0x6a')](_0x4f7771[_0x0653('0x3b')],_0x3dab6f[_0x0653('0x53')]));if(_0x4f7771[_0x0653('0x3b')][_0x0653('0x49')]){_0x3286ed[_0x0653('0x44')]=_[_0x0653('0x48')](_0x3286ed[_0x0653('0x44')],{'$or':_[_0x0653('0x4a')](_0x3286ed[_0x0653('0x3e')],function(_0x26bb1d){var _0x38d601={};_0x38d601[_0x26bb1d]={'$like':'%'+_0x4f7771[_0x0653('0x3b')]['filter']+'%'};return _0x38d601;})});}_0x3286ed=_['merge']({},_0x3286ed,_0x4f7771[_0x0653('0x4b')]);return _0x1eac5a['getAgents'](_0x3286ed);}})['then'](function(_0x49ed18){if(_0x49ed18){_0x4cec69=_0x49ed18[_0x0653('0x3f')];if(!_0x4f7771['query'][_0x0653('0x40')](_0x0653('0x41'))){_0x3286ed['limit']=qs[_0x0653('0x2c')](_0x4f7771['query']['limit']);_0x3286ed['offset']=qs[_0x0653('0x2b')](_0x4f7771['query']['offset']);}return _0x1eac5a[_0x0653('0xb0')](_0x3286ed);}})[_0x0653('0x1c')](function(_0x218ee6){if(_0x218ee6){return _0x218ee6?{'count':_0x4cec69,'rows':_0x218ee6}:null;}})[_0x0653('0x1c')](respondWithResult(_0x3a7c3c,null))[_0x0653('0x4f')](handleError(_0x3a7c3c,null));};exports[_0x0653('0x36')]=function(_0x232207,_0x58b0dc,_0x148781){var _0x341ec4,_0x2b3ca3,_0xa9bfe2;if(_[_0x0653('0x73')](_0x232207[_0x0653('0x57')][_0x0653('0x57')])||_0x232207[_0x0653('0x57')]['body']===''){throw new db[(_0x0653('0x6f'))][(_0x0653('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0653('0x73')](_0x232207[_0x0653('0x57')]['to'])){}_0x341ec4=_0x232207[_0x0653('0x57')]['to'];return db['OpenchannelAccount'][_0x0653('0x63')]({'where':{'id':_0x232207['params']['id']}})['then'](handleEntityNotFound(_0x58b0dc,null))[_0x0653('0x1c')](function(_0x3ecd65){if(_0x3ecd65){return db[_0x0653('0x38')][_0x0653('0x55')]({'where':{'id':_0x3ecd65['id']},'include':[{'model':db[_0x0653('0xb1')],'as':_0x0653('0x7a'),'include':[{'model':db[_0x0653('0x7b')],'as':_0x0653('0x7c'),'where':{[_0x3ecd65[_0x0653('0x79')]]:_0x341ec4},'limit':0x1,'order':[['updatedAt',_0x0653('0x7d')]]}]}]})['then'](handleEntityNotFound(_0x58b0dc,null))[_0x0653('0x1c')](function(_0x527476){if(_0x527476&&_0x527476['List']){_0x2b3ca3=_0x527476[_0x0653('0x59')]({'plain':!![]});if(_0x2b3ca3[_0x0653('0x7a')]&&_0x2b3ca3['List']['Contacts'][_0x0653('0x3f')]){return _0x2b3ca3[_0x0653('0x7a')][_0x0653('0x7c')][0x0];}return db['CmContact'][_0x0653('0x56')](_[_0x0653('0x16')](_0x232207[_0x0653('0x57')],{'firstName':_0x341ec4,[_0x527476['mapKey']]:_0x341ec4,'phone':_0x341ec4,'ListId':_0x2b3ca3[_0x0653('0x85')]}));}})[_0x0653('0x1c')](handleEntityNotFound(_0x58b0dc,null))['then'](function(_0x752223){if(_0x752223){_0xa9bfe2=_0x752223;return db[_0x0653('0x8a')][_0x0653('0x55')]({'where':{'ContactId':_0xa9bfe2['id'],'closed':![],'OpenchannelAccountId':_0x2b3ca3['id']}})[_0x0653('0x1c')](function(_0x19ce1b){if(_0x19ce1b){return[_0x19ce1b,![]];}return db[_0x0653('0x8a')]['create']({'UserId':_0x232207['user']['id'],'ContactId':_0xa9bfe2['id'],'OpenchannelAccountId':_0x2b3ca3['id'],'lastMsgDirection':_0x0653('0xb2'),'Messages':[_[_0x0653('0x48')](_0x232207[_0x0653('0x57')],{'read':![],'body':_0x232207['body'][_0x0653('0x57')],'OpenchannelAccountId':_0x2b3ca3['id'],'UserId':_0x232207[_0x0653('0x58')]['id'],'ContactId':_0xa9bfe2['id']})]},{'include':[{'model':db[_0x0653('0x91')],'as':_0x0653('0xb3')}]})['then'](function(_0x5d03af){return[_0x5d03af,!![]];});});}})[_0x0653('0xb4')](function(_0x1dcd5e,_0x5043d5){if(_0x5043d5){return _0x1dcd5e;}return db[_0x0653('0x91')]['create'](_[_0x0653('0x48')](_0x232207[_0x0653('0x57')],{'read':![],'body':_0x232207[_0x0653('0x57')][_0x0653('0x57')],'OpenchannelAccountId':_0x2b3ca3['id'],'OpenchannelInteractionId':_0x1dcd5e['id'],'UserId':_0x232207[_0x0653('0x58')]['id'],'ContactId':_0xa9bfe2['id']}))[_0x0653('0x1c')](function(_0x3c9b29){_0x1dcd5e[_0x0653('0xb5')][_0x0653('0xb3')]=[];_0x1dcd5e[_0x0653('0xb5')][_0x0653('0xb3')][_0x0653('0xb6')](_0x3c9b29['dataValues']);return _0x1dcd5e;});});}})['then'](respondWithResult(_0x58b0dc,null))[_0x0653('0x4f')](handleError(_0x58b0dc,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ad642ec..141b77b 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 _0xeff9=['hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeff9,0x9c));var _0x9eff=function(_0x4e3baa,_0x3a66c3){_0x4e3baa=_0x4e3baa-0x0;var _0x536f2d=_0xeff9[_0x4e3baa];return _0x536f2d;};'use strict';var EventEmitter=require(_0x9eff('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9eff('0x1')](0x0);var events={'afterCreate':_0x9eff('0x2'),'afterUpdate':_0x9eff('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5120e1){return function(_0x2c1a40,_0x51630f,_0x15f39a){OpenchannelAccountEvents[_0x9eff('0x4')](_0x5120e1+':'+_0x2c1a40['id'],_0x2c1a40);OpenchannelAccountEvents['emit'](_0x5120e1,_0x2c1a40);_0x15f39a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x9eff('0x5')](e,emitEvent(event));}}module[_0x9eff('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x8148=['save','update','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x8148,0x124));var _0x8814=function(_0x557a51,_0x1e615b){_0x557a51=_0x557a51-0x0;var _0x322c8a=_0x8148[_0x557a51];return _0x322c8a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8814('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8814('0x1')](0x0);var events={'afterCreate':_0x8814('0x2'),'afterUpdate':_0x8814('0x3'),'afterDestroy':'remove'};function emitEvent(_0x55a57){return function(_0x43f77d,_0x68b8ef,_0x543b17){OpenchannelAccountEvents['emit'](_0x55a57+':'+_0x43f77d['id'],_0x43f77d);OpenchannelAccountEvents[_0x8814('0x4')](_0x55a57,_0x43f77d);_0x543b17(null);};}for(var e in events){if(events[_0x8814('0x5')](e)){var event=events[e];OpenchannelAccount[_0x8814('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 895e141..b5a3617 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 _0x9ffd=['util','../../config/logger','moment','bluebird','request-promise','./openchannelAccount.attributes','OpenchannelAccount','openchannel_accounts','lodash'];(function(_0x1b7209,_0x101b72){var _0x1002a8=function(_0x2c4cc2){while(--_0x2c4cc2){_0x1b7209['push'](_0x1b7209['shift']());}};_0x1002a8(++_0x101b72);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x49e124,_0x3de33d){_0x49e124=_0x49e124-0x0;var _0x327f90=_0x9ffd[_0x49e124];return _0x327f90;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var attributes=require(_0xd9ff('0x6'));module['exports']=function(_0x1c9460,_0x111697){return _0x1c9460['define'](_0xd9ff('0x7'),attributes,{'tableName':_0xd9ff('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['openchannel_accounts','lodash','../../config/logger','api','moment','request-promise','./openchannelAccount.attributes','exports','define'];(function(_0xd762cb,_0x3c5a46){var _0x3766ff=function(_0xce86fe){while(--_0xce86fe){_0xd762cb['push'](_0xd762cb['shift']());}};_0x3766ff(++_0x3c5a46);}(_0xb10b,0x12a));var _0xbb10=function(_0x265c81,_0x4d539a){_0x265c81=_0x265c81-0x0;var _0x3e63d1=_0xb10b[_0x265c81];return _0x3e63d1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var attributes=require(_0xbb10('0x5'));module[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){return _0x22320e[_0xbb10('0x7')]('OpenchannelAccount',attributes,{'tableName':_0xbb10('0x8'),'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 5ad857d..00ce940 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 _0x5fc3=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./openchannelAccount.socket'];(function(_0x361a4c,_0x4bf35b){var _0x4f97a9=function(_0x4de122){while(--_0x4de122){_0x361a4c['push'](_0x361a4c['shift']());}};_0x4f97a9(++_0x4bf35b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x5fc3[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x35fc('0xa')]=_['defaults'](config[_0x35fc('0xa')],{'host':_0x35fc('0xb'),'port':0x18eb});var socket=require(_0x35fc('0xc'))(new Redis(config[_0x35fc('0xa')]));require(_0x35fc('0xd'))[_0x35fc('0xe')](socket);function respondWithRpcPromise(_0x2051ab,_0x565f95,_0x1083a9){return new BPromise(function(_0x2a1084,_0x4fdca1){return client[_0x35fc('0xf')](_0x2051ab,_0x1083a9)[_0x35fc('0x10')](function(_0x5021d4){logger[_0x35fc('0x11')](_0x35fc('0x12'),_0x565f95,'request\x20sent');logger['debug'](_0x35fc('0x13'),_0x565f95,'request\x20sent',JSON[_0x35fc('0x14')](_0x5021d4));if(_0x5021d4[_0x35fc('0x15')]){if(_0x5021d4[_0x35fc('0x15')][_0x35fc('0x16')]===0x1f4){logger[_0x35fc('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x565f95,_0x5021d4['error']['message']);return _0x4fdca1(_0x5021d4['error'][_0x35fc('0x17')]);}logger[_0x35fc('0x15')](_0x35fc('0x12'),_0x565f95,_0x5021d4[_0x35fc('0x15')][_0x35fc('0x17')]);return _0x2a1084(_0x5021d4[_0x35fc('0x15')]['message']);}else{logger[_0x35fc('0x11')](_0x35fc('0x12'),_0x565f95,'request\x20sent');_0x2a1084(_0x5021d4[_0x35fc('0x18')][_0x35fc('0x17')]);}})[_0x35fc('0x19')](function(_0x5f56c6){logger[_0x35fc('0x15')](_0x35fc('0x12'),_0x565f95,_0x5f56c6);_0x4fdca1(_0x5f56c6);});});} \ No newline at end of file +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(_0x10a16e,_0x49f81e){_0x10a16e=_0x10a16e-0x0;var _0x3517f7=_0x7a54[_0x10a16e];return _0x3517f7;};'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 diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 3bd921b..d2cde96 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 _0x0da4=['remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x0da4,0x16f));var _0x40da=function(_0x483a46,_0x1a2fc8){_0x483a46=_0x483a46-0x0;var _0x15f360=_0x0da4[_0x483a46];return _0x15f360;};'use strict';var OpenchannelAccountEvents=require(_0x40da('0x0'));var events=[_0x40da('0x1'),_0x40da('0x2'),_0x40da('0x3')];function createListener(_0xcba4f6,_0x2a8d82){return function(_0x39131f){_0x2a8d82[_0x40da('0x4')](_0xcba4f6,_0x39131f);};}function removeListener(_0x4a76ea,_0x43c1b0){return function(){OpenchannelAccountEvents[_0x40da('0x5')](_0x4a76ea,_0x43c1b0);};}exports[_0x40da('0x6')]=function(_0x472c6a){for(var _0x46faf8=0x0,_0x1cbe39=events[_0x40da('0x7')];_0x46faf8<_0x1cbe39;_0x46faf8++){var _0xbd0424=events[_0x46faf8];var _0x112ff9=createListener(_0x40da('0x8')+_0xbd0424,_0x472c6a);OpenchannelAccountEvents['on'](_0xbd0424,_0x112ff9);}}; \ No newline at end of file +var _0x6ea0=['save','remove','update','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x934dae,_0x1ecbd9){var _0x57098d=function(_0x4ee833){while(--_0x4ee833){_0x934dae['push'](_0x934dae['shift']());}};_0x57098d(++_0x1ecbd9);}(_0x6ea0,0x8f));var _0x06ea=function(_0x18e58f,_0x588f07){_0x18e58f=_0x18e58f-0x0;var _0x2c114d=_0x6ea0[_0x18e58f];return _0x2c114d;};'use strict';var OpenchannelAccountEvents=require(_0x06ea('0x0'));var events=[_0x06ea('0x1'),_0x06ea('0x2'),_0x06ea('0x3')];function createListener(_0x57353a,_0x576a11){return function(_0x5bad9e){_0x576a11['emit'](_0x57353a,_0x5bad9e);};}function removeListener(_0x1443eb,_0x109b02){return function(){OpenchannelAccountEvents[_0x06ea('0x4')](_0x1443eb,_0x109b02);};}exports[_0x06ea('0x5')]=function(_0x4ea1f7){for(var _0x516783=0x0,_0x533bde=events[_0x06ea('0x6')];_0x516783<_0x533bde;_0x516783++){var _0x57fdac=events[_0x516783];var _0x3fd64e=createListener(_0x06ea('0x7')+_0x57fdac,_0x4ea1f7);OpenchannelAccountEvents['on'](_0x57fdac,_0x3fd64e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index e716dc5..3f91d33 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 _0xe22c=['util','path','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe22c,0x10f));var _0xce22=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe22c[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xce22('0x0'));var util=require(_0xce22('0x1'));var path=require(_0xce22('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xce22('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xce22('0x4'));var config=require(_0xce22('0x5'));var controller=require(_0xce22('0x6'));router[_0xce22('0x7')]('/',auth[_0xce22('0x8')](),controller[_0xce22('0x9')]);router[_0xce22('0x7')](_0xce22('0xa'),auth[_0xce22('0x8')](),controller[_0xce22('0xb')]);router['post']('/',auth[_0xce22('0x8')](),controller[_0xce22('0xc')]);router[_0xce22('0xd')](_0xce22('0xa'),auth[_0xce22('0x8')](),controller[_0xce22('0xe')]);router[_0xce22('0xf')](_0xce22('0xa'),auth['isAuthenticated'](),controller[_0xce22('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbac7=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','post','put','update','destroy','exports','multer','util'];(function(_0x2fb602,_0x24ef73){var _0x3f6319=function(_0xd9bbf0){while(--_0xd9bbf0){_0x2fb602['push'](_0x2fb602['shift']());}};_0x3f6319(++_0x24ef73);}(_0xbac7,0x1ae));var _0x7bac=function(_0x2e1ce5,_0x3b7097){_0x2e1ce5=_0x2e1ce5-0x0;var _0xc7c41c=_0xbac7[_0x2e1ce5];return _0xc7c41c;};'use strict';var multer=require(_0x7bac('0x0'));var util=require(_0x7bac('0x1'));var path=require(_0x7bac('0x2'));var timeout=require(_0x7bac('0x3'));var express=require('express');var router=express[_0x7bac('0x4')]();var auth=require(_0x7bac('0x5'));var interaction=require(_0x7bac('0x6'));var config=require(_0x7bac('0x7'));var controller=require(_0x7bac('0x8'));router['get']('/',auth[_0x7bac('0x9')](),controller[_0x7bac('0xa')]);router[_0x7bac('0xb')](_0x7bac('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7bac('0xd')]('/',auth[_0x7bac('0x9')](),controller['create']);router[_0x7bac('0xe')]('/:id',auth[_0x7bac('0x9')](),controller[_0x7bac('0xf')]);router['delete'](_0x7bac('0xc'),auth[_0x7bac('0x9')](),controller[_0x7bac('0x10')]);module[_0x7bac('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index f92fc06..fa2f6d1 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 _0x8b17=['noop','*,*,*,*','exports','STRING'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x8b17,0x13e));var _0x78b1=function(_0x4e3072,_0x249605){_0x4e3072=_0x4e3072-0x0;var _0x1e7e02=_0x8b17[_0x4e3072];return _0x1e7e02;};'use strict';var Sequelize=require('sequelize');module[_0x78b1('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x78b1('0x1')],'allowNull':![],'defaultValue':_0x78b1('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x78b1('0x1')],'defaultValue':_0x78b1('0x3')}}; \ No newline at end of file +var _0xd051=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x384a1a,_0x477c0f){var _0x4f4be2=function(_0x36d3b6){while(--_0x36d3b6){_0x384a1a['push'](_0x384a1a['shift']());}};_0x4f4be2(++_0x477c0f);}(_0xd051,0x129));var _0x1d05=function(_0x57fda8,_0x5e80a0){_0x57fda8=_0x57fda8-0x0;var _0x11c895=_0xd051[_0x57fda8];return _0x11c895;};'use strict';var Sequelize=require(_0x1d05('0x0'));module[_0x1d05('0x1')]={'priority':{'type':Sequelize[_0x1d05('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1d05('0x3')],'allowNull':![],'defaultValue':_0x1d05('0x4')},'appdata':{'type':Sequelize[_0x1d05('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x1d05('0x3')]},'interval':{'type':Sequelize[_0x1d05('0x3')],'defaultValue':_0x1d05('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 2119604..55bb08d 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 _0xa364=['path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','index','OpenchannelApplication','rawAttributes','model','query','dateStart','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','dateEnd','add','merge','map','filter','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0xa364,0x1eb));var _0x4a36=function(_0x41eb90,_0x28e9bd){_0x41eb90=_0x41eb90-0x0;var _0x27fe53=_0xa364[_0x41eb90];return _0x27fe53;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4a36('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a36('0x1'));var rp=require(_0x4a36('0x2'));var moment=require(_0x4a36('0x3'));var BPromise=require(_0x4a36('0x4'));var Mustache=require(_0x4a36('0x5'));var util=require('util');var path=require(_0x4a36('0x6'));var sox=require(_0x4a36('0x7'));var csv=require(_0x4a36('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4a36('0x9'));var squel=require(_0x4a36('0xa'));var crypto=require('crypto');var jsforce=require(_0x4a36('0xb'));var deskjs=require(_0x4a36('0xc'));var toCsv=require(_0x4a36('0x8'));var querystring=require(_0x4a36('0xd'));var Papa=require(_0x4a36('0xe'));var Redis=require(_0x4a36('0xf'));var qs=require(_0x4a36('0x10'));var logger=require(_0x4a36('0x11'))(_0x4a36('0x12'));var utils=require(_0x4a36('0x13'));var config=require(_0x4a36('0x14'));var db=require(_0x4a36('0x15'))['db'];function respondWithStatusCode(_0x5dfc28,_0x11929b){_0x11929b=_0x11929b||0xcc;return function(_0x48a4e5){if(_0x48a4e5){return _0x5dfc28['sendStatus'](_0x11929b);}return _0x5dfc28[_0x4a36('0x16')](_0x11929b)[_0x4a36('0x17')]();};}function respondWithResult(_0x4b116f,_0x4ffb24){_0x4ffb24=_0x4ffb24||0xc8;return function(_0x1198c5){if(_0x1198c5){return _0x4b116f[_0x4a36('0x16')](_0x4ffb24)[_0x4a36('0x18')](_0x1198c5);}};}function respondWithFilteredResult(_0x405a49,_0x1be6c6){return function(_0xb24ce1){if(_0xb24ce1){var _0x118c1f=_0xb24ce1['count'],_0x3c5bf5=_0x1be6c6['offset'],_0x2f0535=_0x1be6c6[_0x4a36('0x19')]+_0x1be6c6['limit'],_0xaf82d8;if(_0x2f0535>=_0x118c1f){_0x2f0535=_0x118c1f;_0xaf82d8=0xc8;}else{_0xaf82d8=0xce;}_0x405a49['status'](_0xaf82d8);return _0x405a49[_0x4a36('0x1a')](_0x4a36('0x1b'),_0x3c5bf5+'-'+_0x2f0535+'/'+_0x118c1f)['json'](_0xb24ce1);}return null;};}function patchUpdates(_0x7c275d){return function(_0x5319b5){try{jsonpatch[_0x4a36('0x1c')](_0x5319b5,_0x7c275d,!![]);}catch(_0xde319a){return BPromise[_0x4a36('0x1d')](_0xde319a);}return _0x5319b5[_0x4a36('0x1e')]();};}function saveUpdates(_0x161367,_0x331397){return function(_0x4cd5fc){if(_0x4cd5fc){return _0x4cd5fc[_0x4a36('0x1f')](_0x161367)[_0x4a36('0x20')](function(_0x9a2d90){return _0x9a2d90;});}return null;};}function removeEntity(_0x2b5145,_0x19d2f8){return function(_0x2b199e){if(_0x2b199e){return _0x2b199e['destroy']()[_0x4a36('0x20')](function(){_0x2b5145[_0x4a36('0x16')](0xcc)[_0x4a36('0x17')]();});}};}function handleEntityNotFound(_0x3c7e3b,_0xdd3b63){return function(_0x71ed98){if(!_0x71ed98){_0x3c7e3b[_0x4a36('0x21')](0x194);}return _0x71ed98;};}function handleError(_0xdce39b,_0x294d5e){_0x294d5e=_0x294d5e||0x1f4;return function(_0x137dd2){logger[_0x4a36('0x22')](_0x137dd2[_0x4a36('0x23')]);if(_0x137dd2['name']){delete _0x137dd2['name'];}_0xdce39b[_0x4a36('0x16')](_0x294d5e)['send'](_0x137dd2);};}exports[_0x4a36('0x24')]=function(_0x42bf0d,_0x5ee6da){var _0x7ec115={},_0x189f3d={},_0x402237={'count':0x0,'rows':[]};var _0x2cd719=db[_0x4a36('0x25')][_0x4a36('0x26')];_0x189f3d[_0x4a36('0x27')]=_['keys'](_0x2cd719);var _0x539122={'dateStart':_0x42bf0d[_0x4a36('0x28')]['dateStart'],'dateEnd':_0x42bf0d[_0x4a36('0x28')]['dateEnd']};delete _0x42bf0d[_0x4a36('0x28')][_0x4a36('0x29')];delete _0x42bf0d[_0x4a36('0x28')]['dateEnd'];_0x189f3d['query']=_[_0x4a36('0x2a')](_0x42bf0d[_0x4a36('0x28')]);_0x189f3d[_0x4a36('0x2b')]=_[_0x4a36('0x2c')](_0x189f3d[_0x4a36('0x27')],_0x189f3d['query']);_0x7ec115[_0x4a36('0x2d')]=_[_0x4a36('0x2c')](_0x189f3d[_0x4a36('0x27')],qs[_0x4a36('0x2e')](_0x42bf0d[_0x4a36('0x28')]['fields']));_0x7ec115['attributes']=_0x7ec115['attributes'][_0x4a36('0x2f')]?_0x7ec115[_0x4a36('0x2d')]:_0x189f3d[_0x4a36('0x27')];if(!_0x42bf0d[_0x4a36('0x28')]['hasOwnProperty']('nolimit')){_0x7ec115['limit']=qs[_0x4a36('0x30')](_0x42bf0d[_0x4a36('0x28')][_0x4a36('0x30')]);_0x7ec115['offset']=qs['offset'](_0x42bf0d[_0x4a36('0x28')]['offset']);}_0x7ec115[_0x4a36('0x31')]=qs[_0x4a36('0x32')](_0x42bf0d['query'][_0x4a36('0x32')]);_0x7ec115[_0x4a36('0x33')]=qs[_0x4a36('0x2b')](_[_0x4a36('0x34')](_0x42bf0d[_0x4a36('0x28')],_0x189f3d[_0x4a36('0x2b')]));if(_0x539122[_0x4a36('0x29')]){if(_0x539122['dateEnd']){_0x539122[_0x4a36('0x35')]=moment(_0x539122['dateEnd'])[_0x4a36('0x36')](0x1,'day');}else{_0x539122[_0x4a36('0x35')]=moment(_0x539122[_0x4a36('0x29')])[_0x4a36('0x36')](0x1,'day');}_[_0x4a36('0x37')](_0x7ec115['where'],{'createdAt':{'$gte':_0x539122[_0x4a36('0x29')],'$lte':_0x539122[_0x4a36('0x35')]}});}if(_0x42bf0d[_0x4a36('0x28')]['filter']){_0x7ec115[_0x4a36('0x33')]=_[_0x4a36('0x37')](_0x7ec115[_0x4a36('0x33')],{'$or':_[_0x4a36('0x38')](_0x7ec115['attributes'],function(_0x27e110){var _0x508041={};_0x508041[_0x27e110]={'$like':'%'+_0x42bf0d[_0x4a36('0x28')][_0x4a36('0x39')]+'%'};return _0x508041;})});}_0x7ec115=_['merge']({},_0x7ec115,_0x42bf0d[_0x4a36('0x3a')]);var _0x4ea33a={'where':_0x7ec115[_0x4a36('0x33')]};return db['OpenchannelApplication'][_0x4a36('0x3b')](_0x4ea33a)[_0x4a36('0x20')](function(_0x19baa2){_0x402237['count']=_0x19baa2;if(_0x42bf0d[_0x4a36('0x28')]['includeAll']){_0x7ec115[_0x4a36('0x3c')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x4a36('0x3d')](_0x7ec115);})['then'](function(_0x5baa90){_0x402237[_0x4a36('0x3e')]=_0x5baa90;return _0x402237;})['then'](respondWithFilteredResult(_0x5ee6da,_0x7ec115))[_0x4a36('0x3f')](handleError(_0x5ee6da,null));};exports[_0x4a36('0x40')]=function(_0x2deb24,_0x3438e8){var _0x1d6b22={'raw':!![],'where':{'id':_0x2deb24['params']['id']}},_0x17cbc0={};_0x17cbc0[_0x4a36('0x27')]=_['keys'](db[_0x4a36('0x25')][_0x4a36('0x26')]);_0x17cbc0[_0x4a36('0x28')]=_['keys'](_0x2deb24[_0x4a36('0x28')]);_0x17cbc0[_0x4a36('0x2b')]=_[_0x4a36('0x2c')](_0x17cbc0[_0x4a36('0x27')],_0x17cbc0[_0x4a36('0x28')]);_0x1d6b22[_0x4a36('0x2d')]=_[_0x4a36('0x2c')](_0x17cbc0[_0x4a36('0x27')],qs[_0x4a36('0x2e')](_0x2deb24[_0x4a36('0x28')][_0x4a36('0x2e')]));_0x1d6b22[_0x4a36('0x2d')]=_0x1d6b22['attributes'][_0x4a36('0x2f')]?_0x1d6b22['attributes']:_0x17cbc0[_0x4a36('0x27')];if(_0x2deb24[_0x4a36('0x28')][_0x4a36('0x41')]){_0x1d6b22[_0x4a36('0x3c')]=[{'all':!![]}];}_0x1d6b22=_[_0x4a36('0x37')]({},_0x1d6b22,_0x2deb24[_0x4a36('0x3a')]);return db[_0x4a36('0x25')][_0x4a36('0x42')](_0x1d6b22)['then'](handleEntityNotFound(_0x3438e8,null))[_0x4a36('0x20')](respondWithResult(_0x3438e8,null))[_0x4a36('0x3f')](handleError(_0x3438e8,null));};exports[_0x4a36('0x43')]=function(_0x1225e0,_0xb72357){return db[_0x4a36('0x25')]['create'](_0x1225e0[_0x4a36('0x44')],{})[_0x4a36('0x20')](respondWithResult(_0xb72357,0xc9))['catch'](handleError(_0xb72357,null));};exports[_0x4a36('0x1f')]=function(_0x3a9b0d,_0x2ba264){if(_0x3a9b0d[_0x4a36('0x44')]['id']){delete _0x3a9b0d[_0x4a36('0x44')]['id'];}return db['OpenchannelApplication'][_0x4a36('0x42')]({'where':{'id':_0x3a9b0d[_0x4a36('0x45')]['id']}})[_0x4a36('0x20')](handleEntityNotFound(_0x2ba264,null))[_0x4a36('0x20')](saveUpdates(_0x3a9b0d[_0x4a36('0x44')],null))[_0x4a36('0x20')](respondWithResult(_0x2ba264,null))['catch'](handleError(_0x2ba264,null));};exports[_0x4a36('0x46')]=function(_0x14585f,_0x2cb9ff){return db[_0x4a36('0x25')][_0x4a36('0x42')]({'where':{'id':_0x14585f[_0x4a36('0x45')]['id']}})[_0x4a36('0x20')](handleEntityNotFound(_0x2cb9ff,null))[_0x4a36('0x20')](removeEntity(_0x2cb9ff,null))['catch'](handleError(_0x2cb9ff,null));}; \ No newline at end of file +var _0x8670=['index','OpenchannelApplication','rawAttributes','model','keys','query','dateStart','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','dateEnd','add','day','merge','filter','map','options','includeAll','include','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x2c6292,_0x583c88){var _0xedb562=function(_0x4f9ba6){while(--_0x4f9ba6){_0x2c6292['push'](_0x2c6292['shift']());}};_0xedb562(++_0x583c88);}(_0x8670,0xf4));var _0x0867=function(_0x52b91f,_0x499757){_0x52b91f=_0x52b91f-0x0;var _0x15f8f5=_0x8670[_0x52b91f];return _0x15f8f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0867('0x0'));var rimraf=require(_0x0867('0x1'));var zipdir=require(_0x0867('0x2'));var jsonpatch=require(_0x0867('0x3'));var rp=require('request-promise');var moment=require(_0x0867('0x4'));var BPromise=require(_0x0867('0x5'));var Mustache=require(_0x0867('0x6'));var util=require('util');var path=require(_0x0867('0x7'));var sox=require(_0x0867('0x8'));var csv=require(_0x0867('0x9'));var ejs=require(_0x0867('0xa'));var fs=require('fs');var _=require(_0x0867('0xb'));var squel=require('squel');var crypto=require(_0x0867('0xc'));var jsforce=require(_0x0867('0xd'));var deskjs=require(_0x0867('0xe'));var toCsv=require(_0x0867('0x9'));var querystring=require(_0x0867('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x0867('0x10'))(_0x0867('0x11'));var utils=require(_0x0867('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13558c,_0x521d22){_0x521d22=_0x521d22||0xcc;return function(_0xaaf4f9){if(_0xaaf4f9){return _0x13558c[_0x0867('0x13')](_0x521d22);}return _0x13558c[_0x0867('0x14')](_0x521d22)[_0x0867('0x15')]();};}function respondWithResult(_0x4279c7,_0x1edcbc){_0x1edcbc=_0x1edcbc||0xc8;return function(_0x4bcf53){if(_0x4bcf53){return _0x4279c7[_0x0867('0x14')](_0x1edcbc)[_0x0867('0x16')](_0x4bcf53);}};}function respondWithFilteredResult(_0xafbfff,_0x3432fb){return function(_0xfc978){if(_0xfc978){var _0x560bfc=_0xfc978[_0x0867('0x17')],_0x22f0c6=_0x3432fb[_0x0867('0x18')],_0x108abe=_0x3432fb[_0x0867('0x18')]+_0x3432fb[_0x0867('0x19')],_0x461179;if(_0x108abe>=_0x560bfc){_0x108abe=_0x560bfc;_0x461179=0xc8;}else{_0x461179=0xce;}_0xafbfff[_0x0867('0x14')](_0x461179);return _0xafbfff[_0x0867('0x1a')](_0x0867('0x1b'),_0x22f0c6+'-'+_0x108abe+'/'+_0x560bfc)[_0x0867('0x16')](_0xfc978);}return null;};}function patchUpdates(_0x29dc1d){return function(_0x39129c){try{jsonpatch[_0x0867('0x1c')](_0x39129c,_0x29dc1d,!![]);}catch(_0x4c3172){return BPromise[_0x0867('0x1d')](_0x4c3172);}return _0x39129c[_0x0867('0x1e')]();};}function saveUpdates(_0x57e3ab,_0x55ca44){return function(_0x3cd6e9){if(_0x3cd6e9){return _0x3cd6e9['update'](_0x57e3ab)[_0x0867('0x1f')](function(_0x4feddc){return _0x4feddc;});}return null;};}function removeEntity(_0x3c5f60,_0x248d61){return function(_0x5aea40){if(_0x5aea40){return _0x5aea40[_0x0867('0x20')]()[_0x0867('0x1f')](function(){_0x3c5f60[_0x0867('0x14')](0xcc)[_0x0867('0x15')]();});}};}function handleEntityNotFound(_0x40f21c,_0xa1190a){return function(_0x166788){if(!_0x166788){_0x40f21c['sendStatus'](0x194);}return _0x166788;};}function handleError(_0x159188,_0x53610d){_0x53610d=_0x53610d||0x1f4;return function(_0x3dbfe0){logger[_0x0867('0x21')](_0x3dbfe0[_0x0867('0x22')]);if(_0x3dbfe0['name']){delete _0x3dbfe0[_0x0867('0x23')];}_0x159188[_0x0867('0x14')](_0x53610d)['send'](_0x3dbfe0);};}exports[_0x0867('0x24')]=function(_0x5bc18f,_0x5793d7){var _0x465ad7={},_0x468a45={},_0x5d4513={'count':0x0,'rows':[]};var _0x23a49c=db[_0x0867('0x25')][_0x0867('0x26')];_0x468a45[_0x0867('0x27')]=_[_0x0867('0x28')](_0x23a49c);var _0x243a8a={'dateStart':_0x5bc18f[_0x0867('0x29')]['dateStart'],'dateEnd':_0x5bc18f['query']['dateEnd']};delete _0x5bc18f[_0x0867('0x29')][_0x0867('0x2a')];delete _0x5bc18f[_0x0867('0x29')]['dateEnd'];_0x468a45[_0x0867('0x29')]=_[_0x0867('0x28')](_0x5bc18f[_0x0867('0x29')]);_0x468a45['filters']=_[_0x0867('0x2b')](_0x468a45[_0x0867('0x27')],_0x468a45[_0x0867('0x29')]);_0x465ad7[_0x0867('0x2c')]=_['intersection'](_0x468a45[_0x0867('0x27')],qs['fields'](_0x5bc18f[_0x0867('0x29')][_0x0867('0x2d')]));_0x465ad7[_0x0867('0x2c')]=_0x465ad7[_0x0867('0x2c')][_0x0867('0x2e')]?_0x465ad7['attributes']:_0x468a45['model'];if(!_0x5bc18f[_0x0867('0x29')][_0x0867('0x2f')](_0x0867('0x30'))){_0x465ad7['limit']=qs[_0x0867('0x19')](_0x5bc18f[_0x0867('0x29')]['limit']);_0x465ad7[_0x0867('0x18')]=qs['offset'](_0x5bc18f[_0x0867('0x29')][_0x0867('0x18')]);}_0x465ad7[_0x0867('0x31')]=qs[_0x0867('0x32')](_0x5bc18f[_0x0867('0x29')][_0x0867('0x32')]);_0x465ad7[_0x0867('0x33')]=qs[_0x0867('0x34')](_['pick'](_0x5bc18f[_0x0867('0x29')],_0x468a45['filters']));if(_0x243a8a[_0x0867('0x2a')]){if(_0x243a8a[_0x0867('0x35')]){_0x243a8a[_0x0867('0x35')]=moment(_0x243a8a[_0x0867('0x35')])[_0x0867('0x36')](0x1,_0x0867('0x37'));}else{_0x243a8a[_0x0867('0x35')]=moment(_0x243a8a[_0x0867('0x2a')])[_0x0867('0x36')](0x1,'day');}_[_0x0867('0x38')](_0x465ad7['where'],{'createdAt':{'$gte':_0x243a8a[_0x0867('0x2a')],'$lte':_0x243a8a['dateEnd']}});}if(_0x5bc18f[_0x0867('0x29')][_0x0867('0x39')]){_0x465ad7[_0x0867('0x33')]=_[_0x0867('0x38')](_0x465ad7[_0x0867('0x33')],{'$or':_[_0x0867('0x3a')](_0x465ad7[_0x0867('0x2c')],function(_0x231e4a){var _0x110620={};_0x110620[_0x231e4a]={'$like':'%'+_0x5bc18f[_0x0867('0x29')][_0x0867('0x39')]+'%'};return _0x110620;})});}_0x465ad7=_[_0x0867('0x38')]({},_0x465ad7,_0x5bc18f[_0x0867('0x3b')]);var _0x5142a0={'where':_0x465ad7[_0x0867('0x33')]};return db[_0x0867('0x25')][_0x0867('0x17')](_0x5142a0)[_0x0867('0x1f')](function(_0x491218){_0x5d4513['count']=_0x491218;if(_0x5bc18f[_0x0867('0x29')][_0x0867('0x3c')]){_0x465ad7[_0x0867('0x3d')]=[{'all':!![]}];}return db[_0x0867('0x25')]['findAll'](_0x465ad7);})[_0x0867('0x1f')](function(_0x518558){_0x5d4513[_0x0867('0x3e')]=_0x518558;return _0x5d4513;})[_0x0867('0x1f')](respondWithFilteredResult(_0x5793d7,_0x465ad7))[_0x0867('0x3f')](handleError(_0x5793d7,null));};exports[_0x0867('0x40')]=function(_0x1767c6,_0x4b3c1f){var _0x223cb3={'raw':!![],'where':{'id':_0x1767c6[_0x0867('0x41')]['id']}},_0x25a081={};_0x25a081['model']=_['keys'](db[_0x0867('0x25')][_0x0867('0x26')]);_0x25a081['query']=_[_0x0867('0x28')](_0x1767c6[_0x0867('0x29')]);_0x25a081[_0x0867('0x34')]=_[_0x0867('0x2b')](_0x25a081[_0x0867('0x27')],_0x25a081[_0x0867('0x29')]);_0x223cb3['attributes']=_[_0x0867('0x2b')](_0x25a081['model'],qs[_0x0867('0x2d')](_0x1767c6[_0x0867('0x29')]['fields']));_0x223cb3[_0x0867('0x2c')]=_0x223cb3[_0x0867('0x2c')][_0x0867('0x2e')]?_0x223cb3[_0x0867('0x2c')]:_0x25a081[_0x0867('0x27')];if(_0x1767c6[_0x0867('0x29')][_0x0867('0x3c')]){_0x223cb3[_0x0867('0x3d')]=[{'all':!![]}];}_0x223cb3=_[_0x0867('0x38')]({},_0x223cb3,_0x1767c6[_0x0867('0x3b')]);return db['OpenchannelApplication'][_0x0867('0x42')](_0x223cb3)[_0x0867('0x1f')](handleEntityNotFound(_0x4b3c1f,null))['then'](respondWithResult(_0x4b3c1f,null))[_0x0867('0x3f')](handleError(_0x4b3c1f,null));};exports[_0x0867('0x43')]=function(_0xd6d818,_0x2d9924){return db[_0x0867('0x25')][_0x0867('0x43')](_0xd6d818[_0x0867('0x44')],{})[_0x0867('0x1f')](respondWithResult(_0x2d9924,0xc9))[_0x0867('0x3f')](handleError(_0x2d9924,null));};exports[_0x0867('0x45')]=function(_0x3d4e85,_0x22c8a3){if(_0x3d4e85[_0x0867('0x44')]['id']){delete _0x3d4e85['body']['id'];}return db[_0x0867('0x25')]['find']({'where':{'id':_0x3d4e85[_0x0867('0x41')]['id']}})[_0x0867('0x1f')](handleEntityNotFound(_0x22c8a3,null))['then'](saveUpdates(_0x3d4e85['body'],null))[_0x0867('0x1f')](respondWithResult(_0x22c8a3,null))['catch'](handleError(_0x22c8a3,null));};exports[_0x0867('0x20')]=function(_0x12fa38,_0x4ed295){return db[_0x0867('0x25')]['find']({'where':{'id':_0x12fa38[_0x0867('0x41')]['id']}})[_0x0867('0x1f')](handleEntityNotFound(_0x4ed295,null))[_0x0867('0x1f')](removeEntity(_0x4ed295,null))[_0x0867('0x3f')](handleError(_0x4ed295,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0238b05..9421f80 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 _0xfba8=['exports','define','OpenchannelApplication','openchannel_applications','util','../../config/logger','api','moment','bluebird','request-promise','./openchannelApplication.attributes'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xfba8,0x19b));var _0x8fba=function(_0x3419a3,_0x599f21){_0x3419a3=_0x3419a3-0x0;var _0x47bda9=_0xfba8[_0x3419a3];return _0x47bda9;};'use strict';var _=require('lodash');var util=require(_0x8fba('0x0'));var logger=require(_0x8fba('0x1'))(_0x8fba('0x2'));var moment=require(_0x8fba('0x3'));var BPromise=require(_0x8fba('0x4'));var rp=require(_0x8fba('0x5'));var attributes=require(_0x8fba('0x6'));module[_0x8fba('0x7')]=function(_0x46eb9c,_0x2da26c){return _0x46eb9c[_0x8fba('0x8')](_0x8fba('0x9'),attributes,{'tableName':_0x8fba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x515e=['bluebird','request-promise','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','moment'];(function(_0x30b322,_0x5422f5){var _0x130331=function(_0x15e03c){while(--_0x15e03c){_0x30b322['push'](_0x30b322['shift']());}};_0x130331(++_0x5422f5);}(_0x515e,0x10f));var _0xe515=function(_0x30e86a,_0x43751b){_0x30e86a=_0x30e86a-0x0;var _0x100869=_0x515e[_0x30e86a];return _0x100869;};'use strict';var _=require(_0xe515('0x0'));var util=require(_0xe515('0x1'));var logger=require(_0xe515('0x2'))('api');var moment=require(_0xe515('0x3'));var BPromise=require(_0xe515('0x4'));var rp=require(_0xe515('0x5'));var attributes=require(_0xe515('0x6'));module[_0xe515('0x7')]=function(_0x15a163,_0x195799){return _0x15a163[_0xe515('0x8')](_0xe515('0x9'),attributes,{'tableName':_0xe515('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 2ba7ba0..49970af 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 _0x3496=['options','where','attributes','limit','then','lodash','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','OpenchannelApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x3496,0x1a5));var _0x6349=function(_0xa379ba,_0x452ae1){_0xa379ba=_0xa379ba-0x0;var _0xf60e3a=_0x3496[_0xa379ba];return _0xf60e3a;};'use strict';var _=require(_0x6349('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6349('0x1'));var rs=require(_0x6349('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6349('0x3'));var logger=require('../../config/logger')(_0x6349('0x4'));var config=require(_0x6349('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6349('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa35413,_0xeb3e6b,_0x5b8868){return new BPromise(function(_0x12591a,_0x2cd41a){return client['request'](_0xa35413,_0x5b8868)['then'](function(_0x143279){logger['info'](_0x6349('0x7'),_0xeb3e6b,'request\x20sent');logger[_0x6349('0x8')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xeb3e6b,_0x6349('0x9'),JSON[_0x6349('0xa')](_0x143279));if(_0x143279[_0x6349('0xb')]){if(_0x143279[_0x6349('0xb')][_0x6349('0xc')]===0x1f4){logger[_0x6349('0xb')](_0x6349('0x7'),_0xeb3e6b,_0x143279['error'][_0x6349('0xd')]);return _0x2cd41a(_0x143279[_0x6349('0xb')]['message']);}logger[_0x6349('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0xeb3e6b,_0x143279['error'][_0x6349('0xd')]);return _0x12591a(_0x143279[_0x6349('0xb')]['message']);}else{logger[_0x6349('0xe')](_0x6349('0x7'),_0xeb3e6b,_0x6349('0x9'));_0x12591a(_0x143279[_0x6349('0xf')][_0x6349('0xd')]);}})[_0x6349('0x10')](function(_0x52b9b6){logger['error'](_0x6349('0x7'),_0xeb3e6b,_0x52b9b6);_0x2cd41a(_0x52b9b6);});});}exports[_0x6349('0x11')]=function(_0x36d5ee){var _0x48df38=this;return new Promise(function(_0x28b545,_0x56ab3f){return db[_0x6349('0x12')][_0x6349('0x13')](_0x36d5ee[_0x6349('0x14')],{'raw':_0x36d5ee[_0x6349('0x15')]?_0x36d5ee['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d5ee['options']?_0x36d5ee['options'][_0x6349('0x16')]||null:null,'attributes':_0x36d5ee[_0x6349('0x15')]?_0x36d5ee[_0x6349('0x15')][_0x6349('0x17')]||null:null,'limit':_0x36d5ee[_0x6349('0x15')]?_0x36d5ee[_0x6349('0x15')][_0x6349('0x18')]||null:null})[_0x6349('0x19')](function(_0x33ebb3){logger[_0x6349('0xe')](_0x6349('0x11'),_0x36d5ee);logger['debug'](_0x6349('0x11'),_0x36d5ee,JSON[_0x6349('0xa')](_0x33ebb3));_0x28b545(_0x33ebb3);})[_0x6349('0x10')](function(_0x380c80){logger['error']('UpdateOpenchannelApplication',_0x380c80[_0x6349('0xd')],_0x36d5ee);_0x56ab3f(_0x48df38['error'](0x1f4,_0x380c80['message']));});});}; \ No newline at end of file +var _0xfbba=['error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x11ebfb,_0x2a92ce){var _0x2a6f41=function(_0x22a265){while(--_0x22a265){_0x11ebfb['push'](_0x11ebfb['shift']());}};_0x2a6f41(++_0x2a92ce);}(_0xfbba,0x118));var _0xafbb=function(_0x490dc0,_0x2abb25){_0x490dc0=_0x490dc0-0x0;var _0x58b93d=_0xfbba[_0x490dc0];return _0x58b93d;};'use strict';var _=require('lodash');var util=require(_0xafbb('0x0'));var moment=require(_0xafbb('0x1'));var BPromise=require(_0xafbb('0x2'));var rs=require(_0xafbb('0x3'));var fs=require('fs');var Redis=require(_0xafbb('0x4'));var db=require(_0xafbb('0x5'))['db'];var utils=require(_0xafbb('0x6'));var logger=require(_0xafbb('0x7'))(_0xafbb('0x8'));var config=require(_0xafbb('0x9'));var jayson=require(_0xafbb('0xa'));var client=jayson[_0xafbb('0xb')][_0xafbb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fe76b,_0x519cfb,_0x326eb0){return new BPromise(function(_0x4858dc,_0x489120){return client[_0xafbb('0xd')](_0x4fe76b,_0x326eb0)[_0xafbb('0xe')](function(_0x270bc0){logger[_0xafbb('0xf')](_0xafbb('0x10'),_0x519cfb,_0xafbb('0x11'));logger['debug'](_0xafbb('0x12'),_0x519cfb,_0xafbb('0x11'),JSON[_0xafbb('0x13')](_0x270bc0));if(_0x270bc0[_0xafbb('0x14')]){if(_0x270bc0['error']['code']===0x1f4){logger[_0xafbb('0x14')](_0xafbb('0x10'),_0x519cfb,_0x270bc0[_0xafbb('0x14')][_0xafbb('0x15')]);return _0x489120(_0x270bc0[_0xafbb('0x14')]['message']);}logger['error'](_0xafbb('0x10'),_0x519cfb,_0x270bc0['error']['message']);return _0x4858dc(_0x270bc0[_0xafbb('0x14')][_0xafbb('0x15')]);}else{logger['info'](_0xafbb('0x10'),_0x519cfb,_0xafbb('0x11'));_0x4858dc(_0x270bc0[_0xafbb('0x16')][_0xafbb('0x15')]);}})[_0xafbb('0x17')](function(_0x11e04a){logger[_0xafbb('0x14')](_0xafbb('0x10'),_0x519cfb,_0x11e04a);_0x489120(_0x11e04a);});});}exports[_0xafbb('0x18')]=function(_0x1f5978){var _0x5c6931=this;return new Promise(function(_0x26cbb5,_0x194096){return db[_0xafbb('0x19')][_0xafbb('0x1a')](_0x1f5978['body'],{'raw':_0x1f5978[_0xafbb('0x1b')]?_0x1f5978[_0xafbb('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f5978['options']?_0x1f5978[_0xafbb('0x1b')]['where']||null:null,'attributes':_0x1f5978[_0xafbb('0x1b')]?_0x1f5978[_0xafbb('0x1b')][_0xafbb('0x1c')]||null:null,'limit':_0x1f5978[_0xafbb('0x1b')]?_0x1f5978[_0xafbb('0x1b')][_0xafbb('0x1d')]||null:null})[_0xafbb('0xe')](function(_0x291d1d){logger['info'](_0xafbb('0x18'),_0x1f5978);logger['debug'](_0xafbb('0x18'),_0x1f5978,JSON[_0xafbb('0x13')](_0x291d1d));_0x26cbb5(_0x291d1d);})[_0xafbb('0x17')](function(_0x12c74e){logger[_0xafbb('0x14')](_0xafbb('0x18'),_0x12c74e['message'],_0x1f5978);_0x194096(_0x5c6931['error'](0x1f4,_0x12c74e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 28e1dcc..1bc857e 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 _0x0d16=['multer','util','path','connect-timeout','express','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags'];(function(_0x3f00ce,_0xb4ec77){var _0x2748bd=function(_0x1e31fb){while(--_0x1e31fb){_0x3f00ce['push'](_0x3f00ce['shift']());}};_0x2748bd(++_0xb4ec77);}(_0x0d16,0x140));var _0x60d1=function(_0x3992d8,_0x55ede8){_0x3992d8=_0x3992d8-0x0;var _0x3d78a5=_0x0d16[_0x3992d8];return _0x3d78a5;};'use strict';var multer=require(_0x60d1('0x0'));var util=require(_0x60d1('0x1'));var path=require(_0x60d1('0x2'));var timeout=require(_0x60d1('0x3'));var express=require(_0x60d1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x60d1('0x5'));var controller=require(_0x60d1('0x6'));router['get']('/',auth[_0x60d1('0x7')](),controller[_0x60d1('0x8')]);router['get']('/describe',auth[_0x60d1('0x7')](),controller[_0x60d1('0x9')]);router[_0x60d1('0xa')](_0x60d1('0xb'),auth[_0x60d1('0x7')](),controller[_0x60d1('0xc')]);router['get'](_0x60d1('0xd'),auth[_0x60d1('0x7')](),controller[_0x60d1('0xe')]);router[_0x60d1('0xa')](_0x60d1('0xf'),auth['isAuthenticated'](),controller[_0x60d1('0x10')]);router['post']('/',auth[_0x60d1('0x7')](),controller[_0x60d1('0x11')]);router[_0x60d1('0x12')](_0x60d1('0xd'),auth[_0x60d1('0x7')](),controller[_0x60d1('0x13')]);router[_0x60d1('0x12')](_0x60d1('0x14'),auth[_0x60d1('0x7')](),interaction[_0x60d1('0x15')](_0x60d1('0x16'),_0x60d1('0x17')),controller[_0x60d1('0x18')]);router[_0x60d1('0x19')](_0x60d1('0xb'),auth['isAuthenticated'](),interaction[_0x60d1('0x15')](_0x60d1('0x16'),_0x60d1('0x1a')),controller[_0x60d1('0x1b')]);router['delete'](_0x60d1('0xb'),auth[_0x60d1('0x7')](),interaction[_0x60d1('0x15')]('openchannel',_0x60d1('0x1c')),controller[_0x60d1('0x1d')]);router[_0x60d1('0x1e')](_0x60d1('0x14'),auth[_0x60d1('0x7')](),controller[_0x60d1('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x7b4f=['openchannel','openchannelinteraction:addtags','put','update','openchannelinteraction:destroy','destroy','delete','exports','multer','util','path','Router','../../components/auth/service','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked'];(function(_0x3a21c9,_0x1db85c){var _0x20f276=function(_0x510ab3){while(--_0x510ab3){_0x3a21c9['push'](_0x3a21c9['shift']());}};_0x20f276(++_0x1db85c);}(_0x7b4f,0x104));var _0xf7b4=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0x7b4f[_0x5751e6];return _0x4199e4;};'use strict';var multer=require(_0xf7b4('0x0'));var util=require(_0xf7b4('0x1'));var path=require(_0xf7b4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf7b4('0x3')]();var auth=require(_0xf7b4('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf7b4('0x5'));router[_0xf7b4('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf7b4('0x6')](_0xf7b4('0x7'),auth[_0xf7b4('0x8')](),controller[_0xf7b4('0x9')]);router[_0xf7b4('0x6')](_0xf7b4('0xa'),auth[_0xf7b4('0x8')](),controller[_0xf7b4('0xb')]);router[_0xf7b4('0x6')](_0xf7b4('0xc'),auth['isAuthenticated'](),controller[_0xf7b4('0xd')]);router['get'](_0xf7b4('0xe'),auth[_0xf7b4('0x8')](),controller[_0xf7b4('0xf')]);router['post']('/',auth[_0xf7b4('0x8')](),controller['create']);router[_0xf7b4('0x10')](_0xf7b4('0xc'),auth[_0xf7b4('0x8')](),controller[_0xf7b4('0x11')]);router['post'](_0xf7b4('0x12'),auth[_0xf7b4('0x8')](),interaction[_0xf7b4('0x13')](_0xf7b4('0x14'),_0xf7b4('0x15')),controller['addTags']);router[_0xf7b4('0x16')](_0xf7b4('0xa'),auth[_0xf7b4('0x8')](),interaction[_0xf7b4('0x13')]('openchannel','openchannelinteraction:update'),controller[_0xf7b4('0x17')]);router['delete'](_0xf7b4('0xa'),auth[_0xf7b4('0x8')](),interaction[_0xf7b4('0x13')](_0xf7b4('0x14'),_0xf7b4('0x18')),controller[_0xf7b4('0x19')]);router[_0xf7b4('0x1a')](_0xf7b4('0x12'),auth[_0xf7b4('0x8')](),controller['removeTags']);module[_0xf7b4('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 77da6cd..5e4890b 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 _0xd0a4=['BOOLEAN','DATE','STRING','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd0a4,0x13e));var _0x4d0a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd0a4[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x4d0a('0x0'));module[_0x4d0a('0x1')]={'closed':{'type':Sequelize[_0x4d0a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4d0a('0x3')]},'disposition':{'type':Sequelize[_0x4d0a('0x4')]},'note':{'type':Sequelize[_0x4d0a('0x4')]},'read1stAt':{'type':Sequelize[_0x4d0a('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x4d0a('0x4')]},'lastMsgAt':{'type':Sequelize[_0x4d0a('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7ec7=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x453c7a,_0x2437ff){var _0x101ffa=function(_0x16611e){while(--_0x16611e){_0x453c7a['push'](_0x453c7a['shift']());}};_0x101ffa(++_0x2437ff);}(_0x7ec7,0x1a2));var _0x77ec=function(_0xb5c667,_0x586c39){_0xb5c667=_0xb5c667-0x0;var _0x525a12=_0x7ec7[_0xb5c667];return _0x525a12;};'use strict';var Sequelize=require(_0x77ec('0x0'));module[_0x77ec('0x1')]={'closed':{'type':Sequelize[_0x77ec('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x77ec('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x77ec('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x77ec('0x4')]},'externalUrl':{'type':Sequelize[_0x77ec('0x4')]},'lastMsgAt':{'type':Sequelize[_0x77ec('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x77ec('0x5')]('in',_0x77ec('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x77ec('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5057732..e1ffb6d 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 _0xd786=['fullname','Contact','Owner','Account','createdAt','color','ThroughTags','rows','show','params','rawAttributes','intersection','find','catch','create','body','destroy','describe','addMessage','ids','getMessages','findOne','pick','OpenchannelInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','findAll','addTags','setTags','omit','spread','download','unix','toString','join','root','server','tmp','files','attachments','format','CmContact','firstName','Attachment','Letter','1cm','

Openchannel\x20Interaction:\x20#%d

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

','createReadStream','pipe','basename','interaction-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','json','offset','set','Content-Range','apply','save','update','then','status','end','error','stack','name','send','index','OpenchannelInteraction','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','add','day','merge','map','filter','options','tag','include','push','Tag','Tags','distinct','OpenchannelMessage','Messages','direction','read','includeAll','User','Users'];(function(_0x403451,_0x540c82){var _0x2c2cd9=function(_0x2f7ac0){while(--_0x2f7ac0){_0x403451['push'](_0x403451['shift']());}};_0x2c2cd9(++_0x540c82);}(_0xd786,0x1dc));var _0x6d78=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xd786[_0x3ab9ee];return _0x82ee88;};'use strict';var pdf=require(_0x6d78('0x0'));var emlformat=require(_0x6d78('0x1'));var rimraf=require(_0x6d78('0x2'));var zipdir=require(_0x6d78('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d78('0x4'));var moment=require(_0x6d78('0x5'));var BPromise=require(_0x6d78('0x6'));var Mustache=require(_0x6d78('0x7'));var util=require(_0x6d78('0x8'));var path=require(_0x6d78('0x9'));var sox=require(_0x6d78('0xa'));var csv=require('to-csv');var ejs=require(_0x6d78('0xb'));var fs=require('fs');var _=require(_0x6d78('0xc'));var squel=require('squel');var crypto=require(_0x6d78('0xd'));var jsforce=require(_0x6d78('0xe'));var deskjs=require(_0x6d78('0xf'));var toCsv=require(_0x6d78('0x10'));var querystring=require('querystring');var Papa=require(_0x6d78('0x11'));var Redis=require(_0x6d78('0x12'));var qs=require(_0x6d78('0x13'));var logger=require('../../config/logger')(_0x6d78('0x14'));var utils=require(_0x6d78('0x15'));var config=require(_0x6d78('0x16'));var db=require(_0x6d78('0x17'))['db'];config[_0x6d78('0x18')]=_[_0x6d78('0x19')](config[_0x6d78('0x18')],{'host':_0x6d78('0x1a'),'port':0x18eb});var socket=require(_0x6d78('0x1b'))(new Redis(config[_0x6d78('0x18')]));require('./openchannelInteraction.socket')[_0x6d78('0x1c')](socket);function respondWithStatusCode(_0x457157,_0x37658e){_0x37658e=_0x37658e||0xcc;return function(_0x1bdc6e){if(_0x1bdc6e){return _0x457157[_0x6d78('0x1d')](_0x37658e);}return _0x457157['status'](_0x37658e)['end']();};}function respondWithResult(_0x471086,_0x5dbd1c){_0x5dbd1c=_0x5dbd1c||0xc8;return function(_0x210855){if(_0x210855){return _0x471086['status'](_0x5dbd1c)[_0x6d78('0x1e')](_0x210855);}};}function respondWithFilteredResult(_0x4dd7a5,_0x118a3e){return function(_0x378c59){if(_0x378c59){var _0x37fd03=_0x378c59['count'],_0x59d70a=_0x118a3e[_0x6d78('0x1f')],_0x5cf17f=_0x118a3e[_0x6d78('0x1f')]+_0x118a3e['limit'],_0x414193;if(_0x5cf17f>=_0x37fd03){_0x5cf17f=_0x37fd03;_0x414193=0xc8;}else{_0x414193=0xce;}_0x4dd7a5['status'](_0x414193);return _0x4dd7a5[_0x6d78('0x20')](_0x6d78('0x21'),_0x59d70a+'-'+_0x5cf17f+'/'+_0x37fd03)[_0x6d78('0x1e')](_0x378c59);}return null;};}function patchUpdates(_0x23e021){return function(_0x5c1282){try{jsonpatch[_0x6d78('0x22')](_0x5c1282,_0x23e021,!![]);}catch(_0x4c8cbc){return BPromise['reject'](_0x4c8cbc);}return _0x5c1282[_0x6d78('0x23')]();};}function saveUpdates(_0x49439b,_0x2a1d3e){return function(_0x177859){if(_0x177859){return _0x177859[_0x6d78('0x24')](_0x49439b)[_0x6d78('0x25')](function(_0x430b5e){return _0x430b5e;});}return null;};}function removeEntity(_0x45fa3b,_0x341793){return function(_0x36cb4a){if(_0x36cb4a){return _0x36cb4a['destroy']()[_0x6d78('0x25')](function(){_0x45fa3b[_0x6d78('0x26')](0xcc)[_0x6d78('0x27')]();});}};}function handleEntityNotFound(_0xc15670,_0x3d5b35){return function(_0x1563f0){if(!_0x1563f0){_0xc15670[_0x6d78('0x1d')](0x194);}return _0x1563f0;};}function handleError(_0x5c0d66,_0x146ff3){_0x146ff3=_0x146ff3||0x1f4;return function(_0x136a03){logger[_0x6d78('0x28')](_0x136a03[_0x6d78('0x29')]);if(_0x136a03[_0x6d78('0x2a')]){delete _0x136a03['name'];}_0x5c0d66[_0x6d78('0x26')](_0x146ff3)[_0x6d78('0x2b')](_0x136a03);};}exports[_0x6d78('0x2c')]=function(_0xf78fd6,_0x404ff7){var _0x508f99={},_0x1660aa={},_0x450601={'count':0x0,'rows':[]};var _0x5dbbc0=db[_0x6d78('0x2d')]['rawAttributes'];_0x1660aa[_0x6d78('0x2e')]=_[_0x6d78('0x2f')](_0x5dbbc0);var _0x3e6bac={'dateStart':_0xf78fd6[_0x6d78('0x30')][_0x6d78('0x31')],'dateEnd':_0xf78fd6[_0x6d78('0x30')][_0x6d78('0x32')]};delete _0xf78fd6[_0x6d78('0x30')][_0x6d78('0x31')];delete _0xf78fd6['query'][_0x6d78('0x32')];_0x1660aa['query']=_[_0x6d78('0x2f')](_0xf78fd6[_0x6d78('0x30')]);_0x1660aa[_0x6d78('0x33')]=_['intersection'](_0x1660aa['model'],_0x1660aa[_0x6d78('0x30')]);_0x508f99[_0x6d78('0x34')]=_['intersection'](_0x1660aa['model'],qs[_0x6d78('0x35')](_0xf78fd6[_0x6d78('0x30')][_0x6d78('0x35')]));_0x508f99[_0x6d78('0x34')]=_0x508f99[_0x6d78('0x34')][_0x6d78('0x36')]?_0x508f99['attributes']:_0x1660aa[_0x6d78('0x2e')];if(!_0xf78fd6[_0x6d78('0x30')][_0x6d78('0x37')](_0x6d78('0x38'))){_0x508f99[_0x6d78('0x39')]=qs['limit'](_0xf78fd6[_0x6d78('0x30')][_0x6d78('0x39')]);_0x508f99['offset']=qs[_0x6d78('0x1f')](_0xf78fd6[_0x6d78('0x30')][_0x6d78('0x1f')]);}_0x508f99[_0x6d78('0x3a')]=qs[_0x6d78('0x3b')](_0xf78fd6['query']['sort']);_0x508f99[_0x6d78('0x3c')]=qs['filters'](_['pick'](_0xf78fd6['query'],_0x1660aa[_0x6d78('0x33')]));if(_0x3e6bac[_0x6d78('0x31')]){if(_0x3e6bac['dateEnd']){_0x3e6bac[_0x6d78('0x32')]=moment(_0x3e6bac['dateEnd'])[_0x6d78('0x3d')](0x1,_0x6d78('0x3e'));}else{_0x3e6bac[_0x6d78('0x32')]=moment(_0x3e6bac[_0x6d78('0x31')])[_0x6d78('0x3d')](0x1,_0x6d78('0x3e'));}_[_0x6d78('0x3f')](_0x508f99['where'],{'createdAt':{'$gte':_0x3e6bac[_0x6d78('0x31')],'$lte':_0x3e6bac[_0x6d78('0x32')]}});}if(_0xf78fd6['query']['filter']){_0x508f99[_0x6d78('0x3c')]=_[_0x6d78('0x3f')](_0x508f99[_0x6d78('0x3c')],{'$or':_[_0x6d78('0x40')](_0x508f99[_0x6d78('0x34')],function(_0x8e65a4){var _0x1db6ce={};_0x1db6ce[_0x8e65a4]={'$like':'%'+_0xf78fd6['query'][_0x6d78('0x41')]+'%'};return _0x1db6ce;})});}_0x508f99=_[_0x6d78('0x3f')]({},_0x508f99,_0xf78fd6[_0x6d78('0x42')]);var _0x63a608={'where':_0x508f99['where']};_0x63a608['include']=[];if(_0xf78fd6[_0x6d78('0x30')][_0x6d78('0x43')]){_0x63a608[_0x6d78('0x44')][_0x6d78('0x45')]({'model':db[_0x6d78('0x46')],'as':_0x6d78('0x47'),'attributes':['id'],'where':{'id':_0xf78fd6['query']['tag']},'required':!![]});_0x63a608[_0x6d78('0x48')]=!![];}if(_0xf78fd6['query']['read']){_0x63a608[_0x6d78('0x44')][_0x6d78('0x45')]({'model':db[_0x6d78('0x49')],'as':_0x6d78('0x4a'),'attributes':['id',_0x6d78('0x4b'),'createdAt','read'],'where':{'direction':'in','read':_0xf78fd6['query'][_0x6d78('0x4c')]||![]},'required':!![]});_0x63a608['distinct']=!![];}return db['OpenchannelInteraction']['count'](_0x63a608)[_0x6d78('0x25')](function(_0x1c6597){_0x450601['count']=_0x1c6597;if(_0xf78fd6[_0x6d78('0x30')][_0x6d78('0x4d')]){_0x508f99[_0x6d78('0x44')]=[{'model':db[_0x6d78('0x4e')],'as':_0x6d78('0x4f'),'required':![],'attributes':['id',_0x6d78('0x2a'),_0x6d78('0x50')]},{'model':db['CmContact'],'as':_0x6d78('0x51'),'required':![]},{'model':db[_0x6d78('0x4e')],'as':_0x6d78('0x52'),'attributes':[_0x6d78('0x2a'),_0x6d78('0x50'),'internal'],'required':![]},{'model':db['OpenchannelAccount'],'as':_0x6d78('0x53'),'attributes':['name','key'],'required':![]},{'model':db[_0x6d78('0x49')],'as':_0x6d78('0x4a'),'attributes':['id',_0x6d78('0x4b'),_0x6d78('0x54'),_0x6d78('0x4c')],'where':{'direction':'in','read':_0xf78fd6[_0x6d78('0x30')][_0x6d78('0x4c')]||![]},'required':_0xf78fd6['query']['read']||![]},{'model':db[_0x6d78('0x46')],'as':_0x6d78('0x47'),'attributes':['id','name',_0x6d78('0x55')],'required':_0xf78fd6[_0x6d78('0x30')][_0x6d78('0x43')]?!![]:![]},{'model':db[_0x6d78('0x46')],'as':_0x6d78('0x56'),'attributes':['id','name',_0x6d78('0x55')],'through':_0xf78fd6[_0x6d78('0x30')]['tag']?{'attributes':[],'where':{'TagId':_0xf78fd6['query'][_0x6d78('0x43')]||undefined}}:{},'required':_0xf78fd6['query'][_0x6d78('0x43')]?!![]:![]}];}return db[_0x6d78('0x2d')]['findAll'](_0x508f99);})[_0x6d78('0x25')](function(_0x395d27){_0x450601[_0x6d78('0x57')]=_0x395d27;return _0x450601;})['then'](respondWithFilteredResult(_0x404ff7,_0x508f99))['catch'](handleError(_0x404ff7,null));};exports[_0x6d78('0x58')]=function(_0x508c1d,_0x4fbd08){var _0x243cc8={'raw':![],'where':{'id':_0x508c1d[_0x6d78('0x59')]['id']}},_0x2aa369={};_0x2aa369[_0x6d78('0x2e')]=_['keys'](db[_0x6d78('0x2d')][_0x6d78('0x5a')]);_0x2aa369[_0x6d78('0x30')]=_[_0x6d78('0x2f')](_0x508c1d['query']);_0x2aa369['filters']=_[_0x6d78('0x5b')](_0x2aa369[_0x6d78('0x2e')],_0x2aa369[_0x6d78('0x30')]);_0x243cc8[_0x6d78('0x34')]=_[_0x6d78('0x5b')](_0x2aa369['model'],qs[_0x6d78('0x35')](_0x508c1d[_0x6d78('0x30')][_0x6d78('0x35')]));_0x243cc8[_0x6d78('0x34')]=_0x243cc8[_0x6d78('0x34')][_0x6d78('0x36')]?_0x243cc8['attributes']:_0x2aa369['model'];if(_0x508c1d[_0x6d78('0x30')][_0x6d78('0x4d')]){_0x243cc8['include']=[{'all':!![]}];}_0x243cc8=_[_0x6d78('0x3f')]({},_0x243cc8,_0x508c1d[_0x6d78('0x42')]);return db[_0x6d78('0x2d')][_0x6d78('0x5c')](_0x243cc8)[_0x6d78('0x25')](handleEntityNotFound(_0x4fbd08,null))[_0x6d78('0x25')](respondWithResult(_0x4fbd08,null))[_0x6d78('0x5d')](handleError(_0x4fbd08,null));};exports[_0x6d78('0x5e')]=function(_0x149d9c,_0x60dcf9){return db[_0x6d78('0x2d')][_0x6d78('0x5e')](_0x149d9c[_0x6d78('0x5f')],{})[_0x6d78('0x25')](respondWithResult(_0x60dcf9,0xc9))[_0x6d78('0x5d')](handleError(_0x60dcf9,null));};exports[_0x6d78('0x24')]=function(_0x377ba9,_0x3f6487){if(_0x377ba9[_0x6d78('0x5f')]['id']){delete _0x377ba9[_0x6d78('0x5f')]['id'];}return db['OpenchannelInteraction'][_0x6d78('0x5c')]({'where':{'id':_0x377ba9[_0x6d78('0x59')]['id']}})[_0x6d78('0x25')](handleEntityNotFound(_0x3f6487,null))[_0x6d78('0x25')](saveUpdates(_0x377ba9[_0x6d78('0x5f')],null))[_0x6d78('0x25')](respondWithResult(_0x3f6487,null))[_0x6d78('0x5d')](handleError(_0x3f6487,null));};exports[_0x6d78('0x60')]=function(_0xca2f27,_0x1f484b){return db['OpenchannelInteraction'][_0x6d78('0x5c')]({'where':{'id':_0xca2f27[_0x6d78('0x59')]['id']}})[_0x6d78('0x25')](handleEntityNotFound(_0x1f484b,null))[_0x6d78('0x25')](removeEntity(_0x1f484b,null))[_0x6d78('0x5d')](handleError(_0x1f484b,null));};exports[_0x6d78('0x61')]=function(_0x19890b,_0x5e7eae){return db[_0x6d78('0x2d')][_0x6d78('0x61')]()[_0x6d78('0x25')](respondWithResult(_0x5e7eae,null))[_0x6d78('0x5d')](handleError(_0x5e7eae,null));};exports['addMessage']=function(_0x3936f8,_0x151acb,_0x63cc3e){return db[_0x6d78('0x49')][_0x6d78('0x5c')]({'where':{'id':_0x3936f8[_0x6d78('0x59')]['id']}})[_0x6d78('0x25')](handleEntityNotFound(_0x151acb,null))[_0x6d78('0x25')](function(_0x4b301f){if(_0x4b301f){return _0x4b301f[_0x6d78('0x62')](_0x3936f8[_0x6d78('0x5f')][_0x6d78('0x63')],_['omit'](_0x3936f8[_0x6d78('0x5f')],[_0x6d78('0x63'),'id'])||{});}})['then'](respondWithResult(_0x151acb,null))['catch'](handleError(_0x151acb,null));};exports[_0x6d78('0x64')]=function(_0x112b73,_0x2bb16a,_0x1cf488){var _0x314bb1={'raw':![],'where':{}};var _0x2b6ca4={};var _0x2168d2={'count':0x0,'rows':[]};return db[_0x6d78('0x2d')][_0x6d78('0x65')]({'where':{'id':_0x112b73[_0x6d78('0x59')]['id']}})[_0x6d78('0x25')](handleEntityNotFound(_0x2bb16a,null))[_0x6d78('0x25')](function(_0xef669e){if(_0xef669e){_0x2b6ca4[_0x6d78('0x2e')]=_[_0x6d78('0x2f')](db[_0x6d78('0x49')][_0x6d78('0x5a')]);_0x2b6ca4[_0x6d78('0x30')]=_[_0x6d78('0x2f')](_0x112b73[_0x6d78('0x30')]);_0x2b6ca4[_0x6d78('0x33')]=_[_0x6d78('0x5b')](_0x2b6ca4[_0x6d78('0x2e')],_0x2b6ca4[_0x6d78('0x30')]);_0x314bb1[_0x6d78('0x34')]=_[_0x6d78('0x5b')](_0x2b6ca4['model'],qs[_0x6d78('0x35')](_0x112b73[_0x6d78('0x30')]['fields']));_0x314bb1[_0x6d78('0x34')]=_0x314bb1['attributes']['length']?_0x314bb1[_0x6d78('0x34')]:_0x2b6ca4[_0x6d78('0x2e')];if(!_0x112b73[_0x6d78('0x30')][_0x6d78('0x37')](_0x6d78('0x38'))){_0x314bb1[_0x6d78('0x39')]=qs[_0x6d78('0x39')](_0x112b73[_0x6d78('0x30')][_0x6d78('0x39')]);_0x314bb1[_0x6d78('0x1f')]=qs[_0x6d78('0x1f')](_0x112b73[_0x6d78('0x30')][_0x6d78('0x1f')]);}_0x314bb1[_0x6d78('0x3a')]=qs[_0x6d78('0x3b')](_0x112b73[_0x6d78('0x30')]['sort']);_0x314bb1[_0x6d78('0x3c')]=qs[_0x6d78('0x33')](_[_0x6d78('0x66')](_0x112b73[_0x6d78('0x30')],_0x2b6ca4['filters']));_0x314bb1[_0x6d78('0x3c')][_0x6d78('0x67')]=_0xef669e['id'];if(_0x112b73[_0x6d78('0x30')][_0x6d78('0x41')]){_0x314bb1['where']=_[_0x6d78('0x3f')](_0x314bb1[_0x6d78('0x3c')],{'$or':_[_0x6d78('0x40')](_0x314bb1[_0x6d78('0x34')],function(_0x46648d){var _0x265eb3={};_0x265eb3[_0x46648d]={'$like':'%'+_0x112b73[_0x6d78('0x30')][_0x6d78('0x41')]+'%'};return _0x265eb3;})});}if(_0x112b73[_0x6d78('0x30')][_0x6d78('0x68')]){var _0x1c66a0=_0x112b73[_0x6d78('0x30')][_0x6d78('0x68')][_0x6d78('0x69')](',');var _0x2c6590={};_0x2c6590[_0x1c66a0[0x0]]={'$gte':moment(_0x1c66a0[0x1])['format'](_0x6d78('0x6a'))};_0x314bb1[_0x6d78('0x3c')]=_[_0x6d78('0x3f')](_0x314bb1[_0x6d78('0x3c')],_0x2c6590);}_0x314bb1=_['merge']({},_0x314bb1,_0x112b73[_0x6d78('0x42')]);return db[_0x6d78('0x49')]['count']({'where':_0x314bb1[_0x6d78('0x3c')]})[_0x6d78('0x25')](function(_0x500802){_0x2168d2[_0x6d78('0x6b')]=_0x500802;if(_0x112b73[_0x6d78('0x30')][_0x6d78('0x4d')]){_0x314bb1[_0x6d78('0x44')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x6d78('0x6c')](_0x314bb1);})[_0x6d78('0x25')](function(_0x4a530c){_0x2168d2['rows']=_0x4a530c;return _0x2168d2;});}})[_0x6d78('0x25')](respondWithFilteredResult(_0x2bb16a,_0x314bb1))[_0x6d78('0x5d')](handleError(_0x2bb16a,null));};exports[_0x6d78('0x6d')]=function(_0x25cf0e,_0xcbe08c,_0x18a54b){return db[_0x6d78('0x2d')][_0x6d78('0x5c')]({'where':{'id':_0x25cf0e[_0x6d78('0x59')]['id']}})[_0x6d78('0x25')](handleEntityNotFound(_0xcbe08c,null))[_0x6d78('0x25')](function(_0x491762){if(_0x491762){return _0x491762[_0x6d78('0x6e')](_0x25cf0e[_0x6d78('0x5f')][_0x6d78('0x63')],_[_0x6d78('0x6f')](_0x25cf0e[_0x6d78('0x5f')],[_0x6d78('0x63'),'id'])||{})[_0x6d78('0x70')](function(){return db[_0x6d78('0x46')][_0x6d78('0x6c')]({'attributes':['id',_0x6d78('0x2a'),_0x6d78('0x55')],'where':{'id':_0x25cf0e['body'][_0x6d78('0x63')]}});})[_0x6d78('0x25')](function(_0x36e2f9){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x25cf0e[_0x6d78('0x59')]['id']),'tags':_0x36e2f9||[]});return{'id':Number(_0x25cf0e[_0x6d78('0x59')]['id']),'tags':_0x36e2f9||[]};});}})['then'](respondWithResult(_0xcbe08c,null))[_0x6d78('0x5d')](handleError(_0xcbe08c,null));};exports['removeTags']=function(_0x310684,_0x19c202,_0xdd806){var _0x243817;return db[_0x6d78('0x2d')][_0x6d78('0x5c')]({'where':{'id':_0x310684['params']['id']}})[_0x6d78('0x25')](handleEntityNotFound(_0x19c202,null))[_0x6d78('0x25')](function(_0x8d9034){if(_0x8d9034){return _0x8d9034['removeTags'](_0x310684['query'][_0x6d78('0x63')]);}})[_0x6d78('0x25')](respondWithStatusCode(_0x19c202,null))['catch'](handleError(_0x19c202,null));};exports[_0x6d78('0x71')]=function(_0x34500d,_0x26f416){var _0x114ed7=moment()[_0x6d78('0x72')]()[_0x6d78('0x73')]();var _0x4cb6fe=path[_0x6d78('0x74')](config[_0x6d78('0x75')],_0x6d78('0x76'),'files',_0x6d78('0x77'));var _0x4fd4e3=path[_0x6d78('0x74')](config[_0x6d78('0x75')],_0x6d78('0x76'),_0x6d78('0x78'),_0x6d78('0x79'));var _0x392798=path[_0x6d78('0x74')](_0x4cb6fe,_0x114ed7);var _0x51991f=util[_0x6d78('0x7a')]('interaction-%s.zip',_0x114ed7);var _0x1fda57=path[_0x6d78('0x74')](_0x4cb6fe,_0x51991f);var _0x289877=![];return db[_0x6d78('0x2d')]['find']({'where':{'id':_0x34500d['params']['id']},'include':[{'model':db[_0x6d78('0x49')],'as':_0x6d78('0x4a'),'attributes':['id','body'],'include':[{'model':db[_0x6d78('0x4e')],'as':_0x6d78('0x4e'),'attributes':['id',_0x6d78('0x50')],'raw':!![]},{'model':db[_0x6d78('0x7b')],'as':'Contact','attributes':['id',_0x6d78('0x7c')],'raw':!![]},{'model':db[_0x6d78('0x7d')],'as':_0x6d78('0x7d'),'raw':!![]}]}]})[_0x6d78('0x25')](handleEntityNotFound(_0x26f416,null))[_0x6d78('0x25')](function(_0x22ccec){if(_0x22ccec){_0x289877=!![];var _0x103fa5='';var _0x3827b7={'format':_0x6d78('0x7e'),'border':_0x6d78('0x7f')};fs['mkdirSync'](_0x392798);_0x103fa5+=util['format'](_0x6d78('0x80'),_0x22ccec['id']);_0x103fa5+=util[_0x6d78('0x7a')]('

Date:\x20%s

',moment()['format']('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')[_0x6d78('0x73')]());_0x103fa5+=_0x6d78('0x81');for(var _0x2f4bc7=0x0;_0x2f4bc7<_0x22ccec[_0x6d78('0x4a')][_0x6d78('0x36')];_0x2f4bc7++){var _0xe862f7=_0x22ccec[_0x6d78('0x4a')][_0x2f4bc7];_0x103fa5+=_0x6d78('0x82');_0x103fa5+=util['format'](_0x6d78('0x83'),_0xe862f7[_0x6d78('0x4e')]?_0xe862f7[_0x6d78('0x4e')][_0x6d78('0x50')]:_0xe862f7['Contact'][_0x6d78('0x7c')],_0xe862f7['body']);_0x103fa5+='';if(_0xe862f7['Attachment']){var _0x21f0a8=_0xe862f7[_0x6d78('0x7d')];var _0x2f92d0=path[_0x6d78('0x74')](_0x4fd4e3,_0x21f0a8['basename']);if(fs['existsSync'](_0x2f92d0)){fs[_0x6d78('0x84')](_0x2f92d0)[_0x6d78('0x85')](fs['createWriteStream'](path[_0x6d78('0x74')](_0x392798,_0x21f0a8[_0x6d78('0x86')])));}}}return new BPromise(function(_0xc2d177,_0x5a3a00){pdf[_0x6d78('0x5e')](_0x103fa5,_0x3827b7)['toFile'](path[_0x6d78('0x74')](_0x392798,_0x6d78('0x87')+_0x114ed7+'.pdf'),function(_0x39f5d2,_0x48ab16){if(_0x39f5d2)return _0x5a3a00(_0x39f5d2);_0xc2d177(_0x48ab16);});});}})['then'](function(){if(_0x289877){return new BPromise(function(_0x333d8f,_0x2d9663){zipdir(_0x392798,{'saveTo':_0x1fda57},function(_0x227d6e,_0x55b966){if(_0x227d6e)return _0x2d9663(_0x227d6e);return _0x333d8f(_0x55b966);});});}})[_0x6d78('0x25')](function(){if(_0x289877){return new BPromise(function(_0x336016,_0x1860f5){rimraf(_0x392798,function(_0x175fad){if(_0x175fad)_0x1860f5(_0x175fad);return _0x336016();});});}})[_0x6d78('0x25')](function(){if(_0x289877){return _0x26f416['download'](_0x1fda57,_0x51991f,function(_0x4d24b2){if(_0x4d24b2){console[_0x6d78('0x88')](_0x6d78('0x89'),_0x4d24b2);}else{fs[_0x6d78('0x8a')](_0x1fda57);}});}else{return _0x26f416[_0x6d78('0x1d')](0xc8);}})[_0x6d78('0x5d')](handleError(_0x26f416,null));}; \ No newline at end of file +var _0x3f48=['Content-Range','apply','reject','update','then','destroy','error','stack','name','send','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','include','push','tag','distinct','read','OpenchannelMessage','direction','OpenchannelInteraction','includeAll','Users','fullname','CmContact','Contact','Owner','OpenchannelAccount','Messages','createdAt','Tag','Tags','ThroughTags','findAll','catch','show','params','rawAttributes','find','create','body','describe','addMessage','ids','getMessages','findOne','OpenchannelInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','color','openchannelInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','interaction-%s.zip','firstName','Attachment','Letter','1cm','mkdirSync','

Openchannel\x20Interaction:\x20#%d

','

Date:\x20%s

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

','User','basename','existsSync','pipe','createWriteStream','interaction-','.pdf','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','./openchannelInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f48,0x17c));var _0x83f4=function(_0x27f92f,_0x497f5d){_0x27f92f=_0x27f92f-0x0;var _0xe03314=_0x3f48[_0x27f92f];return _0xe03314;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x83f4('0x0'));var zipdir=require(_0x83f4('0x1'));var jsonpatch=require(_0x83f4('0x2'));var rp=require(_0x83f4('0x3'));var moment=require('moment');var BPromise=require(_0x83f4('0x4'));var Mustache=require(_0x83f4('0x5'));var util=require('util');var path=require(_0x83f4('0x6'));var sox=require('sox');var csv=require(_0x83f4('0x7'));var ejs=require(_0x83f4('0x8'));var fs=require('fs');var _=require(_0x83f4('0x9'));var squel=require(_0x83f4('0xa'));var crypto=require(_0x83f4('0xb'));var jsforce=require(_0x83f4('0xc'));var deskjs=require(_0x83f4('0xd'));var toCsv=require(_0x83f4('0x7'));var querystring=require('querystring');var Papa=require(_0x83f4('0xe'));var Redis=require(_0x83f4('0xf'));var qs=require(_0x83f4('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x83f4('0x11'));var db=require(_0x83f4('0x12'))['db'];config[_0x83f4('0x13')]=_['defaults'](config[_0x83f4('0x13')],{'host':_0x83f4('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x83f4('0x13')]));require(_0x83f4('0x15'))[_0x83f4('0x16')](socket);function respondWithStatusCode(_0x2d4c9b,_0xdcfc5e){_0xdcfc5e=_0xdcfc5e||0xcc;return function(_0x3aee93){if(_0x3aee93){return _0x2d4c9b[_0x83f4('0x17')](_0xdcfc5e);}return _0x2d4c9b['status'](_0xdcfc5e)[_0x83f4('0x18')]();};}function respondWithResult(_0x18c56d,_0x204164){_0x204164=_0x204164||0xc8;return function(_0x8062f){if(_0x8062f){return _0x18c56d[_0x83f4('0x19')](_0x204164)[_0x83f4('0x1a')](_0x8062f);}};}function respondWithFilteredResult(_0x4f0f62,_0x1b5626){return function(_0x37dbac){if(_0x37dbac){var _0x239e1e=_0x37dbac[_0x83f4('0x1b')],_0x202511=_0x1b5626['offset'],_0x10f04c=_0x1b5626[_0x83f4('0x1c')]+_0x1b5626[_0x83f4('0x1d')],_0x5db794;if(_0x10f04c>=_0x239e1e){_0x10f04c=_0x239e1e;_0x5db794=0xc8;}else{_0x5db794=0xce;}_0x4f0f62[_0x83f4('0x19')](_0x5db794);return _0x4f0f62[_0x83f4('0x1e')](_0x83f4('0x1f'),_0x202511+'-'+_0x10f04c+'/'+_0x239e1e)[_0x83f4('0x1a')](_0x37dbac);}return null;};}function patchUpdates(_0x52452b){return function(_0x79c248){try{jsonpatch[_0x83f4('0x20')](_0x79c248,_0x52452b,!![]);}catch(_0x2fa788){return BPromise[_0x83f4('0x21')](_0x2fa788);}return _0x79c248['save']();};}function saveUpdates(_0x596ec8,_0x2522da){return function(_0x32e3b0){if(_0x32e3b0){return _0x32e3b0[_0x83f4('0x22')](_0x596ec8)[_0x83f4('0x23')](function(_0x487262){return _0x487262;});}return null;};}function removeEntity(_0x362b6b,_0x219bd1){return function(_0x4115da){if(_0x4115da){return _0x4115da[_0x83f4('0x24')]()['then'](function(){_0x362b6b[_0x83f4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x386530,_0x201b2f){return function(_0x224d63){if(!_0x224d63){_0x386530[_0x83f4('0x17')](0x194);}return _0x224d63;};}function handleError(_0x27623d,_0x46d0d3){_0x46d0d3=_0x46d0d3||0x1f4;return function(_0x7b3d0c){logger[_0x83f4('0x25')](_0x7b3d0c[_0x83f4('0x26')]);if(_0x7b3d0c[_0x83f4('0x27')]){delete _0x7b3d0c[_0x83f4('0x27')];}_0x27623d['status'](_0x46d0d3)[_0x83f4('0x28')](_0x7b3d0c);};}exports['index']=function(_0x5d260d,_0xb54e26){var _0x5f17f5={},_0x250693={},_0xbc819e={'count':0x0,'rows':[]};var _0x139913=db['OpenchannelInteraction']['rawAttributes'];_0x250693['model']=_[_0x83f4('0x29')](_0x139913);var _0x410a42={'dateStart':_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x2b')],'dateEnd':_0x5d260d['query'][_0x83f4('0x2c')]};delete _0x5d260d[_0x83f4('0x2a')][_0x83f4('0x2b')];delete _0x5d260d[_0x83f4('0x2a')][_0x83f4('0x2c')];_0x250693[_0x83f4('0x2a')]=_[_0x83f4('0x29')](_0x5d260d[_0x83f4('0x2a')]);_0x250693['filters']=_[_0x83f4('0x2d')](_0x250693['model'],_0x250693[_0x83f4('0x2a')]);_0x5f17f5['attributes']=_[_0x83f4('0x2d')](_0x250693['model'],qs[_0x83f4('0x2e')](_0x5d260d[_0x83f4('0x2a')]['fields']));_0x5f17f5[_0x83f4('0x2f')]=_0x5f17f5['attributes'][_0x83f4('0x30')]?_0x5f17f5['attributes']:_0x250693[_0x83f4('0x31')];if(!_0x5d260d['query'][_0x83f4('0x32')](_0x83f4('0x33'))){_0x5f17f5[_0x83f4('0x1d')]=qs[_0x83f4('0x1d')](_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x1d')]);_0x5f17f5['offset']=qs[_0x83f4('0x1c')](_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x1c')]);}_0x5f17f5[_0x83f4('0x34')]=qs[_0x83f4('0x35')](_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x35')]);_0x5f17f5[_0x83f4('0x36')]=qs[_0x83f4('0x37')](_[_0x83f4('0x38')](_0x5d260d[_0x83f4('0x2a')],_0x250693[_0x83f4('0x37')]));if(_0x410a42[_0x83f4('0x2b')]){if(_0x410a42[_0x83f4('0x2c')]){_0x410a42[_0x83f4('0x2c')]=moment(_0x410a42[_0x83f4('0x2c')])[_0x83f4('0x39')](0x1,_0x83f4('0x3a'));}else{_0x410a42[_0x83f4('0x2c')]=moment(_0x410a42[_0x83f4('0x2b')])[_0x83f4('0x39')](0x1,'day');}_[_0x83f4('0x3b')](_0x5f17f5['where'],{'createdAt':{'$gte':_0x410a42['dateStart'],'$lte':_0x410a42[_0x83f4('0x2c')]}});}if(_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x3c')]){_0x5f17f5[_0x83f4('0x36')]=_['merge'](_0x5f17f5[_0x83f4('0x36')],{'$or':_[_0x83f4('0x3d')](_0x5f17f5[_0x83f4('0x2f')],function(_0x391033){var _0x4f73a0={};_0x4f73a0[_0x391033]={'$like':'%'+_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x3c')]+'%'};return _0x4f73a0;})});}_0x5f17f5=_[_0x83f4('0x3b')]({},_0x5f17f5,_0x5d260d[_0x83f4('0x3e')]);var _0x224ec8={'where':_0x5f17f5[_0x83f4('0x36')]};_0x224ec8[_0x83f4('0x3f')]=[];if(_0x5d260d[_0x83f4('0x2a')]['tag']){_0x224ec8[_0x83f4('0x3f')][_0x83f4('0x40')]({'model':db['Tag'],'as':'Tags','attributes':['id'],'where':{'id':_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x41')]},'required':!![]});_0x224ec8[_0x83f4('0x42')]=!![];}if(_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x43')]){_0x224ec8[_0x83f4('0x3f')][_0x83f4('0x40')]({'model':db[_0x83f4('0x44')],'as':'Messages','attributes':['id',_0x83f4('0x45'),'createdAt',_0x83f4('0x43')],'where':{'direction':'in','read':_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x43')]||![]},'required':!![]});_0x224ec8[_0x83f4('0x42')]=!![];}return db[_0x83f4('0x46')]['count'](_0x224ec8)['then'](function(_0x35bf03){_0xbc819e[_0x83f4('0x1b')]=_0x35bf03;if(_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x47')]){_0x5f17f5[_0x83f4('0x3f')]=[{'model':db['User'],'as':_0x83f4('0x48'),'required':![],'attributes':['id',_0x83f4('0x27'),_0x83f4('0x49')]},{'model':db[_0x83f4('0x4a')],'as':_0x83f4('0x4b'),'required':![]},{'model':db['User'],'as':_0x83f4('0x4c'),'attributes':[_0x83f4('0x27'),_0x83f4('0x49'),'internal'],'required':![]},{'model':db[_0x83f4('0x4d')],'as':'Account','attributes':['name','key'],'required':![]},{'model':db[_0x83f4('0x44')],'as':_0x83f4('0x4e'),'attributes':['id',_0x83f4('0x45'),_0x83f4('0x4f'),_0x83f4('0x43')],'where':{'direction':'in','read':_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x43')]||![]},'required':_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x43')]||![]},{'model':db[_0x83f4('0x50')],'as':_0x83f4('0x51'),'attributes':['id','name','color'],'required':_0x5d260d['query'][_0x83f4('0x41')]?!![]:![]},{'model':db[_0x83f4('0x50')],'as':_0x83f4('0x52'),'attributes':['id',_0x83f4('0x27'),'color'],'through':_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x41')]?{'attributes':[],'where':{'TagId':_0x5d260d['query']['tag']||undefined}}:{},'required':_0x5d260d[_0x83f4('0x2a')][_0x83f4('0x41')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x83f4('0x53')](_0x5f17f5);})[_0x83f4('0x23')](function(_0x2df278){_0xbc819e['rows']=_0x2df278;return _0xbc819e;})[_0x83f4('0x23')](respondWithFilteredResult(_0xb54e26,_0x5f17f5))[_0x83f4('0x54')](handleError(_0xb54e26,null));};exports[_0x83f4('0x55')]=function(_0x9b5fad,_0x27dfa9){var _0x2e2b2f={'raw':![],'where':{'id':_0x9b5fad[_0x83f4('0x56')]['id']}},_0x2bf597={};_0x2bf597['model']=_['keys'](db[_0x83f4('0x46')][_0x83f4('0x57')]);_0x2bf597[_0x83f4('0x2a')]=_[_0x83f4('0x29')](_0x9b5fad['query']);_0x2bf597[_0x83f4('0x37')]=_[_0x83f4('0x2d')](_0x2bf597['model'],_0x2bf597['query']);_0x2e2b2f['attributes']=_[_0x83f4('0x2d')](_0x2bf597[_0x83f4('0x31')],qs[_0x83f4('0x2e')](_0x9b5fad[_0x83f4('0x2a')][_0x83f4('0x2e')]));_0x2e2b2f['attributes']=_0x2e2b2f[_0x83f4('0x2f')][_0x83f4('0x30')]?_0x2e2b2f[_0x83f4('0x2f')]:_0x2bf597['model'];if(_0x9b5fad[_0x83f4('0x2a')][_0x83f4('0x47')]){_0x2e2b2f[_0x83f4('0x3f')]=[{'all':!![]}];}_0x2e2b2f=_['merge']({},_0x2e2b2f,_0x9b5fad['options']);return db[_0x83f4('0x46')][_0x83f4('0x58')](_0x2e2b2f)['then'](handleEntityNotFound(_0x27dfa9,null))[_0x83f4('0x23')](respondWithResult(_0x27dfa9,null))[_0x83f4('0x54')](handleError(_0x27dfa9,null));};exports[_0x83f4('0x59')]=function(_0x52888b,_0x360396){return db[_0x83f4('0x46')][_0x83f4('0x59')](_0x52888b['body'],{})[_0x83f4('0x23')](respondWithResult(_0x360396,0xc9))['catch'](handleError(_0x360396,null));};exports[_0x83f4('0x22')]=function(_0x38366a,_0xdaf4ed){if(_0x38366a[_0x83f4('0x5a')]['id']){delete _0x38366a[_0x83f4('0x5a')]['id'];}return db[_0x83f4('0x46')][_0x83f4('0x58')]({'where':{'id':_0x38366a[_0x83f4('0x56')]['id']}})[_0x83f4('0x23')](handleEntityNotFound(_0xdaf4ed,null))[_0x83f4('0x23')](saveUpdates(_0x38366a[_0x83f4('0x5a')],null))[_0x83f4('0x23')](respondWithResult(_0xdaf4ed,null))[_0x83f4('0x54')](handleError(_0xdaf4ed,null));};exports['destroy']=function(_0x424cea,_0x48f894){return db['OpenchannelInteraction'][_0x83f4('0x58')]({'where':{'id':_0x424cea[_0x83f4('0x56')]['id']}})['then'](handleEntityNotFound(_0x48f894,null))[_0x83f4('0x23')](removeEntity(_0x48f894,null))[_0x83f4('0x54')](handleError(_0x48f894,null));};exports[_0x83f4('0x5b')]=function(_0x1d2203,_0x5d570c){return db[_0x83f4('0x46')][_0x83f4('0x5b')]()[_0x83f4('0x23')](respondWithResult(_0x5d570c,null))[_0x83f4('0x54')](handleError(_0x5d570c,null));};exports[_0x83f4('0x5c')]=function(_0x46df5f,_0x279a22,_0xe84d6f){return db[_0x83f4('0x44')]['find']({'where':{'id':_0x46df5f[_0x83f4('0x56')]['id']}})['then'](handleEntityNotFound(_0x279a22,null))[_0x83f4('0x23')](function(_0x1dbd2a){if(_0x1dbd2a){return _0x1dbd2a[_0x83f4('0x5c')](_0x46df5f[_0x83f4('0x5a')]['ids'],_['omit'](_0x46df5f[_0x83f4('0x5a')],[_0x83f4('0x5d'),'id'])||{});}})[_0x83f4('0x23')](respondWithResult(_0x279a22,null))[_0x83f4('0x54')](handleError(_0x279a22,null));};exports[_0x83f4('0x5e')]=function(_0x143ac9,_0x1da546,_0x32c600){var _0x1236e0={'raw':![],'where':{}};var _0x101d6c={};var _0x40406e={'count':0x0,'rows':[]};return db[_0x83f4('0x46')][_0x83f4('0x5f')]({'where':{'id':_0x143ac9[_0x83f4('0x56')]['id']}})[_0x83f4('0x23')](handleEntityNotFound(_0x1da546,null))['then'](function(_0x17bcf8){if(_0x17bcf8){_0x101d6c[_0x83f4('0x31')]=_[_0x83f4('0x29')](db[_0x83f4('0x44')][_0x83f4('0x57')]);_0x101d6c[_0x83f4('0x2a')]=_['keys'](_0x143ac9[_0x83f4('0x2a')]);_0x101d6c[_0x83f4('0x37')]=_[_0x83f4('0x2d')](_0x101d6c['model'],_0x101d6c['query']);_0x1236e0[_0x83f4('0x2f')]=_['intersection'](_0x101d6c[_0x83f4('0x31')],qs[_0x83f4('0x2e')](_0x143ac9['query'][_0x83f4('0x2e')]));_0x1236e0[_0x83f4('0x2f')]=_0x1236e0[_0x83f4('0x2f')][_0x83f4('0x30')]?_0x1236e0[_0x83f4('0x2f')]:_0x101d6c[_0x83f4('0x31')];if(!_0x143ac9[_0x83f4('0x2a')][_0x83f4('0x32')](_0x83f4('0x33'))){_0x1236e0['limit']=qs[_0x83f4('0x1d')](_0x143ac9[_0x83f4('0x2a')]['limit']);_0x1236e0['offset']=qs[_0x83f4('0x1c')](_0x143ac9[_0x83f4('0x2a')][_0x83f4('0x1c')]);}_0x1236e0[_0x83f4('0x34')]=qs[_0x83f4('0x35')](_0x143ac9[_0x83f4('0x2a')][_0x83f4('0x35')]);_0x1236e0[_0x83f4('0x36')]=qs[_0x83f4('0x37')](_['pick'](_0x143ac9[_0x83f4('0x2a')],_0x101d6c[_0x83f4('0x37')]));_0x1236e0[_0x83f4('0x36')][_0x83f4('0x60')]=_0x17bcf8['id'];if(_0x143ac9['query'][_0x83f4('0x3c')]){_0x1236e0[_0x83f4('0x36')]=_[_0x83f4('0x3b')](_0x1236e0[_0x83f4('0x36')],{'$or':_[_0x83f4('0x3d')](_0x1236e0[_0x83f4('0x2f')],function(_0x298577){var _0x50d673={};_0x50d673[_0x298577]={'$like':'%'+_0x143ac9[_0x83f4('0x2a')][_0x83f4('0x3c')]+'%'};return _0x50d673;})});}if(_0x143ac9[_0x83f4('0x2a')]['$gte']){var _0x2bbe55=_0x143ac9[_0x83f4('0x2a')][_0x83f4('0x61')][_0x83f4('0x62')](',');var _0x91e84a={};_0x91e84a[_0x2bbe55[0x0]]={'$gte':moment(_0x2bbe55[0x1])[_0x83f4('0x63')](_0x83f4('0x64'))};_0x1236e0['where']=_[_0x83f4('0x3b')](_0x1236e0[_0x83f4('0x36')],_0x91e84a);}_0x1236e0=_[_0x83f4('0x3b')]({},_0x1236e0,_0x143ac9[_0x83f4('0x3e')]);return db['OpenchannelMessage'][_0x83f4('0x1b')]({'where':_0x1236e0[_0x83f4('0x36')]})[_0x83f4('0x23')](function(_0x4bb941){_0x40406e['count']=_0x4bb941;if(_0x143ac9['query'][_0x83f4('0x47')]){_0x1236e0['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x83f4('0x53')](_0x1236e0);})[_0x83f4('0x23')](function(_0x1362a3){_0x40406e[_0x83f4('0x65')]=_0x1362a3;return _0x40406e;});}})[_0x83f4('0x23')](respondWithFilteredResult(_0x1da546,_0x1236e0))[_0x83f4('0x54')](handleError(_0x1da546,null));};exports[_0x83f4('0x66')]=function(_0x19f511,_0x27e7ba,_0x5d6c82){return db[_0x83f4('0x46')][_0x83f4('0x58')]({'where':{'id':_0x19f511[_0x83f4('0x56')]['id']}})[_0x83f4('0x23')](handleEntityNotFound(_0x27e7ba,null))[_0x83f4('0x23')](function(_0x33c07b){if(_0x33c07b){return _0x33c07b[_0x83f4('0x67')](_0x19f511['body'][_0x83f4('0x5d')],_[_0x83f4('0x68')](_0x19f511[_0x83f4('0x5a')],[_0x83f4('0x5d'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x83f4('0x69')],'where':{'id':_0x19f511[_0x83f4('0x5a')]['ids']}});})[_0x83f4('0x23')](function(_0x1cc854){socket['emit'](_0x83f4('0x6a'),{'id':Number(_0x19f511[_0x83f4('0x56')]['id']),'tags':_0x1cc854||[]});return{'id':Number(_0x19f511[_0x83f4('0x56')]['id']),'tags':_0x1cc854||[]};});}})[_0x83f4('0x23')](respondWithResult(_0x27e7ba,null))[_0x83f4('0x54')](handleError(_0x27e7ba,null));};exports[_0x83f4('0x6b')]=function(_0x22ad6e,_0x3b5273,_0x468109){var _0x1ca25d;return db[_0x83f4('0x46')]['find']({'where':{'id':_0x22ad6e['params']['id']}})['then'](handleEntityNotFound(_0x3b5273,null))['then'](function(_0x553e09){if(_0x553e09){return _0x553e09['removeTags'](_0x22ad6e[_0x83f4('0x2a')][_0x83f4('0x5d')]);}})[_0x83f4('0x23')](respondWithStatusCode(_0x3b5273,null))[_0x83f4('0x54')](handleError(_0x3b5273,null));};exports[_0x83f4('0x6c')]=function(_0x37565e,_0x51434e){var _0x31881e=moment()[_0x83f4('0x6d')]()[_0x83f4('0x6e')]();var _0x52e5fb=path[_0x83f4('0x6f')](config['root'],_0x83f4('0x70'),_0x83f4('0x71'),_0x83f4('0x72'));var _0x2b3201=path[_0x83f4('0x6f')](config[_0x83f4('0x73')],_0x83f4('0x70'),'files',_0x83f4('0x74'));var _0x5cf383=path[_0x83f4('0x6f')](_0x52e5fb,_0x31881e);var _0x30b691=util[_0x83f4('0x63')](_0x83f4('0x75'),_0x31881e);var _0x49e50b=path['join'](_0x52e5fb,_0x30b691);var _0x5d75e0=![];return db[_0x83f4('0x46')][_0x83f4('0x58')]({'where':{'id':_0x37565e[_0x83f4('0x56')]['id']},'include':[{'model':db[_0x83f4('0x44')],'as':'Messages','attributes':['id',_0x83f4('0x5a')],'include':[{'model':db['User'],'as':'User','attributes':['id',_0x83f4('0x49')],'raw':!![]},{'model':db[_0x83f4('0x4a')],'as':_0x83f4('0x4b'),'attributes':['id',_0x83f4('0x76')],'raw':!![]},{'model':db['Attachment'],'as':_0x83f4('0x77'),'raw':!![]}]}]})[_0x83f4('0x23')](handleEntityNotFound(_0x51434e,null))['then'](function(_0x5db7b5){if(_0x5db7b5){_0x5d75e0=!![];var _0x295012='';var _0x3ee3fb={'format':_0x83f4('0x78'),'border':_0x83f4('0x79')};fs[_0x83f4('0x7a')](_0x5cf383);_0x295012+=util['format'](_0x83f4('0x7b'),_0x5db7b5['id']);_0x295012+=util[_0x83f4('0x63')](_0x83f4('0x7c'),moment()[_0x83f4('0x63')](_0x83f4('0x7d'))[_0x83f4('0x6e')]());_0x295012+='
';for(var _0x678271=0x0;_0x678271<_0x5db7b5[_0x83f4('0x4e')][_0x83f4('0x30')];_0x678271++){var _0xd8f0a1=_0x5db7b5[_0x83f4('0x4e')][_0x678271];_0x295012+=_0x83f4('0x7e');_0x295012+=util[_0x83f4('0x63')](_0x83f4('0x7f'),_0xd8f0a1[_0x83f4('0x80')]?_0xd8f0a1['User']['fullname']:_0xd8f0a1['Contact'][_0x83f4('0x76')],_0xd8f0a1[_0x83f4('0x5a')]);_0x295012+='';if(_0xd8f0a1[_0x83f4('0x77')]){var _0xbb170d=_0xd8f0a1['Attachment'];var _0x2a2499=path[_0x83f4('0x6f')](_0x2b3201,_0xbb170d[_0x83f4('0x81')]);if(fs[_0x83f4('0x82')](_0x2a2499)){fs['createReadStream'](_0x2a2499)[_0x83f4('0x83')](fs[_0x83f4('0x84')](path[_0x83f4('0x6f')](_0x5cf383,_0xbb170d[_0x83f4('0x81')])));}}}return new BPromise(function(_0x560de9,_0xd38556){pdf[_0x83f4('0x59')](_0x295012,_0x3ee3fb)['toFile'](path[_0x83f4('0x6f')](_0x5cf383,_0x83f4('0x85')+_0x31881e+_0x83f4('0x86')),function(_0x57007f,_0x2103ac){if(_0x57007f)return _0xd38556(_0x57007f);_0x560de9(_0x2103ac);});});}})[_0x83f4('0x23')](function(){if(_0x5d75e0){return new BPromise(function(_0x4e9aaf,_0x523cdc){zipdir(_0x5cf383,{'saveTo':_0x49e50b},function(_0x14138c,_0x281837){if(_0x14138c)return _0x523cdc(_0x14138c);return _0x4e9aaf(_0x281837);});});}})[_0x83f4('0x23')](function(){if(_0x5d75e0){return new BPromise(function(_0x319a50,_0x22e54e){rimraf(_0x5cf383,function(_0x34e0e3){if(_0x34e0e3)_0x22e54e(_0x34e0e3);return _0x319a50();});});}})['then'](function(){if(_0x5d75e0){return _0x51434e[_0x83f4('0x6c')](_0x49e50b,_0x30b691,function(_0x5edda1){if(_0x5edda1){console['log'](_0x83f4('0x87'),_0x5edda1);}else{fs[_0x83f4('0x88')](_0x49e50b);}});}else{return _0x51434e[_0x83f4('0x17')](0xc8);}})[_0x83f4('0x54')](handleError(_0x51434e,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5c667ef..9378ee9 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 _0x0603=['../../mysqldb','OpenchannelInteraction','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0x0603,0xf0));var _0x3060=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x0603[_0x199572];return _0x13cfa3;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x3060('0x0'))['db'][_0x3060('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3060('0x2'),'afterUpdate':_0x3060('0x3'),'afterDestroy':_0x3060('0x4')};function emitEvent(_0xfcd2f9){return function(_0x5a6306,_0x56d8e5,_0x1bc2d8){OpenchannelInteractionEvents['emit'](_0xfcd2f9+':'+_0x5a6306['id'],_0x5a6306);OpenchannelInteractionEvents['emit'](_0xfcd2f9,_0x5a6306);_0x1bc2d8(null);};}for(var e in events){if(events[_0x3060('0x5')](e)){var event=events[e];OpenchannelInteraction[_0x3060('0x6')](e,emitEvent(event));}}module[_0x3060('0x7')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x7c17=['remove','emit','hasOwnProperty','hook','exports','OpenchannelInteraction','setMaxListeners','save'];(function(_0x5d4ed0,_0x4d9248){var _0x10a04a=function(_0x463500){while(--_0x463500){_0x5d4ed0['push'](_0x5d4ed0['shift']());}};_0x10a04a(++_0x4d9248);}(_0x7c17,0x95));var _0x77c1=function(_0x3c296a,_0x511238){_0x3c296a=_0x3c296a-0x0;var _0x325326=_0x7c17[_0x3c296a];return _0x325326;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x77c1('0x0')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x77c1('0x1')](0x0);var events={'afterCreate':_0x77c1('0x2'),'afterUpdate':'update','afterDestroy':_0x77c1('0x3')};function emitEvent(_0x12b4e0){return function(_0x235533,_0x360c66,_0x61fbea){OpenchannelInteractionEvents['emit'](_0x12b4e0+':'+_0x235533['id'],_0x235533);OpenchannelInteractionEvents[_0x77c1('0x4')](_0x12b4e0,_0x235533);_0x61fbea(null);};}for(var e in events){if(events[_0x77c1('0x5')](e)){var event=events[e];OpenchannelInteraction[_0x77c1('0x6')](e,emitEvent(event));}}module[_0x77c1('0x7')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 29cf161..710243e 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 _0x218a=['api','moment','bluebird','request-promise','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','lodash'];(function(_0x311d91,_0x4b9dc9){var _0x3705e1=function(_0xb1ad01){while(--_0xb1ad01){_0x311d91['push'](_0x311d91['shift']());}};_0x3705e1(++_0x4b9dc9);}(_0x218a,0x1e7));var _0xa218=function(_0x3682ad,_0x3d954f){_0x3682ad=_0x3682ad-0x0;var _0x212ff3=_0x218a[_0x3682ad];return _0x212ff3;};'use strict';var _=require(_0xa218('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa218('0x1'));var moment=require(_0xa218('0x2'));var BPromise=require(_0xa218('0x3'));var rp=require(_0xa218('0x4'));var attributes=require(_0xa218('0x5'));module['exports']=function(_0x57b881,_0x5ec773){return _0x57b881['define'](_0xa218('0x6'),attributes,{'tableName':_0xa218('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97eb=['./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','lodash','api','moment','bluebird','request-promise'];(function(_0x2f8ed7,_0xde2ecf){var _0x3aadfc=function(_0x201db9){while(--_0x201db9){_0x2f8ed7['push'](_0x2f8ed7['shift']());}};_0x3aadfc(++_0xde2ecf);}(_0x97eb,0xb8));var _0xb97e=function(_0x29a8cc,_0xd0909b){_0x29a8cc=_0x29a8cc-0x0;var _0x1c7217=_0x97eb[_0x29a8cc];return _0x1c7217;};'use strict';var _=require(_0xb97e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb97e('0x1'));var moment=require(_0xb97e('0x2'));var BPromise=require(_0xb97e('0x3'));var rp=require(_0xb97e('0x4'));var attributes=require(_0xb97e('0x5'));module[_0xb97e('0x6')]=function(_0x1954c1,_0x3c95eb){return _0x1954c1['define'](_0xb97e('0x7'),attributes,{'tableName':_0xb97e('0x8'),'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 a007324..bb7b245 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 _0xaa3f=['OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4a96ca,_0x582ae8){var _0xf91c0c=function(_0x20fea9){while(--_0x20fea9){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0xf91c0c(++_0x582ae8);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x42e865,_0x475af8){_0x42e865=_0x42e865-0x0;var _0xba3ae0=_0xaa3f[_0x42e865];return _0xba3ae0;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var moment=require(_0xfaa3('0x2'));var BPromise=require(_0xfaa3('0x3'));var rs=require(_0xfaa3('0x4'));var fs=require('fs');var Redis=require(_0xfaa3('0x5'));var db=require(_0xfaa3('0x6'))['db'];var utils=require(_0xfaa3('0x7'));var logger=require(_0xfaa3('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfaa3('0x9'));var client=jayson['client'][_0xfaa3('0xa')]({'port':0x232a});config[_0xfaa3('0xb')]=_[_0xfaa3('0xc')](config[_0xfaa3('0xb')],{'host':_0xfaa3('0xd'),'port':0x18eb});var socket=require(_0xfaa3('0xe'))(new Redis(config[_0xfaa3('0xb')]));require('./openchannelInteraction.socket')[_0xfaa3('0xf')](socket);function respondWithRpcPromise(_0x28de66,_0x49380c,_0x5ca0da){return new BPromise(function(_0x44d88e,_0xce3b1f){return client[_0xfaa3('0x10')](_0x28de66,_0x5ca0da)[_0xfaa3('0x11')](function(_0x23e4b6){logger[_0xfaa3('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x49380c,_0xfaa3('0x13'));logger['debug'](_0xfaa3('0x14'),_0x49380c,_0xfaa3('0x13'),JSON[_0xfaa3('0x15')](_0x23e4b6));if(_0x23e4b6['error']){if(_0x23e4b6[_0xfaa3('0x16')]['code']===0x1f4){logger[_0xfaa3('0x16')](_0xfaa3('0x17'),_0x49380c,_0x23e4b6[_0xfaa3('0x16')][_0xfaa3('0x18')]);return _0xce3b1f(_0x23e4b6[_0xfaa3('0x16')][_0xfaa3('0x18')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x49380c,_0x23e4b6[_0xfaa3('0x16')][_0xfaa3('0x18')]);return _0x44d88e(_0x23e4b6[_0xfaa3('0x16')][_0xfaa3('0x18')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x49380c,'request\x20sent');_0x44d88e(_0x23e4b6['result']['message']);}})[_0xfaa3('0x19')](function(_0x5cc884){logger[_0xfaa3('0x16')](_0xfaa3('0x17'),_0x49380c,_0x5cc884);_0xce3b1f(_0x5cc884);});});}exports[_0xfaa3('0x1a')]=function(_0x34b276){var _0x1c32dd=this;return new Promise(function(_0x310b0d,_0x1dd053){return db[_0xfaa3('0x1b')][_0xfaa3('0x1c')](_0x34b276[_0xfaa3('0x1d')],{'raw':_0x34b276['options']?_0x34b276[_0xfaa3('0x1e')][_0xfaa3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34b276[_0xfaa3('0x1e')]?_0x34b276[_0xfaa3('0x1e')]['where']||null:null,'attributes':_0x34b276[_0xfaa3('0x1e')]?_0x34b276[_0xfaa3('0x1e')][_0xfaa3('0x20')]||null:null,'limit':_0x34b276[_0xfaa3('0x1e')]?_0x34b276[_0xfaa3('0x1e')][_0xfaa3('0x21')]||null:null})[_0xfaa3('0x11')](function(_0x11841c){logger['info'](_0xfaa3('0x1a'),_0x34b276);logger[_0xfaa3('0x22')](_0xfaa3('0x1a'),_0x34b276,JSON[_0xfaa3('0x15')](_0x11841c));_0x310b0d(_0x11841c);})[_0xfaa3('0x19')](function(_0xf83bbe){logger[_0xfaa3('0x16')](_0xfaa3('0x1a'),_0xf83bbe[_0xfaa3('0x18')],_0x34b276);_0x1dd053(_0x1c32dd[_0xfaa3('0x16')](0x1f4,_0xf83bbe[_0xfaa3('0x18')]));});});};exports[_0xfaa3('0x23')]=function(_0x18bd3e){return new Promise(function(_0x1bc202,_0x2d7c43){return db['OpenchannelInteraction'][_0xfaa3('0x24')]({'where':_0x18bd3e[_0xfaa3('0x1e')]?_0x18bd3e[_0xfaa3('0x1e')]['where']||null:null})[_0xfaa3('0x11')](function(_0x50fb9f){if(_0x50fb9f){return _0x50fb9f[_0xfaa3('0x25')](_0x18bd3e['body'][_0xfaa3('0x26')],_[_0xfaa3('0x27')](_0x18bd3e[_0xfaa3('0x1d')],[_0xfaa3('0x26'),'id'])||{});}})[_0xfaa3('0x28')](function(_0x33ae08){logger[_0xfaa3('0x12')](_0xfaa3('0x29'),_0x18bd3e);logger['debug'](_0xfaa3('0x29'),_0x18bd3e,JSON[_0xfaa3('0x15')](_0x33ae08));_0x1bc202(_0x33ae08);})[_0xfaa3('0x19')](function(_0x174f78){logger[_0xfaa3('0x16')](_0xfaa3('0x29'),_0x174f78[_0xfaa3('0x18')],_0x18bd3e);_0x2d7c43(_this[_0xfaa3('0x16')](0x1f4,_0x174f78[_0xfaa3('0x18')]));});});}; \ No newline at end of file +var _0x1261=['../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelInteraction','options','raw','where','attributes','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','body','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x1261[_0x47fd36];return _0x21a0fc;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['UpdateOpenchannelInteraction']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['update'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22ed37[_0x1126('0x1a')]?_0x22ed37['options'][_0x1126('0x1c')]||null:null,'attributes':_0x22ed37[_0x1126('0x1a')]?_0x22ed37['options'][_0x1126('0x1d')]||null:null,'limit':_0x22ed37['options']?_0x22ed37['options']['limit']||null:null})[_0x1126('0x1e')](function(_0x15bcc3){logger[_0x1126('0x17')](_0x1126('0x1f'),_0x22ed37);logger[_0x1126('0x11')](_0x1126('0x1f'),_0x22ed37,JSON[_0x1126('0x13')](_0x15bcc3));_0x2f70ac(_0x15bcc3);})[_0x1126('0x18')](function(_0x589725){logger[_0x1126('0x14')](_0x1126('0x1f'),_0x589725[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19['error'](0x1f4,_0x589725['message']));});});};exports[_0x1126('0x20')]=function(_0x39bf0e){return new Promise(function(_0x55e195,_0x2fb797){return db[_0x1126('0x19')]['find']({'where':_0x39bf0e[_0x1126('0x1a')]?_0x39bf0e['options'][_0x1126('0x1c')]||null:null})['then'](function(_0x771bb8){if(_0x771bb8){return _0x771bb8['addTags'](_0x39bf0e[_0x1126('0x21')]['ids'],_['omit'](_0x39bf0e['body'],[_0x1126('0x22'),'id'])||{});}})[_0x1126('0x23')](function(_0x1cef48){logger['info'](_0x1126('0x24'),_0x39bf0e);logger[_0x1126('0x11')]('AddTags',_0x39bf0e,JSON[_0x1126('0x13')](_0x1cef48));_0x55e195(_0x1cef48);})[_0x1126('0x18')](function(_0x2d8127){logger[_0x1126('0x14')]('AddTags',_0x2d8127['message'],_0x39bf0e);_0x2fb797(_this[_0x1126('0x14')](0x1f4,_0x2d8127[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f120678..848c861 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 _0xb243=['update','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xb243,0x1a5));var _0x3b24=function(_0x36b1c4,_0x34e9f7){_0x36b1c4=_0x36b1c4-0x0;var _0x4b266f=_0xb243[_0x36b1c4];return _0x4b266f;};'use strict';var OpenchannelInteractionEvents=require(_0x3b24('0x0'));var events=[_0x3b24('0x1'),_0x3b24('0x2'),_0x3b24('0x3')];function createListener(_0x216620,_0x5b3bdb){return function(_0x2388ca){_0x5b3bdb['emit'](_0x216620,_0x2388ca);};}function removeListener(_0x55cd85,_0x58b94c){return function(){OpenchannelInteractionEvents[_0x3b24('0x4')](_0x55cd85,_0x58b94c);};}exports[_0x3b24('0x5')]=function(_0x275f50){for(var _0x2f01d2=0x0,_0x162e36=events[_0x3b24('0x6')];_0x2f01d2<_0x162e36;_0x2f01d2++){var _0x38468a=events[_0x2f01d2];var _0x6ade39=createListener(_0x3b24('0x7')+_0x38468a,_0x275f50);OpenchannelInteractionEvents['on'](_0x38468a,_0x6ade39);}}; \ No newline at end of file +var _0x2204=['openchannelInteraction:','remove','update','emit','register','length'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0x2204,0xd3));var _0x4220=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2204[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0x4220('0x0'),_0x4220('0x1')];function createListener(_0xa82e78,_0x442afb){return function(_0xdea4ee){_0x442afb[_0x4220('0x2')](_0xa82e78,_0xdea4ee);};}function removeListener(_0x2725d7,_0x19adf3){return function(){OpenchannelInteractionEvents['removeListener'](_0x2725d7,_0x19adf3);};}exports[_0x4220('0x3')]=function(_0x2b094f){for(var _0x111d69=0x0,_0x56c5c3=events[_0x4220('0x4')];_0x111d69<_0x56c5c3;_0x111d69++){var _0x3ab1b4=events[_0x111d69];var _0x21acc8=createListener(_0x4220('0x5')+_0x3ab1b4,_0x2b094f);OpenchannelInteractionEvents['on'](_0x3ab1b4,_0x21acc8);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index fee5a01..eb9d1d6 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 _0xd4de=['express','Router','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3f5190,_0x21927d){var _0x4a414e=function(_0x41c66f){while(--_0x41c66f){_0x3f5190['push'](_0x3f5190['shift']());}};_0x4a414e(++_0x21927d);}(_0xd4de,0x1ac));var _0xed4d=function(_0xc43faa,_0x3860f4){_0xc43faa=_0xc43faa-0x0;var _0x313cb6=_0xd4de[_0xc43faa];return _0x313cb6;};'use strict';var multer=require(_0xed4d('0x0'));var util=require(_0xed4d('0x1'));var path=require(_0xed4d('0x2'));var timeout=require(_0xed4d('0x3'));var express=require(_0xed4d('0x4'));var router=express[_0xed4d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xed4d('0x6'));var config=require(_0xed4d('0x7'));var controller=require(_0xed4d('0x8'));router[_0xed4d('0x9')]('/',auth[_0xed4d('0xa')](),controller[_0xed4d('0xb')]);router[_0xed4d('0x9')](_0xed4d('0xc'),auth[_0xed4d('0xa')](),controller[_0xed4d('0xd')]);router[_0xed4d('0x9')](_0xed4d('0xe'),auth[_0xed4d('0xa')](),controller[_0xed4d('0xf')]);router[_0xed4d('0x10')]('/',auth[_0xed4d('0xa')](),interaction['tracked'](_0xed4d('0x11'),_0xed4d('0x12')),controller['create']);router[_0xed4d('0x13')](_0xed4d('0xe'),auth[_0xed4d('0xa')](),controller[_0xed4d('0x14')]);router[_0xed4d('0x13')](_0xed4d('0x15'),auth['isAuthenticated'](),controller[_0xed4d('0x16')]);router[_0xed4d('0x13')](_0xed4d('0x17'),auth[_0xed4d('0xa')](),controller[_0xed4d('0x18')]);router['delete']('/:id',auth[_0xed4d('0xa')](),controller[_0xed4d('0x19')]);module[_0xed4d('0x1a')]=router; \ No newline at end of file +var _0xf9ec=['express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','get','/describe','describe','tracked','openchannelmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout'];(function(_0x2005a1,_0x105247){var _0x5e1b06=function(_0xc06abc){while(--_0xc06abc){_0x2005a1['push'](_0x2005a1['shift']());}};_0x5e1b06(++_0x105247);}(_0xf9ec,0x128));var _0xcf9e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf9ec[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xcf9e('0x0'));var util=require(_0xcf9e('0x1'));var path=require(_0xcf9e('0x2'));var timeout=require(_0xcf9e('0x3'));var express=require(_0xcf9e('0x4'));var router=express[_0xcf9e('0x5')]();var auth=require(_0xcf9e('0x6'));var interaction=require(_0xcf9e('0x7'));var config=require('../../config/environment');var controller=require(_0xcf9e('0x8'));router['get']('/',auth[_0xcf9e('0x9')](),controller['index']);router[_0xcf9e('0xa')](_0xcf9e('0xb'),auth[_0xcf9e('0x9')](),controller[_0xcf9e('0xc')]);router[_0xcf9e('0xa')]('/:id',auth[_0xcf9e('0x9')](),controller['show']);router['post']('/',auth[_0xcf9e('0x9')](),interaction[_0xcf9e('0xd')]('openchannel',_0xcf9e('0xe')),controller[_0xcf9e('0xf')]);router[_0xcf9e('0x10')](_0xcf9e('0x11'),auth[_0xcf9e('0x9')](),controller[_0xcf9e('0x12')]);router[_0xcf9e('0x10')](_0xcf9e('0x13'),auth[_0xcf9e('0x9')](),controller[_0xcf9e('0x14')]);router[_0xcf9e('0x10')](_0xcf9e('0x15'),auth[_0xcf9e('0x9')](),controller[_0xcf9e('0x16')]);router[_0xcf9e('0x17')](_0xcf9e('0x11'),auth[_0xcf9e('0x9')](),controller[_0xcf9e('0x18')]);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 1b99fe4..f12425f 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 _0x3651=['BOOLEAN','ENUM','DATE','sequelize','medium'];(function(_0x260a78,_0x20c234){var _0x56c872=function(_0x37db61){while(--_0x37db61){_0x260a78['push'](_0x260a78['shift']());}};_0x56c872(++_0x20c234);}(_0x3651,0x1a2));var _0x1365=function(_0x2ed2be,_0x4d4052){_0x2ed2be=_0x2ed2be-0x0;var _0x3e9991=_0x3651[_0x2ed2be];return _0x3e9991;};'use strict';var Sequelize=require(_0x1365('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1365('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1365('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1365('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1365('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x1365('0x4')]}}; \ No newline at end of file +var _0x4c6c=['TEXT','BOOLEAN','ENUM','out','sequelize'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0x4c6c,0x77));var _0xc4c6=function(_0x2e9226,_0x5c5dab){_0x2e9226=_0x2e9226-0x0;var _0x17c89e=_0x4c6c[_0x2e9226];return _0x17c89e;};'use strict';var Sequelize=require(_0xc4c6('0x0'));module['exports']={'body':{'type':Sequelize[_0xc4c6('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc4c6('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc4c6('0x3')]('in',_0xc4c6('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d7bfed3..0c72005 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 _0x4f80=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','stack','name','send','index','rawAttributes','model','keys','query','dateStart','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','dateEnd','add','day','merge','filter','map','options','OpenchannelMessage','params','include','find','create','body','destroy','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','Contact','get','OpenchannelInteractionId','UserId','isNil','read1stAt','format','interaction','info','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','event','EventManager','acceptmessage','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','rejectmessage','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4f80,0x163));var _0x04f8=function(_0x229532,_0x1c0e67){_0x229532=_0x229532-0x0;var _0x598c8a=_0x4f80[_0x229532];return _0x598c8a;};'use strict';var pdf=require(_0x04f8('0x0'));var emlformat=require(_0x04f8('0x1'));var rimraf=require(_0x04f8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x04f8('0x3'));var moment=require(_0x04f8('0x4'));var BPromise=require(_0x04f8('0x5'));var Mustache=require(_0x04f8('0x6'));var util=require(_0x04f8('0x7'));var path=require('path');var sox=require(_0x04f8('0x8'));var csv=require(_0x04f8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x04f8('0xa'));var squel=require(_0x04f8('0xb'));var crypto=require(_0x04f8('0xc'));var jsforce=require(_0x04f8('0xd'));var deskjs=require(_0x04f8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x04f8('0xf'));var Papa=require(_0x04f8('0x10'));var Redis=require(_0x04f8('0x11'));var qs=require(_0x04f8('0x12'));var logger=require('../../config/logger')(_0x04f8('0x13'));var utils=require(_0x04f8('0x14'));var config=require(_0x04f8('0x15'));var db=require(_0x04f8('0x16'))['db'];config[_0x04f8('0x17')]=_[_0x04f8('0x18')](config[_0x04f8('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x04f8('0x19'))(new Redis(config['redis']));require(_0x04f8('0x1a'))[_0x04f8('0x1b')](socket);var jayson=require(_0x04f8('0x1c'));var client=jayson[_0x04f8('0x1d')][_0x04f8('0x1e')]({'port':0x232c});var client9002=jayson[_0x04f8('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x84f3a2,_0x2c2f1e,_0x3d83b6,_0x52be93){return new BPromise(function(_0x8c6032,_0x578163){var _0x1ad1ba=_0x52be93||client;return _0x1ad1ba[_0x04f8('0x1f')](_0x84f3a2,_0x3d83b6)[_0x04f8('0x20')](function(_0x5c1c13){logger['info'](_0x04f8('0x21'),_0x2c2f1e,_0x04f8('0x22'));logger[_0x04f8('0x23')](_0x04f8('0x24'),_0x2c2f1e,_0x04f8('0x22'),JSON[_0x04f8('0x25')](_0x5c1c13));if(_0x5c1c13[_0x04f8('0x26')]){if(_0x5c1c13['error']['code']===0x1f4){logger['error'](_0x04f8('0x21'),_0x2c2f1e,_0x5c1c13[_0x04f8('0x26')][_0x04f8('0x27')]);return _0x578163(_0x5c1c13[_0x04f8('0x26')][_0x04f8('0x27')]);}logger['error'](_0x04f8('0x21'),_0x2c2f1e,_0x5c1c13[_0x04f8('0x26')][_0x04f8('0x27')]);return _0x8c6032(_0x5c1c13['error']['message']);}else{logger['info'](_0x04f8('0x21'),_0x2c2f1e,_0x04f8('0x22'));_0x8c6032(_0x5c1c13[_0x04f8('0x28')][_0x04f8('0x27')]);}})[_0x04f8('0x29')](function(_0x3a645f){logger[_0x04f8('0x26')](_0x04f8('0x21'),_0x2c2f1e,_0x3a645f);_0x578163(_0x3a645f);});});}function respondWithStatusCode(_0x5cd289,_0xdc4774){_0xdc4774=_0xdc4774||0xcc;return function(_0x4c4533){if(_0x4c4533){return _0x5cd289[_0x04f8('0x2a')](_0xdc4774);}return _0x5cd289[_0x04f8('0x2b')](_0xdc4774)[_0x04f8('0x2c')]();};}function respondWithResult(_0x2b73ef,_0x14c03b){_0x14c03b=_0x14c03b||0xc8;return function(_0x44c02f){if(_0x44c02f){return _0x2b73ef[_0x04f8('0x2b')](_0x14c03b)[_0x04f8('0x2d')](_0x44c02f);}};}function respondWithFilteredResult(_0x4040a8,_0x563a75){return function(_0x40adcd){if(_0x40adcd){var _0x15bfcb=_0x40adcd[_0x04f8('0x2e')],_0x188382=_0x563a75[_0x04f8('0x2f')],_0x35bfcc=_0x563a75[_0x04f8('0x2f')]+_0x563a75[_0x04f8('0x30')],_0x5b7cbf;if(_0x35bfcc>=_0x15bfcb){_0x35bfcc=_0x15bfcb;_0x5b7cbf=0xc8;}else{_0x5b7cbf=0xce;}_0x4040a8['status'](_0x5b7cbf);return _0x4040a8[_0x04f8('0x31')](_0x04f8('0x32'),_0x188382+'-'+_0x35bfcc+'/'+_0x15bfcb)[_0x04f8('0x2d')](_0x40adcd);}return null;};}function patchUpdates(_0x7d47a){return function(_0x4fc880){try{jsonpatch['apply'](_0x4fc880,_0x7d47a,!![]);}catch(_0x3ac8e0){return BPromise[_0x04f8('0x33')](_0x3ac8e0);}return _0x4fc880['save']();};}function saveUpdates(_0x280388,_0x2ce374){return function(_0x4810c5){if(_0x4810c5){return _0x4810c5[_0x04f8('0x34')](_0x280388)['then'](function(_0x14e119){return _0x14e119;});}return null;};}function removeEntity(_0x25c165,_0x5a6715){return function(_0x3e262e){if(_0x3e262e){return _0x3e262e['destroy']()['then'](function(){_0x25c165[_0x04f8('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58d0f3,_0x2e3d68){return function(_0x3e51ad){if(!_0x3e51ad){_0x58d0f3[_0x04f8('0x2a')](0x194);}return _0x3e51ad;};}function handleError(_0x6533ac,_0x911ab4){_0x911ab4=_0x911ab4||0x1f4;return function(_0x26ce83){logger['error'](_0x26ce83[_0x04f8('0x35')]);if(_0x26ce83[_0x04f8('0x36')]){delete _0x26ce83[_0x04f8('0x36')];}_0x6533ac[_0x04f8('0x2b')](_0x911ab4)[_0x04f8('0x37')](_0x26ce83);};}exports[_0x04f8('0x38')]=function(_0xd1bdea,_0x1ea088){var _0x245885={},_0x3c2607={},_0x365e39={'count':0x0,'rows':[]};var _0x5d8d6c=db['OpenchannelMessage'][_0x04f8('0x39')];_0x3c2607[_0x04f8('0x3a')]=_[_0x04f8('0x3b')](_0x5d8d6c);var _0x23d967={'dateStart':_0xd1bdea[_0x04f8('0x3c')][_0x04f8('0x3d')],'dateEnd':_0xd1bdea['query']['dateEnd']};delete _0xd1bdea[_0x04f8('0x3c')]['dateStart'];delete _0xd1bdea[_0x04f8('0x3c')]['dateEnd'];_0x3c2607[_0x04f8('0x3c')]=_[_0x04f8('0x3b')](_0xd1bdea[_0x04f8('0x3c')]);_0x3c2607['filters']=_[_0x04f8('0x3e')](_0x3c2607[_0x04f8('0x3a')],_0x3c2607[_0x04f8('0x3c')]);_0x245885['attributes']=_[_0x04f8('0x3e')](_0x3c2607[_0x04f8('0x3a')],qs[_0x04f8('0x3f')](_0xd1bdea['query']['fields']));_0x245885[_0x04f8('0x40')]=_0x245885[_0x04f8('0x40')][_0x04f8('0x41')]?_0x245885['attributes']:_0x3c2607[_0x04f8('0x3a')];if(!_0xd1bdea[_0x04f8('0x3c')][_0x04f8('0x42')](_0x04f8('0x43'))){_0x245885['limit']=qs[_0x04f8('0x30')](_0xd1bdea[_0x04f8('0x3c')]['limit']);_0x245885[_0x04f8('0x2f')]=qs[_0x04f8('0x2f')](_0xd1bdea[_0x04f8('0x3c')][_0x04f8('0x2f')]);}_0x245885[_0x04f8('0x44')]=qs[_0x04f8('0x45')](_0xd1bdea[_0x04f8('0x3c')][_0x04f8('0x45')]);_0x245885[_0x04f8('0x46')]=qs[_0x04f8('0x47')](_[_0x04f8('0x48')](_0xd1bdea[_0x04f8('0x3c')],_0x3c2607[_0x04f8('0x47')]));if(_0x23d967['dateStart']){if(_0x23d967[_0x04f8('0x49')]){_0x23d967[_0x04f8('0x49')]=moment(_0x23d967['dateEnd'])[_0x04f8('0x4a')](0x1,_0x04f8('0x4b'));}else{_0x23d967[_0x04f8('0x49')]=moment(_0x23d967[_0x04f8('0x3d')])[_0x04f8('0x4a')](0x1,_0x04f8('0x4b'));}_[_0x04f8('0x4c')](_0x245885[_0x04f8('0x46')],{'createdAt':{'$gte':_0x23d967[_0x04f8('0x3d')],'$lte':_0x23d967[_0x04f8('0x49')]}});}if(_0xd1bdea['query'][_0x04f8('0x4d')]){_0x245885['where']=_[_0x04f8('0x4c')](_0x245885[_0x04f8('0x46')],{'$or':_[_0x04f8('0x4e')](_0x245885[_0x04f8('0x40')],function(_0x4ae342){var _0x39fe88={};_0x39fe88[_0x4ae342]={'$like':'%'+_0xd1bdea[_0x04f8('0x3c')]['filter']+'%'};return _0x39fe88;})});}_0x245885=_[_0x04f8('0x4c')]({},_0x245885,_0xd1bdea[_0x04f8('0x4f')]);var _0x30d338={'where':_0x245885[_0x04f8('0x46')]};return db[_0x04f8('0x50')][_0x04f8('0x2e')](_0x30d338)[_0x04f8('0x20')](function(_0x593a5f){_0x365e39[_0x04f8('0x2e')]=_0x593a5f;if(_0xd1bdea[_0x04f8('0x3c')]['includeAll']){_0x245885['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x245885);})[_0x04f8('0x20')](function(_0x381f67){_0x365e39['rows']=_0x381f67;return _0x365e39;})[_0x04f8('0x20')](respondWithFilteredResult(_0x1ea088,_0x245885))[_0x04f8('0x29')](handleError(_0x1ea088,null));};exports['show']=function(_0x118603,_0x56039d){var _0x143e83={'raw':!![],'where':{'id':_0x118603[_0x04f8('0x51')]['id']}},_0x53d3c1={};_0x53d3c1['model']=_[_0x04f8('0x3b')](db[_0x04f8('0x50')][_0x04f8('0x39')]);_0x53d3c1[_0x04f8('0x3c')]=_[_0x04f8('0x3b')](_0x118603[_0x04f8('0x3c')]);_0x53d3c1[_0x04f8('0x47')]=_[_0x04f8('0x3e')](_0x53d3c1[_0x04f8('0x3a')],_0x53d3c1[_0x04f8('0x3c')]);_0x143e83[_0x04f8('0x40')]=_[_0x04f8('0x3e')](_0x53d3c1[_0x04f8('0x3a')],qs[_0x04f8('0x3f')](_0x118603[_0x04f8('0x3c')][_0x04f8('0x3f')]));_0x143e83['attributes']=_0x143e83[_0x04f8('0x40')][_0x04f8('0x41')]?_0x143e83[_0x04f8('0x40')]:_0x53d3c1[_0x04f8('0x3a')];if(_0x118603[_0x04f8('0x3c')]['includeAll']){_0x143e83[_0x04f8('0x52')]=[{'all':!![]}];}_0x143e83=_['merge']({},_0x143e83,_0x118603[_0x04f8('0x4f')]);return db[_0x04f8('0x50')][_0x04f8('0x53')](_0x143e83)['then'](handleEntityNotFound(_0x56039d,null))[_0x04f8('0x20')](respondWithResult(_0x56039d,null))[_0x04f8('0x29')](handleError(_0x56039d,null));};exports[_0x04f8('0x54')]=function(_0x5d12b4,_0x2cd85e){return db['OpenchannelMessage'][_0x04f8('0x54')](_0x5d12b4['body'],{})['then'](respondWithResult(_0x2cd85e,0xc9))[_0x04f8('0x29')](handleError(_0x2cd85e,null));};exports[_0x04f8('0x34')]=function(_0xba0de0,_0x3f7753){if(_0xba0de0[_0x04f8('0x55')]['id']){delete _0xba0de0['body']['id'];}return db[_0x04f8('0x50')][_0x04f8('0x53')]({'where':{'id':_0xba0de0[_0x04f8('0x51')]['id']}})[_0x04f8('0x20')](handleEntityNotFound(_0x3f7753,null))[_0x04f8('0x20')](saveUpdates(_0xba0de0[_0x04f8('0x55')],null))[_0x04f8('0x20')](respondWithResult(_0x3f7753,null))[_0x04f8('0x29')](handleError(_0x3f7753,null));};exports[_0x04f8('0x56')]=function(_0x2dd7e5,_0x4454ab){return db['OpenchannelMessage'][_0x04f8('0x53')]({'where':{'id':_0x2dd7e5['params']['id']}})[_0x04f8('0x20')](handleEntityNotFound(_0x4454ab,null))['then'](removeEntity(_0x4454ab,null))[_0x04f8('0x29')](handleError(_0x4454ab,null));};exports[_0x04f8('0x57')]=function(_0x4b0489,_0x419d09){return db[_0x04f8('0x50')][_0x04f8('0x57')]()[_0x04f8('0x20')](respondWithResult(_0x419d09,null))[_0x04f8('0x29')](handleError(_0x419d09,null));};var interaction_log=require(_0x04f8('0x58'))(_0x04f8('0x59'));exports[_0x04f8('0x5a')]=function(_0x541e82,_0xb55f32,_0x25a1b9){var _0x5b16ea={'channel':_0x04f8('0x5b')};if(_0x541e82[_0x04f8('0x55')]['id']){delete _0x541e82[_0x04f8('0x55')]['id'];}_0x541e82[_0x04f8('0x55')][_0x04f8('0x5c')]=!![];_0x541e82[_0x04f8('0x55')][_0x04f8('0x5d')]=moment()['format'](_0x04f8('0x5e'));_0x541e82[_0x04f8('0x55')]['UserId']=_0x541e82[_0x04f8('0x55')]['UserId']||_0x541e82[_0x04f8('0x5f')]['id'];return db[_0x04f8('0x50')][_0x04f8('0x53')]({'where':{'id':_0x541e82[_0x04f8('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x04f8('0x60')}]})['then'](handleEntityNotFound(_0xb55f32,null))[_0x04f8('0x20')](saveUpdates(_0x541e82['body'],null))[_0x04f8('0x20')](function(_0x4a6f93){if(_0x4a6f93){_0x5b16ea[_0x04f8('0x27')]=_0x4a6f93[_0x04f8('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x04f8('0x53')]({'where':{'id':_0x4a6f93[_0x04f8('0x62')]}});}return null;})['then'](handleEntityNotFound(_0xb55f32,null))['then'](function(_0x2ddd06){if(_0x2ddd06){return _0x2ddd06[_0x04f8('0x34')]({'UserId':_0x541e82[_0x04f8('0x55')][_0x04f8('0x63')],'read1stAt':_[_0x04f8('0x64')](_0x2ddd06[_0x04f8('0x65')])?moment()[_0x04f8('0x66')](_0x04f8('0x5e')):undefined});}return null;})[_0x04f8('0x20')](function(_0x5a6dd3){if(_0x5a6dd3){_0x5b16ea[_0x04f8('0x67')]=_0x5a6dd3[_0x04f8('0x61')]({'plain':!![]});interaction_log[_0x04f8('0x68')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x541e82[_0x04f8('0x5f')]['id'],_0x541e82[_0x04f8('0x5f')][_0x04f8('0x36')],_0x541e82[_0x04f8('0x5f')][_0x04f8('0x69')],_0x5b16ea[_0x04f8('0x67')]['id'],_0x541e82['body']?JSON['stringify'](_0x541e82['body']):_0x04f8('0x6a'));return respondWithRpcPromise(_0x04f8('0x6b'),_0x04f8('0x6c'),_0x5b16ea);}return null;})[_0x04f8('0x20')](function(_0x86aa1b){if(_0x86aa1b){if(_0x541e82['body']['manual']){_0x5b16ea[_0x04f8('0x27')][_0x04f8('0x6d')]=util['format'](_0x04f8('0x6e'),_0x541e82['user'][_0x04f8('0x36')]);_0x5b16ea['message']['channel']=_0x5b16ea['channel'];_0x5b16ea[_0x04f8('0x27')][_0x04f8('0x6f')]=_0x04f8('0x5a');return respondWithRpcPromise(_0x04f8('0x70'),_0x04f8('0x70'),{'event':_0x04f8('0x71'),'message':_0x5b16ea[_0x04f8('0x27')]},client9002)[_0x04f8('0x20')](function(){return _0x5b16ea;});}return _0x5b16ea;}return null;})[_0x04f8('0x20')](respondWithResult(_0xb55f32,null))['catch'](handleError(_0xb55f32,null));};var interaction_log=require('../../config/logger')(_0x04f8('0x59'));exports[_0x04f8('0x33')]=function(_0x36a76f,_0x33de0d,_0x335650){var _0x1ebe6a={'agent':{},'channel':'openchannel'};if(_0x36a76f[_0x04f8('0x55')]['id']){delete _0x36a76f[_0x04f8('0x55')]['id'];}_0x36a76f[_0x04f8('0x55')]['UserId']=_0x36a76f[_0x04f8('0x55')][_0x04f8('0x63')]||_0x36a76f[_0x04f8('0x5f')]['id'];_0x1ebe6a[_0x04f8('0x72')]['id']=_0x36a76f[_0x04f8('0x55')][_0x04f8('0x63')];return db[_0x04f8('0x50')][_0x04f8('0x53')]({'where':{'id':_0x36a76f[_0x04f8('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x33de0d,null))[_0x04f8('0x20')](function(_0x3c7498){if(_0x3c7498){_0x1ebe6a[_0x04f8('0x27')]=_0x3c7498['get']({'plain':!![]});return db[_0x04f8('0x73')][_0x04f8('0x53')]({'where':{'id':_0x3c7498[_0x04f8('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x33de0d,null))[_0x04f8('0x20')](function(_0x25be90){if(_0x25be90){_0x1ebe6a[_0x04f8('0x67')]=_0x25be90[_0x04f8('0x61')]({'plain':!![]});interaction_log[_0x04f8('0x68')](_0x04f8('0x74'),_0x36a76f[_0x04f8('0x5f')]['id'],_0x36a76f[_0x04f8('0x5f')][_0x04f8('0x36')],_0x36a76f[_0x04f8('0x5f')][_0x04f8('0x69')],_0x1ebe6a[_0x04f8('0x67')]['id'],_0x36a76f[_0x04f8('0x55')]?JSON[_0x04f8('0x25')](_0x36a76f[_0x04f8('0x55')]):_0x04f8('0x6a'));return respondWithRpcPromise(_0x04f8('0x75'),_0x04f8('0x76'),_0x1ebe6a);}return null;})[_0x04f8('0x20')](function(_0x54dcc1){if(_0x54dcc1){_0x54dcc1['message']['interface']=util[_0x04f8('0x66')](_0x04f8('0x6e'),_0x36a76f[_0x04f8('0x5f')][_0x04f8('0x36')]);_0x54dcc1[_0x04f8('0x27')][_0x04f8('0x77')]=_0x1ebe6a[_0x04f8('0x77')];_0x54dcc1[_0x04f8('0x27')]['event']=_0x04f8('0x33');respondWithRpcPromise('EventManager',_0x04f8('0x70'),{'event':_0x04f8('0x78'),'message':_0x54dcc1[_0x04f8('0x27')]},client9002);return _0x1ebe6a;}return null;})[_0x04f8('0x20')](respondWithResult(_0x33de0d,null))[_0x04f8('0x29')](handleError(_0x33de0d,null));}; \ No newline at end of file +var _0x43d3=['where','pick','add','day','filter','merge','map','includeAll','findAll','then','show','params','length','include','options','find','create','body','describe','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','role','null','manual','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','reject','agent','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','destroy','stack','name','index','OpenchannelMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','sort'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x43d3,0x11a));var _0x343d=function(_0x21f671,_0x14f892){_0x21f671=_0x21f671-0x0;var _0x293ddc=_0x43d3[_0x21f671];return _0x293ddc;};'use strict';var pdf=require(_0x343d('0x0'));var emlformat=require(_0x343d('0x1'));var rimraf=require(_0x343d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x343d('0x3'));var rp=require(_0x343d('0x4'));var moment=require(_0x343d('0x5'));var BPromise=require(_0x343d('0x6'));var Mustache=require(_0x343d('0x7'));var util=require('util');var path=require(_0x343d('0x8'));var sox=require(_0x343d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x343d('0xa'));var crypto=require(_0x343d('0xb'));var jsforce=require(_0x343d('0xc'));var deskjs=require(_0x343d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x343d('0xe'));var Papa=require('papaparse');var Redis=require(_0x343d('0xf'));var qs=require(_0x343d('0x10'));var logger=require(_0x343d('0x11'))(_0x343d('0x12'));var utils=require(_0x343d('0x13'));var config=require(_0x343d('0x14'));var db=require(_0x343d('0x15'))['db'];config[_0x343d('0x16')]=_[_0x343d('0x17')](config['redis'],{'host':_0x343d('0x18'),'port':0x18eb});var socket=require(_0x343d('0x19'))(new Redis(config[_0x343d('0x16')]));require(_0x343d('0x1a'))[_0x343d('0x1b')](socket);var jayson=require(_0x343d('0x1c'));var client=jayson[_0x343d('0x1d')][_0x343d('0x1e')]({'port':0x232c});var client9002=jayson[_0x343d('0x1d')][_0x343d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5c9eb0,_0x361d5c,_0x836220,_0x476a60){return new BPromise(function(_0xe13c4e,_0x55023c){var _0x12b791=_0x476a60||client;return _0x12b791['request'](_0x5c9eb0,_0x836220)['then'](function(_0x2fb65d){logger['info'](_0x343d('0x1f'),_0x361d5c,_0x343d('0x20'));logger[_0x343d('0x21')](_0x343d('0x22'),_0x361d5c,_0x343d('0x20'),JSON[_0x343d('0x23')](_0x2fb65d));if(_0x2fb65d['error']){if(_0x2fb65d['error'][_0x343d('0x24')]===0x1f4){logger[_0x343d('0x25')](_0x343d('0x1f'),_0x361d5c,_0x2fb65d[_0x343d('0x25')][_0x343d('0x26')]);return _0x55023c(_0x2fb65d[_0x343d('0x25')]['message']);}logger['error'](_0x343d('0x1f'),_0x361d5c,_0x2fb65d['error'][_0x343d('0x26')]);return _0xe13c4e(_0x2fb65d[_0x343d('0x25')][_0x343d('0x26')]);}else{logger[_0x343d('0x27')](_0x343d('0x1f'),_0x361d5c,_0x343d('0x20'));_0xe13c4e(_0x2fb65d[_0x343d('0x28')][_0x343d('0x26')]);}})[_0x343d('0x29')](function(_0xedfc98){logger[_0x343d('0x25')](_0x343d('0x1f'),_0x361d5c,_0xedfc98);_0x55023c(_0xedfc98);});});}function respondWithStatusCode(_0x12ae52,_0x205356){_0x205356=_0x205356||0xcc;return function(_0x12aa74){if(_0x12aa74){return _0x12ae52[_0x343d('0x2a')](_0x205356);}return _0x12ae52[_0x343d('0x2b')](_0x205356)[_0x343d('0x2c')]();};}function respondWithResult(_0x1b4de0,_0x5c19a1){_0x5c19a1=_0x5c19a1||0xc8;return function(_0x5999ff){if(_0x5999ff){return _0x1b4de0[_0x343d('0x2b')](_0x5c19a1)[_0x343d('0x2d')](_0x5999ff);}};}function respondWithFilteredResult(_0x53fe2c,_0x6e97e9){return function(_0x1aab73){if(_0x1aab73){var _0x307d0c=_0x1aab73[_0x343d('0x2e')],_0x48e6b2=_0x6e97e9[_0x343d('0x2f')],_0x35dc0e=_0x6e97e9[_0x343d('0x2f')]+_0x6e97e9[_0x343d('0x30')],_0x4ee6be;if(_0x35dc0e>=_0x307d0c){_0x35dc0e=_0x307d0c;_0x4ee6be=0xc8;}else{_0x4ee6be=0xce;}_0x53fe2c['status'](_0x4ee6be);return _0x53fe2c['set'](_0x343d('0x31'),_0x48e6b2+'-'+_0x35dc0e+'/'+_0x307d0c)['json'](_0x1aab73);}return null;};}function patchUpdates(_0x124f21){return function(_0x50b8cb){try{jsonpatch['apply'](_0x50b8cb,_0x124f21,!![]);}catch(_0x4b1e88){return BPromise['reject'](_0x4b1e88);}return _0x50b8cb[_0x343d('0x32')]();};}function saveUpdates(_0x4b1b3f,_0x2be6e5){return function(_0x2a5bd5){if(_0x2a5bd5){return _0x2a5bd5[_0x343d('0x33')](_0x4b1b3f)['then'](function(_0x12b957){return _0x12b957;});}return null;};}function removeEntity(_0x2d614b,_0x5d3acc){return function(_0x4d243e){if(_0x4d243e){return _0x4d243e[_0x343d('0x34')]()['then'](function(){_0x2d614b[_0x343d('0x2b')](0xcc)[_0x343d('0x2c')]();});}};}function handleEntityNotFound(_0x3f8d99,_0xedc84e){return function(_0x5c743d){if(!_0x5c743d){_0x3f8d99['sendStatus'](0x194);}return _0x5c743d;};}function handleError(_0x2446f4,_0x1d4385){_0x1d4385=_0x1d4385||0x1f4;return function(_0x3c2ae1){logger[_0x343d('0x25')](_0x3c2ae1[_0x343d('0x35')]);if(_0x3c2ae1[_0x343d('0x36')]){delete _0x3c2ae1[_0x343d('0x36')];}_0x2446f4[_0x343d('0x2b')](_0x1d4385)['send'](_0x3c2ae1);};}exports[_0x343d('0x37')]=function(_0x510ef5,_0x53929c){var _0x3c34f4={},_0x1b5d6a={},_0x55c014={'count':0x0,'rows':[]};var _0x41b5a8=db[_0x343d('0x38')][_0x343d('0x39')];_0x1b5d6a[_0x343d('0x3a')]=_[_0x343d('0x3b')](_0x41b5a8);var _0x1dd457={'dateStart':_0x510ef5[_0x343d('0x3c')][_0x343d('0x3d')],'dateEnd':_0x510ef5[_0x343d('0x3c')][_0x343d('0x3e')]};delete _0x510ef5[_0x343d('0x3c')]['dateStart'];delete _0x510ef5['query'][_0x343d('0x3e')];_0x1b5d6a[_0x343d('0x3c')]=_['keys'](_0x510ef5['query']);_0x1b5d6a[_0x343d('0x3f')]=_[_0x343d('0x40')](_0x1b5d6a['model'],_0x1b5d6a[_0x343d('0x3c')]);_0x3c34f4[_0x343d('0x41')]=_[_0x343d('0x40')](_0x1b5d6a['model'],qs[_0x343d('0x42')](_0x510ef5['query'][_0x343d('0x42')]));_0x3c34f4[_0x343d('0x41')]=_0x3c34f4[_0x343d('0x41')]['length']?_0x3c34f4['attributes']:_0x1b5d6a['model'];if(!_0x510ef5['query'][_0x343d('0x43')]('nolimit')){_0x3c34f4['limit']=qs[_0x343d('0x30')](_0x510ef5[_0x343d('0x3c')][_0x343d('0x30')]);_0x3c34f4[_0x343d('0x2f')]=qs['offset'](_0x510ef5[_0x343d('0x3c')][_0x343d('0x2f')]);}_0x3c34f4['order']=qs['sort'](_0x510ef5[_0x343d('0x3c')][_0x343d('0x44')]);_0x3c34f4[_0x343d('0x45')]=qs[_0x343d('0x3f')](_[_0x343d('0x46')](_0x510ef5[_0x343d('0x3c')],_0x1b5d6a['filters']));if(_0x1dd457[_0x343d('0x3d')]){if(_0x1dd457[_0x343d('0x3e')]){_0x1dd457[_0x343d('0x3e')]=moment(_0x1dd457[_0x343d('0x3e')])[_0x343d('0x47')](0x1,_0x343d('0x48'));}else{_0x1dd457[_0x343d('0x3e')]=moment(_0x1dd457[_0x343d('0x3d')])[_0x343d('0x47')](0x1,_0x343d('0x48'));}_['merge'](_0x3c34f4[_0x343d('0x45')],{'createdAt':{'$gte':_0x1dd457[_0x343d('0x3d')],'$lte':_0x1dd457[_0x343d('0x3e')]}});}if(_0x510ef5['query'][_0x343d('0x49')]){_0x3c34f4[_0x343d('0x45')]=_[_0x343d('0x4a')](_0x3c34f4[_0x343d('0x45')],{'$or':_[_0x343d('0x4b')](_0x3c34f4[_0x343d('0x41')],function(_0x2fa916){var _0x3ac126={};_0x3ac126[_0x2fa916]={'$like':'%'+_0x510ef5[_0x343d('0x3c')]['filter']+'%'};return _0x3ac126;})});}_0x3c34f4=_[_0x343d('0x4a')]({},_0x3c34f4,_0x510ef5['options']);var _0x4e0933={'where':_0x3c34f4[_0x343d('0x45')]};return db[_0x343d('0x38')][_0x343d('0x2e')](_0x4e0933)['then'](function(_0x49d762){_0x55c014[_0x343d('0x2e')]=_0x49d762;if(_0x510ef5[_0x343d('0x3c')][_0x343d('0x4c')]){_0x3c34f4['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x343d('0x4d')](_0x3c34f4);})[_0x343d('0x4e')](function(_0x1c7c41){_0x55c014['rows']=_0x1c7c41;return _0x55c014;})['then'](respondWithFilteredResult(_0x53929c,_0x3c34f4))[_0x343d('0x29')](handleError(_0x53929c,null));};exports[_0x343d('0x4f')]=function(_0x1303b6,_0x3a3d51){var _0x25223c={'raw':!![],'where':{'id':_0x1303b6[_0x343d('0x50')]['id']}},_0xd347dd={};_0xd347dd['model']=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0xd347dd[_0x343d('0x3c')]=_['keys'](_0x1303b6[_0x343d('0x3c')]);_0xd347dd[_0x343d('0x3f')]=_['intersection'](_0xd347dd[_0x343d('0x3a')],_0xd347dd[_0x343d('0x3c')]);_0x25223c[_0x343d('0x41')]=_[_0x343d('0x40')](_0xd347dd['model'],qs['fields'](_0x1303b6[_0x343d('0x3c')][_0x343d('0x42')]));_0x25223c[_0x343d('0x41')]=_0x25223c[_0x343d('0x41')][_0x343d('0x51')]?_0x25223c['attributes']:_0xd347dd['model'];if(_0x1303b6[_0x343d('0x3c')][_0x343d('0x4c')]){_0x25223c[_0x343d('0x52')]=[{'all':!![]}];}_0x25223c=_[_0x343d('0x4a')]({},_0x25223c,_0x1303b6[_0x343d('0x53')]);return db[_0x343d('0x38')][_0x343d('0x54')](_0x25223c)['then'](handleEntityNotFound(_0x3a3d51,null))['then'](respondWithResult(_0x3a3d51,null))[_0x343d('0x29')](handleError(_0x3a3d51,null));};exports[_0x343d('0x55')]=function(_0x1e0389,_0x39c686){return db[_0x343d('0x38')][_0x343d('0x55')](_0x1e0389[_0x343d('0x56')],{})[_0x343d('0x4e')](respondWithResult(_0x39c686,0xc9))[_0x343d('0x29')](handleError(_0x39c686,null));};exports[_0x343d('0x33')]=function(_0x3b5c2e,_0x283ae2){if(_0x3b5c2e[_0x343d('0x56')]['id']){delete _0x3b5c2e[_0x343d('0x56')]['id'];}return db[_0x343d('0x38')]['find']({'where':{'id':_0x3b5c2e[_0x343d('0x50')]['id']}})[_0x343d('0x4e')](handleEntityNotFound(_0x283ae2,null))[_0x343d('0x4e')](saveUpdates(_0x3b5c2e[_0x343d('0x56')],null))[_0x343d('0x4e')](respondWithResult(_0x283ae2,null))['catch'](handleError(_0x283ae2,null));};exports[_0x343d('0x34')]=function(_0x4c284a,_0x587145){return db[_0x343d('0x38')][_0x343d('0x54')]({'where':{'id':_0x4c284a[_0x343d('0x50')]['id']}})[_0x343d('0x4e')](handleEntityNotFound(_0x587145,null))[_0x343d('0x4e')](removeEntity(_0x587145,null))[_0x343d('0x29')](handleError(_0x587145,null));};exports['describe']=function(_0x4c633a,_0x571f94){return db[_0x343d('0x38')][_0x343d('0x57')]()['then'](respondWithResult(_0x571f94,null))[_0x343d('0x29')](handleError(_0x571f94,null));};var interaction_log=require(_0x343d('0x11'))('openchannel-interactions');exports[_0x343d('0x58')]=function(_0x3ac26a,_0x3d4ed1,_0x1801e4){var _0x1c85b3={'channel':_0x343d('0x59')};if(_0x3ac26a['body']['id']){delete _0x3ac26a['body']['id'];}_0x3ac26a[_0x343d('0x56')]['read']=!![];_0x3ac26a[_0x343d('0x56')]['readAt']=moment()[_0x343d('0x5a')](_0x343d('0x5b'));_0x3ac26a['body'][_0x343d('0x5c')]=_0x3ac26a[_0x343d('0x56')][_0x343d('0x5c')]||_0x3ac26a[_0x343d('0x5d')]['id'];return db[_0x343d('0x38')][_0x343d('0x54')]({'where':{'id':_0x3ac26a[_0x343d('0x50')]['id'],'UserId':null},'include':[{'model':db[_0x343d('0x5e')],'as':_0x343d('0x5f')}]})[_0x343d('0x4e')](handleEntityNotFound(_0x3d4ed1,null))[_0x343d('0x4e')](saveUpdates(_0x3ac26a[_0x343d('0x56')],null))['then'](function(_0x191b4d){if(_0x191b4d){_0x1c85b3[_0x343d('0x26')]=_0x191b4d[_0x343d('0x60')]({'plain':!![]});return db[_0x343d('0x61')][_0x343d('0x54')]({'where':{'id':_0x191b4d[_0x343d('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x3d4ed1,null))[_0x343d('0x4e')](function(_0x4b34bb){if(_0x4b34bb){return _0x4b34bb[_0x343d('0x33')]({'UserId':_0x3ac26a[_0x343d('0x56')][_0x343d('0x5c')],'read1stAt':_[_0x343d('0x63')](_0x4b34bb[_0x343d('0x64')])?moment()['format'](_0x343d('0x5b')):undefined});}return null;})[_0x343d('0x4e')](function(_0x4727cb){if(_0x4727cb){_0x1c85b3['interaction']=_0x4727cb[_0x343d('0x60')]({'plain':!![]});interaction_log[_0x343d('0x27')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ac26a[_0x343d('0x5d')]['id'],_0x3ac26a[_0x343d('0x5d')][_0x343d('0x36')],_0x3ac26a[_0x343d('0x5d')][_0x343d('0x65')],_0x1c85b3['interaction']['id'],_0x3ac26a[_0x343d('0x56')]?JSON[_0x343d('0x23')](_0x3ac26a[_0x343d('0x56')]):_0x343d('0x66'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x1c85b3);}return null;})[_0x343d('0x4e')](function(_0x28815b){if(_0x28815b){if(_0x3ac26a[_0x343d('0x56')][_0x343d('0x67')]){_0x1c85b3[_0x343d('0x26')]['interface']=util['format'](_0x343d('0x68'),_0x3ac26a[_0x343d('0x5d')]['name']);_0x1c85b3[_0x343d('0x26')][_0x343d('0x69')]=_0x1c85b3[_0x343d('0x69')];_0x1c85b3[_0x343d('0x26')][_0x343d('0x6a')]=_0x343d('0x58');return respondWithRpcPromise(_0x343d('0x6b'),'EventManager',{'event':_0x343d('0x6c'),'message':_0x1c85b3[_0x343d('0x26')]},client9002)[_0x343d('0x4e')](function(){return _0x1c85b3;});}return _0x1c85b3;}return null;})[_0x343d('0x4e')](respondWithResult(_0x3d4ed1,null))['catch'](handleError(_0x3d4ed1,null));};var interaction_log=require(_0x343d('0x11'))(_0x343d('0x6d'));exports[_0x343d('0x6e')]=function(_0x43f8b8,_0x2c299d,_0x29e33c){var _0x1b83fd={'agent':{},'channel':_0x343d('0x59')};if(_0x43f8b8[_0x343d('0x56')]['id']){delete _0x43f8b8[_0x343d('0x56')]['id'];}_0x43f8b8['body'][_0x343d('0x5c')]=_0x43f8b8['body']['UserId']||_0x43f8b8['user']['id'];_0x1b83fd[_0x343d('0x6f')]['id']=_0x43f8b8[_0x343d('0x56')][_0x343d('0x5c')];return db[_0x343d('0x38')][_0x343d('0x54')]({'where':{'id':_0x43f8b8[_0x343d('0x50')]['id'],'UserId':null}})[_0x343d('0x4e')](handleEntityNotFound(_0x2c299d,null))['then'](function(_0x38dadc){if(_0x38dadc){_0x1b83fd[_0x343d('0x26')]=_0x38dadc[_0x343d('0x60')]({'plain':!![]});return db[_0x343d('0x61')][_0x343d('0x54')]({'where':{'id':_0x38dadc['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2c299d,null))[_0x343d('0x4e')](function(_0x26bc8e){if(_0x26bc8e){_0x1b83fd[_0x343d('0x70')]=_0x26bc8e[_0x343d('0x60')]({'plain':!![]});interaction_log[_0x343d('0x27')](_0x343d('0x71'),_0x43f8b8['user']['id'],_0x43f8b8['user'][_0x343d('0x36')],_0x43f8b8[_0x343d('0x5d')][_0x343d('0x65')],_0x1b83fd[_0x343d('0x70')]['id'],_0x43f8b8[_0x343d('0x56')]?JSON[_0x343d('0x23')](_0x43f8b8[_0x343d('0x56')]):_0x343d('0x66'));return respondWithRpcPromise(_0x343d('0x72'),_0x343d('0x73'),_0x1b83fd);}return null;})[_0x343d('0x4e')](function(_0x44e0d4){if(_0x44e0d4){_0x44e0d4['message'][_0x343d('0x74')]=util[_0x343d('0x5a')](_0x343d('0x68'),_0x43f8b8['user'][_0x343d('0x36')]);_0x44e0d4[_0x343d('0x26')][_0x343d('0x69')]=_0x1b83fd[_0x343d('0x69')];_0x44e0d4[_0x343d('0x26')][_0x343d('0x6a')]=_0x343d('0x6e');respondWithRpcPromise(_0x343d('0x6b'),_0x343d('0x6b'),{'event':'rejectmessage','message':_0x44e0d4['message']},client9002);return _0x1b83fd;}return null;})['then'](respondWithResult(_0x2c299d,null))[_0x343d('0x29')](handleError(_0x2c299d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index afb9a32..3e35163 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 _0xa7af=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x47d45d,_0x486052){var _0x5a6fcf=function(_0x43f703){while(--_0x43f703){_0x47d45d['push'](_0x47d45d['shift']());}};_0x5a6fcf(++_0x486052);}(_0xa7af,0x6a));var _0xfa7a=function(_0x15cc14,_0x60c3c9){_0x15cc14=_0x15cc14-0x0;var _0x501759=_0xa7af[_0x15cc14];return _0x501759;};'use strict';var EventEmitter=require(_0xfa7a('0x0'));var OpenchannelMessage=require(_0xfa7a('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfa7a('0x2')](0x0);var events={'afterCreate':_0xfa7a('0x3'),'afterUpdate':'update','afterDestroy':_0xfa7a('0x4')};function emitEvent(_0x385b82){return function(_0x2daa1e,_0x55f254,_0x81e148){OpenchannelMessageEvents[_0xfa7a('0x5')](_0x385b82+':'+_0x2daa1e['id'],_0x2daa1e);OpenchannelMessageEvents[_0xfa7a('0x5')](_0x385b82,_0x2daa1e);_0x81e148(null);};}for(var e in events){if(events[_0xfa7a('0x6')](e)){var event=events[e];OpenchannelMessage[_0xfa7a('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x595c=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x401531,_0x582a70){var _0x51b83c=function(_0x118c21){while(--_0x118c21){_0x401531['push'](_0x401531['shift']());}};_0x51b83c(++_0x582a70);}(_0x595c,0x1e3));var _0xc595=function(_0x2f9280,_0x5b5294){_0x2f9280=_0x2f9280-0x0;var _0x1f29d9=_0x595c[_0x2f9280];return _0x1f29d9;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc595('0x0')](0x0);var events={'afterCreate':_0xc595('0x1'),'afterUpdate':_0xc595('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1ce494){return function(_0x558779,_0x3662a5,_0xe71397){OpenchannelMessageEvents[_0xc595('0x3')](_0x1ce494+':'+_0x558779['id'],_0x558779);OpenchannelMessageEvents[_0xc595('0x3')](_0x1ce494,_0x558779);_0xe71397(null);};}for(var e in events){if(events[_0xc595('0x4')](e)){var event=events[e];OpenchannelMessage[_0xc595('0x5')](e,emitEvent(event));}}module[_0xc595('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 45c9d19..c8eef8f 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 _0x825a=['describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','Contact','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','error','afterCreate','inspect','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','body','catch','secret','CmContact'];(function(_0x3f65db,_0x3a97be){var _0x21db02=function(_0x2c5f56){while(--_0x2c5f56){_0x3f65db['push'](_0x3f65db['shift']());}};_0x21db02(++_0x3a97be);}(_0x825a,0x1a9));var _0xa825=function(_0x1a0c59,_0x3b4dcc){_0x1a0c59=_0x1a0c59-0x0;var _0xed67c9=_0x825a[_0x1a0c59];return _0xed67c9;};'use strict';var _=require(_0xa825('0x0'));var util=require('util');var logger=require(_0xa825('0x1'))(_0xa825('0x2'));var moment=require(_0xa825('0x3'));var BPromise=require(_0xa825('0x4'));var rp=require(_0xa825('0x5'));var attributes=require(_0xa825('0x6'));module['exports']=function(_0x5ea931,_0x347e52){return _0x5ea931[_0xa825('0x7')](_0xa825('0x8'),attributes,{'tableName':_0xa825('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ec5df,_0x1d4eb9,_0x19e4da){var _0xee6883=_0x5ea931[_0xa825('0xa')];var _0x90d9b2=_0x3ec5df[_0xa825('0xb')]({'plain':!![]});if(_0x90d9b2[_0xa825('0xc')][_0xa825('0xd')]()==='in'||_0x90d9b2[_0xa825('0xc')][_0xa825('0xd')]()===_0xa825('0xe')&&!_0x90d9b2['secret']&&!_[_0xa825('0xf')](_0x90d9b2[_0xa825('0x10')])){_0xee6883[_0xa825('0x11')][_0xa825('0x12')]({'where':{'id':_0x90d9b2[_0xa825('0x13')]}})[_0xa825('0x14')](function(_0x1300c5){if(_0x1300c5){_0x1300c5['update']({'lastMsgAt':_0x90d9b2['createdAt'],'lastMsgDirection':_0x90d9b2[_0xa825('0xc')][_0xa825('0xd')](),'lastMsgBody':_0x90d9b2[_0xa825('0x15')]});}})[_0xa825('0x16')](function(_0x35d544){console['error'](_0x35d544);});}if(_0x90d9b2[_0xa825('0xc')]===_0xa825('0xe')&&!_0x90d9b2[_0xa825('0x17')]){var _0x3b1830;_0xee6883[_0xa825('0x18')][_0xa825('0x19')]()['then'](function(_0x3a4fe1){return _0xee6883[_0xa825('0x1a')][_0xa825('0x1b')]({'where':{'id':_0x90d9b2[_0xa825('0x1c')]},'include':[{'model':_0xee6883[_0xa825('0x11')],'as':_0xa825('0x1d'),'where':{'id':_0x90d9b2[_0xa825('0x13')]},'limit':0x1,'include':[{'model':_0xee6883['CmContact'],'as':'Contact','attributes':_[_0xa825('0x1e')](_0x3a4fe1)}]}]});})[_0xa825('0x14')](function(_0x5551b8){_0x3b1830=_0x5551b8['get']({'plain':!![]});if(_0x3b1830&&_0x3b1830[_0xa825('0x1f')]){logger['info'](_0xa825('0x20'),'afterCreate',util[_0xa825('0x21')](_0xa825('0x22'),_0x90d9b2['id'],_0x3b1830['replyUri']));if(_0x3b1830[_0xa825('0x1d')]&&_0x3b1830['Interactions'][_0xa825('0x23')]){_0x90d9b2['Interaction']=_[_0xa825('0x24')](_0x3b1830['Interactions'][0x0],'Contact');_0x90d9b2['Contact']=_0x3b1830['Interactions'][0x0][_0xa825('0x25')];}var _0x1d4eb9={'method':_0xa825('0x26'),'uri':encodeURI(_0x3b1830[_0xa825('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1d4eb9[_0xa825('0x27')]){case _0xa825('0x28'):_0x1d4eb9['qs']=_0x90d9b2;break;case _0xa825('0x26'):_0x1d4eb9['body']=_0x90d9b2;break;}return rp(_0x1d4eb9)[_0xa825('0x14')](function(_0x286af3){logger['info'](_0xa825('0x20'),'afterCreate',util[_0xa825('0x21')](_0xa825('0x29'),_0x90d9b2['id'],_0x3b1830[_0xa825('0x1f')]));if(_0x286af3[_0xa825('0x15')][_0xa825('0x2a')]&&_0x286af3[_0xa825('0x15')][_0xa825('0x2a')]!=_0x90d9b2[_0xa825('0x2b')][_0xa825('0x2a')]){return _0xee6883[_0xa825('0x11')]['update']({'threadId':_0x286af3[_0xa825('0x15')][_0xa825('0x2a')]},{'logging':!![],'where':{'id':_0x90d9b2[_0xa825('0x2b')]['id']}});}else{return;}})['then'](function(){return _0x3ec5df[_0xa825('0x2c')]({'read':!![]});})[_0xa825('0x16')](function(_0x1b3ab5){logger[_0xa825('0x2d')](_0xa825('0x20'),_0xa825('0x2e'),util[_0xa825('0x2f')](_0x1b3ab5,{'showHidden':![],'depth':null}));_0x19e4da();});}else{_0x19e4da();}})[_0xa825('0x30')](function(){_0x19e4da();});}else{_0x19e4da();}}},'charset':'utf8mb4','collate':_0xa825('0x31')});}; \ No newline at end of file +var _0x1dae=['info','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction','Contact','method','GET','POST','afterCreate','threadId','inspect','finally','lodash','util','../../config/logger','bluebird','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','get','direction','out','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','update','body','catch','error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','replyUri'];(function(_0x509071,_0x205297){var _0x3f2cec=function(_0x4755c2){while(--_0x4755c2){_0x509071['push'](_0x509071['shift']());}};_0x3f2cec(++_0x205297);}(_0x1dae,0x1a7));var _0xe1da=function(_0xa087df,_0x1570fa){_0xa087df=_0xa087df-0x0;var _0x59d5e1=_0x1dae[_0xa087df];return _0x59d5e1;};'use strict';var _=require(_0xe1da('0x0'));var util=require(_0xe1da('0x1'));var logger=require(_0xe1da('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe1da('0x3'));var rp=require('request-promise');var attributes=require(_0xe1da('0x4'));module[_0xe1da('0x5')]=function(_0x30b712,_0x3dce4c){return _0x30b712[_0xe1da('0x6')](_0xe1da('0x7'),attributes,{'tableName':_0xe1da('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x27daa2,_0x2ac27a,_0x246ed8){var _0x10cc93=_0x30b712['models'];var _0x580a2c=_0x27daa2[_0xe1da('0x9')]({'plain':!![]});if(_0x580a2c[_0xe1da('0xa')]['toLowerCase']()==='in'||_0x580a2c['direction']['toLowerCase']()===_0xe1da('0xb')&&!_0x580a2c[_0xe1da('0xc')]&&!_[_0xe1da('0xd')](_0x580a2c['UserId'])){_0x10cc93[_0xe1da('0xe')]['findOne']({'where':{'id':_0x580a2c[_0xe1da('0xf')]}})[_0xe1da('0x10')](function(_0x3a994e){if(_0x3a994e){_0x3a994e[_0xe1da('0x11')]({'lastMsgAt':_0x580a2c['createdAt'],'lastMsgDirection':_0x580a2c[_0xe1da('0xa')]['toLowerCase'](),'lastMsgBody':_0x580a2c[_0xe1da('0x12')]});}})[_0xe1da('0x13')](function(_0x339dbb){console[_0xe1da('0x14')](_0x339dbb);});}if(_0x580a2c[_0xe1da('0xa')]===_0xe1da('0xb')&&!_0x580a2c[_0xe1da('0xc')]){var _0x4f83c2;_0x10cc93[_0xe1da('0x15')]['describe']()[_0xe1da('0x10')](function(_0x4ac082){return _0x10cc93[_0xe1da('0x16')][_0xe1da('0x17')]({'where':{'id':_0x580a2c[_0xe1da('0x18')]},'include':[{'model':_0x10cc93[_0xe1da('0xe')],'as':_0xe1da('0x19'),'where':{'id':_0x580a2c[_0xe1da('0xf')]},'limit':0x1,'include':[{'model':_0x10cc93[_0xe1da('0x15')],'as':'Contact','attributes':_[_0xe1da('0x1a')](_0x4ac082)}]}]});})[_0xe1da('0x10')](function(_0x294813){_0x4f83c2=_0x294813[_0xe1da('0x9')]({'plain':!![]});if(_0x4f83c2&&_0x4f83c2[_0xe1da('0x1b')]){logger[_0xe1da('0x1c')](_0xe1da('0x1d'),'afterCreate',util[_0xe1da('0x1e')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x580a2c['id'],_0x4f83c2[_0xe1da('0x1b')]));if(_0x4f83c2[_0xe1da('0x19')]&&_0x4f83c2[_0xe1da('0x19')][_0xe1da('0x1f')]){_0x580a2c[_0xe1da('0x20')]=_['omit'](_0x4f83c2[_0xe1da('0x19')][0x0],_0xe1da('0x21'));_0x580a2c[_0xe1da('0x21')]=_0x4f83c2[_0xe1da('0x19')][0x0][_0xe1da('0x21')];}var _0x2ac27a={'method':'POST','uri':encodeURI(_0x4f83c2[_0xe1da('0x1b')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2ac27a[_0xe1da('0x22')]){case _0xe1da('0x23'):_0x2ac27a['qs']=_0x580a2c;break;case _0xe1da('0x24'):_0x2ac27a[_0xe1da('0x12')]=_0x580a2c;break;}return rp(_0x2ac27a)[_0xe1da('0x10')](function(_0x5bae69){logger['info'](_0xe1da('0x1d'),_0xe1da('0x25'),util[_0xe1da('0x1e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x580a2c['id'],_0x4f83c2[_0xe1da('0x1b')]));if(_0x5bae69[_0xe1da('0x12')][_0xe1da('0x26')]&&_0x5bae69[_0xe1da('0x12')]['threadId']!=_0x580a2c[_0xe1da('0x20')][_0xe1da('0x26')]){return _0x10cc93['OpenchannelInteraction']['update']({'threadId':_0x5bae69[_0xe1da('0x12')][_0xe1da('0x26')]},{'logging':!![],'where':{'id':_0x580a2c['Interaction']['id']}});}else{return;}})['then'](function(){return _0x27daa2[_0xe1da('0x11')]({'read':!![]});})['catch'](function(_0x5aa48f){logger[_0xe1da('0x14')](_0xe1da('0x1d'),'afterCreate',util[_0xe1da('0x27')](_0x5aa48f,{'showHidden':![],'depth':null}));_0x246ed8();});}else{_0x246ed8();}})[_0xe1da('0x28')](function(){_0x246ed8();});}else{_0x246ed8();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 61ee845..ccadb24 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 _0x9ff9=['result','catch','OpenchannelMessage','create','body','options','raw','info','CreateOpenchannelMessage','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x598f9a,_0x3a5e55){var _0x23ffa5=function(_0x5607a7){while(--_0x5607a7){_0x598f9a['push'](_0x598f9a['shift']());}};_0x23ffa5(++_0x3a5e55);}(_0x9ff9,0x1c3));var _0x99ff=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x9ff9[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var util=require(_0x99ff('0x0'));var moment=require('moment');var BPromise=require(_0x99ff('0x1'));var rs=require(_0x99ff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99ff('0x3'))['db'];var utils=require(_0x99ff('0x4'));var logger=require(_0x99ff('0x5'))(_0x99ff('0x6'));var config=require('../../config/environment');var jayson=require(_0x99ff('0x7'));var client=jayson[_0x99ff('0x8')][_0x99ff('0x9')]({'port':0x232a});config[_0x99ff('0xa')]=_[_0x99ff('0xb')](config['redis'],{'host':_0x99ff('0xc'),'port':0x18eb});var socket=require(_0x99ff('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x99ff('0xe')](socket);function respondWithRpcPromise(_0x5410f0,_0x3ef7ab,_0x5e760e){return new BPromise(function(_0x101142,_0x4c7d95){return client[_0x99ff('0xf')](_0x5410f0,_0x5e760e)[_0x99ff('0x10')](function(_0x2b6575){logger['info'](_0x99ff('0x11'),_0x3ef7ab,_0x99ff('0x12'));logger[_0x99ff('0x13')](_0x99ff('0x14'),_0x3ef7ab,'request\x20sent',JSON[_0x99ff('0x15')](_0x2b6575));if(_0x2b6575[_0x99ff('0x16')]){if(_0x2b6575['error'][_0x99ff('0x17')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3ef7ab,_0x2b6575[_0x99ff('0x16')][_0x99ff('0x18')]);return _0x4c7d95(_0x2b6575[_0x99ff('0x16')][_0x99ff('0x18')]);}logger[_0x99ff('0x16')](_0x99ff('0x11'),_0x3ef7ab,_0x2b6575[_0x99ff('0x16')][_0x99ff('0x18')]);return _0x101142(_0x2b6575['error']['message']);}else{logger['info'](_0x99ff('0x11'),_0x3ef7ab,_0x99ff('0x12'));_0x101142(_0x2b6575[_0x99ff('0x19')][_0x99ff('0x18')]);}})[_0x99ff('0x1a')](function(_0x893ed){logger[_0x99ff('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x3ef7ab,_0x893ed);_0x4c7d95(_0x893ed);});});}exports['CreateOpenchannelMessage']=function(_0x33b145){var _0x543fcd=this;return new Promise(function(_0x18e031,_0x2e8015){return db[_0x99ff('0x1b')][_0x99ff('0x1c')](_0x33b145[_0x99ff('0x1d')],{'raw':_0x33b145[_0x99ff('0x1e')]?_0x33b145[_0x99ff('0x1e')][_0x99ff('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x2a5ff0){logger[_0x99ff('0x20')](_0x99ff('0x21'),_0x33b145);logger[_0x99ff('0x13')]('CreateOpenchannelMessage',_0x33b145,JSON[_0x99ff('0x15')](_0x2a5ff0));_0x18e031(_0x2a5ff0);})[_0x99ff('0x1a')](function(_0x53d749){logger[_0x99ff('0x16')](_0x99ff('0x21'),_0x53d749[_0x99ff('0x18')],_0x33b145);_0x2e8015(_0x543fcd[_0x99ff('0x16')](0x1f4,_0x53d749[_0x99ff('0x18')]));});});}; \ No newline at end of file +var _0x552d=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','request','then','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','info','result','catch','OpenchannelMessage','body','options','raw','CreateOpenchannelMessage','moment','rpc','../../config/environment'];(function(_0x4da61c,_0x4f3c93){var _0x3403e9=function(_0x32cbc0){while(--_0x32cbc0){_0x4da61c['push'](_0x4da61c['shift']());}};_0x3403e9(++_0x4f3c93);}(_0x552d,0x1e3));var _0xd552=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x552d[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd552('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd552('0x1'));var config=require(_0xd552('0x2'));var jayson=require(_0xd552('0x3'));var client=jayson[_0xd552('0x4')][_0xd552('0x5')]({'port':0x232a});config[_0xd552('0x6')]=_['defaults'](config['redis'],{'host':_0xd552('0x7'),'port':0x18eb});var socket=require(_0xd552('0x8'))(new Redis(config[_0xd552('0x6')]));require(_0xd552('0x9'))['register'](socket);function respondWithRpcPromise(_0x43fdb3,_0x5b6dca,_0xf59b4e){return new BPromise(function(_0xcb671a,_0x43e069){return client[_0xd552('0xa')](_0x43fdb3,_0xf59b4e)[_0xd552('0xb')](function(_0x27aa2c){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x5b6dca,_0xd552('0xc'));logger['debug'](_0xd552('0xd'),_0x5b6dca,'request\x20sent',JSON[_0xd552('0xe')](_0x27aa2c));if(_0x27aa2c[_0xd552('0xf')]){if(_0x27aa2c[_0xd552('0xf')][_0xd552('0x10')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x5b6dca,_0x27aa2c['error'][_0xd552('0x11')]);return _0x43e069(_0x27aa2c['error']['message']);}logger[_0xd552('0xf')](_0xd552('0x12'),_0x5b6dca,_0x27aa2c[_0xd552('0xf')][_0xd552('0x11')]);return _0xcb671a(_0x27aa2c['error'][_0xd552('0x11')]);}else{logger[_0xd552('0x13')](_0xd552('0x12'),_0x5b6dca,_0xd552('0xc'));_0xcb671a(_0x27aa2c[_0xd552('0x14')][_0xd552('0x11')]);}})[_0xd552('0x15')](function(_0x4f7840){logger[_0xd552('0xf')](_0xd552('0x12'),_0x5b6dca,_0x4f7840);_0x43e069(_0x4f7840);});});}exports['CreateOpenchannelMessage']=function(_0xb31a70){var _0x4797f8=this;return new Promise(function(_0x3543ea,_0x6f05be){return db[_0xd552('0x16')]['create'](_0xb31a70[_0xd552('0x17')],{'raw':_0xb31a70[_0xd552('0x18')]?_0xb31a70[_0xd552('0x18')][_0xd552('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x24b2f2){logger[_0xd552('0x13')](_0xd552('0x1a'),_0xb31a70);logger['debug'](_0xd552('0x1a'),_0xb31a70,JSON[_0xd552('0xe')](_0x24b2f2));_0x3543ea(_0x24b2f2);})[_0xd552('0x15')](function(_0x5c14c8){logger[_0xd552('0xf')]('CreateOpenchannelMessage',_0x5c14c8[_0xd552('0x11')],_0xb31a70);_0x6f05be(_0x4797f8[_0xd552('0xf')](0x1f4,_0x5c14c8['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index b85b647..2488e18 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 _0x202c=['emit','removeListener','length','openchannelMessage:','./openchannelMessage.events','update'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x202c,0x178));var _0xc202=function(_0x5daac7,_0xb07c22){_0x5daac7=_0x5daac7-0x0;var _0xeb2d00=_0x202c[_0x5daac7];return _0xeb2d00;};'use strict';var OpenchannelMessageEvents=require(_0xc202('0x0'));var events=['save','remove',_0xc202('0x1')];function createListener(_0x1ab6a1,_0x27b3b2){return function(_0x5c5dec){_0x27b3b2[_0xc202('0x2')](_0x1ab6a1,_0x5c5dec);};}function removeListener(_0x155c3b,_0x1763f5){return function(){OpenchannelMessageEvents[_0xc202('0x3')](_0x155c3b,_0x1763f5);};}exports['register']=function(_0x28e51c){for(var _0x68d363=0x0,_0x59563a=events[_0xc202('0x4')];_0x68d363<_0x59563a;_0x68d363++){var _0x574549=events[_0x68d363];var _0x872c1a=createListener(_0xc202('0x5')+_0x574549,_0x28e51c);OpenchannelMessageEvents['on'](_0x574549,_0x872c1a);}}; \ No newline at end of file +var _0xaa7c=['./openchannelMessage.events','removeListener','register','openchannelMessage:'];(function(_0x3b932f,_0x95dc7a){var _0x5ba210=function(_0xb6426f){while(--_0xb6426f){_0x3b932f['push'](_0x3b932f['shift']());}};_0x5ba210(++_0x95dc7a);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x2805cb,_0x3fb67f){_0x2805cb=_0x2805cb-0x0;var _0x5d2d67=_0xaa7c[_0x2805cb];return _0x5d2d67;};'use strict';var OpenchannelMessageEvents=require(_0xcaa7('0x0'));var events=['save','remove','update'];function createListener(_0x51ab16,_0x1ad795){return function(_0x153b0e){_0x1ad795['emit'](_0x51ab16,_0x153b0e);};}function removeListener(_0xd4ca36,_0xc85ba0){return function(){OpenchannelMessageEvents[_0xcaa7('0x1')](_0xd4ca36,_0xc85ba0);};}exports[_0xcaa7('0x2')]=function(_0x27e610){for(var _0x5a3674=0x0,_0x4b9df0=events['length'];_0x5a3674<_0x4b9df0;_0x5a3674++){var _0x55f6a4=events[_0x5a3674];var _0x4e4fc1=createListener(_0xcaa7('0x3')+_0x55f6a4,_0x27e610);OpenchannelMessageEvents['on'](_0x55f6a4,_0x4e4fc1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 559e09a..102ea55 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 _0x39ad=['../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1f7191,_0x37bc37){var _0x29fd0d=function(_0xfb9c4d){while(--_0xfb9c4d){_0x1f7191['push'](_0x1f7191['shift']());}};_0x29fd0d(++_0x37bc37);}(_0x39ad,0x1f3));var _0xd39a=function(_0x473970,_0x4c0d80){_0x473970=_0x473970-0x0;var _0x3ce50a=_0x39ad[_0x473970];return _0x3ce50a;};'use strict';var multer=require('multer');var util=require(_0xd39a('0x0'));var path=require('path');var timeout=require(_0xd39a('0x1'));var express=require(_0xd39a('0x2'));var router=express['Router']();var auth=require(_0xd39a('0x3'));var interaction=require(_0xd39a('0x4'));var config=require(_0xd39a('0x5'));var controller=require(_0xd39a('0x6'));router[_0xd39a('0x7')]('/',auth['isAuthenticated'](),controller[_0xd39a('0x8')]);router['get'](_0xd39a('0x9'),auth[_0xd39a('0xa')](),controller[_0xd39a('0xb')]);router[_0xd39a('0x7')](_0xd39a('0xc'),auth[_0xd39a('0xa')](),controller[_0xd39a('0xd')]);router[_0xd39a('0x7')](_0xd39a('0xe'),auth[_0xd39a('0xa')](),controller[_0xd39a('0xf')]);router[_0xd39a('0x7')](_0xd39a('0x10'),auth[_0xd39a('0xa')](),controller['getTeams']);router[_0xd39a('0x7')](_0xd39a('0x11'),auth[_0xd39a('0xa')](),controller[_0xd39a('0x12')]);router[_0xd39a('0x13')]('/',auth[_0xd39a('0xa')](),controller[_0xd39a('0x14')]);router[_0xd39a('0x13')](_0xd39a('0x10'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xd39a('0x11'),auth[_0xd39a('0xa')](),controller[_0xd39a('0x15')]);router[_0xd39a('0x16')](_0xd39a('0xc'),auth[_0xd39a('0xa')](),controller['update']);router[_0xd39a('0x17')](_0xd39a('0xc'),auth[_0xd39a('0xa')](),controller[_0xd39a('0x18')]);router[_0xd39a('0x17')](_0xd39a('0x10'),auth['isAuthenticated'](),controller[_0xd39a('0x19')]);router[_0xd39a('0x17')](_0xd39a('0x11'),auth[_0xd39a('0xa')](),controller[_0xd39a('0x1a')]);module[_0xd39a('0x1b')]=router; \ No newline at end of file +var _0xa746=['removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','create','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x3739af,_0x416934){var _0x491d73=function(_0x1a5949){while(--_0x1a5949){_0x3739af['push'](_0x3739af['shift']());}};_0x491d73(++_0x416934);}(_0xa746,0xda));var _0x6a74=function(_0x522b28,_0x529741){_0x522b28=_0x522b28-0x0;var _0x2d653e=_0xa746[_0x522b28];return _0x2d653e;};'use strict';var multer=require(_0x6a74('0x0'));var util=require('util');var path=require(_0x6a74('0x1'));var timeout=require(_0x6a74('0x2'));var express=require(_0x6a74('0x3'));var router=express[_0x6a74('0x4')]();var auth=require(_0x6a74('0x5'));var interaction=require(_0x6a74('0x6'));var config=require(_0x6a74('0x7'));var controller=require(_0x6a74('0x8'));router[_0x6a74('0x9')]('/',auth[_0x6a74('0xa')](),controller[_0x6a74('0xb')]);router['get'](_0x6a74('0xc'),auth[_0x6a74('0xa')](),controller[_0x6a74('0xd')]);router[_0x6a74('0x9')](_0x6a74('0xe'),auth[_0x6a74('0xa')](),controller[_0x6a74('0xf')]);router[_0x6a74('0x9')](_0x6a74('0x10'),auth[_0x6a74('0xa')](),controller[_0x6a74('0x11')]);router['get']('/:id/teams',auth[_0x6a74('0xa')](),controller[_0x6a74('0x12')]);router[_0x6a74('0x9')](_0x6a74('0x13'),auth[_0x6a74('0xa')](),controller['getAgents']);router['post']('/',auth[_0x6a74('0xa')](),controller[_0x6a74('0x14')]);router[_0x6a74('0x15')](_0x6a74('0x16'),auth[_0x6a74('0xa')](),controller[_0x6a74('0x17')]);router[_0x6a74('0x15')](_0x6a74('0x13'),auth[_0x6a74('0xa')](),controller[_0x6a74('0x18')]);router[_0x6a74('0x19')]('/:id',auth[_0x6a74('0xa')](),controller[_0x6a74('0x1a')]);router[_0x6a74('0x1b')](_0x6a74('0xe'),auth[_0x6a74('0xa')](),controller[_0x6a74('0x1c')]);router[_0x6a74('0x1b')](_0x6a74('0x16'),auth[_0x6a74('0xa')](),controller[_0x6a74('0x1d')]);router[_0x6a74('0x1b')](_0x6a74('0x13'),auth[_0x6a74('0xa')](),controller[_0x6a74('0x1e')]);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 a5a7ece..a2851f9 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 _0xf9df=['name','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x4a4752,_0x3cf6c8){var _0x2cc5fa=function(_0x251fce){while(--_0x251fce){_0x4a4752['push'](_0x4a4752['shift']());}};_0x2cc5fa(++_0x3cf6c8);}(_0xf9df,0x1a8));var _0xff9d=function(_0x103d6f,_0x136acd){_0x103d6f=_0x103d6f-0x0;var _0x167a23=_0xf9df[_0x103d6f];return _0x167a23;};'use strict';var Sequelize=require(_0xff9d('0x0'));module[_0xff9d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xff9d('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[_0xff9d('0x3')](_0xff9d('0x4'),'beepall',_0xff9d('0x5'))}}; \ No newline at end of file +var _0x416d=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x3c9cb8,_0x31b60b){var _0x1547ad=function(_0x573102){while(--_0x573102){_0x3c9cb8['push'](_0x3c9cb8['shift']());}};_0x1547ad(++_0x31b60b);}(_0x416d,0x174));var _0xd416=function(_0x5a3a81,_0x5e862f){_0x5a3a81=_0x5a3a81-0x0;var _0x59f7fa=_0x416d[_0x5a3a81];return _0x59f7fa;};'use strict';var Sequelize=require(_0xd416('0x0'));module['exports']={'name':{'type':Sequelize[_0xd416('0x1')],'unique':_0xd416('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd416('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd416('0x4')](_0xd416('0x5'),_0xd416('0x6'),_0xd416('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index bf57f9e..ec47252 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 _0xb682=['desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','offset','limit','set','json','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','OpenchannelQueue','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','add','merge','filter','map','options','count','include','findAll','rows','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','sort','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','addTeams','ids','Agents','union','addAgents','removeAgents','removeTeams','omit','userOpenchannelQueue:save','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','ejs','lodash','squel','jsforce'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0xb682,0xcd));var _0x2b68=function(_0xd98ca3,_0x38fbd9){_0xd98ca3=_0xd98ca3-0x0;var _0x35960d=_0xb682[_0xd98ca3];return _0x35960d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2b68('0x0'));var rimraf=require(_0x2b68('0x1'));var zipdir=require(_0x2b68('0x2'));var jsonpatch=require(_0x2b68('0x3'));var rp=require('request-promise');var moment=require(_0x2b68('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b68('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2b68('0x6'));var csv=require('to-csv');var ejs=require(_0x2b68('0x7'));var fs=require('fs');var _=require(_0x2b68('0x8'));var squel=require(_0x2b68('0x9'));var crypto=require('crypto');var jsforce=require(_0x2b68('0xa'));var deskjs=require(_0x2b68('0xb'));var toCsv=require(_0x2b68('0xc'));var querystring=require(_0x2b68('0xd'));var Papa=require('papaparse');var Redis=require(_0x2b68('0xe'));var qs=require(_0x2b68('0xf'));var logger=require(_0x2b68('0x10'))(_0x2b68('0x11'));var utils=require(_0x2b68('0x12'));var config=require(_0x2b68('0x13'));var db=require(_0x2b68('0x14'))['db'];config[_0x2b68('0x15')]=_[_0x2b68('0x16')](config[_0x2b68('0x15')],{'host':_0x2b68('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2b68('0x18'))[_0x2b68('0x19')](socket);function respondWithStatusCode(_0x5f04d5,_0x5a7ccc){_0x5a7ccc=_0x5a7ccc||0xcc;return function(_0x1cb2df){if(_0x1cb2df){return _0x5f04d5[_0x2b68('0x1a')](_0x5a7ccc);}return _0x5f04d5[_0x2b68('0x1b')](_0x5a7ccc)[_0x2b68('0x1c')]();};}function respondWithResult(_0x5f0acd,_0x41e831){_0x41e831=_0x41e831||0xc8;return function(_0x5b4823){if(_0x5b4823){return _0x5f0acd['status'](_0x41e831)['json'](_0x5b4823);}};}function respondWithFilteredResult(_0x128b1a,_0x37d8d8){return function(_0x58cbee){if(_0x58cbee){var _0xa4c82f=_0x58cbee['count'],_0x129fbd=_0x37d8d8[_0x2b68('0x1d')],_0x4d9f15=_0x37d8d8[_0x2b68('0x1d')]+_0x37d8d8[_0x2b68('0x1e')],_0x149736;if(_0x4d9f15>=_0xa4c82f){_0x4d9f15=_0xa4c82f;_0x149736=0xc8;}else{_0x149736=0xce;}_0x128b1a[_0x2b68('0x1b')](_0x149736);return _0x128b1a[_0x2b68('0x1f')]('Content-Range',_0x129fbd+'-'+_0x4d9f15+'/'+_0xa4c82f)[_0x2b68('0x20')](_0x58cbee);}return null;};}function patchUpdates(_0x322a0a){return function(_0x37846a){try{jsonpatch['apply'](_0x37846a,_0x322a0a,!![]);}catch(_0x3598bb){return BPromise[_0x2b68('0x21')](_0x3598bb);}return _0x37846a[_0x2b68('0x22')]();};}function saveUpdates(_0x53b916,_0x11fa7c){return function(_0x8fdd0e){if(_0x8fdd0e){return _0x8fdd0e[_0x2b68('0x23')](_0x53b916)[_0x2b68('0x24')](function(_0x2d6e20){return _0x2d6e20;});}return null;};}function removeEntity(_0x321d97,_0x550d30){return function(_0x41f070){if(_0x41f070){return _0x41f070[_0x2b68('0x25')]()['then'](function(){var _0x3a26e2=_0x41f070[_0x2b68('0x26')]({'plain':!![]});var _0x2011d7='OpenchannelQueues';return db[_0x2b68('0x27')][_0x2b68('0x25')]({'where':{'type':_0x2011d7,'resourceId':_0x3a26e2['id']}})[_0x2b68('0x24')](function(){return _0x41f070;});})['then'](function(){_0x321d97['status'](0xcc)[_0x2b68('0x1c')]();});}};}function handleEntityNotFound(_0x307172,_0x37b5bb){return function(_0xc687f4){if(!_0xc687f4){_0x307172['sendStatus'](0x194);}return _0xc687f4;};}function handleError(_0x2fedc7,_0x570326){_0x570326=_0x570326||0x1f4;return function(_0x417bfa){logger[_0x2b68('0x28')](_0x417bfa['stack']);if(_0x417bfa[_0x2b68('0x29')]){delete _0x417bfa[_0x2b68('0x29')];}_0x2fedc7[_0x2b68('0x1b')](_0x570326)[_0x2b68('0x2a')](_0x417bfa);};}exports[_0x2b68('0x2b')]=function(_0x53a2f3,_0x1a59ba){var _0x35535f={},_0x1695f7={},_0x1f8b38={'count':0x0,'rows':[]};var _0x26de73=db[_0x2b68('0x2c')][_0x2b68('0x2d')];_0x1695f7[_0x2b68('0x2e')]=_['keys'](_0x26de73);var _0x58d867={'dateStart':_0x53a2f3[_0x2b68('0x2f')][_0x2b68('0x30')],'dateEnd':_0x53a2f3['query'][_0x2b68('0x31')]};delete _0x53a2f3['query'][_0x2b68('0x30')];delete _0x53a2f3[_0x2b68('0x2f')]['dateEnd'];_0x1695f7[_0x2b68('0x2f')]=_[_0x2b68('0x32')](_0x53a2f3[_0x2b68('0x2f')]);_0x1695f7[_0x2b68('0x33')]=_[_0x2b68('0x34')](_0x1695f7[_0x2b68('0x2e')],_0x1695f7['query']);_0x35535f[_0x2b68('0x35')]=_[_0x2b68('0x34')](_0x1695f7[_0x2b68('0x2e')],qs[_0x2b68('0x36')](_0x53a2f3['query']['fields']));_0x35535f[_0x2b68('0x35')]=_0x35535f['attributes'][_0x2b68('0x37')]?_0x35535f[_0x2b68('0x35')]:_0x1695f7[_0x2b68('0x2e')];if(!_0x53a2f3[_0x2b68('0x2f')][_0x2b68('0x38')](_0x2b68('0x39'))){_0x35535f[_0x2b68('0x1e')]=qs[_0x2b68('0x1e')](_0x53a2f3[_0x2b68('0x2f')][_0x2b68('0x1e')]);_0x35535f[_0x2b68('0x1d')]=qs[_0x2b68('0x1d')](_0x53a2f3['query'][_0x2b68('0x1d')]);}_0x35535f[_0x2b68('0x3a')]=qs['sort'](_0x53a2f3['query']['sort']);_0x35535f[_0x2b68('0x3b')]=qs[_0x2b68('0x33')](_[_0x2b68('0x3c')](_0x53a2f3[_0x2b68('0x2f')],_0x1695f7[_0x2b68('0x33')]));if(_0x58d867[_0x2b68('0x30')]){if(_0x58d867[_0x2b68('0x31')]){_0x58d867[_0x2b68('0x31')]=moment(_0x58d867[_0x2b68('0x31')])[_0x2b68('0x3d')](0x1,'day');}else{_0x58d867[_0x2b68('0x31')]=moment(_0x58d867[_0x2b68('0x30')])['add'](0x1,'day');}_[_0x2b68('0x3e')](_0x35535f[_0x2b68('0x3b')],{'createdAt':{'$gte':_0x58d867[_0x2b68('0x30')],'$lte':_0x58d867[_0x2b68('0x31')]}});}if(_0x53a2f3[_0x2b68('0x2f')][_0x2b68('0x3f')]){_0x35535f['where']=_[_0x2b68('0x3e')](_0x35535f[_0x2b68('0x3b')],{'$or':_[_0x2b68('0x40')](_0x35535f['attributes'],function(_0x3761de){var _0x1fa226={};_0x1fa226[_0x3761de]={'$like':'%'+_0x53a2f3['query']['filter']+'%'};return _0x1fa226;})});}_0x35535f=_['merge']({},_0x35535f,_0x53a2f3[_0x2b68('0x41')]);var _0x564d4f={'where':_0x35535f[_0x2b68('0x3b')]};return db[_0x2b68('0x2c')][_0x2b68('0x42')](_0x564d4f)[_0x2b68('0x24')](function(_0x517e5d){_0x1f8b38[_0x2b68('0x42')]=_0x517e5d;if(_0x53a2f3[_0x2b68('0x2f')]['includeAll']){_0x35535f[_0x2b68('0x43')]=[{'all':!![]}];}return db[_0x2b68('0x2c')][_0x2b68('0x44')](_0x35535f);})[_0x2b68('0x24')](function(_0x591aaf){_0x1f8b38[_0x2b68('0x45')]=_0x591aaf;return _0x1f8b38;})['then'](respondWithFilteredResult(_0x1a59ba,_0x35535f))[_0x2b68('0x46')](handleError(_0x1a59ba,null));};exports['show']=function(_0x3c8200,_0x28239d){var _0x94f296={'raw':!![],'where':{'id':_0x3c8200[_0x2b68('0x47')]['id']}},_0x134735={};_0x134735[_0x2b68('0x2e')]=_[_0x2b68('0x32')](db[_0x2b68('0x2c')]['rawAttributes']);_0x134735[_0x2b68('0x2f')]=_[_0x2b68('0x32')](_0x3c8200[_0x2b68('0x2f')]);_0x134735[_0x2b68('0x33')]=_[_0x2b68('0x34')](_0x134735[_0x2b68('0x2e')],_0x134735[_0x2b68('0x2f')]);_0x94f296[_0x2b68('0x35')]=_[_0x2b68('0x34')](_0x134735[_0x2b68('0x2e')],qs[_0x2b68('0x36')](_0x3c8200[_0x2b68('0x2f')][_0x2b68('0x36')]));_0x94f296['attributes']=_0x94f296[_0x2b68('0x35')][_0x2b68('0x37')]?_0x94f296[_0x2b68('0x35')]:_0x134735[_0x2b68('0x2e')];if(_0x3c8200['query'][_0x2b68('0x48')]){_0x94f296[_0x2b68('0x43')]=[{'all':!![]}];}_0x94f296=_[_0x2b68('0x3e')]({},_0x94f296,_0x3c8200[_0x2b68('0x41')]);return db['OpenchannelQueue'][_0x2b68('0x49')](_0x94f296)[_0x2b68('0x24')](handleEntityNotFound(_0x28239d,null))[_0x2b68('0x24')](respondWithResult(_0x28239d,null))[_0x2b68('0x46')](handleError(_0x28239d,null));};exports[_0x2b68('0x4a')]=function(_0x1052c1,_0x50a221){return db[_0x2b68('0x2c')][_0x2b68('0x4a')](_0x1052c1['body'],{})[_0x2b68('0x24')](function(_0x374323){var _0x55b886=_0x1052c1[_0x2b68('0x4b')]['get']({'plain':!![]});if(!_0x55b886)throw new Error(_0x2b68('0x4c'));if(_0x55b886['role']==='user'){var _0x122e49=_0x374323[_0x2b68('0x26')]({'plain':!![]});var _0x273d42='OpenchannelQueues';return db[_0x2b68('0x4d')]['find']({'where':{'name':_0x273d42,'userProfileId':_0x55b886[_0x2b68('0x4e')]},'raw':!![]})[_0x2b68('0x24')](function(_0x47942b){if(_0x47942b&&_0x47942b['autoAssociation']===0x0){return db[_0x2b68('0x27')][_0x2b68('0x4a')]({'name':_0x122e49[_0x2b68('0x29')],'resourceId':_0x122e49['id'],'type':_0x47942b['name'],'sectionId':_0x47942b['id']},{})[_0x2b68('0x24')](function(){return _0x374323;});}else{return _0x374323;}})[_0x2b68('0x46')](function(_0x1f5934){logger['error'](_0x2b68('0x4f'),_0x1f5934);throw _0x1f5934;});}return _0x374323;})[_0x2b68('0x24')](respondWithResult(_0x50a221,0xc9))[_0x2b68('0x46')](handleError(_0x50a221,null));};exports[_0x2b68('0x23')]=function(_0x21aa2e,_0x398e65){if(_0x21aa2e[_0x2b68('0x50')]['id']){delete _0x21aa2e[_0x2b68('0x50')]['id'];}return db[_0x2b68('0x2c')][_0x2b68('0x49')]({'where':{'id':_0x21aa2e[_0x2b68('0x47')]['id']}})['then'](handleEntityNotFound(_0x398e65,null))[_0x2b68('0x24')](saveUpdates(_0x21aa2e[_0x2b68('0x50')],null))[_0x2b68('0x24')](respondWithResult(_0x398e65,null))[_0x2b68('0x46')](handleError(_0x398e65,null));};exports[_0x2b68('0x25')]=function(_0x4321e1,_0x3f13ee){return db[_0x2b68('0x2c')][_0x2b68('0x49')]({'where':{'id':_0x4321e1[_0x2b68('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f13ee,null))[_0x2b68('0x24')](removeEntity(_0x3f13ee,null))[_0x2b68('0x46')](handleError(_0x3f13ee,null));};exports[_0x2b68('0x51')]=function(_0x2cb4be,_0x8f9cad){return db[_0x2b68('0x2c')][_0x2b68('0x51')]()[_0x2b68('0x24')](respondWithResult(_0x8f9cad,null))[_0x2b68('0x46')](handleError(_0x8f9cad,null));};exports[_0x2b68('0x52')]=function(_0x2adab1,_0x1729f5,_0x5e73db){var _0x409dea={'raw':!![],'where':{}},_0x42eb46={},_0x55d751;return db[_0x2b68('0x2c')][_0x2b68('0x53')]({'where':{'id':_0x2adab1[_0x2b68('0x47')]['id']}})['then'](handleEntityNotFound(_0x1729f5,null))[_0x2b68('0x24')](function(_0x4584a2){if(_0x4584a2){_0x55d751=_0x4584a2[_0x2b68('0x26')]({'plain':!![]});_0x42eb46[_0x2b68('0x2e')]=_[_0x2b68('0x32')](db['UserOpenchannelQueue']['rawAttributes']);_0x42eb46[_0x2b68('0x2f')]=_[_0x2b68('0x32')](_0x2adab1[_0x2b68('0x2f')]);_0x42eb46[_0x2b68('0x33')]=_['intersection'](_0x42eb46[_0x2b68('0x2e')],_0x42eb46[_0x2b68('0x2f')]);_0x409dea[_0x2b68('0x35')]=_[_0x2b68('0x34')](_0x42eb46[_0x2b68('0x2e')],qs[_0x2b68('0x36')](_0x2adab1[_0x2b68('0x2f')][_0x2b68('0x36')]));_0x409dea['attributes']=_0x409dea[_0x2b68('0x35')][_0x2b68('0x37')]?_0x409dea[_0x2b68('0x35')]:_0x42eb46[_0x2b68('0x2e')];if(!_0x2adab1[_0x2b68('0x2f')]['hasOwnProperty']('nolimit')){_0x409dea[_0x2b68('0x1e')]=qs[_0x2b68('0x1e')](_0x2adab1[_0x2b68('0x2f')]['limit']);_0x409dea[_0x2b68('0x1d')]=qs[_0x2b68('0x1d')](_0x2adab1[_0x2b68('0x2f')][_0x2b68('0x1d')]);}_0x409dea['order']=qs[_0x2b68('0x54')](_0x2adab1['query']['sort']);_0x409dea[_0x2b68('0x3b')]=qs[_0x2b68('0x33')](_['pick'](_0x2adab1[_0x2b68('0x2f')],_0x42eb46[_0x2b68('0x33')]));_0x409dea[_0x2b68('0x3b')][_0x2b68('0x55')]=_0x4584a2['id'];if(_0x2adab1[_0x2b68('0x2f')][_0x2b68('0x3f')]){_0x409dea[_0x2b68('0x3b')]=_[_0x2b68('0x3e')](_0x409dea[_0x2b68('0x3b')],{'$or':_['map'](_0x409dea[_0x2b68('0x35')],function(_0x24fdbb){var _0x52d4f7={};_0x52d4f7[_0x24fdbb]={'$like':'%'+_0x2adab1[_0x2b68('0x2f')]['filter']+'%'};return _0x52d4f7;})});}_0x409dea=_[_0x2b68('0x3e')]({},_0x409dea,_0x2adab1[_0x2b68('0x41')]);return db['UserOpenchannelQueue']['findAll'](_0x409dea);}})['then'](function(_0x52307c){if(_0x52307c){return db[_0x2b68('0x56')][_0x2b68('0x57')]({'where':{'id':_[_0x2b68('0x40')](_0x52307c,_0x2b68('0x58')),'role':_0x2b68('0x59')},'attributes':['id',_0x2b68('0x29'),_0x2b68('0x5a'),_0x2b68('0x5b'),'createdAt']});}})[_0x2b68('0x24')](function(_0x12c14d){if(_0x12c14d){return{'count':_0x12c14d[_0x2b68('0x42')],'rows':_[_0x2b68('0x40')](_0x12c14d[_0x2b68('0x45')],function(_0x502f16){return{'membername':_0x502f16[_0x2b68('0x29')],'UserId':_0x502f16['id'],'queue_name':_0x55d751[_0x2b68('0x29')],'OpenchannelQueueId':_0x55d751['id'],'interface':util[_0x2b68('0x5c')](_0x2b68('0x5d'),'SIP',_0x502f16[_0x2b68('0x29')]),'penalty':0x0,'paused':_0x502f16[_0x2b68('0x5a')],'createdAt':_0x502f16[_0x2b68('0x5e')],'updatedAt':_0x502f16[_0x2b68('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2b68('0x24')](respondWithFilteredResult(_0x1729f5,_0x409dea))[_0x2b68('0x46')](handleError(_0x1729f5,null));};exports[_0x2b68('0x5f')]=function(_0x36ed6f,_0x994950,_0x156079){var _0xb8b018={};var _0x57b145={};var _0x30d332;var _0x1d0060;return db[_0x2b68('0x2c')][_0x2b68('0x53')]({'where':{'id':_0x36ed6f[_0x2b68('0x47')]['id']}})[_0x2b68('0x24')](handleEntityNotFound(_0x994950,null))[_0x2b68('0x24')](function(_0x2291c5){if(_0x2291c5){_0x30d332=_0x2291c5;_0x57b145[_0x2b68('0x2e')]=_['keys'](db[_0x2b68('0x60')][_0x2b68('0x2d')]);_0x57b145[_0x2b68('0x2f')]=_['keys'](_0x36ed6f[_0x2b68('0x2f')]);_0x57b145[_0x2b68('0x33')]=_[_0x2b68('0x34')](_0x57b145['model'],_0x57b145[_0x2b68('0x2f')]);_0xb8b018[_0x2b68('0x35')]=_['intersection'](_0x57b145[_0x2b68('0x2e')],qs[_0x2b68('0x36')](_0x36ed6f[_0x2b68('0x2f')]['fields']));_0xb8b018[_0x2b68('0x35')]=_0xb8b018[_0x2b68('0x35')]['length']?_0xb8b018[_0x2b68('0x35')]:_0x57b145[_0x2b68('0x2e')];_0xb8b018[_0x2b68('0x3a')]=qs[_0x2b68('0x54')](_0x36ed6f[_0x2b68('0x2f')][_0x2b68('0x54')]);_0xb8b018['where']=qs[_0x2b68('0x33')](_[_0x2b68('0x3c')](_0x36ed6f[_0x2b68('0x2f')],_0x57b145[_0x2b68('0x33')]));if(_0x36ed6f[_0x2b68('0x2f')][_0x2b68('0x3f')]){_0xb8b018[_0x2b68('0x3b')]=_[_0x2b68('0x3e')](_0xb8b018[_0x2b68('0x3b')],{'$or':_[_0x2b68('0x40')](_0xb8b018['attributes'],function(_0x571ebd){var _0x1b03cd={};_0x1b03cd[_0x571ebd]={'$like':'%'+_0x36ed6f[_0x2b68('0x2f')]['filter']+'%'};return _0x1b03cd;})});}_0xb8b018=_[_0x2b68('0x3e')]({},_0xb8b018,_0x36ed6f['options']);return _0x30d332['getTeams'](_0xb8b018);}})[_0x2b68('0x24')](function(_0x1b0e08){if(_0x1b0e08){_0x1d0060=_0x1b0e08[_0x2b68('0x37')];if(!_0x36ed6f[_0x2b68('0x2f')][_0x2b68('0x38')](_0x2b68('0x39'))){_0xb8b018[_0x2b68('0x1e')]=qs[_0x2b68('0x1e')](_0x36ed6f[_0x2b68('0x2f')][_0x2b68('0x1e')]);_0xb8b018[_0x2b68('0x1d')]=qs['offset'](_0x36ed6f['query'][_0x2b68('0x1d')]);}return _0x30d332[_0x2b68('0x5f')](_0xb8b018);}})['then'](function(_0x730cbd){if(_0x730cbd){return _0x730cbd?{'count':_0x1d0060,'rows':_0x730cbd}:null;}})[_0x2b68('0x24')](respondWithResult(_0x994950,null))[_0x2b68('0x46')](handleError(_0x994950,null));};exports[_0x2b68('0x61')]=function(_0x271dd6,_0x312c07,_0x1c5bdb){var _0x2b4a8d=[];var _0x1d2eaa;return db[_0x2b68('0x60')][_0x2b68('0x44')]({'where':{'id':_0x271dd6['body'][_0x2b68('0x62')]},'attributes':['id'],'include':[{'model':db[_0x2b68('0x56')],'as':_0x2b68('0x63'),'attributes':['id'],'raw':!![]}]})[_0x2b68('0x24')](function(_0x3a9d6e){if(_0x3a9d6e){for(var _0x447d9a=0x0;_0x447d9a<_0x3a9d6e['length'];_0x447d9a+=0x1){for(var _0x298e1e=0x0;_0x298e1e<_0x3a9d6e[_0x447d9a][_0x2b68('0x63')][_0x2b68('0x37')];_0x298e1e+=0x1){_0x2b4a8d=_[_0x2b68('0x64')](_0x2b4a8d,[_0x3a9d6e[_0x447d9a][_0x2b68('0x63')][_0x298e1e]['id']]);}}return _0x2b4a8d;}})[_0x2b68('0x24')](function(_0x261921){if(_0x261921){return db[_0x2b68('0x2c')]['find']({'where':{'id':_0x271dd6[_0x2b68('0x47')]['id']}});}})['then'](function(_0xf62e84){if(_0xf62e84){_0x1d2eaa=_0xf62e84;return _0x1d2eaa[_0x2b68('0x65')](_0x2b4a8d,{'penalty':_0x271dd6[_0x2b68('0x50')]['penalty']});}})[_0x2b68('0x24')](function(_0x228d12){if(_0x228d12){return _0x1d2eaa['addTeams'](_0x271dd6[_0x2b68('0x50')][_0x2b68('0x62')]);}})['then'](handleEntityNotFound(_0x312c07,null))['then'](respondWithStatusCode(_0x312c07,null))[_0x2b68('0x46')](handleError(_0x312c07,null));};exports['removeTeams']=function(_0x548ef4,_0x313241,_0x42e129){var _0xd42f75=[];var _0x2bbf1c;return db['Team'][_0x2b68('0x44')]({'where':{'id':_0x548ef4[_0x2b68('0x2f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2b68('0x56')],'as':_0x2b68('0x63'),'attributes':['id'],'raw':!![]}]})[_0x2b68('0x24')](function(_0x112804){if(_0x112804){for(var _0x3989f4=0x0;_0x3989f4<_0x112804['length'];_0x3989f4+=0x1){for(var _0x5e574e=0x0;_0x5e574e<_0x112804[_0x3989f4][_0x2b68('0x63')][_0x2b68('0x37')];_0x5e574e+=0x1){_0xd42f75=_[_0x2b68('0x64')](_0xd42f75,[_0x112804[_0x3989f4][_0x2b68('0x63')][_0x5e574e]['id']]);}}return _0xd42f75;}})[_0x2b68('0x24')](function(_0xf64e3a){if(_0xf64e3a){return db[_0x2b68('0x2c')][_0x2b68('0x49')]({'where':{'id':_0x548ef4['params']['id']}});}})[_0x2b68('0x24')](function(_0x30dd8a){if(_0x30dd8a){_0x2bbf1c=_0x30dd8a;return _0x2bbf1c[_0x2b68('0x66')](_0xd42f75);}})[_0x2b68('0x24')](function(_0x905e0){if(_0x2bbf1c){return _0x2bbf1c[_0x2b68('0x67')](_0x548ef4['query'][_0x2b68('0x62')]);}})[_0x2b68('0x24')](handleEntityNotFound(_0x313241,null))[_0x2b68('0x24')](respondWithStatusCode(_0x313241,null))[_0x2b68('0x46')](handleError(_0x313241,null));};exports['addAgents']=function(_0x2d6a21,_0x52ae4f,_0x166272){return db[_0x2b68('0x2c')][_0x2b68('0x49')]({'where':{'id':_0x2d6a21[_0x2b68('0x47')]['id']}})[_0x2b68('0x24')](handleEntityNotFound(_0x52ae4f,null))[_0x2b68('0x24')](function(_0x37b247){if(_0x37b247){return _0x37b247['addAgents'](_0x2d6a21['body'][_0x2b68('0x62')],_[_0x2b68('0x68')](_0x2d6a21[_0x2b68('0x50')],[_0x2b68('0x62'),'id'])||{})['spread'](function(_0x3ef84a){for(var _0x231c34=0x0;_0x231c34<_0x2d6a21['body'][_0x2b68('0x62')][_0x2b68('0x37')];_0x231c34+=0x1){socket['emit'](_0x2b68('0x69'),{'UserId':_0x2d6a21[_0x2b68('0x50')]['ids'][_0x231c34],'OpenchannelQueueId':_0x2d6a21['params']['id']});}return _0x3ef84a;});}})[_0x2b68('0x24')](respondWithResult(_0x52ae4f,null))['catch'](handleError(_0x52ae4f,null));};exports[_0x2b68('0x66')]=function(_0x1cde2f,_0xe4a592,_0x3bb69c){var _0x1b79e5;return db['OpenchannelQueue'][_0x2b68('0x49')]({'where':{'id':_0x1cde2f[_0x2b68('0x47')]['id']}})[_0x2b68('0x24')](handleEntityNotFound(_0xe4a592,null))['then'](function(_0x281503){if(_0x281503){return _0x281503[_0x2b68('0x66')](_0x1cde2f[_0x2b68('0x2f')][_0x2b68('0x62')])[_0x2b68('0x24')](function(_0x46c9cc){if(_['isArray'](_0x1cde2f[_0x2b68('0x2f')][_0x2b68('0x62')])){for(var _0x429f5d=0x0;_0x429f5d<_0x1cde2f[_0x2b68('0x2f')][_0x2b68('0x62')][_0x2b68('0x37')];_0x429f5d+=0x1){socket['emit'](_0x2b68('0x6a'),{'UserId':_0x1cde2f[_0x2b68('0x2f')]['ids'][_0x429f5d],'OpenchannelQueueId':_0x1cde2f['params']['id']});}}else{socket['emit'](_0x2b68('0x6a'),{'UserId':_0x1cde2f[_0x2b68('0x2f')][_0x2b68('0x62')],'OpenchannelQueueId':_0x1cde2f[_0x2b68('0x47')]['id']});}});}})[_0x2b68('0x24')](respondWithStatusCode(_0xe4a592,null))[_0x2b68('0x46')](handleError(_0xe4a592,null));};exports['getAgents']=function(_0x7f115e,_0x25ab1e,_0x71abd8){var _0x4d6ad1={};var _0x356224={};var _0x3b7be1;var _0x33992b;return db[_0x2b68('0x2c')]['findOne']({'where':{'id':_0x7f115e['params']['id']}})['then'](handleEntityNotFound(_0x25ab1e,null))[_0x2b68('0x24')](function(_0x1f18aa){if(_0x1f18aa){_0x3b7be1=_0x1f18aa;_0x356224[_0x2b68('0x2e')]=_[_0x2b68('0x32')](db[_0x2b68('0x56')][_0x2b68('0x2d')]);_0x356224[_0x2b68('0x2f')]=_[_0x2b68('0x32')](_0x7f115e['query']);_0x356224['filters']=_['intersection'](_0x356224[_0x2b68('0x2e')],_0x356224[_0x2b68('0x2f')]);_0x4d6ad1[_0x2b68('0x35')]=_[_0x2b68('0x34')](_0x356224[_0x2b68('0x2e')],qs[_0x2b68('0x36')](_0x7f115e[_0x2b68('0x2f')][_0x2b68('0x36')]));_0x4d6ad1[_0x2b68('0x35')]=_0x4d6ad1[_0x2b68('0x35')][_0x2b68('0x37')]?_0x4d6ad1[_0x2b68('0x35')]:_0x356224[_0x2b68('0x2e')];_0x4d6ad1[_0x2b68('0x3a')]=qs[_0x2b68('0x54')](_0x7f115e[_0x2b68('0x2f')][_0x2b68('0x54')]);_0x4d6ad1['where']=qs[_0x2b68('0x33')](_[_0x2b68('0x3c')](_0x7f115e[_0x2b68('0x2f')],_0x356224[_0x2b68('0x33')]));if(_0x7f115e[_0x2b68('0x2f')]['filter']){_0x4d6ad1[_0x2b68('0x3b')]=_[_0x2b68('0x3e')](_0x4d6ad1['where'],{'$or':_[_0x2b68('0x40')](_0x4d6ad1['attributes'],function(_0x334af1){var _0x4ac1e7={};_0x4ac1e7[_0x334af1]={'$like':'%'+_0x7f115e[_0x2b68('0x2f')][_0x2b68('0x3f')]+'%'};return _0x4ac1e7;})});}_0x4d6ad1=_[_0x2b68('0x3e')]({},_0x4d6ad1,_0x7f115e[_0x2b68('0x41')]);return _0x3b7be1[_0x2b68('0x6b')](_0x4d6ad1);}})['then'](function(_0x4229ae){if(_0x4229ae){_0x33992b=_0x4229ae[_0x2b68('0x37')];if(!_0x7f115e[_0x2b68('0x2f')][_0x2b68('0x38')](_0x2b68('0x39'))){_0x4d6ad1[_0x2b68('0x1e')]=qs['limit'](_0x7f115e['query']['limit']);_0x4d6ad1[_0x2b68('0x1d')]=qs['offset'](_0x7f115e[_0x2b68('0x2f')][_0x2b68('0x1d')]);}return _0x3b7be1[_0x2b68('0x6b')](_0x4d6ad1);}})[_0x2b68('0x24')](function(_0x39386f){if(_0x39386f){return _0x39386f?{'count':_0x33992b,'rows':_0x39386f}:null;}})[_0x2b68('0x24')](respondWithResult(_0x25ab1e,null))[_0x2b68('0x46')](handleError(_0x25ab1e,null));}; \ No newline at end of file +var _0x9650=['ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','count','offset','limit','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','sendStatus','stack','name','send','OpenchannelQueue','rawAttributes','keys','query','dateStart','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','dateEnd','add','day','merge','filter','map','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','pick','OpenchannelQueueId','UserOpenchannelQueue','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','addTeams','ids','Agents','union','addAgents','removeTeams','User','removeAgents','omit','spread','isArray','emit','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x209126,_0xdaa5e4){var _0x3ef772=function(_0xfb0d1f){while(--_0xfb0d1f){_0x209126['push'](_0x209126['shift']());}};_0x3ef772(++_0xdaa5e4);}(_0x9650,0xe0));var _0x0965=function(_0x3c3fa0,_0x4224be){_0x3c3fa0=_0x3c3fa0-0x0;var _0x4eaa8d=_0x9650[_0x3c3fa0];return _0x4eaa8d;};'use strict';var pdf=require(_0x0965('0x0'));var emlformat=require(_0x0965('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0965('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0965('0x3'));var moment=require(_0x0965('0x4'));var BPromise=require(_0x0965('0x5'));var Mustache=require(_0x0965('0x6'));var util=require(_0x0965('0x7'));var path=require(_0x0965('0x8'));var sox=require(_0x0965('0x9'));var csv=require('to-csv');var ejs=require(_0x0965('0xa'));var fs=require('fs');var _=require(_0x0965('0xb'));var squel=require(_0x0965('0xc'));var crypto=require(_0x0965('0xd'));var jsforce=require(_0x0965('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0965('0xf'));var querystring=require(_0x0965('0x10'));var Papa=require(_0x0965('0x11'));var Redis=require(_0x0965('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x0965('0x13'))(_0x0965('0x14'));var utils=require(_0x0965('0x15'));var config=require(_0x0965('0x16'));var db=require(_0x0965('0x17'))['db'];config[_0x0965('0x18')]=_['defaults'](config[_0x0965('0x18')],{'host':_0x0965('0x19'),'port':0x18eb});var socket=require(_0x0965('0x1a'))(new Redis(config['redis']));require(_0x0965('0x1b'))[_0x0965('0x1c')](socket);function respondWithStatusCode(_0x221c6b,_0x448d12){_0x448d12=_0x448d12||0xcc;return function(_0x2f8cbe){if(_0x2f8cbe){return _0x221c6b['sendStatus'](_0x448d12);}return _0x221c6b[_0x0965('0x1d')](_0x448d12)[_0x0965('0x1e')]();};}function respondWithResult(_0x1bd765,_0x473a30){_0x473a30=_0x473a30||0xc8;return function(_0x386e2c){if(_0x386e2c){return _0x1bd765[_0x0965('0x1d')](_0x473a30)[_0x0965('0x1f')](_0x386e2c);}};}function respondWithFilteredResult(_0x9ca9fe,_0x1010b4){return function(_0x3dcf79){if(_0x3dcf79){var _0x53e4c5=_0x3dcf79[_0x0965('0x20')],_0x155061=_0x1010b4[_0x0965('0x21')],_0x11ebde=_0x1010b4[_0x0965('0x21')]+_0x1010b4[_0x0965('0x22')],_0x1dd80f;if(_0x11ebde>=_0x53e4c5){_0x11ebde=_0x53e4c5;_0x1dd80f=0xc8;}else{_0x1dd80f=0xce;}_0x9ca9fe[_0x0965('0x1d')](_0x1dd80f);return _0x9ca9fe['set']('Content-Range',_0x155061+'-'+_0x11ebde+'/'+_0x53e4c5)['json'](_0x3dcf79);}return null;};}function patchUpdates(_0x2ad705){return function(_0x42e0c1){try{jsonpatch[_0x0965('0x23')](_0x42e0c1,_0x2ad705,!![]);}catch(_0x18cb96){return BPromise[_0x0965('0x24')](_0x18cb96);}return _0x42e0c1[_0x0965('0x25')]();};}function saveUpdates(_0x4c9cd2,_0x5bfa68){return function(_0x1fe321){if(_0x1fe321){return _0x1fe321[_0x0965('0x26')](_0x4c9cd2)['then'](function(_0x2bc1a5){return _0x2bc1a5;});}return null;};}function removeEntity(_0xf90aa6,_0x239045){return function(_0x1334de){if(_0x1334de){return _0x1334de['destroy']()[_0x0965('0x27')](function(){var _0x2f60dd=_0x1334de[_0x0965('0x28')]({'plain':!![]});var _0x286fcc=_0x0965('0x29');return db[_0x0965('0x2a')]['destroy']({'where':{'type':_0x286fcc,'resourceId':_0x2f60dd['id']}})[_0x0965('0x27')](function(){return _0x1334de;});})[_0x0965('0x27')](function(){_0xf90aa6[_0x0965('0x1d')](0xcc)[_0x0965('0x1e')]();});}};}function handleEntityNotFound(_0x2a4336,_0x45e6ad){return function(_0x4d462d){if(!_0x4d462d){_0x2a4336[_0x0965('0x2b')](0x194);}return _0x4d462d;};}function handleError(_0x841935,_0x7a7096){_0x7a7096=_0x7a7096||0x1f4;return function(_0x41dd10){logger['error'](_0x41dd10[_0x0965('0x2c')]);if(_0x41dd10[_0x0965('0x2d')]){delete _0x41dd10['name'];}_0x841935[_0x0965('0x1d')](_0x7a7096)[_0x0965('0x2e')](_0x41dd10);};}exports['index']=function(_0x343e3e,_0x400a69){var _0x1994dd={},_0x106a3b={},_0x5c241d={'count':0x0,'rows':[]};var _0x40b470=db[_0x0965('0x2f')][_0x0965('0x30')];_0x106a3b['model']=_[_0x0965('0x31')](_0x40b470);var _0x15b041={'dateStart':_0x343e3e[_0x0965('0x32')][_0x0965('0x33')],'dateEnd':_0x343e3e[_0x0965('0x32')]['dateEnd']};delete _0x343e3e[_0x0965('0x32')][_0x0965('0x33')];delete _0x343e3e[_0x0965('0x32')]['dateEnd'];_0x106a3b[_0x0965('0x32')]=_[_0x0965('0x31')](_0x343e3e['query']);_0x106a3b[_0x0965('0x34')]=_['intersection'](_0x106a3b['model'],_0x106a3b[_0x0965('0x32')]);_0x1994dd[_0x0965('0x35')]=_[_0x0965('0x36')](_0x106a3b[_0x0965('0x37')],qs[_0x0965('0x38')](_0x343e3e['query'][_0x0965('0x38')]));_0x1994dd[_0x0965('0x35')]=_0x1994dd['attributes'][_0x0965('0x39')]?_0x1994dd[_0x0965('0x35')]:_0x106a3b[_0x0965('0x37')];if(!_0x343e3e[_0x0965('0x32')][_0x0965('0x3a')](_0x0965('0x3b'))){_0x1994dd['limit']=qs[_0x0965('0x22')](_0x343e3e[_0x0965('0x32')][_0x0965('0x22')]);_0x1994dd[_0x0965('0x21')]=qs[_0x0965('0x21')](_0x343e3e[_0x0965('0x32')][_0x0965('0x21')]);}_0x1994dd[_0x0965('0x3c')]=qs['sort'](_0x343e3e['query'][_0x0965('0x3d')]);_0x1994dd[_0x0965('0x3e')]=qs['filters'](_['pick'](_0x343e3e[_0x0965('0x32')],_0x106a3b['filters']));if(_0x15b041[_0x0965('0x33')]){if(_0x15b041[_0x0965('0x3f')]){_0x15b041[_0x0965('0x3f')]=moment(_0x15b041[_0x0965('0x3f')])[_0x0965('0x40')](0x1,_0x0965('0x41'));}else{_0x15b041[_0x0965('0x3f')]=moment(_0x15b041[_0x0965('0x33')])['add'](0x1,_0x0965('0x41'));}_[_0x0965('0x42')](_0x1994dd[_0x0965('0x3e')],{'createdAt':{'$gte':_0x15b041[_0x0965('0x33')],'$lte':_0x15b041[_0x0965('0x3f')]}});}if(_0x343e3e['query'][_0x0965('0x43')]){_0x1994dd[_0x0965('0x3e')]=_[_0x0965('0x42')](_0x1994dd[_0x0965('0x3e')],{'$or':_[_0x0965('0x44')](_0x1994dd[_0x0965('0x35')],function(_0x3a53ab){var _0x16f3fe={};_0x16f3fe[_0x3a53ab]={'$like':'%'+_0x343e3e[_0x0965('0x32')][_0x0965('0x43')]+'%'};return _0x16f3fe;})});}_0x1994dd=_['merge']({},_0x1994dd,_0x343e3e[_0x0965('0x45')]);var _0x110432={'where':_0x1994dd[_0x0965('0x3e')]};return db[_0x0965('0x2f')][_0x0965('0x20')](_0x110432)['then'](function(_0xa014f0){_0x5c241d[_0x0965('0x20')]=_0xa014f0;if(_0x343e3e[_0x0965('0x32')][_0x0965('0x46')]){_0x1994dd['include']=[{'all':!![]}];}return db[_0x0965('0x2f')][_0x0965('0x47')](_0x1994dd);})['then'](function(_0x44d04e){_0x5c241d[_0x0965('0x48')]=_0x44d04e;return _0x5c241d;})[_0x0965('0x27')](respondWithFilteredResult(_0x400a69,_0x1994dd))[_0x0965('0x49')](handleError(_0x400a69,null));};exports[_0x0965('0x4a')]=function(_0x16087b,_0x9641a1){var _0x10f99d={'raw':!![],'where':{'id':_0x16087b[_0x0965('0x4b')]['id']}},_0x5c11e5={};_0x5c11e5[_0x0965('0x37')]=_[_0x0965('0x31')](db['OpenchannelQueue'][_0x0965('0x30')]);_0x5c11e5['query']=_[_0x0965('0x31')](_0x16087b[_0x0965('0x32')]);_0x5c11e5[_0x0965('0x34')]=_[_0x0965('0x36')](_0x5c11e5[_0x0965('0x37')],_0x5c11e5['query']);_0x10f99d[_0x0965('0x35')]=_[_0x0965('0x36')](_0x5c11e5[_0x0965('0x37')],qs[_0x0965('0x38')](_0x16087b['query']['fields']));_0x10f99d[_0x0965('0x35')]=_0x10f99d[_0x0965('0x35')][_0x0965('0x39')]?_0x10f99d[_0x0965('0x35')]:_0x5c11e5[_0x0965('0x37')];if(_0x16087b[_0x0965('0x32')][_0x0965('0x46')]){_0x10f99d[_0x0965('0x4c')]=[{'all':!![]}];}_0x10f99d=_[_0x0965('0x42')]({},_0x10f99d,_0x16087b['options']);return db[_0x0965('0x2f')][_0x0965('0x4d')](_0x10f99d)[_0x0965('0x27')](handleEntityNotFound(_0x9641a1,null))[_0x0965('0x27')](respondWithResult(_0x9641a1,null))[_0x0965('0x49')](handleError(_0x9641a1,null));};exports[_0x0965('0x4e')]=function(_0x25da8d,_0x11a598){return db['OpenchannelQueue'][_0x0965('0x4e')](_0x25da8d[_0x0965('0x4f')],{})[_0x0965('0x27')](function(_0x53e136){var _0x3e9fa8=_0x25da8d[_0x0965('0x50')][_0x0965('0x28')]({'plain':!![]});if(!_0x3e9fa8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e9fa8[_0x0965('0x51')]===_0x0965('0x50')){var _0x51146e=_0x53e136['get']({'plain':!![]});var _0x1dfd01=_0x0965('0x29');return db[_0x0965('0x52')][_0x0965('0x4d')]({'where':{'name':_0x1dfd01,'userProfileId':_0x3e9fa8[_0x0965('0x53')]},'raw':!![]})[_0x0965('0x27')](function(_0x4ec780){if(_0x4ec780&&_0x4ec780[_0x0965('0x54')]===0x0){return db[_0x0965('0x2a')][_0x0965('0x4e')]({'name':_0x51146e[_0x0965('0x2d')],'resourceId':_0x51146e['id'],'type':_0x4ec780['name'],'sectionId':_0x4ec780['id']},{})[_0x0965('0x27')](function(){return _0x53e136;});}else{return _0x53e136;}})[_0x0965('0x49')](function(_0xf2fced){logger[_0x0965('0x55')](_0x0965('0x56'),_0xf2fced);throw _0xf2fced;});}return _0x53e136;})[_0x0965('0x27')](respondWithResult(_0x11a598,0xc9))[_0x0965('0x49')](handleError(_0x11a598,null));};exports[_0x0965('0x26')]=function(_0x5b5305,_0x2ffb49){if(_0x5b5305[_0x0965('0x4f')]['id']){delete _0x5b5305[_0x0965('0x4f')]['id'];}return db[_0x0965('0x2f')][_0x0965('0x4d')]({'where':{'id':_0x5b5305[_0x0965('0x4b')]['id']}})[_0x0965('0x27')](handleEntityNotFound(_0x2ffb49,null))[_0x0965('0x27')](saveUpdates(_0x5b5305[_0x0965('0x4f')],null))[_0x0965('0x27')](respondWithResult(_0x2ffb49,null))['catch'](handleError(_0x2ffb49,null));};exports[_0x0965('0x57')]=function(_0x1a7fb6,_0x18e233){return db['OpenchannelQueue'][_0x0965('0x4d')]({'where':{'id':_0x1a7fb6[_0x0965('0x4b')]['id']}})[_0x0965('0x27')](handleEntityNotFound(_0x18e233,null))[_0x0965('0x27')](removeEntity(_0x18e233,null))[_0x0965('0x49')](handleError(_0x18e233,null));};exports[_0x0965('0x58')]=function(_0x5c517d,_0x40f2df){return db[_0x0965('0x2f')][_0x0965('0x58')]()[_0x0965('0x27')](respondWithResult(_0x40f2df,null))[_0x0965('0x49')](handleError(_0x40f2df,null));};exports[_0x0965('0x59')]=function(_0xa49b62,_0x2fdc47,_0x2a5448){var _0x2fdc1c={'raw':!![],'where':{}},_0x3bcee3={},_0x33eca7;return db[_0x0965('0x2f')][_0x0965('0x5a')]({'where':{'id':_0xa49b62[_0x0965('0x4b')]['id']}})[_0x0965('0x27')](handleEntityNotFound(_0x2fdc47,null))[_0x0965('0x27')](function(_0x36051a){if(_0x36051a){_0x33eca7=_0x36051a[_0x0965('0x28')]({'plain':!![]});_0x3bcee3[_0x0965('0x37')]=_[_0x0965('0x31')](db['UserOpenchannelQueue']['rawAttributes']);_0x3bcee3[_0x0965('0x32')]=_[_0x0965('0x31')](_0xa49b62[_0x0965('0x32')]);_0x3bcee3['filters']=_[_0x0965('0x36')](_0x3bcee3[_0x0965('0x37')],_0x3bcee3[_0x0965('0x32')]);_0x2fdc1c['attributes']=_['intersection'](_0x3bcee3[_0x0965('0x37')],qs['fields'](_0xa49b62[_0x0965('0x32')][_0x0965('0x38')]));_0x2fdc1c[_0x0965('0x35')]=_0x2fdc1c[_0x0965('0x35')][_0x0965('0x39')]?_0x2fdc1c[_0x0965('0x35')]:_0x3bcee3[_0x0965('0x37')];if(!_0xa49b62[_0x0965('0x32')][_0x0965('0x3a')](_0x0965('0x3b'))){_0x2fdc1c[_0x0965('0x22')]=qs[_0x0965('0x22')](_0xa49b62[_0x0965('0x32')][_0x0965('0x22')]);_0x2fdc1c[_0x0965('0x21')]=qs[_0x0965('0x21')](_0xa49b62[_0x0965('0x32')][_0x0965('0x21')]);}_0x2fdc1c[_0x0965('0x3c')]=qs[_0x0965('0x3d')](_0xa49b62['query'][_0x0965('0x3d')]);_0x2fdc1c[_0x0965('0x3e')]=qs[_0x0965('0x34')](_[_0x0965('0x5b')](_0xa49b62[_0x0965('0x32')],_0x3bcee3['filters']));_0x2fdc1c[_0x0965('0x3e')][_0x0965('0x5c')]=_0x36051a['id'];if(_0xa49b62['query'][_0x0965('0x43')]){_0x2fdc1c[_0x0965('0x3e')]=_[_0x0965('0x42')](_0x2fdc1c[_0x0965('0x3e')],{'$or':_[_0x0965('0x44')](_0x2fdc1c[_0x0965('0x35')],function(_0x34f53b){var _0x2241d0={};_0x2241d0[_0x34f53b]={'$like':'%'+_0xa49b62[_0x0965('0x32')]['filter']+'%'};return _0x2241d0;})});}_0x2fdc1c=_['merge']({},_0x2fdc1c,_0xa49b62[_0x0965('0x45')]);return db[_0x0965('0x5d')][_0x0965('0x47')](_0x2fdc1c);}})[_0x0965('0x27')](function(_0x283ab6){if(_0x283ab6){return db['User'][_0x0965('0x5e')]({'where':{'id':_[_0x0965('0x44')](_0x283ab6,_0x0965('0x5f')),'role':_0x0965('0x60')},'attributes':['id',_0x0965('0x2d'),_0x0965('0x61'),_0x0965('0x62'),'createdAt']});}})['then'](function(_0x35fc67){if(_0x35fc67){return{'count':_0x35fc67[_0x0965('0x20')],'rows':_[_0x0965('0x44')](_0x35fc67[_0x0965('0x48')],function(_0x4b0217){return{'membername':_0x4b0217[_0x0965('0x2d')],'UserId':_0x4b0217['id'],'queue_name':_0x33eca7[_0x0965('0x2d')],'OpenchannelQueueId':_0x33eca7['id'],'interface':util[_0x0965('0x63')](_0x0965('0x64'),'SIP',_0x4b0217[_0x0965('0x2d')]),'penalty':0x0,'paused':_0x4b0217['openchannelPause'],'createdAt':_0x4b0217[_0x0965('0x65')],'updatedAt':_0x4b0217[_0x0965('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0965('0x27')](respondWithFilteredResult(_0x2fdc47,_0x2fdc1c))[_0x0965('0x49')](handleError(_0x2fdc47,null));};exports[_0x0965('0x66')]=function(_0x173cb2,_0x556afe,_0x39f6d7){var _0x39562d={};var _0x690a1f={};var _0x52c0aa;var _0x1fcb27;return db[_0x0965('0x2f')][_0x0965('0x5a')]({'where':{'id':_0x173cb2[_0x0965('0x4b')]['id']}})[_0x0965('0x27')](handleEntityNotFound(_0x556afe,null))['then'](function(_0x42a3e7){if(_0x42a3e7){_0x52c0aa=_0x42a3e7;_0x690a1f[_0x0965('0x37')]=_[_0x0965('0x31')](db[_0x0965('0x67')]['rawAttributes']);_0x690a1f[_0x0965('0x32')]=_['keys'](_0x173cb2[_0x0965('0x32')]);_0x690a1f[_0x0965('0x34')]=_[_0x0965('0x36')](_0x690a1f[_0x0965('0x37')],_0x690a1f[_0x0965('0x32')]);_0x39562d[_0x0965('0x35')]=_[_0x0965('0x36')](_0x690a1f[_0x0965('0x37')],qs[_0x0965('0x38')](_0x173cb2[_0x0965('0x32')][_0x0965('0x38')]));_0x39562d[_0x0965('0x35')]=_0x39562d[_0x0965('0x35')][_0x0965('0x39')]?_0x39562d[_0x0965('0x35')]:_0x690a1f[_0x0965('0x37')];_0x39562d[_0x0965('0x3c')]=qs['sort'](_0x173cb2['query'][_0x0965('0x3d')]);_0x39562d[_0x0965('0x3e')]=qs[_0x0965('0x34')](_['pick'](_0x173cb2[_0x0965('0x32')],_0x690a1f[_0x0965('0x34')]));if(_0x173cb2[_0x0965('0x32')][_0x0965('0x43')]){_0x39562d[_0x0965('0x3e')]=_[_0x0965('0x42')](_0x39562d['where'],{'$or':_[_0x0965('0x44')](_0x39562d[_0x0965('0x35')],function(_0x2387c6){var _0x5bf1ed={};_0x5bf1ed[_0x2387c6]={'$like':'%'+_0x173cb2[_0x0965('0x32')][_0x0965('0x43')]+'%'};return _0x5bf1ed;})});}_0x39562d=_[_0x0965('0x42')]({},_0x39562d,_0x173cb2[_0x0965('0x45')]);return _0x52c0aa[_0x0965('0x66')](_0x39562d);}})[_0x0965('0x27')](function(_0x1ca152){if(_0x1ca152){_0x1fcb27=_0x1ca152[_0x0965('0x39')];if(!_0x173cb2['query'][_0x0965('0x3a')](_0x0965('0x3b'))){_0x39562d[_0x0965('0x22')]=qs[_0x0965('0x22')](_0x173cb2['query'][_0x0965('0x22')]);_0x39562d[_0x0965('0x21')]=qs[_0x0965('0x21')](_0x173cb2[_0x0965('0x32')]['offset']);}return _0x52c0aa[_0x0965('0x66')](_0x39562d);}})[_0x0965('0x27')](function(_0x4e1a19){if(_0x4e1a19){return _0x4e1a19?{'count':_0x1fcb27,'rows':_0x4e1a19}:null;}})['then'](respondWithResult(_0x556afe,null))['catch'](handleError(_0x556afe,null));};exports[_0x0965('0x68')]=function(_0x42a7f3,_0x5cc796,_0x1dbae5){var _0x729d60=[];var _0x4e4aa6;return db['Team'][_0x0965('0x47')]({'where':{'id':_0x42a7f3['body'][_0x0965('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0965('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x27ca36){if(_0x27ca36){for(var _0x77501c=0x0;_0x77501c<_0x27ca36[_0x0965('0x39')];_0x77501c+=0x1){for(var _0x1d876e=0x0;_0x1d876e<_0x27ca36[_0x77501c]['Agents']['length'];_0x1d876e+=0x1){_0x729d60=_[_0x0965('0x6b')](_0x729d60,[_0x27ca36[_0x77501c][_0x0965('0x6a')][_0x1d876e]['id']]);}}return _0x729d60;}})[_0x0965('0x27')](function(_0x1ba08a){if(_0x1ba08a){return db[_0x0965('0x2f')][_0x0965('0x4d')]({'where':{'id':_0x42a7f3[_0x0965('0x4b')]['id']}});}})['then'](function(_0x5a6bb1){if(_0x5a6bb1){_0x4e4aa6=_0x5a6bb1;return _0x4e4aa6[_0x0965('0x6c')](_0x729d60,{'penalty':_0x42a7f3[_0x0965('0x4f')]['penalty']});}})[_0x0965('0x27')](function(_0x3679bb){if(_0x3679bb){return _0x4e4aa6[_0x0965('0x68')](_0x42a7f3['body'][_0x0965('0x69')]);}})['then'](handleEntityNotFound(_0x5cc796,null))[_0x0965('0x27')](respondWithStatusCode(_0x5cc796,null))['catch'](handleError(_0x5cc796,null));};exports[_0x0965('0x6d')]=function(_0x4f2e08,_0x5a2b6d,_0x2d43a6){var _0x3f8d15=[];var _0x389e3f;return db['Team']['findAll']({'where':{'id':_0x4f2e08[_0x0965('0x32')][_0x0965('0x69')]},'attributes':['id'],'include':[{'model':db[_0x0965('0x6e')],'as':_0x0965('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x48b938){if(_0x48b938){for(var _0x3cbe08=0x0;_0x3cbe08<_0x48b938[_0x0965('0x39')];_0x3cbe08+=0x1){for(var _0x3c99bd=0x0;_0x3c99bd<_0x48b938[_0x3cbe08][_0x0965('0x6a')][_0x0965('0x39')];_0x3c99bd+=0x1){_0x3f8d15=_[_0x0965('0x6b')](_0x3f8d15,[_0x48b938[_0x3cbe08][_0x0965('0x6a')][_0x3c99bd]['id']]);}}return _0x3f8d15;}})[_0x0965('0x27')](function(_0x3d411b){if(_0x3d411b){return db[_0x0965('0x2f')][_0x0965('0x4d')]({'where':{'id':_0x4f2e08[_0x0965('0x4b')]['id']}});}})[_0x0965('0x27')](function(_0x3d749f){if(_0x3d749f){_0x389e3f=_0x3d749f;return _0x389e3f[_0x0965('0x6f')](_0x3f8d15);}})['then'](function(_0x4d9579){if(_0x389e3f){return _0x389e3f['removeTeams'](_0x4f2e08[_0x0965('0x32')]['ids']);}})[_0x0965('0x27')](handleEntityNotFound(_0x5a2b6d,null))[_0x0965('0x27')](respondWithStatusCode(_0x5a2b6d,null))[_0x0965('0x49')](handleError(_0x5a2b6d,null));};exports[_0x0965('0x6c')]=function(_0x363403,_0x5674f6,_0x62bd71){return db['OpenchannelQueue'][_0x0965('0x4d')]({'where':{'id':_0x363403['params']['id']}})['then'](handleEntityNotFound(_0x5674f6,null))['then'](function(_0x4fd39e){if(_0x4fd39e){return _0x4fd39e[_0x0965('0x6c')](_0x363403[_0x0965('0x4f')][_0x0965('0x69')],_[_0x0965('0x70')](_0x363403[_0x0965('0x4f')],[_0x0965('0x69'),'id'])||{})[_0x0965('0x71')](function(_0x2cbfbc){for(var _0x23dd13=0x0;_0x23dd13<_0x363403[_0x0965('0x4f')][_0x0965('0x69')][_0x0965('0x39')];_0x23dd13+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x363403['body'][_0x0965('0x69')][_0x23dd13],'OpenchannelQueueId':_0x363403[_0x0965('0x4b')]['id']});}return _0x2cbfbc;});}})['then'](respondWithResult(_0x5674f6,null))[_0x0965('0x49')](handleError(_0x5674f6,null));};exports[_0x0965('0x6f')]=function(_0x463bd4,_0x3d059d,_0x41c048){var _0x18041b;return db['OpenchannelQueue']['find']({'where':{'id':_0x463bd4[_0x0965('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d059d,null))[_0x0965('0x27')](function(_0x31c389){if(_0x31c389){return _0x31c389[_0x0965('0x6f')](_0x463bd4[_0x0965('0x32')][_0x0965('0x69')])[_0x0965('0x27')](function(_0x498aa4){if(_[_0x0965('0x72')](_0x463bd4[_0x0965('0x32')][_0x0965('0x69')])){for(var _0x386e01=0x0;_0x386e01<_0x463bd4['query'][_0x0965('0x69')]['length'];_0x386e01+=0x1){socket[_0x0965('0x73')]('userOpenchannelQueue:remove',{'UserId':_0x463bd4[_0x0965('0x32')][_0x0965('0x69')][_0x386e01],'OpenchannelQueueId':_0x463bd4['params']['id']});}}else{socket[_0x0965('0x73')]('userOpenchannelQueue:remove',{'UserId':_0x463bd4[_0x0965('0x32')][_0x0965('0x69')],'OpenchannelQueueId':_0x463bd4[_0x0965('0x4b')]['id']});}});}})[_0x0965('0x27')](respondWithStatusCode(_0x3d059d,null))[_0x0965('0x49')](handleError(_0x3d059d,null));};exports[_0x0965('0x74')]=function(_0x5101df,_0xe37052,_0x224df6){var _0x245c89={};var _0x144fc7={};var _0x24b37b;var _0x3dda88;return db[_0x0965('0x2f')]['findOne']({'where':{'id':_0x5101df['params']['id']}})[_0x0965('0x27')](handleEntityNotFound(_0xe37052,null))['then'](function(_0xf8ad80){if(_0xf8ad80){_0x24b37b=_0xf8ad80;_0x144fc7[_0x0965('0x37')]=_['keys'](db[_0x0965('0x6e')][_0x0965('0x30')]);_0x144fc7[_0x0965('0x32')]=_[_0x0965('0x31')](_0x5101df[_0x0965('0x32')]);_0x144fc7[_0x0965('0x34')]=_[_0x0965('0x36')](_0x144fc7[_0x0965('0x37')],_0x144fc7[_0x0965('0x32')]);_0x245c89['attributes']=_[_0x0965('0x36')](_0x144fc7[_0x0965('0x37')],qs['fields'](_0x5101df[_0x0965('0x32')][_0x0965('0x38')]));_0x245c89[_0x0965('0x35')]=_0x245c89[_0x0965('0x35')]['length']?_0x245c89[_0x0965('0x35')]:_0x144fc7[_0x0965('0x37')];_0x245c89[_0x0965('0x3c')]=qs['sort'](_0x5101df[_0x0965('0x32')][_0x0965('0x3d')]);_0x245c89['where']=qs['filters'](_[_0x0965('0x5b')](_0x5101df['query'],_0x144fc7[_0x0965('0x34')]));if(_0x5101df['query'][_0x0965('0x43')]){_0x245c89[_0x0965('0x3e')]=_['merge'](_0x245c89['where'],{'$or':_['map'](_0x245c89[_0x0965('0x35')],function(_0x58a1ed){var _0x57dd01={};_0x57dd01[_0x58a1ed]={'$like':'%'+_0x5101df['query']['filter']+'%'};return _0x57dd01;})});}_0x245c89=_[_0x0965('0x42')]({},_0x245c89,_0x5101df['options']);return _0x24b37b[_0x0965('0x74')](_0x245c89);}})[_0x0965('0x27')](function(_0x30c54c){if(_0x30c54c){_0x3dda88=_0x30c54c[_0x0965('0x39')];if(!_0x5101df[_0x0965('0x32')]['hasOwnProperty'](_0x0965('0x3b'))){_0x245c89[_0x0965('0x22')]=qs[_0x0965('0x22')](_0x5101df[_0x0965('0x32')][_0x0965('0x22')]);_0x245c89[_0x0965('0x21')]=qs[_0x0965('0x21')](_0x5101df[_0x0965('0x32')][_0x0965('0x21')]);}return _0x24b37b[_0x0965('0x74')](_0x245c89);}})['then'](function(_0x4d6b5a){if(_0x4d6b5a){return _0x4d6b5a?{'count':_0x3dda88,'rows':_0x4d6b5a}:null;}})[_0x0965('0x27')](respondWithResult(_0xe37052,null))['catch'](handleError(_0xe37052,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 5d3b51a..a5c17cc 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 _0xf5d0=['setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','OpenchannelQueue'];(function(_0x167117,_0x2dee70){var _0x387b70=function(_0x58f7e0){while(--_0x58f7e0){_0x167117['push'](_0x167117['shift']());}};_0x387b70(++_0x2dee70);}(_0xf5d0,0xfa));var _0x0f5d=function(_0x1316ac,_0x1e67cf){_0x1316ac=_0x1316ac-0x0;var _0xd0769d=_0xf5d0[_0x1316ac];return _0xd0769d;};'use strict';var EventEmitter=require(_0x0f5d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x0f5d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0f5d('0x2')](0x0);var events={'afterCreate':_0x0f5d('0x3'),'afterUpdate':_0x0f5d('0x4'),'afterDestroy':_0x0f5d('0x5')};function emitEvent(_0x5a6c4d){return function(_0x23e815,_0x48757d,_0x23140a){OpenchannelQueueEvents['emit'](_0x5a6c4d+':'+_0x23e815['id'],_0x23e815);OpenchannelQueueEvents['emit'](_0x5a6c4d,_0x23e815);_0x23140a(null);};}for(var e in events){if(events[_0x0f5d('0x6')](e)){var event=events[e];OpenchannelQueue[_0x0f5d('0x7')](e,emitEvent(event));}}module[_0x0f5d('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xc595=['hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x234ce0,_0x145417){var _0x12f615=function(_0x425867){while(--_0x425867){_0x234ce0['push'](_0x234ce0['shift']());}};_0x12f615(++_0x145417);}(_0xc595,0xe9));var _0x5c59=function(_0x3e7e3c,_0xec2f80){_0x3e7e3c=_0x3e7e3c-0x0;var _0x345d73=_0xc595[_0x3e7e3c];return _0x345d73;};'use strict';var EventEmitter=require(_0x5c59('0x0'));var OpenchannelQueue=require(_0x5c59('0x1'))['db'][_0x5c59('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5c59('0x3')](0x0);var events={'afterCreate':_0x5c59('0x4'),'afterUpdate':_0x5c59('0x5'),'afterDestroy':_0x5c59('0x6')};function emitEvent(_0x25078c){return function(_0x23397b,_0x164d84,_0x299752){OpenchannelQueueEvents[_0x5c59('0x7')](_0x25078c+':'+_0x23397b['id'],_0x23397b);OpenchannelQueueEvents['emit'](_0x25078c,_0x23397b);_0x299752(null);};}for(var e in events){if(events[_0x5c59('0x8')](e)){var event=events[e];OpenchannelQueue[_0x5c59('0x9')](e,emitEvent(event));}}module[_0x5c59('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index bf27a24..0a3396a 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 _0x7a2c=['../../config/logger','api','moment','bluebird','request-promise','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x1ee21d,_0x119e32){_0x1ee21d=_0x1ee21d-0x0;var _0x4c3ad4=_0x7a2c[_0x1ee21d];return _0x4c3ad4;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var rp=require(_0xc7a2('0x5'));var attributes=require(_0xc7a2('0x6'));module[_0xc7a2('0x7')]=function(_0x34cd60,_0x489232){return _0x34cd60[_0xc7a2('0x8')](_0xc7a2('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf72b=['OpenchannelQueue','lodash','../../config/logger','moment','bluebird','./openchannelQueue.attributes','exports','define'];(function(_0x5a9629,_0x532e57){var _0x2212c4=function(_0x1c1a29){while(--_0x1c1a29){_0x5a9629['push'](_0x5a9629['shift']());}};_0x2212c4(++_0x532e57);}(_0xf72b,0x1d9));var _0xbf72=function(_0x13d748,_0x4e3b0d){_0x13d748=_0x13d748-0x0;var _0x47afc8=_0xf72b[_0x13d748];return _0x47afc8;};'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 diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 3b2a9c4..d9c2a3e 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 _0x885e=['error','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x934623,_0x1a612c){var _0x415b32=function(_0x23bcd1){while(--_0x23bcd1){_0x934623['push'](_0x934623['shift']());}};_0x415b32(++_0x1a612c);}(_0x885e,0xe4));var _0xe885=function(_0x8b4167,_0x15c217){_0x8b4167=_0x8b4167-0x0;var _0x28cd7a=_0x885e[_0x8b4167];return _0x28cd7a;};'use strict';var _=require(_0xe885('0x0'));var util=require(_0xe885('0x1'));var moment=require('moment');var BPromise=require(_0xe885('0x2'));var rs=require(_0xe885('0x3'));var fs=require('fs');var Redis=require(_0xe885('0x4'));var db=require(_0xe885('0x5'))['db'];var utils=require(_0xe885('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe885('0x7'));var jayson=require(_0xe885('0x8'));var client=jayson[_0xe885('0x9')][_0xe885('0xa')]({'port':0x232a});config['redis']=_[_0xe885('0xb')](config['redis'],{'host':_0xe885('0xc'),'port':0x18eb});var socket=require(_0xe885('0xd'))(new Redis(config[_0xe885('0xe')]));require(_0xe885('0xf'))[_0xe885('0x10')](socket);function respondWithRpcPromise(_0x974154,_0x5e99d4,_0x27bb9f){return new BPromise(function(_0x2760d5,_0x299c80){return client[_0xe885('0x11')](_0x974154,_0x27bb9f)[_0xe885('0x12')](function(_0x2503e4){logger[_0xe885('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x5e99d4,_0xe885('0x14'));logger[_0xe885('0x15')](_0xe885('0x16'),_0x5e99d4,_0xe885('0x14'),JSON[_0xe885('0x17')](_0x2503e4));if(_0x2503e4[_0xe885('0x18')]){if(_0x2503e4[_0xe885('0x18')]['code']===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x5e99d4,_0x2503e4[_0xe885('0x18')][_0xe885('0x19')]);return _0x299c80(_0x2503e4[_0xe885('0x18')][_0xe885('0x19')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x5e99d4,_0x2503e4[_0xe885('0x18')]['message']);return _0x2760d5(_0x2503e4[_0xe885('0x18')][_0xe885('0x19')]);}else{logger[_0xe885('0x13')](_0xe885('0x1a'),_0x5e99d4,_0xe885('0x14'));_0x2760d5(_0x2503e4[_0xe885('0x1b')]['message']);}})[_0xe885('0x1c')](function(_0x722d6a){logger[_0xe885('0x18')](_0xe885('0x1a'),_0x5e99d4,_0x722d6a);_0x299c80(_0x722d6a);});});}exports[_0xe885('0x1d')]=function(_0xf29906){var _0x10498e=this;return new Promise(function(_0x5ae856,_0x159624){return db[_0xe885('0x1e')][_0xe885('0x1f')]({'raw':_0xf29906[_0xe885('0x20')]?_0xf29906[_0xe885('0x20')][_0xe885('0x21')]===undefined?!![]:![]:!![],'where':_0xf29906[_0xe885('0x20')]?_0xf29906[_0xe885('0x20')][_0xe885('0x22')]||null:null,'attributes':_0xf29906[_0xe885('0x20')]?_0xf29906[_0xe885('0x20')][_0xe885('0x23')]||null:null,'limit':_0xf29906['options']?_0xf29906['options'][_0xe885('0x24')]||null:null,'include':_0xf29906[_0xe885('0x20')]?_0xf29906[_0xe885('0x20')][_0xe885('0x25')]?_[_0xe885('0x26')](_0xf29906['options'][_0xe885('0x25')],function(_0x1cac46){return{'model':db[_0x1cac46[_0xe885('0x27')]],'as':_0x1cac46['as'],'attributes':_0x1cac46['attributes'],'include':_0x1cac46['include']?_[_0xe885('0x26')](_0x1cac46[_0xe885('0x25')],function(_0x4d1662){return{'model':db[_0x4d1662[_0xe885('0x27')]],'as':_0x4d1662['as'],'attributes':_0x4d1662[_0xe885('0x23')],'include':_0x4d1662['include']?_['map'](_0x4d1662[_0xe885('0x25')],function(_0xa4916f){return{'model':db[_0xa4916f[_0xe885('0x27')]],'as':_0xa4916f['as'],'attributes':_0xa4916f['attributes']};}):[]};}):[]};}):[]:[]})[_0xe885('0x12')](function(_0x1d7c84){logger[_0xe885('0x13')](_0xe885('0x1d'),_0xf29906);logger[_0xe885('0x15')](_0xe885('0x1d'),_0xf29906,JSON[_0xe885('0x17')](_0x1d7c84));_0x5ae856(_0x1d7c84);})[_0xe885('0x1c')](function(_0x666c71){logger['error']('GetOpenchannelQueue',_0x666c71[_0xe885('0x19')],_0xf29906);_0x159624(_0x10498e[_0xe885('0x18')](0x1f4,_0x666c71[_0xe885('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x5ec963){var _0x43f5f3=this;return new Promise(function(_0x724980,_0x2df4f8){return db[_0xe885('0x1e')][_0xe885('0x28')]({'raw':_0x5ec963[_0xe885('0x20')]?_0x5ec963[_0xe885('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x5ec963[_0xe885('0x20')]?_0x5ec963['options']['where']||null:null,'attributes':_0x5ec963['options']?_0x5ec963[_0xe885('0x20')][_0xe885('0x23')]||null:null,'include':_0x5ec963[_0xe885('0x20')]?_0x5ec963['options'][_0xe885('0x25')]?_[_0xe885('0x26')](_0x5ec963[_0xe885('0x20')][_0xe885('0x25')],function(_0x42764e){return{'model':db[_0x42764e['model']],'as':_0x42764e['as'],'attributes':_0x42764e['attributes'],'include':_0x42764e[_0xe885('0x25')]?_['map'](_0x42764e[_0xe885('0x25')],function(_0xe90251){return{'model':db[_0xe90251[_0xe885('0x27')]],'as':_0xe90251['as'],'attributes':_0xe90251[_0xe885('0x23')],'include':_0xe90251[_0xe885('0x25')]?_['map'](_0xe90251[_0xe885('0x25')],function(_0x2180ec){return{'model':db[_0x2180ec['model']],'as':_0x2180ec['as'],'attributes':_0x2180ec['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x92636f){logger[_0xe885('0x13')](_0xe885('0x29'),_0x5ec963);logger[_0xe885('0x15')]('ShowOpenchannelQueue',_0x5ec963,JSON[_0xe885('0x17')](_0x92636f));_0x724980(_0x92636f);})[_0xe885('0x1c')](function(_0x3c8b04){logger[_0xe885('0x18')]('ShowOpenchannelQueue',_0x3c8b04['message'],_0x5ec963);_0x2df4f8(_0x43f5f3['error'](0x1f4,_0x3c8b04[_0xe885('0x19')]));});});}; \ No newline at end of file +var _0xa41a=['client','http','redis','localhost','./openchannelQueue.socket','register','request','info','debug','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','options','raw','where','attributes','limit','model','map','include','then','OpenchannelQueue','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3902b8,_0x4b013a){var _0x345127=function(_0x333616){while(--_0x333616){_0x3902b8['push'](_0x3902b8['shift']());}};_0x345127(++_0x4b013a);}(_0xa41a,0x6b));var _0xaa41=function(_0x519424,_0x5671b2){_0x519424=_0x519424-0x0;var _0x4a0402=_0xa41a[_0x519424];return _0x4a0402;};'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});config['redis']=_['defaults'](config[_0xaa41('0xc')],{'host':_0xaa41('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xc')]));require(_0xaa41('0xe'))[_0xaa41('0xf')](socket);function respondWithRpcPromise(_0x1cc344,_0x4263d6,_0x38d930){return new BPromise(function(_0x806f08,_0x423a19){return client[_0xaa41('0x10')](_0x1cc344,_0x38d930)['then'](function(_0x1d3aac){logger[_0xaa41('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x4263d6,'request\x20sent');logger[_0xaa41('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4263d6,_0xaa41('0x13'),JSON[_0xaa41('0x14')](_0x1d3aac));if(_0x1d3aac[_0xaa41('0x15')]){if(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x16')]===0x1f4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);return _0x423a19(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}logger[_0xaa41('0x15')](_0xaa41('0x17'),_0x4263d6,_0x1d3aac['error'][_0xaa41('0x18')]);return _0x806f08(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}else{logger[_0xaa41('0x11')](_0xaa41('0x17'),_0x4263d6,_0xaa41('0x13'));_0x806f08(_0x1d3aac[_0xaa41('0x19')][_0xaa41('0x18')]);}})[_0xaa41('0x1a')](function(_0x4fe1a4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x4fe1a4);_0x423a19(_0x4fe1a4);});});}exports[_0xaa41('0x1b')]=function(_0x35c753){var _0x54c488=this;return new Promise(function(_0x2bf794,_0x1f692b){return db['OpenchannelQueue']['findAll']({'raw':_0x35c753[_0xaa41('0x1c')]?_0x35c753['options'][_0xaa41('0x1d')]===undefined?!![]:![]:!![],'where':_0x35c753[_0xaa41('0x1c')]?_0x35c753[_0xaa41('0x1c')][_0xaa41('0x1e')]||null:null,'attributes':_0x35c753[_0xaa41('0x1c')]?_0x35c753['options'][_0xaa41('0x1f')]||null:null,'limit':_0x35c753[_0xaa41('0x1c')]?_0x35c753[_0xaa41('0x1c')][_0xaa41('0x20')]||null:null,'include':_0x35c753[_0xaa41('0x1c')]?_0x35c753[_0xaa41('0x1c')]['include']?_['map'](_0x35c753[_0xaa41('0x1c')]['include'],function(_0x493a10){return{'model':db[_0x493a10[_0xaa41('0x21')]],'as':_0x493a10['as'],'attributes':_0x493a10['attributes'],'include':_0x493a10['include']?_[_0xaa41('0x22')](_0x493a10[_0xaa41('0x23')],function(_0x392214){return{'model':db[_0x392214[_0xaa41('0x21')]],'as':_0x392214['as'],'attributes':_0x392214[_0xaa41('0x1f')],'include':_0x392214[_0xaa41('0x23')]?_['map'](_0x392214[_0xaa41('0x23')],function(_0x1f0275){return{'model':db[_0x1f0275[_0xaa41('0x21')]],'as':_0x1f0275['as'],'attributes':_0x1f0275[_0xaa41('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaa41('0x24')](function(_0x4466a3){logger[_0xaa41('0x11')](_0xaa41('0x1b'),_0x35c753);logger['debug'](_0xaa41('0x1b'),_0x35c753,JSON['stringify'](_0x4466a3));_0x2bf794(_0x4466a3);})['catch'](function(_0x714537){logger[_0xaa41('0x15')]('GetOpenchannelQueue',_0x714537[_0xaa41('0x18')],_0x35c753);_0x1f692b(_0x54c488[_0xaa41('0x15')](0x1f4,_0x714537['message']));});});};exports['ShowOpenchannelQueue']=function(_0x5c25fb){var _0x1cf3da=this;return new Promise(function(_0x2f5cc0,_0x2a186e){return db[_0xaa41('0x25')]['find']({'raw':_0x5c25fb[_0xaa41('0x1c')]?_0x5c25fb[_0xaa41('0x1c')][_0xaa41('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c25fb['options']?_0x5c25fb[_0xaa41('0x1c')][_0xaa41('0x1e')]||null:null,'attributes':_0x5c25fb[_0xaa41('0x1c')]?_0x5c25fb['options'][_0xaa41('0x1f')]||null:null,'include':_0x5c25fb[_0xaa41('0x1c')]?_0x5c25fb['options'][_0xaa41('0x23')]?_[_0xaa41('0x22')](_0x5c25fb[_0xaa41('0x1c')]['include'],function(_0x22b272){return{'model':db[_0x22b272['model']],'as':_0x22b272['as'],'attributes':_0x22b272[_0xaa41('0x1f')],'include':_0x22b272[_0xaa41('0x23')]?_[_0xaa41('0x22')](_0x22b272['include'],function(_0x526377){return{'model':db[_0x526377['model']],'as':_0x526377['as'],'attributes':_0x526377[_0xaa41('0x1f')],'include':_0x526377[_0xaa41('0x23')]?_[_0xaa41('0x22')](_0x526377[_0xaa41('0x23')],function(_0x4fbb92){return{'model':db[_0x4fbb92['model']],'as':_0x4fbb92['as'],'attributes':_0x4fbb92[_0xaa41('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaa41('0x24')](function(_0x951e52){logger[_0xaa41('0x11')](_0xaa41('0x26'),_0x5c25fb);logger[_0xaa41('0x12')](_0xaa41('0x26'),_0x5c25fb,JSON['stringify'](_0x951e52));_0x2f5cc0(_0x951e52);})[_0xaa41('0x1a')](function(_0x5cf689){logger[_0xaa41('0x15')](_0xaa41('0x26'),_0x5cf689['message'],_0x5c25fb);_0x2a186e(_0x1cf3da['error'](0x1f4,_0x5cf689[_0xaa41('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 20376db..ccb9bb6 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 806a2b9..4271630 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(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 972f058..4b8c02d 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 _0x8765=['moment','sequelize','exports','STRING','DATE'];(function(_0x6ff23d,_0x43db60){var _0x1f85e4=function(_0x415e9c){while(--_0x415e9c){_0x6ff23d['push'](_0x6ff23d['shift']());}};_0x1f85e4(++_0x43db60);}(_0x8765,0xd2));var _0x5876=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8765[_0x199572];return _0x13cfa3;};'use strict';var moment=require(_0x5876('0x0'));var Sequelize=require(_0x5876('0x1'));module[_0x5876('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5876('0x3')]},'joinAt':{'type':Sequelize[_0x5876('0x4')]},'leaveAt':{'type':Sequelize[_0x5876('0x4')]},'acceptAt':{'type':Sequelize[_0x5876('0x4')]},'exitAt':{'type':Sequelize[_0x5876('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7bb9=['DATE','moment','exports','STRING'];(function(_0x3c2a67,_0x2277d4){var _0x99caf5=function(_0x219a83){while(--_0x219a83){_0x3c2a67['push'](_0x3c2a67['shift']());}};_0x99caf5(++_0x2277d4);}(_0x7bb9,0x75));var _0x97bb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7bb9[_0x21a9d9];return _0x46adce;};'use strict';var moment=require(_0x97bb('0x0'));var Sequelize=require('sequelize');module[_0x97bb('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x97bb('0x2')]},'joinAt':{'type':Sequelize[_0x97bb('0x3')]},'leaveAt':{'type':Sequelize[_0x97bb('0x3')]},'acceptAt':{'type':Sequelize[_0x97bb('0x3')]},'exitAt':{'type':Sequelize[_0x97bb('0x3')]},'reason':{'type':Sequelize[_0x97bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 9a8e815..3162dc2 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 _0x9f62=['model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','add','day','merge','filter','map','where','includeAll','include','findAll','catch','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','status','json','count','offset','limit','reject','update','then','end','error','name','send','index','OpenchannelQueueReport','rawAttributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f62,0x154));var _0x29f6=function(_0x9252c6,_0x3ca6ab){_0x9252c6=_0x9252c6-0x0;var _0x4a2c2f=_0x9f62[_0x9252c6];return _0x4a2c2f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x29f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29f6('0x1'));var jsonpatch=require(_0x29f6('0x2'));var rp=require(_0x29f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29f6('0x4'));var util=require(_0x29f6('0x5'));var path=require(_0x29f6('0x6'));var sox=require(_0x29f6('0x7'));var csv=require('to-csv');var ejs=require(_0x29f6('0x8'));var fs=require('fs');var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var qs=require(_0x29f6('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x29f6('0xf'));var config=require(_0x29f6('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17b69c,_0xfa6765){_0xfa6765=_0xfa6765||0xcc;return function(_0x5cf872){if(_0x5cf872){return _0x17b69c['sendStatus'](_0xfa6765);}return _0x17b69c['status'](_0xfa6765)['end']();};}function respondWithResult(_0x2ae0e4,_0x55cf4){_0x55cf4=_0x55cf4||0xc8;return function(_0x189344){if(_0x189344){return _0x2ae0e4[_0x29f6('0x11')](_0x55cf4)[_0x29f6('0x12')](_0x189344);}};}function respondWithFilteredResult(_0x156c96,_0x35d2e2){return function(_0x2418ee){if(_0x2418ee){var _0x1ae582=_0x2418ee[_0x29f6('0x13')],_0x19331f=_0x35d2e2[_0x29f6('0x14')],_0x28d314=_0x35d2e2[_0x29f6('0x14')]+_0x35d2e2[_0x29f6('0x15')],_0x370484;if(_0x28d314>=_0x1ae582){_0x28d314=_0x1ae582;_0x370484=0xc8;}else{_0x370484=0xce;}_0x156c96[_0x29f6('0x11')](_0x370484);return _0x156c96['set']('Content-Range',_0x19331f+'-'+_0x28d314+'/'+_0x1ae582)[_0x29f6('0x12')](_0x2418ee);}return null;};}function patchUpdates(_0x3af478){return function(_0xb31436){try{jsonpatch['apply'](_0xb31436,_0x3af478,!![]);}catch(_0xcb90){return BPromise[_0x29f6('0x16')](_0xcb90);}return _0xb31436['save']();};}function saveUpdates(_0x159227,_0x3e81af){return function(_0x42a8fa){if(_0x42a8fa){return _0x42a8fa[_0x29f6('0x17')](_0x159227)[_0x29f6('0x18')](function(_0x2bfb3d){return _0x2bfb3d;});}return null;};}function removeEntity(_0x5673c8,_0xfb8fd2){return function(_0x59def4){if(_0x59def4){return _0x59def4['destroy']()[_0x29f6('0x18')](function(){_0x5673c8[_0x29f6('0x11')](0xcc)[_0x29f6('0x19')]();});}};}function handleEntityNotFound(_0xafb5dd,_0x54ddeb){return function(_0x2c672e){if(!_0x2c672e){_0xafb5dd['sendStatus'](0x194);}return _0x2c672e;};}function handleError(_0xd4179c,_0xcce041){_0xcce041=_0xcce041||0x1f4;return function(_0x4200cc){logger[_0x29f6('0x1a')](_0x4200cc['stack']);if(_0x4200cc[_0x29f6('0x1b')]){delete _0x4200cc[_0x29f6('0x1b')];}_0xd4179c['status'](_0xcce041)[_0x29f6('0x1c')](_0x4200cc);};}exports[_0x29f6('0x1d')]=function(_0x2519ac,_0x342038){var _0x84ccb7={},_0x4333bc={},_0x23c630={'count':0x0,'rows':[]};var _0x50cdd2=db[_0x29f6('0x1e')][_0x29f6('0x1f')];_0x4333bc[_0x29f6('0x20')]=_[_0x29f6('0x21')](_0x50cdd2);var _0xda0a63={'dateStart':_0x2519ac[_0x29f6('0x22')][_0x29f6('0x23')],'dateEnd':_0x2519ac[_0x29f6('0x22')][_0x29f6('0x24')]};delete _0x2519ac[_0x29f6('0x22')][_0x29f6('0x23')];delete _0x2519ac[_0x29f6('0x22')][_0x29f6('0x24')];_0x4333bc[_0x29f6('0x22')]=_[_0x29f6('0x21')](_0x2519ac[_0x29f6('0x22')]);_0x4333bc[_0x29f6('0x25')]=_['intersection'](_0x4333bc['model'],_0x4333bc[_0x29f6('0x22')]);_0x84ccb7['attributes']=_[_0x29f6('0x26')](_0x4333bc[_0x29f6('0x20')],qs[_0x29f6('0x27')](_0x2519ac[_0x29f6('0x22')]['fields']));_0x84ccb7['attributes']=_0x84ccb7[_0x29f6('0x28')][_0x29f6('0x29')]?_0x84ccb7[_0x29f6('0x28')]:_0x4333bc[_0x29f6('0x20')];if(!_0x2519ac[_0x29f6('0x22')][_0x29f6('0x2a')](_0x29f6('0x2b'))){_0x84ccb7[_0x29f6('0x15')]=qs[_0x29f6('0x15')](_0x2519ac[_0x29f6('0x22')][_0x29f6('0x15')]);_0x84ccb7[_0x29f6('0x14')]=qs[_0x29f6('0x14')](_0x2519ac[_0x29f6('0x22')]['offset']);}_0x84ccb7['order']=qs[_0x29f6('0x2c')](_0x2519ac[_0x29f6('0x22')][_0x29f6('0x2c')]);_0x84ccb7['where']=qs[_0x29f6('0x25')](_[_0x29f6('0x2d')](_0x2519ac[_0x29f6('0x22')],_0x4333bc[_0x29f6('0x25')]));if(_0xda0a63[_0x29f6('0x23')]){if(_0xda0a63['dateEnd']){_0xda0a63[_0x29f6('0x24')]=moment(_0xda0a63[_0x29f6('0x24')])[_0x29f6('0x2e')](0x1,_0x29f6('0x2f'));}else{_0xda0a63['dateEnd']=moment(_0xda0a63[_0x29f6('0x23')])[_0x29f6('0x2e')](0x1,_0x29f6('0x2f'));}_[_0x29f6('0x30')](_0x84ccb7['where'],{'createdAt':{'$gte':_0xda0a63['dateStart'],'$lte':_0xda0a63[_0x29f6('0x24')]}});}if(_0x2519ac['query'][_0x29f6('0x31')]){_0x84ccb7['where']=_[_0x29f6('0x30')](_0x84ccb7['where'],{'$or':_[_0x29f6('0x32')](_0x84ccb7[_0x29f6('0x28')],function(_0x5448c4){var _0x1431fc={};_0x1431fc[_0x5448c4]={'$like':'%'+_0x2519ac['query'][_0x29f6('0x31')]+'%'};return _0x1431fc;})});}_0x84ccb7=_[_0x29f6('0x30')]({},_0x84ccb7,_0x2519ac['options']);var _0xf9c531={'where':_0x84ccb7[_0x29f6('0x33')]};return db[_0x29f6('0x1e')][_0x29f6('0x13')](_0xf9c531)['then'](function(_0x43da1a){_0x23c630[_0x29f6('0x13')]=_0x43da1a;if(_0x2519ac[_0x29f6('0x22')][_0x29f6('0x34')]){_0x84ccb7[_0x29f6('0x35')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x29f6('0x36')](_0x84ccb7);})['then'](function(_0x2ea303){_0x23c630['rows']=_0x2ea303;return _0x23c630;})[_0x29f6('0x18')](respondWithFilteredResult(_0x342038,_0x84ccb7))[_0x29f6('0x37')](handleError(_0x342038,null));};exports['show']=function(_0x28046c,_0x2c371f){var _0x1b3509={'raw':!![],'where':{'id':_0x28046c['params']['id']}},_0x27d655={};_0x27d655[_0x29f6('0x20')]=_[_0x29f6('0x21')](db[_0x29f6('0x1e')]['rawAttributes']);_0x27d655[_0x29f6('0x22')]=_['keys'](_0x28046c[_0x29f6('0x22')]);_0x27d655['filters']=_['intersection'](_0x27d655['model'],_0x27d655[_0x29f6('0x22')]);_0x1b3509[_0x29f6('0x28')]=_[_0x29f6('0x26')](_0x27d655[_0x29f6('0x20')],qs[_0x29f6('0x27')](_0x28046c[_0x29f6('0x22')][_0x29f6('0x27')]));_0x1b3509[_0x29f6('0x28')]=_0x1b3509[_0x29f6('0x28')][_0x29f6('0x29')]?_0x1b3509['attributes']:_0x27d655['model'];if(_0x28046c[_0x29f6('0x22')][_0x29f6('0x34')]){_0x1b3509[_0x29f6('0x35')]=[{'all':!![]}];}_0x1b3509=_[_0x29f6('0x30')]({},_0x1b3509,_0x28046c['options']);return db[_0x29f6('0x1e')][_0x29f6('0x38')](_0x1b3509)['then'](handleEntityNotFound(_0x2c371f,null))[_0x29f6('0x18')](respondWithResult(_0x2c371f,null))[_0x29f6('0x37')](handleError(_0x2c371f,null));};exports[_0x29f6('0x39')]=function(_0x2776ac,_0x1ab004){return db[_0x29f6('0x1e')][_0x29f6('0x39')](_0x2776ac[_0x29f6('0x3a')],{})[_0x29f6('0x18')](respondWithResult(_0x1ab004,0xc9))[_0x29f6('0x37')](handleError(_0x1ab004,null));};exports[_0x29f6('0x17')]=function(_0xb9694,_0x58ea69){if(_0xb9694[_0x29f6('0x3a')]['id']){delete _0xb9694[_0x29f6('0x3a')]['id'];}return db[_0x29f6('0x1e')][_0x29f6('0x38')]({'where':{'id':_0xb9694[_0x29f6('0x3b')]['id']}})['then'](handleEntityNotFound(_0x58ea69,null))[_0x29f6('0x18')](saveUpdates(_0xb9694['body'],null))['then'](respondWithResult(_0x58ea69,null))[_0x29f6('0x37')](handleError(_0x58ea69,null));};exports[_0x29f6('0x3c')]=function(_0x3194fa,_0x1a566f){return db[_0x29f6('0x1e')]['find']({'where':{'id':_0x3194fa[_0x29f6('0x3b')]['id']}})[_0x29f6('0x18')](handleEntityNotFound(_0x1a566f,null))['then'](removeEntity(_0x1a566f,null))[_0x29f6('0x37')](handleError(_0x1a566f,null));};exports['describe']=function(_0x288cf2,_0x241fb0){return db[_0x29f6('0x1e')][_0x29f6('0x3d')]()['then'](respondWithResult(_0x241fb0,null))[_0x29f6('0x37')](handleError(_0x241fb0,null));}; \ No newline at end of file +var _0x207c=['../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','map','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0xb24a44,_0x2dff47){var _0x46e93a=function(_0x3b504c){while(--_0x3b504c){_0xb24a44['push'](_0xb24a44['shift']());}};_0x46e93a(++_0x2dff47);}(_0x207c,0x1e8));var _0xc207=function(_0x5245bc,_0x55e740){_0x5245bc=_0x5245bc-0x0;var _0x2acb9a=_0x207c[_0x5245bc];return _0x2acb9a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc207('0x0'));var rimraf=require(_0xc207('0x1'));var zipdir=require(_0xc207('0x2'));var jsonpatch=require(_0xc207('0x3'));var rp=require(_0xc207('0x4'));var moment=require(_0xc207('0x5'));var BPromise=require(_0xc207('0x6'));var Mustache=require('mustache');var util=require(_0xc207('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc207('0x8'));var fs=require('fs');var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var qs=require(_0xc207('0x10'));var logger=require(_0xc207('0x11'))(_0xc207('0x12'));var utils=require(_0xc207('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b556f,_0x19b297){_0x19b297=_0x19b297||0xcc;return function(_0x491062){if(_0x491062){return _0x5b556f[_0xc207('0x14')](_0x19b297);}return _0x5b556f[_0xc207('0x15')](_0x19b297)['end']();};}function respondWithResult(_0x3e1108,_0xb86b06){_0xb86b06=_0xb86b06||0xc8;return function(_0x3062f5){if(_0x3062f5){return _0x3e1108[_0xc207('0x15')](_0xb86b06)[_0xc207('0x16')](_0x3062f5);}};}function respondWithFilteredResult(_0x51e967,_0xc62672){return function(_0x3c77b7){if(_0x3c77b7){var _0x274bbd=_0x3c77b7['count'],_0x4031ad=_0xc62672[_0xc207('0x17')],_0x4ef6c4=_0xc62672[_0xc207('0x17')]+_0xc62672[_0xc207('0x18')],_0x564cef;if(_0x4ef6c4>=_0x274bbd){_0x4ef6c4=_0x274bbd;_0x564cef=0xc8;}else{_0x564cef=0xce;}_0x51e967[_0xc207('0x15')](_0x564cef);return _0x51e967['set'](_0xc207('0x19'),_0x4031ad+'-'+_0x4ef6c4+'/'+_0x274bbd)[_0xc207('0x16')](_0x3c77b7);}return null;};}function patchUpdates(_0x217d5e){return function(_0x5f288e){try{jsonpatch[_0xc207('0x1a')](_0x5f288e,_0x217d5e,!![]);}catch(_0x488cc0){return BPromise[_0xc207('0x1b')](_0x488cc0);}return _0x5f288e[_0xc207('0x1c')]();};}function saveUpdates(_0x131dc8,_0x461f6a){return function(_0xce0770){if(_0xce0770){return _0xce0770[_0xc207('0x1d')](_0x131dc8)[_0xc207('0x1e')](function(_0x464dea){return _0x464dea;});}return null;};}function removeEntity(_0x212005,_0x2bd2eb){return function(_0x3112ff){if(_0x3112ff){return _0x3112ff[_0xc207('0x1f')]()[_0xc207('0x1e')](function(){_0x212005['status'](0xcc)[_0xc207('0x20')]();});}};}function handleEntityNotFound(_0x5cda23,_0x2e89c5){return function(_0x3ac142){if(!_0x3ac142){_0x5cda23[_0xc207('0x14')](0x194);}return _0x3ac142;};}function handleError(_0x83253f,_0x3539f4){_0x3539f4=_0x3539f4||0x1f4;return function(_0xd209ac){logger[_0xc207('0x21')](_0xd209ac[_0xc207('0x22')]);if(_0xd209ac[_0xc207('0x23')]){delete _0xd209ac[_0xc207('0x23')];}_0x83253f[_0xc207('0x15')](_0x3539f4)[_0xc207('0x24')](_0xd209ac);};}exports[_0xc207('0x25')]=function(_0x138970,_0x1445d3){var _0x56a066={},_0x1e1440={},_0x5e0bd1={'count':0x0,'rows':[]};var _0x4cb3af=db[_0xc207('0x26')][_0xc207('0x27')];_0x1e1440[_0xc207('0x28')]=_[_0xc207('0x29')](_0x4cb3af);var _0x6a653d={'dateStart':_0x138970['query'][_0xc207('0x2a')],'dateEnd':_0x138970[_0xc207('0x2b')][_0xc207('0x2c')]};delete _0x138970[_0xc207('0x2b')][_0xc207('0x2a')];delete _0x138970[_0xc207('0x2b')][_0xc207('0x2c')];_0x1e1440[_0xc207('0x2b')]=_[_0xc207('0x29')](_0x138970[_0xc207('0x2b')]);_0x1e1440[_0xc207('0x2d')]=_[_0xc207('0x2e')](_0x1e1440[_0xc207('0x28')],_0x1e1440['query']);_0x56a066[_0xc207('0x2f')]=_[_0xc207('0x2e')](_0x1e1440[_0xc207('0x28')],qs[_0xc207('0x30')](_0x138970[_0xc207('0x2b')][_0xc207('0x30')]));_0x56a066['attributes']=_0x56a066[_0xc207('0x2f')][_0xc207('0x31')]?_0x56a066[_0xc207('0x2f')]:_0x1e1440[_0xc207('0x28')];if(!_0x138970['query'][_0xc207('0x32')](_0xc207('0x33'))){_0x56a066[_0xc207('0x18')]=qs[_0xc207('0x18')](_0x138970[_0xc207('0x2b')][_0xc207('0x18')]);_0x56a066[_0xc207('0x17')]=qs[_0xc207('0x17')](_0x138970[_0xc207('0x2b')]['offset']);}_0x56a066['order']=qs[_0xc207('0x34')](_0x138970[_0xc207('0x2b')][_0xc207('0x34')]);_0x56a066[_0xc207('0x35')]=qs['filters'](_[_0xc207('0x36')](_0x138970[_0xc207('0x2b')],_0x1e1440[_0xc207('0x2d')]));if(_0x6a653d[_0xc207('0x2a')]){if(_0x6a653d[_0xc207('0x2c')]){_0x6a653d['dateEnd']=moment(_0x6a653d[_0xc207('0x2c')])[_0xc207('0x37')](0x1,'day');}else{_0x6a653d[_0xc207('0x2c')]=moment(_0x6a653d['dateStart'])[_0xc207('0x37')](0x1,_0xc207('0x38'));}_['merge'](_0x56a066[_0xc207('0x35')],{'createdAt':{'$gte':_0x6a653d[_0xc207('0x2a')],'$lte':_0x6a653d[_0xc207('0x2c')]}});}if(_0x138970['query']['filter']){_0x56a066[_0xc207('0x35')]=_[_0xc207('0x39')](_0x56a066[_0xc207('0x35')],{'$or':_[_0xc207('0x3a')](_0x56a066['attributes'],function(_0x3a6f45){var _0x47cdc4={};_0x47cdc4[_0x3a6f45]={'$like':'%'+_0x138970['query']['filter']+'%'};return _0x47cdc4;})});}_0x56a066=_['merge']({},_0x56a066,_0x138970[_0xc207('0x3b')]);var _0x370d0d={'where':_0x56a066[_0xc207('0x35')]};return db['OpenchannelQueueReport'][_0xc207('0x3c')](_0x370d0d)[_0xc207('0x1e')](function(_0x3e7cd9){_0x5e0bd1[_0xc207('0x3c')]=_0x3e7cd9;if(_0x138970['query'][_0xc207('0x3d')]){_0x56a066[_0xc207('0x3e')]=[{'all':!![]}];}return db[_0xc207('0x26')][_0xc207('0x3f')](_0x56a066);})[_0xc207('0x1e')](function(_0x58537e){_0x5e0bd1[_0xc207('0x40')]=_0x58537e;return _0x5e0bd1;})[_0xc207('0x1e')](respondWithFilteredResult(_0x1445d3,_0x56a066))[_0xc207('0x41')](handleError(_0x1445d3,null));};exports[_0xc207('0x42')]=function(_0x153490,_0x477c22){var _0xf74703={'raw':!![],'where':{'id':_0x153490[_0xc207('0x43')]['id']}},_0x49930c={};_0x49930c['model']=_[_0xc207('0x29')](db[_0xc207('0x26')]['rawAttributes']);_0x49930c[_0xc207('0x2b')]=_[_0xc207('0x29')](_0x153490[_0xc207('0x2b')]);_0x49930c[_0xc207('0x2d')]=_[_0xc207('0x2e')](_0x49930c['model'],_0x49930c[_0xc207('0x2b')]);_0xf74703[_0xc207('0x2f')]=_[_0xc207('0x2e')](_0x49930c['model'],qs[_0xc207('0x30')](_0x153490[_0xc207('0x2b')][_0xc207('0x30')]));_0xf74703[_0xc207('0x2f')]=_0xf74703['attributes']['length']?_0xf74703[_0xc207('0x2f')]:_0x49930c[_0xc207('0x28')];if(_0x153490[_0xc207('0x2b')][_0xc207('0x3d')]){_0xf74703[_0xc207('0x3e')]=[{'all':!![]}];}_0xf74703=_[_0xc207('0x39')]({},_0xf74703,_0x153490[_0xc207('0x3b')]);return db[_0xc207('0x26')][_0xc207('0x44')](_0xf74703)[_0xc207('0x1e')](handleEntityNotFound(_0x477c22,null))[_0xc207('0x1e')](respondWithResult(_0x477c22,null))[_0xc207('0x41')](handleError(_0x477c22,null));};exports['create']=function(_0x5e365d,_0x40d085){return db[_0xc207('0x26')][_0xc207('0x45')](_0x5e365d['body'],{})[_0xc207('0x1e')](respondWithResult(_0x40d085,0xc9))[_0xc207('0x41')](handleError(_0x40d085,null));};exports[_0xc207('0x1d')]=function(_0x5ef567,_0x4f5d1f){if(_0x5ef567[_0xc207('0x46')]['id']){delete _0x5ef567['body']['id'];}return db[_0xc207('0x26')]['find']({'where':{'id':_0x5ef567['params']['id']}})[_0xc207('0x1e')](handleEntityNotFound(_0x4f5d1f,null))[_0xc207('0x1e')](saveUpdates(_0x5ef567['body'],null))['then'](respondWithResult(_0x4f5d1f,null))['catch'](handleError(_0x4f5d1f,null));};exports[_0xc207('0x1f')]=function(_0x462958,_0x1b887c){return db[_0xc207('0x26')][_0xc207('0x44')]({'where':{'id':_0x462958[_0xc207('0x43')]['id']}})[_0xc207('0x1e')](handleEntityNotFound(_0x1b887c,null))[_0xc207('0x1e')](removeEntity(_0x1b887c,null))['catch'](handleError(_0x1b887c,null));};exports[_0xc207('0x47')]=function(_0x1435a9,_0x5aedd3){return db['OpenchannelQueueReport'][_0xc207('0x47')]()['then'](respondWithResult(_0x5aedd3,null))['catch'](handleError(_0x5aedd3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 5a02229..5450b69 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 _0x5458=['uniqueid','lodash','util','../../config/logger','api','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue'];(function(_0x7ace87,_0x1a56ef){var _0x50ca9f=function(_0x582e4d){while(--_0x582e4d){_0x7ace87['push'](_0x7ace87['shift']());}};_0x50ca9f(++_0x1a56ef);}(_0x5458,0x1d7));var _0x8545=function(_0x4b85cf,_0x2cbaf4){_0x4b85cf=_0x4b85cf-0x0;var _0x19b7f1=_0x5458[_0x4b85cf];return _0x19b7f1;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var logger=require(_0x8545('0x2'))(_0x8545('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x8545('0x4'));module[_0x8545('0x5')]=function(_0x3e5b3c,_0x22e94c){return _0x3e5b3c[_0x8545('0x6')](_0x8545('0x7'),attributes,{'tableName':_0x8545('0x8'),'paranoid':![],'indexes':[{'name':_0x8545('0x9'),'fields':[_0x8545('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff2a=['OpenchannelQueueReport','report_openchannel_queue','uniqueid','util','../../config/logger','moment','bluebird','./openchannelQueueReport.attributes'];(function(_0x15a709,_0x225202){var _0x49b816=function(_0x1aa542){while(--_0x1aa542){_0x15a709['push'](_0x15a709['shift']());}};_0x49b816(++_0x225202);}(_0xff2a,0x93));var _0xaff2=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xff2a[_0x213518];return _0x1baf75;};'use strict';var _=require('lodash');var util=require(_0xaff2('0x0'));var logger=require(_0xaff2('0x1'))('api');var moment=require(_0xaff2('0x2'));var BPromise=require(_0xaff2('0x3'));var rp=require('request-promise');var attributes=require(_0xaff2('0x4'));module['exports']=function(_0x1cf624,_0x300723){return _0x1cf624['define'](_0xaff2('0x5'),attributes,{'tableName':_0xaff2('0x6'),'paranoid':![],'indexes':[{'name':_0xaff2('0x7'),'fields':[_0xaff2('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 4f54b4e..068dea4 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 _0xaa09=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update','body','raw','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0xaa09,0x132));var _0x9aa0=function(_0x454974,_0x522572){_0x454974=_0x454974-0x0;var _0x4601a7=_0xaa09[_0x454974];return _0x4601a7;};'use strict';var _=require(_0x9aa0('0x0'));var util=require('util');var moment=require(_0x9aa0('0x1'));var BPromise=require(_0x9aa0('0x2'));var rs=require(_0x9aa0('0x3'));var fs=require('fs');var Redis=require(_0x9aa0('0x4'));var db=require(_0x9aa0('0x5'))['db'];var utils=require(_0x9aa0('0x6'));var logger=require(_0x9aa0('0x7'))(_0x9aa0('0x8'));var config=require(_0x9aa0('0x9'));var jayson=require(_0x9aa0('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12416f,_0x16e8ba,_0x3f2617){return new BPromise(function(_0x25b457,_0x2566a1){return client[_0x9aa0('0xb')](_0x12416f,_0x3f2617)[_0x9aa0('0xc')](function(_0x539418){logger[_0x9aa0('0xd')](_0x9aa0('0xe'),_0x16e8ba,_0x9aa0('0xf'));logger[_0x9aa0('0x10')](_0x9aa0('0x11'),_0x16e8ba,_0x9aa0('0xf'),JSON[_0x9aa0('0x12')](_0x539418));if(_0x539418[_0x9aa0('0x13')]){if(_0x539418[_0x9aa0('0x13')]['code']===0x1f4){logger[_0x9aa0('0x13')](_0x9aa0('0xe'),_0x16e8ba,_0x539418[_0x9aa0('0x13')][_0x9aa0('0x14')]);return _0x2566a1(_0x539418[_0x9aa0('0x13')][_0x9aa0('0x14')]);}logger[_0x9aa0('0x13')](_0x9aa0('0xe'),_0x16e8ba,_0x539418[_0x9aa0('0x13')][_0x9aa0('0x14')]);return _0x25b457(_0x539418[_0x9aa0('0x13')][_0x9aa0('0x14')]);}else{logger[_0x9aa0('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x16e8ba,'request\x20sent');_0x25b457(_0x539418[_0x9aa0('0x15')]['message']);}})[_0x9aa0('0x16')](function(_0x35ecce){logger[_0x9aa0('0x13')](_0x9aa0('0xe'),_0x16e8ba,_0x35ecce);_0x2566a1(_0x35ecce);});});}exports[_0x9aa0('0x17')]=function(_0x51ed07){var _0x245926=this;return new Promise(function(_0x55298b,_0x5a0fe1){return db[_0x9aa0('0x18')][_0x9aa0('0x19')](_0x51ed07['body'],{'raw':_0x51ed07[_0x9aa0('0x1a')]?_0x51ed07['options']['raw']===undefined?!![]:![]:!![]})[_0x9aa0('0xc')](function(_0x2ab6b8){logger[_0x9aa0('0xd')](_0x9aa0('0x17'),_0x51ed07);logger[_0x9aa0('0x10')](_0x9aa0('0x17'),_0x51ed07,JSON[_0x9aa0('0x12')](_0x2ab6b8));_0x55298b(_0x2ab6b8);})['catch'](function(_0x5a2fcd){logger[_0x9aa0('0x13')](_0x9aa0('0x17'),_0x5a2fcd[_0x9aa0('0x14')],_0x51ed07);_0x5a0fe1(_0x245926[_0x9aa0('0x13')](0x1f4,_0x5a2fcd[_0x9aa0('0x14')]));});});};exports[_0x9aa0('0x1b')]=function(_0x436514){var _0x20fe83=this;return new Promise(function(_0x3e2eff,_0x1177e4){return db[_0x9aa0('0x18')][_0x9aa0('0x1c')](_0x436514[_0x9aa0('0x1d')],{'raw':_0x436514[_0x9aa0('0x1a')]?_0x436514['options'][_0x9aa0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x436514[_0x9aa0('0x1a')]?_0x436514[_0x9aa0('0x1a')]['where']||null:null,'attributes':_0x436514[_0x9aa0('0x1a')]?_0x436514[_0x9aa0('0x1a')]['attributes']||null:null,'limit':_0x436514[_0x9aa0('0x1a')]?_0x436514[_0x9aa0('0x1a')][_0x9aa0('0x1f')]||null:null})[_0x9aa0('0xc')](function(_0x2a0e43){logger[_0x9aa0('0xd')](_0x9aa0('0x1b'),_0x436514);logger[_0x9aa0('0x10')](_0x9aa0('0x1b'),_0x436514,JSON[_0x9aa0('0x12')](_0x2a0e43));_0x3e2eff(_0x2a0e43);})[_0x9aa0('0x16')](function(_0x3a00ea){logger[_0x9aa0('0x13')](_0x9aa0('0x1b'),_0x3a00ea[_0x9aa0('0x14')],_0x436514);_0x1177e4(_0x20fe83[_0x9aa0('0x13')](0x1f4,_0x3a00ea[_0x9aa0('0x14')]));});});}; \ No newline at end of file +var _0x246c=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','create','body','options','raw','debug','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x246c,0x1e9));var _0xc246=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x246c[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xc246('0x0'));var util=require(_0xc246('0x1'));var moment=require(_0xc246('0x2'));var BPromise=require(_0xc246('0x3'));var rs=require(_0xc246('0x4'));var fs=require('fs');var Redis=require(_0xc246('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc246('0x6'))(_0xc246('0x7'));var config=require('../../config/environment');var jayson=require(_0xc246('0x8'));var client=jayson[_0xc246('0x9')][_0xc246('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2717,_0x5f4b2b,_0x322512){return new BPromise(function(_0x10e4e0,_0x596959){return client[_0xc246('0xb')](_0x3a2717,_0x322512)[_0xc246('0xc')](function(_0x7181ad){logger[_0xc246('0xd')](_0xc246('0xe'),_0x5f4b2b,_0xc246('0xf'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5f4b2b,_0xc246('0xf'),JSON[_0xc246('0x10')](_0x7181ad));if(_0x7181ad[_0xc246('0x11')]){if(_0x7181ad['error']['code']===0x1f4){logger['error'](_0xc246('0xe'),_0x5f4b2b,_0x7181ad[_0xc246('0x11')][_0xc246('0x12')]);return _0x596959(_0x7181ad[_0xc246('0x11')][_0xc246('0x12')]);}logger[_0xc246('0x11')](_0xc246('0xe'),_0x5f4b2b,_0x7181ad[_0xc246('0x11')]['message']);return _0x10e4e0(_0x7181ad['error']['message']);}else{logger['info'](_0xc246('0xe'),_0x5f4b2b,_0xc246('0xf'));_0x10e4e0(_0x7181ad[_0xc246('0x13')][_0xc246('0x12')]);}})[_0xc246('0x14')](function(_0x2c59e5){logger[_0xc246('0x11')](_0xc246('0xe'),_0x5f4b2b,_0x2c59e5);_0x596959(_0x2c59e5);});});}exports['CreateOpenchannelQueueReport']=function(_0x522ba8){var _0x2aa021=this;return new Promise(function(_0xfbcb2b,_0x275177){return db['OpenchannelQueueReport'][_0xc246('0x15')](_0x522ba8[_0xc246('0x16')],{'raw':_0x522ba8[_0xc246('0x17')]?_0x522ba8[_0xc246('0x17')][_0xc246('0x18')]===undefined?!![]:![]:!![]})[_0xc246('0xc')](function(_0xc98a87){logger[_0xc246('0xd')]('CreateOpenchannelQueueReport',_0x522ba8);logger[_0xc246('0x19')](_0xc246('0x1a'),_0x522ba8,JSON[_0xc246('0x10')](_0xc98a87));_0xfbcb2b(_0xc98a87);})[_0xc246('0x14')](function(_0x2e0d1d){logger[_0xc246('0x11')](_0xc246('0x1a'),_0x2e0d1d[_0xc246('0x12')],_0x522ba8);_0x275177(_0x2aa021[_0xc246('0x11')](0x1f4,_0x2e0d1d[_0xc246('0x12')]));});});};exports[_0xc246('0x1b')]=function(_0x4ef815){var _0x2a47ea=this;return new Promise(function(_0x479173,_0x58d57b){return db[_0xc246('0x1c')][_0xc246('0x1d')](_0x4ef815[_0xc246('0x16')],{'raw':_0x4ef815[_0xc246('0x17')]?_0x4ef815[_0xc246('0x17')][_0xc246('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ef815[_0xc246('0x17')]?_0x4ef815[_0xc246('0x17')][_0xc246('0x1e')]||null:null,'attributes':_0x4ef815['options']?_0x4ef815['options'][_0xc246('0x1f')]||null:null,'limit':_0x4ef815[_0xc246('0x17')]?_0x4ef815[_0xc246('0x17')][_0xc246('0x20')]||null:null})[_0xc246('0xc')](function(_0x468b03){logger['info'](_0xc246('0x1b'),_0x4ef815);logger[_0xc246('0x19')](_0xc246('0x1b'),_0x4ef815,JSON[_0xc246('0x10')](_0x468b03));_0x479173(_0x468b03);})[_0xc246('0x14')](function(_0x19d813){logger[_0xc246('0x11')](_0xc246('0x1b'),_0x19d813[_0xc246('0x12')],_0x4ef815);_0x58d57b(_0x2a47ea['error'](0x1f4,_0x19d813['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index aa57fa7..26144f5 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 _0x2c36=['Router','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x503091,_0x3ded2b){var _0x3bf144=function(_0x3c0e99){while(--_0x3c0e99){_0x503091['push'](_0x503091['shift']());}};_0x3bf144(++_0x3ded2b);}(_0x2c36,0x182));var _0x62c3=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x2c36[_0xf34109];return _0x570bfc;};'use strict';var multer=require(_0x62c3('0x0'));var util=require(_0x62c3('0x1'));var path=require(_0x62c3('0x2'));var timeout=require(_0x62c3('0x3'));var express=require(_0x62c3('0x4'));var router=express[_0x62c3('0x5')]();var auth=require(_0x62c3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x62c3('0x7'));var controller=require(_0x62c3('0x8'));router['get']('/',auth[_0x62c3('0x9')](),controller[_0x62c3('0xa')]);router[_0x62c3('0xb')](_0x62c3('0xc'),auth[_0x62c3('0x9')](),controller[_0x62c3('0xd')]);router[_0x62c3('0xb')](_0x62c3('0xe'),auth['isAuthenticated'](),controller[_0x62c3('0xf')]);router[_0x62c3('0x10')]('/',auth[_0x62c3('0x9')](),controller[_0x62c3('0x11')]);router[_0x62c3('0x12')]('/:id',auth[_0x62c3('0x9')](),controller[_0x62c3('0x13')]);router[_0x62c3('0x14')](_0x62c3('0xe'),auth[_0x62c3('0x9')](),controller[_0x62c3('0x15')]);module[_0x62c3('0x16')]=router; \ No newline at end of file +var _0x9c19=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','/:id','show','post','create','put','update'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x9c19,0x1de));var _0x99c1=function(_0x4e2111,_0x1d5493){_0x4e2111=_0x4e2111-0x0;var _0x1b4556=_0x9c19[_0x4e2111];return _0x1b4556;};'use strict';var multer=require(_0x99c1('0x0'));var util=require(_0x99c1('0x1'));var path=require(_0x99c1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99c1('0x3'));var router=express[_0x99c1('0x4')]();var auth=require(_0x99c1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x99c1('0x6'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0x99c1('0x7')](),controller['index']);router[_0x99c1('0x8')](_0x99c1('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x99c1('0x8')](_0x99c1('0xa'),auth[_0x99c1('0x7')](),controller[_0x99c1('0xb')]);router[_0x99c1('0xc')]('/',auth[_0x99c1('0x7')](),controller[_0x99c1('0xd')]);router[_0x99c1('0xe')]('/:id',auth[_0x99c1('0x7')](),controller[_0x99c1('0xf')]);router[_0x99c1('0x10')](_0x99c1('0xa'),auth[_0x99c1('0x7')](),controller[_0x99c1('0x11')]);module[_0x99c1('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index e857c88..4707618 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 _0xfdbb=['DATE','NOW','moment','sequelize','exports','STRING','queue'];(function(_0xee509e,_0x31c16f){var _0x41a351=function(_0x294884){while(--_0x294884){_0xee509e['push'](_0xee509e['shift']());}};_0x41a351(++_0x31c16f);}(_0xfdbb,0x1f3));var _0xbfdb=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xfdbb[_0x1793de];return _0x4f0309;};'use strict';var moment=require(_0xbfdb('0x0'));var Sequelize=require(_0xbfdb('0x1'));module[_0xbfdb('0x2')]={'uniqueid':{'type':Sequelize[_0xbfdb('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xbfdb('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xbfdb('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xbfdb('0x6')]}}; \ No newline at end of file +var _0x3111=['DATE','moment','sequelize','account','agent','queue'];(function(_0x3cf4f7,_0xdf5767){var _0x337005=function(_0x1601ec){while(--_0x1601ec){_0x3cf4f7['push'](_0x3cf4f7['shift']());}};_0x337005(++_0xdf5767);}(_0x3111,0x18d));var _0x1311=function(_0x396408,_0x473f99){_0x396408=_0x396408-0x0;var _0x1a660e=_0x3111[_0x396408];return _0x1a660e;};'use strict';var moment=require(_0x1311('0x0'));var Sequelize=require(_0x1311('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1311('0x2'),_0x1311('0x3'),_0x1311('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x1311('0x5')],'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 9528044..a451998 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 _0xa271=['dateStart','query','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','options','count','includeAll','include','rows','catch','show','params','OpenchannelTransferReport','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','rawAttributes','model'];(function(_0x38b27a,_0x5430d9){var _0x16d484=function(_0x438036){while(--_0x438036){_0x38b27a['push'](_0x38b27a['shift']());}};_0x16d484(++_0x5430d9);}(_0xa271,0xe8));var _0x1a27=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xa271[_0x5caf7e];return _0x5c3435;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1a27('0x0'));var rimraf=require(_0x1a27('0x1'));var zipdir=require(_0x1a27('0x2'));var jsonpatch=require(_0x1a27('0x3'));var rp=require(_0x1a27('0x4'));var moment=require('moment');var BPromise=require(_0x1a27('0x5'));var Mustache=require('mustache');var util=require(_0x1a27('0x6'));var path=require('path');var sox=require(_0x1a27('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1a27('0x8'));var squel=require('squel');var crypto=require(_0x1a27('0x9'));var jsforce=require(_0x1a27('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1a27('0xb'));var querystring=require(_0x1a27('0xc'));var Papa=require(_0x1a27('0xd'));var Redis=require(_0x1a27('0xe'));var qs=require(_0x1a27('0xf'));var logger=require(_0x1a27('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x1a27('0x11'));var db=require(_0x1a27('0x12'))['db'];function respondWithStatusCode(_0x5dcbba,_0x1ae297){_0x1ae297=_0x1ae297||0xcc;return function(_0x362e40){if(_0x362e40){return _0x5dcbba[_0x1a27('0x13')](_0x1ae297);}return _0x5dcbba['status'](_0x1ae297)[_0x1a27('0x14')]();};}function respondWithResult(_0x1238bd,_0x4eca83){_0x4eca83=_0x4eca83||0xc8;return function(_0x27c8ce){if(_0x27c8ce){return _0x1238bd[_0x1a27('0x15')](_0x4eca83)[_0x1a27('0x16')](_0x27c8ce);}};}function respondWithFilteredResult(_0x4e2093,_0x504570){return function(_0x436685){if(_0x436685){var _0x108ed1=_0x436685['count'],_0x3df1a9=_0x504570[_0x1a27('0x17')],_0x151eb2=_0x504570[_0x1a27('0x17')]+_0x504570[_0x1a27('0x18')],_0x5bcaed;if(_0x151eb2>=_0x108ed1){_0x151eb2=_0x108ed1;_0x5bcaed=0xc8;}else{_0x5bcaed=0xce;}_0x4e2093[_0x1a27('0x15')](_0x5bcaed);return _0x4e2093[_0x1a27('0x19')](_0x1a27('0x1a'),_0x3df1a9+'-'+_0x151eb2+'/'+_0x108ed1)['json'](_0x436685);}return null;};}function patchUpdates(_0x5f4a80){return function(_0x73aecd){try{jsonpatch['apply'](_0x73aecd,_0x5f4a80,!![]);}catch(_0x56b530){return BPromise[_0x1a27('0x1b')](_0x56b530);}return _0x73aecd[_0x1a27('0x1c')]();};}function saveUpdates(_0x459682,_0x1a83af){return function(_0x399007){if(_0x399007){return _0x399007[_0x1a27('0x1d')](_0x459682)['then'](function(_0x28d8d8){return _0x28d8d8;});}return null;};}function removeEntity(_0x3d7f23,_0x352b66){return function(_0x2d0781){if(_0x2d0781){return _0x2d0781[_0x1a27('0x1e')]()[_0x1a27('0x1f')](function(){_0x3d7f23[_0x1a27('0x15')](0xcc)[_0x1a27('0x14')]();});}};}function handleEntityNotFound(_0x43f391,_0x325e7a){return function(_0x2a1c62){if(!_0x2a1c62){_0x43f391[_0x1a27('0x13')](0x194);}return _0x2a1c62;};}function handleError(_0x208464,_0x2652f5){_0x2652f5=_0x2652f5||0x1f4;return function(_0x928aaa){logger[_0x1a27('0x20')](_0x928aaa[_0x1a27('0x21')]);if(_0x928aaa['name']){delete _0x928aaa['name'];}_0x208464[_0x1a27('0x15')](_0x2652f5)['send'](_0x928aaa);};}exports['index']=function(_0x23dcc5,_0x175ec2){var _0x91a5eb={},_0x51d5ce={},_0x255175={'count':0x0,'rows':[]};var _0x1fa9ee=db['OpenchannelTransferReport'][_0x1a27('0x22')];_0x51d5ce[_0x1a27('0x23')]=_['keys'](_0x1fa9ee);var _0x53b194={'dateStart':_0x23dcc5['query'][_0x1a27('0x24')],'dateEnd':_0x23dcc5[_0x1a27('0x25')][_0x1a27('0x26')]};delete _0x23dcc5[_0x1a27('0x25')][_0x1a27('0x24')];delete _0x23dcc5['query']['dateEnd'];_0x51d5ce[_0x1a27('0x25')]=_[_0x1a27('0x27')](_0x23dcc5[_0x1a27('0x25')]);_0x51d5ce[_0x1a27('0x28')]=_[_0x1a27('0x29')](_0x51d5ce[_0x1a27('0x23')],_0x51d5ce['query']);_0x91a5eb[_0x1a27('0x2a')]=_[_0x1a27('0x29')](_0x51d5ce[_0x1a27('0x23')],qs[_0x1a27('0x2b')](_0x23dcc5['query'][_0x1a27('0x2b')]));_0x91a5eb[_0x1a27('0x2a')]=_0x91a5eb[_0x1a27('0x2a')][_0x1a27('0x2c')]?_0x91a5eb[_0x1a27('0x2a')]:_0x51d5ce[_0x1a27('0x23')];if(!_0x23dcc5[_0x1a27('0x25')][_0x1a27('0x2d')]('nolimit')){_0x91a5eb[_0x1a27('0x18')]=qs[_0x1a27('0x18')](_0x23dcc5[_0x1a27('0x25')][_0x1a27('0x18')]);_0x91a5eb[_0x1a27('0x17')]=qs[_0x1a27('0x17')](_0x23dcc5[_0x1a27('0x25')]['offset']);}_0x91a5eb[_0x1a27('0x2e')]=qs['sort'](_0x23dcc5[_0x1a27('0x25')][_0x1a27('0x2f')]);_0x91a5eb[_0x1a27('0x30')]=qs[_0x1a27('0x28')](_[_0x1a27('0x31')](_0x23dcc5[_0x1a27('0x25')],_0x51d5ce[_0x1a27('0x28')]));if(_0x53b194['dateStart']){if(_0x53b194[_0x1a27('0x26')]){_0x53b194[_0x1a27('0x26')]=moment(_0x53b194[_0x1a27('0x26')])[_0x1a27('0x32')](0x1,_0x1a27('0x33'));}else{_0x53b194[_0x1a27('0x26')]=moment(_0x53b194[_0x1a27('0x24')])[_0x1a27('0x32')](0x1,'day');}_[_0x1a27('0x34')](_0x91a5eb[_0x1a27('0x30')],{'createdAt':{'$gte':_0x53b194[_0x1a27('0x24')],'$lte':_0x53b194[_0x1a27('0x26')]}});}if(_0x23dcc5['query'][_0x1a27('0x35')]){_0x91a5eb[_0x1a27('0x30')]=_[_0x1a27('0x34')](_0x91a5eb[_0x1a27('0x30')],{'$or':_['map'](_0x91a5eb[_0x1a27('0x2a')],function(_0x3bba11){var _0x186a2f={};_0x186a2f[_0x3bba11]={'$like':'%'+_0x23dcc5[_0x1a27('0x25')][_0x1a27('0x35')]+'%'};return _0x186a2f;})});}_0x91a5eb=_[_0x1a27('0x34')]({},_0x91a5eb,_0x23dcc5[_0x1a27('0x36')]);var _0x2f0042={'where':_0x91a5eb['where']};return db['OpenchannelTransferReport'][_0x1a27('0x37')](_0x2f0042)['then'](function(_0x2e98e9){_0x255175[_0x1a27('0x37')]=_0x2e98e9;if(_0x23dcc5[_0x1a27('0x25')][_0x1a27('0x38')]){_0x91a5eb[_0x1a27('0x39')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x91a5eb);})[_0x1a27('0x1f')](function(_0x2fcc15){_0x255175[_0x1a27('0x3a')]=_0x2fcc15;return _0x255175;})['then'](respondWithFilteredResult(_0x175ec2,_0x91a5eb))[_0x1a27('0x3b')](handleError(_0x175ec2,null));};exports[_0x1a27('0x3c')]=function(_0x13544f,_0x1aa7ad){var _0x2c0fa7={'raw':!![],'where':{'id':_0x13544f[_0x1a27('0x3d')]['id']}},_0x56602d={};_0x56602d['model']=_[_0x1a27('0x27')](db[_0x1a27('0x3e')]['rawAttributes']);_0x56602d[_0x1a27('0x25')]=_['keys'](_0x13544f[_0x1a27('0x25')]);_0x56602d[_0x1a27('0x28')]=_['intersection'](_0x56602d[_0x1a27('0x23')],_0x56602d[_0x1a27('0x25')]);_0x2c0fa7[_0x1a27('0x2a')]=_[_0x1a27('0x29')](_0x56602d[_0x1a27('0x23')],qs[_0x1a27('0x2b')](_0x13544f['query'][_0x1a27('0x2b')]));_0x2c0fa7[_0x1a27('0x2a')]=_0x2c0fa7[_0x1a27('0x2a')][_0x1a27('0x2c')]?_0x2c0fa7[_0x1a27('0x2a')]:_0x56602d[_0x1a27('0x23')];if(_0x13544f[_0x1a27('0x25')][_0x1a27('0x38')]){_0x2c0fa7[_0x1a27('0x39')]=[{'all':!![]}];}_0x2c0fa7=_[_0x1a27('0x34')]({},_0x2c0fa7,_0x13544f['options']);return db[_0x1a27('0x3e')][_0x1a27('0x3f')](_0x2c0fa7)[_0x1a27('0x1f')](handleEntityNotFound(_0x1aa7ad,null))[_0x1a27('0x1f')](respondWithResult(_0x1aa7ad,null))[_0x1a27('0x3b')](handleError(_0x1aa7ad,null));};exports['create']=function(_0x3971a1,_0x1246d9){return db['OpenchannelTransferReport'][_0x1a27('0x40')](_0x3971a1['body'],{})[_0x1a27('0x1f')](respondWithResult(_0x1246d9,0xc9))[_0x1a27('0x3b')](handleError(_0x1246d9,null));};exports['update']=function(_0x5da412,_0x9f5e52){if(_0x5da412[_0x1a27('0x41')]['id']){delete _0x5da412[_0x1a27('0x41')]['id'];}return db[_0x1a27('0x3e')][_0x1a27('0x3f')]({'where':{'id':_0x5da412['params']['id']}})[_0x1a27('0x1f')](handleEntityNotFound(_0x9f5e52,null))[_0x1a27('0x1f')](saveUpdates(_0x5da412[_0x1a27('0x41')],null))[_0x1a27('0x1f')](respondWithResult(_0x9f5e52,null))[_0x1a27('0x3b')](handleError(_0x9f5e52,null));};exports[_0x1a27('0x1e')]=function(_0x11590d,_0x2e42be){return db['OpenchannelTransferReport'][_0x1a27('0x3f')]({'where':{'id':_0x11590d['params']['id']}})[_0x1a27('0x1f')](handleEntityNotFound(_0x2e42be,null))[_0x1a27('0x1f')](removeEntity(_0x2e42be,null))[_0x1a27('0x3b')](handleError(_0x2e42be,null));};exports[_0x1a27('0x42')]=function(_0x39bb4b,_0x2ed31c){return db[_0x1a27('0x3e')][_0x1a27('0x42')]()[_0x1a27('0x1f')](respondWithResult(_0x2ed31c,null))['catch'](handleError(_0x2ed31c,null));}; \ No newline at end of file +var _0xb93e=['includeAll','include','findAll','then','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/logger','../../config/environment','status','end','count','offset','limit','json','apply','reject','save','update','destroy','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','dateStart','dateEnd','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','options'];(function(_0x1b9d15,_0x1a1f4d){var _0x2473de=function(_0x2e1eb9){while(--_0x2e1eb9){_0x1b9d15['push'](_0x1b9d15['shift']());}};_0x2473de(++_0x1a1f4d);}(_0xb93e,0x1a4));var _0xeb93=function(_0x2e3d01,_0x44cfa6){_0x2e3d01=_0x2e3d01-0x0;var _0x3cd3c0=_0xb93e[_0x2e3d01];return _0x3cd3c0;};'use strict';var pdf=require(_0xeb93('0x0'));var emlformat=require(_0xeb93('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb93('0x2'));var moment=require(_0xeb93('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xeb93('0x4'));var util=require(_0xeb93('0x5'));var path=require('path');var sox=require(_0xeb93('0x6'));var csv=require(_0xeb93('0x7'));var ejs=require(_0xeb93('0x8'));var fs=require('fs');var _=require(_0xeb93('0x9'));var squel=require(_0xeb93('0xa'));var crypto=require(_0xeb93('0xb'));var jsforce=require(_0xeb93('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeb93('0x7'));var querystring=require(_0xeb93('0xd'));var Papa=require(_0xeb93('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xeb93('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xeb93('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bb94d,_0x489f5f){_0x489f5f=_0x489f5f||0xcc;return function(_0x7af3c0){if(_0x7af3c0){return _0x4bb94d['sendStatus'](_0x489f5f);}return _0x4bb94d[_0xeb93('0x11')](_0x489f5f)[_0xeb93('0x12')]();};}function respondWithResult(_0x5796f0,_0xe89ba5){_0xe89ba5=_0xe89ba5||0xc8;return function(_0x58d2b5){if(_0x58d2b5){return _0x5796f0[_0xeb93('0x11')](_0xe89ba5)['json'](_0x58d2b5);}};}function respondWithFilteredResult(_0x215722,_0x10813a){return function(_0x5bdd01){if(_0x5bdd01){var _0x2f4ff2=_0x5bdd01[_0xeb93('0x13')],_0x543d0d=_0x10813a['offset'],_0x463c28=_0x10813a[_0xeb93('0x14')]+_0x10813a[_0xeb93('0x15')],_0x51326b;if(_0x463c28>=_0x2f4ff2){_0x463c28=_0x2f4ff2;_0x51326b=0xc8;}else{_0x51326b=0xce;}_0x215722[_0xeb93('0x11')](_0x51326b);return _0x215722['set']('Content-Range',_0x543d0d+'-'+_0x463c28+'/'+_0x2f4ff2)[_0xeb93('0x16')](_0x5bdd01);}return null;};}function patchUpdates(_0x5dbde9){return function(_0x362a1f){try{jsonpatch[_0xeb93('0x17')](_0x362a1f,_0x5dbde9,!![]);}catch(_0x4b5a27){return BPromise[_0xeb93('0x18')](_0x4b5a27);}return _0x362a1f[_0xeb93('0x19')]();};}function saveUpdates(_0x888adf,_0x261323){return function(_0x2e4be2){if(_0x2e4be2){return _0x2e4be2[_0xeb93('0x1a')](_0x888adf)['then'](function(_0x48b86e){return _0x48b86e;});}return null;};}function removeEntity(_0x4646d0,_0x23e211){return function(_0x51cb85){if(_0x51cb85){return _0x51cb85[_0xeb93('0x1b')]()['then'](function(){_0x4646d0['status'](0xcc)[_0xeb93('0x12')]();});}};}function handleEntityNotFound(_0x482bec,_0x501250){return function(_0x5e09b7){if(!_0x5e09b7){_0x482bec['sendStatus'](0x194);}return _0x5e09b7;};}function handleError(_0x491db8,_0x3d4534){_0x3d4534=_0x3d4534||0x1f4;return function(_0xad9652){logger[_0xeb93('0x1c')](_0xad9652[_0xeb93('0x1d')]);if(_0xad9652['name']){delete _0xad9652[_0xeb93('0x1e')];}_0x491db8[_0xeb93('0x11')](_0x3d4534)[_0xeb93('0x1f')](_0xad9652);};}exports[_0xeb93('0x20')]=function(_0x202249,_0x22e792){var _0x40e327={},_0x898f4c={},_0x29e7f2={'count':0x0,'rows':[]};var _0x546815=db[_0xeb93('0x21')][_0xeb93('0x22')];_0x898f4c['model']=_['keys'](_0x546815);var _0x134a7b={'dateStart':_0x202249['query'][_0xeb93('0x23')],'dateEnd':_0x202249['query'][_0xeb93('0x24')]};delete _0x202249[_0xeb93('0x25')]['dateStart'];delete _0x202249['query']['dateEnd'];_0x898f4c['query']=_[_0xeb93('0x26')](_0x202249[_0xeb93('0x25')]);_0x898f4c[_0xeb93('0x27')]=_[_0xeb93('0x28')](_0x898f4c[_0xeb93('0x29')],_0x898f4c[_0xeb93('0x25')]);_0x40e327[_0xeb93('0x2a')]=_[_0xeb93('0x28')](_0x898f4c[_0xeb93('0x29')],qs[_0xeb93('0x2b')](_0x202249[_0xeb93('0x25')][_0xeb93('0x2b')]));_0x40e327[_0xeb93('0x2a')]=_0x40e327[_0xeb93('0x2a')][_0xeb93('0x2c')]?_0x40e327[_0xeb93('0x2a')]:_0x898f4c['model'];if(!_0x202249[_0xeb93('0x25')][_0xeb93('0x2d')](_0xeb93('0x2e'))){_0x40e327['limit']=qs[_0xeb93('0x15')](_0x202249[_0xeb93('0x25')]['limit']);_0x40e327[_0xeb93('0x14')]=qs[_0xeb93('0x14')](_0x202249['query'][_0xeb93('0x14')]);}_0x40e327[_0xeb93('0x2f')]=qs['sort'](_0x202249[_0xeb93('0x25')][_0xeb93('0x30')]);_0x40e327[_0xeb93('0x31')]=qs[_0xeb93('0x27')](_['pick'](_0x202249[_0xeb93('0x25')],_0x898f4c['filters']));if(_0x134a7b[_0xeb93('0x23')]){if(_0x134a7b[_0xeb93('0x24')]){_0x134a7b[_0xeb93('0x24')]=moment(_0x134a7b['dateEnd'])[_0xeb93('0x32')](0x1,_0xeb93('0x33'));}else{_0x134a7b[_0xeb93('0x24')]=moment(_0x134a7b[_0xeb93('0x23')])[_0xeb93('0x32')](0x1,'day');}_[_0xeb93('0x34')](_0x40e327[_0xeb93('0x31')],{'createdAt':{'$gte':_0x134a7b[_0xeb93('0x23')],'$lte':_0x134a7b['dateEnd']}});}if(_0x202249['query'][_0xeb93('0x35')]){_0x40e327['where']=_['merge'](_0x40e327[_0xeb93('0x31')],{'$or':_[_0xeb93('0x36')](_0x40e327[_0xeb93('0x2a')],function(_0x4851ea){var _0x7f8d08={};_0x7f8d08[_0x4851ea]={'$like':'%'+_0x202249[_0xeb93('0x25')][_0xeb93('0x35')]+'%'};return _0x7f8d08;})});}_0x40e327=_['merge']({},_0x40e327,_0x202249[_0xeb93('0x37')]);var _0x130b42={'where':_0x40e327[_0xeb93('0x31')]};return db[_0xeb93('0x21')]['count'](_0x130b42)['then'](function(_0x573bc1){_0x29e7f2[_0xeb93('0x13')]=_0x573bc1;if(_0x202249['query'][_0xeb93('0x38')]){_0x40e327[_0xeb93('0x39')]=[{'all':!![]}];}return db[_0xeb93('0x21')][_0xeb93('0x3a')](_0x40e327);})[_0xeb93('0x3b')](function(_0x13fa48){_0x29e7f2[_0xeb93('0x3c')]=_0x13fa48;return _0x29e7f2;})['then'](respondWithFilteredResult(_0x22e792,_0x40e327))[_0xeb93('0x3d')](handleError(_0x22e792,null));};exports[_0xeb93('0x3e')]=function(_0x5d6217,_0xafa702){var _0x4f343f={'raw':!![],'where':{'id':_0x5d6217[_0xeb93('0x3f')]['id']}},_0x336ec6={};_0x336ec6[_0xeb93('0x29')]=_[_0xeb93('0x26')](db[_0xeb93('0x21')][_0xeb93('0x22')]);_0x336ec6['query']=_[_0xeb93('0x26')](_0x5d6217[_0xeb93('0x25')]);_0x336ec6[_0xeb93('0x27')]=_[_0xeb93('0x28')](_0x336ec6[_0xeb93('0x29')],_0x336ec6[_0xeb93('0x25')]);_0x4f343f['attributes']=_[_0xeb93('0x28')](_0x336ec6[_0xeb93('0x29')],qs[_0xeb93('0x2b')](_0x5d6217[_0xeb93('0x25')][_0xeb93('0x2b')]));_0x4f343f[_0xeb93('0x2a')]=_0x4f343f[_0xeb93('0x2a')][_0xeb93('0x2c')]?_0x4f343f[_0xeb93('0x2a')]:_0x336ec6[_0xeb93('0x29')];if(_0x5d6217[_0xeb93('0x25')][_0xeb93('0x38')]){_0x4f343f[_0xeb93('0x39')]=[{'all':!![]}];}_0x4f343f=_['merge']({},_0x4f343f,_0x5d6217[_0xeb93('0x37')]);return db[_0xeb93('0x21')][_0xeb93('0x40')](_0x4f343f)[_0xeb93('0x3b')](handleEntityNotFound(_0xafa702,null))[_0xeb93('0x3b')](respondWithResult(_0xafa702,null))['catch'](handleError(_0xafa702,null));};exports[_0xeb93('0x41')]=function(_0x1e0bb1,_0x1dffbd){return db['OpenchannelTransferReport'][_0xeb93('0x41')](_0x1e0bb1[_0xeb93('0x42')],{})['then'](respondWithResult(_0x1dffbd,0xc9))[_0xeb93('0x3d')](handleError(_0x1dffbd,null));};exports['update']=function(_0x370869,_0x8150c4){if(_0x370869[_0xeb93('0x42')]['id']){delete _0x370869[_0xeb93('0x42')]['id'];}return db[_0xeb93('0x21')]['find']({'where':{'id':_0x370869[_0xeb93('0x3f')]['id']}})['then'](handleEntityNotFound(_0x8150c4,null))[_0xeb93('0x3b')](saveUpdates(_0x370869['body'],null))[_0xeb93('0x3b')](respondWithResult(_0x8150c4,null))['catch'](handleError(_0x8150c4,null));};exports[_0xeb93('0x1b')]=function(_0x1b5294,_0x545b1d){return db[_0xeb93('0x21')][_0xeb93('0x40')]({'where':{'id':_0x1b5294[_0xeb93('0x3f')]['id']}})[_0xeb93('0x3b')](handleEntityNotFound(_0x545b1d,null))[_0xeb93('0x3b')](removeEntity(_0x545b1d,null))[_0xeb93('0x3d')](handleError(_0x545b1d,null));};exports[_0xeb93('0x43')]=function(_0x110dd1,_0x31d3b6){return db[_0xeb93('0x21')][_0xeb93('0x43')]()['then'](respondWithResult(_0x31d3b6,null))['catch'](handleError(_0x31d3b6,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 3570e04..d43da52 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 _0x814b=['lodash','util','../../config/logger','api','moment','bluebird','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid'];(function(_0x595b9b,_0xa58ff){var _0x3be4c6=function(_0x324f94){while(--_0x324f94){_0x595b9b['push'](_0x595b9b['shift']());}};_0x3be4c6(++_0xa58ff);}(_0x814b,0x1a2));var _0xb814=function(_0x3dbd6d,_0x3ee9d7){_0x3dbd6d=_0x3dbd6d-0x0;var _0x1216f1=_0x814b[_0x3dbd6d];return _0x1216f1;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var attributes=require(_0xb814('0x6'));module[_0xb814('0x7')]=function(_0x258866,_0x4237bc){return _0x258866[_0xb814('0x8')](_0xb814('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xb814('0xa'),'fields':[_0xb814('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x3aa547,_0x22248a){var _0x1dd79d=function(_0x976265){while(--_0x976265){_0x3aa547['push'](_0x3aa547['shift']());}};_0x1dd79d(++_0x22248a);}(_0x7a54,0x106));var _0x47a5=function(_0x316da5,_0x18e8d6){_0x316da5=_0x316da5-0x0;var _0x191d24=_0x7a54[_0x316da5];return _0x191d24;};'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 90cb07d..22a9ca6 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 _0x6f49=['then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request'];(function(_0x38bdd3,_0x50d6b5){var _0x398d50=function(_0x4499e4){while(--_0x4499e4){_0x38bdd3['push'](_0x38bdd3['shift']());}};_0x398d50(++_0x50d6b5);}(_0x6f49,0xa6));var _0x96f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f49[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x96f4('0x0'));var moment=require(_0x96f4('0x1'));var BPromise=require(_0x96f4('0x2'));var rs=require(_0x96f4('0x3'));var fs=require('fs');var Redis=require(_0x96f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x96f4('0x5'));var config=require('../../config/environment');var jayson=require(_0x96f4('0x6'));var client=jayson[_0x96f4('0x7')][_0x96f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c9074,_0x3148f5,_0x28ce35){return new BPromise(function(_0x45cb93,_0x1d83cf){return client[_0x96f4('0x9')](_0x5c9074,_0x28ce35)[_0x96f4('0xa')](function(_0x1ae6e2){logger[_0x96f4('0xb')](_0x96f4('0xc'),_0x3148f5,'request\x20sent');logger[_0x96f4('0xd')](_0x96f4('0xe'),_0x3148f5,_0x96f4('0xf'),JSON[_0x96f4('0x10')](_0x1ae6e2));if(_0x1ae6e2[_0x96f4('0x11')]){if(_0x1ae6e2['error'][_0x96f4('0x12')]===0x1f4){logger[_0x96f4('0x11')](_0x96f4('0xc'),_0x3148f5,_0x1ae6e2['error'][_0x96f4('0x13')]);return _0x1d83cf(_0x1ae6e2[_0x96f4('0x11')][_0x96f4('0x13')]);}logger[_0x96f4('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3148f5,_0x1ae6e2['error']['message']);return _0x45cb93(_0x1ae6e2[_0x96f4('0x11')][_0x96f4('0x13')]);}else{logger[_0x96f4('0xb')](_0x96f4('0xc'),_0x3148f5,_0x96f4('0xf'));_0x45cb93(_0x1ae6e2[_0x96f4('0x14')]['message']);}})[_0x96f4('0x15')](function(_0xbe2caf){logger[_0x96f4('0x11')](_0x96f4('0xc'),_0x3148f5,_0xbe2caf);_0x1d83cf(_0xbe2caf);});});} \ No newline at end of file +var _0x1bc2=['client','http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x1bc2,0x102));var _0x21bc=function(_0x3d69a3,_0x4b7254){_0x3d69a3=_0x3d69a3-0x0;var _0x235290=_0x1bc2[_0x3d69a3];return _0x235290;};'use strict';var _=require('lodash');var util=require(_0x21bc('0x0'));var moment=require(_0x21bc('0x1'));var BPromise=require(_0x21bc('0x2'));var rs=require(_0x21bc('0x3'));var fs=require('fs');var Redis=require(_0x21bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x21bc('0x5'))(_0x21bc('0x6'));var config=require('../../config/environment');var jayson=require(_0x21bc('0x7'));var client=jayson[_0x21bc('0x8')][_0x21bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x878d0a,_0x35f7f1,_0x2f42ab){return new BPromise(function(_0x13b365,_0x378c49){return client['request'](_0x878d0a,_0x2f42ab)[_0x21bc('0xa')](function(_0x1c4021){logger['info'](_0x21bc('0xb'),_0x35f7f1,_0x21bc('0xc'));logger[_0x21bc('0xd')](_0x21bc('0xe'),_0x35f7f1,_0x21bc('0xc'),JSON[_0x21bc('0xf')](_0x1c4021));if(_0x1c4021[_0x21bc('0x10')]){if(_0x1c4021[_0x21bc('0x10')]['code']===0x1f4){logger['error'](_0x21bc('0xb'),_0x35f7f1,_0x1c4021[_0x21bc('0x10')][_0x21bc('0x11')]);return _0x378c49(_0x1c4021[_0x21bc('0x10')]['message']);}logger['error'](_0x21bc('0xb'),_0x35f7f1,_0x1c4021[_0x21bc('0x10')]['message']);return _0x13b365(_0x1c4021[_0x21bc('0x10')][_0x21bc('0x11')]);}else{logger['info'](_0x21bc('0xb'),_0x35f7f1,_0x21bc('0xc'));_0x13b365(_0x1c4021['result'][_0x21bc('0x11')]);}})[_0x21bc('0x12')](function(_0x4bcb11){logger['error'](_0x21bc('0xb'),_0x35f7f1,_0x4bcb11);_0x378c49(_0x4bcb11);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1dd3e42..b8ed0ae 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 _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated'];(function(_0x6574bd,_0x536ece){var _0x4ea2a9=function(_0x22a9a9){while(--_0x22a9a9){_0x6574bd['push'](_0x6574bd['shift']());}};_0x4ea2a9(++_0x536ece);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc964=['index','/:id','post','create','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./pause.controller','get','isAuthenticated'];(function(_0x158bb3,_0x76791){var _0x448da3=function(_0x9d3fff){while(--_0x9d3fff){_0x158bb3['push'](_0x158bb3['shift']());}};_0x448da3(++_0x76791);}(_0xc964,0x7e));var _0x4c96=function(_0x2c3069,_0x336a97){_0x2c3069=_0x2c3069-0x0;var _0x32b782=_0xc964[_0x2c3069];return _0x32b782;};'use strict';var multer=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var path=require('path');var timeout=require(_0x4c96('0x2'));var express=require(_0x4c96('0x3'));var router=express[_0x4c96('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4c96('0x5'));var config=require('../../config/environment');var controller=require(_0x4c96('0x6'));router[_0x4c96('0x7')]('/',auth[_0x4c96('0x8')](),controller[_0x4c96('0x9')]);router[_0x4c96('0x7')](_0x4c96('0xa'),auth[_0x4c96('0x8')](),controller['show']);router[_0x4c96('0xb')]('/',auth[_0x4c96('0x8')](),controller[_0x4c96('0xc')]);router['put'](_0x4c96('0xa'),auth[_0x4c96('0x8')](),controller['update']);router['delete']('/:id',auth[_0x4c96('0x8')](),controller[_0x4c96('0xd')]);module[_0x4c96('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2a8fc2e..523df82 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 _0x285e=['exports','STRING','name','sequelize'];(function(_0x53808d,_0x1d573f){var _0x4850eb=function(_0x2cabc1){while(--_0x2cabc1){_0x53808d['push'](_0x53808d['shift']());}};_0x4850eb(++_0x1d573f);}(_0x285e,0xcb));var _0xe285=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x285e[_0x265aa2];return _0x447a3a;};'use strict';var Sequelize=require(_0xe285('0x0'));module[_0xe285('0x1')]={'name':{'type':Sequelize[_0xe285('0x2')],'unique':_0xe285('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa4b1=['STRING','name','sequelize','exports'];(function(_0x461614,_0x55904e){var _0x34b4ac=function(_0x4a1553){while(--_0x4a1553){_0x461614['push'](_0x461614['shift']());}};_0x34b4ac(++_0x55904e);}(_0xa4b1,0x1b2));var _0x1a4b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa4b1[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x1a4b('0x0'));module[_0x1a4b('0x1')]={'name':{'type':Sequelize[_0x1a4b('0x2')],'unique':_0x1a4b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1a4b('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3acebc3..b2086ea 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 _0xed35=['bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','Pauses','UserProfileResource','error','stack','name','send','keys','query','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','dateStart','add','day','merge','filter','map','Pause','includeAll','include','findAll','catch','params','rawAttributes','options','find','body','user','get','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xed35,0x1ce));var _0x5ed3=function(_0x345c3f,_0x1b1bd8){_0x345c3f=_0x345c3f-0x0;var _0x11e07b=_0xed35[_0x345c3f];return _0x11e07b;};'use strict';var pdf=require(_0x5ed3('0x0'));var emlformat=require(_0x5ed3('0x1'));var rimraf=require(_0x5ed3('0x2'));var zipdir=require(_0x5ed3('0x3'));var jsonpatch=require(_0x5ed3('0x4'));var rp=require('request-promise');var moment=require(_0x5ed3('0x5'));var BPromise=require(_0x5ed3('0x6'));var Mustache=require(_0x5ed3('0x7'));var util=require(_0x5ed3('0x8'));var path=require(_0x5ed3('0x9'));var sox=require('sox');var csv=require(_0x5ed3('0xa'));var ejs=require(_0x5ed3('0xb'));var fs=require('fs');var _=require(_0x5ed3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ed3('0xd'));var deskjs=require(_0x5ed3('0xe'));var toCsv=require(_0x5ed3('0xa'));var querystring=require(_0x5ed3('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ed3('0x10'));var qs=require(_0x5ed3('0x11'));var logger=require(_0x5ed3('0x12'))(_0x5ed3('0x13'));var utils=require(_0x5ed3('0x14'));var config=require(_0x5ed3('0x15'));var db=require(_0x5ed3('0x16'))['db'];function respondWithStatusCode(_0x5c4d12,_0x555626){_0x555626=_0x555626||0xcc;return function(_0x57cb62){if(_0x57cb62){return _0x5c4d12[_0x5ed3('0x17')](_0x555626);}return _0x5c4d12[_0x5ed3('0x18')](_0x555626)[_0x5ed3('0x19')]();};}function respondWithResult(_0x1d03cd,_0x25a60c){_0x25a60c=_0x25a60c||0xc8;return function(_0x276f20){if(_0x276f20){return _0x1d03cd[_0x5ed3('0x18')](_0x25a60c)[_0x5ed3('0x1a')](_0x276f20);}};}function respondWithFilteredResult(_0x57e3bc,_0x4cf8a6){return function(_0x80cdf5){if(_0x80cdf5){var _0x51c662=_0x80cdf5[_0x5ed3('0x1b')],_0x3b040a=_0x4cf8a6[_0x5ed3('0x1c')],_0x5ba471=_0x4cf8a6[_0x5ed3('0x1c')]+_0x4cf8a6[_0x5ed3('0x1d')],_0x1c3c62;if(_0x5ba471>=_0x51c662){_0x5ba471=_0x51c662;_0x1c3c62=0xc8;}else{_0x1c3c62=0xce;}_0x57e3bc[_0x5ed3('0x18')](_0x1c3c62);return _0x57e3bc[_0x5ed3('0x1e')]('Content-Range',_0x3b040a+'-'+_0x5ba471+'/'+_0x51c662)[_0x5ed3('0x1a')](_0x80cdf5);}return null;};}function patchUpdates(_0x1b6f69){return function(_0x4fd7f3){try{jsonpatch[_0x5ed3('0x1f')](_0x4fd7f3,_0x1b6f69,!![]);}catch(_0x4f585f){return BPromise[_0x5ed3('0x20')](_0x4f585f);}return _0x4fd7f3[_0x5ed3('0x21')]();};}function saveUpdates(_0x3d1a23,_0x58399d){return function(_0x5de1cf){if(_0x5de1cf){return _0x5de1cf['update'](_0x3d1a23)[_0x5ed3('0x22')](function(_0x47273b){return _0x47273b;});}return null;};}function removeEntity(_0x6191c6,_0x6bc66){return function(_0x455fc5){if(_0x455fc5){return _0x455fc5[_0x5ed3('0x23')]()[_0x5ed3('0x22')](function(){var _0x2e568c=_0x455fc5['get']({'plain':!![]});var _0x35e270=_0x5ed3('0x24');return db[_0x5ed3('0x25')][_0x5ed3('0x23')]({'where':{'type':_0x35e270,'resourceId':_0x2e568c['id']}})[_0x5ed3('0x22')](function(){return _0x455fc5;});})[_0x5ed3('0x22')](function(){_0x6191c6['status'](0xcc)[_0x5ed3('0x19')]();});}};}function handleEntityNotFound(_0x5d3c6a,_0x199550){return function(_0x5199de){if(!_0x5199de){_0x5d3c6a[_0x5ed3('0x17')](0x194);}return _0x5199de;};}function handleError(_0x2db5a4,_0x53fe82){_0x53fe82=_0x53fe82||0x1f4;return function(_0x56f1ab){logger[_0x5ed3('0x26')](_0x56f1ab[_0x5ed3('0x27')]);if(_0x56f1ab['name']){delete _0x56f1ab[_0x5ed3('0x28')];}_0x2db5a4[_0x5ed3('0x18')](_0x53fe82)[_0x5ed3('0x29')](_0x56f1ab);};}exports['index']=function(_0x7bed7a,_0x4ccced){var _0x16820a={},_0x6221={},_0x1c9c51={'count':0x0,'rows':[]};var _0x14b9a8=db['Pause']['rawAttributes'];_0x6221['model']=_[_0x5ed3('0x2a')](_0x14b9a8);var _0x2814b4={'dateStart':_0x7bed7a[_0x5ed3('0x2b')]['dateStart'],'dateEnd':_0x7bed7a[_0x5ed3('0x2b')][_0x5ed3('0x2c')]};delete _0x7bed7a[_0x5ed3('0x2b')]['dateStart'];delete _0x7bed7a['query']['dateEnd'];_0x6221['query']=_[_0x5ed3('0x2a')](_0x7bed7a['query']);_0x6221[_0x5ed3('0x2d')]=_[_0x5ed3('0x2e')](_0x6221[_0x5ed3('0x2f')],_0x6221[_0x5ed3('0x2b')]);_0x16820a[_0x5ed3('0x30')]=_[_0x5ed3('0x2e')](_0x6221[_0x5ed3('0x2f')],qs[_0x5ed3('0x31')](_0x7bed7a['query'][_0x5ed3('0x31')]));_0x16820a[_0x5ed3('0x30')]=_0x16820a['attributes'][_0x5ed3('0x32')]?_0x16820a['attributes']:_0x6221[_0x5ed3('0x2f')];if(!_0x7bed7a[_0x5ed3('0x2b')][_0x5ed3('0x33')]('nolimit')){_0x16820a[_0x5ed3('0x1d')]=qs[_0x5ed3('0x1d')](_0x7bed7a[_0x5ed3('0x2b')][_0x5ed3('0x1d')]);_0x16820a[_0x5ed3('0x1c')]=qs[_0x5ed3('0x1c')](_0x7bed7a[_0x5ed3('0x2b')]['offset']);}_0x16820a[_0x5ed3('0x34')]=qs['sort'](_0x7bed7a[_0x5ed3('0x2b')][_0x5ed3('0x35')]);_0x16820a[_0x5ed3('0x36')]=qs['filters'](_[_0x5ed3('0x37')](_0x7bed7a[_0x5ed3('0x2b')],_0x6221[_0x5ed3('0x2d')]));if(_0x2814b4[_0x5ed3('0x38')]){if(_0x2814b4[_0x5ed3('0x2c')]){_0x2814b4[_0x5ed3('0x2c')]=moment(_0x2814b4[_0x5ed3('0x2c')])['add'](0x1,'day');}else{_0x2814b4[_0x5ed3('0x2c')]=moment(_0x2814b4[_0x5ed3('0x38')])[_0x5ed3('0x39')](0x1,_0x5ed3('0x3a'));}_[_0x5ed3('0x3b')](_0x16820a['where'],{'createdAt':{'$gte':_0x2814b4['dateStart'],'$lte':_0x2814b4[_0x5ed3('0x2c')]}});}if(_0x7bed7a['query'][_0x5ed3('0x3c')]){_0x16820a['where']=_[_0x5ed3('0x3b')](_0x16820a[_0x5ed3('0x36')],{'$or':_[_0x5ed3('0x3d')](_0x16820a[_0x5ed3('0x30')],function(_0x46ee18){var _0xf3c100={};_0xf3c100[_0x46ee18]={'$like':'%'+_0x7bed7a[_0x5ed3('0x2b')][_0x5ed3('0x3c')]+'%'};return _0xf3c100;})});}_0x16820a=_[_0x5ed3('0x3b')]({},_0x16820a,_0x7bed7a['options']);var _0x1dd6a2={'where':_0x16820a[_0x5ed3('0x36')]};return db[_0x5ed3('0x3e')][_0x5ed3('0x1b')](_0x1dd6a2)['then'](function(_0x3d0ff3){_0x1c9c51[_0x5ed3('0x1b')]=_0x3d0ff3;if(_0x7bed7a[_0x5ed3('0x2b')][_0x5ed3('0x3f')]){_0x16820a[_0x5ed3('0x40')]=[{'all':!![]}];}return db[_0x5ed3('0x3e')][_0x5ed3('0x41')](_0x16820a);})[_0x5ed3('0x22')](function(_0x55b6d2){_0x1c9c51['rows']=_0x55b6d2;return _0x1c9c51;})[_0x5ed3('0x22')](respondWithFilteredResult(_0x4ccced,_0x16820a))[_0x5ed3('0x42')](handleError(_0x4ccced,null));};exports['show']=function(_0x5f1644,_0x2cec7a){var _0x407540={'raw':!![],'where':{'id':_0x5f1644[_0x5ed3('0x43')]['id']}},_0xfece89={};_0xfece89[_0x5ed3('0x2f')]=_[_0x5ed3('0x2a')](db[_0x5ed3('0x3e')][_0x5ed3('0x44')]);_0xfece89[_0x5ed3('0x2b')]=_['keys'](_0x5f1644['query']);_0xfece89[_0x5ed3('0x2d')]=_['intersection'](_0xfece89[_0x5ed3('0x2f')],_0xfece89[_0x5ed3('0x2b')]);_0x407540[_0x5ed3('0x30')]=_[_0x5ed3('0x2e')](_0xfece89[_0x5ed3('0x2f')],qs[_0x5ed3('0x31')](_0x5f1644[_0x5ed3('0x2b')]['fields']));_0x407540[_0x5ed3('0x30')]=_0x407540[_0x5ed3('0x30')]['length']?_0x407540[_0x5ed3('0x30')]:_0xfece89[_0x5ed3('0x2f')];if(_0x5f1644[_0x5ed3('0x2b')][_0x5ed3('0x3f')]){_0x407540[_0x5ed3('0x40')]=[{'all':!![]}];}_0x407540=_['merge']({},_0x407540,_0x5f1644[_0x5ed3('0x45')]);return db[_0x5ed3('0x3e')][_0x5ed3('0x46')](_0x407540)[_0x5ed3('0x22')](handleEntityNotFound(_0x2cec7a,null))[_0x5ed3('0x22')](respondWithResult(_0x2cec7a,null))[_0x5ed3('0x42')](handleError(_0x2cec7a,null));};exports['create']=function(_0x2dc2c8,_0x4c052d){return db['Pause']['create'](_0x2dc2c8[_0x5ed3('0x47')],{})[_0x5ed3('0x22')](function(_0x1cb750){var _0x315f1d=_0x2dc2c8[_0x5ed3('0x48')][_0x5ed3('0x49')]({'plain':!![]});if(!_0x315f1d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x315f1d[_0x5ed3('0x4a')]===_0x5ed3('0x48')){var _0x3340a5=_0x1cb750[_0x5ed3('0x49')]({'plain':!![]});var _0x33b38b=_0x5ed3('0x24');return db['UserProfileSection'][_0x5ed3('0x46')]({'where':{'name':_0x33b38b,'userProfileId':_0x315f1d['userProfileId']},'raw':!![]})['then'](function(_0x522ec5){if(_0x522ec5&&_0x522ec5[_0x5ed3('0x4b')]===0x0){return db[_0x5ed3('0x25')]['create']({'name':_0x3340a5[_0x5ed3('0x28')],'resourceId':_0x3340a5['id'],'type':_0x522ec5[_0x5ed3('0x28')],'sectionId':_0x522ec5['id']},{})[_0x5ed3('0x22')](function(){return _0x1cb750;});}else{return _0x1cb750;}})[_0x5ed3('0x42')](function(_0x8c1a79){logger[_0x5ed3('0x26')](_0x5ed3('0x4c'),_0x8c1a79);throw _0x8c1a79;});}return _0x1cb750;})[_0x5ed3('0x22')](respondWithResult(_0x4c052d,0xc9))['catch'](handleError(_0x4c052d,null));};exports[_0x5ed3('0x4d')]=function(_0x1561a5,_0x5d8073){if(_0x1561a5[_0x5ed3('0x47')]['id']){delete _0x1561a5[_0x5ed3('0x47')]['id'];}return db[_0x5ed3('0x3e')][_0x5ed3('0x46')]({'where':{'id':_0x1561a5[_0x5ed3('0x43')]['id']}})[_0x5ed3('0x22')](handleEntityNotFound(_0x5d8073,null))['then'](saveUpdates(_0x1561a5[_0x5ed3('0x47')],null))[_0x5ed3('0x22')](respondWithResult(_0x5d8073,null))[_0x5ed3('0x42')](handleError(_0x5d8073,null));};exports[_0x5ed3('0x23')]=function(_0x44fedd,_0x19417e){return db['Pause']['find']({'where':{'id':_0x44fedd[_0x5ed3('0x43')]['id']}})[_0x5ed3('0x22')](handleEntityNotFound(_0x19417e,null))[_0x5ed3('0x22')](removeEntity(_0x19417e,null))[_0x5ed3('0x42')](handleError(_0x19417e,null));}; \ No newline at end of file +var _0x8c43=['dateStart','dateEnd','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','params','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','Pauses','destroy','error','stack','name','send','index','Pause','rawAttributes','model','keys','query'];(function(_0x57ef62,_0x2ac2a){var _0x26ba49=function(_0x11168e){while(--_0x11168e){_0x57ef62['push'](_0x57ef62['shift']());}};_0x26ba49(++_0x2ac2a);}(_0x8c43,0x16f));var _0x38c4=function(_0x40fee7,_0x5067bf){_0x40fee7=_0x40fee7-0x0;var _0x5a2d69=_0x8c43[_0x40fee7];return _0x5a2d69;};'use strict';var pdf=require(_0x38c4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x38c4('0x1'));var zipdir=require(_0x38c4('0x2'));var jsonpatch=require(_0x38c4('0x3'));var rp=require(_0x38c4('0x4'));var moment=require(_0x38c4('0x5'));var BPromise=require(_0x38c4('0x6'));var Mustache=require(_0x38c4('0x7'));var util=require('util');var path=require(_0x38c4('0x8'));var sox=require('sox');var csv=require(_0x38c4('0x9'));var ejs=require(_0x38c4('0xa'));var fs=require('fs');var _=require(_0x38c4('0xb'));var squel=require('squel');var crypto=require(_0x38c4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x38c4('0xd'));var toCsv=require(_0x38c4('0x9'));var querystring=require(_0x38c4('0xe'));var Papa=require(_0x38c4('0xf'));var Redis=require(_0x38c4('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x38c4('0x11'))(_0x38c4('0x12'));var utils=require(_0x38c4('0x13'));var config=require(_0x38c4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x483203,_0x9cc263){_0x9cc263=_0x9cc263||0xcc;return function(_0x91e5a1){if(_0x91e5a1){return _0x483203[_0x38c4('0x15')](_0x9cc263);}return _0x483203[_0x38c4('0x16')](_0x9cc263)[_0x38c4('0x17')]();};}function respondWithResult(_0x28028c,_0x178be3){_0x178be3=_0x178be3||0xc8;return function(_0x1faae6){if(_0x1faae6){return _0x28028c[_0x38c4('0x16')](_0x178be3)['json'](_0x1faae6);}};}function respondWithFilteredResult(_0x2640c4,_0x1824dc){return function(_0x5792c4){if(_0x5792c4){var _0x505b80=_0x5792c4[_0x38c4('0x18')],_0x3760a5=_0x1824dc[_0x38c4('0x19')],_0x1215ee=_0x1824dc[_0x38c4('0x19')]+_0x1824dc[_0x38c4('0x1a')],_0x587a15;if(_0x1215ee>=_0x505b80){_0x1215ee=_0x505b80;_0x587a15=0xc8;}else{_0x587a15=0xce;}_0x2640c4[_0x38c4('0x16')](_0x587a15);return _0x2640c4[_0x38c4('0x1b')](_0x38c4('0x1c'),_0x3760a5+'-'+_0x1215ee+'/'+_0x505b80)[_0x38c4('0x1d')](_0x5792c4);}return null;};}function patchUpdates(_0x380918){return function(_0x55e7cd){try{jsonpatch[_0x38c4('0x1e')](_0x55e7cd,_0x380918,!![]);}catch(_0xf80af0){return BPromise[_0x38c4('0x1f')](_0xf80af0);}return _0x55e7cd[_0x38c4('0x20')]();};}function saveUpdates(_0x204517,_0x4847f5){return function(_0x307557){if(_0x307557){return _0x307557[_0x38c4('0x21')](_0x204517)[_0x38c4('0x22')](function(_0x3da812){return _0x3da812;});}return null;};}function removeEntity(_0x30b41b,_0x4677c2){return function(_0x2fc1ce){if(_0x2fc1ce){return _0x2fc1ce['destroy']()[_0x38c4('0x22')](function(){var _0x3cea1a=_0x2fc1ce[_0x38c4('0x23')]({'plain':!![]});var _0x489179=_0x38c4('0x24');return db['UserProfileResource'][_0x38c4('0x25')]({'where':{'type':_0x489179,'resourceId':_0x3cea1a['id']}})['then'](function(){return _0x2fc1ce;});})[_0x38c4('0x22')](function(){_0x30b41b[_0x38c4('0x16')](0xcc)[_0x38c4('0x17')]();});}};}function handleEntityNotFound(_0x29f355,_0x168047){return function(_0x161c0b){if(!_0x161c0b){_0x29f355[_0x38c4('0x15')](0x194);}return _0x161c0b;};}function handleError(_0x2bc732,_0x33a435){_0x33a435=_0x33a435||0x1f4;return function(_0x104818){logger[_0x38c4('0x26')](_0x104818[_0x38c4('0x27')]);if(_0x104818[_0x38c4('0x28')]){delete _0x104818[_0x38c4('0x28')];}_0x2bc732[_0x38c4('0x16')](_0x33a435)[_0x38c4('0x29')](_0x104818);};}exports[_0x38c4('0x2a')]=function(_0x15b7ac,_0x3c7a40){var _0x17a2fc={},_0x467722={},_0xc41a0b={'count':0x0,'rows':[]};var _0x4487bc=db[_0x38c4('0x2b')][_0x38c4('0x2c')];_0x467722[_0x38c4('0x2d')]=_[_0x38c4('0x2e')](_0x4487bc);var _0x220352={'dateStart':_0x15b7ac[_0x38c4('0x2f')][_0x38c4('0x30')],'dateEnd':_0x15b7ac[_0x38c4('0x2f')][_0x38c4('0x31')]};delete _0x15b7ac[_0x38c4('0x2f')][_0x38c4('0x30')];delete _0x15b7ac[_0x38c4('0x2f')]['dateEnd'];_0x467722[_0x38c4('0x2f')]=_['keys'](_0x15b7ac['query']);_0x467722[_0x38c4('0x32')]=_['intersection'](_0x467722[_0x38c4('0x2d')],_0x467722['query']);_0x17a2fc[_0x38c4('0x33')]=_[_0x38c4('0x34')](_0x467722[_0x38c4('0x2d')],qs[_0x38c4('0x35')](_0x15b7ac[_0x38c4('0x2f')]['fields']));_0x17a2fc[_0x38c4('0x33')]=_0x17a2fc[_0x38c4('0x33')]['length']?_0x17a2fc[_0x38c4('0x33')]:_0x467722[_0x38c4('0x2d')];if(!_0x15b7ac[_0x38c4('0x2f')][_0x38c4('0x36')](_0x38c4('0x37'))){_0x17a2fc[_0x38c4('0x1a')]=qs['limit'](_0x15b7ac[_0x38c4('0x2f')][_0x38c4('0x1a')]);_0x17a2fc[_0x38c4('0x19')]=qs[_0x38c4('0x19')](_0x15b7ac['query'][_0x38c4('0x19')]);}_0x17a2fc[_0x38c4('0x38')]=qs['sort'](_0x15b7ac[_0x38c4('0x2f')][_0x38c4('0x39')]);_0x17a2fc[_0x38c4('0x3a')]=qs[_0x38c4('0x32')](_[_0x38c4('0x3b')](_0x15b7ac[_0x38c4('0x2f')],_0x467722[_0x38c4('0x32')]));if(_0x220352[_0x38c4('0x30')]){if(_0x220352[_0x38c4('0x31')]){_0x220352['dateEnd']=moment(_0x220352[_0x38c4('0x31')])[_0x38c4('0x3c')](0x1,_0x38c4('0x3d'));}else{_0x220352[_0x38c4('0x31')]=moment(_0x220352['dateStart'])[_0x38c4('0x3c')](0x1,_0x38c4('0x3d'));}_[_0x38c4('0x3e')](_0x17a2fc[_0x38c4('0x3a')],{'createdAt':{'$gte':_0x220352[_0x38c4('0x30')],'$lte':_0x220352[_0x38c4('0x31')]}});}if(_0x15b7ac[_0x38c4('0x2f')][_0x38c4('0x3f')]){_0x17a2fc[_0x38c4('0x3a')]=_[_0x38c4('0x3e')](_0x17a2fc[_0x38c4('0x3a')],{'$or':_[_0x38c4('0x40')](_0x17a2fc[_0x38c4('0x33')],function(_0x54c210){var _0xca164c={};_0xca164c[_0x54c210]={'$like':'%'+_0x15b7ac[_0x38c4('0x2f')][_0x38c4('0x3f')]+'%'};return _0xca164c;})});}_0x17a2fc=_[_0x38c4('0x3e')]({},_0x17a2fc,_0x15b7ac[_0x38c4('0x41')]);var _0x33d316={'where':_0x17a2fc[_0x38c4('0x3a')]};return db[_0x38c4('0x2b')][_0x38c4('0x18')](_0x33d316)[_0x38c4('0x22')](function(_0x25838b){_0xc41a0b[_0x38c4('0x18')]=_0x25838b;if(_0x15b7ac[_0x38c4('0x2f')][_0x38c4('0x42')]){_0x17a2fc[_0x38c4('0x43')]=[{'all':!![]}];}return db[_0x38c4('0x2b')][_0x38c4('0x44')](_0x17a2fc);})['then'](function(_0x53657d){_0xc41a0b['rows']=_0x53657d;return _0xc41a0b;})[_0x38c4('0x22')](respondWithFilteredResult(_0x3c7a40,_0x17a2fc))[_0x38c4('0x45')](handleError(_0x3c7a40,null));};exports['show']=function(_0xf02ef4,_0x15d6ee){var _0x54c5fb={'raw':!![],'where':{'id':_0xf02ef4[_0x38c4('0x46')]['id']}},_0x394fa0={};_0x394fa0[_0x38c4('0x2d')]=_[_0x38c4('0x2e')](db['Pause']['rawAttributes']);_0x394fa0[_0x38c4('0x2f')]=_['keys'](_0xf02ef4[_0x38c4('0x2f')]);_0x394fa0['filters']=_[_0x38c4('0x34')](_0x394fa0[_0x38c4('0x2d')],_0x394fa0[_0x38c4('0x2f')]);_0x54c5fb[_0x38c4('0x33')]=_[_0x38c4('0x34')](_0x394fa0['model'],qs['fields'](_0xf02ef4[_0x38c4('0x2f')]['fields']));_0x54c5fb['attributes']=_0x54c5fb[_0x38c4('0x33')][_0x38c4('0x47')]?_0x54c5fb[_0x38c4('0x33')]:_0x394fa0['model'];if(_0xf02ef4[_0x38c4('0x2f')][_0x38c4('0x42')]){_0x54c5fb[_0x38c4('0x43')]=[{'all':!![]}];}_0x54c5fb=_['merge']({},_0x54c5fb,_0xf02ef4['options']);return db['Pause']['find'](_0x54c5fb)[_0x38c4('0x22')](handleEntityNotFound(_0x15d6ee,null))['then'](respondWithResult(_0x15d6ee,null))[_0x38c4('0x45')](handleError(_0x15d6ee,null));};exports['create']=function(_0x5b7309,_0x2c9e04){return db[_0x38c4('0x2b')]['create'](_0x5b7309[_0x38c4('0x48')],{})[_0x38c4('0x22')](function(_0x21441f){var _0x39d836=_0x5b7309[_0x38c4('0x49')][_0x38c4('0x23')]({'plain':!![]});if(!_0x39d836)throw new Error(_0x38c4('0x4a'));if(_0x39d836[_0x38c4('0x4b')]===_0x38c4('0x49')){var _0x2b5a6f=_0x21441f['get']({'plain':!![]});var _0x4e014a=_0x38c4('0x24');return db[_0x38c4('0x4c')][_0x38c4('0x4d')]({'where':{'name':_0x4e014a,'userProfileId':_0x39d836[_0x38c4('0x4e')]},'raw':!![]})['then'](function(_0x3b2558){if(_0x3b2558&&_0x3b2558[_0x38c4('0x4f')]===0x0){return db[_0x38c4('0x50')][_0x38c4('0x51')]({'name':_0x2b5a6f['name'],'resourceId':_0x2b5a6f['id'],'type':_0x3b2558[_0x38c4('0x28')],'sectionId':_0x3b2558['id']},{})[_0x38c4('0x22')](function(){return _0x21441f;});}else{return _0x21441f;}})[_0x38c4('0x45')](function(_0x9cb80b){logger[_0x38c4('0x26')](_0x38c4('0x52'),_0x9cb80b);throw _0x9cb80b;});}return _0x21441f;})[_0x38c4('0x22')](respondWithResult(_0x2c9e04,0xc9))[_0x38c4('0x45')](handleError(_0x2c9e04,null));};exports['update']=function(_0xa5a061,_0x44ae7b){if(_0xa5a061[_0x38c4('0x48')]['id']){delete _0xa5a061[_0x38c4('0x48')]['id'];}return db[_0x38c4('0x2b')][_0x38c4('0x4d')]({'where':{'id':_0xa5a061['params']['id']}})['then'](handleEntityNotFound(_0x44ae7b,null))['then'](saveUpdates(_0xa5a061[_0x38c4('0x48')],null))[_0x38c4('0x22')](respondWithResult(_0x44ae7b,null))[_0x38c4('0x45')](handleError(_0x44ae7b,null));};exports[_0x38c4('0x25')]=function(_0x50928f,_0x368568){return db[_0x38c4('0x2b')][_0x38c4('0x4d')]({'where':{'id':_0x50928f[_0x38c4('0x46')]['id']}})[_0x38c4('0x22')](handleEntityNotFound(_0x368568,null))[_0x38c4('0x22')](removeEntity(_0x368568,null))[_0x38c4('0x45')](handleError(_0x368568,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 1471f41..d3b2589 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 _0x4d21=['tools_pauses','util','../../config/logger','moment','bluebird','request-promise','exports','define','Pause'];(function(_0x368c8a,_0x658369){var _0x1f7b7c=function(_0x1f1f50){while(--_0x1f1f50){_0x368c8a['push'](_0x368c8a['shift']());}};_0x1f7b7c(++_0x658369);}(_0x4d21,0x133));var _0x14d2=function(_0x3ec76f,_0x28485){_0x3ec76f=_0x3ec76f-0x0;var _0x2ba0ab=_0x4d21[_0x3ec76f];return _0x2ba0ab;};'use strict';var _=require('lodash');var util=require(_0x14d2('0x0'));var logger=require(_0x14d2('0x1'))('api');var moment=require(_0x14d2('0x2'));var BPromise=require(_0x14d2('0x3'));var rp=require(_0x14d2('0x4'));var attributes=require('./pause.attributes');module[_0x14d2('0x5')]=function(_0x561aa1,_0x51deda){return _0x561aa1[_0x14d2('0x6')](_0x14d2('0x7'),attributes,{'tableName':_0x14d2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc7d=['tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./pause.attributes','exports','define','Pause'];(function(_0x534deb,_0x21de0c){var _0x1b3238=function(_0x5a5406){while(--_0x5a5406){_0x534deb['push'](_0x534deb['shift']());}};_0x1b3238(++_0x21de0c);}(_0xbc7d,0x151));var _0xdbc7=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0xbc7d[_0x460150];return _0x340677;};'use strict';var _=require(_0xdbc7('0x0'));var util=require(_0xdbc7('0x1'));var logger=require(_0xdbc7('0x2'))(_0xdbc7('0x3'));var moment=require(_0xdbc7('0x4'));var BPromise=require(_0xdbc7('0x5'));var rp=require(_0xdbc7('0x6'));var attributes=require(_0xdbc7('0x7'));module[_0xdbc7('0x8')]=function(_0x2367be,_0x63cfa4){return _0x2367be[_0xdbc7('0x9')](_0xdbc7('0xa'),attributes,{'tableName':_0xdbc7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 7fcf724..8380f39 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 _0x4a5a=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowPause','Pause','options','raw','include','map','model','attributes','lodash','moment'];(function(_0xdb810a,_0x3007f8){var _0x3954ba=function(_0x34a8d5){while(--_0x34a8d5){_0xdb810a['push'](_0xdb810a['shift']());}};_0x3954ba(++_0x3007f8);}(_0x4a5a,0x6e));var _0xa4a5=function(_0x4d6f7c,_0x363ec9){_0x4d6f7c=_0x4d6f7c-0x0;var _0x17a7dc=_0x4a5a[_0x4d6f7c];return _0x17a7dc;};'use strict';var _=require(_0xa4a5('0x0'));var util=require('util');var moment=require(_0xa4a5('0x1'));var BPromise=require(_0xa4a5('0x2'));var rs=require(_0xa4a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4a5('0x4'))['db'];var utils=require(_0xa4a5('0x5'));var logger=require(_0xa4a5('0x6'))(_0xa4a5('0x7'));var config=require(_0xa4a5('0x8'));var jayson=require(_0xa4a5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a5a2b,_0x4a3df4,_0xb24c42){return new BPromise(function(_0x161489,_0x1e4550){return client['request'](_0x3a5a2b,_0xb24c42)[_0xa4a5('0xa')](function(_0x4eb5ad){logger[_0xa4a5('0xb')](_0xa4a5('0xc'),_0x4a3df4,_0xa4a5('0xd'));logger[_0xa4a5('0xe')]('Pause,\x20%s,\x20%s,\x20%s',_0x4a3df4,'request\x20sent',JSON[_0xa4a5('0xf')](_0x4eb5ad));if(_0x4eb5ad[_0xa4a5('0x10')]){if(_0x4eb5ad['error']['code']===0x1f4){logger['error']('Pause,\x20%s,\x20%s',_0x4a3df4,_0x4eb5ad['error'][_0xa4a5('0x11')]);return _0x1e4550(_0x4eb5ad[_0xa4a5('0x10')][_0xa4a5('0x11')]);}logger['error']('Pause,\x20%s,\x20%s',_0x4a3df4,_0x4eb5ad['error']['message']);return _0x161489(_0x4eb5ad[_0xa4a5('0x10')][_0xa4a5('0x11')]);}else{logger[_0xa4a5('0xb')](_0xa4a5('0xc'),_0x4a3df4,'request\x20sent');_0x161489(_0x4eb5ad[_0xa4a5('0x12')][_0xa4a5('0x11')]);}})[_0xa4a5('0x13')](function(_0x32d781){logger[_0xa4a5('0x10')](_0xa4a5('0xc'),_0x4a3df4,_0x32d781);_0x1e4550(_0x32d781);});});}exports[_0xa4a5('0x14')]=function(_0x3251a5){var _0x205c22=this;return new Promise(function(_0x1549fb,_0x5f1bad){return db[_0xa4a5('0x15')]['find']({'raw':_0x3251a5[_0xa4a5('0x16')]?_0x3251a5[_0xa4a5('0x16')][_0xa4a5('0x17')]===undefined?!![]:![]:!![],'where':_0x3251a5[_0xa4a5('0x16')]?_0x3251a5[_0xa4a5('0x16')]['where']||null:null,'attributes':_0x3251a5[_0xa4a5('0x16')]?_0x3251a5['options']['attributes']||null:null,'include':_0x3251a5[_0xa4a5('0x16')]?_0x3251a5[_0xa4a5('0x16')][_0xa4a5('0x18')]?_[_0xa4a5('0x19')](_0x3251a5[_0xa4a5('0x16')][_0xa4a5('0x18')],function(_0x3cbf65){return{'model':db[_0x3cbf65[_0xa4a5('0x1a')]],'as':_0x3cbf65['as'],'attributes':_0x3cbf65['attributes'],'include':_0x3cbf65[_0xa4a5('0x18')]?_[_0xa4a5('0x19')](_0x3cbf65[_0xa4a5('0x18')],function(_0x1137bc){return{'model':db[_0x1137bc[_0xa4a5('0x1a')]],'as':_0x1137bc['as'],'attributes':_0x1137bc[_0xa4a5('0x1b')],'include':_0x1137bc[_0xa4a5('0x18')]?_[_0xa4a5('0x19')](_0x1137bc['include'],function(_0x177e70){return{'model':db[_0x177e70[_0xa4a5('0x1a')]],'as':_0x177e70['as'],'attributes':_0x177e70[_0xa4a5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f5663){logger['info']('ShowPause',_0x3251a5);logger['debug'](_0xa4a5('0x14'),_0x3251a5,JSON[_0xa4a5('0xf')](_0x4f5663));_0x1549fb(_0x4f5663);})[_0xa4a5('0x13')](function(_0xdcbc5e){logger[_0xa4a5('0x10')]('ShowPause',_0xdcbc5e[_0xa4a5('0x11')],_0x3251a5);_0x5f1bad(_0x205c22[_0xa4a5('0x10')](0x1f4,_0xdcbc5e['message']));});});}; \ No newline at end of file +var _0x6f7a=['catch','Pause','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','Pause,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x40e7aa,_0x13c91c){var _0xaccc53=function(_0xbbbe02){while(--_0xbbbe02){_0x40e7aa['push'](_0x40e7aa['shift']());}};_0xaccc53(++_0x13c91c);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x32dcfa,_0x2685d0){_0x32dcfa=_0x32dcfa-0x0;var _0x3c5a6c=_0x6f7a[_0x32dcfa];return _0x3c5a6c;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('Pause,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});}exports['ShowPause']=function(_0x4a8827){var _0xba7755=this;return new Promise(function(_0x5298ba,_0x378967){return db[_0xa6f7('0x1a')]['find']({'raw':_0x4a8827[_0xa6f7('0x1b')]?_0x4a8827[_0xa6f7('0x1b')][_0xa6f7('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a8827[_0xa6f7('0x1b')]?_0x4a8827[_0xa6f7('0x1b')][_0xa6f7('0x1d')]||null:null,'attributes':_0x4a8827['options']?_0x4a8827[_0xa6f7('0x1b')][_0xa6f7('0x1e')]||null:null,'include':_0x4a8827['options']?_0x4a8827['options']['include']?_[_0xa6f7('0x1f')](_0x4a8827[_0xa6f7('0x1b')]['include'],function(_0x51b71b){return{'model':db[_0x51b71b['model']],'as':_0x51b71b['as'],'attributes':_0x51b71b[_0xa6f7('0x1e')],'include':_0x51b71b[_0xa6f7('0x20')]?_[_0xa6f7('0x1f')](_0x51b71b['include'],function(_0x484874){return{'model':db[_0x484874[_0xa6f7('0x21')]],'as':_0x484874['as'],'attributes':_0x484874['attributes'],'include':_0x484874['include']?_[_0xa6f7('0x1f')](_0x484874['include'],function(_0x35847e){return{'model':db[_0x35847e[_0xa6f7('0x21')]],'as':_0x35847e['as'],'attributes':_0x35847e[_0xa6f7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa6f7('0xe')](function(_0x3a3508){logger['info']('ShowPause',_0x4a8827);logger[_0xa6f7('0x10')](_0xa6f7('0x22'),_0x4a8827,JSON['stringify'](_0x3a3508));_0x5298ba(_0x3a3508);})[_0xa6f7('0x19')](function(_0x27babb){logger[_0xa6f7('0x13')](_0xa6f7('0x22'),_0x27babb[_0xa6f7('0x16')],_0x4a8827);_0x378967(_0xba7755[_0xa6f7('0x13')](0x1f4,_0x27babb[_0xa6f7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index ed780cd..4285f30 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 _0xd455=['webhookGet','/:id','show','download','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xd455,0x16a));var _0x5d45=function(_0x1346b2,_0x3985f2){_0x1346b2=_0x1346b2-0x0;var _0x3e873c=_0xd455[_0x1346b2];return _0x3e873c;};'use strict';var multer=require(_0x5d45('0x0'));var util=require('util');var path=require(_0x5d45('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d45('0x2')]();var auth=require(_0x5d45('0x3'));var interaction=require(_0x5d45('0x4'));var config=require(_0x5d45('0x5'));var controller=require(_0x5d45('0x6'));router[_0x5d45('0x7')]('/',auth[_0x5d45('0x8')](),controller['index']);router[_0x5d45('0x7')](_0x5d45('0x9'),controller[_0x5d45('0xa')]);router['get'](_0x5d45('0xb'),auth[_0x5d45('0x8')](),controller[_0x5d45('0xc')]);router[_0x5d45('0x7')]('/:id/download',auth[_0x5d45('0x8')](),controller[_0x5d45('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4e1849,_0x17601a,_0x354965){_0x354965(null,path[_0x5d45('0xe')](config[_0x5d45('0xf')],_0x5d45('0x10')));},'filename':function(_0x10058e,_0x589d62,_0x4acc73){_0x589d62[_0x5d45('0x11')]=_0x589d62[_0x5d45('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4acc73(null,util[_0x5d45('0x12')](_0x5d45('0x13'),path[_0x5d45('0x14')](_0x589d62['originalname'],path[_0x5d45('0x15')](_0x589d62['originalname'])),Date['now'](),path[_0x5d45('0x15')](_0x589d62[_0x5d45('0x11')])));}})});router[_0x5d45('0x16')]('/',upload[_0x5d45('0x17')](_0x5d45('0x18')),controller[_0x5d45('0x19')]);router[_0x5d45('0x16')]('/webhook',controller[_0x5d45('0x1a')]);router[_0x5d45('0x1b')]('/:id',auth[_0x5d45('0x8')](),controller[_0x5d45('0x1c')]);router[_0x5d45('0x1d')](_0x5d45('0xb'),auth[_0x5d45('0x8')](),controller['delete']);module[_0x5d45('0x1e')]=router; \ No newline at end of file +var _0x9493=['webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','show','/:id/download','download','join','root','server/files/plugins','originalname','%s-%s%s','basename','now','extname','post','single','file','upload','/webhook'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x9493,0x1f0));var _0x3949=function(_0x21b6d3,_0x561184){_0x21b6d3=_0x21b6d3-0x0;var _0x577198=_0x9493[_0x21b6d3];return _0x577198;};'use strict';var multer=require(_0x3949('0x0'));var util=require(_0x3949('0x1'));var path=require(_0x3949('0x2'));var timeout=require(_0x3949('0x3'));var express=require(_0x3949('0x4'));var router=express[_0x3949('0x5')]();var auth=require(_0x3949('0x6'));var interaction=require(_0x3949('0x7'));var config=require(_0x3949('0x8'));var controller=require(_0x3949('0x9'));router[_0x3949('0xa')]('/',auth[_0x3949('0xb')](),controller[_0x3949('0xc')]);router[_0x3949('0xa')]('/webhook',controller['webhookGet']);router['get']('/:id',auth[_0x3949('0xb')](),controller[_0x3949('0xd')]);router[_0x3949('0xa')](_0x3949('0xe'),auth[_0x3949('0xb')](),controller[_0x3949('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2bd938,_0x34b9ff,_0x4a0bc4){_0x4a0bc4(null,path[_0x3949('0x10')](config[_0x3949('0x11')],_0x3949('0x12')));},'filename':function(_0x1bac76,_0x270cfa,_0x32d647){_0x270cfa[_0x3949('0x13')]=_0x270cfa[_0x3949('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x32d647(null,util['format'](_0x3949('0x14'),path[_0x3949('0x15')](_0x270cfa[_0x3949('0x13')],path['extname'](_0x270cfa[_0x3949('0x13')])),Date[_0x3949('0x16')](),path[_0x3949('0x17')](_0x270cfa[_0x3949('0x13')])));}})});router[_0x3949('0x18')]('/',upload[_0x3949('0x19')](_0x3949('0x1a')),controller[_0x3949('0x1b')]);router['post'](_0x3949('0x1c'),controller[_0x3949('0x1d')]);router[_0x3949('0x1e')](_0x3949('0x1f'),auth['isAuthenticated'](),controller[_0x3949('0x20')]);router['delete'](_0x3949('0x1f'),auth[_0x3949('0xb')](),controller[_0x3949('0x21')]);module[_0x3949('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 9c25062..cf3419a 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 _0x84e6=['sequelize','exports','STRING','ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x26f230,_0x205a58){var _0x2c49a5=function(_0x539998){while(--_0x539998){_0x26f230['push'](_0x26f230['shift']());}};_0x2c49a5(++_0x205a58);}(_0x84e6,0x8f));var _0x684e=function(_0x3338e5,_0x3813d6){_0x3338e5=_0x3338e5-0x0;var _0x40c4c4=_0x84e6[_0x3338e5];return _0x40c4c4;};'use strict';var Sequelize=require(_0x684e('0x0'));module[_0x684e('0x1')]={'name':{'type':Sequelize[_0x684e('0x2')]},'type':{'type':Sequelize[_0x684e('0x3')]('html','script')},'description':{'type':Sequelize[_0x684e('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x684e('0x5')},'active':{'type':Sequelize[_0x684e('0x6')],'defaultValue':0x0,'comment':_0x684e('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x684e('0x8'),'agentOnly',_0x684e('0x9'),'never'),'defaultValue':'always','comment':_0x684e('0xa')},'icon':{'type':Sequelize[_0x684e('0x2')]},'adminUrl':{'type':Sequelize[_0x684e('0x2')]},'agentUrl':{'type':Sequelize[_0x684e('0x2')]},'scriptName':{'type':Sequelize[_0x684e('0x2')]},'scriptPath':{'type':Sequelize[_0x684e('0x2')]}}; \ No newline at end of file +var _0x137c=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','STRING','html'];(function(_0x58f233,_0x532edf){var _0x371209=function(_0x1579ac){while(--_0x1579ac){_0x58f233['push'](_0x58f233['shift']());}};_0x371209(++_0x532edf);}(_0x137c,0x12a));var _0xc137=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x137c[_0x254076];return _0x21a93e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc137('0x0')]},'type':{'type':Sequelize['ENUM'](_0xc137('0x1'),'script')},'description':{'type':Sequelize[_0xc137('0x2')]},'version':{'type':Sequelize[_0xc137('0x2')]},'path':{'type':Sequelize[_0xc137('0x0')],'comment':_0xc137('0x3')},'active':{'type':Sequelize[_0xc137('0x4')],'defaultValue':0x0,'comment':_0xc137('0x5')},'sidebar':{'type':Sequelize['ENUM'](_0xc137('0x6'),_0xc137('0x7'),'always',_0xc137('0x8')),'defaultValue':_0xc137('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xc137('0x0')]},'agentUrl':{'type':Sequelize[_0xc137('0x0')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xc137('0x0')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index ce0ea97..720df18 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 _0xbdf4=['encoding','%s%s','headers','content-length','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','method','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','extract-zip','rimraf','archiver','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','get','Plugins','UserProfileResource','end','error','stack','name','send','Plugin','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','add','day','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','find','download','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','undefined','type','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','admin','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','version','html','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','destroy','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:'];(function(_0x1499c1,_0x15f383){var _0x52d109=function(_0x3d4ea5){while(--_0x3d4ea5){_0x1499c1['push'](_0x1499c1['shift']());}};_0x52d109(++_0x15f383);}(_0xbdf4,0x16b));var _0x4bdf=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xbdf4[_0x32f7d7];return _0x133d09;};'use strict';var pdf=require(_0x4bdf('0x0'));var emlformat=require(_0x4bdf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4bdf('0x2'));var jsonpatch=require(_0x4bdf('0x3'));var rp=require(_0x4bdf('0x4'));var moment=require(_0x4bdf('0x5'));var BPromise=require(_0x4bdf('0x6'));var Mustache=require(_0x4bdf('0x7'));var util=require(_0x4bdf('0x8'));var path=require(_0x4bdf('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4bdf('0xa'));var fs=require('fs');var _=require(_0x4bdf('0xb'));var squel=require(_0x4bdf('0xc'));var crypto=require('crypto');var jsforce=require(_0x4bdf('0xd'));var deskjs=require(_0x4bdf('0xe'));var toCsv=require(_0x4bdf('0xf'));var querystring=require('querystring');var Papa=require(_0x4bdf('0x10'));var Redis=require(_0x4bdf('0x11'));var extract=require(_0x4bdf('0x12'));var rimraf=require(_0x4bdf('0x13'));var archiver=require(_0x4bdf('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0x4bdf('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4bdf('0x16'));var db=require(_0x4bdf('0x17'))['db'];config[_0x4bdf('0x18')]=_[_0x4bdf('0x19')](config[_0x4bdf('0x18')],{'host':_0x4bdf('0x1a'),'port':0x18eb});var socket=require(_0x4bdf('0x1b'))(new Redis(config[_0x4bdf('0x18')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x4e2212,_0x4303d4){_0x4303d4=_0x4303d4||0xcc;return function(_0x44622f){if(_0x44622f){return _0x4e2212[_0x4bdf('0x1c')](_0x4303d4);}return _0x4e2212[_0x4bdf('0x1d')](_0x4303d4)['end']();};}function respondWithResult(_0x272563,_0x1155cf){_0x1155cf=_0x1155cf||0xc8;return function(_0x40056d){if(_0x40056d){return _0x272563[_0x4bdf('0x1d')](_0x1155cf)[_0x4bdf('0x1e')](_0x40056d);}};}function respondWithFilteredResult(_0x217555,_0x2d9e90){return function(_0x57b957){if(_0x57b957){var _0x46c123=_0x57b957[_0x4bdf('0x1f')],_0x3faf65=_0x2d9e90[_0x4bdf('0x20')],_0xab95f3=_0x2d9e90[_0x4bdf('0x20')]+_0x2d9e90['limit'],_0x37280d;if(_0xab95f3>=_0x46c123){_0xab95f3=_0x46c123;_0x37280d=0xc8;}else{_0x37280d=0xce;}_0x217555[_0x4bdf('0x1d')](_0x37280d);return _0x217555[_0x4bdf('0x21')](_0x4bdf('0x22'),_0x3faf65+'-'+_0xab95f3+'/'+_0x46c123)[_0x4bdf('0x1e')](_0x57b957);}return null;};}function patchUpdates(_0x26de03){return function(_0x4536c5){try{jsonpatch[_0x4bdf('0x23')](_0x4536c5,_0x26de03,!![]);}catch(_0x1fbb8f){return BPromise[_0x4bdf('0x24')](_0x1fbb8f);}return _0x4536c5[_0x4bdf('0x25')]();};}function saveUpdates(_0x8fc99e,_0x155907){return function(_0xad8d0d){if(_0xad8d0d){return _0xad8d0d['update'](_0x8fc99e)[_0x4bdf('0x26')](function(_0x39ad7d){return _0x39ad7d;});}return null;};}function removeEntity(_0x4ce73c,_0x3d08ce){return function(_0x8be74f){if(_0x8be74f){return _0x8be74f['destroy']()[_0x4bdf('0x26')](function(){var _0x1d65b3=_0x8be74f[_0x4bdf('0x27')]({'plain':!![]});var _0x5f284d=_0x4bdf('0x28');return db[_0x4bdf('0x29')]['destroy']({'where':{'type':_0x5f284d,'resourceId':_0x1d65b3['id']}})[_0x4bdf('0x26')](function(){return _0x8be74f;});})['then'](function(){_0x4ce73c[_0x4bdf('0x1d')](0xcc)[_0x4bdf('0x2a')]();});}};}function handleEntityNotFound(_0x1982a3,_0x584f7c){return function(_0x144dd3){if(!_0x144dd3){_0x1982a3[_0x4bdf('0x1c')](0x194);}return _0x144dd3;};}function handleError(_0x5b4409,_0x47ad04){_0x47ad04=_0x47ad04||0x1f4;return function(_0x30afd2){logger[_0x4bdf('0x2b')](_0x30afd2[_0x4bdf('0x2c')]);if(_0x30afd2[_0x4bdf('0x2d')]){delete _0x30afd2[_0x4bdf('0x2d')];}_0x5b4409[_0x4bdf('0x1d')](_0x47ad04)[_0x4bdf('0x2e')](_0x30afd2);};}exports['index']=function(_0xb947a0,_0x19d5f8){var _0x5c141a={},_0x46b7bb={},_0x2e4063={'count':0x0,'rows':[]};var _0x730d66=db[_0x4bdf('0x2f')][_0x4bdf('0x30')];_0x46b7bb[_0x4bdf('0x31')]=_[_0x4bdf('0x32')](_0x730d66);var _0x57a76b={'dateStart':_0xb947a0[_0x4bdf('0x33')][_0x4bdf('0x34')],'dateEnd':_0xb947a0[_0x4bdf('0x33')][_0x4bdf('0x35')]};delete _0xb947a0[_0x4bdf('0x33')][_0x4bdf('0x34')];delete _0xb947a0[_0x4bdf('0x33')]['dateEnd'];_0x46b7bb[_0x4bdf('0x33')]=_[_0x4bdf('0x32')](_0xb947a0[_0x4bdf('0x33')]);_0x46b7bb['filters']=_[_0x4bdf('0x36')](_0x46b7bb[_0x4bdf('0x31')],_0x46b7bb[_0x4bdf('0x33')]);_0x5c141a[_0x4bdf('0x37')]=_[_0x4bdf('0x36')](_0x46b7bb['model'],qs[_0x4bdf('0x38')](_0xb947a0['query']['fields']));_0x5c141a[_0x4bdf('0x37')]=_0x5c141a[_0x4bdf('0x37')][_0x4bdf('0x39')]?_0x5c141a[_0x4bdf('0x37')]:_0x46b7bb[_0x4bdf('0x31')];if(!_0xb947a0[_0x4bdf('0x33')][_0x4bdf('0x3a')](_0x4bdf('0x3b'))){_0x5c141a[_0x4bdf('0x3c')]=qs[_0x4bdf('0x3c')](_0xb947a0[_0x4bdf('0x33')][_0x4bdf('0x3c')]);_0x5c141a[_0x4bdf('0x20')]=qs[_0x4bdf('0x20')](_0xb947a0[_0x4bdf('0x33')][_0x4bdf('0x20')]);}_0x5c141a[_0x4bdf('0x3d')]=qs['sort'](_0xb947a0[_0x4bdf('0x33')][_0x4bdf('0x3e')]);_0x5c141a[_0x4bdf('0x3f')]=qs[_0x4bdf('0x40')](_[_0x4bdf('0x41')](_0xb947a0['query'],_0x46b7bb['filters']));if(_0x57a76b[_0x4bdf('0x34')]){if(_0x57a76b[_0x4bdf('0x35')]){_0x57a76b[_0x4bdf('0x35')]=moment(_0x57a76b[_0x4bdf('0x35')])[_0x4bdf('0x42')](0x1,'day');}else{_0x57a76b[_0x4bdf('0x35')]=moment(_0x57a76b[_0x4bdf('0x34')])[_0x4bdf('0x42')](0x1,_0x4bdf('0x43'));}_['merge'](_0x5c141a[_0x4bdf('0x3f')],{'createdAt':{'$gte':_0x57a76b[_0x4bdf('0x34')],'$lte':_0x57a76b['dateEnd']}});}if(_0xb947a0[_0x4bdf('0x33')][_0x4bdf('0x44')]){_0x5c141a[_0x4bdf('0x3f')]=_[_0x4bdf('0x45')](_0x5c141a[_0x4bdf('0x3f')],{'$or':_[_0x4bdf('0x46')](_0x5c141a[_0x4bdf('0x37')],function(_0x122f58){var _0x22091f={};_0x22091f[_0x122f58]={'$like':'%'+_0xb947a0['query']['filter']+'%'};return _0x22091f;})});}_0x5c141a=_[_0x4bdf('0x45')]({},_0x5c141a,_0xb947a0[_0x4bdf('0x47')]);var _0x3220e4={'where':_0x5c141a[_0x4bdf('0x3f')]};return db[_0x4bdf('0x2f')][_0x4bdf('0x1f')](_0x3220e4)[_0x4bdf('0x26')](function(_0x41b110){_0x2e4063[_0x4bdf('0x1f')]=_0x41b110;if(_0xb947a0[_0x4bdf('0x33')][_0x4bdf('0x48')]){_0x5c141a[_0x4bdf('0x49')]=[{'all':!![]}];}return db[_0x4bdf('0x2f')][_0x4bdf('0x4a')](_0x5c141a);})[_0x4bdf('0x26')](function(_0x5d88ad){_0x2e4063[_0x4bdf('0x4b')]=_0x5d88ad;return _0x2e4063;})[_0x4bdf('0x26')](respondWithFilteredResult(_0x19d5f8,_0x5c141a))[_0x4bdf('0x4c')](handleError(_0x19d5f8,null));};exports[_0x4bdf('0x4d')]=function(_0x181353,_0x2a81f2){var _0x4a7c5e={'raw':!![],'where':{'id':_0x181353[_0x4bdf('0x4e')]['id']}},_0x5ed6c6={};_0x5ed6c6[_0x4bdf('0x31')]=_[_0x4bdf('0x32')](db[_0x4bdf('0x2f')]['rawAttributes']);_0x5ed6c6[_0x4bdf('0x33')]=_[_0x4bdf('0x32')](_0x181353['query']);_0x5ed6c6[_0x4bdf('0x40')]=_[_0x4bdf('0x36')](_0x5ed6c6[_0x4bdf('0x31')],_0x5ed6c6[_0x4bdf('0x33')]);_0x4a7c5e['attributes']=_['intersection'](_0x5ed6c6[_0x4bdf('0x31')],qs[_0x4bdf('0x38')](_0x181353[_0x4bdf('0x33')]['fields']));_0x4a7c5e[_0x4bdf('0x37')]=_0x4a7c5e[_0x4bdf('0x37')]['length']?_0x4a7c5e[_0x4bdf('0x37')]:_0x5ed6c6[_0x4bdf('0x31')];if(_0x181353[_0x4bdf('0x33')][_0x4bdf('0x48')]){_0x4a7c5e['include']=[{'all':!![]}];}_0x4a7c5e=_[_0x4bdf('0x45')]({},_0x4a7c5e,_0x181353[_0x4bdf('0x47')]);return db[_0x4bdf('0x2f')][_0x4bdf('0x4f')](_0x4a7c5e)[_0x4bdf('0x26')](handleEntityNotFound(_0x2a81f2,null))[_0x4bdf('0x26')](respondWithResult(_0x2a81f2,null))[_0x4bdf('0x4c')](handleError(_0x2a81f2,null));};exports[_0x4bdf('0x50')]=function(_0x7609fd,_0x35db71,_0x49ca77){return db[_0x4bdf('0x2f')]['find']({'where':{'id':_0x7609fd[_0x4bdf('0x4e')]['id']},'attributes':['name','path'],'raw':!![]})['then'](handleEntityNotFound(_0x35db71,null))[_0x4bdf('0x26')](function(_0xf99fcf){if(_0xf99fcf){var _0x46d338=path[_0x4bdf('0x51')](config['root'],_0x4bdf('0x52'),util[_0x4bdf('0x53')](_0x4bdf('0x54'),path[_0x4bdf('0x55')](_0xf99fcf['path'])));var _0x3e3fa7=fs[_0x4bdf('0x56')](_0x46d338);var _0x43a9ad=archiver(_0x4bdf('0x57'),{'zlib':{'level':0x9}});_0x43a9ad['on'](_0x4bdf('0x58'),function(_0x5d654b){if(_0x5d654b[_0x4bdf('0x59')]===_0x4bdf('0x5a')){logger[_0x4bdf('0x2b')](_0x5d654b);}else{throw new db[(_0x4bdf('0x5b'))][(_0x4bdf('0x5c'))](_0x4bdf('0x5d'));}});_0x43a9ad['on'](_0x4bdf('0x2b'),function(_0xa89a7e){throw new db[(_0x4bdf('0x5b'))][(_0x4bdf('0x5c'))](_0x4bdf('0x5d'));});_0x43a9ad[_0x4bdf('0x5e')](_0x3e3fa7);_0x43a9ad[_0x4bdf('0x5f')](_0x4bdf('0x60'),{'cwd':path[_0x4bdf('0x51')](config[_0x4bdf('0x61')],_0x4bdf('0x52'),path[_0x4bdf('0x62')](_0xf99fcf[_0x4bdf('0x9')])),'ignore':[path[_0x4bdf('0x51')](path[_0x4bdf('0x55')](_0xf99fcf['path']),_0x4bdf('0x63')),path[_0x4bdf('0x51')](path['basename'](_0xf99fcf[_0x4bdf('0x9')]),'attachments/**/*')],'nodir':!![]})[_0x4bdf('0x64')]();_0x3e3fa7['on'](_0x4bdf('0x65'),function(){if(!fs[_0x4bdf('0x66')](_0x46d338)){throw new db['Sequelize'][(_0x4bdf('0x5c'))](_0x4bdf('0x67'));}return _0x35db71[_0x4bdf('0x50')](_0x46d338,util[_0x4bdf('0x53')](_0x4bdf('0x54'),path['basename'](_0xf99fcf[_0x4bdf('0x9')])),function(_0x275f0a){if(_0x275f0a){throw new db[(_0x4bdf('0x5b'))][(_0x4bdf('0x5c'))](_0x4bdf('0x68'));}fs['unlinkSync'](_0x46d338);logger['info'](_0x4bdf('0x69'));logger[_0x4bdf('0x6a')](_0x4bdf('0x6b'));});});}return null;})['catch'](handleError(_0x35db71,null));};exports[_0x4bdf('0x6c')]=function(_0xd7cf6e,_0x16be3e,_0xf21b87){var _0x1ce3bf=path['basename'](_0xd7cf6e[_0x4bdf('0x6d')][_0x4bdf('0x6e')],path[_0x4bdf('0x6f')](_0xd7cf6e[_0x4bdf('0x6d')][_0x4bdf('0x6e')]));var _0x196347=path['join'](config[_0x4bdf('0x61')],_0x4bdf('0x52'),_0xd7cf6e[_0x4bdf('0x6d')][_0x4bdf('0x6e')]);var _0x242a84=path[_0x4bdf('0x51')](config['root'],_0x4bdf('0x52'),_0x1ce3bf);logger[_0x4bdf('0x6a')](_0x4bdf('0x70'),_0x196347);logger[_0x4bdf('0x6a')](_0x4bdf('0x71'),_0x242a84);try{fs[_0x4bdf('0x72')](_0x196347,parseInt(_0x4bdf('0x73'),0x8));extract(_0x196347,{'dir':_0x242a84},function(_0x4e2481){if(_0x4e2481){logger['error'](_0x4e2481);handleError(_0x4e2481,!![]);};var _0xcd5f5=fs[_0x4bdf('0x74')](_0x242a84);if(_0xcd5f5['length']>0x1){removeReferences(_0x196347,_0x242a84);logger[_0x4bdf('0x2b')](_0x4bdf('0x75'));return _0xf21b87(new Error(_0x4bdf('0x75')));}var _0x1c4f4b=fs[_0x4bdf('0x76')](path[_0x4bdf('0x51')](_0x242a84,_0xcd5f5[0x0]));if(_0x1c4f4b['isFile']()){removeReferences(_0x196347,_0x242a84);logger[_0x4bdf('0x2b')](_0x4bdf('0x75'));return _0xf21b87(new Error(_0x4bdf('0x75')));}if(_0x1c4f4b[_0x4bdf('0x77')]()){var _0x561b75=fs[_0x4bdf('0x74')](path[_0x4bdf('0x51')](_0x242a84,_0xcd5f5[0x0]));if(_0x561b75['length']===0x0){removeReferences(_0x196347,_0x242a84);logger[_0x4bdf('0x2b')](_0x4bdf('0x75'));return _0xf21b87(new Error(_0x4bdf('0x75')));}var _0x1d151b=_0x561b75[_0x4bdf('0x78')](function(_0x516182){return _0x516182===_0x4bdf('0x79');});if(!_0x1d151b){return _0xf21b87(new Error(_0x4bdf('0x7a')));}var _0x413d8c=fs[_0x4bdf('0x7b')](path[_0x4bdf('0x51')](_0x242a84,_0xcd5f5[0x0],_0x4bdf('0x79')));var _0x5640fb=JSON[_0x4bdf('0x7c')](_0x413d8c);if('undefined'==typeof _0x5640fb[_0x4bdf('0x2d')]){return _0xf21b87(new Error(_0x4bdf('0x7d')));}if(_0x4bdf('0x7e')==typeof _0x5640fb[_0x4bdf('0x7f')]){return _0xf21b87(new Error(_0x4bdf('0x80')));}if(_0x4bdf('0x7e')==typeof _0x5640fb['version']){return _0xf21b87(new Error(_0x4bdf('0x81')));}if(_0x4bdf('0x7e')==typeof _0x5640fb['parameters']){return _0xf21b87(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5640fb[_0x4bdf('0x7f')]==='html'){if('undefined'==typeof _0x5640fb[_0x4bdf('0x82')]['views']){return _0xf21b87(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x4bdf('0x7e')==typeof _0x5640fb['parameters']['views'][_0x4bdf('0x83')]&&_0x4bdf('0x7e')==typeof _0x5640fb[_0x4bdf('0x82')][_0x4bdf('0x84')][_0x4bdf('0x85')]){return _0xf21b87(new Error(_0x4bdf('0x86')));}}else if(_0x5640fb[_0x4bdf('0x7f')]==='script'){if(_0x4bdf('0x7e')==typeof _0x5640fb[_0x4bdf('0x82')]['scriptName']){return _0xf21b87(new Error(_0x4bdf('0x87')));}if(_0x4bdf('0x7e')==typeof _0x5640fb['parameters'][_0x4bdf('0x88')]){return _0xf21b87(new Error(_0x4bdf('0x89')));}}else{return _0xf21b87(new Error(_0x4bdf('0x8a')));}var _0x101760=_0x5640fb[_0x4bdf('0x2d')];var _0x5dd2ff=_0x5640fb['description'];var _0x3e54bf=_0x5640fb[_0x4bdf('0x7f')];var _0x2435d6=_0x5640fb[_0x4bdf('0x8b')]?_0x5640fb[_0x4bdf('0x8b')]:_0x4bdf('0x8c');var _0x386fa6=_0x5640fb[_0x4bdf('0x8d')]?_0x5640fb[_0x4bdf('0x8d')]:_0x4bdf('0x8e');var _0x31b0b3='';var _0x31fa3c='';var _0xf90793='';var _0x459ab7='';var _0x12dca4=_0x5640fb[_0x4bdf('0x8f')];if(_0x3e54bf===_0x4bdf('0x90')){if('undefined'!=typeof _0x5640fb[_0x4bdf('0x82')][_0x4bdf('0x84')]['admin']){var _0x3bb3a8=_0x5640fb[_0x4bdf('0x82')][_0x4bdf('0x84')][_0x4bdf('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x4bdf('0x91')](_0x3bb3a8)){_0x31b0b3=path['join']('plugins',_0x1ce3bf,_0xcd5f5[0x0],_0x3bb3a8);}else{_0x31b0b3=_0x3bb3a8;}}else{logger[_0x4bdf('0x6a')](_0x4bdf('0x92'));}if('undefined'!=typeof _0x5640fb['parameters']['views'][_0x4bdf('0x85')]){var _0x22ecb2=_0x5640fb['parameters'][_0x4bdf('0x84')][_0x4bdf('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x4bdf('0x91')](_0x22ecb2)){_0x31fa3c=path[_0x4bdf('0x51')](_0x4bdf('0x93'),_0x1ce3bf,_0xcd5f5[0x0],_0x22ecb2);}else{_0x31fa3c=_0x22ecb2;}}else{logger[_0x4bdf('0x6a')](_0x4bdf('0x94'));}}else if(_0x3e54bf===_0x4bdf('0x95')){_0xf90793=_0x5640fb[_0x4bdf('0x82')][_0x4bdf('0x96')];_0x459ab7=_0x5640fb[_0x4bdf('0x82')][_0x4bdf('0x88')];if(_0x4bdf('0x7e')!=typeof _0x5640fb[_0x4bdf('0x82')]['views']){if('undefined'!=typeof _0x5640fb[_0x4bdf('0x82')][_0x4bdf('0x84')][_0x4bdf('0x83')]){var _0x3bb3a8=_0x5640fb[_0x4bdf('0x82')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x4bdf('0x91')](_0x3bb3a8)){_0x31b0b3=path[_0x4bdf('0x51')](_0x4bdf('0x93'),_0x1ce3bf,_0xcd5f5[0x0],_0x3bb3a8);}else{_0x31b0b3=_0x3bb3a8;}}if(_0x4bdf('0x7e')!=typeof _0x5640fb[_0x4bdf('0x82')][_0x4bdf('0x84')][_0x4bdf('0x85')]){var _0x22ecb2=_0x5640fb[_0x4bdf('0x82')][_0x4bdf('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x4bdf('0x91')](_0x22ecb2)){_0x31fa3c=path[_0x4bdf('0x51')](_0x4bdf('0x93'),_0x1ce3bf,_0xcd5f5[0x0],_0x22ecb2);}else{_0x31fa3c=_0x22ecb2;}}}}var _0x401404={'name':_0x101760,'description':_0x5dd2ff,'path':path[_0x4bdf('0x51')](_0x1ce3bf,_0xcd5f5[0x0]),'type':_0x3e54bf,'sidebar':_0x2435d6,'icon':_0x386fa6,'adminUrl':_0x31b0b3,'agentUrl':_0x31fa3c,'scriptName':_0xf90793,'scriptPath':_0x459ab7,'version':_0x12dca4};removeReferences(_0x196347,null);return db['Plugin'][_0x4bdf('0x97')](_0x401404)[_0x4bdf('0x26')](function(_0x55aa90){var _0x2edf7b={'role':_0xd7cf6e[_0x4bdf('0x98')][_0x4bdf('0x99')],'userProfileId':_0xd7cf6e['body'][_0x4bdf('0x9a')]};if(!_0x2edf7b)throw new Error(_0x4bdf('0x9b'));if(_0x2edf7b[_0x4bdf('0x99')]===_0x4bdf('0x9c')){var _0x1bcb4c=_0x55aa90[_0x4bdf('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x4bdf('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x2edf7b[_0x4bdf('0x9a')]},'raw':!![]})[_0x4bdf('0x26')](function(_0x1441d2){if(_0x1441d2&&_0x1441d2['autoAssociation']===0x0){return db[_0x4bdf('0x29')][_0x4bdf('0x97')]({'name':_0x1bcb4c[_0x4bdf('0x2d')],'resourceId':_0x1bcb4c['id'],'type':_0x1441d2[_0x4bdf('0x2d')],'sectionId':_0x1441d2['id']},{})[_0x4bdf('0x26')](function(){return _0x55aa90;});}else{return _0x55aa90;}})[_0x4bdf('0x4c')](function(_0x35a339){logger[_0x4bdf('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35a339);throw _0x35a339;});}return _0x55aa90;})[_0x4bdf('0x26')](respondWithResult(_0x16be3e,null))[_0x4bdf('0x4c')](handleError(_0x16be3e,null));}});}catch(_0x4ce6f5){_0x16be3e['status'](0x1f4)[_0x4bdf('0x2e')](_0x4ce6f5);}};function removeReferences(_0x39cee4,_0x1a8f12){try{if(_0x39cee4){fs['unlinkSync'](_0x39cee4);logger[_0x4bdf('0x6a')](_0x4bdf('0x9d'));}if(_0x1a8f12){rimraf(_0x1a8f12,function(){});logger['info'](_0x4bdf('0x9e'));}}catch(_0x3e24fd){logger['error'](_0x3e24fd);}}exports[_0x4bdf('0x9f')]=function(_0x559274,_0x182154,_0x2b79d4){return db[_0x4bdf('0x2f')][_0x4bdf('0x4f')]({'where':{'id':_0x559274[_0x4bdf('0x4e')]['id']}})['then'](handleEntityNotFound(_0x182154,null))[_0x4bdf('0x26')](saveUpdates(_0x559274[_0x4bdf('0x98')],null))[_0x4bdf('0x26')](respondWithResult(_0x182154,null))['catch'](handleError(_0x182154,null));};exports[_0x4bdf('0xa0')]=function(_0x3e747d,_0x327e19,_0x37ce33){return db[_0x4bdf('0x2f')][_0x4bdf('0x4f')]({'where':{'id':_0x3e747d[_0x4bdf('0x4e')]['id']}})[_0x4bdf('0x26')](function(_0xfdaa03){if(_0xfdaa03){return _0xfdaa03[_0x4bdf('0xa1')]();}})[_0x4bdf('0x26')](function(_0x531011){rimraf(path['join'](config[_0x4bdf('0x61')],_0x4bdf('0x52'),path[_0x4bdf('0x62')](_0x531011['path'])),function(){});return _0x531011;})[_0x4bdf('0x26')](handleEntityNotFound(_0x327e19,null))[_0x4bdf('0x26')](respondWithStatusCode(_0x327e19,null))[_0x4bdf('0x4c')](handleError(_0x327e19,null));};exports[_0x4bdf('0xa2')]=function(_0x3b3554,_0x33b870,_0x32203d){return BPromise[_0x4bdf('0xa3')]()['then'](function(){if(!_0x3b3554[_0x4bdf('0x33')][_0x4bdf('0x9')]){throw new Error(_0x4bdf('0xa4'));}if(!_0x3b3554[_0x4bdf('0x33')][_0x4bdf('0xa5')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1171f2=_0x3b3554[_0x4bdf('0x33')]['hostname']?_0x3b3554[_0x4bdf('0x33')][_0x4bdf('0xa6')]+':'+_0x3b3554[_0x4bdf('0x33')][_0x4bdf('0xa5')]:_0x4bdf('0xa7')+_0x3b3554[_0x4bdf('0x33')]['port'];var _0x22f0ff=_0x3b3554[_0x4bdf('0x33')][_0x4bdf('0x1e')]?_0x3b3554['query'][_0x4bdf('0x1e')]:!![];var _0x28d7a2=_0x3b3554[_0x4bdf('0x33')][_0x4bdf('0xa8')]?_0x3b3554[_0x4bdf('0x33')][_0x4bdf('0xa8')]:null;var _0x4fbc9e={'method':_0x3b3554['method'],'uri':util[_0x4bdf('0x53')](_0x4bdf('0xa9'),_0x1171f2,_0x3b3554['query']['path']),'json':_0x22f0ff,'resolveWithFullResponse':!![],'encoding':_0x28d7a2,'qs':_0x3b3554[_0x4bdf('0x33')]};if(_0x3b3554[_0x4bdf('0xaa')]){_0x4fbc9e[_0x4bdf('0xaa')]=_0x3b3554[_0x4bdf('0xaa')];if(_0x4fbc9e[_0x4bdf('0xaa')][_0x4bdf('0xab')]){delete _0x4fbc9e[_0x4bdf('0xaa')][_0x4bdf('0xab')];}}return rp(_0x4fbc9e);})[_0x4bdf('0x26')](function(_0x3f01a1){if(_0x3f01a1){_0x33b870[_0x4bdf('0x21')](_0x3f01a1[_0x4bdf('0xaa')]);logger['info'](_0x3f01a1[_0x4bdf('0x98')]);if(_[_0x4bdf('0xac')](_0x3b3554[_0x4bdf('0x33')][_0x4bdf('0x9')],_0x4bdf('0x50'))&&_0x3f01a1['statusCode']==0x1f4){return _0x33b870[_0x4bdf('0x1c')](_0x3f01a1[_0x4bdf('0xad')]);}else{return _0x33b870['status'](_0x3f01a1['statusCode'])[_0x4bdf('0x2e')](_0x3f01a1[_0x4bdf('0x98')]);}}else{return _0x33b870['sendStatus'](0xc8);}})[_0x4bdf('0x4c')](handleError(_0x33b870,null));};exports[_0x4bdf('0xae')]=function(_0xec7bb4,_0x1be3b2,_0x4094cd){return BPromise['resolve']()[_0x4bdf('0x26')](function(){if(!_0xec7bb4[_0x4bdf('0x33')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xec7bb4['query'][_0x4bdf('0xa5')]){throw new Error(_0x4bdf('0xaf'));}var _0x35fde9=_0xec7bb4[_0x4bdf('0x33')]['hostname']?_0xec7bb4['query'][_0x4bdf('0xa6')]+':'+_0xec7bb4[_0x4bdf('0x33')][_0x4bdf('0xa5')]:_0x4bdf('0xa7')+_0xec7bb4[_0x4bdf('0x33')]['port'];var _0x336dc8=_0xec7bb4[_0x4bdf('0x33')]['json']?_0xec7bb4[_0x4bdf('0x33')]['json']:!![];var _0x16e594=_0xec7bb4[_0x4bdf('0x33')][_0x4bdf('0xa8')]?_0xec7bb4[_0x4bdf('0x33')][_0x4bdf('0xa8')]:null;var _0x32c7b3={'method':_0xec7bb4[_0x4bdf('0xb0')],'uri':util[_0x4bdf('0x53')](_0x4bdf('0xa9'),_0x35fde9,_0xec7bb4[_0x4bdf('0x33')]['path']),'json':_0x336dc8,'resolveWithFullResponse':!![],'encoding':_0x16e594,'body':_0xec7bb4[_0x4bdf('0x98')]};if(_0xec7bb4[_0x4bdf('0xaa')]){_0x32c7b3[_0x4bdf('0xaa')]=_0xec7bb4[_0x4bdf('0xaa')];if(_0x32c7b3[_0x4bdf('0xaa')]['content-length']){delete _0x32c7b3['headers'][_0x4bdf('0xab')];}}return rp(_0x32c7b3);})[_0x4bdf('0x26')](function(_0x34c715){if(_0x34c715){_0x1be3b2[_0x4bdf('0x21')](_0x34c715[_0x4bdf('0xaa')]);logger[_0x4bdf('0x6a')](_0x34c715[_0x4bdf('0x98')]);return _0x1be3b2[_0x4bdf('0x1d')](_0x34c715[_0x4bdf('0xad')])[_0x4bdf('0x2e')](_0x34c715['body']);}else{return _0x1be3b2['sendStatus'](0xc8);}})[_0x4bdf('0x4c')](handleError(_0x1be3b2,null));}; \ No newline at end of file +var _0xc80f=['code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','basename','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','Plugin\x20manifest\x20missing','readFileSync','manifest.json','undefined','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','version','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','resolve','port','hostname','http://localhost:','encoding','%s%s','headers','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','content-length','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','extract-zip','../../components/parsers/qs','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','Plugins','UserProfileResource','stack','name','send','index','Plugin','rawAttributes','keys','query','dateStart','dateEnd','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','add','day','merge','filter','map','options','include','findAll','rows','params','intersection','includeAll','find','catch','download','join','root','server/files/plugins','format','createWriteStream','warning'];(function(_0x455bbf,_0x487eb1){var _0x31cc6a=function(_0x510dd8){while(--_0x510dd8){_0x455bbf['push'](_0x455bbf['shift']());}};_0x31cc6a(++_0x487eb1);}(_0xc80f,0x1a5));var _0xfc80=function(_0x4ef5ba,_0x6ff6df){_0x4ef5ba=_0x4ef5ba-0x0;var _0x1d0fce=_0xc80f[_0x4ef5ba];return _0x1d0fce;};'use strict';var pdf=require(_0xfc80('0x0'));var emlformat=require(_0xfc80('0x1'));var rimraf=require(_0xfc80('0x2'));var zipdir=require(_0xfc80('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc80('0x4'));var moment=require(_0xfc80('0x5'));var BPromise=require(_0xfc80('0x6'));var Mustache=require(_0xfc80('0x7'));var util=require(_0xfc80('0x8'));var path=require(_0xfc80('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfc80('0xa'));var squel=require(_0xfc80('0xb'));var crypto=require(_0xfc80('0xc'));var jsforce=require(_0xfc80('0xd'));var deskjs=require(_0xfc80('0xe'));var toCsv=require(_0xfc80('0xf'));var querystring=require('querystring');var Papa=require(_0xfc80('0x10'));var Redis=require('ioredis');var extract=require(_0xfc80('0x11'));var rimraf=require(_0xfc80('0x2'));var archiver=require('archiver');var qs=require(_0xfc80('0x12'));var logger=require('../../config/logger')(_0xfc80('0x13'));var utils=require(_0xfc80('0x14'));var config=require(_0xfc80('0x15'));var db=require('../../mysqldb')['db'];config[_0xfc80('0x16')]=_[_0xfc80('0x17')](config[_0xfc80('0x16')],{'host':_0xfc80('0x18'),'port':0x18eb});var socket=require(_0xfc80('0x19'))(new Redis(config['redis']));require('./plugin.socket')[_0xfc80('0x1a')](socket);function respondWithStatusCode(_0x144b68,_0x15e812){_0x15e812=_0x15e812||0xcc;return function(_0x59692d){if(_0x59692d){return _0x144b68[_0xfc80('0x1b')](_0x15e812);}return _0x144b68[_0xfc80('0x1c')](_0x15e812)[_0xfc80('0x1d')]();};}function respondWithResult(_0x4e023a,_0x3132dd){_0x3132dd=_0x3132dd||0xc8;return function(_0x56a5f4){if(_0x56a5f4){return _0x4e023a[_0xfc80('0x1c')](_0x3132dd)['json'](_0x56a5f4);}};}function respondWithFilteredResult(_0x64096b,_0xf01822){return function(_0x4c7066){if(_0x4c7066){var _0x4db479=_0x4c7066[_0xfc80('0x1e')],_0x19fbdc=_0xf01822[_0xfc80('0x1f')],_0x46e982=_0xf01822['offset']+_0xf01822[_0xfc80('0x20')],_0xa887a2;if(_0x46e982>=_0x4db479){_0x46e982=_0x4db479;_0xa887a2=0xc8;}else{_0xa887a2=0xce;}_0x64096b[_0xfc80('0x1c')](_0xa887a2);return _0x64096b[_0xfc80('0x21')](_0xfc80('0x22'),_0x19fbdc+'-'+_0x46e982+'/'+_0x4db479)[_0xfc80('0x23')](_0x4c7066);}return null;};}function patchUpdates(_0x1d8017){return function(_0x557268){try{jsonpatch[_0xfc80('0x24')](_0x557268,_0x1d8017,!![]);}catch(_0x5d01bb){return BPromise[_0xfc80('0x25')](_0x5d01bb);}return _0x557268['save']();};}function saveUpdates(_0x4701dc,_0x2d72b5){return function(_0x11a936){if(_0x11a936){return _0x11a936[_0xfc80('0x26')](_0x4701dc)[_0xfc80('0x27')](function(_0x4d82b6){return _0x4d82b6;});}return null;};}function removeEntity(_0x480b24,_0x4a5d05){return function(_0xebe404){if(_0xebe404){return _0xebe404[_0xfc80('0x28')]()[_0xfc80('0x27')](function(){var _0x1f9792=_0xebe404['get']({'plain':!![]});var _0x4c94fa=_0xfc80('0x29');return db[_0xfc80('0x2a')]['destroy']({'where':{'type':_0x4c94fa,'resourceId':_0x1f9792['id']}})[_0xfc80('0x27')](function(){return _0xebe404;});})[_0xfc80('0x27')](function(){_0x480b24[_0xfc80('0x1c')](0xcc)[_0xfc80('0x1d')]();});}};}function handleEntityNotFound(_0x25e3a4,_0x349a9e){return function(_0x42d327){if(!_0x42d327){_0x25e3a4[_0xfc80('0x1b')](0x194);}return _0x42d327;};}function handleError(_0x163dcc,_0x319309){_0x319309=_0x319309||0x1f4;return function(_0x567f75){logger['error'](_0x567f75[_0xfc80('0x2b')]);if(_0x567f75[_0xfc80('0x2c')]){delete _0x567f75[_0xfc80('0x2c')];}_0x163dcc['status'](_0x319309)[_0xfc80('0x2d')](_0x567f75);};}exports[_0xfc80('0x2e')]=function(_0x2b3331,_0x403945){var _0x3654ae={},_0x355316={},_0x389858={'count':0x0,'rows':[]};var _0x2260f4=db[_0xfc80('0x2f')][_0xfc80('0x30')];_0x355316['model']=_[_0xfc80('0x31')](_0x2260f4);var _0x15ab7c={'dateStart':_0x2b3331[_0xfc80('0x32')][_0xfc80('0x33')],'dateEnd':_0x2b3331[_0xfc80('0x32')]['dateEnd']};delete _0x2b3331[_0xfc80('0x32')][_0xfc80('0x33')];delete _0x2b3331[_0xfc80('0x32')][_0xfc80('0x34')];_0x355316[_0xfc80('0x32')]=_[_0xfc80('0x31')](_0x2b3331[_0xfc80('0x32')]);_0x355316[_0xfc80('0x35')]=_['intersection'](_0x355316[_0xfc80('0x36')],_0x355316[_0xfc80('0x32')]);_0x3654ae[_0xfc80('0x37')]=_['intersection'](_0x355316['model'],qs[_0xfc80('0x38')](_0x2b3331[_0xfc80('0x32')]['fields']));_0x3654ae[_0xfc80('0x37')]=_0x3654ae[_0xfc80('0x37')][_0xfc80('0x39')]?_0x3654ae[_0xfc80('0x37')]:_0x355316[_0xfc80('0x36')];if(!_0x2b3331[_0xfc80('0x32')][_0xfc80('0x3a')]('nolimit')){_0x3654ae[_0xfc80('0x20')]=qs[_0xfc80('0x20')](_0x2b3331['query'][_0xfc80('0x20')]);_0x3654ae['offset']=qs['offset'](_0x2b3331[_0xfc80('0x32')][_0xfc80('0x1f')]);}_0x3654ae[_0xfc80('0x3b')]=qs[_0xfc80('0x3c')](_0x2b3331[_0xfc80('0x32')][_0xfc80('0x3c')]);_0x3654ae[_0xfc80('0x3d')]=qs['filters'](_['pick'](_0x2b3331[_0xfc80('0x32')],_0x355316[_0xfc80('0x35')]));if(_0x15ab7c[_0xfc80('0x33')]){if(_0x15ab7c[_0xfc80('0x34')]){_0x15ab7c['dateEnd']=moment(_0x15ab7c[_0xfc80('0x34')])[_0xfc80('0x3e')](0x1,_0xfc80('0x3f'));}else{_0x15ab7c[_0xfc80('0x34')]=moment(_0x15ab7c[_0xfc80('0x33')])[_0xfc80('0x3e')](0x1,_0xfc80('0x3f'));}_[_0xfc80('0x40')](_0x3654ae[_0xfc80('0x3d')],{'createdAt':{'$gte':_0x15ab7c[_0xfc80('0x33')],'$lte':_0x15ab7c[_0xfc80('0x34')]}});}if(_0x2b3331[_0xfc80('0x32')][_0xfc80('0x41')]){_0x3654ae['where']=_[_0xfc80('0x40')](_0x3654ae[_0xfc80('0x3d')],{'$or':_[_0xfc80('0x42')](_0x3654ae[_0xfc80('0x37')],function(_0x3646c9){var _0x414844={};_0x414844[_0x3646c9]={'$like':'%'+_0x2b3331[_0xfc80('0x32')][_0xfc80('0x41')]+'%'};return _0x414844;})});}_0x3654ae=_[_0xfc80('0x40')]({},_0x3654ae,_0x2b3331[_0xfc80('0x43')]);var _0x46e5eb={'where':_0x3654ae[_0xfc80('0x3d')]};return db['Plugin'][_0xfc80('0x1e')](_0x46e5eb)[_0xfc80('0x27')](function(_0x4139aa){_0x389858[_0xfc80('0x1e')]=_0x4139aa;if(_0x2b3331[_0xfc80('0x32')]['includeAll']){_0x3654ae[_0xfc80('0x44')]=[{'all':!![]}];}return db['Plugin'][_0xfc80('0x45')](_0x3654ae);})[_0xfc80('0x27')](function(_0x351931){_0x389858[_0xfc80('0x46')]=_0x351931;return _0x389858;})[_0xfc80('0x27')](respondWithFilteredResult(_0x403945,_0x3654ae))['catch'](handleError(_0x403945,null));};exports['show']=function(_0x2bca2a,_0x55dfe2){var _0xc42a18={'raw':!![],'where':{'id':_0x2bca2a[_0xfc80('0x47')]['id']}},_0x5ec4c5={};_0x5ec4c5[_0xfc80('0x36')]=_['keys'](db[_0xfc80('0x2f')][_0xfc80('0x30')]);_0x5ec4c5[_0xfc80('0x32')]=_['keys'](_0x2bca2a['query']);_0x5ec4c5[_0xfc80('0x35')]=_[_0xfc80('0x48')](_0x5ec4c5[_0xfc80('0x36')],_0x5ec4c5['query']);_0xc42a18[_0xfc80('0x37')]=_[_0xfc80('0x48')](_0x5ec4c5[_0xfc80('0x36')],qs[_0xfc80('0x38')](_0x2bca2a[_0xfc80('0x32')]['fields']));_0xc42a18['attributes']=_0xc42a18[_0xfc80('0x37')]['length']?_0xc42a18[_0xfc80('0x37')]:_0x5ec4c5[_0xfc80('0x36')];if(_0x2bca2a['query'][_0xfc80('0x49')]){_0xc42a18[_0xfc80('0x44')]=[{'all':!![]}];}_0xc42a18=_[_0xfc80('0x40')]({},_0xc42a18,_0x2bca2a[_0xfc80('0x43')]);return db[_0xfc80('0x2f')][_0xfc80('0x4a')](_0xc42a18)[_0xfc80('0x27')](handleEntityNotFound(_0x55dfe2,null))[_0xfc80('0x27')](respondWithResult(_0x55dfe2,null))[_0xfc80('0x4b')](handleError(_0x55dfe2,null));};exports[_0xfc80('0x4c')]=function(_0x2044ab,_0x3bbbbc,_0x1e309e){return db[_0xfc80('0x2f')][_0xfc80('0x4a')]({'where':{'id':_0x2044ab[_0xfc80('0x47')]['id']},'attributes':[_0xfc80('0x2c'),'path'],'raw':!![]})[_0xfc80('0x27')](handleEntityNotFound(_0x3bbbbc,null))[_0xfc80('0x27')](function(_0xd5ede9){if(_0xd5ede9){var _0x1557c3=path[_0xfc80('0x4d')](config[_0xfc80('0x4e')],_0xfc80('0x4f'),util[_0xfc80('0x50')]('%s.zip',path['basename'](_0xd5ede9[_0xfc80('0x9')])));var _0x5ee179=fs[_0xfc80('0x51')](_0x1557c3);var _0x1e248b=archiver('zip',{'zlib':{'level':0x9}});_0x1e248b['on'](_0xfc80('0x52'),function(_0x3f39a3){if(_0x3f39a3[_0xfc80('0x53')]===_0xfc80('0x54')){logger[_0xfc80('0x55')](_0x3f39a3);}else{throw new db['Sequelize'][(_0xfc80('0x56'))](_0xfc80('0x57'));}});_0x1e248b['on']('error',function(_0x2fd7bd){throw new db[(_0xfc80('0x58'))][(_0xfc80('0x56'))](_0xfc80('0x57'));});_0x1e248b[_0xfc80('0x59')](_0x5ee179);_0x1e248b[_0xfc80('0x5a')](_0xfc80('0x5b'),{'cwd':path[_0xfc80('0x4d')](config[_0xfc80('0x4e')],'server/files/plugins',path[_0xfc80('0x5c')](_0xd5ede9['path'])),'ignore':[path[_0xfc80('0x4d')](path['basename'](_0xd5ede9['path']),_0xfc80('0x5d')),path['join'](path[_0xfc80('0x5e')](_0xd5ede9[_0xfc80('0x9')]),_0xfc80('0x5f'))],'nodir':!![]})['finalize']();_0x5ee179['on'](_0xfc80('0x60'),function(){if(!fs[_0xfc80('0x61')](_0x1557c3)){throw new db[(_0xfc80('0x58'))][(_0xfc80('0x56'))](_0xfc80('0x62'));}return _0x3bbbbc['download'](_0x1557c3,util[_0xfc80('0x50')]('%s.zip',path[_0xfc80('0x5e')](_0xd5ede9[_0xfc80('0x9')])),function(_0x564ca1){if(_0x564ca1){throw new db[(_0xfc80('0x58'))][(_0xfc80('0x56'))](_0xfc80('0x63'));}fs[_0xfc80('0x64')](_0x1557c3);logger[_0xfc80('0x65')](_0xfc80('0x66'));logger[_0xfc80('0x65')](_0xfc80('0x67'));});});}return null;})[_0xfc80('0x4b')](handleError(_0x3bbbbc,null));};exports[_0xfc80('0x68')]=function(_0x1fdc5c,_0x45c155,_0x735c10){var _0x3d10b7=path[_0xfc80('0x5e')](_0x1fdc5c[_0xfc80('0x69')][_0xfc80('0x6a')],path['extname'](_0x1fdc5c['file']['filename']));var _0x31264c=path[_0xfc80('0x4d')](config['root'],_0xfc80('0x4f'),_0x1fdc5c[_0xfc80('0x69')][_0xfc80('0x6a')]);var _0x4c558a=path['join'](config[_0xfc80('0x4e')],_0xfc80('0x4f'),_0x3d10b7);logger['info'](_0xfc80('0x6b'),_0x31264c);logger[_0xfc80('0x65')](_0xfc80('0x6c'),_0x4c558a);try{fs[_0xfc80('0x6d')](_0x31264c,parseInt(_0xfc80('0x6e'),0x8));extract(_0x31264c,{'dir':_0x4c558a},function(_0xeea8f1){if(_0xeea8f1){logger[_0xfc80('0x55')](_0xeea8f1);handleError(_0xeea8f1,!![]);};var _0x42cb1b=fs[_0xfc80('0x6f')](_0x4c558a);if(_0x42cb1b['length']>0x1){removeReferences(_0x31264c,_0x4c558a);logger[_0xfc80('0x55')](_0xfc80('0x70'));return _0x735c10(new Error(_0xfc80('0x70')));}var _0x172c43=fs['lstatSync'](path[_0xfc80('0x4d')](_0x4c558a,_0x42cb1b[0x0]));if(_0x172c43[_0xfc80('0x71')]()){removeReferences(_0x31264c,_0x4c558a);logger[_0xfc80('0x55')]('Invalid\x20plugin\x20structure');return _0x735c10(new Error(_0xfc80('0x70')));}if(_0x172c43[_0xfc80('0x72')]()){var _0x346352=fs[_0xfc80('0x6f')](path[_0xfc80('0x4d')](_0x4c558a,_0x42cb1b[0x0]));if(_0x346352[_0xfc80('0x39')]===0x0){removeReferences(_0x31264c,_0x4c558a);logger['error']('Invalid\x20plugin\x20structure');return _0x735c10(new Error(_0xfc80('0x70')));}var _0x210f39=_0x346352['some'](function(_0x2d2d09){return _0x2d2d09==='manifest.json';});if(!_0x210f39){return _0x735c10(new Error(_0xfc80('0x73')));}var _0x4a33a7=fs[_0xfc80('0x74')](path[_0xfc80('0x4d')](_0x4c558a,_0x42cb1b[0x0],_0xfc80('0x75')));var _0x3ed9d3=JSON['parse'](_0x4a33a7);if(_0xfc80('0x76')==typeof _0x3ed9d3[_0xfc80('0x2c')]){return _0x735c10(new Error(_0xfc80('0x77')));}if(_0xfc80('0x76')==typeof _0x3ed9d3[_0xfc80('0x78')]){return _0x735c10(new Error(_0xfc80('0x79')));}if('undefined'==typeof _0x3ed9d3['version']){return _0x735c10(new Error(_0xfc80('0x7a')));}if(_0xfc80('0x76')==typeof _0x3ed9d3[_0xfc80('0x7b')]){return _0x735c10(new Error(_0xfc80('0x7c')));}if(_0x3ed9d3[_0xfc80('0x78')]===_0xfc80('0x7d')){if(_0xfc80('0x76')==typeof _0x3ed9d3[_0xfc80('0x7b')][_0xfc80('0x7e')]){return _0x735c10(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xfc80('0x76')==typeof _0x3ed9d3[_0xfc80('0x7b')][_0xfc80('0x7e')][_0xfc80('0x7f')]&&_0xfc80('0x76')==typeof _0x3ed9d3[_0xfc80('0x7b')][_0xfc80('0x7e')][_0xfc80('0x80')]){return _0x735c10(new Error(_0xfc80('0x81')));}}else if(_0x3ed9d3[_0xfc80('0x78')]===_0xfc80('0x82')){if(_0xfc80('0x76')==typeof _0x3ed9d3[_0xfc80('0x7b')]['scriptName']){return _0x735c10(new Error(_0xfc80('0x83')));}if(_0xfc80('0x76')==typeof _0x3ed9d3[_0xfc80('0x7b')][_0xfc80('0x84')]){return _0x735c10(new Error(_0xfc80('0x85')));}}else{return _0x735c10(new Error(_0xfc80('0x86')));}var _0x317e00=_0x3ed9d3['name'];var _0x13df52=_0x3ed9d3[_0xfc80('0x87')];var _0x1a1009=_0x3ed9d3[_0xfc80('0x78')];var _0x4d40a0=_0x3ed9d3[_0xfc80('0x88')]?_0x3ed9d3[_0xfc80('0x88')]:'always';var _0x5017cb=_0x3ed9d3[_0xfc80('0x89')]?_0x3ed9d3['icon']:_0xfc80('0x8a');var _0xdfa102='';var _0x4d1f60='';var _0x2b7cd7='';var _0x59a6a6='';var _0x5cd103=_0x3ed9d3[_0xfc80('0x8b')];if(_0x1a1009===_0xfc80('0x7d')){if(_0xfc80('0x76')!=typeof _0x3ed9d3['parameters']['views'][_0xfc80('0x7f')]){var _0x207a55=_0x3ed9d3['parameters'][_0xfc80('0x7e')][_0xfc80('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xfc80('0x8c')](_0x207a55)){_0xdfa102=path[_0xfc80('0x4d')](_0xfc80('0x8d'),_0x3d10b7,_0x42cb1b[0x0],_0x207a55);}else{_0xdfa102=_0x207a55;}}else{logger[_0xfc80('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xfc80('0x76')!=typeof _0x3ed9d3[_0xfc80('0x7b')]['views'][_0xfc80('0x80')]){var _0x3e795a=_0x3ed9d3[_0xfc80('0x7b')][_0xfc80('0x7e')][_0xfc80('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xfc80('0x8c')](_0x3e795a)){_0x4d1f60=path[_0xfc80('0x4d')](_0xfc80('0x8d'),_0x3d10b7,_0x42cb1b[0x0],_0x3e795a);}else{_0x4d1f60=_0x3e795a;}}else{logger[_0xfc80('0x65')](_0xfc80('0x8e'));}}else if(_0x1a1009==='script'){_0x2b7cd7=_0x3ed9d3['parameters'][_0xfc80('0x8f')];_0x59a6a6=_0x3ed9d3[_0xfc80('0x7b')][_0xfc80('0x84')];if(_0xfc80('0x76')!=typeof _0x3ed9d3[_0xfc80('0x7b')][_0xfc80('0x7e')]){if(_0xfc80('0x76')!=typeof _0x3ed9d3[_0xfc80('0x7b')][_0xfc80('0x7e')]['admin']){var _0x207a55=_0x3ed9d3['parameters'][_0xfc80('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x207a55)){_0xdfa102=path[_0xfc80('0x4d')]('plugins',_0x3d10b7,_0x42cb1b[0x0],_0x207a55);}else{_0xdfa102=_0x207a55;}}if(_0xfc80('0x76')!=typeof _0x3ed9d3[_0xfc80('0x7b')]['views'][_0xfc80('0x80')]){var _0x3e795a=_0x3ed9d3[_0xfc80('0x7b')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xfc80('0x8c')](_0x3e795a)){_0x4d1f60=path['join'](_0xfc80('0x8d'),_0x3d10b7,_0x42cb1b[0x0],_0x3e795a);}else{_0x4d1f60=_0x3e795a;}}}}var _0x5bf622={'name':_0x317e00,'description':_0x13df52,'path':path[_0xfc80('0x4d')](_0x3d10b7,_0x42cb1b[0x0]),'type':_0x1a1009,'sidebar':_0x4d40a0,'icon':_0x5017cb,'adminUrl':_0xdfa102,'agentUrl':_0x4d1f60,'scriptName':_0x2b7cd7,'scriptPath':_0x59a6a6,'version':_0x5cd103};removeReferences(_0x31264c,null);return db['Plugin'][_0xfc80('0x90')](_0x5bf622)[_0xfc80('0x27')](function(_0x134234){var _0xc71a54={'role':_0x1fdc5c[_0xfc80('0x91')][_0xfc80('0x92')],'userProfileId':_0x1fdc5c['body']['userProfileId']};if(!_0xc71a54)throw new Error(_0xfc80('0x93'));if(_0xc71a54['role']===_0xfc80('0x94')){var _0xd2bc32=_0x134234[_0xfc80('0x95')]({'plain':!![]});return db[_0xfc80('0x96')][_0xfc80('0x4a')]({'where':{'name':_0xfc80('0x29'),'userProfileId':_0xc71a54['userProfileId']},'raw':!![]})[_0xfc80('0x27')](function(_0x361a03){if(_0x361a03&&_0x361a03[_0xfc80('0x97')]===0x0){return db[_0xfc80('0x2a')][_0xfc80('0x90')]({'name':_0xd2bc32[_0xfc80('0x2c')],'resourceId':_0xd2bc32['id'],'type':_0x361a03[_0xfc80('0x2c')],'sectionId':_0x361a03['id']},{})[_0xfc80('0x27')](function(){return _0x134234;});}else{return _0x134234;}})['catch'](function(_0x1dfe5e){logger[_0xfc80('0x55')](_0xfc80('0x98'),_0x1dfe5e);throw _0x1dfe5e;});}return _0x134234;})['then'](respondWithResult(_0x45c155,null))[_0xfc80('0x4b')](handleError(_0x45c155,null));}});}catch(_0x2d66e6){_0x45c155[_0xfc80('0x1c')](0x1f4)[_0xfc80('0x2d')](_0x2d66e6);}};function removeReferences(_0x239a31,_0x44731c){try{if(_0x239a31){fs[_0xfc80('0x64')](_0x239a31);logger['info'](_0xfc80('0x99'));}if(_0x44731c){rimraf(_0x44731c,function(){});logger[_0xfc80('0x65')]('Extracted\x20folder\x20removed');}}catch(_0x5d830d){logger[_0xfc80('0x55')](_0x5d830d);}}exports[_0xfc80('0x26')]=function(_0xa05b8f,_0x21e7d4,_0x3619f0){return db[_0xfc80('0x2f')][_0xfc80('0x4a')]({'where':{'id':_0xa05b8f[_0xfc80('0x47')]['id']}})[_0xfc80('0x27')](handleEntityNotFound(_0x21e7d4,null))[_0xfc80('0x27')](saveUpdates(_0xa05b8f[_0xfc80('0x91')],null))[_0xfc80('0x27')](respondWithResult(_0x21e7d4,null))[_0xfc80('0x4b')](handleError(_0x21e7d4,null));};exports[_0xfc80('0x9a')]=function(_0x587f8c,_0x5f152d,_0x439907){return db[_0xfc80('0x2f')][_0xfc80('0x4a')]({'where':{'id':_0x587f8c[_0xfc80('0x47')]['id']}})[_0xfc80('0x27')](function(_0x3f55a0){if(_0x3f55a0){return _0x3f55a0['destroy']();}})['then'](function(_0x5c8054){rimraf(path[_0xfc80('0x4d')](config[_0xfc80('0x4e')],_0xfc80('0x4f'),path[_0xfc80('0x5c')](_0x5c8054[_0xfc80('0x9')])),function(){});return _0x5c8054;})[_0xfc80('0x27')](handleEntityNotFound(_0x5f152d,null))['then'](respondWithStatusCode(_0x5f152d,null))[_0xfc80('0x4b')](handleError(_0x5f152d,null));};exports[_0xfc80('0x9b')]=function(_0x56bf95,_0x41964a,_0x375545){return BPromise[_0xfc80('0x9c')]()['then'](function(){if(!_0x56bf95['query'][_0xfc80('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x56bf95[_0xfc80('0x32')][_0xfc80('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x466fdb=_0x56bf95[_0xfc80('0x32')][_0xfc80('0x9e')]?_0x56bf95[_0xfc80('0x32')][_0xfc80('0x9e')]+':'+_0x56bf95[_0xfc80('0x32')][_0xfc80('0x9d')]:_0xfc80('0x9f')+_0x56bf95[_0xfc80('0x32')][_0xfc80('0x9d')];var _0x224ba7=_0x56bf95[_0xfc80('0x32')][_0xfc80('0x23')]?_0x56bf95[_0xfc80('0x32')]['json']:!![];var _0x3c8e87=_0x56bf95[_0xfc80('0x32')][_0xfc80('0xa0')]?_0x56bf95['query'][_0xfc80('0xa0')]:null;var _0x3e254c={'method':_0x56bf95['method'],'uri':util[_0xfc80('0x50')](_0xfc80('0xa1'),_0x466fdb,_0x56bf95[_0xfc80('0x32')]['path']),'json':_0x224ba7,'resolveWithFullResponse':!![],'encoding':_0x3c8e87,'qs':_0x56bf95[_0xfc80('0x32')]};if(_0x56bf95['headers']){_0x3e254c['headers']=_0x56bf95[_0xfc80('0xa2')];if(_0x3e254c['headers']['content-length']){delete _0x3e254c[_0xfc80('0xa2')]['content-length'];}}return rp(_0x3e254c);})[_0xfc80('0x27')](function(_0x3032a0){if(_0x3032a0){_0x41964a[_0xfc80('0x21')](_0x3032a0[_0xfc80('0xa2')]);logger['info'](_0x3032a0['body']);if(_[_0xfc80('0xa3')](_0x56bf95['query'][_0xfc80('0x9')],_0xfc80('0x4c'))&&_0x3032a0[_0xfc80('0xa4')]==0x1f4){return _0x41964a['sendStatus'](_0x3032a0[_0xfc80('0xa4')]);}else{return _0x41964a['status'](_0x3032a0[_0xfc80('0xa4')])[_0xfc80('0x2d')](_0x3032a0[_0xfc80('0x91')]);}}else{return _0x41964a[_0xfc80('0x1b')](0xc8);}})[_0xfc80('0x4b')](handleError(_0x41964a,null));};exports[_0xfc80('0xa5')]=function(_0x5841ed,_0x260bb7,_0x10dc48){return BPromise[_0xfc80('0x9c')]()['then'](function(){if(!_0x5841ed['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5841ed[_0xfc80('0x32')][_0xfc80('0x9d')]){throw new Error(_0xfc80('0xa6'));}var _0x212b18=_0x5841ed[_0xfc80('0x32')]['hostname']?_0x5841ed[_0xfc80('0x32')]['hostname']+':'+_0x5841ed['query']['port']:_0xfc80('0x9f')+_0x5841ed[_0xfc80('0x32')]['port'];var _0x368225=_0x5841ed['query'][_0xfc80('0x23')]?_0x5841ed[_0xfc80('0x32')][_0xfc80('0x23')]:!![];var _0x261823=_0x5841ed[_0xfc80('0x32')][_0xfc80('0xa0')]?_0x5841ed[_0xfc80('0x32')]['encoding']:null;var _0x41497b={'method':_0x5841ed['method'],'uri':util[_0xfc80('0x50')]('%s%s',_0x212b18,_0x5841ed['query']['path']),'json':_0x368225,'resolveWithFullResponse':!![],'encoding':_0x261823,'body':_0x5841ed[_0xfc80('0x91')]};if(_0x5841ed[_0xfc80('0xa2')]){_0x41497b[_0xfc80('0xa2')]=_0x5841ed['headers'];if(_0x41497b['headers'][_0xfc80('0xa7')]){delete _0x41497b[_0xfc80('0xa2')][_0xfc80('0xa7')];}}return rp(_0x41497b);})[_0xfc80('0x27')](function(_0x521a08){if(_0x521a08){_0x260bb7[_0xfc80('0x21')](_0x521a08[_0xfc80('0xa2')]);logger[_0xfc80('0x65')](_0x521a08[_0xfc80('0x91')]);return _0x260bb7['status'](_0x521a08[_0xfc80('0xa4')])['send'](_0x521a08[_0xfc80('0x91')]);}else{return _0x260bb7[_0xfc80('0x1b')](0xc8);}})[_0xfc80('0x4b')](handleError(_0x260bb7,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 112cd7e..04e4087 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(_0x4215ee,_0x69ee19){var _0x49c36b=function(_0x258d6d){while(--_0x258d6d){_0x4215ee['push'](_0x4215ee['shift']());}};_0x49c36b(++_0x69ee19);}(_0x7a54,0x106));var _0x47a5=function(_0x596bab,_0x4fb1f2){_0x596bab=_0x596bab-0x0;var _0x11ce83=_0x7a54[_0x596bab];return _0x11ce83;};'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 _0xb10b=['hasOwnProperty','hook','events','Plugin','setMaxListeners','save','remove','emit'];(function(_0x43ac3,_0x2c18dc){var _0x1ff965=function(_0xee39df){while(--_0xee39df){_0x43ac3['push'](_0x43ac3['shift']());}};_0x1ff965(++_0x2c18dc);}(_0xb10b,0x12a));var _0xbb10=function(_0x5efbd0,_0x299553){_0x5efbd0=_0x5efbd0-0x0;var _0x475ec9=_0xb10b[_0x5efbd0];return _0x475ec9;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Plugin=require('../../mysqldb')['db'][_0xbb10('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){PluginEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);PluginEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Plugin[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 6b1d7e3..f0f0983 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 _0x921b=['exports','define','plugins','util','../../config/logger','api','moment','bluebird','request-promise','./plugin.attributes'];(function(_0x4bcf2d,_0x58bb1c){var _0x58aabe=function(_0x56da19){while(--_0x56da19){_0x4bcf2d['push'](_0x4bcf2d['shift']());}};_0x58aabe(++_0x58bb1c);}(_0x921b,0x175));var _0xb921=function(_0x172336,_0x2b66eb){_0x172336=_0x172336-0x0;var _0x5a5e0e=_0x921b[_0x172336];return _0x5a5e0e;};'use strict';var _=require('lodash');var util=require(_0xb921('0x0'));var logger=require(_0xb921('0x1'))(_0xb921('0x2'));var moment=require(_0xb921('0x3'));var BPromise=require(_0xb921('0x4'));var rp=require(_0xb921('0x5'));var attributes=require(_0xb921('0x6'));module[_0xb921('0x7')]=function(_0x109571,_0x379453){return _0x109571[_0xb921('0x8')]('Plugin',attributes,{'tableName':_0xb921('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74f9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./plugin.attributes','define','Plugin','plugins'];(function(_0x2c87dd,_0x261fea){var _0x23b6de=function(_0x31ead6){while(--_0x31ead6){_0x2c87dd['push'](_0x2c87dd['shift']());}};_0x23b6de(++_0x261fea);}(_0x74f9,0x197));var _0x974f=function(_0x47b8b5,_0x41fd9b){_0x47b8b5=_0x47b8b5-0x0;var _0x1ee44a=_0x74f9[_0x47b8b5];return _0x1ee44a;};'use strict';var _=require(_0x974f('0x0'));var util=require(_0x974f('0x1'));var logger=require(_0x974f('0x2'))(_0x974f('0x3'));var moment=require(_0x974f('0x4'));var BPromise=require(_0x974f('0x5'));var rp=require(_0x974f('0x6'));var attributes=require(_0x974f('0x7'));module['exports']=function(_0x497cd,_0x4843e8){return _0x497cd[_0x974f('0x8')](_0x974f('0x9'),attributes,{'tableName':_0x974f('0xa'),'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 b03c080..0650877 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 _0xe8b9=['create','body','options','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','./plugin.socket','then','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreatePlugin','Plugin'];(function(_0x118628,_0x2ea943){var _0x28d518=function(_0x3cbe24){while(--_0x3cbe24){_0x118628['push'](_0x118628['shift']());}};_0x28d518(++_0x2ea943);}(_0xe8b9,0x1c4));var _0x9e8b=function(_0x263f18,_0x3bf229){_0x263f18=_0x263f18-0x0;var _0x1748b2=_0xe8b9[_0x263f18];return _0x1748b2;};'use strict';var _=require('lodash');var util=require(_0x9e8b('0x0'));var moment=require(_0x9e8b('0x1'));var BPromise=require(_0x9e8b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e8b('0x3'));var db=require(_0x9e8b('0x4'))['db'];var utils=require(_0x9e8b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9e8b('0x6'));var jayson=require(_0x9e8b('0x7'));var client=jayson[_0x9e8b('0x8')][_0x9e8b('0x9')]({'port':0x232a});config['redis']=_[_0x9e8b('0xa')](config[_0x9e8b('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e8b('0xb')]));require(_0x9e8b('0xc'))['register'](socket);function respondWithRpcPromise(_0x160fca,_0x3007cd,_0x3a3c5f){return new BPromise(function(_0x5bd7e7,_0xba5d65){return client['request'](_0x160fca,_0x3a3c5f)[_0x9e8b('0xd')](function(_0x49b7ad){logger['info'](_0x9e8b('0xe'),_0x3007cd,_0x9e8b('0xf'));logger['debug'](_0x9e8b('0x10'),_0x3007cd,_0x9e8b('0xf'),JSON['stringify'](_0x49b7ad));if(_0x49b7ad['error']){if(_0x49b7ad[_0x9e8b('0x11')][_0x9e8b('0x12')]===0x1f4){logger[_0x9e8b('0x11')](_0x9e8b('0xe'),_0x3007cd,_0x49b7ad['error']['message']);return _0xba5d65(_0x49b7ad[_0x9e8b('0x11')]['message']);}logger[_0x9e8b('0x11')](_0x9e8b('0xe'),_0x3007cd,_0x49b7ad['error'][_0x9e8b('0x13')]);return _0x5bd7e7(_0x49b7ad[_0x9e8b('0x11')][_0x9e8b('0x13')]);}else{logger[_0x9e8b('0x14')]('Plugin,\x20%s,\x20%s',_0x3007cd,_0x9e8b('0xf'));_0x5bd7e7(_0x49b7ad['result'][_0x9e8b('0x13')]);}})[_0x9e8b('0x15')](function(_0x4c9771){logger[_0x9e8b('0x11')](_0x9e8b('0xe'),_0x3007cd,_0x4c9771);_0xba5d65(_0x4c9771);});});}exports[_0x9e8b('0x16')]=function(_0x41b475){var _0x32fa78=this;return new Promise(function(_0x159bdf,_0x4b9bde){return db[_0x9e8b('0x17')][_0x9e8b('0x18')](_0x41b475[_0x9e8b('0x19')],{'raw':_0x41b475[_0x9e8b('0x1a')]?_0x41b475[_0x9e8b('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9e8b('0xd')](function(_0x15ff15){logger[_0x9e8b('0x14')](_0x9e8b('0x16'),_0x41b475);logger[_0x9e8b('0x1b')](_0x9e8b('0x16'),_0x41b475,JSON['stringify'](_0x15ff15));_0x159bdf(_0x15ff15);})[_0x9e8b('0x15')](function(_0x470dfa){logger[_0x9e8b('0x11')](_0x9e8b('0x16'),_0x470dfa[_0x9e8b('0x13')],_0x41b475);_0x4b9bde(_0x32fa78['error'](0x1f4,_0x470dfa[_0x9e8b('0x13')]));});});}; \ No newline at end of file +var _0x41a6=['http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreatePlugin','Plugin','create','body','options','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2ce7ed,_0x287153){var _0x28d5b1=function(_0x501684){while(--_0x501684){_0x2ce7ed['push'](_0x2ce7ed['shift']());}};_0x28d5b1(++_0x287153);}(_0x41a6,0x1c8));var _0x641a=function(_0x41e7cc,_0x3e893e){_0x41e7cc=_0x41e7cc-0x0;var _0x4a79cf=_0x41a6[_0x41e7cc];return _0x4a79cf;};'use strict';var _=require(_0x641a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x641a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x641a('0x2'));var db=require(_0x641a('0x3'))['db'];var utils=require(_0x641a('0x4'));var logger=require(_0x641a('0x5'))(_0x641a('0x6'));var config=require('../../config/environment');var jayson=require(_0x641a('0x7'));var client=jayson[_0x641a('0x8')][_0x641a('0x9')]({'port':0x232a});config[_0x641a('0xa')]=_[_0x641a('0xb')](config[_0x641a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x641a('0xc'))(new Redis(config['redis']));require(_0x641a('0xd'))[_0x641a('0xe')](socket);function respondWithRpcPromise(_0xf48d10,_0x169f05,_0xfdc5b4){return new BPromise(function(_0x46b112,_0x2121ae){return client[_0x641a('0xf')](_0xf48d10,_0xfdc5b4)['then'](function(_0xc7f176){logger[_0x641a('0x10')](_0x641a('0x11'),_0x169f05,'request\x20sent');logger[_0x641a('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x169f05,'request\x20sent',JSON[_0x641a('0x13')](_0xc7f176));if(_0xc7f176['error']){if(_0xc7f176[_0x641a('0x14')][_0x641a('0x15')]===0x1f4){logger[_0x641a('0x14')](_0x641a('0x11'),_0x169f05,_0xc7f176['error'][_0x641a('0x16')]);return _0x2121ae(_0xc7f176[_0x641a('0x14')][_0x641a('0x16')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x169f05,_0xc7f176['error'][_0x641a('0x16')]);return _0x46b112(_0xc7f176[_0x641a('0x14')][_0x641a('0x16')]);}else{logger[_0x641a('0x10')](_0x641a('0x11'),_0x169f05,_0x641a('0x17'));_0x46b112(_0xc7f176[_0x641a('0x18')][_0x641a('0x16')]);}})[_0x641a('0x19')](function(_0x294b2a){logger['error'](_0x641a('0x11'),_0x169f05,_0x294b2a);_0x2121ae(_0x294b2a);});});}exports[_0x641a('0x1a')]=function(_0x4a7604){var _0x428d48=this;return new Promise(function(_0x397f59,_0x295b92){return db[_0x641a('0x1b')][_0x641a('0x1c')](_0x4a7604[_0x641a('0x1d')],{'raw':_0x4a7604[_0x641a('0x1e')]?_0x4a7604[_0x641a('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5326df){logger[_0x641a('0x10')]('CreatePlugin',_0x4a7604);logger['debug'](_0x641a('0x1a'),_0x4a7604,JSON[_0x641a('0x13')](_0x5326df));_0x397f59(_0x5326df);})[_0x641a('0x19')](function(_0x354a9f){logger[_0x641a('0x14')](_0x641a('0x1a'),_0x354a9f[_0x641a('0x16')],_0x4a7604);_0x295b92(_0x428d48[_0x641a('0x14')](0x1f4,_0x354a9f[_0x641a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index df1c1a3..2c08f2c 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 _0xccf3=['update','emit','removeListener','register','plugin:','save','remove'];(function(_0x2fe155,_0x106532){var _0xdfcb6=function(_0x5ad565){while(--_0x5ad565){_0x2fe155['push'](_0x2fe155['shift']());}};_0xdfcb6(++_0x106532);}(_0xccf3,0x6e));var _0x3ccf=function(_0x2d3e27,_0x2dfd70){_0x2d3e27=_0x2d3e27-0x0;var _0x1b4fff=_0xccf3[_0x2d3e27];return _0x1b4fff;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x3ccf('0x0'),_0x3ccf('0x1'),_0x3ccf('0x2')];function createListener(_0x317e64,_0x5de3b5){return function(_0x5b1fbd){_0x5de3b5[_0x3ccf('0x3')](_0x317e64,_0x5b1fbd);};}function removeListener(_0x3a4ea4,_0x49acb9){return function(){PluginEvents[_0x3ccf('0x4')](_0x3a4ea4,_0x49acb9);};}exports[_0x3ccf('0x5')]=function(_0x44ee98){for(var _0x3f27c3=0x0,_0x302b06=events['length'];_0x3f27c3<_0x302b06;_0x3f27c3++){var _0x2dceb8=events[_0x3f27c3];var _0x2b0a79=createListener(_0x3ccf('0x6')+_0x2dceb8,_0x44ee98);PluginEvents['on'](_0x2dceb8,_0x2b0a79);}}; \ No newline at end of file +var _0x94d4=['removeListener','register','length','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x517750,_0x10e77a){var _0x5bfbc3=function(_0x183fdc){while(--_0x183fdc){_0x517750['push'](_0x517750['shift']());}};_0x5bfbc3(++_0x10e77a);}(_0x94d4,0x175));var _0x494d=function(_0x14f8ef,_0x1b1107){_0x14f8ef=_0x14f8ef-0x0;var _0x3b97f6=_0x94d4[_0x14f8ef];return _0x3b97f6;};'use strict';var PluginEvents=require(_0x494d('0x0'));var events=[_0x494d('0x1'),_0x494d('0x2'),_0x494d('0x3')];function createListener(_0x5227dd,_0x3fc939){return function(_0x383557){_0x3fc939[_0x494d('0x4')](_0x5227dd,_0x383557);};}function removeListener(_0x5b6b19,_0x47cad4){return function(){PluginEvents[_0x494d('0x5')](_0x5b6b19,_0x47cad4);};}exports[_0x494d('0x6')]=function(_0x48b6d4){for(var _0x4b06fb=0x0,_0x247e0c=events[_0x494d('0x7')];_0x4b06fb<_0x247e0c;_0x4b06fb++){var _0x1ce620=events[_0x4b06fb];var _0x611252=createListener(_0x494d('0x8')+_0x1ce620,_0x48b6d4);PluginEvents['on'](_0x1ce620,_0x611252);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 05cc6c5..05a3e27 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(_0x2fdbed,_0x4201e1){var _0x47729f=function(_0x2f1f7f){while(--_0x2f1f7f){_0x2fdbed['push'](_0x2fdbed['shift']());}};_0x47729f(++_0x4201e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x14dfc4,_0x3e4f7a){var _0x2911fc=function(_0x182f54){while(--_0x182f54){_0x14dfc4['push'](_0x14dfc4['shift']());}};_0x2911fc(++_0x3e4f7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 b7f0f87..007bbea 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 _0x9613=['script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','status','error','stack','name','send','npm\x20install','info','then','reject','express','motion2','length','catch','show','params','create','body'];(function(_0x1c7a3c,_0x2639ac){var _0x36e66c=function(_0x4c1850){while(--_0x4c1850){_0x1c7a3c['push'](_0x1c7a3c['shift']());}};_0x36e66c(++_0x2639ac);}(_0x9613,0x1c9));var _0x3961=function(_0x4a0e3c,_0xba9552){_0x4a0e3c=_0x4a0e3c-0x0;var _0x200a02=_0x9613[_0x4a0e3c];return _0x200a02;};'use strict';var _=require(_0x3961('0x0'));var pm2=require(_0x3961('0x1'));var logger=require(_0x3961('0x2'))(_0x3961('0x3'));var path=require('path');var exec=require(_0x3961('0x4'))[_0x3961('0x5')];var BPromise=require(_0x3961('0x6'));function handleEntityNotFound(_0x1a9c39,_0x5f567d){return function(_0x26b49c){if(!_0x26b49c){_0x1a9c39['sendStatus'](0x194);;}return _0x26b49c;};}function respondWithResult(_0x5c8e55,_0x38178c){_0x38178c=_0x38178c||0xc8;return function(_0x2961c5){if(_0x2961c5){return _0x5c8e55[_0x3961('0x7')](_0x38178c)['json'](_0x2961c5);}return null;};}function handleError(_0x3a0772,_0x492ee8){_0x492ee8=_0x492ee8||0x1f4;return function(_0x1a5b9c){logger[_0x3961('0x8')](_0x1a5b9c[_0x3961('0x9')]);if(_0x1a5b9c[_0x3961('0xa')]){delete _0x1a5b9c['name'];}_0x3a0772[_0x3961('0x7')](_0x492ee8)[_0x3961('0xb')](_0x1a5b9c);};}function execChildProcess(){return new BPromise(function(_0x586e66,_0x96272a){exec(_0x3961('0xc'),function(_0x2282ec,_0x19c86c,_0x6e9610){logger[_0x3961('0xd')](_0x19c86c);logger[_0x3961('0xd')](_0x6e9610);if(_0x2282ec){logger[_0x3961('0x8')](_0x2282ec);return _0x96272a(_0x2282ec);}return _0x586e66(_0x19c86c);});});}exports['index']=function(_0x133916,_0x55e0b0){return pm2['list']()[_0x3961('0xe')](function(_0x57005f){if(_0x57005f){var _0x347d01=_[_0x3961('0xf')](_0x57005f,function(_0x271d2b){return _0x271d2b[_0x3961('0xa')]===_0x3961('0x10')||_0x271d2b[_0x3961('0xa')]===_0x3961('0x11');});return{'rows':_0x347d01,'count':_0x347d01[_0x3961('0x12')]};}return null;})[_0x3961('0xe')](respondWithResult(_0x55e0b0,null))[_0x3961('0x13')](handleError(_0x55e0b0,null));};exports[_0x3961('0x14')]=function(_0x263177,_0x147a5a){return pm2['describe'](_0x263177[_0x3961('0x15')]['id'])[_0x3961('0xe')](respondWithResult(_0x147a5a,null))['then'](handleEntityNotFound(_0x147a5a,null))[_0x3961('0x13')](handleError(_0x147a5a,null));};exports[_0x3961('0x16')]=function(_0x1afbdc,_0x1b9834){if(_0x1afbdc[_0x3961('0x17')][_0x3961('0xa')]&&_0x1afbdc[_0x3961('0x17')]['script']){var _0x48f9ef=path['join'](__dirname,'../../files/plugins',_0x1afbdc[_0x3961('0x17')][_0x3961('0x18')]);var _0xc533bf=process[_0x3961('0x19')]();process[_0x3961('0x1a')](path[_0x3961('0x1b')](_0x48f9ef));return execChildProcess()[_0x3961('0xe')](function(_0x732c42){process[_0x3961('0x1a')](_0xc533bf);return pm2[_0x3961('0x1c')]({'name':_0x1afbdc['body'][_0x3961('0xa')],'script':_0x48f9ef});})[_0x3961('0xe')](function(_0x98da23){pm2[_0x3961('0x1d')]();return _0x98da23[0x0];})['then'](respondWithResult(_0x1b9834,0xc9))[_0x3961('0x13')](handleError(_0x1b9834,null));}else{return _0x1b9834[_0x3961('0x7')](0x1f4)[_0x3961('0xb')]({'message':_0x3961('0x1e')});}};exports[_0x3961('0x1f')]=function(_0x3aaf90,_0x49b262){if(_0x3aaf90[_0x3961('0x17')]['id']){delete _0x3aaf90[_0x3961('0x17')]['id'];}var _0x4a806b={'online':_0x3961('0x20'),'stopped':'stop'};if(_0x4a806b[_0x3961('0x21')](_0x3aaf90['body']['status'])){return pm2[_0x4a806b[_0x3aaf90[_0x3961('0x17')][_0x3961('0x7')]]](_0x3aaf90[_0x3961('0x15')]['id'])['then'](respondWithResult(_0x49b262,0xc8))['catch'](handleError(_0x49b262,null));}else{return _0x49b262[_0x3961('0x7')](0x1f4)[_0x3961('0xb')]({'message':'Unknown\x20status'});}};exports[_0x3961('0x22')]=function(_0x5b7baf,_0x3104ff){if(_0x5b7baf[_0x3961('0x17')]['id']){delete _0x5b7baf[_0x3961('0x17')]['id'];}if(_0x5b7baf['params']['id']){return pm2[_0x3961('0x23')](_0x5b7baf['params']['id'])['then'](function(_0x495477){pm2[_0x3961('0x1d')]();return _0x495477[0x0];})[_0x3961('0xe')](respondWithResult(_0x3104ff,null))[_0x3961('0x13')](handleError(_0x3104ff,null));}else{return _0x3104ff[_0x3961('0x7')](0x1f4)[_0x3961('0xb')]({'message':_0x3961('0x24')});}}; \ No newline at end of file +var _0x75d2=['body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','params','catch','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','status','error','name','send','npm\x20install','info','index','list','reject','express','motion2','length','show','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x75d2,0x152));var _0x275d=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0x75d2[_0x4b4277];return _0x1ff405;};'use strict';var _=require(_0x275d('0x0'));var pm2=require(_0x275d('0x1'));var logger=require(_0x275d('0x2'))(_0x275d('0x3'));var path=require(_0x275d('0x4'));var exec=require(_0x275d('0x5'))[_0x275d('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2ed404,_0x5ac92c){return function(_0x33719c){if(!_0x33719c){_0x2ed404[_0x275d('0x7')](0x194);;}return _0x33719c;};}function respondWithResult(_0x152caf,_0x1103af){_0x1103af=_0x1103af||0xc8;return function(_0x2025e5){if(_0x2025e5){return _0x152caf[_0x275d('0x8')](_0x1103af)['json'](_0x2025e5);}return null;};}function handleError(_0x3b79fe,_0x8b2987){_0x8b2987=_0x8b2987||0x1f4;return function(_0xcbe115){logger[_0x275d('0x9')](_0xcbe115['stack']);if(_0xcbe115[_0x275d('0xa')]){delete _0xcbe115[_0x275d('0xa')];}_0x3b79fe[_0x275d('0x8')](_0x8b2987)[_0x275d('0xb')](_0xcbe115);};}function execChildProcess(){return new BPromise(function(_0x785cae,_0x17bb23){exec(_0x275d('0xc'),function(_0x286eca,_0x28ea5d,_0x349df6){logger[_0x275d('0xd')](_0x28ea5d);logger[_0x275d('0xd')](_0x349df6);if(_0x286eca){logger[_0x275d('0x9')](_0x286eca);return _0x17bb23(_0x286eca);}return _0x785cae(_0x28ea5d);});});}exports[_0x275d('0xe')]=function(_0x4220b6,_0x59dfcc){return pm2[_0x275d('0xf')]()['then'](function(_0xa0633a){if(_0xa0633a){var _0x2ac584=_[_0x275d('0x10')](_0xa0633a,function(_0x2d3d25){return _0x2d3d25[_0x275d('0xa')]===_0x275d('0x11')||_0x2d3d25[_0x275d('0xa')]===_0x275d('0x12');});return{'rows':_0x2ac584,'count':_0x2ac584[_0x275d('0x13')]};}return null;})['then'](respondWithResult(_0x59dfcc,null))['catch'](handleError(_0x59dfcc,null));};exports[_0x275d('0x14')]=function(_0x375c57,_0x396b89){return pm2['describe'](_0x375c57['params']['id'])['then'](respondWithResult(_0x396b89,null))[_0x275d('0x15')](handleEntityNotFound(_0x396b89,null))['catch'](handleError(_0x396b89,null));};exports['create']=function(_0x34e4b9,_0x5e553f){if(_0x34e4b9[_0x275d('0x16')][_0x275d('0xa')]&&_0x34e4b9['body'][_0x275d('0x17')]){var _0x3ba469=path[_0x275d('0x18')](__dirname,_0x275d('0x19'),_0x34e4b9[_0x275d('0x16')][_0x275d('0x17')]);var _0x1339a4=process[_0x275d('0x1a')]();process[_0x275d('0x1b')](path[_0x275d('0x1c')](_0x3ba469));return execChildProcess()[_0x275d('0x15')](function(_0x26c528){process[_0x275d('0x1b')](_0x1339a4);return pm2[_0x275d('0x1d')]({'name':_0x34e4b9['body'][_0x275d('0xa')],'script':_0x3ba469});})[_0x275d('0x15')](function(_0x35d06f){pm2[_0x275d('0x1e')]();return _0x35d06f[0x0];})['then'](respondWithResult(_0x5e553f,0xc9))['catch'](handleError(_0x5e553f,null));}else{return _0x5e553f[_0x275d('0x8')](0x1f4)['send']({'message':_0x275d('0x1f')});}};exports[_0x275d('0x20')]=function(_0x33a3b3,_0x59f789){if(_0x33a3b3[_0x275d('0x16')]['id']){delete _0x33a3b3[_0x275d('0x16')]['id'];}var _0x138087={'online':'restart','stopped':'stop'};if(_0x138087[_0x275d('0x21')](_0x33a3b3[_0x275d('0x16')][_0x275d('0x8')])){return pm2[_0x138087[_0x33a3b3[_0x275d('0x16')][_0x275d('0x8')]]](_0x33a3b3[_0x275d('0x22')]['id'])[_0x275d('0x15')](respondWithResult(_0x59f789,0xc8))[_0x275d('0x23')](handleError(_0x59f789,null));}else{return _0x59f789[_0x275d('0x8')](0x1f4)[_0x275d('0xb')]({'message':_0x275d('0x24')});}};exports[_0x275d('0x25')]=function(_0x591c2c,_0xee2671){if(_0x591c2c['body']['id']){delete _0x591c2c[_0x275d('0x16')]['id'];}if(_0x591c2c[_0x275d('0x22')]['id']){return pm2[_0x275d('0x26')](_0x591c2c[_0x275d('0x22')]['id'])[_0x275d('0x15')](function(_0x4c6d2e){pm2[_0x275d('0x1e')]();return _0x4c6d2e[0x0];})[_0x275d('0x15')](respondWithResult(_0xee2671,null))[_0x275d('0x23')](handleError(_0xee2671,null));}else{return _0xee2671[_0x275d('0x8')](0x1f4)[_0x275d('0xb')]({'message':_0x275d('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index e13ca61..dcccca9 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 _0x4e83=['connect-timeout','express','Router','../../components/auth/service','multer','path'];(function(_0x214946,_0x38dbbc){var _0x1054d2=function(_0x43e7a0){while(--_0x43e7a0){_0x214946['push'](_0x214946['shift']());}};_0x1054d2(++_0x38dbbc);}(_0x4e83,0x1ae));var _0x34e8=function(_0x141908,_0x4e61dc){_0x141908=_0x141908-0x0;var _0x37e9c9=_0x4e83[_0x141908];return _0x37e9c9;};'use strict';var multer=require(_0x34e8('0x0'));var util=require('util');var path=require(_0x34e8('0x1'));var timeout=require(_0x34e8('0x2'));var express=require(_0x34e8('0x3'));var router=express[_0x34e8('0x4')]();var auth=require(_0x34e8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x1c3b=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xd21304,_0x5939a3){var _0x245a1d=function(_0x456e68){while(--_0x456e68){_0xd21304['push'](_0xd21304['shift']());}};_0x245a1d(++_0x5939a3);}(_0x1c3b,0xab));var _0xb1c3=function(_0x4776cf,_0x1ff4bb){_0x4776cf=_0x4776cf-0x0;var _0x1b8e94=_0x1c3b[_0x4776cf];return _0x1b8e94;};'use strict';var multer=require(_0xb1c3('0x0'));var util=require(_0xb1c3('0x1'));var path=require(_0xb1c3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb1c3('0x3')]();var auth=require(_0xb1c3('0x4'));var interaction=require(_0xb1c3('0x5'));var config=require(_0xb1c3('0x6'));module[_0xb1c3('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 33ab351..666b91c 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 _0x682c=['DATE','exports','INTEGER','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x682c,0xb1));var _0xc682=function(_0xec43a,_0x3c0bc9){_0xec43a=_0xec43a-0x0;var _0x2fdd50=_0x682c[_0xec43a];return _0x2fdd50;};'use strict';var Sequelize=require('sequelize');module[_0xc682('0x0')]={'state':{'type':Sequelize[_0xc682('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc682('0x2')]},'scheduledat':{'type':Sequelize[_0xc682('0x3')]},'uniqueid':{'type':Sequelize[_0xc682('0x2')]},'starttime':{'type':Sequelize[_0xc682('0x3')]},'responsetime':{'type':Sequelize[_0xc682('0x3')]},'ringtime':{'type':Sequelize[_0xc682('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc682('0x2')]}}; \ No newline at end of file +var _0x3cee=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x45b374,_0x20dccb){var _0x24fc74=function(_0x357eaf){while(--_0x357eaf){_0x45b374['push'](_0x45b374['shift']());}};_0x24fc74(++_0x20dccb);}(_0x3cee,0x188));var _0xe3ce=function(_0x4cc74f,_0x2efb25){_0x4cc74f=_0x4cc74f-0x0;var _0x5d0e73=_0x3cee[_0x4cc74f];return _0x5d0e73;};'use strict';var Sequelize=require(_0xe3ce('0x0'));module[_0xe3ce('0x1')]={'state':{'type':Sequelize[_0xe3ce('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe3ce('0x3')]},'scheduledat':{'type':Sequelize[_0xe3ce('0x4')]},'uniqueid':{'type':Sequelize[_0xe3ce('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe3ce('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xe3ce('0x3')]},'campaigntype':{'type':Sequelize[_0xe3ce('0x3')]},'membername':{'type':Sequelize[_0xe3ce('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index e5485f6..e764225 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 _0x3781=['../../config/logger','api','moment','bluebird','request-promise','./reportAgentPreview.attributes','exports','report_agent_preview','lodash','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3781,0x116));var _0x1378=function(_0xb7e28a,_0x5cf4be){_0xb7e28a=_0xb7e28a-0x0;var _0x369be6=_0x3781[_0xb7e28a];return _0x369be6;};'use strict';var _=require(_0x1378('0x0'));var util=require(_0x1378('0x1'));var logger=require(_0x1378('0x2'))(_0x1378('0x3'));var moment=require(_0x1378('0x4'));var BPromise=require(_0x1378('0x5'));var rp=require(_0x1378('0x6'));var attributes=require(_0x1378('0x7'));module[_0x1378('0x8')]=function(_0x53cb28,_0x70aff7){return _0x53cb28['define']('ReportAgentPreview',attributes,{'tableName':_0x1378('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa06a=['util','../../config/logger','api','moment','bluebird','request-promise','./reportAgentPreview.attributes','define','report_agent_preview','lodash'];(function(_0x465df4,_0x3538b0){var _0x51ca29=function(_0x1034d2){while(--_0x1034d2){_0x465df4['push'](_0x465df4['shift']());}};_0x51ca29(++_0x3538b0);}(_0xa06a,0x17b));var _0xaa06=function(_0x1ae15e,_0x27172f){_0x1ae15e=_0x1ae15e-0x0;var _0x5e23b6=_0xa06a[_0x1ae15e];return _0x5e23b6;};'use strict';var _=require(_0xaa06('0x0'));var util=require(_0xaa06('0x1'));var logger=require(_0xaa06('0x2'))(_0xaa06('0x3'));var moment=require(_0xaa06('0x4'));var BPromise=require(_0xaa06('0x5'));var rp=require(_0xaa06('0x6'));var attributes=require(_0xaa06('0x7'));module['exports']=function(_0x598cbd,_0x185bd7){return _0x598cbd[_0xaa06('0x8')]('ReportAgentPreview',attributes,{'tableName':_0xaa06('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 f4da19e..0d3634e 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 _0x9b0f=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b0f,0x1a3));var _0xf9b0=function(_0x3acef9,_0x65d155){_0x3acef9=_0x3acef9-0x0;var _0x4bb694=_0x9b0f[_0x3acef9];return _0x4bb694;};'use strict';var _=require('lodash');var util=require(_0xf9b0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf9b0('0x1'));var fs=require('fs');var Redis=require(_0xf9b0('0x2'));var db=require(_0xf9b0('0x3'))['db'];var utils=require(_0xf9b0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf9b0('0x5'));var jayson=require(_0xf9b0('0x6'));var client=jayson[_0xf9b0('0x7')][_0xf9b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c2a86,_0x2be2f7,_0x1464a5){return new BPromise(function(_0x40c4d5,_0x42bebb){return client[_0xf9b0('0x9')](_0x1c2a86,_0x1464a5)[_0xf9b0('0xa')](function(_0x3da95a){logger[_0xf9b0('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x2be2f7,_0xf9b0('0xc'));logger[_0xf9b0('0xd')](_0xf9b0('0xe'),_0x2be2f7,'request\x20sent',JSON[_0xf9b0('0xf')](_0x3da95a));if(_0x3da95a[_0xf9b0('0x10')]){if(_0x3da95a[_0xf9b0('0x10')][_0xf9b0('0x11')]===0x1f4){logger[_0xf9b0('0x10')](_0xf9b0('0x12'),_0x2be2f7,_0x3da95a[_0xf9b0('0x10')][_0xf9b0('0x13')]);return _0x42bebb(_0x3da95a[_0xf9b0('0x10')]['message']);}logger[_0xf9b0('0x10')](_0xf9b0('0x12'),_0x2be2f7,_0x3da95a['error'][_0xf9b0('0x13')]);return _0x40c4d5(_0x3da95a[_0xf9b0('0x10')][_0xf9b0('0x13')]);}else{logger[_0xf9b0('0xb')](_0xf9b0('0x12'),_0x2be2f7,_0xf9b0('0xc'));_0x40c4d5(_0x3da95a[_0xf9b0('0x14')][_0xf9b0('0x13')]);}})[_0xf9b0('0x15')](function(_0x4ef265){logger[_0xf9b0('0x10')](_0xf9b0('0x12'),_0x2be2f7,_0x4ef265);_0x42bebb(_0x4ef265);});});}exports[_0xf9b0('0x16')]=function(_0x4da1e6){var _0x1cc9dc=this;return new Promise(function(_0x4aef14,_0x1e93f3){return db[_0xf9b0('0x17')][_0xf9b0('0x18')](_0x4da1e6[_0xf9b0('0x19')],{'raw':_0x4da1e6[_0xf9b0('0x1a')]?_0x4da1e6[_0xf9b0('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x40885f){logger['info'](_0xf9b0('0x16'),_0x4da1e6);logger[_0xf9b0('0xd')](_0xf9b0('0x16'),_0x4da1e6,JSON[_0xf9b0('0xf')](_0x40885f));_0x4aef14(_0x40885f);})[_0xf9b0('0x15')](function(_0x4d03a4){logger[_0xf9b0('0x10')](_0xf9b0('0x16'),_0x4d03a4[_0xf9b0('0x13')],_0x4da1e6);_0x1e93f3(_0x1cc9dc[_0xf9b0('0x10')](0x1f4,_0x4d03a4[_0xf9b0('0x13')]));});});}; \ No newline at end of file +var _0x0a05=['../../mysqldb','rpc','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ReportAgentPreview','create','options','raw','CreateReportAgentPreview','util','randomstring','ioredis'];(function(_0x25ba51,_0x2ba7e8){var _0x1e5207=function(_0x45c779){while(--_0x45c779){_0x25ba51['push'](_0x25ba51['shift']());}};_0x1e5207(++_0x2ba7e8);}(_0x0a05,0x128));var _0x50a0=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0x0a05[_0xb725be];return _0x2f2424;};'use strict';var _=require('lodash');var util=require(_0x50a0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50a0('0x1'));var fs=require('fs');var Redis=require(_0x50a0('0x2'));var db=require(_0x50a0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x50a0('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5010c8,_0x523d28,_0x4be4ba){return new BPromise(function(_0x34bac1,_0xc9f0f7){return client[_0x50a0('0x5')](_0x5010c8,_0x4be4ba)[_0x50a0('0x6')](function(_0x2cf98b){logger[_0x50a0('0x7')](_0x50a0('0x8'),_0x523d28,_0x50a0('0x9'));logger[_0x50a0('0xa')](_0x50a0('0xb'),_0x523d28,_0x50a0('0x9'),JSON[_0x50a0('0xc')](_0x2cf98b));if(_0x2cf98b[_0x50a0('0xd')]){if(_0x2cf98b[_0x50a0('0xd')][_0x50a0('0xe')]===0x1f4){logger[_0x50a0('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x523d28,_0x2cf98b['error'][_0x50a0('0xf')]);return _0xc9f0f7(_0x2cf98b[_0x50a0('0xd')][_0x50a0('0xf')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x523d28,_0x2cf98b[_0x50a0('0xd')][_0x50a0('0xf')]);return _0x34bac1(_0x2cf98b['error']['message']);}else{logger[_0x50a0('0x7')](_0x50a0('0x8'),_0x523d28,'request\x20sent');_0x34bac1(_0x2cf98b[_0x50a0('0x10')][_0x50a0('0xf')]);}})[_0x50a0('0x11')](function(_0x587faa){logger[_0x50a0('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x523d28,_0x587faa);_0xc9f0f7(_0x587faa);});});}exports['CreateReportAgentPreview']=function(_0x291a3f){var _0x2daac7=this;return new Promise(function(_0x2da37c,_0x486849){return db[_0x50a0('0x12')][_0x50a0('0x13')](_0x291a3f['body'],{'raw':_0x291a3f[_0x50a0('0x14')]?_0x291a3f[_0x50a0('0x14')][_0x50a0('0x15')]===undefined?!![]:![]:!![]})[_0x50a0('0x6')](function(_0x5b86de){logger['info'](_0x50a0('0x16'),_0x291a3f);logger[_0x50a0('0xa')](_0x50a0('0x16'),_0x291a3f,JSON[_0x50a0('0xc')](_0x5b86de));_0x2da37c(_0x5b86de);})[_0x50a0('0x11')](function(_0x444072){logger[_0x50a0('0xd')](_0x50a0('0x16'),_0x444072['message'],_0x291a3f);_0x486849(_0x2daac7['error'](0x1f4,_0x444072[_0x50a0('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index de63138..3c7b836 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 _0x1c17=['sms','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','put','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x1c17,0x1d9));var _0x71c1=function(_0x14a066,_0x3fcf1a){_0x14a066=_0x14a066-0x0;var _0x1b96ed=_0x1c17[_0x14a066];return _0x1b96ed;};'use strict';var multer=require(_0x71c1('0x0'));var util=require(_0x71c1('0x1'));var path=require(_0x71c1('0x2'));var express=require(_0x71c1('0x3'));var router=express[_0x71c1('0x4')]();var auth=require(_0x71c1('0x5'));var controller=require(_0x71c1('0x6'));router[_0x71c1('0x7')]('/voice/channels',auth['isAuthenticated'](),controller['voiceChannels']);router[_0x71c1('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x71c1('0x8')](),controller[_0x71c1('0x9')]);router[_0x71c1('0x7')](_0x71c1('0xa'),auth['isAuthenticated'](),controller[_0x71c1('0xb')]);router[_0x71c1('0x7')](_0x71c1('0xc'),auth[_0x71c1('0x8')](),controller[_0x71c1('0xd')]);router[_0x71c1('0x7')](_0x71c1('0xe'),auth[_0x71c1('0x8')](),controller[_0x71c1('0xf')]);router['get'](_0x71c1('0x10'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x11')]);router[_0x71c1('0x7')](_0x71c1('0x12'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x13')]);router['get'](_0x71c1('0x14'),auth['isAuthenticated'](),controller[_0x71c1('0x15')]);router[_0x71c1('0x7')](_0x71c1('0x16'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x17')]);router[_0x71c1('0x7')](_0x71c1('0x18'),auth[_0x71c1('0x8')](),controller['faxQueues']);router[_0x71c1('0x7')](_0x71c1('0x19'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x1a')]);router[_0x71c1('0x7')](_0x71c1('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x71c1('0x7')](_0x71c1('0x1c'),auth['isAuthenticated'](),controller[_0x71c1('0x1d')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x71c1('0x1e')]);router[_0x71c1('0x7')](_0x71c1('0x1f'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x20')]);router['get'](_0x71c1('0x21'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x22')]);router[_0x71c1('0x7')](_0x71c1('0x23'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x24')]);router['get'](_0x71c1('0x25'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0x71c1('0x7')](_0x71c1('0x26'),auth[_0x71c1('0x8')](),controller['agents']);router[_0x71c1('0x27')](_0x71c1('0x28'),auth[_0x71c1('0x8')](),controller['agentCapacity']);router['get'](_0x71c1('0x29'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x2a')]);router[_0x71c1('0x7')](_0x71c1('0x2b'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x2c')]);router[_0x71c1('0x7')](_0x71c1('0x2d'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x2e')]);router[_0x71c1('0x7')]('/fax/accounts',auth[_0x71c1('0x8')](),controller[_0x71c1('0x2f')]);router[_0x71c1('0x7')](_0x71c1('0x30'),auth['isAuthenticated'](),controller[_0x71c1('0x31')]);router[_0x71c1('0x7')](_0x71c1('0x32'),auth['isAuthenticated'](),controller[_0x71c1('0x33')]);router['get'](_0x71c1('0x34'),auth['isAuthenticated'](),controller[_0x71c1('0x35')]);router['get'](_0x71c1('0x36'),auth[_0x71c1('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x71c1('0x7')](_0x71c1('0x37'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x38')]);router['post'](_0x71c1('0x39'),auth['isAuthenticated'](),controller[_0x71c1('0x3a')](_0x71c1('0x3b')));router['get'](_0x71c1('0x3c'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x3d')]);router[_0x71c1('0x3e')](_0x71c1('0x3f'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x3a')]('chat'));router[_0x71c1('0x7')](_0x71c1('0x40'),auth[_0x71c1('0x8')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0x71c1('0x8')](),controller['queueNotify'](_0x71c1('0x41')));router[_0x71c1('0x7')](_0x71c1('0x42'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x43')]);router[_0x71c1('0x3e')](_0x71c1('0x44'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x3a')](_0x71c1('0x45')));router[_0x71c1('0x7')](_0x71c1('0x46'),auth['isAuthenticated'](),controller[_0x71c1('0x47')]);router[_0x71c1('0x3e')](_0x71c1('0x48'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x3a')](_0x71c1('0x49')));router['get'](_0x71c1('0x4a'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x4b')]);router[_0x71c1('0x3e')](_0x71c1('0x4c'),auth[_0x71c1('0x8')](),controller[_0x71c1('0x4d')]);module['exports']=router; \ No newline at end of file +var _0xcd26=['faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','agentNotify','exports','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/fax/queues'];(function(_0x5ee2db,_0x47ea25){var _0x2cab07=function(_0x4643f7){while(--_0x4643f7){_0x5ee2db['push'](_0x5ee2db['shift']());}};_0x2cab07(++_0x47ea25);}(_0xcd26,0x77));var _0x6cd2=function(_0x292911,_0x279a2e){_0x292911=_0x292911-0x0;var _0x18dee9=_0xcd26[_0x292911];return _0x18dee9;};'use strict';var multer=require('multer');var util=require(_0x6cd2('0x0'));var path=require('path');var express=require(_0x6cd2('0x1'));var router=express[_0x6cd2('0x2')]();var auth=require(_0x6cd2('0x3'));var controller=require(_0x6cd2('0x4'));router[_0x6cd2('0x5')](_0x6cd2('0x6'),auth[_0x6cd2('0x7')](),controller['voiceChannels']);router['get'](_0x6cd2('0x8'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x9')]);router[_0x6cd2('0x5')](_0x6cd2('0xa'),auth['isAuthenticated'](),controller[_0x6cd2('0xb')]);router['get'](_0x6cd2('0xc'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0xd')]);router['get'](_0x6cd2('0xe'),auth['isAuthenticated'](),controller[_0x6cd2('0xf')]);router[_0x6cd2('0x5')]('/mail/queues',auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x10')]);router[_0x6cd2('0x5')](_0x6cd2('0x11'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x12')]);router['get'](_0x6cd2('0x13'),auth['isAuthenticated'](),controller[_0x6cd2('0x14')]);router[_0x6cd2('0x5')]('/sms/queues',auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x15')]);router[_0x6cd2('0x5')](_0x6cd2('0x16'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x17')]);router['get'](_0x6cd2('0x18'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x19')]);router['get'](_0x6cd2('0x1a'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x1b')]);router[_0x6cd2('0x5')](_0x6cd2('0x1c'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x1d')]);router[_0x6cd2('0x5')](_0x6cd2('0x1e'),auth['isAuthenticated'](),controller[_0x6cd2('0x1f')]);router[_0x6cd2('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x6cd2('0x7')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x6cd2('0x20'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x21')]);router[_0x6cd2('0x5')]('/outbound',auth[_0x6cd2('0x7')](),controller['outbound']);router[_0x6cd2('0x5')](_0x6cd2('0x22'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x23')]);router[_0x6cd2('0x5')]('/agents',auth['isAuthenticated'](),controller[_0x6cd2('0x24')]);router[_0x6cd2('0x25')](_0x6cd2('0x26'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x6cd2('0x5')](_0x6cd2('0x27'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x28')]);router[_0x6cd2('0x5')](_0x6cd2('0x29'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x2a')]);router[_0x6cd2('0x5')](_0x6cd2('0x2b'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x2c')]);router[_0x6cd2('0x5')]('/fax/accounts',auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x2d')]);router[_0x6cd2('0x5')](_0x6cd2('0x2e'),auth[_0x6cd2('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0x6cd2('0x5')](_0x6cd2('0x2f'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x30')]);router[_0x6cd2('0x5')](_0x6cd2('0x31'),auth[_0x6cd2('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0x6cd2('0x5')](_0x6cd2('0x32'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x6cd2('0x5')]('/fax/queues/waitinginteractions',auth[_0x6cd2('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x6cd2('0x33')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x6cd2('0x34')](_0x6cd2('0x35')));router['get'](_0x6cd2('0x36'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x37')]);router['post']('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x6cd2('0x34')](_0x6cd2('0x38')));router[_0x6cd2('0x5')]('/chat/queues/:id',auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x39')]);router[_0x6cd2('0x33')](_0x6cd2('0x3a'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x34')](_0x6cd2('0x3b')));router['get']('/fax/queues/:id',auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x3c')]);router['post'](_0x6cd2('0x3d'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x34')](_0x6cd2('0x3e')));router[_0x6cd2('0x5')](_0x6cd2('0x3f'),auth['isAuthenticated'](),controller[_0x6cd2('0x40')]);router['post'](_0x6cd2('0x41'),auth['isAuthenticated'](),controller[_0x6cd2('0x34')](_0x6cd2('0x42')));router[_0x6cd2('0x5')](_0x6cd2('0x43'),auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x44')]);router['post']('/agents/:id/notify',auth[_0x6cd2('0x7')](),controller[_0x6cd2('0x45')]);module[_0x6cd2('0x46')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 6b21ae5..14c9756 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 _0xbcef=['mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','faxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','Account','queue','MessageId','InteractionId','From','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','update','moment','lodash','util','../../mysqldb','api','client','http','request','error','code','message','result','catch','json','sendStatus','name','status','send','isNil','rows','find','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','params','then','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','interface','SIP/%s','agent','AgentCapacity','capacity','telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0xbcef,0x115));var _0xfbce=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xbcef[_0x3b380d];return _0x54502b;};'use strict';var BPromise=require('bluebird');var moment=require(_0xfbce('0x0'));var _=require(_0xfbce('0x1'));var util=require(_0xfbce('0x2'));var db=require(_0xfbce('0x3'))['db'];var logger=require('../../config/logger')(_0xfbce('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xfbce('0x5')][_0xfbce('0x6')]({'port':0x232a});var mailClient=jayson[_0xfbce('0x5')][_0xfbce('0x6')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3a4d3e,_0x6adef4,_0x224d4e){return new BPromise(function(_0x11d514,_0x4f7ae7){var _0x113bfb=_0x224d4e?_0x224d4e:amiClient;return _0x113bfb[_0xfbce('0x7')](_0x3a4d3e,_0x6adef4)['then'](function(_0x51dd93){if(_0x51dd93[_0xfbce('0x8')]){if(_0x51dd93[_0xfbce('0x8')][_0xfbce('0x9')]===0x1f4){return _0x4f7ae7(_0x51dd93['error'][_0xfbce('0xa')]);}return _0x11d514(_0x51dd93['error'][_0xfbce('0xa')]);}else{_0x11d514(_0x51dd93[_0xfbce('0xb')]);}})[_0xfbce('0xc')](function(_0xa51703){_0x4f7ae7(_0xa51703);});});}function respondWithResult(_0xce85a,_0x35be1b){_0x35be1b=_0x35be1b||0xc8;return function(_0x4c85f6){if(_0x4c85f6){return _0xce85a['status'](_0x35be1b)[_0xfbce('0xd')](_0x4c85f6);}return _0xce85a[_0xfbce('0xe')](0x194);};}function handleError(_0x480ea4,_0x8cc80c){_0x8cc80c=_0x8cc80c||0x1f4;return function(_0x1a8412){logger[_0xfbce('0x8')](_0x1a8412['stack']);if(_0x1a8412[_0xfbce('0xf')]){delete _0x1a8412[_0xfbce('0xf')];}_0x480ea4[_0xfbce('0x10')](_0x8cc80c)[_0xfbce('0x11')](_0x1a8412);};}function findById(_0x5703d8){return function(_0x4ee502){if(!_[_0xfbce('0x12')](_0x5703d8)&&!_[_0xfbce('0x12')](_0x4ee502)&&!_[_0xfbce('0x12')](_0x4ee502[_0xfbce('0x13')])){return _[_0xfbce('0x14')](_0x4ee502[_0xfbce('0x13')],function(_0x373a3c){return _0x373a3c['id']==_0x5703d8;});}return null;};}exports[_0xfbce('0x15')]=function(_0x5420d2,_0x3f1104){return respondWithRpcPromise(_0xfbce('0x16'),_0x5420d2[_0xfbce('0x17')])['then'](respondWithResult(_0x3f1104,null))[_0xfbce('0xc')](handleError(_0x3f1104,null));};exports['voiceChannelMixMonitor']=function(_0x25d55a,_0x4c21fd){return respondWithRpcPromise(_0xfbce('0x18'),_['merge'](_0x25d55a['query'],_0x25d55a[_0xfbce('0x19')]))[_0xfbce('0x1a')](respondWithResult(_0x4c21fd,null))['catch'](handleError(_0x4c21fd,null));};exports['voiceChannelStopMixMonitor']=function(_0x35e87d,_0x407d62){return respondWithRpcPromise(_0xfbce('0x1b'),_[_0xfbce('0x1c')](_0x35e87d['query'],_0x35e87d['params']))[_0xfbce('0x1a')](respondWithResult(_0x407d62,null))['catch'](handleError(_0x407d62,null));};exports[_0xfbce('0x1d')]=function(_0x473ebe,_0x30c81c){return respondWithRpcPromise(_0xfbce('0x1e'),_0x473ebe[_0xfbce('0x17')])[_0xfbce('0x1a')](respondWithResult(_0x30c81c,null))['catch'](handleError(_0x30c81c,null));};exports[_0xfbce('0x1f')]=function(_0x4e3653,_0x2d7191){return respondWithRpcPromise(_0xfbce('0x1e'),_0x4e3653[_0xfbce('0x17')])[_0xfbce('0x1a')](findById(_0x4e3653[_0xfbce('0x19')]['id']))[_0xfbce('0x1a')](respondWithResult(_0x2d7191,null))['catch'](handleError(_0x2d7191,null));};exports[_0xfbce('0x20')]=function(_0x25b48e,_0x5defa2){return respondWithRpcPromise(_0xfbce('0x21'),_[_0xfbce('0x1c')](_0x25b48e[_0xfbce('0x17')],_0x25b48e[_0xfbce('0x19')]))[_0xfbce('0x1a')](respondWithResult(_0x5defa2,null))[_0xfbce('0xc')](handleError(_0x5defa2,null));};exports[_0xfbce('0x22')]=function(_0x510ea9,_0x12ef31){return respondWithRpcPromise(_0xfbce('0x23'),_0x510ea9[_0xfbce('0x17')])['then'](respondWithResult(_0x12ef31,null))[_0xfbce('0xc')](handleError(_0x12ef31,null));};exports[_0xfbce('0x24')]=function(_0x276905,_0x506457){return respondWithRpcPromise(_0xfbce('0x25'),_[_0xfbce('0x1c')](_0x276905['query'],_0x276905['params']))[_0xfbce('0x1a')](respondWithResult(_0x506457,null))['catch'](handleError(_0x506457,null));};exports[_0xfbce('0x26')]=function(_0x557623,_0x19976b){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xfbce('0x1c')](_0x557623[_0xfbce('0x17')],_0x557623[_0xfbce('0x19')]))[_0xfbce('0x1a')](respondWithResult(_0x19976b,null))[_0xfbce('0xc')](handleError(_0x19976b,null));};exports[_0xfbce('0x27')]=function(_0x5ae3cc,_0x3fd80f){return respondWithRpcPromise(_0xfbce('0x28'),_['merge'](_0x5ae3cc[_0xfbce('0x17')],_0x5ae3cc['params']))[_0xfbce('0x1a')](respondWithResult(_0x3fd80f,null))['catch'](handleError(_0x3fd80f,null));};exports[_0xfbce('0x29')]=function(_0xdf64fd,_0x315828){return respondWithRpcPromise(_0xfbce('0x2a'),_0xdf64fd[_0xfbce('0x17')])[_0xfbce('0x1a')](respondWithResult(_0x315828,null))['catch'](handleError(_0x315828,null));};exports[_0xfbce('0x2b')]=function(_0x2061c1,_0x4181d7){return respondWithRpcPromise(_0xfbce('0x2c'),_0x2061c1['query'])[_0xfbce('0x1a')](respondWithResult(_0x4181d7,null))['catch'](handleError(_0x4181d7,null));};exports[_0xfbce('0x2d')]=function(_0x1ec5d5,_0x181303){var _0x13f461;return respondWithRpcPromise(_0xfbce('0x2e'),_0x1ec5d5[_0xfbce('0x17')])[_0xfbce('0x1a')](function(_0x50883b){_0x13f461=_0x50883b;return respondWithRpcPromise(_0xfbce('0x2e'),_0x1ec5d5['query'],routingClient);})[_0xfbce('0x1a')](function(_0x599b9e){return _[_0xfbce('0x1c')]({},_0x599b9e,_0x13f461);})[_0xfbce('0x1a')](respondWithResult(_0x181303,null))[_0xfbce('0xc')](handleError(_0x181303,null));};exports[_0xfbce('0x2f')]=function(_0xb673f9,_0x281144){if(_0xb673f9[_0xfbce('0x30')]&&_0xb673f9['body'][_0xfbce('0x31')]&&_0xb673f9[_0xfbce('0x32')]&&_0xb673f9[_0xfbce('0x32')][_0xfbce('0xf')]){for(var _0x58a9ff in _0xb673f9['body'][_0xfbce('0x31')]){if(_0xb673f9[_0xfbce('0x30')][_0xfbce('0x31')][_0xfbce('0x33')](_0x58a9ff)){db[_0xfbce('0x34')][_0xfbce('0x35')]({'where':{'channel':_0x58a9ff,'membername':_0xb673f9[_0xfbce('0x32')][_0xfbce('0xf')],'type':_0xfbce('0x36'),'exitAt':null,'uniqueid':_0xb673f9[_0xfbce('0x30')]['interaction'][_0x58a9ff]&&_0xb673f9[_0xfbce('0x30')]['interaction'][_0x58a9ff]['length']?{'$notIn':_0xb673f9['body'][_0xfbce('0x31')][_0x58a9ff]}:{'$ne':null}}})['then'](function(_0x5b3972){var _0x376f75=moment()[_0xfbce('0x37')](_0xfbce('0x38'));for(var _0x5e43d2=0x0,_0x2fe23d=_0x5b3972['length'];_0x5e43d2<_0x2fe23d;_0x5e43d2+=0x1){_0x5b3972[_0x5e43d2][_0xfbce('0x39')]({'exitAt':_0x376f75});}});for(var _0x51673a=0x0;_0x51673a<_0xb673f9[_0xfbce('0x30')][_0xfbce('0x31')][_0x58a9ff][_0xfbce('0x3a')];_0x51673a+=0x1){db[_0xfbce('0x34')]['findOrCreate']({'where':{'channel':_0x58a9ff,'membername':_0xb673f9[_0xfbce('0x32')][_0xfbce('0xf')],'type':_0xfbce('0x36'),'uniqueid':_0xb673f9[_0xfbce('0x30')][_0xfbce('0x31')][_0x58a9ff][_0x51673a],'exitAt':null},'defaults':{'channel':_0x58a9ff,'membername':_0xb673f9[_0xfbce('0x32')]['name'],'interface':_[_0xfbce('0x12')](_0xb673f9[_0xfbce('0x32')][_0xfbce('0x3b')])?util[_0xfbce('0x37')](_0xfbce('0x3c'),_0xb673f9[_0xfbce('0x32')][_0xfbce('0xf')]):_0xb673f9[_0xfbce('0x32')][_0xfbce('0x3b')],'type':_0xfbce('0x36'),'enterAt':moment()[_0xfbce('0x37')](_0xfbce('0x38')),'role':_0xfbce('0x3d'),'internal':_0xb673f9[_0xfbce('0x32')]['internal'],'uniqueid':_0xb673f9[_0xfbce('0x30')]['interaction'][_0x58a9ff][_0x51673a]}});}}}}return respondWithRpcPromise(_0xfbce('0x3e'),{'id':_0xb673f9['params']['id'],'capacity':_0xb673f9[_0xfbce('0x30')][_0xfbce('0x3f')]},routingClient)[_0xfbce('0x1a')](respondWithResult(_0x281144,null))[_0xfbce('0xc')](handleError(_0x281144,null));};exports[_0xfbce('0x40')]=function(_0x3f919e,_0xd1a4b5){return respondWithRpcPromise('Telephones',_0x3f919e[_0xfbce('0x17')])[_0xfbce('0x1a')](respondWithResult(_0xd1a4b5,null))['catch'](handleError(_0xd1a4b5,null));};exports['trunks']=function(_0x2ecca0,_0x40765b){return respondWithRpcPromise(_0xfbce('0x41'),_0x2ecca0['query'])[_0xfbce('0x1a')](respondWithResult(_0x40765b,null))[_0xfbce('0xc')](handleError(_0x40765b,null));};exports[_0xfbce('0x42')]=function(_0xfe27eb,_0x1e3591){return respondWithRpcPromise(_0xfbce('0x43'),_0xfe27eb[_0xfbce('0x17')])[_0xfbce('0x1a')](respondWithResult(_0x1e3591,null))[_0xfbce('0xc')](handleError(_0x1e3591,null));};exports[_0xfbce('0x44')]=function(_0x3f99b3,_0x53d46f){return respondWithRpcPromise(_0xfbce('0x45'),_0x3f99b3[_0xfbce('0x17')],routingClient)[_0xfbce('0x1a')](respondWithResult(_0x53d46f,null))[_0xfbce('0xc')](handleError(_0x53d46f,null));};exports[_0xfbce('0x46')]=function(_0x2c698b,_0x4331c4){return respondWithRpcPromise(_0xfbce('0x45'),_0x2c698b[_0xfbce('0x17')],routingClient)['then'](findById(_0x2c698b[_0xfbce('0x19')]['id']))[_0xfbce('0x1a')](respondWithResult(_0x4331c4,null))['catch'](handleError(_0x4331c4,null));};exports[_0xfbce('0x47')]=function(_0x1a3bf7,_0x1d6d54){return respondWithRpcPromise('MailQueues',_0x1a3bf7[_0xfbce('0x17')],routingClient)[_0xfbce('0x1a')](respondWithResult(_0x1d6d54,null))[_0xfbce('0xc')](handleError(_0x1d6d54,null));};exports[_0xfbce('0x48')]=function(_0x49d949,_0x2e447f){return respondWithRpcPromise(_0xfbce('0x49'),_0x49d949[_0xfbce('0x17')],routingClient)[_0xfbce('0x1a')](findById(_0x49d949['params']['id']))['then'](respondWithResult(_0x2e447f,null))[_0xfbce('0xc')](handleError(_0x2e447f,null));};exports[_0xfbce('0x4a')]=function(_0x16a54f,_0x272e2c){return respondWithRpcPromise(_0xfbce('0x4b'),_0x16a54f[_0xfbce('0x17')],mailClient)[_0xfbce('0x1a')](respondWithResult(_0x272e2c,null))[_0xfbce('0xc')](handleError(_0x272e2c,null));};exports[_0xfbce('0x4c')]=function(_0x92dda7,_0x42a7af){return respondWithRpcPromise('OpenchannelQueues',_0x92dda7[_0xfbce('0x17')],routingClient)[_0xfbce('0x1a')](respondWithResult(_0x42a7af,null))[_0xfbce('0xc')](handleError(_0x42a7af,null));};exports['showOpenchannelQueues']=function(_0x332f17,_0x4b683b){return respondWithRpcPromise(_0xfbce('0x4d'),_0x332f17[_0xfbce('0x17')],routingClient)[_0xfbce('0x1a')](findById(_0x332f17[_0xfbce('0x19')]['id']))[_0xfbce('0x1a')](respondWithResult(_0x4b683b,null))[_0xfbce('0xc')](handleError(_0x4b683b,null));};exports[_0xfbce('0x4e')]=function(_0x56ddfd,_0x274a1c){return respondWithRpcPromise('SmsQueues',_0x56ddfd['query'],routingClient)[_0xfbce('0x1a')](respondWithResult(_0x274a1c,null))[_0xfbce('0xc')](handleError(_0x274a1c,null));};exports[_0xfbce('0x4f')]=function(_0x16bf0f,_0x1a5857){return respondWithRpcPromise(_0xfbce('0x50'),_0x16bf0f[_0xfbce('0x17')],routingClient)[_0xfbce('0x1a')](findById(_0x16bf0f['params']['id']))[_0xfbce('0x1a')](respondWithResult(_0x1a5857,null))[_0xfbce('0xc')](handleError(_0x1a5857,null));};exports[_0xfbce('0x51')]=function(_0x195aab,_0x5e2b53){return respondWithRpcPromise('FaxQueues',_0x195aab['query'],routingClient)['then'](respondWithResult(_0x5e2b53,null))[_0xfbce('0xc')](handleError(_0x5e2b53,null));};exports['showFaxQueues']=function(_0x5cfc5e,_0x42adc8){return respondWithRpcPromise(_0xfbce('0x52'),_0x5cfc5e[_0xfbce('0x17')],routingClient)[_0xfbce('0x1a')](findById(_0x5cfc5e[_0xfbce('0x19')]['id']))[_0xfbce('0x1a')](respondWithResult(_0x42adc8,null))[_0xfbce('0xc')](handleError(_0x42adc8,null));};exports['faxAccounts']=function(_0x1dd234,_0x2c278d){return respondWithRpcPromise(_0xfbce('0x53'),_0x1dd234['query'])[_0xfbce('0x1a')](respondWithResult(_0x2c278d,null))[_0xfbce('0xc')](handleError(_0x2c278d,null));};exports[_0xfbce('0x54')]=function(_0x5c56e3,_0x506f1a){return respondWithRpcPromise(_0xfbce('0x55'),_0x5c56e3[_0xfbce('0x17')],routingClient)['then'](respondWithResult(_0x506f1a,null))['catch'](handleError(_0x506f1a,null));};exports[_0xfbce('0x56')]=function(_0x4ec375,_0x159f2d){return respondWithRpcPromise(_0xfbce('0x57'),_0x4ec375[_0xfbce('0x17')],routingClient)['then'](respondWithResult(_0x159f2d,null))['catch'](handleError(_0x159f2d,null));};exports[_0xfbce('0x58')]=function(_0x52641d,_0x39ec1d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x52641d[_0xfbce('0x17')],routingClient)[_0xfbce('0x1a')](respondWithResult(_0x39ec1d,null))['catch'](handleError(_0x39ec1d,null));};exports[_0xfbce('0x59')]=function(_0x26f173,_0x517c64){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x26f173[_0xfbce('0x17')],routingClient)['then'](respondWithResult(_0x517c64,null))[_0xfbce('0xc')](handleError(_0x517c64,null));};exports[_0xfbce('0x5a')]=function(_0x202078,_0x39b4cd){return respondWithRpcPromise(_0xfbce('0x5b'),_0x202078[_0xfbce('0x17')],routingClient)[_0xfbce('0x1a')](respondWithResult(_0x39b4cd,null))[_0xfbce('0xc')](handleError(_0x39b4cd,null));};exports['queueNotify']=function(_0x4d020f){return function(_0x19be51,_0x28e360){var _0x196eb3,_0xa83caf;var _0x409c93=_['capitalize'](_0x4d020f);var _0x107a0a=_0x4d020f===_0xfbce('0x5c')?_0xfbce('0x5d'):'Account';return db[_0x409c93+_0xfbce('0x5e')][_0xfbce('0x5f')]({'raw':!![],'where':{'id':_0x19be51[_0xfbce('0x19')]['id']}})['then'](function(_0x2a1ca4){if(_['isNil'](_0x2a1ca4)){throw new Error(_0x409c93+_0xfbce('0x60'));}_0x196eb3=_0x2a1ca4;return db[_0x409c93+'Message'][_0xfbce('0x5f')]({'where':{'id':_0x19be51[_0xfbce('0x30')][_0xfbce('0x61')]},'include':[{'model':db[_0x409c93+_0xfbce('0x62')],'as':_0xfbce('0x62')},{'model':db[_0x409c93+_0x107a0a],'as':_0xfbce('0x63')}]});})['then'](function(_0x5152b7){if(_['isNil'](_0x5152b7)){throw new Error(_0x409c93+'\x20Message\x20not\x20found');}_0xa83caf=_0x5152b7;return _0x5152b7['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xfbce('0x1a')](function(){var _0x2e3d67={'uniqueid':_0x4d020f+'.'+_0xa83caf['id']+'.'+_0xa83caf[_0xfbce('0x62')]['id'],'FromUserId':_0x19be51[_0xfbce('0x32')]['id'],'type':_0xfbce('0x64')};_0x2e3d67[_0x409c93+_0xfbce('0x65')]=_0xa83caf['id'];_0x2e3d67[_0x409c93+_0xfbce('0x66')]=_0xa83caf[_0xfbce('0x62')]['id'];_0x2e3d67[_0xfbce('0x67')+_0x409c93+_0x107a0a+'Id']=_0xa83caf[_0xfbce('0x63')]['id'];_0x2e3d67['To'+_0x409c93+'QueueId']=_0x196eb3['id'];return db[_0x409c93+'TransferReport'][_0xfbce('0x68')](_0x2e3d67);})[_0xfbce('0x1a')](function(){return respondWithRpcPromise(_0xfbce('0x69'),{'channel':_0x4d020f,'interaction':_0xa83caf[_0xfbce('0x62')],'message':_0xa83caf,'account':_0xa83caf[_0xfbce('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfbce('0x64'),'appdata':_0x196eb3[_0xfbce('0xf')]+','+(_0xa83caf['Account'][_0xfbce('0x6a')]||0x12c),'interval':_0xfbce('0x6b')}]},routingClient);})[_0xfbce('0x1a')](respondWithResult(_0x28e360,null))[_0xfbce('0xc')](handleError(_0x28e360,null));};};exports[_0xfbce('0x6c')]=function(_0x5705da,_0x1dd61e){var _0xf172ce,_0x4fde43;if(_[_0xfbce('0x12')](_0x5705da[_0xfbce('0x30')]['channel'])){throw new Error(_0xfbce('0x6d'));}var _0x4ff6a7=_0x5705da[_0xfbce('0x30')]['channel'];var _0x443de6=_[_0xfbce('0x6e')](_0x4ff6a7);var _0x207438=_0x4ff6a7===_0xfbce('0x5c')?_0xfbce('0x5d'):'Account';return db[_0xfbce('0x6f')][_0xfbce('0x5f')]({'raw':!![],'where':{'id':_0x5705da['params']['id'],'role':_0xfbce('0x3d')}})[_0xfbce('0x1a')](function(_0x77bbb6){if(_[_0xfbce('0x12')](_0x77bbb6)){throw new Error(_0xfbce('0x70'));}_0xf172ce=_0x77bbb6;return db[_0x443de6+_0xfbce('0x71')][_0xfbce('0x5f')]({'where':{'id':_0x5705da[_0xfbce('0x30')][_0xfbce('0x61')]},'include':[{'model':db[_0x443de6+_0xfbce('0x62')],'as':_0xfbce('0x62')},{'model':db[_0x443de6+_0x207438],'as':'Account'}]});})[_0xfbce('0x1a')](function(_0x2f33d6){if(_[_0xfbce('0x12')](_0x2f33d6)){throw new Error(_0x443de6+_0xfbce('0x72'));}_0x4fde43=_0x2f33d6;return _0x2f33d6[_0xfbce('0x73')]({'read':0x0,'readAt':null,'UserId':null});})[_0xfbce('0x1a')](function(){var _0x5ac498={'uniqueid':_0x4ff6a7+'.'+_0x4fde43['id']+'.'+_0x4fde43[_0xfbce('0x62')]['id'],'FromUserId':_0x5705da[_0xfbce('0x32')]['id'],'type':'queue','ToUserId':_0xf172ce['id']};_0x5ac498[_0x443de6+_0xfbce('0x65')]=_0x4fde43['id'];_0x5ac498[_0x443de6+_0xfbce('0x66')]=_0x4fde43['Interaction']['id'];_0x5ac498[_0xfbce('0x67')+_0x443de6+_0x207438+'Id']=_0x4fde43[_0xfbce('0x63')]['id'];return db[_0x443de6+'TransferReport']['create'](_0x5ac498);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x4ff6a7,'interaction':_0x4fde43[_0xfbce('0x62')],'message':_0x4fde43,'account':_0x4fde43[_0xfbce('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfbce('0x3d'),'appdata':_0xf172ce[_0xfbce('0xf')]+','+(_0x4fde43['Account']['agentTransferTimeout']||0x12c),'interval':_0xfbce('0x6b')}]},routingClient);})[_0xfbce('0x1a')](respondWithResult(_0x1dd61e,null))['catch'](handleError(_0x1dd61e,null));}; \ No newline at end of file +var _0x7936=['voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','outboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','interface','SIP/%s','format','agent','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','MessageId','agentTransferTimeout','bluebird','moment','../../mysqldb','../../config/logger','api','jayson/promise','client','http','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','VoiceChannels','query','then','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge'];(function(_0x4959fd,_0x186515){var _0x97de01=function(_0x29e1d0){while(--_0x29e1d0){_0x4959fd['push'](_0x4959fd['shift']());}};_0x97de01(++_0x186515);}(_0x7936,0x12f));var _0x6793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7936[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x6793('0x0'));var moment=require(_0x6793('0x1'));var _=require('lodash');var util=require('util');var db=require(_0x6793('0x2'))['db'];var logger=require(_0x6793('0x3'))(_0x6793('0x4'));var jayson=require(_0x6793('0x5'));var amiClient=jayson[_0x6793('0x6')][_0x6793('0x7')]({'port':0x232a});var mailClient=jayson[_0x6793('0x6')][_0x6793('0x7')]({'port':0x232b});var routingClient=jayson[_0x6793('0x6')][_0x6793('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x207759,_0x221859,_0x13d661){return new BPromise(function(_0x39ccfd,_0x33407c){var _0x422148=_0x13d661?_0x13d661:amiClient;return _0x422148['request'](_0x207759,_0x221859)['then'](function(_0x47a13d){if(_0x47a13d['error']){if(_0x47a13d[_0x6793('0x8')][_0x6793('0x9')]===0x1f4){return _0x33407c(_0x47a13d[_0x6793('0x8')][_0x6793('0xa')]);}return _0x39ccfd(_0x47a13d[_0x6793('0x8')][_0x6793('0xa')]);}else{_0x39ccfd(_0x47a13d[_0x6793('0xb')]);}})[_0x6793('0xc')](function(_0x2677b0){_0x33407c(_0x2677b0);});});}function respondWithResult(_0x164ba0,_0x3cb757){_0x3cb757=_0x3cb757||0xc8;return function(_0x27863e){if(_0x27863e){return _0x164ba0[_0x6793('0xd')](_0x3cb757)[_0x6793('0xe')](_0x27863e);}return _0x164ba0[_0x6793('0xf')](0x194);};}function handleError(_0x1a8c4f,_0x389d51){_0x389d51=_0x389d51||0x1f4;return function(_0x3bb68f){logger[_0x6793('0x8')](_0x3bb68f[_0x6793('0x10')]);if(_0x3bb68f[_0x6793('0x11')]){delete _0x3bb68f['name'];}_0x1a8c4f[_0x6793('0xd')](_0x389d51)[_0x6793('0x12')](_0x3bb68f);};}function findById(_0x73c170){return function(_0x45badb){if(!_[_0x6793('0x13')](_0x73c170)&&!_[_0x6793('0x13')](_0x45badb)&&!_['isNil'](_0x45badb['rows'])){return _['find'](_0x45badb['rows'],function(_0x589faf){return _0x589faf['id']==_0x73c170;});}return null;};}exports['voiceChannels']=function(_0x32a7a2,_0x3a9f56){return respondWithRpcPromise(_0x6793('0x14'),_0x32a7a2[_0x6793('0x15')])[_0x6793('0x16')](respondWithResult(_0x3a9f56,null))[_0x6793('0xc')](handleError(_0x3a9f56,null));};exports['voiceChannelMixMonitor']=function(_0x2cae10,_0x5a1090){return respondWithRpcPromise(_0x6793('0x17'),_['merge'](_0x2cae10[_0x6793('0x15')],_0x2cae10[_0x6793('0x18')]))['then'](respondWithResult(_0x5a1090,null))[_0x6793('0xc')](handleError(_0x5a1090,null));};exports['voiceChannelStopMixMonitor']=function(_0x4d5993,_0x473534){return respondWithRpcPromise(_0x6793('0x19'),_[_0x6793('0x1a')](_0x4d5993[_0x6793('0x15')],_0x4d5993[_0x6793('0x18')]))[_0x6793('0x16')](respondWithResult(_0x473534,null))[_0x6793('0xc')](handleError(_0x473534,null));};exports[_0x6793('0x1b')]=function(_0x21b9fa,_0x179fc6){return respondWithRpcPromise(_0x6793('0x1c'),_0x21b9fa['query'])['then'](respondWithResult(_0x179fc6,null))[_0x6793('0xc')](handleError(_0x179fc6,null));};exports[_0x6793('0x1d')]=function(_0xfc6243,_0x2b6672){return respondWithRpcPromise(_0x6793('0x1c'),_0xfc6243[_0x6793('0x15')])[_0x6793('0x16')](findById(_0xfc6243['params']['id']))[_0x6793('0x16')](respondWithResult(_0x2b6672,null))[_0x6793('0xc')](handleError(_0x2b6672,null));};exports['voiceQueuesPreview']=function(_0x436c2d,_0x4031c1){return respondWithRpcPromise(_0x6793('0x1e'),_['merge'](_0x436c2d[_0x6793('0x15')],_0x436c2d[_0x6793('0x18')]))[_0x6793('0x16')](respondWithResult(_0x4031c1,null))[_0x6793('0xc')](handleError(_0x4031c1,null));};exports[_0x6793('0x1f')]=function(_0x4aa53f,_0x2a7e82){return respondWithRpcPromise(_0x6793('0x20'),_0x4aa53f[_0x6793('0x15')])['then'](respondWithResult(_0x2a7e82,null))['catch'](handleError(_0x2a7e82,null));};exports[_0x6793('0x21')]=function(_0x1b2a05,_0xfb6773){return respondWithRpcPromise(_0x6793('0x22'),_['merge'](_0x1b2a05[_0x6793('0x15')],_0x1b2a05[_0x6793('0x18')]))['then'](respondWithResult(_0xfb6773,null))[_0x6793('0xc')](handleError(_0xfb6773,null));};exports[_0x6793('0x23')]=function(_0x21c654,_0x9f5bf5){return respondWithRpcPromise(_0x6793('0x24'),_[_0x6793('0x1a')](_0x21c654[_0x6793('0x15')],_0x21c654[_0x6793('0x18')]))[_0x6793('0x16')](respondWithResult(_0x9f5bf5,null))[_0x6793('0xc')](handleError(_0x9f5bf5,null));};exports['voiceQueuesChannelRedirect']=function(_0x4c4ab9,_0x1ca01d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x4c4ab9[_0x6793('0x15')],_0x4c4ab9['params']))[_0x6793('0x16')](respondWithResult(_0x1ca01d,null))[_0x6793('0xc')](handleError(_0x1ca01d,null));};exports['outbound']=function(_0x22798d,_0x247cff){return respondWithRpcPromise('Outbound',_0x22798d['query'])[_0x6793('0x16')](respondWithResult(_0x247cff,null))['catch'](handleError(_0x247cff,null));};exports[_0x6793('0x25')]=function(_0x218cab,_0x928f07){return respondWithRpcPromise('OutboundChannels',_0x218cab[_0x6793('0x15')])[_0x6793('0x16')](respondWithResult(_0x928f07,null))[_0x6793('0xc')](handleError(_0x928f07,null));};exports['agents']=function(_0x5e9198,_0x2b7c83){var _0x1ad274;return respondWithRpcPromise(_0x6793('0x26'),_0x5e9198[_0x6793('0x15')])[_0x6793('0x16')](function(_0x4547a4){_0x1ad274=_0x4547a4;return respondWithRpcPromise('Agents',_0x5e9198[_0x6793('0x15')],routingClient);})[_0x6793('0x16')](function(_0x45e5a3){return _['merge']({},_0x45e5a3,_0x1ad274);})['then'](respondWithResult(_0x2b7c83,null))[_0x6793('0xc')](handleError(_0x2b7c83,null));};exports[_0x6793('0x27')]=function(_0x14efda,_0x5d24d9){if(_0x14efda[_0x6793('0x28')]&&_0x14efda[_0x6793('0x28')][_0x6793('0x29')]&&_0x14efda[_0x6793('0x2a')]&&_0x14efda[_0x6793('0x2a')][_0x6793('0x11')]){for(var _0x11bfb1 in _0x14efda[_0x6793('0x28')][_0x6793('0x29')]){if(_0x14efda[_0x6793('0x28')]['interaction'][_0x6793('0x2b')](_0x11bfb1)){db[_0x6793('0x2c')][_0x6793('0x2d')]({'where':{'channel':_0x11bfb1,'membername':_0x14efda['user'][_0x6793('0x11')],'type':_0x6793('0x2e'),'exitAt':null,'uniqueid':_0x14efda['body']['interaction'][_0x11bfb1]&&_0x14efda[_0x6793('0x28')][_0x6793('0x29')][_0x11bfb1][_0x6793('0x2f')]?{'$notIn':_0x14efda['body'][_0x6793('0x29')][_0x11bfb1]}:{'$ne':null}}})['then'](function(_0x18c111){var _0x8abdbf=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x382bbc=0x0,_0x569de4=_0x18c111[_0x6793('0x2f')];_0x382bbc<_0x569de4;_0x382bbc+=0x1){_0x18c111[_0x382bbc][_0x6793('0x30')]({'exitAt':_0x8abdbf});}});for(var _0x3b5236=0x0;_0x3b5236<_0x14efda['body'][_0x6793('0x29')][_0x11bfb1]['length'];_0x3b5236+=0x1){db[_0x6793('0x2c')][_0x6793('0x31')]({'where':{'channel':_0x11bfb1,'membername':_0x14efda[_0x6793('0x2a')][_0x6793('0x11')],'type':_0x6793('0x2e'),'uniqueid':_0x14efda[_0x6793('0x28')][_0x6793('0x29')][_0x11bfb1][_0x3b5236],'exitAt':null},'defaults':{'channel':_0x11bfb1,'membername':_0x14efda[_0x6793('0x2a')]['name'],'interface':_[_0x6793('0x13')](_0x14efda[_0x6793('0x2a')][_0x6793('0x32')])?util['format'](_0x6793('0x33'),_0x14efda[_0x6793('0x2a')][_0x6793('0x11')]):_0x14efda['user'][_0x6793('0x32')],'type':_0x6793('0x2e'),'enterAt':moment()[_0x6793('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x6793('0x35'),'internal':_0x14efda[_0x6793('0x2a')]['internal'],'uniqueid':_0x14efda[_0x6793('0x28')][_0x6793('0x29')][_0x11bfb1][_0x3b5236]}});}}}}return respondWithRpcPromise(_0x6793('0x36'),{'id':_0x14efda[_0x6793('0x18')]['id'],'capacity':_0x14efda['body'][_0x6793('0x37')]},routingClient)[_0x6793('0x16')](respondWithResult(_0x5d24d9,null))[_0x6793('0xc')](handleError(_0x5d24d9,null));};exports[_0x6793('0x38')]=function(_0x56f060,_0x15b2c1){return respondWithRpcPromise(_0x6793('0x39'),_0x56f060[_0x6793('0x15')])[_0x6793('0x16')](respondWithResult(_0x15b2c1,null))[_0x6793('0xc')](handleError(_0x15b2c1,null));};exports[_0x6793('0x3a')]=function(_0xcc5512,_0x7ee70d){return respondWithRpcPromise(_0x6793('0x3b'),_0xcc5512[_0x6793('0x15')])[_0x6793('0x16')](respondWithResult(_0x7ee70d,null))[_0x6793('0xc')](handleError(_0x7ee70d,null));};exports[_0x6793('0x3c')]=function(_0x4a570a,_0x6addf9){return respondWithRpcPromise(_0x6793('0x3d'),_0x4a570a[_0x6793('0x15')])[_0x6793('0x16')](respondWithResult(_0x6addf9,null))[_0x6793('0xc')](handleError(_0x6addf9,null));};exports[_0x6793('0x3e')]=function(_0x1ac2d3,_0x554a82){return respondWithRpcPromise(_0x6793('0x3f'),_0x1ac2d3['query'],routingClient)[_0x6793('0x16')](respondWithResult(_0x554a82,null))['catch'](handleError(_0x554a82,null));};exports[_0x6793('0x40')]=function(_0x24c808,_0x28fe50){return respondWithRpcPromise('ChatQueues',_0x24c808[_0x6793('0x15')],routingClient)['then'](findById(_0x24c808['params']['id']))['then'](respondWithResult(_0x28fe50,null))[_0x6793('0xc')](handleError(_0x28fe50,null));};exports[_0x6793('0x41')]=function(_0x3f281a,_0x58883b){return respondWithRpcPromise(_0x6793('0x42'),_0x3f281a[_0x6793('0x15')],routingClient)[_0x6793('0x16')](respondWithResult(_0x58883b,null))[_0x6793('0xc')](handleError(_0x58883b,null));};exports[_0x6793('0x43')]=function(_0x417655,_0x1b7396){return respondWithRpcPromise(_0x6793('0x42'),_0x417655[_0x6793('0x15')],routingClient)[_0x6793('0x16')](findById(_0x417655[_0x6793('0x18')]['id']))['then'](respondWithResult(_0x1b7396,null))[_0x6793('0xc')](handleError(_0x1b7396,null));};exports['mailAccounts']=function(_0x322477,_0x4ba402){return respondWithRpcPromise(_0x6793('0x44'),_0x322477[_0x6793('0x15')],mailClient)[_0x6793('0x16')](respondWithResult(_0x4ba402,null))[_0x6793('0xc')](handleError(_0x4ba402,null));};exports[_0x6793('0x45')]=function(_0x30365a,_0x29190f){return respondWithRpcPromise(_0x6793('0x46'),_0x30365a[_0x6793('0x15')],routingClient)[_0x6793('0x16')](respondWithResult(_0x29190f,null))[_0x6793('0xc')](handleError(_0x29190f,null));};exports['showOpenchannelQueues']=function(_0x1741f0,_0x102b7a){return respondWithRpcPromise(_0x6793('0x46'),_0x1741f0[_0x6793('0x15')],routingClient)[_0x6793('0x16')](findById(_0x1741f0[_0x6793('0x18')]['id']))[_0x6793('0x16')](respondWithResult(_0x102b7a,null))[_0x6793('0xc')](handleError(_0x102b7a,null));};exports['smsQueues']=function(_0x3d17a7,_0x480227){return respondWithRpcPromise(_0x6793('0x47'),_0x3d17a7[_0x6793('0x15')],routingClient)[_0x6793('0x16')](respondWithResult(_0x480227,null))[_0x6793('0xc')](handleError(_0x480227,null));};exports['showSmsQueues']=function(_0xf11961,_0x4eb62a){return respondWithRpcPromise('SmsQueues',_0xf11961[_0x6793('0x15')],routingClient)[_0x6793('0x16')](findById(_0xf11961['params']['id']))[_0x6793('0x16')](respondWithResult(_0x4eb62a,null))[_0x6793('0xc')](handleError(_0x4eb62a,null));};exports[_0x6793('0x48')]=function(_0x190ea5,_0x1e70f1){return respondWithRpcPromise(_0x6793('0x49'),_0x190ea5[_0x6793('0x15')],routingClient)[_0x6793('0x16')](respondWithResult(_0x1e70f1,null))[_0x6793('0xc')](handleError(_0x1e70f1,null));};exports[_0x6793('0x4a')]=function(_0x2fef45,_0x2080ed){return respondWithRpcPromise(_0x6793('0x49'),_0x2fef45[_0x6793('0x15')],routingClient)[_0x6793('0x16')](findById(_0x2fef45[_0x6793('0x18')]['id']))[_0x6793('0x16')](respondWithResult(_0x2080ed,null))['catch'](handleError(_0x2080ed,null));};exports[_0x6793('0x4b')]=function(_0x586d48,_0x397369){return respondWithRpcPromise('FaxAccounts',_0x586d48[_0x6793('0x15')])['then'](respondWithResult(_0x397369,null))[_0x6793('0xc')](handleError(_0x397369,null));};exports[_0x6793('0x4c')]=function(_0x47f576,_0x2eb1ed){return respondWithRpcPromise(_0x6793('0x4d'),_0x47f576[_0x6793('0x15')],routingClient)[_0x6793('0x16')](respondWithResult(_0x2eb1ed,null))[_0x6793('0xc')](handleError(_0x2eb1ed,null));};exports[_0x6793('0x4e')]=function(_0x1c049a,_0x51e11e){return respondWithRpcPromise(_0x6793('0x4f'),_0x1c049a['query'],routingClient)[_0x6793('0x16')](respondWithResult(_0x51e11e,null))[_0x6793('0xc')](handleError(_0x51e11e,null));};exports[_0x6793('0x50')]=function(_0x3736b4,_0x389dfc){return respondWithRpcPromise(_0x6793('0x51'),_0x3736b4[_0x6793('0x15')],routingClient)['then'](respondWithResult(_0x389dfc,null))[_0x6793('0xc')](handleError(_0x389dfc,null));};exports['smsQueuesWaitingInteractions']=function(_0x116849,_0x3c44ad){return respondWithRpcPromise(_0x6793('0x52'),_0x116849['query'],routingClient)[_0x6793('0x16')](respondWithResult(_0x3c44ad,null))['catch'](handleError(_0x3c44ad,null));};exports['faxQueuesWaitingInteractions']=function(_0x385ad0,_0x27851a){return respondWithRpcPromise(_0x6793('0x53'),_0x385ad0['query'],routingClient)['then'](respondWithResult(_0x27851a,null))[_0x6793('0xc')](handleError(_0x27851a,null));};exports[_0x6793('0x54')]=function(_0x1c5afd){return function(_0x4df548,_0x4b73f5){var _0x23da53,_0x4a2bca;var _0x4f26a2=_[_0x6793('0x55')](_0x1c5afd);var _0x1edcd4=_0x1c5afd===_0x6793('0x56')?_0x6793('0x57'):_0x6793('0x58');return db[_0x4f26a2+'Queue'][_0x6793('0x59')]({'raw':!![],'where':{'id':_0x4df548[_0x6793('0x18')]['id']}})[_0x6793('0x16')](function(_0x209bf4){if(_[_0x6793('0x13')](_0x209bf4)){throw new Error(_0x4f26a2+_0x6793('0x5a'));}_0x23da53=_0x209bf4;return db[_0x4f26a2+_0x6793('0x5b')][_0x6793('0x59')]({'where':{'id':_0x4df548[_0x6793('0x28')][_0x6793('0x5c')]},'include':[{'model':db[_0x4f26a2+_0x6793('0x5d')],'as':_0x6793('0x5d')},{'model':db[_0x4f26a2+_0x1edcd4],'as':'Account'}]});})[_0x6793('0x16')](function(_0x333634){if(_[_0x6793('0x13')](_0x333634)){throw new Error(_0x4f26a2+_0x6793('0x5e'));}_0x4a2bca=_0x333634;return _0x333634[_0x6793('0x5f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6793('0x16')](function(){var _0x159a63={'uniqueid':_0x1c5afd+'.'+_0x4a2bca['id']+'.'+_0x4a2bca[_0x6793('0x5d')]['id'],'FromUserId':_0x4df548['user']['id'],'type':_0x6793('0x60')};_0x159a63[_0x4f26a2+'MessageId']=_0x4a2bca['id'];_0x159a63[_0x4f26a2+_0x6793('0x61')]=_0x4a2bca[_0x6793('0x5d')]['id'];_0x159a63[_0x6793('0x62')+_0x4f26a2+_0x1edcd4+'Id']=_0x4a2bca[_0x6793('0x58')]['id'];_0x159a63['To'+_0x4f26a2+_0x6793('0x63')]=_0x23da53['id'];return db[_0x4f26a2+_0x6793('0x64')][_0x6793('0x65')](_0x159a63);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x1c5afd,'interaction':_0x4a2bca[_0x6793('0x5d')],'message':_0x4a2bca,'account':_0x4a2bca[_0x6793('0x58')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x23da53[_0x6793('0x11')]+','+(_0x4a2bca[_0x6793('0x58')][_0x6793('0x66')]||0x12c),'interval':_0x6793('0x67')}]},routingClient);})[_0x6793('0x16')](respondWithResult(_0x4b73f5,null))[_0x6793('0xc')](handleError(_0x4b73f5,null));};};exports['agentNotify']=function(_0x23e749,_0x5aa312){var _0x967b65,_0x5d8c74;if(_[_0x6793('0x13')](_0x23e749['body'][_0x6793('0x68')])){throw new Error(_0x6793('0x69'));}var _0x34d17d=_0x23e749[_0x6793('0x28')][_0x6793('0x68')];var _0x95127e=_[_0x6793('0x55')](_0x34d17d);var _0x44373b=_0x34d17d==='chat'?_0x6793('0x57'):_0x6793('0x58');return db[_0x6793('0x6a')][_0x6793('0x59')]({'raw':!![],'where':{'id':_0x23e749[_0x6793('0x18')]['id'],'role':_0x6793('0x35')}})['then'](function(_0x1ce5f2){if(_['isNil'](_0x1ce5f2)){throw new Error(_0x6793('0x6b'));}_0x967b65=_0x1ce5f2;return db[_0x95127e+_0x6793('0x5b')][_0x6793('0x59')]({'where':{'id':_0x23e749[_0x6793('0x28')][_0x6793('0x5c')]},'include':[{'model':db[_0x95127e+'Interaction'],'as':'Interaction'},{'model':db[_0x95127e+_0x44373b],'as':_0x6793('0x58')}]});})[_0x6793('0x16')](function(_0x298e04){if(_[_0x6793('0x13')](_0x298e04)){throw new Error(_0x95127e+_0x6793('0x5e'));}_0x5d8c74=_0x298e04;return _0x298e04['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x6793('0x16')](function(){var _0x2cffa3={'uniqueid':_0x34d17d+'.'+_0x5d8c74['id']+'.'+_0x5d8c74[_0x6793('0x5d')]['id'],'FromUserId':_0x23e749['user']['id'],'type':'queue','ToUserId':_0x967b65['id']};_0x2cffa3[_0x95127e+_0x6793('0x6c')]=_0x5d8c74['id'];_0x2cffa3[_0x95127e+_0x6793('0x61')]=_0x5d8c74['Interaction']['id'];_0x2cffa3[_0x6793('0x62')+_0x95127e+_0x44373b+'Id']=_0x5d8c74[_0x6793('0x58')]['id'];return db[_0x95127e+_0x6793('0x64')][_0x6793('0x65')](_0x2cffa3);})[_0x6793('0x16')](function(){return respondWithRpcPromise('Start',{'channel':_0x34d17d,'interaction':_0x5d8c74[_0x6793('0x5d')],'message':_0x5d8c74,'account':_0x5d8c74[_0x6793('0x58')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x967b65[_0x6793('0x11')]+','+(_0x5d8c74['Account'][_0x6793('0x6d')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x6793('0x16')](respondWithResult(_0x5aa312,null))[_0x6793('0xc')](handleError(_0x5aa312,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a55d3c5..a840716 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 _0x8341=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','run','post','create','put','delete','destroy','exports','multer'];(function(_0x3880f8,_0xaeb448){var _0x3e526e=function(_0x5c080a){while(--_0x5c080a){_0x3880f8['push'](_0x3880f8['shift']());}};_0x3e526e(++_0xaeb448);}(_0x8341,0xfb));var _0x1834=function(_0x5eb81c,_0x504419){_0x5eb81c=_0x5eb81c-0x0;var _0x2fe8ef=_0x8341[_0x5eb81c];return _0x2fe8ef;};'use strict';var multer=require(_0x1834('0x0'));var util=require(_0x1834('0x1'));var path=require('path');var timeout=require(_0x1834('0x2'));var express=require(_0x1834('0x3'));var router=express['Router']();var auth=require(_0x1834('0x4'));var interaction=require(_0x1834('0x5'));var config=require(_0x1834('0x6'));var controller=require('./schedule.controller');router[_0x1834('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1834('0x7')](_0x1834('0x8'),auth[_0x1834('0x9')](),controller[_0x1834('0xa')]);router['get']('/:id/run',auth[_0x1834('0x9')](),controller[_0x1834('0xb')]);router[_0x1834('0xc')]('/',auth[_0x1834('0x9')](),controller[_0x1834('0xd')]);router[_0x1834('0xe')](_0x1834('0x8'),auth[_0x1834('0x9')](),controller['update']);router[_0x1834('0xf')](_0x1834('0x8'),auth[_0x1834('0x9')](),controller[_0x1834('0x10')]);module[_0x1834('0x11')]=router; \ No newline at end of file +var _0x2e5c=['index','get','/:id','isAuthenticated','show','/:id/run','run','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x579186,_0x18c269){var _0x5736ba=function(_0x137da0){while(--_0x137da0){_0x579186['push'](_0x579186['shift']());}};_0x5736ba(++_0x18c269);}(_0x2e5c,0x19d));var _0xc2e5=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x2e5c[_0x5627e1];return _0x2f013f;};'use strict';var multer=require(_0xc2e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc2e5('0x1'));var express=require('express');var router=express[_0xc2e5('0x2')]();var auth=require(_0xc2e5('0x3'));var interaction=require(_0xc2e5('0x4'));var config=require(_0xc2e5('0x5'));var controller=require(_0xc2e5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc2e5('0x7')]);router[_0xc2e5('0x8')](_0xc2e5('0x9'),auth[_0xc2e5('0xa')](),controller[_0xc2e5('0xb')]);router[_0xc2e5('0x8')](_0xc2e5('0xc'),auth[_0xc2e5('0xa')](),controller[_0xc2e5('0xd')]);router[_0xc2e5('0xe')]('/',auth[_0xc2e5('0xa')](),controller[_0xc2e5('0xf')]);router[_0xc2e5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc2e5('0x11')]);router[_0xc2e5('0x12')](_0xc2e5('0x9'),auth[_0xc2e5('0xa')](),controller[_0xc2e5('0x13')]);module[_0xc2e5('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 6277db2..0b671e6 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 _0x3793=['weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months'];(function(_0xdbd108,_0x525179){var _0x3c9622=function(_0x14a387){while(--_0x14a387){_0xdbd108['push'](_0xdbd108['shift']());}};_0x3c9622(++_0x525179);}(_0x3793,0x14d));var _0x3379=function(_0x25e6c9,_0x30cdde){_0x25e6c9=_0x25e6c9-0x0;var _0x1026ed=_0x3793[_0x25e6c9];return _0x1026ed;};'use strict';var Sequelize=require(_0x3379('0x0'));module[_0x3379('0x1')]={'name':{'type':Sequelize[_0x3379('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3379('0x2')]},'active':{'type':Sequelize[_0x3379('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3379('0x2')],'allowNull':![],'defaultValue':_0x3379('0x4')},'startAt':{'type':Sequelize[_0x3379('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3379('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3379('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3379('0x7')]('years','quarters',_0x3379('0x8'),_0x3379('0x9'),_0x3379('0xa'),_0x3379('0xb'),_0x3379('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x3379('0x7')](_0x3379('0xd'),_0x3379('0xe'),_0x3379('0xf')),'allowNull':![],'defaultValue':_0x3379('0xd')},'type':{'type':Sequelize['ENUM'](_0x3379('0x10'),_0x3379('0x11')),'allowNull':![],'defaultValue':_0x3379('0x10')},'sendMail':{'type':Sequelize[_0x3379('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x3379('0x2')]},'cc':{'type':Sequelize[_0x3379('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x3379('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfdb2=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','weeks','hours','minutes','days','csv','pdf','xlsx','custom'];(function(_0x19558c,_0x5724f9){var _0x5bade4=function(_0xd99956){while(--_0xd99956){_0x19558c['push'](_0x19558c['shift']());}};_0x5bade4(++_0x5724f9);}(_0xfdb2,0xd3));var _0x2fdb=function(_0x291867,_0x44491c){_0x291867=_0x291867-0x0;var _0x468aef=_0xfdb2[_0x291867];return _0x468aef;};'use strict';var Sequelize=require(_0x2fdb('0x0'));module[_0x2fdb('0x1')]={'name':{'type':Sequelize[_0x2fdb('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2fdb('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2fdb('0x2')],'allowNull':![],'defaultValue':_0x2fdb('0x4')},'startAt':{'type':Sequelize[_0x2fdb('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2fdb('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2fdb('0x6')](_0x2fdb('0x7'),_0x2fdb('0x8'),'months',_0x2fdb('0x9'),'days',_0x2fdb('0xa'),_0x2fdb('0xb')),'allowNull':![],'defaultValue':_0x2fdb('0xc')},'output':{'type':Sequelize[_0x2fdb('0x6')](_0x2fdb('0xd'),_0x2fdb('0xe'),_0x2fdb('0xf')),'allowNull':![],'defaultValue':_0x2fdb('0xd')},'type':{'type':Sequelize[_0x2fdb('0x6')](_0x2fdb('0x10'),_0x2fdb('0x11')),'allowNull':![],'defaultValue':_0x2fdb('0x10')},'sendMail':{'type':Sequelize[_0x2fdb('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2fdb('0x12')]},'bcc':{'type':Sequelize[_0x2fdb('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x2fdb('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 93c6b35..91a743a 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 _0x824f=['map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','Schedule','rawAttributes','model','keys','query','dateStart','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','filters','dateEnd','add','day','merge','where','filter'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x824f,0x69));var _0xf824=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x824f[_0x1bc0ae];return _0x501104;};'use strict';var pdf=require(_0xf824('0x0'));var emlformat=require(_0xf824('0x1'));var rimraf=require(_0xf824('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf824('0x3'));var rp=require('request-promise');var moment=require(_0xf824('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf824('0x5'));var util=require(_0xf824('0x6'));var path=require(_0xf824('0x7'));var sox=require('sox');var csv=require(_0xf824('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf824('0x9'));var squel=require(_0xf824('0xa'));var crypto=require(_0xf824('0xb'));var jsforce=require(_0xf824('0xc'));var deskjs=require(_0xf824('0xd'));var toCsv=require(_0xf824('0x8'));var querystring=require(_0xf824('0xe'));var Papa=require(_0xf824('0xf'));var Redis=require(_0xf824('0x10'));var qs=require(_0xf824('0x11'));var logger=require('../../config/logger')(_0xf824('0x12'));var utils=require(_0xf824('0x13'));var config=require(_0xf824('0x14'));var db=require(_0xf824('0x15'))['db'];function respondWithStatusCode(_0x29b04a,_0x2e46af){_0x2e46af=_0x2e46af||0xcc;return function(_0x36a0f7){if(_0x36a0f7){return _0x29b04a[_0xf824('0x16')](_0x2e46af);}return _0x29b04a[_0xf824('0x17')](_0x2e46af)[_0xf824('0x18')]();};}function respondWithResult(_0x9e0d5,_0x4f8542){_0x4f8542=_0x4f8542||0xc8;return function(_0x1dd76f){if(_0x1dd76f){return _0x9e0d5[_0xf824('0x17')](_0x4f8542)[_0xf824('0x19')](_0x1dd76f);}};}function respondWithFilteredResult(_0x2a6a44,_0x564828){return function(_0xb07839){if(_0xb07839){var _0x16233c=_0xb07839[_0xf824('0x1a')],_0x20884b=_0x564828['offset'],_0x13c99e=_0x564828['offset']+_0x564828[_0xf824('0x1b')],_0x5e4afc;if(_0x13c99e>=_0x16233c){_0x13c99e=_0x16233c;_0x5e4afc=0xc8;}else{_0x5e4afc=0xce;}_0x2a6a44['status'](_0x5e4afc);return _0x2a6a44[_0xf824('0x1c')](_0xf824('0x1d'),_0x20884b+'-'+_0x13c99e+'/'+_0x16233c)[_0xf824('0x19')](_0xb07839);}return null;};}function patchUpdates(_0x45b5aa){return function(_0x30359b){try{jsonpatch[_0xf824('0x1e')](_0x30359b,_0x45b5aa,!![]);}catch(_0x161af4){return BPromise[_0xf824('0x1f')](_0x161af4);}return _0x30359b['save']();};}function saveUpdates(_0x127f64,_0x18806d){return function(_0xe616e){if(_0xe616e){return _0xe616e[_0xf824('0x20')](_0x127f64)[_0xf824('0x21')](function(_0x44646c){return _0x44646c;});}return null;};}function removeEntity(_0x57df8a,_0x2682d2){return function(_0x32379d){if(_0x32379d){return _0x32379d[_0xf824('0x22')]()[_0xf824('0x21')](function(){var _0x69997d=_0x32379d[_0xf824('0x23')]({'plain':!![]});var _0x4de0a7=_0xf824('0x24');return db[_0xf824('0x25')]['destroy']({'where':{'type':_0x4de0a7,'resourceId':_0x69997d['id']}})['then'](function(){return _0x32379d;});})[_0xf824('0x21')](function(){_0x57df8a[_0xf824('0x17')](0xcc)[_0xf824('0x18')]();});}};}function handleEntityNotFound(_0x37c8cb,_0x168e71){return function(_0x3bdcce){if(!_0x3bdcce){_0x37c8cb[_0xf824('0x16')](0x194);}return _0x3bdcce;};}function handleError(_0x2a4b85,_0x392fa8){_0x392fa8=_0x392fa8||0x1f4;return function(_0x285048){logger[_0xf824('0x26')](_0x285048[_0xf824('0x27')]);if(_0x285048[_0xf824('0x28')]){delete _0x285048[_0xf824('0x28')];}_0x2a4b85['status'](_0x392fa8)[_0xf824('0x29')](_0x285048);};}exports['index']=function(_0x47c734,_0x5a44a6){var _0x21af34={},_0xd797b3={},_0x59eb09={'count':0x0,'rows':[]};var _0x3e219e=db[_0xf824('0x2a')][_0xf824('0x2b')];_0xd797b3[_0xf824('0x2c')]=_[_0xf824('0x2d')](_0x3e219e);var _0x1589f7={'dateStart':_0x47c734[_0xf824('0x2e')][_0xf824('0x2f')],'dateEnd':_0x47c734[_0xf824('0x2e')]['dateEnd']};delete _0x47c734[_0xf824('0x2e')][_0xf824('0x2f')];delete _0x47c734[_0xf824('0x2e')]['dateEnd'];_0xd797b3[_0xf824('0x2e')]=_['keys'](_0x47c734[_0xf824('0x2e')]);_0xd797b3['filters']=_[_0xf824('0x30')](_0xd797b3[_0xf824('0x2c')],_0xd797b3['query']);_0x21af34['attributes']=_['intersection'](_0xd797b3[_0xf824('0x2c')],qs[_0xf824('0x31')](_0x47c734[_0xf824('0x2e')][_0xf824('0x31')]));_0x21af34['attributes']=_0x21af34[_0xf824('0x32')]['length']?_0x21af34['attributes']:_0xd797b3['model'];if(!_0x47c734['query'][_0xf824('0x33')](_0xf824('0x34'))){_0x21af34['limit']=qs[_0xf824('0x1b')](_0x47c734[_0xf824('0x2e')][_0xf824('0x1b')]);_0x21af34[_0xf824('0x35')]=qs[_0xf824('0x35')](_0x47c734[_0xf824('0x2e')][_0xf824('0x35')]);}_0x21af34[_0xf824('0x36')]=qs[_0xf824('0x37')](_0x47c734['query']['sort']);_0x21af34['where']=qs[_0xf824('0x38')](_['pick'](_0x47c734['query'],_0xd797b3['filters']));if(_0x1589f7[_0xf824('0x2f')]){if(_0x1589f7[_0xf824('0x39')]){_0x1589f7[_0xf824('0x39')]=moment(_0x1589f7[_0xf824('0x39')])[_0xf824('0x3a')](0x1,_0xf824('0x3b'));}else{_0x1589f7[_0xf824('0x39')]=moment(_0x1589f7['dateStart'])[_0xf824('0x3a')](0x1,_0xf824('0x3b'));}_[_0xf824('0x3c')](_0x21af34[_0xf824('0x3d')],{'createdAt':{'$gte':_0x1589f7[_0xf824('0x2f')],'$lte':_0x1589f7[_0xf824('0x39')]}});}if(_0x47c734[_0xf824('0x2e')][_0xf824('0x3e')]){_0x21af34[_0xf824('0x3d')]=_[_0xf824('0x3c')](_0x21af34['where'],{'$or':_[_0xf824('0x3f')](_0x21af34[_0xf824('0x32')],function(_0x400271){var _0x511a65={};_0x511a65[_0x400271]={'$like':'%'+_0x47c734[_0xf824('0x2e')][_0xf824('0x3e')]+'%'};return _0x511a65;})});}_0x21af34=_[_0xf824('0x3c')]({},_0x21af34,_0x47c734[_0xf824('0x40')]);var _0x563b58={'where':_0x21af34[_0xf824('0x3d')]};return db['Schedule'][_0xf824('0x1a')](_0x563b58)[_0xf824('0x21')](function(_0x2e1706){_0x59eb09[_0xf824('0x1a')]=_0x2e1706;if(_0x47c734[_0xf824('0x2e')][_0xf824('0x41')]){_0x21af34[_0xf824('0x42')]=[{'all':!![]}];}return db['Schedule'][_0xf824('0x43')](_0x21af34);})[_0xf824('0x21')](function(_0x1f410c){_0x59eb09[_0xf824('0x44')]=_0x1f410c;return _0x59eb09;})['then'](respondWithFilteredResult(_0x5a44a6,_0x21af34))[_0xf824('0x45')](handleError(_0x5a44a6,null));};exports[_0xf824('0x46')]=function(_0x3ffab1,_0x58c7a8){var _0x47f9f8={'raw':![],'where':{'id':_0x3ffab1[_0xf824('0x47')]['id']}},_0x8b22b7={};_0x8b22b7[_0xf824('0x2c')]=_[_0xf824('0x2d')](db[_0xf824('0x2a')]['rawAttributes']);_0x8b22b7[_0xf824('0x2e')]=_[_0xf824('0x2d')](_0x3ffab1[_0xf824('0x2e')]);_0x8b22b7[_0xf824('0x38')]=_['intersection'](_0x8b22b7[_0xf824('0x2c')],_0x8b22b7[_0xf824('0x2e')]);_0x47f9f8[_0xf824('0x32')]=_[_0xf824('0x30')](_0x8b22b7['model'],qs[_0xf824('0x31')](_0x3ffab1[_0xf824('0x2e')]['fields']));_0x47f9f8[_0xf824('0x32')]=_0x47f9f8[_0xf824('0x32')]['length']?_0x47f9f8['attributes']:_0x8b22b7['model'];if(_0x3ffab1[_0xf824('0x2e')][_0xf824('0x41')]){_0x47f9f8['include']=[{'all':!![]}];}_0x47f9f8=_['merge']({},_0x47f9f8,_0x3ffab1[_0xf824('0x40')]);return db['Schedule'][_0xf824('0x48')](_0x47f9f8)[_0xf824('0x21')](handleEntityNotFound(_0x58c7a8,null))[_0xf824('0x21')](respondWithResult(_0x58c7a8,null))[_0xf824('0x45')](handleError(_0x58c7a8,null));};exports[_0xf824('0x49')]=function(_0x48f15d,_0x17dec8){return db[_0xf824('0x2a')][_0xf824('0x49')](_0x48f15d[_0xf824('0x4a')],{})[_0xf824('0x21')](function(_0x4182b3){var _0x24b517=_0x48f15d[_0xf824('0x4b')][_0xf824('0x23')]({'plain':!![]});if(!_0x24b517)throw new Error(_0xf824('0x4c'));if(_0x24b517[_0xf824('0x4d')]===_0xf824('0x4b')){var _0x162afe=_0x4182b3[_0xf824('0x23')]({'plain':!![]});var _0x52f3a4=_0xf824('0x24');return db[_0xf824('0x4e')][_0xf824('0x48')]({'where':{'name':_0x52f3a4,'userProfileId':_0x24b517[_0xf824('0x4f')]},'raw':!![]})[_0xf824('0x21')](function(_0x2da5c5){if(_0x2da5c5&&_0x2da5c5[_0xf824('0x50')]===0x0){return db['UserProfileResource'][_0xf824('0x49')]({'name':_0x162afe[_0xf824('0x28')],'resourceId':_0x162afe['id'],'type':_0x2da5c5['name'],'sectionId':_0x2da5c5['id']},{})[_0xf824('0x21')](function(){return _0x4182b3;});}else{return _0x4182b3;}})[_0xf824('0x45')](function(_0x59a13f){logger[_0xf824('0x26')](_0xf824('0x51'),_0x59a13f);throw _0x59a13f;});}return _0x4182b3;})[_0xf824('0x21')](respondWithResult(_0x17dec8,0xc9))['catch'](handleError(_0x17dec8,null));};exports['update']=function(_0x1618a6,_0x405b86){if(_0x1618a6[_0xf824('0x4a')]['id']){delete _0x1618a6[_0xf824('0x4a')]['id'];}return db[_0xf824('0x2a')][_0xf824('0x48')]({'where':{'id':_0x1618a6[_0xf824('0x47')]['id']}})[_0xf824('0x21')](handleEntityNotFound(_0x405b86,null))[_0xf824('0x21')](saveUpdates(_0x1618a6[_0xf824('0x4a')],null))[_0xf824('0x21')](respondWithResult(_0x405b86,null))[_0xf824('0x45')](handleError(_0x405b86,null));};exports[_0xf824('0x22')]=function(_0x5dae23,_0xa12c5b){return db[_0xf824('0x2a')][_0xf824('0x48')]({'where':{'id':_0x5dae23[_0xf824('0x47')]['id']}})[_0xf824('0x21')](handleEntityNotFound(_0xa12c5b,null))[_0xf824('0x21')](removeEntity(_0xa12c5b,null))[_0xf824('0x45')](handleError(_0xa12c5b,null));};exports[_0xf824('0x52')]=function(_0x269c5f,_0x417a6a,_0x429b32){var _0x1ce785=require(_0xf824('0x53'));return db[_0xf824('0x2a')][_0xf824('0x48')]({'where':{'id':_0x269c5f['params']['id']},'raw':!![]})[_0xf824('0x21')](handleEntityNotFound(_0x417a6a,null))['then'](function(){_0x1ce785[_0xf824('0x52')](_0x269c5f[_0xf824('0x47')]['id']);})['then'](respondWithStatusCode(_0x417a6a,null))[_0xf824('0x45')](handleError(_0x417a6a,null));}; \ No newline at end of file +var _0x15dd=['squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','Scheduler','UserProfileResource','error','name','send','index','Schedule','rawAttributes','model','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x51ecf1,_0xc03428){var _0x435a30=function(_0x50a4c2){while(--_0x50a4c2){_0x51ecf1['push'](_0x51ecf1['shift']());}};_0x435a30(++_0xc03428);}(_0x15dd,0x1eb));var _0xd15d=function(_0x193fcd,_0x26b8f9){_0x193fcd=_0x193fcd-0x0;var _0x28687a=_0x15dd[_0x193fcd];return _0x28687a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd15d('0x0'));var rimraf=require(_0xd15d('0x1'));var zipdir=require(_0xd15d('0x2'));var jsonpatch=require(_0xd15d('0x3'));var rp=require(_0xd15d('0x4'));var moment=require(_0xd15d('0x5'));var BPromise=require(_0xd15d('0x6'));var Mustache=require(_0xd15d('0x7'));var util=require(_0xd15d('0x8'));var path=require(_0xd15d('0x9'));var sox=require(_0xd15d('0xa'));var csv=require(_0xd15d('0xb'));var ejs=require(_0xd15d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd15d('0xd'));var crypto=require(_0xd15d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd15d('0xf'));var toCsv=require(_0xd15d('0xb'));var querystring=require(_0xd15d('0x10'));var Papa=require('papaparse');var Redis=require(_0xd15d('0x11'));var qs=require(_0xd15d('0x12'));var logger=require('../../config/logger')(_0xd15d('0x13'));var utils=require(_0xd15d('0x14'));var config=require(_0xd15d('0x15'));var db=require(_0xd15d('0x16'))['db'];function respondWithStatusCode(_0x22ad94,_0x53a94e){_0x53a94e=_0x53a94e||0xcc;return function(_0x4545c0){if(_0x4545c0){return _0x22ad94[_0xd15d('0x17')](_0x53a94e);}return _0x22ad94[_0xd15d('0x18')](_0x53a94e)[_0xd15d('0x19')]();};}function respondWithResult(_0x42fefe,_0xc1396f){_0xc1396f=_0xc1396f||0xc8;return function(_0x2f7b5e){if(_0x2f7b5e){return _0x42fefe[_0xd15d('0x18')](_0xc1396f)[_0xd15d('0x1a')](_0x2f7b5e);}};}function respondWithFilteredResult(_0x4f147e,_0x3bd81f){return function(_0x4ce0d0){if(_0x4ce0d0){var _0x55c2c1=_0x4ce0d0[_0xd15d('0x1b')],_0x47688c=_0x3bd81f['offset'],_0x36ff82=_0x3bd81f[_0xd15d('0x1c')]+_0x3bd81f['limit'],_0x433a49;if(_0x36ff82>=_0x55c2c1){_0x36ff82=_0x55c2c1;_0x433a49=0xc8;}else{_0x433a49=0xce;}_0x4f147e[_0xd15d('0x18')](_0x433a49);return _0x4f147e[_0xd15d('0x1d')](_0xd15d('0x1e'),_0x47688c+'-'+_0x36ff82+'/'+_0x55c2c1)['json'](_0x4ce0d0);}return null;};}function patchUpdates(_0x5f1bc7){return function(_0x47f525){try{jsonpatch[_0xd15d('0x1f')](_0x47f525,_0x5f1bc7,!![]);}catch(_0x1a8783){return BPromise['reject'](_0x1a8783);}return _0x47f525[_0xd15d('0x20')]();};}function saveUpdates(_0x3a7708,_0x99e666){return function(_0x5e47a5){if(_0x5e47a5){return _0x5e47a5['update'](_0x3a7708)[_0xd15d('0x21')](function(_0x1dfa3c){return _0x1dfa3c;});}return null;};}function removeEntity(_0xace6bf,_0x4327ed){return function(_0x5da358){if(_0x5da358){return _0x5da358[_0xd15d('0x22')]()['then'](function(){var _0x1c865c=_0x5da358['get']({'plain':!![]});var _0x24dc57=_0xd15d('0x23');return db[_0xd15d('0x24')][_0xd15d('0x22')]({'where':{'type':_0x24dc57,'resourceId':_0x1c865c['id']}})[_0xd15d('0x21')](function(){return _0x5da358;});})[_0xd15d('0x21')](function(){_0xace6bf[_0xd15d('0x18')](0xcc)[_0xd15d('0x19')]();});}};}function handleEntityNotFound(_0x23b5f5,_0x219595){return function(_0x22463a){if(!_0x22463a){_0x23b5f5[_0xd15d('0x17')](0x194);}return _0x22463a;};}function handleError(_0x3608e9,_0x44bf1e){_0x44bf1e=_0x44bf1e||0x1f4;return function(_0x2f1c50){logger[_0xd15d('0x25')](_0x2f1c50['stack']);if(_0x2f1c50[_0xd15d('0x26')]){delete _0x2f1c50[_0xd15d('0x26')];}_0x3608e9[_0xd15d('0x18')](_0x44bf1e)[_0xd15d('0x27')](_0x2f1c50);};}exports[_0xd15d('0x28')]=function(_0x221cd0,_0x1483ad){var _0x505aa1={},_0x45384e={},_0x2ff54b={'count':0x0,'rows':[]};var _0x53eb1c=db[_0xd15d('0x29')][_0xd15d('0x2a')];_0x45384e[_0xd15d('0x2b')]=_['keys'](_0x53eb1c);var _0x53175a={'dateStart':_0x221cd0[_0xd15d('0x2c')]['dateStart'],'dateEnd':_0x221cd0[_0xd15d('0x2c')][_0xd15d('0x2d')]};delete _0x221cd0['query'][_0xd15d('0x2e')];delete _0x221cd0[_0xd15d('0x2c')][_0xd15d('0x2d')];_0x45384e[_0xd15d('0x2c')]=_['keys'](_0x221cd0['query']);_0x45384e[_0xd15d('0x2f')]=_[_0xd15d('0x30')](_0x45384e[_0xd15d('0x2b')],_0x45384e['query']);_0x505aa1[_0xd15d('0x31')]=_['intersection'](_0x45384e['model'],qs[_0xd15d('0x32')](_0x221cd0[_0xd15d('0x2c')][_0xd15d('0x32')]));_0x505aa1['attributes']=_0x505aa1[_0xd15d('0x31')][_0xd15d('0x33')]?_0x505aa1[_0xd15d('0x31')]:_0x45384e[_0xd15d('0x2b')];if(!_0x221cd0[_0xd15d('0x2c')][_0xd15d('0x34')]('nolimit')){_0x505aa1[_0xd15d('0x35')]=qs[_0xd15d('0x35')](_0x221cd0[_0xd15d('0x2c')][_0xd15d('0x35')]);_0x505aa1[_0xd15d('0x1c')]=qs['offset'](_0x221cd0[_0xd15d('0x2c')][_0xd15d('0x1c')]);}_0x505aa1['order']=qs[_0xd15d('0x36')](_0x221cd0[_0xd15d('0x2c')][_0xd15d('0x36')]);_0x505aa1[_0xd15d('0x37')]=qs[_0xd15d('0x2f')](_[_0xd15d('0x38')](_0x221cd0[_0xd15d('0x2c')],_0x45384e[_0xd15d('0x2f')]));if(_0x53175a[_0xd15d('0x2e')]){if(_0x53175a[_0xd15d('0x2d')]){_0x53175a['dateEnd']=moment(_0x53175a[_0xd15d('0x2d')])['add'](0x1,'day');}else{_0x53175a[_0xd15d('0x2d')]=moment(_0x53175a[_0xd15d('0x2e')])['add'](0x1,_0xd15d('0x39'));}_[_0xd15d('0x3a')](_0x505aa1[_0xd15d('0x37')],{'createdAt':{'$gte':_0x53175a[_0xd15d('0x2e')],'$lte':_0x53175a[_0xd15d('0x2d')]}});}if(_0x221cd0['query'][_0xd15d('0x3b')]){_0x505aa1['where']=_[_0xd15d('0x3a')](_0x505aa1[_0xd15d('0x37')],{'$or':_[_0xd15d('0x3c')](_0x505aa1[_0xd15d('0x31')],function(_0x36ce19){var _0xcbddb0={};_0xcbddb0[_0x36ce19]={'$like':'%'+_0x221cd0[_0xd15d('0x2c')][_0xd15d('0x3b')]+'%'};return _0xcbddb0;})});}_0x505aa1=_[_0xd15d('0x3a')]({},_0x505aa1,_0x221cd0[_0xd15d('0x3d')]);var _0x595912={'where':_0x505aa1[_0xd15d('0x37')]};return db[_0xd15d('0x29')]['count'](_0x595912)['then'](function(_0x4eb38a){_0x2ff54b[_0xd15d('0x1b')]=_0x4eb38a;if(_0x221cd0['query'][_0xd15d('0x3e')]){_0x505aa1[_0xd15d('0x3f')]=[{'all':!![]}];}return db[_0xd15d('0x29')][_0xd15d('0x40')](_0x505aa1);})[_0xd15d('0x21')](function(_0x20f15b){_0x2ff54b[_0xd15d('0x41')]=_0x20f15b;return _0x2ff54b;})[_0xd15d('0x21')](respondWithFilteredResult(_0x1483ad,_0x505aa1))[_0xd15d('0x42')](handleError(_0x1483ad,null));};exports[_0xd15d('0x43')]=function(_0x28a4fb,_0x4c667f){var _0x21955c={'raw':![],'where':{'id':_0x28a4fb[_0xd15d('0x44')]['id']}},_0x1ff8f8={};_0x1ff8f8[_0xd15d('0x2b')]=_[_0xd15d('0x45')](db[_0xd15d('0x29')][_0xd15d('0x2a')]);_0x1ff8f8['query']=_[_0xd15d('0x45')](_0x28a4fb[_0xd15d('0x2c')]);_0x1ff8f8[_0xd15d('0x2f')]=_[_0xd15d('0x30')](_0x1ff8f8[_0xd15d('0x2b')],_0x1ff8f8['query']);_0x21955c['attributes']=_[_0xd15d('0x30')](_0x1ff8f8[_0xd15d('0x2b')],qs['fields'](_0x28a4fb['query'][_0xd15d('0x32')]));_0x21955c['attributes']=_0x21955c[_0xd15d('0x31')][_0xd15d('0x33')]?_0x21955c['attributes']:_0x1ff8f8[_0xd15d('0x2b')];if(_0x28a4fb[_0xd15d('0x2c')][_0xd15d('0x3e')]){_0x21955c['include']=[{'all':!![]}];}_0x21955c=_[_0xd15d('0x3a')]({},_0x21955c,_0x28a4fb[_0xd15d('0x3d')]);return db[_0xd15d('0x29')][_0xd15d('0x46')](_0x21955c)[_0xd15d('0x21')](handleEntityNotFound(_0x4c667f,null))[_0xd15d('0x21')](respondWithResult(_0x4c667f,null))[_0xd15d('0x42')](handleError(_0x4c667f,null));};exports[_0xd15d('0x47')]=function(_0x5a2e14,_0x59c4c3){return db[_0xd15d('0x29')][_0xd15d('0x47')](_0x5a2e14[_0xd15d('0x48')],{})[_0xd15d('0x21')](function(_0x4c861c){var _0x2741ff=_0x5a2e14[_0xd15d('0x49')][_0xd15d('0x4a')]({'plain':!![]});if(!_0x2741ff)throw new Error(_0xd15d('0x4b'));if(_0x2741ff[_0xd15d('0x4c')]===_0xd15d('0x49')){var _0x5acaf3=_0x4c861c[_0xd15d('0x4a')]({'plain':!![]});var _0x3b3ca1=_0xd15d('0x23');return db[_0xd15d('0x4d')][_0xd15d('0x46')]({'where':{'name':_0x3b3ca1,'userProfileId':_0x2741ff[_0xd15d('0x4e')]},'raw':!![]})[_0xd15d('0x21')](function(_0x17bf56){if(_0x17bf56&&_0x17bf56[_0xd15d('0x4f')]===0x0){return db[_0xd15d('0x24')][_0xd15d('0x47')]({'name':_0x5acaf3[_0xd15d('0x26')],'resourceId':_0x5acaf3['id'],'type':_0x17bf56[_0xd15d('0x26')],'sectionId':_0x17bf56['id']},{})[_0xd15d('0x21')](function(){return _0x4c861c;});}else{return _0x4c861c;}})[_0xd15d('0x42')](function(_0x4fd17b){logger[_0xd15d('0x25')](_0xd15d('0x50'),_0x4fd17b);throw _0x4fd17b;});}return _0x4c861c;})[_0xd15d('0x21')](respondWithResult(_0x59c4c3,0xc9))[_0xd15d('0x42')](handleError(_0x59c4c3,null));};exports[_0xd15d('0x51')]=function(_0x475242,_0x5eb5e9){if(_0x475242['body']['id']){delete _0x475242[_0xd15d('0x48')]['id'];}return db[_0xd15d('0x29')][_0xd15d('0x46')]({'where':{'id':_0x475242['params']['id']}})[_0xd15d('0x21')](handleEntityNotFound(_0x5eb5e9,null))[_0xd15d('0x21')](saveUpdates(_0x475242[_0xd15d('0x48')],null))[_0xd15d('0x21')](respondWithResult(_0x5eb5e9,null))[_0xd15d('0x42')](handleError(_0x5eb5e9,null));};exports['destroy']=function(_0x2d5841,_0x40328d){return db[_0xd15d('0x29')][_0xd15d('0x46')]({'where':{'id':_0x2d5841[_0xd15d('0x44')]['id']}})[_0xd15d('0x21')](handleEntityNotFound(_0x40328d,null))[_0xd15d('0x21')](removeEntity(_0x40328d,null))['catch'](handleError(_0x40328d,null));};exports[_0xd15d('0x52')]=function(_0x5056c6,_0x5372ea,_0x4fce62){var _0x539e56=require(_0xd15d('0x53'));return db[_0xd15d('0x29')]['find']({'where':{'id':_0x5056c6[_0xd15d('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5372ea,null))[_0xd15d('0x21')](function(){_0x539e56['run'](_0x5056c6[_0xd15d('0x44')]['id']);})[_0xd15d('0x21')](respondWithStatusCode(_0x5372ea,null))[_0xd15d('0x42')](handleError(_0x5372ea,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 927174d..7d1aeb8 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 _0xdd62=['./schedule.attributes','exports','define','Schedule','lodash','../../config/logger','api'];(function(_0x1e3d0a,_0x13107f){var _0x3b77bd=function(_0x485ffc){while(--_0x485ffc){_0x1e3d0a['push'](_0x1e3d0a['shift']());}};_0x3b77bd(++_0x13107f);}(_0xdd62,0x1ee));var _0x2dd6=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xdd62[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x2dd6('0x0'));var util=require('util');var logger=require(_0x2dd6('0x1'))(_0x2dd6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x2dd6('0x3'));module[_0x2dd6('0x4')]=function(_0x474595,_0x473657){return _0x474595[_0x2dd6('0x5')](_0x2dd6('0x6'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95cb=['request-promise','./schedule.attributes','define','Schedule','tools_schedules','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1ab9ca,_0x5e95d8){var _0xd1463d=function(_0x481c65){while(--_0x481c65){_0x1ab9ca['push'](_0x1ab9ca['shift']());}};_0xd1463d(++_0x5e95d8);}(_0x95cb,0x131));var _0xb95c=function(_0x5a7cd1,_0x255778){_0x5a7cd1=_0x5a7cd1-0x0;var _0x51ba5a=_0x95cb[_0x5a7cd1];return _0x51ba5a;};'use strict';var _=require(_0xb95c('0x0'));var util=require('util');var logger=require(_0xb95c('0x1'))(_0xb95c('0x2'));var moment=require(_0xb95c('0x3'));var BPromise=require(_0xb95c('0x4'));var rp=require(_0xb95c('0x5'));var attributes=require(_0xb95c('0x6'));module['exports']=function(_0x5a1a78,_0x51fae3){return _0x5a1a78[_0xb95c('0x7')](_0xb95c('0x8'),attributes,{'tableName':_0xb95c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 7cb3a2f..511f953 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 _0x5ae1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','ioredis'];(function(_0x9ebaa3,_0x4c6efd){var _0x543241=function(_0x1c75fc){while(--_0x1c75fc){_0x9ebaa3['push'](_0x9ebaa3['shift']());}};_0x543241(++_0x4c6efd);}(_0x5ae1,0xe2));var _0x15ae=function(_0x2afdc6,_0x30825c){_0x2afdc6=_0x2afdc6-0x0;var _0x16b16f=_0x5ae1[_0x2afdc6];return _0x16b16f;};'use strict';var _=require(_0x15ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15ae('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x15ae('0x2'));var logger=require(_0x15ae('0x3'))(_0x15ae('0x4'));var config=require(_0x15ae('0x5'));var jayson=require(_0x15ae('0x6'));var client=jayson['client'][_0x15ae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19baa0,_0x1e0691,_0x1fb4ca){return new BPromise(function(_0x2330d4,_0x2af3bd){return client[_0x15ae('0x8')](_0x19baa0,_0x1fb4ca)[_0x15ae('0x9')](function(_0x387527){logger['info'](_0x15ae('0xa'),_0x1e0691,'request\x20sent');logger[_0x15ae('0xb')](_0x15ae('0xc'),_0x1e0691,_0x15ae('0xd'),JSON[_0x15ae('0xe')](_0x387527));if(_0x387527[_0x15ae('0xf')]){if(_0x387527[_0x15ae('0xf')]['code']===0x1f4){logger[_0x15ae('0xf')](_0x15ae('0xa'),_0x1e0691,_0x387527[_0x15ae('0xf')]['message']);return _0x2af3bd(_0x387527['error']['message']);}logger[_0x15ae('0xf')](_0x15ae('0xa'),_0x1e0691,_0x387527[_0x15ae('0xf')][_0x15ae('0x10')]);return _0x2330d4(_0x387527[_0x15ae('0xf')][_0x15ae('0x10')]);}else{logger['info'](_0x15ae('0xa'),_0x1e0691,_0x15ae('0xd'));_0x2330d4(_0x387527[_0x15ae('0x11')][_0x15ae('0x10')]);}})[_0x15ae('0x12')](function(_0x3cd93e){logger[_0x15ae('0xf')](_0x15ae('0xa'),_0x1e0691,_0x3cd93e);_0x2af3bd(_0x3cd93e);});});} \ No newline at end of file +var _0x2ab8=['http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x2ab8,0x19e));var _0x82ab=function(_0x3e1e38,_0x69f183){_0x3e1e38=_0x3e1e38-0x0;var _0x532869=_0x2ab8[_0x3e1e38];return _0x532869;};'use strict';var _=require(_0x82ab('0x0'));var util=require(_0x82ab('0x1'));var moment=require(_0x82ab('0x2'));var BPromise=require('bluebird');var rs=require(_0x82ab('0x3'));var fs=require('fs');var Redis=require(_0x82ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82ab('0x5'));var logger=require(_0x82ab('0x6'))(_0x82ab('0x7'));var config=require(_0x82ab('0x8'));var jayson=require(_0x82ab('0x9'));var client=jayson[_0x82ab('0xa')][_0x82ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a098f,_0x4f87a8,_0x14aa22){return new BPromise(function(_0x16dcc2,_0xa316c4){return client[_0x82ab('0xc')](_0x2a098f,_0x14aa22)[_0x82ab('0xd')](function(_0x14c391){logger[_0x82ab('0xe')](_0x82ab('0xf'),_0x4f87a8,_0x82ab('0x10'));logger[_0x82ab('0x11')](_0x82ab('0x12'),_0x4f87a8,_0x82ab('0x10'),JSON[_0x82ab('0x13')](_0x14c391));if(_0x14c391['error']){if(_0x14c391[_0x82ab('0x14')][_0x82ab('0x15')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x4f87a8,_0x14c391['error'][_0x82ab('0x16')]);return _0xa316c4(_0x14c391['error']['message']);}logger[_0x82ab('0x14')](_0x82ab('0xf'),_0x4f87a8,_0x14c391[_0x82ab('0x14')]['message']);return _0x16dcc2(_0x14c391['error'][_0x82ab('0x16')]);}else{logger['info'](_0x82ab('0xf'),_0x4f87a8,'request\x20sent');_0x16dcc2(_0x14c391[_0x82ab('0x17')][_0x82ab('0x16')]);}})[_0x82ab('0x18')](function(_0x3530b7){logger[_0x82ab('0x14')](_0x82ab('0xf'),_0x4f87a8,_0x3530b7);_0xa316c4(_0x3530b7);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 2b361bd..fa91d8b 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 _0xd020=['get','isAuthenticated','index','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','join','post','preferred','put','multer','util','path','connect-timeout','express','Router','../../config/environment','./setting.controller'];(function(_0xe41644,_0xf7753d){var _0x1b741c=function(_0x69c22a){while(--_0x69c22a){_0xe41644['push'](_0xe41644['shift']());}};_0x1b741c(++_0xf7753d);}(_0xd020,0xe6));var _0x0d02=function(_0x568d13,_0x3acd44){_0x568d13=_0x568d13-0x0;var _0x1918ef=_0xd020[_0x568d13];return _0x1918ef;};'use strict';var multer=require(_0x0d02('0x0'));var util=require(_0x0d02('0x1'));var path=require(_0x0d02('0x2'));var timeout=require(_0x0d02('0x3'));var express=require(_0x0d02('0x4'));var router=express[_0x0d02('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0d02('0x6'));var controller=require(_0x0d02('0x7'));router[_0x0d02('0x8')]('/',auth[_0x0d02('0x9')](),controller[_0x0d02('0xa')]);router[_0x0d02('0x8')](_0x0d02('0xb'),controller[_0x0d02('0xc')]);router['get'](_0x0d02('0xd'),controller[_0x0d02('0xe')]);router[_0x0d02('0x8')](_0x0d02('0xf'),controller['getLogoLogin']);router[_0x0d02('0x8')](_0x0d02('0x10'),controller[_0x0d02('0x11')]);router['get'](_0x0d02('0x12'),controller[_0x0d02('0x13')]);var upload=multer({'storage':multer[_0x0d02('0x14')]({'destination':function(_0x24055a,_0x1bcf17,_0x539d75){_0x539d75(null,path['join'](config[_0x0d02('0x15')],_0x0d02('0x16')));},'filename':function(_0x1014de,_0x36ca8e,_0x5e44cf){_0x5e44cf(null,util[_0x0d02('0x17')](_0x0d02('0x18'),_0x0d02('0x19'),path[_0x0d02('0x1a')](_0x36ca8e[_0x0d02('0x1b')])));}})});router['post']('/:id/logo',upload[_0x0d02('0x1c')](_0x0d02('0x1d')),controller['addLogo']);var upload=multer({'storage':multer[_0x0d02('0x14')]({'destination':function(_0x33c950,_0x3bb2f1,_0x1a6266){_0x1a6266(null,path[_0x0d02('0x1e')](config[_0x0d02('0x15')],_0x0d02('0x16')));},'filename':function(_0x51b208,_0x2dfee3,_0x4460ea){_0x4460ea(null,util[_0x0d02('0x17')](_0x0d02('0x18'),'logologin',path[_0x0d02('0x1a')](_0x2dfee3['originalname'])));}})});router[_0x0d02('0x1f')](_0x0d02('0xf'),upload[_0x0d02('0x1c')](_0x0d02('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4599cf,_0x3dae29,_0x1cac47){_0x1cac47(null,path[_0x0d02('0x1e')](config[_0x0d02('0x15')],_0x0d02('0x16')));},'filename':function(_0x3ef126,_0x48d307,_0x11b360){_0x11b360(null,util[_0x0d02('0x17')](_0x0d02('0x18'),_0x0d02('0x20'),path[_0x0d02('0x1a')](_0x48d307[_0x0d02('0x1b')])));}})});router[_0x0d02('0x1f')]('/:id/preferred',upload[_0x0d02('0x1c')](_0x0d02('0x1d')),controller['addPreferred']);router[_0x0d02('0x21')](_0x0d02('0xb'),auth[_0x0d02('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xe901=['../../config/environment','./setting.controller','index','/:id','get','/:id/logo','getLogoLogin','gdpr','getPreferred','diskStorage','join','server/files/images/logos/','format','%s%s','logo','post','single','file','addLogo','root','extname','originalname','addLogoLogin','/:id/preferred','addPreferred','isAuthenticated','update','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xe901,0x1db));var _0x1e90=function(_0x4e25eb,_0x350892){_0x4e25eb=_0x4e25eb-0x0;var _0x4d34ca=_0xe901[_0x4e25eb];return _0x4d34ca;};'use strict';var multer=require('multer');var util=require(_0x1e90('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e90('0x1'));var router=express[_0x1e90('0x2')]();var auth=require(_0x1e90('0x3'));var interaction=require(_0x1e90('0x4'));var config=require(_0x1e90('0x5'));var controller=require(_0x1e90('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1e90('0x7')]);router['get'](_0x1e90('0x8'),controller['show']);router[_0x1e90('0x9')](_0x1e90('0xa'),controller['getLogo']);router[_0x1e90('0x9')]('/:id/logo_login',controller[_0x1e90('0xb')]);router[_0x1e90('0x9')]('/:id/gdpr',controller[_0x1e90('0xc')]);router[_0x1e90('0x9')]('/:id/preferred',controller[_0x1e90('0xd')]);var upload=multer({'storage':multer[_0x1e90('0xe')]({'destination':function(_0x221ccb,_0x13bf3d,_0x424a1a){_0x424a1a(null,path[_0x1e90('0xf')](config['root'],_0x1e90('0x10')));},'filename':function(_0xd6acd5,_0x1a66c4,_0x3968ea){_0x3968ea(null,util[_0x1e90('0x11')](_0x1e90('0x12'),_0x1e90('0x13'),path['extname'](_0x1a66c4['originalname'])));}})});router[_0x1e90('0x14')]('/:id/logo',upload[_0x1e90('0x15')](_0x1e90('0x16')),controller[_0x1e90('0x17')]);var upload=multer({'storage':multer[_0x1e90('0xe')]({'destination':function(_0x5cb939,_0x4a0385,_0x266e11){_0x266e11(null,path[_0x1e90('0xf')](config[_0x1e90('0x18')],_0x1e90('0x10')));},'filename':function(_0x262264,_0x2efdca,_0x4692b7){_0x4692b7(null,util[_0x1e90('0x11')](_0x1e90('0x12'),'logologin',path[_0x1e90('0x19')](_0x2efdca[_0x1e90('0x1a')])));}})});router[_0x1e90('0x14')]('/:id/logo_login',upload[_0x1e90('0x15')](_0x1e90('0x16')),controller[_0x1e90('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x508eee,_0x33ed60,_0x5640bf){_0x5640bf(null,path[_0x1e90('0xf')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3d05a0,_0x44bb73,_0x2995d5){_0x2995d5(null,util[_0x1e90('0x11')](_0x1e90('0x12'),'preferred',path[_0x1e90('0x19')](_0x44bb73['originalname'])));}})});router[_0x1e90('0x14')](_0x1e90('0x1c'),upload[_0x1e90('0x15')](_0x1e90('0x16')),controller[_0x1e90('0x1d')]);router['put']('/:id',auth[_0x1e90('0x1e')](),controller[_0x1e90('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 0398319..5ee0f5c 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 _0x4d91=['INTEGER','min_internal','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports'];(function(_0x273363,_0x2c2efe){var _0x405ed6=function(_0x3ec870){while(--_0x3ec870){_0x273363['push'](_0x273363['shift']());}};_0x405ed6(++_0x2c2efe);}(_0x4d91,0xbe));var _0x14d9=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x4d91[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x14d9('0x0'));module[_0x14d9('0x1')]={'min_internal':{'type':Sequelize[_0x14d9('0x2')](0xb),'unique':_0x14d9('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x14d9('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x14d9('0x4')]},'defaultLogo':{'type':Sequelize[_0x14d9('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x14d9('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x14d9('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x14d9('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x14d9('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x14d9('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x14d9('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x14d9('0x6')},'enableEmailPreview':{'type':Sequelize[_0x14d9('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x14d9('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x14d9('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x14d9('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x14d9('0x4')],'defaultValue':_0x14d9('0x7')},'chatTimeout':{'type':Sequelize[_0x14d9('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x14d9('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6024=['min_mailbox','STRING','BOOLEAN','exports','INTEGER','min_internal'];(function(_0x2cb742,_0x16184d){var _0x4e9847=function(_0x16ce9d){while(--_0x16ce9d){_0x2cb742['push'](_0x2cb742['shift']());}};_0x4e9847(++_0x16184d);}(_0x6024,0x171));var _0x4602=function(_0xc03315,_0x5385b5){_0xc03315=_0xc03315-0x0;var _0x152fa8=_0x6024[_0xc03315];return _0x152fa8;};'use strict';var Sequelize=require('sequelize');module[_0x4602('0x0')]={'min_internal':{'type':Sequelize[_0x4602('0x1')](0xb),'unique':_0x4602('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x4602('0x1')](0xb),'unique':_0x4602('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4602('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4602('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x4602('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x4602('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x4602('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x4602('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x4602('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x4602('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4602('0x4')]},'turnaddr':{'type':Sequelize[_0x4602('0x4')]},'turnusername':{'type':Sequelize[_0x4602('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x4602('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4602('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x4602('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x4602('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4602('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4602('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x4602('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4602('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x4602('0x4')]},'defaultPreferred':{'type':Sequelize[_0x4602('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index ed380d1..9733b08 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 _0x3eea=['error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','add','day','merge','where','filter','map','options','Setting','includeAll','include','show','find','readFileSync','join','root','utf8','render','server/files/templates/turn.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','res_rtp_asterisk.so','file','filename','body','logo','params','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','defaultPreferred','toLower','default_logo.png','default','upperFirst','custom','Sequelize','ValidationError','Logo\x20not\x20found','download','getLogoLogin','defaultLogo','existsSync','default_loginLogo.png','gdpr','securePassword','addPreferred','getPreferred','defaultLoginLogo','default_preferred.png','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x550c36,_0x18f1a8){_0x550c36=_0x550c36-0x0;var _0x10992a=_0x3eea[_0x550c36];return _0x10992a;};'use strict';var pdf=require(_0xa3ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3ee('0x1'));var zipdir=require(_0xa3ee('0x2'));var jsonpatch=require(_0xa3ee('0x3'));var rp=require(_0xa3ee('0x4'));var moment=require(_0xa3ee('0x5'));var BPromise=require(_0xa3ee('0x6'));var Mustache=require(_0xa3ee('0x7'));var util=require(_0xa3ee('0x8'));var path=require(_0xa3ee('0x9'));var sox=require(_0xa3ee('0xa'));var csv=require(_0xa3ee('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xb'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var qs=require(_0xa3ee('0xf'));var logger=require(_0xa3ee('0x10'))(_0xa3ee('0x11'));var utils=require('../../config/utils');var config=require(_0xa3ee('0x12'));var db=require(_0xa3ee('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa3ee('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x30e652,_0x403518,_0x4363d1,_0x594c88){return new BPromise(function(_0x16d2f9,_0x4d52ef){var _0x43b3bc=_0x594c88||client;return _0x43b3bc[_0xa3ee('0x15')](_0x30e652,_0x4363d1)[_0xa3ee('0x16')](function(_0x150e20){logger['info'](_0xa3ee('0x17'),_0x403518,_0xa3ee('0x18'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x403518,'request\x20sent',JSON[_0xa3ee('0x19')](_0x150e20));if(_0x150e20[_0xa3ee('0x1a')]){if(_0x150e20[_0xa3ee('0x1a')][_0xa3ee('0x1b')]===0x1f4){logger['error'](_0xa3ee('0x17'),_0x403518,_0x150e20[_0xa3ee('0x1a')][_0xa3ee('0x1c')]);return _0x4d52ef(_0x150e20[_0xa3ee('0x1a')][_0xa3ee('0x1c')]);}logger['error'](_0xa3ee('0x17'),_0x403518,_0x150e20[_0xa3ee('0x1a')][_0xa3ee('0x1c')]);return _0x16d2f9(_0x150e20[_0xa3ee('0x1a')][_0xa3ee('0x1c')]);}else{logger[_0xa3ee('0x1d')]('Setting,\x20%s,\x20%s',_0x403518,_0xa3ee('0x18'));_0x16d2f9(_0x150e20[_0xa3ee('0x1e')]['message']);}})[_0xa3ee('0x1f')](function(_0x4e7f32){logger[_0xa3ee('0x1a')](_0xa3ee('0x17'),_0x403518,_0x4e7f32);_0x4d52ef(_0x4e7f32);});});}function respondWithStatusCode(_0x1d3022,_0x1bd196){_0x1bd196=_0x1bd196||0xcc;return function(_0x60b899){if(_0x60b899){return _0x1d3022[_0xa3ee('0x20')](_0x1bd196);}return _0x1d3022[_0xa3ee('0x21')](_0x1bd196)[_0xa3ee('0x22')]();};}function respondWithResult(_0x5ae0a1,_0x3aa81d){_0x3aa81d=_0x3aa81d||0xc8;return function(_0x5b682b){if(_0x5b682b){return _0x5ae0a1[_0xa3ee('0x21')](_0x3aa81d)[_0xa3ee('0x23')](_0x5b682b);}};}function respondWithFilteredResult(_0x157071,_0x1fe4b4){return function(_0x2c48db){if(_0x2c48db){var _0x49c2f1=_0x2c48db[_0xa3ee('0x24')],_0x3c68f9=_0x1fe4b4[_0xa3ee('0x25')],_0x1b766e=_0x1fe4b4[_0xa3ee('0x25')]+_0x1fe4b4[_0xa3ee('0x26')],_0x146493;if(_0x1b766e>=_0x49c2f1){_0x1b766e=_0x49c2f1;_0x146493=0xc8;}else{_0x146493=0xce;}_0x157071[_0xa3ee('0x21')](_0x146493);return _0x157071[_0xa3ee('0x27')](_0xa3ee('0x28'),_0x3c68f9+'-'+_0x1b766e+'/'+_0x49c2f1)['json'](_0x2c48db);}return null;};}function patchUpdates(_0x5ba571){return function(_0x4abf49){try{jsonpatch[_0xa3ee('0x29')](_0x4abf49,_0x5ba571,!![]);}catch(_0x481358){return BPromise[_0xa3ee('0x2a')](_0x481358);}return _0x4abf49[_0xa3ee('0x2b')]();};}function saveUpdates(_0x265f4c,_0x353272){return function(_0x26b222){if(_0x26b222){return _0x26b222[_0xa3ee('0x2c')](_0x265f4c)[_0xa3ee('0x16')](function(_0x1dd03b){return _0x1dd03b;});}return null;};}function removeEntity(_0x120d81,_0x2cc835){return function(_0x4b717a){if(_0x4b717a){return _0x4b717a[_0xa3ee('0x2d')]()['then'](function(){_0x120d81[_0xa3ee('0x21')](0xcc)[_0xa3ee('0x22')]();});}};}function handleEntityNotFound(_0x496839,_0x179bc2){return function(_0x5a3c7f){if(!_0x5a3c7f){_0x496839[_0xa3ee('0x20')](0x194);}return _0x5a3c7f;};}function handleError(_0x49c71d,_0x3516c4){_0x3516c4=_0x3516c4||0x1f4;return function(_0x299099){logger[_0xa3ee('0x1a')](_0x299099[_0xa3ee('0x2e')]);if(_0x299099[_0xa3ee('0x2f')]){delete _0x299099['name'];}_0x49c71d[_0xa3ee('0x21')](_0x3516c4)[_0xa3ee('0x30')](_0x299099);};}exports[_0xa3ee('0x31')]=function(_0x5e7c36,_0x1599e4){var _0x531f58={},_0x10caa5={},_0x49a1ee={'count':0x0,'rows':[]};var _0x44bc25=db['Setting'][_0xa3ee('0x32')];_0x10caa5[_0xa3ee('0x33')]=_[_0xa3ee('0x34')](_0x44bc25);var _0x45be9b={'dateStart':_0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x36')],'dateEnd':_0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x37')]};delete _0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x36')];delete _0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x37')];_0x10caa5[_0xa3ee('0x35')]=_['keys'](_0x5e7c36[_0xa3ee('0x35')]);_0x10caa5[_0xa3ee('0x38')]=_[_0xa3ee('0x39')](_0x10caa5[_0xa3ee('0x33')],_0x10caa5['query']);_0x531f58[_0xa3ee('0x3a')]=_[_0xa3ee('0x39')](_0x10caa5[_0xa3ee('0x33')],qs['fields'](_0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x3b')]));_0x531f58['attributes']=_0x531f58[_0xa3ee('0x3a')][_0xa3ee('0x3c')]?_0x531f58['attributes']:_0x10caa5[_0xa3ee('0x33')];if(!_0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x3d')](_0xa3ee('0x3e'))){_0x531f58[_0xa3ee('0x26')]=qs[_0xa3ee('0x26')](_0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x26')]);_0x531f58[_0xa3ee('0x25')]=qs[_0xa3ee('0x25')](_0x5e7c36[_0xa3ee('0x35')]['offset']);}_0x531f58['order']=qs['sort'](_0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x3f')]);_0x531f58['where']=qs[_0xa3ee('0x38')](_[_0xa3ee('0x40')](_0x5e7c36[_0xa3ee('0x35')],_0x10caa5['filters']));if(_0x45be9b[_0xa3ee('0x36')]){if(_0x45be9b['dateEnd']){_0x45be9b[_0xa3ee('0x37')]=moment(_0x45be9b[_0xa3ee('0x37')])[_0xa3ee('0x41')](0x1,_0xa3ee('0x42'));}else{_0x45be9b[_0xa3ee('0x37')]=moment(_0x45be9b[_0xa3ee('0x36')])[_0xa3ee('0x41')](0x1,_0xa3ee('0x42'));}_[_0xa3ee('0x43')](_0x531f58[_0xa3ee('0x44')],{'createdAt':{'$gte':_0x45be9b[_0xa3ee('0x36')],'$lte':_0x45be9b[_0xa3ee('0x37')]}});}if(_0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x45')]){_0x531f58[_0xa3ee('0x44')]=_[_0xa3ee('0x43')](_0x531f58[_0xa3ee('0x44')],{'$or':_[_0xa3ee('0x46')](_0x531f58['attributes'],function(_0x2dcd10){var _0xdca412={};_0xdca412[_0x2dcd10]={'$like':'%'+_0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x45')]+'%'};return _0xdca412;})});}_0x531f58=_['merge']({},_0x531f58,_0x5e7c36[_0xa3ee('0x47')]);var _0x4bd451={'where':_0x531f58[_0xa3ee('0x44')]};return db[_0xa3ee('0x48')][_0xa3ee('0x24')](_0x4bd451)[_0xa3ee('0x16')](function(_0x2047f9){_0x49a1ee[_0xa3ee('0x24')]=_0x2047f9;if(_0x5e7c36[_0xa3ee('0x35')][_0xa3ee('0x49')]){_0x531f58[_0xa3ee('0x4a')]=[{'all':!![]}];}return db[_0xa3ee('0x48')]['findAll'](_0x531f58);})[_0xa3ee('0x16')](function(_0x5aa418){_0x49a1ee['rows']=_0x5aa418;return _0x49a1ee;})[_0xa3ee('0x16')](respondWithFilteredResult(_0x1599e4,_0x531f58))[_0xa3ee('0x1f')](handleError(_0x1599e4,null));};exports[_0xa3ee('0x4b')]=function(_0x1ec479,_0x400d2c){var _0x3e41af={'raw':![],'where':{'id':_0x1ec479['params']['id']}},_0x1f8699={};_0x1f8699[_0xa3ee('0x33')]=_[_0xa3ee('0x34')](db['Setting'][_0xa3ee('0x32')]);_0x1f8699[_0xa3ee('0x35')]=_[_0xa3ee('0x34')](_0x1ec479['query']);_0x1f8699['filters']=_[_0xa3ee('0x39')](_0x1f8699[_0xa3ee('0x33')],_0x1f8699[_0xa3ee('0x35')]);_0x3e41af[_0xa3ee('0x3a')]=_[_0xa3ee('0x39')](_0x1f8699['model'],qs['fields'](_0x1ec479[_0xa3ee('0x35')][_0xa3ee('0x3b')]));_0x3e41af['attributes']=_0x3e41af[_0xa3ee('0x3a')][_0xa3ee('0x3c')]?_0x3e41af[_0xa3ee('0x3a')]:_0x1f8699['model'];if(_0x1ec479['query'][_0xa3ee('0x49')]){_0x3e41af['include']=[{'all':!![]}];}_0x3e41af=_[_0xa3ee('0x43')]({},_0x3e41af,_0x1ec479[_0xa3ee('0x47')]);return db['Setting'][_0xa3ee('0x4c')](_0x3e41af)[_0xa3ee('0x16')](handleEntityNotFound(_0x400d2c,null))[_0xa3ee('0x16')](respondWithResult(_0x400d2c,null))['catch'](handleError(_0x400d2c,null));};exports[_0xa3ee('0x2c')]=function(_0x476cd5,_0x594034,_0x1d832c){var _0x80833c;return db[_0xa3ee('0x48')]['find']({'where':{'id':_0x476cd5['params']['id']}})[_0xa3ee('0x16')](handleEntityNotFound(_0x594034,null))[_0xa3ee('0x16')](saveUpdates(_0x476cd5['body'],null))[_0xa3ee('0x16')](function(_0x23b089){if(_0x23b089){_0x80833c=_0x23b089['get']({'plain':!![]});var _0x5afece=fs[_0xa3ee('0x4d')](path[_0xa3ee('0x4e')](config[_0xa3ee('0x4f')],'server/files/templates/stun.ejs'),_0xa3ee('0x50'));var _0x1f401d=ejs[_0xa3ee('0x51')](_0x5afece,_0x80833c);var _0x2edbe4=fs[_0xa3ee('0x4d')](path[_0xa3ee('0x4e')](config['root'],_0xa3ee('0x52')),_0xa3ee('0x50'));var _0x4d09b4=ejs[_0xa3ee('0x51')](_0x2edbe4,_0x80833c);fs[_0xa3ee('0x53')](_0xa3ee('0x54'),_0x1f401d);fs[_0xa3ee('0x53')](_0xa3ee('0x55'),_0x4d09b4);return respondWithRpcPromise(_0xa3ee('0x56'),'update',{'module':_0xa3ee('0x57')});}})[_0xa3ee('0x16')](function(){return respondWithRpcPromise(_0xa3ee('0x56'),'update',{'module':_0xa3ee('0x58')});})[_0xa3ee('0x16')](function(){return _0x80833c||null;})['then'](respondWithResult(_0x594034,null))['catch'](handleError(_0x594034,null));};exports['addLogo']=function(_0x5f02e1,_0x1a3b55,_0x3c76ca){if(_0x5f02e1[_0xa3ee('0x59')]&&_0x5f02e1[_0xa3ee('0x59')][_0xa3ee('0x5a')]){_0x5f02e1[_0xa3ee('0x5b')][_0xa3ee('0x5c')]=_0x5f02e1['file'][_0xa3ee('0x5a')];}return db[_0xa3ee('0x48')][_0xa3ee('0x4c')]({'where':{'id':_0x5f02e1[_0xa3ee('0x5d')]['id']}})[_0xa3ee('0x16')](handleEntityNotFound(_0x1a3b55,null))['then'](saveUpdates(_0x5f02e1['body'],null))[_0xa3ee('0x16')](respondWithResult(_0x1a3b55,null))[_0xa3ee('0x1f')](handleError(_0x1a3b55,null));};exports[_0xa3ee('0x5e')]=function(_0x24613d,_0x16aabe,_0x2ba157){if(_0x24613d[_0xa3ee('0x59')]&&_0x24613d[_0xa3ee('0x59')][_0xa3ee('0x5a')]){_0x24613d[_0xa3ee('0x5b')][_0xa3ee('0x5f')]=_0x24613d[_0xa3ee('0x59')][_0xa3ee('0x5a')];}return db[_0xa3ee('0x48')][_0xa3ee('0x4c')]({'where':{'id':_0x24613d['params']['id']}})[_0xa3ee('0x16')](handleEntityNotFound(_0x16aabe,null))['then'](saveUpdates(_0x24613d['body'],null))[_0xa3ee('0x16')](respondWithResult(_0x16aabe,null))['catch'](handleError(_0x16aabe,null));};var utilLicense=require(_0xa3ee('0x60'));exports[_0xa3ee('0x61')]=function(_0x31c50e,_0x221deb,_0x538089){var _0x3f6a8c=_0xa3ee('0x62');var _0x179ae2={'custom':![]};return utilLicense[_0xa3ee('0x63')]()['then'](function(_0x31245a){if(_0x31245a){_0x179ae2=_0x31245a;}return db[_0xa3ee('0x48')]['find']({'where':{'id':_0x31c50e[_0xa3ee('0x5d')]['id']},'attributes':['logo','loginLogo',_0xa3ee('0x64'),'defaultLogo','defaultLoginLogo',_0xa3ee('0x65')],'raw':!![]});})['then'](handleEntityNotFound(_0x221deb,null))['then'](function(_0x39979e){if(_0x39979e){var _0xf8689f=_0x39979e['logo']&&fs['existsSync'](path['join'](config[_0xa3ee('0x4f')],_0x3f6a8c,_[_0xa3ee('0x66')](_0x39979e[_0xa3ee('0x5c')])))?path[_0xa3ee('0x4e')](config[_0xa3ee('0x4f')],_0x3f6a8c,_[_0xa3ee('0x66')](_0x39979e['logo'])):path['join'](config[_0xa3ee('0x4f')],_0x3f6a8c,_[_0xa3ee('0x66')](_0xa3ee('0x67')));var _0x5675fb=_0xa3ee('0x68')+_[_0xa3ee('0x69')]('logo');if(_0x39979e[_0x5675fb]||!_0x179ae2[_0xa3ee('0x6a')]){_0xf8689f=path[_0xa3ee('0x4e')](config[_0xa3ee('0x4f')],_0x3f6a8c,_[_0xa3ee('0x66')](_0xa3ee('0x67')));}if(!fs['existsSync'](_0xf8689f)){throw new db[(_0xa3ee('0x6b'))][(_0xa3ee('0x6c'))](_0xa3ee('0x6d'));}return _0x221deb[_0xa3ee('0x6e')](_0xf8689f);}})[_0xa3ee('0x1f')](handleError(_0x221deb,null));};var utilLicense=require(_0xa3ee('0x60'));exports[_0xa3ee('0x6f')]=function(_0x119d4c,_0x448f14,_0x5e51fa){var _0x4e3ef9=_0xa3ee('0x62');var _0x57afba={'custom':![]};return utilLicense[_0xa3ee('0x63')]()[_0xa3ee('0x16')](function(_0x189dd0){if(_0x189dd0){_0x57afba=_0x189dd0;}return db[_0xa3ee('0x48')]['find']({'where':{'id':_0x119d4c[_0xa3ee('0x5d')]['id']},'attributes':[_0xa3ee('0x5c'),_0xa3ee('0x5f'),_0xa3ee('0x64'),_0xa3ee('0x70'),'defaultLoginLogo',_0xa3ee('0x65')],'raw':!![]});})[_0xa3ee('0x16')](handleEntityNotFound(_0x448f14,null))[_0xa3ee('0x16')](function(_0x51a54b){if(_0x51a54b){var _0x3ca523=_0x51a54b['loginLogo']&&fs[_0xa3ee('0x71')](path['join'](config[_0xa3ee('0x4f')],_0x4e3ef9,_[_0xa3ee('0x66')](_0x51a54b[_0xa3ee('0x5f')])))?path[_0xa3ee('0x4e')](config['root'],_0x4e3ef9,_[_0xa3ee('0x66')](_0x51a54b[_0xa3ee('0x5f')])):path['join'](config[_0xa3ee('0x4f')],_0x4e3ef9,_[_0xa3ee('0x66')](_0xa3ee('0x72')));var _0x15d2f1=_0xa3ee('0x68')+_['upperFirst'](_0xa3ee('0x5f'));if(_0x51a54b[_0x15d2f1]||!_0x57afba[_0xa3ee('0x6a')]){_0x3ca523=path['join'](config[_0xa3ee('0x4f')],_0x4e3ef9,_[_0xa3ee('0x66')](_0xa3ee('0x72')));}if(!fs[_0xa3ee('0x71')](_0x3ca523)){throw new db[(_0xa3ee('0x6b'))][(_0xa3ee('0x6c'))](_0xa3ee('0x6d'));}return _0x448f14[_0xa3ee('0x6e')](_0x3ca523);}})[_0xa3ee('0x1f')](handleError(_0x448f14,null));};exports[_0xa3ee('0x73')]=function(_0x4f7ace,_0x21fd56){return db[_0xa3ee('0x48')][_0xa3ee('0x4c')]({'where':{'id':_0x4f7ace['params']['id']},'attributes':[_0xa3ee('0x74')]})['then'](respondWithResult(_0x21fd56,null))[_0xa3ee('0x1f')](handleError(_0x21fd56,null));};exports[_0xa3ee('0x75')]=function(_0x4badd6,_0x1780c0,_0x44f27b){if(_0x4badd6['file']&&_0x4badd6[_0xa3ee('0x59')][_0xa3ee('0x5a')]){_0x4badd6[_0xa3ee('0x5b')][_0xa3ee('0x64')]=_0x4badd6[_0xa3ee('0x59')][_0xa3ee('0x5a')];}return db['Setting']['find']({'where':{'id':_0x4badd6['params']['id']}})[_0xa3ee('0x16')](handleEntityNotFound(_0x1780c0,null))['then'](saveUpdates(_0x4badd6[_0xa3ee('0x5b')],null))[_0xa3ee('0x16')](respondWithResult(_0x1780c0,null))[_0xa3ee('0x1f')](handleError(_0x1780c0,null));};var utilLicense=require(_0xa3ee('0x60'));exports[_0xa3ee('0x76')]=function(_0x3c104b,_0x1070ec,_0xea3d66){var _0x473bfc=_0xa3ee('0x62');var _0x1787bc={'custom':![]};return utilLicense[_0xa3ee('0x63')]()[_0xa3ee('0x16')](function(_0x201d7f){if(_0x201d7f){_0x1787bc=_0x201d7f;}return db[_0xa3ee('0x48')][_0xa3ee('0x4c')]({'where':{'id':_0x3c104b[_0xa3ee('0x5d')]['id']},'attributes':[_0xa3ee('0x5c'),_0xa3ee('0x5f'),'preferred',_0xa3ee('0x70'),_0xa3ee('0x77'),_0xa3ee('0x65')],'raw':!![]});})['then'](handleEntityNotFound(_0x1070ec,null))['then'](function(_0xc83f50){if(_0xc83f50){var _0x45299d=_0xc83f50['preferred']&&fs['existsSync'](path[_0xa3ee('0x4e')](config[_0xa3ee('0x4f')],_0x473bfc,_[_0xa3ee('0x66')](_0xc83f50[_0xa3ee('0x64')])))?path[_0xa3ee('0x4e')](config[_0xa3ee('0x4f')],_0x473bfc,_[_0xa3ee('0x66')](_0xc83f50[_0xa3ee('0x64')])):path[_0xa3ee('0x4e')](config[_0xa3ee('0x4f')],_0x473bfc,_[_0xa3ee('0x66')](_0xa3ee('0x78')));var _0xa0d7e5='default'+_[_0xa3ee('0x69')](_0xa3ee('0x64'));if(_0xc83f50[_0xa0d7e5]||!_0x1787bc[_0xa3ee('0x6a')]||!_0x1787bc[_0xa3ee('0x64')]){_0x45299d=path[_0xa3ee('0x4e')](config[_0xa3ee('0x4f')],_0x473bfc,_['toLower']('default_preferred.png'));}if(!fs[_0xa3ee('0x71')](_0x45299d)){throw new db[(_0xa3ee('0x6b'))][(_0xa3ee('0x6c'))]('Logo\x20not\x20found');}return _0x1070ec[_0xa3ee('0x6e')](_0x45299d);}})['catch'](handleError(_0x1070ec,null));}; \ No newline at end of file +var _0x17ba=['intersection','options','find','body','server/files/templates/stun.ejs','utf8','render','readFileSync','join','server/files/templates/turn.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','Reload','update','res_stun_monitor.so','addLogo','file','logo','filename','loginLogo','../../config/license/util','server/files/images/logos','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','toLower','root','default_logo.png','Logo\x20not\x20found','download','getLogoLogin','default_loginLogo.png','default','upperFirst','custom','Sequelize','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','ValidationError','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','Setting','rawAttributes','keys','dateStart','query','dateEnd','filters','model','attributes','fields','length','hasOwnProperty','order','sort','pick','add','day','merge','where','map','filter','count','includeAll','include','findAll','params'];(function(_0x1d0a89,_0x4f4a92){var _0xf4a42b=function(_0x28d13f){while(--_0x28d13f){_0x1d0a89['push'](_0x1d0a89['shift']());}};_0xf4a42b(++_0x4f4a92);}(_0x17ba,0xab));var _0xa17b=function(_0x4b88cf,_0x4e132f){_0x4b88cf=_0x4b88cf-0x0;var _0x4887ea=_0x17ba[_0x4b88cf];return _0x4887ea;};'use strict';var pdf=require(_0xa17b('0x0'));var emlformat=require(_0xa17b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa17b('0x2'));var jsonpatch=require(_0xa17b('0x3'));var rp=require(_0xa17b('0x4'));var moment=require(_0xa17b('0x5'));var BPromise=require(_0xa17b('0x6'));var Mustache=require(_0xa17b('0x7'));var util=require(_0xa17b('0x8'));var path=require(_0xa17b('0x9'));var sox=require(_0xa17b('0xa'));var csv=require(_0xa17b('0xb'));var ejs=require(_0xa17b('0xc'));var fs=require('fs');var _=require(_0xa17b('0xd'));var squel=require(_0xa17b('0xe'));var crypto=require(_0xa17b('0xf'));var jsforce=require(_0xa17b('0x10'));var deskjs=require(_0xa17b('0x11'));var toCsv=require(_0xa17b('0xb'));var querystring=require(_0xa17b('0x12'));var Papa=require(_0xa17b('0x13'));var Redis=require('ioredis');var qs=require(_0xa17b('0x14'));var logger=require(_0xa17b('0x15'))(_0xa17b('0x16'));var utils=require(_0xa17b('0x17'));var config=require(_0xa17b('0x18'));var db=require(_0xa17b('0x19'))['db'];var jayson=require(_0xa17b('0x1a'));var client=jayson['client'][_0xa17b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3e92e4,_0x3c3a8a,_0x52b7aa,_0x3abc59){return new BPromise(function(_0x3d7d46,_0x30236c){var _0xeeacaa=_0x3abc59||client;return _0xeeacaa['request'](_0x3e92e4,_0x52b7aa)[_0xa17b('0x1c')](function(_0x529910){logger[_0xa17b('0x1d')](_0xa17b('0x1e'),_0x3c3a8a,'request\x20sent');logger[_0xa17b('0x1f')](_0xa17b('0x20'),_0x3c3a8a,_0xa17b('0x21'),JSON[_0xa17b('0x22')](_0x529910));if(_0x529910['error']){if(_0x529910[_0xa17b('0x23')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3c3a8a,_0x529910[_0xa17b('0x23')][_0xa17b('0x24')]);return _0x30236c(_0x529910['error'][_0xa17b('0x24')]);}logger[_0xa17b('0x23')](_0xa17b('0x1e'),_0x3c3a8a,_0x529910[_0xa17b('0x23')][_0xa17b('0x24')]);return _0x3d7d46(_0x529910[_0xa17b('0x23')][_0xa17b('0x24')]);}else{logger['info'](_0xa17b('0x1e'),_0x3c3a8a,_0xa17b('0x21'));_0x3d7d46(_0x529910[_0xa17b('0x25')]['message']);}})[_0xa17b('0x26')](function(_0x1a6471){logger[_0xa17b('0x23')](_0xa17b('0x1e'),_0x3c3a8a,_0x1a6471);_0x30236c(_0x1a6471);});});}function respondWithStatusCode(_0x3c7ec2,_0x3daef4){_0x3daef4=_0x3daef4||0xcc;return function(_0x52309c){if(_0x52309c){return _0x3c7ec2[_0xa17b('0x27')](_0x3daef4);}return _0x3c7ec2['status'](_0x3daef4)[_0xa17b('0x28')]();};}function respondWithResult(_0x13630d,_0x4ba608){_0x4ba608=_0x4ba608||0xc8;return function(_0x491764){if(_0x491764){return _0x13630d[_0xa17b('0x29')](_0x4ba608)[_0xa17b('0x2a')](_0x491764);}};}function respondWithFilteredResult(_0x4216ca,_0x98f802){return function(_0x3c32a5){if(_0x3c32a5){var _0x3a64f5=_0x3c32a5['count'],_0x4cd38e=_0x98f802[_0xa17b('0x2b')],_0x47aff8=_0x98f802['offset']+_0x98f802[_0xa17b('0x2c')],_0x5c98fe;if(_0x47aff8>=_0x3a64f5){_0x47aff8=_0x3a64f5;_0x5c98fe=0xc8;}else{_0x5c98fe=0xce;}_0x4216ca['status'](_0x5c98fe);return _0x4216ca[_0xa17b('0x2d')](_0xa17b('0x2e'),_0x4cd38e+'-'+_0x47aff8+'/'+_0x3a64f5)[_0xa17b('0x2a')](_0x3c32a5);}return null;};}function patchUpdates(_0x28e6b8){return function(_0x346cc2){try{jsonpatch[_0xa17b('0x2f')](_0x346cc2,_0x28e6b8,!![]);}catch(_0x2fbbe8){return BPromise[_0xa17b('0x30')](_0x2fbbe8);}return _0x346cc2[_0xa17b('0x31')]();};}function saveUpdates(_0x2dc1f2,_0xe84db5){return function(_0x573585){if(_0x573585){return _0x573585['update'](_0x2dc1f2)['then'](function(_0x404369){return _0x404369;});}return null;};}function removeEntity(_0x11070a,_0x46b841){return function(_0x2888b8){if(_0x2888b8){return _0x2888b8[_0xa17b('0x32')]()[_0xa17b('0x1c')](function(){_0x11070a[_0xa17b('0x29')](0xcc)[_0xa17b('0x28')]();});}};}function handleEntityNotFound(_0x5884af,_0x1e33bf){return function(_0x4da126){if(!_0x4da126){_0x5884af[_0xa17b('0x27')](0x194);}return _0x4da126;};}function handleError(_0x43ee7b,_0x198ceb){_0x198ceb=_0x198ceb||0x1f4;return function(_0x3bde6d){logger[_0xa17b('0x23')](_0x3bde6d[_0xa17b('0x33')]);if(_0x3bde6d['name']){delete _0x3bde6d[_0xa17b('0x34')];}_0x43ee7b[_0xa17b('0x29')](_0x198ceb)[_0xa17b('0x35')](_0x3bde6d);};}exports[_0xa17b('0x36')]=function(_0x146fc3,_0x52d775){var _0x2db32a={},_0x5bb6a4={},_0x1ff7da={'count':0x0,'rows':[]};var _0x5a0b00=db[_0xa17b('0x37')][_0xa17b('0x38')];_0x5bb6a4['model']=_[_0xa17b('0x39')](_0x5a0b00);var _0x31b399={'dateStart':_0x146fc3['query'][_0xa17b('0x3a')],'dateEnd':_0x146fc3[_0xa17b('0x3b')][_0xa17b('0x3c')]};delete _0x146fc3[_0xa17b('0x3b')][_0xa17b('0x3a')];delete _0x146fc3['query'][_0xa17b('0x3c')];_0x5bb6a4['query']=_[_0xa17b('0x39')](_0x146fc3['query']);_0x5bb6a4[_0xa17b('0x3d')]=_['intersection'](_0x5bb6a4[_0xa17b('0x3e')],_0x5bb6a4['query']);_0x2db32a[_0xa17b('0x3f')]=_['intersection'](_0x5bb6a4[_0xa17b('0x3e')],qs[_0xa17b('0x40')](_0x146fc3[_0xa17b('0x3b')][_0xa17b('0x40')]));_0x2db32a[_0xa17b('0x3f')]=_0x2db32a[_0xa17b('0x3f')][_0xa17b('0x41')]?_0x2db32a[_0xa17b('0x3f')]:_0x5bb6a4['model'];if(!_0x146fc3[_0xa17b('0x3b')][_0xa17b('0x42')]('nolimit')){_0x2db32a[_0xa17b('0x2c')]=qs[_0xa17b('0x2c')](_0x146fc3[_0xa17b('0x3b')][_0xa17b('0x2c')]);_0x2db32a[_0xa17b('0x2b')]=qs[_0xa17b('0x2b')](_0x146fc3['query'][_0xa17b('0x2b')]);}_0x2db32a[_0xa17b('0x43')]=qs[_0xa17b('0x44')](_0x146fc3['query']['sort']);_0x2db32a['where']=qs[_0xa17b('0x3d')](_[_0xa17b('0x45')](_0x146fc3[_0xa17b('0x3b')],_0x5bb6a4[_0xa17b('0x3d')]));if(_0x31b399[_0xa17b('0x3a')]){if(_0x31b399[_0xa17b('0x3c')]){_0x31b399[_0xa17b('0x3c')]=moment(_0x31b399[_0xa17b('0x3c')])[_0xa17b('0x46')](0x1,_0xa17b('0x47'));}else{_0x31b399[_0xa17b('0x3c')]=moment(_0x31b399[_0xa17b('0x3a')])['add'](0x1,_0xa17b('0x47'));}_[_0xa17b('0x48')](_0x2db32a[_0xa17b('0x49')],{'createdAt':{'$gte':_0x31b399[_0xa17b('0x3a')],'$lte':_0x31b399[_0xa17b('0x3c')]}});}if(_0x146fc3[_0xa17b('0x3b')]['filter']){_0x2db32a[_0xa17b('0x49')]=_[_0xa17b('0x48')](_0x2db32a[_0xa17b('0x49')],{'$or':_[_0xa17b('0x4a')](_0x2db32a[_0xa17b('0x3f')],function(_0x51945a){var _0x27ff13={};_0x27ff13[_0x51945a]={'$like':'%'+_0x146fc3[_0xa17b('0x3b')][_0xa17b('0x4b')]+'%'};return _0x27ff13;})});}_0x2db32a=_[_0xa17b('0x48')]({},_0x2db32a,_0x146fc3['options']);var _0x37a020={'where':_0x2db32a[_0xa17b('0x49')]};return db[_0xa17b('0x37')][_0xa17b('0x4c')](_0x37a020)[_0xa17b('0x1c')](function(_0x19dee2){_0x1ff7da[_0xa17b('0x4c')]=_0x19dee2;if(_0x146fc3['query'][_0xa17b('0x4d')]){_0x2db32a[_0xa17b('0x4e')]=[{'all':!![]}];}return db['Setting'][_0xa17b('0x4f')](_0x2db32a);})[_0xa17b('0x1c')](function(_0x3495a6){_0x1ff7da['rows']=_0x3495a6;return _0x1ff7da;})[_0xa17b('0x1c')](respondWithFilteredResult(_0x52d775,_0x2db32a))[_0xa17b('0x26')](handleError(_0x52d775,null));};exports['show']=function(_0x30ea70,_0xe85fa){var _0x529953={'raw':![],'where':{'id':_0x30ea70[_0xa17b('0x50')]['id']}},_0x2950ee={};_0x2950ee['model']=_[_0xa17b('0x39')](db[_0xa17b('0x37')][_0xa17b('0x38')]);_0x2950ee[_0xa17b('0x3b')]=_[_0xa17b('0x39')](_0x30ea70[_0xa17b('0x3b')]);_0x2950ee[_0xa17b('0x3d')]=_['intersection'](_0x2950ee[_0xa17b('0x3e')],_0x2950ee[_0xa17b('0x3b')]);_0x529953[_0xa17b('0x3f')]=_[_0xa17b('0x51')](_0x2950ee[_0xa17b('0x3e')],qs[_0xa17b('0x40')](_0x30ea70[_0xa17b('0x3b')][_0xa17b('0x40')]));_0x529953[_0xa17b('0x3f')]=_0x529953[_0xa17b('0x3f')][_0xa17b('0x41')]?_0x529953[_0xa17b('0x3f')]:_0x2950ee[_0xa17b('0x3e')];if(_0x30ea70['query'][_0xa17b('0x4d')]){_0x529953[_0xa17b('0x4e')]=[{'all':!![]}];}_0x529953=_[_0xa17b('0x48')]({},_0x529953,_0x30ea70[_0xa17b('0x52')]);return db[_0xa17b('0x37')][_0xa17b('0x53')](_0x529953)[_0xa17b('0x1c')](handleEntityNotFound(_0xe85fa,null))[_0xa17b('0x1c')](respondWithResult(_0xe85fa,null))[_0xa17b('0x26')](handleError(_0xe85fa,null));};exports['update']=function(_0x4abe5b,_0x2a870d,_0x1ae9cb){var _0x55b0e4;return db['Setting']['find']({'where':{'id':_0x4abe5b[_0xa17b('0x50')]['id']}})[_0xa17b('0x1c')](handleEntityNotFound(_0x2a870d,null))[_0xa17b('0x1c')](saveUpdates(_0x4abe5b[_0xa17b('0x54')],null))[_0xa17b('0x1c')](function(_0x15a897){if(_0x15a897){_0x55b0e4=_0x15a897['get']({'plain':!![]});var _0x520954=fs['readFileSync'](path['join'](config['root'],_0xa17b('0x55')),_0xa17b('0x56'));var _0x20fe4a=ejs[_0xa17b('0x57')](_0x520954,_0x55b0e4);var _0x29764b=fs[_0xa17b('0x58')](path[_0xa17b('0x59')](config['root'],_0xa17b('0x5a')),_0xa17b('0x56'));var _0x3dc514=ejs[_0xa17b('0x57')](_0x29764b,_0x55b0e4);fs[_0xa17b('0x5b')](_0xa17b('0x5c'),_0x20fe4a);fs[_0xa17b('0x5b')](_0xa17b('0x5d'),_0x3dc514);return respondWithRpcPromise(_0xa17b('0x5e'),_0xa17b('0x5f'),{'module':_0xa17b('0x60')});}})[_0xa17b('0x1c')](function(){return respondWithRpcPromise('Reload',_0xa17b('0x5f'),{'module':'res_rtp_asterisk.so'});})[_0xa17b('0x1c')](function(){return _0x55b0e4||null;})[_0xa17b('0x1c')](respondWithResult(_0x2a870d,null))[_0xa17b('0x26')](handleError(_0x2a870d,null));};exports[_0xa17b('0x61')]=function(_0x5ab780,_0x40a397,_0x57a1d9){if(_0x5ab780[_0xa17b('0x62')]&&_0x5ab780['file']['filename']){_0x5ab780[_0xa17b('0x54')][_0xa17b('0x63')]=_0x5ab780['file'][_0xa17b('0x64')];}return db[_0xa17b('0x37')]['find']({'where':{'id':_0x5ab780['params']['id']}})[_0xa17b('0x1c')](handleEntityNotFound(_0x40a397,null))[_0xa17b('0x1c')](saveUpdates(_0x5ab780['body'],null))[_0xa17b('0x1c')](respondWithResult(_0x40a397,null))[_0xa17b('0x26')](handleError(_0x40a397,null));};exports['addLogoLogin']=function(_0x27ba7a,_0x3ad933,_0x6464cb){if(_0x27ba7a[_0xa17b('0x62')]&&_0x27ba7a[_0xa17b('0x62')]['filename']){_0x27ba7a[_0xa17b('0x54')][_0xa17b('0x65')]=_0x27ba7a[_0xa17b('0x62')][_0xa17b('0x64')];}return db[_0xa17b('0x37')][_0xa17b('0x53')]({'where':{'id':_0x27ba7a[_0xa17b('0x50')]['id']}})[_0xa17b('0x1c')](handleEntityNotFound(_0x3ad933,null))[_0xa17b('0x1c')](saveUpdates(_0x27ba7a[_0xa17b('0x54')],null))['then'](respondWithResult(_0x3ad933,null))[_0xa17b('0x26')](handleError(_0x3ad933,null));};var utilLicense=require(_0xa17b('0x66'));exports['getLogo']=function(_0x5f5964,_0x14dbba,_0xa38cc8){var _0x2d426a=_0xa17b('0x67');var _0xa6a240={'custom':![]};return utilLicense['getLicense']()[_0xa17b('0x1c')](function(_0x469ecd){if(_0x469ecd){_0xa6a240=_0x469ecd;}return db[_0xa17b('0x37')][_0xa17b('0x53')]({'where':{'id':_0x5f5964['params']['id']},'attributes':[_0xa17b('0x63'),'loginLogo',_0xa17b('0x68'),_0xa17b('0x69'),_0xa17b('0x6a'),_0xa17b('0x6b')],'raw':!![]});})[_0xa17b('0x1c')](handleEntityNotFound(_0x14dbba,null))['then'](function(_0x8ec93e){if(_0x8ec93e){var _0x1dd1b6=_0x8ec93e[_0xa17b('0x63')]&&fs[_0xa17b('0x6c')](path[_0xa17b('0x59')](config['root'],_0x2d426a,_[_0xa17b('0x6d')](_0x8ec93e[_0xa17b('0x63')])))?path['join'](config[_0xa17b('0x6e')],_0x2d426a,_[_0xa17b('0x6d')](_0x8ec93e['logo'])):path['join'](config[_0xa17b('0x6e')],_0x2d426a,_[_0xa17b('0x6d')](_0xa17b('0x6f')));var _0x4eaec5='default'+_['upperFirst'](_0xa17b('0x63'));if(_0x8ec93e[_0x4eaec5]||!_0xa6a240['custom']){_0x1dd1b6=path[_0xa17b('0x59')](config[_0xa17b('0x6e')],_0x2d426a,_[_0xa17b('0x6d')](_0xa17b('0x6f')));}if(!fs['existsSync'](_0x1dd1b6)){throw new db['Sequelize']['ValidationError'](_0xa17b('0x70'));}return _0x14dbba[_0xa17b('0x71')](_0x1dd1b6);}})[_0xa17b('0x26')](handleError(_0x14dbba,null));};var utilLicense=require(_0xa17b('0x66'));exports[_0xa17b('0x72')]=function(_0x671f85,_0x19aaaf,_0x461bd9){var _0x12a1c5='server/files/images/logos';var _0x24e29a={'custom':![]};return utilLicense['getLicense']()[_0xa17b('0x1c')](function(_0x481eea){if(_0x481eea){_0x24e29a=_0x481eea;}return db[_0xa17b('0x37')][_0xa17b('0x53')]({'where':{'id':_0x671f85[_0xa17b('0x50')]['id']},'attributes':['logo',_0xa17b('0x65'),'preferred',_0xa17b('0x69'),_0xa17b('0x6a'),_0xa17b('0x6b')],'raw':!![]});})['then'](handleEntityNotFound(_0x19aaaf,null))[_0xa17b('0x1c')](function(_0x166c08){if(_0x166c08){var _0x27b9c0=_0x166c08[_0xa17b('0x65')]&&fs[_0xa17b('0x6c')](path['join'](config[_0xa17b('0x6e')],_0x12a1c5,_[_0xa17b('0x6d')](_0x166c08[_0xa17b('0x65')])))?path[_0xa17b('0x59')](config[_0xa17b('0x6e')],_0x12a1c5,_['toLower'](_0x166c08[_0xa17b('0x65')])):path[_0xa17b('0x59')](config[_0xa17b('0x6e')],_0x12a1c5,_['toLower'](_0xa17b('0x73')));var _0x8d9082=_0xa17b('0x74')+_[_0xa17b('0x75')](_0xa17b('0x65'));if(_0x166c08[_0x8d9082]||!_0x24e29a[_0xa17b('0x76')]){_0x27b9c0=path[_0xa17b('0x59')](config[_0xa17b('0x6e')],_0x12a1c5,_[_0xa17b('0x6d')](_0xa17b('0x73')));}if(!fs['existsSync'](_0x27b9c0)){throw new db[(_0xa17b('0x77'))]['ValidationError']('Logo\x20not\x20found');}return _0x19aaaf[_0xa17b('0x71')](_0x27b9c0);}})[_0xa17b('0x26')](handleError(_0x19aaaf,null));};exports[_0xa17b('0x78')]=function(_0x5aa85b,_0x26b46b){return db[_0xa17b('0x37')][_0xa17b('0x53')]({'where':{'id':_0x5aa85b[_0xa17b('0x50')]['id']},'attributes':[_0xa17b('0x79')]})[_0xa17b('0x1c')](respondWithResult(_0x26b46b,null))[_0xa17b('0x26')](handleError(_0x26b46b,null));};exports[_0xa17b('0x7a')]=function(_0x4e6a1a,_0x4a6813,_0x353c2d){if(_0x4e6a1a['file']&&_0x4e6a1a[_0xa17b('0x62')]['filename']){_0x4e6a1a['body'][_0xa17b('0x68')]=_0x4e6a1a['file'][_0xa17b('0x64')];}return db[_0xa17b('0x37')][_0xa17b('0x53')]({'where':{'id':_0x4e6a1a[_0xa17b('0x50')]['id']}})[_0xa17b('0x1c')](handleEntityNotFound(_0x4a6813,null))[_0xa17b('0x1c')](saveUpdates(_0x4e6a1a[_0xa17b('0x54')],null))[_0xa17b('0x1c')](respondWithResult(_0x4a6813,null))[_0xa17b('0x26')](handleError(_0x4a6813,null));};var utilLicense=require(_0xa17b('0x66'));exports[_0xa17b('0x7b')]=function(_0xeb1b4e,_0x1f3c29,_0x259433){var _0x3789a5=_0xa17b('0x67');var _0x4cb080={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x410657){if(_0x410657){_0x4cb080=_0x410657;}return db['Setting'][_0xa17b('0x53')]({'where':{'id':_0xeb1b4e[_0xa17b('0x50')]['id']},'attributes':['logo',_0xa17b('0x65'),'preferred',_0xa17b('0x69'),_0xa17b('0x6a'),_0xa17b('0x6b')],'raw':!![]});})[_0xa17b('0x1c')](handleEntityNotFound(_0x1f3c29,null))[_0xa17b('0x1c')](function(_0x5a85ee){if(_0x5a85ee){var _0x531102=_0x5a85ee[_0xa17b('0x68')]&&fs[_0xa17b('0x6c')](path[_0xa17b('0x59')](config[_0xa17b('0x6e')],_0x3789a5,_[_0xa17b('0x6d')](_0x5a85ee[_0xa17b('0x68')])))?path[_0xa17b('0x59')](config[_0xa17b('0x6e')],_0x3789a5,_[_0xa17b('0x6d')](_0x5a85ee[_0xa17b('0x68')])):path['join'](config[_0xa17b('0x6e')],_0x3789a5,_[_0xa17b('0x6d')](_0xa17b('0x7c')));var _0x519cd9=_0xa17b('0x74')+_[_0xa17b('0x75')]('preferred');if(_0x5a85ee[_0x519cd9]||!_0x4cb080[_0xa17b('0x76')]||!_0x4cb080[_0xa17b('0x68')]){_0x531102=path[_0xa17b('0x59')](config[_0xa17b('0x6e')],_0x3789a5,_[_0xa17b('0x6d')](_0xa17b('0x7c')));}if(!fs['existsSync'](_0x531102)){throw new db[(_0xa17b('0x77'))][(_0xa17b('0x7d'))]('Logo\x20not\x20found');}return _0x1f3c29[_0xa17b('0x71')](_0x531102);}})[_0xa17b('0x26')](handleError(_0x1f3c29,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f6c0892..5dad575 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 _0x5a02=['bluebird','request-promise','./setting.attributes','exports','define','util','../../config/logger','api','moment'];(function(_0x1424bd,_0x3a75ea){var _0x1a424e=function(_0x5abad9){while(--_0x5abad9){_0x1424bd['push'](_0x1424bd['shift']());}};_0x1a424e(++_0x3a75ea);}(_0x5a02,0x152));var _0x25a0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5a02[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x25a0('0x0'));var logger=require(_0x25a0('0x1'))(_0x25a0('0x2'));var moment=require(_0x25a0('0x3'));var BPromise=require(_0x25a0('0x4'));var rp=require(_0x25a0('0x5'));var attributes=require(_0x25a0('0x6'));module[_0x25a0('0x7')]=function(_0x26f75f,_0x2b9fbd){return _0x26f75f[_0x25a0('0x8')]('Setting',attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc020=['exports','define','Setting','lodash','util','../../config/logger','moment','request-promise','./setting.attributes'];(function(_0x26edf6,_0x143a47){var _0x10a73d=function(_0x46d42d){while(--_0x46d42d){_0x26edf6['push'](_0x26edf6['shift']());}};_0x10a73d(++_0x143a47);}(_0xc020,0x108));var _0x0c02=function(_0x552352,_0x51e3b0){_0x552352=_0x552352-0x0;var _0x1e0d71=_0xc020[_0x552352];return _0x1e0d71;};'use strict';var _=require(_0x0c02('0x0'));var util=require(_0x0c02('0x1'));var logger=require(_0x0c02('0x2'))('api');var moment=require(_0x0c02('0x3'));var BPromise=require('bluebird');var rp=require(_0x0c02('0x4'));var attributes=require(_0x0c02('0x5'));module[_0x0c02('0x6')]=function(_0x1358ac,_0x51415e){return _0x1358ac[_0x0c02('0x7')](_0x0c02('0x8'),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 aabd71a..9e925c8 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 _0x8786=['debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Setting,\x20%s,\x20%s'];(function(_0x4b6511,_0x30cb8b){var _0x240297=function(_0x5c333c){while(--_0x5c333c){_0x4b6511['push'](_0x4b6511['shift']());}};_0x240297(++_0x30cb8b);}(_0x8786,0x7a));var _0x6878=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8786[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x6878('0x0'));var util=require(_0x6878('0x1'));var moment=require(_0x6878('0x2'));var BPromise=require(_0x6878('0x3'));var rs=require(_0x6878('0x4'));var fs=require('fs');var Redis=require(_0x6878('0x5'));var db=require(_0x6878('0x6'))['db'];var utils=require(_0x6878('0x7'));var logger=require(_0x6878('0x8'))(_0x6878('0x9'));var config=require(_0x6878('0xa'));var jayson=require(_0x6878('0xb'));var client=jayson['client'][_0x6878('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40c823,_0x4b979f,_0x189938){return new BPromise(function(_0x13ddf4,_0x3b7462){return client['request'](_0x40c823,_0x189938)[_0x6878('0xd')](function(_0x18feba){logger[_0x6878('0xe')](_0x6878('0xf'),_0x4b979f,'request\x20sent');logger[_0x6878('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x4b979f,_0x6878('0x11'),JSON[_0x6878('0x12')](_0x18feba));if(_0x18feba[_0x6878('0x13')]){if(_0x18feba[_0x6878('0x13')][_0x6878('0x14')]===0x1f4){logger[_0x6878('0x13')](_0x6878('0xf'),_0x4b979f,_0x18feba[_0x6878('0x13')][_0x6878('0x15')]);return _0x3b7462(_0x18feba[_0x6878('0x13')][_0x6878('0x15')]);}logger[_0x6878('0x13')](_0x6878('0xf'),_0x4b979f,_0x18feba[_0x6878('0x13')]['message']);return _0x13ddf4(_0x18feba[_0x6878('0x13')][_0x6878('0x15')]);}else{logger[_0x6878('0xe')](_0x6878('0xf'),_0x4b979f,_0x6878('0x11'));_0x13ddf4(_0x18feba['result']['message']);}})[_0x6878('0x16')](function(_0x188082){logger[_0x6878('0x13')](_0x6878('0xf'),_0x4b979f,_0x188082);_0x3b7462(_0x188082);});});} \ No newline at end of file +var _0xbe32=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','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','message','result','catch','lodash'];(function(_0x597e38,_0x551ac2){var _0x5305d2=function(_0x47dc5e){while(--_0x47dc5e){_0x597e38['push'](_0x597e38['shift']());}};_0x5305d2(++_0x551ac2);}(_0xbe32,0x89));var _0x2be3=function(_0x30e6cd,_0x54005f){_0x30e6cd=_0x30e6cd-0x0;var _0x306a50=_0xbe32[_0x30e6cd];return _0x306a50;};'use strict';var _=require(_0x2be3('0x0'));var util=require(_0x2be3('0x1'));var moment=require('moment');var BPromise=require(_0x2be3('0x2'));var rs=require(_0x2be3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2be3('0x4'))['db'];var utils=require(_0x2be3('0x5'));var logger=require(_0x2be3('0x6'))(_0x2be3('0x7'));var config=require(_0x2be3('0x8'));var jayson=require(_0x2be3('0x9'));var client=jayson[_0x2be3('0xa')][_0x2be3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1203c1,_0x22b509,_0x2f865b){return new BPromise(function(_0x2634ac,_0x4476cf){return client['request'](_0x1203c1,_0x2f865b)[_0x2be3('0xc')](function(_0x5426c5){logger[_0x2be3('0xd')](_0x2be3('0xe'),_0x22b509,_0x2be3('0xf'));logger[_0x2be3('0x10')](_0x2be3('0x11'),_0x22b509,_0x2be3('0xf'),JSON[_0x2be3('0x12')](_0x5426c5));if(_0x5426c5['error']){if(_0x5426c5[_0x2be3('0x13')]['code']===0x1f4){logger[_0x2be3('0x13')](_0x2be3('0xe'),_0x22b509,_0x5426c5[_0x2be3('0x13')][_0x2be3('0x14')]);return _0x4476cf(_0x5426c5[_0x2be3('0x13')][_0x2be3('0x14')]);}logger[_0x2be3('0x13')](_0x2be3('0xe'),_0x22b509,_0x5426c5[_0x2be3('0x13')][_0x2be3('0x14')]);return _0x2634ac(_0x5426c5[_0x2be3('0x13')]['message']);}else{logger[_0x2be3('0xd')](_0x2be3('0xe'),_0x22b509,_0x2be3('0xf'));_0x2634ac(_0x5426c5[_0x2be3('0x15')]['message']);}})[_0x2be3('0x16')](function(_0x1a5c8a){logger[_0x2be3('0x13')](_0x2be3('0xe'),_0x22b509,_0x1a5c8a);_0x4476cf(_0x1a5c8a);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8c3f7c6..90255e9 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 _0x3251=['create','addDisposition','addAnswer','notify','addApplications','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','statusGet','/:id/users','getAgents','post'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3251,0x18c));var _0x1325=function(_0x36a640,_0xde54fb){_0x36a640=_0x36a640-0x0;var _0x40307d=_0x3251[_0x36a640];return _0x40307d;};'use strict';var multer=require(_0x1325('0x0'));var util=require(_0x1325('0x1'));var path=require(_0x1325('0x2'));var timeout=require(_0x1325('0x3'));var express=require(_0x1325('0x4'));var router=express[_0x1325('0x5')]();var auth=require(_0x1325('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsAccount.controller');router[_0x1325('0x7')]('/',auth[_0x1325('0x8')](),controller['index']);router[_0x1325('0x7')](_0x1325('0x9'),auth[_0x1325('0x8')](),controller[_0x1325('0xa')]);router[_0x1325('0x7')](_0x1325('0xb'),auth[_0x1325('0x8')](),controller[_0x1325('0xc')]);router[_0x1325('0x7')](_0x1325('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x1325('0x7')](_0x1325('0xe'),auth[_0x1325('0x8')](),controller['getAnswers']);router[_0x1325('0x7')](_0x1325('0xf'),auth[_0x1325('0x8')](),controller[_0x1325('0x10')]);router['get'](_0x1325('0x11'),auth[_0x1325('0x8')](),controller['getInteractions']);router[_0x1325('0x7')]('/:id/status',controller[_0x1325('0x12')]);router[_0x1325('0x7')](_0x1325('0x13'),auth[_0x1325('0x8')](),controller[_0x1325('0x14')]);router[_0x1325('0x15')]('/',auth['isAuthenticated'](),controller[_0x1325('0x16')]);router['post'](_0x1325('0xd'),auth[_0x1325('0x8')](),controller[_0x1325('0x17')]);router[_0x1325('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1325('0x18')]);router[_0x1325('0x15')]('/:id/notify',controller[_0x1325('0x19')]);router[_0x1325('0x15')](_0x1325('0xf'),auth[_0x1325('0x8')](),controller[_0x1325('0x1a')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x1325('0x1b')]);router[_0x1325('0x15')]('/:id/status',controller[_0x1325('0x1c')]);router[_0x1325('0x15')](_0x1325('0x13'),auth[_0x1325('0x8')](),controller[_0x1325('0x1d')]);router[_0x1325('0x1e')]('/:id',auth[_0x1325('0x8')](),controller[_0x1325('0x1f')]);router[_0x1325('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x1325('0x21')]);router[_0x1325('0x20')](_0x1325('0xd'),auth[_0x1325('0x8')](),controller[_0x1325('0x22')]);router[_0x1325('0x20')]('/:id/canned_answers',auth[_0x1325('0x8')](),controller[_0x1325('0x23')]);router[_0x1325('0x20')](_0x1325('0x13'),auth[_0x1325('0x8')](),controller[_0x1325('0x24')]);module[_0x1325('0x25')]=router; \ No newline at end of file +var _0xb0e6=['util','connect-timeout','express','../../config/environment','./smsAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','addAnswer','/:id/notify','notify','addApplications','send','status','update','delete','destroy','removeAnswers','removeAgents','exports','multer'];(function(_0x4e8e68,_0x52a7b8){var _0x3c1398=function(_0x315eb8){while(--_0x315eb8){_0x4e8e68['push'](_0x4e8e68['shift']());}};_0x3c1398(++_0x52a7b8);}(_0xb0e6,0x1a3));var _0x6b0e=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xb0e6[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0x6b0e('0x0'));var util=require(_0x6b0e('0x1'));var path=require('path');var timeout=require(_0x6b0e('0x2'));var express=require(_0x6b0e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6b0e('0x4'));var controller=require(_0x6b0e('0x5'));router[_0x6b0e('0x6')]('/',auth['isAuthenticated'](),controller[_0x6b0e('0x7')]);router[_0x6b0e('0x6')](_0x6b0e('0x8'),auth['isAuthenticated'](),controller[_0x6b0e('0x9')]);router['get'](_0x6b0e('0xa'),auth[_0x6b0e('0xb')](),controller['show']);router[_0x6b0e('0x6')](_0x6b0e('0xc'),auth[_0x6b0e('0xb')](),controller['getDispositions']);router['get'](_0x6b0e('0xd'),auth['isAuthenticated'](),controller[_0x6b0e('0xe')]);router[_0x6b0e('0x6')](_0x6b0e('0xf'),auth['isAuthenticated'](),controller[_0x6b0e('0x10')]);router[_0x6b0e('0x6')](_0x6b0e('0x11'),auth[_0x6b0e('0xb')](),controller[_0x6b0e('0x12')]);router[_0x6b0e('0x6')](_0x6b0e('0x13'),controller[_0x6b0e('0x14')]);router[_0x6b0e('0x6')](_0x6b0e('0x15'),auth[_0x6b0e('0xb')](),controller['getAgents']);router[_0x6b0e('0x16')]('/',auth[_0x6b0e('0xb')](),controller['create']);router['post'](_0x6b0e('0xc'),auth[_0x6b0e('0xb')](),controller['addDisposition']);router[_0x6b0e('0x16')](_0x6b0e('0xd'),auth[_0x6b0e('0xb')](),controller[_0x6b0e('0x17')]);router['post'](_0x6b0e('0x18'),controller[_0x6b0e('0x19')]);router[_0x6b0e('0x16')]('/:id/applications',auth[_0x6b0e('0xb')](),controller[_0x6b0e('0x1a')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x6b0e('0x1b')]);router[_0x6b0e('0x16')]('/:id/status',controller[_0x6b0e('0x1c')]);router[_0x6b0e('0x16')]('/:id/users',auth[_0x6b0e('0xb')](),controller['addAgents']);router['put'](_0x6b0e('0xa'),auth['isAuthenticated'](),controller[_0x6b0e('0x1d')]);router[_0x6b0e('0x1e')](_0x6b0e('0xa'),auth[_0x6b0e('0xb')](),controller[_0x6b0e('0x1f')]);router[_0x6b0e('0x1e')](_0x6b0e('0xc'),auth[_0x6b0e('0xb')](),controller['removeDispositions']);router[_0x6b0e('0x1e')](_0x6b0e('0xd'),auth[_0x6b0e('0xb')](),controller[_0x6b0e('0x20')]);router[_0x6b0e('0x1e')](_0x6b0e('0x15'),auth[_0x6b0e('0xb')](),controller[_0x6b0e('0x21')]);module[_0x6b0e('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 1fadbcd..e9bfc21 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 _0xe88e=['ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','randomstring','STRING','name','generate','twilio','skebby','connectel','clickatell','csc','infobip'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe88e,0x1a3));var _0xee88=function(_0x356b9e,_0x306f73){_0x356b9e=_0x356b9e-0x0;var _0x15e910=_0xe88e[_0x356b9e];return _0x15e910;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xee88('0x0'));module['exports']={'name':{'type':Sequelize[_0xee88('0x1')],'unique':_0xee88('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xee88('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xee88('0x1')],'defaultValue':function(){return rs[_0xee88('0x3')]();}},'phone':{'type':Sequelize[_0xee88('0x1')]},'type':{'type':Sequelize['ENUM'](_0xee88('0x4'),_0xee88('0x5'),_0xee88('0x6'),'clicksend','plivo',_0xee88('0x7'),_0xee88('0x8'),_0xee88('0x9'))},'accountSid':{'type':Sequelize[_0xee88('0x1')]},'authId':{'type':Sequelize[_0xee88('0x1')]},'authToken':{'type':Sequelize[_0xee88('0x1')]},'smsMethod':{'type':Sequelize[_0xee88('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0xee88('0x1')]},'password':{'type':Sequelize[_0xee88('0x1')]},'apiKey':{'type':Sequelize[_0xee88('0x1')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xee88('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xee88('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xee88('0xc');}},'notificationSound':{'type':Sequelize[_0xee88('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xee88('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xee88('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xee88('0x1')]}}; \ No newline at end of file +var _0xed49=['sequelize','exports','STRING','name','generate','twilio','skebby','connectel','csc','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x23e02e,_0x4d26cb){var _0x2a6db8=function(_0x46e7af){while(--_0x46e7af){_0x23e02e['push'](_0x23e02e['shift']());}};_0x2a6db8(++_0x4d26cb);}(_0xed49,0x1ee));var _0x9ed4=function(_0x5e3386,_0x15a997){_0x5e3386=_0x5e3386-0x0;var _0x27524e=_0xed49[_0x5e3386];return _0x27524e;};'use strict';var Sequelize=require(_0x9ed4('0x0'));var rs=require('randomstring');module[_0x9ed4('0x1')]={'name':{'type':Sequelize[_0x9ed4('0x2')],'unique':_0x9ed4('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x9ed4('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9ed4('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x9ed4('0x5'),_0x9ed4('0x6'),_0x9ed4('0x7'),'clicksend','plivo','clickatell',_0x9ed4('0x8'),'infobip')},'accountSid':{'type':Sequelize[_0x9ed4('0x2')]},'authId':{'type':Sequelize[_0x9ed4('0x2')]},'authToken':{'type':Sequelize[_0x9ed4('0x2')]},'smsMethod':{'type':Sequelize[_0x9ed4('0x9')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9ed4('0x2')]},'password':{'type':Sequelize[_0x9ed4('0x2')]},'apiKey':{'type':Sequelize[_0x9ed4('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x9ed4('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9ed4('0xa');}},'notificationSound':{'type':Sequelize[_0x9ed4('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9ed4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9ed4('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ed4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9ed4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index e5cc61c..c620cf0 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 _0x7278=['day','merge','filter','map','options','SmsAccount','include','rows','show','params','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','catch','body','describe','SmsAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','applications','asc','account','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','type','from','From','Body','messageId','skebby','sender','connectel','clicksend','message_id','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','defaults','contact','spread','interaction','created','push','close','unmanaged','SmsMessage','ContactId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','\x0a','addApplications','transaction','SmsApplication','findAndCountAll','priority','getApplications','getInteractions','SmsInteraction','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','DESC','ListId','out','Messages','dataValues','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','update','inspect','RECEIVED_BY_RECIPIENT','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add'];(function(_0x1864d6,_0x530830){var _0x36ae25=function(_0x20e789){while(--_0x20e789){_0x1864d6['push'](_0x1864d6['shift']());}};_0x36ae25(++_0x530830);}(_0x7278,0x161));var _0x8727=function(_0x3eb946,_0x188b07){_0x3eb946=_0x3eb946-0x0;var _0x3a118c=_0x7278[_0x3eb946];return _0x3a118c;};'use strict';var pdf=require(_0x8727('0x0'));var emlformat=require(_0x8727('0x1'));var rimraf=require(_0x8727('0x2'));var zipdir=require(_0x8727('0x3'));var jsonpatch=require(_0x8727('0x4'));var rp=require('request-promise');var moment=require(_0x8727('0x5'));var BPromise=require(_0x8727('0x6'));var Mustache=require(_0x8727('0x7'));var util=require(_0x8727('0x8'));var path=require(_0x8727('0x9'));var sox=require(_0x8727('0xa'));var csv=require(_0x8727('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8727('0xc'));var squel=require(_0x8727('0xd'));var crypto=require(_0x8727('0xe'));var jsforce=require(_0x8727('0xf'));var deskjs=require(_0x8727('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8727('0x11'));var qs=require(_0x8727('0x12'));var logger=require(_0x8727('0x13'))(_0x8727('0x14'));var utils=require(_0x8727('0x15'));var config=require(_0x8727('0x16'));var db=require(_0x8727('0x17'))['db'];config[_0x8727('0x18')]=_['defaults'](config[_0x8727('0x18')],{'host':_0x8727('0x19'),'port':0x18eb});var socket=require(_0x8727('0x1a'))(new Redis(config['redis']));require(_0x8727('0x1b'))[_0x8727('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8727('0x1d')][_0x8727('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x47c29d,_0x2185e5,_0x2ea789,_0x3d84db){return new BPromise(function(_0x3865e9,_0x1916f7){var _0x11c828=_0x3d84db||client;return _0x11c828[_0x8727('0x1f')](_0x47c29d,_0x2ea789)['then'](function(_0x17baba){logger[_0x8727('0x20')](_0x8727('0x21'),_0x2185e5,_0x8727('0x22'));logger[_0x8727('0x23')](_0x8727('0x24'),_0x2185e5,'request\x20sent',JSON['stringify'](_0x17baba));if(_0x17baba[_0x8727('0x25')]){if(_0x17baba['error'][_0x8727('0x26')]===0x1f4){logger[_0x8727('0x25')](_0x8727('0x21'),_0x2185e5,_0x17baba[_0x8727('0x25')][_0x8727('0x27')]);return _0x1916f7(_0x17baba['error'][_0x8727('0x27')]);}logger[_0x8727('0x25')](_0x8727('0x21'),_0x2185e5,_0x17baba[_0x8727('0x25')][_0x8727('0x27')]);return _0x3865e9(_0x17baba[_0x8727('0x25')][_0x8727('0x27')]);}else{logger[_0x8727('0x20')](_0x8727('0x21'),_0x2185e5,_0x8727('0x22'));_0x3865e9(_0x17baba[_0x8727('0x28')][_0x8727('0x27')]);}})['catch'](function(_0x464a32){logger[_0x8727('0x25')]('SmsAccount,\x20%s,\x20%s',_0x2185e5,_0x464a32);_0x1916f7(_0x464a32);});});}function respondWithStatusCode(_0x5adefe,_0x3df7f2){_0x3df7f2=_0x3df7f2||0xcc;return function(_0x318684){if(_0x318684){return _0x5adefe[_0x8727('0x29')](_0x3df7f2);}return _0x5adefe['status'](_0x3df7f2)[_0x8727('0x2a')]();};}function respondWithResult(_0x4cacf2,_0x267008){_0x267008=_0x267008||0xc8;return function(_0x440ff5){if(_0x440ff5){return _0x4cacf2[_0x8727('0x2b')](_0x267008)[_0x8727('0x2c')](_0x440ff5);}};}function respondWithFilteredResult(_0x262f36,_0xd92f77){return function(_0x5d03f2){if(_0x5d03f2){var _0x243f15=_0x5d03f2[_0x8727('0x2d')],_0x307055=_0xd92f77[_0x8727('0x2e')],_0x54034d=_0xd92f77[_0x8727('0x2e')]+_0xd92f77[_0x8727('0x2f')],_0x23325f;if(_0x54034d>=_0x243f15){_0x54034d=_0x243f15;_0x23325f=0xc8;}else{_0x23325f=0xce;}_0x262f36[_0x8727('0x2b')](_0x23325f);return _0x262f36['set'](_0x8727('0x30'),_0x307055+'-'+_0x54034d+'/'+_0x243f15)['json'](_0x5d03f2);}return null;};}function patchUpdates(_0x34c58e){return function(_0x47e9f9){try{jsonpatch[_0x8727('0x31')](_0x47e9f9,_0x34c58e,!![]);}catch(_0x391d60){return BPromise[_0x8727('0x32')](_0x391d60);}return _0x47e9f9[_0x8727('0x33')]();};}function saveUpdates(_0x410240,_0x431b24){return function(_0x382be3){if(_0x382be3){return _0x382be3['update'](_0x410240)[_0x8727('0x34')](function(_0x3af17e){return _0x3af17e;});}return null;};}function removeEntity(_0x4728c9,_0x1b047a){return function(_0x3374e8){if(_0x3374e8){return _0x3374e8[_0x8727('0x35')]()[_0x8727('0x34')](function(){var _0x3070bd=_0x3374e8[_0x8727('0x36')]({'plain':!![]});var _0x4435c9=_0x8727('0x37');return db[_0x8727('0x38')]['destroy']({'where':{'type':_0x4435c9,'resourceId':_0x3070bd['id']}})['then'](function(){return _0x3374e8;});})[_0x8727('0x34')](function(){_0x4728c9[_0x8727('0x2b')](0xcc)[_0x8727('0x2a')]();});}};}function handleEntityNotFound(_0x477ae2,_0x52220f){return function(_0xf8f9e2){if(!_0xf8f9e2){_0x477ae2[_0x8727('0x29')](0x194);}return _0xf8f9e2;};}function handleError(_0x3276d5,_0x26c545){_0x26c545=_0x26c545||0x1f4;return function(_0x11d420){logger['error'](_0x11d420[_0x8727('0x39')]);if(_0x11d420[_0x8727('0x3a')]){delete _0x11d420[_0x8727('0x3a')];}_0x3276d5[_0x8727('0x2b')](_0x26c545)[_0x8727('0x3b')](_0x11d420);};}exports[_0x8727('0x3c')]=function(_0x27b950,_0x30c0d0){var _0x416c6f={},_0x1a607a={},_0x396f12={'count':0x0,'rows':[]};var _0x308c1d=db['SmsAccount'][_0x8727('0x3d')];_0x1a607a[_0x8727('0x3e')]=_[_0x8727('0x3f')](_0x308c1d);var _0x403d90={'dateStart':_0x27b950[_0x8727('0x40')][_0x8727('0x41')],'dateEnd':_0x27b950[_0x8727('0x40')][_0x8727('0x42')]};delete _0x27b950[_0x8727('0x40')][_0x8727('0x41')];delete _0x27b950[_0x8727('0x40')][_0x8727('0x42')];_0x1a607a[_0x8727('0x40')]=_[_0x8727('0x3f')](_0x27b950['query']);_0x1a607a[_0x8727('0x43')]=_[_0x8727('0x44')](_0x1a607a[_0x8727('0x3e')],_0x1a607a['query']);_0x416c6f[_0x8727('0x45')]=_[_0x8727('0x44')](_0x1a607a[_0x8727('0x3e')],qs[_0x8727('0x46')](_0x27b950['query'][_0x8727('0x46')]));_0x416c6f[_0x8727('0x45')]=_0x416c6f[_0x8727('0x45')][_0x8727('0x47')]?_0x416c6f[_0x8727('0x45')]:_0x1a607a[_0x8727('0x3e')];if(!_0x27b950[_0x8727('0x40')][_0x8727('0x48')](_0x8727('0x49'))){_0x416c6f[_0x8727('0x2f')]=qs['limit'](_0x27b950[_0x8727('0x40')][_0x8727('0x2f')]);_0x416c6f[_0x8727('0x2e')]=qs[_0x8727('0x2e')](_0x27b950[_0x8727('0x40')]['offset']);}_0x416c6f[_0x8727('0x4a')]=qs[_0x8727('0x4b')](_0x27b950[_0x8727('0x40')]['sort']);_0x416c6f[_0x8727('0x4c')]=qs[_0x8727('0x43')](_[_0x8727('0x4d')](_0x27b950[_0x8727('0x40')],_0x1a607a[_0x8727('0x43')]));if(_0x403d90[_0x8727('0x41')]){if(_0x403d90['dateEnd']){_0x403d90[_0x8727('0x42')]=moment(_0x403d90[_0x8727('0x42')])[_0x8727('0x4e')](0x1,'day');}else{_0x403d90[_0x8727('0x42')]=moment(_0x403d90[_0x8727('0x41')])[_0x8727('0x4e')](0x1,_0x8727('0x4f'));}_[_0x8727('0x50')](_0x416c6f[_0x8727('0x4c')],{'createdAt':{'$gte':_0x403d90[_0x8727('0x41')],'$lte':_0x403d90['dateEnd']}});}if(_0x27b950[_0x8727('0x40')][_0x8727('0x51')]){_0x416c6f[_0x8727('0x4c')]=_[_0x8727('0x50')](_0x416c6f[_0x8727('0x4c')],{'$or':_[_0x8727('0x52')](_0x416c6f[_0x8727('0x45')],function(_0x5b4388){var _0x3c2a53={};_0x3c2a53[_0x5b4388]={'$like':'%'+_0x27b950[_0x8727('0x40')][_0x8727('0x51')]+'%'};return _0x3c2a53;})});}_0x416c6f=_['merge']({},_0x416c6f,_0x27b950[_0x8727('0x53')]);var _0x22cd31={'where':_0x416c6f[_0x8727('0x4c')]};return db[_0x8727('0x54')][_0x8727('0x2d')](_0x22cd31)[_0x8727('0x34')](function(_0x417d4c){_0x396f12['count']=_0x417d4c;if(_0x27b950[_0x8727('0x40')]['includeAll']){_0x416c6f[_0x8727('0x55')]=[{'all':!![]}];}return db[_0x8727('0x54')]['findAll'](_0x416c6f);})[_0x8727('0x34')](function(_0x3bb732){_0x396f12[_0x8727('0x56')]=_0x3bb732;return _0x396f12;})['then'](respondWithFilteredResult(_0x30c0d0,_0x416c6f))['catch'](handleError(_0x30c0d0,null));};exports[_0x8727('0x57')]=function(_0x1486ca,_0x3cbc81){var _0x527223={'raw':![],'where':{'id':_0x1486ca[_0x8727('0x58')]['id']}},_0x102daf={};_0x102daf[_0x8727('0x3e')]=_[_0x8727('0x3f')](db[_0x8727('0x54')][_0x8727('0x3d')]);_0x102daf[_0x8727('0x40')]=_[_0x8727('0x3f')](_0x1486ca['query']);_0x102daf[_0x8727('0x43')]=_[_0x8727('0x44')](_0x102daf[_0x8727('0x3e')],_0x102daf[_0x8727('0x40')]);_0x527223['attributes']=_[_0x8727('0x44')](_0x102daf[_0x8727('0x3e')],qs[_0x8727('0x46')](_0x1486ca[_0x8727('0x40')][_0x8727('0x46')]));_0x527223[_0x8727('0x45')]=_0x527223[_0x8727('0x45')][_0x8727('0x47')]?_0x527223['attributes']:_0x102daf[_0x8727('0x3e')];if(_0x1486ca[_0x8727('0x40')][_0x8727('0x59')]){_0x527223['include']=[{'all':!![]}];}_0x527223=_[_0x8727('0x50')]({},_0x527223,_0x1486ca['options']);return db[_0x8727('0x54')]['find'](_0x527223)[_0x8727('0x34')](handleEntityNotFound(_0x3cbc81,null))[_0x8727('0x34')](respondWithResult(_0x3cbc81,null))['catch'](handleError(_0x3cbc81,null));};exports[_0x8727('0x5a')]=function(_0x1f8f2a,_0x105a9d){return db['SmsAccount']['create'](_0x1f8f2a['body'],{})['then'](function(_0x3ac29a){var _0x41fdad=_0x1f8f2a[_0x8727('0x5b')][_0x8727('0x36')]({'plain':!![]});if(!_0x41fdad)throw new Error(_0x8727('0x5c'));if(_0x41fdad['role']==='user'){var _0x23e24d=_0x3ac29a[_0x8727('0x36')]({'plain':!![]});var _0x34b9e3=_0x8727('0x37');return db[_0x8727('0x5d')][_0x8727('0x5e')]({'where':{'name':_0x34b9e3,'userProfileId':_0x41fdad[_0x8727('0x5f')]},'raw':!![]})[_0x8727('0x34')](function(_0x1e4033){if(_0x1e4033&&_0x1e4033[_0x8727('0x60')]===0x0){return db[_0x8727('0x38')][_0x8727('0x5a')]({'name':_0x23e24d['name'],'resourceId':_0x23e24d['id'],'type':_0x1e4033[_0x8727('0x3a')],'sectionId':_0x1e4033['id']},{})[_0x8727('0x34')](function(){return _0x3ac29a;});}else{return _0x3ac29a;}})['catch'](function(_0x5ba5fb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ba5fb);throw _0x5ba5fb;});}return _0x3ac29a;})[_0x8727('0x34')](respondWithResult(_0x105a9d,0xc9))[_0x8727('0x61')](handleError(_0x105a9d,null));};exports['update']=function(_0x295c61,_0x39d962){if(_0x295c61[_0x8727('0x62')]['id']){delete _0x295c61[_0x8727('0x62')]['id'];}return db[_0x8727('0x54')]['find']({'where':{'id':_0x295c61[_0x8727('0x58')]['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x39d962,null))[_0x8727('0x34')](saveUpdates(_0x295c61[_0x8727('0x62')],null))[_0x8727('0x34')](respondWithResult(_0x39d962,null))[_0x8727('0x61')](handleError(_0x39d962,null));};exports[_0x8727('0x35')]=function(_0x190f0d,_0x1f0338){return db['SmsAccount'][_0x8727('0x5e')]({'where':{'id':_0x190f0d[_0x8727('0x58')]['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x1f0338,null))['then'](removeEntity(_0x1f0338,null))[_0x8727('0x61')](handleError(_0x1f0338,null));};exports['describe']=function(_0x44ffec,_0x1e8cba){return db[_0x8727('0x54')][_0x8727('0x63')]()[_0x8727('0x34')](respondWithResult(_0x1e8cba,null))['catch'](handleError(_0x1e8cba,null));};exports['addDisposition']=function(_0x29f65a,_0x15a88a,_0x19cda5){if(_0x29f65a[_0x8727('0x62')]['id']){delete _0x29f65a[_0x8727('0x62')]['id'];}return db['SmsAccount'][_0x8727('0x5e')]({'where':{'id':_0x29f65a['params']['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x15a88a,null))['then'](function(_0x5c9024){if(_0x5c9024){_0x29f65a[_0x8727('0x62')][_0x8727('0x64')]=_0x5c9024['id'];return db[_0x8727('0x65')][_0x8727('0x5a')](_0x29f65a[_0x8727('0x62')]);}})['then'](respondWithResult(_0x15a88a,null))['catch'](handleError(_0x15a88a,null));};exports[_0x8727('0x66')]=function(_0x3caf78,_0x5b8641,_0x150bbb){var _0x3b2d40={'raw':![],'where':{}};var _0x20bc54={};var _0x398d7f={'count':0x0,'rows':[]};return db['SmsAccount'][_0x8727('0x67')]({'where':{'id':_0x3caf78[_0x8727('0x58')]['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x5b8641,null))[_0x8727('0x34')](function(_0x2b7193){if(_0x2b7193){_0x20bc54[_0x8727('0x3e')]=_[_0x8727('0x3f')](db['Disposition']['rawAttributes']);_0x20bc54['query']=_[_0x8727('0x3f')](_0x3caf78[_0x8727('0x40')]);_0x20bc54[_0x8727('0x43')]=_[_0x8727('0x44')](_0x20bc54[_0x8727('0x3e')],_0x20bc54[_0x8727('0x40')]);_0x3b2d40[_0x8727('0x45')]=_[_0x8727('0x44')](_0x20bc54[_0x8727('0x3e')],qs[_0x8727('0x46')](_0x3caf78[_0x8727('0x40')][_0x8727('0x46')]));_0x3b2d40[_0x8727('0x45')]=_0x3b2d40[_0x8727('0x45')][_0x8727('0x47')]?_0x3b2d40['attributes']:_0x20bc54['model'];if(!_0x3caf78['query'][_0x8727('0x48')](_0x8727('0x49'))){_0x3b2d40['limit']=qs[_0x8727('0x2f')](_0x3caf78[_0x8727('0x40')][_0x8727('0x2f')]);_0x3b2d40['offset']=qs[_0x8727('0x2e')](_0x3caf78['query'][_0x8727('0x2e')]);}_0x3b2d40[_0x8727('0x4a')]=qs[_0x8727('0x4b')](_0x3caf78['query']['sort']);_0x3b2d40[_0x8727('0x4c')]=qs[_0x8727('0x43')](_[_0x8727('0x4d')](_0x3caf78[_0x8727('0x40')],_0x20bc54[_0x8727('0x43')]));_0x3b2d40[_0x8727('0x4c')][_0x8727('0x64')]=_0x2b7193['id'];if(_0x3caf78[_0x8727('0x40')]['filter']){_0x3b2d40['where']=_['merge'](_0x3b2d40[_0x8727('0x4c')],{'$or':_[_0x8727('0x52')](_0x3b2d40[_0x8727('0x45')],function(_0x4cf197){var _0x1da476={};_0x1da476[_0x4cf197]={'$like':'%'+_0x3caf78[_0x8727('0x40')]['filter']+'%'};return _0x1da476;})});}_0x3b2d40=_[_0x8727('0x50')]({},_0x3b2d40,_0x3caf78[_0x8727('0x53')]);return db[_0x8727('0x65')][_0x8727('0x2d')]({'where':_0x3b2d40[_0x8727('0x4c')]})[_0x8727('0x34')](function(_0x317462){_0x398d7f[_0x8727('0x2d')]=_0x317462;if(_0x3caf78[_0x8727('0x40')][_0x8727('0x59')]){_0x3b2d40['include']=[{'all':!![]}];}return db[_0x8727('0x65')][_0x8727('0x68')](_0x3b2d40);})[_0x8727('0x34')](function(_0x2143a2){_0x398d7f[_0x8727('0x56')]=_0x2143a2;return _0x398d7f;});}})[_0x8727('0x34')](respondWithFilteredResult(_0x5b8641,_0x3b2d40))[_0x8727('0x61')](handleError(_0x5b8641,null));};exports[_0x8727('0x69')]=function(_0x37dcd4,_0x70729e,_0x1402d5){var _0x1eb8f1;return db['SmsAccount'][_0x8727('0x5e')]({'where':{'id':_0x37dcd4[_0x8727('0x58')]['id']}})['then'](handleEntityNotFound(_0x70729e,null))['then'](function(_0x18f4cb){if(_0x18f4cb){return _0x18f4cb[_0x8727('0x69')](_0x37dcd4[_0x8727('0x40')][_0x8727('0x6a')]);}})[_0x8727('0x34')](respondWithStatusCode(_0x70729e,null))['catch'](handleError(_0x70729e,null));};exports[_0x8727('0x6b')]=function(_0x42051a,_0x5dd1a0,_0x2b7012){if(_0x42051a['body']['id']){delete _0x42051a[_0x8727('0x62')]['id'];}return db[_0x8727('0x54')]['find']({'where':{'id':_0x42051a['params']['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x5dd1a0,null))[_0x8727('0x34')](function(_0x10ba6e){if(_0x10ba6e){_0x42051a['body'][_0x8727('0x64')]=_0x10ba6e['id'];return db[_0x8727('0x6c')][_0x8727('0x5a')](_0x42051a['body']);}})[_0x8727('0x34')](respondWithResult(_0x5dd1a0,null))[_0x8727('0x61')](handleError(_0x5dd1a0,null));};exports[_0x8727('0x6d')]=function(_0x837c27,_0x4f697d,_0x4de489){var _0x5b2519={'raw':![],'where':{}};var _0x92f690={};var _0x29d89e={'count':0x0,'rows':[]};return db[_0x8727('0x54')][_0x8727('0x67')]({'where':{'id':_0x837c27[_0x8727('0x58')]['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x4f697d,null))[_0x8727('0x34')](function(_0x200b3a){if(_0x200b3a){_0x92f690[_0x8727('0x3e')]=_[_0x8727('0x3f')](db[_0x8727('0x6c')][_0x8727('0x3d')]);_0x92f690[_0x8727('0x40')]=_['keys'](_0x837c27[_0x8727('0x40')]);_0x92f690[_0x8727('0x43')]=_[_0x8727('0x44')](_0x92f690[_0x8727('0x3e')],_0x92f690[_0x8727('0x40')]);_0x5b2519[_0x8727('0x45')]=_[_0x8727('0x44')](_0x92f690[_0x8727('0x3e')],qs[_0x8727('0x46')](_0x837c27['query'][_0x8727('0x46')]));_0x5b2519['attributes']=_0x5b2519[_0x8727('0x45')][_0x8727('0x47')]?_0x5b2519[_0x8727('0x45')]:_0x92f690[_0x8727('0x3e')];if(!_0x837c27[_0x8727('0x40')][_0x8727('0x48')](_0x8727('0x49'))){_0x5b2519[_0x8727('0x2f')]=qs[_0x8727('0x2f')](_0x837c27[_0x8727('0x40')][_0x8727('0x2f')]);_0x5b2519['offset']=qs['offset'](_0x837c27[_0x8727('0x40')][_0x8727('0x2e')]);}_0x5b2519['order']=qs[_0x8727('0x4b')](_0x837c27['query'][_0x8727('0x4b')]);_0x5b2519[_0x8727('0x4c')]=qs[_0x8727('0x43')](_[_0x8727('0x4d')](_0x837c27[_0x8727('0x40')],_0x92f690['filters']));_0x5b2519[_0x8727('0x4c')][_0x8727('0x64')]=_0x200b3a['id'];if(_0x837c27[_0x8727('0x40')][_0x8727('0x51')]){_0x5b2519[_0x8727('0x4c')]=_['merge'](_0x5b2519['where'],{'$or':_[_0x8727('0x52')](_0x5b2519[_0x8727('0x45')],function(_0x113943){var _0x8e37d0={};_0x8e37d0[_0x113943]={'$like':'%'+_0x837c27[_0x8727('0x40')][_0x8727('0x51')]+'%'};return _0x8e37d0;})});}_0x5b2519=_[_0x8727('0x50')]({},_0x5b2519,_0x837c27[_0x8727('0x53')]);return db['CannedAnswer'][_0x8727('0x2d')]({'where':_0x5b2519[_0x8727('0x4c')]})[_0x8727('0x34')](function(_0x48f73f){_0x29d89e[_0x8727('0x2d')]=_0x48f73f;if(_0x837c27[_0x8727('0x40')][_0x8727('0x59')]){_0x5b2519[_0x8727('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8727('0x68')](_0x5b2519);})[_0x8727('0x34')](function(_0x24d8f5){_0x29d89e[_0x8727('0x56')]=_0x24d8f5;return _0x29d89e;});}})[_0x8727('0x34')](respondWithFilteredResult(_0x4f697d,_0x5b2519))[_0x8727('0x61')](handleError(_0x4f697d,null));};exports['removeAnswers']=function(_0x1fd993,_0x2f7f05,_0x50e746){var _0x3441a6;return db[_0x8727('0x54')][_0x8727('0x5e')]({'where':{'id':_0x1fd993[_0x8727('0x58')]['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x2f7f05,null))[_0x8727('0x34')](function(_0x3a860b){if(_0x3a860b){return _0x3a860b['removeAnswers'](_0x1fd993[_0x8727('0x40')]['ids']);}})[_0x8727('0x34')](respondWithStatusCode(_0x2f7f05,null))[_0x8727('0x61')](handleError(_0x2f7f05,null));};exports[_0x8727('0x6e')]=function(_0x5f5b36,_0x22751e,_0x30b18a){var _0x357298={'channel':'sms'};var _0x75d51d=[];var _0x5879e1=[];var _0x338534={};return db['SmsAccount'][_0x8727('0x5e')]({'where':{'id':_0x5f5b36['params']['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0x8727('0x34')](handleEntityNotFound(_0x22751e,null))[_0x8727('0x34')](function(_0x123863){_0x357298['account']=_0x123863;_0x357298[_0x8727('0x6f')]=_['orderBy'](_0x123863['Applications'],['priority'],[_0x8727('0x70')]);if(_0x357298[_0x8727('0x71')][_0x8727('0x72')]){delete _0x357298['account']['Applications'];}return db[_0x8727('0x73')]['describe']();})['then'](function(_0x108a42){if(!_0x108a42){throw new db[(_0x8727('0x74'))][(_0x8727('0x75'))](_0x8727('0x76'));}_0x75d51d=_[_0x8727('0x77')](_[_0x8727('0x3f')](_0x108a42),[_0x8727('0x78'),'updatedAt']);_0x5879e1=_[_0x8727('0x77')](_[_0x8727('0x3f')](_0x108a42),[_0x8727('0x78'),_0x8727('0x79'),_0x8727('0x7a'),'ListId']);_0x357298['body']={'mapKey':_0x8727('0x7b')};if(_0x357298[_0x8727('0x71')][_0x8727('0x7c')]){switch(_0x357298[_0x8727('0x71')][_0x8727('0x7c')]){case'twilio':_0x357298[_0x8727('0x62')][_0x8727('0x7d')]=_0x5f5b36[_0x8727('0x62')][_0x8727('0x7e')];_0x357298[_0x8727('0x62')][_0x8727('0x62')]=_0x5f5b36['body'][_0x8727('0x7f')];_0x357298[_0x8727('0x62')][_0x8727('0x80')]=_0x5f5b36['body']['MessageSid'];break;case _0x8727('0x81'):_0x357298[_0x8727('0x62')][_0x8727('0x7d')]='+'+_0x5f5b36[_0x8727('0x62')][_0x8727('0x82')];_0x357298['body'][_0x8727('0x62')]=_0x5f5b36['body']['text'];break;case _0x8727('0x83'):_0x357298[_0x8727('0x62')][_0x8727('0x7d')]=_0x5f5b36[_0x8727('0x62')][_0x8727('0x7d')];_0x357298[_0x8727('0x62')][_0x8727('0x62')]=_0x5f5b36[_0x8727('0x62')][_0x8727('0x27')];break;case _0x8727('0x84'):_0x357298[_0x8727('0x62')]['from']=_0x5f5b36[_0x8727('0x62')][_0x8727('0x7d')];_0x357298[_0x8727('0x62')][_0x8727('0x62')]=_0x5f5b36['body']['body'];_0x357298[_0x8727('0x62')]['messageId']=_0x5f5b36[_0x8727('0x62')][_0x8727('0x85')];break;case'plivo':_0x357298[_0x8727('0x62')][_0x8727('0x7d')]=_0x5f5b36[_0x8727('0x62')][_0x8727('0x7e')];_0x357298[_0x8727('0x62')]['body']=_0x5f5b36[_0x8727('0x62')]['Text'];_0x357298[_0x8727('0x62')]['messageId']=_0x5f5b36[_0x8727('0x62')][_0x8727('0x86')];break;case _0x8727('0x87'):_0x357298[_0x8727('0x62')][_0x8727('0x7d')]='+'+_0x5f5b36['body']['results'][0x0][_0x8727('0x7d')];_0x357298['body'][_0x8727('0x62')]=_0x5f5b36['body'][_0x8727('0x88')][0x0][_0x8727('0x89')];_0x357298['body'][_0x8727('0x80')]=_0x5f5b36[_0x8727('0x62')]['results'][0x0]['messageId'];break;case _0x8727('0x8a'):_0x357298[_0x8727('0x62')][_0x8727('0x7d')]=_0x5f5b36['body'][_0x8727('0x8b')];_0x357298[_0x8727('0x62')][_0x8727('0x62')]=_0x5f5b36[_0x8727('0x62')][_0x8727('0x8c')]['message'];break;case _0x8727('0x8d'):_0x357298['body'][_0x8727('0x7d')]=_0x5f5b36[_0x8727('0x62')][_0x8727('0x8e')];_0x357298['body'][_0x8727('0x62')]=_0x5f5b36[_0x8727('0x62')][_0x8727('0x89')];_0x357298[_0x8727('0x62')][_0x8727('0x80')]=_0x5f5b36[_0x8727('0x62')][_0x8727('0x8f')];break;}}if(_0x357298[_0x8727('0x62')]['id']){delete _0x357298[_0x8727('0x62')]['id'];}if(_[_0x8727('0x90')](_0x357298[_0x8727('0x62')][_0x8727('0x7d')])){throw new db[(_0x8727('0x74'))]['ValidationError'](_0x8727('0x91'));}if(_[_0x8727('0x90')](_0x357298[_0x8727('0x62')][_0x8727('0x62')])||_0x357298[_0x8727('0x62')][_0x8727('0x62')]===''){throw new db[(_0x8727('0x74'))]['ValidationError'](_0x8727('0x92'));}if(_[_0x8727('0x90')](_0x357298[_0x8727('0x62')][_0x8727('0x93')])){throw new db[(_0x8727('0x74'))][(_0x8727('0x75'))](_0x8727('0x94')+_0x5879e1);}if(!_[_0x8727('0x95')](_0x5879e1,_0x357298[_0x8727('0x62')]['mapKey'])){throw new db['Sequelize'][(_0x8727('0x75'))](_0x8727('0x96')+_0x5879e1);}_0x338534[_0x357298[_0x8727('0x62')][_0x8727('0x93')]]=_0x357298[_0x8727('0x62')]['from'];return db[_0x8727('0x97')][_0x8727('0x5e')]({'where':{'id':_0x357298[_0x8727('0x71')]['ListId']},'include':[{'model':db[_0x8727('0x73')],'as':_0x8727('0x98'),'where':_0x338534,'limit':0x1,'order':[[_0x8727('0x79'),'DESC']]}]});})[_0x8727('0x34')](handleEntityNotFound(_0x22751e,null))['then'](function(_0x366d65){if(_0x366d65){_0x357298[_0x8727('0x99')]=_[_0x8727('0x9a')](_0x366d65,['Contacts']);if(_0x366d65[_0x8727('0x98')][_0x8727('0x47')]){return _0x366d65[_0x8727('0x98')][0x0];}var _0x37ee69=_[_0x8727('0x9b')](_0x357298[_0x8727('0x62')],{'firstName':_0x357298[_0x8727('0x62')][_0x8727('0x7d')],'ListId':_0x366d65['id']});_0x37ee69[_0x357298[_0x8727('0x62')][_0x8727('0x93')]]=_0x357298[_0x8727('0x62')][_0x8727('0x7d')];return db[_0x8727('0x73')][_0x8727('0x5a')](_0x37ee69,{'fields':_0x75d51d,'raw':!![]});}})[_0x8727('0x34')](handleEntityNotFound(_0x22751e,null))[_0x8727('0x34')](function(_0x29751a){if(_0x29751a){_0x357298[_0x8727('0x9c')]=_0x29751a;var _0x6df425={'ContactId':_0x29751a['id'],'phone':_0x357298['body'][_0x8727('0x7d')],'SmsAccountId':_0x5f5b36[_0x8727('0x58')]['id']};var _0x59767c={'ContactId':_0x29751a['id'],'SmsAccountId':_0x5f5b36[_0x8727('0x58')]['id'],'closed':![]};return db['SmsInteraction'][_0x8727('0x5e')]({'where':_0x59767c})[_0x8727('0x34')](function(_0x42d226){if(_0x42d226){return[_0x42d226,![]];}return db['SmsInteraction'][_0x8727('0x5a')](_0x6df425)[_0x8727('0x34')](function(_0x450b8d){return[_0x450b8d,!![]];});});}})[_0x8727('0x9d')](function(_0x44dff5,_0x5c1964){_0x357298[_0x8727('0x9e')]=_0x44dff5[_0x8727('0x36')]({'plain':!![]});_0x357298[_0x8727('0x9e')][_0x8727('0x9f')]=![];if(_0x5c1964){if(_0x357298[_0x8727('0x71')]['autoclose']){_0x357298[_0x8727('0x6f')][_0x8727('0xa0')]({'id':0x0,'priority':_0x357298[_0x8727('0x6f')][_0x8727('0x47')]+0x1,'app':_0x8727('0xa1'),'appdata':_0x8727('0xa2'),'interval':'*,*,*,*'});}_0x357298['interaction'][_0x8727('0x9f')]=!![];}return db[_0x8727('0xa3')][_0x8727('0x5a')]({'phone':_0x357298[_0x8727('0x62')]['from'],'messageId':_0x357298[_0x8727('0x62')]['messageId'],'body':_0x357298[_0x8727('0x62')][_0x8727('0x62')],'SmsAccountId':_0x5f5b36[_0x8727('0x58')]['id'],'SmsInteractionId':_0x44dff5['id'],'direction':'in','ContactId':_0x44dff5[_0x8727('0xa4')],'AttachmentId':_0x357298[_0x8727('0x62')]['AttachmentId']});})['then'](function(_0x595edd){_0x357298[_0x8727('0x27')]=_0x595edd;if(_0x357298[_0x8727('0x9e')]['UserId']){return db[_0x8727('0xa5')]['find']({'attributes':['id',_0x8727('0x3a')],'where':{'id':_0x357298[_0x8727('0x9e')][_0x8727('0xa6')]}})[_0x8727('0x34')](function(_0xf5cbf0){if(_0xf5cbf0){_0x357298[_0x8727('0x6f')][_0x8727('0xa7')]({'id':0x0,'priority':0x0,'app':_0x8727('0xa8'),'appdata':_0xf5cbf0['name']+','+(_0x357298['account'][_0x8727('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8727('0xaa'),_0x8727('0xab'),_0x357298);});}return respondWithRpcPromise(_0x8727('0xaa'),_0x8727('0xab'),_0x357298);})[_0x8727('0x34')](function(_0x5b310a){if(_0x5b310a){var _0x2ec5f2=0xc8;var _0xdcc521='receiveMessage';logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdcc521,_0x2ec5f2,'entity\x20found');logger[_0x8727('0x23')](_0x8727('0xac'),_0xdcc521,_0x2ec5f2,_0x8727('0xad'),JSON[_0x8727('0xae')](_0x5b310a));if(_0x357298[_0x8727('0x71')]['type']==='twilio'){return _0x22751e[_0x8727('0x2b')](_0x2ec5f2)['set'](_0x8727('0xaf'),_0x8727('0xb0'))[_0x8727('0x3b')](_0x8727('0xb1'));}else{return _0x22751e[_0x8727('0x2b')](_0x2ec5f2)[_0x8727('0x2c')](_0x5b310a);}}})[_0x8727('0x61')](handleError(_0x22751e,null));};exports[_0x8727('0xb2')]=function(_0x1d6e38,_0x2f69e8,_0x60fd55){return db[_0x8727('0x54')][_0x8727('0x67')]({'where':{'id':_0x1d6e38['params']['id']}})['then'](handleEntityNotFound(_0x2f69e8,null))[_0x8727('0x34')](function(_0x372753){if(_0x372753){return db['sequelize'][_0x8727('0xb3')](function(_0x510657){return db[_0x8727('0xb4')][_0x8727('0x35')]({'where':{'SmsAccountId':_0x1d6e38[_0x8727('0x58')]['id']},'transaction':_0x510657})[_0x8727('0x34')](function(_0x5590bd){var _0x272682=_[_0x8727('0x52')](_0x1d6e38[_0x8727('0x62')],function(_0xda7ef3){_0xda7ef3[_0x8727('0x64')]=_0x1d6e38[_0x8727('0x58')]['id'];return _0xda7ef3;});return db[_0x8727('0xb4')]['bulkCreate'](_0x272682,{'transaction':_0x510657});});})[_0x8727('0x34')](function(){return db[_0x8727('0xb4')][_0x8727('0xb5')]({'where':{'SmsAccountId':_0x1d6e38['params']['id']},'order':_0x8727('0xb6')});});}})['then'](respondWithResult(_0x2f69e8,null))[_0x8727('0x61')](handleError(_0x2f69e8,null));};exports['getApplications']=function(_0x4c1b87,_0x1de0d5,_0x5d34e6){var _0x55f48c={};var _0x3acfc5={};var _0x29b3b9;var _0x5d780e;return db[_0x8727('0x54')][_0x8727('0x67')]({'where':{'id':_0x4c1b87[_0x8727('0x58')]['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x1de0d5,null))[_0x8727('0x34')](function(_0xad2838){if(_0xad2838){_0x29b3b9=_0xad2838;_0x3acfc5[_0x8727('0x3e')]=_[_0x8727('0x3f')](db[_0x8727('0xb4')][_0x8727('0x3d')]);_0x3acfc5[_0x8727('0x40')]=_['keys'](_0x4c1b87[_0x8727('0x40')]);_0x3acfc5['filters']=_[_0x8727('0x44')](_0x3acfc5['model'],_0x3acfc5['query']);_0x55f48c['attributes']=_[_0x8727('0x44')](_0x3acfc5[_0x8727('0x3e')],qs['fields'](_0x4c1b87[_0x8727('0x40')]['fields']));_0x55f48c['attributes']=_0x55f48c['attributes'][_0x8727('0x47')]?_0x55f48c[_0x8727('0x45')]:_0x3acfc5[_0x8727('0x3e')];_0x55f48c[_0x8727('0x4a')]=qs['sort'](_0x4c1b87[_0x8727('0x40')][_0x8727('0x4b')]);_0x55f48c[_0x8727('0x4c')]=qs['filters'](_[_0x8727('0x4d')](_0x4c1b87[_0x8727('0x40')],_0x3acfc5[_0x8727('0x43')]));if(_0x4c1b87[_0x8727('0x40')][_0x8727('0x51')]){_0x55f48c[_0x8727('0x4c')]=_[_0x8727('0x50')](_0x55f48c[_0x8727('0x4c')],{'$or':_[_0x8727('0x52')](_0x55f48c[_0x8727('0x45')],function(_0x524653){var _0x32c2e6={};_0x32c2e6[_0x524653]={'$like':'%'+_0x4c1b87[_0x8727('0x40')][_0x8727('0x51')]+'%'};return _0x32c2e6;})});}_0x55f48c=_[_0x8727('0x50')]({},_0x55f48c,_0x4c1b87['options']);return _0x29b3b9[_0x8727('0xb7')](_0x55f48c);}})[_0x8727('0x34')](function(_0x3d398c){if(_0x3d398c){_0x5d780e=_0x3d398c[_0x8727('0x47')];if(!_0x4c1b87['query'][_0x8727('0x48')]('nolimit')){_0x55f48c[_0x8727('0x2f')]=qs['limit'](_0x4c1b87[_0x8727('0x40')][_0x8727('0x2f')]);_0x55f48c[_0x8727('0x2e')]=qs[_0x8727('0x2e')](_0x4c1b87['query'][_0x8727('0x2e')]);}return _0x29b3b9['getApplications'](_0x55f48c);}})[_0x8727('0x34')](function(_0x59c30){if(_0x59c30){return _0x59c30?{'count':_0x5d780e,'rows':_0x59c30}:null;}})['then'](respondWithResult(_0x1de0d5,null))[_0x8727('0x61')](handleError(_0x1de0d5,null));};exports[_0x8727('0xb8')]=function(_0x383bd7,_0x4ca8b7,_0x5d0cb7){var _0x578551={'raw':![],'where':{}};var _0x5e95a4={};var _0x221072={'count':0x0,'rows':[]};return db['SmsAccount'][_0x8727('0x67')]({'where':{'id':_0x383bd7['params']['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x4ca8b7,null))[_0x8727('0x34')](function(_0x14783e){if(_0x14783e){_0x5e95a4['model']=_[_0x8727('0x3f')](db[_0x8727('0xb9')][_0x8727('0x3d')]);_0x5e95a4['query']=_['keys'](_0x383bd7['query']);_0x5e95a4['filters']=_[_0x8727('0x44')](_0x5e95a4[_0x8727('0x3e')],_0x5e95a4['query']);_0x578551['attributes']=_[_0x8727('0x44')](_0x5e95a4[_0x8727('0x3e')],qs[_0x8727('0x46')](_0x383bd7[_0x8727('0x40')][_0x8727('0x46')]));_0x578551[_0x8727('0x45')]=_0x578551[_0x8727('0x45')]['length']?_0x578551[_0x8727('0x45')]:_0x5e95a4['model'];if(!_0x383bd7[_0x8727('0x40')][_0x8727('0x48')](_0x8727('0x49'))){_0x578551['limit']=qs[_0x8727('0x2f')](_0x383bd7['query'][_0x8727('0x2f')]);_0x578551[_0x8727('0x2e')]=qs['offset'](_0x383bd7['query'][_0x8727('0x2e')]);}_0x578551[_0x8727('0x4a')]=qs[_0x8727('0x4b')](_0x383bd7[_0x8727('0x40')][_0x8727('0x4b')]);_0x578551[_0x8727('0x4c')]=qs[_0x8727('0x43')](_['pick'](_0x383bd7[_0x8727('0x40')],_0x5e95a4[_0x8727('0x43')]));_0x578551[_0x8727('0x4c')][_0x8727('0x64')]=_0x14783e['id'];if(_0x383bd7[_0x8727('0x40')][_0x8727('0x51')]){_0x578551[_0x8727('0x4c')]=_['merge'](_0x578551[_0x8727('0x4c')],{'$or':_['map'](_0x578551[_0x8727('0x45')],function(_0x545f4f){var _0x2cdc7e={};_0x2cdc7e[_0x545f4f]={'$like':'%'+_0x383bd7['query'][_0x8727('0x51')]+'%'};return _0x2cdc7e;})});}_0x578551=_['merge']({},_0x578551,_0x383bd7[_0x8727('0x53')]);return db[_0x8727('0xb9')][_0x8727('0x2d')]({'where':_0x578551['where']})[_0x8727('0x34')](function(_0x3c9c91){_0x221072['count']=_0x3c9c91;if(_0x383bd7['query']['includeAll']){_0x578551['include']=[{'model':db[_0x8727('0x73')],'as':_0x8727('0xba'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x8727('0x3a'),_0x8727('0xbb'),_0x8727('0xbc')],'required':![]},{'model':db[_0x8727('0xbd')],'as':'Tags','attributes':['id','name',_0x8727('0xbe')],'where':_0x383bd7['query']['tag']?{'id':_0x383bd7[_0x8727('0x40')][_0x8727('0xbf')]}:undefined,'required':_0x383bd7[_0x8727('0x40')][_0x8727('0xbf')]?!![]:![]}];}return db[_0x8727('0xb9')]['findAll'](_0x578551);})[_0x8727('0x34')](function(_0x510872){_0x221072[_0x8727('0x56')]=_0x510872;return _0x221072;});}})[_0x8727('0x34')](respondWithFilteredResult(_0x4ca8b7,_0x578551))[_0x8727('0x61')](handleError(_0x4ca8b7,null));};exports[_0x8727('0x3b')]=function(_0x108efa,_0xa8126e,_0x40b559){var _0x22ef17,_0x5e8a74,_0x1b87fa;if(_[_0x8727('0x90')](_0x108efa[_0x8727('0x62')][_0x8727('0x62')])||_0x108efa['body'][_0x8727('0x62')]===''){throw new db[(_0x8727('0x74'))]['ValidationError'](_0x8727('0x92'));}if(_[_0x8727('0x90')](_0x108efa[_0x8727('0x62')]['to'])){throw new db['Sequelize']['ValidationError'](_0x8727('0xc0'));}_0x22ef17=_0x108efa['body']['to'];return db[_0x8727('0x54')][_0x8727('0x5e')]({'where':{'id':_0x108efa[_0x8727('0x58')]['id']},'include':[{'model':db[_0x8727('0x97')],'as':_0x8727('0xc1'),'include':[{'model':db[_0x8727('0x73')],'as':_0x8727('0x98'),'where':{'mobile':_0x22ef17},'limit':0x1,'order':[[_0x8727('0x79'),_0x8727('0xc2')]]}]}]})[_0x8727('0x34')](handleEntityNotFound(_0xa8126e,null))[_0x8727('0x34')](function(_0x450021){if(_0x450021&&_0x450021[_0x8727('0xc1')]){_0x5e8a74=_0x450021[_0x8727('0x36')]({'plain':!![]});if(_0x5e8a74[_0x8727('0xc1')]&&_0x5e8a74[_0x8727('0xc1')][_0x8727('0x98')][_0x8727('0x47')]){return _0x5e8a74[_0x8727('0xc1')][_0x8727('0x98')][0x0];}return db[_0x8727('0x73')][_0x8727('0x5a')](_['defaults'](_0x108efa[_0x8727('0x62')],{'firstName':_0x22ef17,'mobile':_0x22ef17,'phone':_0x22ef17,'ListId':_0x5e8a74[_0x8727('0xc3')]}));}})[_0x8727('0x34')](handleEntityNotFound(_0xa8126e,null))[_0x8727('0x34')](function(_0x4d5c69){if(_0x4d5c69){_0x1b87fa=_0x4d5c69;return db[_0x8727('0xb9')][_0x8727('0x5e')]({'where':{'ContactId':_0x1b87fa['id'],'closed':![],'SmsAccountId':_0x5e8a74['id']}})['then'](function(_0x3b3e4f){if(_0x3b3e4f){return[_0x3b3e4f,![]];}return db[_0x8727('0xb9')][_0x8727('0x5a')]({'UserId':_0x108efa[_0x8727('0x5b')]['id'],'ContactId':_0x1b87fa['id'],'SmsAccountId':_0x5e8a74['id'],'phone':_0x22ef17,'firstMsgDirection':_0x8727('0xc4'),'Messages':[_['merge'](_0x108efa['body'],{'read':![],'body':_0x108efa[_0x8727('0x62')]['body'],'phone':_0x22ef17,'SmsAccountId':_0x5e8a74['id'],'UserId':_0x108efa[_0x8727('0x5b')]['id'],'ContactId':_0x1b87fa['id']})]},{'include':[{'model':db[_0x8727('0xa3')],'as':_0x8727('0xc5')}]})[_0x8727('0x34')](function(_0x871254){return[_0x871254,!![]];});});}})[_0x8727('0x9d')](function(_0x25103d,_0x3f73b3){if(_0x3f73b3){return _0x25103d;}return db[_0x8727('0xa3')][_0x8727('0x5a')](_[_0x8727('0x50')](_0x108efa[_0x8727('0x62')],{'read':![],'body':_0x108efa[_0x8727('0x62')][_0x8727('0x62')],'phone':_0x22ef17,'SmsAccountId':_0x5e8a74['id'],'SmsInteractionId':_0x25103d['id'],'UserId':_0x108efa['user']['id'],'ContactId':_0x1b87fa['id']}))['then'](function(_0x56ea14){_0x25103d[_0x8727('0xc6')][_0x8727('0xc5')]=[];_0x25103d[_0x8727('0xc6')]['Messages'][_0x8727('0xa0')](_0x56ea14[_0x8727('0xc6')]);return _0x25103d;});})['then'](respondWithResult(_0xa8126e,null))[_0x8727('0x61')](handleError(_0xa8126e,null));};exports['status']=function(_0x283660,_0x2ccf70,_0x570cfa){if(_0x283660[_0x8727('0x62')]['id']){delete _0x283660[_0x8727('0x62')]['id'];}console['log']('endpoint\x20/status\x20POST\x20/',_0x283660[_0x8727('0x62')]);var _0xe8bdd2,_0x3e6f1a,_0x2ef907;return db[_0x8727('0x54')][_0x8727('0x5e')]({'where':{'id':_0x283660[_0x8727('0x58')]['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x2ccf70,null))[_0x8727('0x34')](function(_0x3ce8b0){if(_0x3ce8b0){_0x2ef907=_0x3ce8b0;logger[_0x8727('0x23')](_0x8727('0x24'),_0x8727('0x2b'),'received\x20delivery\x20report\x20from',_0x3ce8b0['type'],util['inspect'](_0x283660[_0x8727('0x62')],{'showHidden':![],'depth':null}));switch(_0x3ce8b0[_0x8727('0x7c')]){case _0x8727('0x81'):if(_0x283660['body'][_0x8727('0xc7')]&&_0x283660['body'][_0x8727('0x2b')]){_0x3e6f1a=_0x283660[_0x8727('0x62')][_0x8727('0x2b')];return db['SmsMessage'][_0x8727('0x5e')]({'where':{'messageId':_0x283660[_0x8727('0x62')][_0x8727('0xc7')]}});}break;case _0x8727('0x83'):if(_0x283660['body'][_0x8727('0xc8')]&&_0x283660['body'][_0x8727('0xc9')]){_0x3e6f1a=_0x283660[_0x8727('0x62')][_0x8727('0xc9')];return db['SmsMessage'][_0x8727('0x5e')]({'where':{'messageId':_0x283660['body'][_0x8727('0xc8')]}});}break;case _0x8727('0x84'):if(_0x283660[_0x8727('0x62')][_0x8727('0x85')]&&_0x283660[_0x8727('0x62')][_0x8727('0xca')]){_0x3e6f1a=_0x283660[_0x8727('0x62')][_0x8727('0xca')];return db[_0x8727('0xa3')][_0x8727('0x5e')]({'where':{'messageId':_0x283660[_0x8727('0x62')][_0x8727('0x85')]}});}break;case'infobip':var _0x383159=_0x283660[_0x8727('0x62')]['results'][0x0];if(_0x383159[_0x8727('0x80')]&&_0x383159['status'][_0x8727('0xcb')]===_0x8727('0xcc')){_0x3e6f1a=_0x383159[_0x8727('0x2b')]['groupName'];return db[_0x8727('0xa3')][_0x8727('0x5e')]({'where':{'messageId':_0x383159[_0x8727('0x80')]}});}break;case _0x8727('0x8d'):if(_0x283660[_0x8727('0x62')][_0x8727('0x80')]&&_0x283660['body'][_0x8727('0x2b')]){_0x3e6f1a=_0x283660[_0x8727('0x62')][_0x8727('0x2b')];return db['SmsMessage'][_0x8727('0x5e')]({'where':{'messageId':_0x283660[_0x8727('0x62')][_0x8727('0x80')]}});}break;}}})[_0x8727('0x34')](handleEntityNotFound(_0x2ccf70,null))[_0x8727('0x34')](function(_0x4de443){if(_0x4de443){_0xe8bdd2=_0x4de443;switch(_0x2ef907[_0x8727('0x7c')]){case _0x8727('0x81'):if(_0x3e6f1a===_0x8727('0xcc')){return _0xe8bdd2[_0x8727('0xcd')]({'read':!![]});}else{logger[_0x8727('0x25')](_0x8727('0x24'),_0x8727('0x2b'),_0x8727('0x81'),util['inspect'](_0x283660['body'],{'showHidden':![],'depth':null}));}break;case _0x8727('0x83'):if(_0x3e6f1a==='1'){return _0xe8bdd2[_0x8727('0xcd')]({'read':!![]});}else{logger[_0x8727('0x25')](_0x8727('0x24'),_0x8727('0x2b'),_0x8727('0x81'),util[_0x8727('0xce')](_0x283660['body'],{'showHidden':![],'depth':null}));}break;case _0x8727('0x84'):if(!_0x283660['body']['error_code']&&_0x3e6f1a>=0xc8&&_0x3e6f1a<=0xce){return _0xe8bdd2[_0x8727('0xcd')]({'read':!![]});}else{logger[_0x8727('0x25')](_0x8727('0x24'),'status','clicksend',util[_0x8727('0xce')](_0x283660['body'],{'showHidden':![],'depth':null}));}break;case _0x8727('0x87'):var _0x22450b=_0x283660['body']['results'][0x0];if(_0x22450b[_0x8727('0x2b')][_0x8727('0xcb')]===_0x8727('0xcc')){return _0xe8bdd2[_0x8727('0xcd')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8727('0x2b'),_0x8727('0x87'),util['inspect'](_0x283660['body'],{'showHidden':![],'depth':null}));}break;case _0x8727('0x8d'):if(_0x3e6f1a=='DELIVERED_TO_GATEWAY'||_0x3e6f1a==_0x8727('0xcf')){return _0xe8bdd2[_0x8727('0xcd')]({'read':!![]});}else{logger[_0x8727('0x25')](_0x8727('0x24'),_0x8727('0x2b'),'clickatell',util[_0x8727('0xce')](_0x283660['body'],{'showHidden':![],'depth':null}));}break;}return _0xe8bdd2;}})[_0x8727('0x34')](respondWithResult(_0x2ccf70,null))[_0x8727('0x61')](handleError(_0x2ccf70,null));};exports['statusGet']=function(_0x300eeb,_0x592836,_0x5b4373){var _0x58d67b,_0x2b25a6,_0x5413dc;return db[_0x8727('0x54')][_0x8727('0x5e')]({'where':{'id':_0x300eeb[_0x8727('0x58')]['id']}})['then'](handleEntityNotFound(_0x592836,null))[_0x8727('0x34')](function(_0x35500f){if(_0x35500f){_0x5413dc=_0x35500f;logger['debug'](_0x8727('0x24'),'status','received\x20delivery\x20report\x20from',_0x35500f[_0x8727('0x7c')],util[_0x8727('0xce')](_0x300eeb[_0x8727('0x40')],{'showHidden':![],'depth':null}));switch(_0x35500f[_0x8727('0x7c')]){case _0x8727('0x8a'):if(_0x300eeb[_0x8727('0x40')][_0x8727('0xd0')]&&_0x300eeb['query'][_0x8727('0xd1')]){_0x2b25a6=_0x300eeb[_0x8727('0x40')]['state'];return db['SmsMessage'][_0x8727('0x5e')]({'where':{'messageId':_0x300eeb[_0x8727('0x40')][_0x8727('0xd0')]}});}break;}}})[_0x8727('0x34')](handleEntityNotFound(_0x592836,null))[_0x8727('0x34')](function(_0x1a0c29){if(_0x1a0c29){_0x58d67b=_0x1a0c29;switch(_0x5413dc[_0x8727('0x7c')]){case _0x8727('0x8a'):if(_0x2b25a6==='2'||_0x2b25a6==='6'){return _0x58d67b[_0x8727('0xcd')]({'read':!![]});}else{logger[_0x8727('0x25')](_0x8727('0x24'),_0x8727('0x2b'),_0x8727('0x8a'),util[_0x8727('0xce')](_0x300eeb['query'],{'showHidden':![],'depth':null}));};break;}return _0x58d67b;}})[_0x8727('0x34')](respondWithResult(_0x592836,null))[_0x8727('0x61')](handleError(_0x592836,null));};exports[_0x8727('0xd2')]=function(_0x590a9f,_0x574273,_0x51de12){return db['SmsAccount']['find']({'where':{'id':_0x590a9f[_0x8727('0x58')]['id']}})['then'](handleEntityNotFound(_0x574273,null))['then'](function(_0x3b2488){if(_0x3b2488){return _0x3b2488['addAgents'](_0x590a9f[_0x8727('0x62')][_0x8727('0x6a')],_[_0x8727('0x9a')](_0x590a9f['body'],[_0x8727('0x6a'),'id'])||{})[_0x8727('0x9d')](function(_0x57106e){for(var _0x8549cd=0x0;_0x8549cd<_0x590a9f['body']['ids']['length'];_0x8549cd+=0x1){socket[_0x8727('0xd3')](_0x8727('0xd4'),{'UserId':_0x590a9f[_0x8727('0x62')][_0x8727('0x6a')][_0x8549cd],'SmsAccountId':_0x590a9f[_0x8727('0x58')]['id']});}return _0x57106e;});}})[_0x8727('0x34')](respondWithResult(_0x574273,null))[_0x8727('0x61')](handleError(_0x574273,null));};exports[_0x8727('0xd5')]=function(_0x27a2cb,_0x8c3314,_0x40d5fd){var _0x4d2d22;return db['SmsAccount'][_0x8727('0x5e')]({'where':{'id':_0x27a2cb[_0x8727('0x58')]['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x8c3314,null))[_0x8727('0x34')](function(_0x572991){if(_0x572991){return _0x572991[_0x8727('0xd5')](_0x27a2cb[_0x8727('0x40')][_0x8727('0x6a')])[_0x8727('0x34')](function(_0x15b837){if(_['isArray'](_0x27a2cb[_0x8727('0x40')]['ids'])){for(var _0x450c3c=0x0;_0x450c3c<_0x27a2cb[_0x8727('0x40')][_0x8727('0x6a')][_0x8727('0x47')];_0x450c3c+=0x1){socket[_0x8727('0xd3')](_0x8727('0xd6'),{'UserId':_0x27a2cb[_0x8727('0x40')]['ids'][_0x450c3c],'SmsAccountId':_0x27a2cb[_0x8727('0x58')]['id']});}}else{socket[_0x8727('0xd3')](_0x8727('0xd6'),{'UserId':_0x27a2cb[_0x8727('0x40')]['ids'],'SmsAccountId':_0x27a2cb[_0x8727('0x58')]['id']});}});}})['then'](respondWithStatusCode(_0x8c3314,null))['catch'](handleError(_0x8c3314,null));};exports[_0x8727('0xd7')]=function(_0x5baa12,_0x2ecb32,_0x285b2c){var _0x2e739d={};var _0x50cfc8={};var _0x10b617;var _0x3173ed;return db[_0x8727('0x54')][_0x8727('0x67')]({'where':{'id':_0x5baa12[_0x8727('0x58')]['id']}})[_0x8727('0x34')](handleEntityNotFound(_0x2ecb32,null))[_0x8727('0x34')](function(_0x52d1c6){if(_0x52d1c6){_0x10b617=_0x52d1c6;_0x50cfc8['model']=_[_0x8727('0x3f')](db[_0x8727('0xa5')][_0x8727('0x3d')]);_0x50cfc8[_0x8727('0x40')]=_[_0x8727('0x3f')](_0x5baa12[_0x8727('0x40')]);_0x50cfc8[_0x8727('0x43')]=_[_0x8727('0x44')](_0x50cfc8[_0x8727('0x3e')],_0x50cfc8['query']);_0x2e739d[_0x8727('0x45')]=_[_0x8727('0x44')](_0x50cfc8[_0x8727('0x3e')],qs[_0x8727('0x46')](_0x5baa12[_0x8727('0x40')][_0x8727('0x46')]));_0x2e739d[_0x8727('0x45')]=_0x2e739d[_0x8727('0x45')][_0x8727('0x47')]?_0x2e739d[_0x8727('0x45')]:_0x50cfc8['model'];_0x2e739d[_0x8727('0x4a')]=qs['sort'](_0x5baa12[_0x8727('0x40')][_0x8727('0x4b')]);_0x2e739d[_0x8727('0x4c')]=qs[_0x8727('0x43')](_['pick'](_0x5baa12['query'],_0x50cfc8[_0x8727('0x43')]));if(_0x5baa12[_0x8727('0x40')][_0x8727('0x51')]){_0x2e739d['where']=_['merge'](_0x2e739d[_0x8727('0x4c')],{'$or':_['map'](_0x2e739d[_0x8727('0x45')],function(_0x2e39e2){var _0x3c2d6b={};_0x3c2d6b[_0x2e39e2]={'$like':'%'+_0x5baa12[_0x8727('0x40')][_0x8727('0x51')]+'%'};return _0x3c2d6b;})});}_0x2e739d=_['merge']({},_0x2e739d,_0x5baa12[_0x8727('0x53')]);return _0x10b617[_0x8727('0xd7')](_0x2e739d);}})[_0x8727('0x34')](function(_0x35bb39){if(_0x35bb39){_0x3173ed=_0x35bb39[_0x8727('0x47')];if(!_0x5baa12[_0x8727('0x40')][_0x8727('0x48')](_0x8727('0x49'))){_0x2e739d[_0x8727('0x2f')]=qs['limit'](_0x5baa12[_0x8727('0x40')]['limit']);_0x2e739d['offset']=qs['offset'](_0x5baa12[_0x8727('0x40')][_0x8727('0x2e')]);}return _0x10b617[_0x8727('0xd7')](_0x2e739d);}})['then'](function(_0x424f77){if(_0x424f77){return _0x424f77?{'count':_0x3173ed,'rows':_0x424f77}:null;}})[_0x8727('0x34')](respondWithResult(_0x2ecb32,null))[_0x8727('0x61')](handleError(_0x2ecb32,null));}; \ No newline at end of file +var _0x3f8a=['SmsMessage','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','skebby','statusInt','requestid','status_code','groupName','DELIVERED','error_code','inspect','DELIVERED_TO_GATEWAY','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','stack','send','index','SmsAccount','rawAttributes','model','query','dateStart','dateEnd','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','catch','show','params','keys','fields','find','create','body','user','role','SmsAccounts','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','map','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','ListId','mobile','type','twilio','from','From','Body','MessageSid','sender','connectel','clicksend','messageId','message_id','plivo','Text','infobip','results','text','originatingAddress','clickatell','fromNumber','replyMessageId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','getApplications','getInteractions','Contact','Owner','internal','Tag','tag','List','out'];(function(_0x586549,_0x14a76c){var _0x563c8d=function(_0x1821f9){while(--_0x1821f9){_0x586549['push'](_0x586549['shift']());}};_0x563c8d(++_0x14a76c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x5c967a,_0x254ae5){_0x5c967a=_0x5c967a-0x0;var _0x412b4a=_0x3f8a[_0x5c967a];return _0x412b4a;};'use strict';var pdf=require(_0xa3f8('0x0'));var emlformat=require(_0xa3f8('0x1'));var rimraf=require(_0xa3f8('0x2'));var zipdir=require(_0xa3f8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3f8('0x4'));var moment=require(_0xa3f8('0x5'));var BPromise=require(_0xa3f8('0x6'));var Mustache=require(_0xa3f8('0x7'));var util=require(_0xa3f8('0x8'));var path=require(_0xa3f8('0x9'));var sox=require(_0xa3f8('0xa'));var csv=require(_0xa3f8('0xb'));var ejs=require(_0xa3f8('0xc'));var fs=require('fs');var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xb'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var qs=require(_0xa3f8('0x14'));var logger=require(_0xa3f8('0x15'))(_0xa3f8('0x16'));var utils=require(_0xa3f8('0x17'));var config=require('../../config/environment');var db=require(_0xa3f8('0x18'))['db'];config[_0xa3f8('0x19')]=_[_0xa3f8('0x1a')](config[_0xa3f8('0x19')],{'host':_0xa3f8('0x1b'),'port':0x18eb});var socket=require(_0xa3f8('0x1c'))(new Redis(config[_0xa3f8('0x19')]));require(_0xa3f8('0x1d'))[_0xa3f8('0x1e')](socket);var jayson=require(_0xa3f8('0x1f'));var client=jayson[_0xa3f8('0x20')][_0xa3f8('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x5b2c33,_0x2d8f74,_0xe55848,_0x45014f){return new BPromise(function(_0x21a170,_0x5caebf){var _0x39c450=_0x45014f||client;return _0x39c450[_0xa3f8('0x22')](_0x5b2c33,_0xe55848)[_0xa3f8('0x23')](function(_0x8cd130){logger[_0xa3f8('0x24')](_0xa3f8('0x25'),_0x2d8f74,_0xa3f8('0x26'));logger[_0xa3f8('0x27')](_0xa3f8('0x28'),_0x2d8f74,_0xa3f8('0x26'),JSON['stringify'](_0x8cd130));if(_0x8cd130[_0xa3f8('0x29')]){if(_0x8cd130['error'][_0xa3f8('0x2a')]===0x1f4){logger[_0xa3f8('0x29')](_0xa3f8('0x25'),_0x2d8f74,_0x8cd130[_0xa3f8('0x29')]['message']);return _0x5caebf(_0x8cd130[_0xa3f8('0x29')]['message']);}logger[_0xa3f8('0x29')]('SmsAccount,\x20%s,\x20%s',_0x2d8f74,_0x8cd130[_0xa3f8('0x29')][_0xa3f8('0x2b')]);return _0x21a170(_0x8cd130[_0xa3f8('0x29')][_0xa3f8('0x2b')]);}else{logger[_0xa3f8('0x24')](_0xa3f8('0x25'),_0x2d8f74,_0xa3f8('0x26'));_0x21a170(_0x8cd130['result'][_0xa3f8('0x2b')]);}})['catch'](function(_0x3ce57b){logger[_0xa3f8('0x29')](_0xa3f8('0x25'),_0x2d8f74,_0x3ce57b);_0x5caebf(_0x3ce57b);});});}function respondWithStatusCode(_0x37b290,_0x24ead6){_0x24ead6=_0x24ead6||0xcc;return function(_0x2c5d10){if(_0x2c5d10){return _0x37b290[_0xa3f8('0x2c')](_0x24ead6);}return _0x37b290[_0xa3f8('0x2d')](_0x24ead6)[_0xa3f8('0x2e')]();};}function respondWithResult(_0x1eb2b9,_0x545a28){_0x545a28=_0x545a28||0xc8;return function(_0x1c3358){if(_0x1c3358){return _0x1eb2b9[_0xa3f8('0x2d')](_0x545a28)[_0xa3f8('0x2f')](_0x1c3358);}};}function respondWithFilteredResult(_0x5a8fcf,_0x40f5cc){return function(_0x57f6be){if(_0x57f6be){var _0xbad6a6=_0x57f6be[_0xa3f8('0x30')],_0x3a3746=_0x40f5cc['offset'],_0x3c1128=_0x40f5cc[_0xa3f8('0x31')]+_0x40f5cc[_0xa3f8('0x32')],_0x4ea213;if(_0x3c1128>=_0xbad6a6){_0x3c1128=_0xbad6a6;_0x4ea213=0xc8;}else{_0x4ea213=0xce;}_0x5a8fcf[_0xa3f8('0x2d')](_0x4ea213);return _0x5a8fcf[_0xa3f8('0x33')](_0xa3f8('0x34'),_0x3a3746+'-'+_0x3c1128+'/'+_0xbad6a6)[_0xa3f8('0x2f')](_0x57f6be);}return null;};}function patchUpdates(_0x23c854){return function(_0x424a3e){try{jsonpatch[_0xa3f8('0x35')](_0x424a3e,_0x23c854,!![]);}catch(_0x290a4e){return BPromise[_0xa3f8('0x36')](_0x290a4e);}return _0x424a3e['save']();};}function saveUpdates(_0x4404da,_0x29c6b4){return function(_0xebc519){if(_0xebc519){return _0xebc519[_0xa3f8('0x37')](_0x4404da)[_0xa3f8('0x23')](function(_0x4da76b){return _0x4da76b;});}return null;};}function removeEntity(_0x1b8aa8,_0x29d5c0){return function(_0x564336){if(_0x564336){return _0x564336[_0xa3f8('0x38')]()[_0xa3f8('0x23')](function(){var _0x5e575a=_0x564336[_0xa3f8('0x39')]({'plain':!![]});var _0x4ec2ce='SmsAccounts';return db[_0xa3f8('0x3a')][_0xa3f8('0x38')]({'where':{'type':_0x4ec2ce,'resourceId':_0x5e575a['id']}})['then'](function(){return _0x564336;});})[_0xa3f8('0x23')](function(){_0x1b8aa8['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x30a972,_0x4e512e){return function(_0x22e8ea){if(!_0x22e8ea){_0x30a972['sendStatus'](0x194);}return _0x22e8ea;};}function handleError(_0x449342,_0x53c7b2){_0x53c7b2=_0x53c7b2||0x1f4;return function(_0x415e66){logger['error'](_0x415e66[_0xa3f8('0x3b')]);if(_0x415e66['name']){delete _0x415e66['name'];}_0x449342['status'](_0x53c7b2)[_0xa3f8('0x3c')](_0x415e66);};}exports[_0xa3f8('0x3d')]=function(_0x1acf4f,_0x2ffeb3){var _0x4b93ba={},_0x447824={},_0x18b9bc={'count':0x0,'rows':[]};var _0x3d01f6=db[_0xa3f8('0x3e')][_0xa3f8('0x3f')];_0x447824[_0xa3f8('0x40')]=_['keys'](_0x3d01f6);var _0x14db5b={'dateStart':_0x1acf4f[_0xa3f8('0x41')][_0xa3f8('0x42')],'dateEnd':_0x1acf4f['query'][_0xa3f8('0x43')]};delete _0x1acf4f[_0xa3f8('0x41')]['dateStart'];delete _0x1acf4f[_0xa3f8('0x41')]['dateEnd'];_0x447824[_0xa3f8('0x41')]=_['keys'](_0x1acf4f[_0xa3f8('0x41')]);_0x447824[_0xa3f8('0x44')]=_[_0xa3f8('0x45')](_0x447824[_0xa3f8('0x40')],_0x447824[_0xa3f8('0x41')]);_0x4b93ba['attributes']=_[_0xa3f8('0x45')](_0x447824[_0xa3f8('0x40')],qs['fields'](_0x1acf4f[_0xa3f8('0x41')]['fields']));_0x4b93ba[_0xa3f8('0x46')]=_0x4b93ba[_0xa3f8('0x46')][_0xa3f8('0x47')]?_0x4b93ba[_0xa3f8('0x46')]:_0x447824[_0xa3f8('0x40')];if(!_0x1acf4f['query'][_0xa3f8('0x48')](_0xa3f8('0x49'))){_0x4b93ba[_0xa3f8('0x32')]=qs[_0xa3f8('0x32')](_0x1acf4f[_0xa3f8('0x41')]['limit']);_0x4b93ba[_0xa3f8('0x31')]=qs[_0xa3f8('0x31')](_0x1acf4f[_0xa3f8('0x41')][_0xa3f8('0x31')]);}_0x4b93ba[_0xa3f8('0x4a')]=qs[_0xa3f8('0x4b')](_0x1acf4f[_0xa3f8('0x41')][_0xa3f8('0x4b')]);_0x4b93ba[_0xa3f8('0x4c')]=qs[_0xa3f8('0x44')](_[_0xa3f8('0x4d')](_0x1acf4f[_0xa3f8('0x41')],_0x447824[_0xa3f8('0x44')]));if(_0x14db5b['dateStart']){if(_0x14db5b['dateEnd']){_0x14db5b['dateEnd']=moment(_0x14db5b[_0xa3f8('0x43')])[_0xa3f8('0x4e')](0x1,_0xa3f8('0x4f'));}else{_0x14db5b[_0xa3f8('0x43')]=moment(_0x14db5b[_0xa3f8('0x42')])[_0xa3f8('0x4e')](0x1,'day');}_[_0xa3f8('0x50')](_0x4b93ba[_0xa3f8('0x4c')],{'createdAt':{'$gte':_0x14db5b[_0xa3f8('0x42')],'$lte':_0x14db5b[_0xa3f8('0x43')]}});}if(_0x1acf4f['query'][_0xa3f8('0x51')]){_0x4b93ba[_0xa3f8('0x4c')]=_[_0xa3f8('0x50')](_0x4b93ba['where'],{'$or':_['map'](_0x4b93ba['attributes'],function(_0x608213){var _0xd3bbc8={};_0xd3bbc8[_0x608213]={'$like':'%'+_0x1acf4f['query'][_0xa3f8('0x51')]+'%'};return _0xd3bbc8;})});}_0x4b93ba=_[_0xa3f8('0x50')]({},_0x4b93ba,_0x1acf4f[_0xa3f8('0x52')]);var _0x142481={'where':_0x4b93ba[_0xa3f8('0x4c')]};return db[_0xa3f8('0x3e')][_0xa3f8('0x30')](_0x142481)[_0xa3f8('0x23')](function(_0xbfef86){_0x18b9bc[_0xa3f8('0x30')]=_0xbfef86;if(_0x1acf4f[_0xa3f8('0x41')][_0xa3f8('0x53')]){_0x4b93ba[_0xa3f8('0x54')]=[{'all':!![]}];}return db[_0xa3f8('0x3e')][_0xa3f8('0x55')](_0x4b93ba);})[_0xa3f8('0x23')](function(_0x42082d){_0x18b9bc['rows']=_0x42082d;return _0x18b9bc;})['then'](respondWithFilteredResult(_0x2ffeb3,_0x4b93ba))[_0xa3f8('0x56')](handleError(_0x2ffeb3,null));};exports[_0xa3f8('0x57')]=function(_0x57efba,_0x291a65){var _0x239ced={'raw':![],'where':{'id':_0x57efba[_0xa3f8('0x58')]['id']}},_0x1682f0={};_0x1682f0[_0xa3f8('0x40')]=_[_0xa3f8('0x59')](db[_0xa3f8('0x3e')][_0xa3f8('0x3f')]);_0x1682f0[_0xa3f8('0x41')]=_[_0xa3f8('0x59')](_0x57efba[_0xa3f8('0x41')]);_0x1682f0[_0xa3f8('0x44')]=_[_0xa3f8('0x45')](_0x1682f0[_0xa3f8('0x40')],_0x1682f0[_0xa3f8('0x41')]);_0x239ced[_0xa3f8('0x46')]=_['intersection'](_0x1682f0['model'],qs[_0xa3f8('0x5a')](_0x57efba['query'][_0xa3f8('0x5a')]));_0x239ced[_0xa3f8('0x46')]=_0x239ced[_0xa3f8('0x46')]['length']?_0x239ced[_0xa3f8('0x46')]:_0x1682f0[_0xa3f8('0x40')];if(_0x57efba[_0xa3f8('0x41')][_0xa3f8('0x53')]){_0x239ced['include']=[{'all':!![]}];}_0x239ced=_[_0xa3f8('0x50')]({},_0x239ced,_0x57efba['options']);return db[_0xa3f8('0x3e')][_0xa3f8('0x5b')](_0x239ced)[_0xa3f8('0x23')](handleEntityNotFound(_0x291a65,null))['then'](respondWithResult(_0x291a65,null))['catch'](handleError(_0x291a65,null));};exports[_0xa3f8('0x5c')]=function(_0x1ef464,_0x30407a){return db[_0xa3f8('0x3e')]['create'](_0x1ef464[_0xa3f8('0x5d')],{})[_0xa3f8('0x23')](function(_0x38dba4){var _0x270ffc=_0x1ef464[_0xa3f8('0x5e')]['get']({'plain':!![]});if(!_0x270ffc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x270ffc[_0xa3f8('0x5f')]===_0xa3f8('0x5e')){var _0x384da0=_0x38dba4[_0xa3f8('0x39')]({'plain':!![]});var _0x33a916=_0xa3f8('0x60');return db[_0xa3f8('0x61')]['find']({'where':{'name':_0x33a916,'userProfileId':_0x270ffc['userProfileId']},'raw':!![]})['then'](function(_0x354384){if(_0x354384&&_0x354384[_0xa3f8('0x62')]===0x0){return db[_0xa3f8('0x3a')][_0xa3f8('0x5c')]({'name':_0x384da0[_0xa3f8('0x63')],'resourceId':_0x384da0['id'],'type':_0x354384[_0xa3f8('0x63')],'sectionId':_0x354384['id']},{})[_0xa3f8('0x23')](function(){return _0x38dba4;});}else{return _0x38dba4;}})[_0xa3f8('0x56')](function(_0x5a50cd){logger[_0xa3f8('0x29')](_0xa3f8('0x64'),_0x5a50cd);throw _0x5a50cd;});}return _0x38dba4;})[_0xa3f8('0x23')](respondWithResult(_0x30407a,0xc9))[_0xa3f8('0x56')](handleError(_0x30407a,null));};exports[_0xa3f8('0x37')]=function(_0x1fcd44,_0x104433){if(_0x1fcd44['body']['id']){delete _0x1fcd44[_0xa3f8('0x5d')]['id'];}return db[_0xa3f8('0x3e')]['find']({'where':{'id':_0x1fcd44[_0xa3f8('0x58')]['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x104433,null))[_0xa3f8('0x23')](saveUpdates(_0x1fcd44[_0xa3f8('0x5d')],null))[_0xa3f8('0x23')](respondWithResult(_0x104433,null))[_0xa3f8('0x56')](handleError(_0x104433,null));};exports[_0xa3f8('0x38')]=function(_0x4a2f72,_0x4c779b){return db[_0xa3f8('0x3e')]['find']({'where':{'id':_0x4a2f72[_0xa3f8('0x58')]['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x4c779b,null))[_0xa3f8('0x23')](removeEntity(_0x4c779b,null))[_0xa3f8('0x56')](handleError(_0x4c779b,null));};exports[_0xa3f8('0x65')]=function(_0x35d4d6,_0xeca2dc){return db[_0xa3f8('0x3e')][_0xa3f8('0x65')]()[_0xa3f8('0x23')](respondWithResult(_0xeca2dc,null))[_0xa3f8('0x56')](handleError(_0xeca2dc,null));};exports[_0xa3f8('0x66')]=function(_0x2edffa,_0x519fa4,_0x5efdcf){if(_0x2edffa[_0xa3f8('0x5d')]['id']){delete _0x2edffa[_0xa3f8('0x5d')]['id'];}return db[_0xa3f8('0x3e')][_0xa3f8('0x5b')]({'where':{'id':_0x2edffa[_0xa3f8('0x58')]['id']}})['then'](handleEntityNotFound(_0x519fa4,null))[_0xa3f8('0x23')](function(_0x3b7c50){if(_0x3b7c50){_0x2edffa[_0xa3f8('0x5d')][_0xa3f8('0x67')]=_0x3b7c50['id'];return db[_0xa3f8('0x68')][_0xa3f8('0x5c')](_0x2edffa[_0xa3f8('0x5d')]);}})[_0xa3f8('0x23')](respondWithResult(_0x519fa4,null))[_0xa3f8('0x56')](handleError(_0x519fa4,null));};exports[_0xa3f8('0x69')]=function(_0x1d1502,_0x5d4fe5,_0x14de37){var _0x1b6343={'raw':![],'where':{}};var _0x47af5b={};var _0x58ef6f={'count':0x0,'rows':[]};return db[_0xa3f8('0x3e')][_0xa3f8('0x6a')]({'where':{'id':_0x1d1502[_0xa3f8('0x58')]['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x5d4fe5,null))[_0xa3f8('0x23')](function(_0x219d84){if(_0x219d84){_0x47af5b[_0xa3f8('0x40')]=_[_0xa3f8('0x59')](db['Disposition'][_0xa3f8('0x3f')]);_0x47af5b[_0xa3f8('0x41')]=_[_0xa3f8('0x59')](_0x1d1502['query']);_0x47af5b[_0xa3f8('0x44')]=_[_0xa3f8('0x45')](_0x47af5b['model'],_0x47af5b[_0xa3f8('0x41')]);_0x1b6343[_0xa3f8('0x46')]=_[_0xa3f8('0x45')](_0x47af5b[_0xa3f8('0x40')],qs[_0xa3f8('0x5a')](_0x1d1502[_0xa3f8('0x41')][_0xa3f8('0x5a')]));_0x1b6343[_0xa3f8('0x46')]=_0x1b6343[_0xa3f8('0x46')]['length']?_0x1b6343[_0xa3f8('0x46')]:_0x47af5b['model'];if(!_0x1d1502[_0xa3f8('0x41')]['hasOwnProperty'](_0xa3f8('0x49'))){_0x1b6343[_0xa3f8('0x32')]=qs[_0xa3f8('0x32')](_0x1d1502[_0xa3f8('0x41')][_0xa3f8('0x32')]);_0x1b6343['offset']=qs[_0xa3f8('0x31')](_0x1d1502[_0xa3f8('0x41')]['offset']);}_0x1b6343[_0xa3f8('0x4a')]=qs[_0xa3f8('0x4b')](_0x1d1502[_0xa3f8('0x41')][_0xa3f8('0x4b')]);_0x1b6343[_0xa3f8('0x4c')]=qs[_0xa3f8('0x44')](_['pick'](_0x1d1502[_0xa3f8('0x41')],_0x47af5b[_0xa3f8('0x44')]));_0x1b6343[_0xa3f8('0x4c')]['SmsAccountId']=_0x219d84['id'];if(_0x1d1502[_0xa3f8('0x41')]['filter']){_0x1b6343[_0xa3f8('0x4c')]=_['merge'](_0x1b6343['where'],{'$or':_[_0xa3f8('0x6b')](_0x1b6343['attributes'],function(_0x2349ba){var _0x5f174a={};_0x5f174a[_0x2349ba]={'$like':'%'+_0x1d1502[_0xa3f8('0x41')][_0xa3f8('0x51')]+'%'};return _0x5f174a;})});}_0x1b6343=_[_0xa3f8('0x50')]({},_0x1b6343,_0x1d1502[_0xa3f8('0x52')]);return db['Disposition'][_0xa3f8('0x30')]({'where':_0x1b6343[_0xa3f8('0x4c')]})['then'](function(_0x3187e0){_0x58ef6f[_0xa3f8('0x30')]=_0x3187e0;if(_0x1d1502[_0xa3f8('0x41')][_0xa3f8('0x53')]){_0x1b6343[_0xa3f8('0x54')]=[{'all':!![]}];}return db[_0xa3f8('0x68')][_0xa3f8('0x55')](_0x1b6343);})[_0xa3f8('0x23')](function(_0x16e5f3){_0x58ef6f[_0xa3f8('0x6c')]=_0x16e5f3;return _0x58ef6f;});}})['then'](respondWithFilteredResult(_0x5d4fe5,_0x1b6343))[_0xa3f8('0x56')](handleError(_0x5d4fe5,null));};exports[_0xa3f8('0x6d')]=function(_0x12752b,_0x5908f3,_0x6603f){var _0x1ca93c;return db[_0xa3f8('0x3e')][_0xa3f8('0x5b')]({'where':{'id':_0x12752b[_0xa3f8('0x58')]['id']}})['then'](handleEntityNotFound(_0x5908f3,null))[_0xa3f8('0x23')](function(_0x3da7ee){if(_0x3da7ee){return _0x3da7ee[_0xa3f8('0x6d')](_0x12752b[_0xa3f8('0x41')][_0xa3f8('0x6e')]);}})[_0xa3f8('0x23')](respondWithStatusCode(_0x5908f3,null))['catch'](handleError(_0x5908f3,null));};exports[_0xa3f8('0x6f')]=function(_0x3175fc,_0x224199,_0x19ec3d){if(_0x3175fc['body']['id']){delete _0x3175fc[_0xa3f8('0x5d')]['id'];}return db[_0xa3f8('0x3e')][_0xa3f8('0x5b')]({'where':{'id':_0x3175fc[_0xa3f8('0x58')]['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x224199,null))[_0xa3f8('0x23')](function(_0x12fe03){if(_0x12fe03){_0x3175fc[_0xa3f8('0x5d')][_0xa3f8('0x67')]=_0x12fe03['id'];return db[_0xa3f8('0x70')][_0xa3f8('0x5c')](_0x3175fc['body']);}})[_0xa3f8('0x23')](respondWithResult(_0x224199,null))['catch'](handleError(_0x224199,null));};exports[_0xa3f8('0x71')]=function(_0x355922,_0x278436,_0x6a1e95){var _0x5b0ed5={'raw':![],'where':{}};var _0x324c8b={};var _0x3d9702={'count':0x0,'rows':[]};return db[_0xa3f8('0x3e')]['findOne']({'where':{'id':_0x355922[_0xa3f8('0x58')]['id']}})['then'](handleEntityNotFound(_0x278436,null))[_0xa3f8('0x23')](function(_0x52fcc3){if(_0x52fcc3){_0x324c8b[_0xa3f8('0x40')]=_['keys'](db[_0xa3f8('0x70')][_0xa3f8('0x3f')]);_0x324c8b[_0xa3f8('0x41')]=_[_0xa3f8('0x59')](_0x355922['query']);_0x324c8b[_0xa3f8('0x44')]=_[_0xa3f8('0x45')](_0x324c8b[_0xa3f8('0x40')],_0x324c8b[_0xa3f8('0x41')]);_0x5b0ed5[_0xa3f8('0x46')]=_[_0xa3f8('0x45')](_0x324c8b['model'],qs[_0xa3f8('0x5a')](_0x355922[_0xa3f8('0x41')][_0xa3f8('0x5a')]));_0x5b0ed5[_0xa3f8('0x46')]=_0x5b0ed5[_0xa3f8('0x46')]['length']?_0x5b0ed5[_0xa3f8('0x46')]:_0x324c8b[_0xa3f8('0x40')];if(!_0x355922['query'][_0xa3f8('0x48')](_0xa3f8('0x49'))){_0x5b0ed5[_0xa3f8('0x32')]=qs['limit'](_0x355922[_0xa3f8('0x41')][_0xa3f8('0x32')]);_0x5b0ed5[_0xa3f8('0x31')]=qs[_0xa3f8('0x31')](_0x355922[_0xa3f8('0x41')][_0xa3f8('0x31')]);}_0x5b0ed5[_0xa3f8('0x4a')]=qs['sort'](_0x355922[_0xa3f8('0x41')][_0xa3f8('0x4b')]);_0x5b0ed5['where']=qs[_0xa3f8('0x44')](_[_0xa3f8('0x4d')](_0x355922[_0xa3f8('0x41')],_0x324c8b[_0xa3f8('0x44')]));_0x5b0ed5[_0xa3f8('0x4c')][_0xa3f8('0x67')]=_0x52fcc3['id'];if(_0x355922[_0xa3f8('0x41')]['filter']){_0x5b0ed5[_0xa3f8('0x4c')]=_[_0xa3f8('0x50')](_0x5b0ed5[_0xa3f8('0x4c')],{'$or':_[_0xa3f8('0x6b')](_0x5b0ed5[_0xa3f8('0x46')],function(_0x1673ac){var _0xb1dca4={};_0xb1dca4[_0x1673ac]={'$like':'%'+_0x355922['query'][_0xa3f8('0x51')]+'%'};return _0xb1dca4;})});}_0x5b0ed5=_[_0xa3f8('0x50')]({},_0x5b0ed5,_0x355922[_0xa3f8('0x52')]);return db[_0xa3f8('0x70')]['count']({'where':_0x5b0ed5['where']})[_0xa3f8('0x23')](function(_0x5152a1){_0x3d9702[_0xa3f8('0x30')]=_0x5152a1;if(_0x355922[_0xa3f8('0x41')][_0xa3f8('0x53')]){_0x5b0ed5['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xa3f8('0x55')](_0x5b0ed5);})[_0xa3f8('0x23')](function(_0x3f95fb){_0x3d9702[_0xa3f8('0x6c')]=_0x3f95fb;return _0x3d9702;});}})['then'](respondWithFilteredResult(_0x278436,_0x5b0ed5))[_0xa3f8('0x56')](handleError(_0x278436,null));};exports['removeAnswers']=function(_0x1f7488,_0x12abed,_0x285497){var _0x4abe82;return db['SmsAccount']['find']({'where':{'id':_0x1f7488[_0xa3f8('0x58')]['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x12abed,null))[_0xa3f8('0x23')](function(_0xb784d4){if(_0xb784d4){return _0xb784d4[_0xa3f8('0x72')](_0x1f7488[_0xa3f8('0x41')][_0xa3f8('0x6e')]);}})[_0xa3f8('0x23')](respondWithStatusCode(_0x12abed,null))['catch'](handleError(_0x12abed,null));};exports[_0xa3f8('0x73')]=function(_0x268773,_0x8ddad1,_0x480463){var _0x374407={'channel':_0xa3f8('0x74')};var _0x522bbb=[];var _0x3c9632=[];var _0x438813={};return db['SmsAccount'][_0xa3f8('0x5b')]({'where':{'id':_0x268773[_0xa3f8('0x58')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xa3f8('0x75')}]})[_0xa3f8('0x23')](handleEntityNotFound(_0x8ddad1,null))[_0xa3f8('0x23')](function(_0x4dc6ab){_0x374407[_0xa3f8('0x76')]=_0x4dc6ab;_0x374407[_0xa3f8('0x77')]=_[_0xa3f8('0x78')](_0x4dc6ab[_0xa3f8('0x75')],[_0xa3f8('0x79')],['asc']);if(_0x374407['account'][_0xa3f8('0x75')]){delete _0x374407[_0xa3f8('0x76')][_0xa3f8('0x75')];}return db[_0xa3f8('0x7a')]['describe']();})[_0xa3f8('0x23')](function(_0x2951d0){if(!_0x2951d0){throw new db[(_0xa3f8('0x7b'))][(_0xa3f8('0x7c'))](_0xa3f8('0x7d'));}_0x522bbb=_[_0xa3f8('0x7e')](_[_0xa3f8('0x59')](_0x2951d0),[_0xa3f8('0x7f'),'updatedAt']);_0x3c9632=_[_0xa3f8('0x7e')](_['keys'](_0x2951d0),[_0xa3f8('0x7f'),'updatedAt','CompanyId',_0xa3f8('0x80')]);_0x374407[_0xa3f8('0x5d')]={'mapKey':_0xa3f8('0x81')};if(_0x374407[_0xa3f8('0x76')][_0xa3f8('0x82')]){switch(_0x374407['account']['type']){case _0xa3f8('0x83'):_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x84')]=_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x85')];_0x374407[_0xa3f8('0x5d')]['body']=_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x86')];_0x374407['body']['messageId']=_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x87')];break;case'skebby':_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x84')]='+'+_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x88')];_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x5d')]=_0x268773[_0xa3f8('0x5d')]['text'];break;case _0xa3f8('0x89'):_0x374407[_0xa3f8('0x5d')]['from']=_0x268773['body'][_0xa3f8('0x84')];_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x5d')]=_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x2b')];break;case _0xa3f8('0x8a'):_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x84')]=_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x84')];_0x374407[_0xa3f8('0x5d')]['body']=_0x268773[_0xa3f8('0x5d')]['body'];_0x374407['body'][_0xa3f8('0x8b')]=_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x8c')];break;case _0xa3f8('0x8d'):_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x84')]=_0x268773['body']['From'];_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x5d')]=_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x8e')];_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x8b')]=_0x268773['body']['MessageUUID'];break;case _0xa3f8('0x8f'):_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x84')]='+'+_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x90')][0x0][_0xa3f8('0x84')];_0x374407['body']['body']=_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x90')][0x0][_0xa3f8('0x91')];_0x374407['body'][_0xa3f8('0x8b')]=_0x268773[_0xa3f8('0x5d')]['results'][0x0][_0xa3f8('0x8b')];break;case'csc':_0x374407[_0xa3f8('0x5d')]['from']=_0x268773['body'][_0xa3f8('0x92')];_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x5d')]=_0x268773[_0xa3f8('0x5d')]['segmentedMessage'][_0xa3f8('0x2b')];break;case _0xa3f8('0x93'):_0x374407['body'][_0xa3f8('0x84')]=_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x94')];_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x5d')]=_0x268773[_0xa3f8('0x5d')][_0xa3f8('0x91')];_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x8b')]=_0x268773['body'][_0xa3f8('0x95')];break;}}if(_0x374407[_0xa3f8('0x5d')]['id']){delete _0x374407[_0xa3f8('0x5d')]['id'];}if(_[_0xa3f8('0x96')](_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x84')])){throw new db[(_0xa3f8('0x7b'))][(_0xa3f8('0x7c'))]('from\x20is\x20mandatory');}if(_[_0xa3f8('0x96')](_0x374407[_0xa3f8('0x5d')]['body'])||_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x5d')]===''){throw new db['Sequelize'][(_0xa3f8('0x7c'))](_0xa3f8('0x97'));}if(_['isNil'](_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x98')])){throw new db['Sequelize'][(_0xa3f8('0x7c'))](_0xa3f8('0x99')+_0x3c9632);}if(!_['includes'](_0x3c9632,_0x374407['body'][_0xa3f8('0x98')])){throw new db[(_0xa3f8('0x7b'))][(_0xa3f8('0x7c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3c9632);}_0x438813[_0x374407['body'][_0xa3f8('0x98')]]=_0x374407[_0xa3f8('0x5d')]['from'];return db[_0xa3f8('0x9a')]['find']({'where':{'id':_0x374407[_0xa3f8('0x76')]['ListId']},'include':[{'model':db[_0xa3f8('0x7a')],'as':'Contacts','where':_0x438813,'limit':0x1,'order':[['updatedAt',_0xa3f8('0x9b')]]}]});})['then'](handleEntityNotFound(_0x8ddad1,null))[_0xa3f8('0x23')](function(_0x2e1f5e){if(_0x2e1f5e){_0x374407[_0xa3f8('0x9c')]=_[_0xa3f8('0x9d')](_0x2e1f5e,[_0xa3f8('0x9e')]);if(_0x2e1f5e[_0xa3f8('0x9e')][_0xa3f8('0x47')]){return _0x2e1f5e[_0xa3f8('0x9e')][0x0];}var _0x2b51cf=_['defaults'](_0x374407[_0xa3f8('0x5d')],{'firstName':_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x84')],'ListId':_0x2e1f5e['id']});_0x2b51cf[_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x98')]]=_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x84')];return db[_0xa3f8('0x7a')][_0xa3f8('0x5c')](_0x2b51cf,{'fields':_0x522bbb,'raw':!![]});}})[_0xa3f8('0x23')](handleEntityNotFound(_0x8ddad1,null))[_0xa3f8('0x23')](function(_0x7d8f0c){if(_0x7d8f0c){_0x374407[_0xa3f8('0x9f')]=_0x7d8f0c;var _0x571fd3={'ContactId':_0x7d8f0c['id'],'phone':_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x84')],'SmsAccountId':_0x268773[_0xa3f8('0x58')]['id']};var _0x8185b1={'ContactId':_0x7d8f0c['id'],'SmsAccountId':_0x268773[_0xa3f8('0x58')]['id'],'closed':![]};return db[_0xa3f8('0xa0')]['find']({'where':_0x8185b1})[_0xa3f8('0x23')](function(_0x42baae){if(_0x42baae){return[_0x42baae,![]];}return db[_0xa3f8('0xa0')][_0xa3f8('0x5c')](_0x571fd3)[_0xa3f8('0x23')](function(_0x7cc3d0){return[_0x7cc3d0,!![]];});});}})[_0xa3f8('0xa1')](function(_0x32324f,_0xb8c3cf){_0x374407[_0xa3f8('0xa2')]=_0x32324f[_0xa3f8('0x39')]({'plain':!![]});_0x374407[_0xa3f8('0xa2')][_0xa3f8('0xa3')]=![];if(_0xb8c3cf){if(_0x374407[_0xa3f8('0x76')][_0xa3f8('0xa4')]){_0x374407[_0xa3f8('0x77')][_0xa3f8('0xa5')]({'id':0x0,'priority':_0x374407[_0xa3f8('0x77')][_0xa3f8('0x47')]+0x1,'app':_0xa3f8('0xa6'),'appdata':_0xa3f8('0xa7'),'interval':_0xa3f8('0xa8')});}_0x374407[_0xa3f8('0xa2')][_0xa3f8('0xa3')]=!![];}return db['SmsMessage'][_0xa3f8('0x5c')]({'phone':_0x374407['body'][_0xa3f8('0x84')],'messageId':_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x8b')],'body':_0x374407[_0xa3f8('0x5d')][_0xa3f8('0x5d')],'SmsAccountId':_0x268773[_0xa3f8('0x58')]['id'],'SmsInteractionId':_0x32324f['id'],'direction':'in','ContactId':_0x32324f[_0xa3f8('0xa9')],'AttachmentId':_0x374407[_0xa3f8('0x5d')][_0xa3f8('0xaa')]});})[_0xa3f8('0x23')](function(_0x414891){_0x374407[_0xa3f8('0x2b')]=_0x414891;if(_0x374407[_0xa3f8('0xa2')][_0xa3f8('0xab')]){return db[_0xa3f8('0xac')][_0xa3f8('0x5b')]({'attributes':['id',_0xa3f8('0x63')],'where':{'id':_0x374407['interaction'][_0xa3f8('0xab')]}})[_0xa3f8('0x23')](function(_0x56eff3){if(_0x56eff3){_0x374407[_0xa3f8('0x77')][_0xa3f8('0xad')]({'id':0x0,'priority':0x0,'app':_0xa3f8('0xae'),'appdata':_0x56eff3[_0xa3f8('0x63')]+','+(_0x374407['account']['waitForTheAssignedAgent']||0xa),'interval':_0xa3f8('0xa8')});}return respondWithRpcPromise(_0xa3f8('0xaf'),_0xa3f8('0xb0'),_0x374407);});}return respondWithRpcPromise('Start',_0xa3f8('0xb0'),_0x374407);})[_0xa3f8('0x23')](function(_0x4a42d9){if(_0x4a42d9){var _0x41b242=0xc8;var _0x16f3a6=_0xa3f8('0xb1');logger[_0xa3f8('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x16f3a6,_0x41b242,_0xa3f8('0xb2'));logger[_0xa3f8('0x27')](_0xa3f8('0xb3'),_0x16f3a6,_0x41b242,_0xa3f8('0xb2'),JSON[_0xa3f8('0xb4')](_0x4a42d9));if(_0x374407[_0xa3f8('0x76')]['type']==='twilio'){return _0x8ddad1[_0xa3f8('0x2d')](_0x41b242)['set'](_0xa3f8('0xb5'),_0xa3f8('0xb6'))[_0xa3f8('0x3c')]('\x0a');}else{return _0x8ddad1[_0xa3f8('0x2d')](_0x41b242)['json'](_0x4a42d9);}}})['catch'](handleError(_0x8ddad1,null));};exports[_0xa3f8('0xb7')]=function(_0x58206e,_0x58a54e,_0x247be3){return db[_0xa3f8('0x3e')][_0xa3f8('0x6a')]({'where':{'id':_0x58206e[_0xa3f8('0x58')]['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x58a54e,null))[_0xa3f8('0x23')](function(_0x3963f5){if(_0x3963f5){return db[_0xa3f8('0xb8')][_0xa3f8('0xb9')](function(_0x238de6){return db[_0xa3f8('0xba')]['destroy']({'where':{'SmsAccountId':_0x58206e[_0xa3f8('0x58')]['id']},'transaction':_0x238de6})[_0xa3f8('0x23')](function(_0x50d4b2){var _0x11a132=_[_0xa3f8('0x6b')](_0x58206e['body'],function(_0x195209){_0x195209[_0xa3f8('0x67')]=_0x58206e[_0xa3f8('0x58')]['id'];return _0x195209;});return db['SmsApplication'][_0xa3f8('0xbb')](_0x11a132,{'transaction':_0x238de6});});})['then'](function(){return db[_0xa3f8('0xba')]['findAndCountAll']({'where':{'SmsAccountId':_0x58206e[_0xa3f8('0x58')]['id']},'order':_0xa3f8('0x79')});});}})[_0xa3f8('0x23')](respondWithResult(_0x58a54e,null))[_0xa3f8('0x56')](handleError(_0x58a54e,null));};exports[_0xa3f8('0xbc')]=function(_0x21d7e2,_0x24e450,_0x3bc11d){var _0x1b73b7={};var _0x30f482={};var _0x3f0369;var _0x503ebf;return db[_0xa3f8('0x3e')][_0xa3f8('0x6a')]({'where':{'id':_0x21d7e2[_0xa3f8('0x58')]['id']}})['then'](handleEntityNotFound(_0x24e450,null))['then'](function(_0x14c151){if(_0x14c151){_0x3f0369=_0x14c151;_0x30f482[_0xa3f8('0x40')]=_[_0xa3f8('0x59')](db[_0xa3f8('0xba')][_0xa3f8('0x3f')]);_0x30f482[_0xa3f8('0x41')]=_[_0xa3f8('0x59')](_0x21d7e2[_0xa3f8('0x41')]);_0x30f482[_0xa3f8('0x44')]=_[_0xa3f8('0x45')](_0x30f482[_0xa3f8('0x40')],_0x30f482['query']);_0x1b73b7['attributes']=_[_0xa3f8('0x45')](_0x30f482[_0xa3f8('0x40')],qs[_0xa3f8('0x5a')](_0x21d7e2[_0xa3f8('0x41')][_0xa3f8('0x5a')]));_0x1b73b7[_0xa3f8('0x46')]=_0x1b73b7[_0xa3f8('0x46')][_0xa3f8('0x47')]?_0x1b73b7['attributes']:_0x30f482[_0xa3f8('0x40')];_0x1b73b7[_0xa3f8('0x4a')]=qs[_0xa3f8('0x4b')](_0x21d7e2[_0xa3f8('0x41')][_0xa3f8('0x4b')]);_0x1b73b7[_0xa3f8('0x4c')]=qs['filters'](_['pick'](_0x21d7e2[_0xa3f8('0x41')],_0x30f482['filters']));if(_0x21d7e2[_0xa3f8('0x41')][_0xa3f8('0x51')]){_0x1b73b7['where']=_['merge'](_0x1b73b7[_0xa3f8('0x4c')],{'$or':_[_0xa3f8('0x6b')](_0x1b73b7[_0xa3f8('0x46')],function(_0x2d3d23){var _0x47c8d4={};_0x47c8d4[_0x2d3d23]={'$like':'%'+_0x21d7e2[_0xa3f8('0x41')][_0xa3f8('0x51')]+'%'};return _0x47c8d4;})});}_0x1b73b7=_[_0xa3f8('0x50')]({},_0x1b73b7,_0x21d7e2[_0xa3f8('0x52')]);return _0x3f0369[_0xa3f8('0xbc')](_0x1b73b7);}})[_0xa3f8('0x23')](function(_0x111514){if(_0x111514){_0x503ebf=_0x111514[_0xa3f8('0x47')];if(!_0x21d7e2['query']['hasOwnProperty']('nolimit')){_0x1b73b7[_0xa3f8('0x32')]=qs[_0xa3f8('0x32')](_0x21d7e2['query'][_0xa3f8('0x32')]);_0x1b73b7[_0xa3f8('0x31')]=qs[_0xa3f8('0x31')](_0x21d7e2['query'][_0xa3f8('0x31')]);}return _0x3f0369['getApplications'](_0x1b73b7);}})[_0xa3f8('0x23')](function(_0x3996bc){if(_0x3996bc){return _0x3996bc?{'count':_0x503ebf,'rows':_0x3996bc}:null;}})[_0xa3f8('0x23')](respondWithResult(_0x24e450,null))[_0xa3f8('0x56')](handleError(_0x24e450,null));};exports[_0xa3f8('0xbd')]=function(_0x24311e,_0x420185,_0xadba84){var _0x5ccf66={'raw':![],'where':{}};var _0x3bacf6={};var _0x66bc7a={'count':0x0,'rows':[]};return db[_0xa3f8('0x3e')][_0xa3f8('0x6a')]({'where':{'id':_0x24311e['params']['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x420185,null))[_0xa3f8('0x23')](function(_0x275f7a){if(_0x275f7a){_0x3bacf6[_0xa3f8('0x40')]=_[_0xa3f8('0x59')](db[_0xa3f8('0xa0')][_0xa3f8('0x3f')]);_0x3bacf6[_0xa3f8('0x41')]=_[_0xa3f8('0x59')](_0x24311e['query']);_0x3bacf6[_0xa3f8('0x44')]=_[_0xa3f8('0x45')](_0x3bacf6[_0xa3f8('0x40')],_0x3bacf6[_0xa3f8('0x41')]);_0x5ccf66[_0xa3f8('0x46')]=_[_0xa3f8('0x45')](_0x3bacf6[_0xa3f8('0x40')],qs[_0xa3f8('0x5a')](_0x24311e[_0xa3f8('0x41')][_0xa3f8('0x5a')]));_0x5ccf66[_0xa3f8('0x46')]=_0x5ccf66[_0xa3f8('0x46')][_0xa3f8('0x47')]?_0x5ccf66[_0xa3f8('0x46')]:_0x3bacf6[_0xa3f8('0x40')];if(!_0x24311e[_0xa3f8('0x41')][_0xa3f8('0x48')](_0xa3f8('0x49'))){_0x5ccf66[_0xa3f8('0x32')]=qs[_0xa3f8('0x32')](_0x24311e['query'][_0xa3f8('0x32')]);_0x5ccf66[_0xa3f8('0x31')]=qs[_0xa3f8('0x31')](_0x24311e[_0xa3f8('0x41')][_0xa3f8('0x31')]);}_0x5ccf66[_0xa3f8('0x4a')]=qs[_0xa3f8('0x4b')](_0x24311e[_0xa3f8('0x41')]['sort']);_0x5ccf66[_0xa3f8('0x4c')]=qs[_0xa3f8('0x44')](_[_0xa3f8('0x4d')](_0x24311e[_0xa3f8('0x41')],_0x3bacf6[_0xa3f8('0x44')]));_0x5ccf66[_0xa3f8('0x4c')]['SmsAccountId']=_0x275f7a['id'];if(_0x24311e[_0xa3f8('0x41')]['filter']){_0x5ccf66[_0xa3f8('0x4c')]=_[_0xa3f8('0x50')](_0x5ccf66[_0xa3f8('0x4c')],{'$or':_[_0xa3f8('0x6b')](_0x5ccf66['attributes'],function(_0x1cc0d4){var _0x13a7ce={};_0x13a7ce[_0x1cc0d4]={'$like':'%'+_0x24311e[_0xa3f8('0x41')][_0xa3f8('0x51')]+'%'};return _0x13a7ce;})});}_0x5ccf66=_['merge']({},_0x5ccf66,_0x24311e[_0xa3f8('0x52')]);return db[_0xa3f8('0xa0')][_0xa3f8('0x30')]({'where':_0x5ccf66['where']})[_0xa3f8('0x23')](function(_0x1707fb){_0x66bc7a[_0xa3f8('0x30')]=_0x1707fb;if(_0x24311e[_0xa3f8('0x41')][_0xa3f8('0x53')]){_0x5ccf66[_0xa3f8('0x54')]=[{'model':db[_0xa3f8('0x7a')],'as':_0xa3f8('0xbe'),'required':![]},{'model':db[_0xa3f8('0xac')],'as':_0xa3f8('0xbf'),'attributes':[_0xa3f8('0x63'),'fullname',_0xa3f8('0xc0')],'required':![]},{'model':db[_0xa3f8('0xc1')],'as':'Tags','attributes':['id','name','color'],'where':_0x24311e['query'][_0xa3f8('0xc2')]?{'id':_0x24311e['query']['tag']}:undefined,'required':_0x24311e['query']['tag']?!![]:![]}];}return db[_0xa3f8('0xa0')][_0xa3f8('0x55')](_0x5ccf66);})['then'](function(_0x5cc849){_0x66bc7a[_0xa3f8('0x6c')]=_0x5cc849;return _0x66bc7a;});}})[_0xa3f8('0x23')](respondWithFilteredResult(_0x420185,_0x5ccf66))['catch'](handleError(_0x420185,null));};exports[_0xa3f8('0x3c')]=function(_0x2bef2b,_0x8e74c1,_0x5357fb){var _0x569b72,_0x8bfa3e,_0xf20b54;if(_[_0xa3f8('0x96')](_0x2bef2b[_0xa3f8('0x5d')][_0xa3f8('0x5d')])||_0x2bef2b['body'][_0xa3f8('0x5d')]===''){throw new db[(_0xa3f8('0x7b'))]['ValidationError'](_0xa3f8('0x97'));}if(_[_0xa3f8('0x96')](_0x2bef2b[_0xa3f8('0x5d')]['to'])){throw new db['Sequelize'][(_0xa3f8('0x7c'))]('to\x20is\x20mandatory');}_0x569b72=_0x2bef2b['body']['to'];return db[_0xa3f8('0x3e')][_0xa3f8('0x5b')]({'where':{'id':_0x2bef2b[_0xa3f8('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xa3f8('0xc3'),'include':[{'model':db[_0xa3f8('0x7a')],'as':_0xa3f8('0x9e'),'where':{'mobile':_0x569b72},'limit':0x1,'order':[['updatedAt',_0xa3f8('0x9b')]]}]}]})[_0xa3f8('0x23')](handleEntityNotFound(_0x8e74c1,null))[_0xa3f8('0x23')](function(_0x21a8af){if(_0x21a8af&&_0x21a8af[_0xa3f8('0xc3')]){_0x8bfa3e=_0x21a8af[_0xa3f8('0x39')]({'plain':!![]});if(_0x8bfa3e[_0xa3f8('0xc3')]&&_0x8bfa3e[_0xa3f8('0xc3')]['Contacts'][_0xa3f8('0x47')]){return _0x8bfa3e[_0xa3f8('0xc3')]['Contacts'][0x0];}return db[_0xa3f8('0x7a')]['create'](_[_0xa3f8('0x1a')](_0x2bef2b['body'],{'firstName':_0x569b72,'mobile':_0x569b72,'phone':_0x569b72,'ListId':_0x8bfa3e[_0xa3f8('0x80')]}));}})[_0xa3f8('0x23')](handleEntityNotFound(_0x8e74c1,null))[_0xa3f8('0x23')](function(_0xa91f9b){if(_0xa91f9b){_0xf20b54=_0xa91f9b;return db['SmsInteraction'][_0xa3f8('0x5b')]({'where':{'ContactId':_0xf20b54['id'],'closed':![],'SmsAccountId':_0x8bfa3e['id']}})['then'](function(_0x1102df){if(_0x1102df){return[_0x1102df,![]];}return db[_0xa3f8('0xa0')]['create']({'UserId':_0x2bef2b[_0xa3f8('0x5e')]['id'],'ContactId':_0xf20b54['id'],'SmsAccountId':_0x8bfa3e['id'],'phone':_0x569b72,'firstMsgDirection':_0xa3f8('0xc4'),'Messages':[_[_0xa3f8('0x50')](_0x2bef2b[_0xa3f8('0x5d')],{'read':![],'body':_0x2bef2b[_0xa3f8('0x5d')]['body'],'phone':_0x569b72,'SmsAccountId':_0x8bfa3e['id'],'UserId':_0x2bef2b['user']['id'],'ContactId':_0xf20b54['id']})]},{'include':[{'model':db[_0xa3f8('0xc5')],'as':'Messages'}]})[_0xa3f8('0x23')](function(_0x444a87){return[_0x444a87,!![]];});});}})['spread'](function(_0x3afae4,_0x4b672c){if(_0x4b672c){return _0x3afae4;}return db[_0xa3f8('0xc5')][_0xa3f8('0x5c')](_[_0xa3f8('0x50')](_0x2bef2b['body'],{'read':![],'body':_0x2bef2b[_0xa3f8('0x5d')]['body'],'phone':_0x569b72,'SmsAccountId':_0x8bfa3e['id'],'SmsInteractionId':_0x3afae4['id'],'UserId':_0x2bef2b[_0xa3f8('0x5e')]['id'],'ContactId':_0xf20b54['id']}))['then'](function(_0x2af5cd){_0x3afae4[_0xa3f8('0xc6')][_0xa3f8('0xc7')]=[];_0x3afae4[_0xa3f8('0xc6')]['Messages'][_0xa3f8('0xa5')](_0x2af5cd[_0xa3f8('0xc6')]);return _0x3afae4;});})['then'](respondWithResult(_0x8e74c1,null))[_0xa3f8('0x56')](handleError(_0x8e74c1,null));};exports[_0xa3f8('0x2d')]=function(_0x3b12ee,_0x744c5e,_0x233e76){if(_0x3b12ee[_0xa3f8('0x5d')]['id']){delete _0x3b12ee['body']['id'];}console[_0xa3f8('0xc8')](_0xa3f8('0xc9'),_0x3b12ee['body']);var _0x1fb60c,_0x4d3ef8,_0x3b5d3f;return db['SmsAccount']['find']({'where':{'id':_0x3b12ee['params']['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x744c5e,null))[_0xa3f8('0x23')](function(_0x1e2f06){if(_0x1e2f06){_0x3b5d3f=_0x1e2f06;logger[_0xa3f8('0x27')](_0xa3f8('0x28'),'status','received\x20delivery\x20report\x20from',_0x1e2f06[_0xa3f8('0x82')],util['inspect'](_0x3b12ee[_0xa3f8('0x5d')],{'showHidden':![],'depth':null}));switch(_0x1e2f06[_0xa3f8('0x82')]){case _0xa3f8('0xca'):if(_0x3b12ee[_0xa3f8('0x5d')]['skebby_dispatch_id']&&_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0x2d')]){_0x4d3ef8=_0x3b12ee[_0xa3f8('0x5d')]['status'];return db[_0xa3f8('0xc5')][_0xa3f8('0x5b')]({'where':{'messageId':_0x3b12ee[_0xa3f8('0x5d')]['skebby_dispatch_id']}});}break;case _0xa3f8('0x89'):if(_0x3b12ee[_0xa3f8('0x5d')]['requestid']&&_0x3b12ee[_0xa3f8('0x5d')]['statusInt']){_0x4d3ef8=_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0xcb')];return db[_0xa3f8('0xc5')][_0xa3f8('0x5b')]({'where':{'messageId':_0x3b12ee['body'][_0xa3f8('0xcc')]}});}break;case _0xa3f8('0x8a'):if(_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0x8c')]&&_0x3b12ee[_0xa3f8('0x5d')]['status_code']){_0x4d3ef8=_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0xcd')];return db[_0xa3f8('0xc5')][_0xa3f8('0x5b')]({'where':{'messageId':_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0x8c')]}});}break;case'infobip':var _0xb40a8e=_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0x90')][0x0];if(_0xb40a8e['messageId']&&_0xb40a8e['status'][_0xa3f8('0xce')]==='DELIVERED'){_0x4d3ef8=_0xb40a8e[_0xa3f8('0x2d')][_0xa3f8('0xce')];return db['SmsMessage']['find']({'where':{'messageId':_0xb40a8e[_0xa3f8('0x8b')]}});}break;case'clickatell':if(_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0x8b')]&&_0x3b12ee['body'][_0xa3f8('0x2d')]){_0x4d3ef8=_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0x2d')];return db['SmsMessage'][_0xa3f8('0x5b')]({'where':{'messageId':_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0x8b')]}});}break;}}})[_0xa3f8('0x23')](handleEntityNotFound(_0x744c5e,null))[_0xa3f8('0x23')](function(_0x3b8c7f){if(_0x3b8c7f){_0x1fb60c=_0x3b8c7f;switch(_0x3b5d3f[_0xa3f8('0x82')]){case _0xa3f8('0xca'):if(_0x4d3ef8===_0xa3f8('0xcf')){return _0x1fb60c['update']({'read':!![]});}else{logger[_0xa3f8('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xa3f8('0xca'),util['inspect'](_0x3b12ee[_0xa3f8('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xa3f8('0x89'):if(_0x4d3ef8==='1'){return _0x1fb60c[_0xa3f8('0x37')]({'read':!![]});}else{logger[_0xa3f8('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3f8('0x2d'),_0xa3f8('0xca'),util['inspect'](_0x3b12ee[_0xa3f8('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xa3f8('0x8a'):if(!_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0xd0')]&&_0x4d3ef8>=0xc8&&_0x4d3ef8<=0xce){return _0x1fb60c[_0xa3f8('0x37')]({'read':!![]});}else{logger['error'](_0xa3f8('0x28'),'status',_0xa3f8('0x8a'),util[_0xa3f8('0xd1')](_0x3b12ee[_0xa3f8('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xa3f8('0x8f'):var _0x3eae06=_0x3b12ee[_0xa3f8('0x5d')][_0xa3f8('0x90')][0x0];if(_0x3eae06[_0xa3f8('0x2d')][_0xa3f8('0xce')]==='DELIVERED'){return _0x1fb60c[_0xa3f8('0x37')]({'read':!![]});}else{logger[_0xa3f8('0x29')](_0xa3f8('0x28'),'status',_0xa3f8('0x8f'),util[_0xa3f8('0xd1')](_0x3b12ee['body'],{'showHidden':![],'depth':null}));}break;case _0xa3f8('0x93'):if(_0x4d3ef8==_0xa3f8('0xd2')||_0x4d3ef8=='RECEIVED_BY_RECIPIENT'){return _0x1fb60c[_0xa3f8('0x37')]({'read':!![]});}else{logger[_0xa3f8('0x29')](_0xa3f8('0x28'),_0xa3f8('0x2d'),'clickatell',util[_0xa3f8('0xd1')](_0x3b12ee[_0xa3f8('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x1fb60c;}})[_0xa3f8('0x23')](respondWithResult(_0x744c5e,null))[_0xa3f8('0x56')](handleError(_0x744c5e,null));};exports[_0xa3f8('0xd3')]=function(_0x3d85f9,_0x13a5f5,_0x3a872f){var _0x12db33,_0x12fd35,_0xa95a20;return db[_0xa3f8('0x3e')][_0xa3f8('0x5b')]({'where':{'id':_0x3d85f9[_0xa3f8('0x58')]['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x13a5f5,null))[_0xa3f8('0x23')](function(_0x2c35a3){if(_0x2c35a3){_0xa95a20=_0x2c35a3;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xa3f8('0xd4'),_0x2c35a3[_0xa3f8('0x82')],util['inspect'](_0x3d85f9['query'],{'showHidden':![],'depth':null}));switch(_0x2c35a3['type']){case _0xa3f8('0xd5'):if(_0x3d85f9[_0xa3f8('0x41')][_0xa3f8('0xd6')]&&_0x3d85f9[_0xa3f8('0x41')][_0xa3f8('0xd7')]){_0x12fd35=_0x3d85f9['query'][_0xa3f8('0xd7')];return db[_0xa3f8('0xc5')]['find']({'where':{'messageId':_0x3d85f9[_0xa3f8('0x41')][_0xa3f8('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x13a5f5,null))['then'](function(_0x4c0afd){if(_0x4c0afd){_0x12db33=_0x4c0afd;switch(_0xa95a20[_0xa3f8('0x82')]){case _0xa3f8('0xd5'):if(_0x12fd35==='2'||_0x12fd35==='6'){return _0x12db33['update']({'read':!![]});}else{logger[_0xa3f8('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3f8('0x2d'),_0xa3f8('0xd5'),util[_0xa3f8('0xd1')](_0x3d85f9[_0xa3f8('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x12db33;}})[_0xa3f8('0x23')](respondWithResult(_0x13a5f5,null))[_0xa3f8('0x56')](handleError(_0x13a5f5,null));};exports[_0xa3f8('0xd8')]=function(_0x2a1d76,_0x1fc7ff,_0x43a344){return db[_0xa3f8('0x3e')][_0xa3f8('0x5b')]({'where':{'id':_0x2a1d76[_0xa3f8('0x58')]['id']}})['then'](handleEntityNotFound(_0x1fc7ff,null))[_0xa3f8('0x23')](function(_0x48842b){if(_0x48842b){return _0x48842b[_0xa3f8('0xd8')](_0x2a1d76[_0xa3f8('0x5d')][_0xa3f8('0x6e')],_[_0xa3f8('0x9d')](_0x2a1d76[_0xa3f8('0x5d')],[_0xa3f8('0x6e'),'id'])||{})[_0xa3f8('0xa1')](function(_0x517980){for(var _0x2c4bc0=0x0;_0x2c4bc0<_0x2a1d76[_0xa3f8('0x5d')][_0xa3f8('0x6e')][_0xa3f8('0x47')];_0x2c4bc0+=0x1){socket['emit']('userSmsAccount:save',{'UserId':_0x2a1d76[_0xa3f8('0x5d')][_0xa3f8('0x6e')][_0x2c4bc0],'SmsAccountId':_0x2a1d76[_0xa3f8('0x58')]['id']});}return _0x517980;});}})['then'](respondWithResult(_0x1fc7ff,null))[_0xa3f8('0x56')](handleError(_0x1fc7ff,null));};exports[_0xa3f8('0xd9')]=function(_0x9d25ad,_0x59772a,_0x4222ed){var _0xeaadaf;return db[_0xa3f8('0x3e')][_0xa3f8('0x5b')]({'where':{'id':_0x9d25ad[_0xa3f8('0x58')]['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x59772a,null))['then'](function(_0x2b2621){if(_0x2b2621){return _0x2b2621[_0xa3f8('0xd9')](_0x9d25ad[_0xa3f8('0x41')][_0xa3f8('0x6e')])['then'](function(_0x5ccaa9){if(_[_0xa3f8('0xda')](_0x9d25ad['query'][_0xa3f8('0x6e')])){for(var _0x5622b6=0x0;_0x5622b6<_0x9d25ad[_0xa3f8('0x41')]['ids']['length'];_0x5622b6+=0x1){socket[_0xa3f8('0xdb')](_0xa3f8('0xdc'),{'UserId':_0x9d25ad[_0xa3f8('0x41')][_0xa3f8('0x6e')][_0x5622b6],'SmsAccountId':_0x9d25ad['params']['id']});}}else{socket['emit']('userSmsAccount:remove',{'UserId':_0x9d25ad[_0xa3f8('0x41')][_0xa3f8('0x6e')],'SmsAccountId':_0x9d25ad['params']['id']});}});}})['then'](respondWithStatusCode(_0x59772a,null))[_0xa3f8('0x56')](handleError(_0x59772a,null));};exports['getAgents']=function(_0x48b1be,_0x2bb384,_0x7ae34e){var _0x2f6087={};var _0x1de30b={};var _0x5b4b2a;var _0x38a80d;return db[_0xa3f8('0x3e')][_0xa3f8('0x6a')]({'where':{'id':_0x48b1be[_0xa3f8('0x58')]['id']}})[_0xa3f8('0x23')](handleEntityNotFound(_0x2bb384,null))[_0xa3f8('0x23')](function(_0x290061){if(_0x290061){_0x5b4b2a=_0x290061;_0x1de30b['model']=_[_0xa3f8('0x59')](db[_0xa3f8('0xac')][_0xa3f8('0x3f')]);_0x1de30b[_0xa3f8('0x41')]=_[_0xa3f8('0x59')](_0x48b1be[_0xa3f8('0x41')]);_0x1de30b[_0xa3f8('0x44')]=_['intersection'](_0x1de30b['model'],_0x1de30b[_0xa3f8('0x41')]);_0x2f6087[_0xa3f8('0x46')]=_[_0xa3f8('0x45')](_0x1de30b[_0xa3f8('0x40')],qs[_0xa3f8('0x5a')](_0x48b1be[_0xa3f8('0x41')]['fields']));_0x2f6087[_0xa3f8('0x46')]=_0x2f6087[_0xa3f8('0x46')]['length']?_0x2f6087['attributes']:_0x1de30b[_0xa3f8('0x40')];_0x2f6087[_0xa3f8('0x4a')]=qs['sort'](_0x48b1be['query'][_0xa3f8('0x4b')]);_0x2f6087[_0xa3f8('0x4c')]=qs[_0xa3f8('0x44')](_[_0xa3f8('0x4d')](_0x48b1be[_0xa3f8('0x41')],_0x1de30b[_0xa3f8('0x44')]));if(_0x48b1be[_0xa3f8('0x41')][_0xa3f8('0x51')]){_0x2f6087[_0xa3f8('0x4c')]=_[_0xa3f8('0x50')](_0x2f6087[_0xa3f8('0x4c')],{'$or':_[_0xa3f8('0x6b')](_0x2f6087[_0xa3f8('0x46')],function(_0x5b47f9){var _0x32632b={};_0x32632b[_0x5b47f9]={'$like':'%'+_0x48b1be[_0xa3f8('0x41')][_0xa3f8('0x51')]+'%'};return _0x32632b;})});}_0x2f6087=_[_0xa3f8('0x50')]({},_0x2f6087,_0x48b1be['options']);return _0x5b4b2a['getAgents'](_0x2f6087);}})['then'](function(_0x555e05){if(_0x555e05){_0x38a80d=_0x555e05['length'];if(!_0x48b1be[_0xa3f8('0x41')][_0xa3f8('0x48')]('nolimit')){_0x2f6087[_0xa3f8('0x32')]=qs[_0xa3f8('0x32')](_0x48b1be[_0xa3f8('0x41')][_0xa3f8('0x32')]);_0x2f6087['offset']=qs['offset'](_0x48b1be[_0xa3f8('0x41')]['offset']);}return _0x5b4b2a[_0xa3f8('0xdd')](_0x2f6087);}})[_0xa3f8('0x23')](function(_0x18ba7f){if(_0x18ba7f){return _0x18ba7f?{'count':_0x38a80d,'rows':_0x18ba7f}:null;}})[_0xa3f8('0x23')](respondWithResult(_0x2bb384,null))['catch'](handleError(_0x2bb384,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 8f9ee85..ab05e3d 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 _0x91d2=['remove','emit','hasOwnProperty','hook','events','SmsAccount','setMaxListeners','save','update'];(function(_0x4ef77b,_0x6a3df){var _0x58d1a6=function(_0x3b7e29){while(--_0x3b7e29){_0x4ef77b['push'](_0x4ef77b['shift']());}};_0x58d1a6(++_0x6a3df);}(_0x91d2,0xdc));var _0x291d=function(_0xf361ea,_0x4d8528){_0xf361ea=_0xf361ea-0x0;var _0x8f02f5=_0x91d2[_0xf361ea];return _0x8f02f5;};'use strict';var EventEmitter=require(_0x291d('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x291d('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x291d('0x2')](0x0);var events={'afterCreate':_0x291d('0x3'),'afterUpdate':_0x291d('0x4'),'afterDestroy':_0x291d('0x5')};function emitEvent(_0x15ea92){return function(_0x206b79,_0x2fb568,_0x15ab2d){SmsAccountEvents[_0x291d('0x6')](_0x15ea92+':'+_0x206b79['id'],_0x206b79);SmsAccountEvents[_0x291d('0x6')](_0x15ea92,_0x206b79);_0x15ab2d(null);};}for(var e in events){if(events[_0x291d('0x7')](e)){var event=events[e];SmsAccount[_0x291d('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x67a8=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x179a45,_0x4ab8fe){var _0x55685=function(_0xd14902){while(--_0xd14902){_0x179a45['push'](_0x179a45['shift']());}};_0x55685(++_0x4ab8fe);}(_0x67a8,0xca));var _0x867a=function(_0x407bb4,_0xecf04e){_0x407bb4=_0x407bb4-0x0;var _0x158ffb=_0x67a8[_0x407bb4];return _0x158ffb;};'use strict';var EventEmitter=require(_0x867a('0x0'));var SmsAccount=require(_0x867a('0x1'))['db'][_0x867a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x867a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x867a('0x4'),'afterDestroy':_0x867a('0x5')};function emitEvent(_0x2561d6){return function(_0x5a767e,_0x47ffb0,_0x507c51){SmsAccountEvents[_0x867a('0x6')](_0x2561d6+':'+_0x5a767e['id'],_0x5a767e);SmsAccountEvents['emit'](_0x2561d6,_0x5a767e);_0x507c51(null);};}for(var e in events){if(events[_0x867a('0x7')](e)){var event=events[e];SmsAccount[_0x867a('0x8')](e,emitEvent(event));}}module[_0x867a('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index ad79411..7487f44 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 _0xcb10=['util','api','moment','request-promise','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0x20d2e1,_0x2c3a4f){var _0x128857=function(_0x22b971){while(--_0x22b971){_0x20d2e1['push'](_0x20d2e1['shift']());}};_0x128857(++_0x2c3a4f);}(_0xcb10,0x104));var _0x0cb1=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xcb10[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x0cb1('0x0'));var util=require(_0x0cb1('0x1'));var logger=require('../../config/logger')(_0x0cb1('0x2'));var moment=require(_0x0cb1('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cb1('0x4'));var attributes=require('./smsAccount.attributes');module[_0x0cb1('0x5')]=function(_0x36b51c,_0xf8664d){return _0x36b51c[_0x0cb1('0x6')](_0x0cb1('0x7'),attributes,{'tableName':_0x0cb1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d87=['bluebird','request-promise','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment'];(function(_0x3e3dcc,_0x9e22f){var _0x39fa6f=function(_0x4c7d96){while(--_0x4c7d96){_0x3e3dcc['push'](_0x3e3dcc['shift']());}};_0x39fa6f(++_0x9e22f);}(_0x7d87,0x178));var _0x77d8=function(_0x5c6403,_0xb08818){_0x5c6403=_0x5c6403-0x0;var _0x523367=_0x7d87[_0x5c6403];return _0x523367;};'use strict';var _=require(_0x77d8('0x0'));var util=require('util');var logger=require(_0x77d8('0x1'))(_0x77d8('0x2'));var moment=require(_0x77d8('0x3'));var BPromise=require(_0x77d8('0x4'));var rp=require(_0x77d8('0x5'));var attributes=require(_0x77d8('0x6'));module['exports']=function(_0x3da7cd,_0x1e9096){return _0x3da7cd[_0x77d8('0x7')](_0x77d8('0x8'),attributes,{'tableName':_0x77d8('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 378bd52..7051ff6 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 _0x1447=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','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','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment'];(function(_0x42f067,_0x5812f5){var _0x425b80=function(_0xfc3e04){while(--_0xfc3e04){_0x42f067['push'](_0x42f067['shift']());}};_0x425b80(++_0x5812f5);}(_0x1447,0xac));var _0x7144=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1447[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x7144('0x0'));var util=require(_0x7144('0x1'));var moment=require(_0x7144('0x2'));var BPromise=require(_0x7144('0x3'));var rs=require(_0x7144('0x4'));var fs=require('fs');var Redis=require(_0x7144('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7144('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7144('0x7'));var jayson=require(_0x7144('0x8'));var client=jayson['client'][_0x7144('0x9')]({'port':0x232a});config[_0x7144('0xa')]=_[_0x7144('0xb')](config[_0x7144('0xa')],{'host':_0x7144('0xc'),'port':0x18eb});var socket=require(_0x7144('0xd'))(new Redis(config[_0x7144('0xa')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x445233,_0x362ab1,_0x280d7c){return new BPromise(function(_0x2b1877,_0x504ccc){return client[_0x7144('0xe')](_0x445233,_0x280d7c)[_0x7144('0xf')](function(_0x1cd42c){logger['info'](_0x7144('0x10'),_0x362ab1,_0x7144('0x11'));logger[_0x7144('0x12')](_0x7144('0x13'),_0x362ab1,'request\x20sent',JSON[_0x7144('0x14')](_0x1cd42c));if(_0x1cd42c[_0x7144('0x15')]){if(_0x1cd42c[_0x7144('0x15')][_0x7144('0x16')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x362ab1,_0x1cd42c[_0x7144('0x15')][_0x7144('0x17')]);return _0x504ccc(_0x1cd42c[_0x7144('0x15')][_0x7144('0x17')]);}logger[_0x7144('0x15')](_0x7144('0x10'),_0x362ab1,_0x1cd42c[_0x7144('0x15')]['message']);return _0x2b1877(_0x1cd42c['error'][_0x7144('0x17')]);}else{logger['info'](_0x7144('0x10'),_0x362ab1,'request\x20sent');_0x2b1877(_0x1cd42c[_0x7144('0x18')][_0x7144('0x17')]);}})[_0x7144('0x19')](function(_0x60ddf5){logger[_0x7144('0x15')](_0x7144('0x10'),_0x362ab1,_0x60ddf5);_0x504ccc(_0x60ddf5);});});}exports[_0x7144('0x1a')]=function(_0x35ae66){var _0x3ef9eb=this;return new Promise(function(_0x57e6c9,_0x3f3722){return db[_0x7144('0x1b')][_0x7144('0x1c')]({'raw':_0x35ae66[_0x7144('0x1d')]?_0x35ae66[_0x7144('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x35ae66[_0x7144('0x1d')]?_0x35ae66[_0x7144('0x1d')][_0x7144('0x1e')]||null:null,'attributes':_0x35ae66[_0x7144('0x1d')]?_0x35ae66['options'][_0x7144('0x1f')]||null:null,'include':_0x35ae66['options']?_0x35ae66['options'][_0x7144('0x20')]?_[_0x7144('0x21')](_0x35ae66[_0x7144('0x1d')][_0x7144('0x20')],function(_0x2982b2){return{'model':db[_0x2982b2[_0x7144('0x22')]],'as':_0x2982b2['as'],'attributes':_0x2982b2['attributes'],'include':_0x2982b2[_0x7144('0x20')]?_[_0x7144('0x21')](_0x2982b2['include'],function(_0x1442eb){return{'model':db[_0x1442eb[_0x7144('0x22')]],'as':_0x1442eb['as'],'attributes':_0x1442eb['attributes'],'include':_0x1442eb[_0x7144('0x20')]?_[_0x7144('0x21')](_0x1442eb['include'],function(_0x497e57){return{'model':db[_0x497e57[_0x7144('0x22')]],'as':_0x497e57['as'],'attributes':_0x497e57[_0x7144('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7144('0xf')](function(_0x1d1527){logger[_0x7144('0x23')](_0x7144('0x1a'),_0x35ae66);logger[_0x7144('0x12')](_0x7144('0x1a'),_0x35ae66,JSON[_0x7144('0x14')](_0x1d1527));_0x57e6c9(_0x1d1527);})[_0x7144('0x19')](function(_0x78f199){logger[_0x7144('0x15')](_0x7144('0x1a'),_0x78f199[_0x7144('0x17')],_0x35ae66);_0x3f3722(_0x3ef9eb[_0x7144('0x15')](0x1f4,_0x78f199[_0x7144('0x17')]));});});}; \ No newline at end of file +var _0xed37=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','SmsAccount','find','options','attributes','include','map','model','ShowSmsAccount','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1ceafa,_0x337b93){var _0x4c0e1a=function(_0xe22e5){while(--_0xe22e5){_0x1ceafa['push'](_0x1ceafa['shift']());}};_0x4c0e1a(++_0x337b93);}(_0xed37,0x142));var _0x7ed3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xed37[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x7ed3('0x0'));var util=require('util');var moment=require(_0x7ed3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ed3('0x2'));var db=require(_0x7ed3('0x3'))['db'];var utils=require(_0x7ed3('0x4'));var logger=require(_0x7ed3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7ed3('0x6'));var client=jayson[_0x7ed3('0x7')]['http']({'port':0x232a});config[_0x7ed3('0x8')]=_[_0x7ed3('0x9')](config['redis'],{'host':_0x7ed3('0xa'),'port':0x18eb});var socket=require(_0x7ed3('0xb'))(new Redis(config[_0x7ed3('0x8')]));require(_0x7ed3('0xc'))['register'](socket);function respondWithRpcPromise(_0x4b8c5d,_0xe7de61,_0x556586){return new BPromise(function(_0x364ca3,_0x3eec72){return client[_0x7ed3('0xd')](_0x4b8c5d,_0x556586)[_0x7ed3('0xe')](function(_0x92b746){logger[_0x7ed3('0xf')](_0x7ed3('0x10'),_0xe7de61,_0x7ed3('0x11'));logger[_0x7ed3('0x12')](_0x7ed3('0x13'),_0xe7de61,_0x7ed3('0x11'),JSON[_0x7ed3('0x14')](_0x92b746));if(_0x92b746['error']){if(_0x92b746['error'][_0x7ed3('0x15')]===0x1f4){logger[_0x7ed3('0x16')]('SmsAccount,\x20%s,\x20%s',_0xe7de61,_0x92b746['error'][_0x7ed3('0x17')]);return _0x3eec72(_0x92b746['error'][_0x7ed3('0x17')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0xe7de61,_0x92b746[_0x7ed3('0x16')]['message']);return _0x364ca3(_0x92b746['error']['message']);}else{logger[_0x7ed3('0xf')]('SmsAccount,\x20%s,\x20%s',_0xe7de61,_0x7ed3('0x11'));_0x364ca3(_0x92b746[_0x7ed3('0x18')][_0x7ed3('0x17')]);}})[_0x7ed3('0x19')](function(_0x42c420){logger[_0x7ed3('0x16')](_0x7ed3('0x10'),_0xe7de61,_0x42c420);_0x3eec72(_0x42c420);});});}exports['ShowSmsAccount']=function(_0x24d067){var _0x258b57=this;return new Promise(function(_0x13ec5c,_0x5805b5){return db[_0x7ed3('0x1a')][_0x7ed3('0x1b')]({'raw':_0x24d067[_0x7ed3('0x1c')]?_0x24d067[_0x7ed3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x24d067[_0x7ed3('0x1c')]?_0x24d067[_0x7ed3('0x1c')]['where']||null:null,'attributes':_0x24d067['options']?_0x24d067[_0x7ed3('0x1c')][_0x7ed3('0x1d')]||null:null,'include':_0x24d067[_0x7ed3('0x1c')]?_0x24d067[_0x7ed3('0x1c')][_0x7ed3('0x1e')]?_[_0x7ed3('0x1f')](_0x24d067[_0x7ed3('0x1c')][_0x7ed3('0x1e')],function(_0x543f60){return{'model':db[_0x543f60['model']],'as':_0x543f60['as'],'attributes':_0x543f60[_0x7ed3('0x1d')],'include':_0x543f60[_0x7ed3('0x1e')]?_[_0x7ed3('0x1f')](_0x543f60[_0x7ed3('0x1e')],function(_0x514818){return{'model':db[_0x514818[_0x7ed3('0x20')]],'as':_0x514818['as'],'attributes':_0x514818['attributes'],'include':_0x514818[_0x7ed3('0x1e')]?_[_0x7ed3('0x1f')](_0x514818['include'],function(_0x21b7dc){return{'model':db[_0x21b7dc[_0x7ed3('0x20')]],'as':_0x21b7dc['as'],'attributes':_0x21b7dc[_0x7ed3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f1c45){logger['info'](_0x7ed3('0x21'),_0x24d067);logger[_0x7ed3('0x12')](_0x7ed3('0x21'),_0x24d067,JSON['stringify'](_0x1f1c45));_0x13ec5c(_0x1f1c45);})[_0x7ed3('0x19')](function(_0x322f78){logger[_0x7ed3('0x16')](_0x7ed3('0x21'),_0x322f78['message'],_0x24d067);_0x5805b5(_0x258b57[_0x7ed3('0x16')](0x1f4,_0x322f78[_0x7ed3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0df1897..4c08039 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 _0xcf5c=['update','emit','removeListener','register','length','save'];(function(_0x11bc84,_0x54a05){var _0x3205bd=function(_0x1d510c){while(--_0x1d510c){_0x11bc84['push'](_0x11bc84['shift']());}};_0x3205bd(++_0x54a05);}(_0xcf5c,0x65));var _0xccf5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcf5c[_0x1facfa];return _0x9ec701;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xccf5('0x0'),'remove',_0xccf5('0x1')];function createListener(_0x1223ed,_0x57b9e8){return function(_0x25a343){_0x57b9e8[_0xccf5('0x2')](_0x1223ed,_0x25a343);};}function removeListener(_0x3926d4,_0x2a125c){return function(){SmsAccountEvents[_0xccf5('0x3')](_0x3926d4,_0x2a125c);};}exports[_0xccf5('0x4')]=function(_0x5e43c3){for(var _0x5217fb=0x0,_0x3a6d66=events[_0xccf5('0x5')];_0x5217fb<_0x3a6d66;_0x5217fb++){var _0x5043e3=events[_0x5217fb];var _0x27cd2b=createListener('smsAccount:'+_0x5043e3,_0x5e43c3);SmsAccountEvents['on'](_0x5043e3,_0x27cd2b);}}; \ No newline at end of file +var _0xae02=['length','smsAccount:','./smsAccount.events','save','remove','removeListener','register'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xae02,0x12f));var _0x2ae0=function(_0x20e9f,_0x1262d6){_0x20e9f=_0x20e9f-0x0;var _0x429dbd=_0xae02[_0x20e9f];return _0x429dbd;};'use strict';var SmsAccountEvents=require(_0x2ae0('0x0'));var events=[_0x2ae0('0x1'),_0x2ae0('0x2'),'update'];function createListener(_0x6d6adb,_0x17ed3f){return function(_0x49bbed){_0x17ed3f['emit'](_0x6d6adb,_0x49bbed);};}function removeListener(_0x50d14d,_0x4a6883){return function(){SmsAccountEvents[_0x2ae0('0x3')](_0x50d14d,_0x4a6883);};}exports[_0x2ae0('0x4')]=function(_0x4da55b){for(var _0x39ef90=0x0,_0x51f9f9=events[_0x2ae0('0x5')];_0x39ef90<_0x51f9f9;_0x39ef90++){var _0x32319b=events[_0x39ef90];var _0x542a90=createListener(_0x2ae0('0x6')+_0x32319b,_0x4da55b);SmsAccountEvents['on'](_0x32319b,_0x542a90);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index deb40b0..37688fa 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 _0x7177=['destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x2572aa,_0x562d43){var _0x1f1961=function(_0x5189b2){while(--_0x5189b2){_0x2572aa['push'](_0x2572aa['shift']());}};_0x1f1961(++_0x562d43);}(_0x7177,0x101));var _0x7717=function(_0x1da811,_0x2e30db){_0x1da811=_0x1da811-0x0;var _0x53858b=_0x7177[_0x1da811];return _0x53858b;};'use strict';var multer=require(_0x7717('0x0'));var util=require('util');var path=require(_0x7717('0x1'));var timeout=require('connect-timeout');var express=require(_0x7717('0x2'));var router=express[_0x7717('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7717('0x4'));var config=require(_0x7717('0x5'));var controller=require('./smsApplication.controller');router[_0x7717('0x6')]('/',auth[_0x7717('0x7')](),controller[_0x7717('0x8')]);router[_0x7717('0x6')](_0x7717('0x9'),auth[_0x7717('0x7')](),controller[_0x7717('0xa')]);router[_0x7717('0xb')]('/',auth[_0x7717('0x7')](),controller[_0x7717('0xc')]);router[_0x7717('0xd')]('/:id',auth[_0x7717('0x7')](),controller[_0x7717('0xe')]);router['delete'](_0x7717('0x9'),auth['isAuthenticated'](),controller[_0x7717('0xf')]);module[_0x7717('0x10')]=router; \ No newline at end of file +var _0xc664=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports'];(function(_0x1300e6,_0x2af507){var _0x53abce=function(_0xee3cb){while(--_0xee3cb){_0x1300e6['push'](_0x1300e6['shift']());}};_0x53abce(++_0x2af507);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var path=require('path');var timeout=require(_0x4c66('0x2'));var express=require(_0x4c66('0x3'));var router=express[_0x4c66('0x4')]();var auth=require(_0x4c66('0x5'));var interaction=require(_0x4c66('0x6'));var config=require('../../config/environment');var controller=require(_0x4c66('0x7'));router[_0x4c66('0x8')]('/',auth[_0x4c66('0x9')](),controller[_0x4c66('0xa')]);router['get'](_0x4c66('0xb'),auth[_0x4c66('0x9')](),controller[_0x4c66('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4c66('0xd')]);router[_0x4c66('0xe')](_0x4c66('0xb'),auth[_0x4c66('0x9')](),controller['update']);router[_0x4c66('0xf')](_0x4c66('0xb'),auth[_0x4c66('0x9')](),controller[_0x4c66('0x10')]);module[_0x4c66('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 4c1f643..2efbb86 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 _0x4a13=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x19f69d,_0xaa7647){var _0x2bf66b=function(_0x45c58d){while(--_0x45c58d){_0x19f69d['push'](_0x19f69d['shift']());}};_0x2bf66b(++_0xaa7647);}(_0x4a13,0x185));var _0x34a1=function(_0x58c378,_0x127ad0){_0x58c378=_0x58c378-0x0;var _0x4efb75=_0x4a13[_0x58c378];return _0x4efb75;};'use strict';var Sequelize=require(_0x34a1('0x0'));module[_0x34a1('0x1')]={'priority':{'type':Sequelize[_0x34a1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x34a1('0x3')],'allowNull':![],'defaultValue':_0x34a1('0x4')},'appdata':{'type':Sequelize[_0x34a1('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x34a1('0x3')]},'interval':{'type':Sequelize[_0x34a1('0x3')],'defaultValue':_0x34a1('0x5')}}; \ No newline at end of file +var _0x6751=['*,*,*,*','INTEGER','noop','STRING'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0x6751,0x191));var _0x1675=function(_0x36ee10,_0x3e4e4b){_0x36ee10=_0x36ee10-0x0;var _0x1ae7e8=_0x6751[_0x36ee10];return _0x1ae7e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x1675('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1675('0x1')},'appdata':{'type':Sequelize[_0x1675('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x1675('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1675('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 01dfdc5..ef76920 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 _0x0227=['zip-dir','fast-json-patch','moment','bluebird','mustache','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','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','SmsApplication','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','includeAll','include','findAll','rows','params','options','find','create','catch','body','html-pdf','rimraf'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0x0227,0x1ef));var _0x7022=function(_0x5bba66,_0x11ac9f){_0x5bba66=_0x5bba66-0x0;var _0x407a37=_0x0227[_0x5bba66];return _0x407a37;};'use strict';var pdf=require(_0x7022('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7022('0x1'));var zipdir=require(_0x7022('0x2'));var jsonpatch=require(_0x7022('0x3'));var rp=require('request-promise');var moment=require(_0x7022('0x4'));var BPromise=require(_0x7022('0x5'));var Mustache=require(_0x7022('0x6'));var util=require('util');var path=require(_0x7022('0x7'));var sox=require(_0x7022('0x8'));var csv=require(_0x7022('0x9'));var ejs=require(_0x7022('0xa'));var fs=require('fs');var _=require(_0x7022('0xb'));var squel=require(_0x7022('0xc'));var crypto=require(_0x7022('0xd'));var jsforce=require(_0x7022('0xe'));var deskjs=require(_0x7022('0xf'));var toCsv=require(_0x7022('0x9'));var querystring=require(_0x7022('0x10'));var Papa=require(_0x7022('0x11'));var Redis=require('ioredis');var qs=require(_0x7022('0x12'));var logger=require(_0x7022('0x13'))(_0x7022('0x14'));var utils=require(_0x7022('0x15'));var config=require(_0x7022('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fc50e,_0x40e782){_0x40e782=_0x40e782||0xcc;return function(_0xa0a25b){if(_0xa0a25b){return _0x2fc50e['sendStatus'](_0x40e782);}return _0x2fc50e[_0x7022('0x17')](_0x40e782)[_0x7022('0x18')]();};}function respondWithResult(_0x49fbcf,_0x45d60f){_0x45d60f=_0x45d60f||0xc8;return function(_0x71e84e){if(_0x71e84e){return _0x49fbcf[_0x7022('0x17')](_0x45d60f)[_0x7022('0x19')](_0x71e84e);}};}function respondWithFilteredResult(_0x5ceb2e,_0x1f6850){return function(_0x37e1dc){if(_0x37e1dc){var _0xfbe5d2=_0x37e1dc[_0x7022('0x1a')],_0x511238=_0x1f6850[_0x7022('0x1b')],_0x1ec0d4=_0x1f6850[_0x7022('0x1b')]+_0x1f6850['limit'],_0x3b89d5;if(_0x1ec0d4>=_0xfbe5d2){_0x1ec0d4=_0xfbe5d2;_0x3b89d5=0xc8;}else{_0x3b89d5=0xce;}_0x5ceb2e['status'](_0x3b89d5);return _0x5ceb2e['set'](_0x7022('0x1c'),_0x511238+'-'+_0x1ec0d4+'/'+_0xfbe5d2)[_0x7022('0x19')](_0x37e1dc);}return null;};}function patchUpdates(_0x475969){return function(_0x3f17dd){try{jsonpatch[_0x7022('0x1d')](_0x3f17dd,_0x475969,!![]);}catch(_0x56defd){return BPromise[_0x7022('0x1e')](_0x56defd);}return _0x3f17dd[_0x7022('0x1f')]();};}function saveUpdates(_0x5c6e7f,_0x35e1f7){return function(_0x4cb7f9){if(_0x4cb7f9){return _0x4cb7f9[_0x7022('0x20')](_0x5c6e7f)[_0x7022('0x21')](function(_0x558640){return _0x558640;});}return null;};}function removeEntity(_0x43e97d,_0x4478ab){return function(_0x2200da){if(_0x2200da){return _0x2200da[_0x7022('0x22')]()[_0x7022('0x21')](function(){_0x43e97d[_0x7022('0x17')](0xcc)[_0x7022('0x18')]();});}};}function handleEntityNotFound(_0x4c6304,_0x564efc){return function(_0x585a26){if(!_0x585a26){_0x4c6304[_0x7022('0x23')](0x194);}return _0x585a26;};}function handleError(_0x1277ab,_0x49e178){_0x49e178=_0x49e178||0x1f4;return function(_0x5c395a){logger['error'](_0x5c395a[_0x7022('0x24')]);if(_0x5c395a['name']){delete _0x5c395a['name'];}_0x1277ab[_0x7022('0x17')](_0x49e178)[_0x7022('0x25')](_0x5c395a);};}exports['index']=function(_0x113eee,_0x486335){var _0x5acf7f={},_0x1fe386={},_0x12bca7={'count':0x0,'rows':[]};var _0x52b849=db[_0x7022('0x26')][_0x7022('0x27')];_0x1fe386['model']=_[_0x7022('0x28')](_0x52b849);var _0xf02ed8={'dateStart':_0x113eee[_0x7022('0x29')]['dateStart'],'dateEnd':_0x113eee[_0x7022('0x29')][_0x7022('0x2a')]};delete _0x113eee[_0x7022('0x29')][_0x7022('0x2b')];delete _0x113eee[_0x7022('0x29')]['dateEnd'];_0x1fe386[_0x7022('0x29')]=_[_0x7022('0x28')](_0x113eee[_0x7022('0x29')]);_0x1fe386[_0x7022('0x2c')]=_[_0x7022('0x2d')](_0x1fe386[_0x7022('0x2e')],_0x1fe386['query']);_0x5acf7f['attributes']=_[_0x7022('0x2d')](_0x1fe386[_0x7022('0x2e')],qs[_0x7022('0x2f')](_0x113eee[_0x7022('0x29')][_0x7022('0x2f')]));_0x5acf7f[_0x7022('0x30')]=_0x5acf7f['attributes'][_0x7022('0x31')]?_0x5acf7f[_0x7022('0x30')]:_0x1fe386[_0x7022('0x2e')];if(!_0x113eee[_0x7022('0x29')]['hasOwnProperty'](_0x7022('0x32'))){_0x5acf7f[_0x7022('0x33')]=qs[_0x7022('0x33')](_0x113eee[_0x7022('0x29')][_0x7022('0x33')]);_0x5acf7f[_0x7022('0x1b')]=qs[_0x7022('0x1b')](_0x113eee[_0x7022('0x29')]['offset']);}_0x5acf7f[_0x7022('0x34')]=qs[_0x7022('0x35')](_0x113eee[_0x7022('0x29')][_0x7022('0x35')]);_0x5acf7f[_0x7022('0x36')]=qs['filters'](_[_0x7022('0x37')](_0x113eee['query'],_0x1fe386[_0x7022('0x2c')]));if(_0xf02ed8['dateStart']){if(_0xf02ed8[_0x7022('0x2a')]){_0xf02ed8['dateEnd']=moment(_0xf02ed8['dateEnd'])[_0x7022('0x38')](0x1,_0x7022('0x39'));}else{_0xf02ed8[_0x7022('0x2a')]=moment(_0xf02ed8[_0x7022('0x2b')])['add'](0x1,_0x7022('0x39'));}_[_0x7022('0x3a')](_0x5acf7f[_0x7022('0x36')],{'createdAt':{'$gte':_0xf02ed8[_0x7022('0x2b')],'$lte':_0xf02ed8[_0x7022('0x2a')]}});}if(_0x113eee[_0x7022('0x29')][_0x7022('0x3b')]){_0x5acf7f[_0x7022('0x36')]=_[_0x7022('0x3a')](_0x5acf7f[_0x7022('0x36')],{'$or':_[_0x7022('0x3c')](_0x5acf7f[_0x7022('0x30')],function(_0x55bacb){var _0x48c7c5={};_0x48c7c5[_0x55bacb]={'$like':'%'+_0x113eee['query'][_0x7022('0x3b')]+'%'};return _0x48c7c5;})});}_0x5acf7f=_[_0x7022('0x3a')]({},_0x5acf7f,_0x113eee['options']);var _0x292d47={'where':_0x5acf7f[_0x7022('0x36')]};return db['SmsApplication']['count'](_0x292d47)[_0x7022('0x21')](function(_0x46a539){_0x12bca7['count']=_0x46a539;if(_0x113eee[_0x7022('0x29')][_0x7022('0x3d')]){_0x5acf7f[_0x7022('0x3e')]=[{'all':!![]}];}return db[_0x7022('0x26')][_0x7022('0x3f')](_0x5acf7f);})[_0x7022('0x21')](function(_0xf2ad79){_0x12bca7[_0x7022('0x40')]=_0xf2ad79;return _0x12bca7;})[_0x7022('0x21')](respondWithFilteredResult(_0x486335,_0x5acf7f))['catch'](handleError(_0x486335,null));};exports['show']=function(_0x21acb0,_0x3cac64){var _0x52c9ee={'raw':!![],'where':{'id':_0x21acb0[_0x7022('0x41')]['id']}},_0x3a46c1={};_0x3a46c1[_0x7022('0x2e')]=_['keys'](db[_0x7022('0x26')][_0x7022('0x27')]);_0x3a46c1[_0x7022('0x29')]=_[_0x7022('0x28')](_0x21acb0[_0x7022('0x29')]);_0x3a46c1[_0x7022('0x2c')]=_[_0x7022('0x2d')](_0x3a46c1['model'],_0x3a46c1[_0x7022('0x29')]);_0x52c9ee[_0x7022('0x30')]=_[_0x7022('0x2d')](_0x3a46c1['model'],qs['fields'](_0x21acb0[_0x7022('0x29')][_0x7022('0x2f')]));_0x52c9ee['attributes']=_0x52c9ee['attributes'][_0x7022('0x31')]?_0x52c9ee[_0x7022('0x30')]:_0x3a46c1[_0x7022('0x2e')];if(_0x21acb0[_0x7022('0x29')]['includeAll']){_0x52c9ee[_0x7022('0x3e')]=[{'all':!![]}];}_0x52c9ee=_[_0x7022('0x3a')]({},_0x52c9ee,_0x21acb0[_0x7022('0x42')]);return db[_0x7022('0x26')][_0x7022('0x43')](_0x52c9ee)[_0x7022('0x21')](handleEntityNotFound(_0x3cac64,null))[_0x7022('0x21')](respondWithResult(_0x3cac64,null))['catch'](handleError(_0x3cac64,null));};exports['create']=function(_0x3537a1,_0x3fc22f){return db[_0x7022('0x26')][_0x7022('0x44')](_0x3537a1['body'],{})['then'](respondWithResult(_0x3fc22f,0xc9))[_0x7022('0x45')](handleError(_0x3fc22f,null));};exports[_0x7022('0x20')]=function(_0x176ad2,_0x2b8b90){if(_0x176ad2[_0x7022('0x46')]['id']){delete _0x176ad2[_0x7022('0x46')]['id'];}return db[_0x7022('0x26')][_0x7022('0x43')]({'where':{'id':_0x176ad2[_0x7022('0x41')]['id']}})[_0x7022('0x21')](handleEntityNotFound(_0x2b8b90,null))[_0x7022('0x21')](saveUpdates(_0x176ad2[_0x7022('0x46')],null))[_0x7022('0x21')](respondWithResult(_0x2b8b90,null))[_0x7022('0x45')](handleError(_0x2b8b90,null));};exports[_0x7022('0x22')]=function(_0x4c1325,_0xcd98aa){return db[_0x7022('0x26')][_0x7022('0x43')]({'where':{'id':_0x4c1325[_0x7022('0x41')]['id']}})[_0x7022('0x21')](handleEntityNotFound(_0xcd98aa,null))[_0x7022('0x21')](removeEntity(_0xcd98aa,null))['catch'](handleError(_0xcd98aa,null));}; \ No newline at end of file +var _0x40a8=['apply','save','update','then','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','SmsApplication','includeAll','rows','catch','show','fields','create','body','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x40bc8b,_0x4b936f){var _0x29a911=function(_0x63211e){while(--_0x63211e){_0x40bc8b['push'](_0x40bc8b['shift']());}};_0x29a911(++_0x4b936f);}(_0x40a8,0x13d));var _0x840a=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x40a8[_0x516927];return _0x30749b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x840a('0x0'));var rimraf=require(_0x840a('0x1'));var zipdir=require(_0x840a('0x2'));var jsonpatch=require(_0x840a('0x3'));var rp=require(_0x840a('0x4'));var moment=require('moment');var BPromise=require(_0x840a('0x5'));var Mustache=require('mustache');var util=require(_0x840a('0x6'));var path=require(_0x840a('0x7'));var sox=require(_0x840a('0x8'));var csv=require(_0x840a('0x9'));var ejs=require(_0x840a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x840a('0xb'));var crypto=require(_0x840a('0xc'));var jsforce=require(_0x840a('0xd'));var deskjs=require(_0x840a('0xe'));var toCsv=require(_0x840a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x840a('0xf'));var qs=require(_0x840a('0x10'));var logger=require(_0x840a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x840a('0x12'));var db=require(_0x840a('0x13'))['db'];function respondWithStatusCode(_0x9cd5ec,_0x1b30c2){_0x1b30c2=_0x1b30c2||0xcc;return function(_0x1a2e1d){if(_0x1a2e1d){return _0x9cd5ec[_0x840a('0x14')](_0x1b30c2);}return _0x9cd5ec[_0x840a('0x15')](_0x1b30c2)[_0x840a('0x16')]();};}function respondWithResult(_0x4105d4,_0x54eddd){_0x54eddd=_0x54eddd||0xc8;return function(_0x12c96b){if(_0x12c96b){return _0x4105d4[_0x840a('0x15')](_0x54eddd)[_0x840a('0x17')](_0x12c96b);}};}function respondWithFilteredResult(_0x4dcf53,_0x3cd43d){return function(_0x214d21){if(_0x214d21){var _0x352e8a=_0x214d21[_0x840a('0x18')],_0x4b2fac=_0x3cd43d['offset'],_0x403a5c=_0x3cd43d[_0x840a('0x19')]+_0x3cd43d[_0x840a('0x1a')],_0x562096;if(_0x403a5c>=_0x352e8a){_0x403a5c=_0x352e8a;_0x562096=0xc8;}else{_0x562096=0xce;}_0x4dcf53[_0x840a('0x15')](_0x562096);return _0x4dcf53[_0x840a('0x1b')]('Content-Range',_0x4b2fac+'-'+_0x403a5c+'/'+_0x352e8a)[_0x840a('0x17')](_0x214d21);}return null;};}function patchUpdates(_0x18f1f8){return function(_0x324ca0){try{jsonpatch[_0x840a('0x1c')](_0x324ca0,_0x18f1f8,!![]);}catch(_0x8a5663){return BPromise['reject'](_0x8a5663);}return _0x324ca0[_0x840a('0x1d')]();};}function saveUpdates(_0x5c369b,_0x260e22){return function(_0x50883e){if(_0x50883e){return _0x50883e[_0x840a('0x1e')](_0x5c369b)[_0x840a('0x1f')](function(_0x101c2e){return _0x101c2e;});}return null;};}function removeEntity(_0x23d277,_0x232b10){return function(_0x4b09a6){if(_0x4b09a6){return _0x4b09a6['destroy']()[_0x840a('0x1f')](function(){_0x23d277['status'](0xcc)[_0x840a('0x16')]();});}};}function handleEntityNotFound(_0x1f52f2,_0x1f218a){return function(_0x588442){if(!_0x588442){_0x1f52f2[_0x840a('0x14')](0x194);}return _0x588442;};}function handleError(_0x18f94e,_0x91df57){_0x91df57=_0x91df57||0x1f4;return function(_0x917c0c){logger[_0x840a('0x20')](_0x917c0c[_0x840a('0x21')]);if(_0x917c0c[_0x840a('0x22')]){delete _0x917c0c['name'];}_0x18f94e[_0x840a('0x15')](_0x91df57)[_0x840a('0x23')](_0x917c0c);};}exports[_0x840a('0x24')]=function(_0x5290f5,_0x9561cb){var _0x252bfa={},_0x380e95={},_0x5d734c={'count':0x0,'rows':[]};var _0x3c8e10=db['SmsApplication'][_0x840a('0x25')];_0x380e95[_0x840a('0x26')]=_[_0x840a('0x27')](_0x3c8e10);var _0x57cc0a={'dateStart':_0x5290f5[_0x840a('0x28')][_0x840a('0x29')],'dateEnd':_0x5290f5['query'][_0x840a('0x2a')]};delete _0x5290f5[_0x840a('0x28')]['dateStart'];delete _0x5290f5[_0x840a('0x28')]['dateEnd'];_0x380e95[_0x840a('0x28')]=_['keys'](_0x5290f5[_0x840a('0x28')]);_0x380e95[_0x840a('0x2b')]=_[_0x840a('0x2c')](_0x380e95[_0x840a('0x26')],_0x380e95[_0x840a('0x28')]);_0x252bfa[_0x840a('0x2d')]=_[_0x840a('0x2c')](_0x380e95[_0x840a('0x26')],qs['fields'](_0x5290f5[_0x840a('0x28')]['fields']));_0x252bfa[_0x840a('0x2d')]=_0x252bfa[_0x840a('0x2d')][_0x840a('0x2e')]?_0x252bfa[_0x840a('0x2d')]:_0x380e95['model'];if(!_0x5290f5[_0x840a('0x28')]['hasOwnProperty'](_0x840a('0x2f'))){_0x252bfa[_0x840a('0x1a')]=qs[_0x840a('0x1a')](_0x5290f5[_0x840a('0x28')][_0x840a('0x1a')]);_0x252bfa[_0x840a('0x19')]=qs[_0x840a('0x19')](_0x5290f5[_0x840a('0x28')]['offset']);}_0x252bfa[_0x840a('0x30')]=qs[_0x840a('0x31')](_0x5290f5[_0x840a('0x28')][_0x840a('0x31')]);_0x252bfa[_0x840a('0x32')]=qs['filters'](_[_0x840a('0x33')](_0x5290f5['query'],_0x380e95[_0x840a('0x2b')]));if(_0x57cc0a[_0x840a('0x29')]){if(_0x57cc0a[_0x840a('0x2a')]){_0x57cc0a[_0x840a('0x2a')]=moment(_0x57cc0a[_0x840a('0x2a')])[_0x840a('0x34')](0x1,_0x840a('0x35'));}else{_0x57cc0a[_0x840a('0x2a')]=moment(_0x57cc0a[_0x840a('0x29')])[_0x840a('0x34')](0x1,_0x840a('0x35'));}_[_0x840a('0x36')](_0x252bfa[_0x840a('0x32')],{'createdAt':{'$gte':_0x57cc0a['dateStart'],'$lte':_0x57cc0a['dateEnd']}});}if(_0x5290f5[_0x840a('0x28')][_0x840a('0x37')]){_0x252bfa[_0x840a('0x32')]=_[_0x840a('0x36')](_0x252bfa['where'],{'$or':_[_0x840a('0x38')](_0x252bfa[_0x840a('0x2d')],function(_0x171879){var _0x5ba257={};_0x5ba257[_0x171879]={'$like':'%'+_0x5290f5[_0x840a('0x28')]['filter']+'%'};return _0x5ba257;})});}_0x252bfa=_[_0x840a('0x36')]({},_0x252bfa,_0x5290f5[_0x840a('0x39')]);var _0x3d26f3={'where':_0x252bfa[_0x840a('0x32')]};return db[_0x840a('0x3a')]['count'](_0x3d26f3)['then'](function(_0x285d6a){_0x5d734c[_0x840a('0x18')]=_0x285d6a;if(_0x5290f5['query'][_0x840a('0x3b')]){_0x252bfa['include']=[{'all':!![]}];}return db[_0x840a('0x3a')]['findAll'](_0x252bfa);})[_0x840a('0x1f')](function(_0x292d1d){_0x5d734c[_0x840a('0x3c')]=_0x292d1d;return _0x5d734c;})[_0x840a('0x1f')](respondWithFilteredResult(_0x9561cb,_0x252bfa))[_0x840a('0x3d')](handleError(_0x9561cb,null));};exports[_0x840a('0x3e')]=function(_0x4f9fab,_0x27169a){var _0xa15372={'raw':!![],'where':{'id':_0x4f9fab['params']['id']}},_0x1708e5={};_0x1708e5[_0x840a('0x26')]=_['keys'](db[_0x840a('0x3a')][_0x840a('0x25')]);_0x1708e5['query']=_['keys'](_0x4f9fab[_0x840a('0x28')]);_0x1708e5[_0x840a('0x2b')]=_[_0x840a('0x2c')](_0x1708e5[_0x840a('0x26')],_0x1708e5[_0x840a('0x28')]);_0xa15372['attributes']=_[_0x840a('0x2c')](_0x1708e5[_0x840a('0x26')],qs[_0x840a('0x3f')](_0x4f9fab[_0x840a('0x28')][_0x840a('0x3f')]));_0xa15372[_0x840a('0x2d')]=_0xa15372[_0x840a('0x2d')][_0x840a('0x2e')]?_0xa15372['attributes']:_0x1708e5[_0x840a('0x26')];if(_0x4f9fab[_0x840a('0x28')][_0x840a('0x3b')]){_0xa15372['include']=[{'all':!![]}];}_0xa15372=_[_0x840a('0x36')]({},_0xa15372,_0x4f9fab[_0x840a('0x39')]);return db[_0x840a('0x3a')]['find'](_0xa15372)[_0x840a('0x1f')](handleEntityNotFound(_0x27169a,null))['then'](respondWithResult(_0x27169a,null))[_0x840a('0x3d')](handleError(_0x27169a,null));};exports['create']=function(_0x48e3ec,_0x7a47ff){return db[_0x840a('0x3a')][_0x840a('0x40')](_0x48e3ec['body'],{})[_0x840a('0x1f')](respondWithResult(_0x7a47ff,0xc9))['catch'](handleError(_0x7a47ff,null));};exports[_0x840a('0x1e')]=function(_0x21aef5,_0x58d100){if(_0x21aef5[_0x840a('0x41')]['id']){delete _0x21aef5[_0x840a('0x41')]['id'];}return db[_0x840a('0x3a')][_0x840a('0x42')]({'where':{'id':_0x21aef5[_0x840a('0x43')]['id']}})['then'](handleEntityNotFound(_0x58d100,null))[_0x840a('0x1f')](saveUpdates(_0x21aef5[_0x840a('0x41')],null))[_0x840a('0x1f')](respondWithResult(_0x58d100,null))[_0x840a('0x3d')](handleError(_0x58d100,null));};exports[_0x840a('0x44')]=function(_0x30ca8d,_0x15e181){return db['SmsApplication'][_0x840a('0x42')]({'where':{'id':_0x30ca8d[_0x840a('0x43')]['id']}})[_0x840a('0x1f')](handleEntityNotFound(_0x15e181,null))[_0x840a('0x1f')](removeEntity(_0x15e181,null))[_0x840a('0x3d')](handleError(_0x15e181,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1871277..6c24271 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 _0xccf3=['sms_applications','util','api','moment','bluebird','request-promise','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x2c484d,_0x581681){var _0x3a517b=function(_0x2568b0){while(--_0x2568b0){_0x2c484d['push'](_0x2c484d['shift']());}};_0x3a517b(++_0x581681);}(_0xccf3,0x19b));var _0x3ccf=function(_0x241ed1,_0x15d94c){_0x241ed1=_0x241ed1-0x0;var _0xe48833=_0xccf3[_0x241ed1];return _0xe48833;};'use strict';var _=require('lodash');var util=require(_0x3ccf('0x0'));var logger=require('../../config/logger')(_0x3ccf('0x1'));var moment=require(_0x3ccf('0x2'));var BPromise=require(_0x3ccf('0x3'));var rp=require(_0x3ccf('0x4'));var attributes=require(_0x3ccf('0x5'));module[_0x3ccf('0x6')]=function(_0xc07749,_0x479716){return _0xc07749[_0x3ccf('0x7')](_0x3ccf('0x8'),attributes,{'tableName':_0x3ccf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe04f=['api','bluebird','request-promise','./smsApplication.attributes','exports','SmsApplication','lodash','util','../../config/logger'];(function(_0x3930d5,_0x344ece){var _0x3aa81e=function(_0x1cca2b){while(--_0x1cca2b){_0x3930d5['push'](_0x3930d5['shift']());}};_0x3aa81e(++_0x344ece);}(_0xe04f,0xf0));var _0xfe04=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xe04f[_0x2112d4];return _0x434972;};'use strict';var _=require(_0xfe04('0x0'));var util=require(_0xfe04('0x1'));var logger=require(_0xfe04('0x2'))(_0xfe04('0x3'));var moment=require('moment');var BPromise=require(_0xfe04('0x4'));var rp=require(_0xfe04('0x5'));var attributes=require(_0xfe04('0x6'));module[_0xfe04('0x7')]=function(_0x26aec8,_0x54ae01){return _0x26aec8['define'](_0xfe04('0x8'),attributes,{'tableName':'sms_applications','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 8dc6725..4f8250d 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 _0x12aa=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x4ddf8d,_0x5d1f75){var _0xb70c4a=function(_0x48ab0){while(--_0x48ab0){_0x4ddf8d['push'](_0x4ddf8d['shift']());}};_0xb70c4a(++_0x5d1f75);}(_0x12aa,0x86));var _0xa12a=function(_0x374e9e,_0x5270ad){_0x374e9e=_0x374e9e-0x0;var _0x538674=_0x12aa[_0x374e9e];return _0x538674;};'use strict';var _=require(_0xa12a('0x0'));var util=require(_0xa12a('0x1'));var moment=require(_0xa12a('0x2'));var BPromise=require(_0xa12a('0x3'));var rs=require(_0xa12a('0x4'));var fs=require('fs');var Redis=require(_0xa12a('0x5'));var db=require(_0xa12a('0x6'))['db'];var utils=require(_0xa12a('0x7'));var logger=require(_0xa12a('0x8'))(_0xa12a('0x9'));var config=require(_0xa12a('0xa'));var jayson=require(_0xa12a('0xb'));var client=jayson[_0xa12a('0xc')][_0xa12a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5a2878,_0x4508bd,_0x554a28){return new BPromise(function(_0x1e93b7,_0x15e0ce){return client['request'](_0x5a2878,_0x554a28)[_0xa12a('0xe')](function(_0x511061){logger[_0xa12a('0xf')](_0xa12a('0x10'),_0x4508bd,_0xa12a('0x11'));logger[_0xa12a('0x12')](_0xa12a('0x13'),_0x4508bd,_0xa12a('0x11'),JSON[_0xa12a('0x14')](_0x511061));if(_0x511061['error']){if(_0x511061['error'][_0xa12a('0x15')]===0x1f4){logger[_0xa12a('0x16')](_0xa12a('0x10'),_0x4508bd,_0x511061[_0xa12a('0x16')][_0xa12a('0x17')]);return _0x15e0ce(_0x511061[_0xa12a('0x16')]['message']);}logger[_0xa12a('0x16')](_0xa12a('0x10'),_0x4508bd,_0x511061['error'][_0xa12a('0x17')]);return _0x1e93b7(_0x511061[_0xa12a('0x16')]['message']);}else{logger[_0xa12a('0xf')](_0xa12a('0x10'),_0x4508bd,_0xa12a('0x11'));_0x1e93b7(_0x511061['result'][_0xa12a('0x17')]);}})[_0xa12a('0x18')](function(_0x2902c5){logger[_0xa12a('0x16')](_0xa12a('0x10'),_0x4508bd,_0x2902c5);_0x15e0ce(_0x2902c5);});});} \ No newline at end of file +var _0xd161=['message','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd161,0x1a7));var _0x1d16=function(_0x25c0e2,_0x163139){_0x25c0e2=_0x25c0e2-0x0;var _0x23da84=_0xd161[_0x25c0e2];return _0x23da84;};'use strict';var _=require(_0x1d16('0x0'));var util=require(_0x1d16('0x1'));var moment=require('moment');var BPromise=require(_0x1d16('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d16('0x3'));var db=require(_0x1d16('0x4'))['db'];var utils=require(_0x1d16('0x5'));var logger=require(_0x1d16('0x6'))('rpc');var config=require(_0x1d16('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d16('0x8')][_0x1d16('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f8750,_0x296d3a,_0x1c42ea){return new BPromise(function(_0x3d8391,_0x5de522){return client[_0x1d16('0xa')](_0x3f8750,_0x1c42ea)[_0x1d16('0xb')](function(_0x57d15d){logger['info'](_0x1d16('0xc'),_0x296d3a,'request\x20sent');logger[_0x1d16('0xd')](_0x1d16('0xe'),_0x296d3a,_0x1d16('0xf'),JSON['stringify'](_0x57d15d));if(_0x57d15d['error']){if(_0x57d15d[_0x1d16('0x10')][_0x1d16('0x11')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x296d3a,_0x57d15d[_0x1d16('0x10')]['message']);return _0x5de522(_0x57d15d[_0x1d16('0x10')]['message']);}logger[_0x1d16('0x10')](_0x1d16('0xc'),_0x296d3a,_0x57d15d['error'][_0x1d16('0x12')]);return _0x3d8391(_0x57d15d['error'][_0x1d16('0x12')]);}else{logger[_0x1d16('0x13')](_0x1d16('0xc'),_0x296d3a,_0x1d16('0xf'));_0x3d8391(_0x57d15d['result']['message']);}})[_0x1d16('0x14')](function(_0x2706cd){logger[_0x1d16('0x10')](_0x1d16('0xc'),_0x296d3a,_0x2706cd);_0x5de522(_0x2706cd);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7d3d75f..523e345 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 _0xb96b=['post','addMessage','sms','smsinteraction:addtags','addTags','tracked','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','create'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb96b,0x1df));var _0xbb96=function(_0x3703eb,_0x1c7cde){_0x3703eb=_0x3703eb-0x0;var _0x190bdc=_0xb96b[_0x3703eb];return _0x190bdc;};'use strict';var multer=require(_0xbb96('0x0'));var util=require('util');var path=require(_0xbb96('0x1'));var timeout=require('connect-timeout');var express=require(_0xbb96('0x2'));var router=express['Router']();var auth=require(_0xbb96('0x3'));var interaction=require(_0xbb96('0x4'));var config=require(_0xbb96('0x5'));var controller=require(_0xbb96('0x6'));router[_0xbb96('0x7')]('/',auth[_0xbb96('0x8')](),controller[_0xbb96('0x9')]);router[_0xbb96('0x7')]('/describe',auth[_0xbb96('0x8')](),controller[_0xbb96('0xa')]);router['get'](_0xbb96('0xb'),auth[_0xbb96('0x8')](),controller['show']);router[_0xbb96('0x7')](_0xbb96('0xc'),auth['isAuthenticated'](),controller[_0xbb96('0xd')]);router[_0xbb96('0x7')](_0xbb96('0xe'),auth[_0xbb96('0x8')](),controller[_0xbb96('0xf')]);router['post']('/',auth[_0xbb96('0x8')](),controller[_0xbb96('0x10')]);router[_0xbb96('0x11')](_0xbb96('0xc'),auth[_0xbb96('0x8')](),controller[_0xbb96('0x12')]);router['post']('/:id/tags',auth[_0xbb96('0x8')](),interaction['tracked'](_0xbb96('0x13'),_0xbb96('0x14')),controller[_0xbb96('0x15')]);router['put'](_0xbb96('0xb'),auth[_0xbb96('0x8')](),interaction[_0xbb96('0x16')](_0xbb96('0x13'),_0xbb96('0x17')),controller[_0xbb96('0x18')]);router[_0xbb96('0x19')](_0xbb96('0xb'),auth[_0xbb96('0x8')](),interaction[_0xbb96('0x16')]('sms',_0xbb96('0x1a')),controller[_0xbb96('0x1b')]);router[_0xbb96('0x19')](_0xbb96('0x1c'),auth[_0xbb96('0x8')](),controller[_0xbb96('0x1d')]);module[_0xbb96('0x1e')]=router; \ No newline at end of file +var _0xed69=['getMessages','/:id/download','download','post','addMessage','tracked','sms','smsinteraction:addtags','put','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages'];(function(_0x4cab9a,_0x40f213){var _0x3509ae=function(_0x33f17f){while(--_0x33f17f){_0x4cab9a['push'](_0x4cab9a['shift']());}};_0x3509ae(++_0x40f213);}(_0xed69,0x8c));var _0x9ed6=function(_0xd1a252,_0x16396f){_0xd1a252=_0xd1a252-0x0;var _0x560ee1=_0xed69[_0xd1a252];return _0x560ee1;};'use strict';var multer=require(_0x9ed6('0x0'));var util=require(_0x9ed6('0x1'));var path=require(_0x9ed6('0x2'));var timeout=require(_0x9ed6('0x3'));var express=require(_0x9ed6('0x4'));var router=express['Router']();var auth=require(_0x9ed6('0x5'));var interaction=require(_0x9ed6('0x6'));var config=require('../../config/environment');var controller=require(_0x9ed6('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9ed6('0x8')](_0x9ed6('0x9'),auth[_0x9ed6('0xa')](),controller[_0x9ed6('0xb')]);router[_0x9ed6('0x8')](_0x9ed6('0xc'),auth['isAuthenticated'](),controller[_0x9ed6('0xd')]);router['get'](_0x9ed6('0xe'),auth['isAuthenticated'](),controller[_0x9ed6('0xf')]);router[_0x9ed6('0x8')](_0x9ed6('0x10'),auth[_0x9ed6('0xa')](),controller[_0x9ed6('0x11')]);router['post']('/',auth[_0x9ed6('0xa')](),controller['create']);router[_0x9ed6('0x12')](_0x9ed6('0xe'),auth[_0x9ed6('0xa')](),controller[_0x9ed6('0x13')]);router[_0x9ed6('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x9ed6('0x14')](_0x9ed6('0x15'),_0x9ed6('0x16')),controller['addTags']);router[_0x9ed6('0x17')]('/:id',auth[_0x9ed6('0xa')](),interaction['tracked']('sms','smsinteraction:update'),controller[_0x9ed6('0x18')]);router[_0x9ed6('0x19')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x9ed6('0x15'),_0x9ed6('0x1a')),controller[_0x9ed6('0x1b')]);router[_0x9ed6('0x19')](_0x9ed6('0x1c'),auth[_0x9ed6('0xa')](),controller[_0x9ed6('0x1d')]);module[_0x9ed6('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f091e55..57247da 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 _0x6d6d=['DATE','STRING','out','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d6d,0x12c));var _0xd6d6=function(_0xe4076c,_0x5b67bd){_0xe4076c=_0xe4076c-0x0;var _0x401026=_0x6d6d[_0xe4076c];return _0x401026;};'use strict';var Sequelize=require(_0xd6d6('0x0'));var moment=require(_0xd6d6('0x1'));module[_0xd6d6('0x2')]={'closed':{'type':Sequelize[_0xd6d6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd6d6('0x4')]},'disposition':{'type':Sequelize[_0xd6d6('0x5')]},'note':{'type':Sequelize[_0xd6d6('0x5')]},'phone':{'type':Sequelize[_0xd6d6('0x5')]},'read1stAt':{'type':Sequelize[_0xd6d6('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd6d6('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xd6d6('0x7')]('in',_0xd6d6('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x1ced=['ENUM','out','sequelize','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1ced,0x1ea));var _0xd1ce=function(_0x1c71cd,_0x4b696a){_0x1c71cd=_0x1c71cd-0x0;var _0x505500=_0x1ced[_0x1c71cd];return _0x505500;};'use strict';var Sequelize=require(_0xd1ce('0x0'));var moment=require(_0xd1ce('0x1'));module[_0xd1ce('0x2')]={'closed':{'type':Sequelize[_0xd1ce('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd1ce('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd1ce('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xd1ce('0x6')]('in',_0xd1ce('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd1ce('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xd1ce('0x6')]('in',_0xd1ce('0x7')),'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 cc90300..e74caa8 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 _0xd734=['path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','error','stack','name','index','SmsInteraction','rawAttributes','model','keys','query','dateEnd','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','dateStart','add','merge','filter','map','include','tag','push','Tag','distinct','read','SmsMessage','Messages','direction','createdAt','count','Users','fullname','CmContact','Contact','User','Owner','internal','SmsAccount','Account','Tags','color','findAll','show','params','includeAll','options','catch','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','order','$gte','split','format','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','root','attachments','join','Letter','mkdirSync','

Sms\x20Interaction:\x20#%d

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

','','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x37adf3,_0x362014){var _0x33bb1b=function(_0xdd079e){while(--_0xdd079e){_0x37adf3['push'](_0x37adf3['shift']());}};_0x33bb1b(++_0x362014);}(_0xd734,0xf7));var _0x4d73=function(_0xd34c25,_0x257421){_0xd34c25=_0xd34c25-0x0;var _0x4d4cd7=_0xd734[_0xd34c25];return _0x4d4cd7;};'use strict';var pdf=require(_0x4d73('0x0'));var emlformat=require(_0x4d73('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d73('0x2'));var jsonpatch=require(_0x4d73('0x3'));var rp=require(_0x4d73('0x4'));var moment=require(_0x4d73('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4d73('0x6'));var path=require(_0x4d73('0x7'));var sox=require(_0x4d73('0x8'));var csv=require(_0x4d73('0x9'));var ejs=require(_0x4d73('0xa'));var fs=require('fs');var _=require(_0x4d73('0xb'));var squel=require(_0x4d73('0xc'));var crypto=require(_0x4d73('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4d73('0xe'));var toCsv=require(_0x4d73('0x9'));var querystring=require('querystring');var Papa=require(_0x4d73('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x4d73('0x10'))(_0x4d73('0x11'));var utils=require(_0x4d73('0x12'));var config=require('../../config/environment');var db=require(_0x4d73('0x13'))['db'];config[_0x4d73('0x14')]=_['defaults'](config[_0x4d73('0x14')],{'host':_0x4d73('0x15'),'port':0x18eb});var socket=require(_0x4d73('0x16'))(new Redis(config[_0x4d73('0x14')]));require('./smsInteraction.socket')[_0x4d73('0x17')](socket);function respondWithStatusCode(_0x4d8ab1,_0x133649){_0x133649=_0x133649||0xcc;return function(_0x11fe2e){if(_0x11fe2e){return _0x4d8ab1[_0x4d73('0x18')](_0x133649);}return _0x4d8ab1[_0x4d73('0x19')](_0x133649)[_0x4d73('0x1a')]();};}function respondWithResult(_0x11f2be,_0xf69639){_0xf69639=_0xf69639||0xc8;return function(_0x134693){if(_0x134693){return _0x11f2be['status'](_0xf69639)[_0x4d73('0x1b')](_0x134693);}};}function respondWithFilteredResult(_0x433e55,_0x36d983){return function(_0x2531ef){if(_0x2531ef){var _0x34e9a6=_0x2531ef['count'],_0x3ad613=_0x36d983[_0x4d73('0x1c')],_0x52fcf2=_0x36d983[_0x4d73('0x1c')]+_0x36d983[_0x4d73('0x1d')],_0x43f14e;if(_0x52fcf2>=_0x34e9a6){_0x52fcf2=_0x34e9a6;_0x43f14e=0xc8;}else{_0x43f14e=0xce;}_0x433e55[_0x4d73('0x19')](_0x43f14e);return _0x433e55[_0x4d73('0x1e')](_0x4d73('0x1f'),_0x3ad613+'-'+_0x52fcf2+'/'+_0x34e9a6)[_0x4d73('0x1b')](_0x2531ef);}return null;};}function patchUpdates(_0x42014c){return function(_0x226745){try{jsonpatch['apply'](_0x226745,_0x42014c,!![]);}catch(_0x4bb1c9){return BPromise[_0x4d73('0x20')](_0x4bb1c9);}return _0x226745['save']();};}function saveUpdates(_0x10ba89,_0x37a7be){return function(_0x149975){if(_0x149975){return _0x149975[_0x4d73('0x21')](_0x10ba89)['then'](function(_0x4316c9){return _0x4316c9;});}return null;};}function removeEntity(_0x5bb924,_0x24be4e){return function(_0x41f0c7){if(_0x41f0c7){return _0x41f0c7['destroy']()[_0x4d73('0x22')](function(){_0x5bb924[_0x4d73('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32dc26,_0x3cb391){return function(_0x382a3e){if(!_0x382a3e){_0x32dc26[_0x4d73('0x18')](0x194);}return _0x382a3e;};}function handleError(_0x3e92a2,_0x5bb6e3){_0x5bb6e3=_0x5bb6e3||0x1f4;return function(_0x490dd4){logger[_0x4d73('0x23')](_0x490dd4[_0x4d73('0x24')]);if(_0x490dd4[_0x4d73('0x25')]){delete _0x490dd4[_0x4d73('0x25')];}_0x3e92a2[_0x4d73('0x19')](_0x5bb6e3)['send'](_0x490dd4);};}exports[_0x4d73('0x26')]=function(_0x312bef,_0x1938e7){var _0x3368ef={},_0x497e56={},_0x52b73b={'count':0x0,'rows':[]};var _0x5a6885=db[_0x4d73('0x27')][_0x4d73('0x28')];_0x497e56[_0x4d73('0x29')]=_[_0x4d73('0x2a')](_0x5a6885);var _0x4bca36={'dateStart':_0x312bef[_0x4d73('0x2b')]['dateStart'],'dateEnd':_0x312bef['query'][_0x4d73('0x2c')]};delete _0x312bef[_0x4d73('0x2b')]['dateStart'];delete _0x312bef[_0x4d73('0x2b')][_0x4d73('0x2c')];_0x497e56[_0x4d73('0x2b')]=_['keys'](_0x312bef[_0x4d73('0x2b')]);_0x497e56[_0x4d73('0x2d')]=_['intersection'](_0x497e56[_0x4d73('0x29')],_0x497e56[_0x4d73('0x2b')]);_0x3368ef[_0x4d73('0x2e')]=_[_0x4d73('0x2f')](_0x497e56['model'],qs[_0x4d73('0x30')](_0x312bef[_0x4d73('0x2b')][_0x4d73('0x30')]));_0x3368ef[_0x4d73('0x2e')]=_0x3368ef[_0x4d73('0x2e')]['length']?_0x3368ef[_0x4d73('0x2e')]:_0x497e56[_0x4d73('0x29')];if(!_0x312bef[_0x4d73('0x2b')][_0x4d73('0x31')](_0x4d73('0x32'))){_0x3368ef[_0x4d73('0x1d')]=qs[_0x4d73('0x1d')](_0x312bef[_0x4d73('0x2b')][_0x4d73('0x1d')]);_0x3368ef['offset']=qs[_0x4d73('0x1c')](_0x312bef['query'][_0x4d73('0x1c')]);}_0x3368ef['order']=qs[_0x4d73('0x33')](_0x312bef['query'][_0x4d73('0x33')]);_0x3368ef[_0x4d73('0x34')]=qs['filters'](_[_0x4d73('0x35')](_0x312bef['query'],_0x497e56['filters']));if(_0x4bca36[_0x4d73('0x36')]){if(_0x4bca36[_0x4d73('0x2c')]){_0x4bca36[_0x4d73('0x2c')]=moment(_0x4bca36[_0x4d73('0x2c')])[_0x4d73('0x37')](0x1,'day');}else{_0x4bca36[_0x4d73('0x2c')]=moment(_0x4bca36[_0x4d73('0x36')])['add'](0x1,'day');}_[_0x4d73('0x38')](_0x3368ef['where'],{'createdAt':{'$gte':_0x4bca36[_0x4d73('0x36')],'$lte':_0x4bca36[_0x4d73('0x2c')]}});}if(_0x312bef[_0x4d73('0x2b')][_0x4d73('0x39')]){_0x3368ef[_0x4d73('0x34')]=_['merge'](_0x3368ef[_0x4d73('0x34')],{'$or':_[_0x4d73('0x3a')](_0x3368ef['attributes'],function(_0x264453){var _0x46f591={};_0x46f591[_0x264453]={'$like':'%'+_0x312bef[_0x4d73('0x2b')][_0x4d73('0x39')]+'%'};return _0x46f591;})});}_0x3368ef=_[_0x4d73('0x38')]({},_0x3368ef,_0x312bef['options']);var _0x59f8e7={'where':_0x3368ef['where']};_0x59f8e7[_0x4d73('0x3b')]=[];if(_0x312bef['query'][_0x4d73('0x3c')]){_0x59f8e7[_0x4d73('0x3b')][_0x4d73('0x3d')]({'model':db[_0x4d73('0x3e')],'as':'Tags','attributes':['id'],'where':{'id':_0x312bef[_0x4d73('0x2b')][_0x4d73('0x3c')]},'required':!![]});_0x59f8e7[_0x4d73('0x3f')]=!![];}if(_0x312bef[_0x4d73('0x2b')][_0x4d73('0x40')]){_0x59f8e7[_0x4d73('0x3b')]['push']({'model':db[_0x4d73('0x41')],'as':_0x4d73('0x42'),'attributes':['id',_0x4d73('0x43'),_0x4d73('0x44'),_0x4d73('0x40')],'where':{'direction':'in','read':_0x312bef[_0x4d73('0x2b')][_0x4d73('0x40')]||![]},'required':!![]});_0x59f8e7[_0x4d73('0x3f')]=!![];}return db[_0x4d73('0x27')][_0x4d73('0x45')](_0x59f8e7)[_0x4d73('0x22')](function(_0x3dd275){_0x52b73b[_0x4d73('0x45')]=_0x3dd275;if(_0x312bef[_0x4d73('0x2b')]['includeAll']){_0x3368ef[_0x4d73('0x3b')]=[{'model':db['User'],'as':_0x4d73('0x46'),'required':![],'attributes':['id',_0x4d73('0x25'),_0x4d73('0x47')]},{'model':db[_0x4d73('0x48')],'as':_0x4d73('0x49'),'required':![]},{'model':db[_0x4d73('0x4a')],'as':_0x4d73('0x4b'),'attributes':[_0x4d73('0x25'),_0x4d73('0x47'),_0x4d73('0x4c')],'required':![]},{'model':db[_0x4d73('0x4d')],'as':_0x4d73('0x4e'),'attributes':[_0x4d73('0x25'),'key'],'required':![]},{'model':db[_0x4d73('0x41')],'as':_0x4d73('0x42'),'attributes':['id','direction','createdAt',_0x4d73('0x40')],'where':{'direction':'in','read':_0x312bef['query'][_0x4d73('0x40')]||![]},'required':_0x312bef[_0x4d73('0x2b')]['read']||![]},{'model':db[_0x4d73('0x3e')],'as':_0x4d73('0x4f'),'attributes':['id',_0x4d73('0x25'),_0x4d73('0x50')],'required':_0x312bef['query'][_0x4d73('0x3c')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0x4d73('0x25'),'color'],'through':_0x312bef[_0x4d73('0x2b')][_0x4d73('0x3c')]?{'attributes':[],'where':{'TagId':_0x312bef[_0x4d73('0x2b')][_0x4d73('0x3c')]||undefined}}:{},'required':_0x312bef[_0x4d73('0x2b')]['tag']?!![]:![]}];}return db[_0x4d73('0x27')][_0x4d73('0x51')](_0x3368ef);})[_0x4d73('0x22')](function(_0x511512){_0x52b73b['rows']=_0x511512;return _0x52b73b;})[_0x4d73('0x22')](respondWithFilteredResult(_0x1938e7,_0x3368ef))['catch'](handleError(_0x1938e7,null));};exports[_0x4d73('0x52')]=function(_0x215446,_0xba9cbc){var _0x5a0a6a={'raw':![],'where':{'id':_0x215446[_0x4d73('0x53')]['id']}},_0x2ae90d={};_0x2ae90d[_0x4d73('0x29')]=_[_0x4d73('0x2a')](db[_0x4d73('0x27')]['rawAttributes']);_0x2ae90d[_0x4d73('0x2b')]=_['keys'](_0x215446[_0x4d73('0x2b')]);_0x2ae90d[_0x4d73('0x2d')]=_['intersection'](_0x2ae90d[_0x4d73('0x29')],_0x2ae90d[_0x4d73('0x2b')]);_0x5a0a6a[_0x4d73('0x2e')]=_['intersection'](_0x2ae90d['model'],qs[_0x4d73('0x30')](_0x215446[_0x4d73('0x2b')]['fields']));_0x5a0a6a['attributes']=_0x5a0a6a[_0x4d73('0x2e')]['length']?_0x5a0a6a[_0x4d73('0x2e')]:_0x2ae90d[_0x4d73('0x29')];if(_0x215446[_0x4d73('0x2b')][_0x4d73('0x54')]){_0x5a0a6a[_0x4d73('0x3b')]=[{'all':!![]}];}_0x5a0a6a=_['merge']({},_0x5a0a6a,_0x215446[_0x4d73('0x55')]);return db[_0x4d73('0x27')]['find'](_0x5a0a6a)[_0x4d73('0x22')](handleEntityNotFound(_0xba9cbc,null))[_0x4d73('0x22')](respondWithResult(_0xba9cbc,null))[_0x4d73('0x56')](handleError(_0xba9cbc,null));};exports[_0x4d73('0x57')]=function(_0x51f0df,_0x3dff6e){return db[_0x4d73('0x27')][_0x4d73('0x57')](_0x51f0df[_0x4d73('0x58')],{})['then'](respondWithResult(_0x3dff6e,0xc9))['catch'](handleError(_0x3dff6e,null));};exports[_0x4d73('0x21')]=function(_0x4748ac,_0x2371b1){if(_0x4748ac[_0x4d73('0x58')]['id']){delete _0x4748ac[_0x4d73('0x58')]['id'];}return db[_0x4d73('0x27')][_0x4d73('0x59')]({'where':{'id':_0x4748ac[_0x4d73('0x53')]['id']}})[_0x4d73('0x22')](handleEntityNotFound(_0x2371b1,null))[_0x4d73('0x22')](saveUpdates(_0x4748ac[_0x4d73('0x58')],null))[_0x4d73('0x22')](respondWithResult(_0x2371b1,null))['catch'](handleError(_0x2371b1,null));};exports['destroy']=function(_0x5781fa,_0x562612){return db[_0x4d73('0x27')][_0x4d73('0x59')]({'where':{'id':_0x5781fa[_0x4d73('0x53')]['id']}})[_0x4d73('0x22')](handleEntityNotFound(_0x562612,null))[_0x4d73('0x22')](removeEntity(_0x562612,null))[_0x4d73('0x56')](handleError(_0x562612,null));};exports[_0x4d73('0x5a')]=function(_0x497580,_0x4153bb){return db[_0x4d73('0x27')]['describe']()[_0x4d73('0x22')](respondWithResult(_0x4153bb,null))[_0x4d73('0x56')](handleError(_0x4153bb,null));};exports[_0x4d73('0x5b')]=function(_0x2f8a89,_0x2ed8ee,_0x2429b2){return db[_0x4d73('0x41')]['find']({'where':{'id':_0x2f8a89['params']['id']}})['then'](handleEntityNotFound(_0x2ed8ee,null))['then'](function(_0x15146e){if(_0x15146e){return _0x15146e[_0x4d73('0x5b')](_0x2f8a89['body'][_0x4d73('0x5c')],_[_0x4d73('0x5d')](_0x2f8a89['body'],[_0x4d73('0x5c'),'id'])||{});}})[_0x4d73('0x22')](respondWithResult(_0x2ed8ee,null))[_0x4d73('0x56')](handleError(_0x2ed8ee,null));};exports[_0x4d73('0x5e')]=function(_0x3e7193,_0x26f817,_0xe2102){var _0x4539ef={'raw':![],'where':{}};var _0x263737={};var _0x380336={'count':0x0,'rows':[]};return db[_0x4d73('0x27')][_0x4d73('0x5f')]({'where':{'id':_0x3e7193[_0x4d73('0x53')]['id']}})[_0x4d73('0x22')](handleEntityNotFound(_0x26f817,null))[_0x4d73('0x22')](function(_0x43f9b0){if(_0x43f9b0){_0x263737['model']=_[_0x4d73('0x2a')](db[_0x4d73('0x41')]['rawAttributes']);_0x263737[_0x4d73('0x2b')]=_[_0x4d73('0x2a')](_0x3e7193['query']);_0x263737['filters']=_[_0x4d73('0x2f')](_0x263737[_0x4d73('0x29')],_0x263737[_0x4d73('0x2b')]);_0x4539ef[_0x4d73('0x2e')]=_[_0x4d73('0x2f')](_0x263737['model'],qs[_0x4d73('0x30')](_0x3e7193['query'][_0x4d73('0x30')]));_0x4539ef[_0x4d73('0x2e')]=_0x4539ef[_0x4d73('0x2e')]['length']?_0x4539ef[_0x4d73('0x2e')]:_0x263737['model'];if(!_0x3e7193['query']['hasOwnProperty'](_0x4d73('0x32'))){_0x4539ef[_0x4d73('0x1d')]=qs[_0x4d73('0x1d')](_0x3e7193[_0x4d73('0x2b')][_0x4d73('0x1d')]);_0x4539ef[_0x4d73('0x1c')]=qs[_0x4d73('0x1c')](_0x3e7193[_0x4d73('0x2b')][_0x4d73('0x1c')]);}_0x4539ef[_0x4d73('0x60')]=qs['sort'](_0x3e7193['query'][_0x4d73('0x33')]);_0x4539ef[_0x4d73('0x34')]=qs[_0x4d73('0x2d')](_[_0x4d73('0x35')](_0x3e7193[_0x4d73('0x2b')],_0x263737['filters']));_0x4539ef['where']['SmsInteractionId']=_0x43f9b0['id'];if(_0x3e7193[_0x4d73('0x2b')]['filter']){_0x4539ef['where']=_['merge'](_0x4539ef['where'],{'$or':_[_0x4d73('0x3a')](_0x4539ef[_0x4d73('0x2e')],function(_0x291880){var _0x4ba5a3={};_0x4ba5a3[_0x291880]={'$like':'%'+_0x3e7193[_0x4d73('0x2b')][_0x4d73('0x39')]+'%'};return _0x4ba5a3;})});}if(_0x3e7193['query'][_0x4d73('0x61')]){var _0x33a242=_0x3e7193[_0x4d73('0x2b')]['$gte'][_0x4d73('0x62')](',');var _0x314cd3={};_0x314cd3[_0x33a242[0x0]]={'$gte':moment(_0x33a242[0x1])[_0x4d73('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4539ef[_0x4d73('0x34')]=_['merge'](_0x4539ef[_0x4d73('0x34')],_0x314cd3);}_0x4539ef=_[_0x4d73('0x38')]({},_0x4539ef,_0x3e7193[_0x4d73('0x55')]);return db[_0x4d73('0x41')]['count']({'where':_0x4539ef[_0x4d73('0x34')]})[_0x4d73('0x22')](function(_0xa02468){_0x380336[_0x4d73('0x45')]=_0xa02468;if(_0x3e7193[_0x4d73('0x2b')][_0x4d73('0x54')]){_0x4539ef['include']=[{'all':!![]}];}return db[_0x4d73('0x41')][_0x4d73('0x51')](_0x4539ef);})[_0x4d73('0x22')](function(_0x11fcdb){_0x380336['rows']=_0x11fcdb;return _0x380336;});}})[_0x4d73('0x22')](respondWithFilteredResult(_0x26f817,_0x4539ef))[_0x4d73('0x56')](handleError(_0x26f817,null));};exports['addTags']=function(_0x21ee93,_0x433ff9,_0x4e6faf){return db['SmsInteraction']['find']({'where':{'id':_0x21ee93[_0x4d73('0x53')]['id']}})[_0x4d73('0x22')](handleEntityNotFound(_0x433ff9,null))['then'](function(_0xa60dd4){if(_0xa60dd4){return _0xa60dd4[_0x4d73('0x64')](_0x21ee93[_0x4d73('0x58')][_0x4d73('0x5c')],_[_0x4d73('0x5d')](_0x21ee93[_0x4d73('0x58')],['ids','id'])||{})[_0x4d73('0x65')](function(){return db[_0x4d73('0x3e')][_0x4d73('0x51')]({'attributes':['id','name',_0x4d73('0x50')],'where':{'id':_0x21ee93['body'][_0x4d73('0x5c')]}});})[_0x4d73('0x22')](function(_0x294fa5){socket[_0x4d73('0x66')](_0x4d73('0x67'),{'id':Number(_0x21ee93[_0x4d73('0x53')]['id']),'tags':_0x294fa5||[]});return{'id':Number(_0x21ee93[_0x4d73('0x53')]['id']),'tags':_0x294fa5||[]};});}})[_0x4d73('0x22')](respondWithResult(_0x433ff9,null))['catch'](handleError(_0x433ff9,null));};exports['removeTags']=function(_0x4b8007,_0x3fec53,_0xd7d604){var _0x372377;return db[_0x4d73('0x27')][_0x4d73('0x59')]({'where':{'id':_0x4b8007[_0x4d73('0x53')]['id']}})[_0x4d73('0x22')](handleEntityNotFound(_0x3fec53,null))['then'](function(_0x2cd143){if(_0x2cd143){return _0x2cd143[_0x4d73('0x68')](_0x4b8007[_0x4d73('0x2b')][_0x4d73('0x5c')]);}})[_0x4d73('0x22')](respondWithStatusCode(_0x3fec53,null))[_0x4d73('0x56')](handleError(_0x3fec53,null));};exports[_0x4d73('0x69')]=function(_0x531e75,_0x2c3be1){var _0x93f5e4=moment()[_0x4d73('0x6a')]()[_0x4d73('0x6b')]();var _0x1af57e=path['join'](config['root'],_0x4d73('0x6c'),_0x4d73('0x6d'),_0x4d73('0x6e'));var _0x37f233=path['join'](config[_0x4d73('0x6f')],'server',_0x4d73('0x6d'),_0x4d73('0x70'));var _0x26df18=path['join'](_0x1af57e,_0x93f5e4);var _0x3e85ee=util[_0x4d73('0x63')]('interaction-%s.zip',_0x93f5e4);var _0x59b305=path[_0x4d73('0x71')](_0x1af57e,_0x3e85ee);var _0xde198f=![];return db[_0x4d73('0x27')]['find']({'where':{'id':_0x531e75[_0x4d73('0x53')]['id']},'include':[{'model':db[_0x4d73('0x41')],'as':_0x4d73('0x42'),'attributes':['id',_0x4d73('0x58')],'include':[{'model':db['User'],'as':_0x4d73('0x4a'),'attributes':['id',_0x4d73('0x47')],'raw':!![]},{'model':db[_0x4d73('0x48')],'as':_0x4d73('0x49'),'attributes':['id','firstName'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2c3be1,null))['then'](function(_0x4161c4){if(_0x4161c4){_0xde198f=!![];var _0x5e798e='';var _0x30623d={'format':_0x4d73('0x72'),'border':'1cm'};fs[_0x4d73('0x73')](_0x26df18);_0x5e798e+=util[_0x4d73('0x63')](_0x4d73('0x74'),_0x4161c4['id']);_0x5e798e+=util[_0x4d73('0x63')]('

Date:\x20%s

',moment()['format'](_0x4d73('0x75'))[_0x4d73('0x6b')]());_0x5e798e+='
';for(var _0x602c0d=0x0;_0x602c0d<_0x4161c4[_0x4d73('0x42')][_0x4d73('0x76')];_0x602c0d++){var _0xd43fe7=_0x4161c4[_0x4d73('0x42')][_0x602c0d];_0x5e798e+=_0x4d73('0x77');_0x5e798e+=util[_0x4d73('0x63')](_0x4d73('0x78'),_0xd43fe7[_0x4d73('0x4a')]?_0xd43fe7[_0x4d73('0x4a')]['fullname']:_0xd43fe7[_0x4d73('0x49')]['firstName'],_0xd43fe7[_0x4d73('0x58')]);_0x5e798e+=_0x4d73('0x79');}return new BPromise(function(_0x592107,_0x3c396f){pdf[_0x4d73('0x57')](_0x5e798e,_0x30623d)[_0x4d73('0x7a')](path[_0x4d73('0x71')](_0x26df18,'interaction-'+_0x93f5e4+_0x4d73('0x7b')),function(_0x4874c2,_0x1541f9){if(_0x4874c2)return _0x3c396f(_0x4874c2);_0x592107(_0x1541f9);});});}})[_0x4d73('0x22')](function(){if(_0xde198f){return new BPromise(function(_0x10a293,_0x49d8c8){zipdir(_0x26df18,{'saveTo':_0x59b305},function(_0x30975e,_0x4f4c89){if(_0x30975e)return _0x49d8c8(_0x30975e);return _0x10a293(_0x4f4c89);});});}})['then'](function(){if(_0xde198f){return new BPromise(function(_0x3fca1e,_0x435716){rimraf(_0x26df18,function(_0x2e1a7d){if(_0x2e1a7d)_0x435716(_0x2e1a7d);return _0x3fca1e();});});}})['then'](function(){if(_0xde198f){return _0x2c3be1[_0x4d73('0x69')](_0x59b305,_0x3e85ee,function(_0x32251f){if(_0x32251f){console[_0x4d73('0x7c')](_0x4d73('0x7d'),_0x32251f);}else{fs[_0x4d73('0x7e')](_0x59b305);}});}else{return _0x2c3be1[_0x4d73('0x18')](0xc8);}})['catch'](handleError(_0x2c3be1,null));}; \ No newline at end of file +var _0xbd7e=['map','options','include','tag','push','Tags','distinct','read','SmsMessage','Messages','direction','createdAt','User','fullname','CmContact','Contact','Owner','internal','key','Tag','color','ThroughTags','SmsInteraction','rows','catch','show','params','length','includeAll','create','body','update','find','describe','addMessage','omit','getMessages','SmsInteractionId','$gte','split','findAll','addTags','setTags','ids','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','files','tmp','join','server','format','interaction-%s.zip','firstName','Letter','1cm','mkdirSync','

Sms\x20Interaction:\x20#%d

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','
','','','toFile','log','unlinkSync','sendStatus','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','end','status','json','count','offset','limit','set','reject','save','then','destroy','error','stack','name','send','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter'];(function(_0x27dfe7,_0x3acd6f){var _0x9d647c=function(_0x200340){while(--_0x200340){_0x27dfe7['push'](_0x27dfe7['shift']());}};_0x9d647c(++_0x3acd6f);}(_0xbd7e,0xcc));var _0xebd7=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0xbd7e[_0x497b1e];return _0x3f72e1;};'use strict';var pdf=require(_0xebd7('0x0'));var emlformat=require(_0xebd7('0x1'));var rimraf=require(_0xebd7('0x2'));var zipdir=require(_0xebd7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebd7('0x4'));var moment=require(_0xebd7('0x5'));var BPromise=require(_0xebd7('0x6'));var Mustache=require('mustache');var util=require(_0xebd7('0x7'));var path=require('path');var sox=require(_0xebd7('0x8'));var csv=require(_0xebd7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xebd7('0xa'));var squel=require(_0xebd7('0xb'));var crypto=require(_0xebd7('0xc'));var jsforce=require(_0xebd7('0xd'));var deskjs=require(_0xebd7('0xe'));var toCsv=require(_0xebd7('0x9'));var querystring=require(_0xebd7('0xf'));var Papa=require(_0xebd7('0x10'));var Redis=require(_0xebd7('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0xebd7('0x12'))(_0xebd7('0x13'));var utils=require(_0xebd7('0x14'));var config=require(_0xebd7('0x15'));var db=require(_0xebd7('0x16'))['db'];config['redis']=_[_0xebd7('0x17')](config[_0xebd7('0x18')],{'host':_0xebd7('0x19'),'port':0x18eb});var socket=require(_0xebd7('0x1a'))(new Redis(config['redis']));require(_0xebd7('0x1b'))[_0xebd7('0x1c')](socket);function respondWithStatusCode(_0x41f879,_0x456ae1){_0x456ae1=_0x456ae1||0xcc;return function(_0xcf813b){if(_0xcf813b){return _0x41f879['sendStatus'](_0x456ae1);}return _0x41f879['status'](_0x456ae1)[_0xebd7('0x1d')]();};}function respondWithResult(_0x10c1c2,_0x47845f){_0x47845f=_0x47845f||0xc8;return function(_0x2ac5b6){if(_0x2ac5b6){return _0x10c1c2[_0xebd7('0x1e')](_0x47845f)[_0xebd7('0x1f')](_0x2ac5b6);}};}function respondWithFilteredResult(_0x1d7937,_0x31f2fd){return function(_0x3e9598){if(_0x3e9598){var _0x51437c=_0x3e9598[_0xebd7('0x20')],_0x17054f=_0x31f2fd[_0xebd7('0x21')],_0x380134=_0x31f2fd[_0xebd7('0x21')]+_0x31f2fd[_0xebd7('0x22')],_0x237529;if(_0x380134>=_0x51437c){_0x380134=_0x51437c;_0x237529=0xc8;}else{_0x237529=0xce;}_0x1d7937[_0xebd7('0x1e')](_0x237529);return _0x1d7937[_0xebd7('0x23')]('Content-Range',_0x17054f+'-'+_0x380134+'/'+_0x51437c)[_0xebd7('0x1f')](_0x3e9598);}return null;};}function patchUpdates(_0x3a4052){return function(_0x574d00){try{jsonpatch['apply'](_0x574d00,_0x3a4052,!![]);}catch(_0x87e72){return BPromise[_0xebd7('0x24')](_0x87e72);}return _0x574d00[_0xebd7('0x25')]();};}function saveUpdates(_0x1424c8,_0x2cea70){return function(_0x58f822){if(_0x58f822){return _0x58f822['update'](_0x1424c8)[_0xebd7('0x26')](function(_0x3825f3){return _0x3825f3;});}return null;};}function removeEntity(_0x93cb00,_0x1df421){return function(_0xb1e346){if(_0xb1e346){return _0xb1e346[_0xebd7('0x27')]()['then'](function(){_0x93cb00[_0xebd7('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8ed42e,_0x57f4ab){return function(_0x346244){if(!_0x346244){_0x8ed42e['sendStatus'](0x194);}return _0x346244;};}function handleError(_0x29b3d3,_0x3d8aa6){_0x3d8aa6=_0x3d8aa6||0x1f4;return function(_0xdaa3db){logger[_0xebd7('0x28')](_0xdaa3db[_0xebd7('0x29')]);if(_0xdaa3db[_0xebd7('0x2a')]){delete _0xdaa3db['name'];}_0x29b3d3['status'](_0x3d8aa6)[_0xebd7('0x2b')](_0xdaa3db);};}exports['index']=function(_0x452dbd,_0xdae887){var _0x1c7e97={},_0x1d4db0={},_0x37967b={'count':0x0,'rows':[]};var _0x452fe4=db['SmsInteraction'][_0xebd7('0x2c')];_0x1d4db0[_0xebd7('0x2d')]=_[_0xebd7('0x2e')](_0x452fe4);var _0x183314={'dateStart':_0x452dbd[_0xebd7('0x2f')]['dateStart'],'dateEnd':_0x452dbd[_0xebd7('0x2f')][_0xebd7('0x30')]};delete _0x452dbd[_0xebd7('0x2f')][_0xebd7('0x31')];delete _0x452dbd[_0xebd7('0x2f')][_0xebd7('0x30')];_0x1d4db0['query']=_['keys'](_0x452dbd[_0xebd7('0x2f')]);_0x1d4db0[_0xebd7('0x32')]=_[_0xebd7('0x33')](_0x1d4db0[_0xebd7('0x2d')],_0x1d4db0['query']);_0x1c7e97[_0xebd7('0x34')]=_['intersection'](_0x1d4db0[_0xebd7('0x2d')],qs[_0xebd7('0x35')](_0x452dbd['query'][_0xebd7('0x35')]));_0x1c7e97['attributes']=_0x1c7e97[_0xebd7('0x34')]['length']?_0x1c7e97[_0xebd7('0x34')]:_0x1d4db0[_0xebd7('0x2d')];if(!_0x452dbd[_0xebd7('0x2f')][_0xebd7('0x36')](_0xebd7('0x37'))){_0x1c7e97[_0xebd7('0x22')]=qs[_0xebd7('0x22')](_0x452dbd['query'][_0xebd7('0x22')]);_0x1c7e97[_0xebd7('0x21')]=qs['offset'](_0x452dbd[_0xebd7('0x2f')][_0xebd7('0x21')]);}_0x1c7e97[_0xebd7('0x38')]=qs[_0xebd7('0x39')](_0x452dbd['query'][_0xebd7('0x39')]);_0x1c7e97[_0xebd7('0x3a')]=qs['filters'](_[_0xebd7('0x3b')](_0x452dbd['query'],_0x1d4db0['filters']));if(_0x183314[_0xebd7('0x31')]){if(_0x183314[_0xebd7('0x30')]){_0x183314[_0xebd7('0x30')]=moment(_0x183314[_0xebd7('0x30')])[_0xebd7('0x3c')](0x1,_0xebd7('0x3d'));}else{_0x183314[_0xebd7('0x30')]=moment(_0x183314[_0xebd7('0x31')])[_0xebd7('0x3c')](0x1,'day');}_[_0xebd7('0x3e')](_0x1c7e97[_0xebd7('0x3a')],{'createdAt':{'$gte':_0x183314[_0xebd7('0x31')],'$lte':_0x183314[_0xebd7('0x30')]}});}if(_0x452dbd['query'][_0xebd7('0x3f')]){_0x1c7e97[_0xebd7('0x3a')]=_['merge'](_0x1c7e97[_0xebd7('0x3a')],{'$or':_[_0xebd7('0x40')](_0x1c7e97[_0xebd7('0x34')],function(_0x1d90f2){var _0x123386={};_0x123386[_0x1d90f2]={'$like':'%'+_0x452dbd['query']['filter']+'%'};return _0x123386;})});}_0x1c7e97=_['merge']({},_0x1c7e97,_0x452dbd[_0xebd7('0x41')]);var _0xe9d162={'where':_0x1c7e97[_0xebd7('0x3a')]};_0xe9d162[_0xebd7('0x42')]=[];if(_0x452dbd[_0xebd7('0x2f')][_0xebd7('0x43')]){_0xe9d162[_0xebd7('0x42')][_0xebd7('0x44')]({'model':db['Tag'],'as':_0xebd7('0x45'),'attributes':['id'],'where':{'id':_0x452dbd[_0xebd7('0x2f')][_0xebd7('0x43')]},'required':!![]});_0xe9d162[_0xebd7('0x46')]=!![];}if(_0x452dbd[_0xebd7('0x2f')][_0xebd7('0x47')]){_0xe9d162[_0xebd7('0x42')][_0xebd7('0x44')]({'model':db[_0xebd7('0x48')],'as':_0xebd7('0x49'),'attributes':['id',_0xebd7('0x4a'),_0xebd7('0x4b'),'read'],'where':{'direction':'in','read':_0x452dbd['query']['read']||![]},'required':!![]});_0xe9d162['distinct']=!![];}return db['SmsInteraction'][_0xebd7('0x20')](_0xe9d162)[_0xebd7('0x26')](function(_0x5877f6){_0x37967b['count']=_0x5877f6;if(_0x452dbd[_0xebd7('0x2f')]['includeAll']){_0x1c7e97[_0xebd7('0x42')]=[{'model':db[_0xebd7('0x4c')],'as':'Users','required':![],'attributes':['id',_0xebd7('0x2a'),_0xebd7('0x4d')]},{'model':db[_0xebd7('0x4e')],'as':_0xebd7('0x4f'),'required':![]},{'model':db['User'],'as':_0xebd7('0x50'),'attributes':[_0xebd7('0x2a'),'fullname',_0xebd7('0x51')],'required':![]},{'model':db['SmsAccount'],'as':'Account','attributes':['name',_0xebd7('0x52')],'required':![]},{'model':db[_0xebd7('0x48')],'as':_0xebd7('0x49'),'attributes':['id',_0xebd7('0x4a'),_0xebd7('0x4b'),'read'],'where':{'direction':'in','read':_0x452dbd['query'][_0xebd7('0x47')]||![]},'required':_0x452dbd[_0xebd7('0x2f')][_0xebd7('0x47')]||![]},{'model':db[_0xebd7('0x53')],'as':'Tags','attributes':['id',_0xebd7('0x2a'),_0xebd7('0x54')],'required':_0x452dbd[_0xebd7('0x2f')]['tag']?!![]:![]},{'model':db[_0xebd7('0x53')],'as':_0xebd7('0x55'),'attributes':['id',_0xebd7('0x2a'),_0xebd7('0x54')],'through':_0x452dbd[_0xebd7('0x2f')][_0xebd7('0x43')]?{'attributes':[],'where':{'TagId':_0x452dbd['query'][_0xebd7('0x43')]||undefined}}:{},'required':_0x452dbd[_0xebd7('0x2f')][_0xebd7('0x43')]?!![]:![]}];}return db[_0xebd7('0x56')]['findAll'](_0x1c7e97);})['then'](function(_0x5a505c){_0x37967b[_0xebd7('0x57')]=_0x5a505c;return _0x37967b;})[_0xebd7('0x26')](respondWithFilteredResult(_0xdae887,_0x1c7e97))[_0xebd7('0x58')](handleError(_0xdae887,null));};exports[_0xebd7('0x59')]=function(_0x56006c,_0x1fe204){var _0x3e6f12={'raw':![],'where':{'id':_0x56006c[_0xebd7('0x5a')]['id']}},_0x93665={};_0x93665[_0xebd7('0x2d')]=_[_0xebd7('0x2e')](db[_0xebd7('0x56')]['rawAttributes']);_0x93665[_0xebd7('0x2f')]=_[_0xebd7('0x2e')](_0x56006c[_0xebd7('0x2f')]);_0x93665[_0xebd7('0x32')]=_[_0xebd7('0x33')](_0x93665[_0xebd7('0x2d')],_0x93665[_0xebd7('0x2f')]);_0x3e6f12[_0xebd7('0x34')]=_[_0xebd7('0x33')](_0x93665[_0xebd7('0x2d')],qs[_0xebd7('0x35')](_0x56006c[_0xebd7('0x2f')][_0xebd7('0x35')]));_0x3e6f12[_0xebd7('0x34')]=_0x3e6f12['attributes'][_0xebd7('0x5b')]?_0x3e6f12['attributes']:_0x93665[_0xebd7('0x2d')];if(_0x56006c['query'][_0xebd7('0x5c')]){_0x3e6f12['include']=[{'all':!![]}];}_0x3e6f12=_[_0xebd7('0x3e')]({},_0x3e6f12,_0x56006c[_0xebd7('0x41')]);return db[_0xebd7('0x56')]['find'](_0x3e6f12)[_0xebd7('0x26')](handleEntityNotFound(_0x1fe204,null))[_0xebd7('0x26')](respondWithResult(_0x1fe204,null))[_0xebd7('0x58')](handleError(_0x1fe204,null));};exports[_0xebd7('0x5d')]=function(_0x4e5b5c,_0x3e64fa){return db[_0xebd7('0x56')][_0xebd7('0x5d')](_0x4e5b5c[_0xebd7('0x5e')],{})['then'](respondWithResult(_0x3e64fa,0xc9))['catch'](handleError(_0x3e64fa,null));};exports[_0xebd7('0x5f')]=function(_0x4e1c12,_0x22b308){if(_0x4e1c12[_0xebd7('0x5e')]['id']){delete _0x4e1c12[_0xebd7('0x5e')]['id'];}return db[_0xebd7('0x56')][_0xebd7('0x60')]({'where':{'id':_0x4e1c12[_0xebd7('0x5a')]['id']}})[_0xebd7('0x26')](handleEntityNotFound(_0x22b308,null))[_0xebd7('0x26')](saveUpdates(_0x4e1c12[_0xebd7('0x5e')],null))['then'](respondWithResult(_0x22b308,null))[_0xebd7('0x58')](handleError(_0x22b308,null));};exports[_0xebd7('0x27')]=function(_0x1fe28f,_0x5623ed){return db[_0xebd7('0x56')]['find']({'where':{'id':_0x1fe28f['params']['id']}})[_0xebd7('0x26')](handleEntityNotFound(_0x5623ed,null))[_0xebd7('0x26')](removeEntity(_0x5623ed,null))[_0xebd7('0x58')](handleError(_0x5623ed,null));};exports[_0xebd7('0x61')]=function(_0x7a936,_0x4e6bc3){return db[_0xebd7('0x56')][_0xebd7('0x61')]()[_0xebd7('0x26')](respondWithResult(_0x4e6bc3,null))[_0xebd7('0x58')](handleError(_0x4e6bc3,null));};exports[_0xebd7('0x62')]=function(_0x5bf6c7,_0x4c42e4,_0xbdda18){return db[_0xebd7('0x48')][_0xebd7('0x60')]({'where':{'id':_0x5bf6c7[_0xebd7('0x5a')]['id']}})[_0xebd7('0x26')](handleEntityNotFound(_0x4c42e4,null))['then'](function(_0x26c29c){if(_0x26c29c){return _0x26c29c[_0xebd7('0x62')](_0x5bf6c7['body']['ids'],_[_0xebd7('0x63')](_0x5bf6c7[_0xebd7('0x5e')],['ids','id'])||{});}})[_0xebd7('0x26')](respondWithResult(_0x4c42e4,null))['catch'](handleError(_0x4c42e4,null));};exports[_0xebd7('0x64')]=function(_0x233616,_0x1a4efb,_0x3639e9){var _0x35fcf6={'raw':![],'where':{}};var _0x388bc5={};var _0x430e79={'count':0x0,'rows':[]};return db[_0xebd7('0x56')]['findOne']({'where':{'id':_0x233616[_0xebd7('0x5a')]['id']}})[_0xebd7('0x26')](handleEntityNotFound(_0x1a4efb,null))['then'](function(_0x4a1eb5){if(_0x4a1eb5){_0x388bc5['model']=_['keys'](db[_0xebd7('0x48')][_0xebd7('0x2c')]);_0x388bc5['query']=_[_0xebd7('0x2e')](_0x233616[_0xebd7('0x2f')]);_0x388bc5[_0xebd7('0x32')]=_[_0xebd7('0x33')](_0x388bc5[_0xebd7('0x2d')],_0x388bc5[_0xebd7('0x2f')]);_0x35fcf6[_0xebd7('0x34')]=_[_0xebd7('0x33')](_0x388bc5[_0xebd7('0x2d')],qs[_0xebd7('0x35')](_0x233616[_0xebd7('0x2f')][_0xebd7('0x35')]));_0x35fcf6['attributes']=_0x35fcf6['attributes'][_0xebd7('0x5b')]?_0x35fcf6[_0xebd7('0x34')]:_0x388bc5[_0xebd7('0x2d')];if(!_0x233616[_0xebd7('0x2f')][_0xebd7('0x36')]('nolimit')){_0x35fcf6[_0xebd7('0x22')]=qs[_0xebd7('0x22')](_0x233616['query'][_0xebd7('0x22')]);_0x35fcf6[_0xebd7('0x21')]=qs['offset'](_0x233616['query'][_0xebd7('0x21')]);}_0x35fcf6[_0xebd7('0x38')]=qs[_0xebd7('0x39')](_0x233616[_0xebd7('0x2f')][_0xebd7('0x39')]);_0x35fcf6[_0xebd7('0x3a')]=qs[_0xebd7('0x32')](_['pick'](_0x233616[_0xebd7('0x2f')],_0x388bc5[_0xebd7('0x32')]));_0x35fcf6[_0xebd7('0x3a')][_0xebd7('0x65')]=_0x4a1eb5['id'];if(_0x233616[_0xebd7('0x2f')][_0xebd7('0x3f')]){_0x35fcf6[_0xebd7('0x3a')]=_[_0xebd7('0x3e')](_0x35fcf6[_0xebd7('0x3a')],{'$or':_[_0xebd7('0x40')](_0x35fcf6['attributes'],function(_0x3a261c){var _0x2e25bc={};_0x2e25bc[_0x3a261c]={'$like':'%'+_0x233616['query']['filter']+'%'};return _0x2e25bc;})});}if(_0x233616[_0xebd7('0x2f')][_0xebd7('0x66')]){var _0x5e23cb=_0x233616[_0xebd7('0x2f')][_0xebd7('0x66')][_0xebd7('0x67')](',');var _0x458156={};_0x458156[_0x5e23cb[0x0]]={'$gte':moment(_0x5e23cb[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x35fcf6[_0xebd7('0x3a')]=_[_0xebd7('0x3e')](_0x35fcf6[_0xebd7('0x3a')],_0x458156);}_0x35fcf6=_[_0xebd7('0x3e')]({},_0x35fcf6,_0x233616[_0xebd7('0x41')]);return db[_0xebd7('0x48')][_0xebd7('0x20')]({'where':_0x35fcf6[_0xebd7('0x3a')]})[_0xebd7('0x26')](function(_0x90ec19){_0x430e79[_0xebd7('0x20')]=_0x90ec19;if(_0x233616[_0xebd7('0x2f')][_0xebd7('0x5c')]){_0x35fcf6[_0xebd7('0x42')]=[{'all':!![]}];}return db['SmsMessage'][_0xebd7('0x68')](_0x35fcf6);})[_0xebd7('0x26')](function(_0x463384){_0x430e79['rows']=_0x463384;return _0x430e79;});}})[_0xebd7('0x26')](respondWithFilteredResult(_0x1a4efb,_0x35fcf6))[_0xebd7('0x58')](handleError(_0x1a4efb,null));};exports[_0xebd7('0x69')]=function(_0x5c6ac9,_0x2ed271,_0xbf5f1a){return db[_0xebd7('0x56')][_0xebd7('0x60')]({'where':{'id':_0x5c6ac9[_0xebd7('0x5a')]['id']}})[_0xebd7('0x26')](handleEntityNotFound(_0x2ed271,null))[_0xebd7('0x26')](function(_0x424205){if(_0x424205){return _0x424205[_0xebd7('0x6a')](_0x5c6ac9[_0xebd7('0x5e')][_0xebd7('0x6b')],_['omit'](_0x5c6ac9[_0xebd7('0x5e')],[_0xebd7('0x6b'),'id'])||{})['spread'](function(){return db['Tag'][_0xebd7('0x68')]({'attributes':['id','name',_0xebd7('0x54')],'where':{'id':_0x5c6ac9[_0xebd7('0x5e')][_0xebd7('0x6b')]}});})['then'](function(_0x45536f){socket[_0xebd7('0x6c')](_0xebd7('0x6d'),{'id':Number(_0x5c6ac9[_0xebd7('0x5a')]['id']),'tags':_0x45536f||[]});return{'id':Number(_0x5c6ac9[_0xebd7('0x5a')]['id']),'tags':_0x45536f||[]};});}})[_0xebd7('0x26')](respondWithResult(_0x2ed271,null))[_0xebd7('0x58')](handleError(_0x2ed271,null));};exports[_0xebd7('0x6e')]=function(_0x197d60,_0x35309f,_0x109959){var _0x344090;return db[_0xebd7('0x56')][_0xebd7('0x60')]({'where':{'id':_0x197d60['params']['id']}})[_0xebd7('0x26')](handleEntityNotFound(_0x35309f,null))[_0xebd7('0x26')](function(_0xc30e32){if(_0xc30e32){return _0xc30e32[_0xebd7('0x6e')](_0x197d60[_0xebd7('0x2f')][_0xebd7('0x6b')]);}})[_0xebd7('0x26')](respondWithStatusCode(_0x35309f,null))['catch'](handleError(_0x35309f,null));};exports[_0xebd7('0x6f')]=function(_0x1b1044,_0x33402e){var _0x298872=moment()[_0xebd7('0x70')]()[_0xebd7('0x71')]();var _0x2f3b91=path['join'](config[_0xebd7('0x72')],'server',_0xebd7('0x73'),_0xebd7('0x74'));var _0x129528=path[_0xebd7('0x75')](config[_0xebd7('0x72')],_0xebd7('0x76'),_0xebd7('0x73'),'attachments');var _0x4a238a=path[_0xebd7('0x75')](_0x2f3b91,_0x298872);var _0x367756=util[_0xebd7('0x77')](_0xebd7('0x78'),_0x298872);var _0x316a10=path[_0xebd7('0x75')](_0x2f3b91,_0x367756);var _0x212bed=![];return db[_0xebd7('0x56')]['find']({'where':{'id':_0x1b1044[_0xebd7('0x5a')]['id']},'include':[{'model':db['SmsMessage'],'as':_0xebd7('0x49'),'attributes':['id',_0xebd7('0x5e')],'include':[{'model':db[_0xebd7('0x4c')],'as':_0xebd7('0x4c'),'attributes':['id',_0xebd7('0x4d')],'raw':!![]},{'model':db['CmContact'],'as':_0xebd7('0x4f'),'attributes':['id',_0xebd7('0x79')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x33402e,null))[_0xebd7('0x26')](function(_0x1634b5){if(_0x1634b5){_0x212bed=!![];var _0xb0a29d='';var _0x48fc90={'format':_0xebd7('0x7a'),'border':_0xebd7('0x7b')};fs[_0xebd7('0x7c')](_0x4a238a);_0xb0a29d+=util[_0xebd7('0x77')](_0xebd7('0x7d'),_0x1634b5['id']);_0xb0a29d+=util[_0xebd7('0x77')]('

Date:\x20%s

',moment()['format'](_0xebd7('0x7e'))[_0xebd7('0x71')]());_0xb0a29d+=_0xebd7('0x7f');for(var _0x24383a=0x0;_0x24383a<_0x1634b5[_0xebd7('0x49')][_0xebd7('0x5b')];_0x24383a++){var _0x1cdd17=_0x1634b5[_0xebd7('0x49')][_0x24383a];_0xb0a29d+=_0xebd7('0x80');_0xb0a29d+=util['format']('%s:\x20%s

',_0x1cdd17[_0xebd7('0x4c')]?_0x1cdd17['User'][_0xebd7('0x4d')]:_0x1cdd17[_0xebd7('0x4f')]['firstName'],_0x1cdd17[_0xebd7('0x5e')]);_0xb0a29d+=_0xebd7('0x81');}return new BPromise(function(_0x30ca8f,_0x2fe56a){pdf['create'](_0xb0a29d,_0x48fc90)[_0xebd7('0x82')](path[_0xebd7('0x75')](_0x4a238a,'interaction-'+_0x298872+'.pdf'),function(_0x5d1dea,_0x47eda9){if(_0x5d1dea)return _0x2fe56a(_0x5d1dea);_0x30ca8f(_0x47eda9);});});}})[_0xebd7('0x26')](function(){if(_0x212bed){return new BPromise(function(_0x19991a,_0x3fc9a9){zipdir(_0x4a238a,{'saveTo':_0x316a10},function(_0x5d8f1e,_0x2ab4c9){if(_0x5d8f1e)return _0x3fc9a9(_0x5d8f1e);return _0x19991a(_0x2ab4c9);});});}})[_0xebd7('0x26')](function(){if(_0x212bed){return new BPromise(function(_0x55689b,_0x3e5b38){rimraf(_0x4a238a,function(_0x4730a0){if(_0x4730a0)_0x3e5b38(_0x4730a0);return _0x55689b();});});}})[_0xebd7('0x26')](function(){if(_0x212bed){return _0x33402e['download'](_0x316a10,_0x367756,function(_0x53878c){if(_0x53878c){console[_0xebd7('0x83')]('err',_0x53878c);}else{fs[_0xebd7('0x84')](_0x316a10);}});}else{return _0x33402e[_0xebd7('0x85')](0xc8);}})['catch'](handleError(_0x33402e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a3794f3..dfc5e0f 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 _0x7698=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save'];(function(_0x3af46e,_0x4f7009){var _0x409b20=function(_0x463671){while(--_0x463671){_0x3af46e['push'](_0x3af46e['shift']());}};_0x409b20(++_0x4f7009);}(_0x7698,0x1e3));var _0x8769=function(_0x580f3e,_0x3752bb){_0x580f3e=_0x580f3e-0x0;var _0xea56b6=_0x7698[_0x580f3e];return _0xea56b6;};'use strict';var EventEmitter=require(_0x8769('0x0'));var SmsInteraction=require(_0x8769('0x1'))['db'][_0x8769('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8769('0x3')](0x0);var events={'afterCreate':_0x8769('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1f704d){return function(_0x38bca3,_0x497658,_0x2d8779){SmsInteractionEvents['emit'](_0x1f704d+':'+_0x38bca3['id'],_0x38bca3);SmsInteractionEvents[_0x8769('0x5')](_0x1f704d,_0x38bca3);_0x2d8779(null);};}for(var e in events){if(events[_0x8769('0x6')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x8769('0x7')]=SmsInteractionEvents; \ No newline at end of file +var _0x2fb1=['SmsInteraction','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x2dacfc,_0x137093){var _0x273284=function(_0x1971aa){while(--_0x1971aa){_0x2dacfc['push'](_0x2dacfc['shift']());}};_0x273284(++_0x137093);}(_0x2fb1,0xee));var _0x12fb=function(_0x43e344,_0x10bf37){_0x43e344=_0x43e344-0x0;var _0x3965f1=_0x2fb1[_0x43e344];return _0x3965f1;};'use strict';var EventEmitter=require(_0x12fb('0x0'));var SmsInteraction=require(_0x12fb('0x1'))['db'][_0x12fb('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x12fb('0x3')](0x0);var events={'afterCreate':_0x12fb('0x4'),'afterUpdate':_0x12fb('0x5'),'afterDestroy':_0x12fb('0x6')};function emitEvent(_0x51609b){return function(_0x492bac,_0x57d812,_0x5c9e5b){SmsInteractionEvents[_0x12fb('0x7')](_0x51609b+':'+_0x492bac['id'],_0x492bac);SmsInteractionEvents[_0x12fb('0x7')](_0x51609b,_0x492bac);_0x5c9e5b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x12fb('0x8')](e,emitEvent(event));}}module[_0x12fb('0x9')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 43b875c..c857582 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 _0x60d7=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x60d7,0x149));var _0x760d=function(_0x2df93c,_0x290562){_0x2df93c=_0x2df93c-0x0;var _0x2d256b=_0x60d7[_0x2df93c];return _0x2d256b;};'use strict';var _=require(_0x760d('0x0'));var util=require(_0x760d('0x1'));var logger=require(_0x760d('0x2'))(_0x760d('0x3'));var moment=require(_0x760d('0x4'));var BPromise=require(_0x760d('0x5'));var rp=require(_0x760d('0x6'));var attributes=require(_0x760d('0x7'));module[_0x760d('0x8')]=function(_0x523dc6,_0x595518){return _0x523dc6[_0x760d('0x9')](_0x760d('0xa'),attributes,{'tableName':_0x760d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d87=['lodash','util','api','moment','bluebird','request-promise','./smsInteraction.attributes','sms_interactions'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x2d87,0x160));var _0x72d8=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x2d87[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x72d8('0x0'));var util=require(_0x72d8('0x1'));var logger=require('../../config/logger')(_0x72d8('0x2'));var moment=require(_0x72d8('0x3'));var BPromise=require(_0x72d8('0x4'));var rp=require(_0x72d8('0x5'));var attributes=require(_0x72d8('0x6'));module['exports']=function(_0x53fc63,_0x2721cd){return _0x53fc63['define']('SmsInteraction',attributes,{'tableName':_0x72d8('0x7'),'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 e4bb2f3..f0298cf 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 _0xc24e=['result','update','options','raw','where','UpdateSmsInteraction','stringify','catch','AddTagsToSmsInteraction','SmsInteraction','find','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsInteraction,\x20%s,\x20%s','message'];(function(_0x534078,_0x1ec172){var _0x2e2bb6=function(_0x388bd8){while(--_0x388bd8){_0x534078['push'](_0x534078['shift']());}};_0x2e2bb6(++_0x1ec172);}(_0xc24e,0x105));var _0xec24=function(_0x31ff75,_0x1831c2){_0x31ff75=_0x31ff75-0x0;var _0x22fec4=_0xc24e[_0x31ff75];return _0x22fec4;};'use strict';var _=require(_0xec24('0x0'));var util=require(_0xec24('0x1'));var moment=require(_0xec24('0x2'));var BPromise=require(_0xec24('0x3'));var rs=require(_0xec24('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec24('0x5'))['db'];var utils=require(_0xec24('0x6'));var logger=require(_0xec24('0x7'))(_0xec24('0x8'));var config=require('../../config/environment');var jayson=require(_0xec24('0x9'));var client=jayson[_0xec24('0xa')][_0xec24('0xb')]({'port':0x232a});config[_0xec24('0xc')]=_[_0xec24('0xd')](config[_0xec24('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xec24('0xe'))(new Redis(config[_0xec24('0xc')]));require('./smsInteraction.socket')[_0xec24('0xf')](socket);function respondWithRpcPromise(_0x5235fd,_0x13c903,_0x1b7759){return new BPromise(function(_0x16d8e1,_0x5deb7a){return client[_0xec24('0x10')](_0x5235fd,_0x1b7759)[_0xec24('0x11')](function(_0x4c812f){logger[_0xec24('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x13c903,'request\x20sent');logger[_0xec24('0x13')](_0xec24('0x14'),_0x13c903,_0xec24('0x15'),JSON['stringify'](_0x4c812f));if(_0x4c812f['error']){if(_0x4c812f[_0xec24('0x16')][_0xec24('0x17')]===0x1f4){logger[_0xec24('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x13c903,_0x4c812f[_0xec24('0x16')]['message']);return _0x5deb7a(_0x4c812f[_0xec24('0x16')]['message']);}logger[_0xec24('0x16')](_0xec24('0x18'),_0x13c903,_0x4c812f[_0xec24('0x16')][_0xec24('0x19')]);return _0x16d8e1(_0x4c812f[_0xec24('0x16')][_0xec24('0x19')]);}else{logger['info'](_0xec24('0x18'),_0x13c903,'request\x20sent');_0x16d8e1(_0x4c812f[_0xec24('0x1a')][_0xec24('0x19')]);}})['catch'](function(_0x4cf980){logger[_0xec24('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x13c903,_0x4cf980);_0x5deb7a(_0x4cf980);});});}exports['UpdateSmsInteraction']=function(_0x339be0){var _0x2f15d1=this;return new Promise(function(_0x1cf60f,_0x3584d4){return db['SmsInteraction'][_0xec24('0x1b')](_0x339be0['body'],{'raw':_0x339be0[_0xec24('0x1c')]?_0x339be0['options'][_0xec24('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x339be0[_0xec24('0x1c')]?_0x339be0[_0xec24('0x1c')][_0xec24('0x1e')]||null:null,'attributes':_0x339be0[_0xec24('0x1c')]?_0x339be0[_0xec24('0x1c')]['attributes']||null:null,'limit':_0x339be0[_0xec24('0x1c')]?_0x339be0[_0xec24('0x1c')]['limit']||null:null})[_0xec24('0x11')](function(_0x47373e){logger['info'](_0xec24('0x1f'),_0x339be0);logger['debug'](_0xec24('0x1f'),_0x339be0,JSON[_0xec24('0x20')](_0x47373e));_0x1cf60f(_0x47373e);})[_0xec24('0x21')](function(_0x26aa11){logger[_0xec24('0x16')](_0xec24('0x1f'),_0x26aa11[_0xec24('0x19')],_0x339be0);_0x3584d4(_0x2f15d1[_0xec24('0x16')](0x1f4,_0x26aa11[_0xec24('0x19')]));});});};exports[_0xec24('0x22')]=function(_0x1c0708){return new Promise(function(_0xdd5b4f,_0x1d77c8){return db[_0xec24('0x23')][_0xec24('0x24')]({'where':_0x1c0708[_0xec24('0x1c')]?_0x1c0708['options'][_0xec24('0x1e')]||null:null})[_0xec24('0x11')](function(_0x48c029){if(_0x48c029){return _0x48c029[_0xec24('0x25')](_0x1c0708['body']['ids'],_[_0xec24('0x26')](_0x1c0708['body'],['ids','id'])||{});}})[_0xec24('0x27')](function(_0x109b5e){logger[_0xec24('0x12')](_0xec24('0x28'),_0x1c0708);logger[_0xec24('0x13')]('AddTags',_0x1c0708,JSON[_0xec24('0x20')](_0x109b5e));_0xdd5b4f(_0x109b5e);})[_0xec24('0x21')](function(_0x1df81b){logger[_0xec24('0x16')](_0xec24('0x28'),_0x1df81b[_0xec24('0x19')],_0x1c0708);_0x1d77c8(_this[_0xec24('0x16')](0x1f4,_0x1df81b[_0xec24('0x19')]));});});}; \ No newline at end of file +var _0xf89e=['request\x20sent','catch','UpdateSmsInteraction','SmsInteraction','options','raw','where','attributes','limit','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0xf89e,0xc4));var _0xef89=function(_0x1de112,_0x14cdaa){_0x1de112=_0x1de112-0x0;var _0x55281b=_0xf89e[_0x1de112];return _0x55281b;};'use strict';var _=require(_0xef89('0x0'));var util=require('util');var moment=require(_0xef89('0x1'));var BPromise=require('bluebird');var rs=require(_0xef89('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xef89('0x3'));var logger=require(_0xef89('0x4'))(_0xef89('0x5'));var config=require(_0xef89('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xef89('0x7')]['http']({'port':0x232a});config[_0xef89('0x8')]=_[_0xef89('0x9')](config['redis'],{'host':_0xef89('0xa'),'port':0x18eb});var socket=require(_0xef89('0xb'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x501a91,_0x2415c1,_0x572494){return new BPromise(function(_0x1cdca7,_0x14a248){return client[_0xef89('0xc')](_0x501a91,_0x572494)[_0xef89('0xd')](function(_0x1e0ed2){logger[_0xef89('0xe')](_0xef89('0xf'),_0x2415c1,'request\x20sent');logger[_0xef89('0x10')](_0xef89('0x11'),_0x2415c1,'request\x20sent',JSON['stringify'](_0x1e0ed2));if(_0x1e0ed2[_0xef89('0x12')]){if(_0x1e0ed2[_0xef89('0x12')]['code']===0x1f4){logger[_0xef89('0x12')](_0xef89('0xf'),_0x2415c1,_0x1e0ed2['error'][_0xef89('0x13')]);return _0x14a248(_0x1e0ed2[_0xef89('0x12')]['message']);}logger[_0xef89('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x2415c1,_0x1e0ed2[_0xef89('0x12')][_0xef89('0x13')]);return _0x1cdca7(_0x1e0ed2[_0xef89('0x12')][_0xef89('0x13')]);}else{logger['info'](_0xef89('0xf'),_0x2415c1,_0xef89('0x14'));_0x1cdca7(_0x1e0ed2['result'][_0xef89('0x13')]);}})[_0xef89('0x15')](function(_0x2f450d){logger[_0xef89('0x12')](_0xef89('0xf'),_0x2415c1,_0x2f450d);_0x14a248(_0x2f450d);});});}exports[_0xef89('0x16')]=function(_0x33e793){var _0x32de87=this;return new Promise(function(_0x14a2e1,_0xbbac46){return db[_0xef89('0x17')]['update'](_0x33e793['body'],{'raw':_0x33e793[_0xef89('0x18')]?_0x33e793[_0xef89('0x18')][_0xef89('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33e793['options']?_0x33e793[_0xef89('0x18')][_0xef89('0x1a')]||null:null,'attributes':_0x33e793['options']?_0x33e793[_0xef89('0x18')][_0xef89('0x1b')]||null:null,'limit':_0x33e793[_0xef89('0x18')]?_0x33e793[_0xef89('0x18')][_0xef89('0x1c')]||null:null})[_0xef89('0xd')](function(_0x28037f){logger[_0xef89('0xe')](_0xef89('0x16'),_0x33e793);logger[_0xef89('0x10')](_0xef89('0x16'),_0x33e793,JSON['stringify'](_0x28037f));_0x14a2e1(_0x28037f);})[_0xef89('0x15')](function(_0x2e1f56){logger[_0xef89('0x12')](_0xef89('0x16'),_0x2e1f56[_0xef89('0x13')],_0x33e793);_0xbbac46(_0x32de87[_0xef89('0x12')](0x1f4,_0x2e1f56[_0xef89('0x13')]));});});};exports['AddTagsToSmsInteraction']=function(_0x298943){return new Promise(function(_0x25feba,_0x1c3197){return db[_0xef89('0x17')][_0xef89('0x1d')]({'where':_0x298943[_0xef89('0x18')]?_0x298943[_0xef89('0x18')][_0xef89('0x1a')]||null:null})[_0xef89('0xd')](function(_0xccf263){if(_0xccf263){return _0xccf263[_0xef89('0x1e')](_0x298943[_0xef89('0x1f')][_0xef89('0x20')],_[_0xef89('0x21')](_0x298943[_0xef89('0x1f')],[_0xef89('0x20'),'id'])||{});}})[_0xef89('0x22')](function(_0x27f9eb){logger[_0xef89('0xe')](_0xef89('0x23'),_0x298943);logger[_0xef89('0x10')](_0xef89('0x23'),_0x298943,JSON['stringify'](_0x27f9eb));_0x25feba(_0x27f9eb);})[_0xef89('0x15')](function(_0x347f60){logger[_0xef89('0x12')](_0xef89('0x23'),_0x347f60[_0xef89('0x13')],_0x298943);_0x1c3197(_this['error'](0x1f4,_0x347f60['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index bebcdf3..6d7bf52 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 _0x9a10=['register','length','smsInteraction:','./smsInteraction.events','save','remove','emit','removeListener'];(function(_0x44a391,_0x195729){var _0x16b897=function(_0x29616d){while(--_0x29616d){_0x44a391['push'](_0x44a391['shift']());}};_0x16b897(++_0x195729);}(_0x9a10,0x1a3));var _0x09a1=function(_0x2d8962,_0x491fa){_0x2d8962=_0x2d8962-0x0;var _0x2d98c1=_0x9a10[_0x2d8962];return _0x2d98c1;};'use strict';var SmsInteractionEvents=require(_0x09a1('0x0'));var events=[_0x09a1('0x1'),_0x09a1('0x2'),'update'];function createListener(_0x34631c,_0x4fb24b){return function(_0x213c76){_0x4fb24b[_0x09a1('0x3')](_0x34631c,_0x213c76);};}function removeListener(_0x1bdbc0,_0x374a8d){return function(){SmsInteractionEvents[_0x09a1('0x4')](_0x1bdbc0,_0x374a8d);};}exports[_0x09a1('0x5')]=function(_0x4dd24b){for(var _0x3eac0e=0x0,_0x540aab=events[_0x09a1('0x6')];_0x3eac0e<_0x540aab;_0x3eac0e++){var _0x5b1b8e=events[_0x3eac0e];var _0x5604f8=createListener(_0x09a1('0x7')+_0x5b1b8e,_0x4dd24b);SmsInteractionEvents['on'](_0x5b1b8e,_0x5604f8);}}; \ No newline at end of file +var _0xf7e8=['removeListener','register','smsInteraction:','./smsInteraction.events','save','update','emit'];(function(_0x4bbe00,_0x1d2f14){var _0x3999d2=function(_0x4390fa){while(--_0x4390fa){_0x4bbe00['push'](_0x4bbe00['shift']());}};_0x3999d2(++_0x1d2f14);}(_0xf7e8,0xe3));var _0x8f7e=function(_0x54e020,_0xa5d8f3){_0x54e020=_0x54e020-0x0;var _0x47a0dd=_0xf7e8[_0x54e020];return _0x47a0dd;};'use strict';var SmsInteractionEvents=require(_0x8f7e('0x0'));var events=[_0x8f7e('0x1'),'remove',_0x8f7e('0x2')];function createListener(_0x1fad33,_0x220eb3){return function(_0x429566){_0x220eb3[_0x8f7e('0x3')](_0x1fad33,_0x429566);};}function removeListener(_0x2bf185,_0x1d2f48){return function(){SmsInteractionEvents[_0x8f7e('0x4')](_0x2bf185,_0x1d2f48);};}exports[_0x8f7e('0x5')]=function(_0x3ea7dd){for(var _0x3f1176=0x0,_0x23475b=events['length'];_0x3f1176<_0x23475b;_0x3f1176++){var _0x150f34=events[_0x3f1176];var _0xee6524=createListener(_0x8f7e('0x6')+_0x150f34,_0x3ea7dd);SmsInteractionEvents['on'](_0x150f34,_0xee6524);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 88cb2c5..d17dc8b 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 _0xe3ed=['status','put','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status'];(function(_0x5d8302,_0x2e85b8){var _0x51cc54=function(_0x58e3e3){while(--_0x58e3e3){_0x5d8302['push'](_0x5d8302['shift']());}};_0x51cc54(++_0x2e85b8);}(_0xe3ed,0x8d));var _0xde3e=function(_0x44400d,_0x5abc96){_0x44400d=_0x44400d-0x0;var _0x5b5803=_0xe3ed[_0x44400d];return _0x5b5803;};'use strict';var multer=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var path=require(_0xde3e('0x2'));var timeout=require(_0xde3e('0x3'));var express=require(_0xde3e('0x4'));var router=express[_0xde3e('0x5')]();var auth=require(_0xde3e('0x6'));var interaction=require(_0xde3e('0x7'));var config=require('../../config/environment');var controller=require(_0xde3e('0x8'));router[_0xde3e('0x9')]('/',auth['isAuthenticated'](),controller[_0xde3e('0xa')]);router['get'](_0xde3e('0xb'),auth[_0xde3e('0xc')](),controller['describe']);router[_0xde3e('0x9')](_0xde3e('0xd'),auth[_0xde3e('0xc')](),controller[_0xde3e('0xe')]);router[_0xde3e('0xf')]('/',auth['isAuthenticated'](),interaction[_0xde3e('0x10')](_0xde3e('0x11'),_0xde3e('0x12')),controller[_0xde3e('0x13')]);router['post'](_0xde3e('0x14'),controller[_0xde3e('0x15')]);router['put'](_0xde3e('0xd'),auth[_0xde3e('0xc')](),controller['update']);router[_0xde3e('0x16')]('/:id/accept',auth[_0xde3e('0xc')](),controller[_0xde3e('0x17')]);router[_0xde3e('0x16')]('/:id/reject',auth[_0xde3e('0xc')](),controller[_0xde3e('0x18')]);router['delete']('/:id',auth[_0xde3e('0xc')](),controller[_0xde3e('0x19')]);module[_0xde3e('0x1a')]=router; \ No newline at end of file +var _0x5dcf=['sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked'];(function(_0x2f0ade,_0x2132d9){var _0x3db79e=function(_0x4bbe11){while(--_0x4bbe11){_0x2f0ade['push'](_0x2f0ade['shift']());}};_0x3db79e(++_0x2132d9);}(_0x5dcf,0xd9));var _0xf5dc=function(_0x39e2c5,_0x4bab18){_0x39e2c5=_0x39e2c5-0x0;var _0x5d9684=_0x5dcf[_0x39e2c5];return _0x5d9684;};'use strict';var multer=require(_0xf5dc('0x0'));var util=require(_0xf5dc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf5dc('0x2'));var router=express[_0xf5dc('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf5dc('0x4'));var config=require(_0xf5dc('0x5'));var controller=require('./smsMessage.controller');router[_0xf5dc('0x6')]('/',auth['isAuthenticated'](),controller[_0xf5dc('0x7')]);router['get'](_0xf5dc('0x8'),auth[_0xf5dc('0x9')](),controller[_0xf5dc('0xa')]);router[_0xf5dc('0x6')](_0xf5dc('0xb'),auth['isAuthenticated'](),controller[_0xf5dc('0xc')]);router[_0xf5dc('0xd')]('/',auth[_0xf5dc('0x9')](),interaction[_0xf5dc('0xe')](_0xf5dc('0xf'),_0xf5dc('0x10')),controller[_0xf5dc('0x11')]);router[_0xf5dc('0xd')](_0xf5dc('0x12'),controller[_0xf5dc('0x13')]);router[_0xf5dc('0x14')](_0xf5dc('0xb'),auth[_0xf5dc('0x9')](),controller[_0xf5dc('0x15')]);router[_0xf5dc('0x14')](_0xf5dc('0x16'),auth[_0xf5dc('0x9')](),controller[_0xf5dc('0x17')]);router['put'](_0xf5dc('0x18'),auth[_0xf5dc('0x9')](),controller[_0xf5dc('0x19')]);router[_0xf5dc('0x1a')](_0xf5dc('0xb'),auth[_0xf5dc('0x9')](),controller[_0xf5dc('0x1b')]);module[_0xf5dc('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 0e52554..328d362 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 _0xcd05=['DATE','sequelize','BOOLEAN','ENUM','out','STRING'];(function(_0x1b9cd5,_0x103dc4){var _0x4c74ca=function(_0x460b5e){while(--_0x460b5e){_0x1b9cd5['push'](_0x1b9cd5['shift']());}};_0x4c74ca(++_0x103dc4);}(_0xcd05,0x163));var _0x5cd0=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0xcd05[_0x53c256];return _0x25feb6;};'use strict';var Sequelize=require(_0x5cd0('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5cd0('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5cd0('0x2')]('in',_0x5cd0('0x3')),'defaultValue':_0x5cd0('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x5cd0('0x4')]},'readAt':{'type':Sequelize[_0x5cd0('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x82f5=['medium','BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x228c64,_0x56b08b){var _0x2da93d=function(_0xd522a3){while(--_0xd522a3){_0x228c64['push'](_0x228c64['shift']());}};_0x2da93d(++_0x56b08b);}(_0x82f5,0x15d));var _0x582f=function(_0x306f82,_0x203824){_0x306f82=_0x306f82-0x0;var _0x5d4e59=_0x82f5[_0x306f82];return _0x5d4e59;};'use strict';var Sequelize=require(_0x582f('0x0'));module[_0x582f('0x1')]={'body':{'type':Sequelize[_0x582f('0x2')](_0x582f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x582f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x582f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x582f('0x6')](0xbe)},'phone':{'type':Sequelize[_0x582f('0x6')]},'readAt':{'type':Sequelize[_0x582f('0x7')]},'secret':{'type':Sequelize[_0x582f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 5c58e1e..3345a9d 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 _0xedd9=['ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','index','SmsMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','day','add','merge','filter','map','includeAll','findAll','rows','show','params','intersection','include','find','create','body','describe','sms-interactions','accept','sms','readAt','format','UserId','user','CmContact','get','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SIP/%s','event','rejectmessage','debug','received\x20delivery\x20report\x20from','type','inspect','MessageSid','messageId','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring'];(function(_0x5c2a7b,_0x487251){var _0x4e58f2=function(_0x46732d){while(--_0x46732d){_0x5c2a7b['push'](_0x5c2a7b['shift']());}};_0x4e58f2(++_0x487251);}(_0xedd9,0xfc));var _0x9edd=function(_0x2e4d07,_0xf12bb){_0x2e4d07=_0x2e4d07-0x0;var _0x3eb32c=_0xedd9[_0x2e4d07];return _0x3eb32c;};'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});function respondWithRpcPromise(_0x4d9a7,_0x13b6b6,_0x338f3c,_0x1042aa){return new BPromise(function(_0x75a4ab,_0x4ea60f){var _0x5f5bf4=_0x1042aa||client;return _0x5f5bf4[_0x9edd('0x1e')](_0x4d9a7,_0x338f3c)[_0x9edd('0x1f')](function(_0x5acf65){logger[_0x9edd('0x20')](_0x9edd('0x21'),_0x13b6b6,_0x9edd('0x22'));logger['debug'](_0x9edd('0x23'),_0x13b6b6,'request\x20sent',JSON[_0x9edd('0x24')](_0x5acf65));if(_0x5acf65[_0x9edd('0x25')]){if(_0x5acf65['error']['code']===0x1f4){logger[_0x9edd('0x25')]('SmsMessage,\x20%s,\x20%s',_0x13b6b6,_0x5acf65[_0x9edd('0x25')]['message']);return _0x4ea60f(_0x5acf65['error'][_0x9edd('0x26')]);}logger[_0x9edd('0x25')]('SmsMessage,\x20%s,\x20%s',_0x13b6b6,_0x5acf65['error'][_0x9edd('0x26')]);return _0x75a4ab(_0x5acf65[_0x9edd('0x25')][_0x9edd('0x26')]);}else{logger['info'](_0x9edd('0x21'),_0x13b6b6,_0x9edd('0x22'));_0x75a4ab(_0x5acf65[_0x9edd('0x27')][_0x9edd('0x26')]);}})[_0x9edd('0x28')](function(_0x4c75d2){logger[_0x9edd('0x25')](_0x9edd('0x21'),_0x13b6b6,_0x4c75d2);_0x4ea60f(_0x4c75d2);});});}function respondWithStatusCode(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xcc;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['sendStatus'](_0x2f9f86);}return _0x3a1ea5['status'](_0x2f9f86)[_0x9edd('0x29')]();};}function respondWithResult(_0xfeca7b,_0x8d67aa){_0x8d67aa=_0x8d67aa||0xc8;return function(_0x25e135){if(_0x25e135){return _0xfeca7b[_0x9edd('0x2a')](_0x8d67aa)['json'](_0x25e135);}};}function respondWithFilteredResult(_0x57a2cc,_0x214d0a){return function(_0x257a26){if(_0x257a26){var _0x1c762c=_0x257a26[_0x9edd('0x2b')],_0x52746a=_0x214d0a[_0x9edd('0x2c')],_0x238b22=_0x214d0a['offset']+_0x214d0a[_0x9edd('0x2d')],_0x28cfae;if(_0x238b22>=_0x1c762c){_0x238b22=_0x1c762c;_0x28cfae=0xc8;}else{_0x28cfae=0xce;}_0x57a2cc[_0x9edd('0x2a')](_0x28cfae);return _0x57a2cc[_0x9edd('0x2e')](_0x9edd('0x2f'),_0x52746a+'-'+_0x238b22+'/'+_0x1c762c)[_0x9edd('0x30')](_0x257a26);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x31')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x32')](_0x19b6c1);}return _0x209aba[_0x9edd('0x33')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x34')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x35')]()[_0x9edd('0x1f')](function(){_0x259259[_0x9edd('0x2a')](0xcc)[_0x9edd('0x29')]();});}};}function handleEntityNotFound(_0x21bc30,_0x2bc4ed){return function(_0x473068){if(!_0x473068){_0x21bc30[_0x9edd('0x36')](0x194);}return _0x473068;};}function handleError(_0xd0fd74,_0x2539c6){_0x2539c6=_0x2539c6||0x1f4;return function(_0x29e789){logger[_0x9edd('0x25')](_0x29e789[_0x9edd('0x37')]);if(_0x29e789[_0x9edd('0x38')]){delete _0x29e789['name'];}_0xd0fd74[_0x9edd('0x2a')](_0x2539c6)['send'](_0x29e789);};}exports[_0x9edd('0x39')]=function(_0x148630,_0x10d6fd){var _0x434d26={},_0x16770e={},_0x4fa5ab={'count':0x0,'rows':[]};var _0x6de835=db[_0x9edd('0x3a')][_0x9edd('0x3b')];_0x16770e[_0x9edd('0x3c')]=_[_0x9edd('0x3d')](_0x6de835);var _0x337e6c={'dateStart':_0x148630[_0x9edd('0x3e')][_0x9edd('0x3f')],'dateEnd':_0x148630[_0x9edd('0x3e')][_0x9edd('0x40')]};delete _0x148630['query'][_0x9edd('0x3f')];delete _0x148630['query'][_0x9edd('0x40')];_0x16770e['query']=_[_0x9edd('0x3d')](_0x148630[_0x9edd('0x3e')]);_0x16770e[_0x9edd('0x41')]=_['intersection'](_0x16770e[_0x9edd('0x3c')],_0x16770e[_0x9edd('0x3e')]);_0x434d26[_0x9edd('0x42')]=_['intersection'](_0x16770e[_0x9edd('0x3c')],qs['fields'](_0x148630[_0x9edd('0x3e')][_0x9edd('0x43')]));_0x434d26['attributes']=_0x434d26[_0x9edd('0x42')][_0x9edd('0x44')]?_0x434d26[_0x9edd('0x42')]:_0x16770e[_0x9edd('0x3c')];if(!_0x148630['query'][_0x9edd('0x45')]('nolimit')){_0x434d26[_0x9edd('0x2d')]=qs[_0x9edd('0x2d')](_0x148630['query'][_0x9edd('0x2d')]);_0x434d26['offset']=qs['offset'](_0x148630[_0x9edd('0x3e')][_0x9edd('0x2c')]);}_0x434d26[_0x9edd('0x46')]=qs[_0x9edd('0x47')](_0x148630[_0x9edd('0x3e')][_0x9edd('0x47')]);_0x434d26[_0x9edd('0x48')]=qs[_0x9edd('0x41')](_[_0x9edd('0x49')](_0x148630[_0x9edd('0x3e')],_0x16770e[_0x9edd('0x41')]));if(_0x337e6c[_0x9edd('0x3f')]){if(_0x337e6c[_0x9edd('0x40')]){_0x337e6c[_0x9edd('0x40')]=moment(_0x337e6c[_0x9edd('0x40')])['add'](0x1,_0x9edd('0x4a'));}else{_0x337e6c[_0x9edd('0x40')]=moment(_0x337e6c[_0x9edd('0x3f')])[_0x9edd('0x4b')](0x1,_0x9edd('0x4a'));}_[_0x9edd('0x4c')](_0x434d26[_0x9edd('0x48')],{'createdAt':{'$gte':_0x337e6c['dateStart'],'$lte':_0x337e6c['dateEnd']}});}if(_0x148630['query'][_0x9edd('0x4d')]){_0x434d26['where']=_[_0x9edd('0x4c')](_0x434d26[_0x9edd('0x48')],{'$or':_[_0x9edd('0x4e')](_0x434d26[_0x9edd('0x42')],function(_0x367791){var _0x53005b={};_0x53005b[_0x367791]={'$like':'%'+_0x148630[_0x9edd('0x3e')][_0x9edd('0x4d')]+'%'};return _0x53005b;})});}_0x434d26=_[_0x9edd('0x4c')]({},_0x434d26,_0x148630['options']);var _0x3626bc={'where':_0x434d26[_0x9edd('0x48')]};return db[_0x9edd('0x3a')][_0x9edd('0x2b')](_0x3626bc)[_0x9edd('0x1f')](function(_0x35bdec){_0x4fa5ab['count']=_0x35bdec;if(_0x148630[_0x9edd('0x3e')][_0x9edd('0x4f')]){_0x434d26['include']=[{'all':!![]}];}return db[_0x9edd('0x3a')][_0x9edd('0x50')](_0x434d26);})['then'](function(_0x2bd089){_0x4fa5ab[_0x9edd('0x51')]=_0x2bd089;return _0x4fa5ab;})[_0x9edd('0x1f')](respondWithFilteredResult(_0x10d6fd,_0x434d26))['catch'](handleError(_0x10d6fd,null));};exports[_0x9edd('0x52')]=function(_0x151157,_0x317a60){var _0x28c7bd={'raw':!![],'where':{'id':_0x151157[_0x9edd('0x53')]['id']}},_0x53f6e3={};_0x53f6e3[_0x9edd('0x3c')]=_[_0x9edd('0x3d')](db['SmsMessage'][_0x9edd('0x3b')]);_0x53f6e3[_0x9edd('0x3e')]=_['keys'](_0x151157[_0x9edd('0x3e')]);_0x53f6e3['filters']=_[_0x9edd('0x54')](_0x53f6e3[_0x9edd('0x3c')],_0x53f6e3[_0x9edd('0x3e')]);_0x28c7bd[_0x9edd('0x42')]=_[_0x9edd('0x54')](_0x53f6e3[_0x9edd('0x3c')],qs[_0x9edd('0x43')](_0x151157[_0x9edd('0x3e')][_0x9edd('0x43')]));_0x28c7bd[_0x9edd('0x42')]=_0x28c7bd[_0x9edd('0x42')]['length']?_0x28c7bd[_0x9edd('0x42')]:_0x53f6e3[_0x9edd('0x3c')];if(_0x151157[_0x9edd('0x3e')]['includeAll']){_0x28c7bd[_0x9edd('0x55')]=[{'all':!![]}];}_0x28c7bd=_['merge']({},_0x28c7bd,_0x151157['options']);return db['SmsMessage'][_0x9edd('0x56')](_0x28c7bd)[_0x9edd('0x1f')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x1f')](respondWithResult(_0x317a60,null))[_0x9edd('0x28')](handleError(_0x317a60,null));};exports['create']=function(_0x56b38b,_0x4e3c3e){return db[_0x9edd('0x3a')][_0x9edd('0x57')](_0x56b38b[_0x9edd('0x58')],{})[_0x9edd('0x1f')](respondWithResult(_0x4e3c3e,0xc9))[_0x9edd('0x28')](handleError(_0x4e3c3e,null));};exports[_0x9edd('0x34')]=function(_0x25906c,_0x1e3087){if(_0x25906c['body']['id']){delete _0x25906c[_0x9edd('0x58')]['id'];}return db['SmsMessage'][_0x9edd('0x56')]({'where':{'id':_0x25906c[_0x9edd('0x53')]['id']}})['then'](handleEntityNotFound(_0x1e3087,null))[_0x9edd('0x1f')](saveUpdates(_0x25906c[_0x9edd('0x58')],null))[_0x9edd('0x1f')](respondWithResult(_0x1e3087,null))['catch'](handleError(_0x1e3087,null));};exports[_0x9edd('0x35')]=function(_0x2e1ce3,_0x430eb4){return db[_0x9edd('0x3a')][_0x9edd('0x56')]({'where':{'id':_0x2e1ce3[_0x9edd('0x53')]['id']}})['then'](handleEntityNotFound(_0x430eb4,null))['then'](removeEntity(_0x430eb4,null))[_0x9edd('0x28')](handleError(_0x430eb4,null));};exports['describe']=function(_0x173ec9,_0x3e9a3e){return db[_0x9edd('0x3a')][_0x9edd('0x59')]()['then'](respondWithResult(_0x3e9a3e,null))[_0x9edd('0x28')](handleError(_0x3e9a3e,null));};var interaction_log=require('../../config/logger')(_0x9edd('0x5a'));exports[_0x9edd('0x5b')]=function(_0xc6bde6,_0x5ca123,_0x2651a2){var _0x57da5b={'channel':_0x9edd('0x5c')};if(_0xc6bde6[_0x9edd('0x58')]['id']){delete _0xc6bde6['body']['id'];}_0xc6bde6[_0x9edd('0x58')]['read']=!![];_0xc6bde6[_0x9edd('0x58')][_0x9edd('0x5d')]=moment()[_0x9edd('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0xc6bde6[_0x9edd('0x58')][_0x9edd('0x5f')]=_0xc6bde6[_0x9edd('0x58')][_0x9edd('0x5f')]||_0xc6bde6[_0x9edd('0x60')]['id'];return db['SmsMessage']['find']({'where':{'id':_0xc6bde6[_0x9edd('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x9edd('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x5ca123,null))['then'](saveUpdates(_0xc6bde6[_0x9edd('0x58')],null))['then'](function(_0x5cde37){if(_0x5cde37){_0x57da5b[_0x9edd('0x26')]=_0x5cde37[_0x9edd('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x9edd('0x56')]({'where':{'id':_0x5cde37[_0x9edd('0x63')]}});}return null;})[_0x9edd('0x1f')](handleEntityNotFound(_0x5ca123,null))['then'](function(_0x34b229){if(_0x34b229){return _0x34b229['update']({'UserId':_0xc6bde6[_0x9edd('0x58')][_0x9edd('0x5f')],'read1stAt':_['isNil'](_0x34b229[_0x9edd('0x64')])?moment()[_0x9edd('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9edd('0x1f')](function(_0x475dc3){if(_0x475dc3){_0x57da5b[_0x9edd('0x65')]=_0x475dc3[_0x9edd('0x62')]({'plain':!![]});interaction_log['info'](_0x9edd('0x66'),_0xc6bde6['user']['id'],_0xc6bde6[_0x9edd('0x60')][_0x9edd('0x38')],_0xc6bde6[_0x9edd('0x60')]['role'],_0x57da5b[_0x9edd('0x65')]['id'],_0xc6bde6[_0x9edd('0x58')]?JSON[_0x9edd('0x24')](_0xc6bde6[_0x9edd('0x58')]):_0x9edd('0x67'));return respondWithRpcPromise(_0x9edd('0x68'),_0x9edd('0x69'),_0x57da5b);}return null;})['then'](function(_0x5e29d0){if(_0x5e29d0){if(_0xc6bde6[_0x9edd('0x58')][_0x9edd('0x6a')]){_0x57da5b[_0x9edd('0x26')][_0x9edd('0x6b')]=util[_0x9edd('0x5e')]('SIP/%s',_0xc6bde6[_0x9edd('0x60')][_0x9edd('0x38')]);_0x57da5b[_0x9edd('0x26')]['channel']=_0x57da5b[_0x9edd('0x6c')];_0x57da5b[_0x9edd('0x26')]['event']=_0x9edd('0x5b');return respondWithRpcPromise(_0x9edd('0x6d'),'EventManager',{'event':_0x9edd('0x6e'),'message':_0x57da5b[_0x9edd('0x26')]},client9002)['then'](function(){return _0x57da5b;});}return _0x57da5b;}return null;})[_0x9edd('0x1f')](respondWithResult(_0x5ca123,null))['catch'](handleError(_0x5ca123,null));};var interaction_log=require('../../config/logger')(_0x9edd('0x5a'));exports[_0x9edd('0x32')]=function(_0x44b426,_0x5b56c7,_0x3c7df3){var _0x286e47={'agent':{},'channel':'sms'};if(_0x44b426[_0x9edd('0x58')]['id']){delete _0x44b426[_0x9edd('0x58')]['id'];}_0x44b426[_0x9edd('0x58')][_0x9edd('0x5f')]=_0x44b426['body']['UserId']||_0x44b426[_0x9edd('0x60')]['id'];_0x286e47['agent']['id']=_0x44b426[_0x9edd('0x58')][_0x9edd('0x5f')];return db[_0x9edd('0x3a')][_0x9edd('0x56')]({'where':{'id':_0x44b426[_0x9edd('0x53')]['id'],'UserId':null}})[_0x9edd('0x1f')](handleEntityNotFound(_0x5b56c7,null))[_0x9edd('0x1f')](function(_0x5a4d4b){if(_0x5a4d4b){_0x286e47[_0x9edd('0x26')]=_0x5a4d4b['get']({'plain':!![]});return db[_0x9edd('0x6f')][_0x9edd('0x56')]({'where':{'id':_0x5a4d4b[_0x9edd('0x63')]}});}return null;})[_0x9edd('0x1f')](handleEntityNotFound(_0x5b56c7,null))[_0x9edd('0x1f')](function(_0x3e284d){if(_0x3e284d){_0x286e47[_0x9edd('0x65')]=_0x3e284d['get']({'plain':!![]});interaction_log[_0x9edd('0x20')](_0x9edd('0x70'),_0x44b426['user']['id'],_0x44b426[_0x9edd('0x60')][_0x9edd('0x38')],_0x44b426['user'][_0x9edd('0x71')],_0x286e47[_0x9edd('0x65')]['id'],_0x44b426[_0x9edd('0x58')]?JSON['stringify'](_0x44b426[_0x9edd('0x58')]):_0x9edd('0x67'));return respondWithRpcPromise(_0x9edd('0x72'),'rejectMessage',_0x286e47);}return null;})['then'](function(_0x5378ca){if(_0x5378ca){_0x5378ca['message'][_0x9edd('0x6b')]=util[_0x9edd('0x5e')](_0x9edd('0x73'),_0x44b426['user']['name']);_0x5378ca['message'][_0x9edd('0x6c')]=_0x286e47[_0x9edd('0x6c')];_0x5378ca[_0x9edd('0x26')][_0x9edd('0x74')]=_0x9edd('0x32');respondWithRpcPromise(_0x9edd('0x6d'),_0x9edd('0x6d'),{'event':_0x9edd('0x75'),'message':_0x5378ca[_0x9edd('0x26')]},client9002);return _0x286e47;}return null;})[_0x9edd('0x1f')](respondWithResult(_0x5b56c7,null))[_0x9edd('0x28')](handleError(_0x5b56c7,null));};exports[_0x9edd('0x2a')]=function(_0x4cfa99,_0x367fc6,_0x29f3b2){if(_0x4cfa99[_0x9edd('0x58')]['id']){delete _0x4cfa99[_0x9edd('0x58')]['id'];}var _0x104afc;return db[_0x9edd('0x3a')][_0x9edd('0x56')]({'where':{'id':_0x4cfa99[_0x9edd('0x53')]['id']}})['then'](handleEntityNotFound(_0x367fc6,null))['then'](function(_0xe02a6){if(_0xe02a6){_0x104afc=_0xe02a6;return db['SmsAccount'][_0x9edd('0x56')]({'where':{'id':_0xe02a6['SmsAccountId']}});}})[_0x9edd('0x1f')](handleEntityNotFound(_0x367fc6,null))[_0x9edd('0x1f')](function(_0x554804){if(_0x554804){logger[_0x9edd('0x76')](_0x9edd('0x23'),'status',_0x9edd('0x77'),_0x554804[_0x9edd('0x78')],util[_0x9edd('0x79')](_0x4cfa99[_0x9edd('0x58')],{'showHidden':![],'depth':null}));switch(_0x554804[_0x9edd('0x78')]){case'twilio':if(_0x4cfa99[_0x9edd('0x58')][_0x9edd('0x7a')]&&_0x4cfa99[_0x9edd('0x58')][_0x9edd('0x7a')]===_0x104afc[_0x9edd('0x7b')]){return _0x104afc['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x9edd('0x79')](_0x4cfa99['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4cfa99[_0x9edd('0x58')][_0x9edd('0x7c')]&&_0x4cfa99[_0x9edd('0x58')][_0x9edd('0x7c')]===_0x104afc[_0x9edd('0x7b')]&&_[_0x9edd('0x7d')]([_0x9edd('0x7e'),_0x9edd('0x7f')],_0x4cfa99[_0x9edd('0x58')][_0x9edd('0x80')])>=0x0){return _0x104afc['update']({'read':!![]});}else{logger[_0x9edd('0x25')](_0x9edd('0x81'),_0x9edd('0x2a'),_0x9edd('0x82'),util[_0x9edd('0x79')](_0x4cfa99[_0x9edd('0x58')],{'showHidden':![],'depth':null}));}break;case _0x9edd('0x83'):var _0x36db47=_0x4cfa99['body']['results'][0x0];if(_0x36db47[_0x9edd('0x2a')][_0x9edd('0x84')]===_0x9edd('0x85')){return _0x104afc[_0x9edd('0x34')]({'read':!![]});}else{logger[_0x9edd('0x25')](_0x9edd('0x81'),_0x9edd('0x2a'),_0x9edd('0x83'),util[_0x9edd('0x79')](_0x4cfa99[_0x9edd('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x104afc;}})[_0x9edd('0x1f')](respondWithResult(_0x367fc6,null))[_0x9edd('0x28')](handleError(_0x367fc6,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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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 1e73af2..5422c53 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 _0xdd36=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x9e48c3,_0x226549){var _0x7fa7b2=function(_0x2a6eac){while(--_0x2a6eac){_0x9e48c3['push'](_0x9e48c3['shift']());}};_0x7fa7b2(++_0x226549);}(_0xdd36,0x124));var _0x6dd3=function(_0x3644b9,_0x5cd3a6){_0x3644b9=_0x3644b9-0x0;var _0x4d196d=_0xdd36[_0x3644b9];return _0x4d196d;};'use strict';var EventEmitter=require(_0x6dd3('0x0'));var SmsMessage=require(_0x6dd3('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6dd3('0x2')](0x0);var events={'afterCreate':_0x6dd3('0x3'),'afterUpdate':_0x6dd3('0x4'),'afterDestroy':_0x6dd3('0x5')};function emitEvent(_0x46c524){return function(_0x159205,_0x551aac,_0x20fe65){SmsMessageEvents[_0x6dd3('0x6')](_0x46c524+':'+_0x159205['id'],_0x159205);SmsMessageEvents['emit'](_0x46c524,_0x159205);_0x20fe65(null);};}for(var e in events){if(events[_0x6dd3('0x7')](e)){var event=events[e];SmsMessage[_0x6dd3('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x773c=['SmsMessage','setMaxListeners','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x509638,_0x31a56a){var _0x39da87=function(_0x12aa37){while(--_0x12aa37){_0x509638['push'](_0x509638['shift']());}};_0x39da87(++_0x31a56a);}(_0x773c,0x6e));var _0xc773=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0x773c[_0x39f34f];return _0x59fee1;};'use strict';var EventEmitter=require(_0xc773('0x0'));var SmsMessage=require(_0xc773('0x1'))['db'][_0xc773('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc773('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc773('0x4'),'afterDestroy':'remove'};function emitEvent(_0x58bcd2){return function(_0xecddc9,_0x28707c,_0x128824){SmsMessageEvents[_0xc773('0x5')](_0x58bcd2+':'+_0xecddc9['id'],_0xecddc9);SmsMessageEvents[_0xc773('0x5')](_0x58bcd2,_0xecddc9);_0x128824(null);};}for(var e in events){if(events[_0xc773('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xc773('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 e8791db..6522b1d 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 _0x5ad7=['messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','smsMethod','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','password','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','read','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','keys','length','createHash','hex','signature=','https://sms.csc.lv/external/get/send.php?','clickatell','https://platform.clickatell.com/messages','apiMessageId','Missing\x20parameters:\x20apiKey','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define','SmsMessage','sms_messages','messageId','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','then','update','createdAt','body','catch','error','SmsAccount','find','SmsAccountId','type','accountSid','authToken','phone'];(function(_0x35c7a0,_0x4293f9){var _0x498783=function(_0x568168){while(--_0x568168){_0x35c7a0['push'](_0x35c7a0['shift']());}};_0x498783(++_0x4293f9);}(_0x5ad7,0x176));var _0x75ad=function(_0x53a1b3,_0x49af05){_0x53a1b3=_0x53a1b3-0x0;var _0x458433=_0x5ad7[_0x53a1b3];return _0x458433;};'use strict';var _=require(_0x75ad('0x0'));var util=require(_0x75ad('0x1'));var logger=require(_0x75ad('0x2'))(_0x75ad('0x3'));var moment=require(_0x75ad('0x4'));var BPromise=require(_0x75ad('0x5'));var rp=require(_0x75ad('0x6'));var attributes=require('./smsMessage.attributes');module[_0x75ad('0x7')]=function(_0x2b4e2b,_0x3532c7){return _0x2b4e2b[_0x75ad('0x8')](_0x75ad('0x9'),attributes,{'tableName':_0x75ad('0xa'),'paranoid':![],'indexes':[{'name':_0x75ad('0xb'),'fields':['messageId']}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27dc7c,_0x35d48d,_0x36e1a3){var _0x4f2794=_0x2b4e2b['models'];var _0x5c2321=_0x27dc7c[_0x75ad('0xc')]({'plain':!![]});if(_0x5c2321['direction']['toLowerCase']()==='in'||_0x5c2321[_0x75ad('0xd')][_0x75ad('0xe')]()===_0x75ad('0xf')&&!_0x5c2321[_0x75ad('0x10')]&&!_[_0x75ad('0x11')](_0x5c2321[_0x75ad('0x12')])){_0x4f2794['SmsInteraction'][_0x75ad('0x13')]({'where':{'id':_0x5c2321[_0x75ad('0x14')]}})[_0x75ad('0x15')](function(_0x440712){if(_0x440712){_0x440712[_0x75ad('0x16')]({'lastMsgAt':_0x5c2321[_0x75ad('0x17')],'lastMsgDirection':_0x5c2321[_0x75ad('0xd')][_0x75ad('0xe')](),'lastMsgBody':_0x5c2321[_0x75ad('0x18')]});}})[_0x75ad('0x19')](function(_0x4cae69){console[_0x75ad('0x1a')](_0x4cae69);});}if(_0x5c2321['direction']===_0x75ad('0xf')&&!_0x5c2321[_0x75ad('0x10')]){var _0x5cb35d;_0x4f2794[_0x75ad('0x1b')][_0x75ad('0x1c')]({'where':{'id':_0x5c2321[_0x75ad('0x1d')]},'raw':!![]})[_0x75ad('0x15')](function(_0x5cfc7b){_0x5cb35d=_0x5cfc7b;if(_0x5cb35d&&_0x5cb35d[_0x75ad('0x1e')]){switch(_0x5cb35d['type']){case'twilio':var _0x1caab5=require('twilio');if(_0x5cb35d[_0x75ad('0x1f')]&&_0x5cb35d[_0x75ad('0x20')]&&_0x5cb35d[_0x75ad('0x21')]){var _0x7f3d32=new _0x1caab5(_0x5cb35d[_0x75ad('0x1f')],_0x5cb35d[_0x75ad('0x20')]);_0x7f3d32[_0x75ad('0x22')][_0x75ad('0x23')]({'body':_0x5c2321[_0x75ad('0x18')],'to':_0x5c2321[_0x75ad('0x21')],'from':_0x5cb35d[_0x75ad('0x21')],'statusCallback':_0x5cb35d[_0x75ad('0x24')]+_0x75ad('0x25')+_0x5c2321['id']+_0x75ad('0x26')+_0x5cb35d[_0x75ad('0x27')]})['then'](function(_0xdfa8a5){if(_0xdfa8a5['sid']){return _0x27dc7c[_0x75ad('0x16')]({'messageId':_0xdfa8a5[_0x75ad('0x28')]});}})[_0x75ad('0x19')](function(_0x4f5e8d){logger[_0x75ad('0x1a')](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x2b'),util[_0x75ad('0x2c')](_0x4f5e8d,{'showHidden':![],'depth':null}));});}else{logger[_0x75ad('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x75ad('0x2a'),_0x75ad('0x2b'),_0x75ad('0x2d'));}break;case'skebby':var _0xf01541='https://api.skebby.it/API/v1.0/REST/';if(_0x5cb35d[_0x75ad('0x2e')]&&_0x5cb35d['password']){var _0x5e91b4={'recipient':[_0x5c2321[_0x75ad('0x21')]],'message':_0x5c2321['body'],'message_type':_0x5cb35d[_0x75ad('0x2f')]};var _0x4dc368={'url':_0xf01541+'login?username='+_0x5cb35d[_0x75ad('0x2e')]+'&password='+_0x5cb35d['password'],'method':_0x75ad('0x30')};rp(_0x4dc368)[_0x75ad('0x15')](function(_0x4fe3ca){var _0xf201d4=_0x4fe3ca[_0x75ad('0x31')](';');var _0x64dc15={'user_key':_0xf201d4[0x0],'session_key':_0xf201d4[0x1]};_0x4dc368={'url':_0xf01541+_0x75ad('0x32'),'method':_0x75ad('0x33'),'headers':{'user_key':_0x64dc15['user_key'],'Session_key':_0x64dc15[_0x75ad('0x34')]},'json':!![],'body':_0x5e91b4};return rp(_0x4dc368);})['then'](function(_0x41ce65){if(_0x41ce65[_0x75ad('0x35')]>=0x1){var _0x28b0dd={'messageId':_0x41ce65[_0x75ad('0x36')]};if(_0x5cb35d[_0x75ad('0x2f')]!=='GP'||!_0x5cb35d[_0x75ad('0x37')]){_0x28b0dd['read']=!![];}return _0x27dc7c[_0x75ad('0x16')](_0x28b0dd);}else{return logger['error'](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x38'),util[_0x75ad('0x2c')](_0x41ce65,{'showHidden':![],'depth':null}));}})[_0x75ad('0x19')](function(_0x220ac3){return logger[_0x75ad('0x1a')](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x38'),util[_0x75ad('0x2c')](_0x220ac3,{'showHidden':![],'depth':null}));});}else{logger[_0x75ad('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x75ad('0x2a'),_0x75ad('0x38'),_0x75ad('0x39'));}break;case _0x75ad('0x3a'):if(_0x5cb35d[_0x75ad('0x20')]){var _0x1204e7={'recipient':_0x5c2321['phone'],'message':_0x5c2321[_0x75ad('0x18')],'sender':_0x5cb35d[_0x75ad('0x3b')]||_0x5cb35d[_0x75ad('0x21')],'authorization':_0x5cb35d['authToken']};var _0x35d48d={'method':_0x75ad('0x33'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x1204e7,'json':!![]};rp(_0x35d48d)[_0x75ad('0x15')](function(_0x278a5f){var _0x35a964={'messageId':_0x278a5f[_0x75ad('0x3c')]};if(!_0x5cb35d[_0x75ad('0x37')]){_0x35a964['read']=!![];}return _0x27dc7c[_0x75ad('0x16')](_0x35a964);})[_0x75ad('0x19')](function(_0xd0e187){logger[_0x75ad('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',util[_0x75ad('0x2c')](_0xd0e187,{'showHidden':![],'depth':null}));});}else{logger[_0x75ad('0x1a')](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x3a'),_0x75ad('0x3d'));}break;case'clicksend':if(_0x5cb35d[_0x75ad('0x2e')]&&_0x5cb35d[_0x75ad('0x3e')]){var _0x1204e7={'messages':[{'source':_0x75ad('0x3f'),'to':_0x5c2321['phone'],'body':_0x5c2321[_0x75ad('0x18')],'from':_0x5cb35d[_0x75ad('0x3b')]||_0x5cb35d[_0x75ad('0x21')]}]};var _0x5697d4=util[_0x75ad('0x40')](_0x75ad('0x41'),_0x5cb35d['username'],_0x5cb35d[_0x75ad('0x3e')]);var _0x35d48d={'method':_0x75ad('0x33'),'uri':_0x75ad('0x42'),'body':_0x1204e7,'headers':{'Authorization':util[_0x75ad('0x40')](_0x75ad('0x43'),new Buffer(_0x5697d4)[_0x75ad('0x44')]('base64'))},'json':!![]};rp(_0x35d48d)[_0x75ad('0x15')](function(_0x21b733){if(_0x21b733[_0x75ad('0x45')]>=0xc8&&_0x21b733[_0x75ad('0x45')]<=0xce){if(_0x21b733[_0x75ad('0x46')]&&_0x21b733[_0x75ad('0x46')]['queued_count']>0x0){var _0x2702dc=_['head'](_0x21b733[_0x75ad('0x46')]['messages']);var _0x39a31b={'messageId':_0x2702dc['message_id']};if(!_0x5cb35d[_0x75ad('0x37')]){_0x39a31b[_0x75ad('0x47')]=!![];}return _0x27dc7c[_0x75ad('0x16')](_0x39a31b);}else{logger[_0x75ad('0x1a')](_0x75ad('0x29'),_0x75ad('0x2a'),'clickSend',util[_0x75ad('0x2c')](_0x21b733,{'showHidden':![],'depth':null}));}}else{logger[_0x75ad('0x1a')](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x48'),util[_0x75ad('0x2c')](_0x21b733,{'showHidden':![],'depth':null}));}})[_0x75ad('0x19')](function(_0x16f275){logger[_0x75ad('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x75ad('0x2a'),_0x75ad('0x48'),util[_0x75ad('0x2c')](_0x16f275,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x75ad('0x2a'),_0x75ad('0x48'),_0x75ad('0x39'));}break;case _0x75ad('0x49'):if(_0x5cb35d[_0x75ad('0x4a')]&&_0x5cb35d['authToken']){var _0x1204e7={'dst':_0x5c2321[_0x75ad('0x21')],'text':_0x5c2321[_0x75ad('0x18')],'src':_0x5cb35d[_0x75ad('0x3b')]||_0x5cb35d['phone'],'url':_0x5cb35d[_0x75ad('0x24')]+'/api/sms/messages/'+_0x5c2321['id']+_0x75ad('0x26')+_0x5cb35d[_0x75ad('0x27')]};var _0x5697d4=util['format']('%s:%s',_0x5cb35d[_0x75ad('0x4a')],_0x5cb35d[_0x75ad('0x20')]);var _0x35d48d={'method':'POST','uri':util['format'](_0x75ad('0x4b'),_0x5cb35d[_0x75ad('0x4a')]),'body':_0x1204e7,'headers':{'Authorization':util['format'](_0x75ad('0x43'),new Buffer(_0x5697d4)['toString'](_0x75ad('0x4c')))},'json':!![]};rp(_0x35d48d)[_0x75ad('0x15')](function(_0x513bdf){var _0x5cf1c1={'messageId':_0x513bdf[_0x75ad('0x4d')][0x0]};return _0x27dc7c[_0x75ad('0x16')](_0x5cf1c1);})['catch'](function(_0x2decdf){logger[_0x75ad('0x1a')](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x49'),util[_0x75ad('0x2c')](_0x2decdf,{'showHidden':![],'depth':null}));});}else{logger[_0x75ad('0x1a')](_0x75ad('0x29'),'afterCreate',_0x75ad('0x49'),_0x75ad('0x4e'));}break;case'infobip':if(_0x5cb35d[_0x75ad('0x2e')]&&_0x5cb35d[_0x75ad('0x3e')]){if(_0x5cb35d[_0x75ad('0x4f')]){var _0x1a48b4={'method':_0x75ad('0x33'),'uri':_0x5cb35d[_0x75ad('0x4f')]+_0x75ad('0x50'),'body':{'username':_0x5cb35d[_0x75ad('0x2e')],'password':_0x5cb35d['password']},'json':!![]};return rp(_0x1a48b4)[_0x75ad('0x15')](function(_0x578563){var _0x5d2066={'method':'POST','uri':_0x5cb35d['baseUrl']+_0x75ad('0x51'),'body':{'messages':[{'from':_0x5cb35d[_0x75ad('0x21')],'destinations':[{'to':_0x5c2321[_0x75ad('0x21')]}],'text':_0x5c2321[_0x75ad('0x18')],'notifyUrl':_0x5cb35d[_0x75ad('0x24')]+_0x75ad('0x25')+_0x5c2321['id']+'/status?token='+_0x5cb35d[_0x75ad('0x27')],'notifyContentType':'application/json','callbackData':_0x5cb35d['phone']+';'+_0x5c2321[_0x75ad('0x18')]}]},'headers':{'Authorization':_0x75ad('0x52')+_0x578563['token']},'json':!![]};return rp(_0x5d2066)[_0x75ad('0x15')](function(_0x17bcde){if(_0x17bcde['messages']){var _0x391842={'messageId':_0x17bcde[_0x75ad('0x22')][0x0][_0x75ad('0xb')]};if(!_0x5cb35d[_0x75ad('0x37')]){_0x391842[_0x75ad('0x47')]=!![];}return _0x27dc7c[_0x75ad('0x16')](_0x391842);}else{return logger['error'](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x53'),util[_0x75ad('0x2c')](_0x17bcde,{'showHidden':![],'depth':null}));}});})[_0x75ad('0x19')](function(_0x55af7d){return logger[_0x75ad('0x1a')](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x53'),util['inspect'](_0x55af7d,{'showHidden':![],'depth':null}));});}else{logger[_0x75ad('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x75ad('0x2a'),'infobip',_0x75ad('0x54'));}}else{logger[_0x75ad('0x1a')](_0x75ad('0x29'),'afterCreate',_0x75ad('0x53'),_0x75ad('0x39'));}case _0x75ad('0x55'):var _0x19a288=require(_0x75ad('0x56'));if(_0x5cb35d[_0x75ad('0x57')]){var _0x1fab66={};_0x1fab66[_0x75ad('0x58')]=_0x5cb35d[_0x75ad('0x2e')];_0x1fab66[_0x75ad('0x21')]=_0x5c2321[_0x75ad('0x21')];_0x1fab66[_0x75ad('0x59')]=_0x5cb35d['phone'];_0x1fab66['text']=_0x5c2321[_0x75ad('0x18')];_0x1fab66['timestamp']=+new Date();var _0x4345e2='';var _0x2c3776='';var _0x48a96e=Object[_0x75ad('0x5a')](_0x1fab66);_0x48a96e['sort']();for(var _0x4af4db=0x0;_0x4af4db<_0x48a96e[_0x75ad('0x5b')];_0x4af4db++){if(_0x4345e2!=''){_0x4345e2+='&';}_0x4345e2+=_0x48a96e[_0x4af4db]+'='+encodeURIComponent(_0x1fab66[_0x48a96e[_0x4af4db]]);_0x2c3776+=_0x1fab66[_0x48a96e[_0x4af4db]];}_0x2c3776+=_0x5cb35d['apiKey'];_0x2c3776=_0x19a288[_0x75ad('0x5c')]('md5')[_0x75ad('0x16')](_0x2c3776)['digest'](_0x75ad('0x5d'));if(_0x4345e2!==''){_0x4345e2+='&';}_0x4345e2+=_0x75ad('0x5e')+_0x2c3776;var _0x4dc368={'method':_0x75ad('0x30'),'uri':_0x75ad('0x5f')+_0x4345e2,'json':!![]};return rp(_0x4dc368)['then'](function(_0xa156f7){var _0x2c3c42=Object[_0x75ad('0x5a')](_0xa156f7);if(_0xa156f7[_0x2c3c42[0x0]][_0x75ad('0x1a')]&&parseInt(_0xa156f7[_0x2c3c42[0x0]][_0x75ad('0x1a')])===0x0){var _0x4451cd={'messageId':_0xa156f7[_0x2c3c42[0x0]]['id_sms']};if(!_0x5cb35d['deliveryReport']){_0x4451cd[_0x75ad('0x47')]=!![];}return _0x27dc7c['update'](_0x4451cd);}else{return logger[_0x75ad('0x1a')](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x55'),util[_0x75ad('0x2c')](_0xa156f7['error'],{'showHidden':![],'depth':null}));}})[_0x75ad('0x19')](function(_0x419087){return logger[_0x75ad('0x1a')](_0x75ad('0x29'),'afterCreate',_0x75ad('0x55'),util[_0x75ad('0x2c')](_0x419087,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x75ad('0x29'),'afterCreate',_0x75ad('0x55'),'Missing\x20parameters:\x20apiKey');}case _0x75ad('0x60'):if(_0x5cb35d[_0x75ad('0x57')]){var _0x2ea6a7={'method':'POST','uri':_0x75ad('0x61'),'headers':{'Authorization':_0x5cb35d[_0x75ad('0x57')]},'body':{'content':_0x5c2321[_0x75ad('0x18')],'to':[_0x5c2321[_0x75ad('0x21')]],'from':_0x5cb35d[_0x75ad('0x21')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x2ea6a7)[_0x75ad('0x15')](function(_0x405ae6){if(!_0x405ae6['error']){var _0xa32e6c={'messageId':_0x405ae6[_0x75ad('0x22')][0x0][_0x75ad('0x62')]};if(!_0x5cb35d[_0x75ad('0x37')]){_0xa32e6c['read']=!![];}return _0x27dc7c[_0x75ad('0x16')](_0xa32e6c);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x75ad('0x2a'),_0x75ad('0x60'),util['inspect'](_0x405ae6[_0x75ad('0x1a')],{'showHidden':![],'depth':null}));}})[_0x75ad('0x19')](function(_0x300b59){return logger[_0x75ad('0x1a')](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x60'),util[_0x75ad('0x2c')](_0x300b59,{'showHidden':![],'depth':null}));});}else{logger[_0x75ad('0x1a')](_0x75ad('0x29'),_0x75ad('0x2a'),_0x75ad('0x60'),_0x75ad('0x63'));}break;}}})[_0x75ad('0x64')](function(){_0x36e1a3();});}else{_0x36e1a3();}}},'charset':'utf8mb4','collate':_0x75ad('0x65')});}; \ No newline at end of file +var _0x33cc=['request-promise','exports','define','SmsMessage','sms_messages','messageId','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','SmsAccountId','then','type','twilio','accountSid','phone','authToken','messages','create','body','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','login?username=','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/send/','requestid','connectel','inspect','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','/status?token=','token','%s:%s','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','remote','application/json','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sender','text','timestamp','sort','length','createHash','md5','digest','hex','signature=','https://sms.csc.lv/external/get/send.php?','keys','csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird'];(function(_0x43fda2,_0x1c5662){var _0xa492a2=function(_0x3a92c4){while(--_0x3a92c4){_0x43fda2['push'](_0x43fda2['shift']());}};_0xa492a2(++_0x1c5662);}(_0x33cc,0x6b));var _0xc33c=function(_0x62d17f,_0x51e932){_0x62d17f=_0x62d17f-0x0;var _0x152f39=_0x33cc[_0x62d17f];return _0x152f39;};'use strict';var _=require(_0xc33c('0x0'));var util=require(_0xc33c('0x1'));var logger=require(_0xc33c('0x2'))(_0xc33c('0x3'));var moment=require('moment');var BPromise=require(_0xc33c('0x4'));var rp=require(_0xc33c('0x5'));var attributes=require('./smsMessage.attributes');module[_0xc33c('0x6')]=function(_0x2a5e6d,_0x12e2a2){return _0x2a5e6d[_0xc33c('0x7')](_0xc33c('0x8'),attributes,{'tableName':_0xc33c('0x9'),'paranoid':![],'indexes':[{'name':_0xc33c('0xa'),'fields':[_0xc33c('0xa')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38dbc6,_0x3311fc,_0x4a326a){var _0x2d8307=_0x2a5e6d[_0xc33c('0xb')];var _0x4a0c4e=_0x38dbc6['get']({'plain':!![]});if(_0x4a0c4e[_0xc33c('0xc')]['toLowerCase']()==='in'||_0x4a0c4e['direction'][_0xc33c('0xd')]()===_0xc33c('0xe')&&!_0x4a0c4e[_0xc33c('0xf')]&&!_[_0xc33c('0x10')](_0x4a0c4e[_0xc33c('0x11')])){_0x2d8307[_0xc33c('0x12')][_0xc33c('0x13')]({'where':{'id':_0x4a0c4e[_0xc33c('0x14')]}})['then'](function(_0x14ddf7){if(_0x14ddf7){_0x14ddf7[_0xc33c('0x15')]({'lastMsgAt':_0x4a0c4e[_0xc33c('0x16')],'lastMsgDirection':_0x4a0c4e['direction'][_0xc33c('0xd')](),'lastMsgBody':_0x4a0c4e['body']});}})[_0xc33c('0x17')](function(_0x323604){console[_0xc33c('0x18')](_0x323604);});}if(_0x4a0c4e[_0xc33c('0xc')]==='out'&&!_0x4a0c4e[_0xc33c('0xf')]){var _0x4d3e93;_0x2d8307[_0xc33c('0x19')]['find']({'where':{'id':_0x4a0c4e[_0xc33c('0x1a')]},'raw':!![]})[_0xc33c('0x1b')](function(_0x4f4898){_0x4d3e93=_0x4f4898;if(_0x4d3e93&&_0x4d3e93[_0xc33c('0x1c')]){switch(_0x4d3e93[_0xc33c('0x1c')]){case _0xc33c('0x1d'):var _0x315132=require(_0xc33c('0x1d'));if(_0x4d3e93[_0xc33c('0x1e')]&&_0x4d3e93['authToken']&&_0x4d3e93[_0xc33c('0x1f')]){var _0xd6cc1b=new _0x315132(_0x4d3e93[_0xc33c('0x1e')],_0x4d3e93[_0xc33c('0x20')]);_0xd6cc1b[_0xc33c('0x21')][_0xc33c('0x22')]({'body':_0x4a0c4e[_0xc33c('0x23')],'to':_0x4a0c4e[_0xc33c('0x1f')],'from':_0x4d3e93['phone'],'statusCallback':_0x4d3e93['remote']+_0xc33c('0x24')+_0x4a0c4e['id']+'/status?token='+_0x4d3e93['token']})['then'](function(_0x214668){if(_0x214668[_0xc33c('0x25')]){return _0x38dbc6[_0xc33c('0x15')]({'messageId':_0x214668[_0xc33c('0x25')]});}})[_0xc33c('0x17')](function(_0x47c72e){logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x1d'),util['inspect'](_0x47c72e,{'showHidden':![],'depth':null}));});}else{logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x1d'),_0xc33c('0x28'));}break;case'skebby':var _0x4d00c3=_0xc33c('0x29');if(_0x4d3e93[_0xc33c('0x2a')]&&_0x4d3e93[_0xc33c('0x2b')]){var _0x548ffe={'recipient':[_0x4a0c4e['phone']],'message':_0x4a0c4e['body'],'message_type':_0x4d3e93['smsMethod']};var _0x40caf1={'url':_0x4d00c3+_0xc33c('0x2c')+_0x4d3e93[_0xc33c('0x2a')]+_0xc33c('0x2d')+_0x4d3e93[_0xc33c('0x2b')],'method':_0xc33c('0x2e')};rp(_0x40caf1)[_0xc33c('0x1b')](function(_0x271394){var _0x487d5f=_0x271394[_0xc33c('0x2f')](';');var _0x23505e={'user_key':_0x487d5f[0x0],'session_key':_0x487d5f[0x1]};_0x40caf1={'url':_0x4d00c3+_0xc33c('0x30'),'method':_0xc33c('0x31'),'headers':{'user_key':_0x23505e[_0xc33c('0x32')],'Session_key':_0x23505e[_0xc33c('0x33')]},'json':!![],'body':_0x548ffe};return rp(_0x40caf1);})[_0xc33c('0x1b')](function(_0x289303){if(_0x289303['total_sent']>=0x1){var _0xbe353e={'messageId':_0x289303[_0xc33c('0x34')]};if(_0x4d3e93['smsMethod']!=='GP'||!_0x4d3e93[_0xc33c('0x35')]){_0xbe353e[_0xc33c('0x36')]=!![];}return _0x38dbc6[_0xc33c('0x15')](_0xbe353e);}else{return logger[_0xc33c('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc33c('0x37'),util['inspect'](_0x289303,{'showHidden':![],'depth':null}));}})[_0xc33c('0x17')](function(_0x54e15e){return logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x37'),util['inspect'](_0x54e15e,{'showHidden':![],'depth':null}));});}else{logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),'skebby',_0xc33c('0x38'));}break;case'connectel':if(_0x4d3e93['authToken']){var _0x14c6ca={'recipient':_0x4a0c4e[_0xc33c('0x1f')],'message':_0x4a0c4e[_0xc33c('0x23')],'sender':_0x4d3e93[_0xc33c('0x39')]||_0x4d3e93[_0xc33c('0x1f')],'authorization':_0x4d3e93[_0xc33c('0x20')]};var _0x3311fc={'method':'POST','uri':_0xc33c('0x3a'),'body':_0x14c6ca,'json':!![]};rp(_0x3311fc)[_0xc33c('0x1b')](function(_0x3379de){var _0x22154a={'messageId':_0x3379de[_0xc33c('0x3b')]};if(!_0x4d3e93['deliveryReport']){_0x22154a[_0xc33c('0x36')]=!![];}return _0x38dbc6[_0xc33c('0x15')](_0x22154a);})[_0xc33c('0x17')](function(_0x2a0940){logger[_0xc33c('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc33c('0x27'),_0xc33c('0x3c'),util[_0xc33c('0x3d')](_0x2a0940,{'showHidden':![],'depth':null}));});}else{logger[_0xc33c('0x18')](_0xc33c('0x26'),'afterCreate',_0xc33c('0x3c'),_0xc33c('0x3e'));}break;case'clicksend':if(_0x4d3e93[_0xc33c('0x2a')]&&_0x4d3e93[_0xc33c('0x2b')]){var _0x14c6ca={'messages':[{'source':_0xc33c('0x3f'),'to':_0x4a0c4e['phone'],'body':_0x4a0c4e[_0xc33c('0x23')],'from':_0x4d3e93[_0xc33c('0x39')]||_0x4d3e93['phone']}]};var _0x340e14=util[_0xc33c('0x40')]('%s:%s',_0x4d3e93[_0xc33c('0x2a')],_0x4d3e93[_0xc33c('0x2b')]);var _0x3311fc={'method':'POST','uri':_0xc33c('0x41'),'body':_0x14c6ca,'headers':{'Authorization':util[_0xc33c('0x40')](_0xc33c('0x42'),new Buffer(_0x340e14)[_0xc33c('0x43')](_0xc33c('0x44')))},'json':!![]};rp(_0x3311fc)[_0xc33c('0x1b')](function(_0x1ed487){if(_0x1ed487[_0xc33c('0x45')]>=0xc8&&_0x1ed487['http_code']<=0xce){if(_0x1ed487[_0xc33c('0x46')]&&_0x1ed487[_0xc33c('0x46')][_0xc33c('0x47')]>0x0){var _0x180ce5=_[_0xc33c('0x48')](_0x1ed487[_0xc33c('0x46')]['messages']);var _0x4f66c7={'messageId':_0x180ce5[_0xc33c('0x49')]};if(!_0x4d3e93[_0xc33c('0x35')]){_0x4f66c7[_0xc33c('0x36')]=!![];}return _0x38dbc6[_0xc33c('0x15')](_0x4f66c7);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc33c('0x27'),'clickSend',util['inspect'](_0x1ed487,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc33c('0x27'),_0xc33c('0x4a'),util[_0xc33c('0x3d')](_0x1ed487,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4221b){logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x4a'),util[_0xc33c('0x3d')](_0x4221b,{'showHidden':![],'depth':null}));});}else{logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xc33c('0x4b'):if(_0x4d3e93['authId']&&_0x4d3e93[_0xc33c('0x20')]){var _0x14c6ca={'dst':_0x4a0c4e['phone'],'text':_0x4a0c4e['body'],'src':_0x4d3e93[_0xc33c('0x39')]||_0x4d3e93[_0xc33c('0x1f')],'url':_0x4d3e93['remote']+_0xc33c('0x24')+_0x4a0c4e['id']+_0xc33c('0x4c')+_0x4d3e93[_0xc33c('0x4d')]};var _0x340e14=util[_0xc33c('0x40')](_0xc33c('0x4e'),_0x4d3e93[_0xc33c('0x4f')],_0x4d3e93[_0xc33c('0x20')]);var _0x3311fc={'method':_0xc33c('0x31'),'uri':util[_0xc33c('0x40')](_0xc33c('0x50'),_0x4d3e93[_0xc33c('0x4f')]),'body':_0x14c6ca,'headers':{'Authorization':util[_0xc33c('0x40')](_0xc33c('0x42'),new Buffer(_0x340e14)['toString']('base64'))},'json':!![]};rp(_0x3311fc)[_0xc33c('0x1b')](function(_0x23defd){var _0x5b6af8={'messageId':_0x23defd[_0xc33c('0x51')][0x0]};return _0x38dbc6['update'](_0x5b6af8);})[_0xc33c('0x17')](function(_0x88bb19){logger[_0xc33c('0x18')](_0xc33c('0x26'),'afterCreate',_0xc33c('0x4b'),util[_0xc33c('0x3d')](_0x88bb19,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x4b'),_0xc33c('0x52'));}break;case _0xc33c('0x53'):if(_0x4d3e93[_0xc33c('0x2a')]&&_0x4d3e93[_0xc33c('0x2b')]){if(_0x4d3e93[_0xc33c('0x54')]){var _0x3ea812={'method':'POST','uri':_0x4d3e93[_0xc33c('0x54')]+_0xc33c('0x55'),'body':{'username':_0x4d3e93[_0xc33c('0x2a')],'password':_0x4d3e93[_0xc33c('0x2b')]},'json':!![]};return rp(_0x3ea812)[_0xc33c('0x1b')](function(_0x278b0a){var _0xe78078={'method':_0xc33c('0x31'),'uri':_0x4d3e93['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x4d3e93['phone'],'destinations':[{'to':_0x4a0c4e[_0xc33c('0x1f')]}],'text':_0x4a0c4e['body'],'notifyUrl':_0x4d3e93[_0xc33c('0x56')]+_0xc33c('0x24')+_0x4a0c4e['id']+_0xc33c('0x4c')+_0x4d3e93[_0xc33c('0x4d')],'notifyContentType':_0xc33c('0x57'),'callbackData':_0x4d3e93['phone']+';'+_0x4a0c4e[_0xc33c('0x23')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x278b0a['token']},'json':!![]};return rp(_0xe78078)[_0xc33c('0x1b')](function(_0x312be7){if(_0x312be7[_0xc33c('0x21')]){var _0x5a3a2f={'messageId':_0x312be7[_0xc33c('0x21')][0x0][_0xc33c('0xa')]};if(!_0x4d3e93[_0xc33c('0x35')]){_0x5a3a2f[_0xc33c('0x36')]=!![];}return _0x38dbc6['update'](_0x5a3a2f);}else{return logger['error'](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x53'),util['inspect'](_0x312be7,{'showHidden':![],'depth':null}));}});})[_0xc33c('0x17')](function(_0x3ebd74){return logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x53'),util[_0xc33c('0x3d')](_0x3ebd74,{'showHidden':![],'depth':null}));});}else{logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x53'),_0xc33c('0x58'));}}else{logger[_0xc33c('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc33c('0x53'),_0xc33c('0x38'));}case'csc':var _0x4ba5ca=require(_0xc33c('0x59'));if(_0x4d3e93[_0xc33c('0x5a')]){var _0x5d0447={};_0x5d0447[_0xc33c('0x5b')]=_0x4d3e93[_0xc33c('0x2a')];_0x5d0447['phone']=_0x4a0c4e[_0xc33c('0x1f')];_0x5d0447[_0xc33c('0x5c')]=_0x4d3e93[_0xc33c('0x1f')];_0x5d0447[_0xc33c('0x5d')]=_0x4a0c4e[_0xc33c('0x23')];_0x5d0447[_0xc33c('0x5e')]=+new Date();var _0x595c96='';var _0x1e8a4c='';var _0x33eb6f=Object['keys'](_0x5d0447);_0x33eb6f[_0xc33c('0x5f')]();for(var _0x19bf43=0x0;_0x19bf43<_0x33eb6f[_0xc33c('0x60')];_0x19bf43++){if(_0x595c96!=''){_0x595c96+='&';}_0x595c96+=_0x33eb6f[_0x19bf43]+'='+encodeURIComponent(_0x5d0447[_0x33eb6f[_0x19bf43]]);_0x1e8a4c+=_0x5d0447[_0x33eb6f[_0x19bf43]];}_0x1e8a4c+=_0x4d3e93[_0xc33c('0x5a')];_0x1e8a4c=_0x4ba5ca[_0xc33c('0x61')](_0xc33c('0x62'))[_0xc33c('0x15')](_0x1e8a4c)[_0xc33c('0x63')](_0xc33c('0x64'));if(_0x595c96!==''){_0x595c96+='&';}_0x595c96+=_0xc33c('0x65')+_0x1e8a4c;var _0x40caf1={'method':_0xc33c('0x2e'),'uri':_0xc33c('0x66')+_0x595c96,'json':!![]};return rp(_0x40caf1)[_0xc33c('0x1b')](function(_0x118697){var _0x4846ea=Object[_0xc33c('0x67')](_0x118697);if(_0x118697[_0x4846ea[0x0]][_0xc33c('0x18')]&&parseInt(_0x118697[_0x4846ea[0x0]][_0xc33c('0x18')])===0x0){var _0x55e59f={'messageId':_0x118697[_0x4846ea[0x0]]['id_sms']};if(!_0x4d3e93[_0xc33c('0x35')]){_0x55e59f[_0xc33c('0x36')]=!![];}return _0x38dbc6[_0xc33c('0x15')](_0x55e59f);}else{return logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x68'),util[_0xc33c('0x3d')](_0x118697[_0xc33c('0x18')],{'showHidden':![],'depth':null}));}})[_0xc33c('0x17')](function(_0x2b583e){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc33c('0x27'),_0xc33c('0x68'),util[_0xc33c('0x3d')](_0x2b583e,{'showHidden':![],'depth':null}));});}else{logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x68'),_0xc33c('0x69'));}case _0xc33c('0x6a'):if(_0x4d3e93['apiKey']){var _0x359675={'method':_0xc33c('0x31'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x4d3e93[_0xc33c('0x5a')]},'body':{'content':_0x4a0c4e['body'],'to':[_0x4a0c4e[_0xc33c('0x1f')]],'from':_0x4d3e93[_0xc33c('0x1f')],'binary':![],'clientMessageId':_0xc33c('0x6b'),'charset':_0xc33c('0x6c')},'json':!![]};rp(_0x359675)[_0xc33c('0x1b')](function(_0x5d0721){if(!_0x5d0721[_0xc33c('0x18')]){var _0x3adc00={'messageId':_0x5d0721[_0xc33c('0x21')][0x0][_0xc33c('0x6d')]};if(!_0x4d3e93[_0xc33c('0x35')]){_0x3adc00[_0xc33c('0x36')]=!![];}return _0x38dbc6[_0xc33c('0x15')](_0x3adc00);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc33c('0x27'),_0xc33c('0x6a'),util['inspect'](_0x5d0721['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x147f30){return logger[_0xc33c('0x18')](_0xc33c('0x26'),_0xc33c('0x27'),_0xc33c('0x6a'),util[_0xc33c('0x3d')](_0x147f30,{'showHidden':![],'depth':null}));});}else{logger[_0xc33c('0x18')](_0xc33c('0x26'),'afterCreate',_0xc33c('0x6a'),_0xc33c('0x69'));}break;}}})[_0xc33c('0x6e')](function(){_0x4a326a();});}else{_0x4a326a();}}},'charset':_0xc33c('0x6f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 156a2d4..5f3073f 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 _0x7da7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','debug','lodash','util','bluebird'];(function(_0x105645,_0x412ac4){var _0xf85a92=function(_0x5c8047){while(--_0x5c8047){_0x105645['push'](_0x105645['shift']());}};_0xf85a92(++_0x412ac4);}(_0x7da7,0x115));var _0x77da=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0x7da7[_0x1be3b3];return _0x4f8b2d;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require('moment');var BPromise=require(_0x77da('0x2'));var rs=require(_0x77da('0x3'));var fs=require('fs');var Redis=require(_0x77da('0x4'));var db=require(_0x77da('0x5'))['db'];var utils=require(_0x77da('0x6'));var logger=require(_0x77da('0x7'))(_0x77da('0x8'));var config=require('../../config/environment');var jayson=require(_0x77da('0x9'));var client=jayson[_0x77da('0xa')][_0x77da('0xb')]({'port':0x232a});config[_0x77da('0xc')]=_[_0x77da('0xd')](config[_0x77da('0xc')],{'host':_0x77da('0xe'),'port':0x18eb});var socket=require(_0x77da('0xf'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x77da('0x10')](socket);function respondWithRpcPromise(_0x5ad3f9,_0x1ee988,_0x5d3d22){return new BPromise(function(_0x826715,_0x5e21e1){return client[_0x77da('0x11')](_0x5ad3f9,_0x5d3d22)[_0x77da('0x12')](function(_0x513b60){logger[_0x77da('0x13')]('SmsMessage,\x20%s,\x20%s',_0x1ee988,_0x77da('0x14'));logger['debug'](_0x77da('0x15'),_0x1ee988,'request\x20sent',JSON[_0x77da('0x16')](_0x513b60));if(_0x513b60[_0x77da('0x17')]){if(_0x513b60[_0x77da('0x17')][_0x77da('0x18')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1ee988,_0x513b60['error'][_0x77da('0x19')]);return _0x5e21e1(_0x513b60['error'][_0x77da('0x19')]);}logger['error'](_0x77da('0x1a'),_0x1ee988,_0x513b60[_0x77da('0x17')][_0x77da('0x19')]);return _0x826715(_0x513b60[_0x77da('0x17')][_0x77da('0x19')]);}else{logger[_0x77da('0x13')](_0x77da('0x1a'),_0x1ee988,_0x77da('0x14'));_0x826715(_0x513b60[_0x77da('0x1b')][_0x77da('0x19')]);}})[_0x77da('0x1c')](function(_0x30285d){logger[_0x77da('0x17')](_0x77da('0x1a'),_0x1ee988,_0x30285d);_0x5e21e1(_0x30285d);});});}exports[_0x77da('0x1d')]=function(_0xebad7a){var _0x28c4a6=this;return new Promise(function(_0xa7b8f6,_0x31458e){return db[_0x77da('0x1e')][_0x77da('0x1f')](_0xebad7a['body'],{'raw':_0xebad7a['options']?_0xebad7a[_0x77da('0x20')][_0x77da('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x16f55d){logger[_0x77da('0x13')]('CreateSmsMessage',_0xebad7a);logger[_0x77da('0x22')](_0x77da('0x1d'),_0xebad7a,JSON[_0x77da('0x16')](_0x16f55d));_0xa7b8f6(_0x16f55d);})[_0x77da('0x1c')](function(_0x583a03){logger[_0x77da('0x17')]('CreateSmsMessage',_0x583a03[_0x77da('0x19')],_0xebad7a);_0x31458e(_0x28c4a6[_0x77da('0x17')](0x1f4,_0x583a03[_0x77da('0x19')]));});});}; \ No newline at end of file +var _0xd609=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsMessage','SmsMessage','body','options','raw','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request'];(function(_0x3cd7c1,_0x413e1b){var _0x1b42b2=function(_0x492d02){while(--_0x492d02){_0x3cd7c1['push'](_0x3cd7c1['shift']());}};_0x1b42b2(++_0x413e1b);}(_0xd609,0x1a3));var _0x9d60=function(_0x1dc2d8,_0x47f2d9){_0x1dc2d8=_0x1dc2d8-0x0;var _0x4600a0=_0xd609[_0x1dc2d8];return _0x4600a0;};'use strict';var _=require('lodash');var util=require(_0x9d60('0x0'));var moment=require('moment');var BPromise=require(_0x9d60('0x1'));var rs=require(_0x9d60('0x2'));var fs=require('fs');var Redis=require(_0x9d60('0x3'));var db=require(_0x9d60('0x4'))['db'];var utils=require(_0x9d60('0x5'));var logger=require('../../config/logger')(_0x9d60('0x6'));var config=require('../../config/environment');var jayson=require(_0x9d60('0x7'));var client=jayson[_0x9d60('0x8')]['http']({'port':0x232a});config[_0x9d60('0x9')]=_[_0x9d60('0xa')](config[_0x9d60('0x9')],{'host':_0x9d60('0xb'),'port':0x18eb});var socket=require(_0x9d60('0xc'))(new Redis(config[_0x9d60('0x9')]));require(_0x9d60('0xd'))['register'](socket);function respondWithRpcPromise(_0x477774,_0x562d22,_0x47ecbd){return new BPromise(function(_0x513c9c,_0x52e3a6){return client[_0x9d60('0xe')](_0x477774,_0x47ecbd)[_0x9d60('0xf')](function(_0x5948e1){logger[_0x9d60('0x10')](_0x9d60('0x11'),_0x562d22,_0x9d60('0x12'));logger[_0x9d60('0x13')](_0x9d60('0x14'),_0x562d22,_0x9d60('0x12'),JSON['stringify'](_0x5948e1));if(_0x5948e1[_0x9d60('0x15')]){if(_0x5948e1[_0x9d60('0x15')][_0x9d60('0x16')]===0x1f4){logger[_0x9d60('0x15')](_0x9d60('0x11'),_0x562d22,_0x5948e1[_0x9d60('0x15')][_0x9d60('0x17')]);return _0x52e3a6(_0x5948e1['error']['message']);}logger[_0x9d60('0x15')](_0x9d60('0x11'),_0x562d22,_0x5948e1[_0x9d60('0x15')][_0x9d60('0x17')]);return _0x513c9c(_0x5948e1[_0x9d60('0x15')][_0x9d60('0x17')]);}else{logger[_0x9d60('0x10')]('SmsMessage,\x20%s,\x20%s',_0x562d22,_0x9d60('0x12'));_0x513c9c(_0x5948e1[_0x9d60('0x18')][_0x9d60('0x17')]);}})['catch'](function(_0x2224ef){logger[_0x9d60('0x15')](_0x9d60('0x11'),_0x562d22,_0x2224ef);_0x52e3a6(_0x2224ef);});});}exports[_0x9d60('0x19')]=function(_0x53ee37){var _0x5b8683=this;return new Promise(function(_0x448f65,_0x474a70){return db[_0x9d60('0x1a')]['create'](_0x53ee37[_0x9d60('0x1b')],{'raw':_0x53ee37[_0x9d60('0x1c')]?_0x53ee37[_0x9d60('0x1c')][_0x9d60('0x1d')]===undefined?!![]:![]:!![]})[_0x9d60('0xf')](function(_0x59ad70){logger[_0x9d60('0x10')](_0x9d60('0x19'),_0x53ee37);logger[_0x9d60('0x13')](_0x9d60('0x19'),_0x53ee37,JSON['stringify'](_0x59ad70));_0x448f65(_0x59ad70);})[_0x9d60('0x1e')](function(_0x4d57cd){logger[_0x9d60('0x15')](_0x9d60('0x19'),_0x4d57cd[_0x9d60('0x17')],_0x53ee37);_0x474a70(_0x5b8683[_0x9d60('0x15')](0x1f4,_0x4d57cd[_0x9d60('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c12a4cb..db7fc8f 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 _0x55d1=['smsMessage:','./smsMessage.events','save','update','emit','register','length'];(function(_0x1220dc,_0x448145){var _0x264ada=function(_0x171972){while(--_0x171972){_0x1220dc['push'](_0x1220dc['shift']());}};_0x264ada(++_0x448145);}(_0x55d1,0xe8));var _0x155d=function(_0x38037a,_0x196abc){_0x38037a=_0x38037a-0x0;var _0x1a1246=_0x55d1[_0x38037a];return _0x1a1246;};'use strict';var SmsMessageEvents=require(_0x155d('0x0'));var events=[_0x155d('0x1'),'remove',_0x155d('0x2')];function createListener(_0x45e88e,_0x16c00c){return function(_0x3edf06){_0x16c00c[_0x155d('0x3')](_0x45e88e,_0x3edf06);};}function removeListener(_0x11c2e8,_0x5b5a56){return function(){SmsMessageEvents['removeListener'](_0x11c2e8,_0x5b5a56);};}exports[_0x155d('0x4')]=function(_0x33a4ae){for(var _0x1ff732=0x0,_0x208b71=events[_0x155d('0x5')];_0x1ff732<_0x208b71;_0x1ff732++){var _0x555623=events[_0x1ff732];var _0xd50820=createListener(_0x155d('0x6')+_0x555623,_0x33a4ae);SmsMessageEvents['on'](_0x555623,_0xd50820);}}; \ No newline at end of file +var _0xcaa4=['removeListener','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0xcaa4,0x14d));var _0x4caa=function(_0x517ead,_0x4b4376){_0x517ead=_0x517ead-0x0;var _0x3cba00=_0xcaa4[_0x517ead];return _0x3cba00;};'use strict';var SmsMessageEvents=require(_0x4caa('0x0'));var events=['save',_0x4caa('0x1'),_0x4caa('0x2')];function createListener(_0x4183ee,_0x3a4cb9){return function(_0x2ddbe7){_0x3a4cb9['emit'](_0x4183ee,_0x2ddbe7);};}function removeListener(_0x469b8a,_0x40cbc7){return function(){SmsMessageEvents[_0x4caa('0x3')](_0x469b8a,_0x40cbc7);};}exports['register']=function(_0x182e0b){for(var _0x226c6c=0x0,_0x18bd58=events[_0x4caa('0x4')];_0x226c6c<_0x18bd58;_0x226c6c++){var _0x3881d4=events[_0x226c6c];var _0x40eaa7=createListener(_0x4caa('0x5')+_0x3881d4,_0x182e0b);SmsMessageEvents['on'](_0x3881d4,_0x40eaa7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 37b3fa2..94a7931 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 _0x3f66=['create','addTeams','addAgents','update','delete','destroy','removeTeams','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x3f66,0x1e4));var _0x63f6=function(_0x49c957,_0x41f32e){_0x49c957=_0x49c957-0x0;var _0x4149d3=_0x3f66[_0x49c957];return _0x4149d3;};'use strict';var multer=require(_0x63f6('0x0'));var util=require(_0x63f6('0x1'));var path=require(_0x63f6('0x2'));var timeout=require('connect-timeout');var express=require(_0x63f6('0x3'));var router=express[_0x63f6('0x4')]();var auth=require(_0x63f6('0x5'));var interaction=require(_0x63f6('0x6'));var config=require(_0x63f6('0x7'));var controller=require(_0x63f6('0x8'));router[_0x63f6('0x9')]('/',auth[_0x63f6('0xa')](),controller['index']);router[_0x63f6('0x9')](_0x63f6('0xb'),auth[_0x63f6('0xa')](),controller[_0x63f6('0xc')]);router[_0x63f6('0x9')](_0x63f6('0xd'),auth[_0x63f6('0xa')](),controller[_0x63f6('0xe')]);router[_0x63f6('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x63f6('0xf')]);router[_0x63f6('0x9')](_0x63f6('0x10'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x63f6('0x11'),auth[_0x63f6('0xa')](),controller[_0x63f6('0x12')]);router[_0x63f6('0x13')]('/',auth[_0x63f6('0xa')](),controller[_0x63f6('0x14')]);router[_0x63f6('0x13')](_0x63f6('0x10'),auth[_0x63f6('0xa')](),controller[_0x63f6('0x15')]);router[_0x63f6('0x13')](_0x63f6('0x11'),auth[_0x63f6('0xa')](),controller[_0x63f6('0x16')]);router['put'](_0x63f6('0xd'),auth['isAuthenticated'](),controller[_0x63f6('0x17')]);router[_0x63f6('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x63f6('0x19')]);router[_0x63f6('0x18')](_0x63f6('0x10'),auth[_0x63f6('0xa')](),controller[_0x63f6('0x1a')]);router['delete'](_0x63f6('0x11'),auth[_0x63f6('0xa')](),controller['removeAgents']);module[_0x63f6('0x1b')]=router; \ No newline at end of file +var _0x1bbc=['../../config/environment','./smsQueue.controller','index','get','/describe','isAuthenticated','describe','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x329595,_0x15ce18){var _0x38f513=function(_0x546310){while(--_0x546310){_0x329595['push'](_0x329595['shift']());}};_0x38f513(++_0x15ce18);}(_0x1bbc,0x14d));var _0xc1bb=function(_0x350dc6,_0x36ab14){_0x350dc6=_0x350dc6-0x0;var _0x2e5887=_0x1bbc[_0x350dc6];return _0x2e5887;};'use strict';var multer=require(_0xc1bb('0x0'));var util=require(_0xc1bb('0x1'));var path=require(_0xc1bb('0x2'));var timeout=require(_0xc1bb('0x3'));var express=require(_0xc1bb('0x4'));var router=express[_0xc1bb('0x5')]();var auth=require(_0xc1bb('0x6'));var interaction=require(_0xc1bb('0x7'));var config=require(_0xc1bb('0x8'));var controller=require(_0xc1bb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1bb('0xa')]);router[_0xc1bb('0xb')](_0xc1bb('0xc'),auth[_0xc1bb('0xd')](),controller[_0xc1bb('0xe')]);router[_0xc1bb('0xb')]('/:id',auth[_0xc1bb('0xd')](),controller[_0xc1bb('0xf')]);router[_0xc1bb('0xb')]('/:id/members',auth[_0xc1bb('0xd')](),controller[_0xc1bb('0x10')]);router[_0xc1bb('0xb')](_0xc1bb('0x11'),auth[_0xc1bb('0xd')](),controller[_0xc1bb('0x12')]);router[_0xc1bb('0xb')](_0xc1bb('0x13'),auth['isAuthenticated'](),controller[_0xc1bb('0x14')]);router[_0xc1bb('0x15')]('/',auth[_0xc1bb('0xd')](),controller[_0xc1bb('0x16')]);router[_0xc1bb('0x15')](_0xc1bb('0x11'),auth['isAuthenticated'](),controller[_0xc1bb('0x17')]);router[_0xc1bb('0x15')](_0xc1bb('0x13'),auth[_0xc1bb('0xd')](),controller[_0xc1bb('0x18')]);router[_0xc1bb('0x19')]('/:id',auth[_0xc1bb('0xd')](),controller[_0xc1bb('0x1a')]);router[_0xc1bb('0x1b')](_0xc1bb('0x1c'),auth[_0xc1bb('0xd')](),controller[_0xc1bb('0x1d')]);router[_0xc1bb('0x1b')]('/:id/teams',auth[_0xc1bb('0xd')](),controller['removeTeams']);router[_0xc1bb('0x1b')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc1bb('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 78b1332..e86abe1 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 _0x432d=['rrmemory','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x405385,_0x56f573){var _0x43837b=function(_0x30e20e){while(--_0x30e20e){_0x405385['push'](_0x405385['shift']());}};_0x43837b(++_0x56f573);}(_0x432d,0x1a5));var _0xd432=function(_0x3bd478,_0x1bb19a){_0x3bd478=_0x3bd478-0x0;var _0x5d4211=_0x432d[_0x3bd478];return _0x5d4211;};'use strict';var Sequelize=require(_0xd432('0x0'));module[_0xd432('0x1')]={'name':{'type':Sequelize[_0xd432('0x2')],'unique':_0xd432('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd432('0x2')]},'timeout':{'type':Sequelize[_0xd432('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd432('0x5')](_0xd432('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x53de=['roundrobin','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x53de,0x151));var _0xe53d=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0x53de[_0x2ef8f1];return _0x17498d;};'use strict';var Sequelize=require('sequelize');module[_0xe53d('0x0')]={'name':{'type':Sequelize[_0xe53d('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe53d('0x1')]},'timeout':{'type':Sequelize[_0xe53d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe53d('0x3')](_0xe53d('0x4'),'beepall',_0xe53d('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index fc1082d..3325319 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 _0x2842=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','limit','Content-Range','save','update','then','destroy','SmsQueues','UserProfileResource','end','error','name','send','index','SmsQueue','rawAttributes','keys','query','dateStart','dateEnd','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','add','merge','filter','map','options','count','include','findAll','rows','catch','includeAll','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','body','params','describe','getMembers','findOne','hasOwnProperty','order','SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','ids','Agents','union','penalty','addTeams','removeTeams','removeAgents','addAgents','omit','spread','emit','userSmsQueue:remove','getAgents','eml-format','rimraf'];(function(_0x41cffb,_0x9816e3){var _0x154498=function(_0x1c63e4){while(--_0x1c63e4){_0x41cffb['push'](_0x41cffb['shift']());}};_0x154498(++_0x9816e3);}(_0x2842,0x1ba));var _0x2284=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2842[_0x3b380d];return _0x54502b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2284('0x0'));var rimraf=require(_0x2284('0x1'));var zipdir=require(_0x2284('0x2'));var jsonpatch=require(_0x2284('0x3'));var rp=require(_0x2284('0x4'));var moment=require('moment');var BPromise=require(_0x2284('0x5'));var Mustache=require(_0x2284('0x6'));var util=require('util');var path=require(_0x2284('0x7'));var sox=require(_0x2284('0x8'));var csv=require(_0x2284('0x9'));var ejs=require(_0x2284('0xa'));var fs=require('fs');var _=require(_0x2284('0xb'));var squel=require(_0x2284('0xc'));var crypto=require('crypto');var jsforce=require(_0x2284('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2284('0x9'));var querystring=require(_0x2284('0xe'));var Papa=require(_0x2284('0xf'));var Redis=require('ioredis');var qs=require(_0x2284('0x10'));var logger=require('../../config/logger')(_0x2284('0x11'));var utils=require(_0x2284('0x12'));var config=require(_0x2284('0x13'));var db=require(_0x2284('0x14'))['db'];config[_0x2284('0x15')]=_[_0x2284('0x16')](config[_0x2284('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x2284('0x17'))(new Redis(config['redis']));require(_0x2284('0x18'))[_0x2284('0x19')](socket);function respondWithStatusCode(_0x419d51,_0x39a510){_0x39a510=_0x39a510||0xcc;return function(_0x56b45b){if(_0x56b45b){return _0x419d51[_0x2284('0x1a')](_0x39a510);}return _0x419d51[_0x2284('0x1b')](_0x39a510)['end']();};}function respondWithResult(_0x41de4c,_0x5cb2a7){_0x5cb2a7=_0x5cb2a7||0xc8;return function(_0x4e09ba){if(_0x4e09ba){return _0x41de4c[_0x2284('0x1b')](_0x5cb2a7)[_0x2284('0x1c')](_0x4e09ba);}};}function respondWithFilteredResult(_0x46dfe2,_0x148d78){return function(_0x138f8c){if(_0x138f8c){var _0x578eff=_0x138f8c['count'],_0xfa1008=_0x148d78[_0x2284('0x1d')],_0x1ccb34=_0x148d78[_0x2284('0x1d')]+_0x148d78[_0x2284('0x1e')],_0xb7935d;if(_0x1ccb34>=_0x578eff){_0x1ccb34=_0x578eff;_0xb7935d=0xc8;}else{_0xb7935d=0xce;}_0x46dfe2[_0x2284('0x1b')](_0xb7935d);return _0x46dfe2['set'](_0x2284('0x1f'),_0xfa1008+'-'+_0x1ccb34+'/'+_0x578eff)[_0x2284('0x1c')](_0x138f8c);}return null;};}function patchUpdates(_0x48c319){return function(_0x823e25){try{jsonpatch['apply'](_0x823e25,_0x48c319,!![]);}catch(_0x367527){return BPromise['reject'](_0x367527);}return _0x823e25[_0x2284('0x20')]();};}function saveUpdates(_0x5d35ef,_0x36b6bc){return function(_0x132b87){if(_0x132b87){return _0x132b87[_0x2284('0x21')](_0x5d35ef)[_0x2284('0x22')](function(_0x22f440){return _0x22f440;});}return null;};}function removeEntity(_0x5bcff8,_0x3e8f59){return function(_0x43b99d){if(_0x43b99d){return _0x43b99d[_0x2284('0x23')]()[_0x2284('0x22')](function(){var _0x470002=_0x43b99d['get']({'plain':!![]});var _0x23e6f8=_0x2284('0x24');return db[_0x2284('0x25')][_0x2284('0x23')]({'where':{'type':_0x23e6f8,'resourceId':_0x470002['id']}})[_0x2284('0x22')](function(){return _0x43b99d;});})[_0x2284('0x22')](function(){_0x5bcff8[_0x2284('0x1b')](0xcc)[_0x2284('0x26')]();});}};}function handleEntityNotFound(_0x3aa78d,_0x5852c2){return function(_0x3b5f00){if(!_0x3b5f00){_0x3aa78d[_0x2284('0x1a')](0x194);}return _0x3b5f00;};}function handleError(_0x36b42a,_0x11049c){_0x11049c=_0x11049c||0x1f4;return function(_0x2cbf8b){logger[_0x2284('0x27')](_0x2cbf8b['stack']);if(_0x2cbf8b[_0x2284('0x28')]){delete _0x2cbf8b[_0x2284('0x28')];}_0x36b42a['status'](_0x11049c)[_0x2284('0x29')](_0x2cbf8b);};}exports[_0x2284('0x2a')]=function(_0x440272,_0x33303a){var _0x4d800d={},_0x2299f0={},_0x4234b8={'count':0x0,'rows':[]};var _0x364a3a=db[_0x2284('0x2b')][_0x2284('0x2c')];_0x2299f0['model']=_[_0x2284('0x2d')](_0x364a3a);var _0x45228d={'dateStart':_0x440272[_0x2284('0x2e')][_0x2284('0x2f')],'dateEnd':_0x440272[_0x2284('0x2e')][_0x2284('0x30')]};delete _0x440272[_0x2284('0x2e')][_0x2284('0x2f')];delete _0x440272[_0x2284('0x2e')][_0x2284('0x30')];_0x2299f0['query']=_[_0x2284('0x2d')](_0x440272['query']);_0x2299f0[_0x2284('0x31')]=_['intersection'](_0x2299f0[_0x2284('0x32')],_0x2299f0[_0x2284('0x2e')]);_0x4d800d[_0x2284('0x33')]=_[_0x2284('0x34')](_0x2299f0[_0x2284('0x32')],qs[_0x2284('0x35')](_0x440272[_0x2284('0x2e')][_0x2284('0x35')]));_0x4d800d[_0x2284('0x33')]=_0x4d800d[_0x2284('0x33')][_0x2284('0x36')]?_0x4d800d[_0x2284('0x33')]:_0x2299f0[_0x2284('0x32')];if(!_0x440272[_0x2284('0x2e')]['hasOwnProperty'](_0x2284('0x37'))){_0x4d800d[_0x2284('0x1e')]=qs['limit'](_0x440272[_0x2284('0x2e')][_0x2284('0x1e')]);_0x4d800d['offset']=qs[_0x2284('0x1d')](_0x440272[_0x2284('0x2e')][_0x2284('0x1d')]);}_0x4d800d['order']=qs[_0x2284('0x38')](_0x440272[_0x2284('0x2e')][_0x2284('0x38')]);_0x4d800d[_0x2284('0x39')]=qs[_0x2284('0x31')](_[_0x2284('0x3a')](_0x440272[_0x2284('0x2e')],_0x2299f0[_0x2284('0x31')]));if(_0x45228d[_0x2284('0x2f')]){if(_0x45228d[_0x2284('0x30')]){_0x45228d[_0x2284('0x30')]=moment(_0x45228d['dateEnd'])[_0x2284('0x3b')](0x1,'day');}else{_0x45228d[_0x2284('0x30')]=moment(_0x45228d[_0x2284('0x2f')])[_0x2284('0x3b')](0x1,'day');}_[_0x2284('0x3c')](_0x4d800d['where'],{'createdAt':{'$gte':_0x45228d[_0x2284('0x2f')],'$lte':_0x45228d[_0x2284('0x30')]}});}if(_0x440272['query'][_0x2284('0x3d')]){_0x4d800d['where']=_['merge'](_0x4d800d[_0x2284('0x39')],{'$or':_[_0x2284('0x3e')](_0x4d800d[_0x2284('0x33')],function(_0x2ab4c2){var _0xb46dbd={};_0xb46dbd[_0x2ab4c2]={'$like':'%'+_0x440272['query']['filter']+'%'};return _0xb46dbd;})});}_0x4d800d=_[_0x2284('0x3c')]({},_0x4d800d,_0x440272[_0x2284('0x3f')]);var _0x22b420={'where':_0x4d800d[_0x2284('0x39')]};return db[_0x2284('0x2b')][_0x2284('0x40')](_0x22b420)[_0x2284('0x22')](function(_0x383627){_0x4234b8['count']=_0x383627;if(_0x440272[_0x2284('0x2e')]['includeAll']){_0x4d800d[_0x2284('0x41')]=[{'all':!![]}];}return db[_0x2284('0x2b')][_0x2284('0x42')](_0x4d800d);})[_0x2284('0x22')](function(_0x396790){_0x4234b8[_0x2284('0x43')]=_0x396790;return _0x4234b8;})['then'](respondWithFilteredResult(_0x33303a,_0x4d800d))[_0x2284('0x44')](handleError(_0x33303a,null));};exports['show']=function(_0x7200eb,_0xd777a8){var _0x43140b={'raw':!![],'where':{'id':_0x7200eb['params']['id']}},_0x3decf9={};_0x3decf9[_0x2284('0x32')]=_[_0x2284('0x2d')](db[_0x2284('0x2b')]['rawAttributes']);_0x3decf9[_0x2284('0x2e')]=_[_0x2284('0x2d')](_0x7200eb['query']);_0x3decf9[_0x2284('0x31')]=_['intersection'](_0x3decf9[_0x2284('0x32')],_0x3decf9['query']);_0x43140b[_0x2284('0x33')]=_['intersection'](_0x3decf9[_0x2284('0x32')],qs[_0x2284('0x35')](_0x7200eb['query'][_0x2284('0x35')]));_0x43140b['attributes']=_0x43140b['attributes'][_0x2284('0x36')]?_0x43140b['attributes']:_0x3decf9[_0x2284('0x32')];if(_0x7200eb[_0x2284('0x2e')][_0x2284('0x45')]){_0x43140b[_0x2284('0x41')]=[{'all':!![]}];}_0x43140b=_[_0x2284('0x3c')]({},_0x43140b,_0x7200eb[_0x2284('0x3f')]);return db['SmsQueue'][_0x2284('0x46')](_0x43140b)[_0x2284('0x22')](handleEntityNotFound(_0xd777a8,null))[_0x2284('0x22')](respondWithResult(_0xd777a8,null))[_0x2284('0x44')](handleError(_0xd777a8,null));};exports['create']=function(_0x24964e,_0x58bea3){return db[_0x2284('0x2b')]['create'](_0x24964e['body'],{})[_0x2284('0x22')](function(_0x4a2af7){var _0x4be91f=_0x24964e[_0x2284('0x47')][_0x2284('0x48')]({'plain':!![]});if(!_0x4be91f)throw new Error(_0x2284('0x49'));if(_0x4be91f[_0x2284('0x4a')]===_0x2284('0x47')){var _0x1d1062=_0x4a2af7[_0x2284('0x48')]({'plain':!![]});var _0x3e6ec7=_0x2284('0x24');return db['UserProfileSection'][_0x2284('0x46')]({'where':{'name':_0x3e6ec7,'userProfileId':_0x4be91f[_0x2284('0x4b')]},'raw':!![]})[_0x2284('0x22')](function(_0x1c6cee){if(_0x1c6cee&&_0x1c6cee[_0x2284('0x4c')]===0x0){return db[_0x2284('0x25')][_0x2284('0x4d')]({'name':_0x1d1062[_0x2284('0x28')],'resourceId':_0x1d1062['id'],'type':_0x1c6cee[_0x2284('0x28')],'sectionId':_0x1c6cee['id']},{})['then'](function(){return _0x4a2af7;});}else{return _0x4a2af7;}})['catch'](function(_0x489bb1){logger[_0x2284('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x489bb1);throw _0x489bb1;});}return _0x4a2af7;})[_0x2284('0x22')](respondWithResult(_0x58bea3,0xc9))[_0x2284('0x44')](handleError(_0x58bea3,null));};exports[_0x2284('0x21')]=function(_0x5758ad,_0x2ba893){if(_0x5758ad['body']['id']){delete _0x5758ad[_0x2284('0x4e')]['id'];}return db[_0x2284('0x2b')]['find']({'where':{'id':_0x5758ad['params']['id']}})[_0x2284('0x22')](handleEntityNotFound(_0x2ba893,null))['then'](saveUpdates(_0x5758ad[_0x2284('0x4e')],null))[_0x2284('0x22')](respondWithResult(_0x2ba893,null))[_0x2284('0x44')](handleError(_0x2ba893,null));};exports[_0x2284('0x23')]=function(_0x553052,_0x3763ea){return db[_0x2284('0x2b')]['find']({'where':{'id':_0x553052[_0x2284('0x4f')]['id']}})[_0x2284('0x22')](handleEntityNotFound(_0x3763ea,null))[_0x2284('0x22')](removeEntity(_0x3763ea,null))[_0x2284('0x44')](handleError(_0x3763ea,null));};exports['describe']=function(_0x1e2263,_0x119a64){return db[_0x2284('0x2b')][_0x2284('0x50')]()[_0x2284('0x22')](respondWithResult(_0x119a64,null))[_0x2284('0x44')](handleError(_0x119a64,null));};exports[_0x2284('0x51')]=function(_0xfc6310,_0x157f50,_0x1833c8){var _0x1796e9={'raw':!![],'where':{}},_0x900046={},_0x356379;return db[_0x2284('0x2b')][_0x2284('0x52')]({'where':{'id':_0xfc6310[_0x2284('0x4f')]['id']}})[_0x2284('0x22')](handleEntityNotFound(_0x157f50,null))[_0x2284('0x22')](function(_0x35ee32){if(_0x35ee32){_0x356379=_0x35ee32[_0x2284('0x48')]({'plain':!![]});_0x900046[_0x2284('0x32')]=_[_0x2284('0x2d')](db['UserSmsQueue'][_0x2284('0x2c')]);_0x900046['query']=_[_0x2284('0x2d')](_0xfc6310['query']);_0x900046[_0x2284('0x31')]=_[_0x2284('0x34')](_0x900046[_0x2284('0x32')],_0x900046[_0x2284('0x2e')]);_0x1796e9['attributes']=_[_0x2284('0x34')](_0x900046[_0x2284('0x32')],qs[_0x2284('0x35')](_0xfc6310[_0x2284('0x2e')]['fields']));_0x1796e9[_0x2284('0x33')]=_0x1796e9[_0x2284('0x33')][_0x2284('0x36')]?_0x1796e9['attributes']:_0x900046['model'];if(!_0xfc6310[_0x2284('0x2e')][_0x2284('0x53')]('nolimit')){_0x1796e9[_0x2284('0x1e')]=qs['limit'](_0xfc6310[_0x2284('0x2e')][_0x2284('0x1e')]);_0x1796e9['offset']=qs[_0x2284('0x1d')](_0xfc6310[_0x2284('0x2e')][_0x2284('0x1d')]);}_0x1796e9[_0x2284('0x54')]=qs[_0x2284('0x38')](_0xfc6310[_0x2284('0x2e')][_0x2284('0x38')]);_0x1796e9[_0x2284('0x39')]=qs['filters'](_[_0x2284('0x3a')](_0xfc6310[_0x2284('0x2e')],_0x900046[_0x2284('0x31')]));_0x1796e9[_0x2284('0x39')][_0x2284('0x55')]=_0x35ee32['id'];if(_0xfc6310[_0x2284('0x2e')][_0x2284('0x3d')]){_0x1796e9[_0x2284('0x39')]=_[_0x2284('0x3c')](_0x1796e9[_0x2284('0x39')],{'$or':_[_0x2284('0x3e')](_0x1796e9[_0x2284('0x33')],function(_0x514713){var _0x47e4f4={};_0x47e4f4[_0x514713]={'$like':'%'+_0xfc6310['query'][_0x2284('0x3d')]+'%'};return _0x47e4f4;})});}_0x1796e9=_[_0x2284('0x3c')]({},_0x1796e9,_0xfc6310[_0x2284('0x3f')]);return db[_0x2284('0x56')][_0x2284('0x42')](_0x1796e9);}})[_0x2284('0x22')](function(_0x28c492){if(_0x28c492){return db[_0x2284('0x57')][_0x2284('0x58')]({'where':{'id':_[_0x2284('0x3e')](_0x28c492,_0x2284('0x59')),'role':_0x2284('0x5a')},'attributes':['id','name',_0x2284('0x5b'),_0x2284('0x5c'),_0x2284('0x5d')]});}})['then'](function(_0x477dae){if(_0x477dae){return{'count':_0x477dae[_0x2284('0x40')],'rows':_[_0x2284('0x3e')](_0x477dae[_0x2284('0x43')],function(_0x27668d){return{'membername':_0x27668d['name'],'UserId':_0x27668d['id'],'queue_name':_0x356379[_0x2284('0x28')],'SmsQueueId':_0x356379['id'],'interface':util[_0x2284('0x5e')]('%s/%s',_0x2284('0x5f'),_0x27668d['name']),'penalty':0x0,'paused':_0x27668d[_0x2284('0x5b')],'createdAt':_0x27668d[_0x2284('0x5d')],'updatedAt':_0x27668d[_0x2284('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x157f50,_0x1796e9))[_0x2284('0x44')](handleError(_0x157f50,null));};exports[_0x2284('0x60')]=function(_0x1609a8,_0x453719,_0x3022b5){var _0x4f4e89={};var _0x2b51a2={};var _0x598403;var _0x19a4f2;return db['SmsQueue'][_0x2284('0x52')]({'where':{'id':_0x1609a8[_0x2284('0x4f')]['id']}})[_0x2284('0x22')](handleEntityNotFound(_0x453719,null))[_0x2284('0x22')](function(_0x1153ba){if(_0x1153ba){_0x598403=_0x1153ba;_0x2b51a2[_0x2284('0x32')]=_['keys'](db[_0x2284('0x61')][_0x2284('0x2c')]);_0x2b51a2[_0x2284('0x2e')]=_[_0x2284('0x2d')](_0x1609a8[_0x2284('0x2e')]);_0x2b51a2[_0x2284('0x31')]=_[_0x2284('0x34')](_0x2b51a2[_0x2284('0x32')],_0x2b51a2['query']);_0x4f4e89[_0x2284('0x33')]=_['intersection'](_0x2b51a2['model'],qs[_0x2284('0x35')](_0x1609a8[_0x2284('0x2e')][_0x2284('0x35')]));_0x4f4e89['attributes']=_0x4f4e89['attributes'][_0x2284('0x36')]?_0x4f4e89[_0x2284('0x33')]:_0x2b51a2[_0x2284('0x32')];_0x4f4e89[_0x2284('0x54')]=qs[_0x2284('0x38')](_0x1609a8['query']['sort']);_0x4f4e89[_0x2284('0x39')]=qs[_0x2284('0x31')](_[_0x2284('0x3a')](_0x1609a8[_0x2284('0x2e')],_0x2b51a2[_0x2284('0x31')]));if(_0x1609a8['query'][_0x2284('0x3d')]){_0x4f4e89[_0x2284('0x39')]=_[_0x2284('0x3c')](_0x4f4e89[_0x2284('0x39')],{'$or':_['map'](_0x4f4e89[_0x2284('0x33')],function(_0x5e14e7){var _0x1c9ed6={};_0x1c9ed6[_0x5e14e7]={'$like':'%'+_0x1609a8[_0x2284('0x2e')][_0x2284('0x3d')]+'%'};return _0x1c9ed6;})});}_0x4f4e89=_[_0x2284('0x3c')]({},_0x4f4e89,_0x1609a8[_0x2284('0x3f')]);return _0x598403[_0x2284('0x60')](_0x4f4e89);}})[_0x2284('0x22')](function(_0x16b46e){if(_0x16b46e){_0x19a4f2=_0x16b46e[_0x2284('0x36')];if(!_0x1609a8[_0x2284('0x2e')][_0x2284('0x53')]('nolimit')){_0x4f4e89[_0x2284('0x1e')]=qs[_0x2284('0x1e')](_0x1609a8[_0x2284('0x2e')]['limit']);_0x4f4e89[_0x2284('0x1d')]=qs[_0x2284('0x1d')](_0x1609a8['query'][_0x2284('0x1d')]);}return _0x598403['getTeams'](_0x4f4e89);}})[_0x2284('0x22')](function(_0xbb6a84){if(_0xbb6a84){return _0xbb6a84?{'count':_0x19a4f2,'rows':_0xbb6a84}:null;}})[_0x2284('0x22')](respondWithResult(_0x453719,null))['catch'](handleError(_0x453719,null));};exports['addTeams']=function(_0x2af7f1,_0x3a4881,_0xc431ad){var _0x4841d3=[];var _0xbe02;return db['Team'][_0x2284('0x42')]({'where':{'id':_0x2af7f1[_0x2284('0x4e')][_0x2284('0x62')]},'attributes':['id'],'include':[{'model':db[_0x2284('0x57')],'as':_0x2284('0x63'),'attributes':['id'],'raw':!![]}]})[_0x2284('0x22')](function(_0x111e1d){if(_0x111e1d){for(var _0x2efd60=0x0;_0x2efd60<_0x111e1d[_0x2284('0x36')];_0x2efd60+=0x1){for(var _0x196403=0x0;_0x196403<_0x111e1d[_0x2efd60][_0x2284('0x63')][_0x2284('0x36')];_0x196403+=0x1){_0x4841d3=_[_0x2284('0x64')](_0x4841d3,[_0x111e1d[_0x2efd60][_0x2284('0x63')][_0x196403]['id']]);}}return _0x4841d3;}})[_0x2284('0x22')](function(_0x2cd912){if(_0x2cd912){return db['SmsQueue']['find']({'where':{'id':_0x2af7f1[_0x2284('0x4f')]['id']}});}})['then'](function(_0x284350){if(_0x284350){_0xbe02=_0x284350;return _0xbe02['addAgents'](_0x4841d3,{'penalty':_0x2af7f1[_0x2284('0x4e')][_0x2284('0x65')]});}})[_0x2284('0x22')](function(_0x4d2c01){if(_0x4d2c01){return _0xbe02[_0x2284('0x66')](_0x2af7f1[_0x2284('0x4e')][_0x2284('0x62')]);}})[_0x2284('0x22')](handleEntityNotFound(_0x3a4881,null))[_0x2284('0x22')](respondWithStatusCode(_0x3a4881,null))[_0x2284('0x44')](handleError(_0x3a4881,null));};exports[_0x2284('0x67')]=function(_0x4133b8,_0x172882,_0x2ef53d){var _0x27cfee=[];var _0x163dc7;return db['Team'][_0x2284('0x42')]({'where':{'id':_0x4133b8[_0x2284('0x2e')][_0x2284('0x62')]},'attributes':['id'],'include':[{'model':db[_0x2284('0x57')],'as':_0x2284('0x63'),'attributes':['id'],'raw':!![]}]})[_0x2284('0x22')](function(_0x705b33){if(_0x705b33){for(var _0x37a971=0x0;_0x37a971<_0x705b33[_0x2284('0x36')];_0x37a971+=0x1){for(var _0xedf940=0x0;_0xedf940<_0x705b33[_0x37a971][_0x2284('0x63')][_0x2284('0x36')];_0xedf940+=0x1){_0x27cfee=_[_0x2284('0x64')](_0x27cfee,[_0x705b33[_0x37a971][_0x2284('0x63')][_0xedf940]['id']]);}}return _0x27cfee;}})[_0x2284('0x22')](function(_0xf92e13){if(_0xf92e13){return db['SmsQueue'][_0x2284('0x46')]({'where':{'id':_0x4133b8[_0x2284('0x4f')]['id']}});}})[_0x2284('0x22')](function(_0x50af35){if(_0x50af35){_0x163dc7=_0x50af35;return _0x163dc7[_0x2284('0x68')](_0x27cfee);}})['then'](function(_0x7cc9a8){if(_0x163dc7){return _0x163dc7[_0x2284('0x67')](_0x4133b8[_0x2284('0x2e')][_0x2284('0x62')]);}})[_0x2284('0x22')](handleEntityNotFound(_0x172882,null))[_0x2284('0x22')](respondWithStatusCode(_0x172882,null))[_0x2284('0x44')](handleError(_0x172882,null));};exports[_0x2284('0x69')]=function(_0x1b22e5,_0x53a975,_0x486400){return db[_0x2284('0x2b')][_0x2284('0x46')]({'where':{'id':_0x1b22e5[_0x2284('0x4f')]['id']}})[_0x2284('0x22')](handleEntityNotFound(_0x53a975,null))['then'](function(_0x2f670c){if(_0x2f670c){return _0x2f670c['addAgents'](_0x1b22e5[_0x2284('0x4e')][_0x2284('0x62')],_[_0x2284('0x6a')](_0x1b22e5[_0x2284('0x4e')],['ids','id'])||{})[_0x2284('0x6b')](function(_0x28322e){for(var _0x7e9294=0x0;_0x7e9294<_0x1b22e5[_0x2284('0x4e')][_0x2284('0x62')][_0x2284('0x36')];_0x7e9294+=0x1){socket[_0x2284('0x6c')]('userSmsQueue:save',{'UserId':_0x1b22e5[_0x2284('0x4e')][_0x2284('0x62')][_0x7e9294],'SmsQueueId':_0x1b22e5[_0x2284('0x4f')]['id']});}return _0x28322e;});}})[_0x2284('0x22')](respondWithResult(_0x53a975,null))[_0x2284('0x44')](handleError(_0x53a975,null));};exports[_0x2284('0x68')]=function(_0x594cbb,_0x1d5cac,_0x2d417b){var _0x5f4eaf;return db['SmsQueue'][_0x2284('0x46')]({'where':{'id':_0x594cbb[_0x2284('0x4f')]['id']}})[_0x2284('0x22')](handleEntityNotFound(_0x1d5cac,null))[_0x2284('0x22')](function(_0x2a6221){if(_0x2a6221){return _0x2a6221[_0x2284('0x68')](_0x594cbb[_0x2284('0x2e')][_0x2284('0x62')])[_0x2284('0x22')](function(_0x9d331a){if(_['isArray'](_0x594cbb['query'][_0x2284('0x62')])){for(var _0x12fda1=0x0;_0x12fda1<_0x594cbb[_0x2284('0x2e')]['ids']['length'];_0x12fda1+=0x1){socket[_0x2284('0x6c')](_0x2284('0x6d'),{'UserId':_0x594cbb['query']['ids'][_0x12fda1],'SmsQueueId':_0x594cbb[_0x2284('0x4f')]['id']});}}else{socket[_0x2284('0x6c')](_0x2284('0x6d'),{'UserId':_0x594cbb[_0x2284('0x2e')][_0x2284('0x62')],'SmsQueueId':_0x594cbb['params']['id']});}});}})[_0x2284('0x22')](respondWithStatusCode(_0x1d5cac,null))[_0x2284('0x44')](handleError(_0x1d5cac,null));};exports[_0x2284('0x6e')]=function(_0x5d6a91,_0x38abba,_0x2d76f2){var _0x13eedc={};var _0x553b7b={};var _0xf831b1;var _0x5bac65;return db[_0x2284('0x2b')][_0x2284('0x52')]({'where':{'id':_0x5d6a91['params']['id']}})[_0x2284('0x22')](handleEntityNotFound(_0x38abba,null))[_0x2284('0x22')](function(_0x5b8506){if(_0x5b8506){_0xf831b1=_0x5b8506;_0x553b7b[_0x2284('0x32')]=_[_0x2284('0x2d')](db['User']['rawAttributes']);_0x553b7b[_0x2284('0x2e')]=_[_0x2284('0x2d')](_0x5d6a91[_0x2284('0x2e')]);_0x553b7b['filters']=_[_0x2284('0x34')](_0x553b7b[_0x2284('0x32')],_0x553b7b[_0x2284('0x2e')]);_0x13eedc[_0x2284('0x33')]=_[_0x2284('0x34')](_0x553b7b[_0x2284('0x32')],qs['fields'](_0x5d6a91[_0x2284('0x2e')][_0x2284('0x35')]));_0x13eedc[_0x2284('0x33')]=_0x13eedc[_0x2284('0x33')][_0x2284('0x36')]?_0x13eedc[_0x2284('0x33')]:_0x553b7b[_0x2284('0x32')];_0x13eedc[_0x2284('0x54')]=qs[_0x2284('0x38')](_0x5d6a91[_0x2284('0x2e')][_0x2284('0x38')]);_0x13eedc[_0x2284('0x39')]=qs['filters'](_[_0x2284('0x3a')](_0x5d6a91[_0x2284('0x2e')],_0x553b7b['filters']));if(_0x5d6a91[_0x2284('0x2e')][_0x2284('0x3d')]){_0x13eedc[_0x2284('0x39')]=_[_0x2284('0x3c')](_0x13eedc['where'],{'$or':_[_0x2284('0x3e')](_0x13eedc[_0x2284('0x33')],function(_0x3692b0){var _0x5be1d0={};_0x5be1d0[_0x3692b0]={'$like':'%'+_0x5d6a91[_0x2284('0x2e')][_0x2284('0x3d')]+'%'};return _0x5be1d0;})});}_0x13eedc=_[_0x2284('0x3c')]({},_0x13eedc,_0x5d6a91[_0x2284('0x3f')]);return _0xf831b1[_0x2284('0x6e')](_0x13eedc);}})[_0x2284('0x22')](function(_0x4c2deb){if(_0x4c2deb){_0x5bac65=_0x4c2deb[_0x2284('0x36')];if(!_0x5d6a91[_0x2284('0x2e')]['hasOwnProperty'](_0x2284('0x37'))){_0x13eedc['limit']=qs[_0x2284('0x1e')](_0x5d6a91[_0x2284('0x2e')][_0x2284('0x1e')]);_0x13eedc[_0x2284('0x1d')]=qs[_0x2284('0x1d')](_0x5d6a91[_0x2284('0x2e')][_0x2284('0x1d')]);}return _0xf831b1['getAgents'](_0x13eedc);}})[_0x2284('0x22')](function(_0x293dc5){if(_0x293dc5){return _0x293dc5?{'count':_0x5bac65,'rows':_0x293dc5}:null;}})['then'](respondWithResult(_0x38abba,null))['catch'](handleError(_0x38abba,null));}; \ No newline at end of file +var _0xaeba=['penalty','addTeams','removeTeams','Agents','removeAgents','omit','userSmsQueue:save','isArray','emit','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','end','error','stack','name','index','SmsQueue','model','query','dateStart','dateEnd','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','count','includeAll','findAll','rows','catch','show','params','keys','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','smsPause','getTeams','rawAttributes','Team','ids','union','addAgents'];(function(_0x23e80c,_0x2e64bd){var _0x1ade5b=function(_0x4a8575){while(--_0x4a8575){_0x23e80c['push'](_0x23e80c['shift']());}};_0x1ade5b(++_0x2e64bd);}(_0xaeba,0x1cf));var _0xaaeb=function(_0x264828,_0x254e3a){_0x264828=_0x264828-0x0;var _0x9e39e7=_0xaeba[_0x264828];return _0x9e39e7;};'use strict';var pdf=require(_0xaaeb('0x0'));var emlformat=require(_0xaaeb('0x1'));var rimraf=require(_0xaaeb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaaeb('0x3'));var moment=require(_0xaaeb('0x4'));var BPromise=require(_0xaaeb('0x5'));var Mustache=require('mustache');var util=require(_0xaaeb('0x6'));var path=require(_0xaaeb('0x7'));var sox=require('sox');var csv=require(_0xaaeb('0x8'));var ejs=require(_0xaaeb('0x9'));var fs=require('fs');var _=require(_0xaaeb('0xa'));var squel=require(_0xaaeb('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaaeb('0x8'));var querystring=require(_0xaaeb('0xc'));var Papa=require(_0xaaeb('0xd'));var Redis=require(_0xaaeb('0xe'));var qs=require(_0xaaeb('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xaaeb('0x10'));var config=require(_0xaaeb('0x11'));var db=require('../../mysqldb')['db'];config[_0xaaeb('0x12')]=_[_0xaaeb('0x13')](config[_0xaaeb('0x12')],{'host':_0xaaeb('0x14'),'port':0x18eb});var socket=require(_0xaaeb('0x15'))(new Redis(config['redis']));require(_0xaaeb('0x16'))[_0xaaeb('0x17')](socket);function respondWithStatusCode(_0x26e08a,_0x225d1d){_0x225d1d=_0x225d1d||0xcc;return function(_0x13f92d){if(_0x13f92d){return _0x26e08a[_0xaaeb('0x18')](_0x225d1d);}return _0x26e08a[_0xaaeb('0x19')](_0x225d1d)['end']();};}function respondWithResult(_0x16f69c,_0x550f63){_0x550f63=_0x550f63||0xc8;return function(_0x4551d7){if(_0x4551d7){return _0x16f69c[_0xaaeb('0x19')](_0x550f63)[_0xaaeb('0x1a')](_0x4551d7);}};}function respondWithFilteredResult(_0x565a5d,_0x529207){return function(_0x4add51){if(_0x4add51){var _0x1bafab=_0x4add51['count'],_0x4dd57c=_0x529207[_0xaaeb('0x1b')],_0xd43a3=_0x529207['offset']+_0x529207[_0xaaeb('0x1c')],_0x4707d1;if(_0xd43a3>=_0x1bafab){_0xd43a3=_0x1bafab;_0x4707d1=0xc8;}else{_0x4707d1=0xce;}_0x565a5d[_0xaaeb('0x19')](_0x4707d1);return _0x565a5d['set'](_0xaaeb('0x1d'),_0x4dd57c+'-'+_0xd43a3+'/'+_0x1bafab)['json'](_0x4add51);}return null;};}function patchUpdates(_0x41391e){return function(_0xe69893){try{jsonpatch['apply'](_0xe69893,_0x41391e,!![]);}catch(_0xf67866){return BPromise[_0xaaeb('0x1e')](_0xf67866);}return _0xe69893[_0xaaeb('0x1f')]();};}function saveUpdates(_0x4d7475,_0x4ff3c8){return function(_0x248729){if(_0x248729){return _0x248729[_0xaaeb('0x20')](_0x4d7475)[_0xaaeb('0x21')](function(_0x4e0470){return _0x4e0470;});}return null;};}function removeEntity(_0x25bd23,_0x200c8b){return function(_0x3edf66){if(_0x3edf66){return _0x3edf66[_0xaaeb('0x22')]()[_0xaaeb('0x21')](function(){var _0x4fd101=_0x3edf66[_0xaaeb('0x23')]({'plain':!![]});var _0x3b2859=_0xaaeb('0x24');return db[_0xaaeb('0x25')]['destroy']({'where':{'type':_0x3b2859,'resourceId':_0x4fd101['id']}})[_0xaaeb('0x21')](function(){return _0x3edf66;});})['then'](function(){_0x25bd23[_0xaaeb('0x19')](0xcc)[_0xaaeb('0x26')]();});}};}function handleEntityNotFound(_0x3edb8c,_0x59fb62){return function(_0x1de1be){if(!_0x1de1be){_0x3edb8c[_0xaaeb('0x18')](0x194);}return _0x1de1be;};}function handleError(_0x5db2e0,_0x5ecb47){_0x5ecb47=_0x5ecb47||0x1f4;return function(_0x3d7b7b){logger[_0xaaeb('0x27')](_0x3d7b7b[_0xaaeb('0x28')]);if(_0x3d7b7b[_0xaaeb('0x29')]){delete _0x3d7b7b[_0xaaeb('0x29')];}_0x5db2e0[_0xaaeb('0x19')](_0x5ecb47)['send'](_0x3d7b7b);};}exports[_0xaaeb('0x2a')]=function(_0x21c80d,_0xa722e0){var _0x3ca400={},_0x167f31={},_0x182d92={'count':0x0,'rows':[]};var _0xcc9265=db[_0xaaeb('0x2b')]['rawAttributes'];_0x167f31[_0xaaeb('0x2c')]=_['keys'](_0xcc9265);var _0x1e9c48={'dateStart':_0x21c80d[_0xaaeb('0x2d')][_0xaaeb('0x2e')],'dateEnd':_0x21c80d[_0xaaeb('0x2d')]['dateEnd']};delete _0x21c80d[_0xaaeb('0x2d')]['dateStart'];delete _0x21c80d['query'][_0xaaeb('0x2f')];_0x167f31[_0xaaeb('0x2d')]=_['keys'](_0x21c80d['query']);_0x167f31[_0xaaeb('0x30')]=_[_0xaaeb('0x31')](_0x167f31['model'],_0x167f31['query']);_0x3ca400[_0xaaeb('0x32')]=_[_0xaaeb('0x31')](_0x167f31[_0xaaeb('0x2c')],qs['fields'](_0x21c80d['query']['fields']));_0x3ca400[_0xaaeb('0x32')]=_0x3ca400[_0xaaeb('0x32')]['length']?_0x3ca400[_0xaaeb('0x32')]:_0x167f31[_0xaaeb('0x2c')];if(!_0x21c80d['query'][_0xaaeb('0x33')](_0xaaeb('0x34'))){_0x3ca400[_0xaaeb('0x1c')]=qs['limit'](_0x21c80d[_0xaaeb('0x2d')][_0xaaeb('0x1c')]);_0x3ca400[_0xaaeb('0x1b')]=qs['offset'](_0x21c80d['query'][_0xaaeb('0x1b')]);}_0x3ca400[_0xaaeb('0x35')]=qs[_0xaaeb('0x36')](_0x21c80d['query'][_0xaaeb('0x36')]);_0x3ca400[_0xaaeb('0x37')]=qs['filters'](_[_0xaaeb('0x38')](_0x21c80d[_0xaaeb('0x2d')],_0x167f31[_0xaaeb('0x30')]));if(_0x1e9c48['dateStart']){if(_0x1e9c48['dateEnd']){_0x1e9c48[_0xaaeb('0x2f')]=moment(_0x1e9c48[_0xaaeb('0x2f')])[_0xaaeb('0x39')](0x1,_0xaaeb('0x3a'));}else{_0x1e9c48['dateEnd']=moment(_0x1e9c48['dateStart'])['add'](0x1,_0xaaeb('0x3a'));}_[_0xaaeb('0x3b')](_0x3ca400['where'],{'createdAt':{'$gte':_0x1e9c48['dateStart'],'$lte':_0x1e9c48[_0xaaeb('0x2f')]}});}if(_0x21c80d['query'][_0xaaeb('0x3c')]){_0x3ca400[_0xaaeb('0x37')]=_[_0xaaeb('0x3b')](_0x3ca400['where'],{'$or':_[_0xaaeb('0x3d')](_0x3ca400[_0xaaeb('0x32')],function(_0x1a0713){var _0x543610={};_0x543610[_0x1a0713]={'$like':'%'+_0x21c80d[_0xaaeb('0x2d')][_0xaaeb('0x3c')]+'%'};return _0x543610;})});}_0x3ca400=_[_0xaaeb('0x3b')]({},_0x3ca400,_0x21c80d[_0xaaeb('0x3e')]);var _0x42987c={'where':_0x3ca400[_0xaaeb('0x37')]};return db[_0xaaeb('0x2b')][_0xaaeb('0x3f')](_0x42987c)['then'](function(_0x436829){_0x182d92[_0xaaeb('0x3f')]=_0x436829;if(_0x21c80d[_0xaaeb('0x2d')][_0xaaeb('0x40')]){_0x3ca400['include']=[{'all':!![]}];}return db[_0xaaeb('0x2b')][_0xaaeb('0x41')](_0x3ca400);})['then'](function(_0x25673e){_0x182d92[_0xaaeb('0x42')]=_0x25673e;return _0x182d92;})[_0xaaeb('0x21')](respondWithFilteredResult(_0xa722e0,_0x3ca400))[_0xaaeb('0x43')](handleError(_0xa722e0,null));};exports[_0xaaeb('0x44')]=function(_0x22989f,_0x194039){var _0x258397={'raw':!![],'where':{'id':_0x22989f[_0xaaeb('0x45')]['id']}},_0x988389={};_0x988389[_0xaaeb('0x2c')]=_[_0xaaeb('0x46')](db[_0xaaeb('0x2b')]['rawAttributes']);_0x988389['query']=_[_0xaaeb('0x46')](_0x22989f[_0xaaeb('0x2d')]);_0x988389['filters']=_[_0xaaeb('0x31')](_0x988389[_0xaaeb('0x2c')],_0x988389[_0xaaeb('0x2d')]);_0x258397[_0xaaeb('0x32')]=_[_0xaaeb('0x31')](_0x988389[_0xaaeb('0x2c')],qs[_0xaaeb('0x47')](_0x22989f[_0xaaeb('0x2d')][_0xaaeb('0x47')]));_0x258397['attributes']=_0x258397['attributes']['length']?_0x258397['attributes']:_0x988389[_0xaaeb('0x2c')];if(_0x22989f[_0xaaeb('0x2d')][_0xaaeb('0x40')]){_0x258397[_0xaaeb('0x48')]=[{'all':!![]}];}_0x258397=_[_0xaaeb('0x3b')]({},_0x258397,_0x22989f[_0xaaeb('0x3e')]);return db['SmsQueue'][_0xaaeb('0x49')](_0x258397)[_0xaaeb('0x21')](handleEntityNotFound(_0x194039,null))[_0xaaeb('0x21')](respondWithResult(_0x194039,null))[_0xaaeb('0x43')](handleError(_0x194039,null));};exports[_0xaaeb('0x4a')]=function(_0x5bc34d,_0x42eb98){return db[_0xaaeb('0x2b')][_0xaaeb('0x4a')](_0x5bc34d[_0xaaeb('0x4b')],{})[_0xaaeb('0x21')](function(_0x506e7c){var _0x2f32ae=_0x5bc34d[_0xaaeb('0x4c')]['get']({'plain':!![]});if(!_0x2f32ae)throw new Error(_0xaaeb('0x4d'));if(_0x2f32ae[_0xaaeb('0x4e')]==='user'){var _0x28450f=_0x506e7c['get']({'plain':!![]});var _0x4b2a3e='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x4b2a3e,'userProfileId':_0x2f32ae[_0xaaeb('0x4f')]},'raw':!![]})[_0xaaeb('0x21')](function(_0xecf9b2){if(_0xecf9b2&&_0xecf9b2[_0xaaeb('0x50')]===0x0){return db[_0xaaeb('0x25')][_0xaaeb('0x4a')]({'name':_0x28450f[_0xaaeb('0x29')],'resourceId':_0x28450f['id'],'type':_0xecf9b2[_0xaaeb('0x29')],'sectionId':_0xecf9b2['id']},{})[_0xaaeb('0x21')](function(){return _0x506e7c;});}else{return _0x506e7c;}})[_0xaaeb('0x43')](function(_0xc2b3a){logger['error'](_0xaaeb('0x51'),_0xc2b3a);throw _0xc2b3a;});}return _0x506e7c;})[_0xaaeb('0x21')](respondWithResult(_0x42eb98,0xc9))['catch'](handleError(_0x42eb98,null));};exports['update']=function(_0x59b101,_0xbf37bd){if(_0x59b101['body']['id']){delete _0x59b101['body']['id'];}return db[_0xaaeb('0x2b')][_0xaaeb('0x49')]({'where':{'id':_0x59b101['params']['id']}})['then'](handleEntityNotFound(_0xbf37bd,null))[_0xaaeb('0x21')](saveUpdates(_0x59b101[_0xaaeb('0x4b')],null))[_0xaaeb('0x21')](respondWithResult(_0xbf37bd,null))['catch'](handleError(_0xbf37bd,null));};exports['destroy']=function(_0x124eb1,_0x2f16a8){return db['SmsQueue']['find']({'where':{'id':_0x124eb1[_0xaaeb('0x45')]['id']}})[_0xaaeb('0x21')](handleEntityNotFound(_0x2f16a8,null))['then'](removeEntity(_0x2f16a8,null))[_0xaaeb('0x43')](handleError(_0x2f16a8,null));};exports[_0xaaeb('0x52')]=function(_0x372c69,_0x4f1ee4){return db[_0xaaeb('0x2b')]['describe']()[_0xaaeb('0x21')](respondWithResult(_0x4f1ee4,null))[_0xaaeb('0x43')](handleError(_0x4f1ee4,null));};exports[_0xaaeb('0x53')]=function(_0x28260f,_0x12971a,_0x559600){var _0x469d92={'raw':!![],'where':{}},_0x32e4cd={},_0x5d68b7;return db[_0xaaeb('0x2b')][_0xaaeb('0x54')]({'where':{'id':_0x28260f[_0xaaeb('0x45')]['id']}})[_0xaaeb('0x21')](handleEntityNotFound(_0x12971a,null))['then'](function(_0x347486){if(_0x347486){_0x5d68b7=_0x347486[_0xaaeb('0x23')]({'plain':!![]});_0x32e4cd[_0xaaeb('0x2c')]=_[_0xaaeb('0x46')](db[_0xaaeb('0x55')]['rawAttributes']);_0x32e4cd[_0xaaeb('0x2d')]=_[_0xaaeb('0x46')](_0x28260f['query']);_0x32e4cd[_0xaaeb('0x30')]=_[_0xaaeb('0x31')](_0x32e4cd[_0xaaeb('0x2c')],_0x32e4cd[_0xaaeb('0x2d')]);_0x469d92['attributes']=_[_0xaaeb('0x31')](_0x32e4cd[_0xaaeb('0x2c')],qs[_0xaaeb('0x47')](_0x28260f[_0xaaeb('0x2d')]['fields']));_0x469d92[_0xaaeb('0x32')]=_0x469d92[_0xaaeb('0x32')][_0xaaeb('0x56')]?_0x469d92['attributes']:_0x32e4cd[_0xaaeb('0x2c')];if(!_0x28260f[_0xaaeb('0x2d')]['hasOwnProperty'](_0xaaeb('0x34'))){_0x469d92['limit']=qs[_0xaaeb('0x1c')](_0x28260f[_0xaaeb('0x2d')][_0xaaeb('0x1c')]);_0x469d92[_0xaaeb('0x1b')]=qs[_0xaaeb('0x1b')](_0x28260f[_0xaaeb('0x2d')][_0xaaeb('0x1b')]);}_0x469d92[_0xaaeb('0x35')]=qs[_0xaaeb('0x36')](_0x28260f['query'][_0xaaeb('0x36')]);_0x469d92['where']=qs[_0xaaeb('0x30')](_[_0xaaeb('0x38')](_0x28260f['query'],_0x32e4cd[_0xaaeb('0x30')]));_0x469d92[_0xaaeb('0x37')][_0xaaeb('0x57')]=_0x347486['id'];if(_0x28260f[_0xaaeb('0x2d')]['filter']){_0x469d92[_0xaaeb('0x37')]=_[_0xaaeb('0x3b')](_0x469d92[_0xaaeb('0x37')],{'$or':_['map'](_0x469d92[_0xaaeb('0x32')],function(_0x5cf3a7){var _0x522b6c={};_0x522b6c[_0x5cf3a7]={'$like':'%'+_0x28260f[_0xaaeb('0x2d')]['filter']+'%'};return _0x522b6c;})});}_0x469d92=_[_0xaaeb('0x3b')]({},_0x469d92,_0x28260f['options']);return db[_0xaaeb('0x55')]['findAll'](_0x469d92);}})[_0xaaeb('0x21')](function(_0x46a329){if(_0x46a329){return db[_0xaaeb('0x58')][_0xaaeb('0x59')]({'where':{'id':_['map'](_0x46a329,_0xaaeb('0x5a')),'role':_0xaaeb('0x5b')},'attributes':['id','name','smsPause',_0xaaeb('0x5c'),_0xaaeb('0x5d')]});}})[_0xaaeb('0x21')](function(_0x16389b){if(_0x16389b){return{'count':_0x16389b['count'],'rows':_[_0xaaeb('0x3d')](_0x16389b[_0xaaeb('0x42')],function(_0x24edbe){return{'membername':_0x24edbe[_0xaaeb('0x29')],'UserId':_0x24edbe['id'],'queue_name':_0x5d68b7[_0xaaeb('0x29')],'SmsQueueId':_0x5d68b7['id'],'interface':util[_0xaaeb('0x5e')]('%s/%s','SIP',_0x24edbe[_0xaaeb('0x29')]),'penalty':0x0,'paused':_0x24edbe[_0xaaeb('0x5f')],'createdAt':_0x24edbe[_0xaaeb('0x5d')],'updatedAt':_0x24edbe['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xaaeb('0x21')](respondWithFilteredResult(_0x12971a,_0x469d92))[_0xaaeb('0x43')](handleError(_0x12971a,null));};exports[_0xaaeb('0x60')]=function(_0x5ee314,_0xb25dcd,_0x19ecea){var _0x217aa3={};var _0x4e3748={};var _0x1d9e47;var _0x259c85;return db['SmsQueue'][_0xaaeb('0x54')]({'where':{'id':_0x5ee314[_0xaaeb('0x45')]['id']}})[_0xaaeb('0x21')](handleEntityNotFound(_0xb25dcd,null))[_0xaaeb('0x21')](function(_0x228628){if(_0x228628){_0x1d9e47=_0x228628;_0x4e3748[_0xaaeb('0x2c')]=_[_0xaaeb('0x46')](db['Team'][_0xaaeb('0x61')]);_0x4e3748[_0xaaeb('0x2d')]=_[_0xaaeb('0x46')](_0x5ee314[_0xaaeb('0x2d')]);_0x4e3748[_0xaaeb('0x30')]=_[_0xaaeb('0x31')](_0x4e3748[_0xaaeb('0x2c')],_0x4e3748[_0xaaeb('0x2d')]);_0x217aa3[_0xaaeb('0x32')]=_[_0xaaeb('0x31')](_0x4e3748['model'],qs[_0xaaeb('0x47')](_0x5ee314[_0xaaeb('0x2d')][_0xaaeb('0x47')]));_0x217aa3[_0xaaeb('0x32')]=_0x217aa3[_0xaaeb('0x32')][_0xaaeb('0x56')]?_0x217aa3['attributes']:_0x4e3748[_0xaaeb('0x2c')];_0x217aa3[_0xaaeb('0x35')]=qs[_0xaaeb('0x36')](_0x5ee314[_0xaaeb('0x2d')]['sort']);_0x217aa3[_0xaaeb('0x37')]=qs[_0xaaeb('0x30')](_[_0xaaeb('0x38')](_0x5ee314[_0xaaeb('0x2d')],_0x4e3748[_0xaaeb('0x30')]));if(_0x5ee314[_0xaaeb('0x2d')][_0xaaeb('0x3c')]){_0x217aa3[_0xaaeb('0x37')]=_['merge'](_0x217aa3[_0xaaeb('0x37')],{'$or':_[_0xaaeb('0x3d')](_0x217aa3['attributes'],function(_0x2f99ce){var _0x4b2d27={};_0x4b2d27[_0x2f99ce]={'$like':'%'+_0x5ee314['query'][_0xaaeb('0x3c')]+'%'};return _0x4b2d27;})});}_0x217aa3=_['merge']({},_0x217aa3,_0x5ee314[_0xaaeb('0x3e')]);return _0x1d9e47[_0xaaeb('0x60')](_0x217aa3);}})['then'](function(_0x4b8d97){if(_0x4b8d97){_0x259c85=_0x4b8d97[_0xaaeb('0x56')];if(!_0x5ee314['query'][_0xaaeb('0x33')](_0xaaeb('0x34'))){_0x217aa3[_0xaaeb('0x1c')]=qs[_0xaaeb('0x1c')](_0x5ee314[_0xaaeb('0x2d')][_0xaaeb('0x1c')]);_0x217aa3[_0xaaeb('0x1b')]=qs['offset'](_0x5ee314[_0xaaeb('0x2d')][_0xaaeb('0x1b')]);}return _0x1d9e47[_0xaaeb('0x60')](_0x217aa3);}})[_0xaaeb('0x21')](function(_0x2734ef){if(_0x2734ef){return _0x2734ef?{'count':_0x259c85,'rows':_0x2734ef}:null;}})[_0xaaeb('0x21')](respondWithResult(_0xb25dcd,null))[_0xaaeb('0x43')](handleError(_0xb25dcd,null));};exports['addTeams']=function(_0x5a0732,_0x307f92,_0x416b9e){var _0x1a0dde=[];var _0xbfdd96;return db[_0xaaeb('0x62')][_0xaaeb('0x41')]({'where':{'id':_0x5a0732[_0xaaeb('0x4b')][_0xaaeb('0x63')]},'attributes':['id'],'include':[{'model':db[_0xaaeb('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xaaeb('0x21')](function(_0x1b97fe){if(_0x1b97fe){for(var _0x5a1fdc=0x0;_0x5a1fdc<_0x1b97fe['length'];_0x5a1fdc+=0x1){for(var _0x97cf07=0x0;_0x97cf07<_0x1b97fe[_0x5a1fdc]['Agents'][_0xaaeb('0x56')];_0x97cf07+=0x1){_0x1a0dde=_[_0xaaeb('0x64')](_0x1a0dde,[_0x1b97fe[_0x5a1fdc]['Agents'][_0x97cf07]['id']]);}}return _0x1a0dde;}})[_0xaaeb('0x21')](function(_0x34c941){if(_0x34c941){return db['SmsQueue'][_0xaaeb('0x49')]({'where':{'id':_0x5a0732[_0xaaeb('0x45')]['id']}});}})['then'](function(_0x223cae){if(_0x223cae){_0xbfdd96=_0x223cae;return _0xbfdd96[_0xaaeb('0x65')](_0x1a0dde,{'penalty':_0x5a0732[_0xaaeb('0x4b')][_0xaaeb('0x66')]});}})[_0xaaeb('0x21')](function(_0x1a0f74){if(_0x1a0f74){return _0xbfdd96[_0xaaeb('0x67')](_0x5a0732[_0xaaeb('0x4b')][_0xaaeb('0x63')]);}})[_0xaaeb('0x21')](handleEntityNotFound(_0x307f92,null))[_0xaaeb('0x21')](respondWithStatusCode(_0x307f92,null))['catch'](handleError(_0x307f92,null));};exports[_0xaaeb('0x68')]=function(_0x570d95,_0x16ef1b,_0x347316){var _0x2462ad=[];var _0x54d6c1;return db[_0xaaeb('0x62')][_0xaaeb('0x41')]({'where':{'id':_0x570d95['query'][_0xaaeb('0x63')]},'attributes':['id'],'include':[{'model':db[_0xaaeb('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](function(_0x24e4af){if(_0x24e4af){for(var _0x1b6446=0x0;_0x1b6446<_0x24e4af[_0xaaeb('0x56')];_0x1b6446+=0x1){for(var _0x175ad6=0x0;_0x175ad6<_0x24e4af[_0x1b6446]['Agents']['length'];_0x175ad6+=0x1){_0x2462ad=_[_0xaaeb('0x64')](_0x2462ad,[_0x24e4af[_0x1b6446][_0xaaeb('0x69')][_0x175ad6]['id']]);}}return _0x2462ad;}})[_0xaaeb('0x21')](function(_0x153227){if(_0x153227){return db[_0xaaeb('0x2b')][_0xaaeb('0x49')]({'where':{'id':_0x570d95['params']['id']}});}})[_0xaaeb('0x21')](function(_0x17cb7e){if(_0x17cb7e){_0x54d6c1=_0x17cb7e;return _0x54d6c1[_0xaaeb('0x6a')](_0x2462ad);}})['then'](function(_0x134fcd){if(_0x54d6c1){return _0x54d6c1[_0xaaeb('0x68')](_0x570d95['query'][_0xaaeb('0x63')]);}})['then'](handleEntityNotFound(_0x16ef1b,null))[_0xaaeb('0x21')](respondWithStatusCode(_0x16ef1b,null))[_0xaaeb('0x43')](handleError(_0x16ef1b,null));};exports[_0xaaeb('0x65')]=function(_0x40fea4,_0x30ac4d,_0x40e37e){return db[_0xaaeb('0x2b')]['find']({'where':{'id':_0x40fea4[_0xaaeb('0x45')]['id']}})['then'](handleEntityNotFound(_0x30ac4d,null))[_0xaaeb('0x21')](function(_0x1939f0){if(_0x1939f0){return _0x1939f0[_0xaaeb('0x65')](_0x40fea4[_0xaaeb('0x4b')][_0xaaeb('0x63')],_[_0xaaeb('0x6b')](_0x40fea4[_0xaaeb('0x4b')],[_0xaaeb('0x63'),'id'])||{})['spread'](function(_0x14373c){for(var _0x19a7f5=0x0;_0x19a7f5<_0x40fea4['body'][_0xaaeb('0x63')][_0xaaeb('0x56')];_0x19a7f5+=0x1){socket['emit'](_0xaaeb('0x6c'),{'UserId':_0x40fea4[_0xaaeb('0x4b')]['ids'][_0x19a7f5],'SmsQueueId':_0x40fea4[_0xaaeb('0x45')]['id']});}return _0x14373c;});}})[_0xaaeb('0x21')](respondWithResult(_0x30ac4d,null))[_0xaaeb('0x43')](handleError(_0x30ac4d,null));};exports[_0xaaeb('0x6a')]=function(_0x212988,_0x35eca3,_0x17b4a9){var _0x2c2e1d;return db[_0xaaeb('0x2b')][_0xaaeb('0x49')]({'where':{'id':_0x212988['params']['id']}})['then'](handleEntityNotFound(_0x35eca3,null))['then'](function(_0x560cee){if(_0x560cee){return _0x560cee[_0xaaeb('0x6a')](_0x212988['query']['ids'])[_0xaaeb('0x21')](function(_0x5e4a6b){if(_[_0xaaeb('0x6d')](_0x212988[_0xaaeb('0x2d')]['ids'])){for(var _0x2ac303=0x0;_0x2ac303<_0x212988['query'][_0xaaeb('0x63')][_0xaaeb('0x56')];_0x2ac303+=0x1){socket[_0xaaeb('0x6e')](_0xaaeb('0x6f'),{'UserId':_0x212988[_0xaaeb('0x2d')]['ids'][_0x2ac303],'SmsQueueId':_0x212988['params']['id']});}}else{socket['emit'](_0xaaeb('0x6f'),{'UserId':_0x212988[_0xaaeb('0x2d')]['ids'],'SmsQueueId':_0x212988[_0xaaeb('0x45')]['id']});}});}})[_0xaaeb('0x21')](respondWithStatusCode(_0x35eca3,null))[_0xaaeb('0x43')](handleError(_0x35eca3,null));};exports[_0xaaeb('0x70')]=function(_0x1745e3,_0x2c3d00,_0x1ac674){var _0x5d24a9={};var _0x560f80={};var _0x31dc1d;var _0x5deec1;return db['SmsQueue'][_0xaaeb('0x54')]({'where':{'id':_0x1745e3[_0xaaeb('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c3d00,null))[_0xaaeb('0x21')](function(_0x43dea4){if(_0x43dea4){_0x31dc1d=_0x43dea4;_0x560f80['model']=_[_0xaaeb('0x46')](db[_0xaaeb('0x58')]['rawAttributes']);_0x560f80[_0xaaeb('0x2d')]=_[_0xaaeb('0x46')](_0x1745e3['query']);_0x560f80[_0xaaeb('0x30')]=_[_0xaaeb('0x31')](_0x560f80[_0xaaeb('0x2c')],_0x560f80[_0xaaeb('0x2d')]);_0x5d24a9[_0xaaeb('0x32')]=_[_0xaaeb('0x31')](_0x560f80[_0xaaeb('0x2c')],qs[_0xaaeb('0x47')](_0x1745e3['query'][_0xaaeb('0x47')]));_0x5d24a9[_0xaaeb('0x32')]=_0x5d24a9[_0xaaeb('0x32')]['length']?_0x5d24a9['attributes']:_0x560f80[_0xaaeb('0x2c')];_0x5d24a9['order']=qs[_0xaaeb('0x36')](_0x1745e3[_0xaaeb('0x2d')]['sort']);_0x5d24a9[_0xaaeb('0x37')]=qs[_0xaaeb('0x30')](_['pick'](_0x1745e3[_0xaaeb('0x2d')],_0x560f80[_0xaaeb('0x30')]));if(_0x1745e3[_0xaaeb('0x2d')][_0xaaeb('0x3c')]){_0x5d24a9[_0xaaeb('0x37')]=_['merge'](_0x5d24a9[_0xaaeb('0x37')],{'$or':_[_0xaaeb('0x3d')](_0x5d24a9[_0xaaeb('0x32')],function(_0x386df7){var _0x272aa8={};_0x272aa8[_0x386df7]={'$like':'%'+_0x1745e3[_0xaaeb('0x2d')][_0xaaeb('0x3c')]+'%'};return _0x272aa8;})});}_0x5d24a9=_[_0xaaeb('0x3b')]({},_0x5d24a9,_0x1745e3[_0xaaeb('0x3e')]);return _0x31dc1d['getAgents'](_0x5d24a9);}})['then'](function(_0x367a6a){if(_0x367a6a){_0x5deec1=_0x367a6a[_0xaaeb('0x56')];if(!_0x1745e3[_0xaaeb('0x2d')][_0xaaeb('0x33')]('nolimit')){_0x5d24a9[_0xaaeb('0x1c')]=qs['limit'](_0x1745e3[_0xaaeb('0x2d')][_0xaaeb('0x1c')]);_0x5d24a9[_0xaaeb('0x1b')]=qs[_0xaaeb('0x1b')](_0x1745e3[_0xaaeb('0x2d')][_0xaaeb('0x1b')]);}return _0x31dc1d[_0xaaeb('0x70')](_0x5d24a9);}})[_0xaaeb('0x21')](function(_0x1b9b31){if(_0x1b9b31){return _0x1b9b31?{'count':_0x5deec1,'rows':_0x1b9b31}:null;}})[_0xaaeb('0x21')](respondWithResult(_0x2c3d00,null))[_0xaaeb('0x43')](handleError(_0x2c3d00,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ab286ac..9415dfd 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 _0xcd95=['SmsQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xcd95,0x1a2));var _0x5cd9=function(_0xe5b3e1,_0x57a645){_0xe5b3e1=_0xe5b3e1-0x0;var _0x121dad=_0xcd95[_0xe5b3e1];return _0x121dad;};'use strict';var EventEmitter=require(_0x5cd9('0x0'));var SmsQueue=require(_0x5cd9('0x1'))['db'][_0x5cd9('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5cd9('0x3')](0x0);var events={'afterCreate':_0x5cd9('0x4'),'afterUpdate':_0x5cd9('0x5'),'afterDestroy':_0x5cd9('0x6')};function emitEvent(_0xc1cd71){return function(_0x230da3,_0x57dbbe,_0x11d4ab){SmsQueueEvents['emit'](_0xc1cd71+':'+_0x230da3['id'],_0x230da3);SmsQueueEvents['emit'](_0xc1cd71,_0x230da3);_0x11d4ab(null);};}for(var e in events){if(events[_0x5cd9('0x7')](e)){var event=events[e];SmsQueue[_0x5cd9('0x8')](e,emitEvent(event));}}module[_0x5cd9('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x0cc8=['update','emit','hasOwnProperty','hook','exports','events','SmsQueue','save'];(function(_0x3a1d6d,_0x24fbd8){var _0x3ddb57=function(_0x3fe9aa){while(--_0x3fe9aa){_0x3a1d6d['push'](_0x3a1d6d['shift']());}};_0x3ddb57(++_0x24fbd8);}(_0x0cc8,0xdd));var _0x80cc=function(_0x4fd82a,_0x29d9d5){_0x4fd82a=_0x4fd82a-0x0;var _0x21d2a8=_0x0cc8[_0x4fd82a];return _0x21d2a8;};'use strict';var EventEmitter=require(_0x80cc('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x80cc('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x80cc('0x2'),'afterUpdate':_0x80cc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x238443){return function(_0x17fe84,_0x2ece23,_0x1c5dbc){SmsQueueEvents[_0x80cc('0x4')](_0x238443+':'+_0x17fe84['id'],_0x17fe84);SmsQueueEvents['emit'](_0x238443,_0x17fe84);_0x1c5dbc(null);};}for(var e in events){if(events[_0x80cc('0x5')](e)){var event=events[e];SmsQueue[_0x80cc('0x6')](e,emitEvent(event));}}module[_0x80cc('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 ca98904..3134d6c 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 _0xfcba=['lodash','util','api','moment','bluebird','request-promise','./smsQueue.attributes','define','SmsQueue','sms_queues'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfcba,0x8c));var _0xafcb=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xfcba[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xafcb('0x0'));var util=require(_0xafcb('0x1'));var logger=require('../../config/logger')(_0xafcb('0x2'));var moment=require(_0xafcb('0x3'));var BPromise=require(_0xafcb('0x4'));var rp=require(_0xafcb('0x5'));var attributes=require(_0xafcb('0x6'));module['exports']=function(_0x144e92,_0x4248b4){return _0x144e92[_0xafcb('0x7')](_0xafcb('0x8'),attributes,{'tableName':_0xafcb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69f4=['../../config/logger','api','moment','bluebird','./smsQueue.attributes','define','SmsQueue','sms_queues','util'];(function(_0x9fe03,_0x59a34e){var _0x62c700=function(_0x13c3dd){while(--_0x13c3dd){_0x9fe03['push'](_0x9fe03['shift']());}};_0x62c700(++_0x59a34e);}(_0x69f4,0x14c));var _0x469f=function(_0x104216,_0x10ef94){_0x104216=_0x104216-0x0;var _0x21c8e4=_0x69f4[_0x104216];return _0x21c8e4;};'use strict';var _=require('lodash');var util=require(_0x469f('0x0'));var logger=require(_0x469f('0x1'))(_0x469f('0x2'));var moment=require(_0x469f('0x3'));var BPromise=require(_0x469f('0x4'));var rp=require('request-promise');var attributes=require(_0x469f('0x5'));module['exports']=function(_0xbe6b1e,_0x29dd47){return _0xbe6b1e[_0x469f('0x6')](_0x469f('0x7'),attributes,{'tableName':_0x469f('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 f91853d..e72a926 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 _0x0c84=['GetSmsQueue','SmsQueue','options','raw','attributes','limit','include','map','model','catch','ShowSmsQueue','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./smsQueue.socket','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2fd08e,_0x38e1e3){var _0x46cc9a=function(_0xd07fc){while(--_0xd07fc){_0x2fd08e['push'](_0x2fd08e['shift']());}};_0x46cc9a(++_0x38e1e3);}(_0x0c84,0xad));var _0x40c8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0c84[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x40c8('0x0'));var util=require(_0x40c8('0x1'));var moment=require(_0x40c8('0x2'));var BPromise=require(_0x40c8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40c8('0x4'));var db=require(_0x40c8('0x5'))['db'];var utils=require(_0x40c8('0x6'));var logger=require(_0x40c8('0x7'))(_0x40c8('0x8'));var config=require('../../config/environment');var jayson=require(_0x40c8('0x9'));var client=jayson[_0x40c8('0xa')][_0x40c8('0xb')]({'port':0x232a});config[_0x40c8('0xc')]=_[_0x40c8('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x40c8('0xe'))['register'](socket);function respondWithRpcPromise(_0x39fa5d,_0x1f0aa5,_0x4eda9a){return new BPromise(function(_0x39a0bc,_0x8a04d4){return client[_0x40c8('0xf')](_0x39fa5d,_0x4eda9a)[_0x40c8('0x10')](function(_0x4c3bb9){logger['info'](_0x40c8('0x11'),_0x1f0aa5,_0x40c8('0x12'));logger[_0x40c8('0x13')](_0x40c8('0x14'),_0x1f0aa5,'request\x20sent',JSON[_0x40c8('0x15')](_0x4c3bb9));if(_0x4c3bb9[_0x40c8('0x16')]){if(_0x4c3bb9[_0x40c8('0x16')][_0x40c8('0x17')]===0x1f4){logger[_0x40c8('0x16')](_0x40c8('0x11'),_0x1f0aa5,_0x4c3bb9[_0x40c8('0x16')][_0x40c8('0x18')]);return _0x8a04d4(_0x4c3bb9['error']['message']);}logger['error'](_0x40c8('0x11'),_0x1f0aa5,_0x4c3bb9[_0x40c8('0x16')][_0x40c8('0x18')]);return _0x39a0bc(_0x4c3bb9[_0x40c8('0x16')][_0x40c8('0x18')]);}else{logger[_0x40c8('0x19')](_0x40c8('0x11'),_0x1f0aa5,'request\x20sent');_0x39a0bc(_0x4c3bb9[_0x40c8('0x1a')][_0x40c8('0x18')]);}})['catch'](function(_0x3988d8){logger[_0x40c8('0x16')]('SmsQueue,\x20%s,\x20%s',_0x1f0aa5,_0x3988d8);_0x8a04d4(_0x3988d8);});});}exports[_0x40c8('0x1b')]=function(_0xbc1153){var _0x30bff6=this;return new Promise(function(_0x238a35,_0x2b837e){return db[_0x40c8('0x1c')]['findAll']({'raw':_0xbc1153['options']?_0xbc1153[_0x40c8('0x1d')][_0x40c8('0x1e')]===undefined?!![]:![]:!![],'where':_0xbc1153[_0x40c8('0x1d')]?_0xbc1153[_0x40c8('0x1d')]['where']||null:null,'attributes':_0xbc1153[_0x40c8('0x1d')]?_0xbc1153[_0x40c8('0x1d')][_0x40c8('0x1f')]||null:null,'limit':_0xbc1153[_0x40c8('0x1d')]?_0xbc1153['options'][_0x40c8('0x20')]||null:null,'include':_0xbc1153['options']?_0xbc1153[_0x40c8('0x1d')][_0x40c8('0x21')]?_[_0x40c8('0x22')](_0xbc1153[_0x40c8('0x1d')][_0x40c8('0x21')],function(_0xd3054d){return{'model':db[_0xd3054d[_0x40c8('0x23')]],'as':_0xd3054d['as'],'attributes':_0xd3054d['attributes'],'include':_0xd3054d[_0x40c8('0x21')]?_[_0x40c8('0x22')](_0xd3054d[_0x40c8('0x21')],function(_0x40cbaa){return{'model':db[_0x40cbaa['model']],'as':_0x40cbaa['as'],'attributes':_0x40cbaa['attributes'],'include':_0x40cbaa['include']?_[_0x40c8('0x22')](_0x40cbaa[_0x40c8('0x21')],function(_0x321d61){return{'model':db[_0x321d61[_0x40c8('0x23')]],'as':_0x321d61['as'],'attributes':_0x321d61[_0x40c8('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ab2e3){logger[_0x40c8('0x19')](_0x40c8('0x1b'),_0xbc1153);logger[_0x40c8('0x13')](_0x40c8('0x1b'),_0xbc1153,JSON[_0x40c8('0x15')](_0x2ab2e3));_0x238a35(_0x2ab2e3);})[_0x40c8('0x24')](function(_0x1c843d){logger['error'](_0x40c8('0x1b'),_0x1c843d[_0x40c8('0x18')],_0xbc1153);_0x2b837e(_0x30bff6[_0x40c8('0x16')](0x1f4,_0x1c843d[_0x40c8('0x18')]));});});};exports[_0x40c8('0x25')]=function(_0x421f6e){var _0x1a8851=this;return new Promise(function(_0x406d1b,_0x38fc47){return db['SmsQueue'][_0x40c8('0x26')]({'raw':_0x421f6e[_0x40c8('0x1d')]?_0x421f6e[_0x40c8('0x1d')][_0x40c8('0x1e')]===undefined?!![]:![]:!![],'where':_0x421f6e[_0x40c8('0x1d')]?_0x421f6e[_0x40c8('0x1d')][_0x40c8('0x27')]||null:null,'attributes':_0x421f6e[_0x40c8('0x1d')]?_0x421f6e['options'][_0x40c8('0x1f')]||null:null,'include':_0x421f6e[_0x40c8('0x1d')]?_0x421f6e[_0x40c8('0x1d')]['include']?_['map'](_0x421f6e[_0x40c8('0x1d')][_0x40c8('0x21')],function(_0x54135e){return{'model':db[_0x54135e[_0x40c8('0x23')]],'as':_0x54135e['as'],'attributes':_0x54135e['attributes'],'include':_0x54135e['include']?_[_0x40c8('0x22')](_0x54135e[_0x40c8('0x21')],function(_0x58cf14){return{'model':db[_0x58cf14[_0x40c8('0x23')]],'as':_0x58cf14['as'],'attributes':_0x58cf14[_0x40c8('0x1f')],'include':_0x58cf14[_0x40c8('0x21')]?_[_0x40c8('0x22')](_0x58cf14[_0x40c8('0x21')],function(_0x5a47e2){return{'model':db[_0x5a47e2[_0x40c8('0x23')]],'as':_0x5a47e2['as'],'attributes':_0x5a47e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x40c8('0x10')](function(_0x1ed021){logger[_0x40c8('0x19')](_0x40c8('0x25'),_0x421f6e);logger[_0x40c8('0x13')](_0x40c8('0x25'),_0x421f6e,JSON[_0x40c8('0x15')](_0x1ed021));_0x406d1b(_0x1ed021);})[_0x40c8('0x24')](function(_0x49742d){logger['error'](_0x40c8('0x25'),_0x49742d[_0x40c8('0x18')],_0x421f6e);_0x38fc47(_0x1a8851[_0x40c8('0x16')](0x1f4,_0x49742d[_0x40c8('0x18')]));});});}; \ No newline at end of file +var _0xd95b=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsQueue.socket','request','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsQueue,\x20%s,\x20%s','result','GetSmsQueue','SmsQueue','options','raw','where','limit','include','model','attributes','map','then','catch','ShowSmsQueue','util','moment'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xd95b,0x126));var _0xbd95=function(_0x22c7fe,_0x48033b){_0x22c7fe=_0x22c7fe-0x0;var _0x494641=_0xd95b[_0x22c7fe];return _0x494641;};'use strict';var _=require('lodash');var util=require(_0xbd95('0x0'));var moment=require(_0xbd95('0x1'));var BPromise=require(_0xbd95('0x2'));var rs=require(_0xbd95('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd95('0x4'))['db'];var utils=require(_0xbd95('0x5'));var logger=require(_0xbd95('0x6'))('rpc');var config=require(_0xbd95('0x7'));var jayson=require(_0xbd95('0x8'));var client=jayson['client'][_0xbd95('0x9')]({'port':0x232a});config[_0xbd95('0xa')]=_[_0xbd95('0xb')](config['redis'],{'host':_0xbd95('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd95('0xa')]));require(_0xbd95('0xd'))['register'](socket);function respondWithRpcPromise(_0x27ee03,_0x490825,_0x1c8ca0){return new BPromise(function(_0x893dcb,_0x4ed6e8){return client[_0xbd95('0xe')](_0x27ee03,_0x1c8ca0)['then'](function(_0xd8a13d){logger[_0xbd95('0xf')]('SmsQueue,\x20%s,\x20%s',_0x490825,_0xbd95('0x10'));logger[_0xbd95('0x11')](_0xbd95('0x12'),_0x490825,_0xbd95('0x10'),JSON[_0xbd95('0x13')](_0xd8a13d));if(_0xd8a13d[_0xbd95('0x14')]){if(_0xd8a13d[_0xbd95('0x14')]['code']===0x1f4){logger[_0xbd95('0x14')]('SmsQueue,\x20%s,\x20%s',_0x490825,_0xd8a13d[_0xbd95('0x14')][_0xbd95('0x15')]);return _0x4ed6e8(_0xd8a13d[_0xbd95('0x14')][_0xbd95('0x15')]);}logger[_0xbd95('0x14')](_0xbd95('0x16'),_0x490825,_0xd8a13d['error'][_0xbd95('0x15')]);return _0x893dcb(_0xd8a13d['error'][_0xbd95('0x15')]);}else{logger[_0xbd95('0xf')]('SmsQueue,\x20%s,\x20%s',_0x490825,_0xbd95('0x10'));_0x893dcb(_0xd8a13d[_0xbd95('0x17')][_0xbd95('0x15')]);}})['catch'](function(_0x172092){logger[_0xbd95('0x14')](_0xbd95('0x16'),_0x490825,_0x172092);_0x4ed6e8(_0x172092);});});}exports[_0xbd95('0x18')]=function(_0xfc3d51){var _0x2e2a76=this;return new Promise(function(_0x18d8ff,_0xd64523){return db[_0xbd95('0x19')]['findAll']({'raw':_0xfc3d51[_0xbd95('0x1a')]?_0xfc3d51[_0xbd95('0x1a')][_0xbd95('0x1b')]===undefined?!![]:![]:!![],'where':_0xfc3d51[_0xbd95('0x1a')]?_0xfc3d51[_0xbd95('0x1a')][_0xbd95('0x1c')]||null:null,'attributes':_0xfc3d51[_0xbd95('0x1a')]?_0xfc3d51['options']['attributes']||null:null,'limit':_0xfc3d51['options']?_0xfc3d51['options'][_0xbd95('0x1d')]||null:null,'include':_0xfc3d51[_0xbd95('0x1a')]?_0xfc3d51['options'][_0xbd95('0x1e')]?_['map'](_0xfc3d51[_0xbd95('0x1a')][_0xbd95('0x1e')],function(_0x5f37d2){return{'model':db[_0x5f37d2[_0xbd95('0x1f')]],'as':_0x5f37d2['as'],'attributes':_0x5f37d2[_0xbd95('0x20')],'include':_0x5f37d2[_0xbd95('0x1e')]?_[_0xbd95('0x21')](_0x5f37d2[_0xbd95('0x1e')],function(_0x7e529c){return{'model':db[_0x7e529c[_0xbd95('0x1f')]],'as':_0x7e529c['as'],'attributes':_0x7e529c['attributes'],'include':_0x7e529c[_0xbd95('0x1e')]?_['map'](_0x7e529c['include'],function(_0x35027e){return{'model':db[_0x35027e[_0xbd95('0x1f')]],'as':_0x35027e['as'],'attributes':_0x35027e[_0xbd95('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbd95('0x22')](function(_0x235389){logger[_0xbd95('0xf')]('GetSmsQueue',_0xfc3d51);logger['debug']('GetSmsQueue',_0xfc3d51,JSON[_0xbd95('0x13')](_0x235389));_0x18d8ff(_0x235389);})[_0xbd95('0x23')](function(_0x3a5bc9){logger[_0xbd95('0x14')](_0xbd95('0x18'),_0x3a5bc9[_0xbd95('0x15')],_0xfc3d51);_0xd64523(_0x2e2a76['error'](0x1f4,_0x3a5bc9[_0xbd95('0x15')]));});});};exports[_0xbd95('0x24')]=function(_0x197bbc){var _0x5f2447=this;return new Promise(function(_0x147814,_0x2a4ee2){return db[_0xbd95('0x19')]['find']({'raw':_0x197bbc['options']?_0x197bbc['options'][_0xbd95('0x1b')]===undefined?!![]:![]:!![],'where':_0x197bbc[_0xbd95('0x1a')]?_0x197bbc['options'][_0xbd95('0x1c')]||null:null,'attributes':_0x197bbc[_0xbd95('0x1a')]?_0x197bbc['options'][_0xbd95('0x20')]||null:null,'include':_0x197bbc['options']?_0x197bbc[_0xbd95('0x1a')]['include']?_['map'](_0x197bbc[_0xbd95('0x1a')][_0xbd95('0x1e')],function(_0x5c4c05){return{'model':db[_0x5c4c05[_0xbd95('0x1f')]],'as':_0x5c4c05['as'],'attributes':_0x5c4c05[_0xbd95('0x20')],'include':_0x5c4c05[_0xbd95('0x1e')]?_[_0xbd95('0x21')](_0x5c4c05[_0xbd95('0x1e')],function(_0x55a972){return{'model':db[_0x55a972[_0xbd95('0x1f')]],'as':_0x55a972['as'],'attributes':_0x55a972[_0xbd95('0x20')],'include':_0x55a972[_0xbd95('0x1e')]?_[_0xbd95('0x21')](_0x55a972[_0xbd95('0x1e')],function(_0x25eb56){return{'model':db[_0x25eb56['model']],'as':_0x25eb56['as'],'attributes':_0x25eb56[_0xbd95('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbd95('0x22')](function(_0x3dd492){logger[_0xbd95('0xf')]('ShowSmsQueue',_0x197bbc);logger[_0xbd95('0x11')]('ShowSmsQueue',_0x197bbc,JSON[_0xbd95('0x13')](_0x3dd492));_0x147814(_0x3dd492);})['catch'](function(_0x46dde9){logger['error'](_0xbd95('0x24'),_0x46dde9[_0xbd95('0x15')],_0x197bbc);_0x2a4ee2(_0x5f2447[_0xbd95('0x14')](0x1f4,_0x46dde9[_0xbd95('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index d22e4ac..21e0c0d 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 _0xa633=['smsQueue:','./smsQueue.events','update','removeListener','register','length'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xa633,0x15d));var _0x3a63=function(_0x12ec6a,_0x339949){_0x12ec6a=_0x12ec6a-0x0;var _0x3dd08a=_0xa633[_0x12ec6a];return _0x3dd08a;};'use strict';var SmsQueueEvents=require(_0x3a63('0x0'));var events=['save','remove',_0x3a63('0x1')];function createListener(_0x47b39e,_0x529bef){return function(_0x121a91){_0x529bef['emit'](_0x47b39e,_0x121a91);};}function removeListener(_0x1d0884,_0x169e18){return function(){SmsQueueEvents[_0x3a63('0x2')](_0x1d0884,_0x169e18);};}exports[_0x3a63('0x3')]=function(_0x1315cb){for(var _0xc9221d=0x0,_0x7ebc45=events[_0x3a63('0x4')];_0xc9221d<_0x7ebc45;_0xc9221d++){var _0x567ff5=events[_0xc9221d];var _0x574b7c=createListener(_0x3a63('0x5')+_0x567ff5,_0x1315cb);SmsQueueEvents['on'](_0x567ff5,_0x574b7c);}}; \ No newline at end of file +var _0x0628=['./smsQueue.events','save','update','emit','register','smsQueue:'];(function(_0x5dc155,_0x1ee061){var _0x9d58d2=function(_0x428f7f){while(--_0x428f7f){_0x5dc155['push'](_0x5dc155['shift']());}};_0x9d58d2(++_0x1ee061);}(_0x0628,0x15c));var _0x8062=function(_0x23b091,_0x504e29){_0x23b091=_0x23b091-0x0;var _0x401023=_0x0628[_0x23b091];return _0x401023;};'use strict';var SmsQueueEvents=require(_0x8062('0x0'));var events=[_0x8062('0x1'),'remove',_0x8062('0x2')];function createListener(_0x14fc40,_0x183383){return function(_0x27d305){_0x183383[_0x8062('0x3')](_0x14fc40,_0x27d305);};}function removeListener(_0x52d5da,_0x190ecc){return function(){SmsQueueEvents['removeListener'](_0x52d5da,_0x190ecc);};}exports[_0x8062('0x4')]=function(_0x232088){for(var _0x28d7d5=0x0,_0x337f7d=events['length'];_0x28d7d5<_0x337f7d;_0x28d7d5++){var _0x40e7f7=events[_0x28d7d5];var _0x5c5d10=createListener(_0x8062('0x5')+_0x40e7f7,_0x232088);SmsQueueEvents['on'](_0x40e7f7,_0x5c5d10);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 2891962..c43dcdc 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 _0xfdb3=['connect-timeout','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util'];(function(_0x27e3d3,_0x58d489){var _0x1ca3ee=function(_0x332e1a){while(--_0x332e1a){_0x27e3d3['push'](_0x27e3d3['shift']());}};_0x1ca3ee(++_0x58d489);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x20b624,_0x47fe58){_0x20b624=_0x20b624-0x0;var _0x2c91d2=_0xfdb3[_0x20b624];return _0x2c91d2;};'use strict';var multer=require(_0x3fdb('0x0'));var util=require(_0x3fdb('0x1'));var path=require('path');var timeout=require(_0x3fdb('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3fdb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3fdb('0x4'));var controller=require(_0x3fdb('0x5'));router[_0x3fdb('0x6')]('/',auth[_0x3fdb('0x7')](),controller[_0x3fdb('0x8')]);router['get'](_0x3fdb('0x9'),auth[_0x3fdb('0x7')](),controller[_0x3fdb('0xa')]);router['get'](_0x3fdb('0xb'),auth['isAuthenticated'](),controller[_0x3fdb('0xc')]);router[_0x3fdb('0xd')]('/',auth[_0x3fdb('0x7')](),controller[_0x3fdb('0xe')]);router[_0x3fdb('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3fdb('0xb'),auth[_0x3fdb('0x7')](),controller[_0x3fdb('0x10')]);module[_0x3fdb('0x11')]=router; \ No newline at end of file +var _0xdb2a=['/:id','show','create','put','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x50144b,_0x482021){var _0x1849db=function(_0x4f4c57){while(--_0x4f4c57){_0x50144b['push'](_0x50144b['shift']());}};_0x1849db(++_0x482021);}(_0xdb2a,0x16f));var _0xadb2=function(_0x519e28,_0x52a148){_0x519e28=_0x519e28-0x0;var _0x3e91dd=_0xdb2a[_0x519e28];return _0x3e91dd;};'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'));var controller=require('./smsQueueReport.controller');router[_0xadb2('0x6')]('/',auth[_0xadb2('0x7')](),controller[_0xadb2('0x8')]);router[_0xadb2('0x6')](_0xadb2('0x9'),auth['isAuthenticated'](),controller[_0xadb2('0xa')]);router['get'](_0xadb2('0xb'),auth[_0xadb2('0x7')](),controller[_0xadb2('0xc')]);router['post']('/',auth[_0xadb2('0x7')](),controller[_0xadb2('0xd')]);router[_0xadb2('0xe')]('/:id',auth[_0xadb2('0x7')](),controller['update']);router[_0xadb2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xadb2('0x10')]);module[_0xadb2('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5ecc13d..9a07831 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 _0x898f=['sequelize','exports','STRING','DATE'];(function(_0x19aee6,_0xcb2918){var _0x511975=function(_0x4fbb42){while(--_0x4fbb42){_0x19aee6['push'](_0x19aee6['shift']());}};_0x511975(++_0xcb2918);}(_0x898f,0x1f4));var _0xf898=function(_0x33f3a0,_0x40d089){_0x33f3a0=_0x33f3a0-0x0;var _0x25a0f9=_0x898f[_0x33f3a0];return _0x25a0f9;};'use strict';var moment=require('moment');var Sequelize=require(_0xf898('0x0'));module[_0xf898('0x1')]={'uniqueid':{'type':Sequelize[_0xf898('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf898('0x2')]},'joinAt':{'type':Sequelize[_0xf898('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf898('0x3')]},'exitAt':{'type':Sequelize[_0xf898('0x3')]},'reason':{'type':Sequelize[_0xf898('0x2')]}}; \ No newline at end of file +var _0xe03c=['DATE','moment','sequelize','STRING'];(function(_0x256356,_0x3a038a){var _0xb9a5e4=function(_0x59c258){while(--_0x59c258){_0x256356['push'](_0x256356['shift']());}};_0xb9a5e4(++_0x3a038a);}(_0xe03c,0x81));var _0xce03=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0xe03c[_0x4cd21c];return _0x5d8e5e;};'use strict';var moment=require(_0xce03('0x0'));var Sequelize=require(_0xce03('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xce03('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xce03('0x3')]},'leaveAt':{'type':Sequelize[_0xce03('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xce03('0x3')]},'reason':{'type':Sequelize[_0xce03('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5689919..db3c146 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 _0xb642=['offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','filter','map','options','SmsQueueReport','includeAll','include','rows','catch','show','params','find','create','body','describe','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','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count'];(function(_0x3f4145,_0x182c44){var _0x30a680=function(_0x4cdba3){while(--_0x4cdba3){_0x3f4145['push'](_0x3f4145['shift']());}};_0x30a680(++_0x182c44);}(_0xb642,0xd0));var _0x2b64=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xb642[_0x23e7c1];return _0x1add43;};'use strict';var pdf=require(_0x2b64('0x0'));var emlformat=require(_0x2b64('0x1'));var rimraf=require(_0x2b64('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b64('0x3'));var rp=require(_0x2b64('0x4'));var moment=require(_0x2b64('0x5'));var BPromise=require(_0x2b64('0x6'));var Mustache=require(_0x2b64('0x7'));var util=require(_0x2b64('0x8'));var path=require(_0x2b64('0x9'));var sox=require(_0x2b64('0xa'));var csv=require(_0x2b64('0xb'));var ejs=require(_0x2b64('0xc'));var fs=require('fs');var _=require(_0x2b64('0xd'));var squel=require(_0x2b64('0xe'));var crypto=require(_0x2b64('0xf'));var jsforce=require(_0x2b64('0x10'));var deskjs=require(_0x2b64('0x11'));var toCsv=require(_0x2b64('0xb'));var querystring=require('querystring');var Papa=require(_0x2b64('0x12'));var Redis=require(_0x2b64('0x13'));var qs=require(_0x2b64('0x14'));var logger=require(_0x2b64('0x15'))(_0x2b64('0x16'));var utils=require(_0x2b64('0x17'));var config=require(_0x2b64('0x18'));var db=require(_0x2b64('0x19'))['db'];function respondWithStatusCode(_0x10db7a,_0x172c0e){_0x172c0e=_0x172c0e||0xcc;return function(_0x3815bc){if(_0x3815bc){return _0x10db7a[_0x2b64('0x1a')](_0x172c0e);}return _0x10db7a[_0x2b64('0x1b')](_0x172c0e)['end']();};}function respondWithResult(_0x4d05c2,_0x52eeb4){_0x52eeb4=_0x52eeb4||0xc8;return function(_0x1e3e09){if(_0x1e3e09){return _0x4d05c2['status'](_0x52eeb4)['json'](_0x1e3e09);}};}function respondWithFilteredResult(_0x3f8232,_0x1f007c){return function(_0x5f3c48){if(_0x5f3c48){var _0x1d6fe2=_0x5f3c48[_0x2b64('0x1c')],_0x1973e=_0x1f007c[_0x2b64('0x1d')],_0x28db9b=_0x1f007c['offset']+_0x1f007c[_0x2b64('0x1e')],_0x507442;if(_0x28db9b>=_0x1d6fe2){_0x28db9b=_0x1d6fe2;_0x507442=0xc8;}else{_0x507442=0xce;}_0x3f8232[_0x2b64('0x1b')](_0x507442);return _0x3f8232[_0x2b64('0x1f')](_0x2b64('0x20'),_0x1973e+'-'+_0x28db9b+'/'+_0x1d6fe2)[_0x2b64('0x21')](_0x5f3c48);}return null;};}function patchUpdates(_0x1f8713){return function(_0x4b11cf){try{jsonpatch[_0x2b64('0x22')](_0x4b11cf,_0x1f8713,!![]);}catch(_0x41bb65){return BPromise[_0x2b64('0x23')](_0x41bb65);}return _0x4b11cf[_0x2b64('0x24')]();};}function saveUpdates(_0x12d2e9,_0x4ed6f5){return function(_0x4c48b3){if(_0x4c48b3){return _0x4c48b3[_0x2b64('0x25')](_0x12d2e9)[_0x2b64('0x26')](function(_0x4df384){return _0x4df384;});}return null;};}function removeEntity(_0x2d0739,_0x40a8f0){return function(_0x8ee767){if(_0x8ee767){return _0x8ee767[_0x2b64('0x27')]()['then'](function(){_0x2d0739[_0x2b64('0x1b')](0xcc)[_0x2b64('0x28')]();});}};}function handleEntityNotFound(_0x33e3ae,_0x1bb17e){return function(_0x4c235c){if(!_0x4c235c){_0x33e3ae['sendStatus'](0x194);}return _0x4c235c;};}function handleError(_0x5049cc,_0x3f28ea){_0x3f28ea=_0x3f28ea||0x1f4;return function(_0x2ca644){logger[_0x2b64('0x29')](_0x2ca644[_0x2b64('0x2a')]);if(_0x2ca644[_0x2b64('0x2b')]){delete _0x2ca644[_0x2b64('0x2b')];}_0x5049cc[_0x2b64('0x1b')](_0x3f28ea)[_0x2b64('0x2c')](_0x2ca644);};}exports['index']=function(_0x53e0b7,_0x3120c6){var _0x222c26={},_0x1badb1={},_0x415d11={'count':0x0,'rows':[]};var _0x3e9894=db['SmsQueueReport'][_0x2b64('0x2d')];_0x1badb1[_0x2b64('0x2e')]=_[_0x2b64('0x2f')](_0x3e9894);var _0x559f65={'dateStart':_0x53e0b7[_0x2b64('0x30')][_0x2b64('0x31')],'dateEnd':_0x53e0b7[_0x2b64('0x30')][_0x2b64('0x32')]};delete _0x53e0b7['query']['dateStart'];delete _0x53e0b7['query']['dateEnd'];_0x1badb1[_0x2b64('0x30')]=_[_0x2b64('0x2f')](_0x53e0b7[_0x2b64('0x30')]);_0x1badb1[_0x2b64('0x33')]=_[_0x2b64('0x34')](_0x1badb1[_0x2b64('0x2e')],_0x1badb1['query']);_0x222c26['attributes']=_[_0x2b64('0x34')](_0x1badb1[_0x2b64('0x2e')],qs[_0x2b64('0x35')](_0x53e0b7[_0x2b64('0x30')][_0x2b64('0x35')]));_0x222c26[_0x2b64('0x36')]=_0x222c26['attributes'][_0x2b64('0x37')]?_0x222c26['attributes']:_0x1badb1[_0x2b64('0x2e')];if(!_0x53e0b7[_0x2b64('0x30')][_0x2b64('0x38')](_0x2b64('0x39'))){_0x222c26[_0x2b64('0x1e')]=qs[_0x2b64('0x1e')](_0x53e0b7['query'][_0x2b64('0x1e')]);_0x222c26[_0x2b64('0x1d')]=qs[_0x2b64('0x1d')](_0x53e0b7[_0x2b64('0x30')][_0x2b64('0x1d')]);}_0x222c26[_0x2b64('0x3a')]=qs[_0x2b64('0x3b')](_0x53e0b7[_0x2b64('0x30')][_0x2b64('0x3b')]);_0x222c26['where']=qs['filters'](_[_0x2b64('0x3c')](_0x53e0b7['query'],_0x1badb1[_0x2b64('0x33')]));if(_0x559f65[_0x2b64('0x31')]){if(_0x559f65[_0x2b64('0x32')]){_0x559f65[_0x2b64('0x32')]=moment(_0x559f65[_0x2b64('0x32')])[_0x2b64('0x3d')](0x1,_0x2b64('0x3e'));}else{_0x559f65['dateEnd']=moment(_0x559f65[_0x2b64('0x31')])[_0x2b64('0x3d')](0x1,_0x2b64('0x3e'));}_[_0x2b64('0x3f')](_0x222c26[_0x2b64('0x40')],{'createdAt':{'$gte':_0x559f65[_0x2b64('0x31')],'$lte':_0x559f65[_0x2b64('0x32')]}});}if(_0x53e0b7[_0x2b64('0x30')][_0x2b64('0x41')]){_0x222c26[_0x2b64('0x40')]=_[_0x2b64('0x3f')](_0x222c26[_0x2b64('0x40')],{'$or':_[_0x2b64('0x42')](_0x222c26[_0x2b64('0x36')],function(_0x2c305a){var _0x3ecb04={};_0x3ecb04[_0x2c305a]={'$like':'%'+_0x53e0b7[_0x2b64('0x30')][_0x2b64('0x41')]+'%'};return _0x3ecb04;})});}_0x222c26=_[_0x2b64('0x3f')]({},_0x222c26,_0x53e0b7[_0x2b64('0x43')]);var _0xcb4183={'where':_0x222c26['where']};return db[_0x2b64('0x44')]['count'](_0xcb4183)[_0x2b64('0x26')](function(_0x52a1ae){_0x415d11[_0x2b64('0x1c')]=_0x52a1ae;if(_0x53e0b7[_0x2b64('0x30')][_0x2b64('0x45')]){_0x222c26[_0x2b64('0x46')]=[{'all':!![]}];}return db[_0x2b64('0x44')]['findAll'](_0x222c26);})[_0x2b64('0x26')](function(_0x28dfc7){_0x415d11[_0x2b64('0x47')]=_0x28dfc7;return _0x415d11;})[_0x2b64('0x26')](respondWithFilteredResult(_0x3120c6,_0x222c26))[_0x2b64('0x48')](handleError(_0x3120c6,null));};exports[_0x2b64('0x49')]=function(_0x4b49c2,_0x5a5008){var _0x4b08e6={'raw':!![],'where':{'id':_0x4b49c2[_0x2b64('0x4a')]['id']}},_0x155c7c={};_0x155c7c[_0x2b64('0x2e')]=_['keys'](db[_0x2b64('0x44')][_0x2b64('0x2d')]);_0x155c7c[_0x2b64('0x30')]=_['keys'](_0x4b49c2[_0x2b64('0x30')]);_0x155c7c[_0x2b64('0x33')]=_[_0x2b64('0x34')](_0x155c7c['model'],_0x155c7c[_0x2b64('0x30')]);_0x4b08e6[_0x2b64('0x36')]=_[_0x2b64('0x34')](_0x155c7c['model'],qs[_0x2b64('0x35')](_0x4b49c2['query'][_0x2b64('0x35')]));_0x4b08e6['attributes']=_0x4b08e6[_0x2b64('0x36')][_0x2b64('0x37')]?_0x4b08e6[_0x2b64('0x36')]:_0x155c7c['model'];if(_0x4b49c2[_0x2b64('0x30')]['includeAll']){_0x4b08e6[_0x2b64('0x46')]=[{'all':!![]}];}_0x4b08e6=_['merge']({},_0x4b08e6,_0x4b49c2[_0x2b64('0x43')]);return db['SmsQueueReport'][_0x2b64('0x4b')](_0x4b08e6)['then'](handleEntityNotFound(_0x5a5008,null))[_0x2b64('0x26')](respondWithResult(_0x5a5008,null))[_0x2b64('0x48')](handleError(_0x5a5008,null));};exports[_0x2b64('0x4c')]=function(_0x2b7c3b,_0x40c649){return db[_0x2b64('0x44')]['create'](_0x2b7c3b[_0x2b64('0x4d')],{})[_0x2b64('0x26')](respondWithResult(_0x40c649,0xc9))['catch'](handleError(_0x40c649,null));};exports[_0x2b64('0x25')]=function(_0x52b45e,_0x3ed3a2){if(_0x52b45e[_0x2b64('0x4d')]['id']){delete _0x52b45e[_0x2b64('0x4d')]['id'];}return db[_0x2b64('0x44')][_0x2b64('0x4b')]({'where':{'id':_0x52b45e[_0x2b64('0x4a')]['id']}})[_0x2b64('0x26')](handleEntityNotFound(_0x3ed3a2,null))[_0x2b64('0x26')](saveUpdates(_0x52b45e[_0x2b64('0x4d')],null))[_0x2b64('0x26')](respondWithResult(_0x3ed3a2,null))['catch'](handleError(_0x3ed3a2,null));};exports['destroy']=function(_0xc2a889,_0x72cc69){return db['SmsQueueReport'][_0x2b64('0x4b')]({'where':{'id':_0xc2a889[_0x2b64('0x4a')]['id']}})['then'](handleEntityNotFound(_0x72cc69,null))[_0x2b64('0x26')](removeEntity(_0x72cc69,null))['catch'](handleError(_0x72cc69,null));};exports[_0x2b64('0x4e')]=function(_0x321a21,_0x1a1cf9){return db['SmsQueueReport'][_0x2b64('0x4e')]()['then'](respondWithResult(_0x1a1cf9,null))[_0x2b64('0x48')](handleError(_0x1a1cf9,null));}; \ No newline at end of file +var _0x5558=['status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','SmsQueueReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus'];(function(_0x54e665,_0x4f9f60){var _0x5f7a95=function(_0x445be9){while(--_0x445be9){_0x54e665['push'](_0x54e665['shift']());}};_0x5f7a95(++_0x4f9f60);}(_0x5558,0x7e));var _0x8555=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5558[_0x199572];return _0x13cfa3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8555('0x0'));var zipdir=require(_0x8555('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8555('0x2'));var moment=require(_0x8555('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8555('0x4'));var util=require('util');var path=require(_0x8555('0x5'));var sox=require(_0x8555('0x6'));var csv=require(_0x8555('0x7'));var ejs=require(_0x8555('0x8'));var fs=require('fs');var _=require(_0x8555('0x9'));var squel=require(_0x8555('0xa'));var crypto=require('crypto');var jsforce=require(_0x8555('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8555('0x7'));var querystring=require(_0x8555('0xc'));var Papa=require(_0x8555('0xd'));var Redis=require(_0x8555('0xe'));var qs=require(_0x8555('0xf'));var logger=require(_0x8555('0x10'))(_0x8555('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8555('0x12'))['db'];function respondWithStatusCode(_0x58e7f1,_0x36a51e){_0x36a51e=_0x36a51e||0xcc;return function(_0x13578f){if(_0x13578f){return _0x58e7f1[_0x8555('0x13')](_0x36a51e);}return _0x58e7f1['status'](_0x36a51e)['end']();};}function respondWithResult(_0x186d54,_0x4d077b){_0x4d077b=_0x4d077b||0xc8;return function(_0xfc146f){if(_0xfc146f){return _0x186d54[_0x8555('0x14')](_0x4d077b)['json'](_0xfc146f);}};}function respondWithFilteredResult(_0x4d0067,_0x38b428){return function(_0x4cfffa){if(_0x4cfffa){var _0x5f46ac=_0x4cfffa[_0x8555('0x15')],_0x160325=_0x38b428[_0x8555('0x16')],_0x2d7a39=_0x38b428[_0x8555('0x16')]+_0x38b428[_0x8555('0x17')],_0x49e330;if(_0x2d7a39>=_0x5f46ac){_0x2d7a39=_0x5f46ac;_0x49e330=0xc8;}else{_0x49e330=0xce;}_0x4d0067[_0x8555('0x14')](_0x49e330);return _0x4d0067[_0x8555('0x18')](_0x8555('0x19'),_0x160325+'-'+_0x2d7a39+'/'+_0x5f46ac)[_0x8555('0x1a')](_0x4cfffa);}return null;};}function patchUpdates(_0x593e55){return function(_0x6a34e){try{jsonpatch[_0x8555('0x1b')](_0x6a34e,_0x593e55,!![]);}catch(_0x157ce2){return BPromise[_0x8555('0x1c')](_0x157ce2);}return _0x6a34e['save']();};}function saveUpdates(_0x579c8,_0x374449){return function(_0x35e1ae){if(_0x35e1ae){return _0x35e1ae[_0x8555('0x1d')](_0x579c8)[_0x8555('0x1e')](function(_0xce3518){return _0xce3518;});}return null;};}function removeEntity(_0x47319a,_0x3e132a){return function(_0x1cdd44){if(_0x1cdd44){return _0x1cdd44[_0x8555('0x1f')]()['then'](function(){_0x47319a[_0x8555('0x14')](0xcc)[_0x8555('0x20')]();});}};}function handleEntityNotFound(_0xdf9df0,_0x18d6eb){return function(_0x5cf6e9){if(!_0x5cf6e9){_0xdf9df0[_0x8555('0x13')](0x194);}return _0x5cf6e9;};}function handleError(_0x4bdfee,_0x3d8a63){_0x3d8a63=_0x3d8a63||0x1f4;return function(_0x17f984){logger[_0x8555('0x21')](_0x17f984[_0x8555('0x22')]);if(_0x17f984[_0x8555('0x23')]){delete _0x17f984['name'];}_0x4bdfee['status'](_0x3d8a63)[_0x8555('0x24')](_0x17f984);};}exports[_0x8555('0x25')]=function(_0x113812,_0x3a8916){var _0x830f66={},_0x1353e7={},_0x1776c1={'count':0x0,'rows':[]};var _0x1202ef=db[_0x8555('0x26')][_0x8555('0x27')];_0x1353e7[_0x8555('0x28')]=_[_0x8555('0x29')](_0x1202ef);var _0x10454d={'dateStart':_0x113812['query'][_0x8555('0x2a')],'dateEnd':_0x113812[_0x8555('0x2b')][_0x8555('0x2c')]};delete _0x113812[_0x8555('0x2b')][_0x8555('0x2a')];delete _0x113812[_0x8555('0x2b')][_0x8555('0x2c')];_0x1353e7[_0x8555('0x2b')]=_['keys'](_0x113812[_0x8555('0x2b')]);_0x1353e7[_0x8555('0x2d')]=_['intersection'](_0x1353e7[_0x8555('0x28')],_0x1353e7[_0x8555('0x2b')]);_0x830f66[_0x8555('0x2e')]=_[_0x8555('0x2f')](_0x1353e7['model'],qs[_0x8555('0x30')](_0x113812[_0x8555('0x2b')][_0x8555('0x30')]));_0x830f66[_0x8555('0x2e')]=_0x830f66['attributes']['length']?_0x830f66[_0x8555('0x2e')]:_0x1353e7[_0x8555('0x28')];if(!_0x113812[_0x8555('0x2b')][_0x8555('0x31')](_0x8555('0x32'))){_0x830f66[_0x8555('0x17')]=qs[_0x8555('0x17')](_0x113812[_0x8555('0x2b')]['limit']);_0x830f66['offset']=qs['offset'](_0x113812['query'][_0x8555('0x16')]);}_0x830f66[_0x8555('0x33')]=qs[_0x8555('0x34')](_0x113812[_0x8555('0x2b')][_0x8555('0x34')]);_0x830f66[_0x8555('0x35')]=qs[_0x8555('0x2d')](_[_0x8555('0x36')](_0x113812[_0x8555('0x2b')],_0x1353e7['filters']));if(_0x10454d[_0x8555('0x2a')]){if(_0x10454d['dateEnd']){_0x10454d[_0x8555('0x2c')]=moment(_0x10454d['dateEnd'])[_0x8555('0x37')](0x1,_0x8555('0x38'));}else{_0x10454d[_0x8555('0x2c')]=moment(_0x10454d['dateStart'])[_0x8555('0x37')](0x1,'day');}_[_0x8555('0x39')](_0x830f66[_0x8555('0x35')],{'createdAt':{'$gte':_0x10454d[_0x8555('0x2a')],'$lte':_0x10454d[_0x8555('0x2c')]}});}if(_0x113812[_0x8555('0x2b')][_0x8555('0x3a')]){_0x830f66[_0x8555('0x35')]=_['merge'](_0x830f66[_0x8555('0x35')],{'$or':_[_0x8555('0x3b')](_0x830f66[_0x8555('0x2e')],function(_0x54d3e0){var _0x2fbfa5={};_0x2fbfa5[_0x54d3e0]={'$like':'%'+_0x113812[_0x8555('0x2b')]['filter']+'%'};return _0x2fbfa5;})});}_0x830f66=_[_0x8555('0x39')]({},_0x830f66,_0x113812[_0x8555('0x3c')]);var _0x2b71b5={'where':_0x830f66[_0x8555('0x35')]};return db[_0x8555('0x26')][_0x8555('0x15')](_0x2b71b5)[_0x8555('0x1e')](function(_0x587014){_0x1776c1[_0x8555('0x15')]=_0x587014;if(_0x113812[_0x8555('0x2b')][_0x8555('0x3d')]){_0x830f66[_0x8555('0x3e')]=[{'all':!![]}];}return db[_0x8555('0x26')][_0x8555('0x3f')](_0x830f66);})[_0x8555('0x1e')](function(_0x51e46d){_0x1776c1[_0x8555('0x40')]=_0x51e46d;return _0x1776c1;})['then'](respondWithFilteredResult(_0x3a8916,_0x830f66))[_0x8555('0x41')](handleError(_0x3a8916,null));};exports[_0x8555('0x42')]=function(_0x21cd64,_0x3eb8a0){var _0x3b3db1={'raw':!![],'where':{'id':_0x21cd64[_0x8555('0x43')]['id']}},_0x23f6cc={};_0x23f6cc[_0x8555('0x28')]=_[_0x8555('0x29')](db['SmsQueueReport'][_0x8555('0x27')]);_0x23f6cc[_0x8555('0x2b')]=_['keys'](_0x21cd64[_0x8555('0x2b')]);_0x23f6cc[_0x8555('0x2d')]=_[_0x8555('0x2f')](_0x23f6cc[_0x8555('0x28')],_0x23f6cc[_0x8555('0x2b')]);_0x3b3db1[_0x8555('0x2e')]=_[_0x8555('0x2f')](_0x23f6cc['model'],qs[_0x8555('0x30')](_0x21cd64[_0x8555('0x2b')][_0x8555('0x30')]));_0x3b3db1[_0x8555('0x2e')]=_0x3b3db1[_0x8555('0x2e')][_0x8555('0x44')]?_0x3b3db1[_0x8555('0x2e')]:_0x23f6cc[_0x8555('0x28')];if(_0x21cd64['query'][_0x8555('0x3d')]){_0x3b3db1[_0x8555('0x3e')]=[{'all':!![]}];}_0x3b3db1=_[_0x8555('0x39')]({},_0x3b3db1,_0x21cd64[_0x8555('0x3c')]);return db['SmsQueueReport'][_0x8555('0x45')](_0x3b3db1)[_0x8555('0x1e')](handleEntityNotFound(_0x3eb8a0,null))[_0x8555('0x1e')](respondWithResult(_0x3eb8a0,null))['catch'](handleError(_0x3eb8a0,null));};exports['create']=function(_0x2cfc93,_0x1744ea){return db['SmsQueueReport'][_0x8555('0x46')](_0x2cfc93['body'],{})['then'](respondWithResult(_0x1744ea,0xc9))[_0x8555('0x41')](handleError(_0x1744ea,null));};exports[_0x8555('0x1d')]=function(_0x23e5f8,_0x5535b5){if(_0x23e5f8['body']['id']){delete _0x23e5f8[_0x8555('0x47')]['id'];}return db[_0x8555('0x26')]['find']({'where':{'id':_0x23e5f8[_0x8555('0x43')]['id']}})[_0x8555('0x1e')](handleEntityNotFound(_0x5535b5,null))[_0x8555('0x1e')](saveUpdates(_0x23e5f8[_0x8555('0x47')],null))[_0x8555('0x1e')](respondWithResult(_0x5535b5,null))[_0x8555('0x41')](handleError(_0x5535b5,null));};exports[_0x8555('0x1f')]=function(_0x19a8d8,_0x53dad9){return db[_0x8555('0x26')][_0x8555('0x45')]({'where':{'id':_0x19a8d8[_0x8555('0x43')]['id']}})[_0x8555('0x1e')](handleEntityNotFound(_0x53dad9,null))[_0x8555('0x1e')](removeEntity(_0x53dad9,null))['catch'](handleError(_0x53dad9,null));};exports[_0x8555('0x48')]=function(_0x2e8117,_0x5a27b0){return db[_0x8555('0x26')][_0x8555('0x48')]()['then'](respondWithResult(_0x5a27b0,null))[_0x8555('0x41')](handleError(_0x5a27b0,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index cf2b3d7..b1c61b4 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 _0xbe7c=['util','../../config/logger','api','moment','exports','define','uniqueid','lodash'];(function(_0x2f982e,_0x13fce8){var _0x1067e7=function(_0x4d274d){while(--_0x4d274d){_0x2f982e['push'](_0x2f982e['shift']());}};_0x1067e7(++_0x13fce8);}(_0xbe7c,0x19f));var _0xcbe7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbe7c[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xcbe7('0x0'));var util=require(_0xcbe7('0x1'));var logger=require(_0xcbe7('0x2'))(_0xcbe7('0x3'));var moment=require(_0xcbe7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./smsQueueReport.attributes');module[_0xcbe7('0x5')]=function(_0x4e276a,_0x2b9d26){return _0x4e276a[_0xcbe7('0x6')]('SmsQueueReport',attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0xcbe7('0x7'),'fields':[_0xcbe7('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ef6=['lodash','util','../../config/logger','./smsQueueReport.attributes','define','report_sms_queue','uniqueid'];(function(_0x3dc79e,_0x557223){var _0xbe2991=function(_0x147d9c){while(--_0x147d9c){_0x3dc79e['push'](_0x3dc79e['shift']());}};_0xbe2991(++_0x557223);}(_0x1ef6,0x16c));var _0x61ef=function(_0x275e50,_0x1d52b8){_0x275e50=_0x275e50-0x0;var _0x1b1ab0=_0x1ef6[_0x275e50];return _0x1b1ab0;};'use strict';var _=require(_0x61ef('0x0'));var util=require(_0x61ef('0x1'));var logger=require(_0x61ef('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x61ef('0x3'));module['exports']=function(_0x2db14c,_0x127fbe){return _0x2db14c[_0x61ef('0x4')]('SmsQueueReport',attributes,{'tableName':_0x61ef('0x5'),'paranoid':![],'indexes':[{'name':_0x61ef('0x6'),'fields':[_0x61ef('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index d300965..2f345f2 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 _0xc199=['raw','catch','UpdateSmsQueueReport','update','limit','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','CreateSmsQueueReport','SmsQueueReport','create','body','options'];(function(_0x3fb37a,_0x4fa12b){var _0x3e8cf0=function(_0x1bf56a){while(--_0x1bf56a){_0x3fb37a['push'](_0x3fb37a['shift']());}};_0x3e8cf0(++_0x4fa12b);}(_0xc199,0x96));var _0x9c19=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xc199[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x9c19('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9c19('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c19('0x2'));var db=require(_0x9c19('0x3'))['db'];var utils=require(_0x9c19('0x4'));var logger=require('../../config/logger')(_0x9c19('0x5'));var config=require(_0x9c19('0x6'));var jayson=require(_0x9c19('0x7'));var client=jayson['client'][_0x9c19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x317972,_0xcf8b81,_0xbd0fd4){return new BPromise(function(_0x2af4f2,_0x3b3f32){return client[_0x9c19('0x9')](_0x317972,_0xbd0fd4)[_0x9c19('0xa')](function(_0x229255){logger[_0x9c19('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0xcf8b81,_0x9c19('0xc'));logger[_0x9c19('0xd')](_0x9c19('0xe'),_0xcf8b81,'request\x20sent',JSON[_0x9c19('0xf')](_0x229255));if(_0x229255['error']){if(_0x229255[_0x9c19('0x10')]['code']===0x1f4){logger[_0x9c19('0x10')](_0x9c19('0x11'),_0xcf8b81,_0x229255['error'][_0x9c19('0x12')]);return _0x3b3f32(_0x229255[_0x9c19('0x10')][_0x9c19('0x12')]);}logger[_0x9c19('0x10')](_0x9c19('0x11'),_0xcf8b81,_0x229255[_0x9c19('0x10')]['message']);return _0x2af4f2(_0x229255[_0x9c19('0x10')][_0x9c19('0x12')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0xcf8b81,_0x9c19('0xc'));_0x2af4f2(_0x229255['result'][_0x9c19('0x12')]);}})['catch'](function(_0x3be04b){logger[_0x9c19('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0xcf8b81,_0x3be04b);_0x3b3f32(_0x3be04b);});});}exports[_0x9c19('0x13')]=function(_0x44dc90){var _0x52fa01=this;return new Promise(function(_0x5ec3d0,_0x373c79){return db[_0x9c19('0x14')][_0x9c19('0x15')](_0x44dc90[_0x9c19('0x16')],{'raw':_0x44dc90[_0x9c19('0x17')]?_0x44dc90[_0x9c19('0x17')][_0x9c19('0x18')]===undefined?!![]:![]:!![]})[_0x9c19('0xa')](function(_0x3b6a4b){logger[_0x9c19('0xb')]('CreateSmsQueueReport',_0x44dc90);logger[_0x9c19('0xd')](_0x9c19('0x13'),_0x44dc90,JSON[_0x9c19('0xf')](_0x3b6a4b));_0x5ec3d0(_0x3b6a4b);})[_0x9c19('0x19')](function(_0xc6976f){logger['error']('CreateSmsQueueReport',_0xc6976f['message'],_0x44dc90);_0x373c79(_0x52fa01[_0x9c19('0x10')](0x1f4,_0xc6976f[_0x9c19('0x12')]));});});};exports[_0x9c19('0x1a')]=function(_0x59a0ed){var _0x2a7dc6=this;return new Promise(function(_0x34172e,_0x2eb30e){return db[_0x9c19('0x14')][_0x9c19('0x1b')](_0x59a0ed['body'],{'raw':_0x59a0ed[_0x9c19('0x17')]?_0x59a0ed[_0x9c19('0x17')][_0x9c19('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59a0ed[_0x9c19('0x17')]?_0x59a0ed[_0x9c19('0x17')]['where']||null:null,'attributes':_0x59a0ed['options']?_0x59a0ed[_0x9c19('0x17')]['attributes']||null:null,'limit':_0x59a0ed[_0x9c19('0x17')]?_0x59a0ed[_0x9c19('0x17')][_0x9c19('0x1c')]||null:null})[_0x9c19('0xa')](function(_0x2921ec){logger['info'](_0x9c19('0x1a'),_0x59a0ed);logger[_0x9c19('0xd')]('UpdateSmsQueueReport',_0x59a0ed,JSON[_0x9c19('0xf')](_0x2921ec));_0x34172e(_0x2921ec);})[_0x9c19('0x19')](function(_0x15d29f){logger['error'](_0x9c19('0x1a'),_0x15d29f[_0x9c19('0x12')],_0x59a0ed);_0x2eb30e(_0x2a7dc6['error'](0x1f4,_0x15d29f['message']));});});}; \ No newline at end of file +var _0xab01=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','info','UpdateSmsQueueReport','update','raw','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x336b69,_0x413e59){var _0x12f0c2=function(_0x520536){while(--_0x520536){_0x336b69['push'](_0x336b69['shift']());}};_0x12f0c2(++_0x413e59);}(_0xab01,0x11b));var _0x1ab0=function(_0x4a737d,_0x3c85ee){_0x4a737d=_0x4a737d-0x0;var _0x1ca394=_0xab01[_0x4a737d];return _0x1ca394;};'use strict';var _=require(_0x1ab0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1ab0('0x1'));var rs=require(_0x1ab0('0x2'));var fs=require('fs');var Redis=require(_0x1ab0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ab0('0x4'));var logger=require(_0x1ab0('0x5'))('rpc');var config=require(_0x1ab0('0x6'));var jayson=require(_0x1ab0('0x7'));var client=jayson[_0x1ab0('0x8')][_0x1ab0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ce3e9,_0x2504fe,_0x6d0ca2){return new BPromise(function(_0x2784a1,_0x3ba863){return client[_0x1ab0('0xa')](_0x3ce3e9,_0x6d0ca2)[_0x1ab0('0xb')](function(_0x20afa5){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x2504fe,'request\x20sent');logger[_0x1ab0('0xc')](_0x1ab0('0xd'),_0x2504fe,'request\x20sent',JSON[_0x1ab0('0xe')](_0x20afa5));if(_0x20afa5[_0x1ab0('0xf')]){if(_0x20afa5[_0x1ab0('0xf')]['code']===0x1f4){logger['error'](_0x1ab0('0x10'),_0x2504fe,_0x20afa5['error'][_0x1ab0('0x11')]);return _0x3ba863(_0x20afa5[_0x1ab0('0xf')]['message']);}logger[_0x1ab0('0xf')](_0x1ab0('0x10'),_0x2504fe,_0x20afa5['error'][_0x1ab0('0x11')]);return _0x2784a1(_0x20afa5['error'][_0x1ab0('0x11')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x2504fe,_0x1ab0('0x12'));_0x2784a1(_0x20afa5[_0x1ab0('0x13')][_0x1ab0('0x11')]);}})[_0x1ab0('0x14')](function(_0x35aa4f){logger[_0x1ab0('0xf')](_0x1ab0('0x10'),_0x2504fe,_0x35aa4f);_0x3ba863(_0x35aa4f);});});}exports[_0x1ab0('0x15')]=function(_0x30ddca){var _0x39da39=this;return new Promise(function(_0x430137,_0x4153ec){return db[_0x1ab0('0x16')][_0x1ab0('0x17')](_0x30ddca['body'],{'raw':_0x30ddca[_0x1ab0('0x18')]?_0x30ddca[_0x1ab0('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x1ab0('0xb')](function(_0x3b0ff8){logger[_0x1ab0('0x19')](_0x1ab0('0x15'),_0x30ddca);logger[_0x1ab0('0xc')](_0x1ab0('0x15'),_0x30ddca,JSON[_0x1ab0('0xe')](_0x3b0ff8));_0x430137(_0x3b0ff8);})[_0x1ab0('0x14')](function(_0x908b7b){logger[_0x1ab0('0xf')]('CreateSmsQueueReport',_0x908b7b[_0x1ab0('0x11')],_0x30ddca);_0x4153ec(_0x39da39[_0x1ab0('0xf')](0x1f4,_0x908b7b[_0x1ab0('0x11')]));});});};exports[_0x1ab0('0x1a')]=function(_0x133dca){var _0x2ee6a9=this;return new Promise(function(_0x2a0775,_0x557658){return db[_0x1ab0('0x16')][_0x1ab0('0x1b')](_0x133dca['body'],{'raw':_0x133dca[_0x1ab0('0x18')]?_0x133dca['options'][_0x1ab0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x133dca[_0x1ab0('0x18')]?_0x133dca[_0x1ab0('0x18')][_0x1ab0('0x1d')]||null:null,'attributes':_0x133dca[_0x1ab0('0x18')]?_0x133dca['options'][_0x1ab0('0x1e')]||null:null,'limit':_0x133dca[_0x1ab0('0x18')]?_0x133dca['options'][_0x1ab0('0x1f')]||null:null})[_0x1ab0('0xb')](function(_0x4db1be){logger['info'](_0x1ab0('0x1a'),_0x133dca);logger[_0x1ab0('0xc')](_0x1ab0('0x1a'),_0x133dca,JSON[_0x1ab0('0xe')](_0x4db1be));_0x2a0775(_0x4db1be);})[_0x1ab0('0x14')](function(_0x23a847){logger[_0x1ab0('0xf')](_0x1ab0('0x1a'),_0x23a847[_0x1ab0('0x11')],_0x133dca);_0x557658(_0x2ee6a9['error'](0x1f4,_0x23a847[_0x1ab0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 198866d..90284d8 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 _0x8ca9=['post','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','/describe','get','/:id','show'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x8ca9,0x16c));var _0x98ca=function(_0x1b8cad,_0x23d4ff){_0x1b8cad=_0x1b8cad-0x0;var _0x5f2562=_0x8ca9[_0x1b8cad];return _0x5f2562;};'use strict';var multer=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var path=require(_0x98ca('0x2'));var timeout=require(_0x98ca('0x3'));var express=require(_0x98ca('0x4'));var router=express[_0x98ca('0x5')]();var auth=require(_0x98ca('0x6'));var interaction=require(_0x98ca('0x7'));var config=require(_0x98ca('0x8'));var controller=require(_0x98ca('0x9'));router['get']('/',auth[_0x98ca('0xa')](),controller[_0x98ca('0xb')]);router['get'](_0x98ca('0xc'),auth[_0x98ca('0xa')](),controller['describe']);router[_0x98ca('0xd')](_0x98ca('0xe'),auth[_0x98ca('0xa')](),controller[_0x98ca('0xf')]);router[_0x98ca('0x10')]('/',auth[_0x98ca('0xa')](),controller['create']);router[_0x98ca('0x11')](_0x98ca('0xe'),auth[_0x98ca('0xa')](),controller[_0x98ca('0x12')]);router['delete'](_0x98ca('0xe'),auth[_0x98ca('0xa')](),controller[_0x98ca('0x13')]);module['exports']=router; \ No newline at end of file +var _0x63c6=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','/describe','isAuthenticated','describe','post','delete','destroy','exports','multer','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63c6,0x11e));var _0x663c=function(_0x110104,_0x266f24){_0x110104=_0x110104-0x0;var _0x344dd0=_0x63c6[_0x110104];return _0x344dd0;};'use strict';var multer=require(_0x663c('0x0'));var util=require('util');var path=require(_0x663c('0x1'));var timeout=require(_0x663c('0x2'));var express=require(_0x663c('0x3'));var router=express[_0x663c('0x4')]();var auth=require(_0x663c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x663c('0x6'));var controller=require(_0x663c('0x7'));router[_0x663c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x663c('0x8')](_0x663c('0x9'),auth[_0x663c('0xa')](),controller[_0x663c('0xb')]);router[_0x663c('0x8')]('/:id',auth[_0x663c('0xa')](),controller['show']);router[_0x663c('0xc')]('/',auth[_0x663c('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x663c('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x663c('0xe')]);module[_0x663c('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 28250f0..d63a712 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 _0x9f2a=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x9f2a,0x1d1));var _0xa9f2=function(_0x1b15a4,_0x6ea8f2){_0x1b15a4=_0x1b15a4-0x0;var _0x453a1f=_0x9f2a[_0x1b15a4];return _0x453a1f;};'use strict';var moment=require(_0xa9f2('0x0'));var Sequelize=require(_0xa9f2('0x1'));module[_0xa9f2('0x2')]={'uniqueid':{'type':Sequelize[_0xa9f2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa9f2('0x4')](_0xa9f2('0x5'),_0xa9f2('0x6'),_0xa9f2('0x7')),'allowNull':![],'defaultValue':_0xa9f2('0x7')},'transferredAt':{'type':Sequelize[_0xa9f2('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xa9f2('0x9')]}}; \ No newline at end of file +var _0x2fcd=['NOW','exports','ENUM','account','agent','queue','DATE'];(function(_0x24a074,_0x24f9e2){var _0x3f1fc3=function(_0x244d16){while(--_0x244d16){_0x24a074['push'](_0x24a074['shift']());}};_0x3f1fc3(++_0x24f9e2);}(_0x2fcd,0x17b));var _0xd2fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fcd[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd2fc('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd2fc('0x1')](_0xd2fc('0x2'),_0xd2fc('0x3'),_0xd2fc('0x4')),'allowNull':![],'defaultValue':_0xd2fc('0x4')},'transferredAt':{'type':Sequelize[_0xd2fc('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xd2fc('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index df7c204..c35f984 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(_0x2f6393,_0x1c071a){var _0x1361e6=function(_0x272609){while(--_0x272609){_0x2f6393['push'](_0x2f6393['shift']());}};_0x1361e6(++_0x1c071a);}(_0x7a54,0x106));var _0x47a5=function(_0x4c15b9,_0x5d62aa){_0x4c15b9=_0x4c15b9-0x0;var _0x2b6318=_0x7a54[_0x4c15b9];return _0x2b6318;};'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 _0x326f=['show','params','options','find','create','update','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','destroy','sendStatus','error','send','index','SmsTransferReport','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','add','day','merge','filter','then','includeAll','include','findAll','rows','catch'];(function(_0x5df92c,_0x2663e9){var _0x342e42=function(_0x5e065b){while(--_0x5e065b){_0x5df92c['push'](_0x5df92c['shift']());}};_0x342e42(++_0x2663e9);}(_0x326f,0xd1));var _0xf326=function(_0x38ba6d,_0x363eac){_0x38ba6d=_0x38ba6d-0x0;var _0x391e34=_0x326f[_0x38ba6d];return _0x391e34;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var qs=require(_0xf326('0x11'));var logger=require(_0xf326('0x12'))(_0xf326('0x13'));var utils=require('../../config/utils');var config=require(_0xf326('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cf441,_0x4aaf3a){_0x4aaf3a=_0x4aaf3a||0xcc;return function(_0x2e4b71){if(_0x2e4b71){return _0x1cf441['sendStatus'](_0x4aaf3a);}return _0x1cf441[_0xf326('0x15')](_0x4aaf3a)[_0xf326('0x16')]();};}function respondWithResult(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xc8;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x15')](_0x342fe5)[_0xf326('0x17')](_0x472632);}};}function respondWithFilteredResult(_0x5c8483,_0x45c1b6){return function(_0x5204ee){if(_0x5204ee){var _0x54bd1a=_0x5204ee[_0xf326('0x18')],_0xdf21d9=_0x45c1b6[_0xf326('0x19')],_0x11f6d2=_0x45c1b6[_0xf326('0x19')]+_0x45c1b6[_0xf326('0x1a')],_0x1f2e5a;if(_0x11f6d2>=_0x54bd1a){_0x11f6d2=_0x54bd1a;_0x1f2e5a=0xc8;}else{_0x1f2e5a=0xce;}_0x5c8483[_0xf326('0x15')](_0x1f2e5a);return _0x5c8483['set'](_0xf326('0x1b'),_0xdf21d9+'-'+_0x11f6d2+'/'+_0x54bd1a)[_0xf326('0x17')](_0x5204ee);}return null;};}function patchUpdates(_0x18bee3){return function(_0x31ffb9){try{jsonpatch[_0xf326('0x1c')](_0x31ffb9,_0x18bee3,!![]);}catch(_0x311af0){return BPromise['reject'](_0x311af0);}return _0x31ffb9['save']();};}function saveUpdates(_0x56ad41,_0x16e605){return function(_0x289f4b){if(_0x289f4b){return _0x289f4b['update'](_0x56ad41)['then'](function(_0x128c68){return _0x128c68;});}return null;};}function removeEntity(_0x4dfa76,_0x5b6d3c){return function(_0x448b92){if(_0x448b92){return _0x448b92[_0xf326('0x1d')]()['then'](function(){_0x4dfa76['status'](0xcc)[_0xf326('0x16')]();});}};}function handleEntityNotFound(_0xb1efcf,_0x5f21a2){return function(_0x337ed5){if(!_0x337ed5){_0xb1efcf[_0xf326('0x1e')](0x194);}return _0x337ed5;};}function handleError(_0x43c53e,_0x295752){_0x295752=_0x295752||0x1f4;return function(_0x17c157){logger[_0xf326('0x1f')](_0x17c157['stack']);if(_0x17c157['name']){delete _0x17c157['name'];}_0x43c53e[_0xf326('0x15')](_0x295752)[_0xf326('0x20')](_0x17c157);};}exports[_0xf326('0x21')]=function(_0x1ff2b5,_0x148953){var _0x410237={},_0x5217d4={},_0x201d28={'count':0x0,'rows':[]};var _0xa3c0b=db[_0xf326('0x22')]['rawAttributes'];_0x5217d4[_0xf326('0x23')]=_['keys'](_0xa3c0b);var _0x4a9abf={'dateStart':_0x1ff2b5[_0xf326('0x24')][_0xf326('0x25')],'dateEnd':_0x1ff2b5[_0xf326('0x24')]['dateEnd']};delete _0x1ff2b5[_0xf326('0x24')][_0xf326('0x25')];delete _0x1ff2b5['query'][_0xf326('0x26')];_0x5217d4[_0xf326('0x24')]=_[_0xf326('0x27')](_0x1ff2b5[_0xf326('0x24')]);_0x5217d4[_0xf326('0x28')]=_[_0xf326('0x29')](_0x5217d4[_0xf326('0x23')],_0x5217d4[_0xf326('0x24')]);_0x410237[_0xf326('0x2a')]=_[_0xf326('0x29')](_0x5217d4['model'],qs[_0xf326('0x2b')](_0x1ff2b5[_0xf326('0x24')][_0xf326('0x2b')]));_0x410237['attributes']=_0x410237[_0xf326('0x2a')][_0xf326('0x2c')]?_0x410237[_0xf326('0x2a')]:_0x5217d4['model'];if(!_0x1ff2b5['query'][_0xf326('0x2d')](_0xf326('0x2e'))){_0x410237[_0xf326('0x1a')]=qs[_0xf326('0x1a')](_0x1ff2b5[_0xf326('0x24')][_0xf326('0x1a')]);_0x410237[_0xf326('0x19')]=qs[_0xf326('0x19')](_0x1ff2b5['query'][_0xf326('0x19')]);}_0x410237[_0xf326('0x2f')]=qs['sort'](_0x1ff2b5[_0xf326('0x24')]['sort']);_0x410237[_0xf326('0x30')]=qs['filters'](_['pick'](_0x1ff2b5[_0xf326('0x24')],_0x5217d4['filters']));if(_0x4a9abf[_0xf326('0x25')]){if(_0x4a9abf['dateEnd']){_0x4a9abf[_0xf326('0x26')]=moment(_0x4a9abf[_0xf326('0x26')])[_0xf326('0x31')](0x1,'day');}else{_0x4a9abf[_0xf326('0x26')]=moment(_0x4a9abf[_0xf326('0x25')])['add'](0x1,_0xf326('0x32'));}_[_0xf326('0x33')](_0x410237[_0xf326('0x30')],{'createdAt':{'$gte':_0x4a9abf[_0xf326('0x25')],'$lte':_0x4a9abf['dateEnd']}});}if(_0x1ff2b5[_0xf326('0x24')][_0xf326('0x34')]){_0x410237[_0xf326('0x30')]=_[_0xf326('0x33')](_0x410237[_0xf326('0x30')],{'$or':_['map'](_0x410237[_0xf326('0x2a')],function(_0x1b7bf6){var _0x5cfb97={};_0x5cfb97[_0x1b7bf6]={'$like':'%'+_0x1ff2b5['query'][_0xf326('0x34')]+'%'};return _0x5cfb97;})});}_0x410237=_['merge']({},_0x410237,_0x1ff2b5['options']);var _0x22d462={'where':_0x410237['where']};return db[_0xf326('0x22')][_0xf326('0x18')](_0x22d462)[_0xf326('0x35')](function(_0x39611e){_0x201d28['count']=_0x39611e;if(_0x1ff2b5[_0xf326('0x24')][_0xf326('0x36')]){_0x410237[_0xf326('0x37')]=[{'all':!![]}];}return db[_0xf326('0x22')][_0xf326('0x38')](_0x410237);})[_0xf326('0x35')](function(_0x2ad841){_0x201d28[_0xf326('0x39')]=_0x2ad841;return _0x201d28;})[_0xf326('0x35')](respondWithFilteredResult(_0x148953,_0x410237))[_0xf326('0x3a')](handleError(_0x148953,null));};exports[_0xf326('0x3b')]=function(_0x2bab13,_0x50d63f){var _0x1b6126={'raw':!![],'where':{'id':_0x2bab13[_0xf326('0x3c')]['id']}},_0x1637dc={};_0x1637dc[_0xf326('0x23')]=_[_0xf326('0x27')](db[_0xf326('0x22')]['rawAttributes']);_0x1637dc[_0xf326('0x24')]=_[_0xf326('0x27')](_0x2bab13['query']);_0x1637dc[_0xf326('0x28')]=_[_0xf326('0x29')](_0x1637dc[_0xf326('0x23')],_0x1637dc[_0xf326('0x24')]);_0x1b6126[_0xf326('0x2a')]=_['intersection'](_0x1637dc['model'],qs[_0xf326('0x2b')](_0x2bab13[_0xf326('0x24')]['fields']));_0x1b6126['attributes']=_0x1b6126[_0xf326('0x2a')][_0xf326('0x2c')]?_0x1b6126[_0xf326('0x2a')]:_0x1637dc['model'];if(_0x2bab13[_0xf326('0x24')][_0xf326('0x36')]){_0x1b6126[_0xf326('0x37')]=[{'all':!![]}];}_0x1b6126=_[_0xf326('0x33')]({},_0x1b6126,_0x2bab13[_0xf326('0x3d')]);return db[_0xf326('0x22')][_0xf326('0x3e')](_0x1b6126)[_0xf326('0x35')](handleEntityNotFound(_0x50d63f,null))[_0xf326('0x35')](respondWithResult(_0x50d63f,null))[_0xf326('0x3a')](handleError(_0x50d63f,null));};exports[_0xf326('0x3f')]=function(_0xa1ba7a,_0x1beef7){return db[_0xf326('0x22')][_0xf326('0x3f')](_0xa1ba7a['body'],{})[_0xf326('0x35')](respondWithResult(_0x1beef7,0xc9))[_0xf326('0x3a')](handleError(_0x1beef7,null));};exports[_0xf326('0x40')]=function(_0x28dde6,_0x5f1829){if(_0x28dde6[_0xf326('0x41')]['id']){delete _0x28dde6[_0xf326('0x41')]['id'];}return db[_0xf326('0x22')][_0xf326('0x3e')]({'where':{'id':_0x28dde6['params']['id']}})[_0xf326('0x35')](handleEntityNotFound(_0x5f1829,null))[_0xf326('0x35')](saveUpdates(_0x28dde6[_0xf326('0x41')],null))[_0xf326('0x35')](respondWithResult(_0x5f1829,null))[_0xf326('0x3a')](handleError(_0x5f1829,null));};exports['destroy']=function(_0x5d312d,_0x15b469){return db[_0xf326('0x22')][_0xf326('0x3e')]({'where':{'id':_0x5d312d['params']['id']}})[_0xf326('0x35')](handleEntityNotFound(_0x15b469,null))[_0xf326('0x35')](removeEntity(_0x15b469,null))[_0xf326('0x3a')](handleError(_0x15b469,null));};exports['describe']=function(_0x47b308,_0x36ef89){return db['SmsTransferReport'][_0xf326('0x42')]()['then'](respondWithResult(_0x36ef89,null))[_0xf326('0x3a')](handleError(_0x36ef89,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 5dd45f3..233ce51 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 _0xd6d6=['define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','./smsTransferReport.attributes','exports'];(function(_0x516f55,_0x2b0103){var _0x42cdfa=function(_0xc8e3ab){while(--_0xc8e3ab){_0x516f55['push'](_0x516f55['shift']());}};_0x42cdfa(++_0x2b0103);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3452ef,_0x4f772a){_0x3452ef=_0x3452ef-0x0;var _0x4083be=_0xd6d6[_0x3452ef];return _0x4083be;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var attributes=require(_0x6d6d('0x6'));module[_0x6d6d('0x7')]=function(_0x5207c9,_0x16e259){return _0x5207c9[_0x6d6d('0x8')]('SmsTransferReport',attributes,{'tableName':_0x6d6d('0x9'),'paranoid':![],'indexes':[{'name':_0x6d6d('0xa'),'fields':[_0x6d6d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird','./smsTransferReport.attributes','exports'];(function(_0x31d53a,_0x101401){var _0x1a093c=function(_0x4c38c9){while(--_0x4c38c9){_0x31d53a['push'](_0x31d53a['shift']());}};_0x1a093c(++_0x101401);}(_0xb43b,0x1b2));var _0xbb43=function(_0x13d7ec,_0x388edf){_0x13d7ec=_0x13d7ec-0x0;var _0x239c99=_0xb43b[_0x13d7ec];return _0x239c99;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var attributes=require(_0xbb43('0x5'));module[_0xbb43('0x6')]=function(_0x351254,_0x16432a){return _0x351254['define']('SmsTransferReport',attributes,{'tableName':_0xbb43('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbb43('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a38df30..8b14832 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 _0xd290=['error','code','message','request\x20sent','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5ce2fd,_0x312ce1){var _0xac931f=function(_0x34bb17){while(--_0x34bb17){_0x5ce2fd['push'](_0x5ce2fd['shift']());}};_0xac931f(++_0x312ce1);}(_0xd290,0x165));var _0x0d29=function(_0x1136e6,_0x39e214){_0x1136e6=_0x1136e6-0x0;var _0x9a834=_0xd290[_0x1136e6];return _0x9a834;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require('moment');var BPromise=require(_0x0d29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d29('0x3'))['db'];var utils=require(_0x0d29('0x4'));var logger=require(_0x0d29('0x5'))(_0x0d29('0x6'));var config=require(_0x0d29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d29('0x8')][_0x0d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151d32,_0x376d19,_0x276aeb){return new BPromise(function(_0x4edfcd,_0x3ee63c){return client[_0x0d29('0xa')](_0x151d32,_0x276aeb)[_0x0d29('0xb')](function(_0x4b876e){logger[_0x0d29('0xc')](_0x0d29('0xd'),_0x376d19,'request\x20sent');logger[_0x0d29('0xe')](_0x0d29('0xf'),_0x376d19,'request\x20sent',JSON[_0x0d29('0x10')](_0x4b876e));if(_0x4b876e['error']){if(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x12')]===0x1f4){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x3ee63c(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x13')]);}logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x4edfcd(_0x4b876e['error']['message']);}else{logger[_0x0d29('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x376d19,_0x0d29('0x14'));_0x4edfcd(_0x4b876e['result'][_0x0d29('0x13')]);}})[_0x0d29('0x15')](function(_0x2a04d6){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x2a04d6);_0x3ee63c(_0x2a04d6);});});} \ No newline at end of file +var _0x4d68=['request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4d68,0x1c3));var _0x84d6=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0x4d68[_0x36f243];return _0x426436;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var moment=require(_0x84d6('0x2'));var BPromise=require(_0x84d6('0x3'));var rs=require(_0x84d6('0x4'));var fs=require('fs');var Redis=require(_0x84d6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x84d6('0x6'));var logger=require('../../config/logger')(_0x84d6('0x7'));var config=require('../../config/environment');var jayson=require(_0x84d6('0x8'));var client=jayson[_0x84d6('0x9')][_0x84d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539e34,_0x561dd8,_0x218daf){return new BPromise(function(_0xa64ed3,_0x260859){return client[_0x84d6('0xb')](_0x539e34,_0x218daf)['then'](function(_0x411c7f){logger['info'](_0x84d6('0xc'),_0x561dd8,_0x84d6('0xd'));logger[_0x84d6('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x561dd8,'request\x20sent',JSON[_0x84d6('0xf')](_0x411c7f));if(_0x411c7f['error']){if(_0x411c7f[_0x84d6('0x10')][_0x84d6('0x11')]===0x1f4){logger[_0x84d6('0x10')](_0x84d6('0xc'),_0x561dd8,_0x411c7f[_0x84d6('0x10')]['message']);return _0x260859(_0x411c7f[_0x84d6('0x10')]['message']);}logger[_0x84d6('0x10')](_0x84d6('0xc'),_0x561dd8,_0x411c7f[_0x84d6('0x10')][_0x84d6('0x12')]);return _0xa64ed3(_0x411c7f[_0x84d6('0x10')][_0x84d6('0x12')]);}else{logger[_0x84d6('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x561dd8,_0x84d6('0xd'));_0xa64ed3(_0x411c7f[_0x84d6('0x14')][_0x84d6('0x12')]);}})[_0x84d6('0x15')](function(_0x385e2b){logger['error'](_0x84d6('0xc'),_0x561dd8,_0x385e2b);_0x260859(_0x385e2b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 2f8a206..ac5b007 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 _0xf603=['show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','create','/:id','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0xf603,0x1e3));var _0x3f60=function(_0x302ef9,_0x1e6a70){_0x302ef9=_0x302ef9-0x0;var _0x3398b3=_0xf603[_0x302ef9];return _0x3398b3;};'use strict';var multer=require(_0x3f60('0x0'));var util=require(_0x3f60('0x1'));var path=require(_0x3f60('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x3f60('0x3'));var interaction=require(_0x3f60('0x4'));var config=require(_0x3f60('0x5'));var controller=require(_0x3f60('0x6'));router[_0x3f60('0x7')]('/',auth[_0x3f60('0x8')](),controller[_0x3f60('0x9')]);router[_0x3f60('0x7')]('/:id',auth[_0x3f60('0x8')](),controller[_0x3f60('0xa')]);router['get'](_0x3f60('0xb'),auth[_0x3f60('0x8')](),controller[_0x3f60('0xc')]);var upload=multer({'storage':multer[_0x3f60('0xd')]({'destination':function(_0x5a379a,_0x5dc0a2,_0x2afeed){_0x2afeed(null,path[_0x3f60('0xe')](config[_0x3f60('0xf')],_0x3f60('0x10')));},'filename':function(_0x596ed9,_0x18f09f,_0x473a76){_0x18f09f[_0x3f60('0x11')]=_0x18f09f[_0x3f60('0x11')][_0x3f60('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x473a76(null,util[_0x3f60('0x13')](_0x3f60('0x14'),path[_0x3f60('0x15')](_0x18f09f['originalname'],path[_0x3f60('0x16')](_0x18f09f[_0x3f60('0x11')])),Date['now'](),path[_0x3f60('0x16')](_0x18f09f[_0x3f60('0x11')])));}})});router[_0x3f60('0x17')]('/',upload[_0x3f60('0x18')]('file'),controller[_0x3f60('0x19')]);router['put'](_0x3f60('0x1a'),auth[_0x3f60('0x8')](),controller['update']);router['delete'](_0x3f60('0x1a'),auth[_0x3f60('0x8')](),controller[_0x3f60('0x1b')]);module[_0x3f60('0x1c')]=router; \ No newline at end of file +var _0x5e67=['root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','post','file','create','put','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5e67,0x11c));var _0x75e6=function(_0x381ed8,_0x24e74a){_0x381ed8=_0x381ed8-0x0;var _0x53d833=_0x5e67[_0x381ed8];return _0x53d833;};'use strict';var multer=require(_0x75e6('0x0'));var util=require('util');var path=require(_0x75e6('0x1'));var timeout=require(_0x75e6('0x2'));var express=require('express');var router=express[_0x75e6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x75e6('0x4'));var config=require(_0x75e6('0x5'));var controller=require(_0x75e6('0x6'));router[_0x75e6('0x7')]('/',auth[_0x75e6('0x8')](),controller[_0x75e6('0x9')]);router[_0x75e6('0x7')](_0x75e6('0xa'),auth['isAuthenticated'](),controller[_0x75e6('0xb')]);router[_0x75e6('0x7')](_0x75e6('0xc'),auth[_0x75e6('0x8')](),controller[_0x75e6('0xd')]);var upload=multer({'storage':multer[_0x75e6('0xe')]({'destination':function(_0x438ad9,_0x1049fe,_0x3342fe){_0x3342fe(null,path[_0x75e6('0xf')](config[_0x75e6('0x10')],_0x75e6('0x11')));},'filename':function(_0x17b8ef,_0x521ad4,_0x36d2f0){_0x521ad4[_0x75e6('0x12')]=_0x521ad4[_0x75e6('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x36d2f0(null,util[_0x75e6('0x13')](_0x75e6('0x14'),path[_0x75e6('0x15')](_0x521ad4[_0x75e6('0x12')],path[_0x75e6('0x16')](_0x521ad4[_0x75e6('0x12')])),Date[_0x75e6('0x17')](),path['extname'](_0x521ad4['originalname'])));}})});router[_0x75e6('0x18')]('/',upload['single'](_0x75e6('0x19')),controller[_0x75e6('0x1a')]);router[_0x75e6('0x1b')](_0x75e6('0xa'),auth[_0x75e6('0x8')](),controller['update']);router[_0x75e6('0x1c')](_0x75e6('0xa'),auth[_0x75e6('0x8')](),controller[_0x75e6('0x1c')]);module[_0x75e6('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 c76d1e8..a8e9922 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 _0x4479=['name','STRING','BIGINT','INTEGER','sequelize','exports'];(function(_0x59a0e3,_0x17f8fc){var _0x8f37d4=function(_0x3a1748){while(--_0x3a1748){_0x59a0e3['push'](_0x59a0e3['shift']());}};_0x8f37d4(++_0x17f8fc);}(_0x4479,0x17e));var _0x9447=function(_0x390129,_0x3a8ca0){_0x390129=_0x390129-0x0;var _0x3c3cb9=_0x4479[_0x390129];return _0x3c3cb9;};'use strict';var Sequelize=require(_0x9447('0x0'));module[_0x9447('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9447('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9447('0x3')]},'display_name':{'type':Sequelize[_0x9447('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x9447('0x3')]},'original_format':{'type':Sequelize[_0x9447('0x3')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x9447('0x4')]},'original_channelCount':{'type':Sequelize[_0x9447('0x5')]},'original_bitRate':{'type':Sequelize[_0x9447('0x4')]},'original_sampleRate':{'type':Sequelize[_0x9447('0x5')]},'converted_format':{'type':Sequelize[_0x9447('0x3')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x9447('0x5')]},'converted_bitRate':{'type':Sequelize[_0x9447('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4e8b=['name','STRING','FLOAT','BIGINT','INTEGER','exports'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0x4e8b,0xa1));var _0xb4e8=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x4e8b[_0x2053ea];return _0x2232c4;};'use strict';var Sequelize=require('sequelize');module[_0xb4e8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb4e8('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb4e8('0x2')]},'display_name':{'type':Sequelize[_0xb4e8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xb4e8('0x2')]},'original_format':{'type':Sequelize[_0xb4e8('0x2')]},'original_duration':{'type':Sequelize[_0xb4e8('0x3')]},'original_sampleCount':{'type':Sequelize[_0xb4e8('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xb4e8('0x4')]},'original_sampleRate':{'type':Sequelize[_0xb4e8('0x5')]},'converted_format':{'type':Sequelize[_0xb4e8('0x2')]},'converted_duration':{'type':Sequelize[_0xb4e8('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xb4e8('0x5')]},'converted_bitRate':{'type':Sequelize[_0xb4e8('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 00e0e9e..8cbe6d7 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 _0x8e39=['end','sendStatus','error','stack','name','index','Sound','model','keys','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','dateEnd','add','day','merge','filter','map','where','include','findAll','rows','catch','show','params','includeAll','options','find','download','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','Content-Range','reject','save','update','destroy','get','Sounds','then'];(function(_0x341d46,_0x14f1b5){var _0x5a4222=function(_0x4731ae){while(--_0x4731ae){_0x341d46['push'](_0x341d46['shift']());}};_0x5a4222(++_0x14f1b5);}(_0x8e39,0x14c));var _0x98e3=function(_0x89ac51,_0x5ecae1){_0x89ac51=_0x89ac51-0x0;var _0x166509=_0x8e39[_0x89ac51];return _0x166509;};'use strict';var pdf=require(_0x98e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x98e3('0x1'));var zipdir=require(_0x98e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98e3('0x3'));var moment=require(_0x98e3('0x4'));var BPromise=require(_0x98e3('0x5'));var Mustache=require(_0x98e3('0x6'));var util=require(_0x98e3('0x7'));var path=require(_0x98e3('0x8'));var sox=require('sox');var csv=require(_0x98e3('0x9'));var ejs=require(_0x98e3('0xa'));var fs=require('fs');var _=require(_0x98e3('0xb'));var squel=require(_0x98e3('0xc'));var crypto=require('crypto');var jsforce=require(_0x98e3('0xd'));var deskjs=require(_0x98e3('0xe'));var toCsv=require(_0x98e3('0x9'));var querystring=require('querystring');var Papa=require(_0x98e3('0xf'));var Redis=require(_0x98e3('0x10'));var qs=require(_0x98e3('0x11'));var logger=require(_0x98e3('0x12'))(_0x98e3('0x13'));var utils=require(_0x98e3('0x14'));var config=require(_0x98e3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1450cd,_0x16e946){_0x16e946=_0x16e946||0xcc;return function(_0x541a87){if(_0x541a87){return _0x1450cd['sendStatus'](_0x16e946);}return _0x1450cd[_0x98e3('0x16')](_0x16e946)['end']();};}function respondWithResult(_0x2b19c3,_0x3a3a28){_0x3a3a28=_0x3a3a28||0xc8;return function(_0x27b449){if(_0x27b449){return _0x2b19c3['status'](_0x3a3a28)[_0x98e3('0x17')](_0x27b449);}};}function respondWithFilteredResult(_0x276761,_0x2ecbdf){return function(_0x4a120e){if(_0x4a120e){var _0x1d2dbd=_0x4a120e[_0x98e3('0x18')],_0x5f27f6=_0x2ecbdf[_0x98e3('0x19')],_0x3a3d9b=_0x2ecbdf[_0x98e3('0x19')]+_0x2ecbdf['limit'],_0x481b1a;if(_0x3a3d9b>=_0x1d2dbd){_0x3a3d9b=_0x1d2dbd;_0x481b1a=0xc8;}else{_0x481b1a=0xce;}_0x276761[_0x98e3('0x16')](_0x481b1a);return _0x276761['set'](_0x98e3('0x1a'),_0x5f27f6+'-'+_0x3a3d9b+'/'+_0x1d2dbd)[_0x98e3('0x17')](_0x4a120e);}return null;};}function patchUpdates(_0x5e6170){return function(_0x3e1fb6){try{jsonpatch['apply'](_0x3e1fb6,_0x5e6170,!![]);}catch(_0x41a39e){return BPromise[_0x98e3('0x1b')](_0x41a39e);}return _0x3e1fb6[_0x98e3('0x1c')]();};}function saveUpdates(_0x2e080a,_0x17ffd5){return function(_0x344d0f){if(_0x344d0f){return _0x344d0f[_0x98e3('0x1d')](_0x2e080a)['then'](function(_0x44bd18){return _0x44bd18;});}return null;};}function removeEntity(_0x577ebb,_0x2e191c){return function(_0x17853a){if(_0x17853a){return _0x17853a[_0x98e3('0x1e')]()['then'](function(){var _0x34cc1b=_0x17853a[_0x98e3('0x1f')]({'plain':!![]});var _0x238bb0=_0x98e3('0x20');return db['UserProfileResource'][_0x98e3('0x1e')]({'where':{'type':_0x238bb0,'resourceId':_0x34cc1b['id']}})[_0x98e3('0x21')](function(){return _0x17853a;});})['then'](function(){_0x577ebb[_0x98e3('0x16')](0xcc)[_0x98e3('0x22')]();});}};}function handleEntityNotFound(_0x557ed4,_0x33274e){return function(_0x4831f2){if(!_0x4831f2){_0x557ed4[_0x98e3('0x23')](0x194);}return _0x4831f2;};}function handleError(_0x4afdd5,_0x596283){_0x596283=_0x596283||0x1f4;return function(_0x23a002){logger[_0x98e3('0x24')](_0x23a002[_0x98e3('0x25')]);if(_0x23a002[_0x98e3('0x26')]){delete _0x23a002[_0x98e3('0x26')];}_0x4afdd5['status'](_0x596283)['send'](_0x23a002);};}exports[_0x98e3('0x27')]=function(_0x141b47,_0x5473bd){var _0x26ac67={},_0x2058fc={},_0x1bd502={'count':0x0,'rows':[]};var _0x3e7577=db[_0x98e3('0x28')]['rawAttributes'];_0x2058fc[_0x98e3('0x29')]=_[_0x98e3('0x2a')](_0x3e7577);var _0x1d29fa={'dateStart':_0x141b47[_0x98e3('0x2b')][_0x98e3('0x2c')],'dateEnd':_0x141b47[_0x98e3('0x2b')]['dateEnd']};delete _0x141b47['query'][_0x98e3('0x2c')];delete _0x141b47[_0x98e3('0x2b')]['dateEnd'];_0x2058fc[_0x98e3('0x2b')]=_['keys'](_0x141b47[_0x98e3('0x2b')]);_0x2058fc[_0x98e3('0x2d')]=_[_0x98e3('0x2e')](_0x2058fc[_0x98e3('0x29')],_0x2058fc[_0x98e3('0x2b')]);_0x26ac67[_0x98e3('0x2f')]=_[_0x98e3('0x2e')](_0x2058fc[_0x98e3('0x29')],qs[_0x98e3('0x30')](_0x141b47['query'][_0x98e3('0x30')]));_0x26ac67[_0x98e3('0x2f')]=_0x26ac67['attributes'][_0x98e3('0x31')]?_0x26ac67[_0x98e3('0x2f')]:_0x2058fc[_0x98e3('0x29')];if(!_0x141b47[_0x98e3('0x2b')][_0x98e3('0x32')]('nolimit')){_0x26ac67[_0x98e3('0x33')]=qs[_0x98e3('0x33')](_0x141b47[_0x98e3('0x2b')][_0x98e3('0x33')]);_0x26ac67[_0x98e3('0x19')]=qs[_0x98e3('0x19')](_0x141b47[_0x98e3('0x2b')]['offset']);}_0x26ac67['order']=qs[_0x98e3('0x34')](_0x141b47[_0x98e3('0x2b')][_0x98e3('0x34')]);_0x26ac67['where']=qs[_0x98e3('0x2d')](_[_0x98e3('0x35')](_0x141b47[_0x98e3('0x2b')],_0x2058fc['filters']));if(_0x1d29fa[_0x98e3('0x2c')]){if(_0x1d29fa[_0x98e3('0x36')]){_0x1d29fa[_0x98e3('0x36')]=moment(_0x1d29fa[_0x98e3('0x36')])[_0x98e3('0x37')](0x1,_0x98e3('0x38'));}else{_0x1d29fa[_0x98e3('0x36')]=moment(_0x1d29fa['dateStart'])['add'](0x1,_0x98e3('0x38'));}_[_0x98e3('0x39')](_0x26ac67['where'],{'createdAt':{'$gte':_0x1d29fa['dateStart'],'$lte':_0x1d29fa['dateEnd']}});}if(_0x141b47['query'][_0x98e3('0x3a')]){_0x26ac67['where']=_['merge'](_0x26ac67['where'],{'$or':_[_0x98e3('0x3b')](_0x26ac67['attributes'],function(_0x49b761){var _0x3eee97={};_0x3eee97[_0x49b761]={'$like':'%'+_0x141b47[_0x98e3('0x2b')]['filter']+'%'};return _0x3eee97;})});}_0x26ac67=_[_0x98e3('0x39')]({},_0x26ac67,_0x141b47['options']);var _0x444154={'where':_0x26ac67[_0x98e3('0x3c')]};return db['Sound'][_0x98e3('0x18')](_0x444154)[_0x98e3('0x21')](function(_0x3711e5){_0x1bd502[_0x98e3('0x18')]=_0x3711e5;if(_0x141b47[_0x98e3('0x2b')]['includeAll']){_0x26ac67[_0x98e3('0x3d')]=[{'all':!![]}];}return db[_0x98e3('0x28')][_0x98e3('0x3e')](_0x26ac67);})[_0x98e3('0x21')](function(_0x5a657b){_0x1bd502[_0x98e3('0x3f')]=_0x5a657b;return _0x1bd502;})['then'](respondWithFilteredResult(_0x5473bd,_0x26ac67))[_0x98e3('0x40')](handleError(_0x5473bd,null));};exports[_0x98e3('0x41')]=function(_0x5de72d,_0x579fee){var _0x545979={'raw':!![],'where':{'id':_0x5de72d[_0x98e3('0x42')]['id']}},_0x3a47c3={};_0x3a47c3[_0x98e3('0x29')]=_[_0x98e3('0x2a')](db[_0x98e3('0x28')]['rawAttributes']);_0x3a47c3[_0x98e3('0x2b')]=_['keys'](_0x5de72d[_0x98e3('0x2b')]);_0x3a47c3[_0x98e3('0x2d')]=_[_0x98e3('0x2e')](_0x3a47c3[_0x98e3('0x29')],_0x3a47c3[_0x98e3('0x2b')]);_0x545979[_0x98e3('0x2f')]=_[_0x98e3('0x2e')](_0x3a47c3[_0x98e3('0x29')],qs[_0x98e3('0x30')](_0x5de72d[_0x98e3('0x2b')]['fields']));_0x545979['attributes']=_0x545979[_0x98e3('0x2f')][_0x98e3('0x31')]?_0x545979[_0x98e3('0x2f')]:_0x3a47c3[_0x98e3('0x29')];if(_0x5de72d[_0x98e3('0x2b')][_0x98e3('0x43')]){_0x545979[_0x98e3('0x3d')]=[{'all':!![]}];}_0x545979=_[_0x98e3('0x39')]({},_0x545979,_0x5de72d[_0x98e3('0x44')]);return db[_0x98e3('0x28')][_0x98e3('0x45')](_0x545979)[_0x98e3('0x21')](handleEntityNotFound(_0x579fee,null))[_0x98e3('0x21')](respondWithResult(_0x579fee,null))[_0x98e3('0x40')](handleError(_0x579fee,null));};exports[_0x98e3('0x46')]=function(_0x1ceafb,_0x244b8b,_0x49dc30){return db[_0x98e3('0x28')]['find']({'where':{'id':_0x1ceafb[_0x98e3('0x42')]['id']},'attributes':[_0x98e3('0x26'),_0x98e3('0x47'),_0x98e3('0x48')],'raw':!![]})[_0x98e3('0x21')](handleEntityNotFound(_0x244b8b,null))[_0x98e3('0x21')](function(_0x222335){if(_0x222335){if(!fs[_0x98e3('0x49')](path[_0x98e3('0x4a')](config[_0x98e3('0x4b')],'server/files/sounds/converted',_0x222335[_0x98e3('0x47')]+'.'+_0x222335[_0x98e3('0x48')]))){throw new db[(_0x98e3('0x4c'))][(_0x98e3('0x4d'))](_0x98e3('0x4e'));}return _0x244b8b[_0x98e3('0x46')](path[_0x98e3('0x4a')](config[_0x98e3('0x4b')],_0x98e3('0x4f'),util[_0x98e3('0x50')](_0x98e3('0x51'),_0x222335[_0x98e3('0x47')],_0x222335['converted_format'])),util[_0x98e3('0x50')](_0x98e3('0x51'),_0x222335[_0x98e3('0x26')],_0x222335[_0x98e3('0x48')]));}return null;})[_0x98e3('0x40')](handleError(_0x244b8b,null));};exports[_0x98e3('0x52')]=function(_0x3d83d0,_0x8ea307,_0x52c01d){var _0x504b6d={'name':path[_0x98e3('0x53')](_0x3d83d0[_0x98e3('0x54')][_0x98e3('0x55')],path[_0x98e3('0x56')](_0x3d83d0[_0x98e3('0x54')][_0x98e3('0x55')])),'save_name':path[_0x98e3('0x53')](_0x3d83d0[_0x98e3('0x54')][_0x98e3('0x57')],path[_0x98e3('0x56')](_0x3d83d0['file'][_0x98e3('0x57')])),'original_format':path[_0x98e3('0x56')](_0x3d83d0[_0x98e3('0x54')][_0x98e3('0x55')])[_0x98e3('0x58')](0x1),'converted_format':_0x98e3('0x59')};var _0x3fa01a=path[_0x98e3('0x4a')](config[_0x98e3('0x4b')],_0x98e3('0x5a'),_0x3d83d0[_0x98e3('0x54')][_0x98e3('0x57')]);var _0x34101b=path[_0x98e3('0x4a')](config['root'],_0x98e3('0x4f'),util[_0x98e3('0x50')]('%s.%s',path[_0x98e3('0x53')](_0x3d83d0[_0x98e3('0x54')][_0x98e3('0x57')],path[_0x98e3('0x56')](_0x3d83d0[_0x98e3('0x54')][_0x98e3('0x57')])),_0x504b6d['converted_format']));logger['info'](_0x98e3('0x5b'),_0x3fa01a);logger[_0x98e3('0x5c')](_0x98e3('0x5d'),_0x34101b);try{fs[_0x98e3('0x5e')](_0x3fa01a,parseInt(_0x98e3('0x5f'),0x8));var _0x1a7727=sox['transcode'](_0x3fa01a,_0x34101b,{'sampleRate':0x1f40,'format':_0x98e3('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a7727['on'](_0x98e3('0x24'),function(_0x363079){fs[_0x98e3('0x60')](_0x3fa01a);_0x8ea307['status'](0x1f4)[_0x98e3('0x61')](_0x363079);});_0x1a7727['on'](_0x98e3('0x62'),function(_0x31ab56){_0x504b6d[_0x98e3('0x63')]=isNaN(_0x31ab56['duration'])?null:_0x31ab56[_0x98e3('0x64')]*0x3e8;_0x504b6d[_0x98e3('0x65')]=isNaN(_0x31ab56[_0x98e3('0x66')])?null:_0x31ab56['sampleCount'];_0x504b6d['original_channelCount']=isNaN(_0x31ab56[_0x98e3('0x67')])?null:_0x31ab56[_0x98e3('0x67')];_0x504b6d['original_bitRate']=isNaN(_0x31ab56[_0x98e3('0x68')])?null:_0x31ab56[_0x98e3('0x68')];_0x504b6d[_0x98e3('0x69')]=isNaN(_0x31ab56[_0x98e3('0x6a')])?null:_0x31ab56[_0x98e3('0x6a')];});_0x1a7727['on']('dest',function(_0x55c198){_0x504b6d[_0x98e3('0x6b')]=isNaN(_0x55c198['duration'])?null:_0x55c198[_0x98e3('0x64')]*0x3e8;_0x504b6d[_0x98e3('0x6c')]=isNaN(_0x55c198['sampleCount'])?null:_0x55c198[_0x98e3('0x66')];_0x504b6d['converted_channelCount']=isNaN(_0x55c198[_0x98e3('0x67')])?null:_0x55c198['channelCount'];_0x504b6d['converted_bitRate']=isNaN(_0x55c198[_0x98e3('0x68')])?null:_0x55c198['bitRate'];_0x504b6d['converted_sampleRate']=isNaN(_0x55c198[_0x98e3('0x6a')])?null:_0x55c198[_0x98e3('0x6a')];});_0x1a7727['on'](_0x98e3('0x22'),function(){fs[_0x98e3('0x5e')](_0x34101b,parseInt(_0x98e3('0x5f'),0x8));return db[_0x98e3('0x28')][_0x98e3('0x52')](_0x504b6d)[_0x98e3('0x21')](function(_0x4fd88f){var _0xad6a72={'role':_0x3d83d0[_0x98e3('0x6d')][_0x98e3('0x6e')],'userProfileId':_0x3d83d0[_0x98e3('0x6d')][_0x98e3('0x6f')]};if(!_0xad6a72)throw new Error(_0x98e3('0x70'));if(_0xad6a72['role']===_0x98e3('0x71')){var _0x362ab4=_0x4fd88f['get']({'plain':!![]});return db[_0x98e3('0x72')][_0x98e3('0x45')]({'where':{'name':_0x98e3('0x20'),'userProfileId':_0xad6a72[_0x98e3('0x6f')]},'raw':!![]})['then'](function(_0x2b294b){if(_0x2b294b&&_0x2b294b[_0x98e3('0x73')]===0x0){return db[_0x98e3('0x74')]['create']({'name':_0x362ab4['name'],'resourceId':_0x362ab4['id'],'type':_0x2b294b['name'],'sectionId':_0x2b294b['id']},{})[_0x98e3('0x21')](function(){return _0x4fd88f;});}else{return _0x4fd88f;}})[_0x98e3('0x40')](function(_0x40abae){logger['error'](_0x98e3('0x75'),_0x40abae);throw _0x40abae;});}return _0x4fd88f;})['then'](respondWithResult(_0x8ea307,null))[_0x98e3('0x40')](handleError(_0x8ea307,null));});_0x1a7727[_0x98e3('0x76')]();}catch(_0x480b55){_0x8ea307[_0x98e3('0x16')](0x1f4)[_0x98e3('0x61')](_0x480b55);}};exports[_0x98e3('0x1d')]=function(_0x2769ad,_0x2887b2,_0x4ef3b7){return db[_0x98e3('0x28')][_0x98e3('0x45')]({'where':{'id':_0x2769ad[_0x98e3('0x42')]['id']}})[_0x98e3('0x21')](handleEntityNotFound(_0x2887b2,null))[_0x98e3('0x21')](saveUpdates(_[_0x98e3('0x35')](_0x2769ad['body'],[_0x98e3('0x26'),_0x98e3('0x77')]),null))[_0x98e3('0x21')](respondWithResult(_0x2887b2,null))[_0x98e3('0x40')](handleError(_0x2887b2,null));};exports[_0x98e3('0x78')]=function(_0x3f793d,_0x27df0b,_0x216dca){return db[_0x98e3('0x28')][_0x98e3('0x45')]({'where':{'id':_0x3f793d['params']['id']}})[_0x98e3('0x21')](function(_0x17dbfd){if(_0x17dbfd){return _0x17dbfd[_0x98e3('0x1e')]();}})[_0x98e3('0x21')](function(_0x4342c4){var _0x2d3bf6=path[_0x98e3('0x4a')](config[_0x98e3('0x4b')],_0x98e3('0x5a'),util[_0x98e3('0x50')]('%s.%s',_0x4342c4[_0x98e3('0x47')],_0x4342c4[_0x98e3('0x79')]));var _0x69d715=path[_0x98e3('0x4a')](config['root'],_0x98e3('0x4f'),util[_0x98e3('0x50')]('%s.%s',_0x4342c4[_0x98e3('0x47')],_0x4342c4[_0x98e3('0x48')]));fs[_0x98e3('0x60')](_0x2d3bf6);fs[_0x98e3('0x60')](_0x69d715);return _0x4342c4;})[_0x98e3('0x21')](function(_0x51dacb){if(_0x51dacb){return _0x27df0b['status'](0xcc)[_0x98e3('0x22')]();}})[_0x98e3('0x21')](handleEntityNotFound(_0x27df0b,null))[_0x98e3('0x40')](handleError(_0x27df0b,null));}; \ No newline at end of file +var _0x17d2=['merge','map','options','include','findAll','rows','catch','show','params','find','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','basename','file','originalname','extname','filename','substring','server/files/sounds/original','root','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','create','body','role','userProfileId','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','original_format','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','Sounds','UserProfileResource','destroy','error','name','send','index','Sound','keys','query','dateStart','dateEnd','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','add','day','where','filter'];(function(_0x1aab9d,_0x503b9e){var _0x3840b2=function(_0x338c19){while(--_0x338c19){_0x1aab9d['push'](_0x1aab9d['shift']());}};_0x3840b2(++_0x503b9e);}(_0x17d2,0xae));var _0x217d=function(_0x210d74,_0x396976){_0x210d74=_0x210d74-0x0;var _0x8a942d=_0x17d2[_0x210d74];return _0x8a942d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x217d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x217d('0x1'));var jsonpatch=require(_0x217d('0x2'));var rp=require('request-promise');var moment=require(_0x217d('0x3'));var BPromise=require(_0x217d('0x4'));var Mustache=require(_0x217d('0x5'));var util=require('util');var path=require(_0x217d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x217d('0x7'));var fs=require('fs');var _=require(_0x217d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x217d('0x9'));var toCsv=require('to-csv');var querystring=require(_0x217d('0xa'));var Papa=require(_0x217d('0xb'));var Redis=require(_0x217d('0xc'));var qs=require(_0x217d('0xd'));var logger=require('../../config/logger')(_0x217d('0xe'));var utils=require(_0x217d('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50972d,_0x2b151d){_0x2b151d=_0x2b151d||0xcc;return function(_0x4e2440){if(_0x4e2440){return _0x50972d[_0x217d('0x10')](_0x2b151d);}return _0x50972d['status'](_0x2b151d)[_0x217d('0x11')]();};}function respondWithResult(_0x417448,_0x5620af){_0x5620af=_0x5620af||0xc8;return function(_0x3309b6){if(_0x3309b6){return _0x417448[_0x217d('0x12')](_0x5620af)[_0x217d('0x13')](_0x3309b6);}};}function respondWithFilteredResult(_0x18ff8d,_0x1684f1){return function(_0x29cf5a){if(_0x29cf5a){var _0x4365d7=_0x29cf5a[_0x217d('0x14')],_0x4d0611=_0x1684f1['offset'],_0x3d4283=_0x1684f1[_0x217d('0x15')]+_0x1684f1[_0x217d('0x16')],_0x1e71dc;if(_0x3d4283>=_0x4365d7){_0x3d4283=_0x4365d7;_0x1e71dc=0xc8;}else{_0x1e71dc=0xce;}_0x18ff8d[_0x217d('0x12')](_0x1e71dc);return _0x18ff8d[_0x217d('0x17')](_0x217d('0x18'),_0x4d0611+'-'+_0x3d4283+'/'+_0x4365d7)['json'](_0x29cf5a);}return null;};}function patchUpdates(_0x417b25){return function(_0x2554cc){try{jsonpatch['apply'](_0x2554cc,_0x417b25,!![]);}catch(_0x2ce403){return BPromise[_0x217d('0x19')](_0x2ce403);}return _0x2554cc[_0x217d('0x1a')]();};}function saveUpdates(_0x154712,_0xf61b56){return function(_0x4bc3c4){if(_0x4bc3c4){return _0x4bc3c4[_0x217d('0x1b')](_0x154712)[_0x217d('0x1c')](function(_0x4c4586){return _0x4c4586;});}return null;};}function removeEntity(_0x3c20a4,_0x1189a2){return function(_0x4fe661){if(_0x4fe661){return _0x4fe661['destroy']()[_0x217d('0x1c')](function(){var _0x2c3dd9=_0x4fe661[_0x217d('0x1d')]({'plain':!![]});var _0x25a03f=_0x217d('0x1e');return db[_0x217d('0x1f')][_0x217d('0x20')]({'where':{'type':_0x25a03f,'resourceId':_0x2c3dd9['id']}})[_0x217d('0x1c')](function(){return _0x4fe661;});})['then'](function(){_0x3c20a4[_0x217d('0x12')](0xcc)[_0x217d('0x11')]();});}};}function handleEntityNotFound(_0x3c53f7,_0x3ba4f6){return function(_0x3a1a20){if(!_0x3a1a20){_0x3c53f7['sendStatus'](0x194);}return _0x3a1a20;};}function handleError(_0x562f45,_0x15ab7a){_0x15ab7a=_0x15ab7a||0x1f4;return function(_0x39e036){logger[_0x217d('0x21')](_0x39e036['stack']);if(_0x39e036['name']){delete _0x39e036[_0x217d('0x22')];}_0x562f45[_0x217d('0x12')](_0x15ab7a)[_0x217d('0x23')](_0x39e036);};}exports[_0x217d('0x24')]=function(_0x18ac51,_0x1d2a5e){var _0x21078c={},_0x17d8bb={},_0x14907f={'count':0x0,'rows':[]};var _0x57441e=db[_0x217d('0x25')]['rawAttributes'];_0x17d8bb['model']=_[_0x217d('0x26')](_0x57441e);var _0x2acca2={'dateStart':_0x18ac51[_0x217d('0x27')][_0x217d('0x28')],'dateEnd':_0x18ac51['query'][_0x217d('0x29')]};delete _0x18ac51['query'][_0x217d('0x28')];delete _0x18ac51['query'][_0x217d('0x29')];_0x17d8bb[_0x217d('0x27')]=_['keys'](_0x18ac51['query']);_0x17d8bb[_0x217d('0x2a')]=_[_0x217d('0x2b')](_0x17d8bb['model'],_0x17d8bb[_0x217d('0x27')]);_0x21078c[_0x217d('0x2c')]=_[_0x217d('0x2b')](_0x17d8bb[_0x217d('0x2d')],qs[_0x217d('0x2e')](_0x18ac51[_0x217d('0x27')]['fields']));_0x21078c[_0x217d('0x2c')]=_0x21078c[_0x217d('0x2c')][_0x217d('0x2f')]?_0x21078c[_0x217d('0x2c')]:_0x17d8bb[_0x217d('0x2d')];if(!_0x18ac51[_0x217d('0x27')][_0x217d('0x30')](_0x217d('0x31'))){_0x21078c[_0x217d('0x16')]=qs['limit'](_0x18ac51[_0x217d('0x27')][_0x217d('0x16')]);_0x21078c[_0x217d('0x15')]=qs[_0x217d('0x15')](_0x18ac51[_0x217d('0x27')][_0x217d('0x15')]);}_0x21078c[_0x217d('0x32')]=qs[_0x217d('0x33')](_0x18ac51[_0x217d('0x27')][_0x217d('0x33')]);_0x21078c['where']=qs[_0x217d('0x2a')](_['pick'](_0x18ac51[_0x217d('0x27')],_0x17d8bb[_0x217d('0x2a')]));if(_0x2acca2[_0x217d('0x28')]){if(_0x2acca2[_0x217d('0x29')]){_0x2acca2[_0x217d('0x29')]=moment(_0x2acca2[_0x217d('0x29')])[_0x217d('0x34')](0x1,_0x217d('0x35'));}else{_0x2acca2[_0x217d('0x29')]=moment(_0x2acca2[_0x217d('0x28')])[_0x217d('0x34')](0x1,_0x217d('0x35'));}_['merge'](_0x21078c[_0x217d('0x36')],{'createdAt':{'$gte':_0x2acca2[_0x217d('0x28')],'$lte':_0x2acca2[_0x217d('0x29')]}});}if(_0x18ac51[_0x217d('0x27')][_0x217d('0x37')]){_0x21078c['where']=_[_0x217d('0x38')](_0x21078c[_0x217d('0x36')],{'$or':_[_0x217d('0x39')](_0x21078c['attributes'],function(_0x27a792){var _0x5d7061={};_0x5d7061[_0x27a792]={'$like':'%'+_0x18ac51[_0x217d('0x27')]['filter']+'%'};return _0x5d7061;})});}_0x21078c=_[_0x217d('0x38')]({},_0x21078c,_0x18ac51[_0x217d('0x3a')]);var _0x28c0b0={'where':_0x21078c[_0x217d('0x36')]};return db['Sound'][_0x217d('0x14')](_0x28c0b0)[_0x217d('0x1c')](function(_0x15ce57){_0x14907f[_0x217d('0x14')]=_0x15ce57;if(_0x18ac51[_0x217d('0x27')]['includeAll']){_0x21078c[_0x217d('0x3b')]=[{'all':!![]}];}return db['Sound'][_0x217d('0x3c')](_0x21078c);})[_0x217d('0x1c')](function(_0x4f9d02){_0x14907f[_0x217d('0x3d')]=_0x4f9d02;return _0x14907f;})[_0x217d('0x1c')](respondWithFilteredResult(_0x1d2a5e,_0x21078c))[_0x217d('0x3e')](handleError(_0x1d2a5e,null));};exports[_0x217d('0x3f')]=function(_0xb25d99,_0x2722e3){var _0x5af013={'raw':!![],'where':{'id':_0xb25d99[_0x217d('0x40')]['id']}},_0x2f57b0={};_0x2f57b0[_0x217d('0x2d')]=_[_0x217d('0x26')](db[_0x217d('0x25')]['rawAttributes']);_0x2f57b0[_0x217d('0x27')]=_[_0x217d('0x26')](_0xb25d99[_0x217d('0x27')]);_0x2f57b0['filters']=_[_0x217d('0x2b')](_0x2f57b0['model'],_0x2f57b0[_0x217d('0x27')]);_0x5af013[_0x217d('0x2c')]=_[_0x217d('0x2b')](_0x2f57b0[_0x217d('0x2d')],qs[_0x217d('0x2e')](_0xb25d99['query'][_0x217d('0x2e')]));_0x5af013[_0x217d('0x2c')]=_0x5af013[_0x217d('0x2c')][_0x217d('0x2f')]?_0x5af013[_0x217d('0x2c')]:_0x2f57b0['model'];if(_0xb25d99['query']['includeAll']){_0x5af013[_0x217d('0x3b')]=[{'all':!![]}];}_0x5af013=_[_0x217d('0x38')]({},_0x5af013,_0xb25d99['options']);return db[_0x217d('0x25')][_0x217d('0x41')](_0x5af013)[_0x217d('0x1c')](handleEntityNotFound(_0x2722e3,null))['then'](respondWithResult(_0x2722e3,null))[_0x217d('0x3e')](handleError(_0x2722e3,null));};exports[_0x217d('0x42')]=function(_0x2b6d6e,_0x288a96,_0x50a2c6){return db[_0x217d('0x25')][_0x217d('0x41')]({'where':{'id':_0x2b6d6e[_0x217d('0x40')]['id']},'attributes':['name',_0x217d('0x43'),_0x217d('0x44')],'raw':!![]})[_0x217d('0x1c')](handleEntityNotFound(_0x288a96,null))[_0x217d('0x1c')](function(_0x12c166){if(_0x12c166){if(!fs['existsSync'](path[_0x217d('0x45')](config['root'],_0x217d('0x46'),_0x12c166[_0x217d('0x43')]+'.'+_0x12c166[_0x217d('0x44')]))){throw new db[(_0x217d('0x47'))][(_0x217d('0x48'))]('Sound\x20not\x20found');}return _0x288a96['download'](path[_0x217d('0x45')](config['root'],_0x217d('0x46'),util['format']('%s.%s',_0x12c166[_0x217d('0x43')],_0x12c166[_0x217d('0x44')])),util[_0x217d('0x49')](_0x217d('0x4a'),_0x12c166['name'],_0x12c166[_0x217d('0x44')]));}return null;})[_0x217d('0x3e')](handleError(_0x288a96,null));};exports['create']=function(_0x194337,_0x10f2ec,_0x5316fa){var _0x3ee6fa={'name':path[_0x217d('0x4b')](_0x194337[_0x217d('0x4c')]['originalname'],path['extname'](_0x194337[_0x217d('0x4c')][_0x217d('0x4d')])),'save_name':path['basename'](_0x194337[_0x217d('0x4c')]['filename'],path[_0x217d('0x4e')](_0x194337[_0x217d('0x4c')][_0x217d('0x4f')])),'original_format':path[_0x217d('0x4e')](_0x194337[_0x217d('0x4c')][_0x217d('0x4d')])[_0x217d('0x50')](0x1),'converted_format':'wav'};var _0x1df848=path['join'](config['root'],_0x217d('0x51'),_0x194337[_0x217d('0x4c')][_0x217d('0x4f')]);var _0x515d3e=path['join'](config[_0x217d('0x52')],_0x217d('0x46'),util[_0x217d('0x49')]('%s.%s',path[_0x217d('0x4b')](_0x194337[_0x217d('0x4c')]['filename'],path[_0x217d('0x4e')](_0x194337[_0x217d('0x4c')][_0x217d('0x4f')])),_0x3ee6fa['converted_format']));logger['info'](_0x217d('0x53'),_0x1df848);logger['info'](_0x217d('0x54'),_0x515d3e);try{fs[_0x217d('0x55')](_0x1df848,parseInt(_0x217d('0x56'),0x8));var _0x45e08b=sox[_0x217d('0x57')](_0x1df848,_0x515d3e,{'sampleRate':0x1f40,'format':_0x217d('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x45e08b['on']('error',function(_0x891111){fs[_0x217d('0x59')](_0x1df848);_0x10f2ec['status'](0x1f4)[_0x217d('0x23')](_0x891111);});_0x45e08b['on'](_0x217d('0x5a'),function(_0x4b5c08){_0x3ee6fa[_0x217d('0x5b')]=isNaN(_0x4b5c08[_0x217d('0x5c')])?null:_0x4b5c08[_0x217d('0x5c')]*0x3e8;_0x3ee6fa[_0x217d('0x5d')]=isNaN(_0x4b5c08[_0x217d('0x5e')])?null:_0x4b5c08[_0x217d('0x5e')];_0x3ee6fa['original_channelCount']=isNaN(_0x4b5c08[_0x217d('0x5f')])?null:_0x4b5c08[_0x217d('0x5f')];_0x3ee6fa[_0x217d('0x60')]=isNaN(_0x4b5c08[_0x217d('0x61')])?null:_0x4b5c08[_0x217d('0x61')];_0x3ee6fa[_0x217d('0x62')]=isNaN(_0x4b5c08[_0x217d('0x63')])?null:_0x4b5c08[_0x217d('0x63')];});_0x45e08b['on']('dest',function(_0x51f0ed){_0x3ee6fa[_0x217d('0x64')]=isNaN(_0x51f0ed[_0x217d('0x5c')])?null:_0x51f0ed[_0x217d('0x5c')]*0x3e8;_0x3ee6fa[_0x217d('0x65')]=isNaN(_0x51f0ed[_0x217d('0x5e')])?null:_0x51f0ed[_0x217d('0x5e')];_0x3ee6fa[_0x217d('0x66')]=isNaN(_0x51f0ed[_0x217d('0x5f')])?null:_0x51f0ed[_0x217d('0x5f')];_0x3ee6fa['converted_bitRate']=isNaN(_0x51f0ed[_0x217d('0x61')])?null:_0x51f0ed[_0x217d('0x61')];_0x3ee6fa[_0x217d('0x67')]=isNaN(_0x51f0ed[_0x217d('0x63')])?null:_0x51f0ed[_0x217d('0x63')];});_0x45e08b['on']('end',function(){fs[_0x217d('0x55')](_0x515d3e,parseInt(_0x217d('0x56'),0x8));return db[_0x217d('0x25')][_0x217d('0x68')](_0x3ee6fa)[_0x217d('0x1c')](function(_0xc05c2d){var _0x28987e={'role':_0x194337[_0x217d('0x69')][_0x217d('0x6a')],'userProfileId':_0x194337[_0x217d('0x69')][_0x217d('0x6b')]};if(!_0x28987e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28987e[_0x217d('0x6a')]===_0x217d('0x6c')){var _0x4e7233=_0xc05c2d[_0x217d('0x1d')]({'plain':!![]});return db[_0x217d('0x6d')][_0x217d('0x41')]({'where':{'name':_0x217d('0x1e'),'userProfileId':_0x28987e[_0x217d('0x6b')]},'raw':!![]})[_0x217d('0x1c')](function(_0x26649a){if(_0x26649a&&_0x26649a['autoAssociation']===0x0){return db['UserProfileResource'][_0x217d('0x68')]({'name':_0x4e7233[_0x217d('0x22')],'resourceId':_0x4e7233['id'],'type':_0x26649a[_0x217d('0x22')],'sectionId':_0x26649a['id']},{})['then'](function(){return _0xc05c2d;});}else{return _0xc05c2d;}})[_0x217d('0x3e')](function(_0xe11cd0){logger[_0x217d('0x21')](_0x217d('0x6e'),_0xe11cd0);throw _0xe11cd0;});}return _0xc05c2d;})[_0x217d('0x1c')](respondWithResult(_0x10f2ec,null))['catch'](handleError(_0x10f2ec,null));});_0x45e08b[_0x217d('0x6f')]();}catch(_0x36e6fa){_0x10f2ec['status'](0x1f4)['send'](_0x36e6fa);}};exports[_0x217d('0x1b')]=function(_0x431336,_0x2a55ba,_0x59be9c){return db[_0x217d('0x25')][_0x217d('0x41')]({'where':{'id':_0x431336[_0x217d('0x40')]['id']}})[_0x217d('0x1c')](handleEntityNotFound(_0x2a55ba,null))[_0x217d('0x1c')](saveUpdates(_[_0x217d('0x70')](_0x431336['body'],['name',_0x217d('0x71')]),null))[_0x217d('0x1c')](respondWithResult(_0x2a55ba,null))[_0x217d('0x3e')](handleError(_0x2a55ba,null));};exports['delete']=function(_0x417626,_0x3fc406,_0x4c8273){return db[_0x217d('0x25')][_0x217d('0x41')]({'where':{'id':_0x417626[_0x217d('0x40')]['id']}})[_0x217d('0x1c')](function(_0x10eaed){if(_0x10eaed){return _0x10eaed[_0x217d('0x20')]();}})['then'](function(_0x22e04f){var _0x5bdea3=path[_0x217d('0x45')](config[_0x217d('0x52')],_0x217d('0x51'),util[_0x217d('0x49')](_0x217d('0x4a'),_0x22e04f[_0x217d('0x43')],_0x22e04f[_0x217d('0x72')]));var _0x56f8b5=path[_0x217d('0x45')](config['root'],_0x217d('0x46'),util[_0x217d('0x49')](_0x217d('0x4a'),_0x22e04f[_0x217d('0x43')],_0x22e04f[_0x217d('0x44')]));fs[_0x217d('0x59')](_0x5bdea3);fs[_0x217d('0x59')](_0x56f8b5);return _0x22e04f;})[_0x217d('0x1c')](function(_0x37a334){if(_0x37a334){return _0x3fc406[_0x217d('0x12')](0xcc)[_0x217d('0x11')]();}})[_0x217d('0x1c')](handleEntityNotFound(_0x3fc406,null))[_0x217d('0x3e')](handleError(_0x3fc406,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a641a6b..373365c 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 _0xcb48=['bluebird','request-promise','./sound.attributes','define','Sound','../../config/logger','api'];(function(_0x181ff5,_0x2ca4bc){var _0x3e5eaf=function(_0x32ce27){while(--_0x32ce27){_0x181ff5['push'](_0x181ff5['shift']());}};_0x3e5eaf(++_0x2ca4bc);}(_0xcb48,0x7c));var _0x8cb4=function(_0x19c0bb,_0x62d51a){_0x19c0bb=_0x19c0bb-0x0;var _0x3d6fcd=_0xcb48[_0x19c0bb];return _0x3d6fcd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8cb4('0x0'))(_0x8cb4('0x1'));var moment=require('moment');var BPromise=require(_0x8cb4('0x2'));var rp=require(_0x8cb4('0x3'));var attributes=require(_0x8cb4('0x4'));module['exports']=function(_0x19d37e,_0x18085c){return _0x19d37e[_0x8cb4('0x5')](_0x8cb4('0x6'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e97=['api','moment','bluebird','request-promise','exports','Sound','util','../../config/logger'];(function(_0x2f9bce,_0x57fdc1){var _0x2bbf09=function(_0x131ff6){while(--_0x131ff6){_0x2f9bce['push'](_0x2f9bce['shift']());}};_0x2bbf09(++_0x57fdc1);}(_0x7e97,0xce));var _0x77e9=function(_0x2f569f,_0x40ae3f){_0x2f569f=_0x2f569f-0x0;var _0x2312ce=_0x7e97[_0x2f569f];return _0x2312ce;};'use strict';var _=require('lodash');var util=require(_0x77e9('0x0'));var logger=require(_0x77e9('0x1'))(_0x77e9('0x2'));var moment=require(_0x77e9('0x3'));var BPromise=require(_0x77e9('0x4'));var rp=require(_0x77e9('0x5'));var attributes=require('./sound.attributes');module[_0x77e9('0x6')]=function(_0x4f6e0c,_0x2079b2){return _0x4f6e0c['define'](_0x77e9('0x7'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 3a579e5..0066ac7 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 _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x14ddc0,_0x176f2b){var _0x32577a=function(_0x4d6c12){while(--_0x4d6c12){_0x14ddc0['push'](_0x14ddc0['shift']());}};_0x32577a(++_0x176f2b);}(_0xb10b,0x12a));var _0xbb10=function(_0x241a78,_0x18e674){_0x241a78=_0x241a78-0x0;var _0x268acc=_0xb10b[_0x241a78];return _0x268acc;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x315525,_0x5b5b40){var _0x4f38e9=function(_0x26209c){while(--_0x26209c){_0x315525['push'](_0x315525['shift']());}};_0x4f38e9(++_0x5b5b40);}(_0xb10b,0x12a));var _0xbb10=function(_0xd49fef,_0x23f01e){_0xd49fef=_0xd49fef-0x0;var _0x304be8=_0xb10b[_0xd49fef];return _0x304be8;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d57b788..b125b97 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 _0x9d1f=['multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','delete','exports'];(function(_0x5af22c,_0x1da1af){var _0x303eab=function(_0x3bf658){while(--_0x3bf658){_0x5af22c['push'](_0x5af22c['shift']());}};_0x303eab(++_0x1da1af);}(_0x9d1f,0x1a9));var _0xf9d1=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x9d1f[_0x99868f];return _0x27a71b;};'use strict';var multer=require(_0xf9d1('0x0'));var util=require('util');var path=require(_0xf9d1('0x1'));var timeout=require(_0xf9d1('0x2'));var express=require(_0xf9d1('0x3'));var router=express['Router']();var auth=require(_0xf9d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf9d1('0x5'));var controller=require(_0xf9d1('0x6'));router[_0xf9d1('0x7')]('/',auth['isAuthenticated'](),controller[_0xf9d1('0x8')]);router[_0xf9d1('0x7')]('/:id',auth[_0xf9d1('0x9')](),controller[_0xf9d1('0xa')]);router[_0xf9d1('0xb')]('/',auth['isAuthenticated'](),controller[_0xf9d1('0xc')]);router[_0xf9d1('0xd')](_0xf9d1('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xf9d1('0xf')](_0xf9d1('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xf9d1('0x10')]=router; \ No newline at end of file +var _0x9be2=['../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x57fa4e,_0x26a0b4){var _0x2a6fc1=function(_0x374b55){while(--_0x374b55){_0x57fa4e['push'](_0x57fa4e['shift']());}};_0x2a6fc1(++_0x26a0b4);}(_0x9be2,0x85));var _0x29be=function(_0x3f9a8a,_0x27cfa5){_0x3f9a8a=_0x3f9a8a-0x0;var _0x12ac7b=_0x9be2[_0x3f9a8a];return _0x12ac7b;};'use strict';var multer=require(_0x29be('0x0'));var util=require(_0x29be('0x1'));var path=require(_0x29be('0x2'));var timeout=require('connect-timeout');var express=require(_0x29be('0x3'));var router=express[_0x29be('0x4')]();var auth=require(_0x29be('0x5'));var interaction=require(_0x29be('0x6'));var config=require(_0x29be('0x7'));var controller=require(_0x29be('0x8'));router[_0x29be('0x9')]('/',auth[_0x29be('0xa')](),controller[_0x29be('0xb')]);router[_0x29be('0x9')](_0x29be('0xc'),auth[_0x29be('0xa')](),controller['show']);router[_0x29be('0xd')]('/',auth['isAuthenticated'](),controller[_0x29be('0xe')]);router[_0x29be('0xf')](_0x29be('0xc'),auth[_0x29be('0xa')](),controller[_0x29be('0x10')]);router[_0x29be('0x11')](_0x29be('0xc'),auth[_0x29be('0xa')](),controller[_0x29be('0x12')]);module[_0x29be('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 91cd9ce..e3a6e49 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 _0x05d6=['out','sequelize','exports','STRING','medium'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x05d6,0xf6));var _0x605d=function(_0x16e933,_0xe6248c){_0x16e933=_0x16e933-0x0;var _0x430656=_0x05d6[_0x16e933];return _0x430656;};'use strict';var Sequelize=require(_0x605d('0x0'));module[_0x605d('0x1')]={'uniqueid':{'type':Sequelize[_0x605d('0x2')]},'body':{'type':Sequelize['TEXT'](_0x605d('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x605d('0x4')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file +var _0x0280=['ENUM','out','STRING','medium'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x0280,0x1ce));var _0x0028=function(_0x12c940,_0x4567f4){_0x12c940=_0x12c940-0x0;var _0x3e4cda=_0x0280[_0x12c940];return _0x3e4cda;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0028('0x0')]},'body':{'type':Sequelize['TEXT'](_0x0028('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x0028('0x2')]('in',_0x0028('0x3')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f49ab96..99b8cbb 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 _0x3d84=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','name','send','index','SquareMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','map','filter','includeAll','include','rows','show','options','catch','body','find','params','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x1799c4,_0x504645){var _0x509b23=function(_0x3e1727){while(--_0x3e1727){_0x1799c4['push'](_0x1799c4['shift']());}};_0x509b23(++_0x504645);}(_0x3d84,0x1a2));var _0x43d8=function(_0x50e798,_0x1f5c39){_0x50e798=_0x50e798-0x0;var _0x28e780=_0x3d84[_0x50e798];return _0x28e780;};'use strict';var pdf=require(_0x43d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x43d8('0x2'));var rp=require('request-promise');var moment=require(_0x43d8('0x3'));var BPromise=require(_0x43d8('0x4'));var Mustache=require(_0x43d8('0x5'));var util=require(_0x43d8('0x6'));var path=require(_0x43d8('0x7'));var sox=require(_0x43d8('0x8'));var csv=require(_0x43d8('0x9'));var ejs=require(_0x43d8('0xa'));var fs=require('fs');var _=require(_0x43d8('0xb'));var squel=require(_0x43d8('0xc'));var crypto=require(_0x43d8('0xd'));var jsforce=require(_0x43d8('0xe'));var deskjs=require(_0x43d8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x43d8('0x10'));var Papa=require(_0x43d8('0x11'));var Redis=require('ioredis');var qs=require(_0x43d8('0x12'));var logger=require(_0x43d8('0x13'))(_0x43d8('0x14'));var utils=require('../../config/utils');var config=require(_0x43d8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xab0f77,_0x397ff5){_0x397ff5=_0x397ff5||0xcc;return function(_0x3b20bc){if(_0x3b20bc){return _0xab0f77[_0x43d8('0x16')](_0x397ff5);}return _0xab0f77[_0x43d8('0x17')](_0x397ff5)[_0x43d8('0x18')]();};}function respondWithResult(_0x16e2cc,_0x3d6376){_0x3d6376=_0x3d6376||0xc8;return function(_0x888c){if(_0x888c){return _0x16e2cc[_0x43d8('0x17')](_0x3d6376)[_0x43d8('0x19')](_0x888c);}};}function respondWithFilteredResult(_0x4d4394,_0x3bedc8){return function(_0x237931){if(_0x237931){var _0x110417=_0x237931[_0x43d8('0x1a')],_0x3097fc=_0x3bedc8[_0x43d8('0x1b')],_0x4cad69=_0x3bedc8['offset']+_0x3bedc8[_0x43d8('0x1c')],_0x438fb3;if(_0x4cad69>=_0x110417){_0x4cad69=_0x110417;_0x438fb3=0xc8;}else{_0x438fb3=0xce;}_0x4d4394['status'](_0x438fb3);return _0x4d4394['set'](_0x43d8('0x1d'),_0x3097fc+'-'+_0x4cad69+'/'+_0x110417)[_0x43d8('0x19')](_0x237931);}return null;};}function patchUpdates(_0x49a942){return function(_0x5a9729){try{jsonpatch[_0x43d8('0x1e')](_0x5a9729,_0x49a942,!![]);}catch(_0x489811){return BPromise[_0x43d8('0x1f')](_0x489811);}return _0x5a9729['save']();};}function saveUpdates(_0x1a03c5,_0x39db44){return function(_0x264f2b){if(_0x264f2b){return _0x264f2b[_0x43d8('0x20')](_0x1a03c5)[_0x43d8('0x21')](function(_0x33b395){return _0x33b395;});}return null;};}function removeEntity(_0x28392f,_0x53c6b7){return function(_0x424f0c){if(_0x424f0c){return _0x424f0c[_0x43d8('0x22')]()[_0x43d8('0x21')](function(){_0x28392f[_0x43d8('0x17')](0xcc)[_0x43d8('0x18')]();});}};}function handleEntityNotFound(_0x126f56,_0x3e5d34){return function(_0x396bfd){if(!_0x396bfd){_0x126f56[_0x43d8('0x16')](0x194);}return _0x396bfd;};}function handleError(_0x17141b,_0x3cb9e4){_0x3cb9e4=_0x3cb9e4||0x1f4;return function(_0x200ab7){logger[_0x43d8('0x23')](_0x200ab7['stack']);if(_0x200ab7[_0x43d8('0x24')]){delete _0x200ab7[_0x43d8('0x24')];}_0x17141b['status'](_0x3cb9e4)[_0x43d8('0x25')](_0x200ab7);};}exports[_0x43d8('0x26')]=function(_0x2d84dc,_0x52609c){var _0x1c4232={},_0x42214c={},_0x154817={'count':0x0,'rows':[]};var _0x3bf9a7=db[_0x43d8('0x27')][_0x43d8('0x28')];_0x42214c[_0x43d8('0x29')]=_[_0x43d8('0x2a')](_0x3bf9a7);var _0x1d2758={'dateStart':_0x2d84dc[_0x43d8('0x2b')][_0x43d8('0x2c')],'dateEnd':_0x2d84dc[_0x43d8('0x2b')]['dateEnd']};delete _0x2d84dc['query'][_0x43d8('0x2c')];delete _0x2d84dc[_0x43d8('0x2b')][_0x43d8('0x2d')];_0x42214c['query']=_[_0x43d8('0x2a')](_0x2d84dc[_0x43d8('0x2b')]);_0x42214c[_0x43d8('0x2e')]=_[_0x43d8('0x2f')](_0x42214c[_0x43d8('0x29')],_0x42214c[_0x43d8('0x2b')]);_0x1c4232['attributes']=_[_0x43d8('0x2f')](_0x42214c[_0x43d8('0x29')],qs[_0x43d8('0x30')](_0x2d84dc[_0x43d8('0x2b')][_0x43d8('0x30')]));_0x1c4232[_0x43d8('0x31')]=_0x1c4232['attributes'][_0x43d8('0x32')]?_0x1c4232['attributes']:_0x42214c[_0x43d8('0x29')];if(!_0x2d84dc[_0x43d8('0x2b')][_0x43d8('0x33')](_0x43d8('0x34'))){_0x1c4232['limit']=qs[_0x43d8('0x1c')](_0x2d84dc[_0x43d8('0x2b')][_0x43d8('0x1c')]);_0x1c4232[_0x43d8('0x1b')]=qs[_0x43d8('0x1b')](_0x2d84dc['query'][_0x43d8('0x1b')]);}_0x1c4232[_0x43d8('0x35')]=qs[_0x43d8('0x36')](_0x2d84dc[_0x43d8('0x2b')][_0x43d8('0x36')]);_0x1c4232['where']=qs[_0x43d8('0x2e')](_[_0x43d8('0x37')](_0x2d84dc['query'],_0x42214c['filters']));if(_0x1d2758[_0x43d8('0x2c')]){if(_0x1d2758[_0x43d8('0x2d')]){_0x1d2758[_0x43d8('0x2d')]=moment(_0x1d2758[_0x43d8('0x2d')])[_0x43d8('0x38')](0x1,_0x43d8('0x39'));}else{_0x1d2758['dateEnd']=moment(_0x1d2758[_0x43d8('0x2c')])[_0x43d8('0x38')](0x1,_0x43d8('0x39'));}_[_0x43d8('0x3a')](_0x1c4232[_0x43d8('0x3b')],{'createdAt':{'$gte':_0x1d2758[_0x43d8('0x2c')],'$lte':_0x1d2758[_0x43d8('0x2d')]}});}if(_0x2d84dc[_0x43d8('0x2b')]['filter']){_0x1c4232['where']=_['merge'](_0x1c4232['where'],{'$or':_[_0x43d8('0x3c')](_0x1c4232[_0x43d8('0x31')],function(_0x19ab24){var _0xee10a9={};_0xee10a9[_0x19ab24]={'$like':'%'+_0x2d84dc['query'][_0x43d8('0x3d')]+'%'};return _0xee10a9;})});}_0x1c4232=_[_0x43d8('0x3a')]({},_0x1c4232,_0x2d84dc['options']);var _0x2cbda9={'where':_0x1c4232[_0x43d8('0x3b')]};return db[_0x43d8('0x27')]['count'](_0x2cbda9)['then'](function(_0x1ba79e){_0x154817['count']=_0x1ba79e;if(_0x2d84dc[_0x43d8('0x2b')][_0x43d8('0x3e')]){_0x1c4232[_0x43d8('0x3f')]=[{'all':!![]}];}return db[_0x43d8('0x27')]['findAll'](_0x1c4232);})['then'](function(_0x18de00){_0x154817[_0x43d8('0x40')]=_0x18de00;return _0x154817;})[_0x43d8('0x21')](respondWithFilteredResult(_0x52609c,_0x1c4232))['catch'](handleError(_0x52609c,null));};exports[_0x43d8('0x41')]=function(_0x33a10c,_0x37f686){var _0x1d3775={'raw':!![],'where':{'id':_0x33a10c['params']['id']}},_0xb70382={};_0xb70382[_0x43d8('0x29')]=_['keys'](db[_0x43d8('0x27')][_0x43d8('0x28')]);_0xb70382['query']=_[_0x43d8('0x2a')](_0x33a10c[_0x43d8('0x2b')]);_0xb70382[_0x43d8('0x2e')]=_[_0x43d8('0x2f')](_0xb70382[_0x43d8('0x29')],_0xb70382[_0x43d8('0x2b')]);_0x1d3775[_0x43d8('0x31')]=_['intersection'](_0xb70382['model'],qs[_0x43d8('0x30')](_0x33a10c[_0x43d8('0x2b')][_0x43d8('0x30')]));_0x1d3775[_0x43d8('0x31')]=_0x1d3775[_0x43d8('0x31')][_0x43d8('0x32')]?_0x1d3775[_0x43d8('0x31')]:_0xb70382[_0x43d8('0x29')];if(_0x33a10c[_0x43d8('0x2b')][_0x43d8('0x3e')]){_0x1d3775[_0x43d8('0x3f')]=[{'all':!![]}];}_0x1d3775=_[_0x43d8('0x3a')]({},_0x1d3775,_0x33a10c[_0x43d8('0x42')]);return db[_0x43d8('0x27')]['find'](_0x1d3775)[_0x43d8('0x21')](handleEntityNotFound(_0x37f686,null))[_0x43d8('0x21')](respondWithResult(_0x37f686,null))[_0x43d8('0x43')](handleError(_0x37f686,null));};exports['create']=function(_0x3e85e4,_0x2e6628){return db['SquareMessage']['create'](_0x3e85e4[_0x43d8('0x44')],{})['then'](respondWithResult(_0x2e6628,0xc9))[_0x43d8('0x43')](handleError(_0x2e6628,null));};exports['update']=function(_0x49fba7,_0x5ac230){if(_0x49fba7[_0x43d8('0x44')]['id']){delete _0x49fba7[_0x43d8('0x44')]['id'];}return db[_0x43d8('0x27')][_0x43d8('0x45')]({'where':{'id':_0x49fba7[_0x43d8('0x46')]['id']}})[_0x43d8('0x21')](handleEntityNotFound(_0x5ac230,null))['then'](saveUpdates(_0x49fba7['body'],null))[_0x43d8('0x21')](respondWithResult(_0x5ac230,null))[_0x43d8('0x43')](handleError(_0x5ac230,null));};exports['destroy']=function(_0x4bb839,_0x1f3bd4){return db[_0x43d8('0x27')][_0x43d8('0x45')]({'where':{'id':_0x4bb839[_0x43d8('0x46')]['id']}})[_0x43d8('0x21')](handleEntityNotFound(_0x1f3bd4,null))['then'](removeEntity(_0x1f3bd4,null))[_0x43d8('0x43')](handleError(_0x1f3bd4,null));}; \ No newline at end of file +var _0xf9d9=['intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','day','add','merge','where','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','eml-format','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','then','error','stack','name','send','index','SquareMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters'];(function(_0x52640c,_0x1072ea){var _0x29de66=function(_0x1e6aaa){while(--_0x1e6aaa){_0x52640c['push'](_0x52640c['shift']());}};_0x29de66(++_0x1072ea);}(_0xf9d9,0x9d));var _0x9f9d=function(_0x155eb8,_0x5aca30){_0x155eb8=_0x155eb8-0x0;var _0x159589=_0xf9d9[_0x155eb8];return _0x159589;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9f9d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f9d('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x9f9d('0x2'));var util=require(_0x9f9d('0x3'));var path=require('path');var sox=require(_0x9f9d('0x4'));var csv=require('to-csv');var ejs=require(_0x9f9d('0x5'));var fs=require('fs');var _=require(_0x9f9d('0x6'));var squel=require('squel');var crypto=require(_0x9f9d('0x7'));var jsforce=require(_0x9f9d('0x8'));var deskjs=require(_0x9f9d('0x9'));var toCsv=require(_0x9f9d('0xa'));var querystring=require(_0x9f9d('0xb'));var Papa=require(_0x9f9d('0xc'));var Redis=require(_0x9f9d('0xd'));var qs=require(_0x9f9d('0xe'));var logger=require(_0x9f9d('0xf'))('api');var utils=require(_0x9f9d('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fe1f2,_0x226679){_0x226679=_0x226679||0xcc;return function(_0x32141a){if(_0x32141a){return _0x1fe1f2[_0x9f9d('0x11')](_0x226679);}return _0x1fe1f2[_0x9f9d('0x12')](_0x226679)[_0x9f9d('0x13')]();};}function respondWithResult(_0x327afd,_0xf49286){_0xf49286=_0xf49286||0xc8;return function(_0x134b90){if(_0x134b90){return _0x327afd[_0x9f9d('0x12')](_0xf49286)[_0x9f9d('0x14')](_0x134b90);}};}function respondWithFilteredResult(_0x8be7af,_0x5b4c91){return function(_0x55342d){if(_0x55342d){var _0x25bb40=_0x55342d[_0x9f9d('0x15')],_0x5b9c2a=_0x5b4c91[_0x9f9d('0x16')],_0x41e2ad=_0x5b4c91[_0x9f9d('0x16')]+_0x5b4c91['limit'],_0x315ec0;if(_0x41e2ad>=_0x25bb40){_0x41e2ad=_0x25bb40;_0x315ec0=0xc8;}else{_0x315ec0=0xce;}_0x8be7af[_0x9f9d('0x12')](_0x315ec0);return _0x8be7af[_0x9f9d('0x17')](_0x9f9d('0x18'),_0x5b9c2a+'-'+_0x41e2ad+'/'+_0x25bb40)[_0x9f9d('0x14')](_0x55342d);}return null;};}function patchUpdates(_0x2ef9b2){return function(_0x5a6bca){try{jsonpatch[_0x9f9d('0x19')](_0x5a6bca,_0x2ef9b2,!![]);}catch(_0x57a114){return BPromise['reject'](_0x57a114);}return _0x5a6bca['save']();};}function saveUpdates(_0x38524b,_0x3814f5){return function(_0x3e7a26){if(_0x3e7a26){return _0x3e7a26[_0x9f9d('0x1a')](_0x38524b)[_0x9f9d('0x1b')](function(_0x257db9){return _0x257db9;});}return null;};}function removeEntity(_0x5091af,_0x4a8b06){return function(_0x5f580c){if(_0x5f580c){return _0x5f580c['destroy']()['then'](function(){_0x5091af[_0x9f9d('0x12')](0xcc)[_0x9f9d('0x13')]();});}};}function handleEntityNotFound(_0x32814f,_0x389d5e){return function(_0x204c54){if(!_0x204c54){_0x32814f[_0x9f9d('0x11')](0x194);}return _0x204c54;};}function handleError(_0x80745c,_0x2c7424){_0x2c7424=_0x2c7424||0x1f4;return function(_0x2d4817){logger[_0x9f9d('0x1c')](_0x2d4817[_0x9f9d('0x1d')]);if(_0x2d4817[_0x9f9d('0x1e')]){delete _0x2d4817['name'];}_0x80745c[_0x9f9d('0x12')](_0x2c7424)[_0x9f9d('0x1f')](_0x2d4817);};}exports[_0x9f9d('0x20')]=function(_0x1f1b9b,_0x268f8d){var _0x44876c={},_0x373ac5={},_0x46bfce={'count':0x0,'rows':[]};var _0x5ce6e2=db[_0x9f9d('0x21')][_0x9f9d('0x22')];_0x373ac5[_0x9f9d('0x23')]=_[_0x9f9d('0x24')](_0x5ce6e2);var _0x2a1295={'dateStart':_0x1f1b9b[_0x9f9d('0x25')][_0x9f9d('0x26')],'dateEnd':_0x1f1b9b[_0x9f9d('0x25')][_0x9f9d('0x27')]};delete _0x1f1b9b['query'][_0x9f9d('0x26')];delete _0x1f1b9b[_0x9f9d('0x25')][_0x9f9d('0x27')];_0x373ac5[_0x9f9d('0x25')]=_[_0x9f9d('0x24')](_0x1f1b9b[_0x9f9d('0x25')]);_0x373ac5[_0x9f9d('0x28')]=_[_0x9f9d('0x29')](_0x373ac5[_0x9f9d('0x23')],_0x373ac5[_0x9f9d('0x25')]);_0x44876c[_0x9f9d('0x2a')]=_[_0x9f9d('0x29')](_0x373ac5['model'],qs[_0x9f9d('0x2b')](_0x1f1b9b[_0x9f9d('0x25')][_0x9f9d('0x2b')]));_0x44876c[_0x9f9d('0x2a')]=_0x44876c['attributes'][_0x9f9d('0x2c')]?_0x44876c[_0x9f9d('0x2a')]:_0x373ac5[_0x9f9d('0x23')];if(!_0x1f1b9b['query'][_0x9f9d('0x2d')]('nolimit')){_0x44876c[_0x9f9d('0x2e')]=qs[_0x9f9d('0x2e')](_0x1f1b9b[_0x9f9d('0x25')][_0x9f9d('0x2e')]);_0x44876c[_0x9f9d('0x16')]=qs[_0x9f9d('0x16')](_0x1f1b9b[_0x9f9d('0x25')][_0x9f9d('0x16')]);}_0x44876c[_0x9f9d('0x2f')]=qs[_0x9f9d('0x30')](_0x1f1b9b['query']['sort']);_0x44876c['where']=qs[_0x9f9d('0x28')](_[_0x9f9d('0x31')](_0x1f1b9b[_0x9f9d('0x25')],_0x373ac5[_0x9f9d('0x28')]));if(_0x2a1295['dateStart']){if(_0x2a1295[_0x9f9d('0x27')]){_0x2a1295['dateEnd']=moment(_0x2a1295[_0x9f9d('0x27')])['add'](0x1,_0x9f9d('0x32'));}else{_0x2a1295[_0x9f9d('0x27')]=moment(_0x2a1295[_0x9f9d('0x26')])[_0x9f9d('0x33')](0x1,_0x9f9d('0x32'));}_[_0x9f9d('0x34')](_0x44876c[_0x9f9d('0x35')],{'createdAt':{'$gte':_0x2a1295[_0x9f9d('0x26')],'$lte':_0x2a1295['dateEnd']}});}if(_0x1f1b9b[_0x9f9d('0x25')][_0x9f9d('0x36')]){_0x44876c[_0x9f9d('0x35')]=_[_0x9f9d('0x34')](_0x44876c[_0x9f9d('0x35')],{'$or':_['map'](_0x44876c['attributes'],function(_0x33839b){var _0x224ba8={};_0x224ba8[_0x33839b]={'$like':'%'+_0x1f1b9b[_0x9f9d('0x25')][_0x9f9d('0x36')]+'%'};return _0x224ba8;})});}_0x44876c=_['merge']({},_0x44876c,_0x1f1b9b[_0x9f9d('0x37')]);var _0x2fc8b1={'where':_0x44876c[_0x9f9d('0x35')]};return db['SquareMessage']['count'](_0x2fc8b1)[_0x9f9d('0x1b')](function(_0x41bde2){_0x46bfce[_0x9f9d('0x15')]=_0x41bde2;if(_0x1f1b9b[_0x9f9d('0x25')][_0x9f9d('0x38')]){_0x44876c['include']=[{'all':!![]}];}return db[_0x9f9d('0x21')][_0x9f9d('0x39')](_0x44876c);})[_0x9f9d('0x1b')](function(_0x4ab3f9){_0x46bfce[_0x9f9d('0x3a')]=_0x4ab3f9;return _0x46bfce;})['then'](respondWithFilteredResult(_0x268f8d,_0x44876c))[_0x9f9d('0x3b')](handleError(_0x268f8d,null));};exports['show']=function(_0x55d0bd,_0x56c051){var _0x5327e8={'raw':!![],'where':{'id':_0x55d0bd[_0x9f9d('0x3c')]['id']}},_0x476203={};_0x476203['model']=_[_0x9f9d('0x24')](db[_0x9f9d('0x21')]['rawAttributes']);_0x476203['query']=_['keys'](_0x55d0bd['query']);_0x476203['filters']=_['intersection'](_0x476203[_0x9f9d('0x23')],_0x476203[_0x9f9d('0x25')]);_0x5327e8['attributes']=_[_0x9f9d('0x29')](_0x476203['model'],qs[_0x9f9d('0x2b')](_0x55d0bd[_0x9f9d('0x25')][_0x9f9d('0x2b')]));_0x5327e8[_0x9f9d('0x2a')]=_0x5327e8[_0x9f9d('0x2a')][_0x9f9d('0x2c')]?_0x5327e8['attributes']:_0x476203['model'];if(_0x55d0bd[_0x9f9d('0x25')]['includeAll']){_0x5327e8[_0x9f9d('0x3d')]=[{'all':!![]}];}_0x5327e8=_[_0x9f9d('0x34')]({},_0x5327e8,_0x55d0bd[_0x9f9d('0x37')]);return db[_0x9f9d('0x21')][_0x9f9d('0x3e')](_0x5327e8)['then'](handleEntityNotFound(_0x56c051,null))[_0x9f9d('0x1b')](respondWithResult(_0x56c051,null))[_0x9f9d('0x3b')](handleError(_0x56c051,null));};exports['create']=function(_0xa28920,_0x52ca3b){return db[_0x9f9d('0x21')][_0x9f9d('0x3f')](_0xa28920['body'],{})[_0x9f9d('0x1b')](respondWithResult(_0x52ca3b,0xc9))[_0x9f9d('0x3b')](handleError(_0x52ca3b,null));};exports[_0x9f9d('0x1a')]=function(_0x4f397d,_0x86ac12){if(_0x4f397d[_0x9f9d('0x40')]['id']){delete _0x4f397d['body']['id'];}return db[_0x9f9d('0x21')][_0x9f9d('0x3e')]({'where':{'id':_0x4f397d['params']['id']}})[_0x9f9d('0x1b')](handleEntityNotFound(_0x86ac12,null))[_0x9f9d('0x1b')](saveUpdates(_0x4f397d['body'],null))[_0x9f9d('0x1b')](respondWithResult(_0x86ac12,null))[_0x9f9d('0x3b')](handleError(_0x86ac12,null));};exports[_0x9f9d('0x41')]=function(_0x4a017d,_0xe7514e){return db['SquareMessage']['find']({'where':{'id':_0x4a017d[_0x9f9d('0x3c')]['id']}})[_0x9f9d('0x1b')](handleEntityNotFound(_0xe7514e,null))[_0x9f9d('0x1b')](removeEntity(_0xe7514e,null))[_0x9f9d('0x3b')](handleError(_0xe7514e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 01a66a7..a245e48 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 _0x0c6d=['moment','bluebird','request-promise','exports','define','SquareMessage','square_messages','lodash','util','api'];(function(_0x465de1,_0x30dbbe){var _0x258b77=function(_0x16a147){while(--_0x16a147){_0x465de1['push'](_0x465de1['shift']());}};_0x258b77(++_0x30dbbe);}(_0x0c6d,0x1bf));var _0xd0c6=function(_0x3567f5,_0x1dc690){_0x3567f5=_0x3567f5-0x0;var _0x419488=_0x0c6d[_0x3567f5];return _0x419488;};'use strict';var _=require(_0xd0c6('0x0'));var util=require(_0xd0c6('0x1'));var logger=require('../../config/logger')(_0xd0c6('0x2'));var moment=require(_0xd0c6('0x3'));var BPromise=require(_0xd0c6('0x4'));var rp=require(_0xd0c6('0x5'));var attributes=require('./squareMessage.attributes');module[_0xd0c6('0x6')]=function(_0x317f03,_0x2b4080){return _0x317f03[_0xd0c6('0x7')](_0xd0c6('0x8'),attributes,{'tableName':_0xd0c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb492=['SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','./squareMessage.attributes','exports'];(function(_0x3ec855,_0x151ced){var _0x32f61f=function(_0x42681e){while(--_0x42681e){_0x3ec855['push'](_0x3ec855['shift']());}};_0x32f61f(++_0x151ced);}(_0xb492,0xe3));var _0x2b49=function(_0x42d894,_0x14ad26){_0x42d894=_0x42d894-0x0;var _0x3bb167=_0xb492[_0x42d894];return _0x3bb167;};'use strict';var _=require(_0x2b49('0x0'));var util=require(_0x2b49('0x1'));var logger=require(_0x2b49('0x2'))(_0x2b49('0x3'));var moment=require(_0x2b49('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x2b49('0x5'));module[_0x2b49('0x6')]=function(_0x995f8f,_0xe002bc){return _0x995f8f['define'](_0x2b49('0x7'),attributes,{'tableName':_0x2b49('0x8'),'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 3b53d0f..056090d 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 _0x4c83=['create','body','options','CreateSquareMessage','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareMessage'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x4c83,0x117));var _0x34c8=function(_0x2a5200,_0xf58291){_0x2a5200=_0x2a5200-0x0;var _0x24ddee=_0x4c83[_0x2a5200];return _0x24ddee;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x34c8('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34c8('0x1'));var logger=require(_0x34c8('0x2'))(_0x34c8('0x3'));var config=require('../../config/environment');var jayson=require(_0x34c8('0x4'));var client=jayson[_0x34c8('0x5')][_0x34c8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xccf5e7,_0x1c49d3,_0x5a2de6){return new BPromise(function(_0x447323,_0x4f901f){return client[_0x34c8('0x7')](_0xccf5e7,_0x5a2de6)[_0x34c8('0x8')](function(_0x22ac71){logger[_0x34c8('0x9')](_0x34c8('0xa'),_0x1c49d3,'request\x20sent');logger[_0x34c8('0xb')](_0x34c8('0xc'),_0x1c49d3,_0x34c8('0xd'),JSON[_0x34c8('0xe')](_0x22ac71));if(_0x22ac71[_0x34c8('0xf')]){if(_0x22ac71[_0x34c8('0xf')][_0x34c8('0x10')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x1c49d3,_0x22ac71[_0x34c8('0xf')][_0x34c8('0x11')]);return _0x4f901f(_0x22ac71['error']['message']);}logger[_0x34c8('0xf')](_0x34c8('0xa'),_0x1c49d3,_0x22ac71[_0x34c8('0xf')]['message']);return _0x447323(_0x22ac71[_0x34c8('0xf')][_0x34c8('0x11')]);}else{logger[_0x34c8('0x9')]('SquareMessage,\x20%s,\x20%s',_0x1c49d3,'request\x20sent');_0x447323(_0x22ac71[_0x34c8('0x12')][_0x34c8('0x11')]);}})[_0x34c8('0x13')](function(_0x52f56f){logger[_0x34c8('0xf')](_0x34c8('0xa'),_0x1c49d3,_0x52f56f);_0x4f901f(_0x52f56f);});});}exports['CreateSquareMessage']=function(_0x46b689){var _0x4dbe01=this;return new Promise(function(_0x6ec1cd,_0x3cd102){return db[_0x34c8('0x14')][_0x34c8('0x15')](_0x46b689[_0x34c8('0x16')],{'raw':_0x46b689[_0x34c8('0x17')]?_0x46b689[_0x34c8('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x34c8('0x8')](function(_0x5ecd69){logger[_0x34c8('0x9')](_0x34c8('0x18'),_0x46b689);logger[_0x34c8('0xb')]('CreateSquareMessage',_0x46b689,JSON[_0x34c8('0xe')](_0x5ecd69));_0x6ec1cd(_0x5ecd69);})['catch'](function(_0x4fe5e3){logger[_0x34c8('0xf')]('CreateSquareMessage',_0x4fe5e3['message'],_0x46b689);_0x3cd102(_0x4dbe01[_0x34c8('0xf')](0x1f4,_0x4fe5e3[_0x34c8('0x11')]));});});}; \ No newline at end of file +var _0xd3c3=['CreateSquareMessage','debug','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','SquareMessage','create','body','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3c3,0x17d));var _0x3d3c=function(_0x2e96ac,_0x176979){_0x2e96ac=_0x2e96ac-0x0;var _0x4861de=_0xd3c3[_0x2e96ac];return _0x4861de;};'use strict';var _=require(_0x3d3c('0x0'));var util=require(_0x3d3c('0x1'));var moment=require(_0x3d3c('0x2'));var BPromise=require(_0x3d3c('0x3'));var rs=require(_0x3d3c('0x4'));var fs=require('fs');var Redis=require(_0x3d3c('0x5'));var db=require(_0x3d3c('0x6'))['db'];var utils=require(_0x3d3c('0x7'));var logger=require(_0x3d3c('0x8'))(_0x3d3c('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d3c('0xa')][_0x3d3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19832f,_0x3c2284,_0x71269c){return new BPromise(function(_0x21319b,_0xf7da1c){return client['request'](_0x19832f,_0x71269c)[_0x3d3c('0xc')](function(_0x362ab6){logger[_0x3d3c('0xd')](_0x3d3c('0xe'),_0x3c2284,_0x3d3c('0xf'));logger['debug'](_0x3d3c('0x10'),_0x3c2284,_0x3d3c('0xf'),JSON['stringify'](_0x362ab6));if(_0x362ab6['error']){if(_0x362ab6[_0x3d3c('0x11')][_0x3d3c('0x12')]===0x1f4){logger[_0x3d3c('0x11')](_0x3d3c('0xe'),_0x3c2284,_0x362ab6[_0x3d3c('0x11')][_0x3d3c('0x13')]);return _0xf7da1c(_0x362ab6['error']['message']);}logger[_0x3d3c('0x11')](_0x3d3c('0xe'),_0x3c2284,_0x362ab6['error'][_0x3d3c('0x13')]);return _0x21319b(_0x362ab6[_0x3d3c('0x11')]['message']);}else{logger[_0x3d3c('0xd')](_0x3d3c('0xe'),_0x3c2284,_0x3d3c('0xf'));_0x21319b(_0x362ab6['result'][_0x3d3c('0x13')]);}})['catch'](function(_0x1ae4cc){logger[_0x3d3c('0x11')](_0x3d3c('0xe'),_0x3c2284,_0x1ae4cc);_0xf7da1c(_0x1ae4cc);});});}exports['CreateSquareMessage']=function(_0xb59a84){var _0x3b2b7d=this;return new Promise(function(_0x36b10a,_0x502b2d){return db[_0x3d3c('0x14')][_0x3d3c('0x15')](_0xb59a84[_0x3d3c('0x16')],{'raw':_0xb59a84[_0x3d3c('0x17')]?_0xb59a84[_0x3d3c('0x17')][_0x3d3c('0x18')]===undefined?!![]:![]:!![]})[_0x3d3c('0xc')](function(_0x1d13c4){logger[_0x3d3c('0xd')](_0x3d3c('0x19'),_0xb59a84);logger[_0x3d3c('0x1a')](_0x3d3c('0x19'),_0xb59a84,JSON[_0x3d3c('0x1b')](_0x1d13c4));_0x36b10a(_0x1d13c4);})[_0x3d3c('0x1c')](function(_0x5141){logger[_0x3d3c('0x11')](_0x3d3c('0x19'),_0x5141[_0x3d3c('0x13')],_0xb59a84);_0x502b2d(_0x3b2b7d['error'](0x1f4,_0x5141[_0x3d3c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 787130e..6c2f6cd 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 _0x6f7a=['index','/:id','/:id/test','15s','test','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated'];(function(_0x54c040,_0x587931){var _0x35d0fd=function(_0x1ab49c){while(--_0x1ab49c){_0x54c040['push'](_0x54c040['shift']());}};_0x35d0fd(++_0x587931);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x50c280,_0x2315f1){_0x50c280=_0x50c280-0x0;var _0x4d24ed=_0x6f7a[_0x50c280];return _0x4d24ed;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var auth=require(_0xa6f7('0x5'));var interaction=require(_0xa6f7('0x6'));var config=require(_0xa6f7('0x7'));var controller=require(_0xa6f7('0x8'));router[_0xa6f7('0x9')]('/',auth[_0xa6f7('0xa')](),controller[_0xa6f7('0xb')]);router[_0xa6f7('0x9')](_0xa6f7('0xc'),auth[_0xa6f7('0xa')](),controller['show']);router['get'](_0xa6f7('0xd'),auth[_0xa6f7('0xa')](),timeout(_0xa6f7('0xe')),controller[_0xa6f7('0xf')]);router[_0xa6f7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6f7('0x11')](_0xa6f7('0xc'),auth['isAuthenticated'](),controller[_0xa6f7('0x12')]);router['delete'](_0xa6f7('0xc'),auth[_0xa6f7('0xa')](),controller[_0xa6f7('0x13')]);module[_0xa6f7('0x14')]=router; \ No newline at end of file +var _0x18a5=['../../config/environment','./squareOdbc.controller','get','/:id','isAuthenticated','show','/:id/test','15s','test','post','create','put','update','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x18a5,0x164));var _0x518a=function(_0x4805f7,_0x2b35bf){_0x4805f7=_0x4805f7-0x0;var _0x2cdef6=_0x18a5[_0x4805f7];return _0x2cdef6;};'use strict';var multer=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x518a('0x2'));var router=express['Router']();var auth=require(_0x518a('0x3'));var interaction=require(_0x518a('0x4'));var config=require(_0x518a('0x5'));var controller=require(_0x518a('0x6'));router[_0x518a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x518a('0x8'),auth[_0x518a('0x9')](),controller[_0x518a('0xa')]);router[_0x518a('0x7')](_0x518a('0xb'),auth[_0x518a('0x9')](),timeout(_0x518a('0xc')),controller[_0x518a('0xd')]);router[_0x518a('0xe')]('/',auth[_0x518a('0x9')](),controller[_0x518a('0xf')]);router[_0x518a('0x10')](_0x518a('0x8'),auth[_0x518a('0x9')](),controller[_0x518a('0x11')]);router['delete'](_0x518a('0x8'),auth['isAuthenticated'](),controller[_0x518a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5bda084..89bbf24 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 _0x8e8c=['exports','STRING','name','sequelize'];(function(_0x544cc2,_0x13da03){var _0x1ed47e=function(_0x22236b){while(--_0x22236b){_0x544cc2['push'](_0x544cc2['shift']());}};_0x1ed47e(++_0x13da03);}(_0x8e8c,0x183));var _0xc8e8=function(_0x4b3e49,_0x9e566c){_0x4b3e49=_0x4b3e49-0x0;var _0x57e339=_0x8e8c[_0x4b3e49];return _0x57e339;};'use strict';var Sequelize=require(_0xc8e8('0x0'));module[_0xc8e8('0x1')]={'name':{'type':Sequelize[_0xc8e8('0x2')],'unique':_0xc8e8('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xc8e8('0x2')]},'description':{'type':Sequelize[_0xc8e8('0x2')]}}; \ No newline at end of file +var _0x894f=['exports','STRING','name'];(function(_0x382168,_0xe03b6a){var _0x3ecf7e=function(_0x17b089){while(--_0x17b089){_0x382168['push'](_0x382168['shift']());}};_0x3ecf7e(++_0xe03b6a);}(_0x894f,0xfc));var _0xf894=function(_0x3d86b5,_0x52d458){_0x3d86b5=_0x3d86b5-0x0;var _0x46b8fb=_0x894f[_0x3d86b5];return _0x46b8fb;};'use strict';var Sequelize=require('sequelize');module[_0xf894('0x0')]={'name':{'type':Sequelize[_0xf894('0x1')],'unique':_0xf894('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf894('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 01be8c8..46cb20e 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 _0x1086=['keys','filters','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','add','day','merge','filter','map','options','count','includeAll','findAll','rows','catch','params','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','status','stack','name','send','index','SquareOdbc','rawAttributes','model','query','dateStart','dateEnd'];(function(_0x454186,_0xfd983e){var _0x2e1ff4=function(_0x325619){while(--_0x325619){_0x454186['push'](_0x454186['shift']());}};_0x2e1ff4(++_0xfd983e);}(_0x1086,0x118));var _0x6108=function(_0x5bafd5,_0x5b0fff){_0x5bafd5=_0x5bafd5-0x0;var _0x3be243=_0x1086[_0x5bafd5];return _0x3be243;};'use strict';var pdf=require(_0x6108('0x0'));var emlformat=require(_0x6108('0x1'));var rimraf=require(_0x6108('0x2'));var zipdir=require(_0x6108('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6108('0x4'));var Mustache=require(_0x6108('0x5'));var util=require(_0x6108('0x6'));var path=require(_0x6108('0x7'));var sox=require(_0x6108('0x8'));var csv=require(_0x6108('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6108('0xa'));var crypto=require('crypto');var jsforce=require(_0x6108('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6108('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x6108('0xd'));var logger=require(_0x6108('0xe'))(_0x6108('0xf'));var utils=require(_0x6108('0x10'));var config=require(_0x6108('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48a707,_0x7560c1){_0x7560c1=_0x7560c1||0xcc;return function(_0x249e59){if(_0x249e59){return _0x48a707[_0x6108('0x12')](_0x7560c1);}return _0x48a707['status'](_0x7560c1)[_0x6108('0x13')]();};}function respondWithResult(_0x2f20c0,_0x44a2ef){_0x44a2ef=_0x44a2ef||0xc8;return function(_0x435ec2){if(_0x435ec2){return _0x2f20c0['status'](_0x44a2ef)[_0x6108('0x14')](_0x435ec2);}};}function respondWithFilteredResult(_0x16270d,_0x59d015){return function(_0x2d1706){if(_0x2d1706){var _0x576055=_0x2d1706['count'],_0x1ac9ac=_0x59d015[_0x6108('0x15')],_0x3bd751=_0x59d015[_0x6108('0x15')]+_0x59d015['limit'],_0x413834;if(_0x3bd751>=_0x576055){_0x3bd751=_0x576055;_0x413834=0xc8;}else{_0x413834=0xce;}_0x16270d['status'](_0x413834);return _0x16270d[_0x6108('0x16')](_0x6108('0x17'),_0x1ac9ac+'-'+_0x3bd751+'/'+_0x576055)[_0x6108('0x14')](_0x2d1706);}return null;};}function patchUpdates(_0x2a2082){return function(_0x584182){try{jsonpatch[_0x6108('0x18')](_0x584182,_0x2a2082,!![]);}catch(_0x22db70){return BPromise[_0x6108('0x19')](_0x22db70);}return _0x584182[_0x6108('0x1a')]();};}function saveUpdates(_0x58c144,_0x1405f2){return function(_0x3c2113){if(_0x3c2113){return _0x3c2113[_0x6108('0x1b')](_0x58c144)[_0x6108('0x1c')](function(_0x422070){return _0x422070;});}return null;};}function removeEntity(_0x486bf9,_0x522862){return function(_0x4fc971){if(_0x4fc971){return _0x4fc971[_0x6108('0x1d')]()[_0x6108('0x1c')](function(){var _0x5c3e2b=_0x4fc971[_0x6108('0x1e')]({'plain':!![]});var _0x507487=_0x6108('0x1f');return db[_0x6108('0x20')]['destroy']({'where':{'type':_0x507487,'resourceId':_0x5c3e2b['id']}})[_0x6108('0x1c')](function(){return _0x4fc971;});})[_0x6108('0x1c')](function(){_0x486bf9[_0x6108('0x21')](0xcc)[_0x6108('0x13')]();});}};}function handleEntityNotFound(_0xb1a03f,_0x47c417){return function(_0x520b7a){if(!_0x520b7a){_0xb1a03f[_0x6108('0x12')](0x194);}return _0x520b7a;};}function handleError(_0x343a70,_0x385c2f){_0x385c2f=_0x385c2f||0x1f4;return function(_0x304150){logger['error'](_0x304150[_0x6108('0x22')]);if(_0x304150['name']){delete _0x304150[_0x6108('0x23')];}_0x343a70[_0x6108('0x21')](_0x385c2f)[_0x6108('0x24')](_0x304150);};}exports[_0x6108('0x25')]=function(_0x359df7,_0x527dc7){var _0x2e8e61={},_0x4a7e44={},_0xd5d522={'count':0x0,'rows':[]};var _0x3d733f=db[_0x6108('0x26')][_0x6108('0x27')];_0x4a7e44[_0x6108('0x28')]=_['keys'](_0x3d733f);var _0x14a089={'dateStart':_0x359df7[_0x6108('0x29')][_0x6108('0x2a')],'dateEnd':_0x359df7['query'][_0x6108('0x2b')]};delete _0x359df7[_0x6108('0x29')][_0x6108('0x2a')];delete _0x359df7[_0x6108('0x29')][_0x6108('0x2b')];_0x4a7e44[_0x6108('0x29')]=_[_0x6108('0x2c')](_0x359df7[_0x6108('0x29')]);_0x4a7e44[_0x6108('0x2d')]=_['intersection'](_0x4a7e44[_0x6108('0x28')],_0x4a7e44['query']);_0x2e8e61['attributes']=_['intersection'](_0x4a7e44['model'],qs[_0x6108('0x2e')](_0x359df7[_0x6108('0x29')]['fields']));_0x2e8e61[_0x6108('0x2f')]=_0x2e8e61[_0x6108('0x2f')]['length']?_0x2e8e61[_0x6108('0x2f')]:_0x4a7e44[_0x6108('0x28')];if(!_0x359df7[_0x6108('0x29')][_0x6108('0x30')]('nolimit')){_0x2e8e61[_0x6108('0x31')]=qs[_0x6108('0x31')](_0x359df7[_0x6108('0x29')][_0x6108('0x31')]);_0x2e8e61[_0x6108('0x15')]=qs[_0x6108('0x15')](_0x359df7['query'][_0x6108('0x15')]);}_0x2e8e61[_0x6108('0x32')]=qs[_0x6108('0x33')](_0x359df7['query'][_0x6108('0x33')]);_0x2e8e61[_0x6108('0x34')]=qs[_0x6108('0x2d')](_[_0x6108('0x35')](_0x359df7[_0x6108('0x29')],_0x4a7e44[_0x6108('0x2d')]));if(_0x14a089[_0x6108('0x2a')]){if(_0x14a089['dateEnd']){_0x14a089[_0x6108('0x2b')]=moment(_0x14a089[_0x6108('0x2b')])[_0x6108('0x36')](0x1,_0x6108('0x37'));}else{_0x14a089[_0x6108('0x2b')]=moment(_0x14a089[_0x6108('0x2a')])[_0x6108('0x36')](0x1,_0x6108('0x37'));}_[_0x6108('0x38')](_0x2e8e61[_0x6108('0x34')],{'createdAt':{'$gte':_0x14a089[_0x6108('0x2a')],'$lte':_0x14a089['dateEnd']}});}if(_0x359df7[_0x6108('0x29')][_0x6108('0x39')]){_0x2e8e61[_0x6108('0x34')]=_['merge'](_0x2e8e61['where'],{'$or':_[_0x6108('0x3a')](_0x2e8e61[_0x6108('0x2f')],function(_0x2111a2){var _0x43ec99={};_0x43ec99[_0x2111a2]={'$like':'%'+_0x359df7[_0x6108('0x29')][_0x6108('0x39')]+'%'};return _0x43ec99;})});}_0x2e8e61=_[_0x6108('0x38')]({},_0x2e8e61,_0x359df7[_0x6108('0x3b')]);var _0x3bc1b0={'where':_0x2e8e61['where']};return db[_0x6108('0x26')]['count'](_0x3bc1b0)['then'](function(_0x5e1c74){_0xd5d522[_0x6108('0x3c')]=_0x5e1c74;if(_0x359df7[_0x6108('0x29')][_0x6108('0x3d')]){_0x2e8e61['include']=[{'all':!![]}];}return db[_0x6108('0x26')][_0x6108('0x3e')](_0x2e8e61);})[_0x6108('0x1c')](function(_0x416067){_0xd5d522[_0x6108('0x3f')]=_0x416067;return _0xd5d522;})['then'](respondWithFilteredResult(_0x527dc7,_0x2e8e61))[_0x6108('0x40')](handleError(_0x527dc7,null));};exports['show']=function(_0x4d6f25,_0x1eedf0){var _0x1f7574={'raw':!![],'where':{'id':_0x4d6f25[_0x6108('0x41')]['id']}},_0x3875f1={};_0x3875f1[_0x6108('0x28')]=_[_0x6108('0x2c')](db[_0x6108('0x26')][_0x6108('0x27')]);_0x3875f1[_0x6108('0x29')]=_[_0x6108('0x2c')](_0x4d6f25['query']);_0x3875f1[_0x6108('0x2d')]=_[_0x6108('0x42')](_0x3875f1['model'],_0x3875f1['query']);_0x1f7574[_0x6108('0x2f')]=_[_0x6108('0x42')](_0x3875f1[_0x6108('0x28')],qs[_0x6108('0x2e')](_0x4d6f25[_0x6108('0x29')]['fields']));_0x1f7574[_0x6108('0x2f')]=_0x1f7574['attributes']['length']?_0x1f7574['attributes']:_0x3875f1[_0x6108('0x28')];if(_0x4d6f25['query'][_0x6108('0x3d')]){_0x1f7574[_0x6108('0x43')]=[{'all':!![]}];}_0x1f7574=_[_0x6108('0x38')]({},_0x1f7574,_0x4d6f25[_0x6108('0x3b')]);return db[_0x6108('0x26')][_0x6108('0x44')](_0x1f7574)[_0x6108('0x1c')](handleEntityNotFound(_0x1eedf0,null))['then'](respondWithResult(_0x1eedf0,null))[_0x6108('0x40')](handleError(_0x1eedf0,null));};exports[_0x6108('0x45')]=function(_0x392fd3,_0x212396){return db['SquareOdbc'][_0x6108('0x45')](_0x392fd3[_0x6108('0x46')],{})['then'](function(_0x13d7f4){var _0x1a182a=_0x392fd3[_0x6108('0x47')][_0x6108('0x1e')]({'plain':!![]});if(!_0x1a182a)throw new Error(_0x6108('0x48'));if(_0x1a182a['role']===_0x6108('0x47')){var _0x12155d=_0x13d7f4['get']({'plain':!![]});var _0x34ff13=_0x6108('0x1f');return db[_0x6108('0x49')][_0x6108('0x44')]({'where':{'name':_0x34ff13,'userProfileId':_0x1a182a[_0x6108('0x4a')]},'raw':!![]})[_0x6108('0x1c')](function(_0x4708c6){if(_0x4708c6&&_0x4708c6[_0x6108('0x4b')]===0x0){return db[_0x6108('0x20')]['create']({'name':_0x12155d[_0x6108('0x23')],'resourceId':_0x12155d['id'],'type':_0x4708c6[_0x6108('0x23')],'sectionId':_0x4708c6['id']},{})[_0x6108('0x1c')](function(){return _0x13d7f4;});}else{return _0x13d7f4;}})[_0x6108('0x40')](function(_0x2ab331){logger[_0x6108('0x4c')](_0x6108('0x4d'),_0x2ab331);throw _0x2ab331;});}return _0x13d7f4;})['then'](respondWithResult(_0x212396,0xc9))[_0x6108('0x40')](handleError(_0x212396,null));};exports[_0x6108('0x1b')]=function(_0x1c04b7,_0x1eb7ef){if(_0x1c04b7[_0x6108('0x46')]['id']){delete _0x1c04b7[_0x6108('0x46')]['id'];}return db[_0x6108('0x26')][_0x6108('0x44')]({'where':{'id':_0x1c04b7[_0x6108('0x41')]['id']}})['then'](handleEntityNotFound(_0x1eb7ef,null))['then'](saveUpdates(_0x1c04b7[_0x6108('0x46')],null))['then'](respondWithResult(_0x1eb7ef,null))['catch'](handleError(_0x1eb7ef,null));};exports[_0x6108('0x1d')]=function(_0x38a46d,_0x3cdc51){return db[_0x6108('0x26')][_0x6108('0x44')]({'where':{'id':_0x38a46d[_0x6108('0x41')]['id']}})['then'](handleEntityNotFound(_0x3cdc51,null))[_0x6108('0x1c')](removeEntity(_0x3cdc51,null))[_0x6108('0x40')](handleError(_0x3cdc51,null));};exports['test']=function(_0x332b04,_0x591c26,_0xa65b30){var _0x47083c;return db['SquareOdbc']['find']({'where':{'id':_0x332b04[_0x6108('0x41')]['id']},'attributes':['id',_0x6108('0x4e')]})[_0x6108('0x1c')](handleEntityNotFound(_0x591c26,null))[_0x6108('0x1c')](function(_0x5927ca){if(_0x5927ca){var _0x4fc6d1=require(_0x6108('0x4f'))();_0x4fc6d1[_0x6108('0x50')](_0x5927ca[_0x6108('0x4e')]);_0x4fc6d1['closeSync']();return _0x5927ca;}})[_0x6108('0x1c')](respondWithResult(_0x591c26,null))['catch'](handleError(_0x591c26,null));}; \ No newline at end of file +var _0x5fe1=['dsn','odbc','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','name','send','index','SquareOdbc','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','day','add','merge','where','filter','map','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test'];(function(_0x74be28,_0xc90fbf){var _0x3af2a6=function(_0x3b0e00){while(--_0x3b0e00){_0x74be28['push'](_0x74be28['shift']());}};_0x3af2a6(++_0xc90fbf);}(_0x5fe1,0xb3));var _0x15fe=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x5fe1[_0x16d10f];return _0x50c823;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x15fe('0x0'));var zipdir=require(_0x15fe('0x1'));var jsonpatch=require(_0x15fe('0x2'));var rp=require(_0x15fe('0x3'));var moment=require('moment');var BPromise=require(_0x15fe('0x4'));var Mustache=require(_0x15fe('0x5'));var util=require(_0x15fe('0x6'));var path=require(_0x15fe('0x7'));var sox=require(_0x15fe('0x8'));var csv=require(_0x15fe('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x15fe('0xa'));var crypto=require(_0x15fe('0xb'));var jsforce=require(_0x15fe('0xc'));var deskjs=require(_0x15fe('0xd'));var toCsv=require(_0x15fe('0x9'));var querystring=require(_0x15fe('0xe'));var Papa=require(_0x15fe('0xf'));var Redis=require(_0x15fe('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x15fe('0x11'))(_0x15fe('0x12'));var utils=require(_0x15fe('0x13'));var config=require(_0x15fe('0x14'));var db=require(_0x15fe('0x15'))['db'];function respondWithStatusCode(_0x5a26a9,_0x1d8e39){_0x1d8e39=_0x1d8e39||0xcc;return function(_0xf24f3c){if(_0xf24f3c){return _0x5a26a9[_0x15fe('0x16')](_0x1d8e39);}return _0x5a26a9[_0x15fe('0x17')](_0x1d8e39)[_0x15fe('0x18')]();};}function respondWithResult(_0x7f9bcf,_0x29f3c5){_0x29f3c5=_0x29f3c5||0xc8;return function(_0x22f44e){if(_0x22f44e){return _0x7f9bcf[_0x15fe('0x17')](_0x29f3c5)[_0x15fe('0x19')](_0x22f44e);}};}function respondWithFilteredResult(_0x25765e,_0x5e7818){return function(_0x2e58f0){if(_0x2e58f0){var _0x47a5f2=_0x2e58f0[_0x15fe('0x1a')],_0x5f306b=_0x5e7818[_0x15fe('0x1b')],_0x5819d3=_0x5e7818[_0x15fe('0x1b')]+_0x5e7818[_0x15fe('0x1c')],_0x38a990;if(_0x5819d3>=_0x47a5f2){_0x5819d3=_0x47a5f2;_0x38a990=0xc8;}else{_0x38a990=0xce;}_0x25765e['status'](_0x38a990);return _0x25765e['set'](_0x15fe('0x1d'),_0x5f306b+'-'+_0x5819d3+'/'+_0x47a5f2)[_0x15fe('0x19')](_0x2e58f0);}return null;};}function patchUpdates(_0x3d8d56){return function(_0xd2312d){try{jsonpatch[_0x15fe('0x1e')](_0xd2312d,_0x3d8d56,!![]);}catch(_0x49d6a7){return BPromise[_0x15fe('0x1f')](_0x49d6a7);}return _0xd2312d[_0x15fe('0x20')]();};}function saveUpdates(_0x5f1ac2,_0x274d85){return function(_0x248a43){if(_0x248a43){return _0x248a43[_0x15fe('0x21')](_0x5f1ac2)[_0x15fe('0x22')](function(_0x4d94fd){return _0x4d94fd;});}return null;};}function removeEntity(_0x24e99e,_0x228d29){return function(_0x2def9c){if(_0x2def9c){return _0x2def9c['destroy']()[_0x15fe('0x22')](function(){var _0x4100c1=_0x2def9c[_0x15fe('0x23')]({'plain':!![]});var _0x420222=_0x15fe('0x24');return db[_0x15fe('0x25')][_0x15fe('0x26')]({'where':{'type':_0x420222,'resourceId':_0x4100c1['id']}})[_0x15fe('0x22')](function(){return _0x2def9c;});})[_0x15fe('0x22')](function(){_0x24e99e[_0x15fe('0x17')](0xcc)[_0x15fe('0x18')]();});}};}function handleEntityNotFound(_0x901d2,_0x1c731c){return function(_0x14787b){if(!_0x14787b){_0x901d2[_0x15fe('0x16')](0x194);}return _0x14787b;};}function handleError(_0x162661,_0x2e5e64){_0x2e5e64=_0x2e5e64||0x1f4;return function(_0x3716f1){logger[_0x15fe('0x27')](_0x3716f1['stack']);if(_0x3716f1['name']){delete _0x3716f1[_0x15fe('0x28')];}_0x162661['status'](_0x2e5e64)[_0x15fe('0x29')](_0x3716f1);};}exports[_0x15fe('0x2a')]=function(_0x361b82,_0x3b06b5){var _0x2874ad={},_0x58ff4b={},_0x193ccf={'count':0x0,'rows':[]};var _0x396921=db[_0x15fe('0x2b')][_0x15fe('0x2c')];_0x58ff4b[_0x15fe('0x2d')]=_[_0x15fe('0x2e')](_0x396921);var _0x40a7be={'dateStart':_0x361b82[_0x15fe('0x2f')][_0x15fe('0x30')],'dateEnd':_0x361b82[_0x15fe('0x2f')][_0x15fe('0x31')]};delete _0x361b82['query'][_0x15fe('0x30')];delete _0x361b82[_0x15fe('0x2f')][_0x15fe('0x31')];_0x58ff4b[_0x15fe('0x2f')]=_['keys'](_0x361b82[_0x15fe('0x2f')]);_0x58ff4b['filters']=_['intersection'](_0x58ff4b[_0x15fe('0x2d')],_0x58ff4b['query']);_0x2874ad[_0x15fe('0x32')]=_[_0x15fe('0x33')](_0x58ff4b['model'],qs[_0x15fe('0x34')](_0x361b82[_0x15fe('0x2f')][_0x15fe('0x34')]));_0x2874ad[_0x15fe('0x32')]=_0x2874ad['attributes'][_0x15fe('0x35')]?_0x2874ad[_0x15fe('0x32')]:_0x58ff4b['model'];if(!_0x361b82[_0x15fe('0x2f')][_0x15fe('0x36')](_0x15fe('0x37'))){_0x2874ad[_0x15fe('0x1c')]=qs['limit'](_0x361b82[_0x15fe('0x2f')][_0x15fe('0x1c')]);_0x2874ad[_0x15fe('0x1b')]=qs['offset'](_0x361b82['query'][_0x15fe('0x1b')]);}_0x2874ad[_0x15fe('0x38')]=qs[_0x15fe('0x39')](_0x361b82['query'][_0x15fe('0x39')]);_0x2874ad['where']=qs[_0x15fe('0x3a')](_[_0x15fe('0x3b')](_0x361b82[_0x15fe('0x2f')],_0x58ff4b[_0x15fe('0x3a')]));if(_0x40a7be[_0x15fe('0x30')]){if(_0x40a7be['dateEnd']){_0x40a7be[_0x15fe('0x31')]=moment(_0x40a7be[_0x15fe('0x31')])['add'](0x1,_0x15fe('0x3c'));}else{_0x40a7be[_0x15fe('0x31')]=moment(_0x40a7be[_0x15fe('0x30')])[_0x15fe('0x3d')](0x1,_0x15fe('0x3c'));}_[_0x15fe('0x3e')](_0x2874ad[_0x15fe('0x3f')],{'createdAt':{'$gte':_0x40a7be[_0x15fe('0x30')],'$lte':_0x40a7be[_0x15fe('0x31')]}});}if(_0x361b82[_0x15fe('0x2f')][_0x15fe('0x40')]){_0x2874ad['where']=_[_0x15fe('0x3e')](_0x2874ad['where'],{'$or':_[_0x15fe('0x41')](_0x2874ad[_0x15fe('0x32')],function(_0x429d12){var _0x4dcc38={};_0x4dcc38[_0x429d12]={'$like':'%'+_0x361b82[_0x15fe('0x2f')][_0x15fe('0x40')]+'%'};return _0x4dcc38;})});}_0x2874ad=_[_0x15fe('0x3e')]({},_0x2874ad,_0x361b82[_0x15fe('0x42')]);var _0x215373={'where':_0x2874ad[_0x15fe('0x3f')]};return db[_0x15fe('0x2b')][_0x15fe('0x1a')](_0x215373)[_0x15fe('0x22')](function(_0x4cde48){_0x193ccf[_0x15fe('0x1a')]=_0x4cde48;if(_0x361b82[_0x15fe('0x2f')]['includeAll']){_0x2874ad[_0x15fe('0x43')]=[{'all':!![]}];}return db[_0x15fe('0x2b')][_0x15fe('0x44')](_0x2874ad);})[_0x15fe('0x22')](function(_0x3f1f0c){_0x193ccf[_0x15fe('0x45')]=_0x3f1f0c;return _0x193ccf;})['then'](respondWithFilteredResult(_0x3b06b5,_0x2874ad))[_0x15fe('0x46')](handleError(_0x3b06b5,null));};exports[_0x15fe('0x47')]=function(_0xdf1e2a,_0x3f1ff5){var _0x260286={'raw':!![],'where':{'id':_0xdf1e2a[_0x15fe('0x48')]['id']}},_0x23bd7a={};_0x23bd7a[_0x15fe('0x2d')]=_[_0x15fe('0x2e')](db[_0x15fe('0x2b')][_0x15fe('0x2c')]);_0x23bd7a[_0x15fe('0x2f')]=_[_0x15fe('0x2e')](_0xdf1e2a[_0x15fe('0x2f')]);_0x23bd7a['filters']=_['intersection'](_0x23bd7a[_0x15fe('0x2d')],_0x23bd7a[_0x15fe('0x2f')]);_0x260286[_0x15fe('0x32')]=_[_0x15fe('0x33')](_0x23bd7a[_0x15fe('0x2d')],qs['fields'](_0xdf1e2a['query']['fields']));_0x260286[_0x15fe('0x32')]=_0x260286[_0x15fe('0x32')][_0x15fe('0x35')]?_0x260286[_0x15fe('0x32')]:_0x23bd7a['model'];if(_0xdf1e2a['query'][_0x15fe('0x49')]){_0x260286[_0x15fe('0x43')]=[{'all':!![]}];}_0x260286=_[_0x15fe('0x3e')]({},_0x260286,_0xdf1e2a[_0x15fe('0x42')]);return db[_0x15fe('0x2b')]['find'](_0x260286)[_0x15fe('0x22')](handleEntityNotFound(_0x3f1ff5,null))['then'](respondWithResult(_0x3f1ff5,null))[_0x15fe('0x46')](handleError(_0x3f1ff5,null));};exports['create']=function(_0x512135,_0x111908){return db[_0x15fe('0x2b')][_0x15fe('0x4a')](_0x512135[_0x15fe('0x4b')],{})[_0x15fe('0x22')](function(_0x20868e){var _0x178591=_0x512135[_0x15fe('0x4c')]['get']({'plain':!![]});if(!_0x178591)throw new Error(_0x15fe('0x4d'));if(_0x178591[_0x15fe('0x4e')]==='user'){var _0x18914b=_0x20868e[_0x15fe('0x23')]({'plain':!![]});var _0x59ddb3='ODBC';return db[_0x15fe('0x4f')][_0x15fe('0x50')]({'where':{'name':_0x59ddb3,'userProfileId':_0x178591[_0x15fe('0x51')]},'raw':!![]})['then'](function(_0x199ade){if(_0x199ade&&_0x199ade[_0x15fe('0x52')]===0x0){return db[_0x15fe('0x25')][_0x15fe('0x4a')]({'name':_0x18914b['name'],'resourceId':_0x18914b['id'],'type':_0x199ade[_0x15fe('0x28')],'sectionId':_0x199ade['id']},{})['then'](function(){return _0x20868e;});}else{return _0x20868e;}})[_0x15fe('0x46')](function(_0x58bd60){logger[_0x15fe('0x27')](_0x15fe('0x53'),_0x58bd60);throw _0x58bd60;});}return _0x20868e;})[_0x15fe('0x22')](respondWithResult(_0x111908,0xc9))[_0x15fe('0x46')](handleError(_0x111908,null));};exports['update']=function(_0x38354f,_0x251ad8){if(_0x38354f[_0x15fe('0x4b')]['id']){delete _0x38354f[_0x15fe('0x4b')]['id'];}return db[_0x15fe('0x2b')][_0x15fe('0x50')]({'where':{'id':_0x38354f[_0x15fe('0x48')]['id']}})[_0x15fe('0x22')](handleEntityNotFound(_0x251ad8,null))[_0x15fe('0x22')](saveUpdates(_0x38354f[_0x15fe('0x4b')],null))[_0x15fe('0x22')](respondWithResult(_0x251ad8,null))[_0x15fe('0x46')](handleError(_0x251ad8,null));};exports[_0x15fe('0x26')]=function(_0x279a42,_0x40746a){return db[_0x15fe('0x2b')][_0x15fe('0x50')]({'where':{'id':_0x279a42[_0x15fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x40746a,null))['then'](removeEntity(_0x40746a,null))[_0x15fe('0x46')](handleError(_0x40746a,null));};exports[_0x15fe('0x54')]=function(_0x544014,_0x1fc411,_0x306a89){var _0x3142c1;return db[_0x15fe('0x2b')][_0x15fe('0x50')]({'where':{'id':_0x544014['params']['id']},'attributes':['id',_0x15fe('0x55')]})['then'](handleEntityNotFound(_0x1fc411,null))['then'](function(_0x5d29e1){if(_0x5d29e1){var _0x237a55=require(_0x15fe('0x56'))();_0x237a55['openSync'](_0x5d29e1['dsn']);_0x237a55[_0x15fe('0x57')]();return _0x5d29e1;}})[_0x15fe('0x22')](respondWithResult(_0x1fc411,null))['catch'](handleError(_0x1fc411,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 78979e9..ba56db6 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 _0xd64b=['square_odbc','lodash','../../config/logger','moment','bluebird','request-promise','./squareOdbc.attributes','exports'];(function(_0x19d92f,_0x53dd6c){var _0x595c85=function(_0x504526){while(--_0x504526){_0x19d92f['push'](_0x19d92f['shift']());}};_0x595c85(++_0x53dd6c);}(_0xd64b,0xc1));var _0xbd64=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0xd64b[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var attributes=require(_0xbd64('0x5'));module[_0xbd64('0x6')]=function(_0x5458d8,_0x5446e4){return _0x5458d8['define']('SquareOdbc',attributes,{'tableName':_0xbd64('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1339=['define','SquareOdbc','square_odbc','../../config/logger','api','moment','bluebird','request-promise','./squareOdbc.attributes','exports'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0x1339,0x1ed));var _0x9133=function(_0x2d59fc,_0x3f6110){_0x2d59fc=_0x2d59fc-0x0;var _0x50ec03=_0x1339[_0x2d59fc];return _0x50ec03;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var attributes=require(_0x9133('0x5'));module[_0x9133('0x6')]=function(_0x110c51,_0x558345){return _0x110c51[_0x9133('0x7')](_0x9133('0x8'),attributes,{'tableName':_0x9133('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index aab01ff..b91186e 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 _0xf2f1=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc','options','raw','where','attributes','include','map','model','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xc2d305,_0x3d9413){var _0x25abe5=function(_0x5b025f){while(--_0x5b025f){_0xc2d305['push'](_0xc2d305['shift']());}};_0x25abe5(++_0x3d9413);}(_0xf2f1,0x1a9));var _0x1f2f=function(_0x32497d,_0x2d305a){_0x32497d=_0x32497d-0x0;var _0x5e05aa=_0xf2f1[_0x32497d];return _0x5e05aa;};'use strict';var _=require(_0x1f2f('0x0'));var util=require(_0x1f2f('0x1'));var moment=require('moment');var BPromise=require(_0x1f2f('0x2'));var rs=require(_0x1f2f('0x3'));var fs=require('fs');var Redis=require(_0x1f2f('0x4'));var db=require(_0x1f2f('0x5'))['db'];var utils=require(_0x1f2f('0x6'));var logger=require(_0x1f2f('0x7'))(_0x1f2f('0x8'));var config=require(_0x1f2f('0x9'));var jayson=require(_0x1f2f('0xa'));var client=jayson['client'][_0x1f2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdf6f6e,_0xb7a804,_0x4d5226){return new BPromise(function(_0xd9a02f,_0x5b62c4){return client[_0x1f2f('0xc')](_0xdf6f6e,_0x4d5226)[_0x1f2f('0xd')](function(_0x412d97){logger[_0x1f2f('0xe')]('SquareOdbc,\x20%s,\x20%s',_0xb7a804,_0x1f2f('0xf'));logger['debug'](_0x1f2f('0x10'),_0xb7a804,_0x1f2f('0xf'),JSON['stringify'](_0x412d97));if(_0x412d97['error']){if(_0x412d97[_0x1f2f('0x11')]['code']===0x1f4){logger[_0x1f2f('0x11')](_0x1f2f('0x12'),_0xb7a804,_0x412d97['error'][_0x1f2f('0x13')]);return _0x5b62c4(_0x412d97['error']['message']);}logger[_0x1f2f('0x11')](_0x1f2f('0x12'),_0xb7a804,_0x412d97[_0x1f2f('0x11')][_0x1f2f('0x13')]);return _0xd9a02f(_0x412d97[_0x1f2f('0x11')]['message']);}else{logger['info'](_0x1f2f('0x12'),_0xb7a804,_0x1f2f('0xf'));_0xd9a02f(_0x412d97['result'][_0x1f2f('0x13')]);}})[_0x1f2f('0x14')](function(_0x2ae0b9){logger[_0x1f2f('0x11')]('SquareOdbc,\x20%s,\x20%s',_0xb7a804,_0x2ae0b9);_0x5b62c4(_0x2ae0b9);});});}exports[_0x1f2f('0x15')]=function(_0x475ab9){var _0x13d6b1=this;return new Promise(function(_0x2c7cbe,_0x54e434){return db['SquareOdbc']['find']({'raw':_0x475ab9['options']?_0x475ab9[_0x1f2f('0x16')][_0x1f2f('0x17')]===undefined?!![]:![]:!![],'where':_0x475ab9['options']?_0x475ab9['options'][_0x1f2f('0x18')]||null:null,'attributes':_0x475ab9[_0x1f2f('0x16')]?_0x475ab9[_0x1f2f('0x16')][_0x1f2f('0x19')]||null:null,'include':_0x475ab9[_0x1f2f('0x16')]?_0x475ab9[_0x1f2f('0x16')][_0x1f2f('0x1a')]?_['map'](_0x475ab9[_0x1f2f('0x16')][_0x1f2f('0x1a')],function(_0x3aa4a0){return{'model':db[_0x3aa4a0['model']],'as':_0x3aa4a0['as'],'attributes':_0x3aa4a0[_0x1f2f('0x19')],'include':_0x3aa4a0[_0x1f2f('0x1a')]?_[_0x1f2f('0x1b')](_0x3aa4a0['include'],function(_0x3daaa3){return{'model':db[_0x3daaa3[_0x1f2f('0x1c')]],'as':_0x3daaa3['as'],'attributes':_0x3daaa3['attributes'],'include':_0x3daaa3[_0x1f2f('0x1a')]?_[_0x1f2f('0x1b')](_0x3daaa3['include'],function(_0x1fa487){return{'model':db[_0x1fa487[_0x1f2f('0x1c')]],'as':_0x1fa487['as'],'attributes':_0x1fa487[_0x1f2f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1f2f('0xd')](function(_0x1ce762){logger['info']('ShowSquareOdbc',_0x475ab9);logger[_0x1f2f('0x1d')]('ShowSquareOdbc',_0x475ab9,JSON[_0x1f2f('0x1e')](_0x1ce762));_0x2c7cbe(_0x1ce762);})[_0x1f2f('0x14')](function(_0x4b383c){logger['error'](_0x1f2f('0x15'),_0x4b383c['message'],_0x475ab9);_0x54e434(_0x13d6b1['error'](0x1f4,_0x4b383c[_0x1f2f('0x13')]));});});}; \ No newline at end of file +var _0x5fe8=['catch','ShowSquareOdbc','SquareOdbc','options','raw','include','map','model','attributes','util','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','SquareOdbc,\x20%s,\x20%s','message','result'];(function(_0x3a488a,_0x1ca50f){var _0x3ca5c1=function(_0x3d5bac){while(--_0x3d5bac){_0x3a488a['push'](_0x3a488a['shift']());}};_0x3ca5c1(++_0x1ca50f);}(_0x5fe8,0x10d));var _0x85fe=function(_0x10d3c2,_0x1f5142){_0x10d3c2=_0x10d3c2-0x0;var _0x4208aa=_0x5fe8[_0x10d3c2];return _0x4208aa;};'use strict';var _=require('lodash');var util=require(_0x85fe('0x0'));var moment=require('moment');var BPromise=require(_0x85fe('0x1'));var rs=require(_0x85fe('0x2'));var fs=require('fs');var Redis=require(_0x85fe('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85fe('0x4'));var config=require('../../config/environment');var jayson=require(_0x85fe('0x5'));var client=jayson[_0x85fe('0x6')][_0x85fe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40c9dd,_0x2e710b,_0x3939a6){return new BPromise(function(_0x94dc9e,_0x54cb9d){return client['request'](_0x40c9dd,_0x3939a6)[_0x85fe('0x8')](function(_0x33e5b7){logger[_0x85fe('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x2e710b,_0x85fe('0xa'));logger[_0x85fe('0xb')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x2e710b,_0x85fe('0xa'),JSON[_0x85fe('0xc')](_0x33e5b7));if(_0x33e5b7[_0x85fe('0xd')]){if(_0x33e5b7[_0x85fe('0xd')]['code']===0x1f4){logger['error'](_0x85fe('0xe'),_0x2e710b,_0x33e5b7[_0x85fe('0xd')][_0x85fe('0xf')]);return _0x54cb9d(_0x33e5b7['error']['message']);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x2e710b,_0x33e5b7[_0x85fe('0xd')][_0x85fe('0xf')]);return _0x94dc9e(_0x33e5b7[_0x85fe('0xd')]['message']);}else{logger[_0x85fe('0x9')](_0x85fe('0xe'),_0x2e710b,'request\x20sent');_0x94dc9e(_0x33e5b7[_0x85fe('0x10')][_0x85fe('0xf')]);}})[_0x85fe('0x11')](function(_0x1c8a44){logger[_0x85fe('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x2e710b,_0x1c8a44);_0x54cb9d(_0x1c8a44);});});}exports[_0x85fe('0x12')]=function(_0xf56478){var _0x5641fd=this;return new Promise(function(_0xd75657,_0x194bfd){return db[_0x85fe('0x13')]['find']({'raw':_0xf56478[_0x85fe('0x14')]?_0xf56478[_0x85fe('0x14')][_0x85fe('0x15')]===undefined?!![]:![]:!![],'where':_0xf56478[_0x85fe('0x14')]?_0xf56478[_0x85fe('0x14')]['where']||null:null,'attributes':_0xf56478[_0x85fe('0x14')]?_0xf56478[_0x85fe('0x14')]['attributes']||null:null,'include':_0xf56478[_0x85fe('0x14')]?_0xf56478['options'][_0x85fe('0x16')]?_[_0x85fe('0x17')](_0xf56478['options'][_0x85fe('0x16')],function(_0x25cf5e){return{'model':db[_0x25cf5e[_0x85fe('0x18')]],'as':_0x25cf5e['as'],'attributes':_0x25cf5e[_0x85fe('0x19')],'include':_0x25cf5e[_0x85fe('0x16')]?_[_0x85fe('0x17')](_0x25cf5e[_0x85fe('0x16')],function(_0x20def9){return{'model':db[_0x20def9[_0x85fe('0x18')]],'as':_0x20def9['as'],'attributes':_0x20def9['attributes'],'include':_0x20def9['include']?_[_0x85fe('0x17')](_0x20def9[_0x85fe('0x16')],function(_0x2424a9){return{'model':db[_0x2424a9[_0x85fe('0x18')]],'as':_0x2424a9['as'],'attributes':_0x2424a9[_0x85fe('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46ccad){logger[_0x85fe('0x9')](_0x85fe('0x12'),_0xf56478);logger[_0x85fe('0xb')](_0x85fe('0x12'),_0xf56478,JSON['stringify'](_0x46ccad));_0xd75657(_0x46ccad);})[_0x85fe('0x11')](function(_0x27a1e8){logger[_0x85fe('0xd')](_0x85fe('0x12'),_0x27a1e8[_0x85fe('0xf')],_0xf56478);_0x194bfd(_0x5641fd[_0x85fe('0xd')](0x1f4,_0x27a1e8['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 27b6e32..d2c2a70 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 _0xa0b6=['addUsers','put','update','destroy','delete','removeUsers','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','post','create'];(function(_0x5256d1,_0x333c3a){var _0x1154f6=function(_0x1b573f){while(--_0x1b573f){_0x5256d1['push'](_0x5256d1['shift']());}};_0x1154f6(++_0x333c3a);}(_0xa0b6,0x16c));var _0x6a0b=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0xa0b6[_0x1562a2];return _0x39a636;};'use strict';var multer=require(_0x6a0b('0x0'));var util=require(_0x6a0b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a0b('0x2'));var router=express[_0x6a0b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a0b('0x4'));var config=require(_0x6a0b('0x5'));var controller=require(_0x6a0b('0x6'));router[_0x6a0b('0x7')]('/',auth[_0x6a0b('0x8')](),controller['index']);router[_0x6a0b('0x7')](_0x6a0b('0x9'),auth[_0x6a0b('0x8')](),controller[_0x6a0b('0xa')]);router[_0x6a0b('0x7')](_0x6a0b('0xb'),auth[_0x6a0b('0x8')](),controller['getUsers']);router[_0x6a0b('0xc')]('/',auth['isAuthenticated'](),controller[_0x6a0b('0xd')]);router[_0x6a0b('0xc')](_0x6a0b('0xb'),auth['isAuthenticated'](),controller[_0x6a0b('0xe')]);router[_0x6a0b('0xf')](_0x6a0b('0x9'),auth[_0x6a0b('0x8')](),controller[_0x6a0b('0x10')]);router['delete'](_0x6a0b('0x9'),auth[_0x6a0b('0x8')](),controller[_0x6a0b('0x11')]);router[_0x6a0b('0x12')](_0x6a0b('0xb'),auth['isAuthenticated'](),controller[_0x6a0b('0x13')]);module[_0x6a0b('0x14')]=router; \ No newline at end of file +var _0x52c0=['./squareProject.controller','isAuthenticated','get','show','/:id/users','put','/:id','update','destroy','delete','removeUsers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x52c0,0x116));var _0x052c=function(_0x361c12,_0x458070){_0x361c12=_0x361c12-0x0;var _0x34d0fe=_0x52c0[_0x361c12];return _0x34d0fe;};'use strict';var multer=require(_0x052c('0x0'));var util=require(_0x052c('0x1'));var path=require(_0x052c('0x2'));var timeout=require('connect-timeout');var express=require(_0x052c('0x3'));var router=express[_0x052c('0x4')]();var auth=require(_0x052c('0x5'));var interaction=require(_0x052c('0x6'));var config=require('../../config/environment');var controller=require(_0x052c('0x7'));router['get']('/',auth[_0x052c('0x8')](),controller['index']);router[_0x052c('0x9')]('/:id',auth[_0x052c('0x8')](),controller[_0x052c('0xa')]);router['get'](_0x052c('0xb'),auth[_0x052c('0x8')](),controller['getUsers']);router['post']('/',auth[_0x052c('0x8')](),controller['create']);router['post'](_0x052c('0xb'),auth[_0x052c('0x8')](),controller['addUsers']);router[_0x052c('0xc')](_0x052c('0xd'),auth[_0x052c('0x8')](),controller[_0x052c('0xe')]);router['delete'](_0x052c('0xd'),auth[_0x052c('0x8')](),controller[_0x052c('0xf')]);router[_0x052c('0x10')](_0x052c('0xb'),auth[_0x052c('0x8')](),controller[_0x052c('0x11')]);module[_0x052c('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index cc25c62..371f18b 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 _0xecb2=['BLOB','long','getDataValue','preproduction','production','utf8','sequelize','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xecb2,0xf6));var _0x2ecb=function(_0x2ce821,_0x573785){_0x2ce821=_0x2ce821-0x0;var _0x3ac586=_0xecb2[_0x2ce821];return _0x3ac586;};'use strict';var Sequelize=require(_0x2ecb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2ecb('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x2ecb('0x2')](_0x2ecb('0x3')),'get':function(){if(this[_0x2ecb('0x4')](_0x2ecb('0x5'))){return this[_0x2ecb('0x4')](_0x2ecb('0x5'))['toString']('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x2ecb('0x3')),'get':function(){if(this[_0x2ecb('0x4')](_0x2ecb('0x6'))){return this[_0x2ecb('0x4')](_0x2ecb('0x6'))['toString'](_0x2ecb('0x7'));}}}}; \ No newline at end of file +var _0x304b=['name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','exports','STRING'];(function(_0x4210ea,_0x27865b){var _0x1e2563=function(_0x4d7fc6){while(--_0x4d7fc6){_0x4210ea['push'](_0x4210ea['shift']());}};_0x1e2563(++_0x27865b);}(_0x304b,0xfb));var _0xb304=function(_0x796005,_0x12fe20){_0x796005=_0x796005-0x0;var _0x30c7b2=_0x304b[_0x796005];return _0x30c7b2;};'use strict';var Sequelize=require('sequelize');module[_0xb304('0x0')]={'name':{'type':Sequelize[_0xb304('0x1')],'unique':_0xb304('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb304('0x1')]},'notes':{'type':Sequelize[_0xb304('0x3')]},'preproduction':{'type':Sequelize[_0xb304('0x4')](_0xb304('0x5')),'get':function(){if(this[_0xb304('0x6')]('preproduction')){return this['getDataValue'](_0xb304('0x7'))[_0xb304('0x8')](_0xb304('0x9'));}}},'production':{'type':Sequelize[_0xb304('0x4')](_0xb304('0x5')),'get':function(){if(this[_0xb304('0x6')](_0xb304('0xa'))){return this[_0xb304('0x6')](_0xb304('0xa'))['toString'](_0xb304('0x9'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 8b200db..d1a8229 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 _0xf61e=['UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','map','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','count','offset','set','json','apply','reject','save','then','get','UserProfileResource','end','error','stack','name','send','index','SquareProject','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','add','day','merge','where','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','SquareProjects'];(function(_0x23f8ff,_0x369599){var _0xb846b5=function(_0x2c9113){while(--_0x2c9113){_0x23f8ff['push'](_0x23f8ff['shift']());}};_0xb846b5(++_0x369599);}(_0xf61e,0x191));var _0xef61=function(_0x50e2bf,_0x563d26){_0x50e2bf=_0x50e2bf-0x0;var _0x387b64=_0xf61e[_0x50e2bf];return _0x387b64;};'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'];config[_0xef61('0x19')]=_[_0xef61('0x1a')](config[_0xef61('0x19')],{'host':_0xef61('0x1b'),'port':0x18eb});var socket=require(_0xef61('0x1c'))(new Redis(config[_0xef61('0x19')]));require('./squareProject.socket')[_0xef61('0x1d')](socket);function respondWithStatusCode(_0x58d9a0,_0x106472){_0x106472=_0x106472||0xcc;return function(_0x1db2a9){if(_0x1db2a9){return _0x58d9a0[_0xef61('0x1e')](_0x106472);}return _0x58d9a0[_0xef61('0x1f')](_0x106472)['end']();};}function respondWithResult(_0x2ac1b2,_0x435beb){_0x435beb=_0x435beb||0xc8;return function(_0x1224c2){if(_0x1224c2){return _0x2ac1b2[_0xef61('0x1f')](_0x435beb)['json'](_0x1224c2);}};}function respondWithFilteredResult(_0x66fa62,_0xbe23a7){return function(_0x4f7a62){if(_0x4f7a62){var _0x8b2810=_0x4f7a62[_0xef61('0x20')],_0x408541=_0xbe23a7[_0xef61('0x21')],_0x36f558=_0xbe23a7[_0xef61('0x21')]+_0xbe23a7['limit'],_0x22dc1b;if(_0x36f558>=_0x8b2810){_0x36f558=_0x8b2810;_0x22dc1b=0xc8;}else{_0x22dc1b=0xce;}_0x66fa62[_0xef61('0x1f')](_0x22dc1b);return _0x66fa62[_0xef61('0x22')]('Content-Range',_0x408541+'-'+_0x36f558+'/'+_0x8b2810)[_0xef61('0x23')](_0x4f7a62);}return null;};}function patchUpdates(_0x36966a){return function(_0x29c13c){try{jsonpatch[_0xef61('0x24')](_0x29c13c,_0x36966a,!![]);}catch(_0xb0d7a4){return BPromise[_0xef61('0x25')](_0xb0d7a4);}return _0x29c13c[_0xef61('0x26')]();};}function saveUpdates(_0x51f9ca,_0x536e9e){return function(_0x3d31c1){if(_0x3d31c1){return _0x3d31c1['update'](_0x51f9ca)[_0xef61('0x27')](function(_0x5ae7a2){return _0x5ae7a2;});}return null;};}function removeEntity(_0x488b47,_0x2f0569){return function(_0x5ce99d){if(_0x5ce99d){return _0x5ce99d['destroy']()[_0xef61('0x27')](function(){var _0x3782c6=_0x5ce99d[_0xef61('0x28')]({'plain':!![]});var _0x111bac='SquareProjects';return db[_0xef61('0x29')]['destroy']({'where':{'type':_0x111bac,'resourceId':_0x3782c6['id']}})[_0xef61('0x27')](function(){return _0x5ce99d;});})[_0xef61('0x27')](function(){_0x488b47[_0xef61('0x1f')](0xcc)[_0xef61('0x2a')]();});}};}function handleEntityNotFound(_0x2155f1,_0x45ece2){return function(_0x258b5a){if(!_0x258b5a){_0x2155f1[_0xef61('0x1e')](0x194);}return _0x258b5a;};}function handleError(_0x297df7,_0x1ee27b){_0x1ee27b=_0x1ee27b||0x1f4;return function(_0x3a16ba){logger[_0xef61('0x2b')](_0x3a16ba[_0xef61('0x2c')]);if(_0x3a16ba[_0xef61('0x2d')]){delete _0x3a16ba[_0xef61('0x2d')];}_0x297df7[_0xef61('0x1f')](_0x1ee27b)[_0xef61('0x2e')](_0x3a16ba);};}exports[_0xef61('0x2f')]=function(_0x587e26,_0x2fe908){var _0x43bc47={},_0x53fa3b={},_0x4f35ad={'count':0x0,'rows':[]};var _0x51d5d1=db[_0xef61('0x30')][_0xef61('0x31')];_0x53fa3b[_0xef61('0x32')]=_['keys'](_0x51d5d1);var _0x2bd5b3={'dateStart':_0x587e26[_0xef61('0x33')]['dateStart'],'dateEnd':_0x587e26[_0xef61('0x33')]['dateEnd']};delete _0x587e26['query'][_0xef61('0x34')];delete _0x587e26['query'][_0xef61('0x35')];_0x53fa3b['query']=_[_0xef61('0x36')](_0x587e26[_0xef61('0x33')]);_0x53fa3b[_0xef61('0x37')]=_[_0xef61('0x38')](_0x53fa3b[_0xef61('0x32')],_0x53fa3b[_0xef61('0x33')]);_0x43bc47[_0xef61('0x39')]=_[_0xef61('0x38')](_0x53fa3b[_0xef61('0x32')],qs[_0xef61('0x3a')](_0x587e26['query'][_0xef61('0x3a')]));_0x43bc47[_0xef61('0x39')]=_0x43bc47[_0xef61('0x39')][_0xef61('0x3b')]?_0x43bc47[_0xef61('0x39')]:_0x53fa3b['model'];if(!_0x587e26[_0xef61('0x33')][_0xef61('0x3c')](_0xef61('0x3d'))){_0x43bc47['limit']=qs['limit'](_0x587e26['query'][_0xef61('0x3e')]);_0x43bc47['offset']=qs['offset'](_0x587e26['query'][_0xef61('0x21')]);}_0x43bc47[_0xef61('0x3f')]=qs[_0xef61('0x40')](_0x587e26['query']['sort']);_0x43bc47['where']=qs[_0xef61('0x37')](_[_0xef61('0x41')](_0x587e26['query'],_0x53fa3b[_0xef61('0x37')]));if(_0x2bd5b3[_0xef61('0x34')]){if(_0x2bd5b3[_0xef61('0x35')]){_0x2bd5b3[_0xef61('0x35')]=moment(_0x2bd5b3['dateEnd'])[_0xef61('0x42')](0x1,_0xef61('0x43'));}else{_0x2bd5b3[_0xef61('0x35')]=moment(_0x2bd5b3[_0xef61('0x34')])['add'](0x1,'day');}_[_0xef61('0x44')](_0x43bc47[_0xef61('0x45')],{'createdAt':{'$gte':_0x2bd5b3[_0xef61('0x34')],'$lte':_0x2bd5b3['dateEnd']}});}if(_0x587e26[_0xef61('0x33')][_0xef61('0x46')]){_0x43bc47[_0xef61('0x45')]=_[_0xef61('0x44')](_0x43bc47['where'],{'$or':_['map'](_0x43bc47['attributes'],function(_0x30efe9){var _0x43b93b={};_0x43b93b[_0x30efe9]={'$like':'%'+_0x587e26[_0xef61('0x33')][_0xef61('0x46')]+'%'};return _0x43b93b;})});}_0x43bc47=_[_0xef61('0x44')]({},_0x43bc47,_0x587e26[_0xef61('0x47')]);var _0xc9b467={'where':_0x43bc47['where']};return db[_0xef61('0x30')][_0xef61('0x20')](_0xc9b467)[_0xef61('0x27')](function(_0x898c74){_0x4f35ad['count']=_0x898c74;if(_0x587e26[_0xef61('0x33')][_0xef61('0x48')]){_0x43bc47[_0xef61('0x49')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x4a')](_0x43bc47);})[_0xef61('0x27')](function(_0x4fec54){_0x4f35ad[_0xef61('0x4b')]=_0x4fec54;return _0x4f35ad;})[_0xef61('0x27')](respondWithFilteredResult(_0x2fe908,_0x43bc47))[_0xef61('0x4c')](handleError(_0x2fe908,null));};exports['show']=function(_0x175cc1,_0x149dfd){var _0x14862d={'raw':![],'where':{'id':_0x175cc1[_0xef61('0x4d')]['id']}},_0x408e7c={};_0x408e7c[_0xef61('0x32')]=_['keys'](db[_0xef61('0x30')][_0xef61('0x31')]);_0x408e7c['query']=_[_0xef61('0x36')](_0x175cc1[_0xef61('0x33')]);_0x408e7c[_0xef61('0x37')]=_[_0xef61('0x38')](_0x408e7c['model'],_0x408e7c[_0xef61('0x33')]);_0x14862d[_0xef61('0x39')]=_[_0xef61('0x38')](_0x408e7c['model'],qs[_0xef61('0x3a')](_0x175cc1[_0xef61('0x33')]['fields']));_0x14862d[_0xef61('0x39')]=_0x14862d[_0xef61('0x39')][_0xef61('0x3b')]?_0x14862d[_0xef61('0x39')]:_0x408e7c[_0xef61('0x32')];if(_0x175cc1[_0xef61('0x33')][_0xef61('0x48')]){_0x14862d['include']=[{'all':!![]}];}_0x14862d=_[_0xef61('0x44')]({},_0x14862d,_0x175cc1['options']);return db[_0xef61('0x30')][_0xef61('0x4e')](_0x14862d)[_0xef61('0x27')](handleEntityNotFound(_0x149dfd,null))[_0xef61('0x27')](respondWithResult(_0x149dfd,null))[_0xef61('0x4c')](handleError(_0x149dfd,null));};exports[_0xef61('0x4f')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['create'](_0x3e23eb[_0xef61('0x50')],{})[_0xef61('0x27')](function(_0x5ef0c3){var _0x5316ac=_0x3e23eb[_0xef61('0x51')][_0xef61('0x28')]({'plain':!![]});if(!_0x5316ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5316ac[_0xef61('0x52')]==='user'){var _0x7383da=_0x5ef0c3[_0xef61('0x28')]({'plain':!![]});var _0x16431e=_0xef61('0x53');return db[_0xef61('0x54')][_0xef61('0x4e')]({'where':{'name':_0x16431e,'userProfileId':_0x5316ac['userProfileId']},'raw':!![]})[_0xef61('0x27')](function(_0x461345){if(_0x461345&&_0x461345['autoAssociation']===0x0){return db[_0xef61('0x29')][_0xef61('0x4f')]({'name':_0x7383da['name'],'resourceId':_0x7383da['id'],'type':_0x461345['name'],'sectionId':_0x461345['id']},{})[_0xef61('0x27')](function(){return _0x5ef0c3;});}else{return _0x5ef0c3;}})['catch'](function(_0x5dcbbe){logger['error'](_0xef61('0x55'),_0x5dcbbe);throw _0x5dcbbe;});}return _0x5ef0c3;})[_0xef61('0x27')](respondWithResult(_0x1565c7,0xc9))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x56')]=function(_0x1928a5,_0x34ae9d){if(_0x1928a5[_0xef61('0x50')]['id']){delete _0x1928a5[_0xef61('0x50')]['id'];}return db[_0xef61('0x30')][_0xef61('0x4e')]({'where':{'id':_0x1928a5[_0xef61('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34ae9d,null))['then'](saveUpdates(_0x1928a5[_0xef61('0x50')],null))[_0xef61('0x27')](respondWithResult(_0x34ae9d,null))[_0xef61('0x4c')](handleError(_0x34ae9d,null));};exports[_0xef61('0x57')]=function(_0x1e1f8e,_0x5a6d4b){return db[_0xef61('0x30')]['find']({'where':{'id':_0x1e1f8e['params']['id']}})[_0xef61('0x27')](handleEntityNotFound(_0x5a6d4b,null))[_0xef61('0x27')](removeEntity(_0x5a6d4b,null))[_0xef61('0x4c')](handleError(_0x5a6d4b,null));};exports['addUsers']=function(_0x292356,_0x1a8f8f,_0x3f8f66){return db[_0xef61('0x30')][_0xef61('0x4e')]({'where':{'id':_0x292356[_0xef61('0x4d')]['id']}})[_0xef61('0x27')](handleEntityNotFound(_0x1a8f8f,null))[_0xef61('0x27')](function(_0x3f2954){if(_0x3f2954){return _0x3f2954[_0xef61('0x58')](_0x292356['body'][_0xef61('0x59')],_['omit'](_0x292356['body'],[_0xef61('0x59'),'id'])||{});}})[_0xef61('0x27')](respondWithResult(_0x1a8f8f,null))[_0xef61('0x4c')](handleError(_0x1a8f8f,null));};exports[_0xef61('0x5a')]=function(_0xc987bc,_0x2a65a0,_0x5e98a9){var _0x4c7a9a;return db[_0xef61('0x30')][_0xef61('0x4e')]({'where':{'id':_0xc987bc[_0xef61('0x4d')]['id']}})[_0xef61('0x27')](handleEntityNotFound(_0x2a65a0,null))[_0xef61('0x27')](function(_0x3ae98c){if(_0x3ae98c){return _0x3ae98c[_0xef61('0x5a')](_0xc987bc[_0xef61('0x33')][_0xef61('0x59')])[_0xef61('0x27')](function(_0x4433ed){if(_['isArray'](_0xc987bc[_0xef61('0x33')][_0xef61('0x59')])){for(var _0x485945=0x0;_0x485945<_0xc987bc[_0xef61('0x33')][_0xef61('0x59')][_0xef61('0x3b')];_0x485945+=0x1){socket[_0xef61('0x5b')](_0xef61('0x5c'),{'UserId':_0xc987bc[_0xef61('0x33')][_0xef61('0x59')][_0x485945],'SquareProjectId':_0xc987bc[_0xef61('0x4d')]['id']});}}else{socket['emit'](_0xef61('0x5c'),{'UserId':_0xc987bc['query']['ids'],'SquareProjectId':_0xc987bc['params']['id']});}});}})[_0xef61('0x27')](respondWithStatusCode(_0x2a65a0,null))[_0xef61('0x4c')](handleError(_0x2a65a0,null));};exports[_0xef61('0x5d')]=function(_0x4abf38,_0x1fb591,_0x261859){var _0x27df9b={};var _0x3a0e72={};var _0x2cdac9;var _0x8708d6;return db[_0xef61('0x30')][_0xef61('0x5e')]({'where':{'id':_0x4abf38[_0xef61('0x4d')]['id']}})[_0xef61('0x27')](handleEntityNotFound(_0x1fb591,null))[_0xef61('0x27')](function(_0x476c51){if(_0x476c51){_0x2cdac9=_0x476c51;_0x3a0e72[_0xef61('0x32')]=_[_0xef61('0x36')](db[_0xef61('0x5f')][_0xef61('0x31')]);_0x3a0e72[_0xef61('0x33')]=_[_0xef61('0x36')](_0x4abf38['query']);_0x3a0e72[_0xef61('0x37')]=_[_0xef61('0x38')](_0x3a0e72[_0xef61('0x32')],_0x3a0e72[_0xef61('0x33')]);_0x27df9b[_0xef61('0x39')]=_[_0xef61('0x38')](_0x3a0e72['model'],qs[_0xef61('0x3a')](_0x4abf38[_0xef61('0x33')]['fields']));_0x27df9b[_0xef61('0x39')]=_0x27df9b['attributes'][_0xef61('0x3b')]?_0x27df9b[_0xef61('0x39')]:_0x3a0e72['model'];_0x27df9b[_0xef61('0x3f')]=qs['sort'](_0x4abf38[_0xef61('0x33')][_0xef61('0x40')]);_0x27df9b['where']=qs['filters'](_[_0xef61('0x41')](_0x4abf38[_0xef61('0x33')],_0x3a0e72[_0xef61('0x37')]));if(_0x4abf38[_0xef61('0x33')][_0xef61('0x46')]){_0x27df9b['where']=_[_0xef61('0x44')](_0x27df9b[_0xef61('0x45')],{'$or':_[_0xef61('0x60')](_0x27df9b[_0xef61('0x39')],function(_0x1b6b47){var _0x1aa9c3={};_0x1aa9c3[_0x1b6b47]={'$like':'%'+_0x4abf38['query'][_0xef61('0x46')]+'%'};return _0x1aa9c3;})});}_0x27df9b=_['merge']({},_0x27df9b,_0x4abf38[_0xef61('0x47')]);return _0x2cdac9[_0xef61('0x5d')](_0x27df9b);}})[_0xef61('0x27')](function(_0x3856e1){if(_0x3856e1){_0x8708d6=_0x3856e1[_0xef61('0x3b')];if(!_0x4abf38[_0xef61('0x33')][_0xef61('0x3c')](_0xef61('0x3d'))){_0x27df9b[_0xef61('0x3e')]=qs[_0xef61('0x3e')](_0x4abf38[_0xef61('0x33')][_0xef61('0x3e')]);_0x27df9b[_0xef61('0x21')]=qs['offset'](_0x4abf38[_0xef61('0x33')][_0xef61('0x21')]);}return _0x2cdac9[_0xef61('0x5d')](_0x27df9b);}})[_0xef61('0x27')](function(_0x5408e7){if(_0x5408e7){return _0x5408e7?{'count':_0x8708d6,'rows':_0x5408e7}:null;}})[_0xef61('0x27')](respondWithResult(_0x1fb591,null))['catch'](handleError(_0x1fb591,null));}; \ No newline at end of file +var _0x5430=['../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','SquareProjects','UserProfileResource','destroy','end','error','stack','name','send','SquareProject','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','add','day','filter','merge','map','includeAll','findAll','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','pick','options','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0x5430,0x10c));var _0x0543=function(_0x16fa4f,_0x3559c6){_0x16fa4f=_0x16fa4f-0x0;var _0x4d603d=_0x5430[_0x16fa4f];return _0x4d603d;};'use strict';var pdf=require(_0x0543('0x0'));var emlformat=require(_0x0543('0x1'));var rimraf=require(_0x0543('0x2'));var zipdir=require(_0x0543('0x3'));var jsonpatch=require(_0x0543('0x4'));var rp=require(_0x0543('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0543('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0543('0x7'));var csv=require(_0x0543('0x8'));var ejs=require(_0x0543('0x9'));var fs=require('fs');var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x8'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x0543('0x11'))(_0x0543('0x12'));var utils=require('../../config/utils');var config=require(_0x0543('0x13'));var db=require(_0x0543('0x14'))['db'];config[_0x0543('0x15')]=_[_0x0543('0x16')](config[_0x0543('0x15')],{'host':_0x0543('0x17'),'port':0x18eb});var socket=require(_0x0543('0x18'))(new Redis(config[_0x0543('0x15')]));require(_0x0543('0x19'))[_0x0543('0x1a')](socket);function respondWithStatusCode(_0x4204db,_0x509afa){_0x509afa=_0x509afa||0xcc;return function(_0x552980){if(_0x552980){return _0x4204db[_0x0543('0x1b')](_0x509afa);}return _0x4204db[_0x0543('0x1c')](_0x509afa)['end']();};}function respondWithResult(_0x4c4763,_0xcb09df){_0xcb09df=_0xcb09df||0xc8;return function(_0x40fb03){if(_0x40fb03){return _0x4c4763[_0x0543('0x1c')](_0xcb09df)[_0x0543('0x1d')](_0x40fb03);}};}function respondWithFilteredResult(_0x38a32e,_0x50d504){return function(_0xe69a3d){if(_0xe69a3d){var _0x235c6f=_0xe69a3d[_0x0543('0x1e')],_0x2dd5cb=_0x50d504[_0x0543('0x1f')],_0x25254e=_0x50d504['offset']+_0x50d504[_0x0543('0x20')],_0x20b396;if(_0x25254e>=_0x235c6f){_0x25254e=_0x235c6f;_0x20b396=0xc8;}else{_0x20b396=0xce;}_0x38a32e['status'](_0x20b396);return _0x38a32e['set'](_0x0543('0x21'),_0x2dd5cb+'-'+_0x25254e+'/'+_0x235c6f)[_0x0543('0x1d')](_0xe69a3d);}return null;};}function patchUpdates(_0x1aece5){return function(_0x52eb53){try{jsonpatch[_0x0543('0x22')](_0x52eb53,_0x1aece5,!![]);}catch(_0x51c271){return BPromise[_0x0543('0x23')](_0x51c271);}return _0x52eb53[_0x0543('0x24')]();};}function saveUpdates(_0x543677,_0x18dd45){return function(_0x333c72){if(_0x333c72){return _0x333c72[_0x0543('0x25')](_0x543677)[_0x0543('0x26')](function(_0x37347e){return _0x37347e;});}return null;};}function removeEntity(_0xe14f94,_0x4adba7){return function(_0x5979d2){if(_0x5979d2){return _0x5979d2['destroy']()[_0x0543('0x26')](function(){var _0x25b3a1=_0x5979d2[_0x0543('0x27')]({'plain':!![]});var _0xaf1c0e=_0x0543('0x28');return db[_0x0543('0x29')][_0x0543('0x2a')]({'where':{'type':_0xaf1c0e,'resourceId':_0x25b3a1['id']}})[_0x0543('0x26')](function(){return _0x5979d2;});})[_0x0543('0x26')](function(){_0xe14f94[_0x0543('0x1c')](0xcc)[_0x0543('0x2b')]();});}};}function handleEntityNotFound(_0x21fc63,_0x547a88){return function(_0x25e6f1){if(!_0x25e6f1){_0x21fc63[_0x0543('0x1b')](0x194);}return _0x25e6f1;};}function handleError(_0x30ad9e,_0x4f2592){_0x4f2592=_0x4f2592||0x1f4;return function(_0x9c7e34){logger[_0x0543('0x2c')](_0x9c7e34[_0x0543('0x2d')]);if(_0x9c7e34[_0x0543('0x2e')]){delete _0x9c7e34['name'];}_0x30ad9e[_0x0543('0x1c')](_0x4f2592)[_0x0543('0x2f')](_0x9c7e34);};}exports['index']=function(_0x576084,_0x3b71f0){var _0x16165c={},_0x51d49d={},_0x3b879b={'count':0x0,'rows':[]};var _0x2e03d1=db[_0x0543('0x30')][_0x0543('0x31')];_0x51d49d[_0x0543('0x32')]=_[_0x0543('0x33')](_0x2e03d1);var _0x164bbf={'dateStart':_0x576084['query'][_0x0543('0x34')],'dateEnd':_0x576084['query'][_0x0543('0x35')]};delete _0x576084[_0x0543('0x36')][_0x0543('0x34')];delete _0x576084[_0x0543('0x36')][_0x0543('0x35')];_0x51d49d['query']=_[_0x0543('0x33')](_0x576084['query']);_0x51d49d[_0x0543('0x37')]=_[_0x0543('0x38')](_0x51d49d[_0x0543('0x32')],_0x51d49d[_0x0543('0x36')]);_0x16165c['attributes']=_[_0x0543('0x38')](_0x51d49d['model'],qs[_0x0543('0x39')](_0x576084[_0x0543('0x36')][_0x0543('0x39')]));_0x16165c[_0x0543('0x3a')]=_0x16165c[_0x0543('0x3a')][_0x0543('0x3b')]?_0x16165c[_0x0543('0x3a')]:_0x51d49d[_0x0543('0x32')];if(!_0x576084[_0x0543('0x36')][_0x0543('0x3c')]('nolimit')){_0x16165c[_0x0543('0x20')]=qs[_0x0543('0x20')](_0x576084['query'][_0x0543('0x20')]);_0x16165c['offset']=qs[_0x0543('0x1f')](_0x576084[_0x0543('0x36')]['offset']);}_0x16165c['order']=qs[_0x0543('0x3d')](_0x576084[_0x0543('0x36')]['sort']);_0x16165c[_0x0543('0x3e')]=qs[_0x0543('0x37')](_['pick'](_0x576084[_0x0543('0x36')],_0x51d49d[_0x0543('0x37')]));if(_0x164bbf[_0x0543('0x34')]){if(_0x164bbf[_0x0543('0x35')]){_0x164bbf[_0x0543('0x35')]=moment(_0x164bbf['dateEnd'])['add'](0x1,'day');}else{_0x164bbf[_0x0543('0x35')]=moment(_0x164bbf[_0x0543('0x34')])[_0x0543('0x3f')](0x1,_0x0543('0x40'));}_['merge'](_0x16165c[_0x0543('0x3e')],{'createdAt':{'$gte':_0x164bbf[_0x0543('0x34')],'$lte':_0x164bbf[_0x0543('0x35')]}});}if(_0x576084[_0x0543('0x36')][_0x0543('0x41')]){_0x16165c[_0x0543('0x3e')]=_[_0x0543('0x42')](_0x16165c['where'],{'$or':_[_0x0543('0x43')](_0x16165c[_0x0543('0x3a')],function(_0x3dd2ca){var _0x1b38bc={};_0x1b38bc[_0x3dd2ca]={'$like':'%'+_0x576084[_0x0543('0x36')][_0x0543('0x41')]+'%'};return _0x1b38bc;})});}_0x16165c=_['merge']({},_0x16165c,_0x576084['options']);var _0x44116a={'where':_0x16165c[_0x0543('0x3e')]};return db[_0x0543('0x30')][_0x0543('0x1e')](_0x44116a)[_0x0543('0x26')](function(_0xff6a88){_0x3b879b[_0x0543('0x1e')]=_0xff6a88;if(_0x576084[_0x0543('0x36')][_0x0543('0x44')]){_0x16165c['include']=[{'all':!![]}];}return db['SquareProject'][_0x0543('0x45')](_0x16165c);})[_0x0543('0x26')](function(_0x5058f2){_0x3b879b['rows']=_0x5058f2;return _0x3b879b;})[_0x0543('0x26')](respondWithFilteredResult(_0x3b71f0,_0x16165c))[_0x0543('0x46')](handleError(_0x3b71f0,null));};exports['show']=function(_0x350ca8,_0x5173bc){var _0x3b3d73={'raw':![],'where':{'id':_0x350ca8['params']['id']}},_0x3e723a={};_0x3e723a['model']=_[_0x0543('0x33')](db['SquareProject'][_0x0543('0x31')]);_0x3e723a[_0x0543('0x36')]=_[_0x0543('0x33')](_0x350ca8[_0x0543('0x36')]);_0x3e723a[_0x0543('0x37')]=_[_0x0543('0x38')](_0x3e723a['model'],_0x3e723a[_0x0543('0x36')]);_0x3b3d73[_0x0543('0x3a')]=_[_0x0543('0x38')](_0x3e723a[_0x0543('0x32')],qs[_0x0543('0x39')](_0x350ca8['query'][_0x0543('0x39')]));_0x3b3d73['attributes']=_0x3b3d73[_0x0543('0x3a')][_0x0543('0x3b')]?_0x3b3d73[_0x0543('0x3a')]:_0x3e723a[_0x0543('0x32')];if(_0x350ca8[_0x0543('0x36')][_0x0543('0x44')]){_0x3b3d73['include']=[{'all':!![]}];}_0x3b3d73=_['merge']({},_0x3b3d73,_0x350ca8['options']);return db[_0x0543('0x30')][_0x0543('0x47')](_0x3b3d73)['then'](handleEntityNotFound(_0x5173bc,null))[_0x0543('0x26')](respondWithResult(_0x5173bc,null))[_0x0543('0x46')](handleError(_0x5173bc,null));};exports[_0x0543('0x48')]=function(_0x3d3bfc,_0x90dd22){return db[_0x0543('0x30')]['create'](_0x3d3bfc[_0x0543('0x49')],{})[_0x0543('0x26')](function(_0x2b4abd){var _0x416ae0=_0x3d3bfc[_0x0543('0x4a')][_0x0543('0x27')]({'plain':!![]});if(!_0x416ae0)throw new Error(_0x0543('0x4b'));if(_0x416ae0[_0x0543('0x4c')]===_0x0543('0x4a')){var _0x1000ed=_0x2b4abd[_0x0543('0x27')]({'plain':!![]});var _0x45d381=_0x0543('0x28');return db[_0x0543('0x4d')]['find']({'where':{'name':_0x45d381,'userProfileId':_0x416ae0[_0x0543('0x4e')]},'raw':!![]})[_0x0543('0x26')](function(_0x1aa689){if(_0x1aa689&&_0x1aa689[_0x0543('0x4f')]===0x0){return db[_0x0543('0x29')][_0x0543('0x48')]({'name':_0x1000ed[_0x0543('0x2e')],'resourceId':_0x1000ed['id'],'type':_0x1aa689[_0x0543('0x2e')],'sectionId':_0x1aa689['id']},{})[_0x0543('0x26')](function(){return _0x2b4abd;});}else{return _0x2b4abd;}})[_0x0543('0x46')](function(_0x44723c){logger[_0x0543('0x2c')](_0x0543('0x50'),_0x44723c);throw _0x44723c;});}return _0x2b4abd;})[_0x0543('0x26')](respondWithResult(_0x90dd22,0xc9))[_0x0543('0x46')](handleError(_0x90dd22,null));};exports['update']=function(_0x402196,_0x367484){if(_0x402196['body']['id']){delete _0x402196[_0x0543('0x49')]['id'];}return db[_0x0543('0x30')][_0x0543('0x47')]({'where':{'id':_0x402196['params']['id']}})[_0x0543('0x26')](handleEntityNotFound(_0x367484,null))['then'](saveUpdates(_0x402196[_0x0543('0x49')],null))['then'](respondWithResult(_0x367484,null))[_0x0543('0x46')](handleError(_0x367484,null));};exports['destroy']=function(_0x3e113d,_0x2496d3){return db[_0x0543('0x30')]['find']({'where':{'id':_0x3e113d[_0x0543('0x51')]['id']}})[_0x0543('0x26')](handleEntityNotFound(_0x2496d3,null))[_0x0543('0x26')](removeEntity(_0x2496d3,null))[_0x0543('0x46')](handleError(_0x2496d3,null));};exports[_0x0543('0x52')]=function(_0x42dbbf,_0x20aac8,_0x774cf7){return db[_0x0543('0x30')][_0x0543('0x47')]({'where':{'id':_0x42dbbf[_0x0543('0x51')]['id']}})[_0x0543('0x26')](handleEntityNotFound(_0x20aac8,null))[_0x0543('0x26')](function(_0x21504b){if(_0x21504b){return _0x21504b[_0x0543('0x52')](_0x42dbbf['body']['ids'],_[_0x0543('0x53')](_0x42dbbf[_0x0543('0x49')],[_0x0543('0x54'),'id'])||{});}})[_0x0543('0x26')](respondWithResult(_0x20aac8,null))[_0x0543('0x46')](handleError(_0x20aac8,null));};exports[_0x0543('0x55')]=function(_0x4c4e49,_0x31213d,_0x13b36d){var _0x51e4e2;return db[_0x0543('0x30')][_0x0543('0x47')]({'where':{'id':_0x4c4e49[_0x0543('0x51')]['id']}})[_0x0543('0x26')](handleEntityNotFound(_0x31213d,null))['then'](function(_0x3b077c){if(_0x3b077c){return _0x3b077c[_0x0543('0x55')](_0x4c4e49[_0x0543('0x36')]['ids'])['then'](function(_0x2f4d15){if(_[_0x0543('0x56')](_0x4c4e49[_0x0543('0x36')]['ids'])){for(var _0x3b9444=0x0;_0x3b9444<_0x4c4e49[_0x0543('0x36')][_0x0543('0x54')]['length'];_0x3b9444+=0x1){socket[_0x0543('0x57')](_0x0543('0x58'),{'UserId':_0x4c4e49[_0x0543('0x36')][_0x0543('0x54')][_0x3b9444],'SquareProjectId':_0x4c4e49[_0x0543('0x51')]['id']});}}else{socket[_0x0543('0x57')](_0x0543('0x58'),{'UserId':_0x4c4e49[_0x0543('0x36')][_0x0543('0x54')],'SquareProjectId':_0x4c4e49[_0x0543('0x51')]['id']});}});}})[_0x0543('0x26')](respondWithStatusCode(_0x31213d,null))[_0x0543('0x46')](handleError(_0x31213d,null));};exports[_0x0543('0x59')]=function(_0x2b16ef,_0x4fe411,_0x50abbb){var _0x41f0f2={};var _0x1f767c={};var _0x3a6d64;var _0x2ee541;return db['SquareProject'][_0x0543('0x5a')]({'where':{'id':_0x2b16ef['params']['id']}})[_0x0543('0x26')](handleEntityNotFound(_0x4fe411,null))[_0x0543('0x26')](function(_0x2ab9f){if(_0x2ab9f){_0x3a6d64=_0x2ab9f;_0x1f767c['model']=_['keys'](db[_0x0543('0x5b')]['rawAttributes']);_0x1f767c['query']=_[_0x0543('0x33')](_0x2b16ef[_0x0543('0x36')]);_0x1f767c[_0x0543('0x37')]=_[_0x0543('0x38')](_0x1f767c[_0x0543('0x32')],_0x1f767c[_0x0543('0x36')]);_0x41f0f2[_0x0543('0x3a')]=_[_0x0543('0x38')](_0x1f767c[_0x0543('0x32')],qs['fields'](_0x2b16ef[_0x0543('0x36')][_0x0543('0x39')]));_0x41f0f2[_0x0543('0x3a')]=_0x41f0f2[_0x0543('0x3a')][_0x0543('0x3b')]?_0x41f0f2['attributes']:_0x1f767c[_0x0543('0x32')];_0x41f0f2['order']=qs[_0x0543('0x3d')](_0x2b16ef[_0x0543('0x36')][_0x0543('0x3d')]);_0x41f0f2[_0x0543('0x3e')]=qs['filters'](_[_0x0543('0x5c')](_0x2b16ef[_0x0543('0x36')],_0x1f767c[_0x0543('0x37')]));if(_0x2b16ef['query'][_0x0543('0x41')]){_0x41f0f2['where']=_[_0x0543('0x42')](_0x41f0f2[_0x0543('0x3e')],{'$or':_[_0x0543('0x43')](_0x41f0f2[_0x0543('0x3a')],function(_0x25aecd){var _0x21c920={};_0x21c920[_0x25aecd]={'$like':'%'+_0x2b16ef['query']['filter']+'%'};return _0x21c920;})});}_0x41f0f2=_['merge']({},_0x41f0f2,_0x2b16ef[_0x0543('0x5d')]);return _0x3a6d64[_0x0543('0x59')](_0x41f0f2);}})[_0x0543('0x26')](function(_0x154142){if(_0x154142){_0x2ee541=_0x154142[_0x0543('0x3b')];if(!_0x2b16ef[_0x0543('0x36')][_0x0543('0x3c')](_0x0543('0x5e'))){_0x41f0f2['limit']=qs['limit'](_0x2b16ef[_0x0543('0x36')][_0x0543('0x20')]);_0x41f0f2['offset']=qs[_0x0543('0x1f')](_0x2b16ef['query'][_0x0543('0x1f')]);}return _0x3a6d64[_0x0543('0x59')](_0x41f0f2);}})[_0x0543('0x26')](function(_0x258015){if(_0x258015){return _0x258015?{'count':_0x2ee541,'rows':_0x258015}:null;}})[_0x0543('0x26')](respondWithResult(_0x4fe411,null))['catch'](handleError(_0x4fe411,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index da793e9..6fb6603 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 _0x59eb=['hook','exports','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xe248d9,_0x3aee92){var _0x3fb7b9=function(_0x334623){while(--_0x334623){_0xe248d9['push'](_0xe248d9['shift']());}};_0x3fb7b9(++_0x3aee92);}(_0x59eb,0x14b));var _0xb59e=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x59eb[_0x4b4f24];return _0x1c13d4;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb59e('0x0')](0x0);var events={'afterCreate':_0xb59e('0x1'),'afterUpdate':_0xb59e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x48826a){return function(_0x4c8e3c,_0x456c9e,_0x55d0e1){SquareProjectEvents[_0xb59e('0x3')](_0x48826a+':'+_0x4c8e3c['id'],_0x4c8e3c);SquareProjectEvents[_0xb59e('0x3')](_0x48826a,_0x4c8e3c);_0x55d0e1(null);};}for(var e in events){if(events[_0xb59e('0x4')](e)){var event=events[e];SquareProject[_0xb59e('0x5')](e,emitEvent(event));}}module[_0xb59e('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0xe1c3=['save','remove','emit','hasOwnProperty','hook','exports','SquareProject','setMaxListeners'];(function(_0x14a4ab,_0x3c8a07){var _0x15f476=function(_0x504d87){while(--_0x504d87){_0x14a4ab['push'](_0x14a4ab['shift']());}};_0x15f476(++_0x3c8a07);}(_0xe1c3,0x116));var _0x3e1c=function(_0x4a31ad,_0x588a90){_0x4a31ad=_0x4a31ad-0x0;var _0x54fa4b=_0xe1c3[_0x4a31ad];return _0x54fa4b;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x3e1c('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3e1c('0x1')](0x0);var events={'afterCreate':_0x3e1c('0x2'),'afterUpdate':'update','afterDestroy':_0x3e1c('0x3')};function emitEvent(_0x4d58bb){return function(_0x1721cc,_0x3aef00,_0x1c5e58){SquareProjectEvents[_0x3e1c('0x4')](_0x4d58bb+':'+_0x1721cc['id'],_0x1721cc);SquareProjectEvents[_0x3e1c('0x4')](_0x4d58bb,_0x1721cc);_0x1c5e58(null);};}for(var e in events){if(events[_0x3e1c('0x5')](e)){var event=events[e];SquareProject[_0x3e1c('0x6')](e,emitEvent(event));}}module[_0x3e1c('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 729f26d..6abe019 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 _0x8ef1=['lodash','util','../../config/logger','moment','bluebird','request-promise','./squareProject.attributes','define','SquareProject','square_projects'];(function(_0x4290c1,_0x2eaa3f){var _0x2d2e5=function(_0x50260f){while(--_0x50260f){_0x4290c1['push'](_0x4290c1['shift']());}};_0x2d2e5(++_0x2eaa3f);}(_0x8ef1,0x190));var _0x18ef=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x8ef1[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x18ef('0x0'));var util=require(_0x18ef('0x1'));var logger=require(_0x18ef('0x2'))('api');var moment=require(_0x18ef('0x3'));var BPromise=require(_0x18ef('0x4'));var rp=require(_0x18ef('0x5'));var attributes=require(_0x18ef('0x6'));module['exports']=function(_0x4cafb7,_0x51fa71){return _0x4cafb7[_0x18ef('0x7')](_0x18ef('0x8'),attributes,{'tableName':_0x18ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd369=['square_projects','util','request-promise','exports','define'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xd369,0xe7));var _0x9d36=function(_0x1520d2,_0x1b971a){_0x1520d2=_0x1520d2-0x0;var _0x4b7f14=_0xd369[_0x1520d2];return _0x4b7f14;};'use strict';var _=require('lodash');var util=require(_0x9d36('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9d36('0x1'));var attributes=require('./squareProject.attributes');module[_0x9d36('0x2')]=function(_0x5703b4,_0x5c79f8){return _0x5703b4[_0x9d36('0x3')]('SquareProject',attributes,{'tableName':_0x9d36('0x4'),'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 b8c5655..ac9cbee 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(_0x3214d1,_0x3c61ad){var _0x520948=function(_0x1cfb3c){while(--_0x1cfb3c){_0x3214d1['push'](_0x3214d1['shift']());}};_0x520948(++_0x3c61ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x5329e2,_0x286c19){var _0x12a13a=function(_0x5199c8){while(--_0x5199c8){_0x5329e2['push'](_0x5329e2['shift']());}};_0x12a13a(++_0x286c19);}(_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 51db3c1..359d33a 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 _0x6898=['register','length','squareProject:','./squareProject.events','remove','update','emit','removeListener'];(function(_0x2ee3fc,_0x58e865){var _0x4986f4=function(_0x2aa3c7){while(--_0x2aa3c7){_0x2ee3fc['push'](_0x2ee3fc['shift']());}};_0x4986f4(++_0x58e865);}(_0x6898,0x11b));var _0x8689=function(_0x1718ea,_0x1c8799){_0x1718ea=_0x1718ea-0x0;var _0x371e64=_0x6898[_0x1718ea];return _0x371e64;};'use strict';var SquareProjectEvents=require(_0x8689('0x0'));var events=['save',_0x8689('0x1'),_0x8689('0x2')];function createListener(_0x472b9d,_0x13fbdb){return function(_0x3ae917){_0x13fbdb[_0x8689('0x3')](_0x472b9d,_0x3ae917);};}function removeListener(_0x524f81,_0x5038aa){return function(){SquareProjectEvents[_0x8689('0x4')](_0x524f81,_0x5038aa);};}exports[_0x8689('0x5')]=function(_0x2c723e){for(var _0x4e776d=0x0,_0xbc1b52=events[_0x8689('0x6')];_0x4e776d<_0xbc1b52;_0x4e776d++){var _0x9ab197=events[_0x4e776d];var _0x4e5261=createListener(_0x8689('0x7')+_0x9ab197,_0x2c723e);SquareProjectEvents['on'](_0x9ab197,_0x4e5261);}}; \ No newline at end of file +var _0x8bdf=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x35f224,_0x33c15e){var _0x1209fc=function(_0x4c8f00){while(--_0x4c8f00){_0x35f224['push'](_0x35f224['shift']());}};_0x1209fc(++_0x33c15e);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x8bdf[_0x6131cd];return _0x47e916;};'use strict';var SquareProjectEvents=require(_0xf8bd('0x0'));var events=[_0xf8bd('0x1'),_0xf8bd('0x2'),_0xf8bd('0x3')];function createListener(_0x336d9f,_0x57e7be){return function(_0x35ddcf){_0x57e7be[_0xf8bd('0x4')](_0x336d9f,_0x35ddcf);};}function removeListener(_0x147fea,_0x3b32a1){return function(){SquareProjectEvents[_0xf8bd('0x5')](_0x147fea,_0x3b32a1);};}exports[_0xf8bd('0x6')]=function(_0x59eff9){for(var _0x4ed701=0x0,_0x504c82=events[_0xf8bd('0x7')];_0x4ed701<_0x504c82;_0x4ed701++){var _0x22a277=events[_0x4ed701];var _0x3e1db1=createListener(_0xf8bd('0x8')+_0x22a277,_0x59eff9);SquareProjectEvents['on'](_0x22a277,_0x3e1db1);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index cc34600..3f019ff 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 _0x8b9d=['../../config/environment','./squareRecording.controller','get','index','isAuthenticated','/:id/download','download','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x8b9d,0x1ee));var _0xd8b9=function(_0x112c0d,_0x5af795){_0x112c0d=_0x112c0d-0x0;var _0xcb9325=_0x8b9d[_0x112c0d];return _0xcb9325;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd8b9('0x0'));var timeout=require(_0xd8b9('0x1'));var express=require(_0xd8b9('0x2'));var router=express[_0xd8b9('0x3')]();var auth=require(_0xd8b9('0x4'));var interaction=require(_0xd8b9('0x5'));var config=require(_0xd8b9('0x6'));var controller=require(_0xd8b9('0x7'));router[_0xd8b9('0x8')]('/',auth['isAuthenticated'](),controller[_0xd8b9('0x9')]);router[_0xd8b9('0x8')]('/:id',auth[_0xd8b9('0xa')](),controller['show']);router[_0xd8b9('0x8')](_0xd8b9('0xb'),auth[_0xd8b9('0xa')](),controller[_0xd8b9('0xc')]);router[_0xd8b9('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd8b9('0xe')](_0xd8b9('0xf'),auth[_0xd8b9('0xa')](),controller[_0xd8b9('0x10')]);router[_0xd8b9('0x11')](_0xd8b9('0xf'),auth[_0xd8b9('0xa')](),controller[_0xd8b9('0x12')]);module[_0xd8b9('0x13')]=router; \ No newline at end of file +var _0xec25=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','index','get','/:id','/:id/download','create','put','delete','destroy','exports','util'];(function(_0x43f16f,_0x5b99e5){var _0x66db51=function(_0x1b017b){while(--_0x1b017b){_0x43f16f['push'](_0x43f16f['shift']());}};_0x66db51(++_0x5b99e5);}(_0xec25,0x1b9));var _0x5ec2=function(_0x35c861,_0xc2d5f0){_0x35c861=_0x35c861-0x0;var _0x42237f=_0xec25[_0x35c861];return _0x42237f;};'use strict';var multer=require('multer');var util=require(_0x5ec2('0x0'));var path=require('path');var timeout=require(_0x5ec2('0x1'));var express=require(_0x5ec2('0x2'));var router=express['Router']();var auth=require(_0x5ec2('0x3'));var interaction=require(_0x5ec2('0x4'));var config=require(_0x5ec2('0x5'));var controller=require(_0x5ec2('0x6'));router['get']('/',auth[_0x5ec2('0x7')](),controller[_0x5ec2('0x8')]);router[_0x5ec2('0x9')](_0x5ec2('0xa'),auth[_0x5ec2('0x7')](),controller['show']);router['get'](_0x5ec2('0xb'),auth[_0x5ec2('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x5ec2('0xc')]);router[_0x5ec2('0xd')](_0x5ec2('0xa'),auth[_0x5ec2('0x7')](),controller['update']);router[_0x5ec2('0xe')](_0x5ec2('0xa'),auth[_0x5ec2('0x7')](),controller[_0x5ec2('0xf')]);module[_0x5ec2('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 1fa8500..bd69980 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 _0x988d=['STRING','exports'];(function(_0x5014af,_0x4161ec){var _0x126d19=function(_0x5730d3){while(--_0x5730d3){_0x5014af['push'](_0x5014af['shift']());}};_0x126d19(++_0x4161ec);}(_0x988d,0x145));var _0xd988=function(_0x369449,_0x24432c){_0x369449=_0x369449-0x0;var _0xe0ba23=_0x988d[_0x369449];return _0xe0ba23;};'use strict';var Sequelize=require('sequelize');module[_0xd988('0x0')]={'uniqueid':{'type':Sequelize[_0xd988('0x1')]},'callerid':{'type':Sequelize[_0xd988('0x1')]},'calleridname':{'type':Sequelize[_0xd988('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd988('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd988('0x1')]},'saveName':{'type':Sequelize[_0xd988('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x056f=['exports','STRING','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x056f,0x11f));var _0xf056=function(_0x50779,_0x57b800){_0x50779=_0x50779-0x0;var _0x203e1b=_0x056f[_0x50779];return _0x203e1b;};'use strict';var Sequelize=require(_0xf056('0x0'));module[_0xf056('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf056('0x2')]},'calleridname':{'type':Sequelize[_0xf056('0x2')]},'context':{'type':Sequelize[_0xf056('0x2')]},'extension':{'type':Sequelize[_0xf056('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf056('0x2')]},'dnid':{'type':Sequelize[_0xf056('0x2')]},'projectName':{'type':Sequelize[_0xf056('0x2')]},'saveName':{'type':Sequelize[_0xf056('0x2')]},'filename':{'type':Sequelize[_0xf056('0x2')]},'savePath':{'type':Sequelize[_0xf056('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f92ab76..881d77d 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 _0xc1f4=['update','then','destroy','sendStatus','stack','send','index','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','nolimit','offset','sort','where','pick','add','day','merge','filter','options','SquareRecording','includeAll','include','findAll','show','rawAttributes','find','catch','create','body','params','download','../../components/encryptor','type','uniqueid','savePath','format','value','existsSync','decryptFile','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','limit','json','apply','reject','save'];(function(_0x42d6eb,_0xbf3169){var _0x4e66bf=function(_0x3bfef7){while(--_0x3bfef7){_0x42d6eb['push'](_0x42d6eb['shift']());}};_0x4e66bf(++_0xbf3169);}(_0xc1f4,0xdc));var _0x4c1f=function(_0x5eae0c,_0x36d39b){_0x5eae0c=_0x5eae0c-0x0;var _0x1695ed=_0xc1f4[_0x5eae0c];return _0x1695ed;};'use strict';var pdf=require(_0x4c1f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4c1f('0x1'));var zipdir=require(_0x4c1f('0x2'));var jsonpatch=require(_0x4c1f('0x3'));var rp=require(_0x4c1f('0x4'));var moment=require(_0x4c1f('0x5'));var BPromise=require(_0x4c1f('0x6'));var Mustache=require(_0x4c1f('0x7'));var util=require(_0x4c1f('0x8'));var path=require(_0x4c1f('0x9'));var sox=require(_0x4c1f('0xa'));var csv=require(_0x4c1f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c1f('0xc'));var squel=require(_0x4c1f('0xd'));var crypto=require(_0x4c1f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4c1f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c1f('0x10'));var Papa=require(_0x4c1f('0x11'));var Redis=require(_0x4c1f('0x12'));var qs=require(_0x4c1f('0x13'));var logger=require('../../config/logger')(_0x4c1f('0x14'));var utils=require(_0x4c1f('0x15'));var config=require(_0x4c1f('0x16'));var db=require(_0x4c1f('0x17'))['db'];function respondWithStatusCode(_0x367123,_0x15c537){_0x15c537=_0x15c537||0xcc;return function(_0x4654cd){if(_0x4654cd){return _0x367123['sendStatus'](_0x15c537);}return _0x367123[_0x4c1f('0x18')](_0x15c537)[_0x4c1f('0x19')]();};}function respondWithResult(_0x4cadf4,_0x3e3a26){_0x3e3a26=_0x3e3a26||0xc8;return function(_0x4fe6dd){if(_0x4fe6dd){return _0x4cadf4['status'](_0x3e3a26)['json'](_0x4fe6dd);}};}function respondWithFilteredResult(_0x4a5974,_0x58ee9b){return function(_0x5e4deb){if(_0x5e4deb){var _0x2ee1f7=_0x5e4deb[_0x4c1f('0x1a')],_0x1c8620=_0x58ee9b['offset'],_0x11b5db=_0x58ee9b['offset']+_0x58ee9b[_0x4c1f('0x1b')],_0x8f4fc0;if(_0x11b5db>=_0x2ee1f7){_0x11b5db=_0x2ee1f7;_0x8f4fc0=0xc8;}else{_0x8f4fc0=0xce;}_0x4a5974[_0x4c1f('0x18')](_0x8f4fc0);return _0x4a5974['set']('Content-Range',_0x1c8620+'-'+_0x11b5db+'/'+_0x2ee1f7)[_0x4c1f('0x1c')](_0x5e4deb);}return null;};}function patchUpdates(_0x213bce){return function(_0x2809fa){try{jsonpatch[_0x4c1f('0x1d')](_0x2809fa,_0x213bce,!![]);}catch(_0x54536f){return BPromise[_0x4c1f('0x1e')](_0x54536f);}return _0x2809fa[_0x4c1f('0x1f')]();};}function saveUpdates(_0x10609f,_0x2034b5){return function(_0x199c03){if(_0x199c03){return _0x199c03[_0x4c1f('0x20')](_0x10609f)[_0x4c1f('0x21')](function(_0x1fa007){return _0x1fa007;});}return null;};}function removeEntity(_0x231e7e,_0x3b0215){return function(_0x1d8715){if(_0x1d8715){return _0x1d8715[_0x4c1f('0x22')]()[_0x4c1f('0x21')](function(){_0x231e7e[_0x4c1f('0x18')](0xcc)[_0x4c1f('0x19')]();});}};}function handleEntityNotFound(_0x293edf,_0x12f8e0){return function(_0x445cd2){if(!_0x445cd2){_0x293edf[_0x4c1f('0x23')](0x194);}return _0x445cd2;};}function handleError(_0x56caad,_0x3adfd5){_0x3adfd5=_0x3adfd5||0x1f4;return function(_0x5aab41){logger['error'](_0x5aab41[_0x4c1f('0x24')]);if(_0x5aab41['name']){delete _0x5aab41['name'];}_0x56caad['status'](_0x3adfd5)[_0x4c1f('0x25')](_0x5aab41);};}exports[_0x4c1f('0x26')]=function(_0x49fd4a,_0x45fa58){var _0x7bc61f={},_0x50df33={},_0x4c9da2={'count':0x0,'rows':[]};var _0x3169f6=db['SquareRecording']['rawAttributes'];_0x50df33[_0x4c1f('0x27')]=_[_0x4c1f('0x28')](_0x3169f6);var _0x9c1632={'dateStart':_0x49fd4a[_0x4c1f('0x29')][_0x4c1f('0x2a')],'dateEnd':_0x49fd4a[_0x4c1f('0x29')][_0x4c1f('0x2b')]};delete _0x49fd4a[_0x4c1f('0x29')][_0x4c1f('0x2a')];delete _0x49fd4a[_0x4c1f('0x29')][_0x4c1f('0x2b')];_0x50df33[_0x4c1f('0x29')]=_[_0x4c1f('0x28')](_0x49fd4a[_0x4c1f('0x29')]);_0x50df33[_0x4c1f('0x2c')]=_[_0x4c1f('0x2d')](_0x50df33[_0x4c1f('0x27')],_0x50df33[_0x4c1f('0x29')]);_0x7bc61f['attributes']=_[_0x4c1f('0x2d')](_0x50df33[_0x4c1f('0x27')],qs[_0x4c1f('0x2e')](_0x49fd4a[_0x4c1f('0x29')]['fields']));_0x7bc61f['attributes']=_0x7bc61f[_0x4c1f('0x2f')][_0x4c1f('0x30')]?_0x7bc61f[_0x4c1f('0x2f')]:_0x50df33[_0x4c1f('0x27')];if(!_0x49fd4a[_0x4c1f('0x29')]['hasOwnProperty'](_0x4c1f('0x31'))){_0x7bc61f[_0x4c1f('0x1b')]=qs[_0x4c1f('0x1b')](_0x49fd4a[_0x4c1f('0x29')][_0x4c1f('0x1b')]);_0x7bc61f['offset']=qs['offset'](_0x49fd4a[_0x4c1f('0x29')][_0x4c1f('0x32')]);}_0x7bc61f['order']=qs[_0x4c1f('0x33')](_0x49fd4a[_0x4c1f('0x29')][_0x4c1f('0x33')]);_0x7bc61f[_0x4c1f('0x34')]=qs[_0x4c1f('0x2c')](_[_0x4c1f('0x35')](_0x49fd4a[_0x4c1f('0x29')],_0x50df33[_0x4c1f('0x2c')]));if(_0x9c1632[_0x4c1f('0x2a')]){if(_0x9c1632['dateEnd']){_0x9c1632[_0x4c1f('0x2b')]=moment(_0x9c1632['dateEnd'])[_0x4c1f('0x36')](0x1,_0x4c1f('0x37'));}else{_0x9c1632[_0x4c1f('0x2b')]=moment(_0x9c1632['dateStart'])[_0x4c1f('0x36')](0x1,_0x4c1f('0x37'));}_[_0x4c1f('0x38')](_0x7bc61f['where'],{'createdAt':{'$gte':_0x9c1632['dateStart'],'$lte':_0x9c1632[_0x4c1f('0x2b')]}});}if(_0x49fd4a['query'][_0x4c1f('0x39')]){_0x7bc61f[_0x4c1f('0x34')]=_[_0x4c1f('0x38')](_0x7bc61f[_0x4c1f('0x34')],{'$or':_['map'](_0x7bc61f['attributes'],function(_0x4bcab7){var _0x3a5d22={};_0x3a5d22[_0x4bcab7]={'$like':'%'+_0x49fd4a['query'][_0x4c1f('0x39')]+'%'};return _0x3a5d22;})});}_0x7bc61f=_['merge']({},_0x7bc61f,_0x49fd4a[_0x4c1f('0x3a')]);var _0x1dde63={'where':_0x7bc61f[_0x4c1f('0x34')]};return db[_0x4c1f('0x3b')][_0x4c1f('0x1a')](_0x1dde63)[_0x4c1f('0x21')](function(_0x30aec1){_0x4c9da2[_0x4c1f('0x1a')]=_0x30aec1;if(_0x49fd4a[_0x4c1f('0x29')][_0x4c1f('0x3c')]){_0x7bc61f[_0x4c1f('0x3d')]=[{'all':!![]}];}return db[_0x4c1f('0x3b')][_0x4c1f('0x3e')](_0x7bc61f);})[_0x4c1f('0x21')](function(_0x230e71){_0x4c9da2['rows']=_0x230e71;return _0x4c9da2;})[_0x4c1f('0x21')](respondWithFilteredResult(_0x45fa58,_0x7bc61f))['catch'](handleError(_0x45fa58,null));};exports[_0x4c1f('0x3f')]=function(_0x5198d,_0x1242f5){var _0x1ff359={'raw':!![],'where':{'id':_0x5198d['params']['id']}},_0x470a00={};_0x470a00[_0x4c1f('0x27')]=_['keys'](db[_0x4c1f('0x3b')][_0x4c1f('0x40')]);_0x470a00['query']=_[_0x4c1f('0x28')](_0x5198d[_0x4c1f('0x29')]);_0x470a00['filters']=_[_0x4c1f('0x2d')](_0x470a00['model'],_0x470a00[_0x4c1f('0x29')]);_0x1ff359[_0x4c1f('0x2f')]=_[_0x4c1f('0x2d')](_0x470a00[_0x4c1f('0x27')],qs[_0x4c1f('0x2e')](_0x5198d['query']['fields']));_0x1ff359['attributes']=_0x1ff359[_0x4c1f('0x2f')][_0x4c1f('0x30')]?_0x1ff359[_0x4c1f('0x2f')]:_0x470a00['model'];if(_0x5198d[_0x4c1f('0x29')]['includeAll']){_0x1ff359[_0x4c1f('0x3d')]=[{'all':!![]}];}_0x1ff359=_['merge']({},_0x1ff359,_0x5198d[_0x4c1f('0x3a')]);return db[_0x4c1f('0x3b')][_0x4c1f('0x41')](_0x1ff359)[_0x4c1f('0x21')](handleEntityNotFound(_0x1242f5,null))[_0x4c1f('0x21')](respondWithResult(_0x1242f5,null))[_0x4c1f('0x42')](handleError(_0x1242f5,null));};exports[_0x4c1f('0x43')]=function(_0x3a228a,_0x3453e6){return db['SquareRecording'][_0x4c1f('0x43')](_0x3a228a[_0x4c1f('0x44')],{})[_0x4c1f('0x21')](respondWithResult(_0x3453e6,0xc9))[_0x4c1f('0x42')](handleError(_0x3453e6,null));};exports[_0x4c1f('0x20')]=function(_0x454fce,_0x2e0de1){if(_0x454fce[_0x4c1f('0x44')]['id']){delete _0x454fce[_0x4c1f('0x44')]['id'];}return db[_0x4c1f('0x3b')][_0x4c1f('0x41')]({'where':{'id':_0x454fce[_0x4c1f('0x45')]['id']}})[_0x4c1f('0x21')](handleEntityNotFound(_0x2e0de1,null))[_0x4c1f('0x21')](saveUpdates(_0x454fce['body'],null))[_0x4c1f('0x21')](respondWithResult(_0x2e0de1,null))[_0x4c1f('0x42')](handleError(_0x2e0de1,null));};exports[_0x4c1f('0x22')]=function(_0x3041f2,_0x326dd3){return db[_0x4c1f('0x3b')][_0x4c1f('0x41')]({'where':{'id':_0x3041f2[_0x4c1f('0x45')]['id']}})[_0x4c1f('0x21')](handleEntityNotFound(_0x326dd3,null))[_0x4c1f('0x21')](removeEntity(_0x326dd3,null))[_0x4c1f('0x42')](handleError(_0x326dd3,null));};exports[_0x4c1f('0x46')]=function(_0x28a62a,_0x45666b,_0x59c70c){var _0x3a055c=require(_0x4c1f('0x47'));var _0x1f46eb=![];var _0x1a278a={};if(_0x28a62a[_0x4c1f('0x29')][_0x4c1f('0x48')]&&_0x28a62a[_0x4c1f('0x29')][_0x4c1f('0x48')]===_0x4c1f('0x49')){_0x1a278a['uniqueid']=_0x28a62a['params']['id'];}else{_0x1a278a['id']=_0x28a62a['params']['id'];}return db[_0x4c1f('0x3b')][_0x4c1f('0x41')]({'where':_0x1a278a,'attributes':['id',_0x4c1f('0x4a'),'filename'],'raw':!![]})[_0x4c1f('0x21')](handleEntityNotFound(_0x45666b,null))['then'](function(_0x331c65){if(_0x331c65){var _0x1610e7=util[_0x4c1f('0x4b')]('%s.cypher',_0x331c65[_0x4c1f('0x4c')]);if(fs[_0x4c1f('0x4d')](_0x1610e7)){_0x1f46eb=!![];return _0x3a055c[_0x4c1f('0x4e')](_0x1610e7,_0x331c65[_0x4c1f('0x4a')],config['secrets']['recording'])[_0x4c1f('0x21')](function(){return _0x331c65;});}return _0x331c65;}})[_0x4c1f('0x21')](function(_0x46d4b5){if(_0x46d4b5){if(!fs[_0x4c1f('0x4d')](_0x46d4b5[_0x4c1f('0x4a')])){throw new db[(_0x4c1f('0x4f'))]['ValidationError'](_0x4c1f('0x50'));}if(_0x46d4b5['filename']){return _0x45666b[_0x4c1f('0x46')](_0x46d4b5[_0x4c1f('0x4a')],_0x46d4b5[_0x4c1f('0x51')]+path[_0x4c1f('0x52')](_0x46d4b5[_0x4c1f('0x4a')]),function(){if(_0x1f46eb){fs[_0x4c1f('0x53')](_0x46d4b5[_0x4c1f('0x4a')]);}});}else{return _0x45666b[_0x4c1f('0x46')](_0x46d4b5[_0x4c1f('0x4a')],function(_0x31158d){if(_0x1f46eb){fs[_0x4c1f('0x53')](_0x46d4b5[_0x4c1f('0x4a')]);}});}}})[_0x4c1f('0x42')](handleError(_0x45666b,null));}; \ No newline at end of file +var _0x9c19=['value','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','SquareRecording','rawAttributes','model','query','dateEnd','dateStart','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','add','day','where','filter','merge','map','include','findAll','rows','catch','show','params','filters','includeAll','options','create','body','find','download','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher'];(function(_0x9413f0,_0x4e908b){var _0x2469bd=function(_0x28bf31){while(--_0x28bf31){_0x9413f0['push'](_0x9413f0['shift']());}};_0x2469bd(++_0x4e908b);}(_0x9c19,0x11d));var _0x99c1=function(_0x32b248,_0x4e4850){_0x32b248=_0x32b248-0x0;var _0x1634c4=_0x9c19[_0x32b248];return _0x1634c4;};'use strict';var pdf=require(_0x99c1('0x0'));var emlformat=require(_0x99c1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x99c1('0x2'));var jsonpatch=require(_0x99c1('0x3'));var rp=require(_0x99c1('0x4'));var moment=require(_0x99c1('0x5'));var BPromise=require(_0x99c1('0x6'));var Mustache=require(_0x99c1('0x7'));var util=require(_0x99c1('0x8'));var path=require(_0x99c1('0x9'));var sox=require(_0x99c1('0xa'));var csv=require(_0x99c1('0xb'));var ejs=require(_0x99c1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x99c1('0xd'));var crypto=require(_0x99c1('0xe'));var jsforce=require(_0x99c1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x99c1('0xb'));var querystring=require('querystring');var Papa=require(_0x99c1('0x10'));var Redis=require(_0x99c1('0x11'));var qs=require(_0x99c1('0x12'));var logger=require(_0x99c1('0x13'))(_0x99c1('0x14'));var utils=require(_0x99c1('0x15'));var config=require(_0x99c1('0x16'));var db=require(_0x99c1('0x17'))['db'];function respondWithStatusCode(_0xe4abaa,_0x4b3cd8){_0x4b3cd8=_0x4b3cd8||0xcc;return function(_0xad3c57){if(_0xad3c57){return _0xe4abaa[_0x99c1('0x18')](_0x4b3cd8);}return _0xe4abaa[_0x99c1('0x19')](_0x4b3cd8)['end']();};}function respondWithResult(_0x73781b,_0x2b4c61){_0x2b4c61=_0x2b4c61||0xc8;return function(_0x32cb78){if(_0x32cb78){return _0x73781b[_0x99c1('0x19')](_0x2b4c61)['json'](_0x32cb78);}};}function respondWithFilteredResult(_0x23bc63,_0x4f52f5){return function(_0x77d406){if(_0x77d406){var _0x318aec=_0x77d406[_0x99c1('0x1a')],_0x43a16b=_0x4f52f5['offset'],_0x4a4312=_0x4f52f5[_0x99c1('0x1b')]+_0x4f52f5[_0x99c1('0x1c')],_0x59ba78;if(_0x4a4312>=_0x318aec){_0x4a4312=_0x318aec;_0x59ba78=0xc8;}else{_0x59ba78=0xce;}_0x23bc63[_0x99c1('0x19')](_0x59ba78);return _0x23bc63['set'](_0x99c1('0x1d'),_0x43a16b+'-'+_0x4a4312+'/'+_0x318aec)[_0x99c1('0x1e')](_0x77d406);}return null;};}function patchUpdates(_0x39b469){return function(_0x4f1779){try{jsonpatch[_0x99c1('0x1f')](_0x4f1779,_0x39b469,!![]);}catch(_0xe65083){return BPromise[_0x99c1('0x20')](_0xe65083);}return _0x4f1779[_0x99c1('0x21')]();};}function saveUpdates(_0x2996df,_0x2d6eee){return function(_0x1d0ac6){if(_0x1d0ac6){return _0x1d0ac6[_0x99c1('0x22')](_0x2996df)[_0x99c1('0x23')](function(_0x4c306c){return _0x4c306c;});}return null;};}function removeEntity(_0x21d1f8,_0x22e199){return function(_0x55a816){if(_0x55a816){return _0x55a816[_0x99c1('0x24')]()[_0x99c1('0x23')](function(){_0x21d1f8[_0x99c1('0x19')](0xcc)[_0x99c1('0x25')]();});}};}function handleEntityNotFound(_0x3c7f19,_0x582e4b){return function(_0x2ca730){if(!_0x2ca730){_0x3c7f19[_0x99c1('0x18')](0x194);}return _0x2ca730;};}function handleError(_0x4cd645,_0x9d0743){_0x9d0743=_0x9d0743||0x1f4;return function(_0x3b2ec5){logger['error'](_0x3b2ec5['stack']);if(_0x3b2ec5[_0x99c1('0x26')]){delete _0x3b2ec5[_0x99c1('0x26')];}_0x4cd645[_0x99c1('0x19')](_0x9d0743)[_0x99c1('0x27')](_0x3b2ec5);};}exports[_0x99c1('0x28')]=function(_0x3c124e,_0x32f32c){var _0x5009d7={},_0x2d9640={},_0xca7c6d={'count':0x0,'rows':[]};var _0x4c68bc=db[_0x99c1('0x29')][_0x99c1('0x2a')];_0x2d9640[_0x99c1('0x2b')]=_['keys'](_0x4c68bc);var _0x47814f={'dateStart':_0x3c124e[_0x99c1('0x2c')]['dateStart'],'dateEnd':_0x3c124e[_0x99c1('0x2c')][_0x99c1('0x2d')]};delete _0x3c124e[_0x99c1('0x2c')][_0x99c1('0x2e')];delete _0x3c124e[_0x99c1('0x2c')][_0x99c1('0x2d')];_0x2d9640[_0x99c1('0x2c')]=_[_0x99c1('0x2f')](_0x3c124e[_0x99c1('0x2c')]);_0x2d9640['filters']=_['intersection'](_0x2d9640[_0x99c1('0x2b')],_0x2d9640[_0x99c1('0x2c')]);_0x5009d7[_0x99c1('0x30')]=_[_0x99c1('0x31')](_0x2d9640[_0x99c1('0x2b')],qs[_0x99c1('0x32')](_0x3c124e[_0x99c1('0x2c')][_0x99c1('0x32')]));_0x5009d7[_0x99c1('0x30')]=_0x5009d7[_0x99c1('0x30')][_0x99c1('0x33')]?_0x5009d7['attributes']:_0x2d9640[_0x99c1('0x2b')];if(!_0x3c124e['query'][_0x99c1('0x34')](_0x99c1('0x35'))){_0x5009d7[_0x99c1('0x1c')]=qs[_0x99c1('0x1c')](_0x3c124e['query'][_0x99c1('0x1c')]);_0x5009d7[_0x99c1('0x1b')]=qs[_0x99c1('0x1b')](_0x3c124e[_0x99c1('0x2c')][_0x99c1('0x1b')]);}_0x5009d7[_0x99c1('0x36')]=qs['sort'](_0x3c124e[_0x99c1('0x2c')][_0x99c1('0x37')]);_0x5009d7['where']=qs['filters'](_[_0x99c1('0x38')](_0x3c124e[_0x99c1('0x2c')],_0x2d9640['filters']));if(_0x47814f[_0x99c1('0x2e')]){if(_0x47814f[_0x99c1('0x2d')]){_0x47814f[_0x99c1('0x2d')]=moment(_0x47814f[_0x99c1('0x2d')])[_0x99c1('0x39')](0x1,_0x99c1('0x3a'));}else{_0x47814f[_0x99c1('0x2d')]=moment(_0x47814f['dateStart'])[_0x99c1('0x39')](0x1,'day');}_['merge'](_0x5009d7[_0x99c1('0x3b')],{'createdAt':{'$gte':_0x47814f[_0x99c1('0x2e')],'$lte':_0x47814f['dateEnd']}});}if(_0x3c124e[_0x99c1('0x2c')][_0x99c1('0x3c')]){_0x5009d7[_0x99c1('0x3b')]=_[_0x99c1('0x3d')](_0x5009d7[_0x99c1('0x3b')],{'$or':_[_0x99c1('0x3e')](_0x5009d7[_0x99c1('0x30')],function(_0x461d93){var _0x13705e={};_0x13705e[_0x461d93]={'$like':'%'+_0x3c124e[_0x99c1('0x2c')][_0x99c1('0x3c')]+'%'};return _0x13705e;})});}_0x5009d7=_[_0x99c1('0x3d')]({},_0x5009d7,_0x3c124e['options']);var _0x3e0694={'where':_0x5009d7[_0x99c1('0x3b')]};return db['SquareRecording'][_0x99c1('0x1a')](_0x3e0694)[_0x99c1('0x23')](function(_0x4a90e3){_0xca7c6d[_0x99c1('0x1a')]=_0x4a90e3;if(_0x3c124e['query']['includeAll']){_0x5009d7[_0x99c1('0x3f')]=[{'all':!![]}];}return db[_0x99c1('0x29')][_0x99c1('0x40')](_0x5009d7);})['then'](function(_0x41dcab){_0xca7c6d[_0x99c1('0x41')]=_0x41dcab;return _0xca7c6d;})[_0x99c1('0x23')](respondWithFilteredResult(_0x32f32c,_0x5009d7))[_0x99c1('0x42')](handleError(_0x32f32c,null));};exports[_0x99c1('0x43')]=function(_0x2e4694,_0x5660b5){var _0x2b6ce0={'raw':!![],'where':{'id':_0x2e4694[_0x99c1('0x44')]['id']}},_0x2420c6={};_0x2420c6[_0x99c1('0x2b')]=_[_0x99c1('0x2f')](db[_0x99c1('0x29')][_0x99c1('0x2a')]);_0x2420c6[_0x99c1('0x2c')]=_[_0x99c1('0x2f')](_0x2e4694[_0x99c1('0x2c')]);_0x2420c6[_0x99c1('0x45')]=_['intersection'](_0x2420c6['model'],_0x2420c6[_0x99c1('0x2c')]);_0x2b6ce0[_0x99c1('0x30')]=_[_0x99c1('0x31')](_0x2420c6[_0x99c1('0x2b')],qs[_0x99c1('0x32')](_0x2e4694[_0x99c1('0x2c')]['fields']));_0x2b6ce0[_0x99c1('0x30')]=_0x2b6ce0[_0x99c1('0x30')][_0x99c1('0x33')]?_0x2b6ce0[_0x99c1('0x30')]:_0x2420c6[_0x99c1('0x2b')];if(_0x2e4694['query'][_0x99c1('0x46')]){_0x2b6ce0[_0x99c1('0x3f')]=[{'all':!![]}];}_0x2b6ce0=_['merge']({},_0x2b6ce0,_0x2e4694[_0x99c1('0x47')]);return db['SquareRecording']['find'](_0x2b6ce0)[_0x99c1('0x23')](handleEntityNotFound(_0x5660b5,null))[_0x99c1('0x23')](respondWithResult(_0x5660b5,null))[_0x99c1('0x42')](handleError(_0x5660b5,null));};exports['create']=function(_0x32251b,_0x113bdc){return db['SquareRecording'][_0x99c1('0x48')](_0x32251b[_0x99c1('0x49')],{})[_0x99c1('0x23')](respondWithResult(_0x113bdc,0xc9))[_0x99c1('0x42')](handleError(_0x113bdc,null));};exports[_0x99c1('0x22')]=function(_0x42f0e5,_0x26d392){if(_0x42f0e5[_0x99c1('0x49')]['id']){delete _0x42f0e5['body']['id'];}return db['SquareRecording'][_0x99c1('0x4a')]({'where':{'id':_0x42f0e5[_0x99c1('0x44')]['id']}})[_0x99c1('0x23')](handleEntityNotFound(_0x26d392,null))[_0x99c1('0x23')](saveUpdates(_0x42f0e5['body'],null))[_0x99c1('0x23')](respondWithResult(_0x26d392,null))['catch'](handleError(_0x26d392,null));};exports['destroy']=function(_0x1e4e7e,_0x50c750){return db[_0x99c1('0x29')]['find']({'where':{'id':_0x1e4e7e[_0x99c1('0x44')]['id']}})[_0x99c1('0x23')](handleEntityNotFound(_0x50c750,null))['then'](removeEntity(_0x50c750,null))[_0x99c1('0x42')](handleError(_0x50c750,null));};exports[_0x99c1('0x4b')]=function(_0x1dd9eb,_0x18b8e8,_0x4ba61f){var _0x19b036=require(_0x99c1('0x4c'));var _0x47378f=![];var _0x3c056e={};if(_0x1dd9eb[_0x99c1('0x2c')]['type']&&_0x1dd9eb[_0x99c1('0x2c')][_0x99c1('0x4d')]==='uniqueid'){_0x3c056e[_0x99c1('0x4e')]=_0x1dd9eb[_0x99c1('0x44')]['id'];}else{_0x3c056e['id']=_0x1dd9eb[_0x99c1('0x44')]['id'];}return db[_0x99c1('0x29')][_0x99c1('0x4a')]({'where':_0x3c056e,'attributes':['id',_0x99c1('0x4f'),_0x99c1('0x50')],'raw':!![]})[_0x99c1('0x23')](handleEntityNotFound(_0x18b8e8,null))['then'](function(_0x545773){if(_0x545773){var _0x2d44db=util[_0x99c1('0x51')](_0x99c1('0x52'),_0x545773[_0x99c1('0x53')]);if(fs[_0x99c1('0x54')](_0x2d44db)){_0x47378f=!![];return _0x19b036[_0x99c1('0x55')](_0x2d44db,_0x545773[_0x99c1('0x4f')],config[_0x99c1('0x56')][_0x99c1('0x57')])[_0x99c1('0x23')](function(){return _0x545773;});}return _0x545773;}})[_0x99c1('0x23')](function(_0x1146ab){if(_0x1146ab){if(!fs[_0x99c1('0x54')](_0x1146ab[_0x99c1('0x4f')])){throw new db[(_0x99c1('0x58'))]['ValidationError'](_0x99c1('0x59'));}if(_0x1146ab[_0x99c1('0x50')]){return _0x18b8e8['download'](_0x1146ab[_0x99c1('0x4f')],_0x1146ab[_0x99c1('0x50')]+path[_0x99c1('0x5a')](_0x1146ab['savePath']),function(){if(_0x47378f){fs[_0x99c1('0x5b')](_0x1146ab[_0x99c1('0x4f')]);}});}else{return _0x18b8e8[_0x99c1('0x4b')](_0x1146ab['savePath'],function(_0x53dbc0){if(_0x47378f){fs[_0x99c1('0x5b')](_0x1146ab[_0x99c1('0x4f')]);}});}}})[_0x99c1('0x42')](handleError(_0x18b8e8,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 3c43346..aab80be 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 _0x1354=['util','../../config/logger','api','moment','bluebird','request-promise','exports','SquareRecording','square_recordings','lodash'];(function(_0x4f60dd,_0x123b3f){var _0x17da92=function(_0x41a424){while(--_0x41a424){_0x4f60dd['push'](_0x4f60dd['shift']());}};_0x17da92(++_0x123b3f);}(_0x1354,0x95));var _0x4135=function(_0x156489,_0x2bbaf2){_0x156489=_0x156489-0x0;var _0x4d2814=_0x1354[_0x156489];return _0x4d2814;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var logger=require(_0x4135('0x2'))(_0x4135('0x3'));var moment=require(_0x4135('0x4'));var BPromise=require(_0x4135('0x5'));var rp=require(_0x4135('0x6'));var attributes=require('./squareRecording.attributes');module[_0x4135('0x7')]=function(_0x4ed434,_0x202042){return _0x4ed434['define'](_0x4135('0x8'),attributes,{'tableName':_0x4135('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1501=['bluebird','request-promise','./squareRecording.attributes','exports','SquareRecording','square_recordings','util','../../config/logger','api'];(function(_0x3bec74,_0x377c94){var _0x25609a=function(_0x28dac7){while(--_0x28dac7){_0x3bec74['push'](_0x3bec74['shift']());}};_0x25609a(++_0x377c94);}(_0x1501,0x126));var _0x1150=function(_0x488f79,_0x305b4b){_0x488f79=_0x488f79-0x0;var _0x102892=_0x1501[_0x488f79];return _0x102892;};'use strict';var _=require('lodash');var util=require(_0x1150('0x0'));var logger=require(_0x1150('0x1'))(_0x1150('0x2'));var moment=require('moment');var BPromise=require(_0x1150('0x3'));var rp=require(_0x1150('0x4'));var attributes=require(_0x1150('0x5'));module[_0x1150('0x6')]=function(_0x4d218f,_0x2525e7){return _0x4d218f['define'](_0x1150('0x7'),attributes,{'tableName':_0x1150('0x8'),'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 8274348..d1a5457 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 _0xaf36=['body','options','raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareRecording','SquareRecording'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0xaf36,0xd0));var _0x6af3=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0xaf36[_0x1a0600];return _0x734670;};'use strict';var _=require(_0x6af3('0x0'));var util=require(_0x6af3('0x1'));var moment=require(_0x6af3('0x2'));var BPromise=require(_0x6af3('0x3'));var rs=require(_0x6af3('0x4'));var fs=require('fs');var Redis=require(_0x6af3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6af3('0x6'));var logger=require(_0x6af3('0x7'))(_0x6af3('0x8'));var config=require('../../config/environment');var jayson=require(_0x6af3('0x9'));var client=jayson[_0x6af3('0xa')][_0x6af3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21fbb7,_0x6e1e5a,_0x4f8c10){return new BPromise(function(_0x3ff182,_0x6e20a5){return client['request'](_0x21fbb7,_0x4f8c10)['then'](function(_0x4093e5){logger[_0x6af3('0xc')](_0x6af3('0xd'),_0x6e1e5a,'request\x20sent');logger[_0x6af3('0xe')](_0x6af3('0xf'),_0x6e1e5a,_0x6af3('0x10'),JSON[_0x6af3('0x11')](_0x4093e5));if(_0x4093e5['error']){if(_0x4093e5[_0x6af3('0x12')][_0x6af3('0x13')]===0x1f4){logger[_0x6af3('0x12')](_0x6af3('0xd'),_0x6e1e5a,_0x4093e5[_0x6af3('0x12')]['message']);return _0x6e20a5(_0x4093e5[_0x6af3('0x12')][_0x6af3('0x14')]);}logger[_0x6af3('0x12')](_0x6af3('0xd'),_0x6e1e5a,_0x4093e5[_0x6af3('0x12')][_0x6af3('0x14')]);return _0x3ff182(_0x4093e5['error'][_0x6af3('0x14')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x6e1e5a,_0x6af3('0x10'));_0x3ff182(_0x4093e5[_0x6af3('0x15')][_0x6af3('0x14')]);}})['catch'](function(_0x7b81d0){logger[_0x6af3('0x12')]('SquareRecording,\x20%s,\x20%s',_0x6e1e5a,_0x7b81d0);_0x6e20a5(_0x7b81d0);});});}exports[_0x6af3('0x16')]=function(_0xd8e157){var _0x122611=this;return new Promise(function(_0x1c8624,_0x3f281c){return db[_0x6af3('0x17')]['create'](_0xd8e157[_0x6af3('0x18')],{'raw':_0xd8e157[_0x6af3('0x19')]?_0xd8e157['options'][_0x6af3('0x1a')]===undefined?!![]:![]:!![]})[_0x6af3('0x1b')](function(_0x24d4be){logger[_0x6af3('0xc')](_0x6af3('0x16'),_0xd8e157);logger['debug']('CreateSquareRecording',_0xd8e157,JSON['stringify'](_0x24d4be));_0x1c8624(_0x24d4be);})[_0x6af3('0x1c')](function(_0x5f0550){logger['error'](_0x6af3('0x16'),_0x5f0550[_0x6af3('0x14')],_0xd8e157);_0x3f281c(_0x122611[_0x6af3('0x12')](0x1f4,_0x5f0550[_0x6af3('0x14')]));});});}; \ No newline at end of file +var _0x73d4=['info','SquareRecording,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','debug','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x41e751,_0x16e185){var _0x18dc18=function(_0xa12a05){while(--_0xa12a05){_0x41e751['push'](_0x41e751['shift']());}};_0x18dc18(++_0x16e185);}(_0x73d4,0x177));var _0x473d=function(_0x4283c0,_0xc694d5){_0x4283c0=_0x4283c0-0x0;var _0x6b47ab=_0x73d4[_0x4283c0];return _0x6b47ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x473d('0x0'));var rs=require(_0x473d('0x1'));var fs=require('fs');var Redis=require(_0x473d('0x2'));var db=require(_0x473d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x473d('0x4'))(_0x473d('0x5'));var config=require(_0x473d('0x6'));var jayson=require(_0x473d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x591106,_0x578977,_0x1fc01f){return new BPromise(function(_0x3745bf,_0x26a51d){return client[_0x473d('0x8')](_0x591106,_0x1fc01f)['then'](function(_0x32e4c6){logger[_0x473d('0x9')](_0x473d('0xa'),_0x578977,_0x473d('0xb'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x578977,_0x473d('0xb'),JSON['stringify'](_0x32e4c6));if(_0x32e4c6[_0x473d('0xc')]){if(_0x32e4c6[_0x473d('0xc')][_0x473d('0xd')]===0x1f4){logger[_0x473d('0xc')](_0x473d('0xa'),_0x578977,_0x32e4c6['error'][_0x473d('0xe')]);return _0x26a51d(_0x32e4c6[_0x473d('0xc')][_0x473d('0xe')]);}logger[_0x473d('0xc')](_0x473d('0xa'),_0x578977,_0x32e4c6[_0x473d('0xc')]['message']);return _0x3745bf(_0x32e4c6[_0x473d('0xc')][_0x473d('0xe')]);}else{logger[_0x473d('0x9')](_0x473d('0xa'),_0x578977,_0x473d('0xb'));_0x3745bf(_0x32e4c6['result'][_0x473d('0xe')]);}})[_0x473d('0xf')](function(_0x5cb7aa){logger[_0x473d('0xc')](_0x473d('0xa'),_0x578977,_0x5cb7aa);_0x26a51d(_0x5cb7aa);});});}exports[_0x473d('0x10')]=function(_0x27763f){var _0x20a9c0=this;return new Promise(function(_0x1cf640,_0x2da514){return db[_0x473d('0x11')][_0x473d('0x12')](_0x27763f[_0x473d('0x13')],{'raw':_0x27763f[_0x473d('0x14')]?_0x27763f[_0x473d('0x14')][_0x473d('0x15')]===undefined?!![]:![]:!![]})[_0x473d('0x16')](function(_0x53bc70){logger[_0x473d('0x9')](_0x473d('0x10'),_0x27763f);logger[_0x473d('0x17')]('CreateSquareRecording',_0x27763f,JSON['stringify'](_0x53bc70));_0x1cf640(_0x53bc70);})[_0x473d('0xf')](function(_0x1bceb9){logger['error'](_0x473d('0x10'),_0x1bceb9[_0x473d('0xe')],_0x27763f);_0x2da514(_0x20a9c0['error'](0x1f4,_0x1bceb9[_0x473d('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e0f4868..b8d51b5 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 _0xd036=['create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x2c90b5,_0x1968ab){var _0x4faec1=function(_0x2cef89){while(--_0x2cef89){_0x2c90b5['push'](_0x2c90b5['shift']());}};_0x4faec1(++_0x1968ab);}(_0xd036,0x1f4));var _0x6d03=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0xd036[_0x408e38];return _0x426b0e;};'use strict';var multer=require(_0x6d03('0x0'));var util=require('util');var path=require(_0x6d03('0x1'));var timeout=require(_0x6d03('0x2'));var express=require('express');var router=express[_0x6d03('0x3')]();var auth=require(_0x6d03('0x4'));var interaction=require(_0x6d03('0x5'));var config=require('../../config/environment');var controller=require('./squareReport.controller');router[_0x6d03('0x6')]('/',auth[_0x6d03('0x7')](),controller[_0x6d03('0x8')]);router['get'](_0x6d03('0x9'),auth['isAuthenticated'](),controller[_0x6d03('0xa')]);router[_0x6d03('0x6')]('/:id',auth[_0x6d03('0x7')](),controller[_0x6d03('0xb')]);router[_0x6d03('0xc')]('/',auth[_0x6d03('0x7')](),controller[_0x6d03('0xd')]);router[_0x6d03('0xe')](_0x6d03('0xf'),auth[_0x6d03('0x7')](),controller['update']);router[_0x6d03('0x10')](_0x6d03('0xf'),auth[_0x6d03('0x7')](),controller[_0x6d03('0x11')]);module[_0x6d03('0x12')]=router; \ No newline at end of file +var _0xb96a=['get','/describe','isAuthenticated','describe','show','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb96a,0x1c4));var _0xab96=function(_0x4fda54,_0x4a89b0){_0x4fda54=_0x4fda54-0x0;var _0x3dc879=_0xb96a[_0x4fda54];return _0x3dc879;};'use strict';var multer=require(_0xab96('0x0'));var util=require('util');var path=require(_0xab96('0x1'));var timeout=require(_0xab96('0x2'));var express=require(_0xab96('0x3'));var router=express[_0xab96('0x4')]();var auth=require(_0xab96('0x5'));var interaction=require(_0xab96('0x6'));var config=require(_0xab96('0x7'));var controller=require(_0xab96('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xab96('0x9')]);router[_0xab96('0xa')](_0xab96('0xb'),auth[_0xab96('0xc')](),controller[_0xab96('0xd')]);router[_0xab96('0xa')]('/:id',auth[_0xab96('0xc')](),controller[_0xab96('0xe')]);router['post']('/',auth[_0xab96('0xc')](),controller['create']);router[_0xab96('0xf')](_0xab96('0x10'),auth[_0xab96('0xc')](),controller[_0xab96('0x11')]);router[_0xab96('0x12')](_0xab96('0x10'),auth[_0xab96('0xc')](),controller[_0xab96('0x13')]);module[_0xab96('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 8af9c81..5259bf9 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 _0x9990=['DATE','BOOLEAN','exports','STRING'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0x9990,0xf6));var _0x0999=function(_0x46ac4d,_0x46fa04){_0x46ac4d=_0x46ac4d-0x0;var _0x2cb141=_0x9990[_0x46ac4d];return _0x2cb141;};'use strict';var Sequelize=require('sequelize');module[_0x0999('0x0')]={'network':{'type':Sequelize[_0x0999('0x1')]},'network_script':{'type':Sequelize[_0x0999('0x1')]},'request':{'type':Sequelize[_0x0999('0x1')]},'channel':{'type':Sequelize[_0x0999('0x1')]},'language':{'type':Sequelize[_0x0999('0x1')]},'type':{'type':Sequelize[_0x0999('0x1')]},'uniqueid':{'type':Sequelize[_0x0999('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0999('0x1')]},'calleridname':{'type':Sequelize[_0x0999('0x1')]},'callingpres':{'type':Sequelize[_0x0999('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x0999('0x1')]},'callingtns':{'type':Sequelize[_0x0999('0x1')]},'dnid':{'type':Sequelize[_0x0999('0x1')]},'rdnis':{'type':Sequelize[_0x0999('0x1')]},'context':{'type':Sequelize[_0x0999('0x1')]},'extension':{'type':Sequelize[_0x0999('0x1')]},'priority':{'type':Sequelize[_0x0999('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0999('0x1')]},'threadid':{'type':Sequelize[_0x0999('0x1')]},'project_name':{'type':Sequelize[_0x0999('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0999('0x2')]},'bot':{'type':Sequelize[_0x0999('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1da1=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1da1,0x1a4));var _0x11da=function(_0x46e094,_0x194c56){_0x46e094=_0x46e094-0x0;var _0x56f44a=_0x1da1[_0x46e094];return _0x56f44a;};'use strict';var Sequelize=require(_0x11da('0x0'));module[_0x11da('0x1')]={'network':{'type':Sequelize[_0x11da('0x2')]},'network_script':{'type':Sequelize[_0x11da('0x2')]},'request':{'type':Sequelize[_0x11da('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x11da('0x2')]},'uniqueid':{'type':Sequelize[_0x11da('0x2')]},'version':{'type':Sequelize[_0x11da('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x11da('0x2')]},'callingpres':{'type':Sequelize[_0x11da('0x2')]},'callingani2':{'type':Sequelize[_0x11da('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x11da('0x2')]},'rdnis':{'type':Sequelize[_0x11da('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x11da('0x2')]},'priority':{'type':Sequelize[_0x11da('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x11da('0x2')]},'threadid':{'type':Sequelize[_0x11da('0x2')]},'project_name':{'type':Sequelize[_0x11da('0x2')]},'joinAt':{'type':Sequelize[_0x11da('0x3')]},'leaveAt':{'type':Sequelize[_0x11da('0x3')]},'bot':{'type':Sequelize[_0x11da('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 39b966c..501dd63 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 _0xbe76=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','SquareReport','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','day','merge','filter','map','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','update','describe'];(function(_0x7f8dde,_0x4622ba){var _0x566522=function(_0x4baf40){while(--_0x4baf40){_0x7f8dde['push'](_0x7f8dde['shift']());}};_0x566522(++_0x4622ba);}(_0xbe76,0x1a4));var _0x6be7=function(_0x44ea17,_0x422059){_0x44ea17=_0x44ea17-0x0;var _0x1d8af1=_0xbe76[_0x44ea17];return _0x1d8af1;};'use strict';var pdf=require(_0x6be7('0x0'));var emlformat=require(_0x6be7('0x1'));var rimraf=require(_0x6be7('0x2'));var zipdir=require(_0x6be7('0x3'));var jsonpatch=require(_0x6be7('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6be7('0x5'));var path=require(_0x6be7('0x6'));var sox=require(_0x6be7('0x7'));var csv=require('to-csv');var ejs=require(_0x6be7('0x8'));var fs=require('fs');var _=require(_0x6be7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6be7('0xa'));var deskjs=require(_0x6be7('0xb'));var toCsv=require(_0x6be7('0xc'));var querystring=require(_0x6be7('0xd'));var Papa=require(_0x6be7('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x6be7('0xf'));var utils=require('../../config/utils');var config=require(_0x6be7('0x10'));var db=require(_0x6be7('0x11'))['db'];function respondWithStatusCode(_0x36ca4f,_0x13532f){_0x13532f=_0x13532f||0xcc;return function(_0x58b84c){if(_0x58b84c){return _0x36ca4f[_0x6be7('0x12')](_0x13532f);}return _0x36ca4f[_0x6be7('0x13')](_0x13532f)['end']();};}function respondWithResult(_0x287789,_0x135e9c){_0x135e9c=_0x135e9c||0xc8;return function(_0x277d27){if(_0x277d27){return _0x287789[_0x6be7('0x13')](_0x135e9c)[_0x6be7('0x14')](_0x277d27);}};}function respondWithFilteredResult(_0x17fb5a,_0x54b04a){return function(_0x52745f){if(_0x52745f){var _0x22f89a=_0x52745f[_0x6be7('0x15')],_0x37e3e0=_0x54b04a['offset'],_0x2947af=_0x54b04a['offset']+_0x54b04a['limit'],_0x4e4a1a;if(_0x2947af>=_0x22f89a){_0x2947af=_0x22f89a;_0x4e4a1a=0xc8;}else{_0x4e4a1a=0xce;}_0x17fb5a[_0x6be7('0x13')](_0x4e4a1a);return _0x17fb5a[_0x6be7('0x16')](_0x6be7('0x17'),_0x37e3e0+'-'+_0x2947af+'/'+_0x22f89a)['json'](_0x52745f);}return null;};}function patchUpdates(_0x434b7a){return function(_0x1bfd29){try{jsonpatch[_0x6be7('0x18')](_0x1bfd29,_0x434b7a,!![]);}catch(_0x188e4a){return BPromise[_0x6be7('0x19')](_0x188e4a);}return _0x1bfd29[_0x6be7('0x1a')]();};}function saveUpdates(_0x2f2cfd,_0x43b1ba){return function(_0x3fda8c){if(_0x3fda8c){return _0x3fda8c['update'](_0x2f2cfd)[_0x6be7('0x1b')](function(_0x2f41d5){return _0x2f41d5;});}return null;};}function removeEntity(_0x162699,_0x469d06){return function(_0x4c2312){if(_0x4c2312){return _0x4c2312[_0x6be7('0x1c')]()[_0x6be7('0x1b')](function(){_0x162699[_0x6be7('0x13')](0xcc)[_0x6be7('0x1d')]();});}};}function handleEntityNotFound(_0x917657,_0x357f8b){return function(_0x209e7c){if(!_0x209e7c){_0x917657[_0x6be7('0x12')](0x194);}return _0x209e7c;};}function handleError(_0x575cda,_0x1afc0b){_0x1afc0b=_0x1afc0b||0x1f4;return function(_0x18a31d){logger[_0x6be7('0x1e')](_0x18a31d[_0x6be7('0x1f')]);if(_0x18a31d['name']){delete _0x18a31d[_0x6be7('0x20')];}_0x575cda[_0x6be7('0x13')](_0x1afc0b)[_0x6be7('0x21')](_0x18a31d);};}exports[_0x6be7('0x22')]=function(_0x5c381f,_0x2d3f79){var _0x6b0f81={},_0x35a185={},_0xabe3ce={'count':0x0,'rows':[]};var _0x389877=db[_0x6be7('0x23')]['rawAttributes'];_0x35a185[_0x6be7('0x24')]=_[_0x6be7('0x25')](_0x389877);var _0x1bf7ad={'dateStart':_0x5c381f[_0x6be7('0x26')][_0x6be7('0x27')],'dateEnd':_0x5c381f[_0x6be7('0x26')][_0x6be7('0x28')]};delete _0x5c381f['query'][_0x6be7('0x27')];delete _0x5c381f['query'][_0x6be7('0x28')];_0x35a185[_0x6be7('0x26')]=_['keys'](_0x5c381f[_0x6be7('0x26')]);_0x35a185[_0x6be7('0x29')]=_[_0x6be7('0x2a')](_0x35a185[_0x6be7('0x24')],_0x35a185[_0x6be7('0x26')]);_0x6b0f81[_0x6be7('0x2b')]=_[_0x6be7('0x2a')](_0x35a185[_0x6be7('0x24')],qs[_0x6be7('0x2c')](_0x5c381f[_0x6be7('0x26')]['fields']));_0x6b0f81[_0x6be7('0x2b')]=_0x6b0f81[_0x6be7('0x2b')][_0x6be7('0x2d')]?_0x6b0f81[_0x6be7('0x2b')]:_0x35a185[_0x6be7('0x24')];if(!_0x5c381f[_0x6be7('0x26')][_0x6be7('0x2e')](_0x6be7('0x2f'))){_0x6b0f81[_0x6be7('0x30')]=qs[_0x6be7('0x30')](_0x5c381f[_0x6be7('0x26')][_0x6be7('0x30')]);_0x6b0f81['offset']=qs[_0x6be7('0x31')](_0x5c381f[_0x6be7('0x26')][_0x6be7('0x31')]);}_0x6b0f81['order']=qs[_0x6be7('0x32')](_0x5c381f[_0x6be7('0x26')]['sort']);_0x6b0f81[_0x6be7('0x33')]=qs['filters'](_[_0x6be7('0x34')](_0x5c381f[_0x6be7('0x26')],_0x35a185[_0x6be7('0x29')]));if(_0x1bf7ad[_0x6be7('0x27')]){if(_0x1bf7ad[_0x6be7('0x28')]){_0x1bf7ad['dateEnd']=moment(_0x1bf7ad[_0x6be7('0x28')])['add'](0x1,_0x6be7('0x35'));}else{_0x1bf7ad['dateEnd']=moment(_0x1bf7ad[_0x6be7('0x27')])['add'](0x1,_0x6be7('0x35'));}_[_0x6be7('0x36')](_0x6b0f81['where'],{'createdAt':{'$gte':_0x1bf7ad[_0x6be7('0x27')],'$lte':_0x1bf7ad[_0x6be7('0x28')]}});}if(_0x5c381f[_0x6be7('0x26')][_0x6be7('0x37')]){_0x6b0f81[_0x6be7('0x33')]=_[_0x6be7('0x36')](_0x6b0f81['where'],{'$or':_[_0x6be7('0x38')](_0x6b0f81['attributes'],function(_0xfb3769){var _0x2d63c0={};_0x2d63c0[_0xfb3769]={'$like':'%'+_0x5c381f[_0x6be7('0x26')][_0x6be7('0x37')]+'%'};return _0x2d63c0;})});}_0x6b0f81=_['merge']({},_0x6b0f81,_0x5c381f[_0x6be7('0x39')]);var _0x5ff44a={'where':_0x6b0f81['where']};return db['SquareReport'][_0x6be7('0x15')](_0x5ff44a)[_0x6be7('0x1b')](function(_0x1311f6){_0xabe3ce[_0x6be7('0x15')]=_0x1311f6;if(_0x5c381f[_0x6be7('0x26')][_0x6be7('0x3a')]){_0x6b0f81[_0x6be7('0x3b')]=[{'all':!![]}];}return db[_0x6be7('0x23')][_0x6be7('0x3c')](_0x6b0f81);})[_0x6be7('0x1b')](function(_0x21ecf9){_0xabe3ce[_0x6be7('0x3d')]=_0x21ecf9;return _0xabe3ce;})[_0x6be7('0x1b')](respondWithFilteredResult(_0x2d3f79,_0x6b0f81))['catch'](handleError(_0x2d3f79,null));};exports['show']=function(_0x4829ef,_0x5ab000){var _0x142e42={'raw':!![],'where':{'id':_0x4829ef[_0x6be7('0x3e')]['id']}},_0x419cb2={};_0x419cb2['model']=_[_0x6be7('0x25')](db['SquareReport'][_0x6be7('0x3f')]);_0x419cb2[_0x6be7('0x26')]=_[_0x6be7('0x25')](_0x4829ef[_0x6be7('0x26')]);_0x419cb2[_0x6be7('0x29')]=_[_0x6be7('0x2a')](_0x419cb2['model'],_0x419cb2[_0x6be7('0x26')]);_0x142e42[_0x6be7('0x2b')]=_[_0x6be7('0x2a')](_0x419cb2[_0x6be7('0x24')],qs[_0x6be7('0x2c')](_0x4829ef[_0x6be7('0x26')][_0x6be7('0x2c')]));_0x142e42['attributes']=_0x142e42[_0x6be7('0x2b')]['length']?_0x142e42[_0x6be7('0x2b')]:_0x419cb2['model'];if(_0x4829ef[_0x6be7('0x26')][_0x6be7('0x3a')]){_0x142e42[_0x6be7('0x3b')]=[{'all':!![]}];}_0x142e42=_[_0x6be7('0x36')]({},_0x142e42,_0x4829ef[_0x6be7('0x39')]);return db[_0x6be7('0x23')][_0x6be7('0x40')](_0x142e42)['then'](handleEntityNotFound(_0x5ab000,null))[_0x6be7('0x1b')](respondWithResult(_0x5ab000,null))[_0x6be7('0x41')](handleError(_0x5ab000,null));};exports[_0x6be7('0x42')]=function(_0x3ccc51,_0x2f87c0){return db[_0x6be7('0x23')][_0x6be7('0x42')](_0x3ccc51[_0x6be7('0x43')],{})[_0x6be7('0x1b')](respondWithResult(_0x2f87c0,0xc9))[_0x6be7('0x41')](handleError(_0x2f87c0,null));};exports[_0x6be7('0x44')]=function(_0x41f505,_0x2106b3){if(_0x41f505['body']['id']){delete _0x41f505[_0x6be7('0x43')]['id'];}return db['SquareReport'][_0x6be7('0x40')]({'where':{'id':_0x41f505[_0x6be7('0x3e')]['id']}})[_0x6be7('0x1b')](handleEntityNotFound(_0x2106b3,null))[_0x6be7('0x1b')](saveUpdates(_0x41f505[_0x6be7('0x43')],null))['then'](respondWithResult(_0x2106b3,null))[_0x6be7('0x41')](handleError(_0x2106b3,null));};exports[_0x6be7('0x1c')]=function(_0x16e654,_0x36065e){return db[_0x6be7('0x23')][_0x6be7('0x40')]({'where':{'id':_0x16e654[_0x6be7('0x3e')]['id']}})[_0x6be7('0x1b')](handleEntityNotFound(_0x36065e,null))['then'](removeEntity(_0x36065e,null))[_0x6be7('0x41')](handleError(_0x36065e,null));};exports[_0x6be7('0x45')]=function(_0x4c626f,_0x177fe3){return db[_0x6be7('0x23')][_0x6be7('0x45')]()['then'](respondWithResult(_0x177fe3,null))[_0x6be7('0x41')](handleError(_0x177fe3,null));}; \ No newline at end of file +var _0x8b42=['hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','params','length','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','SquareReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields'];(function(_0x350b00,_0x36bf38){var _0x288cbf=function(_0x5c9eef){while(--_0x5c9eef){_0x350b00['push'](_0x350b00['shift']());}};_0x288cbf(++_0x36bf38);}(_0x8b42,0x1c7));var _0x28b4=function(_0x3b43f1,_0xd62942){_0x3b43f1=_0x3b43f1-0x0;var _0x3d35bd=_0x8b42[_0x3b43f1];return _0x3d35bd;};'use strict';var pdf=require(_0x28b4('0x0'));var emlformat=require(_0x28b4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x28b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28b4('0x3'));var moment=require(_0x28b4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x28b4('0x5'));var util=require('util');var path=require(_0x28b4('0x6'));var sox=require(_0x28b4('0x7'));var csv=require(_0x28b4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x28b4('0x9'));var crypto=require(_0x28b4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x28b4('0xb'));var toCsv=require(_0x28b4('0x8'));var querystring=require(_0x28b4('0xc'));var Papa=require(_0x28b4('0xd'));var Redis=require(_0x28b4('0xe'));var qs=require(_0x28b4('0xf'));var logger=require(_0x28b4('0x10'))(_0x28b4('0x11'));var utils=require('../../config/utils');var config=require(_0x28b4('0x12'));var db=require(_0x28b4('0x13'))['db'];function respondWithStatusCode(_0x36dd20,_0x2a528c){_0x2a528c=_0x2a528c||0xcc;return function(_0x1141f6){if(_0x1141f6){return _0x36dd20[_0x28b4('0x14')](_0x2a528c);}return _0x36dd20[_0x28b4('0x15')](_0x2a528c)[_0x28b4('0x16')]();};}function respondWithResult(_0x3bb7c3,_0x5c6e81){_0x5c6e81=_0x5c6e81||0xc8;return function(_0x4c421c){if(_0x4c421c){return _0x3bb7c3['status'](_0x5c6e81)[_0x28b4('0x17')](_0x4c421c);}};}function respondWithFilteredResult(_0x175375,_0x270b78){return function(_0x1ac63c){if(_0x1ac63c){var _0x58d7d=_0x1ac63c[_0x28b4('0x18')],_0x16a426=_0x270b78['offset'],_0x471493=_0x270b78[_0x28b4('0x19')]+_0x270b78['limit'],_0x12a7e6;if(_0x471493>=_0x58d7d){_0x471493=_0x58d7d;_0x12a7e6=0xc8;}else{_0x12a7e6=0xce;}_0x175375[_0x28b4('0x15')](_0x12a7e6);return _0x175375[_0x28b4('0x1a')]('Content-Range',_0x16a426+'-'+_0x471493+'/'+_0x58d7d)[_0x28b4('0x17')](_0x1ac63c);}return null;};}function patchUpdates(_0x2f3a43){return function(_0x84fc34){try{jsonpatch[_0x28b4('0x1b')](_0x84fc34,_0x2f3a43,!![]);}catch(_0x305086){return BPromise[_0x28b4('0x1c')](_0x305086);}return _0x84fc34[_0x28b4('0x1d')]();};}function saveUpdates(_0x49780f,_0x1ab807){return function(_0x51f198){if(_0x51f198){return _0x51f198[_0x28b4('0x1e')](_0x49780f)['then'](function(_0x1192e9){return _0x1192e9;});}return null;};}function removeEntity(_0x1da263,_0x36dd24){return function(_0x36fd61){if(_0x36fd61){return _0x36fd61[_0x28b4('0x1f')]()[_0x28b4('0x20')](function(){_0x1da263['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x274abe,_0x50f821){return function(_0xf6aa44){if(!_0xf6aa44){_0x274abe[_0x28b4('0x14')](0x194);}return _0xf6aa44;};}function handleError(_0x2caa61,_0x4ddc0f){_0x4ddc0f=_0x4ddc0f||0x1f4;return function(_0x5f5b01){logger[_0x28b4('0x21')](_0x5f5b01[_0x28b4('0x22')]);if(_0x5f5b01[_0x28b4('0x23')]){delete _0x5f5b01['name'];}_0x2caa61[_0x28b4('0x15')](_0x4ddc0f)[_0x28b4('0x24')](_0x5f5b01);};}exports[_0x28b4('0x25')]=function(_0x1d86de,_0x5d687f){var _0x213c9d={},_0x590e1d={},_0x5ec2e9={'count':0x0,'rows':[]};var _0x548896=db[_0x28b4('0x26')][_0x28b4('0x27')];_0x590e1d[_0x28b4('0x28')]=_[_0x28b4('0x29')](_0x548896);var _0x4ae646={'dateStart':_0x1d86de[_0x28b4('0x2a')]['dateStart'],'dateEnd':_0x1d86de['query'][_0x28b4('0x2b')]};delete _0x1d86de[_0x28b4('0x2a')][_0x28b4('0x2c')];delete _0x1d86de[_0x28b4('0x2a')]['dateEnd'];_0x590e1d[_0x28b4('0x2a')]=_[_0x28b4('0x29')](_0x1d86de[_0x28b4('0x2a')]);_0x590e1d[_0x28b4('0x2d')]=_[_0x28b4('0x2e')](_0x590e1d[_0x28b4('0x28')],_0x590e1d[_0x28b4('0x2a')]);_0x213c9d[_0x28b4('0x2f')]=_[_0x28b4('0x2e')](_0x590e1d['model'],qs['fields'](_0x1d86de[_0x28b4('0x2a')][_0x28b4('0x30')]));_0x213c9d['attributes']=_0x213c9d[_0x28b4('0x2f')]['length']?_0x213c9d[_0x28b4('0x2f')]:_0x590e1d[_0x28b4('0x28')];if(!_0x1d86de[_0x28b4('0x2a')][_0x28b4('0x31')](_0x28b4('0x32'))){_0x213c9d[_0x28b4('0x33')]=qs['limit'](_0x1d86de[_0x28b4('0x2a')][_0x28b4('0x33')]);_0x213c9d['offset']=qs['offset'](_0x1d86de[_0x28b4('0x2a')]['offset']);}_0x213c9d[_0x28b4('0x34')]=qs[_0x28b4('0x35')](_0x1d86de[_0x28b4('0x2a')][_0x28b4('0x35')]);_0x213c9d[_0x28b4('0x36')]=qs['filters'](_[_0x28b4('0x37')](_0x1d86de[_0x28b4('0x2a')],_0x590e1d['filters']));if(_0x4ae646[_0x28b4('0x2c')]){if(_0x4ae646[_0x28b4('0x2b')]){_0x4ae646['dateEnd']=moment(_0x4ae646[_0x28b4('0x2b')])[_0x28b4('0x38')](0x1,_0x28b4('0x39'));}else{_0x4ae646[_0x28b4('0x2b')]=moment(_0x4ae646['dateStart'])[_0x28b4('0x38')](0x1,_0x28b4('0x39'));}_[_0x28b4('0x3a')](_0x213c9d['where'],{'createdAt':{'$gte':_0x4ae646['dateStart'],'$lte':_0x4ae646[_0x28b4('0x2b')]}});}if(_0x1d86de['query'][_0x28b4('0x3b')]){_0x213c9d[_0x28b4('0x36')]=_[_0x28b4('0x3a')](_0x213c9d[_0x28b4('0x36')],{'$or':_[_0x28b4('0x3c')](_0x213c9d[_0x28b4('0x2f')],function(_0x28fc5f){var _0x493248={};_0x493248[_0x28fc5f]={'$like':'%'+_0x1d86de['query']['filter']+'%'};return _0x493248;})});}_0x213c9d=_[_0x28b4('0x3a')]({},_0x213c9d,_0x1d86de[_0x28b4('0x3d')]);var _0x380619={'where':_0x213c9d[_0x28b4('0x36')]};return db[_0x28b4('0x26')]['count'](_0x380619)[_0x28b4('0x20')](function(_0x34d72c){_0x5ec2e9[_0x28b4('0x18')]=_0x34d72c;if(_0x1d86de[_0x28b4('0x2a')][_0x28b4('0x3e')]){_0x213c9d[_0x28b4('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0x28b4('0x40')](_0x213c9d);})['then'](function(_0x3e3f99){_0x5ec2e9['rows']=_0x3e3f99;return _0x5ec2e9;})[_0x28b4('0x20')](respondWithFilteredResult(_0x5d687f,_0x213c9d))['catch'](handleError(_0x5d687f,null));};exports['show']=function(_0x34eeb9,_0x397918){var _0x17579d={'raw':!![],'where':{'id':_0x34eeb9[_0x28b4('0x41')]['id']}},_0x479143={};_0x479143['model']=_[_0x28b4('0x29')](db['SquareReport']['rawAttributes']);_0x479143[_0x28b4('0x2a')]=_['keys'](_0x34eeb9[_0x28b4('0x2a')]);_0x479143[_0x28b4('0x2d')]=_[_0x28b4('0x2e')](_0x479143[_0x28b4('0x28')],_0x479143[_0x28b4('0x2a')]);_0x17579d[_0x28b4('0x2f')]=_[_0x28b4('0x2e')](_0x479143[_0x28b4('0x28')],qs['fields'](_0x34eeb9['query'][_0x28b4('0x30')]));_0x17579d[_0x28b4('0x2f')]=_0x17579d[_0x28b4('0x2f')][_0x28b4('0x42')]?_0x17579d[_0x28b4('0x2f')]:_0x479143['model'];if(_0x34eeb9[_0x28b4('0x2a')][_0x28b4('0x3e')]){_0x17579d['include']=[{'all':!![]}];}_0x17579d=_[_0x28b4('0x3a')]({},_0x17579d,_0x34eeb9[_0x28b4('0x3d')]);return db['SquareReport'][_0x28b4('0x43')](_0x17579d)[_0x28b4('0x20')](handleEntityNotFound(_0x397918,null))[_0x28b4('0x20')](respondWithResult(_0x397918,null))[_0x28b4('0x44')](handleError(_0x397918,null));};exports[_0x28b4('0x45')]=function(_0x4eac94,_0x3c8afd){return db[_0x28b4('0x26')][_0x28b4('0x45')](_0x4eac94[_0x28b4('0x46')],{})['then'](respondWithResult(_0x3c8afd,0xc9))[_0x28b4('0x44')](handleError(_0x3c8afd,null));};exports['update']=function(_0x1e4d3b,_0x2cd009){if(_0x1e4d3b[_0x28b4('0x46')]['id']){delete _0x1e4d3b[_0x28b4('0x46')]['id'];}return db[_0x28b4('0x26')][_0x28b4('0x43')]({'where':{'id':_0x1e4d3b[_0x28b4('0x41')]['id']}})[_0x28b4('0x20')](handleEntityNotFound(_0x2cd009,null))[_0x28b4('0x20')](saveUpdates(_0x1e4d3b[_0x28b4('0x46')],null))[_0x28b4('0x20')](respondWithResult(_0x2cd009,null))['catch'](handleError(_0x2cd009,null));};exports[_0x28b4('0x1f')]=function(_0x4447d6,_0x84ae11){return db['SquareReport'][_0x28b4('0x43')]({'where':{'id':_0x4447d6['params']['id']}})[_0x28b4('0x20')](handleEntityNotFound(_0x84ae11,null))['then'](removeEntity(_0x84ae11,null))['catch'](handleError(_0x84ae11,null));};exports[_0x28b4('0x47')]=function(_0x5add68,_0x3be811){return db[_0x28b4('0x26')][_0x28b4('0x47')]()[_0x28b4('0x20')](respondWithResult(_0x3be811,null))[_0x28b4('0x44')](handleError(_0x3be811,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 05e2e8e..9998a62 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 _0x5c76=['moment','bluebird','request-promise','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5c76,0x169));var _0x65c7=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x5c76[_0x1b3564];return _0x504069;};'use strict';var _=require(_0x65c7('0x0'));var util=require(_0x65c7('0x1'));var logger=require(_0x65c7('0x2'))('api');var moment=require(_0x65c7('0x3'));var BPromise=require(_0x65c7('0x4'));var rp=require(_0x65c7('0x5'));var attributes=require(_0x65c7('0x6'));module[_0x65c7('0x7')]=function(_0x503a62,_0x1f8615){return _0x503a62[_0x65c7('0x8')](_0x65c7('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x65c7('0xa'),'fields':[_0x65c7('0xb'),_0x65c7('0xc')]},{'name':'leaveAt','fields':[_0x65c7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x467e=['exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','request-promise','./squareReport.attributes'];(function(_0x1c493f,_0x3a99fa){var _0x4c7836=function(_0x225868){while(--_0x225868){_0x1c493f['push'](_0x1c493f['shift']());}};_0x4c7836(++_0x3a99fa);}(_0x467e,0x1b6));var _0xe467=function(_0x16bfae,_0x36ed25){_0x16bfae=_0x16bfae-0x0;var _0x3870f5=_0x467e[_0x16bfae];return _0x3870f5;};'use strict';var _=require(_0xe467('0x0'));var util=require(_0xe467('0x1'));var logger=require(_0xe467('0x2'))('api');var moment=require(_0xe467('0x3'));var BPromise=require('bluebird');var rp=require(_0xe467('0x4'));var attributes=require(_0xe467('0x5'));module[_0xe467('0x6')]=function(_0x5aed20,_0x45d58d){return _0x5aed20['define'](_0xe467('0x7'),attributes,{'tableName':_0xe467('0x8'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xe467('0x9'),_0xe467('0xa')]},{'name':_0xe467('0xb'),'fields':[_0xe467('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d24b6b9..e7fe0b8 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 _0x6c5c=['request','then','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','update','where','attributes','limit','UpdateSquareReport','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x82d2f5,_0x1c6abb){var _0x1be607=function(_0x633eac){while(--_0x633eac){_0x82d2f5['push'](_0x82d2f5['shift']());}};_0x1be607(++_0x1c6abb);}(_0x6c5c,0x124));var _0xc6c5=function(_0x438cf5,_0x3fe1b8){_0x438cf5=_0x438cf5-0x0;var _0x411240=_0x6c5c[_0x438cf5];return _0x411240;};'use strict';var _=require('lodash');var util=require(_0xc6c5('0x0'));var moment=require('moment');var BPromise=require(_0xc6c5('0x1'));var rs=require(_0xc6c5('0x2'));var fs=require('fs');var Redis=require(_0xc6c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6c5('0x4'));var logger=require('../../config/logger')(_0xc6c5('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6c5('0x6'));var client=jayson[_0xc6c5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c6533,_0x4d923d,_0xe77741){return new BPromise(function(_0x22c050,_0x2e9d7c){return client[_0xc6c5('0x8')](_0x2c6533,_0xe77741)[_0xc6c5('0x9')](function(_0x184fb5){logger[_0xc6c5('0xa')]('SquareReport,\x20%s,\x20%s',_0x4d923d,'request\x20sent');logger[_0xc6c5('0xb')](_0xc6c5('0xc'),_0x4d923d,_0xc6c5('0xd'),JSON[_0xc6c5('0xe')](_0x184fb5));if(_0x184fb5[_0xc6c5('0xf')]){if(_0x184fb5[_0xc6c5('0xf')]['code']===0x1f4){logger['error'](_0xc6c5('0x10'),_0x4d923d,_0x184fb5[_0xc6c5('0xf')][_0xc6c5('0x11')]);return _0x2e9d7c(_0x184fb5[_0xc6c5('0xf')]['message']);}logger[_0xc6c5('0xf')](_0xc6c5('0x10'),_0x4d923d,_0x184fb5['error'][_0xc6c5('0x11')]);return _0x22c050(_0x184fb5[_0xc6c5('0xf')][_0xc6c5('0x11')]);}else{logger[_0xc6c5('0xa')](_0xc6c5('0x10'),_0x4d923d,_0xc6c5('0xd'));_0x22c050(_0x184fb5[_0xc6c5('0x12')][_0xc6c5('0x11')]);}})[_0xc6c5('0x13')](function(_0x276a21){logger[_0xc6c5('0xf')](_0xc6c5('0x10'),_0x4d923d,_0x276a21);_0x2e9d7c(_0x276a21);});});}exports[_0xc6c5('0x14')]=function(_0x612950){var _0x2f5792=this;return new Promise(function(_0x4bce02,_0x3cefab){return db[_0xc6c5('0x15')]['create'](_0x612950[_0xc6c5('0x16')],{'raw':_0x612950['options']?_0x612950[_0xc6c5('0x17')][_0xc6c5('0x18')]===undefined?!![]:![]:!![]})[_0xc6c5('0x9')](function(_0x50af85){logger[_0xc6c5('0xa')](_0xc6c5('0x14'),_0x612950);logger[_0xc6c5('0xb')](_0xc6c5('0x14'),_0x612950,JSON[_0xc6c5('0xe')](_0x50af85));_0x4bce02(_0x50af85);})[_0xc6c5('0x13')](function(_0x238444){logger[_0xc6c5('0xf')]('CreateSquareReport',_0x238444[_0xc6c5('0x11')],_0x612950);_0x3cefab(_0x2f5792[_0xc6c5('0xf')](0x1f4,_0x238444['message']));});});};exports['UpdateSquareReport']=function(_0x2ca74b){var _0x3aac0a=this;return new Promise(function(_0x4701f6,_0x4a39eb){return db[_0xc6c5('0x15')][_0xc6c5('0x19')](_0x2ca74b['body'],{'raw':_0x2ca74b[_0xc6c5('0x17')]?_0x2ca74b['options'][_0xc6c5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca74b[_0xc6c5('0x17')]?_0x2ca74b[_0xc6c5('0x17')][_0xc6c5('0x1a')]||null:null,'attributes':_0x2ca74b['options']?_0x2ca74b[_0xc6c5('0x17')][_0xc6c5('0x1b')]||null:null,'limit':_0x2ca74b[_0xc6c5('0x17')]?_0x2ca74b[_0xc6c5('0x17')][_0xc6c5('0x1c')]||null:null})['then'](function(_0x53d034){logger['info'](_0xc6c5('0x1d'),_0x2ca74b);logger[_0xc6c5('0xb')]('UpdateSquareReport',_0x2ca74b,JSON[_0xc6c5('0xe')](_0x53d034));_0x4701f6(_0x53d034);})['catch'](function(_0x9854ad){logger['error'](_0xc6c5('0x1d'),_0x9854ad['message'],_0x2ca74b);_0x4a39eb(_0x3aac0a[_0xc6c5('0xf')](0x1f4,_0x9854ad['message']));});});}; \ No newline at end of file +var _0xdcff=['attributes','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateSquareReport','SquareReport','body','raw','catch','UpdateSquareReport','update','options','where'];(function(_0x36f284,_0x24cbd1){var _0x4ea099=function(_0xea729e){while(--_0xea729e){_0x36f284['push'](_0x36f284['shift']());}};_0x4ea099(++_0x24cbd1);}(_0xdcff,0x15d));var _0xfdcf=function(_0x11be91,_0x32e2ba){_0x11be91=_0x11be91-0x0;var _0xe96fdb=_0xdcff[_0x11be91];return _0xe96fdb;};'use strict';var _=require(_0xfdcf('0x0'));var util=require(_0xfdcf('0x1'));var moment=require('moment');var BPromise=require(_0xfdcf('0x2'));var rs=require(_0xfdcf('0x3'));var fs=require('fs');var Redis=require(_0xfdcf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfdcf('0x5'))(_0xfdcf('0x6'));var config=require(_0xfdcf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfdcf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x350818,_0x2495d7,_0x1a91d0){return new BPromise(function(_0x3ed80c,_0x5a106b){return client['request'](_0x350818,_0x1a91d0)[_0xfdcf('0x9')](function(_0x282536){logger[_0xfdcf('0xa')](_0xfdcf('0xb'),_0x2495d7,'request\x20sent');logger[_0xfdcf('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x2495d7,_0xfdcf('0xd'),JSON[_0xfdcf('0xe')](_0x282536));if(_0x282536[_0xfdcf('0xf')]){if(_0x282536[_0xfdcf('0xf')][_0xfdcf('0x10')]===0x1f4){logger[_0xfdcf('0xf')]('SquareReport,\x20%s,\x20%s',_0x2495d7,_0x282536['error'][_0xfdcf('0x11')]);return _0x5a106b(_0x282536[_0xfdcf('0xf')]['message']);}logger[_0xfdcf('0xf')](_0xfdcf('0xb'),_0x2495d7,_0x282536['error'][_0xfdcf('0x11')]);return _0x3ed80c(_0x282536[_0xfdcf('0xf')]['message']);}else{logger[_0xfdcf('0xa')]('SquareReport,\x20%s,\x20%s',_0x2495d7,_0xfdcf('0xd'));_0x3ed80c(_0x282536[_0xfdcf('0x12')][_0xfdcf('0x11')]);}})['catch'](function(_0x1a9b03){logger[_0xfdcf('0xf')](_0xfdcf('0xb'),_0x2495d7,_0x1a9b03);_0x5a106b(_0x1a9b03);});});}exports[_0xfdcf('0x13')]=function(_0x5c04a2){var _0x4b5661=this;return new Promise(function(_0x475ee4,_0x136ea1){return db[_0xfdcf('0x14')]['create'](_0x5c04a2[_0xfdcf('0x15')],{'raw':_0x5c04a2['options']?_0x5c04a2['options'][_0xfdcf('0x16')]===undefined?!![]:![]:!![]})[_0xfdcf('0x9')](function(_0x35237b){logger[_0xfdcf('0xa')](_0xfdcf('0x13'),_0x5c04a2);logger[_0xfdcf('0xc')]('CreateSquareReport',_0x5c04a2,JSON[_0xfdcf('0xe')](_0x35237b));_0x475ee4(_0x35237b);})[_0xfdcf('0x17')](function(_0x4ddde9){logger[_0xfdcf('0xf')](_0xfdcf('0x13'),_0x4ddde9[_0xfdcf('0x11')],_0x5c04a2);_0x136ea1(_0x4b5661[_0xfdcf('0xf')](0x1f4,_0x4ddde9[_0xfdcf('0x11')]));});});};exports[_0xfdcf('0x18')]=function(_0x14f78e){var _0x573224=this;return new Promise(function(_0x236f5a,_0x45bd2f){return db['SquareReport'][_0xfdcf('0x19')](_0x14f78e[_0xfdcf('0x15')],{'raw':_0x14f78e[_0xfdcf('0x1a')]?_0x14f78e['options'][_0xfdcf('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14f78e['options']?_0x14f78e['options'][_0xfdcf('0x1b')]||null:null,'attributes':_0x14f78e['options']?_0x14f78e[_0xfdcf('0x1a')][_0xfdcf('0x1c')]||null:null,'limit':_0x14f78e[_0xfdcf('0x1a')]?_0x14f78e[_0xfdcf('0x1a')]['limit']||null:null})[_0xfdcf('0x9')](function(_0x389cb2){logger[_0xfdcf('0xa')](_0xfdcf('0x18'),_0x14f78e);logger[_0xfdcf('0xc')]('UpdateSquareReport',_0x14f78e,JSON[_0xfdcf('0xe')](_0x389cb2));_0x236f5a(_0x389cb2);})['catch'](function(_0x224ea2){logger[_0xfdcf('0xf')](_0xfdcf('0x18'),_0x224ea2[_0xfdcf('0x11')],_0x14f78e);_0x45bd2f(_0x573224[_0xfdcf('0xf')](0x1f4,_0x224ea2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b2d3502..1e2b68d 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 _0x9308=['post','create','put','isAuthenticated','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','get','/describe','/:id','show'];(function(_0x46b7ed,_0x211e80){var _0x25ffb4=function(_0x95e398){while(--_0x95e398){_0x46b7ed['push'](_0x46b7ed['shift']());}};_0x25ffb4(++_0x211e80);}(_0x9308,0x139));var _0x8930=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9308[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x8930('0x0'));var util=require(_0x8930('0x1'));var path=require(_0x8930('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8930('0x3')]();var auth=require(_0x8930('0x4'));var interaction=require(_0x8930('0x5'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8930('0x6')](_0x8930('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x8930('0x6')](_0x8930('0x8'),auth['isAuthenticated'](),controller[_0x8930('0x9')]);router[_0x8930('0xa')]('/',auth['isAuthenticated'](),controller[_0x8930('0xb')]);router[_0x8930('0xc')]('/:id',auth[_0x8930('0xd')](),controller[_0x8930('0xe')]);router[_0x8930('0xf')]('/:id',auth[_0x8930('0xd')](),controller['destroy']);module[_0x8930('0x10')]=router; \ No newline at end of file +var _0x06fd=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x227c55,_0x49db56){var _0x49e02b=function(_0x5bdd70){while(--_0x5bdd70){_0x227c55['push'](_0x227c55['shift']());}};_0x49e02b(++_0x49db56);}(_0x06fd,0x171));var _0xd06f=function(_0x2b22a6,_0x4194c8){_0x2b22a6=_0x2b22a6-0x0;var _0x359277=_0x06fd[_0x2b22a6];return _0x359277;};'use strict';var multer=require(_0xd06f('0x0'));var util=require(_0xd06f('0x1'));var path=require(_0xd06f('0x2'));var timeout=require(_0xd06f('0x3'));var express=require(_0xd06f('0x4'));var router=express[_0xd06f('0x5')]();var auth=require(_0xd06f('0x6'));var interaction=require(_0xd06f('0x7'));var config=require(_0xd06f('0x8'));var controller=require(_0xd06f('0x9'));router[_0xd06f('0xa')]('/',auth[_0xd06f('0xb')](),controller[_0xd06f('0xc')]);router[_0xd06f('0xa')](_0xd06f('0xd'),auth['isAuthenticated'](),controller[_0xd06f('0xe')]);router[_0xd06f('0xa')](_0xd06f('0xf'),auth[_0xd06f('0xb')](),controller[_0xd06f('0x10')]);router[_0xd06f('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd06f('0x12')](_0xd06f('0xf'),auth[_0xd06f('0xb')](),controller[_0xd06f('0x13')]);router[_0xd06f('0x14')](_0xd06f('0xf'),auth[_0xd06f('0xb')](),controller[_0xd06f('0x15')]);module[_0xd06f('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e267ba2..bd1af85 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 _0xd692=['exports','STRING','sequelize'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xd692,0xd7));var _0x2d69=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd692[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x2d69('0x0'));module[_0x2d69('0x1')]={'uniqueid':{'type':Sequelize[_0x2d69('0x2')]},'node':{'type':Sequelize[_0x2d69('0x2')]},'application':{'type':Sequelize[_0x2d69('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2d69('0x2')]}}; \ No newline at end of file +var _0x1340=['exports','STRING','sequelize'];(function(_0x3d7f0e,_0x104d69){var _0x3e45dd=function(_0x56770a){while(--_0x56770a){_0x3d7f0e['push'](_0x3d7f0e['shift']());}};_0x3e45dd(++_0x104d69);}(_0x1340,0xa1));var _0x0134=function(_0x4b7e27,_0xd5d684){_0x4b7e27=_0x4b7e27-0x0;var _0x1505c4=_0x1340[_0x4b7e27];return _0x1505c4;};'use strict';var Sequelize=require(_0x0134('0x0'));module[_0x0134('0x1')]={'uniqueid':{'type':Sequelize[_0x0134('0x2')]},'node':{'type':Sequelize[_0x0134('0x2')]},'application':{'type':Sequelize[_0x0134('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x0134('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 08f8122..383de0b 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 _0x5265=['create','update','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','index','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','add','day','filter','where','map','options','include','SquareDetailsReport','findAll','rows','catch','show','params','rawAttributes','filters','includeAll'];(function(_0x11624c,_0x38f2b9){var _0x1da047=function(_0xa5b1d5){while(--_0xa5b1d5){_0x11624c['push'](_0x11624c['shift']());}};_0x1da047(++_0x38f2b9);}(_0x5265,0xec));var _0x5526=function(_0x58f0c7,_0x301841){_0x58f0c7=_0x58f0c7-0x0;var _0x4339da=_0x5265[_0x58f0c7];return _0x4339da;};'use strict';var pdf=require(_0x5526('0x0'));var emlformat=require(_0x5526('0x1'));var rimraf=require(_0x5526('0x2'));var zipdir=require(_0x5526('0x3'));var jsonpatch=require(_0x5526('0x4'));var rp=require(_0x5526('0x5'));var moment=require(_0x5526('0x6'));var BPromise=require(_0x5526('0x7'));var Mustache=require(_0x5526('0x8'));var util=require(_0x5526('0x9'));var path=require(_0x5526('0xa'));var sox=require(_0x5526('0xb'));var csv=require(_0x5526('0xc'));var ejs=require(_0x5526('0xd'));var fs=require('fs');var _=require(_0x5526('0xe'));var squel=require(_0x5526('0xf'));var crypto=require('crypto');var jsforce=require(_0x5526('0x10'));var deskjs=require(_0x5526('0x11'));var toCsv=require(_0x5526('0xc'));var querystring=require(_0x5526('0x12'));var Papa=require(_0x5526('0x13'));var Redis=require(_0x5526('0x14'));var qs=require(_0x5526('0x15'));var logger=require(_0x5526('0x16'))(_0x5526('0x17'));var utils=require(_0x5526('0x18'));var config=require(_0x5526('0x19'));var db=require(_0x5526('0x1a'))['db'];function respondWithStatusCode(_0x169bac,_0x32fd96){_0x32fd96=_0x32fd96||0xcc;return function(_0xefa5b3){if(_0xefa5b3){return _0x169bac['sendStatus'](_0x32fd96);}return _0x169bac[_0x5526('0x1b')](_0x32fd96)[_0x5526('0x1c')]();};}function respondWithResult(_0x148ece,_0x47684d){_0x47684d=_0x47684d||0xc8;return function(_0x2b5a80){if(_0x2b5a80){return _0x148ece[_0x5526('0x1b')](_0x47684d)[_0x5526('0x1d')](_0x2b5a80);}};}function respondWithFilteredResult(_0x37b11b,_0x132116){return function(_0xe884b1){if(_0xe884b1){var _0x2e888c=_0xe884b1[_0x5526('0x1e')],_0xec7377=_0x132116[_0x5526('0x1f')],_0x265df9=_0x132116['offset']+_0x132116[_0x5526('0x20')],_0x123442;if(_0x265df9>=_0x2e888c){_0x265df9=_0x2e888c;_0x123442=0xc8;}else{_0x123442=0xce;}_0x37b11b[_0x5526('0x1b')](_0x123442);return _0x37b11b[_0x5526('0x21')](_0x5526('0x22'),_0xec7377+'-'+_0x265df9+'/'+_0x2e888c)[_0x5526('0x1d')](_0xe884b1);}return null;};}function patchUpdates(_0x4b22c1){return function(_0x56b267){try{jsonpatch['apply'](_0x56b267,_0x4b22c1,!![]);}catch(_0x153835){return BPromise[_0x5526('0x23')](_0x153835);}return _0x56b267[_0x5526('0x24')]();};}function saveUpdates(_0x31b82c,_0x8afe4){return function(_0x526068){if(_0x526068){return _0x526068['update'](_0x31b82c)[_0x5526('0x25')](function(_0x4ef6f3){return _0x4ef6f3;});}return null;};}function removeEntity(_0x22849b,_0x7bdb64){return function(_0x55c276){if(_0x55c276){return _0x55c276[_0x5526('0x26')]()[_0x5526('0x25')](function(){_0x22849b['status'](0xcc)[_0x5526('0x1c')]();});}};}function handleEntityNotFound(_0x539aab,_0x43774a){return function(_0x356467){if(!_0x356467){_0x539aab['sendStatus'](0x194);}return _0x356467;};}function handleError(_0x1a93c8,_0x2dec15){_0x2dec15=_0x2dec15||0x1f4;return function(_0x5453b3){logger[_0x5526('0x27')](_0x5453b3[_0x5526('0x28')]);if(_0x5453b3[_0x5526('0x29')]){delete _0x5453b3['name'];}_0x1a93c8[_0x5526('0x1b')](_0x2dec15)['send'](_0x5453b3);};}exports[_0x5526('0x2a')]=function(_0x3b6d73,_0x49cd05){var _0x127818={},_0x4a946d={},_0x4d133a={'count':0x0,'rows':[]};var _0x223806=db['SquareDetailsReport']['rawAttributes'];_0x4a946d[_0x5526('0x2b')]=_[_0x5526('0x2c')](_0x223806);var _0x13fb24={'dateStart':_0x3b6d73[_0x5526('0x2d')][_0x5526('0x2e')],'dateEnd':_0x3b6d73[_0x5526('0x2d')][_0x5526('0x2f')]};delete _0x3b6d73['query']['dateStart'];delete _0x3b6d73[_0x5526('0x2d')][_0x5526('0x2f')];_0x4a946d['query']=_['keys'](_0x3b6d73['query']);_0x4a946d['filters']=_[_0x5526('0x30')](_0x4a946d[_0x5526('0x2b')],_0x4a946d[_0x5526('0x2d')]);_0x127818[_0x5526('0x31')]=_['intersection'](_0x4a946d[_0x5526('0x2b')],qs[_0x5526('0x32')](_0x3b6d73[_0x5526('0x2d')][_0x5526('0x32')]));_0x127818[_0x5526('0x31')]=_0x127818[_0x5526('0x31')][_0x5526('0x33')]?_0x127818[_0x5526('0x31')]:_0x4a946d[_0x5526('0x2b')];if(!_0x3b6d73[_0x5526('0x2d')][_0x5526('0x34')](_0x5526('0x35'))){_0x127818[_0x5526('0x20')]=qs[_0x5526('0x20')](_0x3b6d73['query']['limit']);_0x127818[_0x5526('0x1f')]=qs['offset'](_0x3b6d73[_0x5526('0x2d')]['offset']);}_0x127818[_0x5526('0x36')]=qs['sort'](_0x3b6d73[_0x5526('0x2d')][_0x5526('0x37')]);_0x127818['where']=qs['filters'](_['pick'](_0x3b6d73[_0x5526('0x2d')],_0x4a946d['filters']));if(_0x13fb24[_0x5526('0x2e')]){if(_0x13fb24[_0x5526('0x2f')]){_0x13fb24[_0x5526('0x2f')]=moment(_0x13fb24[_0x5526('0x2f')])[_0x5526('0x38')](0x1,'day');}else{_0x13fb24[_0x5526('0x2f')]=moment(_0x13fb24['dateStart'])[_0x5526('0x38')](0x1,_0x5526('0x39'));}_['merge'](_0x127818['where'],{'createdAt':{'$gte':_0x13fb24[_0x5526('0x2e')],'$lte':_0x13fb24[_0x5526('0x2f')]}});}if(_0x3b6d73['query'][_0x5526('0x3a')]){_0x127818[_0x5526('0x3b')]=_['merge'](_0x127818[_0x5526('0x3b')],{'$or':_[_0x5526('0x3c')](_0x127818[_0x5526('0x31')],function(_0x55f885){var _0x29386b={};_0x29386b[_0x55f885]={'$like':'%'+_0x3b6d73['query'][_0x5526('0x3a')]+'%'};return _0x29386b;})});}_0x127818=_['merge']({},_0x127818,_0x3b6d73[_0x5526('0x3d')]);var _0x410387={'where':_0x127818[_0x5526('0x3b')]};return db['SquareDetailsReport'][_0x5526('0x1e')](_0x410387)[_0x5526('0x25')](function(_0x969f6f){_0x4d133a[_0x5526('0x1e')]=_0x969f6f;if(_0x3b6d73[_0x5526('0x2d')]['includeAll']){_0x127818[_0x5526('0x3e')]=[{'all':!![]}];}return db[_0x5526('0x3f')][_0x5526('0x40')](_0x127818);})[_0x5526('0x25')](function(_0x3f50bf){_0x4d133a[_0x5526('0x41')]=_0x3f50bf;return _0x4d133a;})[_0x5526('0x25')](respondWithFilteredResult(_0x49cd05,_0x127818))[_0x5526('0x42')](handleError(_0x49cd05,null));};exports[_0x5526('0x43')]=function(_0x2bbc10,_0x428eb9){var _0x5dbb20={'raw':!![],'where':{'id':_0x2bbc10[_0x5526('0x44')]['id']}},_0x3b8dfe={};_0x3b8dfe[_0x5526('0x2b')]=_['keys'](db[_0x5526('0x3f')][_0x5526('0x45')]);_0x3b8dfe[_0x5526('0x2d')]=_[_0x5526('0x2c')](_0x2bbc10[_0x5526('0x2d')]);_0x3b8dfe[_0x5526('0x46')]=_[_0x5526('0x30')](_0x3b8dfe[_0x5526('0x2b')],_0x3b8dfe[_0x5526('0x2d')]);_0x5dbb20['attributes']=_[_0x5526('0x30')](_0x3b8dfe[_0x5526('0x2b')],qs[_0x5526('0x32')](_0x2bbc10[_0x5526('0x2d')][_0x5526('0x32')]));_0x5dbb20['attributes']=_0x5dbb20[_0x5526('0x31')][_0x5526('0x33')]?_0x5dbb20[_0x5526('0x31')]:_0x3b8dfe[_0x5526('0x2b')];if(_0x2bbc10['query'][_0x5526('0x47')]){_0x5dbb20[_0x5526('0x3e')]=[{'all':!![]}];}_0x5dbb20=_['merge']({},_0x5dbb20,_0x2bbc10[_0x5526('0x3d')]);return db['SquareDetailsReport']['find'](_0x5dbb20)[_0x5526('0x25')](handleEntityNotFound(_0x428eb9,null))[_0x5526('0x25')](respondWithResult(_0x428eb9,null))[_0x5526('0x42')](handleError(_0x428eb9,null));};exports[_0x5526('0x48')]=function(_0x281103,_0x15f40e){return db[_0x5526('0x3f')][_0x5526('0x48')](_0x281103['body'],{})['then'](respondWithResult(_0x15f40e,0xc9))[_0x5526('0x42')](handleError(_0x15f40e,null));};exports[_0x5526('0x49')]=function(_0x2ba963,_0x38e1ef){if(_0x2ba963[_0x5526('0x4a')]['id']){delete _0x2ba963['body']['id'];}return db[_0x5526('0x3f')][_0x5526('0x4b')]({'where':{'id':_0x2ba963[_0x5526('0x44')]['id']}})['then'](handleEntityNotFound(_0x38e1ef,null))[_0x5526('0x25')](saveUpdates(_0x2ba963['body'],null))[_0x5526('0x25')](respondWithResult(_0x38e1ef,null))['catch'](handleError(_0x38e1ef,null));};exports[_0x5526('0x26')]=function(_0x16d546,_0x251bd8){return db[_0x5526('0x3f')]['find']({'where':{'id':_0x16d546[_0x5526('0x44')]['id']}})[_0x5526('0x25')](handleEntityNotFound(_0x251bd8,null))[_0x5526('0x25')](removeEntity(_0x251bd8,null))[_0x5526('0x42')](handleError(_0x251bd8,null));};exports['describe']=function(_0x386834,_0x17fe6b){return db[_0x5526('0x3f')][_0x5526('0x4c')]()[_0x5526('0x25')](respondWithResult(_0x17fe6b,null))[_0x5526('0x42')](handleError(_0x17fe6b,null));}; \ No newline at end of file +var _0x8b9a=['findAll','catch','show','params','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','index','SquareDetailsReport','rawAttributes','keys','query','dateStart','dateEnd','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','add','day','merge','where','filter','options','include'];(function(_0x28d6e1,_0x3bd067){var _0x529cf3=function(_0x5e66d7){while(--_0x5e66d7){_0x28d6e1['push'](_0x28d6e1['shift']());}};_0x529cf3(++_0x3bd067);}(_0x8b9a,0x158));var _0xa8b9=function(_0x3a7134,_0x35959d){_0x3a7134=_0x3a7134-0x0;var _0x4bedf8=_0x8b9a[_0x3a7134];return _0x4bedf8;};'use strict';var pdf=require(_0xa8b9('0x0'));var emlformat=require(_0xa8b9('0x1'));var rimraf=require(_0xa8b9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8b9('0x3'));var rp=require(_0xa8b9('0x4'));var moment=require(_0xa8b9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa8b9('0x6'));var util=require(_0xa8b9('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa8b9('0x8'));var jsforce=require(_0xa8b9('0x9'));var deskjs=require(_0xa8b9('0xa'));var toCsv=require(_0xa8b9('0xb'));var querystring=require(_0xa8b9('0xc'));var Papa=require(_0xa8b9('0xd'));var Redis=require('ioredis');var qs=require(_0xa8b9('0xe'));var logger=require(_0xa8b9('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xa8b9('0x10'));var db=require(_0xa8b9('0x11'))['db'];function respondWithStatusCode(_0x28a7c7,_0x39c5ff){_0x39c5ff=_0x39c5ff||0xcc;return function(_0x4dd0bf){if(_0x4dd0bf){return _0x28a7c7['sendStatus'](_0x39c5ff);}return _0x28a7c7['status'](_0x39c5ff)[_0xa8b9('0x12')]();};}function respondWithResult(_0x507f2d,_0x30f9f9){_0x30f9f9=_0x30f9f9||0xc8;return function(_0x5ad441){if(_0x5ad441){return _0x507f2d[_0xa8b9('0x13')](_0x30f9f9)[_0xa8b9('0x14')](_0x5ad441);}};}function respondWithFilteredResult(_0x2a1635,_0x4803f6){return function(_0x4a843a){if(_0x4a843a){var _0x320828=_0x4a843a[_0xa8b9('0x15')],_0x2a5c37=_0x4803f6[_0xa8b9('0x16')],_0x1e12df=_0x4803f6[_0xa8b9('0x16')]+_0x4803f6[_0xa8b9('0x17')],_0x1b6437;if(_0x1e12df>=_0x320828){_0x1e12df=_0x320828;_0x1b6437=0xc8;}else{_0x1b6437=0xce;}_0x2a1635[_0xa8b9('0x13')](_0x1b6437);return _0x2a1635[_0xa8b9('0x18')](_0xa8b9('0x19'),_0x2a5c37+'-'+_0x1e12df+'/'+_0x320828)['json'](_0x4a843a);}return null;};}function patchUpdates(_0x491430){return function(_0x416d88){try{jsonpatch[_0xa8b9('0x1a')](_0x416d88,_0x491430,!![]);}catch(_0x3d6f65){return BPromise[_0xa8b9('0x1b')](_0x3d6f65);}return _0x416d88[_0xa8b9('0x1c')]();};}function saveUpdates(_0x2db9a9,_0x469a24){return function(_0x45f8bd){if(_0x45f8bd){return _0x45f8bd[_0xa8b9('0x1d')](_0x2db9a9)[_0xa8b9('0x1e')](function(_0x56758a){return _0x56758a;});}return null;};}function removeEntity(_0x4cb499,_0x23e881){return function(_0x4815fd){if(_0x4815fd){return _0x4815fd[_0xa8b9('0x1f')]()[_0xa8b9('0x1e')](function(){_0x4cb499['status'](0xcc)[_0xa8b9('0x12')]();});}};}function handleEntityNotFound(_0x5e972e,_0x203a46){return function(_0x399d8f){if(!_0x399d8f){_0x5e972e[_0xa8b9('0x20')](0x194);}return _0x399d8f;};}function handleError(_0x18e6b3,_0x311756){_0x311756=_0x311756||0x1f4;return function(_0x8d2b8c){logger['error'](_0x8d2b8c['stack']);if(_0x8d2b8c[_0xa8b9('0x21')]){delete _0x8d2b8c[_0xa8b9('0x21')];}_0x18e6b3[_0xa8b9('0x13')](_0x311756)['send'](_0x8d2b8c);};}exports[_0xa8b9('0x22')]=function(_0x538035,_0x8555ac){var _0x3349f2={},_0x4239aa={},_0x2b1214={'count':0x0,'rows':[]};var _0x2c0852=db[_0xa8b9('0x23')][_0xa8b9('0x24')];_0x4239aa['model']=_[_0xa8b9('0x25')](_0x2c0852);var _0x332a0a={'dateStart':_0x538035[_0xa8b9('0x26')][_0xa8b9('0x27')],'dateEnd':_0x538035[_0xa8b9('0x26')][_0xa8b9('0x28')]};delete _0x538035[_0xa8b9('0x26')][_0xa8b9('0x27')];delete _0x538035[_0xa8b9('0x26')][_0xa8b9('0x28')];_0x4239aa['query']=_[_0xa8b9('0x25')](_0x538035['query']);_0x4239aa['filters']=_['intersection'](_0x4239aa[_0xa8b9('0x29')],_0x4239aa['query']);_0x3349f2[_0xa8b9('0x2a')]=_[_0xa8b9('0x2b')](_0x4239aa['model'],qs[_0xa8b9('0x2c')](_0x538035[_0xa8b9('0x26')][_0xa8b9('0x2c')]));_0x3349f2['attributes']=_0x3349f2[_0xa8b9('0x2a')][_0xa8b9('0x2d')]?_0x3349f2[_0xa8b9('0x2a')]:_0x4239aa['model'];if(!_0x538035[_0xa8b9('0x26')][_0xa8b9('0x2e')]('nolimit')){_0x3349f2[_0xa8b9('0x17')]=qs[_0xa8b9('0x17')](_0x538035['query'][_0xa8b9('0x17')]);_0x3349f2[_0xa8b9('0x16')]=qs[_0xa8b9('0x16')](_0x538035['query'][_0xa8b9('0x16')]);}_0x3349f2[_0xa8b9('0x2f')]=qs['sort'](_0x538035[_0xa8b9('0x26')][_0xa8b9('0x30')]);_0x3349f2['where']=qs[_0xa8b9('0x31')](_[_0xa8b9('0x32')](_0x538035[_0xa8b9('0x26')],_0x4239aa[_0xa8b9('0x31')]));if(_0x332a0a[_0xa8b9('0x27')]){if(_0x332a0a[_0xa8b9('0x28')]){_0x332a0a['dateEnd']=moment(_0x332a0a[_0xa8b9('0x28')])[_0xa8b9('0x33')](0x1,_0xa8b9('0x34'));}else{_0x332a0a['dateEnd']=moment(_0x332a0a[_0xa8b9('0x27')])[_0xa8b9('0x33')](0x1,'day');}_[_0xa8b9('0x35')](_0x3349f2[_0xa8b9('0x36')],{'createdAt':{'$gte':_0x332a0a['dateStart'],'$lte':_0x332a0a[_0xa8b9('0x28')]}});}if(_0x538035['query'][_0xa8b9('0x37')]){_0x3349f2['where']=_[_0xa8b9('0x35')](_0x3349f2[_0xa8b9('0x36')],{'$or':_['map'](_0x3349f2[_0xa8b9('0x2a')],function(_0x60e142){var _0x8c2538={};_0x8c2538[_0x60e142]={'$like':'%'+_0x538035['query'][_0xa8b9('0x37')]+'%'};return _0x8c2538;})});}_0x3349f2=_['merge']({},_0x3349f2,_0x538035[_0xa8b9('0x38')]);var _0x28cd58={'where':_0x3349f2[_0xa8b9('0x36')]};return db[_0xa8b9('0x23')][_0xa8b9('0x15')](_0x28cd58)['then'](function(_0xc9a1e5){_0x2b1214[_0xa8b9('0x15')]=_0xc9a1e5;if(_0x538035[_0xa8b9('0x26')]['includeAll']){_0x3349f2[_0xa8b9('0x39')]=[{'all':!![]}];}return db[_0xa8b9('0x23')][_0xa8b9('0x3a')](_0x3349f2);})[_0xa8b9('0x1e')](function(_0x238a01){_0x2b1214['rows']=_0x238a01;return _0x2b1214;})[_0xa8b9('0x1e')](respondWithFilteredResult(_0x8555ac,_0x3349f2))[_0xa8b9('0x3b')](handleError(_0x8555ac,null));};exports[_0xa8b9('0x3c')]=function(_0x371728,_0x580769){var _0x302239={'raw':!![],'where':{'id':_0x371728[_0xa8b9('0x3d')]['id']}},_0x3bfc89={};_0x3bfc89['model']=_[_0xa8b9('0x25')](db[_0xa8b9('0x23')][_0xa8b9('0x24')]);_0x3bfc89[_0xa8b9('0x26')]=_[_0xa8b9('0x25')](_0x371728[_0xa8b9('0x26')]);_0x3bfc89['filters']=_[_0xa8b9('0x2b')](_0x3bfc89[_0xa8b9('0x29')],_0x3bfc89[_0xa8b9('0x26')]);_0x302239[_0xa8b9('0x2a')]=_['intersection'](_0x3bfc89[_0xa8b9('0x29')],qs[_0xa8b9('0x2c')](_0x371728[_0xa8b9('0x26')][_0xa8b9('0x2c')]));_0x302239[_0xa8b9('0x2a')]=_0x302239[_0xa8b9('0x2a')]['length']?_0x302239[_0xa8b9('0x2a')]:_0x3bfc89[_0xa8b9('0x29')];if(_0x371728[_0xa8b9('0x26')][_0xa8b9('0x3e')]){_0x302239['include']=[{'all':!![]}];}_0x302239=_[_0xa8b9('0x35')]({},_0x302239,_0x371728['options']);return db[_0xa8b9('0x23')][_0xa8b9('0x3f')](_0x302239)['then'](handleEntityNotFound(_0x580769,null))[_0xa8b9('0x1e')](respondWithResult(_0x580769,null))[_0xa8b9('0x3b')](handleError(_0x580769,null));};exports['create']=function(_0x38ad73,_0x40d190){return db[_0xa8b9('0x23')][_0xa8b9('0x40')](_0x38ad73[_0xa8b9('0x41')],{})[_0xa8b9('0x1e')](respondWithResult(_0x40d190,0xc9))[_0xa8b9('0x3b')](handleError(_0x40d190,null));};exports['update']=function(_0x9bb7c7,_0x2bc181){if(_0x9bb7c7[_0xa8b9('0x41')]['id']){delete _0x9bb7c7[_0xa8b9('0x41')]['id'];}return db['SquareDetailsReport'][_0xa8b9('0x3f')]({'where':{'id':_0x9bb7c7[_0xa8b9('0x3d')]['id']}})[_0xa8b9('0x1e')](handleEntityNotFound(_0x2bc181,null))[_0xa8b9('0x1e')](saveUpdates(_0x9bb7c7[_0xa8b9('0x41')],null))['then'](respondWithResult(_0x2bc181,null))[_0xa8b9('0x3b')](handleError(_0x2bc181,null));};exports['destroy']=function(_0x24bdd6,_0x3e2f4f){return db[_0xa8b9('0x23')][_0xa8b9('0x3f')]({'where':{'id':_0x24bdd6[_0xa8b9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3e2f4f,null))[_0xa8b9('0x1e')](removeEntity(_0x3e2f4f,null))[_0xa8b9('0x3b')](handleError(_0x3e2f4f,null));};exports[_0xa8b9('0x42')]=function(_0x59b004,_0x2c3ee4){return db[_0xa8b9('0x23')]['describe']()[_0xa8b9('0x1e')](respondWithResult(_0x2c3ee4,null))[_0xa8b9('0x3b')](handleError(_0x2c3ee4,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c441329..db8b869 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 _0xfdde=['api','moment','bluebird','request-promise','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger'];(function(_0x4dbd85,_0x3e61ee){var _0x23f49a=function(_0x47dcd7){while(--_0x47dcd7){_0x4dbd85['push'](_0x4dbd85['shift']());}};_0x23f49a(++_0x3e61ee);}(_0xfdde,0x127));var _0xefdd=function(_0x1785bf,_0x485813){_0x1785bf=_0x1785bf-0x0;var _0xda5f95=_0xfdde[_0x1785bf];return _0xda5f95;};'use strict';var _=require(_0xefdd('0x0'));var util=require('util');var logger=require(_0xefdd('0x1'))(_0xefdd('0x2'));var moment=require(_0xefdd('0x3'));var BPromise=require(_0xefdd('0x4'));var rp=require(_0xefdd('0x5'));var attributes=require(_0xefdd('0x6'));module[_0xefdd('0x7')]=function(_0x371256,_0x528a80){return _0x371256[_0xefdd('0x8')](_0xefdd('0x9'),attributes,{'tableName':_0xefdd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98bb=['report_square_details','lodash','../../config/logger','api','moment','request-promise','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x39a565,_0x28dda0){var _0xb1b6ed=function(_0x35372e){while(--_0x35372e){_0x39a565['push'](_0x39a565['shift']());}};_0xb1b6ed(++_0x28dda0);}(_0x98bb,0x169));var _0xb98b=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x98bb[_0x373dee];return _0x46798f;};'use strict';var _=require(_0xb98b('0x0'));var util=require('util');var logger=require(_0xb98b('0x1'))(_0xb98b('0x2'));var moment=require(_0xb98b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb98b('0x4'));var attributes=require(_0xb98b('0x5'));module[_0xb98b('0x6')]=function(_0x37f262,_0x14b680){return _0x37f262[_0xb98b('0x7')](_0xb98b('0x8'),attributes,{'tableName':_0xb98b('0x9'),'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 db99e44..6122ca7 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 _0xc0a4=['result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc0a4,0x147));var _0x4c0a=function(_0x16860b,_0x4b187c){_0x16860b=_0x16860b-0x0;var _0x4a5d62=_0xc0a4[_0x16860b];return _0x4a5d62;};'use strict';var _=require('lodash');var util=require(_0x4c0a('0x0'));var moment=require(_0x4c0a('0x1'));var BPromise=require(_0x4c0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c0a('0x3'));var db=require(_0x4c0a('0x4'))['db'];var utils=require(_0x4c0a('0x5'));var logger=require(_0x4c0a('0x6'))(_0x4c0a('0x7'));var config=require('../../config/environment');var jayson=require(_0x4c0a('0x8'));var client=jayson[_0x4c0a('0x9')][_0x4c0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x457ef9,_0x7ca892,_0x1a64e7){return new BPromise(function(_0x4093d5,_0x33aedb){return client[_0x4c0a('0xb')](_0x457ef9,_0x1a64e7)['then'](function(_0x3bfa91){logger[_0x4c0a('0xc')](_0x4c0a('0xd'),_0x7ca892,_0x4c0a('0xe'));logger[_0x4c0a('0xf')](_0x4c0a('0x10'),_0x7ca892,_0x4c0a('0xe'),JSON[_0x4c0a('0x11')](_0x3bfa91));if(_0x3bfa91[_0x4c0a('0x12')]){if(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x13')]===0x1f4){logger[_0x4c0a('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x7ca892,_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);return _0x33aedb(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);}logger['error'](_0x4c0a('0xd'),_0x7ca892,_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);return _0x4093d5(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);}else{logger[_0x4c0a('0xc')](_0x4c0a('0xd'),_0x7ca892,_0x4c0a('0xe'));_0x4093d5(_0x3bfa91[_0x4c0a('0x15')][_0x4c0a('0x14')]);}})[_0x4c0a('0x16')](function(_0x4637a8){logger[_0x4c0a('0x12')](_0x4c0a('0xd'),_0x7ca892,_0x4637a8);_0x33aedb(_0x4637a8);});});}exports[_0x4c0a('0x17')]=function(_0x7e7d4b){var _0x4bdb26=this;return new Promise(function(_0x251c7f,_0x47e9df){return db[_0x4c0a('0x18')][_0x4c0a('0x19')](_0x7e7d4b[_0x4c0a('0x1a')],{'raw':_0x7e7d4b[_0x4c0a('0x1b')]?_0x7e7d4b[_0x4c0a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x4c0a('0x1c')](function(_0x5e7cf1){logger[_0x4c0a('0xc')](_0x4c0a('0x17'),_0x7e7d4b);logger[_0x4c0a('0xf')](_0x4c0a('0x17'),_0x7e7d4b,JSON['stringify'](_0x5e7cf1));_0x251c7f(_0x5e7cf1);})[_0x4c0a('0x16')](function(_0x19705f){logger[_0x4c0a('0x12')](_0x4c0a('0x17'),_0x19705f[_0x4c0a('0x14')],_0x7e7d4b);_0x47e9df(_0x4bdb26[_0x4c0a('0x12')](0x1f4,_0x19705f[_0x4c0a('0x14')]));});});}; \ No newline at end of file +var _0x891b=['message','result','catch','SquareDetailsReport','create','body','options','CreateSquareDetailsReport','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x20ccd6,_0x15eaab){var _0x1606eb=function(_0x15e618){while(--_0x15e618){_0x20ccd6['push'](_0x20ccd6['shift']());}};_0x1606eb(++_0x15eaab);}(_0x891b,0xc5));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb891('0x0'));var BPromise=require(_0xb891('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb891('0x2'));var db=require(_0xb891('0x3'))['db'];var utils=require(_0xb891('0x4'));var logger=require(_0xb891('0x5'))('rpc');var config=require(_0xb891('0x6'));var jayson=require(_0xb891('0x7'));var client=jayson['client'][_0xb891('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4eda97,_0x47ecc2,_0x5521f0){return new BPromise(function(_0x134dc0,_0x367478){return client[_0xb891('0x9')](_0x4eda97,_0x5521f0)[_0xb891('0xa')](function(_0x1ab1d6){logger[_0xb891('0xb')](_0xb891('0xc'),_0x47ecc2,'request\x20sent');logger[_0xb891('0xd')](_0xb891('0xe'),_0x47ecc2,_0xb891('0xf'),JSON[_0xb891('0x10')](_0x1ab1d6));if(_0x1ab1d6[_0xb891('0x11')]){if(_0x1ab1d6[_0xb891('0x11')][_0xb891('0x12')]===0x1f4){logger[_0xb891('0x11')](_0xb891('0xc'),_0x47ecc2,_0x1ab1d6[_0xb891('0x11')][_0xb891('0x13')]);return _0x367478(_0x1ab1d6['error'][_0xb891('0x13')]);}logger[_0xb891('0x11')](_0xb891('0xc'),_0x47ecc2,_0x1ab1d6['error'][_0xb891('0x13')]);return _0x134dc0(_0x1ab1d6[_0xb891('0x11')]['message']);}else{logger[_0xb891('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x47ecc2,_0xb891('0xf'));_0x134dc0(_0x1ab1d6[_0xb891('0x14')][_0xb891('0x13')]);}})[_0xb891('0x15')](function(_0x1fd866){logger[_0xb891('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x47ecc2,_0x1fd866);_0x367478(_0x1fd866);});});}exports['CreateSquareDetailsReport']=function(_0x88e4ad){var _0x36a1a3=this;return new Promise(function(_0x10a1b3,_0x35f2bb){return db[_0xb891('0x16')][_0xb891('0x17')](_0x88e4ad[_0xb891('0x18')],{'raw':_0x88e4ad[_0xb891('0x19')]?_0x88e4ad['options']['raw']===undefined?!![]:![]:!![]})[_0xb891('0xa')](function(_0x5f58dc){logger[_0xb891('0xb')](_0xb891('0x1a'),_0x88e4ad);logger['debug'](_0xb891('0x1a'),_0x88e4ad,JSON['stringify'](_0x5f58dc));_0x10a1b3(_0x5f58dc);})[_0xb891('0x15')](function(_0x3a233c){logger[_0xb891('0x11')](_0xb891('0x1a'),_0x3a233c[_0xb891('0x13')],_0x88e4ad);_0x35f2bb(_0x36a1a3[_0xb891('0x11')](0x1f4,_0x3a233c[_0xb891('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 46e5df0..e94acb9 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 _0xfc1d=['index','get','/process/:pid/kill','killProcess','express','../../components/auth/service','./system.controller','isAuthenticated'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xfc1d,0x10c));var _0xdfc1=function(_0x2e52f4,_0x5ef1f2){_0x2e52f4=_0x2e52f4-0x0;var _0x349146=_0xfc1d[_0x2e52f4];return _0x349146;};'use strict';var express=require(_0xdfc1('0x0'));var router=express['Router']();var auth=require(_0xdfc1('0x1'));var controller=require(_0xdfc1('0x2'));router['get']('/',auth[_0xdfc1('0x3')](),controller[_0xdfc1('0x4')]);router[_0xdfc1('0x5')](_0xdfc1('0x6'),auth[_0xdfc1('0x3')](),controller[_0xdfc1('0x7')]);module['exports']=router; \ No newline at end of file +var _0x3dd3=['index','killProcess','exports','express','Router','./system.controller','isAuthenticated'];(function(_0x3d6156,_0x566e08){var _0xd4abe=function(_0x5c81be){while(--_0x5c81be){_0x3d6156['push'](_0x3d6156['shift']());}};_0xd4abe(++_0x566e08);}(_0x3dd3,0xff));var _0x33dd=function(_0x3d4c5e,_0x2a7715){_0x3d4c5e=_0x3d4c5e-0x0;var _0x593d7c=_0x3dd3[_0x3d4c5e];return _0x593d7c;};'use strict';var express=require(_0x33dd('0x0'));var router=express[_0x33dd('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x33dd('0x2'));router['get']('/',auth[_0x33dd('0x3')](),controller[_0x33dd('0x4')]);router['get']('/process/:pid/kill',auth[_0x33dd('0x3')](),controller[_0x33dd('0x5')]);module[_0x33dd('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 adb90b3..0b1d440 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 _0xed2d=['indexOf','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','catch','json','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length'];(function(_0x5bc75a,_0x38ce5c){var _0x51abb3=function(_0x2622c0){while(--_0x2622c0){_0x5bc75a['push'](_0x5bc75a['shift']());}};_0x51abb3(++_0x38ce5c);}(_0xed2d,0xcb));var _0xded2=function(_0x46827d,_0x1c6b7a){_0x46827d=_0x46827d-0x0;var _0x38d03e=_0xed2d[_0x46827d];return _0x38d03e;};'use strict';var info=require(_0xded2('0x0'));var exec=require(_0xded2('0x1'))[_0xded2('0x2')];var logger=require('../../config/logger')('api');var util=require(_0xded2('0x3'));var BPromise=require(_0xded2('0x4'));var _=require(_0xded2('0x5'));function handleError(_0x321683,_0x44395c,_0xc34cb0){_0x44395c=_0x44395c||0x1f4;return function(_0x284975){logger[_0xded2('0x6')](_0xded2('0x7'),_0xc34cb0,_0x44395c,util[_0xded2('0x8')](_0x284975,{'showHidden':![],'depth':null}));delete _0x284975[_0xded2('0x9')];_0x321683[_0xded2('0xa')](_0x44395c)[_0xded2('0xb')](_0x284975);};}exports[_0xded2('0xc')]=function(_0x1c86e9,_0x352be9){return info['getAllData']()[_0xded2('0xd')](function(_0x1380ad){return _0x352be9[_0xded2('0xa')](0xc8)['json'](_0x1380ad);})[_0xded2('0xe')](function(_0x1d77a7){return _0x352be9[_0xded2('0xa')](0x1f4)[_0xded2('0xf')](_0x1d77a7);});};exports[_0xded2('0x10')]=function(_0x21d0ad,_0x57bd3a){var _0x4b4e13=['components/import/cm'];return new BPromise(function(_0x5074ce,_0x219341){return exec(util['format'](_0xded2('0x11'),_0x21d0ad[_0xded2('0x12')][_0xded2('0x13')]),function(_0x242d6e,_0x1ecb05,_0x19a8c5){if(_0x242d6e){return _0x219341(_0x242d6e);}return _0x5074ce(_0x1ecb05);});})[_0xded2('0xd')](function(_0x34fa6f){var _0x47d2fc=![];var _0x35bf8f=_0x34fa6f[_0xded2('0x14')](/\n/);for(var _0x5e4ad5=0x0,_0x5a792a=_0x4b4e13[_0xded2('0x15')];_0x5e4ad5<_0x5a792a,_0x47d2fc===![];_0x5e4ad5+=0x1){if(_0x34fa6f[_0xded2('0x16')](_0x4b4e13[_0x5e4ad5])>=0x0){_0x47d2fc=!![];}}if(!_0x47d2fc){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x21d0ad[_0xded2('0x12')][_0xded2('0x13')]));}process['kill'](_0x21d0ad['params'][_0xded2('0x13')],_0xded2('0x17'));return _0x57bd3a['status'](0xc8)[_0xded2('0xf')]({'message':util['format'](_0xded2('0x18'),_0x21d0ad[_0xded2('0x12')][_0xded2('0x13')])});})[_0xded2('0xe')](handleError(_0x57bd3a,null,_0xded2('0x10')));}; \ No newline at end of file +var _0x4ae4=['killProcess','components/import/cm','format','split','indexOf','params','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','index','getAllData','then','status','json','catch'];(function(_0x2e852e,_0x5150b2){var _0x4439a2=function(_0x28b482){while(--_0x28b482){_0x2e852e['push'](_0x2e852e['shift']());}};_0x4439a2(++_0x5150b2);}(_0x4ae4,0xb2));var _0x44ae=function(_0xd980d5,_0x4d2239){_0xd980d5=_0xd980d5-0x0;var _0x3fa318=_0x4ae4[_0xd980d5];return _0x3fa318;};'use strict';var info=require(_0x44ae('0x0'));var exec=require(_0x44ae('0x1'))[_0x44ae('0x2')];var logger=require(_0x44ae('0x3'))(_0x44ae('0x4'));var util=require(_0x44ae('0x5'));var BPromise=require(_0x44ae('0x6'));var _=require(_0x44ae('0x7'));function handleError(_0x32f80e,_0x2ffc0c,_0x5c0523){_0x2ffc0c=_0x2ffc0c||0x1f4;return function(_0x88ff5e){logger[_0x44ae('0x8')](_0x44ae('0x9'),_0x5c0523,_0x2ffc0c,util[_0x44ae('0xa')](_0x88ff5e,{'showHidden':![],'depth':null}));delete _0x88ff5e[_0x44ae('0xb')];_0x32f80e['status'](_0x2ffc0c)['send'](_0x88ff5e);};}exports[_0x44ae('0xc')]=function(_0x4134bd,_0x532e84){return info[_0x44ae('0xd')]()[_0x44ae('0xe')](function(_0x471675){return _0x532e84[_0x44ae('0xf')](0xc8)[_0x44ae('0x10')](_0x471675);})[_0x44ae('0x11')](function(_0x125cc3){return _0x532e84[_0x44ae('0xf')](0x1f4)[_0x44ae('0x10')](_0x125cc3);});};exports[_0x44ae('0x12')]=function(_0x485249,_0x26d43b){var _0x3ea985=[_0x44ae('0x13')];return new BPromise(function(_0x408c48,_0x613bb3){return exec(util[_0x44ae('0x14')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x485249['params']['pid']),function(_0x53a14b,_0x359134,_0x40380f){if(_0x53a14b){return _0x613bb3(_0x53a14b);}return _0x408c48(_0x359134);});})[_0x44ae('0xe')](function(_0x39a35e){var _0xad6059=![];var _0x3a4246=_0x39a35e[_0x44ae('0x15')](/\n/);for(var _0x342062=0x0,_0x220dbd=_0x3ea985['length'];_0x342062<_0x220dbd,_0xad6059===![];_0x342062+=0x1){if(_0x39a35e[_0x44ae('0x16')](_0x3ea985[_0x342062])>=0x0){_0xad6059=!![];}}if(!_0xad6059){throw new Error(util[_0x44ae('0x14')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x485249[_0x44ae('0x17')][_0x44ae('0x18')]));}process[_0x44ae('0x19')](_0x485249[_0x44ae('0x17')][_0x44ae('0x18')],_0x44ae('0x1a'));return _0x26d43b[_0x44ae('0xf')](0xc8)['json']({'message':util[_0x44ae('0x14')](_0x44ae('0x1b'),_0x485249[_0x44ae('0x17')][_0x44ae('0x18')])});})['catch'](handleError(_0x26d43b,null,_0x44ae('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 39a5463..9e155e9 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 _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xdb28,0x106));var _0x8db2=function(_0x44ce08,_0xf96f5c){_0x44ce08=_0x44ce08-0x0;var _0x2a7a2d=_0xdb28[_0x44ce08];return _0x2a7a2d;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var auth=require(_0x8db2('0x5'));var interaction=require(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var controller=require(_0x8db2('0x8'));router['get']('/',auth[_0x8db2('0x9')](),controller[_0x8db2('0xa')]);router['get']('/:id',auth[_0x8db2('0x9')](),controller[_0x8db2('0xb')]);router[_0x8db2('0xc')]('/',auth[_0x8db2('0x9')](),controller[_0x8db2('0xd')]);router[_0x8db2('0xe')](_0x8db2('0xf'),auth['isAuthenticated'](),controller[_0x8db2('0x10')]);router[_0x8db2('0x11')](_0x8db2('0xf'),auth['isAuthenticated'](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +var _0x9ffd=['/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./tag.controller','get','index'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x292d93,_0x1e47bc){_0x292d93=_0x292d93-0x0;var _0x3fd183=_0x9ffd[_0x292d93];return _0x3fd183;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9ff('0x9')]);router[_0xd9ff('0x8')](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0xd')]('/',auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xe')]);router[_0xd9ff('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x10')]);module[_0xd9ff('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 55cbee2..8714986 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 _0x244c=['exports','name','STRING','#0091EA','sequelize'];(function(_0x77461f,_0x2a28c9){var _0x416316=function(_0x2948bc){while(--_0x2948bc){_0x77461f['push'](_0x77461f['shift']());}};_0x416316(++_0x2a28c9);}(_0x244c,0x158));var _0xc244=function(_0x53ecb8,_0x3cc708){_0x53ecb8=_0x53ecb8-0x0;var _0x4f00bc=_0x244c[_0x53ecb8];return _0x4f00bc;};'use strict';var Sequelize=require(_0xc244('0x0'));module[_0xc244('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc244('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc244('0x3')],'defaultValue':_0xc244('0x4')},'description':{'type':Sequelize[_0xc244('0x3')]}}; \ No newline at end of file +var _0x31b9=['STRING','name','#0091EA','sequelize','exports'];(function(_0x5cee60,_0x4a0ad2){var _0x68219a=function(_0xdd3058){while(--_0xdd3058){_0x5cee60['push'](_0x5cee60['shift']());}};_0x68219a(++_0x4a0ad2);}(_0x31b9,0x76));var _0x931b=function(_0x260030,_0x4417eb){_0x260030=_0x260030-0x0;var _0x49b5c5=_0x31b9[_0x260030];return _0x49b5c5;};'use strict';var Sequelize=require(_0x931b('0x0'));module[_0x931b('0x1')]={'name':{'type':Sequelize[_0x931b('0x2')],'unique':_0x931b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x931b('0x2')],'defaultValue':_0x931b('0x4')},'description':{'type':Sequelize[_0x931b('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 363c6c8..d97de4f 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 _0xb7e7=['Tags','UserProfileResource','end','error','stack','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','map','filter','merge','options','Tag','rows','catch','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get'];(function(_0x50f1c0,_0x22cf85){var _0x391705=function(_0x5f5e00){while(--_0x5f5e00){_0x50f1c0['push'](_0x50f1c0['shift']());}};_0x391705(++_0x22cf85);}(_0xb7e7,0x121));var _0x7b7e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xb7e7[_0x487b0c];return _0x1adbdc;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var qs=require(_0x7b7e('0x10'));var logger=require('../../config/logger')(_0x7b7e('0x11'));var utils=require(_0x7b7e('0x12'));var config=require(_0x7b7e('0x13'));var db=require(_0x7b7e('0x14'))['db'];function respondWithStatusCode(_0xd581fb,_0x18a1de){_0x18a1de=_0x18a1de||0xcc;return function(_0x36d2a3){if(_0x36d2a3){return _0xd581fb[_0x7b7e('0x15')](_0x18a1de);}return _0xd581fb[_0x7b7e('0x16')](_0x18a1de)['end']();};}function respondWithResult(_0x267446,_0x430eab){_0x430eab=_0x430eab||0xc8;return function(_0x50d7d2){if(_0x50d7d2){return _0x267446[_0x7b7e('0x16')](_0x430eab)['json'](_0x50d7d2);}};}function respondWithFilteredResult(_0x4c6011,_0x2889ed){return function(_0xd304f5){if(_0xd304f5){var _0xf067da=_0xd304f5['count'],_0x457ec5=_0x2889ed[_0x7b7e('0x17')],_0x3d2fb2=_0x2889ed[_0x7b7e('0x17')]+_0x2889ed[_0x7b7e('0x18')],_0x5703fd;if(_0x3d2fb2>=_0xf067da){_0x3d2fb2=_0xf067da;_0x5703fd=0xc8;}else{_0x5703fd=0xce;}_0x4c6011[_0x7b7e('0x16')](_0x5703fd);return _0x4c6011[_0x7b7e('0x19')](_0x7b7e('0x1a'),_0x457ec5+'-'+_0x3d2fb2+'/'+_0xf067da)[_0x7b7e('0x1b')](_0xd304f5);}return null;};}function patchUpdates(_0x200ef7){return function(_0x2acb8c){try{jsonpatch[_0x7b7e('0x1c')](_0x2acb8c,_0x200ef7,!![]);}catch(_0x12e8e9){return BPromise[_0x7b7e('0x1d')](_0x12e8e9);}return _0x2acb8c[_0x7b7e('0x1e')]();};}function saveUpdates(_0x3bec7d,_0x9776c3){return function(_0x864287){if(_0x864287){return _0x864287[_0x7b7e('0x1f')](_0x3bec7d)['then'](function(_0x69262b){return _0x69262b;});}return null;};}function removeEntity(_0x43db4f,_0x24718c){return function(_0x4c0647){if(_0x4c0647){return _0x4c0647[_0x7b7e('0x20')]()[_0x7b7e('0x21')](function(){var _0x14243b=_0x4c0647[_0x7b7e('0x22')]({'plain':!![]});var _0x2b7211=_0x7b7e('0x23');return db[_0x7b7e('0x24')][_0x7b7e('0x20')]({'where':{'type':_0x2b7211,'resourceId':_0x14243b['id']}})['then'](function(){return _0x4c0647;});})['then'](function(){_0x43db4f['status'](0xcc)[_0x7b7e('0x25')]();});}};}function handleEntityNotFound(_0x22598e,_0x23bfa3){return function(_0x483c6f){if(!_0x483c6f){_0x22598e['sendStatus'](0x194);}return _0x483c6f;};}function handleError(_0x5dadbb,_0x182245){_0x182245=_0x182245||0x1f4;return function(_0x3c8192){logger[_0x7b7e('0x26')](_0x3c8192[_0x7b7e('0x27')]);if(_0x3c8192[_0x7b7e('0x28')]){delete _0x3c8192['name'];}_0x5dadbb[_0x7b7e('0x16')](_0x182245)[_0x7b7e('0x29')](_0x3c8192);};}exports['index']=function(_0x57b9da,_0x4e5de7){var _0x12ef0b={},_0x423832={},_0x503625={'count':0x0,'rows':[]};var _0x3db8c4=db['Tag'][_0x7b7e('0x2a')];_0x423832[_0x7b7e('0x2b')]=_[_0x7b7e('0x2c')](_0x3db8c4);var _0x5515ca={'dateStart':_0x57b9da[_0x7b7e('0x2d')][_0x7b7e('0x2e')],'dateEnd':_0x57b9da[_0x7b7e('0x2d')][_0x7b7e('0x2f')]};delete _0x57b9da[_0x7b7e('0x2d')]['dateStart'];delete _0x57b9da[_0x7b7e('0x2d')]['dateEnd'];_0x423832[_0x7b7e('0x2d')]=_[_0x7b7e('0x2c')](_0x57b9da[_0x7b7e('0x2d')]);_0x423832[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x423832[_0x7b7e('0x2b')],_0x423832[_0x7b7e('0x2d')]);_0x12ef0b['attributes']=_['intersection'](_0x423832[_0x7b7e('0x2b')],qs[_0x7b7e('0x32')](_0x57b9da['query'][_0x7b7e('0x32')]));_0x12ef0b[_0x7b7e('0x33')]=_0x12ef0b[_0x7b7e('0x33')]['length']?_0x12ef0b[_0x7b7e('0x33')]:_0x423832[_0x7b7e('0x2b')];if(!_0x57b9da[_0x7b7e('0x2d')][_0x7b7e('0x34')](_0x7b7e('0x35'))){_0x12ef0b[_0x7b7e('0x18')]=qs[_0x7b7e('0x18')](_0x57b9da[_0x7b7e('0x2d')][_0x7b7e('0x18')]);_0x12ef0b[_0x7b7e('0x17')]=qs[_0x7b7e('0x17')](_0x57b9da[_0x7b7e('0x2d')][_0x7b7e('0x17')]);}_0x12ef0b[_0x7b7e('0x36')]=qs[_0x7b7e('0x37')](_0x57b9da[_0x7b7e('0x2d')]['sort']);_0x12ef0b[_0x7b7e('0x38')]=qs[_0x7b7e('0x30')](_[_0x7b7e('0x39')](_0x57b9da[_0x7b7e('0x2d')],_0x423832[_0x7b7e('0x30')]));if(_0x5515ca[_0x7b7e('0x2e')]){if(_0x5515ca[_0x7b7e('0x2f')]){_0x5515ca[_0x7b7e('0x2f')]=moment(_0x5515ca[_0x7b7e('0x2f')])[_0x7b7e('0x3a')](0x1,'day');}else{_0x5515ca[_0x7b7e('0x2f')]=moment(_0x5515ca[_0x7b7e('0x2e')])[_0x7b7e('0x3a')](0x1,_0x7b7e('0x3b'));}_['merge'](_0x12ef0b[_0x7b7e('0x38')],{'createdAt':{'$gte':_0x5515ca[_0x7b7e('0x2e')],'$lte':_0x5515ca[_0x7b7e('0x2f')]}});}if(_0x57b9da['query']['filter']){_0x12ef0b[_0x7b7e('0x38')]=_['merge'](_0x12ef0b[_0x7b7e('0x38')],{'$or':_[_0x7b7e('0x3c')](_0x12ef0b['attributes'],function(_0xa5daaa){var _0x2074d1={};_0x2074d1[_0xa5daaa]={'$like':'%'+_0x57b9da[_0x7b7e('0x2d')][_0x7b7e('0x3d')]+'%'};return _0x2074d1;})});}_0x12ef0b=_[_0x7b7e('0x3e')]({},_0x12ef0b,_0x57b9da[_0x7b7e('0x3f')]);var _0xc888e4={'where':_0x12ef0b[_0x7b7e('0x38')]};return db[_0x7b7e('0x40')]['count'](_0xc888e4)['then'](function(_0x25b41e){_0x503625['count']=_0x25b41e;if(_0x57b9da[_0x7b7e('0x2d')]['includeAll']){_0x12ef0b['include']=[{'all':!![]}];}return db[_0x7b7e('0x40')]['findAll'](_0x12ef0b);})[_0x7b7e('0x21')](function(_0x52051c){_0x503625[_0x7b7e('0x41')]=_0x52051c;return _0x503625;})[_0x7b7e('0x21')](respondWithFilteredResult(_0x4e5de7,_0x12ef0b))[_0x7b7e('0x42')](handleError(_0x4e5de7,null));};exports[_0x7b7e('0x43')]=function(_0x4fd335,_0x1e4505){var _0xedf526={'raw':!![],'where':{'id':_0x4fd335[_0x7b7e('0x44')]['id']}},_0x271e4f={};_0x271e4f[_0x7b7e('0x2b')]=_[_0x7b7e('0x2c')](db['Tag']['rawAttributes']);_0x271e4f['query']=_[_0x7b7e('0x2c')](_0x4fd335[_0x7b7e('0x2d')]);_0x271e4f[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x271e4f[_0x7b7e('0x2b')],_0x271e4f[_0x7b7e('0x2d')]);_0xedf526['attributes']=_[_0x7b7e('0x31')](_0x271e4f[_0x7b7e('0x2b')],qs['fields'](_0x4fd335['query'][_0x7b7e('0x32')]));_0xedf526[_0x7b7e('0x33')]=_0xedf526[_0x7b7e('0x33')][_0x7b7e('0x45')]?_0xedf526[_0x7b7e('0x33')]:_0x271e4f[_0x7b7e('0x2b')];if(_0x4fd335['query'][_0x7b7e('0x46')]){_0xedf526['include']=[{'all':!![]}];}_0xedf526=_[_0x7b7e('0x3e')]({},_0xedf526,_0x4fd335[_0x7b7e('0x3f')]);return db[_0x7b7e('0x40')][_0x7b7e('0x47')](_0xedf526)['then'](handleEntityNotFound(_0x1e4505,null))[_0x7b7e('0x21')](respondWithResult(_0x1e4505,null))[_0x7b7e('0x42')](handleError(_0x1e4505,null));};exports[_0x7b7e('0x48')]=function(_0x334b8e,_0x1f9d0f){return db['Tag'][_0x7b7e('0x48')](_0x334b8e[_0x7b7e('0x49')],{})[_0x7b7e('0x21')](function(_0xcb5186){var _0x4767f0=_0x334b8e['user'][_0x7b7e('0x22')]({'plain':!![]});if(!_0x4767f0)throw new Error(_0x7b7e('0x4a'));if(_0x4767f0[_0x7b7e('0x4b')]===_0x7b7e('0x4c')){var _0x416abe=_0xcb5186[_0x7b7e('0x22')]({'plain':!![]});var _0x210768='Tags';return db[_0x7b7e('0x4d')]['find']({'where':{'name':_0x210768,'userProfileId':_0x4767f0[_0x7b7e('0x4e')]},'raw':!![]})[_0x7b7e('0x21')](function(_0x570303){if(_0x570303&&_0x570303[_0x7b7e('0x4f')]===0x0){return db[_0x7b7e('0x24')][_0x7b7e('0x48')]({'name':_0x416abe[_0x7b7e('0x28')],'resourceId':_0x416abe['id'],'type':_0x570303[_0x7b7e('0x28')],'sectionId':_0x570303['id']},{})[_0x7b7e('0x21')](function(){return _0xcb5186;});}else{return _0xcb5186;}})[_0x7b7e('0x42')](function(_0x5f15ce){logger[_0x7b7e('0x26')](_0x7b7e('0x50'),_0x5f15ce);throw _0x5f15ce;});}return _0xcb5186;})[_0x7b7e('0x21')](respondWithResult(_0x1f9d0f,0xc9))[_0x7b7e('0x42')](handleError(_0x1f9d0f,null));};exports['update']=function(_0x527403,_0x5bdf1d){if(_0x527403[_0x7b7e('0x49')]['id']){delete _0x527403[_0x7b7e('0x49')]['id'];}return db[_0x7b7e('0x40')]['find']({'where':{'id':_0x527403['params']['id']}})[_0x7b7e('0x21')](handleEntityNotFound(_0x5bdf1d,null))[_0x7b7e('0x21')](saveUpdates(_0x527403['body'],null))[_0x7b7e('0x21')](respondWithResult(_0x5bdf1d,null))[_0x7b7e('0x42')](handleError(_0x5bdf1d,null));};exports[_0x7b7e('0x20')]=function(_0x56ea8a,_0x2b0657){return db[_0x7b7e('0x40')]['find']({'where':{'id':_0x56ea8a[_0x7b7e('0x44')]['id']}})[_0x7b7e('0x21')](handleEntityNotFound(_0x2b0657,null))[_0x7b7e('0x21')](removeEntity(_0x2b0657,null))[_0x7b7e('0x42')](handleError(_0x2b0657,null));}; \ No newline at end of file +var _0xd7d1=['length','order','sort','where','filters','pick','add','merge','filter','map','options','Tag','includeAll','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','status','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','Tags','UserProfileResource','end','error','stack','name','index','keys','dateStart','query','dateEnd','model','attributes','intersection','fields'];(function(_0x2f6e8d,_0x2d5a58){var _0x543cbe=function(_0x3a865f){while(--_0x3a865f){_0x2f6e8d['push'](_0x2f6e8d['shift']());}};_0x543cbe(++_0x2d5a58);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2f13d0,_0x2e3d49){_0x2f13d0=_0x2f13d0-0x0;var _0x4618cc=_0xd7d1[_0x2f13d0];return _0x4618cc;};'use strict';var pdf=require(_0x1d7d('0x0'));var emlformat=require(_0x1d7d('0x1'));var rimraf=require(_0x1d7d('0x2'));var zipdir=require(_0x1d7d('0x3'));var jsonpatch=require(_0x1d7d('0x4'));var rp=require(_0x1d7d('0x5'));var moment=require(_0x1d7d('0x6'));var BPromise=require(_0x1d7d('0x7'));var Mustache=require(_0x1d7d('0x8'));var util=require(_0x1d7d('0x9'));var path=require(_0x1d7d('0xa'));var sox=require(_0x1d7d('0xb'));var csv=require(_0x1d7d('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xc'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var qs=require(_0x1d7d('0x15'));var logger=require(_0x1d7d('0x16'))('api');var utils=require(_0x1d7d('0x17'));var config=require('../../config/environment');var db=require(_0x1d7d('0x18'))['db'];function respondWithStatusCode(_0x3a7add,_0x3ddf35){_0x3ddf35=_0x3ddf35||0xcc;return function(_0x30b888){if(_0x30b888){return _0x3a7add['sendStatus'](_0x3ddf35);}return _0x3a7add[_0x1d7d('0x19')](_0x3ddf35)['end']();};}function respondWithResult(_0x577e07,_0x19e6bc){_0x19e6bc=_0x19e6bc||0xc8;return function(_0x4049be){if(_0x4049be){return _0x577e07['status'](_0x19e6bc)['json'](_0x4049be);}};}function respondWithFilteredResult(_0x1d3822,_0x334e78){return function(_0xe10fdd){if(_0xe10fdd){var _0x183fc6=_0xe10fdd[_0x1d7d('0x1a')],_0xeb05b3=_0x334e78['offset'],_0x53423f=_0x334e78[_0x1d7d('0x1b')]+_0x334e78[_0x1d7d('0x1c')],_0x28adf3;if(_0x53423f>=_0x183fc6){_0x53423f=_0x183fc6;_0x28adf3=0xc8;}else{_0x28adf3=0xce;}_0x1d3822[_0x1d7d('0x19')](_0x28adf3);return _0x1d3822[_0x1d7d('0x1d')](_0x1d7d('0x1e'),_0xeb05b3+'-'+_0x53423f+'/'+_0x183fc6)['json'](_0xe10fdd);}return null;};}function patchUpdates(_0x664e3f){return function(_0x191024){try{jsonpatch['apply'](_0x191024,_0x664e3f,!![]);}catch(_0x495212){return BPromise[_0x1d7d('0x1f')](_0x495212);}return _0x191024[_0x1d7d('0x20')]();};}function saveUpdates(_0x2a9f2b,_0x396802){return function(_0x2ae740){if(_0x2ae740){return _0x2ae740[_0x1d7d('0x21')](_0x2a9f2b)['then'](function(_0x225f85){return _0x225f85;});}return null;};}function removeEntity(_0x40c27f,_0x3a93d0){return function(_0x5692d9){if(_0x5692d9){return _0x5692d9[_0x1d7d('0x22')]()[_0x1d7d('0x23')](function(){var _0x4a1cdc=_0x5692d9['get']({'plain':!![]});var _0x1dcaf2=_0x1d7d('0x24');return db[_0x1d7d('0x25')]['destroy']({'where':{'type':_0x1dcaf2,'resourceId':_0x4a1cdc['id']}})[_0x1d7d('0x23')](function(){return _0x5692d9;});})[_0x1d7d('0x23')](function(){_0x40c27f[_0x1d7d('0x19')](0xcc)[_0x1d7d('0x26')]();});}};}function handleEntityNotFound(_0x4fa346,_0x233463){return function(_0x151198){if(!_0x151198){_0x4fa346['sendStatus'](0x194);}return _0x151198;};}function handleError(_0x57bbd8,_0x301e5c){_0x301e5c=_0x301e5c||0x1f4;return function(_0x52c618){logger[_0x1d7d('0x27')](_0x52c618[_0x1d7d('0x28')]);if(_0x52c618[_0x1d7d('0x29')]){delete _0x52c618[_0x1d7d('0x29')];}_0x57bbd8[_0x1d7d('0x19')](_0x301e5c)['send'](_0x52c618);};}exports[_0x1d7d('0x2a')]=function(_0x98c1ad,_0x352d5a){var _0x58672c={},_0x78adbe={},_0x1a935a={'count':0x0,'rows':[]};var _0x23ad85=db['Tag']['rawAttributes'];_0x78adbe['model']=_[_0x1d7d('0x2b')](_0x23ad85);var _0x329f56={'dateStart':_0x98c1ad['query'][_0x1d7d('0x2c')],'dateEnd':_0x98c1ad[_0x1d7d('0x2d')][_0x1d7d('0x2e')]};delete _0x98c1ad[_0x1d7d('0x2d')][_0x1d7d('0x2c')];delete _0x98c1ad[_0x1d7d('0x2d')][_0x1d7d('0x2e')];_0x78adbe[_0x1d7d('0x2d')]=_[_0x1d7d('0x2b')](_0x98c1ad[_0x1d7d('0x2d')]);_0x78adbe['filters']=_['intersection'](_0x78adbe[_0x1d7d('0x2f')],_0x78adbe[_0x1d7d('0x2d')]);_0x58672c[_0x1d7d('0x30')]=_[_0x1d7d('0x31')](_0x78adbe[_0x1d7d('0x2f')],qs[_0x1d7d('0x32')](_0x98c1ad[_0x1d7d('0x2d')][_0x1d7d('0x32')]));_0x58672c[_0x1d7d('0x30')]=_0x58672c['attributes'][_0x1d7d('0x33')]?_0x58672c[_0x1d7d('0x30')]:_0x78adbe[_0x1d7d('0x2f')];if(!_0x98c1ad[_0x1d7d('0x2d')]['hasOwnProperty']('nolimit')){_0x58672c[_0x1d7d('0x1c')]=qs[_0x1d7d('0x1c')](_0x98c1ad['query'][_0x1d7d('0x1c')]);_0x58672c[_0x1d7d('0x1b')]=qs['offset'](_0x98c1ad['query'][_0x1d7d('0x1b')]);}_0x58672c[_0x1d7d('0x34')]=qs[_0x1d7d('0x35')](_0x98c1ad[_0x1d7d('0x2d')][_0x1d7d('0x35')]);_0x58672c[_0x1d7d('0x36')]=qs[_0x1d7d('0x37')](_[_0x1d7d('0x38')](_0x98c1ad[_0x1d7d('0x2d')],_0x78adbe[_0x1d7d('0x37')]));if(_0x329f56['dateStart']){if(_0x329f56['dateEnd']){_0x329f56['dateEnd']=moment(_0x329f56['dateEnd'])[_0x1d7d('0x39')](0x1,'day');}else{_0x329f56[_0x1d7d('0x2e')]=moment(_0x329f56[_0x1d7d('0x2c')])[_0x1d7d('0x39')](0x1,'day');}_[_0x1d7d('0x3a')](_0x58672c[_0x1d7d('0x36')],{'createdAt':{'$gte':_0x329f56[_0x1d7d('0x2c')],'$lte':_0x329f56['dateEnd']}});}if(_0x98c1ad[_0x1d7d('0x2d')][_0x1d7d('0x3b')]){_0x58672c[_0x1d7d('0x36')]=_[_0x1d7d('0x3a')](_0x58672c['where'],{'$or':_[_0x1d7d('0x3c')](_0x58672c[_0x1d7d('0x30')],function(_0x4239fa){var _0x456d51={};_0x456d51[_0x4239fa]={'$like':'%'+_0x98c1ad['query'][_0x1d7d('0x3b')]+'%'};return _0x456d51;})});}_0x58672c=_['merge']({},_0x58672c,_0x98c1ad[_0x1d7d('0x3d')]);var _0x31b850={'where':_0x58672c[_0x1d7d('0x36')]};return db[_0x1d7d('0x3e')][_0x1d7d('0x1a')](_0x31b850)['then'](function(_0x59b8e7){_0x1a935a[_0x1d7d('0x1a')]=_0x59b8e7;if(_0x98c1ad[_0x1d7d('0x2d')][_0x1d7d('0x3f')]){_0x58672c['include']=[{'all':!![]}];}return db['Tag'][_0x1d7d('0x40')](_0x58672c);})['then'](function(_0x86e7bc){_0x1a935a[_0x1d7d('0x41')]=_0x86e7bc;return _0x1a935a;})[_0x1d7d('0x23')](respondWithFilteredResult(_0x352d5a,_0x58672c))[_0x1d7d('0x42')](handleError(_0x352d5a,null));};exports[_0x1d7d('0x43')]=function(_0x370e8d,_0x72f5d7){var _0x51cb15={'raw':!![],'where':{'id':_0x370e8d[_0x1d7d('0x44')]['id']}},_0x3ccd44={};_0x3ccd44['model']=_[_0x1d7d('0x2b')](db[_0x1d7d('0x3e')][_0x1d7d('0x45')]);_0x3ccd44[_0x1d7d('0x2d')]=_[_0x1d7d('0x2b')](_0x370e8d[_0x1d7d('0x2d')]);_0x3ccd44[_0x1d7d('0x37')]=_[_0x1d7d('0x31')](_0x3ccd44[_0x1d7d('0x2f')],_0x3ccd44[_0x1d7d('0x2d')]);_0x51cb15[_0x1d7d('0x30')]=_[_0x1d7d('0x31')](_0x3ccd44['model'],qs[_0x1d7d('0x32')](_0x370e8d['query'][_0x1d7d('0x32')]));_0x51cb15['attributes']=_0x51cb15[_0x1d7d('0x30')][_0x1d7d('0x33')]?_0x51cb15[_0x1d7d('0x30')]:_0x3ccd44[_0x1d7d('0x2f')];if(_0x370e8d['query'][_0x1d7d('0x3f')]){_0x51cb15['include']=[{'all':!![]}];}_0x51cb15=_['merge']({},_0x51cb15,_0x370e8d[_0x1d7d('0x3d')]);return db['Tag']['find'](_0x51cb15)[_0x1d7d('0x23')](handleEntityNotFound(_0x72f5d7,null))[_0x1d7d('0x23')](respondWithResult(_0x72f5d7,null))['catch'](handleError(_0x72f5d7,null));};exports[_0x1d7d('0x46')]=function(_0x1383f9,_0x527711){return db[_0x1d7d('0x3e')][_0x1d7d('0x46')](_0x1383f9[_0x1d7d('0x47')],{})[_0x1d7d('0x23')](function(_0x4ed120){var _0x4a577a=_0x1383f9[_0x1d7d('0x48')][_0x1d7d('0x49')]({'plain':!![]});if(!_0x4a577a)throw new Error(_0x1d7d('0x4a'));if(_0x4a577a[_0x1d7d('0x4b')]===_0x1d7d('0x48')){var _0x550c9f=_0x4ed120[_0x1d7d('0x49')]({'plain':!![]});var _0x24e0b7=_0x1d7d('0x24');return db[_0x1d7d('0x4c')][_0x1d7d('0x4d')]({'where':{'name':_0x24e0b7,'userProfileId':_0x4a577a[_0x1d7d('0x4e')]},'raw':!![]})[_0x1d7d('0x23')](function(_0x296e7c){if(_0x296e7c&&_0x296e7c[_0x1d7d('0x4f')]===0x0){return db['UserProfileResource'][_0x1d7d('0x46')]({'name':_0x550c9f[_0x1d7d('0x29')],'resourceId':_0x550c9f['id'],'type':_0x296e7c[_0x1d7d('0x29')],'sectionId':_0x296e7c['id']},{})['then'](function(){return _0x4ed120;});}else{return _0x4ed120;}})['catch'](function(_0x1d3f54){logger[_0x1d7d('0x27')](_0x1d7d('0x50'),_0x1d3f54);throw _0x1d3f54;});}return _0x4ed120;})['then'](respondWithResult(_0x527711,0xc9))[_0x1d7d('0x42')](handleError(_0x527711,null));};exports[_0x1d7d('0x21')]=function(_0x5eff64,_0x12547a){if(_0x5eff64[_0x1d7d('0x47')]['id']){delete _0x5eff64[_0x1d7d('0x47')]['id'];}return db[_0x1d7d('0x3e')]['find']({'where':{'id':_0x5eff64[_0x1d7d('0x44')]['id']}})[_0x1d7d('0x23')](handleEntityNotFound(_0x12547a,null))['then'](saveUpdates(_0x5eff64['body'],null))[_0x1d7d('0x23')](respondWithResult(_0x12547a,null))[_0x1d7d('0x42')](handleError(_0x12547a,null));};exports['destroy']=function(_0x552b8e,_0x155ef4){return db[_0x1d7d('0x3e')][_0x1d7d('0x4d')]({'where':{'id':_0x552b8e[_0x1d7d('0x44')]['id']}})['then'](handleEntityNotFound(_0x155ef4,null))[_0x1d7d('0x23')](removeEntity(_0x155ef4,null))['catch'](handleError(_0x155ef4,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 13a8c2d..f270457 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 _0x184e=['define','Tag','lodash','util','moment','bluebird','request-promise','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x184e,0x72));var _0xe184=function(_0x56418e,_0x362812){_0x56418e=_0x56418e-0x0;var _0x5b160c=_0x184e[_0x56418e];return _0x5b160c;};'use strict';var _=require(_0xe184('0x0'));var util=require(_0xe184('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe184('0x2'));var BPromise=require(_0xe184('0x3'));var rp=require(_0xe184('0x4'));var attributes=require('./tag.attributes');module[_0xe184('0x5')]=function(_0x4f0e9f,_0x2dc267){return _0x4f0e9f[_0xe184('0x6')](_0xe184('0x7'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf26=['exports','define','Tag','tools_tags','lodash','moment','bluebird'];(function(_0x41ca86,_0x30c9e1){var _0x10aee0=function(_0x14978d){while(--_0x14978d){_0x41ca86['push'](_0x41ca86['shift']());}};_0x10aee0(++_0x30c9e1);}(_0xcf26,0xe4));var _0x6cf2=function(_0x100ffb,_0x5a8adc){_0x100ffb=_0x100ffb-0x0;var _0x54e870=_0xcf26[_0x100ffb];return _0x54e870;};'use strict';var _=require(_0x6cf2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6cf2('0x1'));var BPromise=require(_0x6cf2('0x2'));var rp=require('request-promise');var attributes=require('./tag.attributes');module[_0x6cf2('0x3')]=function(_0x2e4a37,_0x42a2b2){return _0x2e4a37[_0x6cf2('0x4')](_0x6cf2('0x5'),attributes,{'tableName':_0x6cf2('0x6'),'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 88562e2..9f4a6bd 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 _0xef31=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','moment'];(function(_0x31db6a,_0x35aad6){var _0x44fb84=function(_0x4a917c){while(--_0x4a917c){_0x31db6a['push'](_0x31db6a['shift']());}};_0x44fb84(++_0x35aad6);}(_0xef31,0x1cc));var _0x1ef3=function(_0x2c06e8,_0x52090a){_0x2c06e8=_0x2c06e8-0x0;var _0x3bae0a=_0xef31[_0x2c06e8];return _0x3bae0a;};'use strict';var _=require('lodash');var util=require(_0x1ef3('0x0'));var moment=require(_0x1ef3('0x1'));var BPromise=require(_0x1ef3('0x2'));var rs=require(_0x1ef3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ef3('0x4'))['db'];var utils=require(_0x1ef3('0x5'));var logger=require(_0x1ef3('0x6'))(_0x1ef3('0x7'));var config=require(_0x1ef3('0x8'));var jayson=require(_0x1ef3('0x9'));var client=jayson[_0x1ef3('0xa')][_0x1ef3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c1636,_0x1b7858,_0x3a450d){return new BPromise(function(_0xc89124,_0x47de19){return client['request'](_0x4c1636,_0x3a450d)[_0x1ef3('0xc')](function(_0x4a8a13){logger[_0x1ef3('0xd')](_0x1ef3('0xe'),_0x1b7858,'request\x20sent');logger[_0x1ef3('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x1b7858,_0x1ef3('0x10'),JSON[_0x1ef3('0x11')](_0x4a8a13));if(_0x4a8a13[_0x1ef3('0x12')]){if(_0x4a8a13[_0x1ef3('0x12')]['code']===0x1f4){logger[_0x1ef3('0x12')](_0x1ef3('0xe'),_0x1b7858,_0x4a8a13[_0x1ef3('0x12')][_0x1ef3('0x13')]);return _0x47de19(_0x4a8a13['error'][_0x1ef3('0x13')]);}logger[_0x1ef3('0x12')](_0x1ef3('0xe'),_0x1b7858,_0x4a8a13[_0x1ef3('0x12')][_0x1ef3('0x13')]);return _0xc89124(_0x4a8a13[_0x1ef3('0x12')][_0x1ef3('0x13')]);}else{logger[_0x1ef3('0xd')]('Tag,\x20%s,\x20%s',_0x1b7858,_0x1ef3('0x10'));_0xc89124(_0x4a8a13[_0x1ef3('0x14')][_0x1ef3('0x13')]);}})[_0x1ef3('0x15')](function(_0x37a498){logger[_0x1ef3('0x12')](_0x1ef3('0xe'),_0x1b7858,_0x37a498);_0x47de19(_0x37a498);});});} \ No newline at end of file +var _0x5e85=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x4b9978,_0x58eb71){var _0x42f0e5=function(_0x4ff5dc){while(--_0x4ff5dc){_0x4b9978['push'](_0x4b9978['shift']());}};_0x42f0e5(++_0x58eb71);}(_0x5e85,0x14f));var _0x55e8=function(_0x30c996,_0x538904){_0x30c996=_0x30c996-0x0;var _0x1542fe=_0x5e85[_0x30c996];return _0x1542fe;};'use strict';var _=require(_0x55e8('0x0'));var util=require(_0x55e8('0x1'));var moment=require(_0x55e8('0x2'));var BPromise=require(_0x55e8('0x3'));var rs=require(_0x55e8('0x4'));var fs=require('fs');var Redis=require(_0x55e8('0x5'));var db=require(_0x55e8('0x6'))['db'];var utils=require(_0x55e8('0x7'));var logger=require(_0x55e8('0x8'))(_0x55e8('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x55e8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e2e4d,_0x568657,_0x5596fb){return new BPromise(function(_0x1ae9d0,_0x45be29){return client[_0x55e8('0xb')](_0x7e2e4d,_0x5596fb)[_0x55e8('0xc')](function(_0x222856){logger['info'](_0x55e8('0xd'),_0x568657,_0x55e8('0xe'));logger['debug'](_0x55e8('0xf'),_0x568657,'request\x20sent',JSON[_0x55e8('0x10')](_0x222856));if(_0x222856[_0x55e8('0x11')]){if(_0x222856[_0x55e8('0x11')][_0x55e8('0x12')]===0x1f4){logger[_0x55e8('0x11')](_0x55e8('0xd'),_0x568657,_0x222856['error'][_0x55e8('0x13')]);return _0x45be29(_0x222856[_0x55e8('0x11')][_0x55e8('0x13')]);}logger[_0x55e8('0x11')]('Tag,\x20%s,\x20%s',_0x568657,_0x222856['error'][_0x55e8('0x13')]);return _0x1ae9d0(_0x222856['error']['message']);}else{logger['info'](_0x55e8('0xd'),_0x568657,_0x55e8('0xe'));_0x1ae9d0(_0x222856[_0x55e8('0x14')]['message']);}})['catch'](function(_0xec457b){logger[_0x55e8('0x11')](_0x55e8('0xd'),_0x568657,_0xec457b);_0x45be29(_0xec457b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 1b7f72a..49fecea 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 _0x4ca0=['getQueues','post','create','/:id/users','addAgents','put','delete','destroy','removeQueues','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','isAuthenticated','index','/:id','show','get','/:id/queues'];(function(_0x522637,_0x1bf3b1){var _0x15d296=function(_0x2292a8){while(--_0x2292a8){_0x522637['push'](_0x522637['shift']());}};_0x15d296(++_0x1bf3b1);}(_0x4ca0,0x6b));var _0x04ca=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0x4ca0[_0x2726ad];return _0xd87993;};'use strict';var multer=require(_0x04ca('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x04ca('0x1'));var router=express[_0x04ca('0x2')]();var auth=require(_0x04ca('0x3'));var interaction=require(_0x04ca('0x4'));var config=require(_0x04ca('0x5'));var controller=require(_0x04ca('0x6'));router['get']('/',auth[_0x04ca('0x7')](),controller[_0x04ca('0x8')]);router['get'](_0x04ca('0x9'),auth[_0x04ca('0x7')](),controller[_0x04ca('0xa')]);router[_0x04ca('0xb')](_0x04ca('0xc'),auth[_0x04ca('0x7')](),controller[_0x04ca('0xd')]);router[_0x04ca('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x04ca('0xe')]('/',auth[_0x04ca('0x7')](),controller[_0x04ca('0xf')]);router['post']('/:id/queues',auth[_0x04ca('0x7')](),controller['addQueues']);router[_0x04ca('0xe')](_0x04ca('0x10'),auth['isAuthenticated'](),controller[_0x04ca('0x11')]);router[_0x04ca('0x12')](_0x04ca('0x9'),auth[_0x04ca('0x7')](),controller['update']);router[_0x04ca('0x13')](_0x04ca('0x9'),auth['isAuthenticated'](),controller[_0x04ca('0x14')]);router['delete'](_0x04ca('0xc'),auth['isAuthenticated'](),controller[_0x04ca('0x15')]);router[_0x04ca('0x13')](_0x04ca('0x10'),auth[_0x04ca('0x7')](),controller[_0x04ca('0x16')]);module[_0x04ca('0x17')]=router; \ No newline at end of file +var _0xf6ae=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','put','update','delete','destroy','removeQueues','removeAgents','exports','multer'];(function(_0x49f8c2,_0x5d0ef8){var _0x1a15e7=function(_0x456ff3){while(--_0x456ff3){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x1a15e7(++_0x5d0ef8);}(_0xf6ae,0x1af));var _0xef6a=function(_0x25ff0f,_0x42980b){_0x25ff0f=_0x25ff0f-0x0;var _0x29c662=_0xf6ae[_0x25ff0f];return _0x29c662;};'use strict';var multer=require(_0xef6a('0x0'));var util=require(_0xef6a('0x1'));var path=require(_0xef6a('0x2'));var timeout=require(_0xef6a('0x3'));var express=require(_0xef6a('0x4'));var router=express[_0xef6a('0x5')]();var auth=require(_0xef6a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xef6a('0x7'));var controller=require('./team.controller');router[_0xef6a('0x8')]('/',auth[_0xef6a('0x9')](),controller['index']);router[_0xef6a('0x8')](_0xef6a('0xa'),auth[_0xef6a('0x9')](),controller[_0xef6a('0xb')]);router[_0xef6a('0x8')](_0xef6a('0xc'),auth[_0xef6a('0x9')](),controller[_0xef6a('0xd')]);router[_0xef6a('0x8')](_0xef6a('0xe'),auth[_0xef6a('0x9')](),controller[_0xef6a('0xf')]);router[_0xef6a('0x10')]('/',auth[_0xef6a('0x9')](),controller[_0xef6a('0x11')]);router[_0xef6a('0x10')]('/:id/queues',auth['isAuthenticated'](),controller[_0xef6a('0x12')]);router[_0xef6a('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xef6a('0x13')]);router[_0xef6a('0x14')]('/:id',auth[_0xef6a('0x9')](),controller[_0xef6a('0x15')]);router[_0xef6a('0x16')](_0xef6a('0xa'),auth[_0xef6a('0x9')](),controller[_0xef6a('0x17')]);router[_0xef6a('0x16')](_0xef6a('0xc'),auth[_0xef6a('0x9')](),controller[_0xef6a('0x18')]);router['delete'](_0xef6a('0xe'),auth[_0xef6a('0x9')](),controller[_0xef6a('0x19')]);module[_0xef6a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 546aae2..41e47ed 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 _0x625b=['STRING','name','exports'];(function(_0x52b612,_0x2f1177){var _0x45952c=function(_0x4a44b1){while(--_0x4a44b1){_0x52b612['push'](_0x52b612['shift']());}};_0x45952c(++_0x2f1177);}(_0x625b,0x8f));var _0xb625=function(_0x20c6f1,_0x21fa65){_0x20c6f1=_0x20c6f1-0x0;var _0x43c3bf=_0x625b[_0x20c6f1];return _0x43c3bf;};'use strict';var Sequelize=require('sequelize');module[_0xb625('0x0')]={'name':{'type':Sequelize[_0xb625('0x1')],'allowNull':![],'unique':_0xb625('0x2')},'description':{'type':Sequelize[_0xb625('0x1')]}}; \ No newline at end of file +var _0x5c80=['sequelize','exports','STRING','name'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x5c80,0x1d0));var _0x05c8=function(_0x590917,_0x4deba8){_0x590917=_0x590917-0x0;var _0x50fc88=_0x5c80[_0x590917];return _0x50fc88;};'use strict';var Sequelize=require(_0x05c8('0x0'));module[_0x05c8('0x1')]={'name':{'type':Sequelize[_0x05c8('0x2')],'allowNull':![],'unique':_0x05c8('0x3')},'description':{'type':Sequelize[_0x05c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 05304b8..45ea341 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 _0xdd4f=['../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','Teams','UserProfileResource','destroy','end','sendStatus','stack','name','send','Team','rawAttributes','model','dateStart','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','options','include','findAll','rows','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','ids','removeQueues','remove','addAgents','each','voice','chat','mail','sms','fax','openchannel','User','loginInPause','voicePause','interface','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse'];(function(_0x29f30d,_0x14e357){var _0x2448d2=function(_0x21b4e5){while(--_0x21b4e5){_0x29f30d['push'](_0x29f30d['shift']());}};_0x2448d2(++_0x14e357);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5e07f3,_0x3d426d){_0x5e07f3=_0x5e07f3-0x0;var _0x4441db=_0xdd4f[_0x5e07f3];return _0x4441db;};'use strict';var pdf=require(_0xfdd4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfdd4('0x1'));var rp=require(_0xfdd4('0x2'));var moment=require('moment');var BPromise=require(_0xfdd4('0x3'));var Mustache=require(_0xfdd4('0x4'));var util=require(_0xfdd4('0x5'));var path=require('path');var sox=require(_0xfdd4('0x6'));var csv=require(_0xfdd4('0x7'));var ejs=require(_0xfdd4('0x8'));var fs=require('fs');var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x7'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var qs=require(_0xfdd4('0xe'));var logger=require('../../config/logger')(_0xfdd4('0xf'));var utils=require(_0xfdd4('0x10'));var config=require(_0xfdd4('0x11'));var db=require(_0xfdd4('0x12'))['db'];config[_0xfdd4('0x13')]=_[_0xfdd4('0x14')](config[_0xfdd4('0x13')],{'host':_0xfdd4('0x15'),'port':0x18eb});var socket=require(_0xfdd4('0x16'))(new Redis(config[_0xfdd4('0x13')]));require(_0xfdd4('0x17'))['register'](socket);function respondWithStatusCode(_0x4975aa,_0xd7dbf){_0xd7dbf=_0xd7dbf||0xcc;return function(_0x227099){if(_0x227099){return _0x4975aa['sendStatus'](_0xd7dbf);}return _0x4975aa[_0xfdd4('0x18')](_0xd7dbf)['end']();};}function respondWithResult(_0x467824,_0x42c3a8){_0x42c3a8=_0x42c3a8||0xc8;return function(_0x2f34ec){if(_0x2f34ec){return _0x467824[_0xfdd4('0x18')](_0x42c3a8)[_0xfdd4('0x19')](_0x2f34ec);}};}function respondWithFilteredResult(_0x52cf2c,_0x47ed1d){return function(_0x559c77){if(_0x559c77){var _0x3a966d=_0x559c77[_0xfdd4('0x1a')],_0x216c7e=_0x47ed1d[_0xfdd4('0x1b')],_0x2eb174=_0x47ed1d[_0xfdd4('0x1b')]+_0x47ed1d[_0xfdd4('0x1c')],_0x2ccc88;if(_0x2eb174>=_0x3a966d){_0x2eb174=_0x3a966d;_0x2ccc88=0xc8;}else{_0x2ccc88=0xce;}_0x52cf2c[_0xfdd4('0x18')](_0x2ccc88);return _0x52cf2c['set'](_0xfdd4('0x1d'),_0x216c7e+'-'+_0x2eb174+'/'+_0x3a966d)[_0xfdd4('0x19')](_0x559c77);}return null;};}function patchUpdates(_0x2dc51c){return function(_0x36e611){try{jsonpatch[_0xfdd4('0x1e')](_0x36e611,_0x2dc51c,!![]);}catch(_0x29cc8d){return BPromise[_0xfdd4('0x1f')](_0x29cc8d);}return _0x36e611[_0xfdd4('0x20')]();};}function saveUpdates(_0x523a7d,_0x2147e6){return function(_0x17302b){if(_0x17302b){return _0x17302b[_0xfdd4('0x21')](_0x523a7d)[_0xfdd4('0x22')](function(_0xb7856d){return _0xb7856d;});}return null;};}function removeEntity(_0x144acd,_0x451767){return function(_0x277ec1){if(_0x277ec1){return _0x277ec1['destroy']()[_0xfdd4('0x22')](function(){var _0x1112e8=_0x277ec1[_0xfdd4('0x23')]({'plain':!![]});var _0x53d35a=_0xfdd4('0x24');return db[_0xfdd4('0x25')][_0xfdd4('0x26')]({'where':{'type':_0x53d35a,'resourceId':_0x1112e8['id']}})[_0xfdd4('0x22')](function(){return _0x277ec1;});})[_0xfdd4('0x22')](function(){_0x144acd['status'](0xcc)[_0xfdd4('0x27')]();});}};}function handleEntityNotFound(_0x2c88ad,_0x3cd2c9){return function(_0x31e053){if(!_0x31e053){_0x2c88ad[_0xfdd4('0x28')](0x194);}return _0x31e053;};}function handleError(_0x192471,_0x453a48){_0x453a48=_0x453a48||0x1f4;return function(_0x37b7a2){logger['error'](_0x37b7a2[_0xfdd4('0x29')]);if(_0x37b7a2[_0xfdd4('0x2a')]){delete _0x37b7a2[_0xfdd4('0x2a')];}_0x192471[_0xfdd4('0x18')](_0x453a48)[_0xfdd4('0x2b')](_0x37b7a2);};}exports['index']=function(_0xd127b1,_0x3372d2){var _0xbf38b4={},_0x2bb793={},_0x13cc5e={'count':0x0,'rows':[]};var _0x4d64ce=db[_0xfdd4('0x2c')][_0xfdd4('0x2d')];_0x2bb793[_0xfdd4('0x2e')]=_['keys'](_0x4d64ce);var _0x3fd07a={'dateStart':_0xd127b1['query'][_0xfdd4('0x2f')],'dateEnd':_0xd127b1[_0xfdd4('0x30')]['dateEnd']};delete _0xd127b1['query'][_0xfdd4('0x2f')];delete _0xd127b1[_0xfdd4('0x30')]['dateEnd'];_0x2bb793['query']=_[_0xfdd4('0x31')](_0xd127b1[_0xfdd4('0x30')]);_0x2bb793[_0xfdd4('0x32')]=_[_0xfdd4('0x33')](_0x2bb793[_0xfdd4('0x2e')],_0x2bb793[_0xfdd4('0x30')]);_0xbf38b4[_0xfdd4('0x34')]=_[_0xfdd4('0x33')](_0x2bb793[_0xfdd4('0x2e')],qs[_0xfdd4('0x35')](_0xd127b1[_0xfdd4('0x30')][_0xfdd4('0x35')]));_0xbf38b4[_0xfdd4('0x34')]=_0xbf38b4[_0xfdd4('0x34')][_0xfdd4('0x36')]?_0xbf38b4[_0xfdd4('0x34')]:_0x2bb793[_0xfdd4('0x2e')];if(!_0xd127b1[_0xfdd4('0x30')][_0xfdd4('0x37')](_0xfdd4('0x38'))){_0xbf38b4[_0xfdd4('0x1c')]=qs[_0xfdd4('0x1c')](_0xd127b1[_0xfdd4('0x30')][_0xfdd4('0x1c')]);_0xbf38b4[_0xfdd4('0x1b')]=qs[_0xfdd4('0x1b')](_0xd127b1['query'][_0xfdd4('0x1b')]);}_0xbf38b4[_0xfdd4('0x39')]=qs[_0xfdd4('0x3a')](_0xd127b1[_0xfdd4('0x30')][_0xfdd4('0x3a')]);_0xbf38b4[_0xfdd4('0x3b')]=qs['filters'](_[_0xfdd4('0x3c')](_0xd127b1['query'],_0x2bb793[_0xfdd4('0x32')]));if(_0x3fd07a[_0xfdd4('0x2f')]){if(_0x3fd07a[_0xfdd4('0x3d')]){_0x3fd07a[_0xfdd4('0x3d')]=moment(_0x3fd07a['dateEnd'])[_0xfdd4('0x3e')](0x1,_0xfdd4('0x3f'));}else{_0x3fd07a[_0xfdd4('0x3d')]=moment(_0x3fd07a[_0xfdd4('0x2f')])[_0xfdd4('0x3e')](0x1,_0xfdd4('0x3f'));}_[_0xfdd4('0x40')](_0xbf38b4[_0xfdd4('0x3b')],{'createdAt':{'$gte':_0x3fd07a[_0xfdd4('0x2f')],'$lte':_0x3fd07a[_0xfdd4('0x3d')]}});}if(_0xd127b1['query'][_0xfdd4('0x41')]){_0xbf38b4[_0xfdd4('0x3b')]=_[_0xfdd4('0x40')](_0xbf38b4[_0xfdd4('0x3b')],{'$or':_['map'](_0xbf38b4[_0xfdd4('0x34')],function(_0x378965){var _0x30524f={};_0x30524f[_0x378965]={'$like':'%'+_0xd127b1[_0xfdd4('0x30')][_0xfdd4('0x41')]+'%'};return _0x30524f;})});}_0xbf38b4=_['merge']({},_0xbf38b4,_0xd127b1[_0xfdd4('0x42')]);var _0x23af2a={'where':_0xbf38b4[_0xfdd4('0x3b')]};return db[_0xfdd4('0x2c')][_0xfdd4('0x1a')](_0x23af2a)[_0xfdd4('0x22')](function(_0x3d1051){_0x13cc5e['count']=_0x3d1051;if(_0xd127b1[_0xfdd4('0x30')]['includeAll']){_0xbf38b4[_0xfdd4('0x43')]=[{'all':!![]}];}return db[_0xfdd4('0x2c')][_0xfdd4('0x44')](_0xbf38b4);})[_0xfdd4('0x22')](function(_0x5367aa){_0x13cc5e[_0xfdd4('0x45')]=_0x5367aa;return _0x13cc5e;})[_0xfdd4('0x22')](respondWithFilteredResult(_0x3372d2,_0xbf38b4))['catch'](handleError(_0x3372d2,null));};exports[_0xfdd4('0x46')]=function(_0xbfaa53,_0x48d422){var _0x218ca5={'raw':![],'where':{'id':_0xbfaa53['params']['id']}},_0x48c324={};_0x48c324['model']=_[_0xfdd4('0x31')](db[_0xfdd4('0x2c')][_0xfdd4('0x2d')]);_0x48c324['query']=_[_0xfdd4('0x31')](_0xbfaa53[_0xfdd4('0x30')]);_0x48c324['filters']=_[_0xfdd4('0x33')](_0x48c324[_0xfdd4('0x2e')],_0x48c324[_0xfdd4('0x30')]);_0x218ca5[_0xfdd4('0x34')]=_[_0xfdd4('0x33')](_0x48c324[_0xfdd4('0x2e')],qs[_0xfdd4('0x35')](_0xbfaa53[_0xfdd4('0x30')][_0xfdd4('0x35')]));_0x218ca5[_0xfdd4('0x34')]=_0x218ca5[_0xfdd4('0x34')][_0xfdd4('0x36')]?_0x218ca5[_0xfdd4('0x34')]:_0x48c324[_0xfdd4('0x2e')];if(_0xbfaa53['query']['includeAll']){_0x218ca5[_0xfdd4('0x43')]=[{'all':!![]}];}_0x218ca5=_[_0xfdd4('0x40')]({},_0x218ca5,_0xbfaa53[_0xfdd4('0x42')]);return db[_0xfdd4('0x2c')]['find'](_0x218ca5)[_0xfdd4('0x22')](handleEntityNotFound(_0x48d422,null))[_0xfdd4('0x22')](respondWithResult(_0x48d422,null))['catch'](handleError(_0x48d422,null));};exports['create']=function(_0x53c66d,_0x51dd34){return db['Team'][_0xfdd4('0x47')](_0x53c66d[_0xfdd4('0x48')],{})[_0xfdd4('0x22')](function(_0x1bbac9){var _0x35c032=_0x53c66d[_0xfdd4('0x49')]['get']({'plain':!![]});if(!_0x35c032)throw new Error(_0xfdd4('0x4a'));if(_0x35c032[_0xfdd4('0x4b')]===_0xfdd4('0x49')){var _0x2355b5=_0x1bbac9['get']({'plain':!![]});var _0x375adf=_0xfdd4('0x24');return db['UserProfileSection'][_0xfdd4('0x4c')]({'where':{'name':_0x375adf,'userProfileId':_0x35c032[_0xfdd4('0x4d')]},'raw':!![]})['then'](function(_0x5467d1){if(_0x5467d1&&_0x5467d1[_0xfdd4('0x4e')]===0x0){return db[_0xfdd4('0x25')][_0xfdd4('0x47')]({'name':_0x2355b5[_0xfdd4('0x2a')],'resourceId':_0x2355b5['id'],'type':_0x5467d1[_0xfdd4('0x2a')],'sectionId':_0x5467d1['id']},{})[_0xfdd4('0x22')](function(){return _0x1bbac9;});}else{return _0x1bbac9;}})[_0xfdd4('0x4f')](function(_0x3de4fd){logger['error'](_0xfdd4('0x50'),_0x3de4fd);throw _0x3de4fd;});}return _0x1bbac9;})['then'](respondWithResult(_0x51dd34,0xc9))['catch'](handleError(_0x51dd34,null));};exports[_0xfdd4('0x21')]=function(_0x1d9a8d,_0x57cb65){if(_0x1d9a8d['body']['id']){delete _0x1d9a8d['body']['id'];}return db[_0xfdd4('0x2c')][_0xfdd4('0x4c')]({'where':{'id':_0x1d9a8d['params']['id']}})[_0xfdd4('0x22')](handleEntityNotFound(_0x57cb65,null))[_0xfdd4('0x22')](saveUpdates(_0x1d9a8d[_0xfdd4('0x48')],null))[_0xfdd4('0x22')](respondWithResult(_0x57cb65,null))[_0xfdd4('0x4f')](handleError(_0x57cb65,null));};exports['destroy']=function(_0x570b4b,_0x483942){return db['Team'][_0xfdd4('0x4c')]({'where':{'id':_0x570b4b[_0xfdd4('0x51')]['id']}})['then'](handleEntityNotFound(_0x483942,null))[_0xfdd4('0x22')](removeEntity(_0x483942,null))[_0xfdd4('0x4f')](handleError(_0x483942,null));};exports['getQueues']=function(_0x45dcc8,_0x118eb0,_0x4e9364){return db[_0xfdd4('0x2c')][_0xfdd4('0x52')]({'where':{'id':_0x45dcc8[_0xfdd4('0x51')]['id']}})['then'](handleEntityNotFound(_0x118eb0,null))[_0xfdd4('0x22')](function(_0x3417dd){if(!_0x45dcc8[_0xfdd4('0x30')][_0xfdd4('0x53')]||!utils[_0xfdd4('0x54')](_0x45dcc8['query'][_0xfdd4('0x53')])){throw new db[(_0xfdd4('0x55'))][(_0xfdd4('0x56'))](_0xfdd4('0x57'));}var _0x3dd05c={};var _0x14f45c={};_0x14f45c[_0xfdd4('0x2e')]=_[_0xfdd4('0x31')](db[_[_0xfdd4('0x58')](_0x45dcc8['query'][_0xfdd4('0x53')][_0xfdd4('0x59')]())+_0xfdd4('0x5a')][_0xfdd4('0x2d')]);_0x14f45c[_0xfdd4('0x30')]=_['keys'](_0x45dcc8[_0xfdd4('0x30')]);_0x14f45c[_0xfdd4('0x32')]=_[_0xfdd4('0x33')](_0x14f45c[_0xfdd4('0x2e')],_0x14f45c[_0xfdd4('0x30')]);_0x3dd05c[_0xfdd4('0x34')]=_[_0xfdd4('0x33')](_0x14f45c[_0xfdd4('0x2e')],qs[_0xfdd4('0x35')](_0x45dcc8[_0xfdd4('0x30')][_0xfdd4('0x35')]));_0x3dd05c[_0xfdd4('0x34')]=_0x3dd05c[_0xfdd4('0x34')]['length']?_0x3dd05c[_0xfdd4('0x34')]:_0x14f45c['model'];_0x3dd05c[_0xfdd4('0x1c')]=qs[_0xfdd4('0x1c')](_0x45dcc8[_0xfdd4('0x30')][_0xfdd4('0x1c')]);_0x3dd05c[_0xfdd4('0x1b')]=qs[_0xfdd4('0x1b')](_0x45dcc8[_0xfdd4('0x30')][_0xfdd4('0x1b')]);_0x3dd05c[_0xfdd4('0x39')]=qs[_0xfdd4('0x3a')](_0x45dcc8[_0xfdd4('0x30')][_0xfdd4('0x3a')]);_0x3dd05c['where']=qs['filters'](_['pick'](_0x45dcc8[_0xfdd4('0x30')],_0x14f45c[_0xfdd4('0x32')]));_0x3dd05c=_['merge']({},_0x3dd05c,_0x45dcc8[_0xfdd4('0x42')]);return _0x3417dd[_0xfdd4('0x23')+_[_0xfdd4('0x58')](_0x45dcc8[_0xfdd4('0x30')][_0xfdd4('0x53')]['toLowerCase']())+_0xfdd4('0x5b')](_0x3dd05c);})[_0xfdd4('0x22')](respondWithResult(_0x118eb0,null))[_0xfdd4('0x4f')](handleError(_0x118eb0,null));};exports['addQueues']=function(_0x366f1c,_0x4e50f2,_0x2ecd1b){return db[_0xfdd4('0x2c')][_0xfdd4('0x52')]({'where':{'id':_0x366f1c[_0xfdd4('0x51')]['id']}})['then'](function(_0x2351b6){if(_0x2351b6){if(!_0x366f1c[_0xfdd4('0x48')]['channel']||!utils[_0xfdd4('0x54')](_0x366f1c[_0xfdd4('0x48')][_0xfdd4('0x53')])){throw new db['Sequelize'][(_0xfdd4('0x56'))](_0xfdd4('0x57'));}return _0x2351b6[_0xfdd4('0x3e')+_['capitalize'](_0x366f1c[_0xfdd4('0x48')][_0xfdd4('0x53')][_0xfdd4('0x59')]())+_0xfdd4('0x5b')](_0x366f1c[_0xfdd4('0x48')][_0xfdd4('0x5c')]);}return null;})[_0xfdd4('0x22')](handleEntityNotFound(_0x4e50f2,null))['then'](respondWithStatusCode(_0x4e50f2,null))[_0xfdd4('0x4f')](handleError(_0x4e50f2,null));};exports[_0xfdd4('0x5d')]=function(_0xab101d,_0x3c24b0,_0xcdc104){return db[_0xfdd4('0x2c')][_0xfdd4('0x52')]({'where':{'id':_0xab101d[_0xfdd4('0x51')]['id']}})['then'](function(_0x430412){if(_0x430412){if(!_0xab101d['query']['channel']||!utils[_0xfdd4('0x54')](_0xab101d['query'][_0xfdd4('0x53')])){throw new db['Sequelize'][(_0xfdd4('0x56'))](_0xfdd4('0x57'));}return _0x430412[_0xfdd4('0x5e')+_[_0xfdd4('0x58')](_0xab101d[_0xfdd4('0x30')][_0xfdd4('0x53')][_0xfdd4('0x59')]())+'Queues'](_0xab101d['query'][_0xfdd4('0x5c')]);}return null;})['then'](handleEntityNotFound(_0x3c24b0,null))[_0xfdd4('0x22')](respondWithStatusCode(_0x3c24b0,null))[_0xfdd4('0x4f')](handleError(_0x3c24b0,null));};exports[_0xfdd4('0x5f')]=function(_0x1d57f8,_0x243848,_0x165295){return db[_0xfdd4('0x2c')]['find']({'where':{'id':_0x1d57f8['params']['id']}})[_0xfdd4('0x22')](handleEntityNotFound(_0x243848,null))[_0xfdd4('0x22')](function(_0x4259c2){if(_0x4259c2){return BPromise[_0xfdd4('0x60')]([_0xfdd4('0x61'),_0xfdd4('0x62'),_0xfdd4('0x63'),_0xfdd4('0x64'),_0xfdd4('0x65'),_0xfdd4('0x66')],function(_0x3bb707){return _0x4259c2[_0xfdd4('0x23')+_[_0xfdd4('0x58')](_0x3bb707)+'Queues']({'attributes':['id','name']})[_0xfdd4('0x22')](function(_0x34760d){return BPromise['each'](_0x34760d,function(_0x5854b9){return _0x5854b9[_0xfdd4('0x5f')](_0x1d57f8[_0xfdd4('0x48')]['ids'])[_0xfdd4('0x22')](function(){if(_0x3bb707===_0xfdd4('0x61')){return db[_0xfdd4('0x67')][_0xfdd4('0x44')]({'where':{'id':_0x1d57f8[_0xfdd4('0x48')][_0xfdd4('0x5c')]},'attributes':['id','name',_0xfdd4('0x68'),_0xfdd4('0x69'),_0xfdd4('0x6a')],'raw':!![]});}})[_0xfdd4('0x22')](function(_0x2591de){if(_0x3bb707===_0xfdd4('0x61')){return BPromise[_0xfdd4('0x60')](_0x2591de,function(_0x18eea8){return db['UserVoiceQueueRt']['upsert']({'membername':_0x18eea8[_0xfdd4('0x2a')],'UserId':_0x18eea8['id'],'queue_name':_0x5854b9['name'],'VoiceQueueId':_0x5854b9['id'],'interface':_[_0xfdd4('0x6b')](_0x18eea8[_0xfdd4('0x6a')])?util[_0xfdd4('0x6c')](_0xfdd4('0x6d'),_0x18eea8[_0xfdd4('0x2a')]):_0x18eea8['interface'],'paused':_0x18eea8['voicePause']||![],'penalty':0x0});});}});});})[_0xfdd4('0x22')](function(){return _0x4259c2;});})['then'](function(){return _0x4259c2;});}})[_0xfdd4('0x22')](function(_0x4a2848){if(_0x4a2848){return _0x4a2848[_0xfdd4('0x5f')](_0x1d57f8[_0xfdd4('0x48')][_0xfdd4('0x5c')],_[_0xfdd4('0x6e')](_0x1d57f8[_0xfdd4('0x48')],[_0xfdd4('0x5c'),'id'])||{})[_0xfdd4('0x6f')](function(_0x18ae9e){for(var _0x3d23df=0x0;_0x3d23df<_0x1d57f8[_0xfdd4('0x48')][_0xfdd4('0x5c')]['length'];_0x3d23df+=0x1){socket[_0xfdd4('0x70')](_0xfdd4('0x71'),{'UserId':_0x1d57f8[_0xfdd4('0x48')][_0xfdd4('0x5c')][_0x3d23df],'TeamId':_0x1d57f8[_0xfdd4('0x51')]['id']});}return _0x18ae9e;});}})[_0xfdd4('0x22')](respondWithResult(_0x243848,null))[_0xfdd4('0x4f')](handleError(_0x243848,null));};exports[_0xfdd4('0x72')]=function(_0x2fe961,_0x530157,_0x4882d6){var _0x2990aa;return db[_0xfdd4('0x2c')][_0xfdd4('0x4c')]({'where':{'id':_0x2fe961['params']['id']}})[_0xfdd4('0x22')](handleEntityNotFound(_0x530157,null))[_0xfdd4('0x22')](function(_0x1cab63){if(_0x1cab63){return BPromise[_0xfdd4('0x60')](['voice','chat',_0xfdd4('0x63'),_0xfdd4('0x64'),_0xfdd4('0x65'),'openchannel'],function(_0x184172){return _0x1cab63[_0xfdd4('0x23')+_[_0xfdd4('0x58')](_0x184172)+_0xfdd4('0x5b')]({'attributes':['id',_0xfdd4('0x2a')]})[_0xfdd4('0x22')](function(_0x524a8f){return BPromise['each'](_0x524a8f,function(_0x5ba44a){return _0x5ba44a[_0xfdd4('0x72')](_0x2fe961[_0xfdd4('0x30')][_0xfdd4('0x5c')])[_0xfdd4('0x22')](function(){if(_0x184172===_0xfdd4('0x61')){return db[_0xfdd4('0x73')][_0xfdd4('0x26')]({'where':{'VoiceQueueId':_0x5ba44a['id'],'UserId':_0x2fe961['query'][_0xfdd4('0x5c')]}});}});});})['then'](function(){return _0x1cab63;});})[_0xfdd4('0x22')](function(){return _0x1cab63;});}})[_0xfdd4('0x22')](function(_0x58b159){if(_0x58b159){return _0x58b159[_0xfdd4('0x72')](_0x2fe961[_0xfdd4('0x30')][_0xfdd4('0x5c')])[_0xfdd4('0x22')](function(_0x3cd7ae){if(_[_0xfdd4('0x74')](_0x2fe961[_0xfdd4('0x30')][_0xfdd4('0x5c')])){for(var _0xcc0684=0x0;_0xcc0684<_0x2fe961['query'][_0xfdd4('0x5c')]['length'];_0xcc0684+=0x1){socket[_0xfdd4('0x70')]('userTeam:remove',{'UserId':_0x2fe961['query'][_0xfdd4('0x5c')][_0xcc0684],'TeamId':_0x2fe961[_0xfdd4('0x51')]['id']});}}else{socket[_0xfdd4('0x70')](_0xfdd4('0x75'),{'UserId':_0x2fe961[_0xfdd4('0x30')]['ids'],'TeamId':_0x2fe961[_0xfdd4('0x51')]['id']});}});}})[_0xfdd4('0x22')](respondWithStatusCode(_0x530157,null))[_0xfdd4('0x4f')](handleError(_0x530157,null));};exports[_0xfdd4('0x76')]=function(_0x7711ea,_0x1c69de,_0x59f686){var _0x7a81f1={};var _0x1eb455={};var _0x4d123f;var _0x4bc30f;return db[_0xfdd4('0x2c')][_0xfdd4('0x52')]({'where':{'id':_0x7711ea[_0xfdd4('0x51')]['id']}})['then'](handleEntityNotFound(_0x1c69de,null))['then'](function(_0x178f97){if(_0x178f97){_0x4d123f=_0x178f97;_0x1eb455[_0xfdd4('0x2e')]=_[_0xfdd4('0x31')](db['User']['rawAttributes']);_0x1eb455[_0xfdd4('0x30')]=_[_0xfdd4('0x31')](_0x7711ea[_0xfdd4('0x30')]);_0x1eb455['filters']=_[_0xfdd4('0x33')](_0x1eb455['model'],_0x1eb455[_0xfdd4('0x30')]);_0x7a81f1[_0xfdd4('0x34')]=_[_0xfdd4('0x33')](_0x1eb455['model'],qs[_0xfdd4('0x35')](_0x7711ea[_0xfdd4('0x30')][_0xfdd4('0x35')]));_0x7a81f1[_0xfdd4('0x34')]=_0x7a81f1[_0xfdd4('0x34')]['length']?_0x7a81f1[_0xfdd4('0x34')]:_0x1eb455[_0xfdd4('0x2e')];_0x7a81f1[_0xfdd4('0x39')]=qs['sort'](_0x7711ea[_0xfdd4('0x30')][_0xfdd4('0x3a')]);_0x7a81f1[_0xfdd4('0x3b')]=qs[_0xfdd4('0x32')](_['pick'](_0x7711ea[_0xfdd4('0x30')],_0x1eb455['filters']));if(_0x7711ea['query']['filter']){_0x7a81f1[_0xfdd4('0x3b')]=_['merge'](_0x7a81f1['where'],{'$or':_['map'](_0x7a81f1[_0xfdd4('0x34')],function(_0x728e25){var _0x2215fc={};_0x2215fc[_0x728e25]={'$like':'%'+_0x7711ea[_0xfdd4('0x30')][_0xfdd4('0x41')]+'%'};return _0x2215fc;})});}_0x7a81f1=_[_0xfdd4('0x40')]({},_0x7a81f1,_0x7711ea[_0xfdd4('0x42')]);return _0x4d123f[_0xfdd4('0x76')](_0x7a81f1);}})[_0xfdd4('0x22')](function(_0x2683a2){if(_0x2683a2){_0x4bc30f=_0x2683a2[_0xfdd4('0x36')];if(!_0x7711ea[_0xfdd4('0x30')][_0xfdd4('0x37')](_0xfdd4('0x38'))){_0x7a81f1[_0xfdd4('0x1c')]=qs[_0xfdd4('0x1c')](_0x7711ea[_0xfdd4('0x30')][_0xfdd4('0x1c')]);_0x7a81f1[_0xfdd4('0x1b')]=qs[_0xfdd4('0x1b')](_0x7711ea[_0xfdd4('0x30')][_0xfdd4('0x1b')]);}return _0x4d123f[_0xfdd4('0x76')](_0x7a81f1);}})[_0xfdd4('0x22')](function(_0x2ef9bb){if(_0x2ef9bb){return _0x2ef9bb?{'count':_0x4bc30f,'rows':_0x2ef9bb}:null;}})[_0xfdd4('0x22')](respondWithResult(_0x1c69de,null))['catch'](handleError(_0x1c69de,null));}; \ No newline at end of file +var _0x955f=['findAll','loginInPause','voicePause','interface','UserVoiceQueueRt','upsert','format','omit','spread','emit','userTeam:save','removeAgents','userTeam:remove','getAgents','findOne','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','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Teams','error','stack','name','index','Team','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','add','day','filter','merge','map','options','includeAll','rows','show','params','length','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','channel','Sequelize','ValidationError','capitalize','Queue','pick','toLowerCase','Queues','addQueues','isValidChannel','Unknown\x20channel','ids','removeQueues','remove','addAgents','each','voice','chat','sms','fax','openchannel','User'];(function(_0x561e66,_0x2c061d){var _0x374c72=function(_0x32c041){while(--_0x32c041){_0x561e66['push'](_0x561e66['shift']());}};_0x374c72(++_0x2c061d);}(_0x955f,0x1eb));var _0xf955=function(_0x3f9680,_0x18c75e){_0x3f9680=_0x3f9680-0x0;var _0x336528=_0x955f[_0x3f9680];return _0x336528;};'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'];config[_0xf955('0x14')]=_[_0xf955('0x15')](config['redis'],{'host':_0xf955('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf955('0x14')]));require('./team.socket')[_0xf955('0x17')](socket);function respondWithStatusCode(_0x2ff7e5,_0x22507a){_0x22507a=_0x22507a||0xcc;return function(_0x109bc5){if(_0x109bc5){return _0x2ff7e5[_0xf955('0x18')](_0x22507a);}return _0x2ff7e5[_0xf955('0x19')](_0x22507a)[_0xf955('0x1a')]();};}function respondWithResult(_0x2783f2,_0x3c6af7){_0x3c6af7=_0x3c6af7||0xc8;return function(_0x24e75c){if(_0x24e75c){return _0x2783f2['status'](_0x3c6af7)[_0xf955('0x1b')](_0x24e75c);}};}function respondWithFilteredResult(_0x54e60b,_0x3139d5){return function(_0x3a814f){if(_0x3a814f){var _0x2f881b=_0x3a814f[_0xf955('0x1c')],_0x15c07c=_0x3139d5[_0xf955('0x1d')],_0x50930d=_0x3139d5[_0xf955('0x1d')]+_0x3139d5['limit'],_0x5ac6cb;if(_0x50930d>=_0x2f881b){_0x50930d=_0x2f881b;_0x5ac6cb=0xc8;}else{_0x5ac6cb=0xce;}_0x54e60b[_0xf955('0x19')](_0x5ac6cb);return _0x54e60b[_0xf955('0x1e')](_0xf955('0x1f'),_0x15c07c+'-'+_0x50930d+'/'+_0x2f881b)[_0xf955('0x1b')](_0x3a814f);}return null;};}function patchUpdates(_0x3ae4fb){return function(_0x5f4d9a){try{jsonpatch[_0xf955('0x20')](_0x5f4d9a,_0x3ae4fb,!![]);}catch(_0x3dbbe8){return BPromise[_0xf955('0x21')](_0x3dbbe8);}return _0x5f4d9a['save']();};}function saveUpdates(_0x43a5f2,_0x5daa73){return function(_0x21ae24){if(_0x21ae24){return _0x21ae24[_0xf955('0x22')](_0x43a5f2)[_0xf955('0x23')](function(_0xa4ebb4){return _0xa4ebb4;});}return null;};}function removeEntity(_0x160071,_0x565641){return function(_0x25f4f2){if(_0x25f4f2){return _0x25f4f2[_0xf955('0x24')]()[_0xf955('0x23')](function(){var _0x13a1a7=_0x25f4f2[_0xf955('0x25')]({'plain':!![]});var _0x102e36=_0xf955('0x26');return db['UserProfileResource'][_0xf955('0x24')]({'where':{'type':_0x102e36,'resourceId':_0x13a1a7['id']}})[_0xf955('0x23')](function(){return _0x25f4f2;});})[_0xf955('0x23')](function(){_0x160071[_0xf955('0x19')](0xcc)[_0xf955('0x1a')]();});}};}function handleEntityNotFound(_0x13a86d,_0x3796f7){return function(_0x51f3ab){if(!_0x51f3ab){_0x13a86d[_0xf955('0x18')](0x194);}return _0x51f3ab;};}function handleError(_0x145098,_0x41c9f6){_0x41c9f6=_0x41c9f6||0x1f4;return function(_0xbd0b74){logger[_0xf955('0x27')](_0xbd0b74[_0xf955('0x28')]);if(_0xbd0b74['name']){delete _0xbd0b74[_0xf955('0x29')];}_0x145098[_0xf955('0x19')](_0x41c9f6)['send'](_0xbd0b74);};}exports[_0xf955('0x2a')]=function(_0x2c8df1,_0xf3c870){var _0x1ef794={},_0x59bfb5={},_0x3a951c={'count':0x0,'rows':[]};var _0x518fb3=db[_0xf955('0x2b')][_0xf955('0x2c')];_0x59bfb5[_0xf955('0x2d')]=_[_0xf955('0x2e')](_0x518fb3);var _0x1e8024={'dateStart':_0x2c8df1[_0xf955('0x2f')][_0xf955('0x30')],'dateEnd':_0x2c8df1[_0xf955('0x2f')]['dateEnd']};delete _0x2c8df1[_0xf955('0x2f')][_0xf955('0x30')];delete _0x2c8df1[_0xf955('0x2f')][_0xf955('0x31')];_0x59bfb5['query']=_[_0xf955('0x2e')](_0x2c8df1[_0xf955('0x2f')]);_0x59bfb5[_0xf955('0x32')]=_[_0xf955('0x33')](_0x59bfb5[_0xf955('0x2d')],_0x59bfb5['query']);_0x1ef794['attributes']=_['intersection'](_0x59bfb5[_0xf955('0x2d')],qs[_0xf955('0x34')](_0x2c8df1[_0xf955('0x2f')][_0xf955('0x34')]));_0x1ef794[_0xf955('0x35')]=_0x1ef794[_0xf955('0x35')]['length']?_0x1ef794[_0xf955('0x35')]:_0x59bfb5['model'];if(!_0x2c8df1[_0xf955('0x2f')][_0xf955('0x36')](_0xf955('0x37'))){_0x1ef794['limit']=qs[_0xf955('0x38')](_0x2c8df1['query'][_0xf955('0x38')]);_0x1ef794[_0xf955('0x1d')]=qs[_0xf955('0x1d')](_0x2c8df1[_0xf955('0x2f')]['offset']);}_0x1ef794[_0xf955('0x39')]=qs[_0xf955('0x3a')](_0x2c8df1['query'][_0xf955('0x3a')]);_0x1ef794[_0xf955('0x3b')]=qs[_0xf955('0x32')](_['pick'](_0x2c8df1[_0xf955('0x2f')],_0x59bfb5[_0xf955('0x32')]));if(_0x1e8024[_0xf955('0x30')]){if(_0x1e8024['dateEnd']){_0x1e8024[_0xf955('0x31')]=moment(_0x1e8024[_0xf955('0x31')])[_0xf955('0x3c')](0x1,_0xf955('0x3d'));}else{_0x1e8024[_0xf955('0x31')]=moment(_0x1e8024[_0xf955('0x30')])[_0xf955('0x3c')](0x1,_0xf955('0x3d'));}_['merge'](_0x1ef794[_0xf955('0x3b')],{'createdAt':{'$gte':_0x1e8024[_0xf955('0x30')],'$lte':_0x1e8024[_0xf955('0x31')]}});}if(_0x2c8df1[_0xf955('0x2f')][_0xf955('0x3e')]){_0x1ef794[_0xf955('0x3b')]=_[_0xf955('0x3f')](_0x1ef794[_0xf955('0x3b')],{'$or':_[_0xf955('0x40')](_0x1ef794[_0xf955('0x35')],function(_0x713954){var _0x1c72b8={};_0x1c72b8[_0x713954]={'$like':'%'+_0x2c8df1[_0xf955('0x2f')][_0xf955('0x3e')]+'%'};return _0x1c72b8;})});}_0x1ef794=_[_0xf955('0x3f')]({},_0x1ef794,_0x2c8df1[_0xf955('0x41')]);var _0x356ec2={'where':_0x1ef794[_0xf955('0x3b')]};return db[_0xf955('0x2b')]['count'](_0x356ec2)[_0xf955('0x23')](function(_0x25d809){_0x3a951c[_0xf955('0x1c')]=_0x25d809;if(_0x2c8df1['query'][_0xf955('0x42')]){_0x1ef794['include']=[{'all':!![]}];}return db[_0xf955('0x2b')]['findAll'](_0x1ef794);})[_0xf955('0x23')](function(_0x24cb74){_0x3a951c[_0xf955('0x43')]=_0x24cb74;return _0x3a951c;})[_0xf955('0x23')](respondWithFilteredResult(_0xf3c870,_0x1ef794))['catch'](handleError(_0xf3c870,null));};exports[_0xf955('0x44')]=function(_0xdb1cc,_0x12321e){var _0x4f2d55={'raw':![],'where':{'id':_0xdb1cc[_0xf955('0x45')]['id']}},_0x5e98ae={};_0x5e98ae[_0xf955('0x2d')]=_[_0xf955('0x2e')](db[_0xf955('0x2b')]['rawAttributes']);_0x5e98ae[_0xf955('0x2f')]=_[_0xf955('0x2e')](_0xdb1cc[_0xf955('0x2f')]);_0x5e98ae['filters']=_[_0xf955('0x33')](_0x5e98ae['model'],_0x5e98ae[_0xf955('0x2f')]);_0x4f2d55[_0xf955('0x35')]=_[_0xf955('0x33')](_0x5e98ae['model'],qs[_0xf955('0x34')](_0xdb1cc[_0xf955('0x2f')][_0xf955('0x34')]));_0x4f2d55[_0xf955('0x35')]=_0x4f2d55['attributes'][_0xf955('0x46')]?_0x4f2d55[_0xf955('0x35')]:_0x5e98ae[_0xf955('0x2d')];if(_0xdb1cc[_0xf955('0x2f')][_0xf955('0x42')]){_0x4f2d55['include']=[{'all':!![]}];}_0x4f2d55=_[_0xf955('0x3f')]({},_0x4f2d55,_0xdb1cc['options']);return db[_0xf955('0x2b')]['find'](_0x4f2d55)[_0xf955('0x23')](handleEntityNotFound(_0x12321e,null))['then'](respondWithResult(_0x12321e,null))['catch'](handleError(_0x12321e,null));};exports[_0xf955('0x47')]=function(_0x45c7fe,_0x4961cc){return db[_0xf955('0x2b')]['create'](_0x45c7fe['body'],{})['then'](function(_0x5c427c){var _0x3c37e2=_0x45c7fe[_0xf955('0x48')]['get']({'plain':!![]});if(!_0x3c37e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c37e2[_0xf955('0x49')]===_0xf955('0x48')){var _0x460052=_0x5c427c[_0xf955('0x25')]({'plain':!![]});var _0x1b7b21=_0xf955('0x26');return db[_0xf955('0x4a')][_0xf955('0x4b')]({'where':{'name':_0x1b7b21,'userProfileId':_0x3c37e2[_0xf955('0x4c')]},'raw':!![]})[_0xf955('0x23')](function(_0x1b7b73){if(_0x1b7b73&&_0x1b7b73[_0xf955('0x4d')]===0x0){return db['UserProfileResource'][_0xf955('0x47')]({'name':_0x460052[_0xf955('0x29')],'resourceId':_0x460052['id'],'type':_0x1b7b73[_0xf955('0x29')],'sectionId':_0x1b7b73['id']},{})[_0xf955('0x23')](function(){return _0x5c427c;});}else{return _0x5c427c;}})[_0xf955('0x4e')](function(_0x4dc34b){logger[_0xf955('0x27')](_0xf955('0x4f'),_0x4dc34b);throw _0x4dc34b;});}return _0x5c427c;})[_0xf955('0x23')](respondWithResult(_0x4961cc,0xc9))[_0xf955('0x4e')](handleError(_0x4961cc,null));};exports[_0xf955('0x22')]=function(_0x9057df,_0x228d59){if(_0x9057df[_0xf955('0x50')]['id']){delete _0x9057df[_0xf955('0x50')]['id'];}return db[_0xf955('0x2b')]['find']({'where':{'id':_0x9057df[_0xf955('0x45')]['id']}})[_0xf955('0x23')](handleEntityNotFound(_0x228d59,null))[_0xf955('0x23')](saveUpdates(_0x9057df[_0xf955('0x50')],null))[_0xf955('0x23')](respondWithResult(_0x228d59,null))[_0xf955('0x4e')](handleError(_0x228d59,null));};exports[_0xf955('0x24')]=function(_0x30b673,_0x948963){return db[_0xf955('0x2b')][_0xf955('0x4b')]({'where':{'id':_0x30b673[_0xf955('0x45')]['id']}})['then'](handleEntityNotFound(_0x948963,null))[_0xf955('0x23')](removeEntity(_0x948963,null))[_0xf955('0x4e')](handleError(_0x948963,null));};exports[_0xf955('0x51')]=function(_0x3eb727,_0x3c2cfd,_0x3171ba){return db[_0xf955('0x2b')]['findOne']({'where':{'id':_0x3eb727['params']['id']}})['then'](handleEntityNotFound(_0x3c2cfd,null))[_0xf955('0x23')](function(_0x530ec7){if(!_0x3eb727['query'][_0xf955('0x52')]||!utils['isValidChannel'](_0x3eb727[_0xf955('0x2f')][_0xf955('0x52')])){throw new db[(_0xf955('0x53'))][(_0xf955('0x54'))]('Unknown\x20channel');}var _0x349d76={};var _0x9e3437={};_0x9e3437[_0xf955('0x2d')]=_[_0xf955('0x2e')](db[_[_0xf955('0x55')](_0x3eb727['query'][_0xf955('0x52')]['toLowerCase']())+_0xf955('0x56')][_0xf955('0x2c')]);_0x9e3437[_0xf955('0x2f')]=_['keys'](_0x3eb727[_0xf955('0x2f')]);_0x9e3437[_0xf955('0x32')]=_[_0xf955('0x33')](_0x9e3437[_0xf955('0x2d')],_0x9e3437[_0xf955('0x2f')]);_0x349d76[_0xf955('0x35')]=_[_0xf955('0x33')](_0x9e3437['model'],qs['fields'](_0x3eb727[_0xf955('0x2f')][_0xf955('0x34')]));_0x349d76[_0xf955('0x35')]=_0x349d76[_0xf955('0x35')][_0xf955('0x46')]?_0x349d76[_0xf955('0x35')]:_0x9e3437[_0xf955('0x2d')];_0x349d76[_0xf955('0x38')]=qs[_0xf955('0x38')](_0x3eb727[_0xf955('0x2f')][_0xf955('0x38')]);_0x349d76['offset']=qs[_0xf955('0x1d')](_0x3eb727['query'][_0xf955('0x1d')]);_0x349d76['order']=qs['sort'](_0x3eb727[_0xf955('0x2f')][_0xf955('0x3a')]);_0x349d76['where']=qs[_0xf955('0x32')](_[_0xf955('0x57')](_0x3eb727['query'],_0x9e3437['filters']));_0x349d76=_[_0xf955('0x3f')]({},_0x349d76,_0x3eb727[_0xf955('0x41')]);return _0x530ec7[_0xf955('0x25')+_['capitalize'](_0x3eb727[_0xf955('0x2f')][_0xf955('0x52')][_0xf955('0x58')]())+_0xf955('0x59')](_0x349d76);})[_0xf955('0x23')](respondWithResult(_0x3c2cfd,null))[_0xf955('0x4e')](handleError(_0x3c2cfd,null));};exports[_0xf955('0x5a')]=function(_0xf1e40b,_0x5a45da,_0x3960ec){return db[_0xf955('0x2b')]['findOne']({'where':{'id':_0xf1e40b[_0xf955('0x45')]['id']}})[_0xf955('0x23')](function(_0x54dac){if(_0x54dac){if(!_0xf1e40b[_0xf955('0x50')]['channel']||!utils[_0xf955('0x5b')](_0xf1e40b[_0xf955('0x50')]['channel'])){throw new db['Sequelize'][(_0xf955('0x54'))](_0xf955('0x5c'));}return _0x54dac[_0xf955('0x3c')+_[_0xf955('0x55')](_0xf1e40b['body'][_0xf955('0x52')][_0xf955('0x58')]())+_0xf955('0x59')](_0xf1e40b[_0xf955('0x50')][_0xf955('0x5d')]);}return null;})[_0xf955('0x23')](handleEntityNotFound(_0x5a45da,null))[_0xf955('0x23')](respondWithStatusCode(_0x5a45da,null))[_0xf955('0x4e')](handleError(_0x5a45da,null));};exports[_0xf955('0x5e')]=function(_0x12d8d1,_0x2c7ba5,_0x102ef0){return db[_0xf955('0x2b')]['findOne']({'where':{'id':_0x12d8d1[_0xf955('0x45')]['id']}})[_0xf955('0x23')](function(_0x1d9469){if(_0x1d9469){if(!_0x12d8d1[_0xf955('0x2f')]['channel']||!utils[_0xf955('0x5b')](_0x12d8d1[_0xf955('0x2f')][_0xf955('0x52')])){throw new db[(_0xf955('0x53'))][(_0xf955('0x54'))](_0xf955('0x5c'));}return _0x1d9469[_0xf955('0x5f')+_[_0xf955('0x55')](_0x12d8d1[_0xf955('0x2f')][_0xf955('0x52')][_0xf955('0x58')]())+'Queues'](_0x12d8d1[_0xf955('0x2f')][_0xf955('0x5d')]);}return null;})[_0xf955('0x23')](handleEntityNotFound(_0x2c7ba5,null))[_0xf955('0x23')](respondWithStatusCode(_0x2c7ba5,null))[_0xf955('0x4e')](handleError(_0x2c7ba5,null));};exports[_0xf955('0x60')]=function(_0x1cd55b,_0x57f27f,_0xa83204){return db['Team'][_0xf955('0x4b')]({'where':{'id':_0x1cd55b['params']['id']}})[_0xf955('0x23')](handleEntityNotFound(_0x57f27f,null))[_0xf955('0x23')](function(_0x3f76ce){if(_0x3f76ce){return BPromise[_0xf955('0x61')]([_0xf955('0x62'),_0xf955('0x63'),'mail',_0xf955('0x64'),_0xf955('0x65'),_0xf955('0x66')],function(_0x4e2410){return _0x3f76ce['get'+_[_0xf955('0x55')](_0x4e2410)+_0xf955('0x59')]({'attributes':['id',_0xf955('0x29')]})['then'](function(_0x3ee844){return BPromise['each'](_0x3ee844,function(_0x36c23e){return _0x36c23e['addAgents'](_0x1cd55b[_0xf955('0x50')][_0xf955('0x5d')])[_0xf955('0x23')](function(){if(_0x4e2410==='voice'){return db[_0xf955('0x67')][_0xf955('0x68')]({'where':{'id':_0x1cd55b[_0xf955('0x50')]['ids']},'attributes':['id',_0xf955('0x29'),_0xf955('0x69'),_0xf955('0x6a'),_0xf955('0x6b')],'raw':!![]});}})[_0xf955('0x23')](function(_0x130e1a){if(_0x4e2410===_0xf955('0x62')){return BPromise['each'](_0x130e1a,function(_0x308c9e){return db[_0xf955('0x6c')][_0xf955('0x6d')]({'membername':_0x308c9e[_0xf955('0x29')],'UserId':_0x308c9e['id'],'queue_name':_0x36c23e[_0xf955('0x29')],'VoiceQueueId':_0x36c23e['id'],'interface':_['isNil'](_0x308c9e[_0xf955('0x6b')])?util[_0xf955('0x6e')]('SIP/%s',_0x308c9e['name']):_0x308c9e[_0xf955('0x6b')],'paused':_0x308c9e[_0xf955('0x6a')]||![],'penalty':0x0});});}});});})[_0xf955('0x23')](function(){return _0x3f76ce;});})[_0xf955('0x23')](function(){return _0x3f76ce;});}})['then'](function(_0x39f7ab){if(_0x39f7ab){return _0x39f7ab['addAgents'](_0x1cd55b['body'][_0xf955('0x5d')],_[_0xf955('0x6f')](_0x1cd55b['body'],['ids','id'])||{})[_0xf955('0x70')](function(_0x10f8b6){for(var _0x13e548=0x0;_0x13e548<_0x1cd55b['body']['ids'][_0xf955('0x46')];_0x13e548+=0x1){socket[_0xf955('0x71')](_0xf955('0x72'),{'UserId':_0x1cd55b['body']['ids'][_0x13e548],'TeamId':_0x1cd55b['params']['id']});}return _0x10f8b6;});}})['then'](respondWithResult(_0x57f27f,null))[_0xf955('0x4e')](handleError(_0x57f27f,null));};exports['removeAgents']=function(_0x44efad,_0x452091,_0x3b04da){var _0x3fa45e;return db[_0xf955('0x2b')]['find']({'where':{'id':_0x44efad[_0xf955('0x45')]['id']}})[_0xf955('0x23')](handleEntityNotFound(_0x452091,null))[_0xf955('0x23')](function(_0x39b7b4){if(_0x39b7b4){return BPromise['each']([_0xf955('0x62'),_0xf955('0x63'),'mail',_0xf955('0x64'),_0xf955('0x65'),_0xf955('0x66')],function(_0x25d7d6){return _0x39b7b4[_0xf955('0x25')+_[_0xf955('0x55')](_0x25d7d6)+'Queues']({'attributes':['id','name']})[_0xf955('0x23')](function(_0x545275){return BPromise[_0xf955('0x61')](_0x545275,function(_0x146bfc){return _0x146bfc[_0xf955('0x73')](_0x44efad[_0xf955('0x2f')]['ids'])['then'](function(){if(_0x25d7d6===_0xf955('0x62')){return db[_0xf955('0x6c')][_0xf955('0x24')]({'where':{'VoiceQueueId':_0x146bfc['id'],'UserId':_0x44efad[_0xf955('0x2f')][_0xf955('0x5d')]}});}});});})['then'](function(){return _0x39b7b4;});})[_0xf955('0x23')](function(){return _0x39b7b4;});}})[_0xf955('0x23')](function(_0x1ba6b1){if(_0x1ba6b1){return _0x1ba6b1[_0xf955('0x73')](_0x44efad['query']['ids'])[_0xf955('0x23')](function(_0x14123e){if(_['isArray'](_0x44efad[_0xf955('0x2f')][_0xf955('0x5d')])){for(var _0x395e56=0x0;_0x395e56<_0x44efad[_0xf955('0x2f')]['ids'][_0xf955('0x46')];_0x395e56+=0x1){socket[_0xf955('0x71')](_0xf955('0x74'),{'UserId':_0x44efad[_0xf955('0x2f')][_0xf955('0x5d')][_0x395e56],'TeamId':_0x44efad[_0xf955('0x45')]['id']});}}else{socket[_0xf955('0x71')]('userTeam:remove',{'UserId':_0x44efad['query']['ids'],'TeamId':_0x44efad[_0xf955('0x45')]['id']});}});}})[_0xf955('0x23')](respondWithStatusCode(_0x452091,null))[_0xf955('0x4e')](handleError(_0x452091,null));};exports[_0xf955('0x75')]=function(_0x1a672b,_0x35aa70,_0x17e25c){var _0x4d4ede={};var _0x513218={};var _0x1bce14;var _0x56eb0c;return db[_0xf955('0x2b')][_0xf955('0x76')]({'where':{'id':_0x1a672b[_0xf955('0x45')]['id']}})[_0xf955('0x23')](handleEntityNotFound(_0x35aa70,null))[_0xf955('0x23')](function(_0x1eb23){if(_0x1eb23){_0x1bce14=_0x1eb23;_0x513218[_0xf955('0x2d')]=_[_0xf955('0x2e')](db['User']['rawAttributes']);_0x513218['query']=_[_0xf955('0x2e')](_0x1a672b[_0xf955('0x2f')]);_0x513218[_0xf955('0x32')]=_[_0xf955('0x33')](_0x513218[_0xf955('0x2d')],_0x513218['query']);_0x4d4ede[_0xf955('0x35')]=_[_0xf955('0x33')](_0x513218[_0xf955('0x2d')],qs[_0xf955('0x34')](_0x1a672b[_0xf955('0x2f')][_0xf955('0x34')]));_0x4d4ede[_0xf955('0x35')]=_0x4d4ede[_0xf955('0x35')][_0xf955('0x46')]?_0x4d4ede['attributes']:_0x513218[_0xf955('0x2d')];_0x4d4ede['order']=qs[_0xf955('0x3a')](_0x1a672b[_0xf955('0x2f')][_0xf955('0x3a')]);_0x4d4ede[_0xf955('0x3b')]=qs[_0xf955('0x32')](_[_0xf955('0x57')](_0x1a672b[_0xf955('0x2f')],_0x513218['filters']));if(_0x1a672b[_0xf955('0x2f')]['filter']){_0x4d4ede[_0xf955('0x3b')]=_[_0xf955('0x3f')](_0x4d4ede['where'],{'$or':_[_0xf955('0x40')](_0x4d4ede[_0xf955('0x35')],function(_0x1d3aa1){var _0x11cc35={};_0x11cc35[_0x1d3aa1]={'$like':'%'+_0x1a672b[_0xf955('0x2f')][_0xf955('0x3e')]+'%'};return _0x11cc35;})});}_0x4d4ede=_[_0xf955('0x3f')]({},_0x4d4ede,_0x1a672b['options']);return _0x1bce14[_0xf955('0x75')](_0x4d4ede);}})[_0xf955('0x23')](function(_0x5cb03a){if(_0x5cb03a){_0x56eb0c=_0x5cb03a[_0xf955('0x46')];if(!_0x1a672b[_0xf955('0x2f')]['hasOwnProperty']('nolimit')){_0x4d4ede[_0xf955('0x38')]=qs[_0xf955('0x38')](_0x1a672b[_0xf955('0x2f')]['limit']);_0x4d4ede[_0xf955('0x1d')]=qs[_0xf955('0x1d')](_0x1a672b[_0xf955('0x2f')][_0xf955('0x1d')]);}return _0x1bce14[_0xf955('0x75')](_0x4d4ede);}})[_0xf955('0x23')](function(_0x1a2ecc){if(_0x1a2ecc){return _0x1a2ecc?{'count':_0x56eb0c,'rows':_0x1a2ecc}:null;}})[_0xf955('0x23')](respondWithResult(_0x35aa70,null))[_0xf955('0x4e')](handleError(_0x35aa70,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2f0b698..6c393cf 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 _0x7a59=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x7a59,0x96));var _0x97a5=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x7a59[_0x12f688];return _0x59c3de;};'use strict';var EventEmitter=require(_0x97a5('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x97a5('0x1')](0x0);var events={'afterCreate':_0x97a5('0x2'),'afterUpdate':_0x97a5('0x3'),'afterDestroy':_0x97a5('0x4')};function emitEvent(_0x555fba){return function(_0x4a479c,_0x2fe105,_0x468a7a){TeamEvents[_0x97a5('0x5')](_0x555fba+':'+_0x4a479c['id'],_0x4a479c);TeamEvents[_0x97a5('0x5')](_0x555fba,_0x4a479c);_0x468a7a(null);};}for(var e in events){if(events[_0x97a5('0x6')](e)){var event=events[e];Team[_0x97a5('0x7')](e,emitEvent(event));}}module[_0x97a5('0x8')]=TeamEvents; \ No newline at end of file +var _0x8a4e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x8a4e,0x82));var _0xe8a4=function(_0x31aaeb,_0x6194ef){_0x31aaeb=_0x31aaeb-0x0;var _0x2e97da=_0x8a4e[_0x31aaeb];return _0x2e97da;};'use strict';var EventEmitter=require(_0xe8a4('0x0'));var Team=require(_0xe8a4('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xe8a4('0x2')](0x0);var events={'afterCreate':_0xe8a4('0x3'),'afterUpdate':_0xe8a4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4c9efa){return function(_0x3b38a6,_0x4b1426,_0x2261f6){TeamEvents[_0xe8a4('0x5')](_0x4c9efa+':'+_0x3b38a6['id'],_0x3b38a6);TeamEvents['emit'](_0x4c9efa,_0x3b38a6);_0x2261f6(null);};}for(var e in events){if(events[_0xe8a4('0x6')](e)){var event=events[e];Team[_0xe8a4('0x7')](e,emitEvent(event));}}module[_0xe8a4('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 0fb28e7..ff41492 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 _0x55ca=['bluebird','request-promise','exports','define','Team','teams','lodash','util'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x55ca,0x126));var _0xa55c=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x55ca[_0x57014b];return _0x2b258a;};'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 +var _0x008c=['moment','request-promise','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api'];(function(_0x433195,_0x579f59){var _0x162a9e=function(_0x478469){while(--_0x478469){_0x433195['push'](_0x433195['shift']());}};_0x162a9e(++_0x579f59);}(_0x008c,0x188));var _0xc008=function(_0x49d9db,_0x41347b){_0x49d9db=_0x49d9db-0x0;var _0x5f049d=_0x008c[_0x49d9db];return _0x5f049d;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var attributes=require(_0xc008('0x6'));module[_0xc008('0x7')]=function(_0x163bd9,_0x1cbe76){return _0x163bd9[_0xc008('0x8')](_0xc008('0x9'),attributes,{'tableName':_0xc008('0xa'),'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 6e47351..9363e5f 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 _0x4dff=['http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x4dff,0xf3));var _0xf4df=function(_0x194e05,_0x1d0112){_0x194e05=_0x194e05-0x0;var _0x23f130=_0x4dff[_0x194e05];return _0x23f130;};'use strict';var _=require(_0xf4df('0x0'));var util=require('util');var moment=require(_0xf4df('0x1'));var BPromise=require('bluebird');var rs=require(_0xf4df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4df('0x3'))['db'];var utils=require(_0xf4df('0x4'));var logger=require(_0xf4df('0x5'))(_0xf4df('0x6'));var config=require('../../config/environment');var jayson=require(_0xf4df('0x7'));var client=jayson[_0xf4df('0x8')][_0xf4df('0x9')]({'port':0x232a});config[_0xf4df('0xa')]=_[_0xf4df('0xb')](config[_0xf4df('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf4df('0xc'))(new Redis(config[_0xf4df('0xa')]));require(_0xf4df('0xd'))[_0xf4df('0xe')](socket);function respondWithRpcPromise(_0x1148d5,_0x14fa6,_0x1f8efa){return new BPromise(function(_0x10dc26,_0x3255e9){return client[_0xf4df('0xf')](_0x1148d5,_0x1f8efa)[_0xf4df('0x10')](function(_0x167f04){logger[_0xf4df('0x11')](_0xf4df('0x12'),_0x14fa6,_0xf4df('0x13'));logger[_0xf4df('0x14')](_0xf4df('0x15'),_0x14fa6,_0xf4df('0x13'),JSON[_0xf4df('0x16')](_0x167f04));if(_0x167f04['error']){if(_0x167f04[_0xf4df('0x17')][_0xf4df('0x18')]===0x1f4){logger[_0xf4df('0x17')]('Team,\x20%s,\x20%s',_0x14fa6,_0x167f04[_0xf4df('0x17')]['message']);return _0x3255e9(_0x167f04[_0xf4df('0x17')][_0xf4df('0x19')]);}logger[_0xf4df('0x17')](_0xf4df('0x12'),_0x14fa6,_0x167f04[_0xf4df('0x17')][_0xf4df('0x19')]);return _0x10dc26(_0x167f04[_0xf4df('0x17')]['message']);}else{logger['info']('Team,\x20%s,\x20%s',_0x14fa6,_0xf4df('0x13'));_0x10dc26(_0x167f04[_0xf4df('0x1a')][_0xf4df('0x19')]);}})[_0xf4df('0x1b')](function(_0x44e68a){logger[_0xf4df('0x17')]('Team,\x20%s,\x20%s',_0x14fa6,_0x44e68a);_0x3255e9(_0x44e68a);});});} \ No newline at end of file +var _0xb975=['http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xfc6afd,_0x3f4d11){var _0x27d644=function(_0x1d1c65){while(--_0x1d1c65){_0xfc6afd['push'](_0xfc6afd['shift']());}};_0x27d644(++_0x3f4d11);}(_0xb975,0x1c5));var _0x5b97=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xb975[_0x58e469];return _0x4c01c5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5b97('0x0'));var BPromise=require(_0x5b97('0x1'));var rs=require(_0x5b97('0x2'));var fs=require('fs');var Redis=require(_0x5b97('0x3'));var db=require(_0x5b97('0x4'))['db'];var utils=require(_0x5b97('0x5'));var logger=require(_0x5b97('0x6'))(_0x5b97('0x7'));var config=require(_0x5b97('0x8'));var jayson=require(_0x5b97('0x9'));var client=jayson[_0x5b97('0xa')][_0x5b97('0xb')]({'port':0x232a});config[_0x5b97('0xc')]=_[_0x5b97('0xd')](config['redis'],{'host':_0x5b97('0xe'),'port':0x18eb});var socket=require(_0x5b97('0xf'))(new Redis(config[_0x5b97('0xc')]));require(_0x5b97('0x10'))['register'](socket);function respondWithRpcPromise(_0x1e895d,_0x5048c9,_0x28395a){return new BPromise(function(_0x458753,_0x1f3ba4){return client[_0x5b97('0x11')](_0x1e895d,_0x28395a)['then'](function(_0x35aee7){logger['info'](_0x5b97('0x12'),_0x5048c9,_0x5b97('0x13'));logger[_0x5b97('0x14')](_0x5b97('0x15'),_0x5048c9,'request\x20sent',JSON[_0x5b97('0x16')](_0x35aee7));if(_0x35aee7[_0x5b97('0x17')]){if(_0x35aee7[_0x5b97('0x17')][_0x5b97('0x18')]===0x1f4){logger[_0x5b97('0x17')]('Team,\x20%s,\x20%s',_0x5048c9,_0x35aee7[_0x5b97('0x17')]['message']);return _0x1f3ba4(_0x35aee7[_0x5b97('0x17')][_0x5b97('0x19')]);}logger['error'](_0x5b97('0x12'),_0x5048c9,_0x35aee7[_0x5b97('0x17')]['message']);return _0x458753(_0x35aee7[_0x5b97('0x17')][_0x5b97('0x19')]);}else{logger[_0x5b97('0x1a')](_0x5b97('0x12'),_0x5048c9,_0x5b97('0x13'));_0x458753(_0x35aee7[_0x5b97('0x1b')][_0x5b97('0x19')]);}})[_0x5b97('0x1c')](function(_0x1dc536){logger[_0x5b97('0x17')](_0x5b97('0x12'),_0x5048c9,_0x1dc536);_0x1f3ba4(_0x1dc536);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index b7d2699..6aa5623 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 _0x7f4e=['./team.events','remove','update','emit','register','team:'];(function(_0x3c7cb2,_0x311f39){var _0x29b9c4=function(_0xa0ca37){while(--_0xa0ca37){_0x3c7cb2['push'](_0x3c7cb2['shift']());}};_0x29b9c4(++_0x311f39);}(_0x7f4e,0x66));var _0xe7f4=function(_0x38cdaf,_0x3b9537){_0x38cdaf=_0x38cdaf-0x0;var _0x428a5b=_0x7f4e[_0x38cdaf];return _0x428a5b;};'use strict';var TeamEvents=require(_0xe7f4('0x0'));var events=['save',_0xe7f4('0x1'),_0xe7f4('0x2')];function createListener(_0xeb452c,_0x14f03f){return function(_0x44c814){_0x14f03f[_0xe7f4('0x3')](_0xeb452c,_0x44c814);};}function removeListener(_0x548295,_0x3357b2){return function(){TeamEvents['removeListener'](_0x548295,_0x3357b2);};}exports[_0xe7f4('0x4')]=function(_0x109e54){for(var _0x51488c=0x0,_0x405c12=events['length'];_0x51488c<_0x405c12;_0x51488c++){var _0x4b8cf3=events[_0x51488c];var _0x1ca432=createListener(_0xe7f4('0x5')+_0x4b8cf3,_0x109e54);TeamEvents['on'](_0x4b8cf3,_0x1ca432);}}; \ No newline at end of file +var _0x53ef=['emit','register','length','save','remove','update'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x53ef,0x105));var _0xf53e=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x53ef[_0x58547b];return _0x1d3fd2;};'use strict';var TeamEvents=require('./team.events');var events=[_0xf53e('0x0'),_0xf53e('0x1'),_0xf53e('0x2')];function createListener(_0x3ab20f,_0x12e16f){return function(_0x380589){_0x12e16f[_0xf53e('0x3')](_0x3ab20f,_0x380589);};}function removeListener(_0x17b28c,_0x19b625){return function(){TeamEvents['removeListener'](_0x17b28c,_0x19b625);};}exports[_0xf53e('0x4')]=function(_0x55ffc1){for(var _0x3f12ca=0x0,_0x5d3531=events[_0xf53e('0x5')];_0x3f12ca<_0x5d3531;_0x3f12ca++){var _0x5a1549=events[_0x3f12ca];var _0x1723cb=createListener('team:'+_0x5a1549,_0x55ffc1);TeamEvents['on'](_0x5a1549,_0x1723cb);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index e4250a4..5ec4d48 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 _0x3e8e=['isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x3e8e,0x1ba));var _0xe3e8=function(_0xf52277,_0x8f1208){_0xf52277=_0xf52277-0x0;var _0x160269=_0x3e8e[_0xf52277];return _0x160269;};'use strict';var multer=require(_0xe3e8('0x0'));var util=require(_0xe3e8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe3e8('0x2'));var router=express['Router']();var auth=require(_0xe3e8('0x3'));var interaction=require(_0xe3e8('0x4'));var config=require(_0xe3e8('0x5'));var controller=require(_0xe3e8('0x6'));router[_0xe3e8('0x7')]('/',auth[_0xe3e8('0x8')](),controller[_0xe3e8('0x9')]);router['get']('/:id',auth[_0xe3e8('0x8')](),controller[_0xe3e8('0xa')]);router[_0xe3e8('0xb')]('/',auth[_0xe3e8('0x8')](),controller['create']);router[_0xe3e8('0xc')](_0xe3e8('0xd'),auth[_0xe3e8('0x8')](),controller[_0xe3e8('0xe')]);router[_0xe3e8('0xf')](_0xe3e8('0xd'),auth[_0xe3e8('0x8')](),controller[_0xe3e8('0x10')]);module[_0xe3e8('0x11')]=router; \ No newline at end of file +var _0x049b=['/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','index','get'];(function(_0x44b2c0,_0xb37216){var _0x5a7f15=function(_0x24cfb4){while(--_0x24cfb4){_0x44b2c0['push'](_0x44b2c0['shift']());}};_0x5a7f15(++_0xb37216);}(_0x049b,0x185));var _0xb049=function(_0x3a091f,_0x5e202d){_0x3a091f=_0x3a091f-0x0;var _0x43356d=_0x049b[_0x3a091f];return _0x43356d;};'use strict';var multer=require('multer');var util=require(_0xb049('0x0'));var path=require(_0xb049('0x1'));var timeout=require(_0xb049('0x2'));var express=require(_0xb049('0x3'));var router=express[_0xb049('0x4')]();var auth=require(_0xb049('0x5'));var interaction=require(_0xb049('0x6'));var config=require(_0xb049('0x7'));var controller=require(_0xb049('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb049('0x9')]);router[_0xb049('0xa')](_0xb049('0xb'),auth['isAuthenticated'](),controller[_0xb049('0xc')]);router[_0xb049('0xd')]('/',auth[_0xb049('0xe')](),controller[_0xb049('0xf')]);router[_0xb049('0x10')](_0xb049('0xb'),auth[_0xb049('0xe')](),controller['update']);router[_0xb049('0x11')](_0xb049('0xb'),auth[_0xb049('0xe')](),controller[_0xb049('0x12')]);module[_0xb049('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f01ece0..10be664 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 _0xcc61=['exports','TEXT','sequelize'];(function(_0x180c9b,_0x13d173){var _0x3ff116=function(_0x241982){while(--_0x241982){_0x180c9b['push'](_0x180c9b['shift']());}};_0x3ff116(++_0x13d173);}(_0xcc61,0x89));var _0x1cc6=function(_0x69832,_0x2673ba){_0x69832=_0x69832-0x0;var _0x3017ae=_0xcc61[_0x69832];return _0x3017ae;};'use strict';var Sequelize=require(_0x1cc6('0x0'));module[_0x1cc6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x1cc6('0x2')]}}; \ No newline at end of file +var _0xbacb=['sequelize','STRING','TEXT'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbacb,0x12c));var _0xbbac=function(_0xf4a519,_0x2aa0bd){_0xf4a519=_0xf4a519-0x0;var _0x3a31dd=_0xbacb[_0xf4a519];return _0x3a31dd;};'use strict';var Sequelize=require(_0xbbac('0x0'));module['exports']={'name':{'type':Sequelize[_0xbbac('0x1')]},'description':{'type':Sequelize[_0xbbac('0x1')]},'html':{'type':Sequelize[_0xbbac('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 2a597f0..746d7e6 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 _0xa106=['zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','end','sendStatus','error','stack','name','index','Template','model','keys','dateStart','query','dateEnd','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','map','filter','count','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','create','user','role','find','userProfileId','autoAssociation','UserProfileResource','body','eml-format','rimraf'];(function(_0x25a8f7,_0x433d5c){var _0x4e7926=function(_0x3f582c){while(--_0x3f582c){_0x25a8f7['push'](_0x25a8f7['shift']());}};_0x4e7926(++_0x433d5c);}(_0xa106,0x17f));var _0x6a10=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xa106[_0xa990b7];return _0x52c99c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6a10('0x0'));var rimraf=require(_0x6a10('0x1'));var zipdir=require(_0x6a10('0x2'));var jsonpatch=require(_0x6a10('0x3'));var rp=require(_0x6a10('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a10('0x5'));var util=require(_0x6a10('0x6'));var path=require(_0x6a10('0x7'));var sox=require(_0x6a10('0x8'));var csv=require(_0x6a10('0x9'));var ejs=require(_0x6a10('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6a10('0xb'));var crypto=require('crypto');var jsforce=require(_0x6a10('0xc'));var deskjs=require(_0x6a10('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6a10('0xe'));var Redis=require(_0x6a10('0xf'));var qs=require(_0x6a10('0x10'));var logger=require(_0x6a10('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x6a10('0x12'));var db=require(_0x6a10('0x13'))['db'];function respondWithStatusCode(_0x56896a,_0x142b09){_0x142b09=_0x142b09||0xcc;return function(_0x255138){if(_0x255138){return _0x56896a['sendStatus'](_0x142b09);}return _0x56896a['status'](_0x142b09)['end']();};}function respondWithResult(_0x5c3fd0,_0x50e0bd){_0x50e0bd=_0x50e0bd||0xc8;return function(_0x32cb44){if(_0x32cb44){return _0x5c3fd0[_0x6a10('0x14')](_0x50e0bd)[_0x6a10('0x15')](_0x32cb44);}};}function respondWithFilteredResult(_0x1a293e,_0x4debd){return function(_0x320ebd){if(_0x320ebd){var _0x25157a=_0x320ebd['count'],_0xf37069=_0x4debd['offset'],_0x179cb7=_0x4debd[_0x6a10('0x16')]+_0x4debd[_0x6a10('0x17')],_0x2155dd;if(_0x179cb7>=_0x25157a){_0x179cb7=_0x25157a;_0x2155dd=0xc8;}else{_0x2155dd=0xce;}_0x1a293e[_0x6a10('0x14')](_0x2155dd);return _0x1a293e[_0x6a10('0x18')](_0x6a10('0x19'),_0xf37069+'-'+_0x179cb7+'/'+_0x25157a)[_0x6a10('0x15')](_0x320ebd);}return null;};}function patchUpdates(_0x133958){return function(_0x2b4ef8){try{jsonpatch[_0x6a10('0x1a')](_0x2b4ef8,_0x133958,!![]);}catch(_0x294238){return BPromise[_0x6a10('0x1b')](_0x294238);}return _0x2b4ef8[_0x6a10('0x1c')]();};}function saveUpdates(_0x1dd38f,_0x458d02){return function(_0x1979b3){if(_0x1979b3){return _0x1979b3[_0x6a10('0x1d')](_0x1dd38f)[_0x6a10('0x1e')](function(_0x2f0cfd){return _0x2f0cfd;});}return null;};}function removeEntity(_0x20f3d1,_0x329934){return function(_0xc5e61f){if(_0xc5e61f){return _0xc5e61f[_0x6a10('0x1f')]()['then'](function(){var _0x277678=_0xc5e61f[_0x6a10('0x20')]({'plain':!![]});var _0x2df756=_0x6a10('0x21');return db['UserProfileResource'][_0x6a10('0x1f')]({'where':{'type':_0x2df756,'resourceId':_0x277678['id']}})[_0x6a10('0x1e')](function(){return _0xc5e61f;});})['then'](function(){_0x20f3d1[_0x6a10('0x14')](0xcc)[_0x6a10('0x22')]();});}};}function handleEntityNotFound(_0x1675f5,_0x2d0bca){return function(_0x4f4cc4){if(!_0x4f4cc4){_0x1675f5[_0x6a10('0x23')](0x194);}return _0x4f4cc4;};}function handleError(_0x2ec02c,_0x4c949f){_0x4c949f=_0x4c949f||0x1f4;return function(_0x5484ad){logger[_0x6a10('0x24')](_0x5484ad[_0x6a10('0x25')]);if(_0x5484ad['name']){delete _0x5484ad[_0x6a10('0x26')];}_0x2ec02c[_0x6a10('0x14')](_0x4c949f)['send'](_0x5484ad);};}exports[_0x6a10('0x27')]=function(_0x54962e,_0x2ee974){var _0x3b307c={},_0x5c5c80={},_0xced5f8={'count':0x0,'rows':[]};var _0x2e8296=db[_0x6a10('0x28')]['rawAttributes'];_0x5c5c80[_0x6a10('0x29')]=_[_0x6a10('0x2a')](_0x2e8296);var _0x161d16={'dateStart':_0x54962e['query'][_0x6a10('0x2b')],'dateEnd':_0x54962e[_0x6a10('0x2c')][_0x6a10('0x2d')]};delete _0x54962e[_0x6a10('0x2c')][_0x6a10('0x2b')];delete _0x54962e['query'][_0x6a10('0x2d')];_0x5c5c80['query']=_[_0x6a10('0x2a')](_0x54962e[_0x6a10('0x2c')]);_0x5c5c80[_0x6a10('0x2e')]=_['intersection'](_0x5c5c80[_0x6a10('0x29')],_0x5c5c80[_0x6a10('0x2c')]);_0x3b307c[_0x6a10('0x2f')]=_[_0x6a10('0x30')](_0x5c5c80[_0x6a10('0x29')],qs['fields'](_0x54962e[_0x6a10('0x2c')]['fields']));_0x3b307c[_0x6a10('0x2f')]=_0x3b307c[_0x6a10('0x2f')][_0x6a10('0x31')]?_0x3b307c['attributes']:_0x5c5c80[_0x6a10('0x29')];if(!_0x54962e[_0x6a10('0x2c')][_0x6a10('0x32')](_0x6a10('0x33'))){_0x3b307c[_0x6a10('0x17')]=qs[_0x6a10('0x17')](_0x54962e[_0x6a10('0x2c')][_0x6a10('0x17')]);_0x3b307c[_0x6a10('0x16')]=qs['offset'](_0x54962e[_0x6a10('0x2c')][_0x6a10('0x16')]);}_0x3b307c[_0x6a10('0x34')]=qs[_0x6a10('0x35')](_0x54962e[_0x6a10('0x2c')][_0x6a10('0x35')]);_0x3b307c[_0x6a10('0x36')]=qs[_0x6a10('0x2e')](_['pick'](_0x54962e['query'],_0x5c5c80[_0x6a10('0x2e')]));if(_0x161d16[_0x6a10('0x2b')]){if(_0x161d16[_0x6a10('0x2d')]){_0x161d16['dateEnd']=moment(_0x161d16[_0x6a10('0x2d')])[_0x6a10('0x37')](0x1,_0x6a10('0x38'));}else{_0x161d16[_0x6a10('0x2d')]=moment(_0x161d16[_0x6a10('0x2b')])[_0x6a10('0x37')](0x1,'day');}_[_0x6a10('0x39')](_0x3b307c[_0x6a10('0x36')],{'createdAt':{'$gte':_0x161d16[_0x6a10('0x2b')],'$lte':_0x161d16[_0x6a10('0x2d')]}});}if(_0x54962e[_0x6a10('0x2c')]['filter']){_0x3b307c[_0x6a10('0x36')]=_[_0x6a10('0x39')](_0x3b307c['where'],{'$or':_[_0x6a10('0x3a')](_0x3b307c[_0x6a10('0x2f')],function(_0x1dbae5){var _0xd0a970={};_0xd0a970[_0x1dbae5]={'$like':'%'+_0x54962e['query'][_0x6a10('0x3b')]+'%'};return _0xd0a970;})});}_0x3b307c=_[_0x6a10('0x39')]({},_0x3b307c,_0x54962e['options']);var _0x9a63d={'where':_0x3b307c['where']};return db[_0x6a10('0x28')][_0x6a10('0x3c')](_0x9a63d)['then'](function(_0x50a0fc){_0xced5f8[_0x6a10('0x3c')]=_0x50a0fc;if(_0x54962e[_0x6a10('0x2c')][_0x6a10('0x3d')]){_0x3b307c[_0x6a10('0x3e')]=[{'all':!![]}];}return db[_0x6a10('0x28')][_0x6a10('0x3f')](_0x3b307c);})['then'](function(_0x2dc7b4){_0xced5f8[_0x6a10('0x40')]=_0x2dc7b4;return _0xced5f8;})[_0x6a10('0x1e')](respondWithFilteredResult(_0x2ee974,_0x3b307c))[_0x6a10('0x41')](handleError(_0x2ee974,null));};exports['show']=function(_0x1450e8,_0x31d549){var _0x57c3ca={'raw':!![],'where':{'id':_0x1450e8[_0x6a10('0x42')]['id']}},_0x214a5d={};_0x214a5d[_0x6a10('0x29')]=_[_0x6a10('0x2a')](db[_0x6a10('0x28')][_0x6a10('0x43')]);_0x214a5d[_0x6a10('0x2c')]=_['keys'](_0x1450e8['query']);_0x214a5d[_0x6a10('0x2e')]=_[_0x6a10('0x30')](_0x214a5d[_0x6a10('0x29')],_0x214a5d[_0x6a10('0x2c')]);_0x57c3ca[_0x6a10('0x2f')]=_[_0x6a10('0x30')](_0x214a5d[_0x6a10('0x29')],qs[_0x6a10('0x44')](_0x1450e8[_0x6a10('0x2c')]['fields']));_0x57c3ca['attributes']=_0x57c3ca[_0x6a10('0x2f')][_0x6a10('0x31')]?_0x57c3ca[_0x6a10('0x2f')]:_0x214a5d[_0x6a10('0x29')];if(_0x1450e8['query'][_0x6a10('0x3d')]){_0x57c3ca[_0x6a10('0x3e')]=[{'all':!![]}];}_0x57c3ca=_['merge']({},_0x57c3ca,_0x1450e8['options']);return db[_0x6a10('0x28')]['find'](_0x57c3ca)['then'](handleEntityNotFound(_0x31d549,null))[_0x6a10('0x1e')](respondWithResult(_0x31d549,null))['catch'](handleError(_0x31d549,null));};exports['create']=function(_0x3885ed,_0xd693ea){return db['Template'][_0x6a10('0x45')](_0x3885ed['body'],{})[_0x6a10('0x1e')](function(_0x5385a1){var _0x51552a=_0x3885ed[_0x6a10('0x46')][_0x6a10('0x20')]({'plain':!![]});if(!_0x51552a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51552a[_0x6a10('0x47')]==='user'){var _0x23997c=_0x5385a1['get']({'plain':!![]});var _0x5a92c6='Templates';return db['UserProfileSection'][_0x6a10('0x48')]({'where':{'name':_0x5a92c6,'userProfileId':_0x51552a[_0x6a10('0x49')]},'raw':!![]})['then'](function(_0x4c9b51){if(_0x4c9b51&&_0x4c9b51[_0x6a10('0x4a')]===0x0){return db[_0x6a10('0x4b')]['create']({'name':_0x23997c[_0x6a10('0x26')],'resourceId':_0x23997c['id'],'type':_0x4c9b51['name'],'sectionId':_0x4c9b51['id']},{})[_0x6a10('0x1e')](function(){return _0x5385a1;});}else{return _0x5385a1;}})[_0x6a10('0x41')](function(_0x52deca){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52deca);throw _0x52deca;});}return _0x5385a1;})[_0x6a10('0x1e')](respondWithResult(_0xd693ea,0xc9))[_0x6a10('0x41')](handleError(_0xd693ea,null));};exports[_0x6a10('0x1d')]=function(_0xb845f6,_0x627893){if(_0xb845f6['body']['id']){delete _0xb845f6[_0x6a10('0x4c')]['id'];}return db['Template'][_0x6a10('0x48')]({'where':{'id':_0xb845f6[_0x6a10('0x42')]['id']}})[_0x6a10('0x1e')](handleEntityNotFound(_0x627893,null))['then'](saveUpdates(_0xb845f6['body'],null))[_0x6a10('0x1e')](respondWithResult(_0x627893,null))[_0x6a10('0x41')](handleError(_0x627893,null));};exports[_0x6a10('0x1f')]=function(_0x29707,_0x9a5435){return db[_0x6a10('0x28')][_0x6a10('0x48')]({'where':{'id':_0x29707[_0x6a10('0x42')]['id']}})['then'](handleEntityNotFound(_0x9a5435,null))[_0x6a10('0x1e')](removeEntity(_0x9a5435,null))[_0x6a10('0x41')](handleError(_0x9a5435,null));}; \ No newline at end of file +var _0xdac7=['eml-format','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','name','send','index','Template','keys','query','dateEnd','dateStart','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','add','day','merge','where','map','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf'];(function(_0x321723,_0x3ddd2d){var _0x34295d=function(_0xcfa88a){while(--_0xcfa88a){_0x321723['push'](_0x321723['shift']());}};_0x34295d(++_0x3ddd2d);}(_0xdac7,0x180));var _0x7dac=function(_0x521877,_0x415bc5){_0x521877=_0x521877-0x0;var _0x30508=_0xdac7[_0x521877];return _0x30508;};'use strict';var pdf=require(_0x7dac('0x0'));var emlformat=require(_0x7dac('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7dac('0x2'));var moment=require(_0x7dac('0x3'));var BPromise=require(_0x7dac('0x4'));var Mustache=require(_0x7dac('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7dac('0x6'));var ejs=require(_0x7dac('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7dac('0x8'));var crypto=require('crypto');var jsforce=require(_0x7dac('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x7dac('0x6'));var querystring=require(_0x7dac('0xa'));var Papa=require(_0x7dac('0xb'));var Redis=require(_0x7dac('0xc'));var qs=require(_0x7dac('0xd'));var logger=require(_0x7dac('0xe'))(_0x7dac('0xf'));var utils=require(_0x7dac('0x10'));var config=require(_0x7dac('0x11'));var db=require(_0x7dac('0x12'))['db'];function respondWithStatusCode(_0x4dba13,_0x4e3a47){_0x4e3a47=_0x4e3a47||0xcc;return function(_0x4d4625){if(_0x4d4625){return _0x4dba13[_0x7dac('0x13')](_0x4e3a47);}return _0x4dba13['status'](_0x4e3a47)[_0x7dac('0x14')]();};}function respondWithResult(_0x4e5e65,_0x2413ee){_0x2413ee=_0x2413ee||0xc8;return function(_0x22e197){if(_0x22e197){return _0x4e5e65[_0x7dac('0x15')](_0x2413ee)[_0x7dac('0x16')](_0x22e197);}};}function respondWithFilteredResult(_0x1efd1b,_0x2c5dae){return function(_0x752576){if(_0x752576){var _0x53e417=_0x752576[_0x7dac('0x17')],_0x17442e=_0x2c5dae[_0x7dac('0x18')],_0x5171e4=_0x2c5dae[_0x7dac('0x18')]+_0x2c5dae[_0x7dac('0x19')],_0x507951;if(_0x5171e4>=_0x53e417){_0x5171e4=_0x53e417;_0x507951=0xc8;}else{_0x507951=0xce;}_0x1efd1b[_0x7dac('0x15')](_0x507951);return _0x1efd1b['set'](_0x7dac('0x1a'),_0x17442e+'-'+_0x5171e4+'/'+_0x53e417)['json'](_0x752576);}return null;};}function patchUpdates(_0x352a77){return function(_0x4639e2){try{jsonpatch[_0x7dac('0x1b')](_0x4639e2,_0x352a77,!![]);}catch(_0x1ddde7){return BPromise[_0x7dac('0x1c')](_0x1ddde7);}return _0x4639e2[_0x7dac('0x1d')]();};}function saveUpdates(_0x2375c8,_0x34e36b){return function(_0x7a1cac){if(_0x7a1cac){return _0x7a1cac[_0x7dac('0x1e')](_0x2375c8)[_0x7dac('0x1f')](function(_0xb095bb){return _0xb095bb;});}return null;};}function removeEntity(_0x1a9276,_0x356d93){return function(_0x500623){if(_0x500623){return _0x500623['destroy']()[_0x7dac('0x1f')](function(){var _0x4c9fda=_0x500623[_0x7dac('0x20')]({'plain':!![]});var _0x121f2c='Templates';return db[_0x7dac('0x21')][_0x7dac('0x22')]({'where':{'type':_0x121f2c,'resourceId':_0x4c9fda['id']}})['then'](function(){return _0x500623;});})[_0x7dac('0x1f')](function(){_0x1a9276[_0x7dac('0x15')](0xcc)[_0x7dac('0x14')]();});}};}function handleEntityNotFound(_0x179881,_0x31876c){return function(_0x3c9967){if(!_0x3c9967){_0x179881[_0x7dac('0x13')](0x194);}return _0x3c9967;};}function handleError(_0x4b5776,_0x9acd44){_0x9acd44=_0x9acd44||0x1f4;return function(_0x157211){logger[_0x7dac('0x23')](_0x157211['stack']);if(_0x157211['name']){delete _0x157211[_0x7dac('0x24')];}_0x4b5776[_0x7dac('0x15')](_0x9acd44)[_0x7dac('0x25')](_0x157211);};}exports[_0x7dac('0x26')]=function(_0xbad8a1,_0x3d47e9){var _0x3f76fd={},_0x31bbf7={},_0xdd98b1={'count':0x0,'rows':[]};var _0x184887=db[_0x7dac('0x27')]['rawAttributes'];_0x31bbf7['model']=_[_0x7dac('0x28')](_0x184887);var _0xa92c4b={'dateStart':_0xbad8a1[_0x7dac('0x29')]['dateStart'],'dateEnd':_0xbad8a1[_0x7dac('0x29')][_0x7dac('0x2a')]};delete _0xbad8a1[_0x7dac('0x29')][_0x7dac('0x2b')];delete _0xbad8a1['query'][_0x7dac('0x2a')];_0x31bbf7['query']=_[_0x7dac('0x28')](_0xbad8a1[_0x7dac('0x29')]);_0x31bbf7[_0x7dac('0x2c')]=_['intersection'](_0x31bbf7[_0x7dac('0x2d')],_0x31bbf7[_0x7dac('0x29')]);_0x3f76fd[_0x7dac('0x2e')]=_[_0x7dac('0x2f')](_0x31bbf7[_0x7dac('0x2d')],qs[_0x7dac('0x30')](_0xbad8a1['query']['fields']));_0x3f76fd['attributes']=_0x3f76fd[_0x7dac('0x2e')][_0x7dac('0x31')]?_0x3f76fd[_0x7dac('0x2e')]:_0x31bbf7['model'];if(!_0xbad8a1[_0x7dac('0x29')][_0x7dac('0x32')](_0x7dac('0x33'))){_0x3f76fd['limit']=qs[_0x7dac('0x19')](_0xbad8a1[_0x7dac('0x29')][_0x7dac('0x19')]);_0x3f76fd[_0x7dac('0x18')]=qs['offset'](_0xbad8a1[_0x7dac('0x29')][_0x7dac('0x18')]);}_0x3f76fd[_0x7dac('0x34')]=qs[_0x7dac('0x35')](_0xbad8a1[_0x7dac('0x29')][_0x7dac('0x35')]);_0x3f76fd['where']=qs[_0x7dac('0x2c')](_['pick'](_0xbad8a1[_0x7dac('0x29')],_0x31bbf7['filters']));if(_0xa92c4b[_0x7dac('0x2b')]){if(_0xa92c4b[_0x7dac('0x2a')]){_0xa92c4b[_0x7dac('0x2a')]=moment(_0xa92c4b[_0x7dac('0x2a')])[_0x7dac('0x36')](0x1,'day');}else{_0xa92c4b['dateEnd']=moment(_0xa92c4b[_0x7dac('0x2b')])['add'](0x1,_0x7dac('0x37'));}_[_0x7dac('0x38')](_0x3f76fd[_0x7dac('0x39')],{'createdAt':{'$gte':_0xa92c4b[_0x7dac('0x2b')],'$lte':_0xa92c4b[_0x7dac('0x2a')]}});}if(_0xbad8a1[_0x7dac('0x29')]['filter']){_0x3f76fd['where']=_[_0x7dac('0x38')](_0x3f76fd[_0x7dac('0x39')],{'$or':_[_0x7dac('0x3a')](_0x3f76fd[_0x7dac('0x2e')],function(_0x224298){var _0x186894={};_0x186894[_0x224298]={'$like':'%'+_0xbad8a1['query'][_0x7dac('0x3b')]+'%'};return _0x186894;})});}_0x3f76fd=_[_0x7dac('0x38')]({},_0x3f76fd,_0xbad8a1[_0x7dac('0x3c')]);var _0x20346f={'where':_0x3f76fd['where']};return db[_0x7dac('0x27')]['count'](_0x20346f)[_0x7dac('0x1f')](function(_0x2f593b){_0xdd98b1[_0x7dac('0x17')]=_0x2f593b;if(_0xbad8a1[_0x7dac('0x29')][_0x7dac('0x3d')]){_0x3f76fd[_0x7dac('0x3e')]=[{'all':!![]}];}return db['Template'][_0x7dac('0x3f')](_0x3f76fd);})[_0x7dac('0x1f')](function(_0x12e250){_0xdd98b1[_0x7dac('0x40')]=_0x12e250;return _0xdd98b1;})[_0x7dac('0x1f')](respondWithFilteredResult(_0x3d47e9,_0x3f76fd))[_0x7dac('0x41')](handleError(_0x3d47e9,null));};exports[_0x7dac('0x42')]=function(_0x43b426,_0x19a9e4){var _0x21c5dd={'raw':!![],'where':{'id':_0x43b426['params']['id']}},_0x378bb5={};_0x378bb5['model']=_[_0x7dac('0x28')](db[_0x7dac('0x27')]['rawAttributes']);_0x378bb5[_0x7dac('0x29')]=_[_0x7dac('0x28')](_0x43b426[_0x7dac('0x29')]);_0x378bb5[_0x7dac('0x2c')]=_[_0x7dac('0x2f')](_0x378bb5['model'],_0x378bb5[_0x7dac('0x29')]);_0x21c5dd[_0x7dac('0x2e')]=_['intersection'](_0x378bb5[_0x7dac('0x2d')],qs[_0x7dac('0x30')](_0x43b426['query'][_0x7dac('0x30')]));_0x21c5dd[_0x7dac('0x2e')]=_0x21c5dd[_0x7dac('0x2e')][_0x7dac('0x31')]?_0x21c5dd[_0x7dac('0x2e')]:_0x378bb5[_0x7dac('0x2d')];if(_0x43b426[_0x7dac('0x29')][_0x7dac('0x3d')]){_0x21c5dd[_0x7dac('0x3e')]=[{'all':!![]}];}_0x21c5dd=_['merge']({},_0x21c5dd,_0x43b426[_0x7dac('0x3c')]);return db[_0x7dac('0x27')][_0x7dac('0x43')](_0x21c5dd)[_0x7dac('0x1f')](handleEntityNotFound(_0x19a9e4,null))[_0x7dac('0x1f')](respondWithResult(_0x19a9e4,null))[_0x7dac('0x41')](handleError(_0x19a9e4,null));};exports[_0x7dac('0x44')]=function(_0x3cd7a9,_0x14a97a){return db[_0x7dac('0x27')][_0x7dac('0x44')](_0x3cd7a9[_0x7dac('0x45')],{})[_0x7dac('0x1f')](function(_0x377c41){var _0x382d02=_0x3cd7a9[_0x7dac('0x46')][_0x7dac('0x20')]({'plain':!![]});if(!_0x382d02)throw new Error(_0x7dac('0x47'));if(_0x382d02['role']===_0x7dac('0x46')){var _0x5a1256=_0x377c41[_0x7dac('0x20')]({'plain':!![]});var _0x5b4589='Templates';return db[_0x7dac('0x48')][_0x7dac('0x43')]({'where':{'name':_0x5b4589,'userProfileId':_0x382d02[_0x7dac('0x49')]},'raw':!![]})['then'](function(_0x2bec13){if(_0x2bec13&&_0x2bec13[_0x7dac('0x4a')]===0x0){return db[_0x7dac('0x21')][_0x7dac('0x44')]({'name':_0x5a1256[_0x7dac('0x24')],'resourceId':_0x5a1256['id'],'type':_0x2bec13['name'],'sectionId':_0x2bec13['id']},{})[_0x7dac('0x1f')](function(){return _0x377c41;});}else{return _0x377c41;}})[_0x7dac('0x41')](function(_0x5b519e){logger[_0x7dac('0x23')](_0x7dac('0x4b'),_0x5b519e);throw _0x5b519e;});}return _0x377c41;})[_0x7dac('0x1f')](respondWithResult(_0x14a97a,0xc9))['catch'](handleError(_0x14a97a,null));};exports[_0x7dac('0x1e')]=function(_0x1d7739,_0xbac1b){if(_0x1d7739[_0x7dac('0x45')]['id']){delete _0x1d7739[_0x7dac('0x45')]['id'];}return db[_0x7dac('0x27')][_0x7dac('0x43')]({'where':{'id':_0x1d7739['params']['id']}})['then'](handleEntityNotFound(_0xbac1b,null))['then'](saveUpdates(_0x1d7739[_0x7dac('0x45')],null))[_0x7dac('0x1f')](respondWithResult(_0xbac1b,null))['catch'](handleError(_0xbac1b,null));};exports[_0x7dac('0x22')]=function(_0x227a48,_0x2b6d13){return db[_0x7dac('0x27')][_0x7dac('0x43')]({'where':{'id':_0x227a48[_0x7dac('0x4c')]['id']}})[_0x7dac('0x1f')](handleEntityNotFound(_0x2b6d13,null))[_0x7dac('0x1f')](removeEntity(_0x2b6d13,null))[_0x7dac('0x41')](handleError(_0x2b6d13,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 9ee393a..ef61a2c 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 _0xb428=['./template.attributes','exports','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3f2ecf,_0x4ccad6){var _0xa6dd7e=function(_0x5e04c3){while(--_0x5e04c3){_0x3f2ecf['push'](_0x3f2ecf['shift']());}};_0xa6dd7e(++_0x4ccad6);}(_0xb428,0xeb));var _0x8b42=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0xb428[_0x5bb4e8];return _0x2a86f2;};'use strict';var _=require('lodash');var util=require(_0x8b42('0x0'));var logger=require(_0x8b42('0x1'))(_0x8b42('0x2'));var moment=require('moment');var BPromise=require(_0x8b42('0x3'));var rp=require(_0x8b42('0x4'));var attributes=require(_0x8b42('0x5'));module[_0x8b42('0x6')]=function(_0x52714b,_0x3b2293){return _0x52714b[_0x8b42('0x7')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4e0=['../../config/logger','api','moment','bluebird','request-promise','./template.attributes','exports','define','util'];(function(_0x411eb5,_0x2cd241){var _0x338798=function(_0x25013f){while(--_0x25013f){_0x411eb5['push'](_0x411eb5['shift']());}};_0x338798(++_0x2cd241);}(_0xd4e0,0x194));var _0x0d4e=function(_0x269ec9,_0x34f8e0){_0x269ec9=_0x269ec9-0x0;var _0x4436e0=_0xd4e0[_0x269ec9];return _0x4436e0;};'use strict';var _=require('lodash');var util=require(_0x0d4e('0x0'));var logger=require(_0x0d4e('0x1'))(_0x0d4e('0x2'));var moment=require(_0x0d4e('0x3'));var BPromise=require(_0x0d4e('0x4'));var rp=require(_0x0d4e('0x5'));var attributes=require(_0x0d4e('0x6'));module[_0x0d4e('0x7')]=function(_0x14e455,_0x5ab44c){return _0x14e455[_0x0d4e('0x8')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 2a0db42..f350a6d 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 _0x7bdc=['stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s'];(function(_0x2f4c39,_0x1146b1){var _0x3426ab=function(_0x3d35f9){while(--_0x3d35f9){_0x2f4c39['push'](_0x2f4c39['shift']());}};_0x3426ab(++_0x1146b1);}(_0x7bdc,0xac));var _0xc7bd=function(_0x55fb6e,_0x2874ed){_0x55fb6e=_0x55fb6e-0x0;var _0xe88932=_0x7bdc[_0x55fb6e];return _0xe88932;};'use strict';var _=require('lodash');var util=require(_0xc7bd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7bd('0x1'))['db'];var utils=require(_0xc7bd('0x2'));var logger=require(_0xc7bd('0x3'))(_0xc7bd('0x4'));var config=require(_0xc7bd('0x5'));var jayson=require(_0xc7bd('0x6'));var client=jayson[_0xc7bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39aa44,_0x2b4622,_0x2dadf7){return new BPromise(function(_0x2f5831,_0x43bd9f){return client['request'](_0x39aa44,_0x2dadf7)[_0xc7bd('0x8')](function(_0x365fd2){logger[_0xc7bd('0x9')](_0xc7bd('0xa'),_0x2b4622,_0xc7bd('0xb'));logger[_0xc7bd('0xc')](_0xc7bd('0xd'),_0x2b4622,_0xc7bd('0xb'),JSON[_0xc7bd('0xe')](_0x365fd2));if(_0x365fd2[_0xc7bd('0xf')]){if(_0x365fd2[_0xc7bd('0xf')][_0xc7bd('0x10')]===0x1f4){logger[_0xc7bd('0xf')]('Template,\x20%s,\x20%s',_0x2b4622,_0x365fd2[_0xc7bd('0xf')][_0xc7bd('0x11')]);return _0x43bd9f(_0x365fd2[_0xc7bd('0xf')]['message']);}logger[_0xc7bd('0xf')](_0xc7bd('0xa'),_0x2b4622,_0x365fd2['error'][_0xc7bd('0x11')]);return _0x2f5831(_0x365fd2['error'][_0xc7bd('0x11')]);}else{logger[_0xc7bd('0x9')](_0xc7bd('0xa'),_0x2b4622,_0xc7bd('0xb'));_0x2f5831(_0x365fd2[_0xc7bd('0x12')][_0xc7bd('0x11')]);}})[_0xc7bd('0x13')](function(_0x268e6c){logger[_0xc7bd('0xf')](_0xc7bd('0xa'),_0x2b4622,_0x268e6c);_0x43bd9f(_0x268e6c);});});}exports[_0xc7bd('0x14')]=function(_0x5afe60){var _0x89ebe1=this;return new Promise(function(_0x4353f5,_0x442f5e){return db[_0xc7bd('0x15')][_0xc7bd('0x16')]({'raw':_0x5afe60['options']?_0x5afe60[_0xc7bd('0x17')][_0xc7bd('0x18')]===undefined?!![]:![]:!![],'where':_0x5afe60['options']?_0x5afe60[_0xc7bd('0x17')][_0xc7bd('0x19')]||null:null,'attributes':_0x5afe60['options']?_0x5afe60['options'][_0xc7bd('0x1a')]||null:null,'limit':_0x5afe60['options']?_0x5afe60[_0xc7bd('0x17')][_0xc7bd('0x1b')]||null:null,'include':_0x5afe60[_0xc7bd('0x17')]?_0x5afe60[_0xc7bd('0x17')][_0xc7bd('0x1c')]?_[_0xc7bd('0x1d')](_0x5afe60[_0xc7bd('0x17')]['include'],function(_0x58dd93){return{'model':db[_0x58dd93['model']],'as':_0x58dd93['as'],'attributes':_0x58dd93[_0xc7bd('0x1a')],'include':_0x58dd93[_0xc7bd('0x1c')]?_['map'](_0x58dd93[_0xc7bd('0x1c')],function(_0x25751a){return{'model':db[_0x25751a[_0xc7bd('0x1e')]],'as':_0x25751a['as'],'attributes':_0x25751a[_0xc7bd('0x1a')],'include':_0x25751a[_0xc7bd('0x1c')]?_[_0xc7bd('0x1d')](_0x25751a[_0xc7bd('0x1c')],function(_0x10fb9c){return{'model':db[_0x10fb9c[_0xc7bd('0x1e')]],'as':_0x10fb9c['as'],'attributes':_0x10fb9c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc7bd('0x8')](function(_0x3eb1ac){logger[_0xc7bd('0x9')](_0xc7bd('0x14'),_0x5afe60);logger['debug'](_0xc7bd('0x14'),_0x5afe60,JSON[_0xc7bd('0xe')](_0x3eb1ac));_0x4353f5(_0x3eb1ac);})[_0xc7bd('0x13')](function(_0x58181d){logger[_0xc7bd('0xf')](_0xc7bd('0x14'),_0x58181d[_0xc7bd('0x11')],_0x5afe60);_0x442f5e(_0x89ebe1[_0xc7bd('0xf')](0x1f4,_0x58181d['message']));});});}; \ No newline at end of file +var _0x5d56=['then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','map','model','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5102d3,_0x26981c){var _0x2c4ab3=function(_0x2a7d2f){while(--_0x2a7d2f){_0x5102d3['push'](_0x5102d3['shift']());}};_0x2c4ab3(++_0x26981c);}(_0x5d56,0x94));var _0x65d5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5d56[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x65d5('0x0'));var moment=require(_0x65d5('0x1'));var BPromise=require(_0x65d5('0x2'));var rs=require(_0x65d5('0x3'));var fs=require('fs');var Redis=require(_0x65d5('0x4'));var db=require(_0x65d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x65d5('0x6'))(_0x65d5('0x7'));var config=require(_0x65d5('0x8'));var jayson=require(_0x65d5('0x9'));var client=jayson[_0x65d5('0xa')][_0x65d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bccc9,_0x1c2ad0,_0x4d6850){return new BPromise(function(_0x2895f1,_0x51320f){return client['request'](_0x1bccc9,_0x4d6850)[_0x65d5('0xc')](function(_0x1ecab1){logger[_0x65d5('0xd')](_0x65d5('0xe'),_0x1c2ad0,_0x65d5('0xf'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x1c2ad0,'request\x20sent',JSON[_0x65d5('0x10')](_0x1ecab1));if(_0x1ecab1['error']){if(_0x1ecab1['error'][_0x65d5('0x11')]===0x1f4){logger[_0x65d5('0x12')]('Template,\x20%s,\x20%s',_0x1c2ad0,_0x1ecab1[_0x65d5('0x12')][_0x65d5('0x13')]);return _0x51320f(_0x1ecab1['error'][_0x65d5('0x13')]);}logger[_0x65d5('0x12')](_0x65d5('0xe'),_0x1c2ad0,_0x1ecab1[_0x65d5('0x12')]['message']);return _0x2895f1(_0x1ecab1[_0x65d5('0x12')]['message']);}else{logger[_0x65d5('0xd')]('Template,\x20%s,\x20%s',_0x1c2ad0,_0x65d5('0xf'));_0x2895f1(_0x1ecab1['result'][_0x65d5('0x13')]);}})[_0x65d5('0x14')](function(_0x50f24d){logger[_0x65d5('0x12')](_0x65d5('0xe'),_0x1c2ad0,_0x50f24d);_0x51320f(_0x50f24d);});});}exports[_0x65d5('0x15')]=function(_0x4de55a){var _0x4ca81f=this;return new Promise(function(_0x329a9c,_0x3a9a1a){return db[_0x65d5('0x16')][_0x65d5('0x17')]({'raw':_0x4de55a[_0x65d5('0x18')]?_0x4de55a[_0x65d5('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4de55a['options']?_0x4de55a[_0x65d5('0x18')][_0x65d5('0x19')]||null:null,'attributes':_0x4de55a[_0x65d5('0x18')]?_0x4de55a[_0x65d5('0x18')][_0x65d5('0x1a')]||null:null,'limit':_0x4de55a[_0x65d5('0x18')]?_0x4de55a[_0x65d5('0x18')][_0x65d5('0x1b')]||null:null,'include':_0x4de55a[_0x65d5('0x18')]?_0x4de55a['options'][_0x65d5('0x1c')]?_[_0x65d5('0x1d')](_0x4de55a['options'][_0x65d5('0x1c')],function(_0x517003){return{'model':db[_0x517003[_0x65d5('0x1e')]],'as':_0x517003['as'],'attributes':_0x517003[_0x65d5('0x1a')],'include':_0x517003[_0x65d5('0x1c')]?_[_0x65d5('0x1d')](_0x517003['include'],function(_0x239068){return{'model':db[_0x239068[_0x65d5('0x1e')]],'as':_0x239068['as'],'attributes':_0x239068[_0x65d5('0x1a')],'include':_0x239068[_0x65d5('0x1c')]?_[_0x65d5('0x1d')](_0x239068['include'],function(_0x44c607){return{'model':db[_0x44c607[_0x65d5('0x1e')]],'as':_0x44c607['as'],'attributes':_0x44c607['attributes']};}):[]};}):[]};}):[]:[]})[_0x65d5('0xc')](function(_0x40098f){logger[_0x65d5('0xd')]('GetTemplate',_0x4de55a);logger[_0x65d5('0x1f')](_0x65d5('0x15'),_0x4de55a,JSON[_0x65d5('0x10')](_0x40098f));_0x329a9c(_0x40098f);})[_0x65d5('0x14')](function(_0x498114){logger[_0x65d5('0x12')](_0x65d5('0x15'),_0x498114[_0x65d5('0x13')],_0x4de55a);_0x3a9a1a(_0x4ca81f['error'](0x1f4,_0x498114[_0x65d5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index ff924b9..d855e8c 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 _0x125d=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/any_conditions','put','update','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x265fda,_0x49ebd0){var _0x4dcc5f=function(_0xe0c43c){while(--_0xe0c43c){_0x265fda['push'](_0x265fda['shift']());}};_0x4dcc5f(++_0x49ebd0);}(_0x125d,0x120));var _0xd125=function(_0x721c9d,_0x12d603){_0x721c9d=_0x721c9d-0x0;var _0x243a69=_0x125d[_0x721c9d];return _0x243a69;};'use strict';var multer=require(_0xd125('0x0'));var util=require(_0xd125('0x1'));var path=require(_0xd125('0x2'));var timeout=require(_0xd125('0x3'));var express=require('express');var router=express[_0xd125('0x4')]();var auth=require(_0xd125('0x5'));var interaction=require(_0xd125('0x6'));var config=require(_0xd125('0x7'));var controller=require('./trigger.controller');router[_0xd125('0x8')]('/',auth[_0xd125('0x9')](),controller[_0xd125('0xa')]);router[_0xd125('0x8')](_0xd125('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd125('0x8')](_0xd125('0xc'),auth[_0xd125('0x9')](),controller['getAllConditions']);router[_0xd125('0x8')]('/:id/any_conditions',auth[_0xd125('0x9')](),controller[_0xd125('0xd')]);router[_0xd125('0x8')](_0xd125('0xe'),auth['isAuthenticated'](),controller[_0xd125('0xf')]);router[_0xd125('0x10')]('/',auth[_0xd125('0x9')](),controller[_0xd125('0x11')]);router['post']('/:id/all_conditions',auth[_0xd125('0x9')](),controller['addAllCondition']);router['post'](_0xd125('0x12'),auth[_0xd125('0x9')](),controller['addAnyCondition']);router['post'](_0xd125('0xe'),auth[_0xd125('0x9')](),controller['addAction']);router[_0xd125('0x13')](_0xd125('0xb'),auth[_0xd125('0x9')](),controller[_0xd125('0x14')]);router['delete']('/:id',auth[_0xd125('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0da1=['get','isAuthenticated','show','getAllConditions','/:id/actions','create','post','addAllCondition','/:id/any_conditions','addAction','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller'];(function(_0x5e12a9,_0x2b382b){var _0x2fd558=function(_0x36496a){while(--_0x36496a){_0x5e12a9['push'](_0x5e12a9['shift']());}};_0x2fd558(++_0x2b382b);}(_0x0da1,0x1da));var _0x10da=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0da1[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x10da('0x0'));var util=require(_0x10da('0x1'));var path=require(_0x10da('0x2'));var timeout=require(_0x10da('0x3'));var express=require('express');var router=express[_0x10da('0x4')]();var auth=require(_0x10da('0x5'));var interaction=require(_0x10da('0x6'));var config=require(_0x10da('0x7'));var controller=require(_0x10da('0x8'));router[_0x10da('0x9')]('/',auth[_0x10da('0xa')](),controller['index']);router[_0x10da('0x9')]('/:id',auth[_0x10da('0xa')](),controller[_0x10da('0xb')]);router['get']('/:id/all_conditions',auth[_0x10da('0xa')](),controller[_0x10da('0xc')]);router[_0x10da('0x9')]('/:id/any_conditions',auth[_0x10da('0xa')](),controller['getAnyConditions']);router['get'](_0x10da('0xd'),auth[_0x10da('0xa')](),controller['getActions']);router['post']('/',auth[_0x10da('0xa')](),controller[_0x10da('0xe')]);router[_0x10da('0xf')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x10da('0x10')]);router[_0x10da('0xf')](_0x10da('0x11'),auth[_0x10da('0xa')](),controller['addAnyCondition']);router[_0x10da('0xf')](_0x10da('0xd'),auth[_0x10da('0xa')](),controller[_0x10da('0x12')]);router[_0x10da('0x13')](_0x10da('0x14'),auth[_0x10da('0xa')](),controller['update']);router['delete'](_0x10da('0x14'),auth['isAuthenticated'](),controller[_0x10da('0x15')]);module[_0x10da('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ff2e0b3..5c48910 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 _0x8e26=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1269f3,_0x20676a){var _0xe28dea=function(_0x5e8f04){while(--_0x5e8f04){_0x1269f3['push'](_0x1269f3['shift']());}};_0xe28dea(++_0x20676a);}(_0x8e26,0x14c));var _0x68e2=function(_0x328118,_0x339a57){_0x328118=_0x328118-0x0;var _0xf0cb48=_0x8e26[_0x328118];return _0xf0cb48;};'use strict';var Sequelize=require(_0x68e2('0x0'));module[_0x68e2('0x1')]={'name':{'type':Sequelize[_0x68e2('0x2')]},'channel':{'type':Sequelize[_0x68e2('0x2')]},'description':{'type':Sequelize[_0x68e2('0x2')]},'status':{'type':Sequelize[_0x68e2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd164=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2e2b45,_0x2a07e3){var _0x2bf3c2=function(_0x51d98d){while(--_0x51d98d){_0x2e2b45['push'](_0x2e2b45['shift']());}};_0x2bf3c2(++_0x2a07e3);}(_0xd164,0xc0));var _0x4d16=function(_0x40f918,_0x5dfcbd){_0x40f918=_0x40f918-0x0;var _0x260e64=_0xd164[_0x40f918];return _0x260e64;};'use strict';var Sequelize=require(_0x4d16('0x0'));module[_0x4d16('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4d16('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x4d16('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 4884356..f2f2a8c 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 _0xaca4=['addAction','TriggerId','Action','getActions','moment','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','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','error','stack','name','send','index','Trigger','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','order','sort','where','pick','add','day','merge','map','filter','options','then','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','hasOwnProperty','nolimit','findOne','getAnyConditions'];(function(_0x33ae72,_0x3f9f60){var _0x4df2c3=function(_0x140591){while(--_0x140591){_0x33ae72['push'](_0x33ae72['shift']());}};_0x4df2c3(++_0x3f9f60);}(_0xaca4,0x1df));var _0x4aca=function(_0x38ff68,_0x5c29e0){_0x38ff68=_0x38ff68-0x0;var _0x1c51f7=_0xaca4[_0x38ff68];return _0x1c51f7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4aca('0x0'));var BPromise=require('bluebird');var Mustache=require(_0x4aca('0x1'));var util=require(_0x4aca('0x2'));var path=require(_0x4aca('0x3'));var sox=require(_0x4aca('0x4'));var csv=require(_0x4aca('0x5'));var ejs=require(_0x4aca('0x6'));var fs=require('fs');var _=require(_0x4aca('0x7'));var squel=require(_0x4aca('0x8'));var crypto=require(_0x4aca('0x9'));var jsforce=require(_0x4aca('0xa'));var deskjs=require(_0x4aca('0xb'));var toCsv=require(_0x4aca('0x5'));var querystring=require(_0x4aca('0xc'));var Papa=require(_0x4aca('0xd'));var Redis=require(_0x4aca('0xe'));var qs=require(_0x4aca('0xf'));var logger=require(_0x4aca('0x10'))(_0x4aca('0x11'));var utils=require(_0x4aca('0x12'));var config=require(_0x4aca('0x13'));var db=require(_0x4aca('0x14'))['db'];function respondWithStatusCode(_0x4108ba,_0x5c003c){_0x5c003c=_0x5c003c||0xcc;return function(_0x1f7b72){if(_0x1f7b72){return _0x4108ba[_0x4aca('0x15')](_0x5c003c);}return _0x4108ba[_0x4aca('0x16')](_0x5c003c)[_0x4aca('0x17')]();};}function respondWithResult(_0xce4453,_0x28c01e){_0x28c01e=_0x28c01e||0xc8;return function(_0x117a12){if(_0x117a12){return _0xce4453[_0x4aca('0x16')](_0x28c01e)[_0x4aca('0x18')](_0x117a12);}};}function respondWithFilteredResult(_0x1fd51f,_0x13c991){return function(_0x22afd7){if(_0x22afd7){var _0x169a79=_0x22afd7[_0x4aca('0x19')],_0x27da14=_0x13c991[_0x4aca('0x1a')],_0xa3893f=_0x13c991['offset']+_0x13c991[_0x4aca('0x1b')],_0x3cbb06;if(_0xa3893f>=_0x169a79){_0xa3893f=_0x169a79;_0x3cbb06=0xc8;}else{_0x3cbb06=0xce;}_0x1fd51f[_0x4aca('0x16')](_0x3cbb06);return _0x1fd51f[_0x4aca('0x1c')](_0x4aca('0x1d'),_0x27da14+'-'+_0xa3893f+'/'+_0x169a79)[_0x4aca('0x18')](_0x22afd7);}return null;};}function patchUpdates(_0x1207f6){return function(_0x469c30){try{jsonpatch[_0x4aca('0x1e')](_0x469c30,_0x1207f6,!![]);}catch(_0x323c88){return BPromise[_0x4aca('0x1f')](_0x323c88);}return _0x469c30[_0x4aca('0x20')]();};}function saveUpdates(_0x6c7f79,_0xfcaa35){return function(_0x542333){if(_0x542333){return _0x542333[_0x4aca('0x21')](_0x6c7f79)['then'](function(_0x21320a){return _0x21320a;});}return null;};}function removeEntity(_0x23f483,_0x5dedcd){return function(_0x4fa918){if(_0x4fa918){return _0x4fa918['destroy']()['then'](function(){var _0x1f1bab=_0x4fa918[_0x4aca('0x22')]({'plain':!![]});var _0x12e77a='Triggers';return db[_0x4aca('0x23')][_0x4aca('0x24')]({'where':{'type':_0x12e77a,'resourceId':_0x1f1bab['id']}})['then'](function(){return _0x4fa918;});})['then'](function(){_0x23f483[_0x4aca('0x16')](0xcc)[_0x4aca('0x17')]();});}};}function handleEntityNotFound(_0xd1b705,_0x17561e){return function(_0x183ea0){if(!_0x183ea0){_0xd1b705['sendStatus'](0x194);}return _0x183ea0;};}function handleError(_0x2f4053,_0x245de0){_0x245de0=_0x245de0||0x1f4;return function(_0x282971){logger[_0x4aca('0x25')](_0x282971[_0x4aca('0x26')]);if(_0x282971[_0x4aca('0x27')]){delete _0x282971[_0x4aca('0x27')];}_0x2f4053[_0x4aca('0x16')](_0x245de0)[_0x4aca('0x28')](_0x282971);};}exports[_0x4aca('0x29')]=function(_0xe7cef2,_0x59513a){var _0x3f1018={},_0x44b990={},_0x228b68={'count':0x0,'rows':[]};var _0x102587=db[_0x4aca('0x2a')][_0x4aca('0x2b')];_0x44b990[_0x4aca('0x2c')]=_[_0x4aca('0x2d')](_0x102587);var _0x45ba77={'dateStart':_0xe7cef2['query'][_0x4aca('0x2e')],'dateEnd':_0xe7cef2[_0x4aca('0x2f')][_0x4aca('0x30')]};delete _0xe7cef2[_0x4aca('0x2f')][_0x4aca('0x2e')];delete _0xe7cef2[_0x4aca('0x2f')]['dateEnd'];_0x44b990[_0x4aca('0x2f')]=_['keys'](_0xe7cef2[_0x4aca('0x2f')]);_0x44b990[_0x4aca('0x31')]=_[_0x4aca('0x32')](_0x44b990[_0x4aca('0x2c')],_0x44b990[_0x4aca('0x2f')]);_0x3f1018[_0x4aca('0x33')]=_['intersection'](_0x44b990[_0x4aca('0x2c')],qs[_0x4aca('0x34')](_0xe7cef2[_0x4aca('0x2f')][_0x4aca('0x34')]));_0x3f1018[_0x4aca('0x33')]=_0x3f1018[_0x4aca('0x33')][_0x4aca('0x35')]?_0x3f1018['attributes']:_0x44b990['model'];if(!_0xe7cef2[_0x4aca('0x2f')]['hasOwnProperty']('nolimit')){_0x3f1018[_0x4aca('0x1b')]=qs['limit'](_0xe7cef2[_0x4aca('0x2f')][_0x4aca('0x1b')]);_0x3f1018[_0x4aca('0x1a')]=qs[_0x4aca('0x1a')](_0xe7cef2[_0x4aca('0x2f')][_0x4aca('0x1a')]);}_0x3f1018[_0x4aca('0x36')]=qs[_0x4aca('0x37')](_0xe7cef2[_0x4aca('0x2f')][_0x4aca('0x37')]);_0x3f1018[_0x4aca('0x38')]=qs[_0x4aca('0x31')](_[_0x4aca('0x39')](_0xe7cef2[_0x4aca('0x2f')],_0x44b990['filters']));if(_0x45ba77[_0x4aca('0x2e')]){if(_0x45ba77[_0x4aca('0x30')]){_0x45ba77[_0x4aca('0x30')]=moment(_0x45ba77[_0x4aca('0x30')])[_0x4aca('0x3a')](0x1,_0x4aca('0x3b'));}else{_0x45ba77['dateEnd']=moment(_0x45ba77[_0x4aca('0x2e')])[_0x4aca('0x3a')](0x1,_0x4aca('0x3b'));}_[_0x4aca('0x3c')](_0x3f1018[_0x4aca('0x38')],{'createdAt':{'$gte':_0x45ba77['dateStart'],'$lte':_0x45ba77['dateEnd']}});}if(_0xe7cef2['query']['filter']){_0x3f1018[_0x4aca('0x38')]=_[_0x4aca('0x3c')](_0x3f1018[_0x4aca('0x38')],{'$or':_[_0x4aca('0x3d')](_0x3f1018[_0x4aca('0x33')],function(_0x196fe8){var _0x2cdd95={};_0x2cdd95[_0x196fe8]={'$like':'%'+_0xe7cef2[_0x4aca('0x2f')][_0x4aca('0x3e')]+'%'};return _0x2cdd95;})});}_0x3f1018=_[_0x4aca('0x3c')]({},_0x3f1018,_0xe7cef2[_0x4aca('0x3f')]);var _0x1928fb={'where':_0x3f1018['where']};return db[_0x4aca('0x2a')][_0x4aca('0x19')](_0x1928fb)[_0x4aca('0x40')](function(_0x2b4fa8){_0x228b68[_0x4aca('0x19')]=_0x2b4fa8;if(_0xe7cef2['query']['includeAll']){_0x3f1018[_0x4aca('0x41')]=[{'all':!![]}];}return db[_0x4aca('0x2a')][_0x4aca('0x42')](_0x3f1018);})[_0x4aca('0x40')](function(_0x3e2438){_0x228b68[_0x4aca('0x43')]=_0x3e2438;return _0x228b68;})[_0x4aca('0x40')](respondWithFilteredResult(_0x59513a,_0x3f1018))[_0x4aca('0x44')](handleError(_0x59513a,null));};exports[_0x4aca('0x45')]=function(_0x17dd3e,_0x18eff1){var _0x7bf69d={'raw':![],'where':{'id':_0x17dd3e[_0x4aca('0x46')]['id']}},_0x586cd1={};_0x586cd1[_0x4aca('0x2c')]=_['keys'](db[_0x4aca('0x2a')]['rawAttributes']);_0x586cd1['query']=_[_0x4aca('0x2d')](_0x17dd3e[_0x4aca('0x2f')]);_0x586cd1['filters']=_[_0x4aca('0x32')](_0x586cd1[_0x4aca('0x2c')],_0x586cd1[_0x4aca('0x2f')]);_0x7bf69d[_0x4aca('0x33')]=_[_0x4aca('0x32')](_0x586cd1[_0x4aca('0x2c')],qs[_0x4aca('0x34')](_0x17dd3e[_0x4aca('0x2f')]['fields']));_0x7bf69d['attributes']=_0x7bf69d[_0x4aca('0x33')]['length']?_0x7bf69d[_0x4aca('0x33')]:_0x586cd1['model'];if(_0x17dd3e[_0x4aca('0x2f')][_0x4aca('0x47')]){_0x7bf69d[_0x4aca('0x41')]=[{'all':!![]}];}_0x7bf69d=_[_0x4aca('0x3c')]({},_0x7bf69d,_0x17dd3e[_0x4aca('0x3f')]);return db['Trigger'][_0x4aca('0x48')](_0x7bf69d)[_0x4aca('0x40')](handleEntityNotFound(_0x18eff1,null))[_0x4aca('0x40')](respondWithResult(_0x18eff1,null))[_0x4aca('0x44')](handleError(_0x18eff1,null));};exports[_0x4aca('0x49')]=function(_0x1a5ed2,_0x516b86){return db[_0x4aca('0x2a')][_0x4aca('0x49')](_0x1a5ed2[_0x4aca('0x4a')],{})[_0x4aca('0x40')](function(_0x4ee6e4){var _0x3c7613=_0x1a5ed2[_0x4aca('0x4b')][_0x4aca('0x22')]({'plain':!![]});if(!_0x3c7613)throw new Error(_0x4aca('0x4c'));if(_0x3c7613[_0x4aca('0x4d')]==='user'){var _0x3463c0=_0x4ee6e4[_0x4aca('0x22')]({'plain':!![]});var _0x4fdb83='Triggers';return db[_0x4aca('0x4e')][_0x4aca('0x48')]({'where':{'name':_0x4fdb83,'userProfileId':_0x3c7613[_0x4aca('0x4f')]},'raw':!![]})[_0x4aca('0x40')](function(_0x3c8de2){if(_0x3c8de2&&_0x3c8de2['autoAssociation']===0x0){return db[_0x4aca('0x23')][_0x4aca('0x49')]({'name':_0x3463c0[_0x4aca('0x27')],'resourceId':_0x3463c0['id'],'type':_0x3c8de2[_0x4aca('0x27')],'sectionId':_0x3c8de2['id']},{})[_0x4aca('0x40')](function(){return _0x4ee6e4;});}else{return _0x4ee6e4;}})[_0x4aca('0x44')](function(_0x5061f5){logger[_0x4aca('0x25')](_0x4aca('0x50'),_0x5061f5);throw _0x5061f5;});}return _0x4ee6e4;})['then'](respondWithResult(_0x516b86,0xc9))[_0x4aca('0x44')](handleError(_0x516b86,null));};exports[_0x4aca('0x21')]=function(_0x1d12e4,_0x185cb5){if(_0x1d12e4[_0x4aca('0x4a')]['id']){delete _0x1d12e4['body']['id'];}return db['Trigger'][_0x4aca('0x48')]({'where':{'id':_0x1d12e4[_0x4aca('0x46')]['id']}})[_0x4aca('0x40')](handleEntityNotFound(_0x185cb5,null))[_0x4aca('0x40')](saveUpdates(_0x1d12e4['body'],null))[_0x4aca('0x40')](respondWithResult(_0x185cb5,null))[_0x4aca('0x44')](handleError(_0x185cb5,null));};exports['destroy']=function(_0x59b532,_0x39791a){return db['Trigger']['find']({'where':{'id':_0x59b532['params']['id']}})[_0x4aca('0x40')](handleEntityNotFound(_0x39791a,null))[_0x4aca('0x40')](removeEntity(_0x39791a,null))[_0x4aca('0x44')](handleError(_0x39791a,null));};exports[_0x4aca('0x51')]=function(_0x41593a,_0x35dbce,_0x36655b){if(_0x41593a['body']['id']){delete _0x41593a[_0x4aca('0x4a')]['id'];}return db[_0x4aca('0x2a')][_0x4aca('0x48')]({'where':{'id':_0x41593a[_0x4aca('0x46')]['id']}})[_0x4aca('0x40')](handleEntityNotFound(_0x35dbce,null))[_0x4aca('0x40')](function(_0x2bb176){if(_0x2bb176){_0x41593a['body'][_0x4aca('0x52')]=_0x2bb176['id'];return db[_0x4aca('0x53')][_0x4aca('0x49')](_0x41593a['body']);}})[_0x4aca('0x40')](respondWithResult(_0x35dbce,null))[_0x4aca('0x44')](handleError(_0x35dbce,null));};exports[_0x4aca('0x54')]=function(_0x4540c6,_0x3ab744,_0x1e570f){if(_0x4540c6[_0x4aca('0x4a')]['id']){delete _0x4540c6[_0x4aca('0x4a')]['id'];}return db[_0x4aca('0x2a')][_0x4aca('0x48')]({'where':{'id':_0x4540c6[_0x4aca('0x46')]['id']}})[_0x4aca('0x40')](handleEntityNotFound(_0x3ab744,null))['then'](function(_0xc63702){if(_0xc63702){_0x4540c6[_0x4aca('0x4a')][_0x4aca('0x55')]=_0xc63702['id'];return db[_0x4aca('0x53')][_0x4aca('0x49')](_0x4540c6[_0x4aca('0x4a')]);}})[_0x4aca('0x40')](respondWithResult(_0x3ab744,null))[_0x4aca('0x44')](handleError(_0x3ab744,null));};exports[_0x4aca('0x56')]=function(_0x4043dd,_0x14866c,_0x3e9640){var _0x368cbc={};var _0x284c08={};var _0x50ed26;var _0x13be37;return db[_0x4aca('0x2a')]['findOne']({'where':{'id':_0x4043dd['params']['id']}})[_0x4aca('0x40')](handleEntityNotFound(_0x14866c,null))[_0x4aca('0x40')](function(_0x552fef){if(_0x552fef){_0x50ed26=_0x552fef;_0x284c08[_0x4aca('0x2c')]=_[_0x4aca('0x2d')](db['Condition'][_0x4aca('0x2b')]);_0x284c08[_0x4aca('0x2f')]=_[_0x4aca('0x2d')](_0x4043dd[_0x4aca('0x2f')]);_0x284c08[_0x4aca('0x31')]=_[_0x4aca('0x32')](_0x284c08['model'],_0x284c08[_0x4aca('0x2f')]);_0x368cbc[_0x4aca('0x33')]=_['intersection'](_0x284c08[_0x4aca('0x2c')],qs[_0x4aca('0x34')](_0x4043dd[_0x4aca('0x2f')][_0x4aca('0x34')]));_0x368cbc['attributes']=_0x368cbc[_0x4aca('0x33')]['length']?_0x368cbc[_0x4aca('0x33')]:_0x284c08['model'];_0x368cbc[_0x4aca('0x36')]=qs[_0x4aca('0x37')](_0x4043dd['query'][_0x4aca('0x37')]);_0x368cbc[_0x4aca('0x38')]=qs['filters'](_[_0x4aca('0x39')](_0x4043dd[_0x4aca('0x2f')],_0x284c08[_0x4aca('0x31')]));if(_0x4043dd[_0x4aca('0x2f')][_0x4aca('0x3e')]){_0x368cbc[_0x4aca('0x38')]=_['merge'](_0x368cbc['where'],{'$or':_['map'](_0x368cbc[_0x4aca('0x33')],function(_0xb3ac18){var _0x3e9140={};_0x3e9140[_0xb3ac18]={'$like':'%'+_0x4043dd['query'][_0x4aca('0x3e')]+'%'};return _0x3e9140;})});}_0x368cbc=_[_0x4aca('0x3c')]({},_0x368cbc,_0x4043dd[_0x4aca('0x3f')]);return _0x50ed26[_0x4aca('0x56')](_0x368cbc);}})[_0x4aca('0x40')](function(_0x41cda7){if(_0x41cda7){_0x13be37=_0x41cda7['length'];if(!_0x4043dd[_0x4aca('0x2f')][_0x4aca('0x57')](_0x4aca('0x58'))){_0x368cbc[_0x4aca('0x1b')]=qs['limit'](_0x4043dd['query'][_0x4aca('0x1b')]);_0x368cbc[_0x4aca('0x1a')]=qs[_0x4aca('0x1a')](_0x4043dd[_0x4aca('0x2f')]['offset']);}return _0x50ed26[_0x4aca('0x56')](_0x368cbc);}})[_0x4aca('0x40')](function(_0xb89109){if(_0xb89109){return _0xb89109?{'count':_0x13be37,'rows':_0xb89109}:null;}})[_0x4aca('0x40')](respondWithResult(_0x14866c,null))[_0x4aca('0x44')](handleError(_0x14866c,null));};exports['getAnyConditions']=function(_0x27e8aa,_0x275c24,_0x2ad019){var _0x5d80dc={};var _0x28cf7c={};var _0x286194;var _0x5d8e15;return db[_0x4aca('0x2a')][_0x4aca('0x59')]({'where':{'id':_0x27e8aa[_0x4aca('0x46')]['id']}})[_0x4aca('0x40')](handleEntityNotFound(_0x275c24,null))[_0x4aca('0x40')](function(_0x43b60d){if(_0x43b60d){_0x286194=_0x43b60d;_0x28cf7c[_0x4aca('0x2c')]=_[_0x4aca('0x2d')](db[_0x4aca('0x53')][_0x4aca('0x2b')]);_0x28cf7c[_0x4aca('0x2f')]=_[_0x4aca('0x2d')](_0x27e8aa['query']);_0x28cf7c[_0x4aca('0x31')]=_[_0x4aca('0x32')](_0x28cf7c[_0x4aca('0x2c')],_0x28cf7c[_0x4aca('0x2f')]);_0x5d80dc[_0x4aca('0x33')]=_[_0x4aca('0x32')](_0x28cf7c[_0x4aca('0x2c')],qs[_0x4aca('0x34')](_0x27e8aa[_0x4aca('0x2f')][_0x4aca('0x34')]));_0x5d80dc[_0x4aca('0x33')]=_0x5d80dc['attributes'][_0x4aca('0x35')]?_0x5d80dc[_0x4aca('0x33')]:_0x28cf7c[_0x4aca('0x2c')];_0x5d80dc[_0x4aca('0x36')]=qs[_0x4aca('0x37')](_0x27e8aa[_0x4aca('0x2f')][_0x4aca('0x37')]);_0x5d80dc['where']=qs['filters'](_[_0x4aca('0x39')](_0x27e8aa[_0x4aca('0x2f')],_0x28cf7c[_0x4aca('0x31')]));if(_0x27e8aa['query'][_0x4aca('0x3e')]){_0x5d80dc[_0x4aca('0x38')]=_[_0x4aca('0x3c')](_0x5d80dc[_0x4aca('0x38')],{'$or':_['map'](_0x5d80dc[_0x4aca('0x33')],function(_0x43cd4f){var _0x50121f={};_0x50121f[_0x43cd4f]={'$like':'%'+_0x27e8aa['query'][_0x4aca('0x3e')]+'%'};return _0x50121f;})});}_0x5d80dc=_[_0x4aca('0x3c')]({},_0x5d80dc,_0x27e8aa[_0x4aca('0x3f')]);return _0x286194['getAnyConditions'](_0x5d80dc);}})[_0x4aca('0x40')](function(_0x17a809){if(_0x17a809){_0x5d8e15=_0x17a809[_0x4aca('0x35')];if(!_0x27e8aa[_0x4aca('0x2f')][_0x4aca('0x57')](_0x4aca('0x58'))){_0x5d80dc[_0x4aca('0x1b')]=qs[_0x4aca('0x1b')](_0x27e8aa[_0x4aca('0x2f')][_0x4aca('0x1b')]);_0x5d80dc[_0x4aca('0x1a')]=qs[_0x4aca('0x1a')](_0x27e8aa['query']['offset']);}return _0x286194[_0x4aca('0x5a')](_0x5d80dc);}})[_0x4aca('0x40')](function(_0x87c6e){if(_0x87c6e){return _0x87c6e?{'count':_0x5d8e15,'rows':_0x87c6e}:null;}})[_0x4aca('0x40')](respondWithResult(_0x275c24,null))[_0x4aca('0x44')](handleError(_0x275c24,null));};exports[_0x4aca('0x5b')]=function(_0x14dc62,_0x20b77a,_0x37bd81){if(_0x14dc62[_0x4aca('0x4a')]['id']){delete _0x14dc62[_0x4aca('0x4a')]['id'];}return db['Trigger'][_0x4aca('0x48')]({'where':{'id':_0x14dc62['params']['id']}})['then'](handleEntityNotFound(_0x20b77a,null))[_0x4aca('0x40')](function(_0x4a4aa8){if(_0x4a4aa8){_0x14dc62[_0x4aca('0x4a')][_0x4aca('0x5c')]=_0x4a4aa8['id'];return db[_0x4aca('0x5d')]['create'](_0x14dc62[_0x4aca('0x4a')]);}})[_0x4aca('0x40')](respondWithResult(_0x20b77a,null))[_0x4aca('0x44')](handleError(_0x20b77a,null));};exports['getActions']=function(_0x378a6c,_0xfa59cc,_0x118404){var _0x4a245f={};var _0x1bcc3e={};var _0xa4d872;var _0x2db778;return db['Trigger'][_0x4aca('0x59')]({'where':{'id':_0x378a6c[_0x4aca('0x46')]['id']}})[_0x4aca('0x40')](handleEntityNotFound(_0xfa59cc,null))[_0x4aca('0x40')](function(_0x9df5eb){if(_0x9df5eb){_0xa4d872=_0x9df5eb;_0x1bcc3e['model']=_[_0x4aca('0x2d')](db[_0x4aca('0x5d')]['rawAttributes']);_0x1bcc3e['query']=_['keys'](_0x378a6c[_0x4aca('0x2f')]);_0x1bcc3e['filters']=_[_0x4aca('0x32')](_0x1bcc3e[_0x4aca('0x2c')],_0x1bcc3e[_0x4aca('0x2f')]);_0x4a245f[_0x4aca('0x33')]=_[_0x4aca('0x32')](_0x1bcc3e[_0x4aca('0x2c')],qs['fields'](_0x378a6c['query'][_0x4aca('0x34')]));_0x4a245f[_0x4aca('0x33')]=_0x4a245f[_0x4aca('0x33')][_0x4aca('0x35')]?_0x4a245f[_0x4aca('0x33')]:_0x1bcc3e[_0x4aca('0x2c')];_0x4a245f[_0x4aca('0x36')]=qs[_0x4aca('0x37')](_0x378a6c[_0x4aca('0x2f')][_0x4aca('0x37')]);_0x4a245f[_0x4aca('0x38')]=qs['filters'](_['pick'](_0x378a6c['query'],_0x1bcc3e[_0x4aca('0x31')]));if(_0x378a6c[_0x4aca('0x2f')]['filter']){_0x4a245f['where']=_[_0x4aca('0x3c')](_0x4a245f[_0x4aca('0x38')],{'$or':_[_0x4aca('0x3d')](_0x4a245f[_0x4aca('0x33')],function(_0x4bf084){var _0x74fd59={};_0x74fd59[_0x4bf084]={'$like':'%'+_0x378a6c['query'][_0x4aca('0x3e')]+'%'};return _0x74fd59;})});}_0x4a245f=_[_0x4aca('0x3c')]({},_0x4a245f,_0x378a6c[_0x4aca('0x3f')]);return _0xa4d872[_0x4aca('0x5e')](_0x4a245f);}})['then'](function(_0x429e1c){if(_0x429e1c){_0x2db778=_0x429e1c[_0x4aca('0x35')];if(!_0x378a6c['query'][_0x4aca('0x57')](_0x4aca('0x58'))){_0x4a245f[_0x4aca('0x1b')]=qs[_0x4aca('0x1b')](_0x378a6c['query']['limit']);_0x4a245f[_0x4aca('0x1a')]=qs[_0x4aca('0x1a')](_0x378a6c[_0x4aca('0x2f')][_0x4aca('0x1a')]);}return _0xa4d872['getActions'](_0x4a245f);}})['then'](function(_0x28b702){if(_0x28b702){return _0x28b702?{'count':_0x2db778,'rows':_0x28b702}:null;}})[_0x4aca('0x40')](respondWithResult(_0xfa59cc,null))[_0x4aca('0x44')](handleError(_0xfa59cc,null));}; \ No newline at end of file +var _0x22e9=['filter','count','include','rows','catch','show','params','includeAll','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Triggers','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','TriggerAnyId','Condition','getAllConditions','map','findOne','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','UserProfileResource','destroy','error','name','send','index','Trigger','rawAttributes','keys','dateStart','query','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge'];(function(_0x5aae4c,_0x4cdaee){var _0x3a978b=function(_0xfa078c){while(--_0xfa078c){_0x5aae4c['push'](_0x5aae4c['shift']());}};_0x3a978b(++_0x4cdaee);}(_0x22e9,0xd8));var _0x922e=function(_0x69752e,_0x2579f6){_0x69752e=_0x69752e-0x0;var _0x506a36=_0x22e9[_0x69752e];return _0x506a36;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x922e('0x0'));var rimraf=require(_0x922e('0x1'));var zipdir=require(_0x922e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x922e('0x3'));var moment=require(_0x922e('0x4'));var BPromise=require(_0x922e('0x5'));var Mustache=require(_0x922e('0x6'));var util=require(_0x922e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x922e('0x8'));var ejs=require(_0x922e('0x9'));var fs=require('fs');var _=require(_0x922e('0xa'));var squel=require(_0x922e('0xb'));var crypto=require('crypto');var jsforce=require(_0x922e('0xc'));var deskjs=require(_0x922e('0xd'));var toCsv=require(_0x922e('0x8'));var querystring=require(_0x922e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x922e('0xf'));var logger=require(_0x922e('0x10'))(_0x922e('0x11'));var utils=require(_0x922e('0x12'));var config=require(_0x922e('0x13'));var db=require(_0x922e('0x14'))['db'];function respondWithStatusCode(_0x4d150f,_0xd2d193){_0xd2d193=_0xd2d193||0xcc;return function(_0x5a98b7){if(_0x5a98b7){return _0x4d150f[_0x922e('0x15')](_0xd2d193);}return _0x4d150f['status'](_0xd2d193)[_0x922e('0x16')]();};}function respondWithResult(_0x5bba03,_0x4ba477){_0x4ba477=_0x4ba477||0xc8;return function(_0x864fa0){if(_0x864fa0){return _0x5bba03[_0x922e('0x17')](_0x4ba477)[_0x922e('0x18')](_0x864fa0);}};}function respondWithFilteredResult(_0x58a4f6,_0x55ae5f){return function(_0x287628){if(_0x287628){var _0x4d98c8=_0x287628['count'],_0x3d38f5=_0x55ae5f[_0x922e('0x19')],_0x21faba=_0x55ae5f[_0x922e('0x19')]+_0x55ae5f[_0x922e('0x1a')],_0x170ca0;if(_0x21faba>=_0x4d98c8){_0x21faba=_0x4d98c8;_0x170ca0=0xc8;}else{_0x170ca0=0xce;}_0x58a4f6[_0x922e('0x17')](_0x170ca0);return _0x58a4f6[_0x922e('0x1b')](_0x922e('0x1c'),_0x3d38f5+'-'+_0x21faba+'/'+_0x4d98c8)['json'](_0x287628);}return null;};}function patchUpdates(_0x4f86b2){return function(_0x323651){try{jsonpatch[_0x922e('0x1d')](_0x323651,_0x4f86b2,!![]);}catch(_0x292e8){return BPromise[_0x922e('0x1e')](_0x292e8);}return _0x323651['save']();};}function saveUpdates(_0x401b04,_0x1b0532){return function(_0x321d71){if(_0x321d71){return _0x321d71[_0x922e('0x1f')](_0x401b04)[_0x922e('0x20')](function(_0x3dae66){return _0x3dae66;});}return null;};}function removeEntity(_0x165e20,_0x3dadd1){return function(_0x1d6d33){if(_0x1d6d33){return _0x1d6d33['destroy']()['then'](function(){var _0x20af1f=_0x1d6d33['get']({'plain':!![]});var _0x10f0c9='Triggers';return db[_0x922e('0x21')][_0x922e('0x22')]({'where':{'type':_0x10f0c9,'resourceId':_0x20af1f['id']}})[_0x922e('0x20')](function(){return _0x1d6d33;});})[_0x922e('0x20')](function(){_0x165e20[_0x922e('0x17')](0xcc)[_0x922e('0x16')]();});}};}function handleEntityNotFound(_0x424fc5,_0x79c1e8){return function(_0x54e1ab){if(!_0x54e1ab){_0x424fc5[_0x922e('0x15')](0x194);}return _0x54e1ab;};}function handleError(_0x5a3ba2,_0x2455ae){_0x2455ae=_0x2455ae||0x1f4;return function(_0x4df488){logger[_0x922e('0x23')](_0x4df488['stack']);if(_0x4df488[_0x922e('0x24')]){delete _0x4df488[_0x922e('0x24')];}_0x5a3ba2[_0x922e('0x17')](_0x2455ae)[_0x922e('0x25')](_0x4df488);};}exports[_0x922e('0x26')]=function(_0x51667a,_0x57c0cf){var _0x4d6196={},_0x6605de={},_0x1c7b76={'count':0x0,'rows':[]};var _0x39084c=db[_0x922e('0x27')][_0x922e('0x28')];_0x6605de['model']=_[_0x922e('0x29')](_0x39084c);var _0x4690f8={'dateStart':_0x51667a['query'][_0x922e('0x2a')],'dateEnd':_0x51667a[_0x922e('0x2b')][_0x922e('0x2c')]};delete _0x51667a['query'][_0x922e('0x2a')];delete _0x51667a[_0x922e('0x2b')]['dateEnd'];_0x6605de[_0x922e('0x2b')]=_[_0x922e('0x29')](_0x51667a[_0x922e('0x2b')]);_0x6605de[_0x922e('0x2d')]=_[_0x922e('0x2e')](_0x6605de[_0x922e('0x2f')],_0x6605de[_0x922e('0x2b')]);_0x4d6196[_0x922e('0x30')]=_[_0x922e('0x2e')](_0x6605de[_0x922e('0x2f')],qs[_0x922e('0x31')](_0x51667a[_0x922e('0x2b')][_0x922e('0x31')]));_0x4d6196[_0x922e('0x30')]=_0x4d6196[_0x922e('0x30')][_0x922e('0x32')]?_0x4d6196[_0x922e('0x30')]:_0x6605de[_0x922e('0x2f')];if(!_0x51667a[_0x922e('0x2b')][_0x922e('0x33')](_0x922e('0x34'))){_0x4d6196['limit']=qs[_0x922e('0x1a')](_0x51667a[_0x922e('0x2b')]['limit']);_0x4d6196[_0x922e('0x19')]=qs[_0x922e('0x19')](_0x51667a[_0x922e('0x2b')][_0x922e('0x19')]);}_0x4d6196[_0x922e('0x35')]=qs[_0x922e('0x36')](_0x51667a['query'][_0x922e('0x36')]);_0x4d6196[_0x922e('0x37')]=qs[_0x922e('0x2d')](_[_0x922e('0x38')](_0x51667a[_0x922e('0x2b')],_0x6605de['filters']));if(_0x4690f8['dateStart']){if(_0x4690f8['dateEnd']){_0x4690f8[_0x922e('0x2c')]=moment(_0x4690f8[_0x922e('0x2c')])[_0x922e('0x39')](0x1,_0x922e('0x3a'));}else{_0x4690f8[_0x922e('0x2c')]=moment(_0x4690f8[_0x922e('0x2a')])['add'](0x1,'day');}_[_0x922e('0x3b')](_0x4d6196[_0x922e('0x37')],{'createdAt':{'$gte':_0x4690f8[_0x922e('0x2a')],'$lte':_0x4690f8[_0x922e('0x2c')]}});}if(_0x51667a[_0x922e('0x2b')][_0x922e('0x3c')]){_0x4d6196[_0x922e('0x37')]=_[_0x922e('0x3b')](_0x4d6196[_0x922e('0x37')],{'$or':_['map'](_0x4d6196[_0x922e('0x30')],function(_0x23cbd1){var _0x38cb0e={};_0x38cb0e[_0x23cbd1]={'$like':'%'+_0x51667a[_0x922e('0x2b')][_0x922e('0x3c')]+'%'};return _0x38cb0e;})});}_0x4d6196=_['merge']({},_0x4d6196,_0x51667a['options']);var _0x310192={'where':_0x4d6196['where']};return db[_0x922e('0x27')][_0x922e('0x3d')](_0x310192)[_0x922e('0x20')](function(_0xede890){_0x1c7b76[_0x922e('0x3d')]=_0xede890;if(_0x51667a[_0x922e('0x2b')]['includeAll']){_0x4d6196[_0x922e('0x3e')]=[{'all':!![]}];}return db[_0x922e('0x27')]['findAll'](_0x4d6196);})[_0x922e('0x20')](function(_0x1f843b){_0x1c7b76[_0x922e('0x3f')]=_0x1f843b;return _0x1c7b76;})['then'](respondWithFilteredResult(_0x57c0cf,_0x4d6196))[_0x922e('0x40')](handleError(_0x57c0cf,null));};exports[_0x922e('0x41')]=function(_0xc72e06,_0x5a797c){var _0x232805={'raw':![],'where':{'id':_0xc72e06[_0x922e('0x42')]['id']}},_0x1512ae={};_0x1512ae[_0x922e('0x2f')]=_[_0x922e('0x29')](db[_0x922e('0x27')][_0x922e('0x28')]);_0x1512ae['query']=_['keys'](_0xc72e06['query']);_0x1512ae[_0x922e('0x2d')]=_[_0x922e('0x2e')](_0x1512ae[_0x922e('0x2f')],_0x1512ae[_0x922e('0x2b')]);_0x232805[_0x922e('0x30')]=_[_0x922e('0x2e')](_0x1512ae['model'],qs['fields'](_0xc72e06[_0x922e('0x2b')][_0x922e('0x31')]));_0x232805[_0x922e('0x30')]=_0x232805['attributes'][_0x922e('0x32')]?_0x232805[_0x922e('0x30')]:_0x1512ae[_0x922e('0x2f')];if(_0xc72e06[_0x922e('0x2b')][_0x922e('0x43')]){_0x232805[_0x922e('0x3e')]=[{'all':!![]}];}_0x232805=_['merge']({},_0x232805,_0xc72e06[_0x922e('0x44')]);return db['Trigger'][_0x922e('0x45')](_0x232805)[_0x922e('0x20')](handleEntityNotFound(_0x5a797c,null))[_0x922e('0x20')](respondWithResult(_0x5a797c,null))[_0x922e('0x40')](handleError(_0x5a797c,null));};exports['create']=function(_0x4743d2,_0x1100a9){return db[_0x922e('0x27')]['create'](_0x4743d2[_0x922e('0x46')],{})['then'](function(_0x4f0aaf){var _0x1e304c=_0x4743d2['user'][_0x922e('0x47')]({'plain':!![]});if(!_0x1e304c)throw new Error(_0x922e('0x48'));if(_0x1e304c[_0x922e('0x49')]===_0x922e('0x4a')){var _0x18c0a8=_0x4f0aaf[_0x922e('0x47')]({'plain':!![]});var _0x4a2b72=_0x922e('0x4b');return db[_0x922e('0x4c')][_0x922e('0x45')]({'where':{'name':_0x4a2b72,'userProfileId':_0x1e304c['userProfileId']},'raw':!![]})[_0x922e('0x20')](function(_0x34310c){if(_0x34310c&&_0x34310c[_0x922e('0x4d')]===0x0){return db[_0x922e('0x21')][_0x922e('0x4e')]({'name':_0x18c0a8[_0x922e('0x24')],'resourceId':_0x18c0a8['id'],'type':_0x34310c[_0x922e('0x24')],'sectionId':_0x34310c['id']},{})[_0x922e('0x20')](function(){return _0x4f0aaf;});}else{return _0x4f0aaf;}})[_0x922e('0x40')](function(_0x97d351){logger[_0x922e('0x23')](_0x922e('0x4f'),_0x97d351);throw _0x97d351;});}return _0x4f0aaf;})[_0x922e('0x20')](respondWithResult(_0x1100a9,0xc9))[_0x922e('0x40')](handleError(_0x1100a9,null));};exports[_0x922e('0x1f')]=function(_0x111dac,_0x520e58){if(_0x111dac[_0x922e('0x46')]['id']){delete _0x111dac[_0x922e('0x46')]['id'];}return db[_0x922e('0x27')][_0x922e('0x45')]({'where':{'id':_0x111dac[_0x922e('0x42')]['id']}})[_0x922e('0x20')](handleEntityNotFound(_0x520e58,null))[_0x922e('0x20')](saveUpdates(_0x111dac[_0x922e('0x46')],null))[_0x922e('0x20')](respondWithResult(_0x520e58,null))[_0x922e('0x40')](handleError(_0x520e58,null));};exports['destroy']=function(_0x563b89,_0x52eeb2){return db[_0x922e('0x27')][_0x922e('0x45')]({'where':{'id':_0x563b89['params']['id']}})['then'](handleEntityNotFound(_0x52eeb2,null))[_0x922e('0x20')](removeEntity(_0x52eeb2,null))[_0x922e('0x40')](handleError(_0x52eeb2,null));};exports[_0x922e('0x50')]=function(_0x222a5b,_0x9187cc,_0x41f806){if(_0x222a5b['body']['id']){delete _0x222a5b[_0x922e('0x46')]['id'];}return db[_0x922e('0x27')]['find']({'where':{'id':_0x222a5b[_0x922e('0x42')]['id']}})[_0x922e('0x20')](handleEntityNotFound(_0x9187cc,null))[_0x922e('0x20')](function(_0x182d69){if(_0x182d69){_0x222a5b['body'][_0x922e('0x51')]=_0x182d69['id'];return db['Condition'][_0x922e('0x4e')](_0x222a5b[_0x922e('0x46')]);}})[_0x922e('0x20')](respondWithResult(_0x9187cc,null))[_0x922e('0x40')](handleError(_0x9187cc,null));};exports['addAnyCondition']=function(_0x4424eb,_0x36c23d,_0x5f15d7){if(_0x4424eb[_0x922e('0x46')]['id']){delete _0x4424eb[_0x922e('0x46')]['id'];}return db[_0x922e('0x27')][_0x922e('0x45')]({'where':{'id':_0x4424eb['params']['id']}})[_0x922e('0x20')](handleEntityNotFound(_0x36c23d,null))[_0x922e('0x20')](function(_0x30233b){if(_0x30233b){_0x4424eb[_0x922e('0x46')][_0x922e('0x52')]=_0x30233b['id'];return db[_0x922e('0x53')][_0x922e('0x4e')](_0x4424eb[_0x922e('0x46')]);}})[_0x922e('0x20')](respondWithResult(_0x36c23d,null))['catch'](handleError(_0x36c23d,null));};exports[_0x922e('0x54')]=function(_0x28569f,_0x569866,_0x53926b){var _0x119698={};var _0x174368={};var _0x1006e0;var _0x200fa1;return db[_0x922e('0x27')]['findOne']({'where':{'id':_0x28569f[_0x922e('0x42')]['id']}})[_0x922e('0x20')](handleEntityNotFound(_0x569866,null))[_0x922e('0x20')](function(_0x11b78a){if(_0x11b78a){_0x1006e0=_0x11b78a;_0x174368[_0x922e('0x2f')]=_[_0x922e('0x29')](db[_0x922e('0x53')][_0x922e('0x28')]);_0x174368[_0x922e('0x2b')]=_[_0x922e('0x29')](_0x28569f[_0x922e('0x2b')]);_0x174368[_0x922e('0x2d')]=_[_0x922e('0x2e')](_0x174368[_0x922e('0x2f')],_0x174368[_0x922e('0x2b')]);_0x119698[_0x922e('0x30')]=_[_0x922e('0x2e')](_0x174368[_0x922e('0x2f')],qs[_0x922e('0x31')](_0x28569f[_0x922e('0x2b')]['fields']));_0x119698['attributes']=_0x119698[_0x922e('0x30')][_0x922e('0x32')]?_0x119698[_0x922e('0x30')]:_0x174368[_0x922e('0x2f')];_0x119698[_0x922e('0x35')]=qs[_0x922e('0x36')](_0x28569f[_0x922e('0x2b')][_0x922e('0x36')]);_0x119698[_0x922e('0x37')]=qs[_0x922e('0x2d')](_[_0x922e('0x38')](_0x28569f[_0x922e('0x2b')],_0x174368[_0x922e('0x2d')]));if(_0x28569f[_0x922e('0x2b')]['filter']){_0x119698[_0x922e('0x37')]=_[_0x922e('0x3b')](_0x119698['where'],{'$or':_[_0x922e('0x55')](_0x119698[_0x922e('0x30')],function(_0x348728){var _0x510251={};_0x510251[_0x348728]={'$like':'%'+_0x28569f[_0x922e('0x2b')][_0x922e('0x3c')]+'%'};return _0x510251;})});}_0x119698=_['merge']({},_0x119698,_0x28569f[_0x922e('0x44')]);return _0x1006e0[_0x922e('0x54')](_0x119698);}})['then'](function(_0x2e60bd){if(_0x2e60bd){_0x200fa1=_0x2e60bd[_0x922e('0x32')];if(!_0x28569f[_0x922e('0x2b')]['hasOwnProperty'](_0x922e('0x34'))){_0x119698['limit']=qs['limit'](_0x28569f[_0x922e('0x2b')][_0x922e('0x1a')]);_0x119698[_0x922e('0x19')]=qs[_0x922e('0x19')](_0x28569f[_0x922e('0x2b')][_0x922e('0x19')]);}return _0x1006e0[_0x922e('0x54')](_0x119698);}})[_0x922e('0x20')](function(_0x34929c){if(_0x34929c){return _0x34929c?{'count':_0x200fa1,'rows':_0x34929c}:null;}})[_0x922e('0x20')](respondWithResult(_0x569866,null))[_0x922e('0x40')](handleError(_0x569866,null));};exports['getAnyConditions']=function(_0x514c1f,_0x1a4d3a,_0xd6d10){var _0x46a9ad={};var _0x5934b0={};var _0x4c3aac;var _0x392b16;return db[_0x922e('0x27')][_0x922e('0x56')]({'where':{'id':_0x514c1f[_0x922e('0x42')]['id']}})[_0x922e('0x20')](handleEntityNotFound(_0x1a4d3a,null))[_0x922e('0x20')](function(_0x2de808){if(_0x2de808){_0x4c3aac=_0x2de808;_0x5934b0[_0x922e('0x2f')]=_['keys'](db[_0x922e('0x53')][_0x922e('0x28')]);_0x5934b0[_0x922e('0x2b')]=_[_0x922e('0x29')](_0x514c1f[_0x922e('0x2b')]);_0x5934b0[_0x922e('0x2d')]=_[_0x922e('0x2e')](_0x5934b0[_0x922e('0x2f')],_0x5934b0[_0x922e('0x2b')]);_0x46a9ad[_0x922e('0x30')]=_['intersection'](_0x5934b0[_0x922e('0x2f')],qs[_0x922e('0x31')](_0x514c1f[_0x922e('0x2b')][_0x922e('0x31')]));_0x46a9ad[_0x922e('0x30')]=_0x46a9ad[_0x922e('0x30')][_0x922e('0x32')]?_0x46a9ad[_0x922e('0x30')]:_0x5934b0[_0x922e('0x2f')];_0x46a9ad[_0x922e('0x35')]=qs[_0x922e('0x36')](_0x514c1f[_0x922e('0x2b')][_0x922e('0x36')]);_0x46a9ad['where']=qs['filters'](_['pick'](_0x514c1f['query'],_0x5934b0[_0x922e('0x2d')]));if(_0x514c1f[_0x922e('0x2b')][_0x922e('0x3c')]){_0x46a9ad[_0x922e('0x37')]=_[_0x922e('0x3b')](_0x46a9ad[_0x922e('0x37')],{'$or':_[_0x922e('0x55')](_0x46a9ad['attributes'],function(_0x47767d){var _0x1bc261={};_0x1bc261[_0x47767d]={'$like':'%'+_0x514c1f[_0x922e('0x2b')][_0x922e('0x3c')]+'%'};return _0x1bc261;})});}_0x46a9ad=_[_0x922e('0x3b')]({},_0x46a9ad,_0x514c1f[_0x922e('0x44')]);return _0x4c3aac[_0x922e('0x57')](_0x46a9ad);}})[_0x922e('0x20')](function(_0x21cc96){if(_0x21cc96){_0x392b16=_0x21cc96[_0x922e('0x32')];if(!_0x514c1f[_0x922e('0x2b')][_0x922e('0x33')](_0x922e('0x34'))){_0x46a9ad[_0x922e('0x1a')]=qs['limit'](_0x514c1f['query']['limit']);_0x46a9ad[_0x922e('0x19')]=qs[_0x922e('0x19')](_0x514c1f[_0x922e('0x2b')]['offset']);}return _0x4c3aac[_0x922e('0x57')](_0x46a9ad);}})[_0x922e('0x20')](function(_0x4502c8){if(_0x4502c8){return _0x4502c8?{'count':_0x392b16,'rows':_0x4502c8}:null;}})[_0x922e('0x20')](respondWithResult(_0x1a4d3a,null))[_0x922e('0x40')](handleError(_0x1a4d3a,null));};exports[_0x922e('0x58')]=function(_0x2147b6,_0x1ed8a9,_0x5255be){if(_0x2147b6['body']['id']){delete _0x2147b6[_0x922e('0x46')]['id'];}return db[_0x922e('0x27')]['find']({'where':{'id':_0x2147b6['params']['id']}})['then'](handleEntityNotFound(_0x1ed8a9,null))[_0x922e('0x20')](function(_0x33977e){if(_0x33977e){_0x2147b6['body'][_0x922e('0x59')]=_0x33977e['id'];return db['Action'][_0x922e('0x4e')](_0x2147b6[_0x922e('0x46')]);}})[_0x922e('0x20')](respondWithResult(_0x1ed8a9,null))[_0x922e('0x40')](handleError(_0x1ed8a9,null));};exports[_0x922e('0x5a')]=function(_0x4c04ca,_0x67b21d,_0x358309){var _0x574082={};var _0x3a2fd6={};var _0x4df357;var _0xfaf318;return db[_0x922e('0x27')][_0x922e('0x56')]({'where':{'id':_0x4c04ca[_0x922e('0x42')]['id']}})[_0x922e('0x20')](handleEntityNotFound(_0x67b21d,null))[_0x922e('0x20')](function(_0x1aaa54){if(_0x1aaa54){_0x4df357=_0x1aaa54;_0x3a2fd6[_0x922e('0x2f')]=_[_0x922e('0x29')](db[_0x922e('0x5b')][_0x922e('0x28')]);_0x3a2fd6['query']=_[_0x922e('0x29')](_0x4c04ca[_0x922e('0x2b')]);_0x3a2fd6[_0x922e('0x2d')]=_[_0x922e('0x2e')](_0x3a2fd6['model'],_0x3a2fd6[_0x922e('0x2b')]);_0x574082['attributes']=_[_0x922e('0x2e')](_0x3a2fd6[_0x922e('0x2f')],qs[_0x922e('0x31')](_0x4c04ca[_0x922e('0x2b')]['fields']));_0x574082[_0x922e('0x30')]=_0x574082[_0x922e('0x30')][_0x922e('0x32')]?_0x574082['attributes']:_0x3a2fd6[_0x922e('0x2f')];_0x574082[_0x922e('0x35')]=qs[_0x922e('0x36')](_0x4c04ca[_0x922e('0x2b')][_0x922e('0x36')]);_0x574082[_0x922e('0x37')]=qs['filters'](_[_0x922e('0x38')](_0x4c04ca['query'],_0x3a2fd6[_0x922e('0x2d')]));if(_0x4c04ca[_0x922e('0x2b')][_0x922e('0x3c')]){_0x574082[_0x922e('0x37')]=_[_0x922e('0x3b')](_0x574082[_0x922e('0x37')],{'$or':_['map'](_0x574082['attributes'],function(_0x21afac){var _0x182502={};_0x182502[_0x21afac]={'$like':'%'+_0x4c04ca['query'][_0x922e('0x3c')]+'%'};return _0x182502;})});}_0x574082=_['merge']({},_0x574082,_0x4c04ca[_0x922e('0x44')]);return _0x4df357[_0x922e('0x5a')](_0x574082);}})['then'](function(_0x3a69b6){if(_0x3a69b6){_0xfaf318=_0x3a69b6['length'];if(!_0x4c04ca['query'][_0x922e('0x33')](_0x922e('0x34'))){_0x574082['limit']=qs[_0x922e('0x1a')](_0x4c04ca['query'][_0x922e('0x1a')]);_0x574082[_0x922e('0x19')]=qs[_0x922e('0x19')](_0x4c04ca[_0x922e('0x2b')][_0x922e('0x19')]);}return _0x4df357[_0x922e('0x5a')](_0x574082);}})[_0x922e('0x20')](function(_0x4e2dc1){if(_0x4e2dc1){return _0x4e2dc1?{'count':_0xfaf318,'rows':_0x4e2dc1}:null;}})['then'](respondWithResult(_0x67b21d,null))[_0x922e('0x40')](handleError(_0x67b21d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 86045ef..bd6ed2b 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 _0xc964=['./trigger.attributes','define','Trigger','tools_triggers','lodash','api','bluebird'];(function(_0x3f717c,_0x32cd68){var _0x53d9ec=function(_0x240fe7){while(--_0x240fe7){_0x3f717c['push'](_0x3f717c['shift']());}};_0x53d9ec(++_0x32cd68);}(_0xc964,0x107));var _0x4c96=function(_0x203339,_0x65b769){_0x203339=_0x203339-0x0;var _0x1c06fa=_0xc964[_0x203339];return _0x1c06fa;};'use strict';var _=require(_0x4c96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4c96('0x1'));var moment=require('moment');var BPromise=require(_0x4c96('0x2'));var rp=require('request-promise');var attributes=require(_0x4c96('0x3'));module['exports']=function(_0x1e979e,_0x1fe28d){return _0x1e979e[_0x4c96('0x4')](_0x4c96('0x5'),attributes,{'tableName':_0x4c96('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x575d=['tools_triggers','lodash','util','../../config/logger','api','bluebird','exports','define','Trigger'];(function(_0x33fe91,_0x2aa1dd){var _0x234322=function(_0x1ea65b){while(--_0x1ea65b){_0x33fe91['push'](_0x33fe91['shift']());}};_0x234322(++_0x2aa1dd);}(_0x575d,0x106));var _0xd575=function(_0x5b67d6,_0x5ce7db){_0x5b67d6=_0x5b67d6-0x0;var _0x1c0399=_0x575d[_0x5b67d6];return _0x1c0399;};'use strict';var _=require(_0xd575('0x0'));var util=require(_0xd575('0x1'));var logger=require(_0xd575('0x2'))(_0xd575('0x3'));var moment=require('moment');var BPromise=require(_0xd575('0x4'));var rp=require('request-promise');var attributes=require('./trigger.attributes');module[_0xd575('0x5')]=function(_0x57ad65,_0x4c2ceb){return _0x57ad65[_0xd575('0x6')](_0xd575('0x7'),attributes,{'tableName':_0xd575('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 fca2314..bdf9e5f 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 _0x4dac=['request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetTrigger','Trigger','options','where','attributes','limit','map','model','include','ShowTrigger','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Trigger,\x20%s,\x20%s'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x4dac,0x1cf));var _0xc4da=function(_0x2cbc82,_0x30d15a){_0x2cbc82=_0x2cbc82-0x0;var _0x222f31=_0x4dac[_0x2cbc82];return _0x222f31;};'use strict';var _=require(_0xc4da('0x0'));var util=require('util');var moment=require(_0xc4da('0x1'));var BPromise=require(_0xc4da('0x2'));var rs=require(_0xc4da('0x3'));var fs=require('fs');var Redis=require(_0xc4da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4da('0x5'));var logger=require(_0xc4da('0x6'))(_0xc4da('0x7'));var config=require(_0xc4da('0x8'));var jayson=require(_0xc4da('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34b9d1,_0x1a4664,_0x34e88f){return new BPromise(function(_0x4f22b2,_0x4b0bab){return client[_0xc4da('0xa')](_0x34b9d1,_0x34e88f)[_0xc4da('0xb')](function(_0x55bb32){logger['info'](_0xc4da('0xc'),_0x1a4664,_0xc4da('0xd'));logger[_0xc4da('0xe')](_0xc4da('0xf'),_0x1a4664,_0xc4da('0xd'),JSON[_0xc4da('0x10')](_0x55bb32));if(_0x55bb32[_0xc4da('0x11')]){if(_0x55bb32[_0xc4da('0x11')]['code']===0x1f4){logger[_0xc4da('0x11')]('Trigger,\x20%s,\x20%s',_0x1a4664,_0x55bb32['error']['message']);return _0x4b0bab(_0x55bb32['error'][_0xc4da('0x12')]);}logger[_0xc4da('0x11')](_0xc4da('0xc'),_0x1a4664,_0x55bb32[_0xc4da('0x11')]['message']);return _0x4f22b2(_0x55bb32['error'][_0xc4da('0x12')]);}else{logger[_0xc4da('0x13')](_0xc4da('0xc'),_0x1a4664,_0xc4da('0xd'));_0x4f22b2(_0x55bb32[_0xc4da('0x14')][_0xc4da('0x12')]);}})[_0xc4da('0x15')](function(_0x1129ca){logger[_0xc4da('0x11')]('Trigger,\x20%s,\x20%s',_0x1a4664,_0x1129ca);_0x4b0bab(_0x1129ca);});});}exports[_0xc4da('0x16')]=function(_0xda4bd9){var _0x292fc2=this;return new Promise(function(_0x415fbd,_0x2901b1){return db[_0xc4da('0x17')]['findAll']({'raw':_0xda4bd9[_0xc4da('0x18')]?_0xda4bd9[_0xc4da('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xda4bd9[_0xc4da('0x18')]?_0xda4bd9[_0xc4da('0x18')][_0xc4da('0x19')]||null:null,'attributes':_0xda4bd9[_0xc4da('0x18')]?_0xda4bd9[_0xc4da('0x18')][_0xc4da('0x1a')]||null:null,'limit':_0xda4bd9[_0xc4da('0x18')]?_0xda4bd9[_0xc4da('0x18')][_0xc4da('0x1b')]||null:null,'include':_0xda4bd9[_0xc4da('0x18')]?_0xda4bd9[_0xc4da('0x18')]['include']?_[_0xc4da('0x1c')](_0xda4bd9[_0xc4da('0x18')]['include'],function(_0x255cc7){return{'model':db[_0x255cc7[_0xc4da('0x1d')]],'as':_0x255cc7['as'],'attributes':_0x255cc7[_0xc4da('0x1a')],'include':_0x255cc7[_0xc4da('0x1e')]?_[_0xc4da('0x1c')](_0x255cc7['include'],function(_0x9006ed){return{'model':db[_0x9006ed[_0xc4da('0x1d')]],'as':_0x9006ed['as'],'attributes':_0x9006ed['attributes'],'include':_0x9006ed['include']?_[_0xc4da('0x1c')](_0x9006ed[_0xc4da('0x1e')],function(_0x48f707){return{'model':db[_0x48f707['model']],'as':_0x48f707['as'],'attributes':_0x48f707[_0xc4da('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x485fb9){logger['info']('GetTrigger',_0xda4bd9);logger[_0xc4da('0xe')](_0xc4da('0x16'),_0xda4bd9,JSON[_0xc4da('0x10')](_0x485fb9));_0x415fbd(_0x485fb9);})[_0xc4da('0x15')](function(_0x136306){logger[_0xc4da('0x11')](_0xc4da('0x16'),_0x136306[_0xc4da('0x12')],_0xda4bd9);_0x2901b1(_0x292fc2[_0xc4da('0x11')](0x1f4,_0x136306[_0xc4da('0x12')]));});});};exports[_0xc4da('0x1f')]=function(_0x33ea90){var _0x513162=this;return new Promise(function(_0x17f3fe,_0x499baa){return db[_0xc4da('0x17')][_0xc4da('0x20')]({'raw':_0x33ea90[_0xc4da('0x18')]?_0x33ea90[_0xc4da('0x18')][_0xc4da('0x21')]===undefined?!![]:![]:!![],'where':_0x33ea90[_0xc4da('0x18')]?_0x33ea90['options'][_0xc4da('0x19')]||null:null,'attributes':_0x33ea90[_0xc4da('0x18')]?_0x33ea90[_0xc4da('0x18')]['attributes']||null:null,'include':_0x33ea90[_0xc4da('0x18')]?_0x33ea90[_0xc4da('0x18')][_0xc4da('0x1e')]?_[_0xc4da('0x1c')](_0x33ea90[_0xc4da('0x18')]['include'],function(_0x39c2aa){return{'model':db[_0x39c2aa['model']],'as':_0x39c2aa['as'],'attributes':_0x39c2aa['attributes'],'include':_0x39c2aa[_0xc4da('0x1e')]?_[_0xc4da('0x1c')](_0x39c2aa[_0xc4da('0x1e')],function(_0x13b6db){return{'model':db[_0x13b6db[_0xc4da('0x1d')]],'as':_0x13b6db['as'],'attributes':_0x13b6db[_0xc4da('0x1a')],'include':_0x13b6db['include']?_[_0xc4da('0x1c')](_0x13b6db[_0xc4da('0x1e')],function(_0x4e3863){return{'model':db[_0x4e3863[_0xc4da('0x1d')]],'as':_0x4e3863['as'],'attributes':_0x4e3863[_0xc4da('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc4da('0xb')](function(_0x5983fb){logger[_0xc4da('0x13')](_0xc4da('0x1f'),_0x33ea90);logger[_0xc4da('0xe')](_0xc4da('0x1f'),_0x33ea90,JSON['stringify'](_0x5983fb));_0x17f3fe(_0x5983fb);})[_0xc4da('0x15')](function(_0x228954){logger['error'](_0xc4da('0x1f'),_0x228954[_0xc4da('0x12')],_0x33ea90);_0x499baa(_0x513162[_0xc4da('0x11')](0x1f4,_0x228954[_0xc4da('0x12')]));});});}; \ No newline at end of file +var _0xac1a=['../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Trigger','findAll','options','raw','attributes','limit','include','map','model','GetTrigger','stringify','ShowTrigger','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x179b6,_0x3dd063){var _0x58ef03=function(_0x4f8c78){while(--_0x4f8c78){_0x179b6['push'](_0x179b6['shift']());}};_0x58ef03(++_0x3dd063);}(_0xac1a,0xb2));var _0xaac1=function(_0x441a42,_0x75d50d){_0x441a42=_0x441a42-0x0;var _0x3d992d=_0xac1a[_0x441a42];return _0x3d992d;};'use strict';var _=require(_0xaac1('0x0'));var util=require(_0xaac1('0x1'));var moment=require(_0xaac1('0x2'));var BPromise=require(_0xaac1('0x3'));var rs=require(_0xaac1('0x4'));var fs=require('fs');var Redis=require(_0xaac1('0x5'));var db=require(_0xaac1('0x6'))['db'];var utils=require(_0xaac1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xaac1('0x8'));var jayson=require(_0xaac1('0x9'));var client=jayson[_0xaac1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x295b7f,_0x2b6096,_0x1afaf1){return new BPromise(function(_0x402037,_0x4ee5e6){return client[_0xaac1('0xb')](_0x295b7f,_0x1afaf1)[_0xaac1('0xc')](function(_0x52f720){logger[_0xaac1('0xd')](_0xaac1('0xe'),_0x2b6096,_0xaac1('0xf'));logger[_0xaac1('0x10')](_0xaac1('0x11'),_0x2b6096,'request\x20sent',JSON['stringify'](_0x52f720));if(_0x52f720[_0xaac1('0x12')]){if(_0x52f720[_0xaac1('0x12')][_0xaac1('0x13')]===0x1f4){logger[_0xaac1('0x12')](_0xaac1('0xe'),_0x2b6096,_0x52f720[_0xaac1('0x12')][_0xaac1('0x14')]);return _0x4ee5e6(_0x52f720[_0xaac1('0x12')][_0xaac1('0x14')]);}logger[_0xaac1('0x12')](_0xaac1('0xe'),_0x2b6096,_0x52f720[_0xaac1('0x12')]['message']);return _0x402037(_0x52f720['error'][_0xaac1('0x14')]);}else{logger['info'](_0xaac1('0xe'),_0x2b6096,_0xaac1('0xf'));_0x402037(_0x52f720[_0xaac1('0x15')]['message']);}})[_0xaac1('0x16')](function(_0x44458c){logger[_0xaac1('0x12')](_0xaac1('0xe'),_0x2b6096,_0x44458c);_0x4ee5e6(_0x44458c);});});}exports['GetTrigger']=function(_0x99c1c3){var _0x5e2508=this;return new Promise(function(_0xa7b0a,_0x3b040b){return db[_0xaac1('0x17')][_0xaac1('0x18')]({'raw':_0x99c1c3['options']?_0x99c1c3[_0xaac1('0x19')][_0xaac1('0x1a')]===undefined?!![]:![]:!![],'where':_0x99c1c3['options']?_0x99c1c3[_0xaac1('0x19')]['where']||null:null,'attributes':_0x99c1c3[_0xaac1('0x19')]?_0x99c1c3['options'][_0xaac1('0x1b')]||null:null,'limit':_0x99c1c3['options']?_0x99c1c3[_0xaac1('0x19')][_0xaac1('0x1c')]||null:null,'include':_0x99c1c3[_0xaac1('0x19')]?_0x99c1c3[_0xaac1('0x19')][_0xaac1('0x1d')]?_[_0xaac1('0x1e')](_0x99c1c3['options'][_0xaac1('0x1d')],function(_0x21fc67){return{'model':db[_0x21fc67[_0xaac1('0x1f')]],'as':_0x21fc67['as'],'attributes':_0x21fc67[_0xaac1('0x1b')],'include':_0x21fc67[_0xaac1('0x1d')]?_[_0xaac1('0x1e')](_0x21fc67[_0xaac1('0x1d')],function(_0x509d0a){return{'model':db[_0x509d0a[_0xaac1('0x1f')]],'as':_0x509d0a['as'],'attributes':_0x509d0a[_0xaac1('0x1b')],'include':_0x509d0a['include']?_['map'](_0x509d0a[_0xaac1('0x1d')],function(_0x3dd100){return{'model':db[_0x3dd100['model']],'as':_0x3dd100['as'],'attributes':_0x3dd100[_0xaac1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaac1('0xc')](function(_0x41caa2){logger[_0xaac1('0xd')](_0xaac1('0x20'),_0x99c1c3);logger[_0xaac1('0x10')](_0xaac1('0x20'),_0x99c1c3,JSON[_0xaac1('0x21')](_0x41caa2));_0xa7b0a(_0x41caa2);})[_0xaac1('0x16')](function(_0x2335af){logger[_0xaac1('0x12')](_0xaac1('0x20'),_0x2335af[_0xaac1('0x14')],_0x99c1c3);_0x3b040b(_0x5e2508[_0xaac1('0x12')](0x1f4,_0x2335af[_0xaac1('0x14')]));});});};exports[_0xaac1('0x22')]=function(_0x41d0f0){var _0x4b859e=this;return new Promise(function(_0x25ee2b,_0x442b1f){return db[_0xaac1('0x17')][_0xaac1('0x23')]({'raw':_0x41d0f0[_0xaac1('0x19')]?_0x41d0f0[_0xaac1('0x19')][_0xaac1('0x1a')]===undefined?!![]:![]:!![],'where':_0x41d0f0[_0xaac1('0x19')]?_0x41d0f0[_0xaac1('0x19')][_0xaac1('0x24')]||null:null,'attributes':_0x41d0f0[_0xaac1('0x19')]?_0x41d0f0[_0xaac1('0x19')][_0xaac1('0x1b')]||null:null,'include':_0x41d0f0['options']?_0x41d0f0[_0xaac1('0x19')][_0xaac1('0x1d')]?_[_0xaac1('0x1e')](_0x41d0f0[_0xaac1('0x19')][_0xaac1('0x1d')],function(_0x3900d4){return{'model':db[_0x3900d4['model']],'as':_0x3900d4['as'],'attributes':_0x3900d4[_0xaac1('0x1b')],'include':_0x3900d4[_0xaac1('0x1d')]?_['map'](_0x3900d4[_0xaac1('0x1d')],function(_0x182c2b){return{'model':db[_0x182c2b[_0xaac1('0x1f')]],'as':_0x182c2b['as'],'attributes':_0x182c2b[_0xaac1('0x1b')],'include':_0x182c2b[_0xaac1('0x1d')]?_[_0xaac1('0x1e')](_0x182c2b[_0xaac1('0x1d')],function(_0xf1121d){return{'model':db[_0xf1121d[_0xaac1('0x1f')]],'as':_0xf1121d['as'],'attributes':_0xf1121d[_0xaac1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37be30){logger[_0xaac1('0xd')]('ShowTrigger',_0x41d0f0);logger[_0xaac1('0x10')](_0xaac1('0x22'),_0x41d0f0,JSON[_0xaac1('0x21')](_0x37be30));_0x25ee2b(_0x37be30);})[_0xaac1('0x16')](function(_0x273df2){logger['error']('ShowTrigger',_0x273df2[_0xaac1('0x14')],_0x41d0f0);_0x442b1f(_0x4b859e['error'](0x1f4,_0x273df2[_0xaac1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index b435cec..b171243 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 _0x1966=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','/:id/clone','clone','post','create','put','update','delete','destroy'];(function(_0x46f7c5,_0x44d7a6){var _0x3b2634=function(_0x141e66){while(--_0x141e66){_0x46f7c5['push'](_0x46f7c5['shift']());}};_0x3b2634(++_0x44d7a6);}(_0x1966,0x1e4));var _0x6196=function(_0x515ac8,_0x2c89b0){_0x515ac8=_0x515ac8-0x0;var _0x318a3b=_0x1966[_0x515ac8];return _0x318a3b;};'use strict';var multer=require(_0x6196('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6196('0x1'));var express=require(_0x6196('0x2'));var router=express[_0x6196('0x3')]();var auth=require(_0x6196('0x4'));var interaction=require(_0x6196('0x5'));var config=require(_0x6196('0x6'));var controller=require(_0x6196('0x7'));router[_0x6196('0x8')]('/',auth[_0x6196('0x9')](),controller['index']);router[_0x6196('0x8')](_0x6196('0xa'),auth['isAuthenticated'](),controller[_0x6196('0xb')]);router['post'](_0x6196('0xc'),auth['isAuthenticated'](),controller[_0x6196('0xd')]);router[_0x6196('0xe')]('/',auth[_0x6196('0x9')](),controller[_0x6196('0xf')]);router[_0x6196('0x10')](_0x6196('0xa'),auth[_0x6196('0x9')](),controller[_0x6196('0x11')]);router[_0x6196('0x12')](_0x6196('0xa'),auth[_0x6196('0x9')](),controller[_0x6196('0x13')]);module[_0x6196('0x14')]=router; \ No newline at end of file +var _0xecc6=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','clone','create','put','update','/:id','exports','util','path','connect-timeout','express','Router'];(function(_0x5125e9,_0x2be8c8){var _0x23aced=function(_0x1994e6){while(--_0x1994e6){_0x5125e9['push'](_0x5125e9['shift']());}};_0x23aced(++_0x2be8c8);}(_0xecc6,0x13f));var _0x6ecc=function(_0x5d3f56,_0x5d8673){_0x5d3f56=_0x5d3f56-0x0;var _0x316c9d=_0xecc6[_0x5d3f56];return _0x316c9d;};'use strict';var multer=require('multer');var util=require(_0x6ecc('0x0'));var path=require(_0x6ecc('0x1'));var timeout=require(_0x6ecc('0x2'));var express=require(_0x6ecc('0x3'));var router=express[_0x6ecc('0x4')]();var auth=require(_0x6ecc('0x5'));var interaction=require(_0x6ecc('0x6'));var config=require(_0x6ecc('0x7'));var controller=require('./trunk.controller');router[_0x6ecc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6ecc('0x8')]('/:id',auth[_0x6ecc('0x9')](),controller[_0x6ecc('0xa')]);router[_0x6ecc('0xb')]('/:id/clone',auth[_0x6ecc('0x9')](),controller[_0x6ecc('0xc')]);router[_0x6ecc('0xb')]('/',auth[_0x6ecc('0x9')](),controller[_0x6ecc('0xd')]);router[_0x6ecc('0xe')]('/:id',auth[_0x6ecc('0x9')](),controller[_0x6ecc('0xf')]);router['delete'](_0x6ecc('0x10'),auth[_0x6ecc('0x9')](),controller['destroy']);module[_0x6ecc('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index e6dccf7..acbcfd4 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(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_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 _0x2032=['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]','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','exports','STRING','name','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','getDataValue','rfc2833','inband','auto','yes','nonat','update','outgoing','setDataValue','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0xc0f08f,_0x634f7){var _0xac706d=function(_0xa37b26){while(--_0xa37b26){_0xc0f08f['push'](_0xc0f08f['shift']());}};_0xac706d(++_0x634f7);}(_0x2032,0xd9));var _0x2203=function(_0xbac07a,_0x45f70b){_0xbac07a=_0xbac07a-0x0;var _0x166ff4=_0x2032[_0xbac07a];return _0x166ff4;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2203('0x3'),_0x2203('0x4'),'peer'),'allowNull':![],'defaultValue':_0x2203('0x3')},'context':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'defaultValue':_0x2203('0x5')},'callingpres':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x7'),_0x2203('0x8'),_0x2203('0x9'),_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc'),_0x2203('0xd'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2203('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x2203('0x1')]},'remotesecret':{'type':Sequelize[_0x2203('0x1')]},'transport':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'udp','set':function(_0x849049){this['setDataValue'](_0x2203('0xe'),_0x849049?_0x849049['join'](','):null);},'get':function(){return this[_0x2203('0xf')](_0x2203('0xe'))?this['getDataValue']('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x2203('0x10'),'info','shortinfo',_0x2203('0x11'),_0x2203('0x12')),'defaultValue':_0x2203('0x10')},'directmedia':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x14'),_0x2203('0x15'),_0x2203('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x2203('0x1')]},'nat':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x3f9ef6){this[_0x2203('0x17')]('nat',_0x3f9ef6?_0x3f9ef6[_0x2203('0x18')](','):null);},'get':function(){return this['getDataValue'](_0x2203('0x19'))?this[_0x2203('0xf')](_0x2203('0x19'))[_0x2203('0x1a')](','):null;},'comment':_0x2203('0x1b')},'callgroup':{'type':Sequelize[_0x2203('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2203('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2203('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x1c')},'allow':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3ee25b){this['setDataValue']('allow',_0x3ee25b?_0x3ee25b[_0x2203('0x18')](';'):_0x2203('0x1d'));},'get':function(){return this[_0x2203('0xf')](_0x2203('0x1e'))?this[_0x2203('0xf')](_0x2203('0x1e'))[_0x2203('0x1a')](';'):null;},'comment':_0x2203('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'insecure':{'type':Sequelize[_0x2203('0x1')],'defaultValue':_0x2203('0x20'),'set':function(_0x5f11bf){this[_0x2203('0x17')](_0x2203('0x21'),_0x5f11bf?_0x5f11bf['join'](','):null);},'get':function(){return this[_0x2203('0xf')](_0x2203('0x21'))?this[_0x2203('0xf')](_0x2203('0x21'))[_0x2203('0x1a')](','):null;},'comment':_0x2203('0x22')},'trustrpid':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no','never')},'promiscredir':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x2203('0x1')]},'callerid':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2203('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x2203('0x1')]},'template':{'type':Sequelize[_0x2203('0x1')]},'videosupport':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2203('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'mailbox':{'type':Sequelize[_0x2203('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x2203('0x25'),_0x2203('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x2203('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2203('0x27'),_0x2203('0x28')),'defaultValue':_0x2203('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x2203('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2203('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2203('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x2203('0x1')]},'defaultuser':{'type':Sequelize[_0x2203('0x1')]},'rtptimeout':{'type':Sequelize[_0x2203('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2203('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x2203('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2203('0x1')]},'callbackextension':{'type':Sequelize[_0x2203('0x1')]},'timert1':{'type':Sequelize[_0x2203('0x23')](0xb)},'timerb':{'type':Sequelize[_0x2203('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2203('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x2203('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2203('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x2203('0x1')]},'use_q850_reason':{'type':Sequelize[_0x2203('0x1')]},'maxforwards':{'type':Sequelize[_0x2203('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'force_avp':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'icesupport':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x2a'),_0x2203('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x2203('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2203('0x1')]},'dtlscipher':{'type':Sequelize[_0x2203('0x1')]},'dtlscafile':{'type':Sequelize[_0x2203('0x1')]},'dtlscapath':{'type':Sequelize[_0x2203('0x1')]},'dtlssetup':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x2c'),_0x2203('0x2d'),_0x2203('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2203('0x1')]},'usereqphone':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2203('0x1')]},'recordofffeature':{'type':Sequelize[_0x2203('0x1')]},'call_limit':{'type':Sequelize[_0x2203('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2203('0x1')]},'mohsuggest':{'type':Sequelize[_0x2203('0x1')]},'parkinglot':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x2f')},'canreinvite':{'type':Sequelize[_0x2203('0x6')]('yes','no',_0x2203('0x14'),_0x2203('0x15'),_0x2203('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2203('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2203('0x1')],'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 da5ff1e..07c9e81 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 _0x3dca=['fields','length','nolimit','offset','order','where','filters','add','day','filter','merge','map','count','includeAll','include','catch','show','options','find','clone','params','omit','createdAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','limit','set','json','apply','then','get','UserProfileResource','destroy','stack','name','send','index','Trunk','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x3dca,0x9c));var _0xa3dc=function(_0x362745,_0xf706fe){_0x362745=_0x362745-0x0;var _0x4d65d2=_0x3dca[_0x362745];return _0x4d65d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa3dc('0x0'));var rimraf=require(_0xa3dc('0x1'));var zipdir=require(_0xa3dc('0x2'));var jsonpatch=require(_0xa3dc('0x3'));var rp=require(_0xa3dc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa3dc('0x5'));var util=require(_0xa3dc('0x6'));var path=require(_0xa3dc('0x7'));var sox=require(_0xa3dc('0x8'));var csv=require('to-csv');var ejs=require(_0xa3dc('0x9'));var fs=require('fs');var _=require(_0xa3dc('0xa'));var squel=require(_0xa3dc('0xb'));var crypto=require('crypto');var jsforce=require(_0xa3dc('0xc'));var deskjs=require(_0xa3dc('0xd'));var toCsv=require(_0xa3dc('0xe'));var querystring=require(_0xa3dc('0xf'));var Papa=require(_0xa3dc('0x10'));var Redis=require(_0xa3dc('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0xa3dc('0x12'))(_0xa3dc('0x13'));var utils=require(_0xa3dc('0x14'));var config=require(_0xa3dc('0x15'));var db=require(_0xa3dc('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa3dc('0x17')][_0xa3dc('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x8dc2b9,_0x10090f,_0x2ac182,_0x2bf9e2){return new BPromise(function(_0x22388b,_0x1da26b){var _0x310fff=_0x2bf9e2||client;return _0x310fff[_0xa3dc('0x19')](_0x8dc2b9,_0x2ac182)['then'](function(_0x5a736f){logger[_0xa3dc('0x1a')](_0xa3dc('0x1b'),_0x10090f,_0xa3dc('0x1c'));logger[_0xa3dc('0x1d')](_0xa3dc('0x1e'),_0x10090f,_0xa3dc('0x1c'),JSON[_0xa3dc('0x1f')](_0x5a736f));if(_0x5a736f[_0xa3dc('0x20')]){if(_0x5a736f[_0xa3dc('0x20')][_0xa3dc('0x21')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x10090f,_0x5a736f[_0xa3dc('0x20')][_0xa3dc('0x22')]);return _0x1da26b(_0x5a736f[_0xa3dc('0x20')]['message']);}logger[_0xa3dc('0x20')]('Trunk,\x20%s,\x20%s',_0x10090f,_0x5a736f[_0xa3dc('0x20')][_0xa3dc('0x22')]);return _0x22388b(_0x5a736f[_0xa3dc('0x20')][_0xa3dc('0x22')]);}else{logger[_0xa3dc('0x1a')](_0xa3dc('0x1b'),_0x10090f,'request\x20sent');_0x22388b(_0x5a736f[_0xa3dc('0x23')][_0xa3dc('0x22')]);}})['catch'](function(_0xe0b6aa){logger[_0xa3dc('0x20')]('Trunk,\x20%s,\x20%s',_0x10090f,_0xe0b6aa);_0x1da26b(_0xe0b6aa);});});}function respondWithStatusCode(_0x1b489d,_0x30f1d0){_0x30f1d0=_0x30f1d0||0xcc;return function(_0x147e28){if(_0x147e28){return _0x1b489d[_0xa3dc('0x24')](_0x30f1d0);}return _0x1b489d['status'](_0x30f1d0)[_0xa3dc('0x25')]();};}function respondWithResult(_0x4f73ee,_0x3678f9){_0x3678f9=_0x3678f9||0xc8;return function(_0xacbc25){if(_0xacbc25){return _0x4f73ee[_0xa3dc('0x26')](_0x3678f9)['json'](_0xacbc25);}};}function respondWithFilteredResult(_0x1264f5,_0x25449a){return function(_0x4367a2){if(_0x4367a2){var _0x4ec1f2=_0x4367a2['count'],_0x3a0566=_0x25449a['offset'],_0x1757d6=_0x25449a['offset']+_0x25449a[_0xa3dc('0x27')],_0x4c88ce;if(_0x1757d6>=_0x4ec1f2){_0x1757d6=_0x4ec1f2;_0x4c88ce=0xc8;}else{_0x4c88ce=0xce;}_0x1264f5['status'](_0x4c88ce);return _0x1264f5[_0xa3dc('0x28')]('Content-Range',_0x3a0566+'-'+_0x1757d6+'/'+_0x4ec1f2)[_0xa3dc('0x29')](_0x4367a2);}return null;};}function patchUpdates(_0x3b687e){return function(_0x4eb0ba){try{jsonpatch[_0xa3dc('0x2a')](_0x4eb0ba,_0x3b687e,!![]);}catch(_0x105398){return BPromise['reject'](_0x105398);}return _0x4eb0ba['save']();};}function saveUpdates(_0x36fac6,_0xbb91ce){return function(_0x146fc5){if(_0x146fc5){return _0x146fc5['update'](_0x36fac6)[_0xa3dc('0x2b')](function(_0x422365){return _0x422365;});}return null;};}function removeEntity(_0x5d53d7,_0x72521c){return function(_0x47f3a8){if(_0x47f3a8){return _0x47f3a8['destroy']()[_0xa3dc('0x2b')](function(){var _0x4e3188=_0x47f3a8[_0xa3dc('0x2c')]({'plain':!![]});var _0x5ab2ef='Trunks';return db[_0xa3dc('0x2d')][_0xa3dc('0x2e')]({'where':{'type':_0x5ab2ef,'resourceId':_0x4e3188['id']}})[_0xa3dc('0x2b')](function(){return _0x47f3a8;});})[_0xa3dc('0x2b')](function(){_0x5d53d7['status'](0xcc)[_0xa3dc('0x25')]();});}};}function handleEntityNotFound(_0x444ff4,_0x9ab733){return function(_0x3d7ead){if(!_0x3d7ead){_0x444ff4[_0xa3dc('0x24')](0x194);}return _0x3d7ead;};}function handleError(_0x1064b7,_0xf35390){_0xf35390=_0xf35390||0x1f4;return function(_0x131955){logger['error'](_0x131955[_0xa3dc('0x2f')]);if(_0x131955[_0xa3dc('0x30')]){delete _0x131955['name'];}_0x1064b7[_0xa3dc('0x26')](_0xf35390)[_0xa3dc('0x31')](_0x131955);};}exports[_0xa3dc('0x32')]=function(_0xd87b58,_0x35dc6e){var _0x4ad910={},_0x7761cc={},_0x21aa78={'count':0x0,'rows':[]};var _0x47e30f=db[_0xa3dc('0x33')][_0xa3dc('0x34')];_0x7761cc['model']=_[_0xa3dc('0x35')](_0x47e30f);var _0x3201b6={'dateStart':_0xd87b58[_0xa3dc('0x36')][_0xa3dc('0x37')],'dateEnd':_0xd87b58['query'][_0xa3dc('0x38')]};delete _0xd87b58[_0xa3dc('0x36')][_0xa3dc('0x37')];delete _0xd87b58[_0xa3dc('0x36')][_0xa3dc('0x38')];_0x7761cc[_0xa3dc('0x36')]=_['keys'](_0xd87b58[_0xa3dc('0x36')]);_0x7761cc['filters']=_[_0xa3dc('0x39')](_0x7761cc[_0xa3dc('0x3a')],_0x7761cc['query']);_0x4ad910[_0xa3dc('0x3b')]=_['intersection'](_0x7761cc[_0xa3dc('0x3a')],qs[_0xa3dc('0x3c')](_0xd87b58['query'][_0xa3dc('0x3c')]));_0x4ad910[_0xa3dc('0x3b')]=_0x4ad910[_0xa3dc('0x3b')][_0xa3dc('0x3d')]?_0x4ad910['attributes']:_0x7761cc[_0xa3dc('0x3a')];if(!_0xd87b58['query']['hasOwnProperty'](_0xa3dc('0x3e'))){_0x4ad910[_0xa3dc('0x27')]=qs[_0xa3dc('0x27')](_0xd87b58[_0xa3dc('0x36')]['limit']);_0x4ad910[_0xa3dc('0x3f')]=qs[_0xa3dc('0x3f')](_0xd87b58[_0xa3dc('0x36')][_0xa3dc('0x3f')]);}_0x4ad910[_0xa3dc('0x40')]=qs['sort'](_0xd87b58[_0xa3dc('0x36')]['sort']);_0x4ad910[_0xa3dc('0x41')]=qs['filters'](_['pick'](_0xd87b58[_0xa3dc('0x36')],_0x7761cc[_0xa3dc('0x42')]));if(_0x3201b6['dateStart']){if(_0x3201b6[_0xa3dc('0x38')]){_0x3201b6[_0xa3dc('0x38')]=moment(_0x3201b6[_0xa3dc('0x38')])[_0xa3dc('0x43')](0x1,_0xa3dc('0x44'));}else{_0x3201b6['dateEnd']=moment(_0x3201b6[_0xa3dc('0x37')])['add'](0x1,'day');}_['merge'](_0x4ad910[_0xa3dc('0x41')],{'createdAt':{'$gte':_0x3201b6[_0xa3dc('0x37')],'$lte':_0x3201b6[_0xa3dc('0x38')]}});}if(_0xd87b58[_0xa3dc('0x36')][_0xa3dc('0x45')]){_0x4ad910[_0xa3dc('0x41')]=_[_0xa3dc('0x46')](_0x4ad910['where'],{'$or':_[_0xa3dc('0x47')](_0x4ad910['attributes'],function(_0x2694c9){var _0x9e0c4f={};_0x9e0c4f[_0x2694c9]={'$like':'%'+_0xd87b58[_0xa3dc('0x36')][_0xa3dc('0x45')]+'%'};return _0x9e0c4f;})});}_0x4ad910=_[_0xa3dc('0x46')]({},_0x4ad910,_0xd87b58['options']);var _0xcc629c={'where':_0x4ad910[_0xa3dc('0x41')]};return db['Trunk'][_0xa3dc('0x48')](_0xcc629c)['then'](function(_0x2baed3){_0x21aa78[_0xa3dc('0x48')]=_0x2baed3;if(_0xd87b58[_0xa3dc('0x36')][_0xa3dc('0x49')]){_0x4ad910[_0xa3dc('0x4a')]=[{'all':!![]}];}return db['Trunk']['findAll'](_0x4ad910);})[_0xa3dc('0x2b')](function(_0x590a06){_0x21aa78['rows']=_0x590a06;return _0x21aa78;})[_0xa3dc('0x2b')](respondWithFilteredResult(_0x35dc6e,_0x4ad910))[_0xa3dc('0x4b')](handleError(_0x35dc6e,null));};exports[_0xa3dc('0x4c')]=function(_0x7947f9,_0x1c3bf9){var _0x22a260={'raw':![],'where':{'id':_0x7947f9['params']['id']}},_0x2eb8fe={};_0x2eb8fe['model']=_[_0xa3dc('0x35')](db[_0xa3dc('0x33')][_0xa3dc('0x34')]);_0x2eb8fe[_0xa3dc('0x36')]=_[_0xa3dc('0x35')](_0x7947f9[_0xa3dc('0x36')]);_0x2eb8fe[_0xa3dc('0x42')]=_['intersection'](_0x2eb8fe[_0xa3dc('0x3a')],_0x2eb8fe['query']);_0x22a260[_0xa3dc('0x3b')]=_[_0xa3dc('0x39')](_0x2eb8fe[_0xa3dc('0x3a')],qs[_0xa3dc('0x3c')](_0x7947f9[_0xa3dc('0x36')][_0xa3dc('0x3c')]));_0x22a260[_0xa3dc('0x3b')]=_0x22a260[_0xa3dc('0x3b')][_0xa3dc('0x3d')]?_0x22a260['attributes']:_0x2eb8fe[_0xa3dc('0x3a')];if(_0x7947f9[_0xa3dc('0x36')]['includeAll']){_0x22a260[_0xa3dc('0x4a')]=[{'all':!![]}];}_0x22a260=_[_0xa3dc('0x46')]({},_0x22a260,_0x7947f9[_0xa3dc('0x4d')]);return db[_0xa3dc('0x33')][_0xa3dc('0x4e')](_0x22a260)[_0xa3dc('0x2b')](handleEntityNotFound(_0x1c3bf9,null))[_0xa3dc('0x2b')](respondWithResult(_0x1c3bf9,null))[_0xa3dc('0x4b')](handleError(_0x1c3bf9,null));};exports[_0xa3dc('0x4f')]=function(_0x4e02d4,_0x4355ac){var _0xe6bb66={'raw':![],'where':{'id':_0x4e02d4[_0xa3dc('0x50')]['id']}},_0x504e77={};_0x504e77[_0xa3dc('0x3a')]=_[_0xa3dc('0x35')](db[_0xa3dc('0x33')]['rawAttributes']);_0xe6bb66[_0xa3dc('0x3b')]=_[_0xa3dc('0x39')](_0x504e77[_0xa3dc('0x3a')],qs[_0xa3dc('0x3c')](_0x4e02d4['query'][_0xa3dc('0x3c')]));_0xe6bb66[_0xa3dc('0x3b')]=_0xe6bb66[_0xa3dc('0x3b')][_0xa3dc('0x3d')]?_0xe6bb66['attributes']:_0x504e77['model'];if(_0x4e02d4[_0xa3dc('0x36')][_0xa3dc('0x49')]){_0xe6bb66['include']=[{'all':!![]}];}_0xe6bb66=_[_0xa3dc('0x46')]({},_0xe6bb66,_0x4e02d4[_0xa3dc('0x4d')]);return db[_0xa3dc('0x33')]['find'](_0xe6bb66)[_0xa3dc('0x2b')](handleEntityNotFound(_0x4355ac,null))[_0xa3dc('0x2b')](function(_0x1fb876){if(_0x1fb876){var _0x1d6cc6=_0x1fb876[_0xa3dc('0x2c')]({'plain':!![]});_0x1d6cc6=qs[_0xa3dc('0x51')](_0x1d6cc6,['id',_0xa3dc('0x52'),'updatedAt']);_0x4e02d4['body']=_[_0xa3dc('0x51')](_0x4e02d4['body'],['id','createdAt','updatedAt']);return db[_0xa3dc('0x33')]['create'](_[_0xa3dc('0x46')](_0x1d6cc6,_0x4e02d4[_0xa3dc('0x53')]),{'include':_0x4e02d4[_0xa3dc('0x36')][_0xa3dc('0x49')]?[{'all':!![]}]:undefined})[_0xa3dc('0x2b')](function(_0x4e9f7b){var _0x199031=_0x4e02d4[_0xa3dc('0x54')][_0xa3dc('0x2c')]({'plain':!![]});if(!_0x199031)throw new Error(_0xa3dc('0x55'));if(_0x199031[_0xa3dc('0x56')]===_0xa3dc('0x54')){var _0x206869=_0x4e9f7b['get']({'plain':!![]});var _0x2966c6=_0xa3dc('0x57');return db['UserProfileSection']['find']({'where':{'name':_0x2966c6,'userProfileId':_0x199031[_0xa3dc('0x58')]},'raw':!![]})[_0xa3dc('0x2b')](function(_0x34dddf){if(_0x34dddf&&_0x34dddf[_0xa3dc('0x59')]===0x0){return db[_0xa3dc('0x2d')][_0xa3dc('0x5a')]({'name':_0x206869[_0xa3dc('0x30')],'resourceId':_0x206869['id'],'type':_0x34dddf[_0xa3dc('0x30')],'sectionId':_0x34dddf['id']},{})[_0xa3dc('0x2b')](function(){return _0x4e9f7b;});}else{return _0x4e9f7b;}})[_0xa3dc('0x4b')](function(_0x45b577){logger[_0xa3dc('0x20')](_0xa3dc('0x5b'),_0x45b577);throw _0x45b577;});}return _0x4e9f7b;});}})['then'](respondWithResult(_0x4355ac,0xc9))[_0xa3dc('0x4b')](handleError(_0x4355ac,null));};exports[_0xa3dc('0x5a')]=function(_0x4350b1,_0x2aeb7c,_0x44dee9){var _0x2009cc;return db[_0xa3dc('0x33')][_0xa3dc('0x5a')](_0x4350b1[_0xa3dc('0x53')],{'raw':!![]})[_0xa3dc('0x2b')](function(_0x530787){_0x2009cc=_0x530787;return db[_0xa3dc('0x33')][_0xa3dc('0x5c')]({'raw':!![]});})[_0xa3dc('0x2b')](function(_0x1cf8ee){var _0x239348=fs[_0xa3dc('0x5d')](path[_0xa3dc('0x5e')](config[_0xa3dc('0x5f')],'server/files/templates/trunk.ejs'),_0xa3dc('0x60'));var _0x3965e1=fs[_0xa3dc('0x5d')](path['join'](config[_0xa3dc('0x5f')],_0xa3dc('0x61')),'utf8');var _0x48c62d=ejs[_0xa3dc('0x62')](_0x239348,{'trunks':_0x1cf8ee||[]});fs[_0xa3dc('0x63')](_0xa3dc('0x64'),_0x48c62d);if(_0x2009cc[_0xa3dc('0x65')]){var _0x12d7db=ejs[_0xa3dc('0x62')](_0x3965e1,{'trunks':_0x1cf8ee||[]});fs['writeFileSync'](_0xa3dc('0x66'),_0x12d7db);}})[_0xa3dc('0x2b')](function(){return respondWithRpcPromise(_0xa3dc('0x67'),_0xa3dc('0x5a'),{'module':_0xa3dc('0x68')});})[_0xa3dc('0x2b')](function(){var _0x339ff9=_0x4350b1[_0xa3dc('0x54')][_0xa3dc('0x2c')]({'plain':!![]});if(!_0x339ff9)throw new Error(_0xa3dc('0x55'));if(_0x339ff9[_0xa3dc('0x56')]===_0xa3dc('0x54')){var _0x1d0d1d=_0x2009cc[_0xa3dc('0x2c')]({'plain':!![]});return db[_0xa3dc('0x69')]['find']({'where':{'name':_0xa3dc('0x57'),'userProfileId':_0x339ff9[_0xa3dc('0x58')]},'raw':!![]})['then'](function(_0x3b8098){if(_0x3b8098&&_0x3b8098[_0xa3dc('0x59')]===0x0){return db['UserProfileResource'][_0xa3dc('0x5a')]({'name':_0x1d0d1d['name'],'resourceId':_0x1d0d1d['id'],'type':_0x3b8098[_0xa3dc('0x30')],'sectionId':_0x3b8098['id']},{})[_0xa3dc('0x2b')](function(){return _0x2009cc;});}else{return _0x2009cc;}})[_0xa3dc('0x4b')](function(_0x2f74d5){logger['error'](_0xa3dc('0x5b'),_0x2f74d5);throw _0x2f74d5;});}return _0x2009cc;})['then'](respondWithResult(_0x2aeb7c,0xc9))[_0xa3dc('0x4b')](handleError(_0x2aeb7c,null));};exports['update']=function(_0x4e56e9,_0x54e198,_0x394156){var _0x3e2a94;return db[_0xa3dc('0x33')][_0xa3dc('0x4e')]({'where':{'id':_0x4e56e9[_0xa3dc('0x50')]['id']}})[_0xa3dc('0x2b')](handleEntityNotFound(_0x54e198,null))[_0xa3dc('0x2b')](saveUpdates(_0x4e56e9[_0xa3dc('0x53')],null))[_0xa3dc('0x2b')](function(_0x30aaca){if(_0x30aaca){_0x3e2a94=_0x30aaca;return db[_0xa3dc('0x33')][_0xa3dc('0x5c')]({'raw':!![]});}})['then'](function(_0x400fc4){if(_0x400fc4){var _0x2f0282=fs[_0xa3dc('0x5d')](path[_0xa3dc('0x5e')](config[_0xa3dc('0x5f')],'server/files/templates/trunk.ejs'),'utf8');var _0x4f0a24=fs['readFileSync'](path[_0xa3dc('0x5e')](config['root'],_0xa3dc('0x61')),'utf8');var _0x4f6fd9=ejs[_0xa3dc('0x62')](_0x2f0282,{'trunks':_0x400fc4||[]});fs[_0xa3dc('0x63')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f6fd9);var _0x32ae4a=ejs['render'](_0x4f0a24,{'trunks':_0x400fc4||[]});fs[_0xa3dc('0x63')](_0xa3dc('0x66'),_0x32ae4a);return respondWithRpcPromise(_0xa3dc('0x67'),_0xa3dc('0x6a'),{'module':_0xa3dc('0x68')});}return null;})[_0xa3dc('0x2b')](function(_0x145ec2){if(_0x145ec2){return _0x3e2a94;}})['then'](respondWithResult(_0x54e198,null))[_0xa3dc('0x4b')](handleError(_0x54e198,null));};exports[_0xa3dc('0x2e')]=function(_0x2f50c1,_0x53689e,_0x4f8529){var _0x240bf5;return db['Trunk']['find']({'where':{'id':_0x2f50c1[_0xa3dc('0x50')]['id']}})['then'](handleEntityNotFound(_0x53689e,null))['then'](removeEntity(_0x53689e,null))[_0xa3dc('0x2b')](function(){return db[_0xa3dc('0x33')][_0xa3dc('0x5c')]({'raw':!![]});})[_0xa3dc('0x2b')](function(_0x5ba519){var _0x1d7607=fs[_0xa3dc('0x5d')](path[_0xa3dc('0x5e')](config[_0xa3dc('0x5f')],_0xa3dc('0x6b')),_0xa3dc('0x60'));var _0x1ac713=fs['readFileSync'](path[_0xa3dc('0x5e')](config[_0xa3dc('0x5f')],_0xa3dc('0x61')),_0xa3dc('0x60'));var _0x2ac598=ejs[_0xa3dc('0x62')](_0x1d7607,{'trunks':_0x5ba519});var _0x41e618=ejs[_0xa3dc('0x62')](_0x1ac713,{'trunks':_0x5ba519});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x2ac598);fs[_0xa3dc('0x63')](_0xa3dc('0x66'),_0x41e618);return respondWithRpcPromise(_0xa3dc('0x67'),_0xa3dc('0x2e'),{'module':'chan_sip.so'});})[_0xa3dc('0x4b')](handleError(_0x53689e,null));}; \ No newline at end of file +var _0x50fa=['stringify','code','error','message','sendStatus','status','end','json','limit','set','Content-Range','reject','destroy','get','Trunks','UserProfileResource','name','send','index','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','nolimit','offset','order','sort','where','day','merge','filter','map','options','Trunk','count','includeAll','include','findAll','rows','catch','show','rawAttributes','find','clone','params','omit','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','user','update','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3b3a6d,_0x2025e9){var _0x19b854=function(_0x2503ab){while(--_0x2503ab){_0x3b3a6d['push'](_0x3b3a6d['shift']());}};_0x19b854(++_0x2025e9);}(_0x50fa,0x11f));var _0xa50f=function(_0x304c6f,_0x2d1741){_0x304c6f=_0x304c6f-0x0;var _0x3231dc=_0x50fa[_0x304c6f];return _0x3231dc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa50f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa50f('0x1'));var jsonpatch=require(_0xa50f('0x2'));var rp=require('request-promise');var moment=require(_0xa50f('0x3'));var BPromise=require(_0xa50f('0x4'));var Mustache=require(_0xa50f('0x5'));var util=require(_0xa50f('0x6'));var path=require(_0xa50f('0x7'));var sox=require(_0xa50f('0x8'));var csv=require(_0xa50f('0x9'));var ejs=require(_0xa50f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa50f('0xb'));var crypto=require(_0xa50f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa50f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa50f('0xe'));var Redis=require('ioredis');var qs=require(_0xa50f('0xf'));var logger=require(_0xa50f('0x10'))(_0xa50f('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa50f('0x12'))['db'];var jayson=require(_0xa50f('0x13'));var client=jayson[_0xa50f('0x14')][_0xa50f('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x4db5e8,_0x2fd1a8,_0x402966,_0x1974d8){return new BPromise(function(_0x1fccf4,_0x4c1400){var _0x1788e8=_0x1974d8||client;return _0x1788e8[_0xa50f('0x16')](_0x4db5e8,_0x402966)[_0xa50f('0x17')](function(_0xc78a33){logger[_0xa50f('0x18')](_0xa50f('0x19'),_0x2fd1a8,'request\x20sent');logger[_0xa50f('0x1a')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2fd1a8,_0xa50f('0x1b'),JSON[_0xa50f('0x1c')](_0xc78a33));if(_0xc78a33['error']){if(_0xc78a33['error'][_0xa50f('0x1d')]===0x1f4){logger[_0xa50f('0x1e')](_0xa50f('0x19'),_0x2fd1a8,_0xc78a33[_0xa50f('0x1e')][_0xa50f('0x1f')]);return _0x4c1400(_0xc78a33[_0xa50f('0x1e')][_0xa50f('0x1f')]);}logger['error'](_0xa50f('0x19'),_0x2fd1a8,_0xc78a33[_0xa50f('0x1e')][_0xa50f('0x1f')]);return _0x1fccf4(_0xc78a33['error'][_0xa50f('0x1f')]);}else{logger[_0xa50f('0x18')](_0xa50f('0x19'),_0x2fd1a8,'request\x20sent');_0x1fccf4(_0xc78a33['result'][_0xa50f('0x1f')]);}})['catch'](function(_0x3966da){logger[_0xa50f('0x1e')](_0xa50f('0x19'),_0x2fd1a8,_0x3966da);_0x4c1400(_0x3966da);});});}function respondWithStatusCode(_0x59aca6,_0x4afd52){_0x4afd52=_0x4afd52||0xcc;return function(_0x5438d4){if(_0x5438d4){return _0x59aca6[_0xa50f('0x20')](_0x4afd52);}return _0x59aca6[_0xa50f('0x21')](_0x4afd52)[_0xa50f('0x22')]();};}function respondWithResult(_0x54abb1,_0x521f4a){_0x521f4a=_0x521f4a||0xc8;return function(_0xe2fd4d){if(_0xe2fd4d){return _0x54abb1[_0xa50f('0x21')](_0x521f4a)[_0xa50f('0x23')](_0xe2fd4d);}};}function respondWithFilteredResult(_0x3f4bd5,_0x414dee){return function(_0x13a34e){if(_0x13a34e){var _0x101d0d=_0x13a34e['count'],_0x554081=_0x414dee['offset'],_0x575506=_0x414dee['offset']+_0x414dee[_0xa50f('0x24')],_0x13a85d;if(_0x575506>=_0x101d0d){_0x575506=_0x101d0d;_0x13a85d=0xc8;}else{_0x13a85d=0xce;}_0x3f4bd5[_0xa50f('0x21')](_0x13a85d);return _0x3f4bd5[_0xa50f('0x25')](_0xa50f('0x26'),_0x554081+'-'+_0x575506+'/'+_0x101d0d)[_0xa50f('0x23')](_0x13a34e);}return null;};}function patchUpdates(_0x5b6827){return function(_0x2c8937){try{jsonpatch['apply'](_0x2c8937,_0x5b6827,!![]);}catch(_0x35f823){return BPromise[_0xa50f('0x27')](_0x35f823);}return _0x2c8937['save']();};}function saveUpdates(_0x5c62d3,_0xbff4f){return function(_0x11fedd){if(_0x11fedd){return _0x11fedd['update'](_0x5c62d3)['then'](function(_0x306ed6){return _0x306ed6;});}return null;};}function removeEntity(_0x1ee19c,_0x5bbf23){return function(_0x215bfe){if(_0x215bfe){return _0x215bfe[_0xa50f('0x28')]()[_0xa50f('0x17')](function(){var _0x351df7=_0x215bfe[_0xa50f('0x29')]({'plain':!![]});var _0x33cd8b=_0xa50f('0x2a');return db[_0xa50f('0x2b')][_0xa50f('0x28')]({'where':{'type':_0x33cd8b,'resourceId':_0x351df7['id']}})[_0xa50f('0x17')](function(){return _0x215bfe;});})['then'](function(){_0x1ee19c[_0xa50f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x657c8b,_0x58ac65){return function(_0x47a696){if(!_0x47a696){_0x657c8b[_0xa50f('0x20')](0x194);}return _0x47a696;};}function handleError(_0x46ea0a,_0x9d18a0){_0x9d18a0=_0x9d18a0||0x1f4;return function(_0x2d9132){logger[_0xa50f('0x1e')](_0x2d9132['stack']);if(_0x2d9132[_0xa50f('0x2c')]){delete _0x2d9132[_0xa50f('0x2c')];}_0x46ea0a[_0xa50f('0x21')](_0x9d18a0)[_0xa50f('0x2d')](_0x2d9132);};}exports[_0xa50f('0x2e')]=function(_0x27d7c8,_0x240f20){var _0x521163={},_0x4db655={},_0x5867c5={'count':0x0,'rows':[]};var _0x2b2023=db['Trunk']['rawAttributes'];_0x4db655[_0xa50f('0x2f')]=_[_0xa50f('0x30')](_0x2b2023);var _0x1e3cc={'dateStart':_0x27d7c8[_0xa50f('0x31')][_0xa50f('0x32')],'dateEnd':_0x27d7c8[_0xa50f('0x31')]['dateEnd']};delete _0x27d7c8['query'][_0xa50f('0x32')];delete _0x27d7c8['query'][_0xa50f('0x33')];_0x4db655[_0xa50f('0x31')]=_[_0xa50f('0x30')](_0x27d7c8[_0xa50f('0x31')]);_0x4db655[_0xa50f('0x34')]=_['intersection'](_0x4db655[_0xa50f('0x2f')],_0x4db655[_0xa50f('0x31')]);_0x521163['attributes']=_[_0xa50f('0x35')](_0x4db655[_0xa50f('0x2f')],qs['fields'](_0x27d7c8[_0xa50f('0x31')][_0xa50f('0x36')]));_0x521163[_0xa50f('0x37')]=_0x521163[_0xa50f('0x37')][_0xa50f('0x38')]?_0x521163[_0xa50f('0x37')]:_0x4db655[_0xa50f('0x2f')];if(!_0x27d7c8['query']['hasOwnProperty'](_0xa50f('0x39'))){_0x521163['limit']=qs['limit'](_0x27d7c8[_0xa50f('0x31')][_0xa50f('0x24')]);_0x521163[_0xa50f('0x3a')]=qs[_0xa50f('0x3a')](_0x27d7c8['query']['offset']);}_0x521163[_0xa50f('0x3b')]=qs[_0xa50f('0x3c')](_0x27d7c8['query']['sort']);_0x521163[_0xa50f('0x3d')]=qs[_0xa50f('0x34')](_['pick'](_0x27d7c8['query'],_0x4db655[_0xa50f('0x34')]));if(_0x1e3cc['dateStart']){if(_0x1e3cc[_0xa50f('0x33')]){_0x1e3cc['dateEnd']=moment(_0x1e3cc['dateEnd'])['add'](0x1,'day');}else{_0x1e3cc[_0xa50f('0x33')]=moment(_0x1e3cc[_0xa50f('0x32')])['add'](0x1,_0xa50f('0x3e'));}_[_0xa50f('0x3f')](_0x521163[_0xa50f('0x3d')],{'createdAt':{'$gte':_0x1e3cc[_0xa50f('0x32')],'$lte':_0x1e3cc[_0xa50f('0x33')]}});}if(_0x27d7c8[_0xa50f('0x31')][_0xa50f('0x40')]){_0x521163[_0xa50f('0x3d')]=_[_0xa50f('0x3f')](_0x521163[_0xa50f('0x3d')],{'$or':_[_0xa50f('0x41')](_0x521163[_0xa50f('0x37')],function(_0x2c86b7){var _0x21885c={};_0x21885c[_0x2c86b7]={'$like':'%'+_0x27d7c8['query'][_0xa50f('0x40')]+'%'};return _0x21885c;})});}_0x521163=_['merge']({},_0x521163,_0x27d7c8[_0xa50f('0x42')]);var _0x484b82={'where':_0x521163[_0xa50f('0x3d')]};return db[_0xa50f('0x43')][_0xa50f('0x44')](_0x484b82)[_0xa50f('0x17')](function(_0x10a1e8){_0x5867c5[_0xa50f('0x44')]=_0x10a1e8;if(_0x27d7c8[_0xa50f('0x31')][_0xa50f('0x45')]){_0x521163[_0xa50f('0x46')]=[{'all':!![]}];}return db['Trunk'][_0xa50f('0x47')](_0x521163);})[_0xa50f('0x17')](function(_0x1fa56c){_0x5867c5[_0xa50f('0x48')]=_0x1fa56c;return _0x5867c5;})[_0xa50f('0x17')](respondWithFilteredResult(_0x240f20,_0x521163))[_0xa50f('0x49')](handleError(_0x240f20,null));};exports[_0xa50f('0x4a')]=function(_0x5e38da,_0x336a95){var _0x329a={'raw':![],'where':{'id':_0x5e38da['params']['id']}},_0x2faa8f={};_0x2faa8f[_0xa50f('0x2f')]=_[_0xa50f('0x30')](db[_0xa50f('0x43')][_0xa50f('0x4b')]);_0x2faa8f[_0xa50f('0x31')]=_[_0xa50f('0x30')](_0x5e38da[_0xa50f('0x31')]);_0x2faa8f[_0xa50f('0x34')]=_[_0xa50f('0x35')](_0x2faa8f['model'],_0x2faa8f[_0xa50f('0x31')]);_0x329a[_0xa50f('0x37')]=_[_0xa50f('0x35')](_0x2faa8f[_0xa50f('0x2f')],qs[_0xa50f('0x36')](_0x5e38da[_0xa50f('0x31')]['fields']));_0x329a['attributes']=_0x329a[_0xa50f('0x37')][_0xa50f('0x38')]?_0x329a[_0xa50f('0x37')]:_0x2faa8f[_0xa50f('0x2f')];if(_0x5e38da[_0xa50f('0x31')][_0xa50f('0x45')]){_0x329a[_0xa50f('0x46')]=[{'all':!![]}];}_0x329a=_[_0xa50f('0x3f')]({},_0x329a,_0x5e38da[_0xa50f('0x42')]);return db[_0xa50f('0x43')][_0xa50f('0x4c')](_0x329a)[_0xa50f('0x17')](handleEntityNotFound(_0x336a95,null))[_0xa50f('0x17')](respondWithResult(_0x336a95,null))[_0xa50f('0x49')](handleError(_0x336a95,null));};exports[_0xa50f('0x4d')]=function(_0x2d42b2,_0x3f4a4d){var _0x3bb2f5={'raw':![],'where':{'id':_0x2d42b2[_0xa50f('0x4e')]['id']}},_0x4ea089={};_0x4ea089[_0xa50f('0x2f')]=_[_0xa50f('0x30')](db[_0xa50f('0x43')]['rawAttributes']);_0x3bb2f5[_0xa50f('0x37')]=_[_0xa50f('0x35')](_0x4ea089[_0xa50f('0x2f')],qs[_0xa50f('0x36')](_0x2d42b2[_0xa50f('0x31')][_0xa50f('0x36')]));_0x3bb2f5[_0xa50f('0x37')]=_0x3bb2f5[_0xa50f('0x37')][_0xa50f('0x38')]?_0x3bb2f5[_0xa50f('0x37')]:_0x4ea089['model'];if(_0x2d42b2[_0xa50f('0x31')][_0xa50f('0x45')]){_0x3bb2f5['include']=[{'all':!![]}];}_0x3bb2f5=_[_0xa50f('0x3f')]({},_0x3bb2f5,_0x2d42b2['options']);return db[_0xa50f('0x43')]['find'](_0x3bb2f5)[_0xa50f('0x17')](handleEntityNotFound(_0x3f4a4d,null))['then'](function(_0x3bdb96){if(_0x3bdb96){var _0x6acf8=_0x3bdb96[_0xa50f('0x29')]({'plain':!![]});_0x6acf8=qs[_0xa50f('0x4f')](_0x6acf8,['id','createdAt',_0xa50f('0x50')]);_0x2d42b2[_0xa50f('0x51')]=_[_0xa50f('0x4f')](_0x2d42b2['body'],['id',_0xa50f('0x52'),'updatedAt']);return db[_0xa50f('0x43')]['create'](_[_0xa50f('0x3f')](_0x6acf8,_0x2d42b2[_0xa50f('0x51')]),{'include':_0x2d42b2[_0xa50f('0x31')][_0xa50f('0x45')]?[{'all':!![]}]:undefined})[_0xa50f('0x17')](function(_0x42637c){var _0x8400b3=_0x2d42b2['user'][_0xa50f('0x29')]({'plain':!![]});if(!_0x8400b3)throw new Error(_0xa50f('0x53'));if(_0x8400b3[_0xa50f('0x54')]==='user'){var _0x39e17b=_0x42637c[_0xa50f('0x29')]({'plain':!![]});var _0x24b22a='Trunks';return db[_0xa50f('0x55')][_0xa50f('0x4c')]({'where':{'name':_0x24b22a,'userProfileId':_0x8400b3[_0xa50f('0x56')]},'raw':!![]})['then'](function(_0x57dec0){if(_0x57dec0&&_0x57dec0[_0xa50f('0x57')]===0x0){return db['UserProfileResource'][_0xa50f('0x58')]({'name':_0x39e17b[_0xa50f('0x2c')],'resourceId':_0x39e17b['id'],'type':_0x57dec0[_0xa50f('0x2c')],'sectionId':_0x57dec0['id']},{})[_0xa50f('0x17')](function(){return _0x42637c;});}else{return _0x42637c;}})[_0xa50f('0x49')](function(_0x7de701){logger[_0xa50f('0x1e')](_0xa50f('0x59'),_0x7de701);throw _0x7de701;});}return _0x42637c;});}})[_0xa50f('0x17')](respondWithResult(_0x3f4a4d,0xc9))[_0xa50f('0x49')](handleError(_0x3f4a4d,null));};exports[_0xa50f('0x58')]=function(_0x23259f,_0x1f75a7,_0x1522f1){var _0x1d3278;return db[_0xa50f('0x43')][_0xa50f('0x58')](_0x23259f[_0xa50f('0x51')],{'raw':!![]})[_0xa50f('0x17')](function(_0x3fdc14){_0x1d3278=_0x3fdc14;return db['Trunk'][_0xa50f('0x47')]({'raw':!![]});})['then'](function(_0x17b7d5){var _0xd6babc=fs['readFileSync'](path[_0xa50f('0x5a')](config[_0xa50f('0x5b')],_0xa50f('0x5c')),'utf8');var _0x3db0c6=fs[_0xa50f('0x5d')](path[_0xa50f('0x5a')](config[_0xa50f('0x5b')],_0xa50f('0x5e')),_0xa50f('0x5f'));var _0x362e35=ejs[_0xa50f('0x60')](_0xd6babc,{'trunks':_0x17b7d5||[]});fs['writeFileSync'](_0xa50f('0x61'),_0x362e35);if(_0x1d3278[_0xa50f('0x62')]){var _0x4a7310=ejs[_0xa50f('0x60')](_0x3db0c6,{'trunks':_0x17b7d5||[]});fs[_0xa50f('0x63')](_0xa50f('0x64'),_0x4a7310);}})['then'](function(){return respondWithRpcPromise(_0xa50f('0x65'),_0xa50f('0x58'),{'module':_0xa50f('0x66')});})[_0xa50f('0x17')](function(){var _0x5bf038=_0x23259f[_0xa50f('0x67')][_0xa50f('0x29')]({'plain':!![]});if(!_0x5bf038)throw new Error(_0xa50f('0x53'));if(_0x5bf038[_0xa50f('0x54')]===_0xa50f('0x67')){var _0x20e2c9=_0x1d3278[_0xa50f('0x29')]({'plain':!![]});return db[_0xa50f('0x55')][_0xa50f('0x4c')]({'where':{'name':_0xa50f('0x2a'),'userProfileId':_0x5bf038[_0xa50f('0x56')]},'raw':!![]})['then'](function(_0x4a49ad){if(_0x4a49ad&&_0x4a49ad[_0xa50f('0x57')]===0x0){return db[_0xa50f('0x2b')][_0xa50f('0x58')]({'name':_0x20e2c9[_0xa50f('0x2c')],'resourceId':_0x20e2c9['id'],'type':_0x4a49ad[_0xa50f('0x2c')],'sectionId':_0x4a49ad['id']},{})['then'](function(){return _0x1d3278;});}else{return _0x1d3278;}})[_0xa50f('0x49')](function(_0x3cf972){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cf972);throw _0x3cf972;});}return _0x1d3278;})['then'](respondWithResult(_0x1f75a7,0xc9))[_0xa50f('0x49')](handleError(_0x1f75a7,null));};exports[_0xa50f('0x68')]=function(_0x32f6c0,_0x249a89,_0x5ca631){var _0x19bcf2;return db[_0xa50f('0x43')][_0xa50f('0x4c')]({'where':{'id':_0x32f6c0[_0xa50f('0x4e')]['id']}})[_0xa50f('0x17')](handleEntityNotFound(_0x249a89,null))[_0xa50f('0x17')](saveUpdates(_0x32f6c0['body'],null))[_0xa50f('0x17')](function(_0x5adb6d){if(_0x5adb6d){_0x19bcf2=_0x5adb6d;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa50f('0x17')](function(_0x3422b5){if(_0x3422b5){var _0x37e996=fs[_0xa50f('0x5d')](path[_0xa50f('0x5a')](config[_0xa50f('0x5b')],_0xa50f('0x5c')),_0xa50f('0x5f'));var _0x6d3887=fs['readFileSync'](path[_0xa50f('0x5a')](config[_0xa50f('0x5b')],_0xa50f('0x5e')),_0xa50f('0x5f'));var _0x98dac5=ejs[_0xa50f('0x60')](_0x37e996,{'trunks':_0x3422b5||[]});fs[_0xa50f('0x63')](_0xa50f('0x61'),_0x98dac5);var _0x4e26ff=ejs['render'](_0x6d3887,{'trunks':_0x3422b5||[]});fs[_0xa50f('0x63')](_0xa50f('0x64'),_0x4e26ff);return respondWithRpcPromise(_0xa50f('0x65'),_0xa50f('0x68'),{'module':'chan_sip.so'});}return null;})[_0xa50f('0x17')](function(_0x15804b){if(_0x15804b){return _0x19bcf2;}})[_0xa50f('0x17')](respondWithResult(_0x249a89,null))[_0xa50f('0x49')](handleError(_0x249a89,null));};exports[_0xa50f('0x28')]=function(_0x5ece71,_0x10d933,_0x247575){var _0x4231eb;return db[_0xa50f('0x43')][_0xa50f('0x4c')]({'where':{'id':_0x5ece71[_0xa50f('0x4e')]['id']}})[_0xa50f('0x17')](handleEntityNotFound(_0x10d933,null))[_0xa50f('0x17')](removeEntity(_0x10d933,null))[_0xa50f('0x17')](function(){return db[_0xa50f('0x43')][_0xa50f('0x47')]({'raw':!![]});})['then'](function(_0x7ff578){var _0x15c62a=fs[_0xa50f('0x5d')](path[_0xa50f('0x5a')](config[_0xa50f('0x5b')],'server/files/templates/trunk.ejs'),_0xa50f('0x5f'));var _0x5d519a=fs[_0xa50f('0x5d')](path[_0xa50f('0x5a')](config[_0xa50f('0x5b')],_0xa50f('0x5e')),_0xa50f('0x5f'));var _0x90728a=ejs[_0xa50f('0x60')](_0x15c62a,{'trunks':_0x7ff578});var _0x12d235=ejs[_0xa50f('0x60')](_0x5d519a,{'trunks':_0x7ff578});fs[_0xa50f('0x63')](_0xa50f('0x61'),_0x90728a);fs[_0xa50f('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0x12d235);return respondWithRpcPromise(_0xa50f('0x65'),_0xa50f('0x28'),{'module':_0xa50f('0x66')});})[_0xa50f('0x49')](handleError(_0x10d933,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 60e501e..aa3c9c6 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 _0xd169=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./trunk.attributes','exports','define'];(function(_0x24a54a,_0x2436c6){var _0x4a03fc=function(_0x49b20a){while(--_0x49b20a){_0x24a54a['push'](_0x24a54a['shift']());}};_0x4a03fc(++_0x2436c6);}(_0xd169,0x1f4));var _0x9d16=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xd169[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x9d16('0x0'));var util=require(_0x9d16('0x1'));var logger=require(_0x9d16('0x2'))(_0x9d16('0x3'));var moment=require(_0x9d16('0x4'));var BPromise=require(_0x9d16('0x5'));var rp=require(_0x9d16('0x6'));var attributes=require(_0x9d16('0x7'));module[_0x9d16('0x8')]=function(_0x8d5a6d,_0x2882a3){return _0x8d5a6d[_0x9d16('0x9')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x998c=['request-promise','./trunk.attributes','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x377680,_0x5b8206){var _0x5a77ac=function(_0x47944b){while(--_0x47944b){_0x377680['push'](_0x377680['shift']());}};_0x5a77ac(++_0x5b8206);}(_0x998c,0x118));var _0xc998=function(_0x23a8ba,_0xab5848){_0x23a8ba=_0x23a8ba-0x0;var _0x468389=_0x998c[_0x23a8ba];return _0x468389;};'use strict';var _=require(_0xc998('0x0'));var util=require(_0xc998('0x1'));var logger=require(_0xc998('0x2'))(_0xc998('0x3'));var moment=require(_0xc998('0x4'));var BPromise=require(_0xc998('0x5'));var rp=require(_0xc998('0x6'));var attributes=require(_0xc998('0x7'));module['exports']=function(_0x2e7014,_0x34eaed){return _0x2e7014[_0xc998('0x8')](_0xc998('0x9'),attributes,{'tableName':_0xc998('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index cf5c91c..80e60c4 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 _0xa073=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trunk','findAll','options','raw','where','attributes','include','map','model','then','GetTrunk','ShowTrunk','find'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0xa073,0xfc));var _0x3a07=function(_0x7e59a2,_0x4c0084){_0x7e59a2=_0x7e59a2-0x0;var _0x2d06ce=_0xa073[_0x7e59a2];return _0x2d06ce;};'use strict';var _=require(_0x3a07('0x0'));var util=require(_0x3a07('0x1'));var moment=require(_0x3a07('0x2'));var BPromise=require(_0x3a07('0x3'));var rs=require(_0x3a07('0x4'));var fs=require('fs');var Redis=require(_0x3a07('0x5'));var db=require(_0x3a07('0x6'))['db'];var utils=require(_0x3a07('0x7'));var logger=require('../../config/logger')(_0x3a07('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3a07('0x9')][_0x3a07('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e7043,_0x193135,_0x2e282e){return new BPromise(function(_0x3cfa35,_0x4a9ed6){return client[_0x3a07('0xb')](_0x2e7043,_0x2e282e)['then'](function(_0xf01422){logger[_0x3a07('0xc')](_0x3a07('0xd'),_0x193135,_0x3a07('0xe'));logger[_0x3a07('0xf')](_0x3a07('0x10'),_0x193135,_0x3a07('0xe'),JSON[_0x3a07('0x11')](_0xf01422));if(_0xf01422[_0x3a07('0x12')]){if(_0xf01422[_0x3a07('0x12')][_0x3a07('0x13')]===0x1f4){logger[_0x3a07('0x12')](_0x3a07('0xd'),_0x193135,_0xf01422[_0x3a07('0x12')]['message']);return _0x4a9ed6(_0xf01422[_0x3a07('0x12')][_0x3a07('0x14')]);}logger[_0x3a07('0x12')](_0x3a07('0xd'),_0x193135,_0xf01422['error'][_0x3a07('0x14')]);return _0x3cfa35(_0xf01422['error'][_0x3a07('0x14')]);}else{logger[_0x3a07('0xc')](_0x3a07('0xd'),_0x193135,_0x3a07('0xe'));_0x3cfa35(_0xf01422[_0x3a07('0x15')][_0x3a07('0x14')]);}})[_0x3a07('0x16')](function(_0x14446f){logger[_0x3a07('0x12')](_0x3a07('0xd'),_0x193135,_0x14446f);_0x4a9ed6(_0x14446f);});});}exports['GetTrunk']=function(_0x3a13dc){var _0x2754c8=this;return new Promise(function(_0x34204e,_0x5d08c4){return db[_0x3a07('0x17')][_0x3a07('0x18')]({'raw':_0x3a13dc[_0x3a07('0x19')]?_0x3a13dc[_0x3a07('0x19')][_0x3a07('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a13dc[_0x3a07('0x19')]?_0x3a13dc[_0x3a07('0x19')][_0x3a07('0x1b')]||null:null,'attributes':_0x3a13dc['options']?_0x3a13dc[_0x3a07('0x19')][_0x3a07('0x1c')]||null:null,'limit':_0x3a13dc[_0x3a07('0x19')]?_0x3a13dc['options']['limit']||null:null,'include':_0x3a13dc[_0x3a07('0x19')]?_0x3a13dc[_0x3a07('0x19')][_0x3a07('0x1d')]?_[_0x3a07('0x1e')](_0x3a13dc[_0x3a07('0x19')][_0x3a07('0x1d')],function(_0x3fec59){return{'model':db[_0x3fec59[_0x3a07('0x1f')]],'as':_0x3fec59['as'],'attributes':_0x3fec59[_0x3a07('0x1c')],'include':_0x3fec59['include']?_[_0x3a07('0x1e')](_0x3fec59[_0x3a07('0x1d')],function(_0x115b92){return{'model':db[_0x115b92['model']],'as':_0x115b92['as'],'attributes':_0x115b92[_0x3a07('0x1c')],'include':_0x115b92['include']?_[_0x3a07('0x1e')](_0x115b92['include'],function(_0x391711){return{'model':db[_0x391711[_0x3a07('0x1f')]],'as':_0x391711['as'],'attributes':_0x391711[_0x3a07('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3a07('0x20')](function(_0x180535){logger[_0x3a07('0xc')](_0x3a07('0x21'),_0x3a13dc);logger['debug'](_0x3a07('0x21'),_0x3a13dc,JSON[_0x3a07('0x11')](_0x180535));_0x34204e(_0x180535);})['catch'](function(_0x462a0a){logger['error']('GetTrunk',_0x462a0a[_0x3a07('0x14')],_0x3a13dc);_0x5d08c4(_0x2754c8[_0x3a07('0x12')](0x1f4,_0x462a0a['message']));});});};exports[_0x3a07('0x22')]=function(_0x35a46){var _0x5c72e8=this;return new Promise(function(_0x46d894,_0x449d00){return db['Trunk'][_0x3a07('0x23')]({'raw':_0x35a46[_0x3a07('0x19')]?_0x35a46[_0x3a07('0x19')][_0x3a07('0x1a')]===undefined?!![]:![]:!![],'where':_0x35a46[_0x3a07('0x19')]?_0x35a46[_0x3a07('0x19')][_0x3a07('0x1b')]||null:null,'attributes':_0x35a46[_0x3a07('0x19')]?_0x35a46['options'][_0x3a07('0x1c')]||null:null,'include':_0x35a46[_0x3a07('0x19')]?_0x35a46['options'][_0x3a07('0x1d')]?_[_0x3a07('0x1e')](_0x35a46[_0x3a07('0x19')]['include'],function(_0x2d6cc2){return{'model':db[_0x2d6cc2[_0x3a07('0x1f')]],'as':_0x2d6cc2['as'],'attributes':_0x2d6cc2[_0x3a07('0x1c')],'include':_0x2d6cc2[_0x3a07('0x1d')]?_[_0x3a07('0x1e')](_0x2d6cc2[_0x3a07('0x1d')],function(_0x36c839){return{'model':db[_0x36c839['model']],'as':_0x36c839['as'],'attributes':_0x36c839[_0x3a07('0x1c')],'include':_0x36c839[_0x3a07('0x1d')]?_[_0x3a07('0x1e')](_0x36c839[_0x3a07('0x1d')],function(_0xfc32f8){return{'model':db[_0xfc32f8[_0x3a07('0x1f')]],'as':_0xfc32f8['as'],'attributes':_0xfc32f8[_0x3a07('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3a07('0x20')](function(_0x41a01b){logger[_0x3a07('0xc')](_0x3a07('0x22'),_0x35a46);logger[_0x3a07('0xf')](_0x3a07('0x22'),_0x35a46,JSON[_0x3a07('0x11')](_0x41a01b));_0x46d894(_0x41a01b);})['catch'](function(_0x211eed){logger[_0x3a07('0x12')](_0x3a07('0x22'),_0x211eed[_0x3a07('0x14')],_0x35a46);_0x449d00(_0x5c72e8[_0x3a07('0x12')](0x1f4,_0x211eed[_0x3a07('0x14')]));});});}; \ No newline at end of file +var _0xc636=['catch','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrunk','findAll','options','raw','limit','map','include','model','attributes','then'];(function(_0x5795ca,_0x46fc57){var _0x33e47d=function(_0x17c94e){while(--_0x17c94e){_0x5795ca['push'](_0x5795ca['shift']());}};_0x33e47d(++_0x46fc57);}(_0xc636,0x13e));var _0x6c63=function(_0x3a3047,_0x4e5307){_0x3a3047=_0x3a3047-0x0;var _0x440b6b=_0xc636[_0x3a3047];return _0x440b6b;};'use strict';var _=require(_0x6c63('0x0'));var util=require(_0x6c63('0x1'));var moment=require(_0x6c63('0x2'));var BPromise=require(_0x6c63('0x3'));var rs=require(_0x6c63('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c63('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c63('0x6'))(_0x6c63('0x7'));var config=require(_0x6c63('0x8'));var jayson=require(_0x6c63('0x9'));var client=jayson[_0x6c63('0xa')][_0x6c63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1aab1a,_0x4a170f,_0x5ee3be){return new BPromise(function(_0x385ddd,_0x4ffdaa){return client['request'](_0x1aab1a,_0x5ee3be)['then'](function(_0x4daece){logger[_0x6c63('0xc')](_0x6c63('0xd'),_0x4a170f,_0x6c63('0xe'));logger[_0x6c63('0xf')](_0x6c63('0x10'),_0x4a170f,_0x6c63('0xe'),JSON[_0x6c63('0x11')](_0x4daece));if(_0x4daece['error']){if(_0x4daece[_0x6c63('0x12')][_0x6c63('0x13')]===0x1f4){logger[_0x6c63('0x12')]('Trunk,\x20%s,\x20%s',_0x4a170f,_0x4daece[_0x6c63('0x12')][_0x6c63('0x14')]);return _0x4ffdaa(_0x4daece[_0x6c63('0x12')]['message']);}logger['error'](_0x6c63('0xd'),_0x4a170f,_0x4daece[_0x6c63('0x12')][_0x6c63('0x14')]);return _0x385ddd(_0x4daece[_0x6c63('0x12')]['message']);}else{logger[_0x6c63('0xc')](_0x6c63('0xd'),_0x4a170f,_0x6c63('0xe'));_0x385ddd(_0x4daece[_0x6c63('0x15')][_0x6c63('0x14')]);}})['catch'](function(_0x48b9ab){logger[_0x6c63('0x12')](_0x6c63('0xd'),_0x4a170f,_0x48b9ab);_0x4ffdaa(_0x48b9ab);});});}exports[_0x6c63('0x16')]=function(_0x153730){var _0x497dcd=this;return new Promise(function(_0x3fdbcd,_0x3ec39c){return db['Trunk'][_0x6c63('0x17')]({'raw':_0x153730[_0x6c63('0x18')]?_0x153730['options'][_0x6c63('0x19')]===undefined?!![]:![]:!![],'where':_0x153730[_0x6c63('0x18')]?_0x153730[_0x6c63('0x18')]['where']||null:null,'attributes':_0x153730[_0x6c63('0x18')]?_0x153730[_0x6c63('0x18')]['attributes']||null:null,'limit':_0x153730[_0x6c63('0x18')]?_0x153730[_0x6c63('0x18')][_0x6c63('0x1a')]||null:null,'include':_0x153730[_0x6c63('0x18')]?_0x153730['options']['include']?_[_0x6c63('0x1b')](_0x153730[_0x6c63('0x18')][_0x6c63('0x1c')],function(_0x593223){return{'model':db[_0x593223[_0x6c63('0x1d')]],'as':_0x593223['as'],'attributes':_0x593223[_0x6c63('0x1e')],'include':_0x593223['include']?_[_0x6c63('0x1b')](_0x593223[_0x6c63('0x1c')],function(_0x4a42c3){return{'model':db[_0x4a42c3[_0x6c63('0x1d')]],'as':_0x4a42c3['as'],'attributes':_0x4a42c3[_0x6c63('0x1e')],'include':_0x4a42c3[_0x6c63('0x1c')]?_[_0x6c63('0x1b')](_0x4a42c3[_0x6c63('0x1c')],function(_0x15efd5){return{'model':db[_0x15efd5[_0x6c63('0x1d')]],'as':_0x15efd5['as'],'attributes':_0x15efd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c63('0x1f')](function(_0x2b469d){logger[_0x6c63('0xc')]('GetTrunk',_0x153730);logger[_0x6c63('0xf')](_0x6c63('0x16'),_0x153730,JSON[_0x6c63('0x11')](_0x2b469d));_0x3fdbcd(_0x2b469d);})[_0x6c63('0x20')](function(_0x4f0f56){logger[_0x6c63('0x12')]('GetTrunk',_0x4f0f56[_0x6c63('0x14')],_0x153730);_0x3ec39c(_0x497dcd[_0x6c63('0x12')](0x1f4,_0x4f0f56['message']));});});};exports[_0x6c63('0x21')]=function(_0x5a8d5a){var _0x2041f3=this;return new Promise(function(_0x500faa,_0x169325){return db['Trunk'][_0x6c63('0x22')]({'raw':_0x5a8d5a[_0x6c63('0x18')]?_0x5a8d5a['options'][_0x6c63('0x19')]===undefined?!![]:![]:!![],'where':_0x5a8d5a[_0x6c63('0x18')]?_0x5a8d5a['options']['where']||null:null,'attributes':_0x5a8d5a['options']?_0x5a8d5a[_0x6c63('0x18')][_0x6c63('0x1e')]||null:null,'include':_0x5a8d5a[_0x6c63('0x18')]?_0x5a8d5a[_0x6c63('0x18')]['include']?_['map'](_0x5a8d5a['options'][_0x6c63('0x1c')],function(_0x42589b){return{'model':db[_0x42589b[_0x6c63('0x1d')]],'as':_0x42589b['as'],'attributes':_0x42589b[_0x6c63('0x1e')],'include':_0x42589b[_0x6c63('0x1c')]?_[_0x6c63('0x1b')](_0x42589b[_0x6c63('0x1c')],function(_0x1ed2ab){return{'model':db[_0x1ed2ab[_0x6c63('0x1d')]],'as':_0x1ed2ab['as'],'attributes':_0x1ed2ab[_0x6c63('0x1e')],'include':_0x1ed2ab[_0x6c63('0x1c')]?_[_0x6c63('0x1b')](_0x1ed2ab[_0x6c63('0x1c')],function(_0x256d16){return{'model':db[_0x256d16[_0x6c63('0x1d')]],'as':_0x256d16['as'],'attributes':_0x256d16[_0x6c63('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x567378){logger['info'](_0x6c63('0x21'),_0x5a8d5a);logger['debug']('ShowTrunk',_0x5a8d5a,JSON[_0x6c63('0x11')](_0x567378));_0x500faa(_0x567378);})[_0x6c63('0x20')](function(_0x3f63a3){logger[_0x6c63('0x12')](_0x6c63('0x21'),_0x3f63a3['message'],_0x5a8d5a);_0x169325(_0x2041f3['error'](0x1f4,_0x3f63a3[_0x6c63('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 1adf3af..1e5457d 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 _0xca77=['diskStorage','join','root','server/files/images/','format','%s-%s','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addSquareProjects','put','update','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeSquareProjects','exports','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','getScheduledCalls','post','/create_many','addContacts','create','addQueues'];(function(_0x27b059,_0x275671){var _0x982b2a=function(_0x1e7d71){while(--_0x1e7d71){_0x27b059['push'](_0x27b059['shift']());}};_0x982b2a(++_0x275671);}(_0xca77,0x164));var _0x7ca7=function(_0x57ab43,_0x1e43ed){_0x57ab43=_0x57ab43-0x0;var _0x55f246=_0xca77[_0x57ab43];return _0x55f246;};'use strict';var multer=require('multer');var util=require(_0x7ca7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7ca7('0x1'));var router=express['Router']();var auth=require(_0x7ca7('0x2'));var interaction=require(_0x7ca7('0x3'));var config=require(_0x7ca7('0x4'));var controller=require(_0x7ca7('0x5'));router[_0x7ca7('0x6')]('/',auth['isAuthenticated'](),controller[_0x7ca7('0x7')]);router[_0x7ca7('0x6')](_0x7ca7('0x8'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0xa')]);router[_0x7ca7('0x6')](_0x7ca7('0xb'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0xc')]);router['get'](_0x7ca7('0xd'),controller['getAvatar']);router[_0x7ca7('0x6')](_0x7ca7('0xe'),auth['isAuthenticated'](),controller[_0x7ca7('0xf')]);router['get'](_0x7ca7('0x10'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x11')]);router['get'](_0x7ca7('0x12'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x13')]);router[_0x7ca7('0x6')](_0x7ca7('0x14'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x15')]);router[_0x7ca7('0x6')]('/:id/recordings',auth[_0x7ca7('0x9')](),controller['getRecordings']);router['get'](_0x7ca7('0x16'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x17')]);router['get'](_0x7ca7('0x18'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x7ca7('0x6')](_0x7ca7('0x19'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x1a')]);router['get'](_0x7ca7('0x1b'),auth['isAuthenticated'](),controller[_0x7ca7('0x1c')]);router[_0x7ca7('0x6')](_0x7ca7('0x1d'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x1e')]);router[_0x7ca7('0x6')](_0x7ca7('0x1f'),auth['isAuthenticated'](),controller[_0x7ca7('0x20')]);router[_0x7ca7('0x6')](_0x7ca7('0x21'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x22')]);router['get'](_0x7ca7('0x23'),auth['isAuthenticated'](),controller[_0x7ca7('0x24')]);router[_0x7ca7('0x6')](_0x7ca7('0x25'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x26')]);router[_0x7ca7('0x6')](_0x7ca7('0x27'),auth['isAuthenticated'](),controller[_0x7ca7('0x28')]);router[_0x7ca7('0x6')]('/:id/mail_accounts',auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x29')]);router[_0x7ca7('0x6')](_0x7ca7('0x2a'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x2b')]);router[_0x7ca7('0x6')](_0x7ca7('0x2c'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x2d')]);router[_0x7ca7('0x6')](_0x7ca7('0x2e'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x2f')]);router[_0x7ca7('0x6')](_0x7ca7('0x30'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x31')]);router[_0x7ca7('0x6')]('/:id/scheduled_calls',auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x32')]);router[_0x7ca7('0x33')](_0x7ca7('0x34'),auth[_0x7ca7('0x9')](),controller['bulkCreate']);router[_0x7ca7('0x33')](_0x7ca7('0xe'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x35')]);router[_0x7ca7('0x33')]('/',auth['isAuthenticated'](),controller[_0x7ca7('0x36')]);router[_0x7ca7('0x33')]('/:id/queues',auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x37')]);var upload=multer({'storage':multer[_0x7ca7('0x38')]({'destination':function(_0x14a8c4,_0x160634,_0x252684){_0x252684(null,path[_0x7ca7('0x39')](config[_0x7ca7('0x3a')],_0x7ca7('0x3b')));},'filename':function(_0x4b0b94,_0x422262,_0x4ab3bc){_0x4ab3bc(null,util[_0x7ca7('0x3c')](_0x7ca7('0x3d'),Date['now'](),_0x422262[_0x7ca7('0x3e')]));}})});router[_0x7ca7('0x33')](_0x7ca7('0xd'),upload[_0x7ca7('0x3f')]('file'),controller[_0x7ca7('0x40')]);router[_0x7ca7('0x33')](_0x7ca7('0x41'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x42')]);router[_0x7ca7('0x33')](_0x7ca7('0x43'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x44')]);router[_0x7ca7('0x33')](_0x7ca7('0x45'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x46')]);router[_0x7ca7('0x33')]('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router[_0x7ca7('0x33')](_0x7ca7('0x1f'),auth['isAuthenticated'](),controller[_0x7ca7('0x47')]);router[_0x7ca7('0x33')](_0x7ca7('0x48'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x49')]);router['post']('/:id/mail_interactions',auth[_0x7ca7('0x9')](),controller['addMailInteractions']);router[_0x7ca7('0x33')](_0x7ca7('0x4a'),auth['isAuthenticated'](),controller[_0x7ca7('0x4b')]);router[_0x7ca7('0x33')](_0x7ca7('0x4c'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x4d')]);router[_0x7ca7('0x33')](_0x7ca7('0x4e'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x4f')]);router[_0x7ca7('0x33')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x7ca7('0x50')]);router[_0x7ca7('0x33')](_0x7ca7('0x51'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x52')]);router['post'](_0x7ca7('0x2a'),auth['isAuthenticated'](),controller[_0x7ca7('0x53')]);router['post'](_0x7ca7('0x2c'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x54')]);router[_0x7ca7('0x33')](_0x7ca7('0x2e'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x7ca7('0x33')]('/:id/square_projects',auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x55')]);router[_0x7ca7('0x56')](_0x7ca7('0xb'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x57')]);router['put'](_0x7ca7('0x58'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x59')]);router['delete'](_0x7ca7('0x10'),auth[_0x7ca7('0x9')](),controller['removeQueues']);router[_0x7ca7('0x5a')]('/:id/teams',auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x5b')]);router[_0x7ca7('0x5a')](_0x7ca7('0xb'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x5c')]);router['delete'](_0x7ca7('0x48'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x5d')]);router[_0x7ca7('0x5a')]('/:id/mail_interactions',auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x5e')]);router[_0x7ca7('0x5a')](_0x7ca7('0x4a'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x5f')]);router[_0x7ca7('0x5a')](_0x7ca7('0x4c'),auth[_0x7ca7('0x9')](),controller['removeSmsInteractions']);router['delete']('/:id/openchannel_interactions',auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x60')]);router[_0x7ca7('0x5a')](_0x7ca7('0x27'),auth['isAuthenticated'](),controller[_0x7ca7('0x61')]);router[_0x7ca7('0x5a')](_0x7ca7('0x51'),auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x62')]);router['delete']('/:id/openchannel_accounts',auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x63')]);router[_0x7ca7('0x5a')]('/:id/sms_accounts',auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x64')]);router[_0x7ca7('0x5a')](_0x7ca7('0x2e'),auth['isAuthenticated'](),controller['removeChatWebsites']);router['delete']('/:id/square_projects',auth[_0x7ca7('0x9')](),controller[_0x7ca7('0x65')]);module[_0x7ca7('0x66')]=router; \ No newline at end of file +var _0x42cd=['/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/teams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/create_many','bulkCreate','post','create','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','addChatWebsites','addSquareProjects','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','/:id/mail_accounts','removeMailAccounts','removeOpenchannelAccounts','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/avatar','getAvatar'];(function(_0x4567da,_0x47618a){var _0xa6aa0d=function(_0x12acab){while(--_0x12acab){_0x4567da['push'](_0x4567da['shift']());}};_0xa6aa0d(++_0x47618a);}(_0x42cd,0x17f));var _0xd42c=function(_0x3f420f,_0x2a7664){_0x3f420f=_0x3f420f-0x0;var _0x3ee07f=_0x42cd[_0x3f420f];return _0x3ee07f;};'use strict';var multer=require(_0xd42c('0x0'));var util=require('util');var path=require(_0xd42c('0x1'));var timeout=require(_0xd42c('0x2'));var express=require(_0xd42c('0x3'));var router=express[_0xd42c('0x4')]();var auth=require(_0xd42c('0x5'));var interaction=require(_0xd42c('0x6'));var config=require(_0xd42c('0x7'));var controller=require(_0xd42c('0x8'));router[_0xd42c('0x9')]('/',auth[_0xd42c('0xa')](),controller[_0xd42c('0xb')]);router['get'](_0xd42c('0xc'),auth[_0xd42c('0xa')](),controller[_0xd42c('0xd')]);router['get'](_0xd42c('0xe'),auth[_0xd42c('0xa')](),controller['show']);router['get'](_0xd42c('0xf'),controller[_0xd42c('0x10')]);router[_0xd42c('0x9')](_0xd42c('0x11'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x12')]);router[_0xd42c('0x9')](_0xd42c('0x13'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x14')]);router[_0xd42c('0x9')]('/:id/queues_rt',auth[_0xd42c('0xa')](),controller[_0xd42c('0x15')]);router[_0xd42c('0x9')]('/:id/groups',auth[_0xd42c('0xa')](),controller[_0xd42c('0x16')]);router[_0xd42c('0x9')](_0xd42c('0x17'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x18')]);router[_0xd42c('0x9')](_0xd42c('0x19'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0xd42c('0x9')](_0xd42c('0x1a'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x1b')]);router[_0xd42c('0x9')](_0xd42c('0x1c'),auth['isAuthenticated'](),controller[_0xd42c('0x1d')]);router[_0xd42c('0x9')](_0xd42c('0x1e'),auth['isAuthenticated'](),controller[_0xd42c('0x1f')]);router[_0xd42c('0x9')](_0xd42c('0x20'),auth[_0xd42c('0xa')](),controller['getFaxInteractions']);router['get'](_0xd42c('0x21'),auth[_0xd42c('0xa')](),controller['getTeams']);router[_0xd42c('0x9')](_0xd42c('0x22'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x23')]);router[_0xd42c('0x9')]('/:id/agents',auth[_0xd42c('0xa')](),controller['getAgents']);router['get'](_0xd42c('0x24'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x25')]);router['get'](_0xd42c('0x26'),auth[_0xd42c('0xa')](),controller['getFaxAccounts']);router[_0xd42c('0x9')]('/:id/mail_accounts',auth[_0xd42c('0xa')](),controller[_0xd42c('0x27')]);router[_0xd42c('0x9')]('/:id/openchannel_accounts',auth[_0xd42c('0xa')](),controller[_0xd42c('0x28')]);router[_0xd42c('0x9')](_0xd42c('0x29'),auth['isAuthenticated'](),controller[_0xd42c('0x2a')]);router['get'](_0xd42c('0x2b'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x2c')]);router['get'](_0xd42c('0x2d'),auth['isAuthenticated'](),controller[_0xd42c('0x2e')]);router[_0xd42c('0x9')]('/:id/scheduled_calls',auth[_0xd42c('0xa')](),controller['getScheduledCalls']);router['post'](_0xd42c('0x2f'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x30')]);router[_0xd42c('0x31')](_0xd42c('0x11'),auth[_0xd42c('0xa')](),controller['addContacts']);router[_0xd42c('0x31')]('/',auth[_0xd42c('0xa')](),controller[_0xd42c('0x32')]);router['post'](_0xd42c('0x13'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x33')]);var upload=multer({'storage':multer[_0xd42c('0x34')]({'destination':function(_0x7b5203,_0x30b51f,_0xd8194f){_0xd8194f(null,path[_0xd42c('0x35')](config[_0xd42c('0x36')],_0xd42c('0x37')));},'filename':function(_0x205493,_0x10aed6,_0x1efe59){_0x1efe59(null,util[_0xd42c('0x38')](_0xd42c('0x39'),Date[_0xd42c('0x3a')](),_0x10aed6['originalname']));}})});router[_0xd42c('0x31')]('/:id/avatar',upload[_0xd42c('0x3b')]('file'),controller[_0xd42c('0x3c')]);router['post'](_0xd42c('0x3d'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x3e')]);router['post'](_0xd42c('0x3f'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x40')]);router[_0xd42c('0x31')](_0xd42c('0x41'),auth['isAuthenticated'](),controller[_0xd42c('0x42')]);router[_0xd42c('0x31')](_0xd42c('0x43'),auth['isAuthenticated'](),controller[_0xd42c('0x44')]);router[_0xd42c('0x31')](_0xd42c('0x21'),auth[_0xd42c('0xa')](),controller['addTeams']);router[_0xd42c('0x31')](_0xd42c('0x45'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0xd42c('0x31')](_0xd42c('0x46'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x47')]);router[_0xd42c('0x31')](_0xd42c('0x48'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x49')]);router[_0xd42c('0x31')](_0xd42c('0x4a'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x4b')]);router[_0xd42c('0x31')](_0xd42c('0x4c'),auth['isAuthenticated'](),controller[_0xd42c('0x4d')]);router[_0xd42c('0x31')](_0xd42c('0x26'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x4e')]);router['post']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xd42c('0x4f')]);router['post'](_0xd42c('0x50'),auth[_0xd42c('0xa')](),controller['addOpenchannelAccounts']);router[_0xd42c('0x31')](_0xd42c('0x29'),auth['isAuthenticated'](),controller[_0xd42c('0x51')]);router[_0xd42c('0x31')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xd42c('0x52')]);router[_0xd42c('0x31')](_0xd42c('0x2d'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x53')]);router[_0xd42c('0x54')](_0xd42c('0xe'),auth['isAuthenticated'](),controller[_0xd42c('0x55')]);router[_0xd42c('0x54')](_0xd42c('0x56'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x57')]);router[_0xd42c('0x58')](_0xd42c('0x13'),auth['isAuthenticated'](),controller[_0xd42c('0x59')]);router[_0xd42c('0x58')](_0xd42c('0x21'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x5a')]);router[_0xd42c('0x58')](_0xd42c('0xe'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x5b')]);router[_0xd42c('0x58')](_0xd42c('0x45'),auth['isAuthenticated'](),controller[_0xd42c('0x5c')]);router[_0xd42c('0x58')](_0xd42c('0x46'),auth[_0xd42c('0xa')](),controller['removeMailInteractions']);router[_0xd42c('0x58')](_0xd42c('0x48'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x5d')]);router['delete'](_0xd42c('0x4a'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x5e')]);router['delete']('/:id/openchannel_interactions',auth[_0xd42c('0xa')](),controller['removeOpenchannelInteractions']);router[_0xd42c('0x58')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xd42c('0x5f')]);router[_0xd42c('0x58')](_0xd42c('0x60'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x61')]);router[_0xd42c('0x58')](_0xd42c('0x50'),auth[_0xd42c('0xa')](),controller[_0xd42c('0x62')]);router[_0xd42c('0x58')](_0xd42c('0x29'),auth[_0xd42c('0xa')](),controller['removeSmsAccounts']);router[_0xd42c('0x58')]('/:id/chat_websites',auth[_0xd42c('0xa')](),controller['removeChatWebsites']);router[_0xd42c('0x58')](_0xd42c('0x2d'),auth[_0xd42c('0xa')](),controller['removeSquareProjects']);module[_0xd42c('0x63')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 24a1d36..be24789 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 _0x0713=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','nonat','update','yes','force_rport,comedia','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','active','passive','actpass','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','rtcp_mux','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join'];(function(_0x12f9e3,_0x3fadc1){var _0x2de0c8=function(_0x31b5c5){while(--_0x31b5c5){_0x12f9e3['push'](_0x12f9e3['shift']());}};_0x2de0c8(++_0x3fadc1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x3071('0x0'));var _=require(_0x3071('0x1'));module[_0x3071('0x2')]={'name':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'unique':_0x3071('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x52b5fb){this[_0x3071('0x5')](_0x3071('0x4'),_0x52b5fb);this[_0x3071('0x5')](_0x3071('0x6'),_0x52b5fb);},'comment':_0x3071('0x7')},'fullname':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'set':function(_0x1d3dd6){this[_0x3071('0x5')](_0x3071('0x8'),_0x1d3dd6);this[_0x3071('0x5')](_0x3071('0x9'),util[_0x3071('0xa')](_0x3071('0xb'),_0x1d3dd6,this['getDataValue'](_0x3071('0xc'))));}},'alias':{'type':Sequelize[_0x3071('0x3')]},'email':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'unique':_0x3071('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1ce844){if(_0x1ce844){this['setDataValue'](_0x3071('0xd'),_0x1ce844[_0x3071('0xe')]());}}},'role':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x12')},'internal':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x104e73){this['setDataValue'](_0x3071('0xc'),_0x104e73);this[_0x3071('0x5')](_0x3071('0x14'),_0x104e73);this[_0x3071('0x5')](_0x3071('0x9'),util[_0x3071('0xa')](_0x3071('0xb'),this[_0x3071('0x15')](_0x3071('0x8')),_0x104e73));}},'salt':{'type':Sequelize[_0x3071('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x3071('0x3')]},'address':{'type':Sequelize[_0x3071('0x3')]},'zipcode':{'type':Sequelize[_0x3071('0x3')]},'userpic':{'type':Sequelize[_0x3071('0x3')]},'city':{'type':Sequelize[_0x3071('0x3')]},'country':{'type':Sequelize[_0x3071('0x3')]},'online':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3071('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x18')},'lastPauseAt':{'type':Sequelize[_0x3071('0x17')]},'chatCapacity':{'type':Sequelize[_0x3071('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3071('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3071('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3071('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3071('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x13c4},'phoneBarExpires':{'type':Sequelize[_0x3071('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3071('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![],'defaultValue':_0x3071('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x3071('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x1a'),_0x3071('0x11'),_0x3071('0x1b')),'allowNull':!![],'defaultValue':_0x3071('0x1a')},'context':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![],'defaultValue':_0x3071('0x1c')},'callingpres':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x1d'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x3071('0x1e'),_0x3071('0x1f'),_0x3071('0x20'),_0x3071('0x21'),_0x3071('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3071('0x23'),'set':function(_0x392800){this['setDataValue'](_0x3071('0x24'),_0x392800?_0x392800[_0x3071('0x25')](','):null);},'get':function(){return this[_0x3071('0x15')](_0x3071('0x24'))?this['getDataValue'](_0x3071('0x24'))[_0x3071('0x26')](','):null;},'comment':_0x3071('0x27')},'dtmfmode':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x28'),_0x3071('0x29'),_0x3071('0x2a'),_0x3071('0x2b'),'auto'),'allowNull':!![],'defaultValue':_0x3071('0x28')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x3071('0x2c'),_0x3071('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![],'defaultValue':_0x3071('0x2f'),'set':function(_0x5610ab){this[_0x3071('0x5')](_0x3071('0x30'),_0x5610ab?_0x5610ab['join'](','):null);},'get':function(){return this[_0x3071('0x15')]('nat')?this[_0x3071('0x15')](_0x3071('0x30'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x3071('0x3')]},'namedcallgroup':{'type':Sequelize[_0x3071('0x3')]},'pickupgroup':{'type':Sequelize[_0x3071('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3071('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'defaultValue':_0x3071('0x31'),'set':function(_0x1fcc52){this[_0x3071('0x5')](_0x3071('0x32'),_0x1fcc52?_0x1fcc52['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x3071('0x15')](_0x3071('0x32'))?this[_0x3071('0x15')](_0x3071('0x32'))['split'](';'):null;},'comment':_0x3071('0x33')},'autoframing':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![],'set':function(_0x277104){this[_0x3071('0x5')]('insecure',_0x277104?_0x277104[_0x3071('0x25')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue']('insecure')[_0x3071('0x26')](','):null;},'comment':_0x3071('0x34')},'trustrpid':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3071('0x35')},'amaflags':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x3071('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3071('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3071('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x3071('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3071('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no',_0x3071('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3071('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x3071('0x37'),_0x3071('0x38'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x39'),_0x3071('0x3a')),'allowNull':!![],'defaultValue':_0x3071('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x3071('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x3071('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3071('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x3071('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no',_0x3071('0x3b'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x3c'),_0x3071('0x3d'),_0x3071('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3071('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x3071('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x3071('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3071('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3071('0xf')](_0x3071('0x2e'),'no',_0x3071('0x2c'),_0x3071('0x2d'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3071('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x3071('0x17')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x1b0f81){this[_0x3071('0x5')](_0x3071('0x3f'),_0x1b0f81);var _0x25680e=this[_0x3071('0x40')]({'plain':!![]});switch(_0x1b0f81){case 0x0:case 0x1:var _0x210123=_0x25680e[_0x3071('0x24')]?_[_0x3071('0x41')](_0x25680e[_0x3071('0x24')])?_0x25680e['transport'][_0x3071('0x25')]():_0x25680e[_0x3071('0x24')]:_0x3071('0x23');if(_0x210123===_0x3071('0x42')){_0x210123=_0x3071('0x23');}this[_0x3071('0x5')](_0x3071('0x24'),_0x210123);this[_0x3071('0x5')](_0x3071('0x43'),'no');this[_0x3071('0x5')](_0x3071('0x44'),null);this['setDataValue'](_0x3071('0x45'),null);this[_0x3071('0x5')](_0x3071('0x46'),null);this[_0x3071('0x5')](_0x3071('0x47'),null);this[_0x3071('0x5')](_0x3071('0x48'),null);this[_0x3071('0x5')]('dtlssetup',null);this[_0x3071('0x5')](_0x3071('0x49'),null);this['setDataValue']('dtlsprivatekey',null);this[_0x3071('0x5')](_0x3071('0x4a'),'no');break;case 0x2:this[_0x3071('0x5')](_0x3071('0x24'),'wss');this['setDataValue'](_0x3071('0x43'),'yes');this['setDataValue']('avpf','yes');this[_0x3071('0x5')](_0x3071('0x45'),_0x3071('0x2e'));this['setDataValue'](_0x3071('0x46'),_0x3071('0x2e'));this[_0x3071('0x5')](_0x3071('0x47'),'yes');this[_0x3071('0x5')](_0x3071('0x48'),'no');this['setDataValue'](_0x3071('0x4b'),_0x3071('0x3e'));this[_0x3071('0x5')](_0x3071('0x49'),_0x25680e[_0x3071('0x49')]||_0x3071('0x4c'));this[_0x3071('0x5')]('dtlsprivatekey',_0x25680e['dtlsprivatekey']||_0x3071('0x4d'));this[_0x3071('0x5')](_0x3071('0x4a'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x9f49f0){this[_0x3071('0x5')](_0x3071('0x4e'),_0x9f49f0?_0x9f49f0[_0x3071('0x25')](','):[]);},'get':function(){return this[_0x3071('0x15')](_0x3071('0x4e'))?_[_0x3071('0x4f')](this[_0x3071('0x15')]('permissions')[_0x3071('0x26')](','),function(_0x5ea33f){return parseInt(_0x5ea33f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3071('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3071('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3071('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3071('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x3071('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3071('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x3071('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3071('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x3071('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3071('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3071('0x3')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3071('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3071('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xa9e0=['PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x5d99e5,_0x110cca){var _0x5df59f=function(_0x13d81c){while(--_0x13d81c){_0x5d99e5['push'](_0x5d99e5['shift']());}};_0x5df59f(++_0x110cca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x13c4},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 155a687..637fafe 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 _0x0660=['ChatInteraction','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','push','UserVoiceQueue.penalty','MemberReport','forEach','all','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','YYYY-MM-DD\x20HH:mm:ss','pause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','smsPause','pauseType','QueuePause','manual','mail','fax','openchannel','%s%s','Pause','getTeams','Team','addTeams','omit','removeTeams','CmList','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$lt','$lte','$ne','$not','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','Contact','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./user.socket','client','http','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','get','Users','Agents','agent','telephone','filter','ignore','map','includes','role','find','value','UserProfileResource','destroy','stack','name','send','index','User','model','differenceBy','keys','query','dateEnd','dateStart','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','sequelize','col','lower','options','count','includeAll','include','findAll','params','salt','bulkCreate','body','describe','addContacts','agent\x20role','admin','user','../../config/license/util','getLicense','telephones','users','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','internal','Setting','findById','min_internal','max','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','password','fullname','email','101','102','110','104','106','107','108','109','100','111','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','loginInPause','interface','isValidChannel','Unknown\x20channel','channel','toLowerCase','Queues','ids','penalty','capitalize','emit','voice','VoiceQueue','SIP/%s','voicePause','each','UserVoiceQueueRt','upsert','removeQueues','remove','QueueId','Queue:remove','addAvatar','userpic','file','filename','getAvatar','server/files/images/logos/default_profile.png','download','existsSync','join','root','server/files/images/','getContacts','CmContact','rawAttributes','Tag','Tags','color','tag','getQueues','findOne','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','rows','getChatInteractions'];(function(_0x334cd2,_0x15f890){var _0x4bec64=function(_0x55b7c2){while(--_0x55b7c2){_0x334cd2['push'](_0x334cd2['shift']());}};_0x4bec64(++_0x15f890);}(_0x0660,0x1be));var _0x0066=function(_0x4e05fb,_0xe66bae){_0x4e05fb=_0x4e05fb-0x0;var _0x35d7e4=_0x0660[_0x4e05fb];return _0x35d7e4;};'use strict';var pdf=require(_0x0066('0x0'));var emlformat=require(_0x0066('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0066('0x2'));var jsonpatch=require(_0x0066('0x3'));var rp=require(_0x0066('0x4'));var moment=require(_0x0066('0x5'));var BPromise=require(_0x0066('0x6'));var Mustache=require(_0x0066('0x7'));var util=require('util');var path=require(_0x0066('0x8'));var sox=require(_0x0066('0x9'));var csv=require('to-csv');var ejs=require(_0x0066('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0066('0xb'));var crypto=require(_0x0066('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0066('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0066('0xe'));var Papa=require(_0x0066('0xf'));var Redis=require(_0x0066('0x10'));var qs=require(_0x0066('0x11'));var logger=require('../../config/logger')(_0x0066('0x12'));var utils=require(_0x0066('0x13'));var config=require(_0x0066('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0066('0x15')](config['redis'],{'host':_0x0066('0x16'),'port':0x18eb});var socket=require(_0x0066('0x17'))(new Redis(config[_0x0066('0x18')]));require(_0x0066('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0066('0x1a')][_0x0066('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2d2c41,_0x1ef9c1,_0x4a2e6d,_0x15d9e8){return new BPromise(function(_0x564adf,_0x3ae3cf){var _0x7dbb65=_0x15d9e8||client;return _0x7dbb65['request'](_0x2d2c41,_0x4a2e6d)[_0x0066('0x1c')](function(_0xdceefa){logger[_0x0066('0x1d')](_0x0066('0x1e'),_0x1ef9c1,'request\x20sent');logger[_0x0066('0x1f')](_0x0066('0x20'),_0x1ef9c1,_0x0066('0x21'),JSON[_0x0066('0x22')](_0xdceefa));if(_0xdceefa[_0x0066('0x23')]){if(_0xdceefa[_0x0066('0x23')][_0x0066('0x24')]===0x1f4){logger[_0x0066('0x23')]('User,\x20%s,\x20%s',_0x1ef9c1,_0xdceefa['error'][_0x0066('0x25')]);return _0x3ae3cf(_0xdceefa[_0x0066('0x23')]['message']);}logger[_0x0066('0x23')](_0x0066('0x1e'),_0x1ef9c1,_0xdceefa[_0x0066('0x23')][_0x0066('0x25')]);return _0x564adf(_0xdceefa[_0x0066('0x23')][_0x0066('0x25')]);}else{logger[_0x0066('0x1d')](_0x0066('0x1e'),_0x1ef9c1,_0x0066('0x21'));_0x564adf(_0xdceefa['result'][_0x0066('0x25')]);}})[_0x0066('0x26')](function(_0x45b602){logger['error'](_0x0066('0x1e'),_0x1ef9c1,_0x45b602);_0x3ae3cf(_0x45b602);});});}function respondWithStatusCode(_0x1f410a,_0x553c10){_0x553c10=_0x553c10||0xcc;return function(_0x2e538b){if(_0x2e538b){return _0x1f410a[_0x0066('0x27')](_0x553c10);}return _0x1f410a[_0x0066('0x28')](_0x553c10)[_0x0066('0x29')]();};}function respondWithResult(_0x4a023,_0x1b1968){_0x1b1968=_0x1b1968||0xc8;return function(_0x432a06){if(_0x432a06){return _0x4a023[_0x0066('0x28')](_0x1b1968)[_0x0066('0x2a')](_0x432a06);}};}function respondWithFilteredResult(_0xe7155f,_0x5400e5){return function(_0x6dcaf6){if(_0x6dcaf6){var _0x37bc66=_0x6dcaf6['count'],_0x121055=_0x5400e5[_0x0066('0x2b')],_0x69dabe=_0x5400e5['offset']+_0x5400e5[_0x0066('0x2c')],_0x30ebad;if(_0x69dabe>=_0x37bc66){_0x69dabe=_0x37bc66;_0x30ebad=0xc8;}else{_0x30ebad=0xce;}_0xe7155f[_0x0066('0x28')](_0x30ebad);return _0xe7155f[_0x0066('0x2d')](_0x0066('0x2e'),_0x121055+'-'+_0x69dabe+'/'+_0x37bc66)[_0x0066('0x2a')](_0x6dcaf6);}return null;};}function patchUpdates(_0x502f40){return function(_0x5649bf){try{jsonpatch[_0x0066('0x2f')](_0x5649bf,_0x502f40,!![]);}catch(_0x194c28){return BPromise[_0x0066('0x30')](_0x194c28);}return _0x5649bf[_0x0066('0x31')]();};}function saveUpdates(_0x4fd3fb,_0x5d24d5){return function(_0x580682){if(_0x580682){return _0x580682[_0x0066('0x32')](_0x4fd3fb)[_0x0066('0x1c')](function(_0x260b1f){return _0x260b1f;});}return null;};}function removeEntity(_0x58e0b4,_0x2f8381){return function(_0x1549cc){if(_0x1549cc){return _0x1549cc['destroy']()[_0x0066('0x1c')](function(){var _0x42f0e9=_0x1549cc[_0x0066('0x33')]({'plain':!![]});var _0x5a54dd=[{'name':_0x0066('0x34'),'value':'user','ignore':!![]},{'name':_0x0066('0x35'),'value':_0x0066('0x36'),'ignore':![]},{'name':'Telephones','value':_0x0066('0x37'),'ignore':![]}];var _0x1da488=_(_0x5a54dd)[_0x0066('0x38')](_0x0066('0x39'))[_0x0066('0x3a')]('value')['value']();if(_[_0x0066('0x3b')](_0x1da488,_0x42f0e9[_0x0066('0x3c')])){return;}var _0x3a4ff7=_[_0x0066('0x3d')](_0x5a54dd,[_0x0066('0x3e'),_0x42f0e9[_0x0066('0x3c')]])['name'];return db[_0x0066('0x3f')][_0x0066('0x40')]({'where':{'type':_0x3a4ff7,'resourceId':_0x42f0e9['id']}})[_0x0066('0x1c')](function(){return _0x1549cc;});})[_0x0066('0x1c')](function(){_0x58e0b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2616c7,_0x142ce4){return function(_0x550558){if(!_0x550558){_0x2616c7[_0x0066('0x27')](0x194);}return _0x550558;};}function handleError(_0x1993ba,_0x297cfd){_0x297cfd=_0x297cfd||0x1f4;return function(_0x5d6259){logger[_0x0066('0x23')](_0x5d6259[_0x0066('0x41')]);if(_0x5d6259[_0x0066('0x42')]){delete _0x5d6259[_0x0066('0x42')];}_0x1993ba['status'](_0x297cfd)[_0x0066('0x43')](_0x5d6259);};}exports[_0x0066('0x44')]=function(_0x867596,_0x158617){var _0x131e39={},_0x2a8833={},_0x1a66ec={'count':0x0,'rows':[]};var _0x3a38e7=db[_0x0066('0x45')]['rawAttributes'];_0x2a8833[_0x0066('0x46')]=_[_0x0066('0x47')](_[_0x0066('0x48')](_0x3a38e7),['password','salt']);var _0x4b1e15={'dateStart':_0x867596[_0x0066('0x49')]['dateStart'],'dateEnd':_0x867596[_0x0066('0x49')][_0x0066('0x4a')]};delete _0x867596[_0x0066('0x49')][_0x0066('0x4b')];delete _0x867596['query'][_0x0066('0x4a')];_0x2a8833[_0x0066('0x49')]=_[_0x0066('0x48')](_0x867596['query']);_0x2a8833['filters']=_['intersection'](_0x2a8833[_0x0066('0x46')],_0x2a8833[_0x0066('0x49')]);_0x131e39[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x2a8833[_0x0066('0x46')],qs[_0x0066('0x4e')](_0x867596[_0x0066('0x49')][_0x0066('0x4e')]));_0x131e39[_0x0066('0x4c')]=_0x131e39['attributes'][_0x0066('0x4f')]?_0x131e39[_0x0066('0x4c')]:_0x2a8833[_0x0066('0x46')];if(!_0x867596[_0x0066('0x49')][_0x0066('0x50')](_0x0066('0x51'))){_0x131e39[_0x0066('0x2c')]=qs[_0x0066('0x2c')](_0x867596[_0x0066('0x49')][_0x0066('0x2c')]);_0x131e39[_0x0066('0x2b')]=qs[_0x0066('0x2b')](_0x867596['query'][_0x0066('0x2b')]);}_0x131e39[_0x0066('0x52')]=qs['sort'](_0x867596['query'][_0x0066('0x53')]);_0x131e39[_0x0066('0x54')]=qs[_0x0066('0x55')](_[_0x0066('0x56')](_0x867596[_0x0066('0x49')],_0x2a8833[_0x0066('0x55')]));if(_0x4b1e15[_0x0066('0x4b')]){if(_0x4b1e15[_0x0066('0x4a')]){_0x4b1e15[_0x0066('0x4a')]=moment(_0x4b1e15['dateEnd'])[_0x0066('0x57')](0x1,'day');}else{_0x4b1e15[_0x0066('0x4a')]=moment(_0x4b1e15[_0x0066('0x4b')])[_0x0066('0x57')](0x1,_0x0066('0x58'));}_['merge'](_0x131e39[_0x0066('0x54')],{'createdAt':{'$gte':_0x4b1e15[_0x0066('0x4b')],'$lte':_0x4b1e15[_0x0066('0x4a')]}});}if(_0x867596[_0x0066('0x49')][_0x0066('0x38')]){_0x131e39[_0x0066('0x54')]=_[_0x0066('0x59')](_0x131e39[_0x0066('0x54')],{'$or':_[_0x0066('0x3a')](_0x131e39[_0x0066('0x4c')],function(_0x17c434){return db[_0x0066('0x5a')][_0x0066('0x54')](db[_0x0066('0x5a')]['fn']('lower',db[_0x0066('0x5a')][_0x0066('0x5b')](_0x17c434)),{'$like':db['sequelize']['fn'](_0x0066('0x5c'),'%'+_0x867596[_0x0066('0x49')][_0x0066('0x38')]+'%')});})});}_0x131e39=_[_0x0066('0x59')]({},_0x131e39,_0x867596[_0x0066('0x5d')]);var _0x2f5019={'where':_0x131e39[_0x0066('0x54')]};return db[_0x0066('0x45')]['count'](_0x2f5019)['then'](function(_0x117b64){_0x1a66ec[_0x0066('0x5e')]=_0x117b64;if(_0x867596['query'][_0x0066('0x5f')]){_0x131e39[_0x0066('0x60')]=[{'all':!![]}];}return db[_0x0066('0x45')][_0x0066('0x61')](_0x131e39);})['then'](function(_0x4af0ab){_0x1a66ec['rows']=_0x4af0ab;return _0x1a66ec;})[_0x0066('0x1c')](respondWithFilteredResult(_0x158617,_0x131e39))[_0x0066('0x26')](handleError(_0x158617,null));};exports['show']=function(_0x117e82,_0x853e31){var _0x5da304={'raw':![],'where':{'id':_0x117e82[_0x0066('0x62')]['id']}},_0x29e085={};_0x29e085['model']=_[_0x0066('0x47')](_[_0x0066('0x48')](db[_0x0066('0x45')]['rawAttributes']),['password',_0x0066('0x63')]);_0x29e085[_0x0066('0x49')]=_[_0x0066('0x48')](_0x117e82[_0x0066('0x49')]);_0x29e085[_0x0066('0x55')]=_[_0x0066('0x4d')](_0x29e085['model'],_0x29e085[_0x0066('0x49')]);_0x5da304['attributes']=_[_0x0066('0x4d')](_0x29e085[_0x0066('0x46')],qs[_0x0066('0x4e')](_0x117e82[_0x0066('0x49')][_0x0066('0x4e')]));_0x5da304[_0x0066('0x4c')]=_0x5da304[_0x0066('0x4c')][_0x0066('0x4f')]?_0x5da304[_0x0066('0x4c')]:_0x29e085[_0x0066('0x46')];if(_0x117e82['query'][_0x0066('0x5f')]){_0x5da304[_0x0066('0x60')]=[{'all':!![]}];}_0x5da304=_[_0x0066('0x59')]({},_0x5da304,_0x117e82['options']);return db['User'][_0x0066('0x3d')](_0x5da304)[_0x0066('0x1c')](handleEntityNotFound(_0x853e31,null))[_0x0066('0x1c')](respondWithResult(_0x853e31,null))[_0x0066('0x26')](handleError(_0x853e31,null));};exports['bulkCreate']=function(_0x11c4b8,_0xa044e){return db[_0x0066('0x45')][_0x0066('0x64')](_0x11c4b8[_0x0066('0x65')],{'raw':![],'individualHooks':!![]})[_0x0066('0x1c')](respondWithResult(_0xa044e,0xc9))['catch'](handleError(_0xa044e,null));};exports['update']=function(_0x38415a,_0x1bc2d5){if(_0x38415a['body']['id']){delete _0x38415a['body']['id'];}return db['User'][_0x0066('0x3d')]({'where':{'id':_0x38415a[_0x0066('0x62')]['id']}})[_0x0066('0x1c')](handleEntityNotFound(_0x1bc2d5,null))[_0x0066('0x1c')](saveUpdates(_0x38415a[_0x0066('0x65')],null))[_0x0066('0x1c')](respondWithResult(_0x1bc2d5,null))[_0x0066('0x26')](handleError(_0x1bc2d5,null));};exports[_0x0066('0x66')]=function(_0x5e531d,_0x386f77){return db[_0x0066('0x45')][_0x0066('0x66')]()['then'](respondWithResult(_0x386f77,null))[_0x0066('0x26')](handleError(_0x386f77,null));};exports[_0x0066('0x67')]=function(_0x223a19,_0x4f783f,_0x5a0ab0){return db['User'][_0x0066('0x3d')]({'where':{'id':_0x223a19['params']['id']}})['then'](handleEntityNotFound(_0x4f783f,null))[_0x0066('0x1c')](function(_0x38d5f0){if(_0x38d5f0){return _0x38d5f0['addContacts'](_0x223a19[_0x0066('0x65')]['ids'],_['omit'](_0x223a19[_0x0066('0x65')],['ids','id'])||{});}})[_0x0066('0x1c')](respondWithResult(_0x4f783f,null))[_0x0066('0x26')](handleError(_0x4f783f,null));};var getLicense=function(_0x3268c5){return new BPromise(function(_0x3c6f59,_0xb28573){var _0xd154cc=0x0;_0x3268c5[_0x0066('0x65')]['role']===_0x0066('0x36')&&_0x3c6f59(_0x0066('0x68'));return db['User'][_0x0066('0x5e')]({'where':{'$or':[{'role':_0x3268c5[_0x0066('0x65')]['role']===_0x0066('0x37')?_0x0066('0x37'):[_0x0066('0x69'),_0x0066('0x6a')]}]}})[_0x0066('0x1c')](function(_0x285712){_0xd154cc=_0x285712;return require(_0x0066('0x6b'))[_0x0066('0x6c')]();})[_0x0066('0x1c')](function(_0x171151){var _0x2000ca=_0x3268c5[_0x0066('0x65')][_0x0066('0x3c')]===_0x0066('0x37')?_0x0066('0x6d'):_0x0066('0x6e');if(!_['isNil'](_0x171151[_0x2000ca])&&_0xd154cc>=_0x171151[_0x2000ca]){return _0xb28573({'message':_0x0066('0x6f')});}return _0x3c6f59(util[_0x0066('0x70')](_0x0066('0x71'),_0x2000ca,_0xd154cc));})['catch'](function(_0x1b3427){return _0xb28573(_0x1b3427);});});};exports[_0x0066('0x72')]=function(_0x303139,_0xbbdbc5){return getLicense(_0x303139)[_0x0066('0x1c')](function(_0x3f2b86){if(!_0x303139['body'][_0x0066('0x73')]){var _0x308867;return db[_0x0066('0x74')][_0x0066('0x75')](0x1)[_0x0066('0x1c')](function(_0x6ea837){_0x308867=_0x6ea837[_0x0066('0x76')];return db[_0x0066('0x45')][_0x0066('0x77')](_0x0066('0x73'));})['then'](function(_0x1babde){if(_[_0x0066('0x78')](_0x1babde)){if(_0x308867){_0x303139[_0x0066('0x65')][_0x0066('0x73')]=_0x308867;}else{_0x303139[_0x0066('0x65')]['internal']=0x1;}}else{if(_[_0x0066('0x78')](_0x308867)||_0x308867==_0x1babde){_0x303139['body'][_0x0066('0x73')]=_0x1babde+0x1;}else if(_0x308867>_0x1babde){_0x303139[_0x0066('0x65')][_0x0066('0x73')]=_0x308867;}else{return db['sequelize'][_0x0066('0x49')](_0x0066('0x79'),{'type':db[_0x0066('0x5a')][_0x0066('0x7a')][_0x0066('0x7b')]})[_0x0066('0x1c')](function(_0x1bc92e){if(_0x1bc92e&&_0x1bc92e['length']){for(var _0x3e0fb1=0x0,_0x3378e0=_0x1bc92e['length'];_0x3e0fb1<_0x3378e0&&_[_0x0066('0x78')](_0x303139[_0x0066('0x65')]['internal']);_0x3e0fb1++){if(_0x308867<=_0x1bc92e[_0x3e0fb1]['from']){_0x303139[_0x0066('0x65')]['internal']=_0x1bc92e[_0x3e0fb1][_0x0066('0x7c')];}else if(_0x308867>_0x1bc92e[_0x3e0fb1][_0x0066('0x7c')]&&_0x308867<=_0x1bc92e[_0x3e0fb1]['to']){_0x303139['body'][_0x0066('0x73')]=_0x308867;}}}if(_[_0x0066('0x78')](_0x303139[_0x0066('0x65')][_0x0066('0x73')])){_0x303139[_0x0066('0x65')][_0x0066('0x73')]=_0x1babde+0x1;}});}}});}})[_0x0066('0x1c')](function(){if(_0x303139[_0x0066('0x65')][_0x0066('0x7d')]){_0x303139['body'][_0x0066('0x7e')]=_0x303139[_0x0066('0x65')][_0x0066('0x73')];_0x303139[_0x0066('0x65')][_0x0066('0x7f')]={'mailbox':_0x303139['body'][_0x0066('0x73')],'password':_0x303139[_0x0066('0x65')][_0x0066('0x80')],'fullname':_0x303139[_0x0066('0x65')][_0x0066('0x81')],'email':_0x303139[_0x0066('0x65')][_0x0066('0x82')]};}if(_0x303139['body']&&_0x303139[_0x0066('0x65')][_0x0066('0x3c')]==='agent'){_0x303139[_0x0066('0x65')]['permissions']=[_0x0066('0x83'),_0x0066('0x84'),'103',_0x0066('0x85'),_0x0066('0x86'),'105',_0x0066('0x87'),_0x0066('0x88'),_0x0066('0x89'),_0x0066('0x8a'),_0x0066('0x8b'),_0x0066('0x8c')];}return db['User']['create'](_0x303139[_0x0066('0x65')],{'include':[{'model':db[_0x0066('0x7f')],'as':_0x0066('0x7f')}]});})['then'](function(_0x1ce3a1){if(_0x303139[_0x0066('0x65')][_0x0066('0x3c')]===_0x0066('0x6a'))return _0x1ce3a1;var _0x43a260=_0x303139[_0x0066('0x6a')][_0x0066('0x33')]({'plain':!![]});if(!_0x43a260)throw new Error(_0x0066('0x8d'));if(_0x43a260[_0x0066('0x3c')]===_0x0066('0x6a')){var _0x1d5e4c=_0x1ce3a1[_0x0066('0x33')]({'plain':!![]});var _0xbc09c2=[{'name':'Agents','value':'agent'},{'name':'Telephones','value':_0x0066('0x37')}];var _0x28cf94=_[_0x0066('0x3d')](_0xbc09c2,[_0x0066('0x3e'),_0x1d5e4c[_0x0066('0x3c')]])['name'];return db[_0x0066('0x8e')][_0x0066('0x3d')]({'where':{'name':_0x28cf94,'userProfileId':_0x43a260[_0x0066('0x8f')]},'raw':!![]})[_0x0066('0x1c')](function(_0x5460c7){if(_0x5460c7&&_0x5460c7[_0x0066('0x90')]===0x0){return db[_0x0066('0x3f')][_0x0066('0x72')]({'name':_0x1d5e4c[_0x0066('0x42')],'resourceId':_0x1d5e4c['id'],'type':_0x5460c7[_0x0066('0x42')],'sectionId':_0x5460c7['id']},{})['then'](function(){return _0x1ce3a1;});}else{return _0x1ce3a1;}})[_0x0066('0x26')](function(_0x36fc76){logger['error'](_0x0066('0x91'),_0x36fc76);throw _0x36fc76;});}return _0x1ce3a1;})['then'](respondWithResult(_0xbbdbc5,0xc9))[_0x0066('0x26')](handleError(_0xbbdbc5,null));};exports[_0x0066('0x92')]=function(_0x2f1ee2,_0xbf22f1,_0x29bf93){if(_0x2f1ee2[_0x0066('0x65')]['id']){delete _0x2f1ee2[_0x0066('0x65')]['id'];}return db[_0x0066('0x45')][_0x0066('0x3d')]({'where':{'id':_0x2f1ee2[_0x0066('0x62')]['id']}})['then'](function(_0x478976){if(_0x478976){if(_0x478976['id']==_0x2f1ee2[_0x0066('0x6a')]['id']){if(!_0x2f1ee2[_0x0066('0x65')][_0x0066('0x93')]||!_0x2f1ee2[_0x0066('0x65')][_0x0066('0x94')]){throw new db[(_0x0066('0x95'))][(_0x0066('0x96'))](_0x0066('0x97'));}if(!_0x478976['authenticate'](_0x2f1ee2[_0x0066('0x65')][_0x0066('0x93')])){throw new db[(_0x0066('0x95'))][(_0x0066('0x96'))]('Wrong\x20credentials');}if(_0x2f1ee2[_0x0066('0x65')][_0x0066('0x93')]==_0x2f1ee2[_0x0066('0x65')]['newPassword']){throw new db[(_0x0066('0x95'))][(_0x0066('0x96'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x478976;}else if(_0x2f1ee2[_0x0066('0x6a')][_0x0066('0x3c')]=='admin'){if(!_0x2f1ee2['body'][_0x0066('0x94')]){throw new db['Sequelize']['ValidationError'](_0x0066('0x98'));}return _0x478976;}else if(_0x2f1ee2['user'][_0x0066('0x3c')]==_0x0066('0x6a')){if(!_0x2f1ee2[_0x0066('0x65')][_0x0066('0x94')]){throw new db['Sequelize'][(_0x0066('0x96'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x478976[_0x0066('0x3c')]!=_0x0066('0x36')){throw new db[(_0x0066('0x95'))][(_0x0066('0x96'))]('Unauthorized');}return _0x478976;}else{throw new db[(_0x0066('0x95'))]['ValidationError'](_0x0066('0x99'));}}return null;})[_0x0066('0x1c')](handleEntityNotFound(_0xbf22f1,null))[_0x0066('0x1c')](saveUpdates({'password':_0x2f1ee2['body'][_0x0066('0x94')],'passwordResetAt':_0x2f1ee2[_0x0066('0x6a')]['id']==_0x2f1ee2['params']['id']?moment():null},null))[_0x0066('0x1c')](respondWithResult(_0xbf22f1,null))[_0x0066('0x26')](handleError(_0xbf22f1,null));};exports[_0x0066('0x9a')]=function(_0x4eb7f3,_0x132c1a,_0x820ed7){var _0x48f147;return db[_0x0066('0x45')][_0x0066('0x3d')]({'where':{'id':_0x4eb7f3['params']['id']},'attributes':['id',_0x0066('0x42'),_0x0066('0x3c'),_0x0066('0x9b'),'voicePause',_0x0066('0x9c')]})[_0x0066('0x1c')](handleEntityNotFound(_0x132c1a,null))[_0x0066('0x1c')](function(_0x5476d3){if(_0x5476d3){_0x48f147=_0x5476d3;if(!utils[_0x0066('0x9d')](_0x4eb7f3[_0x0066('0x65')]['channel'])){throw new db[(_0x0066('0x95'))]['ValidationError'](_0x0066('0x9e'));}return _0x5476d3[_0x0066('0x57')+_['capitalize'](_0x4eb7f3[_0x0066('0x65')][_0x0066('0x9f')][_0x0066('0xa0')]())+_0x0066('0xa1')](_0x4eb7f3[_0x0066('0x65')][_0x0066('0xa2')],{'penalty':_0x4eb7f3[_0x0066('0x65')][_0x0066('0xa3')]||0x0});}})['spread'](function(_0x43e9b9){for(var _0x4cb846=0x0;_0x4cb846<_0x4eb7f3[_0x0066('0x65')][_0x0066('0xa2')][_0x0066('0x4f')];_0x4cb846+=0x1){var _0x3b66c5={'UserId':_0x4eb7f3[_0x0066('0x62')]['id']};_0x3b66c5[_[_0x0066('0xa4')](_0x4eb7f3['body'][_0x0066('0x9f')]['toLowerCase']())+'QueueId']=_0x4eb7f3['body'][_0x0066('0xa2')][_0x4cb846];socket[_0x0066('0xa5')](_0x0066('0x6a')+_[_0x0066('0xa4')](_0x4eb7f3[_0x0066('0x65')][_0x0066('0x9f')][_0x0066('0xa0')]())+'Queue:save',_0x3b66c5);}return _0x43e9b9;})[_0x0066('0x1c')](function(){if(_0x4eb7f3[_0x0066('0x65')]['channel']===_0x0066('0xa6')){return db[_0x0066('0xa7')][_0x0066('0x61')]({'where':{'id':_0x4eb7f3[_0x0066('0x65')][_0x0066('0xa2')]||[]},'raw':!![],'attributes':['id',_0x0066('0x42')]});}})['then'](function(_0x2fd292){var _0x2099bf=[];if(_0x4eb7f3[_0x0066('0x65')][_0x0066('0x9f')]===_0x0066('0xa6')&&_0x48f147['role']===_0x0066('0x36')){for(var _0x56ece4=0x0;_0x56ece4<_0x2fd292[_0x0066('0x4f')];_0x56ece4+=0x1){_0x2099bf['push']({'membername':_0x48f147['name'],'UserId':_0x48f147['id'],'queue_name':_0x2fd292[_0x56ece4][_0x0066('0x42')],'VoiceQueueId':_0x2fd292[_0x56ece4]['id'],'interface':_[_0x0066('0x78')](_0x48f147[_0x0066('0x9c')])?util['format'](_0x0066('0xa8'),_0x48f147[_0x0066('0x42')]):_0x48f147[_0x0066('0x9c')],'paused':_0x48f147[_0x0066('0xa9')]||![],'penalty':_0x4eb7f3['body'][_0x0066('0xa3')]||0x0});}return BPromise[_0x0066('0xaa')](_0x2099bf,function(_0x1649c5){return db[_0x0066('0xab')][_0x0066('0xac')](_0x1649c5);});}return _0x48f147;})[_0x0066('0x1c')](respondWithStatusCode(_0x132c1a,null))[_0x0066('0x26')](handleError(_0x132c1a,null));};exports[_0x0066('0xad')]=function(_0x1911e5,_0x311115,_0x270c54){var _0x42f3d8;return db[_0x0066('0x45')]['find']({'where':{'id':_0x1911e5[_0x0066('0x62')]['id']},'attributes':['id',_0x0066('0x42'),_0x0066('0x3c')]})['then'](handleEntityNotFound(_0x311115,null))[_0x0066('0x1c')](function(_0x424859){if(_0x424859){_0x42f3d8=_0x424859;if(!_0x1911e5[_0x0066('0x49')][_0x0066('0x9f')]||!utils[_0x0066('0x9d')](_0x1911e5['query']['channel'])){throw new db[(_0x0066('0x95'))]['ValidationError'](_0x0066('0x9e'));}return _0x424859[_0x0066('0xae')+_[_0x0066('0xa4')](_0x1911e5['query'][_0x0066('0x9f')]['toLowerCase']())+'Queues'](_0x1911e5[_0x0066('0x49')][_0x0066('0xa2')]);}})[_0x0066('0x1c')](function(_0x66b17c){for(var _0x494ad1=0x0;_0x494ad1<_0x1911e5[_0x0066('0x49')][_0x0066('0xa2')][_0x0066('0x4f')];_0x494ad1+=0x1){var _0x578fc2={'UserId':_0x1911e5[_0x0066('0x62')]['id']};_0x578fc2[_[_0x0066('0xa4')](_0x1911e5[_0x0066('0x49')]['channel'][_0x0066('0xa0')]())+_0x0066('0xaf')]=_0x1911e5[_0x0066('0x49')][_0x0066('0xa2')][_0x494ad1];socket[_0x0066('0xa5')]('user'+_[_0x0066('0xa4')](_0x1911e5[_0x0066('0x49')]['channel'][_0x0066('0xa0')]())+_0x0066('0xb0'),_0x578fc2);}return _0x66b17c;})[_0x0066('0x1c')](function(){if(_0x1911e5[_0x0066('0x49')][_0x0066('0x9f')]===_0x0066('0xa6')){return db[_0x0066('0xab')][_0x0066('0x40')]({'where':{'UserId':_0x1911e5[_0x0066('0x62')]['id'],'VoiceQueueId':_0x1911e5[_0x0066('0x49')][_0x0066('0xa2')]},'individualHooks':!![]})[_0x0066('0x1c')](function(){return _0x42f3d8;});}return _0x42f3d8;})[_0x0066('0x1c')](respondWithStatusCode(_0x311115,null))[_0x0066('0x26')](handleError(_0x311115,null));};exports[_0x0066('0xb1')]=function(_0x159e08,_0x5ef212,_0x547fd0){_0x159e08['body'][_0x0066('0xb2')]=_0x159e08[_0x0066('0xb3')][_0x0066('0xb4')];return db[_0x0066('0x45')][_0x0066('0x3d')]({'where':{'id':_0x159e08['params']['id']}})[_0x0066('0x1c')](handleEntityNotFound(_0x5ef212,null))[_0x0066('0x1c')](saveUpdates(_0x159e08[_0x0066('0x65')],null))[_0x0066('0x1c')](respondWithResult(_0x5ef212,null))[_0x0066('0x26')](handleError(_0x5ef212,null));};exports[_0x0066('0xb5')]=function(_0x1a780e,_0x260149,_0x562735){var _0x538a8d=path['join'](config['root'],_0x0066('0xb6'));return db[_0x0066('0x45')][_0x0066('0x3d')]({'where':{'id':_0x1a780e[_0x0066('0x62')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x260149,null))[_0x0066('0x1c')](function(_0x34b7f0){if(_0x34b7f0){if(_[_0x0066('0x78')](_0x34b7f0['userpic'])){return _0x260149[_0x0066('0xb7')](_0x538a8d);}else{if(!fs[_0x0066('0xb8')](path[_0x0066('0xb9')](config[_0x0066('0xba')],_0x0066('0xbb'),_0x34b7f0[_0x0066('0xb2')]))){return _0x260149[_0x0066('0xb7')](_0x538a8d);}return _0x260149[_0x0066('0xb7')](path[_0x0066('0xb9')](config[_0x0066('0xba')],'server/files/images/',_0x34b7f0[_0x0066('0xb2')]));}}})[_0x0066('0x26')](handleError(_0x260149,null));};exports[_0x0066('0xbc')]=function(_0x2933b2,_0x384a84,_0x479ced){var _0x3178f0={};var _0x313fc8={};var _0x491bb6;var _0xa7d269;return db[_0x0066('0x45')]['findOne']({'where':{'id':_0x2933b2[_0x0066('0x62')]['id']}})[_0x0066('0x1c')](handleEntityNotFound(_0x384a84,null))[_0x0066('0x1c')](function(_0x1a5ee7){if(_0x1a5ee7){_0x491bb6=_0x1a5ee7;_0x313fc8['model']=_[_0x0066('0x48')](db[_0x0066('0xbd')][_0x0066('0xbe')]);_0x313fc8['query']=_[_0x0066('0x48')](_0x2933b2[_0x0066('0x49')]);_0x313fc8[_0x0066('0x55')]=_[_0x0066('0x4d')](_0x313fc8[_0x0066('0x46')],_0x313fc8[_0x0066('0x49')]);_0x3178f0[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x313fc8[_0x0066('0x46')],qs['fields'](_0x2933b2[_0x0066('0x49')][_0x0066('0x4e')]));_0x3178f0['attributes']=_0x3178f0['attributes'][_0x0066('0x4f')]?_0x3178f0['attributes']:_0x313fc8[_0x0066('0x46')];_0x3178f0[_0x0066('0x52')]=qs[_0x0066('0x53')](_0x2933b2[_0x0066('0x49')][_0x0066('0x53')]);_0x3178f0[_0x0066('0x54')]=qs[_0x0066('0x55')](_[_0x0066('0x56')](_0x2933b2['query'],_0x313fc8[_0x0066('0x55')]));if(_0x2933b2[_0x0066('0x49')][_0x0066('0x38')]){_0x3178f0[_0x0066('0x54')]=_['merge'](_0x3178f0['where'],{'$or':_[_0x0066('0x3a')](_0x3178f0['attributes'],function(_0xb7654e){var _0x29cafd={};_0x29cafd[_0xb7654e]={'$like':'%'+_0x2933b2[_0x0066('0x49')]['filter']+'%'};return _0x29cafd;})});}_0x3178f0=_[_0x0066('0x59')]({},_0x3178f0,_0x2933b2[_0x0066('0x5d')]);return _0x491bb6['getContacts'](_0x3178f0);}})[_0x0066('0x1c')](function(_0x39961e){if(_0x39961e){_0xa7d269=_0x39961e[_0x0066('0x4f')];if(_0x2933b2[_0x0066('0x49')][_0x0066('0x50')](_0x0066('0x5f'))){_0x3178f0[_0x0066('0x60')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x0066('0xbf')],'as':_0x0066('0xc0'),'attributes':['id','name',_0x0066('0xc1')],'where':_0x2933b2['query'][_0x0066('0xc2')]?{'id':_0x2933b2[_0x0066('0x49')][_0x0066('0xc2')]}:undefined,'required':_0x2933b2[_0x0066('0x49')][_0x0066('0xc2')]?!![]:![]}];}if(!_0x2933b2[_0x0066('0x49')][_0x0066('0x50')]('nolimit')){_0x3178f0[_0x0066('0x2c')]=qs['limit'](_0x2933b2['query']['limit']);_0x3178f0[_0x0066('0x2b')]=qs[_0x0066('0x2b')](_0x2933b2['query'][_0x0066('0x2b')]);}return _0x491bb6[_0x0066('0xbc')](_0x3178f0);}})['then'](function(_0x1aa083){if(_0x1aa083){return _0x1aa083?{'count':_0xa7d269,'rows':_0x1aa083}:null;}})[_0x0066('0x1c')](respondWithResult(_0x384a84,null))['catch'](handleError(_0x384a84,null));};exports[_0x0066('0xc3')]=function(_0x5b6093,_0x8afd7c,_0x5d0424){var _0x196f2d;var _0x1ef25;var _0x32af2a={};var _0x122119;return db[_0x0066('0x45')][_0x0066('0xc4')]({'where':{'id':_0x5b6093[_0x0066('0x62')]['id']},'attributes':['id',_0x0066('0x42'),'role']})[_0x0066('0x1c')](handleEntityNotFound(_0x8afd7c,null))[_0x0066('0x1c')](function(_0x51a14b){if(!utils[_0x0066('0x9d')](_0x5b6093[_0x0066('0x49')][_0x0066('0x9f')])){throw new db[(_0x0066('0x95'))][(_0x0066('0x96'))](_0x0066('0x9e'));}_0x196f2d=_0x51a14b;var _0x5d7252={};_0x5d7252['model']=_[_0x0066('0x48')](db[_[_0x0066('0xa4')](_0x5b6093[_0x0066('0x49')]['channel'])+_0x0066('0xc5')][_0x0066('0xbe')]);_0x5d7252[_0x0066('0x49')]=_['keys'](_0x5b6093[_0x0066('0x49')]);_0x5d7252['filters']=_['intersection'](_0x5d7252[_0x0066('0x46')],_0x5d7252[_0x0066('0x49')]);_0x32af2a[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x5d7252[_0x0066('0x46')],qs[_0x0066('0x4e')](_0x5b6093[_0x0066('0x49')][_0x0066('0x4e')]));_0x32af2a[_0x0066('0x4c')]=_0x32af2a['attributes'][_0x0066('0x4f')]?_0x32af2a[_0x0066('0x4c')]:_0x5d7252[_0x0066('0x46')];_0x32af2a[_0x0066('0x52')]=qs[_0x0066('0x53')](_0x5b6093[_0x0066('0x49')]['sort']);_0x32af2a[_0x0066('0x54')]=qs['filters'](_[_0x0066('0x56')](_0x5b6093[_0x0066('0x49')],_0x5d7252['filters']));if(_0x5b6093[_0x0066('0x49')][_0x0066('0x38')]){_0x32af2a['where']=_[_0x0066('0x59')](_0x32af2a[_0x0066('0x54')],{'$or':_[_0x0066('0x3a')](_0x32af2a['attributes'],function(_0x54c385){var _0x514901={};_0x514901[_0x54c385]={'$like':'%'+_0x5b6093[_0x0066('0x49')][_0x0066('0x38')]+'%'};return _0x514901;})});}_0x32af2a=_[_0x0066('0x59')]({},_0x32af2a,_0x5b6093[_0x0066('0x5d')]);switch(_0x196f2d[_0x0066('0x3c')]){case _0x0066('0x69'):return db[_[_0x0066('0xa4')](_0x5b6093[_0x0066('0x49')][_0x0066('0x9f')])+_0x0066('0xc5')][_0x0066('0x61')](_0x32af2a);case _0x0066('0x6a'):case _0x0066('0x36'):return _0x196f2d['get'+_[_0x0066('0xa4')](_0x5b6093[_0x0066('0x49')][_0x0066('0x9f')])+_0x0066('0xa1')](_0x32af2a);default:throw new db['Sequelize'][(_0x0066('0x96'))]('Unknown\x20role');}})[_0x0066('0x1c')](function(_0x51d5f8){_0x122119=_0x51d5f8['length'];if(!_0x5b6093[_0x0066('0x49')]['hasOwnProperty']('nolimit')){_0x32af2a['limit']=qs[_0x0066('0x2c')](_0x5b6093[_0x0066('0x49')]['limit']);_0x32af2a[_0x0066('0x2b')]=qs[_0x0066('0x2b')](_0x5b6093[_0x0066('0x49')][_0x0066('0x2b')]);}switch(_0x196f2d['role']){case _0x0066('0x69'):return db[_[_0x0066('0xa4')](_0x5b6093[_0x0066('0x49')][_0x0066('0x9f')])+_0x0066('0xc5')]['findAll'](_0x32af2a);case _0x0066('0x6a'):case _0x0066('0x36'):return _0x196f2d[_0x0066('0x33')+_[_0x0066('0xa4')](_0x5b6093[_0x0066('0x49')][_0x0066('0x9f')])+'Queues'](_0x32af2a);}})[_0x0066('0x1c')](function(_0x75ead6){return{'count':_0x122119,'rows':_0x75ead6};})[_0x0066('0x1c')](respondWithResult(_0x8afd7c,null))['catch'](handleError(_0x8afd7c,null));};exports['getVoiceQueuesRt']=function(_0x279390,_0x1abe0b,_0x5937d8){var _0x571687={};var _0x10cbd0={};var _0x39bde1;var _0x2f6e50;return db[_0x0066('0x45')]['findOne']({'where':{'id':_0x279390[_0x0066('0x62')]['id']}})[_0x0066('0x1c')](handleEntityNotFound(_0x1abe0b,null))[_0x0066('0x1c')](function(_0x654be5){if(_0x654be5){_0x39bde1=_0x654be5;_0x10cbd0[_0x0066('0x46')]=_[_0x0066('0x48')](db[_0x0066('0xab')][_0x0066('0xbe')]);_0x10cbd0['query']=_[_0x0066('0x48')](_0x279390[_0x0066('0x49')]);_0x10cbd0[_0x0066('0x55')]=_[_0x0066('0x4d')](_0x10cbd0[_0x0066('0x46')],_0x10cbd0['query']);_0x571687[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x10cbd0['model'],qs[_0x0066('0x4e')](_0x279390[_0x0066('0x49')]['fields']));_0x571687[_0x0066('0x4c')]=_0x571687['attributes'][_0x0066('0x4f')]?_0x571687[_0x0066('0x4c')]:_0x10cbd0[_0x0066('0x46')];_0x571687[_0x0066('0x52')]=qs[_0x0066('0x53')](_0x279390[_0x0066('0x49')][_0x0066('0x53')]);_0x571687['where']=qs['filters'](_[_0x0066('0x56')](_0x279390[_0x0066('0x49')],_0x10cbd0['filters']));if(_0x279390[_0x0066('0x49')][_0x0066('0x38')]){_0x571687[_0x0066('0x54')]=_[_0x0066('0x59')](_0x571687[_0x0066('0x54')],{'$or':_[_0x0066('0x3a')](_0x571687[_0x0066('0x4c')],function(_0x5f491b){var _0x2c6528={};_0x2c6528[_0x5f491b]={'$like':'%'+_0x279390[_0x0066('0x49')][_0x0066('0x38')]+'%'};return _0x2c6528;})});}_0x571687=_[_0x0066('0x59')]({},_0x571687,_0x279390[_0x0066('0x5d')]);return _0x39bde1[_0x0066('0xc6')](_0x571687);}})['then'](function(_0x5b2834){if(_0x5b2834){_0x2f6e50=_0x5b2834['length'];if(!_0x279390[_0x0066('0x49')][_0x0066('0x50')](_0x0066('0x51'))){_0x571687[_0x0066('0x2c')]=qs[_0x0066('0x2c')](_0x279390[_0x0066('0x49')][_0x0066('0x2c')]);_0x571687[_0x0066('0x2b')]=qs['offset'](_0x279390['query'][_0x0066('0x2b')]);}return _0x39bde1[_0x0066('0xc6')](_0x571687);}})[_0x0066('0x1c')](function(_0x5c8ba3){if(_0x5c8ba3){return _0x5c8ba3?{'count':_0x2f6e50,'rows':_0x5c8ba3}:null;}})['then'](respondWithResult(_0x1abe0b,null))[_0x0066('0x26')](handleError(_0x1abe0b,null));};exports[_0x0066('0xc7')]=function(_0x5d9c96,_0x86a1e0,_0x3296e4){var _0x2e87fc={};var _0x148d6e={};var _0x1bbaeb;var _0x3efd18;return db[_0x0066('0x45')]['findOne']({'where':{'id':_0x5d9c96[_0x0066('0x62')]['id']}})['then'](handleEntityNotFound(_0x86a1e0,null))[_0x0066('0x1c')](function(_0x5e294d){if(_0x5e294d){_0x1bbaeb=_0x5e294d;_0x148d6e[_0x0066('0x46')]=_['keys'](db[_0x0066('0xc8')][_0x0066('0xbe')]);_0x148d6e[_0x0066('0x49')]=_[_0x0066('0x48')](_0x5d9c96[_0x0066('0x49')]);_0x148d6e[_0x0066('0x55')]=_[_0x0066('0x4d')](_0x148d6e[_0x0066('0x46')],_0x148d6e[_0x0066('0x49')]);_0x2e87fc[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x148d6e[_0x0066('0x46')],qs[_0x0066('0x4e')](_0x5d9c96[_0x0066('0x49')][_0x0066('0x4e')]));_0x2e87fc[_0x0066('0x4c')]=_0x2e87fc[_0x0066('0x4c')][_0x0066('0x4f')]?_0x2e87fc[_0x0066('0x4c')]:_0x148d6e['model'];_0x2e87fc['order']=qs['sort'](_0x5d9c96['query']['sort']);_0x2e87fc['where']=qs[_0x0066('0x55')](_[_0x0066('0x56')](_0x5d9c96[_0x0066('0x49')],_0x148d6e[_0x0066('0x55')]));if(_0x5d9c96[_0x0066('0x49')][_0x0066('0x38')]){_0x2e87fc['where']=_[_0x0066('0x59')](_0x2e87fc[_0x0066('0x54')],{'$or':_[_0x0066('0x3a')](_0x2e87fc[_0x0066('0x4c')],function(_0x5524ae){var _0x4026a4={};_0x4026a4[_0x5524ae]={'$like':'%'+_0x5d9c96[_0x0066('0x49')]['filter']+'%'};return _0x4026a4;})});}_0x2e87fc=_[_0x0066('0x59')]({},_0x2e87fc,_0x5d9c96['options']);return _0x1bbaeb[_0x0066('0xc7')](_0x2e87fc);}})['then'](function(_0x497655){if(_0x497655){_0x3efd18=_0x497655['length'];if(!_0x5d9c96['query'][_0x0066('0x50')](_0x0066('0x51'))){_0x2e87fc[_0x0066('0x2c')]=qs[_0x0066('0x2c')](_0x5d9c96['query'][_0x0066('0x2c')]);_0x2e87fc[_0x0066('0x2b')]=qs[_0x0066('0x2b')](_0x5d9c96[_0x0066('0x49')][_0x0066('0x2b')]);}return _0x1bbaeb['getGroups'](_0x2e87fc);}})['then'](function(_0xd54b4a){if(_0xd54b4a){return _0xd54b4a?{'count':_0x3efd18,'rows':_0xd54b4a}:null;}})[_0x0066('0x1c')](respondWithResult(_0x86a1e0,null))['catch'](handleError(_0x86a1e0,null));};exports[_0x0066('0xc9')]=function(_0x634564,_0x59c242,_0x312e5d){var _0x19b9a5={'raw':!![],'where':{}};var _0xecd492={};var _0x1322a4={'count':0x0,'rows':[]};return db[_0x0066('0x45')][_0x0066('0xc4')]({'where':{'id':_0x634564[_0x0066('0x62')]['id']}})['then'](handleEntityNotFound(_0x59c242,null))['then'](function(_0x1b26de){if(_0x1b26de){_0xecd492[_0x0066('0x46')]=_[_0x0066('0x48')](db[_0x0066('0xca')][_0x0066('0xbe')]);_0xecd492[_0x0066('0x49')]=_[_0x0066('0x48')](_0x634564['query']);_0xecd492[_0x0066('0x55')]=_['intersection'](_0xecd492[_0x0066('0x46')],_0xecd492[_0x0066('0x49')]);_0x19b9a5[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0xecd492[_0x0066('0x46')],qs[_0x0066('0x4e')](_0x634564['query']['fields']));_0x19b9a5[_0x0066('0x4c')]=_0x19b9a5['attributes']['length']?_0x19b9a5[_0x0066('0x4c')]:_0xecd492['model'];if(!_0x634564[_0x0066('0x49')][_0x0066('0x50')](_0x0066('0x51'))){_0x19b9a5[_0x0066('0x2c')]=qs[_0x0066('0x2c')](_0x634564[_0x0066('0x49')][_0x0066('0x2c')]);_0x19b9a5[_0x0066('0x2b')]=qs['offset'](_0x634564[_0x0066('0x49')][_0x0066('0x2b')]);}_0x19b9a5[_0x0066('0x52')]=qs[_0x0066('0x53')](_0x634564[_0x0066('0x49')][_0x0066('0x53')]);_0x19b9a5['where']=qs[_0x0066('0x55')](_[_0x0066('0x56')](_0x634564['query'],_0xecd492['filters']));_0x19b9a5[_0x0066('0x54')][_0x0066('0xcb')]=_0x1b26de['id'];if(_0x634564[_0x0066('0x49')][_0x0066('0x38')]){_0x19b9a5[_0x0066('0x54')]=_[_0x0066('0x59')](_0x19b9a5[_0x0066('0x54')],{'$or':_[_0x0066('0x3a')](_0x19b9a5[_0x0066('0x4c')],function(_0x311f29){var _0x489666={};_0x489666[_0x311f29]={'$like':'%'+_0x634564[_0x0066('0x49')][_0x0066('0x38')]+'%'};return _0x489666;})});}_0x19b9a5=_[_0x0066('0x59')]({},_0x19b9a5,_0x634564[_0x0066('0x5d')]);return db[_0x0066('0xca')]['count']({'where':_0x19b9a5[_0x0066('0x54')]})['then'](function(_0x4c183b){_0x1322a4[_0x0066('0x5e')]=_0x4c183b;if(_0x634564[_0x0066('0x49')][_0x0066('0x5f')]){_0x19b9a5['include']=[{'all':!![]}];}return db[_0x0066('0xca')][_0x0066('0x61')](_0x19b9a5);})[_0x0066('0x1c')](function(_0x4777b3){_0x1322a4[_0x0066('0xcc')]=_0x4777b3;return _0x1322a4;});}})[_0x0066('0x1c')](respondWithFilteredResult(_0x59c242,_0x19b9a5))[_0x0066('0x26')](handleError(_0x59c242,null));};exports[_0x0066('0xcd')]=function(_0x4d83c2,_0x7268cc,_0x17267c){var _0x59f6c0={};var _0x20084c={};var _0x21e03c;var _0x978d31;return db[_0x0066('0x45')][_0x0066('0xc4')]({'where':{'id':_0x4d83c2[_0x0066('0x62')]['id']}})['then'](handleEntityNotFound(_0x7268cc,null))['then'](function(_0x3c617a){if(_0x3c617a){_0x21e03c=_0x3c617a;_0x20084c[_0x0066('0x46')]=_[_0x0066('0x48')](db[_0x0066('0xce')][_0x0066('0xbe')]);_0x20084c['query']=_['keys'](_0x4d83c2[_0x0066('0x49')]);_0x20084c[_0x0066('0x55')]=_['intersection'](_0x20084c[_0x0066('0x46')],_0x20084c['query']);_0x59f6c0[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x20084c[_0x0066('0x46')],qs[_0x0066('0x4e')](_0x4d83c2[_0x0066('0x49')][_0x0066('0x4e')]));_0x59f6c0[_0x0066('0x4c')]=_0x59f6c0[_0x0066('0x4c')]['length']?_0x59f6c0[_0x0066('0x4c')]:_0x20084c[_0x0066('0x46')];_0x59f6c0[_0x0066('0x52')]=qs[_0x0066('0x53')](_0x4d83c2[_0x0066('0x49')]['sort']);_0x59f6c0[_0x0066('0x54')]=qs['filters'](_[_0x0066('0x56')](_0x4d83c2[_0x0066('0x49')],_0x20084c[_0x0066('0x55')]));if(_0x4d83c2[_0x0066('0x49')][_0x0066('0x38')]){_0x59f6c0[_0x0066('0x54')]=_['merge'](_0x59f6c0[_0x0066('0x54')],{'$or':_[_0x0066('0x3a')](_0x59f6c0[_0x0066('0x4c')],function(_0xe00ab3){var _0x5c02bc={};_0x5c02bc[_0xe00ab3]={'$like':'%'+_0x4d83c2[_0x0066('0x49')][_0x0066('0x38')]+'%'};return _0x5c02bc;})});}_0x59f6c0=_[_0x0066('0x59')]({},_0x59f6c0,_0x4d83c2['options']);return _0x21e03c[_0x0066('0xcd')](_0x59f6c0);}})[_0x0066('0x1c')](function(_0x4f0567){if(_0x4f0567){_0x978d31=_0x4f0567[_0x0066('0x4f')];if(!_0x4d83c2[_0x0066('0x49')][_0x0066('0x50')](_0x0066('0x51'))){_0x59f6c0['limit']=qs[_0x0066('0x2c')](_0x4d83c2['query'][_0x0066('0x2c')]);_0x59f6c0[_0x0066('0x2b')]=qs[_0x0066('0x2b')](_0x4d83c2[_0x0066('0x49')][_0x0066('0x2b')]);}return _0x21e03c[_0x0066('0xcd')](_0x59f6c0);}})[_0x0066('0x1c')](function(_0x2a8889){if(_0x2a8889){return _0x2a8889?{'count':_0x978d31,'rows':_0x2a8889}:null;}})[_0x0066('0x1c')](respondWithResult(_0x7268cc,null))[_0x0066('0x26')](handleError(_0x7268cc,null));};exports['getOpenchannelInteractions']=function(_0x23e497,_0x169faf,_0x16d67d){var _0x2d91b9={};var _0x1735ed={};var _0x3ddd98;var _0x32033a;return db[_0x0066('0x45')]['findOne']({'where':{'id':_0x23e497[_0x0066('0x62')]['id']}})[_0x0066('0x1c')](handleEntityNotFound(_0x169faf,null))[_0x0066('0x1c')](function(_0x2537a4){if(_0x2537a4){_0x3ddd98=_0x2537a4;_0x1735ed[_0x0066('0x46')]=_[_0x0066('0x48')](db[_0x0066('0xcf')][_0x0066('0xbe')]);_0x1735ed['query']=_['keys'](_0x23e497[_0x0066('0x49')]);_0x1735ed[_0x0066('0x55')]=_[_0x0066('0x4d')](_0x1735ed[_0x0066('0x46')],_0x1735ed[_0x0066('0x49')]);_0x2d91b9[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x1735ed['model'],qs[_0x0066('0x4e')](_0x23e497[_0x0066('0x49')][_0x0066('0x4e')]));_0x2d91b9[_0x0066('0x4c')]=_0x2d91b9[_0x0066('0x4c')]['length']?_0x2d91b9['attributes']:_0x1735ed['model'];_0x2d91b9[_0x0066('0x52')]=qs[_0x0066('0x53')](_0x23e497[_0x0066('0x49')]['sort']);_0x2d91b9[_0x0066('0x54')]=qs[_0x0066('0x55')](_[_0x0066('0x56')](_0x23e497[_0x0066('0x49')],_0x1735ed[_0x0066('0x55')]));if(_0x23e497[_0x0066('0x49')][_0x0066('0x38')]){_0x2d91b9['where']=_[_0x0066('0x59')](_0x2d91b9['where'],{'$or':_[_0x0066('0x3a')](_0x2d91b9['attributes'],function(_0x26a70c){var _0x52a34c={};_0x52a34c[_0x26a70c]={'$like':'%'+_0x23e497['query'][_0x0066('0x38')]+'%'};return _0x52a34c;})});}_0x2d91b9=_[_0x0066('0x59')]({},_0x2d91b9,_0x23e497[_0x0066('0x5d')]);return _0x3ddd98['getOpenchannelInteractions'](_0x2d91b9);}})[_0x0066('0x1c')](function(_0x2c21b4){if(_0x2c21b4){_0x32033a=_0x2c21b4[_0x0066('0x4f')];if(!_0x23e497['query'][_0x0066('0x50')]('nolimit')){_0x2d91b9[_0x0066('0x2c')]=qs[_0x0066('0x2c')](_0x23e497['query']['limit']);_0x2d91b9[_0x0066('0x2b')]=qs[_0x0066('0x2b')](_0x23e497[_0x0066('0x49')][_0x0066('0x2b')]);}return _0x3ddd98['getOpenchannelInteractions'](_0x2d91b9);}})[_0x0066('0x1c')](function(_0x3d0b71){if(_0x3d0b71){return _0x3d0b71?{'count':_0x32033a,'rows':_0x3d0b71}:null;}})[_0x0066('0x1c')](respondWithResult(_0x169faf,null))['catch'](handleError(_0x169faf,null));};exports[_0x0066('0xd0')]=function(_0x8b7469,_0x2311de,_0x5c84dd){var _0x6f4074={'raw':!![],'where':{}};var _0x3b61b0={};var _0x46d98f={'count':0x0,'rows':[]};return db[_0x0066('0x45')][_0x0066('0xc4')]({'where':{'id':_0x8b7469['params']['id']}})[_0x0066('0x1c')](handleEntityNotFound(_0x2311de,null))['then'](function(_0x4a30e7){if(_0x4a30e7){_0x3b61b0[_0x0066('0x46')]=_[_0x0066('0x48')](db[_0x0066('0xd1')][_0x0066('0xbe')]);_0x3b61b0[_0x0066('0x49')]=_[_0x0066('0x48')](_0x8b7469[_0x0066('0x49')]);_0x3b61b0[_0x0066('0x55')]=_[_0x0066('0x4d')](_0x3b61b0['model'],_0x3b61b0['query']);_0x6f4074[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x3b61b0['model'],qs['fields'](_0x8b7469[_0x0066('0x49')][_0x0066('0x4e')]));_0x6f4074[_0x0066('0x4c')]=_0x6f4074[_0x0066('0x4c')]['length']?_0x6f4074[_0x0066('0x4c')]:_0x3b61b0['model'];if(!_0x8b7469[_0x0066('0x49')]['hasOwnProperty'](_0x0066('0x51'))){_0x6f4074[_0x0066('0x2c')]=qs[_0x0066('0x2c')](_0x8b7469[_0x0066('0x49')][_0x0066('0x2c')]);_0x6f4074[_0x0066('0x2b')]=qs[_0x0066('0x2b')](_0x8b7469[_0x0066('0x49')]['offset']);}_0x6f4074[_0x0066('0x52')]=qs['sort'](_0x8b7469['query'][_0x0066('0x53')]);_0x6f4074['where']=qs[_0x0066('0x55')](_[_0x0066('0x56')](_0x8b7469[_0x0066('0x49')],_0x3b61b0[_0x0066('0x55')]));_0x6f4074[_0x0066('0x54')]['UserId']=_0x4a30e7['id'];if(_0x8b7469[_0x0066('0x49')][_0x0066('0x38')]){_0x6f4074['where']=_[_0x0066('0x59')](_0x6f4074['where'],{'$or':_[_0x0066('0x3a')](_0x6f4074['attributes'],function(_0x2d77ab){var _0x19a29={};_0x19a29[_0x2d77ab]={'$like':'%'+_0x8b7469[_0x0066('0x49')][_0x0066('0x38')]+'%'};return _0x19a29;})});}_0x6f4074=_[_0x0066('0x59')]({},_0x6f4074,_0x8b7469[_0x0066('0x5d')]);return db[_0x0066('0xd1')][_0x0066('0x5e')]({'where':_0x6f4074[_0x0066('0x54')]})[_0x0066('0x1c')](function(_0x398ed7){_0x46d98f[_0x0066('0x5e')]=_0x398ed7;if(_0x8b7469[_0x0066('0x49')][_0x0066('0x5f')]){_0x6f4074[_0x0066('0x60')]=[{'all':!![]}];}return db[_0x0066('0xd1')]['findAll'](_0x6f4074);})[_0x0066('0x1c')](function(_0x4cdaff){_0x46d98f[_0x0066('0xcc')]=_0x4cdaff;return _0x46d98f;});}})[_0x0066('0x1c')](respondWithFilteredResult(_0x2311de,_0x6f4074))[_0x0066('0x26')](handleError(_0x2311de,null));};exports[_0x0066('0xd2')]=function(_0x42e217,_0x4ef1a5,_0xf76572){var _0x423635={};var _0x2bb587={};var _0x1bd5e1;var _0x292852;return db[_0x0066('0x45')]['findOne']({'where':{'id':_0x42e217['params']['id']}})[_0x0066('0x1c')](handleEntityNotFound(_0x4ef1a5,null))[_0x0066('0x1c')](function(_0xfd7638){if(_0xfd7638){_0x1bd5e1=_0xfd7638;_0x2bb587[_0x0066('0x46')]=_[_0x0066('0x48')](db[_0x0066('0xd3')][_0x0066('0xbe')]);_0x2bb587[_0x0066('0x49')]=_[_0x0066('0x48')](_0x42e217['query']);_0x2bb587[_0x0066('0x55')]=_[_0x0066('0x4d')](_0x2bb587[_0x0066('0x46')],_0x2bb587[_0x0066('0x49')]);_0x423635[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x2bb587[_0x0066('0x46')],qs[_0x0066('0x4e')](_0x42e217[_0x0066('0x49')][_0x0066('0x4e')]));_0x423635[_0x0066('0x4c')]=_0x423635[_0x0066('0x4c')]['length']?_0x423635['attributes']:_0x2bb587[_0x0066('0x46')];_0x423635[_0x0066('0x52')]=qs['sort'](_0x42e217[_0x0066('0x49')][_0x0066('0x53')]);_0x423635[_0x0066('0x54')]=qs['filters'](_[_0x0066('0x56')](_0x42e217[_0x0066('0x49')],_0x2bb587[_0x0066('0x55')]));if(_0x42e217[_0x0066('0x49')][_0x0066('0x38')]){_0x423635[_0x0066('0x54')]=_[_0x0066('0x59')](_0x423635[_0x0066('0x54')],{'$or':_['map'](_0x423635[_0x0066('0x4c')],function(_0x1fc090){var _0xb58a6e={};_0xb58a6e[_0x1fc090]={'$like':'%'+_0x42e217[_0x0066('0x49')][_0x0066('0x38')]+'%'};return _0xb58a6e;})});}_0x423635=_['merge']({},_0x423635,_0x42e217[_0x0066('0x5d')]);return _0x1bd5e1['getSmsInteractions'](_0x423635);}})[_0x0066('0x1c')](function(_0x28d582){if(_0x28d582){_0x292852=_0x28d582[_0x0066('0x4f')];if(!_0x42e217[_0x0066('0x49')]['hasOwnProperty'](_0x0066('0x51'))){_0x423635[_0x0066('0x2c')]=qs[_0x0066('0x2c')](_0x42e217[_0x0066('0x49')][_0x0066('0x2c')]);_0x423635[_0x0066('0x2b')]=qs[_0x0066('0x2b')](_0x42e217[_0x0066('0x49')][_0x0066('0x2b')]);}return _0x1bd5e1['getSmsInteractions'](_0x423635);}})['then'](function(_0x583fa1){if(_0x583fa1){return _0x583fa1?{'count':_0x292852,'rows':_0x583fa1}:null;}})[_0x0066('0x1c')](respondWithResult(_0x4ef1a5,null))['catch'](handleError(_0x4ef1a5,null));};exports[_0x0066('0xd4')]=function(_0x547d6e,_0x4bb6f8,_0x27b923){var _0x4cd10a={};var _0x344eda={};var _0x1839ab;var _0x6fc58b;return db['User'][_0x0066('0xc4')]({'where':{'id':_0x547d6e[_0x0066('0x62')]['id']}})[_0x0066('0x1c')](handleEntityNotFound(_0x4bb6f8,null))[_0x0066('0x1c')](function(_0x220a0c){if(_0x220a0c){_0x1839ab=_0x220a0c;_0x344eda[_0x0066('0x46')]=_[_0x0066('0x48')](db['FaxInteraction']['rawAttributes']);_0x344eda['query']=_[_0x0066('0x48')](_0x547d6e['query']);_0x344eda[_0x0066('0x55')]=_[_0x0066('0x4d')](_0x344eda[_0x0066('0x46')],_0x344eda[_0x0066('0x49')]);_0x4cd10a[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x344eda[_0x0066('0x46')],qs['fields'](_0x547d6e[_0x0066('0x49')][_0x0066('0x4e')]));_0x4cd10a['attributes']=_0x4cd10a[_0x0066('0x4c')][_0x0066('0x4f')]?_0x4cd10a[_0x0066('0x4c')]:_0x344eda['model'];_0x4cd10a['order']=qs[_0x0066('0x53')](_0x547d6e[_0x0066('0x49')]['sort']);_0x4cd10a['where']=qs[_0x0066('0x55')](_[_0x0066('0x56')](_0x547d6e[_0x0066('0x49')],_0x344eda[_0x0066('0x55')]));if(_0x547d6e[_0x0066('0x49')][_0x0066('0x38')]){_0x4cd10a[_0x0066('0x54')]=_['merge'](_0x4cd10a['where'],{'$or':_[_0x0066('0x3a')](_0x4cd10a[_0x0066('0x4c')],function(_0x51a49a){var _0x2965af={};_0x2965af[_0x51a49a]={'$like':'%'+_0x547d6e[_0x0066('0x49')][_0x0066('0x38')]+'%'};return _0x2965af;})});}_0x4cd10a=_['merge']({},_0x4cd10a,_0x547d6e[_0x0066('0x5d')]);return _0x1839ab[_0x0066('0xd4')](_0x4cd10a);}})['then'](function(_0x52d21c){if(_0x52d21c){_0x6fc58b=_0x52d21c[_0x0066('0x4f')];if(!_0x547d6e[_0x0066('0x49')][_0x0066('0x50')](_0x0066('0x51'))){_0x4cd10a[_0x0066('0x2c')]=qs[_0x0066('0x2c')](_0x547d6e[_0x0066('0x49')][_0x0066('0x2c')]);_0x4cd10a[_0x0066('0x2b')]=qs[_0x0066('0x2b')](_0x547d6e[_0x0066('0x49')][_0x0066('0x2b')]);}return _0x1839ab['getFaxInteractions'](_0x4cd10a);}})[_0x0066('0x1c')](function(_0x13157){if(_0x13157){return _0x13157?{'count':_0x6fc58b,'rows':_0x13157}:null;}})['then'](respondWithResult(_0x4bb6f8,null))[_0x0066('0x26')](handleError(_0x4bb6f8,null));};exports[_0x0066('0xd5')]=function(_0x16259c,_0x597707,_0x36d9d2){var _0x282f37;var _0x31362e;var _0x579f65;return db[_0x0066('0x45')]['find']({'where':{'id':_0x16259c[_0x0066('0x62')]['id'],'role':'agent'},'attributes':['id',_0x0066('0x42'),_0x0066('0xd6'),_0x0066('0xd7'),'role','internal',_0x0066('0x9b')]})[_0x0066('0x1c')](handleEntityNotFound(_0x597707,null))['then'](function(_0x143826){if(_0x143826){_0x282f37=_0x143826;if(_0x16259c[_0x0066('0x65')][_0x0066('0x9c')]){_0x579f65=util[_0x0066('0x70')](_0x0066('0xd8'),_0x282f37[_0x16259c[_0x0066('0x65')][_0x0066('0x9c')]]);}else if(_0x16259c[_0x0066('0x65')][_0x0066('0xd9')]){_0x579f65=util[_0x0066('0x70')](_0x0066('0xa8'),_0x16259c['body'][_0x0066('0xd9')]);}else{_0x579f65=util[_0x0066('0x70')](_0x0066('0xa8'),_0x282f37[_0x0066('0x42')]);}socket['to'](util[_0x0066('0x70')]('user:%s',_0x282f37['name']))['emit']('user:forcelogout',{'ip':_0x16259c[_0x0066('0xda')][_0x0066('0xdb')]||_0x16259c[_0x0066('0xdc')][_0x0066('0xdd')]||_0x16259c[_0x0066('0xde')][_0x0066('0xdd')]||_0x16259c[_0x0066('0xdc')][_0x0066('0xde')][_0x0066('0xdd')]});return db[_0x0066('0xab')][_0x0066('0x40')]({'where':{'membername':_0x282f37[_0x0066('0x42')]},'individualHooks':!![]});}})[_0x0066('0x1c')](function(_0x420f40){if(_0x282f37){return _0x282f37[_0x0066('0xdf')]({'raw':!![]});}})[_0x0066('0x1c')](function(_0x433aa7){var _0x5e6c14=[];if(_0x433aa7){_0x31362e=_0x433aa7;if(_0x31362e[_0x0066('0x4f')]){for(var _0x4da85a=0x0;_0x4da85a<_0x31362e['length'];_0x4da85a++){_0x5e6c14[_0x0066('0xe0')]({'membername':_0x282f37[_0x0066('0x42')],'UserId':_0x282f37['id'],'queue_name':_0x31362e[_0x4da85a][_0x0066('0x42')],'VoiceQueueId':_0x31362e[_0x4da85a]['id'],'interface':_0x579f65,'paused':_0x282f37['loginInPause']||![],'penalty':_0x31362e[_0x4da85a][_0x0066('0xe1')]||0x0});}return BPromise['each'](_0x5e6c14,function(_0x247a2f){return db[_0x0066('0xab')][_0x0066('0xac')](_0x247a2f);});}}})[_0x0066('0x1c')](function(){return db[_0x0066('0xe2')][_0x0066('0x61')]({'where':{'membername':_0x282f37['name'],'exitAt':null}});})[_0x0066('0x1c')](function(_0x501e76){var _0x2572f6=[];_0x501e76[_0x0066('0xe3')](function(_0x1c98b9){_0x2572f6[_0x0066('0xe0')](_0x1c98b9[_0x0066('0x32')]({'exitAt':moment()[_0x0066('0x70')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0066('0xe4')](_0x2572f6);})[_0x0066('0x1c')](function(){var _0x1701d8=[];var _0x2f9188=[];var _0x4d81a5=utils[_0x0066('0xe5')]();var _0x4ea8b9={'membername':_0x282f37['name'],'interface':_0x579f65,'enterAt':moment()[_0x0066('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x282f37[_0x0066('0x3c')],'internal':_0x282f37[_0x0066('0x73')]};_0x4d81a5[_0x0066('0xe3')](function(_0x460db9){_0x1701d8[_0x0066('0xe0')](_[_0x0066('0x59')]({'channel':_0x460db9,'type':_0x0066('0xe6'),'data1':_0x16259c['body'][_0x0066('0xe7')],'data2':_0x579f65},_0x4ea8b9));if(_0x282f37[_0x0066('0x9b')]){_0x2f9188[_0x0066('0xe0')](_[_0x0066('0x59')]({'channel':_0x460db9,'type':_0x0066('0xe8'),'data1':_0x0066('0xe9')},_0x4ea8b9));}});return db['MemberReport']['bulkCreate'](_0x1701d8[_0x0066('0xea')](_0x2f9188),{'individualHooks':!![]});})[_0x0066('0x1c')](function(){return _0x282f37[_0x0066('0x32')]({'online':!![],'lastLoginAt':moment()['format'](_0x0066('0xeb')),'voicePause':_0x282f37[_0x0066('0x9b')]||![],'mailPause':_0x282f37[_0x0066('0x9b')]||![],'chatPause':_0x282f37[_0x0066('0x9b')]||![],'faxPause':_0x282f37[_0x0066('0x9b')]||![],'smsPause':_0x282f37[_0x0066('0x9b')]||![],'openchannelPause':_0x282f37[_0x0066('0x9b')]||![],'pauseType':_0x282f37['loginInPause']?'LOGININPAUSE':null,'interface':_0x579f65,'lastPauseAt':moment()[_0x0066('0x70')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x0066('0x1c')](respondWithResult(_0x597707,null))[_0x0066('0x26')](handleError(_0x597707,null));};exports['logout']=function(_0x23310e,_0x11dc90,_0xf39a8d){var _0x475fd9;return db[_0x0066('0x45')]['find']({'where':{'id':_0x23310e[_0x0066('0x62')]['id'],'role':_0x0066('0x36')},'attributes':['id',_0x0066('0x42'),_0x0066('0x3c')]})['then'](handleEntityNotFound(_0x11dc90,null))[_0x0066('0x1c')](function(_0x4069a8){if(_0x4069a8){_0x475fd9=_0x4069a8;return db[_0x0066('0xab')]['destroy']({'where':{'membername':_0x475fd9[_0x0066('0x42')]},'individualHooks':!![]});}})[_0x0066('0x1c')](function(){return db['MemberReport'][_0x0066('0x61')]({'where':{'membername':_0x475fd9[_0x0066('0x42')],'exitAt':null}});})[_0x0066('0x1c')](function(_0x2df387){var _0x5411b7=[];_0x2df387[_0x0066('0xe3')](function(_0x50dfa0){_0x5411b7[_0x0066('0xe0')](_0x50dfa0[_0x0066('0x32')]({'exitAt':moment()[_0x0066('0x70')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0066('0xe4')](_0x5411b7);})[_0x0066('0x1c')](function(){return _0x475fd9[_0x0066('0x32')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})['then'](respondWithResult(_0x11dc90,null))[_0x0066('0x26')](handleError(_0x11dc90,null));};exports[_0x0066('0xec')]=function(_0x4d0e33,_0x1594d8,_0xc57808){var _0x214173;return db[_0x0066('0xab')][_0x0066('0x32')]({'paused':0x1},{'where':{'UserId':_0x4d0e33['params']['id']},'individualHooks':!![]})[_0x0066('0x1c')](function(){return db[_0x0066('0x45')]['find']({'where':{'id':_0x4d0e33[_0x0066('0x62')]['id'],'role':'agent'},'attributes':['id',_0x0066('0x42'),_0x0066('0x3c'),'internal',_0x0066('0x9c')]});})['then'](handleEntityNotFound(_0x1594d8,null))[_0x0066('0x1c')](function(_0x541ecf){if(_0x541ecf){_0x214173=_0x541ecf;return respondWithRpcPromise('QueuePause','pause',{'id':_0x214173['id'],'name':_0x214173[_0x0066('0x42')],'pause':!![]});}})[_0x0066('0x1c')](function(){if(_0x214173){return db[_0x0066('0xe2')][_0x0066('0x61')]({'where':{'membername':_0x214173[_0x0066('0x42')],'type':_0x0066('0xe8'),'exitAt':null}});}})['then'](function(_0x83cb99){if(_0x83cb99[_0x0066('0x4f')]){var _0xcfd35b=moment()[_0x0066('0x70')](_0x0066('0xeb'));for(var _0x4942f1=0x0,_0x547c01=_0x83cb99[_0x0066('0x4f')];_0x4942f1<_0x547c01;_0x4942f1++){_0x83cb99[_0x4942f1][_0x0066('0xed')]({'exitAt':_0xcfd35b});}}})['then'](function(){var _0xa84a5f=[];var _0x570553=utils[_0x0066('0xe5')]();_0x570553[_0x0066('0xe3')](function(_0x47599e){_0xa84a5f['push']({'channel':_0x47599e,'membername':_0x214173['name'],'interface':_[_0x0066('0x78')](_0x214173[_0x0066('0x9c')])?util[_0x0066('0x70')]('SIP/%s',_0x214173[_0x0066('0x42')]):_0x214173[_0x0066('0x9c')],'type':_0x0066('0xe8'),'enterAt':moment()[_0x0066('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4d0e33[_0x0066('0x65')][_0x0066('0xee')]||_0x0066('0xef'),'role':_0x214173['role'],'internal':_0x214173[_0x0066('0x73')]});});return db[_0x0066('0xe2')][_0x0066('0x64')](_0xa84a5f,{'individualHooks':!![]});})[_0x0066('0x1c')](function(){return _0x214173[_0x0066('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4d0e33['body'][_0x0066('0xee')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0066('0x70')](_0x0066('0xeb'))});})['then'](respondWithResult(_0x1594d8,null))[_0x0066('0x26')](handleError(_0x1594d8,null));};exports[_0x0066('0xf0')]=function(_0xd62273,_0x11646d,_0x5116e9){var _0x27f0bd;return db[_0x0066('0x45')][_0x0066('0x3d')]({'where':{'id':_0xd62273[_0x0066('0x62')]['id']},'attributes':['id',_0x0066('0x42'),_0x0066('0x3c'),_0x0066('0xa9'),'mailPause',_0x0066('0xf1'),_0x0066('0xf2'),_0x0066('0xf3'),_0x0066('0xf4'),_0x0066('0xf5'),'lastPauseAt']})[_0x0066('0x1c')](handleEntityNotFound(_0x11646d,null))['then'](function(_0x3d1fe3){if(_0x3d1fe3){_0x27f0bd=_0x3d1fe3;if(_0xd62273['body'][_0x0066('0x9f')]&&!utils['isValidChannel'](_0xd62273[_0x0066('0x65')][_0x0066('0x9f')])){throw new db['Sequelize'][(_0x0066('0x96'))](_0x0066('0x9e'));}switch(_0xd62273[_0x0066('0x65')]['channel']){case'voice':return respondWithRpcPromise(_0x0066('0xf6'),'unpause',{'id':_0x27f0bd['id'],'name':_0x27f0bd[_0x0066('0x42')],'pause':![]})[_0x0066('0x1c')](function(){return db[_0x0066('0xab')]['update']({'paused':0x0},{'where':{'UserId':_0x27f0bd['id']},'individualHooks':!![]});})[_0x0066('0x1c')](function(){return db[_0x0066('0xe2')]['find']({'where':{'channel':_0xd62273['body'][_0x0066('0x9f')],'membername':_0x27f0bd['name'],'type':_0x0066('0xe8'),'exitAt':null}});})[_0x0066('0x1c')](function(_0x222515){if(_0x222515){return _0x222515[_0x0066('0x32')]({'exitAt':moment()[_0x0066('0x70')](_0x0066('0xeb')),'data2':_0x0066('0xf7')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x27f0bd[_0x0066('0x32')]({'voicePause':![]});});case _0x0066('0xf8'):case'chat':case _0x0066('0xf9'):case'sms':case _0x0066('0xfa'):return db[_0x0066('0xe2')][_0x0066('0x3d')]({'where':{'channel':_0xd62273[_0x0066('0x65')][_0x0066('0x9f')],'membername':_0x27f0bd[_0x0066('0x42')],'type':_0x0066('0xe8'),'exitAt':null}})['then'](function(_0x4c1afa){if(_0x4c1afa){return _0x4c1afa[_0x0066('0x32')]({'exitAt':moment()[_0x0066('0x70')](_0x0066('0xeb')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x46be71={};_[_0x0066('0x2d')](_0x46be71,util['format'](_0x0066('0xfb'),_0xd62273['body']['channel'],_0x0066('0xfc')),![]);return _0x27f0bd[_0x0066('0x32')](_0x46be71);});default:return respondWithRpcPromise(_0x0066('0xf6'),_0x0066('0xf0'),{'id':_0x27f0bd['id'],'name':_0x27f0bd[_0x0066('0x42')],'pause':![]})[_0x0066('0x1c')](function(){return db[_0x0066('0xab')]['update']({'paused':0x0},{'where':{'UserId':_0x27f0bd['id']}});})['then'](function(){return db[_0x0066('0xe2')][_0x0066('0x61')]({'where':{'membername':_0x27f0bd[_0x0066('0x42')],'type':_0x0066('0xe8'),'exitAt':null}});})[_0x0066('0x1c')](function(_0x2164ad){var _0x4b2e72=[];_0x2164ad[_0x0066('0xe3')](function(_0x4a12a8){_0x4b2e72[_0x0066('0xe0')](_0x4a12a8['update']({'exitAt':moment()[_0x0066('0x70')](_0x0066('0xeb')),'data2':_0x0066('0xf7')}));});return BPromise[_0x0066('0xe4')](_0x4b2e72);})[_0x0066('0x1c')](function(){return _0x27f0bd['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x11646d,null))[_0x0066('0x26')](handleError(_0x11646d,null));};exports[_0x0066('0xfd')]=function(_0x420eff,_0x477dad,_0x121aaf){var _0x51c3f3={};var _0xae367b={};var _0x4b33f2;var _0x298164;return db[_0x0066('0x45')]['findOne']({'where':{'id':_0x420eff[_0x0066('0x62')]['id']}})[_0x0066('0x1c')](handleEntityNotFound(_0x477dad,null))['then'](function(_0x49cfe3){if(_0x49cfe3){_0x4b33f2=_0x49cfe3;_0xae367b[_0x0066('0x46')]=_[_0x0066('0x48')](db[_0x0066('0xfe')]['rawAttributes']);_0xae367b['query']=_[_0x0066('0x48')](_0x420eff[_0x0066('0x49')]);_0xae367b[_0x0066('0x55')]=_[_0x0066('0x4d')](_0xae367b[_0x0066('0x46')],_0xae367b[_0x0066('0x49')]);_0x51c3f3['attributes']=_[_0x0066('0x4d')](_0xae367b[_0x0066('0x46')],qs[_0x0066('0x4e')](_0x420eff[_0x0066('0x49')][_0x0066('0x4e')]));_0x51c3f3['attributes']=_0x51c3f3[_0x0066('0x4c')][_0x0066('0x4f')]?_0x51c3f3[_0x0066('0x4c')]:_0xae367b['model'];_0x51c3f3[_0x0066('0x52')]=qs[_0x0066('0x53')](_0x420eff[_0x0066('0x49')][_0x0066('0x53')]);_0x51c3f3[_0x0066('0x54')]=qs['filters'](_['pick'](_0x420eff[_0x0066('0x49')],_0xae367b[_0x0066('0x55')]));if(_0x420eff[_0x0066('0x49')]['filter']){_0x51c3f3[_0x0066('0x54')]=_['merge'](_0x51c3f3[_0x0066('0x54')],{'$or':_[_0x0066('0x3a')](_0x51c3f3[_0x0066('0x4c')],function(_0x23cd2b){var _0x25b37e={};_0x25b37e[_0x23cd2b]={'$like':'%'+_0x420eff[_0x0066('0x49')][_0x0066('0x38')]+'%'};return _0x25b37e;})});}_0x51c3f3=_[_0x0066('0x59')]({},_0x51c3f3,_0x420eff[_0x0066('0x5d')]);return _0x4b33f2[_0x0066('0xfd')](_0x51c3f3);}})[_0x0066('0x1c')](function(_0x3a4278){if(_0x3a4278){_0x298164=_0x3a4278['length'];if(!_0x420eff[_0x0066('0x49')]['hasOwnProperty']('nolimit')){_0x51c3f3['limit']=qs['limit'](_0x420eff['query'][_0x0066('0x2c')]);_0x51c3f3['offset']=qs[_0x0066('0x2b')](_0x420eff[_0x0066('0x49')][_0x0066('0x2b')]);}return _0x4b33f2['getTeams'](_0x51c3f3);}})['then'](function(_0x59e49f){if(_0x59e49f){return _0x59e49f?{'count':_0x298164,'rows':_0x59e49f}:null;}})[_0x0066('0x1c')](respondWithResult(_0x477dad,null))['catch'](handleError(_0x477dad,null));};exports[_0x0066('0xff')]=function(_0x539d34,_0x2a16be,_0x2e8f86){return db[_0x0066('0x45')][_0x0066('0x3d')]({'where':{'id':_0x539d34['params']['id']}})[_0x0066('0x1c')](handleEntityNotFound(_0x2a16be,null))['then'](function(_0x1651cc){if(_0x1651cc){return _0x1651cc[_0x0066('0xff')](_0x539d34['body'][_0x0066('0xa2')],_[_0x0066('0x100')](_0x539d34[_0x0066('0x65')],[_0x0066('0xa2'),'id'])||{});}})[_0x0066('0x1c')](respondWithResult(_0x2a16be,null))[_0x0066('0x26')](handleError(_0x2a16be,null));};exports[_0x0066('0x101')]=function(_0x22cfd5,_0xef2908,_0x506378){var _0x32a8b5;return db['User']['find']({'where':{'id':_0x22cfd5[_0x0066('0x62')]['id']}})['then'](handleEntityNotFound(_0xef2908,null))[_0x0066('0x1c')](function(_0xc5ff99){if(_0xc5ff99){return _0xc5ff99['removeTeams'](_0x22cfd5['query'][_0x0066('0xa2')]);}})[_0x0066('0x1c')](respondWithStatusCode(_0xef2908,null))[_0x0066('0x26')](handleError(_0xef2908,null));};exports['getLists']=function(_0x5c584b,_0x58b3e0,_0x45061a){var _0x3105cc={};var _0x7ff4a7={};var _0x2758c4;var _0x42fc51;return db[_0x0066('0x45')][_0x0066('0xc4')]({'where':{'id':_0x5c584b['params']['id']}})['then'](handleEntityNotFound(_0x58b3e0,null))[_0x0066('0x1c')](function(_0x364443){if(_0x364443){_0x2758c4=_0x364443;_0x7ff4a7[_0x0066('0x46')]=_[_0x0066('0x48')](db[_0x0066('0x102')][_0x0066('0xbe')]);_0x7ff4a7['query']=_['keys'](_0x5c584b[_0x0066('0x49')]);_0x7ff4a7[_0x0066('0x55')]=_['intersection'](_0x7ff4a7[_0x0066('0x46')],_0x7ff4a7[_0x0066('0x49')]);_0x3105cc[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x7ff4a7[_0x0066('0x46')],qs['fields'](_0x5c584b[_0x0066('0x49')][_0x0066('0x4e')]));_0x3105cc['attributes']=_0x3105cc['attributes'][_0x0066('0x4f')]?_0x3105cc[_0x0066('0x4c')]:_0x7ff4a7[_0x0066('0x46')];_0x3105cc[_0x0066('0x52')]=qs[_0x0066('0x53')](_0x5c584b[_0x0066('0x49')][_0x0066('0x53')]);_0x3105cc[_0x0066('0x54')]=qs[_0x0066('0x55')](_[_0x0066('0x56')](_0x5c584b[_0x0066('0x49')],_0x7ff4a7['filters']));if(_0x5c584b[_0x0066('0x49')][_0x0066('0x38')]){_0x3105cc['where']=_['merge'](_0x3105cc[_0x0066('0x54')],{'$or':_[_0x0066('0x3a')](_0x3105cc[_0x0066('0x4c')],function(_0x3a7d68){var _0x3c025c={};_0x3c025c[_0x3a7d68]={'$like':'%'+_0x5c584b[_0x0066('0x49')][_0x0066('0x38')]+'%'};return _0x3c025c;})});}_0x3105cc=_[_0x0066('0x59')]({},_0x3105cc,_0x5c584b[_0x0066('0x5d')]);return _0x2758c4[_0x0066('0x103')](_0x3105cc);}})[_0x0066('0x1c')](function(_0x1601ea){if(_0x1601ea){_0x42fc51=_0x1601ea[_0x0066('0x4f')];if(!_0x5c584b[_0x0066('0x49')][_0x0066('0x50')](_0x0066('0x51'))){_0x3105cc[_0x0066('0x2c')]=qs[_0x0066('0x2c')](_0x5c584b[_0x0066('0x49')]['limit']);_0x3105cc[_0x0066('0x2b')]=qs['offset'](_0x5c584b[_0x0066('0x49')][_0x0066('0x2b')]);}return _0x2758c4[_0x0066('0x103')](_0x3105cc);}})[_0x0066('0x1c')](function(_0x50158e){if(_0x50158e){return _0x50158e?{'count':_0x42fc51,'rows':_0x50158e}:null;}})[_0x0066('0x1c')](respondWithResult(_0x58b3e0,null))[_0x0066('0x26')](handleError(_0x58b3e0,null));};exports[_0x0066('0x104')]=function(_0x50ed41,_0x12a637,_0x4f8596){var _0x5d48ce={};var _0x3096a5={};var _0x449695;var _0xa47de8;return db[_0x0066('0x45')][_0x0066('0xc4')]({'where':{'id':_0x50ed41[_0x0066('0x62')]['id']}})['then'](handleEntityNotFound(_0x12a637,null))['then'](function(_0x556bf6){if(_0x556bf6){_0x449695=_0x556bf6;_0x3096a5[_0x0066('0x46')]=_[_0x0066('0x48')](db[_0x0066('0x45')][_0x0066('0xbe')]);_0x3096a5[_0x0066('0x49')]=_[_0x0066('0x48')](_0x50ed41['query']);_0x3096a5[_0x0066('0x55')]=_[_0x0066('0x4d')](_0x3096a5[_0x0066('0x46')],_0x3096a5['query']);_0x5d48ce[_0x0066('0x4c')]=_[_0x0066('0x4d')](_0x3096a5[_0x0066('0x46')],qs['fields'](_0x50ed41['query'][_0x0066('0x4e')]));_0x5d48ce[_0x0066('0x4c')]=_0x5d48ce[_0x0066('0x4c')][_0x0066('0x4f')]?_0x5d48ce[_0x0066('0x4c')]:_0x3096a5[_0x0066('0x46')];_0x5d48ce[_0x0066('0x52')]=qs[_0x0066('0x53')](_0x50ed41[_0x0066('0x49')][_0x0066('0x53')]);_0x5d48ce[_0x0066('0x54')]=qs[_0x0066('0x55')](_[_0x0066('0x56')](_0x50ed41[_0x0066('0x49')],_0x3096a5['filters']));if(_0x50ed41['query'][_0x0066('0x38')]){_0x5d48ce[_0x0066('0x54')]=_[_0x0066('0x59')](_0x5d48ce[_0x0066('0x54')],{'$or':_[_0x0066('0x3a')](_0x5d48ce['attributes'],function(_0x51b0f2){var _0x489fd3={};_0x489fd3[_0x51b0f2]={'$like':'%'+_0x50ed41[_0x0066('0x49')][_0x0066('0x38')]+'%'};return _0x489fd3;})});}_0x5d48ce[_0x0066('0x46')]=db[_0x0066('0x45')];_0x5d48ce['as']='Agents';_0x5d48ce=_['merge']({},_0x5d48ce,_0x50ed41['options']);return _0x449695[_0x0066('0xdf')]({'include':[_0x5d48ce]});}})[_0x0066('0x1c')](function(_0x4de51b){if(_0x4de51b){var _0x2d5520={},_0x2a6804=[],_0x431495=0x0;for(var _0x5f34f4=0x0;_0x5f34f4<_0x4de51b[_0x0066('0x4f')];_0x5f34f4+=0x1){for(var _0x5be39a=0x0,_0x610132;_0x5be39a<_0x4de51b[_0x5f34f4][_0x0066('0x35')][_0x0066('0x4f')];_0x5be39a+=0x1){_0x610132=_0x4de51b[_0x5f34f4]['Agents'][_0x5be39a]['get']({'plain':!![]});_0x2d5520[_0x610132['id']]=_0x610132;}}_0x2d5520=_[_0x0066('0x105')](_0x2d5520);for(var _0x4d9731=qs[_0x0066('0x2b')](_0x50ed41[_0x0066('0x49')][_0x0066('0x2b')]);_0x4d9731<_0x2d5520['length']&&_0x2a6804[_0x0066('0x4f')]=_0xd11960){_0x21a614=_0xd11960;_0x36583f=0xc8;}else{_0x36583f=0xce;}_0x32fded[_0x4516('0x28')](_0x36583f);return _0x32fded[_0x4516('0x2e')](_0x4516('0x2f'),_0x11159e+'-'+_0x21a614+'/'+_0xd11960)[_0x4516('0x2a')](_0x21fef5);}return null;};}function patchUpdates(_0x48fc35){return function(_0x37ab6e){try{jsonpatch[_0x4516('0x30')](_0x37ab6e,_0x48fc35,!![]);}catch(_0x151623){return BPromise[_0x4516('0x31')](_0x151623);}return _0x37ab6e['save']();};}function saveUpdates(_0x1f4c50,_0x41bc16){return function(_0x351d27){if(_0x351d27){return _0x351d27[_0x4516('0x32')](_0x1f4c50)['then'](function(_0x434129){return _0x434129;});}return null;};}function removeEntity(_0x575d0a,_0x45bdf0){return function(_0xbd4932){if(_0xbd4932){return _0xbd4932['destroy']()[_0x4516('0x1c')](function(){var _0x211f37=_0xbd4932[_0x4516('0x33')]({'plain':!![]});var _0x28022e=[{'name':_0x4516('0x34'),'value':'user','ignore':!![]},{'name':_0x4516('0x35'),'value':_0x4516('0x36'),'ignore':![]},{'name':'Telephones','value':_0x4516('0x37'),'ignore':![]}];var _0x3cef3e=_(_0x28022e)[_0x4516('0x38')](_0x4516('0x39'))[_0x4516('0x3a')]('value')[_0x4516('0x3b')]();if(_[_0x4516('0x3c')](_0x3cef3e,_0x211f37['role'])){return;}var _0x572e6d=_[_0x4516('0x3d')](_0x28022e,['value',_0x211f37[_0x4516('0x3e')]])['name'];return db[_0x4516('0x3f')][_0x4516('0x40')]({'where':{'type':_0x572e6d,'resourceId':_0x211f37['id']}})[_0x4516('0x1c')](function(){return _0xbd4932;});})[_0x4516('0x1c')](function(){_0x575d0a[_0x4516('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3167b2,_0x5c1a1b){return function(_0x1cb19b){if(!_0x1cb19b){_0x3167b2[_0x4516('0x27')](0x194);}return _0x1cb19b;};}function handleError(_0x5ddc3b,_0xf447eb){_0xf447eb=_0xf447eb||0x1f4;return function(_0x80a105){logger[_0x4516('0x23')](_0x80a105[_0x4516('0x41')]);if(_0x80a105['name']){delete _0x80a105['name'];}_0x5ddc3b[_0x4516('0x28')](_0xf447eb)[_0x4516('0x42')](_0x80a105);};}exports[_0x4516('0x43')]=function(_0x384ab6,_0x251c10){var _0x5aee6c={},_0x31f996={},_0x476b4f={'count':0x0,'rows':[]};var _0x5738a4=db[_0x4516('0x44')][_0x4516('0x45')];_0x31f996[_0x4516('0x46')]=_['differenceBy'](_[_0x4516('0x47')](_0x5738a4),[_0x4516('0x48'),_0x4516('0x49')]);var _0x2cfbc3={'dateStart':_0x384ab6[_0x4516('0x4a')][_0x4516('0x4b')],'dateEnd':_0x384ab6[_0x4516('0x4a')]['dateEnd']};delete _0x384ab6['query'][_0x4516('0x4b')];delete _0x384ab6[_0x4516('0x4a')]['dateEnd'];_0x31f996[_0x4516('0x4a')]=_[_0x4516('0x47')](_0x384ab6[_0x4516('0x4a')]);_0x31f996[_0x4516('0x4c')]=_[_0x4516('0x4d')](_0x31f996['model'],_0x31f996[_0x4516('0x4a')]);_0x5aee6c[_0x4516('0x4e')]=_['intersection'](_0x31f996[_0x4516('0x46')],qs[_0x4516('0x4f')](_0x384ab6[_0x4516('0x4a')][_0x4516('0x4f')]));_0x5aee6c['attributes']=_0x5aee6c[_0x4516('0x4e')]['length']?_0x5aee6c[_0x4516('0x4e')]:_0x31f996[_0x4516('0x46')];if(!_0x384ab6[_0x4516('0x4a')][_0x4516('0x50')]('nolimit')){_0x5aee6c['limit']=qs['limit'](_0x384ab6[_0x4516('0x4a')][_0x4516('0x2d')]);_0x5aee6c[_0x4516('0x2c')]=qs[_0x4516('0x2c')](_0x384ab6[_0x4516('0x4a')][_0x4516('0x2c')]);}_0x5aee6c[_0x4516('0x51')]=qs[_0x4516('0x52')](_0x384ab6['query'][_0x4516('0x52')]);_0x5aee6c[_0x4516('0x53')]=qs[_0x4516('0x4c')](_['pick'](_0x384ab6[_0x4516('0x4a')],_0x31f996[_0x4516('0x4c')]));if(_0x2cfbc3[_0x4516('0x4b')]){if(_0x2cfbc3[_0x4516('0x54')]){_0x2cfbc3[_0x4516('0x54')]=moment(_0x2cfbc3[_0x4516('0x54')])[_0x4516('0x55')](0x1,_0x4516('0x56'));}else{_0x2cfbc3['dateEnd']=moment(_0x2cfbc3['dateStart'])[_0x4516('0x55')](0x1,_0x4516('0x56'));}_[_0x4516('0x57')](_0x5aee6c[_0x4516('0x53')],{'createdAt':{'$gte':_0x2cfbc3[_0x4516('0x4b')],'$lte':_0x2cfbc3[_0x4516('0x54')]}});}if(_0x384ab6['query'][_0x4516('0x38')]){_0x5aee6c['where']=_['merge'](_0x5aee6c[_0x4516('0x53')],{'$or':_[_0x4516('0x3a')](_0x5aee6c[_0x4516('0x4e')],function(_0xd7a513){return db['sequelize'][_0x4516('0x53')](db['sequelize']['fn'](_0x4516('0x58'),db[_0x4516('0x59')][_0x4516('0x5a')](_0xd7a513)),{'$like':db[_0x4516('0x59')]['fn']('lower','%'+_0x384ab6[_0x4516('0x4a')][_0x4516('0x38')]+'%')});})});}_0x5aee6c=_[_0x4516('0x57')]({},_0x5aee6c,_0x384ab6[_0x4516('0x5b')]);var _0x3f9207={'where':_0x5aee6c[_0x4516('0x53')]};return db['User'][_0x4516('0x2b')](_0x3f9207)[_0x4516('0x1c')](function(_0x1d9a87){_0x476b4f[_0x4516('0x2b')]=_0x1d9a87;if(_0x384ab6['query'][_0x4516('0x5c')]){_0x5aee6c[_0x4516('0x5d')]=[{'all':!![]}];}return db[_0x4516('0x44')][_0x4516('0x5e')](_0x5aee6c);})[_0x4516('0x1c')](function(_0xd836bf){_0x476b4f[_0x4516('0x5f')]=_0xd836bf;return _0x476b4f;})[_0x4516('0x1c')](respondWithFilteredResult(_0x251c10,_0x5aee6c))[_0x4516('0x60')](handleError(_0x251c10,null));};exports[_0x4516('0x61')]=function(_0x569410,_0x5a80ad){var _0x300eef={'raw':![],'where':{'id':_0x569410[_0x4516('0x62')]['id']}},_0x40edc={};_0x40edc[_0x4516('0x46')]=_[_0x4516('0x63')](_[_0x4516('0x47')](db['User'][_0x4516('0x45')]),[_0x4516('0x48'),_0x4516('0x49')]);_0x40edc[_0x4516('0x4a')]=_[_0x4516('0x47')](_0x569410[_0x4516('0x4a')]);_0x40edc[_0x4516('0x4c')]=_[_0x4516('0x4d')](_0x40edc[_0x4516('0x46')],_0x40edc[_0x4516('0x4a')]);_0x300eef[_0x4516('0x4e')]=_['intersection'](_0x40edc[_0x4516('0x46')],qs['fields'](_0x569410['query']['fields']));_0x300eef[_0x4516('0x4e')]=_0x300eef['attributes'][_0x4516('0x64')]?_0x300eef[_0x4516('0x4e')]:_0x40edc[_0x4516('0x46')];if(_0x569410[_0x4516('0x4a')]['includeAll']){_0x300eef[_0x4516('0x5d')]=[{'all':!![]}];}_0x300eef=_[_0x4516('0x57')]({},_0x300eef,_0x569410[_0x4516('0x5b')]);return db[_0x4516('0x44')]['find'](_0x300eef)[_0x4516('0x1c')](handleEntityNotFound(_0x5a80ad,null))[_0x4516('0x1c')](respondWithResult(_0x5a80ad,null))['catch'](handleError(_0x5a80ad,null));};exports[_0x4516('0x65')]=function(_0x48fcb0,_0x59eb21){return db[_0x4516('0x44')][_0x4516('0x65')](_0x48fcb0[_0x4516('0x66')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x59eb21,0xc9))[_0x4516('0x60')](handleError(_0x59eb21,null));};exports['update']=function(_0x12ca13,_0x3dfe2d){if(_0x12ca13[_0x4516('0x66')]['id']){delete _0x12ca13[_0x4516('0x66')]['id'];}return db[_0x4516('0x44')][_0x4516('0x3d')]({'where':{'id':_0x12ca13[_0x4516('0x62')]['id']}})['then'](handleEntityNotFound(_0x3dfe2d,null))[_0x4516('0x1c')](saveUpdates(_0x12ca13[_0x4516('0x66')],null))[_0x4516('0x1c')](respondWithResult(_0x3dfe2d,null))[_0x4516('0x60')](handleError(_0x3dfe2d,null));};exports[_0x4516('0x67')]=function(_0x3f8f6e,_0x4ac1ff){return db[_0x4516('0x44')]['describe']()[_0x4516('0x1c')](respondWithResult(_0x4ac1ff,null))['catch'](handleError(_0x4ac1ff,null));};exports['addContacts']=function(_0x18864f,_0x3588c0,_0x1f6861){return db['User'][_0x4516('0x3d')]({'where':{'id':_0x18864f[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x3588c0,null))[_0x4516('0x1c')](function(_0x52979d){if(_0x52979d){return _0x52979d['addContacts'](_0x18864f[_0x4516('0x66')]['ids'],_[_0x4516('0x68')](_0x18864f[_0x4516('0x66')],[_0x4516('0x69'),'id'])||{});}})['then'](respondWithResult(_0x3588c0,null))[_0x4516('0x60')](handleError(_0x3588c0,null));};var getLicense=function(_0xccfa05){return new BPromise(function(_0x394fc8,_0x311fbf){var _0xc6bb1a=0x0;_0xccfa05['body'][_0x4516('0x3e')]===_0x4516('0x36')&&_0x394fc8(_0x4516('0x6a'));return db[_0x4516('0x44')][_0x4516('0x2b')]({'where':{'$or':[{'role':_0xccfa05['body']['role']==='telephone'?_0x4516('0x37'):[_0x4516('0x6b'),_0x4516('0x6c')]}]}})[_0x4516('0x1c')](function(_0x62e1d){_0xc6bb1a=_0x62e1d;return require(_0x4516('0x6d'))[_0x4516('0x6e')]();})[_0x4516('0x1c')](function(_0x23038a){var _0x517e0a=_0xccfa05[_0x4516('0x66')][_0x4516('0x3e')]===_0x4516('0x37')?_0x4516('0x6f'):_0x4516('0x70');if(!_['isNil'](_0x23038a[_0x517e0a])&&_0xc6bb1a>=_0x23038a[_0x517e0a]){return _0x311fbf({'message':_0x4516('0x71')});}return _0x394fc8(util[_0x4516('0x72')](_0x4516('0x73'),_0x517e0a,_0xc6bb1a));})[_0x4516('0x60')](function(_0x5bf9cf){return _0x311fbf(_0x5bf9cf);});});};exports['create']=function(_0x438e84,_0x5aed03){return getLicense(_0x438e84)[_0x4516('0x1c')](function(_0x4b18e9){if(!_0x438e84['body'][_0x4516('0x74')]){var _0xe0cba9;return db['Setting']['findById'](0x1)[_0x4516('0x1c')](function(_0x441e22){_0xe0cba9=_0x441e22['min_internal'];return db[_0x4516('0x44')][_0x4516('0x75')](_0x4516('0x74'));})[_0x4516('0x1c')](function(_0x36185e){if(_[_0x4516('0x76')](_0x36185e)){if(_0xe0cba9){_0x438e84[_0x4516('0x66')]['internal']=_0xe0cba9;}else{_0x438e84[_0x4516('0x66')][_0x4516('0x74')]=0x1;}}else{if(_[_0x4516('0x76')](_0xe0cba9)||_0xe0cba9==_0x36185e){_0x438e84[_0x4516('0x66')]['internal']=_0x36185e+0x1;}else if(_0xe0cba9>_0x36185e){_0x438e84[_0x4516('0x66')]['internal']=_0xe0cba9;}else{return db[_0x4516('0x59')][_0x4516('0x4a')](_0x4516('0x77'),{'type':db[_0x4516('0x59')]['QueryTypes']['SELECT']})[_0x4516('0x1c')](function(_0x53ea99){if(_0x53ea99&&_0x53ea99[_0x4516('0x64')]){for(var _0x377eea=0x0,_0x592e9c=_0x53ea99[_0x4516('0x64')];_0x377eea<_0x592e9c&&_[_0x4516('0x76')](_0x438e84['body'][_0x4516('0x74')]);_0x377eea++){if(_0xe0cba9<=_0x53ea99[_0x377eea][_0x4516('0x78')]){_0x438e84['body']['internal']=_0x53ea99[_0x377eea][_0x4516('0x78')];}else if(_0xe0cba9>_0x53ea99[_0x377eea][_0x4516('0x78')]&&_0xe0cba9<=_0x53ea99[_0x377eea]['to']){_0x438e84['body'][_0x4516('0x74')]=_0xe0cba9;}}}if(_[_0x4516('0x76')](_0x438e84[_0x4516('0x66')]['internal'])){_0x438e84[_0x4516('0x66')][_0x4516('0x74')]=_0x36185e+0x1;}});}}});}})[_0x4516('0x1c')](function(){if(_0x438e84[_0x4516('0x66')][_0x4516('0x79')]){_0x438e84[_0x4516('0x66')][_0x4516('0x7a')]=_0x438e84[_0x4516('0x66')]['internal'];_0x438e84[_0x4516('0x66')]['VoiceMail']={'mailbox':_0x438e84[_0x4516('0x66')][_0x4516('0x74')],'password':_0x438e84['body'][_0x4516('0x48')],'fullname':_0x438e84['body']['fullname'],'email':_0x438e84[_0x4516('0x66')][_0x4516('0x7b')]};}if(_0x438e84['body']&&_0x438e84['body'][_0x4516('0x3e')]===_0x4516('0x36')){_0x438e84[_0x4516('0x66')][_0x4516('0x7c')]=[_0x4516('0x7d'),_0x4516('0x7e'),_0x4516('0x7f'),_0x4516('0x80'),'104',_0x4516('0x81'),_0x4516('0x82'),'107','108',_0x4516('0x83'),_0x4516('0x84'),_0x4516('0x85')];}return db[_0x4516('0x44')][_0x4516('0x86')](_0x438e84[_0x4516('0x66')],{'include':[{'model':db['VoiceMail'],'as':_0x4516('0x87')}]});})[_0x4516('0x1c')](function(_0x3b84f7){if(_0x438e84[_0x4516('0x66')][_0x4516('0x3e')]==='user')return _0x3b84f7;var _0x58d017=_0x438e84[_0x4516('0x6c')][_0x4516('0x33')]({'plain':!![]});if(!_0x58d017)throw new Error(_0x4516('0x88'));if(_0x58d017[_0x4516('0x3e')]==='user'){var _0x12ea54=_0x3b84f7[_0x4516('0x33')]({'plain':!![]});var _0x5ede31=[{'name':_0x4516('0x35'),'value':'agent'},{'name':_0x4516('0x89'),'value':'telephone'}];var _0x1d3384=_[_0x4516('0x3d')](_0x5ede31,[_0x4516('0x3b'),_0x12ea54['role']])[_0x4516('0x8a')];return db[_0x4516('0x8b')][_0x4516('0x3d')]({'where':{'name':_0x1d3384,'userProfileId':_0x58d017[_0x4516('0x8c')]},'raw':!![]})[_0x4516('0x1c')](function(_0x166fba){if(_0x166fba&&_0x166fba[_0x4516('0x8d')]===0x0){return db['UserProfileResource'][_0x4516('0x86')]({'name':_0x12ea54[_0x4516('0x8a')],'resourceId':_0x12ea54['id'],'type':_0x166fba[_0x4516('0x8a')],'sectionId':_0x166fba['id']},{})[_0x4516('0x1c')](function(){return _0x3b84f7;});}else{return _0x3b84f7;}})[_0x4516('0x60')](function(_0x1ffa23){logger[_0x4516('0x23')](_0x4516('0x8e'),_0x1ffa23);throw _0x1ffa23;});}return _0x3b84f7;})['then'](respondWithResult(_0x5aed03,0xc9))[_0x4516('0x60')](handleError(_0x5aed03,null));};exports[_0x4516('0x8f')]=function(_0x2c0fb5,_0x161889,_0x3b6c4e){if(_0x2c0fb5[_0x4516('0x66')]['id']){delete _0x2c0fb5[_0x4516('0x66')]['id'];}return db[_0x4516('0x44')]['find']({'where':{'id':_0x2c0fb5[_0x4516('0x62')]['id']}})['then'](function(_0x4d5ca2){if(_0x4d5ca2){if(_0x4d5ca2['id']==_0x2c0fb5[_0x4516('0x6c')]['id']){if(!_0x2c0fb5['body'][_0x4516('0x90')]||!_0x2c0fb5[_0x4516('0x66')][_0x4516('0x91')]){throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x4d5ca2[_0x4516('0x94')](_0x2c0fb5['body'][_0x4516('0x90')])){throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))](_0x4516('0x95'));}if(_0x2c0fb5[_0x4516('0x66')]['oldPassword']==_0x2c0fb5[_0x4516('0x66')][_0x4516('0x91')]){throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x4d5ca2;}else if(_0x2c0fb5[_0x4516('0x6c')][_0x4516('0x3e')]==_0x4516('0x6b')){if(!_0x2c0fb5[_0x4516('0x66')][_0x4516('0x91')]){throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))](_0x4516('0x96'));}return _0x4d5ca2;}else if(_0x2c0fb5['user'][_0x4516('0x3e')]==_0x4516('0x6c')){if(!_0x2c0fb5[_0x4516('0x66')][_0x4516('0x91')]){throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))](_0x4516('0x96'));}if(_0x4d5ca2[_0x4516('0x3e')]!=_0x4516('0x36')){throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))](_0x4516('0x97'));}return _0x4d5ca2;}else{throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))](_0x4516('0x97'));}}return null;})[_0x4516('0x1c')](handleEntityNotFound(_0x161889,null))['then'](saveUpdates({'password':_0x2c0fb5[_0x4516('0x66')][_0x4516('0x91')],'passwordResetAt':_0x2c0fb5[_0x4516('0x6c')]['id']==_0x2c0fb5[_0x4516('0x62')]['id']?moment():null},null))[_0x4516('0x1c')](respondWithResult(_0x161889,null))[_0x4516('0x60')](handleError(_0x161889,null));};exports[_0x4516('0x98')]=function(_0x6e9e14,_0x3bd67c,_0x5e2c74){var _0x2e4223;return db['User'][_0x4516('0x3d')]({'where':{'id':_0x6e9e14[_0x4516('0x62')]['id']},'attributes':['id',_0x4516('0x8a'),_0x4516('0x3e'),_0x4516('0x99'),_0x4516('0x9a'),_0x4516('0x9b')]})[_0x4516('0x1c')](handleEntityNotFound(_0x3bd67c,null))[_0x4516('0x1c')](function(_0xaabccb){if(_0xaabccb){_0x2e4223=_0xaabccb;if(!utils[_0x4516('0x9c')](_0x6e9e14[_0x4516('0x66')][_0x4516('0x9d')])){throw new db['Sequelize'][(_0x4516('0x93'))]('Unknown\x20channel');}return _0xaabccb[_0x4516('0x55')+_['capitalize'](_0x6e9e14['body'][_0x4516('0x9d')]['toLowerCase']())+_0x4516('0x9e')](_0x6e9e14['body'][_0x4516('0x69')],{'penalty':_0x6e9e14['body'][_0x4516('0x9f')]||0x0});}})[_0x4516('0xa0')](function(_0x3ef5ad){for(var _0x3abff2=0x0;_0x3abff2<_0x6e9e14[_0x4516('0x66')][_0x4516('0x69')][_0x4516('0x64')];_0x3abff2+=0x1){var _0x4b511a={'UserId':_0x6e9e14['params']['id']};_0x4b511a[_[_0x4516('0xa1')](_0x6e9e14[_0x4516('0x66')]['channel'][_0x4516('0xa2')]())+'QueueId']=_0x6e9e14[_0x4516('0x66')][_0x4516('0x69')][_0x3abff2];socket[_0x4516('0xa3')](_0x4516('0x6c')+_['capitalize'](_0x6e9e14[_0x4516('0x66')][_0x4516('0x9d')][_0x4516('0xa2')]())+_0x4516('0xa4'),_0x4b511a);}return _0x3ef5ad;})[_0x4516('0x1c')](function(){if(_0x6e9e14[_0x4516('0x66')][_0x4516('0x9d')]==='voice'){return db['VoiceQueue'][_0x4516('0x5e')]({'where':{'id':_0x6e9e14[_0x4516('0x66')]['ids']||[]},'raw':!![],'attributes':['id',_0x4516('0x8a')]});}})[_0x4516('0x1c')](function(_0x34e32e){var _0x1c18a6=[];if(_0x6e9e14[_0x4516('0x66')]['channel']===_0x4516('0xa5')&&_0x2e4223[_0x4516('0x3e')]===_0x4516('0x36')){for(var _0xc73ee1=0x0;_0xc73ee1<_0x34e32e[_0x4516('0x64')];_0xc73ee1+=0x1){_0x1c18a6[_0x4516('0xa6')]({'membername':_0x2e4223[_0x4516('0x8a')],'UserId':_0x2e4223['id'],'queue_name':_0x34e32e[_0xc73ee1][_0x4516('0x8a')],'VoiceQueueId':_0x34e32e[_0xc73ee1]['id'],'interface':_[_0x4516('0x76')](_0x2e4223[_0x4516('0x9b')])?util[_0x4516('0x72')](_0x4516('0xa7'),_0x2e4223[_0x4516('0x8a')]):_0x2e4223[_0x4516('0x9b')],'paused':_0x2e4223['voicePause']||![],'penalty':_0x6e9e14[_0x4516('0x66')]['penalty']||0x0});}return BPromise['each'](_0x1c18a6,function(_0x310c4c){return db[_0x4516('0xa8')][_0x4516('0xa9')](_0x310c4c);});}return _0x2e4223;})[_0x4516('0x1c')](respondWithStatusCode(_0x3bd67c,null))[_0x4516('0x60')](handleError(_0x3bd67c,null));};exports[_0x4516('0xaa')]=function(_0x19ee6b,_0x4ecdcb,_0x3be838){var _0x2be4b8;return db[_0x4516('0x44')][_0x4516('0x3d')]({'where':{'id':_0x19ee6b[_0x4516('0x62')]['id']},'attributes':['id',_0x4516('0x8a'),_0x4516('0x3e')]})[_0x4516('0x1c')](handleEntityNotFound(_0x4ecdcb,null))[_0x4516('0x1c')](function(_0x4e82e1){if(_0x4e82e1){_0x2be4b8=_0x4e82e1;if(!_0x19ee6b[_0x4516('0x4a')]['channel']||!utils[_0x4516('0x9c')](_0x19ee6b[_0x4516('0x4a')]['channel'])){throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))](_0x4516('0xab'));}return _0x4e82e1[_0x4516('0xac')+_[_0x4516('0xa1')](_0x19ee6b[_0x4516('0x4a')]['channel'][_0x4516('0xa2')]())+_0x4516('0x9e')](_0x19ee6b[_0x4516('0x4a')][_0x4516('0x69')]);}})['then'](function(_0x2851c5){for(var _0x4e2f8c=0x0;_0x4e2f8c<_0x19ee6b[_0x4516('0x4a')][_0x4516('0x69')][_0x4516('0x64')];_0x4e2f8c+=0x1){var _0x57dc91={'UserId':_0x19ee6b['params']['id']};_0x57dc91[_[_0x4516('0xa1')](_0x19ee6b[_0x4516('0x4a')][_0x4516('0x9d')]['toLowerCase']())+_0x4516('0xad')]=_0x19ee6b['query']['ids'][_0x4e2f8c];socket[_0x4516('0xa3')]('user'+_[_0x4516('0xa1')](_0x19ee6b['query'][_0x4516('0x9d')][_0x4516('0xa2')]())+_0x4516('0xae'),_0x57dc91);}return _0x2851c5;})['then'](function(){if(_0x19ee6b['query'][_0x4516('0x9d')]==='voice'){return db[_0x4516('0xa8')][_0x4516('0x40')]({'where':{'UserId':_0x19ee6b[_0x4516('0x62')]['id'],'VoiceQueueId':_0x19ee6b[_0x4516('0x4a')]['ids']},'individualHooks':!![]})['then'](function(){return _0x2be4b8;});}return _0x2be4b8;})[_0x4516('0x1c')](respondWithStatusCode(_0x4ecdcb,null))['catch'](handleError(_0x4ecdcb,null));};exports[_0x4516('0xaf')]=function(_0x93d7d1,_0x4f4aaa,_0x59164e){_0x93d7d1[_0x4516('0x66')]['userpic']=_0x93d7d1[_0x4516('0xb0')][_0x4516('0xb1')];return db[_0x4516('0x44')]['find']({'where':{'id':_0x93d7d1[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x4f4aaa,null))[_0x4516('0x1c')](saveUpdates(_0x93d7d1[_0x4516('0x66')],null))[_0x4516('0x1c')](respondWithResult(_0x4f4aaa,null))['catch'](handleError(_0x4f4aaa,null));};exports[_0x4516('0xb2')]=function(_0x3a7743,_0x1415a6,_0x160c26){var _0xe33e8e=path[_0x4516('0xb3')](config[_0x4516('0xb4')],'server/files/images/logos/default_profile.png');return db[_0x4516('0x44')][_0x4516('0x3d')]({'where':{'id':_0x3a7743['params']['id']},'attributes':['id',_0x4516('0xb5')],'raw':!![]})[_0x4516('0x1c')](handleEntityNotFound(_0x1415a6,null))[_0x4516('0x1c')](function(_0x5a4133){if(_0x5a4133){if(_[_0x4516('0x76')](_0x5a4133[_0x4516('0xb5')])){return _0x1415a6[_0x4516('0xb6')](_0xe33e8e);}else{if(!fs[_0x4516('0xb7')](path[_0x4516('0xb3')](config[_0x4516('0xb4')],'server/files/images/',_0x5a4133['userpic']))){return _0x1415a6['download'](_0xe33e8e);}return _0x1415a6[_0x4516('0xb6')](path[_0x4516('0xb3')](config[_0x4516('0xb4')],_0x4516('0xb8'),_0x5a4133[_0x4516('0xb5')]));}}})[_0x4516('0x60')](handleError(_0x1415a6,null));};exports[_0x4516('0xb9')]=function(_0x47c623,_0x46867c,_0x530fb5){var _0x27a06a={};var _0x404f02={};var _0x2cba6d;var _0x3dd516;return db[_0x4516('0x44')][_0x4516('0xba')]({'where':{'id':_0x47c623[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x46867c,null))[_0x4516('0x1c')](function(_0x41f3a2){if(_0x41f3a2){_0x2cba6d=_0x41f3a2;_0x404f02[_0x4516('0x46')]=_[_0x4516('0x47')](db[_0x4516('0xbb')][_0x4516('0x45')]);_0x404f02[_0x4516('0x4a')]=_['keys'](_0x47c623[_0x4516('0x4a')]);_0x404f02[_0x4516('0x4c')]=_['intersection'](_0x404f02[_0x4516('0x46')],_0x404f02[_0x4516('0x4a')]);_0x27a06a['attributes']=_[_0x4516('0x4d')](_0x404f02[_0x4516('0x46')],qs[_0x4516('0x4f')](_0x47c623[_0x4516('0x4a')][_0x4516('0x4f')]));_0x27a06a[_0x4516('0x4e')]=_0x27a06a['attributes'][_0x4516('0x64')]?_0x27a06a['attributes']:_0x404f02[_0x4516('0x46')];_0x27a06a[_0x4516('0x51')]=qs[_0x4516('0x52')](_0x47c623[_0x4516('0x4a')]['sort']);_0x27a06a['where']=qs['filters'](_[_0x4516('0xbc')](_0x47c623['query'],_0x404f02[_0x4516('0x4c')]));if(_0x47c623[_0x4516('0x4a')][_0x4516('0x38')]){_0x27a06a[_0x4516('0x53')]=_[_0x4516('0x57')](_0x27a06a[_0x4516('0x53')],{'$or':_[_0x4516('0x3a')](_0x27a06a['attributes'],function(_0x5c1831){var _0x3091db={};_0x3091db[_0x5c1831]={'$like':'%'+_0x47c623[_0x4516('0x4a')]['filter']+'%'};return _0x3091db;})});}_0x27a06a=_[_0x4516('0x57')]({},_0x27a06a,_0x47c623['options']);return _0x2cba6d['getContacts'](_0x27a06a);}})[_0x4516('0x1c')](function(_0x34cdda){if(_0x34cdda){_0x3dd516=_0x34cdda[_0x4516('0x64')];if(_0x47c623['query']['hasOwnProperty']('includeAll')){_0x27a06a['include']=[{'model':db[_0x4516('0xbd')],'as':_0x4516('0xbe'),'required':![]},{'model':db[_0x4516('0xbf')],'as':'Tags','attributes':['id',_0x4516('0x8a'),_0x4516('0xc0')],'where':_0x47c623[_0x4516('0x4a')]['tag']?{'id':_0x47c623[_0x4516('0x4a')][_0x4516('0xc1')]}:undefined,'required':_0x47c623[_0x4516('0x4a')][_0x4516('0xc1')]?!![]:![]}];}if(!_0x47c623[_0x4516('0x4a')][_0x4516('0x50')](_0x4516('0xc2'))){_0x27a06a['limit']=qs[_0x4516('0x2d')](_0x47c623[_0x4516('0x4a')][_0x4516('0x2d')]);_0x27a06a[_0x4516('0x2c')]=qs[_0x4516('0x2c')](_0x47c623[_0x4516('0x4a')]['offset']);}return _0x2cba6d[_0x4516('0xb9')](_0x27a06a);}})[_0x4516('0x1c')](function(_0x106117){if(_0x106117){return _0x106117?{'count':_0x3dd516,'rows':_0x106117}:null;}})[_0x4516('0x1c')](respondWithResult(_0x46867c,null))['catch'](handleError(_0x46867c,null));};exports['getQueues']=function(_0x5f327c,_0x3f5a54,_0x197de6){var _0x2a5dbc;var _0x19b06e;var _0x20fc49={};var _0x20620d;return db[_0x4516('0x44')]['findOne']({'where':{'id':_0x5f327c['params']['id']},'attributes':['id',_0x4516('0x8a'),_0x4516('0x3e')]})[_0x4516('0x1c')](handleEntityNotFound(_0x3f5a54,null))[_0x4516('0x1c')](function(_0x4e5976){if(!utils[_0x4516('0x9c')](_0x5f327c[_0x4516('0x4a')][_0x4516('0x9d')])){throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))](_0x4516('0xab'));}_0x2a5dbc=_0x4e5976;var _0x153167={};_0x153167[_0x4516('0x46')]=_['keys'](db[_['capitalize'](_0x5f327c[_0x4516('0x4a')][_0x4516('0x9d')])+_0x4516('0xc3')][_0x4516('0x45')]);_0x153167[_0x4516('0x4a')]=_[_0x4516('0x47')](_0x5f327c[_0x4516('0x4a')]);_0x153167[_0x4516('0x4c')]=_[_0x4516('0x4d')](_0x153167[_0x4516('0x46')],_0x153167[_0x4516('0x4a')]);_0x20fc49[_0x4516('0x4e')]=_[_0x4516('0x4d')](_0x153167[_0x4516('0x46')],qs[_0x4516('0x4f')](_0x5f327c[_0x4516('0x4a')]['fields']));_0x20fc49['attributes']=_0x20fc49[_0x4516('0x4e')]['length']?_0x20fc49[_0x4516('0x4e')]:_0x153167[_0x4516('0x46')];_0x20fc49[_0x4516('0x51')]=qs[_0x4516('0x52')](_0x5f327c['query']['sort']);_0x20fc49[_0x4516('0x53')]=qs[_0x4516('0x4c')](_[_0x4516('0xbc')](_0x5f327c[_0x4516('0x4a')],_0x153167[_0x4516('0x4c')]));if(_0x5f327c['query'][_0x4516('0x38')]){_0x20fc49['where']=_[_0x4516('0x57')](_0x20fc49[_0x4516('0x53')],{'$or':_[_0x4516('0x3a')](_0x20fc49[_0x4516('0x4e')],function(_0x587246){var _0x21edb3={};_0x21edb3[_0x587246]={'$like':'%'+_0x5f327c[_0x4516('0x4a')][_0x4516('0x38')]+'%'};return _0x21edb3;})});}_0x20fc49=_[_0x4516('0x57')]({},_0x20fc49,_0x5f327c['options']);switch(_0x2a5dbc[_0x4516('0x3e')]){case _0x4516('0x6b'):return db[_[_0x4516('0xa1')](_0x5f327c[_0x4516('0x4a')][_0x4516('0x9d')])+_0x4516('0xc3')][_0x4516('0x5e')](_0x20fc49);case _0x4516('0x6c'):case _0x4516('0x36'):return _0x2a5dbc[_0x4516('0x33')+_['capitalize'](_0x5f327c[_0x4516('0x4a')][_0x4516('0x9d')])+_0x4516('0x9e')](_0x20fc49);default:throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))]('Unknown\x20role');}})[_0x4516('0x1c')](function(_0x239856){_0x20620d=_0x239856[_0x4516('0x64')];if(!_0x5f327c['query']['hasOwnProperty'](_0x4516('0xc2'))){_0x20fc49['limit']=qs[_0x4516('0x2d')](_0x5f327c[_0x4516('0x4a')][_0x4516('0x2d')]);_0x20fc49['offset']=qs[_0x4516('0x2c')](_0x5f327c[_0x4516('0x4a')][_0x4516('0x2c')]);}switch(_0x2a5dbc[_0x4516('0x3e')]){case _0x4516('0x6b'):return db[_[_0x4516('0xa1')](_0x5f327c[_0x4516('0x4a')]['channel'])+_0x4516('0xc3')][_0x4516('0x5e')](_0x20fc49);case _0x4516('0x6c'):case _0x4516('0x36'):return _0x2a5dbc[_0x4516('0x33')+_['capitalize'](_0x5f327c[_0x4516('0x4a')][_0x4516('0x9d')])+_0x4516('0x9e')](_0x20fc49);}})[_0x4516('0x1c')](function(_0xb469bd){return{'count':_0x20620d,'rows':_0xb469bd};})['then'](respondWithResult(_0x3f5a54,null))[_0x4516('0x60')](handleError(_0x3f5a54,null));};exports['getVoiceQueuesRt']=function(_0x5ebea6,_0x393b7d,_0x31481e){var _0x2b6b0c={};var _0x2b788b={};var _0x3bc70e;var _0x265c7d;return db[_0x4516('0x44')][_0x4516('0xba')]({'where':{'id':_0x5ebea6['params']['id']}})['then'](handleEntityNotFound(_0x393b7d,null))[_0x4516('0x1c')](function(_0x3bec15){if(_0x3bec15){_0x3bc70e=_0x3bec15;_0x2b788b[_0x4516('0x46')]=_[_0x4516('0x47')](db[_0x4516('0xa8')][_0x4516('0x45')]);_0x2b788b[_0x4516('0x4a')]=_[_0x4516('0x47')](_0x5ebea6[_0x4516('0x4a')]);_0x2b788b[_0x4516('0x4c')]=_[_0x4516('0x4d')](_0x2b788b['model'],_0x2b788b[_0x4516('0x4a')]);_0x2b6b0c['attributes']=_[_0x4516('0x4d')](_0x2b788b[_0x4516('0x46')],qs[_0x4516('0x4f')](_0x5ebea6['query']['fields']));_0x2b6b0c[_0x4516('0x4e')]=_0x2b6b0c[_0x4516('0x4e')][_0x4516('0x64')]?_0x2b6b0c[_0x4516('0x4e')]:_0x2b788b[_0x4516('0x46')];_0x2b6b0c['order']=qs[_0x4516('0x52')](_0x5ebea6[_0x4516('0x4a')][_0x4516('0x52')]);_0x2b6b0c[_0x4516('0x53')]=qs[_0x4516('0x4c')](_[_0x4516('0xbc')](_0x5ebea6['query'],_0x2b788b[_0x4516('0x4c')]));if(_0x5ebea6[_0x4516('0x4a')]['filter']){_0x2b6b0c['where']=_[_0x4516('0x57')](_0x2b6b0c[_0x4516('0x53')],{'$or':_[_0x4516('0x3a')](_0x2b6b0c[_0x4516('0x4e')],function(_0x40f7b3){var _0x34c321={};_0x34c321[_0x40f7b3]={'$like':'%'+_0x5ebea6[_0x4516('0x4a')][_0x4516('0x38')]+'%'};return _0x34c321;})});}_0x2b6b0c=_[_0x4516('0x57')]({},_0x2b6b0c,_0x5ebea6[_0x4516('0x5b')]);return _0x3bc70e[_0x4516('0xc4')](_0x2b6b0c);}})[_0x4516('0x1c')](function(_0x5c696a){if(_0x5c696a){_0x265c7d=_0x5c696a[_0x4516('0x64')];if(!_0x5ebea6[_0x4516('0x4a')][_0x4516('0x50')]('nolimit')){_0x2b6b0c[_0x4516('0x2d')]=qs[_0x4516('0x2d')](_0x5ebea6[_0x4516('0x4a')][_0x4516('0x2d')]);_0x2b6b0c['offset']=qs[_0x4516('0x2c')](_0x5ebea6[_0x4516('0x4a')][_0x4516('0x2c')]);}return _0x3bc70e[_0x4516('0xc4')](_0x2b6b0c);}})[_0x4516('0x1c')](function(_0x5b80c1){if(_0x5b80c1){return _0x5b80c1?{'count':_0x265c7d,'rows':_0x5b80c1}:null;}})[_0x4516('0x1c')](respondWithResult(_0x393b7d,null))[_0x4516('0x60')](handleError(_0x393b7d,null));};exports[_0x4516('0xc5')]=function(_0x27222b,_0x235eb6,_0x1929f7){var _0x1bf5b6={};var _0x1e9971={};var _0x2331e9;var _0xcfd629;return db[_0x4516('0x44')][_0x4516('0xba')]({'where':{'id':_0x27222b[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x235eb6,null))[_0x4516('0x1c')](function(_0xd11ab){if(_0xd11ab){_0x2331e9=_0xd11ab;_0x1e9971[_0x4516('0x46')]=_['keys'](db[_0x4516('0xc6')][_0x4516('0x45')]);_0x1e9971[_0x4516('0x4a')]=_['keys'](_0x27222b[_0x4516('0x4a')]);_0x1e9971[_0x4516('0x4c')]=_[_0x4516('0x4d')](_0x1e9971[_0x4516('0x46')],_0x1e9971[_0x4516('0x4a')]);_0x1bf5b6[_0x4516('0x4e')]=_['intersection'](_0x1e9971[_0x4516('0x46')],qs[_0x4516('0x4f')](_0x27222b[_0x4516('0x4a')][_0x4516('0x4f')]));_0x1bf5b6[_0x4516('0x4e')]=_0x1bf5b6[_0x4516('0x4e')][_0x4516('0x64')]?_0x1bf5b6[_0x4516('0x4e')]:_0x1e9971[_0x4516('0x46')];_0x1bf5b6['order']=qs[_0x4516('0x52')](_0x27222b['query'][_0x4516('0x52')]);_0x1bf5b6['where']=qs[_0x4516('0x4c')](_['pick'](_0x27222b[_0x4516('0x4a')],_0x1e9971[_0x4516('0x4c')]));if(_0x27222b[_0x4516('0x4a')][_0x4516('0x38')]){_0x1bf5b6[_0x4516('0x53')]=_['merge'](_0x1bf5b6['where'],{'$or':_[_0x4516('0x3a')](_0x1bf5b6[_0x4516('0x4e')],function(_0xd79932){var _0x2265e7={};_0x2265e7[_0xd79932]={'$like':'%'+_0x27222b['query']['filter']+'%'};return _0x2265e7;})});}_0x1bf5b6=_[_0x4516('0x57')]({},_0x1bf5b6,_0x27222b[_0x4516('0x5b')]);return _0x2331e9[_0x4516('0xc5')](_0x1bf5b6);}})[_0x4516('0x1c')](function(_0x1d973a){if(_0x1d973a){_0xcfd629=_0x1d973a[_0x4516('0x64')];if(!_0x27222b[_0x4516('0x4a')][_0x4516('0x50')](_0x4516('0xc2'))){_0x1bf5b6[_0x4516('0x2d')]=qs[_0x4516('0x2d')](_0x27222b['query'][_0x4516('0x2d')]);_0x1bf5b6[_0x4516('0x2c')]=qs[_0x4516('0x2c')](_0x27222b[_0x4516('0x4a')]['offset']);}return _0x2331e9[_0x4516('0xc5')](_0x1bf5b6);}})['then'](function(_0x248773){if(_0x248773){return _0x248773?{'count':_0xcfd629,'rows':_0x248773}:null;}})[_0x4516('0x1c')](respondWithResult(_0x235eb6,null))['catch'](handleError(_0x235eb6,null));};exports[_0x4516('0xc7')]=function(_0x51488e,_0x37651e,_0x14e59f){var _0x254593={'raw':!![],'where':{}};var _0x2eace6={};var _0x201673={'count':0x0,'rows':[]};return db[_0x4516('0x44')][_0x4516('0xba')]({'where':{'id':_0x51488e[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x37651e,null))[_0x4516('0x1c')](function(_0x4b4a1c){if(_0x4b4a1c){_0x2eace6[_0x4516('0x46')]=_['keys'](db[_0x4516('0xc8')][_0x4516('0x45')]);_0x2eace6[_0x4516('0x4a')]=_['keys'](_0x51488e[_0x4516('0x4a')]);_0x2eace6[_0x4516('0x4c')]=_[_0x4516('0x4d')](_0x2eace6[_0x4516('0x46')],_0x2eace6['query']);_0x254593[_0x4516('0x4e')]=_[_0x4516('0x4d')](_0x2eace6[_0x4516('0x46')],qs[_0x4516('0x4f')](_0x51488e[_0x4516('0x4a')][_0x4516('0x4f')]));_0x254593[_0x4516('0x4e')]=_0x254593[_0x4516('0x4e')][_0x4516('0x64')]?_0x254593['attributes']:_0x2eace6[_0x4516('0x46')];if(!_0x51488e[_0x4516('0x4a')][_0x4516('0x50')](_0x4516('0xc2'))){_0x254593['limit']=qs[_0x4516('0x2d')](_0x51488e[_0x4516('0x4a')][_0x4516('0x2d')]);_0x254593[_0x4516('0x2c')]=qs[_0x4516('0x2c')](_0x51488e[_0x4516('0x4a')]['offset']);}_0x254593['order']=qs[_0x4516('0x52')](_0x51488e[_0x4516('0x4a')]['sort']);_0x254593[_0x4516('0x53')]=qs['filters'](_[_0x4516('0xbc')](_0x51488e[_0x4516('0x4a')],_0x2eace6[_0x4516('0x4c')]));_0x254593[_0x4516('0x53')][_0x4516('0xc9')]=_0x4b4a1c['id'];if(_0x51488e[_0x4516('0x4a')][_0x4516('0x38')]){_0x254593[_0x4516('0x53')]=_[_0x4516('0x57')](_0x254593['where'],{'$or':_[_0x4516('0x3a')](_0x254593[_0x4516('0x4e')],function(_0x15c053){var _0x5a5892={};_0x5a5892[_0x15c053]={'$like':'%'+_0x51488e[_0x4516('0x4a')][_0x4516('0x38')]+'%'};return _0x5a5892;})});}_0x254593=_[_0x4516('0x57')]({},_0x254593,_0x51488e[_0x4516('0x5b')]);return db[_0x4516('0xc8')][_0x4516('0x2b')]({'where':_0x254593[_0x4516('0x53')]})[_0x4516('0x1c')](function(_0x17915b){_0x201673['count']=_0x17915b;if(_0x51488e['query'][_0x4516('0x5c')]){_0x254593[_0x4516('0x5d')]=[{'all':!![]}];}return db[_0x4516('0xc8')][_0x4516('0x5e')](_0x254593);})['then'](function(_0x37755c){_0x201673['rows']=_0x37755c;return _0x201673;});}})[_0x4516('0x1c')](respondWithFilteredResult(_0x37651e,_0x254593))[_0x4516('0x60')](handleError(_0x37651e,null));};exports['getChatInteractions']=function(_0x45a90a,_0x5ef36e,_0x565b49){var _0x3df861={};var _0x3bb385={};var _0x423f3f;var _0x12455a;return db[_0x4516('0x44')][_0x4516('0xba')]({'where':{'id':_0x45a90a[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x5ef36e,null))[_0x4516('0x1c')](function(_0x2effa){if(_0x2effa){_0x423f3f=_0x2effa;_0x3bb385['model']=_[_0x4516('0x47')](db[_0x4516('0xca')]['rawAttributes']);_0x3bb385[_0x4516('0x4a')]=_[_0x4516('0x47')](_0x45a90a[_0x4516('0x4a')]);_0x3bb385[_0x4516('0x4c')]=_[_0x4516('0x4d')](_0x3bb385['model'],_0x3bb385[_0x4516('0x4a')]);_0x3df861[_0x4516('0x4e')]=_[_0x4516('0x4d')](_0x3bb385[_0x4516('0x46')],qs[_0x4516('0x4f')](_0x45a90a['query']['fields']));_0x3df861[_0x4516('0x4e')]=_0x3df861[_0x4516('0x4e')][_0x4516('0x64')]?_0x3df861[_0x4516('0x4e')]:_0x3bb385['model'];_0x3df861[_0x4516('0x51')]=qs[_0x4516('0x52')](_0x45a90a[_0x4516('0x4a')][_0x4516('0x52')]);_0x3df861[_0x4516('0x53')]=qs['filters'](_[_0x4516('0xbc')](_0x45a90a[_0x4516('0x4a')],_0x3bb385[_0x4516('0x4c')]));if(_0x45a90a[_0x4516('0x4a')][_0x4516('0x38')]){_0x3df861[_0x4516('0x53')]=_[_0x4516('0x57')](_0x3df861[_0x4516('0x53')],{'$or':_[_0x4516('0x3a')](_0x3df861[_0x4516('0x4e')],function(_0x20b5fb){var _0x374a7f={};_0x374a7f[_0x20b5fb]={'$like':'%'+_0x45a90a[_0x4516('0x4a')][_0x4516('0x38')]+'%'};return _0x374a7f;})});}_0x3df861=_[_0x4516('0x57')]({},_0x3df861,_0x45a90a[_0x4516('0x5b')]);return _0x423f3f[_0x4516('0xcb')](_0x3df861);}})['then'](function(_0x4d4c76){if(_0x4d4c76){_0x12455a=_0x4d4c76[_0x4516('0x64')];if(!_0x45a90a[_0x4516('0x4a')]['hasOwnProperty'](_0x4516('0xc2'))){_0x3df861[_0x4516('0x2d')]=qs['limit'](_0x45a90a['query'][_0x4516('0x2d')]);_0x3df861[_0x4516('0x2c')]=qs[_0x4516('0x2c')](_0x45a90a[_0x4516('0x4a')][_0x4516('0x2c')]);}return _0x423f3f[_0x4516('0xcb')](_0x3df861);}})[_0x4516('0x1c')](function(_0x4e479a){if(_0x4e479a){return _0x4e479a?{'count':_0x12455a,'rows':_0x4e479a}:null;}})[_0x4516('0x1c')](respondWithResult(_0x5ef36e,null))['catch'](handleError(_0x5ef36e,null));};exports['getOpenchannelInteractions']=function(_0x4627c9,_0x4e6dd2,_0x279d14){var _0x5be739={};var _0x4c25f3={};var _0x1ee38e;var _0x5dbc5b;return db['User']['findOne']({'where':{'id':_0x4627c9[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x4e6dd2,null))[_0x4516('0x1c')](function(_0x4e6f2d){if(_0x4e6f2d){_0x1ee38e=_0x4e6f2d;_0x4c25f3[_0x4516('0x46')]=_[_0x4516('0x47')](db[_0x4516('0xcc')][_0x4516('0x45')]);_0x4c25f3[_0x4516('0x4a')]=_['keys'](_0x4627c9[_0x4516('0x4a')]);_0x4c25f3[_0x4516('0x4c')]=_[_0x4516('0x4d')](_0x4c25f3['model'],_0x4c25f3[_0x4516('0x4a')]);_0x5be739[_0x4516('0x4e')]=_['intersection'](_0x4c25f3[_0x4516('0x46')],qs[_0x4516('0x4f')](_0x4627c9[_0x4516('0x4a')][_0x4516('0x4f')]));_0x5be739[_0x4516('0x4e')]=_0x5be739[_0x4516('0x4e')]['length']?_0x5be739[_0x4516('0x4e')]:_0x4c25f3[_0x4516('0x46')];_0x5be739['order']=qs[_0x4516('0x52')](_0x4627c9[_0x4516('0x4a')][_0x4516('0x52')]);_0x5be739[_0x4516('0x53')]=qs[_0x4516('0x4c')](_[_0x4516('0xbc')](_0x4627c9[_0x4516('0x4a')],_0x4c25f3[_0x4516('0x4c')]));if(_0x4627c9[_0x4516('0x4a')]['filter']){_0x5be739[_0x4516('0x53')]=_[_0x4516('0x57')](_0x5be739[_0x4516('0x53')],{'$or':_[_0x4516('0x3a')](_0x5be739[_0x4516('0x4e')],function(_0x10e5bc){var _0x5695cc={};_0x5695cc[_0x10e5bc]={'$like':'%'+_0x4627c9[_0x4516('0x4a')][_0x4516('0x38')]+'%'};return _0x5695cc;})});}_0x5be739=_['merge']({},_0x5be739,_0x4627c9[_0x4516('0x5b')]);return _0x1ee38e[_0x4516('0xcd')](_0x5be739);}})[_0x4516('0x1c')](function(_0x8f189c){if(_0x8f189c){_0x5dbc5b=_0x8f189c[_0x4516('0x64')];if(!_0x4627c9[_0x4516('0x4a')][_0x4516('0x50')](_0x4516('0xc2'))){_0x5be739[_0x4516('0x2d')]=qs[_0x4516('0x2d')](_0x4627c9['query'][_0x4516('0x2d')]);_0x5be739[_0x4516('0x2c')]=qs[_0x4516('0x2c')](_0x4627c9[_0x4516('0x4a')][_0x4516('0x2c')]);}return _0x1ee38e[_0x4516('0xcd')](_0x5be739);}})[_0x4516('0x1c')](function(_0x5b025e){if(_0x5b025e){return _0x5b025e?{'count':_0x5dbc5b,'rows':_0x5b025e}:null;}})[_0x4516('0x1c')](respondWithResult(_0x4e6dd2,null))[_0x4516('0x60')](handleError(_0x4e6dd2,null));};exports[_0x4516('0xce')]=function(_0x4723b4,_0x54ac16,_0x4dc66b){var _0x415f21={'raw':!![],'where':{}};var _0x4bbe1d={};var _0x22873f={'count':0x0,'rows':[]};return db[_0x4516('0x44')][_0x4516('0xba')]({'where':{'id':_0x4723b4[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x54ac16,null))[_0x4516('0x1c')](function(_0x1d5579){if(_0x1d5579){_0x4bbe1d[_0x4516('0x46')]=_[_0x4516('0x47')](db[_0x4516('0xcf')][_0x4516('0x45')]);_0x4bbe1d[_0x4516('0x4a')]=_[_0x4516('0x47')](_0x4723b4[_0x4516('0x4a')]);_0x4bbe1d[_0x4516('0x4c')]=_['intersection'](_0x4bbe1d['model'],_0x4bbe1d[_0x4516('0x4a')]);_0x415f21[_0x4516('0x4e')]=_[_0x4516('0x4d')](_0x4bbe1d['model'],qs[_0x4516('0x4f')](_0x4723b4['query'][_0x4516('0x4f')]));_0x415f21[_0x4516('0x4e')]=_0x415f21['attributes']['length']?_0x415f21[_0x4516('0x4e')]:_0x4bbe1d[_0x4516('0x46')];if(!_0x4723b4[_0x4516('0x4a')][_0x4516('0x50')](_0x4516('0xc2'))){_0x415f21[_0x4516('0x2d')]=qs['limit'](_0x4723b4[_0x4516('0x4a')]['limit']);_0x415f21[_0x4516('0x2c')]=qs[_0x4516('0x2c')](_0x4723b4['query'][_0x4516('0x2c')]);}_0x415f21[_0x4516('0x51')]=qs[_0x4516('0x52')](_0x4723b4['query'][_0x4516('0x52')]);_0x415f21[_0x4516('0x53')]=qs['filters'](_[_0x4516('0xbc')](_0x4723b4[_0x4516('0x4a')],_0x4bbe1d[_0x4516('0x4c')]));_0x415f21[_0x4516('0x53')]['UserId']=_0x1d5579['id'];if(_0x4723b4['query'][_0x4516('0x38')]){_0x415f21[_0x4516('0x53')]=_[_0x4516('0x57')](_0x415f21[_0x4516('0x53')],{'$or':_['map'](_0x415f21[_0x4516('0x4e')],function(_0x5bc423){var _0x55f02b={};_0x55f02b[_0x5bc423]={'$like':'%'+_0x4723b4['query'][_0x4516('0x38')]+'%'};return _0x55f02b;})});}_0x415f21=_[_0x4516('0x57')]({},_0x415f21,_0x4723b4['options']);return db[_0x4516('0xcf')]['count']({'where':_0x415f21[_0x4516('0x53')]})[_0x4516('0x1c')](function(_0x1f779d){_0x22873f[_0x4516('0x2b')]=_0x1f779d;if(_0x4723b4[_0x4516('0x4a')][_0x4516('0x5c')]){_0x415f21[_0x4516('0x5d')]=[{'all':!![]}];}return db[_0x4516('0xcf')][_0x4516('0x5e')](_0x415f21);})['then'](function(_0x25149e){_0x22873f[_0x4516('0x5f')]=_0x25149e;return _0x22873f;});}})[_0x4516('0x1c')](respondWithFilteredResult(_0x54ac16,_0x415f21))['catch'](handleError(_0x54ac16,null));};exports[_0x4516('0xd0')]=function(_0x12538c,_0x2f1097,_0x394e46){var _0x42c20e={};var _0x277415={};var _0x19d050;var _0x7b235c;return db['User'][_0x4516('0xba')]({'where':{'id':_0x12538c[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x2f1097,null))['then'](function(_0x5da850){if(_0x5da850){_0x19d050=_0x5da850;_0x277415[_0x4516('0x46')]=_[_0x4516('0x47')](db[_0x4516('0xd1')][_0x4516('0x45')]);_0x277415['query']=_[_0x4516('0x47')](_0x12538c['query']);_0x277415[_0x4516('0x4c')]=_['intersection'](_0x277415[_0x4516('0x46')],_0x277415[_0x4516('0x4a')]);_0x42c20e[_0x4516('0x4e')]=_[_0x4516('0x4d')](_0x277415[_0x4516('0x46')],qs['fields'](_0x12538c['query'][_0x4516('0x4f')]));_0x42c20e[_0x4516('0x4e')]=_0x42c20e[_0x4516('0x4e')][_0x4516('0x64')]?_0x42c20e[_0x4516('0x4e')]:_0x277415['model'];_0x42c20e[_0x4516('0x51')]=qs[_0x4516('0x52')](_0x12538c[_0x4516('0x4a')]['sort']);_0x42c20e[_0x4516('0x53')]=qs[_0x4516('0x4c')](_[_0x4516('0xbc')](_0x12538c[_0x4516('0x4a')],_0x277415[_0x4516('0x4c')]));if(_0x12538c['query'][_0x4516('0x38')]){_0x42c20e[_0x4516('0x53')]=_['merge'](_0x42c20e[_0x4516('0x53')],{'$or':_[_0x4516('0x3a')](_0x42c20e[_0x4516('0x4e')],function(_0x5b444f){var _0x14bb2e={};_0x14bb2e[_0x5b444f]={'$like':'%'+_0x12538c[_0x4516('0x4a')][_0x4516('0x38')]+'%'};return _0x14bb2e;})});}_0x42c20e=_['merge']({},_0x42c20e,_0x12538c[_0x4516('0x5b')]);return _0x19d050[_0x4516('0xd0')](_0x42c20e);}})[_0x4516('0x1c')](function(_0x491b85){if(_0x491b85){_0x7b235c=_0x491b85[_0x4516('0x64')];if(!_0x12538c[_0x4516('0x4a')]['hasOwnProperty'](_0x4516('0xc2'))){_0x42c20e[_0x4516('0x2d')]=qs[_0x4516('0x2d')](_0x12538c[_0x4516('0x4a')][_0x4516('0x2d')]);_0x42c20e[_0x4516('0x2c')]=qs[_0x4516('0x2c')](_0x12538c[_0x4516('0x4a')][_0x4516('0x2c')]);}return _0x19d050[_0x4516('0xd0')](_0x42c20e);}})[_0x4516('0x1c')](function(_0x2b19f3){if(_0x2b19f3){return _0x2b19f3?{'count':_0x7b235c,'rows':_0x2b19f3}:null;}})[_0x4516('0x1c')](respondWithResult(_0x2f1097,null))[_0x4516('0x60')](handleError(_0x2f1097,null));};exports[_0x4516('0xd2')]=function(_0x2956c5,_0x2e385a,_0x342443){var _0x5af51b={};var _0x3d5830={};var _0x445933;var _0x20196a;return db[_0x4516('0x44')][_0x4516('0xba')]({'where':{'id':_0x2956c5[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x2e385a,null))[_0x4516('0x1c')](function(_0x1b9887){if(_0x1b9887){_0x445933=_0x1b9887;_0x3d5830['model']=_['keys'](db[_0x4516('0xd3')]['rawAttributes']);_0x3d5830['query']=_['keys'](_0x2956c5[_0x4516('0x4a')]);_0x3d5830['filters']=_[_0x4516('0x4d')](_0x3d5830[_0x4516('0x46')],_0x3d5830[_0x4516('0x4a')]);_0x5af51b[_0x4516('0x4e')]=_[_0x4516('0x4d')](_0x3d5830[_0x4516('0x46')],qs['fields'](_0x2956c5['query'][_0x4516('0x4f')]));_0x5af51b[_0x4516('0x4e')]=_0x5af51b['attributes'][_0x4516('0x64')]?_0x5af51b['attributes']:_0x3d5830['model'];_0x5af51b[_0x4516('0x51')]=qs[_0x4516('0x52')](_0x2956c5[_0x4516('0x4a')]['sort']);_0x5af51b[_0x4516('0x53')]=qs['filters'](_[_0x4516('0xbc')](_0x2956c5['query'],_0x3d5830[_0x4516('0x4c')]));if(_0x2956c5['query'][_0x4516('0x38')]){_0x5af51b[_0x4516('0x53')]=_[_0x4516('0x57')](_0x5af51b[_0x4516('0x53')],{'$or':_[_0x4516('0x3a')](_0x5af51b[_0x4516('0x4e')],function(_0x5164b5){var _0x3f0175={};_0x3f0175[_0x5164b5]={'$like':'%'+_0x2956c5[_0x4516('0x4a')][_0x4516('0x38')]+'%'};return _0x3f0175;})});}_0x5af51b=_[_0x4516('0x57')]({},_0x5af51b,_0x2956c5[_0x4516('0x5b')]);return _0x445933['getFaxInteractions'](_0x5af51b);}})[_0x4516('0x1c')](function(_0x412291){if(_0x412291){_0x20196a=_0x412291['length'];if(!_0x2956c5['query']['hasOwnProperty'](_0x4516('0xc2'))){_0x5af51b[_0x4516('0x2d')]=qs[_0x4516('0x2d')](_0x2956c5[_0x4516('0x4a')][_0x4516('0x2d')]);_0x5af51b[_0x4516('0x2c')]=qs['offset'](_0x2956c5['query'][_0x4516('0x2c')]);}return _0x445933['getFaxInteractions'](_0x5af51b);}})[_0x4516('0x1c')](function(_0x7691f9){if(_0x7691f9){return _0x7691f9?{'count':_0x20196a,'rows':_0x7691f9}:null;}})[_0x4516('0x1c')](respondWithResult(_0x2e385a,null))[_0x4516('0x60')](handleError(_0x2e385a,null));};exports[_0x4516('0xd4')]=function(_0x137400,_0x29b436,_0xf27ae0){var _0x328d5e;var _0x3d0aec;var _0x25578b;return db[_0x4516('0x44')][_0x4516('0x3d')]({'where':{'id':_0x137400[_0x4516('0x62')]['id'],'role':'agent'},'attributes':['id',_0x4516('0x8a'),_0x4516('0xd5'),'mobile',_0x4516('0x3e'),_0x4516('0x74'),_0x4516('0x99')]})[_0x4516('0x1c')](handleEntityNotFound(_0x29b436,null))[_0x4516('0x1c')](function(_0x4e711e){if(_0x4e711e){_0x328d5e=_0x4e711e;if(_0x137400['body'][_0x4516('0x9b')]){_0x25578b=util['format'](_0x4516('0xd6'),_0x328d5e[_0x137400['body']['interface']]);}else if(_0x137400[_0x4516('0x66')][_0x4516('0xd7')]){_0x25578b=util[_0x4516('0x72')](_0x4516('0xa7'),_0x137400[_0x4516('0x66')]['intrf']);}else{_0x25578b=util['format'](_0x4516('0xa7'),_0x328d5e['name']);}socket['to'](util['format'](_0x4516('0xd8'),_0x328d5e['name']))[_0x4516('0xa3')](_0x4516('0xd9'),{'ip':_0x137400[_0x4516('0xda')][_0x4516('0xdb')]||_0x137400[_0x4516('0xdc')]['remoteAddress']||_0x137400[_0x4516('0xdd')][_0x4516('0xde')]||_0x137400[_0x4516('0xdc')][_0x4516('0xdd')][_0x4516('0xde')]});return db['UserVoiceQueueRt'][_0x4516('0x40')]({'where':{'membername':_0x328d5e[_0x4516('0x8a')]},'individualHooks':!![]});}})[_0x4516('0x1c')](function(_0x5488c3){if(_0x328d5e){return _0x328d5e[_0x4516('0xdf')]({'raw':!![]});}})[_0x4516('0x1c')](function(_0x5c2ed7){var _0x5e8556=[];if(_0x5c2ed7){_0x3d0aec=_0x5c2ed7;if(_0x3d0aec['length']){for(var _0x4fe91c=0x0;_0x4fe91c<_0x3d0aec[_0x4516('0x64')];_0x4fe91c++){_0x5e8556[_0x4516('0xa6')]({'membername':_0x328d5e[_0x4516('0x8a')],'UserId':_0x328d5e['id'],'queue_name':_0x3d0aec[_0x4fe91c][_0x4516('0x8a')],'VoiceQueueId':_0x3d0aec[_0x4fe91c]['id'],'interface':_0x25578b,'paused':_0x328d5e[_0x4516('0x99')]||![],'penalty':_0x3d0aec[_0x4fe91c][_0x4516('0xe0')]||0x0});}return BPromise[_0x4516('0xe1')](_0x5e8556,function(_0x53d8e2){return db[_0x4516('0xa8')][_0x4516('0xa9')](_0x53d8e2);});}}})[_0x4516('0x1c')](function(){return db[_0x4516('0xe2')][_0x4516('0x5e')]({'where':{'membername':_0x328d5e[_0x4516('0x8a')],'exitAt':null}});})[_0x4516('0x1c')](function(_0x5c1e2b){var _0x31e1a3=[];_0x5c1e2b[_0x4516('0xe3')](function(_0x1540d5){_0x31e1a3[_0x4516('0xa6')](_0x1540d5['update']({'exitAt':moment()[_0x4516('0x72')](_0x4516('0xe4'))}));});return BPromise[_0x4516('0xe5')](_0x31e1a3);})[_0x4516('0x1c')](function(){var _0x3360b1=[];var _0x2566d7=[];var _0x442bad=utils[_0x4516('0xe6')]();var _0x4ec3c7={'membername':_0x328d5e[_0x4516('0x8a')],'interface':_0x25578b,'enterAt':moment()['format'](_0x4516('0xe4')),'role':_0x328d5e[_0x4516('0x3e')],'internal':_0x328d5e[_0x4516('0x74')]};_0x442bad['forEach'](function(_0x3547b1){_0x3360b1[_0x4516('0xa6')](_['merge']({'channel':_0x3547b1,'type':_0x4516('0xe7'),'data1':_0x137400[_0x4516('0x66')][_0x4516('0xe8')],'data2':_0x25578b},_0x4ec3c7));if(_0x328d5e[_0x4516('0x99')]){_0x2566d7['push'](_[_0x4516('0x57')]({'channel':_0x3547b1,'type':_0x4516('0xe9'),'data1':'LOGININPAUSE'},_0x4ec3c7));}});return db[_0x4516('0xe2')][_0x4516('0x65')](_0x3360b1[_0x4516('0xea')](_0x2566d7),{'individualHooks':!![]});})[_0x4516('0x1c')](function(){return _0x328d5e[_0x4516('0x32')]({'online':!![],'lastLoginAt':moment()[_0x4516('0x72')](_0x4516('0xe4')),'voicePause':_0x328d5e['loginInPause']||![],'mailPause':_0x328d5e[_0x4516('0x99')]||![],'chatPause':_0x328d5e[_0x4516('0x99')]||![],'faxPause':_0x328d5e[_0x4516('0x99')]||![],'smsPause':_0x328d5e[_0x4516('0x99')]||![],'openchannelPause':_0x328d5e[_0x4516('0x99')]||![],'pauseType':_0x328d5e[_0x4516('0x99')]?_0x4516('0xeb'):null,'interface':_0x25578b,'lastPauseAt':moment()[_0x4516('0x72')](_0x4516('0xe4'))});})[_0x4516('0x1c')](respondWithResult(_0x29b436,null))['catch'](handleError(_0x29b436,null));};exports[_0x4516('0xec')]=function(_0x12255f,_0x10c18f,_0x2f1560){var _0x5ed034;return db[_0x4516('0x44')][_0x4516('0x3d')]({'where':{'id':_0x12255f[_0x4516('0x62')]['id'],'role':_0x4516('0x36')},'attributes':['id','name',_0x4516('0x3e')]})[_0x4516('0x1c')](handleEntityNotFound(_0x10c18f,null))[_0x4516('0x1c')](function(_0x3c9267){if(_0x3c9267){_0x5ed034=_0x3c9267;return db['UserVoiceQueueRt'][_0x4516('0x40')]({'where':{'membername':_0x5ed034[_0x4516('0x8a')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x4516('0x5e')]({'where':{'membername':_0x5ed034[_0x4516('0x8a')],'exitAt':null}});})[_0x4516('0x1c')](function(_0x51b429){var _0x132211=[];_0x51b429[_0x4516('0xe3')](function(_0x2db703){_0x132211[_0x4516('0xa6')](_0x2db703[_0x4516('0x32')]({'exitAt':moment()[_0x4516('0x72')](_0x4516('0xe4'))}));});return BPromise[_0x4516('0xe5')](_0x132211);})[_0x4516('0x1c')](function(){return _0x5ed034[_0x4516('0x32')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0x4516('0x1c')](respondWithResult(_0x10c18f,null))[_0x4516('0x60')](handleError(_0x10c18f,null));};exports[_0x4516('0xed')]=function(_0xbc5774,_0x2d0821,_0x2d2030){var _0x3707eb;return db[_0x4516('0xa8')][_0x4516('0x32')]({'paused':0x1},{'where':{'UserId':_0xbc5774[_0x4516('0x62')]['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0x4516('0x3d')]({'where':{'id':_0xbc5774[_0x4516('0x62')]['id'],'role':_0x4516('0x36')},'attributes':['id',_0x4516('0x8a'),_0x4516('0x3e'),'internal',_0x4516('0x9b')]});})['then'](handleEntityNotFound(_0x2d0821,null))[_0x4516('0x1c')](function(_0x5a9c92){if(_0x5a9c92){_0x3707eb=_0x5a9c92;return respondWithRpcPromise('QueuePause','pause',{'id':_0x3707eb['id'],'name':_0x3707eb[_0x4516('0x8a')],'pause':!![]});}})['then'](function(){if(_0x3707eb){return db[_0x4516('0xe2')][_0x4516('0x5e')]({'where':{'membername':_0x3707eb[_0x4516('0x8a')],'type':_0x4516('0xe9'),'exitAt':null}});}})['then'](function(_0x4a57c3){if(_0x4a57c3[_0x4516('0x64')]){var _0x5f4652=moment()[_0x4516('0x72')](_0x4516('0xe4'));for(var _0x5ae5e0=0x0,_0x3a0551=_0x4a57c3['length'];_0x5ae5e0<_0x3a0551;_0x5ae5e0++){_0x4a57c3[_0x5ae5e0][_0x4516('0xee')]({'exitAt':_0x5f4652});}}})['then'](function(){var _0x327af5=[];var _0x3f37ec=utils[_0x4516('0xe6')]();_0x3f37ec['forEach'](function(_0x28f141){_0x327af5[_0x4516('0xa6')]({'channel':_0x28f141,'membername':_0x3707eb['name'],'interface':_[_0x4516('0x76')](_0x3707eb['interface'])?util[_0x4516('0x72')](_0x4516('0xa7'),_0x3707eb['name']):_0x3707eb[_0x4516('0x9b')],'type':'PAUSE','enterAt':moment()[_0x4516('0x72')](_0x4516('0xe4')),'data1':_0xbc5774[_0x4516('0x66')][_0x4516('0xef')]||_0x4516('0xf0'),'role':_0x3707eb[_0x4516('0x3e')],'internal':_0x3707eb[_0x4516('0x74')]});});return db[_0x4516('0xe2')][_0x4516('0x65')](_0x327af5,{'individualHooks':!![]});})[_0x4516('0x1c')](function(){return _0x3707eb[_0x4516('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0xbc5774[_0x4516('0x66')]['type']||_0x4516('0xf0'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x2d0821,null))[_0x4516('0x60')](handleError(_0x2d0821,null));};exports[_0x4516('0xf1')]=function(_0x20edd5,_0x56a7ad,_0x256e52){var _0x5c1179;return db['User'][_0x4516('0x3d')]({'where':{'id':_0x20edd5[_0x4516('0x62')]['id']},'attributes':['id',_0x4516('0x8a'),_0x4516('0x3e'),'voicePause',_0x4516('0xf2'),'chatPause',_0x4516('0xf3'),_0x4516('0xf4'),_0x4516('0xf5'),_0x4516('0xf6'),_0x4516('0xf7')]})[_0x4516('0x1c')](handleEntityNotFound(_0x56a7ad,null))[_0x4516('0x1c')](function(_0x3d5bb6){if(_0x3d5bb6){_0x5c1179=_0x3d5bb6;if(_0x20edd5[_0x4516('0x66')][_0x4516('0x9d')]&&!utils[_0x4516('0x9c')](_0x20edd5[_0x4516('0x66')]['channel'])){throw new db[(_0x4516('0x92'))][(_0x4516('0x93'))]('Unknown\x20channel');}switch(_0x20edd5['body'][_0x4516('0x9d')]){case _0x4516('0xa5'):return respondWithRpcPromise('QueuePause',_0x4516('0xf1'),{'id':_0x5c1179['id'],'name':_0x5c1179[_0x4516('0x8a')],'pause':![]})[_0x4516('0x1c')](function(){return db['UserVoiceQueueRt'][_0x4516('0x32')]({'paused':0x0},{'where':{'UserId':_0x5c1179['id']},'individualHooks':!![]});})[_0x4516('0x1c')](function(){return db[_0x4516('0xe2')]['find']({'where':{'channel':_0x20edd5[_0x4516('0x66')]['channel'],'membername':_0x5c1179[_0x4516('0x8a')],'type':_0x4516('0xe9'),'exitAt':null}});})[_0x4516('0x1c')](function(_0x403ca3){if(_0x403ca3){return _0x403ca3[_0x4516('0x32')]({'exitAt':moment()['format'](_0x4516('0xe4')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x4516('0x1c')](function(){return _0x5c1179['update']({'voicePause':![]});});case _0x4516('0xf8'):case'chat':case'fax':case _0x4516('0xf9'):case'openchannel':return db[_0x4516('0xe2')]['find']({'where':{'channel':_0x20edd5[_0x4516('0x66')][_0x4516('0x9d')],'membername':_0x5c1179[_0x4516('0x8a')],'type':_0x4516('0xe9'),'exitAt':null}})['then'](function(_0x41901c){if(_0x41901c){return _0x41901c[_0x4516('0x32')]({'exitAt':moment()[_0x4516('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x4516('0xfa')},{'individualHooks':!![]});}return null;})[_0x4516('0x1c')](function(){var _0x30a880={};_[_0x4516('0x2e')](_0x30a880,util['format'](_0x4516('0xfb'),_0x20edd5[_0x4516('0x66')][_0x4516('0x9d')],_0x4516('0xfc')),![]);return _0x5c1179[_0x4516('0x32')](_0x30a880);});default:return respondWithRpcPromise(_0x4516('0xfd'),'unpause',{'id':_0x5c1179['id'],'name':_0x5c1179[_0x4516('0x8a')],'pause':![]})[_0x4516('0x1c')](function(){return db[_0x4516('0xa8')][_0x4516('0x32')]({'paused':0x0},{'where':{'UserId':_0x5c1179['id']}});})[_0x4516('0x1c')](function(){return db[_0x4516('0xe2')][_0x4516('0x5e')]({'where':{'membername':_0x5c1179[_0x4516('0x8a')],'type':'PAUSE','exitAt':null}});})[_0x4516('0x1c')](function(_0x3674bc){var _0x4e21cb=[];_0x3674bc[_0x4516('0xe3')](function(_0x2b9ef2){_0x4e21cb[_0x4516('0xa6')](_0x2b9ef2[_0x4516('0x32')]({'exitAt':moment()[_0x4516('0x72')](_0x4516('0xe4')),'data2':'manual'}));});return BPromise[_0x4516('0xe5')](_0x4e21cb);})[_0x4516('0x1c')](function(){return _0x5c1179[_0x4516('0x32')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x56a7ad,null))[_0x4516('0x60')](handleError(_0x56a7ad,null));};exports[_0x4516('0xfe')]=function(_0x3c5cbb,_0x417f4c,_0x9a0e83){var _0x55cc9f={};var _0x36d312={};var _0x3adf25;var _0x5002ce;return db[_0x4516('0x44')]['findOne']({'where':{'id':_0x3c5cbb[_0x4516('0x62')]['id']}})['then'](handleEntityNotFound(_0x417f4c,null))[_0x4516('0x1c')](function(_0x24cad4){if(_0x24cad4){_0x3adf25=_0x24cad4;_0x36d312['model']=_[_0x4516('0x47')](db[_0x4516('0xff')][_0x4516('0x45')]);_0x36d312[_0x4516('0x4a')]=_['keys'](_0x3c5cbb[_0x4516('0x4a')]);_0x36d312['filters']=_[_0x4516('0x4d')](_0x36d312[_0x4516('0x46')],_0x36d312['query']);_0x55cc9f['attributes']=_['intersection'](_0x36d312[_0x4516('0x46')],qs['fields'](_0x3c5cbb['query']['fields']));_0x55cc9f['attributes']=_0x55cc9f[_0x4516('0x4e')][_0x4516('0x64')]?_0x55cc9f[_0x4516('0x4e')]:_0x36d312[_0x4516('0x46')];_0x55cc9f[_0x4516('0x51')]=qs[_0x4516('0x52')](_0x3c5cbb[_0x4516('0x4a')][_0x4516('0x52')]);_0x55cc9f[_0x4516('0x53')]=qs['filters'](_['pick'](_0x3c5cbb['query'],_0x36d312[_0x4516('0x4c')]));if(_0x3c5cbb[_0x4516('0x4a')][_0x4516('0x38')]){_0x55cc9f[_0x4516('0x53')]=_[_0x4516('0x57')](_0x55cc9f[_0x4516('0x53')],{'$or':_[_0x4516('0x3a')](_0x55cc9f[_0x4516('0x4e')],function(_0x19fe80){var _0xc4bac1={};_0xc4bac1[_0x19fe80]={'$like':'%'+_0x3c5cbb[_0x4516('0x4a')][_0x4516('0x38')]+'%'};return _0xc4bac1;})});}_0x55cc9f=_[_0x4516('0x57')]({},_0x55cc9f,_0x3c5cbb[_0x4516('0x5b')]);return _0x3adf25[_0x4516('0xfe')](_0x55cc9f);}})[_0x4516('0x1c')](function(_0x56c612){if(_0x56c612){_0x5002ce=_0x56c612[_0x4516('0x64')];if(!_0x3c5cbb[_0x4516('0x4a')][_0x4516('0x50')](_0x4516('0xc2'))){_0x55cc9f[_0x4516('0x2d')]=qs[_0x4516('0x2d')](_0x3c5cbb[_0x4516('0x4a')][_0x4516('0x2d')]);_0x55cc9f[_0x4516('0x2c')]=qs[_0x4516('0x2c')](_0x3c5cbb[_0x4516('0x4a')]['offset']);}return _0x3adf25['getTeams'](_0x55cc9f);}})[_0x4516('0x1c')](function(_0x2ad886){if(_0x2ad886){return _0x2ad886?{'count':_0x5002ce,'rows':_0x2ad886}:null;}})[_0x4516('0x1c')](respondWithResult(_0x417f4c,null))['catch'](handleError(_0x417f4c,null));};exports['addTeams']=function(_0x35e15b,_0x5da100,_0x383f7e){return db[_0x4516('0x44')]['find']({'where':{'id':_0x35e15b[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x5da100,null))[_0x4516('0x1c')](function(_0x32895e){if(_0x32895e){return _0x32895e[_0x4516('0x100')](_0x35e15b['body'][_0x4516('0x69')],_[_0x4516('0x68')](_0x35e15b[_0x4516('0x66')],[_0x4516('0x69'),'id'])||{});}})[_0x4516('0x1c')](respondWithResult(_0x5da100,null))['catch'](handleError(_0x5da100,null));};exports['removeTeams']=function(_0xe26af9,_0x32c14a,_0x24a141){var _0x105929;return db[_0x4516('0x44')][_0x4516('0x3d')]({'where':{'id':_0xe26af9[_0x4516('0x62')]['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x32c14a,null))[_0x4516('0x1c')](function(_0x5c1a13){if(_0x5c1a13){return _0x5c1a13[_0x4516('0x101')](_0xe26af9[_0x4516('0x4a')][_0x4516('0x69')]);}})[_0x4516('0x1c')](respondWithStatusCode(_0x32c14a,null))[_0x4516('0x60')](handleError(_0x32c14a,null));};exports[_0x4516('0x102')]=function(_0x9b8208,_0x493370,_0x505e7f){var _0x190cd6={};var _0x50fc27={};var _0x131ff3;var _0x3d2ad0;return db['User'][_0x4516('0xba')]({'where':{'id':_0x9b8208[_0x4516('0x62')]['id']}})['then'](handleEntityNotFound(_0x493370,null))[_0x4516('0x1c')](function(_0x15a6e1){if(_0x15a6e1){_0x131ff3=_0x15a6e1;_0x50fc27[_0x4516('0x46')]=_[_0x4516('0x47')](db[_0x4516('0xbd')][_0x4516('0x45')]);_0x50fc27['query']=_[_0x4516('0x47')](_0x9b8208[_0x4516('0x4a')]);_0x50fc27[_0x4516('0x4c')]=_[_0x4516('0x4d')](_0x50fc27['model'],_0x50fc27[_0x4516('0x4a')]);_0x190cd6[_0x4516('0x4e')]=_['intersection'](_0x50fc27[_0x4516('0x46')],qs[_0x4516('0x4f')](_0x9b8208[_0x4516('0x4a')][_0x4516('0x4f')]));_0x190cd6[_0x4516('0x4e')]=_0x190cd6[_0x4516('0x4e')][_0x4516('0x64')]?_0x190cd6[_0x4516('0x4e')]:_0x50fc27[_0x4516('0x46')];_0x190cd6['order']=qs[_0x4516('0x52')](_0x9b8208[_0x4516('0x4a')][_0x4516('0x52')]);_0x190cd6[_0x4516('0x53')]=qs[_0x4516('0x4c')](_[_0x4516('0xbc')](_0x9b8208[_0x4516('0x4a')],_0x50fc27[_0x4516('0x4c')]));if(_0x9b8208['query'][_0x4516('0x38')]){_0x190cd6[_0x4516('0x53')]=_['merge'](_0x190cd6['where'],{'$or':_[_0x4516('0x3a')](_0x190cd6[_0x4516('0x4e')],function(_0x1ea53a){var _0x574872={};_0x574872[_0x1ea53a]={'$like':'%'+_0x9b8208[_0x4516('0x4a')][_0x4516('0x38')]+'%'};return _0x574872;})});}_0x190cd6=_['merge']({},_0x190cd6,_0x9b8208['options']);return _0x131ff3[_0x4516('0x102')](_0x190cd6);}})['then'](function(_0x53b41e){if(_0x53b41e){_0x3d2ad0=_0x53b41e[_0x4516('0x64')];if(!_0x9b8208[_0x4516('0x4a')]['hasOwnProperty'](_0x4516('0xc2'))){_0x190cd6['limit']=qs[_0x4516('0x2d')](_0x9b8208[_0x4516('0x4a')][_0x4516('0x2d')]);_0x190cd6[_0x4516('0x2c')]=qs[_0x4516('0x2c')](_0x9b8208[_0x4516('0x4a')][_0x4516('0x2c')]);}return _0x131ff3[_0x4516('0x102')](_0x190cd6);}})[_0x4516('0x1c')](function(_0x34322d){if(_0x34322d){return _0x34322d?{'count':_0x3d2ad0,'rows':_0x34322d}:null;}})['then'](respondWithResult(_0x493370,null))[_0x4516('0x60')](handleError(_0x493370,null));};exports['getAgents']=function(_0x54a2ee,_0x2e7815,_0x3dd1fb){var _0x10d1aa={};var _0x215f81={};var _0x20f692;var _0x3789fb;return db[_0x4516('0x44')][_0x4516('0xba')]({'where':{'id':_0x54a2ee['params']['id']}})[_0x4516('0x1c')](handleEntityNotFound(_0x2e7815,null))[_0x4516('0x1c')](function(_0x2cdeb8){if(_0x2cdeb8){_0x20f692=_0x2cdeb8;_0x215f81[_0x4516('0x46')]=_[_0x4516('0x47')](db[_0x4516('0x44')][_0x4516('0x45')]);_0x215f81['query']=_[_0x4516('0x47')](_0x54a2ee['query']);_0x215f81[_0x4516('0x4c')]=_[_0x4516('0x4d')](_0x215f81[_0x4516('0x46')],_0x215f81[_0x4516('0x4a')]);_0x10d1aa[_0x4516('0x4e')]=_[_0x4516('0x4d')](_0x215f81[_0x4516('0x46')],qs[_0x4516('0x4f')](_0x54a2ee[_0x4516('0x4a')][_0x4516('0x4f')]));_0x10d1aa[_0x4516('0x4e')]=_0x10d1aa[_0x4516('0x4e')][_0x4516('0x64')]?_0x10d1aa[_0x4516('0x4e')]:_0x215f81[_0x4516('0x46')];_0x10d1aa[_0x4516('0x51')]=qs[_0x4516('0x52')](_0x54a2ee[_0x4516('0x4a')][_0x4516('0x52')]);_0x10d1aa['where']=qs['filters'](_[_0x4516('0xbc')](_0x54a2ee[_0x4516('0x4a')],_0x215f81['filters']));if(_0x54a2ee[_0x4516('0x4a')][_0x4516('0x38')]){_0x10d1aa[_0x4516('0x53')]=_[_0x4516('0x57')](_0x10d1aa[_0x4516('0x53')],{'$or':_[_0x4516('0x3a')](_0x10d1aa[_0x4516('0x4e')],function(_0x501289){var _0x4f363f={};_0x4f363f[_0x501289]={'$like':'%'+_0x54a2ee[_0x4516('0x4a')][_0x4516('0x38')]+'%'};return _0x4f363f;})});}_0x10d1aa[_0x4516('0x46')]=db[_0x4516('0x44')];_0x10d1aa['as']=_0x4516('0x35');_0x10d1aa=_['merge']({},_0x10d1aa,_0x54a2ee[_0x4516('0x5b')]);return _0x20f692['getVoiceQueues']({'include':[_0x10d1aa]});}})['then'](function(_0x1da320){if(_0x1da320){var _0x3dcd1e={},_0x5bdd95=[],_0x191bff=0x0;for(var _0x39bf11=0x0;_0x39bf11<_0x1da320[_0x4516('0x64')];_0x39bf11+=0x1){for(var _0x3377ae=0x0,_0x3df1bf;_0x3377ae<_0x1da320[_0x39bf11][_0x4516('0x35')]['length'];_0x3377ae+=0x1){_0x3df1bf=_0x1da320[_0x39bf11][_0x4516('0x35')][_0x3377ae][_0x4516('0x33')]({'plain':!![]});_0x3dcd1e[_0x3df1bf['id']]=_0x3df1bf;}}_0x3dcd1e=_['values'](_0x3dcd1e);for(var _0x13544f=qs[_0x4516('0x2c')](_0x54a2ee[_0x4516('0x4a')][_0x4516('0x2c')]);_0x13544f<_0x3dcd1e['length']&&_0x5bdd95[_0x4516('0x64')]=_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(_0x246f1d,_0x2fd180){var _0x39d41e=function(_0x20ba2a){while(--_0x20ba2a){_0x246f1d['push'](_0x246f1d['shift']());}};_0x39d41e(++_0x2fd180);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a213a,_0x2b4a23){_0x5a213a=_0x5a213a-0x0;var _0x3577b3=_0xb10b[_0x5a213a];return _0x3577b3;};'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 37314e1..36f82f3 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 _0x3e2e=['remove','update','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x4fc2b8,_0x32516a){var _0x5de3ac=function(_0x5e98f0){while(--_0x5e98f0){_0x4fc2b8['push'](_0x4fc2b8['shift']());}};_0x5de3ac(++_0x32516a);}(_0x3e2e,0x142));var _0xe3e2=function(_0x29b42b,_0x21a1e3){_0x29b42b=_0x29b42b-0x0;var _0x4ca35c=_0x3e2e[_0x29b42b];return _0x4ca35c;};'use strict';var UserEvents=require(_0xe3e2('0x0'));var events=[_0xe3e2('0x1'),_0xe3e2('0x2'),_0xe3e2('0x3')];function createListener(_0xe22eff,_0xb04a07){return function(_0xe0770c){_0xb04a07[_0xe3e2('0x4')](_0xe22eff,_0xe0770c);};}function removeListener(_0x599a40,_0x4153f3){return function(){UserEvents[_0xe3e2('0x5')](_0x599a40,_0x4153f3);};}exports[_0xe3e2('0x6')]=function(_0x142f0c){for(var _0x219ba7=0x0,_0x409c22=events[_0xe3e2('0x7')];_0x219ba7<_0x409c22;_0x219ba7++){var _0x40dc1c=events[_0x219ba7];var _0x377f89=createListener(_0xe3e2('0x8')+_0x40dc1c,_0x142f0c);UserEvents['on'](_0x40dc1c,_0x377f89);}}; \ No newline at end of file +var _0x25c3=['remove','emit','length','user:','./user.events'];(function(_0x4073cb,_0x5dad84){var _0x35c408=function(_0x1bd11e){while(--_0x1bd11e){_0x4073cb['push'](_0x4073cb['shift']());}};_0x35c408(++_0x5dad84);}(_0x25c3,0x185));var _0x325c=function(_0x3e65b4,_0x3809bd){_0x3e65b4=_0x3e65b4-0x0;var _0x31f567=_0x25c3[_0x3e65b4];return _0x31f567;};'use strict';var UserEvents=require(_0x325c('0x0'));var events=['save',_0x325c('0x1'),'update'];function createListener(_0x3f3d63,_0x2c1f4f){return function(_0x484371){_0x2c1f4f[_0x325c('0x2')](_0x3f3d63,_0x484371);};}function removeListener(_0x3abab4,_0x3a9747){return function(){UserEvents['removeListener'](_0x3abab4,_0x3a9747);};}exports['register']=function(_0x1cfd02){for(var _0x93612d=0x0,_0x3629b9=events[_0x325c('0x3')];_0x93612d<_0x3629b9;_0x93612d++){var _0x4865a9=events[_0x93612d];var _0x393815=createListener(_0x325c('0x4')+_0x4865a9,_0x1cfd02);UserEvents['on'](_0x4865a9,_0x393815);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index d8db2dc..072a17a 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 _0x9b0d=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x36f66c,_0x24ccd5){_0x36f66c=_0x36f66c-0x0;var _0x480387=_0x9b0d[_0x36f66c];return _0x480387;};'use strict';var multer=require('multer');var util=require(_0xd9b0('0x0'));var path=require(_0xd9b0('0x1'));var timeout=require(_0xd9b0('0x2'));var express=require(_0xd9b0('0x3'));var router=express['Router']();var auth=require(_0xd9b0('0x4'));var interaction=require(_0xd9b0('0x5'));var config=require(_0xd9b0('0x6'));module[_0xd9b0('0x7')]=router; \ No newline at end of file +var _0x9206=['path','connect-timeout','express','Router','../../config/environment','exports','multer','util'];(function(_0x1293d2,_0xf64281){var _0x18d3a3=function(_0x5f3c68){while(--_0x5f3c68){_0x1293d2['push'](_0x1293d2['shift']());}};_0x18d3a3(++_0xf64281);}(_0x9206,0x176));var _0x6920=function(_0x32bef7,_0x35f1b0){_0x32bef7=_0x32bef7-0x0;var _0x474514=_0x9206[_0x32bef7];return _0x474514;};'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'));module[_0x6920('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 1775527..d1f8a79 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 _0x0d38=['exports','INTEGER','sequelize'];(function(_0x1f5c02,_0x2cc183){var _0x186f00=function(_0x2a4823){while(--_0x2a4823){_0x1f5c02['push'](_0x1f5c02['shift']());}};_0x186f00(++_0x2cc183);}(_0x0d38,0x92));var _0x80d3=function(_0x183d84,_0x5a238c){_0x183d84=_0x183d84-0x0;var _0x37e294=_0x0d38[_0x183d84];return _0x37e294;};'use strict';var Sequelize=require(_0x80d3('0x0'));module[_0x80d3('0x1')]={'penalty':{'type':Sequelize[_0x80d3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5ea4=['sequelize'];(function(_0x221e17,_0x550e4e){var _0x5cfa1e=function(_0x58d7eb){while(--_0x58d7eb){_0x221e17['push'](_0x221e17['shift']());}};_0x5cfa1e(++_0x550e4e);}(_0x5ea4,0x1d5));var _0x45ea=function(_0x1d6da3,_0x40ede2){_0x1d6da3=_0x1d6da3-0x0;var _0x2f0971=_0x5ea4[_0x1d6da3];return _0x2f0971;};'use strict';var Sequelize=require(_0x45ea('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index de730a7..750b12e 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 _0x1c3d=['../../config/logger','api','moment','bluebird','exports','define','UserChatQueue','user_has_chat_queues','util'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x2e5a54,_0x402ae0){_0x2e5a54=_0x2e5a54-0x0;var _0x2f8658=_0x1c3d[_0x2e5a54];return _0x2f8658;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var logger=require(_0xd1c3('0x1'))(_0xd1c3('0x2'));var moment=require(_0xd1c3('0x3'));var BPromise=require(_0xd1c3('0x4'));var rp=require('request-promise');var attributes=require('./userChatQueue.attributes');module[_0xd1c3('0x5')]=function(_0x3cc8a4,_0x793c5c){return _0x3cc8a4[_0xd1c3('0x6')](_0xd1c3('0x7'),attributes,{'tableName':_0xd1c3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5713=['./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','api','bluebird','request-promise'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5713,0x1c7));var _0x3571=function(_0xb71fa9,_0x29e8d9){_0xb71fa9=_0xb71fa9-0x0;var _0x3f367a=_0x5713[_0xb71fa9];return _0x3f367a;};'use strict';var _=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var logger=require('../../config/logger')(_0x3571('0x2'));var moment=require('moment');var BPromise=require(_0x3571('0x3'));var rp=require(_0x3571('0x4'));var attributes=require(_0x3571('0x5'));module[_0x3571('0x6')]=function(_0x577a08,_0x4c9017){return _0x577a08[_0x3571('0x7')](_0x3571('0x8'),attributes,{'tableName':_0x3571('0x9'),'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 33b0284..f1358c4 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 _0x0ccc=['then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0ccc,0x90));var _0xc0cc=function(_0x2d7f32,_0x698862){_0x2d7f32=_0x2d7f32-0x0;var _0x3ea589=_0x0ccc[_0x2d7f32];return _0x3ea589;};'use strict';var _=require(_0xc0cc('0x0'));var util=require('util');var moment=require(_0xc0cc('0x1'));var BPromise=require('bluebird');var rs=require(_0xc0cc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc0cc('0x3'));var logger=require(_0xc0cc('0x4'))(_0xc0cc('0x5'));var config=require(_0xc0cc('0x6'));var jayson=require(_0xc0cc('0x7'));var client=jayson[_0xc0cc('0x8')][_0xc0cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cebfe,_0x1dbae7,_0x1f11f3){return new BPromise(function(_0x20c731,_0x547a9d){return client['request'](_0x5cebfe,_0x1f11f3)[_0xc0cc('0xa')](function(_0x5e220a){logger[_0xc0cc('0xb')](_0xc0cc('0xc'),_0x1dbae7,_0xc0cc('0xd'));logger[_0xc0cc('0xe')](_0xc0cc('0xf'),_0x1dbae7,_0xc0cc('0xd'),JSON[_0xc0cc('0x10')](_0x5e220a));if(_0x5e220a['error']){if(_0x5e220a['error'][_0xc0cc('0x11')]===0x1f4){logger[_0xc0cc('0x12')](_0xc0cc('0xc'),_0x1dbae7,_0x5e220a['error']['message']);return _0x547a9d(_0x5e220a['error'][_0xc0cc('0x13')]);}logger['error'](_0xc0cc('0xc'),_0x1dbae7,_0x5e220a[_0xc0cc('0x12')]['message']);return _0x20c731(_0x5e220a[_0xc0cc('0x12')]['message']);}else{logger[_0xc0cc('0xb')](_0xc0cc('0xc'),_0x1dbae7,'request\x20sent');_0x20c731(_0x5e220a[_0xc0cc('0x14')][_0xc0cc('0x13')]);}})[_0xc0cc('0x15')](function(_0x17f24f){logger['error'](_0xc0cc('0xc'),_0x1dbae7,_0x17f24f);_0x547a9d(_0x17f24f);});});} \ No newline at end of file +var _0xac5c=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x1d237a,_0x34aa7f){var _0x2a7a9a=function(_0x44f74b){while(--_0x44f74b){_0x1d237a['push'](_0x1d237a['shift']());}};_0x2a7a9a(++_0x34aa7f);}(_0xac5c,0x10f));var _0xcac5=function(_0x3c8475,_0x2e3ae7){_0x3c8475=_0x3c8475-0x0;var _0x2f70b7=_0xac5c[_0x3c8475];return _0x2f70b7;};'use strict';var _=require(_0xcac5('0x0'));var util=require(_0xcac5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcac5('0x2'));var fs=require('fs');var Redis=require(_0xcac5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcac5('0x4'));var logger=require(_0xcac5('0x5'))(_0xcac5('0x6'));var config=require(_0xcac5('0x7'));var jayson=require(_0xcac5('0x8'));var client=jayson[_0xcac5('0x9')][_0xcac5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b848c,_0xc24d2f,_0x266912){return new BPromise(function(_0x558b35,_0x242574){return client[_0xcac5('0xb')](_0x4b848c,_0x266912)[_0xcac5('0xc')](function(_0x34a5ac){logger[_0xcac5('0xd')]('UserChatQueue,\x20%s,\x20%s',_0xc24d2f,_0xcac5('0xe'));logger[_0xcac5('0xf')](_0xcac5('0x10'),_0xc24d2f,_0xcac5('0xe'),JSON[_0xcac5('0x11')](_0x34a5ac));if(_0x34a5ac['error']){if(_0x34a5ac[_0xcac5('0x12')][_0xcac5('0x13')]===0x1f4){logger['error'](_0xcac5('0x14'),_0xc24d2f,_0x34a5ac['error']['message']);return _0x242574(_0x34a5ac[_0xcac5('0x12')][_0xcac5('0x15')]);}logger[_0xcac5('0x12')](_0xcac5('0x14'),_0xc24d2f,_0x34a5ac['error']['message']);return _0x558b35(_0x34a5ac[_0xcac5('0x12')]['message']);}else{logger[_0xcac5('0xd')](_0xcac5('0x14'),_0xc24d2f,_0xcac5('0xe'));_0x558b35(_0x34a5ac['result'][_0xcac5('0x15')]);}})['catch'](function(_0x44f933){logger[_0xcac5('0x12')](_0xcac5('0x14'),_0xc24d2f,_0x44f933);_0x242574(_0x44f933);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 28a165b..9b77f48 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 _0x1883=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5d672b,_0x28f0e4){var _0x3268fc=function(_0x47aa90){while(--_0x47aa90){_0x5d672b['push'](_0x5d672b['shift']());}};_0x3268fc(++_0x28f0e4);}(_0x1883,0xab));var _0x3188=function(_0x56a1c1,_0x3115c2){_0x56a1c1=_0x56a1c1-0x0;var _0x328820=_0x1883[_0x56a1c1];return _0x328820;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var auth=require(_0x3188('0x6'));var interaction=require(_0x3188('0x7'));var config=require(_0x3188('0x8'));module[_0x3188('0x9')]=router; \ No newline at end of file +var _0x90b1=['../../components/interaction/service','../../config/environment','multer','util','path','Router','../../components/auth/service'];(function(_0x5b37bd,_0x1ba9ef){var _0x572c66=function(_0x29e0e0){while(--_0x29e0e0){_0x5b37bd['push'](_0x5b37bd['shift']());}};_0x572c66(++_0x1ba9ef);}(_0x90b1,0x1bb));var _0x190b=function(_0x253a1a,_0x2cae6d){_0x253a1a=_0x253a1a-0x0;var _0x1c9f74=_0x90b1[_0x253a1a];return _0x1c9f74;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var auth=require(_0x190b('0x4'));var interaction=require(_0x190b('0x5'));var config=require(_0x190b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 36a790a..d21bd5f 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 _0xd7c5=['exports','STRING','sequelize'];(function(_0x35cf12,_0x2ffb85){var _0x44f186=function(_0x3e65a0){while(--_0x3e65a0){_0x35cf12['push'](_0x35cf12['shift']());}};_0x44f186(++_0x2ffb85);}(_0xd7c5,0xdd));var _0x5d7c=function(_0x182d3d,_0x55b672){_0x182d3d=_0x182d3d-0x0;var _0x331e29=_0xd7c5[_0x182d3d];return _0x331e29;};'use strict';var Sequelize=require(_0x5d7c('0x0'));module[_0x5d7c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5d7c('0x2')]}}; \ No newline at end of file +var _0x2054=['exports','INTEGER','STRING','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2054,0x1b3));var _0x4205=function(_0x4036d4,_0x5994ab){_0x4036d4=_0x4036d4-0x0;var _0x3bc2a4=_0x2054[_0x4036d4];return _0x3bc2a4;};'use strict';var Sequelize=require(_0x4205('0x0'));module[_0x4205('0x1')]={'penalty':{'type':Sequelize[_0x4205('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4205('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4205('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5fa9e87..d35d521 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 _0x81bd=['request-promise','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x21383b,_0x5158af){var _0x1e55ed=function(_0x3bbc5d){while(--_0x3bbc5d){_0x21383b['push'](_0x21383b['shift']());}};_0x1e55ed(++_0x5158af);}(_0x81bd,0x7c));var _0xd81b=function(_0x1d0948,_0x29a5ad){_0x1d0948=_0x1d0948-0x0;var _0x405614=_0x81bd[_0x1d0948];return _0x405614;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xd81b('0x7')]=function(_0x2c3d9e,_0x1b6cfe){return _0x2c3d9e['define'](_0xd81b('0x8'),attributes,{'tableName':_0xd81b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae24=['UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','moment','bluebird','exports','define'];(function(_0x4718a9,_0x25fb44){var _0x516234=function(_0x2f621a){while(--_0x2f621a){_0x4718a9['push'](_0x4718a9['shift']());}};_0x516234(++_0x25fb44);}(_0xae24,0x182));var _0x4ae2=function(_0x5663d0,_0x11aaf4){_0x5663d0=_0x5663d0-0x0;var _0x3bb94f=_0xae24[_0x5663d0];return _0x3bb94f;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require('request-promise');var attributes=require('./userFaxQueue.attributes');module[_0x4ae2('0x4')]=function(_0x5b25b5,_0x2ed9ff){return _0x5b25b5[_0x4ae2('0x5')](_0x4ae2('0x6'),attributes,{'tableName':_0x4ae2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 0c8850a..528f692 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 _0x569a=['client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x11be52,_0x2ef4f4){var _0x5b0bf8=function(_0x3659b6){while(--_0x3659b6){_0x11be52['push'](_0x11be52['shift']());}};_0x5b0bf8(++_0x2ef4f4);}(_0x569a,0xe6));var _0xa569=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x569a[_0x43b487];return _0x2f707a;};'use strict';var _=require(_0xa569('0x0'));var util=require(_0xa569('0x1'));var moment=require(_0xa569('0x2'));var BPromise=require(_0xa569('0x3'));var rs=require(_0xa569('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa569('0x5'))['db'];var utils=require(_0xa569('0x6'));var logger=require('../../config/logger')(_0xa569('0x7'));var config=require(_0xa569('0x8'));var jayson=require(_0xa569('0x9'));var client=jayson[_0xa569('0xa')][_0xa569('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x161db7,_0xc82652,_0x5df099){return new BPromise(function(_0x2cb1ea,_0x5d74b2){return client[_0xa569('0xc')](_0x161db7,_0x5df099)['then'](function(_0x26cb99){logger[_0xa569('0xd')](_0xa569('0xe'),_0xc82652,_0xa569('0xf'));logger[_0xa569('0x10')](_0xa569('0x11'),_0xc82652,'request\x20sent',JSON[_0xa569('0x12')](_0x26cb99));if(_0x26cb99[_0xa569('0x13')]){if(_0x26cb99[_0xa569('0x13')][_0xa569('0x14')]===0x1f4){logger[_0xa569('0x13')](_0xa569('0xe'),_0xc82652,_0x26cb99['error'][_0xa569('0x15')]);return _0x5d74b2(_0x26cb99[_0xa569('0x13')][_0xa569('0x15')]);}logger['error'](_0xa569('0xe'),_0xc82652,_0x26cb99[_0xa569('0x13')][_0xa569('0x15')]);return _0x2cb1ea(_0x26cb99[_0xa569('0x13')][_0xa569('0x15')]);}else{logger[_0xa569('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0xc82652,_0xa569('0xf'));_0x2cb1ea(_0x26cb99[_0xa569('0x16')][_0xa569('0x15')]);}})[_0xa569('0x17')](function(_0x24fd3c){logger[_0xa569('0x13')](_0xa569('0xe'),_0xc82652,_0x24fd3c);_0x5d74b2(_0x24fd3c);});});} \ No newline at end of file +var _0x12d7=['UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','request\x20sent','debug'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x12d7,0xda));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x712d('0x0'));var util=require('util');var moment=require(_0x712d('0x1'));var BPromise=require(_0x712d('0x2'));var rs=require(_0x712d('0x3'));var fs=require('fs');var Redis=require(_0x712d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x712d('0x5'));var logger=require(_0x712d('0x6'))('rpc');var config=require(_0x712d('0x7'));var jayson=require(_0x712d('0x8'));var client=jayson['client'][_0x712d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51b809,_0x4993d0,_0x36abd0){return new BPromise(function(_0x4a835d,_0x5393b2){return client['request'](_0x51b809,_0x36abd0)['then'](function(_0x537a89){logger[_0x712d('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x4993d0,_0x712d('0xb'));logger[_0x712d('0xc')](_0x712d('0xd'),_0x4993d0,_0x712d('0xb'),JSON[_0x712d('0xe')](_0x537a89));if(_0x537a89[_0x712d('0xf')]){if(_0x537a89[_0x712d('0xf')][_0x712d('0x10')]===0x1f4){logger['error'](_0x712d('0x11'),_0x4993d0,_0x537a89[_0x712d('0xf')][_0x712d('0x12')]);return _0x5393b2(_0x537a89[_0x712d('0xf')][_0x712d('0x12')]);}logger[_0x712d('0xf')](_0x712d('0x11'),_0x4993d0,_0x537a89['error']['message']);return _0x4a835d(_0x537a89[_0x712d('0xf')][_0x712d('0x12')]);}else{logger['info'](_0x712d('0x11'),_0x4993d0,_0x712d('0xb'));_0x4a835d(_0x537a89[_0x712d('0x13')][_0x712d('0x12')]);}})[_0x712d('0x14')](function(_0x6efb0e){logger[_0x712d('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x4993d0,_0x6efb0e);_0x5393b2(_0x6efb0e);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 875eb65..f5ac75c 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 _0x61f1=['express','Router','../../config/environment','exports','util','connect-timeout'];(function(_0x1183ce,_0x41a94f){var _0x5e8fcc=function(_0x4f1e9d){while(--_0x4f1e9d){_0x1183ce['push'](_0x1183ce['shift']());}};_0x5e8fcc(++_0x41a94f);}(_0x61f1,0x18a));var _0x161f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x161f('0x0'));var path=require('path');var timeout=require(_0x161f('0x1'));var express=require(_0x161f('0x2'));var router=express[_0x161f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x161f('0x4'));module[_0x161f('0x5')]=router; \ No newline at end of file +var _0x323f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','connect-timeout'];(function(_0x24c139,_0x5230c9){var _0x414ef3=function(_0x3e94da){while(--_0x3e94da){_0x24c139['push'](_0x24c139['shift']());}};_0x414ef3(++_0x5230c9);}(_0x323f,0x1ee));var _0xf323=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x323f[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var auth=require(_0xf323('0x4'));var interaction=require(_0xf323('0x5'));var config=require(_0xf323('0x6'));module[_0xf323('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 6ad5d5d..0ac0ef5 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 _0xfb35=['sequelize','exports'];(function(_0x4641c1,_0x32a95d){var _0x5016e2=function(_0x2e469a){while(--_0x2e469a){_0x4641c1['push'](_0x4641c1['shift']());}};_0x5016e2(++_0x32a95d);}(_0xfb35,0x100));var _0x5fb3=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0xfb35[_0x3718b7];return _0xf8c91e;};'use strict';var Sequelize=require(_0x5fb3('0x0'));module[_0x5fb3('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x03c0=['exports','INTEGER','sequelize'];(function(_0x22ad2c,_0x200556){var _0x53ffa7=function(_0x19fca3){while(--_0x19fca3){_0x22ad2c['push'](_0x22ad2c['shift']());}};_0x53ffa7(++_0x200556);}(_0x03c0,0xf2));var _0x003c=function(_0xa6ace7,_0x2100c){_0xa6ace7=_0xa6ace7-0x0;var _0x440f0=_0x03c0[_0xa6ace7];return _0x440f0;};'use strict';var Sequelize=require(_0x003c('0x0'));module[_0x003c('0x1')]={'penalty':{'type':Sequelize[_0x003c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 530f169..465b4e8 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 _0x032e=['util','../../config/logger','api','moment','bluebird','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x34de81,_0x5522f7){var _0x1d61a7=function(_0x4ed87e){while(--_0x4ed87e){_0x34de81['push'](_0x34de81['shift']());}};_0x1d61a7(++_0x5522f7);}(_0x032e,0x1cc));var _0xe032=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x032e[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require(_0xe032('0x0'));var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require(_0xe032('0x3'));var BPromise=require(_0xe032('0x4'));var rp=require('request-promise');var attributes=require(_0xe032('0x5'));module[_0xe032('0x6')]=function(_0x3d33f8,_0x15430e){return _0x3d33f8[_0xe032('0x7')](_0xe032('0x8'),attributes,{'tableName':_0xe032('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b0e=['../../config/logger','api','moment','bluebird','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util'];(function(_0x55c847,_0x5370dc){var _0x823fc2=function(_0x966663){while(--_0x966663){_0x55c847['push'](_0x55c847['shift']());}};_0x823fc2(++_0x5370dc);}(_0x8b0e,0x166));var _0xe8b0=function(_0x4fabbe,_0xc514f3){_0x4fabbe=_0x4fabbe-0x0;var _0x5510dd=_0x8b0e[_0x4fabbe];return _0x5510dd;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var logger=require(_0xe8b0('0x2'))(_0xe8b0('0x3'));var moment=require(_0xe8b0('0x4'));var BPromise=require(_0xe8b0('0x5'));var rp=require('request-promise');var attributes=require(_0xe8b0('0x6'));module['exports']=function(_0x34ccc7,_0x240513){return _0x34ccc7[_0xe8b0('0x7')](_0xe8b0('0x8'),attributes,{'tableName':_0xe8b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 72e1305..a90cd83 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 _0xb43e=['moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x1b7aef,_0x1ee52f){var _0x720060=function(_0x33ae41){while(--_0x33ae41){_0x1b7aef['push'](_0x1b7aef['shift']());}};_0x720060(++_0x1ee52f);}(_0xb43e,0xc6));var _0xeb43=function(_0x17055a,_0x5aa499){_0x17055a=_0x17055a-0x0;var _0xea5e0a=_0xb43e[_0x17055a];return _0xea5e0a;};'use strict';var _=require(_0xeb43('0x0'));var util=require(_0xeb43('0x1'));var moment=require(_0xeb43('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb43('0x3'))['db'];var utils=require(_0xeb43('0x4'));var logger=require(_0xeb43('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb43('0x6'));var client=jayson[_0xeb43('0x7')][_0xeb43('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc9f4b5,_0x275c41,_0x57ffd8){return new BPromise(function(_0x4ddd6f,_0xe95ea6){return client['request'](_0xc9f4b5,_0x57ffd8)[_0xeb43('0x9')](function(_0x36bc18){logger[_0xeb43('0xa')]('UserMailQueue,\x20%s,\x20%s',_0x275c41,_0xeb43('0xb'));logger[_0xeb43('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x275c41,_0xeb43('0xb'),JSON[_0xeb43('0xd')](_0x36bc18));if(_0x36bc18['error']){if(_0x36bc18[_0xeb43('0xe')][_0xeb43('0xf')]===0x1f4){logger['error'](_0xeb43('0x10'),_0x275c41,_0x36bc18[_0xeb43('0xe')][_0xeb43('0x11')]);return _0xe95ea6(_0x36bc18[_0xeb43('0xe')][_0xeb43('0x11')]);}logger[_0xeb43('0xe')](_0xeb43('0x10'),_0x275c41,_0x36bc18['error']['message']);return _0x4ddd6f(_0x36bc18[_0xeb43('0xe')][_0xeb43('0x11')]);}else{logger[_0xeb43('0xa')]('UserMailQueue,\x20%s,\x20%s',_0x275c41,_0xeb43('0xb'));_0x4ddd6f(_0x36bc18[_0xeb43('0x12')][_0xeb43('0x11')]);}})[_0xeb43('0x13')](function(_0x1aaae8){logger[_0xeb43('0xe')](_0xeb43('0x10'),_0x275c41,_0x1aaae8);_0xe95ea6(_0x1aaae8);});});} \ No newline at end of file +var _0x1456=['jayson/promise','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x29e296,_0x533e84){var _0x5c1e33=function(_0x1973ba){while(--_0x1973ba){_0x29e296['push'](_0x29e296['shift']());}};_0x5c1e33(++_0x533e84);}(_0x1456,0x1f1));var _0x6145=function(_0x35cabc,_0xc0f89a){_0x35cabc=_0x35cabc-0x0;var _0x2af2b9=_0x1456[_0x35cabc];return _0x2af2b9;};'use strict';var _=require('lodash');var util=require(_0x6145('0x0'));var moment=require(_0x6145('0x1'));var BPromise=require(_0x6145('0x2'));var rs=require(_0x6145('0x3'));var fs=require('fs');var Redis=require(_0x6145('0x4'));var db=require(_0x6145('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6145('0x6'))(_0x6145('0x7'));var config=require(_0x6145('0x8'));var jayson=require(_0x6145('0x9'));var client=jayson[_0x6145('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa33557,_0x5e5fc0,_0x46193a){return new BPromise(function(_0x4cbcea,_0x1302b8){return client[_0x6145('0xb')](_0xa33557,_0x46193a)[_0x6145('0xc')](function(_0x57cf6d){logger[_0x6145('0xd')](_0x6145('0xe'),_0x5e5fc0,_0x6145('0xf'));logger[_0x6145('0x10')](_0x6145('0x11'),_0x5e5fc0,_0x6145('0xf'),JSON['stringify'](_0x57cf6d));if(_0x57cf6d['error']){if(_0x57cf6d[_0x6145('0x12')][_0x6145('0x13')]===0x1f4){logger[_0x6145('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x5e5fc0,_0x57cf6d['error'][_0x6145('0x14')]);return _0x1302b8(_0x57cf6d[_0x6145('0x12')][_0x6145('0x14')]);}logger['error'](_0x6145('0xe'),_0x5e5fc0,_0x57cf6d[_0x6145('0x12')][_0x6145('0x14')]);return _0x4cbcea(_0x57cf6d[_0x6145('0x12')][_0x6145('0x14')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x5e5fc0,_0x6145('0xf'));_0x4cbcea(_0x57cf6d['result'][_0x6145('0x14')]);}})[_0x6145('0x15')](function(_0x192627){logger['error'](_0x6145('0xe'),_0x5e5fc0,_0x192627);_0x1302b8(_0x192627);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9f6f0a6..f127fb2 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 _0x741c=['multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0x741c,0x196));var _0xc741=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x741c[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc741('0x6'));module['exports']=router; \ No newline at end of file +var _0x23f4=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23f4,0x1ee));var _0x423f=function(_0x5a420d,_0x19c59f){_0x5a420d=_0x5a420d-0x0;var _0x34e016=_0x23f4[_0x5a420d];return _0x34e016;};'use strict';var multer=require('multer');var util=require(_0x423f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x423f('0x1'));var router=express[_0x423f('0x2')]();var auth=require(_0x423f('0x3'));var interaction=require(_0x423f('0x4'));var config=require(_0x423f('0x5'));module[_0x423f('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e3cda60..0502500 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 _0xbd0a=['exports','INTEGER','sequelize'];(function(_0x3fd108,_0x5d911f){var _0x4f943f=function(_0x12abdf){while(--_0x12abdf){_0x3fd108['push'](_0x3fd108['shift']());}};_0x4f943f(++_0x5d911f);}(_0xbd0a,0x1f4));var _0xabd0=function(_0x178879,_0x4b79eb){_0x178879=_0x178879-0x0;var _0x3b7503=_0xbd0a[_0x178879];return _0x3b7503;};'use strict';var Sequelize=require(_0xabd0('0x0'));module[_0xabd0('0x1')]={'penalty':{'type':Sequelize[_0xabd0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x58c5=['INTEGER','sequelize','exports'];(function(_0x4b727f,_0xe353b2){var _0x1e8b8c=function(_0x16df4b){while(--_0x16df4b){_0x4b727f['push'](_0x4b727f['shift']());}};_0x1e8b8c(++_0xe353b2);}(_0x58c5,0xac));var _0x558c=function(_0x399735,_0x2d9d27){_0x399735=_0x399735-0x0;var _0x1f393e=_0x58c5[_0x399735];return _0x1f393e;};'use strict';var Sequelize=require(_0x558c('0x0'));module[_0x558c('0x1')]={'penalty':{'type':Sequelize[_0x558c('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 7866c1d..a95359b 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 _0x38a1=['exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x42e2a0,_0xd2a7e1){var _0x3dbf06=function(_0x1a8ed6){while(--_0x1a8ed6){_0x42e2a0['push'](_0x42e2a0['shift']());}};_0x3dbf06(++_0xd2a7e1);}(_0x38a1,0x130));var _0x138a=function(_0x556d7a,_0x1f5f04){_0x556d7a=_0x556d7a-0x0;var _0x1942df=_0x38a1[_0x556d7a];return _0x1942df;};'use strict';var _=require(_0x138a('0x0'));var util=require(_0x138a('0x1'));var logger=require(_0x138a('0x2'))(_0x138a('0x3'));var moment=require(_0x138a('0x4'));var BPromise=require('bluebird');var rp=require(_0x138a('0x5'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x138a('0x6')]=function(_0x524b60,_0x5286a8){return _0x524b60[_0x138a('0x7')](_0x138a('0x8'),attributes,{'tableName':_0x138a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f60=['./userOpenchannelQueue.attributes','exports','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x451503,_0x427827){var _0x4f707b=function(_0x4ed478){while(--_0x4ed478){_0x451503['push'](_0x451503['shift']());}};_0x4f707b(++_0x427827);}(_0x5f60,0xed));var _0x05f6=function(_0x31ad84,_0x3a1364){_0x31ad84=_0x31ad84-0x0;var _0x2ab374=_0x5f60[_0x31ad84];return _0x2ab374;};'use strict';var _=require(_0x05f6('0x0'));var util=require('util');var logger=require(_0x05f6('0x1'))(_0x05f6('0x2'));var moment=require(_0x05f6('0x3'));var BPromise=require(_0x05f6('0x4'));var rp=require(_0x05f6('0x5'));var attributes=require(_0x05f6('0x6'));module[_0x05f6('0x7')]=function(_0x21da78,_0x1b2ac5){return _0x21da78['define']('UserOpenchannelQueue',attributes,{'tableName':_0x05f6('0x8'),'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 4933eb6..ae8c2c9 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 _0xfa3d=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x3f8720,_0x1c812c){var _0x197a82=function(_0x4966a4){while(--_0x4966a4){_0x3f8720['push'](_0x3f8720['shift']());}};_0x197a82(++_0x1c812c);}(_0xfa3d,0x115));var _0xdfa3=function(_0x3c4e87,_0x370255){_0x3c4e87=_0x3c4e87-0x0;var _0x512be0=_0xfa3d[_0x3c4e87];return _0x512be0;};'use strict';var _=require(_0xdfa3('0x0'));var util=require('util');var moment=require(_0xdfa3('0x1'));var BPromise=require(_0xdfa3('0x2'));var rs=require(_0xdfa3('0x3'));var fs=require('fs');var Redis=require(_0xdfa3('0x4'));var db=require(_0xdfa3('0x5'))['db'];var utils=require(_0xdfa3('0x6'));var logger=require('../../config/logger')(_0xdfa3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdfa3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50d906,_0x144aa9,_0x431298){return new BPromise(function(_0x8ea838,_0x3f0254){return client[_0xdfa3('0x9')](_0x50d906,_0x431298)['then'](function(_0x588292){logger[_0xdfa3('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x144aa9,_0xdfa3('0xb'));logger['debug'](_0xdfa3('0xc'),_0x144aa9,_0xdfa3('0xb'),JSON[_0xdfa3('0xd')](_0x588292));if(_0x588292[_0xdfa3('0xe')]){if(_0x588292[_0xdfa3('0xe')][_0xdfa3('0xf')]===0x1f4){logger['error'](_0xdfa3('0x10'),_0x144aa9,_0x588292[_0xdfa3('0xe')][_0xdfa3('0x11')]);return _0x3f0254(_0x588292[_0xdfa3('0xe')][_0xdfa3('0x11')]);}logger[_0xdfa3('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x144aa9,_0x588292['error'][_0xdfa3('0x11')]);return _0x8ea838(_0x588292[_0xdfa3('0xe')]['message']);}else{logger[_0xdfa3('0xa')](_0xdfa3('0x10'),_0x144aa9,_0xdfa3('0xb'));_0x8ea838(_0x588292[_0xdfa3('0x12')][_0xdfa3('0x11')]);}})[_0xdfa3('0x13')](function(_0x922183){logger[_0xdfa3('0xe')](_0xdfa3('0x10'),_0x144aa9,_0x922183);_0x3f0254(_0x922183);});});} \ No newline at end of file +var _0x548f=['code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x18c2e4,_0x1ef1d9){var _0xe2d0fc=function(_0x49ff59){while(--_0x49ff59){_0x18c2e4['push'](_0x18c2e4['shift']());}};_0xe2d0fc(++_0x1ef1d9);}(_0x548f,0x16b));var _0xf548=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x548f[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xf548('0x0'));var util=require('util');var moment=require(_0xf548('0x1'));var BPromise=require(_0xf548('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf548('0x3'));var db=require(_0xf548('0x4'))['db'];var utils=require(_0xf548('0x5'));var logger=require('../../config/logger')(_0xf548('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf548('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36e9cc,_0x3d7c0d,_0x1ca123){return new BPromise(function(_0x592f51,_0x485bec){return client['request'](_0x36e9cc,_0x1ca123)[_0xf548('0x8')](function(_0x3b4ca6){logger[_0xf548('0x9')](_0xf548('0xa'),_0x3d7c0d,_0xf548('0xb'));logger[_0xf548('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3d7c0d,_0xf548('0xb'),JSON[_0xf548('0xd')](_0x3b4ca6));if(_0x3b4ca6[_0xf548('0xe')]){if(_0x3b4ca6[_0xf548('0xe')][_0xf548('0xf')]===0x1f4){logger[_0xf548('0xe')](_0xf548('0xa'),_0x3d7c0d,_0x3b4ca6[_0xf548('0xe')][_0xf548('0x10')]);return _0x485bec(_0x3b4ca6[_0xf548('0xe')][_0xf548('0x10')]);}logger[_0xf548('0xe')](_0xf548('0xa'),_0x3d7c0d,_0x3b4ca6[_0xf548('0xe')][_0xf548('0x10')]);return _0x592f51(_0x3b4ca6['error'][_0xf548('0x10')]);}else{logger[_0xf548('0x9')](_0xf548('0xa'),_0x3d7c0d,_0xf548('0xb'));_0x592f51(_0x3b4ca6[_0xf548('0x11')]['message']);}})['catch'](function(_0x271a30){logger[_0xf548('0xe')](_0xf548('0xa'),_0x3d7c0d,_0x271a30);_0x485bec(_0x271a30);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 0ac2567..11567fe 100644 --- a/server/api/userProfile/index.js +++ b/server/api/userProfile/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1211=['show','/:id/resources','getResources','post','create','/:id/clone','/:id/sections','addResources','put','update','removeSections','delete','removeResources','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x202939,_0x4a1063){var _0x243aec=function(_0x3cbdeb){while(--_0x3cbdeb){_0x202939['push'](_0x202939['shift']());}};_0x243aec(++_0x4a1063);}(_0x1211,0x101));var _0x1121=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1211[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x1121('0x0'));var path=require(_0x1121('0x1'));var timeout=require(_0x1121('0x2'));var express=require(_0x1121('0x3'));var router=express[_0x1121('0x4')]();var auth=require(_0x1121('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1121('0x6'));var controller=require('./userProfile.controller');router[_0x1121('0x7')]('/',auth[_0x1121('0x8')](),controller[_0x1121('0x9')]);router[_0x1121('0x7')](_0x1121('0xa'),auth['isAuthenticated'](),controller[_0x1121('0xb')]);router['get'](_0x1121('0xc'),auth[_0x1121('0x8')](),controller[_0x1121('0xd')]);router[_0x1121('0x7')](_0x1121('0xe'),auth[_0x1121('0x8')](),controller[_0x1121('0xf')]);router[_0x1121('0x10')]('/',auth['isAuthenticated'](),controller[_0x1121('0x11')]);router['post'](_0x1121('0x12'),auth[_0x1121('0x8')](),controller['clone']);router['post'](_0x1121('0x13'),auth[_0x1121('0x8')](),controller['addSections']);router[_0x1121('0x10')]('/:id/resources',auth['isAuthenticated'](),controller[_0x1121('0x14')]);router[_0x1121('0x15')](_0x1121('0xc'),auth[_0x1121('0x8')](),controller[_0x1121('0x16')]);router['delete'](_0x1121('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/sections',auth[_0x1121('0x8')](),controller[_0x1121('0x17')]);router[_0x1121('0x18')]('/:id/resources',auth['isAuthenticated'](),controller[_0x1121('0x19')]);module[_0x1121('0x1a')]=router; \ No newline at end of file +var _0xb01e=['update','removeSections','delete','removeResources','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','/:id','show','/:id/resources','getResources','create','post','clone','/:id/sections','addSections','addResources'];(function(_0x51bcf3,_0x3c7eba){var _0x572247=function(_0x5ae97b){while(--_0x5ae97b){_0x51bcf3['push'](_0x51bcf3['shift']());}};_0x572247(++_0x3c7eba);}(_0xb01e,0x1d1));var _0xeb01=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb01e[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0xeb01('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeb01('0x1'));var express=require(_0xeb01('0x2'));var router=express[_0xeb01('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xeb01('0x4'));var config=require('../../config/environment');var controller=require(_0xeb01('0x5'));router[_0xeb01('0x6')]('/',auth[_0xeb01('0x7')](),controller['index']);router[_0xeb01('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xeb01('0x6')](_0xeb01('0x8'),auth[_0xeb01('0x7')](),controller[_0xeb01('0x9')]);router[_0xeb01('0x6')](_0xeb01('0xa'),auth[_0xeb01('0x7')](),controller[_0xeb01('0xb')]);router['post']('/',auth[_0xeb01('0x7')](),controller[_0xeb01('0xc')]);router[_0xeb01('0xd')]('/:id/clone',auth[_0xeb01('0x7')](),controller[_0xeb01('0xe')]);router['post'](_0xeb01('0xf'),auth[_0xeb01('0x7')](),controller[_0xeb01('0x10')]);router['post'](_0xeb01('0xa'),auth[_0xeb01('0x7')](),controller[_0xeb01('0x11')]);router['put'](_0xeb01('0x8'),auth[_0xeb01('0x7')](),controller[_0xeb01('0x12')]);router['delete'](_0xeb01('0x8'),auth[_0xeb01('0x7')](),controller['destroy']);router['delete'](_0xeb01('0xf'),auth['isAuthenticated'](),controller[_0xeb01('0x13')]);router[_0xeb01('0x14')]('/:id/resources',auth[_0xeb01('0x7')](),controller[_0xeb01('0x15')]);module[_0xeb01('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index b9eb058..4dcfc0c 100644 --- a/server/api/userProfile/userProfile.attributes.js +++ b/server/api/userProfile/userProfile.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x214e=['setDataValue','getDataValue','crudPermissions','split','sequelize','STRING','name'];(function(_0x2beb5d,_0x458ca1){var _0x2199bc=function(_0x50b49c){while(--_0x50b49c){_0x2beb5d['push'](_0x2beb5d['shift']());}};_0x2199bc(++_0x458ca1);}(_0x214e,0x12a));var _0xe214=function(_0x11b35b,_0x19d7e0){_0x11b35b=_0x11b35b-0x0;var _0x4ffc16=_0x214e[_0x11b35b];return _0x4ffc16;};'use strict';var Sequelize=require(_0xe214('0x0'));module['exports']={'name':{'type':Sequelize[_0xe214('0x1')],'allowNull':![],'unique':_0xe214('0x2')},'crudPermissions':{'type':Sequelize[_0xe214('0x1')],'set':function(_0x5a0ca2){this[_0xe214('0x3')]('crudPermissions',_0x5a0ca2?_0x5a0ca2['join'](''):[]);},'get':function(){return this[_0xe214('0x4')](_0xe214('0x5'))?this['getDataValue'](_0xe214('0x5'))[_0xe214('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe214('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x060a=['STRING','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports'];(function(_0x5eef12,_0x483dd9){var _0x400c54=function(_0x2e504e){while(--_0x2e504e){_0x5eef12['push'](_0x5eef12['shift']());}};_0x400c54(++_0x483dd9);}(_0x060a,0x1be));var _0xa060=function(_0x34da9f,_0x36829e){_0x34da9f=_0x34da9f-0x0;var _0x3abf74=_0x060a[_0x34da9f];return _0x3abf74;};'use strict';var Sequelize=require(_0xa060('0x0'));module[_0xa060('0x1')]={'name':{'type':Sequelize[_0xa060('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xa060('0x2')],'set':function(_0x1e0ebf){this[_0xa060('0x3')](_0xa060('0x4'),_0x1e0ebf?_0x1e0ebf[_0xa060('0x5')](''):[]);},'get':function(){return this[_0xa060('0x6')]('crudPermissions')?this[_0xa060('0x6')]('crudPermissions')[_0xa060('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 718ccea..74d2a4b 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a5a=['add','day','merge','filter','includeAll','include','findAll','show','params','rawAttributes','find','create','body','catch','clone','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','get','each','autoAssociation','map','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','describe','addSections','push','removeSections','ids','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','union','ignore','childModel','foreignKey','resourceIds','field','resourceFields','forEach','reportType','default','reportId','DefaultReports','custom','type','CustomReports','rows','count','CmContact','Tag','Tags','color','tag','ThroughTags','value','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','JscriptyProject','contacts','Lists','ListId','CmList','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','Agents','agent','Telephones','membername','User','telephone','queue','VoiceQueue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','teams','Team','queuecampaigns','QueueCampaigns','telephones','role','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','UserProfile','keys','query','dateStart','dateEnd','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters'];(function(_0x5b2784,_0x22bdd4){var _0x10cd92=function(_0x56286f){while(--_0x56286f){_0x5b2784['push'](_0x5b2784['shift']());}};_0x10cd92(++_0x22bdd4);}(_0x9a5a,0x194));var _0xa9a5=function(_0x90f779,_0x2e0f26){_0x90f779=_0x90f779-0x0;var _0x34a516=_0x9a5a[_0x90f779];return _0x34a516;};'use strict';var pdf=require(_0xa9a5('0x0'));var emlformat=require(_0xa9a5('0x1'));var rimraf=require(_0xa9a5('0x2'));var zipdir=require(_0xa9a5('0x3'));var jsonpatch=require(_0xa9a5('0x4'));var rp=require('request-promise');var moment=require(_0xa9a5('0x5'));var BPromise=require(_0xa9a5('0x6'));var Mustache=require(_0xa9a5('0x7'));var util=require(_0xa9a5('0x8'));var path=require(_0xa9a5('0x9'));var sox=require(_0xa9a5('0xa'));var csv=require('to-csv');var ejs=require(_0xa9a5('0xb'));var fs=require('fs');var _=require(_0xa9a5('0xc'));var squel=require(_0xa9a5('0xd'));var crypto=require(_0xa9a5('0xe'));var jsforce=require(_0xa9a5('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa9a5('0x10'));var Redis=require(_0xa9a5('0x11'));var qs=require(_0xa9a5('0x12'));var logger=require(_0xa9a5('0x13'))(_0xa9a5('0x14'));var utils=require(_0xa9a5('0x15'));var config=require(_0xa9a5('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xa9a5('0x17')],{'host':_0xa9a5('0x18'),'port':0x18eb});var socket=require(_0xa9a5('0x19'))(new Redis(config[_0xa9a5('0x17')]));require(_0xa9a5('0x1a'))['register'](socket);function respondWithStatusCode(_0xe6a34b,_0x3e7ebe){_0x3e7ebe=_0x3e7ebe||0xcc;return function(_0x3a7905){if(_0x3a7905){return _0xe6a34b[_0xa9a5('0x1b')](_0x3e7ebe);}return _0xe6a34b[_0xa9a5('0x1c')](_0x3e7ebe)[_0xa9a5('0x1d')]();};}function respondWithResult(_0x5edc1e,_0x30a479){_0x30a479=_0x30a479||0xc8;return function(_0x25c458){if(_0x25c458){return _0x5edc1e[_0xa9a5('0x1c')](_0x30a479)[_0xa9a5('0x1e')](_0x25c458);}};}function respondWithFilteredResult(_0x5bbfeb,_0x3353ca){return function(_0x106cbf){if(_0x106cbf){var _0xb8bed2=_0x106cbf['count'],_0x5967f6=_0x3353ca[_0xa9a5('0x1f')],_0x3c505b=_0x3353ca[_0xa9a5('0x1f')]+_0x3353ca['limit'],_0x4ba946;if(_0x3c505b>=_0xb8bed2){_0x3c505b=_0xb8bed2;_0x4ba946=0xc8;}else{_0x4ba946=0xce;}_0x5bbfeb[_0xa9a5('0x1c')](_0x4ba946);return _0x5bbfeb['set'](_0xa9a5('0x20'),_0x5967f6+'-'+_0x3c505b+'/'+_0xb8bed2)[_0xa9a5('0x1e')](_0x106cbf);}return null;};}function patchUpdates(_0x3bd8e9){return function(_0x15468f){try{jsonpatch[_0xa9a5('0x21')](_0x15468f,_0x3bd8e9,!![]);}catch(_0x1cc402){return BPromise[_0xa9a5('0x22')](_0x1cc402);}return _0x15468f[_0xa9a5('0x23')]();};}function saveUpdates(_0x98ac21,_0x19d619){return function(_0x2d9620){if(_0x2d9620){return _0x2d9620[_0xa9a5('0x24')](_0x98ac21)['then'](function(_0x5c8314){return _0x5c8314;});}return null;};}function removeEntity(_0x59b37c,_0x43017d){return function(_0x5210c1){if(_0x5210c1){return _0x5210c1[_0xa9a5('0x25')]()[_0xa9a5('0x26')](function(){_0x59b37c[_0xa9a5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e5d79,_0xb37bcb){return function(_0x341723){if(!_0x341723){_0x1e5d79['sendStatus'](0x194);}return _0x341723;};}function handleError(_0x5dd641,_0x2a7e75){_0x2a7e75=_0x2a7e75||0x1f4;return function(_0x19ccbd){logger[_0xa9a5('0x27')](_0x19ccbd['stack']);if(_0x19ccbd[_0xa9a5('0x28')]){delete _0x19ccbd[_0xa9a5('0x28')];}_0x5dd641['status'](_0x2a7e75)[_0xa9a5('0x29')](_0x19ccbd);};}exports[_0xa9a5('0x2a')]=function(_0x5743b6,_0x11f6ce){var _0x52e2ad={},_0x11366f={},_0x47ee9e={'count':0x0,'rows':[]};var _0x1a9832=db[_0xa9a5('0x2b')]['rawAttributes'];_0x11366f['model']=_[_0xa9a5('0x2c')](_0x1a9832);var _0x4cf453={'dateStart':_0x5743b6[_0xa9a5('0x2d')][_0xa9a5('0x2e')],'dateEnd':_0x5743b6['query'][_0xa9a5('0x2f')]};delete _0x5743b6[_0xa9a5('0x2d')]['dateStart'];delete _0x5743b6[_0xa9a5('0x2d')][_0xa9a5('0x2f')];_0x11366f['query']=_['keys'](_0x5743b6['query']);_0x11366f['filters']=_[_0xa9a5('0x30')](_0x11366f['model'],_0x11366f[_0xa9a5('0x2d')]);_0x52e2ad[_0xa9a5('0x31')]=_['intersection'](_0x11366f[_0xa9a5('0x32')],qs[_0xa9a5('0x33')](_0x5743b6[_0xa9a5('0x2d')]['fields']));_0x52e2ad['attributes']=_0x52e2ad[_0xa9a5('0x31')][_0xa9a5('0x34')]?_0x52e2ad['attributes']:_0x11366f[_0xa9a5('0x32')];if(!_0x5743b6[_0xa9a5('0x2d')][_0xa9a5('0x35')](_0xa9a5('0x36'))){_0x52e2ad[_0xa9a5('0x37')]=qs[_0xa9a5('0x37')](_0x5743b6[_0xa9a5('0x2d')]['limit']);_0x52e2ad['offset']=qs[_0xa9a5('0x1f')](_0x5743b6[_0xa9a5('0x2d')][_0xa9a5('0x1f')]);}_0x52e2ad[_0xa9a5('0x38')]=qs[_0xa9a5('0x39')](_0x5743b6[_0xa9a5('0x2d')][_0xa9a5('0x39')]);_0x52e2ad[_0xa9a5('0x3a')]=qs[_0xa9a5('0x3b')](_['pick'](_0x5743b6[_0xa9a5('0x2d')],_0x11366f['filters']));if(_0x4cf453[_0xa9a5('0x2e')]){if(_0x4cf453['dateEnd']){_0x4cf453['dateEnd']=moment(_0x4cf453[_0xa9a5('0x2f')])[_0xa9a5('0x3c')](0x1,_0xa9a5('0x3d'));}else{_0x4cf453[_0xa9a5('0x2f')]=moment(_0x4cf453['dateStart'])[_0xa9a5('0x3c')](0x1,_0xa9a5('0x3d'));}_[_0xa9a5('0x3e')](_0x52e2ad[_0xa9a5('0x3a')],{'createdAt':{'$gte':_0x4cf453[_0xa9a5('0x2e')],'$lte':_0x4cf453[_0xa9a5('0x2f')]}});}if(_0x5743b6[_0xa9a5('0x2d')][_0xa9a5('0x3f')]){_0x52e2ad[_0xa9a5('0x3a')]=_[_0xa9a5('0x3e')](_0x52e2ad[_0xa9a5('0x3a')],{'$or':_['map'](_0x52e2ad[_0xa9a5('0x31')],function(_0x58f214){var _0x232437={};_0x232437[_0x58f214]={'$like':'%'+_0x5743b6[_0xa9a5('0x2d')][_0xa9a5('0x3f')]+'%'};return _0x232437;})});}_0x52e2ad=_[_0xa9a5('0x3e')]({},_0x52e2ad,_0x5743b6['options']);var _0x258d6c={'where':_0x52e2ad[_0xa9a5('0x3a')]};return db[_0xa9a5('0x2b')]['count'](_0x258d6c)['then'](function(_0x3c472d){_0x47ee9e['count']=_0x3c472d;if(_0x5743b6[_0xa9a5('0x2d')][_0xa9a5('0x40')]){_0x52e2ad[_0xa9a5('0x41')]=[{'all':!![]}];}return db['UserProfile'][_0xa9a5('0x42')](_0x52e2ad);})[_0xa9a5('0x26')](function(_0x49059){_0x47ee9e['rows']=_0x49059;return _0x47ee9e;})[_0xa9a5('0x26')](respondWithFilteredResult(_0x11f6ce,_0x52e2ad))['catch'](handleError(_0x11f6ce,null));};exports[_0xa9a5('0x43')]=function(_0x2fbd87,_0x4827a0){var _0x144954={'raw':![],'where':{'id':_0x2fbd87[_0xa9a5('0x44')]['id']}},_0x5e72b8={};_0x5e72b8[_0xa9a5('0x32')]=_['keys'](db['UserProfile'][_0xa9a5('0x45')]);_0x5e72b8[_0xa9a5('0x2d')]=_['keys'](_0x2fbd87[_0xa9a5('0x2d')]);_0x5e72b8[_0xa9a5('0x3b')]=_[_0xa9a5('0x30')](_0x5e72b8['model'],_0x5e72b8['query']);_0x144954['attributes']=_[_0xa9a5('0x30')](_0x5e72b8[_0xa9a5('0x32')],qs['fields'](_0x2fbd87[_0xa9a5('0x2d')]['fields']));_0x144954[_0xa9a5('0x31')]=_0x144954[_0xa9a5('0x31')][_0xa9a5('0x34')]?_0x144954[_0xa9a5('0x31')]:_0x5e72b8['model'];if(_0x2fbd87[_0xa9a5('0x2d')][_0xa9a5('0x40')]){_0x144954[_0xa9a5('0x41')]=[{'all':!![]}];}_0x144954=_['merge']({},_0x144954,_0x2fbd87['options']);return db['UserProfile'][_0xa9a5('0x46')](_0x144954)[_0xa9a5('0x26')](handleEntityNotFound(_0x4827a0,null))[_0xa9a5('0x26')](respondWithResult(_0x4827a0,null))['catch'](handleError(_0x4827a0,null));};exports['create']=function(_0x183dd6,_0x2e9c04){return db['UserProfile'][_0xa9a5('0x47')](_0x183dd6[_0xa9a5('0x48')],{})[_0xa9a5('0x26')](respondWithResult(_0x2e9c04,0xc9))[_0xa9a5('0x49')](handleError(_0x2e9c04,null));};exports[_0xa9a5('0x4a')]=function(_0x4638ed,_0x218a78){var _0x17e331={'raw':![],'where':{'id':_0x4638ed[_0xa9a5('0x44')]['id']}},_0x6f52d7={};_0x6f52d7[_0xa9a5('0x32')]=_['keys'](db[_0xa9a5('0x2b')]['rawAttributes']);_0x17e331['attributes']=_[_0xa9a5('0x30')](_0x6f52d7['model'],qs[_0xa9a5('0x33')](_0x4638ed[_0xa9a5('0x2d')]['fields']));_0x17e331[_0xa9a5('0x31')]=_0x17e331[_0xa9a5('0x31')][_0xa9a5('0x34')]?_0x17e331[_0xa9a5('0x31')]:_0x6f52d7[_0xa9a5('0x32')];if(_0x4638ed[_0xa9a5('0x2d')]['includeAll']){_0x17e331[_0xa9a5('0x41')]=[{'all':!![]}];}_0x17e331=_[_0xa9a5('0x3e')]({},_0x17e331,_0x4638ed['options']);return db['UserProfile'][_0xa9a5('0x46')](_0x17e331)[_0xa9a5('0x26')](handleEntityNotFound(_0x218a78,null))[_0xa9a5('0x26')](function(_0x347195){if(_0x347195){var _0xaee781=_0x347195['get']({'plain':!![]});_0xaee781=qs[_0xa9a5('0x4b')](_0xaee781,['id',_0xa9a5('0x4c'),_0xa9a5('0x4d'),_0xa9a5('0x4e')]);_0x4638ed[_0xa9a5('0x48')]=_[_0xa9a5('0x4b')](_0x4638ed[_0xa9a5('0x48')],['id',_0xa9a5('0x4c'),_0xa9a5('0x4d')]);return db[_0xa9a5('0x4f')][_0xa9a5('0x50')](function(_0x1dfe69){return db[_0xa9a5('0x2b')][_0xa9a5('0x47')](_[_0xa9a5('0x3e')](_0xaee781,_0x4638ed[_0xa9a5('0x48')]),{'include':_0x4638ed[_0xa9a5('0x2d')][_0xa9a5('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x1dfe69})[_0xa9a5('0x26')](function(_0x3d0e61){var _0x36f1ac=_0x3d0e61[_0xa9a5('0x51')]({'plain':!![]});return db['UserProfileSection'][_0xa9a5('0x42')]({'where':{'userProfileId':_0x4638ed[_0xa9a5('0x44')]['id']},'raw':!![]})[_0xa9a5('0x26')](function(_0x554200){if(_0x554200){return BPromise[_0xa9a5('0x52')](_0x554200,function(_0x384dcc){return new BPromise(function(_0x4a98e2,_0x3bd3d5){if(_0x384dcc[_0xa9a5('0x53')]===null||_0x384dcc[_0xa9a5('0x53')]===0x1)_0x4a98e2(null);return db['UserProfileResource'][_0xa9a5('0x42')]({'where':{'sectionId':_0x384dcc['id']},'raw':!![]})['then'](function(_0x29e266){var _0x3f3bb5=_[_0xa9a5('0x54')](_0x29e266,function(_0x34c0fb){return qs[_0xa9a5('0x4b')](_0x34c0fb,['id',_0xa9a5('0x4c'),_0xa9a5('0x4d'),_0xa9a5('0x55')]);});_0x4a98e2(_0x3f3bb5);})['catch'](function(_0x1dc32f){_0x3bd3d5(_0x1dc32f);});})[_0xa9a5('0x26')](function(_0x242f99){var _0x3d606e=qs[_0xa9a5('0x4b')](_0x384dcc,['id',_0xa9a5('0x4c'),_0xa9a5('0x4d')]);_0x3d606e[_0xa9a5('0x56')]=_0x36f1ac['id'];if(_0x242f99)_0x3d606e[_0xa9a5('0x57')]=_0x242f99;return _0x3d606e;})[_0xa9a5('0x26')](function(_0x4046ba){return db[_0xa9a5('0x58')][_0xa9a5('0x47')](_0x4046ba,{'include':[{'model':db[_0xa9a5('0x59')],'as':_0xa9a5('0x57')}],'raw':!![],'transaction':_0x1dfe69});});})[_0xa9a5('0x26')](function(){return _0x36f1ac;});}});});});}})[_0xa9a5('0x26')](respondWithResult(_0x218a78,0xc9))[_0xa9a5('0x49')](handleError(_0x218a78,null));};exports[_0xa9a5('0x24')]=function(_0x458765,_0x5b5648){if(_0x458765[_0xa9a5('0x48')]['id']){delete _0x458765['body']['id'];}return db['UserProfile'][_0xa9a5('0x46')]({'where':{'id':_0x458765[_0xa9a5('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b5648,null))['then'](saveUpdates(_0x458765[_0xa9a5('0x48')],null))[_0xa9a5('0x26')](respondWithResult(_0x5b5648,null))[_0xa9a5('0x49')](handleError(_0x5b5648,null));};exports[_0xa9a5('0x25')]=function(_0x52ca49,_0x121583){return db[_0xa9a5('0x2b')]['find']({'where':{'id':_0x52ca49[_0xa9a5('0x44')]['id']}})[_0xa9a5('0x26')](handleEntityNotFound(_0x121583,null))[_0xa9a5('0x26')](removeEntity(_0x121583,null))[_0xa9a5('0x49')](handleError(_0x121583,null));};exports[_0xa9a5('0x5a')]=function(_0x5be817,_0x336d81){return db[_0xa9a5('0x2b')]['describe']()['then'](respondWithResult(_0x336d81,null))[_0xa9a5('0x49')](handleError(_0x336d81,null));};exports[_0xa9a5('0x5b')]=function(_0x342c9d,_0x3ecce2){var _0x1499df=_0x342c9d[_0xa9a5('0x48')];return db[_0xa9a5('0x2b')]['find']({'where':{'id':_0x342c9d['params']['id']}})['then'](handleEntityNotFound(_0x3ecce2,null))[_0xa9a5('0x26')](function(_0x177739){if(_0x177739){return db[_0xa9a5('0x4f')][_0xa9a5('0x50')](function(_0x113e98){return db['UserProfileSection'][_0xa9a5('0x25')]({'where':{'userProfileId':_0x342c9d[_0xa9a5('0x44')]['id'],'sectionId':_[_0xa9a5('0x54')](_0x1499df,function(_0xbbf791){return _0xbbf791[_0xa9a5('0x55')];})},'transaction':_0x113e98})[_0xa9a5('0x26')](function(){var _0x2eedcb=_[_0xa9a5('0x54')](_0x1499df,function(_0x36eca9){_0x36eca9[_0xa9a5('0x56')]=_0x342c9d[_0xa9a5('0x44')]['id'];return _0x36eca9;});var _0x311fca=[];return BPromise['each'](_0x2eedcb,function(_0x40d3e2){return db['UserProfileSection'][_0xa9a5('0x47')](_0x40d3e2,{'include':[{'model':db[_0xa9a5('0x59')],'as':_0xa9a5('0x57')}],'raw':!![],'transaction':_0x113e98})[_0xa9a5('0x26')](function(_0x3d683a){_0x311fca[_0xa9a5('0x5c')](_0x3d683a[_0xa9a5('0x51')]({'plain':!![]}));});})[_0xa9a5('0x26')](function(){return _0x311fca;});});});}})[_0xa9a5('0x26')](function(_0x58d7b5){return _0x58d7b5;})[_0xa9a5('0x26')](respondWithResult(_0x3ecce2,null))[_0xa9a5('0x49')](handleError(_0x3ecce2,null));};exports[_0xa9a5('0x5d')]=function(_0xefd346,_0x479b66){var _0x2d7271;return db[_0xa9a5('0x2b')][_0xa9a5('0x46')]({'where':{'id':_0xefd346[_0xa9a5('0x44')]['id']},'attributes':['id','name']})[_0xa9a5('0x26')](handleEntityNotFound(_0x479b66,null))['then'](function(_0x1beeb3){if(_0x1beeb3){_0x2d7271=_0x1beeb3;return db[_0xa9a5('0x58')][_0xa9a5('0x25')]({'where':{'userProfileId':_0xefd346[_0xa9a5('0x44')]['id'],'sectionId':_0xefd346['query'][_0xa9a5('0x5e')]}});}})[_0xa9a5('0x26')](function(){return _0x2d7271;})[_0xa9a5('0x26')](respondWithStatusCode(_0x479b66,null))[_0xa9a5('0x49')](handleError(_0x479b66,null));};exports[_0xa9a5('0x5f')]=function(_0x518e3b,_0x16ad36){return db[_0xa9a5('0x2b')][_0xa9a5('0x46')]({'where':{'id':_0x518e3b[_0xa9a5('0x44')]['id']}})[_0xa9a5('0x26')](handleEntityNotFound(_0x16ad36,null))['then'](function(_0x2e27c8){if(_0x2e27c8){return db[_0xa9a5('0x4f')][_0xa9a5('0x50')](function(_0x3b311b){return db['UserProfileSection'][_0xa9a5('0x42')]({'where':{'userProfileId':_0x518e3b[_0xa9a5('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0xa9a5('0x26')](function(_0x39f560){if(_0x39f560){return db['UserProfileSection'][_0xa9a5('0x25')]({'where':{'userProfileId':_0x518e3b['params']['id'],'id':_[_0xa9a5('0x54')](_0x39f560,function(_0x3980dd){return _0x3980dd['id'];})},'transaction':_0x3b311b});}})['then'](function(_0x4ea526){var _0x587684=_[_0xa9a5('0x54')](_0x518e3b[_0xa9a5('0x48')],function(_0x41e18d){_0x41e18d[_0xa9a5('0x56')]=_0x518e3b[_0xa9a5('0x44')]['id'];return _0x41e18d;});return db[_0xa9a5('0x58')][_0xa9a5('0x60')](_0x587684,{'raw':!![],'transaction':_0x3b311b});})[_0xa9a5('0x26')](function(_0x1b1729){var _0x499bd1=_[_0xa9a5('0x3f')](_[_0xa9a5('0x54')](_0x1b1729,function(_0x454046){return _0x454046[_0xa9a5('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x499bd1){return db['UserProfileSection'][_0xa9a5('0x42')]({'where':{'userProfileId':_0x518e3b[_0xa9a5('0x44')]['id'],'sectionId':_[_0xa9a5('0x54')](_0x499bd1,function(_0x3bb081){return _0x3bb081[_0xa9a5('0x55')];})},'attributes':['id',_0xa9a5('0x55')],'raw':!![]})[_0xa9a5('0x26')](function(_0x5562f9){var _0x529c74=_[_0xa9a5('0x54')](_0x518e3b[_0xa9a5('0x48')],function(_0x1863d1){_0x1863d1['userProfileId']=_0x518e3b[_0xa9a5('0x44')]['id'];return _0x1863d1;});return db[_0xa9a5('0x59')][_0xa9a5('0x60')](_0x529c74,{'raw':!![],'transaction':_0x3b311b});});}})[_0xa9a5('0x49')](handleError(_0x16ad36,null));});}})[_0xa9a5('0x26')](function(_0x3d2411){var _0x5ced17=_['map'](_0x3d2411,function(_0xab316e){return _0xab316e[_0xa9a5('0x51')]({'plain':!![]});});})[_0xa9a5('0x26')](respondWithResult(_0x16ad36,null))[_0xa9a5('0x49')](handleError(_0x16ad36,null));};exports['removeResources']=function(_0x45d2da,_0x375247,_0xaacd3a){var _0x482722;return db[_0xa9a5('0x2b')][_0xa9a5('0x46')]({'where':{'id':_0x45d2da[_0xa9a5('0x44')]['id']}})[_0xa9a5('0x26')](handleEntityNotFound(_0x375247,null))[_0xa9a5('0x26')](function(_0x5ae965){if(_0x5ae965){return _0x5ae965[_0xa9a5('0x61')](_0x45d2da[_0xa9a5('0x2d')]['ids']);}})[_0xa9a5('0x26')](respondWithStatusCode(_0x375247,null))[_0xa9a5('0x49')](handleError(_0x375247,null));};exports[_0xa9a5('0x62')]=function(_0xc8e6ea,_0x3577af){var _0x29b55f={'raw':![],'where':{}};var _0x59eae1={};var _0x34d9f4={'count':0x0,'rows':[]};var _0x26f9d5=_0xc8e6ea['query'][_0xa9a5('0x63')];if(typeof _0x26f9d5===_0xa9a5('0x64')){throw new db[(_0xa9a5('0x65'))][(_0xa9a5('0x66'))](_0xa9a5('0x67'));}var _0x26f608=_0xc8e6ea[_0xa9a5('0x2d')][_0xa9a5('0x68')]||![];var _0x3ac406=getQueryModels(_0x26f9d5,_0x26f608);if(typeof _0x3ac406['childModel']===_0xa9a5('0x64')){throw new db[(_0xa9a5('0x65'))][(_0xa9a5('0x66'))](_0xa9a5('0x69')+_0x26f9d5+'\x27');}var _0xad2ce4=[];if(!_[_0xa9a5('0x6a')](_0x3ac406[_0xa9a5('0x6b')])){_0xad2ce4=_0x3ac406['parentSections'];}else{_0xad2ce4=[{'name':_0x26f9d5}];}return db['UserProfile'][_0xa9a5('0x6c')]({'where':{'id':_0xc8e6ea['params']['id']}})[_0xa9a5('0x26')](handleEntityNotFound(_0x3577af,null))[_0xa9a5('0x26')](function(_0x435a02){if(_0x435a02){var _0x45ab47=[];for(var _0x385cec=0x0;_0x385cec<_0xad2ce4[_0xa9a5('0x34')];_0x385cec++){_0x45ab47[_0xa9a5('0x5c')](db[_0xa9a5('0x58')]['findOne']({'where':{'userProfileId':_0x435a02['id'],'name':_0xad2ce4[_0x385cec][_0xa9a5('0x28')]},'raw':!![]}));}return BPromise[_0xa9a5('0x6d')](_0x45ab47);}})['then'](function(_0x12e0f3){var _0x3304e0=_[_0xa9a5('0x3f')](_0x12e0f3,function(_0x5c3b51){return _0x5c3b51?_0x5c3b51:undefined;});var _0x10f5f5=_[_0xa9a5('0x3f')](_0xad2ce4,['ignore',!![]]);var _0x31520c=_[_0xa9a5('0x6a')](_0x3304e0)&&_[_0xa9a5('0x6a')](_0x10f5f5)?null:_[_0xa9a5('0x6e')](_0x10f5f5,_0x3304e0);if(_0x31520c){var _0x5b2996=[];for(var _0x2675f4=0x0;_0x2675f4<_0x31520c['length'];_0x2675f4++){var _0xf42ff1=_[_0xa9a5('0x46')](_0xad2ce4,function(_0x2d796b){return _0x31520c[_0x2675f4]?_0x2d796b[_0xa9a5('0x28')]===_0x31520c[_0x2675f4][_0xa9a5('0x28')]:null;});if(_0xf42ff1){if(_0x31520c[_0x2675f4][_0xa9a5('0x6f')]){_0x5b2996['push'](getAllResources(_0x3ac406[_0xa9a5('0x70')],_0x31520c[_0x2675f4]));}else{if(!_0x31520c[_0x2675f4][_0xa9a5('0x53')]){_0x5b2996[_0xa9a5('0x5c')](getAllowedResources(_0xf42ff1,_0x31520c[_0x2675f4]));}else{if(_0xf42ff1[_0xa9a5('0x32')]){_0x5b2996['push'](getAllFilteredResources(_0xf42ff1,_0x31520c[_0x2675f4]));}}}}}return BPromise[_0xa9a5('0x6d')](_0x5b2996);}else{return null;}})[_0xa9a5('0x26')](function(_0x4aa591){var _0x3e05cf=_0x4aa591;var _0x57f5d9=null;if(_0x3e05cf){_0x57f5d9=_0x3e05cf[_0xa9a5('0x34')]===0x1?_0x3e05cf[0x0]:null;}if(_0x57f5d9||_0x3e05cf){_0x59eae1[_0xa9a5('0x32')]=_[_0xa9a5('0x2c')](db[_0x3ac406['childModel']][_0xa9a5('0x45')]);_0x59eae1['query']=_[_0xa9a5('0x2c')](_0xc8e6ea[_0xa9a5('0x2d')]);_0x59eae1[_0xa9a5('0x3b')]=_['intersection'](_0x59eae1[_0xa9a5('0x32')],_0x59eae1[_0xa9a5('0x2d')]);_0x29b55f[_0xa9a5('0x31')]=_['intersection'](_0x59eae1[_0xa9a5('0x32')],qs[_0xa9a5('0x33')](_0xc8e6ea[_0xa9a5('0x2d')][_0xa9a5('0x33')]));_0x29b55f[_0xa9a5('0x31')]=_0x29b55f[_0xa9a5('0x31')]['length']?_0x29b55f[_0xa9a5('0x31')]:_0x59eae1[_0xa9a5('0x32')];if(!_0xc8e6ea[_0xa9a5('0x2d')]['hasOwnProperty'](_0xa9a5('0x36'))){_0x29b55f[_0xa9a5('0x37')]=qs['limit'](_0xc8e6ea[_0xa9a5('0x2d')][_0xa9a5('0x37')]);_0x29b55f[_0xa9a5('0x1f')]=qs[_0xa9a5('0x1f')](_0xc8e6ea['query'][_0xa9a5('0x1f')]);}_0x29b55f[_0xa9a5('0x38')]=qs[_0xa9a5('0x39')](_0xc8e6ea[_0xa9a5('0x2d')][_0xa9a5('0x39')]);_0x29b55f[_0xa9a5('0x3a')]=qs[_0xa9a5('0x3b')](_['pick'](_0xc8e6ea[_0xa9a5('0x2d')],_0x59eae1['filters']));var _0x1291fc=[];if(_0x57f5d9){var _0x567380=_[_0xa9a5('0x46')](_0xad2ce4,[_0xa9a5('0x28'),_0x57f5d9[_0xa9a5('0x28')]]);if(_0x567380['field']){var _0x15e1cd={};_0x15e1cd[_0x567380[_0xa9a5('0x71')]]=_0x57f5d9['resourceIds'];_0x1291fc[_0xa9a5('0x5c')](_0x15e1cd);}else{_0x29b55f[_0xa9a5('0x3a')]['id']=_0x57f5d9[_0xa9a5('0x72')];}}else{var _0x1291fc=[];for(var _0x16df40=0x0;_0x16df40<_0x3e05cf['length'];_0x16df40++){var _0x567380=_[_0xa9a5('0x46')](_0xad2ce4,[_0xa9a5('0x28'),_0x3e05cf[_0x16df40]['name']]);if(_0x567380[_0xa9a5('0x73')]){var _0x15e1cd={};if(_0x567380[_0xa9a5('0x73')]==='id'){_0x15e1cd[_0x567380['foreignKey']]=_0x3e05cf[_0x16df40][_0xa9a5('0x72')];}else{_0x15e1cd[_0x567380[_0xa9a5('0x71')]]=_0x3e05cf[_0x16df40][_0xa9a5('0x74')];}}else{if(!_0x29b55f[_0xa9a5('0x3a')]['id'])_0x29b55f[_0xa9a5('0x3a')]['id']=[];_0x3e05cf[_0x16df40]['resourceIds'][_0xa9a5('0x75')](function(_0x2b02ed){_0x29b55f[_0xa9a5('0x3a')]['id'][_0xa9a5('0x5c')](_0x2b02ed);});}}}if(!_[_0xa9a5('0x6a')](_0x1291fc)){_0x29b55f[_0xa9a5('0x3a')]=_[_0xa9a5('0x3e')](_0x29b55f[_0xa9a5('0x3a')],{'$or':_0x1291fc});}if(_0xc8e6ea[_0xa9a5('0x2d')][_0xa9a5('0x3f')]){_0x29b55f['where']=_[_0xa9a5('0x3e')](_0x29b55f[_0xa9a5('0x3a')],{'$or':_[_0xa9a5('0x54')](_0x29b55f[_0xa9a5('0x31')],function(_0x3355d4){var _0x2c8d07={};_0x2c8d07[_0x3355d4]={'$like':'%'+_0xc8e6ea[_0xa9a5('0x2d')][_0xa9a5('0x3f')]+'%'};return _0x2c8d07;})});}_0x29b55f=_[_0xa9a5('0x3e')]({},_0x29b55f,_0xc8e6ea['options']);if(_0x57f5d9&&!_0x57f5d9[_0xa9a5('0x53')]&&_0x3ac406['childModel']==='AnalyticExtractedReport'){if(_0xc8e6ea['query'][_0xa9a5('0x40')]){_0x29b55f[_0xa9a5('0x41')]=[{'all':!![]}];}return db[_0x3ac406[_0xa9a5('0x70')]][_0xa9a5('0x42')](_0x29b55f)[_0xa9a5('0x26')](function(_0x3c503c){var _0x38f7b6=[];_0x3c503c['forEach'](function(_0xd84002){var _0x1205f9;switch(_0xd84002[_0xa9a5('0x76')]){case _0xa9a5('0x77'):_0x1205f9=_[_0xa9a5('0x46')](_0x57f5d9['resourceIds'],function(_0x1ec567){return _0x1ec567['id']===_0xd84002[_0xa9a5('0x78')]&&_0x1ec567['type']===_0xa9a5('0x79');});break;case _0xa9a5('0x7a'):_0x1205f9=_[_0xa9a5('0x46')](_0x57f5d9[_0xa9a5('0x72')],function(_0x5672d8){return _0x5672d8['id']===_0xd84002[_0xa9a5('0x78')]&&_0x5672d8[_0xa9a5('0x7b')]===_0xa9a5('0x7c');});break;}if(_0x1205f9)_0x38f7b6['push'](_0xd84002);});_0x34d9f4['count']=_0x38f7b6[_0xa9a5('0x34')];_0x34d9f4[_0xa9a5('0x7d')]=_0x38f7b6;return _0x34d9f4;});}else{return db[_0x3ac406[_0xa9a5('0x70')]]['count']({'where':_0x29b55f[_0xa9a5('0x3a')]})[_0xa9a5('0x26')](function(_0x1e8eea){_0x34d9f4[_0xa9a5('0x7e')]=_0x1e8eea;if(_0xc8e6ea[_0xa9a5('0x2d')][_0xa9a5('0x40')]){if(_0x3ac406[_0xa9a5('0x70')]===_0xa9a5('0x7f')){_0x29b55f['include']=[{'model':db[_0xa9a5('0x80')],'as':_0xa9a5('0x81'),'attributes':['id',_0xa9a5('0x28'),_0xa9a5('0x82')],'required':_0xc8e6ea[_0xa9a5('0x2d')][_0xa9a5('0x83')]?!![]:![]},{'model':db[_0xa9a5('0x80')],'as':_0xa9a5('0x84'),'attributes':['id',_0xa9a5('0x28'),_0xa9a5('0x82')],'through':_0xc8e6ea[_0xa9a5('0x2d')][_0xa9a5('0x83')]?{'attributes':[],'where':{'TagId':_0xc8e6ea['query'][_0xa9a5('0x83')]||undefined}}:{},'required':_0xc8e6ea[_0xa9a5('0x2d')][_0xa9a5('0x83')]?!![]:![]}];}else{_0x29b55f['include']=[{'all':!![]}];}}return db[_0x3ac406[_0xa9a5('0x70')]][_0xa9a5('0x42')](_0x29b55f);})['then'](function(_0x312c89){_0x34d9f4[_0xa9a5('0x7d')]=_0x312c89;return _0x34d9f4;});}}else{return _0x34d9f4;}})['then'](respondWithFilteredResult(_0x3577af,_0x29b55f))[_0xa9a5('0x49')](handleError(_0x3577af,null));};function getAllResources(_0x4b257e,_0x364525){return new BPromise(function(_0x55f9f6,_0x15971e){if(_0x364525){var _0x1bebeb=_0x364525[_0xa9a5('0x3f')]?{[_0x364525['filter']['field']]:_0x364525[_0xa9a5('0x3f')]['value']}:undefined;return db[_0x4b257e][_0xa9a5('0x42')]({'where':_0x1bebeb,'raw':!![]})['then'](function(_0x5b608c){_0x364525[_0xa9a5('0x72')]=_[_0xa9a5('0x54')](_0x5b608c,'id');_0x55f9f6(_0x364525);})[_0xa9a5('0x49')](function(_0x55df72){_0x15971e(_0x55df72);});}else{_0x55f9f6(null);}});}function getAllFilteredResources(_0x4d3f24,_0x1f8fe3){return new BPromise(function(_0x28cd97,_0x5547f4){var _0x4c40e3=_0x4d3f24[_0xa9a5('0x3f')]?{[_0x4d3f24[_0xa9a5('0x3f')][_0xa9a5('0x73')]]:_0x4d3f24[_0xa9a5('0x3f')][_0xa9a5('0x85')]}:undefined;return db[_0x4d3f24[_0xa9a5('0x32')]]['findAll']({'where':_0x4c40e3,'raw':!![]})[_0xa9a5('0x26')](function(_0x21ced0){_0x1f8fe3[_0xa9a5('0x74')]=_[_0xa9a5('0x54')](_0x21ced0,function(_0x8538f5){return _0x8538f5[_0xa9a5('0x28')];});_0x28cd97(_0x1f8fe3);})['catch'](function(_0x3612a9){_0x5547f4(_0x3612a9);});});}function getAllowedResources(_0x2c85cd,_0x179224){return new BPromise(function(_0x11e0b7,_0x353d3c){if(_0x179224){return db[_0xa9a5('0x59')][_0xa9a5('0x42')]({'where':{'sectionId':_0x179224['id']},'raw':!![]})[_0xa9a5('0x26')](function(_0x5658e2){if(_0x2c85cd['field']&&_0x2c85cd['field']!=='id'){_0x179224[_0xa9a5('0x74')]=_[_0xa9a5('0x54')](_0x5658e2,function(_0x5d3d33){return _0x5d3d33[_0x2c85cd[_0xa9a5('0x73')]];});}else{if(_0x2c85cd[_0xa9a5('0x70')]===_0xa9a5('0x86')){_0x179224['resourceIds']=_[_0xa9a5('0x54')](_0x5658e2,function(_0x4d6665){return{'id':_0x4d6665[_0xa9a5('0x87')],'type':_0x4d6665[_0xa9a5('0x7b')]};});}else{_0x179224['resourceIds']=_['map'](_0x5658e2,function(_0x4db6e9){return _0x4db6e9[_0xa9a5('0x87')];});}}_0x11e0b7(_0x179224);})[_0xa9a5('0x49')](function(_0x5139cb){_0x353d3c(_0x5139cb);});}else{_0x11e0b7(null);}});}function getQueryModels(_0xcdeca2,_0x50debf){var _0x325b24=_0xcdeca2[_0xa9a5('0x88')]();var _0x3efede={'childModel':undefined,'parentSections':[]};switch(_0x325b24){case _0xa9a5('0x89'):_0x3efede['childModel']=_0xa9a5('0x8a');break;case _0xa9a5('0x8b'):_0x3efede['childModel']=_0xa9a5('0x8c');break;case'squarerecordings':_0x3efede['childModel']=_0xa9a5('0x8d');_0x3efede['parentSections']=[{'name':_0xa9a5('0x8e'),'field':_0xa9a5('0x28'),'foreignKey':'projectName'}];break;case'projects':_0x3efede['childModel']=_0xa9a5('0x8f');break;case _0xa9a5('0x90'):_0x3efede['childModel']=_0xa9a5('0x7f');_0x3efede['parentSections']=[{'name':_0xa9a5('0x91'),'field':'id','foreignKey':_0xa9a5('0x92'),'model':_0xa9a5('0x93')}];break;case _0xa9a5('0x94'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0x93');break;case _0xa9a5('0x95'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0x96');break;case _0xa9a5('0x97'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0x98');break;case _0xa9a5('0x99'):_0x3efede[_0xa9a5('0x70')]='ChatQueue';break;case'chatwebsites':_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0x9a');break;case _0xa9a5('0x9b'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0x9c');break;case'faxaccounts':_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0x9d');break;case _0xa9a5('0x9e'):case _0xa9a5('0x9f'):case _0xa9a5('0xa0'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xa1');break;case _0xa9a5('0xa2'):_0x3efede[_0xa9a5('0x70')]='VoiceContext';break;case _0xa9a5('0xa3'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xa4');break;case _0xa9a5('0xa5'):_0x3efede[_0xa9a5('0x70')]='VoiceRecording';_0x3efede[_0xa9a5('0x6b')]=[{'name':_0xa9a5('0xa6'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0xa9a5('0xa7')]}},{'name':_0xa9a5('0xa8'),'field':_0xa9a5('0x28'),'foreignKey':_0xa9a5('0xa9'),'model':_0xa9a5('0xaa'),'filter':{'field':'role','value':[_0xa9a5('0xab')]}},{'name':'VoiceQueues','field':_0xa9a5('0x28'),'foreignKey':_0xa9a5('0xac'),'model':_0xa9a5('0xad')}];break;case _0xa9a5('0xae'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xaf');break;case _0xa9a5('0xb0'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xb1');break;case _0xa9a5('0xb2'):_0x3efede[_0xa9a5('0x70')]='VoicePrefix';break;case _0xa9a5('0xb3'):_0x3efede[_0xa9a5('0x70')]='Campaign';break;case _0xa9a5('0xb4'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xb5');break;case _0xa9a5('0xb6'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xb7');break;case _0xa9a5('0xb8'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xb9');break;case _0xa9a5('0xba'):_0x3efede['childModel']=_0xa9a5('0xbb');break;case _0xa9a5('0xbc'):_0x3efede[_0xa9a5('0x70')]='OpenchannelAccount';break;case _0xa9a5('0xbd'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xbe');break;case _0xa9a5('0xbf'):_0x3efede[_0xa9a5('0x70')]='SmsAccount';break;case _0xa9a5('0xc0'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xc1');break;case'voicequeues':case _0xa9a5('0xc2'):_0x3efede['childModel']=_0xa9a5('0xad');if(_0x50debf){_0x3efede[_0xa9a5('0x6b')]=[{'name':'VoiceQueues'},{'name':_0xa9a5('0xc3')}];}break;case'users':case'agents':case _0xa9a5('0xc4'):_0x3efede[_0xa9a5('0x70')]='User';if(_0x50debf){_0x3efede[_0xa9a5('0x6b')]=[{'name':'Users','filter':{'field':_0xa9a5('0xc5'),'value':[_0xa9a5('0xc6'),_0xa9a5('0xc7')]},'ignore':!![]},{'name':_0xa9a5('0xa6')},{'name':'Telephones'}];}break;case _0xa9a5('0xc8'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xc9');break;case'salesforceaccounts':_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xca');break;case _0xa9a5('0xcb'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xcc');break;case'sugarcrmaccounts':_0x3efede[_0xa9a5('0x70')]='SugarcrmAccount';break;case _0xa9a5('0xcd'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xce');break;case _0xa9a5('0xcf'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xd0');break;case _0xa9a5('0xd1'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xaa');break;case _0xa9a5('0xd2'):_0x3efede['childModel']='CannedAnswer';break;case _0xa9a5('0xd3'):_0x3efede['childModel']=_0xa9a5('0xd4');break;case _0xa9a5('0xd5'):_0x3efede[_0xa9a5('0x70')]='Dashboard';break;case _0xa9a5('0xd6'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xd7');break;case _0xa9a5('0xd8'):_0x3efede['childModel']=_0xa9a5('0xd9');break;case _0xa9a5('0xda'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xdb');break;case _0xa9a5('0xdc'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xdd');break;case'tags':_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0x80');break;case'templates':_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xde');break;case'triggers':_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xdf');break;case _0xa9a5('0xe0'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xe1');break;case _0xa9a5('0xe2'):_0x3efede['childModel']=_0xa9a5('0xe3');break;case _0xa9a5('0xe4'):_0x3efede['childModel']=_0xa9a5('0xe5');break;case _0xa9a5('0xe6'):_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0x86');_0x3efede['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xa9a5('0x78')}];break;case'metrics':_0x3efede[_0xa9a5('0x70')]=_0xa9a5('0xe7');break;default:return _0x3efede;}return _0x3efede;} \ No newline at end of file +var _0x9fd4=['autoAssociation','UserProfileResource','userProfileId','Resources','describe','transaction','sectionId','removeSections','ids','addResources','bulkCreate','removeResources','getResources','section','Sequelize','Unknown\x20section','childModel','ValidationError','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','push','all','ignore','union','resourceIds','field','foreignKey','resourceFields','forEach','AnalyticExtractedReport','reportType','default','reportId','type','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','resourceId','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','ListId','CmList','globalcustomfields','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','User','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','musiconholds','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','teams','Team','voicequeues','QueueCampaigns','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','tags','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','error','stack','name','index','UserProfile','rawAttributes','model','keys','query','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','dateStart','add','day','where','map','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','each'];(function(_0x40aeca,_0x8b1195){var _0x4545bb=function(_0x1cef6b){while(--_0x1cef6b){_0x40aeca['push'](_0x40aeca['shift']());}};_0x4545bb(++_0x8b1195);}(_0x9fd4,0x16c));var _0x49fd=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x9fd4[_0x280ae7];return _0x418b9e;};'use strict';var pdf=require(_0x49fd('0x0'));var emlformat=require(_0x49fd('0x1'));var rimraf=require(_0x49fd('0x2'));var zipdir=require(_0x49fd('0x3'));var jsonpatch=require(_0x49fd('0x4'));var rp=require(_0x49fd('0x5'));var moment=require(_0x49fd('0x6'));var BPromise=require(_0x49fd('0x7'));var Mustache=require(_0x49fd('0x8'));var util=require('util');var path=require('path');var sox=require(_0x49fd('0x9'));var csv=require(_0x49fd('0xa'));var ejs=require(_0x49fd('0xb'));var fs=require('fs');var _=require(_0x49fd('0xc'));var squel=require('squel');var crypto=require(_0x49fd('0xd'));var jsforce=require(_0x49fd('0xe'));var deskjs=require(_0x49fd('0xf'));var toCsv=require(_0x49fd('0xa'));var querystring=require(_0x49fd('0x10'));var Papa=require('papaparse');var Redis=require(_0x49fd('0x11'));var qs=require(_0x49fd('0x12'));var logger=require(_0x49fd('0x13'))(_0x49fd('0x14'));var utils=require(_0x49fd('0x15'));var config=require(_0x49fd('0x16'));var db=require(_0x49fd('0x17'))['db'];config['redis']=_[_0x49fd('0x18')](config[_0x49fd('0x19')],{'host':_0x49fd('0x1a'),'port':0x18eb});var socket=require(_0x49fd('0x1b'))(new Redis(config[_0x49fd('0x19')]));require(_0x49fd('0x1c'))[_0x49fd('0x1d')](socket);function respondWithStatusCode(_0x3fa518,_0x1d900b){_0x1d900b=_0x1d900b||0xcc;return function(_0x652890){if(_0x652890){return _0x3fa518[_0x49fd('0x1e')](_0x1d900b);}return _0x3fa518[_0x49fd('0x1f')](_0x1d900b)[_0x49fd('0x20')]();};}function respondWithResult(_0x1a9063,_0x264ab1){_0x264ab1=_0x264ab1||0xc8;return function(_0x201109){if(_0x201109){return _0x1a9063[_0x49fd('0x1f')](_0x264ab1)[_0x49fd('0x21')](_0x201109);}};}function respondWithFilteredResult(_0x2f8d68,_0x12ae8f){return function(_0x14c34f){if(_0x14c34f){var _0x23d5ff=_0x14c34f[_0x49fd('0x22')],_0x320fe5=_0x12ae8f['offset'],_0x475eee=_0x12ae8f[_0x49fd('0x23')]+_0x12ae8f[_0x49fd('0x24')],_0xb55d24;if(_0x475eee>=_0x23d5ff){_0x475eee=_0x23d5ff;_0xb55d24=0xc8;}else{_0xb55d24=0xce;}_0x2f8d68['status'](_0xb55d24);return _0x2f8d68['set'](_0x49fd('0x25'),_0x320fe5+'-'+_0x475eee+'/'+_0x23d5ff)['json'](_0x14c34f);}return null;};}function patchUpdates(_0x316e7c){return function(_0xbb113b){try{jsonpatch['apply'](_0xbb113b,_0x316e7c,!![]);}catch(_0xf7efcf){return BPromise[_0x49fd('0x26')](_0xf7efcf);}return _0xbb113b['save']();};}function saveUpdates(_0x1ebdf7,_0x1165db){return function(_0x2e1c40){if(_0x2e1c40){return _0x2e1c40[_0x49fd('0x27')](_0x1ebdf7)[_0x49fd('0x28')](function(_0x156221){return _0x156221;});}return null;};}function removeEntity(_0x5dc839,_0x46019d){return function(_0xd43815){if(_0xd43815){return _0xd43815[_0x49fd('0x29')]()['then'](function(){_0x5dc839[_0x49fd('0x1f')](0xcc)[_0x49fd('0x20')]();});}};}function handleEntityNotFound(_0x146d55,_0x4bff4c){return function(_0x597161){if(!_0x597161){_0x146d55['sendStatus'](0x194);}return _0x597161;};}function handleError(_0x13c5a8,_0x1c9a0e){_0x1c9a0e=_0x1c9a0e||0x1f4;return function(_0x4ec190){logger[_0x49fd('0x2a')](_0x4ec190[_0x49fd('0x2b')]);if(_0x4ec190[_0x49fd('0x2c')]){delete _0x4ec190[_0x49fd('0x2c')];}_0x13c5a8[_0x49fd('0x1f')](_0x1c9a0e)['send'](_0x4ec190);};}exports[_0x49fd('0x2d')]=function(_0x52b35d,_0x32fc19){var _0x89badc={},_0x54acb5={},_0x203038={'count':0x0,'rows':[]};var _0x2c8568=db[_0x49fd('0x2e')][_0x49fd('0x2f')];_0x54acb5[_0x49fd('0x30')]=_[_0x49fd('0x31')](_0x2c8568);var _0x23dcc0={'dateStart':_0x52b35d[_0x49fd('0x32')]['dateStart'],'dateEnd':_0x52b35d[_0x49fd('0x32')]['dateEnd']};delete _0x52b35d[_0x49fd('0x32')]['dateStart'];delete _0x52b35d[_0x49fd('0x32')][_0x49fd('0x33')];_0x54acb5[_0x49fd('0x32')]=_['keys'](_0x52b35d['query']);_0x54acb5['filters']=_[_0x49fd('0x34')](_0x54acb5[_0x49fd('0x30')],_0x54acb5['query']);_0x89badc[_0x49fd('0x35')]=_['intersection'](_0x54acb5['model'],qs[_0x49fd('0x36')](_0x52b35d[_0x49fd('0x32')][_0x49fd('0x36')]));_0x89badc[_0x49fd('0x35')]=_0x89badc[_0x49fd('0x35')]['length']?_0x89badc['attributes']:_0x54acb5[_0x49fd('0x30')];if(!_0x52b35d[_0x49fd('0x32')][_0x49fd('0x37')](_0x49fd('0x38'))){_0x89badc['limit']=qs[_0x49fd('0x24')](_0x52b35d[_0x49fd('0x32')][_0x49fd('0x24')]);_0x89badc[_0x49fd('0x23')]=qs[_0x49fd('0x23')](_0x52b35d[_0x49fd('0x32')][_0x49fd('0x23')]);}_0x89badc[_0x49fd('0x39')]=qs[_0x49fd('0x3a')](_0x52b35d[_0x49fd('0x32')][_0x49fd('0x3a')]);_0x89badc['where']=qs[_0x49fd('0x3b')](_[_0x49fd('0x3c')](_0x52b35d[_0x49fd('0x32')],_0x54acb5[_0x49fd('0x3b')]));if(_0x23dcc0[_0x49fd('0x3d')]){if(_0x23dcc0[_0x49fd('0x33')]){_0x23dcc0[_0x49fd('0x33')]=moment(_0x23dcc0[_0x49fd('0x33')])[_0x49fd('0x3e')](0x1,'day');}else{_0x23dcc0[_0x49fd('0x33')]=moment(_0x23dcc0['dateStart'])[_0x49fd('0x3e')](0x1,_0x49fd('0x3f'));}_['merge'](_0x89badc[_0x49fd('0x40')],{'createdAt':{'$gte':_0x23dcc0[_0x49fd('0x3d')],'$lte':_0x23dcc0['dateEnd']}});}if(_0x52b35d[_0x49fd('0x32')]['filter']){_0x89badc['where']=_['merge'](_0x89badc[_0x49fd('0x40')],{'$or':_[_0x49fd('0x41')](_0x89badc[_0x49fd('0x35')],function(_0x3f73d3){var _0x5424ab={};_0x5424ab[_0x3f73d3]={'$like':'%'+_0x52b35d[_0x49fd('0x32')][_0x49fd('0x42')]+'%'};return _0x5424ab;})});}_0x89badc=_[_0x49fd('0x43')]({},_0x89badc,_0x52b35d[_0x49fd('0x44')]);var _0x115c5a={'where':_0x89badc[_0x49fd('0x40')]};return db[_0x49fd('0x2e')][_0x49fd('0x22')](_0x115c5a)['then'](function(_0x255a73){_0x203038[_0x49fd('0x22')]=_0x255a73;if(_0x52b35d['query'][_0x49fd('0x45')]){_0x89badc[_0x49fd('0x46')]=[{'all':!![]}];}return db['UserProfile'][_0x49fd('0x47')](_0x89badc);})['then'](function(_0x2f7538){_0x203038[_0x49fd('0x48')]=_0x2f7538;return _0x203038;})[_0x49fd('0x28')](respondWithFilteredResult(_0x32fc19,_0x89badc))[_0x49fd('0x49')](handleError(_0x32fc19,null));};exports['show']=function(_0x567075,_0x1ff66e){var _0x59298b={'raw':![],'where':{'id':_0x567075[_0x49fd('0x4a')]['id']}},_0xf79ed6={};_0xf79ed6[_0x49fd('0x30')]=_[_0x49fd('0x31')](db['UserProfile'][_0x49fd('0x2f')]);_0xf79ed6[_0x49fd('0x32')]=_[_0x49fd('0x31')](_0x567075[_0x49fd('0x32')]);_0xf79ed6[_0x49fd('0x3b')]=_[_0x49fd('0x34')](_0xf79ed6[_0x49fd('0x30')],_0xf79ed6[_0x49fd('0x32')]);_0x59298b[_0x49fd('0x35')]=_[_0x49fd('0x34')](_0xf79ed6[_0x49fd('0x30')],qs[_0x49fd('0x36')](_0x567075[_0x49fd('0x32')][_0x49fd('0x36')]));_0x59298b['attributes']=_0x59298b['attributes'][_0x49fd('0x4b')]?_0x59298b[_0x49fd('0x35')]:_0xf79ed6[_0x49fd('0x30')];if(_0x567075[_0x49fd('0x32')]['includeAll']){_0x59298b[_0x49fd('0x46')]=[{'all':!![]}];}_0x59298b=_[_0x49fd('0x43')]({},_0x59298b,_0x567075['options']);return db[_0x49fd('0x2e')][_0x49fd('0x4c')](_0x59298b)[_0x49fd('0x28')](handleEntityNotFound(_0x1ff66e,null))[_0x49fd('0x28')](respondWithResult(_0x1ff66e,null))[_0x49fd('0x49')](handleError(_0x1ff66e,null));};exports[_0x49fd('0x4d')]=function(_0x35273b,_0x3ea47f){return db[_0x49fd('0x2e')][_0x49fd('0x4d')](_0x35273b[_0x49fd('0x4e')],{})['then'](respondWithResult(_0x3ea47f,0xc9))[_0x49fd('0x49')](handleError(_0x3ea47f,null));};exports[_0x49fd('0x4f')]=function(_0x32694b,_0x263cf3){var _0x23457c={'raw':![],'where':{'id':_0x32694b['params']['id']}},_0x163004={};_0x163004['model']=_[_0x49fd('0x31')](db[_0x49fd('0x2e')][_0x49fd('0x2f')]);_0x23457c['attributes']=_[_0x49fd('0x34')](_0x163004[_0x49fd('0x30')],qs['fields'](_0x32694b['query']['fields']));_0x23457c[_0x49fd('0x35')]=_0x23457c['attributes']['length']?_0x23457c['attributes']:_0x163004[_0x49fd('0x30')];if(_0x32694b[_0x49fd('0x32')][_0x49fd('0x45')]){_0x23457c[_0x49fd('0x46')]=[{'all':!![]}];}_0x23457c=_[_0x49fd('0x43')]({},_0x23457c,_0x32694b[_0x49fd('0x44')]);return db[_0x49fd('0x2e')][_0x49fd('0x4c')](_0x23457c)[_0x49fd('0x28')](handleEntityNotFound(_0x263cf3,null))[_0x49fd('0x28')](function(_0x503502){if(_0x503502){var _0x444a0e=_0x503502[_0x49fd('0x50')]({'plain':!![]});_0x444a0e=qs[_0x49fd('0x51')](_0x444a0e,['id',_0x49fd('0x52'),_0x49fd('0x53'),_0x49fd('0x54')]);_0x32694b['body']=_[_0x49fd('0x51')](_0x32694b[_0x49fd('0x4e')],['id','createdAt','updatedAt']);return db[_0x49fd('0x55')]['transaction'](function(_0x3d514a){return db['UserProfile'][_0x49fd('0x4d')](_['merge'](_0x444a0e,_0x32694b[_0x49fd('0x4e')]),{'include':_0x32694b[_0x49fd('0x32')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3d514a})[_0x49fd('0x28')](function(_0xc34aed){var _0x275a68=_0xc34aed[_0x49fd('0x50')]({'plain':!![]});return db[_0x49fd('0x56')][_0x49fd('0x47')]({'where':{'userProfileId':_0x32694b[_0x49fd('0x4a')]['id']},'raw':!![]})[_0x49fd('0x28')](function(_0x50151a){if(_0x50151a){return BPromise[_0x49fd('0x57')](_0x50151a,function(_0x46f351){return new BPromise(function(_0x3732bb,_0x5d0d68){if(_0x46f351[_0x49fd('0x58')]===null||_0x46f351[_0x49fd('0x58')]===0x1)_0x3732bb(null);return db[_0x49fd('0x59')][_0x49fd('0x47')]({'where':{'sectionId':_0x46f351['id']},'raw':!![]})[_0x49fd('0x28')](function(_0x3a36e7){var _0x220ff9=_[_0x49fd('0x41')](_0x3a36e7,function(_0x61d98c){return qs['omit'](_0x61d98c,['id',_0x49fd('0x52'),_0x49fd('0x53'),'sectionId']);});_0x3732bb(_0x220ff9);})[_0x49fd('0x49')](function(_0x35eb01){_0x5d0d68(_0x35eb01);});})['then'](function(_0x596b31){var _0x5b5041=qs[_0x49fd('0x51')](_0x46f351,['id',_0x49fd('0x52'),_0x49fd('0x53')]);_0x5b5041[_0x49fd('0x5a')]=_0x275a68['id'];if(_0x596b31)_0x5b5041[_0x49fd('0x5b')]=_0x596b31;return _0x5b5041;})['then'](function(_0x7e0750){return db['UserProfileSection'][_0x49fd('0x4d')](_0x7e0750,{'include':[{'model':db['UserProfileResource'],'as':_0x49fd('0x5b')}],'raw':!![],'transaction':_0x3d514a});});})[_0x49fd('0x28')](function(){return _0x275a68;});}});});});}})[_0x49fd('0x28')](respondWithResult(_0x263cf3,0xc9))[_0x49fd('0x49')](handleError(_0x263cf3,null));};exports['update']=function(_0x16abae,_0x4feef4){if(_0x16abae['body']['id']){delete _0x16abae[_0x49fd('0x4e')]['id'];}return db[_0x49fd('0x2e')][_0x49fd('0x4c')]({'where':{'id':_0x16abae['params']['id']}})[_0x49fd('0x28')](handleEntityNotFound(_0x4feef4,null))[_0x49fd('0x28')](saveUpdates(_0x16abae[_0x49fd('0x4e')],null))[_0x49fd('0x28')](respondWithResult(_0x4feef4,null))[_0x49fd('0x49')](handleError(_0x4feef4,null));};exports[_0x49fd('0x29')]=function(_0x59281f,_0x4ac428){return db[_0x49fd('0x2e')][_0x49fd('0x4c')]({'where':{'id':_0x59281f[_0x49fd('0x4a')]['id']}})[_0x49fd('0x28')](handleEntityNotFound(_0x4ac428,null))[_0x49fd('0x28')](removeEntity(_0x4ac428,null))[_0x49fd('0x49')](handleError(_0x4ac428,null));};exports[_0x49fd('0x5c')]=function(_0x17ebd2,_0x36de5c){return db[_0x49fd('0x2e')][_0x49fd('0x5c')]()[_0x49fd('0x28')](respondWithResult(_0x36de5c,null))[_0x49fd('0x49')](handleError(_0x36de5c,null));};exports['addSections']=function(_0x37f512,_0x35a8e4){var _0x365bc3=_0x37f512['body'];return db['UserProfile'][_0x49fd('0x4c')]({'where':{'id':_0x37f512[_0x49fd('0x4a')]['id']}})[_0x49fd('0x28')](handleEntityNotFound(_0x35a8e4,null))['then'](function(_0x446911){if(_0x446911){return db[_0x49fd('0x55')][_0x49fd('0x5d')](function(_0x3ce72c){return db[_0x49fd('0x56')][_0x49fd('0x29')]({'where':{'userProfileId':_0x37f512[_0x49fd('0x4a')]['id'],'sectionId':_['map'](_0x365bc3,function(_0x58eecf){return _0x58eecf[_0x49fd('0x5e')];})},'transaction':_0x3ce72c})['then'](function(){var _0x3b94e1=_['map'](_0x365bc3,function(_0x593346){_0x593346['userProfileId']=_0x37f512[_0x49fd('0x4a')]['id'];return _0x593346;});var _0x355c5e=[];return BPromise['each'](_0x3b94e1,function(_0x52e0ac){return db[_0x49fd('0x56')]['create'](_0x52e0ac,{'include':[{'model':db[_0x49fd('0x59')],'as':_0x49fd('0x5b')}],'raw':!![],'transaction':_0x3ce72c})['then'](function(_0x3562f7){_0x355c5e['push'](_0x3562f7[_0x49fd('0x50')]({'plain':!![]}));});})[_0x49fd('0x28')](function(){return _0x355c5e;});});});}})['then'](function(_0x19dcaf){return _0x19dcaf;})[_0x49fd('0x28')](respondWithResult(_0x35a8e4,null))['catch'](handleError(_0x35a8e4,null));};exports[_0x49fd('0x5f')]=function(_0x12a2f8,_0x2e4f40){var _0x194ded;return db[_0x49fd('0x2e')][_0x49fd('0x4c')]({'where':{'id':_0x12a2f8[_0x49fd('0x4a')]['id']},'attributes':['id',_0x49fd('0x2c')]})['then'](handleEntityNotFound(_0x2e4f40,null))['then'](function(_0x209fa4){if(_0x209fa4){_0x194ded=_0x209fa4;return db[_0x49fd('0x56')]['destroy']({'where':{'userProfileId':_0x12a2f8[_0x49fd('0x4a')]['id'],'sectionId':_0x12a2f8[_0x49fd('0x32')][_0x49fd('0x60')]}});}})[_0x49fd('0x28')](function(){return _0x194ded;})[_0x49fd('0x28')](respondWithStatusCode(_0x2e4f40,null))[_0x49fd('0x49')](handleError(_0x2e4f40,null));};exports[_0x49fd('0x61')]=function(_0x4ff63a,_0x33c908){return db[_0x49fd('0x2e')][_0x49fd('0x4c')]({'where':{'id':_0x4ff63a[_0x49fd('0x4a')]['id']}})[_0x49fd('0x28')](handleEntityNotFound(_0x33c908,null))[_0x49fd('0x28')](function(_0x344143){if(_0x344143){return db['sequelize'][_0x49fd('0x5d')](function(_0x31dec5){return db[_0x49fd('0x56')][_0x49fd('0x47')]({'where':{'userProfileId':_0x4ff63a[_0x49fd('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x49fd('0x28')](function(_0x2020be){if(_0x2020be){return db[_0x49fd('0x56')][_0x49fd('0x29')]({'where':{'userProfileId':_0x4ff63a[_0x49fd('0x4a')]['id'],'id':_[_0x49fd('0x41')](_0x2020be,function(_0x40c089){return _0x40c089['id'];})},'transaction':_0x31dec5});}})[_0x49fd('0x28')](function(_0x3c96e8){var _0x14fcf7=_[_0x49fd('0x41')](_0x4ff63a[_0x49fd('0x4e')],function(_0xf1aee0){_0xf1aee0[_0x49fd('0x5a')]=_0x4ff63a[_0x49fd('0x4a')]['id'];return _0xf1aee0;});return db['UserProfileSection'][_0x49fd('0x62')](_0x14fcf7,{'raw':!![],'transaction':_0x31dec5});})['then'](function(_0x181f12){var _0x472450=_['filter'](_['map'](_0x181f12,function(_0x4138a8){return _0x4138a8[_0x49fd('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x472450){return db[_0x49fd('0x56')]['findAll']({'where':{'userProfileId':_0x4ff63a[_0x49fd('0x4a')]['id'],'sectionId':_['map'](_0x472450,function(_0x1dde00){return _0x1dde00[_0x49fd('0x5e')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x51afb5){var _0x3090fd=_['map'](_0x4ff63a[_0x49fd('0x4e')],function(_0x1d4ef0){_0x1d4ef0[_0x49fd('0x5a')]=_0x4ff63a['params']['id'];return _0x1d4ef0;});return db[_0x49fd('0x59')][_0x49fd('0x62')](_0x3090fd,{'raw':!![],'transaction':_0x31dec5});});}})[_0x49fd('0x49')](handleError(_0x33c908,null));});}})[_0x49fd('0x28')](function(_0x58d948){var _0x158ff2=_[_0x49fd('0x41')](_0x58d948,function(_0x1eb149){return _0x1eb149['get']({'plain':!![]});});})[_0x49fd('0x28')](respondWithResult(_0x33c908,null))[_0x49fd('0x49')](handleError(_0x33c908,null));};exports[_0x49fd('0x63')]=function(_0x43477d,_0x5473dd,_0x3e2b65){var _0x268029;return db[_0x49fd('0x2e')][_0x49fd('0x4c')]({'where':{'id':_0x43477d['params']['id']}})['then'](handleEntityNotFound(_0x5473dd,null))[_0x49fd('0x28')](function(_0x5a86b0){if(_0x5a86b0){return _0x5a86b0[_0x49fd('0x63')](_0x43477d[_0x49fd('0x32')][_0x49fd('0x60')]);}})[_0x49fd('0x28')](respondWithStatusCode(_0x5473dd,null))['catch'](handleError(_0x5473dd,null));};exports[_0x49fd('0x64')]=function(_0x1a0bec,_0x574e8a){var _0x557189={'raw':![],'where':{}};var _0x20f97d={};var _0x57a435={'count':0x0,'rows':[]};var _0x2b506c=_0x1a0bec[_0x49fd('0x32')][_0x49fd('0x65')];if(typeof _0x2b506c==='undefined'){throw new db[(_0x49fd('0x66'))]['ValidationError'](_0x49fd('0x67'));}var _0x5d638d=_0x1a0bec[_0x49fd('0x32')]['mergeResources']||![];var _0x5c28d7=getQueryModels(_0x2b506c,_0x5d638d);if(typeof _0x5c28d7[_0x49fd('0x68')]==='undefined'){throw new db[(_0x49fd('0x66'))][(_0x49fd('0x69'))](_0x49fd('0x6a')+_0x2b506c+'\x27');}var _0x5e1943=[];if(!_[_0x49fd('0x6b')](_0x5c28d7['parentSections'])){_0x5e1943=_0x5c28d7[_0x49fd('0x6c')];}else{_0x5e1943=[{'name':_0x2b506c}];}return db['UserProfile'][_0x49fd('0x6d')]({'where':{'id':_0x1a0bec['params']['id']}})['then'](handleEntityNotFound(_0x574e8a,null))['then'](function(_0x4d75f1){if(_0x4d75f1){var _0x53cc83=[];for(var _0x17c7d8=0x0;_0x17c7d8<_0x5e1943[_0x49fd('0x4b')];_0x17c7d8++){_0x53cc83[_0x49fd('0x6e')](db['UserProfileSection'][_0x49fd('0x6d')]({'where':{'userProfileId':_0x4d75f1['id'],'name':_0x5e1943[_0x17c7d8][_0x49fd('0x2c')]},'raw':!![]}));}return BPromise[_0x49fd('0x6f')](_0x53cc83);}})['then'](function(_0x2ce520){var _0x591bbc=_[_0x49fd('0x42')](_0x2ce520,function(_0x485396){return _0x485396?_0x485396:undefined;});var _0xd23a0a=_[_0x49fd('0x42')](_0x5e1943,[_0x49fd('0x70'),!![]]);var _0x292613=_[_0x49fd('0x6b')](_0x591bbc)&&_[_0x49fd('0x6b')](_0xd23a0a)?null:_[_0x49fd('0x71')](_0xd23a0a,_0x591bbc);if(_0x292613){var _0x265b81=[];for(var _0x49cd5f=0x0;_0x49cd5f<_0x292613[_0x49fd('0x4b')];_0x49cd5f++){var _0x11b242=_['find'](_0x5e1943,function(_0x30c14a){return _0x292613[_0x49cd5f]?_0x30c14a['name']===_0x292613[_0x49cd5f]['name']:null;});if(_0x11b242){if(_0x292613[_0x49cd5f][_0x49fd('0x70')]){_0x265b81[_0x49fd('0x6e')](getAllResources(_0x5c28d7['childModel'],_0x292613[_0x49cd5f]));}else{if(!_0x292613[_0x49cd5f][_0x49fd('0x58')]){_0x265b81[_0x49fd('0x6e')](getAllowedResources(_0x11b242,_0x292613[_0x49cd5f]));}else{if(_0x11b242[_0x49fd('0x30')]){_0x265b81[_0x49fd('0x6e')](getAllFilteredResources(_0x11b242,_0x292613[_0x49cd5f]));}}}}}return BPromise[_0x49fd('0x6f')](_0x265b81);}else{return null;}})[_0x49fd('0x28')](function(_0x4d292b){var _0x4b3b42=_0x4d292b;var _0x549914=null;if(_0x4b3b42){_0x549914=_0x4b3b42[_0x49fd('0x4b')]===0x1?_0x4b3b42[0x0]:null;}if(_0x549914||_0x4b3b42){_0x20f97d['model']=_[_0x49fd('0x31')](db[_0x5c28d7[_0x49fd('0x68')]][_0x49fd('0x2f')]);_0x20f97d[_0x49fd('0x32')]=_['keys'](_0x1a0bec['query']);_0x20f97d[_0x49fd('0x3b')]=_[_0x49fd('0x34')](_0x20f97d['model'],_0x20f97d[_0x49fd('0x32')]);_0x557189[_0x49fd('0x35')]=_[_0x49fd('0x34')](_0x20f97d['model'],qs[_0x49fd('0x36')](_0x1a0bec[_0x49fd('0x32')][_0x49fd('0x36')]));_0x557189[_0x49fd('0x35')]=_0x557189[_0x49fd('0x35')][_0x49fd('0x4b')]?_0x557189[_0x49fd('0x35')]:_0x20f97d['model'];if(!_0x1a0bec[_0x49fd('0x32')]['hasOwnProperty'](_0x49fd('0x38'))){_0x557189[_0x49fd('0x24')]=qs['limit'](_0x1a0bec['query']['limit']);_0x557189[_0x49fd('0x23')]=qs['offset'](_0x1a0bec[_0x49fd('0x32')][_0x49fd('0x23')]);}_0x557189[_0x49fd('0x39')]=qs[_0x49fd('0x3a')](_0x1a0bec[_0x49fd('0x32')][_0x49fd('0x3a')]);_0x557189[_0x49fd('0x40')]=qs[_0x49fd('0x3b')](_[_0x49fd('0x3c')](_0x1a0bec[_0x49fd('0x32')],_0x20f97d[_0x49fd('0x3b')]));var _0x4b3d1a=[];if(_0x549914){var _0x584e64=_[_0x49fd('0x4c')](_0x5e1943,[_0x49fd('0x2c'),_0x549914[_0x49fd('0x2c')]]);if(_0x584e64['field']){var _0x178473={};_0x178473[_0x584e64['foreignKey']]=_0x549914[_0x49fd('0x72')];_0x4b3d1a[_0x49fd('0x6e')](_0x178473);}else{_0x557189['where']['id']=_0x549914[_0x49fd('0x72')];}}else{var _0x4b3d1a=[];for(var _0x1b1592=0x0;_0x1b1592<_0x4b3b42[_0x49fd('0x4b')];_0x1b1592++){var _0x584e64=_[_0x49fd('0x4c')](_0x5e1943,['name',_0x4b3b42[_0x1b1592][_0x49fd('0x2c')]]);if(_0x584e64[_0x49fd('0x73')]){var _0x178473={};if(_0x584e64['field']==='id'){_0x178473[_0x584e64[_0x49fd('0x74')]]=_0x4b3b42[_0x1b1592]['resourceIds'];}else{_0x178473[_0x584e64[_0x49fd('0x74')]]=_0x4b3b42[_0x1b1592][_0x49fd('0x75')];}}else{if(!_0x557189[_0x49fd('0x40')]['id'])_0x557189[_0x49fd('0x40')]['id']=[];_0x4b3b42[_0x1b1592]['resourceIds'][_0x49fd('0x76')](function(_0x46dac5){_0x557189['where']['id'][_0x49fd('0x6e')](_0x46dac5);});}}}if(!_['isEmpty'](_0x4b3d1a)){_0x557189['where']=_[_0x49fd('0x43')](_0x557189['where'],{'$or':_0x4b3d1a});}if(_0x1a0bec[_0x49fd('0x32')]['filter']){_0x557189['where']=_[_0x49fd('0x43')](_0x557189[_0x49fd('0x40')],{'$or':_[_0x49fd('0x41')](_0x557189['attributes'],function(_0x12e15c){var _0x310dd6={};_0x310dd6[_0x12e15c]={'$like':'%'+_0x1a0bec[_0x49fd('0x32')][_0x49fd('0x42')]+'%'};return _0x310dd6;})});}_0x557189=_[_0x49fd('0x43')]({},_0x557189,_0x1a0bec['options']);if(_0x549914&&!_0x549914['autoAssociation']&&_0x5c28d7[_0x49fd('0x68')]===_0x49fd('0x77')){if(_0x1a0bec[_0x49fd('0x32')][_0x49fd('0x45')]){_0x557189['include']=[{'all':!![]}];}return db[_0x5c28d7['childModel']][_0x49fd('0x47')](_0x557189)[_0x49fd('0x28')](function(_0x10f44b){var _0x104ac9=[];_0x10f44b[_0x49fd('0x76')](function(_0xa1e8c7){var _0x1bc0da;switch(_0xa1e8c7[_0x49fd('0x78')]){case _0x49fd('0x79'):_0x1bc0da=_[_0x49fd('0x4c')](_0x549914[_0x49fd('0x72')],function(_0x596917){return _0x596917['id']===_0xa1e8c7[_0x49fd('0x7a')]&&_0x596917[_0x49fd('0x7b')]===_0x49fd('0x7c');});break;case _0x49fd('0x7d'):_0x1bc0da=_[_0x49fd('0x4c')](_0x549914['resourceIds'],function(_0x300699){return _0x300699['id']===_0xa1e8c7[_0x49fd('0x7a')]&&_0x300699[_0x49fd('0x7b')]===_0x49fd('0x7e');});break;}if(_0x1bc0da)_0x104ac9[_0x49fd('0x6e')](_0xa1e8c7);});_0x57a435['count']=_0x104ac9[_0x49fd('0x4b')];_0x57a435[_0x49fd('0x48')]=_0x104ac9;return _0x57a435;});}else{return db[_0x5c28d7['childModel']]['count']({'where':_0x557189['where']})[_0x49fd('0x28')](function(_0x22be73){_0x57a435[_0x49fd('0x22')]=_0x22be73;if(_0x1a0bec[_0x49fd('0x32')][_0x49fd('0x45')]){if(_0x5c28d7['childModel']===_0x49fd('0x7f')){_0x557189[_0x49fd('0x46')]=[{'model':db[_0x49fd('0x80')],'as':_0x49fd('0x81'),'attributes':['id',_0x49fd('0x2c'),_0x49fd('0x82')],'required':_0x1a0bec['query'][_0x49fd('0x83')]?!![]:![]},{'model':db[_0x49fd('0x80')],'as':_0x49fd('0x84'),'attributes':['id','name','color'],'through':_0x1a0bec[_0x49fd('0x32')][_0x49fd('0x83')]?{'attributes':[],'where':{'TagId':_0x1a0bec[_0x49fd('0x32')][_0x49fd('0x83')]||undefined}}:{},'required':_0x1a0bec[_0x49fd('0x32')][_0x49fd('0x83')]?!![]:![]}];}else{_0x557189[_0x49fd('0x46')]=[{'all':!![]}];}}return db[_0x5c28d7[_0x49fd('0x68')]]['findAll'](_0x557189);})['then'](function(_0x336b0b){_0x57a435['rows']=_0x336b0b;return _0x57a435;});}}else{return _0x57a435;}})['then'](respondWithFilteredResult(_0x574e8a,_0x557189))['catch'](handleError(_0x574e8a,null));};function getAllResources(_0x487311,_0x3ab862){return new BPromise(function(_0x395797,_0x450703){if(_0x3ab862){var _0x575489=_0x3ab862[_0x49fd('0x42')]?{[_0x3ab862['filter'][_0x49fd('0x73')]]:_0x3ab862[_0x49fd('0x42')]['value']}:undefined;return db[_0x487311][_0x49fd('0x47')]({'where':_0x575489,'raw':!![]})[_0x49fd('0x28')](function(_0x40ae1d){_0x3ab862[_0x49fd('0x72')]=_[_0x49fd('0x41')](_0x40ae1d,'id');_0x395797(_0x3ab862);})[_0x49fd('0x49')](function(_0x1e9794){_0x450703(_0x1e9794);});}else{_0x395797(null);}});}function getAllFilteredResources(_0x6a31c3,_0x2c5329){return new BPromise(function(_0x2aeb55,_0x1d219c){var _0x17aa93=_0x6a31c3[_0x49fd('0x42')]?{[_0x6a31c3[_0x49fd('0x42')]['field']]:_0x6a31c3[_0x49fd('0x42')]['value']}:undefined;return db[_0x6a31c3[_0x49fd('0x30')]]['findAll']({'where':_0x17aa93,'raw':!![]})[_0x49fd('0x28')](function(_0x33ddf0){_0x2c5329[_0x49fd('0x75')]=_[_0x49fd('0x41')](_0x33ddf0,function(_0x34e4d2){return _0x34e4d2[_0x49fd('0x2c')];});_0x2aeb55(_0x2c5329);})[_0x49fd('0x49')](function(_0x2ddf74){_0x1d219c(_0x2ddf74);});});}function getAllowedResources(_0x286476,_0x10eb9a){return new BPromise(function(_0x2b4707,_0x5c3270){if(_0x10eb9a){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x10eb9a['id']},'raw':!![]})[_0x49fd('0x28')](function(_0x2bc999){if(_0x286476[_0x49fd('0x73')]&&_0x286476[_0x49fd('0x73')]!=='id'){_0x10eb9a[_0x49fd('0x75')]=_[_0x49fd('0x41')](_0x2bc999,function(_0x300892){return _0x300892[_0x286476[_0x49fd('0x73')]];});}else{if(_0x286476[_0x49fd('0x68')]==='AnalyticExtractedReport'){_0x10eb9a[_0x49fd('0x72')]=_[_0x49fd('0x41')](_0x2bc999,function(_0x19d64d){return{'id':_0x19d64d[_0x49fd('0x85')],'type':_0x19d64d[_0x49fd('0x7b')]};});}else{_0x10eb9a[_0x49fd('0x72')]=_[_0x49fd('0x41')](_0x2bc999,function(_0x3cfffc){return _0x3cfffc[_0x49fd('0x85')];});}}_0x2b4707(_0x10eb9a);})[_0x49fd('0x49')](function(_0x5e2bf2){_0x5c3270(_0x5e2bf2);});}else{_0x2b4707(null);}});}function getQueryModels(_0x498290,_0x13094e){var _0x23e5b3=_0x498290[_0x49fd('0x86')]();var _0x211085={'childModel':undefined,'parentSections':[]};switch(_0x23e5b3){case'squareprojects':_0x211085[_0x49fd('0x68')]=_0x49fd('0x87');break;case _0x49fd('0x88'):_0x211085['childModel']=_0x49fd('0x89');break;case _0x49fd('0x8a'):_0x211085[_0x49fd('0x68')]=_0x49fd('0x8b');_0x211085[_0x49fd('0x6c')]=[{'name':_0x49fd('0x8c'),'field':_0x49fd('0x2c'),'foreignKey':_0x49fd('0x8d')}];break;case _0x49fd('0x8e'):_0x211085[_0x49fd('0x68')]='JscriptyProject';break;case'contacts':_0x211085[_0x49fd('0x68')]=_0x49fd('0x7f');_0x211085['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x49fd('0x8f'),'model':_0x49fd('0x90')}];break;case'lists':_0x211085[_0x49fd('0x68')]='CmList';break;case'companies':_0x211085[_0x49fd('0x68')]='CmCompany';break;case _0x49fd('0x91'):_0x211085[_0x49fd('0x68')]='CmCustomField';break;case _0x49fd('0x92'):_0x211085[_0x49fd('0x68')]=_0x49fd('0x93');break;case'chatwebsites':_0x211085[_0x49fd('0x68')]=_0x49fd('0x94');break;case _0x49fd('0x95'):_0x211085[_0x49fd('0x68')]=_0x49fd('0x96');break;case _0x49fd('0x97'):_0x211085['childModel']=_0x49fd('0x98');break;case'inboundroutes':case _0x49fd('0x99'):case _0x49fd('0x9a'):_0x211085['childModel']=_0x49fd('0x9b');break;case _0x49fd('0x9c'):_0x211085['childModel']=_0x49fd('0x9d');break;case _0x49fd('0x9e'):_0x211085['childModel']=_0x49fd('0x9f');break;case'voicerecordings':_0x211085[_0x49fd('0x68')]=_0x49fd('0xa0');_0x211085[_0x49fd('0x6c')]=[{'name':_0x49fd('0xa1'),'field':'name','foreignKey':'membername','model':_0x49fd('0xa2'),'filter':{'field':'role','value':[_0x49fd('0xa3')]}},{'name':_0x49fd('0xa4'),'field':_0x49fd('0x2c'),'foreignKey':'membername','model':_0x49fd('0xa2'),'filter':{'field':'role','value':[_0x49fd('0xa5')]}},{'name':_0x49fd('0xa6'),'field':_0x49fd('0x2c'),'foreignKey':_0x49fd('0xa7'),'model':_0x49fd('0xa8')}];break;case _0x49fd('0xa9'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xaa');break;case _0x49fd('0xab'):_0x211085[_0x49fd('0x68')]='VoiceChanSpy';break;case'voiceprefixes':_0x211085[_0x49fd('0x68')]=_0x49fd('0xac');break;case _0x49fd('0xad'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xae');break;case _0x49fd('0xaf'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xb0');break;case _0x49fd('0xb1'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xb2');break;case _0x49fd('0xb3'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xb4');break;case _0x49fd('0xb5'):_0x211085['childModel']='OpenchannelQueue';break;case _0x49fd('0xb6'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xb7');break;case'smsqueues':_0x211085['childModel']=_0x49fd('0xb8');break;case _0x49fd('0xb9'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xba');break;case _0x49fd('0xbb'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xbc');break;case _0x49fd('0xbd'):case'queuecampaigns':_0x211085[_0x49fd('0x68')]=_0x49fd('0xa8');if(_0x13094e){_0x211085['parentSections']=[{'name':_0x49fd('0xa6')},{'name':_0x49fd('0xbe')}];}break;case'users':case _0x49fd('0xbf'):case'telephones':_0x211085[_0x49fd('0x68')]='User';if(_0x13094e){_0x211085[_0x49fd('0x6c')]=[{'name':_0x49fd('0xc0'),'filter':{'field':'role','value':[_0x49fd('0xc1'),_0x49fd('0xc2')]},'ignore':!![]},{'name':_0x49fd('0xa1')},{'name':_0x49fd('0xa4')}];}break;case _0x49fd('0xc3'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xc4');break;case _0x49fd('0xc5'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xc6');break;case _0x49fd('0xc7'):_0x211085['childModel']=_0x49fd('0xc8');break;case _0x49fd('0xc9'):_0x211085['childModel']='SugarcrmAccount';break;case _0x49fd('0xca'):_0x211085[_0x49fd('0x68')]='DeskAccount';break;case'zohoaccounts':_0x211085[_0x49fd('0x68')]=_0x49fd('0xcb');break;case'vtigeraccounts':_0x211085[_0x49fd('0x68')]=_0x49fd('0xa2');break;case _0x49fd('0xcc'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xcd');break;case _0x49fd('0xce'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xcf');break;case _0x49fd('0xd0'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xd1');break;case _0x49fd('0xd2'):_0x211085['childModel']=_0x49fd('0xd3');break;case _0x49fd('0xd4'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xd5');break;case _0x49fd('0xd6'):_0x211085['childModel']='Schedule';break;case'sounds':_0x211085[_0x49fd('0x68')]='Sound';break;case _0x49fd('0xd7'):_0x211085[_0x49fd('0x68')]=_0x49fd('0x80');break;case'templates':_0x211085['childModel']=_0x49fd('0xd8');break;case _0x49fd('0xd9'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xda');break;case _0x49fd('0xdb'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xdc');break;case'variables':_0x211085[_0x49fd('0x68')]=_0x49fd('0xdd');break;case _0x49fd('0xde'):_0x211085[_0x49fd('0x68')]=_0x49fd('0xdf');break;case _0x49fd('0xe0'):_0x211085[_0x49fd('0x68')]=_0x49fd('0x77');_0x211085['parentSections']=[{'name':_0x49fd('0xe1'),'field':'id','foreignKey':_0x49fd('0x7a')}];break;case'metrics':_0x211085[_0x49fd('0x68')]='AnalyticMetric';break;default:return _0x211085;}return _0x211085;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ac8331c..3fdbbf7 100644 --- a/server/api/userProfile/userProfile.events.js +++ b/server/api/userProfile/userProfile.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ccb=['remove','emit','exports','UserProfile','setMaxListeners','save'];(function(_0x235f61,_0x504d07){var _0x406115=function(_0x1ae128){while(--_0x1ae128){_0x235f61['push'](_0x235f61['shift']());}};_0x406115(++_0x504d07);}(_0x1ccb,0x105));var _0xb1cc=function(_0x8f6f7,_0x15c3e0){_0x8f6f7=_0x8f6f7-0x0;var _0x49452a=_0x1ccb[_0x8f6f7];return _0x49452a;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0xb1cc('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb1cc('0x1')](0x0);var events={'afterCreate':_0xb1cc('0x2'),'afterUpdate':'update','afterDestroy':_0xb1cc('0x3')};function emitEvent(_0x438aac){return function(_0x44f519,_0x55d57d,_0x46a689){UserProfileEvents[_0xb1cc('0x4')](_0x438aac+':'+_0x44f519['id'],_0x44f519);UserProfileEvents[_0xb1cc('0x4')](_0x438aac,_0x44f519);_0x46a689(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xb1cc('0x5')]=UserProfileEvents; \ No newline at end of file +var _0xe643=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0xe643,0x84));var _0x3e64=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe643[_0x465028];return _0xb783d4;};'use strict';var EventEmitter=require(_0x3e64('0x0'));var UserProfile=require(_0x3e64('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3e64('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e64('0x3'),'afterDestroy':_0x3e64('0x4')};function emitEvent(_0x39eadd){return function(_0x12eb74,_0x13b250,_0x5d4a4e){UserProfileEvents[_0x3e64('0x5')](_0x39eadd+':'+_0x12eb74['id'],_0x12eb74);UserProfileEvents[_0x3e64('0x5')](_0x39eadd,_0x12eb74);_0x5d4a4e(null);};}for(var e in events){if(events[_0x3e64('0x6')](e)){var event=events[e];UserProfile[_0x3e64('0x7')](e,emitEvent(event));}}module[_0x3e64('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index c33d950..68324f1 100644 --- a/server/api/userProfile/userProfile.model.js +++ b/server/api/userProfile/userProfile.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a87=['./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5ea45a,_0x15b633){var _0x168266=function(_0x1a076b){while(--_0x1a076b){_0x5ea45a['push'](_0x5ea45a['shift']());}};_0x168266(++_0x15b633);}(_0x8a87,0xa5));var _0x78a8=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0x8a87[_0x57645b];return _0xe82f00;};'use strict';var _=require(_0x78a8('0x0'));var util=require('util');var logger=require(_0x78a8('0x1'))(_0x78a8('0x2'));var moment=require('moment');var BPromise=require(_0x78a8('0x3'));var rp=require(_0x78a8('0x4'));var attributes=require(_0x78a8('0x5'));module[_0x78a8('0x6')]=function(_0x1af067,_0xfb491f){return _0x1af067[_0x78a8('0x7')](_0x78a8('0x8'),attributes,{'tableName':_0x78a8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x698a=['moment','bluebird','exports','define','UserProfile','lodash','util','../../config/logger','api'];(function(_0x2ec723,_0x1257b9){var _0x2fc54b=function(_0x50ece8){while(--_0x50ece8){_0x2ec723['push'](_0x2ec723['shift']());}};_0x2fc54b(++_0x1257b9);}(_0x698a,0x10a));var _0xa698=function(_0x4e0c31,_0x208e9f){_0x4e0c31=_0x4e0c31-0x0;var _0x3fd7df=_0x698a[_0x4e0c31];return _0x3fd7df;};'use strict';var _=require(_0xa698('0x0'));var util=require(_0xa698('0x1'));var logger=require(_0xa698('0x2'))(_0xa698('0x3'));var moment=require(_0xa698('0x4'));var BPromise=require(_0xa698('0x5'));var rp=require('request-promise');var attributes=require('./userProfile.attributes');module[_0xa698('0x6')]=function(_0x33c713,_0x5d3816){return _0x33c713[_0xa698('0x7')](_0xa698('0x8'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 2f676b9..aaa4793 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x876e=['client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x29632e,_0x5ecba4){var _0x426e04=function(_0x4eb357){while(--_0x4eb357){_0x29632e['push'](_0x29632e['shift']());}};_0x426e04(++_0x5ecba4);}(_0x876e,0x14b));var _0xe876=function(_0x321f2f,_0xec1294){_0x321f2f=_0x321f2f-0x0;var _0x50573c=_0x876e[_0x321f2f];return _0x50573c;};'use strict';var _=require(_0xe876('0x0'));var util=require(_0xe876('0x1'));var moment=require(_0xe876('0x2'));var BPromise=require(_0xe876('0x3'));var rs=require(_0xe876('0x4'));var fs=require('fs');var Redis=require(_0xe876('0x5'));var db=require(_0xe876('0x6'))['db'];var utils=require(_0xe876('0x7'));var logger=require(_0xe876('0x8'))(_0xe876('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe876('0xa')][_0xe876('0xb')]({'port':0x232a});config[_0xe876('0xc')]=_[_0xe876('0xd')](config[_0xe876('0xc')],{'host':_0xe876('0xe'),'port':0x18eb});var socket=require(_0xe876('0xf'))(new Redis(config[_0xe876('0xc')]));require(_0xe876('0x10'))[_0xe876('0x11')](socket);function respondWithRpcPromise(_0x2e20a9,_0x313e39,_0x79cb09){return new BPromise(function(_0xf8dc42,_0x50e581){return client[_0xe876('0x12')](_0x2e20a9,_0x79cb09)[_0xe876('0x13')](function(_0x44babf){logger['info'](_0xe876('0x14'),_0x313e39,_0xe876('0x15'));logger[_0xe876('0x16')](_0xe876('0x17'),_0x313e39,_0xe876('0x15'),JSON[_0xe876('0x18')](_0x44babf));if(_0x44babf['error']){if(_0x44babf[_0xe876('0x19')][_0xe876('0x1a')]===0x1f4){logger[_0xe876('0x19')]('UserProfile,\x20%s,\x20%s',_0x313e39,_0x44babf['error'][_0xe876('0x1b')]);return _0x50e581(_0x44babf[_0xe876('0x19')]['message']);}logger[_0xe876('0x19')]('UserProfile,\x20%s,\x20%s',_0x313e39,_0x44babf['error'][_0xe876('0x1b')]);return _0xf8dc42(_0x44babf[_0xe876('0x19')][_0xe876('0x1b')]);}else{logger[_0xe876('0x1c')](_0xe876('0x14'),_0x313e39,_0xe876('0x15'));_0xf8dc42(_0x44babf[_0xe876('0x1d')][_0xe876('0x1b')]);}})[_0xe876('0x1e')](function(_0x1dacc0){logger[_0xe876('0x19')](_0xe876('0x14'),_0x313e39,_0x1dacc0);_0x50e581(_0x1dacc0);});});} \ No newline at end of file +var _0x591e=['../../config/environment','jayson/promise','client','http','redis','defaults','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x20d619,_0x2e7541){var _0xa5d938=function(_0x57df36){while(--_0x57df36){_0x20d619['push'](_0x20d619['shift']());}};_0xa5d938(++_0x2e7541);}(_0x591e,0x110));var _0xe591=function(_0x516b02,_0x4d806d){_0x516b02=_0x516b02-0x0;var _0x24c729=_0x591e[_0x516b02];return _0x24c729;};'use strict';var _=require(_0xe591('0x0'));var util=require(_0xe591('0x1'));var moment=require(_0xe591('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe591('0x3'));var db=require(_0xe591('0x4'))['db'];var utils=require(_0xe591('0x5'));var logger=require(_0xe591('0x6'))(_0xe591('0x7'));var config=require(_0xe591('0x8'));var jayson=require(_0xe591('0x9'));var client=jayson[_0xe591('0xa')][_0xe591('0xb')]({'port':0x232a});config[_0xe591('0xc')]=_[_0xe591('0xd')](config[_0xe591('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe591('0xc')]));require(_0xe591('0xe'))['register'](socket);function respondWithRpcPromise(_0x41093a,_0x3fe87e,_0x34b7a7){return new BPromise(function(_0x47ef3e,_0x92c17d){return client[_0xe591('0xf')](_0x41093a,_0x34b7a7)[_0xe591('0x10')](function(_0x34427c){logger[_0xe591('0x11')](_0xe591('0x12'),_0x3fe87e,_0xe591('0x13'));logger[_0xe591('0x14')](_0xe591('0x15'),_0x3fe87e,_0xe591('0x13'),JSON[_0xe591('0x16')](_0x34427c));if(_0x34427c[_0xe591('0x17')]){if(_0x34427c[_0xe591('0x17')][_0xe591('0x18')]===0x1f4){logger[_0xe591('0x17')](_0xe591('0x12'),_0x3fe87e,_0x34427c['error']['message']);return _0x92c17d(_0x34427c[_0xe591('0x17')][_0xe591('0x19')]);}logger[_0xe591('0x17')](_0xe591('0x12'),_0x3fe87e,_0x34427c[_0xe591('0x17')]['message']);return _0x47ef3e(_0x34427c[_0xe591('0x17')]['message']);}else{logger[_0xe591('0x11')](_0xe591('0x12'),_0x3fe87e,'request\x20sent');_0x47ef3e(_0x34427c[_0xe591('0x1a')][_0xe591('0x19')]);}})[_0xe591('0x1b')](function(_0x3894fd){logger[_0xe591('0x17')](_0xe591('0x12'),_0x3fe87e,_0x3894fd);_0x92c17d(_0x3894fd);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index fc9131c..6458712 100644 --- a/server/api/userProfile/userProfile.socket.js +++ b/server/api/userProfile/userProfile.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd307=['./userProfile.events','save','remove','update','emit','removeListener','length','userProfile:'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd307,0x110));var _0x7d30=function(_0xe884ae,_0x4e9a14){_0xe884ae=_0xe884ae-0x0;var _0x4c69ee=_0xd307[_0xe884ae];return _0x4c69ee;};'use strict';var UserProfileEvents=require(_0x7d30('0x0'));var events=[_0x7d30('0x1'),_0x7d30('0x2'),_0x7d30('0x3')];function createListener(_0x2917cd,_0x3c6f99){return function(_0x359ef3){_0x3c6f99[_0x7d30('0x4')](_0x2917cd,_0x359ef3);};}function removeListener(_0x57cf6e,_0x2a0bb8){return function(){UserProfileEvents[_0x7d30('0x5')](_0x57cf6e,_0x2a0bb8);};}exports['register']=function(_0x400916){for(var _0x449938=0x0,_0x9451ed=events[_0x7d30('0x6')];_0x449938<_0x9451ed;_0x449938++){var _0x43b35e=events[_0x449938];var _0x1ef3e7=createListener(_0x7d30('0x7')+_0x43b35e,_0x400916);UserProfileEvents['on'](_0x43b35e,_0x1ef3e7);}}; \ No newline at end of file +var _0x0be3=['removeListener','userProfile:','remove','update'];(function(_0x2f6cda,_0x3e8d02){var _0x430801=function(_0x3a91d2){while(--_0x3a91d2){_0x2f6cda['push'](_0x2f6cda['shift']());}};_0x430801(++_0x3e8d02);}(_0x0be3,0x9a));var _0x30be=function(_0x234775,_0x33ed07){_0x234775=_0x234775-0x0;var _0xb6bd02=_0x0be3[_0x234775];return _0xb6bd02;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x30be('0x0'),_0x30be('0x1')];function createListener(_0xb63525,_0x556f73){return function(_0xa66e58){_0x556f73['emit'](_0xb63525,_0xa66e58);};}function removeListener(_0x44abbe,_0x2dda13){return function(){UserProfileEvents[_0x30be('0x2')](_0x44abbe,_0x2dda13);};}exports['register']=function(_0x47ef09){for(var _0x429488=0x0,_0xdc3ff5=events['length'];_0x429488<_0xdc3ff5;_0x429488++){var _0x124baf=events[_0x429488];var _0x4207d3=createListener(_0x30be('0x3')+_0x124baf,_0x47ef09);UserProfileEvents['on'](_0x124baf,_0x4207d3);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index fe7463d..0727481 100644 --- a/server/api/userProfileResource/index.js +++ b/server/api/userProfileResource/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c8e=['exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','post','create','put','update','delete'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x3c8e,0x89));var _0xe3c8=function(_0xe634a6,_0x220525){_0xe634a6=_0xe634a6-0x0;var _0x170a06=_0x3c8e[_0xe634a6];return _0x170a06;};'use strict';var multer=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe3c8('0x2'));var router=express[_0xe3c8('0x3')]();var auth=require(_0xe3c8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe3c8('0x5'));var controller=require(_0xe3c8('0x6'));router[_0xe3c8('0x7')]('/',auth[_0xe3c8('0x8')](),controller['index']);router[_0xe3c8('0x7')](_0xe3c8('0x9'),auth[_0xe3c8('0x8')](),controller[_0xe3c8('0xa')]);router[_0xe3c8('0x7')]('/:id',auth[_0xe3c8('0x8')](),controller['show']);router[_0xe3c8('0xb')]('/',auth[_0xe3c8('0x8')](),controller[_0xe3c8('0xc')]);router[_0xe3c8('0xd')]('/:id',auth[_0xe3c8('0x8')](),controller[_0xe3c8('0xe')]);router[_0xe3c8('0xf')]('/:id',auth[_0xe3c8('0x8')](),controller['destroy']);module[_0xe3c8('0x10')]=router; \ No newline at end of file +var _0x9148=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x24516c,_0x59fcd8){var _0xaf2987=function(_0x9f8828){while(--_0x9f8828){_0x24516c['push'](_0x24516c['shift']());}};_0xaf2987(++_0x59fcd8);}(_0x9148,0x10d));var _0x8914=function(_0x150152,_0x1a4dfa){_0x150152=_0x150152-0x0;var _0x1b10c2=_0x9148[_0x150152];return _0x1b10c2;};'use strict';var multer=require(_0x8914('0x0'));var util=require(_0x8914('0x1'));var path=require(_0x8914('0x2'));var timeout=require(_0x8914('0x3'));var express=require(_0x8914('0x4'));var router=express[_0x8914('0x5')]();var auth=require(_0x8914('0x6'));var interaction=require(_0x8914('0x7'));var config=require(_0x8914('0x8'));var controller=require(_0x8914('0x9'));router[_0x8914('0xa')]('/',auth['isAuthenticated'](),controller[_0x8914('0xb')]);router['get'](_0x8914('0xc'),auth['isAuthenticated'](),controller[_0x8914('0xd')]);router[_0x8914('0xa')](_0x8914('0xe'),auth[_0x8914('0xf')](),controller['show']);router[_0x8914('0x10')]('/',auth[_0x8914('0xf')](),controller[_0x8914('0x11')]);router[_0x8914('0x12')](_0x8914('0xe'),auth['isAuthenticated'](),controller[_0x8914('0x13')]);router[_0x8914('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8914('0x15')]);module[_0x8914('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e0104dd..73d5da9 100644 --- a/server/api/userProfileResource/userProfileResource.attributes.js +++ b/server/api/userProfileResource/userProfileResource.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfea=['STRING'];(function(_0x25e185,_0x389990){var _0x540be2=function(_0x1789ea){while(--_0x1789ea){_0x25e185['push'](_0x25e185['shift']());}};_0x540be2(++_0x389990);}(_0xcfea,0x1f4));var _0xacfe=function(_0x3298cd,_0x46783d){_0x3298cd=_0x3298cd-0x0;var _0x44f126=_0xcfea[_0x3298cd];return _0x44f126;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xacfe('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xcf63=['STRING','INTEGER','exports'];(function(_0x39a12a,_0x363fd2){var _0x2e8100=function(_0x2cd694){while(--_0x2cd694){_0x39a12a['push'](_0x39a12a['shift']());}};_0x2e8100(++_0x363fd2);}(_0xcf63,0x12b));var _0x3cf6=function(_0x4171bf,_0x4322f3){_0x4171bf=_0x4171bf-0x0;var _0x18a433=_0xcf63[_0x4171bf];return _0x18a433;};'use strict';var Sequelize=require('sequelize');module[_0x3cf6('0x0')]={'name':{'type':Sequelize[_0x3cf6('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3cf6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3cf6('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 2e619bf..7ce51bb 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0269=['order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','params','rawAttributes','create','body','update','find','describe','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','index','UserProfileResource','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3d58d7,_0x100900){var _0x282e75=function(_0x9eca1f){while(--_0x9eca1f){_0x3d58d7['push'](_0x3d58d7['shift']());}};_0x282e75(++_0x100900);}(_0x0269,0x135));var _0x9026=function(_0x4a5a2b,_0x9cbfc3){_0x4a5a2b=_0x4a5a2b-0x0;var _0x2034e0=_0x0269[_0x4a5a2b];return _0x2034e0;};'use strict';var pdf=require(_0x9026('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9026('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9026('0x2'));var rp=require('request-promise');var moment=require(_0x9026('0x3'));var BPromise=require(_0x9026('0x4'));var Mustache=require(_0x9026('0x5'));var util=require(_0x9026('0x6'));var path=require('path');var sox=require(_0x9026('0x7'));var csv=require(_0x9026('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9026('0x9'));var crypto=require(_0x9026('0xa'));var jsforce=require(_0x9026('0xb'));var deskjs=require(_0x9026('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9026('0xd'));var Papa=require(_0x9026('0xe'));var Redis=require(_0x9026('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x9026('0x10'))(_0x9026('0x11'));var utils=require(_0x9026('0x12'));var config=require('../../config/environment');var db=require(_0x9026('0x13'))['db'];function respondWithStatusCode(_0x5021f5,_0x357a41){_0x357a41=_0x357a41||0xcc;return function(_0x389f69){if(_0x389f69){return _0x5021f5[_0x9026('0x14')](_0x357a41);}return _0x5021f5[_0x9026('0x15')](_0x357a41)[_0x9026('0x16')]();};}function respondWithResult(_0x40b5dd,_0x363892){_0x363892=_0x363892||0xc8;return function(_0x51aba6){if(_0x51aba6){return _0x40b5dd[_0x9026('0x15')](_0x363892)['json'](_0x51aba6);}};}function respondWithFilteredResult(_0x385afc,_0x2612cd){return function(_0xd2473f){if(_0xd2473f){var _0xe7b66a=_0xd2473f[_0x9026('0x17')],_0x11c0d1=_0x2612cd['offset'],_0x421ee2=_0x2612cd[_0x9026('0x18')]+_0x2612cd[_0x9026('0x19')],_0x142465;if(_0x421ee2>=_0xe7b66a){_0x421ee2=_0xe7b66a;_0x142465=0xc8;}else{_0x142465=0xce;}_0x385afc['status'](_0x142465);return _0x385afc[_0x9026('0x1a')](_0x9026('0x1b'),_0x11c0d1+'-'+_0x421ee2+'/'+_0xe7b66a)[_0x9026('0x1c')](_0xd2473f);}return null;};}function patchUpdates(_0x4e37d0){return function(_0x1d1613){try{jsonpatch[_0x9026('0x1d')](_0x1d1613,_0x4e37d0,!![]);}catch(_0x42c928){return BPromise[_0x9026('0x1e')](_0x42c928);}return _0x1d1613['save']();};}function saveUpdates(_0x7985,_0x569be0){return function(_0x2203f0){if(_0x2203f0){return _0x2203f0['update'](_0x7985)[_0x9026('0x1f')](function(_0x1b03af){return _0x1b03af;});}return null;};}function removeEntity(_0x2d782f,_0x22a77c){return function(_0xdce1d6){if(_0xdce1d6){return _0xdce1d6[_0x9026('0x20')]()[_0x9026('0x1f')](function(){_0x2d782f[_0x9026('0x15')](0xcc)[_0x9026('0x16')]();});}};}function handleEntityNotFound(_0x4d01d4,_0x5c6e39){return function(_0x7b962){if(!_0x7b962){_0x4d01d4[_0x9026('0x14')](0x194);}return _0x7b962;};}function handleError(_0x2968fb,_0x82a8e0){_0x82a8e0=_0x82a8e0||0x1f4;return function(_0x18279b){logger[_0x9026('0x21')](_0x18279b[_0x9026('0x22')]);if(_0x18279b[_0x9026('0x23')]){delete _0x18279b[_0x9026('0x23')];}_0x2968fb[_0x9026('0x15')](_0x82a8e0)[_0x9026('0x24')](_0x18279b);};}exports[_0x9026('0x25')]=function(_0x38fd9c,_0x2ace13){var _0x28dba4={},_0x56c5ca={},_0x1f431b={'count':0x0,'rows':[]};var _0x9c5f39=db[_0x9026('0x26')]['rawAttributes'];_0x56c5ca[_0x9026('0x27')]=_[_0x9026('0x28')](_0x9c5f39);var _0x30c988={'dateStart':_0x38fd9c[_0x9026('0x29')][_0x9026('0x2a')],'dateEnd':_0x38fd9c[_0x9026('0x29')][_0x9026('0x2b')]};delete _0x38fd9c[_0x9026('0x29')][_0x9026('0x2a')];delete _0x38fd9c[_0x9026('0x29')][_0x9026('0x2b')];_0x56c5ca['query']=_[_0x9026('0x28')](_0x38fd9c[_0x9026('0x29')]);_0x56c5ca[_0x9026('0x2c')]=_[_0x9026('0x2d')](_0x56c5ca[_0x9026('0x27')],_0x56c5ca[_0x9026('0x29')]);_0x28dba4[_0x9026('0x2e')]=_['intersection'](_0x56c5ca[_0x9026('0x27')],qs['fields'](_0x38fd9c[_0x9026('0x29')][_0x9026('0x2f')]));_0x28dba4[_0x9026('0x2e')]=_0x28dba4[_0x9026('0x2e')][_0x9026('0x30')]?_0x28dba4[_0x9026('0x2e')]:_0x56c5ca['model'];if(!_0x38fd9c[_0x9026('0x29')][_0x9026('0x31')](_0x9026('0x32'))){_0x28dba4[_0x9026('0x19')]=qs['limit'](_0x38fd9c[_0x9026('0x29')][_0x9026('0x19')]);_0x28dba4['offset']=qs[_0x9026('0x18')](_0x38fd9c[_0x9026('0x29')][_0x9026('0x18')]);}_0x28dba4[_0x9026('0x33')]=qs[_0x9026('0x34')](_0x38fd9c[_0x9026('0x29')][_0x9026('0x34')]);_0x28dba4[_0x9026('0x35')]=qs['filters'](_[_0x9026('0x36')](_0x38fd9c[_0x9026('0x29')],_0x56c5ca['filters']));if(_0x30c988[_0x9026('0x2a')]){if(_0x30c988[_0x9026('0x2b')]){_0x30c988[_0x9026('0x2b')]=moment(_0x30c988[_0x9026('0x2b')])[_0x9026('0x37')](0x1,_0x9026('0x38'));}else{_0x30c988[_0x9026('0x2b')]=moment(_0x30c988[_0x9026('0x2a')])['add'](0x1,_0x9026('0x38'));}_[_0x9026('0x39')](_0x28dba4[_0x9026('0x35')],{'createdAt':{'$gte':_0x30c988[_0x9026('0x2a')],'$lte':_0x30c988[_0x9026('0x2b')]}});}if(_0x38fd9c[_0x9026('0x29')][_0x9026('0x3a')]){_0x28dba4['where']=_[_0x9026('0x39')](_0x28dba4['where'],{'$or':_[_0x9026('0x3b')](_0x28dba4[_0x9026('0x2e')],function(_0x3632c3){var _0x3e106a={};_0x3e106a[_0x3632c3]={'$like':'%'+_0x38fd9c['query']['filter']+'%'};return _0x3e106a;})});}_0x28dba4=_[_0x9026('0x39')]({},_0x28dba4,_0x38fd9c[_0x9026('0x3c')]);var _0x51e719={'where':_0x28dba4['where']};return db['UserProfileResource'][_0x9026('0x17')](_0x51e719)[_0x9026('0x1f')](function(_0x4d78e4){_0x1f431b[_0x9026('0x17')]=_0x4d78e4;if(_0x38fd9c[_0x9026('0x29')][_0x9026('0x3d')]){_0x28dba4[_0x9026('0x3e')]=[{'all':!![]}];}return db[_0x9026('0x26')][_0x9026('0x3f')](_0x28dba4);})[_0x9026('0x1f')](function(_0x2c24f4){_0x1f431b['rows']=_0x2c24f4;return _0x1f431b;})[_0x9026('0x1f')](respondWithFilteredResult(_0x2ace13,_0x28dba4))[_0x9026('0x40')](handleError(_0x2ace13,null));};exports['show']=function(_0x587d64,_0x52c8f1){var _0x27cd0b={'raw':![],'where':{'id':_0x587d64[_0x9026('0x41')]['id']}},_0x126046={};_0x126046[_0x9026('0x27')]=_[_0x9026('0x28')](db['UserProfileResource'][_0x9026('0x42')]);_0x126046['query']=_[_0x9026('0x28')](_0x587d64[_0x9026('0x29')]);_0x126046[_0x9026('0x2c')]=_[_0x9026('0x2d')](_0x126046['model'],_0x126046['query']);_0x27cd0b[_0x9026('0x2e')]=_[_0x9026('0x2d')](_0x126046[_0x9026('0x27')],qs[_0x9026('0x2f')](_0x587d64[_0x9026('0x29')][_0x9026('0x2f')]));_0x27cd0b['attributes']=_0x27cd0b[_0x9026('0x2e')]['length']?_0x27cd0b[_0x9026('0x2e')]:_0x126046[_0x9026('0x27')];if(_0x587d64['query'][_0x9026('0x3d')]){_0x27cd0b['include']=[{'all':!![]}];}_0x27cd0b=_[_0x9026('0x39')]({},_0x27cd0b,_0x587d64['options']);return db[_0x9026('0x26')]['find'](_0x27cd0b)['then'](handleEntityNotFound(_0x52c8f1,null))[_0x9026('0x1f')](respondWithResult(_0x52c8f1,null))[_0x9026('0x40')](handleError(_0x52c8f1,null));};exports[_0x9026('0x43')]=function(_0x4d9051,_0x3a4c72){return db[_0x9026('0x26')][_0x9026('0x43')](_0x4d9051[_0x9026('0x44')],{})[_0x9026('0x1f')](respondWithResult(_0x3a4c72,0xc9))['catch'](handleError(_0x3a4c72,null));};exports[_0x9026('0x45')]=function(_0x23d0e9,_0x24c3b1){if(_0x23d0e9[_0x9026('0x44')]['id']){delete _0x23d0e9[_0x9026('0x44')]['id'];}return db[_0x9026('0x26')]['find']({'where':{'id':_0x23d0e9[_0x9026('0x41')]['id']}})['then'](handleEntityNotFound(_0x24c3b1,null))[_0x9026('0x1f')](saveUpdates(_0x23d0e9[_0x9026('0x44')],null))['then'](respondWithResult(_0x24c3b1,null))[_0x9026('0x40')](handleError(_0x24c3b1,null));};exports[_0x9026('0x20')]=function(_0x37f65c,_0x3376c1){return db[_0x9026('0x26')][_0x9026('0x46')]({'where':{'id':_0x37f65c[_0x9026('0x41')]['id']}})[_0x9026('0x1f')](handleEntityNotFound(_0x3376c1,null))[_0x9026('0x1f')](removeEntity(_0x3376c1,null))[_0x9026('0x40')](handleError(_0x3376c1,null));};exports['describe']=function(_0x207ab6,_0x24aa21){return db['UserProfileResource'][_0x9026('0x47')]()[_0x9026('0x1f')](respondWithResult(_0x24aa21,null))[_0x9026('0x40')](handleError(_0x24aa21,null));}; \ No newline at end of file +var _0xc1c3=['create','update','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','sendStatus','error','name','send','index','model','query','dateEnd','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','dateStart','add','day','merge','filter','map','options','UserProfileResource','findAll','rows','show','params','includeAll','include','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1c3,0x1b5));var _0x3c1c=function(_0x3585d1,_0x4d7ec4){_0x3585d1=_0x3585d1-0x0;var _0x3543c8=_0xc1c3[_0x3585d1];return _0x3543c8;};'use strict';var pdf=require(_0x3c1c('0x0'));var emlformat=require(_0x3c1c('0x1'));var rimraf=require(_0x3c1c('0x2'));var zipdir=require(_0x3c1c('0x3'));var jsonpatch=require(_0x3c1c('0x4'));var rp=require(_0x3c1c('0x5'));var moment=require(_0x3c1c('0x6'));var BPromise=require(_0x3c1c('0x7'));var Mustache=require(_0x3c1c('0x8'));var util=require('util');var path=require(_0x3c1c('0x9'));var sox=require('sox');var csv=require(_0x3c1c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3c1c('0xb'));var crypto=require('crypto');var jsforce=require(_0x3c1c('0xc'));var deskjs=require(_0x3c1c('0xd'));var toCsv=require(_0x3c1c('0xa'));var querystring=require(_0x3c1c('0xe'));var Papa=require(_0x3c1c('0xf'));var Redis=require(_0x3c1c('0x10'));var qs=require(_0x3c1c('0x11'));var logger=require(_0x3c1c('0x12'))(_0x3c1c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3c1c('0x14'))['db'];function respondWithStatusCode(_0xf6a12c,_0x39bc63){_0x39bc63=_0x39bc63||0xcc;return function(_0x41aac6){if(_0x41aac6){return _0xf6a12c['sendStatus'](_0x39bc63);}return _0xf6a12c['status'](_0x39bc63)[_0x3c1c('0x15')]();};}function respondWithResult(_0x4fec7a,_0x14bcbb){_0x14bcbb=_0x14bcbb||0xc8;return function(_0xbb7fe8){if(_0xbb7fe8){return _0x4fec7a[_0x3c1c('0x16')](_0x14bcbb)['json'](_0xbb7fe8);}};}function respondWithFilteredResult(_0x4fc14c,_0x1ee596){return function(_0x5a535c){if(_0x5a535c){var _0x33a386=_0x5a535c[_0x3c1c('0x17')],_0x1febc0=_0x1ee596[_0x3c1c('0x18')],_0x391f22=_0x1ee596['offset']+_0x1ee596[_0x3c1c('0x19')],_0x2f9b32;if(_0x391f22>=_0x33a386){_0x391f22=_0x33a386;_0x2f9b32=0xc8;}else{_0x2f9b32=0xce;}_0x4fc14c[_0x3c1c('0x16')](_0x2f9b32);return _0x4fc14c[_0x3c1c('0x1a')](_0x3c1c('0x1b'),_0x1febc0+'-'+_0x391f22+'/'+_0x33a386)[_0x3c1c('0x1c')](_0x5a535c);}return null;};}function patchUpdates(_0x3db631){return function(_0x17ee10){try{jsonpatch[_0x3c1c('0x1d')](_0x17ee10,_0x3db631,!![]);}catch(_0x2f90b9){return BPromise['reject'](_0x2f90b9);}return _0x17ee10[_0x3c1c('0x1e')]();};}function saveUpdates(_0x4561fc,_0x28f2b4){return function(_0x5e27ed){if(_0x5e27ed){return _0x5e27ed['update'](_0x4561fc)[_0x3c1c('0x1f')](function(_0x230b99){return _0x230b99;});}return null;};}function removeEntity(_0x3d08be,_0x451de6){return function(_0x3b545f){if(_0x3b545f){return _0x3b545f[_0x3c1c('0x20')]()[_0x3c1c('0x1f')](function(){_0x3d08be[_0x3c1c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x265aa8,_0x1a49ca){return function(_0x510709){if(!_0x510709){_0x265aa8[_0x3c1c('0x21')](0x194);}return _0x510709;};}function handleError(_0x445d13,_0x3cf412){_0x3cf412=_0x3cf412||0x1f4;return function(_0xd5938){logger[_0x3c1c('0x22')](_0xd5938['stack']);if(_0xd5938['name']){delete _0xd5938[_0x3c1c('0x23')];}_0x445d13['status'](_0x3cf412)[_0x3c1c('0x24')](_0xd5938);};}exports[_0x3c1c('0x25')]=function(_0x3e9e4a,_0x2c6cd6){var _0x3c8e94={},_0x25c416={},_0x36e366={'count':0x0,'rows':[]};var _0x348110=db['UserProfileResource']['rawAttributes'];_0x25c416[_0x3c1c('0x26')]=_['keys'](_0x348110);var _0x10c2dc={'dateStart':_0x3e9e4a[_0x3c1c('0x27')]['dateStart'],'dateEnd':_0x3e9e4a[_0x3c1c('0x27')][_0x3c1c('0x28')]};delete _0x3e9e4a[_0x3c1c('0x27')]['dateStart'];delete _0x3e9e4a['query'][_0x3c1c('0x28')];_0x25c416['query']=_[_0x3c1c('0x29')](_0x3e9e4a[_0x3c1c('0x27')]);_0x25c416['filters']=_['intersection'](_0x25c416['model'],_0x25c416[_0x3c1c('0x27')]);_0x3c8e94[_0x3c1c('0x2a')]=_[_0x3c1c('0x2b')](_0x25c416[_0x3c1c('0x26')],qs['fields'](_0x3e9e4a[_0x3c1c('0x27')][_0x3c1c('0x2c')]));_0x3c8e94[_0x3c1c('0x2a')]=_0x3c8e94[_0x3c1c('0x2a')][_0x3c1c('0x2d')]?_0x3c8e94['attributes']:_0x25c416[_0x3c1c('0x26')];if(!_0x3e9e4a[_0x3c1c('0x27')][_0x3c1c('0x2e')]('nolimit')){_0x3c8e94['limit']=qs['limit'](_0x3e9e4a[_0x3c1c('0x27')]['limit']);_0x3c8e94[_0x3c1c('0x18')]=qs['offset'](_0x3e9e4a[_0x3c1c('0x27')][_0x3c1c('0x18')]);}_0x3c8e94[_0x3c1c('0x2f')]=qs[_0x3c1c('0x30')](_0x3e9e4a[_0x3c1c('0x27')][_0x3c1c('0x30')]);_0x3c8e94[_0x3c1c('0x31')]=qs[_0x3c1c('0x32')](_[_0x3c1c('0x33')](_0x3e9e4a[_0x3c1c('0x27')],_0x25c416['filters']));if(_0x10c2dc[_0x3c1c('0x34')]){if(_0x10c2dc[_0x3c1c('0x28')]){_0x10c2dc[_0x3c1c('0x28')]=moment(_0x10c2dc[_0x3c1c('0x28')])[_0x3c1c('0x35')](0x1,'day');}else{_0x10c2dc[_0x3c1c('0x28')]=moment(_0x10c2dc[_0x3c1c('0x34')])['add'](0x1,_0x3c1c('0x36'));}_[_0x3c1c('0x37')](_0x3c8e94[_0x3c1c('0x31')],{'createdAt':{'$gte':_0x10c2dc['dateStart'],'$lte':_0x10c2dc[_0x3c1c('0x28')]}});}if(_0x3e9e4a[_0x3c1c('0x27')][_0x3c1c('0x38')]){_0x3c8e94['where']=_[_0x3c1c('0x37')](_0x3c8e94[_0x3c1c('0x31')],{'$or':_[_0x3c1c('0x39')](_0x3c8e94[_0x3c1c('0x2a')],function(_0x18e22f){var _0x345e13={};_0x345e13[_0x18e22f]={'$like':'%'+_0x3e9e4a['query']['filter']+'%'};return _0x345e13;})});}_0x3c8e94=_[_0x3c1c('0x37')]({},_0x3c8e94,_0x3e9e4a[_0x3c1c('0x3a')]);var _0x21f63f={'where':_0x3c8e94[_0x3c1c('0x31')]};return db[_0x3c1c('0x3b')][_0x3c1c('0x17')](_0x21f63f)[_0x3c1c('0x1f')](function(_0x7e436b){_0x36e366[_0x3c1c('0x17')]=_0x7e436b;if(_0x3e9e4a['query']['includeAll']){_0x3c8e94['include']=[{'all':!![]}];}return db[_0x3c1c('0x3b')][_0x3c1c('0x3c')](_0x3c8e94);})[_0x3c1c('0x1f')](function(_0x2599ea){_0x36e366[_0x3c1c('0x3d')]=_0x2599ea;return _0x36e366;})[_0x3c1c('0x1f')](respondWithFilteredResult(_0x2c6cd6,_0x3c8e94))['catch'](handleError(_0x2c6cd6,null));};exports[_0x3c1c('0x3e')]=function(_0x531561,_0x2fdddd){var _0x2a6f4e={'raw':![],'where':{'id':_0x531561[_0x3c1c('0x3f')]['id']}},_0x507c4f={};_0x507c4f[_0x3c1c('0x26')]=_[_0x3c1c('0x29')](db[_0x3c1c('0x3b')]['rawAttributes']);_0x507c4f[_0x3c1c('0x27')]=_[_0x3c1c('0x29')](_0x531561['query']);_0x507c4f[_0x3c1c('0x32')]=_['intersection'](_0x507c4f[_0x3c1c('0x26')],_0x507c4f[_0x3c1c('0x27')]);_0x2a6f4e[_0x3c1c('0x2a')]=_[_0x3c1c('0x2b')](_0x507c4f[_0x3c1c('0x26')],qs[_0x3c1c('0x2c')](_0x531561[_0x3c1c('0x27')][_0x3c1c('0x2c')]));_0x2a6f4e[_0x3c1c('0x2a')]=_0x2a6f4e[_0x3c1c('0x2a')][_0x3c1c('0x2d')]?_0x2a6f4e[_0x3c1c('0x2a')]:_0x507c4f['model'];if(_0x531561[_0x3c1c('0x27')][_0x3c1c('0x40')]){_0x2a6f4e[_0x3c1c('0x41')]=[{'all':!![]}];}_0x2a6f4e=_['merge']({},_0x2a6f4e,_0x531561[_0x3c1c('0x3a')]);return db[_0x3c1c('0x3b')]['find'](_0x2a6f4e)[_0x3c1c('0x1f')](handleEntityNotFound(_0x2fdddd,null))[_0x3c1c('0x1f')](respondWithResult(_0x2fdddd,null))[_0x3c1c('0x42')](handleError(_0x2fdddd,null));};exports[_0x3c1c('0x43')]=function(_0x57247f,_0x3712b4){return db[_0x3c1c('0x3b')]['create'](_0x57247f['body'],{})[_0x3c1c('0x1f')](respondWithResult(_0x3712b4,0xc9))[_0x3c1c('0x42')](handleError(_0x3712b4,null));};exports[_0x3c1c('0x44')]=function(_0x104f7d,_0x2c6556){if(_0x104f7d[_0x3c1c('0x45')]['id']){delete _0x104f7d[_0x3c1c('0x45')]['id'];}return db['UserProfileResource'][_0x3c1c('0x46')]({'where':{'id':_0x104f7d['params']['id']}})[_0x3c1c('0x1f')](handleEntityNotFound(_0x2c6556,null))[_0x3c1c('0x1f')](saveUpdates(_0x104f7d[_0x3c1c('0x45')],null))[_0x3c1c('0x1f')](respondWithResult(_0x2c6556,null))['catch'](handleError(_0x2c6556,null));};exports[_0x3c1c('0x20')]=function(_0x2641f4,_0x53aa14){return db[_0x3c1c('0x3b')][_0x3c1c('0x46')]({'where':{'id':_0x2641f4['params']['id']}})[_0x3c1c('0x1f')](handleEntityNotFound(_0x53aa14,null))[_0x3c1c('0x1f')](removeEntity(_0x53aa14,null))['catch'](handleError(_0x53aa14,null));};exports[_0x3c1c('0x47')]=function(_0x9e739c,_0x10b631){return db[_0x3c1c('0x3b')][_0x3c1c('0x47')]()[_0x3c1c('0x1f')](respondWithResult(_0x10b631,null))['catch'](handleError(_0x10b631,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 015e229..939ec1d 100644 --- a/server/api/userProfileResource/userProfileResource.model.js +++ b/server/api/userProfileResource/userProfileResource.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2f5=['resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0xb2f5,0x188));var _0x5b2f=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xb2f5[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x5b2f('0x0'));var util=require('util');var logger=require(_0x5b2f('0x1'))(_0x5b2f('0x2'));var moment=require(_0x5b2f('0x3'));var BPromise=require(_0x5b2f('0x4'));var rp=require(_0x5b2f('0x5'));var attributes=require(_0x5b2f('0x6'));module[_0x5b2f('0x7')]=function(_0x1033ae,_0x144290){return _0x1033ae[_0x5b2f('0x8')]('UserProfileResource',attributes,{'tableName':_0x5b2f('0x9'),'paranoid':![],'indexes':[{'name':_0x5b2f('0xa'),'fields':[_0x5b2f('0xb'),_0x5b2f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x48c0=['resourceId','lodash','api','bluebird','request-promise','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x48c0,0x90));var _0x048c=function(_0xae83dc,_0x160375){_0xae83dc=_0xae83dc-0x0;var _0x48504a=_0x48c0[_0xae83dc];return _0x48504a;};'use strict';var _=require(_0x048c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x048c('0x1'));var moment=require('moment');var BPromise=require(_0x048c('0x2'));var rp=require(_0x048c('0x3'));var attributes=require(_0x048c('0x4'));module[_0x048c('0x5')]=function(_0x5dd1f6,_0x4bb1a1){return _0x5dd1f6[_0x048c('0x6')](_0x048c('0x7'),attributes,{'tableName':_0x048c('0x8'),'paranoid':![],'indexes':[{'name':_0x048c('0x9'),'fields':[_0x048c('0xa'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c4dc6b1..925da19 100644 --- a/server/api/userProfileResource/userProfileResource.rpc.js +++ b/server/api/userProfileResource/userProfileResource.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11e5=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x11e5,0x8b));var _0x511e=function(_0x1bcf34,_0xf080e3){_0x1bcf34=_0x1bcf34-0x0;var _0x1691b1=_0x11e5[_0x1bcf34];return _0x1691b1;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var moment=require(_0x511e('0x1'));var BPromise=require(_0x511e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x511e('0x3'));var db=require(_0x511e('0x4'))['db'];var utils=require(_0x511e('0x5'));var logger=require('../../config/logger')(_0x511e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x511e('0x7')][_0x511e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x466dec,_0x57cac3,_0x47cf56){return new BPromise(function(_0x3ebc4b,_0xf0ba86){return client[_0x511e('0x9')](_0x466dec,_0x47cf56)[_0x511e('0xa')](function(_0x4449c4){logger[_0x511e('0xb')](_0x511e('0xc'),_0x57cac3,_0x511e('0xd'));logger[_0x511e('0xe')](_0x511e('0xf'),_0x57cac3,_0x511e('0xd'),JSON['stringify'](_0x4449c4));if(_0x4449c4[_0x511e('0x10')]){if(_0x4449c4['error']['code']===0x1f4){logger[_0x511e('0x10')](_0x511e('0xc'),_0x57cac3,_0x4449c4[_0x511e('0x10')][_0x511e('0x11')]);return _0xf0ba86(_0x4449c4[_0x511e('0x10')][_0x511e('0x11')]);}logger['error'](_0x511e('0xc'),_0x57cac3,_0x4449c4[_0x511e('0x10')]['message']);return _0x3ebc4b(_0x4449c4[_0x511e('0x10')][_0x511e('0x11')]);}else{logger['info'](_0x511e('0xc'),_0x57cac3,_0x511e('0xd'));_0x3ebc4b(_0x4449c4[_0x511e('0x12')][_0x511e('0x11')]);}})['catch'](function(_0x3e0415){logger[_0x511e('0x10')](_0x511e('0xc'),_0x57cac3,_0x3e0415);_0xf0ba86(_0x3e0415);});});} \ No newline at end of file +var _0x3e24=['info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x3e24,0x167));var _0x43e2=function(_0x4bd8a3,_0x452c5c){_0x4bd8a3=_0x4bd8a3-0x0;var _0x4eaf3c=_0x3e24[_0x4bd8a3];return _0x4eaf3c;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index a583732..b04327b 100644 --- a/server/api/userProfileSection/index.js +++ b/server/api/userProfileSection/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe807=['isAuthenticated','index','get','describe','show','post','put','/:id','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3cd965,_0x6182b7){var _0x281310=function(_0x2d23db){while(--_0x2d23db){_0x3cd965['push'](_0x3cd965['shift']());}};_0x281310(++_0x6182b7);}(_0xe807,0x1cc));var _0x7e80=function(_0x386ee5,_0x23f9dc){_0x386ee5=_0x386ee5-0x0;var _0x5e7cf5=_0xe807[_0x386ee5];return _0x5e7cf5;};'use strict';var multer=require('multer');var util=require(_0x7e80('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7e80('0x1'));var router=express[_0x7e80('0x2')]();var auth=require(_0x7e80('0x3'));var interaction=require(_0x7e80('0x4'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x7e80('0x5')](),controller[_0x7e80('0x6')]);router[_0x7e80('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x7e80('0x8')]);router[_0x7e80('0x7')]('/:id',auth[_0x7e80('0x5')](),controller[_0x7e80('0x9')]);router[_0x7e80('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7e80('0xb')](_0x7e80('0xc'),auth[_0x7e80('0x5')](),controller['update']);router[_0x7e80('0xd')](_0x7e80('0xc'),auth[_0x7e80('0x5')](),controller['destroy']);module[_0x7e80('0xe')]=router; \ No newline at end of file +var _0x55e8=['put','update','destroy','multer','util','path','express','Router','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x43e48a,_0x2feacf){var _0x1f2c94=function(_0x36efce){while(--_0x36efce){_0x43e48a['push'](_0x43e48a['shift']());}};_0x1f2c94(++_0x2feacf);}(_0x55e8,0xad));var _0x855e=function(_0x598a8e,_0x141985){_0x598a8e=_0x598a8e-0x0;var _0x3ff776=_0x55e8[_0x598a8e];return _0x3ff776;};'use strict';var multer=require(_0x855e('0x0'));var util=require(_0x855e('0x1'));var path=require(_0x855e('0x2'));var timeout=require('connect-timeout');var express=require(_0x855e('0x3'));var router=express[_0x855e('0x4')]();var auth=require(_0x855e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x855e('0x6'));router[_0x855e('0x7')]('/',auth[_0x855e('0x8')](),controller[_0x855e('0x9')]);router[_0x855e('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x855e('0xa')]);router[_0x855e('0x7')](_0x855e('0xb'),auth[_0x855e('0x8')](),controller[_0x855e('0xc')]);router[_0x855e('0xd')]('/',auth[_0x855e('0x8')](),controller['create']);router[_0x855e('0xe')](_0x855e('0xb'),auth[_0x855e('0x8')](),controller[_0x855e('0xf')]);router['delete'](_0x855e('0xb'),auth[_0x855e('0x8')](),controller[_0x855e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a6dc858..c49fe12 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['crudPermissions','join','getDataValue','sequelize','exports','STRING','BOOLEAN','setDataValue'];(function(_0x52a696,_0x2aa42d){var _0x292598=function(_0x4f5b90){while(--_0x4f5b90){_0x52a696['push'](_0x52a696['shift']());}};_0x292598(++_0x2aa42d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0a9e('0x2')],'set':function(_0x432180){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x432180?_0x432180[_0x0a9e('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x0a9e('0x5'))?this[_0x0a9e('0x7')](_0x0a9e('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0x3e74=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x5b5c45,_0x199467){var _0x2cd0dd=function(_0x3f3266){while(--_0x3f3266){_0x5b5c45['push'](_0x5b5c45['shift']());}};_0x2cd0dd(++_0x199467);}(_0x3e74,0x175));var _0x43e7=function(_0x2cbf37,_0x2747e2){_0x2cbf37=_0x2cbf37-0x0;var _0x1f1203=_0x3e74[_0x2cbf37];return _0x1f1203;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x43e7('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x43e7('0x1')],'set':function(_0x4f9bbe){this[_0x43e7('0x3')](_0x43e7('0x4'),_0x4f9bbe?_0x4f9bbe[_0x43e7('0x5')](''):[]);},'get':function(){return this[_0x43e7('0x6')](_0x43e7('0x4'))?this['getDataValue'](_0x43e7('0x4'))[_0x43e7('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 517b378..243cf1a 100644 --- a/server/api/userProfileSection/userProfileSection.controller.js +++ b/server/api/userProfileSection/userProfileSection.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['map','filter','options','UserProfileSection','includeAll','include','rows','show','params','find','catch','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','order','sort','add','day','where','merge'];(function(_0x56ea8f,_0x5944fc){var _0x2c0549=function(_0x20a437){while(--_0x20a437){_0x56ea8f['push'](_0x56ea8f['shift']());}};_0x2c0549(++_0x5944fc);}(_0xe14b,0x93));var _0xbe14=function(_0x48a082,_0x2a26b9){_0x48a082=_0x48a082-0x0;var _0xf69a35=_0xe14b[_0x48a082];return _0xf69a35;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var qs=require(_0xbe14('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xbe14('0x10'));var config=require(_0xbe14('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x254c3b,_0x35aa19){_0x35aa19=_0x35aa19||0xcc;return function(_0x886a5e){if(_0x886a5e){return _0x254c3b[_0xbe14('0x12')](_0x35aa19);}return _0x254c3b[_0xbe14('0x13')](_0x35aa19)[_0xbe14('0x14')]();};}function respondWithResult(_0x23a730,_0x2850cb){_0x2850cb=_0x2850cb||0xc8;return function(_0x16893f){if(_0x16893f){return _0x23a730[_0xbe14('0x13')](_0x2850cb)[_0xbe14('0x15')](_0x16893f);}};}function respondWithFilteredResult(_0x33fd54,_0x813399){return function(_0x530538){if(_0x530538){var _0x55b3a7=_0x530538[_0xbe14('0x16')],_0x3f58f5=_0x813399['offset'],_0x3dc4a9=_0x813399[_0xbe14('0x17')]+_0x813399[_0xbe14('0x18')],_0xf4ac9;if(_0x3dc4a9>=_0x55b3a7){_0x3dc4a9=_0x55b3a7;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x33fd54[_0xbe14('0x13')](_0xf4ac9);return _0x33fd54[_0xbe14('0x19')](_0xbe14('0x1a'),_0x3f58f5+'-'+_0x3dc4a9+'/'+_0x55b3a7)[_0xbe14('0x15')](_0x530538);}return null;};}function patchUpdates(_0x17ae86){return function(_0x5ea1f8){try{jsonpatch[_0xbe14('0x1b')](_0x5ea1f8,_0x17ae86,!![]);}catch(_0x456ca8){return BPromise[_0xbe14('0x1c')](_0x456ca8);}return _0x5ea1f8[_0xbe14('0x1d')]();};}function saveUpdates(_0x3249da,_0x37e4c1){return function(_0x59a9e3){if(_0x59a9e3){return _0x59a9e3[_0xbe14('0x1e')](_0x3249da)[_0xbe14('0x1f')](function(_0x417c8d){return _0x417c8d;});}return null;};}function removeEntity(_0xc12977,_0x188ec4){return function(_0x51dc0b){if(_0x51dc0b){return _0x51dc0b[_0xbe14('0x20')]()['then'](function(){_0xc12977[_0xbe14('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32e8eb,_0x4a25fa){return function(_0x274018){if(!_0x274018){_0x32e8eb[_0xbe14('0x12')](0x194);}return _0x274018;};}function handleError(_0x505dbd,_0x2da350){_0x2da350=_0x2da350||0x1f4;return function(_0x4d4190){logger[_0xbe14('0x21')](_0x4d4190['stack']);if(_0x4d4190[_0xbe14('0x22')]){delete _0x4d4190[_0xbe14('0x22')];}_0x505dbd[_0xbe14('0x13')](_0x2da350)[_0xbe14('0x23')](_0x4d4190);};}exports[_0xbe14('0x24')]=function(_0x2703f5,_0x55d001){var _0x1822e0={},_0x1ba46a={},_0x391556={'count':0x0,'rows':[]};var _0x169369=db['UserProfileSection'][_0xbe14('0x25')];_0x1ba46a[_0xbe14('0x26')]=_['keys'](_0x169369);var _0x3c3613={'dateStart':_0x2703f5[_0xbe14('0x27')][_0xbe14('0x28')],'dateEnd':_0x2703f5[_0xbe14('0x27')][_0xbe14('0x29')]};delete _0x2703f5[_0xbe14('0x27')][_0xbe14('0x28')];delete _0x2703f5[_0xbe14('0x27')][_0xbe14('0x29')];_0x1ba46a[_0xbe14('0x27')]=_[_0xbe14('0x2a')](_0x2703f5[_0xbe14('0x27')]);_0x1ba46a[_0xbe14('0x2b')]=_[_0xbe14('0x2c')](_0x1ba46a[_0xbe14('0x26')],_0x1ba46a[_0xbe14('0x27')]);_0x1822e0[_0xbe14('0x2d')]=_[_0xbe14('0x2c')](_0x1ba46a[_0xbe14('0x26')],qs[_0xbe14('0x2e')](_0x2703f5['query'][_0xbe14('0x2e')]));_0x1822e0['attributes']=_0x1822e0['attributes'][_0xbe14('0x2f')]?_0x1822e0['attributes']:_0x1ba46a[_0xbe14('0x26')];if(!_0x2703f5[_0xbe14('0x27')]['hasOwnProperty']('nolimit')){_0x1822e0['limit']=qs[_0xbe14('0x18')](_0x2703f5[_0xbe14('0x27')]['limit']);_0x1822e0[_0xbe14('0x17')]=qs[_0xbe14('0x17')](_0x2703f5[_0xbe14('0x27')][_0xbe14('0x17')]);}_0x1822e0[_0xbe14('0x30')]=qs['sort'](_0x2703f5['query'][_0xbe14('0x31')]);_0x1822e0['where']=qs['filters'](_['pick'](_0x2703f5[_0xbe14('0x27')],_0x1ba46a[_0xbe14('0x2b')]));if(_0x3c3613[_0xbe14('0x28')]){if(_0x3c3613[_0xbe14('0x29')]){_0x3c3613[_0xbe14('0x29')]=moment(_0x3c3613[_0xbe14('0x29')])[_0xbe14('0x32')](0x1,_0xbe14('0x33'));}else{_0x3c3613[_0xbe14('0x29')]=moment(_0x3c3613[_0xbe14('0x28')])[_0xbe14('0x32')](0x1,_0xbe14('0x33'));}_['merge'](_0x1822e0['where'],{'createdAt':{'$gte':_0x3c3613[_0xbe14('0x28')],'$lte':_0x3c3613[_0xbe14('0x29')]}});}if(_0x2703f5[_0xbe14('0x27')]['filter']){_0x1822e0[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x1822e0[_0xbe14('0x34')],{'$or':_[_0xbe14('0x36')](_0x1822e0[_0xbe14('0x2d')],function(_0x25ee1f){var _0x19fa30={};_0x19fa30[_0x25ee1f]={'$like':'%'+_0x2703f5[_0xbe14('0x27')][_0xbe14('0x37')]+'%'};return _0x19fa30;})});}_0x1822e0=_['merge']({},_0x1822e0,_0x2703f5[_0xbe14('0x38')]);var _0x841b71={'where':_0x1822e0[_0xbe14('0x34')]};return db[_0xbe14('0x39')][_0xbe14('0x16')](_0x841b71)[_0xbe14('0x1f')](function(_0x548d17){_0x391556[_0xbe14('0x16')]=_0x548d17;if(_0x2703f5[_0xbe14('0x27')][_0xbe14('0x3a')]){_0x1822e0[_0xbe14('0x3b')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1822e0);})[_0xbe14('0x1f')](function(_0xe417b){_0x391556[_0xbe14('0x3c')]=_0xe417b;return _0x391556;})['then'](respondWithFilteredResult(_0x55d001,_0x1822e0))['catch'](handleError(_0x55d001,null));};exports[_0xbe14('0x3d')]=function(_0x59ae4d,_0x5657fe){var _0x3593f8={'raw':![],'where':{'id':_0x59ae4d[_0xbe14('0x3e')]['id']}},_0x1f0355={};_0x1f0355['model']=_['keys'](db['UserProfileSection'][_0xbe14('0x25')]);_0x1f0355[_0xbe14('0x27')]=_[_0xbe14('0x2a')](_0x59ae4d['query']);_0x1f0355[_0xbe14('0x2b')]=_[_0xbe14('0x2c')](_0x1f0355[_0xbe14('0x26')],_0x1f0355[_0xbe14('0x27')]);_0x3593f8['attributes']=_['intersection'](_0x1f0355[_0xbe14('0x26')],qs[_0xbe14('0x2e')](_0x59ae4d[_0xbe14('0x27')][_0xbe14('0x2e')]));_0x3593f8[_0xbe14('0x2d')]=_0x3593f8['attributes']['length']?_0x3593f8[_0xbe14('0x2d')]:_0x1f0355[_0xbe14('0x26')];if(_0x59ae4d[_0xbe14('0x27')][_0xbe14('0x3a')]){_0x3593f8['include']=[{'all':!![]}];}_0x3593f8=_[_0xbe14('0x35')]({},_0x3593f8,_0x59ae4d[_0xbe14('0x38')]);return db['UserProfileSection'][_0xbe14('0x3f')](_0x3593f8)[_0xbe14('0x1f')](handleEntityNotFound(_0x5657fe,null))[_0xbe14('0x1f')](respondWithResult(_0x5657fe,null))[_0xbe14('0x40')](handleError(_0x5657fe,null));};exports['create']=function(_0x594f65,_0x1b0a2e){return db[_0xbe14('0x39')]['create'](_0x594f65['body'],{})[_0xbe14('0x1f')](respondWithResult(_0x1b0a2e,0xc9))[_0xbe14('0x40')](handleError(_0x1b0a2e,null));};exports[_0xbe14('0x1e')]=function(_0x1a8a3d,_0xdbc6e1){if(_0x1a8a3d[_0xbe14('0x41')]['id']){delete _0x1a8a3d[_0xbe14('0x41')]['id'];}return db['UserProfileSection'][_0xbe14('0x3f')]({'where':{'id':_0x1a8a3d[_0xbe14('0x3e')]['id']}})[_0xbe14('0x1f')](handleEntityNotFound(_0xdbc6e1,null))[_0xbe14('0x1f')](saveUpdates(_0x1a8a3d[_0xbe14('0x41')],null))['then'](respondWithResult(_0xdbc6e1,null))[_0xbe14('0x40')](handleError(_0xdbc6e1,null));};exports[_0xbe14('0x20')]=function(_0x35126f,_0x20f46d){return db[_0xbe14('0x39')][_0xbe14('0x3f')]({'where':{'id':_0x35126f['params']['id']}})['then'](handleEntityNotFound(_0x20f46d,null))[_0xbe14('0x1f')](removeEntity(_0x20f46d,null))[_0xbe14('0x40')](handleError(_0x20f46d,null));};exports[_0xbe14('0x42')]=function(_0x48554a,_0x497b00){return db[_0xbe14('0x39')][_0xbe14('0x42')]()['then'](respondWithResult(_0x497b00,null))[_0xbe14('0x40')](handleError(_0x497b00,null));}; \ No newline at end of file +var _0xe14b=['map','filter','options','UserProfileSection','includeAll','include','rows','show','params','find','catch','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','order','sort','add','day','where','merge'];(function(_0x5ae067,_0x15a29e){var _0x6e83be=function(_0x208acc){while(--_0x208acc){_0x5ae067['push'](_0x5ae067['shift']());}};_0x6e83be(++_0x15a29e);}(_0xe14b,0x93));var _0xbe14=function(_0x195ad0,_0x282353){_0x195ad0=_0x195ad0-0x0;var _0x134bd4=_0xe14b[_0x195ad0];return _0x134bd4;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var qs=require(_0xbe14('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xbe14('0x10'));var config=require(_0xbe14('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x254c3b,_0x35aa19){_0x35aa19=_0x35aa19||0xcc;return function(_0x886a5e){if(_0x886a5e){return _0x254c3b[_0xbe14('0x12')](_0x35aa19);}return _0x254c3b[_0xbe14('0x13')](_0x35aa19)[_0xbe14('0x14')]();};}function respondWithResult(_0x23a730,_0x2850cb){_0x2850cb=_0x2850cb||0xc8;return function(_0x16893f){if(_0x16893f){return _0x23a730[_0xbe14('0x13')](_0x2850cb)[_0xbe14('0x15')](_0x16893f);}};}function respondWithFilteredResult(_0x33fd54,_0x813399){return function(_0x530538){if(_0x530538){var _0x55b3a7=_0x530538[_0xbe14('0x16')],_0x3f58f5=_0x813399['offset'],_0x3dc4a9=_0x813399[_0xbe14('0x17')]+_0x813399[_0xbe14('0x18')],_0xf4ac9;if(_0x3dc4a9>=_0x55b3a7){_0x3dc4a9=_0x55b3a7;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x33fd54[_0xbe14('0x13')](_0xf4ac9);return _0x33fd54[_0xbe14('0x19')](_0xbe14('0x1a'),_0x3f58f5+'-'+_0x3dc4a9+'/'+_0x55b3a7)[_0xbe14('0x15')](_0x530538);}return null;};}function patchUpdates(_0x17ae86){return function(_0x5ea1f8){try{jsonpatch[_0xbe14('0x1b')](_0x5ea1f8,_0x17ae86,!![]);}catch(_0x456ca8){return BPromise[_0xbe14('0x1c')](_0x456ca8);}return _0x5ea1f8[_0xbe14('0x1d')]();};}function saveUpdates(_0x3249da,_0x37e4c1){return function(_0x59a9e3){if(_0x59a9e3){return _0x59a9e3[_0xbe14('0x1e')](_0x3249da)[_0xbe14('0x1f')](function(_0x417c8d){return _0x417c8d;});}return null;};}function removeEntity(_0xc12977,_0x188ec4){return function(_0x51dc0b){if(_0x51dc0b){return _0x51dc0b[_0xbe14('0x20')]()['then'](function(){_0xc12977[_0xbe14('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32e8eb,_0x4a25fa){return function(_0x274018){if(!_0x274018){_0x32e8eb[_0xbe14('0x12')](0x194);}return _0x274018;};}function handleError(_0x505dbd,_0x2da350){_0x2da350=_0x2da350||0x1f4;return function(_0x4d4190){logger[_0xbe14('0x21')](_0x4d4190['stack']);if(_0x4d4190[_0xbe14('0x22')]){delete _0x4d4190[_0xbe14('0x22')];}_0x505dbd[_0xbe14('0x13')](_0x2da350)[_0xbe14('0x23')](_0x4d4190);};}exports[_0xbe14('0x24')]=function(_0x2703f5,_0x55d001){var _0x1822e0={},_0x1ba46a={},_0x391556={'count':0x0,'rows':[]};var _0x169369=db['UserProfileSection'][_0xbe14('0x25')];_0x1ba46a[_0xbe14('0x26')]=_['keys'](_0x169369);var _0x3c3613={'dateStart':_0x2703f5[_0xbe14('0x27')][_0xbe14('0x28')],'dateEnd':_0x2703f5[_0xbe14('0x27')][_0xbe14('0x29')]};delete _0x2703f5[_0xbe14('0x27')][_0xbe14('0x28')];delete _0x2703f5[_0xbe14('0x27')][_0xbe14('0x29')];_0x1ba46a[_0xbe14('0x27')]=_[_0xbe14('0x2a')](_0x2703f5[_0xbe14('0x27')]);_0x1ba46a[_0xbe14('0x2b')]=_[_0xbe14('0x2c')](_0x1ba46a[_0xbe14('0x26')],_0x1ba46a[_0xbe14('0x27')]);_0x1822e0[_0xbe14('0x2d')]=_[_0xbe14('0x2c')](_0x1ba46a[_0xbe14('0x26')],qs[_0xbe14('0x2e')](_0x2703f5['query'][_0xbe14('0x2e')]));_0x1822e0['attributes']=_0x1822e0['attributes'][_0xbe14('0x2f')]?_0x1822e0['attributes']:_0x1ba46a[_0xbe14('0x26')];if(!_0x2703f5[_0xbe14('0x27')]['hasOwnProperty']('nolimit')){_0x1822e0['limit']=qs[_0xbe14('0x18')](_0x2703f5[_0xbe14('0x27')]['limit']);_0x1822e0[_0xbe14('0x17')]=qs[_0xbe14('0x17')](_0x2703f5[_0xbe14('0x27')][_0xbe14('0x17')]);}_0x1822e0[_0xbe14('0x30')]=qs['sort'](_0x2703f5['query'][_0xbe14('0x31')]);_0x1822e0['where']=qs['filters'](_['pick'](_0x2703f5[_0xbe14('0x27')],_0x1ba46a[_0xbe14('0x2b')]));if(_0x3c3613[_0xbe14('0x28')]){if(_0x3c3613[_0xbe14('0x29')]){_0x3c3613[_0xbe14('0x29')]=moment(_0x3c3613[_0xbe14('0x29')])[_0xbe14('0x32')](0x1,_0xbe14('0x33'));}else{_0x3c3613[_0xbe14('0x29')]=moment(_0x3c3613[_0xbe14('0x28')])[_0xbe14('0x32')](0x1,_0xbe14('0x33'));}_['merge'](_0x1822e0['where'],{'createdAt':{'$gte':_0x3c3613[_0xbe14('0x28')],'$lte':_0x3c3613[_0xbe14('0x29')]}});}if(_0x2703f5[_0xbe14('0x27')]['filter']){_0x1822e0[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x1822e0[_0xbe14('0x34')],{'$or':_[_0xbe14('0x36')](_0x1822e0[_0xbe14('0x2d')],function(_0x25ee1f){var _0x19fa30={};_0x19fa30[_0x25ee1f]={'$like':'%'+_0x2703f5[_0xbe14('0x27')][_0xbe14('0x37')]+'%'};return _0x19fa30;})});}_0x1822e0=_['merge']({},_0x1822e0,_0x2703f5[_0xbe14('0x38')]);var _0x841b71={'where':_0x1822e0[_0xbe14('0x34')]};return db[_0xbe14('0x39')][_0xbe14('0x16')](_0x841b71)[_0xbe14('0x1f')](function(_0x548d17){_0x391556[_0xbe14('0x16')]=_0x548d17;if(_0x2703f5[_0xbe14('0x27')][_0xbe14('0x3a')]){_0x1822e0[_0xbe14('0x3b')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1822e0);})[_0xbe14('0x1f')](function(_0xe417b){_0x391556[_0xbe14('0x3c')]=_0xe417b;return _0x391556;})['then'](respondWithFilteredResult(_0x55d001,_0x1822e0))['catch'](handleError(_0x55d001,null));};exports[_0xbe14('0x3d')]=function(_0x59ae4d,_0x5657fe){var _0x3593f8={'raw':![],'where':{'id':_0x59ae4d[_0xbe14('0x3e')]['id']}},_0x1f0355={};_0x1f0355['model']=_['keys'](db['UserProfileSection'][_0xbe14('0x25')]);_0x1f0355[_0xbe14('0x27')]=_[_0xbe14('0x2a')](_0x59ae4d['query']);_0x1f0355[_0xbe14('0x2b')]=_[_0xbe14('0x2c')](_0x1f0355[_0xbe14('0x26')],_0x1f0355[_0xbe14('0x27')]);_0x3593f8['attributes']=_['intersection'](_0x1f0355[_0xbe14('0x26')],qs[_0xbe14('0x2e')](_0x59ae4d[_0xbe14('0x27')][_0xbe14('0x2e')]));_0x3593f8[_0xbe14('0x2d')]=_0x3593f8['attributes']['length']?_0x3593f8[_0xbe14('0x2d')]:_0x1f0355[_0xbe14('0x26')];if(_0x59ae4d[_0xbe14('0x27')][_0xbe14('0x3a')]){_0x3593f8['include']=[{'all':!![]}];}_0x3593f8=_[_0xbe14('0x35')]({},_0x3593f8,_0x59ae4d[_0xbe14('0x38')]);return db['UserProfileSection'][_0xbe14('0x3f')](_0x3593f8)[_0xbe14('0x1f')](handleEntityNotFound(_0x5657fe,null))[_0xbe14('0x1f')](respondWithResult(_0x5657fe,null))[_0xbe14('0x40')](handleError(_0x5657fe,null));};exports['create']=function(_0x594f65,_0x1b0a2e){return db[_0xbe14('0x39')]['create'](_0x594f65['body'],{})[_0xbe14('0x1f')](respondWithResult(_0x1b0a2e,0xc9))[_0xbe14('0x40')](handleError(_0x1b0a2e,null));};exports[_0xbe14('0x1e')]=function(_0x1a8a3d,_0xdbc6e1){if(_0x1a8a3d[_0xbe14('0x41')]['id']){delete _0x1a8a3d[_0xbe14('0x41')]['id'];}return db['UserProfileSection'][_0xbe14('0x3f')]({'where':{'id':_0x1a8a3d[_0xbe14('0x3e')]['id']}})[_0xbe14('0x1f')](handleEntityNotFound(_0xdbc6e1,null))[_0xbe14('0x1f')](saveUpdates(_0x1a8a3d[_0xbe14('0x41')],null))['then'](respondWithResult(_0xdbc6e1,null))[_0xbe14('0x40')](handleError(_0xdbc6e1,null));};exports[_0xbe14('0x20')]=function(_0x35126f,_0x20f46d){return db[_0xbe14('0x39')][_0xbe14('0x3f')]({'where':{'id':_0x35126f['params']['id']}})['then'](handleEntityNotFound(_0x20f46d,null))[_0xbe14('0x1f')](removeEntity(_0x20f46d,null))[_0xbe14('0x40')](handleError(_0x20f46d,null));};exports[_0xbe14('0x42')]=function(_0x48554a,_0x497b00){return db[_0xbe14('0x39')][_0xbe14('0x42')]()['then'](respondWithResult(_0x497b00,null))[_0xbe14('0x40')](handleError(_0x497b00,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 864155c..d43191a 100644 --- a/server/api/userProfileSection/userProfileSection.model.js +++ b/server/api/userProfileSection/userProfileSection.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfef2=['util','../../config/logger','moment','bluebird','request-promise','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xfef2,0x1e0));var _0x2fef=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0xfef2[_0x2d0b84];return _0x8d0088;};'use strict';var _=require(_0x2fef('0x0'));var util=require(_0x2fef('0x1'));var logger=require(_0x2fef('0x2'))('api');var moment=require(_0x2fef('0x3'));var BPromise=require(_0x2fef('0x4'));var rp=require(_0x2fef('0x5'));var attributes=require(_0x2fef('0x6'));module['exports']=function(_0x2fb0c2,_0x4c639e){return _0x2fb0c2[_0x2fef('0x7')](_0x2fef('0x8'),attributes,{'tableName':_0x2fef('0x9'),'paranoid':![],'indexes':[{'name':_0x2fef('0xa'),'fields':[_0x2fef('0xb'),_0x2fef('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8876=['util','../../config/logger','api','moment','bluebird','request-promise','./userProfileSection.attributes','define','sectionId','userProfileId'];(function(_0x139b47,_0x2b1e46){var _0x37ad49=function(_0xd732df){while(--_0xd732df){_0x139b47['push'](_0x139b47['shift']());}};_0x37ad49(++_0x2b1e46);}(_0x8876,0xa0));var _0x6887=function(_0x435b1f,_0x1d2b9c){_0x435b1f=_0x435b1f-0x0;var _0x2a482c=_0x8876[_0x435b1f];return _0x2a482c;};'use strict';var _=require('lodash');var util=require(_0x6887('0x0'));var logger=require(_0x6887('0x1'))(_0x6887('0x2'));var moment=require(_0x6887('0x3'));var BPromise=require(_0x6887('0x4'));var rp=require(_0x6887('0x5'));var attributes=require(_0x6887('0x6'));module['exports']=function(_0x23abe0,_0x172c2d){return _0x23abe0[_0x6887('0x7')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6887('0x8'),_0x6887('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 024fdb7..391e056 100644 --- a/server/api/userProfileSection/userProfileSection.rpc.js +++ b/server/api/userProfileSection/userProfileSection.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa80e=['http','request','then','info','request\x20sent','stringify','code','error','message','result','catch','UserProfileSection,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xa80e,0x7f));var _0xea80=function(_0x1575fb,_0x48554c){_0x1575fb=_0x1575fb-0x0;var _0x1e5f78=_0xa80e[_0x1575fb];return _0x1e5f78;};'use strict';var _=require(_0xea80('0x0'));var util=require(_0xea80('0x1'));var moment=require(_0xea80('0x2'));var BPromise=require('bluebird');var rs=require(_0xea80('0x3'));var fs=require('fs');var Redis=require(_0xea80('0x4'));var db=require(_0xea80('0x5'))['db'];var utils=require(_0xea80('0x6'));var logger=require(_0xea80('0x7'))(_0xea80('0x8'));var config=require('../../config/environment');var jayson=require(_0xea80('0x9'));var client=jayson[_0xea80('0xa')][_0xea80('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ffdda,_0x2c4f34,_0x430491){return new BPromise(function(_0x59a4fb,_0x4745da){return client[_0xea80('0xc')](_0x1ffdda,_0x430491)[_0xea80('0xd')](function(_0x86e859){logger[_0xea80('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2c4f34,_0xea80('0xf'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2c4f34,_0xea80('0xf'),JSON[_0xea80('0x10')](_0x86e859));if(_0x86e859['error']){if(_0x86e859['error'][_0xea80('0x11')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2c4f34,_0x86e859[_0xea80('0x12')]['message']);return _0x4745da(_0x86e859[_0xea80('0x12')]['message']);}logger[_0xea80('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x2c4f34,_0x86e859[_0xea80('0x12')][_0xea80('0x13')]);return _0x59a4fb(_0x86e859[_0xea80('0x12')]['message']);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x2c4f34,_0xea80('0xf'));_0x59a4fb(_0x86e859[_0xea80('0x14')][_0xea80('0x13')]);}})[_0xea80('0x15')](function(_0x614b10){logger[_0xea80('0x12')](_0xea80('0x16'),_0x2c4f34,_0x614b10);_0x4745da(_0x614b10);});});} \ No newline at end of file +var _0xd4ab=['then','info','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4d2d17,_0x9e5117){var _0x49b7db=function(_0x2f3ac5){while(--_0x2f3ac5){_0x4d2d17['push'](_0x4d2d17['shift']());}};_0x49b7db(++_0x9e5117);}(_0xd4ab,0x112));var _0xbd4a=function(_0x2429d8,_0x2f06d8){_0x2429d8=_0x2429d8-0x0;var _0x45b6bc=_0xd4ab[_0x2429d8];return _0x45b6bc;};'use strict';var _=require('lodash');var util=require(_0xbd4a('0x0'));var moment=require(_0xbd4a('0x1'));var BPromise=require(_0xbd4a('0x2'));var rs=require(_0xbd4a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd4a('0x4'))['db'];var utils=require(_0xbd4a('0x5'));var logger=require(_0xbd4a('0x6'))(_0xbd4a('0x7'));var config=require('../../config/environment');var jayson=require(_0xbd4a('0x8'));var client=jayson[_0xbd4a('0x9')][_0xbd4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2019ec,_0x2eed6a,_0x2ca461){return new BPromise(function(_0x3a9e5e,_0x3705e6){return client[_0xbd4a('0xb')](_0x2019ec,_0x2ca461)[_0xbd4a('0xc')](function(_0x3d8326){logger[_0xbd4a('0xd')](_0xbd4a('0xe'),_0x2eed6a,'request\x20sent');logger['debug'](_0xbd4a('0xf'),_0x2eed6a,_0xbd4a('0x10'),JSON[_0xbd4a('0x11')](_0x3d8326));if(_0x3d8326[_0xbd4a('0x12')]){if(_0x3d8326[_0xbd4a('0x12')][_0xbd4a('0x13')]===0x1f4){logger[_0xbd4a('0x12')](_0xbd4a('0xe'),_0x2eed6a,_0x3d8326[_0xbd4a('0x12')][_0xbd4a('0x14')]);return _0x3705e6(_0x3d8326[_0xbd4a('0x12')][_0xbd4a('0x14')]);}logger[_0xbd4a('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x2eed6a,_0x3d8326[_0xbd4a('0x12')][_0xbd4a('0x14')]);return _0x3a9e5e(_0x3d8326[_0xbd4a('0x12')][_0xbd4a('0x14')]);}else{logger[_0xbd4a('0xd')](_0xbd4a('0xe'),_0x2eed6a,_0xbd4a('0x10'));_0x3a9e5e(_0x3d8326[_0xbd4a('0x15')][_0xbd4a('0x14')]);}})['catch'](function(_0x5d1c2e){logger[_0xbd4a('0x12')](_0xbd4a('0xe'),_0x2eed6a,_0x5d1c2e);_0x3705e6(_0x5d1c2e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 37335bc..8de5af3 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 _0x7409=['../../config/environment','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x23e18e,_0x12d239){var _0x187913=function(_0x176861){while(--_0x176861){_0x23e18e['push'](_0x23e18e['shift']());}};_0x187913(++_0x12d239);}(_0x7409,0x6e));var _0x9740=function(_0x16ce18,_0x4c67b9){_0x16ce18=_0x16ce18-0x0;var _0x4f3b2e=_0x7409[_0x16ce18];return _0x4f3b2e;};'use strict';var multer=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var path=require('path');var timeout=require(_0x9740('0x2'));var express=require(_0x9740('0x3'));var router=express[_0x9740('0x4')]();var auth=require(_0x9740('0x5'));var interaction=require(_0x9740('0x6'));var config=require(_0x9740('0x7'));module[_0x9740('0x8')]=router; \ No newline at end of file +var _0xd8fb=['connect-timeout','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x4c76b5,_0x16737b){var _0x1edfcd=function(_0x341131){while(--_0x341131){_0x4c76b5['push'](_0x4c76b5['shift']());}};_0x1edfcd(++_0x16737b);}(_0xd8fb,0x99));var _0xbd8f=function(_0x43fbdb,_0x5d93f2){_0x43fbdb=_0x43fbdb-0x0;var _0x31454d=_0xd8fb[_0x43fbdb];return _0x31454d;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbd8f('0x4'));var config=require(_0xbd8f('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 0df6e49..1f2333d 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 _0x9559=['sequelize','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9559,0x13c));var _0x9955=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x9559[_0x44d9ab];return _0x31485e;};'use strict';var Sequelize=require(_0x9955('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9955('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b9d=['INTEGER','exports'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x6b9d,0x187));var _0xd6b9=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0x6b9d[_0x37b7b6];return _0x10c4c3;};'use strict';var Sequelize=require('sequelize');module[_0xd6b9('0x0')]={'penalty':{'type':Sequelize[_0xd6b9('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index a4c8dcc..cd6ab5f 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 _0x6f58=['user_has_sms_queues','lodash','util','../../config/logger','api','moment','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x25057a,_0x43a0fd){var _0x408369=function(_0x12c526){while(--_0x12c526){_0x25057a['push'](_0x25057a['shift']());}};_0x408369(++_0x43a0fd);}(_0x6f58,0x1cd));var _0x86f5=function(_0x491eed,_0x3104a0){_0x491eed=_0x491eed-0x0;var _0x3e92f2=_0x6f58[_0x491eed];return _0x3e92f2;};'use strict';var _=require(_0x86f5('0x0'));var util=require(_0x86f5('0x1'));var logger=require(_0x86f5('0x2'))(_0x86f5('0x3'));var moment=require(_0x86f5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x86f5('0x5'));module[_0x86f5('0x6')]=function(_0x3ad8fb,_0x4ae912){return _0x3ad8fb[_0x86f5('0x7')](_0x86f5('0x8'),attributes,{'tableName':_0x86f5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0603=['api','bluebird','request-promise','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x0603,0xd9));var _0x3060=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x0603[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0x3060('0x0'));var util=require(_0x3060('0x1'));var logger=require(_0x3060('0x2'))(_0x3060('0x3'));var moment=require('moment');var BPromise=require(_0x3060('0x4'));var rp=require(_0x3060('0x5'));var attributes=require(_0x3060('0x6'));module[_0x3060('0x7')]=function(_0x5a60ec,_0xb035b0){return _0x5a60ec[_0x3060('0x8')](_0x3060('0x9'),attributes,{'tableName':_0x3060('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index af9daf2..3f81bbb 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 _0x6597=['error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x562828,_0x5bf6bd){var _0x30bd03=function(_0x5c9714){while(--_0x5c9714){_0x562828['push'](_0x562828['shift']());}};_0x30bd03(++_0x5bf6bd);}(_0x6597,0x1af));var _0x7659=function(_0xe147bb,_0x4ff035){_0xe147bb=_0xe147bb-0x0;var _0x369e3a=_0x6597[_0xe147bb];return _0x369e3a;};'use strict';var _=require(_0x7659('0x0'));var util=require(_0x7659('0x1'));var moment=require(_0x7659('0x2'));var BPromise=require(_0x7659('0x3'));var rs=require(_0x7659('0x4'));var fs=require('fs');var Redis=require(_0x7659('0x5'));var db=require(_0x7659('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7659('0x7'))(_0x7659('0x8'));var config=require(_0x7659('0x9'));var jayson=require(_0x7659('0xa'));var client=jayson[_0x7659('0xb')][_0x7659('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5978fc,_0xf646f5,_0x48c218){return new BPromise(function(_0x1602c6,_0x31e81f){return client[_0x7659('0xd')](_0x5978fc,_0x48c218)['then'](function(_0x4b224e){logger[_0x7659('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0xf646f5,'request\x20sent');logger[_0x7659('0xf')](_0x7659('0x10'),_0xf646f5,_0x7659('0x11'),JSON[_0x7659('0x12')](_0x4b224e));if(_0x4b224e[_0x7659('0x13')]){if(_0x4b224e[_0x7659('0x13')][_0x7659('0x14')]===0x1f4){logger['error'](_0x7659('0x15'),_0xf646f5,_0x4b224e[_0x7659('0x13')][_0x7659('0x16')]);return _0x31e81f(_0x4b224e['error'][_0x7659('0x16')]);}logger['error'](_0x7659('0x15'),_0xf646f5,_0x4b224e['error'][_0x7659('0x16')]);return _0x1602c6(_0x4b224e[_0x7659('0x13')]['message']);}else{logger[_0x7659('0xe')](_0x7659('0x15'),_0xf646f5,'request\x20sent');_0x1602c6(_0x4b224e[_0x7659('0x17')]['message']);}})[_0x7659('0x18')](function(_0x111edf){logger[_0x7659('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0xf646f5,_0x111edf);_0x31e81f(_0x111edf);});});} \ No newline at end of file +var _0x77d4=['client','http','request','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77d4,0x1dc));var _0x477d=function(_0x21747a,_0x2bf4d5){_0x21747a=_0x21747a-0x0;var _0x365f2a=_0x77d4[_0x21747a];return _0x365f2a;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require(_0x477d('0x1'));var BPromise=require('bluebird');var rs=require(_0x477d('0x2'));var fs=require('fs');var Redis=require(_0x477d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x477d('0x4'))(_0x477d('0x5'));var config=require(_0x477d('0x6'));var jayson=require(_0x477d('0x7'));var client=jayson[_0x477d('0x8')][_0x477d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37160a,_0x5558a7,_0x45b299){return new BPromise(function(_0x4b7b7c,_0x39529f){return client[_0x477d('0xa')](_0x37160a,_0x45b299)['then'](function(_0xb73f4d){logger[_0x477d('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x5558a7,_0x477d('0xc'));logger[_0x477d('0xd')](_0x477d('0xe'),_0x5558a7,_0x477d('0xc'),JSON[_0x477d('0xf')](_0xb73f4d));if(_0xb73f4d['error']){if(_0xb73f4d[_0x477d('0x10')][_0x477d('0x11')]===0x1f4){logger[_0x477d('0x10')](_0x477d('0x12'),_0x5558a7,_0xb73f4d['error']['message']);return _0x39529f(_0xb73f4d[_0x477d('0x10')]['message']);}logger[_0x477d('0x10')](_0x477d('0x12'),_0x5558a7,_0xb73f4d['error'][_0x477d('0x13')]);return _0x4b7b7c(_0xb73f4d[_0x477d('0x10')][_0x477d('0x13')]);}else{logger['info'](_0x477d('0x12'),_0x5558a7,_0x477d('0xc'));_0x4b7b7c(_0xb73f4d[_0x477d('0x14')][_0x477d('0x13')]);}})[_0x477d('0x15')](function(_0x50c071){logger[_0x477d('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x5558a7,_0x50c071);_0x39529f(_0x50c071);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 5964a93..d5cf9d8 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 _0x8c46=['../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','../../components/auth/service'];(function(_0x4cc61d,_0x3fd027){var _0x916589=function(_0x3f8b72){while(--_0x3f8b72){_0x4cc61d['push'](_0x4cc61d['shift']());}};_0x916589(++_0x3fd027);}(_0x8c46,0x171));var _0x68c4=function(_0x1a0546,_0x4e5132){_0x1a0546=_0x1a0546-0x0;var _0x1738ac=_0x8c46[_0x1a0546];return _0x1738ac;};'use strict';var multer=require(_0x68c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x68c4('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x68c4('0x2'));var interaction=require(_0x68c4('0x3'));var config=require(_0x68c4('0x4'));module[_0x68c4('0x5')]=router; \ No newline at end of file +var _0x06ae=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xe06a('0x0'));var path=require(_0xe06a('0x1'));var timeout=require(_0xe06a('0x2'));var express=require(_0xe06a('0x3'));var router=express[_0xe06a('0x4')]();var auth=require(_0xe06a('0x5'));var interaction=require(_0xe06a('0x6'));var config=require(_0xe06a('0x7'));module[_0xe06a('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 30ceb69..e42f94f 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 _0x6ad8=['INTEGER','sequelize'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x6ad8,0xed));var _0x86ad=function(_0xf28428,_0xe6c75c){_0xf28428=_0xf28428-0x0;var _0x181b90=_0x6ad8[_0xf28428];return _0x181b90;};'use strict';var Sequelize=require(_0x86ad('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x86ad('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x30e0=['sequelize','exports','INTEGER'];(function(_0x246114,_0x13b78a){var _0x575db5=function(_0x195d9f){while(--_0x195d9f){_0x246114['push'](_0x246114['shift']());}};_0x575db5(++_0x13b78a);}(_0x30e0,0x75));var _0x030e=function(_0x8b2fbc,_0x5dc121){_0x8b2fbc=_0x8b2fbc-0x0;var _0x43f51c=_0x30e0[_0x8b2fbc];return _0x43f51c;};'use strict';var Sequelize=require(_0x030e('0x0'));module[_0x030e('0x1')]={'penalty':{'type':Sequelize[_0x030e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index c62088d..c8418dd 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 _0x2ad9=['bluebird','request-promise','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment'];(function(_0x3cf754,_0x5ae3ab){var _0x5d2e5f=function(_0x7daecf){while(--_0x7daecf){_0x3cf754['push'](_0x3cf754['shift']());}};_0x5d2e5f(++_0x5ae3ab);}(_0x2ad9,0x13b));var _0x92ad=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2ad9[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x92ad('0x0'));var logger=require(_0x92ad('0x1'))(_0x92ad('0x2'));var moment=require(_0x92ad('0x3'));var BPromise=require(_0x92ad('0x4'));var rp=require(_0x92ad('0x5'));var attributes=require(_0x92ad('0x6'));module[_0x92ad('0x7')]=function(_0x23845c,_0x3dacd4){return _0x23845c[_0x92ad('0x8')](_0x92ad('0x9'),attributes,{'tableName':_0x92ad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9265=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3f1076,_0x23b6c1){var _0x21d34f=function(_0x3af4f4){while(--_0x3af4f4){_0x3f1076['push'](_0x3f1076['shift']());}};_0x21d34f(++_0x23b6c1);}(_0x9265,0x1ee));var _0x5926=function(_0xa644f5,_0xdceeb7){_0xa644f5=_0xa644f5-0x0;var _0x326a1e=_0x9265[_0xa644f5];return _0x326a1e;};'use strict';var _=require(_0x5926('0x0'));var util=require('util');var logger=require(_0x5926('0x1'))(_0x5926('0x2'));var moment=require(_0x5926('0x3'));var BPromise=require(_0x5926('0x4'));var rp=require(_0x5926('0x5'));var attributes=require(_0x5926('0x6'));module[_0x5926('0x7')]=function(_0x57795e,_0x4f47ec){return _0x57795e[_0x5926('0x8')](_0x5926('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 63cd45a..e42370d 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 _0x636f=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x255091,_0x36f5f5){var _0x16642f=function(_0x3b1cd8){while(--_0x3b1cd8){_0x255091['push'](_0x255091['shift']());}};_0x16642f(++_0x36f5f5);}(_0x636f,0xe3));var _0xf636=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x636f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf636('0x0'));var util=require(_0xf636('0x1'));var moment=require(_0xf636('0x2'));var BPromise=require('bluebird');var rs=require(_0xf636('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf636('0x4'))['db'];var utils=require(_0xf636('0x5'));var logger=require(_0xf636('0x6'))(_0xf636('0x7'));var config=require(_0xf636('0x8'));var jayson=require(_0xf636('0x9'));var client=jayson[_0xf636('0xa')][_0xf636('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1340b9,_0x8cfd12,_0x5e3497){return new BPromise(function(_0x2a2759,_0x4c3cfd){return client['request'](_0x1340b9,_0x5e3497)[_0xf636('0xc')](function(_0x1f6d5d){logger[_0xf636('0xd')](_0xf636('0xe'),_0x8cfd12,_0xf636('0xf'));logger[_0xf636('0x10')](_0xf636('0x11'),_0x8cfd12,_0xf636('0xf'),JSON[_0xf636('0x12')](_0x1f6d5d));if(_0x1f6d5d[_0xf636('0x13')]){if(_0x1f6d5d[_0xf636('0x13')][_0xf636('0x14')]===0x1f4){logger['error'](_0xf636('0xe'),_0x8cfd12,_0x1f6d5d['error'][_0xf636('0x15')]);return _0x4c3cfd(_0x1f6d5d[_0xf636('0x13')][_0xf636('0x15')]);}logger[_0xf636('0x13')](_0xf636('0xe'),_0x8cfd12,_0x1f6d5d['error'][_0xf636('0x15')]);return _0x2a2759(_0x1f6d5d['error'][_0xf636('0x15')]);}else{logger['info'](_0xf636('0xe'),_0x8cfd12,'request\x20sent');_0x2a2759(_0x1f6d5d['result']['message']);}})[_0xf636('0x16')](function(_0x44b351){logger[_0xf636('0x13')](_0xf636('0xe'),_0x8cfd12,_0x44b351);_0x4c3cfd(_0x44b351);});});} \ No newline at end of file +var _0x6731=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3a708c,_0x4dca8e){var _0x4c4eee=function(_0x26f2c9){while(--_0x26f2c9){_0x3a708c['push'](_0x3a708c['shift']());}};_0x4c4eee(++_0x4dca8e);}(_0x6731,0x180));var _0x1673=function(_0x2f5100,_0x565cbe){_0x2f5100=_0x2f5100-0x0;var _0x40c4bc=_0x6731[_0x2f5100];return _0x40c4bc;};'use strict';var _=require(_0x1673('0x0'));var util=require('util');var moment=require(_0x1673('0x1'));var BPromise=require(_0x1673('0x2'));var rs=require(_0x1673('0x3'));var fs=require('fs');var Redis=require(_0x1673('0x4'));var db=require(_0x1673('0x5'))['db'];var utils=require(_0x1673('0x6'));var logger=require(_0x1673('0x7'))(_0x1673('0x8'));var config=require(_0x1673('0x9'));var jayson=require(_0x1673('0xa'));var client=jayson[_0x1673('0xb')][_0x1673('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c237c,_0x47375d,_0x38104d){return new BPromise(function(_0x3851ed,_0x114b77){return client[_0x1673('0xd')](_0x3c237c,_0x38104d)[_0x1673('0xe')](function(_0x2b829a){logger[_0x1673('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x47375d,'request\x20sent');logger[_0x1673('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x47375d,_0x1673('0x11'),JSON['stringify'](_0x2b829a));if(_0x2b829a[_0x1673('0x12')]){if(_0x2b829a[_0x1673('0x12')]['code']===0x1f4){logger[_0x1673('0x12')](_0x1673('0x13'),_0x47375d,_0x2b829a['error'][_0x1673('0x14')]);return _0x114b77(_0x2b829a[_0x1673('0x12')][_0x1673('0x14')]);}logger['error'](_0x1673('0x13'),_0x47375d,_0x2b829a[_0x1673('0x12')][_0x1673('0x14')]);return _0x3851ed(_0x2b829a[_0x1673('0x12')][_0x1673('0x14')]);}else{logger[_0x1673('0xf')](_0x1673('0x13'),_0x47375d,'request\x20sent');_0x3851ed(_0x2b829a[_0x1673('0x15')]['message']);}})[_0x1673('0x16')](function(_0x3634cf){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x47375d,_0x3634cf);_0x114b77(_0x3634cf);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3e2248b..87123e7 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 _0xafb9=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x2333bb,_0x1d2025){var _0x3244a4=function(_0x5968a8){while(--_0x5968a8){_0x2333bb['push'](_0x2333bb['shift']());}};_0x3244a4(++_0x1d2025);}(_0xafb9,0x68));var _0x9afb=function(_0x5c2ca7,_0x3661ac){_0x5c2ca7=_0x5c2ca7-0x0;var _0xa9823f=_0xafb9[_0x5c2ca7];return _0xa9823f;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var auth=require(_0x9afb('0x6'));var interaction=require(_0x9afb('0x7'));var config=require(_0x9afb('0x8'));module['exports']=router; \ No newline at end of file +var _0xffd6=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path'];(function(_0x4c7fce,_0x4b86e1){var _0x4eef80=function(_0x2fafd7){while(--_0x2fafd7){_0x4c7fce['push'](_0x4c7fce['shift']());}};_0x4eef80(++_0x4b86e1);}(_0xffd6,0x97));var _0x6ffd=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0xffd6[_0x59eefb];return _0x1a49e8;};'use strict';var multer=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var path=require(_0x6ffd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ffd('0x3')]();var auth=require(_0x6ffd('0x4'));var interaction=require(_0x6ffd('0x5'));var config=require('../../config/environment');module[_0x6ffd('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5516240..46b7496 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 _0x435c=['STRING','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x38c7e0,_0x1bb480){var _0xea210a=function(_0x3511d1){while(--_0x3511d1){_0x38c7e0['push'](_0x38c7e0['shift']());}};_0xea210a(++_0x1bb480);}(_0x435c,0x1dc));var _0xc435=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x435c[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xc435('0x0'));module[_0xc435('0x1')]={'uniqueid':{'type':Sequelize[_0xc435('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc435('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xc435('0x3')},'UserId':{'type':Sequelize[_0xc435('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xc435('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xc435('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xc435('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xc435('0x3')},'paused':{'type':Sequelize[_0xc435('0x2')](0xb),'defaultValue':0x0,'comment':_0xc435('0x3')}}; \ No newline at end of file +var _0xc20b=['sequelize','Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface'];(function(_0x377f9b,_0x231ce2){var _0x27d977=function(_0x10ee1f){while(--_0x10ee1f){_0x377f9b['push'](_0x377f9b['shift']());}};_0x27d977(++_0x231ce2);}(_0xc20b,0x1a4));var _0xbc20=function(_0x5089df,_0x1c6038){_0x5089df=_0x5089df-0x0;var _0x56a1c8=_0xc20b[_0x5089df];return _0x56a1c8;};'use strict';var Sequelize=require(_0xbc20('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xbc20('0x1')},'membername':{'type':Sequelize[_0xbc20('0x2')],'allowNull':![],'comment':_0xbc20('0x1')},'UserId':{'type':Sequelize[_0xbc20('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbc20('0x4'),'comment':_0xbc20('0x1')},'VoiceQueueId':{'type':Sequelize[_0xbc20('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0xbc20('0x2')],'allowNull':![],'unique':_0xbc20('0x4'),'comment':_0xbc20('0x1')},'penalty':{'type':Sequelize[_0xbc20('0x3')](0xb),'defaultValue':0x0,'comment':_0xbc20('0x1')},'paused':{'type':Sequelize[_0xbc20('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 55a0e68..ad46bc8 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 _0xf7ce=['exports','events','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0xf7ce,0x169));var _0xef7c=function(_0x5b9252,_0x4bc2f8){_0x5b9252=_0x5b9252-0x0;var _0x1a4284=_0xf7ce[_0x5b9252];return _0x1a4284;};'use strict';var EventEmitter=require(_0xef7c('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xef7c('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xef7c('0x2')](0x0);var events={'afterCreate':_0xef7c('0x3'),'afterUpdate':_0xef7c('0x4'),'afterDestroy':'remove'};function emitEvent(_0xca5262){return function(_0x21d4c2,_0x53f93d,_0x302dbc){UserVoiceQueueRtEvents[_0xef7c('0x5')](_0xca5262+':'+_0x21d4c2['id'],_0x21d4c2);UserVoiceQueueRtEvents[_0xef7c('0x5')](_0xca5262,_0x21d4c2);_0x302dbc(null);};}for(var e in events){if(events[_0xef7c('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xef7c('0x7')](e,emitEvent(event));}}module[_0xef7c('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x574f=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1c3332,_0x2d9072){var _0x259ee2=function(_0x5bfe57){while(--_0x5bfe57){_0x1c3332['push'](_0x1c3332['shift']());}};_0x259ee2(++_0x2d9072);}(_0x574f,0x1cb));var _0xf574=function(_0x4536e1,_0x16f793){_0x4536e1=_0x4536e1-0x0;var _0x1d371e=_0x574f[_0x4536e1];return _0x1d371e;};'use strict';var EventEmitter=require(_0xf574('0x0'));var UserVoiceQueueRt=require(_0xf574('0x1'))['db'][_0xf574('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf574('0x3')](0x0);var events={'afterCreate':_0xf574('0x4'),'afterUpdate':'update','afterDestroy':_0xf574('0x5')};function emitEvent(_0xb8c25d){return function(_0x218efa,_0x36105b,_0x5e1b04){UserVoiceQueueRtEvents['emit'](_0xb8c25d+':'+_0x218efa['id'],_0x218efa);UserVoiceQueueRtEvents[_0xf574('0x6')](_0xb8c25d,_0x218efa);_0x5e1b04(null);};}for(var e in events){if(events[_0xf574('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xf574('0x8')](e,emitEvent(event));}}module[_0xf574('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 4ed5281..ee44f3a 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 _0xbec6=['../../config/logger','api','moment','request-promise','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','util'];(function(_0x1ceaaa,_0x1bc3f9){var _0x59eabf=function(_0x40dad8){while(--_0x40dad8){_0x1ceaaa['push'](_0x1ceaaa['shift']());}};_0x59eabf(++_0x1bc3f9);}(_0xbec6,0x116));var _0x6bec=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0xbec6[_0x2f48cd];return _0x193ae2;};'use strict';var _=require('lodash');var util=require(_0x6bec('0x0'));var logger=require(_0x6bec('0x1'))(_0x6bec('0x2'));var moment=require(_0x6bec('0x3'));var BPromise=require('bluebird');var rp=require(_0x6bec('0x4'));var attributes=require(_0x6bec('0x5'));module[_0x6bec('0x6')]=function(_0x59b61,_0x4b7c22){return _0x59b61['define'](_0x6bec('0x7'),attributes,{'tableName':_0x6bec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0653=['exports','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','api','moment','bluebird','request-promise','./userVoiceQueueRt.attributes'];(function(_0x13f108,_0x4100b5){var _0x2e0ff7=function(_0x5d39f9){while(--_0x5d39f9){_0x13f108['push'](_0x13f108['shift']());}};_0x2e0ff7(++_0x4100b5);}(_0x0653,0x159));var _0x3065=function(_0x279710,_0x5bb8a2){_0x279710=_0x279710-0x0;var _0x1aa6a4=_0x0653[_0x279710];return _0x1aa6a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3065('0x0'))(_0x3065('0x1'));var moment=require(_0x3065('0x2'));var BPromise=require(_0x3065('0x3'));var rp=require(_0x3065('0x4'));var attributes=require(_0x3065('0x5'));module[_0x3065('0x6')]=function(_0x2b012e,_0x5642f6){return _0x2b012e['define'](_0x3065('0x7'),attributes,{'tableName':_0x3065('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 522d890..c2ff841 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 _0x0360=['options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0x596274,_0x5c1f3f){var _0x5e7569=function(_0x852c37){while(--_0x852c37){_0x596274['push'](_0x596274['shift']());}};_0x5e7569(++_0x5c1f3f);}(_0x0360,0x15f));var _0x0036=function(_0x4c4284,_0x581403){_0x4c4284=_0x4c4284-0x0;var _0x18e0fb=_0x0360[_0x4c4284];return _0x18e0fb;};'use strict';var _=require(_0x0036('0x0'));var util=require(_0x0036('0x1'));var moment=require(_0x0036('0x2'));var BPromise=require(_0x0036('0x3'));var rs=require(_0x0036('0x4'));var fs=require('fs');var Redis=require(_0x0036('0x5'));var db=require(_0x0036('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0036('0x7'));var config=require(_0x0036('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0036('0x9')][_0x0036('0xa')]({'port':0x232a});config[_0x0036('0xb')]=_[_0x0036('0xc')](config['redis'],{'host':_0x0036('0xd'),'port':0x18eb});var socket=require(_0x0036('0xe'))(new Redis(config[_0x0036('0xb')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x2dc3b6,_0x1a57b2,_0x4993a6){return new BPromise(function(_0x3e3217,_0x2fe314){return client['request'](_0x2dc3b6,_0x4993a6)[_0x0036('0xf')](function(_0x2b5d7a){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1a57b2,_0x0036('0x10'));logger[_0x0036('0x11')](_0x0036('0x12'),_0x1a57b2,_0x0036('0x10'),JSON[_0x0036('0x13')](_0x2b5d7a));if(_0x2b5d7a[_0x0036('0x14')]){if(_0x2b5d7a['error'][_0x0036('0x15')]===0x1f4){logger[_0x0036('0x14')](_0x0036('0x16'),_0x1a57b2,_0x2b5d7a['error']['message']);return _0x2fe314(_0x2b5d7a[_0x0036('0x14')][_0x0036('0x17')]);}logger[_0x0036('0x14')](_0x0036('0x16'),_0x1a57b2,_0x2b5d7a[_0x0036('0x14')][_0x0036('0x17')]);return _0x3e3217(_0x2b5d7a[_0x0036('0x14')]['message']);}else{logger[_0x0036('0x18')](_0x0036('0x16'),_0x1a57b2,_0x0036('0x10'));_0x3e3217(_0x2b5d7a[_0x0036('0x19')][_0x0036('0x17')]);}})['catch'](function(_0x5e029d){logger[_0x0036('0x14')](_0x0036('0x16'),_0x1a57b2,_0x5e029d);_0x2fe314(_0x5e029d);});});}exports[_0x0036('0x1a')]=function(_0x4f45e3){var _0x4e4d48=this;return new Promise(function(_0x5ab071,_0x249977){return db[_0x0036('0x1b')][_0x0036('0x1c')]({'raw':_0x4f45e3[_0x0036('0x1d')]?_0x4f45e3[_0x0036('0x1d')][_0x0036('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f45e3[_0x0036('0x1d')]?_0x4f45e3['options'][_0x0036('0x1f')]||null:null,'attributes':[[db[_0x0036('0x20')]['fn'](_0x0036('0x21'),db[_0x0036('0x20')]['fn']('IF',db['sequelize'][_0x0036('0x22')](_0x0036('0x23')))),_0x0036('0x24')]]})[_0x0036('0xf')](function(_0x2dd1de){logger[_0x0036('0x18')](_0x0036('0x1a'),_0x4f45e3);logger[_0x0036('0x11')](_0x0036('0x1a'),_0x4f45e3,JSON[_0x0036('0x13')](_0x2dd1de));_0x5ab071(_0x2dd1de);})[_0x0036('0x25')](function(_0x5aca2e){logger[_0x0036('0x14')]('GetVoiceQueueRtPauses',_0x5aca2e[_0x0036('0x17')],_0x4f45e3);_0x249977(_0x4e4d48['error'](0x1f4,_0x5aca2e[_0x0036('0x17')]));});});}; \ No newline at end of file +var _0x42e0=['client','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x42e0,0x16e));var _0x042e=function(_0x32ba76,_0x22d423){_0x32ba76=_0x32ba76-0x0;var _0x34bcfe=_0x42e0[_0x32ba76];return _0x34bcfe;};'use strict';var _=require(_0x042e('0x0'));var util=require(_0x042e('0x1'));var moment=require('moment');var BPromise=require(_0x042e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x042e('0x3'));var db=require(_0x042e('0x4'))['db'];var utils=require(_0x042e('0x5'));var logger=require('../../config/logger')(_0x042e('0x6'));var config=require('../../config/environment');var jayson=require(_0x042e('0x7'));var client=jayson[_0x042e('0x8')]['http']({'port':0x232a});config[_0x042e('0x9')]=_['defaults'](config[_0x042e('0x9')],{'host':_0x042e('0xa'),'port':0x18eb});var socket=require(_0x042e('0xb'))(new Redis(config[_0x042e('0x9')]));require(_0x042e('0xc'))[_0x042e('0xd')](socket);function respondWithRpcPromise(_0x438f68,_0x2f7e1a,_0x17b00d){return new BPromise(function(_0xd1a5f2,_0x5bef64){return client[_0x042e('0xe')](_0x438f68,_0x17b00d)['then'](function(_0xb2f5b6){logger[_0x042e('0xf')](_0x042e('0x10'),_0x2f7e1a,_0x042e('0x11'));logger[_0x042e('0x12')](_0x042e('0x13'),_0x2f7e1a,'request\x20sent',JSON['stringify'](_0xb2f5b6));if(_0xb2f5b6[_0x042e('0x14')]){if(_0xb2f5b6[_0x042e('0x14')][_0x042e('0x15')]===0x1f4){logger[_0x042e('0x14')](_0x042e('0x10'),_0x2f7e1a,_0xb2f5b6[_0x042e('0x14')][_0x042e('0x16')]);return _0x5bef64(_0xb2f5b6[_0x042e('0x14')][_0x042e('0x16')]);}logger[_0x042e('0x14')](_0x042e('0x10'),_0x2f7e1a,_0xb2f5b6['error']['message']);return _0xd1a5f2(_0xb2f5b6[_0x042e('0x14')]['message']);}else{logger[_0x042e('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2f7e1a,_0x042e('0x11'));_0xd1a5f2(_0xb2f5b6[_0x042e('0x17')][_0x042e('0x16')]);}})[_0x042e('0x18')](function(_0x472d14){logger['error'](_0x042e('0x10'),_0x2f7e1a,_0x472d14);_0x5bef64(_0x472d14);});});}exports['GetVoiceQueueRtPauses']=function(_0x20f445){var _0xc999df=this;return new Promise(function(_0xd3dcb7,_0x1e653c){return db['UserVoiceQueueRt'][_0x042e('0x19')]({'raw':_0x20f445[_0x042e('0x1a')]?_0x20f445['options'][_0x042e('0x1b')]===undefined?!![]:![]:!![],'where':_0x20f445[_0x042e('0x1a')]?_0x20f445[_0x042e('0x1a')]['where']||null:null,'attributes':[[db[_0x042e('0x1c')]['fn'](_0x042e('0x1d'),db[_0x042e('0x1c')]['fn']('IF',db[_0x042e('0x1c')][_0x042e('0x1e')](_0x042e('0x1f')))),_0x042e('0x20')]]})['then'](function(_0x4cd652){logger[_0x042e('0xf')](_0x042e('0x21'),_0x20f445);logger[_0x042e('0x12')](_0x042e('0x21'),_0x20f445,JSON['stringify'](_0x4cd652));_0xd3dcb7(_0x4cd652);})[_0x042e('0x18')](function(_0x4408d2){logger['error'](_0x042e('0x21'),_0x4408d2[_0x042e('0x16')],_0x20f445);_0x1e653c(_0xc999df[_0x042e('0x14')](0x1f4,_0x4408d2[_0x042e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2fbee97..811fc1f 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 _0x11e5=['remove','update','emit','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x1ea900,_0x21302e){var _0x182004=function(_0x1d3180){while(--_0x1d3180){_0x1ea900['push'](_0x1ea900['shift']());}};_0x182004(++_0x21302e);}(_0x11e5,0x8b));var _0x511e=function(_0x495baa,_0x267a3c){_0x495baa=_0x495baa-0x0;var _0x308f21=_0x11e5[_0x495baa];return _0x308f21;};'use strict';var UserVoiceQueueRtEvents=require(_0x511e('0x0'));var events=['save',_0x511e('0x1'),_0x511e('0x2')];function createListener(_0x5bba15,_0x2947e4){return function(_0x30fb24){_0x2947e4[_0x511e('0x3')](_0x5bba15,_0x30fb24);};}function removeListener(_0x5cab33,_0x249e4d){return function(){UserVoiceQueueRtEvents['removeListener'](_0x5cab33,_0x249e4d);};}exports['register']=function(_0x342539){for(var _0x323f8c=0x0,_0x466dec=events['length'];_0x323f8c<_0x466dec;_0x323f8c++){var _0x47cf56=events[_0x323f8c];var _0x3ebc4b=createListener(_0x511e('0x4')+_0x47cf56,_0x342539);UserVoiceQueueRtEvents['on'](_0x47cf56,_0x3ebc4b);}}; \ No newline at end of file +var _0x3831=['removeListener','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update'];(function(_0x518bf5,_0x4367b9){var _0x1e6be8=function(_0x7f919f){while(--_0x7f919f){_0x518bf5['push'](_0x518bf5['shift']());}};_0x1e6be8(++_0x4367b9);}(_0x3831,0x14c));var _0x1383=function(_0x561195,_0x1f9dec){_0x561195=_0x561195-0x0;var _0x5c87c3=_0x3831[_0x561195];return _0x5c87c3;};'use strict';var UserVoiceQueueRtEvents=require(_0x1383('0x0'));var events=['save',_0x1383('0x1'),_0x1383('0x2')];function createListener(_0x3a25fd,_0x15e6b5){return function(_0x391bef){_0x15e6b5['emit'](_0x3a25fd,_0x391bef);};}function removeListener(_0x2fdf72,_0x573874){return function(){UserVoiceQueueRtEvents[_0x1383('0x3')](_0x2fdf72,_0x573874);};}exports['register']=function(_0x5b64b1){for(var _0x5eb4d8=0x0,_0x45a030=events['length'];_0x5eb4d8<_0x45a030;_0x5eb4d8++){var _0x187027=events[_0x5eb4d8];var _0x1ddd4c=createListener(_0x1383('0x4')+_0x187027,_0x5b64b1);UserVoiceQueueRtEvents['on'](_0x187027,_0x1ddd4c);}}; \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 55b4d98..673e4b1 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 _0xf4eb=['../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','Router'];(function(_0x28af14,_0x4115da){var _0x3393b8=function(_0x4a5cfe){while(--_0x4a5cfe){_0x28af14['push'](_0x28af14['shift']());}};_0x3393b8(++_0x4115da);}(_0xf4eb,0xec));var _0xbf4e=function(_0x508c8c,_0x453297){_0x508c8c=_0x508c8c-0x0;var _0x192d2a=_0xf4eb[_0x508c8c];return _0x192d2a;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf4e('0x2'));var controller=require(_0xbf4e('0x3'));router[_0xbf4e('0x4')]('/',auth[_0xbf4e('0x5')](),controller[_0xbf4e('0x6')]);router[_0xbf4e('0x4')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller[_0xbf4e('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')](_0xbf4e('0x7'),auth[_0xbf4e('0x5')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf4e('0xd')]=router; \ No newline at end of file +var _0x1be1=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x35e93c,_0x4aac86){var _0x165ffb=function(_0x397480){while(--_0x397480){_0x35e93c['push'](_0x35e93c['shift']());}};_0x165ffb(++_0x4aac86);}(_0x1be1,0x192));var _0x11be=function(_0x545be0,_0x1e819e){_0x545be0=_0x545be0-0x0;var _0x18e6f6=_0x1be1[_0x545be0];return _0x18e6f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var auth=require(_0x11be('0x3'));var interaction=require(_0x11be('0x4'));var config=require(_0x11be('0x5'));var controller=require('./variable.controller');router[_0x11be('0x6')]('/',auth[_0x11be('0x7')](),controller[_0x11be('0x8')]);router['get'](_0x11be('0x9'),auth['isAuthenticated'](),controller[_0x11be('0xa')]);router[_0x11be('0xb')]('/',auth[_0x11be('0x7')](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/:id',auth[_0x11be('0x7')](),controller[_0x11be('0xe')]);router['delete'](_0x11be('0x9'),auth[_0x11be('0x7')](),controller[_0x11be('0xf')]);module[_0x11be('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index e75381e..2facccf 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 _0x0765=['exports','STRING','name'];(function(_0xc44054,_0x3968ba){var _0x1afb94=function(_0x397407){while(--_0x397407){_0xc44054['push'](_0xc44054['shift']());}};_0x1afb94(++_0x3968ba);}(_0x0765,0x11a));var _0x5076=function(_0x2a49c2,_0x335eb0){_0x2a49c2=_0x2a49c2-0x0;var _0xed4443=_0x0765[_0x2a49c2];return _0xed4443;};'use strict';var Sequelize=require('sequelize');module[_0x5076('0x0')]={'name':{'type':Sequelize[_0x5076('0x1')],'unique':_0x5076('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5076('0x1')]}}; \ No newline at end of file +var _0x593b=['STRING','name','sequelize','exports'];(function(_0x5ae893,_0x5b4a78){var _0x4200eb=function(_0x111ccd){while(--_0x111ccd){_0x5ae893['push'](_0x5ae893['shift']());}};_0x4200eb(++_0x5b4a78);}(_0x593b,0xba));var _0xb593=function(_0x5b09c3,_0x2e2102){_0x5b09c3=_0x5b09c3-0x0;var _0x1083a0=_0x593b[_0x5b09c3];return _0x1083a0;};'use strict';var Sequelize=require(_0xb593('0x0'));module[_0xb593('0x1')]={'name':{'type':Sequelize[_0xb593('0x2')],'unique':_0xb593('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb593('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 43a9bfd..a50a1f4 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 _0x6f18=['where','pick','add','day','merge','filter','map','options','include','findAll','rows','show','params','intersection','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','catch','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Variables','error','name','index','Variable','rawAttributes','model','keys','dateEnd','query','dateStart','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x17e761,_0x18e027){var _0x4ed647=function(_0x1fd72c){while(--_0x1fd72c){_0x17e761['push'](_0x17e761['shift']());}};_0x4ed647(++_0x18e027);}(_0x6f18,0x1b4));var _0x86f1=function(_0x46fa2c,_0x17d2ac){_0x46fa2c=_0x46fa2c-0x0;var _0x4a55fc=_0x6f18[_0x46fa2c];return _0x4a55fc;};'use strict';var pdf=require(_0x86f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x86f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86f1('0x2'));var rp=require(_0x86f1('0x3'));var moment=require('moment');var BPromise=require(_0x86f1('0x4'));var Mustache=require(_0x86f1('0x5'));var util=require('util');var path=require(_0x86f1('0x6'));var sox=require(_0x86f1('0x7'));var csv=require(_0x86f1('0x8'));var ejs=require(_0x86f1('0x9'));var fs=require('fs');var _=require(_0x86f1('0xa'));var squel=require('squel');var crypto=require(_0x86f1('0xb'));var jsforce=require(_0x86f1('0xc'));var deskjs=require(_0x86f1('0xd'));var toCsv=require(_0x86f1('0x8'));var querystring=require(_0x86f1('0xe'));var Papa=require('papaparse');var Redis=require(_0x86f1('0xf'));var qs=require(_0x86f1('0x10'));var logger=require(_0x86f1('0x11'))(_0x86f1('0x12'));var utils=require(_0x86f1('0x13'));var config=require(_0x86f1('0x14'));var db=require(_0x86f1('0x15'))['db'];function respondWithStatusCode(_0x46f023,_0x47ab73){_0x47ab73=_0x47ab73||0xcc;return function(_0x64a3c1){if(_0x64a3c1){return _0x46f023[_0x86f1('0x16')](_0x47ab73);}return _0x46f023[_0x86f1('0x17')](_0x47ab73)[_0x86f1('0x18')]();};}function respondWithResult(_0x692342,_0x28afe9){_0x28afe9=_0x28afe9||0xc8;return function(_0x56d974){if(_0x56d974){return _0x692342[_0x86f1('0x17')](_0x28afe9)[_0x86f1('0x19')](_0x56d974);}};}function respondWithFilteredResult(_0x1b16ff,_0x648502){return function(_0x2a2281){if(_0x2a2281){var _0x32ccd1=_0x2a2281[_0x86f1('0x1a')],_0x117cc4=_0x648502[_0x86f1('0x1b')],_0x2a05b5=_0x648502[_0x86f1('0x1b')]+_0x648502[_0x86f1('0x1c')],_0x512cde;if(_0x2a05b5>=_0x32ccd1){_0x2a05b5=_0x32ccd1;_0x512cde=0xc8;}else{_0x512cde=0xce;}_0x1b16ff[_0x86f1('0x17')](_0x512cde);return _0x1b16ff[_0x86f1('0x1d')](_0x86f1('0x1e'),_0x117cc4+'-'+_0x2a05b5+'/'+_0x32ccd1)[_0x86f1('0x19')](_0x2a2281);}return null;};}function patchUpdates(_0x1adad5){return function(_0x4fd6dc){try{jsonpatch[_0x86f1('0x1f')](_0x4fd6dc,_0x1adad5,!![]);}catch(_0x31ded6){return BPromise[_0x86f1('0x20')](_0x31ded6);}return _0x4fd6dc['save']();};}function saveUpdates(_0x5aba4f,_0x3c16d9){return function(_0x27d172){if(_0x27d172){return _0x27d172[_0x86f1('0x21')](_0x5aba4f)[_0x86f1('0x22')](function(_0xabac12){return _0xabac12;});}return null;};}function removeEntity(_0x2196fd,_0x2b7e68){return function(_0xe937bc){if(_0xe937bc){return _0xe937bc[_0x86f1('0x23')]()[_0x86f1('0x22')](function(){var _0x4c13ed=_0xe937bc[_0x86f1('0x24')]({'plain':!![]});var _0x22e66f=_0x86f1('0x25');return db['UserProfileResource'][_0x86f1('0x23')]({'where':{'type':_0x22e66f,'resourceId':_0x4c13ed['id']}})['then'](function(){return _0xe937bc;});})[_0x86f1('0x22')](function(){_0x2196fd[_0x86f1('0x17')](0xcc)[_0x86f1('0x18')]();});}};}function handleEntityNotFound(_0x188e61,_0x57573){return function(_0x2efae9){if(!_0x2efae9){_0x188e61[_0x86f1('0x16')](0x194);}return _0x2efae9;};}function handleError(_0x3b3809,_0x1b535d){_0x1b535d=_0x1b535d||0x1f4;return function(_0x20aa1b){logger[_0x86f1('0x26')](_0x20aa1b['stack']);if(_0x20aa1b[_0x86f1('0x27')]){delete _0x20aa1b[_0x86f1('0x27')];}_0x3b3809['status'](_0x1b535d)['send'](_0x20aa1b);};}exports[_0x86f1('0x28')]=function(_0x3087d9,_0x39685e){var _0x5f18ad={},_0x16e3b3={},_0x210ed8={'count':0x0,'rows':[]};var _0x4f4e25=db[_0x86f1('0x29')][_0x86f1('0x2a')];_0x16e3b3[_0x86f1('0x2b')]=_[_0x86f1('0x2c')](_0x4f4e25);var _0x28f690={'dateStart':_0x3087d9['query']['dateStart'],'dateEnd':_0x3087d9['query'][_0x86f1('0x2d')]};delete _0x3087d9[_0x86f1('0x2e')][_0x86f1('0x2f')];delete _0x3087d9[_0x86f1('0x2e')][_0x86f1('0x2d')];_0x16e3b3['query']=_[_0x86f1('0x2c')](_0x3087d9['query']);_0x16e3b3[_0x86f1('0x30')]=_['intersection'](_0x16e3b3[_0x86f1('0x2b')],_0x16e3b3[_0x86f1('0x2e')]);_0x5f18ad[_0x86f1('0x31')]=_['intersection'](_0x16e3b3[_0x86f1('0x2b')],qs[_0x86f1('0x32')](_0x3087d9[_0x86f1('0x2e')]['fields']));_0x5f18ad['attributes']=_0x5f18ad[_0x86f1('0x31')][_0x86f1('0x33')]?_0x5f18ad[_0x86f1('0x31')]:_0x16e3b3[_0x86f1('0x2b')];if(!_0x3087d9[_0x86f1('0x2e')][_0x86f1('0x34')](_0x86f1('0x35'))){_0x5f18ad[_0x86f1('0x1c')]=qs[_0x86f1('0x1c')](_0x3087d9[_0x86f1('0x2e')][_0x86f1('0x1c')]);_0x5f18ad[_0x86f1('0x1b')]=qs[_0x86f1('0x1b')](_0x3087d9['query']['offset']);}_0x5f18ad[_0x86f1('0x36')]=qs['sort'](_0x3087d9['query'][_0x86f1('0x37')]);_0x5f18ad[_0x86f1('0x38')]=qs[_0x86f1('0x30')](_[_0x86f1('0x39')](_0x3087d9[_0x86f1('0x2e')],_0x16e3b3[_0x86f1('0x30')]));if(_0x28f690['dateStart']){if(_0x28f690['dateEnd']){_0x28f690[_0x86f1('0x2d')]=moment(_0x28f690[_0x86f1('0x2d')])['add'](0x1,'day');}else{_0x28f690['dateEnd']=moment(_0x28f690[_0x86f1('0x2f')])[_0x86f1('0x3a')](0x1,_0x86f1('0x3b'));}_[_0x86f1('0x3c')](_0x5f18ad['where'],{'createdAt':{'$gte':_0x28f690[_0x86f1('0x2f')],'$lte':_0x28f690[_0x86f1('0x2d')]}});}if(_0x3087d9[_0x86f1('0x2e')][_0x86f1('0x3d')]){_0x5f18ad[_0x86f1('0x38')]=_[_0x86f1('0x3c')](_0x5f18ad[_0x86f1('0x38')],{'$or':_[_0x86f1('0x3e')](_0x5f18ad['attributes'],function(_0x18ee29){var _0x1a1062={};_0x1a1062[_0x18ee29]={'$like':'%'+_0x3087d9[_0x86f1('0x2e')][_0x86f1('0x3d')]+'%'};return _0x1a1062;})});}_0x5f18ad=_[_0x86f1('0x3c')]({},_0x5f18ad,_0x3087d9[_0x86f1('0x3f')]);var _0x1d57d2={'where':_0x5f18ad[_0x86f1('0x38')]};return db[_0x86f1('0x29')][_0x86f1('0x1a')](_0x1d57d2)[_0x86f1('0x22')](function(_0x15485a){_0x210ed8[_0x86f1('0x1a')]=_0x15485a;if(_0x3087d9['query']['includeAll']){_0x5f18ad[_0x86f1('0x40')]=[{'all':!![]}];}return db[_0x86f1('0x29')][_0x86f1('0x41')](_0x5f18ad);})[_0x86f1('0x22')](function(_0x457907){_0x210ed8[_0x86f1('0x42')]=_0x457907;return _0x210ed8;})[_0x86f1('0x22')](respondWithFilteredResult(_0x39685e,_0x5f18ad))['catch'](handleError(_0x39685e,null));};exports[_0x86f1('0x43')]=function(_0x5c2741,_0x456be6){var _0x49611d={'raw':!![],'where':{'id':_0x5c2741[_0x86f1('0x44')]['id']}},_0x2352aa={};_0x2352aa[_0x86f1('0x2b')]=_[_0x86f1('0x2c')](db[_0x86f1('0x29')][_0x86f1('0x2a')]);_0x2352aa[_0x86f1('0x2e')]=_[_0x86f1('0x2c')](_0x5c2741[_0x86f1('0x2e')]);_0x2352aa[_0x86f1('0x30')]=_[_0x86f1('0x45')](_0x2352aa[_0x86f1('0x2b')],_0x2352aa[_0x86f1('0x2e')]);_0x49611d['attributes']=_[_0x86f1('0x45')](_0x2352aa[_0x86f1('0x2b')],qs[_0x86f1('0x32')](_0x5c2741[_0x86f1('0x2e')][_0x86f1('0x32')]));_0x49611d['attributes']=_0x49611d[_0x86f1('0x31')][_0x86f1('0x33')]?_0x49611d[_0x86f1('0x31')]:_0x2352aa[_0x86f1('0x2b')];if(_0x5c2741[_0x86f1('0x2e')][_0x86f1('0x46')]){_0x49611d[_0x86f1('0x40')]=[{'all':!![]}];}_0x49611d=_['merge']({},_0x49611d,_0x5c2741['options']);return db[_0x86f1('0x29')]['find'](_0x49611d)[_0x86f1('0x22')](handleEntityNotFound(_0x456be6,null))[_0x86f1('0x22')](respondWithResult(_0x456be6,null))['catch'](handleError(_0x456be6,null));};exports[_0x86f1('0x47')]=function(_0x673941,_0x6851f1){return db[_0x86f1('0x29')][_0x86f1('0x47')](_0x673941['body'],{})['then'](function(_0x11a2ea){var _0x316027=_0x673941[_0x86f1('0x48')][_0x86f1('0x24')]({'plain':!![]});if(!_0x316027)throw new Error(_0x86f1('0x49'));if(_0x316027[_0x86f1('0x4a')]===_0x86f1('0x48')){var _0x5db97d=_0x11a2ea[_0x86f1('0x24')]({'plain':!![]});var _0xdac27d=_0x86f1('0x25');return db[_0x86f1('0x4b')][_0x86f1('0x4c')]({'where':{'name':_0xdac27d,'userProfileId':_0x316027[_0x86f1('0x4d')]},'raw':!![]})[_0x86f1('0x22')](function(_0x21aa32){if(_0x21aa32&&_0x21aa32['autoAssociation']===0x0){return db[_0x86f1('0x4e')]['create']({'name':_0x5db97d['name'],'resourceId':_0x5db97d['id'],'type':_0x21aa32[_0x86f1('0x27')],'sectionId':_0x21aa32['id']},{})[_0x86f1('0x22')](function(){return _0x11a2ea;});}else{return _0x11a2ea;}})['catch'](function(_0x997b5c){logger[_0x86f1('0x26')](_0x86f1('0x4f'),_0x997b5c);throw _0x997b5c;});}return _0x11a2ea;})[_0x86f1('0x22')](respondWithResult(_0x6851f1,0xc9))['catch'](handleError(_0x6851f1,null));};exports['update']=function(_0x2d4e8c,_0x3c9662){if(_0x2d4e8c[_0x86f1('0x50')]['id']){delete _0x2d4e8c[_0x86f1('0x50')]['id'];}return db['Variable'][_0x86f1('0x4c')]({'where':{'id':_0x2d4e8c[_0x86f1('0x44')]['id']}})[_0x86f1('0x22')](handleEntityNotFound(_0x3c9662,null))[_0x86f1('0x22')](saveUpdates(_0x2d4e8c[_0x86f1('0x50')],null))[_0x86f1('0x22')](respondWithResult(_0x3c9662,null))[_0x86f1('0x51')](handleError(_0x3c9662,null));};exports[_0x86f1('0x23')]=function(_0x374731,_0x424201){return db[_0x86f1('0x29')][_0x86f1('0x4c')]({'where':{'id':_0x374731[_0x86f1('0x44')]['id']}})[_0x86f1('0x22')](handleEntityNotFound(_0x424201,null))[_0x86f1('0x22')](removeEntity(_0x424201,null))[_0x86f1('0x51')](handleError(_0x424201,null));}; \ No newline at end of file +var _0xf643=['end','json','count','offset','limit','set','then','destroy','get','error','stack','name','send','index','Variable','rawAttributes','dateStart','query','dateEnd','keys','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','filters','pick','day','merge','map','filter','include','findAll','rows','catch','show','params','includeAll','options','find','create','user','role','Variables','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x2ee0fd,_0x439694){var _0x4887d0=function(_0x3e739c){while(--_0x3e739c){_0x2ee0fd['push'](_0x2ee0fd['shift']());}};_0x4887d0(++_0x439694);}(_0xf643,0x122));var _0x3f64=function(_0x11392d,_0x2336c9){_0x11392d=_0x11392d-0x0;var _0x478fa8=_0xf643[_0x11392d];return _0x478fa8;};'use strict';var pdf=require(_0x3f64('0x0'));var emlformat=require(_0x3f64('0x1'));var rimraf=require(_0x3f64('0x2'));var zipdir=require(_0x3f64('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f64('0x4'));var moment=require(_0x3f64('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3f64('0x6'));var util=require(_0x3f64('0x7'));var path=require(_0x3f64('0x8'));var sox=require(_0x3f64('0x9'));var csv=require(_0x3f64('0xa'));var ejs=require(_0x3f64('0xb'));var fs=require('fs');var _=require(_0x3f64('0xc'));var squel=require(_0x3f64('0xd'));var crypto=require(_0x3f64('0xe'));var jsforce=require(_0x3f64('0xf'));var deskjs=require(_0x3f64('0x10'));var toCsv=require(_0x3f64('0xa'));var querystring=require(_0x3f64('0x11'));var Papa=require(_0x3f64('0x12'));var Redis=require(_0x3f64('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x3f64('0x14'))(_0x3f64('0x15'));var utils=require(_0x3f64('0x16'));var config=require('../../config/environment');var db=require(_0x3f64('0x17'))['db'];function respondWithStatusCode(_0x42fb23,_0x23e825){_0x23e825=_0x23e825||0xcc;return function(_0x1fac7c){if(_0x1fac7c){return _0x42fb23[_0x3f64('0x18')](_0x23e825);}return _0x42fb23[_0x3f64('0x19')](_0x23e825)[_0x3f64('0x1a')]();};}function respondWithResult(_0x55dd00,_0xda7b1){_0xda7b1=_0xda7b1||0xc8;return function(_0x29d8f5){if(_0x29d8f5){return _0x55dd00[_0x3f64('0x19')](_0xda7b1)[_0x3f64('0x1b')](_0x29d8f5);}};}function respondWithFilteredResult(_0x505e9f,_0x84d3a9){return function(_0x1af45b){if(_0x1af45b){var _0x3fb0bd=_0x1af45b[_0x3f64('0x1c')],_0x1f215d=_0x84d3a9[_0x3f64('0x1d')],_0x52acab=_0x84d3a9[_0x3f64('0x1d')]+_0x84d3a9[_0x3f64('0x1e')],_0x1c4059;if(_0x52acab>=_0x3fb0bd){_0x52acab=_0x3fb0bd;_0x1c4059=0xc8;}else{_0x1c4059=0xce;}_0x505e9f[_0x3f64('0x19')](_0x1c4059);return _0x505e9f[_0x3f64('0x1f')]('Content-Range',_0x1f215d+'-'+_0x52acab+'/'+_0x3fb0bd)[_0x3f64('0x1b')](_0x1af45b);}return null;};}function patchUpdates(_0x7bca32){return function(_0x2cdac6){try{jsonpatch['apply'](_0x2cdac6,_0x7bca32,!![]);}catch(_0x628b59){return BPromise['reject'](_0x628b59);}return _0x2cdac6['save']();};}function saveUpdates(_0xe904d9,_0x38cea3){return function(_0x15d0fb){if(_0x15d0fb){return _0x15d0fb['update'](_0xe904d9)[_0x3f64('0x20')](function(_0x301d72){return _0x301d72;});}return null;};}function removeEntity(_0x211c91,_0x5f5507){return function(_0x16b3fd){if(_0x16b3fd){return _0x16b3fd[_0x3f64('0x21')]()['then'](function(){var _0xc72655=_0x16b3fd[_0x3f64('0x22')]({'plain':!![]});var _0x53cd96='Variables';return db['UserProfileResource'][_0x3f64('0x21')]({'where':{'type':_0x53cd96,'resourceId':_0xc72655['id']}})[_0x3f64('0x20')](function(){return _0x16b3fd;});})[_0x3f64('0x20')](function(){_0x211c91[_0x3f64('0x19')](0xcc)[_0x3f64('0x1a')]();});}};}function handleEntityNotFound(_0x48be0c,_0x222097){return function(_0x4702a3){if(!_0x4702a3){_0x48be0c[_0x3f64('0x18')](0x194);}return _0x4702a3;};}function handleError(_0x142fe5,_0x383780){_0x383780=_0x383780||0x1f4;return function(_0x26e152){logger[_0x3f64('0x23')](_0x26e152[_0x3f64('0x24')]);if(_0x26e152['name']){delete _0x26e152[_0x3f64('0x25')];}_0x142fe5['status'](_0x383780)[_0x3f64('0x26')](_0x26e152);};}exports[_0x3f64('0x27')]=function(_0x43f349,_0x2fac90){var _0x191a2d={},_0x307efc={},_0x286b2a={'count':0x0,'rows':[]};var _0x1bcefe=db[_0x3f64('0x28')][_0x3f64('0x29')];_0x307efc['model']=_['keys'](_0x1bcefe);var _0x25ec96={'dateStart':_0x43f349['query'][_0x3f64('0x2a')],'dateEnd':_0x43f349[_0x3f64('0x2b')][_0x3f64('0x2c')]};delete _0x43f349[_0x3f64('0x2b')]['dateStart'];delete _0x43f349['query'][_0x3f64('0x2c')];_0x307efc[_0x3f64('0x2b')]=_[_0x3f64('0x2d')](_0x43f349[_0x3f64('0x2b')]);_0x307efc['filters']=_[_0x3f64('0x2e')](_0x307efc['model'],_0x307efc['query']);_0x191a2d['attributes']=_[_0x3f64('0x2e')](_0x307efc['model'],qs[_0x3f64('0x2f')](_0x43f349['query'][_0x3f64('0x2f')]));_0x191a2d[_0x3f64('0x30')]=_0x191a2d[_0x3f64('0x30')][_0x3f64('0x31')]?_0x191a2d['attributes']:_0x307efc[_0x3f64('0x32')];if(!_0x43f349[_0x3f64('0x2b')][_0x3f64('0x33')]('nolimit')){_0x191a2d['limit']=qs[_0x3f64('0x1e')](_0x43f349['query'][_0x3f64('0x1e')]);_0x191a2d[_0x3f64('0x1d')]=qs[_0x3f64('0x1d')](_0x43f349['query'][_0x3f64('0x1d')]);}_0x191a2d[_0x3f64('0x34')]=qs[_0x3f64('0x35')](_0x43f349[_0x3f64('0x2b')][_0x3f64('0x35')]);_0x191a2d[_0x3f64('0x36')]=qs[_0x3f64('0x37')](_[_0x3f64('0x38')](_0x43f349[_0x3f64('0x2b')],_0x307efc[_0x3f64('0x37')]));if(_0x25ec96[_0x3f64('0x2a')]){if(_0x25ec96[_0x3f64('0x2c')]){_0x25ec96[_0x3f64('0x2c')]=moment(_0x25ec96[_0x3f64('0x2c')])['add'](0x1,_0x3f64('0x39'));}else{_0x25ec96[_0x3f64('0x2c')]=moment(_0x25ec96[_0x3f64('0x2a')])['add'](0x1,_0x3f64('0x39'));}_[_0x3f64('0x3a')](_0x191a2d[_0x3f64('0x36')],{'createdAt':{'$gte':_0x25ec96[_0x3f64('0x2a')],'$lte':_0x25ec96[_0x3f64('0x2c')]}});}if(_0x43f349[_0x3f64('0x2b')]['filter']){_0x191a2d[_0x3f64('0x36')]=_['merge'](_0x191a2d[_0x3f64('0x36')],{'$or':_[_0x3f64('0x3b')](_0x191a2d[_0x3f64('0x30')],function(_0x4e7bd9){var _0x4462fa={};_0x4462fa[_0x4e7bd9]={'$like':'%'+_0x43f349[_0x3f64('0x2b')][_0x3f64('0x3c')]+'%'};return _0x4462fa;})});}_0x191a2d=_[_0x3f64('0x3a')]({},_0x191a2d,_0x43f349['options']);var _0x70ba90={'where':_0x191a2d[_0x3f64('0x36')]};return db[_0x3f64('0x28')][_0x3f64('0x1c')](_0x70ba90)['then'](function(_0x5c6a22){_0x286b2a[_0x3f64('0x1c')]=_0x5c6a22;if(_0x43f349[_0x3f64('0x2b')]['includeAll']){_0x191a2d[_0x3f64('0x3d')]=[{'all':!![]}];}return db[_0x3f64('0x28')][_0x3f64('0x3e')](_0x191a2d);})['then'](function(_0x115a30){_0x286b2a[_0x3f64('0x3f')]=_0x115a30;return _0x286b2a;})['then'](respondWithFilteredResult(_0x2fac90,_0x191a2d))[_0x3f64('0x40')](handleError(_0x2fac90,null));};exports[_0x3f64('0x41')]=function(_0x12a382,_0x3fed32){var _0x2f51ce={'raw':!![],'where':{'id':_0x12a382[_0x3f64('0x42')]['id']}},_0x3bbd64={};_0x3bbd64[_0x3f64('0x32')]=_[_0x3f64('0x2d')](db[_0x3f64('0x28')][_0x3f64('0x29')]);_0x3bbd64[_0x3f64('0x2b')]=_[_0x3f64('0x2d')](_0x12a382['query']);_0x3bbd64['filters']=_[_0x3f64('0x2e')](_0x3bbd64[_0x3f64('0x32')],_0x3bbd64[_0x3f64('0x2b')]);_0x2f51ce[_0x3f64('0x30')]=_['intersection'](_0x3bbd64[_0x3f64('0x32')],qs[_0x3f64('0x2f')](_0x12a382[_0x3f64('0x2b')][_0x3f64('0x2f')]));_0x2f51ce[_0x3f64('0x30')]=_0x2f51ce[_0x3f64('0x30')][_0x3f64('0x31')]?_0x2f51ce[_0x3f64('0x30')]:_0x3bbd64[_0x3f64('0x32')];if(_0x12a382['query'][_0x3f64('0x43')]){_0x2f51ce[_0x3f64('0x3d')]=[{'all':!![]}];}_0x2f51ce=_[_0x3f64('0x3a')]({},_0x2f51ce,_0x12a382[_0x3f64('0x44')]);return db['Variable'][_0x3f64('0x45')](_0x2f51ce)[_0x3f64('0x20')](handleEntityNotFound(_0x3fed32,null))['then'](respondWithResult(_0x3fed32,null))[_0x3f64('0x40')](handleError(_0x3fed32,null));};exports[_0x3f64('0x46')]=function(_0x12a956,_0xae2783){return db[_0x3f64('0x28')]['create'](_0x12a956['body'],{})[_0x3f64('0x20')](function(_0x481bfa){var _0xa026a=_0x12a956[_0x3f64('0x47')][_0x3f64('0x22')]({'plain':!![]});if(!_0xa026a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa026a[_0x3f64('0x48')]===_0x3f64('0x47')){var _0x428ef2=_0x481bfa[_0x3f64('0x22')]({'plain':!![]});var _0x5b5ad0=_0x3f64('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x5b5ad0,'userProfileId':_0xa026a[_0x3f64('0x4a')]},'raw':!![]})[_0x3f64('0x20')](function(_0x4505c3){if(_0x4505c3&&_0x4505c3[_0x3f64('0x4b')]===0x0){return db['UserProfileResource'][_0x3f64('0x46')]({'name':_0x428ef2['name'],'resourceId':_0x428ef2['id'],'type':_0x4505c3[_0x3f64('0x25')],'sectionId':_0x4505c3['id']},{})['then'](function(){return _0x481bfa;});}else{return _0x481bfa;}})['catch'](function(_0x313789){logger[_0x3f64('0x23')](_0x3f64('0x4c'),_0x313789);throw _0x313789;});}return _0x481bfa;})[_0x3f64('0x20')](respondWithResult(_0xae2783,0xc9))[_0x3f64('0x40')](handleError(_0xae2783,null));};exports[_0x3f64('0x4d')]=function(_0x135781,_0x43411c){if(_0x135781['body']['id']){delete _0x135781[_0x3f64('0x4e')]['id'];}return db[_0x3f64('0x28')][_0x3f64('0x45')]({'where':{'id':_0x135781[_0x3f64('0x42')]['id']}})[_0x3f64('0x20')](handleEntityNotFound(_0x43411c,null))['then'](saveUpdates(_0x135781['body'],null))[_0x3f64('0x20')](respondWithResult(_0x43411c,null))[_0x3f64('0x40')](handleError(_0x43411c,null));};exports[_0x3f64('0x21')]=function(_0x2ad021,_0x5f05b8){return db[_0x3f64('0x28')][_0x3f64('0x45')]({'where':{'id':_0x2ad021[_0x3f64('0x42')]['id']}})[_0x3f64('0x20')](handleEntityNotFound(_0x5f05b8,null))[_0x3f64('0x20')](removeEntity(_0x5f05b8,null))['catch'](handleError(_0x5f05b8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 5e74bd7..d0183ab 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 _0xabce=['./variable.attributes','exports','Variable','lodash','util','../../config/logger','api','moment'];(function(_0x2e8e1e,_0xc5e216){var _0x3f7687=function(_0x405e67){while(--_0x405e67){_0x2e8e1e['push'](_0x2e8e1e['shift']());}};_0x3f7687(++_0xc5e216);}(_0xabce,0x103));var _0xeabc=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xabce[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xeabc('0x5'));module[_0xeabc('0x6')]=function(_0x1a88a7,_0x5e9e2d){return _0x1a88a7['define'](_0xeabc('0x7'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['./variable.attributes','Variable','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4d209e,_0x24e53d){var _0x4b8dd3=function(_0x53fb4f){while(--_0x53fb4f){_0x4d209e['push'](_0x4d209e['shift']());}};_0x4b8dd3(++_0x24e53d);}(_0x53ec,0x192));var _0xc53e=function(_0x3cebff,_0x20b43d){_0x3cebff=_0x3cebff-0x0;var _0x6e5423=_0x53ec[_0x3cebff];return _0x6e5423;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var attributes=require(_0xc53e('0x6'));module['exports']=function(_0x2b90f6,_0x38033d){return _0x2b90f6['define'](_0xc53e('0x7'),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 9c5dbdc..6698ce4 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 _0xc1db=['stringify','error','code','Variable,\x20%s,\x20%s','message','catch','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc1db,0x108));var _0xbc1d=function(_0x183bb7,_0x10d41c){_0x183bb7=_0x183bb7-0x0;var _0x2cb8bf=_0xc1db[_0x183bb7];return _0x2cb8bf;};'use strict';var _=require('lodash');var util=require(_0xbc1d('0x0'));var moment=require(_0xbc1d('0x1'));var BPromise=require(_0xbc1d('0x2'));var rs=require(_0xbc1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc1d('0x4'))['db'];var utils=require(_0xbc1d('0x5'));var logger=require(_0xbc1d('0x6'))('rpc');var config=require(_0xbc1d('0x7'));var jayson=require(_0xbc1d('0x8'));var client=jayson[_0xbc1d('0x9')][_0xbc1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27c00d,_0x28932d,_0x3e1b53){return new BPromise(function(_0x2f7db7,_0x206eac){return client[_0xbc1d('0xb')](_0x27c00d,_0x3e1b53)[_0xbc1d('0xc')](function(_0x143583){logger['info']('Variable,\x20%s,\x20%s',_0x28932d,_0xbc1d('0xd'));logger[_0xbc1d('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x28932d,'request\x20sent',JSON[_0xbc1d('0xf')](_0x143583));if(_0x143583['error']){if(_0x143583[_0xbc1d('0x10')][_0xbc1d('0x11')]===0x1f4){logger[_0xbc1d('0x10')](_0xbc1d('0x12'),_0x28932d,_0x143583[_0xbc1d('0x10')][_0xbc1d('0x13')]);return _0x206eac(_0x143583[_0xbc1d('0x10')]['message']);}logger[_0xbc1d('0x10')](_0xbc1d('0x12'),_0x28932d,_0x143583[_0xbc1d('0x10')][_0xbc1d('0x13')]);return _0x2f7db7(_0x143583['error'][_0xbc1d('0x13')]);}else{logger['info'](_0xbc1d('0x12'),_0x28932d,_0xbc1d('0xd'));_0x2f7db7(_0x143583['result']['message']);}})[_0xbc1d('0x14')](function(_0x19d541){logger[_0xbc1d('0x10')]('Variable,\x20%s,\x20%s',_0x28932d,_0x19d541);_0x206eac(_0x19d541);});});}exports[_0xbc1d('0x15')]=function(_0x542541){var _0x24af72=this;return new Promise(function(_0x200804,_0x5efe1c){return db[_0xbc1d('0x16')][_0xbc1d('0x17')]({'raw':_0x542541[_0xbc1d('0x18')]?_0x542541[_0xbc1d('0x18')][_0xbc1d('0x19')]===undefined?!![]:![]:!![],'where':_0x542541[_0xbc1d('0x18')]?_0x542541['options'][_0xbc1d('0x1a')]||null:null,'attributes':_0x542541[_0xbc1d('0x18')]?_0x542541[_0xbc1d('0x18')][_0xbc1d('0x1b')]||null:null,'include':_0x542541['options']?_0x542541['options'][_0xbc1d('0x1c')]?_[_0xbc1d('0x1d')](_0x542541[_0xbc1d('0x18')][_0xbc1d('0x1c')],function(_0x2bda0f){return{'model':db[_0x2bda0f[_0xbc1d('0x1e')]],'as':_0x2bda0f['as'],'attributes':_0x2bda0f['attributes'],'include':_0x2bda0f[_0xbc1d('0x1c')]?_[_0xbc1d('0x1d')](_0x2bda0f[_0xbc1d('0x1c')],function(_0x58c6aa){return{'model':db[_0x58c6aa[_0xbc1d('0x1e')]],'as':_0x58c6aa['as'],'attributes':_0x58c6aa['attributes'],'include':_0x58c6aa[_0xbc1d('0x1c')]?_[_0xbc1d('0x1d')](_0x58c6aa[_0xbc1d('0x1c')],function(_0x3f23a5){return{'model':db[_0x3f23a5['model']],'as':_0x3f23a5['as'],'attributes':_0x3f23a5[_0xbc1d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c5754){logger['info'](_0xbc1d('0x15'),_0x542541);logger[_0xbc1d('0xe')](_0xbc1d('0x15'),_0x542541,JSON[_0xbc1d('0xf')](_0x1c5754));_0x200804(_0x1c5754);})['catch'](function(_0x418c12){logger[_0xbc1d('0x10')]('ShowVariable',_0x418c12[_0xbc1d('0x13')],_0x542541);_0x5efe1c(_0x24af72[_0xbc1d('0x10')](0x1f4,_0x418c12[_0xbc1d('0x13')]));});});}; \ No newline at end of file +var _0x0451=['rpc','jayson/promise','client','http','request','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','include','model','map','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xe27810,_0x8b3e76){var _0x53dcec=function(_0x4a83c7){while(--_0x4a83c7){_0xe27810['push'](_0xe27810['shift']());}};_0x53dcec(++_0x8b3e76);}(_0x0451,0x80));var _0x1045=function(_0x77d76e,_0x106ed2){_0x77d76e=_0x77d76e-0x0;var _0x5620c8=_0x0451[_0x77d76e];return _0x5620c8;};'use strict';var _=require(_0x1045('0x0'));var util=require(_0x1045('0x1'));var moment=require(_0x1045('0x2'));var BPromise=require(_0x1045('0x3'));var rs=require(_0x1045('0x4'));var fs=require('fs');var Redis=require(_0x1045('0x5'));var db=require(_0x1045('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1045('0x7'))(_0x1045('0x8'));var config=require('../../config/environment');var jayson=require(_0x1045('0x9'));var client=jayson[_0x1045('0xa')][_0x1045('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13df57,_0x1af2d1,_0x2c8659){return new BPromise(function(_0x202170,_0x34ffa9){return client[_0x1045('0xc')](_0x13df57,_0x2c8659)['then'](function(_0x1d2fae){logger['info'](_0x1045('0xd'),_0x1af2d1,_0x1045('0xe'));logger[_0x1045('0xf')](_0x1045('0x10'),_0x1af2d1,_0x1045('0xe'),JSON[_0x1045('0x11')](_0x1d2fae));if(_0x1d2fae[_0x1045('0x12')]){if(_0x1d2fae[_0x1045('0x12')]['code']===0x1f4){logger[_0x1045('0x12')](_0x1045('0xd'),_0x1af2d1,_0x1d2fae[_0x1045('0x12')][_0x1045('0x13')]);return _0x34ffa9(_0x1d2fae['error'][_0x1045('0x13')]);}logger[_0x1045('0x12')](_0x1045('0xd'),_0x1af2d1,_0x1d2fae[_0x1045('0x12')][_0x1045('0x13')]);return _0x202170(_0x1d2fae[_0x1045('0x12')][_0x1045('0x13')]);}else{logger[_0x1045('0x14')](_0x1045('0xd'),_0x1af2d1,'request\x20sent');_0x202170(_0x1d2fae[_0x1045('0x15')]['message']);}})[_0x1045('0x16')](function(_0x55aa41){logger[_0x1045('0x12')](_0x1045('0xd'),_0x1af2d1,_0x55aa41);_0x34ffa9(_0x55aa41);});});}exports[_0x1045('0x17')]=function(_0x46bfde){var _0x362b11=this;return new Promise(function(_0x4370a1,_0x406ddb){return db[_0x1045('0x18')][_0x1045('0x19')]({'raw':_0x46bfde[_0x1045('0x1a')]?_0x46bfde['options'][_0x1045('0x1b')]===undefined?!![]:![]:!![],'where':_0x46bfde[_0x1045('0x1a')]?_0x46bfde[_0x1045('0x1a')][_0x1045('0x1c')]||null:null,'attributes':_0x46bfde[_0x1045('0x1a')]?_0x46bfde['options'][_0x1045('0x1d')]||null:null,'include':_0x46bfde['options']?_0x46bfde[_0x1045('0x1a')][_0x1045('0x1e')]?_['map'](_0x46bfde[_0x1045('0x1a')][_0x1045('0x1e')],function(_0x2e887c){return{'model':db[_0x2e887c[_0x1045('0x1f')]],'as':_0x2e887c['as'],'attributes':_0x2e887c[_0x1045('0x1d')],'include':_0x2e887c[_0x1045('0x1e')]?_[_0x1045('0x20')](_0x2e887c[_0x1045('0x1e')],function(_0x25c47d){return{'model':db[_0x25c47d[_0x1045('0x1f')]],'as':_0x25c47d['as'],'attributes':_0x25c47d[_0x1045('0x1d')],'include':_0x25c47d['include']?_[_0x1045('0x20')](_0x25c47d[_0x1045('0x1e')],function(_0x3e2a58){return{'model':db[_0x3e2a58[_0x1045('0x1f')]],'as':_0x3e2a58['as'],'attributes':_0x3e2a58[_0x1045('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1045('0x21')](function(_0x57a464){logger['info'](_0x1045('0x17'),_0x46bfde);logger[_0x1045('0xf')](_0x1045('0x17'),_0x46bfde,JSON[_0x1045('0x11')](_0x57a464));_0x4370a1(_0x57a464);})[_0x1045('0x16')](function(_0x12771a){logger[_0x1045('0x12')](_0x1045('0x17'),_0x12771a[_0x1045('0x13')],_0x46bfde);_0x406ddb(_0x362b11[_0x1045('0x12')](0x1f4,_0x12771a['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index ff109ac..66ca009 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 _0x933e=['index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','/restart','migrations','exports','Router','../../components/auth/service','./version.controller','get'];(function(_0x28e018,_0xc5620b){var _0x22a148=function(_0x2d5aaa){while(--_0x2d5aaa){_0x28e018['push'](_0x28e018['shift']());}};_0x22a148(++_0xc5620b);}(_0x933e,0x10c));var _0xe933=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x933e[_0x122ef9];return _0x42fba0;};'use strict';var express=require('express');var router=express[_0xe933('0x0')]();var auth=require(_0xe933('0x1'));var controller=require(_0xe933('0x2'));router[_0xe933('0x3')]('/',controller[_0xe933('0x4')]);router[_0xe933('0x3')](_0xe933('0x5'),auth[_0xe933('0x6')](),auth['canUpdate'](),controller[_0xe933('0x7')]);router[_0xe933('0x3')](_0xe933('0x8'),auth['isAuthenticated'](),auth[_0xe933('0x9')](),controller[_0xe933('0xa')]);router[_0xe933('0x3')](_0xe933('0xb'),auth[_0xe933('0x6')](),auth['canUpdate'](),controller[_0xe933('0xc')]);router[_0xe933('0x3')](_0xe933('0xd'),auth['isAuthenticated'](),controller['restart']);router['get']('/migrations',controller[_0xe933('0xe')]);module[_0xe933('0xf')]=router; \ No newline at end of file +var _0x07f0=['migrations','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','restart','/migrations'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x07f0,0x121));var _0x007f=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x07f0[_0x4792c8];return _0x35edb1;};'use strict';var express=require('express');var router=express[_0x007f('0x0')]();var auth=require(_0x007f('0x1'));var controller=require('./version.controller');router[_0x007f('0x2')]('/',controller[_0x007f('0x3')]);router[_0x007f('0x2')](_0x007f('0x4'),auth[_0x007f('0x5')](),auth[_0x007f('0x6')](),controller['fetch']);router['get'](_0x007f('0x7'),auth[_0x007f('0x5')](),auth[_0x007f('0x6')](),controller[_0x007f('0x8')]);router['get']('/pull',auth[_0x007f('0x5')](),auth[_0x007f('0x6')](),controller['pull']);router['get']('/restart',auth[_0x007f('0x5')](),controller[_0x007f('0x9')]);router[_0x007f('0x2')](_0x007f('0xa'),controller[_0x007f('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index e29ffa4..f99dcc6 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 _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(_0x24a9d5,_0x5c3c7c){var _0x151b71=function(_0x52e58f){while(--_0x52e58f){_0x24a9d5['push'](_0x24a9d5['shift']());}};_0x151b71(++_0x5c3c7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 +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(_0x5f175c,_0x36de13){var _0x3dde95=function(_0x4f20a0){while(--_0x4f20a0){_0x5f175c['push'](_0x5f175c['shift']());}};_0x3dde95(++_0x36de13);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 95d8617..4ab2696 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 _0xdf55=['post','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0xdf55,0x83));var _0x5df5=function(_0x3925ff,_0x3fe6e5){_0x3925ff=_0x3925ff-0x0;var _0x1f16d5=_0xdf55[_0x3925ff];return _0x1f16d5;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var auth=require(_0x5df5('0x4'));var interaction=require(_0x5df5('0x5'));var config=require(_0x5df5('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x5df5('0x7')]('/',auth[_0x5df5('0x8')](),controller[_0x5df5('0x9')]);router[_0x5df5('0x7')](_0x5df5('0xa'),auth[_0x5df5('0x8')](),controller[_0x5df5('0xb')]);router[_0x5df5('0x7')]('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0xc')]);router[_0x5df5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5df5('0xe')]('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0xf')]);router['delete']('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0x10')]);module[_0x5df5('0x11')]=router; \ No newline at end of file +var _0xc1c6=['get','describe','/:id','show','post','create','put','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2e53d7,_0x1b1784){_0x2e53d7=_0x2e53d7-0x0;var _0x506793=_0xc1c6[_0x2e53d7];return _0x506793;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var auth=require(_0x6c1c('0x4'));var interaction=require(_0x6c1c('0x5'));var config=require(_0x6c1c('0x6'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x6c1c('0x7')](),controller['index']);router[_0x6c1c('0x8')]('/describe',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x9')]);router[_0x6c1c('0x8')](_0x6c1c('0xa'),auth['isAuthenticated'](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0xc')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0xd')]);router[_0x6c1c('0xe')](_0x6c1c('0xa'),auth[_0x6c1c('0x7')](),controller['update']);router[_0x6c1c('0xf')](_0x6c1c('0xa'),auth[_0x6c1c('0x7')](),controller['destroy']);module[_0x6c1c('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 2eb8019..fdddfee 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 _0x4a76=['STRING','DATE','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x57aefd,_0x5f5173){var _0x2e852f=function(_0x195794){while(--_0x195794){_0x57aefd['push'](_0x57aefd['shift']());}};_0x2e852f(++_0x5f5173);}(_0x4a76,0x1b4));var _0x64a7=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x4a76[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x64a7('0x0'));module[_0x64a7('0x1')]={'type':{'type':Sequelize[_0x64a7('0x2')]},'uniqueid':{'type':Sequelize[_0x64a7('0x2')]},'calleridnum':{'type':Sequelize[_0x64a7('0x2')]},'calleridname':{'type':Sequelize[_0x64a7('0x2')]},'queue':{'type':Sequelize[_0x64a7('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x64a7('0x2')]},'agentcalledAt':{'type':Sequelize[_0x64a7('0x3')]},'agentconnectAt':{'type':Sequelize[_0x64a7('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x64a7('0x3')]},'agentdumpAt':{'type':Sequelize[_0x64a7('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x64a7('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x64a7('0x5')]},'reason':{'type':Sequelize[_0x64a7('0x2')]},'lastevent':{'type':Sequelize[_0x64a7('0x2')]},'channel':{'type':Sequelize[_0x64a7('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x64a7('0x2')]},'connectedlinenum':{'type':Sequelize[_0x64a7('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x64a7('0x2')]},'accountcode':{'type':Sequelize[_0x64a7('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x64a7('0x2')]},'priority':{'type':Sequelize[_0x64a7('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x64a7('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x64a7('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x64a7('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x64a7('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x64a7('0x2')]},'destuniqueid':{'type':Sequelize[_0x64a7('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x64a7('0x2')]}}; \ No newline at end of file +var _0x7bbe=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0x7bbe,0x1ef));var _0xe7bb=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x7bbe[_0x58ae8a];return _0x2f0b6b;};'use strict';var Sequelize=require(_0xe7bb('0x0'));module[_0xe7bb('0x1')]={'type':{'type':Sequelize[_0xe7bb('0x2')]},'uniqueid':{'type':Sequelize[_0xe7bb('0x2')]},'calleridnum':{'type':Sequelize[_0xe7bb('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe7bb('0x2')]},'interface':{'type':Sequelize[_0xe7bb('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xe7bb('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe7bb('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe7bb('0x3')]},'holdtime':{'type':Sequelize[_0xe7bb('0x4')]},'agentcomplete':{'type':Sequelize[_0xe7bb('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe7bb('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe7bb('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe7bb('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe7bb('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xe7bb('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xe7bb('0x4')]},'channelstatedesc':{'type':Sequelize[_0xe7bb('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe7bb('0x2')]},'connectedlinename':{'type':Sequelize[_0xe7bb('0x2')]},'language':{'type':Sequelize[_0xe7bb('0x2')]},'accountcode':{'type':Sequelize[_0xe7bb('0x2')]},'context':{'type':Sequelize[_0xe7bb('0x2')]},'exten':{'type':Sequelize[_0xe7bb('0x2')]},'priority':{'type':Sequelize[_0xe7bb('0x2')]},'destchannel':{'type':Sequelize[_0xe7bb('0x2')]},'destchannelstate':{'type':Sequelize[_0xe7bb('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe7bb('0x2')]},'destcalleridname':{'type':Sequelize[_0xe7bb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe7bb('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe7bb('0x2')]},'destlanguage':{'type':Sequelize[_0xe7bb('0x2')]},'destaccountcode':{'type':Sequelize[_0xe7bb('0x2')]},'destcontext':{'type':Sequelize[_0xe7bb('0x2')]},'destexten':{'type':Sequelize[_0xe7bb('0x2')]},'destpriority':{'type':Sequelize[_0xe7bb('0x2')]},'destuniqueid':{'type':Sequelize[_0xe7bb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe7bb('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 0d158f6..9e8e0e8 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 _0x63d4=['find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','count','offset','limit','Content-Range','json','reject','save','then','destroy','end','sendStatus','error','stack','name','index','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','map','filter','VoiceAgentReport','includeAll','include','findAll','rows','catch','show','params','merge'];(function(_0x2433cf,_0x464f07){var _0x179c6f=function(_0x1ad6db){while(--_0x1ad6db){_0x2433cf['push'](_0x2433cf['shift']());}};_0x179c6f(++_0x464f07);}(_0x63d4,0x11c));var _0x463d=function(_0x2482d4,_0x55431a){_0x2482d4=_0x2482d4-0x0;var _0x1adfe1=_0x63d4[_0x2482d4];return _0x1adfe1;};'use strict';var pdf=require(_0x463d('0x0'));var emlformat=require(_0x463d('0x1'));var rimraf=require(_0x463d('0x2'));var zipdir=require(_0x463d('0x3'));var jsonpatch=require(_0x463d('0x4'));var rp=require(_0x463d('0x5'));var moment=require(_0x463d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x463d('0x7'));var util=require(_0x463d('0x8'));var path=require(_0x463d('0x9'));var sox=require(_0x463d('0xa'));var csv=require('to-csv');var ejs=require(_0x463d('0xb'));var fs=require('fs');var _=require(_0x463d('0xc'));var squel=require(_0x463d('0xd'));var crypto=require(_0x463d('0xe'));var jsforce=require(_0x463d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x463d('0x10'));var Papa=require(_0x463d('0x11'));var Redis=require('ioredis');var qs=require(_0x463d('0x12'));var logger=require(_0x463d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x463d('0x14'));var db=require(_0x463d('0x15'))['db'];function respondWithStatusCode(_0x18a117,_0x588e09){_0x588e09=_0x588e09||0xcc;return function(_0x4d235f){if(_0x4d235f){return _0x18a117['sendStatus'](_0x588e09);}return _0x18a117['status'](_0x588e09)['end']();};}function respondWithResult(_0x2926b7,_0x237c01){_0x237c01=_0x237c01||0xc8;return function(_0x2e7ccf){if(_0x2e7ccf){return _0x2926b7[_0x463d('0x16')](_0x237c01)['json'](_0x2e7ccf);}};}function respondWithFilteredResult(_0x4b3d53,_0x193272){return function(_0x39a8be){if(_0x39a8be){var _0x446cc3=_0x39a8be[_0x463d('0x17')],_0x345db7=_0x193272[_0x463d('0x18')],_0x50cd7b=_0x193272[_0x463d('0x18')]+_0x193272[_0x463d('0x19')],_0xb27493;if(_0x50cd7b>=_0x446cc3){_0x50cd7b=_0x446cc3;_0xb27493=0xc8;}else{_0xb27493=0xce;}_0x4b3d53['status'](_0xb27493);return _0x4b3d53['set'](_0x463d('0x1a'),_0x345db7+'-'+_0x50cd7b+'/'+_0x446cc3)[_0x463d('0x1b')](_0x39a8be);}return null;};}function patchUpdates(_0x580b87){return function(_0x124ec1){try{jsonpatch['apply'](_0x124ec1,_0x580b87,!![]);}catch(_0x153e77){return BPromise[_0x463d('0x1c')](_0x153e77);}return _0x124ec1[_0x463d('0x1d')]();};}function saveUpdates(_0x522864,_0x15ffe0){return function(_0x4ee584){if(_0x4ee584){return _0x4ee584['update'](_0x522864)[_0x463d('0x1e')](function(_0x4ad96c){return _0x4ad96c;});}return null;};}function removeEntity(_0xfaea60,_0x563233){return function(_0x3a1c14){if(_0x3a1c14){return _0x3a1c14[_0x463d('0x1f')]()['then'](function(){_0xfaea60[_0x463d('0x16')](0xcc)[_0x463d('0x20')]();});}};}function handleEntityNotFound(_0x34b485,_0x4bb0b5){return function(_0x12a316){if(!_0x12a316){_0x34b485[_0x463d('0x21')](0x194);}return _0x12a316;};}function handleError(_0x4b5268,_0x64c289){_0x64c289=_0x64c289||0x1f4;return function(_0x38d234){logger[_0x463d('0x22')](_0x38d234[_0x463d('0x23')]);if(_0x38d234[_0x463d('0x24')]){delete _0x38d234[_0x463d('0x24')];}_0x4b5268['status'](_0x64c289)['send'](_0x38d234);};}exports[_0x463d('0x25')]=function(_0x2bad4f,_0x464189){var _0x4b6ca2={},_0x39947a={},_0xc6d076={'count':0x0,'rows':[]};var _0x464d7c=db['VoiceAgentReport']['rawAttributes'];_0x39947a[_0x463d('0x26')]=_[_0x463d('0x27')](_0x464d7c);var _0x3661e8={'dateStart':_0x2bad4f['query'][_0x463d('0x28')],'dateEnd':_0x2bad4f[_0x463d('0x29')][_0x463d('0x2a')]};delete _0x2bad4f[_0x463d('0x29')][_0x463d('0x28')];delete _0x2bad4f[_0x463d('0x29')][_0x463d('0x2a')];_0x39947a[_0x463d('0x29')]=_[_0x463d('0x27')](_0x2bad4f[_0x463d('0x29')]);_0x39947a[_0x463d('0x2b')]=_[_0x463d('0x2c')](_0x39947a[_0x463d('0x26')],_0x39947a[_0x463d('0x29')]);_0x4b6ca2[_0x463d('0x2d')]=_[_0x463d('0x2c')](_0x39947a[_0x463d('0x26')],qs['fields'](_0x2bad4f[_0x463d('0x29')][_0x463d('0x2e')]));_0x4b6ca2[_0x463d('0x2d')]=_0x4b6ca2[_0x463d('0x2d')][_0x463d('0x2f')]?_0x4b6ca2['attributes']:_0x39947a['model'];if(!_0x2bad4f[_0x463d('0x29')][_0x463d('0x30')]('nolimit')){_0x4b6ca2['limit']=qs[_0x463d('0x19')](_0x2bad4f[_0x463d('0x29')][_0x463d('0x19')]);_0x4b6ca2[_0x463d('0x18')]=qs[_0x463d('0x18')](_0x2bad4f[_0x463d('0x29')][_0x463d('0x18')]);}_0x4b6ca2[_0x463d('0x31')]=qs[_0x463d('0x32')](_0x2bad4f[_0x463d('0x29')][_0x463d('0x32')]);_0x4b6ca2[_0x463d('0x33')]=qs[_0x463d('0x2b')](_[_0x463d('0x34')](_0x2bad4f[_0x463d('0x29')],_0x39947a[_0x463d('0x2b')]));if(_0x3661e8[_0x463d('0x28')]){if(_0x3661e8[_0x463d('0x2a')]){_0x3661e8[_0x463d('0x2a')]=moment(_0x3661e8[_0x463d('0x2a')])[_0x463d('0x35')](0x1,'day');}else{_0x3661e8[_0x463d('0x2a')]=moment(_0x3661e8[_0x463d('0x28')])[_0x463d('0x35')](0x1,_0x463d('0x36'));}_['merge'](_0x4b6ca2[_0x463d('0x33')],{'createdAt':{'$gte':_0x3661e8[_0x463d('0x28')],'$lte':_0x3661e8[_0x463d('0x2a')]}});}if(_0x2bad4f[_0x463d('0x29')]['filter']){_0x4b6ca2[_0x463d('0x33')]=_['merge'](_0x4b6ca2['where'],{'$or':_[_0x463d('0x37')](_0x4b6ca2[_0x463d('0x2d')],function(_0x43afba){var _0x30e9a0={};_0x30e9a0[_0x43afba]={'$like':'%'+_0x2bad4f[_0x463d('0x29')][_0x463d('0x38')]+'%'};return _0x30e9a0;})});}_0x4b6ca2=_['merge']({},_0x4b6ca2,_0x2bad4f['options']);var _0x3b0759={'where':_0x4b6ca2[_0x463d('0x33')]};return db[_0x463d('0x39')][_0x463d('0x17')](_0x3b0759)[_0x463d('0x1e')](function(_0x29fb91){_0xc6d076[_0x463d('0x17')]=_0x29fb91;if(_0x2bad4f['query'][_0x463d('0x3a')]){_0x4b6ca2[_0x463d('0x3b')]=[{'all':!![]}];}return db[_0x463d('0x39')][_0x463d('0x3c')](_0x4b6ca2);})[_0x463d('0x1e')](function(_0x112bc8){_0xc6d076[_0x463d('0x3d')]=_0x112bc8;return _0xc6d076;})['then'](respondWithFilteredResult(_0x464189,_0x4b6ca2))[_0x463d('0x3e')](handleError(_0x464189,null));};exports[_0x463d('0x3f')]=function(_0x2f3ab0,_0xb8e563){var _0x143d2f={'raw':![],'where':{'id':_0x2f3ab0[_0x463d('0x40')]['id']}},_0x22dc5b={};_0x22dc5b['model']=_[_0x463d('0x27')](db['VoiceAgentReport']['rawAttributes']);_0x22dc5b[_0x463d('0x29')]=_['keys'](_0x2f3ab0['query']);_0x22dc5b[_0x463d('0x2b')]=_[_0x463d('0x2c')](_0x22dc5b['model'],_0x22dc5b['query']);_0x143d2f['attributes']=_['intersection'](_0x22dc5b[_0x463d('0x26')],qs[_0x463d('0x2e')](_0x2f3ab0[_0x463d('0x29')]['fields']));_0x143d2f['attributes']=_0x143d2f['attributes'][_0x463d('0x2f')]?_0x143d2f[_0x463d('0x2d')]:_0x22dc5b['model'];if(_0x2f3ab0[_0x463d('0x29')]['includeAll']){_0x143d2f[_0x463d('0x3b')]=[{'all':!![]}];}_0x143d2f=_[_0x463d('0x41')]({},_0x143d2f,_0x2f3ab0['options']);return db[_0x463d('0x39')][_0x463d('0x42')](_0x143d2f)[_0x463d('0x1e')](handleEntityNotFound(_0xb8e563,null))[_0x463d('0x1e')](respondWithResult(_0xb8e563,null))['catch'](handleError(_0xb8e563,null));};exports[_0x463d('0x43')]=function(_0x34f5c2,_0x22e742){return db[_0x463d('0x39')][_0x463d('0x43')](_0x34f5c2['body'],{})[_0x463d('0x1e')](respondWithResult(_0x22e742,0xc9))[_0x463d('0x3e')](handleError(_0x22e742,null));};exports['update']=function(_0x25217f,_0x4673e7){if(_0x25217f[_0x463d('0x44')]['id']){delete _0x25217f[_0x463d('0x44')]['id'];}return db[_0x463d('0x39')]['find']({'where':{'id':_0x25217f[_0x463d('0x40')]['id']}})[_0x463d('0x1e')](handleEntityNotFound(_0x4673e7,null))[_0x463d('0x1e')](saveUpdates(_0x25217f[_0x463d('0x44')],null))['then'](respondWithResult(_0x4673e7,null))[_0x463d('0x3e')](handleError(_0x4673e7,null));};exports[_0x463d('0x1f')]=function(_0x1dc04e,_0x16c096){return db[_0x463d('0x39')][_0x463d('0x42')]({'where':{'id':_0x1dc04e[_0x463d('0x40')]['id']}})[_0x463d('0x1e')](handleEntityNotFound(_0x16c096,null))[_0x463d('0x1e')](removeEntity(_0x16c096,null))[_0x463d('0x3e')](handleError(_0x16c096,null));};exports[_0x463d('0x45')]=function(_0x31e226,_0x20a898){return db[_0x463d('0x39')]['describe']()[_0x463d('0x1e')](respondWithResult(_0x20a898,null))[_0x463d('0x3e')](handleError(_0x20a898,null));}; \ No newline at end of file +var _0x495c=['../../mysqldb','sendStatus','end','status','json','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','filters','add','day','merge','filter','map','VoiceAgentReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x4ccf96,_0x34978e){var _0xd103b7=function(_0x55736b){while(--_0x55736b){_0x4ccf96['push'](_0x4ccf96['shift']());}};_0xd103b7(++_0x34978e);}(_0x495c,0x7d));var _0xc495=function(_0x51bd9c,_0x2cb4f8){_0x51bd9c=_0x51bd9c-0x0;var _0x3a6097=_0x495c[_0x51bd9c];return _0x3a6097;};'use strict';var pdf=require(_0xc495('0x0'));var emlformat=require(_0xc495('0x1'));var rimraf=require(_0xc495('0x2'));var zipdir=require(_0xc495('0x3'));var jsonpatch=require(_0xc495('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc495('0x5'));var Mustache=require('mustache');var util=require(_0xc495('0x6'));var path=require(_0xc495('0x7'));var sox=require(_0xc495('0x8'));var csv=require(_0xc495('0x9'));var ejs=require(_0xc495('0xa'));var fs=require('fs');var _=require(_0xc495('0xb'));var squel=require(_0xc495('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc495('0x9'));var querystring=require('querystring');var Papa=require(_0xc495('0xd'));var Redis=require(_0xc495('0xe'));var qs=require(_0xc495('0xf'));var logger=require(_0xc495('0x10'))(_0xc495('0x11'));var utils=require(_0xc495('0x12'));var config=require('../../config/environment');var db=require(_0xc495('0x13'))['db'];function respondWithStatusCode(_0x281ee0,_0x2af9f6){_0x2af9f6=_0x2af9f6||0xcc;return function(_0x38b046){if(_0x38b046){return _0x281ee0[_0xc495('0x14')](_0x2af9f6);}return _0x281ee0['status'](_0x2af9f6)[_0xc495('0x15')]();};}function respondWithResult(_0x4a0cf0,_0x3d3d59){_0x3d3d59=_0x3d3d59||0xc8;return function(_0x3a02bd){if(_0x3a02bd){return _0x4a0cf0[_0xc495('0x16')](_0x3d3d59)[_0xc495('0x17')](_0x3a02bd);}};}function respondWithFilteredResult(_0x2dbf41,_0x351fa6){return function(_0x3d218a){if(_0x3d218a){var _0x4b1400=_0x3d218a[_0xc495('0x18')],_0x269fb5=_0x351fa6['offset'],_0x54ca15=_0x351fa6['offset']+_0x351fa6['limit'],_0x3220d2;if(_0x54ca15>=_0x4b1400){_0x54ca15=_0x4b1400;_0x3220d2=0xc8;}else{_0x3220d2=0xce;}_0x2dbf41[_0xc495('0x16')](_0x3220d2);return _0x2dbf41[_0xc495('0x19')](_0xc495('0x1a'),_0x269fb5+'-'+_0x54ca15+'/'+_0x4b1400)[_0xc495('0x17')](_0x3d218a);}return null;};}function patchUpdates(_0x266ff8){return function(_0x5073e1){try{jsonpatch[_0xc495('0x1b')](_0x5073e1,_0x266ff8,!![]);}catch(_0x3ffcb9){return BPromise[_0xc495('0x1c')](_0x3ffcb9);}return _0x5073e1[_0xc495('0x1d')]();};}function saveUpdates(_0xf65465,_0x287d61){return function(_0x1f64e0){if(_0x1f64e0){return _0x1f64e0[_0xc495('0x1e')](_0xf65465)[_0xc495('0x1f')](function(_0x3649e){return _0x3649e;});}return null;};}function removeEntity(_0x34f571,_0x3728f2){return function(_0x459b3a){if(_0x459b3a){return _0x459b3a[_0xc495('0x20')]()['then'](function(){_0x34f571[_0xc495('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0984,_0x30e3ca){return function(_0x253ec6){if(!_0x253ec6){_0x5f0984[_0xc495('0x14')](0x194);}return _0x253ec6;};}function handleError(_0x2e4a42,_0x590c46){_0x590c46=_0x590c46||0x1f4;return function(_0x1e7527){logger[_0xc495('0x21')](_0x1e7527[_0xc495('0x22')]);if(_0x1e7527[_0xc495('0x23')]){delete _0x1e7527[_0xc495('0x23')];}_0x2e4a42[_0xc495('0x16')](_0x590c46)['send'](_0x1e7527);};}exports[_0xc495('0x24')]=function(_0x3262b4,_0x159075){var _0xf5d91e={},_0x5b8823={},_0xc4715a={'count':0x0,'rows':[]};var _0x546a9b=db['VoiceAgentReport']['rawAttributes'];_0x5b8823['model']=_[_0xc495('0x25')](_0x546a9b);var _0x146d19={'dateStart':_0x3262b4[_0xc495('0x26')][_0xc495('0x27')],'dateEnd':_0x3262b4[_0xc495('0x26')]['dateEnd']};delete _0x3262b4[_0xc495('0x26')]['dateStart'];delete _0x3262b4[_0xc495('0x26')][_0xc495('0x28')];_0x5b8823[_0xc495('0x26')]=_[_0xc495('0x25')](_0x3262b4['query']);_0x5b8823['filters']=_[_0xc495('0x29')](_0x5b8823[_0xc495('0x2a')],_0x5b8823[_0xc495('0x26')]);_0xf5d91e[_0xc495('0x2b')]=_[_0xc495('0x29')](_0x5b8823[_0xc495('0x2a')],qs[_0xc495('0x2c')](_0x3262b4['query'][_0xc495('0x2c')]));_0xf5d91e[_0xc495('0x2b')]=_0xf5d91e[_0xc495('0x2b')][_0xc495('0x2d')]?_0xf5d91e[_0xc495('0x2b')]:_0x5b8823['model'];if(!_0x3262b4[_0xc495('0x26')][_0xc495('0x2e')]('nolimit')){_0xf5d91e[_0xc495('0x2f')]=qs['limit'](_0x3262b4['query']['limit']);_0xf5d91e[_0xc495('0x30')]=qs['offset'](_0x3262b4[_0xc495('0x26')][_0xc495('0x30')]);}_0xf5d91e[_0xc495('0x31')]=qs[_0xc495('0x32')](_0x3262b4[_0xc495('0x26')][_0xc495('0x32')]);_0xf5d91e[_0xc495('0x33')]=qs[_0xc495('0x34')](_['pick'](_0x3262b4[_0xc495('0x26')],_0x5b8823['filters']));if(_0x146d19['dateStart']){if(_0x146d19[_0xc495('0x28')]){_0x146d19[_0xc495('0x28')]=moment(_0x146d19['dateEnd'])[_0xc495('0x35')](0x1,_0xc495('0x36'));}else{_0x146d19[_0xc495('0x28')]=moment(_0x146d19['dateStart'])[_0xc495('0x35')](0x1,'day');}_[_0xc495('0x37')](_0xf5d91e[_0xc495('0x33')],{'createdAt':{'$gte':_0x146d19['dateStart'],'$lte':_0x146d19[_0xc495('0x28')]}});}if(_0x3262b4[_0xc495('0x26')][_0xc495('0x38')]){_0xf5d91e[_0xc495('0x33')]=_['merge'](_0xf5d91e[_0xc495('0x33')],{'$or':_[_0xc495('0x39')](_0xf5d91e[_0xc495('0x2b')],function(_0xe87a7e){var _0x484ed9={};_0x484ed9[_0xe87a7e]={'$like':'%'+_0x3262b4[_0xc495('0x26')][_0xc495('0x38')]+'%'};return _0x484ed9;})});}_0xf5d91e=_['merge']({},_0xf5d91e,_0x3262b4['options']);var _0x2d06ef={'where':_0xf5d91e['where']};return db[_0xc495('0x3a')][_0xc495('0x18')](_0x2d06ef)[_0xc495('0x1f')](function(_0x5b5195){_0xc4715a[_0xc495('0x18')]=_0x5b5195;if(_0x3262b4[_0xc495('0x26')][_0xc495('0x3b')]){_0xf5d91e[_0xc495('0x3c')]=[{'all':!![]}];}return db[_0xc495('0x3a')][_0xc495('0x3d')](_0xf5d91e);})[_0xc495('0x1f')](function(_0x3d09d5){_0xc4715a[_0xc495('0x3e')]=_0x3d09d5;return _0xc4715a;})[_0xc495('0x1f')](respondWithFilteredResult(_0x159075,_0xf5d91e))[_0xc495('0x3f')](handleError(_0x159075,null));};exports[_0xc495('0x40')]=function(_0x90eef8,_0x2eba72){var _0x3838a0={'raw':![],'where':{'id':_0x90eef8[_0xc495('0x41')]['id']}},_0x383960={};_0x383960[_0xc495('0x2a')]=_[_0xc495('0x25')](db[_0xc495('0x3a')][_0xc495('0x42')]);_0x383960[_0xc495('0x26')]=_[_0xc495('0x25')](_0x90eef8[_0xc495('0x26')]);_0x383960[_0xc495('0x34')]=_[_0xc495('0x29')](_0x383960[_0xc495('0x2a')],_0x383960[_0xc495('0x26')]);_0x3838a0['attributes']=_[_0xc495('0x29')](_0x383960[_0xc495('0x2a')],qs[_0xc495('0x2c')](_0x90eef8[_0xc495('0x26')][_0xc495('0x2c')]));_0x3838a0['attributes']=_0x3838a0[_0xc495('0x2b')][_0xc495('0x2d')]?_0x3838a0[_0xc495('0x2b')]:_0x383960[_0xc495('0x2a')];if(_0x90eef8[_0xc495('0x26')][_0xc495('0x3b')]){_0x3838a0[_0xc495('0x3c')]=[{'all':!![]}];}_0x3838a0=_['merge']({},_0x3838a0,_0x90eef8[_0xc495('0x43')]);return db[_0xc495('0x3a')][_0xc495('0x44')](_0x3838a0)[_0xc495('0x1f')](handleEntityNotFound(_0x2eba72,null))[_0xc495('0x1f')](respondWithResult(_0x2eba72,null))[_0xc495('0x3f')](handleError(_0x2eba72,null));};exports[_0xc495('0x45')]=function(_0x23997f,_0x22eb79){return db[_0xc495('0x3a')][_0xc495('0x45')](_0x23997f[_0xc495('0x46')],{})[_0xc495('0x1f')](respondWithResult(_0x22eb79,0xc9))[_0xc495('0x3f')](handleError(_0x22eb79,null));};exports[_0xc495('0x1e')]=function(_0x24ca29,_0x165f86){if(_0x24ca29[_0xc495('0x46')]['id']){delete _0x24ca29[_0xc495('0x46')]['id'];}return db[_0xc495('0x3a')]['find']({'where':{'id':_0x24ca29[_0xc495('0x41')]['id']}})[_0xc495('0x1f')](handleEntityNotFound(_0x165f86,null))['then'](saveUpdates(_0x24ca29[_0xc495('0x46')],null))[_0xc495('0x1f')](respondWithResult(_0x165f86,null))['catch'](handleError(_0x165f86,null));};exports[_0xc495('0x20')]=function(_0x3dc786,_0x542afe){return db['VoiceAgentReport'][_0xc495('0x44')]({'where':{'id':_0x3dc786['params']['id']}})[_0xc495('0x1f')](handleEntityNotFound(_0x542afe,null))[_0xc495('0x1f')](removeEntity(_0x542afe,null))['catch'](handleError(_0x542afe,null));};exports[_0xc495('0x47')]=function(_0x5073ea,_0x31dd70){return db[_0xc495('0x3a')][_0xc495('0x47')]()[_0xc495('0x1f')](respondWithResult(_0x31dd70,null))[_0xc495('0x3f')](handleError(_0x31dd70,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 1cb5de1..8a23c03 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 _0xb80f=['moment','request-promise','./voiceAgentReport.attributes','exports','define','uniqueid','destuniqueid','lodash','util','../../config/logger','api'];(function(_0xb26a9f,_0x355d96){var _0x3acd00=function(_0x204a0f){while(--_0x204a0f){_0xb26a9f['push'](_0xb26a9f['shift']());}};_0x3acd00(++_0x355d96);}(_0xb80f,0x146));var _0xfb80=function(_0x10984b,_0x6e50e4){_0x10984b=_0x10984b-0x0;var _0x207c41=_0xb80f[_0x10984b];return _0x207c41;};'use strict';var _=require(_0xfb80('0x0'));var util=require(_0xfb80('0x1'));var logger=require(_0xfb80('0x2'))(_0xfb80('0x3'));var moment=require(_0xfb80('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb80('0x5'));var attributes=require(_0xfb80('0x6'));module[_0xfb80('0x7')]=function(_0x4f9eb9,_0x41a0ed){return _0x4f9eb9[_0xfb80('0x8')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xfb80('0x9'),_0xfb80('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x200c=['bluebird','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment'];(function(_0x490d06,_0x56cacf){var _0x431f70=function(_0x1a9fab){while(--_0x1a9fab){_0x490d06['push'](_0x490d06['shift']());}};_0x431f70(++_0x56cacf);}(_0x200c,0x1c4));var _0xc200=function(_0x91df94,_0x5b51f0){_0x91df94=_0x91df94-0x0;var _0xea0827=_0x200c[_0x91df94];return _0xea0827;};'use strict';var _=require(_0xc200('0x0'));var util=require('util');var logger=require(_0xc200('0x1'))(_0xc200('0x2'));var moment=require(_0xc200('0x3'));var BPromise=require(_0xc200('0x4'));var rp=require('request-promise');var attributes=require(_0xc200('0x5'));module[_0xc200('0x6')]=function(_0xf62c17,_0x46fdb9){return _0xf62c17[_0xc200('0x7')](_0xc200('0x8'),attributes,{'tableName':_0xc200('0x9'),'paranoid':![],'indexes':[{'fields':[_0xc200('0xa'),_0xc200('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 9586b8c..b511ec0 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceAgentReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','then','lodash','util'];(function(_0x56f78f,_0x28e511){var _0x406b04=function(_0x58149c){while(--_0x58149c){_0x56f78f['push'](_0x56f78f['shift']());}};_0x406b04(++_0x28e511);}(_0x7a54,0x106));var _0x47a5=function(_0x1806b6,_0x36c160){_0x1806b6=_0x1806b6-0x0;var _0x38b060=_0x7a54[_0x1806b6];return _0x38b060;};'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')]('VoiceAgentReport,\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['CreateVoiceAgentReport']=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?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateVoiceAgentReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ 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(_0x1d1d64,_0x237d16){var _0x6052b4=function(_0x3be921){while(--_0x3be921){_0x1d1d64['push'](_0x1d1d64['shift']());}};_0x6052b4(++_0x237d16);}(_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 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 e46c7e2..a99bc50 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 _0x8ce7=['exports','multer','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','create','put','update','delete'];(function(_0x46c3b5,_0xcff2f0){var _0x4b35a3=function(_0x21a47a){while(--_0x21a47a){_0x46c3b5['push'](_0x46c3b5['shift']());}};_0x4b35a3(++_0xcff2f0);}(_0x8ce7,0x141));var _0x78ce=function(_0x402154,_0x21fc31){_0x402154=_0x402154-0x0;var _0x34eb84=_0x8ce7[_0x402154];return _0x34eb84;};'use strict';var multer=require(_0x78ce('0x0'));var util=require('util');var path=require(_0x78ce('0x1'));var timeout=require('connect-timeout');var express=require(_0x78ce('0x2'));var router=express[_0x78ce('0x3')]();var auth=require(_0x78ce('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78ce('0x5'));var controller=require('./voiceCallReport.controller');router[_0x78ce('0x6')]('/',auth[_0x78ce('0x7')](),controller[_0x78ce('0x8')]);router[_0x78ce('0x6')](_0x78ce('0x9'),auth[_0x78ce('0x7')](),controller['describe']);router[_0x78ce('0x6')](_0x78ce('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x78ce('0x7')](),controller[_0x78ce('0xb')]);router[_0x78ce('0xc')](_0x78ce('0xa'),auth[_0x78ce('0x7')](),controller[_0x78ce('0xd')]);router[_0x78ce('0xe')](_0x78ce('0xa'),auth[_0x78ce('0x7')](),controller['destroy']);module[_0x78ce('0xf')]=router; \ No newline at end of file +var _0x6f3d=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','create'];(function(_0x223143,_0x47acd3){var _0x20f866=function(_0x440f92){while(--_0x440f92){_0x223143['push'](_0x223143['shift']());}};_0x20f866(++_0x47acd3);}(_0x6f3d,0x145));var _0xd6f3=function(_0x23ca3a,_0xe44c43){_0x23ca3a=_0x23ca3a-0x0;var _0x5c1aab=_0x6f3d[_0x23ca3a];return _0x5c1aab;};'use strict';var multer=require('multer');var util=require(_0xd6f3('0x0'));var path=require(_0xd6f3('0x1'));var timeout=require(_0xd6f3('0x2'));var express=require(_0xd6f3('0x3'));var router=express[_0xd6f3('0x4')]();var auth=require(_0xd6f3('0x5'));var interaction=require(_0xd6f3('0x6'));var config=require(_0xd6f3('0x7'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0xd6f3('0x8')](),controller[_0xd6f3('0x9')]);router[_0xd6f3('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xd6f3('0xb')]);router[_0xd6f3('0xa')](_0xd6f3('0xc'),auth['isAuthenticated'](),controller[_0xd6f3('0xd')]);router['post']('/',auth[_0xd6f3('0x8')](),controller[_0xd6f3('0xe')]);router[_0xd6f3('0xf')](_0xd6f3('0xc'),auth[_0xd6f3('0x8')](),controller[_0xd6f3('0x10')]);router[_0xd6f3('0x11')](_0xd6f3('0xc'),auth['isAuthenticated'](),controller[_0xd6f3('0x12')]);module[_0xd6f3('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index bb90a8e..6bc02e2 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 _0xd2bd=['INTEGER','exports','internal','inbound-fax','dialer','STRING','TEXT','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2bd,0x169));var _0xdd2b=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xd2bd[_0x51e79c];return _0x2467be;};'use strict';var Sequelize=require('sequelize');module[_0xdd2b('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('inbound',_0xdd2b('0x1'),'outbound',_0xdd2b('0x2'),'outbound-fax',_0xdd2b('0x3'))},'tag':{'type':Sequelize[_0xdd2b('0x4')]},'accountcode':{'type':Sequelize[_0xdd2b('0x4')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xdd2b('0x4')]},'destinationcontext':{'type':Sequelize[_0xdd2b('0x4')]},'callerid':{'type':Sequelize[_0xdd2b('0x4')]},'channel':{'type':Sequelize[_0xdd2b('0x4')]},'destinationchannel':{'type':Sequelize[_0xdd2b('0x4')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xdd2b('0x5')]},'starttime':{'type':Sequelize[_0xdd2b('0x6')]},'answertime':{'type':Sequelize[_0xdd2b('0x6')]},'endtime':{'type':Sequelize[_0xdd2b('0x6')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xdd2b('0x7')]},'mohtime':{'type':Sequelize[_0xdd2b('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdd2b('0x4')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xdd2b('0x4')]},'userDisposition':{'type':Sequelize[_0xdd2b('0x4')]},'note':{'type':Sequelize[_0xdd2b('0x4')]},'prefix':{'type':Sequelize[_0xdd2b('0x4')]},'routeid':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfdf1=['TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax'];(function(_0x55ad1e,_0x108610){var _0x4d779b=function(_0x43eeb){while(--_0x43eeb){_0x55ad1e['push'](_0x55ad1e['shift']());}};_0x4d779b(++_0x108610);}(_0xfdf1,0xea));var _0x1fdf=function(_0x1c9efe,_0x51e80e){_0x1c9efe=_0x1c9efe-0x0;var _0x1e5eae=_0xfdf1[_0x1c9efe];return _0x1e5eae;};'use strict';var Sequelize=require(_0x1fdf('0x0'));module[_0x1fdf('0x1')]={'uniqueid':{'type':Sequelize[_0x1fdf('0x2')]},'type':{'type':Sequelize[_0x1fdf('0x3')](_0x1fdf('0x4'),_0x1fdf('0x5'),'outbound',_0x1fdf('0x6'),_0x1fdf('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1fdf('0x2')]},'source':{'type':Sequelize[_0x1fdf('0x2')]},'destination':{'type':Sequelize[_0x1fdf('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1fdf('0x2')]},'channel':{'type':Sequelize[_0x1fdf('0x2')]},'destinationchannel':{'type':Sequelize[_0x1fdf('0x2')]},'lastapplication':{'type':Sequelize[_0x1fdf('0x2')]},'lastdata':{'type':Sequelize[_0x1fdf('0x8')]},'starttime':{'type':Sequelize[_0x1fdf('0x9')]},'answertime':{'type':Sequelize[_0x1fdf('0x9')]},'endtime':{'type':Sequelize[_0x1fdf('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x1fdf('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1fdf('0x2')]},'amaflags':{'type':Sequelize[_0x1fdf('0x2')]},'userfield':{'type':Sequelize[_0x1fdf('0x2')]},'userDisposition':{'type':Sequelize[_0x1fdf('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x1fdf('0x2')]},'routeid':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5edecdf..ae06088 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 _0x7ad1=['day','merge','filter','map','options','includeAll','include','alias','User','findAll','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','limit','Content-Range','json','apply','save','update','then','destroy','stack','name','send','VoiceCallReport','rawAttributes','keys','dateEnd','query','dateStart','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters','pick','add'];(function(_0x48d517,_0x27a4fd){var _0x5c7324=function(_0x231561){while(--_0x231561){_0x48d517['push'](_0x48d517['shift']());}};_0x5c7324(++_0x27a4fd);}(_0x7ad1,0x17e));var _0x17ad=function(_0x235769,_0x5e2e5d){_0x235769=_0x235769-0x0;var _0x4b8215=_0x7ad1[_0x235769];return _0x4b8215;};'use strict';var pdf=require(_0x17ad('0x0'));var emlformat=require(_0x17ad('0x1'));var rimraf=require(_0x17ad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x17ad('0x3'));var rp=require(_0x17ad('0x4'));var moment=require(_0x17ad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x17ad('0x6'));var util=require(_0x17ad('0x7'));var path=require('path');var sox=require(_0x17ad('0x8'));var csv=require(_0x17ad('0x9'));var ejs=require(_0x17ad('0xa'));var fs=require('fs');var _=require(_0x17ad('0xb'));var squel=require(_0x17ad('0xc'));var crypto=require('crypto');var jsforce=require(_0x17ad('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x17ad('0x9'));var querystring=require(_0x17ad('0xe'));var Papa=require(_0x17ad('0xf'));var Redis=require(_0x17ad('0x10'));var qs=require(_0x17ad('0x11'));var logger=require(_0x17ad('0x12'))(_0x17ad('0x13'));var utils=require(_0x17ad('0x14'));var config=require('../../config/environment');var db=require(_0x17ad('0x15'))['db'];function respondWithStatusCode(_0x1ffd35,_0x1fd3c8){_0x1fd3c8=_0x1fd3c8||0xcc;return function(_0x24e973){if(_0x24e973){return _0x1ffd35[_0x17ad('0x16')](_0x1fd3c8);}return _0x1ffd35[_0x17ad('0x17')](_0x1fd3c8)[_0x17ad('0x18')]();};}function respondWithResult(_0x4adf41,_0x123718){_0x123718=_0x123718||0xc8;return function(_0x22ff58){if(_0x22ff58){return _0x4adf41[_0x17ad('0x17')](_0x123718)['json'](_0x22ff58);}};}function respondWithFilteredResult(_0x3de6a4,_0x34d76f){return function(_0xc40a46){if(_0xc40a46){var _0x28cfe6=_0xc40a46[_0x17ad('0x19')],_0x17ad49=_0x34d76f['offset'],_0x2f1911=_0x34d76f['offset']+_0x34d76f[_0x17ad('0x1a')],_0x4acd54;if(_0x2f1911>=_0x28cfe6){_0x2f1911=_0x28cfe6;_0x4acd54=0xc8;}else{_0x4acd54=0xce;}_0x3de6a4[_0x17ad('0x17')](_0x4acd54);return _0x3de6a4['set'](_0x17ad('0x1b'),_0x17ad49+'-'+_0x2f1911+'/'+_0x28cfe6)[_0x17ad('0x1c')](_0xc40a46);}return null;};}function patchUpdates(_0x46da2c){return function(_0x55cff6){try{jsonpatch[_0x17ad('0x1d')](_0x55cff6,_0x46da2c,!![]);}catch(_0x172c67){return BPromise['reject'](_0x172c67);}return _0x55cff6[_0x17ad('0x1e')]();};}function saveUpdates(_0x217873,_0x2f5017){return function(_0x365636){if(_0x365636){return _0x365636[_0x17ad('0x1f')](_0x217873)[_0x17ad('0x20')](function(_0x380700){return _0x380700;});}return null;};}function removeEntity(_0x2ee0d9,_0xf22121){return function(_0x4473d3){if(_0x4473d3){return _0x4473d3[_0x17ad('0x21')]()[_0x17ad('0x20')](function(){_0x2ee0d9[_0x17ad('0x17')](0xcc)[_0x17ad('0x18')]();});}};}function handleEntityNotFound(_0x37e744,_0x16a850){return function(_0x23f3cc){if(!_0x23f3cc){_0x37e744[_0x17ad('0x16')](0x194);}return _0x23f3cc;};}function handleError(_0x372a25,_0x422503){_0x422503=_0x422503||0x1f4;return function(_0x1d7630){logger['error'](_0x1d7630[_0x17ad('0x22')]);if(_0x1d7630[_0x17ad('0x23')]){delete _0x1d7630[_0x17ad('0x23')];}_0x372a25[_0x17ad('0x17')](_0x422503)[_0x17ad('0x24')](_0x1d7630);};}exports['index']=function(_0xfe7955,_0x585ab2){var _0x81ebb3={},_0x1f7b41={},_0x335a31={'count':0x0,'rows':[]};var _0x10f32b=db[_0x17ad('0x25')][_0x17ad('0x26')];_0x1f7b41['model']=_[_0x17ad('0x27')](_0x10f32b);var _0x1e5d3f={'dateStart':_0xfe7955['query']['dateStart'],'dateEnd':_0xfe7955['query'][_0x17ad('0x28')]};delete _0xfe7955[_0x17ad('0x29')][_0x17ad('0x2a')];delete _0xfe7955['query'][_0x17ad('0x28')];_0x1f7b41[_0x17ad('0x29')]=_[_0x17ad('0x27')](_0xfe7955[_0x17ad('0x29')]);_0x1f7b41['filters']=_[_0x17ad('0x2b')](_0x1f7b41[_0x17ad('0x2c')],_0x1f7b41['query']);_0x81ebb3[_0x17ad('0x2d')]=_[_0x17ad('0x2b')](_0x1f7b41['model'],qs[_0x17ad('0x2e')](_0xfe7955[_0x17ad('0x29')]['fields']));_0x81ebb3[_0x17ad('0x2d')]=_0x81ebb3[_0x17ad('0x2d')][_0x17ad('0x2f')]?_0x81ebb3[_0x17ad('0x2d')]:_0x1f7b41[_0x17ad('0x2c')];if(!_0xfe7955['query'][_0x17ad('0x30')]('nolimit')){_0x81ebb3[_0x17ad('0x1a')]=qs[_0x17ad('0x1a')](_0xfe7955[_0x17ad('0x29')][_0x17ad('0x1a')]);_0x81ebb3[_0x17ad('0x31')]=qs[_0x17ad('0x31')](_0xfe7955[_0x17ad('0x29')][_0x17ad('0x31')]);}_0x81ebb3[_0x17ad('0x32')]=qs[_0x17ad('0x33')](_0xfe7955[_0x17ad('0x29')]['sort']);_0x81ebb3[_0x17ad('0x34')]=qs[_0x17ad('0x35')](_[_0x17ad('0x36')](_0xfe7955[_0x17ad('0x29')],_0x1f7b41[_0x17ad('0x35')]));if(_0x1e5d3f['dateStart']){if(_0x1e5d3f[_0x17ad('0x28')]){_0x1e5d3f['dateEnd']=moment(_0x1e5d3f['dateEnd'])[_0x17ad('0x37')](0x1,_0x17ad('0x38'));}else{_0x1e5d3f[_0x17ad('0x28')]=moment(_0x1e5d3f[_0x17ad('0x2a')])['add'](0x1,'day');}_[_0x17ad('0x39')](_0x81ebb3[_0x17ad('0x34')],{'createdAt':{'$gte':_0x1e5d3f[_0x17ad('0x2a')],'$lte':_0x1e5d3f[_0x17ad('0x28')]}});}if(_0xfe7955[_0x17ad('0x29')][_0x17ad('0x3a')]){_0x81ebb3[_0x17ad('0x34')]=_[_0x17ad('0x39')](_0x81ebb3[_0x17ad('0x34')],{'$or':_[_0x17ad('0x3b')](_0x81ebb3[_0x17ad('0x2d')],function(_0x94c660){var _0x2fc492={};_0x2fc492[_0x94c660]={'$like':'%'+_0xfe7955[_0x17ad('0x29')]['filter']+'%'};return _0x2fc492;})});}_0x81ebb3=_[_0x17ad('0x39')]({},_0x81ebb3,_0xfe7955[_0x17ad('0x3c')]);var _0x5a8b9a={'where':_0x81ebb3[_0x17ad('0x34')]};return db[_0x17ad('0x25')][_0x17ad('0x19')](_0x5a8b9a)[_0x17ad('0x20')](function(_0xad143b){_0x335a31[_0x17ad('0x19')]=_0xad143b;if(_0xfe7955[_0x17ad('0x29')][_0x17ad('0x3d')]){_0x81ebb3[_0x17ad('0x3e')]=[{'attributes':['id',_0x17ad('0x23'),'fullname',_0x17ad('0x3f')],'model':db[_0x17ad('0x40')],'as':_0x17ad('0x40')}];}return db[_0x17ad('0x25')][_0x17ad('0x41')](_0x81ebb3);})['then'](function(_0x57e9ce){_0x335a31['rows']=_0x57e9ce;return _0x335a31;})[_0x17ad('0x20')](respondWithFilteredResult(_0x585ab2,_0x81ebb3))[_0x17ad('0x42')](handleError(_0x585ab2,null));};exports[_0x17ad('0x43')]=function(_0x3f0e79,_0x5c74fe){var _0x152de6={'raw':!![],'where':{'id':_0x3f0e79[_0x17ad('0x44')]['id']}},_0x2f4da0={};_0x2f4da0[_0x17ad('0x2c')]=_[_0x17ad('0x27')](db[_0x17ad('0x25')][_0x17ad('0x26')]);_0x2f4da0[_0x17ad('0x29')]=_[_0x17ad('0x27')](_0x3f0e79['query']);_0x2f4da0['filters']=_['intersection'](_0x2f4da0[_0x17ad('0x2c')],_0x2f4da0['query']);_0x152de6['attributes']=_[_0x17ad('0x2b')](_0x2f4da0[_0x17ad('0x2c')],qs[_0x17ad('0x2e')](_0x3f0e79[_0x17ad('0x29')]['fields']));_0x152de6[_0x17ad('0x2d')]=_0x152de6[_0x17ad('0x2d')]['length']?_0x152de6[_0x17ad('0x2d')]:_0x2f4da0[_0x17ad('0x2c')];if(_0x3f0e79[_0x17ad('0x29')][_0x17ad('0x3d')]){_0x152de6[_0x17ad('0x3e')]=[{'all':!![]}];}_0x152de6=_[_0x17ad('0x39')]({},_0x152de6,_0x3f0e79[_0x17ad('0x3c')]);return db[_0x17ad('0x25')][_0x17ad('0x45')](_0x152de6)[_0x17ad('0x20')](handleEntityNotFound(_0x5c74fe,null))[_0x17ad('0x20')](respondWithResult(_0x5c74fe,null))[_0x17ad('0x42')](handleError(_0x5c74fe,null));};exports[_0x17ad('0x46')]=function(_0x4b4b27,_0x1ca08d){return db['VoiceCallReport']['create'](_0x4b4b27[_0x17ad('0x47')],{})['then'](respondWithResult(_0x1ca08d,0xc9))[_0x17ad('0x42')](handleError(_0x1ca08d,null));};exports[_0x17ad('0x21')]=function(_0x49ce1c,_0x251356){return db[_0x17ad('0x25')]['find']({'where':{'id':_0x49ce1c[_0x17ad('0x44')]['id']}})['then'](handleEntityNotFound(_0x251356,null))['then'](removeEntity(_0x251356,null))[_0x17ad('0x42')](handleError(_0x251356,null));};exports[_0x17ad('0x48')]=function(_0x56cf9c,_0x1ffce4){return db[_0x17ad('0x25')][_0x17ad('0x48')]()[_0x17ad('0x20')](respondWithResult(_0x1ffce4,null))[_0x17ad('0x42')](handleError(_0x1ffce4,null));};exports[_0x17ad('0x1f')]=function(_0x477ea6,_0x7a9cfd){if(_0x477ea6['body']['uniqueid']){delete _0x477ea6[_0x17ad('0x47')]['uniqueid'];}return db[_0x17ad('0x25')][_0x17ad('0x45')]({'where':{'uniqueid':_0x477ea6[_0x17ad('0x44')]['id'],'UserId':{'$or':[null,_0x477ea6['user']['id']]}}})[_0x17ad('0x20')](handleEntityNotFound(_0x7a9cfd,null))['then'](saveUpdates(_0x477ea6[_0x17ad('0x47')],null))['then'](respondWithResult(_0x7a9cfd,null))[_0x17ad('0x42')](handleError(_0x7a9cfd,null));}; \ No newline at end of file +var _0x5051=['sendStatus','status','json','offset','limit','set','apply','reject','save','then','destroy','end','error','name','send','VoiceCallReport','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','add','day','merge','map','filter','options','count','alias','User','findAll','catch','params','includeAll','include','find','create','body','update','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x3e7454,_0x216b60){var _0x12cd0a=function(_0xd3fb8c){while(--_0xd3fb8c){_0x3e7454['push'](_0x3e7454['shift']());}};_0x12cd0a(++_0x216b60);}(_0x5051,0x81));var _0x1505=function(_0x340618,_0x3aeafe){_0x340618=_0x340618-0x0;var _0x48c0e1=_0x5051[_0x340618];return _0x48c0e1;};'use strict';var pdf=require(_0x1505('0x0'));var emlformat=require(_0x1505('0x1'));var rimraf=require(_0x1505('0x2'));var zipdir=require(_0x1505('0x3'));var jsonpatch=require(_0x1505('0x4'));var rp=require(_0x1505('0x5'));var moment=require(_0x1505('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1505('0x7'));var path=require(_0x1505('0x8'));var sox=require(_0x1505('0x9'));var csv=require(_0x1505('0xa'));var ejs=require(_0x1505('0xb'));var fs=require('fs');var _=require(_0x1505('0xc'));var squel=require(_0x1505('0xd'));var crypto=require(_0x1505('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1505('0xf'));var toCsv=require(_0x1505('0xa'));var querystring=require(_0x1505('0x10'));var Papa=require(_0x1505('0x11'));var Redis=require(_0x1505('0x12'));var qs=require(_0x1505('0x13'));var logger=require(_0x1505('0x14'))(_0x1505('0x15'));var utils=require(_0x1505('0x16'));var config=require(_0x1505('0x17'));var db=require(_0x1505('0x18'))['db'];function respondWithStatusCode(_0x529d14,_0x294c2b){_0x294c2b=_0x294c2b||0xcc;return function(_0x1b749c){if(_0x1b749c){return _0x529d14[_0x1505('0x19')](_0x294c2b);}return _0x529d14['status'](_0x294c2b)['end']();};}function respondWithResult(_0x2d1d86,_0x543b79){_0x543b79=_0x543b79||0xc8;return function(_0x2d8fb9){if(_0x2d8fb9){return _0x2d1d86[_0x1505('0x1a')](_0x543b79)[_0x1505('0x1b')](_0x2d8fb9);}};}function respondWithFilteredResult(_0x282d44,_0x4fd5d0){return function(_0x5b20fe){if(_0x5b20fe){var _0x2909a5=_0x5b20fe['count'],_0x74ff1c=_0x4fd5d0[_0x1505('0x1c')],_0x5e7b0d=_0x4fd5d0[_0x1505('0x1c')]+_0x4fd5d0[_0x1505('0x1d')],_0x568559;if(_0x5e7b0d>=_0x2909a5){_0x5e7b0d=_0x2909a5;_0x568559=0xc8;}else{_0x568559=0xce;}_0x282d44[_0x1505('0x1a')](_0x568559);return _0x282d44[_0x1505('0x1e')]('Content-Range',_0x74ff1c+'-'+_0x5e7b0d+'/'+_0x2909a5)[_0x1505('0x1b')](_0x5b20fe);}return null;};}function patchUpdates(_0x537298){return function(_0x431255){try{jsonpatch[_0x1505('0x1f')](_0x431255,_0x537298,!![]);}catch(_0x1b446b){return BPromise[_0x1505('0x20')](_0x1b446b);}return _0x431255[_0x1505('0x21')]();};}function saveUpdates(_0x44cb37,_0x354d0e){return function(_0x75a7cb){if(_0x75a7cb){return _0x75a7cb['update'](_0x44cb37)[_0x1505('0x22')](function(_0x2ca82c){return _0x2ca82c;});}return null;};}function removeEntity(_0x212ceb,_0x4eb00c){return function(_0x2a3ffd){if(_0x2a3ffd){return _0x2a3ffd[_0x1505('0x23')]()[_0x1505('0x22')](function(){_0x212ceb[_0x1505('0x1a')](0xcc)[_0x1505('0x24')]();});}};}function handleEntityNotFound(_0x31bc81,_0x43d89b){return function(_0x58ee13){if(!_0x58ee13){_0x31bc81[_0x1505('0x19')](0x194);}return _0x58ee13;};}function handleError(_0x2efd06,_0x46056b){_0x46056b=_0x46056b||0x1f4;return function(_0x57da82){logger[_0x1505('0x25')](_0x57da82['stack']);if(_0x57da82[_0x1505('0x26')]){delete _0x57da82[_0x1505('0x26')];}_0x2efd06[_0x1505('0x1a')](_0x46056b)[_0x1505('0x27')](_0x57da82);};}exports['index']=function(_0x4c8f81,_0x27f7c5){var _0xde107={},_0x5b6160={},_0x4beca4={'count':0x0,'rows':[]};var _0x2d3d82=db[_0x1505('0x28')][_0x1505('0x29')];_0x5b6160[_0x1505('0x2a')]=_['keys'](_0x2d3d82);var _0x1d23a8={'dateStart':_0x4c8f81[_0x1505('0x2b')][_0x1505('0x2c')],'dateEnd':_0x4c8f81[_0x1505('0x2b')][_0x1505('0x2d')]};delete _0x4c8f81[_0x1505('0x2b')]['dateStart'];delete _0x4c8f81['query'][_0x1505('0x2d')];_0x5b6160[_0x1505('0x2b')]=_[_0x1505('0x2e')](_0x4c8f81[_0x1505('0x2b')]);_0x5b6160['filters']=_[_0x1505('0x2f')](_0x5b6160[_0x1505('0x2a')],_0x5b6160[_0x1505('0x2b')]);_0xde107[_0x1505('0x30')]=_[_0x1505('0x2f')](_0x5b6160[_0x1505('0x2a')],qs['fields'](_0x4c8f81[_0x1505('0x2b')][_0x1505('0x31')]));_0xde107[_0x1505('0x30')]=_0xde107[_0x1505('0x30')][_0x1505('0x32')]?_0xde107[_0x1505('0x30')]:_0x5b6160['model'];if(!_0x4c8f81[_0x1505('0x2b')][_0x1505('0x33')](_0x1505('0x34'))){_0xde107[_0x1505('0x1d')]=qs[_0x1505('0x1d')](_0x4c8f81[_0x1505('0x2b')][_0x1505('0x1d')]);_0xde107[_0x1505('0x1c')]=qs[_0x1505('0x1c')](_0x4c8f81[_0x1505('0x2b')][_0x1505('0x1c')]);}_0xde107[_0x1505('0x35')]=qs['sort'](_0x4c8f81[_0x1505('0x2b')]['sort']);_0xde107[_0x1505('0x36')]=qs[_0x1505('0x37')](_[_0x1505('0x38')](_0x4c8f81[_0x1505('0x2b')],_0x5b6160[_0x1505('0x37')]));if(_0x1d23a8[_0x1505('0x2c')]){if(_0x1d23a8[_0x1505('0x2d')]){_0x1d23a8[_0x1505('0x2d')]=moment(_0x1d23a8[_0x1505('0x2d')])[_0x1505('0x39')](0x1,_0x1505('0x3a'));}else{_0x1d23a8['dateEnd']=moment(_0x1d23a8['dateStart'])[_0x1505('0x39')](0x1,_0x1505('0x3a'));}_[_0x1505('0x3b')](_0xde107[_0x1505('0x36')],{'createdAt':{'$gte':_0x1d23a8[_0x1505('0x2c')],'$lte':_0x1d23a8[_0x1505('0x2d')]}});}if(_0x4c8f81[_0x1505('0x2b')]['filter']){_0xde107[_0x1505('0x36')]=_[_0x1505('0x3b')](_0xde107['where'],{'$or':_[_0x1505('0x3c')](_0xde107[_0x1505('0x30')],function(_0x2bf78d){var _0x45e02b={};_0x45e02b[_0x2bf78d]={'$like':'%'+_0x4c8f81[_0x1505('0x2b')][_0x1505('0x3d')]+'%'};return _0x45e02b;})});}_0xde107=_['merge']({},_0xde107,_0x4c8f81[_0x1505('0x3e')]);var _0x1c817d={'where':_0xde107[_0x1505('0x36')]};return db[_0x1505('0x28')]['count'](_0x1c817d)[_0x1505('0x22')](function(_0x511a08){_0x4beca4[_0x1505('0x3f')]=_0x511a08;if(_0x4c8f81[_0x1505('0x2b')]['includeAll']){_0xde107['include']=[{'attributes':['id',_0x1505('0x26'),'fullname',_0x1505('0x40')],'model':db[_0x1505('0x41')],'as':_0x1505('0x41')}];}return db[_0x1505('0x28')][_0x1505('0x42')](_0xde107);})[_0x1505('0x22')](function(_0x26ba70){_0x4beca4['rows']=_0x26ba70;return _0x4beca4;})[_0x1505('0x22')](respondWithFilteredResult(_0x27f7c5,_0xde107))[_0x1505('0x43')](handleError(_0x27f7c5,null));};exports['show']=function(_0xc9ba4e,_0x39c59b){var _0x5d1e68={'raw':!![],'where':{'id':_0xc9ba4e[_0x1505('0x44')]['id']}},_0x7958bd={};_0x7958bd[_0x1505('0x2a')]=_[_0x1505('0x2e')](db[_0x1505('0x28')][_0x1505('0x29')]);_0x7958bd[_0x1505('0x2b')]=_[_0x1505('0x2e')](_0xc9ba4e['query']);_0x7958bd[_0x1505('0x37')]=_[_0x1505('0x2f')](_0x7958bd[_0x1505('0x2a')],_0x7958bd[_0x1505('0x2b')]);_0x5d1e68['attributes']=_[_0x1505('0x2f')](_0x7958bd[_0x1505('0x2a')],qs[_0x1505('0x31')](_0xc9ba4e[_0x1505('0x2b')][_0x1505('0x31')]));_0x5d1e68[_0x1505('0x30')]=_0x5d1e68[_0x1505('0x30')][_0x1505('0x32')]?_0x5d1e68[_0x1505('0x30')]:_0x7958bd['model'];if(_0xc9ba4e['query'][_0x1505('0x45')]){_0x5d1e68[_0x1505('0x46')]=[{'all':!![]}];}_0x5d1e68=_[_0x1505('0x3b')]({},_0x5d1e68,_0xc9ba4e[_0x1505('0x3e')]);return db[_0x1505('0x28')][_0x1505('0x47')](_0x5d1e68)[_0x1505('0x22')](handleEntityNotFound(_0x39c59b,null))[_0x1505('0x22')](respondWithResult(_0x39c59b,null))[_0x1505('0x43')](handleError(_0x39c59b,null));};exports['create']=function(_0x4aca4d,_0x51a3f3){return db[_0x1505('0x28')][_0x1505('0x48')](_0x4aca4d[_0x1505('0x49')],{})['then'](respondWithResult(_0x51a3f3,0xc9))[_0x1505('0x43')](handleError(_0x51a3f3,null));};exports[_0x1505('0x23')]=function(_0x176f39,_0x5adf3a){return db[_0x1505('0x28')][_0x1505('0x47')]({'where':{'id':_0x176f39['params']['id']}})[_0x1505('0x22')](handleEntityNotFound(_0x5adf3a,null))[_0x1505('0x22')](removeEntity(_0x5adf3a,null))[_0x1505('0x43')](handleError(_0x5adf3a,null));};exports['describe']=function(_0x444aab,_0x3365ab){return db[_0x1505('0x28')]['describe']()[_0x1505('0x22')](respondWithResult(_0x3365ab,null))['catch'](handleError(_0x3365ab,null));};exports[_0x1505('0x4a')]=function(_0x3b0fdf,_0x3318e7){if(_0x3b0fdf[_0x1505('0x49')]['uniqueid']){delete _0x3b0fdf['body'][_0x1505('0x4b')];}return db['VoiceCallReport'][_0x1505('0x47')]({'where':{'uniqueid':_0x3b0fdf[_0x1505('0x44')]['id'],'UserId':{'$or':[null,_0x3b0fdf[_0x1505('0x4c')]['id']]}}})[_0x1505('0x22')](handleEntityNotFound(_0x3318e7,null))[_0x1505('0x22')](saveUpdates(_0x3b0fdf[_0x1505('0x49')],null))['then'](respondWithResult(_0x3318e7,null))[_0x1505('0x43')](handleError(_0x3318e7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index af7b98f..b313110 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 _0xa990=['define','VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceCallReport.attributes'];(function(_0x211e32,_0x4d5f8d){var _0x1a164e=function(_0x5072dd){while(--_0x5072dd){_0x211e32['push'](_0x211e32['shift']());}};_0x1a164e(++_0x4d5f8d);}(_0xa990,0xc9));var _0x0a99=function(_0xe4d827,_0x30d893){_0xe4d827=_0xe4d827-0x0;var _0x49b451=_0xa990[_0xe4d827];return _0x49b451;};'use strict';var _=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var logger=require(_0x0a99('0x2'))(_0x0a99('0x3'));var moment=require(_0x0a99('0x4'));var BPromise=require(_0x0a99('0x5'));var rp=require(_0x0a99('0x6'));var attributes=require(_0x0a99('0x7'));module['exports']=function(_0x4d1781,_0x3768d1){return _0x4d1781[_0x0a99('0x8')](_0x0a99('0x9'),attributes,{'tableName':_0x0a99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec7=['bluebird','request-promise','./voiceCallReport.attributes','VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment'];(function(_0x4a0a2e,_0x3897b1){var _0x20d54c=function(_0x383ac9){while(--_0x383ac9){_0x4a0a2e['push'](_0x4a0a2e['shift']());}};_0x20d54c(++_0x3897b1);}(_0xbec7,0x1d1));var _0x7bec=function(_0x2fc9ce,_0x440c8c){_0x2fc9ce=_0x2fc9ce-0x0;var _0x536d3d=_0xbec7[_0x2fc9ce];return _0x536d3d;};'use strict';var _=require(_0x7bec('0x0'));var util=require(_0x7bec('0x1'));var logger=require(_0x7bec('0x2'))(_0x7bec('0x3'));var moment=require(_0x7bec('0x4'));var BPromise=require(_0x7bec('0x5'));var rp=require(_0x7bec('0x6'));var attributes=require(_0x7bec('0x7'));module['exports']=function(_0xbdea55,_0x311496){return _0xbdea55['define'](_0x7bec('0x8'),attributes,{'tableName':_0x7bec('0x9'),'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 a78b4b1..13d8560 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 _0xba56=['CreateVoiceCallReport','body','UpdateVoiceCallReport','VoiceCallReport','update','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','limit','include','map','model','attributes','then'];(function(_0x322020,_0x41423c){var _0x173fb0=function(_0x367ddf){while(--_0x367ddf){_0x322020['push'](_0x322020['shift']());}};_0x173fb0(++_0x41423c);}(_0xba56,0xb9));var _0x6ba5=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xba56[_0x309d93];return _0x2dd61d;};'use strict';var _=require(_0x6ba5('0x0'));var util=require(_0x6ba5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6ba5('0x2'));var fs=require('fs');var Redis=require(_0x6ba5('0x3'));var db=require(_0x6ba5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ba5('0x5'))('rpc');var config=require(_0x6ba5('0x6'));var jayson=require(_0x6ba5('0x7'));var client=jayson[_0x6ba5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe1635a,_0x4406eb,_0xfcf4bd){return new BPromise(function(_0x26470d,_0x170cfc){return client['request'](_0xe1635a,_0xfcf4bd)['then'](function(_0x228909){logger[_0x6ba5('0x9')](_0x6ba5('0xa'),_0x4406eb,_0x6ba5('0xb'));logger[_0x6ba5('0xc')](_0x6ba5('0xd'),_0x4406eb,_0x6ba5('0xb'),JSON[_0x6ba5('0xe')](_0x228909));if(_0x228909[_0x6ba5('0xf')]){if(_0x228909[_0x6ba5('0xf')][_0x6ba5('0x10')]===0x1f4){logger[_0x6ba5('0xf')](_0x6ba5('0xa'),_0x4406eb,_0x228909[_0x6ba5('0xf')][_0x6ba5('0x11')]);return _0x170cfc(_0x228909['error'][_0x6ba5('0x11')]);}logger[_0x6ba5('0xf')](_0x6ba5('0xa'),_0x4406eb,_0x228909[_0x6ba5('0xf')][_0x6ba5('0x11')]);return _0x26470d(_0x228909[_0x6ba5('0xf')][_0x6ba5('0x11')]);}else{logger[_0x6ba5('0x9')]('VoiceCallReport,\x20%s,\x20%s',_0x4406eb,'request\x20sent');_0x26470d(_0x228909[_0x6ba5('0x12')]['message']);}})[_0x6ba5('0x13')](function(_0x43aa1f){logger[_0x6ba5('0xf')](_0x6ba5('0xa'),_0x4406eb,_0x43aa1f);_0x170cfc(_0x43aa1f);});});}exports[_0x6ba5('0x14')]=function(_0x382692){var _0x15de9e=this;return new Promise(function(_0x54fc02,_0x329ada){return db['VoiceCallReport'][_0x6ba5('0x15')]({'raw':_0x382692['options']?_0x382692[_0x6ba5('0x16')][_0x6ba5('0x17')]===undefined?!![]:![]:!![],'where':_0x382692[_0x6ba5('0x16')]?_0x382692['options'][_0x6ba5('0x18')]||null:null,'attributes':_0x382692[_0x6ba5('0x16')]?_0x382692[_0x6ba5('0x16')]['attributes']||null:null,'limit':_0x382692['options']?_0x382692['options'][_0x6ba5('0x19')]||null:null,'include':_0x382692[_0x6ba5('0x16')]?_0x382692[_0x6ba5('0x16')][_0x6ba5('0x1a')]?_[_0x6ba5('0x1b')](_0x382692[_0x6ba5('0x16')][_0x6ba5('0x1a')],function(_0x275aea){return{'model':db[_0x275aea[_0x6ba5('0x1c')]],'as':_0x275aea['as'],'attributes':_0x275aea[_0x6ba5('0x1d')],'include':_0x275aea[_0x6ba5('0x1a')]?_['map'](_0x275aea[_0x6ba5('0x1a')],function(_0x17942f){return{'model':db[_0x17942f[_0x6ba5('0x1c')]],'as':_0x17942f['as'],'attributes':_0x17942f[_0x6ba5('0x1d')],'include':_0x17942f[_0x6ba5('0x1a')]?_[_0x6ba5('0x1b')](_0x17942f[_0x6ba5('0x1a')],function(_0x10ac60){return{'model':db[_0x10ac60[_0x6ba5('0x1c')]],'as':_0x10ac60['as'],'attributes':_0x10ac60[_0x6ba5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6ba5('0x1e')](function(_0x4ec33e){logger[_0x6ba5('0x9')](_0x6ba5('0x14'),_0x382692);logger[_0x6ba5('0xc')](_0x6ba5('0x14'),_0x382692,JSON[_0x6ba5('0xe')](_0x4ec33e));_0x54fc02(_0x4ec33e);})[_0x6ba5('0x13')](function(_0x4c322b){logger['error'](_0x6ba5('0x14'),_0x4c322b['message'],_0x382692);_0x329ada(_0x15de9e[_0x6ba5('0xf')](0x1f4,_0x4c322b[_0x6ba5('0x11')]));});});};exports[_0x6ba5('0x1f')]=function(_0x51a8f8){var _0x548f6a=this;return new Promise(function(_0x2211c3,_0x4e94ec){return db['VoiceCallReport']['create'](_0x51a8f8[_0x6ba5('0x20')],{'raw':_0x51a8f8['options']?_0x51a8f8[_0x6ba5('0x16')][_0x6ba5('0x17')]===undefined?!![]:![]:!![]})[_0x6ba5('0x1e')](function(_0x3eece3){logger[_0x6ba5('0x9')](_0x6ba5('0x1f'),_0x51a8f8);logger[_0x6ba5('0xc')]('CreateVoiceCallReport',_0x51a8f8,JSON[_0x6ba5('0xe')](_0x3eece3));_0x2211c3(_0x3eece3);})[_0x6ba5('0x13')](function(_0x296a18){logger['error'](_0x6ba5('0x1f'),_0x296a18['message'],_0x51a8f8);_0x4e94ec(_0x548f6a['error'](0x1f4,_0x296a18[_0x6ba5('0x11')]));});});};exports[_0x6ba5('0x21')]=function(_0x16fcf6){var _0x1e7f55=this;return new Promise(function(_0x5dcd89,_0x218604){return db[_0x6ba5('0x22')][_0x6ba5('0x23')](_0x16fcf6[_0x6ba5('0x20')],{'raw':_0x16fcf6[_0x6ba5('0x16')]?_0x16fcf6['options'][_0x6ba5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16fcf6['options']?_0x16fcf6[_0x6ba5('0x16')][_0x6ba5('0x18')]||null:null,'attributes':_0x16fcf6[_0x6ba5('0x16')]?_0x16fcf6[_0x6ba5('0x16')][_0x6ba5('0x1d')]||null:null,'limit':_0x16fcf6[_0x6ba5('0x16')]?_0x16fcf6[_0x6ba5('0x16')][_0x6ba5('0x19')]||null:null})['then'](function(_0x16ddeb){logger[_0x6ba5('0x9')]('UpdateVoiceCallReport',_0x16fcf6);logger[_0x6ba5('0xc')]('UpdateVoiceCallReport',_0x16fcf6,JSON[_0x6ba5('0xe')](_0x16ddeb));_0x5dcd89(_0x16ddeb);})[_0x6ba5('0x13')](function(_0x8ac93f){logger[_0x6ba5('0xf')](_0x6ba5('0x21'),_0x8ac93f[_0x6ba5('0x11')],_0x16fcf6);_0x218604(_0x1e7f55[_0x6ba5('0xf')](0x1f4,_0x8ac93f[_0x6ba5('0x11')]));});});}; \ No newline at end of file +var _0xb43c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','body','debug','UpdateVoiceCallReport','lodash','util','moment'];(function(_0x5f04f1,_0x5537e6){var _0x148a80=function(_0x3ce3e3){while(--_0x3ce3e3){_0x5f04f1['push'](_0x5f04f1['shift']());}};_0x148a80(++_0x5537e6);}(_0xb43c,0xb6));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcb43('0x0'));var util=require(_0xcb43('0x1'));var moment=require(_0xcb43('0x2'));var BPromise=require(_0xcb43('0x3'));var rs=require(_0xcb43('0x4'));var fs=require('fs');var Redis=require(_0xcb43('0x5'));var db=require(_0xcb43('0x6'))['db'];var utils=require(_0xcb43('0x7'));var logger=require(_0xcb43('0x8'))(_0xcb43('0x9'));var config=require(_0xcb43('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcb43('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314dae,_0x37ca4a,_0x4c95d0){return new BPromise(function(_0x4144c3,_0x5d515e){return client['request'](_0x314dae,_0x4c95d0)[_0xcb43('0xc')](function(_0xfd4066){logger['info'](_0xcb43('0xd'),_0x37ca4a,_0xcb43('0xe'));logger['debug'](_0xcb43('0xf'),_0x37ca4a,_0xcb43('0xe'),JSON[_0xcb43('0x10')](_0xfd4066));if(_0xfd4066[_0xcb43('0x11')]){if(_0xfd4066[_0xcb43('0x11')][_0xcb43('0x12')]===0x1f4){logger['error'](_0xcb43('0xd'),_0x37ca4a,_0xfd4066[_0xcb43('0x11')]['message']);return _0x5d515e(_0xfd4066[_0xcb43('0x11')][_0xcb43('0x13')]);}logger[_0xcb43('0x11')](_0xcb43('0xd'),_0x37ca4a,_0xfd4066[_0xcb43('0x11')][_0xcb43('0x13')]);return _0x4144c3(_0xfd4066[_0xcb43('0x11')][_0xcb43('0x13')]);}else{logger[_0xcb43('0x14')](_0xcb43('0xd'),_0x37ca4a,_0xcb43('0xe'));_0x4144c3(_0xfd4066['result'][_0xcb43('0x13')]);}})[_0xcb43('0x15')](function(_0x5b5fac){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x37ca4a,_0x5b5fac);_0x5d515e(_0x5b5fac);});});}exports[_0xcb43('0x16')]=function(_0x2576c5){var _0x1af007=this;return new Promise(function(_0x58b93b,_0x6b755f){return db[_0xcb43('0x17')][_0xcb43('0x18')]({'raw':_0x2576c5[_0xcb43('0x19')]?_0x2576c5[_0xcb43('0x19')][_0xcb43('0x1a')]===undefined?!![]:![]:!![],'where':_0x2576c5['options']?_0x2576c5[_0xcb43('0x19')][_0xcb43('0x1b')]||null:null,'attributes':_0x2576c5[_0xcb43('0x19')]?_0x2576c5[_0xcb43('0x19')][_0xcb43('0x1c')]||null:null,'limit':_0x2576c5[_0xcb43('0x19')]?_0x2576c5[_0xcb43('0x19')][_0xcb43('0x1d')]||null:null,'include':_0x2576c5[_0xcb43('0x19')]?_0x2576c5['options'][_0xcb43('0x1e')]?_[_0xcb43('0x1f')](_0x2576c5[_0xcb43('0x19')][_0xcb43('0x1e')],function(_0xa63928){return{'model':db[_0xa63928['model']],'as':_0xa63928['as'],'attributes':_0xa63928[_0xcb43('0x1c')],'include':_0xa63928[_0xcb43('0x1e')]?_['map'](_0xa63928[_0xcb43('0x1e')],function(_0x5b55d4){return{'model':db[_0x5b55d4[_0xcb43('0x20')]],'as':_0x5b55d4['as'],'attributes':_0x5b55d4[_0xcb43('0x1c')],'include':_0x5b55d4[_0xcb43('0x1e')]?_[_0xcb43('0x1f')](_0x5b55d4[_0xcb43('0x1e')],function(_0x3341a8){return{'model':db[_0x3341a8[_0xcb43('0x20')]],'as':_0x3341a8['as'],'attributes':_0x3341a8['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb43('0xc')](function(_0x5437ea){logger[_0xcb43('0x14')](_0xcb43('0x16'),_0x2576c5);logger['debug']('GetVoiceCallReport',_0x2576c5,JSON[_0xcb43('0x10')](_0x5437ea));_0x58b93b(_0x5437ea);})[_0xcb43('0x15')](function(_0x111aca){logger['error'](_0xcb43('0x16'),_0x111aca[_0xcb43('0x13')],_0x2576c5);_0x6b755f(_0x1af007[_0xcb43('0x11')](0x1f4,_0x111aca[_0xcb43('0x13')]));});});};exports[_0xcb43('0x21')]=function(_0x245284){var _0x1a7e38=this;return new Promise(function(_0x4ead19,_0x24ed47){return db[_0xcb43('0x17')]['create'](_0x245284[_0xcb43('0x22')],{'raw':_0x245284[_0xcb43('0x19')]?_0x245284[_0xcb43('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xcb43('0xc')](function(_0xb60c10){logger[_0xcb43('0x14')]('CreateVoiceCallReport',_0x245284);logger[_0xcb43('0x23')](_0xcb43('0x21'),_0x245284,JSON['stringify'](_0xb60c10));_0x4ead19(_0xb60c10);})[_0xcb43('0x15')](function(_0x443059){logger[_0xcb43('0x11')](_0xcb43('0x21'),_0x443059[_0xcb43('0x13')],_0x245284);_0x24ed47(_0x1a7e38['error'](0x1f4,_0x443059[_0xcb43('0x13')]));});});};exports[_0xcb43('0x24')]=function(_0x42394b){var _0xcf404c=this;return new Promise(function(_0xf3c17c,_0x1e47bb){return db['VoiceCallReport']['update'](_0x42394b[_0xcb43('0x22')],{'raw':_0x42394b[_0xcb43('0x19')]?_0x42394b[_0xcb43('0x19')][_0xcb43('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42394b['options']?_0x42394b[_0xcb43('0x19')][_0xcb43('0x1b')]||null:null,'attributes':_0x42394b[_0xcb43('0x19')]?_0x42394b[_0xcb43('0x19')][_0xcb43('0x1c')]||null:null,'limit':_0x42394b[_0xcb43('0x19')]?_0x42394b[_0xcb43('0x19')][_0xcb43('0x1d')]||null:null})[_0xcb43('0xc')](function(_0x30f02d){logger[_0xcb43('0x14')](_0xcb43('0x24'),_0x42394b);logger[_0xcb43('0x23')](_0xcb43('0x24'),_0x42394b,JSON[_0xcb43('0x10')](_0x30f02d));_0xf3c17c(_0x30f02d);})['catch'](function(_0x212f33){logger[_0xcb43('0x11')](_0xcb43('0x24'),_0x212f33[_0xcb43('0x13')],_0x42394b);_0x1e47bb(_0xcf404c[_0xcb43('0x11')](0x1f4,_0x212f33[_0xcb43('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 0ceba76..7aa4558 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 _0xa8c7=['put','update','delete','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','post','create'];(function(_0xe96015,_0x3b6459){var _0x3d9e1b=function(_0x4c3c63){while(--_0x4c3c63){_0xe96015['push'](_0xe96015['shift']());}};_0x3d9e1b(++_0x3b6459);}(_0xa8c7,0x184));var _0x7a8c=function(_0x432b4d,_0x5dbd44){_0x432b4d=_0x432b4d-0x0;var _0x3ab62d=_0xa8c7[_0x432b4d];return _0x3ab62d;};'use strict';var multer=require('multer');var util=require(_0x7a8c('0x0'));var path=require('path');var timeout=require(_0x7a8c('0x1'));var express=require('express');var router=express[_0x7a8c('0x2')]();var auth=require(_0x7a8c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7a8c('0x4'));var controller=require(_0x7a8c('0x5'));router['get']('/',auth[_0x7a8c('0x6')](),controller[_0x7a8c('0x7')]);router[_0x7a8c('0x8')](_0x7a8c('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x7a8c('0xa')]('/',auth[_0x7a8c('0x6')](),controller[_0x7a8c('0xb')]);router[_0x7a8c('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x7a8c('0xd')]);router[_0x7a8c('0xe')](_0x7a8c('0x9'),auth[_0x7a8c('0x6')](),controller['destroy']);module[_0x7a8c('0xf')]=router; \ No newline at end of file +var _0x59b0=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','show','post','create','/:id','update','destroy'];(function(_0x4de007,_0x546ed2){var _0x431199=function(_0xceda45){while(--_0xceda45){_0x4de007['push'](_0x4de007['shift']());}};_0x431199(++_0x546ed2);}(_0x59b0,0x190));var _0x059b=function(_0x137da3,_0xa6277a){_0x137da3=_0x137da3-0x0;var _0x1ac46c=_0x59b0[_0x137da3];return _0x1ac46c;};'use strict';var multer=require(_0x059b('0x0'));var util=require(_0x059b('0x1'));var path=require(_0x059b('0x2'));var timeout=require(_0x059b('0x3'));var express=require(_0x059b('0x4'));var router=express[_0x059b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x059b('0x6'));var config=require('../../config/environment');var controller=require(_0x059b('0x7'));router[_0x059b('0x8')]('/',auth[_0x059b('0x9')](),controller['index']);router[_0x059b('0x8')]('/:id',auth[_0x059b('0x9')](),controller[_0x059b('0xa')]);router[_0x059b('0xb')]('/',auth['isAuthenticated'](),controller[_0x059b('0xc')]);router['put'](_0x059b('0xd'),auth[_0x059b('0x9')](),controller[_0x059b('0xe')]);router['delete'](_0x059b('0xd'),auth['isAuthenticated'](),controller[_0x059b('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 3f4ae7f..3488628 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 _0x33da=['BOOLEAN','STRING','setDataValue','getDataValue','options','split'];(function(_0x14647d,_0x20a244){var _0x3a0cae=function(_0x6f6909){while(--_0x6f6909){_0x14647d['push'](_0x14647d['shift']());}};_0x3a0cae(++_0x20a244);}(_0x33da,0x1cf));var _0xa33d=function(_0x245505,_0x2cfe7b){_0x245505=_0x245505-0x0;var _0x424bcb=_0x33da[_0x245505];return _0x424bcb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa33d('0x0')]},'prefix':{'type':Sequelize[_0xa33d('0x0')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xa33d('0x0')],'set':function(_0x3f2324){this[_0xa33d('0x1')]('options',_0x3f2324?_0x3f2324['join'](''):[]);},'get':function(){return this[_0xa33d('0x2')](_0xa33d('0x3'))?this[_0xa33d('0x2')]('options')[_0xa33d('0x4')](''):[];}},'auth':{'type':Sequelize[_0xa33d('0x5')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa33d('0x0')]},'description':{'type':Sequelize[_0xa33d('0x0')]}}; \ No newline at end of file +var _0xf740=['setDataValue','join','getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x5092e2,_0x54cdeb){var _0x375fc5=function(_0x5898c9){while(--_0x5898c9){_0x5092e2['push'](_0x5092e2['shift']());}};_0x375fc5(++_0x54cdeb);}(_0xf740,0x1e6));var _0x0f74=function(_0x481af3,_0x483fac){_0x481af3=_0x481af3-0x0;var _0x3354ea=_0xf740[_0x481af3];return _0x3354ea;};'use strict';var Sequelize=require(_0x0f74('0x0'));module[_0x0f74('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x0f74('0x2')],'unique':_0x0f74('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0f74('0x2')],'set':function(_0x4493e0){this[_0x0f74('0x4')]('options',_0x4493e0?_0x4493e0[_0x0f74('0x5')](''):[]);},'get':function(){return this[_0x0f74('0x6')]('options')?this[_0x0f74('0x6')](_0x0f74('0x7'))[_0x0f74('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x0f74('0x2')]},'record':{'type':Sequelize[_0x0f74('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0f74('0x2')]},'description':{'type':Sequelize[_0x0f74('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index da86477..057531d 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 _0x63aa=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','zip-dir','request-promise','moment','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','status','end','json','count','offset','limit','Content-Range','apply','save','then','destroy','get','ChanSpies','error','stack','name','send','index','VoiceChanSpy','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','add','day','merge','where','map','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','user'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0x63aa,0x158));var _0xa63a=function(_0x67aea5,_0x4d78ce){_0x67aea5=_0x67aea5-0x0;var _0x4d91da=_0x63aa[_0x67aea5];return _0x4d91da;};'use strict';var pdf=require(_0xa63a('0x0'));var emlformat=require(_0xa63a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa63a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa63a('0x3'));var moment=require(_0xa63a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa63a('0x5'));var util=require(_0xa63a('0x6'));var path=require(_0xa63a('0x7'));var sox=require(_0xa63a('0x8'));var csv=require(_0xa63a('0x9'));var ejs=require(_0xa63a('0xa'));var fs=require('fs');var _=require(_0xa63a('0xb'));var squel=require(_0xa63a('0xc'));var crypto=require(_0xa63a('0xd'));var jsforce=require(_0xa63a('0xe'));var deskjs=require(_0xa63a('0xf'));var toCsv=require(_0xa63a('0x9'));var querystring=require(_0xa63a('0x10'));var Papa=require(_0xa63a('0x11'));var Redis=require(_0xa63a('0x12'));var qs=require(_0xa63a('0x13'));var logger=require(_0xa63a('0x14'))(_0xa63a('0x15'));var utils=require(_0xa63a('0x16'));var config=require(_0xa63a('0x17'));var db=require(_0xa63a('0x18'))['db'];function respondWithStatusCode(_0x593a2f,_0x51feec){_0x51feec=_0x51feec||0xcc;return function(_0x402a2f){if(_0x402a2f){return _0x593a2f['sendStatus'](_0x51feec);}return _0x593a2f[_0xa63a('0x19')](_0x51feec)[_0xa63a('0x1a')]();};}function respondWithResult(_0x33fc02,_0x473e0a){_0x473e0a=_0x473e0a||0xc8;return function(_0x517d00){if(_0x517d00){return _0x33fc02['status'](_0x473e0a)[_0xa63a('0x1b')](_0x517d00);}};}function respondWithFilteredResult(_0x3f9841,_0x1147f0){return function(_0x5de0e3){if(_0x5de0e3){var _0x2605c1=_0x5de0e3[_0xa63a('0x1c')],_0x3a61a9=_0x1147f0['offset'],_0x45a1a6=_0x1147f0[_0xa63a('0x1d')]+_0x1147f0[_0xa63a('0x1e')],_0x12e2f5;if(_0x45a1a6>=_0x2605c1){_0x45a1a6=_0x2605c1;_0x12e2f5=0xc8;}else{_0x12e2f5=0xce;}_0x3f9841[_0xa63a('0x19')](_0x12e2f5);return _0x3f9841['set'](_0xa63a('0x1f'),_0x3a61a9+'-'+_0x45a1a6+'/'+_0x2605c1)['json'](_0x5de0e3);}return null;};}function patchUpdates(_0x29cc56){return function(_0x42c173){try{jsonpatch[_0xa63a('0x20')](_0x42c173,_0x29cc56,!![]);}catch(_0x5ec9f3){return BPromise['reject'](_0x5ec9f3);}return _0x42c173[_0xa63a('0x21')]();};}function saveUpdates(_0x4cbb12,_0x2380b8){return function(_0x33fd7c){if(_0x33fd7c){return _0x33fd7c['update'](_0x4cbb12)[_0xa63a('0x22')](function(_0x33d304){return _0x33d304;});}return null;};}function removeEntity(_0x22d6fb,_0x121a17){return function(_0x1766ad){if(_0x1766ad){return _0x1766ad[_0xa63a('0x23')]()['then'](function(){var _0x236e7e=_0x1766ad[_0xa63a('0x24')]({'plain':!![]});var _0x55a1c9=_0xa63a('0x25');return db['UserProfileResource'][_0xa63a('0x23')]({'where':{'type':_0x55a1c9,'resourceId':_0x236e7e['id']}})[_0xa63a('0x22')](function(){return _0x1766ad;});})[_0xa63a('0x22')](function(){_0x22d6fb[_0xa63a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34049e,_0x5441fc){return function(_0x3f3b10){if(!_0x3f3b10){_0x34049e['sendStatus'](0x194);}return _0x3f3b10;};}function handleError(_0x19bd39,_0x418976){_0x418976=_0x418976||0x1f4;return function(_0x23bc42){logger[_0xa63a('0x26')](_0x23bc42[_0xa63a('0x27')]);if(_0x23bc42[_0xa63a('0x28')]){delete _0x23bc42[_0xa63a('0x28')];}_0x19bd39[_0xa63a('0x19')](_0x418976)[_0xa63a('0x29')](_0x23bc42);};}exports[_0xa63a('0x2a')]=function(_0x9b49e7,_0x26e705){var _0x27285b={},_0x59d5b0={},_0x5421f5={'count':0x0,'rows':[]};var _0x2b4e41=db[_0xa63a('0x2b')][_0xa63a('0x2c')];_0x59d5b0[_0xa63a('0x2d')]=_['keys'](_0x2b4e41);var _0x53fca9={'dateStart':_0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x2f')],'dateEnd':_0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x30')]};delete _0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x2f')];delete _0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x30')];_0x59d5b0[_0xa63a('0x2e')]=_[_0xa63a('0x31')](_0x9b49e7['query']);_0x59d5b0[_0xa63a('0x32')]=_['intersection'](_0x59d5b0[_0xa63a('0x2d')],_0x59d5b0[_0xa63a('0x2e')]);_0x27285b['attributes']=_[_0xa63a('0x33')](_0x59d5b0[_0xa63a('0x2d')],qs[_0xa63a('0x34')](_0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x34')]));_0x27285b[_0xa63a('0x35')]=_0x27285b[_0xa63a('0x35')][_0xa63a('0x36')]?_0x27285b[_0xa63a('0x35')]:_0x59d5b0['model'];if(!_0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x37')]('nolimit')){_0x27285b[_0xa63a('0x1e')]=qs[_0xa63a('0x1e')](_0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x1e')]);_0x27285b[_0xa63a('0x1d')]=qs[_0xa63a('0x1d')](_0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x1d')]);}_0x27285b[_0xa63a('0x38')]=qs['sort'](_0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x39')]);_0x27285b['where']=qs[_0xa63a('0x32')](_[_0xa63a('0x3a')](_0x9b49e7[_0xa63a('0x2e')],_0x59d5b0[_0xa63a('0x32')]));if(_0x53fca9[_0xa63a('0x2f')]){if(_0x53fca9[_0xa63a('0x30')]){_0x53fca9[_0xa63a('0x30')]=moment(_0x53fca9[_0xa63a('0x30')])[_0xa63a('0x3b')](0x1,_0xa63a('0x3c'));}else{_0x53fca9[_0xa63a('0x30')]=moment(_0x53fca9[_0xa63a('0x2f')])[_0xa63a('0x3b')](0x1,_0xa63a('0x3c'));}_[_0xa63a('0x3d')](_0x27285b[_0xa63a('0x3e')],{'createdAt':{'$gte':_0x53fca9['dateStart'],'$lte':_0x53fca9[_0xa63a('0x30')]}});}if(_0x9b49e7[_0xa63a('0x2e')]['filter']){_0x27285b['where']=_[_0xa63a('0x3d')](_0x27285b['where'],{'$or':_[_0xa63a('0x3f')](_0x27285b['attributes'],function(_0x255070){var _0x57d771={};_0x57d771[_0x255070]={'$like':'%'+_0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x40')]+'%'};return _0x57d771;})});}_0x27285b=_[_0xa63a('0x3d')]({},_0x27285b,_0x9b49e7[_0xa63a('0x41')]);var _0x542e74={'where':_0x27285b[_0xa63a('0x3e')]};return db[_0xa63a('0x2b')][_0xa63a('0x1c')](_0x542e74)[_0xa63a('0x22')](function(_0x41e0f0){_0x5421f5[_0xa63a('0x1c')]=_0x41e0f0;if(_0x9b49e7[_0xa63a('0x2e')][_0xa63a('0x42')]){_0x27285b[_0xa63a('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xa63a('0x44')](_0x27285b);})[_0xa63a('0x22')](function(_0x2ebf80){_0x5421f5[_0xa63a('0x45')]=_0x2ebf80;return _0x5421f5;})['then'](respondWithFilteredResult(_0x26e705,_0x27285b))[_0xa63a('0x46')](handleError(_0x26e705,null));};exports[_0xa63a('0x47')]=function(_0x5c1aa8,_0x228733){var _0x563638={'raw':![],'where':{'id':_0x5c1aa8[_0xa63a('0x48')]['id']}},_0x299b78={};_0x299b78[_0xa63a('0x2d')]=_[_0xa63a('0x31')](db[_0xa63a('0x2b')][_0xa63a('0x2c')]);_0x299b78[_0xa63a('0x2e')]=_['keys'](_0x5c1aa8[_0xa63a('0x2e')]);_0x299b78[_0xa63a('0x32')]=_[_0xa63a('0x33')](_0x299b78[_0xa63a('0x2d')],_0x299b78['query']);_0x563638['attributes']=_[_0xa63a('0x33')](_0x299b78[_0xa63a('0x2d')],qs[_0xa63a('0x34')](_0x5c1aa8['query'][_0xa63a('0x34')]));_0x563638['attributes']=_0x563638['attributes'][_0xa63a('0x36')]?_0x563638['attributes']:_0x299b78[_0xa63a('0x2d')];if(_0x5c1aa8[_0xa63a('0x2e')][_0xa63a('0x42')]){_0x563638[_0xa63a('0x43')]=[{'all':!![]}];}_0x563638=_['merge']({},_0x563638,_0x5c1aa8['options']);return db[_0xa63a('0x2b')][_0xa63a('0x49')](_0x563638)[_0xa63a('0x22')](handleEntityNotFound(_0x228733,null))['then'](respondWithResult(_0x228733,null))[_0xa63a('0x46')](handleError(_0x228733,null));};exports['create']=function(_0x3f65f8,_0x456f7d){return db['VoiceChanSpy'][_0xa63a('0x4a')](_0x3f65f8['body'],{})[_0xa63a('0x22')](function(_0x1a8e26){var _0x499e5f=_0x3f65f8[_0xa63a('0x4b')][_0xa63a('0x24')]({'plain':!![]});if(!_0x499e5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x499e5f[_0xa63a('0x4c')]===_0xa63a('0x4b')){var _0x4fc2d2=_0x1a8e26[_0xa63a('0x24')]({'plain':!![]});var _0xc4e373=_0xa63a('0x25');return db[_0xa63a('0x4d')][_0xa63a('0x49')]({'where':{'name':_0xc4e373,'userProfileId':_0x499e5f[_0xa63a('0x4e')]},'raw':!![]})['then'](function(_0x19f1a7){if(_0x19f1a7&&_0x19f1a7[_0xa63a('0x4f')]===0x0){return db[_0xa63a('0x50')][_0xa63a('0x4a')]({'name':_0x4fc2d2['name'],'resourceId':_0x4fc2d2['id'],'type':_0x19f1a7['name'],'sectionId':_0x19f1a7['id']},{})[_0xa63a('0x22')](function(){return _0x1a8e26;});}else{return _0x1a8e26;}})[_0xa63a('0x46')](function(_0x1c45ab){logger[_0xa63a('0x26')](_0xa63a('0x51'),_0x1c45ab);throw _0x1c45ab;});}return _0x1a8e26;})[_0xa63a('0x22')](respondWithResult(_0x456f7d,0xc9))[_0xa63a('0x46')](handleError(_0x456f7d,null));};exports[_0xa63a('0x52')]=function(_0x4848fa,_0x731c15){if(_0x4848fa['body']['id']){delete _0x4848fa[_0xa63a('0x53')]['id'];}return db[_0xa63a('0x2b')][_0xa63a('0x49')]({'where':{'id':_0x4848fa[_0xa63a('0x48')]['id']}})[_0xa63a('0x22')](handleEntityNotFound(_0x731c15,null))[_0xa63a('0x22')](saveUpdates(_0x4848fa[_0xa63a('0x53')],null))[_0xa63a('0x22')](respondWithResult(_0x731c15,null))['catch'](handleError(_0x731c15,null));};exports['destroy']=function(_0x970d57,_0xe61792){return db['VoiceChanSpy'][_0xa63a('0x49')]({'where':{'id':_0x970d57[_0xa63a('0x48')]['id']}})[_0xa63a('0x22')](handleEntityNotFound(_0xe61792,null))['then'](removeEntity(_0xe61792,null))['catch'](handleError(_0xe61792,null));}; \ No newline at end of file +var _0x5fcb=['where','map','filter','count','include','VoiceChanSpy','findAll','rows','catch','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','limit','set','Content-Range','update','destroy','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge'];(function(_0x1f7325,_0x28b438){var _0x123a59=function(_0x1cee19){while(--_0x1cee19){_0x1f7325['push'](_0x1f7325['shift']());}};_0x123a59(++_0x28b438);}(_0x5fcb,0x19b));var _0xb5fc=function(_0x4b280b,_0x346e8f){_0x4b280b=_0x4b280b-0x0;var _0x56f351=_0x5fcb[_0x4b280b];return _0x56f351;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb5fc('0x0'));var rimraf=require(_0xb5fc('0x1'));var zipdir=require(_0xb5fc('0x2'));var jsonpatch=require(_0xb5fc('0x3'));var rp=require(_0xb5fc('0x4'));var moment=require('moment');var BPromise=require(_0xb5fc('0x5'));var Mustache=require(_0xb5fc('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb5fc('0x7'));var ejs=require(_0xb5fc('0x8'));var fs=require('fs');var _=require(_0xb5fc('0x9'));var squel=require(_0xb5fc('0xa'));var crypto=require('crypto');var jsforce=require(_0xb5fc('0xb'));var deskjs=require(_0xb5fc('0xc'));var toCsv=require(_0xb5fc('0x7'));var querystring=require(_0xb5fc('0xd'));var Papa=require('papaparse');var Redis=require(_0xb5fc('0xe'));var qs=require(_0xb5fc('0xf'));var logger=require(_0xb5fc('0x10'))(_0xb5fc('0x11'));var utils=require(_0xb5fc('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x248695,_0x22294f){_0x22294f=_0x22294f||0xcc;return function(_0x48cee7){if(_0x48cee7){return _0x248695[_0xb5fc('0x13')](_0x22294f);}return _0x248695['status'](_0x22294f)[_0xb5fc('0x14')]();};}function respondWithResult(_0x42e54e,_0x510f21){_0x510f21=_0x510f21||0xc8;return function(_0x36b629){if(_0x36b629){return _0x42e54e[_0xb5fc('0x15')](_0x510f21)[_0xb5fc('0x16')](_0x36b629);}};}function respondWithFilteredResult(_0x3edba1,_0x101af5){return function(_0x210a76){if(_0x210a76){var _0x42d6dc=_0x210a76['count'],_0xe50e8d=_0x101af5['offset'],_0x5dbab2=_0x101af5[_0xb5fc('0x17')]+_0x101af5[_0xb5fc('0x18')],_0x5d43ca;if(_0x5dbab2>=_0x42d6dc){_0x5dbab2=_0x42d6dc;_0x5d43ca=0xc8;}else{_0x5d43ca=0xce;}_0x3edba1['status'](_0x5d43ca);return _0x3edba1[_0xb5fc('0x19')](_0xb5fc('0x1a'),_0xe50e8d+'-'+_0x5dbab2+'/'+_0x42d6dc)[_0xb5fc('0x16')](_0x210a76);}return null;};}function patchUpdates(_0x2bdd50){return function(_0x3122bb){try{jsonpatch['apply'](_0x3122bb,_0x2bdd50,!![]);}catch(_0x28d996){return BPromise['reject'](_0x28d996);}return _0x3122bb['save']();};}function saveUpdates(_0x41459f,_0x45ad19){return function(_0x51f99f){if(_0x51f99f){return _0x51f99f[_0xb5fc('0x1b')](_0x41459f)['then'](function(_0x5a7867){return _0x5a7867;});}return null;};}function removeEntity(_0x3ab625,_0x2ecf62){return function(_0x4b02c2){if(_0x4b02c2){return _0x4b02c2[_0xb5fc('0x1c')]()[_0xb5fc('0x1d')](function(){var _0x5e784d=_0x4b02c2[_0xb5fc('0x1e')]({'plain':!![]});var _0x398e06=_0xb5fc('0x1f');return db[_0xb5fc('0x20')][_0xb5fc('0x1c')]({'where':{'type':_0x398e06,'resourceId':_0x5e784d['id']}})[_0xb5fc('0x1d')](function(){return _0x4b02c2;});})[_0xb5fc('0x1d')](function(){_0x3ab625[_0xb5fc('0x15')](0xcc)[_0xb5fc('0x14')]();});}};}function handleEntityNotFound(_0x1434aa,_0x2c4aba){return function(_0x400d24){if(!_0x400d24){_0x1434aa[_0xb5fc('0x13')](0x194);}return _0x400d24;};}function handleError(_0x5449bf,_0x18072b){_0x18072b=_0x18072b||0x1f4;return function(_0x2e3506){logger[_0xb5fc('0x21')](_0x2e3506[_0xb5fc('0x22')]);if(_0x2e3506['name']){delete _0x2e3506[_0xb5fc('0x23')];}_0x5449bf[_0xb5fc('0x15')](_0x18072b)[_0xb5fc('0x24')](_0x2e3506);};}exports[_0xb5fc('0x25')]=function(_0x7fb9a2,_0xdbb073){var _0x2a8a09={},_0x2d2ee7={},_0xc06cfc={'count':0x0,'rows':[]};var _0x2e23ab=db['VoiceChanSpy'][_0xb5fc('0x26')];_0x2d2ee7[_0xb5fc('0x27')]=_[_0xb5fc('0x28')](_0x2e23ab);var _0x5e90c4={'dateStart':_0x7fb9a2[_0xb5fc('0x29')][_0xb5fc('0x2a')],'dateEnd':_0x7fb9a2[_0xb5fc('0x29')][_0xb5fc('0x2b')]};delete _0x7fb9a2[_0xb5fc('0x29')][_0xb5fc('0x2a')];delete _0x7fb9a2[_0xb5fc('0x29')]['dateEnd'];_0x2d2ee7[_0xb5fc('0x29')]=_[_0xb5fc('0x28')](_0x7fb9a2[_0xb5fc('0x29')]);_0x2d2ee7[_0xb5fc('0x2c')]=_['intersection'](_0x2d2ee7[_0xb5fc('0x27')],_0x2d2ee7[_0xb5fc('0x29')]);_0x2a8a09[_0xb5fc('0x2d')]=_[_0xb5fc('0x2e')](_0x2d2ee7[_0xb5fc('0x27')],qs['fields'](_0x7fb9a2['query'][_0xb5fc('0x2f')]));_0x2a8a09[_0xb5fc('0x2d')]=_0x2a8a09[_0xb5fc('0x2d')][_0xb5fc('0x30')]?_0x2a8a09['attributes']:_0x2d2ee7[_0xb5fc('0x27')];if(!_0x7fb9a2[_0xb5fc('0x29')][_0xb5fc('0x31')](_0xb5fc('0x32'))){_0x2a8a09[_0xb5fc('0x18')]=qs[_0xb5fc('0x18')](_0x7fb9a2[_0xb5fc('0x29')][_0xb5fc('0x18')]);_0x2a8a09[_0xb5fc('0x17')]=qs['offset'](_0x7fb9a2[_0xb5fc('0x29')][_0xb5fc('0x17')]);}_0x2a8a09[_0xb5fc('0x33')]=qs[_0xb5fc('0x34')](_0x7fb9a2['query'][_0xb5fc('0x34')]);_0x2a8a09['where']=qs[_0xb5fc('0x2c')](_[_0xb5fc('0x35')](_0x7fb9a2[_0xb5fc('0x29')],_0x2d2ee7[_0xb5fc('0x2c')]));if(_0x5e90c4['dateStart']){if(_0x5e90c4['dateEnd']){_0x5e90c4[_0xb5fc('0x2b')]=moment(_0x5e90c4[_0xb5fc('0x2b')])[_0xb5fc('0x36')](0x1,_0xb5fc('0x37'));}else{_0x5e90c4[_0xb5fc('0x2b')]=moment(_0x5e90c4[_0xb5fc('0x2a')])[_0xb5fc('0x36')](0x1,_0xb5fc('0x37'));}_[_0xb5fc('0x38')](_0x2a8a09[_0xb5fc('0x39')],{'createdAt':{'$gte':_0x5e90c4[_0xb5fc('0x2a')],'$lte':_0x5e90c4[_0xb5fc('0x2b')]}});}if(_0x7fb9a2[_0xb5fc('0x29')]['filter']){_0x2a8a09[_0xb5fc('0x39')]=_['merge'](_0x2a8a09[_0xb5fc('0x39')],{'$or':_[_0xb5fc('0x3a')](_0x2a8a09[_0xb5fc('0x2d')],function(_0x193efd){var _0x14d53a={};_0x14d53a[_0x193efd]={'$like':'%'+_0x7fb9a2[_0xb5fc('0x29')][_0xb5fc('0x3b')]+'%'};return _0x14d53a;})});}_0x2a8a09=_[_0xb5fc('0x38')]({},_0x2a8a09,_0x7fb9a2['options']);var _0x4789b9={'where':_0x2a8a09[_0xb5fc('0x39')]};return db['VoiceChanSpy'][_0xb5fc('0x3c')](_0x4789b9)[_0xb5fc('0x1d')](function(_0x3bd14a){_0xc06cfc[_0xb5fc('0x3c')]=_0x3bd14a;if(_0x7fb9a2[_0xb5fc('0x29')]['includeAll']){_0x2a8a09[_0xb5fc('0x3d')]=[{'all':!![]}];}return db[_0xb5fc('0x3e')][_0xb5fc('0x3f')](_0x2a8a09);})[_0xb5fc('0x1d')](function(_0x141d4f){_0xc06cfc[_0xb5fc('0x40')]=_0x141d4f;return _0xc06cfc;})[_0xb5fc('0x1d')](respondWithFilteredResult(_0xdbb073,_0x2a8a09))[_0xb5fc('0x41')](handleError(_0xdbb073,null));};exports['show']=function(_0x5ca4d2,_0x451f62){var _0x26c69c={'raw':![],'where':{'id':_0x5ca4d2[_0xb5fc('0x42')]['id']}},_0x4e16a9={};_0x4e16a9['model']=_[_0xb5fc('0x28')](db['VoiceChanSpy']['rawAttributes']);_0x4e16a9[_0xb5fc('0x29')]=_['keys'](_0x5ca4d2[_0xb5fc('0x29')]);_0x4e16a9[_0xb5fc('0x2c')]=_[_0xb5fc('0x2e')](_0x4e16a9[_0xb5fc('0x27')],_0x4e16a9[_0xb5fc('0x29')]);_0x26c69c[_0xb5fc('0x2d')]=_[_0xb5fc('0x2e')](_0x4e16a9['model'],qs[_0xb5fc('0x2f')](_0x5ca4d2[_0xb5fc('0x29')][_0xb5fc('0x2f')]));_0x26c69c[_0xb5fc('0x2d')]=_0x26c69c['attributes'][_0xb5fc('0x30')]?_0x26c69c[_0xb5fc('0x2d')]:_0x4e16a9['model'];if(_0x5ca4d2[_0xb5fc('0x29')]['includeAll']){_0x26c69c[_0xb5fc('0x3d')]=[{'all':!![]}];}_0x26c69c=_[_0xb5fc('0x38')]({},_0x26c69c,_0x5ca4d2[_0xb5fc('0x43')]);return db['VoiceChanSpy'][_0xb5fc('0x44')](_0x26c69c)[_0xb5fc('0x1d')](handleEntityNotFound(_0x451f62,null))[_0xb5fc('0x1d')](respondWithResult(_0x451f62,null))['catch'](handleError(_0x451f62,null));};exports[_0xb5fc('0x45')]=function(_0x298246,_0x51e3e2){return db[_0xb5fc('0x3e')][_0xb5fc('0x45')](_0x298246[_0xb5fc('0x46')],{})[_0xb5fc('0x1d')](function(_0xbfec46){var _0x1593d5=_0x298246['user'][_0xb5fc('0x1e')]({'plain':!![]});if(!_0x1593d5)throw new Error(_0xb5fc('0x47'));if(_0x1593d5[_0xb5fc('0x48')]===_0xb5fc('0x49')){var _0x2099eb=_0xbfec46[_0xb5fc('0x1e')]({'plain':!![]});var _0x5eeda7=_0xb5fc('0x1f');return db[_0xb5fc('0x4a')][_0xb5fc('0x44')]({'where':{'name':_0x5eeda7,'userProfileId':_0x1593d5[_0xb5fc('0x4b')]},'raw':!![]})['then'](function(_0xdf650a){if(_0xdf650a&&_0xdf650a[_0xb5fc('0x4c')]===0x0){return db[_0xb5fc('0x20')][_0xb5fc('0x45')]({'name':_0x2099eb['name'],'resourceId':_0x2099eb['id'],'type':_0xdf650a[_0xb5fc('0x23')],'sectionId':_0xdf650a['id']},{})[_0xb5fc('0x1d')](function(){return _0xbfec46;});}else{return _0xbfec46;}})[_0xb5fc('0x41')](function(_0x14a62f){logger['error'](_0xb5fc('0x4d'),_0x14a62f);throw _0x14a62f;});}return _0xbfec46;})[_0xb5fc('0x1d')](respondWithResult(_0x51e3e2,0xc9))[_0xb5fc('0x41')](handleError(_0x51e3e2,null));};exports[_0xb5fc('0x1b')]=function(_0x1fe735,_0x33c0ca){if(_0x1fe735[_0xb5fc('0x46')]['id']){delete _0x1fe735[_0xb5fc('0x46')]['id'];}return db[_0xb5fc('0x3e')][_0xb5fc('0x44')]({'where':{'id':_0x1fe735[_0xb5fc('0x42')]['id']}})[_0xb5fc('0x1d')](handleEntityNotFound(_0x33c0ca,null))[_0xb5fc('0x1d')](saveUpdates(_0x1fe735[_0xb5fc('0x46')],null))[_0xb5fc('0x1d')](respondWithResult(_0x33c0ca,null))[_0xb5fc('0x41')](handleError(_0x33c0ca,null));};exports[_0xb5fc('0x1c')]=function(_0x20c368,_0x460210){return db['VoiceChanSpy']['find']({'where':{'id':_0x20c368[_0xb5fc('0x42')]['id']}})[_0xb5fc('0x1d')](handleEntityNotFound(_0x460210,null))[_0xb5fc('0x1d')](removeEntity(_0x460210,null))[_0xb5fc('0x41')](handleError(_0x460210,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b0a28d6..5831910 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 _0x0ad6=['prefix','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','merge','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','internal','concat','User','findAll','name','agent','then','catch','exports','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','lodash','util','bluebird','../../config/logger','api','from-sip','format','%s%s'];(function(_0x3d727f,_0x5ad92e){var _0xbaf67c=function(_0x56467c){while(--_0x56467c){_0x3d727f['push'](_0x3d727f['shift']());}};_0xbaf67c(++_0x5ad92e);}(_0x0ad6,0x188));var _0x60ad=function(_0x5f1bc0,_0x14f6c1){_0x5f1bc0=_0x5f1bc0-0x0;var _0x3dcfe7=_0x0ad6[_0x5f1bc0];return _0x3dcfe7;};'use strict';var _=require(_0x60ad('0x0'));var util=require(_0x60ad('0x1'));var BPromise=require(_0x60ad('0x2'));var logger=require(_0x60ad('0x3'))(_0x60ad('0x4'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x4903db,_0x34eb1d,_0xedefdd){var _0x2653e1=0x1;var _0x24e99f=[];var _0x39a866={'context':_0x60ad('0x5'),'type':'system','isApp':![]};var _0x43597d={'exten':util[_0x60ad('0x6')](_0x60ad('0x7'),_0x4903db[_0x60ad('0x8')],_0xedefdd),'ChanSpyId':_0x4903db['id'],'UserId':_0x34eb1d['id']};_0x24e99f['push'](_['merge']({'app':_0x60ad('0x9'),'appdata':util['format'](_0x60ad('0xa'),_0x60ad('0xb')),'priority':_0x2653e1++},_0x39a866,_0x43597d));if(_0x4903db[_0x60ad('0xc')]){_0x24e99f[_0x60ad('0xd')](_['merge']({'app':_0x60ad('0xe'),'appdata':util['format'](_0x60ad('0xf'),_0x4903db[_0x60ad('0x10')]),'priority':_0x2653e1++},_0x39a866,_0x43597d));}if(_0x4903db[_0x60ad('0x11')]){_0x24e99f['push'](_[_0x60ad('0x12')]({'app':_0x60ad('0x13'),'appdata':_0x4903db[_0x60ad('0x14')],'priority':_0x2653e1++},_0x39a866,_0x43597d));}_0x24e99f[_0x60ad('0xd')](_[_0x60ad('0x12')]({'app':_0x60ad('0x15'),'appdata':util[_0x60ad('0x6')](_0x60ad('0x16'),_0x34eb1d['name'],_0x4903db[_0x60ad('0x17')]?_0x4903db['options'][_0x60ad('0x18')](''):''),'priority':_0x2653e1++},_0x39a866,_0x43597d));if(_0x4903db['record']){_0x24e99f[_0x60ad('0xd')](_[_0x60ad('0x12')]({'app':_0x60ad('0x19'),'priority':_0x2653e1++},_0x39a866,_0x43597d));}return _0x24e99f;};var getChanSpyApplications=function(_0x71d811,_0x531858){var _0x1680f8=[];for(var _0x4143ef=0x0,_0x49a863=0x1;_0x4143ef<_0x531858['length'];_0x4143ef++,_0x49a863=0x1){var _0x2d017f=getUserApplications(_0x71d811,_0x531858[_0x4143ef],_0x531858[_0x4143ef][_0x60ad('0x1a')]);var _0x38c488=getUserApplications(_0x71d811,_0x531858[_0x4143ef],_0x531858[_0x4143ef]['name']);_0x1680f8=_0x1680f8[_0x60ad('0x1b')](_0x2d017f,_0x38c488);}return _0x1680f8;};var getChanSpyPromise=function(_0xca4c59,_0x1b9736){return new BPromise(function(_0x18fba5,_0x551a76){return _0xca4c59[_0x60ad('0x1c')][_0x60ad('0x1d')]({'attributes':['id',_0x60ad('0x1e'),_0x60ad('0x1a')],'where':{'role':_0x60ad('0x1f'),'chanspy':!![]},'raw':!![]})[_0x60ad('0x20')](function(_0x20b554){if(_0x20b554){return _0x18fba5(getChanSpyApplications(_0x1b9736,_0x20b554));}return _0x18fba5([]);})[_0x60ad('0x21')](function(_0x19b44a){_0x551a76(_0x19b44a);});});};module[_0x60ad('0x22')]=function(_0x8127dc,_0x451343){var _0x3565d2=_0x8127dc['models'];return _0x8127dc['define'](_0x60ad('0x23'),attributes,{'tableName':_0x60ad('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x567f41,_0x5d7fb3,_0x3420cd){return getChanSpyPromise(_0x3565d2,_0x567f41)['then'](function(_0x334838){if(_0x334838&&_0x334838[_0x60ad('0x25')]){return _0x3565d2[_0x60ad('0x26')][_0x60ad('0x27')](_0x334838);}})[_0x60ad('0x20')](function(){_0x3420cd();})[_0x60ad('0x21')](function(_0x5f0ae6){_0x3420cd(_0x5f0ae6);});},'afterUpdate':function(_0x4dcd47,_0x3abf18,_0x4d7571){return _0x3565d2['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x4dcd47['id']}})[_0x60ad('0x20')](function(){return getChanSpyPromise(_0x3565d2,_0x4dcd47);})['then'](function(_0x4baf49){if(_0x4baf49&&_0x4baf49[_0x60ad('0x25')]){return _0x3565d2[_0x60ad('0x26')][_0x60ad('0x27')](_0x4baf49);}})[_0x60ad('0x20')](function(){_0x4d7571();})[_0x60ad('0x21')](function(_0x5ec6c9){_0x4d7571(_0x5ec6c9);});},'afterDestroy':function(_0x2cc0df,_0x3bdb1c,_0x4fca1c){return _0x3565d2[_0x60ad('0x26')]['destroy']({'where':{'ChanSpyId':_0x2cc0df['id']}})[_0x60ad('0x20')](function(){_0x4fca1c();})[_0x60ad('0x21')](function(_0x330957){_0x4fca1c(_0x330957);});}}});}; \ No newline at end of file +var _0x2fcd=['bulkCreate','destroy','util','bluebird','../../config/logger','api','./voiceChanSpy.attributes','from-sip','system','format','%s%s','prefix','push','merge','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','internal','concat','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension'];(function(_0x54b543,_0x5580ff){var _0x344a29=function(_0x261813){while(--_0x261813){_0x54b543['push'](_0x54b543['shift']());}};_0x344a29(++_0x5580ff);}(_0x2fcd,0x192));var _0xd2fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fcd[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xd2fc('0x0'));var BPromise=require(_0xd2fc('0x1'));var logger=require(_0xd2fc('0x2'))(_0xd2fc('0x3'));var attributes=require(_0xd2fc('0x4'));var getUserApplications=function(_0x13b1e3,_0x2d4655,_0x27e20c){var _0x57f1fc=0x1;var _0x4f397c=[];var _0x4c59e1={'context':_0xd2fc('0x5'),'type':_0xd2fc('0x6'),'isApp':![]};var _0x21eef1={'exten':util[_0xd2fc('0x7')](_0xd2fc('0x8'),_0x13b1e3[_0xd2fc('0x9')],_0x27e20c),'ChanSpyId':_0x13b1e3['id'],'UserId':_0x2d4655['id']};_0x4f397c[_0xd2fc('0xa')](_[_0xd2fc('0xb')]({'app':'Set','appdata':util[_0xd2fc('0x7')](_0xd2fc('0xc'),_0xd2fc('0xd')),'priority':_0x57f1fc++},_0x4c59e1,_0x21eef1));if(_0x13b1e3['record']){_0x4f397c[_0xd2fc('0xa')](_[_0xd2fc('0xb')]({'app':_0xd2fc('0xe'),'appdata':util[_0xd2fc('0x7')](_0xd2fc('0xf'),_0x13b1e3[_0xd2fc('0x10')]),'priority':_0x57f1fc++},_0x4c59e1,_0x21eef1));}if(_0x13b1e3[_0xd2fc('0x11')]){_0x4f397c[_0xd2fc('0xa')](_['merge']({'app':_0xd2fc('0x12'),'appdata':_0x13b1e3[_0xd2fc('0x13')],'priority':_0x57f1fc++},_0x4c59e1,_0x21eef1));}_0x4f397c[_0xd2fc('0xa')](_['merge']({'app':_0xd2fc('0x14'),'appdata':util[_0xd2fc('0x7')](_0xd2fc('0x15'),_0x2d4655[_0xd2fc('0x16')],_0x13b1e3[_0xd2fc('0x17')]?_0x13b1e3['options'][_0xd2fc('0x18')](''):''),'priority':_0x57f1fc++},_0x4c59e1,_0x21eef1));if(_0x13b1e3[_0xd2fc('0x19')]){_0x4f397c[_0xd2fc('0xa')](_[_0xd2fc('0xb')]({'app':_0xd2fc('0x1a'),'priority':_0x57f1fc++},_0x4c59e1,_0x21eef1));}return _0x4f397c;};var getChanSpyApplications=function(_0x234f26,_0x536186){var _0x236fd6=[];for(var _0x2c2091=0x0,_0x36d8f1=0x1;_0x2c2091<_0x536186[_0xd2fc('0x1b')];_0x2c2091++,_0x36d8f1=0x1){var _0x461924=getUserApplications(_0x234f26,_0x536186[_0x2c2091],_0x536186[_0x2c2091][_0xd2fc('0x1c')]);var _0x5b00e4=getUserApplications(_0x234f26,_0x536186[_0x2c2091],_0x536186[_0x2c2091][_0xd2fc('0x16')]);_0x236fd6=_0x236fd6[_0xd2fc('0x1d')](_0x461924,_0x5b00e4);}return _0x236fd6;};var getChanSpyPromise=function(_0x874137,_0x275deb){return new BPromise(function(_0xdbc2da,_0x3c7fcb){return _0x874137['User']['findAll']({'attributes':['id',_0xd2fc('0x16'),_0xd2fc('0x1c')],'where':{'role':_0xd2fc('0x1e'),'chanspy':!![]},'raw':!![]})[_0xd2fc('0x1f')](function(_0x56e5bc){if(_0x56e5bc){return _0xdbc2da(getChanSpyApplications(_0x275deb,_0x56e5bc));}return _0xdbc2da([]);})[_0xd2fc('0x20')](function(_0x53d739){_0x3c7fcb(_0x53d739);});});};module[_0xd2fc('0x21')]=function(_0x434ae3,_0x58492f){var _0x57e6af=_0x434ae3['models'];return _0x434ae3[_0xd2fc('0x22')](_0xd2fc('0x23'),attributes,{'tableName':_0xd2fc('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x196d03,_0x317aa7,_0xffaf77){return getChanSpyPromise(_0x57e6af,_0x196d03)[_0xd2fc('0x1f')](function(_0x2b26b1){if(_0x2b26b1&&_0x2b26b1[_0xd2fc('0x1b')]){return _0x57e6af[_0xd2fc('0x25')][_0xd2fc('0x26')](_0x2b26b1);}})[_0xd2fc('0x1f')](function(){_0xffaf77();})['catch'](function(_0x38e09b){_0xffaf77(_0x38e09b);});},'afterUpdate':function(_0x313be5,_0xfc91,_0x12ac82){return _0x57e6af['VoiceExtension'][_0xd2fc('0x27')]({'where':{'ChanSpyId':_0x313be5['id']}})[_0xd2fc('0x1f')](function(){return getChanSpyPromise(_0x57e6af,_0x313be5);})[_0xd2fc('0x1f')](function(_0x3d97bc){if(_0x3d97bc&&_0x3d97bc['length']){return _0x57e6af[_0xd2fc('0x25')]['bulkCreate'](_0x3d97bc);}})[_0xd2fc('0x1f')](function(){_0x12ac82();})['catch'](function(_0x4d4a49){_0x12ac82(_0x4d4a49);});},'afterDestroy':function(_0x228b2b,_0x20ac09,_0x40b097){return _0x57e6af[_0xd2fc('0x25')][_0xd2fc('0x27')]({'where':{'ChanSpyId':_0x228b2b['id']}})[_0xd2fc('0x1f')](function(){_0x40b097();})[_0xd2fc('0x20')](function(_0x2cf66d){_0x40b097(_0x2cf66d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 298c4a6..fcfb007 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 _0xda79=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x4951a9,_0x7bcc3){var _0x2b8c57=function(_0x106809){while(--_0x106809){_0x4951a9['push'](_0x4951a9['shift']());}};_0x2b8c57(++_0x7bcc3);}(_0xda79,0x6f));var _0x9da7=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xda79[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var moment=require(_0x9da7('0x2'));var BPromise=require(_0x9da7('0x3'));var rs=require(_0x9da7('0x4'));var fs=require('fs');var Redis=require(_0x9da7('0x5'));var db=require(_0x9da7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da7('0x7'))(_0x9da7('0x8'));var config=require(_0x9da7('0x9'));var jayson=require(_0x9da7('0xa'));var client=jayson['client'][_0x9da7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x301a62,_0x111669,_0x3bfda1){return new BPromise(function(_0x3e0f4b,_0x269612){return client['request'](_0x301a62,_0x3bfda1)[_0x9da7('0xc')](function(_0xeb4080){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x111669,_0x9da7('0xd'));logger[_0x9da7('0xe')](_0x9da7('0xf'),_0x111669,_0x9da7('0xd'),JSON['stringify'](_0xeb4080));if(_0xeb4080[_0x9da7('0x10')]){if(_0xeb4080[_0x9da7('0x10')][_0x9da7('0x11')]===0x1f4){logger[_0x9da7('0x10')](_0x9da7('0x12'),_0x111669,_0xeb4080[_0x9da7('0x10')][_0x9da7('0x13')]);return _0x269612(_0xeb4080[_0x9da7('0x10')][_0x9da7('0x13')]);}logger[_0x9da7('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x111669,_0xeb4080[_0x9da7('0x10')][_0x9da7('0x13')]);return _0x3e0f4b(_0xeb4080['error']['message']);}else{logger[_0x9da7('0x14')](_0x9da7('0x12'),_0x111669,_0x9da7('0xd'));_0x3e0f4b(_0xeb4080[_0x9da7('0x15')]['message']);}})[_0x9da7('0x16')](function(_0x3ab476){logger[_0x9da7('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x111669,_0x3ab476);_0x269612(_0x3ab476);});});} \ No newline at end of file +var _0x90b2=['info','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1d2cdb,_0x39f853){var _0x42ad94=function(_0x5b9239){while(--_0x5b9239){_0x1d2cdb['push'](_0x1d2cdb['shift']());}};_0x42ad94(++_0x39f853);}(_0x90b2,0x14c));var _0x290b=function(_0x595adc,_0x3e9d42){_0x595adc=_0x595adc-0x0;var _0x3a2419=_0x90b2[_0x595adc];return _0x3a2419;};'use strict';var _=require(_0x290b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x290b('0x1'));var fs=require('fs');var Redis=require(_0x290b('0x2'));var db=require(_0x290b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x290b('0x4'));var config=require(_0x290b('0x5'));var jayson=require(_0x290b('0x6'));var client=jayson[_0x290b('0x7')][_0x290b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d78d,_0x4ded4e,_0x139247){return new BPromise(function(_0x10e25e,_0x1d4985){return client[_0x290b('0x9')](_0x2d78d,_0x139247)['then'](function(_0x1ebbeb){logger[_0x290b('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ded4e,'request\x20sent');logger['debug'](_0x290b('0xb'),_0x4ded4e,_0x290b('0xc'),JSON[_0x290b('0xd')](_0x1ebbeb));if(_0x1ebbeb['error']){if(_0x1ebbeb['error']['code']===0x1f4){logger[_0x290b('0xe')](_0x290b('0xf'),_0x4ded4e,_0x1ebbeb['error'][_0x290b('0x10')]);return _0x1d4985(_0x1ebbeb['error']['message']);}logger['error'](_0x290b('0xf'),_0x4ded4e,_0x1ebbeb[_0x290b('0xe')][_0x290b('0x10')]);return _0x10e25e(_0x1ebbeb[_0x290b('0xe')][_0x290b('0x10')]);}else{logger[_0x290b('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ded4e,_0x290b('0xc'));_0x10e25e(_0x1ebbeb[_0x290b('0x11')][_0x290b('0x10')]);}})[_0x290b('0x12')](function(_0x126786){logger[_0x290b('0xe')](_0x290b('0xf'),_0x4ded4e,_0x126786);_0x1d4985(_0x126786);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index efcef5d..f0b847e 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 _0x6a95=['util','path','connect-timeout','express','Router','../../components/auth/service','./voiceContext.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy','exports','multer'];(function(_0x30f39b,_0x111da8){var _0x1467cb=function(_0x52c6d3){while(--_0x52c6d3){_0x30f39b['push'](_0x30f39b['shift']());}};_0x1467cb(++_0x111da8);}(_0x6a95,0x1db));var _0x56a9=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x6a95[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var path=require(_0x56a9('0x2'));var timeout=require(_0x56a9('0x3'));var express=require(_0x56a9('0x4'));var router=express[_0x56a9('0x5')]();var auth=require(_0x56a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x56a9('0x7'));router[_0x56a9('0x8')]('/',auth[_0x56a9('0x9')](),controller[_0x56a9('0xa')]);router[_0x56a9('0x8')](_0x56a9('0xb'),auth[_0x56a9('0x9')](),controller['show']);router['post']('/',auth[_0x56a9('0x9')](),controller[_0x56a9('0xc')]);router['put'](_0x56a9('0xb'),auth[_0x56a9('0x9')](),controller[_0x56a9('0xd')]);router[_0x56a9('0xe')](_0x56a9('0xb'),auth[_0x56a9('0x9')](),controller[_0x56a9('0xf')]);module[_0x56a9('0x10')]=router; \ No newline at end of file +var _0x69d4=['../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x80f2f0,_0x50643f){var _0x23a795=function(_0x364fea){while(--_0x364fea){_0x80f2f0['push'](_0x80f2f0['shift']());}};_0x23a795(++_0x50643f);}(_0x69d4,0x83));var _0x469d=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x69d4[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x469d('0x0'));var util=require(_0x469d('0x1'));var path=require('path');var timeout=require(_0x469d('0x2'));var express=require(_0x469d('0x3'));var router=express[_0x469d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x469d('0x5'));var config=require('../../config/environment');var controller=require(_0x469d('0x6'));router[_0x469d('0x7')]('/',auth[_0x469d('0x8')](),controller[_0x469d('0x9')]);router[_0x469d('0x7')](_0x469d('0xa'),auth['isAuthenticated'](),controller[_0x469d('0xb')]);router['post']('/',auth[_0x469d('0x8')](),controller[_0x469d('0xc')]);router[_0x469d('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x469d('0xe')](_0x469d('0xa'),auth['isAuthenticated'](),controller[_0x469d('0xf')]);module[_0x469d('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 04d201b..971d913 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 _0x57ab=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0xfa514e,_0x2665aa){var _0x39d8b0=function(_0x46328e){while(--_0x46328e){_0xfa514e['push'](_0xfa514e['shift']());}};_0x39d8b0(++_0x2665aa);}(_0x57ab,0x165));var _0xb57a=function(_0x42f3e4,_0x2646fd){_0x42f3e4=_0x42f3e4-0x0;var _0x1d7aa6=_0x57ab[_0x42f3e4];return _0x1d7aa6;};'use strict';var Sequelize=require(_0xb57a('0x0'));module[_0xb57a('0x1')]={'name':{'type':Sequelize[_0xb57a('0x2')],'unique':_0xb57a('0x3')},'description':{'type':Sequelize[_0xb57a('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb57a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa8ad=['sequelize','name','STRING'];(function(_0xe2d290,_0x25c542){var _0x13d105=function(_0x140677){while(--_0x140677){_0xe2d290['push'](_0xe2d290['shift']());}};_0x13d105(++_0x25c542);}(_0xa8ad,0x117));var _0xda8a=function(_0xb33a6f,_0x2a5618){_0xb33a6f=_0xb33a6f-0x0;var _0x591d4b=_0xa8ad[_0xb33a6f];return _0x591d4b;};'use strict';var Sequelize=require(_0xda8a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xda8a('0x1')},'description':{'type':Sequelize[_0xda8a('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 54f04bf..31ce519 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 _0x3a65=['render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','userProfileId','autoAssociation','join','root','Reload','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','VoiceContext','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','day','add','merge','filter','map','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','readFileSync','server/files/templates/context.ejs','utf8'];(function(_0x41af56,_0x31eba0){var _0x445504=function(_0x50464b){while(--_0x50464b){_0x41af56['push'](_0x41af56['shift']());}};_0x445504(++_0x31eba0);}(_0x3a65,0xe0));var _0x53a6=function(_0x26e2b0,_0x351281){_0x26e2b0=_0x26e2b0-0x0;var _0x1b79a8=_0x3a65[_0x26e2b0];return _0x1b79a8;};'use strict';var pdf=require(_0x53a6('0x0'));var emlformat=require(_0x53a6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x53a6('0x2'));var jsonpatch=require(_0x53a6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x53a6('0x4'));var Mustache=require(_0x53a6('0x5'));var util=require(_0x53a6('0x6'));var path=require(_0x53a6('0x7'));var sox=require(_0x53a6('0x8'));var csv=require(_0x53a6('0x9'));var ejs=require(_0x53a6('0xa'));var fs=require('fs');var _=require(_0x53a6('0xb'));var squel=require(_0x53a6('0xc'));var crypto=require(_0x53a6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x53a6('0xe'));var toCsv=require(_0x53a6('0x9'));var querystring=require(_0x53a6('0xf'));var Papa=require(_0x53a6('0x10'));var Redis=require(_0x53a6('0x11'));var qs=require(_0x53a6('0x12'));var logger=require('../../config/logger')(_0x53a6('0x13'));var utils=require('../../config/utils');var config=require(_0x53a6('0x14'));var db=require(_0x53a6('0x15'))['db'];var jayson=require(_0x53a6('0x16'));var client=jayson[_0x53a6('0x17')][_0x53a6('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x24c81a,_0x479f83,_0x123027,_0x3af49f){return new BPromise(function(_0x35b8f4,_0xd4be09){var _0x39af80=_0x3af49f||client;return _0x39af80['request'](_0x24c81a,_0x123027)[_0x53a6('0x19')](function(_0xdb9704){logger[_0x53a6('0x1a')](_0x53a6('0x1b'),_0x479f83,_0x53a6('0x1c'));logger[_0x53a6('0x1d')](_0x53a6('0x1e'),_0x479f83,_0x53a6('0x1c'),JSON[_0x53a6('0x1f')](_0xdb9704));if(_0xdb9704[_0x53a6('0x20')]){if(_0xdb9704[_0x53a6('0x20')][_0x53a6('0x21')]===0x1f4){logger[_0x53a6('0x20')](_0x53a6('0x1b'),_0x479f83,_0xdb9704['error'][_0x53a6('0x22')]);return _0xd4be09(_0xdb9704[_0x53a6('0x20')][_0x53a6('0x22')]);}logger[_0x53a6('0x20')](_0x53a6('0x1b'),_0x479f83,_0xdb9704[_0x53a6('0x20')][_0x53a6('0x22')]);return _0x35b8f4(_0xdb9704['error']['message']);}else{logger[_0x53a6('0x1a')](_0x53a6('0x1b'),_0x479f83,_0x53a6('0x1c'));_0x35b8f4(_0xdb9704[_0x53a6('0x23')][_0x53a6('0x22')]);}})[_0x53a6('0x24')](function(_0x49c929){logger[_0x53a6('0x20')](_0x53a6('0x1b'),_0x479f83,_0x49c929);_0xd4be09(_0x49c929);});});}function respondWithStatusCode(_0x54a50a,_0x22c5d3){_0x22c5d3=_0x22c5d3||0xcc;return function(_0x369ff2){if(_0x369ff2){return _0x54a50a[_0x53a6('0x25')](_0x22c5d3);}return _0x54a50a[_0x53a6('0x26')](_0x22c5d3)['end']();};}function respondWithResult(_0x279b3a,_0x4fe39e){_0x4fe39e=_0x4fe39e||0xc8;return function(_0x56dea5){if(_0x56dea5){return _0x279b3a[_0x53a6('0x26')](_0x4fe39e)[_0x53a6('0x27')](_0x56dea5);}};}function respondWithFilteredResult(_0x352402,_0x2e1b2e){return function(_0x5c8f7a){if(_0x5c8f7a){var _0x4c6eb9=_0x5c8f7a[_0x53a6('0x28')],_0x4a25fa=_0x2e1b2e['offset'],_0x112cc9=_0x2e1b2e['offset']+_0x2e1b2e[_0x53a6('0x29')],_0x451fc9;if(_0x112cc9>=_0x4c6eb9){_0x112cc9=_0x4c6eb9;_0x451fc9=0xc8;}else{_0x451fc9=0xce;}_0x352402[_0x53a6('0x26')](_0x451fc9);return _0x352402[_0x53a6('0x2a')](_0x53a6('0x2b'),_0x4a25fa+'-'+_0x112cc9+'/'+_0x4c6eb9)[_0x53a6('0x27')](_0x5c8f7a);}return null;};}function patchUpdates(_0x323c33){return function(_0x3263eb){try{jsonpatch[_0x53a6('0x2c')](_0x3263eb,_0x323c33,!![]);}catch(_0x168d15){return BPromise[_0x53a6('0x2d')](_0x168d15);}return _0x3263eb[_0x53a6('0x2e')]();};}function saveUpdates(_0x4a1fcd,_0x666774){return function(_0x1448d5){if(_0x1448d5){return _0x1448d5[_0x53a6('0x2f')](_0x4a1fcd)[_0x53a6('0x19')](function(_0x34e52c){return _0x34e52c;});}return null;};}function removeEntity(_0x4fc619,_0xaade35){return function(_0x4ae1ad){if(_0x4ae1ad){return _0x4ae1ad[_0x53a6('0x30')]()[_0x53a6('0x19')](function(){var _0xc80442=_0x4ae1ad[_0x53a6('0x31')]({'plain':!![]});var _0x18f3d8='Contexts';return db[_0x53a6('0x32')][_0x53a6('0x30')]({'where':{'type':_0x18f3d8,'resourceId':_0xc80442['id']}})['then'](function(){return _0x4ae1ad;});})[_0x53a6('0x19')](function(){_0x4fc619[_0x53a6('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37550c,_0x52460b){return function(_0x2f4839){if(!_0x2f4839){_0x37550c[_0x53a6('0x25')](0x194);}return _0x2f4839;};}function handleError(_0x5a394a,_0x6bbfd3){_0x6bbfd3=_0x6bbfd3||0x1f4;return function(_0xec7aed){logger[_0x53a6('0x20')](_0xec7aed[_0x53a6('0x33')]);if(_0xec7aed[_0x53a6('0x34')]){delete _0xec7aed[_0x53a6('0x34')];}_0x5a394a[_0x53a6('0x26')](_0x6bbfd3)[_0x53a6('0x35')](_0xec7aed);};}exports[_0x53a6('0x36')]=function(_0x12ff87,_0x457008){var _0x3fd0cf={},_0x2e570d={},_0x573490={'count':0x0,'rows':[]};var _0x47ef24=db[_0x53a6('0x37')]['rawAttributes'];_0x2e570d[_0x53a6('0x38')]=_[_0x53a6('0x39')](_0x47ef24);var _0x4156ba={'dateStart':_0x12ff87[_0x53a6('0x3a')][_0x53a6('0x3b')],'dateEnd':_0x12ff87[_0x53a6('0x3a')][_0x53a6('0x3c')]};delete _0x12ff87['query']['dateStart'];delete _0x12ff87[_0x53a6('0x3a')][_0x53a6('0x3c')];_0x2e570d[_0x53a6('0x3a')]=_[_0x53a6('0x39')](_0x12ff87[_0x53a6('0x3a')]);_0x2e570d[_0x53a6('0x3d')]=_[_0x53a6('0x3e')](_0x2e570d[_0x53a6('0x38')],_0x2e570d[_0x53a6('0x3a')]);_0x3fd0cf['attributes']=_[_0x53a6('0x3e')](_0x2e570d[_0x53a6('0x38')],qs[_0x53a6('0x3f')](_0x12ff87['query'][_0x53a6('0x3f')]));_0x3fd0cf[_0x53a6('0x40')]=_0x3fd0cf[_0x53a6('0x40')][_0x53a6('0x41')]?_0x3fd0cf[_0x53a6('0x40')]:_0x2e570d[_0x53a6('0x38')];if(!_0x12ff87[_0x53a6('0x3a')][_0x53a6('0x42')](_0x53a6('0x43'))){_0x3fd0cf[_0x53a6('0x29')]=qs[_0x53a6('0x29')](_0x12ff87[_0x53a6('0x3a')][_0x53a6('0x29')]);_0x3fd0cf[_0x53a6('0x44')]=qs[_0x53a6('0x44')](_0x12ff87[_0x53a6('0x3a')][_0x53a6('0x44')]);}_0x3fd0cf[_0x53a6('0x45')]=qs['sort'](_0x12ff87[_0x53a6('0x3a')][_0x53a6('0x46')]);_0x3fd0cf[_0x53a6('0x47')]=qs[_0x53a6('0x3d')](_[_0x53a6('0x48')](_0x12ff87[_0x53a6('0x3a')],_0x2e570d[_0x53a6('0x3d')]));if(_0x4156ba['dateStart']){if(_0x4156ba['dateEnd']){_0x4156ba[_0x53a6('0x3c')]=moment(_0x4156ba['dateEnd'])['add'](0x1,_0x53a6('0x49'));}else{_0x4156ba[_0x53a6('0x3c')]=moment(_0x4156ba[_0x53a6('0x3b')])[_0x53a6('0x4a')](0x1,_0x53a6('0x49'));}_[_0x53a6('0x4b')](_0x3fd0cf['where'],{'createdAt':{'$gte':_0x4156ba[_0x53a6('0x3b')],'$lte':_0x4156ba[_0x53a6('0x3c')]}});}if(_0x12ff87[_0x53a6('0x3a')][_0x53a6('0x4c')]){_0x3fd0cf['where']=_['merge'](_0x3fd0cf[_0x53a6('0x47')],{'$or':_[_0x53a6('0x4d')](_0x3fd0cf['attributes'],function(_0x1be3e9){var _0xb4dc6e={};_0xb4dc6e[_0x1be3e9]={'$like':'%'+_0x12ff87['query'][_0x53a6('0x4c')]+'%'};return _0xb4dc6e;})});}_0x3fd0cf=_[_0x53a6('0x4b')]({},_0x3fd0cf,_0x12ff87['options']);var _0x266392={'where':_0x3fd0cf[_0x53a6('0x47')]};return db['VoiceContext'][_0x53a6('0x28')](_0x266392)[_0x53a6('0x19')](function(_0x6a80ae){_0x573490[_0x53a6('0x28')]=_0x6a80ae;if(_0x12ff87[_0x53a6('0x3a')][_0x53a6('0x4e')]){_0x3fd0cf[_0x53a6('0x4f')]=[{'all':!![]}];}return db[_0x53a6('0x37')][_0x53a6('0x50')](_0x3fd0cf);})[_0x53a6('0x19')](function(_0x862331){_0x573490[_0x53a6('0x51')]=_0x862331;return _0x573490;})[_0x53a6('0x19')](respondWithFilteredResult(_0x457008,_0x3fd0cf))[_0x53a6('0x24')](handleError(_0x457008,null));};exports[_0x53a6('0x52')]=function(_0x37b269,_0x5c97dc){var _0x3a5720={'raw':![],'where':{'id':_0x37b269[_0x53a6('0x53')]['id']}},_0x5a0227={};_0x5a0227[_0x53a6('0x38')]=_[_0x53a6('0x39')](db[_0x53a6('0x37')][_0x53a6('0x54')]);_0x5a0227[_0x53a6('0x3a')]=_[_0x53a6('0x39')](_0x37b269[_0x53a6('0x3a')]);_0x5a0227[_0x53a6('0x3d')]=_[_0x53a6('0x3e')](_0x5a0227['model'],_0x5a0227['query']);_0x3a5720[_0x53a6('0x40')]=_['intersection'](_0x5a0227['model'],qs[_0x53a6('0x3f')](_0x37b269[_0x53a6('0x3a')]['fields']));_0x3a5720[_0x53a6('0x40')]=_0x3a5720[_0x53a6('0x40')][_0x53a6('0x41')]?_0x3a5720[_0x53a6('0x40')]:_0x5a0227[_0x53a6('0x38')];if(_0x37b269[_0x53a6('0x3a')][_0x53a6('0x4e')]){_0x3a5720[_0x53a6('0x4f')]=[{'all':!![]}];}_0x3a5720=_[_0x53a6('0x4b')]({},_0x3a5720,_0x37b269['options']);return db[_0x53a6('0x37')][_0x53a6('0x55')](_0x3a5720)[_0x53a6('0x19')](handleEntityNotFound(_0x5c97dc,null))[_0x53a6('0x19')](respondWithResult(_0x5c97dc,null))['catch'](handleError(_0x5c97dc,null));};exports[_0x53a6('0x56')]=function(_0x13f46f,_0x7650e7,_0xf23430){var _0x3afa90;return db[_0x53a6('0x37')]['create'](_0x13f46f[_0x53a6('0x57')],{'raw':!![]})['then'](function(_0x40fb2b){_0x3afa90=_0x40fb2b;return db['VoiceContext'][_0x53a6('0x50')]({'raw':!![]});})[_0x53a6('0x19')](function(_0x32113e){var _0xb745e9=fs[_0x53a6('0x58')](path['join'](config['root'],_0x53a6('0x59')),_0x53a6('0x5a'));var _0x3ccdc7=ejs[_0x53a6('0x5b')](_0xb745e9,{'contexts':_0x32113e||[]});fs[_0x53a6('0x5c')](_0x53a6('0x5d'),_0x3ccdc7);})[_0x53a6('0x19')](function(){return respondWithRpcPromise('Reload',_0x53a6('0x56'),{'module':_0x53a6('0x5e')});})['then'](function(){var _0xbe59e6=_0x13f46f['user'][_0x53a6('0x31')]({'plain':!![]});if(!_0xbe59e6)throw new Error(_0x53a6('0x5f'));if(_0xbe59e6[_0x53a6('0x60')]===_0x53a6('0x61')){var _0x1271aa=_0x3afa90[_0x53a6('0x31')]({'plain':!![]});return db[_0x53a6('0x62')][_0x53a6('0x55')]({'where':{'name':_0x53a6('0x63'),'userProfileId':_0xbe59e6[_0x53a6('0x64')]},'raw':!![]})[_0x53a6('0x19')](function(_0x422d74){if(_0x422d74&&_0x422d74[_0x53a6('0x65')]===0x0){return db[_0x53a6('0x32')][_0x53a6('0x56')]({'name':_0x1271aa[_0x53a6('0x34')],'resourceId':_0x1271aa['id'],'type':_0x422d74[_0x53a6('0x34')],'sectionId':_0x422d74['id']},{})[_0x53a6('0x19')](function(){return _0x3afa90;});}else{return _0x3afa90;}})[_0x53a6('0x24')](function(_0x462d56){logger[_0x53a6('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x462d56);throw _0x462d56;});}return _0x3afa90;})[_0x53a6('0x19')](respondWithResult(_0x7650e7,0xc9))[_0x53a6('0x24')](handleError(_0x7650e7,null));};exports[_0x53a6('0x2f')]=function(_0x20d809,_0x104178,_0x1b81da){var _0x20da65;return db[_0x53a6('0x37')][_0x53a6('0x55')]({'where':{'id':_0x20d809['params']['id']}})['then'](handleEntityNotFound(_0x104178,null))[_0x53a6('0x19')](saveUpdates(_0x20d809[_0x53a6('0x57')],null))['then'](function(_0x3766af){if(_0x3766af){_0x20da65=_0x3766af;return db[_0x53a6('0x37')][_0x53a6('0x50')]({'raw':!![]});}})[_0x53a6('0x19')](function(_0x3002e6){var _0x4ed049=fs['readFileSync'](path[_0x53a6('0x66')](config[_0x53a6('0x67')],_0x53a6('0x59')),_0x53a6('0x5a'));var _0x5b0de5=ejs[_0x53a6('0x5b')](_0x4ed049,{'contexts':_0x3002e6||[]});fs[_0x53a6('0x5c')](_0x53a6('0x5d'),_0x5b0de5);})[_0x53a6('0x19')](function(){return respondWithRpcPromise(_0x53a6('0x68'),_0x53a6('0x2f'),{'module':_0x53a6('0x5e')});})['then'](function(){return _0x20da65;})[_0x53a6('0x19')](respondWithResult(_0x104178,null))['catch'](handleError(_0x104178,null));};exports[_0x53a6('0x30')]=function(_0x2caa75,_0x1d30d4,_0x2c4538){var _0x5c22a1;return db['VoiceContext']['find']({'where':{'id':_0x2caa75[_0x53a6('0x53')]['id']}})['then'](handleEntityNotFound(_0x1d30d4,null))['then'](removeEntity(_0x1d30d4,null))[_0x53a6('0x19')](function(){return db['VoiceContext'][_0x53a6('0x50')]({'raw':!![]});})[_0x53a6('0x19')](function(_0x54cca5){var _0x2995ef=fs['readFileSync'](path['join'](config[_0x53a6('0x67')],_0x53a6('0x59')),'utf8');var _0x35bd1f=ejs['render'](_0x2995ef,{'contexts':_0x54cca5});fs[_0x53a6('0x5c')](_0x53a6('0x5d'),_0x35bd1f);return respondWithRpcPromise(_0x53a6('0x68'),_0x53a6('0x30'),{'module':_0x53a6('0x5e')});})[_0x53a6('0x24')](handleError(_0x1d30d4,null));}; \ No newline at end of file +var _0x8e6c=['utf8','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','set','Content-Range','reject','save','update','then','get','Contexts','UserProfileResource','destroy','end','stack','name','send','VoiceContext','model','keys','dateEnd','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','dateStart','add','day','merge','map','filter','includeAll','findAll','rows','params','rawAttributes','length','options','find','create','body','readFileSync','join','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','root','server/files/templates/context.ejs','render','Reload'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8e6c,0x67));var _0xc8e6=function(_0x2a38cc,_0x3a0a36){_0x2a38cc=_0x2a38cc-0x0;var _0x451a85=_0x8e6c[_0x2a38cc];return _0x451a85;};'use strict';var pdf=require(_0xc8e6('0x0'));var emlformat=require(_0xc8e6('0x1'));var rimraf=require(_0xc8e6('0x2'));var zipdir=require(_0xc8e6('0x3'));var jsonpatch=require(_0xc8e6('0x4'));var rp=require(_0xc8e6('0x5'));var moment=require(_0xc8e6('0x6'));var BPromise=require(_0xc8e6('0x7'));var Mustache=require('mustache');var util=require(_0xc8e6('0x8'));var path=require('path');var sox=require(_0xc8e6('0x9'));var csv=require(_0xc8e6('0xa'));var ejs=require(_0xc8e6('0xb'));var fs=require('fs');var _=require(_0xc8e6('0xc'));var squel=require('squel');var crypto=require(_0xc8e6('0xd'));var jsforce=require(_0xc8e6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc8e6('0xa'));var querystring=require('querystring');var Papa=require(_0xc8e6('0xf'));var Redis=require(_0xc8e6('0x10'));var qs=require(_0xc8e6('0x11'));var logger=require(_0xc8e6('0x12'))(_0xc8e6('0x13'));var utils=require(_0xc8e6('0x14'));var config=require(_0xc8e6('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc8e6('0x16'));var client=jayson[_0xc8e6('0x17')][_0xc8e6('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4f2e8f,_0x14c69a,_0x47d5bb,_0x1e1652){return new BPromise(function(_0x2484b5,_0x1a8630){var _0x5c5654=_0x1e1652||client;return _0x5c5654[_0xc8e6('0x19')](_0x4f2e8f,_0x47d5bb)['then'](function(_0x3fc5ff){logger[_0xc8e6('0x1a')](_0xc8e6('0x1b'),_0x14c69a,_0xc8e6('0x1c'));logger[_0xc8e6('0x1d')](_0xc8e6('0x1e'),_0x14c69a,_0xc8e6('0x1c'),JSON[_0xc8e6('0x1f')](_0x3fc5ff));if(_0x3fc5ff[_0xc8e6('0x20')]){if(_0x3fc5ff[_0xc8e6('0x20')][_0xc8e6('0x21')]===0x1f4){logger[_0xc8e6('0x20')](_0xc8e6('0x1b'),_0x14c69a,_0x3fc5ff[_0xc8e6('0x20')][_0xc8e6('0x22')]);return _0x1a8630(_0x3fc5ff['error'][_0xc8e6('0x22')]);}logger[_0xc8e6('0x20')](_0xc8e6('0x1b'),_0x14c69a,_0x3fc5ff[_0xc8e6('0x20')]['message']);return _0x2484b5(_0x3fc5ff[_0xc8e6('0x20')]['message']);}else{logger['info'](_0xc8e6('0x1b'),_0x14c69a,_0xc8e6('0x1c'));_0x2484b5(_0x3fc5ff['result'][_0xc8e6('0x22')]);}})[_0xc8e6('0x23')](function(_0x530878){logger[_0xc8e6('0x20')]('VoiceContext,\x20%s,\x20%s',_0x14c69a,_0x530878);_0x1a8630(_0x530878);});});}function respondWithStatusCode(_0x4b51ad,_0x2b5a98){_0x2b5a98=_0x2b5a98||0xcc;return function(_0x5b46a2){if(_0x5b46a2){return _0x4b51ad['sendStatus'](_0x2b5a98);}return _0x4b51ad[_0xc8e6('0x24')](_0x2b5a98)['end']();};}function respondWithResult(_0x20be0c,_0x382c98){_0x382c98=_0x382c98||0xc8;return function(_0x15b666){if(_0x15b666){return _0x20be0c['status'](_0x382c98)[_0xc8e6('0x25')](_0x15b666);}};}function respondWithFilteredResult(_0x4b7077,_0xe4faa6){return function(_0x25bdde){if(_0x25bdde){var _0x29591e=_0x25bdde[_0xc8e6('0x26')],_0x3daa4=_0xe4faa6[_0xc8e6('0x27')],_0x43a773=_0xe4faa6[_0xc8e6('0x27')]+_0xe4faa6['limit'],_0x331f61;if(_0x43a773>=_0x29591e){_0x43a773=_0x29591e;_0x331f61=0xc8;}else{_0x331f61=0xce;}_0x4b7077['status'](_0x331f61);return _0x4b7077[_0xc8e6('0x28')](_0xc8e6('0x29'),_0x3daa4+'-'+_0x43a773+'/'+_0x29591e)['json'](_0x25bdde);}return null;};}function patchUpdates(_0x1a564d){return function(_0xf792cd){try{jsonpatch['apply'](_0xf792cd,_0x1a564d,!![]);}catch(_0x4d737f){return BPromise[_0xc8e6('0x2a')](_0x4d737f);}return _0xf792cd[_0xc8e6('0x2b')]();};}function saveUpdates(_0x207540,_0x4e7548){return function(_0x158843){if(_0x158843){return _0x158843[_0xc8e6('0x2c')](_0x207540)[_0xc8e6('0x2d')](function(_0x1da8c0){return _0x1da8c0;});}return null;};}function removeEntity(_0x18ca8b,_0x209581){return function(_0x27f90d){if(_0x27f90d){return _0x27f90d['destroy']()['then'](function(){var _0x44fb46=_0x27f90d[_0xc8e6('0x2e')]({'plain':!![]});var _0x2f095c=_0xc8e6('0x2f');return db[_0xc8e6('0x30')][_0xc8e6('0x31')]({'where':{'type':_0x2f095c,'resourceId':_0x44fb46['id']}})['then'](function(){return _0x27f90d;});})['then'](function(){_0x18ca8b[_0xc8e6('0x24')](0xcc)[_0xc8e6('0x32')]();});}};}function handleEntityNotFound(_0x3bd66b,_0xcb97ca){return function(_0x5919b2){if(!_0x5919b2){_0x3bd66b['sendStatus'](0x194);}return _0x5919b2;};}function handleError(_0x18745c,_0x5d687e){_0x5d687e=_0x5d687e||0x1f4;return function(_0x567407){logger[_0xc8e6('0x20')](_0x567407[_0xc8e6('0x33')]);if(_0x567407[_0xc8e6('0x34')]){delete _0x567407[_0xc8e6('0x34')];}_0x18745c[_0xc8e6('0x24')](_0x5d687e)[_0xc8e6('0x35')](_0x567407);};}exports['index']=function(_0x3da689,_0x3ea0e3){var _0x1598f4={},_0x3b258={},_0x41a491={'count':0x0,'rows':[]};var _0x3aa86c=db[_0xc8e6('0x36')]['rawAttributes'];_0x3b258[_0xc8e6('0x37')]=_[_0xc8e6('0x38')](_0x3aa86c);var _0x9bc9dc={'dateStart':_0x3da689['query']['dateStart'],'dateEnd':_0x3da689['query'][_0xc8e6('0x39')]};delete _0x3da689[_0xc8e6('0x3a')]['dateStart'];delete _0x3da689[_0xc8e6('0x3a')][_0xc8e6('0x39')];_0x3b258[_0xc8e6('0x3a')]=_[_0xc8e6('0x38')](_0x3da689[_0xc8e6('0x3a')]);_0x3b258['filters']=_[_0xc8e6('0x3b')](_0x3b258[_0xc8e6('0x37')],_0x3b258[_0xc8e6('0x3a')]);_0x1598f4['attributes']=_[_0xc8e6('0x3b')](_0x3b258[_0xc8e6('0x37')],qs[_0xc8e6('0x3c')](_0x3da689['query'][_0xc8e6('0x3c')]));_0x1598f4[_0xc8e6('0x3d')]=_0x1598f4['attributes']['length']?_0x1598f4[_0xc8e6('0x3d')]:_0x3b258[_0xc8e6('0x37')];if(!_0x3da689[_0xc8e6('0x3a')][_0xc8e6('0x3e')](_0xc8e6('0x3f'))){_0x1598f4[_0xc8e6('0x40')]=qs[_0xc8e6('0x40')](_0x3da689[_0xc8e6('0x3a')][_0xc8e6('0x40')]);_0x1598f4[_0xc8e6('0x27')]=qs[_0xc8e6('0x27')](_0x3da689[_0xc8e6('0x3a')][_0xc8e6('0x27')]);}_0x1598f4[_0xc8e6('0x41')]=qs[_0xc8e6('0x42')](_0x3da689[_0xc8e6('0x3a')]['sort']);_0x1598f4[_0xc8e6('0x43')]=qs[_0xc8e6('0x44')](_[_0xc8e6('0x45')](_0x3da689[_0xc8e6('0x3a')],_0x3b258[_0xc8e6('0x44')]));if(_0x9bc9dc[_0xc8e6('0x46')]){if(_0x9bc9dc[_0xc8e6('0x39')]){_0x9bc9dc[_0xc8e6('0x39')]=moment(_0x9bc9dc[_0xc8e6('0x39')])[_0xc8e6('0x47')](0x1,'day');}else{_0x9bc9dc[_0xc8e6('0x39')]=moment(_0x9bc9dc['dateStart'])[_0xc8e6('0x47')](0x1,_0xc8e6('0x48'));}_[_0xc8e6('0x49')](_0x1598f4[_0xc8e6('0x43')],{'createdAt':{'$gte':_0x9bc9dc[_0xc8e6('0x46')],'$lte':_0x9bc9dc[_0xc8e6('0x39')]}});}if(_0x3da689['query']['filter']){_0x1598f4[_0xc8e6('0x43')]=_['merge'](_0x1598f4[_0xc8e6('0x43')],{'$or':_[_0xc8e6('0x4a')](_0x1598f4[_0xc8e6('0x3d')],function(_0x569ee3){var _0x318ef8={};_0x318ef8[_0x569ee3]={'$like':'%'+_0x3da689[_0xc8e6('0x3a')][_0xc8e6('0x4b')]+'%'};return _0x318ef8;})});}_0x1598f4=_[_0xc8e6('0x49')]({},_0x1598f4,_0x3da689['options']);var _0x320515={'where':_0x1598f4[_0xc8e6('0x43')]};return db[_0xc8e6('0x36')][_0xc8e6('0x26')](_0x320515)['then'](function(_0x4149b8){_0x41a491[_0xc8e6('0x26')]=_0x4149b8;if(_0x3da689[_0xc8e6('0x3a')][_0xc8e6('0x4c')]){_0x1598f4['include']=[{'all':!![]}];}return db[_0xc8e6('0x36')][_0xc8e6('0x4d')](_0x1598f4);})['then'](function(_0x57e996){_0x41a491[_0xc8e6('0x4e')]=_0x57e996;return _0x41a491;})[_0xc8e6('0x2d')](respondWithFilteredResult(_0x3ea0e3,_0x1598f4))[_0xc8e6('0x23')](handleError(_0x3ea0e3,null));};exports['show']=function(_0x362081,_0x4b6bdc){var _0x25097c={'raw':![],'where':{'id':_0x362081[_0xc8e6('0x4f')]['id']}},_0x458fa5={};_0x458fa5['model']=_[_0xc8e6('0x38')](db[_0xc8e6('0x36')][_0xc8e6('0x50')]);_0x458fa5[_0xc8e6('0x3a')]=_[_0xc8e6('0x38')](_0x362081[_0xc8e6('0x3a')]);_0x458fa5[_0xc8e6('0x44')]=_['intersection'](_0x458fa5[_0xc8e6('0x37')],_0x458fa5['query']);_0x25097c[_0xc8e6('0x3d')]=_['intersection'](_0x458fa5[_0xc8e6('0x37')],qs[_0xc8e6('0x3c')](_0x362081[_0xc8e6('0x3a')]['fields']));_0x25097c[_0xc8e6('0x3d')]=_0x25097c[_0xc8e6('0x3d')][_0xc8e6('0x51')]?_0x25097c[_0xc8e6('0x3d')]:_0x458fa5['model'];if(_0x362081[_0xc8e6('0x3a')][_0xc8e6('0x4c')]){_0x25097c['include']=[{'all':!![]}];}_0x25097c=_[_0xc8e6('0x49')]({},_0x25097c,_0x362081[_0xc8e6('0x52')]);return db[_0xc8e6('0x36')][_0xc8e6('0x53')](_0x25097c)[_0xc8e6('0x2d')](handleEntityNotFound(_0x4b6bdc,null))[_0xc8e6('0x2d')](respondWithResult(_0x4b6bdc,null))[_0xc8e6('0x23')](handleError(_0x4b6bdc,null));};exports[_0xc8e6('0x54')]=function(_0x38ab25,_0x503fb6,_0x54a0cc){var _0xc71a83;return db[_0xc8e6('0x36')][_0xc8e6('0x54')](_0x38ab25[_0xc8e6('0x55')],{'raw':!![]})[_0xc8e6('0x2d')](function(_0x5b9522){_0xc71a83=_0x5b9522;return db[_0xc8e6('0x36')][_0xc8e6('0x4d')]({'raw':!![]});})[_0xc8e6('0x2d')](function(_0x51afc1){var _0x3ef38e=fs[_0xc8e6('0x56')](path[_0xc8e6('0x57')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x19338c=ejs['render'](_0x3ef38e,{'contexts':_0x51afc1||[]});fs[_0xc8e6('0x58')](_0xc8e6('0x59'),_0x19338c);})['then'](function(){return respondWithRpcPromise('Reload',_0xc8e6('0x54'),{'module':_0xc8e6('0x5a')});})[_0xc8e6('0x2d')](function(){var _0x266e2e=_0x38ab25[_0xc8e6('0x5b')][_0xc8e6('0x2e')]({'plain':!![]});if(!_0x266e2e)throw new Error(_0xc8e6('0x5c'));if(_0x266e2e[_0xc8e6('0x5d')]===_0xc8e6('0x5b')){var _0xa64103=_0xc71a83['get']({'plain':!![]});return db[_0xc8e6('0x5e')][_0xc8e6('0x53')]({'where':{'name':'Contexts','userProfileId':_0x266e2e[_0xc8e6('0x5f')]},'raw':!![]})[_0xc8e6('0x2d')](function(_0x1a8e72){if(_0x1a8e72&&_0x1a8e72[_0xc8e6('0x60')]===0x0){return db[_0xc8e6('0x30')]['create']({'name':_0xa64103[_0xc8e6('0x34')],'resourceId':_0xa64103['id'],'type':_0x1a8e72[_0xc8e6('0x34')],'sectionId':_0x1a8e72['id']},{})[_0xc8e6('0x2d')](function(){return _0xc71a83;});}else{return _0xc71a83;}})[_0xc8e6('0x23')](function(_0x2028ac){logger[_0xc8e6('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2028ac);throw _0x2028ac;});}return _0xc71a83;})[_0xc8e6('0x2d')](respondWithResult(_0x503fb6,0xc9))['catch'](handleError(_0x503fb6,null));};exports[_0xc8e6('0x2c')]=function(_0x53e0e7,_0x5f54ea,_0x32bbfb){var _0x22412d;return db[_0xc8e6('0x36')]['find']({'where':{'id':_0x53e0e7['params']['id']}})['then'](handleEntityNotFound(_0x5f54ea,null))[_0xc8e6('0x2d')](saveUpdates(_0x53e0e7[_0xc8e6('0x55')],null))[_0xc8e6('0x2d')](function(_0x20c651){if(_0x20c651){_0x22412d=_0x20c651;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0xc8e6('0x2d')](function(_0x1a1bb5){var _0x58bf57=fs[_0xc8e6('0x56')](path[_0xc8e6('0x57')](config[_0xc8e6('0x61')],_0xc8e6('0x62')),'utf8');var _0x40127b=ejs[_0xc8e6('0x63')](_0x58bf57,{'contexts':_0x1a1bb5||[]});fs[_0xc8e6('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x40127b);})[_0xc8e6('0x2d')](function(){return respondWithRpcPromise(_0xc8e6('0x64'),'update',{'module':_0xc8e6('0x5a')});})['then'](function(){return _0x22412d;})['then'](respondWithResult(_0x5f54ea,null))[_0xc8e6('0x23')](handleError(_0x5f54ea,null));};exports[_0xc8e6('0x31')]=function(_0x2c22bd,_0x1b14c5,_0x18b911){var _0x431d1d;return db[_0xc8e6('0x36')][_0xc8e6('0x53')]({'where':{'id':_0x2c22bd[_0xc8e6('0x4f')]['id']}})[_0xc8e6('0x2d')](handleEntityNotFound(_0x1b14c5,null))['then'](removeEntity(_0x1b14c5,null))['then'](function(){return db[_0xc8e6('0x36')][_0xc8e6('0x4d')]({'raw':!![]});})[_0xc8e6('0x2d')](function(_0x2f613a){var _0x246166=fs[_0xc8e6('0x56')](path[_0xc8e6('0x57')](config[_0xc8e6('0x61')],'server/files/templates/context.ejs'),_0xc8e6('0x65'));var _0x44b491=ejs[_0xc8e6('0x63')](_0x246166,{'contexts':_0x2f613a});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x44b491);return respondWithRpcPromise(_0xc8e6('0x64'),_0xc8e6('0x31'),{'module':_0xc8e6('0x5a')});})[_0xc8e6('0x23')](handleError(_0x1b14c5,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index fada235..a18de19 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 _0xe9c4=['util','bluebird','exports','define','voice_contexts','lodash'];(function(_0x4a43a3,_0x52ed34){var _0x49c7cd=function(_0x3b71cf){while(--_0x3b71cf){_0x4a43a3['push'](_0x4a43a3['shift']());}};_0x49c7cd(++_0x52ed34);}(_0xe9c4,0x1af));var _0x4e9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e9c('0x0'));var util=require(_0x4e9c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4e9c('0x2'));var rp=require('request-promise');var attributes=require('./voiceContext.attributes');module[_0x4e9c('0x3')]=function(_0x42166b,_0x185835){return _0x42166b[_0x4e9c('0x4')]('VoiceContext',attributes,{'tableName':_0x4e9c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x392f=['api','moment','request-promise','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x26bf3c,_0x55716e){var _0x1e3cdb=function(_0x3893e2){while(--_0x3893e2){_0x26bf3c['push'](_0x26bf3c['shift']());}};_0x1e3cdb(++_0x55716e);}(_0x392f,0xb1));var _0xf392=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0x392f[_0x423097];return _0x3a73f1;};'use strict';var _=require(_0xf392('0x0'));var util=require(_0xf392('0x1'));var logger=require(_0xf392('0x2'))(_0xf392('0x3'));var moment=require(_0xf392('0x4'));var BPromise=require('bluebird');var rp=require(_0xf392('0x5'));var attributes=require(_0xf392('0x6'));module[_0xf392('0x7')]=function(_0x3b19c7,_0x2f630b){return _0x3b19c7['define'](_0xf392('0x8'),attributes,{'tableName':_0xf392('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index c2ec595..4007373 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 _0x0649=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','request\x20sent','debug','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch'];(function(_0x1d4db5,_0x1ec91c){var _0x496945=function(_0x5889bd){while(--_0x5889bd){_0x1d4db5['push'](_0x1d4db5['shift']());}};_0x496945(++_0x1ec91c);}(_0x0649,0x1b0));var _0x9064=function(_0xc8be76,_0x128839){_0xc8be76=_0xc8be76-0x0;var _0x32fd7c=_0x0649[_0xc8be76];return _0x32fd7c;};'use strict';var _=require(_0x9064('0x0'));var util=require(_0x9064('0x1'));var moment=require(_0x9064('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9064('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9064('0x4'));var logger=require(_0x9064('0x5'))(_0x9064('0x6'));var config=require('../../config/environment');var jayson=require(_0x9064('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c7859,_0x3c38a7,_0x1971ed){return new BPromise(function(_0xdb0eb7,_0x2107e7){return client[_0x9064('0x8')](_0x1c7859,_0x1971ed)['then'](function(_0x3551de){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3c38a7,_0x9064('0x9'));logger[_0x9064('0xa')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3c38a7,_0x9064('0x9'),JSON['stringify'](_0x3551de));if(_0x3551de[_0x9064('0xb')]){if(_0x3551de[_0x9064('0xb')][_0x9064('0xc')]===0x1f4){logger[_0x9064('0xb')](_0x9064('0xd'),_0x3c38a7,_0x3551de[_0x9064('0xb')][_0x9064('0xe')]);return _0x2107e7(_0x3551de[_0x9064('0xb')][_0x9064('0xe')]);}logger['error'](_0x9064('0xd'),_0x3c38a7,_0x3551de[_0x9064('0xb')][_0x9064('0xe')]);return _0xdb0eb7(_0x3551de[_0x9064('0xb')][_0x9064('0xe')]);}else{logger[_0x9064('0xf')]('VoiceContext,\x20%s,\x20%s',_0x3c38a7,_0x9064('0x9'));_0xdb0eb7(_0x3551de[_0x9064('0x10')]['message']);}})[_0x9064('0x11')](function(_0x129031){logger['error'](_0x9064('0xd'),_0x3c38a7,_0x129031);_0x2107e7(_0x129031);});});} \ No newline at end of file +var _0xf45b=['http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment'];(function(_0x5a3fb1,_0x14dbbc){var _0x49e026=function(_0xda57d4){while(--_0xda57d4){_0x5a3fb1['push'](_0x5a3fb1['shift']());}};_0x49e026(++_0x14dbbc);}(_0xf45b,0x10a));var _0xbf45=function(_0x3a3959,_0x5c8488){_0x3a3959=_0x3a3959-0x0;var _0x3b8f77=_0xf45b[_0x3a3959];return _0x3b8f77;};'use strict';var _=require(_0xbf45('0x0'));var util=require(_0xbf45('0x1'));var moment=require('moment');var BPromise=require(_0xbf45('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf45('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf45('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbf45('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf45('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x35cb7f,_0x42594d,_0x5f18b8){return new BPromise(function(_0xb5d4a0,_0x3ee6b3){return client['request'](_0x35cb7f,_0x5f18b8)[_0xbf45('0x7')](function(_0x3b028d){logger[_0xbf45('0x8')](_0xbf45('0x9'),_0x42594d,_0xbf45('0xa'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x42594d,_0xbf45('0xa'),JSON[_0xbf45('0xb')](_0x3b028d));if(_0x3b028d[_0xbf45('0xc')]){if(_0x3b028d[_0xbf45('0xc')][_0xbf45('0xd')]===0x1f4){logger[_0xbf45('0xc')](_0xbf45('0x9'),_0x42594d,_0x3b028d['error']['message']);return _0x3ee6b3(_0x3b028d[_0xbf45('0xc')][_0xbf45('0xe')]);}logger[_0xbf45('0xc')]('VoiceContext,\x20%s,\x20%s',_0x42594d,_0x3b028d[_0xbf45('0xc')][_0xbf45('0xe')]);return _0xb5d4a0(_0x3b028d[_0xbf45('0xc')]['message']);}else{logger[_0xbf45('0x8')]('VoiceContext,\x20%s,\x20%s',_0x42594d,_0xbf45('0xa'));_0xb5d4a0(_0x3b028d[_0xbf45('0xf')]['message']);}})[_0xbf45('0x10')](function(_0x3e2f38){logger[_0xbf45('0xc')](_0xbf45('0x9'),_0x42594d,_0x3e2f38);_0x3ee6b3(_0x3e2f38);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 84f7697..490265c 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 _0x8d02=['delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0x8d02,0x121));var _0x28d0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8d02[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x28d0('0x0'));var util=require(_0x28d0('0x1'));var path=require('path');var timeout=require(_0x28d0('0x2'));var express=require(_0x28d0('0x3'));var router=express[_0x28d0('0x4')]();var auth=require(_0x28d0('0x5'));var interaction=require(_0x28d0('0x6'));var config=require(_0x28d0('0x7'));var controller=require('./voiceDialReport.controller');router[_0x28d0('0x8')]('/',auth[_0x28d0('0x9')](),controller['index']);router['get'](_0x28d0('0xa'),auth[_0x28d0('0x9')](),controller[_0x28d0('0xb')]);router[_0x28d0('0x8')](_0x28d0('0xc'),auth[_0x28d0('0x9')](),controller[_0x28d0('0xd')]);router[_0x28d0('0xe')]('/',auth['isAuthenticated'](),controller[_0x28d0('0xf')]);router[_0x28d0('0x10')](_0x28d0('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x28d0('0x11')]('/:id',auth[_0x28d0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xba9a=['express','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xba9a,0x150));var _0xaba9=function(_0x19718a,_0x43c96a){_0x19718a=_0x19718a-0x0;var _0x5934ba=_0xba9a[_0x19718a];return _0x5934ba;};'use strict';var multer=require(_0xaba9('0x0'));var util=require(_0xaba9('0x1'));var path=require(_0xaba9('0x2'));var timeout=require(_0xaba9('0x3'));var express=require(_0xaba9('0x4'));var router=express['Router']();var auth=require(_0xaba9('0x5'));var interaction=require(_0xaba9('0x6'));var config=require('../../config/environment');var controller=require(_0xaba9('0x7'));router[_0xaba9('0x8')]('/',auth[_0xaba9('0x9')](),controller[_0xaba9('0xa')]);router['get'](_0xaba9('0xb'),auth[_0xaba9('0x9')](),controller['describe']);router[_0xaba9('0x8')](_0xaba9('0xc'),auth[_0xaba9('0x9')](),controller['show']);router[_0xaba9('0xd')]('/',auth[_0xaba9('0x9')](),controller['create']);router['put']('/:id',auth[_0xaba9('0x9')](),controller[_0xaba9('0xe')]);router['delete']('/:id',auth[_0xaba9('0x9')](),controller[_0xaba9('0xf')]);module[_0xaba9('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 37286b9..8967d71 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 _0x0c42=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x5c2806,_0x1144db){var _0x4ffeba=function(_0x3f12f1){while(--_0x3f12f1){_0x5c2806['push'](_0x5c2806['shift']());}};_0x4ffeba(++_0x1144db);}(_0x0c42,0x191));var _0x20c4=function(_0x58caac,_0x1378fa){_0x58caac=_0x58caac-0x0;var _0x11577a=_0x0c42[_0x58caac];return _0x11577a;};'use strict';var Sequelize=require(_0x20c4('0x0'));module[_0x20c4('0x1')]={'privilege':{'type':Sequelize[_0x20c4('0x2')]},'channel':{'type':Sequelize[_0x20c4('0x2')]},'channelstate':{'type':Sequelize[_0x20c4('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x20c4('0x2')]},'connectedlinenum':{'type':Sequelize[_0x20c4('0x2')]},'connectedlinename':{'type':Sequelize[_0x20c4('0x2')]},'language':{'type':Sequelize[_0x20c4('0x2')]},'accountcode':{'type':Sequelize[_0x20c4('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x20c4('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x20c4('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x20c4('0x2')]},'destchannelstate':{'type':Sequelize[_0x20c4('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x20c4('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x20c4('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x20c4('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x20c4('0x2')]},'destlanguage':{'type':Sequelize[_0x20c4('0x2')]},'destaccountcode':{'type':Sequelize[_0x20c4('0x2')]},'destcontext':{'type':Sequelize[_0x20c4('0x2')]},'destexten':{'type':Sequelize[_0x20c4('0x2')]},'destpriority':{'type':Sequelize[_0x20c4('0x3')]},'destuniqueid':{'type':Sequelize[_0x20c4('0x2')]},'destlinkedid':{'type':Sequelize[_0x20c4('0x2')]},'dialstring':{'type':Sequelize[_0x20c4('0x2')]},'dialstatus':{'type':Sequelize[_0x20c4('0x2')]},'starttime':{'type':Sequelize[_0x20c4('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x20c4('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x20c4('0x5')},'routeId':{'type':Sequelize[_0x20c4('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x20c4('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x94fe=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x302f8c,_0x153c3e){var _0xde630c=function(_0x5f4dbb){while(--_0x5f4dbb){_0x302f8c['push'](_0x302f8c['shift']());}};_0xde630c(++_0x153c3e);}(_0x94fe,0x167));var _0xe94f=function(_0x4c7ee5,_0x31afc9){_0x4c7ee5=_0x4c7ee5-0x0;var _0x37365b=_0x94fe[_0x4c7ee5];return _0x37365b;};'use strict';var Sequelize=require(_0xe94f('0x0'));module[_0xe94f('0x1')]={'privilege':{'type':Sequelize[_0xe94f('0x2')]},'channel':{'type':Sequelize[_0xe94f('0x2')]},'channelstate':{'type':Sequelize[_0xe94f('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe94f('0x2')]},'calleridname':{'type':Sequelize[_0xe94f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe94f('0x2')]},'connectedlinename':{'type':Sequelize[_0xe94f('0x2')]},'language':{'type':Sequelize[_0xe94f('0x2')]},'accountcode':{'type':Sequelize[_0xe94f('0x2')]},'context':{'type':Sequelize[_0xe94f('0x2')]},'exten':{'type':Sequelize[_0xe94f('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe94f('0x2')]},'linkedid':{'type':Sequelize[_0xe94f('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe94f('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe94f('0x2')]},'destcalleridname':{'type':Sequelize[_0xe94f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe94f('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xe94f('0x2')]},'destaccountcode':{'type':Sequelize[_0xe94f('0x2')]},'destcontext':{'type':Sequelize[_0xe94f('0x2')]},'destexten':{'type':Sequelize[_0xe94f('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe94f('0x2')]},'destlinkedid':{'type':Sequelize[_0xe94f('0x2')]},'dialstring':{'type':Sequelize[_0xe94f('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe94f('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe94f('0x2')],'comment':_0xe94f('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xe94f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 14e6181..0ca45fe 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 _0x3b37=['findAll','rows','catch','params','include','find','body','html-pdf','eml-format','request-promise','moment','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','day','merge','filter','map','options','VoiceDialReport','includeAll'];(function(_0x263b2c,_0x388a18){var _0x1d00f3=function(_0x838382){while(--_0x838382){_0x263b2c['push'](_0x263b2c['shift']());}};_0x1d00f3(++_0x388a18);}(_0x3b37,0xd0));var _0x73b3=function(_0x2eaaed,_0x388610){_0x2eaaed=_0x2eaaed-0x0;var _0x288428=_0x3b37[_0x2eaaed];return _0x288428;};'use strict';var pdf=require(_0x73b3('0x0'));var emlformat=require(_0x73b3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x73b3('0x2'));var moment=require(_0x73b3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x73b3('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x73b3('0x5'));var ejs=require(_0x73b3('0x6'));var fs=require('fs');var _=require(_0x73b3('0x7'));var squel=require(_0x73b3('0x8'));var crypto=require(_0x73b3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x73b3('0xa'));var toCsv=require(_0x73b3('0x5'));var querystring=require(_0x73b3('0xb'));var Papa=require(_0x73b3('0xc'));var Redis=require(_0x73b3('0xd'));var qs=require(_0x73b3('0xe'));var logger=require('../../config/logger')(_0x73b3('0xf'));var utils=require(_0x73b3('0x10'));var config=require(_0x73b3('0x11'));var db=require(_0x73b3('0x12'))['db'];function respondWithStatusCode(_0x32b26a,_0x32c155){_0x32c155=_0x32c155||0xcc;return function(_0x1bbdfd){if(_0x1bbdfd){return _0x32b26a[_0x73b3('0x13')](_0x32c155);}return _0x32b26a['status'](_0x32c155)[_0x73b3('0x14')]();};}function respondWithResult(_0x5e2a30,_0x438ede){_0x438ede=_0x438ede||0xc8;return function(_0x503e32){if(_0x503e32){return _0x5e2a30[_0x73b3('0x15')](_0x438ede)[_0x73b3('0x16')](_0x503e32);}};}function respondWithFilteredResult(_0x3288f5,_0x5c6937){return function(_0x13a89f){if(_0x13a89f){var _0x1b06f6=_0x13a89f[_0x73b3('0x17')],_0x598ba0=_0x5c6937[_0x73b3('0x18')],_0x4a30d9=_0x5c6937[_0x73b3('0x18')]+_0x5c6937[_0x73b3('0x19')],_0x1a1321;if(_0x4a30d9>=_0x1b06f6){_0x4a30d9=_0x1b06f6;_0x1a1321=0xc8;}else{_0x1a1321=0xce;}_0x3288f5[_0x73b3('0x15')](_0x1a1321);return _0x3288f5[_0x73b3('0x1a')](_0x73b3('0x1b'),_0x598ba0+'-'+_0x4a30d9+'/'+_0x1b06f6)[_0x73b3('0x16')](_0x13a89f);}return null;};}function patchUpdates(_0x2ae83e){return function(_0xd52b05){try{jsonpatch[_0x73b3('0x1c')](_0xd52b05,_0x2ae83e,!![]);}catch(_0x518177){return BPromise[_0x73b3('0x1d')](_0x518177);}return _0xd52b05[_0x73b3('0x1e')]();};}function saveUpdates(_0x3d08ef,_0x4f4311){return function(_0x5bd63c){if(_0x5bd63c){return _0x5bd63c[_0x73b3('0x1f')](_0x3d08ef)[_0x73b3('0x20')](function(_0xd94239){return _0xd94239;});}return null;};}function removeEntity(_0x466686,_0x1bf132){return function(_0x2f8d01){if(_0x2f8d01){return _0x2f8d01[_0x73b3('0x21')]()[_0x73b3('0x20')](function(){_0x466686[_0x73b3('0x15')](0xcc)[_0x73b3('0x14')]();});}};}function handleEntityNotFound(_0x3bb464,_0x542167){return function(_0x4bef00){if(!_0x4bef00){_0x3bb464['sendStatus'](0x194);}return _0x4bef00;};}function handleError(_0x2d46bc,_0x5b5dd2){_0x5b5dd2=_0x5b5dd2||0x1f4;return function(_0x3c2ec3){logger[_0x73b3('0x22')](_0x3c2ec3[_0x73b3('0x23')]);if(_0x3c2ec3['name']){delete _0x3c2ec3[_0x73b3('0x24')];}_0x2d46bc['status'](_0x5b5dd2)[_0x73b3('0x25')](_0x3c2ec3);};}exports['index']=function(_0x362e13,_0x47f18b){var _0x3088ec={},_0x4527a4={},_0x31101f={'count':0x0,'rows':[]};var _0x38afbd=db['VoiceDialReport'][_0x73b3('0x26')];_0x4527a4[_0x73b3('0x27')]=_[_0x73b3('0x28')](_0x38afbd);var _0x109c49={'dateStart':_0x362e13[_0x73b3('0x29')][_0x73b3('0x2a')],'dateEnd':_0x362e13[_0x73b3('0x29')]['dateEnd']};delete _0x362e13[_0x73b3('0x29')]['dateStart'];delete _0x362e13[_0x73b3('0x29')][_0x73b3('0x2b')];_0x4527a4[_0x73b3('0x29')]=_[_0x73b3('0x28')](_0x362e13[_0x73b3('0x29')]);_0x4527a4[_0x73b3('0x2c')]=_[_0x73b3('0x2d')](_0x4527a4[_0x73b3('0x27')],_0x4527a4[_0x73b3('0x29')]);_0x3088ec[_0x73b3('0x2e')]=_[_0x73b3('0x2d')](_0x4527a4[_0x73b3('0x27')],qs[_0x73b3('0x2f')](_0x362e13[_0x73b3('0x29')][_0x73b3('0x2f')]));_0x3088ec[_0x73b3('0x2e')]=_0x3088ec[_0x73b3('0x2e')][_0x73b3('0x30')]?_0x3088ec[_0x73b3('0x2e')]:_0x4527a4[_0x73b3('0x27')];if(!_0x362e13[_0x73b3('0x29')][_0x73b3('0x31')]('nolimit')){_0x3088ec[_0x73b3('0x19')]=qs[_0x73b3('0x19')](_0x362e13[_0x73b3('0x29')]['limit']);_0x3088ec[_0x73b3('0x18')]=qs['offset'](_0x362e13[_0x73b3('0x29')][_0x73b3('0x18')]);}_0x3088ec['order']=qs['sort'](_0x362e13[_0x73b3('0x29')][_0x73b3('0x32')]);_0x3088ec[_0x73b3('0x33')]=qs[_0x73b3('0x2c')](_[_0x73b3('0x34')](_0x362e13[_0x73b3('0x29')],_0x4527a4['filters']));if(_0x109c49[_0x73b3('0x2a')]){if(_0x109c49['dateEnd']){_0x109c49[_0x73b3('0x2b')]=moment(_0x109c49[_0x73b3('0x2b')])['add'](0x1,_0x73b3('0x35'));}else{_0x109c49[_0x73b3('0x2b')]=moment(_0x109c49[_0x73b3('0x2a')])['add'](0x1,'day');}_[_0x73b3('0x36')](_0x3088ec[_0x73b3('0x33')],{'createdAt':{'$gte':_0x109c49[_0x73b3('0x2a')],'$lte':_0x109c49[_0x73b3('0x2b')]}});}if(_0x362e13[_0x73b3('0x29')][_0x73b3('0x37')]){_0x3088ec[_0x73b3('0x33')]=_[_0x73b3('0x36')](_0x3088ec[_0x73b3('0x33')],{'$or':_[_0x73b3('0x38')](_0x3088ec[_0x73b3('0x2e')],function(_0x390ca8){var _0x20a309={};_0x20a309[_0x390ca8]={'$like':'%'+_0x362e13[_0x73b3('0x29')][_0x73b3('0x37')]+'%'};return _0x20a309;})});}_0x3088ec=_[_0x73b3('0x36')]({},_0x3088ec,_0x362e13[_0x73b3('0x39')]);var _0x3cab61={'where':_0x3088ec[_0x73b3('0x33')]};return db[_0x73b3('0x3a')][_0x73b3('0x17')](_0x3cab61)[_0x73b3('0x20')](function(_0x3d6a9c){_0x31101f[_0x73b3('0x17')]=_0x3d6a9c;if(_0x362e13[_0x73b3('0x29')][_0x73b3('0x3b')]){_0x3088ec['include']=[{'all':!![]}];}return db[_0x73b3('0x3a')][_0x73b3('0x3c')](_0x3088ec);})[_0x73b3('0x20')](function(_0x481116){_0x31101f[_0x73b3('0x3d')]=_0x481116;return _0x31101f;})[_0x73b3('0x20')](respondWithFilteredResult(_0x47f18b,_0x3088ec))[_0x73b3('0x3e')](handleError(_0x47f18b,null));};exports['show']=function(_0x3fc4a4,_0x46152e){var _0x276629={'raw':!![],'where':{'id':_0x3fc4a4[_0x73b3('0x3f')]['id']}},_0x32d13d={};_0x32d13d[_0x73b3('0x27')]=_[_0x73b3('0x28')](db[_0x73b3('0x3a')]['rawAttributes']);_0x32d13d['query']=_[_0x73b3('0x28')](_0x3fc4a4[_0x73b3('0x29')]);_0x32d13d[_0x73b3('0x2c')]=_['intersection'](_0x32d13d[_0x73b3('0x27')],_0x32d13d[_0x73b3('0x29')]);_0x276629[_0x73b3('0x2e')]=_[_0x73b3('0x2d')](_0x32d13d['model'],qs[_0x73b3('0x2f')](_0x3fc4a4['query'][_0x73b3('0x2f')]));_0x276629[_0x73b3('0x2e')]=_0x276629[_0x73b3('0x2e')][_0x73b3('0x30')]?_0x276629['attributes']:_0x32d13d[_0x73b3('0x27')];if(_0x3fc4a4[_0x73b3('0x29')][_0x73b3('0x3b')]){_0x276629[_0x73b3('0x40')]=[{'all':!![]}];}_0x276629=_[_0x73b3('0x36')]({},_0x276629,_0x3fc4a4[_0x73b3('0x39')]);return db['VoiceDialReport'][_0x73b3('0x41')](_0x276629)[_0x73b3('0x20')](handleEntityNotFound(_0x46152e,null))[_0x73b3('0x20')](respondWithResult(_0x46152e,null))['catch'](handleError(_0x46152e,null));};exports['create']=function(_0x2c463a,_0x55a893){return db[_0x73b3('0x3a')]['create'](_0x2c463a[_0x73b3('0x42')],{})[_0x73b3('0x20')](respondWithResult(_0x55a893,0xc9))[_0x73b3('0x3e')](handleError(_0x55a893,null));};exports[_0x73b3('0x1f')]=function(_0x20c7b2,_0x3a26b0){if(_0x20c7b2[_0x73b3('0x42')]['id']){delete _0x20c7b2['body']['id'];}return db[_0x73b3('0x3a')][_0x73b3('0x41')]({'where':{'id':_0x20c7b2[_0x73b3('0x3f')]['id']}})[_0x73b3('0x20')](handleEntityNotFound(_0x3a26b0,null))[_0x73b3('0x20')](saveUpdates(_0x20c7b2[_0x73b3('0x42')],null))[_0x73b3('0x20')](respondWithResult(_0x3a26b0,null))[_0x73b3('0x3e')](handleError(_0x3a26b0,null));};exports[_0x73b3('0x21')]=function(_0x283332,_0x427dee){return db[_0x73b3('0x3a')][_0x73b3('0x41')]({'where':{'id':_0x283332['params']['id']}})[_0x73b3('0x20')](handleEntityNotFound(_0x427dee,null))[_0x73b3('0x20')](removeEntity(_0x427dee,null))[_0x73b3('0x3e')](handleError(_0x427dee,null));};exports['describe']=function(_0x2c56fb,_0x4b4600){return db['VoiceDialReport']['describe']()[_0x73b3('0x20')](respondWithResult(_0x4b4600,null))[_0x73b3('0x3e')](handleError(_0x4b4600,null));}; \ No newline at end of file +var _0x4d05=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','model','keys','dateEnd','dateStart','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','filter','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json'];(function(_0x9d39e9,_0x3aebc9){var _0x4ac75b=function(_0x25bb25){while(--_0x25bb25){_0x9d39e9['push'](_0x9d39e9['shift']());}};_0x4ac75b(++_0x3aebc9);}(_0x4d05,0x147));var _0x54d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4d05[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x54d0('0x0'));var jsonpatch=require(_0x54d0('0x1'));var rp=require(_0x54d0('0x2'));var moment=require('moment');var BPromise=require(_0x54d0('0x3'));var Mustache=require(_0x54d0('0x4'));var util=require(_0x54d0('0x5'));var path=require(_0x54d0('0x6'));var sox=require(_0x54d0('0x7'));var csv=require(_0x54d0('0x8'));var ejs=require(_0x54d0('0x9'));var fs=require('fs');var _=require(_0x54d0('0xa'));var squel=require(_0x54d0('0xb'));var crypto=require(_0x54d0('0xc'));var jsforce=require(_0x54d0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x54d0('0x8'));var querystring=require('querystring');var Papa=require(_0x54d0('0xe'));var Redis=require(_0x54d0('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x54d0('0x10'))('api');var utils=require(_0x54d0('0x11'));var config=require(_0x54d0('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x455966,_0x172125){_0x172125=_0x172125||0xcc;return function(_0x19774b){if(_0x19774b){return _0x455966[_0x54d0('0x13')](_0x172125);}return _0x455966['status'](_0x172125)[_0x54d0('0x14')]();};}function respondWithResult(_0x2cd23d,_0x469c44){_0x469c44=_0x469c44||0xc8;return function(_0x57b516){if(_0x57b516){return _0x2cd23d[_0x54d0('0x15')](_0x469c44)[_0x54d0('0x16')](_0x57b516);}};}function respondWithFilteredResult(_0x1a96e4,_0x2325ec){return function(_0x425af4){if(_0x425af4){var _0x2f5321=_0x425af4[_0x54d0('0x17')],_0x2e108f=_0x2325ec[_0x54d0('0x18')],_0x4fc516=_0x2325ec['offset']+_0x2325ec[_0x54d0('0x19')],_0x5ebbfe;if(_0x4fc516>=_0x2f5321){_0x4fc516=_0x2f5321;_0x5ebbfe=0xc8;}else{_0x5ebbfe=0xce;}_0x1a96e4[_0x54d0('0x15')](_0x5ebbfe);return _0x1a96e4[_0x54d0('0x1a')](_0x54d0('0x1b'),_0x2e108f+'-'+_0x4fc516+'/'+_0x2f5321)['json'](_0x425af4);}return null;};}function patchUpdates(_0x4f109b){return function(_0x51264d){try{jsonpatch[_0x54d0('0x1c')](_0x51264d,_0x4f109b,!![]);}catch(_0xe8bad6){return BPromise[_0x54d0('0x1d')](_0xe8bad6);}return _0x51264d[_0x54d0('0x1e')]();};}function saveUpdates(_0x2b76aa,_0x265f10){return function(_0x4a261b){if(_0x4a261b){return _0x4a261b[_0x54d0('0x1f')](_0x2b76aa)[_0x54d0('0x20')](function(_0x3eae00){return _0x3eae00;});}return null;};}function removeEntity(_0x41092f,_0x1d88f7){return function(_0x4b44d6){if(_0x4b44d6){return _0x4b44d6[_0x54d0('0x21')]()[_0x54d0('0x20')](function(){_0x41092f['status'](0xcc)[_0x54d0('0x14')]();});}};}function handleEntityNotFound(_0x338774,_0x1201e3){return function(_0x1a98c0){if(!_0x1a98c0){_0x338774[_0x54d0('0x13')](0x194);}return _0x1a98c0;};}function handleError(_0x1881ba,_0x4ad581){_0x4ad581=_0x4ad581||0x1f4;return function(_0x45f9ed){logger[_0x54d0('0x22')](_0x45f9ed[_0x54d0('0x23')]);if(_0x45f9ed[_0x54d0('0x24')]){delete _0x45f9ed['name'];}_0x1881ba[_0x54d0('0x15')](_0x4ad581)[_0x54d0('0x25')](_0x45f9ed);};}exports[_0x54d0('0x26')]=function(_0x2444fa,_0x364e39){var _0x5154c7={},_0x1e9e16={},_0x135aa1={'count':0x0,'rows':[]};var _0x595700=db[_0x54d0('0x27')][_0x54d0('0x28')];_0x1e9e16[_0x54d0('0x29')]=_[_0x54d0('0x2a')](_0x595700);var _0x38d3b0={'dateStart':_0x2444fa['query']['dateStart'],'dateEnd':_0x2444fa['query'][_0x54d0('0x2b')]};delete _0x2444fa['query'][_0x54d0('0x2c')];delete _0x2444fa['query']['dateEnd'];_0x1e9e16[_0x54d0('0x2d')]=_[_0x54d0('0x2a')](_0x2444fa[_0x54d0('0x2d')]);_0x1e9e16[_0x54d0('0x2e')]=_[_0x54d0('0x2f')](_0x1e9e16[_0x54d0('0x29')],_0x1e9e16[_0x54d0('0x2d')]);_0x5154c7[_0x54d0('0x30')]=_[_0x54d0('0x2f')](_0x1e9e16[_0x54d0('0x29')],qs[_0x54d0('0x31')](_0x2444fa['query'][_0x54d0('0x31')]));_0x5154c7[_0x54d0('0x30')]=_0x5154c7['attributes'][_0x54d0('0x32')]?_0x5154c7[_0x54d0('0x30')]:_0x1e9e16[_0x54d0('0x29')];if(!_0x2444fa[_0x54d0('0x2d')][_0x54d0('0x33')]('nolimit')){_0x5154c7[_0x54d0('0x19')]=qs['limit'](_0x2444fa['query'][_0x54d0('0x19')]);_0x5154c7[_0x54d0('0x18')]=qs[_0x54d0('0x18')](_0x2444fa[_0x54d0('0x2d')][_0x54d0('0x18')]);}_0x5154c7[_0x54d0('0x34')]=qs[_0x54d0('0x35')](_0x2444fa[_0x54d0('0x2d')][_0x54d0('0x35')]);_0x5154c7[_0x54d0('0x36')]=qs[_0x54d0('0x2e')](_[_0x54d0('0x37')](_0x2444fa[_0x54d0('0x2d')],_0x1e9e16['filters']));if(_0x38d3b0[_0x54d0('0x2c')]){if(_0x38d3b0['dateEnd']){_0x38d3b0[_0x54d0('0x2b')]=moment(_0x38d3b0[_0x54d0('0x2b')])[_0x54d0('0x38')](0x1,_0x54d0('0x39'));}else{_0x38d3b0[_0x54d0('0x2b')]=moment(_0x38d3b0[_0x54d0('0x2c')])['add'](0x1,'day');}_['merge'](_0x5154c7['where'],{'createdAt':{'$gte':_0x38d3b0[_0x54d0('0x2c')],'$lte':_0x38d3b0[_0x54d0('0x2b')]}});}if(_0x2444fa[_0x54d0('0x2d')][_0x54d0('0x3a')]){_0x5154c7[_0x54d0('0x36')]=_[_0x54d0('0x3b')](_0x5154c7['where'],{'$or':_['map'](_0x5154c7[_0x54d0('0x30')],function(_0x1fb61f){var _0x23f923={};_0x23f923[_0x1fb61f]={'$like':'%'+_0x2444fa[_0x54d0('0x2d')]['filter']+'%'};return _0x23f923;})});}_0x5154c7=_[_0x54d0('0x3b')]({},_0x5154c7,_0x2444fa['options']);var _0x516d27={'where':_0x5154c7[_0x54d0('0x36')]};return db['VoiceDialReport'][_0x54d0('0x17')](_0x516d27)[_0x54d0('0x20')](function(_0x3ea7ea){_0x135aa1['count']=_0x3ea7ea;if(_0x2444fa[_0x54d0('0x2d')][_0x54d0('0x3c')]){_0x5154c7[_0x54d0('0x3d')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x54d0('0x3e')](_0x5154c7);})[_0x54d0('0x20')](function(_0x2a3559){_0x135aa1['rows']=_0x2a3559;return _0x135aa1;})[_0x54d0('0x20')](respondWithFilteredResult(_0x364e39,_0x5154c7))[_0x54d0('0x3f')](handleError(_0x364e39,null));};exports[_0x54d0('0x40')]=function(_0x29c136,_0x4f7a38){var _0x25d8f4={'raw':!![],'where':{'id':_0x29c136[_0x54d0('0x41')]['id']}},_0x554b4a={};_0x554b4a[_0x54d0('0x29')]=_[_0x54d0('0x2a')](db[_0x54d0('0x27')][_0x54d0('0x28')]);_0x554b4a[_0x54d0('0x2d')]=_[_0x54d0('0x2a')](_0x29c136[_0x54d0('0x2d')]);_0x554b4a[_0x54d0('0x2e')]=_['intersection'](_0x554b4a[_0x54d0('0x29')],_0x554b4a[_0x54d0('0x2d')]);_0x25d8f4[_0x54d0('0x30')]=_[_0x54d0('0x2f')](_0x554b4a[_0x54d0('0x29')],qs[_0x54d0('0x31')](_0x29c136['query']['fields']));_0x25d8f4['attributes']=_0x25d8f4[_0x54d0('0x30')][_0x54d0('0x32')]?_0x25d8f4[_0x54d0('0x30')]:_0x554b4a['model'];if(_0x29c136[_0x54d0('0x2d')][_0x54d0('0x3c')]){_0x25d8f4[_0x54d0('0x3d')]=[{'all':!![]}];}_0x25d8f4=_[_0x54d0('0x3b')]({},_0x25d8f4,_0x29c136[_0x54d0('0x42')]);return db['VoiceDialReport'][_0x54d0('0x43')](_0x25d8f4)[_0x54d0('0x20')](handleEntityNotFound(_0x4f7a38,null))[_0x54d0('0x20')](respondWithResult(_0x4f7a38,null))[_0x54d0('0x3f')](handleError(_0x4f7a38,null));};exports[_0x54d0('0x44')]=function(_0x410547,_0x3e2e04){return db[_0x54d0('0x27')][_0x54d0('0x44')](_0x410547[_0x54d0('0x45')],{})['then'](respondWithResult(_0x3e2e04,0xc9))['catch'](handleError(_0x3e2e04,null));};exports[_0x54d0('0x1f')]=function(_0x8a86d1,_0x1a8e1e){if(_0x8a86d1[_0x54d0('0x45')]['id']){delete _0x8a86d1[_0x54d0('0x45')]['id'];}return db[_0x54d0('0x27')]['find']({'where':{'id':_0x8a86d1['params']['id']}})['then'](handleEntityNotFound(_0x1a8e1e,null))[_0x54d0('0x20')](saveUpdates(_0x8a86d1[_0x54d0('0x45')],null))['then'](respondWithResult(_0x1a8e1e,null))[_0x54d0('0x3f')](handleError(_0x1a8e1e,null));};exports[_0x54d0('0x21')]=function(_0x51e805,_0x2ad567){return db[_0x54d0('0x27')][_0x54d0('0x43')]({'where':{'id':_0x51e805[_0x54d0('0x41')]['id']}})[_0x54d0('0x20')](handleEntityNotFound(_0x2ad567,null))[_0x54d0('0x20')](removeEntity(_0x2ad567,null))['catch'](handleError(_0x2ad567,null));};exports['describe']=function(_0x427aff,_0x8de811){return db[_0x54d0('0x27')]['describe']()[_0x54d0('0x20')](respondWithResult(_0x8de811,null))[_0x54d0('0x3f')](handleError(_0x8de811,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 0335024..54dbb40 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 _0x9f60=['../../config/logger','api','bluebird','./voiceDialReport.attributes','exports','define','report_dial','lodash','util'];(function(_0x31f7c5,_0x39d26c){var _0x192ab6=function(_0x3dd5e0){while(--_0x3dd5e0){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x192ab6(++_0x39d26c);}(_0x9f60,0x166));var _0x09f6=function(_0x3c22a8,_0x5e376b){_0x3c22a8=_0x3c22a8-0x0;var _0x33201c=_0x9f60[_0x3c22a8];return _0x33201c;};'use strict';var _=require(_0x09f6('0x0'));var util=require(_0x09f6('0x1'));var logger=require(_0x09f6('0x2'))(_0x09f6('0x3'));var moment=require('moment');var BPromise=require(_0x09f6('0x4'));var rp=require('request-promise');var attributes=require(_0x09f6('0x5'));module[_0x09f6('0x6')]=function(_0x4cd397,_0x568014){return _0x4cd397[_0x09f6('0x7')]('VoiceDialReport',attributes,{'tableName':_0x09f6('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x95c4=['util','api','bluebird','request-promise','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x519a7e,_0x36d1fb){var _0x3a9dcd=function(_0x105c5f){while(--_0x105c5f){_0x519a7e['push'](_0x519a7e['shift']());}};_0x3a9dcd(++_0x36d1fb);}(_0x95c4,0x15d));var _0x495c=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x95c4[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x495c('0x0'));var util=require(_0x495c('0x1'));var logger=require('../../config/logger')(_0x495c('0x2'));var moment=require('moment');var BPromise=require(_0x495c('0x3'));var rp=require(_0x495c('0x4'));var attributes=require(_0x495c('0x5'));module['exports']=function(_0x32eb82,_0x9407c5){return _0x32eb82[_0x495c('0x6')](_0x495c('0x7'),attributes,{'tableName':_0x495c('0x8'),'paranoid':![],'indexes':[{'fields':[_0x495c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 1d6bd6a..c63bd65 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 _0xc874=['request\x20sent','debug','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceDialReport,\x20%s,\x20%s'];(function(_0x4e44ef,_0x3840c8){var _0x27ccfe=function(_0x55d029){while(--_0x55d029){_0x4e44ef['push'](_0x4e44ef['shift']());}};_0x27ccfe(++_0x3840c8);}(_0xc874,0x154));var _0x4c87=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xc874[_0x3acee8];return _0x5046cc;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});}exports[_0x4c87('0x13')]=function(_0x547d92){var _0x428144=this;return new Promise(function(_0x561441,_0x9bc75f){return db[_0x4c87('0x14')][_0x4c87('0x15')](_0x547d92[_0x4c87('0x16')],{'raw':_0x547d92['options']?_0x547d92[_0x4c87('0x17')][_0x4c87('0x18')]===undefined?!![]:![]:!![]})[_0x4c87('0x19')](function(_0x3f27d4){logger[_0x4c87('0xa')](_0x4c87('0x13'),_0x547d92);logger[_0x4c87('0xd')](_0x4c87('0x13'),_0x547d92,JSON['stringify'](_0x3f27d4));_0x561441(_0x3f27d4);})[_0x4c87('0x1a')](function(_0x33aafd){logger['error'](_0x4c87('0x13'),_0x33aafd[_0x4c87('0x11')],_0x547d92);_0x9bc75f(_0x428144['error'](0x1f4,_0x33aafd[_0x4c87('0x11')]));});});};exports[_0x4c87('0x1b')]=function(_0x40a413){var _0x3b4399=this;return new Promise(function(_0x5cd58d,_0x4735f2){return db[_0x4c87('0x14')][_0x4c87('0x1c')](_0x40a413[_0x4c87('0x16')],{'raw':_0x40a413[_0x4c87('0x17')]?_0x40a413[_0x4c87('0x17')][_0x4c87('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40a413[_0x4c87('0x17')]?_0x40a413['options'][_0x4c87('0x1d')]||null:null,'attributes':_0x40a413['options']?_0x40a413[_0x4c87('0x17')][_0x4c87('0x1e')]||null:null,'limit':_0x40a413[_0x4c87('0x17')]?_0x40a413[_0x4c87('0x17')][_0x4c87('0x1f')]||null:null})[_0x4c87('0x19')](function(_0x5c264d){logger[_0x4c87('0xa')](_0x4c87('0x1b'),_0x40a413);logger[_0x4c87('0xd')](_0x4c87('0x1b'),_0x40a413,JSON[_0x4c87('0xe')](_0x5c264d));_0x5cd58d(_0x5c264d);})[_0x4c87('0x1a')](function(_0x32ae5e){logger[_0x4c87('0xf')](_0x4c87('0x1b'),_0x32ae5e[_0x4c87('0x11')],_0x40a413);_0x4735f2(_0x3b4399[_0x4c87('0xf')](0x1f4,_0x32ae5e[_0x4c87('0x11')]));});});}; \ No newline at end of file +var _0x1fdc=['where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update'];(function(_0x4db0da,_0x52015b){var _0x199a0c=function(_0x520dd6){while(--_0x520dd6){_0x4db0da['push'](_0x4db0da['shift']());}};_0x199a0c(++_0x52015b);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0x1fdc[_0x466e57];return _0x34df42;};'use strict';var _=require(_0xc1fd('0x0'));var util=require(_0xc1fd('0x1'));var moment=require('moment');var BPromise=require(_0xc1fd('0x2'));var rs=require(_0xc1fd('0x3'));var fs=require('fs');var Redis=require(_0xc1fd('0x4'));var db=require(_0xc1fd('0x5'))['db'];var utils=require(_0xc1fd('0x6'));var logger=require(_0xc1fd('0x7'))(_0xc1fd('0x8'));var config=require('../../config/environment');var jayson=require(_0xc1fd('0x9'));var client=jayson[_0xc1fd('0xa')][_0xc1fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf6faef,_0x1865d0,_0x3eebe6){return new BPromise(function(_0x43b858,_0x2e06e4){return client[_0xc1fd('0xc')](_0xf6faef,_0x3eebe6)[_0xc1fd('0xd')](function(_0x37fb6c){logger[_0xc1fd('0xe')](_0xc1fd('0xf'),_0x1865d0,'request\x20sent');logger[_0xc1fd('0x10')](_0xc1fd('0x11'),_0x1865d0,'request\x20sent',JSON[_0xc1fd('0x12')](_0x37fb6c));if(_0x37fb6c['error']){if(_0x37fb6c[_0xc1fd('0x13')]['code']===0x1f4){logger[_0xc1fd('0x13')](_0xc1fd('0xf'),_0x1865d0,_0x37fb6c[_0xc1fd('0x13')]['message']);return _0x2e06e4(_0x37fb6c[_0xc1fd('0x13')][_0xc1fd('0x14')]);}logger[_0xc1fd('0x13')](_0xc1fd('0xf'),_0x1865d0,_0x37fb6c['error']['message']);return _0x43b858(_0x37fb6c[_0xc1fd('0x13')][_0xc1fd('0x14')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x1865d0,'request\x20sent');_0x43b858(_0x37fb6c[_0xc1fd('0x15')][_0xc1fd('0x14')]);}})[_0xc1fd('0x16')](function(_0x1ddbff){logger['error'](_0xc1fd('0xf'),_0x1865d0,_0x1ddbff);_0x2e06e4(_0x1ddbff);});});}exports['CreateVoiceDialReport']=function(_0x3634e3){var _0x115b23=this;return new Promise(function(_0x12398e,_0x3a03a2){return db[_0xc1fd('0x17')][_0xc1fd('0x18')](_0x3634e3[_0xc1fd('0x19')],{'raw':_0x3634e3[_0xc1fd('0x1a')]?_0x3634e3[_0xc1fd('0x1a')][_0xc1fd('0x1b')]===undefined?!![]:![]:!![]})[_0xc1fd('0xd')](function(_0x4e5f56){logger[_0xc1fd('0xe')]('CreateVoiceDialReport',_0x3634e3);logger[_0xc1fd('0x10')]('CreateVoiceDialReport',_0x3634e3,JSON[_0xc1fd('0x12')](_0x4e5f56));_0x12398e(_0x4e5f56);})[_0xc1fd('0x16')](function(_0x3d4ae4){logger['error'](_0xc1fd('0x1c'),_0x3d4ae4['message'],_0x3634e3);_0x3a03a2(_0x115b23[_0xc1fd('0x13')](0x1f4,_0x3d4ae4[_0xc1fd('0x14')]));});});};exports[_0xc1fd('0x1d')]=function(_0x1593da){var _0x422570=this;return new Promise(function(_0x22c992,_0x3f566c){return db['VoiceDialReport'][_0xc1fd('0x1e')](_0x1593da['body'],{'raw':_0x1593da['options']?_0x1593da['options'][_0xc1fd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1593da[_0xc1fd('0x1a')]?_0x1593da[_0xc1fd('0x1a')][_0xc1fd('0x1f')]||null:null,'attributes':_0x1593da[_0xc1fd('0x1a')]?_0x1593da[_0xc1fd('0x1a')][_0xc1fd('0x20')]||null:null,'limit':_0x1593da['options']?_0x1593da[_0xc1fd('0x1a')][_0xc1fd('0x21')]||null:null})[_0xc1fd('0xd')](function(_0x12f8f6){logger[_0xc1fd('0xe')](_0xc1fd('0x1d'),_0x1593da);logger[_0xc1fd('0x10')](_0xc1fd('0x1d'),_0x1593da,JSON[_0xc1fd('0x12')](_0x12f8f6));_0x22c992(_0x12f8f6);})[_0xc1fd('0x16')](function(_0x588492){logger[_0xc1fd('0x13')](_0xc1fd('0x1d'),_0x588492[_0xc1fd('0x14')],_0x1593da);_0x3f566c(_0x422570[_0xc1fd('0x13')](0x1f4,_0x588492[_0xc1fd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index aab29cd..3ae6bb4 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 _0xa693=['destroy','multer','util','path','connect-timeout','express','Router','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','put','update','delete'];(function(_0x378e4a,_0x1f8baf){var _0x56976d=function(_0x2bec93){while(--_0x2bec93){_0x378e4a['push'](_0x378e4a['shift']());}};_0x56976d(++_0x1f8baf);}(_0xa693,0xf1));var _0x3a69=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0xa693[_0x366e99];return _0x180bbe;};'use strict';var multer=require(_0x3a69('0x0'));var util=require(_0x3a69('0x1'));var path=require(_0x3a69('0x2'));var timeout=require(_0x3a69('0x3'));var express=require(_0x3a69('0x4'));var router=express[_0x3a69('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3a69('0x6'));router[_0x3a69('0x7')]('/',auth[_0x3a69('0x8')](),controller[_0x3a69('0x9')]);router[_0x3a69('0x7')](_0x3a69('0xa'),auth[_0x3a69('0x8')](),controller['show']);router[_0x3a69('0xb')]('/',auth[_0x3a69('0x8')](),controller['create']);router['post']('/:id/applications',auth[_0x3a69('0x8')](),controller['addApplications']);router[_0x3a69('0xc')](_0x3a69('0xa'),auth[_0x3a69('0x8')](),controller[_0x3a69('0xd')]);router[_0x3a69('0xe')]('/:id',auth[_0x3a69('0x8')](),controller[_0x3a69('0xf')]);module['exports']=router; \ No newline at end of file +var _0x896e=['addApplications','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications'];(function(_0x496d65,_0x12479e){var _0x535a9c=function(_0xad3e95){while(--_0xad3e95){_0x496d65['push'](_0x496d65['shift']());}};_0x535a9c(++_0x12479e);}(_0x896e,0x1e9));var _0xe896=function(_0x11acf2,_0x57fce4){_0x11acf2=_0x11acf2-0x0;var _0xf59168=_0x896e[_0x11acf2];return _0xf59168;};'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('0xe')](_0xe896('0x10'),auth['isAuthenticated'](),controller[_0xe896('0x11')]);router['put'](_0xe896('0xc'),auth['isAuthenticated'](),controller[_0xe896('0x12')]);router[_0xe896('0x13')](_0xe896('0xc'),auth['isAuthenticated'](),controller[_0xe896('0x14')]);module[_0xe896('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d42924e..9025110 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 _0x70e0=['INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN'];(function(_0x221448,_0xd8a150){var _0x436694=function(_0xe22057){while(--_0xe22057){_0x221448['push'](_0x221448['shift']());}};_0x436694(++_0xd8a150);}(_0x70e0,0x17b));var _0x070e=function(_0x162fbf,_0x4c4b7e){_0x162fbf=_0x162fbf-0x0;var _0x2d33d7=_0x70e0[_0x162fbf];return _0x2d33d7;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'context':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0x3')},'priority':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x070e('0x3')},'tag':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x070e('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x070e('0x5')]('inbound','outbound','internal',_0x070e('0x6'),_0x070e('0x7'),_0x070e('0x8'),_0x070e('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x070e('0x2')]},'interval':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':_0x070e('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x070e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x070e('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x070e('0xc')]},'recordingFormat':{'type':Sequelize[_0x070e('0x2')],'defaultValue':_0x070e('0xd')},'answer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x070e('0xe')],'get':function(_0x39d2b9){return this[_0x070e('0xf')](_0x070e('0x10'));}}}; \ No newline at end of file +var _0xc874=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xc874,0x154));var _0x4c87=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xc874[_0x18b5e8];return _0x25baed;};'use strict';var Sequelize=require(_0x4c87('0x0'));module['exports']={'context':{'type':Sequelize[_0x4c87('0x1')],'allowNull':![],'unique':_0x4c87('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x4c87('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x4c87('0x2')},'tag':{'type':Sequelize[_0x4c87('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4c87('0x3')},'appdata':{'type':Sequelize[_0x4c87('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x4c87('0x4'),_0x4c87('0x5'),_0x4c87('0x6'),_0x4c87('0x7'),_0x4c87('0x8'),'system',_0x4c87('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4c87('0x1')],'allowNull':![],'defaultValue':_0x4c87('0xa')},'IntervalId':{'type':Sequelize[_0x4c87('0xb')]},'isApp':{'type':Sequelize[_0x4c87('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4c87('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x4c87('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4c87('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x4c87('0xd')},'answer':{'type':Sequelize[_0x4c87('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4c87('0xe')],'get':function(_0x3b01bb){return this[_0x4c87('0xf')]('exten');}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 9a9cb1c..c08fa0c 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 _0x757a=['recordingFormat','cutdigits','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','day','add','merge','count','includeAll','include','findAll','rows','catch','options','find','params','create','body','type','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description'];(function(_0x564f54,_0x443777){var _0x5c8a5f=function(_0xa7454f){while(--_0xa7454f){_0x564f54['push'](_0x564f54['shift']());}};_0x5c8a5f(++_0x443777);}(_0x757a,0xde));var _0xa757=function(_0x2e3437,_0x32b79f){_0x2e3437=_0x2e3437-0x0;var _0x260606=_0x757a[_0x2e3437];return _0x260606;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var logger=require(_0xa757('0x11'))(_0xa757('0x12'));var utils=require(_0xa757('0x13'));var config=require(_0xa757('0x14'));var db=require(_0xa757('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa757('0x16')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x2ed0d2,_0x513b1f){_0x513b1f=_0x513b1f||0xcc;return function(_0x481508){if(_0x481508){return _0x2ed0d2[_0xa757('0x17')](_0x513b1f);}return _0x2ed0d2[_0xa757('0x18')](_0x513b1f)[_0xa757('0x19')]();};}function respondWithResult(_0x4a0c38,_0x86abd){_0x86abd=_0x86abd||0xc8;return function(_0x31cfd2){if(_0x31cfd2){return _0x4a0c38[_0xa757('0x18')](_0x86abd)[_0xa757('0x1a')](_0x31cfd2);}};}function respondWithFilteredResult(_0x185011,_0x3df1f9){return function(_0x50aac1){if(_0x50aac1){var _0x2e195b=_0x50aac1['count'],_0x44eab8=_0x3df1f9[_0xa757('0x1b')],_0xde8248=_0x3df1f9[_0xa757('0x1b')]+_0x3df1f9[_0xa757('0x1c')],_0x4d9f58;if(_0xde8248>=_0x2e195b){_0xde8248=_0x2e195b;_0x4d9f58=0xc8;}else{_0x4d9f58=0xce;}_0x185011[_0xa757('0x18')](_0x4d9f58);return _0x185011[_0xa757('0x1d')](_0xa757('0x1e'),_0x44eab8+'-'+_0xde8248+'/'+_0x2e195b)['json'](_0x50aac1);}return null;};}function patchUpdates(_0x58954){return function(_0x4fec52){try{jsonpatch[_0xa757('0x1f')](_0x4fec52,_0x58954,!![]);}catch(_0x167640){return BPromise[_0xa757('0x20')](_0x167640);}return _0x4fec52[_0xa757('0x21')]();};}function saveUpdates(_0x4d598c,_0x5638c7){return function(_0x40ec48){if(_0x40ec48){return _0x40ec48[_0xa757('0x22')](_0x4d598c)[_0xa757('0x23')](function(_0x8d121f){return _0x8d121f;});}return null;};}function removeEntity(_0x1d6e2,_0x40562f){return function(_0x2ca10d){if(_0x2ca10d){return _0x2ca10d[_0xa757('0x24')]()[_0xa757('0x23')](function(){var _0x59fae6=_0x2ca10d[_0xa757('0x25')]({'plain':!![]});var _0x59e9d4=[{'name':_0xa757('0x26'),'value':'inbound','ignore':![]},{'name':_0xa757('0x27'),'value':_0xa757('0x28'),'ignore':![]},{'name':_0xa757('0x29'),'value':'internal','ignore':![]}];var _0x2b19d5=_(_0x59e9d4)[_0xa757('0x2a')](_0xa757('0x2b'))[_0xa757('0x2c')]('value')[_0xa757('0x2d')]();if(_['includes'](_0x2b19d5,_0x59fae6['type'])){return;}var _0x54b75e=_['find'](_0x59e9d4,[_0xa757('0x2d'),_0x59fae6['type']])[_0xa757('0x2e')];return db[_0xa757('0x2f')]['destroy']({'where':{'type':_0x54b75e,'resourceId':_0x59fae6['id']}})[_0xa757('0x23')](function(){return _0x2ca10d;});})['then'](function(){_0x1d6e2[_0xa757('0x18')](0xcc)[_0xa757('0x19')]();});}};}function handleEntityNotFound(_0x5307c3,_0x235e54){return function(_0x5ade7b){if(!_0x5ade7b){_0x5307c3[_0xa757('0x17')](0x194);}return _0x5ade7b;};}function handleError(_0x27b3e2,_0x458974){_0x458974=_0x458974||0x1f4;return function(_0x300dc4){logger[_0xa757('0x30')](_0x300dc4[_0xa757('0x31')]);if(_0x300dc4[_0xa757('0x2e')]){delete _0x300dc4[_0xa757('0x2e')];}_0x27b3e2[_0xa757('0x18')](_0x458974)[_0xa757('0x32')](_0x300dc4);};}exports[_0xa757('0x33')]=function(_0x20735f,_0x25dfbb){var _0x2dfb33={},_0x27be88={},_0xc1cc20={'count':0x0,'rows':[]};var _0x3e64b7=db[_0xa757('0x34')][_0xa757('0x35')];_0x27be88[_0xa757('0x36')]=_[_0xa757('0x37')](_0x3e64b7);var _0x170aa9={'dateStart':_0x20735f[_0xa757('0x38')][_0xa757('0x39')],'dateEnd':_0x20735f['query'][_0xa757('0x3a')]};delete _0x20735f[_0xa757('0x38')][_0xa757('0x39')];delete _0x20735f[_0xa757('0x38')][_0xa757('0x3a')];_0x27be88['query']=_[_0xa757('0x37')](_0x20735f[_0xa757('0x38')]);_0x27be88[_0xa757('0x3b')]=_[_0xa757('0x3c')](_0x27be88[_0xa757('0x36')],_0x27be88[_0xa757('0x38')]);_0x2dfb33['attributes']=_[_0xa757('0x3c')](_0x27be88[_0xa757('0x36')],qs[_0xa757('0x3d')](_0x20735f[_0xa757('0x38')][_0xa757('0x3d')]));_0x2dfb33[_0xa757('0x3e')]=_0x2dfb33[_0xa757('0x3e')][_0xa757('0x3f')]?_0x2dfb33[_0xa757('0x3e')]:_0x27be88['model'];if(!_0x20735f[_0xa757('0x38')][_0xa757('0x40')](_0xa757('0x41'))){_0x2dfb33[_0xa757('0x1c')]=qs[_0xa757('0x1c')](_0x20735f[_0xa757('0x38')]['limit']);_0x2dfb33[_0xa757('0x1b')]=qs[_0xa757('0x1b')](_0x20735f['query']['offset']);}_0x2dfb33[_0xa757('0x42')]=qs[_0xa757('0x43')](_0x20735f['query']['sort']);_0x2dfb33[_0xa757('0x44')]=qs[_0xa757('0x3b')](_[_0xa757('0x45')](_0x20735f['query'],_0x27be88[_0xa757('0x3b')]));if(_0x170aa9[_0xa757('0x39')]){if(_0x170aa9[_0xa757('0x3a')]){_0x170aa9[_0xa757('0x3a')]=moment(_0x170aa9[_0xa757('0x3a')])['add'](0x1,_0xa757('0x46'));}else{_0x170aa9['dateEnd']=moment(_0x170aa9['dateStart'])[_0xa757('0x47')](0x1,_0xa757('0x46'));}_[_0xa757('0x48')](_0x2dfb33[_0xa757('0x44')],{'createdAt':{'$gte':_0x170aa9[_0xa757('0x39')],'$lte':_0x170aa9['dateEnd']}});}if(_0x20735f['query'][_0xa757('0x2a')]){_0x2dfb33[_0xa757('0x44')]=_[_0xa757('0x48')](_0x2dfb33[_0xa757('0x44')],{'$or':_[_0xa757('0x2c')](_0x2dfb33[_0xa757('0x3e')],function(_0x4f12b1){var _0xd61628={};_0xd61628[_0x4f12b1]={'$like':'%'+_0x20735f[_0xa757('0x38')]['filter']+'%'};return _0xd61628;})});}_0x2dfb33=_[_0xa757('0x48')]({},_0x2dfb33,_0x20735f['options']);var _0x2d111e={'where':_0x2dfb33[_0xa757('0x44')]};return db['VoiceExtension'][_0xa757('0x49')](_0x2d111e)[_0xa757('0x23')](function(_0x4bee69){_0xc1cc20[_0xa757('0x49')]=_0x4bee69;if(_0x20735f[_0xa757('0x38')][_0xa757('0x4a')]){_0x2dfb33[_0xa757('0x4b')]=[{'all':!![]}];}return db['VoiceExtension'][_0xa757('0x4c')](_0x2dfb33);})[_0xa757('0x23')](function(_0x450815){_0xc1cc20[_0xa757('0x4d')]=_0x450815;return _0xc1cc20;})['then'](respondWithFilteredResult(_0x25dfbb,_0x2dfb33))[_0xa757('0x4e')](handleError(_0x25dfbb,null));};exports['show']=function(_0x50c131,_0x2acf88){var _0x3c039d={'raw':![],'where':{'id':_0x50c131['params']['id']}},_0x1ae3ae={};_0x1ae3ae[_0xa757('0x36')]=_['keys'](db[_0xa757('0x34')][_0xa757('0x35')]);_0x1ae3ae[_0xa757('0x38')]=_[_0xa757('0x37')](_0x50c131[_0xa757('0x38')]);_0x1ae3ae[_0xa757('0x3b')]=_[_0xa757('0x3c')](_0x1ae3ae[_0xa757('0x36')],_0x1ae3ae['query']);_0x3c039d[_0xa757('0x3e')]=_[_0xa757('0x3c')](_0x1ae3ae[_0xa757('0x36')],qs[_0xa757('0x3d')](_0x50c131[_0xa757('0x38')][_0xa757('0x3d')]));_0x3c039d[_0xa757('0x3e')]=_0x3c039d[_0xa757('0x3e')][_0xa757('0x3f')]?_0x3c039d[_0xa757('0x3e')]:_0x1ae3ae[_0xa757('0x36')];if(_0x50c131[_0xa757('0x38')][_0xa757('0x4a')]){_0x3c039d[_0xa757('0x4b')]=[{'all':!![]}];}_0x3c039d=_[_0xa757('0x48')]({},_0x3c039d,_0x50c131[_0xa757('0x4f')]);return db['VoiceExtension'][_0xa757('0x50')](_0x3c039d)['then'](handleEntityNotFound(_0x2acf88,null))[_0xa757('0x23')](respondWithResult(_0x2acf88,null))[_0xa757('0x4e')](handleError(_0x2acf88,null));};exports[_0xa757('0x24')]=function(_0x24c0ad,_0x4cb461){return db[_0xa757('0x34')][_0xa757('0x50')]({'where':{'id':_0x24c0ad[_0xa757('0x51')]['id']}})[_0xa757('0x23')](handleEntityNotFound(_0x4cb461,null))['then'](removeEntity(_0x4cb461,null))[_0xa757('0x4e')](handleError(_0x4cb461,null));};exports[_0xa757('0x52')]=function(_0x216b32,_0x1c9f1e){if(_0x216b32[_0xa757('0x53')][_0xa757('0x54')]==='outbound'&&!_['startsWith'](_0x216b32['body']['exten'],'_')){_0x216b32[_0xa757('0x53')][_0xa757('0x55')]='_'[_0xa757('0x56')](_0x216b32[_0xa757('0x53')][_0xa757('0x55')]);}return db[_0xa757('0x34')]['create'](_0x216b32[_0xa757('0x53')],{'raw':![]})[_0xa757('0x23')](function(_0x34e03f){var _0x29b2f5=_0x216b32['user'][_0xa757('0x25')]({'plain':!![]});if(!_0x29b2f5)throw new Error(_0xa757('0x57'));if(_0x29b2f5['role']===_0xa757('0x58')){var _0x5cd0c3=_0x34e03f[_0xa757('0x25')]({'plain':!![]});var _0x5d375c=[{'name':_0xa757('0x26'),'value':'inbound'},{'name':'OutboundRoutes','value':_0xa757('0x28')},{'name':_0xa757('0x29'),'value':_0xa757('0x59')}];var _0x1b5db5=_[_0xa757('0x50')](_0x5d375c,[_0xa757('0x2d'),_0x5cd0c3['type']])['name'];return db[_0xa757('0x5a')][_0xa757('0x50')]({'where':{'name':_0x1b5db5,'userProfileId':_0x29b2f5[_0xa757('0x5b')]},'raw':!![]})['then'](function(_0x55a7d2){if(_0x55a7d2&&_0x55a7d2[_0xa757('0x5c')]===0x0){return db[_0xa757('0x2f')][_0xa757('0x52')]({'name':_0x5cd0c3[_0xa757('0x2e')],'resourceId':_0x5cd0c3['id'],'type':_0x55a7d2[_0xa757('0x2e')],'sectionId':_0x55a7d2['id']},{})[_0xa757('0x23')](function(){return _0x34e03f;});}else{return _0x34e03f;}})['catch'](function(_0x466728){logger[_0xa757('0x30')](_0xa757('0x5d'),_0x466728);throw _0x466728;});}return _0x34e03f;})[_0xa757('0x23')](respondWithResult(_0x1c9f1e,0xc9))[_0xa757('0x4e')](handleError(_0x1c9f1e,null));};exports[_0xa757('0x22')]=function(_0x213219,_0x13dd81){if(_0x213219[_0xa757('0x53')]['id']){delete _0x213219[_0xa757('0x53')]['id'];}return db['VoiceExtension'][_0xa757('0x50')]({'where':{'id':_0x213219['params']['id']}})['then'](handleEntityNotFound(_0x13dd81,null))[_0xa757('0x23')](function(_0x3da8c1){if(_0x3da8c1){return db[_0xa757('0x34')][_0xa757('0x22')](_[_0xa757('0x45')](_0x213219[_0xa757('0x53')],[_0xa757('0x55'),_0xa757('0x5e'),_0xa757('0x5f'),_0xa757('0x60'),_0xa757('0x61')]),{'where':{'context':_0x3da8c1['context'],'exten':_0x3da8c1[_0xa757('0x55')]},'individualHooks':!![]})[_0xa757('0x23')](function(_0x5f0b71){return _0x5f0b71;});}return null;})[_0xa757('0x23')](respondWithStatusCode(_0x13dd81,null))[_0xa757('0x4e')](handleError(_0x13dd81,null));};exports[_0xa757('0x62')]=function(_0x180cec,_0x27d79b,_0x113a33){return db['VoiceExtension'][_0xa757('0x63')]({'where':{'id':_0x180cec['params']['id']}})[_0xa757('0x23')](handleEntityNotFound(_0x27d79b,null))[_0xa757('0x23')](function(_0x2d9d97){if(_0x2d9d97){return db[_0xa757('0x64')][_0xa757('0x65')](function(_0x5c0870){return db['VoiceExtension'][_0xa757('0x24')]({'where':{'VoiceExtensionId':_0x180cec[_0xa757('0x51')]['id']},'transaction':_0x5c0870})[_0xa757('0x23')](function(_0x5f450f){var _0x115a94=_['map'](_0x180cec[_0xa757('0x53')],function(_0x294165){_0x294165[_0xa757('0x66')]=_0x180cec[_0xa757('0x51')]['id'];return _0x294165;});return db[_0xa757('0x34')][_0xa757('0x67')](_0x115a94,{'transaction':_0x5c0870});});})['then'](function(){return db[_0xa757('0x34')][_0xa757('0x68')]({'where':{'isApp':!![],'VoiceExtensionId':_0x180cec[_0xa757('0x51')]['id']},'order':_0xa757('0x69')});});}})[_0xa757('0x23')](respondWithResult(_0x27d79b,null))['catch'](handleError(_0x27d79b,null));}; \ No newline at end of file +var _0xb7e7=['localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','InboundRoutes','InternalRoutes','internal','filter','ignore','value','find','name','destroy','sendStatus','error','stack','send','index','VoiceExtension','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','merge','include','rows','catch','show','params','options','body','type','outbound','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','addApplications','findOne','sequelize','transaction','map','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x43c62b,_0x58efd1){var _0x2b23e7=function(_0x1cfdae){while(--_0x1cfdae){_0x43c62b['push'](_0x43c62b['shift']());}};_0x2b23e7(++_0x58efd1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb7e7[_0x31e29a];return _0x32d892;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var qs=require(_0x7b7e('0x10'));var logger=require('../../config/logger')(_0x7b7e('0x11'));var utils=require(_0x7b7e('0x12'));var config=require(_0x7b7e('0x13'));var db=require(_0x7b7e('0x14'))['db'];config[_0x7b7e('0x15')]=_[_0x7b7e('0x16')](config[_0x7b7e('0x15')],{'host':_0x7b7e('0x17'),'port':0x18eb});var socket=require(_0x7b7e('0x18'))(new Redis(config['redis']));require(_0x7b7e('0x19'))[_0x7b7e('0x1a')](socket);function respondWithStatusCode(_0x50d7d2,_0x422d3a){_0x422d3a=_0x422d3a||0xcc;return function(_0x5976ac){if(_0x5976ac){return _0x50d7d2['sendStatus'](_0x422d3a);}return _0x50d7d2[_0x7b7e('0x1b')](_0x422d3a)[_0x7b7e('0x1c')]();};}function respondWithResult(_0xf067da,_0x457ec5){_0x457ec5=_0x457ec5||0xc8;return function(_0x3d2fb2){if(_0x3d2fb2){return _0xf067da['status'](_0x457ec5)['json'](_0x3d2fb2);}};}function respondWithFilteredResult(_0xc7f087,_0x36444d){return function(_0x27f999){if(_0x27f999){var _0x26aaec=_0x27f999[_0x7b7e('0x1d')],_0x2cc400=_0x36444d[_0x7b7e('0x1e')],_0x3bf2f0=_0x36444d[_0x7b7e('0x1e')]+_0x36444d[_0x7b7e('0x1f')],_0x242368;if(_0x3bf2f0>=_0x26aaec){_0x3bf2f0=_0x26aaec;_0x242368=0xc8;}else{_0x242368=0xce;}_0xc7f087[_0x7b7e('0x1b')](_0x242368);return _0xc7f087[_0x7b7e('0x20')](_0x7b7e('0x21'),_0x2cc400+'-'+_0x3bf2f0+'/'+_0x26aaec)[_0x7b7e('0x22')](_0x27f999);}return null;};}function patchUpdates(_0x864287){return function(_0x3a7b8b){try{jsonpatch['apply'](_0x3a7b8b,_0x864287,!![]);}catch(_0x69262b){return BPromise[_0x7b7e('0x23')](_0x69262b);}return _0x3a7b8b[_0x7b7e('0x24')]();};}function saveUpdates(_0x4c0647,_0x313122){return function(_0xbf0cb3){if(_0xbf0cb3){return _0xbf0cb3[_0x7b7e('0x25')](_0x4c0647)[_0x7b7e('0x26')](function(_0x2b7211){return _0x2b7211;});}return null;};}function removeEntity(_0x303d8c,_0x28bf43){return function(_0x10a66a){if(_0x10a66a){return _0x10a66a['destroy']()['then'](function(){var _0x4a836a=_0x10a66a[_0x7b7e('0x27')]({'plain':!![]});var _0x22598e=[{'name':_0x7b7e('0x28'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x7b7e('0x29'),'value':_0x7b7e('0x2a'),'ignore':![]}];var _0x16a3c7=_(_0x22598e)[_0x7b7e('0x2b')](_0x7b7e('0x2c'))['map'](_0x7b7e('0x2d'))[_0x7b7e('0x2d')]();if(_['includes'](_0x16a3c7,_0x4a836a['type'])){return;}var _0x4e5de7=_[_0x7b7e('0x2e')](_0x22598e,[_0x7b7e('0x2d'),_0x4a836a['type']])[_0x7b7e('0x2f')];return db['UserProfileResource'][_0x7b7e('0x30')]({'where':{'type':_0x4e5de7,'resourceId':_0x4a836a['id']}})[_0x7b7e('0x26')](function(){return _0x10a66a;});})[_0x7b7e('0x26')](function(){_0x303d8c['status'](0xcc)[_0x7b7e('0x1c')]();});}};}function handleEntityNotFound(_0xe31336,_0x35602a){return function(_0x326dd2){if(!_0x326dd2){_0xe31336[_0x7b7e('0x31')](0x194);}return _0x326dd2;};}function handleError(_0x5732ee,_0x41af57){_0x41af57=_0x41af57||0x1f4;return function(_0x51c010){logger[_0x7b7e('0x32')](_0x51c010[_0x7b7e('0x33')]);if(_0x51c010[_0x7b7e('0x2f')]){delete _0x51c010[_0x7b7e('0x2f')];}_0x5732ee[_0x7b7e('0x1b')](_0x41af57)[_0x7b7e('0x34')](_0x51c010);};}exports[_0x7b7e('0x35')]=function(_0x4bfe7f,_0x5227a7){var _0xebcdbc={},_0x162b84={},_0x5f25fe={'count':0x0,'rows':[]};var _0x3a3bc7=db[_0x7b7e('0x36')][_0x7b7e('0x37')];_0x162b84['model']=_[_0x7b7e('0x38')](_0x3a3bc7);var _0x256908={'dateStart':_0x4bfe7f[_0x7b7e('0x39')][_0x7b7e('0x3a')],'dateEnd':_0x4bfe7f[_0x7b7e('0x39')][_0x7b7e('0x3b')]};delete _0x4bfe7f[_0x7b7e('0x39')][_0x7b7e('0x3a')];delete _0x4bfe7f[_0x7b7e('0x39')][_0x7b7e('0x3b')];_0x162b84[_0x7b7e('0x39')]=_[_0x7b7e('0x38')](_0x4bfe7f[_0x7b7e('0x39')]);_0x162b84[_0x7b7e('0x3c')]=_[_0x7b7e('0x3d')](_0x162b84[_0x7b7e('0x3e')],_0x162b84['query']);_0xebcdbc[_0x7b7e('0x3f')]=_[_0x7b7e('0x3d')](_0x162b84[_0x7b7e('0x3e')],qs[_0x7b7e('0x40')](_0x4bfe7f[_0x7b7e('0x39')][_0x7b7e('0x40')]));_0xebcdbc[_0x7b7e('0x3f')]=_0xebcdbc[_0x7b7e('0x3f')][_0x7b7e('0x41')]?_0xebcdbc[_0x7b7e('0x3f')]:_0x162b84['model'];if(!_0x4bfe7f[_0x7b7e('0x39')][_0x7b7e('0x42')](_0x7b7e('0x43'))){_0xebcdbc[_0x7b7e('0x1f')]=qs['limit'](_0x4bfe7f[_0x7b7e('0x39')][_0x7b7e('0x1f')]);_0xebcdbc[_0x7b7e('0x1e')]=qs['offset'](_0x4bfe7f['query'][_0x7b7e('0x1e')]);}_0xebcdbc['order']=qs[_0x7b7e('0x44')](_0x4bfe7f[_0x7b7e('0x39')]['sort']);_0xebcdbc[_0x7b7e('0x45')]=qs[_0x7b7e('0x3c')](_[_0x7b7e('0x46')](_0x4bfe7f[_0x7b7e('0x39')],_0x162b84[_0x7b7e('0x3c')]));if(_0x256908[_0x7b7e('0x3a')]){if(_0x256908[_0x7b7e('0x3b')]){_0x256908[_0x7b7e('0x3b')]=moment(_0x256908[_0x7b7e('0x3b')])['add'](0x1,'day');}else{_0x256908[_0x7b7e('0x3b')]=moment(_0x256908['dateStart'])[_0x7b7e('0x47')](0x1,'day');}_['merge'](_0xebcdbc[_0x7b7e('0x45')],{'createdAt':{'$gte':_0x256908['dateStart'],'$lte':_0x256908[_0x7b7e('0x3b')]}});}if(_0x4bfe7f['query'][_0x7b7e('0x2b')]){_0xebcdbc[_0x7b7e('0x45')]=_[_0x7b7e('0x48')](_0xebcdbc[_0x7b7e('0x45')],{'$or':_['map'](_0xebcdbc[_0x7b7e('0x3f')],function(_0xedf526){var _0x271e4f={};_0x271e4f[_0xedf526]={'$like':'%'+_0x4bfe7f[_0x7b7e('0x39')][_0x7b7e('0x2b')]+'%'};return _0x271e4f;})});}_0xebcdbc=_[_0x7b7e('0x48')]({},_0xebcdbc,_0x4bfe7f['options']);var _0x492df0={'where':_0xebcdbc['where']};return db[_0x7b7e('0x36')][_0x7b7e('0x1d')](_0x492df0)[_0x7b7e('0x26')](function(_0x2cfe70){_0x5f25fe[_0x7b7e('0x1d')]=_0x2cfe70;if(_0x4bfe7f[_0x7b7e('0x39')]['includeAll']){_0xebcdbc[_0x7b7e('0x49')]=[{'all':!![]}];}return db[_0x7b7e('0x36')]['findAll'](_0xebcdbc);})['then'](function(_0x1dcb88){_0x5f25fe[_0x7b7e('0x4a')]=_0x1dcb88;return _0x5f25fe;})[_0x7b7e('0x26')](respondWithFilteredResult(_0x5227a7,_0xebcdbc))[_0x7b7e('0x4b')](handleError(_0x5227a7,null));};exports[_0x7b7e('0x4c')]=function(_0xb46776,_0x590154){var _0x2673eb={'raw':![],'where':{'id':_0xb46776[_0x7b7e('0x4d')]['id']}},_0x4cc7db={};_0x4cc7db[_0x7b7e('0x3e')]=_[_0x7b7e('0x38')](db[_0x7b7e('0x36')]['rawAttributes']);_0x4cc7db[_0x7b7e('0x39')]=_[_0x7b7e('0x38')](_0xb46776[_0x7b7e('0x39')]);_0x4cc7db[_0x7b7e('0x3c')]=_[_0x7b7e('0x3d')](_0x4cc7db['model'],_0x4cc7db[_0x7b7e('0x39')]);_0x2673eb[_0x7b7e('0x3f')]=_[_0x7b7e('0x3d')](_0x4cc7db[_0x7b7e('0x3e')],qs[_0x7b7e('0x40')](_0xb46776['query'][_0x7b7e('0x40')]));_0x2673eb[_0x7b7e('0x3f')]=_0x2673eb[_0x7b7e('0x3f')][_0x7b7e('0x41')]?_0x2673eb[_0x7b7e('0x3f')]:_0x4cc7db[_0x7b7e('0x3e')];if(_0xb46776[_0x7b7e('0x39')]['includeAll']){_0x2673eb[_0x7b7e('0x49')]=[{'all':!![]}];}_0x2673eb=_['merge']({},_0x2673eb,_0xb46776[_0x7b7e('0x4e')]);return db[_0x7b7e('0x36')]['find'](_0x2673eb)[_0x7b7e('0x26')](handleEntityNotFound(_0x590154,null))[_0x7b7e('0x26')](respondWithResult(_0x590154,null))[_0x7b7e('0x4b')](handleError(_0x590154,null));};exports[_0x7b7e('0x30')]=function(_0x412d1b,_0x36ffd4){return db[_0x7b7e('0x36')]['find']({'where':{'id':_0x412d1b[_0x7b7e('0x4d')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x36ffd4,null))[_0x7b7e('0x26')](removeEntity(_0x36ffd4,null))[_0x7b7e('0x4b')](handleError(_0x36ffd4,null));};exports['create']=function(_0x527403,_0x5bdf1d){if(_0x527403[_0x7b7e('0x4f')][_0x7b7e('0x50')]===_0x7b7e('0x51')&&!_['startsWith'](_0x527403['body'][_0x7b7e('0x52')],'_')){_0x527403[_0x7b7e('0x4f')]['exten']='_'[_0x7b7e('0x53')](_0x527403[_0x7b7e('0x4f')][_0x7b7e('0x52')]);}return db['VoiceExtension'][_0x7b7e('0x54')](_0x527403[_0x7b7e('0x4f')],{'raw':![]})['then'](function(_0x25c933){var _0x441c3c=_0x527403[_0x7b7e('0x55')][_0x7b7e('0x27')]({'plain':!![]});if(!_0x441c3c)throw new Error(_0x7b7e('0x56'));if(_0x441c3c[_0x7b7e('0x57')]===_0x7b7e('0x55')){var _0x2d1908=_0x25c933[_0x7b7e('0x27')]({'plain':!![]});var _0x5509ad=[{'name':_0x7b7e('0x28'),'value':_0x7b7e('0x58')},{'name':'OutboundRoutes','value':_0x7b7e('0x51')},{'name':_0x7b7e('0x29'),'value':_0x7b7e('0x2a')}];var _0x59f2df=_[_0x7b7e('0x2e')](_0x5509ad,['value',_0x2d1908[_0x7b7e('0x50')]])[_0x7b7e('0x2f')];return db['UserProfileSection'][_0x7b7e('0x2e')]({'where':{'name':_0x59f2df,'userProfileId':_0x441c3c[_0x7b7e('0x59')]},'raw':!![]})['then'](function(_0x2dcb35){if(_0x2dcb35&&_0x2dcb35[_0x7b7e('0x5a')]===0x0){return db[_0x7b7e('0x5b')][_0x7b7e('0x54')]({'name':_0x2d1908['name'],'resourceId':_0x2d1908['id'],'type':_0x2dcb35[_0x7b7e('0x2f')],'sectionId':_0x2dcb35['id']},{})[_0x7b7e('0x26')](function(){return _0x25c933;});}else{return _0x25c933;}})[_0x7b7e('0x4b')](function(_0x7f705c){logger[_0x7b7e('0x32')](_0x7b7e('0x5c'),_0x7f705c);throw _0x7f705c;});}return _0x25c933;})[_0x7b7e('0x26')](respondWithResult(_0x5bdf1d,0xc9))[_0x7b7e('0x4b')](handleError(_0x5bdf1d,null));};exports[_0x7b7e('0x25')]=function(_0x13c676,_0x5b9010){if(_0x13c676[_0x7b7e('0x4f')]['id']){delete _0x13c676['body']['id'];}return db['VoiceExtension'][_0x7b7e('0x2e')]({'where':{'id':_0x13c676[_0x7b7e('0x4d')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x5b9010,null))[_0x7b7e('0x26')](function(_0x5cd4ae){if(_0x5cd4ae){return db[_0x7b7e('0x36')][_0x7b7e('0x25')](_[_0x7b7e('0x46')](_0x13c676[_0x7b7e('0x4f')],[_0x7b7e('0x52'),_0x7b7e('0x5d'),'description',_0x7b7e('0x5e'),'cutdigits']),{'where':{'context':_0x5cd4ae['context'],'exten':_0x5cd4ae[_0x7b7e('0x52')]},'individualHooks':!![]})['then'](function(_0x47aa4c){return _0x47aa4c;});}return null;})['then'](respondWithStatusCode(_0x5b9010,null))[_0x7b7e('0x4b')](handleError(_0x5b9010,null));};exports[_0x7b7e('0x5f')]=function(_0x4c46e0,_0x2c167d,_0x2da71e){return db['VoiceExtension'][_0x7b7e('0x60')]({'where':{'id':_0x4c46e0[_0x7b7e('0x4d')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x2c167d,null))[_0x7b7e('0x26')](function(_0x36ea09){if(_0x36ea09){return db[_0x7b7e('0x61')][_0x7b7e('0x62')](function(_0x3f8f8f){return db[_0x7b7e('0x36')][_0x7b7e('0x30')]({'where':{'VoiceExtensionId':_0x4c46e0['params']['id']},'transaction':_0x3f8f8f})['then'](function(_0x34e7df){var _0x46ac1f=_[_0x7b7e('0x63')](_0x4c46e0[_0x7b7e('0x4f')],function(_0xea39fa){_0xea39fa[_0x7b7e('0x64')]=_0x4c46e0[_0x7b7e('0x4d')]['id'];return _0xea39fa;});return db['VoiceExtension'][_0x7b7e('0x65')](_0x46ac1f,{'transaction':_0x3f8f8f});});})[_0x7b7e('0x26')](function(){return db['VoiceExtension'][_0x7b7e('0x66')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4c46e0[_0x7b7e('0x4d')]['id']},'order':_0x7b7e('0x67')});});}})[_0x7b7e('0x26')](respondWithResult(_0x2c167d,null))[_0x7b7e('0x4b')](handleError(_0x2c167d,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index c560b49..9f01e13 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 _0xb71e=['hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0xb71e,0x110));var _0xeb71=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xb71e[_0x11c573];return _0x6b72de;};'use strict';var EventEmitter=require(_0xeb71('0x0'));var VoiceExtension=require(_0xeb71('0x1'))['db'][_0xeb71('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xeb71('0x3')](0x0);var events={'afterCreate':_0xeb71('0x4'),'afterUpdate':_0xeb71('0x5'),'afterDestroy':_0xeb71('0x6')};function emitEvent(_0x57a459){return function(_0x387333,_0x49b57d,_0x5daf18){VoiceExtensionEvents[_0xeb71('0x7')](_0x57a459+':'+_0x387333['id'],_0x387333);VoiceExtensionEvents[_0xeb71('0x7')](_0x57a459,_0x387333);_0x5daf18(null);};}for(var e in events){if(events[_0xeb71('0x8')](e)){var event=events[e];VoiceExtension[_0xeb71('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x4e9b=['setMaxListeners','remove','emit','hook','exports','events','VoiceExtension'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x4e9b,0xc2));var _0xb4e9=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x4e9b[_0x4c445a];return _0x2f611c;};'use strict';var EventEmitter=require(_0xb4e9('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xb4e9('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb4e9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb4e9('0x3')};function emitEvent(_0x4543c7){return function(_0x174dd6,_0x5da51f,_0x4e7406){VoiceExtensionEvents[_0xb4e9('0x4')](_0x4543c7+':'+_0x174dd6['id'],_0x174dd6);VoiceExtensionEvents[_0xb4e9('0x4')](_0x4543c7,_0x174dd6);_0x4e7406(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb4e9('0x5')](e,emitEvent(event));}}module[_0xb4e9('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 f594405..6ba09bb 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 _0x7bad=['moment','bluebird','request-promise','exports','define','util','../../config/logger','api'];(function(_0x5efccc,_0x5c5dcf){var _0x1ccb0d=function(_0x390231){while(--_0x390231){_0x5efccc['push'](_0x5efccc['shift']());}};_0x1ccb0d(++_0x5c5dcf);}(_0x7bad,0x11d));var _0xd7ba=function(_0x5d184b,_0x1b04c5){_0x5d184b=_0x5d184b-0x0;var _0x5cee64=_0x7bad[_0x5d184b];return _0x5cee64;};'use strict';var _=require('lodash');var util=require(_0xd7ba('0x0'));var logger=require(_0xd7ba('0x1'))(_0xd7ba('0x2'));var moment=require(_0xd7ba('0x3'));var BPromise=require(_0xd7ba('0x4'));var rp=require(_0xd7ba('0x5'));var attributes=require('./voiceExtension.attributes');module[_0xd7ba('0x6')]=function(_0x3aec63,_0x3f1d37){return _0x3aec63[_0xd7ba('0x7')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x786f=['./voiceExtension.attributes','exports','define','VoiceExtension','lodash','util','../../config/logger','bluebird'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0x786f,0x11c));var _0xf786=function(_0x12c263,_0x2d9bce){_0x12c263=_0x12c263-0x0;var _0x192cd7=_0x786f[_0x12c263];return _0x192cd7;};'use strict';var _=require(_0xf786('0x0'));var util=require(_0xf786('0x1'));var logger=require(_0xf786('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf786('0x3'));var rp=require('request-promise');var attributes=require(_0xf786('0x4'));module[_0xf786('0x5')]=function(_0x480898,_0x4c9e76){return _0x480898[_0xf786('0x6')](_0xf786('0x7'),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 340c48b..70a830a 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 _0x750a=['map','model','attributes','GetVoiceExtension','stringify','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VoiceExtension','options','where','limit','include'];(function(_0xd5b921,_0x2a9c0f){var _0x1cfe8c=function(_0x337ede){while(--_0x337ede){_0xd5b921['push'](_0xd5b921['shift']());}};_0x1cfe8c(++_0x2a9c0f);}(_0x750a,0x140));var _0xa750=function(_0x4611b9,_0x416038){_0x4611b9=_0x4611b9-0x0;var _0x1c902e=_0x750a[_0x4611b9];return _0x1c902e;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});config[_0xa750('0xb')]=_[_0xa750('0xc')](config[_0xa750('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa750('0xb')]));require('./voiceExtension.socket')[_0xa750('0xd')](socket);function respondWithRpcPromise(_0x1760f5,_0x51f594,_0x264284){return new BPromise(function(_0x2c2ea4,_0x5870f0){return client['request'](_0x1760f5,_0x264284)[_0xa750('0xe')](function(_0x4b19a1){logger[_0xa750('0xf')](_0xa750('0x10'),_0x51f594,'request\x20sent');logger[_0xa750('0x11')](_0xa750('0x12'),_0x51f594,_0xa750('0x13'),JSON['stringify'](_0x4b19a1));if(_0x4b19a1[_0xa750('0x14')]){if(_0x4b19a1[_0xa750('0x14')][_0xa750('0x15')]===0x1f4){logger[_0xa750('0x14')](_0xa750('0x10'),_0x51f594,_0x4b19a1[_0xa750('0x14')]['message']);return _0x5870f0(_0x4b19a1[_0xa750('0x14')][_0xa750('0x16')]);}logger[_0xa750('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x51f594,_0x4b19a1[_0xa750('0x14')][_0xa750('0x16')]);return _0x2c2ea4(_0x4b19a1['error']['message']);}else{logger[_0xa750('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x51f594,_0xa750('0x13'));_0x2c2ea4(_0x4b19a1[_0xa750('0x17')]['message']);}})[_0xa750('0x18')](function(_0x500a84){logger['error'](_0xa750('0x10'),_0x51f594,_0x500a84);_0x5870f0(_0x500a84);});});}exports['GetVoiceExtension']=function(_0x3fa031){var _0x4f170f=this;return new Promise(function(_0x174a8c,_0x4a007d){return db[_0xa750('0x19')]['findAll']({'raw':_0x3fa031[_0xa750('0x1a')]?_0x3fa031['options']['raw']===undefined?!![]:![]:!![],'where':_0x3fa031[_0xa750('0x1a')]?_0x3fa031['options'][_0xa750('0x1b')]||null:null,'attributes':_0x3fa031['options']?_0x3fa031['options']['attributes']||null:null,'limit':_0x3fa031['options']?_0x3fa031[_0xa750('0x1a')][_0xa750('0x1c')]||null:null,'include':_0x3fa031[_0xa750('0x1a')]?_0x3fa031[_0xa750('0x1a')][_0xa750('0x1d')]?_[_0xa750('0x1e')](_0x3fa031[_0xa750('0x1a')][_0xa750('0x1d')],function(_0x3d52b3){return{'model':db[_0x3d52b3[_0xa750('0x1f')]],'as':_0x3d52b3['as'],'attributes':_0x3d52b3[_0xa750('0x20')],'include':_0x3d52b3[_0xa750('0x1d')]?_[_0xa750('0x1e')](_0x3d52b3[_0xa750('0x1d')],function(_0x310e2d){return{'model':db[_0x310e2d['model']],'as':_0x310e2d['as'],'attributes':_0x310e2d[_0xa750('0x20')],'include':_0x310e2d[_0xa750('0x1d')]?_[_0xa750('0x1e')](_0x310e2d['include'],function(_0x35ab53){return{'model':db[_0x35ab53[_0xa750('0x1f')]],'as':_0x35ab53['as'],'attributes':_0x35ab53[_0xa750('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa750('0xe')](function(_0x579f1c){logger[_0xa750('0xf')](_0xa750('0x21'),_0x3fa031);logger[_0xa750('0x11')](_0xa750('0x21'),_0x3fa031,JSON[_0xa750('0x22')](_0x579f1c));_0x174a8c(_0x579f1c);})['catch'](function(_0x46cc11){logger['error'](_0xa750('0x21'),_0x46cc11[_0xa750('0x16')],_0x3fa031);_0x4a007d(_0x4f170f['error'](0x1f4,_0x46cc11[_0xa750('0x16')]));});});}; \ No newline at end of file +var _0xb7e7=['VoiceExtension','findAll','options','raw','where','attributes','include','map','model','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceExtension'];(function(_0x18bbc8,_0x1e001c){var _0xaeab32=function(_0x18f133){while(--_0x18f133){_0x18bbc8['push'](_0x18bbc8['shift']());}};_0xaeab32(++_0x1e001c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xb7e7[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});config[_0x7b7e('0x8')]=_[_0x7b7e('0x9')](config['redis'],{'host':_0x7b7e('0xa'),'port':0x18eb});var socket=require(_0x7b7e('0xb'))(new Redis(config[_0x7b7e('0x8')]));require(_0x7b7e('0xc'))[_0x7b7e('0xd')](socket);function respondWithRpcPromise(_0x26bb8d,_0x242e70,_0x52de3b){return new BPromise(function(_0x299519,_0x1eef0a){return client[_0x7b7e('0xe')](_0x26bb8d,_0x52de3b)[_0x7b7e('0xf')](function(_0xd581fb){logger[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x242e70,_0x7b7e('0x12'));logger[_0x7b7e('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x242e70,_0x7b7e('0x12'),JSON[_0x7b7e('0x14')](_0xd581fb));if(_0xd581fb['error']){if(_0xd581fb[_0x7b7e('0x15')]['code']===0x1f4){logger['error'](_0x7b7e('0x11'),_0x242e70,_0xd581fb[_0x7b7e('0x15')][_0x7b7e('0x16')]);return _0x1eef0a(_0xd581fb[_0x7b7e('0x15')][_0x7b7e('0x16')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x242e70,_0xd581fb[_0x7b7e('0x15')][_0x7b7e('0x16')]);return _0x299519(_0xd581fb[_0x7b7e('0x15')][_0x7b7e('0x16')]);}else{logger[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x242e70,_0x7b7e('0x12'));_0x299519(_0xd581fb[_0x7b7e('0x17')][_0x7b7e('0x16')]);}})[_0x7b7e('0x18')](function(_0x12e8e9){logger[_0x7b7e('0x15')](_0x7b7e('0x11'),_0x242e70,_0x12e8e9);_0x1eef0a(_0x12e8e9);});});}exports[_0x7b7e('0x19')]=function(_0x9776c3){var _0x864287=this;return new Promise(function(_0x3a7b8b,_0x49eddb){return db[_0x7b7e('0x1a')][_0x7b7e('0x1b')]({'raw':_0x9776c3[_0x7b7e('0x1c')]?_0x9776c3['options'][_0x7b7e('0x1d')]===undefined?!![]:![]:!![],'where':_0x9776c3[_0x7b7e('0x1c')]?_0x9776c3[_0x7b7e('0x1c')][_0x7b7e('0x1e')]||null:null,'attributes':_0x9776c3[_0x7b7e('0x1c')]?_0x9776c3[_0x7b7e('0x1c')][_0x7b7e('0x1f')]||null:null,'limit':_0x9776c3[_0x7b7e('0x1c')]?_0x9776c3['options']['limit']||null:null,'include':_0x9776c3['options']?_0x9776c3[_0x7b7e('0x1c')][_0x7b7e('0x20')]?_[_0x7b7e('0x21')](_0x9776c3['options']['include'],function(_0x5dadbb){return{'model':db[_0x5dadbb[_0x7b7e('0x22')]],'as':_0x5dadbb['as'],'attributes':_0x5dadbb[_0x7b7e('0x1f')],'include':_0x5dadbb[_0x7b7e('0x20')]?_[_0x7b7e('0x21')](_0x5dadbb[_0x7b7e('0x20')],function(_0x48fad1){return{'model':db[_0x48fad1[_0x7b7e('0x22')]],'as':_0x48fad1['as'],'attributes':_0x48fad1[_0x7b7e('0x1f')],'include':_0x48fad1['include']?_['map'](_0x48fad1['include'],function(_0x12ef0b){return{'model':db[_0x12ef0b[_0x7b7e('0x22')]],'as':_0x12ef0b['as'],'attributes':_0x12ef0b['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0xf')](function(_0x51d4b5){logger[_0x7b7e('0x10')](_0x7b7e('0x19'),_0x9776c3);logger[_0x7b7e('0x13')]('GetVoiceExtension',_0x9776c3,JSON[_0x7b7e('0x14')](_0x51d4b5));_0x3a7b8b(_0x51d4b5);})[_0x7b7e('0x18')](function(_0x35602a){logger[_0x7b7e('0x15')](_0x7b7e('0x19'),_0x35602a['message'],_0x9776c3);_0x49eddb(_0x864287[_0x7b7e('0x15')](0x1f4,_0x35602a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0f388ad..acaac6b 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 _0x4d66=['save','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x4d66,0xbc));var _0x64d6=function(_0x2dd195,_0x4c1c1b){_0x2dd195=_0x2dd195-0x0;var _0x3358c8=_0x4d66[_0x2dd195];return _0x3358c8;};'use strict';var VoiceExtensionEvents=require(_0x64d6('0x0'));var events=[_0x64d6('0x1'),'remove','update'];function createListener(_0x42d81c,_0xcf0051){return function(_0x460810){_0xcf0051[_0x64d6('0x2')](_0x42d81c,_0x460810);};}function removeListener(_0x1355b9,_0x2fff25){return function(){VoiceExtensionEvents[_0x64d6('0x3')](_0x1355b9,_0x2fff25);};}exports[_0x64d6('0x4')]=function(_0x4cfb3e){for(var _0x379fe0=0x0,_0x2375da=events[_0x64d6('0x5')];_0x379fe0<_0x2375da;_0x379fe0++){var _0x13cd6f=events[_0x379fe0];var _0x3f0c3a=createListener(_0x64d6('0x6')+_0x13cd6f,_0x4cfb3e);VoiceExtensionEvents['on'](_0x13cd6f,_0x3f0c3a);}}; \ No newline at end of file +var _0x323b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','update','emit'];(function(_0x516537,_0x3e4da0){var _0x2bba10=function(_0x9ec779){while(--_0x9ec779){_0x516537['push'](_0x516537['shift']());}};_0x2bba10(++_0x3e4da0);}(_0x323b,0x194));var _0xb323=function(_0x155cb9,_0x4aec0d){_0x155cb9=_0x155cb9-0x0;var _0x433bf0=_0x323b[_0x155cb9];return _0x433bf0;};'use strict';var VoiceExtensionEvents=require(_0xb323('0x0'));var events=[_0xb323('0x1'),'remove',_0xb323('0x2')];function createListener(_0x144a99,_0x55e314){return function(_0x47c1ef){_0x55e314[_0xb323('0x3')](_0x144a99,_0x47c1ef);};}function removeListener(_0x572642,_0x598cd1){return function(){VoiceExtensionEvents[_0xb323('0x4')](_0x572642,_0x598cd1);};}exports[_0xb323('0x5')]=function(_0x207321){for(var _0x19b902=0x0,_0x225ad9=events[_0xb323('0x6')];_0x19b902<_0x225ad9;_0x19b902++){var _0x2f4270=events[_0x19b902];var _0x11e028=createListener(_0xb323('0x7')+_0x2f4270,_0x207321);VoiceExtensionEvents['on'](_0x2f4270,_0x11e028);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 50816b7..bf94263 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 _0xd7a3=['index','get','/:id/messages','post','create','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated'];(function(_0x4cf8d5,_0x2220f8){var _0x36b751=function(_0x245403){while(--_0x245403){_0x4cf8d5['push'](_0x4cf8d5['shift']());}};_0x36b751(++_0x2220f8);}(_0xd7a3,0xbd));var _0x3d7a=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xd7a3[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require('multer');var util=require(_0x3d7a('0x0'));var path=require(_0x3d7a('0x1'));var timeout=require(_0x3d7a('0x2'));var express=require(_0x3d7a('0x3'));var router=express[_0x3d7a('0x4')]();var auth=require(_0x3d7a('0x5'));var interaction=require(_0x3d7a('0x6'));var config=require('../../config/environment');var controller=require(_0x3d7a('0x7'));router['get']('/',auth[_0x3d7a('0x8')](),controller[_0x3d7a('0x9')]);router[_0x3d7a('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x3d7a('0xb'),auth[_0x3d7a('0x8')](),controller['getMessages']);router[_0x3d7a('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d7a('0xd')]);router['put'](_0x3d7a('0xe'),auth[_0x3d7a('0x8')](),controller[_0x3d7a('0xf')]);router['delete'](_0x3d7a('0xe'),auth[_0x3d7a('0x8')](),controller[_0x3d7a('0x10')]);module[_0x3d7a('0x11')]=router; \ No newline at end of file +var _0x3bcd=['util','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','update','delete','destroy','exports','multer'];(function(_0x5a852b,_0x1694c2){var _0xd74d84=function(_0x170a6d){while(--_0x170a6d){_0x5a852b['push'](_0x5a852b['shift']());}};_0xd74d84(++_0x1694c2);}(_0x3bcd,0x10d));var _0xd3bc=function(_0x51356c,_0x501f0c){_0x51356c=_0x51356c-0x0;var _0x2ebe29=_0x3bcd[_0x51356c];return _0x2ebe29;};'use strict';var multer=require(_0xd3bc('0x0'));var util=require(_0xd3bc('0x1'));var path=require('path');var timeout=require(_0xd3bc('0x2'));var express=require(_0xd3bc('0x3'));var router=express[_0xd3bc('0x4')]();var auth=require(_0xd3bc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0xd3bc('0x6')]('/',auth[_0xd3bc('0x7')](),controller[_0xd3bc('0x8')]);router['get'](_0xd3bc('0x9'),auth[_0xd3bc('0x7')](),controller[_0xd3bc('0xa')]);router['get'](_0xd3bc('0xb'),auth[_0xd3bc('0x7')](),controller[_0xd3bc('0xc')]);router['post']('/',auth[_0xd3bc('0x7')](),controller[_0xd3bc('0xd')]);router['put'](_0xd3bc('0x9'),auth['isAuthenticated'](),controller[_0xd3bc('0xe')]);router[_0xd3bc('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd3bc('0x10')]);module[_0xd3bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 2b6aa6e..34a3db2 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 _0xe2e2=['STRING','contest_mailbox','setDataValue','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','mailbox','sequelize','exports'];(function(_0x1539bf,_0x28aace){var _0x2607eb=function(_0x137f3e){while(--_0x137f3e){_0x1539bf['push'](_0x1539bf['shift']());}};_0x2607eb(++_0x28aace);}(_0xe2e2,0x1c0));var _0x2e2e=function(_0x308fca,_0x31fbd6){_0x308fca=_0x308fca-0x0;var _0x4364b2=_0xe2e2[_0x308fca];return _0x4364b2;};'use strict';var Sequelize=require(_0x2e2e('0x0'));module[_0x2e2e('0x1')]={'customer_id':{'type':Sequelize[_0x2e2e('0x2')]},'context':{'type':Sequelize[_0x2e2e('0x2')],'defaultValue':'from-voicemail','unique':_0x2e2e('0x3')},'mailbox':{'type':Sequelize[_0x2e2e('0x2')],'defaultValue':'','allowNull':![],'unique':_0x2e2e('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x2e2e('0x2')]},'email':{'type':Sequelize[_0x2e2e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x24bc3b){this[_0x2e2e('0x4')]('email',typeof _0x24bc3b==='string'&&_0x24bc3b[_0x2e2e('0x5')]()?_0x24bc3b[_0x2e2e('0x5')]():null);}},'pager':{'type':Sequelize[_0x2e2e('0x2')]},'tz':{'type':Sequelize[_0x2e2e('0x2')],'defaultValue':_0x2e2e('0x6')},'attach':{'type':Sequelize['ENUM'](_0x2e2e('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x2e2e('0x7'),'no'),'defaultValue':_0x2e2e('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2e2e('0x2')]},'callback':{'type':Sequelize[_0x2e2e('0x2')]},'review':{'type':Sequelize[_0x2e2e('0x8')](_0x2e2e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2e2e('0x8')](_0x2e2e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2e2e('0x8')](_0x2e2e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x2e2e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2e2e('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2e2e('0x8')](_0x2e2e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x2e2e('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2e2e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x2e2e('0x7'),'no'),'defaultValue':_0x2e2e('0x7'),'allowNull':![]},'stamp':{'type':_0x2e2e('0xa')},'emailsubject':{'type':Sequelize[_0x2e2e('0x2')]},'emailbody':{'type':Sequelize[_0x2e2e('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2e2e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2e2e('0xc')],'get':function(){return this['getDataValue']('fullname')+_0x2e2e('0xd')+this['getDataValue'](_0x2e2e('0xe'));}}}; \ No newline at end of file +var _0x05ed=['central','ENUM','yes','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','email','trim'];(function(_0x2faabf,_0x55fc9d){var _0x37cc7b=function(_0x2d927d){while(--_0x2d927d){_0x2faabf['push'](_0x2faabf['shift']());}};_0x37cc7b(++_0x55fc9d);}(_0x05ed,0x1cb));var _0xd05e=function(_0x178e71,_0x5c6c7d){_0x178e71=_0x178e71-0x0;var _0x3eec6c=_0x05ed[_0x178e71];return _0x3eec6c;};'use strict';var Sequelize=require(_0xd05e('0x0'));module[_0xd05e('0x1')]={'customer_id':{'type':Sequelize[_0xd05e('0x2')]},'context':{'type':Sequelize[_0xd05e('0x2')],'defaultValue':'from-voicemail','unique':_0xd05e('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xd05e('0x2')]},'fullname':{'type':Sequelize[_0xd05e('0x2')]},'email':{'type':Sequelize[_0xd05e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x44876a){this['setDataValue'](_0xd05e('0x4'),typeof _0x44876a==='string'&&_0x44876a[_0xd05e('0x5')]()?_0x44876a[_0xd05e('0x5')]():null);}},'pager':{'type':Sequelize[_0xd05e('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xd05e('0x6')},'attach':{'type':Sequelize[_0xd05e('0x7')](_0xd05e('0x8'),'no'),'defaultValue':_0xd05e('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xd05e('0x7')](_0xd05e('0x8'),'no'),'defaultValue':_0xd05e('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd05e('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xd05e('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd05e('0x7')](_0xd05e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd05e('0x7')](_0xd05e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd05e('0x7')](_0xd05e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xd05e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xd05e('0x8'),'no'),'defaultValue':_0xd05e('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xd05e('0x7')](_0xd05e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd05e('0x7')](_0xd05e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd05e('0x7')](_0xd05e('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xd05e('0x9')},'emailsubject':{'type':Sequelize[_0xd05e('0x2')]},'emailbody':{'type':Sequelize[_0xd05e('0x2')]},'maxsecs':{'type':Sequelize[_0xd05e('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd05e('0xb')](_0xd05e('0xc'))+_0xd05e('0xd')+this[_0xd05e('0xb')](_0xd05e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index da4f35d..29d6a03 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 _0xb10b=['send','index','VoiceMail','rawAttributes','model','dateStart','dateEnd','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','add','day','merge','map','filter','options','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','nolimit','pick','mailbox','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','Voicemails','UserProfileResource','destroy','error','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10b,0x12a));var _0xbb10=function(_0x53c2b9,_0x1dbc82){_0x53c2b9=_0x53c2b9-0x0;var _0x2c677b=_0xb10b[_0x53c2b9];return _0x2c677b;};'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'];function respondWithStatusCode(_0x5e136d,_0x408248){_0x408248=_0x408248||0xcc;return function(_0x5be7e0){if(_0x5be7e0){return _0x5e136d[_0xbb10('0x17')](_0x408248);}return _0x5e136d[_0xbb10('0x18')](_0x408248)[_0xbb10('0x19')]();};}function respondWithResult(_0x193a27,_0x442548){_0x442548=_0x442548||0xc8;return function(_0x147230){if(_0x147230){return _0x193a27['status'](_0x442548)[_0xbb10('0x1a')](_0x147230);}};}function respondWithFilteredResult(_0x42d7e4,_0x45b9d6){return function(_0x17fd46){if(_0x17fd46){var _0x3df17b=_0x17fd46[_0xbb10('0x1b')],_0x2f2ebf=_0x45b9d6[_0xbb10('0x1c')],_0x24a57b=_0x45b9d6['offset']+_0x45b9d6[_0xbb10('0x1d')],_0x36b5e8;if(_0x24a57b>=_0x3df17b){_0x24a57b=_0x3df17b;_0x36b5e8=0xc8;}else{_0x36b5e8=0xce;}_0x42d7e4[_0xbb10('0x18')](_0x36b5e8);return _0x42d7e4[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x2f2ebf+'-'+_0x24a57b+'/'+_0x3df17b)[_0xbb10('0x1a')](_0x17fd46);}return null;};}function patchUpdates(_0x1682a4){return function(_0x575cca){try{jsonpatch[_0xbb10('0x20')](_0x575cca,_0x1682a4,!![]);}catch(_0xbf2906){return BPromise[_0xbb10('0x21')](_0xbf2906);}return _0x575cca['save']();};}function saveUpdates(_0x5ff0cf,_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x22')](_0x5ff0cf)[_0xbb10('0x23')](function(_0x44e563){return _0x44e563;});}return null;};}function removeEntity(_0x4deb49,_0x12f888){return function(_0x12ef77){if(_0x12ef77){return _0x12ef77['destroy']()['then'](function(){var _0x8e2b97=_0x12ef77[_0xbb10('0x24')]({'plain':!![]});var _0x2e911d=_0xbb10('0x25');return db[_0xbb10('0x26')][_0xbb10('0x27')]({'where':{'type':_0x2e911d,'resourceId':_0x8e2b97['id']}})[_0xbb10('0x23')](function(){return _0x12ef77;});})[_0xbb10('0x23')](function(){_0x4deb49[_0xbb10('0x18')](0xcc)[_0xbb10('0x19')]();});}};}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('0x28')](_0x3c5ae7['stack']);if(_0x3c5ae7[_0xbb10('0x29')]){delete _0x3c5ae7[_0xbb10('0x29')];}_0x4fb5e0[_0xbb10('0x18')](_0xc93a04)[_0xbb10('0x2a')](_0x3c5ae7);};}exports[_0xbb10('0x2b')]=function(_0x20d946,_0x2a0e8b){var _0x4aabb9={},_0x3796c7={},_0x21ac54={'count':0x0,'rows':[]};var _0xfc3595=db[_0xbb10('0x2c')][_0xbb10('0x2d')];_0x3796c7[_0xbb10('0x2e')]=_['keys'](_0xfc3595);var _0x221624={'dateStart':_0x20d946['query'][_0xbb10('0x2f')],'dateEnd':_0x20d946['query'][_0xbb10('0x30')]};delete _0x20d946[_0xbb10('0x31')][_0xbb10('0x2f')];delete _0x20d946['query']['dateEnd'];_0x3796c7[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x20d946['query']);_0x3796c7[_0xbb10('0x33')]=_[_0xbb10('0x34')](_0x3796c7[_0xbb10('0x2e')],_0x3796c7[_0xbb10('0x31')]);_0x4aabb9[_0xbb10('0x35')]=_[_0xbb10('0x34')](_0x3796c7[_0xbb10('0x2e')],qs['fields'](_0x20d946[_0xbb10('0x31')][_0xbb10('0x36')]));_0x4aabb9[_0xbb10('0x35')]=_0x4aabb9[_0xbb10('0x35')][_0xbb10('0x37')]?_0x4aabb9[_0xbb10('0x35')]:_0x3796c7[_0xbb10('0x2e')];if(!_0x20d946[_0xbb10('0x31')][_0xbb10('0x38')]('nolimit')){_0x4aabb9[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x20d946[_0xbb10('0x31')][_0xbb10('0x1d')]);_0x4aabb9['offset']=qs[_0xbb10('0x1c')](_0x20d946['query']['offset']);}_0x4aabb9[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_0x20d946[_0xbb10('0x31')][_0xbb10('0x3a')]);_0x4aabb9[_0xbb10('0x3b')]=qs[_0xbb10('0x33')](_['pick'](_0x20d946[_0xbb10('0x31')],_0x3796c7[_0xbb10('0x33')]));if(_0x221624['dateStart']){if(_0x221624['dateEnd']){_0x221624['dateEnd']=moment(_0x221624[_0xbb10('0x30')])[_0xbb10('0x3c')](0x1,_0xbb10('0x3d'));}else{_0x221624['dateEnd']=moment(_0x221624[_0xbb10('0x2f')])[_0xbb10('0x3c')](0x1,_0xbb10('0x3d'));}_['merge'](_0x4aabb9[_0xbb10('0x3b')],{'createdAt':{'$gte':_0x221624[_0xbb10('0x2f')],'$lte':_0x221624[_0xbb10('0x30')]}});}if(_0x20d946[_0xbb10('0x31')]['filter']){_0x4aabb9[_0xbb10('0x3b')]=_[_0xbb10('0x3e')](_0x4aabb9['where'],{'$or':_[_0xbb10('0x3f')](_0x4aabb9[_0xbb10('0x35')],function(_0x44d6ae){var _0x3a9934={};_0x3a9934[_0x44d6ae]={'$like':'%'+_0x20d946[_0xbb10('0x31')][_0xbb10('0x40')]+'%'};return _0x3a9934;})});}_0x4aabb9=_['merge']({},_0x4aabb9,_0x20d946[_0xbb10('0x41')]);var _0x1c7fae={'where':_0x4aabb9[_0xbb10('0x3b')]};return db[_0xbb10('0x2c')]['count'](_0x1c7fae)[_0xbb10('0x23')](function(_0x331751){_0x21ac54[_0xbb10('0x1b')]=_0x331751;if(_0x20d946[_0xbb10('0x31')]['includeAll']){_0x4aabb9[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x2c')]['findAll'](_0x4aabb9);})['then'](function(_0x38d78f){_0x21ac54['rows']=_0x38d78f;return _0x21ac54;})[_0xbb10('0x23')](respondWithFilteredResult(_0x2a0e8b,_0x4aabb9))[_0xbb10('0x43')](handleError(_0x2a0e8b,null));};exports['show']=function(_0x366608,_0x1d82bf){var _0x474e99={'raw':!![],'where':{'id':_0x366608[_0xbb10('0x44')]['id']}},_0x5cf4f8={};_0x5cf4f8[_0xbb10('0x2e')]=_[_0xbb10('0x32')](db[_0xbb10('0x2c')][_0xbb10('0x2d')]);_0x5cf4f8[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x366608[_0xbb10('0x31')]);_0x5cf4f8[_0xbb10('0x33')]=_[_0xbb10('0x34')](_0x5cf4f8[_0xbb10('0x2e')],_0x5cf4f8[_0xbb10('0x31')]);_0x474e99['attributes']=_[_0xbb10('0x34')](_0x5cf4f8[_0xbb10('0x2e')],qs['fields'](_0x366608[_0xbb10('0x31')][_0xbb10('0x36')]));_0x474e99[_0xbb10('0x35')]=_0x474e99[_0xbb10('0x35')][_0xbb10('0x37')]?_0x474e99[_0xbb10('0x35')]:_0x5cf4f8[_0xbb10('0x2e')];if(_0x366608['query']['includeAll']){_0x474e99[_0xbb10('0x42')]=[{'all':!![]}];}_0x474e99=_[_0xbb10('0x3e')]({},_0x474e99,_0x366608[_0xbb10('0x41')]);return db['VoiceMail']['find'](_0x474e99)[_0xbb10('0x23')](handleEntityNotFound(_0x1d82bf,null))[_0xbb10('0x23')](respondWithResult(_0x1d82bf,null))[_0xbb10('0x43')](handleError(_0x1d82bf,null));};exports[_0xbb10('0x45')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x2c')][_0xbb10('0x45')](_0x10159b[_0xbb10('0x46')],{})[_0xbb10('0x23')](function(_0x550111){var _0x5eafac=_0x10159b[_0xbb10('0x47')][_0xbb10('0x24')]({'plain':!![]});if(!_0x5eafac)throw new Error(_0xbb10('0x48'));if(_0x5eafac[_0xbb10('0x49')]===_0xbb10('0x47')){var _0x440f9e=_0x550111[_0xbb10('0x24')]({'plain':!![]});var _0x445870=_0xbb10('0x25');return db[_0xbb10('0x4a')][_0xbb10('0x4b')]({'where':{'name':_0x445870,'userProfileId':_0x5eafac[_0xbb10('0x4c')]},'raw':!![]})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x2e6fd9&&_0x2e6fd9[_0xbb10('0x4d')]===0x0){return db['UserProfileResource'][_0xbb10('0x45')]({'name':_0x440f9e['name'],'resourceId':_0x440f9e['id'],'type':_0x2e6fd9[_0xbb10('0x29')],'sectionId':_0x2e6fd9['id']},{})[_0xbb10('0x23')](function(){return _0x550111;});}else{return _0x550111;}})[_0xbb10('0x43')](function(_0x3f27ce){logger[_0xbb10('0x28')](_0xbb10('0x4e'),_0x3f27ce);throw _0x3f27ce;});}return _0x550111;})[_0xbb10('0x23')](respondWithResult(_0x22b315,0xc9))[_0xbb10('0x43')](handleError(_0x22b315,null));};exports[_0xbb10('0x22')]=function(_0x3d71e,_0x44a056){if(_0x3d71e[_0xbb10('0x46')]['id']){delete _0x3d71e[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x4b')]({'where':{'id':_0x3d71e['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x44a056,null))[_0xbb10('0x23')](saveUpdates(_0x3d71e[_0xbb10('0x46')],null))[_0xbb10('0x23')](respondWithResult(_0x44a056,null))[_0xbb10('0x43')](handleError(_0x44a056,null));};exports[_0xbb10('0x27')]=function(_0x4bedd0,_0x120bda){return db[_0xbb10('0x2c')][_0xbb10('0x4b')]({'where':{'id':_0x4bedd0[_0xbb10('0x44')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x120bda,null))[_0xbb10('0x23')](removeEntity(_0x120bda,null))[_0xbb10('0x43')](handleError(_0x120bda,null));};exports[_0xbb10('0x4f')]=function(_0x205e01,_0x40c4fb,_0x2eb05a){return db[_0xbb10('0x2c')][_0xbb10('0x50')]({'where':{'id':_0x205e01['params']['id']}})['then'](handleEntityNotFound(_0x40c4fb,null))[_0xbb10('0x23')](function(_0x3e6338){var _0x3d0cb7;var _0x8b0a7d={},_0x5573bb={};_0x5573bb['model']=_[_0xbb10('0x32')](db[_0xbb10('0x51')][_0xbb10('0x2d')]);_0x5573bb[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x205e01[_0xbb10('0x31')]);_0x5573bb[_0xbb10('0x33')]=_['intersection'](_0x5573bb[_0xbb10('0x2e')],_0x5573bb[_0xbb10('0x31')]);_0x8b0a7d['attributes']=_['intersection'](_0x5573bb['model'],qs[_0xbb10('0x36')](_0x205e01[_0xbb10('0x31')][_0xbb10('0x36')]));_0x8b0a7d['attributes']=_0x8b0a7d['attributes']['length']?_0x8b0a7d[_0xbb10('0x35')]:_0x5573bb[_0xbb10('0x2e')];if(!_0x205e01[_0xbb10('0x31')]['hasOwnProperty'](_0xbb10('0x52'))){_0x8b0a7d[_0xbb10('0x1d')]=qs['limit'](_0x205e01['query'][_0xbb10('0x1d')]);_0x8b0a7d[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x205e01[_0xbb10('0x31')]['offset']);}_0x8b0a7d[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_0x205e01[_0xbb10('0x31')]['sort']);_0x8b0a7d[_0xbb10('0x3b')]=qs[_0xbb10('0x33')](_[_0xbb10('0x53')](_0x205e01['query'],_0x5573bb[_0xbb10('0x33')]));if(_0x205e01[_0xbb10('0x31')][_0xbb10('0x40')]){_0x8b0a7d[_0xbb10('0x3b')]=_['merge'](_0x8b0a7d[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x3f')](_0x8b0a7d[_0xbb10('0x35')],function(_0x2d0f4b){var _0x56b3a3={};_0x56b3a3[_0x2d0f4b]={'$like':'%'+_0x205e01[_0xbb10('0x31')][_0xbb10('0x40')]+'%'};return _0x56b3a3;})});}_0x8b0a7d[_0xbb10('0x3b')]=_[_0xbb10('0x3e')](_0x8b0a7d[_0xbb10('0x3b')],{'mailboxuser':_0x3e6338[_0xbb10('0x54')]});_0x8b0a7d=_[_0xbb10('0x3e')]({},_0x8b0a7d,_0x205e01['options']);return db['VoiceMailMessage']['findAndCountAll'](_0x8b0a7d)[_0xbb10('0x23')](respondWithFilteredResult(_0x40c4fb,_0x8b0a7d));})[_0xbb10('0x43')](handleError(_0x40c4fb,null));}; \ No newline at end of file +var _0xb10b=['send','index','VoiceMail','rawAttributes','model','dateStart','dateEnd','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','add','day','merge','map','filter','options','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','nolimit','pick','mailbox','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','Voicemails','UserProfileResource','destroy','error','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e0c31,_0x208e9f){_0x4e0c31=_0x4e0c31-0x0;var _0x3fd7df=_0xb10b[_0x4e0c31];return _0x3fd7df;};'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'];function respondWithStatusCode(_0x5e136d,_0x408248){_0x408248=_0x408248||0xcc;return function(_0x5be7e0){if(_0x5be7e0){return _0x5e136d[_0xbb10('0x17')](_0x408248);}return _0x5e136d[_0xbb10('0x18')](_0x408248)[_0xbb10('0x19')]();};}function respondWithResult(_0x193a27,_0x442548){_0x442548=_0x442548||0xc8;return function(_0x147230){if(_0x147230){return _0x193a27['status'](_0x442548)[_0xbb10('0x1a')](_0x147230);}};}function respondWithFilteredResult(_0x42d7e4,_0x45b9d6){return function(_0x17fd46){if(_0x17fd46){var _0x3df17b=_0x17fd46[_0xbb10('0x1b')],_0x2f2ebf=_0x45b9d6[_0xbb10('0x1c')],_0x24a57b=_0x45b9d6['offset']+_0x45b9d6[_0xbb10('0x1d')],_0x36b5e8;if(_0x24a57b>=_0x3df17b){_0x24a57b=_0x3df17b;_0x36b5e8=0xc8;}else{_0x36b5e8=0xce;}_0x42d7e4[_0xbb10('0x18')](_0x36b5e8);return _0x42d7e4[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x2f2ebf+'-'+_0x24a57b+'/'+_0x3df17b)[_0xbb10('0x1a')](_0x17fd46);}return null;};}function patchUpdates(_0x1682a4){return function(_0x575cca){try{jsonpatch[_0xbb10('0x20')](_0x575cca,_0x1682a4,!![]);}catch(_0xbf2906){return BPromise[_0xbb10('0x21')](_0xbf2906);}return _0x575cca['save']();};}function saveUpdates(_0x5ff0cf,_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x22')](_0x5ff0cf)[_0xbb10('0x23')](function(_0x44e563){return _0x44e563;});}return null;};}function removeEntity(_0x4deb49,_0x12f888){return function(_0x12ef77){if(_0x12ef77){return _0x12ef77['destroy']()['then'](function(){var _0x8e2b97=_0x12ef77[_0xbb10('0x24')]({'plain':!![]});var _0x2e911d=_0xbb10('0x25');return db[_0xbb10('0x26')][_0xbb10('0x27')]({'where':{'type':_0x2e911d,'resourceId':_0x8e2b97['id']}})[_0xbb10('0x23')](function(){return _0x12ef77;});})[_0xbb10('0x23')](function(){_0x4deb49[_0xbb10('0x18')](0xcc)[_0xbb10('0x19')]();});}};}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('0x28')](_0x3c5ae7['stack']);if(_0x3c5ae7[_0xbb10('0x29')]){delete _0x3c5ae7[_0xbb10('0x29')];}_0x4fb5e0[_0xbb10('0x18')](_0xc93a04)[_0xbb10('0x2a')](_0x3c5ae7);};}exports[_0xbb10('0x2b')]=function(_0x20d946,_0x2a0e8b){var _0x4aabb9={},_0x3796c7={},_0x21ac54={'count':0x0,'rows':[]};var _0xfc3595=db[_0xbb10('0x2c')][_0xbb10('0x2d')];_0x3796c7[_0xbb10('0x2e')]=_['keys'](_0xfc3595);var _0x221624={'dateStart':_0x20d946['query'][_0xbb10('0x2f')],'dateEnd':_0x20d946['query'][_0xbb10('0x30')]};delete _0x20d946[_0xbb10('0x31')][_0xbb10('0x2f')];delete _0x20d946['query']['dateEnd'];_0x3796c7[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x20d946['query']);_0x3796c7[_0xbb10('0x33')]=_[_0xbb10('0x34')](_0x3796c7[_0xbb10('0x2e')],_0x3796c7[_0xbb10('0x31')]);_0x4aabb9[_0xbb10('0x35')]=_[_0xbb10('0x34')](_0x3796c7[_0xbb10('0x2e')],qs['fields'](_0x20d946[_0xbb10('0x31')][_0xbb10('0x36')]));_0x4aabb9[_0xbb10('0x35')]=_0x4aabb9[_0xbb10('0x35')][_0xbb10('0x37')]?_0x4aabb9[_0xbb10('0x35')]:_0x3796c7[_0xbb10('0x2e')];if(!_0x20d946[_0xbb10('0x31')][_0xbb10('0x38')]('nolimit')){_0x4aabb9[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x20d946[_0xbb10('0x31')][_0xbb10('0x1d')]);_0x4aabb9['offset']=qs[_0xbb10('0x1c')](_0x20d946['query']['offset']);}_0x4aabb9[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_0x20d946[_0xbb10('0x31')][_0xbb10('0x3a')]);_0x4aabb9[_0xbb10('0x3b')]=qs[_0xbb10('0x33')](_['pick'](_0x20d946[_0xbb10('0x31')],_0x3796c7[_0xbb10('0x33')]));if(_0x221624['dateStart']){if(_0x221624['dateEnd']){_0x221624['dateEnd']=moment(_0x221624[_0xbb10('0x30')])[_0xbb10('0x3c')](0x1,_0xbb10('0x3d'));}else{_0x221624['dateEnd']=moment(_0x221624[_0xbb10('0x2f')])[_0xbb10('0x3c')](0x1,_0xbb10('0x3d'));}_['merge'](_0x4aabb9[_0xbb10('0x3b')],{'createdAt':{'$gte':_0x221624[_0xbb10('0x2f')],'$lte':_0x221624[_0xbb10('0x30')]}});}if(_0x20d946[_0xbb10('0x31')]['filter']){_0x4aabb9[_0xbb10('0x3b')]=_[_0xbb10('0x3e')](_0x4aabb9['where'],{'$or':_[_0xbb10('0x3f')](_0x4aabb9[_0xbb10('0x35')],function(_0x44d6ae){var _0x3a9934={};_0x3a9934[_0x44d6ae]={'$like':'%'+_0x20d946[_0xbb10('0x31')][_0xbb10('0x40')]+'%'};return _0x3a9934;})});}_0x4aabb9=_['merge']({},_0x4aabb9,_0x20d946[_0xbb10('0x41')]);var _0x1c7fae={'where':_0x4aabb9[_0xbb10('0x3b')]};return db[_0xbb10('0x2c')]['count'](_0x1c7fae)[_0xbb10('0x23')](function(_0x331751){_0x21ac54[_0xbb10('0x1b')]=_0x331751;if(_0x20d946[_0xbb10('0x31')]['includeAll']){_0x4aabb9[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x2c')]['findAll'](_0x4aabb9);})['then'](function(_0x38d78f){_0x21ac54['rows']=_0x38d78f;return _0x21ac54;})[_0xbb10('0x23')](respondWithFilteredResult(_0x2a0e8b,_0x4aabb9))[_0xbb10('0x43')](handleError(_0x2a0e8b,null));};exports['show']=function(_0x366608,_0x1d82bf){var _0x474e99={'raw':!![],'where':{'id':_0x366608[_0xbb10('0x44')]['id']}},_0x5cf4f8={};_0x5cf4f8[_0xbb10('0x2e')]=_[_0xbb10('0x32')](db[_0xbb10('0x2c')][_0xbb10('0x2d')]);_0x5cf4f8[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x366608[_0xbb10('0x31')]);_0x5cf4f8[_0xbb10('0x33')]=_[_0xbb10('0x34')](_0x5cf4f8[_0xbb10('0x2e')],_0x5cf4f8[_0xbb10('0x31')]);_0x474e99['attributes']=_[_0xbb10('0x34')](_0x5cf4f8[_0xbb10('0x2e')],qs['fields'](_0x366608[_0xbb10('0x31')][_0xbb10('0x36')]));_0x474e99[_0xbb10('0x35')]=_0x474e99[_0xbb10('0x35')][_0xbb10('0x37')]?_0x474e99[_0xbb10('0x35')]:_0x5cf4f8[_0xbb10('0x2e')];if(_0x366608['query']['includeAll']){_0x474e99[_0xbb10('0x42')]=[{'all':!![]}];}_0x474e99=_[_0xbb10('0x3e')]({},_0x474e99,_0x366608[_0xbb10('0x41')]);return db['VoiceMail']['find'](_0x474e99)[_0xbb10('0x23')](handleEntityNotFound(_0x1d82bf,null))[_0xbb10('0x23')](respondWithResult(_0x1d82bf,null))[_0xbb10('0x43')](handleError(_0x1d82bf,null));};exports[_0xbb10('0x45')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x2c')][_0xbb10('0x45')](_0x10159b[_0xbb10('0x46')],{})[_0xbb10('0x23')](function(_0x550111){var _0x5eafac=_0x10159b[_0xbb10('0x47')][_0xbb10('0x24')]({'plain':!![]});if(!_0x5eafac)throw new Error(_0xbb10('0x48'));if(_0x5eafac[_0xbb10('0x49')]===_0xbb10('0x47')){var _0x440f9e=_0x550111[_0xbb10('0x24')]({'plain':!![]});var _0x445870=_0xbb10('0x25');return db[_0xbb10('0x4a')][_0xbb10('0x4b')]({'where':{'name':_0x445870,'userProfileId':_0x5eafac[_0xbb10('0x4c')]},'raw':!![]})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x2e6fd9&&_0x2e6fd9[_0xbb10('0x4d')]===0x0){return db['UserProfileResource'][_0xbb10('0x45')]({'name':_0x440f9e['name'],'resourceId':_0x440f9e['id'],'type':_0x2e6fd9[_0xbb10('0x29')],'sectionId':_0x2e6fd9['id']},{})[_0xbb10('0x23')](function(){return _0x550111;});}else{return _0x550111;}})[_0xbb10('0x43')](function(_0x3f27ce){logger[_0xbb10('0x28')](_0xbb10('0x4e'),_0x3f27ce);throw _0x3f27ce;});}return _0x550111;})[_0xbb10('0x23')](respondWithResult(_0x22b315,0xc9))[_0xbb10('0x43')](handleError(_0x22b315,null));};exports[_0xbb10('0x22')]=function(_0x3d71e,_0x44a056){if(_0x3d71e[_0xbb10('0x46')]['id']){delete _0x3d71e[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x4b')]({'where':{'id':_0x3d71e['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x44a056,null))[_0xbb10('0x23')](saveUpdates(_0x3d71e[_0xbb10('0x46')],null))[_0xbb10('0x23')](respondWithResult(_0x44a056,null))[_0xbb10('0x43')](handleError(_0x44a056,null));};exports[_0xbb10('0x27')]=function(_0x4bedd0,_0x120bda){return db[_0xbb10('0x2c')][_0xbb10('0x4b')]({'where':{'id':_0x4bedd0[_0xbb10('0x44')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x120bda,null))[_0xbb10('0x23')](removeEntity(_0x120bda,null))[_0xbb10('0x43')](handleError(_0x120bda,null));};exports[_0xbb10('0x4f')]=function(_0x205e01,_0x40c4fb,_0x2eb05a){return db[_0xbb10('0x2c')][_0xbb10('0x50')]({'where':{'id':_0x205e01['params']['id']}})['then'](handleEntityNotFound(_0x40c4fb,null))[_0xbb10('0x23')](function(_0x3e6338){var _0x3d0cb7;var _0x8b0a7d={},_0x5573bb={};_0x5573bb['model']=_[_0xbb10('0x32')](db[_0xbb10('0x51')][_0xbb10('0x2d')]);_0x5573bb[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x205e01[_0xbb10('0x31')]);_0x5573bb[_0xbb10('0x33')]=_['intersection'](_0x5573bb[_0xbb10('0x2e')],_0x5573bb[_0xbb10('0x31')]);_0x8b0a7d['attributes']=_['intersection'](_0x5573bb['model'],qs[_0xbb10('0x36')](_0x205e01[_0xbb10('0x31')][_0xbb10('0x36')]));_0x8b0a7d['attributes']=_0x8b0a7d['attributes']['length']?_0x8b0a7d[_0xbb10('0x35')]:_0x5573bb[_0xbb10('0x2e')];if(!_0x205e01[_0xbb10('0x31')]['hasOwnProperty'](_0xbb10('0x52'))){_0x8b0a7d[_0xbb10('0x1d')]=qs['limit'](_0x205e01['query'][_0xbb10('0x1d')]);_0x8b0a7d[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x205e01[_0xbb10('0x31')]['offset']);}_0x8b0a7d[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_0x205e01[_0xbb10('0x31')]['sort']);_0x8b0a7d[_0xbb10('0x3b')]=qs[_0xbb10('0x33')](_[_0xbb10('0x53')](_0x205e01['query'],_0x5573bb[_0xbb10('0x33')]));if(_0x205e01[_0xbb10('0x31')][_0xbb10('0x40')]){_0x8b0a7d[_0xbb10('0x3b')]=_['merge'](_0x8b0a7d[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x3f')](_0x8b0a7d[_0xbb10('0x35')],function(_0x2d0f4b){var _0x56b3a3={};_0x56b3a3[_0x2d0f4b]={'$like':'%'+_0x205e01[_0xbb10('0x31')][_0xbb10('0x40')]+'%'};return _0x56b3a3;})});}_0x8b0a7d[_0xbb10('0x3b')]=_[_0xbb10('0x3e')](_0x8b0a7d[_0xbb10('0x3b')],{'mailboxuser':_0x3e6338[_0xbb10('0x54')]});_0x8b0a7d=_[_0xbb10('0x3e')]({},_0x8b0a7d,_0x205e01['options']);return db['VoiceMailMessage']['findAndCountAll'](_0x8b0a7d)[_0xbb10('0x23')](respondWithFilteredResult(_0x40c4fb,_0x8b0a7d));})[_0xbb10('0x43')](handleError(_0x40c4fb,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5084461..9cbc163 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 _0xc417=['mailbox','api','bluebird','request-promise','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context'];(function(_0x35a8a0,_0x58b379){var _0x3d6b42=function(_0x21a73a){while(--_0x21a73a){_0x35a8a0['push'](_0x35a8a0['shift']());}};_0x3d6b42(++_0x58b379);}(_0xc417,0xd0));var _0x7c41=function(_0x1c3ef9,_0x5b8d06){_0x1c3ef9=_0x1c3ef9-0x0;var _0x4bba0a=_0xc417[_0x1c3ef9];return _0x4bba0a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7c41('0x0'));var moment=require('moment');var BPromise=require(_0x7c41('0x1'));var rp=require(_0x7c41('0x2'));var attributes=require(_0x7c41('0x3'));module[_0x7c41('0x4')]=function(_0x11cc5a,_0x3563e9){return _0x11cc5a[_0x7c41('0x5')]('VoiceMail',attributes,{'tableName':_0x7c41('0x6'),'paranoid':![],'indexes':[{'name':_0x7c41('0x7'),'fields':[_0x7c41('0x8'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ab7=['./voiceMail.attributes','exports','define','mailbox_context','mailbox','context','util','api','moment','bluebird','request-promise'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x9ab7,0x1be));var _0x79ab=function(_0x5a41f4,_0x51c1da){_0x5a41f4=_0x5a41f4-0x0;var _0x396de1=_0x9ab7[_0x5a41f4];return _0x396de1;};'use strict';var _=require('lodash');var util=require(_0x79ab('0x0'));var logger=require('../../config/logger')(_0x79ab('0x1'));var moment=require(_0x79ab('0x2'));var BPromise=require(_0x79ab('0x3'));var rp=require(_0x79ab('0x4'));var attributes=require(_0x79ab('0x5'));module[_0x79ab('0x6')]=function(_0x2de11c,_0x3caca5){return _0x2de11c[_0x79ab('0x7')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x79ab('0x8'),'fields':[_0x79ab('0x9'),_0x79ab('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 53b2aac..4f06811 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 _0x7ef4=['request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x454d68,_0x27c4c5){var _0x2bce75=function(_0x5d9096){while(--_0x5d9096){_0x454d68['push'](_0x454d68['shift']());}};_0x2bce75(++_0x27c4c5);}(_0x7ef4,0x113));var _0x47ef=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7ef4[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x47ef('0x0'));var util=require('util');var moment=require(_0x47ef('0x1'));var BPromise=require(_0x47ef('0x2'));var rs=require(_0x47ef('0x3'));var fs=require('fs');var Redis=require(_0x47ef('0x4'));var db=require(_0x47ef('0x5'))['db'];var utils=require(_0x47ef('0x6'));var logger=require(_0x47ef('0x7'))(_0x47ef('0x8'));var config=require(_0x47ef('0x9'));var jayson=require(_0x47ef('0xa'));var client=jayson[_0x47ef('0xb')][_0x47ef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x451be5,_0x3dc3dd,_0x1d6658){return new BPromise(function(_0x34dbc1,_0x20865b){return client[_0x47ef('0xd')](_0x451be5,_0x1d6658)[_0x47ef('0xe')](function(_0x2b7ebe){logger['info'](_0x47ef('0xf'),_0x3dc3dd,_0x47ef('0x10'));logger['debug'](_0x47ef('0x11'),_0x3dc3dd,'request\x20sent',JSON[_0x47ef('0x12')](_0x2b7ebe));if(_0x2b7ebe[_0x47ef('0x13')]){if(_0x2b7ebe['error'][_0x47ef('0x14')]===0x1f4){logger[_0x47ef('0x13')]('VoiceMail,\x20%s,\x20%s',_0x3dc3dd,_0x2b7ebe['error'][_0x47ef('0x15')]);return _0x20865b(_0x2b7ebe['error']['message']);}logger[_0x47ef('0x13')](_0x47ef('0xf'),_0x3dc3dd,_0x2b7ebe[_0x47ef('0x13')][_0x47ef('0x15')]);return _0x34dbc1(_0x2b7ebe['error'][_0x47ef('0x15')]);}else{logger[_0x47ef('0x16')](_0x47ef('0xf'),_0x3dc3dd,_0x47ef('0x10'));_0x34dbc1(_0x2b7ebe[_0x47ef('0x17')][_0x47ef('0x15')]);}})['catch'](function(_0x4b32a4){logger[_0x47ef('0x13')]('VoiceMail,\x20%s,\x20%s',_0x3dc3dd,_0x4b32a4);_0x20865b(_0x4b32a4);});});} \ No newline at end of file +var _0xf74b=['catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceMail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result'];(function(_0x577cf7,_0x39eb4b){var _0x437757=function(_0x3cd395){while(--_0x3cd395){_0x577cf7['push'](_0x577cf7['shift']());}};_0x437757(++_0x39eb4b);}(_0xf74b,0x1e1));var _0xbf74=function(_0x4b32bb,_0x52591c){_0x4b32bb=_0x4b32bb-0x0;var _0x5d1174=_0xf74b[_0x4b32bb];return _0x5d1174;};'use strict';var _=require(_0xbf74('0x0'));var util=require(_0xbf74('0x1'));var moment=require('moment');var BPromise=require(_0xbf74('0x2'));var rs=require(_0xbf74('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbf74('0x4'));var logger=require(_0xbf74('0x5'))(_0xbf74('0x6'));var config=require(_0xbf74('0x7'));var jayson=require(_0xbf74('0x8'));var client=jayson[_0xbf74('0x9')][_0xbf74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc6b058,_0x59394d,_0x268905){return new BPromise(function(_0xbeabe5,_0x1a2731){return client['request'](_0xc6b058,_0x268905)['then'](function(_0x250117){logger[_0xbf74('0xb')](_0xbf74('0xc'),_0x59394d,'request\x20sent');logger[_0xbf74('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x59394d,_0xbf74('0xe'),JSON[_0xbf74('0xf')](_0x250117));if(_0x250117[_0xbf74('0x10')]){if(_0x250117['error']['code']===0x1f4){logger[_0xbf74('0x10')](_0xbf74('0xc'),_0x59394d,_0x250117[_0xbf74('0x10')][_0xbf74('0x11')]);return _0x1a2731(_0x250117[_0xbf74('0x10')]['message']);}logger[_0xbf74('0x10')](_0xbf74('0xc'),_0x59394d,_0x250117[_0xbf74('0x10')][_0xbf74('0x11')]);return _0xbeabe5(_0x250117[_0xbf74('0x10')][_0xbf74('0x11')]);}else{logger[_0xbf74('0xb')]('VoiceMail,\x20%s,\x20%s',_0x59394d,_0xbf74('0xe'));_0xbeabe5(_0x250117[_0xbf74('0x12')][_0xbf74('0x11')]);}})[_0xbf74('0x13')](function(_0x341e44){logger['error'](_0xbf74('0xc'),_0x59394d,_0x341e44);_0x1a2731(_0x341e44);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index e86d05f..5645d0f 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 _0x2085=['/:id','download','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x2085,0xb2));var _0x5208=function(_0x20412f,_0x32b502){_0x20412f=_0x20412f-0x0;var _0x16d840=_0x2085[_0x20412f];return _0x16d840;};'use strict';var multer=require('multer');var util=require(_0x5208('0x0'));var path=require(_0x5208('0x1'));var timeout=require(_0x5208('0x2'));var express=require(_0x5208('0x3'));var router=express[_0x5208('0x4')]();var auth=require(_0x5208('0x5'));var interaction=require(_0x5208('0x6'));var config=require(_0x5208('0x7'));var controller=require(_0x5208('0x8'));router[_0x5208('0x9')]('/',auth[_0x5208('0xa')](),controller[_0x5208('0xb')]);router[_0x5208('0x9')](_0x5208('0xc'),auth[_0x5208('0xa')](),controller['show']);router[_0x5208('0x9')]('/:id/download',auth[_0x5208('0xa')](),controller[_0x5208('0xd')]);router[_0x5208('0xe')]('/',auth[_0x5208('0xa')](),controller['create']);router[_0x5208('0xf')](_0x5208('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x5208('0x10')](_0x5208('0xc'),auth['isAuthenticated'](),controller[_0x5208('0x11')]);module[_0x5208('0x12')]=router; \ No newline at end of file +var _0xb1c9=['index','show','download','create','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x259f4f,_0x59f708){var _0x222b26=function(_0x44201a){while(--_0x44201a){_0x259f4f['push'](_0x259f4f['shift']());}};_0x222b26(++_0x59f708);}(_0xb1c9,0x8d));var _0x9b1c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb1c9[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x9b1c('0x0'));var path=require(_0x9b1c('0x1'));var timeout=require(_0x9b1c('0x2'));var express=require(_0x9b1c('0x3'));var router=express[_0x9b1c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9b1c('0x5'));var config=require('../../config/environment');var controller=require(_0x9b1c('0x6'));router[_0x9b1c('0x7')]('/',auth[_0x9b1c('0x8')](),controller[_0x9b1c('0x9')]);router[_0x9b1c('0x7')]('/:id',auth[_0x9b1c('0x8')](),controller[_0x9b1c('0xa')]);router[_0x9b1c('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x9b1c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9b1c('0xc')]);router['put']('/:id',auth[_0x9b1c('0x8')](),controller[_0x9b1c('0xd')]);router[_0x9b1c('0xe')]('/:id',auth[_0x9b1c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index d1d0aa0..cec4e57 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 _0xde97=['long','TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER','STRING','BLOB'];(function(_0x264965,_0x1db1ca){var _0x9030fa=function(_0x31bef0){while(--_0x31bef0){_0x264965['push'](_0x264965['shift']());}};_0x9030fa(++_0x1db1ca);}(_0xde97,0x142));var _0x7de9=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0xde97[_0x1ee0a1];return _0x1d2d5b;};'use strict';var Sequelize=require(_0x7de9('0x0'));module[_0x7de9('0x1')]={'name':{'type':Sequelize[_0x7de9('0x2')],'get':function(_0x5b9756){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x7de9('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x7de9('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x7de9('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7de9('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x7de9('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x7de9('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x7de9('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7de9('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7de9('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x7de9('0x5')](_0x7de9('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x7de9('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0x27d1=['INTEGER','STRING','BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0xbce206,_0x30668e){var _0xa4c126=function(_0x11ce96){while(--_0x11ce96){_0xbce206['push'](_0xbce206['shift']());}};_0xa4c126(++_0x30668e);}(_0x27d1,0xe6));var _0x127d=function(_0x2fbb35,_0x16a413){_0x2fbb35=_0x2fbb35-0x0;var _0x42de22=_0x27d1[_0x2fbb35];return _0x42de22;};'use strict';var Sequelize=require(_0x127d('0x0'));module[_0x127d('0x1')]={'name':{'type':Sequelize[_0x127d('0x2')],'get':function(_0x28da9a){return this[_0x127d('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x127d('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x127d('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x127d('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x127d('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x127d('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x127d('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x127d('0x6')](_0x127d('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x127d('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x127d('0x5')],'defaultValue':''},'stamp':{'type':_0x127d('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b9e2bba..aa5e9c8 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 _0xda2d=['rows','catch','show','params','find','create','body','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','sendStatus','error','name','send','VoiceMailMessage','rawAttributes','model','differenceBy','keys','query','dateEnd','dateStart','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','add','day','where','filter','merge','map','then','include','findAll'];(function(_0x59d866,_0x55657c){var _0x43b7cc=function(_0x5dd449){while(--_0x5dd449){_0x59d866['push'](_0x59d866['shift']());}};_0x43b7cc(++_0x55657c);}(_0xda2d,0x102));var _0xdda2=function(_0x5550e3,_0x2a052f){_0x5550e3=_0x5550e3-0x0;var _0x1d1b71=_0xda2d[_0x5550e3];return _0x1d1b71;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var qs=require(_0xdda2('0x11'));var logger=require(_0xdda2('0x12'))(_0xdda2('0x13'));var utils=require(_0xdda2('0x14'));var config=require(_0xdda2('0x15'));var db=require(_0xdda2('0x16'))['db'];function respondWithStatusCode(_0x26fe81,_0x1dac9a){_0x1dac9a=_0x1dac9a||0xcc;return function(_0x57aba3){if(_0x57aba3){return _0x26fe81['sendStatus'](_0x1dac9a);}return _0x26fe81['status'](_0x1dac9a)[_0xdda2('0x17')]();};}function respondWithResult(_0x320f73,_0x3518b9){_0x3518b9=_0x3518b9||0xc8;return function(_0x1503a7){if(_0x1503a7){return _0x320f73[_0xdda2('0x18')](_0x3518b9)[_0xdda2('0x19')](_0x1503a7);}};}function respondWithFilteredResult(_0x3490f1,_0x4df902){return function(_0x79c6d4){if(_0x79c6d4){var _0x4b0220=_0x79c6d4[_0xdda2('0x1a')],_0xbef148=_0x4df902[_0xdda2('0x1b')],_0xb6b01e=_0x4df902['offset']+_0x4df902['limit'],_0x3553d5;if(_0xb6b01e>=_0x4b0220){_0xb6b01e=_0x4b0220;_0x3553d5=0xc8;}else{_0x3553d5=0xce;}_0x3490f1[_0xdda2('0x18')](_0x3553d5);return _0x3490f1['set'](_0xdda2('0x1c'),_0xbef148+'-'+_0xb6b01e+'/'+_0x4b0220)[_0xdda2('0x19')](_0x79c6d4);}return null;};}function patchUpdates(_0x335fb5){return function(_0x2b6ee8){try{jsonpatch[_0xdda2('0x1d')](_0x2b6ee8,_0x335fb5,!![]);}catch(_0x17015f){return BPromise[_0xdda2('0x1e')](_0x17015f);}return _0x2b6ee8[_0xdda2('0x1f')]();};}function saveUpdates(_0x3c02a4,_0x337b0b){return function(_0x312ef1){if(_0x312ef1){return _0x312ef1[_0xdda2('0x20')](_0x3c02a4)['then'](function(_0x41fe7d){return _0x41fe7d;});}return null;};}function removeEntity(_0x5dfce7,_0xc4567c){return function(_0x1a4db4){if(_0x1a4db4){return _0x1a4db4[_0xdda2('0x21')]()['then'](function(){_0x5dfce7[_0xdda2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x425489,_0x107ee4){return function(_0x4ac3eb){if(!_0x4ac3eb){_0x425489[_0xdda2('0x22')](0x194);}return _0x4ac3eb;};}function handleError(_0xfda248,_0x2528d7){_0x2528d7=_0x2528d7||0x1f4;return function(_0x13b0f3){logger[_0xdda2('0x23')](_0x13b0f3['stack']);if(_0x13b0f3[_0xdda2('0x24')]){delete _0x13b0f3[_0xdda2('0x24')];}_0xfda248[_0xdda2('0x18')](_0x2528d7)[_0xdda2('0x25')](_0x13b0f3);};}exports['index']=function(_0x4e97dc,_0x28da54){var _0x4567e7={},_0x2e8591={},_0x5e9e74={'count':0x0,'rows':[]};var _0x90d919=db[_0xdda2('0x26')][_0xdda2('0x27')];_0x2e8591[_0xdda2('0x28')]=_[_0xdda2('0x29')](_[_0xdda2('0x2a')](_0x90d919),['name']);var _0x24c37d={'dateStart':_0x4e97dc[_0xdda2('0x2b')]['dateStart'],'dateEnd':_0x4e97dc[_0xdda2('0x2b')][_0xdda2('0x2c')]};delete _0x4e97dc[_0xdda2('0x2b')][_0xdda2('0x2d')];delete _0x4e97dc['query'][_0xdda2('0x2c')];_0x2e8591[_0xdda2('0x2b')]=_['keys'](_0x4e97dc[_0xdda2('0x2b')]);_0x2e8591['filters']=_[_0xdda2('0x2e')](_0x2e8591['model'],_0x2e8591['query']);_0x4567e7['attributes']=_[_0xdda2('0x2e')](_0x2e8591['model'],qs[_0xdda2('0x2f')](_0x4e97dc['query']['fields']));_0x4567e7['attributes']=_0x4567e7[_0xdda2('0x30')][_0xdda2('0x31')]?_0x4567e7[_0xdda2('0x30')]:_0x2e8591[_0xdda2('0x28')];if(!_0x4e97dc[_0xdda2('0x2b')][_0xdda2('0x32')](_0xdda2('0x33'))){_0x4567e7[_0xdda2('0x34')]=qs[_0xdda2('0x34')](_0x4e97dc[_0xdda2('0x2b')]['limit']);_0x4567e7[_0xdda2('0x1b')]=qs[_0xdda2('0x1b')](_0x4e97dc[_0xdda2('0x2b')][_0xdda2('0x1b')]);}_0x4567e7[_0xdda2('0x35')]=qs[_0xdda2('0x36')](_0x4e97dc[_0xdda2('0x2b')]['sort']);_0x4567e7['where']=qs[_0xdda2('0x37')](_[_0xdda2('0x38')](_0x4e97dc[_0xdda2('0x2b')],_0x2e8591['filters']));if(_0x24c37d['dateStart']){if(_0x24c37d[_0xdda2('0x2c')]){_0x24c37d[_0xdda2('0x2c')]=moment(_0x24c37d[_0xdda2('0x2c')])[_0xdda2('0x39')](0x1,_0xdda2('0x3a'));}else{_0x24c37d['dateEnd']=moment(_0x24c37d[_0xdda2('0x2d')])[_0xdda2('0x39')](0x1,'day');}_['merge'](_0x4567e7[_0xdda2('0x3b')],{'createdAt':{'$gte':_0x24c37d[_0xdda2('0x2d')],'$lte':_0x24c37d[_0xdda2('0x2c')]}});}if(_0x4e97dc[_0xdda2('0x2b')][_0xdda2('0x3c')]){_0x4567e7['where']=_[_0xdda2('0x3d')](_0x4567e7[_0xdda2('0x3b')],{'$or':_[_0xdda2('0x3e')](_0x4567e7[_0xdda2('0x30')],function(_0x50c4ae){var _0x4dc38f={};_0x4dc38f[_0x50c4ae]={'$like':'%'+_0x4e97dc[_0xdda2('0x2b')][_0xdda2('0x3c')]+'%'};return _0x4dc38f;})});}_0x4567e7=_[_0xdda2('0x3d')]({},_0x4567e7,_0x4e97dc['options']);var _0x1bb2a7={'where':_0x4567e7['where']};return db[_0xdda2('0x26')]['count'](_0x1bb2a7)[_0xdda2('0x3f')](function(_0x2bebab){_0x5e9e74[_0xdda2('0x1a')]=_0x2bebab;if(_0x4e97dc[_0xdda2('0x2b')]['includeAll']){_0x4567e7[_0xdda2('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xdda2('0x41')](_0x4567e7);})['then'](function(_0x1d1678){_0x5e9e74[_0xdda2('0x42')]=_0x1d1678;return _0x5e9e74;})[_0xdda2('0x3f')](respondWithFilteredResult(_0x28da54,_0x4567e7))[_0xdda2('0x43')](handleError(_0x28da54,null));};exports[_0xdda2('0x44')]=function(_0x5acbb8,_0x1e29dc){var _0x15a616={'raw':!![],'where':{'id':_0x5acbb8[_0xdda2('0x45')]['id']}},_0x54735b={};_0x54735b['model']=_[_0xdda2('0x2a')](db[_0xdda2('0x26')][_0xdda2('0x27')]);_0x54735b[_0xdda2('0x2b')]=_[_0xdda2('0x2a')](_0x5acbb8[_0xdda2('0x2b')]);_0x54735b[_0xdda2('0x37')]=_[_0xdda2('0x2e')](_0x54735b[_0xdda2('0x28')],_0x54735b[_0xdda2('0x2b')]);_0x15a616[_0xdda2('0x30')]=_[_0xdda2('0x2e')](_0x54735b[_0xdda2('0x28')],qs['fields'](_0x5acbb8['query']['fields']));_0x15a616[_0xdda2('0x30')]=_0x15a616[_0xdda2('0x30')]['length']?_0x15a616[_0xdda2('0x30')]:_0x54735b[_0xdda2('0x28')];if(_0x5acbb8[_0xdda2('0x2b')]['includeAll']){_0x15a616[_0xdda2('0x40')]=[{'all':!![]}];}_0x15a616=_[_0xdda2('0x3d')]({},_0x15a616,_0x5acbb8['options']);return db['VoiceMailMessage'][_0xdda2('0x46')](_0x15a616)['then'](handleEntityNotFound(_0x1e29dc,null))[_0xdda2('0x3f')](respondWithResult(_0x1e29dc,null))['catch'](handleError(_0x1e29dc,null));};exports[_0xdda2('0x47')]=function(_0x4300c1,_0x50bd88){return db['VoiceMailMessage'][_0xdda2('0x47')](_0x4300c1[_0xdda2('0x48')],{})[_0xdda2('0x3f')](respondWithResult(_0x50bd88,0xc9))[_0xdda2('0x43')](handleError(_0x50bd88,null));};exports['update']=function(_0x1edbc6,_0x3bba94){if(_0x1edbc6[_0xdda2('0x48')]['id']){delete _0x1edbc6[_0xdda2('0x48')]['id'];}return db[_0xdda2('0x26')]['find']({'where':{'id':_0x1edbc6[_0xdda2('0x45')]['id']}})[_0xdda2('0x3f')](handleEntityNotFound(_0x3bba94,null))['then'](saveUpdates(_0x1edbc6[_0xdda2('0x48')],null))[_0xdda2('0x3f')](respondWithResult(_0x3bba94,null))[_0xdda2('0x43')](handleError(_0x3bba94,null));};exports[_0xdda2('0x21')]=function(_0x161d7b,_0x265169){return db['VoiceMailMessage'][_0xdda2('0x46')]({'where':{'id':_0x161d7b['params']['id']}})[_0xdda2('0x3f')](handleEntityNotFound(_0x265169,null))['then'](removeEntity(_0x265169,null))[_0xdda2('0x43')](handleError(_0x265169,null));};exports['download']=function(_0x3b5bbf,_0x11c8b1,_0xbb30b8){return db[_0xdda2('0x26')][_0xdda2('0x46')]({'where':{'id':_0x3b5bbf[_0xdda2('0x45')]['id']},'attributes':['id',_0xdda2('0x49'),_0xdda2('0x4a')]})['then'](handleEntityNotFound(_0x11c8b1,null))[_0xdda2('0x3f')](function(_0x206515){if(_0x206515){if(!_0x206515[_0xdda2('0x49')]){throw new db['Sequelize'][(_0xdda2('0x4b'))](_0xdda2('0x4c'));}var _0x56ddf2={'Content-Type':_0xdda2('0x4d'),'Content-Disposition':'attachment'};if(_0x206515[_0xdda2('0x4a')]){_0x56ddf2[_0xdda2('0x4e')]=_0xdda2('0x4f')+_0x206515[_0xdda2('0x4a')]+_0xdda2('0x50');}_0x11c8b1['set'](_0x56ddf2);return _0x11c8b1['send'](new Buffer(_0x206515['recording']));}})[_0xdda2('0x43')](handleError(_0x11c8b1,null));}; \ No newline at end of file +var _0x5f66=['length','hasOwnProperty','nolimit','order','sort','pick','day','add','where','filter','merge','count','includeAll','findAll','rows','catch','show','params','options','find','create','body','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','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','VoiceMailMessage','model','differenceBy','keys','dateStart','query','dateEnd','filters','attributes','intersection','fields'];(function(_0x298c5d,_0x4b89eb){var _0xb4f55=function(_0x4831a9){while(--_0x4831a9){_0x298c5d['push'](_0x298c5d['shift']());}};_0xb4f55(++_0x4b89eb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'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')](_[_0x65f6('0x26')](_0x296cd9),['name']);var _0x4ac04b={'dateStart':_0x5cb131['query'][_0x65f6('0x27')],'dateEnd':_0x5cb131[_0x65f6('0x28')][_0x65f6('0x29')]};delete _0x5cb131[_0x65f6('0x28')][_0x65f6('0x27')];delete _0x5cb131[_0x65f6('0x28')][_0x65f6('0x29')];_0x16cde8['query']=_['keys'](_0x5cb131[_0x65f6('0x28')]);_0x16cde8[_0x65f6('0x2a')]=_['intersection'](_0x16cde8['model'],_0x16cde8[_0x65f6('0x28')]);_0x29abdb[_0x65f6('0x2b')]=_[_0x65f6('0x2c')](_0x16cde8[_0x65f6('0x24')],qs[_0x65f6('0x2d')](_0x5cb131[_0x65f6('0x28')]['fields']));_0x29abdb[_0x65f6('0x2b')]=_0x29abdb[_0x65f6('0x2b')][_0x65f6('0x2e')]?_0x29abdb['attributes']:_0x16cde8[_0x65f6('0x24')];if(!_0x5cb131[_0x65f6('0x28')][_0x65f6('0x2f')](_0x65f6('0x30'))){_0x29abdb[_0x65f6('0x16')]=qs[_0x65f6('0x16')](_0x5cb131['query'][_0x65f6('0x16')]);_0x29abdb[_0x65f6('0x15')]=qs['offset'](_0x5cb131[_0x65f6('0x28')]['offset']);}_0x29abdb[_0x65f6('0x31')]=qs['sort'](_0x5cb131[_0x65f6('0x28')][_0x65f6('0x32')]);_0x29abdb['where']=qs[_0x65f6('0x2a')](_[_0x65f6('0x33')](_0x5cb131[_0x65f6('0x28')],_0x16cde8['filters']));if(_0x4ac04b['dateStart']){if(_0x4ac04b[_0x65f6('0x29')]){_0x4ac04b['dateEnd']=moment(_0x4ac04b[_0x65f6('0x29')])['add'](0x1,_0x65f6('0x34'));}else{_0x4ac04b[_0x65f6('0x29')]=moment(_0x4ac04b['dateStart'])[_0x65f6('0x35')](0x1,'day');}_['merge'](_0x29abdb[_0x65f6('0x36')],{'createdAt':{'$gte':_0x4ac04b[_0x65f6('0x27')],'$lte':_0x4ac04b[_0x65f6('0x29')]}});}if(_0x5cb131[_0x65f6('0x28')][_0x65f6('0x37')]){_0x29abdb[_0x65f6('0x36')]=_[_0x65f6('0x38')](_0x29abdb[_0x65f6('0x36')],{'$or':_['map'](_0x29abdb[_0x65f6('0x2b')],function(_0x49d8ee){var _0x12a589={};_0x12a589[_0x49d8ee]={'$like':'%'+_0x5cb131[_0x65f6('0x28')][_0x65f6('0x37')]+'%'};return _0x12a589;})});}_0x29abdb=_[_0x65f6('0x38')]({},_0x29abdb,_0x5cb131['options']);var _0x32148f={'where':_0x29abdb[_0x65f6('0x36')]};return db[_0x65f6('0x23')][_0x65f6('0x39')](_0x32148f)[_0x65f6('0x1c')](function(_0x3f6103){_0x4b2292[_0x65f6('0x39')]=_0x3f6103;if(_0x5cb131[_0x65f6('0x28')][_0x65f6('0x3a')]){_0x29abdb['include']=[{'all':!![]}];}return db[_0x65f6('0x23')][_0x65f6('0x3b')](_0x29abdb);})[_0x65f6('0x1c')](function(_0x181798){_0x4b2292[_0x65f6('0x3c')]=_0x181798;return _0x4b2292;})[_0x65f6('0x1c')](respondWithFilteredResult(_0x4fde2f,_0x29abdb))[_0x65f6('0x3d')](handleError(_0x4fde2f,null));};exports[_0x65f6('0x3e')]=function(_0x461393,_0x2abbed){var _0xcf19da={'raw':!![],'where':{'id':_0x461393[_0x65f6('0x3f')]['id']}},_0x2c008a={};_0x2c008a[_0x65f6('0x24')]=_[_0x65f6('0x26')](db[_0x65f6('0x23')]['rawAttributes']);_0x2c008a[_0x65f6('0x28')]=_[_0x65f6('0x26')](_0x461393[_0x65f6('0x28')]);_0x2c008a[_0x65f6('0x2a')]=_['intersection'](_0x2c008a[_0x65f6('0x24')],_0x2c008a[_0x65f6('0x28')]);_0xcf19da[_0x65f6('0x2b')]=_['intersection'](_0x2c008a[_0x65f6('0x24')],qs[_0x65f6('0x2d')](_0x461393[_0x65f6('0x28')][_0x65f6('0x2d')]));_0xcf19da['attributes']=_0xcf19da[_0x65f6('0x2b')]['length']?_0xcf19da[_0x65f6('0x2b')]:_0x2c008a[_0x65f6('0x24')];if(_0x461393['query'][_0x65f6('0x3a')]){_0xcf19da['include']=[{'all':!![]}];}_0xcf19da=_[_0x65f6('0x38')]({},_0xcf19da,_0x461393[_0x65f6('0x40')]);return db[_0x65f6('0x23')][_0x65f6('0x41')](_0xcf19da)[_0x65f6('0x1c')](handleEntityNotFound(_0x2abbed,null))[_0x65f6('0x1c')](respondWithResult(_0x2abbed,null))['catch'](handleError(_0x2abbed,null));};exports['create']=function(_0x198e2f,_0x15d3ba){return db[_0x65f6('0x23')][_0x65f6('0x42')](_0x198e2f[_0x65f6('0x43')],{})[_0x65f6('0x1c')](respondWithResult(_0x15d3ba,0xc9))[_0x65f6('0x3d')](handleError(_0x15d3ba,null));};exports[_0x65f6('0x1a')]=function(_0x414f49,_0x517a47){if(_0x414f49[_0x65f6('0x43')]['id']){delete _0x414f49[_0x65f6('0x43')]['id'];}return db[_0x65f6('0x23')]['find']({'where':{'id':_0x414f49[_0x65f6('0x3f')]['id']}})[_0x65f6('0x1c')](handleEntityNotFound(_0x517a47,null))['then'](saveUpdates(_0x414f49[_0x65f6('0x43')],null))[_0x65f6('0x1c')](respondWithResult(_0x517a47,null))['catch'](handleError(_0x517a47,null));};exports[_0x65f6('0x1b')]=function(_0x4f96c4,_0x247be3){return db[_0x65f6('0x23')][_0x65f6('0x41')]({'where':{'id':_0x4f96c4['params']['id']}})[_0x65f6('0x1c')](handleEntityNotFound(_0x247be3,null))[_0x65f6('0x1c')](removeEntity(_0x247be3,null))['catch'](handleError(_0x247be3,null));};exports[_0x65f6('0x44')]=function(_0x34312c,_0x48a2ed,_0x34d6a9){return db[_0x65f6('0x23')][_0x65f6('0x41')]({'where':{'id':_0x34312c[_0x65f6('0x3f')]['id']},'attributes':['id',_0x65f6('0x45'),_0x65f6('0x46')]})[_0x65f6('0x1c')](handleEntityNotFound(_0x48a2ed,null))[_0x65f6('0x1c')](function(_0x4f69d8){if(_0x4f69d8){if(!_0x4f69d8['recording']){throw new db['Sequelize'][(_0x65f6('0x47'))](_0x65f6('0x48'));}var _0x111a8a={'Content-Type':_0x65f6('0x49'),'Content-Disposition':'attachment'};if(_0x4f69d8[_0x65f6('0x46')]){_0x111a8a[_0x65f6('0x4a')]=_0x65f6('0x4b')+_0x4f69d8['msg_id']+_0x65f6('0x4c');}_0x48a2ed[_0x65f6('0x17')](_0x111a8a);return _0x48a2ed[_0x65f6('0x22')](new Buffer(_0x4f69d8['recording']));}})['catch'](handleError(_0x48a2ed,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 78e5b3e..95de439 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 _0x5d2a=['../../config/logger','api','moment','bluebird','request-promise','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util'];(function(_0x25db70,_0x5d4c54){var _0x44c484=function(_0x428328){while(--_0x428328){_0x25db70['push'](_0x25db70['shift']());}};_0x44c484(++_0x5d4c54);}(_0x5d2a,0x1b8));var _0xa5d2=function(_0x7eeac3,_0x48a56e){_0x7eeac3=_0x7eeac3-0x0;var _0x544df7=_0x5d2a[_0x7eeac3];return _0x544df7;};'use strict';var _=require(_0xa5d2('0x0'));var util=require(_0xa5d2('0x1'));var logger=require(_0xa5d2('0x2'))(_0xa5d2('0x3'));var moment=require(_0xa5d2('0x4'));var BPromise=require(_0xa5d2('0x5'));var rp=require(_0xa5d2('0x6'));var attributes=require(_0xa5d2('0x7'));module[_0xa5d2('0x8')]=function(_0x4df02c,_0x1e2734){return _0x4df02c[_0xa5d2('0x9')](_0xa5d2('0xa'),attributes,{'tableName':_0xa5d2('0xb'),'paranoid':![],'indexes':[{'name':_0xa5d2('0xc'),'fields':[_0xa5d2('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7cbe=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','request-promise','./voiceMailMessage.attributes','exports','define'];(function(_0x579608,_0x5f5556){var _0x523de9=function(_0x40e3ea){while(--_0x40e3ea){_0x579608['push'](_0x579608['shift']());}};_0x523de9(++_0x5f5556);}(_0x7cbe,0xab));var _0xe7cb=function(_0x259f53,_0x587855){_0x259f53=_0x259f53-0x0;var _0x105676=_0x7cbe[_0x259f53];return _0x105676;};'use strict';var _=require(_0xe7cb('0x0'));var util=require(_0xe7cb('0x1'));var logger=require(_0xe7cb('0x2'))(_0xe7cb('0x3'));var moment=require('moment');var BPromise=require(_0xe7cb('0x4'));var rp=require(_0xe7cb('0x5'));var attributes=require(_0xe7cb('0x6'));module[_0xe7cb('0x7')]=function(_0x2a588c,_0x3b02c6){return _0x2a588c[_0xe7cb('0x8')](_0xe7cb('0x9'),attributes,{'tableName':_0xe7cb('0xa'),'paranoid':![],'indexes':[{'name':_0xe7cb('0xb'),'fields':[_0xe7cb('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 1943f36..6cb4e8d 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 _0x6a98=['debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x2b92d2,_0x4e8ded){var _0x133446=function(_0x43edf5){while(--_0x43edf5){_0x2b92d2['push'](_0x2b92d2['shift']());}};_0x133446(++_0x4e8ded);}(_0x6a98,0x133));var _0x86a9=function(_0x4f9617,_0x16a10a){_0x4f9617=_0x4f9617-0x0;var _0x55b7d0=_0x6a98[_0x4f9617];return _0x55b7d0;};'use strict';var _=require(_0x86a9('0x0'));var util=require(_0x86a9('0x1'));var moment=require(_0x86a9('0x2'));var BPromise=require(_0x86a9('0x3'));var rs=require(_0x86a9('0x4'));var fs=require('fs');var Redis=require(_0x86a9('0x5'));var db=require(_0x86a9('0x6'))['db'];var utils=require(_0x86a9('0x7'));var logger=require(_0x86a9('0x8'))(_0x86a9('0x9'));var config=require(_0x86a9('0xa'));var jayson=require(_0x86a9('0xb'));var client=jayson[_0x86a9('0xc')][_0x86a9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x180684,_0x21c291,_0x3a9fff){return new BPromise(function(_0x362047,_0x3bd6cf){return client[_0x86a9('0xe')](_0x180684,_0x3a9fff)[_0x86a9('0xf')](function(_0x2f5b7e){logger['info'](_0x86a9('0x10'),_0x21c291,_0x86a9('0x11'));logger[_0x86a9('0x12')](_0x86a9('0x13'),_0x21c291,'request\x20sent',JSON['stringify'](_0x2f5b7e));if(_0x2f5b7e[_0x86a9('0x14')]){if(_0x2f5b7e[_0x86a9('0x14')][_0x86a9('0x15')]===0x1f4){logger[_0x86a9('0x14')](_0x86a9('0x10'),_0x21c291,_0x2f5b7e['error']['message']);return _0x3bd6cf(_0x2f5b7e[_0x86a9('0x14')][_0x86a9('0x16')]);}logger[_0x86a9('0x14')](_0x86a9('0x10'),_0x21c291,_0x2f5b7e[_0x86a9('0x14')][_0x86a9('0x16')]);return _0x362047(_0x2f5b7e['error'][_0x86a9('0x16')]);}else{logger[_0x86a9('0x17')](_0x86a9('0x10'),_0x21c291,'request\x20sent');_0x362047(_0x2f5b7e[_0x86a9('0x18')][_0x86a9('0x16')]);}})['catch'](function(_0x3dbe9a){logger['error'](_0x86a9('0x10'),_0x21c291,_0x3dbe9a);_0x3bd6cf(_0x3dbe9a);});});} \ No newline at end of file +var _0x51a7=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x51a7,0x145));var _0x751a=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0x51a7[_0x231b2e];return _0x3feb2a;};'use strict';var _=require('lodash');var util=require(_0x751a('0x0'));var moment=require('moment');var BPromise=require(_0x751a('0x1'));var rs=require(_0x751a('0x2'));var fs=require('fs');var Redis=require(_0x751a('0x3'));var db=require(_0x751a('0x4'))['db'];var utils=require(_0x751a('0x5'));var logger=require(_0x751a('0x6'))(_0x751a('0x7'));var config=require(_0x751a('0x8'));var jayson=require(_0x751a('0x9'));var client=jayson[_0x751a('0xa')][_0x751a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x879933,_0x10c6ba,_0x5e1eb4){return new BPromise(function(_0x2f6ea0,_0x3bb530){return client['request'](_0x879933,_0x5e1eb4)['then'](function(_0x204658){logger[_0x751a('0xc')](_0x751a('0xd'),_0x10c6ba,_0x751a('0xe'));logger[_0x751a('0xf')](_0x751a('0x10'),_0x10c6ba,_0x751a('0xe'),JSON[_0x751a('0x11')](_0x204658));if(_0x204658['error']){if(_0x204658[_0x751a('0x12')][_0x751a('0x13')]===0x1f4){logger[_0x751a('0x12')](_0x751a('0xd'),_0x10c6ba,_0x204658[_0x751a('0x12')][_0x751a('0x14')]);return _0x3bb530(_0x204658[_0x751a('0x12')]['message']);}logger[_0x751a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x10c6ba,_0x204658[_0x751a('0x12')][_0x751a('0x14')]);return _0x2f6ea0(_0x204658['error'][_0x751a('0x14')]);}else{logger[_0x751a('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x10c6ba,_0x751a('0xe'));_0x2f6ea0(_0x204658[_0x751a('0x15')][_0x751a('0x14')]);}})['catch'](function(_0x231047){logger[_0x751a('0x12')](_0x751a('0xd'),_0x10c6ba,_0x231047);_0x3bb530(_0x231047);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 3e77597..efa7284 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 _0xc368=['put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','addSound'];(function(_0x2b42da,_0x41bced){var _0x1f47bc=function(_0x4f17ea){while(--_0x4f17ea){_0x2b42da['push'](_0x2b42da['shift']());}};_0x1f47bc(++_0x41bced);}(_0xc368,0x7b));var _0x8c36=function(_0x4ed9ad,_0x8f4626){_0x4ed9ad=_0x4ed9ad-0x0;var _0x5a19cb=_0xc368[_0x4ed9ad];return _0x5a19cb;};'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')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8c36('0xd')](_0x8c36('0xb'),auth['isAuthenticated'](),controller[_0x8c36('0xe')]);router[_0x8c36('0xf')](_0x8c36('0x10'),auth[_0x8c36('0x8')](),controller[_0x8c36('0x11')]);router[_0x8c36('0x12')](_0x8c36('0x10'),auth[_0x8c36('0x8')](),controller[_0x8c36('0x13')]);router[_0x8c36('0x12')](_0x8c36('0x14'),auth[_0x8c36('0x8')](),controller[_0x8c36('0x15')]);module[_0x8c36('0x16')]=router; \ No newline at end of file +var _0x6f7a=['isAuthenticated','index','/:id','/:id/sounds','getSounds','post','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get'];(function(_0x267c61,_0x361a4c){var _0x3f1047=function(_0x38454f){while(--_0x38454f){_0x267c61['push'](_0x267c61['shift']());}};_0x3f1047(++_0x361a4c);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x11eb09,_0x9f3100){_0x11eb09=_0x11eb09-0x0;var _0x218887=_0x6f7a[_0x11eb09];return _0x218887;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var auth=require(_0xa6f7('0x5'));var interaction=require(_0xa6f7('0x6'));var config=require(_0xa6f7('0x7'));var controller=require(_0xa6f7('0x8'));router[_0xa6f7('0x9')]('/',auth[_0xa6f7('0xa')](),controller[_0xa6f7('0xb')]);router[_0xa6f7('0x9')](_0xa6f7('0xc'),auth[_0xa6f7('0xa')](),controller['show']);router['get'](_0xa6f7('0xd'),auth[_0xa6f7('0xa')](),controller[_0xa6f7('0xe')]);router[_0xa6f7('0xf')]('/',auth[_0xa6f7('0xa')](),controller['create']);router['post'](_0xa6f7('0xd'),auth[_0xa6f7('0xa')](),controller['addSound']);router[_0xa6f7('0x10')]('/:id',auth[_0xa6f7('0xa')](),controller[_0xa6f7('0x11')]);router[_0xa6f7('0x12')](_0xa6f7('0xc'),auth['isAuthenticated'](),controller[_0xa6f7('0x13')]);router['delete'](_0xa6f7('0x14'),auth[_0xa6f7('0xa')](),controller[_0xa6f7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 1229f64..b79d5a1 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 _0xe7b3=['quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb'];(function(_0x33ad85,_0x2b107d){var _0x26542d=function(_0x46d0bb){while(--_0x46d0bb){_0x33ad85['push'](_0x33ad85['shift']());}};_0x26542d(++_0x2b107d);}(_0xe7b3,0x1a5));var _0x3e7b=function(_0x51384c,_0x37277e){_0x51384c=_0x51384c-0x0;var _0x2db701=_0xe7b3[_0x51384c];return _0x2db701;};'use strict';var Sequelize=require(_0x3e7b('0x0'));module[_0x3e7b('0x1')]={'name':{'type':Sequelize[_0x3e7b('0x2')],'allowNull':![],'unique':_0x3e7b('0x3')},'mode':{'type':Sequelize[_0x3e7b('0x4')](_0x3e7b('0x5'),_0x3e7b('0x6'),_0x3e7b('0x7'),_0x3e7b('0x8'),_0x3e7b('0x9'),_0x3e7b('0xa')),'allowNull':!![],'defaultValue':_0x3e7b('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x3e7b('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x3e7b('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x3e7b('0x2')],'allowNull':!![],'defaultValue':_0x3e7b('0xb')},'format':{'type':Sequelize[_0x3e7b('0x2')],'allowNull':!![]},'stamp':{'type':_0x3e7b('0xc')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xad97=['mp3','TIMESTAMP','BOOLEAN','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x9077a4,_0x41748c){var _0x204bdc=function(_0x1c611e){while(--_0x1c611e){_0x9077a4['push'](_0x9077a4['shift']());}};_0x204bdc(++_0x41748c);}(_0xad97,0x1e3));var _0x7ad9=function(_0x10de7c,_0x129ff5){_0x10de7c=_0x10de7c-0x0;var _0x3ecf00=_0xad97[_0x10de7c];return _0x3ecf00;};'use strict';var Sequelize=require('sequelize');module[_0x7ad9('0x0')]={'name':{'type':Sequelize[_0x7ad9('0x1')],'allowNull':![],'unique':_0x7ad9('0x2')},'mode':{'type':Sequelize[_0x7ad9('0x3')](_0x7ad9('0x4'),_0x7ad9('0x5'),_0x7ad9('0x6'),_0x7ad9('0x7'),_0x7ad9('0x8'),_0x7ad9('0x9')),'allowNull':!![],'defaultValue':_0x7ad9('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x7ad9('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7ad9('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7ad9('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x7ad9('0x1')],'allowNull':!![]},'stamp':{'type':_0x7ad9('0xa')},'defaultEntry':{'type':Sequelize[_0x7ad9('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index a11a3ef..2c8bb7c 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 _0xea21=['server/files/sounds/converted','format','basename','save_name','extname','Sequelize','ValidationError','removeSound','id2','%s.%s','getSounds','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','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','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','add','merge','filter','where','map','options','include','findAll','rows','catch','show','params','fields','includeAll','find','body','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','message','addSound','sequelize','Sound','findOne','converted_format','createdAt'];(function(_0x481617,_0x3077b1){var _0x272fc5=function(_0x192bb8){while(--_0x192bb8){_0x481617['push'](_0x481617['shift']());}};_0x272fc5(++_0x3077b1);}(_0xea21,0x167));var _0x1ea2=function(_0x43c7ec,_0x31f614){_0x43c7ec=_0x43c7ec-0x0;var _0x2eeb59=_0xea21[_0x43c7ec];return _0x2eeb59;};'use strict';var pdf=require(_0x1ea2('0x0'));var emlformat=require(_0x1ea2('0x1'));var rimraf=require(_0x1ea2('0x2'));var zipdir=require(_0x1ea2('0x3'));var jsonpatch=require(_0x1ea2('0x4'));var rp=require(_0x1ea2('0x5'));var moment=require(_0x1ea2('0x6'));var BPromise=require(_0x1ea2('0x7'));var Mustache=require('mustache');var util=require(_0x1ea2('0x8'));var path=require(_0x1ea2('0x9'));var sox=require(_0x1ea2('0xa'));var csv=require(_0x1ea2('0xb'));var ejs=require(_0x1ea2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1ea2('0xd'));var crypto=require(_0x1ea2('0xe'));var jsforce=require(_0x1ea2('0xf'));var deskjs=require(_0x1ea2('0x10'));var toCsv=require(_0x1ea2('0xb'));var querystring=require(_0x1ea2('0x11'));var Papa=require(_0x1ea2('0x12'));var Redis=require(_0x1ea2('0x13'));var qs=require(_0x1ea2('0x14'));var logger=require(_0x1ea2('0x15'))('api');var utils=require(_0x1ea2('0x16'));var config=require(_0x1ea2('0x17'));var db=require(_0x1ea2('0x18'))['db'];function respondWithStatusCode(_0x4e405f,_0x5bcd52){_0x5bcd52=_0x5bcd52||0xcc;return function(_0x52e39d){if(_0x52e39d){return _0x4e405f['sendStatus'](_0x5bcd52);}return _0x4e405f[_0x1ea2('0x19')](_0x5bcd52)[_0x1ea2('0x1a')]();};}function respondWithResult(_0x28945c,_0x134a62){_0x134a62=_0x134a62||0xc8;return function(_0x4a2b96){if(_0x4a2b96){return _0x28945c[_0x1ea2('0x19')](_0x134a62)[_0x1ea2('0x1b')](_0x4a2b96);}};}function respondWithFilteredResult(_0x22a9f0,_0x449f0e){return function(_0x1e5a47){if(_0x1e5a47){var _0x4e7158=_0x1e5a47[_0x1ea2('0x1c')],_0x571b45=_0x449f0e['offset'],_0x6e39ab=_0x449f0e[_0x1ea2('0x1d')]+_0x449f0e[_0x1ea2('0x1e')],_0x4521d5;if(_0x6e39ab>=_0x4e7158){_0x6e39ab=_0x4e7158;_0x4521d5=0xc8;}else{_0x4521d5=0xce;}_0x22a9f0['status'](_0x4521d5);return _0x22a9f0[_0x1ea2('0x1f')]('Content-Range',_0x571b45+'-'+_0x6e39ab+'/'+_0x4e7158)[_0x1ea2('0x1b')](_0x1e5a47);}return null;};}function patchUpdates(_0x1e32ed){return function(_0x13f2e0){try{jsonpatch[_0x1ea2('0x20')](_0x13f2e0,_0x1e32ed,!![]);}catch(_0x988160){return BPromise[_0x1ea2('0x21')](_0x988160);}return _0x13f2e0[_0x1ea2('0x22')]();};}function saveUpdates(_0x88d5bc,_0x269add){return function(_0x1e0e91){if(_0x1e0e91){return _0x1e0e91[_0x1ea2('0x23')](_0x88d5bc)['then'](function(_0x1e978b){return _0x1e978b;});}return null;};}function removeEntity(_0x336695,_0xa596a){return function(_0x371a87){if(_0x371a87){return _0x371a87[_0x1ea2('0x24')]()['then'](function(){var _0x3a03a9=_0x371a87[_0x1ea2('0x25')]({'plain':!![]});var _0x1abb1a=_0x1ea2('0x26');return db[_0x1ea2('0x27')]['destroy']({'where':{'type':_0x1abb1a,'resourceId':_0x3a03a9['id']}})[_0x1ea2('0x28')](function(){return _0x371a87;});})[_0x1ea2('0x28')](function(){_0x336695[_0x1ea2('0x19')](0xcc)[_0x1ea2('0x1a')]();});}};}function handleEntityNotFound(_0x2c802d,_0x13c4c7){return function(_0x332046){if(!_0x332046){_0x2c802d[_0x1ea2('0x29')](0x194);}return _0x332046;};}function handleError(_0x51b475,_0x29c75e){_0x29c75e=_0x29c75e||0x1f4;return function(_0x240c25){logger[_0x1ea2('0x2a')](_0x240c25[_0x1ea2('0x2b')]);if(_0x240c25['name']){delete _0x240c25[_0x1ea2('0x2c')];}_0x51b475['status'](_0x29c75e)[_0x1ea2('0x2d')](_0x240c25);};}exports[_0x1ea2('0x2e')]=function(_0x5e7405,_0x11ba63){var _0x13a5b4={},_0x4ea3ed={},_0x520fb0={'count':0x0,'rows':[]};var _0x556a97=db[_0x1ea2('0x2f')][_0x1ea2('0x30')];_0x4ea3ed[_0x1ea2('0x31')]=_['keys'](_0x556a97);var _0x1d04cb={'dateStart':_0x5e7405[_0x1ea2('0x32')]['dateStart'],'dateEnd':_0x5e7405[_0x1ea2('0x32')][_0x1ea2('0x33')]};delete _0x5e7405[_0x1ea2('0x32')][_0x1ea2('0x34')];delete _0x5e7405['query']['dateEnd'];_0x4ea3ed['query']=_[_0x1ea2('0x35')](_0x5e7405['query']);_0x4ea3ed[_0x1ea2('0x36')]=_[_0x1ea2('0x37')](_0x4ea3ed[_0x1ea2('0x31')],_0x4ea3ed[_0x1ea2('0x32')]);_0x13a5b4[_0x1ea2('0x38')]=_['intersection'](_0x4ea3ed[_0x1ea2('0x31')],qs['fields'](_0x5e7405[_0x1ea2('0x32')]['fields']));_0x13a5b4[_0x1ea2('0x38')]=_0x13a5b4[_0x1ea2('0x38')][_0x1ea2('0x39')]?_0x13a5b4[_0x1ea2('0x38')]:_0x4ea3ed['model'];if(!_0x5e7405[_0x1ea2('0x32')][_0x1ea2('0x3a')](_0x1ea2('0x3b'))){_0x13a5b4[_0x1ea2('0x1e')]=qs[_0x1ea2('0x1e')](_0x5e7405['query'][_0x1ea2('0x1e')]);_0x13a5b4[_0x1ea2('0x1d')]=qs[_0x1ea2('0x1d')](_0x5e7405[_0x1ea2('0x32')][_0x1ea2('0x1d')]);}_0x13a5b4[_0x1ea2('0x3c')]=qs[_0x1ea2('0x3d')](_0x5e7405[_0x1ea2('0x32')]['sort']);_0x13a5b4['where']=qs[_0x1ea2('0x36')](_[_0x1ea2('0x3e')](_0x5e7405[_0x1ea2('0x32')],_0x4ea3ed['filters']));if(_0x1d04cb[_0x1ea2('0x34')]){if(_0x1d04cb[_0x1ea2('0x33')]){_0x1d04cb['dateEnd']=moment(_0x1d04cb['dateEnd'])[_0x1ea2('0x3f')](0x1,'day');}else{_0x1d04cb[_0x1ea2('0x33')]=moment(_0x1d04cb[_0x1ea2('0x34')])[_0x1ea2('0x3f')](0x1,'day');}_[_0x1ea2('0x40')](_0x13a5b4['where'],{'createdAt':{'$gte':_0x1d04cb[_0x1ea2('0x34')],'$lte':_0x1d04cb[_0x1ea2('0x33')]}});}if(_0x5e7405[_0x1ea2('0x32')][_0x1ea2('0x41')]){_0x13a5b4[_0x1ea2('0x42')]=_[_0x1ea2('0x40')](_0x13a5b4[_0x1ea2('0x42')],{'$or':_[_0x1ea2('0x43')](_0x13a5b4['attributes'],function(_0x20f194){var _0x19cae9={};_0x19cae9[_0x20f194]={'$like':'%'+_0x5e7405['query'][_0x1ea2('0x41')]+'%'};return _0x19cae9;})});}_0x13a5b4=_[_0x1ea2('0x40')]({},_0x13a5b4,_0x5e7405[_0x1ea2('0x44')]);var _0x5dd96b={'where':_0x13a5b4['where']};return db[_0x1ea2('0x2f')][_0x1ea2('0x1c')](_0x5dd96b)[_0x1ea2('0x28')](function(_0x220edb){_0x520fb0[_0x1ea2('0x1c')]=_0x220edb;if(_0x5e7405[_0x1ea2('0x32')]['includeAll']){_0x13a5b4[_0x1ea2('0x45')]=[{'all':!![]}];}return db[_0x1ea2('0x2f')][_0x1ea2('0x46')](_0x13a5b4);})[_0x1ea2('0x28')](function(_0x18a666){_0x520fb0[_0x1ea2('0x47')]=_0x18a666;return _0x520fb0;})[_0x1ea2('0x28')](respondWithFilteredResult(_0x11ba63,_0x13a5b4))[_0x1ea2('0x48')](handleError(_0x11ba63,null));};exports[_0x1ea2('0x49')]=function(_0x3de556,_0x5381c8){var _0xb07e16={'raw':![],'where':{'id':_0x3de556[_0x1ea2('0x4a')]['id']}},_0x3b6b57={};_0x3b6b57[_0x1ea2('0x31')]=_[_0x1ea2('0x35')](db[_0x1ea2('0x2f')][_0x1ea2('0x30')]);_0x3b6b57[_0x1ea2('0x32')]=_[_0x1ea2('0x35')](_0x3de556[_0x1ea2('0x32')]);_0x3b6b57['filters']=_['intersection'](_0x3b6b57[_0x1ea2('0x31')],_0x3b6b57[_0x1ea2('0x32')]);_0xb07e16['attributes']=_[_0x1ea2('0x37')](_0x3b6b57[_0x1ea2('0x31')],qs['fields'](_0x3de556['query'][_0x1ea2('0x4b')]));_0xb07e16['attributes']=_0xb07e16['attributes'][_0x1ea2('0x39')]?_0xb07e16['attributes']:_0x3b6b57['model'];if(_0x3de556[_0x1ea2('0x32')][_0x1ea2('0x4c')]){_0xb07e16['include']=[{'all':!![]}];}_0xb07e16=_['merge']({},_0xb07e16,_0x3de556[_0x1ea2('0x44')]);return db[_0x1ea2('0x2f')][_0x1ea2('0x4d')](_0xb07e16)[_0x1ea2('0x28')](handleEntityNotFound(_0x5381c8,null))[_0x1ea2('0x28')](respondWithResult(_0x5381c8,null))[_0x1ea2('0x48')](handleError(_0x5381c8,null));};exports[_0x1ea2('0x23')]=function(_0x2a3f9d,_0x23e5da){if(_0x2a3f9d[_0x1ea2('0x4e')]['id']){delete _0x2a3f9d['body']['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x2a3f9d[_0x1ea2('0x4a')]['id']}})[_0x1ea2('0x28')](handleEntityNotFound(_0x23e5da,null))[_0x1ea2('0x28')](saveUpdates(_0x2a3f9d[_0x1ea2('0x4e')],null))[_0x1ea2('0x28')](respondWithResult(_0x23e5da,null))[_0x1ea2('0x48')](handleError(_0x23e5da,null));};exports[_0x1ea2('0x4f')]=function(_0x46e722,_0x18ab84,_0x55fea2){return db['sequelize'][_0x1ea2('0x50')](function(_0x26fef2){if(_0x46e722[_0x1ea2('0x4e')][_0x1ea2('0x51')]===_0x1ea2('0x52')){_0x46e722[_0x1ea2('0x4e')][_0x1ea2('0x53')]=path[_0x1ea2('0x54')](config[_0x1ea2('0x55')],_0x1ea2('0x56'),_0x46e722[_0x1ea2('0x4e')][_0x1ea2('0x2c')]);}return db[_0x1ea2('0x2f')][_0x1ea2('0x4f')](_0x46e722[_0x1ea2('0x4e')],{'transaction':_0x26fef2})[_0x1ea2('0x28')](function(_0x59c2bc){if(_0x46e722[_0x1ea2('0x4e')][_0x1ea2('0x51')]===_0x1ea2('0x52')){fs[_0x1ea2('0x57')](_0x59c2bc[_0x1ea2('0x53')],parseInt(_0x1ea2('0x58'),0x8));}var _0x5705cd=_0x46e722['user']['get']({'plain':!![]});if(!_0x5705cd)throw new Error(_0x1ea2('0x59'));if(_0x5705cd[_0x1ea2('0x5a')]===_0x1ea2('0x5b')){var _0x55b068=_0x59c2bc[_0x1ea2('0x25')]({'plain':!![]});return db[_0x1ea2('0x5c')][_0x1ea2('0x4d')]({'where':{'name':_0x1ea2('0x26'),'userProfileId':_0x5705cd['userProfileId']},'raw':!![]})[_0x1ea2('0x28')](function(_0x2034df){if(_0x2034df&&_0x2034df[_0x1ea2('0x5d')]===0x0){return db[_0x1ea2('0x27')][_0x1ea2('0x4f')]({'name':_0x55b068['name'],'resourceId':_0x55b068['id'],'type':_0x2034df[_0x1ea2('0x2c')],'sectionId':_0x2034df['id']},{})[_0x1ea2('0x28')](function(){return _0x59c2bc;});}else{return _0x59c2bc;}})[_0x1ea2('0x48')](function(_0x29be73){logger['error'](_0x1ea2('0x5e'),_0x29be73);});}return _0x59c2bc;});})['then'](respondWithResult(_0x18ab84,0xc9))['catch'](handleError(_0x18ab84,null));};exports['destroy']=function(_0x155a93,_0x595df4,_0x3c2b88){var _0x61b456;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x155a93[_0x1ea2('0x4a')]['id']}})[_0x1ea2('0x28')](function(_0x559b4d){if(_0x559b4d){return db['sequelize']['transaction'](function(_0x238b54){return _0x559b4d['destroy']({'transaction':_0x238b54,'raw':!![]})['then'](function(_0x3873f4){if(_0x3873f4[_0x1ea2('0x53')]){fs[_0x1ea2('0x5f')](_0x3873f4[_0x1ea2('0x53')])['forEach'](function(_0x226e9b){fs[_0x1ea2('0x60')](path['join'](_0x3873f4[_0x1ea2('0x53')],_0x226e9b));});fs[_0x1ea2('0x61')](_0x3873f4[_0x1ea2('0x53')]);}return _0x3873f4;});})['catch'](function(_0x10922e){throw new db['Sequelize']['ValidationError'](_0x10922e[_0x1ea2('0x62')]);});}})[_0x1ea2('0x28')](handleEntityNotFound(_0x595df4,null))['then'](removeEntity(_0x595df4,null))[_0x1ea2('0x48')](handleError(_0x595df4,null));};exports[_0x1ea2('0x63')]=function(_0x1d11c9,_0x5cfe8c,_0x53e15b){return db[_0x1ea2('0x64')]['transaction'](function(_0x1093ee){var _0x1c5011;return db[_0x1ea2('0x2f')][_0x1ea2('0x4d')]({'where':{'id':_0x1d11c9[_0x1ea2('0x4a')]['id']}})[_0x1ea2('0x28')](function(_0x5159c4){if(_0x5159c4){_0x1c5011=_0x5159c4;return _0x5159c4[_0x1ea2('0x63')](_0x1d11c9['body']['id'],{'transaction':_0x1093ee});}})[_0x1ea2('0x28')](function(_0x39b43d){if(_0x39b43d){return db[_0x1ea2('0x65')][_0x1ea2('0x66')]({'where':{'id':_0x1d11c9[_0x1ea2('0x4e')]['id']},'attributes':['id',_0x1ea2('0x2c'),'save_name',_0x1ea2('0x67'),_0x1ea2('0x68')],'raw':!![]});}})[_0x1ea2('0x28')](function(_0x469b6c){if(_0x469b6c){var _0x539cc5=path[_0x1ea2('0x54')](config[_0x1ea2('0x55')],_0x1ea2('0x69'),util[_0x1ea2('0x6a')]('%s.%s',path[_0x1ea2('0x6b')](_0x469b6c[_0x1ea2('0x6c')],path[_0x1ea2('0x6d')](_0x469b6c['save_name'])),_0x469b6c[_0x1ea2('0x67')]));var _0x3f8705=path[_0x1ea2('0x54')](config[_0x1ea2('0x55')],_0x1ea2('0x56'),_0x1c5011[_0x1ea2('0x2c')],util['format']('%s.%s',_0x469b6c['name'],_0x469b6c[_0x1ea2('0x67')]));fs['symlinkSync'](_0x539cc5,_0x3f8705);return _0x469b6c;}})[_0x1ea2('0x48')](function(_0x5f1d3f){throw new db[(_0x1ea2('0x6e'))][(_0x1ea2('0x6f'))](_0x5f1d3f[_0x1ea2('0x62')]);});})[_0x1ea2('0x28')](handleEntityNotFound(_0x5cfe8c,null))[_0x1ea2('0x28')](respondWithResult(_0x5cfe8c,0xc9))['catch'](handleError(_0x5cfe8c,null));};exports[_0x1ea2('0x70')]=function(_0xa9ca70,_0x281a43,_0x5a7fa7){return db['sequelize']['transaction'](function(_0x81ebb3){var _0x50ce3e;return db[_0x1ea2('0x2f')]['findOne']({'where':{'id':_0xa9ca70[_0x1ea2('0x4a')]['id']}})[_0x1ea2('0x28')](handleEntityNotFound(_0x281a43,null))[_0x1ea2('0x28')](function(_0x54799f){if(_0x54799f){_0x50ce3e=_0x54799f;return _0x54799f['removeSound'](_0xa9ca70['params'][_0x1ea2('0x71')]);}})[_0x1ea2('0x28')](function(_0xfd1ebd){if(_0xfd1ebd){return db[_0x1ea2('0x65')][_0x1ea2('0x66')]({'where':{'id':_0xa9ca70[_0x1ea2('0x4a')][_0x1ea2('0x71')]},'attributes':['id',_0x1ea2('0x2c'),'save_name','converted_format',_0x1ea2('0x68')],'raw':!![]});}})[_0x1ea2('0x28')](function(_0x506479){if(_0x506479){fs[_0x1ea2('0x60')](path[_0x1ea2('0x54')](_0x50ce3e[_0x1ea2('0x53')],util[_0x1ea2('0x6a')](_0x1ea2('0x72'),_0x506479[_0x1ea2('0x2c')],_0x506479[_0x1ea2('0x67')])));return _0x506479;}})[_0x1ea2('0x48')](function(_0x384538){throw new db[(_0x1ea2('0x6e'))]['ValidationError'](_0x384538['message']);});})[_0x1ea2('0x28')](handleEntityNotFound(_0x281a43,null))[_0x1ea2('0x28')](respondWithStatusCode(_0x281a43,0xcc))[_0x1ea2('0x48')](handleError(_0x281a43,null));};exports[_0x1ea2('0x73')]=function(_0x4287ef,_0x5342c4,_0x5f4f8d){var _0x43ecb4={};var _0x13160c={};var _0x220ebe;var _0x3e8ebb;return db[_0x1ea2('0x2f')]['findOne']({'where':{'id':_0x4287ef[_0x1ea2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5342c4,null))[_0x1ea2('0x28')](function(_0x3c66cc){if(_0x3c66cc){_0x220ebe=_0x3c66cc;_0x13160c['model']=_[_0x1ea2('0x35')](db['Sound'][_0x1ea2('0x30')]);_0x13160c[_0x1ea2('0x32')]=_[_0x1ea2('0x35')](_0x4287ef[_0x1ea2('0x32')]);_0x13160c['filters']=_['intersection'](_0x13160c[_0x1ea2('0x31')],_0x13160c[_0x1ea2('0x32')]);_0x43ecb4['attributes']=_['intersection'](_0x13160c[_0x1ea2('0x31')],qs[_0x1ea2('0x4b')](_0x4287ef[_0x1ea2('0x32')]['fields']));_0x43ecb4[_0x1ea2('0x38')]=_0x43ecb4[_0x1ea2('0x38')][_0x1ea2('0x39')]?_0x43ecb4[_0x1ea2('0x38')]:_0x13160c[_0x1ea2('0x31')];_0x43ecb4[_0x1ea2('0x3c')]=qs['sort'](_0x4287ef[_0x1ea2('0x32')]['sort']);_0x43ecb4['where']=qs[_0x1ea2('0x36')](_['pick'](_0x4287ef[_0x1ea2('0x32')],_0x13160c['filters']));if(_0x4287ef[_0x1ea2('0x32')][_0x1ea2('0x41')]){_0x43ecb4[_0x1ea2('0x42')]=_['merge'](_0x43ecb4[_0x1ea2('0x42')],{'$or':_['map'](_0x43ecb4['attributes'],function(_0x5938a7){var _0x24411d={};_0x24411d[_0x5938a7]={'$like':'%'+_0x4287ef['query'][_0x1ea2('0x41')]+'%'};return _0x24411d;})});}_0x43ecb4=_[_0x1ea2('0x40')]({},_0x43ecb4,_0x4287ef[_0x1ea2('0x44')]);return _0x220ebe['getSounds'](_0x43ecb4);}})[_0x1ea2('0x28')](function(_0x435b3e){if(_0x435b3e){_0x3e8ebb=_0x435b3e[_0x1ea2('0x39')];if(!_0x4287ef[_0x1ea2('0x32')][_0x1ea2('0x3a')](_0x1ea2('0x3b'))){_0x43ecb4[_0x1ea2('0x1e')]=qs[_0x1ea2('0x1e')](_0x4287ef[_0x1ea2('0x32')]['limit']);_0x43ecb4[_0x1ea2('0x1d')]=qs[_0x1ea2('0x1d')](_0x4287ef[_0x1ea2('0x32')][_0x1ea2('0x1d')]);}return _0x220ebe[_0x1ea2('0x73')](_0x43ecb4);}})[_0x1ea2('0x28')](function(_0x22aac4){if(_0x22aac4){return _0x22aac4?{'count':_0x3e8ebb,'rows':_0x22aac4}:null;}})[_0x1ea2('0x28')](respondWithResult(_0x5342c4,null))[_0x1ea2('0x48')](handleError(_0x5342c4,null));}; \ No newline at end of file +var _0x9736=['model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','add','day','merge','map','filter','count','includeAll','include','findAll','rows','catch','show','params','options','find','body','create','sequelize','transaction','join','root','server/files/moh','mode','files','mkdirSync','0777','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','directory','forEach','unlinkSync','ValidationError','message','addSound','Sound','findOne','save_name','server/files/sounds/converted','%s.%s','basename','extname','converted_format','format','symlinkSync','removeSound','id2','getSounds','order','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes'];(function(_0x4a8072,_0x435bab){var _0x11a4fe=function(_0x24b69a){while(--_0x24b69a){_0x4a8072['push'](_0x4a8072['shift']());}};_0x11a4fe(++_0x435bab);}(_0x9736,0xaf));var _0x6973=function(_0x3336b5,_0x1889fc){_0x3336b5=_0x3336b5-0x0;var _0x4a86cd=_0x9736[_0x3336b5];return _0x4a86cd;};'use strict';var pdf=require(_0x6973('0x0'));var emlformat=require(_0x6973('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6973('0x2'));var jsonpatch=require(_0x6973('0x3'));var rp=require(_0x6973('0x4'));var moment=require(_0x6973('0x5'));var BPromise=require(_0x6973('0x6'));var Mustache=require(_0x6973('0x7'));var util=require('util');var path=require('path');var sox=require(_0x6973('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6973('0x9'));var squel=require('squel');var crypto=require(_0x6973('0xa'));var jsforce=require(_0x6973('0xb'));var deskjs=require(_0x6973('0xc'));var toCsv=require(_0x6973('0xd'));var querystring=require('querystring');var Papa=require(_0x6973('0xe'));var Redis=require(_0x6973('0xf'));var qs=require(_0x6973('0x10'));var logger=require('../../config/logger')(_0x6973('0x11'));var utils=require('../../config/utils');var config=require(_0x6973('0x12'));var db=require(_0x6973('0x13'))['db'];function respondWithStatusCode(_0x89724f,_0x412a44){_0x412a44=_0x412a44||0xcc;return function(_0x1f22c3){if(_0x1f22c3){return _0x89724f['sendStatus'](_0x412a44);}return _0x89724f[_0x6973('0x14')](_0x412a44)['end']();};}function respondWithResult(_0x4b94a0,_0x2fd777){_0x2fd777=_0x2fd777||0xc8;return function(_0xe6d3e1){if(_0xe6d3e1){return _0x4b94a0['status'](_0x2fd777)['json'](_0xe6d3e1);}};}function respondWithFilteredResult(_0x5b7a25,_0x5a70ca){return function(_0x2b935c){if(_0x2b935c){var _0x451beb=_0x2b935c['count'],_0x4ed1ac=_0x5a70ca[_0x6973('0x15')],_0x47da45=_0x5a70ca[_0x6973('0x15')]+_0x5a70ca[_0x6973('0x16')],_0x1c0c8b;if(_0x47da45>=_0x451beb){_0x47da45=_0x451beb;_0x1c0c8b=0xc8;}else{_0x1c0c8b=0xce;}_0x5b7a25[_0x6973('0x14')](_0x1c0c8b);return _0x5b7a25[_0x6973('0x17')](_0x6973('0x18'),_0x4ed1ac+'-'+_0x47da45+'/'+_0x451beb)[_0x6973('0x19')](_0x2b935c);}return null;};}function patchUpdates(_0x170980){return function(_0x21aa8a){try{jsonpatch[_0x6973('0x1a')](_0x21aa8a,_0x170980,!![]);}catch(_0xfd868a){return BPromise['reject'](_0xfd868a);}return _0x21aa8a[_0x6973('0x1b')]();};}function saveUpdates(_0x4bda29,_0x39c0d1){return function(_0x26bc68){if(_0x26bc68){return _0x26bc68[_0x6973('0x1c')](_0x4bda29)['then'](function(_0x1efb24){return _0x1efb24;});}return null;};}function removeEntity(_0x112b11,_0x262590){return function(_0x3cac38){if(_0x3cac38){return _0x3cac38[_0x6973('0x1d')]()[_0x6973('0x1e')](function(){var _0xe8e661=_0x3cac38['get']({'plain':!![]});var _0x46ad49=_0x6973('0x1f');return db[_0x6973('0x20')][_0x6973('0x1d')]({'where':{'type':_0x46ad49,'resourceId':_0xe8e661['id']}})['then'](function(){return _0x3cac38;});})['then'](function(){_0x112b11[_0x6973('0x14')](0xcc)[_0x6973('0x21')]();});}};}function handleEntityNotFound(_0x520c2a,_0x5ed5b2){return function(_0x409400){if(!_0x409400){_0x520c2a['sendStatus'](0x194);}return _0x409400;};}function handleError(_0x1d2d4a,_0x5406c0){_0x5406c0=_0x5406c0||0x1f4;return function(_0xf73150){logger[_0x6973('0x22')](_0xf73150[_0x6973('0x23')]);if(_0xf73150[_0x6973('0x24')]){delete _0xf73150[_0x6973('0x24')];}_0x1d2d4a[_0x6973('0x14')](_0x5406c0)[_0x6973('0x25')](_0xf73150);};}exports[_0x6973('0x26')]=function(_0x5cf875,_0x173596){var _0x47b451={},_0x5b5710={},_0x3c0c40={'count':0x0,'rows':[]};var _0x411695=db[_0x6973('0x27')][_0x6973('0x28')];_0x5b5710[_0x6973('0x29')]=_[_0x6973('0x2a')](_0x411695);var _0x2e01ff={'dateStart':_0x5cf875[_0x6973('0x2b')][_0x6973('0x2c')],'dateEnd':_0x5cf875[_0x6973('0x2b')][_0x6973('0x2d')]};delete _0x5cf875[_0x6973('0x2b')][_0x6973('0x2c')];delete _0x5cf875[_0x6973('0x2b')][_0x6973('0x2d')];_0x5b5710[_0x6973('0x2b')]=_[_0x6973('0x2a')](_0x5cf875[_0x6973('0x2b')]);_0x5b5710[_0x6973('0x2e')]=_[_0x6973('0x2f')](_0x5b5710[_0x6973('0x29')],_0x5b5710[_0x6973('0x2b')]);_0x47b451[_0x6973('0x30')]=_[_0x6973('0x2f')](_0x5b5710[_0x6973('0x29')],qs[_0x6973('0x31')](_0x5cf875[_0x6973('0x2b')][_0x6973('0x31')]));_0x47b451[_0x6973('0x30')]=_0x47b451[_0x6973('0x30')][_0x6973('0x32')]?_0x47b451[_0x6973('0x30')]:_0x5b5710[_0x6973('0x29')];if(!_0x5cf875['query'][_0x6973('0x33')]('nolimit')){_0x47b451['limit']=qs[_0x6973('0x16')](_0x5cf875[_0x6973('0x2b')]['limit']);_0x47b451[_0x6973('0x15')]=qs[_0x6973('0x15')](_0x5cf875[_0x6973('0x2b')]['offset']);}_0x47b451['order']=qs[_0x6973('0x34')](_0x5cf875[_0x6973('0x2b')]['sort']);_0x47b451[_0x6973('0x35')]=qs[_0x6973('0x2e')](_[_0x6973('0x36')](_0x5cf875[_0x6973('0x2b')],_0x5b5710[_0x6973('0x2e')]));if(_0x2e01ff[_0x6973('0x2c')]){if(_0x2e01ff['dateEnd']){_0x2e01ff[_0x6973('0x2d')]=moment(_0x2e01ff[_0x6973('0x2d')])[_0x6973('0x37')](0x1,_0x6973('0x38'));}else{_0x2e01ff[_0x6973('0x2d')]=moment(_0x2e01ff['dateStart'])['add'](0x1,'day');}_['merge'](_0x47b451[_0x6973('0x35')],{'createdAt':{'$gte':_0x2e01ff[_0x6973('0x2c')],'$lte':_0x2e01ff[_0x6973('0x2d')]}});}if(_0x5cf875[_0x6973('0x2b')]['filter']){_0x47b451['where']=_[_0x6973('0x39')](_0x47b451[_0x6973('0x35')],{'$or':_[_0x6973('0x3a')](_0x47b451['attributes'],function(_0x107319){var _0x224fe2={};_0x224fe2[_0x107319]={'$like':'%'+_0x5cf875[_0x6973('0x2b')][_0x6973('0x3b')]+'%'};return _0x224fe2;})});}_0x47b451=_['merge']({},_0x47b451,_0x5cf875['options']);var _0x150532={'where':_0x47b451[_0x6973('0x35')]};return db['VoiceMusicOnHold'][_0x6973('0x3c')](_0x150532)['then'](function(_0x56c283){_0x3c0c40[_0x6973('0x3c')]=_0x56c283;if(_0x5cf875[_0x6973('0x2b')][_0x6973('0x3d')]){_0x47b451[_0x6973('0x3e')]=[{'all':!![]}];}return db[_0x6973('0x27')][_0x6973('0x3f')](_0x47b451);})[_0x6973('0x1e')](function(_0x570da8){_0x3c0c40[_0x6973('0x40')]=_0x570da8;return _0x3c0c40;})[_0x6973('0x1e')](respondWithFilteredResult(_0x173596,_0x47b451))[_0x6973('0x41')](handleError(_0x173596,null));};exports[_0x6973('0x42')]=function(_0x1e746c,_0x34110a){var _0x58404e={'raw':![],'where':{'id':_0x1e746c[_0x6973('0x43')]['id']}},_0x13932f={};_0x13932f[_0x6973('0x29')]=_[_0x6973('0x2a')](db[_0x6973('0x27')][_0x6973('0x28')]);_0x13932f[_0x6973('0x2b')]=_[_0x6973('0x2a')](_0x1e746c[_0x6973('0x2b')]);_0x13932f[_0x6973('0x2e')]=_[_0x6973('0x2f')](_0x13932f[_0x6973('0x29')],_0x13932f['query']);_0x58404e[_0x6973('0x30')]=_['intersection'](_0x13932f[_0x6973('0x29')],qs[_0x6973('0x31')](_0x1e746c[_0x6973('0x2b')][_0x6973('0x31')]));_0x58404e[_0x6973('0x30')]=_0x58404e[_0x6973('0x30')]['length']?_0x58404e[_0x6973('0x30')]:_0x13932f[_0x6973('0x29')];if(_0x1e746c[_0x6973('0x2b')][_0x6973('0x3d')]){_0x58404e[_0x6973('0x3e')]=[{'all':!![]}];}_0x58404e=_[_0x6973('0x39')]({},_0x58404e,_0x1e746c[_0x6973('0x44')]);return db[_0x6973('0x27')][_0x6973('0x45')](_0x58404e)[_0x6973('0x1e')](handleEntityNotFound(_0x34110a,null))[_0x6973('0x1e')](respondWithResult(_0x34110a,null))[_0x6973('0x41')](handleError(_0x34110a,null));};exports[_0x6973('0x1c')]=function(_0x47543c,_0x27b063){if(_0x47543c[_0x6973('0x46')]['id']){delete _0x47543c[_0x6973('0x46')]['id'];}return db[_0x6973('0x27')]['find']({'where':{'id':_0x47543c['params']['id']}})[_0x6973('0x1e')](handleEntityNotFound(_0x27b063,null))[_0x6973('0x1e')](saveUpdates(_0x47543c[_0x6973('0x46')],null))[_0x6973('0x1e')](respondWithResult(_0x27b063,null))[_0x6973('0x41')](handleError(_0x27b063,null));};exports[_0x6973('0x47')]=function(_0x42a4a9,_0x44f85b,_0x4d1564){return db[_0x6973('0x48')][_0x6973('0x49')](function(_0xa4fb11){if(_0x42a4a9[_0x6973('0x46')]['mode']==='files'){_0x42a4a9[_0x6973('0x46')]['directory']=path[_0x6973('0x4a')](config[_0x6973('0x4b')],_0x6973('0x4c'),_0x42a4a9[_0x6973('0x46')][_0x6973('0x24')]);}return db[_0x6973('0x27')]['create'](_0x42a4a9[_0x6973('0x46')],{'transaction':_0xa4fb11})['then'](function(_0x863afe){if(_0x42a4a9['body'][_0x6973('0x4d')]===_0x6973('0x4e')){fs[_0x6973('0x4f')](_0x863afe['directory'],parseInt(_0x6973('0x50'),0x8));}var _0xc5a2ff=_0x42a4a9[_0x6973('0x51')]['get']({'plain':!![]});if(!_0xc5a2ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc5a2ff['role']===_0x6973('0x51')){var _0x5313dd=_0x863afe[_0x6973('0x52')]({'plain':!![]});return db[_0x6973('0x53')]['find']({'where':{'name':_0x6973('0x1f'),'userProfileId':_0xc5a2ff[_0x6973('0x54')]},'raw':!![]})['then'](function(_0x11aa31){if(_0x11aa31&&_0x11aa31[_0x6973('0x55')]===0x0){return db[_0x6973('0x20')][_0x6973('0x47')]({'name':_0x5313dd[_0x6973('0x24')],'resourceId':_0x5313dd['id'],'type':_0x11aa31[_0x6973('0x24')],'sectionId':_0x11aa31['id']},{})[_0x6973('0x1e')](function(){return _0x863afe;});}else{return _0x863afe;}})['catch'](function(_0x1f25c8){logger[_0x6973('0x22')](_0x6973('0x56'),_0x1f25c8);});}return _0x863afe;});})['then'](respondWithResult(_0x44f85b,0xc9))[_0x6973('0x41')](handleError(_0x44f85b,null));};exports['destroy']=function(_0xfd04cd,_0x5e1e38,_0x49f7f6){var _0x21b73e;return db[_0x6973('0x27')][_0x6973('0x45')]({'where':{'id':_0xfd04cd[_0x6973('0x43')]['id']}})[_0x6973('0x1e')](function(_0x5006c5){if(_0x5006c5){return db['sequelize'][_0x6973('0x49')](function(_0x424ff9){return _0x5006c5[_0x6973('0x1d')]({'transaction':_0x424ff9,'raw':!![]})[_0x6973('0x1e')](function(_0x8e152c){if(_0x8e152c['directory']){fs[_0x6973('0x57')](_0x8e152c[_0x6973('0x58')])[_0x6973('0x59')](function(_0x1133a3){fs[_0x6973('0x5a')](path['join'](_0x8e152c[_0x6973('0x58')],_0x1133a3));});fs['rmdirSync'](_0x8e152c[_0x6973('0x58')]);}return _0x8e152c;});})['catch'](function(_0x550ef7){throw new db['Sequelize'][(_0x6973('0x5b'))](_0x550ef7[_0x6973('0x5c')]);});}})[_0x6973('0x1e')](handleEntityNotFound(_0x5e1e38,null))['then'](removeEntity(_0x5e1e38,null))['catch'](handleError(_0x5e1e38,null));};exports['addSound']=function(_0x2851a6,_0x3abbc7,_0x5ac244){return db[_0x6973('0x48')]['transaction'](function(_0x265267){var _0x517f9f;return db[_0x6973('0x27')]['find']({'where':{'id':_0x2851a6['params']['id']}})['then'](function(_0x37bba2){if(_0x37bba2){_0x517f9f=_0x37bba2;return _0x37bba2[_0x6973('0x5d')](_0x2851a6[_0x6973('0x46')]['id'],{'transaction':_0x265267});}})[_0x6973('0x1e')](function(_0x520b9f){if(_0x520b9f){return db[_0x6973('0x5e')][_0x6973('0x5f')]({'where':{'id':_0x2851a6[_0x6973('0x46')]['id']},'attributes':['id',_0x6973('0x24'),_0x6973('0x60'),'converted_format','createdAt'],'raw':!![]});}})[_0x6973('0x1e')](function(_0x131815){if(_0x131815){var _0x313b2d=path[_0x6973('0x4a')](config[_0x6973('0x4b')],_0x6973('0x61'),util['format'](_0x6973('0x62'),path[_0x6973('0x63')](_0x131815[_0x6973('0x60')],path[_0x6973('0x64')](_0x131815[_0x6973('0x60')])),_0x131815[_0x6973('0x65')]));var _0x51a319=path['join'](config[_0x6973('0x4b')],_0x6973('0x4c'),_0x517f9f[_0x6973('0x24')],util[_0x6973('0x66')](_0x6973('0x62'),_0x131815[_0x6973('0x24')],_0x131815[_0x6973('0x65')]));fs[_0x6973('0x67')](_0x313b2d,_0x51a319);return _0x131815;}})[_0x6973('0x41')](function(_0x4e806e){throw new db['Sequelize'][(_0x6973('0x5b'))](_0x4e806e[_0x6973('0x5c')]);});})[_0x6973('0x1e')](handleEntityNotFound(_0x3abbc7,null))[_0x6973('0x1e')](respondWithResult(_0x3abbc7,0xc9))['catch'](handleError(_0x3abbc7,null));};exports[_0x6973('0x68')]=function(_0x329fed,_0x3ca9c7,_0x5cbe11){return db['sequelize']['transaction'](function(_0x5b7c95){var _0x2783d1;return db[_0x6973('0x27')][_0x6973('0x5f')]({'where':{'id':_0x329fed[_0x6973('0x43')]['id']}})[_0x6973('0x1e')](handleEntityNotFound(_0x3ca9c7,null))[_0x6973('0x1e')](function(_0x2fc12){if(_0x2fc12){_0x2783d1=_0x2fc12;return _0x2fc12['removeSound'](_0x329fed[_0x6973('0x43')][_0x6973('0x69')]);}})['then'](function(_0x288b21){if(_0x288b21){return db[_0x6973('0x5e')][_0x6973('0x5f')]({'where':{'id':_0x329fed[_0x6973('0x43')][_0x6973('0x69')]},'attributes':['id','name',_0x6973('0x60'),_0x6973('0x65'),'createdAt'],'raw':!![]});}})['then'](function(_0x2608bc){if(_0x2608bc){fs[_0x6973('0x5a')](path[_0x6973('0x4a')](_0x2783d1[_0x6973('0x58')],util['format'](_0x6973('0x62'),_0x2608bc[_0x6973('0x24')],_0x2608bc['converted_format'])));return _0x2608bc;}})['catch'](function(_0x191789){throw new db['Sequelize'][(_0x6973('0x5b'))](_0x191789[_0x6973('0x5c')]);});})[_0x6973('0x1e')](handleEntityNotFound(_0x3ca9c7,null))['then'](respondWithStatusCode(_0x3ca9c7,0xcc))[_0x6973('0x41')](handleError(_0x3ca9c7,null));};exports[_0x6973('0x6a')]=function(_0x2db5ea,_0x155e50,_0x36c3df){var _0x478a79={};var _0x3eb907={};var _0x4eea9b;var _0x3f18ed;return db[_0x6973('0x27')]['findOne']({'where':{'id':_0x2db5ea[_0x6973('0x43')]['id']}})[_0x6973('0x1e')](handleEntityNotFound(_0x155e50,null))[_0x6973('0x1e')](function(_0x4de8f3){if(_0x4de8f3){_0x4eea9b=_0x4de8f3;_0x3eb907[_0x6973('0x29')]=_[_0x6973('0x2a')](db[_0x6973('0x5e')][_0x6973('0x28')]);_0x3eb907[_0x6973('0x2b')]=_[_0x6973('0x2a')](_0x2db5ea[_0x6973('0x2b')]);_0x3eb907[_0x6973('0x2e')]=_[_0x6973('0x2f')](_0x3eb907[_0x6973('0x29')],_0x3eb907['query']);_0x478a79[_0x6973('0x30')]=_[_0x6973('0x2f')](_0x3eb907[_0x6973('0x29')],qs['fields'](_0x2db5ea[_0x6973('0x2b')][_0x6973('0x31')]));_0x478a79[_0x6973('0x30')]=_0x478a79[_0x6973('0x30')][_0x6973('0x32')]?_0x478a79[_0x6973('0x30')]:_0x3eb907[_0x6973('0x29')];_0x478a79[_0x6973('0x6b')]=qs['sort'](_0x2db5ea[_0x6973('0x2b')][_0x6973('0x34')]);_0x478a79[_0x6973('0x35')]=qs['filters'](_['pick'](_0x2db5ea[_0x6973('0x2b')],_0x3eb907[_0x6973('0x2e')]));if(_0x2db5ea[_0x6973('0x2b')][_0x6973('0x3b')]){_0x478a79['where']=_[_0x6973('0x39')](_0x478a79[_0x6973('0x35')],{'$or':_['map'](_0x478a79[_0x6973('0x30')],function(_0x546a30){var _0x43abf3={};_0x43abf3[_0x546a30]={'$like':'%'+_0x2db5ea[_0x6973('0x2b')][_0x6973('0x3b')]+'%'};return _0x43abf3;})});}_0x478a79=_['merge']({},_0x478a79,_0x2db5ea[_0x6973('0x44')]);return _0x4eea9b[_0x6973('0x6a')](_0x478a79);}})['then'](function(_0x178582){if(_0x178582){_0x3f18ed=_0x178582['length'];if(!_0x2db5ea[_0x6973('0x2b')][_0x6973('0x33')]('nolimit')){_0x478a79[_0x6973('0x16')]=qs[_0x6973('0x16')](_0x2db5ea[_0x6973('0x2b')]['limit']);_0x478a79['offset']=qs[_0x6973('0x15')](_0x2db5ea[_0x6973('0x2b')][_0x6973('0x15')]);}return _0x4eea9b['getSounds'](_0x478a79);}})['then'](function(_0x4ed693){if(_0x4ed693){return _0x4ed693?{'count':_0x3f18ed,'rows':_0x4ed693}:null;}})[_0x6973('0x1e')](respondWithResult(_0x155e50,null))['catch'](handleError(_0x155e50,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3ce7667..14c1c40 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 _0x0c3f=['../../config/logger','api','moment','request-promise','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x0c3f,0x1b6));var _0xf0c3=function(_0x35099b,_0x31070e){_0x35099b=_0x35099b-0x0;var _0x139dfb=_0x0c3f[_0x35099b];return _0x139dfb;};'use strict';var _=require(_0xf0c3('0x0'));var util=require(_0xf0c3('0x1'));var logger=require(_0xf0c3('0x2'))(_0xf0c3('0x3'));var moment=require(_0xf0c3('0x4'));var BPromise=require('bluebird');var rp=require(_0xf0c3('0x5'));var attributes=require(_0xf0c3('0x6'));module[_0xf0c3('0x7')]=function(_0x10530d,_0x536d69){return _0x10530d['define'](_0xf0c3('0x8'),attributes,{'tableName':_0xf0c3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5845=['api','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger'];(function(_0x139b30,_0x12cfa7){var _0x5af4a3=function(_0x253482){while(--_0x253482){_0x139b30['push'](_0x139b30['shift']());}};_0x5af4a3(++_0x12cfa7);}(_0x5845,0x1be));var _0x5584=function(_0x1faf4a,_0x1e885a){_0x1faf4a=_0x1faf4a-0x0;var _0x380728=_0x5845[_0x1faf4a];return _0x380728;};'use strict';var _=require(_0x5584('0x0'));var util=require('util');var logger=require(_0x5584('0x1'))(_0x5584('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x5584('0x3'));module[_0x5584('0x4')]=function(_0x1fc24b,_0x5e9b5a){return _0x1fc24b[_0x5584('0x5')](_0x5584('0x6'),attributes,{'tableName':_0x5584('0x7'),'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 aedf1f0..e5b9939 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 _0xd957=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x81aa14,_0x283f55){var _0x403a23=function(_0x3d983c){while(--_0x3d983c){_0x81aa14['push'](_0x81aa14['shift']());}};_0x403a23(++_0x283f55);}(_0xd957,0x153));var _0x7d95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd957[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7d95('0x0'));var util=require(_0x7d95('0x1'));var moment=require('moment');var BPromise=require(_0x7d95('0x2'));var rs=require(_0x7d95('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d95('0x4'))['db'];var utils=require(_0x7d95('0x5'));var logger=require(_0x7d95('0x6'))(_0x7d95('0x7'));var config=require(_0x7d95('0x8'));var jayson=require(_0x7d95('0x9'));var client=jayson[_0x7d95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x181ca5,_0x11bb29,_0x4f10ec){return new BPromise(function(_0xfd14f6,_0x399d23){return client[_0x7d95('0xb')](_0x181ca5,_0x4f10ec)[_0x7d95('0xc')](function(_0x173838){logger['info'](_0x7d95('0xd'),_0x11bb29,_0x7d95('0xe'));logger[_0x7d95('0xf')](_0x7d95('0x10'),_0x11bb29,_0x7d95('0xe'),JSON['stringify'](_0x173838));if(_0x173838['error']){if(_0x173838[_0x7d95('0x11')][_0x7d95('0x12')]===0x1f4){logger['error'](_0x7d95('0xd'),_0x11bb29,_0x173838[_0x7d95('0x11')][_0x7d95('0x13')]);return _0x399d23(_0x173838[_0x7d95('0x11')][_0x7d95('0x13')]);}logger[_0x7d95('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x11bb29,_0x173838[_0x7d95('0x11')]['message']);return _0xfd14f6(_0x173838[_0x7d95('0x11')]['message']);}else{logger[_0x7d95('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x11bb29,_0x7d95('0xe'));_0xfd14f6(_0x173838[_0x7d95('0x15')][_0x7d95('0x13')]);}})[_0x7d95('0x16')](function(_0x5ab72e){logger['error'](_0x7d95('0xd'),_0x11bb29,_0x5ab72e);_0x399d23(_0x5ab72e);});});} \ No newline at end of file +var _0x91dd=['request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x119b87,_0x4d95ec){var _0x584f65=function(_0x39910f){while(--_0x39910f){_0x119b87['push'](_0x119b87['shift']());}};_0x584f65(++_0x4d95ec);}(_0x91dd,0x136));var _0xd91d=function(_0x34d9a3,_0x508530){_0x34d9a3=_0x34d9a3-0x0;var _0xc573fc=_0x91dd[_0x34d9a3];return _0xc573fc;};'use strict';var _=require(_0xd91d('0x0'));var util=require(_0xd91d('0x1'));var moment=require(_0xd91d('0x2'));var BPromise=require(_0xd91d('0x3'));var rs=require(_0xd91d('0x4'));var fs=require('fs');var Redis=require(_0xd91d('0x5'));var db=require(_0xd91d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd91d('0x7'))(_0xd91d('0x8'));var config=require(_0xd91d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd91d('0xa')][_0xd91d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a6131,_0x2b30f3,_0x57938a){return new BPromise(function(_0x3f0a25,_0x4431ac){return client[_0xd91d('0xc')](_0x1a6131,_0x57938a)[_0xd91d('0xd')](function(_0x1cd49f){logger[_0xd91d('0xe')](_0xd91d('0xf'),_0x2b30f3,_0xd91d('0x10'));logger[_0xd91d('0x11')](_0xd91d('0x12'),_0x2b30f3,_0xd91d('0x10'),JSON['stringify'](_0x1cd49f));if(_0x1cd49f[_0xd91d('0x13')]){if(_0x1cd49f[_0xd91d('0x13')]['code']===0x1f4){logger['error'](_0xd91d('0xf'),_0x2b30f3,_0x1cd49f[_0xd91d('0x13')][_0xd91d('0x14')]);return _0x4431ac(_0x1cd49f[_0xd91d('0x13')][_0xd91d('0x14')]);}logger[_0xd91d('0x13')](_0xd91d('0xf'),_0x2b30f3,_0x1cd49f[_0xd91d('0x13')][_0xd91d('0x14')]);return _0x3f0a25(_0x1cd49f[_0xd91d('0x13')][_0xd91d('0x14')]);}else{logger[_0xd91d('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2b30f3,_0xd91d('0x10'));_0x3f0a25(_0x1cd49f[_0xd91d('0x15')][_0xd91d('0x14')]);}})[_0xd91d('0x16')](function(_0x2438ef){logger[_0xd91d('0x13')](_0xd91d('0xf'),_0x2b30f3,_0x2438ef);_0x4431ac(_0x2438ef);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 37bb6df..b52b02a 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 _0x2621=['put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','show','post','/:id/users','addAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2621,0x1d2));var _0x1262=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2621[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1262('0x0'));var util=require(_0x1262('0x1'));var path=require(_0x1262('0x2'));var timeout=require(_0x1262('0x3'));var express=require(_0x1262('0x4'));var router=express[_0x1262('0x5')]();var auth=require(_0x1262('0x6'));var interaction=require(_0x1262('0x7'));var config=require(_0x1262('0x8'));var controller=require(_0x1262('0x9'));router[_0x1262('0xa')]('/',auth[_0x1262('0xb')](),controller[_0x1262('0xc')]);router[_0x1262('0xa')]('/describe',auth[_0x1262('0xb')](),controller['describe']);router[_0x1262('0xa')]('/:id',auth[_0x1262('0xb')](),controller[_0x1262('0xd')]);router[_0x1262('0xa')]('/:id/users',auth[_0x1262('0xb')](),controller['getAgents']);router[_0x1262('0xe')]('/',auth[_0x1262('0xb')](),controller['create']);router['post'](_0x1262('0xf'),auth[_0x1262('0xb')](),controller[_0x1262('0x10')]);router[_0x1262('0x11')](_0x1262('0x12'),auth[_0x1262('0xb')](),controller['update']);router[_0x1262('0x13')](_0x1262('0x12'),auth[_0x1262('0xb')](),controller['destroy']);router[_0x1262('0x13')](_0x1262('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1262('0x14')]=router; \ No newline at end of file +var _0x1ae3=['isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','post','addAgents','update','destroy','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x1ae3,0x139));var _0x31ae=function(_0x4db868,_0x2841d3){_0x4db868=_0x4db868-0x0;var _0x38df8a=_0x1ae3[_0x4db868];return _0x38df8a;};'use strict';var multer=require(_0x31ae('0x0'));var util=require(_0x31ae('0x1'));var path=require('path');var timeout=require(_0x31ae('0x2'));var express=require(_0x31ae('0x3'));var router=express[_0x31ae('0x4')]();var auth=require(_0x31ae('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x31ae('0x6'));var controller=require(_0x31ae('0x7'));router[_0x31ae('0x8')]('/',auth[_0x31ae('0x9')](),controller[_0x31ae('0xa')]);router[_0x31ae('0x8')](_0x31ae('0xb'),auth[_0x31ae('0x9')](),controller[_0x31ae('0xc')]);router[_0x31ae('0x8')](_0x31ae('0xd'),auth[_0x31ae('0x9')](),controller[_0x31ae('0xe')]);router[_0x31ae('0x8')](_0x31ae('0xf'),auth['isAuthenticated'](),controller[_0x31ae('0x10')]);router[_0x31ae('0x11')]('/',auth[_0x31ae('0x9')](),controller['create']);router[_0x31ae('0x11')](_0x31ae('0xf'),auth['isAuthenticated'](),controller[_0x31ae('0x12')]);router['put'](_0x31ae('0xd'),auth[_0x31ae('0x9')](),controller[_0x31ae('0x13')]);router['delete'](_0x31ae('0xd'),auth[_0x31ae('0x9')](),controller[_0x31ae('0x14')]);router[_0x31ae('0x15')](_0x31ae('0xf'),auth[_0x31ae('0x9')](),controller['removeAgents']);module[_0x31ae('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1a181eb..0761230 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 _0xe0eb=['exports','STRING','name','VIRTUAL','system-','INTEGER','sequelize'];(function(_0x5c0b9a,_0x1c814d){var _0x39f82b=function(_0x272d95){while(--_0x272d95){_0x5c0b9a['push'](_0x5c0b9a['shift']());}};_0x39f82b(++_0x1c814d);}(_0xe0eb,0x117));var _0xbe0e=function(_0x2a0824,_0x21d97a){_0x2a0824=_0x2a0824-0x0;var _0x1a78f7=_0xe0eb[_0x2a0824];return _0x1a78f7;};'use strict';var Sequelize=require(_0xbe0e('0x0'));module[_0xbe0e('0x1')]={'name':{'type':Sequelize[_0xbe0e('0x2')],'allowNull':![],'unique':_0xbe0e('0x3')},'prefix':{'type':Sequelize[_0xbe0e('0x4')],'get':function(_0x1c479a){return _0xbe0e('0x5')+this['getDataValue'](_0xbe0e('0x3'))+'-';}},'description':{'type':Sequelize[_0xbe0e('0x2')]},'callerIdAll':{'type':Sequelize[_0xbe0e('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xbe0e('0x6')]}}; \ No newline at end of file +var _0x95a8=['sequelize','exports','STRING','name','system-','getDataValue','INTEGER'];(function(_0x2e68db,_0x275d04){var _0x12df4c=function(_0x1b6701){while(--_0x1b6701){_0x2e68db['push'](_0x2e68db['shift']());}};_0x12df4c(++_0x275d04);}(_0x95a8,0x1b9));var _0x895a=function(_0x12c43b,_0x2197f6){_0x12c43b=_0x12c43b-0x0;var _0x1ffd81=_0x95a8[_0x12c43b];return _0x1ffd81;};'use strict';var Sequelize=require(_0x895a('0x0'));module[_0x895a('0x1')]={'name':{'type':Sequelize[_0x895a('0x2')],'allowNull':![],'unique':_0x895a('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x427df8){return _0x895a('0x4')+this[_0x895a('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x895a('0x2')]},'callerIdAll':{'type':Sequelize[_0x895a('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x895a('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f3ccf6d..15e64c0 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 _0xed11=['redis','socket.io-emitter','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','VoicePrefix','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','day','add','merge','options','count','includeAll','include','findAll','rows','catch','show','find','params','describe','sequelize','transaction','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','filter','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5e9049,_0x4c39f1){var _0x272c94=function(_0x28cf2d){while(--_0x28cf2d){_0x5e9049['push'](_0x5e9049['shift']());}};_0x272c94(++_0x4c39f1);}(_0xed11,0x15b));var _0x1ed1=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xed11[_0x2a6809];return _0x11c371;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1ed1('0x0'));var rimraf=require(_0x1ed1('0x1'));var zipdir=require(_0x1ed1('0x2'));var jsonpatch=require(_0x1ed1('0x3'));var rp=require(_0x1ed1('0x4'));var moment=require(_0x1ed1('0x5'));var BPromise=require(_0x1ed1('0x6'));var Mustache=require(_0x1ed1('0x7'));var util=require(_0x1ed1('0x8'));var path=require(_0x1ed1('0x9'));var sox=require(_0x1ed1('0xa'));var csv=require(_0x1ed1('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ed1('0xc'));var squel=require('squel');var crypto=require(_0x1ed1('0xd'));var jsforce=require(_0x1ed1('0xe'));var deskjs=require(_0x1ed1('0xf'));var toCsv=require(_0x1ed1('0xb'));var querystring=require('querystring');var Papa=require(_0x1ed1('0x10'));var Redis=require(_0x1ed1('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x1ed1('0x12'))(_0x1ed1('0x13'));var utils=require(_0x1ed1('0x14'));var config=require(_0x1ed1('0x15'));var db=require('../../mysqldb')['db'];config[_0x1ed1('0x16')]=_['defaults'](config[_0x1ed1('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ed1('0x17'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x1ed1('0x18')](socket);function respondWithStatusCode(_0x2620cb,_0x2858cd){_0x2858cd=_0x2858cd||0xcc;return function(_0x47cc74){if(_0x47cc74){return _0x2620cb[_0x1ed1('0x19')](_0x2858cd);}return _0x2620cb[_0x1ed1('0x1a')](_0x2858cd)['end']();};}function respondWithResult(_0x52b9e2,_0x31b4ec){_0x31b4ec=_0x31b4ec||0xc8;return function(_0x5b0b13){if(_0x5b0b13){return _0x52b9e2[_0x1ed1('0x1a')](_0x31b4ec)[_0x1ed1('0x1b')](_0x5b0b13);}};}function respondWithFilteredResult(_0x10de0c,_0x1f06ff){return function(_0x18a39e){if(_0x18a39e){var _0x1aa071=_0x18a39e['count'],_0x3f8ad6=_0x1f06ff[_0x1ed1('0x1c')],_0x4d341f=_0x1f06ff[_0x1ed1('0x1c')]+_0x1f06ff[_0x1ed1('0x1d')],_0x4cc804;if(_0x4d341f>=_0x1aa071){_0x4d341f=_0x1aa071;_0x4cc804=0xc8;}else{_0x4cc804=0xce;}_0x10de0c[_0x1ed1('0x1a')](_0x4cc804);return _0x10de0c[_0x1ed1('0x1e')](_0x1ed1('0x1f'),_0x3f8ad6+'-'+_0x4d341f+'/'+_0x1aa071)['json'](_0x18a39e);}return null;};}function patchUpdates(_0x1985d8){return function(_0x37df1e){try{jsonpatch[_0x1ed1('0x20')](_0x37df1e,_0x1985d8,!![]);}catch(_0x112958){return BPromise[_0x1ed1('0x21')](_0x112958);}return _0x37df1e[_0x1ed1('0x22')]();};}function saveUpdates(_0x3113d1,_0x5e7be2){return function(_0x3c6ba8){if(_0x3c6ba8){return _0x3c6ba8[_0x1ed1('0x23')](_0x3113d1)[_0x1ed1('0x24')](function(_0x1cd0e8){return _0x1cd0e8;});}return null;};}function removeEntity(_0x44d51b,_0x42572b){return function(_0x53c612){if(_0x53c612){return _0x53c612[_0x1ed1('0x25')]()[_0x1ed1('0x24')](function(){var _0x2e1ee1=_0x53c612[_0x1ed1('0x26')]({'plain':!![]});var _0x2aa303=_0x1ed1('0x27');return db[_0x1ed1('0x28')]['destroy']({'where':{'type':_0x2aa303,'resourceId':_0x2e1ee1['id']}})[_0x1ed1('0x24')](function(){return _0x53c612;});})['then'](function(){_0x44d51b[_0x1ed1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5228a7,_0x2b2d36){return function(_0x44ee28){if(!_0x44ee28){_0x5228a7[_0x1ed1('0x19')](0x194);}return _0x44ee28;};}function handleError(_0x5185de,_0x1cca03){_0x1cca03=_0x1cca03||0x1f4;return function(_0x1c9624){logger[_0x1ed1('0x29')](_0x1c9624[_0x1ed1('0x2a')]);if(_0x1c9624[_0x1ed1('0x2b')]){delete _0x1c9624['name'];}_0x5185de['status'](_0x1cca03)[_0x1ed1('0x2c')](_0x1c9624);};}exports[_0x1ed1('0x2d')]=function(_0x2cb843,_0x3d6fe4){var _0x54cc34={},_0x516bc1={},_0x28d6aa={'count':0x0,'rows':[]};var _0x4a57d4=db[_0x1ed1('0x2e')][_0x1ed1('0x2f')];_0x516bc1['model']=_[_0x1ed1('0x30')](_0x4a57d4);var _0x408829={'dateStart':_0x2cb843[_0x1ed1('0x31')][_0x1ed1('0x32')],'dateEnd':_0x2cb843['query'][_0x1ed1('0x33')]};delete _0x2cb843[_0x1ed1('0x31')][_0x1ed1('0x32')];delete _0x2cb843[_0x1ed1('0x31')][_0x1ed1('0x33')];_0x516bc1[_0x1ed1('0x31')]=_[_0x1ed1('0x30')](_0x2cb843[_0x1ed1('0x31')]);_0x516bc1[_0x1ed1('0x34')]=_[_0x1ed1('0x35')](_0x516bc1[_0x1ed1('0x36')],_0x516bc1[_0x1ed1('0x31')]);_0x54cc34[_0x1ed1('0x37')]=_['intersection'](_0x516bc1[_0x1ed1('0x36')],qs[_0x1ed1('0x38')](_0x2cb843[_0x1ed1('0x31')][_0x1ed1('0x38')]));_0x54cc34[_0x1ed1('0x37')]=_0x54cc34['attributes'][_0x1ed1('0x39')]?_0x54cc34['attributes']:_0x516bc1[_0x1ed1('0x36')];if(!_0x2cb843[_0x1ed1('0x31')][_0x1ed1('0x3a')](_0x1ed1('0x3b'))){_0x54cc34['limit']=qs[_0x1ed1('0x1d')](_0x2cb843[_0x1ed1('0x31')]['limit']);_0x54cc34[_0x1ed1('0x1c')]=qs[_0x1ed1('0x1c')](_0x2cb843[_0x1ed1('0x31')][_0x1ed1('0x1c')]);}_0x54cc34[_0x1ed1('0x3c')]=qs[_0x1ed1('0x3d')](_0x2cb843[_0x1ed1('0x31')]['sort']);_0x54cc34[_0x1ed1('0x3e')]=qs[_0x1ed1('0x34')](_['pick'](_0x2cb843[_0x1ed1('0x31')],_0x516bc1[_0x1ed1('0x34')]));if(_0x408829[_0x1ed1('0x32')]){if(_0x408829[_0x1ed1('0x33')]){_0x408829[_0x1ed1('0x33')]=moment(_0x408829[_0x1ed1('0x33')])['add'](0x1,_0x1ed1('0x3f'));}else{_0x408829['dateEnd']=moment(_0x408829['dateStart'])[_0x1ed1('0x40')](0x1,'day');}_['merge'](_0x54cc34[_0x1ed1('0x3e')],{'createdAt':{'$gte':_0x408829[_0x1ed1('0x32')],'$lte':_0x408829[_0x1ed1('0x33')]}});}if(_0x2cb843[_0x1ed1('0x31')]['filter']){_0x54cc34['where']=_[_0x1ed1('0x41')](_0x54cc34[_0x1ed1('0x3e')],{'$or':_['map'](_0x54cc34[_0x1ed1('0x37')],function(_0x1ee6db){var _0x30ac72={};_0x30ac72[_0x1ee6db]={'$like':'%'+_0x2cb843['query']['filter']+'%'};return _0x30ac72;})});}_0x54cc34=_[_0x1ed1('0x41')]({},_0x54cc34,_0x2cb843[_0x1ed1('0x42')]);var _0x181797={'where':_0x54cc34[_0x1ed1('0x3e')]};return db['VoicePrefix'][_0x1ed1('0x43')](_0x181797)[_0x1ed1('0x24')](function(_0x59f5a3){_0x28d6aa[_0x1ed1('0x43')]=_0x59f5a3;if(_0x2cb843[_0x1ed1('0x31')][_0x1ed1('0x44')]){_0x54cc34[_0x1ed1('0x45')]=[{'all':!![]}];}return db['VoicePrefix'][_0x1ed1('0x46')](_0x54cc34);})['then'](function(_0xdb4837){_0x28d6aa[_0x1ed1('0x47')]=_0xdb4837;return _0x28d6aa;})[_0x1ed1('0x24')](respondWithFilteredResult(_0x3d6fe4,_0x54cc34))[_0x1ed1('0x48')](handleError(_0x3d6fe4,null));};exports[_0x1ed1('0x49')]=function(_0x9e3621,_0x18e31b){var _0x21ca1c={'raw':![],'where':{'id':_0x9e3621['params']['id']}},_0x5545dd={};_0x5545dd[_0x1ed1('0x36')]=_[_0x1ed1('0x30')](db[_0x1ed1('0x2e')][_0x1ed1('0x2f')]);_0x5545dd[_0x1ed1('0x31')]=_['keys'](_0x9e3621['query']);_0x5545dd[_0x1ed1('0x34')]=_['intersection'](_0x5545dd[_0x1ed1('0x36')],_0x5545dd[_0x1ed1('0x31')]);_0x21ca1c[_0x1ed1('0x37')]=_[_0x1ed1('0x35')](_0x5545dd[_0x1ed1('0x36')],qs[_0x1ed1('0x38')](_0x9e3621['query'][_0x1ed1('0x38')]));_0x21ca1c[_0x1ed1('0x37')]=_0x21ca1c['attributes'][_0x1ed1('0x39')]?_0x21ca1c[_0x1ed1('0x37')]:_0x5545dd[_0x1ed1('0x36')];if(_0x9e3621[_0x1ed1('0x31')]['includeAll']){_0x21ca1c['include']=[{'all':!![]}];}_0x21ca1c=_[_0x1ed1('0x41')]({},_0x21ca1c,_0x9e3621['options']);return db[_0x1ed1('0x2e')][_0x1ed1('0x4a')](_0x21ca1c)[_0x1ed1('0x24')](handleEntityNotFound(_0x18e31b,null))['then'](respondWithResult(_0x18e31b,null))[_0x1ed1('0x48')](handleError(_0x18e31b,null));};exports[_0x1ed1('0x25')]=function(_0x69ceb3,_0x1376e5){return db[_0x1ed1('0x2e')]['find']({'where':{'id':_0x69ceb3[_0x1ed1('0x4b')]['id']}})[_0x1ed1('0x24')](handleEntityNotFound(_0x1376e5,null))[_0x1ed1('0x24')](removeEntity(_0x1376e5,null))[_0x1ed1('0x48')](handleError(_0x1376e5,null));};exports[_0x1ed1('0x4c')]=function(_0x13cdd1,_0x1d4f65){return db[_0x1ed1('0x2e')][_0x1ed1('0x4c')]()[_0x1ed1('0x24')](respondWithResult(_0x1d4f65,null))[_0x1ed1('0x48')](handleError(_0x1d4f65,null));};exports['create']=function(_0x20c4a9,_0x5ec2b4){var _0x1a6efe;return db[_0x1ed1('0x4d')][_0x1ed1('0x4e')](function(_0x414517){return db['VoicePrefix'][_0x1ed1('0x4f')](_0x20c4a9[_0x1ed1('0x50')],{'transaction':_0x414517})['then'](function(_0x2d8f56){_0x1a6efe=_0x2d8f56[_0x1ed1('0x26')]({'plain':!![]});return db[_0x1ed1('0x51')][_0x1ed1('0x4a')]({'where':{'id':_0x1a6efe[_0x1ed1('0x52')]},'raw':!![]})['then'](function(_0x13f403){return createVoicePrefixExtensions(_0x1a6efe,_0x13f403,_0x414517);});});})[_0x1ed1('0x24')](function(){var _0x8af3df=_0x20c4a9[_0x1ed1('0x53')][_0x1ed1('0x26')]({'plain':!![]});if(!_0x8af3df)throw new Error(_0x1ed1('0x54'));if(_0x8af3df[_0x1ed1('0x55')]==='user'){var _0x823cde=_0x1a6efe;return db['UserProfileSection'][_0x1ed1('0x4a')]({'where':{'name':_0x1ed1('0x27'),'userProfileId':_0x8af3df[_0x1ed1('0x56')]},'raw':!![]})[_0x1ed1('0x24')](function(_0x13efd6){if(_0x13efd6&&_0x13efd6['autoAssociation']===0x0){return db[_0x1ed1('0x28')][_0x1ed1('0x4f')]({'name':_0x823cde[_0x1ed1('0x2b')],'resourceId':_0x823cde['id'],'type':_0x13efd6[_0x1ed1('0x2b')],'sectionId':_0x13efd6['id']},{})['then'](function(){return _0x1a6efe;});}else{return _0x1a6efe;}})[_0x1ed1('0x48')](function(_0x5a0593){logger[_0x1ed1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a0593);throw _0x5a0593;});}return _0x1a6efe;})[_0x1ed1('0x24')](respondWithResult(_0x5ec2b4,null))[_0x1ed1('0x48')](handleError(_0x5ec2b4,null));};function Extension(_0x2aa8ce,_0x1e9e72,_0x33cfea,_0x3d1f4d){this[_0x1ed1('0x57')]=_0x1ed1('0x58');this[_0x1ed1('0x59')]=_0x2aa8ce;this[_0x1ed1('0x5a')]=_0x33cfea;this['type']='system';this[_0x1ed1('0x5b')]=_0x1ed1('0x5c');this[_0x1ed1('0x5d')]=_0x1e9e72;this['appdata']=_0x3d1f4d;}function createVoicePrefixExtensions(_0x525f8c,_0x4746c0,_0x5bd95e){return new BPromise(function(_0x26054f,_0x17a12c){var _0x3baf83=new Extension(formatPrefixName(_0x525f8c[_0x1ed1('0x5e')]),0x1,_0x1ed1('0x5f'),_0x1ed1('0x60'));_0x3baf83[_0x1ed1('0x61')]=_0x525f8c['id'];return db[_0x1ed1('0x51')]['create'](_0x3baf83,{'transaction':_0x5bd95e})[_0x1ed1('0x24')](function(_0x174f3e){var _0x2254ca=_0x174f3e[_0x1ed1('0x26')]({'plain':!![]});var _0x4bcdb1=_['map'](addVoicePrefixExtensions(_0x525f8c,_0x4746c0),function(_0x457ce9){_0x457ce9[_0x1ed1('0x52')]=_0x2254ca['id'];_0x457ce9[_0x1ed1('0x61')]=_0x525f8c['id'];return _0x457ce9;});return db[_0x1ed1('0x51')][_0x1ed1('0x62')](_0x4bcdb1,{'transaction':_0x5bd95e})['then'](function(_0x1a7df3){if(!_0x1a7df3){return _0x17a12c(_0x1ed1('0x63'));}else{return _0x26054f(_0x1a7df3);}})[_0x1ed1('0x48')](function(_0x5019cd){return _0x17a12c(_0x5019cd);});});;});};function addVoicePrefixExtensions(_0x390dde,_0x1e5053){var _0xc8ef3=[];var _0x45665b=formatPrefixName(_0x390dde[_0x1ed1('0x5e')]);_0xc8ef3[_0x1ed1('0x64')](new Extension(_0x45665b,0x2,_0x1ed1('0x65'),_0x1ed1('0x66')+_0x390dde[_0x1ed1('0x2b')]));if(_0x390dde[_0x1ed1('0x67')]){_0xc8ef3[_0x1ed1('0x64')](new Extension(_0x45665b,0x3,_0x1ed1('0x65'),_0x1ed1('0x68')+_0x390dde[_0x1ed1('0x67')]));}else{_0xc8ef3[_0x1ed1('0x64')](new Extension(_0x45665b,0x3,'NoOp',_0x1ed1('0x69')));}_0xc8ef3[_0x1ed1('0x64')](new Extension(_0x45665b,0x4,'goto',_0x1e5053[_0x1ed1('0x57')]+','+'${EXTEN:'+(0x8+_0x390dde['name'][_0x1ed1('0x39')])+'}'+','+0x1));return _0xc8ef3;}function formatPrefixName(_0x39d8dc){var _0x5206b7='_';for(var _0x26a356=0x0;_0x26a356<_0x39d8dc['length'];_0x26a356++){if(_0x39d8dc[_0x1ed1('0x6a')](_0x26a356)=='-'){_0x5206b7+=_0x39d8dc[_0x1ed1('0x6a')](_0x26a356);}else{_0x5206b7+='['+_0x39d8dc[_0x1ed1('0x6a')](_0x26a356)+']';}}_0x5206b7+='.';return _0x5206b7;}exports[_0x1ed1('0x23')]=function(_0x207742,_0x2b7529,_0x4a54f3){var _0x125368=_0x207742['body'];_0x125368[_0x1ed1('0x5e')]=_0x1ed1('0x6b')+_0x125368[_0x1ed1('0x2b')]+'-';return db[_0x1ed1('0x4d')][_0x1ed1('0x4e')](function(_0x404ad8){return db[_0x1ed1('0x2e')][_0x1ed1('0x23')](_0x125368,{'where':{'id':_0x125368['id']},'transaction':_0x404ad8})[_0x1ed1('0x24')](function(){return db[_0x1ed1('0x51')]['destroy']({'where':{'VoicePrefixId':_0x125368['id']},'transaction':_0x404ad8})['then'](function(){return db[_0x1ed1('0x51')][_0x1ed1('0x4a')]({'where':{'id':_0x125368[_0x1ed1('0x52')]},'raw':!![]})['then'](function(_0x1190d9){return createVoicePrefixExtensions(_0x125368,_0x1190d9,_0x404ad8);});});});})[_0x1ed1('0x24')](function(){return db[_0x1ed1('0x2e')][_0x1ed1('0x6c')](_0x125368['id']);})[_0x1ed1('0x24')](respondWithResult(_0x2b7529,null))[_0x1ed1('0x48')](handleError(_0x2b7529,null));};exports[_0x1ed1('0x6d')]=function(_0x471e60,_0x1e1cd5,_0x897420){return db['VoicePrefix'][_0x1ed1('0x4a')]({'where':{'id':_0x471e60[_0x1ed1('0x4b')]['id']}})[_0x1ed1('0x24')](handleEntityNotFound(_0x1e1cd5,null))[_0x1ed1('0x24')](function(_0xc1774c){if(_0xc1774c){return _0xc1774c['addAgents'](_0x471e60[_0x1ed1('0x50')]['ids'],_[_0x1ed1('0x6e')](_0x471e60['body'],[_0x1ed1('0x6f'),'id'])||{})[_0x1ed1('0x70')](function(_0xd1973){for(var _0x53d138=0x0;_0x53d138<_0x471e60[_0x1ed1('0x50')][_0x1ed1('0x6f')][_0x1ed1('0x39')];_0x53d138+=0x1){socket[_0x1ed1('0x71')](_0x1ed1('0x72'),{'UserId':_0x471e60[_0x1ed1('0x50')][_0x1ed1('0x6f')][_0x53d138],'VoicePrefixId':_0x471e60[_0x1ed1('0x4b')]['id']});}return _0xd1973;});}})[_0x1ed1('0x24')](respondWithResult(_0x1e1cd5,null))[_0x1ed1('0x48')](handleError(_0x1e1cd5,null));};exports['removeAgents']=function(_0x4699d0,_0x38fbcd,_0x12762f){var _0x1ccc58;return db[_0x1ed1('0x2e')][_0x1ed1('0x4a')]({'where':{'id':_0x4699d0[_0x1ed1('0x4b')]['id']}})[_0x1ed1('0x24')](handleEntityNotFound(_0x38fbcd,null))['then'](function(_0x20d655){if(_0x20d655){return _0x20d655[_0x1ed1('0x73')](_0x4699d0[_0x1ed1('0x31')]['ids'])['then'](function(_0x3d7129){if(_[_0x1ed1('0x74')](_0x4699d0[_0x1ed1('0x31')][_0x1ed1('0x6f')])){for(var _0x4a078c=0x0;_0x4a078c<_0x4699d0[_0x1ed1('0x31')]['ids']['length'];_0x4a078c+=0x1){socket[_0x1ed1('0x71')](_0x1ed1('0x75'),{'UserId':_0x4699d0[_0x1ed1('0x31')][_0x1ed1('0x6f')][_0x4a078c],'VoicePrefixId':_0x4699d0[_0x1ed1('0x4b')]['id']});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':_0x4699d0[_0x1ed1('0x31')][_0x1ed1('0x6f')],'VoicePrefixId':_0x4699d0[_0x1ed1('0x4b')]['id']});}});}})[_0x1ed1('0x24')](respondWithStatusCode(_0x38fbcd,null))[_0x1ed1('0x48')](handleError(_0x38fbcd,null));};exports['getAgents']=function(_0x4ad506,_0x59d33e,_0x1ed26c){var _0x28b985={};var _0x3038be={};var _0x1875ca;var _0x18c8ce;return db[_0x1ed1('0x2e')][_0x1ed1('0x76')]({'where':{'id':_0x4ad506[_0x1ed1('0x4b')]['id']}})[_0x1ed1('0x24')](handleEntityNotFound(_0x59d33e,null))['then'](function(_0x596a49){if(_0x596a49){_0x1875ca=_0x596a49;_0x3038be[_0x1ed1('0x36')]=_[_0x1ed1('0x30')](db[_0x1ed1('0x77')][_0x1ed1('0x2f')]);_0x3038be[_0x1ed1('0x31')]=_[_0x1ed1('0x30')](_0x4ad506[_0x1ed1('0x31')]);_0x3038be[_0x1ed1('0x34')]=_[_0x1ed1('0x35')](_0x3038be[_0x1ed1('0x36')],_0x3038be[_0x1ed1('0x31')]);_0x28b985['attributes']=_['intersection'](_0x3038be[_0x1ed1('0x36')],qs[_0x1ed1('0x38')](_0x4ad506[_0x1ed1('0x31')][_0x1ed1('0x38')]));_0x28b985[_0x1ed1('0x37')]=_0x28b985['attributes'][_0x1ed1('0x39')]?_0x28b985[_0x1ed1('0x37')]:_0x3038be[_0x1ed1('0x36')];_0x28b985[_0x1ed1('0x3c')]=qs[_0x1ed1('0x3d')](_0x4ad506[_0x1ed1('0x31')][_0x1ed1('0x3d')]);_0x28b985['where']=qs[_0x1ed1('0x34')](_[_0x1ed1('0x78')](_0x4ad506[_0x1ed1('0x31')],_0x3038be[_0x1ed1('0x34')]));if(_0x4ad506['query']['filter']){_0x28b985['where']=_[_0x1ed1('0x41')](_0x28b985['where'],{'$or':_['map'](_0x28b985['attributes'],function(_0x27f482){var _0x5ccb2a={};_0x5ccb2a[_0x27f482]={'$like':'%'+_0x4ad506[_0x1ed1('0x31')][_0x1ed1('0x79')]+'%'};return _0x5ccb2a;})});}_0x28b985=_[_0x1ed1('0x41')]({},_0x28b985,_0x4ad506['options']);return _0x1875ca[_0x1ed1('0x7a')](_0x28b985);}})[_0x1ed1('0x24')](function(_0x1998c8){if(_0x1998c8){_0x18c8ce=_0x1998c8['length'];if(!_0x4ad506[_0x1ed1('0x31')][_0x1ed1('0x3a')]('nolimit')){_0x28b985['limit']=qs[_0x1ed1('0x1d')](_0x4ad506[_0x1ed1('0x31')][_0x1ed1('0x1d')]);_0x28b985['offset']=qs[_0x1ed1('0x1c')](_0x4ad506[_0x1ed1('0x31')]['offset']);}return _0x1875ca[_0x1ed1('0x7a')](_0x28b985);}})[_0x1ed1('0x24')](function(_0x34b0a6){if(_0x34b0a6){return _0x34b0a6?{'count':_0x18c8ce,'rows':_0x34b0a6}:null;}})[_0x1ed1('0x24')](respondWithResult(_0x59d33e,null))['catch'](handleError(_0x59d33e,null));}; \ No newline at end of file +var _0xf441=['limit','set','apply','save','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','VoicePrefix','keys','query','dateStart','dateEnd','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','add','day','filter','merge','map','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','charAt','update','body','system-','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','order','html-pdf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset'];(function(_0x5af2d4,_0x133ed0){var _0x490013=function(_0x4680d8){while(--_0x4680d8){_0x5af2d4['push'](_0x5af2d4['shift']());}};_0x490013(++_0x133ed0);}(_0xf441,0x14d));var _0x1f44=function(_0x2e6a69,_0x1ba014){_0x2e6a69=_0x2e6a69-0x0;var _0x583b2a=_0xf441[_0x2e6a69];return _0x583b2a;};'use strict';var pdf=require(_0x1f44('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f44('0x1'));var rp=require(_0x1f44('0x2'));var moment=require(_0x1f44('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1f44('0x4'));var sox=require(_0x1f44('0x5'));var csv=require(_0x1f44('0x6'));var ejs=require(_0x1f44('0x7'));var fs=require('fs');var _=require(_0x1f44('0x8'));var squel=require(_0x1f44('0x9'));var crypto=require('crypto');var jsforce=require(_0x1f44('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1f44('0x6'));var querystring=require(_0x1f44('0xb'));var Papa=require(_0x1f44('0xc'));var Redis=require(_0x1f44('0xd'));var qs=require(_0x1f44('0xe'));var logger=require('../../config/logger')(_0x1f44('0xf'));var utils=require(_0x1f44('0x10'));var config=require(_0x1f44('0x11'));var db=require(_0x1f44('0x12'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1f44('0x13'),'port':0x18eb});var socket=require(_0x1f44('0x14'))(new Redis(config[_0x1f44('0x15')]));require(_0x1f44('0x16'))[_0x1f44('0x17')](socket);function respondWithStatusCode(_0x540e6b,_0x272223){_0x272223=_0x272223||0xcc;return function(_0x3916ea){if(_0x3916ea){return _0x540e6b[_0x1f44('0x18')](_0x272223);}return _0x540e6b[_0x1f44('0x19')](_0x272223)[_0x1f44('0x1a')]();};}function respondWithResult(_0x2622be,_0x2b0908){_0x2b0908=_0x2b0908||0xc8;return function(_0x51acdf){if(_0x51acdf){return _0x2622be[_0x1f44('0x19')](_0x2b0908)[_0x1f44('0x1b')](_0x51acdf);}};}function respondWithFilteredResult(_0x3fd6d6,_0x433626){return function(_0x3fa7e7){if(_0x3fa7e7){var _0x34e9de=_0x3fa7e7[_0x1f44('0x1c')],_0x111e7d=_0x433626['offset'],_0x2a56a5=_0x433626[_0x1f44('0x1d')]+_0x433626[_0x1f44('0x1e')],_0xe47b1d;if(_0x2a56a5>=_0x34e9de){_0x2a56a5=_0x34e9de;_0xe47b1d=0xc8;}else{_0xe47b1d=0xce;}_0x3fd6d6[_0x1f44('0x19')](_0xe47b1d);return _0x3fd6d6[_0x1f44('0x1f')]('Content-Range',_0x111e7d+'-'+_0x2a56a5+'/'+_0x34e9de)[_0x1f44('0x1b')](_0x3fa7e7);}return null;};}function patchUpdates(_0x2bc89d){return function(_0x597d64){try{jsonpatch[_0x1f44('0x20')](_0x597d64,_0x2bc89d,!![]);}catch(_0x243366){return BPromise['reject'](_0x243366);}return _0x597d64[_0x1f44('0x21')]();};}function saveUpdates(_0x42c554,_0x2cdb1b){return function(_0xef711e){if(_0xef711e){return _0xef711e['update'](_0x42c554)[_0x1f44('0x22')](function(_0x36b07a){return _0x36b07a;});}return null;};}function removeEntity(_0x32ad8c,_0x509d84){return function(_0x1a9ef4){if(_0x1a9ef4){return _0x1a9ef4[_0x1f44('0x23')]()[_0x1f44('0x22')](function(){var _0x234d25=_0x1a9ef4[_0x1f44('0x24')]({'plain':!![]});var _0x53e0b9=_0x1f44('0x25');return db[_0x1f44('0x26')][_0x1f44('0x23')]({'where':{'type':_0x53e0b9,'resourceId':_0x234d25['id']}})['then'](function(){return _0x1a9ef4;});})[_0x1f44('0x22')](function(){_0x32ad8c[_0x1f44('0x19')](0xcc)[_0x1f44('0x1a')]();});}};}function handleEntityNotFound(_0x46fc62,_0x4da085){return function(_0x258a11){if(!_0x258a11){_0x46fc62[_0x1f44('0x18')](0x194);}return _0x258a11;};}function handleError(_0x349c83,_0x176403){_0x176403=_0x176403||0x1f4;return function(_0x36329c){logger[_0x1f44('0x27')](_0x36329c[_0x1f44('0x28')]);if(_0x36329c['name']){delete _0x36329c[_0x1f44('0x29')];}_0x349c83[_0x1f44('0x19')](_0x176403)[_0x1f44('0x2a')](_0x36329c);};}exports['index']=function(_0x24c50c,_0x9e5e09){var _0x31f451={},_0x1ac589={},_0x46d304={'count':0x0,'rows':[]};var _0x839ca1=db[_0x1f44('0x2b')]['rawAttributes'];_0x1ac589['model']=_[_0x1f44('0x2c')](_0x839ca1);var _0x288095={'dateStart':_0x24c50c[_0x1f44('0x2d')][_0x1f44('0x2e')],'dateEnd':_0x24c50c[_0x1f44('0x2d')][_0x1f44('0x2f')]};delete _0x24c50c[_0x1f44('0x2d')][_0x1f44('0x2e')];delete _0x24c50c[_0x1f44('0x2d')]['dateEnd'];_0x1ac589[_0x1f44('0x2d')]=_[_0x1f44('0x2c')](_0x24c50c['query']);_0x1ac589[_0x1f44('0x30')]=_['intersection'](_0x1ac589[_0x1f44('0x31')],_0x1ac589['query']);_0x31f451[_0x1f44('0x32')]=_[_0x1f44('0x33')](_0x1ac589[_0x1f44('0x31')],qs[_0x1f44('0x34')](_0x24c50c['query'][_0x1f44('0x34')]));_0x31f451[_0x1f44('0x32')]=_0x31f451['attributes']['length']?_0x31f451['attributes']:_0x1ac589[_0x1f44('0x31')];if(!_0x24c50c[_0x1f44('0x2d')][_0x1f44('0x35')](_0x1f44('0x36'))){_0x31f451[_0x1f44('0x1e')]=qs[_0x1f44('0x1e')](_0x24c50c[_0x1f44('0x2d')]['limit']);_0x31f451[_0x1f44('0x1d')]=qs['offset'](_0x24c50c['query'][_0x1f44('0x1d')]);}_0x31f451['order']=qs[_0x1f44('0x37')](_0x24c50c['query'][_0x1f44('0x37')]);_0x31f451[_0x1f44('0x38')]=qs[_0x1f44('0x30')](_[_0x1f44('0x39')](_0x24c50c[_0x1f44('0x2d')],_0x1ac589['filters']));if(_0x288095[_0x1f44('0x2e')]){if(_0x288095[_0x1f44('0x2f')]){_0x288095[_0x1f44('0x2f')]=moment(_0x288095[_0x1f44('0x2f')])['add'](0x1,'day');}else{_0x288095[_0x1f44('0x2f')]=moment(_0x288095[_0x1f44('0x2e')])[_0x1f44('0x3a')](0x1,_0x1f44('0x3b'));}_['merge'](_0x31f451['where'],{'createdAt':{'$gte':_0x288095[_0x1f44('0x2e')],'$lte':_0x288095[_0x1f44('0x2f')]}});}if(_0x24c50c[_0x1f44('0x2d')][_0x1f44('0x3c')]){_0x31f451[_0x1f44('0x38')]=_[_0x1f44('0x3d')](_0x31f451['where'],{'$or':_[_0x1f44('0x3e')](_0x31f451[_0x1f44('0x32')],function(_0x3d4f8d){var _0x5f1859={};_0x5f1859[_0x3d4f8d]={'$like':'%'+_0x24c50c[_0x1f44('0x2d')][_0x1f44('0x3c')]+'%'};return _0x5f1859;})});}_0x31f451=_['merge']({},_0x31f451,_0x24c50c[_0x1f44('0x3f')]);var _0x3619c8={'where':_0x31f451[_0x1f44('0x38')]};return db['VoicePrefix'][_0x1f44('0x1c')](_0x3619c8)['then'](function(_0x2a20b6){_0x46d304[_0x1f44('0x1c')]=_0x2a20b6;if(_0x24c50c['query'][_0x1f44('0x40')]){_0x31f451[_0x1f44('0x41')]=[{'all':!![]}];}return db[_0x1f44('0x2b')][_0x1f44('0x42')](_0x31f451);})[_0x1f44('0x22')](function(_0x483411){_0x46d304['rows']=_0x483411;return _0x46d304;})[_0x1f44('0x22')](respondWithFilteredResult(_0x9e5e09,_0x31f451))[_0x1f44('0x43')](handleError(_0x9e5e09,null));};exports[_0x1f44('0x44')]=function(_0x1e03c6,_0x22b9f4){var _0x1d5650={'raw':![],'where':{'id':_0x1e03c6[_0x1f44('0x45')]['id']}},_0x44e736={};_0x44e736[_0x1f44('0x31')]=_[_0x1f44('0x2c')](db['VoicePrefix'][_0x1f44('0x46')]);_0x44e736[_0x1f44('0x2d')]=_[_0x1f44('0x2c')](_0x1e03c6[_0x1f44('0x2d')]);_0x44e736['filters']=_[_0x1f44('0x33')](_0x44e736[_0x1f44('0x31')],_0x44e736['query']);_0x1d5650[_0x1f44('0x32')]=_['intersection'](_0x44e736['model'],qs[_0x1f44('0x34')](_0x1e03c6[_0x1f44('0x2d')][_0x1f44('0x34')]));_0x1d5650[_0x1f44('0x32')]=_0x1d5650['attributes'][_0x1f44('0x47')]?_0x1d5650[_0x1f44('0x32')]:_0x44e736[_0x1f44('0x31')];if(_0x1e03c6[_0x1f44('0x2d')][_0x1f44('0x40')]){_0x1d5650[_0x1f44('0x41')]=[{'all':!![]}];}_0x1d5650=_[_0x1f44('0x3d')]({},_0x1d5650,_0x1e03c6[_0x1f44('0x3f')]);return db[_0x1f44('0x2b')][_0x1f44('0x48')](_0x1d5650)['then'](handleEntityNotFound(_0x22b9f4,null))[_0x1f44('0x22')](respondWithResult(_0x22b9f4,null))[_0x1f44('0x43')](handleError(_0x22b9f4,null));};exports['destroy']=function(_0x597699,_0x415eee){return db['VoicePrefix'][_0x1f44('0x48')]({'where':{'id':_0x597699[_0x1f44('0x45')]['id']}})[_0x1f44('0x22')](handleEntityNotFound(_0x415eee,null))[_0x1f44('0x22')](removeEntity(_0x415eee,null))[_0x1f44('0x43')](handleError(_0x415eee,null));};exports[_0x1f44('0x49')]=function(_0x55e659,_0x3cc447){return db[_0x1f44('0x2b')]['describe']()['then'](respondWithResult(_0x3cc447,null))[_0x1f44('0x43')](handleError(_0x3cc447,null));};exports[_0x1f44('0x4a')]=function(_0x2e2355,_0x3bf34b){var _0xbc1e34;return db[_0x1f44('0x4b')][_0x1f44('0x4c')](function(_0x3999d7){return db[_0x1f44('0x2b')][_0x1f44('0x4a')](_0x2e2355['body'],{'transaction':_0x3999d7})[_0x1f44('0x22')](function(_0x442783){_0xbc1e34=_0x442783[_0x1f44('0x24')]({'plain':!![]});return db[_0x1f44('0x4d')][_0x1f44('0x48')]({'where':{'id':_0xbc1e34[_0x1f44('0x4e')]},'raw':!![]})[_0x1f44('0x22')](function(_0x2522ce){return createVoicePrefixExtensions(_0xbc1e34,_0x2522ce,_0x3999d7);});});})['then'](function(){var _0x1f05ae=_0x2e2355[_0x1f44('0x4f')]['get']({'plain':!![]});if(!_0x1f05ae)throw new Error(_0x1f44('0x50'));if(_0x1f05ae['role']===_0x1f44('0x4f')){var _0x5b122c=_0xbc1e34;return db[_0x1f44('0x51')][_0x1f44('0x48')]({'where':{'name':_0x1f44('0x25'),'userProfileId':_0x1f05ae[_0x1f44('0x52')]},'raw':!![]})[_0x1f44('0x22')](function(_0x20c1b1){if(_0x20c1b1&&_0x20c1b1[_0x1f44('0x53')]===0x0){return db[_0x1f44('0x26')][_0x1f44('0x4a')]({'name':_0x5b122c[_0x1f44('0x29')],'resourceId':_0x5b122c['id'],'type':_0x20c1b1[_0x1f44('0x29')],'sectionId':_0x20c1b1['id']},{})[_0x1f44('0x22')](function(){return _0xbc1e34;});}else{return _0xbc1e34;}})[_0x1f44('0x43')](function(_0x5a082f){logger[_0x1f44('0x27')](_0x1f44('0x54'),_0x5a082f);throw _0x5a082f;});}return _0xbc1e34;})[_0x1f44('0x22')](respondWithResult(_0x3bf34b,null))[_0x1f44('0x43')](handleError(_0x3bf34b,null));};function Extension(_0x3c5bdb,_0x20e9c1,_0x3131dd,_0x269726){this[_0x1f44('0x55')]=_0x1f44('0x56');this[_0x1f44('0x57')]=_0x3c5bdb;this[_0x1f44('0x58')]=_0x3131dd;this['type']='system';this[_0x1f44('0x59')]=_0x1f44('0x5a');this[_0x1f44('0x5b')]=_0x20e9c1;this[_0x1f44('0x5c')]=_0x269726;}function createVoicePrefixExtensions(_0x2b848f,_0x4a120a,_0x3e0a62){return new BPromise(function(_0x404180,_0x123060){var _0x4c68ea=new Extension(formatPrefixName(_0x2b848f[_0x1f44('0x5d')]),0x1,_0x1f44('0x5e'),'Voice\x20Prefix');_0x4c68ea[_0x1f44('0x5f')]=_0x2b848f['id'];return db['VoiceExtension'][_0x1f44('0x4a')](_0x4c68ea,{'transaction':_0x3e0a62})['then'](function(_0x3c6c55){var _0x318c4e=_0x3c6c55[_0x1f44('0x24')]({'plain':!![]});var _0x3958b6=_[_0x1f44('0x3e')](addVoicePrefixExtensions(_0x2b848f,_0x4a120a),function(_0x17ab26){_0x17ab26[_0x1f44('0x4e')]=_0x318c4e['id'];_0x17ab26[_0x1f44('0x5f')]=_0x2b848f['id'];return _0x17ab26;});return db[_0x1f44('0x4d')][_0x1f44('0x60')](_0x3958b6,{'transaction':_0x3e0a62})[_0x1f44('0x22')](function(_0x498418){if(!_0x498418){return _0x123060(_0x1f44('0x61'));}else{return _0x404180(_0x498418);}})['catch'](function(_0x573eef){return _0x123060(_0x573eef);});});;});};function addVoicePrefixExtensions(_0x44d2ea,_0x15d14c){var _0x50a9f9=[];var _0x144a0d=formatPrefixName(_0x44d2ea[_0x1f44('0x5d')]);_0x50a9f9[_0x1f44('0x62')](new Extension(_0x144a0d,0x2,_0x1f44('0x63'),_0x1f44('0x64')+_0x44d2ea[_0x1f44('0x29')]));if(_0x44d2ea[_0x1f44('0x65')]){_0x50a9f9[_0x1f44('0x62')](new Extension(_0x144a0d,0x3,_0x1f44('0x63'),_0x1f44('0x66')+_0x44d2ea['callerIdAll']));}else{_0x50a9f9[_0x1f44('0x62')](new Extension(_0x144a0d,0x3,'NoOp',_0x1f44('0x67')));}_0x50a9f9[_0x1f44('0x62')](new Extension(_0x144a0d,0x4,'goto',_0x15d14c[_0x1f44('0x55')]+','+'${EXTEN:'+(0x8+_0x44d2ea['name'][_0x1f44('0x47')])+'}'+','+0x1));return _0x50a9f9;}function formatPrefixName(_0x5c75dd){var _0x6374c7='_';for(var _0x9ab8e6=0x0;_0x9ab8e6<_0x5c75dd['length'];_0x9ab8e6++){if(_0x5c75dd[_0x1f44('0x68')](_0x9ab8e6)=='-'){_0x6374c7+=_0x5c75dd['charAt'](_0x9ab8e6);}else{_0x6374c7+='['+_0x5c75dd[_0x1f44('0x68')](_0x9ab8e6)+']';}}_0x6374c7+='.';return _0x6374c7;}exports[_0x1f44('0x69')]=function(_0x58f3a2,_0x3ab679,_0x4171df){var _0x70c684=_0x58f3a2[_0x1f44('0x6a')];_0x70c684[_0x1f44('0x5d')]=_0x1f44('0x6b')+_0x70c684['name']+'-';return db[_0x1f44('0x4b')][_0x1f44('0x4c')](function(_0x337da1){return db['VoicePrefix'][_0x1f44('0x69')](_0x70c684,{'where':{'id':_0x70c684['id']},'transaction':_0x337da1})[_0x1f44('0x22')](function(){return db[_0x1f44('0x4d')][_0x1f44('0x23')]({'where':{'VoicePrefixId':_0x70c684['id']},'transaction':_0x337da1})[_0x1f44('0x22')](function(){return db[_0x1f44('0x4d')][_0x1f44('0x48')]({'where':{'id':_0x70c684[_0x1f44('0x4e')]},'raw':!![]})[_0x1f44('0x22')](function(_0x2e40a8){return createVoicePrefixExtensions(_0x70c684,_0x2e40a8,_0x337da1);});});});})[_0x1f44('0x22')](function(){return db[_0x1f44('0x2b')][_0x1f44('0x6c')](_0x70c684['id']);})[_0x1f44('0x22')](respondWithResult(_0x3ab679,null))[_0x1f44('0x43')](handleError(_0x3ab679,null));};exports[_0x1f44('0x6d')]=function(_0x5945a7,_0x57fa25,_0x552ca7){return db['VoicePrefix'][_0x1f44('0x48')]({'where':{'id':_0x5945a7[_0x1f44('0x45')]['id']}})[_0x1f44('0x22')](handleEntityNotFound(_0x57fa25,null))[_0x1f44('0x22')](function(_0x22e265){if(_0x22e265){return _0x22e265['addAgents'](_0x5945a7['body'][_0x1f44('0x6e')],_[_0x1f44('0x6f')](_0x5945a7['body'],[_0x1f44('0x6e'),'id'])||{})[_0x1f44('0x70')](function(_0x3d3b65){for(var _0xb68633=0x0;_0xb68633<_0x5945a7[_0x1f44('0x6a')][_0x1f44('0x6e')][_0x1f44('0x47')];_0xb68633+=0x1){socket['emit'](_0x1f44('0x71'),{'UserId':_0x5945a7[_0x1f44('0x6a')][_0x1f44('0x6e')][_0xb68633],'VoicePrefixId':_0x5945a7['params']['id']});}return _0x3d3b65;});}})[_0x1f44('0x22')](respondWithResult(_0x57fa25,null))[_0x1f44('0x43')](handleError(_0x57fa25,null));};exports[_0x1f44('0x72')]=function(_0x227ee7,_0x37c9e6,_0x56397e){var _0x486d86;return db['VoicePrefix'][_0x1f44('0x48')]({'where':{'id':_0x227ee7['params']['id']}})[_0x1f44('0x22')](handleEntityNotFound(_0x37c9e6,null))[_0x1f44('0x22')](function(_0x515863){if(_0x515863){return _0x515863[_0x1f44('0x72')](_0x227ee7[_0x1f44('0x2d')]['ids'])['then'](function(_0xbfa0fa){if(_[_0x1f44('0x73')](_0x227ee7['query'][_0x1f44('0x6e')])){for(var _0x1b56ba=0x0;_0x1b56ba<_0x227ee7['query'][_0x1f44('0x6e')][_0x1f44('0x47')];_0x1b56ba+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':_0x227ee7[_0x1f44('0x2d')][_0x1f44('0x6e')][_0x1b56ba],'VoicePrefixId':_0x227ee7[_0x1f44('0x45')]['id']});}}else{socket[_0x1f44('0x74')](_0x1f44('0x75'),{'UserId':_0x227ee7[_0x1f44('0x2d')]['ids'],'VoicePrefixId':_0x227ee7['params']['id']});}});}})[_0x1f44('0x22')](respondWithStatusCode(_0x37c9e6,null))[_0x1f44('0x43')](handleError(_0x37c9e6,null));};exports[_0x1f44('0x76')]=function(_0x3a0b21,_0x22305e,_0x53b52a){var _0x132244={};var _0x57281b={};var _0x3128b4;var _0x5f89e0;return db[_0x1f44('0x2b')][_0x1f44('0x77')]({'where':{'id':_0x3a0b21[_0x1f44('0x45')]['id']}})[_0x1f44('0x22')](handleEntityNotFound(_0x22305e,null))[_0x1f44('0x22')](function(_0xb49d84){if(_0xb49d84){_0x3128b4=_0xb49d84;_0x57281b[_0x1f44('0x31')]=_[_0x1f44('0x2c')](db['User']['rawAttributes']);_0x57281b['query']=_[_0x1f44('0x2c')](_0x3a0b21['query']);_0x57281b[_0x1f44('0x30')]=_[_0x1f44('0x33')](_0x57281b[_0x1f44('0x31')],_0x57281b[_0x1f44('0x2d')]);_0x132244[_0x1f44('0x32')]=_[_0x1f44('0x33')](_0x57281b['model'],qs[_0x1f44('0x34')](_0x3a0b21['query'][_0x1f44('0x34')]));_0x132244[_0x1f44('0x32')]=_0x132244[_0x1f44('0x32')][_0x1f44('0x47')]?_0x132244[_0x1f44('0x32')]:_0x57281b[_0x1f44('0x31')];_0x132244[_0x1f44('0x78')]=qs[_0x1f44('0x37')](_0x3a0b21['query']['sort']);_0x132244[_0x1f44('0x38')]=qs[_0x1f44('0x30')](_[_0x1f44('0x39')](_0x3a0b21[_0x1f44('0x2d')],_0x57281b[_0x1f44('0x30')]));if(_0x3a0b21['query']['filter']){_0x132244[_0x1f44('0x38')]=_[_0x1f44('0x3d')](_0x132244[_0x1f44('0x38')],{'$or':_[_0x1f44('0x3e')](_0x132244[_0x1f44('0x32')],function(_0x15f986){var _0x1382d2={};_0x1382d2[_0x15f986]={'$like':'%'+_0x3a0b21[_0x1f44('0x2d')]['filter']+'%'};return _0x1382d2;})});}_0x132244=_['merge']({},_0x132244,_0x3a0b21[_0x1f44('0x3f')]);return _0x3128b4[_0x1f44('0x76')](_0x132244);}})[_0x1f44('0x22')](function(_0x736b4a){if(_0x736b4a){_0x5f89e0=_0x736b4a[_0x1f44('0x47')];if(!_0x3a0b21[_0x1f44('0x2d')][_0x1f44('0x35')](_0x1f44('0x36'))){_0x132244[_0x1f44('0x1e')]=qs[_0x1f44('0x1e')](_0x3a0b21[_0x1f44('0x2d')][_0x1f44('0x1e')]);_0x132244['offset']=qs[_0x1f44('0x1d')](_0x3a0b21[_0x1f44('0x2d')][_0x1f44('0x1d')]);}return _0x3128b4['getAgents'](_0x132244);}})[_0x1f44('0x22')](function(_0x3224ac){if(_0x3224ac){return _0x3224ac?{'count':_0x5f89e0,'rows':_0x3224ac}:null;}})[_0x1f44('0x22')](respondWithResult(_0x22305e,null))['catch'](handleError(_0x22305e,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index e7ccd36..6a18e35 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 _0x524a=['setMaxListeners','update','remove','emit','hook','events','../../mysqldb','VoicePrefix'];(function(_0x3b512f,_0x239bbb){var _0x19214d=function(_0x5e66a8){while(--_0x5e66a8){_0x3b512f['push'](_0x3b512f['shift']());}};_0x19214d(++_0x239bbb);}(_0x524a,0xf5));var _0xa524=function(_0x24086a,_0x23b024){_0x24086a=_0x24086a-0x0;var _0x443d31=_0x524a[_0x24086a];return _0x443d31;};'use strict';var EventEmitter=require(_0xa524('0x0'));var VoicePrefix=require(_0xa524('0x1'))['db'][_0xa524('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xa524('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa524('0x4'),'afterDestroy':_0xa524('0x5')};function emitEvent(_0xa89d8c){return function(_0x56ab08,_0x50ec75,_0x34a665){VoicePrefixEvents[_0xa524('0x6')](_0xa89d8c+':'+_0x56ab08['id'],_0x56ab08);VoicePrefixEvents[_0xa524('0x6')](_0xa89d8c,_0x56ab08);_0x34a665(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xa524('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xcb66=['VoicePrefix','setMaxListeners','save','update','emit','hook','exports','../../mysqldb'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xcb66,0x19f));var _0x6cb6=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xcb66[_0x24f31b];return _0x488401;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x6cb6('0x0'))['db'][_0x6cb6('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6cb6('0x2')](0x0);var events={'afterCreate':_0x6cb6('0x3'),'afterUpdate':_0x6cb6('0x4'),'afterDestroy':'remove'};function emitEvent(_0xe996ed){return function(_0x2d7dbb,_0x24660c,_0xa166ce){VoicePrefixEvents[_0x6cb6('0x5')](_0xe996ed+':'+_0x2d7dbb['id'],_0x2d7dbb);VoicePrefixEvents['emit'](_0xe996ed,_0x2d7dbb);_0xa166ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x6cb6('0x6')](e,emitEvent(event));}}module[_0x6cb6('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 027e35c..a7f3340 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 _0x65ac=['util','../../config/logger','api','bluebird','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x36f8e4,_0x477a76){var _0x482f70=function(_0x54ed70){while(--_0x54ed70){_0x36f8e4['push'](_0x36f8e4['shift']());}};_0x482f70(++_0x477a76);}(_0x65ac,0x100));var _0xc65a=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x65ac[_0x13ce0c];return _0x4388fb;};'use strict';var _=require('lodash');var util=require(_0xc65a('0x0'));var logger=require(_0xc65a('0x1'))(_0xc65a('0x2'));var moment=require('moment');var BPromise=require(_0xc65a('0x3'));var rp=require('request-promise');var attributes=require(_0xc65a('0x4'));module['exports']=function(_0x3d84d6,_0x7d3c15){return _0x3d84d6[_0xc65a('0x5')](_0xc65a('0x6'),attributes,{'tableName':_0xc65a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4a1=['./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment','request-promise'];(function(_0x40a827,_0x413586){var _0x4aa580=function(_0x37db8d){while(--_0x37db8d){_0x40a827['push'](_0x40a827['shift']());}};_0x4aa580(++_0x413586);}(_0xc4a1,0x1ef));var _0x1c4a=function(_0x29c2c5,_0x1b0345){_0x29c2c5=_0x29c2c5-0x0;var _0x4ac5f6=_0xc4a1[_0x29c2c5];return _0x4ac5f6;};'use strict';var _=require(_0x1c4a('0x0'));var util=require('util');var logger=require(_0x1c4a('0x1'))(_0x1c4a('0x2'));var moment=require(_0x1c4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c4a('0x4'));var attributes=require(_0x1c4a('0x5'));module[_0x1c4a('0x6')]=function(_0x3a1a32,_0x24e100){return _0x3a1a32[_0x1c4a('0x7')](_0x1c4a('0x8'),attributes,{'tableName':_0x1c4a('0x9'),'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 72be9cc..2e37a29 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 _0x1eec=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x428029,_0x1a5eb3){var _0x52033a=function(_0x5d73a8){while(--_0x5d73a8){_0x428029['push'](_0x428029['shift']());}};_0x52033a(++_0x1a5eb3);}(_0x1eec,0x1de));var _0xc1ee=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x1eec[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require(_0xc1ee('0x0'));var moment=require('moment');var BPromise=require(_0xc1ee('0x1'));var rs=require(_0xc1ee('0x2'));var fs=require('fs');var Redis=require(_0xc1ee('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1ee('0x4'));var logger=require(_0xc1ee('0x5'))(_0xc1ee('0x6'));var config=require(_0xc1ee('0x7'));var jayson=require(_0xc1ee('0x8'));var client=jayson[_0xc1ee('0x9')][_0xc1ee('0xa')]({'port':0x232a});config['redis']=_[_0xc1ee('0xb')](config[_0xc1ee('0xc')],{'host':_0xc1ee('0xd'),'port':0x18eb});var socket=require(_0xc1ee('0xe'))(new Redis(config[_0xc1ee('0xc')]));require(_0xc1ee('0xf'))['register'](socket);function respondWithRpcPromise(_0x4a8a63,_0x29f957,_0x315689){return new BPromise(function(_0xe687a5,_0x2c0fb4){return client[_0xc1ee('0x10')](_0x4a8a63,_0x315689)['then'](function(_0x37d15d){logger[_0xc1ee('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x29f957,'request\x20sent');logger[_0xc1ee('0x12')](_0xc1ee('0x13'),_0x29f957,_0xc1ee('0x14'),JSON[_0xc1ee('0x15')](_0x37d15d));if(_0x37d15d[_0xc1ee('0x16')]){if(_0x37d15d[_0xc1ee('0x16')][_0xc1ee('0x17')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x29f957,_0x37d15d['error'][_0xc1ee('0x18')]);return _0x2c0fb4(_0x37d15d[_0xc1ee('0x16')]['message']);}logger[_0xc1ee('0x16')](_0xc1ee('0x19'),_0x29f957,_0x37d15d[_0xc1ee('0x16')]['message']);return _0xe687a5(_0x37d15d[_0xc1ee('0x16')]['message']);}else{logger['info'](_0xc1ee('0x19'),_0x29f957,_0xc1ee('0x14'));_0xe687a5(_0x37d15d[_0xc1ee('0x1a')][_0xc1ee('0x18')]);}})['catch'](function(_0x37d9fb){logger[_0xc1ee('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x29f957,_0x37d9fb);_0x2c0fb4(_0x37d9fb);});});} \ No newline at end of file +var _0x14de=['socket.io-emitter','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x1a0668,_0x1987af){var _0x596f91=function(_0x2a68fa){while(--_0x2a68fa){_0x1a0668['push'](_0x1a0668['shift']());}};_0x596f91(++_0x1987af);}(_0x14de,0x1d8));var _0xe14d=function(_0x9071ca,_0x5dbc46){_0x9071ca=_0x9071ca-0x0;var _0x254d8b=_0x14de[_0x9071ca];return _0x254d8b;};'use strict';var _=require(_0xe14d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe14d('0x1'));var rs=require(_0xe14d('0x2'));var fs=require('fs');var Redis=require(_0xe14d('0x3'));var db=require(_0xe14d('0x4'))['db'];var utils=require(_0xe14d('0x5'));var logger=require('../../config/logger')(_0xe14d('0x6'));var config=require(_0xe14d('0x7'));var jayson=require(_0xe14d('0x8'));var client=jayson[_0xe14d('0x9')][_0xe14d('0xa')]({'port':0x232a});config['redis']=_[_0xe14d('0xb')](config[_0xe14d('0xc')],{'host':_0xe14d('0xd'),'port':0x18eb});var socket=require(_0xe14d('0xe'))(new Redis(config[_0xe14d('0xc')]));require(_0xe14d('0xf'))['register'](socket);function respondWithRpcPromise(_0x5165b3,_0x1189f4,_0x21d4b4){return new BPromise(function(_0x5ab7c7,_0x10706b){return client['request'](_0x5165b3,_0x21d4b4)[_0xe14d('0x10')](function(_0x1db911){logger[_0xe14d('0x11')](_0xe14d('0x12'),_0x1189f4,_0xe14d('0x13'));logger[_0xe14d('0x14')](_0xe14d('0x15'),_0x1189f4,'request\x20sent',JSON[_0xe14d('0x16')](_0x1db911));if(_0x1db911['error']){if(_0x1db911['error'][_0xe14d('0x17')]===0x1f4){logger['error'](_0xe14d('0x12'),_0x1189f4,_0x1db911[_0xe14d('0x18')][_0xe14d('0x19')]);return _0x10706b(_0x1db911[_0xe14d('0x18')][_0xe14d('0x19')]);}logger[_0xe14d('0x18')](_0xe14d('0x12'),_0x1189f4,_0x1db911[_0xe14d('0x18')]['message']);return _0x5ab7c7(_0x1db911['error'][_0xe14d('0x19')]);}else{logger['info'](_0xe14d('0x12'),_0x1189f4,_0xe14d('0x13'));_0x5ab7c7(_0x1db911['result'][_0xe14d('0x19')]);}})[_0xe14d('0x1a')](function(_0x480a08){logger[_0xe14d('0x18')](_0xe14d('0x12'),_0x1189f4,_0x480a08);_0x10706b(_0x480a08);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 44006ac..2927918 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 _0xbc51=['save','emit','removeListener','register','length'];(function(_0x58cda3,_0x18cb1f){var _0x27b4f2=function(_0x105540){while(--_0x105540){_0x58cda3['push'](_0x58cda3['shift']());}};_0x27b4f2(++_0x18cb1f);}(_0xbc51,0xdc));var _0x1bc5=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0xbc51[_0x1fc1f9];return _0x4987ca;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x1bc5('0x0'),'remove','update'];function createListener(_0x1af21e,_0x5799cb){return function(_0x38a0e3){_0x5799cb[_0x1bc5('0x1')](_0x1af21e,_0x38a0e3);};}function removeListener(_0x553412,_0x346c05){return function(){VoicePrefixEvents[_0x1bc5('0x2')](_0x553412,_0x346c05);};}exports[_0x1bc5('0x3')]=function(_0x300d41){for(var _0xc1144=0x0,_0x31b6e1=events[_0x1bc5('0x4')];_0xc1144<_0x31b6e1;_0xc1144++){var _0x1b5d0d=events[_0xc1144];var _0x54fea4=createListener('voicePrefix:'+_0x1b5d0d,_0x300d41);VoicePrefixEvents['on'](_0x1b5d0d,_0x54fea4);}}; \ No newline at end of file +var _0x67ad=['length','voicePrefix:','./voicePrefix.events','remove','update','emit','register'];(function(_0x20ebf7,_0x255d29){var _0x28be76=function(_0x5dc978){while(--_0x5dc978){_0x20ebf7['push'](_0x20ebf7['shift']());}};_0x28be76(++_0x255d29);}(_0x67ad,0xaa));var _0xd67a=function(_0x42b576,_0xebc94f){_0x42b576=_0x42b576-0x0;var _0x9919b1=_0x67ad[_0x42b576];return _0x9919b1;};'use strict';var VoicePrefixEvents=require(_0xd67a('0x0'));var events=['save',_0xd67a('0x1'),_0xd67a('0x2')];function createListener(_0x53ad9a,_0x5d005f){return function(_0x5966ac){_0x5d005f[_0xd67a('0x3')](_0x53ad9a,_0x5966ac);};}function removeListener(_0x5d17a8,_0x298b48){return function(){VoicePrefixEvents['removeListener'](_0x5d17a8,_0x298b48);};}exports[_0xd67a('0x4')]=function(_0x21552c){for(var _0x34adb4=0x0,_0x470598=events[_0xd67a('0x5')];_0x34adb4<_0x470598;_0x34adb4++){var _0x74ffd3=events[_0x34adb4];var _0x2c0666=createListener(_0xd67a('0x6')+_0x74ffd3,_0x21552c);VoicePrefixEvents['on'](_0x74ffd3,_0x2c0666);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 90a8fc3..aee7e1d 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(_0x51da60,_0x5585f8){var _0x4f49cd=function(_0x4f6000){while(--_0x4f6000){_0x51da60['push'](_0x51da60['shift']());}};_0x4f49cd(++_0x5585f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 _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(_0x13b2a6,_0x1c95eb){var _0x5db59f=function(_0x18a576){while(--_0x18a576){_0x13b2a6['push'](_0x13b2a6['shift']());}};_0x5db59f(++_0x1c95eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index e04967d..4311eb2 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 _0xb10b=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','STRING','name','ENUM','outbound','inbound','default','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','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','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x3396e8,_0x3048a3){var _0x296815=function(_0x2d2b81){while(--_0x2d2b81){_0x3396e8['push'](_0x3396e8['shift']());}};_0x296815(++_0x3048a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f7cc0,_0xa7ddc9){_0x2f7cc0=_0x2f7cc0-0x0;var _0x42ac73=_0xb10b[_0x2f7cc0];return _0x42ac73;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbb10('0x3')]('inbound',_0xbb10('0x4')),'allowNull':![],'defaultValue':_0xbb10('0x5')},'musiconhold':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x6')},'announce':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xbb10('0x3')]('rr','ringall',_0xbb10('0x7'),_0xbb10('0x8'),'random',_0xbb10('0x9'),_0xbb10('0xa'),_0xbb10('0xb'),_0xbb10('0xc')),'allowNull':![],'defaultValue':_0xbb10('0xd'),'set':function(_0x1ce33e){this[_0xbb10('0xe')](_0xbb10('0xf'),_0x1ce33e?_0x1ce33e:'rrmemory');},'get':function(){var _0x4e47f8=this[_0xbb10('0x10')](_0xbb10('0x11'));var _0xce64f3=this['getDataValue'](_0xbb10('0x12'));var _0x5be7e0=this[_0xbb10('0x10')](_0xbb10('0xf'));if(_0x4e47f8===_0xbb10('0x5')){return _0x5be7e0;}if(_0xce64f3===_0xbb10('0x13')&&_0x5be7e0===_0xbb10('0x9')||_0xce64f3===_0xbb10('0x13')&&_0x5be7e0==='roundrobin'){return _0x5be7e0;}if(_0xce64f3===_0xbb10('0x14')||_0xce64f3===_0xbb10('0x15')||_0xce64f3===_0xbb10('0x16')){return _0x5be7e0;}return null;}},'servicelevel':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbb10('0x17')](0xb)},'timeout':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xbb10('0x1')]},'weight':{'type':Sequelize[_0xbb10('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':_0xbb10('0x18')},'autopause':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no',_0xbb10('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbb10('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':_0xbb10('0x18')},'announce_holdtime':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no',_0xbb10('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbb10('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbb10('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbb10('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xbb10('0x1')]},'queue_quantity2':{'type':Sequelize[_0xbb10('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xbb10('0x1')]},'queue_less_than':{'type':Sequelize[_0xbb10('0x1')]},'periodic_announce':{'type':Sequelize[_0xbb10('0x1b')],'set':function(_0x2ff4c1){this['setDataValue'](_0xbb10('0x1c'),_0x2ff4c1?_0x2ff4c1['join'](','):[]);},'get':function(){return this[_0xbb10('0x10')]('periodic_announce')?this[_0xbb10('0x10')](_0xbb10('0x1c'))[_0xbb10('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x4c3744){this[_0xbb10('0xe')]('joinempty',_0x4c3744?_0x4c3744[_0xbb10('0x1e')](','):[]);},'get':function(){return this[_0xbb10('0x10')](_0xbb10('0x1f'))?this[_0xbb10('0x10')](_0xbb10('0x1f'))[_0xbb10('0x1d')](','):[];}},'leavewhenempty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'no','set':function(_0x4975f5){this[_0xbb10('0xe')](_0xbb10('0x20'),_0x4975f5?_0x4975f5[_0xbb10('0x1e')](','):[]);},'get':function(){return this[_0xbb10('0x10')](_0xbb10('0x20'))?this[_0xbb10('0x10')](_0xbb10('0x20'))[_0xbb10('0x1d')](','):[];}},'reportholdtime':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3eb3cc){this[_0xbb10('0xe')](_0xbb10('0x21'),_0x3eb3cc);if(_0x3eb3cc){if(this[_0xbb10('0x10')](_0xbb10('0x22'))<0x2){this[_0xbb10('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xbb10('0x14'),_0xbb10('0x16'),_0xbb10('0x15'),'booked'),'defaultValue':_0xbb10('0x14'),'comment':_0xbb10('0x24')},'dialLimitChannel':{'type':Sequelize[_0xbb10('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbb10('0x25')},'dialLimitQueue':{'type':Sequelize[_0xbb10('0x17')](0x4)[_0xbb10('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbb10('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xbb10('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbb10('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xbb10('0x29'),_0xbb10('0x2a')),'defaultValue':_0xbb10('0x2a'),'comment':_0xbb10('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbb10('0x2c')](0x2)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbb10('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbb10('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbb10('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'tTxX','comment':_0xbb10('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xbb10('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xbb10('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbb10('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'comment':_0xbb10('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbb10('0x35')},'dialTimezone':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbb10('0x36')},'dialPrefix':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x37'),_0xbb10('0x38'),_0xbb10('0x39')),'defaultValue':_0xbb10('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbb10('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbb10('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbb10('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbb10('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbb10('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbb10('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbb10('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbb10('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbb10('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbb10('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':0x0,'comment':_0xbb10('0x44')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xbb10('0x45'),'ASC'),'defaultValue':_0xbb10('0x45')},'dialQueueProject2':{'type':Sequelize[_0xbb10('0x1')],'comment':_0xbb10('0x46')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbb10('0x47')},'dialCutDigit':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbb10('0x48')}}; \ 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(_0x19e9a7,_0x57e686){var _0x3a8442=function(_0x154567){while(--_0x154567){_0x19e9a7['push'](_0x19e9a7['shift']());}};_0x3a8442(++_0x57e686);}(_0x7a54,0x106));var _0x47a5=function(_0xe46794,_0x3cfa87){_0xe46794=_0xe46794-0x0;var _0x4affc2=_0x7a54[_0xe46794];return _0x4affc2;};'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 4de671b..34d6c29 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 _0x2581=['CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','VoiceQueueId\x20=\x20?','onlyIfOpen','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','stack','send','VoiceQueue','keys','query','dateStart','dateEnd','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','add','day','merge','where','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','role','user','UserProfileSection','userProfileId','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','autoAssociation','update','findOne','CmHopper','hasOwnProperty','getHopperHistories','CmHopperHistory','getHopperFinals','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','ids','User','Agents','union','penalty','removeTeams','removeAgents','addAgents','spread','emit','userVoiceQueue:save','voicePause','interface','push','UserVoiceQueueRt','upsert','isNil','isArray','userVoiceQueue:remove','realtime','getAgents','getMembers','getLists'];(function(_0x318a7f,_0x1a74f3){var _0x388423=function(_0x1f8bb1){while(--_0x1f8bb1){_0x318a7f['push'](_0x318a7f['shift']());}};_0x388423(++_0x1a74f3);}(_0x2581,0xcb));var _0x1258=function(_0xb95742,_0x165e9c){_0xb95742=_0xb95742-0x0;var _0x3c920e=_0x2581[_0xb95742];return _0x3c920e;};'use strict';var pdf=require(_0x1258('0x0'));var emlformat=require(_0x1258('0x1'));var rimraf=require(_0x1258('0x2'));var zipdir=require(_0x1258('0x3'));var jsonpatch=require(_0x1258('0x4'));var rp=require('request-promise');var moment=require(_0x1258('0x5'));var BPromise=require(_0x1258('0x6'));var Mustache=require(_0x1258('0x7'));var util=require(_0x1258('0x8'));var path=require(_0x1258('0x9'));var sox=require(_0x1258('0xa'));var csv=require(_0x1258('0xb'));var ejs=require(_0x1258('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1258('0xd'));var crypto=require(_0x1258('0xe'));var jsforce=require(_0x1258('0xf'));var deskjs=require(_0x1258('0x10'));var toCsv=require(_0x1258('0xb'));var querystring=require(_0x1258('0x11'));var Papa=require(_0x1258('0x12'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x1258('0x13'))(_0x1258('0x14'));var utils=require(_0x1258('0x15'));var config=require(_0x1258('0x16'));var db=require('../../mysqldb')['db'];config[_0x1258('0x17')]=_[_0x1258('0x18')](config[_0x1258('0x17')],{'host':_0x1258('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1258('0x17')]));require(_0x1258('0x1a'))[_0x1258('0x1b')](socket);function respondWithStatusCode(_0x41b891,_0x2f9cd6){_0x2f9cd6=_0x2f9cd6||0xcc;return function(_0x365038){if(_0x365038){return _0x41b891[_0x1258('0x1c')](_0x2f9cd6);}return _0x41b891['status'](_0x2f9cd6)[_0x1258('0x1d')]();};}function respondWithResult(_0x56bd82,_0x477502){_0x477502=_0x477502||0xc8;return function(_0x19775e){if(_0x19775e){return _0x56bd82[_0x1258('0x1e')](_0x477502)[_0x1258('0x1f')](_0x19775e);}};}function respondWithFilteredResult(_0x313717,_0x4a85e4){return function(_0x1645a6){if(_0x1645a6){var _0x3dd26e=_0x1645a6[_0x1258('0x20')],_0x38d6e9=_0x4a85e4['offset'],_0x55f1dc=_0x4a85e4[_0x1258('0x21')]+_0x4a85e4[_0x1258('0x22')],_0x97c02e;if(_0x55f1dc>=_0x3dd26e){_0x55f1dc=_0x3dd26e;_0x97c02e=0xc8;}else{_0x97c02e=0xce;}_0x313717[_0x1258('0x1e')](_0x97c02e);return _0x313717[_0x1258('0x23')](_0x1258('0x24'),_0x38d6e9+'-'+_0x55f1dc+'/'+_0x3dd26e)[_0x1258('0x1f')](_0x1645a6);}return null;};}function patchUpdates(_0x8de82c){return function(_0xbdd2ff){try{jsonpatch[_0x1258('0x25')](_0xbdd2ff,_0x8de82c,!![]);}catch(_0x2d397a){return BPromise[_0x1258('0x26')](_0x2d397a);}return _0xbdd2ff[_0x1258('0x27')]();};}function saveUpdates(_0x21bbd6,_0x1d270b){return function(_0x1c6373){if(_0x1c6373){return _0x1c6373['update'](_0x21bbd6)[_0x1258('0x28')](function(_0x528a62){return _0x528a62;});}return null;};}function removeEntity(_0x569f65,_0x4bdf96){return function(_0x2c661a){if(_0x2c661a){return _0x2c661a[_0x1258('0x29')]()[_0x1258('0x28')](function(){var _0x437fce=_0x2c661a[_0x1258('0x2a')]({'plain':!![]});var _0x385acb=[{'name':'VoiceQueues','value':_0x1258('0x2b'),'ignore':![]},{'name':_0x1258('0x2c'),'value':_0x1258('0x2d'),'ignore':![]}];var _0x195986=_(_0x385acb)[_0x1258('0x2e')](_0x1258('0x2f'))[_0x1258('0x30')](_0x1258('0x31'))[_0x1258('0x31')]();if(_[_0x1258('0x32')](_0x195986,_0x437fce[_0x1258('0x33')])){return;}var _0x42a3b4=_[_0x1258('0x34')](_0x385acb,['value',_0x437fce['type']])[_0x1258('0x35')];return db['UserProfileResource'][_0x1258('0x29')]({'where':{'type':_0x42a3b4,'resourceId':_0x437fce['id']}})[_0x1258('0x28')](function(){return _0x2c661a;});})['then'](function(){_0x569f65[_0x1258('0x1e')](0xcc)[_0x1258('0x1d')]();});}};}function handleEntityNotFound(_0x3c0216,_0x5b5743){return function(_0x58e7be){if(!_0x58e7be){_0x3c0216[_0x1258('0x1c')](0x194);}return _0x58e7be;};}function handleError(_0x2598a6,_0x4a9642){_0x4a9642=_0x4a9642||0x1f4;return function(_0xa93e0b){logger['error'](_0xa93e0b[_0x1258('0x36')]);if(_0xa93e0b[_0x1258('0x35')]){delete _0xa93e0b[_0x1258('0x35')];}_0x2598a6[_0x1258('0x1e')](_0x4a9642)[_0x1258('0x37')](_0xa93e0b);};}exports['index']=function(_0x4e94fb,_0x132d4b){var _0x417239={},_0xe5a0c6={},_0xea698c={'count':0x0,'rows':[]};var _0x3dac88=db[_0x1258('0x38')]['rawAttributes'];_0xe5a0c6['model']=_[_0x1258('0x39')](_0x3dac88);var _0x38057e={'dateStart':_0x4e94fb['query']['dateStart'],'dateEnd':_0x4e94fb['query']['dateEnd']};delete _0x4e94fb[_0x1258('0x3a')][_0x1258('0x3b')];delete _0x4e94fb[_0x1258('0x3a')][_0x1258('0x3c')];_0xe5a0c6[_0x1258('0x3a')]=_[_0x1258('0x39')](_0x4e94fb[_0x1258('0x3a')]);_0xe5a0c6[_0x1258('0x3d')]=_[_0x1258('0x3e')](_0xe5a0c6['model'],_0xe5a0c6['query']);_0x417239[_0x1258('0x3f')]=_['intersection'](_0xe5a0c6[_0x1258('0x40')],qs['fields'](_0x4e94fb[_0x1258('0x3a')][_0x1258('0x41')]));_0x417239[_0x1258('0x3f')]=_0x417239[_0x1258('0x3f')][_0x1258('0x42')]?_0x417239[_0x1258('0x3f')]:_0xe5a0c6[_0x1258('0x40')];if(!_0x4e94fb[_0x1258('0x3a')]['hasOwnProperty'](_0x1258('0x43'))){_0x417239[_0x1258('0x22')]=qs[_0x1258('0x22')](_0x4e94fb[_0x1258('0x3a')][_0x1258('0x22')]);_0x417239[_0x1258('0x21')]=qs['offset'](_0x4e94fb['query'][_0x1258('0x21')]);}_0x417239[_0x1258('0x44')]=qs[_0x1258('0x45')](_0x4e94fb['query'][_0x1258('0x45')]);_0x417239['where']=qs['filters'](_[_0x1258('0x46')](_0x4e94fb[_0x1258('0x3a')],_0xe5a0c6[_0x1258('0x3d')]));if(_0x38057e[_0x1258('0x3b')]){if(_0x38057e[_0x1258('0x3c')]){_0x38057e[_0x1258('0x3c')]=moment(_0x38057e[_0x1258('0x3c')])[_0x1258('0x47')](0x1,_0x1258('0x48'));}else{_0x38057e[_0x1258('0x3c')]=moment(_0x38057e[_0x1258('0x3b')])[_0x1258('0x47')](0x1,_0x1258('0x48'));}_[_0x1258('0x49')](_0x417239['where'],{'createdAt':{'$gte':_0x38057e[_0x1258('0x3b')],'$lte':_0x38057e[_0x1258('0x3c')]}});}if(_0x4e94fb[_0x1258('0x3a')][_0x1258('0x2e')]){_0x417239[_0x1258('0x4a')]=_[_0x1258('0x49')](_0x417239[_0x1258('0x4a')],{'$or':_['map'](_0x417239[_0x1258('0x3f')],function(_0x318563){var _0x8cfb02={};_0x8cfb02[_0x318563]={'$like':'%'+_0x4e94fb[_0x1258('0x3a')][_0x1258('0x2e')]+'%'};return _0x8cfb02;})});}_0x417239=_[_0x1258('0x49')]({},_0x417239,_0x4e94fb[_0x1258('0x4b')]);var _0x10addc={'where':_0x417239[_0x1258('0x4a')]};return db[_0x1258('0x38')][_0x1258('0x20')](_0x10addc)[_0x1258('0x28')](function(_0x119fca){_0xea698c[_0x1258('0x20')]=_0x119fca;if(_0x4e94fb[_0x1258('0x3a')][_0x1258('0x4c')]){_0x417239[_0x1258('0x4d')]=[{'all':!![]}];}return db[_0x1258('0x38')][_0x1258('0x4e')](_0x417239);})['then'](function(_0x4086fe){_0xea698c[_0x1258('0x4f')]=_0x4086fe;return _0xea698c;})['then'](respondWithFilteredResult(_0x132d4b,_0x417239))['catch'](handleError(_0x132d4b,null));};exports[_0x1258('0x50')]=function(_0xdc31d2,_0x2e7eb0){var _0x5954b8={'raw':![],'where':{'id':_0xdc31d2[_0x1258('0x51')]['id']}},_0x45d72a={};_0x45d72a[_0x1258('0x40')]=_['keys'](db[_0x1258('0x38')][_0x1258('0x52')]);_0x45d72a[_0x1258('0x3a')]=_[_0x1258('0x39')](_0xdc31d2['query']);_0x45d72a['filters']=_['intersection'](_0x45d72a[_0x1258('0x40')],_0x45d72a[_0x1258('0x3a')]);_0x5954b8['attributes']=_[_0x1258('0x3e')](_0x45d72a[_0x1258('0x40')],qs[_0x1258('0x41')](_0xdc31d2[_0x1258('0x3a')]['fields']));_0x5954b8[_0x1258('0x3f')]=_0x5954b8[_0x1258('0x3f')][_0x1258('0x42')]?_0x5954b8[_0x1258('0x3f')]:_0x45d72a['model'];if(_0xdc31d2[_0x1258('0x3a')][_0x1258('0x4c')]){_0x5954b8[_0x1258('0x4d')]=[{'all':!![]}];}_0x5954b8=_[_0x1258('0x49')]({},_0x5954b8,_0xdc31d2[_0x1258('0x4b')]);return db[_0x1258('0x38')][_0x1258('0x34')](_0x5954b8)[_0x1258('0x28')](handleEntityNotFound(_0x2e7eb0,null))['then'](respondWithResult(_0x2e7eb0,null))['catch'](handleError(_0x2e7eb0,null));};exports[_0x1258('0x53')]=function(_0x1a75c7,_0x1bcf9f){return db[_0x1258('0x38')][_0x1258('0x53')](_0x1a75c7['body'],{})[_0x1258('0x28')](function(_0x2e6692){var _0x2adc55=_0x1a75c7['user']['get']({'plain':!![]});if(!_0x2adc55)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2adc55[_0x1258('0x54')]===_0x1258('0x55')){var _0x2de959=_0x2e6692[_0x1258('0x2a')]({'plain':!![]});var _0x40a873=[{'name':'VoiceQueues','value':_0x1258('0x2b')},{'name':_0x1258('0x2c'),'value':_0x1258('0x2d')}];var _0x2a21ef=_[_0x1258('0x34')](_0x40a873,[_0x1258('0x31'),_0x2de959[_0x1258('0x33')]])[_0x1258('0x35')];return db[_0x1258('0x56')]['find']({'where':{'name':_0x2a21ef,'userProfileId':_0x2adc55[_0x1258('0x57')]},'raw':!![]})[_0x1258('0x28')](function(_0x2bdf01){if(_0x2bdf01&&_0x2bdf01['autoAssociation']===0x0){return db[_0x1258('0x58')][_0x1258('0x53')]({'name':_0x2de959[_0x1258('0x35')],'resourceId':_0x2de959['id'],'type':_0x2bdf01[_0x1258('0x35')],'sectionId':_0x2bdf01['id']},{})[_0x1258('0x28')](function(){return _0x2e6692;});}else{return _0x2e6692;}})[_0x1258('0x59')](function(_0x7ab93c){logger[_0x1258('0x5a')](_0x1258('0x5b'),_0x7ab93c);throw _0x7ab93c;});}return _0x2e6692;})[_0x1258('0x28')](respondWithResult(_0x1bcf9f,0xc9))[_0x1258('0x59')](handleError(_0x1bcf9f,null));};exports[_0x1258('0x5c')]=function(_0x439c25,_0x53a790){var _0x27b67b={'raw':![],'where':{'id':_0x439c25[_0x1258('0x51')]['id']}},_0xae040={};_0xae040[_0x1258('0x40')]=_[_0x1258('0x39')](db[_0x1258('0x38')]['rawAttributes']);_0x27b67b[_0x1258('0x3f')]=_[_0x1258('0x3e')](_0xae040[_0x1258('0x40')],qs[_0x1258('0x41')](_0x439c25[_0x1258('0x3a')][_0x1258('0x41')]));_0x27b67b['attributes']=_0x27b67b[_0x1258('0x3f')]['length']?_0x27b67b[_0x1258('0x3f')]:_0xae040[_0x1258('0x40')];if(_0x439c25[_0x1258('0x3a')][_0x1258('0x4c')]){_0x27b67b[_0x1258('0x4d')]=[{'all':!![]}];}_0x27b67b=_[_0x1258('0x49')]({},_0x27b67b,_0x439c25[_0x1258('0x4b')]);return db[_0x1258('0x38')][_0x1258('0x34')](_0x27b67b)[_0x1258('0x28')](handleEntityNotFound(_0x53a790,null))['then'](function(_0x1496f1){if(_0x1496f1){var _0x38c9eb=_0x1496f1['get']({'plain':!![]});_0x38c9eb=qs[_0x1258('0x5d')](_0x38c9eb,['id','createdAt',_0x1258('0x5e')]);_0x439c25['body']=_[_0x1258('0x5d')](_0x439c25[_0x1258('0x5f')],['id',_0x1258('0x60'),_0x1258('0x5e')]);return db[_0x1258('0x38')][_0x1258('0x53')](_[_0x1258('0x49')](_0x38c9eb,_0x439c25[_0x1258('0x5f')]),{'include':_0x439c25[_0x1258('0x3a')][_0x1258('0x4c')]?[{'all':!![]}]:undefined})[_0x1258('0x28')](function(_0x2c46aa){var _0x15aca4=_0x439c25[_0x1258('0x55')][_0x1258('0x2a')]({'plain':!![]});if(!_0x15aca4)throw new Error(_0x1258('0x61'));if(_0x15aca4[_0x1258('0x54')]===_0x1258('0x55')){var _0x48c020=_0x2c46aa['get']({'plain':!![]});var _0x2940f5=[{'name':_0x1258('0x62'),'value':_0x1258('0x2b')},{'name':_0x1258('0x2c'),'value':_0x1258('0x2d')}];var _0x485120=_[_0x1258('0x34')](_0x2940f5,[_0x1258('0x31'),_0x48c020[_0x1258('0x33')]])[_0x1258('0x35')];return db[_0x1258('0x56')][_0x1258('0x34')]({'where':{'name':_0x485120,'userProfileId':_0x15aca4['userProfileId']},'raw':!![]})[_0x1258('0x28')](function(_0x4dc2bd){if(_0x4dc2bd&&_0x4dc2bd[_0x1258('0x63')]===0x0){return db[_0x1258('0x58')][_0x1258('0x53')]({'name':_0x48c020[_0x1258('0x35')],'resourceId':_0x48c020['id'],'type':_0x4dc2bd[_0x1258('0x35')],'sectionId':_0x4dc2bd['id']},{})[_0x1258('0x28')](function(){return _0x2c46aa;});}else{return _0x2c46aa;}})[_0x1258('0x59')](function(_0x332ea7){logger['error'](_0x1258('0x5b'),_0x332ea7);throw _0x332ea7;});}return _0x2c46aa;});}})['then'](respondWithResult(_0x53a790,0xc9))[_0x1258('0x59')](handleError(_0x53a790,null));};exports[_0x1258('0x64')]=function(_0x5aa2b7,_0x5a254e){if(_0x5aa2b7[_0x1258('0x5f')]['id']){delete _0x5aa2b7[_0x1258('0x5f')]['id'];}return db[_0x1258('0x38')][_0x1258('0x34')]({'where':{'id':_0x5aa2b7[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x5a254e,null))[_0x1258('0x28')](saveUpdates(_0x5aa2b7[_0x1258('0x5f')],null))[_0x1258('0x28')](respondWithResult(_0x5a254e,null))[_0x1258('0x59')](handleError(_0x5a254e,null));};exports[_0x1258('0x29')]=function(_0x949e25,_0x5a13a8){return db[_0x1258('0x38')][_0x1258('0x34')]({'where':{'id':_0x949e25[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x5a13a8,null))[_0x1258('0x28')](removeEntity(_0x5a13a8,null))[_0x1258('0x59')](handleError(_0x5a13a8,null));};exports['getHoppers']=function(_0x1214ac,_0x4fa126,_0x39ae20){var _0x413e3f={'raw':![],'where':{}};var _0x4a213e={};var _0x3435c2={'count':0x0,'rows':[]};return db[_0x1258('0x38')][_0x1258('0x65')]({'where':{'id':_0x1214ac[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x4fa126,null))[_0x1258('0x28')](function(_0x55fc18){if(_0x55fc18){_0x4a213e['model']=_[_0x1258('0x39')](db[_0x1258('0x66')][_0x1258('0x52')]);_0x4a213e['query']=_[_0x1258('0x39')](_0x1214ac['query']);_0x4a213e[_0x1258('0x3d')]=_['intersection'](_0x4a213e[_0x1258('0x40')],_0x4a213e[_0x1258('0x3a')]);_0x413e3f[_0x1258('0x3f')]=_['intersection'](_0x4a213e['model'],qs[_0x1258('0x41')](_0x1214ac[_0x1258('0x3a')][_0x1258('0x41')]));_0x413e3f['attributes']=_0x413e3f[_0x1258('0x3f')]['length']?_0x413e3f[_0x1258('0x3f')]:_0x4a213e[_0x1258('0x40')];if(!_0x1214ac['query'][_0x1258('0x67')](_0x1258('0x43'))){_0x413e3f['limit']=qs[_0x1258('0x22')](_0x1214ac[_0x1258('0x3a')][_0x1258('0x22')]);_0x413e3f[_0x1258('0x21')]=qs[_0x1258('0x21')](_0x1214ac[_0x1258('0x3a')][_0x1258('0x21')]);}_0x413e3f['order']=qs[_0x1258('0x45')](_0x1214ac[_0x1258('0x3a')][_0x1258('0x45')]);_0x413e3f[_0x1258('0x4a')]=qs[_0x1258('0x3d')](_[_0x1258('0x46')](_0x1214ac[_0x1258('0x3a')],_0x4a213e[_0x1258('0x3d')]));_0x413e3f['where']['VoiceQueueId']=_0x55fc18['id'];if(_0x1214ac[_0x1258('0x3a')][_0x1258('0x2e')]){_0x413e3f[_0x1258('0x4a')]=_['merge'](_0x413e3f['where'],{'$or':_[_0x1258('0x30')](_0x413e3f[_0x1258('0x3f')],function(_0x5d13e7){var _0x50863b={};_0x50863b[_0x5d13e7]={'$like':'%'+_0x1214ac['query'][_0x1258('0x2e')]+'%'};return _0x50863b;})});}_0x413e3f=_['merge']({},_0x413e3f,_0x1214ac[_0x1258('0x4b')]);return db[_0x1258('0x66')][_0x1258('0x20')]({'where':_0x413e3f[_0x1258('0x4a')]})[_0x1258('0x28')](function(_0x3cc1fa){_0x3435c2[_0x1258('0x20')]=_0x3cc1fa;if(_0x1214ac[_0x1258('0x3a')][_0x1258('0x4c')]){_0x413e3f['include']=[{'all':!![]}];}return db[_0x1258('0x66')][_0x1258('0x4e')](_0x413e3f);})[_0x1258('0x28')](function(_0x46e162){_0x3435c2[_0x1258('0x4f')]=_0x46e162;return _0x3435c2;});}})['then'](respondWithFilteredResult(_0x4fa126,_0x413e3f))['catch'](handleError(_0x4fa126,null));};exports[_0x1258('0x68')]=function(_0x3afe26,_0x17d23f,_0x2b7f3a){var _0x2eaed3={'raw':!![],'where':{}};var _0x51402a={};var _0x1a2848={'count':0x0,'rows':[]};return db[_0x1258('0x38')]['findOne']({'where':{'id':_0x3afe26[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x17d23f,null))[_0x1258('0x28')](function(_0x581231){if(_0x581231){_0x51402a['model']=_['keys'](db[_0x1258('0x69')][_0x1258('0x52')]);_0x51402a[_0x1258('0x3a')]=_[_0x1258('0x39')](_0x3afe26[_0x1258('0x3a')]);_0x51402a[_0x1258('0x3d')]=_[_0x1258('0x3e')](_0x51402a[_0x1258('0x40')],_0x51402a[_0x1258('0x3a')]);_0x2eaed3[_0x1258('0x3f')]=_[_0x1258('0x3e')](_0x51402a[_0x1258('0x40')],qs[_0x1258('0x41')](_0x3afe26[_0x1258('0x3a')][_0x1258('0x41')]));_0x2eaed3[_0x1258('0x3f')]=_0x2eaed3[_0x1258('0x3f')][_0x1258('0x42')]?_0x2eaed3['attributes']:_0x51402a[_0x1258('0x40')];if(!_0x3afe26[_0x1258('0x3a')][_0x1258('0x67')](_0x1258('0x43'))){_0x2eaed3[_0x1258('0x22')]=qs[_0x1258('0x22')](_0x3afe26[_0x1258('0x3a')][_0x1258('0x22')]);_0x2eaed3['offset']=qs['offset'](_0x3afe26[_0x1258('0x3a')][_0x1258('0x21')]);}_0x2eaed3[_0x1258('0x44')]=qs[_0x1258('0x45')](_0x3afe26[_0x1258('0x3a')][_0x1258('0x45')]);_0x2eaed3[_0x1258('0x4a')]=qs['filters'](_[_0x1258('0x46')](_0x3afe26[_0x1258('0x3a')],_0x51402a[_0x1258('0x3d')]));_0x2eaed3[_0x1258('0x4a')]['VoiceQueueId']=_0x581231['id'];if(_0x3afe26[_0x1258('0x3a')][_0x1258('0x2e')]){_0x2eaed3[_0x1258('0x4a')]=_[_0x1258('0x49')](_0x2eaed3[_0x1258('0x4a')],{'$or':_['map'](_0x2eaed3[_0x1258('0x3f')],function(_0x396122){var _0x3d8cec={};_0x3d8cec[_0x396122]={'$like':'%'+_0x3afe26[_0x1258('0x3a')][_0x1258('0x2e')]+'%'};return _0x3d8cec;})});}_0x2eaed3=_['merge']({},_0x2eaed3,_0x3afe26['options']);return db[_0x1258('0x69')][_0x1258('0x20')]({'where':_0x2eaed3[_0x1258('0x4a')]})[_0x1258('0x28')](function(_0x34ad2a){_0x1a2848[_0x1258('0x20')]=_0x34ad2a;if(_0x3afe26['query'][_0x1258('0x4c')]){_0x2eaed3['include']=[{'all':!![]}];}return db[_0x1258('0x69')][_0x1258('0x4e')](_0x2eaed3);})[_0x1258('0x28')](function(_0x47b215){_0x1a2848[_0x1258('0x4f')]=_0x47b215;return _0x1a2848;});}})['then'](respondWithFilteredResult(_0x17d23f,_0x2eaed3))['catch'](handleError(_0x17d23f,null));};exports[_0x1258('0x6a')]=function(_0x3fa46b,_0xd4351b,_0x146a70){var _0x212712={'raw':!![],'where':{}};var _0x347ac7={};var _0x121153={'count':0x0,'rows':[]};return db[_0x1258('0x38')][_0x1258('0x65')]({'where':{'id':_0x3fa46b['params']['id']}})[_0x1258('0x28')](handleEntityNotFound(_0xd4351b,null))[_0x1258('0x28')](function(_0xa4c3f8){if(_0xa4c3f8){_0x347ac7[_0x1258('0x40')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x347ac7[_0x1258('0x3a')]=_[_0x1258('0x39')](_0x3fa46b['query']);_0x347ac7['filters']=_['intersection'](_0x347ac7[_0x1258('0x40')],_0x347ac7[_0x1258('0x3a')]);_0x212712[_0x1258('0x3f')]=_['intersection'](_0x347ac7[_0x1258('0x40')],qs[_0x1258('0x41')](_0x3fa46b[_0x1258('0x3a')][_0x1258('0x41')]));_0x212712[_0x1258('0x3f')]=_0x212712[_0x1258('0x3f')][_0x1258('0x42')]?_0x212712['attributes']:_0x347ac7['model'];if(!_0x3fa46b['query'][_0x1258('0x67')](_0x1258('0x43'))){_0x212712[_0x1258('0x22')]=qs['limit'](_0x3fa46b[_0x1258('0x3a')][_0x1258('0x22')]);_0x212712[_0x1258('0x21')]=qs[_0x1258('0x21')](_0x3fa46b[_0x1258('0x3a')][_0x1258('0x21')]);}_0x212712[_0x1258('0x44')]=qs['sort'](_0x3fa46b[_0x1258('0x3a')]['sort']);_0x212712['where']=qs[_0x1258('0x3d')](_['pick'](_0x3fa46b[_0x1258('0x3a')],_0x347ac7['filters']));_0x212712[_0x1258('0x4a')][_0x1258('0x6b')]=_0xa4c3f8['id'];if(_0x3fa46b[_0x1258('0x3a')]['filter']){_0x212712['where']=_['merge'](_0x212712['where'],{'$or':_['map'](_0x212712[_0x1258('0x3f')],function(_0x5129eb){var _0x3fcb10={};_0x3fcb10[_0x5129eb]={'$like':'%'+_0x3fa46b[_0x1258('0x3a')]['filter']+'%'};return _0x3fcb10;})});}_0x212712=_[_0x1258('0x49')]({},_0x212712,_0x3fa46b[_0x1258('0x4b')]);return db[_0x1258('0x6c')][_0x1258('0x20')]({'where':_0x212712[_0x1258('0x4a')]})[_0x1258('0x28')](function(_0x18fc58){_0x121153['count']=_0x18fc58;if(_0x3fa46b[_0x1258('0x3a')]['includeAll']){_0x212712[_0x1258('0x4d')]=[{'all':!![]}];}return db[_0x1258('0x6c')][_0x1258('0x4e')](_0x212712);})[_0x1258('0x28')](function(_0x1a4678){_0x121153[_0x1258('0x4f')]=_0x1a4678;return _0x121153;});}})['then'](respondWithFilteredResult(_0xd4351b,_0x212712))[_0x1258('0x59')](handleError(_0xd4351b,null));};exports[_0x1258('0x6d')]=function(_0xc29001,_0x371f98,_0x3f7afa){var _0xd2757c={'raw':!![],'where':{}};var _0x4e56cb={};var _0xe6c898={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x1258('0x65')]({'where':{'id':_0xc29001[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x371f98,null))[_0x1258('0x28')](function(_0x46d450){if(_0x46d450){_0x4e56cb[_0x1258('0x40')]=_[_0x1258('0x39')](db[_0x1258('0x6e')][_0x1258('0x52')]);_0x4e56cb[_0x1258('0x3a')]=_['keys'](_0xc29001[_0x1258('0x3a')]);_0x4e56cb['filters']=_[_0x1258('0x3e')](_0x4e56cb[_0x1258('0x40')],_0x4e56cb['query']);_0xd2757c[_0x1258('0x3f')]=_['intersection'](_0x4e56cb['model'],qs[_0x1258('0x41')](_0xc29001[_0x1258('0x3a')]['fields']));_0xd2757c[_0x1258('0x3f')]=_0xd2757c[_0x1258('0x3f')]['length']?_0xd2757c['attributes']:_0x4e56cb['model'];if(!_0xc29001[_0x1258('0x3a')]['hasOwnProperty'](_0x1258('0x43'))){_0xd2757c['limit']=qs[_0x1258('0x22')](_0xc29001[_0x1258('0x3a')][_0x1258('0x22')]);_0xd2757c['offset']=qs[_0x1258('0x21')](_0xc29001['query']['offset']);}_0xd2757c[_0x1258('0x44')]=qs['sort'](_0xc29001[_0x1258('0x3a')][_0x1258('0x45')]);_0xd2757c[_0x1258('0x4a')]=qs[_0x1258('0x3d')](_[_0x1258('0x46')](_0xc29001['query'],_0x4e56cb[_0x1258('0x3d')]));_0xd2757c[_0x1258('0x4a')][_0x1258('0x6b')]=_0x46d450['id'];if(_0xc29001[_0x1258('0x3a')][_0x1258('0x2e')]){_0xd2757c[_0x1258('0x4a')]=_['merge'](_0xd2757c[_0x1258('0x4a')],{'$or':_[_0x1258('0x30')](_0xd2757c[_0x1258('0x3f')],function(_0x1b2073){var _0x49bfab={};_0x49bfab[_0x1b2073]={'$like':'%'+_0xc29001[_0x1258('0x3a')]['filter']+'%'};return _0x49bfab;})});}_0xd2757c=_[_0x1258('0x49')]({},_0xd2757c,_0xc29001['options']);return db['CmHopperBlack'][_0x1258('0x20')]({'where':_0xd2757c[_0x1258('0x4a')]})[_0x1258('0x28')](function(_0x235475){_0xe6c898[_0x1258('0x20')]=_0x235475;if(_0xc29001[_0x1258('0x3a')][_0x1258('0x4c')]){_0xd2757c[_0x1258('0x4d')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0xd2757c);})['then'](function(_0xa1b10c){_0xe6c898[_0x1258('0x4f')]=_0xa1b10c;return _0xe6c898;});}})['then'](respondWithFilteredResult(_0x371f98,_0xd2757c))[_0x1258('0x59')](handleError(_0x371f98,null));};exports['getTeams']=function(_0x396adf,_0x58ba8d,_0x517135){var _0x468d8e={};var _0x10fb96={};var _0x211966;var _0x4069ce;return db[_0x1258('0x38')][_0x1258('0x65')]({'where':{'id':_0x396adf[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x58ba8d,null))[_0x1258('0x28')](function(_0x18d553){if(_0x18d553){_0x211966=_0x18d553;_0x10fb96[_0x1258('0x40')]=_['keys'](db[_0x1258('0x6f')]['rawAttributes']);_0x10fb96[_0x1258('0x3a')]=_[_0x1258('0x39')](_0x396adf[_0x1258('0x3a')]);_0x10fb96[_0x1258('0x3d')]=_['intersection'](_0x10fb96[_0x1258('0x40')],_0x10fb96['query']);_0x468d8e[_0x1258('0x3f')]=_['intersection'](_0x10fb96[_0x1258('0x40')],qs['fields'](_0x396adf['query'][_0x1258('0x41')]));_0x468d8e[_0x1258('0x3f')]=_0x468d8e[_0x1258('0x3f')][_0x1258('0x42')]?_0x468d8e[_0x1258('0x3f')]:_0x10fb96['model'];_0x468d8e['order']=qs[_0x1258('0x45')](_0x396adf[_0x1258('0x3a')][_0x1258('0x45')]);_0x468d8e[_0x1258('0x4a')]=qs[_0x1258('0x3d')](_[_0x1258('0x46')](_0x396adf['query'],_0x10fb96['filters']));if(_0x396adf[_0x1258('0x3a')]['filter']){_0x468d8e['where']=_[_0x1258('0x49')](_0x468d8e[_0x1258('0x4a')],{'$or':_[_0x1258('0x30')](_0x468d8e[_0x1258('0x3f')],function(_0x1433dd){var _0x4df467={};_0x4df467[_0x1433dd]={'$like':'%'+_0x396adf['query'][_0x1258('0x2e')]+'%'};return _0x4df467;})});}_0x468d8e=_[_0x1258('0x49')]({},_0x468d8e,_0x396adf[_0x1258('0x4b')]);return _0x211966[_0x1258('0x70')](_0x468d8e);}})[_0x1258('0x28')](function(_0x487d04){if(_0x487d04){_0x4069ce=_0x487d04[_0x1258('0x42')];if(!_0x396adf[_0x1258('0x3a')]['hasOwnProperty']('nolimit')){_0x468d8e[_0x1258('0x22')]=qs[_0x1258('0x22')](_0x396adf[_0x1258('0x3a')][_0x1258('0x22')]);_0x468d8e[_0x1258('0x21')]=qs[_0x1258('0x21')](_0x396adf[_0x1258('0x3a')]['offset']);}return _0x211966[_0x1258('0x70')](_0x468d8e);}})[_0x1258('0x28')](function(_0x4684e3){if(_0x4684e3){return _0x4684e3?{'count':_0x4069ce,'rows':_0x4684e3}:null;}})[_0x1258('0x28')](respondWithResult(_0x58ba8d,null))[_0x1258('0x59')](handleError(_0x58ba8d,null));};exports[_0x1258('0x71')]=function(_0x46a594,_0x125d8d,_0x21079d){var _0x32bb92=[];var _0x1c9703;return db[_0x1258('0x6f')][_0x1258('0x4e')]({'where':{'id':_0x46a594[_0x1258('0x5f')][_0x1258('0x72')]},'attributes':['id'],'include':[{'model':db[_0x1258('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1258('0x28')](function(_0x5a3ae9){if(_0x5a3ae9){for(var _0x346d6c=0x0;_0x346d6c<_0x5a3ae9[_0x1258('0x42')];_0x346d6c+=0x1){for(var _0x41407d=0x0;_0x41407d<_0x5a3ae9[_0x346d6c][_0x1258('0x74')][_0x1258('0x42')];_0x41407d+=0x1){_0x32bb92=_[_0x1258('0x75')](_0x32bb92,[_0x5a3ae9[_0x346d6c][_0x1258('0x74')][_0x41407d]['id']]);}}return _0x32bb92;}})['then'](function(_0x5e7292){if(_0x5e7292){return db[_0x1258('0x38')]['find']({'where':{'id':_0x46a594[_0x1258('0x51')]['id']}});}})[_0x1258('0x28')](function(_0x393649){if(_0x393649){_0x1c9703=_0x393649;return _0x1c9703['addAgents'](_0x32bb92,{'penalty':_0x46a594['body'][_0x1258('0x76')]});}})[_0x1258('0x28')](function(_0x4f6d05){if(_0x4f6d05){return _0x1c9703[_0x1258('0x71')](_0x46a594['body'][_0x1258('0x72')]);}})[_0x1258('0x28')](handleEntityNotFound(_0x125d8d,null))['then'](respondWithStatusCode(_0x125d8d,null))[_0x1258('0x59')](handleError(_0x125d8d,null));};exports[_0x1258('0x77')]=function(_0x2107ab,_0x4f7e45,_0x2a4307){var _0x55aeb0=[];var _0x1ba3f1;return db[_0x1258('0x6f')][_0x1258('0x4e')]({'where':{'id':_0x2107ab['query'][_0x1258('0x72')]},'attributes':['id'],'include':[{'model':db[_0x1258('0x73')],'as':_0x1258('0x74'),'attributes':['id'],'raw':!![]}]})[_0x1258('0x28')](function(_0x425c10){if(_0x425c10){for(var _0x1016ea=0x0;_0x1016ea<_0x425c10[_0x1258('0x42')];_0x1016ea+=0x1){for(var _0x1b6720=0x0;_0x1b6720<_0x425c10[_0x1016ea]['Agents']['length'];_0x1b6720+=0x1){_0x55aeb0=_[_0x1258('0x75')](_0x55aeb0,[_0x425c10[_0x1016ea]['Agents'][_0x1b6720]['id']]);}}return _0x55aeb0;}})[_0x1258('0x28')](function(_0x490652){if(_0x490652){return db['VoiceQueue'][_0x1258('0x34')]({'where':{'id':_0x2107ab[_0x1258('0x51')]['id']}});}})[_0x1258('0x28')](function(_0x1e612c){if(_0x1e612c){_0x1ba3f1=_0x1e612c;return _0x1ba3f1[_0x1258('0x78')](_0x55aeb0);}})[_0x1258('0x28')](function(_0x1c80d5){if(_0x1ba3f1){return _0x1ba3f1['removeTeams'](_0x2107ab[_0x1258('0x3a')]['ids']);}})[_0x1258('0x28')](handleEntityNotFound(_0x4f7e45,null))['then'](respondWithStatusCode(_0x4f7e45,null))[_0x1258('0x59')](handleError(_0x4f7e45,null));};exports[_0x1258('0x79')]=function(_0x418ba9,_0xb1ed10,_0x1d9c67){var _0x5e6fc9,_0x312266;return db[_0x1258('0x38')][_0x1258('0x34')]({'where':{'id':_0x418ba9[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0xb1ed10,null))[_0x1258('0x28')](function(_0x26e6f7){if(_0x26e6f7){_0x312266=_0x26e6f7;return _0x26e6f7['addAgents'](_0x418ba9[_0x1258('0x5f')][_0x1258('0x72')],_['omit'](_0x418ba9[_0x1258('0x5f')],['ids','id'])||{})[_0x1258('0x7a')](function(_0x4a0e6d){for(var _0x103cab=0x0;_0x103cab<_0x418ba9[_0x1258('0x5f')][_0x1258('0x72')][_0x1258('0x42')];_0x103cab+=0x1){socket[_0x1258('0x7b')](_0x1258('0x7c'),{'UserId':_0x418ba9[_0x1258('0x5f')]['ids'][_0x103cab],'VoiceQueueId':_0x418ba9[_0x1258('0x51')]['id']});}return _0x4a0e6d;});}})[_0x1258('0x28')](function(_0x1ab598){_0x5e6fc9=_0x1ab598||[];if(_0x312266){return db['User']['findAll']({'where':{'id':_0x418ba9[_0x1258('0x5f')][_0x1258('0x72')]},'attributes':['id',_0x1258('0x35'),'loginInPause',_0x1258('0x7d'),_0x1258('0x7e')],'raw':!![]});}})['then'](function(_0x4c54be){if(_0x4c54be&&_0x4c54be[_0x1258('0x42')]){var _0x205221=[];for(var _0x3a2ae6=0x0;_0x3a2ae6<_0x4c54be[_0x1258('0x42')];_0x3a2ae6++){_0x205221[_0x1258('0x7f')](db[_0x1258('0x80')][_0x1258('0x81')]({'membername':_0x4c54be[_0x3a2ae6][_0x1258('0x35')],'UserId':_0x4c54be[_0x3a2ae6]['id'],'queue_name':_0x312266[_0x1258('0x35')],'VoiceQueueId':_0x312266['id'],'interface':_[_0x1258('0x82')](_0x4c54be[_0x3a2ae6][_0x1258('0x7e')])?util['format']('SIP/%s',_0x4c54be[_0x3a2ae6]['name']):_0x4c54be[_0x3a2ae6][_0x1258('0x7e')],'paused':_0x4c54be[_0x3a2ae6][_0x1258('0x7d')]||![],'penalty':_0x418ba9[_0x1258('0x5f')][_0x1258('0x76')]||0x0}));}return BPromise['all'](_0x205221);}})['then'](function(_0x23561e){return _0x5e6fc9;})['then'](respondWithResult(_0xb1ed10,null))[_0x1258('0x59')](handleError(_0xb1ed10,null));};exports['removeAgents']=function(_0x36b40f,_0x2cf40c,_0x35d199){var _0x3c36aa;return db[_0x1258('0x38')][_0x1258('0x34')]({'where':{'id':_0x36b40f[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x2cf40c,null))[_0x1258('0x28')](function(_0x310f2a){if(_0x310f2a){return _0x310f2a[_0x1258('0x78')](_0x36b40f['query'][_0x1258('0x72')])['then'](function(_0x2bcc04){if(_[_0x1258('0x83')](_0x36b40f[_0x1258('0x3a')][_0x1258('0x72')])){for(var _0x220355=0x0;_0x220355<_0x36b40f['query'][_0x1258('0x72')][_0x1258('0x42')];_0x220355+=0x1){socket[_0x1258('0x7b')]('userVoiceQueue:remove',{'UserId':_0x36b40f[_0x1258('0x3a')]['ids'][_0x220355],'VoiceQueueId':_0x36b40f[_0x1258('0x51')]['id']});}}else{socket['emit'](_0x1258('0x84'),{'UserId':_0x36b40f[_0x1258('0x3a')]['ids'],'VoiceQueueId':_0x36b40f[_0x1258('0x51')]['id']});}});}})['then'](function(_0x59331d){if(_0x36b40f[_0x1258('0x3a')][_0x1258('0x85')]){_0x3c36aa=_0x59331d;return db['UserVoiceQueueRt'][_0x1258('0x29')]({'where':{'VoiceQueueId':_0x36b40f['params']['id'],'UserId':_0x36b40f[_0x1258('0x3a')]['ids']}})[_0x1258('0x28')](function(){return _0x3c36aa;});}})[_0x1258('0x28')](respondWithStatusCode(_0x2cf40c,null))[_0x1258('0x59')](handleError(_0x2cf40c,null));};exports['getAgents']=function(_0x4cb684,_0xebbcbc,_0x49445c){var _0x331c43={};var _0x4c5b64={};var _0x366c30;var _0x56d744;return db['VoiceQueue'][_0x1258('0x65')]({'where':{'id':_0x4cb684[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0xebbcbc,null))[_0x1258('0x28')](function(_0x327873){if(_0x327873){_0x366c30=_0x327873;_0x4c5b64[_0x1258('0x40')]=_['keys'](db[_0x1258('0x73')]['rawAttributes']);_0x4c5b64[_0x1258('0x3a')]=_['keys'](_0x4cb684[_0x1258('0x3a')]);_0x4c5b64[_0x1258('0x3d')]=_[_0x1258('0x3e')](_0x4c5b64[_0x1258('0x40')],_0x4c5b64[_0x1258('0x3a')]);_0x331c43['attributes']=_[_0x1258('0x3e')](_0x4c5b64[_0x1258('0x40')],qs[_0x1258('0x41')](_0x4cb684[_0x1258('0x3a')][_0x1258('0x41')]));_0x331c43[_0x1258('0x3f')]=_0x331c43['attributes']['length']?_0x331c43[_0x1258('0x3f')]:_0x4c5b64[_0x1258('0x40')];_0x331c43[_0x1258('0x44')]=qs[_0x1258('0x45')](_0x4cb684[_0x1258('0x3a')][_0x1258('0x45')]);_0x331c43[_0x1258('0x4a')]=qs[_0x1258('0x3d')](_[_0x1258('0x46')](_0x4cb684['query'],_0x4c5b64[_0x1258('0x3d')]));if(_0x4cb684[_0x1258('0x3a')][_0x1258('0x2e')]){_0x331c43['where']=_['merge'](_0x331c43['where'],{'$or':_[_0x1258('0x30')](_0x331c43[_0x1258('0x3f')],function(_0x28bbc2){var _0x2128f4={};_0x2128f4[_0x28bbc2]={'$like':'%'+_0x4cb684['query'][_0x1258('0x2e')]+'%'};return _0x2128f4;})});}_0x331c43=_['merge']({},_0x331c43,_0x4cb684['options']);return _0x366c30[_0x1258('0x86')](_0x331c43);}})[_0x1258('0x28')](function(_0x3ace56){if(_0x3ace56){_0x56d744=_0x3ace56[_0x1258('0x42')];if(!_0x4cb684[_0x1258('0x3a')]['hasOwnProperty'](_0x1258('0x43'))){_0x331c43['limit']=qs['limit'](_0x4cb684[_0x1258('0x3a')][_0x1258('0x22')]);_0x331c43['offset']=qs[_0x1258('0x21')](_0x4cb684[_0x1258('0x3a')][_0x1258('0x21')]);}return _0x366c30[_0x1258('0x86')](_0x331c43);}})[_0x1258('0x28')](function(_0x2dd8a2){if(_0x2dd8a2){return _0x2dd8a2?{'count':_0x56d744,'rows':_0x2dd8a2}:null;}})[_0x1258('0x28')](respondWithResult(_0xebbcbc,null))['catch'](handleError(_0xebbcbc,null));};exports[_0x1258('0x87')]=function(_0x3dbc9c,_0x1adec7,_0x319ec8){var _0x18e70a={};var _0x144127={};var _0x566019;var _0x23ab52;return db['VoiceQueue'][_0x1258('0x65')]({'where':{'id':_0x3dbc9c[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x1adec7,null))[_0x1258('0x28')](function(_0x11c3c7){if(_0x11c3c7){_0x566019=_0x11c3c7;_0x144127[_0x1258('0x40')]=_[_0x1258('0x39')](db[_0x1258('0x80')][_0x1258('0x52')]);_0x144127[_0x1258('0x3a')]=_[_0x1258('0x39')](_0x3dbc9c[_0x1258('0x3a')]);_0x144127[_0x1258('0x3d')]=_[_0x1258('0x3e')](_0x144127[_0x1258('0x40')],_0x144127[_0x1258('0x3a')]);_0x18e70a['attributes']=_['intersection'](_0x144127[_0x1258('0x40')],qs[_0x1258('0x41')](_0x3dbc9c[_0x1258('0x3a')][_0x1258('0x41')]));_0x18e70a[_0x1258('0x3f')]=_0x18e70a[_0x1258('0x3f')][_0x1258('0x42')]?_0x18e70a[_0x1258('0x3f')]:_0x144127[_0x1258('0x40')];_0x18e70a[_0x1258('0x44')]=qs[_0x1258('0x45')](_0x3dbc9c['query']['sort']);_0x18e70a[_0x1258('0x4a')]=qs[_0x1258('0x3d')](_['pick'](_0x3dbc9c['query'],_0x144127[_0x1258('0x3d')]));if(_0x3dbc9c[_0x1258('0x3a')][_0x1258('0x2e')]){_0x18e70a['where']=_[_0x1258('0x49')](_0x18e70a[_0x1258('0x4a')],{'$or':_[_0x1258('0x30')](_0x18e70a[_0x1258('0x3f')],function(_0x3452a5){var _0xcde8ca={};_0xcde8ca[_0x3452a5]={'$like':'%'+_0x3dbc9c[_0x1258('0x3a')]['filter']+'%'};return _0xcde8ca;})});}_0x18e70a=_[_0x1258('0x49')]({},_0x18e70a,_0x3dbc9c[_0x1258('0x4b')]);return _0x566019[_0x1258('0x87')](_0x18e70a);}})[_0x1258('0x28')](function(_0x47ae9f){if(_0x47ae9f){_0x23ab52=_0x47ae9f[_0x1258('0x42')];if(!_0x3dbc9c[_0x1258('0x3a')][_0x1258('0x67')]('nolimit')){_0x18e70a[_0x1258('0x22')]=qs['limit'](_0x3dbc9c[_0x1258('0x3a')][_0x1258('0x22')]);_0x18e70a[_0x1258('0x21')]=qs['offset'](_0x3dbc9c['query']['offset']);}return _0x566019['getMembers'](_0x18e70a);}})[_0x1258('0x28')](function(_0x205fd3){return _0x205fd3?{'count':_0x23ab52,'rows':_0x205fd3}:null;})[_0x1258('0x28')](respondWithResult(_0x1adec7,null))[_0x1258('0x59')](handleError(_0x1adec7,null));};exports[_0x1258('0x88')]=function(_0xa302a,_0x3a70e2,_0x44f1fa){var _0xf79803={};var _0x15008e={};var _0x448f09;var _0x3a5072;return db[_0x1258('0x38')][_0x1258('0x65')]({'where':{'id':_0xa302a['params']['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x3a70e2,null))[_0x1258('0x28')](function(_0x1ae13e){if(_0x1ae13e){_0x448f09=_0x1ae13e;_0x15008e[_0x1258('0x40')]=_[_0x1258('0x39')](db[_0x1258('0x89')][_0x1258('0x52')]);_0x15008e[_0x1258('0x3a')]=_[_0x1258('0x39')](_0xa302a[_0x1258('0x3a')]);_0x15008e[_0x1258('0x3d')]=_[_0x1258('0x3e')](_0x15008e[_0x1258('0x40')],_0x15008e[_0x1258('0x3a')]);_0xf79803[_0x1258('0x3f')]=_[_0x1258('0x3e')](_0x15008e['model'],qs['fields'](_0xa302a['query']['fields']));_0xf79803['attributes']=_0xf79803[_0x1258('0x3f')][_0x1258('0x42')]?_0xf79803[_0x1258('0x3f')]:_0x15008e[_0x1258('0x40')];_0xf79803[_0x1258('0x44')]=qs[_0x1258('0x45')](_0xa302a[_0x1258('0x3a')]['sort']);_0xf79803['where']=qs[_0x1258('0x3d')](_[_0x1258('0x46')](_0xa302a['query'],_0x15008e[_0x1258('0x3d')]));if(_0xa302a['query']['filter']){_0xf79803[_0x1258('0x4a')]=_['merge'](_0xf79803[_0x1258('0x4a')],{'$or':_[_0x1258('0x30')](_0xf79803[_0x1258('0x3f')],function(_0x43243d){var _0x39ee30={};_0x39ee30[_0x43243d]={'$like':'%'+_0xa302a[_0x1258('0x3a')][_0x1258('0x2e')]+'%'};return _0x39ee30;})});}_0xf79803=_['merge']({},_0xf79803,_0xa302a[_0x1258('0x4b')]);return _0x448f09['getLists'](_0xf79803);}})['then'](function(_0xbe755a){if(_0xbe755a){_0x3a5072=_0xbe755a[_0x1258('0x42')];if(!_0xa302a[_0x1258('0x3a')][_0x1258('0x67')]('nolimit')){_0xf79803['limit']=qs[_0x1258('0x22')](_0xa302a['query'][_0x1258('0x22')]);_0xf79803[_0x1258('0x21')]=qs['offset'](_0xa302a['query'][_0x1258('0x21')]);}return _0x448f09['getLists'](_0xf79803);}})[_0x1258('0x28')](function(_0x2f785f){if(_0x2f785f){return _0x2f785f?{'count':_0x3a5072,'rows':_0x2f785f}:null;}})['then'](respondWithResult(_0x3a70e2,null))[_0x1258('0x59')](handleError(_0x3a70e2,null));};exports['addLists']=function(_0x5badc8,_0x426b0c,_0x3179d9){var _0xd2e96e,_0x36031b;return db[_0x1258('0x38')]['find']({'where':{'id':_0x5badc8[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x426b0c,null))[_0x1258('0x28')](function(_0x39ebfa){if(_0x39ebfa){_0x36031b=_0x39ebfa;return _0x39ebfa['addLists'](_0x5badc8['body'][_0x1258('0x72')],_[_0x1258('0x5d')](_0x5badc8[_0x1258('0x5f')],[_0x1258('0x72'),'id'])||{});}return null;})[_0x1258('0x7a')](function(_0x2a6337){var _0x188d1b;_0xd2e96e=_0x2a6337||[];var _0x12e7f6=[];if(_0x2a6337){for(var _0x267a79=0x0;_0x267a79<_0x2a6337[_0x1258('0x42')];_0x267a79+=0x1){var _0x114a21=_0x2a6337[_0x267a79]['get']({'plain':!![]});_0x36031b[_0x1258('0x8a')]=_0x5badc8[_0x1258('0x5f')][_0x1258('0x8a')]?_0x5badc8[_0x1258('0x5f')][_0x1258('0x8a')]:_0x36031b[_0x1258('0x8a')];switch(_0x36031b[_0x1258('0x8a')]){case _0x1258('0x8b'):_0x188d1b=squel[_0x1258('0x8c')]()[_0x1258('0x8d')](_0x1258('0x8e'))[_0x1258('0x8f')]([_0x1258('0x90'),_0x1258('0x91'),_0x1258('0x92'),_0x1258('0x93'),'VoiceQueueId','createdAt',_0x1258('0x5e')],squel[_0x1258('0x94')]()[_0x1258('0x95')](_0x1258('0x90'),_0x1258('0x90'))[_0x1258('0x95')](_0x1258('0x96'),_0x1258('0x91'))[_0x1258('0x95')]('id',_0x1258('0x92'))['field'](_0x114a21['CmListId'][_0x1258('0x97')](),'ListId')[_0x1258('0x95')](_0x5badc8[_0x1258('0x51')]['id']['toString'](),_0x1258('0x6b'))[_0x1258('0x95')](_0x1258('0x96'),_0x1258('0x60'))[_0x1258('0x95')](_0x1258('0x96'),_0x1258('0x5e'))[_0x1258('0x98')](_0x1258('0x99'))[_0x1258('0x4a')](_0x1258('0x9a'))[_0x1258('0x4a')](_0x1258('0x9b'),_0x114a21[_0x1258('0x9c')][_0x1258('0x97')]())['where'](_0x1258('0x9d'))[_0x1258('0x4a')](_0x1258('0x9e'),squel[_0x1258('0x94')]()[_0x1258('0x95')](_0x1258('0x9f'))['from'](_0x1258('0xa0'))[_0x1258('0x4a')]('VoiceQueueId\x20=\x20?',_0x5badc8[_0x1258('0x51')]['id'][_0x1258('0x97')]()))[_0x1258('0x4a')](_0x1258('0x9e'),squel[_0x1258('0x94')]()[_0x1258('0x95')](_0x1258('0x90'))[_0x1258('0x98')]('cm_hopper')['where'](_0x1258('0xa1'),_0x5badc8['params']['id'][_0x1258('0x97')]())))[_0x1258('0x97')]();break;case _0x1258('0xa2'):_0x188d1b=squel[_0x1258('0x8c')]()[_0x1258('0x8d')](_0x1258('0x8e'))[_0x1258('0x8f')]([_0x1258('0x90'),'scheduledAt',_0x1258('0x92'),'ListId',_0x1258('0x6b'),_0x1258('0x60'),_0x1258('0x5e')],squel[_0x1258('0x94')]()[_0x1258('0x95')](_0x1258('0x90'),'phone')[_0x1258('0x95')](_0x1258('0x96'),_0x1258('0x91'))['field']('id','ContactId')['field'](_0x114a21[_0x1258('0x9c')][_0x1258('0x97')](),_0x1258('0x93'))['field'](_0x5badc8[_0x1258('0x51')]['id'][_0x1258('0x97')](),_0x1258('0x6b'))['field'](_0x1258('0x96'),'createdAt')[_0x1258('0x95')](_0x1258('0x96'),'updatedAt')['from'](_0x1258('0x99'))[_0x1258('0x4a')](_0x1258('0x9a'))[_0x1258('0x4a')]('ListId\x20=\x20?',_0x114a21[_0x1258('0x9c')]['toString']())[_0x1258('0x4a')](_0x1258('0x9d'))[_0x1258('0x4a')](_0x1258('0x9e'),squel[_0x1258('0x94')]()['field'](_0x1258('0x90'))[_0x1258('0x98')]('cm_hopper')[_0x1258('0x4a')](_0x1258('0xa1'),_0x5badc8['params']['id']['toString']())))[_0x1258('0x97')]();break;default:_0x188d1b=squel[_0x1258('0x8c')]()['into'](_0x1258('0x8e'))[_0x1258('0x8f')](['phone','scheduledAt',_0x1258('0x92'),'ListId','VoiceQueueId','createdAt',_0x1258('0x5e')],squel[_0x1258('0x94')]()[_0x1258('0x95')]('phone',_0x1258('0x90'))[_0x1258('0x95')](_0x1258('0x96'),'scheduledAt')['field']('id',_0x1258('0x92'))[_0x1258('0x95')](_0x114a21[_0x1258('0x9c')]['toString'](),_0x1258('0x93'))[_0x1258('0x95')](_0x5badc8[_0x1258('0x51')]['id']['toString'](),'VoiceQueueId')[_0x1258('0x95')]('NOW()',_0x1258('0x60'))[_0x1258('0x95')](_0x1258('0x96'),_0x1258('0x5e'))[_0x1258('0x98')](_0x1258('0x99'))[_0x1258('0x4a')](_0x1258('0x9a'))['where'](_0x1258('0x9b'),_0x114a21[_0x1258('0x9c')][_0x1258('0x97')]())[_0x1258('0x4a')](_0x1258('0x9d')))[_0x1258('0x97')]();}_0x12e7f6[_0x1258('0x7f')](db[_0x1258('0xa3')][_0x1258('0x3a')](_0x188d1b));}return BPromise[_0x1258('0xa4')](_0x12e7f6);}})[_0x1258('0x28')](function(){return _0xd2e96e;})['then'](respondWithResult(_0x426b0c,null))[_0x1258('0x59')](handleError(_0x426b0c,null));};exports[_0x1258('0xa5')]=function(_0xa2240e,_0x49c002,_0x29e946){var _0x6bdc0d;return db[_0x1258('0x38')]['find']({'where':{'id':_0xa2240e['params']['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x49c002,null))[_0x1258('0x28')](function(_0x2c7245){if(_0x2c7245){return _0x2c7245[_0x1258('0xa5')](_0xa2240e['query']['ids']);}})[_0x1258('0x28')](function(_0x183fe1){if(_0x183fe1){_0x6bdc0d=_0x183fe1;return db[_0x1258('0x66')][_0x1258('0x29')]({'where':{'ListId':_0xa2240e[_0x1258('0x3a')][_0x1258('0x72')],'VoiceQueueId':_0xa2240e[_0x1258('0x51')]['id']}})[_0x1258('0x28')](function(){return _0x6bdc0d;});}})[_0x1258('0x28')](respondWithStatusCode(_0x49c002,null))['catch'](handleError(_0x49c002,null));};exports['getBlackLists']=function(_0x36f731,_0x2616e2,_0x5d4854){var _0x146f53={};var _0xfbad7a={};var _0x1a38fd;var _0x11f0f9;return db[_0x1258('0x38')][_0x1258('0x65')]({'where':{'id':_0x36f731[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x2616e2,null))['then'](function(_0x9b4f02){if(_0x9b4f02){_0x1a38fd=_0x9b4f02;_0xfbad7a[_0x1258('0x40')]=_[_0x1258('0x39')](db[_0x1258('0x89')]['rawAttributes']);_0xfbad7a[_0x1258('0x3a')]=_[_0x1258('0x39')](_0x36f731[_0x1258('0x3a')]);_0xfbad7a[_0x1258('0x3d')]=_[_0x1258('0x3e')](_0xfbad7a[_0x1258('0x40')],_0xfbad7a['query']);_0x146f53[_0x1258('0x3f')]=_['intersection'](_0xfbad7a['model'],qs[_0x1258('0x41')](_0x36f731[_0x1258('0x3a')][_0x1258('0x41')]));_0x146f53['attributes']=_0x146f53[_0x1258('0x3f')]['length']?_0x146f53['attributes']:_0xfbad7a[_0x1258('0x40')];_0x146f53[_0x1258('0x44')]=qs['sort'](_0x36f731[_0x1258('0x3a')][_0x1258('0x45')]);_0x146f53[_0x1258('0x4a')]=qs[_0x1258('0x3d')](_[_0x1258('0x46')](_0x36f731[_0x1258('0x3a')],_0xfbad7a['filters']));if(_0x36f731['query'][_0x1258('0x2e')]){_0x146f53[_0x1258('0x4a')]=_[_0x1258('0x49')](_0x146f53[_0x1258('0x4a')],{'$or':_[_0x1258('0x30')](_0x146f53[_0x1258('0x3f')],function(_0x1054d0){var _0xcac73c={};_0xcac73c[_0x1054d0]={'$like':'%'+_0x36f731[_0x1258('0x3a')][_0x1258('0x2e')]+'%'};return _0xcac73c;})});}_0x146f53=_[_0x1258('0x49')]({},_0x146f53,_0x36f731[_0x1258('0x4b')]);return _0x1a38fd[_0x1258('0xa6')](_0x146f53);}})[_0x1258('0x28')](function(_0x4cd4b0){if(_0x4cd4b0){_0x11f0f9=_0x4cd4b0[_0x1258('0x42')];if(!_0x36f731[_0x1258('0x3a')][_0x1258('0x67')](_0x1258('0x43'))){_0x146f53[_0x1258('0x22')]=qs['limit'](_0x36f731['query'][_0x1258('0x22')]);_0x146f53[_0x1258('0x21')]=qs[_0x1258('0x21')](_0x36f731['query'][_0x1258('0x21')]);}return _0x1a38fd['getBlackLists'](_0x146f53);}})[_0x1258('0x28')](function(_0xab5744){if(_0xab5744){return _0xab5744?{'count':_0x11f0f9,'rows':_0xab5744}:null;}})[_0x1258('0x28')](respondWithResult(_0x2616e2,null))[_0x1258('0x59')](handleError(_0x2616e2,null));};exports[_0x1258('0xa7')]=function(_0x5b3fc2,_0x4a42ab,_0x3a4844){var _0x446092,_0x1ee6c5;return db[_0x1258('0x38')][_0x1258('0x34')]({'where':{'id':_0x5b3fc2[_0x1258('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a42ab,null))[_0x1258('0x28')](function(_0x5e6028){if(_0x5e6028){_0x1ee6c5=_0x5e6028;return _0x5e6028[_0x1258('0xa7')](_0x5b3fc2['body'][_0x1258('0x72')],_[_0x1258('0x5d')](_0x5b3fc2[_0x1258('0x5f')],[_0x1258('0x72'),'id'])||{});}return null;})[_0x1258('0x7a')](function(_0x10f94d){var _0x243691;_0x446092=_0x10f94d||[];var _0x129cfe=[];if(_0x10f94d){for(var _0x125f34=0x0;_0x125f34<_0x10f94d[_0x1258('0x42')];_0x125f34+=0x1){var _0x4e67e0=_0x10f94d[_0x125f34][_0x1258('0x2a')]({'plain':!![]});_0x243691=squel['insert']()[_0x1258('0x8d')](_0x1258('0xa8'))[_0x1258('0x8f')]([_0x1258('0x90'),'ContactId',_0x1258('0x93'),'VoiceQueueId','createdAt',_0x1258('0x5e')],squel['select']()[_0x1258('0x95')](_0x1258('0x90'),'phone')[_0x1258('0x95')]('id',_0x1258('0x92'))[_0x1258('0x95')](_0x4e67e0[_0x1258('0x9c')]['toString'](),'ListId')[_0x1258('0x95')](_0x5b3fc2[_0x1258('0x51')]['id']['toString'](),_0x1258('0x6b'))[_0x1258('0x95')](_0x1258('0x96'),'createdAt')[_0x1258('0x95')](_0x1258('0x96'),'updatedAt')['from'](_0x1258('0x99'))[_0x1258('0x4a')]('deletedAt\x20IS\x20NULL')[_0x1258('0x4a')](_0x1258('0x9b'),_0x4e67e0[_0x1258('0x9c')][_0x1258('0x97')]())[_0x1258('0x4a')](_0x1258('0x9d')))[_0x1258('0x97')]();_0x129cfe['push'](db['sequelize'][_0x1258('0x3a')](_0x243691));}return BPromise[_0x1258('0xa4')](_0x129cfe);}})['then'](function(){return _0x446092;})['then'](respondWithResult(_0x4a42ab,null))[_0x1258('0x59')](handleError(_0x4a42ab,null));};exports['removeBlackLists']=function(_0x4fbbe3,_0x380ae0,_0x5e942d){var _0x320150;return db[_0x1258('0x38')][_0x1258('0x34')]({'where':{'id':_0x4fbbe3[_0x1258('0x51')]['id']}})[_0x1258('0x28')](handleEntityNotFound(_0x380ae0,null))[_0x1258('0x28')](function(_0x28b34a){if(_0x28b34a){return _0x28b34a[_0x1258('0xa9')](_0x4fbbe3[_0x1258('0x3a')][_0x1258('0x72')]);}})[_0x1258('0x28')](function(_0x25a7c5){if(_0x25a7c5){_0x320150=_0x25a7c5;return db[_0x1258('0x6e')]['destroy']({'where':{'ListId':_0x4fbbe3[_0x1258('0x3a')][_0x1258('0x72')],'VoiceQueueId':_0x4fbbe3[_0x1258('0x51')]['id']}})[_0x1258('0x28')](function(){return _0x320150;});}})[_0x1258('0x28')](respondWithStatusCode(_0x380ae0,null))['catch'](handleError(_0x380ae0,null));}; \ No newline at end of file +var _0x6b8f=['includes','type','find','value','UserProfileResource','end','error','stack','name','send','index','VoiceQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','add','day','merge','options','include','findAll','rows','catch','show','includeAll','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','getHoppers','findOne','hasOwnProperty','CmHopper','CmHopperHistory','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','ids','User','Agents','union','addAgents','removeTeams','removeAgents','spread','userVoiceQueue:save','loginInPause','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','isArray','userVoiceQueue:remove','emit','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','select','field','toString','ListId','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','VoiceQueueId\x20=\x20?','cm_hopper','CmListId','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','removeBlackLists','eml-format','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','update','destroy','then','get','VoiceQueues','inbound','outbound','filter','ignore','map'];(function(_0x4dcb18,_0x87fe5a){var _0x350f7c=function(_0x1d0ae1){while(--_0x1d0ae1){_0x4dcb18['push'](_0x4dcb18['shift']());}};_0x350f7c(++_0x87fe5a);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x3c4bbb,_0x307113){_0x3c4bbb=_0x3c4bbb-0x0;var _0x2d3592=_0x6b8f[_0x3c4bbb];return _0x2d3592;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf6b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6b8('0x2'));var BPromise=require(_0xf6b8('0x3'));var Mustache=require('mustache');var util=require(_0xf6b8('0x4'));var path=require(_0xf6b8('0x5'));var sox=require(_0xf6b8('0x6'));var csv=require('to-csv');var ejs=require(_0xf6b8('0x7'));var fs=require('fs');var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0xb'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xc'));var Redis=require(_0xf6b8('0xd'));var qs=require(_0xf6b8('0xe'));var logger=require(_0xf6b8('0xf'))(_0xf6b8('0x10'));var utils=require(_0xf6b8('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf6b8('0x12')](config[_0xf6b8('0x13')],{'host':_0xf6b8('0x14'),'port':0x18eb});var socket=require(_0xf6b8('0x15'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xf6b8('0x16')](socket);function respondWithStatusCode(_0x3899a9,_0x5104d3){_0x5104d3=_0x5104d3||0xcc;return function(_0xfcecc9){if(_0xfcecc9){return _0x3899a9[_0xf6b8('0x17')](_0x5104d3);}return _0x3899a9[_0xf6b8('0x18')](_0x5104d3)['end']();};}function respondWithResult(_0x3e162e,_0x53d744){_0x53d744=_0x53d744||0xc8;return function(_0x410345){if(_0x410345){return _0x3e162e[_0xf6b8('0x18')](_0x53d744)[_0xf6b8('0x19')](_0x410345);}};}function respondWithFilteredResult(_0x1a4b65,_0x12f9a8){return function(_0x567b58){if(_0x567b58){var _0x48e375=_0x567b58[_0xf6b8('0x1a')],_0x3bb9ae=_0x12f9a8['offset'],_0x56508b=_0x12f9a8['offset']+_0x12f9a8[_0xf6b8('0x1b')],_0x3cf63c;if(_0x56508b>=_0x48e375){_0x56508b=_0x48e375;_0x3cf63c=0xc8;}else{_0x3cf63c=0xce;}_0x1a4b65[_0xf6b8('0x18')](_0x3cf63c);return _0x1a4b65[_0xf6b8('0x1c')](_0xf6b8('0x1d'),_0x3bb9ae+'-'+_0x56508b+'/'+_0x48e375)['json'](_0x567b58);}return null;};}function patchUpdates(_0x59f9df){return function(_0x5a9553){try{jsonpatch[_0xf6b8('0x1e')](_0x5a9553,_0x59f9df,!![]);}catch(_0x2a8195){return BPromise[_0xf6b8('0x1f')](_0x2a8195);}return _0x5a9553['save']();};}function saveUpdates(_0x136bc6,_0x193e84){return function(_0x3d2c57){if(_0x3d2c57){return _0x3d2c57[_0xf6b8('0x20')](_0x136bc6)['then'](function(_0xd2c23e){return _0xd2c23e;});}return null;};}function removeEntity(_0x5c92ed,_0x22c52d){return function(_0x2b5bd3){if(_0x2b5bd3){return _0x2b5bd3[_0xf6b8('0x21')]()[_0xf6b8('0x22')](function(){var _0x565e45=_0x2b5bd3[_0xf6b8('0x23')]({'plain':!![]});var _0x4edd29=[{'name':_0xf6b8('0x24'),'value':_0xf6b8('0x25'),'ignore':![]},{'name':'QueueCampaigns','value':_0xf6b8('0x26'),'ignore':![]}];var _0x378e89=_(_0x4edd29)[_0xf6b8('0x27')](_0xf6b8('0x28'))[_0xf6b8('0x29')]('value')['value']();if(_[_0xf6b8('0x2a')](_0x378e89,_0x565e45[_0xf6b8('0x2b')])){return;}var _0x5a9514=_[_0xf6b8('0x2c')](_0x4edd29,[_0xf6b8('0x2d'),_0x565e45[_0xf6b8('0x2b')]])['name'];return db[_0xf6b8('0x2e')][_0xf6b8('0x21')]({'where':{'type':_0x5a9514,'resourceId':_0x565e45['id']}})['then'](function(){return _0x2b5bd3;});})[_0xf6b8('0x22')](function(){_0x5c92ed[_0xf6b8('0x18')](0xcc)[_0xf6b8('0x2f')]();});}};}function handleEntityNotFound(_0x223ee7,_0x51ffcf){return function(_0x2d3515){if(!_0x2d3515){_0x223ee7[_0xf6b8('0x17')](0x194);}return _0x2d3515;};}function handleError(_0x4006a6,_0x48b07f){_0x48b07f=_0x48b07f||0x1f4;return function(_0x7c7546){logger[_0xf6b8('0x30')](_0x7c7546[_0xf6b8('0x31')]);if(_0x7c7546['name']){delete _0x7c7546[_0xf6b8('0x32')];}_0x4006a6[_0xf6b8('0x18')](_0x48b07f)[_0xf6b8('0x33')](_0x7c7546);};}exports[_0xf6b8('0x34')]=function(_0x4be3cb,_0x1cb84d){var _0x1b2725={},_0x920fb1={},_0x5e0ed9={'count':0x0,'rows':[]};var _0x583341=db[_0xf6b8('0x35')][_0xf6b8('0x36')];_0x920fb1[_0xf6b8('0x37')]=_[_0xf6b8('0x38')](_0x583341);var _0xb24c78={'dateStart':_0x4be3cb[_0xf6b8('0x39')][_0xf6b8('0x3a')],'dateEnd':_0x4be3cb[_0xf6b8('0x39')][_0xf6b8('0x3b')]};delete _0x4be3cb[_0xf6b8('0x39')][_0xf6b8('0x3a')];delete _0x4be3cb[_0xf6b8('0x39')][_0xf6b8('0x3b')];_0x920fb1[_0xf6b8('0x39')]=_[_0xf6b8('0x38')](_0x4be3cb[_0xf6b8('0x39')]);_0x920fb1[_0xf6b8('0x3c')]=_[_0xf6b8('0x3d')](_0x920fb1['model'],_0x920fb1['query']);_0x1b2725[_0xf6b8('0x3e')]=_[_0xf6b8('0x3d')](_0x920fb1[_0xf6b8('0x37')],qs[_0xf6b8('0x3f')](_0x4be3cb[_0xf6b8('0x39')][_0xf6b8('0x3f')]));_0x1b2725[_0xf6b8('0x3e')]=_0x1b2725[_0xf6b8('0x3e')][_0xf6b8('0x40')]?_0x1b2725[_0xf6b8('0x3e')]:_0x920fb1[_0xf6b8('0x37')];if(!_0x4be3cb[_0xf6b8('0x39')]['hasOwnProperty'](_0xf6b8('0x41'))){_0x1b2725[_0xf6b8('0x1b')]=qs['limit'](_0x4be3cb[_0xf6b8('0x39')][_0xf6b8('0x1b')]);_0x1b2725[_0xf6b8('0x42')]=qs[_0xf6b8('0x42')](_0x4be3cb[_0xf6b8('0x39')][_0xf6b8('0x42')]);}_0x1b2725[_0xf6b8('0x43')]=qs[_0xf6b8('0x44')](_0x4be3cb[_0xf6b8('0x39')][_0xf6b8('0x44')]);_0x1b2725[_0xf6b8('0x45')]=qs[_0xf6b8('0x3c')](_[_0xf6b8('0x46')](_0x4be3cb[_0xf6b8('0x39')],_0x920fb1['filters']));if(_0xb24c78['dateStart']){if(_0xb24c78['dateEnd']){_0xb24c78[_0xf6b8('0x3b')]=moment(_0xb24c78[_0xf6b8('0x3b')])[_0xf6b8('0x47')](0x1,_0xf6b8('0x48'));}else{_0xb24c78[_0xf6b8('0x3b')]=moment(_0xb24c78[_0xf6b8('0x3a')])[_0xf6b8('0x47')](0x1,'day');}_[_0xf6b8('0x49')](_0x1b2725['where'],{'createdAt':{'$gte':_0xb24c78[_0xf6b8('0x3a')],'$lte':_0xb24c78[_0xf6b8('0x3b')]}});}if(_0x4be3cb[_0xf6b8('0x39')][_0xf6b8('0x27')]){_0x1b2725[_0xf6b8('0x45')]=_['merge'](_0x1b2725[_0xf6b8('0x45')],{'$or':_[_0xf6b8('0x29')](_0x1b2725[_0xf6b8('0x3e')],function(_0x448243){var _0x558672={};_0x558672[_0x448243]={'$like':'%'+_0x4be3cb['query'][_0xf6b8('0x27')]+'%'};return _0x558672;})});}_0x1b2725=_[_0xf6b8('0x49')]({},_0x1b2725,_0x4be3cb[_0xf6b8('0x4a')]);var _0x5806dc={'where':_0x1b2725['where']};return db[_0xf6b8('0x35')][_0xf6b8('0x1a')](_0x5806dc)[_0xf6b8('0x22')](function(_0x28a80e){_0x5e0ed9['count']=_0x28a80e;if(_0x4be3cb['query']['includeAll']){_0x1b2725[_0xf6b8('0x4b')]=[{'all':!![]}];}return db['VoiceQueue'][_0xf6b8('0x4c')](_0x1b2725);})[_0xf6b8('0x22')](function(_0x12f582){_0x5e0ed9[_0xf6b8('0x4d')]=_0x12f582;return _0x5e0ed9;})[_0xf6b8('0x22')](respondWithFilteredResult(_0x1cb84d,_0x1b2725))[_0xf6b8('0x4e')](handleError(_0x1cb84d,null));};exports[_0xf6b8('0x4f')]=function(_0xc1a738,_0x394a34){var _0x597511={'raw':![],'where':{'id':_0xc1a738['params']['id']}},_0x1144b3={};_0x1144b3[_0xf6b8('0x37')]=_[_0xf6b8('0x38')](db[_0xf6b8('0x35')][_0xf6b8('0x36')]);_0x1144b3[_0xf6b8('0x39')]=_[_0xf6b8('0x38')](_0xc1a738[_0xf6b8('0x39')]);_0x1144b3['filters']=_[_0xf6b8('0x3d')](_0x1144b3[_0xf6b8('0x37')],_0x1144b3[_0xf6b8('0x39')]);_0x597511[_0xf6b8('0x3e')]=_['intersection'](_0x1144b3[_0xf6b8('0x37')],qs[_0xf6b8('0x3f')](_0xc1a738['query'][_0xf6b8('0x3f')]));_0x597511[_0xf6b8('0x3e')]=_0x597511[_0xf6b8('0x3e')][_0xf6b8('0x40')]?_0x597511[_0xf6b8('0x3e')]:_0x1144b3['model'];if(_0xc1a738[_0xf6b8('0x39')][_0xf6b8('0x50')]){_0x597511['include']=[{'all':!![]}];}_0x597511=_['merge']({},_0x597511,_0xc1a738['options']);return db[_0xf6b8('0x35')][_0xf6b8('0x2c')](_0x597511)[_0xf6b8('0x22')](handleEntityNotFound(_0x394a34,null))[_0xf6b8('0x22')](respondWithResult(_0x394a34,null))['catch'](handleError(_0x394a34,null));};exports[_0xf6b8('0x51')]=function(_0x40c563,_0x1119ca){return db[_0xf6b8('0x35')][_0xf6b8('0x51')](_0x40c563[_0xf6b8('0x52')],{})[_0xf6b8('0x22')](function(_0x4e4c90){var _0x5e179d=_0x40c563[_0xf6b8('0x53')][_0xf6b8('0x23')]({'plain':!![]});if(!_0x5e179d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e179d['role']===_0xf6b8('0x53')){var _0xc0e082=_0x4e4c90[_0xf6b8('0x23')]({'plain':!![]});var _0x25cf3d=[{'name':_0xf6b8('0x24'),'value':_0xf6b8('0x25')},{'name':'QueueCampaigns','value':_0xf6b8('0x26')}];var _0x1a1453=_[_0xf6b8('0x2c')](_0x25cf3d,[_0xf6b8('0x2d'),_0xc0e082['type']])[_0xf6b8('0x32')];return db[_0xf6b8('0x54')]['find']({'where':{'name':_0x1a1453,'userProfileId':_0x5e179d[_0xf6b8('0x55')]},'raw':!![]})[_0xf6b8('0x22')](function(_0x33b639){if(_0x33b639&&_0x33b639['autoAssociation']===0x0){return db[_0xf6b8('0x2e')][_0xf6b8('0x51')]({'name':_0xc0e082[_0xf6b8('0x32')],'resourceId':_0xc0e082['id'],'type':_0x33b639[_0xf6b8('0x32')],'sectionId':_0x33b639['id']},{})[_0xf6b8('0x22')](function(){return _0x4e4c90;});}else{return _0x4e4c90;}})[_0xf6b8('0x4e')](function(_0x41ade8){logger[_0xf6b8('0x30')](_0xf6b8('0x56'),_0x41ade8);throw _0x41ade8;});}return _0x4e4c90;})[_0xf6b8('0x22')](respondWithResult(_0x1119ca,0xc9))[_0xf6b8('0x4e')](handleError(_0x1119ca,null));};exports[_0xf6b8('0x57')]=function(_0x5d124b,_0x5b663c){var _0x5c3871={'raw':![],'where':{'id':_0x5d124b[_0xf6b8('0x58')]['id']}},_0x2ee325={};_0x2ee325[_0xf6b8('0x37')]=_[_0xf6b8('0x38')](db['VoiceQueue'][_0xf6b8('0x36')]);_0x5c3871[_0xf6b8('0x3e')]=_[_0xf6b8('0x3d')](_0x2ee325['model'],qs[_0xf6b8('0x3f')](_0x5d124b[_0xf6b8('0x39')][_0xf6b8('0x3f')]));_0x5c3871['attributes']=_0x5c3871['attributes'][_0xf6b8('0x40')]?_0x5c3871[_0xf6b8('0x3e')]:_0x2ee325[_0xf6b8('0x37')];if(_0x5d124b[_0xf6b8('0x39')]['includeAll']){_0x5c3871[_0xf6b8('0x4b')]=[{'all':!![]}];}_0x5c3871=_['merge']({},_0x5c3871,_0x5d124b[_0xf6b8('0x4a')]);return db[_0xf6b8('0x35')][_0xf6b8('0x2c')](_0x5c3871)[_0xf6b8('0x22')](handleEntityNotFound(_0x5b663c,null))[_0xf6b8('0x22')](function(_0x4e2241){if(_0x4e2241){var _0x2f62f7=_0x4e2241[_0xf6b8('0x23')]({'plain':!![]});_0x2f62f7=qs[_0xf6b8('0x59')](_0x2f62f7,['id',_0xf6b8('0x5a'),_0xf6b8('0x5b')]);_0x5d124b[_0xf6b8('0x52')]=_[_0xf6b8('0x59')](_0x5d124b[_0xf6b8('0x52')],['id',_0xf6b8('0x5a'),_0xf6b8('0x5b')]);return db['VoiceQueue'][_0xf6b8('0x51')](_[_0xf6b8('0x49')](_0x2f62f7,_0x5d124b[_0xf6b8('0x52')]),{'include':_0x5d124b['query'][_0xf6b8('0x50')]?[{'all':!![]}]:undefined})['then'](function(_0x459268){var _0x5f0ed7=_0x5d124b['user'][_0xf6b8('0x23')]({'plain':!![]});if(!_0x5f0ed7)throw new Error(_0xf6b8('0x5c'));if(_0x5f0ed7[_0xf6b8('0x5d')]===_0xf6b8('0x53')){var _0x1a293d=_0x459268['get']({'plain':!![]});var _0xbae668=[{'name':_0xf6b8('0x24'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xf6b8('0x26')}];var _0x36b8a2=_[_0xf6b8('0x2c')](_0xbae668,[_0xf6b8('0x2d'),_0x1a293d[_0xf6b8('0x2b')]])['name'];return db['UserProfileSection'][_0xf6b8('0x2c')]({'where':{'name':_0x36b8a2,'userProfileId':_0x5f0ed7[_0xf6b8('0x55')]},'raw':!![]})[_0xf6b8('0x22')](function(_0x8bc0cd){if(_0x8bc0cd&&_0x8bc0cd['autoAssociation']===0x0){return db[_0xf6b8('0x2e')][_0xf6b8('0x51')]({'name':_0x1a293d[_0xf6b8('0x32')],'resourceId':_0x1a293d['id'],'type':_0x8bc0cd[_0xf6b8('0x32')],'sectionId':_0x8bc0cd['id']},{})[_0xf6b8('0x22')](function(){return _0x459268;});}else{return _0x459268;}})[_0xf6b8('0x4e')](function(_0x7a8ae6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7a8ae6);throw _0x7a8ae6;});}return _0x459268;});}})[_0xf6b8('0x22')](respondWithResult(_0x5b663c,0xc9))[_0xf6b8('0x4e')](handleError(_0x5b663c,null));};exports[_0xf6b8('0x20')]=function(_0x4776a7,_0x4707ff){if(_0x4776a7[_0xf6b8('0x52')]['id']){delete _0x4776a7[_0xf6b8('0x52')]['id'];}return db[_0xf6b8('0x35')]['find']({'where':{'id':_0x4776a7[_0xf6b8('0x58')]['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0x4707ff,null))[_0xf6b8('0x22')](saveUpdates(_0x4776a7[_0xf6b8('0x52')],null))[_0xf6b8('0x22')](respondWithResult(_0x4707ff,null))['catch'](handleError(_0x4707ff,null));};exports[_0xf6b8('0x21')]=function(_0x5459af,_0xc4fce7){return db[_0xf6b8('0x35')][_0xf6b8('0x2c')]({'where':{'id':_0x5459af[_0xf6b8('0x58')]['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0xc4fce7,null))[_0xf6b8('0x22')](removeEntity(_0xc4fce7,null))['catch'](handleError(_0xc4fce7,null));};exports[_0xf6b8('0x5e')]=function(_0x457f9b,_0x1c6692,_0x3d76ee){var _0x396a7c={'raw':![],'where':{}};var _0x3d6e09={};var _0x3b3e12={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf6b8('0x5f')]({'where':{'id':_0x457f9b[_0xf6b8('0x58')]['id']}})['then'](handleEntityNotFound(_0x1c6692,null))[_0xf6b8('0x22')](function(_0x7756c3){if(_0x7756c3){_0x3d6e09[_0xf6b8('0x37')]=_[_0xf6b8('0x38')](db['CmHopper'][_0xf6b8('0x36')]);_0x3d6e09[_0xf6b8('0x39')]=_[_0xf6b8('0x38')](_0x457f9b['query']);_0x3d6e09[_0xf6b8('0x3c')]=_['intersection'](_0x3d6e09['model'],_0x3d6e09[_0xf6b8('0x39')]);_0x396a7c[_0xf6b8('0x3e')]=_[_0xf6b8('0x3d')](_0x3d6e09[_0xf6b8('0x37')],qs[_0xf6b8('0x3f')](_0x457f9b[_0xf6b8('0x39')][_0xf6b8('0x3f')]));_0x396a7c[_0xf6b8('0x3e')]=_0x396a7c[_0xf6b8('0x3e')][_0xf6b8('0x40')]?_0x396a7c[_0xf6b8('0x3e')]:_0x3d6e09[_0xf6b8('0x37')];if(!_0x457f9b[_0xf6b8('0x39')][_0xf6b8('0x60')](_0xf6b8('0x41'))){_0x396a7c['limit']=qs['limit'](_0x457f9b[_0xf6b8('0x39')][_0xf6b8('0x1b')]);_0x396a7c['offset']=qs[_0xf6b8('0x42')](_0x457f9b[_0xf6b8('0x39')][_0xf6b8('0x42')]);}_0x396a7c[_0xf6b8('0x43')]=qs['sort'](_0x457f9b[_0xf6b8('0x39')][_0xf6b8('0x44')]);_0x396a7c[_0xf6b8('0x45')]=qs['filters'](_['pick'](_0x457f9b['query'],_0x3d6e09[_0xf6b8('0x3c')]));_0x396a7c[_0xf6b8('0x45')]['VoiceQueueId']=_0x7756c3['id'];if(_0x457f9b[_0xf6b8('0x39')]['filter']){_0x396a7c[_0xf6b8('0x45')]=_[_0xf6b8('0x49')](_0x396a7c['where'],{'$or':_[_0xf6b8('0x29')](_0x396a7c[_0xf6b8('0x3e')],function(_0x21a3b2){var _0x267cc8={};_0x267cc8[_0x21a3b2]={'$like':'%'+_0x457f9b['query'][_0xf6b8('0x27')]+'%'};return _0x267cc8;})});}_0x396a7c=_[_0xf6b8('0x49')]({},_0x396a7c,_0x457f9b['options']);return db[_0xf6b8('0x61')][_0xf6b8('0x1a')]({'where':_0x396a7c[_0xf6b8('0x45')]})['then'](function(_0x583d31){_0x3b3e12['count']=_0x583d31;if(_0x457f9b[_0xf6b8('0x39')][_0xf6b8('0x50')]){_0x396a7c[_0xf6b8('0x4b')]=[{'all':!![]}];}return db[_0xf6b8('0x61')][_0xf6b8('0x4c')](_0x396a7c);})[_0xf6b8('0x22')](function(_0x32ec89){_0x3b3e12[_0xf6b8('0x4d')]=_0x32ec89;return _0x3b3e12;});}})['then'](respondWithFilteredResult(_0x1c6692,_0x396a7c))[_0xf6b8('0x4e')](handleError(_0x1c6692,null));};exports['getHopperHistories']=function(_0x1f4148,_0x411e2e,_0x3e6756){var _0x5ccae2={'raw':!![],'where':{}};var _0x444bae={};var _0x5d247c={'count':0x0,'rows':[]};return db[_0xf6b8('0x35')]['findOne']({'where':{'id':_0x1f4148['params']['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0x411e2e,null))[_0xf6b8('0x22')](function(_0x360b04){if(_0x360b04){_0x444bae[_0xf6b8('0x37')]=_['keys'](db[_0xf6b8('0x62')][_0xf6b8('0x36')]);_0x444bae['query']=_[_0xf6b8('0x38')](_0x1f4148['query']);_0x444bae[_0xf6b8('0x3c')]=_[_0xf6b8('0x3d')](_0x444bae['model'],_0x444bae[_0xf6b8('0x39')]);_0x5ccae2[_0xf6b8('0x3e')]=_[_0xf6b8('0x3d')](_0x444bae[_0xf6b8('0x37')],qs['fields'](_0x1f4148[_0xf6b8('0x39')]['fields']));_0x5ccae2[_0xf6b8('0x3e')]=_0x5ccae2[_0xf6b8('0x3e')][_0xf6b8('0x40')]?_0x5ccae2[_0xf6b8('0x3e')]:_0x444bae[_0xf6b8('0x37')];if(!_0x1f4148[_0xf6b8('0x39')][_0xf6b8('0x60')](_0xf6b8('0x41'))){_0x5ccae2[_0xf6b8('0x1b')]=qs[_0xf6b8('0x1b')](_0x1f4148[_0xf6b8('0x39')][_0xf6b8('0x1b')]);_0x5ccae2['offset']=qs[_0xf6b8('0x42')](_0x1f4148[_0xf6b8('0x39')][_0xf6b8('0x42')]);}_0x5ccae2[_0xf6b8('0x43')]=qs[_0xf6b8('0x44')](_0x1f4148['query'][_0xf6b8('0x44')]);_0x5ccae2[_0xf6b8('0x45')]=qs[_0xf6b8('0x3c')](_[_0xf6b8('0x46')](_0x1f4148['query'],_0x444bae[_0xf6b8('0x3c')]));_0x5ccae2[_0xf6b8('0x45')][_0xf6b8('0x63')]=_0x360b04['id'];if(_0x1f4148[_0xf6b8('0x39')][_0xf6b8('0x27')]){_0x5ccae2[_0xf6b8('0x45')]=_['merge'](_0x5ccae2[_0xf6b8('0x45')],{'$or':_[_0xf6b8('0x29')](_0x5ccae2[_0xf6b8('0x3e')],function(_0x5557fa){var _0x220d6b={};_0x220d6b[_0x5557fa]={'$like':'%'+_0x1f4148[_0xf6b8('0x39')][_0xf6b8('0x27')]+'%'};return _0x220d6b;})});}_0x5ccae2=_[_0xf6b8('0x49')]({},_0x5ccae2,_0x1f4148[_0xf6b8('0x4a')]);return db['CmHopperHistory'][_0xf6b8('0x1a')]({'where':_0x5ccae2[_0xf6b8('0x45')]})['then'](function(_0x2f110c){_0x5d247c['count']=_0x2f110c;if(_0x1f4148[_0xf6b8('0x39')][_0xf6b8('0x50')]){_0x5ccae2['include']=[{'all':!![]}];}return db[_0xf6b8('0x62')][_0xf6b8('0x4c')](_0x5ccae2);})[_0xf6b8('0x22')](function(_0x460d68){_0x5d247c[_0xf6b8('0x4d')]=_0x460d68;return _0x5d247c;});}})['then'](respondWithFilteredResult(_0x411e2e,_0x5ccae2))[_0xf6b8('0x4e')](handleError(_0x411e2e,null));};exports['getHopperFinals']=function(_0x35730d,_0x56bb05,_0x397cb7){var _0x4f9895={'raw':!![],'where':{}};var _0x3e8f6a={};var _0x1814d1={'count':0x0,'rows':[]};return db[_0xf6b8('0x35')]['findOne']({'where':{'id':_0x35730d[_0xf6b8('0x58')]['id']}})['then'](handleEntityNotFound(_0x56bb05,null))[_0xf6b8('0x22')](function(_0x508bac){if(_0x508bac){_0x3e8f6a[_0xf6b8('0x37')]=_[_0xf6b8('0x38')](db['CmHopperFinal'][_0xf6b8('0x36')]);_0x3e8f6a[_0xf6b8('0x39')]=_[_0xf6b8('0x38')](_0x35730d[_0xf6b8('0x39')]);_0x3e8f6a['filters']=_[_0xf6b8('0x3d')](_0x3e8f6a['model'],_0x3e8f6a['query']);_0x4f9895[_0xf6b8('0x3e')]=_['intersection'](_0x3e8f6a[_0xf6b8('0x37')],qs['fields'](_0x35730d[_0xf6b8('0x39')][_0xf6b8('0x3f')]));_0x4f9895['attributes']=_0x4f9895[_0xf6b8('0x3e')][_0xf6b8('0x40')]?_0x4f9895[_0xf6b8('0x3e')]:_0x3e8f6a[_0xf6b8('0x37')];if(!_0x35730d[_0xf6b8('0x39')][_0xf6b8('0x60')]('nolimit')){_0x4f9895['limit']=qs[_0xf6b8('0x1b')](_0x35730d[_0xf6b8('0x39')][_0xf6b8('0x1b')]);_0x4f9895['offset']=qs[_0xf6b8('0x42')](_0x35730d['query'][_0xf6b8('0x42')]);}_0x4f9895['order']=qs[_0xf6b8('0x44')](_0x35730d[_0xf6b8('0x39')][_0xf6b8('0x44')]);_0x4f9895[_0xf6b8('0x45')]=qs['filters'](_[_0xf6b8('0x46')](_0x35730d['query'],_0x3e8f6a['filters']));_0x4f9895[_0xf6b8('0x45')][_0xf6b8('0x63')]=_0x508bac['id'];if(_0x35730d['query'][_0xf6b8('0x27')]){_0x4f9895[_0xf6b8('0x45')]=_[_0xf6b8('0x49')](_0x4f9895['where'],{'$or':_['map'](_0x4f9895['attributes'],function(_0x25e698){var _0x36c8a5={};_0x36c8a5[_0x25e698]={'$like':'%'+_0x35730d[_0xf6b8('0x39')]['filter']+'%'};return _0x36c8a5;})});}_0x4f9895=_[_0xf6b8('0x49')]({},_0x4f9895,_0x35730d['options']);return db[_0xf6b8('0x64')]['count']({'where':_0x4f9895[_0xf6b8('0x45')]})['then'](function(_0x28d248){_0x1814d1['count']=_0x28d248;if(_0x35730d[_0xf6b8('0x39')]['includeAll']){_0x4f9895['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4f9895);})['then'](function(_0x16cc16){_0x1814d1[_0xf6b8('0x4d')]=_0x16cc16;return _0x1814d1;});}})[_0xf6b8('0x22')](respondWithFilteredResult(_0x56bb05,_0x4f9895))[_0xf6b8('0x4e')](handleError(_0x56bb05,null));};exports[_0xf6b8('0x65')]=function(_0xf13405,_0xeae789,_0xd94f0c){var _0x3054a1={'raw':!![],'where':{}};var _0x1399c1={};var _0xf40a45={'count':0x0,'rows':[]};return db[_0xf6b8('0x35')]['findOne']({'where':{'id':_0xf13405[_0xf6b8('0x58')]['id']}})['then'](handleEntityNotFound(_0xeae789,null))[_0xf6b8('0x22')](function(_0x2ecdb0){if(_0x2ecdb0){_0x1399c1[_0xf6b8('0x37')]=_[_0xf6b8('0x38')](db['CmHopperBlack'][_0xf6b8('0x36')]);_0x1399c1[_0xf6b8('0x39')]=_[_0xf6b8('0x38')](_0xf13405[_0xf6b8('0x39')]);_0x1399c1[_0xf6b8('0x3c')]=_[_0xf6b8('0x3d')](_0x1399c1[_0xf6b8('0x37')],_0x1399c1[_0xf6b8('0x39')]);_0x3054a1['attributes']=_[_0xf6b8('0x3d')](_0x1399c1[_0xf6b8('0x37')],qs[_0xf6b8('0x3f')](_0xf13405['query'][_0xf6b8('0x3f')]));_0x3054a1['attributes']=_0x3054a1['attributes'][_0xf6b8('0x40')]?_0x3054a1[_0xf6b8('0x3e')]:_0x1399c1[_0xf6b8('0x37')];if(!_0xf13405[_0xf6b8('0x39')]['hasOwnProperty'](_0xf6b8('0x41'))){_0x3054a1[_0xf6b8('0x1b')]=qs[_0xf6b8('0x1b')](_0xf13405[_0xf6b8('0x39')][_0xf6b8('0x1b')]);_0x3054a1[_0xf6b8('0x42')]=qs[_0xf6b8('0x42')](_0xf13405[_0xf6b8('0x39')][_0xf6b8('0x42')]);}_0x3054a1[_0xf6b8('0x43')]=qs[_0xf6b8('0x44')](_0xf13405[_0xf6b8('0x39')]['sort']);_0x3054a1[_0xf6b8('0x45')]=qs[_0xf6b8('0x3c')](_[_0xf6b8('0x46')](_0xf13405[_0xf6b8('0x39')],_0x1399c1['filters']));_0x3054a1[_0xf6b8('0x45')][_0xf6b8('0x63')]=_0x2ecdb0['id'];if(_0xf13405[_0xf6b8('0x39')][_0xf6b8('0x27')]){_0x3054a1[_0xf6b8('0x45')]=_[_0xf6b8('0x49')](_0x3054a1[_0xf6b8('0x45')],{'$or':_['map'](_0x3054a1[_0xf6b8('0x3e')],function(_0x3ef7b7){var _0x3a3a7f={};_0x3a3a7f[_0x3ef7b7]={'$like':'%'+_0xf13405[_0xf6b8('0x39')][_0xf6b8('0x27')]+'%'};return _0x3a3a7f;})});}_0x3054a1=_[_0xf6b8('0x49')]({},_0x3054a1,_0xf13405[_0xf6b8('0x4a')]);return db[_0xf6b8('0x66')][_0xf6b8('0x1a')]({'where':_0x3054a1[_0xf6b8('0x45')]})['then'](function(_0x4c242a){_0xf40a45[_0xf6b8('0x1a')]=_0x4c242a;if(_0xf13405[_0xf6b8('0x39')][_0xf6b8('0x50')]){_0x3054a1[_0xf6b8('0x4b')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3054a1);})['then'](function(_0x1440fd){_0xf40a45[_0xf6b8('0x4d')]=_0x1440fd;return _0xf40a45;});}})[_0xf6b8('0x22')](respondWithFilteredResult(_0xeae789,_0x3054a1))[_0xf6b8('0x4e')](handleError(_0xeae789,null));};exports[_0xf6b8('0x67')]=function(_0x50a4ff,_0x33fef1,_0x389219){var _0x4aec2d={};var _0x3e4740={};var _0x9792a8;var _0x378343;return db[_0xf6b8('0x35')][_0xf6b8('0x5f')]({'where':{'id':_0x50a4ff[_0xf6b8('0x58')]['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0x33fef1,null))[_0xf6b8('0x22')](function(_0x1462bb){if(_0x1462bb){_0x9792a8=_0x1462bb;_0x3e4740[_0xf6b8('0x37')]=_[_0xf6b8('0x38')](db['Team'][_0xf6b8('0x36')]);_0x3e4740[_0xf6b8('0x39')]=_[_0xf6b8('0x38')](_0x50a4ff['query']);_0x3e4740['filters']=_[_0xf6b8('0x3d')](_0x3e4740[_0xf6b8('0x37')],_0x3e4740['query']);_0x4aec2d[_0xf6b8('0x3e')]=_[_0xf6b8('0x3d')](_0x3e4740['model'],qs['fields'](_0x50a4ff['query']['fields']));_0x4aec2d[_0xf6b8('0x3e')]=_0x4aec2d[_0xf6b8('0x3e')]['length']?_0x4aec2d['attributes']:_0x3e4740[_0xf6b8('0x37')];_0x4aec2d[_0xf6b8('0x43')]=qs[_0xf6b8('0x44')](_0x50a4ff[_0xf6b8('0x39')]['sort']);_0x4aec2d['where']=qs[_0xf6b8('0x3c')](_['pick'](_0x50a4ff[_0xf6b8('0x39')],_0x3e4740[_0xf6b8('0x3c')]));if(_0x50a4ff[_0xf6b8('0x39')][_0xf6b8('0x27')]){_0x4aec2d[_0xf6b8('0x45')]=_[_0xf6b8('0x49')](_0x4aec2d['where'],{'$or':_[_0xf6b8('0x29')](_0x4aec2d[_0xf6b8('0x3e')],function(_0x318a82){var _0x317a0e={};_0x317a0e[_0x318a82]={'$like':'%'+_0x50a4ff[_0xf6b8('0x39')][_0xf6b8('0x27')]+'%'};return _0x317a0e;})});}_0x4aec2d=_[_0xf6b8('0x49')]({},_0x4aec2d,_0x50a4ff[_0xf6b8('0x4a')]);return _0x9792a8['getTeams'](_0x4aec2d);}})['then'](function(_0x4bcb0c){if(_0x4bcb0c){_0x378343=_0x4bcb0c[_0xf6b8('0x40')];if(!_0x50a4ff[_0xf6b8('0x39')]['hasOwnProperty']('nolimit')){_0x4aec2d[_0xf6b8('0x1b')]=qs['limit'](_0x50a4ff[_0xf6b8('0x39')][_0xf6b8('0x1b')]);_0x4aec2d['offset']=qs[_0xf6b8('0x42')](_0x50a4ff[_0xf6b8('0x39')][_0xf6b8('0x42')]);}return _0x9792a8[_0xf6b8('0x67')](_0x4aec2d);}})[_0xf6b8('0x22')](function(_0x198189){if(_0x198189){return _0x198189?{'count':_0x378343,'rows':_0x198189}:null;}})['then'](respondWithResult(_0x33fef1,null))['catch'](handleError(_0x33fef1,null));};exports[_0xf6b8('0x68')]=function(_0x420934,_0x1619e3,_0xac3077){var _0x403975=[];var _0x39b063;return db[_0xf6b8('0x69')][_0xf6b8('0x4c')]({'where':{'id':_0x420934['body'][_0xf6b8('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xf6b8('0x6b')],'as':_0xf6b8('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xf6b8('0x22')](function(_0x3c2280){if(_0x3c2280){for(var _0x52564b=0x0;_0x52564b<_0x3c2280[_0xf6b8('0x40')];_0x52564b+=0x1){for(var _0x5a7ad1=0x0;_0x5a7ad1<_0x3c2280[_0x52564b][_0xf6b8('0x6c')]['length'];_0x5a7ad1+=0x1){_0x403975=_[_0xf6b8('0x6d')](_0x403975,[_0x3c2280[_0x52564b][_0xf6b8('0x6c')][_0x5a7ad1]['id']]);}}return _0x403975;}})[_0xf6b8('0x22')](function(_0x5264ba){if(_0x5264ba){return db[_0xf6b8('0x35')][_0xf6b8('0x2c')]({'where':{'id':_0x420934[_0xf6b8('0x58')]['id']}});}})[_0xf6b8('0x22')](function(_0x1d6ec2){if(_0x1d6ec2){_0x39b063=_0x1d6ec2;return _0x39b063[_0xf6b8('0x6e')](_0x403975,{'penalty':_0x420934[_0xf6b8('0x52')]['penalty']});}})[_0xf6b8('0x22')](function(_0x482165){if(_0x482165){return _0x39b063['addTeams'](_0x420934['body']['ids']);}})[_0xf6b8('0x22')](handleEntityNotFound(_0x1619e3,null))[_0xf6b8('0x22')](respondWithStatusCode(_0x1619e3,null))['catch'](handleError(_0x1619e3,null));};exports[_0xf6b8('0x6f')]=function(_0x30c9d9,_0x37f81e,_0x23870b){var _0x542397=[];var _0xa494c5;return db[_0xf6b8('0x69')]['findAll']({'where':{'id':_0x30c9d9[_0xf6b8('0x39')][_0xf6b8('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xf6b8('0x6b')],'as':_0xf6b8('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xf6b8('0x22')](function(_0x261235){if(_0x261235){for(var _0x21fe9e=0x0;_0x21fe9e<_0x261235[_0xf6b8('0x40')];_0x21fe9e+=0x1){for(var _0x1108f3=0x0;_0x1108f3<_0x261235[_0x21fe9e]['Agents']['length'];_0x1108f3+=0x1){_0x542397=_[_0xf6b8('0x6d')](_0x542397,[_0x261235[_0x21fe9e][_0xf6b8('0x6c')][_0x1108f3]['id']]);}}return _0x542397;}})[_0xf6b8('0x22')](function(_0x58ca6f){if(_0x58ca6f){return db[_0xf6b8('0x35')]['find']({'where':{'id':_0x30c9d9['params']['id']}});}})[_0xf6b8('0x22')](function(_0x4e2b2f){if(_0x4e2b2f){_0xa494c5=_0x4e2b2f;return _0xa494c5[_0xf6b8('0x70')](_0x542397);}})[_0xf6b8('0x22')](function(_0x214841){if(_0xa494c5){return _0xa494c5['removeTeams'](_0x30c9d9[_0xf6b8('0x39')][_0xf6b8('0x6a')]);}})['then'](handleEntityNotFound(_0x37f81e,null))[_0xf6b8('0x22')](respondWithStatusCode(_0x37f81e,null))['catch'](handleError(_0x37f81e,null));};exports[_0xf6b8('0x6e')]=function(_0x1a7208,_0x29e545,_0x4c54e6){var _0x307a0b,_0x7016d5;return db['VoiceQueue']['find']({'where':{'id':_0x1a7208[_0xf6b8('0x58')]['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0x29e545,null))[_0xf6b8('0x22')](function(_0x477885){if(_0x477885){_0x7016d5=_0x477885;return _0x477885[_0xf6b8('0x6e')](_0x1a7208[_0xf6b8('0x52')]['ids'],_[_0xf6b8('0x59')](_0x1a7208[_0xf6b8('0x52')],[_0xf6b8('0x6a'),'id'])||{})[_0xf6b8('0x71')](function(_0x3bb19f){for(var _0x30fce1=0x0;_0x30fce1<_0x1a7208[_0xf6b8('0x52')]['ids']['length'];_0x30fce1+=0x1){socket['emit'](_0xf6b8('0x72'),{'UserId':_0x1a7208[_0xf6b8('0x52')][_0xf6b8('0x6a')][_0x30fce1],'VoiceQueueId':_0x1a7208[_0xf6b8('0x58')]['id']});}return _0x3bb19f;});}})[_0xf6b8('0x22')](function(_0x2febfb){_0x307a0b=_0x2febfb||[];if(_0x7016d5){return db['User'][_0xf6b8('0x4c')]({'where':{'id':_0x1a7208[_0xf6b8('0x52')][_0xf6b8('0x6a')]},'attributes':['id',_0xf6b8('0x32'),_0xf6b8('0x73'),_0xf6b8('0x74'),'interface'],'raw':!![]});}})['then'](function(_0x2f251b){if(_0x2f251b&&_0x2f251b[_0xf6b8('0x40')]){var _0x503869=[];for(var _0x2c286d=0x0;_0x2c286d<_0x2f251b['length'];_0x2c286d++){_0x503869['push'](db[_0xf6b8('0x75')][_0xf6b8('0x76')]({'membername':_0x2f251b[_0x2c286d][_0xf6b8('0x32')],'UserId':_0x2f251b[_0x2c286d]['id'],'queue_name':_0x7016d5['name'],'VoiceQueueId':_0x7016d5['id'],'interface':_[_0xf6b8('0x77')](_0x2f251b[_0x2c286d][_0xf6b8('0x78')])?util[_0xf6b8('0x79')](_0xf6b8('0x7a'),_0x2f251b[_0x2c286d][_0xf6b8('0x32')]):_0x2f251b[_0x2c286d][_0xf6b8('0x78')],'paused':_0x2f251b[_0x2c286d]['voicePause']||![],'penalty':_0x1a7208[_0xf6b8('0x52')]['penalty']||0x0}));}return BPromise['all'](_0x503869);}})[_0xf6b8('0x22')](function(_0x3fb30f){return _0x307a0b;})['then'](respondWithResult(_0x29e545,null))[_0xf6b8('0x4e')](handleError(_0x29e545,null));};exports[_0xf6b8('0x70')]=function(_0x6bd63,_0x12843f,_0x53f18c){var _0xa6660;return db[_0xf6b8('0x35')]['find']({'where':{'id':_0x6bd63[_0xf6b8('0x58')]['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0x12843f,null))[_0xf6b8('0x22')](function(_0x1baeb7){if(_0x1baeb7){return _0x1baeb7[_0xf6b8('0x70')](_0x6bd63[_0xf6b8('0x39')][_0xf6b8('0x6a')])['then'](function(_0x2c2e4f){if(_[_0xf6b8('0x7b')](_0x6bd63[_0xf6b8('0x39')]['ids'])){for(var _0x340e2b=0x0;_0x340e2b<_0x6bd63[_0xf6b8('0x39')][_0xf6b8('0x6a')]['length'];_0x340e2b+=0x1){socket['emit'](_0xf6b8('0x7c'),{'UserId':_0x6bd63[_0xf6b8('0x39')][_0xf6b8('0x6a')][_0x340e2b],'VoiceQueueId':_0x6bd63['params']['id']});}}else{socket[_0xf6b8('0x7d')](_0xf6b8('0x7c'),{'UserId':_0x6bd63[_0xf6b8('0x39')]['ids'],'VoiceQueueId':_0x6bd63[_0xf6b8('0x58')]['id']});}});}})[_0xf6b8('0x22')](function(_0x414fef){if(_0x6bd63['query']['realtime']){_0xa6660=_0x414fef;return db[_0xf6b8('0x75')][_0xf6b8('0x21')]({'where':{'VoiceQueueId':_0x6bd63['params']['id'],'UserId':_0x6bd63[_0xf6b8('0x39')][_0xf6b8('0x6a')]}})[_0xf6b8('0x22')](function(){return _0xa6660;});}})[_0xf6b8('0x22')](respondWithStatusCode(_0x12843f,null))['catch'](handleError(_0x12843f,null));};exports[_0xf6b8('0x7e')]=function(_0x2133e4,_0x1219fb,_0x1a6105){var _0x26909c={};var _0x3e3b90={};var _0x4a319a;var _0x48c093;return db[_0xf6b8('0x35')][_0xf6b8('0x5f')]({'where':{'id':_0x2133e4['params']['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0x1219fb,null))[_0xf6b8('0x22')](function(_0x5a2f76){if(_0x5a2f76){_0x4a319a=_0x5a2f76;_0x3e3b90[_0xf6b8('0x37')]=_['keys'](db[_0xf6b8('0x6b')]['rawAttributes']);_0x3e3b90['query']=_['keys'](_0x2133e4['query']);_0x3e3b90[_0xf6b8('0x3c')]=_[_0xf6b8('0x3d')](_0x3e3b90[_0xf6b8('0x37')],_0x3e3b90[_0xf6b8('0x39')]);_0x26909c[_0xf6b8('0x3e')]=_['intersection'](_0x3e3b90[_0xf6b8('0x37')],qs['fields'](_0x2133e4[_0xf6b8('0x39')][_0xf6b8('0x3f')]));_0x26909c[_0xf6b8('0x3e')]=_0x26909c['attributes'][_0xf6b8('0x40')]?_0x26909c[_0xf6b8('0x3e')]:_0x3e3b90['model'];_0x26909c[_0xf6b8('0x43')]=qs[_0xf6b8('0x44')](_0x2133e4[_0xf6b8('0x39')][_0xf6b8('0x44')]);_0x26909c[_0xf6b8('0x45')]=qs[_0xf6b8('0x3c')](_['pick'](_0x2133e4['query'],_0x3e3b90[_0xf6b8('0x3c')]));if(_0x2133e4[_0xf6b8('0x39')][_0xf6b8('0x27')]){_0x26909c[_0xf6b8('0x45')]=_[_0xf6b8('0x49')](_0x26909c['where'],{'$or':_[_0xf6b8('0x29')](_0x26909c['attributes'],function(_0x2a8b2a){var _0x51ce7c={};_0x51ce7c[_0x2a8b2a]={'$like':'%'+_0x2133e4[_0xf6b8('0x39')]['filter']+'%'};return _0x51ce7c;})});}_0x26909c=_[_0xf6b8('0x49')]({},_0x26909c,_0x2133e4[_0xf6b8('0x4a')]);return _0x4a319a[_0xf6b8('0x7e')](_0x26909c);}})[_0xf6b8('0x22')](function(_0x819900){if(_0x819900){_0x48c093=_0x819900[_0xf6b8('0x40')];if(!_0x2133e4[_0xf6b8('0x39')][_0xf6b8('0x60')](_0xf6b8('0x41'))){_0x26909c['limit']=qs[_0xf6b8('0x1b')](_0x2133e4[_0xf6b8('0x39')]['limit']);_0x26909c[_0xf6b8('0x42')]=qs[_0xf6b8('0x42')](_0x2133e4[_0xf6b8('0x39')][_0xf6b8('0x42')]);}return _0x4a319a[_0xf6b8('0x7e')](_0x26909c);}})[_0xf6b8('0x22')](function(_0x1a4dbe){if(_0x1a4dbe){return _0x1a4dbe?{'count':_0x48c093,'rows':_0x1a4dbe}:null;}})[_0xf6b8('0x22')](respondWithResult(_0x1219fb,null))[_0xf6b8('0x4e')](handleError(_0x1219fb,null));};exports[_0xf6b8('0x7f')]=function(_0x3510ff,_0x51196c,_0x2eebf1){var _0x2b47aa={};var _0xe4b16a={};var _0x52772c;var _0x11d768;return db[_0xf6b8('0x35')]['findOne']({'where':{'id':_0x3510ff[_0xf6b8('0x58')]['id']}})['then'](handleEntityNotFound(_0x51196c,null))[_0xf6b8('0x22')](function(_0x179aae){if(_0x179aae){_0x52772c=_0x179aae;_0xe4b16a[_0xf6b8('0x37')]=_[_0xf6b8('0x38')](db[_0xf6b8('0x75')][_0xf6b8('0x36')]);_0xe4b16a[_0xf6b8('0x39')]=_[_0xf6b8('0x38')](_0x3510ff[_0xf6b8('0x39')]);_0xe4b16a['filters']=_[_0xf6b8('0x3d')](_0xe4b16a[_0xf6b8('0x37')],_0xe4b16a[_0xf6b8('0x39')]);_0x2b47aa[_0xf6b8('0x3e')]=_[_0xf6b8('0x3d')](_0xe4b16a[_0xf6b8('0x37')],qs[_0xf6b8('0x3f')](_0x3510ff['query'][_0xf6b8('0x3f')]));_0x2b47aa['attributes']=_0x2b47aa[_0xf6b8('0x3e')][_0xf6b8('0x40')]?_0x2b47aa['attributes']:_0xe4b16a[_0xf6b8('0x37')];_0x2b47aa['order']=qs[_0xf6b8('0x44')](_0x3510ff[_0xf6b8('0x39')][_0xf6b8('0x44')]);_0x2b47aa[_0xf6b8('0x45')]=qs[_0xf6b8('0x3c')](_[_0xf6b8('0x46')](_0x3510ff[_0xf6b8('0x39')],_0xe4b16a['filters']));if(_0x3510ff[_0xf6b8('0x39')]['filter']){_0x2b47aa[_0xf6b8('0x45')]=_[_0xf6b8('0x49')](_0x2b47aa[_0xf6b8('0x45')],{'$or':_[_0xf6b8('0x29')](_0x2b47aa[_0xf6b8('0x3e')],function(_0x3ad38c){var _0x34846f={};_0x34846f[_0x3ad38c]={'$like':'%'+_0x3510ff[_0xf6b8('0x39')][_0xf6b8('0x27')]+'%'};return _0x34846f;})});}_0x2b47aa=_[_0xf6b8('0x49')]({},_0x2b47aa,_0x3510ff[_0xf6b8('0x4a')]);return _0x52772c[_0xf6b8('0x7f')](_0x2b47aa);}})['then'](function(_0x5ac777){if(_0x5ac777){_0x11d768=_0x5ac777[_0xf6b8('0x40')];if(!_0x3510ff['query'][_0xf6b8('0x60')](_0xf6b8('0x41'))){_0x2b47aa['limit']=qs[_0xf6b8('0x1b')](_0x3510ff[_0xf6b8('0x39')][_0xf6b8('0x1b')]);_0x2b47aa[_0xf6b8('0x42')]=qs[_0xf6b8('0x42')](_0x3510ff['query'][_0xf6b8('0x42')]);}return _0x52772c[_0xf6b8('0x7f')](_0x2b47aa);}})[_0xf6b8('0x22')](function(_0x265ab0){return _0x265ab0?{'count':_0x11d768,'rows':_0x265ab0}:null;})[_0xf6b8('0x22')](respondWithResult(_0x51196c,null))['catch'](handleError(_0x51196c,null));};exports[_0xf6b8('0x80')]=function(_0x4c9da5,_0x650af5,_0x19d8ad){var _0x48e505={};var _0x18d345={};var _0x2c0829;var _0x3510cf;return db[_0xf6b8('0x35')][_0xf6b8('0x5f')]({'where':{'id':_0x4c9da5[_0xf6b8('0x58')]['id']}})['then'](handleEntityNotFound(_0x650af5,null))[_0xf6b8('0x22')](function(_0x92b9a5){if(_0x92b9a5){_0x2c0829=_0x92b9a5;_0x18d345[_0xf6b8('0x37')]=_[_0xf6b8('0x38')](db[_0xf6b8('0x81')]['rawAttributes']);_0x18d345[_0xf6b8('0x39')]=_[_0xf6b8('0x38')](_0x4c9da5[_0xf6b8('0x39')]);_0x18d345[_0xf6b8('0x3c')]=_[_0xf6b8('0x3d')](_0x18d345['model'],_0x18d345['query']);_0x48e505[_0xf6b8('0x3e')]=_[_0xf6b8('0x3d')](_0x18d345[_0xf6b8('0x37')],qs[_0xf6b8('0x3f')](_0x4c9da5[_0xf6b8('0x39')][_0xf6b8('0x3f')]));_0x48e505[_0xf6b8('0x3e')]=_0x48e505[_0xf6b8('0x3e')][_0xf6b8('0x40')]?_0x48e505['attributes']:_0x18d345[_0xf6b8('0x37')];_0x48e505['order']=qs[_0xf6b8('0x44')](_0x4c9da5[_0xf6b8('0x39')][_0xf6b8('0x44')]);_0x48e505['where']=qs[_0xf6b8('0x3c')](_[_0xf6b8('0x46')](_0x4c9da5[_0xf6b8('0x39')],_0x18d345[_0xf6b8('0x3c')]));if(_0x4c9da5[_0xf6b8('0x39')]['filter']){_0x48e505[_0xf6b8('0x45')]=_[_0xf6b8('0x49')](_0x48e505[_0xf6b8('0x45')],{'$or':_[_0xf6b8('0x29')](_0x48e505[_0xf6b8('0x3e')],function(_0x11e535){var _0x6a9f45={};_0x6a9f45[_0x11e535]={'$like':'%'+_0x4c9da5['query'][_0xf6b8('0x27')]+'%'};return _0x6a9f45;})});}_0x48e505=_[_0xf6b8('0x49')]({},_0x48e505,_0x4c9da5[_0xf6b8('0x4a')]);return _0x2c0829['getLists'](_0x48e505);}})['then'](function(_0x3a05e8){if(_0x3a05e8){_0x3510cf=_0x3a05e8['length'];if(!_0x4c9da5[_0xf6b8('0x39')]['hasOwnProperty'](_0xf6b8('0x41'))){_0x48e505[_0xf6b8('0x1b')]=qs[_0xf6b8('0x1b')](_0x4c9da5[_0xf6b8('0x39')][_0xf6b8('0x1b')]);_0x48e505[_0xf6b8('0x42')]=qs[_0xf6b8('0x42')](_0x4c9da5['query']['offset']);}return _0x2c0829[_0xf6b8('0x80')](_0x48e505);}})[_0xf6b8('0x22')](function(_0x45881f){if(_0x45881f){return _0x45881f?{'count':_0x3510cf,'rows':_0x45881f}:null;}})['then'](respondWithResult(_0x650af5,null))['catch'](handleError(_0x650af5,null));};exports[_0xf6b8('0x82')]=function(_0x53a6a2,_0x12a5f6,_0x27ce5a){var _0x1f7b9a,_0x461583;return db[_0xf6b8('0x35')]['find']({'where':{'id':_0x53a6a2[_0xf6b8('0x58')]['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0x12a5f6,null))[_0xf6b8('0x22')](function(_0x30b3eb){if(_0x30b3eb){_0x461583=_0x30b3eb;return _0x30b3eb[_0xf6b8('0x82')](_0x53a6a2[_0xf6b8('0x52')]['ids'],_['omit'](_0x53a6a2[_0xf6b8('0x52')],['ids','id'])||{});}return null;})[_0xf6b8('0x71')](function(_0x3531a7){var _0x49cec0;_0x1f7b9a=_0x3531a7||[];var _0x2113ca=[];if(_0x3531a7){for(var _0x1a8c8a=0x0;_0x1a8c8a<_0x3531a7[_0xf6b8('0x40')];_0x1a8c8a+=0x1){var _0x1d8db8=_0x3531a7[_0x1a8c8a]['get']({'plain':!![]});_0x461583['dialCheckDuplicateType']=_0x53a6a2[_0xf6b8('0x52')][_0xf6b8('0x83')]?_0x53a6a2['body'][_0xf6b8('0x83')]:_0x461583[_0xf6b8('0x83')];switch(_0x461583[_0xf6b8('0x83')]){case'always':_0x49cec0=squel[_0xf6b8('0x84')]()[_0xf6b8('0x85')]('cm_hopper')[_0xf6b8('0x86')]([_0xf6b8('0x87'),_0xf6b8('0x88'),_0xf6b8('0x89'),'ListId',_0xf6b8('0x63'),_0xf6b8('0x5a'),_0xf6b8('0x5b')],squel[_0xf6b8('0x8a')]()[_0xf6b8('0x8b')](_0xf6b8('0x87'),'phone')[_0xf6b8('0x8b')]('NOW()',_0xf6b8('0x88'))[_0xf6b8('0x8b')]('id',_0xf6b8('0x89'))[_0xf6b8('0x8b')](_0x1d8db8['CmListId'][_0xf6b8('0x8c')](),_0xf6b8('0x8d'))[_0xf6b8('0x8b')](_0x53a6a2['params']['id'][_0xf6b8('0x8c')](),'VoiceQueueId')[_0xf6b8('0x8b')](_0xf6b8('0x8e'),_0xf6b8('0x5a'))[_0xf6b8('0x8b')](_0xf6b8('0x8e'),_0xf6b8('0x5b'))[_0xf6b8('0x8f')](_0xf6b8('0x90'))['where'](_0xf6b8('0x91'))[_0xf6b8('0x45')](_0xf6b8('0x92'),_0x1d8db8['CmListId'][_0xf6b8('0x8c')]())[_0xf6b8('0x45')](_0xf6b8('0x93'))[_0xf6b8('0x45')](_0xf6b8('0x94'),squel[_0xf6b8('0x8a')]()[_0xf6b8('0x8b')](_0xf6b8('0x95'))[_0xf6b8('0x8f')](_0xf6b8('0x96'))[_0xf6b8('0x45')](_0xf6b8('0x97'),_0x53a6a2['params']['id']['toString']()))[_0xf6b8('0x45')](_0xf6b8('0x94'),squel[_0xf6b8('0x8a')]()[_0xf6b8('0x8b')](_0xf6b8('0x87'))[_0xf6b8('0x8f')](_0xf6b8('0x98'))['where']('VoiceQueueId\x20=\x20?',_0x53a6a2[_0xf6b8('0x58')]['id'][_0xf6b8('0x8c')]())))[_0xf6b8('0x8c')]();break;case'onlyIfOpen':_0x49cec0=squel[_0xf6b8('0x84')]()[_0xf6b8('0x85')](_0xf6b8('0x98'))[_0xf6b8('0x86')]([_0xf6b8('0x87'),_0xf6b8('0x88'),_0xf6b8('0x89'),_0xf6b8('0x8d'),_0xf6b8('0x63'),'createdAt',_0xf6b8('0x5b')],squel['select']()[_0xf6b8('0x8b')](_0xf6b8('0x87'),_0xf6b8('0x87'))[_0xf6b8('0x8b')](_0xf6b8('0x8e'),_0xf6b8('0x88'))[_0xf6b8('0x8b')]('id',_0xf6b8('0x89'))['field'](_0x1d8db8['CmListId'][_0xf6b8('0x8c')](),_0xf6b8('0x8d'))['field'](_0x53a6a2[_0xf6b8('0x58')]['id'][_0xf6b8('0x8c')](),_0xf6b8('0x63'))[_0xf6b8('0x8b')](_0xf6b8('0x8e'),_0xf6b8('0x5a'))[_0xf6b8('0x8b')](_0xf6b8('0x8e'),'updatedAt')[_0xf6b8('0x8f')]('cm_contacts')[_0xf6b8('0x45')](_0xf6b8('0x91'))[_0xf6b8('0x45')](_0xf6b8('0x92'),_0x1d8db8[_0xf6b8('0x99')][_0xf6b8('0x8c')]())['where'](_0xf6b8('0x93'))[_0xf6b8('0x45')](_0xf6b8('0x94'),squel['select']()[_0xf6b8('0x8b')](_0xf6b8('0x87'))[_0xf6b8('0x8f')](_0xf6b8('0x98'))['where']('VoiceQueueId\x20=\x20?',_0x53a6a2['params']['id']['toString']())))['toString']();break;default:_0x49cec0=squel[_0xf6b8('0x84')]()[_0xf6b8('0x85')]('cm_hopper')[_0xf6b8('0x86')]([_0xf6b8('0x87'),_0xf6b8('0x88'),_0xf6b8('0x89'),_0xf6b8('0x8d'),_0xf6b8('0x63'),_0xf6b8('0x5a'),_0xf6b8('0x5b')],squel['select']()[_0xf6b8('0x8b')](_0xf6b8('0x87'),_0xf6b8('0x87'))['field'](_0xf6b8('0x8e'),_0xf6b8('0x88'))[_0xf6b8('0x8b')]('id',_0xf6b8('0x89'))[_0xf6b8('0x8b')](_0x1d8db8['CmListId'][_0xf6b8('0x8c')](),_0xf6b8('0x8d'))[_0xf6b8('0x8b')](_0x53a6a2[_0xf6b8('0x58')]['id'][_0xf6b8('0x8c')](),'VoiceQueueId')['field']('NOW()',_0xf6b8('0x5a'))[_0xf6b8('0x8b')]('NOW()','updatedAt')[_0xf6b8('0x8f')](_0xf6b8('0x90'))['where'](_0xf6b8('0x91'))['where'](_0xf6b8('0x92'),_0x1d8db8[_0xf6b8('0x99')][_0xf6b8('0x8c')]())[_0xf6b8('0x45')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x2113ca['push'](db[_0xf6b8('0x9a')][_0xf6b8('0x39')](_0x49cec0));}return BPromise[_0xf6b8('0x9b')](_0x2113ca);}})[_0xf6b8('0x22')](function(){return _0x1f7b9a;})[_0xf6b8('0x22')](respondWithResult(_0x12a5f6,null))[_0xf6b8('0x4e')](handleError(_0x12a5f6,null));};exports[_0xf6b8('0x9c')]=function(_0x4a127a,_0x34840e,_0x568118){var _0x4946c8;return db['VoiceQueue'][_0xf6b8('0x2c')]({'where':{'id':_0x4a127a[_0xf6b8('0x58')]['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0x34840e,null))[_0xf6b8('0x22')](function(_0x173bd6){if(_0x173bd6){return _0x173bd6[_0xf6b8('0x9c')](_0x4a127a[_0xf6b8('0x39')][_0xf6b8('0x6a')]);}})['then'](function(_0x392636){if(_0x392636){_0x4946c8=_0x392636;return db[_0xf6b8('0x61')]['destroy']({'where':{'ListId':_0x4a127a['query'][_0xf6b8('0x6a')],'VoiceQueueId':_0x4a127a[_0xf6b8('0x58')]['id']}})['then'](function(){return _0x4946c8;});}})[_0xf6b8('0x22')](respondWithStatusCode(_0x34840e,null))[_0xf6b8('0x4e')](handleError(_0x34840e,null));};exports[_0xf6b8('0x9d')]=function(_0x252c31,_0x2d5c2c,_0x15bf78){var _0x3c44f8={};var _0x24b5cb={};var _0x50c7b4;var _0x4ca5ad;return db[_0xf6b8('0x35')][_0xf6b8('0x5f')]({'where':{'id':_0x252c31[_0xf6b8('0x58')]['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0x2d5c2c,null))[_0xf6b8('0x22')](function(_0x5330ca){if(_0x5330ca){_0x50c7b4=_0x5330ca;_0x24b5cb[_0xf6b8('0x37')]=_[_0xf6b8('0x38')](db[_0xf6b8('0x81')]['rawAttributes']);_0x24b5cb['query']=_['keys'](_0x252c31[_0xf6b8('0x39')]);_0x24b5cb[_0xf6b8('0x3c')]=_['intersection'](_0x24b5cb[_0xf6b8('0x37')],_0x24b5cb[_0xf6b8('0x39')]);_0x3c44f8[_0xf6b8('0x3e')]=_['intersection'](_0x24b5cb[_0xf6b8('0x37')],qs[_0xf6b8('0x3f')](_0x252c31['query'][_0xf6b8('0x3f')]));_0x3c44f8['attributes']=_0x3c44f8[_0xf6b8('0x3e')][_0xf6b8('0x40')]?_0x3c44f8[_0xf6b8('0x3e')]:_0x24b5cb[_0xf6b8('0x37')];_0x3c44f8[_0xf6b8('0x43')]=qs['sort'](_0x252c31[_0xf6b8('0x39')][_0xf6b8('0x44')]);_0x3c44f8[_0xf6b8('0x45')]=qs[_0xf6b8('0x3c')](_[_0xf6b8('0x46')](_0x252c31[_0xf6b8('0x39')],_0x24b5cb[_0xf6b8('0x3c')]));if(_0x252c31[_0xf6b8('0x39')][_0xf6b8('0x27')]){_0x3c44f8['where']=_[_0xf6b8('0x49')](_0x3c44f8[_0xf6b8('0x45')],{'$or':_[_0xf6b8('0x29')](_0x3c44f8['attributes'],function(_0x1157d3){var _0x2aa30c={};_0x2aa30c[_0x1157d3]={'$like':'%'+_0x252c31[_0xf6b8('0x39')][_0xf6b8('0x27')]+'%'};return _0x2aa30c;})});}_0x3c44f8=_[_0xf6b8('0x49')]({},_0x3c44f8,_0x252c31[_0xf6b8('0x4a')]);return _0x50c7b4[_0xf6b8('0x9d')](_0x3c44f8);}})[_0xf6b8('0x22')](function(_0x3df70c){if(_0x3df70c){_0x4ca5ad=_0x3df70c['length'];if(!_0x252c31[_0xf6b8('0x39')][_0xf6b8('0x60')]('nolimit')){_0x3c44f8[_0xf6b8('0x1b')]=qs['limit'](_0x252c31[_0xf6b8('0x39')][_0xf6b8('0x1b')]);_0x3c44f8[_0xf6b8('0x42')]=qs[_0xf6b8('0x42')](_0x252c31[_0xf6b8('0x39')][_0xf6b8('0x42')]);}return _0x50c7b4[_0xf6b8('0x9d')](_0x3c44f8);}})[_0xf6b8('0x22')](function(_0x2a9cc8){if(_0x2a9cc8){return _0x2a9cc8?{'count':_0x4ca5ad,'rows':_0x2a9cc8}:null;}})[_0xf6b8('0x22')](respondWithResult(_0x2d5c2c,null))[_0xf6b8('0x4e')](handleError(_0x2d5c2c,null));};exports[_0xf6b8('0x9e')]=function(_0x348f19,_0x36b973,_0x1fa81e){var _0x24e4f3,_0x28b5ae;return db[_0xf6b8('0x35')][_0xf6b8('0x2c')]({'where':{'id':_0x348f19[_0xf6b8('0x58')]['id']}})['then'](handleEntityNotFound(_0x36b973,null))[_0xf6b8('0x22')](function(_0x70703b){if(_0x70703b){_0x28b5ae=_0x70703b;return _0x70703b[_0xf6b8('0x9e')](_0x348f19[_0xf6b8('0x52')]['ids'],_[_0xf6b8('0x59')](_0x348f19[_0xf6b8('0x52')],[_0xf6b8('0x6a'),'id'])||{});}return null;})[_0xf6b8('0x71')](function(_0x34220f){var _0x14348f;_0x24e4f3=_0x34220f||[];var _0x2f1155=[];if(_0x34220f){for(var _0x430b5c=0x0;_0x430b5c<_0x34220f[_0xf6b8('0x40')];_0x430b5c+=0x1){var _0x1ba4de=_0x34220f[_0x430b5c][_0xf6b8('0x23')]({'plain':!![]});_0x14348f=squel[_0xf6b8('0x84')]()['into'](_0xf6b8('0x9f'))[_0xf6b8('0x86')]([_0xf6b8('0x87'),_0xf6b8('0x89'),_0xf6b8('0x8d'),'VoiceQueueId',_0xf6b8('0x5a'),_0xf6b8('0x5b')],squel[_0xf6b8('0x8a')]()['field']('phone','phone')[_0xf6b8('0x8b')]('id',_0xf6b8('0x89'))['field'](_0x1ba4de[_0xf6b8('0x99')][_0xf6b8('0x8c')](),_0xf6b8('0x8d'))[_0xf6b8('0x8b')](_0x348f19['params']['id']['toString'](),_0xf6b8('0x63'))[_0xf6b8('0x8b')](_0xf6b8('0x8e'),'createdAt')['field'](_0xf6b8('0x8e'),_0xf6b8('0x5b'))[_0xf6b8('0x8f')](_0xf6b8('0x90'))[_0xf6b8('0x45')](_0xf6b8('0x91'))['where'](_0xf6b8('0x92'),_0x1ba4de['CmListId'][_0xf6b8('0x8c')]())[_0xf6b8('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xf6b8('0x8c')]();_0x2f1155[_0xf6b8('0xa0')](db[_0xf6b8('0x9a')][_0xf6b8('0x39')](_0x14348f));}return BPromise['all'](_0x2f1155);}})[_0xf6b8('0x22')](function(){return _0x24e4f3;})[_0xf6b8('0x22')](respondWithResult(_0x36b973,null))[_0xf6b8('0x4e')](handleError(_0x36b973,null));};exports[_0xf6b8('0xa1')]=function(_0x427805,_0x4602be,_0x17968f){var _0x1555ba;return db[_0xf6b8('0x35')][_0xf6b8('0x2c')]({'where':{'id':_0x427805['params']['id']}})[_0xf6b8('0x22')](handleEntityNotFound(_0x4602be,null))[_0xf6b8('0x22')](function(_0x3d6f2e){if(_0x3d6f2e){return _0x3d6f2e[_0xf6b8('0xa1')](_0x427805[_0xf6b8('0x39')][_0xf6b8('0x6a')]);}})[_0xf6b8('0x22')](function(_0x420e33){if(_0x420e33){_0x1555ba=_0x420e33;return db[_0xf6b8('0x66')][_0xf6b8('0x21')]({'where':{'ListId':_0x427805[_0xf6b8('0x39')][_0xf6b8('0x6a')],'VoiceQueueId':_0x427805['params']['id']}})[_0xf6b8('0x22')](function(){return _0x1555ba;});}})[_0xf6b8('0x22')](respondWithStatusCode(_0x4602be,null))[_0xf6b8('0x4e')](handleError(_0x4602be,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index d089cf2..99c16f5 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 _0xdb6e=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x4f3555,_0x40a06f){var _0x1c2142=function(_0x4ac329){while(--_0x4ac329){_0x4f3555['push'](_0x4f3555['shift']());}};_0x1c2142(++_0x40a06f);}(_0xdb6e,0x179));var _0xedb6=function(_0x1d8b31,_0xef220e){_0x1d8b31=_0x1d8b31-0x0;var _0x2548ce=_0xdb6e[_0x1d8b31];return _0x2548ce;};'use strict';var EventEmitter=require(_0xedb6('0x0'));var VoiceQueue=require(_0xedb6('0x1'))['db'][_0xedb6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xedb6('0x3')](0x0);var events={'afterCreate':_0xedb6('0x4'),'afterUpdate':_0xedb6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x11173a){return function(_0x42207a,_0x2965e8,_0x473708){VoiceQueueEvents[_0xedb6('0x6')](_0x11173a+':'+_0x42207a['id'],_0x42207a);VoiceQueueEvents[_0xedb6('0x6')](_0x11173a,_0x42207a);_0x473708(null);};}for(var e in events){if(events[_0xedb6('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xedb6('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xaa77=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x338808,_0x41c267){var _0x585c04=function(_0x458691){while(--_0x458691){_0x338808['push'](_0x338808['shift']());}};_0x585c04(++_0x41c267);}(_0xaa77,0xb0));var _0x7aa7=function(_0x49d42f,_0x2a1c49){_0x49d42f=_0x49d42f-0x0;var _0x5880a6=_0xaa77[_0x49d42f];return _0x5880a6;};'use strict';var EventEmitter=require(_0x7aa7('0x0'));var VoiceQueue=require(_0x7aa7('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7aa7('0x2')](0x0);var events={'afterCreate':_0x7aa7('0x3'),'afterUpdate':_0x7aa7('0x4'),'afterDestroy':_0x7aa7('0x5')};function emitEvent(_0xbd0589){return function(_0x3b9f51,_0x4b6f76,_0x44773d){VoiceQueueEvents['emit'](_0xbd0589+':'+_0x3b9f51['id'],_0x3b9f51);VoiceQueueEvents[_0x7aa7('0x6')](_0xbd0589,_0x3b9f51);_0x44773d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x7aa7('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 7c36cdc..f5fa915 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 _0x928c=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x928c,0x180));var _0xc928=function(_0x1b1902,_0x112f6c){_0x1b1902=_0x1b1902-0x0;var _0x12cbdf=_0x928c[_0x1b1902];return _0x12cbdf;};'use strict';var _=require(_0xc928('0x0'));var util=require(_0xc928('0x1'));var logger=require('../../config/logger')(_0xc928('0x2'));var moment=require(_0xc928('0x3'));var BPromise=require(_0xc928('0x4'));var rp=require(_0xc928('0x5'));var attributes=require(_0xc928('0x6'));module[_0xc928('0x7')]=function(_0x482303,_0x4df4c2){return _0x482303[_0xc928('0x8')]('VoiceQueue',attributes,{'tableName':_0xc928('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc2=['exports','VoiceQueue','api','moment','bluebird','request-promise','./voiceQueue.attributes'];(function(_0x41e6ca,_0xc83bf2){var _0x3fa3ca=function(_0x54b89a){while(--_0x54b89a){_0x41e6ca['push'](_0x41e6ca['shift']());}};_0x3fa3ca(++_0xc83bf2);}(_0xafc2,0x183));var _0x2afc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xafc2[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2afc('0x0'));var moment=require(_0x2afc('0x1'));var BPromise=require(_0x2afc('0x2'));var rp=require(_0x2afc('0x3'));var attributes=require(_0x2afc('0x4'));module[_0x2afc('0x5')]=function(_0x1b0628,_0x396fe8){return _0x1b0628['define'](_0x2afc('0x6'),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 7efb020..418499b 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 _0xa9e0=['register','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue','VoiceQueue','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x3b1c90,_0xcdf42f){var _0x1bcd4e=function(_0x5268b1){while(--_0x5268b1){_0x3b1c90['push'](_0x3b1c90['shift']());}};_0x1bcd4e(++_0xcdf42f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./voiceQueue.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')]('VoiceQueue,\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['VoiceQueue'][_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,'limit':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]||null:null,'include':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x1314ae[_0x0a9e('0x1b')]['include'],function(_0x59181e){return{'model':db[_0x59181e[_0x0a9e('0x22')]],'as':_0x59181e['as'],'attributes':_0x59181e[_0x0a9e('0x1e')],'include':_0x59181e[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x59181e['include'],function(_0x384319){return{'model':db[_0x384319['model']],'as':_0x384319['as'],'attributes':_0x384319[_0x0a9e('0x1e')],'include':_0x384319['include']?_[_0x0a9e('0x21')](_0x384319[_0x0a9e('0x20')],function(_0x25fba9){return{'model':db[_0x25fba9[_0x0a9e('0x22')]],'as':_0x25fba9['as'],'attributes':_0x25fba9[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x11c3b6){logger[_0x0a9e('0x16')]('GetVoiceQueue',_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON[_0x0a9e('0x12')](_0x11c3b6));_0x1c696a(_0x11c3b6);})[_0x0a9e('0x18')](function(_0x5c877d){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x5c877d[_0x0a9e('0x15')],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x5c877d[_0x0a9e('0x15')]));});});};exports[_0x0a9e('0x24')]=function(_0x296f41){var _0x2e8759=this;return new Promise(function(_0x1dbde2,_0x540530){return db[_0x0a9e('0x25')]['find']({'raw':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')]['where']||null:null,'attributes':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x296f41[_0x0a9e('0x1b')]['include'],function(_0x44295a){return{'model':db[_0x44295a['model']],'as':_0x44295a['as'],'attributes':_0x44295a[_0x0a9e('0x1e')],'include':_0x44295a[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x44295a[_0x0a9e('0x20')],function(_0x567193){return{'model':db[_0x567193[_0x0a9e('0x22')]],'as':_0x567193['as'],'attributes':_0x567193[_0x0a9e('0x1e')],'include':_0x567193[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x567193['include'],function(_0x54135e){return{'model':db[_0x54135e[_0x0a9e('0x22')]],'as':_0x54135e['as'],'attributes':_0x54135e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x3d9717){logger[_0x0a9e('0x16')](_0x0a9e('0x24'),_0x296f41);logger['debug'](_0x0a9e('0x24'),_0x296f41,JSON[_0x0a9e('0x12')](_0x3d9717));_0x1dbde2(_0x3d9717);})[_0x0a9e('0x18')](function(_0x533942){logger[_0x0a9e('0x13')](_0x0a9e('0x24'),_0x533942[_0x0a9e('0x15')],_0x296f41);_0x540530(_0x2e8759['error'](0x1f4,_0x533942['message']));});});}; \ 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(_0x486efc,_0x1cca6a){var _0x42ae7e=function(_0x48f4c0){while(--_0x48f4c0){_0x486efc['push'](_0x486efc['shift']());}};_0x42ae7e(++_0x1cca6a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});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 49ad350..35e3fb0 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 _0xff56=['removeListener','register','length','./voiceQueue.events','remove','update'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xff56,0x1d1));var _0x6ff5=function(_0x1d51e7,_0xbd9d33){_0x1d51e7=_0x1d51e7-0x0;var _0x5eb44d=_0xff56[_0x1d51e7];return _0x5eb44d;};'use strict';var VoiceQueueEvents=require(_0x6ff5('0x0'));var events=['save',_0x6ff5('0x1'),_0x6ff5('0x2')];function createListener(_0x2f7a01,_0x3a33e5){return function(_0x10aa79){_0x3a33e5['emit'](_0x2f7a01,_0x10aa79);};}function removeListener(_0x518f99,_0x21f4c2){return function(){VoiceQueueEvents[_0x6ff5('0x3')](_0x518f99,_0x21f4c2);};}exports[_0x6ff5('0x4')]=function(_0x8d8e6f){for(var _0x3a9657=0x0,_0x165a46=events[_0x6ff5('0x5')];_0x3a9657<_0x165a46;_0x3a9657++){var _0x2475a5=events[_0x3a9657];var _0x8a0352=createListener('voiceQueue:'+_0x2475a5,_0x8d8e6f);VoiceQueueEvents['on'](_0x2475a5,_0x8a0352);}}; \ No newline at end of file +var _0x5a86=['removeListener','register','voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0xeed38,_0x45e18a){var _0x53533c=function(_0x3ebc0b){while(--_0x3ebc0b){_0xeed38['push'](_0xeed38['shift']());}};_0x53533c(++_0x45e18a);}(_0x5a86,0x14b));var _0x65a8=function(_0x51ad18,_0x248673){_0x51ad18=_0x51ad18-0x0;var _0x354881=_0x5a86[_0x51ad18];return _0x354881;};'use strict';var VoiceQueueEvents=require(_0x65a8('0x0'));var events=[_0x65a8('0x1'),_0x65a8('0x2'),_0x65a8('0x3')];function createListener(_0x413574,_0xc629ce){return function(_0x202a21){_0xc629ce[_0x65a8('0x4')](_0x413574,_0x202a21);};}function removeListener(_0x3afd6f,_0x5942db){return function(){VoiceQueueEvents[_0x65a8('0x5')](_0x3afd6f,_0x5942db);};}exports[_0x65a8('0x6')]=function(_0x20743d){for(var _0xc5edea=0x0,_0x3f9631=events['length'];_0xc5edea<_0x3f9631;_0xc5edea++){var _0x1d880d=events[_0xc5edea];var _0x7c27f4=createListener(_0x65a8('0x7')+_0x1d880d,_0x20743d);VoiceQueueEvents['on'](_0x1d880d,_0x7c27f4);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index b083931..759e0d9 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 _0xb6d1=['show','post','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','index','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb6d1,0x117));var _0x1b6d=function(_0x51f632,_0x5a14d5){_0x51f632=_0x51f632-0x0;var _0x24cf36=_0xb6d1[_0x51f632];return _0x24cf36;};'use strict';var multer=require(_0x1b6d('0x0'));var util=require(_0x1b6d('0x1'));var path=require(_0x1b6d('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b6d('0x3'));var router=express[_0x1b6d('0x4')]();var auth=require(_0x1b6d('0x5'));var interaction=require(_0x1b6d('0x6'));var config=require('../../config/environment');var controller=require(_0x1b6d('0x7'));router[_0x1b6d('0x8')]('/',auth['isAuthenticated'](),controller[_0x1b6d('0x9')]);router[_0x1b6d('0x8')]('/describe',auth[_0x1b6d('0xa')](),controller[_0x1b6d('0xb')]);router[_0x1b6d('0x8')](_0x1b6d('0xc'),auth[_0x1b6d('0xa')](),controller[_0x1b6d('0xd')]);router[_0x1b6d('0x8')](_0x1b6d('0xe'),auth[_0x1b6d('0xa')](),controller[_0x1b6d('0xf')]);router[_0x1b6d('0x10')]('/',auth[_0x1b6d('0xa')](),controller['create']);router[_0x1b6d('0x11')](_0x1b6d('0xe'),auth['isAuthenticated'](),controller[_0x1b6d('0x12')]);router[_0x1b6d('0x13')](_0x1b6d('0xe'),auth[_0x1b6d('0xa')](),controller[_0x1b6d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0e6d=['get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller'];(function(_0x352a53,_0x23566f){var _0x3d9035=function(_0x1d995d){while(--_0x1d995d){_0x352a53['push'](_0x352a53['shift']());}};_0x3d9035(++_0x23566f);}(_0x0e6d,0x1d9));var _0xd0e6=function(_0x1c100b,_0x5e17a0){_0x1c100b=_0x1c100b-0x0;var _0x2417fe=_0x0e6d[_0x1c100b];return _0x2417fe;};'use strict';var multer=require(_0xd0e6('0x0'));var util=require(_0xd0e6('0x1'));var path=require('path');var timeout=require(_0xd0e6('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xd0e6('0x3'));var interaction=require(_0xd0e6('0x4'));var config=require(_0xd0e6('0x5'));var controller=require(_0xd0e6('0x6'));router[_0xd0e6('0x7')]('/',auth['isAuthenticated'](),controller[_0xd0e6('0x8')]);router['get'](_0xd0e6('0x9'),auth[_0xd0e6('0xa')](),controller[_0xd0e6('0xb')]);router[_0xd0e6('0x7')](_0xd0e6('0xc'),auth['isAuthenticated'](),controller[_0xd0e6('0xd')]);router[_0xd0e6('0x7')](_0xd0e6('0xe'),auth['isAuthenticated'](),controller[_0xd0e6('0xf')]);router[_0xd0e6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd0e6('0x11')]('/:id',auth[_0xd0e6('0xa')](),controller[_0xd0e6('0x12')]);router[_0xd0e6('0x13')]('/:id',auth[_0xd0e6('0xa')](),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 982dd64..b3e982d 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 _0xaf18=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3df4a3,_0x9fdb6f){var _0x4a8cbb=function(_0x24216c){while(--_0x24216c){_0x3df4a3['push'](_0x3df4a3['shift']());}};_0x4a8cbb(++_0x9fdb6f);}(_0xaf18,0x177));var _0x8af1=function(_0x32ab83,_0x295ddb){_0x32ab83=_0x32ab83-0x0;var _0x5bb3bb=_0xaf18[_0x32ab83];return _0x5bb3bb;};'use strict';var Sequelize=require(_0x8af1('0x0'));var moment=require(_0x8af1('0x1'));module[_0x8af1('0x2')]={'type':{'type':Sequelize[_0x8af1('0x3')]},'uniqueid':{'type':Sequelize[_0x8af1('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8af1('0x3')]},'queue':{'type':Sequelize[_0x8af1('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x8af1('0x4')],'set':function(_0x59829f){var _0x4d61d1=moment(_0x59829f);var _0x4edc5a=moment(this[_0x8af1('0x5')](_0x8af1('0x6')))[_0x8af1('0x7')](_0x8af1('0x8'));var _0x48e72e=_0x4d61d1['diff'](_0x4edc5a,'seconds');this[_0x8af1('0x9')](_0x8af1('0xa'),_0x59829f);this[_0x8af1('0x9')](_0x8af1('0xb'),_0x48e72e||null);}},'position':{'type':Sequelize[_0x8af1('0xc')]},'count':{'type':Sequelize[_0x8af1('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x8af1('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x8af1('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x8af1('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x8af1('0x3')],'comment':_0x8af1('0xe')},'originalposition':{'type':Sequelize[_0x8af1('0xc')]},'channel':{'type':Sequelize[_0x8af1('0x3')]},'connectedlinenum':{'type':Sequelize[_0x8af1('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8af1('0x3')]},'context':{'type':Sequelize[_0x8af1('0x3')]},'exten':{'type':Sequelize[_0x8af1('0x3')]},'priority':{'type':Sequelize[_0x8af1('0x3')]},'holdtime':{'type':Sequelize[_0x8af1('0xc')]},'mohtime':{'type':Sequelize[_0x8af1('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x8af1('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8af1('0x3')],'comment':_0x8af1('0xf')},'transferexten':{'type':Sequelize[_0x8af1('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x8af1('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb1e5=['diff','seconds','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x120b0d,_0x4aba9b){var _0x465a3b=function(_0xf38f47){while(--_0xf38f47){_0x120b0d['push'](_0x120b0d['shift']());}};_0x465a3b(++_0x4aba9b);}(_0xb1e5,0x19d));var _0x5b1e=function(_0x1ae873,_0xbc2651){_0x1ae873=_0x1ae873-0x0;var _0x48bc79=_0xb1e5[_0x1ae873];return _0x48bc79;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5b1e('0x0'));module['exports']={'type':{'type':Sequelize[_0x5b1e('0x1')]},'uniqueid':{'type':Sequelize[_0x5b1e('0x1')]},'calleridnum':{'type':Sequelize[_0x5b1e('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5b1e('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x5b1e('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x5b1e('0x2')],'set':function(_0x5200d5){var _0x15a383=moment(_0x5200d5);var _0x1ec82c=moment(this[_0x5b1e('0x3')](_0x5b1e('0x4')))[_0x5b1e('0x5')](_0x5b1e('0x6'));var _0x5866d8=_0x15a383[_0x5b1e('0x7')](_0x1ec82c,_0x5b1e('0x8'));this['setDataValue']('queuecallerleaveAt',_0x5200d5);this['setDataValue'](_0x5b1e('0x9'),_0x5866d8||null);}},'position':{'type':Sequelize[_0x5b1e('0xa')]},'count':{'type':Sequelize[_0x5b1e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x5b1e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5b1e('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x5b1e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x5b1e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5b1e('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x5b1e('0x1')],'comment':_0x5b1e('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5b1e('0x1')]},'accountcode':{'type':Sequelize[_0x5b1e('0x1')]},'context':{'type':Sequelize[_0x5b1e('0x1')]},'exten':{'type':Sequelize[_0x5b1e('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x5b1e('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5b1e('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5b1e('0x1')]},'transfer':{'type':Sequelize[_0x5b1e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x5b1e('0xd')},'transferexten':{'type':Sequelize[_0x5b1e('0x1')]},'transferuniqueid':{'type':Sequelize[_0x5b1e('0x1')]},'disposition':{'type':Sequelize[_0x5b1e('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x5b1e('0xa')],'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 f2b6d40..602ba80 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 _0x1cb9=['fields','length','hasOwnProperty','sort','where','add','day','merge','map','filter','options','includeAll','rows','catch','show','params','rawAttributes','find','create','body','describe','order','pick','include','findAll','getVoiceQueuesReport','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','count','offset','limit','set','save','then','destroy','sendStatus','stack','name','send','VoiceQueueReport','model','keys','dateStart','query','dateEnd','filters','intersection','attributes'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x1cb9,0x14e));var _0x91cb=function(_0x50b044,_0x1e9ef0){_0x50b044=_0x50b044-0x0;var _0xa12d87=_0x1cb9[_0x50b044];return _0xa12d87;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var qs=require(_0x91cb('0x10'));var logger=require(_0x91cb('0x11'))(_0x91cb('0x12'));var utils=require(_0x91cb('0x13'));var config=require(_0x91cb('0x14'));var db=require(_0x91cb('0x15'))['db'];config[_0x91cb('0x16')]=_[_0x91cb('0x17')](config['redis'],{'host':_0x91cb('0x18'),'port':0x18eb});var socket=require(_0x91cb('0x19'))(new Redis(config['redis']));require(_0x91cb('0x1a'))[_0x91cb('0x1b')](socket);function respondWithStatusCode(_0x44f2e9,_0x2c7d40){_0x2c7d40=_0x2c7d40||0xcc;return function(_0x4a7d45){if(_0x4a7d45){return _0x44f2e9['sendStatus'](_0x2c7d40);}return _0x44f2e9[_0x91cb('0x1c')](_0x2c7d40)[_0x91cb('0x1d')]();};}function respondWithResult(_0x585470,_0x528f73){_0x528f73=_0x528f73||0xc8;return function(_0x576369){if(_0x576369){return _0x585470[_0x91cb('0x1c')](_0x528f73)[_0x91cb('0x1e')](_0x576369);}};}function respondWithFilteredResult(_0x5ea796,_0x238f11){return function(_0x135890){if(_0x135890){var _0x4f1554=_0x135890[_0x91cb('0x1f')],_0xc594e3=_0x238f11['offset'],_0x139f4b=_0x238f11[_0x91cb('0x20')]+_0x238f11[_0x91cb('0x21')],_0x1cd34b;if(_0x139f4b>=_0x4f1554){_0x139f4b=_0x4f1554;_0x1cd34b=0xc8;}else{_0x1cd34b=0xce;}_0x5ea796['status'](_0x1cd34b);return _0x5ea796[_0x91cb('0x22')]('Content-Range',_0xc594e3+'-'+_0x139f4b+'/'+_0x4f1554)['json'](_0x135890);}return null;};}function patchUpdates(_0x281ff3){return function(_0x160ded){try{jsonpatch['apply'](_0x160ded,_0x281ff3,!![]);}catch(_0x51a1d5){return BPromise['reject'](_0x51a1d5);}return _0x160ded[_0x91cb('0x23')]();};}function saveUpdates(_0x18827b,_0x20aff5){return function(_0x1dbee2){if(_0x1dbee2){return _0x1dbee2['update'](_0x18827b)[_0x91cb('0x24')](function(_0x43881c){return _0x43881c;});}return null;};}function removeEntity(_0x1fa837,_0x55fa78){return function(_0x26f18f){if(_0x26f18f){return _0x26f18f[_0x91cb('0x25')]()[_0x91cb('0x24')](function(){_0x1fa837[_0x91cb('0x1c')](0xcc)[_0x91cb('0x1d')]();});}};}function handleEntityNotFound(_0x7ad361,_0x414e60){return function(_0x423c4f){if(!_0x423c4f){_0x7ad361[_0x91cb('0x26')](0x194);}return _0x423c4f;};}function handleError(_0x4c8438,_0x59bf3a){_0x59bf3a=_0x59bf3a||0x1f4;return function(_0x234eb1){logger['error'](_0x234eb1[_0x91cb('0x27')]);if(_0x234eb1[_0x91cb('0x28')]){delete _0x234eb1[_0x91cb('0x28')];}_0x4c8438['status'](_0x59bf3a)[_0x91cb('0x29')](_0x234eb1);};}exports['index']=function(_0x4572f6,_0x308e8c){var _0x3b3ee6={},_0x2fb473={},_0x468908={'count':0x0,'rows':[]};var _0x504275=db[_0x91cb('0x2a')]['rawAttributes'];_0x2fb473[_0x91cb('0x2b')]=_[_0x91cb('0x2c')](_0x504275);var _0x445fe1={'dateStart':_0x4572f6['query'][_0x91cb('0x2d')],'dateEnd':_0x4572f6[_0x91cb('0x2e')][_0x91cb('0x2f')]};delete _0x4572f6[_0x91cb('0x2e')][_0x91cb('0x2d')];delete _0x4572f6[_0x91cb('0x2e')][_0x91cb('0x2f')];_0x2fb473[_0x91cb('0x2e')]=_[_0x91cb('0x2c')](_0x4572f6['query']);_0x2fb473[_0x91cb('0x30')]=_[_0x91cb('0x31')](_0x2fb473[_0x91cb('0x2b')],_0x2fb473[_0x91cb('0x2e')]);_0x3b3ee6[_0x91cb('0x32')]=_['intersection'](_0x2fb473[_0x91cb('0x2b')],qs[_0x91cb('0x33')](_0x4572f6[_0x91cb('0x2e')][_0x91cb('0x33')]));_0x3b3ee6[_0x91cb('0x32')]=_0x3b3ee6['attributes'][_0x91cb('0x34')]?_0x3b3ee6['attributes']:_0x2fb473['model'];if(!_0x4572f6['query'][_0x91cb('0x35')]('nolimit')){_0x3b3ee6[_0x91cb('0x21')]=qs['limit'](_0x4572f6['query'][_0x91cb('0x21')]);_0x3b3ee6[_0x91cb('0x20')]=qs[_0x91cb('0x20')](_0x4572f6[_0x91cb('0x2e')][_0x91cb('0x20')]);}_0x3b3ee6['order']=qs[_0x91cb('0x36')](_0x4572f6[_0x91cb('0x2e')][_0x91cb('0x36')]);_0x3b3ee6[_0x91cb('0x37')]=qs['filters'](_['pick'](_0x4572f6[_0x91cb('0x2e')],_0x2fb473[_0x91cb('0x30')]));if(_0x445fe1['dateStart']){if(_0x445fe1[_0x91cb('0x2f')]){_0x445fe1[_0x91cb('0x2f')]=moment(_0x445fe1['dateEnd'])[_0x91cb('0x38')](0x1,_0x91cb('0x39'));}else{_0x445fe1['dateEnd']=moment(_0x445fe1[_0x91cb('0x2d')])['add'](0x1,_0x91cb('0x39'));}_[_0x91cb('0x3a')](_0x3b3ee6[_0x91cb('0x37')],{'createdAt':{'$gte':_0x445fe1[_0x91cb('0x2d')],'$lte':_0x445fe1[_0x91cb('0x2f')]}});}if(_0x4572f6[_0x91cb('0x2e')]['filter']){_0x3b3ee6[_0x91cb('0x37')]=_[_0x91cb('0x3a')](_0x3b3ee6['where'],{'$or':_[_0x91cb('0x3b')](_0x3b3ee6['attributes'],function(_0x2c6102){var _0x2eac87={};_0x2eac87[_0x2c6102]={'$like':'%'+_0x4572f6[_0x91cb('0x2e')][_0x91cb('0x3c')]+'%'};return _0x2eac87;})});}_0x3b3ee6=_['merge']({},_0x3b3ee6,_0x4572f6[_0x91cb('0x3d')]);var _0x5af0e6={'where':_0x3b3ee6[_0x91cb('0x37')]};return db[_0x91cb('0x2a')][_0x91cb('0x1f')](_0x5af0e6)[_0x91cb('0x24')](function(_0x451463){_0x468908[_0x91cb('0x1f')]=_0x451463;if(_0x4572f6[_0x91cb('0x2e')][_0x91cb('0x3e')]){_0x3b3ee6['include']=[{'all':!![]}];}return db[_0x91cb('0x2a')]['findAll'](_0x3b3ee6);})[_0x91cb('0x24')](function(_0x5537a0){_0x468908[_0x91cb('0x3f')]=_0x5537a0;return _0x468908;})['then'](respondWithFilteredResult(_0x308e8c,_0x3b3ee6))[_0x91cb('0x40')](handleError(_0x308e8c,null));};exports[_0x91cb('0x41')]=function(_0xba99ce,_0x31c966){var _0x4f5da7={'raw':![],'where':{'id':_0xba99ce[_0x91cb('0x42')]['id']}},_0x2cdb61={};_0x2cdb61['model']=_[_0x91cb('0x2c')](db[_0x91cb('0x2a')][_0x91cb('0x43')]);_0x2cdb61[_0x91cb('0x2e')]=_[_0x91cb('0x2c')](_0xba99ce[_0x91cb('0x2e')]);_0x2cdb61[_0x91cb('0x30')]=_[_0x91cb('0x31')](_0x2cdb61[_0x91cb('0x2b')],_0x2cdb61['query']);_0x4f5da7[_0x91cb('0x32')]=_[_0x91cb('0x31')](_0x2cdb61[_0x91cb('0x2b')],qs[_0x91cb('0x33')](_0xba99ce[_0x91cb('0x2e')][_0x91cb('0x33')]));_0x4f5da7[_0x91cb('0x32')]=_0x4f5da7[_0x91cb('0x32')]['length']?_0x4f5da7[_0x91cb('0x32')]:_0x2cdb61[_0x91cb('0x2b')];if(_0xba99ce[_0x91cb('0x2e')][_0x91cb('0x3e')]){_0x4f5da7['include']=[{'all':!![]}];}_0x4f5da7=_[_0x91cb('0x3a')]({},_0x4f5da7,_0xba99ce[_0x91cb('0x3d')]);return db['VoiceQueueReport'][_0x91cb('0x44')](_0x4f5da7)['then'](handleEntityNotFound(_0x31c966,null))[_0x91cb('0x24')](respondWithResult(_0x31c966,null))['catch'](handleError(_0x31c966,null));};exports['create']=function(_0x52db35,_0x98245b){return db[_0x91cb('0x2a')][_0x91cb('0x45')](_0x52db35[_0x91cb('0x46')],{})[_0x91cb('0x24')](respondWithResult(_0x98245b,0xc9))['catch'](handleError(_0x98245b,null));};exports['update']=function(_0x1d26b8,_0xfe6692){if(_0x1d26b8[_0x91cb('0x46')]['id']){delete _0x1d26b8[_0x91cb('0x46')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x1d26b8['params']['id']}})[_0x91cb('0x24')](handleEntityNotFound(_0xfe6692,null))['then'](saveUpdates(_0x1d26b8[_0x91cb('0x46')],null))['then'](respondWithResult(_0xfe6692,null))[_0x91cb('0x40')](handleError(_0xfe6692,null));};exports[_0x91cb('0x25')]=function(_0x2febe9,_0x649976){return db[_0x91cb('0x2a')][_0x91cb('0x44')]({'where':{'id':_0x2febe9[_0x91cb('0x42')]['id']}})[_0x91cb('0x24')](handleEntityNotFound(_0x649976,null))[_0x91cb('0x24')](removeEntity(_0x649976,null))[_0x91cb('0x40')](handleError(_0x649976,null));};exports[_0x91cb('0x47')]=function(_0x5752ed,_0x1e445a){return db[_0x91cb('0x2a')]['describe']()[_0x91cb('0x24')](respondWithResult(_0x1e445a,null))[_0x91cb('0x40')](handleError(_0x1e445a,null));};exports['getVoiceQueuesReport']=function(_0x2f5311,_0x166eeb){var _0x13b204={},_0x170b10={},_0x43ddee={'count':0x0,'rows':[]};_0x170b10[_0x91cb('0x2b')]=_[_0x91cb('0x2c')](db[_0x91cb('0x2a')][_0x91cb('0x43')]);var _0x93ef52={'dateStart':_0x2f5311[_0x91cb('0x2e')]['dateStart'],'dateEnd':_0x2f5311[_0x91cb('0x2e')]['dateEnd']};delete _0x2f5311[_0x91cb('0x2e')]['dateStart'];delete _0x2f5311[_0x91cb('0x2e')][_0x91cb('0x2f')];_0x170b10[_0x91cb('0x2e')]=_['keys'](_0x2f5311[_0x91cb('0x2e')]);_0x170b10[_0x91cb('0x30')]=_['intersection'](_0x170b10[_0x91cb('0x2b')],_0x170b10[_0x91cb('0x2e')]);_0x13b204[_0x91cb('0x32')]=_[_0x91cb('0x31')](_0x170b10['model'],qs[_0x91cb('0x33')](_0x2f5311[_0x91cb('0x2e')][_0x91cb('0x33')]));_0x13b204[_0x91cb('0x32')]=_0x13b204['attributes'][_0x91cb('0x34')]?_0x13b204[_0x91cb('0x32')]:_0x170b10['model'];if(!_0x2f5311['query'][_0x91cb('0x35')]('nolimit')){_0x13b204[_0x91cb('0x21')]=qs[_0x91cb('0x21')](_0x2f5311['query']['limit']);_0x13b204[_0x91cb('0x20')]=qs['offset'](_0x2f5311[_0x91cb('0x2e')][_0x91cb('0x20')]);}_0x13b204[_0x91cb('0x48')]=qs['sort'](_0x2f5311[_0x91cb('0x2e')]['sort']);_0x13b204[_0x91cb('0x37')]=qs[_0x91cb('0x30')](_[_0x91cb('0x49')](_0x2f5311[_0x91cb('0x2e')],_0x170b10['filters']));if(_0x93ef52[_0x91cb('0x2d')]){if(_0x93ef52[_0x91cb('0x2f')]){_0x93ef52[_0x91cb('0x2f')]=moment(_0x93ef52[_0x91cb('0x2f')])[_0x91cb('0x38')](0x1,_0x91cb('0x39'));}else{_0x93ef52[_0x91cb('0x2f')]=moment(_0x93ef52[_0x91cb('0x2d')])[_0x91cb('0x38')](0x1,_0x91cb('0x39'));}_[_0x91cb('0x3a')](_0x13b204[_0x91cb('0x37')],{'createdAt':{'$gte':_0x93ef52['dateStart'],'$lte':_0x93ef52[_0x91cb('0x2f')]}});}if(_0x2f5311[_0x91cb('0x2e')][_0x91cb('0x3c')]){_0x13b204[_0x91cb('0x37')]=_[_0x91cb('0x3a')](_0x13b204[_0x91cb('0x37')],{'$or':_[_0x91cb('0x3b')](_0x13b204['attributes'],function(_0x325b2d){var _0x5a3c7d={};_0x5a3c7d[_0x325b2d]={'$like':'%'+_0x2f5311[_0x91cb('0x2e')][_0x91cb('0x3c')]+'%'};return _0x5a3c7d;})});}_0x13b204=_[_0x91cb('0x3a')]({},_0x13b204,_0x2f5311[_0x91cb('0x3d')]);var _0x48fcfe={'where':_0x13b204[_0x91cb('0x37')]};return db[_0x91cb('0x2a')][_0x91cb('0x1f')](_0x48fcfe)[_0x91cb('0x24')](function(_0x1bb16f){_0x43ddee[_0x91cb('0x1f')]=_0x1bb16f;if(_0x2f5311['query'][_0x91cb('0x3e')]){_0x13b204[_0x91cb('0x4a')]=[{'all':!![]}];}return db[_0x91cb('0x2a')][_0x91cb('0x4b')](_0x13b204);})[_0x91cb('0x24')](function(_0xc58b4a){_0x43ddee[_0x91cb('0x3f')]=_0xc58b4a;return _0x43ddee;})[_0x91cb('0x24')](respondWithFilteredResult(_0x166eeb,_0x13b204,_0x91cb('0x4c')))[_0x91cb('0x40')](handleError(_0x166eeb,null,_0x91cb('0x4c')));}; \ No newline at end of file +var _0x00bb=['filters','add','day','merge','where','map','filter','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','sendStatus','end','status','offset','limit','set','Content-Range','reject','save','then','name','send','index','VoiceQueueReport','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var qs=require(_0xb00b('0xf'));var logger=require(_0xb00b('0x10'))(_0xb00b('0x11'));var utils=require(_0xb00b('0x12'));var config=require('../../config/environment');var db=require(_0xb00b('0x13'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x14'),'port':0x18eb});var socket=require(_0xb00b('0x15'))(new Redis(config[_0xb00b('0x16')]));require(_0xb00b('0x17'))[_0xb00b('0x18')](socket);function respondWithStatusCode(_0x1f1c1d,_0x4ada81){_0x4ada81=_0x4ada81||0xcc;return function(_0x218de2){if(_0x218de2){return _0x1f1c1d[_0xb00b('0x19')](_0x4ada81);}return _0x1f1c1d['status'](_0x4ada81)[_0xb00b('0x1a')]();};}function respondWithResult(_0x1084a6,_0x540b79){_0x540b79=_0x540b79||0xc8;return function(_0x5da36b){if(_0x5da36b){return _0x1084a6[_0xb00b('0x1b')](_0x540b79)['json'](_0x5da36b);}};}function respondWithFilteredResult(_0x51d136,_0x1f9c78){return function(_0x638443){if(_0x638443){var _0x387d97=_0x638443['count'],_0xbb72fc=_0x1f9c78[_0xb00b('0x1c')],_0x58d65f=_0x1f9c78['offset']+_0x1f9c78[_0xb00b('0x1d')],_0x2a7231;if(_0x58d65f>=_0x387d97){_0x58d65f=_0x387d97;_0x2a7231=0xc8;}else{_0x2a7231=0xce;}_0x51d136['status'](_0x2a7231);return _0x51d136[_0xb00b('0x1e')](_0xb00b('0x1f'),_0xbb72fc+'-'+_0x58d65f+'/'+_0x387d97)['json'](_0x638443);}return null;};}function patchUpdates(_0x55770c){return function(_0x2b0da1){try{jsonpatch['apply'](_0x2b0da1,_0x55770c,!![]);}catch(_0x1344c4){return BPromise[_0xb00b('0x20')](_0x1344c4);}return _0x2b0da1[_0xb00b('0x21')]();};}function saveUpdates(_0x3501af,_0x56c189){return function(_0x362ee0){if(_0x362ee0){return _0x362ee0['update'](_0x3501af)[_0xb00b('0x22')](function(_0x121ec7){return _0x121ec7;});}return null;};}function removeEntity(_0x51b841,_0x231293){return function(_0x2896d1){if(_0x2896d1){return _0x2896d1['destroy']()[_0xb00b('0x22')](function(){_0x51b841[_0xb00b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44efe5,_0x243fdb){return function(_0x3c9500){if(!_0x3c9500){_0x44efe5[_0xb00b('0x19')](0x194);}return _0x3c9500;};}function handleError(_0x520e55,_0x50be6c){_0x50be6c=_0x50be6c||0x1f4;return function(_0x3785e9){logger['error'](_0x3785e9['stack']);if(_0x3785e9['name']){delete _0x3785e9[_0xb00b('0x23')];}_0x520e55[_0xb00b('0x1b')](_0x50be6c)[_0xb00b('0x24')](_0x3785e9);};}exports[_0xb00b('0x25')]=function(_0x1f14fa,_0x197379){var _0x15d3b9={},_0x4a8d2b={},_0x22c22d={'count':0x0,'rows':[]};var _0x503c9c=db[_0xb00b('0x26')][_0xb00b('0x27')];_0x4a8d2b[_0xb00b('0x28')]=_['keys'](_0x503c9c);var _0x2fc11a={'dateStart':_0x1f14fa[_0xb00b('0x29')][_0xb00b('0x2a')],'dateEnd':_0x1f14fa[_0xb00b('0x29')][_0xb00b('0x2b')]};delete _0x1f14fa[_0xb00b('0x29')][_0xb00b('0x2a')];delete _0x1f14fa[_0xb00b('0x29')][_0xb00b('0x2b')];_0x4a8d2b['query']=_[_0xb00b('0x2c')](_0x1f14fa[_0xb00b('0x29')]);_0x4a8d2b['filters']=_[_0xb00b('0x2d')](_0x4a8d2b[_0xb00b('0x28')],_0x4a8d2b['query']);_0x15d3b9[_0xb00b('0x2e')]=_['intersection'](_0x4a8d2b[_0xb00b('0x28')],qs[_0xb00b('0x2f')](_0x1f14fa[_0xb00b('0x29')][_0xb00b('0x2f')]));_0x15d3b9[_0xb00b('0x2e')]=_0x15d3b9[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x15d3b9['attributes']:_0x4a8d2b['model'];if(!_0x1f14fa['query'][_0xb00b('0x31')](_0xb00b('0x32'))){_0x15d3b9[_0xb00b('0x1d')]=qs[_0xb00b('0x1d')](_0x1f14fa['query'][_0xb00b('0x1d')]);_0x15d3b9[_0xb00b('0x1c')]=qs[_0xb00b('0x1c')](_0x1f14fa[_0xb00b('0x29')][_0xb00b('0x1c')]);}_0x15d3b9[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x1f14fa[_0xb00b('0x29')]['sort']);_0x15d3b9['where']=qs[_0xb00b('0x35')](_['pick'](_0x1f14fa[_0xb00b('0x29')],_0x4a8d2b[_0xb00b('0x35')]));if(_0x2fc11a[_0xb00b('0x2a')]){if(_0x2fc11a[_0xb00b('0x2b')]){_0x2fc11a[_0xb00b('0x2b')]=moment(_0x2fc11a[_0xb00b('0x2b')])[_0xb00b('0x36')](0x1,'day');}else{_0x2fc11a[_0xb00b('0x2b')]=moment(_0x2fc11a[_0xb00b('0x2a')])[_0xb00b('0x36')](0x1,_0xb00b('0x37'));}_[_0xb00b('0x38')](_0x15d3b9[_0xb00b('0x39')],{'createdAt':{'$gte':_0x2fc11a['dateStart'],'$lte':_0x2fc11a[_0xb00b('0x2b')]}});}if(_0x1f14fa[_0xb00b('0x29')]['filter']){_0x15d3b9[_0xb00b('0x39')]=_[_0xb00b('0x38')](_0x15d3b9[_0xb00b('0x39')],{'$or':_[_0xb00b('0x3a')](_0x15d3b9[_0xb00b('0x2e')],function(_0x5636b1){var _0x14ff6a={};_0x14ff6a[_0x5636b1]={'$like':'%'+_0x1f14fa[_0xb00b('0x29')][_0xb00b('0x3b')]+'%'};return _0x14ff6a;})});}_0x15d3b9=_[_0xb00b('0x38')]({},_0x15d3b9,_0x1f14fa['options']);var _0x4867fe={'where':_0x15d3b9[_0xb00b('0x39')]};return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x4867fe)[_0xb00b('0x22')](function(_0x19a0d0){_0x22c22d[_0xb00b('0x3c')]=_0x19a0d0;if(_0x1f14fa[_0xb00b('0x29')]['includeAll']){_0x15d3b9[_0xb00b('0x3d')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3e')](_0x15d3b9);})[_0xb00b('0x22')](function(_0x302ded){_0x22c22d[_0xb00b('0x3f')]=_0x302ded;return _0x22c22d;})[_0xb00b('0x22')](respondWithFilteredResult(_0x197379,_0x15d3b9))[_0xb00b('0x40')](handleError(_0x197379,null));};exports[_0xb00b('0x41')]=function(_0xf4eb3a,_0xc0dddd){var _0x419113={'raw':![],'where':{'id':_0xf4eb3a[_0xb00b('0x42')]['id']}},_0x577bad={};_0x577bad[_0xb00b('0x28')]=_[_0xb00b('0x2c')](db[_0xb00b('0x26')][_0xb00b('0x27')]);_0x577bad[_0xb00b('0x29')]=_[_0xb00b('0x2c')](_0xf4eb3a[_0xb00b('0x29')]);_0x577bad[_0xb00b('0x35')]=_[_0xb00b('0x2d')](_0x577bad[_0xb00b('0x28')],_0x577bad[_0xb00b('0x29')]);_0x419113['attributes']=_['intersection'](_0x577bad['model'],qs[_0xb00b('0x2f')](_0xf4eb3a[_0xb00b('0x29')]['fields']));_0x419113[_0xb00b('0x2e')]=_0x419113[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x419113[_0xb00b('0x2e')]:_0x577bad['model'];if(_0xf4eb3a['query'][_0xb00b('0x43')]){_0x419113[_0xb00b('0x3d')]=[{'all':!![]}];}_0x419113=_['merge']({},_0x419113,_0xf4eb3a['options']);return db[_0xb00b('0x26')][_0xb00b('0x44')](_0x419113)['then'](handleEntityNotFound(_0xc0dddd,null))[_0xb00b('0x22')](respondWithResult(_0xc0dddd,null))['catch'](handleError(_0xc0dddd,null));};exports['create']=function(_0x4bcc9e,_0x465d90){return db['VoiceQueueReport'][_0xb00b('0x45')](_0x4bcc9e[_0xb00b('0x46')],{})[_0xb00b('0x22')](respondWithResult(_0x465d90,0xc9))[_0xb00b('0x40')](handleError(_0x465d90,null));};exports[_0xb00b('0x47')]=function(_0xda60ca,_0x4846c9){if(_0xda60ca['body']['id']){delete _0xda60ca[_0xb00b('0x46')]['id'];}return db[_0xb00b('0x26')]['find']({'where':{'id':_0xda60ca[_0xb00b('0x42')]['id']}})[_0xb00b('0x22')](handleEntityNotFound(_0x4846c9,null))['then'](saveUpdates(_0xda60ca[_0xb00b('0x46')],null))[_0xb00b('0x22')](respondWithResult(_0x4846c9,null))[_0xb00b('0x40')](handleError(_0x4846c9,null));};exports['destroy']=function(_0x501cbe,_0x19f907){return db[_0xb00b('0x26')][_0xb00b('0x44')]({'where':{'id':_0x501cbe[_0xb00b('0x42')]['id']}})['then'](handleEntityNotFound(_0x19f907,null))[_0xb00b('0x22')](removeEntity(_0x19f907,null))[_0xb00b('0x40')](handleError(_0x19f907,null));};exports['describe']=function(_0x4cd9fd,_0x160965){return db['VoiceQueueReport'][_0xb00b('0x48')]()[_0xb00b('0x22')](respondWithResult(_0x160965,null))[_0xb00b('0x40')](handleError(_0x160965,null));};exports[_0xb00b('0x49')]=function(_0x450ce7,_0x2965ca){var _0x5a3b85={},_0x5d52a5={},_0x51c9e3={'count':0x0,'rows':[]};_0x5d52a5[_0xb00b('0x28')]=_[_0xb00b('0x2c')](db[_0xb00b('0x26')]['rawAttributes']);var _0x248335={'dateStart':_0x450ce7[_0xb00b('0x29')][_0xb00b('0x2a')],'dateEnd':_0x450ce7['query'][_0xb00b('0x2b')]};delete _0x450ce7[_0xb00b('0x29')][_0xb00b('0x2a')];delete _0x450ce7[_0xb00b('0x29')][_0xb00b('0x2b')];_0x5d52a5[_0xb00b('0x29')]=_[_0xb00b('0x2c')](_0x450ce7[_0xb00b('0x29')]);_0x5d52a5['filters']=_[_0xb00b('0x2d')](_0x5d52a5[_0xb00b('0x28')],_0x5d52a5[_0xb00b('0x29')]);_0x5a3b85['attributes']=_[_0xb00b('0x2d')](_0x5d52a5[_0xb00b('0x28')],qs[_0xb00b('0x2f')](_0x450ce7[_0xb00b('0x29')][_0xb00b('0x2f')]));_0x5a3b85['attributes']=_0x5a3b85[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x5a3b85[_0xb00b('0x2e')]:_0x5d52a5[_0xb00b('0x28')];if(!_0x450ce7['query'][_0xb00b('0x31')](_0xb00b('0x32'))){_0x5a3b85[_0xb00b('0x1d')]=qs[_0xb00b('0x1d')](_0x450ce7[_0xb00b('0x29')][_0xb00b('0x1d')]);_0x5a3b85[_0xb00b('0x1c')]=qs['offset'](_0x450ce7[_0xb00b('0x29')]['offset']);}_0x5a3b85[_0xb00b('0x33')]=qs['sort'](_0x450ce7[_0xb00b('0x29')]['sort']);_0x5a3b85[_0xb00b('0x39')]=qs['filters'](_[_0xb00b('0x4a')](_0x450ce7[_0xb00b('0x29')],_0x5d52a5[_0xb00b('0x35')]));if(_0x248335['dateStart']){if(_0x248335['dateEnd']){_0x248335['dateEnd']=moment(_0x248335[_0xb00b('0x2b')])[_0xb00b('0x36')](0x1,_0xb00b('0x37'));}else{_0x248335['dateEnd']=moment(_0x248335[_0xb00b('0x2a')])[_0xb00b('0x36')](0x1,_0xb00b('0x37'));}_[_0xb00b('0x38')](_0x5a3b85[_0xb00b('0x39')],{'createdAt':{'$gte':_0x248335['dateStart'],'$lte':_0x248335[_0xb00b('0x2b')]}});}if(_0x450ce7[_0xb00b('0x29')]['filter']){_0x5a3b85[_0xb00b('0x39')]=_[_0xb00b('0x38')](_0x5a3b85[_0xb00b('0x39')],{'$or':_['map'](_0x5a3b85['attributes'],function(_0x359669){var _0x188da7={};_0x188da7[_0x359669]={'$like':'%'+_0x450ce7[_0xb00b('0x29')]['filter']+'%'};return _0x188da7;})});}_0x5a3b85=_['merge']({},_0x5a3b85,_0x450ce7['options']);var _0x5e9677={'where':_0x5a3b85[_0xb00b('0x39')]};return db['VoiceQueueReport'][_0xb00b('0x3c')](_0x5e9677)[_0xb00b('0x22')](function(_0x53dd22){_0x51c9e3[_0xb00b('0x3c')]=_0x53dd22;if(_0x450ce7[_0xb00b('0x29')][_0xb00b('0x43')]){_0x5a3b85[_0xb00b('0x3d')]=[{'all':!![]}];}return db[_0xb00b('0x26')]['findAll'](_0x5a3b85);})[_0xb00b('0x22')](function(_0x851800){_0x51c9e3[_0xb00b('0x3f')]=_0x851800;return _0x51c9e3;})[_0xb00b('0x22')](respondWithFilteredResult(_0x2965ca,_0x5a3b85,_0xb00b('0x49')))[_0xb00b('0x40')](handleError(_0x2965ca,null,_0xb00b('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 490b347..3196db8 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 _0xebd7=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x272d97,_0x3cb745){var _0x40fc01=function(_0x1ad071){while(--_0x1ad071){_0x272d97['push'](_0x272d97['shift']());}};_0x40fc01(++_0x3cb745);}(_0xebd7,0x96));var _0x7ebd=function(_0x47a352,_0x3f5489){_0x47a352=_0x47a352-0x0;var _0x5f339f=_0xebd7[_0x47a352];return _0x5f339f;};'use strict';var EventEmitter=require(_0x7ebd('0x0'));var VoiceQueueReport=require(_0x7ebd('0x1'))['db'][_0x7ebd('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7ebd('0x3')](0x0);var events={'afterCreate':_0x7ebd('0x4'),'afterUpdate':_0x7ebd('0x5'),'afterDestroy':_0x7ebd('0x6')};function emitEvent(_0x5e1393){return function(_0x45a045,_0x5f00b5,_0x473481){VoiceQueueReportEvents['emit'](_0x5e1393+':'+_0x45a045['id'],_0x45a045);VoiceQueueReportEvents[_0x7ebd('0x7')](_0x5e1393,_0x45a045);_0x473481(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x7ebd('0x8')](e,emitEvent(event));}}module[_0x7ebd('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x7e8e=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb'];(function(_0xc21b09,_0x5b4e19){var _0x34a385=function(_0x46efa5){while(--_0x46efa5){_0xc21b09['push'](_0xc21b09['shift']());}};_0x34a385(++_0x5b4e19);}(_0x7e8e,0x99));var _0xe7e8=function(_0x18fb4c,_0x578f22){_0x18fb4c=_0x18fb4c-0x0;var _0x4a75b3=_0x7e8e[_0x18fb4c];return _0x4a75b3;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xe7e8('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe7e8('0x1')](0x0);var events={'afterCreate':_0xe7e8('0x2'),'afterUpdate':'update','afterDestroy':_0xe7e8('0x3')};function emitEvent(_0x535837){return function(_0x5b6562,_0x3cc397,_0x4ad8e7){VoiceQueueReportEvents[_0xe7e8('0x4')](_0x535837+':'+_0x5b6562['id'],_0x5b6562);VoiceQueueReportEvents['emit'](_0x535837,_0x5b6562);_0x4ad8e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xe7e8('0x5')](e,emitEvent(event));}}module[_0xe7e8('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 2370b33..2ee99db 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 _0x4366=['../../config/logger','api','moment','bluebird','./voiceQueueReport.attributes','define','VoiceQueueReport','calleridnum'];(function(_0x57fb32,_0x48b5a9){var _0x2a7cf7=function(_0x483ccf){while(--_0x483ccf){_0x57fb32['push'](_0x57fb32['shift']());}};_0x2a7cf7(++_0x48b5a9);}(_0x4366,0x120));var _0x6436=function(_0x4a07a8,_0x35784f){_0x4a07a8=_0x4a07a8-0x0;var _0x494769=_0x4366[_0x4a07a8];return _0x494769;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6436('0x0'))(_0x6436('0x1'));var moment=require(_0x6436('0x2'));var BPromise=require(_0x6436('0x3'));var rp=require('request-promise');var attributes=require(_0x6436('0x4'));module['exports']=function(_0xf179e5,_0x41060d){return _0xf179e5[_0x6436('0x5')](_0x6436('0x6'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x6436('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c40=['uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x0c40,0x13a));var _0x00c4=function(_0x328f57,_0x2a43eb){_0x328f57=_0x328f57-0x0;var _0xfad523=_0x0c40[_0x328f57];return _0xfad523;};'use strict';var _=require(_0x00c4('0x0'));var util=require(_0x00c4('0x1'));var logger=require(_0x00c4('0x2'))(_0x00c4('0x3'));var moment=require(_0x00c4('0x4'));var BPromise=require('bluebird');var rp=require(_0x00c4('0x5'));var attributes=require(_0x00c4('0x6'));module[_0x00c4('0x7')]=function(_0x5846cc,_0x115f08){return _0x5846cc['define'](_0x00c4('0x8'),attributes,{'tableName':_0x00c4('0x9'),'paranoid':![],'indexes':[{'fields':[_0x00c4('0xa')]},{'fields':[_0x00c4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 26b7add..d9940b3 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 _0xe035=['body','raw','stringify','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','map','include','model','CreateVoiceQueueReport','create'];(function(_0x13e842,_0x52c4ee){var _0x9ce52f=function(_0x570a06){while(--_0x570a06){_0x13e842['push'](_0x13e842['shift']());}};_0x9ce52f(++_0x52c4ee);}(_0xe035,0x132));var _0x5e03=function(_0x16b88f,_0x2d2964){_0x16b88f=_0x16b88f-0x0;var _0x2be8a8=_0xe035[_0x16b88f];return _0x2be8a8;};'use strict';var _=require(_0x5e03('0x0'));var util=require(_0x5e03('0x1'));var moment=require(_0x5e03('0x2'));var BPromise=require(_0x5e03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e03('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e03('0x5'))(_0x5e03('0x6'));var config=require(_0x5e03('0x7'));var jayson=require(_0x5e03('0x8'));var client=jayson[_0x5e03('0x9')]['http']({'port':0x232a});config[_0x5e03('0xa')]=_[_0x5e03('0xb')](config[_0x5e03('0xa')],{'host':_0x5e03('0xc'),'port':0x18eb});var socket=require(_0x5e03('0xd'))(new Redis(config[_0x5e03('0xa')]));require(_0x5e03('0xe'))[_0x5e03('0xf')](socket);function respondWithRpcPromise(_0x49897c,_0xd9c65f,_0x43f51d){return new BPromise(function(_0x410029,_0x520f86){return client[_0x5e03('0x10')](_0x49897c,_0x43f51d)[_0x5e03('0x11')](function(_0x53e4fb){logger[_0x5e03('0x12')](_0x5e03('0x13'),_0xd9c65f,'request\x20sent');logger[_0x5e03('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0xd9c65f,'request\x20sent',JSON['stringify'](_0x53e4fb));if(_0x53e4fb[_0x5e03('0x15')]){if(_0x53e4fb[_0x5e03('0x15')][_0x5e03('0x16')]===0x1f4){logger[_0x5e03('0x15')](_0x5e03('0x13'),_0xd9c65f,_0x53e4fb[_0x5e03('0x15')]['message']);return _0x520f86(_0x53e4fb[_0x5e03('0x15')][_0x5e03('0x17')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0xd9c65f,_0x53e4fb['error'][_0x5e03('0x17')]);return _0x410029(_0x53e4fb[_0x5e03('0x15')][_0x5e03('0x17')]);}else{logger['info'](_0x5e03('0x13'),_0xd9c65f,_0x5e03('0x18'));_0x410029(_0x53e4fb['result'][_0x5e03('0x17')]);}})[_0x5e03('0x19')](function(_0x33355d){logger[_0x5e03('0x15')](_0x5e03('0x13'),_0xd9c65f,_0x33355d);_0x520f86(_0x33355d);});});}exports[_0x5e03('0x1a')]=function(_0x323c03){var _0x322d56=this;return new Promise(function(_0x77fc23,_0x4b6733){return db[_0x5e03('0x1b')][_0x5e03('0x1c')]({'raw':_0x323c03[_0x5e03('0x1d')]?_0x323c03[_0x5e03('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x323c03['options']?_0x323c03['options'][_0x5e03('0x1e')]||null:null,'attributes':_0x323c03[_0x5e03('0x1d')]?_0x323c03[_0x5e03('0x1d')][_0x5e03('0x1f')]||null:null,'limit':_0x323c03[_0x5e03('0x1d')]?_0x323c03[_0x5e03('0x1d')][_0x5e03('0x20')]||null:null,'include':_0x323c03[_0x5e03('0x1d')]?_0x323c03['options']['include']?_[_0x5e03('0x21')](_0x323c03['options'][_0x5e03('0x22')],function(_0x5e6f5b){return{'model':db[_0x5e6f5b[_0x5e03('0x23')]],'as':_0x5e6f5b['as'],'attributes':_0x5e6f5b[_0x5e03('0x1f')],'include':_0x5e6f5b[_0x5e03('0x22')]?_[_0x5e03('0x21')](_0x5e6f5b[_0x5e03('0x22')],function(_0x1b3381){return{'model':db[_0x1b3381[_0x5e03('0x23')]],'as':_0x1b3381['as'],'attributes':_0x1b3381[_0x5e03('0x1f')],'include':_0x1b3381[_0x5e03('0x22')]?_[_0x5e03('0x21')](_0x1b3381['include'],function(_0x991e30){return{'model':db[_0x991e30[_0x5e03('0x23')]],'as':_0x991e30['as'],'attributes':_0x991e30[_0x5e03('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c8eac){logger['info'](_0x5e03('0x1a'),_0x323c03);logger[_0x5e03('0x14')](_0x5e03('0x1a'),_0x323c03,JSON['stringify'](_0x4c8eac));_0x77fc23(_0x4c8eac);})['catch'](function(_0x3a9e3d){logger[_0x5e03('0x15')](_0x5e03('0x1a'),_0x3a9e3d[_0x5e03('0x17')],_0x323c03);_0x4b6733(_0x322d56[_0x5e03('0x15')](0x1f4,_0x3a9e3d[_0x5e03('0x17')]));});});};exports[_0x5e03('0x24')]=function(_0xf6403){var _0x11a504=this;return new Promise(function(_0x207a61,_0x19528d){return db[_0x5e03('0x1b')][_0x5e03('0x25')](_0xf6403[_0x5e03('0x26')],{'raw':_0xf6403['options']?_0xf6403[_0x5e03('0x1d')][_0x5e03('0x27')]===undefined?!![]:![]:!![]})[_0x5e03('0x11')](function(_0x50139c){logger[_0x5e03('0x12')](_0x5e03('0x24'),_0xf6403);logger[_0x5e03('0x14')](_0x5e03('0x24'),_0xf6403,JSON[_0x5e03('0x28')](_0x50139c));_0x207a61(_0x50139c);})[_0x5e03('0x19')](function(_0x50d7fa){logger[_0x5e03('0x15')](_0x5e03('0x24'),_0x50d7fa['message'],_0xf6403);_0x19528d(_0x11a504[_0x5e03('0x15')](0x1f4,_0x50d7fa['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x24cc56){var _0x30723a=this;return new Promise(function(_0x4176ec,_0x36d881){return db[_0x5e03('0x1b')][_0x5e03('0x29')](_0x24cc56[_0x5e03('0x26')],{'raw':_0x24cc56[_0x5e03('0x1d')]?_0x24cc56[_0x5e03('0x1d')][_0x5e03('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24cc56[_0x5e03('0x1d')]?_0x24cc56[_0x5e03('0x1d')][_0x5e03('0x1e')]||null:null,'attributes':_0x24cc56[_0x5e03('0x1d')]?_0x24cc56[_0x5e03('0x1d')]['attributes']||null:null,'limit':_0x24cc56[_0x5e03('0x1d')]?_0x24cc56[_0x5e03('0x1d')][_0x5e03('0x20')]||null:null})[_0x5e03('0x11')](function(_0x550079){logger[_0x5e03('0x12')](_0x5e03('0x2a'),_0x24cc56);logger[_0x5e03('0x14')](_0x5e03('0x2a'),_0x24cc56,JSON['stringify'](_0x550079));_0x4176ec(_0x550079);})['catch'](function(_0x1e1107){logger['error'](_0x5e03('0x2a'),_0x1e1107[_0x5e03('0x17')],_0x24cc56);_0x36d881(_0x30723a[_0x5e03('0x15')](0x1f4,_0x1e1107[_0x5e03('0x17')]));});});}; \ No newline at end of file +var _0xcd63=['info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','GetVoiceQueueReport','stringify','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','register','request','then'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xcd63,0xf7));var _0x3cd6=function(_0x441bc5,_0x296131){_0x441bc5=_0x441bc5-0x0;var _0x3e1f5f=_0xcd63[_0x441bc5];return _0x3e1f5f;};'use strict';var _=require(_0x3cd6('0x0'));var util=require(_0x3cd6('0x1'));var moment=require('moment');var BPromise=require(_0x3cd6('0x2'));var rs=require(_0x3cd6('0x3'));var fs=require('fs');var Redis=require(_0x3cd6('0x4'));var db=require(_0x3cd6('0x5'))['db'];var utils=require(_0x3cd6('0x6'));var logger=require(_0x3cd6('0x7'))(_0x3cd6('0x8'));var config=require(_0x3cd6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3cd6('0xa')]['http']({'port':0x232a});config[_0x3cd6('0xb')]=_[_0x3cd6('0xc')](config['redis'],{'host':_0x3cd6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3cd6('0xb')]));require('./voiceQueueReport.socket')[_0x3cd6('0xe')](socket);function respondWithRpcPromise(_0x1f2f8b,_0x4dca26,_0x16f752){return new BPromise(function(_0x58a262,_0x16294f){return client[_0x3cd6('0xf')](_0x1f2f8b,_0x16f752)[_0x3cd6('0x10')](function(_0x4eb582){logger[_0x3cd6('0x11')](_0x3cd6('0x12'),_0x4dca26,'request\x20sent');logger[_0x3cd6('0x13')](_0x3cd6('0x14'),_0x4dca26,'request\x20sent',JSON['stringify'](_0x4eb582));if(_0x4eb582[_0x3cd6('0x15')]){if(_0x4eb582[_0x3cd6('0x15')][_0x3cd6('0x16')]===0x1f4){logger[_0x3cd6('0x15')](_0x3cd6('0x12'),_0x4dca26,_0x4eb582[_0x3cd6('0x15')]['message']);return _0x16294f(_0x4eb582[_0x3cd6('0x15')]['message']);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x4dca26,_0x4eb582[_0x3cd6('0x15')][_0x3cd6('0x17')]);return _0x58a262(_0x4eb582['error'][_0x3cd6('0x17')]);}else{logger[_0x3cd6('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x4dca26,_0x3cd6('0x18'));_0x58a262(_0x4eb582[_0x3cd6('0x19')][_0x3cd6('0x17')]);}})['catch'](function(_0x191707){logger[_0x3cd6('0x15')](_0x3cd6('0x12'),_0x4dca26,_0x191707);_0x16294f(_0x191707);});});}exports['GetVoiceQueueReport']=function(_0x4db697){var _0x287663=this;return new Promise(function(_0x213be6,_0x14a33b){return db[_0x3cd6('0x1a')][_0x3cd6('0x1b')]({'raw':_0x4db697[_0x3cd6('0x1c')]?_0x4db697[_0x3cd6('0x1c')][_0x3cd6('0x1d')]===undefined?!![]:![]:!![],'where':_0x4db697[_0x3cd6('0x1c')]?_0x4db697[_0x3cd6('0x1c')]['where']||null:null,'attributes':_0x4db697['options']?_0x4db697[_0x3cd6('0x1c')][_0x3cd6('0x1e')]||null:null,'limit':_0x4db697[_0x3cd6('0x1c')]?_0x4db697[_0x3cd6('0x1c')][_0x3cd6('0x1f')]||null:null,'include':_0x4db697[_0x3cd6('0x1c')]?_0x4db697['options'][_0x3cd6('0x20')]?_[_0x3cd6('0x21')](_0x4db697['options'][_0x3cd6('0x20')],function(_0x2bae2f){return{'model':db[_0x2bae2f[_0x3cd6('0x22')]],'as':_0x2bae2f['as'],'attributes':_0x2bae2f[_0x3cd6('0x1e')],'include':_0x2bae2f[_0x3cd6('0x20')]?_[_0x3cd6('0x21')](_0x2bae2f[_0x3cd6('0x20')],function(_0x3c7aa2){return{'model':db[_0x3c7aa2['model']],'as':_0x3c7aa2['as'],'attributes':_0x3c7aa2['attributes'],'include':_0x3c7aa2[_0x3cd6('0x20')]?_[_0x3cd6('0x21')](_0x3c7aa2[_0x3cd6('0x20')],function(_0x4198dd){return{'model':db[_0x4198dd['model']],'as':_0x4198dd['as'],'attributes':_0x4198dd[_0x3cd6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3cd6('0x10')](function(_0x510bae){logger[_0x3cd6('0x11')](_0x3cd6('0x23'),_0x4db697);logger['debug'](_0x3cd6('0x23'),_0x4db697,JSON[_0x3cd6('0x24')](_0x510bae));_0x213be6(_0x510bae);})[_0x3cd6('0x25')](function(_0x9c8a25){logger[_0x3cd6('0x15')](_0x3cd6('0x23'),_0x9c8a25[_0x3cd6('0x17')],_0x4db697);_0x14a33b(_0x287663[_0x3cd6('0x15')](0x1f4,_0x9c8a25[_0x3cd6('0x17')]));});});};exports[_0x3cd6('0x26')]=function(_0x1b2513){var _0x3d00f7=this;return new Promise(function(_0x23c6dc,_0x1c9f0d){return db['VoiceQueueReport'][_0x3cd6('0x27')](_0x1b2513[_0x3cd6('0x28')],{'raw':_0x1b2513[_0x3cd6('0x1c')]?_0x1b2513[_0x3cd6('0x1c')][_0x3cd6('0x1d')]===undefined?!![]:![]:!![]})[_0x3cd6('0x10')](function(_0x2b2e20){logger[_0x3cd6('0x11')](_0x3cd6('0x26'),_0x1b2513);logger['debug'](_0x3cd6('0x26'),_0x1b2513,JSON[_0x3cd6('0x24')](_0x2b2e20));_0x23c6dc(_0x2b2e20);})['catch'](function(_0x4d07bf){logger[_0x3cd6('0x15')]('CreateVoiceQueueReport',_0x4d07bf['message'],_0x1b2513);_0x1c9f0d(_0x3d00f7[_0x3cd6('0x15')](0x1f4,_0x4d07bf[_0x3cd6('0x17')]));});});};exports[_0x3cd6('0x29')]=function(_0xabbe28){var _0x2a993e=this;return new Promise(function(_0x2a30bf,_0xa87170){return db[_0x3cd6('0x1a')][_0x3cd6('0x2a')](_0xabbe28[_0x3cd6('0x28')],{'raw':_0xabbe28[_0x3cd6('0x1c')]?_0xabbe28[_0x3cd6('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xabbe28[_0x3cd6('0x1c')]?_0xabbe28[_0x3cd6('0x1c')][_0x3cd6('0x2b')]||null:null,'attributes':_0xabbe28[_0x3cd6('0x1c')]?_0xabbe28[_0x3cd6('0x1c')][_0x3cd6('0x1e')]||null:null,'limit':_0xabbe28[_0x3cd6('0x1c')]?_0xabbe28[_0x3cd6('0x1c')]['limit']||null:null})[_0x3cd6('0x10')](function(_0x4b5fee){logger[_0x3cd6('0x11')](_0x3cd6('0x29'),_0xabbe28);logger[_0x3cd6('0x13')](_0x3cd6('0x29'),_0xabbe28,JSON[_0x3cd6('0x24')](_0x4b5fee));_0x2a30bf(_0x4b5fee);})[_0x3cd6('0x25')](function(_0x5448c7){logger[_0x3cd6('0x15')]('UpdateVoiceQueueReport',_0x5448c7['message'],_0xabbe28);_0xa87170(_0x2a993e[_0x3cd6('0x15')](0x1f4,_0x5448c7[_0x3cd6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 534c6a9..45d467b 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 _0x8b52=['length','./voiceQueueReport.events','save','remove','emit','removeListener','register'];(function(_0x2af663,_0x511eef){var _0x8468dc=function(_0x482579){while(--_0x482579){_0x2af663['push'](_0x2af663['shift']());}};_0x8468dc(++_0x511eef);}(_0x8b52,0x151));var _0x28b5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8b52[_0x167cc1];return _0x10bc4b;};'use strict';var VoiceQueueReportEvents=require(_0x28b5('0x0'));var events=[_0x28b5('0x1'),_0x28b5('0x2'),'update'];function createListener(_0x41ff44,_0x122510){return function(_0x5de956){_0x122510[_0x28b5('0x3')](_0x41ff44,_0x5de956);};}function removeListener(_0x3d0e93,_0x3a762e){return function(){VoiceQueueReportEvents[_0x28b5('0x4')](_0x3d0e93,_0x3a762e);};}exports[_0x28b5('0x5')]=function(_0x17c21a){for(var _0x42573d=0x0,_0xca79de=events[_0x28b5('0x6')];_0x42573d<_0xca79de;_0x42573d++){var _0x4a136e=events[_0x42573d];var _0x1fc3a0=createListener('voiceQueueReport:'+_0x4a136e,_0x17c21a);VoiceQueueReportEvents['on'](_0x4a136e,_0x1fc3a0);}}; \ No newline at end of file +var _0x7996=['save','remove','update','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0x7996,0xc7));var _0x6799=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0x7996[_0x4f8f3b];return _0x4c250c;};'use strict';var VoiceQueueReportEvents=require(_0x6799('0x0'));var events=[_0x6799('0x1'),_0x6799('0x2'),_0x6799('0x3')];function createListener(_0x5dc879,_0x481127){return function(_0x1c873d){_0x481127['emit'](_0x5dc879,_0x1c873d);};}function removeListener(_0x5b4a21,_0x3729b8){return function(){VoiceQueueReportEvents[_0x6799('0x4')](_0x5b4a21,_0x3729b8);};}exports[_0x6799('0x5')]=function(_0x151c32){for(var _0x4ebd8f=0x0,_0xa348ba=events[_0x6799('0x6')];_0x4ebd8f<_0xa348ba;_0x4ebd8f++){var _0x4cb33e=events[_0x4ebd8f];var _0x481139=createListener(_0x6799('0x7')+_0x4cb33e,_0x151c32);VoiceQueueReportEvents['on'](_0x4cb33e,_0x481139);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 891e1dd..ebeeb2d 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 _0x3b74=['../../config/environment','get','isAuthenticated','index','/:id','create','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x3b74,0x80));var _0x43b7=function(_0x13b8b1,_0x42882a){_0x13b8b1=_0x13b8b1-0x0;var _0x467f68=_0x3b74[_0x13b8b1];return _0x467f68;};'use strict';var multer=require(_0x43b7('0x0'));var util=require(_0x43b7('0x1'));var path=require(_0x43b7('0x2'));var timeout=require(_0x43b7('0x3'));var express=require('express');var router=express[_0x43b7('0x4')]();var auth=require(_0x43b7('0x5'));var interaction=require(_0x43b7('0x6'));var config=require(_0x43b7('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x43b7('0x8')]('/',auth[_0x43b7('0x9')](),controller[_0x43b7('0xa')]);router[_0x43b7('0x8')](_0x43b7('0xb'),auth[_0x43b7('0x9')](),controller['show']);router['post']('/',auth[_0x43b7('0x9')](),controller[_0x43b7('0xc')]);router['put'](_0x43b7('0xb'),auth[_0x43b7('0x9')](),controller['update']);router[_0x43b7('0xd')]('/:id',auth[_0x43b7('0x9')](),controller[_0x43b7('0xe')]);module['exports']=router; \ No newline at end of file +var _0xba0d=['connect-timeout','express','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','path'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0xba0d,0x8e));var _0xdba0=function(_0x28dd29,_0x45754e){_0x28dd29=_0x28dd29-0x0;var _0x13ce65=_0xba0d[_0x28dd29];return _0x13ce65;};'use strict';var multer=require(_0xdba0('0x0'));var util=require('util');var path=require(_0xdba0('0x1'));var timeout=require(_0xdba0('0x2'));var express=require(_0xdba0('0x3'));var router=express['Router']();var auth=require(_0xdba0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdba0('0x5'));var controller=require(_0xdba0('0x6'));router[_0xdba0('0x7')]('/',auth[_0xdba0('0x8')](),controller['index']);router['get'](_0xdba0('0x9'),auth[_0xdba0('0x8')](),controller[_0xdba0('0xa')]);router[_0xdba0('0xb')]('/',auth['isAuthenticated'](),controller[_0xdba0('0xc')]);router['put']('/:id',auth[_0xdba0('0x8')](),controller['update']);router[_0xdba0('0xd')]('/:id',auth[_0xdba0('0x8')](),controller[_0xdba0('0xe')]);module[_0xdba0('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 7b874c8..1854af6 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 _0x207c=['STRING','DATE','format','moment','exports'];(function(_0x1f89a8,_0x14ba84){var _0x1ace95=function(_0x460ba8){while(--_0x460ba8){_0x1f89a8['push'](_0x1f89a8['shift']());}};_0x1ace95(++_0x14ba84);}(_0x207c,0x1e8));var _0xc207=function(_0x1a61c1,_0x2f064d){_0x1a61c1=_0x1a61c1-0x0;var _0x2240bf=_0x207c[_0x1a61c1];return _0x2240bf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc207('0x0'));module[_0xc207('0x1')]={'time':{'type':Sequelize[_0xc207('0x2')]},'callid':{'type':Sequelize[_0xc207('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc207('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc207('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc207('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc207('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc207('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc207('0x3')],'allowNull':![],'defaultValue':moment()[_0xc207('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x17ba=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING'];(function(_0x10b10f,_0x2bef95){var _0x3004d6=function(_0x2f34f3){while(--_0x2f34f3){_0x10b10f['push'](_0x10b10f['shift']());}};_0x3004d6(++_0x2bef95);}(_0x17ba,0xab));var _0xa17b=function(_0x268835,_0x275f8e){_0x268835=_0x268835-0x0;var _0x3abf38=_0x17ba[_0x268835];return _0x3abf38;};'use strict';var Sequelize=require(_0xa17b('0x0'));var moment=require(_0xa17b('0x1'));module['exports']={'time':{'type':Sequelize[_0xa17b('0x2')]},'callid':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa17b('0x3')],'allowNull':![],'defaultValue':moment()[_0xa17b('0x4')](_0xa17b('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 946b2e7..fc4a938 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 _0x86f0=['length','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/environment','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','add','day','filter','map','merge','options','includeAll','include','findAll','rows','show'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x86f0,0x121));var _0x086f=function(_0x5b6bb8,_0x16bd8a){_0x5b6bb8=_0x5b6bb8-0x0;var _0x161752=_0x86f0[_0x5b6bb8];return _0x161752;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x086f('0x0'));var rimraf=require(_0x086f('0x1'));var zipdir=require(_0x086f('0x2'));var jsonpatch=require(_0x086f('0x3'));var rp=require('request-promise');var moment=require(_0x086f('0x4'));var BPromise=require(_0x086f('0x5'));var Mustache=require(_0x086f('0x6'));var util=require(_0x086f('0x7'));var path=require(_0x086f('0x8'));var sox=require(_0x086f('0x9'));var csv=require('to-csv');var ejs=require(_0x086f('0xa'));var fs=require('fs');var _=require(_0x086f('0xb'));var squel=require(_0x086f('0xc'));var crypto=require(_0x086f('0xd'));var jsforce=require(_0x086f('0xe'));var deskjs=require(_0x086f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x086f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x086f('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x086f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f02ff,_0x4edb1d){_0x4edb1d=_0x4edb1d||0xcc;return function(_0x316125){if(_0x316125){return _0x4f02ff['sendStatus'](_0x4edb1d);}return _0x4f02ff[_0x086f('0x13')](_0x4edb1d)['end']();};}function respondWithResult(_0x4f7529,_0x56c9df){_0x56c9df=_0x56c9df||0xc8;return function(_0x7d0e35){if(_0x7d0e35){return _0x4f7529['status'](_0x56c9df)[_0x086f('0x14')](_0x7d0e35);}};}function respondWithFilteredResult(_0x2dae95,_0x13cfb0){return function(_0x4d64af){if(_0x4d64af){var _0x208a6c=_0x4d64af[_0x086f('0x15')],_0x34f75a=_0x13cfb0['offset'],_0x61ba24=_0x13cfb0['offset']+_0x13cfb0[_0x086f('0x16')],_0x1163a6;if(_0x61ba24>=_0x208a6c){_0x61ba24=_0x208a6c;_0x1163a6=0xc8;}else{_0x1163a6=0xce;}_0x2dae95[_0x086f('0x13')](_0x1163a6);return _0x2dae95[_0x086f('0x17')](_0x086f('0x18'),_0x34f75a+'-'+_0x61ba24+'/'+_0x208a6c)[_0x086f('0x14')](_0x4d64af);}return null;};}function patchUpdates(_0xcc4498){return function(_0x2bb9e0){try{jsonpatch[_0x086f('0x19')](_0x2bb9e0,_0xcc4498,!![]);}catch(_0x2f3a4d){return BPromise[_0x086f('0x1a')](_0x2f3a4d);}return _0x2bb9e0[_0x086f('0x1b')]();};}function saveUpdates(_0x5c6665,_0x14cfa6){return function(_0x571588){if(_0x571588){return _0x571588[_0x086f('0x1c')](_0x5c6665)[_0x086f('0x1d')](function(_0x2f2aac){return _0x2f2aac;});}return null;};}function removeEntity(_0x3fdaeb,_0x55baf6){return function(_0x4fd8f8){if(_0x4fd8f8){return _0x4fd8f8[_0x086f('0x1e')]()['then'](function(){_0x3fdaeb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31e3c3,_0x483a95){return function(_0x5668f0){if(!_0x5668f0){_0x31e3c3[_0x086f('0x1f')](0x194);}return _0x5668f0;};}function handleError(_0x385f1a,_0x15ad99){_0x15ad99=_0x15ad99||0x1f4;return function(_0x59b2be){logger[_0x086f('0x20')](_0x59b2be[_0x086f('0x21')]);if(_0x59b2be[_0x086f('0x22')]){delete _0x59b2be[_0x086f('0x22')];}_0x385f1a[_0x086f('0x13')](_0x15ad99)[_0x086f('0x23')](_0x59b2be);};}exports[_0x086f('0x24')]=function(_0x2e43b2,_0x5bc3c2){var _0x1e0181={},_0x85b85b={},_0x204c11={'count':0x0,'rows':[]};var _0xf7e845=db[_0x086f('0x25')][_0x086f('0x26')];_0x85b85b[_0x086f('0x27')]=_[_0x086f('0x28')](_0xf7e845);var _0x1bc5ec={'dateStart':_0x2e43b2[_0x086f('0x29')][_0x086f('0x2a')],'dateEnd':_0x2e43b2['query'][_0x086f('0x2b')]};delete _0x2e43b2[_0x086f('0x29')][_0x086f('0x2a')];delete _0x2e43b2[_0x086f('0x29')][_0x086f('0x2b')];_0x85b85b[_0x086f('0x29')]=_[_0x086f('0x28')](_0x2e43b2['query']);_0x85b85b[_0x086f('0x2c')]=_[_0x086f('0x2d')](_0x85b85b[_0x086f('0x27')],_0x85b85b[_0x086f('0x29')]);_0x1e0181[_0x086f('0x2e')]=_[_0x086f('0x2d')](_0x85b85b['model'],qs[_0x086f('0x2f')](_0x2e43b2[_0x086f('0x29')]['fields']));_0x1e0181['attributes']=_0x1e0181[_0x086f('0x2e')]['length']?_0x1e0181[_0x086f('0x2e')]:_0x85b85b[_0x086f('0x27')];if(!_0x2e43b2[_0x086f('0x29')][_0x086f('0x30')](_0x086f('0x31'))){_0x1e0181[_0x086f('0x16')]=qs[_0x086f('0x16')](_0x2e43b2['query']['limit']);_0x1e0181[_0x086f('0x32')]=qs[_0x086f('0x32')](_0x2e43b2[_0x086f('0x29')]['offset']);}_0x1e0181[_0x086f('0x33')]=qs[_0x086f('0x34')](_0x2e43b2[_0x086f('0x29')][_0x086f('0x34')]);_0x1e0181[_0x086f('0x35')]=qs['filters'](_[_0x086f('0x36')](_0x2e43b2[_0x086f('0x29')],_0x85b85b[_0x086f('0x2c')]));if(_0x1bc5ec[_0x086f('0x2a')]){if(_0x1bc5ec[_0x086f('0x2b')]){_0x1bc5ec[_0x086f('0x2b')]=moment(_0x1bc5ec[_0x086f('0x2b')])[_0x086f('0x37')](0x1,_0x086f('0x38'));}else{_0x1bc5ec[_0x086f('0x2b')]=moment(_0x1bc5ec[_0x086f('0x2a')])['add'](0x1,_0x086f('0x38'));}_['merge'](_0x1e0181['where'],{'createdAt':{'$gte':_0x1bc5ec[_0x086f('0x2a')],'$lte':_0x1bc5ec[_0x086f('0x2b')]}});}if(_0x2e43b2['query'][_0x086f('0x39')]){_0x1e0181['where']=_['merge'](_0x1e0181[_0x086f('0x35')],{'$or':_[_0x086f('0x3a')](_0x1e0181[_0x086f('0x2e')],function(_0x1e2735){var _0x7efaab={};_0x7efaab[_0x1e2735]={'$like':'%'+_0x2e43b2['query'][_0x086f('0x39')]+'%'};return _0x7efaab;})});}_0x1e0181=_[_0x086f('0x3b')]({},_0x1e0181,_0x2e43b2[_0x086f('0x3c')]);var _0x5001b8={'where':_0x1e0181['where']};return db[_0x086f('0x25')][_0x086f('0x15')](_0x5001b8)[_0x086f('0x1d')](function(_0x5afce5){_0x204c11[_0x086f('0x15')]=_0x5afce5;if(_0x2e43b2[_0x086f('0x29')][_0x086f('0x3d')]){_0x1e0181[_0x086f('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x086f('0x3f')](_0x1e0181);})['then'](function(_0x15a2dd){_0x204c11[_0x086f('0x40')]=_0x15a2dd;return _0x204c11;})['then'](respondWithFilteredResult(_0x5bc3c2,_0x1e0181))['catch'](handleError(_0x5bc3c2,null));};exports[_0x086f('0x41')]=function(_0xbfb439,_0x2d145a){var _0x1dbe60={'raw':!![],'where':{'id':_0xbfb439['params']['id']}},_0x5fca97={};_0x5fca97['model']=_[_0x086f('0x28')](db[_0x086f('0x25')][_0x086f('0x26')]);_0x5fca97['query']=_[_0x086f('0x28')](_0xbfb439['query']);_0x5fca97[_0x086f('0x2c')]=_[_0x086f('0x2d')](_0x5fca97['model'],_0x5fca97[_0x086f('0x29')]);_0x1dbe60[_0x086f('0x2e')]=_[_0x086f('0x2d')](_0x5fca97[_0x086f('0x27')],qs[_0x086f('0x2f')](_0xbfb439['query']['fields']));_0x1dbe60[_0x086f('0x2e')]=_0x1dbe60[_0x086f('0x2e')][_0x086f('0x42')]?_0x1dbe60[_0x086f('0x2e')]:_0x5fca97['model'];if(_0xbfb439[_0x086f('0x29')][_0x086f('0x3d')]){_0x1dbe60[_0x086f('0x3e')]=[{'all':!![]}];}_0x1dbe60=_['merge']({},_0x1dbe60,_0xbfb439[_0x086f('0x3c')]);return db[_0x086f('0x25')]['find'](_0x1dbe60)[_0x086f('0x1d')](handleEntityNotFound(_0x2d145a,null))[_0x086f('0x1d')](respondWithResult(_0x2d145a,null))[_0x086f('0x43')](handleError(_0x2d145a,null));};exports[_0x086f('0x44')]=function(_0x57f332,_0xa821d6){return db[_0x086f('0x25')][_0x086f('0x44')](_0x57f332['body'],{})[_0x086f('0x1d')](respondWithResult(_0xa821d6,0xc9))[_0x086f('0x43')](handleError(_0xa821d6,null));};exports['update']=function(_0x1fe95b,_0x2e594e){if(_0x1fe95b[_0x086f('0x45')]['id']){delete _0x1fe95b['body']['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x1fe95b['params']['id']}})['then'](handleEntityNotFound(_0x2e594e,null))[_0x086f('0x1d')](saveUpdates(_0x1fe95b[_0x086f('0x45')],null))['then'](respondWithResult(_0x2e594e,null))[_0x086f('0x43')](handleError(_0x2e594e,null));};exports[_0x086f('0x1e')]=function(_0x2ead79,_0x53e107){return db['VoiceQueuesLog']['find']({'where':{'id':_0x2ead79[_0x086f('0x46')]['id']}})[_0x086f('0x1d')](handleEntityNotFound(_0x53e107,null))[_0x086f('0x1d')](removeEntity(_0x53e107,null))[_0x086f('0x43')](handleError(_0x53e107,null));}; \ No newline at end of file +var _0x4ffe=['includeAll','findAll','rows','catch','show','params','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','options'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x4ffe,0x172));var _0xe4ff=function(_0x45ce90,_0x114609){_0x45ce90=_0x45ce90-0x0;var _0x313c45=_0x4ffe[_0x45ce90];return _0x313c45;};'use strict';var pdf=require(_0xe4ff('0x0'));var emlformat=require(_0xe4ff('0x1'));var rimraf=require(_0xe4ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4ff('0x3'));var rp=require(_0xe4ff('0x4'));var moment=require(_0xe4ff('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe4ff('0x6'));var util=require(_0xe4ff('0x7'));var path=require(_0xe4ff('0x8'));var sox=require(_0xe4ff('0x9'));var csv=require(_0xe4ff('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe4ff('0xb'));var squel=require(_0xe4ff('0xc'));var crypto=require(_0xe4ff('0xd'));var jsforce=require(_0xe4ff('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe4ff('0xa'));var querystring=require('querystring');var Papa=require(_0xe4ff('0xf'));var Redis=require(_0xe4ff('0x10'));var qs=require(_0xe4ff('0x11'));var logger=require(_0xe4ff('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe4ff('0x13'));var db=require(_0xe4ff('0x14'))['db'];function respondWithStatusCode(_0x2f1861,_0x43b6b1){_0x43b6b1=_0x43b6b1||0xcc;return function(_0x3437fc){if(_0x3437fc){return _0x2f1861[_0xe4ff('0x15')](_0x43b6b1);}return _0x2f1861['status'](_0x43b6b1)[_0xe4ff('0x16')]();};}function respondWithResult(_0x20c8c1,_0x4b5f3e){_0x4b5f3e=_0x4b5f3e||0xc8;return function(_0x17140c){if(_0x17140c){return _0x20c8c1['status'](_0x4b5f3e)[_0xe4ff('0x17')](_0x17140c);}};}function respondWithFilteredResult(_0x2d5182,_0x5702dc){return function(_0x3db2da){if(_0x3db2da){var _0x26133d=_0x3db2da[_0xe4ff('0x18')],_0x1d0664=_0x5702dc['offset'],_0x30db8f=_0x5702dc[_0xe4ff('0x19')]+_0x5702dc[_0xe4ff('0x1a')],_0x2b7212;if(_0x30db8f>=_0x26133d){_0x30db8f=_0x26133d;_0x2b7212=0xc8;}else{_0x2b7212=0xce;}_0x2d5182[_0xe4ff('0x1b')](_0x2b7212);return _0x2d5182[_0xe4ff('0x1c')]('Content-Range',_0x1d0664+'-'+_0x30db8f+'/'+_0x26133d)[_0xe4ff('0x17')](_0x3db2da);}return null;};}function patchUpdates(_0xa3429a){return function(_0x2f89d0){try{jsonpatch[_0xe4ff('0x1d')](_0x2f89d0,_0xa3429a,!![]);}catch(_0x54edef){return BPromise[_0xe4ff('0x1e')](_0x54edef);}return _0x2f89d0[_0xe4ff('0x1f')]();};}function saveUpdates(_0x44e11d,_0x1fa844){return function(_0xb195e9){if(_0xb195e9){return _0xb195e9['update'](_0x44e11d)[_0xe4ff('0x20')](function(_0xfa6146){return _0xfa6146;});}return null;};}function removeEntity(_0x296b99,_0x3a7511){return function(_0x16ab09){if(_0x16ab09){return _0x16ab09[_0xe4ff('0x21')]()['then'](function(){_0x296b99[_0xe4ff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a7f1,_0x2533d7){return function(_0x47d9c3){if(!_0x47d9c3){_0x44a7f1[_0xe4ff('0x15')](0x194);}return _0x47d9c3;};}function handleError(_0x5c9345,_0xf8e190){_0xf8e190=_0xf8e190||0x1f4;return function(_0xe728d1){logger[_0xe4ff('0x22')](_0xe728d1[_0xe4ff('0x23')]);if(_0xe728d1[_0xe4ff('0x24')]){delete _0xe728d1[_0xe4ff('0x24')];}_0x5c9345[_0xe4ff('0x1b')](_0xf8e190)[_0xe4ff('0x25')](_0xe728d1);};}exports[_0xe4ff('0x26')]=function(_0x46242d,_0x2d12fd){var _0x46844e={},_0x59b4b7={},_0x28e28a={'count':0x0,'rows':[]};var _0x768c03=db[_0xe4ff('0x27')][_0xe4ff('0x28')];_0x59b4b7[_0xe4ff('0x29')]=_[_0xe4ff('0x2a')](_0x768c03);var _0x49c9a3={'dateStart':_0x46242d[_0xe4ff('0x2b')][_0xe4ff('0x2c')],'dateEnd':_0x46242d[_0xe4ff('0x2b')]['dateEnd']};delete _0x46242d[_0xe4ff('0x2b')]['dateStart'];delete _0x46242d[_0xe4ff('0x2b')][_0xe4ff('0x2d')];_0x59b4b7['query']=_['keys'](_0x46242d[_0xe4ff('0x2b')]);_0x59b4b7[_0xe4ff('0x2e')]=_[_0xe4ff('0x2f')](_0x59b4b7[_0xe4ff('0x29')],_0x59b4b7[_0xe4ff('0x2b')]);_0x46844e[_0xe4ff('0x30')]=_[_0xe4ff('0x2f')](_0x59b4b7[_0xe4ff('0x29')],qs['fields'](_0x46242d[_0xe4ff('0x2b')][_0xe4ff('0x31')]));_0x46844e[_0xe4ff('0x30')]=_0x46844e[_0xe4ff('0x30')][_0xe4ff('0x32')]?_0x46844e['attributes']:_0x59b4b7['model'];if(!_0x46242d[_0xe4ff('0x2b')][_0xe4ff('0x33')](_0xe4ff('0x34'))){_0x46844e[_0xe4ff('0x1a')]=qs[_0xe4ff('0x1a')](_0x46242d['query'][_0xe4ff('0x1a')]);_0x46844e['offset']=qs[_0xe4ff('0x19')](_0x46242d['query'][_0xe4ff('0x19')]);}_0x46844e['order']=qs[_0xe4ff('0x35')](_0x46242d['query'][_0xe4ff('0x35')]);_0x46844e[_0xe4ff('0x36')]=qs[_0xe4ff('0x2e')](_[_0xe4ff('0x37')](_0x46242d['query'],_0x59b4b7[_0xe4ff('0x2e')]));if(_0x49c9a3['dateStart']){if(_0x49c9a3[_0xe4ff('0x2d')]){_0x49c9a3[_0xe4ff('0x2d')]=moment(_0x49c9a3[_0xe4ff('0x2d')])[_0xe4ff('0x38')](0x1,'day');}else{_0x49c9a3[_0xe4ff('0x2d')]=moment(_0x49c9a3[_0xe4ff('0x2c')])[_0xe4ff('0x38')](0x1,_0xe4ff('0x39'));}_[_0xe4ff('0x3a')](_0x46844e[_0xe4ff('0x36')],{'createdAt':{'$gte':_0x49c9a3[_0xe4ff('0x2c')],'$lte':_0x49c9a3[_0xe4ff('0x2d')]}});}if(_0x46242d[_0xe4ff('0x2b')][_0xe4ff('0x3b')]){_0x46844e['where']=_[_0xe4ff('0x3a')](_0x46844e[_0xe4ff('0x36')],{'$or':_[_0xe4ff('0x3c')](_0x46844e[_0xe4ff('0x30')],function(_0x459246){var _0x212c09={};_0x212c09[_0x459246]={'$like':'%'+_0x46242d[_0xe4ff('0x2b')][_0xe4ff('0x3b')]+'%'};return _0x212c09;})});}_0x46844e=_[_0xe4ff('0x3a')]({},_0x46844e,_0x46242d[_0xe4ff('0x3d')]);var _0x451dd4={'where':_0x46844e[_0xe4ff('0x36')]};return db[_0xe4ff('0x27')]['count'](_0x451dd4)['then'](function(_0x6d2e79){_0x28e28a['count']=_0x6d2e79;if(_0x46242d[_0xe4ff('0x2b')][_0xe4ff('0x3e')]){_0x46844e['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xe4ff('0x3f')](_0x46844e);})[_0xe4ff('0x20')](function(_0x2ea39d){_0x28e28a[_0xe4ff('0x40')]=_0x2ea39d;return _0x28e28a;})[_0xe4ff('0x20')](respondWithFilteredResult(_0x2d12fd,_0x46844e))[_0xe4ff('0x41')](handleError(_0x2d12fd,null));};exports[_0xe4ff('0x42')]=function(_0x520fcd,_0x1961f8){var _0x2b0997={'raw':!![],'where':{'id':_0x520fcd[_0xe4ff('0x43')]['id']}},_0x5b7d8f={};_0x5b7d8f[_0xe4ff('0x29')]=_['keys'](db[_0xe4ff('0x27')][_0xe4ff('0x28')]);_0x5b7d8f[_0xe4ff('0x2b')]=_[_0xe4ff('0x2a')](_0x520fcd[_0xe4ff('0x2b')]);_0x5b7d8f['filters']=_[_0xe4ff('0x2f')](_0x5b7d8f['model'],_0x5b7d8f[_0xe4ff('0x2b')]);_0x2b0997[_0xe4ff('0x30')]=_[_0xe4ff('0x2f')](_0x5b7d8f['model'],qs[_0xe4ff('0x31')](_0x520fcd[_0xe4ff('0x2b')][_0xe4ff('0x31')]));_0x2b0997['attributes']=_0x2b0997['attributes'][_0xe4ff('0x32')]?_0x2b0997['attributes']:_0x5b7d8f[_0xe4ff('0x29')];if(_0x520fcd[_0xe4ff('0x2b')][_0xe4ff('0x3e')]){_0x2b0997['include']=[{'all':!![]}];}_0x2b0997=_[_0xe4ff('0x3a')]({},_0x2b0997,_0x520fcd[_0xe4ff('0x3d')]);return db[_0xe4ff('0x27')][_0xe4ff('0x44')](_0x2b0997)[_0xe4ff('0x20')](handleEntityNotFound(_0x1961f8,null))[_0xe4ff('0x20')](respondWithResult(_0x1961f8,null))[_0xe4ff('0x41')](handleError(_0x1961f8,null));};exports[_0xe4ff('0x45')]=function(_0x340d6f,_0x588350){return db[_0xe4ff('0x27')][_0xe4ff('0x45')](_0x340d6f[_0xe4ff('0x46')],{})[_0xe4ff('0x20')](respondWithResult(_0x588350,0xc9))[_0xe4ff('0x41')](handleError(_0x588350,null));};exports[_0xe4ff('0x47')]=function(_0x27f34d,_0x4c1ca1){if(_0x27f34d[_0xe4ff('0x46')]['id']){delete _0x27f34d[_0xe4ff('0x46')]['id'];}return db[_0xe4ff('0x27')][_0xe4ff('0x44')]({'where':{'id':_0x27f34d[_0xe4ff('0x43')]['id']}})[_0xe4ff('0x20')](handleEntityNotFound(_0x4c1ca1,null))[_0xe4ff('0x20')](saveUpdates(_0x27f34d[_0xe4ff('0x46')],null))[_0xe4ff('0x20')](respondWithResult(_0x4c1ca1,null))['catch'](handleError(_0x4c1ca1,null));};exports[_0xe4ff('0x21')]=function(_0x596cba,_0x1c7a26){return db[_0xe4ff('0x27')]['find']({'where':{'id':_0x596cba[_0xe4ff('0x43')]['id']}})[_0xe4ff('0x20')](handleEntityNotFound(_0x1c7a26,null))[_0xe4ff('0x20')](removeEntity(_0x1c7a26,null))[_0xe4ff('0x41')](handleError(_0x1c7a26,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 2295954..bf0d863 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 _0x7f6c=['util','../../config/logger','api','moment','bluebird','./voiceQueuesLog.attributes','VoiceQueuesLog','event_dtm','event','dtm'];(function(_0x4189be,_0x14fda3){var _0x339705=function(_0x10af3d){while(--_0x10af3d){_0x4189be['push'](_0x4189be['shift']());}};_0x339705(++_0x14fda3);}(_0x7f6c,0x1b8));var _0xc7f6=function(_0x437b2a,_0x3bdf65){_0x437b2a=_0x437b2a-0x0;var _0xc22c10=_0x7f6c[_0x437b2a];return _0xc22c10;};'use strict';var _=require('lodash');var util=require(_0xc7f6('0x0'));var logger=require(_0xc7f6('0x1'))(_0xc7f6('0x2'));var moment=require(_0xc7f6('0x3'));var BPromise=require(_0xc7f6('0x4'));var rp=require('request-promise');var attributes=require(_0xc7f6('0x5'));module['exports']=function(_0x23673d,_0x1ae68c){return _0x23673d['define'](_0xc7f6('0x6'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xc7f6('0x7'),'fields':[_0xc7f6('0x8'),_0xc7f6('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x12b7=['moment','request-promise','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','dtm','lodash','util','../../config/logger','api'];(function(_0x2373f5,_0x293df4){var _0x4766fe=function(_0x5468e5){while(--_0x5468e5){_0x2373f5['push'](_0x2373f5['shift']());}};_0x4766fe(++_0x293df4);}(_0x12b7,0x194));var _0x712b=function(_0x5a9156,_0xb01a96){_0x5a9156=_0x5a9156-0x0;var _0x1f0cc7=_0x12b7[_0x5a9156];return _0x1f0cc7;};'use strict';var _=require(_0x712b('0x0'));var util=require(_0x712b('0x1'));var logger=require(_0x712b('0x2'))(_0x712b('0x3'));var moment=require(_0x712b('0x4'));var BPromise=require('bluebird');var rp=require(_0x712b('0x5'));var attributes=require(_0x712b('0x6'));module[_0x712b('0x7')]=function(_0x167685,_0x1baf94){return _0x167685[_0x712b('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x712b('0x9'),'paranoid':![],'indexes':[{'name':_0x712b('0xa'),'fields':['event',_0x712b('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index f1cccca..871ae75 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 _0xf29c=['info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0xbc4395,_0x5f2a9e){var _0x2e3361=function(_0x1e8fba){while(--_0x1e8fba){_0xbc4395['push'](_0xbc4395['shift']());}};_0x2e3361(++_0x5f2a9e);}(_0xf29c,0xf1));var _0xcf29=function(_0x52a310,_0x16b818){_0x52a310=_0x52a310-0x0;var _0x10bd1b=_0xf29c[_0x52a310];return _0x10bd1b;};'use strict';var _=require(_0xcf29('0x0'));var util=require(_0xcf29('0x1'));var moment=require(_0xcf29('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcf29('0x4'));var logger=require('../../config/logger')(_0xcf29('0x5'));var config=require(_0xcf29('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcf29('0x7')][_0xcf29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x517477,_0x329bd5,_0x1ef44e){return new BPromise(function(_0xa47b6a,_0x3c41a3){return client[_0xcf29('0x9')](_0x517477,_0x1ef44e)[_0xcf29('0xa')](function(_0x2f9108){logger[_0xcf29('0xb')](_0xcf29('0xc'),_0x329bd5,'request\x20sent');logger[_0xcf29('0xd')](_0xcf29('0xe'),_0x329bd5,'request\x20sent',JSON[_0xcf29('0xf')](_0x2f9108));if(_0x2f9108[_0xcf29('0x10')]){if(_0x2f9108['error'][_0xcf29('0x11')]===0x1f4){logger[_0xcf29('0x10')](_0xcf29('0xc'),_0x329bd5,_0x2f9108[_0xcf29('0x10')][_0xcf29('0x12')]);return _0x3c41a3(_0x2f9108['error']['message']);}logger[_0xcf29('0x10')](_0xcf29('0xc'),_0x329bd5,_0x2f9108[_0xcf29('0x10')][_0xcf29('0x12')]);return _0xa47b6a(_0x2f9108[_0xcf29('0x10')][_0xcf29('0x12')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x329bd5,'request\x20sent');_0xa47b6a(_0x2f9108[_0xcf29('0x13')]['message']);}})[_0xcf29('0x14')](function(_0x4164b6){logger[_0xcf29('0x10')](_0xcf29('0xc'),_0x329bd5,_0x4164b6);_0x3c41a3(_0x4164b6);});});} \ No newline at end of file +var _0xd935=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x22ff10,_0x16ea10){var _0x267619=function(_0x457ec4){while(--_0x457ec4){_0x22ff10['push'](_0x22ff10['shift']());}};_0x267619(++_0x16ea10);}(_0xd935,0xc6));var _0x5d93=function(_0x577026,_0x4a48ef){_0x577026=_0x577026-0x0;var _0x10477a=_0xd935[_0x577026];return _0x10477a;};'use strict';var _=require(_0x5d93('0x0'));var util=require(_0x5d93('0x1'));var moment=require(_0x5d93('0x2'));var BPromise=require(_0x5d93('0x3'));var rs=require(_0x5d93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d93('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d93('0x6'))(_0x5d93('0x7'));var config=require(_0x5d93('0x8'));var jayson=require(_0x5d93('0x9'));var client=jayson[_0x5d93('0xa')][_0x5d93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x252e8a,_0x7f35c2,_0x1dd9fc){return new BPromise(function(_0x1aa13c,_0x1f927b){return client['request'](_0x252e8a,_0x1dd9fc)[_0x5d93('0xc')](function(_0x4877f7){logger[_0x5d93('0xd')](_0x5d93('0xe'),_0x7f35c2,_0x5d93('0xf'));logger[_0x5d93('0x10')](_0x5d93('0x11'),_0x7f35c2,_0x5d93('0xf'),JSON[_0x5d93('0x12')](_0x4877f7));if(_0x4877f7[_0x5d93('0x13')]){if(_0x4877f7[_0x5d93('0x13')][_0x5d93('0x14')]===0x1f4){logger[_0x5d93('0x13')](_0x5d93('0xe'),_0x7f35c2,_0x4877f7[_0x5d93('0x13')]['message']);return _0x1f927b(_0x4877f7[_0x5d93('0x13')]['message']);}logger[_0x5d93('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x7f35c2,_0x4877f7[_0x5d93('0x13')][_0x5d93('0x15')]);return _0x1aa13c(_0x4877f7[_0x5d93('0x13')][_0x5d93('0x15')]);}else{logger[_0x5d93('0xd')](_0x5d93('0xe'),_0x7f35c2,_0x5d93('0xf'));_0x1aa13c(_0x4877f7[_0x5d93('0x16')]['message']);}})[_0x5d93('0x17')](function(_0x5b1700){logger[_0x5d93('0x13')](_0x5d93('0xe'),_0x7f35c2,_0x5b1700);_0x1f927b(_0x5b1700);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 9332a79..2d60692 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 _0x1ba2=['describe','/:id','show','download','/:id/downloads','downloads','post','create','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1323c7,_0x52db96){var _0x39c28c=function(_0x2762a3){while(--_0x2762a3){_0x1323c7['push'](_0x1323c7['shift']());}};_0x39c28c(++_0x52db96);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x21ba('0x0'));var util=require('util');var path=require(_0x21ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x21ba('0x2'));var router=express[_0x21ba('0x3')]();var auth=require(_0x21ba('0x4'));var interaction=require(_0x21ba('0x5'));var config=require(_0x21ba('0x6'));var controller=require('./voiceRecording.controller');router[_0x21ba('0x7')]('/',auth[_0x21ba('0x8')](),controller['index']);router[_0x21ba('0x7')]('/describe',auth[_0x21ba('0x8')](),controller[_0x21ba('0x9')]);router['get'](_0x21ba('0xa'),auth['isAuthenticated'](),controller[_0x21ba('0xb')]);router[_0x21ba('0x7')]('/:id/download',auth[_0x21ba('0x8')](),controller[_0x21ba('0xc')]);router[_0x21ba('0x7')](_0x21ba('0xd'),controller[_0x21ba('0xe')]);router[_0x21ba('0xf')]('/',auth[_0x21ba('0x8')](),controller[_0x21ba('0x10')]);router[_0x21ba('0x11')](_0x21ba('0xa'),auth[_0x21ba('0x8')](),controller[_0x21ba('0x12')]);router['delete']('/:id',auth[_0x21ba('0x8')](),controller[_0x21ba('0x13')]);module[_0x21ba('0x14')]=router; \ No newline at end of file +var _0x878f=['get','isAuthenticated','/describe','/:id/download','download','/:id/downloads','downloads','put','/:id','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller'];(function(_0x20e09a,_0x3d7508){var _0xa8cb7=function(_0x39b46e){while(--_0x39b46e){_0x20e09a['push'](_0x20e09a['shift']());}};_0xa8cb7(++_0x3d7508);}(_0x878f,0x173));var _0xf878=function(_0x2b640f,_0x4e53b7){_0x2b640f=_0x2b640f-0x0;var _0x38bd8b=_0x878f[_0x2b640f];return _0x38bd8b;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var auth=require(_0xf878('0x5'));var interaction=require(_0xf878('0x6'));var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth[_0xf878('0xa')](),controller['index']);router['get'](_0xf878('0xb'),auth[_0xf878('0xa')](),controller['describe']);router['get']('/:id',auth[_0xf878('0xa')](),controller['show']);router['get'](_0xf878('0xc'),auth[_0xf878('0xa')](),controller[_0xf878('0xd')]);router['get'](_0xf878('0xe'),controller[_0xf878('0xf')]);router['post']('/',auth[_0xf878('0xa')](),controller['create']);router[_0xf878('0x10')](_0xf878('0x11'),auth[_0xf878('0xa')](),controller['update']);router[_0xf878('0x12')](_0xf878('0x11'),auth[_0xf878('0xa')](),controller['destroy']);module[_0xf878('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 6c9a31a..b50978f 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 _0x3695=['moment','path','VIRTUAL','getDataValue','value','STRING','setDataValue','membername','split','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format','sequelize'];(function(_0x1a1228,_0x10d11b){var _0x1eb2e6=function(_0x245afe){while(--_0x245afe){_0x1a1228['push'](_0x1a1228['shift']());}};_0x1eb2e6(++_0x10d11b);}(_0x3695,0x19f));var _0x5369=function(_0x350480,_0x117329){_0x350480=_0x350480-0x0;var _0x37228d=_0x3695[_0x350480];return _0x37228d;};'use strict';var Sequelize=require(_0x5369('0x0'));var moment=require(_0x5369('0x1'));var path=require(_0x5369('0x2'));module['exports']={'format':{'type':Sequelize[_0x5369('0x3')],'get':function(){return this[_0x5369('0x4')](_0x5369('0x5'))?path['extname'](this[_0x5369('0x4')](_0x5369('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x5369('0x6')]},'channel':{'type':Sequelize[_0x5369('0x6')],'set':function(_0xb124d3){if(_0xb124d3){this[_0x5369('0x7')]('channel',_0xb124d3);this['setDataValue'](_0x5369('0x8'),_0xb124d3[_0x5369('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x5369('0x6')]},'calleridnum':{'type':Sequelize[_0x5369('0x6')]},'calleridname':{'type':Sequelize[_0x5369('0x6')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5369('0x6')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5369('0x6')]},'exten':{'type':Sequelize[_0x5369('0x6')]},'value':{'type':Sequelize[_0x5369('0x6')]},'type':{'type':Sequelize[_0x5369('0x6')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x5369('0x6')]},'userDisposition':{'type':Sequelize[_0x5369('0x6')]},'createdAt':{'type':Sequelize[_0x5369('0xa')],'get':function(){return moment(this['getDataValue'](_0x5369('0xb')))['format'](_0x5369('0xc'))[_0x5369('0xd')]();}},'updatedAt':{'type':Sequelize[_0x5369('0xa')],'get':function(){return moment(this['getDataValue'](_0x5369('0xe')))[_0x5369('0xf')](_0x5369('0xc'))['toString']();}}}; \ No newline at end of file +var _0xc093=['sequelize','moment','path','exports','VIRTUAL','getDataValue','value','setDataValue','membername','STRING','DATE','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','format','toString'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0xc093,0x1c0));var _0x3c09=function(_0x1fbeaf,_0x256fbd){_0x1fbeaf=_0x1fbeaf-0x0;var _0x13daa3=_0xc093[_0x1fbeaf];return _0x13daa3;};'use strict';var Sequelize=require(_0x3c09('0x0'));var moment=require(_0x3c09('0x1'));var path=require(_0x3c09('0x2'));module[_0x3c09('0x3')]={'format':{'type':Sequelize[_0x3c09('0x4')],'get':function(){return this[_0x3c09('0x5')](_0x3c09('0x6'))?path['extname'](this[_0x3c09('0x5')]('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING'],'set':function(_0x4e4cb8){if(_0x4e4cb8){this[_0x3c09('0x7')]('channel',_0x4e4cb8);this['setDataValue'](_0x3c09('0x8'),_0x4e4cb8['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x3c09('0x9')]},'calleridnum':{'type':Sequelize[_0x3c09('0x9')]},'calleridname':{'type':Sequelize[_0x3c09('0x9')]},'connectedlinenum':{'type':Sequelize[_0x3c09('0x9')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3c09('0x9')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x3c09('0x9')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x3c09('0x9')]},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize[_0x3c09('0xa')],'get':function(){return moment(this['getDataValue'](_0x3c09('0xb')))['format'](_0x3c09('0xc'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3c09('0x5')](_0x3c09('0xd')))[_0x3c09('0xe')](_0x3c09('0xc'))[_0x3c09('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index a82448e..e846213 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 _0x14a5=['query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','dateStart','dateEnd','add','day','merge','map','options','include','findAll','rows','catch','params','length','includeAll','find','create','body','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','unlink','downloads','sequelize','MD5','col','$and','push','extname','html-pdf','eml-format','zip-dir','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','VoiceRecording','rawAttributes','model','differenceBy','keys','format'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x14a5,0x13c));var _0x514a=function(_0x4332a7,_0x25be74){_0x4332a7=_0x4332a7-0x0;var _0x17bb3e=_0x14a5[_0x4332a7];return _0x17bb3e;};'use strict';var pdf=require(_0x514a('0x0'));var emlformat=require(_0x514a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x514a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x514a('0x3'));var util=require(_0x514a('0x4'));var path=require(_0x514a('0x5'));var sox=require(_0x514a('0x6'));var csv=require('to-csv');var ejs=require(_0x514a('0x7'));var fs=require('fs');var _=require(_0x514a('0x8'));var squel=require(_0x514a('0x9'));var crypto=require(_0x514a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x514a('0xb'));var querystring=require(_0x514a('0xc'));var Papa=require(_0x514a('0xd'));var Redis=require(_0x514a('0xe'));var qs=require(_0x514a('0xf'));var logger=require('../../config/logger')(_0x514a('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x514a('0x11'))['db'];function respondWithStatusCode(_0x15adef,_0x25acee){_0x25acee=_0x25acee||0xcc;return function(_0x1b1fa8){if(_0x1b1fa8){return _0x15adef[_0x514a('0x12')](_0x25acee);}return _0x15adef[_0x514a('0x13')](_0x25acee)[_0x514a('0x14')]();};}function respondWithResult(_0x66f298,_0x3e4abd){_0x3e4abd=_0x3e4abd||0xc8;return function(_0x34c437){if(_0x34c437){return _0x66f298[_0x514a('0x13')](_0x3e4abd)[_0x514a('0x15')](_0x34c437);}};}function respondWithFilteredResult(_0x1690e1,_0x4307dd){return function(_0x3329d2){if(_0x3329d2){var _0x50de51=_0x3329d2[_0x514a('0x16')],_0x4e0b67=_0x4307dd[_0x514a('0x17')],_0xd5c3cd=_0x4307dd['offset']+_0x4307dd[_0x514a('0x18')],_0x355c26;if(_0xd5c3cd>=_0x50de51){_0xd5c3cd=_0x50de51;_0x355c26=0xc8;}else{_0x355c26=0xce;}_0x1690e1[_0x514a('0x13')](_0x355c26);return _0x1690e1[_0x514a('0x19')](_0x514a('0x1a'),_0x4e0b67+'-'+_0xd5c3cd+'/'+_0x50de51)[_0x514a('0x15')](_0x3329d2);}return null;};}function patchUpdates(_0x449825){return function(_0x45b11a){try{jsonpatch[_0x514a('0x1b')](_0x45b11a,_0x449825,!![]);}catch(_0x4b35f0){return BPromise[_0x514a('0x1c')](_0x4b35f0);}return _0x45b11a[_0x514a('0x1d')]();};}function saveUpdates(_0x180c88,_0x59ec4c){return function(_0x139d0b){if(_0x139d0b){return _0x139d0b[_0x514a('0x1e')](_0x180c88)[_0x514a('0x1f')](function(_0x4bfb77){return _0x4bfb77;});}return null;};}function removeEntity(_0x129735,_0x1d752b){return function(_0xaa02fd){if(_0xaa02fd){return _0xaa02fd[_0x514a('0x20')]()[_0x514a('0x1f')](function(){_0x129735[_0x514a('0x13')](0xcc)[_0x514a('0x14')]();});}};}function handleEntityNotFound(_0x1d1f44,_0x642742){return function(_0xdf5bdc){if(!_0xdf5bdc){_0x1d1f44[_0x514a('0x12')](0x194);}return _0xdf5bdc;};}function handleError(_0x552163,_0x4329dd){_0x4329dd=_0x4329dd||0x1f4;return function(_0x5ecbc1){logger['error'](_0x5ecbc1['stack']);if(_0x5ecbc1[_0x514a('0x21')]){delete _0x5ecbc1['name'];}_0x552163[_0x514a('0x13')](_0x4329dd)['send'](_0x5ecbc1);};}exports['index']=function(_0x4712f9,_0x457b71){var _0x1f901e={},_0x11c1af={},_0x307a34={'count':0x0,'rows':[]};var _0x5f27b4=db[_0x514a('0x22')][_0x514a('0x23')];_0x11c1af[_0x514a('0x24')]=_[_0x514a('0x25')](_[_0x514a('0x26')](_0x5f27b4),[_0x514a('0x27')]);var _0xb0e58a={'dateStart':_0x4712f9[_0x514a('0x28')]['dateStart'],'dateEnd':_0x4712f9['query']['dateEnd']};delete _0x4712f9[_0x514a('0x28')]['dateStart'];delete _0x4712f9[_0x514a('0x28')]['dateEnd'];_0x11c1af[_0x514a('0x28')]=_[_0x514a('0x26')](_0x4712f9[_0x514a('0x28')]);_0x11c1af[_0x514a('0x29')]=_[_0x514a('0x2a')](_0x11c1af['model'],_0x11c1af[_0x514a('0x28')]);_0x1f901e['attributes']=_[_0x514a('0x2a')](_0x11c1af[_0x514a('0x24')],qs[_0x514a('0x2b')](_0x4712f9['query'][_0x514a('0x2b')]));_0x1f901e[_0x514a('0x2c')]=_0x1f901e[_0x514a('0x2c')]['length']?_0x1f901e[_0x514a('0x2c')]:_0x11c1af[_0x514a('0x24')];if(!_0x4712f9[_0x514a('0x28')][_0x514a('0x2d')](_0x514a('0x2e'))){_0x1f901e['limit']=qs['limit'](_0x4712f9[_0x514a('0x28')]['limit']);_0x1f901e[_0x514a('0x17')]=qs[_0x514a('0x17')](_0x4712f9[_0x514a('0x28')]['offset']);}_0x1f901e[_0x514a('0x2f')]=qs['sort'](_0x4712f9['query'][_0x514a('0x30')]);_0x1f901e[_0x514a('0x31')]=qs[_0x514a('0x29')](_['pick'](_0x4712f9[_0x514a('0x28')],_0x11c1af[_0x514a('0x29')]));if(_0xb0e58a[_0x514a('0x32')]){if(_0xb0e58a['dateEnd']){_0xb0e58a[_0x514a('0x33')]=moment(_0xb0e58a['dateEnd'])[_0x514a('0x34')](0x1,_0x514a('0x35'));}else{_0xb0e58a['dateEnd']=moment(_0xb0e58a[_0x514a('0x32')])['add'](0x1,_0x514a('0x35'));}_[_0x514a('0x36')](_0x1f901e[_0x514a('0x31')],{'createdAt':{'$gte':_0xb0e58a[_0x514a('0x32')],'$lte':_0xb0e58a[_0x514a('0x33')]}});}if(_0x4712f9[_0x514a('0x28')]['filter']){_0x1f901e[_0x514a('0x31')]=_[_0x514a('0x36')](_0x1f901e[_0x514a('0x31')],{'$or':_[_0x514a('0x37')](_0x1f901e[_0x514a('0x2c')],function(_0x5ab96d){var _0x2ab3b1={};_0x2ab3b1[_0x5ab96d]={'$like':'%'+_0x4712f9[_0x514a('0x28')]['filter']+'%'};return _0x2ab3b1;})});}_0x1f901e=_[_0x514a('0x36')]({},_0x1f901e,_0x4712f9[_0x514a('0x38')]);var _0x408e7b={'where':_0x1f901e[_0x514a('0x31')]};return db['VoiceRecording'][_0x514a('0x16')](_0x408e7b)[_0x514a('0x1f')](function(_0x4e6136){_0x307a34[_0x514a('0x16')]=_0x4e6136;if(_0x4712f9['query']['includeAll']){_0x1f901e[_0x514a('0x39')]=[{'all':!![]}];}return db[_0x514a('0x22')][_0x514a('0x3a')](_0x1f901e);})[_0x514a('0x1f')](function(_0x1aacb3){_0x307a34[_0x514a('0x3b')]=_0x1aacb3;return _0x307a34;})['then'](respondWithFilteredResult(_0x457b71,_0x1f901e))[_0x514a('0x3c')](handleError(_0x457b71,null));};exports['show']=function(_0x473e2a,_0x307557){var _0x2dc1f3={'raw':![],'where':{'id':_0x473e2a[_0x514a('0x3d')]['id']}},_0x1ff8ae={};_0x1ff8ae['model']=_[_0x514a('0x26')](db[_0x514a('0x22')][_0x514a('0x23')]);_0x1ff8ae[_0x514a('0x28')]=_['keys'](_0x473e2a[_0x514a('0x28')]);_0x1ff8ae[_0x514a('0x29')]=_[_0x514a('0x2a')](_0x1ff8ae[_0x514a('0x24')],_0x1ff8ae[_0x514a('0x28')]);_0x2dc1f3['attributes']=_[_0x514a('0x2a')](_0x1ff8ae[_0x514a('0x24')],qs[_0x514a('0x2b')](_0x473e2a[_0x514a('0x28')][_0x514a('0x2b')]));_0x2dc1f3[_0x514a('0x2c')]=_0x2dc1f3[_0x514a('0x2c')][_0x514a('0x3e')]?_0x2dc1f3[_0x514a('0x2c')]:_0x1ff8ae[_0x514a('0x24')];if(_0x473e2a[_0x514a('0x28')][_0x514a('0x3f')]){_0x2dc1f3['include']=[{'all':!![]}];}_0x2dc1f3=_[_0x514a('0x36')]({},_0x2dc1f3,_0x473e2a[_0x514a('0x38')]);return db[_0x514a('0x22')][_0x514a('0x40')](_0x2dc1f3)['then'](handleEntityNotFound(_0x307557,null))['then'](respondWithResult(_0x307557,null))[_0x514a('0x3c')](handleError(_0x307557,null));};exports[_0x514a('0x41')]=function(_0x3657cb,_0x47b5e3){return db[_0x514a('0x22')][_0x514a('0x41')](_0x3657cb[_0x514a('0x42')],{})['then'](respondWithResult(_0x47b5e3,0xc9))[_0x514a('0x3c')](handleError(_0x47b5e3,null));};exports[_0x514a('0x1e')]=function(_0x3a338d,_0x2d986d){if(_0x3a338d[_0x514a('0x42')]['id']){delete _0x3a338d[_0x514a('0x42')]['id'];}return db[_0x514a('0x22')][_0x514a('0x40')]({'where':{'id':_0x3a338d[_0x514a('0x3d')]['id']}})[_0x514a('0x1f')](handleEntityNotFound(_0x2d986d,null))[_0x514a('0x1f')](saveUpdates(_0x3a338d[_0x514a('0x42')],null))[_0x514a('0x1f')](respondWithResult(_0x2d986d,null))[_0x514a('0x3c')](handleError(_0x2d986d,null));};exports[_0x514a('0x20')]=function(_0x54a356,_0x53ae1b){return db[_0x514a('0x22')][_0x514a('0x40')]({'where':{'id':_0x54a356[_0x514a('0x3d')]['id']}})[_0x514a('0x1f')](handleEntityNotFound(_0x53ae1b,null))['then'](removeEntity(_0x53ae1b,null))[_0x514a('0x3c')](handleError(_0x53ae1b,null));};exports[_0x514a('0x43')]=function(_0x1c1721,_0x12187a){return db[_0x514a('0x22')][_0x514a('0x43')]()['then'](respondWithResult(_0x12187a,null))[_0x514a('0x3c')](handleError(_0x12187a,null));};exports[_0x514a('0x44')]=function(_0x1a79cd,_0x13e667,_0x1e2029){var _0x22d0d1=require(_0x514a('0x45'));var _0x5593a5=![];var _0x233d49={};if(_0x1a79cd[_0x514a('0x28')][_0x514a('0x46')]&&_0x1a79cd[_0x514a('0x28')]['type']===_0x514a('0x47')){_0x233d49['uniqueid']=_0x1a79cd[_0x514a('0x3d')]['id'];}else{_0x233d49['id']=_0x1a79cd[_0x514a('0x3d')]['id'];}return db[_0x514a('0x22')][_0x514a('0x40')]({'where':_0x233d49,'attributes':['id',_0x514a('0x48')],'raw':!![]})[_0x514a('0x1f')](handleEntityNotFound(_0x13e667,null))['then'](function(_0x58c938){if(_0x58c938){var _0x40985b=util[_0x514a('0x27')](_0x514a('0x49'),_0x58c938['value']);if(fs[_0x514a('0x4a')](_0x40985b)){_0x5593a5=!![];return _0x22d0d1[_0x514a('0x4b')](_0x40985b,_0x58c938[_0x514a('0x48')],config[_0x514a('0x4c')][_0x514a('0x4d')])[_0x514a('0x1f')](function(){return _0x58c938;});}return _0x58c938;}})[_0x514a('0x1f')](function(_0x456f8e){if(_0x456f8e){if(!fs[_0x514a('0x4a')](_0x456f8e[_0x514a('0x48')])){throw new db[(_0x514a('0x4e'))][(_0x514a('0x4f'))]('VoiceRecording\x20not\x20found');}if(_0x456f8e['filename']){return _0x13e667[_0x514a('0x44')](_0x456f8e[_0x514a('0x48')],_0x456f8e[_0x514a('0x50')]+path['extname'](_0x456f8e[_0x514a('0x48')]),function(){if(_0x5593a5){fs['unlink'](_0x456f8e['value']);}});}else{return _0x13e667[_0x514a('0x44')](_0x456f8e[_0x514a('0x48')],function(_0x12115d){if(_0x5593a5){fs[_0x514a('0x51')](_0x456f8e[_0x514a('0x48')]);}});}}})[_0x514a('0x3c')](handleError(_0x13e667,null));};exports[_0x514a('0x52')]=function(_0x51ac09,_0x5d1bad,_0x127abe){var _0x1f46b1=require(_0x514a('0x45'));var _0x25e9ec=![];var _0x4558f2={'$and':[db[_0x514a('0x53')][_0x514a('0x31')](db['sequelize']['fn'](_0x514a('0x54'),db[_0x514a('0x53')][_0x514a('0x55')](_0x514a('0x47'))),_0x51ac09['query']['token'])]};if(_0x51ac09[_0x514a('0x28')][_0x514a('0x46')]&&_0x51ac09['query'][_0x514a('0x46')]===_0x514a('0x47')){_0x4558f2[_0x514a('0x56')][_0x514a('0x57')]({'uniqueid':_0x51ac09['params']['id']});}else{_0x4558f2[_0x514a('0x56')]['push']({'id':_0x51ac09[_0x514a('0x3d')]['id']});}return db['VoiceRecording']['find']({'where':_0x4558f2,'attributes':['id',_0x514a('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x5d1bad,null))['then'](function(_0x336e00){if(_0x336e00){var _0x4558ff=util['format'](_0x514a('0x49'),_0x336e00['value']);if(fs[_0x514a('0x4a')](_0x4558ff)){_0x25e9ec=!![];return _0x1f46b1[_0x514a('0x4b')](_0x4558ff,_0x336e00[_0x514a('0x48')],config[_0x514a('0x4c')][_0x514a('0x4d')])[_0x514a('0x1f')](function(){return _0x336e00;});}return _0x336e00;}})[_0x514a('0x1f')](function(_0x4b8485){if(_0x4b8485){if(!fs[_0x514a('0x4a')](_0x4b8485['value'])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x4b8485['filename']){return _0x5d1bad[_0x514a('0x44')](_0x4b8485[_0x514a('0x48')],_0x4b8485[_0x514a('0x50')]+path[_0x514a('0x58')](_0x4b8485[_0x514a('0x48')]),function(){if(_0x25e9ec){fs[_0x514a('0x51')](_0x4b8485[_0x514a('0x48')]);}});}else{return _0x5d1bad['download'](_0x4b8485[_0x514a('0x48')],function(_0x3a20a8){if(_0x25e9ec){fs['unlink'](_0x4b8485['value']);}});}}})[_0x514a('0x3c')](handleError(_0x5d1bad,null));}; \ No newline at end of file +var _0x4490=['dateEnd','filters','intersection','attributes','fields','nolimit','sort','where','pick','add','day','merge','filter','map','VoiceRecording','includeAll','include','rows','catch','show','params','length','options','find','create','body','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','MD5','col','token','$and','push','secrets','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','model','keys','format','query','dateStart'];(function(_0x53c907,_0x4496d4){var _0x3525ef=function(_0x5d0f6e){while(--_0x5d0f6e){_0x53c907['push'](_0x53c907['shift']());}};_0x3525ef(++_0x4496d4);}(_0x4490,0x94));var _0x0449=function(_0x35916e,_0x47f693){_0x35916e=_0x35916e-0x0;var _0x3addf0=_0x4490[_0x35916e];return _0x3addf0;};'use strict';var pdf=require(_0x0449('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0449('0x1'));var zipdir=require(_0x0449('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0449('0x3'));var moment=require(_0x0449('0x4'));var BPromise=require(_0x0449('0x5'));var Mustache=require(_0x0449('0x6'));var util=require(_0x0449('0x7'));var path=require(_0x0449('0x8'));var sox=require(_0x0449('0x9'));var csv=require(_0x0449('0xa'));var ejs=require(_0x0449('0xb'));var fs=require('fs');var _=require(_0x0449('0xc'));var squel=require(_0x0449('0xd'));var crypto=require(_0x0449('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0449('0xf'));var toCsv=require(_0x0449('0xa'));var querystring=require(_0x0449('0x10'));var Papa=require(_0x0449('0x11'));var Redis=require(_0x0449('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x0449('0x13'))(_0x0449('0x14'));var utils=require(_0x0449('0x15'));var config=require(_0x0449('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x508e6e,_0x30553e){_0x30553e=_0x30553e||0xcc;return function(_0x29560a){if(_0x29560a){return _0x508e6e[_0x0449('0x17')](_0x30553e);}return _0x508e6e[_0x0449('0x18')](_0x30553e)[_0x0449('0x19')]();};}function respondWithResult(_0x598f92,_0x56bd08){_0x56bd08=_0x56bd08||0xc8;return function(_0x505573){if(_0x505573){return _0x598f92[_0x0449('0x18')](_0x56bd08)[_0x0449('0x1a')](_0x505573);}};}function respondWithFilteredResult(_0x1162f2,_0x47f157){return function(_0x4165d8){if(_0x4165d8){var _0x523f55=_0x4165d8[_0x0449('0x1b')],_0x576487=_0x47f157[_0x0449('0x1c')],_0x4a8e53=_0x47f157[_0x0449('0x1c')]+_0x47f157[_0x0449('0x1d')],_0x3d8845;if(_0x4a8e53>=_0x523f55){_0x4a8e53=_0x523f55;_0x3d8845=0xc8;}else{_0x3d8845=0xce;}_0x1162f2[_0x0449('0x18')](_0x3d8845);return _0x1162f2[_0x0449('0x1e')](_0x0449('0x1f'),_0x576487+'-'+_0x4a8e53+'/'+_0x523f55)[_0x0449('0x1a')](_0x4165d8);}return null;};}function patchUpdates(_0x1f58b7){return function(_0x9277d4){try{jsonpatch[_0x0449('0x20')](_0x9277d4,_0x1f58b7,!![]);}catch(_0x325810){return BPromise[_0x0449('0x21')](_0x325810);}return _0x9277d4[_0x0449('0x22')]();};}function saveUpdates(_0x2447cd,_0x10d4e8){return function(_0x3a4295){if(_0x3a4295){return _0x3a4295[_0x0449('0x23')](_0x2447cd)[_0x0449('0x24')](function(_0x149019){return _0x149019;});}return null;};}function removeEntity(_0x509a24,_0x468202){return function(_0x208ba0){if(_0x208ba0){return _0x208ba0[_0x0449('0x25')]()[_0x0449('0x24')](function(){_0x509a24[_0x0449('0x18')](0xcc)[_0x0449('0x19')]();});}};}function handleEntityNotFound(_0x41540a,_0x3f46ee){return function(_0x382f4c){if(!_0x382f4c){_0x41540a['sendStatus'](0x194);}return _0x382f4c;};}function handleError(_0x31dc86,_0x468cd9){_0x468cd9=_0x468cd9||0x1f4;return function(_0x8687ec){logger[_0x0449('0x26')](_0x8687ec[_0x0449('0x27')]);if(_0x8687ec[_0x0449('0x28')]){delete _0x8687ec[_0x0449('0x28')];}_0x31dc86[_0x0449('0x18')](_0x468cd9)[_0x0449('0x29')](_0x8687ec);};}exports['index']=function(_0xd00ae9,_0xfc8584){var _0x1c5c8d={},_0x49911b={},_0x11f1aa={'count':0x0,'rows':[]};var _0x354f35=db['VoiceRecording'][_0x0449('0x2a')];_0x49911b[_0x0449('0x2b')]=_['differenceBy'](_[_0x0449('0x2c')](_0x354f35),[_0x0449('0x2d')]);var _0x2598ba={'dateStart':_0xd00ae9[_0x0449('0x2e')][_0x0449('0x2f')],'dateEnd':_0xd00ae9[_0x0449('0x2e')]['dateEnd']};delete _0xd00ae9[_0x0449('0x2e')][_0x0449('0x2f')];delete _0xd00ae9['query'][_0x0449('0x30')];_0x49911b[_0x0449('0x2e')]=_[_0x0449('0x2c')](_0xd00ae9[_0x0449('0x2e')]);_0x49911b[_0x0449('0x31')]=_[_0x0449('0x32')](_0x49911b[_0x0449('0x2b')],_0x49911b['query']);_0x1c5c8d[_0x0449('0x33')]=_['intersection'](_0x49911b[_0x0449('0x2b')],qs[_0x0449('0x34')](_0xd00ae9[_0x0449('0x2e')][_0x0449('0x34')]));_0x1c5c8d[_0x0449('0x33')]=_0x1c5c8d['attributes']['length']?_0x1c5c8d[_0x0449('0x33')]:_0x49911b['model'];if(!_0xd00ae9['query']['hasOwnProperty'](_0x0449('0x35'))){_0x1c5c8d[_0x0449('0x1d')]=qs[_0x0449('0x1d')](_0xd00ae9[_0x0449('0x2e')][_0x0449('0x1d')]);_0x1c5c8d[_0x0449('0x1c')]=qs[_0x0449('0x1c')](_0xd00ae9[_0x0449('0x2e')][_0x0449('0x1c')]);}_0x1c5c8d['order']=qs['sort'](_0xd00ae9['query'][_0x0449('0x36')]);_0x1c5c8d[_0x0449('0x37')]=qs['filters'](_[_0x0449('0x38')](_0xd00ae9[_0x0449('0x2e')],_0x49911b[_0x0449('0x31')]));if(_0x2598ba['dateStart']){if(_0x2598ba['dateEnd']){_0x2598ba[_0x0449('0x30')]=moment(_0x2598ba['dateEnd'])[_0x0449('0x39')](0x1,_0x0449('0x3a'));}else{_0x2598ba[_0x0449('0x30')]=moment(_0x2598ba['dateStart'])[_0x0449('0x39')](0x1,'day');}_[_0x0449('0x3b')](_0x1c5c8d[_0x0449('0x37')],{'createdAt':{'$gte':_0x2598ba[_0x0449('0x2f')],'$lte':_0x2598ba[_0x0449('0x30')]}});}if(_0xd00ae9[_0x0449('0x2e')][_0x0449('0x3c')]){_0x1c5c8d[_0x0449('0x37')]=_[_0x0449('0x3b')](_0x1c5c8d['where'],{'$or':_[_0x0449('0x3d')](_0x1c5c8d[_0x0449('0x33')],function(_0x2c1aa7){var _0x401ad5={};_0x401ad5[_0x2c1aa7]={'$like':'%'+_0xd00ae9[_0x0449('0x2e')][_0x0449('0x3c')]+'%'};return _0x401ad5;})});}_0x1c5c8d=_['merge']({},_0x1c5c8d,_0xd00ae9['options']);var _0x30f601={'where':_0x1c5c8d[_0x0449('0x37')]};return db[_0x0449('0x3e')][_0x0449('0x1b')](_0x30f601)[_0x0449('0x24')](function(_0xcb639d){_0x11f1aa[_0x0449('0x1b')]=_0xcb639d;if(_0xd00ae9[_0x0449('0x2e')][_0x0449('0x3f')]){_0x1c5c8d[_0x0449('0x40')]=[{'all':!![]}];}return db[_0x0449('0x3e')]['findAll'](_0x1c5c8d);})['then'](function(_0x29bf45){_0x11f1aa[_0x0449('0x41')]=_0x29bf45;return _0x11f1aa;})[_0x0449('0x24')](respondWithFilteredResult(_0xfc8584,_0x1c5c8d))[_0x0449('0x42')](handleError(_0xfc8584,null));};exports[_0x0449('0x43')]=function(_0x4ff6c1,_0x33bcfe){var _0x10eb31={'raw':![],'where':{'id':_0x4ff6c1[_0x0449('0x44')]['id']}},_0x3f7a15={};_0x3f7a15[_0x0449('0x2b')]=_[_0x0449('0x2c')](db[_0x0449('0x3e')][_0x0449('0x2a')]);_0x3f7a15[_0x0449('0x2e')]=_[_0x0449('0x2c')](_0x4ff6c1[_0x0449('0x2e')]);_0x3f7a15[_0x0449('0x31')]=_[_0x0449('0x32')](_0x3f7a15[_0x0449('0x2b')],_0x3f7a15[_0x0449('0x2e')]);_0x10eb31['attributes']=_['intersection'](_0x3f7a15[_0x0449('0x2b')],qs['fields'](_0x4ff6c1['query'][_0x0449('0x34')]));_0x10eb31[_0x0449('0x33')]=_0x10eb31['attributes'][_0x0449('0x45')]?_0x10eb31['attributes']:_0x3f7a15[_0x0449('0x2b')];if(_0x4ff6c1[_0x0449('0x2e')][_0x0449('0x3f')]){_0x10eb31[_0x0449('0x40')]=[{'all':!![]}];}_0x10eb31=_[_0x0449('0x3b')]({},_0x10eb31,_0x4ff6c1[_0x0449('0x46')]);return db['VoiceRecording'][_0x0449('0x47')](_0x10eb31)['then'](handleEntityNotFound(_0x33bcfe,null))['then'](respondWithResult(_0x33bcfe,null))['catch'](handleError(_0x33bcfe,null));};exports[_0x0449('0x48')]=function(_0x1922df,_0x4d1d17){return db[_0x0449('0x3e')][_0x0449('0x48')](_0x1922df['body'],{})[_0x0449('0x24')](respondWithResult(_0x4d1d17,0xc9))['catch'](handleError(_0x4d1d17,null));};exports['update']=function(_0x5d4422,_0x15ad5d){if(_0x5d4422[_0x0449('0x49')]['id']){delete _0x5d4422['body']['id'];}return db[_0x0449('0x3e')][_0x0449('0x47')]({'where':{'id':_0x5d4422[_0x0449('0x44')]['id']}})[_0x0449('0x24')](handleEntityNotFound(_0x15ad5d,null))[_0x0449('0x24')](saveUpdates(_0x5d4422['body'],null))[_0x0449('0x24')](respondWithResult(_0x15ad5d,null))['catch'](handleError(_0x15ad5d,null));};exports[_0x0449('0x25')]=function(_0x376641,_0x4efd82){return db[_0x0449('0x3e')][_0x0449('0x47')]({'where':{'id':_0x376641['params']['id']}})['then'](handleEntityNotFound(_0x4efd82,null))[_0x0449('0x24')](removeEntity(_0x4efd82,null))[_0x0449('0x42')](handleError(_0x4efd82,null));};exports[_0x0449('0x4a')]=function(_0x23fc29,_0x488ce0){return db[_0x0449('0x3e')]['describe']()['then'](respondWithResult(_0x488ce0,null))[_0x0449('0x42')](handleError(_0x488ce0,null));};exports[_0x0449('0x4b')]=function(_0x6946b7,_0x326bc1,_0x57117a){var _0x318ee9=require(_0x0449('0x4c'));var _0x6e9447=![];var _0x36800a={};if(_0x6946b7['query'][_0x0449('0x4d')]&&_0x6946b7[_0x0449('0x2e')][_0x0449('0x4d')]===_0x0449('0x4e')){_0x36800a['uniqueid']=_0x6946b7[_0x0449('0x44')]['id'];}else{_0x36800a['id']=_0x6946b7[_0x0449('0x44')]['id'];}return db[_0x0449('0x3e')][_0x0449('0x47')]({'where':_0x36800a,'attributes':['id',_0x0449('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x326bc1,null))[_0x0449('0x24')](function(_0x9a5ffb){if(_0x9a5ffb){var _0x5abd50=util[_0x0449('0x2d')](_0x0449('0x50'),_0x9a5ffb[_0x0449('0x4f')]);if(fs[_0x0449('0x51')](_0x5abd50)){_0x6e9447=!![];return _0x318ee9[_0x0449('0x52')](_0x5abd50,_0x9a5ffb[_0x0449('0x4f')],config['secrets'][_0x0449('0x53')])[_0x0449('0x24')](function(){return _0x9a5ffb;});}return _0x9a5ffb;}})[_0x0449('0x24')](function(_0x2288d8){if(_0x2288d8){if(!fs['existsSync'](_0x2288d8[_0x0449('0x4f')])){throw new db[(_0x0449('0x54'))][(_0x0449('0x55'))](_0x0449('0x56'));}if(_0x2288d8[_0x0449('0x57')]){return _0x326bc1[_0x0449('0x4b')](_0x2288d8[_0x0449('0x4f')],_0x2288d8[_0x0449('0x57')]+path[_0x0449('0x58')](_0x2288d8[_0x0449('0x4f')]),function(){if(_0x6e9447){fs[_0x0449('0x59')](_0x2288d8['value']);}});}else{return _0x326bc1[_0x0449('0x4b')](_0x2288d8['value'],function(_0xbf10e0){if(_0x6e9447){fs[_0x0449('0x59')](_0x2288d8[_0x0449('0x4f')]);}});}}})[_0x0449('0x42')](handleError(_0x326bc1,null));};exports[_0x0449('0x5a')]=function(_0x33f9a4,_0x2a1137,_0x17cb6f){var _0xf4a187=require(_0x0449('0x4c'));var _0x2a9ab5=![];var _0x179e19={'$and':[db[_0x0449('0x5b')][_0x0449('0x37')](db[_0x0449('0x5b')]['fn'](_0x0449('0x5c'),db[_0x0449('0x5b')][_0x0449('0x5d')]('uniqueid')),_0x33f9a4[_0x0449('0x2e')][_0x0449('0x5e')])]};if(_0x33f9a4[_0x0449('0x2e')][_0x0449('0x4d')]&&_0x33f9a4[_0x0449('0x2e')][_0x0449('0x4d')]===_0x0449('0x4e')){_0x179e19[_0x0449('0x5f')][_0x0449('0x60')]({'uniqueid':_0x33f9a4[_0x0449('0x44')]['id']});}else{_0x179e19[_0x0449('0x5f')][_0x0449('0x60')]({'id':_0x33f9a4[_0x0449('0x44')]['id']});}return db['VoiceRecording'][_0x0449('0x47')]({'where':_0x179e19,'attributes':['id',_0x0449('0x4f')],'raw':!![]})[_0x0449('0x24')](handleEntityNotFound(_0x2a1137,null))['then'](function(_0x3701fc){if(_0x3701fc){var _0x1f39c0=util[_0x0449('0x2d')](_0x0449('0x50'),_0x3701fc[_0x0449('0x4f')]);if(fs[_0x0449('0x51')](_0x1f39c0)){_0x2a9ab5=!![];return _0xf4a187[_0x0449('0x52')](_0x1f39c0,_0x3701fc[_0x0449('0x4f')],config[_0x0449('0x61')][_0x0449('0x53')])[_0x0449('0x24')](function(){return _0x3701fc;});}return _0x3701fc;}})[_0x0449('0x24')](function(_0x376bf8){if(_0x376bf8){if(!fs[_0x0449('0x51')](_0x376bf8['value'])){throw new db['Sequelize'][(_0x0449('0x55'))](_0x0449('0x56'));}if(_0x376bf8[_0x0449('0x57')]){return _0x2a1137[_0x0449('0x4b')](_0x376bf8['value'],_0x376bf8[_0x0449('0x57')]+path['extname'](_0x376bf8[_0x0449('0x4f')]),function(){if(_0x2a9ab5){fs[_0x0449('0x59')](_0x376bf8[_0x0449('0x4f')]);}});}else{return _0x2a1137[_0x0449('0x4b')](_0x376bf8[_0x0449('0x4f')],function(_0x113e38){if(_0x2a9ab5){fs[_0x0449('0x59')](_0x376bf8['value']);}});}}})[_0x0449('0x42')](handleError(_0x2a1137,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index c598e20..0b2b2d3 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 _0x29b2=['../../config/logger','./voiceRecording.attributes','exports','voice_recordings','uniqueid','util'];(function(_0x130fa2,_0x432c21){var _0x4c19b9=function(_0x2289cb){while(--_0x2289cb){_0x130fa2['push'](_0x130fa2['shift']());}};_0x4c19b9(++_0x432c21);}(_0x29b2,0x1bb));var _0x229b=function(_0x20ffea,_0x4d75de){_0x20ffea=_0x20ffea-0x0;var _0x2e03fc=_0x29b2[_0x20ffea];return _0x2e03fc;};'use strict';var _=require('lodash');var util=require(_0x229b('0x0'));var logger=require(_0x229b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x229b('0x2'));module[_0x229b('0x3')]=function(_0x51ef89,_0x10d42f){return _0x51ef89['define']('VoiceRecording',attributes,{'tableName':_0x229b('0x4'),'paranoid':![],'indexes':[{'name':_0x229b('0x5'),'fields':[_0x229b('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x428b=['voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0xd0bfc0,_0x39983e){var _0x5d9fb6=function(_0xe73f06){while(--_0xe73f06){_0xd0bfc0['push'](_0xd0bfc0['shift']());}};_0x5d9fb6(++_0x39983e);}(_0x428b,0x70));var _0xb428=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x428b[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xb428('0x0'));var util=require(_0xb428('0x1'));var logger=require(_0xb428('0x2'))(_0xb428('0x3'));var moment=require(_0xb428('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xb428('0x5'));module[_0xb428('0x6')]=function(_0x5875c9,_0x30768d){return _0x5875c9[_0xb428('0x7')](_0xb428('0x8'),attributes,{'tableName':_0xb428('0x9'),'paranoid':![],'indexes':[{'name':_0xb428('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 24d7d07..bf487ce 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 _0x2968=['result','catch','UpdateVoiceRecording','VoiceRecording','options','where','attributes','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','value','%s.cypher','encryptFile','unlink','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','info'];(function(_0x2f2c67,_0x33016b){var _0x3b0712=function(_0x170099){while(--_0x170099){_0x2f2c67['push'](_0x2f2c67['shift']());}};_0x3b0712(++_0x33016b);}(_0x2968,0xd1));var _0x8296=function(_0x283dd5,_0x5d52c3){_0x283dd5=_0x283dd5-0x0;var _0x535bfd=_0x2968[_0x283dd5];return _0x535bfd;};'use strict';var _=require('lodash');var util=require(_0x8296('0x0'));var moment=require(_0x8296('0x1'));var BPromise=require('bluebird');var rs=require(_0x8296('0x2'));var fs=require('fs');var Redis=require(_0x8296('0x3'));var db=require(_0x8296('0x4'))['db'];var utils=require(_0x8296('0x5'));var logger=require('../../config/logger')(_0x8296('0x6'));var config=require(_0x8296('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8296('0x8')][_0x8296('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x88130a,_0x3a78bb,_0x170b87){return new BPromise(function(_0x317afc,_0x2ebde7){return client['request'](_0x88130a,_0x170b87)[_0x8296('0xa')](function(_0x3f8ef7){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x3a78bb,'request\x20sent');logger['debug'](_0x8296('0xb'),_0x3a78bb,_0x8296('0xc'),JSON[_0x8296('0xd')](_0x3f8ef7));if(_0x3f8ef7['error']){if(_0x3f8ef7[_0x8296('0xe')][_0x8296('0xf')]===0x1f4){logger[_0x8296('0xe')](_0x8296('0x10'),_0x3a78bb,_0x3f8ef7[_0x8296('0xe')][_0x8296('0x11')]);return _0x2ebde7(_0x3f8ef7[_0x8296('0xe')][_0x8296('0x11')]);}logger[_0x8296('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x3a78bb,_0x3f8ef7['error'][_0x8296('0x11')]);return _0x317afc(_0x3f8ef7[_0x8296('0xe')][_0x8296('0x11')]);}else{logger[_0x8296('0x12')](_0x8296('0x10'),_0x3a78bb,_0x8296('0xc'));_0x317afc(_0x3f8ef7[_0x8296('0x13')][_0x8296('0x11')]);}})[_0x8296('0x14')](function(_0x5c2081){logger[_0x8296('0xe')](_0x8296('0x10'),_0x3a78bb,_0x5c2081);_0x2ebde7(_0x5c2081);});});}exports[_0x8296('0x15')]=function(_0x1bb30a){var _0x373bb0=this;return new Promise(function(_0x44ea32,_0x286e64){return db[_0x8296('0x16')]['update'](_0x1bb30a['body'],{'raw':_0x1bb30a[_0x8296('0x17')]?_0x1bb30a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bb30a[_0x8296('0x17')]?_0x1bb30a[_0x8296('0x17')][_0x8296('0x18')]||null:null,'attributes':_0x1bb30a[_0x8296('0x17')]?_0x1bb30a[_0x8296('0x17')][_0x8296('0x19')]||null:null,'limit':_0x1bb30a[_0x8296('0x17')]?_0x1bb30a[_0x8296('0x17')]['limit']||null:null})[_0x8296('0xa')](function(_0x50de89){logger[_0x8296('0x12')](_0x8296('0x15'),_0x1bb30a);logger['debug'](_0x8296('0x15'),_0x1bb30a,JSON[_0x8296('0xd')](_0x50de89));_0x44ea32(_0x50de89);})[_0x8296('0x14')](function(_0x38ac70){logger[_0x8296('0xe')](_0x8296('0x15'),_0x38ac70['message'],_0x1bb30a);_0x286e64(_0x373bb0[_0x8296('0xe')](0x1f4,_0x38ac70[_0x8296('0x11')]));});});};exports[_0x8296('0x1a')]=function(_0x595997){var _0x45fcd1=this;return new Promise(function(_0x5e315d,_0x28b9ea){var _0x5724e9=require(_0x8296('0x1b'));var _0x44ec43;return db[_0x8296('0x1c')][_0x8296('0x1d')]({'attributes':['id',_0x8296('0x1e')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x2fee9d){_0x44ec43=_0x2fee9d;return db[_0x8296('0x16')][_0x8296('0x1f')](_0x595997[_0x8296('0x20')]);})[_0x8296('0xa')](function(_0x27b0b6){if(_0x44ec43[_0x8296('0x1e')]&&fs['existsSync'](_0x27b0b6[_0x8296('0x21')])){var _0xea7818=util['format'](_0x8296('0x22'),_0x27b0b6[_0x8296('0x21')]);return _0x5724e9[_0x8296('0x23')](_0x27b0b6['value'],_0xea7818,config['secrets']['recording'])[_0x8296('0xa')](function(){fs[_0x8296('0x24')](_0x27b0b6['value']);logger[_0x8296('0x12')]('CreateVoiceRecording\x20file\x20encrypted');return _0x27b0b6;});}return _0x27b0b6;})[_0x8296('0xa')](function(_0x426a35){logger[_0x8296('0x12')](_0x8296('0x1a'),_0x595997);logger[_0x8296('0x25')](_0x8296('0x1a'),_0x595997,JSON['stringify'](_0x426a35));_0x5e315d(_0x426a35);})[_0x8296('0x14')](function(_0x35f68f){logger['error'](_0x8296('0x1a'),_0x35f68f[_0x8296('0x11')],_0x595997);_0x28b9ea(_0x45fcd1['error'](0x1f4,_0x35f68f[_0x8296('0x11')]));});});}; \ No newline at end of file +var _0x064d=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateVoiceRecording','VoiceRecording','update','body','raw','options','where','attributes','limit','catch','CreateVoiceRecording','../../components/encryptor','callRecordingEncryption','existsSync','value','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','moment','bluebird','randomstring','ioredis'];(function(_0x2510e0,_0xe63d06){var _0x25dc00=function(_0x5260b0){while(--_0x5260b0){_0x2510e0['push'](_0x2510e0['shift']());}};_0x25dc00(++_0xe63d06);}(_0x064d,0x19f));var _0xd064=function(_0x4137ca,_0xbb1990){_0x4137ca=_0x4137ca-0x0;var _0x112743=_0x064d[_0x4137ca];return _0x112743;};'use strict';var _=require('lodash');var util=require(_0xd064('0x0'));var moment=require(_0xd064('0x1'));var BPromise=require(_0xd064('0x2'));var rs=require(_0xd064('0x3'));var fs=require('fs');var Redis=require(_0xd064('0x4'));var db=require(_0xd064('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd064('0x6'));var config=require(_0xd064('0x7'));var jayson=require(_0xd064('0x8'));var client=jayson[_0xd064('0x9')][_0xd064('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x298c37,_0x473920,_0x4e8970){return new BPromise(function(_0x42e43,_0x25b5ae){return client[_0xd064('0xb')](_0x298c37,_0x4e8970)[_0xd064('0xc')](function(_0x43accb){logger[_0xd064('0xd')](_0xd064('0xe'),_0x473920,'request\x20sent');logger[_0xd064('0xf')](_0xd064('0x10'),_0x473920,_0xd064('0x11'),JSON[_0xd064('0x12')](_0x43accb));if(_0x43accb[_0xd064('0x13')]){if(_0x43accb[_0xd064('0x13')][_0xd064('0x14')]===0x1f4){logger[_0xd064('0x13')](_0xd064('0xe'),_0x473920,_0x43accb[_0xd064('0x13')][_0xd064('0x15')]);return _0x25b5ae(_0x43accb['error'][_0xd064('0x15')]);}logger[_0xd064('0x13')](_0xd064('0xe'),_0x473920,_0x43accb[_0xd064('0x13')][_0xd064('0x15')]);return _0x42e43(_0x43accb[_0xd064('0x13')][_0xd064('0x15')]);}else{logger[_0xd064('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x473920,_0xd064('0x11'));_0x42e43(_0x43accb['result'][_0xd064('0x15')]);}})['catch'](function(_0x32b7a9){logger[_0xd064('0x13')](_0xd064('0xe'),_0x473920,_0x32b7a9);_0x25b5ae(_0x32b7a9);});});}exports[_0xd064('0x16')]=function(_0x163671){var _0xdb4fb6=this;return new Promise(function(_0x19b4ee,_0x1f37eb){return db[_0xd064('0x17')][_0xd064('0x18')](_0x163671[_0xd064('0x19')],{'raw':_0x163671['options']?_0x163671['options'][_0xd064('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163671[_0xd064('0x1b')]?_0x163671['options'][_0xd064('0x1c')]||null:null,'attributes':_0x163671['options']?_0x163671[_0xd064('0x1b')][_0xd064('0x1d')]||null:null,'limit':_0x163671['options']?_0x163671['options'][_0xd064('0x1e')]||null:null})[_0xd064('0xc')](function(_0x32e0d0){logger[_0xd064('0xd')]('UpdateVoiceRecording',_0x163671);logger[_0xd064('0xf')](_0xd064('0x16'),_0x163671,JSON[_0xd064('0x12')](_0x32e0d0));_0x19b4ee(_0x32e0d0);})[_0xd064('0x1f')](function(_0x5ce6b9){logger[_0xd064('0x13')](_0xd064('0x16'),_0x5ce6b9[_0xd064('0x15')],_0x163671);_0x1f37eb(_0xdb4fb6['error'](0x1f4,_0x5ce6b9['message']));});});};exports[_0xd064('0x20')]=function(_0x1039d5){var _0x3c714c=this;return new Promise(function(_0x5b61c9,_0x16cd6d){var _0x4a3eaa=require(_0xd064('0x21'));var _0x118062;return db['Setting']['findOne']({'attributes':['id',_0xd064('0x22')],'where':{'id':0x1},'raw':!![]})[_0xd064('0xc')](function(_0x47303c){_0x118062=_0x47303c;return db[_0xd064('0x17')]['create'](_0x1039d5[_0xd064('0x19')]);})[_0xd064('0xc')](function(_0x6c6f40){if(_0x118062[_0xd064('0x22')]&&fs[_0xd064('0x23')](_0x6c6f40[_0xd064('0x24')])){var _0x281533=util['format'](_0xd064('0x25'),_0x6c6f40[_0xd064('0x24')]);return _0x4a3eaa['encryptFile'](_0x6c6f40[_0xd064('0x24')],_0x281533,config[_0xd064('0x26')][_0xd064('0x27')])[_0xd064('0xc')](function(){fs[_0xd064('0x28')](_0x6c6f40['value']);logger[_0xd064('0xd')](_0xd064('0x29'));return _0x6c6f40;});}return _0x6c6f40;})['then'](function(_0x2480e6){logger[_0xd064('0xd')](_0xd064('0x20'),_0x1039d5);logger[_0xd064('0xf')]('CreateVoiceRecording',_0x1039d5,JSON[_0xd064('0x12')](_0x2480e6));_0x5b61c9(_0x2480e6);})['catch'](function(_0x3c5645){logger[_0xd064('0x13')](_0xd064('0x20'),_0x3c5645[_0xd064('0x15')],_0x1039d5);_0x16cd6d(_0x3c714c[_0xd064('0x13')](0x1f4,_0x3c5645[_0xd064('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index ad170b7..5fbe2e4 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 _0x9ae2=['/:id','show','post','create','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated'];(function(_0x337222,_0x3175a8){var _0x4bc903=function(_0x2a3bd5){while(--_0x2a3bd5){_0x337222['push'](_0x337222['shift']());}};_0x4bc903(++_0x3175a8);}(_0x9ae2,0x132));var _0x29ae=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x9ae2[_0x102e37];return _0x35a07c;};'use strict';var multer=require('multer');var util=require(_0x29ae('0x0'));var path=require(_0x29ae('0x1'));var timeout=require(_0x29ae('0x2'));var express=require('express');var router=express[_0x29ae('0x3')]();var auth=require(_0x29ae('0x4'));var interaction=require(_0x29ae('0x5'));var config=require(_0x29ae('0x6'));var controller=require(_0x29ae('0x7'));router['get']('/',auth[_0x29ae('0x8')](),controller['index']);router['get'](_0x29ae('0x9'),auth[_0x29ae('0x8')](),controller[_0x29ae('0xa')]);router[_0x29ae('0xb')]('/',auth['isAuthenticated'](),controller[_0x29ae('0xc')]);router['put'](_0x29ae('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x29ae('0x9'),auth[_0x29ae('0x8')](),controller[_0x29ae('0xd')]);module[_0x29ae('0xe')]=router; \ No newline at end of file +var _0x096f=['../../config/environment','get','index','isAuthenticated','post','put','update','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3c75ff,_0x5cac46){var _0xa201e=function(_0x31408c){while(--_0x31408c){_0x3c75ff['push'](_0x3c75ff['shift']());}};_0xa201e(++_0x5cac46);}(_0x096f,0x1c3));var _0xf096=function(_0x59be33,_0x1c8b79){_0x59be33=_0x59be33-0x0;var _0x344036=_0x096f[_0x59be33];return _0x344036;};'use strict';var multer=require(_0xf096('0x0'));var util=require(_0xf096('0x1'));var path=require(_0xf096('0x2'));var timeout=require(_0xf096('0x3'));var express=require(_0xf096('0x4'));var router=express[_0xf096('0x5')]();var auth=require(_0xf096('0x6'));var interaction=require(_0xf096('0x7'));var config=require(_0xf096('0x8'));var controller=require('./voiceTransferReport.controller');router[_0xf096('0x9')]('/',auth['isAuthenticated'](),controller[_0xf096('0xa')]);router[_0xf096('0x9')]('/:id',auth[_0xf096('0xb')](),controller['show']);router[_0xf096('0xc')]('/',auth[_0xf096('0xb')](),controller['create']);router[_0xf096('0xd')]('/:id',auth[_0xf096('0xb')](),controller[_0xf096('0xe')]);router['delete'](_0xf096('0xf'),auth[_0xf096('0xb')](),controller[_0xf096('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 43aae29..4293d08 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 _0x7568=['Yes','sequelize','exports','ENUM','blind','attended','STRING'];(function(_0x47dad0,_0xdcdb5e){var _0x2cf1f6=function(_0x35cd50){while(--_0x35cd50){_0x47dad0['push'](_0x47dad0['shift']());}};_0x2cf1f6(++_0xdcdb5e);}(_0x7568,0x9b));var _0x8756=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x7568[_0x31ced5];return _0x10d9e5;};'use strict';var Sequelize=require(_0x8756('0x0'));var moment=require('moment');module[_0x8756('0x1')]={'type':{'type':Sequelize[_0x8756('0x2')](_0x8756('0x3'),_0x8756('0x4'))},'result':{'type':Sequelize[_0x8756('0x5')]},'transfererchannel':{'type':Sequelize[_0x8756('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x8756('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8756('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x8756('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x8756('0x5')]},'transfererexten':{'type':Sequelize[_0x8756('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x8756('0x5')]},'transfereechannel':{'type':Sequelize[_0x8756('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8756('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8756('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8756('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8756('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x8756('0x5')]},'transfereeexten':{'type':Sequelize[_0x8756('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8756('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x8756('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd0cd=['ENUM','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd0cd,0xf2));var _0xdd0c=function(_0x18be08,_0x1329bc){_0x18be08=_0x18be08-0x0;var _0x5cdf81=_0xd0cd[_0x18be08];return _0x5cdf81;};'use strict';var Sequelize=require(_0xdd0c('0x0'));var moment=require(_0xdd0c('0x1'));module[_0xdd0c('0x2')]={'type':{'type':Sequelize[_0xdd0c('0x3')]('blind',_0xdd0c('0x4'))},'result':{'type':Sequelize[_0xdd0c('0x5')]},'transfererchannel':{'type':Sequelize[_0xdd0c('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xdd0c('0x5')]},'transferercalleridname':{'type':Sequelize[_0xdd0c('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xdd0c('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xdd0c('0x5')]},'transferercontext':{'type':Sequelize[_0xdd0c('0x5')]},'transfererexten':{'type':Sequelize[_0xdd0c('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xdd0c('0x5')]},'transfereechannel':{'type':Sequelize[_0xdd0c('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xdd0c('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xdd0c('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xdd0c('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xdd0c('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xdd0c('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xdd0c('0x3')](_0xdd0c('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xdd0c('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 169f8d3..b1fc461 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(_0x13a2c0,_0x2e0927){var _0x507ff3=function(_0x14b90c){while(--_0x14b90c){_0x13a2c0['push'](_0x13a2c0['shift']());}};_0x507ff3(++_0x2e0927);}(_0xadb5,0xad));var _0x5adb=function(_0x917ae,_0x2f9fad){_0x917ae=_0x917ae-0x0;var _0x410714=_0xadb5[_0x917ae];return _0x410714;};'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 _0x2ef3=['Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','send','index','VoiceTransferReport','rawAttributes','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','add','day','merge','where','map','filter','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit'];(function(_0x35ef49,_0x39ff7e){var _0x33b503=function(_0x552ec2){while(--_0x552ec2){_0x35ef49['push'](_0x35ef49['shift']());}};_0x33b503(++_0x39ff7e);}(_0x2ef3,0xba));var _0x32ef=function(_0x2a68cc,_0x547f2b){_0x2a68cc=_0x2a68cc-0x0;var _0x19fd8d=_0x2ef3[_0x2a68cc];return _0x19fd8d;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var qs=require(_0x32ef('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x32ef('0x14'));var config=require(_0x32ef('0x15'));var db=require(_0x32ef('0x16'))['db'];function respondWithStatusCode(_0x1499c2,_0x5af651){_0x5af651=_0x5af651||0xcc;return function(_0x193714){if(_0x193714){return _0x1499c2['sendStatus'](_0x5af651);}return _0x1499c2[_0x32ef('0x17')](_0x5af651)['end']();};}function respondWithResult(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xc8;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['status'](_0x1ef1ae)[_0x32ef('0x18')](_0x5c3eb9);}};}function respondWithFilteredResult(_0x4d8009,_0x326fce){return function(_0x40a6e6){if(_0x40a6e6){var _0x93d492=_0x40a6e6['count'],_0x54c7f5=_0x326fce[_0x32ef('0x19')],_0x57aff1=_0x326fce[_0x32ef('0x19')]+_0x326fce[_0x32ef('0x1a')],_0x55bf0b;if(_0x57aff1>=_0x93d492){_0x57aff1=_0x93d492;_0x55bf0b=0xc8;}else{_0x55bf0b=0xce;}_0x4d8009['status'](_0x55bf0b);return _0x4d8009['set'](_0x32ef('0x1b'),_0x54c7f5+'-'+_0x57aff1+'/'+_0x93d492)[_0x32ef('0x18')](_0x40a6e6);}return null;};}function patchUpdates(_0x286bfb){return function(_0x57863c){try{jsonpatch[_0x32ef('0x1c')](_0x57863c,_0x286bfb,!![]);}catch(_0x33e230){return BPromise['reject'](_0x33e230);}return _0x57863c[_0x32ef('0x1d')]();};}function saveUpdates(_0x314ef1,_0x26aff3){return function(_0x251084){if(_0x251084){return _0x251084[_0x32ef('0x1e')](_0x314ef1)[_0x32ef('0x1f')](function(_0x4de441){return _0x4de441;});}return null;};}function removeEntity(_0x3c5b78,_0x5cc3ef){return function(_0x309866){if(_0x309866){return _0x309866[_0x32ef('0x20')]()['then'](function(){_0x3c5b78[_0x32ef('0x17')](0xcc)[_0x32ef('0x21')]();});}};}function handleEntityNotFound(_0x5e8898,_0x55f7f2){return function(_0x57f5e5){if(!_0x57f5e5){_0x5e8898[_0x32ef('0x22')](0x194);}return _0x57f5e5;};}function handleError(_0xb30fab,_0x225feb){_0x225feb=_0x225feb||0x1f4;return function(_0x478bef){logger['error'](_0x478bef[_0x32ef('0x23')]);if(_0x478bef['name']){delete _0x478bef['name'];}_0xb30fab[_0x32ef('0x17')](_0x225feb)[_0x32ef('0x24')](_0x478bef);};}exports[_0x32ef('0x25')]=function(_0x1dbe98,_0x15ce54){var _0x234175={},_0x1874ea={},_0x38aed5={'count':0x0,'rows':[]};var _0x338f19=db[_0x32ef('0x26')][_0x32ef('0x27')];_0x1874ea[_0x32ef('0x28')]=_['keys'](_0x338f19);var _0xd65fde={'dateStart':_0x1dbe98[_0x32ef('0x29')]['dateStart'],'dateEnd':_0x1dbe98[_0x32ef('0x29')][_0x32ef('0x2a')]};delete _0x1dbe98[_0x32ef('0x29')][_0x32ef('0x2b')];delete _0x1dbe98['query'][_0x32ef('0x2a')];_0x1874ea[_0x32ef('0x29')]=_[_0x32ef('0x2c')](_0x1dbe98[_0x32ef('0x29')]);_0x1874ea[_0x32ef('0x2d')]=_[_0x32ef('0x2e')](_0x1874ea[_0x32ef('0x28')],_0x1874ea['query']);_0x234175[_0x32ef('0x2f')]=_['intersection'](_0x1874ea[_0x32ef('0x28')],qs[_0x32ef('0x30')](_0x1dbe98['query'][_0x32ef('0x30')]));_0x234175[_0x32ef('0x2f')]=_0x234175[_0x32ef('0x2f')][_0x32ef('0x31')]?_0x234175[_0x32ef('0x2f')]:_0x1874ea['model'];if(!_0x1dbe98['query'][_0x32ef('0x32')]('nolimit')){_0x234175[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x1dbe98[_0x32ef('0x29')][_0x32ef('0x1a')]);_0x234175[_0x32ef('0x19')]=qs[_0x32ef('0x19')](_0x1dbe98['query']['offset']);}_0x234175['order']=qs[_0x32ef('0x33')](_0x1dbe98[_0x32ef('0x29')][_0x32ef('0x33')]);_0x234175['where']=qs['filters'](_[_0x32ef('0x34')](_0x1dbe98[_0x32ef('0x29')],_0x1874ea[_0x32ef('0x2d')]));if(_0xd65fde['dateStart']){if(_0xd65fde['dateEnd']){_0xd65fde[_0x32ef('0x2a')]=moment(_0xd65fde[_0x32ef('0x2a')])[_0x32ef('0x35')](0x1,_0x32ef('0x36'));}else{_0xd65fde[_0x32ef('0x2a')]=moment(_0xd65fde[_0x32ef('0x2b')])[_0x32ef('0x35')](0x1,_0x32ef('0x36'));}_[_0x32ef('0x37')](_0x234175['where'],{'createdAt':{'$gte':_0xd65fde[_0x32ef('0x2b')],'$lte':_0xd65fde[_0x32ef('0x2a')]}});}if(_0x1dbe98[_0x32ef('0x29')]['filter']){_0x234175[_0x32ef('0x38')]=_[_0x32ef('0x37')](_0x234175[_0x32ef('0x38')],{'$or':_[_0x32ef('0x39')](_0x234175[_0x32ef('0x2f')],function(_0x33a0fb){var _0x256c40={};_0x256c40[_0x33a0fb]={'$like':'%'+_0x1dbe98[_0x32ef('0x29')][_0x32ef('0x3a')]+'%'};return _0x256c40;})});}_0x234175=_[_0x32ef('0x37')]({},_0x234175,_0x1dbe98[_0x32ef('0x3b')]);var _0x4615b4={'where':_0x234175['where']};return db[_0x32ef('0x26')][_0x32ef('0x3c')](_0x4615b4)[_0x32ef('0x1f')](function(_0x1733e3){_0x38aed5[_0x32ef('0x3c')]=_0x1733e3;if(_0x1dbe98[_0x32ef('0x29')][_0x32ef('0x3d')]){_0x234175['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x32ef('0x3e')](_0x234175);})[_0x32ef('0x1f')](function(_0x2a33dd){_0x38aed5[_0x32ef('0x3f')]=_0x2a33dd;return _0x38aed5;})['then'](respondWithFilteredResult(_0x15ce54,_0x234175))[_0x32ef('0x40')](handleError(_0x15ce54,null));};exports[_0x32ef('0x41')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x42')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x28')]=_[_0x32ef('0x2c')](db[_0x32ef('0x26')][_0x32ef('0x27')]);_0xcb3c08[_0x32ef('0x29')]=_[_0x32ef('0x2c')](_0x5d2f06[_0x32ef('0x29')]);_0xcb3c08[_0x32ef('0x2d')]=_['intersection'](_0xcb3c08[_0x32ef('0x28')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x2f')]=_[_0x32ef('0x2e')](_0xcb3c08[_0x32ef('0x28')],qs['fields'](_0x5d2f06[_0x32ef('0x29')][_0x32ef('0x30')]));_0x4bc5bc[_0x32ef('0x2f')]=_0x4bc5bc[_0x32ef('0x2f')][_0x32ef('0x31')]?_0x4bc5bc[_0x32ef('0x2f')]:_0xcb3c08[_0x32ef('0x28')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x43')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x37')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3b')]);return db[_0x32ef('0x26')][_0x32ef('0x44')](_0x4bc5bc)[_0x32ef('0x1f')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x1f')](respondWithResult(_0x4744ba,null))[_0x32ef('0x40')](handleError(_0x4744ba,null));};exports[_0x32ef('0x45')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x26')][_0x32ef('0x45')](_0x1ebedf['body'],{})[_0x32ef('0x1f')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x40')](handleError(_0x35a294,null));};exports[_0x32ef('0x1e')]=function(_0xd42609,_0x1cc9f3){if(_0xd42609[_0x32ef('0x46')]['id']){delete _0xd42609[_0x32ef('0x46')]['id'];}return db[_0x32ef('0x26')][_0x32ef('0x44')]({'where':{'id':_0xd42609[_0x32ef('0x42')]['id']}})[_0x32ef('0x1f')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x1f')](saveUpdates(_0xd42609[_0x32ef('0x46')],null))[_0x32ef('0x1f')](respondWithResult(_0x1cc9f3,null))[_0x32ef('0x40')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x20')]=function(_0x16bec6,_0x2c1b44){return db['VoiceTransferReport']['find']({'where':{'id':_0x16bec6[_0x32ef('0x42')]['id']}})[_0x32ef('0x1f')](handleEntityNotFound(_0x2c1b44,null))[_0x32ef('0x1f')](removeEntity(_0x2c1b44,null))[_0x32ef('0x40')](handleError(_0x2c1b44,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 11df80c..fc477a0 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 _0xf9e6=['../../config/logger','api','moment','bluebird','./voiceTransferReport.attributes','exports','define','lodash'];(function(_0x2383e9,_0x19ae38){var _0x3f7178=function(_0x42c898){while(--_0x42c898){_0x2383e9['push'](_0x2383e9['shift']());}};_0x3f7178(++_0x19ae38);}(_0xf9e6,0x1d7));var _0x6f9e=function(_0x9d43ae,_0x3a64f2){_0x9d43ae=_0x9d43ae-0x0;var _0x1d609c=_0xf9e6[_0x9d43ae];return _0x1d609c;};'use strict';var _=require(_0x6f9e('0x0'));var util=require('util');var logger=require(_0x6f9e('0x1'))(_0x6f9e('0x2'));var moment=require(_0x6f9e('0x3'));var BPromise=require(_0x6f9e('0x4'));var rp=require('request-promise');var attributes=require(_0x6f9e('0x5'));module[_0x6f9e('0x6')]=function(_0x333ae8,_0x56919d){return _0x333ae8[_0x6f9e('0x7')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd037=['api','moment','bluebird','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger'];(function(_0x27231b,_0x5b5697){var _0x5d1c39=function(_0x2b4a20){while(--_0x2b4a20){_0x27231b['push'](_0x27231b['shift']());}};_0x5d1c39(++_0x5b5697);}(_0xd037,0x89));var _0x7d03=function(_0x4c5e44,_0x341428){_0x4c5e44=_0x4c5e44-0x0;var _0xd48265=_0xd037[_0x4c5e44];return _0xd48265;};'use strict';var _=require(_0x7d03('0x0'));var util=require(_0x7d03('0x1'));var logger=require(_0x7d03('0x2'))(_0x7d03('0x3'));var moment=require(_0x7d03('0x4'));var BPromise=require(_0x7d03('0x5'));var rp=require('request-promise');var attributes=require(_0x7d03('0x6'));module[_0x7d03('0x7')]=function(_0x49a3a5,_0x687732){return _0x49a3a5[_0x7d03('0x8')](_0x7d03('0x9'),attributes,{'tableName':'report_call_transfer','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 1c18b10..5ecd0bb 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 _0x6a58=['../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5724e6,_0xa6ee67){var _0x4ccb15=function(_0x48a8c2){while(--_0x48a8c2){_0x5724e6['push'](_0x5724e6['shift']());}};_0x4ccb15(++_0xa6ee67);}(_0x6a58,0x18c));var _0x86a5=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x6a58[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x86a5('0x0'));var BPromise=require(_0x86a5('0x1'));var rs=require(_0x86a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86a5('0x3'))['db'];var utils=require(_0x86a5('0x4'));var logger=require(_0x86a5('0x5'))(_0x86a5('0x6'));var config=require('../../config/environment');var jayson=require(_0x86a5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4794c1,_0x2570b7,_0x4019fa){return new BPromise(function(_0x17f220,_0x4cfe96){return client[_0x86a5('0x8')](_0x4794c1,_0x4019fa)[_0x86a5('0x9')](function(_0x173067){logger[_0x86a5('0xa')](_0x86a5('0xb'),_0x2570b7,'request\x20sent');logger[_0x86a5('0xc')](_0x86a5('0xd'),_0x2570b7,_0x86a5('0xe'),JSON[_0x86a5('0xf')](_0x173067));if(_0x173067['error']){if(_0x173067[_0x86a5('0x10')][_0x86a5('0x11')]===0x1f4){logger[_0x86a5('0x10')](_0x86a5('0xb'),_0x2570b7,_0x173067[_0x86a5('0x10')][_0x86a5('0x12')]);return _0x4cfe96(_0x173067[_0x86a5('0x10')]['message']);}logger[_0x86a5('0x10')](_0x86a5('0xb'),_0x2570b7,_0x173067[_0x86a5('0x10')][_0x86a5('0x12')]);return _0x17f220(_0x173067['error'][_0x86a5('0x12')]);}else{logger[_0x86a5('0xa')](_0x86a5('0xb'),_0x2570b7,_0x86a5('0xe'));_0x17f220(_0x173067[_0x86a5('0x13')][_0x86a5('0x12')]);}})[_0x86a5('0x14')](function(_0x920122){logger[_0x86a5('0x10')](_0x86a5('0xb'),_0x2570b7,_0x920122);_0x4cfe96(_0x920122);});});}exports[_0x86a5('0x15')]=function(_0x216b19){var _0x584e00=this;return new Promise(function(_0x2a5885,_0x1b41e4){return db[_0x86a5('0x16')]['create'](_0x216b19[_0x86a5('0x17')],{'raw':_0x216b19[_0x86a5('0x18')]?_0x216b19['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x259c6a){logger[_0x86a5('0xa')](_0x86a5('0x15'),_0x216b19);logger[_0x86a5('0xc')](_0x86a5('0x15'),_0x216b19,JSON[_0x86a5('0xf')](_0x259c6a));_0x2a5885(_0x259c6a);})['catch'](function(_0x461e9f){logger[_0x86a5('0x10')](_0x86a5('0x15'),_0x461e9f['message'],_0x216b19);_0x1b41e4(_0x584e00[_0x86a5('0x10')](0x1f4,_0x461e9f[_0x86a5('0x12')]));});});}; \ No newline at end of file +var _0x7db9=['../../mysqldb','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','stringify','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1c8c2f,_0x1d99fe){var _0x24fa67=function(_0x15fd50){while(--_0x15fd50){_0x1c8c2f['push'](_0x1c8c2f['shift']());}};_0x24fa67(++_0x1d99fe);}(_0x7db9,0x19b));var _0x97db=function(_0x39b81e,_0x57e359){_0x39b81e=_0x39b81e-0x0;var _0x1feaa8=_0x7db9[_0x39b81e];return _0x1feaa8;};'use strict';var _=require(_0x97db('0x0'));var util=require('util');var moment=require(_0x97db('0x1'));var BPromise=require(_0x97db('0x2'));var rs=require(_0x97db('0x3'));var fs=require('fs');var Redis=require(_0x97db('0x4'));var db=require(_0x97db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x97db('0x6'));var jayson=require(_0x97db('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39f1cd,_0x19dfc4,_0x40a961){return new BPromise(function(_0x9b3700,_0x4e6864){return client[_0x97db('0x8')](_0x39f1cd,_0x40a961)[_0x97db('0x9')](function(_0x37fd68){logger[_0x97db('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x19dfc4,_0x97db('0xb'));logger[_0x97db('0xc')](_0x97db('0xd'),_0x19dfc4,'request\x20sent',JSON['stringify'](_0x37fd68));if(_0x37fd68['error']){if(_0x37fd68[_0x97db('0xe')][_0x97db('0xf')]===0x1f4){logger[_0x97db('0xe')](_0x97db('0x10'),_0x19dfc4,_0x37fd68[_0x97db('0xe')][_0x97db('0x11')]);return _0x4e6864(_0x37fd68[_0x97db('0xe')]['message']);}logger[_0x97db('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x19dfc4,_0x37fd68[_0x97db('0xe')][_0x97db('0x11')]);return _0x9b3700(_0x37fd68[_0x97db('0xe')][_0x97db('0x11')]);}else{logger[_0x97db('0xa')](_0x97db('0x10'),_0x19dfc4,'request\x20sent');_0x9b3700(_0x37fd68[_0x97db('0x12')][_0x97db('0x11')]);}})[_0x97db('0x13')](function(_0x12ba99){logger[_0x97db('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x19dfc4,_0x12ba99);_0x4e6864(_0x12ba99);});});}exports[_0x97db('0x14')]=function(_0x1016a9){var _0x5f4bdb=this;return new Promise(function(_0x3800a2,_0x1529e1){return db[_0x97db('0x15')][_0x97db('0x16')](_0x1016a9[_0x97db('0x17')],{'raw':_0x1016a9['options']?_0x1016a9[_0x97db('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x97db('0x9')](function(_0x5eab37){logger[_0x97db('0xa')](_0x97db('0x14'),_0x1016a9);logger['debug'](_0x97db('0x14'),_0x1016a9,JSON[_0x97db('0x19')](_0x5eab37));_0x3800a2(_0x5eab37);})[_0x97db('0x13')](function(_0x4a2915){logger[_0x97db('0xe')](_0x97db('0x14'),_0x4a2915['message'],_0x1016a9);_0x1529e1(_0x5f4bdb[_0x97db('0xe')](0x1f4,_0x4a2915[_0x97db('0x11')]));});});}; \ No newline at end of file diff --git a/server/app.js b/server/app.js index b8783ff..8800c8c 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc3c=['exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','join','Offline\x20apps:','status','online','seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x29bca4,_0x2cf174){_0x29bca4=_0x29bca4-0x0;var _0x478734=_0xdc3c[_0x29bca4];return _0x478734;};'use strict';var _=require(_0xcdc3('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xcdc3('0x1'));var config=require(_0xcdc3('0x2'));var logger=require(_0xcdc3('0x3'))(_0xcdc3('0x4'));var pm2=require(_0xcdc3('0x5'));var pm2Config=require(_0xcdc3('0x6'));var schedule=require(_0xcdc3('0x7'));var chat=require(_0xcdc3('0x8'));function main(){return mysqldb['db'][_0xcdc3('0x9')][_0xcdc3('0xa')]()[_0xcdc3('0xb')](function(){return rpc[_0xcdc3('0xc')]();})[_0xcdc3('0xb')](function(_0x428b03){logger[_0xcdc3('0xd')](_0x428b03);return chat[_0xcdc3('0xe')]();})['then'](function(){return schedule['start']();})['then'](function(_0x3aa1b2){logger[_0xcdc3('0xd')](_0x3aa1b2);return pm2[_0xcdc3('0xe')](pm2Config);})[_0xcdc3('0xb')](function(_0x18ba5f){logger[_0xcdc3('0xd')](_0xcdc3('0xf'),_[_0xcdc3('0x10')](_[_0xcdc3('0x11')](_0x18ba5f,{'status':'online'}),'name')[_0xcdc3('0x12')]());logger[_0xcdc3('0xd')](_0xcdc3('0x13'),_[_0xcdc3('0x10')](_[_0xcdc3('0x11')](_0x18ba5f,function(_0x20cf7c){return _0x20cf7c[_0xcdc3('0x14')]!==_0xcdc3('0x15');}),'name')[_0xcdc3('0x12')]()||'None');config[_0xcdc3('0x16')]&&require('./config/seedDB')[_0xcdc3('0x17')]();require(_0xcdc3('0x18'))[_0xcdc3('0x17')]();})[_0xcdc3('0x19')](function(_0x9f07bf){logger[_0xcdc3('0x1a')](_0xcdc3('0x1b'),_0x9f07bf);process[_0xcdc3('0x1c')](0x1);});}main(); \ No newline at end of file +var _0x392a=['./config/pm2','./config/schedule','sequelize','sync','listen','info','start','then','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','status','None','seedDB','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x392a,0x11d));var _0xa392=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x392a[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xa392('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xa392('0x1'));var config=require(_0xa392('0x2'));var logger=require(_0xa392('0x3'))(_0xa392('0x4'));var pm2=require(_0xa392('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xa392('0x6'));var chat=require('./config/schedule/chat');function main(){return mysqldb['db'][_0xa392('0x7')][_0xa392('0x8')]()['then'](function(){return rpc[_0xa392('0x9')]();})['then'](function(_0x3d437f){logger[_0xa392('0xa')](_0x3d437f);return chat[_0xa392('0xb')]();})[_0xa392('0xc')](function(){return schedule[_0xa392('0xb')]();})[_0xa392('0xc')](function(_0x3e9073){logger[_0xa392('0xa')](_0x3e9073);return pm2[_0xa392('0xb')](pm2Config);})[_0xa392('0xc')](function(_0x47ec89){logger['info'](_0xa392('0xd'),_['map'](_[_0xa392('0xe')](_0x47ec89,{'status':_0xa392('0xf')}),_0xa392('0x10'))[_0xa392('0x11')]());logger[_0xa392('0xa')](_0xa392('0x12'),_[_0xa392('0x13')](_['filter'](_0x47ec89,function(_0x5071fb){return _0x5071fb[_0xa392('0x14')]!=='online';}),_0xa392('0x10'))['join']()||_0xa392('0x15'));config[_0xa392('0x16')]&&require(_0xa392('0x17'))[_0xa392('0x18')]();require(_0xa392('0x19'))[_0xa392('0x18')]();})[_0xa392('0x1a')](function(_0x45bdd6){logger['error'](_0xa392('0x1b'),_0x45bdd6);process[_0xa392('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index da3b116..341ccad 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 _0x3aff=['pauseType','phoneBarRemoteControl','interface','userProfileId','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Unmanaged.','catch','authorization','startsWith','headers','Basic','User','find','authenticate','Wrong\x20credentials.','Bearer','json','User\x20not\x20found.','isAuthenticated','../../config/license/util','getLicense','update','Forbidden','canUpdate','sign','signToken','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','pick','/dashboards/general','../../mysqldb','jsonwebtoken','express-jwt','composable-middleware','basic-auth','ipaddr.js','secrets','session','role','fullname','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause'];(function(_0x12ca16,_0x281fd9){var _0x56fb78=function(_0x3479b2){while(--_0x3479b2){_0x12ca16['push'](_0x12ca16['shift']());}};_0x56fb78(++_0x281fd9);}(_0x3aff,0x12b));var _0xf3af=function(_0x105ee6,_0x5f1768){_0x105ee6=_0x105ee6-0x0;var _0x3856e3=_0x3aff[_0x105ee6];return _0x3856e3;};'use strict';var db=require(_0xf3af('0x0'))['db'];var config=require('../../config/environment');var _=require('lodash');var jwt=require(_0xf3af('0x1'));var expressJwt=require(_0xf3af('0x2'));var compose=require(_0xf3af('0x3'));var basicAuth=require(_0xf3af('0x4'));var ipaddr=require(_0xf3af('0x5'));var validateJwt=expressJwt({'secret':config[_0xf3af('0x6')][_0xf3af('0x7')]});var userAttributes=['id',_0xf3af('0x8'),_0xf3af('0x9'),_0xf3af('0xa'),_0xf3af('0xb'),_0xf3af('0xc'),_0xf3af('0xd'),_0xf3af('0xe'),_0xf3af('0xf'),_0xf3af('0x10'),_0xf3af('0x11'),_0xf3af('0x12'),_0xf3af('0x13'),_0xf3af('0x14'),_0xf3af('0x15'),'showWebBar','phoneBarRemoteControlPort',_0xf3af('0x16'),_0xf3af('0x17'),_0xf3af('0x18')];exports[_0xf3af('0x19')]=function(){return isAuthenticated(!![])[_0xf3af('0x1a')](function(_0x48257a,_0x44c999,_0x57c1c4){if(_0x48257a[_0xf3af('0x1b')]){_0x57c1c4();}else{return db[_0xf3af('0x1c')]['findOne']({'where':{'id':_0x48257a[_0xf3af('0x1d')]['id']},'attributes':['id',_0xf3af('0x1e'),_0xf3af('0x1f')],'raw':!![]})[_0xf3af('0x20')](function(_0x30aaf0){if(_0x30aaf0&&_0x30aaf0[_0xf3af('0x1e')]){return _0x44c999[_0xf3af('0x21')](_0x30aaf0[_0xf3af('0x1f')]===_0xf3af('0x22')?0x195:0x193)['json']({'message':_0x30aaf0['disposition']===_0xf3af('0x22')?_0xf3af('0x23'):'Forbidden.'});}else{_0x57c1c4();}})[_0xf3af('0x24')](function(_0x11a862){_0x57c1c4(_0x11a862);});}});};function isAuthenticated(_0x4ddb22){return compose()[_0xf3af('0x1a')](function(_0x5611a3,_0x4b5c94,_0x2bc5a1){if(_0x5611a3['headers'][_0xf3af('0x25')]){if(_[_0xf3af('0x26')](_0x5611a3[_0xf3af('0x27')][_0xf3af('0x25')],_0xf3af('0x28'))){var _0x1db94f=basicAuth(_0x5611a3);db[_0xf3af('0x29')][_0xf3af('0x2a')]({'where':{'name':_0x1db94f[_0xf3af('0xa')]}})[_0xf3af('0x20')](function(_0x2910ff){if(!_0x2910ff||!_0x2910ff[_0xf3af('0x2b')](_0x1db94f['pass'])){return _0x4b5c94[_0xf3af('0x21')](0x191)['json']({'message':_0xf3af('0x2c')});}_0x5611a3[_0xf3af('0x1b')]={'id':_0x2910ff['id']};_0x2bc5a1();})[_0xf3af('0x24')](function(_0x517e0a){_0x2bc5a1(_0x517e0a);});}else if(_[_0xf3af('0x26')](_0x5611a3[_0xf3af('0x27')]['authorization'],_0xf3af('0x2d'))){validateJwt(_0x5611a3,_0x4b5c94,_0x2bc5a1);}}else{if(_0x4ddb22){_0x2bc5a1();}else{return _0x4b5c94[_0xf3af('0x21')](0x191)[_0xf3af('0x2e')]({'message':'Unknown\x20authorization\x20format.'});}}})[_0xf3af('0x1a')](function(_0x594fae,_0x5782d6,_0x50cfc4){if(_0x594fae[_0xf3af('0x1b')]){db[_0xf3af('0x29')][_0xf3af('0x2a')]({'where':{'id':_0x594fae[_0xf3af('0x1b')]['id']},'attributes':userAttributes})[_0xf3af('0x20')](function(_0x219dd6){if(!_0x219dd6){return _0x5782d6[_0xf3af('0x21')](0x194)[_0xf3af('0x2e')]({'message':_0xf3af('0x2f')});}_0x594fae[_0xf3af('0x1b')]=_0x219dd6;_0x50cfc4();})['catch'](function(_0x336c0e){_0x50cfc4(_0x336c0e);});}else if(_0x4ddb22){_0x50cfc4();}else{return _0x5782d6[_0xf3af('0x21')](0x194)[_0xf3af('0x2e')]({'message':'User\x20object\x20not\x20found.'});}});}exports[_0xf3af('0x30')]=isAuthenticated;function canUpdate(){return compose()[_0xf3af('0x1a')](function(_0x42ea82,_0x2ca0e7,_0x465448){return require(_0xf3af('0x31'))[_0xf3af('0x32')]()[_0xf3af('0x20')](function(_0x51ee23){if(_0x51ee23[_0xf3af('0x33')]){_0x465448();}else{return _0x2ca0e7[_0xf3af('0x21')](0x193)[_0xf3af('0x2e')]({'message':_0xf3af('0x34')});}})['catch'](function(_0x1eeb34){_0x465448(_0x1eeb34);});});}exports[_0xf3af('0x35')]=canUpdate;function signToken(_0xb84247,_0x57a7ca){return jwt[_0xf3af('0x36')]({'id':_0xb84247,'role':_0x57a7ca},config[_0xf3af('0x6')]['session'],{'expiresIn':0x15180});}exports[_0xf3af('0x37')]=signToken;exports[_0xf3af('0x38')]=function(_0x4618e7){if(!_0x4618e7){throw new Error(_0xf3af('0x39'));}return compose()[_0xf3af('0x1a')](isAuthenticated())[_0xf3af('0x1a')](function meetsRequirements(_0x365541,_0x754623,_0x1e235e){if(config[_0xf3af('0x3a')][_0xf3af('0x3b')](_0x365541[_0xf3af('0x1b')][_0xf3af('0x8')])>=config[_0xf3af('0x3a')][_0xf3af('0x3b')](_0x4618e7)){return _0x1e235e();}else{return _0x754623[_0xf3af('0x21')](0x193)[_0xf3af('0x2e')]({'message':_0xf3af('0x34')});}});};exports['setTokenCookie']=function(_0x30e539,_0x366cca){if(!_0x30e539[_0xf3af('0x1b')]){return _0x366cca['status'](0x194)[_0xf3af('0x2e')]({'message':_0xf3af('0x3c')});}var _0x45a9da=signToken(_0x30e539[_0xf3af('0x1b')]['id'],_0x30e539[_0xf3af('0x1b')]['role']);_0x366cca['cookie'](_0xf3af('0x3d'),_0x45a9da);_0x366cca['cookie']('motion.user',JSON['stringify'](_[_0xf3af('0x3e')](_0x30e539[_0xf3af('0x1b')],userAttributes)));_0x366cca['redirect'](_0xf3af('0x3f'));}; \ No newline at end of file +var _0x45af=['use','user','params','closed','disposition','then','status','json','Unmanaged.','Forbidden.','catch','headers','authorization','User','find','authenticate','pass','Wrong\x20credentials.','startsWith','Bearer','User\x20not\x20found.','isAuthenticated','getLicense','update','Forbidden','canUpdate','sign','signToken','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','motion.user','stringify','pick','redirect','/dashboards/general','../../mysqldb','lodash','jsonwebtoken','express-jwt','basic-auth','ipaddr.js','secrets','session','role','fullname','name','email','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','phoneBarRemoteControl','interface','userProfileId','isChatInteractionAuthorized'];(function(_0x319ce5,_0x5ac87d){var _0x2355b5=function(_0x380f9c){while(--_0x380f9c){_0x319ce5['push'](_0x319ce5['shift']());}};_0x2355b5(++_0x5ac87d);}(_0x45af,0x194));var _0xf45a=function(_0x48e730,_0x4a425c){_0x48e730=_0x48e730-0x0;var _0x1ffe13=_0x45af[_0x48e730];return _0x1ffe13;};'use strict';var db=require(_0xf45a('0x0'))['db'];var config=require('../../config/environment');var _=require(_0xf45a('0x1'));var jwt=require(_0xf45a('0x2'));var expressJwt=require(_0xf45a('0x3'));var compose=require('composable-middleware');var basicAuth=require(_0xf45a('0x4'));var ipaddr=require(_0xf45a('0x5'));var validateJwt=expressJwt({'secret':config[_0xf45a('0x6')][_0xf45a('0x7')]});var userAttributes=['id',_0xf45a('0x8'),_0xf45a('0x9'),_0xf45a('0xa'),'internal',_0xf45a('0xb'),'userpic','permissions',_0xf45a('0xc'),_0xf45a('0xd'),_0xf45a('0xe'),_0xf45a('0xf'),'smsPause',_0xf45a('0x10'),_0xf45a('0x11'),_0xf45a('0x12'),'phoneBarRemoteControlPort',_0xf45a('0x13'),_0xf45a('0x14'),_0xf45a('0x15')];exports[_0xf45a('0x16')]=function(){return isAuthenticated(!![])[_0xf45a('0x17')](function(_0x7065b2,_0x3e5563,_0x5ead7a){if(_0x7065b2[_0xf45a('0x18')]){_0x5ead7a();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x7065b2[_0xf45a('0x19')]['id']},'attributes':['id',_0xf45a('0x1a'),_0xf45a('0x1b')],'raw':!![]})[_0xf45a('0x1c')](function(_0x122421){if(_0x122421&&_0x122421['closed']){return _0x3e5563[_0xf45a('0x1d')](_0x122421['disposition']==='unmanaged'?0x195:0x193)[_0xf45a('0x1e')]({'message':_0x122421['disposition']==='unmanaged'?_0xf45a('0x1f'):_0xf45a('0x20')});}else{_0x5ead7a();}})[_0xf45a('0x21')](function(_0x38e201){_0x5ead7a(_0x38e201);});}});};function isAuthenticated(_0xf8dcaa){return compose()[_0xf45a('0x17')](function(_0x590790,_0x565469,_0x4def7c){if(_0x590790[_0xf45a('0x22')]['authorization']){if(_['startsWith'](_0x590790[_0xf45a('0x22')][_0xf45a('0x23')],'Basic')){var _0x532d3f=basicAuth(_0x590790);db[_0xf45a('0x24')][_0xf45a('0x25')]({'where':{'name':_0x532d3f[_0xf45a('0xa')]}})[_0xf45a('0x1c')](function(_0x1042fe){if(!_0x1042fe||!_0x1042fe[_0xf45a('0x26')](_0x532d3f[_0xf45a('0x27')])){return _0x565469[_0xf45a('0x1d')](0x191)[_0xf45a('0x1e')]({'message':_0xf45a('0x28')});}_0x590790[_0xf45a('0x18')]={'id':_0x1042fe['id']};_0x4def7c();})[_0xf45a('0x21')](function(_0x14f746){_0x4def7c(_0x14f746);});}else if(_[_0xf45a('0x29')](_0x590790['headers']['authorization'],_0xf45a('0x2a'))){validateJwt(_0x590790,_0x565469,_0x4def7c);}}else{if(_0xf8dcaa){_0x4def7c();}else{return _0x565469[_0xf45a('0x1d')](0x191)[_0xf45a('0x1e')]({'message':'Unknown\x20authorization\x20format.'});}}})[_0xf45a('0x17')](function(_0x1c38df,_0x4fc9d3,_0x3d2576){if(_0x1c38df[_0xf45a('0x18')]){db[_0xf45a('0x24')][_0xf45a('0x25')]({'where':{'id':_0x1c38df[_0xf45a('0x18')]['id']},'attributes':userAttributes})[_0xf45a('0x1c')](function(_0x32d443){if(!_0x32d443){return _0x4fc9d3[_0xf45a('0x1d')](0x194)[_0xf45a('0x1e')]({'message':_0xf45a('0x2b')});}_0x1c38df[_0xf45a('0x18')]=_0x32d443;_0x3d2576();})['catch'](function(_0x10acad){_0x3d2576(_0x10acad);});}else if(_0xf8dcaa){_0x3d2576();}else{return _0x4fc9d3[_0xf45a('0x1d')](0x194)[_0xf45a('0x1e')]({'message':'User\x20object\x20not\x20found.'});}});}exports[_0xf45a('0x2c')]=isAuthenticated;function canUpdate(){return compose()['use'](function(_0x10cac8,_0x557ef0,_0xeeafff){return require('../../config/license/util')[_0xf45a('0x2d')]()['then'](function(_0x1337db){if(_0x1337db[_0xf45a('0x2e')]){_0xeeafff();}else{return _0x557ef0[_0xf45a('0x1d')](0x193)[_0xf45a('0x1e')]({'message':_0xf45a('0x2f')});}})[_0xf45a('0x21')](function(_0x5d10ce){_0xeeafff(_0x5d10ce);});});}exports[_0xf45a('0x30')]=canUpdate;function signToken(_0x4b4702,_0x23b59e){return jwt[_0xf45a('0x31')]({'id':_0x4b4702,'role':_0x23b59e},config[_0xf45a('0x6')][_0xf45a('0x7')],{'expiresIn':0x15180});}exports[_0xf45a('0x32')]=signToken;exports['hasRole']=function(_0x59e3c9){if(!_0x59e3c9){throw new Error(_0xf45a('0x33'));}return compose()['use'](isAuthenticated())[_0xf45a('0x17')](function meetsRequirements(_0x3cba2a,_0x1e3bc2,_0x3294a0){if(config[_0xf45a('0x34')]['indexOf'](_0x3cba2a['user'][_0xf45a('0x8')])>=config[_0xf45a('0x34')]['indexOf'](_0x59e3c9)){return _0x3294a0();}else{return _0x1e3bc2[_0xf45a('0x1d')](0x193)[_0xf45a('0x1e')]({'message':_0xf45a('0x2f')});}});};exports[_0xf45a('0x35')]=function(_0xfa82f4,_0x6874a4){if(!_0xfa82f4['user']){return _0x6874a4['status'](0x194)[_0xf45a('0x1e')]({'message':_0xf45a('0x36')});}var _0x458926=signToken(_0xfa82f4[_0xf45a('0x18')]['id'],_0xfa82f4[_0xf45a('0x18')][_0xf45a('0x8')]);_0x6874a4['cookie'](_0xf45a('0x37'),_0x458926);_0x6874a4['cookie'](_0xf45a('0x38'),JSON[_0xf45a('0x39')](_[_0xf45a('0x3a')](_0xfa82f4[_0xf45a('0x18')],userAttributes)));_0x6874a4[_0xf45a('0x3b')](_0xf45a('0x3c'));}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 492bd82..8eb506c 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 _0xdd82=['crypto','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','algorithm','binary','write','end','final','close','decryptFile','createDecipher','data','update','unlink'];(function(_0x4955fe,_0x5aad5b){var _0x352374=function(_0x45db75){while(--_0x45db75){_0x4955fe['push'](_0x4955fe['shift']());}};_0x352374(++_0x5aad5b);}(_0xdd82,0xcc));var _0x2dd8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdd82[_0x432682];return _0x463d05;};'use strict';var crypto=require(_0x2dd8('0x0'));var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x2dd8('0x1')};function combineOptions(_0x2b6349){var _0x461ca4={};for(var _0x3db2d0 in defaultOptions){if(defaultOptions[_0x2dd8('0x2')](_0x3db2d0)){_0x461ca4[_0x3db2d0]=defaultOptions[_0x3db2d0];}}if(_0x2b6349){for(var _0x574cfe in _0x2b6349){if(_0x2b6349[_0x2dd8('0x2')](_0x574cfe)){_0x461ca4[_0x574cfe]=_0x2b6349[_0x574cfe];}}}return _0x461ca4;}exports[_0x2dd8('0x3')]=function(_0x43d567,_0x24a840,_0x2a7024,_0x2fe749){return new BPromise(function(_0x368da5,_0xb59ccd){_0x2fe749=combineOptions(_0x2fe749);var _0x5c470e=new Buffer(_0x2a7024);var _0x2f81ac=fs[_0x2dd8('0x4')](_0x43d567);var _0x27d647=fs[_0x2dd8('0x5')](_0x24a840);var _0x27b7da=crypto['createCipher'](_0x2fe749[_0x2dd8('0x6')],_0x5c470e);_0x2f81ac['on']('data',function(_0xf0137e){var _0x30774d=new Buffer(_0x27b7da['update'](_0xf0137e),_0x2dd8('0x7'));_0x27d647[_0x2dd8('0x8')](_0x30774d);});_0x2f81ac['on'](_0x2dd8('0x9'),function(){try{var _0x494bc3=new Buffer(_0x27b7da[_0x2dd8('0xa')]('binary'),_0x2dd8('0x7'));_0x27d647[_0x2dd8('0x8')](_0x494bc3);_0x27d647['end']();_0x27d647['on'](_0x2dd8('0xb'),function(){return _0x368da5(_0x24a840);});}catch(_0x36dc95){fs['unlink'](_0x24a840);return _0xb59ccd(_0x36dc95);}});});};exports[_0x2dd8('0xc')]=function(_0x16f97f,_0x2bed76,_0x53a7c6,_0x21fb17){return new BPromise(function(_0x29e97f,_0x303738){_0x21fb17=combineOptions(_0x21fb17);var _0x571958=new Buffer(_0x53a7c6);var _0x1400ff=fs[_0x2dd8('0x4')](_0x16f97f);var _0x516240=fs[_0x2dd8('0x5')](_0x2bed76);var _0xc4bf98=crypto[_0x2dd8('0xd')](_0x21fb17[_0x2dd8('0x6')],_0x571958);_0x1400ff['on'](_0x2dd8('0xe'),function(_0x52867a){var _0x374bb3=new Buffer(_0xc4bf98[_0x2dd8('0xf')](_0x52867a),_0x2dd8('0x7'));_0x516240[_0x2dd8('0x8')](_0x374bb3);});_0x1400ff['on'](_0x2dd8('0x9'),function(){try{var _0x2263d8=new Buffer(_0xc4bf98[_0x2dd8('0xa')](_0x2dd8('0x7')),_0x2dd8('0x7'));_0x516240[_0x2dd8('0x8')](_0x2263d8);_0x516240[_0x2dd8('0x9')]();_0x516240['on']('close',function(){return _0x29e97f(_0x2bed76);});}catch(_0x139da4){fs[_0x2dd8('0x10')](_0x2bed76);return _0x303738(_0x139da4);}});});}; \ No newline at end of file +var _0x272c=['close','decryptFile','createWriteStream','createDecipher','data','unlink','crypto','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','update','binary','write','end','final'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0x272c,0x96));var _0xc272=function(_0x1d28f7,_0x279b64){_0x1d28f7=_0x1d28f7-0x0;var _0x1394e5=_0x272c[_0x1d28f7];return _0x1394e5;};'use strict';var crypto=require(_0xc272('0x0'));var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0xc272('0x1')};function combineOptions(_0x132c16){var _0x35542d={};for(var _0x5a9e1a in defaultOptions){if(defaultOptions[_0xc272('0x2')](_0x5a9e1a)){_0x35542d[_0x5a9e1a]=defaultOptions[_0x5a9e1a];}}if(_0x132c16){for(var _0x79c562 in _0x132c16){if(_0x132c16[_0xc272('0x2')](_0x79c562)){_0x35542d[_0x79c562]=_0x132c16[_0x79c562];}}}return _0x35542d;}exports[_0xc272('0x3')]=function(_0x3ec3bd,_0x4ca766,_0xba032,_0x43de34){return new BPromise(function(_0x5c9927,_0x392166){_0x43de34=combineOptions(_0x43de34);var _0x1cf94b=new Buffer(_0xba032);var _0x1cd1cb=fs[_0xc272('0x4')](_0x3ec3bd);var _0x231016=fs['createWriteStream'](_0x4ca766);var _0x3aeeb7=crypto[_0xc272('0x5')](_0x43de34[_0xc272('0x6')],_0x1cf94b);_0x1cd1cb['on']('data',function(_0x56dae9){var _0x3f0abf=new Buffer(_0x3aeeb7[_0xc272('0x7')](_0x56dae9),_0xc272('0x8'));_0x231016[_0xc272('0x9')](_0x3f0abf);});_0x1cd1cb['on'](_0xc272('0xa'),function(){try{var _0x29c9e5=new Buffer(_0x3aeeb7[_0xc272('0xb')](_0xc272('0x8')),'binary');_0x231016[_0xc272('0x9')](_0x29c9e5);_0x231016[_0xc272('0xa')]();_0x231016['on'](_0xc272('0xc'),function(){return _0x5c9927(_0x4ca766);});}catch(_0x1586d0){fs['unlink'](_0x4ca766);return _0x392166(_0x1586d0);}});});};exports[_0xc272('0xd')]=function(_0x415754,_0x4b66f7,_0x20d3c6,_0x13c59f){return new BPromise(function(_0xf4b534,_0x45e5e4){_0x13c59f=combineOptions(_0x13c59f);var _0x159dbc=new Buffer(_0x20d3c6);var _0x487cfa=fs[_0xc272('0x4')](_0x415754);var _0x47d47c=fs[_0xc272('0xe')](_0x4b66f7);var _0x1d46c9=crypto[_0xc272('0xf')](_0x13c59f[_0xc272('0x6')],_0x159dbc);_0x487cfa['on'](_0xc272('0x10'),function(_0x39722f){var _0x35cee9=new Buffer(_0x1d46c9[_0xc272('0x7')](_0x39722f),_0xc272('0x8'));_0x47d47c[_0xc272('0x9')](_0x35cee9);});_0x487cfa['on']('end',function(){try{var _0x14710c=new Buffer(_0x1d46c9[_0xc272('0xb')](_0xc272('0x8')),_0xc272('0x8'));_0x47d47c[_0xc272('0x9')](_0x14710c);_0x47d47c['end']();_0x47d47c['on'](_0xc272('0xc'),function(){return _0xf4b534(_0x4b66f7);});}catch(_0x48b024){fs[_0xc272('0x11')](_0x4b66f7);return _0x45e5e4(_0x48b024);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d0037f3..97e28ac 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 _0xc797=['basename','length','existsSync','join','mkdirSync','each','push','%s%d.%s','csv','%s.%s','writeFileSync','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','bluebird','rimraf','../../mysqldb','dbH','analytics','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','split','then','splitSizeCsv','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0xc797,0x10c));var _0x7c79=function(_0xfe91e7,_0xcc1702){_0xfe91e7=_0xfe91e7-0x0;var _0x37bea6=_0xc797[_0xfe91e7];return _0x37bea6;};'use strict';var util=require('util');var path=require(_0x7c79('0x0'));var _=require(_0x7c79('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x7c79('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x7c79('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7c79('0x4'))[_0x7c79('0x5')];var logger=require('../../config/logger')(_0x7c79('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x3a3bbd,_0x1c44fb){var _0x4d588b={'status':_0x3a3bbd};var _0x5119cf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c44fb){_0x4d588b[_0x7c79('0x7')]=_0x1c44fb;}return db[_0x7c79('0x8')][_0x7c79('0x9')](_0x4d588b,_0x5119cf);}function main(){var _0x83bb4c=0x1388;var _0x146e31;logger[_0x7c79('0xa')](util[_0x7c79('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7c79('0xc')));return db[_0x7c79('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7c79('0xe'),'splitSizeCsv']})[_0x7c79('0xf')](function(_0x416221){if(_0x416221){_0x146e31=_0x416221;_0x83bb4c=_0x146e31[_0x7c79('0x10')]||0x1388;}})[_0x7c79('0xf')](function(){return dbH['sequelize']['query'](util[_0x7c79('0xb')](_0x7c79('0x11'),QUERY),{'type':dbH[_0x7c79('0x12')][_0x7c79('0x13')][_0x7c79('0x14')]});})['then'](function(_0x42f7b1){if(!_0x42f7b1[0x0][_0x7c79('0x15')]){return analyticExtractedReport(_0x7c79('0x16'));}var _0x45a8a8=[];var _0x44fd7a=0x0;var _0x42cc9c=!![];if(_0x42f7b1&&_0x42f7b1['length']){var _0x41a8fb=_0x42f7b1[0x0][_0x7c79('0x15')]%(_0x44fd7a+_0x83bb4c);if(_0x146e31[_0x7c79('0xe')]){for(;_0x42cc9c;_0x44fd7a+=_0x83bb4c,_0x41a8fb=_0x42f7b1[0x0]['num']%(_0x44fd7a+_0x83bb4c)){if(_0x41a8fb==0x0||_0x41a8fb==_0x42f7b1[0x0]['num']){_0x42cc9c=![];}_0x45a8a8['push'](dbH[_0x7c79('0x12')][_0x7c79('0x17')](util['format'](_0x7c79('0x18'),QUERY,_0x83bb4c,_0x44fd7a),{'type':dbH[_0x7c79('0x12')]['QueryTypes']['SELECT']}));}}else{_0x45a8a8['push'](dbH[_0x7c79('0x12')][_0x7c79('0x17')](QUERY,{'type':dbH[_0x7c79('0x12')][_0x7c79('0x13')][_0x7c79('0x14')]}));}}var _0x5d604b=path[_0x7c79('0x19')](PATH);var _0x2b03d0=path[_0x7c79('0x1a')](PATH,'.csv');var _0x1d6186=_0x146e31[_0x7c79('0xe')]&&_0x45a8a8[_0x7c79('0x1b')]>0x1;var _0x52d88c=[];if(!fs[_0x7c79('0x1c')](path[_0x7c79('0x1d')](_0x5d604b,_0x2b03d0))&&_0x1d6186){fs[_0x7c79('0x1e')](path[_0x7c79('0x1d')](_0x5d604b,_0x2b03d0));}return BPromise[_0x7c79('0x1f')](_0x45a8a8,function(_0x422ec8){_0x52d88c[_0x7c79('0x20')](_0x422ec8);})['then'](function(){for(var _0x25e300=0x0;_0x25e300<_0x52d88c[_0x7c79('0x1b')];_0x25e300+=0x1){var _0x2e9804;var _0x3d6df6=_0x52d88c[_0x25e300];if(_0x1d6186){_0x2e9804=path[_0x7c79('0x1d')](_0x5d604b,_0x2b03d0,util[_0x7c79('0xb')](_0x7c79('0x21'),_0x2b03d0,_0x25e300,_0x7c79('0x22')));}else{_0x2e9804=path[_0x7c79('0x1d')](_0x5d604b,util[_0x7c79('0xb')](_0x7c79('0x23'),_0x2b03d0,_0x7c79('0x22')));}fs[_0x7c79('0x24')](_0x2e9804,csv(_0x3d6df6));}})[_0x7c79('0xf')](function(){if(_0x1d6186){zipdir(path['join'](_0x5d604b,_0x2b03d0),{'saveTo':path[_0x7c79('0x1d')](_0x5d604b,util[_0x7c79('0xb')](_0x7c79('0x23'),_0x2b03d0,_0x7c79('0x25')))},function(_0x3f48ec,_0x4710f6){});rimraf(path['join'](_0x5d604b,_0x2b03d0),function(){});}})[_0x7c79('0xf')](function(){logger['info'](util[_0x7c79('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x7c79('0xc')));return analyticExtractedReport('Completed',_0x1d6186?util[_0x7c79('0xb')]('%s.%s',_0x2b03d0,_0x1d6186?'zip':_0x7c79('0x22')):null);});})[_0x7c79('0x26')](function(_0x4a9d75){logger[_0x7c79('0xa')](util[_0x7c79('0xb')](_0x7c79('0x27'),EXTRACTED_REPORT_ID,_0x7c79('0xc')),util[_0x7c79('0x28')](_0x4a9d75,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x7c79('0x29'));});}main(); \ No newline at end of file +var _0x9287=['savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','splitSizeCsv','sequelize','query','SELECT','num','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','length','existsSync','join','each','then','csv','%s.%s','writeFileSync','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','Failed','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv'];(function(_0x2e3e10,_0x4e239d){var _0x17edc4=function(_0x2ce8fb){while(--_0x2ce8fb){_0x2e3e10['push'](_0x2e3e10['shift']());}};_0x17edc4(++_0x4e239d);}(_0x9287,0x14d));var _0x7928=function(_0x27f39d,_0x5efee5){_0x27f39d=_0x27f39d-0x0;var _0x355e1e=_0x9287[_0x27f39d];return _0x355e1e;};'use strict';var util=require('util');var path=require(_0x7928('0x0'));var _=require(_0x7928('0x1'));var csv=require(_0x7928('0x2'));var fs=require('fs');var BPromise=require(_0x7928('0x3'));var zipdir=require(_0x7928('0x4'));var rimraf=require(_0x7928('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7928('0x6'))[_0x7928('0x7')];var logger=require(_0x7928('0x8'))(_0x7928('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x7928('0xa')][0x3];var PATH=process[_0x7928('0xa')][0x4];function analyticExtractedReport(_0x44e991,_0x13c512){var _0x51ef89={'status':_0x44e991};var _0x5dcd77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x13c512){_0x51ef89[_0x7928('0xb')]=_0x13c512;}return db[_0x7928('0xc')]['update'](_0x51ef89,_0x5dcd77);}function main(){var _0x4e9fa6=0x1388;var _0xe04dbe;logger['info'](util[_0x7928('0xd')](_0x7928('0xe'),EXTRACTED_REPORT_ID,_0x7928('0xf')));return db[_0x7928('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x7928('0x11')]})['then'](function(_0x2566e6){if(_0x2566e6){_0xe04dbe=_0x2566e6;_0x4e9fa6=_0xe04dbe[_0x7928('0x11')]||0x1388;}})['then'](function(){return dbH[_0x7928('0x12')][_0x7928('0x13')](util[_0x7928('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x7928('0x14')]});})['then'](function(_0x579083){if(!_0x579083[0x0][_0x7928('0x15')]){return analyticExtractedReport('Empty');}var _0x28620a=[];var _0x5f1008=0x0;var _0x48dd6d=!![];if(_0x579083&&_0x579083['length']){var _0x338153=_0x579083[0x0]['num']%(_0x5f1008+_0x4e9fa6);if(_0xe04dbe[_0x7928('0x16')]){for(;_0x48dd6d;_0x5f1008+=_0x4e9fa6,_0x338153=_0x579083[0x0][_0x7928('0x15')]%(_0x5f1008+_0x4e9fa6)){if(_0x338153==0x0||_0x338153==_0x579083[0x0][_0x7928('0x15')]){_0x48dd6d=![];}_0x28620a[_0x7928('0x17')](dbH[_0x7928('0x12')][_0x7928('0x13')](util['format'](_0x7928('0x18'),QUERY,_0x4e9fa6,_0x5f1008),{'type':dbH['sequelize']['QueryTypes'][_0x7928('0x14')]}));}}else{_0x28620a[_0x7928('0x17')](dbH[_0x7928('0x12')][_0x7928('0x13')](QUERY,{'type':dbH[_0x7928('0x12')][_0x7928('0x19')][_0x7928('0x14')]}));}}var _0x16f485=path[_0x7928('0x1a')](PATH);var _0x632c90=path[_0x7928('0x1b')](PATH,_0x7928('0x1c'));var _0x472b26=_0xe04dbe[_0x7928('0x16')]&&_0x28620a[_0x7928('0x1d')]>0x1;var _0x55756b=[];if(!fs[_0x7928('0x1e')](path[_0x7928('0x1f')](_0x16f485,_0x632c90))&&_0x472b26){fs['mkdirSync'](path[_0x7928('0x1f')](_0x16f485,_0x632c90));}return BPromise[_0x7928('0x20')](_0x28620a,function(_0x23cbb0){_0x55756b[_0x7928('0x17')](_0x23cbb0);})[_0x7928('0x21')](function(){for(var _0x1d7980=0x0;_0x1d7980<_0x55756b[_0x7928('0x1d')];_0x1d7980+=0x1){var _0x4cdcca;var _0x4d1390=_0x55756b[_0x1d7980];if(_0x472b26){_0x4cdcca=path[_0x7928('0x1f')](_0x16f485,_0x632c90,util[_0x7928('0xd')]('%s%d.%s',_0x632c90,_0x1d7980,_0x7928('0x22')));}else{_0x4cdcca=path['join'](_0x16f485,util['format'](_0x7928('0x23'),_0x632c90,_0x7928('0x22')));}fs[_0x7928('0x24')](_0x4cdcca,csv(_0x4d1390));}})[_0x7928('0x21')](function(){if(_0x472b26){zipdir(path[_0x7928('0x1f')](_0x16f485,_0x632c90),{'saveTo':path[_0x7928('0x1f')](_0x16f485,util[_0x7928('0xd')](_0x7928('0x23'),_0x632c90,_0x7928('0x25')))},function(_0x89ceeb,_0x2904eb){});rimraf(path['join'](_0x16f485,_0x632c90),function(){});}})[_0x7928('0x21')](function(){logger[_0x7928('0x26')](util['format'](_0x7928('0x27'),EXTRACTED_REPORT_ID,_0x7928('0xf')));return analyticExtractedReport('Completed',_0x472b26?util['format']('%s.%s',_0x632c90,_0x472b26?_0x7928('0x25'):_0x7928('0x22')):null);});})[_0x7928('0x28')](function(_0x40d967){logger[_0x7928('0x26')](util[_0x7928('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7928('0xf')),util[_0x7928('0x29')](_0x40d967,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x7928('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 3b03e98..205b14c 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 _0x2e8e=['argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','hasOwnProperty','push','tableHeader','num','Empty','dirname','.pdf','Setting','find','splitSizePdf','then','length','split','format','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','existsSync','join','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','landscape','header','black','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','pipe','finish','error','err','end','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','query','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','bluebird','util','moment','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','dbH','analytics'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x2e8e,0x18e));var _0xe2e8=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x2e8e[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0xe2e8('0x0'));var fs=require('fs');var BPromise=require(_0xe2e8('0x1'));var util=require(_0xe2e8('0x2'));var path=require('path');var moment=require(_0xe2e8('0x3'));var PdfPrinter=require(_0xe2e8('0x4'));var zipdir=require(_0xe2e8('0x5'));var rimraf=require(_0xe2e8('0x6'));var db=require(_0xe2e8('0x7'))['db'];var dbH=require(_0xe2e8('0x7'))[_0xe2e8('0x8')];var logger=require('../../config/logger')(_0xe2e8('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe2e8('0xa')][0x3];var PATH=process[_0xe2e8('0xa')][0x4];var NAME=process[_0xe2e8('0xa')][0x5];var FORMAT=_0xe2e8('0xb');var _extractedReport;function analyticExtractedReport(_0x33b2b2,_0x2ded7f){var _0x413294={'status':_0x33b2b2};var _0x506efa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ded7f){_0x413294[_0xe2e8('0xc')]=_0x2ded7f;}return db['AnalyticExtractedReport'][_0xe2e8('0xd')](_0x413294,_0x506efa);}function getHeader(_0x3e3030){var _0x45837b=[];for(var _0x12273f in _0x3e3030){if(_0x3e3030[_0xe2e8('0xe')](_0x12273f)){_0x45837b[_0xe2e8('0xf')]({'text':_0x12273f,'style':_0xe2e8('0x10')});}}return _0x45837b;}function extractReport(_0x47d04c){var _0x4876d7=0x1388;var _0x6cdc1d;if(!_0x47d04c[0x0][_0xe2e8('0x11')]){return analyticExtractedReport(_0xe2e8('0x12'));}var _0x59a2bc=[];var _0x3475de=0x0;var _0x7b677=!![];var _0x2a08dc=path[_0xe2e8('0x13')](PATH);var _0x11c2e2=path['basename'](PATH,_0xe2e8('0x14'));var _0x355578=![];var _0x1b76eb=[];return db[_0xe2e8('0x15')][_0xe2e8('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe2e8('0x17')]})['then'](function(_0x49a11b){if(_0x49a11b){_0x6cdc1d=_0x49a11b;_0x4876d7=_0x6cdc1d['splitSizePdf']||0x3e8;}})[_0xe2e8('0x18')](function(){if(_0x47d04c&&_0x47d04c[_0xe2e8('0x19')]){var _0x56a241=_0x47d04c[0x0]['num']%(_0x3475de+_0x4876d7);if(_0x6cdc1d[_0xe2e8('0x1a')]){for(;_0x7b677;_0x3475de+=_0x4876d7,_0x56a241=_0x47d04c[0x0]['num']%(_0x3475de+_0x4876d7)){if(_0x56a241==0x0||_0x56a241==_0x47d04c[0x0]['num']){_0x7b677=![];}_0x59a2bc[_0xe2e8('0xf')](dbH['sequelize']['query'](util[_0xe2e8('0x1b')](_0xe2e8('0x1c'),QUERY,_0x4876d7,_0x3475de),{'type':dbH[_0xe2e8('0x1d')][_0xe2e8('0x1e')]['SELECT']}));}}else{_0x59a2bc[_0xe2e8('0xf')](dbH[_0xe2e8('0x1d')]['query'](QUERY,{'type':dbH['sequelize'][_0xe2e8('0x1e')][_0xe2e8('0x1f')]}));}}_0x355578=_0x6cdc1d[_0xe2e8('0x1a')]&&_0x59a2bc[_0xe2e8('0x19')]>0x1;if(!fs[_0xe2e8('0x20')](path[_0xe2e8('0x21')](_0x2a08dc,_0x11c2e2))&&_0x355578){fs['mkdirSync'](path[_0xe2e8('0x21')](_0x2a08dc,_0x11c2e2));}return BPromise[_0xe2e8('0x22')](_0x59a2bc,function(_0x32d606){_0x1b76eb['push'](_0x32d606);});})[_0xe2e8('0x18')](function(){return BPromise[_0xe2e8('0x22')](_0x59a2bc,function(_0x695ba6,_0x1355ef){var _0xb0cfd9;var _0x53b3db=util[_0xe2e8('0x1b')](_0xe2e8('0x23'),NAME,_extractedReport['name'],moment(_extractedReport[_0xe2e8('0x24')])['format'](FORMAT),moment(_extractedReport['endDate'])['format'](FORMAT));var _0x59d472={'pageSize':'A4','pageOrientation':_0xe2e8('0x25'),'content':[{'text':_0x53b3db,'style':_0xe2e8('0x26')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xe2e8('0x27')}}};var _0x3a0878={'headerRows':0x1,'body':[]};_0x3a0878[_0xe2e8('0x28')][_0xe2e8('0xf')](getHeader(_0x695ba6[0x0]));var _0x444fd9;for(var _0x40e990=0x0;_0x40e990<_0x695ba6['length'];_0x40e990+=0x1){_0x444fd9=[];for(var _0x3ac8e8 in _0x695ba6[_0x40e990]){if(_0x695ba6[_0x40e990][_0xe2e8('0xe')](_0x3ac8e8)){_0x444fd9[_0xe2e8('0xf')](_0x695ba6[_0x40e990][_0x3ac8e8]?_[_0xe2e8('0x29')](_0x695ba6[_0x40e990][_0x3ac8e8]):'');}}_0x3a0878[_0xe2e8('0x28')]['push'](_0x444fd9);}_0x59d472[_0xe2e8('0x2a')][_0xe2e8('0xf')]({'table':_0x3a0878});return new BPromise(function(_0x432cc7,_0x535b92){var _0x4908ad=new PdfPrinter({'Roboto':{'normal':__dirname+_0xe2e8('0x2b'),'bold':__dirname+_0xe2e8('0x2c'),'italics':__dirname+_0xe2e8('0x2d'),'bolditalics':__dirname+'/fonts/Roboto-MediumItalic.ttf'}});var _0x33a04c=_0x4908ad[_0xe2e8('0x2e')](_0x59d472);if(_0x355578){_0xb0cfd9=path[_0xe2e8('0x21')](_0x2a08dc,_0x11c2e2,util[_0xe2e8('0x1b')](_0xe2e8('0x2f'),_0x11c2e2,_0x1355ef,_0xe2e8('0x30')));}else{_0xb0cfd9=path['join'](_0x2a08dc,util['format'](_0xe2e8('0x31'),_0x11c2e2,_0xe2e8('0x30')));}var _0x180c51=_0x33a04c[_0xe2e8('0x32')](fs['createWriteStream'](_0xb0cfd9));_0x180c51['on'](_0xe2e8('0x33'),function(){_0x432cc7();});_0x180c51['on'](_0xe2e8('0x34'),function(_0x229e00){console['log'](_0xe2e8('0x35'),_0x229e00);_0x535b92(_0x229e00);});_0x33a04c[_0xe2e8('0x36')]();});});})['then'](function(){if(_0x355578){return new BPromise(function(_0x509a8a,_0x196480){zipdir(path[_0xe2e8('0x21')](_0x2a08dc,_0x11c2e2),{'saveTo':path[_0xe2e8('0x21')](_0x2a08dc,util[_0xe2e8('0x1b')]('%s.%s',_0x11c2e2,'zip'))},function(_0x7e1c6a){if(_0x7e1c6a){_0x196480(_0x7e1c6a);}else{_0x509a8a();}});});}})[_0xe2e8('0x18')](function(){if(_0x355578){rimraf(path[_0xe2e8('0x21')](_0x2a08dc,_0x11c2e2),function(){});}})['then'](function(){logger['info'](util[_0xe2e8('0x1b')](_0xe2e8('0x37'),EXTRACTED_REPORT_ID,_0xe2e8('0x38')));return analyticExtractedReport(_0xe2e8('0x39'),_0x355578?util[_0xe2e8('0x1b')](_0xe2e8('0x31'),_0x11c2e2,_0x355578?_0xe2e8('0x3a'):_0xe2e8('0x30')):null);});}function main(){logger[_0xe2e8('0x3b')](util[_0xe2e8('0x1b')](_0xe2e8('0x3c'),EXTRACTED_REPORT_ID,_0xe2e8('0x3d')));return db[_0xe2e8('0x3e')][_0xe2e8('0x3f')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xe2e8('0x18')](function(_0x166658){_extractedReport=_0x166658;return dbH[_0xe2e8('0x1d')][_0xe2e8('0x40')](util[_0xe2e8('0x1b')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe2e8('0x1d')]['QueryTypes'][_0xe2e8('0x1f')]});})[_0xe2e8('0x18')](extractReport)[_0xe2e8('0x41')](function(_0x3ca17e){logger['info'](util[_0xe2e8('0x1b')](_0xe2e8('0x42'),EXTRACTED_REPORT_ID,_0xe2e8('0x3d')),util['inspect'](_0x3ca17e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe2e8('0x43'));});}main(); \ No newline at end of file +var _0x3c3c=['err','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','info','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','num','sequelize','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','push','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','header','black','length','toString','body','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x3c3c,0x18b));var _0xc3c3=function(_0x4636f9,_0x31deff){_0x4636f9=_0x4636f9-0x0;var _0x1419cd=_0x3c3c[_0x4636f9];return _0x1419cd;};'use strict';var _=require('lodash');var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xc3c3('0x0'));var path=require(_0xc3c3('0x1'));var moment=require(_0xc3c3('0x2'));var PdfPrinter=require(_0xc3c3('0x3'));var zipdir=require(_0xc3c3('0x4'));var rimraf=require(_0xc3c3('0x5'));var db=require(_0xc3c3('0x6'))['db'];var dbH=require(_0xc3c3('0x6'))['dbH'];var logger=require(_0xc3c3('0x7'))(_0xc3c3('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xc3c3('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc3c3('0x9')][0x4];var NAME=process[_0xc3c3('0x9')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var _extractedReport;function analyticExtractedReport(_0x42e9eb,_0x50c0c0){var _0x4df890={'status':_0x42e9eb};var _0x6e4722={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50c0c0){_0x4df890[_0xc3c3('0xa')]=_0x50c0c0;}return db[_0xc3c3('0xb')][_0xc3c3('0xc')](_0x4df890,_0x6e4722);}function getHeader(_0x205574){var _0x2c8a26=[];for(var _0x1b5315 in _0x205574){if(_0x205574[_0xc3c3('0xd')](_0x1b5315)){_0x2c8a26['push']({'text':_0x1b5315,'style':_0xc3c3('0xe')});}}return _0x2c8a26;}function extractReport(_0x244178){var _0x159d8a=0x1388;var _0x134f02;if(!_0x244178[0x0]['num']){return analyticExtractedReport(_0xc3c3('0xf'));}var _0x11cf30=[];var _0x27eff0=0x0;var _0x38b25e=!![];var _0x5acc6d=path[_0xc3c3('0x10')](PATH);var _0x622fc4=path[_0xc3c3('0x11')](PATH,_0xc3c3('0x12'));var _0x5ab1ac=![];var _0x2fb8a8=[];return db[_0xc3c3('0x13')][_0xc3c3('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc3c3('0x15'),_0xc3c3('0x16')]})['then'](function(_0x1eae40){if(_0x1eae40){_0x134f02=_0x1eae40;_0x159d8a=_0x134f02['splitSizePdf']||0x3e8;}})[_0xc3c3('0x17')](function(){if(_0x244178&&_0x244178['length']){var _0x53eb7b=_0x244178[0x0][_0xc3c3('0x18')]%(_0x27eff0+_0x159d8a);if(_0x134f02[_0xc3c3('0x15')]){for(;_0x38b25e;_0x27eff0+=_0x159d8a,_0x53eb7b=_0x244178[0x0][_0xc3c3('0x18')]%(_0x27eff0+_0x159d8a)){if(_0x53eb7b==0x0||_0x53eb7b==_0x244178[0x0]['num']){_0x38b25e=![];}_0x11cf30['push'](dbH[_0xc3c3('0x19')][_0xc3c3('0x1a')](util[_0xc3c3('0x1b')](_0xc3c3('0x1c'),QUERY,_0x159d8a,_0x27eff0),{'type':dbH[_0xc3c3('0x19')][_0xc3c3('0x1d')][_0xc3c3('0x1e')]}));}}else{_0x11cf30[_0xc3c3('0x1f')](dbH[_0xc3c3('0x19')][_0xc3c3('0x1a')](QUERY,{'type':dbH[_0xc3c3('0x19')][_0xc3c3('0x1d')][_0xc3c3('0x1e')]}));}}_0x5ab1ac=_0x134f02[_0xc3c3('0x15')]&&_0x11cf30['length']>0x1;if(!fs['existsSync'](path[_0xc3c3('0x20')](_0x5acc6d,_0x622fc4))&&_0x5ab1ac){fs[_0xc3c3('0x21')](path[_0xc3c3('0x20')](_0x5acc6d,_0x622fc4));}return BPromise[_0xc3c3('0x22')](_0x11cf30,function(_0x10897c){_0x2fb8a8['push'](_0x10897c);});})[_0xc3c3('0x17')](function(){return BPromise['each'](_0x11cf30,function(_0x12593c,_0x34224f){var _0xb45f90;var _0x17b4df=util[_0xc3c3('0x1b')](_0xc3c3('0x23'),NAME,_extractedReport[_0xc3c3('0x24')],moment(_extractedReport['startDate'])[_0xc3c3('0x1b')](FORMAT),moment(_extractedReport[_0xc3c3('0x25')])[_0xc3c3('0x1b')](FORMAT));var _0x5b24e8={'pageSize':'A4','pageOrientation':_0xc3c3('0x26'),'content':[{'text':_0x17b4df,'style':_0xc3c3('0x27')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc3c3('0x28')}}};var _0x132dfe={'headerRows':0x1,'body':[]};_0x132dfe['body'][_0xc3c3('0x1f')](getHeader(_0x12593c[0x0]));var _0x39547c;for(var _0x460efa=0x0;_0x460efa<_0x12593c[_0xc3c3('0x29')];_0x460efa+=0x1){_0x39547c=[];for(var _0x1829c9 in _0x12593c[_0x460efa]){if(_0x12593c[_0x460efa][_0xc3c3('0xd')](_0x1829c9)){_0x39547c[_0xc3c3('0x1f')](_0x12593c[_0x460efa][_0x1829c9]?_[_0xc3c3('0x2a')](_0x12593c[_0x460efa][_0x1829c9]):'');}}_0x132dfe[_0xc3c3('0x2b')][_0xc3c3('0x1f')](_0x39547c);}_0x5b24e8['content'][_0xc3c3('0x1f')]({'table':_0x132dfe});return new BPromise(function(_0x20a746,_0x57f5fa){var _0x2eb179=new PdfPrinter({'Roboto':{'normal':__dirname+_0xc3c3('0x2c'),'bold':__dirname+_0xc3c3('0x2d'),'italics':__dirname+'/fonts/Roboto-Italic.ttf','bolditalics':__dirname+'/fonts/Roboto-MediumItalic.ttf'}});var _0x580b37=_0x2eb179[_0xc3c3('0x2e')](_0x5b24e8);if(_0x5ab1ac){_0xb45f90=path[_0xc3c3('0x20')](_0x5acc6d,_0x622fc4,util[_0xc3c3('0x1b')]('%s%d.%s',_0x622fc4,_0x34224f,_0xc3c3('0x2f')));}else{_0xb45f90=path[_0xc3c3('0x20')](_0x5acc6d,util[_0xc3c3('0x1b')](_0xc3c3('0x30'),_0x622fc4,'pdf'));}var _0x1f52f4=_0x580b37[_0xc3c3('0x31')](fs[_0xc3c3('0x32')](_0xb45f90));_0x1f52f4['on'](_0xc3c3('0x33'),function(){_0x20a746();});_0x1f52f4['on']('error',function(_0x22bf3f){console[_0xc3c3('0x34')](_0xc3c3('0x35'),_0x22bf3f);_0x57f5fa(_0x22bf3f);});_0x580b37['end']();});});})['then'](function(){if(_0x5ab1ac){return new BPromise(function(_0x16579b,_0x56e8e5){zipdir(path['join'](_0x5acc6d,_0x622fc4),{'saveTo':path[_0xc3c3('0x20')](_0x5acc6d,util[_0xc3c3('0x1b')](_0xc3c3('0x30'),_0x622fc4,_0xc3c3('0x36')))},function(_0x5b3101){if(_0x5b3101){_0x56e8e5(_0x5b3101);}else{_0x16579b();}});});}})[_0xc3c3('0x17')](function(){if(_0x5ab1ac){rimraf(path[_0xc3c3('0x20')](_0x5acc6d,_0x622fc4),function(){});}})[_0xc3c3('0x17')](function(){logger['info'](util['format'](_0xc3c3('0x37'),EXTRACTED_REPORT_ID,_0xc3c3('0x38')));return analyticExtractedReport('Completed',_0x5ab1ac?util[_0xc3c3('0x1b')](_0xc3c3('0x30'),_0x622fc4,_0x5ab1ac?_0xc3c3('0x36'):_0xc3c3('0x2f')):null);});}function main(){logger[_0xc3c3('0x39')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc3c3('0x3a')));return db[_0xc3c3('0xb')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0xf58db4){_extractedReport=_0xf58db4;return dbH[_0xc3c3('0x19')]['query'](util['format'](_0xc3c3('0x3b'),QUERY),{'type':dbH[_0xc3c3('0x19')][_0xc3c3('0x1d')][_0xc3c3('0x1e')]});})[_0xc3c3('0x17')](extractReport)[_0xc3c3('0x3c')](function(_0x546fe2){logger['info'](util['format'](_0xc3c3('0x3d'),EXTRACTED_REPORT_ID,_0xc3c3('0x3a')),util[_0xc3c3('0x3e')](_0x546fe2,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xc3c3('0x3f'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 85f0b47..ece1e49 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 _0x849d=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','lodash','rimraf','../../mysqldb','dbH','../../config/logger','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','length','join','mkdirSync','xlsx','writeFileSync','%s.%s','zip'];(function(_0x1bbe6c,_0x56d18a){var _0x76ab07=function(_0x220f14){while(--_0x220f14){_0x1bbe6c['push'](_0x1bbe6c['shift']());}};_0x76ab07(++_0x56d18a);}(_0x849d,0x161));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var path=require('path');var _=require(_0xd849('0x0'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xd849('0x1'));var db=require(_0xd849('0x2'))['db'];var dbH=require(_0xd849('0x2'))[_0xd849('0x3')];var logger=require(_0xd849('0x4'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd849('0x5')][0x3];var PATH=process[_0xd849('0x5')][0x4];function analyticExtractedReport(_0x20921d,_0x5020ed){var _0x335ff2={'status':_0x20921d};var _0x32d64e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5020ed){_0x335ff2['savename']=_0x5020ed;}return db['AnalyticExtractedReport'][_0xd849('0x6')](_0x335ff2,_0x32d64e);}function main(){var _0x3e6750=0x1388;var _0x4837f7;logger[_0xd849('0x7')](util[_0xd849('0x8')](_0xd849('0x9'),EXTRACTED_REPORT_ID,_0xd849('0xa')));return db['Setting'][_0xd849('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd849('0xc'),_0xd849('0xd')]})[_0xd849('0xe')](function(_0x46d592){if(_0x46d592){_0x4837f7=_0x46d592;_0x3e6750=_0x4837f7[_0xd849('0xd')]||0x1388;}})[_0xd849('0xe')](function(){return dbH[_0xd849('0xf')][_0xd849('0x10')](util[_0xd849('0x8')](_0xd849('0x11'),QUERY),{'type':dbH['sequelize'][_0xd849('0x12')][_0xd849('0x13')]});})['then'](function(_0x348762){if(!_0x348762[0x0][_0xd849('0x14')]){return analyticExtractedReport(_0xd849('0x15'));}var _0x1c1a3f=[];var _0xb737ee=0x0;var _0x36c76f=!![];if(_0x4837f7['split']){if(_0x348762&&_0x348762['length']){var _0x47c787=_0x348762[0x0][_0xd849('0x14')]%(_0xb737ee+_0x3e6750);for(;_0x36c76f;_0xb737ee+=_0x3e6750,_0x47c787=_0x348762[0x0][_0xd849('0x14')]%(_0xb737ee+_0x3e6750)){if(_0x47c787==0x0||_0x47c787==_0x348762[0x0][_0xd849('0x14')]){_0x36c76f=![];}_0x1c1a3f['push'](dbH['sequelize'][_0xd849('0x10')](util['format'](_0xd849('0x16'),QUERY,_0x3e6750,_0xb737ee),{'type':dbH[_0xd849('0xf')][_0xd849('0x12')]['SELECT']}));}}}else{_0x1c1a3f[_0xd849('0x17')](dbH[_0xd849('0xf')]['query'](QUERY,{'type':dbH[_0xd849('0xf')][_0xd849('0x12')][_0xd849('0x13')]}));}var _0x4e9ebb=path[_0xd849('0x18')](PATH);var _0x36a338=path['basename'](PATH,'.xlsx');var _0x4b9d4f=_0x4837f7['split']&&_0x1c1a3f[_0xd849('0x19')]>0x1;var _0x4bcd1b=[];if(!fs['existsSync'](path[_0xd849('0x1a')](_0x4e9ebb,_0x36a338))&&_0x4b9d4f){fs[_0xd849('0x1b')](path['join'](_0x4e9ebb,_0x36a338));}return BPromise['each'](_0x1c1a3f,function(_0x5cb0ad){_0x4bcd1b['push'](_0x5cb0ad);})[_0xd849('0xe')](function(){for(var _0x48ece8=0x0;_0x48ece8<_0x4bcd1b[_0xd849('0x19')];_0x48ece8+=0x1){var _0x53d485;var _0x4283cf=_0x4bcd1b[_0x48ece8];if(_0x4b9d4f){_0x53d485=path[_0xd849('0x1a')](_0x4e9ebb,_0x36a338,util[_0xd849('0x8')]('%s%d.%s',_0x36a338,_0x48ece8,'xlsx'));}else{_0x53d485=path[_0xd849('0x1a')](_0x4e9ebb,util[_0xd849('0x8')]('%s.%s',_0x36a338,_0xd849('0x1c')));}fs[_0xd849('0x1d')](_0x53d485,json2xls(_0x4283cf),'binary');}})[_0xd849('0xe')](function(){if(_0x4b9d4f){zipdir(path[_0xd849('0x1a')](_0x4e9ebb,_0x36a338),{'saveTo':path[_0xd849('0x1a')](_0x4e9ebb,util[_0xd849('0x8')](_0xd849('0x1e'),_0x36a338,_0xd849('0x1f')))},function(_0x5f0cd4,_0x461b65){});rimraf(path[_0xd849('0x1a')](_0x4e9ebb,_0x36a338),function(){});}})['then'](function(){logger[_0xd849('0x7')](util[_0xd849('0x8')](_0xd849('0x20'),EXTRACTED_REPORT_ID,_0xd849('0xa')));return analyticExtractedReport(_0xd849('0x21'),_0x4b9d4f?util[_0xd849('0x8')](_0xd849('0x1e'),_0x36a338,_0x4b9d4f?'zip':_0xd849('0x1c')):null);});})[_0xd849('0x22')](function(_0x237d80){logger['info'](util[_0xd849('0x8')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd849('0xa')),util['inspect'](_0x237d80,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x714b=['QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','zip-dir','rimraf','../../mysqldb','dbH','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x714b,0x72));var _0xb714=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x714b[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0xb714('0x0'));var path=require(_0xb714('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xb714('0x2'));var rimraf=require(_0xb714('0x3'));var db=require(_0xb714('0x4'))['db'];var dbH=require(_0xb714('0x4'))[_0xb714('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb714('0x6')][0x3];var PATH=process[_0xb714('0x6')][0x4];function analyticExtractedReport(_0x34565b,_0x58b7e6){var _0x1dabf4={'status':_0x34565b};var _0x8ce37b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x58b7e6){_0x1dabf4['savename']=_0x58b7e6;}return db[_0xb714('0x7')][_0xb714('0x8')](_0x1dabf4,_0x8ce37b);}function main(){var _0x46517a=0x1388;var _0x140745;logger[_0xb714('0x9')](util[_0xb714('0xa')](_0xb714('0xb'),EXTRACTED_REPORT_ID,_0xb714('0xc')));return db[_0xb714('0xd')][_0xb714('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb714('0xf'),_0xb714('0x10')]})[_0xb714('0x11')](function(_0x161782){if(_0x161782){_0x140745=_0x161782;_0x46517a=_0x140745[_0xb714('0x10')]||0x1388;}})[_0xb714('0x11')](function(){return dbH[_0xb714('0x12')][_0xb714('0x13')](util[_0xb714('0xa')](_0xb714('0x14'),QUERY),{'type':dbH[_0xb714('0x12')][_0xb714('0x15')][_0xb714('0x16')]});})[_0xb714('0x11')](function(_0x23ce87){if(!_0x23ce87[0x0][_0xb714('0x17')]){return analyticExtractedReport(_0xb714('0x18'));}var _0x5ebb21=[];var _0x53a9ca=0x0;var _0x41ee1f=!![];if(_0x140745[_0xb714('0xf')]){if(_0x23ce87&&_0x23ce87[_0xb714('0x19')]){var _0xa19dd9=_0x23ce87[0x0]['num']%(_0x53a9ca+_0x46517a);for(;_0x41ee1f;_0x53a9ca+=_0x46517a,_0xa19dd9=_0x23ce87[0x0][_0xb714('0x17')]%(_0x53a9ca+_0x46517a)){if(_0xa19dd9==0x0||_0xa19dd9==_0x23ce87[0x0][_0xb714('0x17')]){_0x41ee1f=![];}_0x5ebb21[_0xb714('0x1a')](dbH[_0xb714('0x12')][_0xb714('0x13')](util['format'](_0xb714('0x1b'),QUERY,_0x46517a,_0x53a9ca),{'type':dbH[_0xb714('0x12')][_0xb714('0x15')][_0xb714('0x16')]}));}}}else{_0x5ebb21['push'](dbH[_0xb714('0x12')][_0xb714('0x13')](QUERY,{'type':dbH[_0xb714('0x12')][_0xb714('0x15')]['SELECT']}));}var _0x234dd9=path[_0xb714('0x1c')](PATH);var _0x4aadbf=path[_0xb714('0x1d')](PATH,_0xb714('0x1e'));var _0x3d0aa7=_0x140745['split']&&_0x5ebb21[_0xb714('0x19')]>0x1;var _0x6a4545=[];if(!fs['existsSync'](path['join'](_0x234dd9,_0x4aadbf))&&_0x3d0aa7){fs[_0xb714('0x1f')](path[_0xb714('0x20')](_0x234dd9,_0x4aadbf));}return BPromise[_0xb714('0x21')](_0x5ebb21,function(_0x2343d5){_0x6a4545[_0xb714('0x1a')](_0x2343d5);})[_0xb714('0x11')](function(){for(var _0x5a9f44=0x0;_0x5a9f44<_0x6a4545[_0xb714('0x19')];_0x5a9f44+=0x1){var _0x5ec0fd;var _0x313e23=_0x6a4545[_0x5a9f44];if(_0x3d0aa7){_0x5ec0fd=path[_0xb714('0x20')](_0x234dd9,_0x4aadbf,util['format'](_0xb714('0x22'),_0x4aadbf,_0x5a9f44,_0xb714('0x23')));}else{_0x5ec0fd=path['join'](_0x234dd9,util[_0xb714('0xa')](_0xb714('0x24'),_0x4aadbf,_0xb714('0x23')));}fs[_0xb714('0x25')](_0x5ec0fd,json2xls(_0x313e23),_0xb714('0x26'));}})[_0xb714('0x11')](function(){if(_0x3d0aa7){zipdir(path['join'](_0x234dd9,_0x4aadbf),{'saveTo':path['join'](_0x234dd9,util[_0xb714('0xa')](_0xb714('0x24'),_0x4aadbf,_0xb714('0x27')))},function(_0x54c6cd,_0x19c5e7){});rimraf(path[_0xb714('0x20')](_0x234dd9,_0x4aadbf),function(){});}})[_0xb714('0x11')](function(){logger[_0xb714('0x9')](util[_0xb714('0xa')](_0xb714('0x28'),EXTRACTED_REPORT_ID,_0xb714('0xc')));return analyticExtractedReport('Completed',_0x3d0aa7?util[_0xb714('0xa')](_0xb714('0x24'),_0x4aadbf,_0x3d0aa7?_0xb714('0x27'):_0xb714('0x23')):null);});})[_0xb714('0x29')](function(_0x2b6673){logger[_0xb714('0x9')](util[_0xb714('0xa')](_0xb714('0x2a'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xb714('0x2b')](_0x2b6673,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xb714('0x2c'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d376eeb..440ded4 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 _0xda01=['then','intervals','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','groupBy','exten','queue','playback','answer','progress','priority','extensions','push','type','context','Set','format','CDR(type)=%s','VoiceExtensionId','length','createdAt','updatedAt','interval','*,*,*,*','filter','hasOwnProperty','tag','callerID','CALLERID(all)=','app','toLowerCase','custom','Answer','Progress','record','MixMonitor','${UNIQUEID}.','recordingFormat','StopMixMonitor','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','Interval','findAll'];(function(_0x2381e4,_0x5aa4b9){var _0x18ce47=function(_0x348d70){while(--_0x348d70){_0x2381e4['push'](_0x2381e4['shift']());}};_0x18ce47(++_0x5aa4b9);}(_0xda01,0xa6));var _0x1da0=function(_0x53e5ff,_0x15220f){_0x53e5ff=_0x53e5ff-0x0;var _0x15a03c=_0xda01[_0x53e5ff];return _0x15a03c;};'use strict';var _=require(_0x1da0('0x0'));var util=require(_0x1da0('0x1'));function rewrite(_0x50d5e1,_0x2e03a8){var _0x768f76=this;return _0x50d5e1[_0x1da0('0x2')][_0x1da0('0x3')][_0x1da0('0x4')]({'raw':!![]})[_0x1da0('0x5')](function(_0x45eaa8){_0x768f76[_0x1da0('0x6')]=_0x45eaa8;return _0x50d5e1[_0x1da0('0x2')][_0x1da0('0x7')][_0x1da0('0x4')]({'where':{'IntervalId':_0x2e03a8[_0x1da0('0x8')]},'raw':!![]});})[_0x1da0('0x5')](function(_0x4e9891){return _0x50d5e1['models'][_0x1da0('0x7')][_0x1da0('0x4')]({'where':{'exten':{'$in':_[_0x1da0('0x9')](_[_0x1da0('0xa')](_0x4e9891,'exten'))},'isApp':!![]},'order':[{'raw':_0x1da0('0xb')}],'raw':!![]});})[_0x1da0('0x5')](function(_0x1dee52){var _0xcfdc6b=_[_0x1da0('0xc')](_0x1dee52,_0x1da0('0xd'));var _0x26e07b=[_0x1da0('0xe'),_0x1da0('0xf')];var _0x4217c6=[];var _0x5aa0ee=[];for(var _0x4a7e70 in _0xcfdc6b){if(_0xcfdc6b['hasOwnProperty'](_0x4a7e70)){_0x768f76[_0x1da0('0x10')]=![];_0x768f76[_0x1da0('0x11')]=![];_0x768f76[_0x1da0('0x12')]=0x2;_0x768f76[_0x1da0('0x13')]=[];_0x768f76[_0x1da0('0x13')][_0x1da0('0x14')]({'type':_0xcfdc6b[_0x4a7e70][0x0][_0x1da0('0x15')],'context':_0xcfdc6b[_0x4a7e70][0x0][_0x1da0('0x16')],'exten':_0xcfdc6b[_0x4a7e70][0x0]['exten'],'priority':_0x768f76['priority']++,'app':_0x1da0('0x17'),'appdata':util[_0x1da0('0x18')](_0x1da0('0x19'),_0xcfdc6b[_0x4a7e70][0x0]['type']),'VoiceExtensionId':_0xcfdc6b[_0x4a7e70][0x0][_0x1da0('0x1a')]});for(var _0x21e840=0x0,_0xad36e0=0x0;_0x21e840<_0xcfdc6b[_0x4a7e70][_0x1da0('0x1b')];_0x21e840+=0x1,_0xad36e0=0x0){var _0x1bc220=_0xcfdc6b[_0x4a7e70][_0x21e840];var _0x56ba16=[];var _0x125a82=[];delete _0x1bc220['id'];delete _0x1bc220[_0x1da0('0x1c')];delete _0x1bc220[_0x1da0('0x1d')];var _0x29eb2f=_0x1bc220[_0x1da0('0x1e')]!==_0x1da0('0x1f')?[_0x1bc220[_0x1da0('0x1e')]]:_0x1bc220[_0x1da0('0x8')]?_[_0x1da0('0xa')](_[_0x1da0('0x20')](_0x768f76[_0x1da0('0x6')],{'IntervalId':_0x1bc220['IntervalId']}),_0x1da0('0x1e')):[];if(_0x1bc220[_0x1da0('0x21')](_0x1da0('0x22'))){if(_0x1bc220[_0x1da0('0x22')]&&_0x1bc220[_0x1da0('0x22')]!=='--'){_0x56ba16['push']({'type':_0x1bc220['type'],'app':_0x1da0('0x17'),'appdata':'CDR(tag)='+_0x1bc220['tag'],'context':_0x1bc220['context'],'exten':_0x1bc220[_0x1da0('0xd')],'priority':_0x29eb2f[_0x1da0('0x1b')]+_0x768f76[_0x1da0('0x12')]+_0xad36e0++,'VoiceExtensionId':_0xcfdc6b[_0x4a7e70][0x0][_0x1da0('0x1a')]});}}if(_0x1bc220[_0x1da0('0x21')](_0x1da0('0x23'))){if(_0x1bc220['callerID']){_0x56ba16[_0x1da0('0x14')]({'type':_0x1bc220[_0x1da0('0x15')],'app':_0x1da0('0x17'),'appdata':_0x1da0('0x24')+_0x1bc220[_0x1da0('0x23')],'context':_0x1bc220[_0x1da0('0x16')],'exten':_0x1bc220['exten'],'priority':_0x29eb2f[_0x1da0('0x1b')]+_0x768f76[_0x1da0('0x12')]+_0xad36e0++,'VoiceExtensionId':_0xcfdc6b[_0x4a7e70][0x0]['VoiceExtensionId']});}}if(_0x1bc220['hasOwnProperty'](_0x1da0('0x10'))){if(_0x26e07b['indexOf'](_0x1bc220[_0x1da0('0x25')][_0x1da0('0x26')]())>=0x0&&_0x1bc220['appType']!==_0x1da0('0x27')){if(!_0x768f76[_0x1da0('0x10')]&&_0x1bc220[_0x1da0('0x10')]){_0x768f76[_0x1da0('0x10')]=!![];_0x56ba16[_0x1da0('0x14')]({'type':_0x1bc220[_0x1da0('0x15')],'app':_0x1da0('0x28'),'context':_0x1bc220[_0x1da0('0x16')],'exten':_0x1bc220[_0x1da0('0xd')],'priority':_0x29eb2f[_0x1da0('0x1b')]+_0x768f76[_0x1da0('0x12')]+_0xad36e0++,'VoiceExtensionId':_0xcfdc6b[_0x4a7e70][0x0][_0x1da0('0x1a')]});}if(!_0x768f76['answer']&&!_0x768f76[_0x1da0('0x11')]&&!_0x1bc220[_0x1da0('0x10')]){_0x768f76['progress']=!![];_0x56ba16[_0x1da0('0x14')]({'type':_0x1bc220[_0x1da0('0x15')],'app':_0x1da0('0x29'),'context':_0x1bc220[_0x1da0('0x16')],'exten':_0x1bc220[_0x1da0('0xd')],'priority':_0x29eb2f[_0x1da0('0x1b')]+_0x768f76['priority']+_0xad36e0++,'VoiceExtensionId':_0xcfdc6b[_0x4a7e70][0x0]['VoiceExtensionId']});}}}if(_0x1bc220[_0x1da0('0x21')](_0x1da0('0x2a'))&&_0x1bc220[_0x1da0('0x21')]('recordingFormat')){if(_0x1bc220[_0x1da0('0x2a')]){_0x56ba16['push']({'type':_0x1bc220[_0x1da0('0x15')],'app':_0x1da0('0x2b'),'appdata':_0x1da0('0x2c')+_0x1bc220['recordingFormat']+',ab','context':_0x1bc220[_0x1da0('0x16')],'exten':_0x1bc220[_0x1da0('0xd')],'priority':_0x29eb2f['length']+_0x768f76[_0x1da0('0x12')]+_0xad36e0++,'VoiceExtensionId':_0xcfdc6b[_0x4a7e70][0x0]['VoiceExtensionId']});}}if(_0x1bc220[_0x1da0('0x21')](_0x1da0('0x2a'))&&_0x1bc220[_0x1da0('0x21')](_0x1da0('0x2d'))){if(_0x1bc220['record']){_0x125a82[_0x1da0('0x14')]({'type':_0x1bc220[_0x1da0('0x15')],'app':_0x1da0('0x2e'),'appdata':null,'context':_0x1bc220[_0x1da0('0x16')],'exten':_0x1bc220[_0x1da0('0xd')],'priority':_0x29eb2f['length']+_0x768f76[_0x1da0('0x12')]+_0xad36e0++ +0x1,'VoiceExtensionId':_0xcfdc6b[_0x4a7e70][0x0][_0x1da0('0x1a')]});}}for(var _0x1df77e=0x0;_0x1df77e<_0x29eb2f[_0x1da0('0x1b')];_0x1df77e+=0x1){var _0x79e57b=_0x768f76['priority']+_0x29eb2f['length'];var _0x295d60=_0x1df77e===_0x29eb2f[_0x1da0('0x1b')]-0x1?_0x768f76[_0x1da0('0x12')]+_0x56ba16[_0x1da0('0x1b')]+_0x125a82[_0x1da0('0x1b')]+0x2:_0x768f76[_0x1da0('0x12')]+_0x1df77e+0x1;_0x56ba16['splice'](_0x1df77e,0x0,{'type':_0x1bc220[_0x1da0('0x15')],'app':_0x1da0('0x2f'),'appdata':_0x29eb2f[_0x1df77e]+'?'+_0x1bc220['context']+',${EXTEN},'+_0x79e57b+':'+_0x1bc220[_0x1da0('0x16')]+_0x1da0('0x30')+_0x295d60,'exten':_0x1bc220[_0x1da0('0xd')],'context':_0x1bc220[_0x1da0('0x16')],'priority':_0x768f76[_0x1da0('0x12')]+_0x1df77e,'VoiceExtensionId':_0xcfdc6b[_0x4a7e70][0x0]['VoiceExtensionId']});}_0x1bc220[_0x1da0('0x12')]=_0x56ba16['length']?_[_0x1da0('0x31')](_0x56ba16)[_0x1da0('0x12')]+0x1:_0x768f76[_0x1da0('0x12')];_0x768f76[_0x1da0('0x12')]=(_0x125a82['length']?_[_0x1da0('0x31')](_0x125a82)['priority']:_0x1bc220[_0x1da0('0x12')])+0x1;_0x768f76['extensions']=_[_0x1da0('0x32')](_0x768f76['extensions'],_0x56ba16,[_0x1bc220],_0x125a82);}_0x768f76['extensions'][_0x1da0('0x14')]({'type':_0xcfdc6b[_0x4a7e70][0x0][_0x1da0('0x15')],'app':'Hangup','exten':_0xcfdc6b[_0x4a7e70][0x0][_0x1da0('0xd')],'context':_0xcfdc6b[_0x4a7e70][0x0]['context'],'priority':_0x768f76['priority'],'VoiceExtensionId':_0xcfdc6b[_0x4a7e70][0x0][_0x1da0('0x1a')]});_0x4217c6[_0x1da0('0x14')](_0xcfdc6b[_0x4a7e70][0x0][_0x1da0('0x1a')]);_0x5aa0ee=_[_0x1da0('0x32')](_0x5aa0ee,_0x768f76['extensions']);}}return _0x50d5e1[_0x1da0('0x33')](function(_0x186abc){return _0x50d5e1[_0x1da0('0x2')]['VoiceExtension'][_0x1da0('0x34')]({'where':{'VoiceExtensionId':{'$in':_0x4217c6}},'transaction':_0x186abc})['then'](function(_0x13da64){return _0x50d5e1[_0x1da0('0x2')][_0x1da0('0x7')][_0x1da0('0x35')](_[_0x1da0('0x36')](_0x5aa0ee,'priority'),{'transaction':_0x186abc});});});})[_0x1da0('0x37')](function(_0x3819ce){console[_0x1da0('0x38')](_0x3819ce);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x18e8=['filter','tag','CDR(tag)=','callerID','CALLERID(all)=','indexOf','app','toLowerCase','appType','custom','Answer','progress','Progress','record','recordingFormat','MixMonitor','${UNIQUEID}.',',ab','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','bulkCreate','sortBy','catch','error','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','queue','hasOwnProperty','answer','priority','extensions','push','type','context','Set','format','CDR(type)=%s','VoiceExtensionId','length','createdAt','updatedAt','interval','*,*,*,*'];(function(_0x3fb1a8,_0x126f3f){var _0x5dd35d=function(_0x307b51){while(--_0x307b51){_0x3fb1a8['push'](_0x3fb1a8['shift']());}};_0x5dd35d(++_0x126f3f);}(_0x18e8,0x139));var _0x818e=function(_0x1cd9dc,_0x87cdd1){_0x1cd9dc=_0x1cd9dc-0x0;var _0x5788bf=_0x18e8[_0x1cd9dc];return _0x5788bf;};'use strict';var _=require('lodash');var util=require(_0x818e('0x0'));function rewrite(_0x338986,_0x3b5ccd){var _0x1ccad2=this;return _0x338986[_0x818e('0x1')][_0x818e('0x2')][_0x818e('0x3')]({'raw':!![]})['then'](function(_0x64a70e){_0x1ccad2[_0x818e('0x4')]=_0x64a70e;return _0x338986[_0x818e('0x1')][_0x818e('0x5')]['findAll']({'where':{'IntervalId':_0x3b5ccd[_0x818e('0x6')]},'raw':!![]});})[_0x818e('0x7')](function(_0x11a4c3){return _0x338986['models'][_0x818e('0x5')][_0x818e('0x3')]({'where':{'exten':{'$in':_[_0x818e('0x8')](_[_0x818e('0x9')](_0x11a4c3,_0x818e('0xa')))},'isApp':!![]},'order':[{'raw':_0x818e('0xb')}],'raw':!![]});})['then'](function(_0x2bebf0){var _0x49bed5=_['groupBy'](_0x2bebf0,_0x818e('0xa'));var _0x31564c=[_0x818e('0xc'),'playback'];var _0x116c98=[];var _0x32deb4=[];for(var _0x12330b in _0x49bed5){if(_0x49bed5[_0x818e('0xd')](_0x12330b)){_0x1ccad2[_0x818e('0xe')]=![];_0x1ccad2['progress']=![];_0x1ccad2[_0x818e('0xf')]=0x2;_0x1ccad2['extensions']=[];_0x1ccad2[_0x818e('0x10')][_0x818e('0x11')]({'type':_0x49bed5[_0x12330b][0x0][_0x818e('0x12')],'context':_0x49bed5[_0x12330b][0x0][_0x818e('0x13')],'exten':_0x49bed5[_0x12330b][0x0][_0x818e('0xa')],'priority':_0x1ccad2[_0x818e('0xf')]++,'app':_0x818e('0x14'),'appdata':util[_0x818e('0x15')](_0x818e('0x16'),_0x49bed5[_0x12330b][0x0][_0x818e('0x12')]),'VoiceExtensionId':_0x49bed5[_0x12330b][0x0][_0x818e('0x17')]});for(var _0x128418=0x0,_0x22812b=0x0;_0x128418<_0x49bed5[_0x12330b][_0x818e('0x18')];_0x128418+=0x1,_0x22812b=0x0){var _0x1b5221=_0x49bed5[_0x12330b][_0x128418];var _0x25dd03=[];var _0x5bba6b=[];delete _0x1b5221['id'];delete _0x1b5221[_0x818e('0x19')];delete _0x1b5221[_0x818e('0x1a')];var _0x3b7e3b=_0x1b5221[_0x818e('0x1b')]!==_0x818e('0x1c')?[_0x1b5221['interval']]:_0x1b5221[_0x818e('0x6')]?_['map'](_[_0x818e('0x1d')](_0x1ccad2['intervals'],{'IntervalId':_0x1b5221[_0x818e('0x6')]}),'interval'):[];if(_0x1b5221[_0x818e('0xd')](_0x818e('0x1e'))){if(_0x1b5221[_0x818e('0x1e')]&&_0x1b5221[_0x818e('0x1e')]!=='--'){_0x25dd03[_0x818e('0x11')]({'type':_0x1b5221[_0x818e('0x12')],'app':_0x818e('0x14'),'appdata':_0x818e('0x1f')+_0x1b5221[_0x818e('0x1e')],'context':_0x1b5221[_0x818e('0x13')],'exten':_0x1b5221['exten'],'priority':_0x3b7e3b[_0x818e('0x18')]+_0x1ccad2[_0x818e('0xf')]+_0x22812b++,'VoiceExtensionId':_0x49bed5[_0x12330b][0x0][_0x818e('0x17')]});}}if(_0x1b5221['hasOwnProperty'](_0x818e('0x20'))){if(_0x1b5221['callerID']){_0x25dd03['push']({'type':_0x1b5221[_0x818e('0x12')],'app':'Set','appdata':_0x818e('0x21')+_0x1b5221[_0x818e('0x20')],'context':_0x1b5221[_0x818e('0x13')],'exten':_0x1b5221[_0x818e('0xa')],'priority':_0x3b7e3b[_0x818e('0x18')]+_0x1ccad2[_0x818e('0xf')]+_0x22812b++,'VoiceExtensionId':_0x49bed5[_0x12330b][0x0]['VoiceExtensionId']});}}if(_0x1b5221['hasOwnProperty'](_0x818e('0xe'))){if(_0x31564c[_0x818e('0x22')](_0x1b5221[_0x818e('0x23')][_0x818e('0x24')]())>=0x0&&_0x1b5221[_0x818e('0x25')]!==_0x818e('0x26')){if(!_0x1ccad2[_0x818e('0xe')]&&_0x1b5221['answer']){_0x1ccad2[_0x818e('0xe')]=!![];_0x25dd03[_0x818e('0x11')]({'type':_0x1b5221['type'],'app':_0x818e('0x27'),'context':_0x1b5221['context'],'exten':_0x1b5221['exten'],'priority':_0x3b7e3b[_0x818e('0x18')]+_0x1ccad2[_0x818e('0xf')]+_0x22812b++,'VoiceExtensionId':_0x49bed5[_0x12330b][0x0]['VoiceExtensionId']});}if(!_0x1ccad2[_0x818e('0xe')]&&!_0x1ccad2[_0x818e('0x28')]&&!_0x1b5221[_0x818e('0xe')]){_0x1ccad2[_0x818e('0x28')]=!![];_0x25dd03[_0x818e('0x11')]({'type':_0x1b5221[_0x818e('0x12')],'app':_0x818e('0x29'),'context':_0x1b5221[_0x818e('0x13')],'exten':_0x1b5221[_0x818e('0xa')],'priority':_0x3b7e3b[_0x818e('0x18')]+_0x1ccad2[_0x818e('0xf')]+_0x22812b++,'VoiceExtensionId':_0x49bed5[_0x12330b][0x0][_0x818e('0x17')]});}}}if(_0x1b5221[_0x818e('0xd')](_0x818e('0x2a'))&&_0x1b5221[_0x818e('0xd')](_0x818e('0x2b'))){if(_0x1b5221['record']){_0x25dd03[_0x818e('0x11')]({'type':_0x1b5221['type'],'app':_0x818e('0x2c'),'appdata':_0x818e('0x2d')+_0x1b5221[_0x818e('0x2b')]+_0x818e('0x2e'),'context':_0x1b5221[_0x818e('0x13')],'exten':_0x1b5221[_0x818e('0xa')],'priority':_0x3b7e3b[_0x818e('0x18')]+_0x1ccad2[_0x818e('0xf')]+_0x22812b++,'VoiceExtensionId':_0x49bed5[_0x12330b][0x0][_0x818e('0x17')]});}}if(_0x1b5221[_0x818e('0xd')]('record')&&_0x1b5221['hasOwnProperty']('recordingFormat')){if(_0x1b5221[_0x818e('0x2a')]){_0x5bba6b['push']({'type':_0x1b5221[_0x818e('0x12')],'app':'StopMixMonitor','appdata':null,'context':_0x1b5221['context'],'exten':_0x1b5221['exten'],'priority':_0x3b7e3b[_0x818e('0x18')]+_0x1ccad2['priority']+_0x22812b++ +0x1,'VoiceExtensionId':_0x49bed5[_0x12330b][0x0][_0x818e('0x17')]});}}for(var _0x265aeb=0x0;_0x265aeb<_0x3b7e3b['length'];_0x265aeb+=0x1){var _0x4f3229=_0x1ccad2[_0x818e('0xf')]+_0x3b7e3b['length'];var _0x1c4f41=_0x265aeb===_0x3b7e3b['length']-0x1?_0x1ccad2[_0x818e('0xf')]+_0x25dd03['length']+_0x5bba6b['length']+0x2:_0x1ccad2[_0x818e('0xf')]+_0x265aeb+0x1;_0x25dd03[_0x818e('0x2f')](_0x265aeb,0x0,{'type':_0x1b5221['type'],'app':_0x818e('0x30'),'appdata':_0x3b7e3b[_0x265aeb]+'?'+_0x1b5221[_0x818e('0x13')]+_0x818e('0x31')+_0x4f3229+':'+_0x1b5221[_0x818e('0x13')]+_0x818e('0x31')+_0x1c4f41,'exten':_0x1b5221[_0x818e('0xa')],'context':_0x1b5221[_0x818e('0x13')],'priority':_0x1ccad2[_0x818e('0xf')]+_0x265aeb,'VoiceExtensionId':_0x49bed5[_0x12330b][0x0][_0x818e('0x17')]});}_0x1b5221[_0x818e('0xf')]=_0x25dd03['length']?_['last'](_0x25dd03)[_0x818e('0xf')]+0x1:_0x1ccad2[_0x818e('0xf')];_0x1ccad2[_0x818e('0xf')]=(_0x5bba6b[_0x818e('0x18')]?_[_0x818e('0x32')](_0x5bba6b)[_0x818e('0xf')]:_0x1b5221[_0x818e('0xf')])+0x1;_0x1ccad2[_0x818e('0x10')]=_[_0x818e('0x33')](_0x1ccad2['extensions'],_0x25dd03,[_0x1b5221],_0x5bba6b);}_0x1ccad2[_0x818e('0x10')][_0x818e('0x11')]({'type':_0x49bed5[_0x12330b][0x0][_0x818e('0x12')],'app':_0x818e('0x34'),'exten':_0x49bed5[_0x12330b][0x0][_0x818e('0xa')],'context':_0x49bed5[_0x12330b][0x0][_0x818e('0x13')],'priority':_0x1ccad2[_0x818e('0xf')],'VoiceExtensionId':_0x49bed5[_0x12330b][0x0][_0x818e('0x17')]});_0x116c98[_0x818e('0x11')](_0x49bed5[_0x12330b][0x0][_0x818e('0x17')]);_0x32deb4=_[_0x818e('0x33')](_0x32deb4,_0x1ccad2[_0x818e('0x10')]);}}return _0x338986['transaction'](function(_0x2d2845){return _0x338986['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x116c98}},'transaction':_0x2d2845})[_0x818e('0x7')](function(_0x15f57a){return _0x338986[_0x818e('0x1')][_0x818e('0x5')][_0x818e('0x35')](_[_0x818e('0x36')](_0x32deb4,_0x818e('0xf')),{'transaction':_0x2d2845});});});})[_0x818e('0x37')](function(_0x37f682){console[_0x818e('0x38')](_0x37f682);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 9babf31..d083fba 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 _0xbeb6=['lodash','squel','papaparse','ioredis','../../../config/environment','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','find','duplicate','CmContact','create','then','push','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','checkHopper','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','toString','into','fromQuery','str','calleridnum','\x20=\x20?','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0xbeb6,0xd4));var _0x6beb=function(_0x514c5f,_0x4a7757){_0x514c5f=_0x514c5f-0x0;var _0x41b31b=_0xbeb6[_0x514c5f];return _0x41b31b;};'use strict';var BPromise=require(_0x6beb('0x0'));var util=require(_0x6beb('0x1'));var _=require(_0x6beb('0x2'));var fs=require('fs');var squel=require(_0x6beb('0x3'));var Papa=require(_0x6beb('0x4'));var Redis=require(_0x6beb('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x6beb('0x6'));var logger=require('../../../config/logger')(_0x6beb('0x7'));config['redis']=_['defaults'](config[_0x6beb('0x8')],{'host':_0x6beb('0x9'),'port':0x18eb});var socket=require(_0x6beb('0xa'))(new Redis(config['redis']));require(_0x6beb('0xb'))[_0x6beb('0xc')](socket);try{if(!process[_0x6beb('0xd')][0x2]||process['argv'][0x2]===_0x6beb('0xe')||process[_0x6beb('0xd')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x6beb('0xd')][0x2];if(!process[_0x6beb('0xd')][0x3]||process['argv'][0x3]==='undefined'||process[_0x6beb('0xd')][0x3]===_0x6beb('0xf')||!process[_0x6beb('0xd')][0x4]||process[_0x6beb('0xd')][0x4]==='undefined'||process[_0x6beb('0xd')][0x4]===_0x6beb('0xf')){throw new Error(_0x6beb('0x10'));}var FIELDS=_[_0x6beb('0x11')](process['argv'][0x3][_0x6beb('0x12')](','),process[_0x6beb('0xd')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x6beb('0xd')][0x5]===_0x6beb('0xe')||process[_0x6beb('0xd')][0x5]===_0x6beb('0xf')){throw new Error(_0x6beb('0x13'));}var LISTID=process[_0x6beb('0xd')][0x5];var COMPANYID=process[_0x6beb('0xd')][0x6]&&process[_0x6beb('0xd')][0x6]!==_0x6beb('0xe')&&process['argv'][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x6beb('0xd')][0x7]&&process[_0x6beb('0xd')][0x7]!=='undefined'&&process[_0x6beb('0xd')][0x7]!==_0x6beb('0xf')?process[_0x6beb('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0x6beb('0xd')][0x8]==='undefined'||process[_0x6beb('0xd')][0x8]===_0x6beb('0xf')){throw new Error(_0x6beb('0x14'));}var SOCKET_TIMESTAMP=process[_0x6beb('0xd')][0x8];}catch(_0x24ec73){logger[_0x6beb('0x15')](_0x24ec73);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(_0x3001d7,_0x3ff2d4,_0x35f122,_0x39b775){var _0x21d0cc={'message':_0x3ff2d4};_0x21d0cc[_0x3001d7]=!![];if(_0x35f122){_0x21d0cc[_0x6beb('0x16')]=_0x35f122;}if(_0x39b775){_0x21d0cc[_0x6beb('0x17')]=_0x39b775;}return _0x21d0cc;}function isEmail(_0x58b976){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'](_0x58b976);}function checkRow(_0x4b04d9,_0x59d0af,_0x4eff5c){return new BPromise(function(_0x1b60dc,_0x43dc36){if(_[_0x6beb('0x18')](_0x4b04d9)){return _0x43dc36(handleCheckRowError('error',_0x6beb('0x19'),null,_0x4eff5c));}if(_0x4b04d9[_0x6beb('0x1a')]&&_0x4b04d9['errors'][_0x6beb('0x1b')]){var _0x36da7e=_['map'](_0x4b04d9[_0x6beb('0x1a')],'message')[_0x6beb('0x1c')](';');return _0x43dc36(handleCheckRowError('error',_0x36da7e,null,_0x4eff5c));}var _0x1290c5={};for(var _0x9c332e in FIELDS){if(FIELDS[_0x6beb('0x1d')](_0x9c332e)&&FIELDS[_0x9c332e]){_0x1290c5[_0x9c332e]=_0x4b04d9['data'][0x0][FIELDS[_0x9c332e]]||_0x4b04d9[_0x6beb('0x1e')][0x0]['\ufeff'+FIELDS[_0x9c332e]];}}if(!_0x1290c5[_0x6beb('0x1f')]){return _0x43dc36(handleCheckRowError(_0x6beb('0x15'),_0x6beb('0x20'),null,_0x4eff5c));}if(!_0x1290c5['phone']){return _0x43dc36(handleCheckRowError(_0x6beb('0x15'),_0x6beb('0x21'),null,_0x4eff5c));}if(_0x1290c5[_0x6beb('0x22')]){var _0x4bad88=moment(_0x1290c5['birthDate'],'YYYY-MM-DD');if(!_0x4bad88[_0x6beb('0x23')]()){return _0x43dc36(handleCheckRowError(_0x6beb('0x15'),_0x6beb('0x24'),null,_0x4eff5c));}}if(_0x1290c5[_0x6beb('0x25')]){if(!isEmail(_0x1290c5[_0x6beb('0x25')])){return _0x43dc36(handleCheckRowError(_0x6beb('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x4eff5c));}}_0x1290c5[_0x6beb('0x26')]=LISTID;_0x1290c5['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x59d0af){var _0x10b300={};for(var _0xdeaa19=0x0,_0x4b2331=DUPLICATES[_0x6beb('0x1b')];_0xdeaa19<_0x4b2331;_0xdeaa19+=0x1){_0x10b300[DUPLICATES[_0xdeaa19]]=_0x1290c5[DUPLICATES[_0xdeaa19]];}var _0x45729c=_[_0x6beb('0x27')](_0x59d0af,_0x10b300);if(_0x45729c){return _0x43dc36(handleCheckRowError(_0x6beb('0x28'),'Duplicate\x20Contact',_0x45729c,_0x4eff5c));}}return db[_0x6beb('0x29')][_0x6beb('0x2a')](_0x1290c5,{'raw':!![],'hooks':![],'fields':_['keys'](_0x1290c5)})[_0x6beb('0x2b')](function(_0x3103b3){if(DUPLICATES&&DUPLICATES[_0x6beb('0x1b')]&&_0x59d0af){_0x59d0af[_0x6beb('0x2c')](_['pick'](_0x1290c5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3103b3['id'];return _0x1b60dc();})[_0x6beb('0x2d')](function(_0x41ccbc){return _0x43dc36(handleCheckRowError(_0x6beb('0x15'),_0x6beb('0x2e')+(_0x41ccbc[_0x6beb('0x2f')]||JSON[_0x6beb('0x30')](_0x41ccbc)),null,_0x4eff5c));});});}function checkHopper(){function _0x3a114c(){return function(_0x8583b5){logger[_0x6beb('0x15')]('cmContact',_0x6beb('0x31'),util['inspect'](_0x8583b5,{'showHidden':![],'depth':null}));};}var _0x344f9e=function(_0x5eb29d,_0x1a8fa4){var _0x121b82=squel[_0x6beb('0x32')]()['into'](_0x6beb('0x33'))['fromQuery']([_0x6beb('0x34'),'scheduledAt',_0x6beb('0x35'),_0x6beb('0x26'),_0x1a8fa4,_0x6beb('0x36'),_0x6beb('0x37')],squel[_0x6beb('0x38')]()[_0x6beb('0x39')](_0x6beb('0x34'),'phone')[_0x6beb('0x39')](_0x6beb('0x3a'),_0x6beb('0x3b'))[_0x6beb('0x39')]('id',_0x6beb('0x35'))[_0x6beb('0x39')](LISTID['toString'](),_0x6beb('0x26'))[_0x6beb('0x39')](_0x5eb29d['id']['toString'](),_0x1a8fa4)[_0x6beb('0x39')](_0x6beb('0x3a'),_0x6beb('0x36'))[_0x6beb('0x39')](_0x6beb('0x3a'),_0x6beb('0x37'))['from'](_0x6beb('0x3c'))['where'](_0x6beb('0x3d'))[_0x6beb('0x3e')](_0x6beb('0x3f'),LISTID['toString']())[_0x6beb('0x3e')](_0x6beb('0x40'))[_0x6beb('0x3e')](_0x6beb('0x41'),squel[_0x6beb('0x38')]()[_0x6beb('0x39')](_0x6beb('0x34'))[_0x6beb('0x42')](_0x6beb('0x33'))[_0x6beb('0x3e')](_0x1a8fa4+'\x20=\x20?',_0x5eb29d['id']['toString']())))[_0x6beb('0x43')]();return _0x121b82;};var _0x4aefc7=function(_0x43e852,_0x5a4e96){var _0xc98cc=squel[_0x6beb('0x32')]()[_0x6beb('0x44')](_0x6beb('0x33'))[_0x6beb('0x45')]([_0x6beb('0x34'),_0x6beb('0x3b'),'ContactId',_0x6beb('0x26'),_0x5a4e96,_0x6beb('0x36'),_0x6beb('0x37')],squel[_0x6beb('0x38')]()[_0x6beb('0x39')](_0x6beb('0x34'),_0x6beb('0x34'))['field']('NOW()','scheduledAt')[_0x6beb('0x39')]('id','ContactId')['field'](LISTID[_0x6beb('0x43')](),_0x6beb('0x26'))['field'](_0x43e852['id'][_0x6beb('0x43')](),_0x5a4e96)[_0x6beb('0x39')]('NOW()',_0x6beb('0x36'))[_0x6beb('0x39')](_0x6beb('0x3a'),_0x6beb('0x37'))[_0x6beb('0x42')](_0x6beb('0x3c'))['where'](_0x6beb('0x3d'))['where'](_0x6beb('0x3f'),LISTID['toString']())[_0x6beb('0x3e')]('id\x20IN\x20?',squel[_0x6beb('0x46')](hopperContacts))[_0x6beb('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x6beb('0x3e')](_0x6beb('0x41'),squel[_0x6beb('0x38')]()[_0x6beb('0x39')](_0x6beb('0x47'))[_0x6beb('0x42')]('cm_hopper_final')[_0x6beb('0x3e')](_0x5a4e96+_0x6beb('0x48'),_0x43e852['id'][_0x6beb('0x43')]()))[_0x6beb('0x3e')](_0x6beb('0x41'),squel['select']()[_0x6beb('0x39')](_0x6beb('0x34'))[_0x6beb('0x42')](_0x6beb('0x33'))['where'](_0x5a4e96+_0x6beb('0x48'),_0x43e852['id'][_0x6beb('0x43')]())))[_0x6beb('0x43')]();return _0xc98cc;};function _0x122649(_0x202a26,_0x52cb77){var _0x5f3574=squel['insert']()['into'](_0x6beb('0x33'))['fromQuery']([_0x6beb('0x34'),_0x6beb('0x3b'),_0x6beb('0x35'),'ListId',_0x52cb77,_0x6beb('0x36'),_0x6beb('0x37')],squel[_0x6beb('0x38')]()[_0x6beb('0x39')](_0x6beb('0x34'),_0x6beb('0x34'))[_0x6beb('0x39')](_0x6beb('0x3a'),'scheduledAt')[_0x6beb('0x39')]('id',_0x6beb('0x35'))['field'](LISTID[_0x6beb('0x43')](),'ListId')[_0x6beb('0x39')](_0x202a26['id']['toString'](),_0x52cb77)[_0x6beb('0x39')](_0x6beb('0x3a'),_0x6beb('0x36'))[_0x6beb('0x39')](_0x6beb('0x3a'),_0x6beb('0x37'))[_0x6beb('0x42')]('cm_contacts')[_0x6beb('0x3e')](_0x6beb('0x3d'))[_0x6beb('0x3e')](_0x6beb('0x3f'),LISTID[_0x6beb('0x43')]())[_0x6beb('0x3e')](_0x6beb('0x49'),squel[_0x6beb('0x46')](hopperContacts))[_0x6beb('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0x6beb('0x43')]();return _0x5f3574;}function _0x2a5374(_0x1c288e,_0x32a5d7){var _0x3fdae0=squel['insert']()[_0x6beb('0x44')]('cm_hopper_black')[_0x6beb('0x45')]([_0x6beb('0x34'),_0x6beb('0x35'),_0x6beb('0x26'),_0x32a5d7,'createdAt',_0x6beb('0x37')],squel['select']()[_0x6beb('0x39')](_0x6beb('0x34'),_0x6beb('0x34'))[_0x6beb('0x39')]('id','ContactId')[_0x6beb('0x39')](LISTID['toString'](),_0x6beb('0x26'))[_0x6beb('0x39')](_0x1c288e['id'][_0x6beb('0x43')](),_0x32a5d7)[_0x6beb('0x39')](_0x6beb('0x3a'),_0x6beb('0x36'))[_0x6beb('0x39')](_0x6beb('0x3a'),_0x6beb('0x37'))['from']('cm_contacts')[_0x6beb('0x3e')]('deletedAt\x20IS\x20NULL')[_0x6beb('0x3e')](_0x6beb('0x3f'),LISTID[_0x6beb('0x43')]())[_0x6beb('0x3e')](_0x6beb('0x49'),squel[_0x6beb('0x46')](hopperContacts))['where'](_0x6beb('0x40')))[_0x6beb('0x43')]();return _0x3fdae0;}return db[_0x6beb('0x4a')][_0x6beb('0x4b')]({'where':{'type':_0x6beb('0x4c')},'attributes':['id',_0x6beb('0x4d')],'include':[{'model':db[_0x6beb('0x4e')],'as':_0x6beb('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x3b7dbc){var _0x3c2c77=[];if(_0x3b7dbc){var _0x105c22;for(var _0x36e5c7=0x0,_0x2fcc43;_0x36e5c7<_0x3b7dbc[_0x6beb('0x1b')];_0x36e5c7+=0x1){_0x2fcc43=_0x3b7dbc[_0x36e5c7][_0x6beb('0x50')]({'plain':!![]});switch(_0x2fcc43[_0x6beb('0x4d')]){case _0x6beb('0x51'):_0x3c2c77['push'](db[_0x6beb('0x52')][_0x6beb('0x53')](_0x4aefc7(_0x2fcc43,_0x6beb('0x54')))['then'](function(){})[_0x6beb('0x2d')](_0x3a114c()));break;case _0x6beb('0x55'):_0x3c2c77[_0x6beb('0x2c')](db['sequelize'][_0x6beb('0x53')](_0x344f9e(_0x2fcc43,_0x6beb('0x54')))[_0x6beb('0x2b')](function(){})['catch'](_0x3a114c()));break;default:_0x3c2c77[_0x6beb('0x2c')](db[_0x6beb('0x52')][_0x6beb('0x53')](_0x122649(_0x2fcc43,_0x6beb('0x54')))[_0x6beb('0x2b')](function(){})[_0x6beb('0x2d')](_0x3a114c()));}}}return _0x3c2c77;})['all']()[_0x6beb('0x2b')](function(){return db[_0x6beb('0x4a')][_0x6beb('0x4b')]({'where':{'type':_0x6beb('0x4c')},'attributes':['id'],'include':[{'model':db[_0x6beb('0x4e')],'as':_0x6beb('0x56'),'where':{'id':LISTID}}]})[_0x6beb('0x2b')](function(_0x54a675){var _0x38c8b6=[];if(_0x54a675){var _0x101193;for(var _0xcb116b=0x0,_0x202362;_0xcb116b<_0x54a675[_0x6beb('0x1b')];_0xcb116b+=0x1){_0x202362=_0x54a675[_0xcb116b][_0x6beb('0x50')]({'plain':!![]});_0x38c8b6[_0x6beb('0x2c')](db['sequelize'][_0x6beb('0x53')](_0x2a5374(_0x202362,'VoiceQueueId'))['then'](function(){})[_0x6beb('0x2d')](_0x3a114c()));}}return _0x38c8b6;})[_0x6beb('0x57')]();})[_0x6beb('0x2b')](function(){return db[_0x6beb('0x58')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x6beb('0x4f'),'where':{'id':LISTID}}]})[_0x6beb('0x2b')](function(_0x2411ff){var _0x56a441=[];if(_0x2411ff){for(var _0x469ab6=0x0,_0x40d899;_0x469ab6<_0x2411ff[_0x6beb('0x1b')];_0x469ab6+=0x1){_0x40d899=_0x2411ff[_0x469ab6][_0x6beb('0x50')]({'plain':!![]});switch(_0x40d899[_0x6beb('0x4d')]){case'always':_0x56a441['push'](db[_0x6beb('0x52')][_0x6beb('0x53')](_0x4aefc7(_0x40d899,'CampaignId'))[_0x6beb('0x2b')](function(){})[_0x6beb('0x2d')](_0x3a114c()));break;case _0x6beb('0x55'):_0x56a441['push'](db[_0x6beb('0x52')][_0x6beb('0x53')](_0x344f9e(_0x40d899,_0x6beb('0x59')))[_0x6beb('0x2b')](function(){})[_0x6beb('0x2d')](_0x3a114c()));break;default:_0x56a441[_0x6beb('0x2c')](db['sequelize'][_0x6beb('0x53')](_0x122649(_0x40d899,_0x6beb('0x59')))[_0x6beb('0x2b')](function(){})[_0x6beb('0x2d')](_0x3a114c()));}}}return _0x56a441;})[_0x6beb('0x57')]();})['then'](function(){return db[_0x6beb('0x58')][_0x6beb('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x6beb('0x4e')],'as':_0x6beb('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x927407){var _0x3f6905=[];if(_0x927407){for(var _0x12e5a1=0x0,_0x11d679;_0x12e5a1<_0x927407[_0x6beb('0x1b')];_0x12e5a1+=0x1){_0x11d679=_0x927407[_0x12e5a1][_0x6beb('0x50')]({'plain':!![]});_0x3f6905[_0x6beb('0x2c')](db[_0x6beb('0x52')][_0x6beb('0x53')](_0x2a5374(_0x11d679,_0x6beb('0x59')))[_0x6beb('0x2b')](function(){})[_0x6beb('0x2d')](_0x3a114c()));}}return _0x3f6905;})[_0x6beb('0x57')]();})[_0x6beb('0x2d')](function(_0x5b7ca6){logger[_0x6beb('0x15')](_0x6beb('0x5a'),'generalCheckHopper',_0x5b7ca6[_0x6beb('0x2f')]);});}var processPromises=function(_0x411d77){return BPromise['all'](promises)[_0x6beb('0x2b')](function(_0x5d1698){})['catch'](function(_0x44f00e){logger['error'](_0x6beb('0x5b'),JSON[_0x6beb('0x30')](_0x44f00e));})[_0x6beb('0x5c')](function(){socket['emit'](_0x6beb('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x411d77){return _0x411d77[_0x6beb('0x5e')]();}});};var endCsv=function(){return BPromise[_0x6beb('0x5f')]()[_0x6beb('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x6beb('0x2b')](function(){socket[_0x6beb('0x60')](_0x6beb('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6beb('0x61')](FILEPATH);}catch(_0xf59226){logger[_0x6beb('0x15')](_0x6beb('0x62'),JSON[_0x6beb('0x30')](_0xf59226));}finally{process[_0x6beb('0x63')](0x0);}});};process['on'](_0x6beb('0x64'),function(){logger[_0x6beb('0x65')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x6beb('0x5f')]()[_0x6beb('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x6beb('0x29')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6beb('0x2b')](function(_0x588d9c){var _0xd5cb2a=fs[_0x6beb('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6beb('0x67')](_0xd5cb2a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2f861e,_0x1e9ce3){total+=0x1;var _0x37f473=total;promises[_0x6beb('0x2c')](checkRow(_0x2f861e,_0x588d9c,_0x37f473)[_0x6beb('0x2b')](function(){success+=0x1;})[_0x6beb('0x2d')](function(_0x46eae2){if(_0x46eae2[_0x6beb('0x15')]){errors+=0x1;delete _0x46eae2['error'];}else if(_0x46eae2['duplicate']){duplicates+=0x1;delete _0x46eae2[_0x6beb('0x28')];}rows[_0x6beb('0x2c')](_0x46eae2);}));if(total%0xc8===0x0){_0x1e9ce3[_0x6beb('0x68')]();return processPromises(_0x1e9ce3);}},'complete':function(){return processPromises()[_0x6beb('0x2b')](function(){logger[_0x6beb('0x65')](_0x6beb('0x69'));endCsv();});},'error':function(_0x81f836,_0x58e158){logger[_0x6beb('0x65')](_0x6beb('0x6a'),JSON['stringify'](_0x81f836));endCsv();}});})['catch'](function(_0x4b41cd){logger[_0x6beb('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x4b41cd));});}main(); \ No newline at end of file +var _0xaaf3=['CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','scheduledAt','ContactId','updatedAt','field','toString','createdAt','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','from','cm_hopper','into','fromQuery','NOW()','id\x20IN\x20?','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','deletedAt\x20IS\x20NULL','str','VoiceQueue','findAll','dialCheckDuplicateType','CmList','get','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','outbound','BlackLists','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','contact:csv_','resume','resolve','emit','SIGINT','info','createReadStream','parse','duplicate','pause'];(function(_0x938fee,_0x1868f1){var _0x4f7367=function(_0x4f0ab9){while(--_0x4f0ab9){_0x938fee['push'](_0x938fee['shift']());}};_0x4f7367(++_0x1868f1);}(_0xaaf3,0xe1));var _0x3aaf=function(_0x4984ae,_0x3895c3){_0x4984ae=_0x4984ae-0x0;var _0x513811=_0xaaf3[_0x4984ae];return _0x513811;};'use strict';var BPromise=require(_0x3aaf('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x3aaf('0x1'));var Papa=require(_0x3aaf('0x2'));var Redis=require(_0x3aaf('0x3'));var db=require(_0x3aaf('0x4'))['db'];var config=require(_0x3aaf('0x5'));var logger=require('../../../config/logger')(_0x3aaf('0x6'));config[_0x3aaf('0x7')]=_[_0x3aaf('0x8')](config[_0x3aaf('0x7')],{'host':_0x3aaf('0x9'),'port':0x18eb});var socket=require(_0x3aaf('0xa'))(new Redis(config[_0x3aaf('0x7')]));require(_0x3aaf('0xb'))['register'](socket);try{if(!process[_0x3aaf('0xc')][0x2]||process[_0x3aaf('0xc')][0x2]===_0x3aaf('0xd')||process[_0x3aaf('0xc')][0x2]===_0x3aaf('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x3aaf('0xc')][0x2];if(!process[_0x3aaf('0xc')][0x3]||process[_0x3aaf('0xc')][0x3]==='undefined'||process['argv'][0x3]===_0x3aaf('0xe')||!process['argv'][0x4]||process[_0x3aaf('0xc')][0x4]===_0x3aaf('0xd')||process[_0x3aaf('0xc')][0x4]==='null'){throw new Error(_0x3aaf('0xf'));}var FIELDS=_[_0x3aaf('0x10')](process[_0x3aaf('0xc')][0x3]['split'](','),process[_0x3aaf('0xc')][0x4][_0x3aaf('0x11')](','));if(!process['argv'][0x5]||process[_0x3aaf('0xc')][0x5]===_0x3aaf('0xd')||process[_0x3aaf('0xc')][0x5]===_0x3aaf('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x3aaf('0xc')][0x5];var COMPANYID=process[_0x3aaf('0xc')][0x6]&&process[_0x3aaf('0xc')][0x6]!==_0x3aaf('0xd')&&process[_0x3aaf('0xc')][0x6]!==_0x3aaf('0xe')?process[_0x3aaf('0xc')][0x6]:null;var DUPLICATES=process[_0x3aaf('0xc')][0x7]&&process[_0x3aaf('0xc')][0x7]!==_0x3aaf('0xd')&&process[_0x3aaf('0xc')][0x7]!==_0x3aaf('0xe')?process[_0x3aaf('0xc')][0x7]:null;if(!process[_0x3aaf('0xc')][0x8]||process['argv'][0x8]===_0x3aaf('0xd')||process['argv'][0x8]==='null'){throw new Error(_0x3aaf('0x12'));}var SOCKET_TIMESTAMP=process[_0x3aaf('0xc')][0x8];}catch(_0x2a2c0f){logger[_0x3aaf('0x13')](_0x2a2c0f);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(_0x4c785c,_0x200289,_0x3c9e55,_0x595b6f){var _0x3da441={'message':_0x200289};_0x3da441[_0x4c785c]=!![];if(_0x3c9e55){_0x3da441[_0x3aaf('0x14')]=_0x3c9e55;}if(_0x595b6f){_0x3da441[_0x3aaf('0x15')]=_0x595b6f;}return _0x3da441;}function isEmail(_0x400e16){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))*$/[_0x3aaf('0x16')](_0x400e16);}function checkRow(_0x37733c,_0x1c52e8,_0xb105dc){return new BPromise(function(_0x1bf44d,_0xde0dda){if(_[_0x3aaf('0x17')](_0x37733c)){return _0xde0dda(handleCheckRowError('error',_0x3aaf('0x18'),null,_0xb105dc));}if(_0x37733c[_0x3aaf('0x19')]&&_0x37733c[_0x3aaf('0x19')][_0x3aaf('0x1a')]){var _0x3690c4=_[_0x3aaf('0x1b')](_0x37733c[_0x3aaf('0x19')],_0x3aaf('0x1c'))[_0x3aaf('0x1d')](';');return _0xde0dda(handleCheckRowError(_0x3aaf('0x13'),_0x3690c4,null,_0xb105dc));}var _0x570f22={};for(var _0x1b8288 in FIELDS){if(FIELDS[_0x3aaf('0x1e')](_0x1b8288)&&FIELDS[_0x1b8288]){_0x570f22[_0x1b8288]=_0x37733c[_0x3aaf('0x1f')][0x0][FIELDS[_0x1b8288]]||_0x37733c['data'][0x0]['\ufeff'+FIELDS[_0x1b8288]];}}if(!_0x570f22['firstName']){return _0xde0dda(handleCheckRowError(_0x3aaf('0x13'),_0x3aaf('0x20'),null,_0xb105dc));}if(!_0x570f22[_0x3aaf('0x21')]){return _0xde0dda(handleCheckRowError('error',_0x3aaf('0x22'),null,_0xb105dc));}if(_0x570f22['birthDate']){var _0x89100a=moment(_0x570f22[_0x3aaf('0x23')],'YYYY-MM-DD');if(!_0x89100a['isValid']()){return _0xde0dda(handleCheckRowError(_0x3aaf('0x13'),_0x3aaf('0x24'),null,_0xb105dc));}}if(_0x570f22[_0x3aaf('0x25')]){if(!isEmail(_0x570f22['email'])){return _0xde0dda(handleCheckRowError(_0x3aaf('0x13'),_0x3aaf('0x26'),null,_0xb105dc));}}_0x570f22[_0x3aaf('0x27')]=LISTID;_0x570f22[_0x3aaf('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1c52e8){var _0x20a8ad={};for(var _0x5950a5=0x0,_0x486313=DUPLICATES[_0x3aaf('0x1a')];_0x5950a5<_0x486313;_0x5950a5+=0x1){_0x20a8ad[DUPLICATES[_0x5950a5]]=_0x570f22[DUPLICATES[_0x5950a5]];}var _0x548e59=_[_0x3aaf('0x29')](_0x1c52e8,_0x20a8ad);if(_0x548e59){return _0xde0dda(handleCheckRowError('duplicate',_0x3aaf('0x2a'),_0x548e59,_0xb105dc));}}return db[_0x3aaf('0x2b')][_0x3aaf('0x2c')](_0x570f22,{'raw':!![],'hooks':![],'fields':_[_0x3aaf('0x2d')](_0x570f22)})[_0x3aaf('0x2e')](function(_0x195b00){if(DUPLICATES&&DUPLICATES['length']&&_0x1c52e8){_0x1c52e8[_0x3aaf('0x2f')](_['pick'](_0x570f22,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x195b00['id'];return _0x1bf44d();})[_0x3aaf('0x30')](function(_0x4be35f){return _0xde0dda(handleCheckRowError('error',_0x3aaf('0x31')+(_0x4be35f['message']||JSON[_0x3aaf('0x32')](_0x4be35f)),null,_0xb105dc));});});}function checkHopper(){function _0x266c11(){return function(_0x4ae0f5){logger[_0x3aaf('0x13')](_0x3aaf('0x33'),_0x3aaf('0x34'),util[_0x3aaf('0x35')](_0x4ae0f5,{'showHidden':![],'depth':null}));};}var _0x22b337=function(_0x45af0a,_0xa2d4f7){var _0x282815=squel[_0x3aaf('0x36')]()['into']('cm_hopper')['fromQuery'](['phone',_0x3aaf('0x37'),_0x3aaf('0x38'),'ListId',_0xa2d4f7,'createdAt',_0x3aaf('0x39')],squel['select']()[_0x3aaf('0x3a')](_0x3aaf('0x21'),'phone')[_0x3aaf('0x3a')]('NOW()',_0x3aaf('0x37'))[_0x3aaf('0x3a')]('id',_0x3aaf('0x38'))[_0x3aaf('0x3a')](LISTID[_0x3aaf('0x3b')](),_0x3aaf('0x27'))['field'](_0x45af0a['id']['toString'](),_0xa2d4f7)[_0x3aaf('0x3a')]('NOW()',_0x3aaf('0x3c'))[_0x3aaf('0x3a')]('NOW()',_0x3aaf('0x39'))['from'](_0x3aaf('0x3d'))[_0x3aaf('0x3e')]('deletedAt\x20IS\x20NULL')[_0x3aaf('0x3e')](_0x3aaf('0x3f'),LISTID['toString']())[_0x3aaf('0x3e')](_0x3aaf('0x40'))[_0x3aaf('0x3e')](_0x3aaf('0x41'),squel[_0x3aaf('0x42')]()[_0x3aaf('0x3a')](_0x3aaf('0x21'))[_0x3aaf('0x43')](_0x3aaf('0x44'))[_0x3aaf('0x3e')](_0xa2d4f7+'\x20=\x20?',_0x45af0a['id'][_0x3aaf('0x3b')]())))[_0x3aaf('0x3b')]();return _0x282815;};var _0x2174fd=function(_0x33bfe4,_0x3059cb){var _0x133fa4=squel['insert']()[_0x3aaf('0x45')](_0x3aaf('0x44'))[_0x3aaf('0x46')]([_0x3aaf('0x21'),_0x3aaf('0x37'),_0x3aaf('0x38'),_0x3aaf('0x27'),_0x3059cb,_0x3aaf('0x3c'),_0x3aaf('0x39')],squel[_0x3aaf('0x42')]()['field'](_0x3aaf('0x21'),_0x3aaf('0x21'))[_0x3aaf('0x3a')]('NOW()',_0x3aaf('0x37'))['field']('id','ContactId')[_0x3aaf('0x3a')](LISTID['toString'](),_0x3aaf('0x27'))['field'](_0x33bfe4['id']['toString'](),_0x3059cb)[_0x3aaf('0x3a')](_0x3aaf('0x47'),_0x3aaf('0x3c'))['field'](_0x3aaf('0x47'),_0x3aaf('0x39'))[_0x3aaf('0x43')](_0x3aaf('0x3d'))[_0x3aaf('0x3e')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())[_0x3aaf('0x3e')](_0x3aaf('0x48'),squel['str'](hopperContacts))[_0x3aaf('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x3aaf('0x3e')](_0x3aaf('0x41'),squel[_0x3aaf('0x42')]()['field'](_0x3aaf('0x49'))['from'](_0x3aaf('0x4a'))[_0x3aaf('0x3e')](_0x3059cb+_0x3aaf('0x4b'),_0x33bfe4['id']['toString']()))[_0x3aaf('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3aaf('0x42')]()[_0x3aaf('0x3a')](_0x3aaf('0x21'))[_0x3aaf('0x43')]('cm_hopper')[_0x3aaf('0x3e')](_0x3059cb+'\x20=\x20?',_0x33bfe4['id'][_0x3aaf('0x3b')]())))[_0x3aaf('0x3b')]();return _0x133fa4;};function _0x59c2b5(_0x2effd3,_0xa886d7){var _0x16b5ee=squel[_0x3aaf('0x36')]()[_0x3aaf('0x45')](_0x3aaf('0x44'))['fromQuery']([_0x3aaf('0x21'),_0x3aaf('0x37'),_0x3aaf('0x38'),_0x3aaf('0x27'),_0xa886d7,_0x3aaf('0x3c'),_0x3aaf('0x39')],squel[_0x3aaf('0x42')]()[_0x3aaf('0x3a')]('phone',_0x3aaf('0x21'))['field']('NOW()',_0x3aaf('0x37'))['field']('id',_0x3aaf('0x38'))[_0x3aaf('0x3a')](LISTID[_0x3aaf('0x3b')](),_0x3aaf('0x27'))[_0x3aaf('0x3a')](_0x2effd3['id'][_0x3aaf('0x3b')](),_0xa886d7)['field']('NOW()',_0x3aaf('0x3c'))['field'](_0x3aaf('0x47'),_0x3aaf('0x39'))[_0x3aaf('0x43')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x3aaf('0x3e')](_0x3aaf('0x3f'),LISTID[_0x3aaf('0x3b')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0x3aaf('0x3e')](_0x3aaf('0x40')))[_0x3aaf('0x3b')]();return _0x16b5ee;}function _0x13827b(_0x4d74c9,_0xedbe59){var _0x324706=squel[_0x3aaf('0x36')]()['into'](_0x3aaf('0x4c'))['fromQuery']([_0x3aaf('0x21'),_0x3aaf('0x38'),_0x3aaf('0x27'),_0xedbe59,_0x3aaf('0x3c'),'updatedAt'],squel[_0x3aaf('0x42')]()[_0x3aaf('0x3a')]('phone','phone')[_0x3aaf('0x3a')]('id','ContactId')[_0x3aaf('0x3a')](LISTID[_0x3aaf('0x3b')](),'ListId')[_0x3aaf('0x3a')](_0x4d74c9['id'][_0x3aaf('0x3b')](),_0xedbe59)[_0x3aaf('0x3a')](_0x3aaf('0x47'),_0x3aaf('0x3c'))[_0x3aaf('0x3a')](_0x3aaf('0x47'),_0x3aaf('0x39'))[_0x3aaf('0x43')](_0x3aaf('0x3d'))[_0x3aaf('0x3e')](_0x3aaf('0x4d'))[_0x3aaf('0x3e')](_0x3aaf('0x3f'),LISTID['toString']())[_0x3aaf('0x3e')](_0x3aaf('0x48'),squel[_0x3aaf('0x4e')](hopperContacts))['where'](_0x3aaf('0x40')))[_0x3aaf('0x3b')]();return _0x324706;}return db[_0x3aaf('0x4f')][_0x3aaf('0x50')]({'where':{'type':'outbound'},'attributes':['id',_0x3aaf('0x51')],'include':[{'model':db[_0x3aaf('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x3aaf('0x2e')](function(_0xf4749b){var _0xb471db=[];if(_0xf4749b){var _0x23033f;for(var _0xb0e746=0x0,_0x54ecf9;_0xb0e746<_0xf4749b[_0x3aaf('0x1a')];_0xb0e746+=0x1){_0x54ecf9=_0xf4749b[_0xb0e746][_0x3aaf('0x53')]({'plain':!![]});switch(_0x54ecf9[_0x3aaf('0x51')]){case _0x3aaf('0x54'):_0xb471db['push'](db[_0x3aaf('0x55')][_0x3aaf('0x56')](_0x2174fd(_0x54ecf9,'VoiceQueueId'))['then'](function(){})[_0x3aaf('0x30')](_0x266c11()));break;case _0x3aaf('0x57'):_0xb471db[_0x3aaf('0x2f')](db[_0x3aaf('0x55')][_0x3aaf('0x56')](_0x22b337(_0x54ecf9,'VoiceQueueId'))[_0x3aaf('0x2e')](function(){})[_0x3aaf('0x30')](_0x266c11()));break;default:_0xb471db['push'](db[_0x3aaf('0x55')][_0x3aaf('0x56')](_0x59c2b5(_0x54ecf9,_0x3aaf('0x58')))['then'](function(){})[_0x3aaf('0x30')](_0x266c11()));}}}return _0xb471db;})[_0x3aaf('0x59')]()[_0x3aaf('0x2e')](function(){return db['VoiceQueue'][_0x3aaf('0x50')]({'where':{'type':_0x3aaf('0x5a')},'attributes':['id'],'include':[{'model':db[_0x3aaf('0x52')],'as':_0x3aaf('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x416ffd){var _0x21d822=[];if(_0x416ffd){var _0x4c866a;for(var _0x2232d7=0x0,_0x26aaae;_0x2232d7<_0x416ffd[_0x3aaf('0x1a')];_0x2232d7+=0x1){_0x26aaae=_0x416ffd[_0x2232d7]['get']({'plain':!![]});_0x21d822[_0x3aaf('0x2f')](db[_0x3aaf('0x55')]['query'](_0x13827b(_0x26aaae,_0x3aaf('0x58')))[_0x3aaf('0x2e')](function(){})['catch'](_0x266c11()));}}return _0x21d822;})[_0x3aaf('0x59')]();})[_0x3aaf('0x2e')](function(){return db[_0x3aaf('0x5c')][_0x3aaf('0x50')]({'attributes':['id',_0x3aaf('0x51')],'include':[{'model':db['CmList'],'as':_0x3aaf('0x5d'),'where':{'id':LISTID}}]})[_0x3aaf('0x2e')](function(_0x551c82){var _0xa86bd1=[];if(_0x551c82){for(var _0x17212d=0x0,_0x2ff88a;_0x17212d<_0x551c82[_0x3aaf('0x1a')];_0x17212d+=0x1){_0x2ff88a=_0x551c82[_0x17212d][_0x3aaf('0x53')]({'plain':!![]});switch(_0x2ff88a[_0x3aaf('0x51')]){case'always':_0xa86bd1[_0x3aaf('0x2f')](db['sequelize']['query'](_0x2174fd(_0x2ff88a,'CampaignId'))[_0x3aaf('0x2e')](function(){})[_0x3aaf('0x30')](_0x266c11()));break;case _0x3aaf('0x57'):_0xa86bd1[_0x3aaf('0x2f')](db[_0x3aaf('0x55')][_0x3aaf('0x56')](_0x22b337(_0x2ff88a,_0x3aaf('0x5e')))['then'](function(){})[_0x3aaf('0x30')](_0x266c11()));break;default:_0xa86bd1[_0x3aaf('0x2f')](db['sequelize'][_0x3aaf('0x56')](_0x59c2b5(_0x2ff88a,_0x3aaf('0x5e')))[_0x3aaf('0x2e')](function(){})[_0x3aaf('0x30')](_0x266c11()));}}}return _0xa86bd1;})['all']();})[_0x3aaf('0x2e')](function(){return db[_0x3aaf('0x5c')][_0x3aaf('0x50')]({'attributes':['id'],'include':[{'model':db[_0x3aaf('0x52')],'as':_0x3aaf('0x5b'),'where':{'id':LISTID}}]})[_0x3aaf('0x2e')](function(_0x29ba70){var _0x324f04=[];if(_0x29ba70){for(var _0x5aaddc=0x0,_0x65353f;_0x5aaddc<_0x29ba70['length'];_0x5aaddc+=0x1){_0x65353f=_0x29ba70[_0x5aaddc][_0x3aaf('0x53')]({'plain':!![]});_0x324f04[_0x3aaf('0x2f')](db[_0x3aaf('0x55')][_0x3aaf('0x56')](_0x13827b(_0x65353f,_0x3aaf('0x5e')))[_0x3aaf('0x2e')](function(){})[_0x3aaf('0x30')](_0x266c11()));}}return _0x324f04;})[_0x3aaf('0x59')]();})[_0x3aaf('0x30')](function(_0x3e378d){logger['error'](_0x3aaf('0x5f'),_0x3aaf('0x60'),_0x3e378d[_0x3aaf('0x1c')]);});}var processPromises=function(_0x26be25){return BPromise[_0x3aaf('0x59')](promises)[_0x3aaf('0x2e')](function(_0x48910b){})[_0x3aaf('0x30')](function(_0x3dc2d9){logger[_0x3aaf('0x13')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x3dc2d9));})[_0x3aaf('0x61')](function(){socket['emit'](_0x3aaf('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x26be25){return _0x26be25[_0x3aaf('0x63')]();}});};var endCsv=function(){return BPromise[_0x3aaf('0x64')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x3aaf('0x2e')](function(){socket[_0x3aaf('0x65')](_0x3aaf('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x3a94ea){logger[_0x3aaf('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x3aaf('0x32')](_0x3a94ea));}finally{process['exit'](0x0);}});};process['on'](_0x3aaf('0x66'),function(){logger[_0x3aaf('0x67')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x3aaf('0x64')]()[_0x3aaf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3aaf('0x11')](',');return db[_0x3aaf('0x2b')][_0x3aaf('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x3931cd){var _0x4ecf26=fs[_0x3aaf('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3aaf('0x69')](_0x4ecf26,{'header':!![],'skipEmptyLines':!![],'step':function(_0xbd82be,_0x4768e8){total+=0x1;var _0x951a41=total;promises[_0x3aaf('0x2f')](checkRow(_0xbd82be,_0x3931cd,_0x951a41)['then'](function(){success+=0x1;})[_0x3aaf('0x30')](function(_0x2a91cd){if(_0x2a91cd[_0x3aaf('0x13')]){errors+=0x1;delete _0x2a91cd[_0x3aaf('0x13')];}else if(_0x2a91cd[_0x3aaf('0x6a')]){duplicates+=0x1;delete _0x2a91cd[_0x3aaf('0x6a')];}rows[_0x3aaf('0x2f')](_0x2a91cd);}));if(total%0xc8===0x0){_0x4768e8[_0x3aaf('0x6b')]();return processPromises(_0x4768e8);}},'complete':function(){return processPromises()[_0x3aaf('0x2e')](function(){logger[_0x3aaf('0x67')](_0x3aaf('0x6c'));endCsv();});},'error':function(_0x31a952,_0x18f561){logger[_0x3aaf('0x67')](_0x3aaf('0x6d'),JSON[_0x3aaf('0x32')](_0x31a952));endCsv();}});})[_0x3aaf('0x30')](function(_0x4397f7){logger[_0x3aaf('0x13')](_0x3aaf('0x6e'),JSON[_0x3aaf('0x32')](_0x4397f7));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index be6a5aa..6f6de48 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 _0x38f8=['emit','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.ListId','cm_hopper_black','fromQuery','createdAt','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','spread','catch','main','send','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','appendFileSync'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0x38f8,0x12c));var _0x838f=function(_0x339842,_0x3e16d1){_0x339842=_0x339842-0x0;var _0xa37841=_0x38f8[_0x339842];return _0xa37841;};'use strict';var fs=require('fs');var path=require(_0x838f('0x0'));var _=require(_0x838f('0x1'));var Papa=require(_0x838f('0x2'));var util=require('util');var BPromise=require(_0x838f('0x3'));var moment=require(_0x838f('0x4'));var squel=require(_0x838f('0x5'));var Redis=require('ioredis');var db=require(_0x838f('0x6'))['db'];var config=require(_0x838f('0x7'));var logger=require(_0x838f('0x8'))(_0x838f('0x9'));config['redis']=_[_0x838f('0xa')](config[_0x838f('0xb')],{'host':_0x838f('0xc'),'port':0x18eb});var socket=require(_0x838f('0xd'))(new Redis(config[_0x838f('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x838f('0xe'));function isEmail(_0x5d23cf){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'](_0x5d23cf);}function selectNotIn(_0x2492c7,_0x5462aa,_0xcb58e8,_0x499d18,_0x35dc97){return squel[_0x838f('0xf')]()[_0x838f('0x10')](_0x838f('0x11'))[_0x838f('0x12')](_0x499d18)[_0x838f('0x13')](_0x5462aa,null,_0x5462aa+_0x838f('0x14')+_0x499d18+'.'+_0xcb58e8)[_0x838f('0x15')](_0x499d18+'.'+_0xcb58e8+_0x838f('0x16')+_0x2492c7+'.'+_0xcb58e8)[_0x838f('0x15')](_0x5462aa+'.dialCheckDuplicateType\x20IN\x20('+_0x35dc97['join']()+')');}function insertCmHopper(_0x5edc80,_0x36d585,_0x25cd81,_0x2eedd1,_0x23fdec){var _0x20296d=['cm_contacts.phone','cm_contacts.scheduledat',_0x838f('0x17'),'cm_contacts.ListId',_0x36d585+'.'+_0x2eedd1,_0x838f('0x18'),_0x838f('0x19'),_0x838f('0x1a'),_0x838f('0x1b'),'\x22'+_0x23fdec+'\x22'];return squel[_0x838f('0x1c')]()[_0x838f('0x1d')](_0x838f('0x1e'))['fromQuery']([_0x838f('0x11'),_0x838f('0x1f'),_0x838f('0x20'),_0x838f('0x21'),_0x2eedd1,'createdAt',_0x838f('0x22'),_0x838f('0x23'),_0x838f('0x24'),_0x838f('0x25')],squel['select']()['fields'](_0x20296d)[_0x838f('0x12')](_0x36d585)[_0x838f('0x13')](_0x838f('0x26'),null,_0x838f('0x27')+_0x36d585+_0x838f('0x28'))[_0x838f('0x13')](_0x25cd81,null,_0x25cd81+_0x838f('0x14')+_0x36d585+'.'+_0x2eedd1)[_0x838f('0x15')](_0x36d585+_0x838f('0x29'),_0x5edc80)[_0x838f('0x15')](_0x838f('0x2a'),NOW)[_0x838f('0x15')](_0x838f('0x2b'),selectNotIn(_0x36d585,_0x25cd81,_0x2eedd1,_0x838f('0x1e'),[_0x838f('0x2c'),_0x838f('0x2d')]))[_0x838f('0x15')](_0x838f('0x2b'),selectNotIn(_0x36d585,_0x25cd81,_0x2eedd1,'cm_hopper',['\x22always\x22'])))[_0x838f('0x2e')]();}function insertCmHopperBlack(_0x28df94,_0x2ddabd,_0x2087ca,_0xc371c3){var _0x210740=[_0x838f('0x2f'),_0x838f('0x17'),_0x838f('0x30'),_0x2ddabd+'.'+_0xc371c3,_0x838f('0x18'),_0x838f('0x19')];return squel['insert']()[_0x838f('0x1d')](_0x838f('0x31'))[_0x838f('0x32')]([_0x838f('0x11'),'ContactId',_0x838f('0x21'),_0xc371c3,_0x838f('0x33'),_0x838f('0x22')],squel[_0x838f('0xf')]()['fields'](_0x210740)[_0x838f('0x12')](_0x2ddabd)[_0x838f('0x13')](_0x838f('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x2ddabd+_0x838f('0x28'))[_0x838f('0x13')](_0x2087ca,null,_0x2087ca+'.id\x20=\x20'+_0x2ddabd+'.'+_0xc371c3)[_0x838f('0x15')](_0x2ddabd+_0x838f('0x29'),_0x28df94)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x838f('0x15')](_0x838f('0x2b'),squel['select']()['field'](_0x838f('0x11'))[_0x838f('0x12')]('cm_hopper_black')[_0x838f('0x15')](_0x838f('0x34'),_0x28df94)['where'](_0xc371c3+_0x838f('0x35'),_0x2ddabd+'.'+_0xc371c3)))[_0x838f('0x2e')]();}function insertCmContact(_0x292c99,_0xee2c5,_0x266def,_0x3b7d2e){var _0xf9d533=_[_0x838f('0x36')](_['keys'](_0x3b7d2e),['ListId',_0x838f('0x37'),_0x838f('0x33'),'updatedAt']);return squel['insert']()[_0x838f('0x1d')](_0x838f('0x26'))[_0x838f('0x32')](_0xf9d533,squel[_0x838f('0xf')]()['fields'](_0xf9d533)['from'](_0xee2c5)[_0x838f('0x15')]('('+_0x266def[_0x838f('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x838f('0xf')]()['fields'](_0x266def)[_0x838f('0x12')]('cm_contacts')[_0x838f('0x15')](_0x838f('0x34'),_0x292c99))[_0x838f('0x15')](_0x838f('0x38'),squel[_0x838f('0xf')]()[_0x838f('0x10')](_0x838f('0x39'),'min_id')[_0x838f('0x12')](_0xee2c5)[_0x838f('0x3a')](_0x266def[_0x838f('0x13')](','))))['toString']();}function handleStop(){logger[_0x838f('0x3b')](_0x838f('0x3c'));stopped=!![];}function handleUncaughtException(_0x243d9f){logger[_0x838f('0x3d')](_0x243d9f[_0x838f('0x3e')]);process[_0x838f('0x3f')](0x1);}function handleError(_0x5e1870,_0x1762cd){stats[_0x838f('0x40')][_0x838f('0x41')]({'name':_0x1762cd[_0x838f('0x42')],'message':_0x1762cd[_0x838f('0x3e')],'row':_0x5e1870});}function handleQuery(_0x258b5f){logger['info'](_0x258b5f);return db['sequelize']['query'](_0x258b5f)[_0x838f('0x43')](function(_0x1ea135){results[_0x838f('0x41')](_0x1ea135);})[_0x838f('0x44')](function(_0x58f014){logger['error'](_0x58f014[_0x838f('0x3e')]);});}function main(_0x180afd,_0x4e6cf3,_0x35f674,_0xe7bcba){logger[_0x838f('0x3b')](_0x838f('0x45'),_0x180afd,JSON['stringify'](_0x4e6cf3));process[_0x838f('0x46')]('start');var _0x5e3eb9=_0x4e6cf3[_0x838f('0x47')];var _0x1421ef=_0x4e6cf3[_0x838f('0x48')];var _0x3a010f=path[_0x838f('0x13')](config[_0x838f('0x49')],_0x838f('0x4a'),_0x1421ef+_0x838f('0x4b'));var _0x5b435f=_['keys'](_0x5e3eb9)[_0x838f('0x13')]();logger[_0x838f('0x3b')](_0x838f('0x4c'),_0x5b435f);fs[_0x838f('0x4d')](_0x3a010f,_0x5b435f+'\x0a');Papa[_0x838f('0x4e')](fs[_0x838f('0x4f')](_0x180afd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x354d45,_0x415fd7){try{for(var _0x5a5050=0x0,_0x24ad01=[];_0x5a5050<_0x354d45[_0x838f('0x50')][_0x838f('0x51')];_0x5a5050++){stats[_0x838f('0x52')]+=0x1;if(_0x354d45['errors'][_0x5a5050]){handleError(_0x354d45[_0x838f('0x50')][_0x5a5050],_0x354d45['errors'][_0x5a5050]);}else{var _0x1e16db=[];for(var _0x32736d in _0x5e3eb9){if(_0x5e3eb9[_0x838f('0x53')](_0x32736d)){if(_0x354d45['data'][_0x5a5050][_0x5e3eb9[_0x32736d]]){var _0x2fa3fc=_[_0x838f('0x54')](_0x354d45[_0x838f('0x50')][_0x5a5050][_0x5e3eb9[_0x32736d]][_0x838f('0x55')](/"/g,'\x27'));switch(_0x32736d){case _0x838f('0x1f'):var _0x69db7c=moment(_0x2fa3fc,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x69db7c['isValid']()){_0x24ad01[_0x838f('0x41')]('\x22'+_0x2fa3fc+'\x22');}else{_0x1e16db[_0x838f('0x41')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x838f('0x23'):var _0x3e224c=parseInt(_0x2fa3fc);_0x2fa3fc=_[_0x838f('0x56')](_0x3e224c)||_0x3e224c<0x0||_0x3e224c>0x4?_0xe7bcba?0x3:0x2:_0x3e224c;_0x24ad01[_0x838f('0x41')]('\x22'+_0x2fa3fc+'\x22');break;case'UserId':var _0x3206b0=parseInt(_0x2fa3fc);if(_[_0x838f('0x57')](_0x3206b0)&&_[_0x838f('0x58')](_0x35f674,_0x3206b0)){_0x24ad01[_0x838f('0x41')]('\x22'+_0x3206b0+'\x22');}else{_0x1e16db['push'](_0x838f('0x59'));}break;case _0x838f('0x5a'):if(isEmail(_0x2fa3fc)){_0x24ad01[_0x838f('0x41')]('\x22'+_0x2fa3fc+'\x22');}else{_0x1e16db['push']('email\x20wrong\x20format');}break;case _0x838f('0x5b'):var _0x2191cd=moment(_0x2fa3fc,_0x838f('0x5c'),!![]);if(_0x2191cd[_0x838f('0x5d')]()){_0x24ad01[_0x838f('0x41')]('\x22'+_0x2fa3fc+'\x22');}else{_0x1e16db[_0x838f('0x41')](_0x838f('0x5e'));}break;default:_0x24ad01[_0x838f('0x41')]('\x22'+_0x2fa3fc+'\x22');}}else{switch(_0x32736d){case'firstName':case'phone':_0x1e16db[_0x838f('0x41')](_0x32736d+'\x20not\x20specified');break;default:_0x24ad01['push']('\x22\x22');}}}}if(_0x1e16db[_0x838f('0x51')]){handleError(_0x354d45['data'][_0x5a5050],{'code':'SystemRow','message':_0x1e16db[_0x838f('0x13')]()});}else{fs[_0x838f('0x5f')](_0x3a010f,_0x24ad01['join']()+'\x0a');}_0x24ad01=[];}if(!(stats[_0x838f('0x52')]%0xc8)){socket[_0x838f('0x60')]('contact:import:'+_0x1421ef,stats);stats[_0x838f('0x40')]=[];}}if(stopped){logger[_0x838f('0x3b')](_0x838f('0x61'));_0x415fd7[_0x838f('0x62')]();}}catch(_0x2191d9){handleError(_0x354d45[_0x838f('0x50')][_0x5a5050],{'code':_0x838f('0x63'),'message':_0x2191d9[_0x838f('0x3e')]});logger['error'](_0x838f('0x64'),_0x2191d9[_0x838f('0x3e')]);}},'complete':function(){try{var _0x299683=[];var _0x15ae9d='cm_contacts';if(_0x4e6cf3[_0x838f('0x65')]&&_0x4e6cf3['duplicates']['length']){_0x15ae9d='cm_contacts_'+_0x1421ef;_0x299683[_0x838f('0x41')](_0x838f('0x66')+_0x15ae9d+_0x838f('0x67'));}var _0x2601dd=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x3a010f,_0x15ae9d,_0x5b435f,_0x4e6cf3[_0x838f('0x21')],_0x4e6cf3[_0x838f('0x37')]||null,NOW,NOW);if(_[_0x838f('0x68')](_0x5e3eb9[_0x838f('0x1f')])){_0x2601dd+=_0x838f('0x69');}_0x299683['push'](_0x2601dd);if(_0x4e6cf3[_0x838f('0x65')]&&_0x4e6cf3[_0x838f('0x65')][_0x838f('0x51')]){_0x299683['push'](insertCmContact(_0x4e6cf3[_0x838f('0x21')],_0x15ae9d,_0x4e6cf3[_0x838f('0x65')],_0x5e3eb9));_0x299683['push'](_0x838f('0x6a')+_0x15ae9d+';');}_0x299683[_0x838f('0x41')](insertCmHopper(_0x4e6cf3[_0x838f('0x21')],_0x838f('0x6b'),_0x838f('0x6c'),'VoiceQueueId',_0xe7bcba));_0x299683[_0x838f('0x41')](insertCmHopperBlack(_0x4e6cf3['ListId'],_0x838f('0x6d'),_0x838f('0x6c'),_0x838f('0x6e')));_0x299683['push'](insertCmHopper(_0x4e6cf3[_0x838f('0x21')],_0x838f('0x6f'),_0x838f('0x70'),_0x838f('0x71'),_0xe7bcba));_0x299683[_0x838f('0x41')](insertCmHopperBlack(_0x4e6cf3[_0x838f('0x21')],_0x838f('0x72'),_0x838f('0x70'),_0x838f('0x71')));BPromise[_0x838f('0x73')](_0x299683,handleQuery)[_0x838f('0x74')](function(_0x430faf){stats[_0x838f('0x75')]=!![];stats[_0x838f('0x76')]=_0x4e6cf3['duplicates']&&_0x4e6cf3[_0x838f('0x65')][_0x838f('0x51')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0x838f('0x60')]('contact:import:'+_0x1421ef,stats);fs[_0x838f('0x77')](_0x180afd);fs[_0x838f('0x77')](_0x3a010f);process[_0x838f('0x3f')](0x0);})[_0x838f('0x44')](function(_0x5b5dc7){logger[_0x838f('0x3d')](_0x5b5dc7[_0x838f('0x3e')]);process['exit'](0x1);});}catch(_0x2ec439){logger[_0x838f('0x3d')](_0x838f('0x78'),_0x2ec439[_0x838f('0x3e')]);process[_0x838f('0x3f')](0x1);}},'error':function(_0x9f36f8,_0x5d24a8,_0xde1b15,_0xed2906){throw new Error(_0xed2906);}});}function validate(){if(process[_0x838f('0x79')]&&process[_0x838f('0x79')][_0x838f('0x51')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x246d18=path[_0x838f('0x13')](config[_0x838f('0x49')],_0x838f('0x4a'),process[_0x838f('0x79')][0x2]);if(!fs[_0x838f('0x7a')](_0x246d18)){throw new Error(_0x838f('0x7b'));}var _0x2c15e7={};try{_0x2c15e7=JSON[_0x838f('0x4e')](process['argv'][0x3]);if(!_0x2c15e7[_0x838f('0x47')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2c15e7[_0x838f('0x47')]['phone']){throw new Error(_0x838f('0x7c'));}if(!_0x2c15e7['binding'][_0x838f('0x7d')]){throw new Error(_0x838f('0x7e'));}var _0x1987dc=0x0;if(_0x2c15e7[_0x838f('0x47')][_0x838f('0x24')]){_0x1987dc=0x1;}if(!_0x2c15e7[_0x838f('0x21')]){throw new Error(_0x838f('0x7f'));}}catch(_0x195460){throw new Error('body\x20id\x20mandatory');}var _0x55bee1=[];try{_0x55bee1=_[_0x838f('0x80')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x20646b){logger[_0x838f('0x3b')](_0x838f('0x81'));}main(_0x246d18,_0x2c15e7,_0x55bee1,_0x1987dc);}validate();process['on'](_0x838f('0x82'),handleStop);process['on'](_0x838f('0x83'),handleUncaughtException); \ No newline at end of file +var _0xd1cf=['server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','errors','hasOwnProperty','trim','replace','scheduledat','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\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()','length','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','each','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_hopper_black','updatedAt','.CmListId','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','min_id','group','info','Received\x20SIGINT','message','exit','push','code','spread','catch','error','main','start','root'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd1cf,0xb3));var _0xfd1c=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0xd1cf[_0x16aaef];return _0x1c82ef;};'use strict';var fs=require('fs');var path=require(_0xfd1c('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xfd1c('0x1'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require(_0xfd1c('0x2'));var db=require(_0xfd1c('0x3'))['db'];var config=require(_0xfd1c('0x4'));var logger=require(_0xfd1c('0x5'))(_0xfd1c('0x6'));config[_0xfd1c('0x7')]=_['defaults'](config[_0xfd1c('0x7')],{'host':_0xfd1c('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd1c('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xfd1c('0x9')](_0xfd1c('0xa'));function isEmail(_0x24e659){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))*$/[_0xfd1c('0xb')](_0x24e659);}function selectNotIn(_0x3d65f9,_0x5682f8,_0x375c18,_0x31f71e,_0x31eb11){return squel[_0xfd1c('0xc')]()[_0xfd1c('0xd')](_0xfd1c('0xe'))[_0xfd1c('0xf')](_0x31f71e)[_0xfd1c('0x10')](_0x5682f8,null,_0x5682f8+'.id\x20=\x20'+_0x31f71e+'.'+_0x375c18)['where'](_0x31f71e+'.'+_0x375c18+_0xfd1c('0x11')+_0x3d65f9+'.'+_0x375c18)['where'](_0x5682f8+_0xfd1c('0x12')+_0x31eb11['join']()+')');}function insertCmHopper(_0x2172c4,_0x3a8ab5,_0x507b75,_0x2bc062,_0x320c60){var _0x51206a=['cm_contacts.phone',_0xfd1c('0x13'),_0xfd1c('0x14'),_0xfd1c('0x15'),_0x3a8ab5+'.'+_0x2bc062,_0xfd1c('0x16'),_0xfd1c('0x17'),_0xfd1c('0x18'),_0xfd1c('0x19'),'\x22'+_0x320c60+'\x22'];return squel[_0xfd1c('0x1a')]()[_0xfd1c('0x1b')](_0xfd1c('0x1c'))[_0xfd1c('0x1d')]([_0xfd1c('0xe'),'scheduledat','ContactId',_0xfd1c('0x1e'),_0x2bc062,_0xfd1c('0x1f'),'updatedAt',_0xfd1c('0x20'),_0xfd1c('0x21'),_0xfd1c('0x22')],squel[_0xfd1c('0xc')]()[_0xfd1c('0x23')](_0x51206a)[_0xfd1c('0xf')](_0x3a8ab5)[_0xfd1c('0x10')](_0xfd1c('0x24'),null,_0xfd1c('0x25')+_0x3a8ab5+'.CmListId')['join'](_0x507b75,null,_0x507b75+_0xfd1c('0x26')+_0x3a8ab5+'.'+_0x2bc062)[_0xfd1c('0x27')](_0x3a8ab5+_0xfd1c('0x28'),_0x2172c4)[_0xfd1c('0x27')](_0xfd1c('0x29'),NOW)[_0xfd1c('0x27')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3a8ab5,_0x507b75,_0x2bc062,_0xfd1c('0x1c'),[_0xfd1c('0x2a'),_0xfd1c('0x2b')]))['where'](_0xfd1c('0x2c'),selectNotIn(_0x3a8ab5,_0x507b75,_0x2bc062,_0xfd1c('0x1c'),[_0xfd1c('0x2a')])))[_0xfd1c('0x2d')]();}function insertCmHopperBlack(_0x417064,_0x6e2d7b,_0x5e2573,_0x1b31e1){var _0x37afff=[_0xfd1c('0x2e'),_0xfd1c('0x14'),_0xfd1c('0x15'),_0x6e2d7b+'.'+_0x1b31e1,_0xfd1c('0x16'),_0xfd1c('0x17')];return squel[_0xfd1c('0x1a')]()[_0xfd1c('0x1b')](_0xfd1c('0x2f'))[_0xfd1c('0x1d')]([_0xfd1c('0xe'),'ContactId',_0xfd1c('0x1e'),_0x1b31e1,'createdAt',_0xfd1c('0x30')],squel[_0xfd1c('0xc')]()['fields'](_0x37afff)['from'](_0x6e2d7b)['join'](_0xfd1c('0x24'),null,_0xfd1c('0x25')+_0x6e2d7b+_0xfd1c('0x31'))[_0xfd1c('0x10')](_0x5e2573,null,_0x5e2573+_0xfd1c('0x26')+_0x6e2d7b+'.'+_0x1b31e1)[_0xfd1c('0x27')](_0x6e2d7b+_0xfd1c('0x28'),_0x417064)[_0xfd1c('0x27')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfd1c('0x27')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xfd1c('0xc')]()[_0xfd1c('0xd')](_0xfd1c('0xe'))[_0xfd1c('0xf')](_0xfd1c('0x2f'))[_0xfd1c('0x27')](_0xfd1c('0x32'),_0x417064)[_0xfd1c('0x27')](_0x1b31e1+_0xfd1c('0x33'),_0x6e2d7b+'.'+_0x1b31e1)))[_0xfd1c('0x2d')]();}function insertCmContact(_0x5397d6,_0x1542d8,_0x362358,_0x23e2d1){var _0x220e51=_[_0xfd1c('0x34')](_[_0xfd1c('0x35')](_0x23e2d1),[_0xfd1c('0x1e'),_0xfd1c('0x36'),_0xfd1c('0x1f'),_0xfd1c('0x30')]);return squel[_0xfd1c('0x1a')]()[_0xfd1c('0x1b')]('cm_contacts')[_0xfd1c('0x1d')](_0x220e51,squel[_0xfd1c('0xc')]()[_0xfd1c('0x23')](_0x220e51)['from'](_0x1542d8)[_0xfd1c('0x27')]('('+_0x362358['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xfd1c('0xc')]()[_0xfd1c('0x23')](_0x362358)[_0xfd1c('0xf')](_0xfd1c('0x24'))[_0xfd1c('0x27')](_0xfd1c('0x32'),_0x5397d6))[_0xfd1c('0x27')]('id\x20IN\x20?',squel[_0xfd1c('0xc')]()[_0xfd1c('0xd')]('MIN(id)',_0xfd1c('0x37'))[_0xfd1c('0xf')](_0x1542d8)[_0xfd1c('0x38')](_0x362358[_0xfd1c('0x10')](','))))[_0xfd1c('0x2d')]();}function handleStop(){logger[_0xfd1c('0x39')](_0xfd1c('0x3a'));stopped=!![];}function handleUncaughtException(_0x19de61){logger['error'](_0x19de61[_0xfd1c('0x3b')]);process[_0xfd1c('0x3c')](0x1);}function handleError(_0x5c4194,_0x496600){stats['errors'][_0xfd1c('0x3d')]({'name':_0x496600[_0xfd1c('0x3e')],'message':_0x496600[_0xfd1c('0x3b')],'row':_0x5c4194});}function handleQuery(_0x376a7d){logger['info'](_0x376a7d);return db['sequelize']['query'](_0x376a7d)[_0xfd1c('0x3f')](function(_0x59d83a){results[_0xfd1c('0x3d')](_0x59d83a);})[_0xfd1c('0x40')](function(_0x1abd10){logger[_0xfd1c('0x41')](_0x1abd10['message']);});}function main(_0x1014d5,_0x3ec3b9,_0x12e51e,_0x2650b4){logger[_0xfd1c('0x39')](_0xfd1c('0x42'),_0x1014d5,JSON['stringify'](_0x3ec3b9));process['send'](_0xfd1c('0x43'));var _0x163c19=_0x3ec3b9['binding'];var _0x4b9c99=_0x3ec3b9['socket_timestamp'];var _0x927870=path[_0xfd1c('0x10')](config[_0xfd1c('0x44')],_0xfd1c('0x45'),_0x4b9c99+_0xfd1c('0x46'));var _0x3d8adf=_[_0xfd1c('0x35')](_0x163c19)['join']();logger[_0xfd1c('0x39')](_0xfd1c('0x47'),_0x3d8adf);fs[_0xfd1c('0x48')](_0x927870,_0x3d8adf+'\x0a');Papa[_0xfd1c('0x49')](fs[_0xfd1c('0x4a')](_0x1014d5),{'header':!![],'skipEmptyLines':!![],'step':function(_0xb2e6b7,_0x3a493c){try{for(var _0x34b94d=0x0,_0x8d6ed1=[];_0x34b94d<_0xb2e6b7[_0xfd1c('0x4b')]['length'];_0x34b94d++){stats['rows']+=0x1;if(_0xb2e6b7[_0xfd1c('0x4c')][_0x34b94d]){handleError(_0xb2e6b7['data'][_0x34b94d],_0xb2e6b7[_0xfd1c('0x4c')][_0x34b94d]);}else{var _0x4aa5fe=[];for(var _0x4c39e9 in _0x163c19){if(_0x163c19[_0xfd1c('0x4d')](_0x4c39e9)){if(_0xb2e6b7[_0xfd1c('0x4b')][_0x34b94d][_0x163c19[_0x4c39e9]]){var _0x489ec2=_[_0xfd1c('0x4e')](_0xb2e6b7[_0xfd1c('0x4b')][_0x34b94d][_0x163c19[_0x4c39e9]][_0xfd1c('0x4f')](/"/g,'\x27'));switch(_0x4c39e9){case _0xfd1c('0x50'):var _0x3364a3=moment(_0x489ec2,_0xfd1c('0xa'),!![]);if(_0x3364a3['isValid']()){_0x8d6ed1[_0xfd1c('0x3d')]('\x22'+_0x489ec2+'\x22');}else{_0x4aa5fe[_0xfd1c('0x3d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x1b7ee7=parseInt(_0x489ec2);_0x489ec2=_['isNaN'](_0x1b7ee7)||_0x1b7ee7<0x0||_0x1b7ee7>0x4?_0x2650b4?0x3:0x2:_0x1b7ee7;_0x8d6ed1[_0xfd1c('0x3d')]('\x22'+_0x489ec2+'\x22');break;case _0xfd1c('0x21'):var _0x26836b=parseInt(_0x489ec2);if(_['isNumber'](_0x26836b)&&_[_0xfd1c('0x51')](_0x12e51e,_0x26836b)){_0x8d6ed1['push']('\x22'+_0x26836b+'\x22');}else{_0x4aa5fe[_0xfd1c('0x3d')]('agent\x20not\x20exists');}break;case _0xfd1c('0x52'):if(isEmail(_0x489ec2)){_0x8d6ed1['push']('\x22'+_0x489ec2+'\x22');}else{_0x4aa5fe[_0xfd1c('0x3d')](_0xfd1c('0x53'));}break;case _0xfd1c('0x54'):var _0xc93452=moment(_0x489ec2,_0xfd1c('0x55'),!![]);if(_0xc93452[_0xfd1c('0x56')]()){_0x8d6ed1['push']('\x22'+_0x489ec2+'\x22');}else{_0x4aa5fe[_0xfd1c('0x3d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x8d6ed1[_0xfd1c('0x3d')]('\x22'+_0x489ec2+'\x22');}}else{switch(_0x4c39e9){case'firstName':case'phone':_0x4aa5fe[_0xfd1c('0x3d')](_0x4c39e9+_0xfd1c('0x57'));break;default:_0x8d6ed1[_0xfd1c('0x3d')]('\x22\x22');}}}}if(_0x4aa5fe['length']){handleError(_0xb2e6b7[_0xfd1c('0x4b')][_0x34b94d],{'code':_0xfd1c('0x58'),'message':_0x4aa5fe[_0xfd1c('0x10')]()});}else{fs[_0xfd1c('0x59')](_0x927870,_0x8d6ed1[_0xfd1c('0x10')]()+'\x0a');}_0x8d6ed1=[];}if(!(stats['rows']%0xc8)){socket[_0xfd1c('0x5a')](_0xfd1c('0x5b')+_0x4b9c99,stats);stats[_0xfd1c('0x4c')]=[];}}if(stopped){logger[_0xfd1c('0x39')](_0xfd1c('0x5c'));_0x3a493c[_0xfd1c('0x5d')]();}}catch(_0x2995bd){handleError(_0xb2e6b7[_0xfd1c('0x4b')][_0x34b94d],{'code':_0xfd1c('0x5e'),'message':_0x2995bd['message']});logger[_0xfd1c('0x41')](_0xfd1c('0x5f'),_0x2995bd[_0xfd1c('0x3b')]);}},'complete':function(){try{var _0x5d087e=[];var _0x4c8231='cm_contacts';if(_0x3ec3b9[_0xfd1c('0x60')]&&_0x3ec3b9[_0xfd1c('0x60')]['length']){_0x4c8231=_0xfd1c('0x61')+_0x4b9c99;_0x5d087e[_0xfd1c('0x3d')](_0xfd1c('0x62')+_0x4c8231+_0xfd1c('0x63'));}var _0x4c033c=util[_0xfd1c('0x9')](_0xfd1c('0x64'),_0x927870,_0x4c8231,_0x3d8adf,_0x3ec3b9['ListId'],_0x3ec3b9['CompanyId']||null,NOW,NOW);if(_[_0xfd1c('0x65')](_0x163c19[_0xfd1c('0x50')])){_0x4c033c+=_0xfd1c('0x66');}_0x5d087e['push'](_0x4c033c);if(_0x3ec3b9[_0xfd1c('0x60')]&&_0x3ec3b9['duplicates'][_0xfd1c('0x67')]){_0x5d087e[_0xfd1c('0x3d')](insertCmContact(_0x3ec3b9[_0xfd1c('0x1e')],_0x4c8231,_0x3ec3b9[_0xfd1c('0x60')],_0x163c19));_0x5d087e[_0xfd1c('0x3d')](_0xfd1c('0x68')+_0x4c8231+';');}_0x5d087e[_0xfd1c('0x3d')](insertCmHopper(_0x3ec3b9[_0xfd1c('0x1e')],'voice_queues_has_cm_lists',_0xfd1c('0x69'),_0xfd1c('0x6a'),_0x2650b4));_0x5d087e['push'](insertCmHopperBlack(_0x3ec3b9[_0xfd1c('0x1e')],'voice_queues_has_cm_blacklists',_0xfd1c('0x69'),_0xfd1c('0x6a')));_0x5d087e[_0xfd1c('0x3d')](insertCmHopper(_0x3ec3b9[_0xfd1c('0x1e')],_0xfd1c('0x6b'),_0xfd1c('0x6c'),'CampaignId',_0x2650b4));_0x5d087e[_0xfd1c('0x3d')](insertCmHopperBlack(_0x3ec3b9[_0xfd1c('0x1e')],_0xfd1c('0x6d'),_0xfd1c('0x6c'),'CampaignId'));BPromise[_0xfd1c('0x6e')](_0x5d087e,handleQuery)['then'](function(_0x106edf){stats['finish']=!![];stats['affectedRows']=_0x3ec3b9[_0xfd1c('0x60')]&&_0x3ec3b9[_0xfd1c('0x60')]['length']?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0xfd1c('0x5a')](_0xfd1c('0x5b')+_0x4b9c99,stats);fs['unlink'](_0x1014d5);fs[_0xfd1c('0x6f')](_0x927870);process[_0xfd1c('0x3c')](0x0);})[_0xfd1c('0x40')](function(_0x3c4019){logger['error'](_0x3c4019['message']);process['exit'](0x1);});}catch(_0x36533b){logger[_0xfd1c('0x41')]('complete',_0x36533b[_0xfd1c('0x3b')]);process[_0xfd1c('0x3c')](0x1);}},'error':function(_0x4530dc,_0xe92171,_0xb359ab,_0x12c8f8){throw new Error(_0x12c8f8);}});}function validate(){if(process[_0xfd1c('0x70')]&&process[_0xfd1c('0x70')][_0xfd1c('0x67')]<0x4){throw new Error(_0xfd1c('0x71'));}var _0x3a9d0e=path['join'](config[_0xfd1c('0x44')],_0xfd1c('0x45'),process[_0xfd1c('0x70')][0x2]);if(!fs['existsSync'](_0x3a9d0e)){throw new Error(_0xfd1c('0x72'));}var _0x30f7a8={};try{_0x30f7a8=JSON['parse'](process['argv'][0x3]);if(!_0x30f7a8['binding']){throw new Error(_0xfd1c('0x73'));}if(!_0x30f7a8[_0xfd1c('0x74')]['phone']){throw new Error(_0xfd1c('0x75'));}if(!_0x30f7a8['binding']['firstName']){throw new Error(_0xfd1c('0x76'));}var _0x25169d=0x0;if(_0x30f7a8[_0xfd1c('0x74')][_0xfd1c('0x21')]){_0x25169d=0x1;}if(!_0x30f7a8['ListId']){throw new Error(_0xfd1c('0x77'));}}catch(_0x134fe5){throw new Error('body\x20id\x20mandatory');}var _0x330c7b=[];try{_0x330c7b=_[_0xfd1c('0x78')](JSON[_0xfd1c('0x49')](process[_0xfd1c('0x70')][0x4]),'id');}catch(_0x17fd5c){logger[_0xfd1c('0x39')](_0xfd1c('0x79'));}main(_0x3a9d0e,_0x30f7a8,_0x330c7b,_0x25169d);}validate();process['on'](_0xfd1c('0x7a'),handleStop);process['on'](_0xfd1c('0x7b'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 2dd4a15..5298acc 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 _0xf109=['membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','getSubjects','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','UniqueId','uniqueid','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf109,0xce));var _0x9f10=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf109[_0x22b68a];return _0x1ac67a;};'use strict';exports[_0x9f10('0x0')]=function(_0x60d1e,_0x44c4f2){var _0x5d2950=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x60d1e[_0x9f10('0x1')]()){case _0x9f10('0x2'):switch(_0x44c4f2[_0x9f10('0x1')]()){case _0x9f10('0x3'):_0x5d2950[_0x9f10('0x4')]({'type':_0x9f10('0x5'),'content':'','variableName':_0x9f10('0x6')});_0x5d2950[_0x9f10('0x4')]({'type':_0x9f10('0x5'),'content':'','variableName':_0x9f10('0x7')});break;case _0x9f10('0x8'):_0x5d2950['push']({'type':_0x9f10('0x9'),'content':_0x9f10('0xa'),'variableName':null});_0x5d2950[_0x9f10('0x4')]({'type':_0x9f10('0x5'),'content':'','variableName':_0x9f10('0xb')});break;}}return _0x5d2950;};exports['getDescriptions']=function(_0x318776,_0x18995b){var _0x4522d9=[];switch(_0x318776['toLowerCase']()){case'voice':switch(_0x18995b[_0x9f10('0x1')]()){case _0x9f10('0x3'):_0x4522d9=[{'type':_0x9f10('0x9'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x9f10('0xc'),'content':'','key':_0x9f10('0xd'),'keyType':_0x9f10('0x5'),'variableName':'calleridnum'},{'type':_0x9f10('0xc'),'content':'','key':_0x9f10('0xe'),'keyType':'variable','variableName':_0x9f10('0xf')},{'type':_0x9f10('0xc'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0x9f10('0x10')},{'type':_0x9f10('0xc'),'content':'','key':'Queue','keyType':_0x9f10('0x5'),'variableName':'queue'},{'type':_0x9f10('0xc'),'content':'','key':_0x9f10('0x11'),'keyType':'variable','variableName':_0x9f10('0x12')},{'type':_0x9f10('0xc'),'content':'','key':'Date','keyType':_0x9f10('0x5'),'variableName':'agentcalledAt'},{'type':_0x9f10('0x9'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x9f10('0xc'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0x9f10('0x13')},{'type':_0x9f10('0xc'),'content':'','key':_0x9f10('0x14'),'keyType':_0x9f10('0x5'),'variableName':_0x9f10('0xb')},{'type':_0x9f10('0x9'),'content':_0x9f10('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x9f10('0x16'),'keyType':'variable','variableName':_0x9f10('0x17')},{'type':_0x9f10('0xc'),'content':'','key':_0x9f10('0x18'),'keyType':'variable','variableName':_0x9f10('0x19')},{'type':_0x9f10('0xc'),'content':'','key':_0x9f10('0x1a'),'keyType':'variable','variableName':_0x9f10('0x1b')},{'type':_0x9f10('0xc'),'content':'','key':_0x9f10('0x1c'),'keyType':'variable','variableName':_0x9f10('0x1d')},{'type':_0x9f10('0xc'),'content':'','key':_0x9f10('0x1e'),'keyType':_0x9f10('0x5'),'variableName':'talktime'}];break;case'outbound':_0x4522d9=[{'type':'string','content':_0x9f10('0x1f'),'variableName':null},{'type':'keyValue','content':'','key':_0x9f10('0x20'),'keyType':_0x9f10('0x5'),'keyContent':'','variableName':_0x9f10('0xb')},{'type':_0x9f10('0xc'),'content':'','key':_0x9f10('0x21'),'keyType':'variable','keyContent':'','variableName':_0x9f10('0x22')},{'type':_0x9f10('0xc'),'content':'','key':_0x9f10('0x11'),'keyType':_0x9f10('0x5'),'keyContent':'','variableName':_0x9f10('0x12')},{'type':_0x9f10('0xc'),'content':'','key':'Date','keyType':_0x9f10('0x5'),'keyContent':'','variableName':_0x9f10('0x23')},{'type':_0x9f10('0x9'),'content':_0x9f10('0x15')},{'type':'keyValue','content':'','key':_0x9f10('0x24'),'keyType':_0x9f10('0x5'),'keyContent':'','variableName':_0x9f10('0x25')},{'type':'keyValue','content':'','key':_0x9f10('0x26'),'keyType':'variable','keyContent':'','variableName':_0x9f10('0x27')}];break;}}return _0x4522d9;}; \ No newline at end of file +var _0x5c12=['Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','Called\x20Number','Member\x20Name','uniqueid','starttime','Complete\x20Time','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','Queue','UniqueId','Date','agentcalledAt','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt'];(function(_0x201289,_0x2436af){var _0x4c1837=function(_0x97962b){while(--_0x97962b){_0x201289['push'](_0x201289['shift']());}};_0x4c1837(++_0x2436af);}(_0x5c12,0x188));var _0x25c1=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0x5c12[_0x364cf8];return _0x6a59ee;};'use strict';exports['getSubjects']=function(_0x41f3d0,_0x1e452d){var _0x549b0f=[{'type':_0x25c1('0x0'),'content':_0x25c1('0x1'),'variableName':null}];switch(_0x41f3d0[_0x25c1('0x2')]()){case _0x25c1('0x3'):switch(_0x1e452d[_0x25c1('0x2')]()){case _0x25c1('0x4'):_0x549b0f[_0x25c1('0x5')]({'type':'variable','content':'','variableName':_0x25c1('0x6')});_0x549b0f[_0x25c1('0x5')]({'type':_0x25c1('0x7'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x549b0f[_0x25c1('0x5')]({'type':_0x25c1('0x0'),'content':_0x25c1('0x8'),'variableName':null});_0x549b0f[_0x25c1('0x5')]({'type':_0x25c1('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x549b0f;};exports[_0x25c1('0x9')]=function(_0x41c89d,_0x11a223){var _0x81f0f4=[];switch(_0x41c89d[_0x25c1('0x2')]()){case'voice':switch(_0x11a223[_0x25c1('0x2')]()){case _0x25c1('0x4'):_0x81f0f4=[{'type':'string','content':_0x25c1('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x25c1('0xb'),'content':'','key':_0x25c1('0xc'),'keyType':_0x25c1('0x7'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0x25c1('0xd')},{'type':_0x25c1('0xb'),'content':'','key':_0x25c1('0xe'),'keyType':_0x25c1('0x7'),'variableName':_0x25c1('0xf')},{'type':'keyValue','content':'','key':_0x25c1('0x10'),'keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':_0x25c1('0x11'),'keyType':_0x25c1('0x7'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x25c1('0x12'),'keyType':'variable','variableName':_0x25c1('0x13')},{'type':_0x25c1('0x0'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0x25c1('0x7'),'variableName':_0x25c1('0x14')},{'type':_0x25c1('0xb'),'content':'','key':_0x25c1('0x15'),'keyType':'variable','variableName':_0x25c1('0x16')},{'type':_0x25c1('0x0'),'content':_0x25c1('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x25c1('0xb'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0x25c1('0x13')},{'type':_0x25c1('0xb'),'content':'','key':_0x25c1('0x18'),'keyType':_0x25c1('0x7'),'variableName':_0x25c1('0x19')},{'type':_0x25c1('0xb'),'content':'','key':_0x25c1('0x1a'),'keyType':_0x25c1('0x7'),'variableName':_0x25c1('0x1b')},{'type':_0x25c1('0xb'),'content':'','key':_0x25c1('0x1c'),'keyType':_0x25c1('0x7'),'variableName':_0x25c1('0x1d')},{'type':'keyValue','content':'','key':_0x25c1('0x1e'),'keyType':_0x25c1('0x7'),'variableName':_0x25c1('0x1f')}];break;case _0x25c1('0x20'):_0x81f0f4=[{'type':_0x25c1('0x0'),'content':_0x25c1('0xa'),'variableName':null},{'type':'keyValue','content':'','key':_0x25c1('0x21'),'keyType':_0x25c1('0x7'),'keyContent':'','variableName':_0x25c1('0x16')},{'type':_0x25c1('0xb'),'content':'','key':_0x25c1('0x22'),'keyType':_0x25c1('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x25c1('0xb'),'content':'','key':'UniqueId','keyType':_0x25c1('0x7'),'keyContent':'','variableName':_0x25c1('0x23')},{'type':_0x25c1('0xb'),'content':'','key':_0x25c1('0x12'),'keyType':_0x25c1('0x7'),'keyContent':'','variableName':_0x25c1('0x24')},{'type':_0x25c1('0x0'),'content':_0x25c1('0x17')},{'type':_0x25c1('0xb'),'content':'','key':'Answer\x20Time','keyType':_0x25c1('0x7'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x25c1('0x25'),'keyType':_0x25c1('0x7'),'keyContent':'','variableName':'endtime'}];break;}}return _0x81f0f4;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 3c2b201..fe172e0 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 _0x8e82=['Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','phone','fax','lodash','../../mysqldb','../../config/logger','fax-interactions','sms-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role'];(function(_0x38214e,_0x21d27b){var _0xcba792=function(_0x388bc9){while(--_0x388bc9){_0x38214e['push'](_0x38214e['shift']());}};_0xcba792(++_0x21d27b);}(_0x8e82,0xb0));var _0x28e8=function(_0x221f4f,_0x452f2f){_0x221f4f=_0x221f4f-0x0;var _0x1aa145=_0x8e82[_0x221f4f];return _0x1aa145;};'use strict';var _=require(_0x28e8('0x0'));var db=require(_0x28e8('0x1'))['db'];var loggers={'openchannel':require(_0x28e8('0x2'))('openchannel-interactions'),'mail':require(_0x28e8('0x2'))('mail-interactions'),'fax':require(_0x28e8('0x2'))(_0x28e8('0x3')),'sms':require(_0x28e8('0x2'))(_0x28e8('0x4')),'chat':require('../../config/logger')('chat-interactions')};function getInteractionId(_0x26e232,_0x16ba9a,_0x555c5d){if(_0x26e232&&_0x26e232[_[_0x28e8('0x5')](_0x555c5d)+_0x28e8('0x6')]){return _0x26e232[_[_0x28e8('0x5')](_0x555c5d)+_0x28e8('0x6')];}else if(_0x26e232&&_0x26e232['id']){return _0x26e232['id'];}else if(_0x16ba9a&&_0x16ba9a['id']){return _0x16ba9a['id'];}else{return _0x28e8('0x7');}}function log(_0x48ad31,_0x3145b4,_0x140003,_0x3d6bf9,_0x1ac7e6,_0x3f38fe){loggers[_0x1ac7e6[_0x28e8('0x8')]()][_0x48ad31](_0x28e8('0x9'),_0x3f38fe[_0x28e8('0xa')](),_0x3145b4?_0x3145b4['id']:null,_0x3145b4?_0x3145b4[_0x28e8('0xb')]:null,_0x3145b4?_0x3145b4[_0x28e8('0xc')]:null,getInteractionId(_0x140003,_0x3d6bf9,_0x1ac7e6),_0x140003?JSON['stringify'](_0x140003):'null');}function updateUser(_0x1edd3d,_0x2d68ee,_0x5548ab,_0x18b76f,_0x6f6c4f){db[_[_0x28e8('0x5')](_0x18b76f)+_0x28e8('0xd')][_0x28e8('0xe')]({'where':{'id':getInteractionId(_0x2d68ee,_0x5548ab,_0x18b76f)}})[_0x28e8('0xf')](function(_0x4ae3e6){if(_0x4ae3e6){return _0x4ae3e6[_0x28e8('0x10')]({'UserId':_0x1edd3d?_0x1edd3d['id']:null});}})[_0x28e8('0xf')](function(_0x3a4d4a){if(_0x3a4d4a){log(_0x28e8('0x11'),_0x1edd3d,_0x2d68ee,_0x5548ab,_0x18b76f,_0x6f6c4f);}})[_0x28e8('0x12')](function(){log(_0x28e8('0x13'),_0x1edd3d,_0x2d68ee,_0x5548ab,_0x18b76f,_0x6f6c4f);});}exports[_0x28e8('0x14')]=function(_0x230ad0,_0x4432b9){return function(_0x3ec7ef,_0xc689f3,_0x1064f8){var _0x2eb23c=_0x3ec7ef[_0x28e8('0x15')];var _0x5d996f={};var _0x45282b=_0x3ec7ef[_0x28e8('0x16')];if(_0x5d996f){_0x5d996f=_[_0x28e8('0x17')](_0x3ec7ef[_0x28e8('0x18')]);_0x5d996f=_['omit'](_0x5d996f,[_0x28e8('0x18'),'html',_0x28e8('0x19'),_0x28e8('0x1a'),'mobile']);}updateUser(_0x2eb23c,_0x5d996f,_0x45282b,_0x230ad0,_0x4432b9);_0x1064f8(null);};}; \ No newline at end of file +var _0x33e6=['body','phone','fax','lodash','../../config/logger','openchannel-interactions','mail-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','update','then','info','error','tracked','user','query','clone'];(function(_0x3bbc04,_0x4dcc5e){var _0x4720b1=function(_0x304f87){while(--_0x304f87){_0x3bbc04['push'](_0x3bbc04['shift']());}};_0x4720b1(++_0x4dcc5e);}(_0x33e6,0xc0));var _0x633e=function(_0x486367,_0x51f6cf){_0x486367=_0x486367-0x0;var _0x5d381e=_0x33e6[_0x486367];return _0x5d381e;};'use strict';var _=require(_0x633e('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x633e('0x1'))(_0x633e('0x2')),'mail':require(_0x633e('0x1'))(_0x633e('0x3')),'fax':require(_0x633e('0x1'))('fax-interactions'),'sms':require(_0x633e('0x1'))('sms-interactions'),'chat':require(_0x633e('0x1'))('chat-interactions')};function getInteractionId(_0x74137a,_0x40bd0c,_0x2199ae){if(_0x74137a&&_0x74137a[_[_0x633e('0x4')](_0x2199ae)+_0x633e('0x5')]){return _0x74137a[_['upperFirst'](_0x2199ae)+_0x633e('0x5')];}else if(_0x74137a&&_0x74137a['id']){return _0x74137a['id'];}else if(_0x40bd0c&&_0x40bd0c['id']){return _0x40bd0c['id'];}else{return _0x633e('0x6');}}function log(_0x1146cb,_0x235437,_0x457206,_0x6f23ab,_0x482990,_0x5ccb68){loggers[_0x482990[_0x633e('0x7')]()][_0x1146cb](_0x633e('0x8'),_0x5ccb68[_0x633e('0x9')](),_0x235437?_0x235437['id']:null,_0x235437?_0x235437[_0x633e('0xa')]:null,_0x235437?_0x235437[_0x633e('0xb')]:null,getInteractionId(_0x457206,_0x6f23ab,_0x482990),_0x457206?JSON[_0x633e('0xc')](_0x457206):_0x633e('0xd'));}function updateUser(_0x37ab0e,_0x2b2262,_0x3600b4,_0x2140f4,_0x2aac2a){db[_['upperFirst'](_0x2140f4)+_0x633e('0xe')][_0x633e('0xf')]({'where':{'id':getInteractionId(_0x2b2262,_0x3600b4,_0x2140f4)}})['then'](function(_0x55e7f6){if(_0x55e7f6){return _0x55e7f6[_0x633e('0x10')]({'UserId':_0x37ab0e?_0x37ab0e['id']:null});}})[_0x633e('0x11')](function(_0xad7b7c){if(_0xad7b7c){log(_0x633e('0x12'),_0x37ab0e,_0x2b2262,_0x3600b4,_0x2140f4,_0x2aac2a);}})['catch'](function(){log(_0x633e('0x13'),_0x37ab0e,_0x2b2262,_0x3600b4,_0x2140f4,_0x2aac2a);});}exports[_0x633e('0x14')]=function(_0x11d469,_0x273c7d){return function(_0x38b1a4,_0x57ac20,_0x4870d6){var _0xc5807=_0x38b1a4[_0x633e('0x15')];var _0x4a91ed={};var _0x4fb762=_0x38b1a4[_0x633e('0x16')];if(_0x4a91ed){_0x4a91ed=_[_0x633e('0x17')](_0x38b1a4[_0x633e('0x18')]);_0x4a91ed=_['omit'](_0x4a91ed,[_0x633e('0x18'),'html',_0x633e('0x19'),_0x633e('0x1a'),'mobile']);}updateUser(_0xc5807,_0x4a91ed,_0x4fb762,_0x11d469,_0x273c7d);_0x4870d6(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 0d69992..1599b7a 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 _0x801b=['update','base64','utf8','parse','hasOwnProperty','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb','data1','license','split','createDecipher','format'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x801b,0xf2));var _0xb801=function(_0x130a18,_0x3fa617){_0x130a18=_0x130a18-0x0;var _0xff5470=_0x801b[_0x130a18];return _0xff5470;};'use strict';var crypto=require(_0xb801('0x0'));var util=require(_0xb801('0x1'));var compose=require('composable-middleware');var db=require(_0xb801('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x3b818e,_0x57d4d8){if(_0x3b818e&&_0x57d4d8){if(_0x57d4d8[_0xb801('0x3')]&&_0x57d4d8[_0xb801('0x4')]){var _0x1ff436=_0x57d4d8[_0xb801('0x3')];var _0x2bf014=_0x57d4d8[_0xb801('0x4')];var _0x19b154=_0x1ff436[_0xb801('0x5')]('-')[0x4];var _0x1f0c1e=_0x1ff436[_0xb801('0x5')]('-')[0x0];var _0x4ffc28=crypto[_0xb801('0x6')]('aes-256-ctr',util[_0xb801('0x7')]('%s:%s:%s',_0x19b154,_0x1ff436,_0x1f0c1e));var _0x289fe6=_0x4ffc28[_0xb801('0x8')](_0x2bf014,_0xb801('0x9'),_0xb801('0xa'));_0x289fe6+=_0x4ffc28['final'](_0xb801('0xa'));var _0x2ddfba=JSON[_0xb801('0xb')](_0x289fe6);return _0x2ddfba[_0xb801('0xc')](_0x3b818e)?_0x2ddfba[_0x3b818e]:null;}}return null;}function isLimit(_0xa22ad2,_0x35eb31,_0x2be116,_0xc9d6bb){var _0x35690f=_0x35eb31;return compose()[_0xb801('0xd')](function(_0x4947e0,_0x119ee5,_0x265cf8){return db['License'][_0xb801('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0xf97266){var _0x9c0f08=getValueFromLicense(_0xa22ad2,_0xf97266);return _0x9c0f08?_0x9c0f08:_0x35690f;})[_0xb801('0xf')](function(_0x9932ad){_0x35690f=_0x9932ad;return _0x2be116['count'](_0xc9d6bb);})[_0xb801('0xf')](function(_0x4eadd2){if(_0x4eadd2>=_0x35690f){return _0x119ee5[_0xb801('0x10')](0x193)[_0xb801('0x11')]({'message':util[_0xb801('0x7')](_0xb801('0x12'),_0xa22ad2)});}_0x265cf8();})[_0xb801('0x13')](function(_0x13e013){_0x265cf8(_0x13e013);});});}function isUserLimit(){return isLimit(_0xb801('0x14'),0x1,db[_0xb801('0x15')],{'where':{'$or':[{'role':_0xb801('0x16')},{'role':_0xb801('0x17')}]}});}exports[_0xb801('0x18')]=isUserLimit; \ No newline at end of file +var _0x099f=['license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','crypto','util','composable-middleware','../../mysqldb','data1'];(function(_0x38578e,_0x3ea10c){var _0x1b26c6=function(_0x12f493){while(--_0x12f493){_0x38578e['push'](_0x38578e['shift']());}};_0x1b26c6(++_0x3ea10c);}(_0x099f,0x133));var _0xf099=function(_0x1877cf,_0x1eea3d){_0x1877cf=_0x1877cf-0x0;var _0x35a881=_0x099f[_0x1877cf];return _0x35a881;};'use strict';var crypto=require(_0xf099('0x0'));var util=require(_0xf099('0x1'));var compose=require(_0xf099('0x2'));var db=require(_0xf099('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x1eb98e,_0x43115d){if(_0x1eb98e&&_0x43115d){if(_0x43115d[_0xf099('0x4')]&&_0x43115d[_0xf099('0x5')]){var _0x3f46c0=_0x43115d[_0xf099('0x4')];var _0x45f85c=_0x43115d['license'];var _0x9dc437=_0x3f46c0['split']('-')[0x4];var _0x11d863=_0x3f46c0[_0xf099('0x6')]('-')[0x0];var _0x5a3398=crypto[_0xf099('0x7')](_0xf099('0x8'),util[_0xf099('0x9')](_0xf099('0xa'),_0x9dc437,_0x3f46c0,_0x11d863));var _0x50efa3=_0x5a3398['update'](_0x45f85c,_0xf099('0xb'),_0xf099('0xc'));_0x50efa3+=_0x5a3398[_0xf099('0xd')](_0xf099('0xc'));var _0x56af08=JSON[_0xf099('0xe')](_0x50efa3);return _0x56af08[_0xf099('0xf')](_0x1eb98e)?_0x56af08[_0x1eb98e]:null;}}return null;}function isLimit(_0x34df63,_0x236bcf,_0x31b544,_0x100303){var _0x21cf98=_0x236bcf;return compose()[_0xf099('0x10')](function(_0x5766a0,_0x4bbb32,_0x28174a){return db['License'][_0xf099('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xf099('0x12')](function(_0x5f53c0){var _0x3b7a6=getValueFromLicense(_0x34df63,_0x5f53c0);return _0x3b7a6?_0x3b7a6:_0x21cf98;})[_0xf099('0x12')](function(_0x19998d){_0x21cf98=_0x19998d;return _0x31b544['count'](_0x100303);})[_0xf099('0x12')](function(_0x46b06){if(_0x46b06>=_0x21cf98){return _0x4bbb32[_0xf099('0x13')](0x193)[_0xf099('0x14')]({'message':util[_0xf099('0x9')](_0xf099('0x15'),_0x34df63)});}_0x28174a();})[_0xf099('0x16')](function(_0x3ffb67){_0x28174a(_0x3ffb67);});});}function isUserLimit(){return isLimit(_0xf099('0x17'),0x1,db['User'],{'where':{'$or':[{'role':_0xf099('0x18')},{'role':_0xf099('0x19')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7341796..f6c9eb3 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 _0xb35c=['filters','isEmpty','forOwn','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','isArray','length','isObject','isString','unset','fields','split'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0xb35c,0x9f));var _0xcb35=function(_0x2fdb1d,_0x213140){_0x2fdb1d=_0x2fdb1d-0x0;var _0x3e363e=_0xb35c[_0x2fdb1d];return _0x3e363e;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var LIMIT_VALUE=0xfa;exports[_0xcb35('0x0')]=function(_0x578c4c){var _0x4a00b9=null;if(_0x578c4c){_0x4a00b9=_0x578c4c[_0xcb35('0x1')](',');}return _0x4a00b9;};exports[_0xcb35('0x2')]=function(_0xf47de1){var _0x3e4250={};if(!_[_0xcb35('0x3')](_0xf47de1)){_0x3e4250={};_[_0xcb35('0x4')](_0xf47de1,function(_0x26f7df,_0x2be22c){try{_0x3e4250[_0x2be22c]=JSON['parse'](_0x26f7df);}catch(_0x2e8ace){_0x3e4250[_0x2be22c]=_0x26f7df['split'](',');}});}return _0x3e4250;};exports[_0xcb35('0x5')]=function(_0x4386c1){_0x4386c1=parseInt(_0x4386c1,0xa);if(!_0x4386c1||_0x4386c1<0x0){_0x4386c1=LIMIT_VALUE;}return _0x4386c1;};exports[_0xcb35('0x6')]=function(_0x242191){_0x242191=parseInt(_0x242191,0xa);if(!_0x242191||_0x242191<0x0){_0x242191=0x0;}return _0x242191;};exports[_0xcb35('0x7')]=function(_0x17b9ee){var _0x44df33,_0x5b9995=null;if(_0x17b9ee){_0x44df33=_0x17b9ee[_0xcb35('0x1')](',');_0x5b9995=_[_0xcb35('0x8')](_0x44df33,function(_0x1b05ad){if(_0x1b05ad[_0xcb35('0x9')]('-')===0x0){return[_0x1b05ad===_0xcb35('0xa')?sequelize['cast'](sequelize[_0xcb35('0xb')](_0xcb35('0xa')),_0xcb35('0xc')):_0x1b05ad[_0xcb35('0xd')](0x1),_0xcb35('0xe')];}else{return[_0x1b05ad===_0xcb35('0xa')?sequelize[_0xcb35('0xf')](sequelize[_0xcb35('0xb')]('priority'),_0xcb35('0xc')):_0x1b05ad,_0xcb35('0x10')];}});}return _0x5b9995;};exports[_0xcb35('0x11')]=function(_0x29ec27,_0x1af2a8){if(_[_0xcb35('0x3')](_0x29ec27)){return _0x29ec27;}if(_[_0xcb35('0x12')](_0x29ec27)){for(var _0x4f78ba=0x0;_0x4f78ba<_0x29ec27[_0xcb35('0x13')];_0x4f78ba+=0x1){_0x29ec27[_0x4f78ba]=this[_0xcb35('0x11')](_0x29ec27[_0x4f78ba],_0x1af2a8);}return _0x29ec27;}if(!_[_0xcb35('0x14')](_0x29ec27)){return _0x29ec27;}if(_[_0xcb35('0x15')](_0x1af2a8)){_0x1af2a8=[_0x1af2a8];}if(!_[_0xcb35('0x12')](_0x1af2a8)){return _0x29ec27;}for(var _0x538109=0x0;_0x538109<_0x1af2a8[_0xcb35('0x13')];_0x538109+=0x1){_[_0xcb35('0x16')](_0x29ec27,_0x1af2a8[_0x538109]);}for(var _0x18dadb in _0x29ec27){if(_0x29ec27['hasOwnProperty'](_0x18dadb)){_0x29ec27[_0x18dadb]=this[_0xcb35('0x11')](_0x29ec27[_0x18dadb],_0x1af2a8);}}return _0x29ec27;}; \ No newline at end of file +var _0x31f4=['hasOwnProperty','lodash','sequelize','fields','parse','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','isEmpty','isArray','length','isObject','isString','unset'];(function(_0x2d77db,_0x433b58){var _0x5cf52=function(_0x88be8c){while(--_0x88be8c){_0x2d77db['push'](_0x2d77db['shift']());}};_0x5cf52(++_0x433b58);}(_0x31f4,0x181));var _0x431f=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x31f4[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x431f('0x0'));var sequelize=require(_0x431f('0x1'));var LIMIT_VALUE=0xfa;exports[_0x431f('0x2')]=function(_0x2f8037){var _0x539a50=null;if(_0x2f8037){_0x539a50=_0x2f8037['split'](',');}return _0x539a50;};exports['filters']=function(_0x485bbd){var _0x5c3470={};if(!_['isEmpty'](_0x485bbd)){_0x5c3470={};_['forOwn'](_0x485bbd,function(_0x4f8735,_0x1a9d3c){try{_0x5c3470[_0x1a9d3c]=JSON[_0x431f('0x3')](_0x4f8735);}catch(_0x35d080){_0x5c3470[_0x1a9d3c]=_0x4f8735[_0x431f('0x4')](',');}});}return _0x5c3470;};exports[_0x431f('0x5')]=function(_0x58fe11){_0x58fe11=parseInt(_0x58fe11,0xa);if(!_0x58fe11||_0x58fe11<0x0){_0x58fe11=LIMIT_VALUE;}return _0x58fe11;};exports[_0x431f('0x6')]=function(_0x4e667d){_0x4e667d=parseInt(_0x4e667d,0xa);if(!_0x4e667d||_0x4e667d<0x0){_0x4e667d=0x0;}return _0x4e667d;};exports[_0x431f('0x7')]=function(_0x275702){var _0x213b35,_0x211d05=null;if(_0x275702){_0x213b35=_0x275702[_0x431f('0x4')](',');_0x211d05=_[_0x431f('0x8')](_0x213b35,function(_0x2a96da){if(_0x2a96da[_0x431f('0x9')]('-')===0x0){return[_0x2a96da===_0x431f('0xa')?sequelize[_0x431f('0xb')](sequelize[_0x431f('0xc')](_0x431f('0xa')),_0x431f('0xd')):_0x2a96da['substr'](0x1),_0x431f('0xe')];}else{return[_0x2a96da===_0x431f('0xa')?sequelize[_0x431f('0xb')](sequelize[_0x431f('0xc')](_0x431f('0xa')),_0x431f('0xd')):_0x2a96da,_0x431f('0xf')];}});}return _0x211d05;};exports[_0x431f('0x10')]=function(_0x44474a,_0xe94203){if(_[_0x431f('0x11')](_0x44474a)){return _0x44474a;}if(_[_0x431f('0x12')](_0x44474a)){for(var _0x5f2f97=0x0;_0x5f2f97<_0x44474a[_0x431f('0x13')];_0x5f2f97+=0x1){_0x44474a[_0x5f2f97]=this[_0x431f('0x10')](_0x44474a[_0x5f2f97],_0xe94203);}return _0x44474a;}if(!_[_0x431f('0x14')](_0x44474a)){return _0x44474a;}if(_[_0x431f('0x15')](_0xe94203)){_0xe94203=[_0xe94203];}if(!_[_0x431f('0x12')](_0xe94203)){return _0x44474a;}for(var _0x2bac0c=0x0;_0x2bac0c<_0xe94203['length'];_0x2bac0c+=0x1){_[_0x431f('0x16')](_0x44474a,_0xe94203[_0x2bac0c]);}for(var _0x8a94d1 in _0x44474a){if(_0x44474a[_0x431f('0x17')](_0x8a94d1)){_0x44474a[_0x8a94d1]=this[_0x431f('0x10')](_0x44474a[_0x8a94d1],_0xe94203);}}return _0x44474a;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index fe6f1de..7a93ba6 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['use','join','root','favicon.ico','set','appPath','development','test','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','body-parser','method-override','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','default','get','env','production'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x3071('0x0'));var methodOverride=require(_0x3071('0x1'));var cookieParser=require(_0x3071('0x2'));var errorHandler=require(_0x3071('0x3'));var path=require(_0x3071('0x4'));var passport=require('passport');var cors=require(_0x3071('0x5'));var moment=require(_0x3071('0x6'));var config=require(_0x3071('0x7'));var db=require(_0x3071('0x8'))['db'];exports[_0x3071('0x9')]=function(_0x41cf76){var _0x1d3dd6=_0x41cf76[_0x3071('0xa')](_0x3071('0xb'));if(_0x1d3dd6===_0x3071('0xc')){_0x41cf76[_0x3071('0xd')](favicon(path[_0x3071('0xe')](config[_0x3071('0xf')],'public',_0x3071('0x10'))));_0x41cf76[_0x3071('0x11')](_0x3071('0x12'),path[_0x3071('0xe')](config[_0x3071('0xf')],'public'));}if(_0x1d3dd6===_0x3071('0x13')||_0x1d3dd6===_0x3071('0x14')){_0x41cf76[_0x3071('0xd')](favicon(path[_0x3071('0xe')](config[_0x3071('0xf')],'client','favicon.ico')));_0x41cf76[_0x3071('0x11')]('appPath',path[_0x3071('0xe')](config[_0x3071('0xf')],'client'));_0x41cf76[_0x3071('0xd')](errorHandler());}_0x41cf76['set'](_0x3071('0x15'),function(_0x45c93b,_0x1271d0){if(this[_0x45c93b]instanceof Date){_0x1271d0=this[_0x45c93b][_0x3071('0x16')]()[_0x3071('0x17')]('.')[0x0]+'Z';}return _0x1271d0;});_0x41cf76[_0x3071('0xd')](express[_0x3071('0x18')](_0x41cf76[_0x3071('0xa')](_0x3071('0x12'))));_0x41cf76[_0x3071('0x11')]('views',config[_0x3071('0xf')]+_0x3071('0x19'));_0x41cf76[_0x3071('0x1a')](_0x3071('0x1b'),require(_0x3071('0x1c'))[_0x3071('0x1d')]);_0x41cf76[_0x3071('0x11')](_0x3071('0x1e'),'html');_0x41cf76[_0x3071('0xd')](bodyParser[_0x3071('0x1f')]({'limit':_0x3071('0x20'),'extended':!![]}));_0x41cf76['use'](bodyParser[_0x3071('0x21')]({'limit':'50mb'}));_0x41cf76[_0x3071('0xd')](cors());_0x41cf76[_0x3071('0xd')](methodOverride());_0x41cf76[_0x3071('0xd')](cookieParser());_0x41cf76[_0x3071('0xd')](passport[_0x3071('0x22')]());}; \ No newline at end of file +var _0x34e8=['passport','cors','moment','./environment','../mysqldb','get','env','production','use','join','root','public','favicon.ico','set','appPath','development','test','client','json\x20replacer','split','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','json','express','serve-favicon','body-parser','method-override','errorhandler','path'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x34e8,0x12c));var _0x834e=function(_0x233e2e,_0x1ab494){_0x233e2e=_0x233e2e-0x0;var _0x3a0a45=_0x34e8[_0x233e2e];return _0x3a0a45;};'use strict';var express=require(_0x834e('0x0'));var favicon=require(_0x834e('0x1'));var bodyParser=require(_0x834e('0x2'));var methodOverride=require(_0x834e('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x834e('0x4'));var path=require(_0x834e('0x5'));var passport=require(_0x834e('0x6'));var cors=require(_0x834e('0x7'));var moment=require(_0x834e('0x8'));var config=require(_0x834e('0x9'));var db=require(_0x834e('0xa'))['db'];exports['default']=function(_0x858aa1){var _0x52056d=_0x858aa1[_0x834e('0xb')](_0x834e('0xc'));if(_0x52056d===_0x834e('0xd')){_0x858aa1[_0x834e('0xe')](favicon(path[_0x834e('0xf')](config[_0x834e('0x10')],_0x834e('0x11'),_0x834e('0x12'))));_0x858aa1[_0x834e('0x13')](_0x834e('0x14'),path[_0x834e('0xf')](config[_0x834e('0x10')],_0x834e('0x11')));}if(_0x52056d===_0x834e('0x15')||_0x52056d===_0x834e('0x16')){_0x858aa1[_0x834e('0xe')](favicon(path[_0x834e('0xf')](config['root'],_0x834e('0x17'),_0x834e('0x12'))));_0x858aa1['set'](_0x834e('0x14'),path[_0x834e('0xf')](config[_0x834e('0x10')],_0x834e('0x17')));_0x858aa1['use'](errorHandler());}_0x858aa1[_0x834e('0x13')](_0x834e('0x18'),function(_0x57274a,_0x316205){if(this[_0x57274a]instanceof Date){_0x316205=this[_0x57274a]['toISOString']()[_0x834e('0x19')]('.')[0x0]+'Z';}return _0x316205;});_0x858aa1[_0x834e('0xe')](express['static'](_0x858aa1[_0x834e('0xb')](_0x834e('0x14'))));_0x858aa1[_0x834e('0x13')]('views',config[_0x834e('0x10')]+_0x834e('0x1a'));_0x858aa1[_0x834e('0x1b')](_0x834e('0x1c'),require(_0x834e('0x1d'))[_0x834e('0x1e')]);_0x858aa1[_0x834e('0x13')]('view\x20engine',_0x834e('0x1c'));_0x858aa1[_0x834e('0xe')](bodyParser[_0x834e('0x1f')]({'limit':_0x834e('0x20'),'extended':!![]}));_0x858aa1['use'](bodyParser[_0x834e('0x21')]({'limit':_0x834e('0x20')}));_0x858aa1['use'](cors());_0x858aa1[_0x834e('0xe')](methodOverride());_0x858aa1[_0x834e('0xe')](cookieParser());_0x858aa1[_0x834e('0xe')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b156184..f16eafc 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 _0x6294=['win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','map','join','update','digest','hex','platform'];(function(_0x317138,_0xc8684c){var _0x3d42ff=function(_0x57e8e4){while(--_0x57e8e4){_0x317138['push'](_0x317138['shift']());}};_0x3d42ff(++_0xc8684c);}(_0x6294,0x154));var _0x4629=function(_0x230b03,_0x30a762){_0x230b03=_0x230b03-0x0;var _0x19ab94=_0x6294[_0x230b03];return _0x19ab94;};'use strict';var _=require(_0x4629('0x0'));var os=require('os');var crypto=require(_0x4629('0x1'));var machine=require(_0x4629('0x2'));var exec=require(_0x4629('0x3'))[_0x4629('0x4')];function getInterfaces(){var _0x3a11cd=[];var _0x3fada8=os[_0x4629('0x5')]();var _0x4f8d48=_[_0x4629('0x6')](_[_0x4629('0x7')](_0x3fada8));for(var _0x357e93=0x0;_0x357e93<_0x4f8d48[_0x4629('0x8')];_0x357e93++){var _0x3bf900=_0x3fada8[_0x4f8d48[_0x357e93]][_0x4629('0x9')](function(_0x49150a){return _0x49150a['family']==='IPv4'&&_0x49150a[_0x4629('0xa')]===![];});_0x3a11cd=_0x3a11cd[_0x4629('0xb')](_0x3bf900);}return _0x3a11cd;}function getFirstInterface(){var _0x3abe08=_[_0x4629('0xc')](getInterfaces());return{'macAddress':_0x3abe08&&_0x3abe08[_0x4629('0xd')]?_0x3abe08[_0x4629('0xd')]:'00:00:00:00:00:00','ipAddress':_0x3abe08&&_0x3abe08[_0x4629('0xe')]?_0x3abe08[_0x4629('0xe')]:_0x4629('0xf')};}exports[_0x4629('0x10')]=getFirstInterface;function getCPUhash(){var _0x53acc7=_[_0x4629('0x6')](os['cpus']()[_0x4629('0x11')](function(_0x345eb2){return _0x345eb2['model'];}))[_0x4629('0x12')](':');return crypto['createHash']('md5')[_0x4629('0x13')](_0x53acc7)[_0x4629('0x14')](_0x4629('0x15'));}exports['getUuid']=function(){switch(os[_0x4629('0x16')]()){case _0x4629('0x17'):return exec(_0x4629('0x18'),{'encoding':_0x4629('0x19')})[_0x4629('0x1a')]('\x0d\x0a','');default:var _0xe85325=getFirstInterface();var _0x3e80ef=getCPUhash();var _0x313270=_0x3e80ef+'|'+os[_0x4629('0x1b')]()+'|'+_0xe85325[_0x4629('0x1c')]+'|'+_0xe85325[_0x4629('0x1d')];var _0x9653e7=crypto[_0x4629('0x1e')](_0x4629('0x1f'))[_0x4629('0x13')](_0x313270)[_0x4629('0x14')](_0x4629('0x15'));return _0x9653e7[_0x4629('0x20')](0x0,0x8)+'-'+_0x9653e7[_0x4629('0x20')](0x8,0xc)+'-'+_0x9653e7[_0x4629('0x20')](0xc,0x10)+'-'+_0x9653e7[_0x4629('0x20')](0x10,0x14)+'-'+_0x9653e7[_0x4629('0x20')](0x14);}}; \ No newline at end of file +var _0x34e7=['hostname','ipAddress','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','cpus','map','model','join','md5','update','digest','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x34e7,0x164));var _0x734e=function(_0x4b7a68,_0x2d75b8){_0x4b7a68=_0x4b7a68-0x0;var _0x192677=_0x34e7[_0x4b7a68];return _0x192677;};'use strict';var _=require(_0x734e('0x0'));var os=require('os');var crypto=require(_0x734e('0x1'));var machine=require(_0x734e('0x2'));var exec=require(_0x734e('0x3'))[_0x734e('0x4')];function getInterfaces(){var _0x381907=[];var _0x3872ce=os[_0x734e('0x5')]();var _0x23d0df=_[_0x734e('0x6')](_[_0x734e('0x7')](_0x3872ce));for(var _0x2bd337=0x0;_0x2bd337<_0x23d0df[_0x734e('0x8')];_0x2bd337++){var _0x192562=_0x3872ce[_0x23d0df[_0x2bd337]]['filter'](function(_0x2cf8f9){return _0x2cf8f9[_0x734e('0x9')]===_0x734e('0xa')&&_0x2cf8f9['internal']===![];});_0x381907=_0x381907[_0x734e('0xb')](_0x192562);}return _0x381907;}function getFirstInterface(){var _0x52f925=_[_0x734e('0xc')](getInterfaces());return{'macAddress':_0x52f925&&_0x52f925[_0x734e('0xd')]?_0x52f925[_0x734e('0xd')]:_0x734e('0xe'),'ipAddress':_0x52f925&&_0x52f925[_0x734e('0xf')]?_0x52f925[_0x734e('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xaabf6b=_[_0x734e('0x6')](os[_0x734e('0x10')]()[_0x734e('0x11')](function(_0x4bf3e0){return _0x4bf3e0[_0x734e('0x12')];}))[_0x734e('0x13')](':');return crypto['createHash'](_0x734e('0x14'))[_0x734e('0x15')](_0xaabf6b)[_0x734e('0x16')](_0x734e('0x17'));}exports[_0x734e('0x18')]=function(){switch(os['platform']()){case _0x734e('0x19'):return exec(_0x734e('0x1a'),{'encoding':_0x734e('0x1b')})['replace']('\x0d\x0a','');default:var _0x2c1bdb=getFirstInterface();var _0x4cb595=getCPUhash();var _0x173009=_0x4cb595+'|'+os[_0x734e('0x1c')]()+'|'+_0x2c1bdb['macAddress']+'|'+_0x2c1bdb[_0x734e('0x1d')];var _0x52b432=crypto[_0x734e('0x1e')]('md5')[_0x734e('0x15')](_0x173009)[_0x734e('0x16')](_0x734e('0x17'));return _0x52b432[_0x734e('0x1f')](0x0,0x8)+'-'+_0x52b432[_0x734e('0x1f')](0x8,0xc)+'-'+_0x52b432[_0x734e('0x1f')](0xc,0x10)+'-'+_0x52b432[_0x734e('0x1f')](0x10,0x14)+'-'+_0x52b432[_0x734e('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index fb863c6..9889e5a 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 _0xdaa4=['../environment','../logger','license','../../api/jira/jira.controller','www.xcallymotion.com','format','exports','application/json','request','utf8','end','createCipher','secrets','session','update','base64','final','createDecipher','aes-256-ctr','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','then','|uuid|','|machineUuid|','|name|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','https','moment','pkginfo','version','../../mysqldb'];(function(_0x19e769,_0x4f38e0){var _0x307124=function(_0x334abd){while(--_0x334abd){_0x19e769['push'](_0x19e769['shift']());}};_0x307124(++_0x4f38e0);}(_0xdaa4,0xb8));var _0x4daa=function(_0x522a18,_0x2d0fa8){_0x522a18=_0x522a18-0x0;var _0x31f964=_0xdaa4[_0x522a18];return _0x31f964;};'use strict';var util=require('util');var https=require(_0x4daa('0x0'));var crypto=require('crypto');var moment=require(_0x4daa('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x4daa('0x2'))(module,_0x4daa('0x3'));var db=require(_0x4daa('0x4'))['db'];var config=require(_0x4daa('0x5'));var hardware=require('./hardware');var logger=require(_0x4daa('0x6'))(_0x4daa('0x7'));var jira=require(_0x4daa('0x8'));var HOST=_0x4daa('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x1361ec){return new BPromise(function(_0x4dc9f8,_0x519502){var _0x108e42={'host':HOST,'port':0x1bb,'path':util[_0x4daa('0xa')]('/api/servers/%s/check?version=%s',_0x1361ec,module[_0x4daa('0xb')][_0x4daa('0x3')]),'method':'GET','timeout':0xea60,'headers':{'Content-Type':_0x4daa('0xc')}};var _0x23d3f7=https[_0x4daa('0xd')](_0x108e42,function(_0x336100){_0x336100['setEncoding'](_0x4daa('0xe'));var _0x34063c='';_0x336100['on']('data',function(_0x87f741){_0x34063c+=_0x87f741;});_0x336100['on'](_0x4daa('0xf'),function(){try{_0x4dc9f8(JSON['parse'](_0x34063c));}catch(_0x59a887){_0x519502(_0x59a887);}});});_0x23d3f7['on']('error',_0x519502);_0x23d3f7[_0x4daa('0xf')]();});}function encryptDate(_0x28d242){var _0x2c196c=crypto[_0x4daa('0x10')]('aes-256-ctr',config[_0x4daa('0x11')][_0x4daa('0x12')]);var _0x5696eb=_0x2c196c[_0x4daa('0x13')](_0x28d242,'utf8',_0x4daa('0x14'));_0x5696eb+=_0x2c196c[_0x4daa('0x15')](_0x4daa('0x14'));return _0x5696eb;}function decryptDate(_0x56f8d2){var _0x1e3063=crypto[_0x4daa('0x16')](_0x4daa('0x17'),config[_0x4daa('0x11')]['session']);var _0x39eeaf=_0x1e3063[_0x4daa('0x13')](_0x56f8d2,_0x4daa('0x14'),'utf8');_0x39eeaf+=_0x1e3063[_0x4daa('0x15')](_0x4daa('0xe'));return _0x39eeaf;}function sendJiraAlert(_0x3c7e5b,_0x26d1f6,_0x4bc793){var _0x4f114a=_0x4daa('0x18');return db[_0x4daa('0x19')][_0x4daa('0x1a')]({'where':{'role':_0x4daa('0x1b')},'attributes':[_0x4daa('0x1c'),_0x4daa('0x1d')],'raw':!![]})[_0x4daa('0x1e')](function(_0x3ab191){ADMIN=_0x3ab191;_0x4f114a+='|reason|'+_0x4bc793+'|\x0a';_0x4f114a+=_0x4daa('0x1f')+_0x3c7e5b+'|\x0a';_0x4f114a+=_0x4daa('0x20')+_0x26d1f6+'|\x0a';_0x4f114a+=_0x4daa('0x21')+ADMIN[_0x4daa('0x1c')]+'|\x0a';_0x4f114a+='|email|'+ADMIN[_0x4daa('0x1d')]+'|\x0a';return _0x4f114a;})[_0x4daa('0x1e')](function(_0x20269d){var _0x7f3230=hardware[_0x4daa('0x22')]()[_0x4daa('0x23')];return jira[_0x4daa('0x24')]({'key':_0x4daa('0x25'),'summary':_0x4daa('0x26'),'description':_0x20269d,'issuetype':_0x4daa('0x27'),'oldToken':_0x3c7e5b,'newToken':_0x26d1f6,'email':ADMIN[_0x4daa('0x1d')],'name':ADMIN[_0x4daa('0x1c')],'reason':GRAY_PERIOD_REASON,'ip':_0x7f3230});});}function manageLicense(_0x22fb47,_0xe359de){var _0x3e2ce3=_0xe359de[_0x4daa('0x28')]({'plain':!![]});httpRequest(_0x22fb47)[_0x4daa('0x1e')](function(_0x275587){if(_0x275587[_0x4daa('0x29')]){if(!_0x3e2ce3[_0x4daa('0x7')]&&_0x3e2ce3['license']!=_0x275587['license']||_0x3e2ce3['license']&&_0x3e2ce3[_0x4daa('0x2a')]){logger[_0x4daa('0x2b')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3e2ce3[_0x4daa('0x7')]&&!_0x3e2ce3[_0x4daa('0x2a')]&&_0x3e2ce3[_0x4daa('0x7')]!=_0x275587[_0x4daa('0x7')]){logger[_0x4daa('0x2b')](_0x4daa('0x2c'));}if(_0x3e2ce3['license']&&!_0x3e2ce3[_0x4daa('0x2a')]&&_0x3e2ce3[_0x4daa('0x7')]==_0x275587[_0x4daa('0x7')]){return _0xe359de;}return _0xe359de['update']({'data1':_0x22fb47,'data2':null,'license':_0x275587[_0x4daa('0x7')]});}else{if(_0x275587['license']||_0x3e2ce3[_0x4daa('0x7')]){if(!_0x3e2ce3[_0x4daa('0x2a')]){if(_0x3e2ce3[_0x4daa('0x2d')]==_0x22fb47){GRAY_PERIOD_REASON=_0x4daa('0x2e');logger['info'](_0x4daa('0x2f'));}else{GRAY_PERIOD_REASON=_0x4daa('0x30');logger[_0x4daa('0x2b')](_0x4daa('0x31'),_0x3e2ce3['data1'],_0x22fb47);}sendJiraAlert(_0x3e2ce3['data1'],_0x275587['uuid'],GRAY_PERIOD_REASON);logger[_0x4daa('0x2b')](_0x4daa('0x32'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x4daa('0xa')](_0x4daa('0x33')));return _0xe359de[_0x4daa('0x13')]({'data2':encryptDate(moment()[_0x4daa('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x4daa('0x34')](decryptDate(_0x3e2ce3['data2']),'days')>DAYS){logger[_0x4daa('0x2b')](_0x4daa('0x35'),moment()[_0x4daa('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0xe359de[_0x4daa('0x13')]({'data1':_0x22fb47,'data2':null,'license':null});}}}else{if(_0x3e2ce3[_0x4daa('0x2d')]!=_0x22fb47){logger[_0x4daa('0x2b')](_0x4daa('0x31'),_0x3e2ce3[_0x4daa('0x2d')],_0x22fb47);return _0xe359de[_0x4daa('0x13')]({'data1':_0x22fb47,'data2':null,'license':null});}}}return _0xe359de;})['then'](function(_0x3d5bce){_0xe359de=_0x3d5bce;})[_0x4daa('0x36')](function(_0xac1704){logger[_0x4daa('0x37')](_0xac1704[_0x4daa('0x38')]);})[_0x4daa('0x39')](function(){setTimeout(function(){manageLicense(hardware[_0x4daa('0x3a')](),_0xe359de);},TIME);});}function defaultLicense(){var _0x3db73c=hardware[_0x4daa('0x3a')]();if(_0x3db73c){return db[_0x4daa('0x3b')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x3db73c}})[_0x4daa('0x3c')](function(_0x45aeeb,_0x3a8946){logger[_0x4daa('0x2b')](_0x4daa('0x3d'),_0x3db73c);manageLicense(_0x3db73c,_0x45aeeb);})[_0x4daa('0x36')](function(_0x4e8b9c){logger[_0x4daa('0x37')](_0x4e8b9c[_0x4daa('0x38')]);});}}exports[_0x4daa('0x3e')]=defaultLicense; \ No newline at end of file +var _0x757a=['Disabled','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','diff','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','then','catch','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','https','crypto','moment','bluebird','pkginfo','version','../environment','../logger','license','../../api/jira/jira.controller','www.xcallymotion.com','format','/api/servers/%s/check?version=%s','GET','application/json','request','setEncoding','utf8','data','end','parse','error','createCipher','session','update','base64','createDecipher','aes-256-ctr','secrets','final','User','findOne','admin','fullname','email','|reason|','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','get','data2','info','data1'];(function(_0x1f587c,_0x382ac8){var _0x51cc64=function(_0x57f99c){while(--_0x57f99c){_0x1f587c['push'](_0x1f587c['shift']());}};_0x51cc64(++_0x382ac8);}(_0x757a,0xc4));var _0xa757=function(_0x4ade6b,_0x29bcb2){_0x4ade6b=_0x4ade6b-0x0;var _0x6b76d4=_0x757a[_0x4ade6b];return _0x6b76d4;};'use strict';var util=require('util');var https=require(_0xa757('0x0'));var crypto=require(_0xa757('0x1'));var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var pkginfo=require(_0xa757('0x4'))(module,_0xa757('0x5'));var db=require('../../mysqldb')['db'];var config=require(_0xa757('0x6'));var hardware=require('./hardware');var logger=require(_0xa757('0x7'))(_0xa757('0x8'));var jira=require(_0xa757('0x9'));var HOST=_0xa757('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x581c83){return new BPromise(function(_0xcbad52,_0x178c2b){var _0x1d7bed={'host':HOST,'port':0x1bb,'path':util[_0xa757('0xb')](_0xa757('0xc'),_0x581c83,module['exports']['version']),'method':_0xa757('0xd'),'timeout':0xea60,'headers':{'Content-Type':_0xa757('0xe')}};var _0x548965=https[_0xa757('0xf')](_0x1d7bed,function(_0x1bc018){_0x1bc018[_0xa757('0x10')](_0xa757('0x11'));var _0x3a3b75='';_0x1bc018['on'](_0xa757('0x12'),function(_0x5f1d9b){_0x3a3b75+=_0x5f1d9b;});_0x1bc018['on'](_0xa757('0x13'),function(){try{_0xcbad52(JSON[_0xa757('0x14')](_0x3a3b75));}catch(_0x29ee78){_0x178c2b(_0x29ee78);}});});_0x548965['on'](_0xa757('0x15'),_0x178c2b);_0x548965[_0xa757('0x13')]();});}function encryptDate(_0x49eee0){var _0xd90d7a=crypto[_0xa757('0x16')]('aes-256-ctr',config['secrets'][_0xa757('0x17')]);var _0x1149d5=_0xd90d7a[_0xa757('0x18')](_0x49eee0,_0xa757('0x11'),_0xa757('0x19'));_0x1149d5+=_0xd90d7a['final'](_0xa757('0x19'));return _0x1149d5;}function decryptDate(_0x59b7f5){var _0x15b3fd=crypto[_0xa757('0x1a')](_0xa757('0x1b'),config[_0xa757('0x1c')][_0xa757('0x17')]);var _0x469042=_0x15b3fd[_0xa757('0x18')](_0x59b7f5,_0xa757('0x19'),_0xa757('0x11'));_0x469042+=_0x15b3fd[_0xa757('0x1d')](_0xa757('0x11'));return _0x469042;}function sendJiraAlert(_0x3a83e4,_0x315db0,_0x4ff999){var _0x2e44b5='||FIELD||VALUE||\x0a';return db[_0xa757('0x1e')][_0xa757('0x1f')]({'where':{'role':_0xa757('0x20')},'attributes':[_0xa757('0x21'),_0xa757('0x22')],'raw':!![]})['then'](function(_0x284a6c){ADMIN=_0x284a6c;_0x2e44b5+=_0xa757('0x23')+_0x4ff999+'|\x0a';_0x2e44b5+='|uuid|'+_0x3a83e4+'|\x0a';_0x2e44b5+='|machineUuid|'+_0x315db0+'|\x0a';_0x2e44b5+='|name|'+ADMIN[_0xa757('0x21')]+'|\x0a';_0x2e44b5+='|email|'+ADMIN['email']+'|\x0a';return _0x2e44b5;})['then'](function(_0x263d7a){var _0x35b258=hardware[_0xa757('0x24')]()[_0xa757('0x25')];return jira[_0xa757('0x26')]({'key':'MOTLICENSE','summary':_0xa757('0x27'),'description':_0x263d7a,'issuetype':'Alert','oldToken':_0x3a83e4,'newToken':_0x315db0,'email':ADMIN[_0xa757('0x22')],'name':ADMIN[_0xa757('0x21')],'reason':GRAY_PERIOD_REASON,'ip':_0x35b258});});}function manageLicense(_0x1c84a4,_0x35ba05){var _0x3313b0=_0x35ba05[_0xa757('0x28')]({'plain':!![]});httpRequest(_0x1c84a4)['then'](function(_0x1f75c5){if(_0x1f75c5['active']){if(!_0x3313b0[_0xa757('0x8')]&&_0x3313b0[_0xa757('0x8')]!=_0x1f75c5['license']||_0x3313b0[_0xa757('0x8')]&&_0x3313b0[_0xa757('0x29')]){logger[_0xa757('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3313b0[_0xa757('0x8')]&&!_0x3313b0[_0xa757('0x29')]&&_0x3313b0[_0xa757('0x8')]!=_0x1f75c5['license']){logger[_0xa757('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3313b0[_0xa757('0x8')]&&!_0x3313b0[_0xa757('0x29')]&&_0x3313b0[_0xa757('0x8')]==_0x1f75c5[_0xa757('0x8')]){return _0x35ba05;}return _0x35ba05['update']({'data1':_0x1c84a4,'data2':null,'license':_0x1f75c5[_0xa757('0x8')]});}else{if(_0x1f75c5[_0xa757('0x8')]||_0x3313b0['license']){if(!_0x3313b0[_0xa757('0x29')]){if(_0x3313b0[_0xa757('0x2b')]==_0x1c84a4){GRAY_PERIOD_REASON=_0xa757('0x2c');logger[_0xa757('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0xa757('0x2a')](_0xa757('0x2d'),_0x3313b0[_0xa757('0x2b')],_0x1c84a4);}sendJiraAlert(_0x3313b0[_0xa757('0x2b')],_0x1f75c5['uuid'],GRAY_PERIOD_REASON);logger['info'](_0xa757('0x2e'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xa757('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x35ba05['update']({'data2':encryptDate(moment()[_0xa757('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xa757('0x2f')](decryptDate(_0x3313b0[_0xa757('0x29')]),_0xa757('0x30'))>DAYS){logger[_0xa757('0x2a')](_0xa757('0x31'),moment()[_0xa757('0xb')](_0xa757('0x32')));return _0x35ba05[_0xa757('0x18')]({'data1':_0x1c84a4,'data2':null,'license':null});}}}else{if(_0x3313b0[_0xa757('0x2b')]!=_0x1c84a4){logger[_0xa757('0x2a')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3313b0['data1'],_0x1c84a4);return _0x35ba05[_0xa757('0x18')]({'data1':_0x1c84a4,'data2':null,'license':null});}}}return _0x35ba05;})[_0xa757('0x33')](function(_0x42bbc2){_0x35ba05=_0x42bbc2;})[_0xa757('0x34')](function(_0x45f37d){logger[_0xa757('0x15')](_0x45f37d[_0xa757('0x35')]);})[_0xa757('0x36')](function(){setTimeout(function(){manageLicense(hardware[_0xa757('0x37')](),_0x35ba05);},TIME);});}function defaultLicense(){var _0x2b60ca=hardware['getUuid']();if(_0x2b60ca){return db[_0xa757('0x38')][_0xa757('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x2b60ca}})[_0xa757('0x3a')](function(_0x18d376,_0x1e388b){logger[_0xa757('0x2a')](_0xa757('0x3b'),_0x2b60ca);manageLicense(_0x2b60ca,_0x18d376);})['catch'](function(_0x488da5){logger['error'](_0x488da5[_0xa757('0x35')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 0a34069..c9b03fe 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 _0x5a91=['%s:%s:%s','base64','utf8','final','uuid','machineUuid','getUuid','secrets','session','update','deadline','add','days','format','grayReason','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','License','find','defaults','then','checkLicense','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr'];(function(_0x4be6bc,_0x1c0427){var _0x107d66=function(_0x152eee){while(--_0x152eee){_0x4be6bc['push'](_0x4be6bc['shift']());}};_0x107d66(++_0x1c0427);}(_0x5a91,0x139));var _0x15a9=function(_0x571714,_0x30d2b3){_0x571714=_0x571714-0x0;var _0x599a14=_0x5a91[_0x571714];return _0x599a14;};'use strict';var crypto=require(_0x15a9('0x0'));var util=require(_0x15a9('0x1'));var _=require(_0x15a9('0x2'));var moment=require(_0x15a9('0x3'));var hardware=require(_0x15a9('0x4'));var config=require(_0x15a9('0x5'));var db=require(_0x15a9('0x6'))['db'];function checkLicense(_0x4214c2,_0x309dae){if(_0x4214c2){try{var _0x3d2743=_0x309dae||_0x4214c2[_0x15a9('0x7')];if(_[_0x15a9('0x8')](_0x3d2743)){throw new Error(_0x15a9('0x9'));}var _0x5df50f=_0x4214c2[_0x15a9('0xa')];var _0x5c043f=_0x4214c2[_0x15a9('0xb')];var _0x1c0adb=_0x5df50f['split']('-')[0x4];var _0x379309=_0x5df50f[_0x15a9('0xc')]('-')[0x0];var _0x494b29=crypto[_0x15a9('0xd')](_0x15a9('0xe'),util['format'](_0x15a9('0xf'),_0x1c0adb,_0x5df50f,_0x379309));var _0x185fa1=_0x494b29['update'](_0x3d2743,_0x15a9('0x10'),_0x15a9('0x11'));_0x185fa1+=_0x494b29[_0x15a9('0x12')]('utf8');var _0x585b86=JSON['parse'](_0x185fa1);_0x585b86['demo']=![];_0x585b86[_0x15a9('0x13')]=_0x5df50f;_0x585b86[_0x15a9('0x14')]=hardware[_0x15a9('0x15')]();if(_0x5c043f){var _0xf42e5b=crypto[_0x15a9('0xd')](_0x15a9('0xe'),config[_0x15a9('0x16')][_0x15a9('0x17')]);var _0x272a70=_0xf42e5b[_0x15a9('0x18')](_0x5c043f,_0x15a9('0x10'),_0x15a9('0x11'));_0x272a70+=_0xf42e5b['final'](_0x15a9('0x11'));_0x585b86['gray']=_0x272a70;_0x585b86[_0x15a9('0x19')]=moment(_0x272a70)[_0x15a9('0x1a')](0x7,_0x15a9('0x1b'))[_0x15a9('0x1c')]();_0x585b86[_0x15a9('0x1d')]=_0x585b86['uuid']!=_0x585b86[_0x15a9('0x14')]?'changed':_0x15a9('0x1e');}return _0x585b86;}catch(_0xef44b7){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x15a9('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x15a9('0x20'),'uuid':_0x4214c2[_0x15a9('0xa')],'machineUuid':hardware['getUuid'](),'message':_0xef44b7[_0x15a9('0x21')],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x15a9('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x15a9('0x22'),'uuid':_0x4214c2[_0x15a9('0xa')],'machineUuid':hardware[_0x15a9('0x15')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports[_0x15a9('0x23')]=function(_0x1492f8){return db[_0x15a9('0x24')][_0x15a9('0x25')](_[_0x15a9('0x26')](_0x1492f8,{'raw':!![],'where':{'id':0x1}}))[_0x15a9('0x27')](function(_0x28c8e4){return checkLicense(_0x28c8e4,null);});};exports[_0x15a9('0x28')]=checkLicense; \ No newline at end of file +var _0xe3b9=['data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','final','utf8','demo','uuid','getUuid','secrets','session','gray','deadline','add','days','machineUuid','changed','Breaking\x20license','2027-01-01T00:00:00.000Z','Demo\x20license','License','find','defaults','then','checkLicense','util','lodash','./hardware','../environment','../../mysqldb','license','isEmpty','data1'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xe3b9,0x13c));var _0x9e3b=function(_0x2b2726,_0x2d8e56){_0x2b2726=_0x2b2726-0x0;var _0x17598b=_0xe3b9[_0x2b2726];return _0x17598b;};'use strict';var crypto=require('crypto');var util=require(_0x9e3b('0x0'));var _=require(_0x9e3b('0x1'));var moment=require('moment');var hardware=require(_0x9e3b('0x2'));var config=require(_0x9e3b('0x3'));var db=require(_0x9e3b('0x4'))['db'];function checkLicense(_0x590f06,_0x4a6e38){if(_0x590f06){try{var _0x258d08=_0x4a6e38||_0x590f06[_0x9e3b('0x5')];if(_[_0x9e3b('0x6')](_0x258d08)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5198dd=_0x590f06[_0x9e3b('0x7')];var _0x9e7549=_0x590f06[_0x9e3b('0x8')];var _0x282514=_0x5198dd[_0x9e3b('0x9')]('-')[0x4];var _0x359141=_0x5198dd[_0x9e3b('0x9')]('-')[0x0];var _0x20314a=crypto[_0x9e3b('0xa')](_0x9e3b('0xb'),util[_0x9e3b('0xc')](_0x9e3b('0xd'),_0x282514,_0x5198dd,_0x359141));var _0x87c40a=_0x20314a['update'](_0x258d08,_0x9e3b('0xe'),'utf8');_0x87c40a+=_0x20314a[_0x9e3b('0xf')](_0x9e3b('0x10'));var _0x1e9fc5=JSON['parse'](_0x87c40a);_0x1e9fc5[_0x9e3b('0x11')]=![];_0x1e9fc5[_0x9e3b('0x12')]=_0x5198dd;_0x1e9fc5['machineUuid']=hardware[_0x9e3b('0x13')]();if(_0x9e7549){var _0x18c0a2=crypto[_0x9e3b('0xa')](_0x9e3b('0xb'),config[_0x9e3b('0x14')][_0x9e3b('0x15')]);var _0x28fb6e=_0x18c0a2['update'](_0x9e7549,'base64',_0x9e3b('0x10'));_0x28fb6e+=_0x18c0a2['final']('utf8');_0x1e9fc5[_0x9e3b('0x16')]=_0x28fb6e;_0x1e9fc5[_0x9e3b('0x17')]=moment(_0x28fb6e)[_0x9e3b('0x18')](0x7,_0x9e3b('0x19'))[_0x9e3b('0xc')]();_0x1e9fc5['grayReason']=_0x1e9fc5[_0x9e3b('0x12')]!=_0x1e9fc5[_0x9e3b('0x1a')]?_0x9e3b('0x1b'):'disabled';}return _0x1e9fc5;}catch(_0xdc131b){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':_0x9e3b('0x1c'),'uuid':_0x590f06[_0x9e3b('0x7')],'machineUuid':hardware[_0x9e3b('0x13')](),'message':_0xdc131b['message'],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9e3b('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9e3b('0x1e'),'uuid':_0x590f06[_0x9e3b('0x7')],'machineUuid':hardware[_0x9e3b('0x13')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports['getLicense']=function(_0xc7056){return db[_0x9e3b('0x1f')][_0x9e3b('0x20')](_[_0x9e3b('0x21')](_0xc7056,{'raw':!![],'where':{'id':0x1}}))[_0x9e3b('0x22')](function(_0x89552){return checkLicense(_0x89552,null);});};exports[_0x9e3b('0x23')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 2ae9f52..ff65210 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 _0x8696=['http://localhost:9000','app-id','exports'];(function(_0x4422ef,_0x1923e1){var _0xdfb928=function(_0x224862){while(--_0x224862){_0x4422ef['push'](_0x4422ef['shift']());}};_0xdfb928(++_0x1923e1);}(_0x8696,0x143));var _0x6869=function(_0x56c9b5,_0x3dffdc){_0x56c9b5=_0x56c9b5-0x0;var _0x13bf8f=_0x8696[_0x56c9b5];return _0x13bf8f;};'use strict';module[_0x6869('0x0')]={'DOMAIN':_0x6869('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x6869('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x80ce=['app-id','secret'];(function(_0x8b64b9,_0x190d7e){var _0x3b6d36=function(_0x314636){while(--_0x314636){_0x8b64b9['push'](_0x8b64b9['shift']());}};_0x3b6d36(++_0x190d7e);}(_0x80ce,0xae));var _0xe80c=function(_0x2a16f7,_0x45bf57){_0x2a16f7=_0x2a16f7-0x0;var _0x3a06ad=_0x80ce[_0x2a16f7];return _0x3a06ad;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xe80c('0x0'),'GOOGLE_SECRET':_0xe80c('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index b2d5767..3010038 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d8f=['join','/var','log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','util','path','INFO'];(function(_0x493d42,_0x4df72a){var _0x40fc42=function(_0x247992){while(--_0x247992){_0x493d42['push'](_0x493d42['shift']());}};_0x40fc42(++_0x4df72a);}(_0x8d8f,0xb4));var _0xf8d8=function(_0x537702,_0x24fc4e){_0x537702=_0x537702-0x0;var _0x1336c1=_0x8d8f[_0x537702];return _0x1336c1;};'use strict';var moment=require(_0xf8d8('0x0'));var winston=require('winston');var util=require(_0xf8d8('0x1'));var path=require(_0xf8d8('0x2'));var debugLevel=_0xf8d8('0x3');function filename(_0x10b8ab,_0x3947c7){return path[_0xf8d8('0x4')](_0xf8d8('0x5'),_0xf8d8('0x6'),'xcally',util[_0xf8d8('0x7')]('%s-%s.log',_0x10b8ab,_0x3947c7));}function formatter(_0x940b1a,_0x4893a8){return util['format'](_0xf8d8('0x8'),moment()[_0xf8d8('0x7')](_0xf8d8('0x9')),_0x4893a8[_0xf8d8('0xa')][_0xf8d8('0xb')](),_0x940b1a,_0x4893a8[_0xf8d8('0xc')]);}module[_0xf8d8('0xd')]=function(_0x1f830b){return new winston[(_0xf8d8('0xe'))]({'transports':[new winston[(_0xf8d8('0xf'))][(_0xf8d8('0x10'))]({'name':util[_0xf8d8('0x7')](_0xf8d8('0x11'),_0x1f830b,_0xf8d8('0x12')),'filename':filename(_0x1f830b,_0xf8d8('0x12')),'level':_0xf8d8('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x50df6b){return formatter(_0x1f830b,_0x50df6b);}}),new winston['transports']['File']({'name':util[_0xf8d8('0x7')](_0xf8d8('0x11'),_0x1f830b,'info'),'filename':filename(_0x1f830b,_0xf8d8('0x13')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3fae91){return formatter(_0x1f830b,_0x3fae91);}}),new winston['transports'][(_0xf8d8('0x14'))]({'level':process[_0xf8d8('0x15')][_0xf8d8('0x16')]||debugLevel,'json':![],'formatter':function(_0x1b1c7c){return formatter(_0x1f830b,_0x1b1c7c);}})]});}; \ No newline at end of file +var _0x565e=['xcally','%s-%s.log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','message','exports','transports','%s-%s','error','File','info','env','debugLevel','moment','winston','util','INFO','/var','log'];(function(_0x45edf0,_0x4562a1){var _0x31178c=function(_0x2a7bb4){while(--_0x2a7bb4){_0x45edf0['push'](_0x45edf0['shift']());}};_0x31178c(++_0x4562a1);}(_0x565e,0x1da));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xe565('0x0'));var winston=require(_0xe565('0x1'));var util=require(_0xe565('0x2'));var path=require('path');var debugLevel=_0xe565('0x3');function filename(_0x445b58,_0x149c4e){return path['join'](_0xe565('0x4'),_0xe565('0x5'),_0xe565('0x6'),util['format'](_0xe565('0x7'),_0x445b58,_0x149c4e));}function formatter(_0x51f9ff,_0x280e6f){return util[_0xe565('0x8')](_0xe565('0x9'),moment()[_0xe565('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),_0x280e6f['level'][_0xe565('0xa')](),_0x51f9ff,_0x280e6f[_0xe565('0xb')]);}module[_0xe565('0xc')]=function(_0x5a1d0c){return new winston['Logger']({'transports':[new winston[(_0xe565('0xd'))]['File']({'name':util['format'](_0xe565('0xe'),_0x5a1d0c,'error'),'filename':filename(_0x5a1d0c,_0xe565('0xf')),'level':_0xe565('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x6fc18d){return formatter(_0x5a1d0c,_0x6fc18d);}}),new winston[(_0xe565('0xd'))][(_0xe565('0x10'))]({'name':util['format'](_0xe565('0xe'),_0x5a1d0c,'info'),'filename':filename(_0x5a1d0c,_0xe565('0x11')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5eb105){return formatter(_0x5a1d0c,_0x5eb105);}}),new winston['transports']['Console']({'level':process[_0xe565('0x12')][_0xe565('0x13')]||debugLevel,'json':![],'formatter':function(_0x3cb9b0){return formatter(_0x5a1d0c,_0x3cb9b0);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e8b813a..9ddec2e 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 _0x30cf=['join','../../services/express/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','path','express'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x30cf,0x8a));var _0xf30c=function(_0x113696,_0x1843cc){_0x113696=_0x113696-0x0;var _0x1fb234=_0x30cf[_0x113696];return _0x1fb234;};'use strict';var path=require(_0xf30c('0x0'));var os=require('os');var config={'apps':[{'name':_0xf30c('0x1'),'script':path[_0xf30c('0x2')](__dirname,_0xf30c('0x3'))},{'name':'ami','script':path['join'](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0xf30c('0x2')](__dirname,_0xf30c('0x4'))},{'name':_0xf30c('0x5'),'script':path['join'](__dirname,_0xf30c('0x6'))},{'name':_0xf30c('0x7'),'script':path[_0xf30c('0x2')](__dirname,_0xf30c('0x8'))},{'name':'xdr','script':path[_0xf30c('0x2')](__dirname,_0xf30c('0x9'))}]};module['exports']=config; \ No newline at end of file +var _0xd1a2=['ami','join','../../services/ami/index.js','agi','email','../../services/email/index.js','../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../services/express/index.js'];(function(_0x4ec65f,_0x871c26){var _0x5d1143=function(_0x1ad8e5){while(--_0x1ad8e5){_0x4ec65f['push'](_0x4ec65f['shift']());}};_0x5d1143(++_0x871c26);}(_0xd1a2,0xa3));var _0x2d1a=function(_0x5714a7,_0xcdb6b){_0x5714a7=_0x5714a7-0x0;var _0x256be1=_0xd1a2[_0x5714a7];return _0x256be1;};'use strict';var path=require(_0x2d1a('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x2d1a('0x1'))},{'name':_0x2d1a('0x2'),'script':path[_0x2d1a('0x3')](__dirname,_0x2d1a('0x4'))},{'name':_0x2d1a('0x5'),'script':path[_0x2d1a('0x3')](__dirname,'../../services/agi/index.js')},{'name':_0x2d1a('0x6'),'script':path[_0x2d1a('0x3')](__dirname,_0x2d1a('0x7'))},{'name':'routing','script':path[_0x2d1a('0x3')](__dirname,_0x2d1a('0x8'))},{'name':'xdr','script':path[_0x2d1a('0x3')](__dirname,_0x2d1a('0x9'))}]};module[_0x2d1a('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 121cb9f..bb1dbe2 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(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 _0x55ca=['stop','restart','list','describe','delete','dump','pm2','bluebird','connect','start','then','disconnect'];(function(_0x6394c,_0x36d6a4){var _0x4af71f=function(_0x8d25d7){while(--_0x8d25d7){_0x6394c['push'](_0x6394c['shift']());}};_0x4af71f(++_0x36d6a4);}(_0x55ca,0x126));var _0xa55c=function(_0xd29892,_0x2b67b9){_0xd29892=_0xd29892-0x0;var _0x293dfd=_0x55ca[_0xd29892];return _0x293dfd;};'use strict';var pm2=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x5edc58,_0x49875a){return pm2[_0xa55c('0x2')](function(_0x267ea0){if(_0x267ea0){return _0x49875a(_0x267ea0);}return _0x5edc58('connected');});});};exports[_0xa55c('0x3')]=function(_0x2db02a){return connect()[_0xa55c('0x4')](function(){return new BPromise(function(_0x204951,_0x3c97c8){return pm2[_0xa55c('0x3')](_0x2db02a,function(_0x36b623,_0x4d0624){if(_0x36b623){return _0x3c97c8(_0x36b623);}pm2[_0xa55c('0x5')]();return _0x204951(_0x4d0624);});});});};exports[_0xa55c('0x6')]=function(_0x57e069){return connect()[_0xa55c('0x4')](function(){return new BPromise(function(_0x290d28,_0x52a3bc){return pm2['stop'](_0x57e069,function(_0x473d0e,_0x20c76a){if(_0x473d0e){return _0x52a3bc(_0x473d0e);}pm2[_0xa55c('0x5')]();return _0x290d28(_0x20c76a);});});});};exports[_0xa55c('0x7')]=function(_0x31646d){return connect()[_0xa55c('0x4')](function(){return new BPromise(function(_0x508342,_0x70c2de){return pm2[_0xa55c('0x7')](_0x31646d,function(_0x15eec8,_0x5d47ff){if(_0x15eec8){return _0x70c2de(_0x15eec8);}pm2['disconnect']();return _0x508342(_0x5d47ff);});});});};exports[_0xa55c('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5a3672,_0x59ea8d){return pm2[_0xa55c('0x8')](function(_0x3930e4,_0x462cd6){if(_0x3930e4){return _0x59ea8d(_0x3930e4);}pm2[_0xa55c('0x5')]();return _0x5a3672(_0x462cd6);});});});};exports[_0xa55c('0x9')]=function(_0x247e77){return connect()['then'](function(){return new BPromise(function(_0x3ccf65,_0x3dcf4f){return pm2[_0xa55c('0x9')](_0x247e77,function(_0x31e10d,_0x1c4cfd){if(_0x31e10d){return _0x3dcf4f(_0x31e10d);}pm2[_0xa55c('0x5')]();return _0x3ccf65(_0x1c4cfd);});});});};exports[_0xa55c('0xa')]=function(_0x2d09d8){return connect()[_0xa55c('0x4')](function(){return new BPromise(function(_0x4cee3c,_0x3d4c9e){return pm2[_0xa55c('0xa')](_0x2d09d8,function(_0x461284,_0x358b61){if(_0x461284){return _0x3d4c9e(_0x461284);}pm2[_0xa55c('0x5')]();return _0x4cee3c(_0x358b61);});});});};exports[_0xa55c('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5f5158,_0xd643cc){return pm2[_0xa55c('0xb')](function(_0xade4c4){if(_0xade4c4){return _0xd643cc(_0xade4c4);}return _0x5f5158('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1346b1c..99e594d 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 _0x9755=['find','then','ChatInteraction','findAll','lastMsgAt','chatTimeout','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','catch','error','lodash','ioredis','../../mysqldb','../../config/environment','localhost','socket.io-emitter','redis','Setting'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x9755,0x1c6));var _0x5975=function(_0x37eca7,_0x3e016e){_0x37eca7=_0x37eca7-0x0;var _0x222bce=_0x9755[_0x37eca7];return _0x222bce;};'use strict';var _=require(_0x5975('0x0'));var moment=require('moment');var Redis=require(_0x5975('0x1'));var db=require(_0x5975('0x2'))['db'];var config=require(_0x5975('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x5975('0x4'),'port':0x18eb});var io=require(_0x5975('0x5'))(new Redis(config[_0x5975('0x6')]));function closeInteractions(){var _0x1a201e=0x0;var _0x414e54=[];return db[_0x5975('0x7')][_0x5975('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x5975('0x9')](function(_0x2209f1){_0x1a201e=_0x2209f1['chatTimeout'];if(_0x1a201e){return db[_0x5975('0xa')][_0x5975('0xb')]({'raw':!![],'attributes':['id',_0x5975('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x2209f1[_0x5975('0xd')],'minutes')}}});}else{return[];}})['then'](function(_0xede3bb){_0x414e54=_0xede3bb;if(_0x1a201e){return db[_0x5975('0xa')][_0x5975('0xe')]({'closeReason':'system','disposition':_0x5975('0xf'),'closed':!![],'closedAt':moment()[_0x5975('0x10')](_0x5975('0x11'))},{'where':{'id':_['map'](_0x414e54||[],'id')}});}})[_0x5975('0x9')](function(_0x2ad3ed){for(var _0x2894cc=0x0;_0x2894cc<_0x414e54[_0x5975('0x12')];_0x2894cc++){io['emit']('chatInteraction:update',{'id':_0x414e54[_0x2894cc]['id'],'closed':!![]});}})[_0x5975('0x13')](function(_0x1543c5){console[_0x5975('0x14')](_0x1543c5);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6a11=['localhost','socket.io-emitter','find','chatTimeout','then','findAll','lastMsgAt','subtract','ChatInteraction','update','format','YYYY-MM-DD\x20HH:mm:ss','length','chatInteraction:update','catch','start','lodash','ioredis','../../mysqldb','../../config/environment','redis','defaults'];(function(_0x489e1c,_0x115de6){var _0x1a2f4d=function(_0x19283f){while(--_0x19283f){_0x489e1c['push'](_0x489e1c['shift']());}};_0x1a2f4d(++_0x115de6);}(_0x6a11,0xc0));var _0x16a1=function(_0x36bf18,_0x4b1907){_0x36bf18=_0x36bf18-0x0;var _0x6ebb6f=_0x6a11[_0x36bf18];return _0x6ebb6f;};'use strict';var _=require(_0x16a1('0x0'));var moment=require('moment');var Redis=require(_0x16a1('0x1'));var db=require(_0x16a1('0x2'))['db'];var config=require(_0x16a1('0x3'));config[_0x16a1('0x4')]=_[_0x16a1('0x5')](config[_0x16a1('0x4')],{'host':_0x16a1('0x6'),'port':0x18eb});var io=require(_0x16a1('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x340dd5=0x0;var _0x3c9338=[];return db['Setting'][_0x16a1('0x8')]({'raw':!![],'attributes':['id',_0x16a1('0x9')],'where':{'id':0x1}})[_0x16a1('0xa')](function(_0x2f8f51){_0x340dd5=_0x2f8f51[_0x16a1('0x9')];if(_0x340dd5){return db['ChatInteraction'][_0x16a1('0xb')]({'raw':!![],'attributes':['id',_0x16a1('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x16a1('0xd')](_0x2f8f51[_0x16a1('0x9')],'minutes')}}});}else{return[];}})[_0x16a1('0xa')](function(_0x2203fc){_0x3c9338=_0x2203fc;if(_0x340dd5){return db[_0x16a1('0xe')][_0x16a1('0xf')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x16a1('0x10')](_0x16a1('0x11'))},{'where':{'id':_['map'](_0x3c9338||[],'id')}});}})[_0x16a1('0xa')](function(_0x1af4c9){for(var _0x10c79e=0x0;_0x10c79e<_0x3c9338[_0x16a1('0x12')];_0x10c79e++){io['emit'](_0x16a1('0x13'),{'id':_0x3c9338[_0x10c79e]['id'],'closed':!![]});}})[_0x16a1('0x14')](function(_0xb4ec9){console['error'](_0xb4ec9);});}exports[_0x16a1('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 4552400..d0091cf 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 _0xdcbb=['my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','update','start','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','email','MailAccount','Smtp','service','host','port','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','then','error\x20mail','email\x20sent','error','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','toRun'];(function(_0x4671a5,_0x1db5f4){var _0x12f1ac=function(_0x3f09de){while(--_0x3f09de){_0x4671a5['push'](_0x4671a5['shift']());}};_0x12f1ac(++_0x1db5f4);}(_0xdcbb,0x66));var _0xbdcb=function(_0x21378c,_0x38ec34){_0x21378c=_0x21378c-0x0;var _0x900096=_0xdcbb[_0x21378c];return _0x900096;};'use strict';var fs=require('fs');var util=require(_0xbdcb('0x0'));var path=require(_0xbdcb('0x1'));var _=require('lodash');var moment=require(_0xbdcb('0x2'));var CronJobManager=require(_0xbdcb('0x3'));var jayson=require(_0xbdcb('0x4'));var BPromise=require(_0xbdcb('0x5'));var logger=require(_0xbdcb('0x6'))(_0xbdcb('0x7'));var db=require(_0xbdcb('0x8'))['db'];var analyticCustomReportController=require(_0xbdcb('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xbdcb('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2cac96,_0x4d657b){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x2cac96[_0xbdcb('0xb')]);var _0x2f5132=!![];var _0x21fbda={'tls':{'rejectUnauthorized':![]}};if(_0x2cac96[_0xbdcb('0xc')][_0xbdcb('0xd')][_0xbdcb('0xe')]){_0x21fbda[_0xbdcb('0xe')]=_0x2cac96[_0xbdcb('0xc')][_0xbdcb('0xd')][_0xbdcb('0xe')];}else{_0x21fbda[_0xbdcb('0xf')]=_0x2cac96[_0xbdcb('0xc')][_0xbdcb('0xd')][_0xbdcb('0xf')];_0x21fbda[_0xbdcb('0x10')]=_0x2cac96[_0xbdcb('0xc')][_0xbdcb('0xd')]['port'];_0x21fbda[_0xbdcb('0x11')]=_0x2cac96[_0xbdcb('0xc')]['Smtp']['secure'];}if(_0x2cac96[_0xbdcb('0xc')][_0xbdcb('0xd')]['authentication']){_0x21fbda[_0xbdcb('0x12')]={'user':_0x2cac96[_0xbdcb('0xc')][_0xbdcb('0xd')][_0xbdcb('0x13')],'pass':_0x2cac96[_0xbdcb('0xc')][_0xbdcb('0xd')][_0xbdcb('0x14')]};}var _0x4df622={'account':_0x21fbda,'message':{'from':util[_0xbdcb('0x15')](_0xbdcb('0x16'),_0x2cac96[_0xbdcb('0xc')][_0xbdcb('0x17')],_0x2cac96[_0xbdcb('0xc')][_0xbdcb('0xb')]||_0x2cac96['MailAccount'][_0xbdcb('0xd')][_0xbdcb('0x13')]),'to':_0x2cac96[_0xbdcb('0xb')],'cc':_0x2cac96['cc'],'bcc':_0x2cac96[_0xbdcb('0x18')],'subject':util[_0xbdcb('0x15')](_0xbdcb('0x19'),_0x4d657b[_0xbdcb('0x17')],_0x2cac96[_0xbdcb('0x1a')],_0x2cac96[_0xbdcb('0x1b')])}};var _0x2c745d=path['join'](__dirname,_0xbdcb('0x1c'));var _0x53d54b=_0x4d657b[_0xbdcb('0x1d')];var _0x1e74fa=util[_0xbdcb('0x15')](_0xbdcb('0x1e'),path[_0xbdcb('0x1f')](_0x4d657b['savename'],path[_0xbdcb('0x20')](_0x4d657b[_0xbdcb('0x1d')])),_0xbdcb('0x21'));var _0x42dd99=path[_0xbdcb('0x22')](_0x2c745d,_0x53d54b);var _0x332ade=path['join'](_0x2c745d,_0x1e74fa);if(fs[_0xbdcb('0x23')](_0x42dd99)){_0x4d657b[_0xbdcb('0x24')]=_0xbdcb('0x25');_0x4df622[_0xbdcb('0x26')][_0xbdcb('0x27')]=[{'filename':_0x53d54b,'path':_0x42dd99}];_0x4df622[_0xbdcb('0x26')]['text']=util['format'](_0xbdcb('0x28'),JSON[_0xbdcb('0x29')](_0x4d657b,null,0x2));}else if(fs[_0xbdcb('0x23')](_0x332ade)){_0x4d657b[_0xbdcb('0x24')]=_0xbdcb('0x25');_0x4df622['message'][_0xbdcb('0x27')]=[{'filename':_0x1e74fa,'path':_0x332ade}];}else{_0x4df622['message'][_0xbdcb('0x2a')]=_0xbdcb('0x2b');if(!_0x2cac96[_0xbdcb('0x2c')]){_0x2f5132=![];logger[_0xbdcb('0x2d')](_0xbdcb('0x2e'));}}if(_0x2f5132){return client[_0xbdcb('0x2f')]('SendMail',_0x4df622)[_0xbdcb('0x30')](function(_0x17c3e5){if(_0x17c3e5['error']){return logger['error'](_0xbdcb('0x31'),JSON['stringify'](_0x17c3e5));}return logger[_0xbdcb('0x2d')](_0xbdcb('0x32'));})['catch'](function(_0x3f18b2){return logger[_0xbdcb('0x33')](_0xbdcb('0x31'),JSON[_0xbdcb('0x29')](_0x3f18b2));});}};}function handleError(){return function(_0xf731ac){return logger[_0xbdcb('0x33')](JSON[_0xbdcb('0x29')](_0xf731ac));};}function handleResult(_0x29ada0){return function(_0x4dfb42){logger[_0xbdcb('0x2d')](_0xbdcb('0x34'),JSON[_0xbdcb('0x29')](_0x4dfb42));if(_0x29ada0[_0xbdcb('0xc')]&&_0x29ada0[_0xbdcb('0xc')][_0xbdcb('0xd')]&&!_['isNil'](_0x29ada0['email'])){setTimeout(handleSendEmail(_0x29ada0,_0x4dfb42),0x3c*0x3e8);}};}function handleJob(_0x3842f8){return function(){try{if(_[_0xbdcb('0x35')](_0x3842f8[_0xbdcb('0x1a')])){return logger[_0xbdcb('0x2d')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xbdcb('0x35')](_0x3842f8['subtractUnit'])){return logger[_0xbdcb('0x2d')](_0xbdcb('0x36'));}var _0x2e2a27={'startDate':moment()[_0xbdcb('0x37')](_0x3842f8[_0xbdcb('0x1a')],_0x3842f8[_0xbdcb('0x1b')])['format'](_0xbdcb('0x38')),'endDate':moment()[_0xbdcb('0x15')](_0xbdcb('0x38')),'type':_0xbdcb('0x39'),'output':_0x3842f8[_0xbdcb('0x3a')],'name':_0x3842f8[_0xbdcb('0x17')]};if(!_[_0xbdcb('0x35')](_0x3842f8[_0xbdcb('0x3b')])){logger['info'](_0xbdcb('0x3c'),_0x3842f8[_0xbdcb('0x3b')]);return analyticDefaultReportController[_0xbdcb('0x3d')]({'id':_0x3842f8[_0xbdcb('0x3b')]},_0x2e2a27)['then'](handleResult(_0x3842f8))[_0xbdcb('0x3e')](handleError());}if(!_[_0xbdcb('0x35')](_0x3842f8[_0xbdcb('0x3f')])){logger[_0xbdcb('0x2d')](_0xbdcb('0x40'),_0x3842f8[_0xbdcb('0x3f')]);return analyticCustomReportController[_0xbdcb('0x3d')]({'id':_0x3842f8[_0xbdcb('0x3f')]},_0x2e2a27)[_0xbdcb('0x30')](handleResult(_0x3842f8))[_0xbdcb('0x3e')](handleError());}}catch(_0x35ccbc){logger[_0xbdcb('0x33')](JSON[_0xbdcb('0x29')](_0x35ccbc));}return logger[_0xbdcb('0x2d')](_0xbdcb('0x41'));};}function getJobs(_0x26b8ff){var _0x1d95df={};if(_0x26b8ff){_0x1d95df['id']=_0x26b8ff;}return db[_0xbdcb('0x42')][_0xbdcb('0x43')]({'where':_0x1d95df,'include':[{'model':db[_0xbdcb('0xc')],'attributes':['id','name',_0xbdcb('0xb')],'include':[{'model':db['MailServerOut'],'as':_0xbdcb('0xd')}]}]})[_0xbdcb('0x30')](function(_0x15e7af){var _0x268ef2=_[_0xbdcb('0x44')](manager[_0xbdcb('0x45')]);var _0x455586=_[_0xbdcb('0x46')](_0x15e7af,function(_0x53b1ec){return _0x53b1ec['id']['toString']();});var _0x513e6c=_[_0xbdcb('0x47')](_0x15e7af,function(_0x2a7bd8){return _0x2a7bd8['id'][_0xbdcb('0x48')]();});var _0x5ed917=_0x26b8ff?_0x455586:_[_0xbdcb('0x49')](_0x455586,_0x268ef2);var _0x2b8e8a=_[_0xbdcb('0x4a')](_0x455586,_0x268ef2);var _0x5a2afe=_['difference'](_0x268ef2,_0x455586);var _0x2fcf00;var _0x2726a0;for(_0x2fcf00=0x0;_0x2fcf00<_0x5a2afe[_0xbdcb('0x4b')]&&!_0x26b8ff;_0x2fcf00+=0x1){_0x2726a0=_0x5a2afe[_0x2fcf00]['toString']();if(manager[_0xbdcb('0x4c')](_0x2726a0)){manager[_0xbdcb('0x4d')](_0x2726a0);manager[_0xbdcb('0x4e')](_0x2726a0);logger['info']('delete\x20cron',_0x2726a0);}}logger[_0xbdcb('0x2d')](_0xbdcb('0x4f'),JSON['stringify'](_0x5ed917));for(_0x2fcf00=0x0;_0x2fcf00<_0x5ed917['length'];_0x2fcf00+=0x1){_0x2726a0=_0x5ed917[_0x2fcf00][_0xbdcb('0x48')]();logger[_0xbdcb('0x2d')]('index',_0x2726a0);if(_0x26b8ff){logger[_0xbdcb('0x2d')](_0xbdcb('0x50'),_0x26b8ff);logger[_0xbdcb('0x2d')](JSON[_0xbdcb('0x29')](_0x513e6c[_0x2726a0]));BPromise[_0xbdcb('0x51')]()[_0xbdcb('0x30')](handleJob(_0x513e6c[_0x2726a0]));logger['info'](_0xbdcb('0x52'),_0x513e6c[_0x2726a0][_0xbdcb('0x17')],_0x513e6c[_0x2726a0][_0xbdcb('0x53')]);}else if(_0x513e6c[_0x2726a0][_0xbdcb('0x53')]&&_0x513e6c[_0x2726a0][_0xbdcb('0x54')]&&moment()[_0xbdcb('0x55')](_0x513e6c[_0x2726a0][_0xbdcb('0x56')],_0x513e6c[_0x2726a0][_0xbdcb('0x57')])){manager[_0xbdcb('0x58')](_0x2726a0,_0x513e6c[_0x2726a0]['cron'],handleJob(_0x513e6c[_0x2726a0]));manager['start'](_0x2726a0);logger[_0xbdcb('0x2d')]('add\x20cron',_0x513e6c[_0x2726a0]['name'],_0x513e6c[_0x2726a0]['cron']);}else if(manager[_0xbdcb('0x4c')](_0x2726a0)){manager[_0xbdcb('0x4d')](_0x2726a0);manager[_0xbdcb('0x4e')](_0x2726a0);logger['info']('stop\x20cron',_0x513e6c[_0x2726a0]['name'],_0x513e6c[_0x2726a0][_0xbdcb('0x53')]);}}for(_0x2fcf00=0x0,_0x2726a0;_0x2fcf00<_0x2b8e8a[_0xbdcb('0x4b')]&&!_0x26b8ff;_0x2fcf00+=0x1){_0x2726a0=_0x2b8e8a[_0x2fcf00]['toString']();if(manager['exists'](_0x2726a0)){if(_0x513e6c[_0x2726a0]['cron']&&_0x513e6c[_0x2726a0][_0xbdcb('0x54')]&&moment()['isBetween'](_0x513e6c[_0x2726a0][_0xbdcb('0x56')],_0x513e6c[_0x2726a0][_0xbdcb('0x57')])){manager[_0xbdcb('0x59')](_0x2726a0,_0x513e6c[_0x2726a0][_0xbdcb('0x53')],handleJob(_0x513e6c[_0x2726a0]));logger[_0xbdcb('0x2d')]('update\x20cron',_0x513e6c[_0x2726a0][_0xbdcb('0x17')],_0x513e6c[_0x2726a0][_0xbdcb('0x53')]);}else{manager[_0xbdcb('0x4d')](_0x2726a0);manager['deleteJob'](_0x2726a0);logger[_0xbdcb('0x2d')]('stop\x20cron',_0x513e6c[_0x2726a0][_0xbdcb('0x17')],_0x513e6c[_0x2726a0][_0xbdcb('0x53')]);}}}})['catch'](function(_0x42326f){logger['error'](JSON[_0xbdcb('0x29')](_0x42326f));});}exports['run']=function(_0x5e1173){return getJobs(_0x5e1173);};exports[_0xbdcb('0x5a')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xeaf5=['run','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','subtractUnit','../../files/reports','%s.%s','basename','savename','extname','zip','join','existsSync','status','message','attachments','text','Sent','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','keyBy','toString','intersection','length','exists','stop','delete\x20cron','toRun','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','deleteJob'];(function(_0x2673a4,_0x4d0b8d){var _0x5e3a6a=function(_0x59e268){while(--_0x59e268){_0x2673a4['push'](_0x2673a4['shift']());}};_0x5e3a6a(++_0x4d0b8d);}(_0xeaf5,0x165));var _0x5eaf=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0xeaf5[_0x3bef2c];return _0x331503;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x5eaf('0x0'));var _=require(_0x5eaf('0x1'));var moment=require(_0x5eaf('0x2'));var CronJobManager=require(_0x5eaf('0x3'));var jayson=require(_0x5eaf('0x4'));var BPromise=require('bluebird');var logger=require(_0x5eaf('0x5'))(_0x5eaf('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x5eaf('0x7'));var client=jayson[_0x5eaf('0x8')][_0x5eaf('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x58a27f,_0x1cae5c){return function(){logger[_0x5eaf('0xa')](_0x5eaf('0xb'),_0x58a27f[_0x5eaf('0xc')]);var _0x3e426b=!![];var _0x27eeee={'tls':{'rejectUnauthorized':![]}};if(_0x58a27f[_0x5eaf('0xd')][_0x5eaf('0xe')][_0x5eaf('0xf')]){_0x27eeee[_0x5eaf('0xf')]=_0x58a27f['MailAccount'][_0x5eaf('0xe')][_0x5eaf('0xf')];}else{_0x27eeee['host']=_0x58a27f['MailAccount']['Smtp'][_0x5eaf('0x10')];_0x27eeee[_0x5eaf('0x11')]=_0x58a27f[_0x5eaf('0xd')][_0x5eaf('0xe')][_0x5eaf('0x11')];_0x27eeee['secure']=_0x58a27f[_0x5eaf('0xd')][_0x5eaf('0xe')][_0x5eaf('0x12')];}if(_0x58a27f[_0x5eaf('0xd')][_0x5eaf('0xe')][_0x5eaf('0x13')]){_0x27eeee[_0x5eaf('0x14')]={'user':_0x58a27f[_0x5eaf('0xd')][_0x5eaf('0xe')][_0x5eaf('0x15')],'pass':_0x58a27f[_0x5eaf('0xd')][_0x5eaf('0xe')][_0x5eaf('0x16')]};}var _0x537a34={'account':_0x27eeee,'message':{'from':util[_0x5eaf('0x17')](_0x5eaf('0x18'),_0x58a27f['MailAccount']['name'],_0x58a27f[_0x5eaf('0xd')][_0x5eaf('0xc')]||_0x58a27f[_0x5eaf('0xd')][_0x5eaf('0xe')][_0x5eaf('0x15')]),'to':_0x58a27f[_0x5eaf('0xc')],'cc':_0x58a27f['cc'],'bcc':_0x58a27f['bcc'],'subject':util[_0x5eaf('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x1cae5c[_0x5eaf('0x19')],_0x58a27f['subtractNumber'],_0x58a27f[_0x5eaf('0x1a')])}};var _0x3bef6f=path['join'](__dirname,_0x5eaf('0x1b'));var _0x6a0cfe=_0x1cae5c['savename'];var _0x3148f5=util['format'](_0x5eaf('0x1c'),path[_0x5eaf('0x1d')](_0x1cae5c[_0x5eaf('0x1e')],path[_0x5eaf('0x1f')](_0x1cae5c[_0x5eaf('0x1e')])),_0x5eaf('0x20'));var _0x5ab1de=path[_0x5eaf('0x21')](_0x3bef6f,_0x6a0cfe);var _0x43e83e=path['join'](_0x3bef6f,_0x3148f5);if(fs[_0x5eaf('0x22')](_0x5ab1de)){_0x1cae5c[_0x5eaf('0x23')]='Sent';_0x537a34[_0x5eaf('0x24')][_0x5eaf('0x25')]=[{'filename':_0x6a0cfe,'path':_0x5ab1de}];_0x537a34[_0x5eaf('0x24')][_0x5eaf('0x26')]=util[_0x5eaf('0x17')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x1cae5c,null,0x2));}else if(fs[_0x5eaf('0x22')](_0x43e83e)){_0x1cae5c['status']=_0x5eaf('0x27');_0x537a34['message'][_0x5eaf('0x25')]=[{'filename':_0x3148f5,'path':_0x43e83e}];}else{_0x537a34[_0x5eaf('0x24')][_0x5eaf('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x58a27f[_0x5eaf('0x28')]){_0x3e426b=![];logger[_0x5eaf('0xa')](_0x5eaf('0x29'));}}if(_0x3e426b){return client[_0x5eaf('0x2a')](_0x5eaf('0x2b'),_0x537a34)[_0x5eaf('0x2c')](function(_0x276a71){if(_0x276a71[_0x5eaf('0x2d')]){return logger[_0x5eaf('0x2d')](_0x5eaf('0x2e'),JSON[_0x5eaf('0x2f')](_0x276a71));}return logger[_0x5eaf('0xa')](_0x5eaf('0x30'));})[_0x5eaf('0x31')](function(_0x459930){return logger[_0x5eaf('0x2d')](_0x5eaf('0x2e'),JSON[_0x5eaf('0x2f')](_0x459930));});}};}function handleError(){return function(_0xc61b49){return logger[_0x5eaf('0x2d')](JSON[_0x5eaf('0x2f')](_0xc61b49));};}function handleResult(_0x13d805){return function(_0x102e32){logger['info']('data',JSON['stringify'](_0x102e32));if(_0x13d805[_0x5eaf('0xd')]&&_0x13d805[_0x5eaf('0xd')][_0x5eaf('0xe')]&&!_[_0x5eaf('0x32')](_0x13d805[_0x5eaf('0xc')])){setTimeout(handleSendEmail(_0x13d805,_0x102e32),0x3c*0x3e8);}};}function handleJob(_0x143755){return function(){try{if(_[_0x5eaf('0x32')](_0x143755[_0x5eaf('0x33')])){return logger[_0x5eaf('0xa')](_0x5eaf('0x34'));}if(_[_0x5eaf('0x32')](_0x143755['subtractUnit'])){return logger[_0x5eaf('0xa')](_0x5eaf('0x35'));}var _0x3fc896={'startDate':moment()['subtract'](_0x143755[_0x5eaf('0x33')],_0x143755[_0x5eaf('0x1a')])[_0x5eaf('0x17')](_0x5eaf('0x36')),'endDate':moment()[_0x5eaf('0x17')](_0x5eaf('0x36')),'type':_0x5eaf('0x37'),'output':_0x143755[_0x5eaf('0x38')],'name':_0x143755[_0x5eaf('0x19')]};if(!_['isNil'](_0x143755[_0x5eaf('0x39')])){logger[_0x5eaf('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x143755['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x143755['DefaultReportId']},_0x3fc896)[_0x5eaf('0x2c')](handleResult(_0x143755))[_0x5eaf('0x31')](handleError());}if(!_[_0x5eaf('0x32')](_0x143755[_0x5eaf('0x3a')])){logger[_0x5eaf('0xa')](_0x5eaf('0x3b'),_0x143755[_0x5eaf('0x3a')]);return analyticCustomReportController[_0x5eaf('0x3c')]({'id':_0x143755['CustomReportId']},_0x3fc896)[_0x5eaf('0x2c')](handleResult(_0x143755))[_0x5eaf('0x31')](handleError());}}catch(_0x200b40){logger[_0x5eaf('0x2d')](JSON[_0x5eaf('0x2f')](_0x200b40));}return logger[_0x5eaf('0xa')](_0x5eaf('0x3d'));};}function getJobs(_0x42bee5){var _0x15d356={};if(_0x42bee5){_0x15d356['id']=_0x42bee5;}return db[_0x5eaf('0x3e')][_0x5eaf('0x3f')]({'where':_0x15d356,'include':[{'model':db[_0x5eaf('0xd')],'attributes':['id',_0x5eaf('0x19'),'email'],'include':[{'model':db[_0x5eaf('0x40')],'as':_0x5eaf('0xe')}]}]})['then'](function(_0x810463){var _0x1c6689=_[_0x5eaf('0x41')](manager['jobs']);var _0x459489=_['map'](_0x810463,function(_0x5ede62){return _0x5ede62['id']['toString']();});var _0xf397a4=_[_0x5eaf('0x42')](_0x810463,function(_0x4857dc){return _0x4857dc['id'][_0x5eaf('0x43')]();});var _0x27b34a=_0x42bee5?_0x459489:_['difference'](_0x459489,_0x1c6689);var _0x1077af=_[_0x5eaf('0x44')](_0x459489,_0x1c6689);var _0x3782d2=_['difference'](_0x1c6689,_0x459489);var _0x6f07a0;var _0x4db24c;for(_0x6f07a0=0x0;_0x6f07a0<_0x3782d2[_0x5eaf('0x45')]&&!_0x42bee5;_0x6f07a0+=0x1){_0x4db24c=_0x3782d2[_0x6f07a0]['toString']();if(manager[_0x5eaf('0x46')](_0x4db24c)){manager[_0x5eaf('0x47')](_0x4db24c);manager['deleteJob'](_0x4db24c);logger['info'](_0x5eaf('0x48'),_0x4db24c);}}logger[_0x5eaf('0xa')](_0x5eaf('0x49'),JSON[_0x5eaf('0x2f')](_0x27b34a));for(_0x6f07a0=0x0;_0x6f07a0<_0x27b34a['length'];_0x6f07a0+=0x1){_0x4db24c=_0x27b34a[_0x6f07a0][_0x5eaf('0x43')]();logger['info']('index',_0x4db24c);if(_0x42bee5){logger[_0x5eaf('0xa')](_0x5eaf('0x4a'),_0x42bee5);logger[_0x5eaf('0xa')](JSON[_0x5eaf('0x2f')](_0xf397a4[_0x4db24c]));BPromise['resolve']()[_0x5eaf('0x2c')](handleJob(_0xf397a4[_0x4db24c]));logger['info'](_0x5eaf('0x4b'),_0xf397a4[_0x4db24c][_0x5eaf('0x19')],_0xf397a4[_0x4db24c][_0x5eaf('0x4c')]);}else if(_0xf397a4[_0x4db24c][_0x5eaf('0x4c')]&&_0xf397a4[_0x4db24c][_0x5eaf('0x4d')]&&moment()[_0x5eaf('0x4e')](_0xf397a4[_0x4db24c][_0x5eaf('0x4f')],_0xf397a4[_0x4db24c][_0x5eaf('0x50')])){manager[_0x5eaf('0x51')](_0x4db24c,_0xf397a4[_0x4db24c][_0x5eaf('0x4c')],handleJob(_0xf397a4[_0x4db24c]));manager[_0x5eaf('0x52')](_0x4db24c);logger[_0x5eaf('0xa')](_0x5eaf('0x53'),_0xf397a4[_0x4db24c]['name'],_0xf397a4[_0x4db24c][_0x5eaf('0x4c')]);}else if(manager['exists'](_0x4db24c)){manager[_0x5eaf('0x47')](_0x4db24c);manager['deleteJob'](_0x4db24c);logger[_0x5eaf('0xa')](_0x5eaf('0x54'),_0xf397a4[_0x4db24c][_0x5eaf('0x19')],_0xf397a4[_0x4db24c][_0x5eaf('0x4c')]);}}for(_0x6f07a0=0x0,_0x4db24c;_0x6f07a0<_0x1077af[_0x5eaf('0x45')]&&!_0x42bee5;_0x6f07a0+=0x1){_0x4db24c=_0x1077af[_0x6f07a0][_0x5eaf('0x43')]();if(manager['exists'](_0x4db24c)){if(_0xf397a4[_0x4db24c]['cron']&&_0xf397a4[_0x4db24c][_0x5eaf('0x4d')]&&moment()['isBetween'](_0xf397a4[_0x4db24c]['startAt'],_0xf397a4[_0x4db24c][_0x5eaf('0x50')])){manager[_0x5eaf('0x55')](_0x4db24c,_0xf397a4[_0x4db24c][_0x5eaf('0x4c')],handleJob(_0xf397a4[_0x4db24c]));logger['info'](_0x5eaf('0x56'),_0xf397a4[_0x4db24c][_0x5eaf('0x19')],_0xf397a4[_0x4db24c][_0x5eaf('0x4c')]);}else{manager[_0x5eaf('0x47')](_0x4db24c);manager[_0x5eaf('0x57')](_0x4db24c);logger['info'](_0x5eaf('0x54'),_0xf397a4[_0x4db24c]['name'],_0xf397a4[_0x4db24c][_0x5eaf('0x4c')]);}}}})[_0x5eaf('0x31')](function(_0x25d72c){logger[_0x5eaf('0x2d')](JSON[_0x5eaf('0x2f')](_0x25d72c));});}exports[_0x5eaf('0x58')]=function(_0x13198a){return getJobs(_0x13198a);};exports[_0x5eaf('0x52')]=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 8dd6d37..6452135 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a62=['finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log'];(function(_0x262958,_0x4711f5){var _0x327cff=function(_0x6241a9){while(--_0x6241a9){_0x262958['push'](_0x262958['shift']());}};_0x327cff(++_0x4711f5);}(_0x2a62,0x111));var _0x22a6=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x2a62[_0xa148b7];return _0x51efd3;};'use strict';var util=require(_0x22a6('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x22a6('0x1')]({'id':i,'firstName':_0x22a6('0x2')+i,'lastName':_0x22a6('0x3')+i,'phone':0xf879fb460+i,'email':_0x22a6('0x4')+i+_0x22a6('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x22a6('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x22a6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x22a6('0x6')](),'updatedAt':Date[_0x22a6('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x22a6('0x1')]({'id':i,'firstName':_0x22a6('0x2')+i,'lastName':_0x22a6('0x3')+i,'phone':0xf879fb460+i,'email':_0x22a6('0x4')+i+_0x22a6('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x22a6('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x22a6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x22a6('0x6')](),'updatedAt':Date[_0x22a6('0x6')]()});}db[_0x22a6('0x7')][_0x22a6('0x8')]({'where':{}})[_0x22a6('0x9')](function(){return db[_0x22a6('0x7')][_0x22a6('0xa')](contacts);})['then'](function(){console[_0x22a6('0xb')](_0x22a6('0xc'),_0x22a6('0xd'));return db[_0x22a6('0xe')][_0x22a6('0x8')]({'where':{}});})[_0x22a6('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console['log'](_0x22a6('0xc'),_0x22a6('0xf'));return db[_0x22a6('0x7')]['bulkCreate'](contacts2);})[_0x22a6('0x9')](function(){console['log'](_0x22a6('0xc'),_0x22a6('0x10'));return db[_0x22a6('0xe')][_0x22a6('0xa')](hopper2);})['then'](function(){console['log']('finished\x20populating',_0x22a6('0x11'));})[_0x22a6('0x12')](function(_0x530a33){console[_0x22a6('0xb')](_0x530a33);}); \ No newline at end of file +var _0xf482=['util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','finished\x20populating','CmHopper','log','hopper1','contacts2','hopper2','catch'];(function(_0x1e1f4a,_0x15d8c7){var _0x2221c8=function(_0xd9e618){while(--_0xd9e618){_0x1e1f4a['push'](_0x1e1f4a['shift']());}};_0x2221c8(++_0x15d8c7);}(_0xf482,0xe4));var _0x2f48=function(_0x380fdc,_0x59f8cc){_0x380fdc=_0x380fdc-0x0;var _0x17d942=_0xf482[_0x380fdc];return _0x17d942;};'use strict';var util=require(_0x2f48('0x0'));var db=require(_0x2f48('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2f48('0x2')]({'id':i,'firstName':_0x2f48('0x3')+i,'lastName':_0x2f48('0x4')+i,'phone':0xf879fb460+i,'email':_0x2f48('0x5')+i+_0x2f48('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2f48('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x2f48('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x2f48('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2f48('0x2')]({'id':i,'firstName':_0x2f48('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2f48('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2f48('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x2f48('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2f48('0x7')](),'updatedAt':Date[_0x2f48('0x7')]()});}db[_0x2f48('0x8')][_0x2f48('0x9')]({'where':{}})['then'](function(){return db[_0x2f48('0x8')][_0x2f48('0xa')](contacts);})[_0x2f48('0xb')](function(){console['log'](_0x2f48('0xc'),'contacts1');return db[_0x2f48('0xd')][_0x2f48('0x9')]({'where':{}});})['then'](function(){return db[_0x2f48('0xd')][_0x2f48('0xa')](hopper);})['then'](function(){console[_0x2f48('0xe')](_0x2f48('0xc'),_0x2f48('0xf'));return db[_0x2f48('0x8')][_0x2f48('0xa')](contacts2);})[_0x2f48('0xb')](function(){console['log'](_0x2f48('0xc'),_0x2f48('0x10'));return db[_0x2f48('0xd')]['bulkCreate'](hopper2);})['then'](function(){console['log'](_0x2f48('0xc'),_0x2f48('0x11'));})[_0x2f48('0x12')](function(_0x312b2a){console[_0x2f48('0xe')](_0x312b2a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 13e654f..17a3f99 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7555=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','friend','udp','all','yes'];(function(_0x523aad,_0x13b66d){var _0xe6b5ec=function(_0x333d53){while(--_0x333d53){_0x523aad['push'](_0x523aad['shift']());}};_0xe6b5ec(++_0x13b66d);}(_0x7555,0x1aa));var _0x5755=function(_0x5c8a39,_0x486adb){_0x5c8a39=_0x5c8a39-0x0;var _0x29ea71=_0x7555[_0x5c8a39];return _0x29ea71;};'use strict';var util=require(_0x5755('0x0'));var db=require(_0x5755('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5755('0x2')]({'name':util[_0x5755('0x3')]('%s%s',_0x5755('0x4'),i),'fullname':util[_0x5755('0x3')](_0x5755('0x5'),_0x5755('0x4'),i),'email':util[_0x5755('0x3')](_0x5755('0x6'),'agent',i),'role':_0x5755('0x4'),'password':'password','internal':0xfa0+i,'type':_0x5755('0x7'),'transport':[_0x5755('0x8'),'ws','wss'],'disallow':[_0x5755('0x9')],'allow':['ulaw'],'defaultuser':util[_0x5755('0x3')]('%s%s',_0x5755('0x4'),i),'encryption':'yes','avpf':_0x5755('0xa'),'force_avp':_0x5755('0xa'),'icesupport':_0x5755('0xa'),'dtlsenable':_0x5755('0xa'),'dtlsverify':'no','dtlscertfile':_0x5755('0xb'),'dtlsprivatekey':_0x5755('0xc'),'dtlssetup':_0x5755('0xd'),'callerid':util[_0x5755('0x3')]('\x22%s\x22\x20<%s>',util[_0x5755('0x3')](_0x5755('0x5'),_0x5755('0x4'),i),0xfa0+i)});}db['User'][_0x5755('0xe')](users)[_0x5755('0xf')](function(){console['log'](_0x5755('0x10'));})[_0x5755('0x11')](function(_0x355948){console[_0x5755('0x12')](_0x355948);}); \ No newline at end of file +var _0xfec8=['/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','wss','all','ulaw','yes'];(function(_0x2e5dae,_0x1e6026){var _0x55f678=function(_0x2b9939){while(--_0x2b9939){_0x2e5dae['push'](_0x2e5dae['shift']());}};_0x55f678(++_0x1e6026);}(_0xfec8,0x184));var _0x8fec=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xfec8[_0x122096];return _0x3d1966;};'use strict';var util=require(_0x8fec('0x0'));var db=require(_0x8fec('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8fec('0x2')]({'name':util[_0x8fec('0x3')](_0x8fec('0x4'),_0x8fec('0x5'),i),'fullname':util['format'](_0x8fec('0x4'),'agent',i),'email':util[_0x8fec('0x3')](_0x8fec('0x6'),_0x8fec('0x5'),i),'role':_0x8fec('0x5'),'password':'password','internal':0xfa0+i,'type':_0x8fec('0x7'),'transport':['udp','ws',_0x8fec('0x8')],'disallow':[_0x8fec('0x9')],'allow':[_0x8fec('0xa')],'defaultuser':util[_0x8fec('0x3')](_0x8fec('0x4'),_0x8fec('0x5'),i),'encryption':_0x8fec('0xb'),'avpf':'yes','force_avp':'yes','icesupport':_0x8fec('0xb'),'dtlsenable':_0x8fec('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x8fec('0xc'),'dtlssetup':_0x8fec('0xd'),'callerid':util[_0x8fec('0x3')]('\x22%s\x22\x20<%s>',util[_0x8fec('0x3')](_0x8fec('0x4'),'agent',i),0xfa0+i)});}db[_0x8fec('0xe')][_0x8fec('0xf')](users)[_0x8fec('0x10')](function(){console[_0x8fec('0x11')](_0x8fec('0x12'));})[_0x8fec('0x13')](function(_0x4f8bce){console[_0x8fec('0x11')](_0x4f8bce);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7197b72..a71e5d9 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d01=['user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','log','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','../mysqldb','name','Agents','User','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','format','%s:queue:%s','length','user:%s','handshake','query','find','role','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','Trunk','Campaign','user','userProfileId','ChatQueue','SmsQueues','OpenchannelQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit'];(function(_0x27f226,_0x58c49d){var _0x2b00bd=function(_0x2068a6){while(--_0x2068a6){_0x27f226['push'](_0x27f226['shift']());}};_0x2b00bd(++_0x58c49d);}(_0x5d01,0xd8));var _0x15d0=function(_0x10eb60,_0x1e5ba8){_0x10eb60=_0x10eb60-0x0;var _0x14240b=_0x5d01[_0x10eb60];return _0x14240b;};'use strict';var _=require(_0x15d0('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x15d0('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x15d0('0x2')],'include':[{'as':_0x15d0('0x3'),'model':db[_0x15d0('0x4')],'attributes':['id',_0x15d0('0x2'),'role'],'raw':!![],'where':{'role':_0x15d0('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x15d0('0x2')],'where':{'role':_0x15d0('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x15d0('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x15d0('0x2')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x15d0('0x2'),_0x15d0('0x7')],'where':{'type':_0x15d0('0x8')}};function getAssociatedResources(_0x3ebf14,_0x37cf37,_0x2053b0){return db['UserProfileSection'][_0x15d0('0x9')]({'where':{'name':_0x3ebf14,'userProfileId':_0x37cf37},'raw':!![]})[_0x15d0('0xa')](function(_0x3b0e9f){if(_0x3b0e9f){if(_0x3b0e9f[_0x15d0('0xb')]){switch(_0x3ebf14){case _0x15d0('0xc'):case _0x15d0('0xd'):case _0x15d0('0xe'):case'SmsQueues':case _0x15d0('0xf'):case _0x15d0('0x10'):return db[_0x2053b0][_0x15d0('0x11')](queryQueues);case _0x15d0('0x12'):return db[_0x2053b0][_0x15d0('0x11')](queryTelephones);case _0x15d0('0x13'):return db[_0x2053b0][_0x15d0('0x11')](queryTrunks);case _0x15d0('0x14'):return db[_0x2053b0][_0x15d0('0x11')](queryCampaigns);}}else{return db[_0x15d0('0x15')]['findAll']({'attributes':[_0x15d0('0x16')],'where':{'sectionId':_0x3b0e9f['id']},'raw':!![]})[_0x15d0('0xa')](function(_0x4b1334){if(_0x4b1334){var _0x53e456={'where':{'id':_[_0x15d0('0x17')](_0x4b1334,'resourceId')},'raw':!![]};switch(_0x2053b0){case _0x15d0('0x4'):_0x53e456[_0x15d0('0x18')]['role']=_0x15d0('0x6');break;case'Campaign':_0x53e456['where'][_0x15d0('0x7')]=_0x15d0('0x8');break;}return db[_0x2053b0][_0x15d0('0x11')](_0x53e456);}else{return[];}});}}else{return[];}})[_0x15d0('0xa')](function(_0x249d96){return _0x249d96;});}function joinOrLeaveQueues(_0x189d3f,_0x247b68,_0x34a506,_0x453734){_0x189d3f[_0x247b68](util[_0x15d0('0x19')](_0x15d0('0x1a'),_0x34a506,_0x453734['name']));if(_0x453734['Agents']){for(var _0x3b4161=0x0;_0x3b4161<_0x453734[_0x15d0('0x3')][_0x15d0('0x1b')];_0x3b4161+=0x1){_0x189d3f[_0x247b68](util[_0x15d0('0x19')](_0x15d0('0x1c'),_0x453734['Agents'][_0x3b4161][_0x15d0('0x2')]));}}}function joinOrLeave(_0x3716e4,_0x4e587f,_0x15d982){var _0x6333ce;if(_0x3716e4[_0x15d0('0x1d')][_0x15d0('0x1e')]['id']){db[_0x15d0('0x4')][_0x15d0('0x1f')]({'attributes':['id','name',_0x15d0('0x20'),'userProfileId'],'where':{'id':_0x3716e4['handshake'][_0x15d0('0x1e')]['id']},'include':[{'model':db[_0x15d0('0x21')],'as':_0x15d0('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x15d0('0x23')],'as':_0x15d0('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x15d0('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x15d0('0x26')],'as':_0x15d0('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x15d0('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]}]})[_0x15d0('0xa')](function(_0x5a980a){if(_0x5a980a){_0x6333ce=_0x5a980a;_0x3716e4[_0x4e587f](util[_0x15d0('0x19')]('user:%s',_0x5a980a[_0x15d0('0x2')]));var _0x5a5d8a=[];switch(_0x5a980a[_0x15d0('0x20')]){case _0x15d0('0x29'):_0x3716e4[_0x4e587f](_0x15d0('0x2a'));_0x3716e4[_0x4e587f](_0x15d0('0x2b'));if(queryQueues['hasOwnProperty'](_0x15d0('0x2c'))){delete queryQueues[_0x15d0('0x2c')];}_0x5a5d8a[_0x15d0('0x2d')](db[_0x15d0('0x2e')]['findAll'](queryQueues));_0x5a5d8a[_0x15d0('0x2d')](db['ChatQueue']['findAll'](queryQueues));_0x5a5d8a[_0x15d0('0x2d')](db[_0x15d0('0x2f')][_0x15d0('0x11')](queryQueues));_0x5a5d8a[_0x15d0('0x2d')](db[_0x15d0('0x30')][_0x15d0('0x11')](queryQueues));_0x5a5d8a[_0x15d0('0x2d')](db[_0x15d0('0x31')][_0x15d0('0x11')](queryQueues));_0x5a5d8a['push'](db['OpenchannelQueue'][_0x15d0('0x11')](queryQueues));_0x5a5d8a['push'](db[_0x15d0('0x4')][_0x15d0('0x11')](queryTelephones));_0x5a5d8a[_0x15d0('0x2d')](db[_0x15d0('0x32')]['findAll'](queryTrunks));_0x5a5d8a[_0x15d0('0x2d')](db[_0x15d0('0x33')]['findAll'](queryCampaigns));_0x5a5d8a[_0x15d0('0x2d')](db[_0x15d0('0x4')][_0x15d0('0x11')](queryAgents));break;case _0x15d0('0x34'):_0x3716e4[_0x4e587f](_0x15d0('0x2a'));_0x3716e4[_0x4e587f](_0x15d0('0x2b'));_0x5a5d8a[_0x15d0('0x2d')](getAssociatedResources(_0x15d0('0xc'),_0x5a980a[_0x15d0('0x35')],'VoiceQueue'));_0x5a5d8a['push'](getAssociatedResources(_0x15d0('0xd'),_0x5a980a[_0x15d0('0x35')],_0x15d0('0x36')));_0x5a5d8a[_0x15d0('0x2d')](getAssociatedResources(_0x15d0('0xe'),_0x5a980a[_0x15d0('0x35')],_0x15d0('0x2f')));_0x5a5d8a[_0x15d0('0x2d')](getAssociatedResources(_0x15d0('0x37'),_0x5a980a[_0x15d0('0x35')],_0x15d0('0x30')));_0x5a5d8a['push'](getAssociatedResources(_0x15d0('0xf'),_0x5a980a['userProfileId'],'MailQueue'));_0x5a5d8a[_0x15d0('0x2d')](getAssociatedResources(_0x15d0('0x10'),_0x5a980a[_0x15d0('0x35')],_0x15d0('0x38')));_0x5a5d8a['push'](getAssociatedResources(_0x15d0('0x12'),_0x5a980a[_0x15d0('0x35')],_0x15d0('0x4')));_0x5a5d8a[_0x15d0('0x2d')](getAssociatedResources(_0x15d0('0x13'),_0x5a980a[_0x15d0('0x35')],_0x15d0('0x32')));_0x5a5d8a[_0x15d0('0x2d')](getAssociatedResources(_0x15d0('0x14'),_0x5a980a[_0x15d0('0x35')],_0x15d0('0x33')));_0x5a5d8a['push'](db['User']['findAll'](queryAgents));break;case _0x15d0('0x5'):_0x3716e4[_0x4e587f](_0x15d0('0x2a'));_0x3716e4[_0x4e587f](_0x15d0('0x2b'));_0x5a5d8a['push'](_0x5a980a[_0x15d0('0x39')]({'attributes':['id',_0x15d0('0x2')]}));_0x5a5d8a[_0x15d0('0x2d')](_0x5a980a[_0x15d0('0x3a')]({'attributes':['id',_0x15d0('0x2')]}));_0x5a5d8a[_0x15d0('0x2d')](_0x5a980a[_0x15d0('0x3b')]({'attributes':['id',_0x15d0('0x2')]}));_0x5a5d8a[_0x15d0('0x2d')](_0x5a980a[_0x15d0('0x3c')]({'attributes':['id',_0x15d0('0x2')]}));_0x5a5d8a[_0x15d0('0x2d')](_0x5a980a[_0x15d0('0x3d')]({'attributes':['id','name']}));_0x5a5d8a['push'](_0x5a980a[_0x15d0('0x3e')]({'attributes':['id',_0x15d0('0x2')]}));break;}return BPromise[_0x15d0('0x3f')](_0x5a5d8a);}})['then'](function(_0xf5279e){if(_0xf5279e&&_0xf5279e[_0x15d0('0x1b')]){for(var _0xf1a735=0x0;_0xf1a735<_0xf5279e[_0x15d0('0x1b')];_0xf1a735+=0x1){for(var _0x3524c1=0x0;_0x3524c1<_0xf5279e[_0xf1a735]['length'];_0x3524c1+=0x1){switch(_0xf1a735){case 0x0:joinOrLeaveQueues(_0x3716e4,_0x4e587f,_0x15d0('0x40'),_0xf5279e[_0xf1a735][_0x3524c1]);break;case 0x1:joinOrLeaveQueues(_0x3716e4,_0x4e587f,_0x15d0('0x41'),_0xf5279e[_0xf1a735][_0x3524c1]);break;case 0x2:joinOrLeaveQueues(_0x3716e4,_0x4e587f,_0x15d0('0x42'),_0xf5279e[_0xf1a735][_0x3524c1]);break;case 0x3:joinOrLeaveQueues(_0x3716e4,_0x4e587f,_0x15d0('0x43'),_0xf5279e[_0xf1a735][_0x3524c1]);break;case 0x4:joinOrLeaveQueues(_0x3716e4,_0x4e587f,_0x15d0('0x44'),_0xf5279e[_0xf1a735][_0x3524c1]);break;case 0x5:joinOrLeaveQueues(_0x3716e4,_0x4e587f,'openchannel',_0xf5279e[_0xf1a735][_0x3524c1]);break;case 0x6:_0x3716e4[_0x4e587f](util[_0x15d0('0x19')](_0x15d0('0x45'),_0xf5279e[_0xf1a735][_0x3524c1][_0x15d0('0x2')]));break;case 0x7:_0x3716e4[_0x4e587f](util[_0x15d0('0x19')](_0x15d0('0x46'),_0xf5279e[_0xf1a735][_0x3524c1][_0x15d0('0x2')]));break;case 0x8:_0x3716e4[_0x4e587f](util[_0x15d0('0x19')](_0x15d0('0x47'),_0xf5279e[_0xf1a735][_0x3524c1][_0x15d0('0x7')],_0xf5279e[_0xf1a735][_0x3524c1][_0x15d0('0x2')]));break;case 0x9:_0x3716e4[_0x4e587f](util[_0x15d0('0x19')]('user:%s',_0xf5279e[_0xf1a735][_0x3524c1][_0x15d0('0x2')]));break;}}}}})[_0x15d0('0xa')](function(){if(_0x4e587f===_0x15d0('0x48')){var _0x2ab9ec=_['map'](_0x6333ce[_0x15d0('0x22')],'id');return _0x6333ce[_0x15d0('0x49')](_0x2ab9ec)[_0x15d0('0xa')](function(){for(var _0x6b01f7=0x0;_0x6b01f7<_0x2ab9ec[_0x15d0('0x1b')];_0x6b01f7+=0x1){_0x15d982[_0x15d0('0x4a')](_0x15d0('0x4b'),{'ChatInteractionId':Number(_0x2ab9ec[_0x6b01f7]),'UserId':Number(_0x6333ce['id'])});}});}})[_0x15d0('0xa')](function(){if(_0x4e587f===_0x15d0('0x48')){var _0x1ba5db=_[_0x15d0('0x17')](_0x6333ce['MailInteractions'],'id');return _0x6333ce[_0x15d0('0x4c')](_0x1ba5db)[_0x15d0('0xa')](function(){for(var _0x5502ae=0x0;_0x5502ae<_0x1ba5db[_0x15d0('0x1b')];_0x5502ae+=0x1){_0x15d982[_0x15d0('0x4a')](_0x15d0('0x4d'),{'MailInteractionId':Number(_0x1ba5db[_0x5502ae]),'UserId':Number(_0x6333ce['id'])});}});}})['then'](function(){if(_0x4e587f===_0x15d0('0x48')){var _0x22ec07=_['map'](_0x6333ce[_0x15d0('0x4e')],'id');return _0x6333ce[_0x15d0('0x4f')](_0x22ec07)[_0x15d0('0xa')](function(){for(var _0x3c4199=0x0;_0x3c4199<_0x22ec07['length'];_0x3c4199+=0x1){_0x15d982[_0x15d0('0x4a')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x22ec07[_0x3c4199]),'UserId':Number(_0x6333ce['id'])});}});}})[_0x15d0('0xa')](function(){if(_0x4e587f===_0x15d0('0x48')){var _0x51effd=_['map'](_0x6333ce['SmsInteractions'],'id');return _0x6333ce[_0x15d0('0x50')](_0x51effd)[_0x15d0('0xa')](function(){for(var _0x37d138=0x0;_0x37d138<_0x51effd[_0x15d0('0x1b')];_0x37d138+=0x1){_0x15d982['emit'](_0x15d0('0x51'),{'SmsInteractionId':Number(_0x51effd[_0x37d138]),'UserId':Number(_0x6333ce['id'])});}});}})[_0x15d0('0xa')](function(){if(_0x4e587f===_0x15d0('0x48')){var _0x2ad5fb=_[_0x15d0('0x17')](_0x6333ce['OpenchannelInteractions'],'id');return _0x6333ce[_0x15d0('0x52')](_0x2ad5fb)[_0x15d0('0xa')](function(){for(var _0x299a72=0x0;_0x299a72<_0x2ad5fb[_0x15d0('0x1b')];_0x299a72+=0x1){_0x15d982[_0x15d0('0x4a')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x2ad5fb[_0x299a72]),'UserId':Number(_0x6333ce['id'])});}});}})['catch'](function(_0x3344ac){_0x3716e4[_0x15d0('0x53')](_0x3344ac);});}}function onDisconnect(_0x4b332b,_0x10bef5){joinOrLeave(_0x4b332b,_0x15d0('0x48'),_0x10bef5);}function onConnect(_0x54f676){joinOrLeave(_0x54f676,_0x15d0('0x54'));}exports[_0x15d0('0x55')]=function(_0x36afc8){_0x36afc8['on'](_0x15d0('0x56'),function(_0x27f796){_0x27f796[_0x15d0('0x57')](0x0);_0x27f796[_0x15d0('0x58')]=_0x27f796['request'][_0x15d0('0x56')][_0x15d0('0x59')]+':'+_0x27f796[_0x15d0('0x5a')][_0x15d0('0x56')][_0x15d0('0x5b')];_0x27f796[_0x15d0('0x5c')]=new Date();_0x27f796['log']=function(_0x3fe740){console[_0x15d0('0x53')]('SocketIO\x20'+_0x27f796[_0x15d0('0x5d')][_0x15d0('0x2')]+'['+_0x27f796['address']+']',_0x3fe740);};_0x27f796['on'](_0x15d0('0x5e'),function(){onDisconnect(_0x27f796,_0x36afc8);_0x27f796[_0x15d0('0x53')](_0x15d0('0x5f'));});onConnect(_0x27f796);_0x27f796[_0x15d0('0x53')](_0x15d0('0x60'));});}; \ No newline at end of file +var _0xfc02=['query','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','user:%s','admin','voice:inbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','Trunk','user','voice:outbound','VoiceQueue','FaxQueue','MailQueues','OpenchannelQueue','Trunks','getVoiceQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','voice','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','user_has_mail_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','log','SocketIO\x20','nsp','lodash','util','bluebird','../mysqldb','./environment','Agents','User','role','agent','name','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','UserProfileResource','map','Campaign','where','%s:queue:%s','length','format','handshake'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0xfc02,0x145));var _0x2fc0=function(_0x46599d,_0x335ded){_0x46599d=_0x46599d-0x0;var _0x2e111a=_0xfc02[_0x46599d];return _0x2e111a;};'use strict';var _=require(_0x2fc0('0x0'));var util=require(_0x2fc0('0x1'));var BPromise=require(_0x2fc0('0x2'));var db=require(_0x2fc0('0x3'))['db'];var config=require(_0x2fc0('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x2fc0('0x5'),'model':db[_0x2fc0('0x6')],'attributes':['id','name',_0x2fc0('0x7')],'raw':!![],'where':{'role':_0x2fc0('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2fc0('0x9')],'where':{'role':_0x2fc0('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2fc0('0x9')]};var queryAgents={'raw':!![],'attributes':['id',_0x2fc0('0x9')],'where':{'role':_0x2fc0('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x2fc0('0xb')],'where':{'type':_0x2fc0('0xc')}};function getAssociatedResources(_0x3fb13e,_0x192ba5,_0x741aeb){return db[_0x2fc0('0xd')]['findOne']({'where':{'name':_0x3fb13e,'userProfileId':_0x192ba5},'raw':!![]})[_0x2fc0('0xe')](function(_0xb6053f){if(_0xb6053f){if(_0xb6053f[_0x2fc0('0xf')]){switch(_0x3fb13e){case _0x2fc0('0x10'):case _0x2fc0('0x11'):case _0x2fc0('0x12'):case _0x2fc0('0x13'):case'MailQueues':case _0x2fc0('0x14'):return db[_0x741aeb][_0x2fc0('0x15')](queryQueues);case _0x2fc0('0x16'):return db[_0x741aeb][_0x2fc0('0x15')](queryTelephones);case'Trunks':return db[_0x741aeb][_0x2fc0('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x741aeb][_0x2fc0('0x15')](queryCampaigns);}}else{return db[_0x2fc0('0x17')][_0x2fc0('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0xb6053f['id']},'raw':!![]})[_0x2fc0('0xe')](function(_0xbfe551){if(_0xbfe551){var _0x1b50b8={'where':{'id':_[_0x2fc0('0x18')](_0xbfe551,'resourceId')},'raw':!![]};switch(_0x741aeb){case _0x2fc0('0x6'):_0x1b50b8['where']['role']='telephone';break;case _0x2fc0('0x19'):_0x1b50b8[_0x2fc0('0x1a')][_0x2fc0('0xb')]=_0x2fc0('0xc');break;}return db[_0x741aeb]['findAll'](_0x1b50b8);}else{return[];}});}}else{return[];}})[_0x2fc0('0xe')](function(_0x469e7e){return _0x469e7e;});}function joinOrLeaveQueues(_0x5510ca,_0x191e7b,_0x627bd4,_0x502438){_0x5510ca[_0x191e7b](util['format'](_0x2fc0('0x1b'),_0x627bd4,_0x502438[_0x2fc0('0x9')]));if(_0x502438[_0x2fc0('0x5')]){for(var _0x38be53=0x0;_0x38be53<_0x502438[_0x2fc0('0x5')][_0x2fc0('0x1c')];_0x38be53+=0x1){_0x5510ca[_0x191e7b](util[_0x2fc0('0x1d')]('user:%s',_0x502438[_0x2fc0('0x5')][_0x38be53][_0x2fc0('0x9')]));}}}function joinOrLeave(_0x20249f,_0x109f42,_0xfdeef2){var _0x4e5da3;if(_0x20249f[_0x2fc0('0x1e')][_0x2fc0('0x1f')]['id']){db[_0x2fc0('0x6')]['find']({'attributes':['id','name',_0x2fc0('0x7'),_0x2fc0('0x20')],'where':{'id':_0x20249f[_0x2fc0('0x1e')][_0x2fc0('0x1f')]['id']},'include':[{'model':db[_0x2fc0('0x21')],'as':_0x2fc0('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x2fc0('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2fc0('0x24')],'as':_0x2fc0('0x25'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x2fc0('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x2fc0('0x27')],'as':_0x2fc0('0x28'),'attributes':['id'],'raw':!![]}]})[_0x2fc0('0xe')](function(_0x305911){if(_0x305911){_0x4e5da3=_0x305911;_0x20249f[_0x109f42](util['format'](_0x2fc0('0x29'),_0x305911[_0x2fc0('0x9')]));var _0x3eab1d=[];switch(_0x305911[_0x2fc0('0x7')]){case _0x2fc0('0x2a'):_0x20249f[_0x109f42](_0x2fc0('0x2b'));_0x20249f[_0x109f42]('voice:outbound');if(queryQueues[_0x2fc0('0x2c')](_0x2fc0('0x2d'))){delete queryQueues['include'];}_0x3eab1d[_0x2fc0('0x2e')](db['VoiceQueue'][_0x2fc0('0x15')](queryQueues));_0x3eab1d['push'](db[_0x2fc0('0x2f')]['findAll'](queryQueues));_0x3eab1d[_0x2fc0('0x2e')](db['FaxQueue'][_0x2fc0('0x15')](queryQueues));_0x3eab1d[_0x2fc0('0x2e')](db[_0x2fc0('0x30')]['findAll'](queryQueues));_0x3eab1d[_0x2fc0('0x2e')](db[_0x2fc0('0x31')]['findAll'](queryQueues));_0x3eab1d[_0x2fc0('0x2e')](db['OpenchannelQueue']['findAll'](queryQueues));_0x3eab1d['push'](db[_0x2fc0('0x6')]['findAll'](queryTelephones));_0x3eab1d[_0x2fc0('0x2e')](db[_0x2fc0('0x32')][_0x2fc0('0x15')](queryTrunks));_0x3eab1d[_0x2fc0('0x2e')](db['Campaign']['findAll'](queryCampaigns));_0x3eab1d[_0x2fc0('0x2e')](db[_0x2fc0('0x6')][_0x2fc0('0x15')](queryAgents));break;case _0x2fc0('0x33'):_0x20249f[_0x109f42](_0x2fc0('0x2b'));_0x20249f[_0x109f42](_0x2fc0('0x34'));_0x3eab1d[_0x2fc0('0x2e')](getAssociatedResources(_0x2fc0('0x10'),_0x305911[_0x2fc0('0x20')],_0x2fc0('0x35')));_0x3eab1d[_0x2fc0('0x2e')](getAssociatedResources(_0x2fc0('0x11'),_0x305911[_0x2fc0('0x20')],'ChatQueue'));_0x3eab1d['push'](getAssociatedResources('FaxQueues',_0x305911['userProfileId'],_0x2fc0('0x36')));_0x3eab1d[_0x2fc0('0x2e')](getAssociatedResources('SmsQueues',_0x305911[_0x2fc0('0x20')],'SmsQueue'));_0x3eab1d[_0x2fc0('0x2e')](getAssociatedResources(_0x2fc0('0x37'),_0x305911['userProfileId'],_0x2fc0('0x31')));_0x3eab1d[_0x2fc0('0x2e')](getAssociatedResources(_0x2fc0('0x14'),_0x305911[_0x2fc0('0x20')],_0x2fc0('0x38')));_0x3eab1d[_0x2fc0('0x2e')](getAssociatedResources(_0x2fc0('0x16'),_0x305911['userProfileId'],_0x2fc0('0x6')));_0x3eab1d[_0x2fc0('0x2e')](getAssociatedResources(_0x2fc0('0x39'),_0x305911['userProfileId'],_0x2fc0('0x32')));_0x3eab1d['push'](getAssociatedResources('IvrCampaigns',_0x305911[_0x2fc0('0x20')],_0x2fc0('0x19')));_0x3eab1d[_0x2fc0('0x2e')](db[_0x2fc0('0x6')][_0x2fc0('0x15')](queryAgents));break;case _0x2fc0('0x8'):_0x20249f[_0x109f42](_0x2fc0('0x2b'));_0x20249f[_0x109f42]('voice:outbound');_0x3eab1d[_0x2fc0('0x2e')](_0x305911[_0x2fc0('0x3a')]({'attributes':['id','name']}));_0x3eab1d[_0x2fc0('0x2e')](_0x305911['getChatQueues']({'attributes':['id',_0x2fc0('0x9')]}));_0x3eab1d['push'](_0x305911[_0x2fc0('0x3b')]({'attributes':['id',_0x2fc0('0x9')]}));_0x3eab1d[_0x2fc0('0x2e')](_0x305911['getSmsQueues']({'attributes':['id',_0x2fc0('0x9')]}));_0x3eab1d[_0x2fc0('0x2e')](_0x305911[_0x2fc0('0x3c')]({'attributes':['id',_0x2fc0('0x9')]}));_0x3eab1d['push'](_0x305911[_0x2fc0('0x3d')]({'attributes':['id',_0x2fc0('0x9')]}));break;}return BPromise[_0x2fc0('0x3e')](_0x3eab1d);}})[_0x2fc0('0xe')](function(_0x4d0244){if(_0x4d0244&&_0x4d0244[_0x2fc0('0x1c')]){for(var _0x16e6c4=0x0;_0x16e6c4<_0x4d0244[_0x2fc0('0x1c')];_0x16e6c4+=0x1){for(var _0x587eb9=0x0;_0x587eb9<_0x4d0244[_0x16e6c4][_0x2fc0('0x1c')];_0x587eb9+=0x1){switch(_0x16e6c4){case 0x0:joinOrLeaveQueues(_0x20249f,_0x109f42,_0x2fc0('0x3f'),_0x4d0244[_0x16e6c4][_0x587eb9]);break;case 0x1:joinOrLeaveQueues(_0x20249f,_0x109f42,'chat',_0x4d0244[_0x16e6c4][_0x587eb9]);break;case 0x2:joinOrLeaveQueues(_0x20249f,_0x109f42,_0x2fc0('0x40'),_0x4d0244[_0x16e6c4][_0x587eb9]);break;case 0x3:joinOrLeaveQueues(_0x20249f,_0x109f42,_0x2fc0('0x41'),_0x4d0244[_0x16e6c4][_0x587eb9]);break;case 0x4:joinOrLeaveQueues(_0x20249f,_0x109f42,_0x2fc0('0x42'),_0x4d0244[_0x16e6c4][_0x587eb9]);break;case 0x5:joinOrLeaveQueues(_0x20249f,_0x109f42,_0x2fc0('0x43'),_0x4d0244[_0x16e6c4][_0x587eb9]);break;case 0x6:_0x20249f[_0x109f42](util['format'](_0x2fc0('0x44'),_0x4d0244[_0x16e6c4][_0x587eb9]['name']));break;case 0x7:_0x20249f[_0x109f42](util[_0x2fc0('0x1d')](_0x2fc0('0x45'),_0x4d0244[_0x16e6c4][_0x587eb9][_0x2fc0('0x9')]));break;case 0x8:_0x20249f[_0x109f42](util[_0x2fc0('0x1d')](_0x2fc0('0x46'),_0x4d0244[_0x16e6c4][_0x587eb9]['type'],_0x4d0244[_0x16e6c4][_0x587eb9][_0x2fc0('0x9')]));break;case 0x9:_0x20249f[_0x109f42](util[_0x2fc0('0x1d')](_0x2fc0('0x29'),_0x4d0244[_0x16e6c4][_0x587eb9][_0x2fc0('0x9')]));break;}}}}})[_0x2fc0('0xe')](function(){if(_0x109f42==='leave'){var _0x27d061=_[_0x2fc0('0x18')](_0x4e5da3['ChatInteractions'],'id');return _0x4e5da3[_0x2fc0('0x47')](_0x27d061)[_0x2fc0('0xe')](function(){for(var _0x1d8e91=0x0;_0x1d8e91<_0x27d061[_0x2fc0('0x1c')];_0x1d8e91+=0x1){_0xfdeef2[_0x2fc0('0x48')](_0x2fc0('0x49'),{'ChatInteractionId':Number(_0x27d061[_0x1d8e91]),'UserId':Number(_0x4e5da3['id'])});}});}})[_0x2fc0('0xe')](function(){if(_0x109f42===_0x2fc0('0x4a')){var _0x462760=_[_0x2fc0('0x18')](_0x4e5da3[_0x2fc0('0x23')],'id');return _0x4e5da3['removeMailInteractions'](_0x462760)[_0x2fc0('0xe')](function(){for(var _0x2afb7e=0x0;_0x2afb7e<_0x462760[_0x2fc0('0x1c')];_0x2afb7e+=0x1){_0xfdeef2[_0x2fc0('0x48')](_0x2fc0('0x4b'),{'MailInteractionId':Number(_0x462760[_0x2afb7e]),'UserId':Number(_0x4e5da3['id'])});}});}})['then'](function(){if(_0x109f42===_0x2fc0('0x4a')){var _0xf0fb93=_['map'](_0x4e5da3[_0x2fc0('0x25')],'id');return _0x4e5da3['removeFaxInteractions'](_0xf0fb93)[_0x2fc0('0xe')](function(){for(var _0x1c5759=0x0;_0x1c5759<_0xf0fb93[_0x2fc0('0x1c')];_0x1c5759+=0x1){_0xfdeef2[_0x2fc0('0x48')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0xf0fb93[_0x1c5759]),'UserId':Number(_0x4e5da3['id'])});}});}})[_0x2fc0('0xe')](function(){if(_0x109f42===_0x2fc0('0x4a')){var _0x59e05e=_['map'](_0x4e5da3['SmsInteractions'],'id');return _0x4e5da3['removeSmsInteractions'](_0x59e05e)[_0x2fc0('0xe')](function(){for(var _0x112565=0x0;_0x112565<_0x59e05e['length'];_0x112565+=0x1){_0xfdeef2[_0x2fc0('0x48')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x59e05e[_0x112565]),'UserId':Number(_0x4e5da3['id'])});}});}})['then'](function(){if(_0x109f42===_0x2fc0('0x4a')){var _0x2e0a06=_[_0x2fc0('0x18')](_0x4e5da3[_0x2fc0('0x28')],'id');return _0x4e5da3[_0x2fc0('0x4c')](_0x2e0a06)['then'](function(){for(var _0x3b5d51=0x0;_0x3b5d51<_0x2e0a06[_0x2fc0('0x1c')];_0x3b5d51+=0x1){_0xfdeef2[_0x2fc0('0x48')](_0x2fc0('0x4d'),{'OpenchannelInteractionId':Number(_0x2e0a06[_0x3b5d51]),'UserId':Number(_0x4e5da3['id'])});}});}})['catch'](function(_0x5c9caa){_0x20249f['log'](_0x5c9caa);});}}function onDisconnect(_0x5b4330,_0x5d290f){joinOrLeave(_0x5b4330,_0x2fc0('0x4a'),_0x5d290f);}function onConnect(_0x2f4a5b){joinOrLeave(_0x2f4a5b,_0x2fc0('0x4e'));}exports[_0x2fc0('0x4f')]=function(_0x472d37){_0x472d37['on'](_0x2fc0('0x50'),function(_0x19fba4){_0x19fba4[_0x2fc0('0x51')](0x0);_0x19fba4[_0x2fc0('0x52')]=_0x19fba4['request'][_0x2fc0('0x50')][_0x2fc0('0x53')]+':'+_0x19fba4[_0x2fc0('0x54')]['connection'][_0x2fc0('0x55')];_0x19fba4['connectedAt']=new Date();_0x19fba4[_0x2fc0('0x56')]=function(_0x2f9bcd){console[_0x2fc0('0x56')](_0x2fc0('0x57')+_0x19fba4[_0x2fc0('0x58')][_0x2fc0('0x9')]+'['+_0x19fba4[_0x2fc0('0x52')]+']',_0x2f9bcd);};_0x19fba4['on']('disconnect',function(){onDisconnect(_0x19fba4,_0x472d37);_0x19fba4[_0x2fc0('0x56')]('DISCONNECTED');});onConnect(_0x19fba4);_0x19fba4[_0x2fc0('0x56')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index fb6f25e..0f778dd 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 _0x3f60=['info','error','Trigger,\x20%s','catch','get','channel','event','direction','UserId','User','find','name','format','SIP/%s','incomingmessage','opened','changed','closed','interface','default','hasOwnProperty','callback','condition','util','../../mysqldb','triggers','client','http','ChatInteraction','newinteraction','afterUpdate','closedinteraction','Chat','afterCreate','newmessage','Sms','SmsMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x3f60,0x77));var _0x03f6=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0x3f60[_0x3cba93];return _0x4a2991;};'use strict';var util=require(_0x03f6('0x0'));var db=require(_0x03f6('0x1'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x03f6('0x2'));var client=jayson[_0x03f6('0x3')][_0x03f6('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x03f6('0x5'),'event':'afterCreate','condition':_0x03f6('0x6'),'callback':afterCreate},{'channel':'Chat','model':_0x03f6('0x5'),'event':_0x03f6('0x7'),'condition':_0x03f6('0x8'),'callback':afterUpdate},{'channel':_0x03f6('0x9'),'model':'ChatMessage','event':_0x03f6('0xa'),'condition':_0x03f6('0xb'),'callback':afterCreateMessage},{'channel':_0x03f6('0xc'),'model':'SmsInteraction','event':_0x03f6('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x03f6('0xc'),'model':'SmsInteraction','event':_0x03f6('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x03f6('0xd'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x03f6('0xe'),'event':_0x03f6('0xa'),'condition':_0x03f6('0x6'),'callback':afterCreate},{'channel':_0x03f6('0xf'),'model':_0x03f6('0xe'),'event':_0x03f6('0x7'),'condition':_0x03f6('0x8'),'callback':afterUpdate},{'channel':_0x03f6('0xf'),'model':_0x03f6('0x10'),'event':_0x03f6('0xa'),'condition':_0x03f6('0xb'),'callback':afterCreateMessage},{'channel':_0x03f6('0x11'),'model':_0x03f6('0x12'),'event':_0x03f6('0xa'),'condition':_0x03f6('0x6'),'callback':afterCreate},{'channel':'Mail','model':_0x03f6('0x12'),'event':'afterUpdate','condition':_0x03f6('0x8'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0x03f6('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x03f6('0x13'),'model':'OpenchannelInteraction','event':_0x03f6('0xa'),'condition':_0x03f6('0x6'),'callback':afterCreate},{'channel':_0x03f6('0x13'),'model':_0x03f6('0x14'),'event':_0x03f6('0x7'),'condition':_0x03f6('0x8'),'callback':afterUpdate},{'channel':_0x03f6('0x13'),'model':_0x03f6('0x15'),'event':_0x03f6('0xa'),'condition':_0x03f6('0xb'),'callback':afterCreateMessage}];function request(_0x46a5ee){return client[_0x03f6('0x16')](_0x03f6('0x17'),_0x46a5ee)[_0x03f6('0x18')](function(_0x14ce79){logger[_0x03f6('0x19')]('Trigger,\x20%s',_0x03f6('0x17'),_0x14ce79);if(_0x14ce79[_0x03f6('0x1a')]){if(_0x14ce79[_0x03f6('0x1a')]['code']===0x1f4){logger[_0x03f6('0x1a')](_0x03f6('0x1b'),'EventManager',_0x14ce79[_0x03f6('0x1a')]);}}})[_0x03f6('0x1c')](function(_0x431137){logger[_0x03f6('0x1a')](_0x03f6('0x1b'),_0x03f6('0x17'),_0x431137);});}function afterCreateMessage(_0x23b8cc,_0x491bbc){return function(_0x261e68,_0x39f2b6){_0x261e68=_0x261e68[_0x03f6('0x1d')]({'plain':!![]});_0x261e68[_0x03f6('0x1e')]=_0x23b8cc;_0x261e68[_0x03f6('0x1f')]=_0x261e68[_0x03f6('0x20')];if(_0x261e68[_0x03f6('0x21')]){return db[_0x03f6('0x22')][_0x03f6('0x23')]({'where':{'id':_0x261e68[_0x03f6('0x21')]},'attributes':['id',_0x03f6('0x24')],'raw':!![]})[_0x03f6('0x18')](function(_0x5c1b66){_0x261e68['interface']=util[_0x03f6('0x25')](_0x03f6('0x26'),_0x5c1b66[_0x03f6('0x24')]);_0x261e68['channel']=_0x23b8cc;return request({'event':_0x03f6('0x27'),'message':_0x261e68});})[_0x03f6('0x1c')](function(_0x1bab53){console[_0x03f6('0x1a')](_0x1bab53);});}else{return request({'event':'outgoingmessage','message':_0x261e68});}};}function afterCreate(_0x42f2eb,_0x120e03){return function(_0x22924d,_0x557ad1){_0x22924d=_0x22924d[_0x03f6('0x1d')]({'plain':!![]});_0x22924d['channel']=_0x42f2eb;_0x22924d['event']=_0x03f6('0x28');return request({'event':_0x120e03,'message':_0x22924d});};}function afterUpdate(_0x2c404d,_0x1e8339){return function(_0x271e6c,_0x1495aa){if(_0x271e6c[_0x03f6('0x29')]('closed')&&_0x271e6c['closed']){_0x271e6c=_0x271e6c[_0x03f6('0x1d')]({'plain':!![]});_0x271e6c[_0x03f6('0x1e')]=_0x2c404d;_0x271e6c[_0x03f6('0x1f')]=_0x03f6('0x2a');if(_0x271e6c['UserId']){return db[_0x03f6('0x22')][_0x03f6('0x23')]({'where':{'id':_0x271e6c[_0x03f6('0x21')]},'attributes':['id',_0x03f6('0x24')],'raw':!![]})['then'](function(_0x3c59c6){_0x271e6c[_0x03f6('0x2b')]=util[_0x03f6('0x25')](_0x03f6('0x26'),_0x3c59c6[_0x03f6('0x24')]);return request({'event':_0x1e8339,'message':_0x271e6c});})[_0x03f6('0x1c')](function(_0x2b02c6){console[_0x03f6('0x1a')](_0x2b02c6);});}else{return request({'event':_0x1e8339,'message':_0x271e6c});}}};}exports[_0x03f6('0x2c')]=function(){for(var _0x3c4131=0x0;_0x3c41310x3){var _0x340710=/\((.+)\)/;var _0x19a4e7=_0x1ed1dc['rx'][_0x6f52('0x18')](_0x340710);if(_0x19a4e7){_0x5485d7=_0x19a4e7[0x1];}else{_0x5485d7=null;}}else{_0x5485d7=null;}_0x1ed1dc['cb'](null,{'code':_0x3a31a6,'result':_0x5b27e9,'extra':_0x5485d7});}});_0x13ba1a['on']('error',function(_0x210925){_0x331bcb[_0x6f52('0x9')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x210925[_0x6f52('0x19')]));});_0x13ba1a['on'](_0x6f52('0x1a'),function(){_0x331bcb['emit'](_0x6f52('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x13ba1a['on'](_0x6f52('0x1b'),function(){_0x331bcb[_0x6f52('0x9')](_0x6f52('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x13ba1a['destroy']();});_0x13ba1a[_0x6f52('0x1c')](_0x497bdd);this[_0x6f52('0x1d')]=function(_0x2517ca,_0x4fbc8a){var _0x2517ca=_0x2517ca||'',_0x4fbc8a=typeof _0x4fbc8a=='function'?_0x4fbc8a:new Function();_0x1ed1dc={'tx':_0x2517ca,'rx':'','cb':_0x4fbc8a};_0x13ba1a['write'](_0x2517ca+'\x0a');},this['close']=function(){_0x13ba1a[_0x6f52('0x1e')]();};}util[_0x6f52('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x6f52('0x20')][_0x6f52('0x21')]=function(_0x189399){return this['command'][_0x6f52('0x22')](this,_0x189399);};AGIChannel[_0x6f52('0x20')][_0x6f52('0x23')]=function(){return this[_0x6f52('0x21')]('ANSWER');};AGIChannel[_0x6f52('0x20')][_0x6f52('0x24')]=function(_0x31b1fd,_0x17447a,_0x975ffd){_0x31b1fd=_0x31b1fd===undefined?_0x6f52('0x25'):_0x31b1fd;_0x17447a=_0x17447a===undefined?'5':_0x17447a;_0x975ffd=_0x975ffd===undefined?'1':_0x975ffd;return this[_0x6f52('0x21')](util[_0x6f52('0x26')](_0x6f52('0x27'),_0x31b1fd,_0x17447a*0x3e8,_0x975ffd));};AGIChannel[_0x6f52('0x20')][_0x6f52('0x28')]=function(_0x29f000){_0x29f000=_0x29f000||_0x6f52('0x29');return this[_0x6f52('0x21')](util[_0x6f52('0x26')](_0x6f52('0x2a'),_0x29f000));};AGIChannel[_0x6f52('0x20')]['exec']=function(_0x113b02,_0x4aa0c9){if(_['isArray'](_0x4aa0c9)){return this[_0x6f52('0x21')](util[_0x6f52('0x26')]('EXEC\x20%s\x20%s',_0x113b02,_0x4aa0c9[_0x6f52('0x2b')](',')));}return this[_0x6f52('0x21')](util[_0x6f52('0x26')](_0x6f52('0x2c'),_0x113b02,_0x4aa0c9));};AGIChannel[_0x6f52('0x20')][_0x6f52('0x2d')]=function(_0x31b29e){return this[_0x6f52('0x21')](util['format'](_0x6f52('0x2e'),_0x31b29e));};AGIChannel['prototype'][_0x6f52('0x2f')]=function(_0x353262){return this[_0x6f52('0x21')](util[_0x6f52('0x26')](_0x6f52('0x30'),_0x353262));};AGIChannel[_0x6f52('0x20')][_0x6f52('0x31')]=function(_0x569895){return this['sendRequest'](util['format'](_0x6f52('0x32'),_0x569895));};AGIChannel[_0x6f52('0x20')]['hangup']=function(){return this['sendRequest'](_0x6f52('0x33'));};AGIChannel[_0x6f52('0x20')][_0x6f52('0x34')]=function(_0x2472fa,_0x5e228a){return this['sendRequest'](util['format'](_0x6f52('0x35'),_0x2472fa,_0x5e228a?_0x5e228a[_0x6f52('0x36')]()[_0x6f52('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6f52('0x20')][_0x6f52('0x38')]=function(_0x100e8e,_0x41a0ab){return this[_0x6f52('0x21')](util[_0x6f52('0x26')](_0x6f52('0x39'),_0x100e8e,_0x41a0ab));};AGIChannel['prototype'][_0x6f52('0x3a')]=function(_0x7c410f,_0x588edf){return this[_0x6f52('0x21')](util[_0x6f52('0x26')]('SAY\x20DIGITS\x20%s\x20%s',_0x7c410f,_0x588edf));};AGIChannel[_0x6f52('0x20')][_0x6f52('0x3b')]=function(_0x20a3ca,_0x1b10d4){return this[_0x6f52('0x21')](util[_0x6f52('0x26')](_0x6f52('0x3c'),_0x20a3ca,_0x1b10d4));};AGIChannel[_0x6f52('0x20')][_0x6f52('0x3d')]=function(_0x18f85e,_0x1d8294,_0x34d6cc){_0x1d8294=_0x1d8294||this['extension'];_0x34d6cc=_0x34d6cc||0x1;this[_0x6f52('0x2d')](_0x18f85e);this['setExtension'](_0x1d8294);this[_0x6f52('0x31')](_0x34d6cc);return this[_0x6f52('0x28')](util[_0x6f52('0x26')](_0x6f52('0x3e'),_0x18f85e,_0x1d8294,_0x34d6cc));};AGIChannel[_0x6f52('0x20')][_0x6f52('0x3f')]=function(_0x3b0ff5){return this['sendRequest'](util[_0x6f52('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x3b0ff5));};AGIChannel[_0x6f52('0x20')]['recordFile']=function(_0x47a4bc,_0x56052f,_0x26776d,_0x4d2c23,_0x4e43d6,_0x41ae26){_0x56052f=_0x56052f||_0x6f52('0x40');_0x26776d=_0x26776d||'';_0x4d2c23=_0x4d2c23===undefined?-0x1:_0x4d2c23==='-1'?-0x1:_0x4d2c23*0x3e8;_0x4e43d6=_0x4e43d6===undefined?'':'s='+_0x4e43d6;_0x41ae26=_0x41ae26?_0x6f52('0x41'):'';return this[_0x6f52('0x21')](util[_0x6f52('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x47a4bc,_0x56052f,_0x26776d,_0x4d2c23,_0x41ae26,_0x4e43d6));};AGIChannel['prototype'][_0x6f52('0x42')]=function(_0x2e1330,_0x5abbad){_0x5abbad=_0x5abbad||'';return this[_0x6f52('0x21')](util[_0x6f52('0x26')](_0x6f52('0x43'),_0x2e1330,_0x5abbad));};AGIChannel[_0x6f52('0x20')]['agi']=function(_0x261a7b){return this[_0x6f52('0x44')](_0x6f52('0x45'),_0x261a7b);};AGIChannel[_0x6f52('0x20')][_0x6f52('0x46')]=function(_0x52f5b5){return this[_0x6f52('0x44')](_0x6f52('0x47'),_0x52f5b5);};AGIChannel[_0x6f52('0x20')]['error']=function(_0x4d6bd6,_0x1e4b9b){this['noop'](util['format'](_0x6f52('0x48'),_0x4d6bd6['id'],_0x4d6bd6[_0x6f52('0x49')],_0x1e4b9b));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x3124=['hangup','substring','520-Invalid','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','answer','ANSWER','sendRequest','format','NO\x20MESSAGE','exec','isArray','join','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setPriority','noop','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','toLowerCase'];(function(_0x309092,_0x279d1c){var _0x54b589=function(_0x3d4cea){while(--_0x3d4cea){_0x309092['push'](_0x309092['shift']());}};_0x54b589(++_0x279d1c);}(_0x3124,0xc1));var _0x4312=function(_0x18299f,_0x4b6273){_0x18299f=_0x18299f-0x0;var _0x35b303=_0x3124[_0x18299f];return _0x35b303;};'use strict';var util=require(_0x4312('0x0'));var _=require('lodash');var EventEmitter=require(_0x4312('0x1'))['EventEmitter'];var AGIReply=require(_0x4312('0x2'));var AGIError=require(_0x4312('0x3'));function AGIChannel(_0x2e55f4){var _0x255704=this,_0x146994=new AGIReply(),_0x4bdff1=![],_0x677dd5={};EventEmitter[_0x4312('0x4')](_0x255704);_0x2e55f4['setEncoding'](_0x4312('0x5'));_0x2e55f4[_0x4312('0x6')](0x8*0x3c*0x3c*0x3e8);_0x146994[_0x4312('0x7')](_0x4312('0x5'));_0x146994['on'](_0x4312('0x8'),function(_0x5e201c){for(var _0x187835 in _0x5e201c){_0x255704[_0x187835]=_0x5e201c[_0x187835];}_0x255704[_0x4312('0x9')]('ready');});_0x146994['on']('line',function(_0x481353){if(_0x481353[_0x4312('0xa')]()==_0x4312('0xb')){_0x255704[_0x4312('0x9')]('hangup');return;}if(_0x481353[_0x4312('0xc')](0x0,0xb)==_0x4312('0xd')){_0x4bdff1=!![];}if(_0x4bdff1){_0x677dd5['rx']+=_0x481353+'\x0a';if(_0x481353['search'](_0x4312('0xe'))!=-0x1){_0x4bdff1=![];}}else{_0x677dd5['rx']=_0x481353;}if(_0x4bdff1){return;}if(typeof _0x677dd5['cb']=='function'){var _0x4e5ff6=_0x677dd5['rx'][_0x4312('0xc')](0x0,0x3),_0xbe52ab=null,_0x417790=null;_0x4e5ff6=parseInt(_0x4e5ff6);if(isNaN(_0x4e5ff6)){_0x677dd5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4312('0xf')});return;}if(_0x4e5ff6!=0xc8){_0x677dd5['cb'](null,{'code':_0x4e5ff6,'result':-0x1,'extra':'KO'});return;}_0xbe52ab=_0x677dd5['rx']['substring'](0x4)[_0x4312('0x10')](_0x4312('0x11'),'');if(_0xbe52ab[_0x4312('0x12')]('\x20')!=-0x1){_0xbe52ab=_0xbe52ab[_0x4312('0x13')](0x0,_0xbe52ab['indexOf']('\x20'));}if(_[_0x4312('0x14')](_0xbe52ab,'-1')){_0xbe52ab=parseInt(_0xbe52ab);}_0x417790=_0x677dd5['rx']['split']('\x20');if(_0x417790[_0x4312('0x15')]==0x3){_0x417790=_0x417790[0x2]['substring'](0x1,_0x417790[0x2][_0x4312('0x15')]-0x1);}else if(_0x417790['length']>0x3){var _0x297d6b=/\((.+)\)/;var _0x172290=_0x677dd5['rx'][_0x4312('0x16')](_0x297d6b);if(_0x172290){_0x417790=_0x172290[0x1];}else{_0x417790=null;}}else{_0x417790=null;}_0x677dd5['cb'](null,{'code':_0x4e5ff6,'result':_0xbe52ab,'extra':_0x417790});}});_0x2e55f4['on'](_0x4312('0x17'),function(_0x573ca2){_0x255704[_0x4312('0x9')](_0x4312('0x17'),new AGIError(_0x4312('0x18'),_0x573ca2[_0x4312('0x19')]));});_0x2e55f4['on'](_0x4312('0x1a'),function(){_0x255704[_0x4312('0x9')](_0x4312('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x2e55f4['on'](_0x4312('0x1b'),function(){_0x255704[_0x4312('0x9')](_0x4312('0x1b'),new AGIError(_0x4312('0x1c')));_0x2e55f4[_0x4312('0x1d')]();});_0x2e55f4[_0x4312('0x1e')](_0x146994);this[_0x4312('0x1f')]=function(_0x44d5c5,_0x5824a6){var _0x44d5c5=_0x44d5c5||'',_0x5824a6=typeof _0x5824a6=='function'?_0x5824a6:new Function();_0x677dd5={'tx':_0x44d5c5,'rx':'','cb':_0x5824a6};_0x2e55f4[_0x4312('0x20')](_0x44d5c5+'\x0a');},this[_0x4312('0x1a')]=function(){_0x2e55f4['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x4312('0x21')]['sendRequest']=function(_0x5204f3){return this[_0x4312('0x1f')]['sync'](this,_0x5204f3);};AGIChannel[_0x4312('0x21')][_0x4312('0x22')]=function(){return this['sendRequest'](_0x4312('0x23'));};AGIChannel['prototype']['getData']=function(_0x4a437f,_0x4989c2,_0x1f5da1){_0x4a437f=_0x4a437f===undefined?'beep':_0x4a437f;_0x4989c2=_0x4989c2===undefined?'5':_0x4989c2;_0x1f5da1=_0x1f5da1===undefined?'1':_0x1f5da1;return this[_0x4312('0x24')](util[_0x4312('0x25')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x4a437f,_0x4989c2*0x3e8,_0x1f5da1));};AGIChannel[_0x4312('0x21')]['noop']=function(_0x4d787f){_0x4d787f=_0x4d787f||_0x4312('0x26');return this[_0x4312('0x24')](util[_0x4312('0x25')]('VERBOSE\x20\x22%s\x22',_0x4d787f));};AGIChannel['prototype'][_0x4312('0x27')]=function(_0x456acb,_0x57403b){if(_[_0x4312('0x28')](_0x57403b)){return this[_0x4312('0x24')](util['format']('EXEC\x20%s\x20%s',_0x456acb,_0x57403b[_0x4312('0x29')](',')));}return this[_0x4312('0x24')](util['format'](_0x4312('0x2a'),_0x456acb,_0x57403b));};AGIChannel[_0x4312('0x21')][_0x4312('0x2b')]=function(_0x2c701b){return this['sendRequest'](util[_0x4312('0x25')]('SET\x20CONTEXT\x20%s',_0x2c701b));};AGIChannel[_0x4312('0x21')][_0x4312('0x2c')]=function(_0x333b52){return this[_0x4312('0x24')](util['format'](_0x4312('0x2d'),_0x333b52));};AGIChannel[_0x4312('0x21')]['setPriority']=function(_0x38e6fa){return this[_0x4312('0x24')](util[_0x4312('0x25')](_0x4312('0x2e'),_0x38e6fa));};AGIChannel[_0x4312('0x21')]['hangup']=function(){return this['sendRequest'](_0x4312('0x2f'));};AGIChannel[_0x4312('0x21')][_0x4312('0x30')]=function(_0x3cde45,_0x58afc5){return this[_0x4312('0x24')](util[_0x4312('0x25')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3cde45,_0x58afc5?_0x58afc5[_0x4312('0x31')]()[_0x4312('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x3fef64,_0x3639bf){return this[_0x4312('0x24')](util['format'](_0x4312('0x32'),_0x3fef64,_0x3639bf));};AGIChannel[_0x4312('0x21')][_0x4312('0x33')]=function(_0x4340bf,_0x42493a){return this['sendRequest'](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x4340bf,_0x42493a));};AGIChannel['prototype'][_0x4312('0x34')]=function(_0xe51339,_0x403081){return this['sendRequest'](util[_0x4312('0x25')](_0x4312('0x35'),_0xe51339,_0x403081));};AGIChannel['prototype']['continueAt']=function(_0x371eff,_0x30830f,_0x57bafd){_0x30830f=_0x30830f||this[_0x4312('0x36')];_0x57bafd=_0x57bafd||0x1;this['setContext'](_0x371eff);this[_0x4312('0x2c')](_0x30830f);this[_0x4312('0x37')](_0x57bafd);return this[_0x4312('0x38')](util[_0x4312('0x25')]('GOTO\x20%s\x20%s\x20%s',_0x371eff,_0x30830f,_0x57bafd));};AGIChannel[_0x4312('0x21')][_0x4312('0x39')]=function(_0x145b54){return this[_0x4312('0x24')](util[_0x4312('0x25')]('GET\x20VARIABLE\x20\x22%s\x22',_0x145b54));};AGIChannel[_0x4312('0x21')][_0x4312('0x3a')]=function(_0x298af4,_0x52c8a7,_0x2413ac,_0x4cd24a,_0xc4568c,_0x519a73){_0x52c8a7=_0x52c8a7||_0x4312('0x3b');_0x2413ac=_0x2413ac||'';_0x4cd24a=_0x4cd24a===undefined?-0x1:_0x4cd24a==='-1'?-0x1:_0x4cd24a*0x3e8;_0xc4568c=_0xc4568c===undefined?'':'s='+_0xc4568c;_0x519a73=_0x519a73?_0x4312('0x3c'):'';return this[_0x4312('0x24')](util[_0x4312('0x25')](_0x4312('0x3d'),_0x298af4,_0x52c8a7,_0x2413ac,_0x4cd24a,_0x519a73,_0xc4568c));};AGIChannel[_0x4312('0x21')]['streamFile']=function(_0x4be694,_0x468cb7){_0x468cb7=_0x468cb7||'';return this[_0x4312('0x24')](util[_0x4312('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4be694,_0x468cb7));};AGIChannel[_0x4312('0x21')]['agi']=function(_0x1be7e6){return this[_0x4312('0x27')](_0x4312('0x3e'),_0x1be7e6);};AGIChannel['prototype'][_0x4312('0x3f')]=function(_0x520ec6){return this[_0x4312('0x27')](_0x4312('0x40'),_0x520ec6);};AGIChannel['prototype'][_0x4312('0x17')]=function(_0x54b1f7,_0x451a97){this[_0x4312('0x38')](util['format'](_0x4312('0x41'),_0x54b1f7['id'],_0x54b1f7[_0x4312('0x42')],_0x451a97));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4312('0x43')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f61f136..515551c 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 _0xb2fa=['name','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xb2fa,0x1dd));var _0xab2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb2fa[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xab2f('0x0'));var error={'E_AGI_UNDEFINED':_0xab2f('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xab2f('0x2'),'E_AGI_SERVER_CLOSE':_0xab2f('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xab2f('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xab2f('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xab2f('0x6'),'E_AGI_COMMAND_EMPTY':_0xab2f('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xab2f('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2adeac){var _0x2adeac=_0x2adeac||null,_0x3dbc62=_0x3dbc62||[],_0x39e62a=0x1,_0x5b8bcc='';if(!error[_0x2adeac]){_0x2adeac=_0xab2f('0x9');}_0x3dbc62['push'](error[_0x2adeac]);while(arguments[_0x39e62a]){_0x3dbc62[_0xab2f('0xa')](arguments[_0x39e62a]);_0x39e62a++;}_0x5b8bcc=util[_0xab2f('0xb')][_0xab2f('0xc')](util,_0x3dbc62);this['message']=_0x5b8bcc;this[_0xab2f('0xd')]=_0x2adeac;}module['exports']=AGIError; \ No newline at end of file +var _0x05ad=['apply','message','name','exports','util','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\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x1c8c07,_0x2579af){var _0x4aa88f=function(_0x2ad13d){while(--_0x2ad13d){_0x1c8c07['push'](_0x1c8c07['shift']());}};_0x4aa88f(++_0x2579af);}(_0x05ad,0x1d4));var _0xd05a=function(_0x24bd97,_0x3b1cf7){_0x24bd97=_0x24bd97-0x0;var _0xcf31a6=_0x05ad[_0x24bd97];return _0xcf31a6;};'use strict';var util=require(_0xd05a('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xd05a('0x1'),'E_AGI_SERVER_ERROR':_0xd05a('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xd05a('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xd05a('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xd05a('0x5'),'E_AGI_COMMAND_EMPTY':_0xd05a('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd05a('0x7'),'E_AGI_IVR_ENTRY':_0xd05a('0x8')};function AGIError(_0x5ea7ef){var _0x5ea7ef=_0x5ea7ef||null,_0x367c15=_0x367c15||[],_0x518682=0x1,_0x1c6f2b='';if(!error[_0x5ea7ef]){_0x5ea7ef=_0xd05a('0x9');}_0x367c15['push'](error[_0x5ea7ef]);while(arguments[_0x518682]){_0x367c15[_0xd05a('0xa')](arguments[_0x518682]);_0x518682++;}_0x1c6f2b=util[_0xd05a('0xb')][_0xd05a('0xc')](util,_0x367c15);this[_0xd05a('0xd')]=_0x1c6f2b;this[_0xd05a('0xe')]=_0x5ea7ef;}module[_0xd05a('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index fe92dd5..d15a57a 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 _0xccde=['exports','lodash','agi','getdigits','getsecretdigits','numberOfEdges','prototype','addVertex','vertices','addEdge','edges','push','relations','getVertex','traverseBFS','info','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','target','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found'];(function(_0x33ea6a,_0x55ccef){var _0x224d9f=function(_0x1f8fb8){while(--_0x1f8fb8){_0x33ea6a['push'](_0x33ea6a['shift']());}};_0x224d9f(++_0x55ccef);}(_0xccde,0x1e1));var _0xeccd=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0xccde[_0x3a3758];return _0x1a9234;};'use strict';var _=require(_0xeccd('0x0'));var logger=require('../../../config/logger')(_0xeccd('0x1'));var verticesWithRetry=['menu',_0xeccd('0x2'),_0xeccd('0x3')];var Graph=function(){this['vertices']={};this['edges']={};this[_0xeccd('0x4')]=0x0;};Graph[_0xeccd('0x5')][_0xeccd('0x6')]=function(_0x397cd0){this[_0xeccd('0x7')][_0x397cd0['id']]=_0x397cd0;this['edges'][_0x397cd0['id']]=[];};Graph[_0xeccd('0x5')][_0xeccd('0x8')]=function(_0x1b622f,_0x1eebfb,_0x4b068e){this[_0xeccd('0x9')][_0x1b622f][_0xeccd('0xa')]({'target':_0x1eebfb,'condition':_0x4b068e});this[_0xeccd('0x4')]+=0x1;};Graph[_0xeccd('0x5')]['size']=function(){return _['size'](this['vertices']);};Graph['prototype'][_0xeccd('0xb')]=function(){return this[_0xeccd('0x4')];};Graph[_0xeccd('0x5')][_0xeccd('0xc')]=function(_0x307e37){return this['vertices'][_0x307e37];};Graph[_0xeccd('0x5')][_0xeccd('0xd')]=function(_0x377cd7,_0x3bd19c){if(!this[_0xeccd('0x7')][_0x377cd7]){return logger[_0xeccd('0xe')]('no\x20vertex\x20found');}var _0x57516f=_0x3bd19c(this[_0xeccd('0x7')][_0x377cd7]);if(!_0x57516f){return logger[_0xeccd('0xe')](_0xeccd('0xf'));}if(this[_0xeccd('0x9')][_0x377cd7]['length']===0x0){return logger[_0xeccd('0xe')](_0xeccd('0x10'));}for(var _0x496061=0x0,_0x53f4d8=[],_0x42e47e=![];_0x496061\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','continueAt','close','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','moment','agi','./rpc','./vertices','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','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','hasOwnProperty','retry','omit','isArray','length','source','addEdge','value','getSquareProject','then'];(function(_0x6d4cee,_0x295b67){var _0x2602b0=function(_0x712d39){while(--_0x712d39){_0x6d4cee['push'](_0x6d4cee['shift']());}};_0x2602b0(++_0x295b67);}(_0x4006,0x1c7));var _0x6400=function(_0x398b56,_0x294e48){_0x398b56=_0x398b56-0x0;var _0x3d695d=_0x4006[_0x398b56];return _0x3d695d;};'use strict';var parser=require('xml2json');var _=require(_0x6400('0x0'));var syncho=require(_0x6400('0x1'));var util=require(_0x6400('0x2'));var moment=require(_0x6400('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x6400('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x6400('0x5'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x6400('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x6400('0x7')](config[_0x6400('0x4')],{'ip':_0x6400('0x8'),'port':0x11dd});function connectionHandler(_0x250dba){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x250dba);agiHandler(_0x250dba);}catch(_0x31cc99){logger[_0x6400('0x9')](_0x31cc99[_0x6400('0xa')]);}});});}function listeningHandler(){console[_0x6400('0xb')](_0x6400('0xc'),config[_0x6400('0x4')][_0x6400('0xd')]);logger[_0x6400('0xe')](util[_0x6400('0xf')](_0x6400('0x10'),config[_0x6400('0x4')]['ip'],config['agi'][_0x6400('0xd')]));}function errorHandler(_0x3a408e){if(_0x3a408e&&_0x3a408e[_0x6400('0x11')]&&_0x3a408e[_0x6400('0x12')]){logger['error'](util[_0x6400('0xf')](_0x6400('0x13'),_0x3a408e['name'],_0x3a408e['message']));}else{logger['error'](util[_0x6400('0xf')](_0x6400('0x14'),_0x3a408e['stack']));}}function closeHandler(){logger[_0x6400('0xe')](util['format'](_0x6400('0x15'),this['arg_1'],this[_0x6400('0x16')],this[_0x6400('0x17')],this[_0x6400('0x18')],this[_0x6400('0x19')]));try{createSquareReport(this);}catch(_0x49d412){logger[_0x6400('0x9')](_0x49d412[_0x6400('0xa')]);}}function timeoutHandler(){logger[_0x6400('0xe')](util['format'](_0x6400('0x1a'),this[_0x6400('0x1b')],this['calleridname'],this[_0x6400('0x17')],this[_0x6400('0x18')],this[_0x6400('0x19')]));}function hangupHandler(){logger['info'](util[_0x6400('0xf')](_0x6400('0x1c'),this[_0x6400('0x1b')],this[_0x6400('0x16')],this[_0x6400('0x17')],this[_0x6400('0x18')],this[_0x6400('0x19')]));this[_0x6400('0x1d')]=!![];}function getRoot(_0x22eb63){return parser[_0x6400('0x1e')](_0x22eb63,{'object':!![]})['mxGraphModel'][_0x6400('0x1f')];}function addVertex(_0x50c29e,_0x589b7c,_0x257d80){_0x589b7c[_0x6400('0x20')]=_0x257d80;if(_0x589b7c[_0x6400('0x21')](_0x6400('0x22'))){_0x589b7c['maxRetry']=parseInt(_0x589b7c[_0x6400('0x22')],0xa);}_0x50c29e['addVertex'](_[_0x6400('0x23')](_0x589b7c,'mxCell'));}function initGraph(_0x3bcb28,_0x246433){var _0x577156=new Graph();for(var _0x434550 in _0x3bcb28){if(_0x3bcb28[_0x6400('0x21')](_0x434550)){if(_[_0x6400('0x24')](_0x3bcb28[_0x434550])){for(var _0x56b285=0x0;_0x56b285<_0x3bcb28[_0x434550][_0x6400('0x25')];_0x56b285+=0x1){addVertex(_0x577156,_0x3bcb28[_0x434550][_0x56b285],_0x434550);}}else{addVertex(_0x577156,_0x3bcb28[_0x434550],_0x434550);}}}for(var _0x5116ea=0x0;_0x5116ea<_0x246433['length'];_0x5116ea+=0x1){if(_0x246433[_0x5116ea][_0x6400('0x26')]&&_0x246433[_0x5116ea]['target']){_0x577156[_0x6400('0x27')](_0x246433[_0x5116ea][_0x6400('0x26')],_0x246433[_0x5116ea]['target'],_0x246433[_0x5116ea][_0x6400('0x28')]);}}return _0x577156;}function getSquareProject(_0x52eba1,_0x498eaa){rpc[_0x6400('0x29')](_0x52eba1)[_0x6400('0x2a')](function(_0x10005a){_0x498eaa(null,_0x10005a);})[_0x6400('0x2b')](function(_0x1cf032){_0x498eaa(null,_0x1cf032);});}function createSquareReport(_0x54cf9f,_0x3bed65){rpc[_0x6400('0x2c')](_0x54cf9f)[_0x6400('0x2a')](function(_0x1f66c3){if(_0x3bed65){_0x3bed65(null,_0x1f66c3);}})['catch'](function(_0x437624){if(_0x3bed65){_0x3bed65(null,_0x437624);}});}function setChannelVariables(_0x356f4d){for(var _0x115aec in _0x356f4d){if(_0x356f4d['hasOwnProperty'](_0x115aec)){if(_0x115aec[_0x6400('0x2d')](_0x6400('0x2e'))===0x0){_0x356f4d[_0x115aec[_0x6400('0x2f')](0x4)]=_0x356f4d[_0x115aec];delete _0x356f4d[_0x115aec];}}}}function getLogFromObject(_0x3564ac){return util['inspect'](_0x3564ac,{'showHidden':![],'depth':null});}function agiHandler(_0x1aec8b){var _0x111676,_0x53e74c,_0x1e01c7,_0x37ab9a,_0x50ba26;logger['debug'](_0x6400('0x30'),JSON[_0x6400('0x31')](_0x1aec8b,null,0x2));logger[_0x6400('0xe')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1aec8b['arg_1'],_0x1aec8b[_0x6400('0x16')],_0x1aec8b[_0x6400('0x17')],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));_0x1aec8b['on'](_0x6400('0x9'),errorHandler);_0x1aec8b['on']('close',closeHandler);_0x1aec8b['on'](_0x6400('0x32'),timeoutHandler);_0x1aec8b[_0x6400('0x1d')]=![];_0x1aec8b['on']('hangup',hangupHandler);var _0x51425c=getSquareProject[_0x6400('0x33')](null,_0x1aec8b[_0x6400('0x1b')]);if(_0x51425c){if(_0x51425c[_0x6400('0x34')]){_0x111676=getRoot(_0x51425c['production']);if(_0x111676&&_0x111676[_0x6400('0x35')]){logger[_0x6400('0x36')](_0x6400('0x1f'),JSON['stringify'](_0x111676,null,0x2));_0x1aec8b[_0x6400('0x37')]=moment()[_0x6400('0xf')](_0x6400('0x38'));_0x53e74c=initGraph(_['omit'](_0x111676,'mxCell'),_0x111676['mxCell']);_0x1e01c7=new Vertices(_0x1aec8b,rpc,mailRpc);logger[_0x6400('0xe')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1aec8b[_0x6400('0x1b')],_0x1aec8b[_0x6400('0x16')],_0x1aec8b['callerid'],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));_0x53e74c[_0x6400('0x39')](_0x111676['start']['id'],function(_0x9536e5){try{_0x9536e5=_0x1e01c7[_0x6400('0x3a')](_0x9536e5);logger[_0x6400('0x36')](_0x6400('0x3b'),JSON['stringify'](_0x9536e5,null,0x2));if(_0x9536e5['agicommand']===_0x6400('0x3c')){logger[_0x6400('0xe')](_0x6400('0x3d'));_0x1aec8b['context']=_0x9536e5[_0x6400('0x3e')]||_0x1aec8b[_0x6400('0x3e')];_0x1aec8b[_0x6400('0x3f')]=_0x9536e5[_0x6400('0x3f')];_0x1aec8b[_0x6400('0x40')]=_0x9536e5['priority']?_0x9536e5[_0x6400('0x40')]-0x1:0x1;return null;}else if(_0x9536e5&&_0x1e01c7[_0x9536e5['agicommand']]){_0x50ba26=_0x1e01c7[_0x9536e5[_0x6400('0x20')]](_0x9536e5);logger[_0x6400('0xe')](_0x6400('0x41'),JSON[_0x6400('0x31')](_0x50ba26,null,0x2));if(_0x50ba26&&_0x50ba26['code']===AGI_CODE_SUCCESS&&_0x50ba26[_0x6400('0x42')]!==AGI_RESULT_ERROR&&!_0x1aec8b[_0x6400('0x1d')]){logger[_0x6400('0x36')](_0x6400('0x41'),getLogFromObject(_0x50ba26));return _['isUndefined'](_0x50ba26[_0x6400('0x42')])?null:_0x50ba26['result'][_0x6400('0x43')]();}else{logger['error'](_0x6400('0x41'),getLogFromObject(_0x50ba26));return null;}}else{logger[_0x6400('0x9')](_0x6400('0x44'));return null;}}catch(_0x5712f1){logger[_0x6400('0x9')](_0x5712f1['stack']);return null;}});if(_0x111676[_0x6400('0x45')]){logger[_0x6400('0xe')](util[_0x6400('0xf')](_0x6400('0x46'),_0x1aec8b[_0x6400('0x1b')],_0x1aec8b[_0x6400('0x16')],_0x1aec8b[_0x6400('0x17')],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));_0x53e74c[_0x6400('0x39')](_0x111676[_0x6400('0x45')]['id'],function(_0x4b9e9e){try{_0x4b9e9e=_0x1e01c7[_0x6400('0x3a')](_0x4b9e9e);logger[_0x6400('0x36')](_0x6400('0x3b'),JSON['stringify'](_0x4b9e9e,null,0x2));if(_0x4b9e9e&&_0x1e01c7[_0x4b9e9e[_0x6400('0x20')]]){_0x50ba26=_0x1e01c7[_0x4b9e9e[_0x6400('0x20')]](_0x4b9e9e);if(_0x50ba26){logger[_0x6400('0x36')]('response',getLogFromObject(_0x50ba26));return _[_0x6400('0x47')](_0x50ba26['result'])?null:_0x50ba26['result']['toString']();}else{logger[_0x6400('0x9')](_0x6400('0x41'),getLogFromObject(_0x50ba26));return null;}}else{logger['error'](_0x6400('0x44'));return null;}}catch(_0x9737b3){logger['error'](_0x9737b3['stack']);return null;}});}logger[_0x6400('0xe')](util[_0x6400('0xf')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1aec8b[_0x6400('0x1b')],_0x1aec8b[_0x6400('0x16')],_0x1aec8b[_0x6400('0x17')],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));logger[_0x6400('0xe')](util[_0x6400('0xf')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1aec8b[_0x6400('0x3e')],_0x1aec8b[_0x6400('0x3f')],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1));_0x1aec8b[_0x6400('0x48')](_0x1aec8b[_0x6400('0x3e')],_0x1aec8b[_0x6400('0x3f')],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1);_0x1aec8b['close']();}}else{logger[_0x6400('0x9')](util['format']('Project\x20%s\x20not\x20published',_0x1aec8b[_0x6400('0x1b')]));_0x1aec8b[_0x6400('0x48')](_0x1aec8b[_0x6400('0x3e')],_0x1aec8b['extension'],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1);_0x1aec8b[_0x6400('0x49')]();}}else{logger[_0x6400('0x9')](util[_0x6400('0xf')](_0x6400('0x4a'),_0x1aec8b['arg_1']));_0x1aec8b[_0x6400('0x48')](_0x1aec8b[_0x6400('0x3e')],_0x1aec8b['extension'],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1);_0x1aec8b[_0x6400('0x49')]();}}function main(){var _0x85a5ac;return utilLicense['getLicense']()[_0x6400('0x2a')](function(_0x489042){if(_0x489042){if(_0x489042[_0x6400('0x4b')]){if(_0x489042[_0x6400('0x4c')]&&_0x489042[_0x6400('0x4c')]>0x0){logger[_0x6400('0xe')](util[_0x6400('0xf')](_0x6400('0x4d'),_0x489042['callysquare']));_0x85a5ac=_0x489042[_0x6400('0x4c')];}else{logger[_0x6400('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x6400('0xe')](_0x6400('0x4e'));_0x85a5ac=-0x1;}}})[_0x6400('0x2b')](function(_0x17f72d){logger['error'](_0x6400('0x4f'),_0x17f72d[_0x6400('0xa')]);})[_0x6400('0x45')](function(){var _0x3d68d9=require(_0x6400('0x50'))(config[_0x6400('0x4')][_0x6400('0xd')],config[_0x6400('0x4')]['ip'],_0x85a5ac);_0x3d68d9['on'](_0x6400('0x9'),errorHandler);_0x3d68d9['on'](_0x6400('0x51'),listeningHandler);_0x3d68d9['on'](_0x6400('0x52'),connectionHandler);_0x3d68d9['on'](_0x6400('0x49'),closeHandler);});}main(); \ No newline at end of file +var _0xa7e6=['root','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','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','vertex','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','defaults','127.0.0.1','nextTick','error','stack','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[ERROR]\x20%s','arg_1','dnid','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toJson','mxGraphModel','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','target','addEdge','source','value','createSquareReport','then','catch','indexOf','agi_','substring','debug','variables','stringify','timeout','production','start'];(function(_0x27715a,_0x3c8283){var _0x30be34=function(_0x3b2dc1){while(--_0x3b2dc1){_0x27715a['push'](_0x27715a['shift']());}};_0x30be34(++_0x3c8283);}(_0xa7e6,0x74));var _0x6a7e=function(_0x3c9f45,_0x80b642){_0x3c9f45=_0x3c9f45-0x0;var _0x4b6e1a=_0xa7e6[_0x3c9f45];return _0x4b6e1a;};'use strict';var parser=require(_0x6a7e('0x0'));var _=require(_0x6a7e('0x1'));var syncho=require(_0x6a7e('0x2'));var util=require(_0x6a7e('0x3'));var moment=require(_0x6a7e('0x4'));var config=require(_0x6a7e('0x5'));var logger=require('../../config/logger')(_0x6a7e('0x6'));var utilLicense=require(_0x6a7e('0x7'));var rpc=require(_0x6a7e('0x8'));var mailRpc=require(_0x6a7e('0x9'));var Graph=require(_0x6a7e('0xa'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x6a7e('0x6')]=_[_0x6a7e('0xb')](config[_0x6a7e('0x6')],{'ip':_0x6a7e('0xc'),'port':0x11dd});function connectionHandler(_0x45e92e){process[_0x6a7e('0xd')](function(){syncho(function(){try{setChannelVariables(_0x45e92e);agiHandler(_0x45e92e);}catch(_0x23b5d6){logger[_0x6a7e('0xe')](_0x23b5d6[_0x6a7e('0xf')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')](_0x6a7e('0x12'),config[_0x6a7e('0x6')]['ip'],config[_0x6a7e('0x6')]['port']));}function errorHandler(_0x3ded6f){if(_0x3ded6f&&_0x3ded6f[_0x6a7e('0x13')]&&_0x3ded6f['message']){logger['error'](util[_0x6a7e('0x11')](_0x6a7e('0x14'),_0x3ded6f[_0x6a7e('0x13')],_0x3ded6f[_0x6a7e('0x15')]));}else{logger['error'](util[_0x6a7e('0x11')](_0x6a7e('0x16'),_0x3ded6f[_0x6a7e('0xf')]));}}function closeHandler(){logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x6a7e('0x17')],this['calleridname'],this['callerid'],this[_0x6a7e('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x1d2abb){logger[_0x6a7e('0xe')](_0x1d2abb[_0x6a7e('0xf')]);}}function timeoutHandler(){logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x6a7e('0x19')],this[_0x6a7e('0x18')],this[_0x6a7e('0x1a')]));}function hangupHandler(){logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')](_0x6a7e('0x1b'),this[_0x6a7e('0x17')],this[_0x6a7e('0x1c')],this['callerid'],this[_0x6a7e('0x18')],this[_0x6a7e('0x1a')]));this['evtHangup']=!![];}function getRoot(_0x3e1e64){return parser[_0x6a7e('0x1d')](_0x3e1e64,{'object':!![]})[_0x6a7e('0x1e')]['root'];}function addVertex(_0x40c7f6,_0xd045ca,_0x4ee914){_0xd045ca[_0x6a7e('0x1f')]=_0x4ee914;if(_0xd045ca['hasOwnProperty'](_0x6a7e('0x20'))){_0xd045ca[_0x6a7e('0x21')]=parseInt(_0xd045ca['retry'],0xa);}_0x40c7f6[_0x6a7e('0x22')](_[_0x6a7e('0x23')](_0xd045ca,_0x6a7e('0x24')));}function initGraph(_0x438c77,_0x3498c5){var _0x380f2f=new Graph();for(var _0x573bdc in _0x438c77){if(_0x438c77[_0x6a7e('0x25')](_0x573bdc)){if(_[_0x6a7e('0x26')](_0x438c77[_0x573bdc])){for(var _0x43b214=0x0;_0x43b214<_0x438c77[_0x573bdc][_0x6a7e('0x27')];_0x43b214+=0x1){addVertex(_0x380f2f,_0x438c77[_0x573bdc][_0x43b214],_0x573bdc);}}else{addVertex(_0x380f2f,_0x438c77[_0x573bdc],_0x573bdc);}}}for(var _0x149fe8=0x0;_0x149fe8<_0x3498c5['length'];_0x149fe8+=0x1){if(_0x3498c5[_0x149fe8]['source']&&_0x3498c5[_0x149fe8][_0x6a7e('0x28')]){_0x380f2f[_0x6a7e('0x29')](_0x3498c5[_0x149fe8][_0x6a7e('0x2a')],_0x3498c5[_0x149fe8]['target'],_0x3498c5[_0x149fe8][_0x6a7e('0x2b')]);}}return _0x380f2f;}function getSquareProject(_0x57e642,_0x1d1e3b){rpc['getSquareProject'](_0x57e642)['then'](function(_0x15c2b8){_0x1d1e3b(null,_0x15c2b8);})['catch'](function(_0x15cc6a){_0x1d1e3b(null,_0x15cc6a);});}function createSquareReport(_0x4a18c7,_0x5665df){rpc[_0x6a7e('0x2c')](_0x4a18c7)[_0x6a7e('0x2d')](function(_0x450a86){if(_0x5665df){_0x5665df(null,_0x450a86);}})[_0x6a7e('0x2e')](function(_0x2b1788){if(_0x5665df){_0x5665df(null,_0x2b1788);}});}function setChannelVariables(_0x2f5deb){for(var _0x10625d in _0x2f5deb){if(_0x2f5deb[_0x6a7e('0x25')](_0x10625d)){if(_0x10625d[_0x6a7e('0x2f')](_0x6a7e('0x30'))===0x0){_0x2f5deb[_0x10625d[_0x6a7e('0x31')](0x4)]=_0x2f5deb[_0x10625d];delete _0x2f5deb[_0x10625d];}}}}function getLogFromObject(_0x231cad){return util['inspect'](_0x231cad,{'showHidden':![],'depth':null});}function agiHandler(_0x1d5bc1){var _0x3f4764,_0x366236,_0x510c50,_0x328f9b,_0x3b7678;logger[_0x6a7e('0x32')](_0x6a7e('0x33'),JSON[_0x6a7e('0x34')](_0x1d5bc1,null,0x2));logger[_0x6a7e('0x10')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1d5bc1[_0x6a7e('0x17')],_0x1d5bc1['calleridname'],_0x1d5bc1[_0x6a7e('0x19')],_0x1d5bc1[_0x6a7e('0x18')],_0x1d5bc1['uniqueid']));_0x1d5bc1['on']('error',errorHandler);_0x1d5bc1['on']('close',closeHandler);_0x1d5bc1['on'](_0x6a7e('0x35'),timeoutHandler);_0x1d5bc1['evtHangup']=![];_0x1d5bc1['on']('hangup',hangupHandler);var _0x512430=getSquareProject['sync'](null,_0x1d5bc1[_0x6a7e('0x17')]);if(_0x512430){if(_0x512430['production']){_0x3f4764=getRoot(_0x512430[_0x6a7e('0x36')]);if(_0x3f4764&&_0x3f4764[_0x6a7e('0x37')]){logger[_0x6a7e('0x32')](_0x6a7e('0x38'),JSON[_0x6a7e('0x34')](_0x3f4764,null,0x2));_0x1d5bc1['joinAt']=moment()[_0x6a7e('0x11')](_0x6a7e('0x39'));_0x366236=initGraph(_['omit'](_0x3f4764,_0x6a7e('0x24')),_0x3f4764[_0x6a7e('0x24')]);_0x510c50=new Vertices(_0x1d5bc1,rpc,mailRpc);logger['info'](util[_0x6a7e('0x11')](_0x6a7e('0x3a'),_0x1d5bc1[_0x6a7e('0x17')],_0x1d5bc1[_0x6a7e('0x1c')],_0x1d5bc1[_0x6a7e('0x19')],_0x1d5bc1[_0x6a7e('0x18')],_0x1d5bc1[_0x6a7e('0x1a')]));_0x366236[_0x6a7e('0x3b')](_0x3f4764[_0x6a7e('0x37')]['id'],function(_0x27434a){try{_0x27434a=_0x510c50[_0x6a7e('0x3c')](_0x27434a);logger['debug']('vertex',JSON[_0x6a7e('0x34')](_0x27434a,null,0x2));if(_0x27434a[_0x6a7e('0x1f')]==='gotoc'){logger[_0x6a7e('0x10')](_0x6a7e('0x3d'));_0x1d5bc1[_0x6a7e('0x3e')]=_0x27434a[_0x6a7e('0x3e')]||_0x1d5bc1[_0x6a7e('0x3e')];_0x1d5bc1[_0x6a7e('0x3f')]=_0x27434a[_0x6a7e('0x3f')];_0x1d5bc1[_0x6a7e('0x40')]=_0x27434a[_0x6a7e('0x40')]?_0x27434a[_0x6a7e('0x40')]-0x1:0x1;return null;}else if(_0x27434a&&_0x510c50[_0x27434a[_0x6a7e('0x1f')]]){_0x3b7678=_0x510c50[_0x27434a[_0x6a7e('0x1f')]](_0x27434a);logger[_0x6a7e('0x10')](_0x6a7e('0x41'),JSON['stringify'](_0x3b7678,null,0x2));if(_0x3b7678&&_0x3b7678['code']===AGI_CODE_SUCCESS&&_0x3b7678[_0x6a7e('0x42')]!==AGI_RESULT_ERROR&&!_0x1d5bc1[_0x6a7e('0x43')]){logger[_0x6a7e('0x32')](_0x6a7e('0x41'),getLogFromObject(_0x3b7678));return _[_0x6a7e('0x44')](_0x3b7678[_0x6a7e('0x42')])?null:_0x3b7678[_0x6a7e('0x42')][_0x6a7e('0x45')]();}else{logger['error'](_0x6a7e('0x41'),getLogFromObject(_0x3b7678));return null;}}else{logger['error'](_0x6a7e('0x46'));return null;}}catch(_0x2f87ea){logger[_0x6a7e('0xe')](_0x2f87ea[_0x6a7e('0xf')]);return null;}});if(_0x3f4764['finally']){logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')](_0x6a7e('0x47'),_0x1d5bc1['arg_1'],_0x1d5bc1[_0x6a7e('0x1c')],_0x1d5bc1['callerid'],_0x1d5bc1[_0x6a7e('0x18')],_0x1d5bc1[_0x6a7e('0x1a')]));_0x366236[_0x6a7e('0x3b')](_0x3f4764[_0x6a7e('0x48')]['id'],function(_0x4cb7ef){try{_0x4cb7ef=_0x510c50[_0x6a7e('0x3c')](_0x4cb7ef);logger[_0x6a7e('0x32')](_0x6a7e('0x49'),JSON[_0x6a7e('0x34')](_0x4cb7ef,null,0x2));if(_0x4cb7ef&&_0x510c50[_0x4cb7ef['agicommand']]){_0x3b7678=_0x510c50[_0x4cb7ef[_0x6a7e('0x1f')]](_0x4cb7ef);if(_0x3b7678){logger['debug'](_0x6a7e('0x41'),getLogFromObject(_0x3b7678));return _[_0x6a7e('0x44')](_0x3b7678[_0x6a7e('0x42')])?null:_0x3b7678['result'][_0x6a7e('0x45')]();}else{logger['error'](_0x6a7e('0x41'),getLogFromObject(_0x3b7678));return null;}}else{logger['error'](_0x6a7e('0x46'));return null;}}catch(_0x22e4f7){logger[_0x6a7e('0xe')](_0x22e4f7[_0x6a7e('0xf')]);return null;}});}logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1d5bc1[_0x6a7e('0x17')],_0x1d5bc1[_0x6a7e('0x1c')],_0x1d5bc1[_0x6a7e('0x19')],_0x1d5bc1[_0x6a7e('0x18')],_0x1d5bc1['uniqueid']));logger['info'](util[_0x6a7e('0x11')](_0x6a7e('0x4a'),_0x1d5bc1[_0x6a7e('0x3e')],_0x1d5bc1[_0x6a7e('0x3f')],parseInt(_0x1d5bc1[_0x6a7e('0x40')],0xa)+0x1));_0x1d5bc1['continueAt'](_0x1d5bc1[_0x6a7e('0x3e')],_0x1d5bc1[_0x6a7e('0x3f')],parseInt(_0x1d5bc1[_0x6a7e('0x40')],0xa)+0x1);_0x1d5bc1[_0x6a7e('0x4b')]();}}else{logger['error'](util['format'](_0x6a7e('0x4c'),_0x1d5bc1[_0x6a7e('0x17')]));_0x1d5bc1['continueAt'](_0x1d5bc1[_0x6a7e('0x3e')],_0x1d5bc1[_0x6a7e('0x3f')],parseInt(_0x1d5bc1[_0x6a7e('0x40')],0xa)+0x1);_0x1d5bc1[_0x6a7e('0x4b')]();}}else{logger[_0x6a7e('0xe')](util[_0x6a7e('0x11')](_0x6a7e('0x4d'),_0x1d5bc1[_0x6a7e('0x17')]));_0x1d5bc1['continueAt'](_0x1d5bc1[_0x6a7e('0x3e')],_0x1d5bc1[_0x6a7e('0x3f')],parseInt(_0x1d5bc1[_0x6a7e('0x40')],0xa)+0x1);_0x1d5bc1[_0x6a7e('0x4b')]();}}function main(){var _0xb16534;return utilLicense['getLicense']()[_0x6a7e('0x2d')](function(_0xee25e0){if(_0xee25e0){if(_0xee25e0[_0x6a7e('0x4e')]){if(_0xee25e0[_0x6a7e('0x4f')]&&_0xee25e0[_0x6a7e('0x4f')]>0x0){logger['info'](util[_0x6a7e('0x11')](_0x6a7e('0x50'),_0xee25e0[_0x6a7e('0x4f')]));_0xb16534=_0xee25e0[_0x6a7e('0x4f')];}else{logger['info'](_0x6a7e('0x51'));}}else{logger[_0x6a7e('0x10')](_0x6a7e('0x52'));_0xb16534=-0x1;}}})[_0x6a7e('0x2e')](function(_0x3e2cb8){logger[_0x6a7e('0xe')]('[LICENSE]',_0x3e2cb8[_0x6a7e('0xf')]);})[_0x6a7e('0x48')](function(){var _0x25a4ff=require(_0x6a7e('0x53'))(config[_0x6a7e('0x6')]['port'],config[_0x6a7e('0x6')]['ip'],_0xb16534);_0x25a4ff['on'](_0x6a7e('0xe'),errorHandler);_0x25a4ff['on'](_0x6a7e('0x54'),listeningHandler);_0x25a4ff['on'](_0x6a7e('0x55'),connectionHandler);_0x25a4ff['on']('close',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 563cd67..8b63242 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(_0x5c367f,_0x4e77c9){var _0x3a1082=function(_0x561268){while(--_0x561268){_0x5c367f['push'](_0x5c367f['shift']());}};_0x3a1082(++_0x4e77c9);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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(_0x3f502b,_0x46989b){var _0x35692c=function(_0x5ed22b){while(--_0x5ed22b){_0x3f502b['push'](_0x3f502b['shift']());}};_0x35692c(++_0x46989b);}(_0x814b,0x1a2));var _0xb814=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x814b[_0x4b2436];return _0x4f5ab2;};'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 95f320a..f885539 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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x4d4616,_0x22ce69){var _0x897266=function(_0x1a49a9){while(--_0x1a49a9){_0x4d4616['push'](_0x4d4616['shift']());}};_0x897266(++_0x22ce69);}(_0x7a54,0x106));var _0x47a5=function(_0x468c39,_0x516528){_0x468c39=_0x468c39-0x0;var _0x2de8d9=_0x7a54[_0x468c39];return _0x2de8d9;};'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 +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(_0x4e128a,_0x3ad506){var _0x3829f6=function(_0x3cc48d){while(--_0x3cc48d){_0x4e128a['push'](_0x4e128a['shift']());}};_0x3829f6(++_0x3ad506);}(_0x5f2f,0x73));var _0xf5f2=function(_0x39e785,_0x253c17){_0x39e785=_0x39e785-0x0;var _0x397d69=_0x5f2f[_0x39e785];return _0x397d69;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 2a29b3c..5277e91 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 _0x04a3=['createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','agentLogin','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','then','error','message','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','ShowSquareProject','getVoiceQueueById','name','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','getSmsAccountById','ShowSmsAccount'];(function(_0x3e4bd5,_0x1191df){var _0x261d71=function(_0x9f1a84){while(--_0x9f1a84){_0x3e4bd5['push'](_0x3e4bd5['shift']());}};_0x261d71(++_0x1191df);}(_0x04a3,0x12f));var _0x304a=function(_0x36d1f3,_0x56a4e2){_0x36d1f3=_0x36d1f3-0x0;var _0x187ba2=_0x04a3[_0x36d1f3];return _0x187ba2;};'use strict';var BPromise=require(_0x304a('0x0'));var moment=require(_0x304a('0x1'));var _=require(_0x304a('0x2'));var util=require(_0x304a('0x3'));var jayson=require(_0x304a('0x4'));var client=jayson[_0x304a('0x5')][_0x304a('0x6')]({'port':0x2329});function request(_0x265249,_0x4a025a){return new BPromise(function(_0x43cffa,_0x1fb4dc){return client['request'](_0x265249,_0x4a025a)[_0x304a('0x7')](function(_0x326855){if(_0x326855[_0x304a('0x8')]){return _0x1fb4dc(_0x326855[_0x304a('0x8')][_0x304a('0x9')]);}else{return _0x43cffa(_0x326855['result']);}})['catch'](function(_0x150752){return _0x1fb4dc(_0x150752);});});}exports[_0x304a('0xa')]=function(_0x325fd9){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x325fd9},'attributes':[_0x304a('0xb')]}});};exports[_0x304a('0xc')]=function(_0x3ad91e){return request(_0x304a('0xd'),{'options':{'raw':![],'where':{'id':_0x3ad91e},'include':[{'model':_0x304a('0xe'),'as':_0x304a('0xf')}],'attributes':['id','name',_0x304a('0x10')]}});};exports['getSquareProjectById']=function(_0x136466){return request(_0x304a('0x11'),{'options':{'where':{'id':_0x136466},'attributes':['name']}});};exports[_0x304a('0x12')]=function(_0x56cf7c){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x56cf7c},'attributes':[_0x304a('0x13')]}});};exports[_0x304a('0x14')]=function(_0x54a7b0){return request(_0x304a('0x15'),{'options':{'where':{'id':_0x54a7b0},'attributes':[_0x304a('0x13')]}});};exports[_0x304a('0x16')]=function(_0x425801){return request(_0x304a('0x17'),{'options':{'where':{'id':_0x425801},'attributes':[_0x304a('0x18')]}});};exports[_0x304a('0x19')]=function(_0x2a50c7){return request('ShowUser',{'options':{'where':{'id':_0x2a50c7},'attributes':[_0x304a('0x13')]}});};exports['getTrunkById']=function(_0x152147){return request(_0x304a('0x1a'),{'options':{'where':{'id':_0x152147},'attributes':[_0x304a('0x13')]}});};exports[_0x304a('0x1b')]=function(_0x477ddc){return request(_0x304a('0x1c'),{'options':{'where':{'id':_0x477ddc},'attributes':[_0x304a('0x1d')]}});};exports[_0x304a('0x1e')]=function(_0x5e70c5){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5e70c5},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x304a('0x1f')]=function(_0x23d39e){return request(_0x304a('0x20'),{'options':{'where':{'id':_0x23d39e},'attributes':['id',_0x304a('0x13')]}});};exports[_0x304a('0x21')]=function(_0x551540){return request(_0x304a('0x22'),{'body':_0x551540});};exports[_0x304a('0x23')]=function(_0x397b90){return request(_0x304a('0x24'),{'body':_0x397b90});};exports[_0x304a('0x25')]=function(_0x185610){return request(_0x304a('0x26'),{'body':_['merge'](_0x185610,{'project_name':_0x185610[_0x304a('0x27')],'prev_project_name':_0x185610[_0x304a('0x28')]||'','is_subproject':_0x185610[_0x304a('0x28')]?!![]:![],'leaveAt':moment()[_0x304a('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x304a('0x2a')]=function(_0x2fb799){return request(_0x304a('0x2b'),{'body':_0x2fb799});};exports[_0x304a('0x2c')]=function(_0x4c8878){return request('CreateSquareMessage',{'body':_0x4c8878});};exports[_0x304a('0x2d')]=function(_0x2bcb32){return request(_0x304a('0x2e'),{'options':{'raw':![],'where':{'phone':_0x2bcb32[_0x304a('0x2f')],'ListId':_0x2bcb32['ListId']}}})[_0x304a('0x7')](function(_0x149f6b){if(_0x149f6b){return _0x149f6b;}return request(_0x304a('0x30'),{'body':_0x2bcb32});});};exports[_0x304a('0x31')]=function(_0x2f27bc){return request('ShowPause',{'options':{'where':{'id':_0x2f27bc},'attributes':[_0x304a('0x13')]}});};exports[_0x304a('0x32')]=function(_0xf8ef68,_0x544fa3){return request('LoginUser',{'body':{'interface':_0x544fa3},'options':{'where':_0xf8ef68}});};exports[_0x304a('0x33')]=function(_0x1cb9e2,_0x4d9916,_0x312293){return request('PauseUser',{'body':{'type':_0x4d9916,'uniqueid':_0x312293},'options':{'where':_0x1cb9e2}});};exports[_0x304a('0x34')]=function(_0x4c0079){return request(_0x304a('0x35'),{'body':{},'options':{'where':_0x4c0079}});};exports[_0x304a('0x36')]=function(_0x56d509){return request(_0x304a('0x37'),{'body':{},'options':{'where':_0x56d509}});}; \ No newline at end of file +var _0xe13a=['createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','phone','ListId','then','CreateCmContact','getPauseById','agentLogin','LoginUser','agentUnpause','LogoutUser','bluebird','lodash','util','jayson/promise','client','http','request','error','message','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getSoundById','ShowSound','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage'];(function(_0x10171b,_0x24dae6){var _0x3dba47=function(_0x2c164d){while(--_0x2c164d){_0x10171b['push'](_0x10171b['shift']());}};_0x3dba47(++_0x24dae6);}(_0xe13a,0x15f));var _0xae13=function(_0x4e2dbc,_0x52cc9e){_0x4e2dbc=_0x4e2dbc-0x0;var _0x404998=_0xe13a[_0x4e2dbc];return _0x404998;};'use strict';var BPromise=require(_0xae13('0x0'));var moment=require('moment');var _=require(_0xae13('0x1'));var util=require(_0xae13('0x2'));var jayson=require(_0xae13('0x3'));var client=jayson[_0xae13('0x4')][_0xae13('0x5')]({'port':0x2329});function request(_0x1ccbea,_0x50acb1){return new BPromise(function(_0x338ee2,_0xa191d1){return client[_0xae13('0x6')](_0x1ccbea,_0x50acb1)['then'](function(_0x54b435){if(_0x54b435[_0xae13('0x7')]){return _0xa191d1(_0x54b435[_0xae13('0x7')][_0xae13('0x8')]);}else{return _0x338ee2(_0x54b435['result']);}})[_0xae13('0x9')](function(_0x54e78e){return _0xa191d1(_0x54e78e);});});}exports[_0xae13('0xa')]=function(_0x3a1fdc){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x3a1fdc},'attributes':[_0xae13('0xb')]}});};exports[_0xae13('0xc')]=function(_0x53ef68){return request(_0xae13('0xd'),{'options':{'raw':![],'where':{'id':_0x53ef68},'include':[{'model':_0xae13('0xe'),'as':_0xae13('0xf')}],'attributes':['id',_0xae13('0x10'),_0xae13('0x11')]}});};exports['getSquareProjectById']=function(_0x16c806){return request(_0xae13('0x12'),{'options':{'where':{'id':_0x16c806},'attributes':[_0xae13('0x10')]}});};exports[_0xae13('0x13')]=function(_0x641521){return request(_0xae13('0x14'),{'options':{'where':{'id':_0x641521},'attributes':[_0xae13('0x10')]}});};exports['getVariableById']=function(_0x4bcdab){return request(_0xae13('0x15'),{'options':{'where':{'id':_0x4bcdab},'attributes':['name']}});};exports[_0xae13('0x16')]=function(_0x452e2d){return request(_0xae13('0x17'),{'options':{'where':{'id':_0x452e2d},'attributes':[_0xae13('0x18')]}});};exports['getUserById']=function(_0x54e51e){return request(_0xae13('0x19'),{'options':{'where':{'id':_0x54e51e},'attributes':[_0xae13('0x10')]}});};exports['getTrunkById']=function(_0x2c258d){return request('ShowTrunk',{'options':{'where':{'id':_0x2c258d},'attributes':['name']}});};exports[_0xae13('0x1a')]=function(_0x451bbd){return request(_0xae13('0x1b'),{'options':{'where':{'id':_0x451bbd},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x1b9698){return request(_0xae13('0x1c'),{'options':{'raw':![],'where':{'id':_0x1b9698},'include':[{'model':_0xae13('0x1d'),'as':_0xae13('0x1e')}]}});};exports['getSmsAccountById']=function(_0x379134){return request(_0xae13('0x1f'),{'options':{'where':{'id':_0x379134},'attributes':['id',_0xae13('0x10')]}});};exports[_0xae13('0x20')]=function(_0x1e87a8){return request(_0xae13('0x21'),{'body':_0x1e87a8});};exports[_0xae13('0x22')]=function(_0xe787a1){return request(_0xae13('0x23'),{'body':_0xe787a1});};exports[_0xae13('0x24')]=function(_0x1b0e08){return request(_0xae13('0x25'),{'body':_[_0xae13('0x26')](_0x1b0e08,{'project_name':_0x1b0e08[_0xae13('0x27')],'prev_project_name':_0x1b0e08['arg_2']||'','is_subproject':_0x1b0e08[_0xae13('0x28')]?!![]:![],'leaveAt':moment()[_0xae13('0x29')](_0xae13('0x2a'))})});};exports[_0xae13('0x2b')]=function(_0x19ab0c){return request(_0xae13('0x2c'),{'body':_0x19ab0c});};exports[_0xae13('0x2d')]=function(_0x1d782e){return request('CreateSquareMessage',{'body':_0x1d782e});};exports['createCmContact']=function(_0x53e673){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x53e673[_0xae13('0x2e')],'ListId':_0x53e673[_0xae13('0x2f')]}}})[_0xae13('0x30')](function(_0x25d29a){if(_0x25d29a){return _0x25d29a;}return request(_0xae13('0x31'),{'body':_0x53e673});});};exports[_0xae13('0x32')]=function(_0x11a5db){return request('ShowPause',{'options':{'where':{'id':_0x11a5db},'attributes':[_0xae13('0x10')]}});};exports[_0xae13('0x33')]=function(_0x30e9f7,_0x2ec90b){return request(_0xae13('0x34'),{'body':{'interface':_0x2ec90b},'options':{'where':_0x30e9f7}});};exports['agentPause']=function(_0x5cd5cb,_0x44be7c,_0x7628ac){return request('PauseUser',{'body':{'type':_0x44be7c,'uniqueid':_0x7628ac},'options':{'where':_0x5cd5cb}});};exports[_0xae13('0x35')]=function(_0x38e4d1){return request('UnpauseUser',{'body':{},'options':{'where':_0x38e4d1}});};exports['agentLogout']=function(_0x2c12d0){return request(_0xae13('0x36'),{'body':{},'options':{'where':_0x2c12d0}});}; \ 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 7a83fb3..9f47d26 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 _0xc3d3=['./lex','exports'];(function(_0x5a4e52,_0x2430fb){var _0x804743=function(_0x23b6d3){while(--_0x23b6d3){_0x5a4e52['push'](_0x5a4e52['shift']());}};_0x804743(++_0x2430fb);}(_0xc3d3,0x18e));var _0x3c3d=function(_0x193dc8,_0x10ed99){_0x193dc8=_0x193dc8-0x0;var _0x2c2d8b=_0xc3d3[_0x193dc8];return _0x2c2d8b;};var polly=require('./polly');var lex=require(_0x3c3d('0x0'));module[_0x3c3d('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x207a=['./lex','exports','./polly'];(function(_0x3b0a71,_0x241df3){var _0x2312de=function(_0x1d9b59){while(--_0x1d9b59){_0x3b0a71['push'](_0x3b0a71['shift']());}};_0x2312de(++_0x241df3);}(_0x207a,0x1cd));var _0xa207=function(_0xcb0ee7,_0x240a3f){_0xcb0ee7=_0xcb0ee7-0x0;var _0x1a5966=_0x207a[_0xcb0ee7];return _0x1a5966;};var polly=require(_0xa207('0x0'));var lex=require(_0xa207('0x1'));module[_0xa207('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index d55cf5b..9c4ae52 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 _0xf0ba=['exports','./lib/api'];(function(_0x1c13c8,_0x414c6b){var _0x3f01bb=function(_0xfc9211){while(--_0xfc9211){_0x1c13c8['push'](_0x1c13c8['shift']());}};_0x3f01bb(++_0x414c6b);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var lex=require(_0xaf0b('0x0'));module[_0xaf0b('0x1')]=function(_0x1caf8c,_0x38cf45,_0xea88b2,_0x555620,_0x277920,_0xce0364){return lex(_0x1caf8c,_0x38cf45,_0xea88b2,_0x555620,_0x277920,_0xce0364);}; \ No newline at end of file +var _0xc9c3=['exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x4464ac,_0x5549ae){_0x4464ac=_0x4464ac-0x0;var _0x356e9f=_0xc9c3[_0x4464ac];return _0x356e9f;};'use strict';var lex=require('./lib/api');module[_0x3c9c('0x0')]=function(_0x362cef,_0x772a1a,_0x51a13c,_0x4a1db1,_0x2ca714,_0x11d161){return lex(_0x362cef,_0x772a1a,_0x51a13c,_0x4a1db1,_0x2ca714,_0x11d161);}; \ 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 e908ea4..954b75b 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 _0x67c8=['slots','slot_','exports','LexRuntime','$LATEST','bluebird','postText'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x67c8,0x1d3));var _0x867c=function(_0x1113d4,_0x342c3c){_0x1113d4=_0x1113d4-0x0;var _0xc93aed=_0x67c8[_0x1113d4];return _0xc93aed;};'use strict';var BPromise=require(_0x867c('0x0'));var AWS=require('aws-sdk');function lexResult(_0x4aabf1,_0x754b54){return new BPromise(function(_0x5bd3c4,_0x271c4d){_0x4aabf1[_0x867c('0x1')](_0x754b54,function(_0x5e8238,_0x14c1ce){if(_0x5e8238){_0x271c4d(_0x5e8238);}if(_0x14c1ce['slots']){for(const _0xe60a37 in _0x14c1ce['slots']){if(_0x14c1ce[_0x867c('0x2')]['hasOwnProperty'](_0xe60a37)){var _0x4c884d=_0x14c1ce[_0x867c('0x2')][_0xe60a37];_0x14c1ce[_0x867c('0x3')+_0xe60a37]=_0x4c884d;}}}_0x5bd3c4(_0x14c1ce);});});}module[_0x867c('0x4')]=function(_0x21dd1b,_0x58b834,_0x45cc3f,_0x3cda4e,_0x45618e,_0x4e1ae2){var _0x2422a1=new AWS[(_0x867c('0x5'))]({'accessKeyId':_0x58b834,'secretAccessKey':_0x45cc3f,'region':_0x3cda4e});var _0x1ba3a1={'botAlias':_0x867c('0x6'),'botName':_0x4e1ae2,'inputText':_0x45618e,'userId':_0x21dd1b};return lexResult(_0x2422a1,_0x1ba3a1);}; \ No newline at end of file +var _0x5c6c=['slot_','exports','LexRuntime','$LATEST','bluebird','slots','hasOwnProperty'];(function(_0xdf6837,_0x440887){var _0x254cfa=function(_0x3bcbc2){while(--_0x3bcbc2){_0xdf6837['push'](_0xdf6837['shift']());}};_0x254cfa(++_0x440887);}(_0x5c6c,0x97));var _0xc5c6=function(_0x12077e,_0x2a5a00){_0x12077e=_0x12077e-0x0;var _0x118188=_0x5c6c[_0x12077e];return _0x118188;};'use strict';var BPromise=require(_0xc5c6('0x0'));var AWS=require('aws-sdk');function lexResult(_0x525278,_0x27fdc8){return new BPromise(function(_0x2a93ba,_0x521f08){_0x525278['postText'](_0x27fdc8,function(_0x326a06,_0x82fd83){if(_0x326a06){_0x521f08(_0x326a06);}if(_0x82fd83['slots']){for(const _0x1b3cdd in _0x82fd83[_0xc5c6('0x1')]){if(_0x82fd83[_0xc5c6('0x1')][_0xc5c6('0x2')](_0x1b3cdd)){var _0x29b19b=_0x82fd83[_0xc5c6('0x1')][_0x1b3cdd];_0x82fd83[_0xc5c6('0x3')+_0x1b3cdd]=_0x29b19b;}}}_0x2a93ba(_0x82fd83);});});}module[_0xc5c6('0x4')]=function(_0x3c3b80,_0x2ce4f5,_0x372d15,_0x37c5eb,_0x2702b5,_0x146b02){var _0x49e5de=new AWS[(_0xc5c6('0x5'))]({'accessKeyId':_0x2ce4f5,'secretAccessKey':_0x372d15,'region':_0x37c5eb});var _0x27cd1e={'botAlias':_0xc5c6('0x6'),'botName':_0x146b02,'inputText':_0x2702b5,'userId':_0x3c3b80};return lexResult(_0x49e5de,_0x27cd1e);}; \ 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 27ec8a6..09ee327 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 _0x3e9e=['exports','./lib/api'];(function(_0x146c59,_0x3892bc){var _0x231b8b=function(_0x40d8a0){while(--_0x40d8a0){_0x146c59['push'](_0x146c59['shift']());}};_0x231b8b(++_0x3892bc);}(_0x3e9e,0xcf));var _0xe3e9=function(_0x226194,_0x2a77ce){_0x226194=_0x226194-0x0;var _0x4cb12e=_0x3e9e[_0x226194];return _0x4cb12e;};'use strict';var polly=require(_0xe3e9('0x0'));module[_0xe3e9('0x1')]=function(_0x25aacc,_0x359a0b,_0x1b0887,_0xff5440,_0x550d0c,_0x3b9a18,_0x40ffa0){return polly(_0x25aacc,_0x359a0b,_0x1b0887,_0xff5440,_0x550d0c,_0x3b9a18,_0x40ffa0);}; \ No newline at end of file +var _0xe1e2=['./lib/api','exports'];(function(_0x559e51,_0x2836f7){var _0x3d228c=function(_0x1f2a44){while(--_0x1f2a44){_0x559e51['push'](_0x559e51['shift']());}};_0x3d228c(++_0x2836f7);}(_0xe1e2,0x8a));var _0x2e1e=function(_0x4ba811,_0x4428f2){_0x4ba811=_0x4ba811-0x0;var _0x3b616f=_0xe1e2[_0x4ba811];return _0x3b616f;};'use strict';var polly=require(_0x2e1e('0x0'));module[_0x2e1e('0x1')]=function(_0x169d2e,_0x1e45c1,_0x14447e,_0x507426,_0x180991,_0x4f5ed1,_0x23cef2){return polly(_0x169d2e,_0x1e45c1,_0x14447e,_0x507426,_0x180991,_0x4f5ed1,_0x23cef2);}; \ 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 ce0621b..5f1b502 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 _0x1a0b=['Polly','mp3','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x4b82ef,_0x25f3d6){var _0xa7937f=function(_0x3c6782){while(--_0x3c6782){_0x4b82ef['push'](_0x4b82ef['shift']());}};_0xa7937f(++_0x25f3d6);}(_0x1a0b,0xf5));var _0xb1a0=function(_0x19b291,_0x56f8e2){_0x19b291=_0x19b291-0x0;var _0x44a843=_0x1a0b[_0x19b291];return _0x44a843;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xb1a0('0x0'));var rs=require('randomstring');var AWS=require(_0xb1a0('0x1'));function pollyResult(_0x39e8d0,_0x448fb0,_0x5cfbfe){return new BPromise(function(_0x26de3b,_0x2b9551){_0x39e8d0[_0xb1a0('0x2')](_0x448fb0,function(_0x6ff075,_0x141d13){if(_0x6ff075){_0x2b9551(_0x6ff075);}else if(_0x141d13){if(_0x141d13[_0xb1a0('0x3')]instanceof Buffer){fs[_0xb1a0('0x4')](_0x5cfbfe,_0x141d13['AudioStream'],function(_0x5df897){if(_0x5df897){_0x2b9551(_0x5df897);}else{_0x26de3b();}});}else{_0x2b9551(new Error(_0xb1a0('0x5')));}}else{_0x2b9551(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xb1a0('0x6')]=function(_0x1bb4ce,_0x28af6b,_0x28f274,_0x179bd7,_0x4e7d0e,_0x3b4516,_0x939ca0){var _0x5248db=new AWS[(_0xb1a0('0x7'))]({'accessKeyId':_0x1bb4ce,'secretAccessKey':_0x28af6b,'region':_0x28f274});var _0x1a0b98={'Text':_0x4e7d0e,'TextType':_0x3b4516||'text','OutputFormat':_0xb1a0('0x8'),'VoiceId':_0x179bd7};return pollyResult(_0x5248db,_0x1a0b98,_0x939ca0);}; \ No newline at end of file +var _0xacb7=['aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring'];(function(_0x493cf4,_0x59fc21){var _0x2ce32c=function(_0x2e9181){while(--_0x2e9181){_0x493cf4['push'](_0x493cf4['shift']());}};_0x2ce32c(++_0x59fc21);}(_0xacb7,0xc3));var _0x7acb=function(_0x2961d4,_0x3e1e65){_0x2961d4=_0x2961d4-0x0;var _0x59951b=_0xacb7[_0x2961d4];return _0x59951b;};'use strict';var fs=require('fs');var path=require(_0x7acb('0x0'));var BPromise=require(_0x7acb('0x1'));var rs=require(_0x7acb('0x2'));var AWS=require(_0x7acb('0x3'));function pollyResult(_0x37a51d,_0x3e7497,_0x3022f5){return new BPromise(function(_0x180e90,_0x351fed){_0x37a51d[_0x7acb('0x4')](_0x3e7497,function(_0x54df20,_0x3ac2bd){if(_0x54df20){_0x351fed(_0x54df20);}else if(_0x3ac2bd){if(_0x3ac2bd[_0x7acb('0x5')]instanceof Buffer){fs['writeFile'](_0x3022f5,_0x3ac2bd[_0x7acb('0x5')],function(_0x41201a){if(_0x41201a){_0x351fed(_0x41201a);}else{_0x180e90();}});}else{_0x351fed(new Error(_0x7acb('0x6')));}}else{_0x351fed(new Error(_0x7acb('0x7')));}});});}module[_0x7acb('0x8')]=function(_0x41611c,_0x4d386e,_0x43318f,_0x20cdfe,_0x186563,_0x59c841,_0x16347e){var _0x4082ec=new AWS[(_0x7acb('0x9'))]({'accessKeyId':_0x41611c,'secretAccessKey':_0x4d386e,'region':_0x43318f});var _0x3111a9={'Text':_0x186563,'TextType':_0x59c841||_0x7acb('0xa'),'OutputFormat':'mp3','VoiceId':_0x20cdfe};return pollyResult(_0x4082ec,_0x3111a9,_0x16347e);}; \ 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 8b13688..deaeea3 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 _0xb13f=['./lib/api','exports'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xb13f,0x1de));var _0xfb13=function(_0x534cc9,_0x2638fe){_0x534cc9=_0x534cc9-0x0;var _0xdbcd2f=_0xb13f[_0x534cc9];return _0xdbcd2f;};'use strict';var asr=require(_0xfb13('0x0'));module[_0xfb13('0x1')]=function(_0x5bc7df,_0x9b9958,_0x52a908,_0x3c3f15){return asr(_0x5bc7df,_0x9b9958,_0x52a908);}; \ No newline at end of file +var _0x7e1a=['exports','./lib/api'];(function(_0x1dfed7,_0x16ba1f){var _0x145cd2=function(_0x5d04ff){while(--_0x5d04ff){_0x1dfed7['push'](_0x1dfed7['shift']());}};_0x145cd2(++_0x16ba1f);}(_0x7e1a,0x1c5));var _0xa7e1=function(_0x36671c,_0x39bc4c){_0x36671c=_0x36671c-0x0;var _0x517fa1=_0x7e1a[_0x36671c];return _0x517fa1;};'use strict';var asr=require(_0xa7e1('0x0'));module[_0xa7e1('0x1')]=function(_0x223fe4,_0xc277f7,_0x44e5bb,_0x2fdf4f){return asr(_0x223fe4,_0xc277f7,_0x44e5bb);}; \ 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 d58bee6..98b2911 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 _0x3672=['LINEAR16','8000','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key='];(function(_0x3d30aa,_0x2861b2){var _0x3f1b19=function(_0x1fb5b0){while(--_0x1fb5b0){_0x3d30aa['push'](_0x3d30aa['shift']());}};_0x3f1b19(++_0x2861b2);}(_0x3672,0x128));var _0x2367=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x3672[_0x533110];return _0xc3c866;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x2367('0x0');module[_0x2367('0x1')]=function(_0x27f6bb,_0x2a2ddb,_0x29b29b){return new BPromise(function(_0x121e7f,_0x61d327){var _0x58c6ba;if(typeof _0x27f6bb!==_0x2367('0x2')||_0x27f6bb[_0x2367('0x3')]===0x0){return _0x61d327('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x2a2ddb!=='string'||_0x2a2ddb['length']===0x0){return _0x61d327(_0x2367('0x4'));}if(typeof _0x29b29b!==_0x2367('0x5')&&(typeof _0x29b29b!==_0x2367('0x2')||_0x29b29b['length']===0x0)){return _0x61d327(_0x2367('0x6'));}try{_0x58c6ba=fs[_0x2367('0x7')](_0x27f6bb)[_0x2367('0x8')](_0x2367('0x9'));}catch(_0x1935f0){return _0x61d327(_0x1935f0);}return _0x121e7f({'method':_0x2367('0xa'),'uri':host+_0x2367('0xb')+_0x2a2ddb,'body':{'config':{'encoding':_0x2367('0xc'),'sampleRateHertz':_0x2367('0xd'),'languageCode':_0x29b29b},'audio':{'content':_0x58c6ba}},'json':!![]});});}; \ No newline at end of file +var _0x1f9d=['length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string'];(function(_0x245efb,_0x2c636b){var _0x59ee7b=function(_0x3953f8){while(--_0x3953f8){_0x245efb['push'](_0x245efb['shift']());}};_0x59ee7b(++_0x2c636b);}(_0x1f9d,0xfa));var _0xd1f9=function(_0x1c979b,_0x3e246d){_0x1c979b=_0x1c979b-0x0;var _0x142b09=_0x1f9d[_0x1c979b];return _0x142b09;};'use strict';var url=require(_0xd1f9('0x0'));var BPromise=require(_0xd1f9('0x1'));var fs=require('fs');var host=_0xd1f9('0x2');module[_0xd1f9('0x3')]=function(_0x568564,_0xe0a20c,_0x423b2f){return new BPromise(function(_0x16ea0,_0x30c851){var _0xd0c97c;if(typeof _0x568564!==_0xd1f9('0x4')||_0x568564['length']===0x0){return _0x30c851(_0xd1f9('0x5'));}if(typeof _0xe0a20c!==_0xd1f9('0x4')||_0xe0a20c[_0xd1f9('0x6')]===0x0){return _0x30c851(_0xd1f9('0x7'));}if(typeof _0x423b2f!==_0xd1f9('0x8')&&(typeof _0x423b2f!==_0xd1f9('0x4')||_0x423b2f[_0xd1f9('0x6')]===0x0)){return _0x30c851(_0xd1f9('0x9'));}try{_0xd0c97c=fs[_0xd1f9('0xa')](_0x568564)[_0xd1f9('0xb')](_0xd1f9('0xc'));}catch(_0x578d4d){return _0x30c851(_0x578d4d);}return _0x16ea0({'method':_0xd1f9('0xd'),'uri':host+'/v1/speech:recognize?key='+_0xe0a20c,'body':{'config':{'encoding':_0xd1f9('0xe'),'sampleRateHertz':_0xd1f9('0xf'),'languageCode':_0x423b2f},'audio':{'content':_0xd0c97c}},'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 e7ed31d..10cb4be 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 _0x008c=['./asr','exports'];(function(_0x33f404,_0x344c7f){var _0x5c9437=function(_0xe33ec){while(--_0xe33ec){_0x33f404['push'](_0x33f404['shift']());}};_0x5c9437(++_0x344c7f);}(_0x008c,0x188));var _0xc008=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x008c[_0x286726];return _0xcd4fe9;};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/scripts/index.js b/server/services/agi/scripts/index.js index baa586d..5030efa 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 _0xa9e0=['text','channelData','CustomAction','AudioFromTts','Data','dirName','path','http','https','bluebird','sox','request-promise','util','querystring','moment','apiai-promise','md5','./google','./sestek','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','freeform=3','parse','sestekNDA','nda'];(function(_0x2b0486,_0x2d6589){var _0x5ba6d1=function(_0x341548){while(--_0x341548){_0x2b0486['push'](_0x2b0486['shift']());}};_0x5ba6d1(++_0x2d6589);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var fs=require('fs');var path=require(_0x0a9e('0x0'));var http=require(_0x0a9e('0x1'));var https=require(_0x0a9e('0x2'));var urlParse=require('url')['parse'];var BPromise=require(_0x0a9e('0x3'));var rs=require('randomstring');var sox=require(_0x0a9e('0x4'));var rp=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var querystring=require(_0x0a9e('0x7'));var moment=require(_0x0a9e('0x8'));var tts=require('google-tts-api');var apiai=require(_0x0a9e('0x9'));var md5=require(_0x0a9e('0xa'));var google=require(_0x0a9e('0xb'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x0a9e('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x0a9e('0xd');function downloadFile(_0xf81284,_0x307b3e){return new BPromise(function(_0x3ab53f,_0xfeb75b){var _0xbd1168=urlParse(_0xf81284);var _0x4a4c56=_0xbd1168['protocol']==='https:'?https:http;var _0x4cfe67={'host':_0xbd1168[_0x0a9e('0xe')],'path':_0xbd1168[_0x0a9e('0x0')],'headers':{'user-agent':_0x0a9e('0xf')}};_0x4a4c56[_0x0a9e('0x10')](_0x4cfe67,function(_0x32d742){if(_0x32d742[_0x0a9e('0x11')]!==0xc8){logger['error'](_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742[_0x0a9e('0x11')]+'\x20('+_0x32d742[_0x0a9e('0x14')]+')');_0xfeb75b(new Error(_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742['statusCode']+'\x20('+_0x32d742[_0x0a9e('0x14')]+')'));return;}var _0x5d0880=fs[_0x0a9e('0x15')](_0x307b3e);_0x5d0880['on']('finish',function(){logger[_0x0a9e('0x16')](_0x0a9e('0x17'));_0x5d0880['close'](_0x3ab53f);});_0x5d0880['on'](_0x0a9e('0x18'),function(_0x5a0a06){fs[_0x0a9e('0x19')](_0x307b3e);logger[_0x0a9e('0x18')](_0x0a9e('0x1a'),_0x5a0a06);_0xfeb75b(_0x5a0a06);});_0x32d742[_0x0a9e('0x1b')](_0x5d0880);})['on'](_0x0a9e('0x18'),function(_0x2eb11f){logger[_0x0a9e('0x18')](_0x2eb11f);_0xfeb75b(_0x2eb11f);})[_0x0a9e('0x1c')]();});}function uploadFile(_0x1314ae){return new BPromise(function(_0x112016,_0x1c696a){var _0x105080=urlParse(_0x1314ae);var _0x4bb1e3=_0x105080[_0x0a9e('0x1d')]===_0x0a9e('0x1e')?https:http;var _0x53682f={'host':_0x105080[_0x0a9e('0xe')],'path':_0x105080['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4bb1e3[_0x0a9e('0x10')](_0x53682f,function(_0x432e56){if(_0x432e56[_0x0a9e('0x11')]!==0xc8){_0x1c696a(new Error(_0x0a9e('0x12')+_0x1314ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x432e56[_0x0a9e('0x11')]+'\x20('+_0x432e56[_0x0a9e('0x14')]+')'));return;}var _0x3b45bc='';_0x432e56['on'](_0x0a9e('0x1f'),function(_0x370d86){_0x3b45bc+=_0x370d86;});_0x432e56['on'](_0x0a9e('0x1c'),function(){_0x112016(_0x3b45bc);});})['on'](_0x0a9e('0x18'),function(_0x5ea472){_0x1c696a(_0x5ea472);})['end']();});}function convertFile(_0x197ec0,_0x3a8e58){return new BPromise(function(_0x40c424,_0x33161b){var _0x526cf3=sox[_0x0a9e('0x20')](_0x197ec0,_0x3a8e58,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x526cf3['on'](_0x0a9e('0x18'),function(_0x5bfb33){logger[_0x0a9e('0x18')](_0x0a9e('0x21'),_0x5bfb33);_0x33161b(_0x5bfb33);});_0x526cf3['on'](_0x0a9e('0x1c'),function(){logger[_0x0a9e('0x16')](_0x0a9e('0x22'));_0x40c424();});_0x526cf3[_0x0a9e('0x23')]();});}function base64Decode(_0x11c3b6,_0x14de77){var _0x5a101a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));fs['writeFileSync'](_0x5a101a,_0x11c3b6,_0x0a9e('0x28'));return convertFile(_0x5a101a,_0x14de77)[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x5a101a);fs[_0x0a9e('0x2a')](_0x14de77,_0x0a9e('0x2b'));}catch(_0x563b45){logger[_0x0a9e('0x18')](_0x563b45);}return _0x14de77[_0x0a9e('0x2c')]('.')[0x0];});}function base64Encode(_0x1dbde2){var _0x540530=fs[_0x0a9e('0x2d')](_0x1dbde2);return new Buffer(_0x540530)['toString'](_0x0a9e('0x28'));}exports[_0x0a9e('0x2e')]=function(_0x1122db,_0x33bdb7){var _0x25ce3a,_0x5180f1;return tts(_0x1122db,_0x33bdb7||'en',0x1)[_0x0a9e('0x29')](function(_0x46f0a5){logger[_0x0a9e('0x16')](_0x46f0a5);_0x25ce3a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));return downloadFile(_0x46f0a5,_0x25ce3a);})[_0x0a9e('0x29')](function(){_0x5180f1=path['resolve'](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27'));return convertFile(_0x25ce3a,_0x5180f1);})[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x25ce3a);fs[_0x0a9e('0x2a')](_0x5180f1,'777');}catch(_0x191e91){logger[_0x0a9e('0x18')](_0x191e91);}logger[_0x0a9e('0x16')](_0x0a9e('0x30'),_0x5180f1['split']('.')[0x0]);return _0x5180f1['split']('.')[0x0];});};exports[_0x0a9e('0x31')]=function(_0x5640eb,_0x24936a,_0x3d9717){return google[_0x0a9e('0x32')](_0x5640eb,_0x24936a,_0x3d9717)[_0x0a9e('0x29')](function(_0x4f41ae){logger[_0x0a9e('0x16')](_0x4f41ae[_0x0a9e('0x33')]);return rp(_0x4f41ae);})[_0x0a9e('0x29')](function(_0x533942){var _0x1dbf74='';var _0x1a180b=0x0;try{fs[_0x0a9e('0x19')](_0x5640eb);}catch(_0x4c1c0e){logger['error'](_0x4c1c0e);}if(_0x533942&&_0x533942[_0x0a9e('0x34')]){_0x1dbf74=_0x533942[_0x0a9e('0x34')]['map'](function(_0x2b814e){return _0x2b814e&&_0x2b814e[_0x0a9e('0x35')][0x0]&&_0x2b814e[_0x0a9e('0x35')][0x0][_0x0a9e('0x36')]?_0x2b814e['alternatives'][0x0]['transcript']:'';})[_0x0a9e('0x37')]('\x0a');_0x1a180b=_0x533942[_0x0a9e('0x34')]['map'](function(_0x183991){return _0x183991&&_0x183991[_0x0a9e('0x35')][0x0]&&_0x183991[_0x0a9e('0x35')][0x0]['confidence']?_0x183991[_0x0a9e('0x35')][0x0][_0x0a9e('0x38')]:0x0;})[_0x0a9e('0x37')]('\x0a');}logger[_0x0a9e('0x16')](_0x0a9e('0x39'),_0x1dbf74);logger[_0x0a9e('0x16')](_0x0a9e('0x3a'),_0x1a180b);return{'transcript':_0x1dbf74,'confidence':_0x1a180b};})[_0x0a9e('0x3b')](function(_0x23b089){logger[_0x0a9e('0x18')](_0x0a9e('0x3c'),_0x23b089[_0x0a9e('0x11')],_0x23b089[_0x0a9e('0x3d')],_0x23b089[_0x0a9e('0x3e')]);});};exports[_0x0a9e('0x3f')]=function(_0x4d04c8,_0x52628e,_0x473fdc,_0xb3795a){var _0x405c8f=apiai(_0x52628e,{'language':_0xb3795a||'en'});return _0x405c8f[_0x0a9e('0x40')](_0x473fdc,{'sessionId':md5(_0x4d04c8)})[_0x0a9e('0x29')](function(_0xc9a702){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0xc9a702));return{'source':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x43')],'resolvedQuery':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x44')],'action':_0xc9a702['result'][_0x0a9e('0x45')],'actionIncomplete':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x46')],'speech':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x47')][_0x0a9e('0x48')],'score':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x49')],'statusCode':_0xc9a702['status'][_0x0a9e('0x4a')],'endConversation':_0xc9a702['result'][_0x0a9e('0x4b')][_0x0a9e('0x4c')]||![],'isFallbackIntent':_0xc9a702[_0x0a9e('0x42')]['metadata'][_0x0a9e('0x4d')]};});};exports[_0x0a9e('0x4e')]=function(_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73){return tilde[_0x0a9e('0x32')](_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73)['then'](function(_0x13f44d){try{fs[_0x0a9e('0x19')](_0x4774f4);}catch(_0x1b5e80){logger[_0x0a9e('0x18')](_0x1b5e80);}logger[_0x0a9e('0x16')](_0x0a9e('0x4f'),_0x13f44d[_0x0a9e('0x36')]);logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x13f44d['confidence']);return _0x13f44d;});};exports[_0x0a9e('0x51')]=function(_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3){var _0x37edaa=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x375c18;return aws['polly'](_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3,_0x37edaa)['then'](function(){_0x375c18=path['resolve'](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x37edaa,_0x375c18);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x37edaa);fs[_0x0a9e('0x2a')](_0x375c18,'777');}catch(_0x5a88da){logger[_0x0a9e('0x18')](_0x5a88da);}return _0x375c18['split']('.')[0x0];});};exports[_0x0a9e('0x52')]=function(_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return aws[_0x0a9e('0x53')](_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da)['then'](function(_0x50f687){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0x50f687));return _0x50f687;});};exports['ispeechTTS']=function(_0x145931,_0x5ce9ac,_0x211ef9,_0x523cd2){var _0xe22ccc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x145931,encodeURIComponent(_0x5ce9ac),_0x211ef9,_0x523cd2);var _0x5df0ad=path[_0x0a9e('0x24')](__dirname,'tmp',rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x3cfd00;return downloadFile(_0xe22ccc,_0x5df0ad)[_0x0a9e('0x29')](function(){_0x3cfd00=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x5df0ad,_0x3cfd00);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x5df0ad);fs[_0x0a9e('0x2a')](_0x3cfd00,_0x0a9e('0x2b'));}catch(_0x30c491){logger[_0x0a9e('0x18')](_0x30c491);}return _0x3cfd00[_0x0a9e('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x956fbe,_0x26bc80,_0x5239ef,_0x3649cc){var _0x5cc8fb=util[_0x0a9e('0x54')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x26bc80,_0x5239ef,base64Encode(_0x956fbe),_0x3649cc?util['format']('model=%s',encodeURIComponent(_0x3649cc)):_0x0a9e('0x55'));return uploadFile(_0x5cc8fb)['then'](function(_0x2244d6){return querystring[_0x0a9e('0x56')](_0x2244d6);});};exports[_0x0a9e('0x57')]=function(_0x7be420,_0x1cca9f){return sestek[_0x0a9e('0x58')](_0x7be420,_0x1cca9f)['then'](function(_0x1627a7){logger['info'](JSON[_0x0a9e('0x41')](_0x1627a7));var _0x1f07cb={'speech':_0x1627a7[_0x0a9e('0x59')],'action':_0x1627a7['channelData']?_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5b')]:undefined,'actiondata':_0x1627a7[_0x0a9e('0x5a')]?_0x1627a7[_0x0a9e('0x5a')]['CustomActionData']:undefined};if(_0x1627a7[_0x0a9e('0x5a')]&&_0x1627a7[_0x0a9e('0x5a')]['AudioFromTts']){return base64Decode(_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5c')][_0x0a9e('0x5d')],path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27')))[_0x0a9e('0x29')](function(_0x281c7d){_0x1f07cb['audiofile']=_0x281c7d;return _0x1f07cb;});}return _0x1f07cb;});};exports[_0x0a9e('0x5e')]=function(){return __dirname;}; \ No newline at end of file +var _0xa9e0=['text','channelData','CustomAction','AudioFromTts','Data','dirName','path','http','https','bluebird','sox','request-promise','util','querystring','moment','apiai-promise','md5','./google','./sestek','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','freeform=3','parse','sestekNDA','nda'];(function(_0x52dbfa,_0x50c2fd){var _0x3d237d=function(_0x3b08cb){while(--_0x3b08cb){_0x52dbfa['push'](_0x52dbfa['shift']());}};_0x3d237d(++_0x50c2fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var fs=require('fs');var path=require(_0x0a9e('0x0'));var http=require(_0x0a9e('0x1'));var https=require(_0x0a9e('0x2'));var urlParse=require('url')['parse'];var BPromise=require(_0x0a9e('0x3'));var rs=require('randomstring');var sox=require(_0x0a9e('0x4'));var rp=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var querystring=require(_0x0a9e('0x7'));var moment=require(_0x0a9e('0x8'));var tts=require('google-tts-api');var apiai=require(_0x0a9e('0x9'));var md5=require(_0x0a9e('0xa'));var google=require(_0x0a9e('0xb'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x0a9e('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x0a9e('0xd');function downloadFile(_0xf81284,_0x307b3e){return new BPromise(function(_0x3ab53f,_0xfeb75b){var _0xbd1168=urlParse(_0xf81284);var _0x4a4c56=_0xbd1168['protocol']==='https:'?https:http;var _0x4cfe67={'host':_0xbd1168[_0x0a9e('0xe')],'path':_0xbd1168[_0x0a9e('0x0')],'headers':{'user-agent':_0x0a9e('0xf')}};_0x4a4c56[_0x0a9e('0x10')](_0x4cfe67,function(_0x32d742){if(_0x32d742[_0x0a9e('0x11')]!==0xc8){logger['error'](_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742[_0x0a9e('0x11')]+'\x20('+_0x32d742[_0x0a9e('0x14')]+')');_0xfeb75b(new Error(_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742['statusCode']+'\x20('+_0x32d742[_0x0a9e('0x14')]+')'));return;}var _0x5d0880=fs[_0x0a9e('0x15')](_0x307b3e);_0x5d0880['on']('finish',function(){logger[_0x0a9e('0x16')](_0x0a9e('0x17'));_0x5d0880['close'](_0x3ab53f);});_0x5d0880['on'](_0x0a9e('0x18'),function(_0x5a0a06){fs[_0x0a9e('0x19')](_0x307b3e);logger[_0x0a9e('0x18')](_0x0a9e('0x1a'),_0x5a0a06);_0xfeb75b(_0x5a0a06);});_0x32d742[_0x0a9e('0x1b')](_0x5d0880);})['on'](_0x0a9e('0x18'),function(_0x2eb11f){logger[_0x0a9e('0x18')](_0x2eb11f);_0xfeb75b(_0x2eb11f);})[_0x0a9e('0x1c')]();});}function uploadFile(_0x1314ae){return new BPromise(function(_0x112016,_0x1c696a){var _0x105080=urlParse(_0x1314ae);var _0x4bb1e3=_0x105080[_0x0a9e('0x1d')]===_0x0a9e('0x1e')?https:http;var _0x53682f={'host':_0x105080[_0x0a9e('0xe')],'path':_0x105080['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4bb1e3[_0x0a9e('0x10')](_0x53682f,function(_0x432e56){if(_0x432e56[_0x0a9e('0x11')]!==0xc8){_0x1c696a(new Error(_0x0a9e('0x12')+_0x1314ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x432e56[_0x0a9e('0x11')]+'\x20('+_0x432e56[_0x0a9e('0x14')]+')'));return;}var _0x3b45bc='';_0x432e56['on'](_0x0a9e('0x1f'),function(_0x370d86){_0x3b45bc+=_0x370d86;});_0x432e56['on'](_0x0a9e('0x1c'),function(){_0x112016(_0x3b45bc);});})['on'](_0x0a9e('0x18'),function(_0x5ea472){_0x1c696a(_0x5ea472);})['end']();});}function convertFile(_0x197ec0,_0x3a8e58){return new BPromise(function(_0x40c424,_0x33161b){var _0x526cf3=sox[_0x0a9e('0x20')](_0x197ec0,_0x3a8e58,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x526cf3['on'](_0x0a9e('0x18'),function(_0x5bfb33){logger[_0x0a9e('0x18')](_0x0a9e('0x21'),_0x5bfb33);_0x33161b(_0x5bfb33);});_0x526cf3['on'](_0x0a9e('0x1c'),function(){logger[_0x0a9e('0x16')](_0x0a9e('0x22'));_0x40c424();});_0x526cf3[_0x0a9e('0x23')]();});}function base64Decode(_0x11c3b6,_0x14de77){var _0x5a101a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));fs['writeFileSync'](_0x5a101a,_0x11c3b6,_0x0a9e('0x28'));return convertFile(_0x5a101a,_0x14de77)[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x5a101a);fs[_0x0a9e('0x2a')](_0x14de77,_0x0a9e('0x2b'));}catch(_0x563b45){logger[_0x0a9e('0x18')](_0x563b45);}return _0x14de77[_0x0a9e('0x2c')]('.')[0x0];});}function base64Encode(_0x1dbde2){var _0x540530=fs[_0x0a9e('0x2d')](_0x1dbde2);return new Buffer(_0x540530)['toString'](_0x0a9e('0x28'));}exports[_0x0a9e('0x2e')]=function(_0x1122db,_0x33bdb7){var _0x25ce3a,_0x5180f1;return tts(_0x1122db,_0x33bdb7||'en',0x1)[_0x0a9e('0x29')](function(_0x46f0a5){logger[_0x0a9e('0x16')](_0x46f0a5);_0x25ce3a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));return downloadFile(_0x46f0a5,_0x25ce3a);})[_0x0a9e('0x29')](function(){_0x5180f1=path['resolve'](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27'));return convertFile(_0x25ce3a,_0x5180f1);})[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x25ce3a);fs[_0x0a9e('0x2a')](_0x5180f1,'777');}catch(_0x191e91){logger[_0x0a9e('0x18')](_0x191e91);}logger[_0x0a9e('0x16')](_0x0a9e('0x30'),_0x5180f1['split']('.')[0x0]);return _0x5180f1['split']('.')[0x0];});};exports[_0x0a9e('0x31')]=function(_0x5640eb,_0x24936a,_0x3d9717){return google[_0x0a9e('0x32')](_0x5640eb,_0x24936a,_0x3d9717)[_0x0a9e('0x29')](function(_0x4f41ae){logger[_0x0a9e('0x16')](_0x4f41ae[_0x0a9e('0x33')]);return rp(_0x4f41ae);})[_0x0a9e('0x29')](function(_0x533942){var _0x1dbf74='';var _0x1a180b=0x0;try{fs[_0x0a9e('0x19')](_0x5640eb);}catch(_0x4c1c0e){logger['error'](_0x4c1c0e);}if(_0x533942&&_0x533942[_0x0a9e('0x34')]){_0x1dbf74=_0x533942[_0x0a9e('0x34')]['map'](function(_0x2b814e){return _0x2b814e&&_0x2b814e[_0x0a9e('0x35')][0x0]&&_0x2b814e[_0x0a9e('0x35')][0x0][_0x0a9e('0x36')]?_0x2b814e['alternatives'][0x0]['transcript']:'';})[_0x0a9e('0x37')]('\x0a');_0x1a180b=_0x533942[_0x0a9e('0x34')]['map'](function(_0x183991){return _0x183991&&_0x183991[_0x0a9e('0x35')][0x0]&&_0x183991[_0x0a9e('0x35')][0x0]['confidence']?_0x183991[_0x0a9e('0x35')][0x0][_0x0a9e('0x38')]:0x0;})[_0x0a9e('0x37')]('\x0a');}logger[_0x0a9e('0x16')](_0x0a9e('0x39'),_0x1dbf74);logger[_0x0a9e('0x16')](_0x0a9e('0x3a'),_0x1a180b);return{'transcript':_0x1dbf74,'confidence':_0x1a180b};})[_0x0a9e('0x3b')](function(_0x23b089){logger[_0x0a9e('0x18')](_0x0a9e('0x3c'),_0x23b089[_0x0a9e('0x11')],_0x23b089[_0x0a9e('0x3d')],_0x23b089[_0x0a9e('0x3e')]);});};exports[_0x0a9e('0x3f')]=function(_0x4d04c8,_0x52628e,_0x473fdc,_0xb3795a){var _0x405c8f=apiai(_0x52628e,{'language':_0xb3795a||'en'});return _0x405c8f[_0x0a9e('0x40')](_0x473fdc,{'sessionId':md5(_0x4d04c8)})[_0x0a9e('0x29')](function(_0xc9a702){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0xc9a702));return{'source':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x43')],'resolvedQuery':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x44')],'action':_0xc9a702['result'][_0x0a9e('0x45')],'actionIncomplete':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x46')],'speech':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x47')][_0x0a9e('0x48')],'score':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x49')],'statusCode':_0xc9a702['status'][_0x0a9e('0x4a')],'endConversation':_0xc9a702['result'][_0x0a9e('0x4b')][_0x0a9e('0x4c')]||![],'isFallbackIntent':_0xc9a702[_0x0a9e('0x42')]['metadata'][_0x0a9e('0x4d')]};});};exports[_0x0a9e('0x4e')]=function(_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73){return tilde[_0x0a9e('0x32')](_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73)['then'](function(_0x13f44d){try{fs[_0x0a9e('0x19')](_0x4774f4);}catch(_0x1b5e80){logger[_0x0a9e('0x18')](_0x1b5e80);}logger[_0x0a9e('0x16')](_0x0a9e('0x4f'),_0x13f44d[_0x0a9e('0x36')]);logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x13f44d['confidence']);return _0x13f44d;});};exports[_0x0a9e('0x51')]=function(_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3){var _0x37edaa=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x375c18;return aws['polly'](_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3,_0x37edaa)['then'](function(){_0x375c18=path['resolve'](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x37edaa,_0x375c18);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x37edaa);fs[_0x0a9e('0x2a')](_0x375c18,'777');}catch(_0x5a88da){logger[_0x0a9e('0x18')](_0x5a88da);}return _0x375c18['split']('.')[0x0];});};exports[_0x0a9e('0x52')]=function(_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return aws[_0x0a9e('0x53')](_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da)['then'](function(_0x50f687){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0x50f687));return _0x50f687;});};exports['ispeechTTS']=function(_0x145931,_0x5ce9ac,_0x211ef9,_0x523cd2){var _0xe22ccc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x145931,encodeURIComponent(_0x5ce9ac),_0x211ef9,_0x523cd2);var _0x5df0ad=path[_0x0a9e('0x24')](__dirname,'tmp',rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x3cfd00;return downloadFile(_0xe22ccc,_0x5df0ad)[_0x0a9e('0x29')](function(){_0x3cfd00=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x5df0ad,_0x3cfd00);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x5df0ad);fs[_0x0a9e('0x2a')](_0x3cfd00,_0x0a9e('0x2b'));}catch(_0x30c491){logger[_0x0a9e('0x18')](_0x30c491);}return _0x3cfd00[_0x0a9e('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x956fbe,_0x26bc80,_0x5239ef,_0x3649cc){var _0x5cc8fb=util[_0x0a9e('0x54')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x26bc80,_0x5239ef,base64Encode(_0x956fbe),_0x3649cc?util['format']('model=%s',encodeURIComponent(_0x3649cc)):_0x0a9e('0x55'));return uploadFile(_0x5cc8fb)['then'](function(_0x2244d6){return querystring[_0x0a9e('0x56')](_0x2244d6);});};exports[_0x0a9e('0x57')]=function(_0x7be420,_0x1cca9f){return sestek[_0x0a9e('0x58')](_0x7be420,_0x1cca9f)['then'](function(_0x1627a7){logger['info'](JSON[_0x0a9e('0x41')](_0x1627a7));var _0x1f07cb={'speech':_0x1627a7[_0x0a9e('0x59')],'action':_0x1627a7['channelData']?_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5b')]:undefined,'actiondata':_0x1627a7[_0x0a9e('0x5a')]?_0x1627a7[_0x0a9e('0x5a')]['CustomActionData']:undefined};if(_0x1627a7[_0x0a9e('0x5a')]&&_0x1627a7[_0x0a9e('0x5a')]['AudioFromTts']){return base64Decode(_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5c')][_0x0a9e('0x5d')],path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27')))[_0x0a9e('0x29')](function(_0x281c7d){_0x1f07cb['audiofile']=_0x281c7d;return _0x1f07cb;});}return _0x1f07cb;});};exports[_0x0a9e('0x5e')]=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 e17e16a..48fcec5 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 _0x3adb=['./nda'];(function(_0x5ba9ff,_0x1a8955){var _0x415b2d=function(_0x2b67bf){while(--_0x2b67bf){_0x5ba9ff['push'](_0x5ba9ff['shift']());}};_0x415b2d(++_0x1a8955);}(_0x3adb,0x1ba));var _0xb3ad=function(_0x246f5f,_0x5c8c56){_0x246f5f=_0x246f5f-0x0;var _0x3e2e4=_0x3adb[_0x246f5f];return _0x3e2e4;};var nda=require(_0xb3ad('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x54de=['exports','./nda'];(function(_0x4dfe27,_0x1f1575){var _0x3b167a=function(_0x117501){while(--_0x117501){_0x4dfe27['push'](_0x4dfe27['shift']());}};_0x3b167a(++_0x1f1575);}(_0x54de,0x1af));var _0xe54d=function(_0x13287e,_0x550dda){_0x13287e=_0x13287e-0x0;var _0xe1f6e4=_0x54de[_0x13287e];return _0xe1f6e4;};var nda=require(_0xe54d('0x0'));module[_0xe54d('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 ba83630..9ffabbc 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 _0x3925=['../../../../../config/logger','agi','exports','POST','ndauth_url','/token','username','password','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','text','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','audio/wav','info','request-promise','url'];(function(_0x507dd6,_0x3d3acc){var _0x10ee74=function(_0x1ea93e){while(--_0x1ea93e){_0x507dd6['push'](_0x507dd6['shift']());}};_0x10ee74(++_0x3d3acc);}(_0x3925,0xd6));var _0x5392=function(_0x3c0796,_0x37e184){_0x3c0796=_0x3c0796-0x0;var _0x12e7aa=_0x3925[_0x3c0796];return _0x12e7aa;};'use strict';var rp=require(_0x5392('0x0'));var url=require(_0x5392('0x1'));var logger=require(_0x5392('0x2'))(_0x5392('0x3'));module[_0x5392('0x4')]=function(_0x24d6c3,_0x2c4a97){var _0xb51c79={'method':_0x5392('0x5'),'uri':url['resolve'](_0x2c4a97[_0x5392('0x6')],_0x5392('0x7')),'form':{'grant_type':'password','username':_0x2c4a97[_0x5392('0x8')],'password':_0x2c4a97[_0x5392('0x9')]},'json':!![]};return rp(_0xb51c79)['then'](function(_0x14d223){var _0x3bf4dc={'method':_0x5392('0x5'),'uri':url[_0x5392('0xa')](_0x2c4a97[_0x5392('0xb')],_0x5392('0xc')),'body':{'type':_0x5392('0xd'),'channelId':_0x5392('0xe'),'conversation':{'id':_0x24d6c3[_0x5392('0xf')]},'from':{'id':_0x24d6c3[_0x5392('0x10')],'name':_0x24d6c3[_0x5392('0x11')]},'recipient':{'id':_0x24d6c3['dnid'],'name':_0x24d6c3['extension']},'text':_0x2c4a97[_0x5392('0x12')],'channelData':{}},'headers':{'Authorization':_0x5392('0x13')+_0x14d223[_0x5392('0x14')]},'json':!![]};if(_0x2c4a97[_0x5392('0x15')]){_0x3bf4dc['body'][_0x5392('0x16')][_0x5392('0x17')]=_0x2c4a97[_0x5392('0x15')];}if(_0x2c4a97[_0x5392('0x18')]=='1'){_0x3bf4dc['body'][_0x5392('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5392('0x19')};}logger[_0x5392('0x1a')](JSON['stringify'](_0x3bf4dc));return rp(_0x3bf4dc);});}; \ No newline at end of file +var _0xa350=['uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','audio/wav','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda'];(function(_0x5e329a,_0x503dde){var _0x42855c=function(_0x344784){while(--_0x344784){_0x5e329a['push'](_0x5e329a['shift']());}};_0x42855c(++_0x503dde);}(_0xa350,0x13a));var _0x0a35=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xa350[_0x2642cb];return _0xe6e41;};'use strict';var rp=require(_0x0a35('0x0'));var url=require(_0x0a35('0x1'));var logger=require(_0x0a35('0x2'))(_0x0a35('0x3'));module[_0x0a35('0x4')]=function(_0x2c3bc7,_0x5c0bd7){var _0x4f5c7d={'method':_0x0a35('0x5'),'uri':url[_0x0a35('0x6')](_0x5c0bd7[_0x0a35('0x7')],_0x0a35('0x8')),'form':{'grant_type':_0x0a35('0x9'),'username':_0x5c0bd7[_0x0a35('0xa')],'password':_0x5c0bd7[_0x0a35('0x9')]},'json':!![]};return rp(_0x4f5c7d)[_0x0a35('0xb')](function(_0x3a9242){var _0xc549bb={'method':_0x0a35('0x5'),'uri':url[_0x0a35('0x6')](_0x5c0bd7[_0x0a35('0xc')],_0x0a35('0xd')),'body':{'type':_0x0a35('0xe'),'channelId':_0x0a35('0xf'),'conversation':{'id':_0x2c3bc7[_0x0a35('0x10')]},'from':{'id':_0x2c3bc7[_0x0a35('0x11')],'name':_0x2c3bc7[_0x0a35('0x12')]},'recipient':{'id':_0x2c3bc7[_0x0a35('0x13')],'name':_0x2c3bc7[_0x0a35('0x14')]},'text':_0x5c0bd7[_0x0a35('0x15')],'channelData':{}},'headers':{'Authorization':_0x0a35('0x16')+_0x3a9242[_0x0a35('0x17')]},'json':!![]};if(_0x5c0bd7['project']){_0xc549bb[_0x0a35('0x18')][_0x0a35('0x19')][_0x0a35('0x1a')]=_0x5c0bd7['project'];}if(_0x5c0bd7[_0x0a35('0x1b')]=='1'){_0xc549bb[_0x0a35('0x18')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0a35('0x1c')};}logger['info'](JSON[_0x0a35('0x1d')](_0xc549bb));return rp(_0xc549bb);});}; \ 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 3a5eae7..c62b425 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 _0xb55c=['./lib/api'];(function(_0x202c5a,_0x4e5240){var _0x8486e3=function(_0xaa1fdf){while(--_0xaa1fdf){_0x202c5a['push'](_0x202c5a['shift']());}};_0x8486e3(++_0x4e5240);}(_0xb55c,0x97));var _0xcb55=function(_0x4b4517,_0x5dbf6a){_0x4b4517=_0x4b4517-0x0;var _0x48278b=_0xb55c[_0x4b4517];return _0x48278b;};'use strict';var asr=require(_0xcb55('0x0'));module['exports']=function(_0x36a9a8,_0x6a3421,_0x2879b6,_0xabe343){return asr(_0x36a9a8,_0x6a3421,_0x2879b6,_0xabe343);}; \ No newline at end of file +var _0x4f69=['exports','./lib/api'];(function(_0xf5b8c1,_0x3aa2dd){var _0x3c1c7a=function(_0x5b3dd2){while(--_0x5b3dd2){_0xf5b8c1['push'](_0xf5b8c1['shift']());}};_0x3c1c7a(++_0x3aa2dd);}(_0x4f69,0xcf));var _0x94f6=function(_0x380c7f,_0x234003){_0x380c7f=_0x380c7f-0x0;var _0x57f3c2=_0x4f69[_0x380c7f];return _0x57f3c2;};'use strict';var asr=require(_0x94f6('0x0'));module[_0x94f6('0x1')]=function(_0x299d41,_0x409cf2,_0xc97401,_0x1e8c2f){return asr(_0x299d41,_0x409cf2,_0xc97401,_0x1e8c2f);}; \ 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 e661ae1..01e3163 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 _0x57a1=['Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','isNil','isObject','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood'];(function(_0x4627e8,_0x48c929){var _0x34e0d2=function(_0x5250f2){while(--_0x5250f2){_0x4627e8['push'](_0x4627e8['shift']());}};_0x34e0d2(++_0x48c929);}(_0x57a1,0x199));var _0x157a=function(_0x29982b,_0x594e0){_0x29982b=_0x29982b-0x0;var _0xb1f0a9=_0x57a1[_0x29982b];return _0xb1f0a9;};'use strict';var BPromise=require(_0x157a('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x157a('0x1'));var crypto=require(_0x157a('0x2'));var logger=require(_0x157a('0x3'))(_0x157a('0x4'));module[_0x157a('0x5')]=function(_0x42f269,_0x8d2bdc,_0x4fc889,_0x227e35){return new BPromise(function(_0x15457b,_0x7b115){logger[_0x157a('0x6')](_0x157a('0x7'),_0x227e35||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x37e774=new WebSocket(_0x227e35||_0x157a('0x8'),{'perMessageDeflate':![]});var _0xa2f40f='';var _0xaef34b='0';var _0x2df474='1';var _0x3a1e5a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xbad100(_0x114c9a){var _0x4d1f95=crypto[_0x157a('0x9')]('sha1');_0x4d1f95[_0x157a('0xa')](_0x114c9a);return _0x4d1f95[_0x157a('0xb')](_0x157a('0xc'));}function _0x219f8c(){try{logger[_0x157a('0x6')](_0x157a('0xd'));var _0x16cffb=moment()[_0x157a('0xe')]();var _0x10f679=_0xbad100(_0x16cffb+_0x8d2bdc+_0x4fc889);_0x37e774[_0x157a('0xf')](JSON[_0x157a('0x10')]({'appID':_0x8d2bdc,'timestamp':_0x16cffb,'appKey':_0x10f679}));var _0x1aa61b=fs[_0x157a('0x11')](_0x42f269);_0x1aa61b['on'](_0x157a('0x12'),function(_0x347bcf){_0x37e774[_0x157a('0xf')](_0x347bcf);});_0x1aa61b['on'](_0x157a('0x13'),function(){_0x37e774[_0x157a('0xf')](_0x157a('0x14'));});}catch(_0x3a5a19){logger[_0x157a('0x15')](_0x157a('0x16'),JSON[_0x157a('0x10')](_0x3a5a19));_0x37e774[_0x157a('0x17')]();}}function _0x452b87(_0x294912){try{if(_0x294912){var _0x42fc40=JSON[_0x157a('0x18')](_0x294912);switch(_0x42fc40[_0x157a('0x19')]){case 0x0:if(_0x42fc40[_0x157a('0x1a')]){if(_0x42fc40['result'][_0x157a('0x1b')]){logger['info'](_0x157a('0x1c'),JSON['stringify'](_0x42fc40[_0x157a('0x1a')][_0x157a('0x1d')]));_0xa2f40f=_0x42fc40[_0x157a('0x1a')][_0x157a('0x1d')][0x0]['transcript'];_0xaef34b=_0x42fc40[_0x157a('0x1a')][_0x157a('0x1d')][0x0][_0x157a('0x1e')];_0x2df474='0';_0x3a1e5a=_0x157a('0x1f');_0x37e774[_0x157a('0x17')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2df474='1';_0x3a1e5a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x157a('0x6')](_0x157a('0x20'));_0x2df474='2';_0x3a1e5a='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x157a('0x6')](_0x157a('0x21'));_0x2df474='9';_0x3a1e5a=_0x157a('0x21');break;case 0xa:logger['info'](_0x157a('0x22'));_0x2df474='10';_0x3a1e5a=_0x157a('0x22');break;case 0xb:logger[_0x157a('0x6')](_0x157a('0x23'));_0x2df474='11';_0x3a1e5a='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x315c30){logger[_0x157a('0x15')](_0x157a('0x24'),JSON[_0x157a('0x10')](_0x315c30));_0x37e774[_0x157a('0x17')]();}}function _0x22d230(){logger[_0x157a('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x15457b({'transcript':_0xa2f40f,'confidence':_0xaef34b,'status':_0x2df474,'status_message':_0x3a1e5a});}function _0x3141f5(_0x37164e){logger[_0x157a('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x157a('0x25')](_0x37164e)){logger['error'](_[_0x157a('0x26')](_0x37164e)?JSON[_0x157a('0x10')](_0x37164e):_0x37164e);}}_0x37e774['on']('open',_0x219f8c);_0x37e774['on'](_0x157a('0x27'),_0x452b87);_0x37e774['on']('close',_0x22d230);_0x37e774['on'](_0x157a('0x15'),_0x3141f5);});}; \ No newline at end of file +var _0x816e=['unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','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.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','hex'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x816e,0x176));var _0xe816=function(_0x4a96ca,_0x13754e){_0x4a96ca=_0x4a96ca-0x0;var _0x2aed48=_0x816e[_0x4a96ca];return _0x2aed48;};'use strict';var BPromise=require(_0xe816('0x0'));var _=require(_0xe816('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xe816('0x2'));var logger=require(_0xe816('0x3'))(_0xe816('0x4'));module[_0xe816('0x5')]=function(_0x3cee4d,_0x234f55,_0x496d9d,_0x299725){return new BPromise(function(_0xd181d4,_0x27c47a){logger[_0xe816('0x6')](_0xe816('0x7'),_0x299725||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x34e41=new WebSocket(_0x299725||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x46d1f6='';var _0x2f7fe3='0';var _0x850026='1';var _0x4a38a5=_0xe816('0x8');function _0x2f1650(_0x5c4ec5){var _0x322162=crypto['createHash'](_0xe816('0x9'));_0x322162['update'](_0x5c4ec5);return _0x322162['digest'](_0xe816('0xa'));}function _0x348618(){try{logger[_0xe816('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x2eb88d=moment()[_0xe816('0xb')]();var _0x3eff29=_0x2f1650(_0x2eb88d+_0x234f55+_0x496d9d);_0x34e41[_0xe816('0xc')](JSON[_0xe816('0xd')]({'appID':_0x234f55,'timestamp':_0x2eb88d,'appKey':_0x3eff29}));var _0x2b7588=fs[_0xe816('0xe')](_0x3cee4d);_0x2b7588['on'](_0xe816('0xf'),function(_0x5e6896){_0x34e41[_0xe816('0xc')](_0x5e6896);});_0x2b7588['on'](_0xe816('0x10'),function(){_0x34e41['send'](_0xe816('0x11'));});}catch(_0x192c3b){logger['error'](_0xe816('0x12'),JSON[_0xe816('0xd')](_0x192c3b));_0x34e41[_0xe816('0x13')]();}}function _0x194c88(_0x5065b2){try{if(_0x5065b2){var _0x3956ab=JSON[_0xe816('0x14')](_0x5065b2);switch(_0x3956ab[_0xe816('0x15')]){case 0x0:if(_0x3956ab[_0xe816('0x16')]){if(_0x3956ab[_0xe816('0x16')]['final']){logger['info'](_0xe816('0x17'),JSON[_0xe816('0xd')](_0x3956ab['result']['hypotheses']));_0x46d1f6=_0x3956ab[_0xe816('0x16')][_0xe816('0x18')][0x0]['transcript'];_0x2f7fe3=_0x3956ab['result']['hypotheses'][0x0][_0xe816('0x19')];_0x850026='0';_0x4a38a5='Success.';_0x34e41[_0xe816('0x13')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x850026='1';_0x4a38a5=_0xe816('0x8');break;case 0x2:logger[_0xe816('0x6')](_0xe816('0x1a'));_0x850026='2';_0x4a38a5=_0xe816('0x1a');break;case 0x9:logger[_0xe816('0x6')](_0xe816('0x1b'));_0x850026='9';_0x4a38a5='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xe816('0x6')]('Authentication\x20failed.');_0x850026='10';_0x4a38a5='Authentication\x20failed.';break;case 0xb:logger[_0xe816('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x850026='11';_0x4a38a5=_0xe816('0x1c');}}}catch(_0x51b949){logger[_0xe816('0x1d')](_0xe816('0x1e'),JSON[_0xe816('0xd')](_0x51b949));_0x34e41[_0xe816('0x13')]();}}function _0x425f55(){logger[_0xe816('0x6')](_0xe816('0x1f'));_0xd181d4({'transcript':_0x46d1f6,'confidence':_0x2f7fe3,'status':_0x850026,'status_message':_0x4a38a5});}function _0x36595a(_0x580a65){logger[_0xe816('0x1d')](_0xe816('0x20'));if(!_['isNil'](_0x580a65)){logger[_0xe816('0x1d')](_[_0xe816('0x21')](_0x580a65)?JSON[_0xe816('0xd')](_0x580a65):_0x580a65);}}_0x34e41['on']('open',_0x348618);_0x34e41['on'](_0xe816('0x22'),_0x194c88);_0x34e41['on']('close',_0x425f55);_0x34e41['on']('error',_0x36595a);});}; \ 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 e829f42..a7f52e9 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 _0x34e8=['./asr','exports'];(function(_0x262baa,_0x283058){var _0x4f2257=function(_0x2cd1c6){while(--_0x2cd1c6){_0x262baa['push'](_0x262baa['shift']());}};_0x4f2257(++_0x283058);}(_0x34e8,0x12c));var _0x834e=function(_0x2176ee,_0x27cc69){_0x2176ee=_0x2176ee-0x0;var _0x27d28d=_0x34e8[_0x2176ee];return _0x27d28d;};var asr=require(_0x834e('0x0'));module[_0x834e('0x1')]={'asr':asr}; \ No newline at end of file +var _0xedd9=['exports'];(function(_0x2f7234,_0xe1b766){var _0xf2679f=function(_0x1c0714){while(--_0x1c0714){_0x2f7234['push'](_0x2f7234['shift']());}};_0xf2679f(++_0xe1b766);}(_0xedd9,0xfc));var _0x9edd=function(_0x3bb8da,_0x197bbd){_0x3bb8da=_0x3bb8da-0x0;var _0x2df98a=_0xedd9[_0x3bb8da];return _0x2df98a;};var asr=require('./asr');module[_0x9edd('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 8f4404c..28591a4 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 _0x58e4=['destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','nextTick','inherits','exports','util','EventEmitter','./error','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR'];(function(_0x2577d9,_0x8f2f28){var _0x36fe58=function(_0xbba849){while(--_0xbba849){_0x2577d9['push'](_0x2577d9['shift']());}};_0x36fe58(++_0x8f2f28);}(_0x58e4,0x157));var _0x458e=function(_0x2f42f9,_0x3edb5b){_0x2f42f9=_0x2f42f9-0x0;var _0x1d4540=_0x58e4[_0x2f42f9];return _0x1d4540;};'use strict';var util=require(_0x458e('0x0'));var net=require('net');var EventEmitter=require('events')[_0x458e('0x1')];var AGIError=require(_0x458e('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0x43ca9b,_0x9c2e2a,_0x35c6f2){var _0x21f717=this,_0x43ca9b=_0x43ca9b||0x11dd,_0x9c2e2a=_0x9c2e2a||_0x458e('0x3'),_0x3fd5d5=null,_0x7a7231=0x0;EventEmitter[_0x458e('0x4')](_0x21f717);function _0x3c06bf(){if(!_0x43ca9b){_0x21f717[_0x458e('0x5')](_0x458e('0x6'),new AGIError(_0x458e('0x7')));return![];}_0x3fd5d5=net[_0x458e('0x8')]();_0x3fd5d5[_0x458e('0x9')](_0x43ca9b,_0x9c2e2a);_0x3fd5d5['on'](_0x458e('0xa'),function(){_0x21f717['emit'](_0x458e('0xa'));});_0x3fd5d5['on'](_0x458e('0xb'),function(_0xba1d9e){_0x3fd5d5[_0x458e('0xc')](function(_0x2ff780,_0x2239ba){if(_0x2ff780){_0x21f717['emit'](_0x458e('0x6'),new AGIError(_0x458e('0xd'),_0x2ff780));}else if(_0x35c6f2&&_0x35c6f2<0x0){_0x21f717[_0x458e('0x5')](_0x458e('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0xba1d9e[_0x458e('0xe')]();}else if(_0x35c6f2&&_0x35c6f2>0x0&&_0x35c6f2<_0x2239ba){_0x7a7231+=0x1;_0x21f717[_0x458e('0x5')](_0x458e('0x6'),new AGIError(_0x458e('0xf'),_0x7a7231));_0xba1d9e[_0x458e('0xe')]();}else{var _0x4706b4=new AGIChannel(_0xba1d9e);_0x4706b4['on'](_0x458e('0x10'),function(){_0x21f717[_0x458e('0x5')](_0x458e('0xb'),_0x4706b4);});}});});_0x3fd5d5['on'](_0x458e('0x6'),function(_0x748e5f){_0x21f717[_0x458e('0x5')](_0x458e('0x6'),new AGIError(_0x458e('0xd'),_0x748e5f[_0x458e('0x11')]));});_0x3fd5d5['on']('close',function(){_0x21f717[_0x458e('0x5')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x458e('0x12')](function(){_0x3c06bf();});};util[_0x458e('0x13')](AGIServer,EventEmitter);module[_0x458e('0x14')]=function(_0xfdc116,_0x2fa1cc,_0x13f63b){return new AGIServer(_0xfdc116,_0x2fa1cc,_0x13f63b);}; \ No newline at end of file +var _0xe9e8=['E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION'];(function(_0x58a597,_0x3e928d){var _0x2dff4d=function(_0x270ab3){while(--_0x270ab3){_0x58a597['push'](_0x58a597['shift']());}};_0x2dff4d(++_0x3e928d);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x516c3a,_0x121b74){_0x516c3a=_0x516c3a-0x0;var _0x125117=_0xe9e8[_0x516c3a];return _0x125117;};'use strict';var util=require(_0x8e9e('0x0'));var net=require(_0x8e9e('0x1'));var EventEmitter=require(_0x8e9e('0x2'))[_0x8e9e('0x3')];var AGIError=require(_0x8e9e('0x4'));var AGIChannel=require(_0x8e9e('0x5'));var AGIServer=function(_0x10ee84,_0x48233f,_0x103d8b){var _0x2a1d41=this,_0x10ee84=_0x10ee84||0x11dd,_0x48233f=_0x48233f||_0x8e9e('0x6'),_0x5c10ad=null,_0x39983a=0x0;EventEmitter[_0x8e9e('0x7')](_0x2a1d41);function _0x58f822(){if(!_0x10ee84){_0x2a1d41[_0x8e9e('0x8')](_0x8e9e('0x9'),new AGIError(_0x8e9e('0xa')));return![];}_0x5c10ad=net['createServer']();_0x5c10ad[_0x8e9e('0xb')](_0x10ee84,_0x48233f);_0x5c10ad['on'](_0x8e9e('0xc'),function(){_0x2a1d41[_0x8e9e('0x8')]('listening');});_0x5c10ad['on'](_0x8e9e('0xd'),function(_0x303402){_0x5c10ad[_0x8e9e('0xe')](function(_0x1eb82c,_0x35f014){if(_0x1eb82c){_0x2a1d41[_0x8e9e('0x8')](_0x8e9e('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x1eb82c));}else if(_0x103d8b&&_0x103d8b<0x0){_0x2a1d41[_0x8e9e('0x8')]('error',new AGIError(_0x8e9e('0xf')));_0x303402[_0x8e9e('0x10')]();}else if(_0x103d8b&&_0x103d8b>0x0&&_0x103d8b<_0x35f014){_0x39983a+=0x1;_0x2a1d41[_0x8e9e('0x8')](_0x8e9e('0x9'),new AGIError(_0x8e9e('0x11'),_0x39983a));_0x303402[_0x8e9e('0x10')]();}else{var _0x2871a9=new AGIChannel(_0x303402);_0x2871a9['on']('ready',function(){_0x2a1d41['emit'](_0x8e9e('0xd'),_0x2871a9);});}});});_0x5c10ad['on'](_0x8e9e('0x9'),function(_0x5674ef){_0x2a1d41[_0x8e9e('0x8')](_0x8e9e('0x9'),new AGIError(_0x8e9e('0x12'),_0x5674ef[_0x8e9e('0x13')]));});_0x5c10ad['on'](_0x8e9e('0x14'),function(){_0x2a1d41['emit']('close',new AGIError(_0x8e9e('0x15')));});}process[_0x8e9e('0x16')](function(){_0x58f822();});};util[_0x8e9e('0x17')](AGIServer,EventEmitter);module[_0x8e9e('0x18')]=function(_0xa079b5,_0x1b56db,_0x311697){return new AGIServer(_0xa079b5,_0x1b56db,_0x311697);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c31f310..c647ae9 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 _0x6d92=['model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','google_asr_language','tildeASR','appid','appsecret','uri','clear','includes','clone','hasOwnProperty','isString','replaceAllVariables','split','length','replaceAll','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','sync','retry','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','label','no\x20list\x20selected','delay','add','minutes','callback_priority','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','options','result','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','odbc_id','query','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','setVariable','%s[%s][%s]','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','toUpperCase','audiofile','.wav','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','url','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','stringify','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','%s.%s','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','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','unlink','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogin','AGENT\x20%s\x20FOUND\x20BY','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','operation','no\x20operation\x20configured','isArray','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','channel','prototype','getVariable','rpc','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','createSquareRecording','callerid','calleridname','context','priority','accountcode','dnid','arg_1','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','list_id','scheduledAt','callback','toString','getPause','agentPause','agent','isNil','error','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleTTS','text','google_tts_language','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','isConfigured'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6d92,0x131));var _0x26d9=function(_0x1b9f9a,_0xa2c457){_0x1b9f9a=_0x1b9f9a-0x0;var _0x38d54a=_0x6d92[_0x1b9f9a];return _0x38d54a;};'use strict';var fs=require('fs');var path=require(_0x26d9('0x0'));var util=require(_0x26d9('0x1'));var _=require(_0x26d9('0x2'));var sh=require('shelljs');var odbc=require(_0x26d9('0x3'))();var rs=require(_0x26d9('0x4'));var moment=require(_0x26d9('0x5'));var Mustache=require(_0x26d9('0x6'));var logger=require(_0x26d9('0x7'))(_0x26d9('0x8'));var config=require(_0x26d9('0x9'));var scripts=require(_0x26d9('0xa'));var FILES_PATH=_0x26d9('0xb');var verticesWithRetry=[_0x26d9('0xc'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x5b926b,_0x47b247,_0x2348cd){this[_0x26d9('0xd')]=_0x5b926b;this['rpc']=_0x47b247;this['mailRpc']=_0x2348cd;};AGIVertices[_0x26d9('0xe')][_0x26d9('0xf')]=function(_0x1b2c20,_0x3704bb){this[_0x26d9('0x10')][_0x26d9('0x11')](_0x1b2c20)['then'](function(_0x3fac6c){_0x3704bb(null,_0x3fac6c?_0x3fac6c[_0x26d9('0x12')]:![]);})[_0x26d9('0x13')](function(_0x5b3bca){_0x3704bb(_0x5b3bca);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x14')]=function(_0x172b7d,_0x3f0dab){this['rpc'][_0x26d9('0x15')](_0x172b7d)[_0x26d9('0x16')](function(_0x418d21){_0x3f0dab(null,_0x418d21?_0x418d21[_0x26d9('0x12')]:![]);})[_0x26d9('0x13')](function(_0x52a61d){_0x3f0dab(_0x52a61d);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x17')]=function(_0x535d0e,_0x210fc3){this[_0x26d9('0x10')][_0x26d9('0x18')](_0x535d0e)[_0x26d9('0x16')](function(_0x356f0c){_0x210fc3(null,_0x356f0c?_0x356f0c['name']:![]);})[_0x26d9('0x13')](function(_0x1f2713){_0x210fc3(_0x1f2713);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x19')]=function(_0x52f153,_0x19ddeb){this[_0x26d9('0x10')]['getSquareOdbcById'](_0x52f153)[_0x26d9('0x16')](function(_0x43e299){_0x19ddeb(null,_0x43e299?_0x43e299[_0x26d9('0x1a')]:![]);})[_0x26d9('0x13')](function(_0x44e415){_0x19ddeb(_0x44e415);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x1b')]=function(_0x3f0590,_0x3419b){this['rpc'][_0x26d9('0x1c')](_0x3f0590)[_0x26d9('0x16')](function(_0x5666c2){_0x3419b(null,_0x5666c2?_0x5666c2[_0x26d9('0x12')]:![]);})[_0x26d9('0x13')](function(_0x49ef89){_0x3419b(_0x49ef89);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x1d')]=function(_0x490fc7,_0x12e4f8){this[_0x26d9('0x10')][_0x26d9('0x1e')](_0x490fc7)[_0x26d9('0x16')](function(_0x2cdf24){_0x12e4f8(null,_0x2cdf24?_0x2cdf24['name']:![]);})[_0x26d9('0x13')](function(_0x6c74f8){_0x12e4f8(_0x6c74f8);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x1f')]=function(_0x3e2657,_0xa43401){var _0x413660=this;this['rpc'][_0x26d9('0x20')](_0x3e2657)[_0x26d9('0x16')](function(_0xb29466){_0xa43401(null,_0xb29466?_0x413660[_0x26d9('0x21')](_0xb29466[_0x26d9('0x22')]):![]);})[_0x26d9('0x13')](function(_0x2960c0){_0xa43401(_0x2960c0);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x23')]=function(_0x52f5aa,_0x5ab495){this[_0x26d9('0x10')][_0x26d9('0x24')](_0x52f5aa)['then'](function(_0x4cf4a3){_0x5ab495(null,_0x4cf4a3?_0x4cf4a3:![]);})['catch'](function(_0x732621){_0x5ab495(_0x732621);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x25')]=function(_0x1d1ae1,_0x3246e9,_0x212152){this[_0x26d9('0x26')][_0x26d9('0x25')](_0x1d1ae1,_0x3246e9)[_0x26d9('0x16')](function(){_0x212152(null);})['catch'](function(_0x2c5edc){_0x212152(_0x2c5edc);});};AGIVertices['prototype']['getIntervals']=function(_0xe95987,_0x4f1ecb){this[_0x26d9('0x10')][_0x26d9('0x27')](_0xe95987)[_0x26d9('0x16')](function(_0xc5f838){if(_0xc5f838){if(_0xc5f838[_0x26d9('0x28')]){_0x4f1ecb(null,[_0xc5f838[_0x26d9('0x29')]]);}else{_0x4f1ecb(null,_[_0x26d9('0x2a')](_0xc5f838[_0x26d9('0x2b')],_0x26d9('0x29')));}}else{_0x4f1ecb(null,![]);}})[_0x26d9('0x13')](function(_0x322cb3){_0x4f1ecb(_0x322cb3);});};AGIVertices[_0x26d9('0xe')]['getSoundPath']=function(_0x235cbe){return util[_0x26d9('0x2c')](_0x26d9('0x2d'),FILES_PATH,_0x235cbe);};AGIVertices[_0x26d9('0xe')][_0x26d9('0x2e')]=function(_0x2de56e,_0x5b63a1,_0x1089b3){odbc[_0x26d9('0x2f')](_0x2de56e,function(_0x1bd8c6){if(_0x1bd8c6){logger['error'](_0x26d9('0x30'),_0x1bd8c6);_0x1089b3(_0x1bd8c6);}else{logger[_0x26d9('0x31')](_0x26d9('0x32'));odbc['query'](_0x5b63a1,function(_0x1bea49,_0x67a353){if(_0x1bea49){logger[_0x26d9('0x31')]('Error\x20executing\x20query\x20%s',_0x5b63a1);_0x1089b3(_0x1bea49);}else{logger[_0x26d9('0x31')](_0x26d9('0x33'),_0x5b63a1);odbc[_0x26d9('0x34')](function(_0x45cf7d){if(_0x45cf7d){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x45cf7d);}_0x1089b3(null,_0x67a353);});}});}});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x35')]=function(_0x5abd5d,_0x32c2ef){this[_0x26d9('0x10')][_0x26d9('0x36')](_0x5abd5d)[_0x26d9('0x16')](function(_0x152830){_0x32c2ef(null,_0x152830?_0x152830:![]);})['catch'](function(_0x18ab4d){_0x32c2ef(_0x18ab4d);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x37')]=function(_0xcc7a8a,_0x54d2ef){this[_0x26d9('0x10')]['createSmsMessage'](_0xcc7a8a)['then'](function(_0x1a87f5){_0x54d2ef(null,_0x1a87f5);})[_0x26d9('0x13')](function(_0x405d9c){_0x54d2ef(_0x405d9c);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x38')]=function(_0x5c05f0,_0xd16cb5,_0x44a163){this[_0x26d9('0x10')][_0x26d9('0x38')]({'uniqueid':this[_0x26d9('0xd')][_0x26d9('0x39')],'node':_0x5c05f0['label'],'application':_0x5c05f0[_0x26d9('0x3a')],'data':_0xd16cb5||null,'project_name':this[_0x26d9('0xd')]['arg_1'],'callerid':this['channel']['callerid']})[_0x26d9('0x16')](function(_0x3a6f14){if(_0x44a163){_0x44a163(null,_0x3a6f14);}})[_0x26d9('0x13')](function(_0x5f1f5f){if(_0x44a163){_0x44a163(_0x5f1f5f);}});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x3b')]=function(_0xa150e1,_0x573ef7,_0x390c14,_0x509c2c){this['rpc'][_0x26d9('0x3b')]({'uniqueid':this[_0x26d9('0xd')][_0x26d9('0x39')],'callerid':this[_0x26d9('0xd')][_0x26d9('0x3c')],'calleridname':this[_0x26d9('0xd')][_0x26d9('0x3d')],'context':this[_0x26d9('0xd')][_0x26d9('0x3e')],'extension':this[_0x26d9('0xd')]['extension'],'priority':this['channel'][_0x26d9('0x3f')],'accountcode':this[_0x26d9('0xd')][_0x26d9('0x40')],'dnid':this[_0x26d9('0xd')][_0x26d9('0x41')],'projectName':this['channel'][_0x26d9('0x42')],'saveName':_0x573ef7,'filename':_0xa150e1['file']||_0x573ef7,'savePath':_0x390c14})[_0x26d9('0x16')](function(_0x30f4cf){_0x509c2c(null,_0x30f4cf);})[_0x26d9('0x13')](function(_0x57a471){_0x509c2c(_0x57a471);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x43')]=function(_0x9f28fa,_0x32bec8,_0x25ad69){this[_0x26d9('0x10')]['createSquareMessage']({'uniqueid':this[_0x26d9('0xd')][_0x26d9('0x39')],'body':_0x9f28fa,'direction':_0x32bec8})[_0x26d9('0x16')](function(_0x390350){if(_0x25ad69){_0x25ad69(null,_0x390350);}})['catch'](function(_0x2cb01b){if(_0x25ad69){_0x25ad69(_0x2cb01b);}});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x44')]=function(_0x42096a,_0x1178a0){this[_0x26d9('0x10')][_0x26d9('0x44')]({'firstName':_[_0x26d9('0x45')](_0x42096a['name'])||_['isNil'](_0x42096a[_0x26d9('0x12')])?_0x26d9('0x46')+Math[_0x26d9('0x47')]():_0x42096a[_0x26d9('0x12')],'lastName':_[_0x26d9('0x45')](_0x42096a[_0x26d9('0x48')])||_['isNil'](_0x42096a[_0x26d9('0x48')])?null:_0x42096a['lastName'],'phone':_0x42096a[_0x26d9('0x49')],'ListId':_0x42096a[_0x26d9('0x4a')],'scheduledAt':_0x42096a[_0x26d9('0x4b')],'callbackUniqueid':this[_0x26d9('0xd')][_0x26d9('0x39')],'tags':_0x26d9('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x42096a['scheduledAt'][_0x26d9('0x4d')](),'priority':_0x42096a['callback_priority']})[_0x26d9('0x16')](function(_0x912ad){_0x1178a0(null,_0x912ad);})[_0x26d9('0x13')](function(_0x5e4205){_0x1178a0(_0x5e4205);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x4e')]=function(_0x3167d5,_0x186045){this[_0x26d9('0x10')]['getPauseById'](_0x3167d5)['then'](function(_0x2d838a){_0x186045(null,_0x2d838a?_0x2d838a[_0x26d9('0x12')]:![]);})[_0x26d9('0x13')](function(_0x4ff5ba){_0x186045(_0x4ff5ba);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x4f')]=function(_0x1b7dd9,_0xff41a8,_0x130c00){var _0xf4150c={'role':_0x26d9('0x50')};_0xf4150c[_0x1b7dd9]=this[_0x26d9('0xd')]['callerid'];this['rpc']['agentPause'](_0xf4150c,_0xff41a8,this[_0x26d9('0xd')]['uniqueid'])['then'](function(_0x309200){_0x130c00(null,_[_0x26d9('0x51')](_0x309200)?![]:!![]);})[_0x26d9('0x13')](function(_0x22b199){logger[_0x26d9('0x52')](_0x22b199);_0x130c00(null,![]);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x53')]=function(_0x1de877,_0x55b413){var _0x572d8f={'role':_0x26d9('0x50')};_0x572d8f[_0x1de877]=this[_0x26d9('0xd')][_0x26d9('0x3c')];this[_0x26d9('0x10')][_0x26d9('0x53')](_0x572d8f)[_0x26d9('0x16')](function(_0x52cd80){_0x55b413(null,_[_0x26d9('0x51')](_0x52cd80)?![]:!![]);})['catch'](function(_0x47ea45){logger[_0x26d9('0x52')](_0x47ea45);_0x55b413(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x1c39f1,_0x6235c1){var _0xccb49={'role':'agent'};_0xccb49[_0x1c39f1]=this[_0x26d9('0xd')][_0x26d9('0x3c')];this[_0x26d9('0x10')][_0x26d9('0x54')](_0xccb49)[_0x26d9('0x16')](function(_0x553036){_0x6235c1(null,_['isNil'](_0x553036)?![]:!![]);})[_0x26d9('0x13')](function(_0x22d052){logger[_0x26d9('0x52')](_0x22d052);_0x6235c1(null,![]);});};AGIVertices[_0x26d9('0xe')]['agentLogin']=function(_0x2375f7,_0x2adca3){var _0x468e0c={'role':_0x26d9('0x50')};_0x468e0c[_0x2375f7]=this[_0x26d9('0xd')][_0x26d9('0x3c')];var _0x53a6f9=_0x2375f7!=_0x26d9('0x55')?util[_0x26d9('0x2c')](_0x26d9('0x56'),_0x26d9('0x57'),this[_0x26d9('0xd')][_0x26d9('0x3c')]):undefined;this[_0x26d9('0x10')]['agentLogin'](_0x468e0c,_0x53a6f9)['then'](function(_0x1c468c){_0x2adca3(null,_[_0x26d9('0x51')](_0x1c468c)?![]:!![]);})[_0x26d9('0x13')](function(_0x3a8d8e){logger['error'](_0x3a8d8e);_0x2adca3(null,![]);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x58')]=function(_0x5984aa,_0x14baf4){sh[_0x26d9('0x59')](_[_0x26d9('0x5a')](_0x5984aa),function(_0xae9a08,_0x75fbc6){var _0x2dbc9a=_0x75fbc6[_0x26d9('0x5b')](/(\r\n|\n|\r)/gm,'');_0x14baf4(null,_0x2dbc9a);});};AGIVertices['prototype'][_0x26d9('0x5c')]=function(_0x54c0c7,_0x1a8a4c){scripts[_0x26d9('0x5c')](_0x54c0c7[_0x26d9('0x5d')],_0x54c0c7[_0x26d9('0x5e')]||'en',0x1)['then'](function(_0x1ef7f5){_0x1a8a4c(null,_0x1ef7f5);})[_0x26d9('0x13')](function(_0x302434){_0x1a8a4c(_0x302434);});};AGIVertices['prototype']['googleDialogflow']=function(_0x2f530b,_0x2c3adf){scripts[_0x26d9('0x5f')](this[_0x26d9('0xd')][_0x26d9('0x39')],_0x2f530b[_0x26d9('0x60')],_0x2f530b[_0x26d9('0x5d')],_0x2f530b[_0x26d9('0x61')]||'en')['then'](function(_0x51f185){_0x2c3adf(null,_0x51f185);})['catch'](function(_0x408454){_0x2c3adf(_0x408454);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x62')]=function(_0x36c780,_0x7a7667){scripts[_0x26d9('0x62')](this[_0x26d9('0xd')],_0x36c780)[_0x26d9('0x16')](function(_0x4ebbea){_0x7a7667(null,_0x4ebbea);})[_0x26d9('0x13')](function(_0x3bad9b){_0x7a7667(_0x3bad9b);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x63')]=function(_0x308fe8,_0x4cb59e){scripts[_0x26d9('0x63')](_0x308fe8[_0x26d9('0x60')],_0x308fe8[_0x26d9('0x5d')],_0x308fe8[_0x26d9('0x64')]||_0x26d9('0x65'),_0x308fe8['speed'])['then'](function(_0x590877){_0x4cb59e(null,_0x590877);})[_0x26d9('0x13')](function(_0x1aca72){_0x4cb59e(_0x1aca72);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x66')]=function(_0x2fae76,_0x481791,_0x51a027){scripts[_0x26d9('0x66')](_0x481791,_0x2fae76['key'],_0x2fae76[_0x26d9('0x67')]||'en-US',this[_0x26d9('0x68')](_0x2fae76[_0x26d9('0x69')])?_0x2fae76[_0x26d9('0x69')]:undefined)[_0x26d9('0x16')](function(_0x4fb9aa){_0x51a027(null,_0x4fb9aa);})[_0x26d9('0x13')](function(_0x44b2ad){_0x51a027(_0x44b2ad);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x6a')]=function(_0x19380a,_0x25d9b0){scripts['awsPolly'](_0x19380a[_0x26d9('0x6b')],_0x19380a[_0x26d9('0x6c')],_0x19380a[_0x26d9('0x6d')],_0x19380a[_0x26d9('0x6e')]||_0x26d9('0x6f'),_0x19380a[_0x26d9('0x5d')],_0x19380a[_0x26d9('0x70')]||_0x26d9('0x5d'))[_0x26d9('0x16')](function(_0x4445e3){_0x25d9b0(null,_0x4445e3);})['catch'](function(_0xf10041){_0x25d9b0(_0xf10041);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x71')]=function(_0x504930,_0x430482){scripts[_0x26d9('0x71')](this[_0x26d9('0xd')][_0x26d9('0x39')],_0x504930['aws_access_key_id'],_0x504930[_0x26d9('0x6c')],_0x504930[_0x26d9('0x72')],_0x504930[_0x26d9('0x5d')],_0x504930['aws_bot_name'])[_0x26d9('0x16')](function(_0x2df68b){_0x430482(null,_0x2df68b);})[_0x26d9('0x13')](function(_0x3996bd){_0x430482(_0x3996bd);});};AGIVertices['prototype']['googleASR']=function(_0x5aa44d,_0x29b325,_0x28028e){scripts['googleASR'](_0x29b325,_0x5aa44d[_0x26d9('0x60')],_0x5aa44d[_0x26d9('0x73')]||_0x26d9('0x65'))[_0x26d9('0x16')](function(_0x11852d){_0x28028e(null,_0x11852d);})[_0x26d9('0x13')](function(_0x67aa7c){_0x28028e(_0x67aa7c);});};AGIVertices[_0x26d9('0xe')][_0x26d9('0x74')]=function(_0x2b805f,_0xdeb370,_0xcb39a7){scripts[_0x26d9('0x74')](_0xdeb370,_0x2b805f[_0x26d9('0x75')],_0x2b805f[_0x26d9('0x76')],_0x2b805f[_0x26d9('0x77')])[_0x26d9('0x16')](function(_0x319c8a){_0xcb39a7(null,_0x319c8a);})['catch'](function(_0xdbfeba){_0xcb39a7(_0xdbfeba);});};AGIVertices['prototype'][_0x26d9('0x78')]=function(_0xcf20c0){var _0x847699=_[_0x26d9('0x79')](verticesWithRetry,_0xcf20c0['agicommand'])?_0xcf20c0:_[_0x26d9('0x7a')](_0xcf20c0);for(var _0x4dd04d in _0x847699){if(_0x847699[_0x26d9('0x7b')](_0x4dd04d)){if(_0x847699[_0x4dd04d]&&_[_0x26d9('0x7c')](_0x847699[_0x4dd04d])){_0x847699[_0x4dd04d]=this[_0x26d9('0x7d')](_0x847699[_0x4dd04d]);}}}return _0x847699;};AGIVertices[_0x26d9('0xe')][_0x26d9('0x7d')]=function(_0x3b584c){var _0x575bd1=_0x3b584c[_0x26d9('0x7e')]('{');for(var _0x2cca83=0x1;_0x2cca83<_0x575bd1['length'];_0x2cca83+=0x1){var _0x287d2c=_0x575bd1[_0x2cca83][_0x26d9('0x7e')]('}');if(_0x287d2c[_0x26d9('0x7f')]>0x1){_0x3b584c=_0x3b584c[_0x26d9('0x80')]('{'+_0x287d2c[0x0]+'}',this[_0x26d9('0xd')][_0x26d9('0xf')](_0x287d2c[0x0])['extra']||_0x287d2c[0x0]);}}if(_0x575bd1[_0x26d9('0x7f')]===0x1){return _0x3b584c[_0x26d9('0x4d')]();}return this[_0x26d9('0x7d')](_0x3b584c);};AGIVertices[_0x26d9('0xe')][_0x26d9('0x81')]=function(_0x218a7d,_0x30975e){var _0x37d39b=this[_0x26d9('0xd')]['getVariable'](_0x218a7d);if(_0x37d39b['result']===-0x1){return _0x37d39b;}logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x82'),_0x30975e,_0x37d39b['extra']));return this['channel']['setVariable'](_0x30975e,_0x37d39b[_0x26d9('0x83')]);};AGIVertices[_0x26d9('0xe')][_0x26d9('0x68')]=function(_0x24a7c9){return _0x24a7c9&&_0x24a7c9!=='0'&&_0x24a7c9!=='-1'&&_0x24a7c9!=='';};AGIVertices[_0x26d9('0xe')][_0x26d9('0x84')]=function(_0x2858ef){this[_0x26d9('0x38')][_0x26d9('0x85')](this,_0x2858ef,'-');_0x2858ef[_0x26d9('0x86')]=_0x2858ef['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x26d9('0x8')]=function(_0x4b40d3){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x87'),_0x4b40d3['label']));return this[_0x26d9('0xd')]['agi']([_0x4b40d3[_0x26d9('0x88')],_0x4b40d3[_0x26d9('0x89')]]);};AGIVertices['prototype'][_0x26d9('0x8a')]=function(_0x543974){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x8b'),_0x543974['label']));if(this['isConfigured'](_0x543974[_0x26d9('0x8c')])){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x8d'),_0x543974[_0x26d9('0x8c')]));var _0x478a9a=this['channel'][_0x26d9('0x8e')](_0x543974[_0x26d9('0x8c')]);if(_0x478a9a['result']===-0x1){return _0x478a9a;}}return this[_0x26d9('0xd')][_0x26d9('0x8a')]();};AGIVertices[_0x26d9('0xe')]['callback']=function(_0x35bf7c){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x8f'),_0x35bf7c[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x35bf7c[_0x26d9('0x4a')])){return this['channel'][_0x26d9('0x52')](_0x35bf7c,_0x26d9('0x91'));}_0x35bf7c[_0x26d9('0x4b')]=moment();if(this[_0x26d9('0x68')](_0x35bf7c[_0x26d9('0x92')])){_0x35bf7c[_0x26d9('0x4b')]=moment()[_0x26d9('0x93')](_0x35bf7c[_0x26d9('0x92')],_0x26d9('0x94'));}if(!this[_0x26d9('0x68')](_0x35bf7c[_0x26d9('0x95')])){_0x35bf7c['callback_priority']=0x2;}this[_0x26d9('0x44')][_0x26d9('0x85')](this,_0x35bf7c);return this['channel'][_0x26d9('0x96')](util['format'](_0x26d9('0x97'),_0x35bf7c[_0x26d9('0x49')],_0x35bf7c[_0x26d9('0x4a')],_0x35bf7c['scheduledAt']));};AGIVertices[_0x26d9('0xe')][_0x26d9('0x98')]=function(_0x1c6829){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x99'),_0x1c6829[_0x26d9('0x90')]));var _0x3890ec=this[_0x26d9('0xd')][_0x26d9('0x59')](_0x1c6829['application'],_0x1c6829[_0x26d9('0x9a')]);if(_0x3890ec[_0x26d9('0x9b')]===-0x1){return _0x3890ec;}return this[_0x26d9('0xd')][_0x26d9('0x96')](util['format'](_0x26d9('0x9c'),_0x1c6829['application'],_0x1c6829[_0x26d9('0x9a')]));};AGIVertices[_0x26d9('0xe')]['lumenvoxtts']=function(_0x39feff){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x9d'),_0x39feff['label']));if(!this[_0x26d9('0x68')](_0x39feff[_0x26d9('0x5d')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x9e'));}var _0x552b28='\x22'+_0x39feff[_0x26d9('0x5d')]+'\x22';if(this[_0x26d9('0x68')](_0x39feff[_0x26d9('0x9a')])){_0x552b28+=','+_0x39feff[_0x26d9('0x9a')];}var _0x4f49de=this[_0x26d9('0xd')][_0x26d9('0x59')](_0x26d9('0x9f'),_0x552b28);if(_0x4f49de['result']===-0x1){return _0x4f49de;}return this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0xa0'),_0x552b28));};AGIVertices[_0x26d9('0xe')][_0x26d9('0xa1')]=function(_0xa287f9){logger['info'](util['format'](_0x26d9('0xa2'),_0xa287f9[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0xa287f9[_0x26d9('0x5d')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x9e'));}var _0x46b01c='\x22'+_0xa287f9['text']+'\x22';if(this[_0x26d9('0x68')](_0xa287f9[_0x26d9('0x9a')])){_0x46b01c+=','+_0xa287f9[_0x26d9('0x9a')];}var _0x3de8bc=this[_0x26d9('0xd')][_0x26d9('0x59')](_0x26d9('0x9f'),_0x46b01c);if(_0x3de8bc[_0x26d9('0x9b')]===-0x1){return _0x3de8bc;}return this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0xa0'),_0x46b01c));};AGIVertices['prototype']['lumenvoxasr']=function(_0x28a951){logger['info'](util[_0x26d9('0x2c')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x28a951[_0x26d9('0x90')]));if(!this['isConfigured'](_0x28a951[_0x26d9('0xa3')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xa4'));}var _0x86e29b=_0x28a951[_0x26d9('0xa3')];if(this[_0x26d9('0x68')](_0x28a951['options'])){_0x86e29b+=','+_0x28a951['options'];}var _0x5aeb69=this['channel']['exec'](_0x26d9('0xa5'),_0x86e29b);if(_0x5aeb69[_0x26d9('0x9b')]===-0x1){return _0x5aeb69;}var _0x681a43=this[_0x26d9('0x81')](_0x26d9('0xa6'),'LUMENVOX_ASR_CONFIDENCE');if(_0x681a43[_0x26d9('0x9b')]===-0x1){return _0x681a43;}var _0x2b3eb8=this[_0x26d9('0x81')](_0x26d9('0xa7'),_0x26d9('0xa8'));if(_0x2b3eb8['result']===-0x1){return _0x2b3eb8;}var _0xdeabca=this['getAndSetVariable'](_0x26d9('0xa9'),_0x26d9('0xaa'));if(_0xdeabca[_0x26d9('0x9b')]===-0x1){return _0xdeabca;}return this[_0x26d9('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x86e29b));};AGIVertices[_0x26d9('0xe')][_0x26d9('0xab')]=function(_0x7cb5b6){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0xac'),_0x7cb5b6[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x7cb5b6[_0x26d9('0xa3')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xa4'));}var _0x12b28f=_0x7cb5b6[_0x26d9('0xa3')];if(this[_0x26d9('0x68')](_0x7cb5b6[_0x26d9('0x9a')])){_0x12b28f+=','+_0x7cb5b6[_0x26d9('0x9a')];}var _0x393d2a=this[_0x26d9('0xd')][_0x26d9('0x59')]('MRCPRecog',_0x12b28f);if(_0x393d2a[_0x26d9('0x9b')]===-0x1){return _0x393d2a;}var _0x5a2f38=this[_0x26d9('0x81')](_0x26d9('0xa6'),_0x26d9('0xad'));if(_0x5a2f38['result']===-0x1){return _0x5a2f38;}var _0x2d5e80=this[_0x26d9('0x81')](_0x26d9('0xa7'),_0x26d9('0xae'));if(_0x2d5e80[_0x26d9('0x9b')]===-0x1){return _0x2d5e80;}var _0x18a515=this['getAndSetVariable'](_0x26d9('0xa9'),_0x26d9('0xaf'));if(_0x18a515[_0x26d9('0x9b')]===-0x1){return _0x18a515;}return this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0xb0'),_0x12b28f));};AGIVertices[_0x26d9('0xe')]['database']=function(_0x4965ee){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x4965ee[_0x26d9('0x90')]));if(!this['isConfigured'](_0x4965ee[_0x26d9('0xb1')])){return this['channel'][_0x26d9('0x52')](_0x4965ee,'no\x20database\x20selected');}var _0x43e49c=this[_0x26d9('0x19')][_0x26d9('0x85')](this,_0x4965ee[_0x26d9('0xb1')]);if(!_0x43e49c){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x4965ee,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x4965ee[_0x26d9('0xb2')])){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x4965ee,_0x26d9('0xb3'));}var _0x35b6fd=_0x4965ee[_0x26d9('0xb2')][_0x26d9('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')]('query:\x20%s',_0x35b6fd));var _0x222dd3=this[_0x26d9('0x2e')][_0x26d9('0x85')](this,_0x43e49c,_0x35b6fd);this[_0x26d9('0x38')][_0x26d9('0x85')](this,_0x4965ee,_0x35b6fd);if(!this[_0x26d9('0x68')](_0x4965ee[_0x26d9('0xb4')])){return this['channel']['noop'](_0x26d9('0xb5'));}var _0x45f3f7=this[_0x26d9('0xf')]['sync'](this,_0x4965ee[_0x26d9('0xb4')]);if(!_0x45f3f7){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x4965ee,_0x26d9('0xb6'));}var _0x21eae8=this;_0x222dd3['forEach'](function(_0x4d581b,_0x1920ca){Object[_0x26d9('0xb7')](_0x4d581b)[_0x26d9('0xb8')](function(_0x3e0498){_0x21eae8[_0x26d9('0xd')][_0x26d9('0xb9')](util['format'](_0x26d9('0xba'),_0x45f3f7,_0x1920ca,_0x3e0498),_0x4d581b[_0x3e0498]);});});this[_0x26d9('0xd')][_0x26d9('0xb9')](util[_0x26d9('0x2c')]('%s_ROWS_COUNT',_0x45f3f7),_0x222dd3[_0x26d9('0x7f')]);return this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')]('variable\x20%s\x20set',_0x45f3f7));};AGIVertices[_0x26d9('0xe')]['dial']=function(_0x3d26bd){logger[_0x26d9('0xbb')](util[_0x26d9('0x2c')](_0x26d9('0xbc'),_0x3d26bd['label']));if(!this[_0x26d9('0x68')](_0x3d26bd[_0x26d9('0xbd')])){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x3d26bd,_0x26d9('0xbe'));}var _0x5bdb89=this[_0x26d9('0x1b')][_0x26d9('0x85')](this,_0x3d26bd[_0x26d9('0xbd')]);if(!_0x5bdb89){return this[_0x26d9('0xd')]['error'](_0x3d26bd,_0x26d9('0xbf'));}var _0x114114=this[_0x26d9('0xd')]['exec'](_0x26d9('0xc0'),[util[_0x26d9('0x2c')](_0x26d9('0xc1'),_0x5bdb89),_0x3d26bd[_0x26d9('0x8c')],_0x3d26bd[_0x26d9('0xc2')],_0x3d26bd['url']]);if(_0x114114[_0x26d9('0x9b')]===-0x1){return _0x114114;}return this[_0x26d9('0xd')][_0x26d9('0x96')](util['format'](_0x26d9('0xc3'),'DIAL'));};AGIVertices[_0x26d9('0xe')][_0x26d9('0xc4')]=function(_0x3a72c6){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0xc5'),_0x3a72c6[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x3a72c6[_0x26d9('0x60')])){return this[_0x26d9('0xd')]['noop'](_0x26d9('0xc6'));}if(!this[_0x26d9('0x68')](_0x3a72c6['text'])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x9e'));}this[_0x26d9('0xd')][_0x26d9('0xc7')]=!![];this[_0x26d9('0x38')](_0x3a72c6);this[_0x26d9('0x43')](_0x3a72c6[_0x26d9('0x5d')],'in');this[_0x26d9('0xd')]['noop'](util['format'](_0x26d9('0xc8'),_0x3a72c6[_0x26d9('0x5d')]));var _0x455211=this['googleDialogflow'][_0x26d9('0x85')](this,_0x3a72c6);if(_0x455211){for(var _0x19f410 in _0x455211){if(_0x455211[_0x26d9('0x7b')](_0x19f410)){this[_0x26d9('0xd')][_0x26d9('0xb9')](util[_0x26d9('0x2c')]('DIALOGFLOW_%s',_0x19f410['toUpperCase']()),_0x455211[_0x19f410]);}}this[_0x26d9('0x43')](_0x455211[_0x26d9('0xc9')],_0x26d9('0xca'));return this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0xcb'),_0x455211[_0x26d9('0xc9')]));}return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x3a72c6,_0x26d9('0xcc'));};AGIVertices[_0x26d9('0xe')][_0x26d9('0xcd')]=function(_0x56b4e2){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x56b4e2[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x56b4e2[_0x26d9('0xce')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xcf'));}if(!this[_0x26d9('0x68')](_0x56b4e2[_0x26d9('0xd0')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xd1'));}if(!this[_0x26d9('0x68')](_0x56b4e2['password'])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xd2'));}if(!this['isConfigured'](_0x56b4e2[_0x26d9('0xd3')])){return this['channel'][_0x26d9('0x96')](_0x26d9('0x9e'));}this[_0x26d9('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x56b4e2);this[_0x26d9('0x43')](_0x56b4e2['text'],'in');this[_0x26d9('0xd')]['noop'](util[_0x26d9('0x2c')](_0x26d9('0xd4'),_0x56b4e2['text']));var _0x4bb50c=this[_0x26d9('0x62')][_0x26d9('0x85')](this,_0x56b4e2);if(_0x4bb50c){for(var _0x79c4c1 in _0x4bb50c){if(_0x4bb50c[_0x26d9('0x7b')](_0x79c4c1)){this[_0x26d9('0xd')]['setVariable'](util[_0x26d9('0x2c')]('SESTEK_NDA_%s',_0x79c4c1[_0x26d9('0xd5')]()),_0x4bb50c[_0x79c4c1]);}}this['createSquareMessage'](_0x4bb50c[_0x26d9('0xc9')],'out');if(_0x4bb50c[_0x26d9('0xd6')]){this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x4bb50c[_0x26d9('0xd6')]));var _0x14630a=this[_0x26d9('0xd')]['streamFile'](_0x4bb50c[_0x26d9('0xd6')]);try{fs['unlink'](_0x4bb50c['audiofile']+_0x26d9('0xd7'));}catch(_0x1c002a){logger[_0x26d9('0x52')](_0x1c002a);}return _0x14630a;}else{return this[_0x26d9('0xd')]['noop'](util[_0x26d9('0x2c')]('SestekNDA\x20Result\x20%s',_0x4bb50c[_0x26d9('0xc9')]));}}return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x56b4e2,_0x26d9('0xd8'));};AGIVertices[_0x26d9('0xe')][_0x26d9('0xd9')]=function(_0x1fc49f){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0xda'),_0x1fc49f[_0x26d9('0x90')]));return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xd9'));};AGIVertices[_0x26d9('0xe')][_0x26d9('0xdb')]=function(_0x47ece7){logger[_0x26d9('0x31')](util['format'](_0x26d9('0xdc'),_0x47ece7['label']));var _0x5f5d30='';if(_0x47ece7[_0x26d9('0xdd')]){if(!this['isConfigured'](_0x47ece7['trunk_id'])){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x47ece7,_0x26d9('0xde'));}else{var _0x1fdc20=parseInt(_0x47ece7[_0x26d9('0xdd')],0xa);if(isNaN(_0x1fdc20)){_0x5f5d30=_0x47ece7['trunk_id'];}else{_0x5f5d30=this[_0x26d9('0x1d')]['sync'](this,_0x47ece7['trunk_id']);if(!_0x5f5d30){return this['channel'][_0x26d9('0x52')](_0x47ece7,_0x26d9('0xdf'));}}}}else if(_0x47ece7['trunk_name']){_0x5f5d30=_0x47ece7['trunk_name'];}else{return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x47ece7,'no\x20trunk\x20selected');}var _0x2a547a=this['channel']['exec'](_0x26d9('0xc0'),[util[_0x26d9('0x2c')]('SIP/%s/%s',_0x5f5d30,_0x47ece7[_0x26d9('0x49')]),_0x47ece7['timeout'],_0x47ece7[_0x26d9('0xc2')],_0x47ece7[_0x26d9('0xe0')]]);if(_0x2a547a['result']===-0x1){return _0x2a547a;}return this[_0x26d9('0xd')]['noop'](util[_0x26d9('0x2c')](_0x26d9('0xc3'),_0x26d9('0xc0')));};AGIVertices['prototype']['finally']=function(_0x506fbd){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x506fbd[_0x26d9('0x90')]));return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xe1'));};AGIVertices['prototype'][_0x26d9('0xe2')]=function(_0x2356dd){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0xe3'),_0x2356dd[_0x26d9('0x90')]));if(_0x2356dd[_0x26d9('0x86')]===0x0){return this[_0x26d9('0x84')](_0x2356dd);}_0x2356dd[_0x26d9('0x86')]-=0x1;if(!this[_0x26d9('0x68')](_0x2356dd[_0x26d9('0xe4')])){return this['channel'][_0x26d9('0x52')](_0x2356dd,_0x26d9('0xe5'));}var _0x221883=this[_0x26d9('0x1f')][_0x26d9('0x85')](this,_0x2356dd[_0x26d9('0xe4')]);if(!_0x221883){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x2356dd,_0x26d9('0xe6'));}if(!this[_0x26d9('0x68')](_0x2356dd[_0x26d9('0xb4')])){return this[_0x26d9('0xd')][_0x26d9('0x52')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x51ff7f=this[_0x26d9('0xd')][_0x26d9('0xe7')](_0x221883,_0x2356dd['response'],_0x2356dd[_0x26d9('0xe8')]);var _0x2b592c=_0x51ff7f[_0x26d9('0x9b')]?_0x51ff7f['result'][_0x26d9('0x4d')]():'';logger[_0x26d9('0x31')](_0x26d9('0xe9'),JSON[_0x26d9('0xea')](_0x51ff7f));if(_0x51ff7f['result']===-0x1){this[_0x26d9('0x38')]['sync'](this,_0x2356dd,_0x2b592c);return _0x51ff7f;}else if(_0x51ff7f[_0x26d9('0x83')]===_0x26d9('0x8c')){_0x51ff7f[_0x26d9('0x9b')]=_0x2b592c['length']>=parseInt(_0x2356dd[_0x26d9('0xeb')])?'x':'i';}else{_0x51ff7f[_0x26d9('0x9b')]=_0x2b592c['length']>=parseInt(_0x2356dd[_0x26d9('0xeb')])&&_0x2b592c[_0x26d9('0x7f')]<=parseInt(_0x2356dd['maxdigit'])?'x':'i';}var _0x398a4e=this[_0x26d9('0xf')][_0x26d9('0x85')](this,_0x2356dd['variable_id']);if(!_0x398a4e){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x2356dd,'no\x20variable\x20found');}this[_0x26d9('0xd')]['setVariable'](_0x398a4e,_0x2b592c);if(this[_0x26d9('0x68')](_0x2356dd[_0x26d9('0xec')])){var _0xea1b30=parseInt(_0x2356dd['hiddendigitsnum'],0xa);var _0x1804b0=rs['generate']({'charset':'*','length':_0xea1b30});var _0x93457=_0x2b592c[_0x26d9('0x7f')];if(_0x93457>0x0){if(_0x93457>_0xea1b30){this[_0x26d9('0x38')][_0x26d9('0x85')](this,_0x2356dd,_0x2356dd[_0x26d9('0xed')]===_0x26d9('0xee')?_0x1804b0+_0x2b592c[_0x26d9('0xef')](_0xea1b30):_0x2b592c[_0x26d9('0xef')](0x0,_0x93457-_0xea1b30)+_0x1804b0);}else{this[_0x26d9('0x38')][_0x26d9('0x85')](this,_0x2356dd,rs[_0x26d9('0xf0')]({'charset':'*','length':_0x93457}));}}else{this[_0x26d9('0x38')][_0x26d9('0x85')](this,_0x2356dd,'');}}else{this[_0x26d9('0x38')]['sync'](this,_0x2356dd,_0x2b592c);}return _0x51ff7f;};AGIVertices['prototype'][_0x26d9('0xf1')]=function(_0x25dec0){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0xf2'),_0x25dec0[_0x26d9('0x90')]));return this[_0x26d9('0xe2')](_0x25dec0);};AGIVertices[_0x26d9('0xe')][_0x26d9('0xf3')]=function(_0x1cfb14){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0xf4'),_0x1cfb14['label']));this[_0x26d9('0x38')]['sync'](this,_0x1cfb14,_0x1cfb14[_0x26d9('0xf5')]);return this['channel'][_0x26d9('0x96')](util['format'](_0x26d9('0xf6'),_0x1cfb14[_0x26d9('0xf5')]));};AGIVertices[_0x26d9('0xe')][_0x26d9('0xf7')]=function(_0x2306e2){logger['info'](util['format'](_0x26d9('0xf8'),_0x2306e2['label']));if(!this[_0x26d9('0x68')](_0x2306e2[_0x26d9('0x6b')])||!this['isConfigured'](_0x2306e2[_0x26d9('0x6c')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xf9'));}if(!this[_0x26d9('0x68')](_0x2306e2[_0x26d9('0x5d')])){return this['channel'][_0x26d9('0x96')](_0x26d9('0x9e'));}this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0xfa'),_0x2306e2[_0x26d9('0x5d')]));var _0xdf31b8=this[_0x26d9('0x6a')][_0x26d9('0x85')](this,_0x2306e2);if(_0xdf31b8){this['channel'][_0x26d9('0x96')](util['format'](_0x26d9('0xfb'),_0xdf31b8));var _0x271031=this[_0x26d9('0xd')][_0x26d9('0xfc')](_0xdf31b8);try{fs['unlink'](_0xdf31b8+_0x26d9('0xd7'));}catch(_0x407a92){logger[_0x26d9('0x52')](_0x407a92);}return _0x271031;}return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x2306e2,_0x26d9('0xfd'));};AGIVertices[_0x26d9('0xe')][_0x26d9('0xfe')]=function(_0x2a2059){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0xff'),_0x2a2059[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x2a2059[_0x26d9('0x6b')])||!this[_0x26d9('0x68')](_0x2a2059[_0x26d9('0x6c')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xf9'));}if(!this['isConfigured'](_0x2a2059[_0x26d9('0x100')])){return this[_0x26d9('0xd')][_0x26d9('0x96')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x2a2059[_0x26d9('0x5d')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x9e'));}this[_0x26d9('0xd')][_0x26d9('0xc7')]=!![];this['createSquareDetailsReport'](_0x2a2059);this[_0x26d9('0x43')](_0x2a2059['text'],'in');this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x101'),_0x2a2059[_0x26d9('0x5d')]));var _0xd4eba1=this['awsLex'][_0x26d9('0x85')](this,_0x2a2059);if(_0xd4eba1){for(var _0x103775 in _0xd4eba1){if(_0xd4eba1[_0x26d9('0x7b')](_0x103775)&&_[_0x26d9('0x7c')](_0xd4eba1[_0x103775])){this[_0x26d9('0xd')][_0x26d9('0xb9')](util['format'](_0x26d9('0x102'),_0x103775[_0x26d9('0xd5')]()),_0xd4eba1[_0x103775]);}}if(_['isNil'](_0xd4eba1[_0x26d9('0x103')])){return this['channel'][_0x26d9('0x96')](_0x26d9('0x104'));}else{this['createSquareMessage'](_0xd4eba1[_0x26d9('0x103')],_0x26d9('0xca'));return this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')]('Amazon\x20Lex\x20Result\x20%s',_0xd4eba1[_0x26d9('0x103')]));}}return this['channel'][_0x26d9('0x52')](_0x2a2059,_0x26d9('0x105'));};AGIVertices[_0x26d9('0xe')][_0x26d9('0x106')]=function(_0xecd411){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x107'),_0xecd411[_0x26d9('0x90')],_0xecd411[_0x26d9('0x8c')]));if(!this[_0x26d9('0x68')](_0xecd411['key'])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xc6'));}var _0x1874f4=_0x26d9('0x108');var _0x5f1f2c=util[_0x26d9('0x2c')](_0x26d9('0x109'),FILES_PATH,rs[_0x26d9('0xf0')](0x4));var _0x53f455=util[_0x26d9('0x2c')](_0x26d9('0x10a'),_0x5f1f2c,_0x1874f4);var _0x19a010=!![];if(_0xecd411['beep']==='NOBEEP'){_0x19a010=![];}var _0xb80bce=this['channel'][_0x26d9('0x10b')](_0x5f1f2c,_0x1874f4,_0xecd411[_0x26d9('0x10c')],_0xecd411[_0x26d9('0x8c')],undefined,_0x19a010);if(_0xb80bce[_0x26d9('0x9b')]!==-0x1){this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')]('google\x20%s\x20file\x20created',_0x53f455));var _0x52802b=this['googleASR'][_0x26d9('0x85')](this,_0xecd411,_0x53f455);if(_0x52802b){for(var _0x2713c0 in _0x52802b){if(_0x52802b[_0x26d9('0x7b')](_0x2713c0)){this['channel'][_0x26d9('0xb9')](util[_0x26d9('0x2c')](_0x26d9('0x10d'),_0x2713c0[_0x26d9('0xd5')]()),_0x52802b[_0x2713c0]);}}return this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x10e'),JSON[_0x26d9('0xea')](_0x52802b)));}}return _0xb80bce;};AGIVertices['prototype']['tildeasr']=function(_0x46ab32){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x10f'),_0x46ab32['label']));if(!this['isConfigured'](_0x46ab32['appid'])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x110'));}if(!this[_0x26d9('0x68')](_0x46ab32[_0x26d9('0x76')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x111'));}var _0xe00ace=_0x26d9('0x108');var _0x367dcf=util[_0x26d9('0x2c')](_0x26d9('0x109'),FILES_PATH,rs[_0x26d9('0xf0')](0x4));var _0x503d81=util[_0x26d9('0x2c')](_0x26d9('0x10a'),_0x367dcf,_0xe00ace);var _0x4c167c=!![];if(_0x46ab32[_0x26d9('0x112')]===_0x26d9('0x113')){_0x4c167c=![];}var _0x504db1=this[_0x26d9('0xd')][_0x26d9('0x10b')](_0x367dcf,_0xe00ace,_0x46ab32[_0x26d9('0x10c')],_0x46ab32[_0x26d9('0x8c')],undefined,_0x4c167c);if(_0x504db1['result']!==-0x1){this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x114'),_0x503d81));var _0x3e951e=this[_0x26d9('0x74')][_0x26d9('0x85')](this,_0x46ab32,_0x503d81);if(_0x3e951e){for(var _0x17c7a2 in _0x3e951e){if(_0x3e951e[_0x26d9('0x7b')](_0x17c7a2)){this[_0x26d9('0xd')][_0x26d9('0xb9')](util['format'](_0x26d9('0x115'),_0x17c7a2[_0x26d9('0xd5')]()),_0x3e951e[_0x17c7a2]);}}return this[_0x26d9('0xd')][_0x26d9('0x96')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x26d9('0xea')](_0x3e951e)));}}return _0x504db1;};AGIVertices['prototype'][_0x26d9('0x116')]=function(_0x4b49df){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x117'),_0x4b49df['label']));return this[_0x26d9('0xd')]['continueAt'](_0x4b49df['context'],_0x4b49df[_0x26d9('0x118')],_0x4b49df[_0x26d9('0x3f')]);};AGIVertices[_0x26d9('0xe')][_0x26d9('0x119')]=function(_0x36a01e){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x11a'),_0x36a01e[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x36a01e[_0x26d9('0x11b')])){return this['channel']['error'](_0x36a01e,'no\x20condition\x20configured');}try{var _0x32ba83=eval(_0x36a01e['condition'])?_0x26d9('0x11c'):'false';this[_0x26d9('0xd')][_0x26d9('0x96')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x36a01e['condition'],_0x32ba83));return{'code':0xc8,'result':_0x32ba83};}catch(_0x15c618){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x26d9('0xe')][_0x26d9('0x11d')]=function(_0x3c2116){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x11e'),_0x3c2116[_0x26d9('0x90')]));if(!this['isConfigured'](_0x3c2116[_0x26d9('0x11f')])){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x3c2116,_0x26d9('0x120'));}var _0x3cb071=this['getIntervals'][_0x26d9('0x85')](this,_0x3c2116[_0x26d9('0x11f')]);if(!_0x3cb071){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x3c2116,_0x26d9('0x121'));}for(var _0x110d77=0x0;_0x110d77<_0x3cb071[_0x26d9('0x7f')];_0x110d77+=0x1){var _0x7aa94b=this[_0x26d9('0xd')]['getVariable'](util[_0x26d9('0x2c')](_0x26d9('0x122'),_0x3cb071[_0x110d77]));if(_0x7aa94b[_0x26d9('0x9b')]===-0x1){return _0x7aa94b;}logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x123'),_0x3cb071[_0x110d77],_0x7aa94b['extra']));if(_0x7aa94b[_0x26d9('0x83')]===_0x26d9('0x11c')){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x123'),_0x3cb071[_0x110d77],'true'));this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x123'),_0x3cb071[_0x110d77],_0x26d9('0x11c')));return{'code':0xc8,'result':_0x26d9('0x11c')};}else{logger[_0x26d9('0x31')](util['format'](_0x26d9('0x123'),_0x3cb071[_0x110d77],'false'));this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')]('IFTIME\x20%s\x20%s',_0x3cb071[_0x110d77],_0x26d9('0x124')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x26d9('0xe')]['hangup']=function(_0xead59c){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x125'),_0xead59c[_0x26d9('0x90')]));return this['channel'][_0x26d9('0x126')]();};AGIVertices[_0x26d9('0xe')][_0x26d9('0x127')]=function(_0x34828b){logger[_0x26d9('0x31')](util['format'](_0x26d9('0x128'),_0x34828b[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x34828b[_0x26d9('0x60')])){return this['channel'][_0x26d9('0x96')](_0x26d9('0xc6'));}var _0xa8bf60=_0x26d9('0x108');var _0x1fb9f5=util[_0x26d9('0x2c')](_0x26d9('0x109'),FILES_PATH,rs[_0x26d9('0xf0')](0x4));var _0x1e77a4=util[_0x26d9('0x2c')](_0x26d9('0x10a'),_0x1fb9f5,_0xa8bf60);var _0xb415a8=!![];if(_0x34828b[_0x26d9('0x112')]===_0x26d9('0x113')){_0xb415a8=![];}var _0x367a4c=this[_0x26d9('0xd')]['recordFile'](_0x1fb9f5,_0xa8bf60,_0x34828b[_0x26d9('0x10c')],_0x34828b[_0x26d9('0x8c')],undefined,_0xb415a8);if(_0x367a4c[_0x26d9('0x9b')]!==-0x1){this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x129'),_0x1e77a4));var _0x13b82f=this[_0x26d9('0x66')]['sync'](this,_0x34828b,_0x1e77a4);if(_0x13b82f){for(var _0xc871db in _0x13b82f){if(_0x13b82f[_0x26d9('0x7b')](_0xc871db)){this[_0x26d9('0xd')][_0x26d9('0xb9')](util[_0x26d9('0x2c')](_0x26d9('0x12a'),_0xc871db['toUpperCase']()),_0x13b82f[_0xc871db]);}}return this[_0x26d9('0xd')]['noop'](util['format'](_0x26d9('0x12b'),JSON[_0x26d9('0xea')](_0x13b82f)));}}return _0x367a4c;};AGIVertices[_0x26d9('0xe')][_0x26d9('0x12c')]=function(_0x4a2601){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x12d'),_0x4a2601[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x4a2601['key'])){return this['channel'][_0x26d9('0x96')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x4a2601[_0x26d9('0x5d')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x9e'));}this[_0x26d9('0xd')][_0x26d9('0x96')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x4a2601[_0x26d9('0x5d')]));var _0x48635c=this[_0x26d9('0x63')][_0x26d9('0x85')](this,_0x4a2601);if(_0x48635c){this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')]('ispeech\x20%s\x20file\x20created',_0x48635c));var _0x25394d=this['channel'][_0x26d9('0xfc')](_0x48635c,_0x4a2601['intKey']);try{fs[_0x26d9('0x12e')](_0x48635c+'.wav');}catch(_0x56b696){logger[_0x26d9('0x52')](_0x56b696);}return _0x25394d;}return this['channel'][_0x26d9('0x52')](_0x4a2601,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x26d9('0xe')][_0x26d9('0x12f')]=function(_0x45a91c){logger[_0x26d9('0x31')](util['format'](_0x26d9('0x130'),_0x45a91c['label']));if(!this[_0x26d9('0x68')](_0x45a91c['findBy'])){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x45a91c,_0x26d9('0x131'));}logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x132'),this[_0x26d9('0xd')][_0x26d9('0x3c')],_0x45a91c['findBy']));var _0x1254d4=this[_0x26d9('0x133')][_0x26d9('0x85')](this,_0x45a91c['findBy']);if(_0x1254d4){logger[_0x26d9('0x31')](util['format'](_0x26d9('0x134'),this['channel'][_0x26d9('0x3c')],_0x45a91c['findBy']));this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x134'),this[_0x26d9('0xd')][_0x26d9('0x3c')],_0x45a91c[_0x26d9('0x135')]));return{'code':0xc8,'result':_0x26d9('0x136')};}else{logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x137'),this['channel'][_0x26d9('0x3c')],_0x45a91c[_0x26d9('0x135')]));this[_0x26d9('0xd')]['noop'](util[_0x26d9('0x2c')](_0x26d9('0x137'),this[_0x26d9('0xd')][_0x26d9('0x3c')],_0x45a91c[_0x26d9('0x135')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x26d9('0x138')]=function(_0x20f609){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x139'),_0x20f609[_0x26d9('0x90')]));if(!this['isConfigured'](_0x20f609['findBy'])){return this['channel']['error'](_0x20f609,_0x26d9('0x131'));}logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x132'),this[_0x26d9('0xd')]['callerid'],_0x20f609['findBy']));var _0x30979f=this[_0x26d9('0x54')][_0x26d9('0x85')](this,_0x20f609[_0x26d9('0x135')]);if(_0x30979f){logger[_0x26d9('0x31')](util['format'](_0x26d9('0x134'),this['channel'][_0x26d9('0x3c')],_0x20f609[_0x26d9('0x135')]));this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x134'),this[_0x26d9('0xd')]['callerid'],_0x20f609['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x137'),this[_0x26d9('0xd')][_0x26d9('0x3c')],_0x20f609[_0x26d9('0x135')]));this[_0x26d9('0xd')][_0x26d9('0x96')](util['format'](_0x26d9('0x137'),this[_0x26d9('0xd')]['callerid'],_0x20f609[_0x26d9('0x135')]));return{'code':0xc8,'result':_0x26d9('0x13a')};}};AGIVertices[_0x26d9('0xe')][_0x26d9('0x13b')]=function(_0x5c9b0e){logger['info'](util[_0x26d9('0x2c')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x5c9b0e[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x5c9b0e[_0x26d9('0x13c')])){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x5c9b0e,_0x26d9('0x13d'));}this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')]('math\x20%s',_0x5c9b0e[_0x26d9('0x13c')]));var _0x44d19f=eval(_0x5c9b0e[_0x26d9('0x13c')]);if(!this[_0x26d9('0x68')](_0x5c9b0e[_0x26d9('0xb4')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xb5'));}var _0x33cd65=this[_0x26d9('0xf')]['sync'](this,_0x5c9b0e[_0x26d9('0xb4')]);if(!_0x33cd65){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x5c9b0e,_0x26d9('0xb6'));}if(_[_0x26d9('0x13e')](_0x44d19f)){var _0x4f79ff=this;_0x44d19f['forEach'](function(_0x20b62c,_0x2e14ce){_0x4f79ff['channel'][_0x26d9('0xb9')](util[_0x26d9('0x2c')]('%s[%s]',_0x33cd65,_0x2e14ce),_0x20b62c);});return this[_0x26d9('0xd')]['noop'](util[_0x26d9('0x2c')](_0x26d9('0x13f'),_0x33cd65));}else{return this[_0x26d9('0xd')][_0x26d9('0xb9')](_0x33cd65,_0x44d19f);}};AGIVertices['prototype'][_0x26d9('0xc')]=function(_0x515c36){logger[_0x26d9('0x31')](util['format'](_0x26d9('0x140'),_0x515c36[_0x26d9('0x90')]));if(_0x515c36[_0x26d9('0x86')]===0x0){return this[_0x26d9('0x84')](_0x515c36);}_0x515c36[_0x26d9('0x86')]-=0x1;if(!this[_0x26d9('0x68')](_0x515c36[_0x26d9('0xe4')])){return this['channel'][_0x26d9('0x52')](_0x515c36,_0x26d9('0xe5'));}var _0x119bd7=this['getSound']['sync'](this,_0x515c36['file_id']);if(!_0x119bd7){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x515c36,'no\x20file\x20audio\x20found');}var _0x25404b=this[_0x26d9('0xd')][_0x26d9('0xe7')](_0x119bd7,_0x515c36[_0x26d9('0x141')],_0x515c36[_0x26d9('0x142')]);var _0x3e9d44=_0x25404b['result'];if(_0x25404b[_0x26d9('0x9b')]===-0x1){this[_0x26d9('0x38')][_0x26d9('0x85')](this,_0x515c36,'-1');return _0x25404b;}else if(_0x25404b[_0x26d9('0x83')]===_0x26d9('0x8c')){_0x25404b[_0x26d9('0x9b')]=_0x25404b['result'][_0x26d9('0x7f')]>0x0?_0x25404b['result']:'t';}else if(_[_0x26d9('0x45')](_0x25404b['result'])){_0x25404b[_0x26d9('0x9b')]='#';_0x3e9d44='#';}if(!this['isConfigured'](_0x515c36[_0x26d9('0xb4')])){this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0xb5'));}else{var _0x341d73=this['getVariable'][_0x26d9('0x85')](this,_0x515c36['variable_id']);if(!_0x341d73){return this['channel'][_0x26d9('0x52')](_0x515c36,'no\x20variable\x20found');}this['channel'][_0x26d9('0xb9')](_0x341d73,_0x3e9d44);}this[_0x26d9('0x38')]['sync'](this,_0x515c36,_0x3e9d44);return _0x25404b;};AGIVertices[_0x26d9('0xe')][_0x26d9('0x96')]=function(_0x4ac03c){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x143'),_0x4ac03c[_0x26d9('0x90')]));return this['channel']['noop'](_0x4ac03c['output']||_0x4ac03c[_0x26d9('0x90')]);};AGIVertices[_0x26d9('0xe')][_0x26d9('0x144')]=function(_0x4480b8){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4480b8[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x4480b8[_0x26d9('0x135')])){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x4480b8,'no\x20find\x20by\x20configured');}logger[_0x26d9('0x31')](util['format'](_0x26d9('0x132'),this[_0x26d9('0xd')]['callerid'],_0x4480b8[_0x26d9('0x135')]));var _0x553ed9=this['getPause'][_0x26d9('0x85')](this,_0x4480b8[_0x26d9('0x145')]);var _0x261b0b=this[_0x26d9('0x4f')][_0x26d9('0x85')](this,_0x4480b8[_0x26d9('0x135')],_0x553ed9);if(_0x261b0b){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x134'),this[_0x26d9('0xd')][_0x26d9('0x3c')],_0x4480b8['findBy']));this['channel']['noop'](util[_0x26d9('0x2c')](_0x26d9('0x134'),this[_0x26d9('0xd')][_0x26d9('0x3c')],_0x4480b8[_0x26d9('0x135')]));return{'code':0xc8,'result':'success'};}else{logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x137'),this[_0x26d9('0xd')][_0x26d9('0x3c')],_0x4480b8[_0x26d9('0x135')]));this[_0x26d9('0xd')][_0x26d9('0x96')](util['format'](_0x26d9('0x134'),this[_0x26d9('0xd')][_0x26d9('0x3c')],_0x4480b8[_0x26d9('0x135')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x26d9('0xe')][_0x26d9('0x146')]=function(_0x3e1c4a){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x147'),_0x3e1c4a[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x3e1c4a[_0x26d9('0xe4')])){return this[_0x26d9('0xd')]['error'](_0x3e1c4a,_0x26d9('0xe5'));}var _0x1de655=this[_0x26d9('0x1f')][_0x26d9('0x85')](this,_0x3e1c4a[_0x26d9('0xe4')]);if(!_0x1de655){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x3e1c4a,_0x26d9('0xe6'));}var _0x442529=this[_0x26d9('0xd')][_0x26d9('0x59')](_0x26d9('0x148'),[_0x1de655,_0x3e1c4a[_0x26d9('0xc2')]]);if(_0x442529[_0x26d9('0x9b')]===-0x1){return _0x442529;}return this[_0x26d9('0xd')][_0x26d9('0x96')](util['format'](_0x26d9('0x9c'),_0x26d9('0x148'),_0x1de655));};AGIVertices['prototype'][_0x26d9('0x149')]=function(_0x2fb01a){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x14a'),_0x2fb01a[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x2fb01a[_0x26d9('0x14b')])){return this['channel'][_0x26d9('0x52')](_0x2fb01a,_0x26d9('0x14c'));}var _0x1720db='';var _0x374f86=parseInt(_0x2fb01a[_0x26d9('0x14b')],0xa);if(isNaN(_0x374f86)){_0x1720db=_0x2fb01a[_0x26d9('0x14b')];}else{_0x1720db=this[_0x26d9('0x14')]['sync'](this,_0x2fb01a[_0x26d9('0x14b')]);if(!_0x1720db){return this['channel'][_0x26d9('0x52')](_0x2fb01a,_0x26d9('0x14d'));}}var _0x715436='';if(this[_0x26d9('0x68')](_0x2fb01a[_0x26d9('0xe4')])){var _0x14ac93=this['getSound']['sync'](this,_0x2fb01a['file_id']);if(_0x14ac93){_0x715436=_0x14ac93;}}this[_0x26d9('0x38')][_0x26d9('0x85')](this,_0x2fb01a,_0x1720db);if(_0x2fb01a[_0x26d9('0xc2')]['indexOf']('x')<0x0){_0x2fb01a[_0x26d9('0xc2')]+='x';}if(_0x2fb01a['opts'][_0x26d9('0x14e')]('X')<0x0){_0x2fb01a['opts']+='X';}this[_0x26d9('0xd')][_0x26d9('0xb9')](_0x26d9('0x14f'),_0x1720db?_0x1720db['toLowerCase']():'');var _0x14354f=this['channel']['exec'](_0x26d9('0x150'),[_0x1720db,_0x2fb01a[_0x26d9('0xc2')],_0x2fb01a[_0x26d9('0xe0')],_0x715436,_0x2fb01a[_0x26d9('0x8c')],_0x2fb01a[_0x26d9('0x8')],_0x2fb01a[_0x26d9('0x151')],_0x2fb01a['gosub'],'',_0x2fb01a[_0x26d9('0x152')]]);if(_0x14354f[_0x26d9('0x9b')]===-0x1){return _0x14354f;}return this['channel']['noop'](util['format'](_0x26d9('0x9c'),'QUEUE',_0x1720db));};AGIVertices[_0x26d9('0xe')][_0x26d9('0x153')]=function(_0xf257f5){logger[_0x26d9('0x31')](util['format'](_0x26d9('0x154'),_0xf257f5[_0x26d9('0x90')]));var _0x2cb73a=_0xf257f5[_0x26d9('0x155')]||_0x26d9('0x108');var _0x4b9dc7=util[_0x26d9('0x2c')](_0x26d9('0x156'),this['channel'][_0x26d9('0x39')],rs['generate'](0x5));var _0x489347=util[_0x26d9('0x2c')](_0x26d9('0x157'),FILES_PATH,_0x4b9dc7,_0x2cb73a);var _0x4714f6=util[_0x26d9('0x2c')]('%s/recordings/%s',FILES_PATH,_0x4b9dc7);this[_0x26d9('0x3b')][_0x26d9('0x85')](this,_0xf257f5,_0x4b9dc7,_0x489347);this[_0x26d9('0xd')][_0x26d9('0xb9')](_0x26d9('0x158'),_0x4b9dc7);logger[_0x26d9('0x31')](_0x26d9('0x159'),_0x4714f6,_0x2cb73a,_0xf257f5['escape_digits'],_0xf257f5[_0x26d9('0x8c')]);return this[_0x26d9('0xd')][_0x26d9('0x10b')](_0x4714f6,_0x2cb73a,_0xf257f5[_0x26d9('0x15a')],_0xf257f5['timeout'],undefined,!![]);};AGIVertices[_0x26d9('0xe')]['saydigits']=function(_0x31f930){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x15b'),_0x31f930[_0x26d9('0x90')]));return this[_0x26d9('0xd')]['sayDigits'](_0x31f930[_0x26d9('0x15c')]['replace'](/\s+/g,''),_0x31f930[_0x26d9('0x15a')]);};AGIVertices[_0x26d9('0xe')][_0x26d9('0x15d')]=function(_0x398f40){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x398f40[_0x26d9('0x90')]));return this[_0x26d9('0xd')]['sayNumber'](_0x398f40['number'][_0x26d9('0x5b')](/\s+/g,''),_0x398f40['escape_digits']);};AGIVertices[_0x26d9('0xe')][_0x26d9('0x15e')]=function(_0x412ec8){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x15f'),_0x412ec8['label']));return this[_0x26d9('0xd')][_0x26d9('0x160')](_0x412ec8[_0x26d9('0x5d')],_0x412ec8['escape_digits']);};AGIVertices[_0x26d9('0xe')][_0x26d9('0x161')]=function(_0x450a2f){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x162'),_0x450a2f['label']));if(!this[_0x26d9('0x68')](_0x450a2f[_0x26d9('0x163')])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x164'));}var _0x93eba5=this[_0x26d9('0x23')][_0x26d9('0x85')](this,_0x450a2f[_0x26d9('0x163')]);if(!_0x93eba5||!_0x93eba5[_0x26d9('0x165')]){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x450a2f,_0x26d9('0x166'));}var _0x34bb52={'from':util[_0x26d9('0x2c')](_0x26d9('0x167'),_0x93eba5[_0x26d9('0x12')],_0x93eba5[_0x26d9('0x168')]||_0x93eba5[_0x26d9('0x165')][_0x26d9('0x169')]),'to':_0x450a2f['to']||'','cc':_0x450a2f['cc']||'','bcc':_0x450a2f[_0x26d9('0x16a')]||'','subject':_0x450a2f[_0x26d9('0x16b')],'html':_0x450a2f[_0x26d9('0x5d')],'text':_0x450a2f['text']};var _0x93701b={'tls':{'rejectUnauthorized':![]}};if(_0x93eba5['Smtp'][_0x26d9('0x16c')]){_0x93701b['service']=_0x93eba5[_0x26d9('0x165')][_0x26d9('0x16c')];}else{_0x93701b[_0x26d9('0x16d')]=_0x93eba5[_0x26d9('0x165')][_0x26d9('0x16d')];_0x93701b[_0x26d9('0x16e')]=_0x93eba5[_0x26d9('0x165')][_0x26d9('0x16e')];_0x93701b[_0x26d9('0x16f')]=_0x93eba5['Smtp'][_0x26d9('0x16f')];}if(_0x93eba5[_0x26d9('0x165')]['authentication']){_0x93701b[_0x26d9('0x170')]={'user':_0x93eba5[_0x26d9('0x165')][_0x26d9('0x169')],'pass':_0x93eba5[_0x26d9('0x165')][_0x26d9('0x171')]};}if(this[_0x26d9('0x68')](_0x450a2f[_0x26d9('0x172')])){}logger[_0x26d9('0xbb')](_0x26d9('0x173'),JSON[_0x26d9('0xea')](_0x34bb52));this[_0x26d9('0x38')][_0x26d9('0x85')](this,_0x450a2f,_0x450a2f[_0x26d9('0x163')]);this['channel'][_0x26d9('0x96')](util['format'](_0x26d9('0x174'),_0x93eba5[_0x26d9('0x12')]));this['sendMailMessage'][_0x26d9('0x85')](this,_0x93701b,_0x34bb52);return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x175'));};AGIVertices[_0x26d9('0xe')]['sendFax']=function(_0x173abf){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x176'),_0x173abf['label']));return this[_0x26d9('0xd')][_0x26d9('0x96')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x26d9('0xe')][_0x26d9('0x177')]=function(_0x292e48){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x178'),_0x292e48[_0x26d9('0x90')]));if(!this[_0x26d9('0x68')](_0x292e48[_0x26d9('0x179')])){return this['channel'][_0x26d9('0x96')](_0x26d9('0x17a'));}var _0x38126e=this[_0x26d9('0x35')][_0x26d9('0x85')](this,_0x292e48['sms_account_id']);if(!_0x38126e){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x292e48,'no\x20sms\x20account\x20found');}var _0x138bfe={'body':_0x292e48[_0x26d9('0x17b')],'phone':_0x292e48['to']||'','SmsAccountId':_0x38126e['id']};logger[_0x26d9('0xbb')]('sendSMS\x20message',JSON[_0x26d9('0xea')](_0x138bfe));this[_0x26d9('0x38')][_0x26d9('0x85')](this,_0x292e48,_0x292e48[_0x26d9('0x179')]);this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x17c'),_0x38126e['name']));this[_0x26d9('0x37')][_0x26d9('0x85')](this,_0x138bfe);return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x17d'));};AGIVertices['prototype'][_0x26d9('0x17e')]=function(_0x1c9a3e){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x17f'),_0x1c9a3e['label']));if(!this['isConfigured'](_0x1c9a3e[_0x26d9('0xb4')])){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0x1c9a3e,_0x26d9('0x180'));}var _0x56fca6=this[_0x26d9('0xf')][_0x26d9('0x85')](this,_0x1c9a3e[_0x26d9('0xb4')]);if(!_0x56fca6){return this['channel']['error'](_0x1c9a3e,'no\x20variable\x20found');}return this[_0x26d9('0xd')]['setVariable'](_0x56fca6,_0x1c9a3e[_0x26d9('0x181')]);};AGIVertices[_0x26d9('0xe')][_0x26d9('0x182')]=function(_0x4b4e50){logger['info'](util[_0x26d9('0x2c')](_0x26d9('0x183'),_0x4b4e50[_0x26d9('0x90')]));this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x184'));if(_0x4b4e50[_0x26d9('0x8a')]==='yes'){this[_0x26d9('0xd')]['noop'](_0x26d9('0x185'));return this[_0x26d9('0xd')][_0x26d9('0x8a')]();}return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x186'));};AGIVertices[_0x26d9('0xe')][_0x26d9('0x187')]=function(_0x56d9b0){logger['info'](util[_0x26d9('0x2c')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x56d9b0['label']));if(!this[_0x26d9('0x68')](_0x56d9b0[_0x26d9('0x188')])){return this['channel'][_0x26d9('0x52')](_0x56d9b0,_0x26d9('0x189'));}var _0x411ae4=this[_0x26d9('0x17')][_0x26d9('0x85')](this,_0x56d9b0['project_id']);if(!this['isConfigured'](_0x411ae4)){return this[_0x26d9('0xd')]['error'](_0x56d9b0,util[_0x26d9('0x2c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x56d9b0['project_id']));}if(_0x411ae4===this['channel'][_0x26d9('0x42')]){return this['channel']['error'](_0x56d9b0,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x26d9('0x85')](this,_0x56d9b0,_0x411ae4);var _0xebf73f=this[_0x26d9('0xd')]['exec'](_0x26d9('0x18a'),util[_0x26d9('0x2c')](_0x26d9('0x18b'),config[_0x26d9('0x8')][_0x26d9('0x16d')]||_0x26d9('0x18c'),_0x411ae4,this['channel'][_0x26d9('0x42')]));if(_0xebf73f[_0x26d9('0x9b')]===-0x1){return _0xebf73f;}return this[_0x26d9('0xd')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x26d9('0x18a'),_0x411ae4));};AGIVertices[_0x26d9('0xe')]['system']=function(_0x2bd499){logger['info'](util['format'](_0x26d9('0x18d'),_0x2bd499['label']));var _0x3bed5b=this['shellCommand']['sync'](this,_0x2bd499['command']);this[_0x26d9('0x38')][_0x26d9('0x85')](this,_0x2bd499,_0x2bd499[_0x26d9('0x88')]);if(this[_0x26d9('0x68')](_0x2bd499['variable_id'])){var _0x64bbda=this[_0x26d9('0xf')][_0x26d9('0x85')](this,_0x2bd499[_0x26d9('0xb4')]);if(_0x64bbda){this[_0x26d9('0xd')][_0x26d9('0xb9')](_0x64bbda,_0x3bed5b);return this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x18e'),_0x2bd499[_0x26d9('0x88')],_0x64bbda));}}return this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x18f'),_0x2bd499[_0x26d9('0x88')]));};AGIVertices[_0x26d9('0xe')]['tts']=function(_0x426567){logger['info'](util[_0x26d9('0x2c')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x426567[_0x26d9('0x90')]));if(!this['isConfigured'](_0x426567['text'])){return this[_0x26d9('0xd')][_0x26d9('0x96')](_0x26d9('0x9e'));}this[_0x26d9('0xd')][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x190'),_0x426567['text']));var _0x1f5f32=this[_0x26d9('0x5c')][_0x26d9('0x85')](this,_0x426567);if(_0x1f5f32){this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')]('Google\x20TTS\x20%s\x20file\x20created',_0x1f5f32));var _0x56338d=this[_0x26d9('0xd')][_0x26d9('0xfc')](_0x1f5f32);try{fs[_0x26d9('0x12e')](_0x1f5f32+_0x26d9('0xd7'));}catch(_0x585de9){logger[_0x26d9('0x52')](_0x585de9);}return _0x56338d;}return this['channel'][_0x26d9('0x52')](_0x426567,_0x26d9('0x191'));};AGIVertices[_0x26d9('0xe')][_0x26d9('0x192')]=function(_0xd5f474){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x193'),_0xd5f474[_0x26d9('0x90')]));if(!this['isConfigured'](_0xd5f474['findBy'])){return this[_0x26d9('0xd')][_0x26d9('0x52')](_0xd5f474,'no\x20find\x20by\x20configured');}logger[_0x26d9('0x31')](util['format'](_0x26d9('0x132'),this[_0x26d9('0xd')][_0x26d9('0x3c')],_0xd5f474[_0x26d9('0x135')]));var _0x487308=this['agentUnpause'][_0x26d9('0x85')](this,_0xd5f474[_0x26d9('0x135')]);if(_0x487308){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x134'),this[_0x26d9('0xd')][_0x26d9('0x3c')],_0xd5f474[_0x26d9('0x135')]));this['channel']['noop'](util[_0x26d9('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x26d9('0xd')][_0x26d9('0x3c')],_0xd5f474[_0x26d9('0x135')]));return{'code':0xc8,'result':_0x26d9('0x136')};}else{logger[_0x26d9('0x31')](util[_0x26d9('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x26d9('0x3c')],_0xd5f474[_0x26d9('0x135')]));this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')](_0x26d9('0x137'),this['channel']['callerid'],_0xd5f474[_0x26d9('0x135')]));return{'code':0xc8,'result':_0x26d9('0x13a')};}};AGIVertices[_0x26d9('0xe')][_0x26d9('0x194')]=function(_0x516957){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x195'),_0x516957['label']));var _0x15091f=this['channel']['exec'](_0x26d9('0x196'),[_0x516957['mailbox'],_0x516957[_0x26d9('0x9a')]]);if(_0x15091f[_0x26d9('0x9b')]===-0x1){return _0x15091f;}return this['channel'][_0x26d9('0x96')](util[_0x26d9('0x2c')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x516957['mailbox']));};AGIVertices[_0x26d9('0xe')][_0x26d9('0x197')]=function(_0x14aa2d){logger[_0x26d9('0x31')](util[_0x26d9('0x2c')](_0x26d9('0x198'),_0x14aa2d['label']));if(!this[_0x26d9('0x68')](_0x14aa2d[_0x26d9('0xb4')])){return this['channel']['error'](_0x14aa2d,_0x26d9('0x180'));}var _0x5a5da2=this[_0x26d9('0xf')][_0x26d9('0x85')](this,_0x14aa2d[_0x26d9('0xb4')]);if(!_0x5a5da2){return this[_0x26d9('0xd')]['error'](_0x14aa2d,_0x26d9('0xb6'));}var _0x110635=this[_0x26d9('0xd')][_0x26d9('0xf')](_0x5a5da2);return{'code':0xc8,'result':_0x110635['extra']?_0x110635['extra']:'-'};};String[_0x26d9('0xe')][_0x26d9('0x80')]=function(_0x59ff46,_0x4ea4d1){return this[_0x26d9('0x7e')](_0x59ff46)['join'](_0x4ea4d1);};module[_0x26d9('0x199')]=AGIVertices; \ No newline at end of file +var _0x971a=['speech','out','Dialogflow\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','trunk_name','finally','maxRetry','file_id','no\x20file\x20audio\x20found','maxdigit','stringify','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20is\x20unreachable','awslex','bot','Trying\x20Amazon\x20Lex:\x20%s','isString','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s.%s','beep','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','context','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','math','no\x20operation\x20configured','math\x20%s','operation','isArray','variable\x20%s[key]\x20set','getData','response','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','escape_digits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','Smtp','service','host','port','secure','auth','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','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','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','command','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','lodash','shelljs','odbc','randomstring','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariableById','then','catch','prototype','getVoiceQueue','getVoiceQueueById','name','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleTTS','google_tts_language','googleDialogflow','text','dialogflow_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','clear','includes','clone','hasOwnProperty','replaceAllVariables','split','length','replaceAll','extra','getVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','sync','retry','Enter\x20in\x20AGI\x20(%s)\x20block','args','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','result','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','noop','Executed\x20command\x20%s\x20%s','options','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','getAndSetVariable','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','opts','url','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','createSquareMessage','DIALOGFLOW_%s','toUpperCase'];(function(_0x324f49,_0x318e9e){var _0x2caf00=function(_0x38e5db){while(--_0x38e5db){_0x324f49['push'](_0x324f49['shift']());}};_0x2caf00(++_0x318e9e);}(_0x971a,0xc3));var _0xa971=function(_0x1f404a,_0x5088b2){_0x1f404a=_0x1f404a-0x0;var _0x2cdcd5=_0x971a[_0x1f404a];return _0x2cdcd5;};'use strict';var fs=require('fs');var path=require(_0xa971('0x0'));var util=require('util');var _=require(_0xa971('0x1'));var sh=require(_0xa971('0x2'));var odbc=require(_0xa971('0x3'))();var rs=require(_0xa971('0x4'));var moment=require('moment');var Mustache=require(_0xa971('0x5'));var logger=require(_0xa971('0x6'))(_0xa971('0x7'));var config=require(_0xa971('0x8'));var scripts=require('./scripts');var FILES_PATH=_0xa971('0x9');var verticesWithRetry=[_0xa971('0xa'),_0xa971('0xb'),_0xa971('0xc')];var AGIVertices=function(_0xc176fc,_0x488a63,_0x57479d){this[_0xa971('0xd')]=_0xc176fc;this[_0xa971('0xe')]=_0x488a63;this[_0xa971('0xf')]=_0x57479d;};AGIVertices['prototype']['getVariable']=function(_0x4b8e54,_0x2ee88a){this[_0xa971('0xe')][_0xa971('0x10')](_0x4b8e54)[_0xa971('0x11')](function(_0x1a79ff){_0x2ee88a(null,_0x1a79ff?_0x1a79ff['name']:![]);})[_0xa971('0x12')](function(_0x17b416){_0x2ee88a(_0x17b416);});};AGIVertices[_0xa971('0x13')][_0xa971('0x14')]=function(_0x4ee0d6,_0x4f19ee){this['rpc'][_0xa971('0x15')](_0x4ee0d6)[_0xa971('0x11')](function(_0x54b859){_0x4f19ee(null,_0x54b859?_0x54b859[_0xa971('0x16')]:![]);})[_0xa971('0x12')](function(_0x10fdf2){_0x4f19ee(_0x10fdf2);});};AGIVertices[_0xa971('0x13')]['getSquareProject']=function(_0x194e76,_0x2c624a){this[_0xa971('0xe')][_0xa971('0x17')](_0x194e76)[_0xa971('0x11')](function(_0x3b0624){_0x2c624a(null,_0x3b0624?_0x3b0624['name']:![]);})['catch'](function(_0x136d0b){_0x2c624a(_0x136d0b);});};AGIVertices[_0xa971('0x13')][_0xa971('0x18')]=function(_0x1d1162,_0x179b77){this[_0xa971('0xe')][_0xa971('0x19')](_0x1d1162)[_0xa971('0x11')](function(_0x42429b){_0x179b77(null,_0x42429b?_0x42429b['dsn']:![]);})[_0xa971('0x12')](function(_0x56de1e){_0x179b77(_0x56de1e);});};AGIVertices[_0xa971('0x13')][_0xa971('0x1a')]=function(_0x2d276c,_0x30464e){this['rpc'][_0xa971('0x1b')](_0x2d276c)['then'](function(_0x217ead){_0x30464e(null,_0x217ead?_0x217ead[_0xa971('0x16')]:![]);})[_0xa971('0x12')](function(_0x29a836){_0x30464e(_0x29a836);});};AGIVertices['prototype']['getTrunk']=function(_0xf44422,_0x4bd9c7){this[_0xa971('0xe')][_0xa971('0x1c')](_0xf44422)[_0xa971('0x11')](function(_0x31170a){_0x4bd9c7(null,_0x31170a?_0x31170a[_0xa971('0x16')]:![]);})[_0xa971('0x12')](function(_0x54d2bb){_0x4bd9c7(_0x54d2bb);});};AGIVertices['prototype'][_0xa971('0x1d')]=function(_0x25678d,_0x399ed5){var _0x11f4a2=this;this[_0xa971('0xe')][_0xa971('0x1e')](_0x25678d)[_0xa971('0x11')](function(_0x316235){_0x399ed5(null,_0x316235?_0x11f4a2[_0xa971('0x1f')](_0x316235[_0xa971('0x20')]):![]);})[_0xa971('0x12')](function(_0x3c2f2d){_0x399ed5(_0x3c2f2d);});};AGIVertices['prototype'][_0xa971('0x21')]=function(_0x4f5269,_0x512e93){this[_0xa971('0xe')]['getMailAccountById'](_0x4f5269)['then'](function(_0x31e6af){_0x512e93(null,_0x31e6af?_0x31e6af:![]);})[_0xa971('0x12')](function(_0x1b4dab){_0x512e93(_0x1b4dab);});};AGIVertices[_0xa971('0x13')]['sendMailMessage']=function(_0x210c8b,_0x12f88f,_0xcac46e){this[_0xa971('0xf')][_0xa971('0x22')](_0x210c8b,_0x12f88f)['then'](function(){_0xcac46e(null);})['catch'](function(_0x449ac3){_0xcac46e(_0x449ac3);});};AGIVertices[_0xa971('0x13')][_0xa971('0x23')]=function(_0x16d2b1,_0x175c3f){this[_0xa971('0xe')][_0xa971('0x24')](_0x16d2b1)['then'](function(_0x21776d){if(_0x21776d){if(_0x21776d[_0xa971('0x25')]){_0x175c3f(null,[_0x21776d[_0xa971('0x26')]]);}else{_0x175c3f(null,_[_0xa971('0x27')](_0x21776d[_0xa971('0x28')],'interval'));}}else{_0x175c3f(null,![]);}})[_0xa971('0x12')](function(_0x45ef6f){_0x175c3f(_0x45ef6f);});};AGIVertices[_0xa971('0x13')]['getSoundPath']=function(_0x4f93ce){return util[_0xa971('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x4f93ce);};AGIVertices[_0xa971('0x13')]['getQueryOdbc']=function(_0x100550,_0x5e19e5,_0x427a3b){odbc[_0xa971('0x2a')](_0x100550,function(_0x49f9b2){if(_0x49f9b2){logger[_0xa971('0x2b')](_0xa971('0x2c'),_0x49f9b2);_0x427a3b(_0x49f9b2);}else{logger[_0xa971('0x2d')](_0xa971('0x2e'));odbc[_0xa971('0x2f')](_0x5e19e5,function(_0x3f970f,_0x43f584){if(_0x3f970f){logger['info'](_0xa971('0x30'),_0x5e19e5);_0x427a3b(_0x3f970f);}else{logger['info'](_0xa971('0x31'),_0x5e19e5);odbc[_0xa971('0x32')](function(_0x3e006f){if(_0x3e006f){logger[_0xa971('0x2b')](_0xa971('0x33'),_0x3e006f);}_0x427a3b(null,_0x43f584);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x3de0b9,_0x22a68c){this['rpc'][_0xa971('0x34')](_0x3de0b9)[_0xa971('0x11')](function(_0x554f3e){_0x22a68c(null,_0x554f3e?_0x554f3e:![]);})[_0xa971('0x12')](function(_0x5ec681){_0x22a68c(_0x5ec681);});};AGIVertices[_0xa971('0x13')][_0xa971('0x35')]=function(_0x137623,_0x1bca50){this[_0xa971('0xe')][_0xa971('0x35')](_0x137623)[_0xa971('0x11')](function(_0x92484){_0x1bca50(null,_0x92484);})[_0xa971('0x12')](function(_0x3b6570){_0x1bca50(_0x3b6570);});};AGIVertices[_0xa971('0x13')][_0xa971('0x36')]=function(_0x189e24,_0x25da79,_0x381e4a){this[_0xa971('0xe')][_0xa971('0x36')]({'uniqueid':this['channel'][_0xa971('0x37')],'node':_0x189e24[_0xa971('0x38')],'application':_0x189e24[_0xa971('0x39')],'data':_0x25da79||null,'project_name':this['channel'][_0xa971('0x3a')],'callerid':this[_0xa971('0xd')][_0xa971('0x3b')]})['then'](function(_0x7e2439){if(_0x381e4a){_0x381e4a(null,_0x7e2439);}})[_0xa971('0x12')](function(_0x394dae){if(_0x381e4a){_0x381e4a(_0x394dae);}});};AGIVertices[_0xa971('0x13')][_0xa971('0x3c')]=function(_0x598ede,_0x233a90,_0x2622c2,_0x55b9d9){this[_0xa971('0xe')][_0xa971('0x3c')]({'uniqueid':this[_0xa971('0xd')][_0xa971('0x37')],'callerid':this['channel'][_0xa971('0x3b')],'calleridname':this[_0xa971('0xd')][_0xa971('0x3d')],'context':this['channel']['context'],'extension':this[_0xa971('0xd')][_0xa971('0x3e')],'priority':this[_0xa971('0xd')][_0xa971('0x3f')],'accountcode':this[_0xa971('0xd')][_0xa971('0x40')],'dnid':this[_0xa971('0xd')][_0xa971('0x41')],'projectName':this[_0xa971('0xd')]['arg_1'],'saveName':_0x233a90,'filename':_0x598ede[_0xa971('0x42')]||_0x233a90,'savePath':_0x2622c2})['then'](function(_0x485ec5){_0x55b9d9(null,_0x485ec5);})[_0xa971('0x12')](function(_0xb54689){_0x55b9d9(_0xb54689);});};AGIVertices[_0xa971('0x13')]['createSquareMessage']=function(_0x5d71bf,_0x408af3,_0x3dffaa){this['rpc']['createSquareMessage']({'uniqueid':this[_0xa971('0xd')][_0xa971('0x37')],'body':_0x5d71bf,'direction':_0x408af3})[_0xa971('0x11')](function(_0x50539e){if(_0x3dffaa){_0x3dffaa(null,_0x50539e);}})[_0xa971('0x12')](function(_0x305457){if(_0x3dffaa){_0x3dffaa(_0x305457);}});};AGIVertices['prototype'][_0xa971('0x43')]=function(_0x1de1a5,_0x343f5b){this['rpc'][_0xa971('0x43')]({'firstName':_[_0xa971('0x44')](_0x1de1a5[_0xa971('0x16')])||_[_0xa971('0x45')](_0x1de1a5[_0xa971('0x16')])?_0xa971('0x46')+Math[_0xa971('0x47')]():_0x1de1a5[_0xa971('0x16')],'lastName':_[_0xa971('0x44')](_0x1de1a5[_0xa971('0x48')])||_[_0xa971('0x45')](_0x1de1a5[_0xa971('0x48')])?null:_0x1de1a5[_0xa971('0x48')],'phone':_0x1de1a5[_0xa971('0x49')],'ListId':_0x1de1a5[_0xa971('0x4a')],'scheduledAt':_0x1de1a5[_0xa971('0x4b')],'callbackUniqueid':this[_0xa971('0xd')][_0xa971('0x37')],'tags':_0xa971('0x4c'),'description':_0xa971('0x4d')+_0x1de1a5[_0xa971('0x4b')][_0xa971('0x4e')](),'priority':_0x1de1a5['callback_priority']})['then'](function(_0x438b52){_0x343f5b(null,_0x438b52);})[_0xa971('0x12')](function(_0x4e26c9){_0x343f5b(_0x4e26c9);});};AGIVertices[_0xa971('0x13')][_0xa971('0x4f')]=function(_0x2530ce,_0x5e0c1d){this['rpc'][_0xa971('0x50')](_0x2530ce)[_0xa971('0x11')](function(_0x184c30){_0x5e0c1d(null,_0x184c30?_0x184c30['name']:![]);})[_0xa971('0x12')](function(_0x2d65f6){_0x5e0c1d(_0x2d65f6);});};AGIVertices['prototype']['agentPause']=function(_0x442ba0,_0x5519ef,_0x3e7bd9){var _0x1e38e6={'role':'agent'};_0x1e38e6[_0x442ba0]=this['channel'][_0xa971('0x3b')];this['rpc']['agentPause'](_0x1e38e6,_0x5519ef,this[_0xa971('0xd')][_0xa971('0x37')])[_0xa971('0x11')](function(_0x3e000f){_0x3e7bd9(null,_[_0xa971('0x45')](_0x3e000f)?![]:!![]);})[_0xa971('0x12')](function(_0x42d7a3){logger[_0xa971('0x2b')](_0x42d7a3);_0x3e7bd9(null,![]);});};AGIVertices[_0xa971('0x13')][_0xa971('0x51')]=function(_0x2a165e,_0x5c4112){var _0x16f11c={'role':_0xa971('0x52')};_0x16f11c[_0x2a165e]=this[_0xa971('0xd')][_0xa971('0x3b')];this['rpc']['agentUnpause'](_0x16f11c)[_0xa971('0x11')](function(_0x1b3c5a){_0x5c4112(null,_['isNil'](_0x1b3c5a)?![]:!![]);})['catch'](function(_0xd44ee7){logger[_0xa971('0x2b')](_0xd44ee7);_0x5c4112(null,![]);});};AGIVertices[_0xa971('0x13')][_0xa971('0x53')]=function(_0x237d62,_0x3f8e47){var _0x7d020c={'role':_0xa971('0x52')};_0x7d020c[_0x237d62]=this[_0xa971('0xd')][_0xa971('0x3b')];this[_0xa971('0xe')][_0xa971('0x53')](_0x7d020c)[_0xa971('0x11')](function(_0x4af94c){_0x3f8e47(null,_[_0xa971('0x45')](_0x4af94c)?![]:!![]);})['catch'](function(_0x446c9c){logger['error'](_0x446c9c);_0x3f8e47(null,![]);});};AGIVertices[_0xa971('0x13')][_0xa971('0x54')]=function(_0x33a501,_0x4d7833){var _0x2a9bad={'role':_0xa971('0x52')};_0x2a9bad[_0x33a501]=this[_0xa971('0xd')][_0xa971('0x3b')];var _0x43431b=_0x33a501!=_0xa971('0x55')?util['format'](_0xa971('0x56'),_0xa971('0x57'),this[_0xa971('0xd')][_0xa971('0x3b')]):undefined;this[_0xa971('0xe')][_0xa971('0x54')](_0x2a9bad,_0x43431b)[_0xa971('0x11')](function(_0x40a296){_0x4d7833(null,_[_0xa971('0x45')](_0x40a296)?![]:!![]);})[_0xa971('0x12')](function(_0x3ec628){logger[_0xa971('0x2b')](_0x3ec628);_0x4d7833(null,![]);});};AGIVertices['prototype'][_0xa971('0x58')]=function(_0x246c70,_0x22209c){sh[_0xa971('0x59')](_[_0xa971('0x5a')](_0x246c70),function(_0x51e11c,_0x3dcc50){var _0x165731=_0x3dcc50[_0xa971('0x5b')](/(\r\n|\n|\r)/gm,'');_0x22209c(null,_0x165731);});};AGIVertices[_0xa971('0x13')][_0xa971('0x5c')]=function(_0x98abea,_0x2757c4){scripts[_0xa971('0x5c')](_0x98abea['text'],_0x98abea[_0xa971('0x5d')]||'en',0x1)[_0xa971('0x11')](function(_0x5af00b){_0x2757c4(null,_0x5af00b);})[_0xa971('0x12')](function(_0x3677e5){_0x2757c4(_0x3677e5);});};AGIVertices['prototype'][_0xa971('0x5e')]=function(_0x5ba51b,_0x1055bf){scripts[_0xa971('0x5e')](this[_0xa971('0xd')]['uniqueid'],_0x5ba51b['key'],_0x5ba51b[_0xa971('0x5f')],_0x5ba51b[_0xa971('0x60')]||'en')[_0xa971('0x11')](function(_0x364b5d){_0x1055bf(null,_0x364b5d);})[_0xa971('0x12')](function(_0x9fe449){_0x1055bf(_0x9fe449);});};AGIVertices[_0xa971('0x13')][_0xa971('0x61')]=function(_0x1b1078,_0x59db52){scripts[_0xa971('0x61')](this[_0xa971('0xd')],_0x1b1078)[_0xa971('0x11')](function(_0x5d080d){_0x59db52(null,_0x5d080d);})[_0xa971('0x12')](function(_0xfd983a){_0x59db52(_0xfd983a);});};AGIVertices[_0xa971('0x13')]['ispeechTTS']=function(_0x13e541,_0x263055){scripts[_0xa971('0x62')](_0x13e541[_0xa971('0x63')],_0x13e541['text'],_0x13e541[_0xa971('0x64')]||_0xa971('0x65'),_0x13e541[_0xa971('0x66')])['then'](function(_0x4045a1){_0x263055(null,_0x4045a1);})[_0xa971('0x12')](function(_0x558ffd){_0x263055(_0x558ffd);});};AGIVertices['prototype'][_0xa971('0x67')]=function(_0x3f46a8,_0x203a75,_0x5b1fa3){scripts[_0xa971('0x67')](_0x203a75,_0x3f46a8[_0xa971('0x63')],_0x3f46a8[_0xa971('0x68')]||_0xa971('0x65'),this[_0xa971('0x69')](_0x3f46a8[_0xa971('0x6a')])?_0x3f46a8[_0xa971('0x6a')]:undefined)[_0xa971('0x11')](function(_0x4f8d2a){_0x5b1fa3(null,_0x4f8d2a);})[_0xa971('0x12')](function(_0x5d7034){_0x5b1fa3(_0x5d7034);});};AGIVertices[_0xa971('0x13')]['awsPolly']=function(_0x5810f2,_0x341d9d){scripts['awsPolly'](_0x5810f2[_0xa971('0x6b')],_0x5810f2[_0xa971('0x6c')],_0x5810f2[_0xa971('0x6d')],_0x5810f2[_0xa971('0x6e')]||_0xa971('0x6f'),_0x5810f2[_0xa971('0x5f')],_0x5810f2[_0xa971('0x70')]||_0xa971('0x5f'))[_0xa971('0x11')](function(_0x2aab78){_0x341d9d(null,_0x2aab78);})[_0xa971('0x12')](function(_0x44a5c7){_0x341d9d(_0x44a5c7);});};AGIVertices[_0xa971('0x13')][_0xa971('0x71')]=function(_0x3a53c8,_0x3cd047){scripts[_0xa971('0x71')](this[_0xa971('0xd')][_0xa971('0x37')],_0x3a53c8[_0xa971('0x6b')],_0x3a53c8[_0xa971('0x6c')],_0x3a53c8['aws_lex_region'],_0x3a53c8[_0xa971('0x5f')],_0x3a53c8[_0xa971('0x72')])[_0xa971('0x11')](function(_0x55200f){_0x3cd047(null,_0x55200f);})[_0xa971('0x12')](function(_0x89bd3d){_0x3cd047(_0x89bd3d);});};AGIVertices[_0xa971('0x13')][_0xa971('0x73')]=function(_0x1ae570,_0x27fd36,_0x112741){scripts['googleASR'](_0x27fd36,_0x1ae570[_0xa971('0x63')],_0x1ae570['google_asr_language']||'en-US')[_0xa971('0x11')](function(_0x2d9254){_0x112741(null,_0x2d9254);})['catch'](function(_0x39e13e){_0x112741(_0x39e13e);});};AGIVertices[_0xa971('0x13')][_0xa971('0x74')]=function(_0x1b844e,_0x51d4e7,_0x5bd3e9){scripts[_0xa971('0x74')](_0x51d4e7,_0x1b844e[_0xa971('0x75')],_0x1b844e[_0xa971('0x76')],_0x1b844e[_0xa971('0x77')])['then'](function(_0x3fb182){_0x5bd3e9(null,_0x3fb182);})[_0xa971('0x12')](function(_0xf6f2a4){_0x5bd3e9(_0xf6f2a4);});};AGIVertices[_0xa971('0x13')][_0xa971('0x78')]=function(_0x39ddf3){var _0x43b069=_[_0xa971('0x79')](verticesWithRetry,_0x39ddf3[_0xa971('0x39')])?_0x39ddf3:_[_0xa971('0x7a')](_0x39ddf3);for(var _0x3f0661 in _0x43b069){if(_0x43b069[_0xa971('0x7b')](_0x3f0661)){if(_0x43b069[_0x3f0661]&&_['isString'](_0x43b069[_0x3f0661])){_0x43b069[_0x3f0661]=this['replaceAllVariables'](_0x43b069[_0x3f0661]);}}}return _0x43b069;};AGIVertices[_0xa971('0x13')][_0xa971('0x7c')]=function(_0x2cb21b){var _0x51fe9a=_0x2cb21b[_0xa971('0x7d')]('{');for(var _0x318ea4=0x1;_0x318ea4<_0x51fe9a[_0xa971('0x7e')];_0x318ea4+=0x1){var _0x1bfc12=_0x51fe9a[_0x318ea4][_0xa971('0x7d')]('}');if(_0x1bfc12[_0xa971('0x7e')]>0x1){_0x2cb21b=_0x2cb21b[_0xa971('0x7f')]('{'+_0x1bfc12[0x0]+'}',this[_0xa971('0xd')]['getVariable'](_0x1bfc12[0x0])[_0xa971('0x80')]||_0x1bfc12[0x0]);}}if(_0x51fe9a[_0xa971('0x7e')]===0x1){return _0x2cb21b[_0xa971('0x4e')]();}return this[_0xa971('0x7c')](_0x2cb21b);};AGIVertices['prototype']['getAndSetVariable']=function(_0x4317f5,_0x4793f8){var _0x5579c6=this[_0xa971('0xd')][_0xa971('0x81')](_0x4317f5);if(_0x5579c6['result']===-0x1){return _0x5579c6;}logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x82'),_0x4793f8,_0x5579c6[_0xa971('0x80')]));return this[_0xa971('0xd')][_0xa971('0x83')](_0x4793f8,_0x5579c6[_0xa971('0x80')]);};AGIVertices[_0xa971('0x13')][_0xa971('0x69')]=function(_0x115a4c){return _0x115a4c&&_0x115a4c!=='0'&&_0x115a4c!=='-1'&&_0x115a4c!=='';};AGIVertices['prototype']['maxRetry']=function(_0x2cfceb){this[_0xa971('0x36')][_0xa971('0x84')](this,_0x2cfceb,'-');_0x2cfceb[_0xa971('0x85')]=_0x2cfceb['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa971('0x13')]['agi']=function(_0x2d1874){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x86'),_0x2d1874[_0xa971('0x38')]));return this[_0xa971('0xd')][_0xa971('0x7')]([_0x2d1874['command'],_0x2d1874[_0xa971('0x87')]]);};AGIVertices[_0xa971('0x13')]['answer']=function(_0x4217ec){logger[_0xa971('0x2d')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x4217ec[_0xa971('0x38')]));if(this[_0xa971('0x69')](_0x4217ec[_0xa971('0x88')])){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x89'),_0x4217ec[_0xa971('0x88')]));var _0xc9fe66=this[_0xa971('0xd')][_0xa971('0x8a')](_0x4217ec[_0xa971('0x88')]);if(_0xc9fe66[_0xa971('0x8b')]===-0x1){return _0xc9fe66;}}return this[_0xa971('0xd')][_0xa971('0x8c')]();};AGIVertices[_0xa971('0x13')][_0xa971('0x4c')]=function(_0x294da8){logger['info'](util[_0xa971('0x29')](_0xa971('0x8d'),_0x294da8[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x294da8[_0xa971('0x4a')])){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x294da8,_0xa971('0x8e'));}_0x294da8[_0xa971('0x4b')]=moment();if(this[_0xa971('0x69')](_0x294da8[_0xa971('0x8f')])){_0x294da8[_0xa971('0x4b')]=moment()[_0xa971('0x90')](_0x294da8['delay'],_0xa971('0x91'));}if(!this[_0xa971('0x69')](_0x294da8[_0xa971('0x92')])){_0x294da8['callback_priority']=0x2;}this[_0xa971('0x43')][_0xa971('0x84')](this,_0x294da8);return this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x294da8[_0xa971('0x49')],_0x294da8['list_id'],_0x294da8[_0xa971('0x4b')]));};AGIVertices[_0xa971('0x13')][_0xa971('0x93')]=function(_0x20b861){logger[_0xa971('0x2d')](util['format'](_0xa971('0x94'),_0x20b861['label']));var _0x132ce8=this['channel'][_0xa971('0x59')](_0x20b861[_0xa971('0x95')],_0x20b861['options']);if(_0x132ce8['result']===-0x1){return _0x132ce8;}return this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x97'),_0x20b861[_0xa971('0x95')],_0x20b861[_0xa971('0x98')]));};AGIVertices[_0xa971('0x13')][_0xa971('0x99')]=function(_0x1f0242){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x9a'),_0x1f0242['label']));if(!this[_0xa971('0x69')](_0x1f0242[_0xa971('0x5f')])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0x9b'));}var _0x2556df='\x22'+_0x1f0242['text']+'\x22';if(this[_0xa971('0x69')](_0x1f0242[_0xa971('0x98')])){_0x2556df+=','+_0x1f0242[_0xa971('0x98')];}var _0x565e2e=this['channel'][_0xa971('0x59')](_0xa971('0x9c'),_0x2556df);if(_0x565e2e[_0xa971('0x8b')]===-0x1){return _0x565e2e;}return this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2556df));};AGIVertices[_0xa971('0x13')]['sestektts']=function(_0x1993a5){logger['info'](util[_0xa971('0x29')](_0xa971('0x9d'),_0x1993a5[_0xa971('0x38')]));if(!this['isConfigured'](_0x1993a5['text'])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0x9b'));}var _0x115246='\x22'+_0x1993a5[_0xa971('0x5f')]+'\x22';if(this['isConfigured'](_0x1993a5['options'])){_0x115246+=','+_0x1993a5[_0xa971('0x98')];}var _0xea808a=this[_0xa971('0xd')][_0xa971('0x59')](_0xa971('0x9c'),_0x115246);if(_0xea808a[_0xa971('0x8b')]===-0x1){return _0xea808a;}return this[_0xa971('0xd')][_0xa971('0x96')](util['format'](_0xa971('0x9e'),_0x115246));};AGIVertices[_0xa971('0x13')][_0xa971('0x9f')]=function(_0x50baee){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0xa0'),_0x50baee['label']));if(!this[_0xa971('0x69')](_0x50baee[_0xa971('0xa1')])){return this['channel'][_0xa971('0x96')](_0xa971('0xa2'));}var _0x37dd2f=_0x50baee[_0xa971('0xa1')];if(this[_0xa971('0x69')](_0x50baee[_0xa971('0x98')])){_0x37dd2f+=','+_0x50baee[_0xa971('0x98')];}var _0x376df3=this[_0xa971('0xd')][_0xa971('0x59')]('MRCPRecog',_0x37dd2f);if(_0x376df3[_0xa971('0x8b')]===-0x1){return _0x376df3;}var _0xd6431f=this[_0xa971('0xa3')](_0xa971('0xa4'),_0xa971('0xa5'));if(_0xd6431f[_0xa971('0x8b')]===-0x1){return _0xd6431f;}var _0xcafae2=this[_0xa971('0xa3')](_0xa971('0xa6'),_0xa971('0xa7'));if(_0xcafae2[_0xa971('0x8b')]===-0x1){return _0xcafae2;}var _0x3c3c56=this[_0xa971('0xa3')](_0xa971('0xa8'),_0xa971('0xa9'));if(_0x3c3c56[_0xa971('0x8b')]===-0x1){return _0x3c3c56;}return this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0xaa'),_0x37dd2f));};AGIVertices['prototype'][_0xa971('0xab')]=function(_0x5637ce){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0xac'),_0x5637ce[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x5637ce[_0xa971('0xa1')])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0xa2'));}var _0x2bb0fe=_0x5637ce['grammar'];if(this[_0xa971('0x69')](_0x5637ce['options'])){_0x2bb0fe+=','+_0x5637ce[_0xa971('0x98')];}var _0x1ec55f=this[_0xa971('0xd')][_0xa971('0x59')]('MRCPRecog',_0x2bb0fe);if(_0x1ec55f['result']===-0x1){return _0x1ec55f;}var _0x5df095=this[_0xa971('0xa3')](_0xa971('0xa4'),_0xa971('0xad'));if(_0x5df095['result']===-0x1){return _0x5df095;}var _0x58c7cd=this['getAndSetVariable'](_0xa971('0xa6'),'SESTEK_ASR_TRANSCRIPT');if(_0x58c7cd[_0xa971('0x8b')]===-0x1){return _0x58c7cd;}var _0x1f664e=this[_0xa971('0xa3')](_0xa971('0xa8'),_0xa971('0xae'));if(_0x1f664e['result']===-0x1){return _0x1f664e;}return this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')](_0xa971('0xaa'),_0x2bb0fe));};AGIVertices[_0xa971('0x13')]['database']=function(_0x49edb5){logger['info'](util[_0xa971('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x49edb5[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x49edb5['odbc_id'])){return this['channel'][_0xa971('0x2b')](_0x49edb5,_0xa971('0xaf'));}var _0x4c7c23=this[_0xa971('0x18')][_0xa971('0x84')](this,_0x49edb5[_0xa971('0xb0')]);if(!_0x4c7c23){return this['channel'][_0xa971('0x2b')](_0x49edb5,_0xa971('0xb1'));}if(!this[_0xa971('0x69')](_0x49edb5[_0xa971('0x2f')])){return this[_0xa971('0xd')]['error'](_0x49edb5,_0xa971('0xb2'));}var _0x2bc73b=_0x49edb5['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xa971('0xd')]['noop'](util['format'](_0xa971('0xb3'),_0x2bc73b));var _0x1a8357=this[_0xa971('0xb4')]['sync'](this,_0x4c7c23,_0x2bc73b);this[_0xa971('0x36')][_0xa971('0x84')](this,_0x49edb5,_0x2bc73b);if(!this[_0xa971('0x69')](_0x49edb5[_0xa971('0xb5')])){return this[_0xa971('0xd')]['noop'](_0xa971('0xb6'));}var _0xb02f1b=this[_0xa971('0x81')][_0xa971('0x84')](this,_0x49edb5['variable_id']);if(!_0xb02f1b){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x49edb5,_0xa971('0xb7'));}var _0x354362=this;_0x1a8357[_0xa971('0xb8')](function(_0x30d304,_0x32e404){Object[_0xa971('0xb9')](_0x30d304)[_0xa971('0xb8')](function(_0x1859da){_0x354362[_0xa971('0xd')][_0xa971('0x83')](util[_0xa971('0x29')](_0xa971('0xba'),_0xb02f1b,_0x32e404,_0x1859da),_0x30d304[_0x1859da]);});});this[_0xa971('0xd')][_0xa971('0x83')](util['format'](_0xa971('0xbb'),_0xb02f1b),_0x1a8357[_0xa971('0x7e')]);return this['channel'][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0xbc'),_0xb02f1b));};AGIVertices[_0xa971('0x13')][_0xa971('0xbd')]=function(_0x45b763){logger['debug'](util[_0xa971('0x29')](_0xa971('0xbe'),_0x45b763[_0xa971('0x38')]));if(!this['isConfigured'](_0x45b763[_0xa971('0xbf')])){return this['channel'][_0xa971('0x2b')](_0x45b763,_0xa971('0xc0'));}var _0x536eff=this[_0xa971('0x1a')][_0xa971('0x84')](this,_0x45b763[_0xa971('0xbf')]);if(!_0x536eff){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x45b763,_0xa971('0xc1'));}var _0x423893=this[_0xa971('0xd')][_0xa971('0x59')]('DIAL',[util['format']('SIP/%s',_0x536eff),_0x45b763[_0xa971('0x88')],_0x45b763[_0xa971('0xc2')],_0x45b763[_0xa971('0xc3')]]);if(_0x423893['result']===-0x1){return _0x423893;}return this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0xc4'),_0xa971('0xc5')));};AGIVertices[_0xa971('0x13')]['dialogflow']=function(_0x5b4ff1){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0xc6'),_0x5b4ff1[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x5b4ff1['key'])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0xc7'));}if(!this[_0xa971('0x69')](_0x5b4ff1[_0xa971('0x5f')])){return this['channel'][_0xa971('0x96')]('no\x20text\x20configured');}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x5b4ff1);this[_0xa971('0xc8')](_0x5b4ff1['text'],'in');this[_0xa971('0xd')]['noop'](util['format']('Trying\x20Dialogflow:\x20%s',_0x5b4ff1[_0xa971('0x5f')]));var _0x3c4b7c=this[_0xa971('0x5e')][_0xa971('0x84')](this,_0x5b4ff1);if(_0x3c4b7c){for(var _0xa47a05 in _0x3c4b7c){if(_0x3c4b7c[_0xa971('0x7b')](_0xa47a05)){this[_0xa971('0xd')][_0xa971('0x83')](util['format'](_0xa971('0xc9'),_0xa47a05[_0xa971('0xca')]()),_0x3c4b7c[_0xa47a05]);}}this['createSquareMessage'](_0x3c4b7c[_0xa971('0xcb')],_0xa971('0xcc'));return this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')](_0xa971('0xcd'),_0x3c4b7c['speech']));}return this[_0xa971('0xd')][_0xa971('0x2b')](_0x5b4ff1,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xa971('0xce')]=function(_0x2c0ffe){logger['info'](util[_0xa971('0x29')](_0xa971('0xcf'),_0x2c0ffe[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x2c0ffe['ndauth_url'])){return this[_0xa971('0xd')]['noop'](_0xa971('0xd0'));}if(!this[_0xa971('0x69')](_0x2c0ffe[_0xa971('0xd1')])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0xd2'));}if(!this[_0xa971('0x69')](_0x2c0ffe[_0xa971('0xd3')])){return this[_0xa971('0xd')][_0xa971('0x96')]('no\x20password\x20configured');}if(!this[_0xa971('0x69')](_0x2c0ffe['ndassistant_url'])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0x9b'));}this[_0xa971('0xd')]['bot']=!![];this[_0xa971('0x36')](_0x2c0ffe);this[_0xa971('0xc8')](_0x2c0ffe[_0xa971('0x5f')],'in');this['channel'][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0xd4'),_0x2c0ffe[_0xa971('0x5f')]));var _0x256b5d=this[_0xa971('0x61')][_0xa971('0x84')](this,_0x2c0ffe);if(_0x256b5d){for(var _0xe4852d in _0x256b5d){if(_0x256b5d[_0xa971('0x7b')](_0xe4852d)){this[_0xa971('0xd')][_0xa971('0x83')](util['format']('SESTEK_NDA_%s',_0xe4852d['toUpperCase']()),_0x256b5d[_0xe4852d]);}}this['createSquareMessage'](_0x256b5d[_0xa971('0xcb')],_0xa971('0xcc'));if(_0x256b5d[_0xa971('0xd5')]){this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0xd6'),_0x256b5d['audiofile']));var _0x273515=this[_0xa971('0xd')][_0xa971('0xd7')](_0x256b5d[_0xa971('0xd5')]);try{fs[_0xa971('0xd8')](_0x256b5d['audiofile']+_0xa971('0xd9'));}catch(_0x533ba0){logger[_0xa971('0x2b')](_0x533ba0);}return _0x273515;}else{return this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')]('SestekNDA\x20Result\x20%s',_0x256b5d['speech']));}}return this['channel'][_0xa971('0x2b')](_0x2c0ffe,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xa971('0x13')]['end']=function(_0x542577){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x542577[_0xa971('0x38')]));return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0xda'));};AGIVertices[_0xa971('0x13')][_0xa971('0xdb')]=function(_0x5ee67d){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0xdc'),_0x5ee67d[_0xa971('0x38')]));var _0x260662='';if(_0x5ee67d['trunk_id']){if(!this[_0xa971('0x69')](_0x5ee67d[_0xa971('0xdd')])){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x5ee67d,_0xa971('0xde'));}else{var _0x4855e4=parseInt(_0x5ee67d['trunk_id'],0xa);if(isNaN(_0x4855e4)){_0x260662=_0x5ee67d['trunk_id'];}else{_0x260662=this[_0xa971('0xdf')][_0xa971('0x84')](this,_0x5ee67d[_0xa971('0xdd')]);if(!_0x260662){return this['channel'][_0xa971('0x2b')](_0x5ee67d,'no\x20trunk\x20found');}}}}else if(_0x5ee67d[_0xa971('0xe0')]){_0x260662=_0x5ee67d[_0xa971('0xe0')];}else{return this[_0xa971('0xd')][_0xa971('0x2b')](_0x5ee67d,'no\x20trunk\x20selected');}var _0x5428aa=this[_0xa971('0xd')][_0xa971('0x59')](_0xa971('0xc5'),[util[_0xa971('0x29')]('SIP/%s/%s',_0x260662,_0x5ee67d[_0xa971('0x49')]),_0x5ee67d[_0xa971('0x88')],_0x5ee67d[_0xa971('0xc2')],_0x5ee67d[_0xa971('0xc3')]]);if(_0x5428aa['result']===-0x1){return _0x5428aa;}return this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0xc4'),_0xa971('0xc5')));};AGIVertices[_0xa971('0x13')][_0xa971('0xe1')]=function(_0x1968d9){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1968d9[_0xa971('0x38')]));return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0xe1'));};AGIVertices[_0xa971('0x13')]['getdigits']=function(_0x5ed9e9){logger['info'](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x5ed9e9['label']));if(_0x5ed9e9[_0xa971('0x85')]===0x0){return this[_0xa971('0xe2')](_0x5ed9e9);}_0x5ed9e9[_0xa971('0x85')]-=0x1;if(!this[_0xa971('0x69')](_0x5ed9e9[_0xa971('0xe3')])){return this['channel'][_0xa971('0x2b')](_0x5ed9e9,'no\x20file\x20audio\x20selected');}var _0x4140d0=this['getSound'][_0xa971('0x84')](this,_0x5ed9e9[_0xa971('0xe3')]);if(!_0x4140d0){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x5ed9e9,_0xa971('0xe4'));}if(!this['isConfigured'](_0x5ed9e9[_0xa971('0xb5')])){return this['channel'][_0xa971('0x2b')](_0xa971('0xb6'));}var _0x5ea288=this[_0xa971('0xd')]['getData'](_0x4140d0,_0x5ed9e9['response'],_0x5ed9e9[_0xa971('0xe5')]);var _0x4d7c31=_0x5ea288[_0xa971('0x8b')]?_0x5ea288[_0xa971('0x8b')]['toString']():'';logger['info']('test',JSON[_0xa971('0xe6')](_0x5ea288));if(_0x5ea288[_0xa971('0x8b')]===-0x1){this[_0xa971('0x36')][_0xa971('0x84')](this,_0x5ed9e9,_0x4d7c31);return _0x5ea288;}else if(_0x5ea288[_0xa971('0x80')]===_0xa971('0x88')){_0x5ea288[_0xa971('0x8b')]=_0x4d7c31[_0xa971('0x7e')]>=parseInt(_0x5ed9e9[_0xa971('0xe7')])?'x':'i';}else{_0x5ea288[_0xa971('0x8b')]=_0x4d7c31[_0xa971('0x7e')]>=parseInt(_0x5ed9e9[_0xa971('0xe7')])&&_0x4d7c31[_0xa971('0x7e')]<=parseInt(_0x5ed9e9[_0xa971('0xe5')])?'x':'i';}var _0xb64f0f=this['getVariable'][_0xa971('0x84')](this,_0x5ed9e9[_0xa971('0xb5')]);if(!_0xb64f0f){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x5ed9e9,'no\x20variable\x20found');}this['channel'][_0xa971('0x83')](_0xb64f0f,_0x4d7c31);if(this[_0xa971('0x69')](_0x5ed9e9[_0xa971('0xe8')])){var _0x2ab6fe=parseInt(_0x5ed9e9[_0xa971('0xe8')],0xa);var _0x5a393c=rs[_0xa971('0xe9')]({'charset':'*','length':_0x2ab6fe});var _0x3a7ffe=_0x4d7c31[_0xa971('0x7e')];if(_0x3a7ffe>0x0){if(_0x3a7ffe>_0x2ab6fe){this[_0xa971('0x36')][_0xa971('0x84')](this,_0x5ed9e9,_0x5ed9e9['hiddendigitspos']===_0xa971('0xea')?_0x5a393c+_0x4d7c31[_0xa971('0xeb')](_0x2ab6fe):_0x4d7c31['substr'](0x0,_0x3a7ffe-_0x2ab6fe)+_0x5a393c);}else{this[_0xa971('0x36')][_0xa971('0x84')](this,_0x5ed9e9,rs[_0xa971('0xe9')]({'charset':'*','length':_0x3a7ffe}));}}else{this[_0xa971('0x36')][_0xa971('0x84')](this,_0x5ed9e9,'');}}else{this[_0xa971('0x36')][_0xa971('0x84')](this,_0x5ed9e9,_0x4d7c31);}return _0x5ea288;};AGIVertices[_0xa971('0x13')][_0xa971('0xc')]=function(_0x3e7297){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0xec'),_0x3e7297['label']));return this[_0xa971('0xb')](_0x3e7297);};AGIVertices['prototype'][_0xa971('0xed')]=function(_0x4e35b3){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4e35b3[_0xa971('0x38')]));this[_0xa971('0x36')][_0xa971('0x84')](this,_0x4e35b3,_0x4e35b3[_0xa971('0xee')]);return this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')]('GOAL\x20%s',_0x4e35b3['goalname']));};AGIVertices[_0xa971('0x13')][_0xa971('0xef')]=function(_0x2f2e98){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0xf0'),_0x2f2e98['label']));if(!this['isConfigured'](_0x2f2e98['aws_access_key_id'])||!this[_0xa971('0x69')](_0x2f2e98[_0xa971('0x6c')])){return this[_0xa971('0xd')]['noop'](_0xa971('0xf1'));}if(!this[_0xa971('0x69')](_0x2f2e98[_0xa971('0x5f')])){return this[_0xa971('0xd')]['noop'](_0xa971('0x9b'));}this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0xf2'),_0x2f2e98[_0xa971('0x5f')]));var _0x46f9f3=this[_0xa971('0xf3')][_0xa971('0x84')](this,_0x2f2e98);if(_0x46f9f3){this['channel'][_0xa971('0x96')](util[_0xa971('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x46f9f3));var _0x528dfb=this[_0xa971('0xd')][_0xa971('0xd7')](_0x46f9f3);try{fs[_0xa971('0xd8')](_0x46f9f3+_0xa971('0xd9'));}catch(_0x1d3182){logger[_0xa971('0x2b')](_0x1d3182);}return _0x528dfb;}return this[_0xa971('0xd')][_0xa971('0x2b')](_0x2f2e98,_0xa971('0xf4'));};AGIVertices[_0xa971('0x13')][_0xa971('0xf5')]=function(_0x111c42){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x111c42[_0xa971('0x38')]));if(!this['isConfigured'](_0x111c42[_0xa971('0x6b')])||!this['isConfigured'](_0x111c42[_0xa971('0x6c')])){return this[_0xa971('0xd')]['noop'](_0xa971('0xf1'));}if(!this[_0xa971('0x69')](_0x111c42[_0xa971('0x72')])){return this['channel'][_0xa971('0x96')]('no\x20bot\x20name\x20configured');}if(!this[_0xa971('0x69')](_0x111c42[_0xa971('0x5f')])){return this[_0xa971('0xd')]['noop'](_0xa971('0x9b'));}this[_0xa971('0xd')][_0xa971('0xf6')]=!![];this[_0xa971('0x36')](_0x111c42);this[_0xa971('0xc8')](_0x111c42[_0xa971('0x5f')],'in');this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0xf7'),_0x111c42['text']));var _0x367380=this[_0xa971('0x71')][_0xa971('0x84')](this,_0x111c42);if(_0x367380){for(var _0x274967 in _0x367380){if(_0x367380[_0xa971('0x7b')](_0x274967)&&_[_0xa971('0xf8')](_0x367380[_0x274967])){this[_0xa971('0xd')][_0xa971('0x83')](util[_0xa971('0x29')]('AWS_LEX_%s',_0x274967[_0xa971('0xca')]()),_0x367380[_0x274967]);}}if(_['isNil'](_0x367380[_0xa971('0xf9')])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0xfa'));}else{this['createSquareMessage'](_0x367380[_0xa971('0xf9')],_0xa971('0xcc'));return this[_0xa971('0xd')][_0xa971('0x96')](util['format'](_0xa971('0xfb'),_0x367380[_0xa971('0xf9')]));}}return this[_0xa971('0xd')][_0xa971('0x2b')](_0x111c42,_0xa971('0xfc'));};AGIVertices['prototype'][_0xa971('0xfd')]=function(_0x4c1c39){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0xfe'),_0x4c1c39[_0xa971('0x38')],_0x4c1c39[_0xa971('0x88')]));if(!this[_0xa971('0x69')](_0x4c1c39['key'])){return this[_0xa971('0xd')][_0xa971('0x96')]('no\x20key\x20configured');}var _0x1e3569='wav';var _0x1571a1=util[_0xa971('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0xa971('0xe9')](0x4));var _0x1d62ac=util[_0xa971('0x29')]('%s.%s',_0x1571a1,_0x1e3569);var _0x1a7dee=!![];if(_0x4c1c39['beep']==='NOBEEP'){_0x1a7dee=![];}var _0xe4a0ca=this[_0xa971('0xd')][_0xa971('0xff')](_0x1571a1,_0x1e3569,_0x4c1c39['intKey'],_0x4c1c39['timeout'],undefined,_0x1a7dee);if(_0xe4a0ca[_0xa971('0x8b')]!==-0x1){this['channel']['noop'](util['format'](_0xa971('0x100'),_0x1d62ac));var _0xf51970=this['googleASR'][_0xa971('0x84')](this,_0x4c1c39,_0x1d62ac);if(_0xf51970){for(var _0x2cabae in _0xf51970){if(_0xf51970[_0xa971('0x7b')](_0x2cabae)){this[_0xa971('0xd')][_0xa971('0x83')](util[_0xa971('0x29')]('GOOGLE_ASR_%s',_0x2cabae[_0xa971('0xca')]()),_0xf51970[_0x2cabae]);}}return this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x101'),JSON['stringify'](_0xf51970)));}}return _0xe4a0ca;};AGIVertices[_0xa971('0x13')]['tildeasr']=function(_0x833d58){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x102'),_0x833d58[_0xa971('0x38')]));if(!this['isConfigured'](_0x833d58[_0xa971('0x75')])){return this[_0xa971('0xd')]['noop'](_0xa971('0x103'));}if(!this[_0xa971('0x69')](_0x833d58['appsecret'])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0x104'));}var _0x16ad5d=_0xa971('0x105');var _0x379f71=util[_0xa971('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0xa971('0xe9')](0x4));var _0x29a1a1=util[_0xa971('0x29')](_0xa971('0x106'),_0x379f71,_0x16ad5d);var _0x512cdf=!![];if(_0x833d58[_0xa971('0x107')]===_0xa971('0x108')){_0x512cdf=![];}var _0x391e9c=this[_0xa971('0xd')][_0xa971('0xff')](_0x379f71,_0x16ad5d,_0x833d58[_0xa971('0x109')],_0x833d58[_0xa971('0x88')],undefined,_0x512cdf);if(_0x391e9c[_0xa971('0x8b')]!==-0x1){this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')](_0xa971('0x10a'),_0x29a1a1));var _0xea4d5d=this[_0xa971('0x74')][_0xa971('0x84')](this,_0x833d58,_0x29a1a1);if(_0xea4d5d){for(var _0x3558a5 in _0xea4d5d){if(_0xea4d5d['hasOwnProperty'](_0x3558a5)){this[_0xa971('0xd')][_0xa971('0x83')](util[_0xa971('0x29')](_0xa971('0x10b'),_0x3558a5[_0xa971('0xca')]()),_0xea4d5d[_0x3558a5]);}}return this[_0xa971('0xd')][_0xa971('0x96')](util['format'](_0xa971('0x10c'),JSON[_0xa971('0xe6')](_0xea4d5d)));}}return _0x391e9c;};AGIVertices[_0xa971('0x13')][_0xa971('0x10d')]=function(_0x3dbbbe){logger['info'](util[_0xa971('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3dbbbe[_0xa971('0x38')]));return this[_0xa971('0xd')]['continueAt'](_0x3dbbbe[_0xa971('0x10e')],_0x3dbbbe[_0xa971('0x3e')],_0x3dbbbe[_0xa971('0x3f')]);};AGIVertices[_0xa971('0x13')]['gotoif']=function(_0x253ab1){logger['info'](util[_0xa971('0x29')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x253ab1['label']));if(!this[_0xa971('0x69')](_0x253ab1[_0xa971('0x10f')])){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x253ab1,'no\x20condition\x20configured');}try{var _0x5e15de=eval(_0x253ab1[_0xa971('0x10f')])?'true':_0xa971('0x110');this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x111'),_0x253ab1['condition'],_0x5e15de));return{'code':0xc8,'result':_0x5e15de};}catch(_0x44073f){return{'code':0xc8,'result':_0xa971('0x110')};}};AGIVertices['prototype'][_0xa971('0x112')]=function(_0x19ebde){logger[_0xa971('0x2d')](util['format'](_0xa971('0x113'),_0x19ebde[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x19ebde[_0xa971('0x114')])){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x19ebde,_0xa971('0x115'));}var _0x464d42=this[_0xa971('0x23')]['sync'](this,_0x19ebde[_0xa971('0x114')]);if(!_0x464d42){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x19ebde,'no\x20intervals\x20found');}for(var _0x285917=0x0;_0x285917<_0x464d42[_0xa971('0x7e')];_0x285917+=0x1){var _0x5659a4=this[_0xa971('0xd')][_0xa971('0x81')](util[_0xa971('0x29')](_0xa971('0x116'),_0x464d42[_0x285917]));if(_0x5659a4[_0xa971('0x8b')]===-0x1){return _0x5659a4;}logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x117'),_0x464d42[_0x285917],_0x5659a4[_0xa971('0x80')]));if(_0x5659a4[_0xa971('0x80')]===_0xa971('0x118')){logger['info'](util[_0xa971('0x29')](_0xa971('0x117'),_0x464d42[_0x285917],_0xa971('0x118')));this[_0xa971('0xd')][_0xa971('0x96')](util['format'](_0xa971('0x117'),_0x464d42[_0x285917],_0xa971('0x118')));return{'code':0xc8,'result':_0xa971('0x118')};}else{logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x117'),_0x464d42[_0x285917],_0xa971('0x110')));this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')]('IFTIME\x20%s\x20%s',_0x464d42[_0x285917],_0xa971('0x110')));}}return{'code':0xc8,'result':_0xa971('0x110')};};AGIVertices[_0xa971('0x13')][_0xa971('0x119')]=function(_0x5df3f1){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x11a'),_0x5df3f1[_0xa971('0x38')]));return this[_0xa971('0xd')]['hangup']();};AGIVertices['prototype'][_0xa971('0x11b')]=function(_0x53a9e6){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x53a9e6[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x53a9e6[_0xa971('0x63')])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0xc7'));}var _0xe878e8='wav';var _0x4fc8ba=util[_0xa971('0x29')](_0xa971('0x11c'),FILES_PATH,rs[_0xa971('0xe9')](0x4));var _0x3afd64=util[_0xa971('0x29')](_0xa971('0x106'),_0x4fc8ba,_0xe878e8);var _0x41f536=!![];if(_0x53a9e6[_0xa971('0x107')]===_0xa971('0x108')){_0x41f536=![];}var _0x80187=this[_0xa971('0xd')][_0xa971('0xff')](_0x4fc8ba,_0xe878e8,_0x53a9e6[_0xa971('0x109')],_0x53a9e6[_0xa971('0x88')],undefined,_0x41f536);if(_0x80187['result']!==-0x1){this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x11d'),_0x3afd64));var _0x47238e=this['ispeechASR'][_0xa971('0x84')](this,_0x53a9e6,_0x3afd64);if(_0x47238e){for(var _0x40df51 in _0x47238e){if(_0x47238e['hasOwnProperty'](_0x40df51)){this[_0xa971('0xd')][_0xa971('0x83')](util[_0xa971('0x29')](_0xa971('0x11e'),_0x40df51[_0xa971('0xca')]()),_0x47238e[_0x40df51]);}}return this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')](_0xa971('0x11f'),JSON[_0xa971('0xe6')](_0x47238e)));}}return _0x80187;};AGIVertices[_0xa971('0x13')][_0xa971('0x120')]=function(_0x2b027b){logger[_0xa971('0x2d')](util['format'](_0xa971('0x121'),_0x2b027b[_0xa971('0x38')]));if(!this['isConfigured'](_0x2b027b[_0xa971('0x63')])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0xc7'));}if(!this[_0xa971('0x69')](_0x2b027b[_0xa971('0x5f')])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0x9b'));}this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x122'),_0x2b027b[_0xa971('0x5f')]));var _0x536345=this['ispeechTTS'][_0xa971('0x84')](this,_0x2b027b);if(_0x536345){this[_0xa971('0xd')][_0xa971('0x96')](util['format'](_0xa971('0x11d'),_0x536345));var _0x50aaa7=this['channel'][_0xa971('0xd7')](_0x536345,_0x2b027b[_0xa971('0x109')]);try{fs[_0xa971('0xd8')](_0x536345+_0xa971('0xd9'));}catch(_0x5ba874){logger[_0xa971('0x2b')](_0x5ba874);}return _0x50aaa7;}return this['channel'][_0xa971('0x2b')](_0x2b027b,_0xa971('0x123'));};AGIVertices['prototype'][_0xa971('0x124')]=function(_0x116423){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x116423[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x116423[_0xa971('0x125')])){return this[_0xa971('0xd')]['error'](_0x116423,'no\x20find\x20by\x20configured');}logger[_0xa971('0x2d')](util[_0xa971('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa971('0xd')][_0xa971('0x3b')],_0x116423[_0xa971('0x125')]));var _0x157d01=this['agentLogin'][_0xa971('0x84')](this,_0x116423[_0xa971('0x125')]);if(_0x157d01){logger['info'](util['format'](_0xa971('0x126'),this[_0xa971('0xd')]['callerid'],_0x116423[_0xa971('0x125')]));this['channel']['noop'](util[_0xa971('0x29')](_0xa971('0x126'),this['channel']['callerid'],_0x116423[_0xa971('0x125')]));return{'code':0xc8,'result':_0xa971('0x127')};}else{logger[_0xa971('0x2d')](util[_0xa971('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa971('0xd')][_0xa971('0x3b')],_0x116423[_0xa971('0x125')]));this[_0xa971('0xd')][_0xa971('0x96')](util['format'](_0xa971('0x128'),this['channel'][_0xa971('0x3b')],_0x116423[_0xa971('0x125')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa971('0x13')][_0xa971('0x129')]=function(_0x2f6c9e){logger['info'](util[_0xa971('0x29')](_0xa971('0x12a'),_0x2f6c9e[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x2f6c9e[_0xa971('0x125')])){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x2f6c9e,_0xa971('0x12b'));}logger['info'](util[_0xa971('0x29')](_0xa971('0x12c'),this['channel'][_0xa971('0x3b')],_0x2f6c9e[_0xa971('0x125')]));var _0x143761=this[_0xa971('0x53')]['sync'](this,_0x2f6c9e[_0xa971('0x125')]);if(_0x143761){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x2f6c9e[_0xa971('0x125')]));this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa971('0xd')]['callerid'],_0x2f6c9e[_0xa971('0x125')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa971('0x2d')](util[_0xa971('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa971('0xd')][_0xa971('0x3b')],_0x2f6c9e[_0xa971('0x125')]));this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x128'),this['channel'][_0xa971('0x3b')],_0x2f6c9e['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xa971('0x12d')]=function(_0x2bcebf){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2bcebf[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x2bcebf['operation'])){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x2bcebf,_0xa971('0x12e'));}this[_0xa971('0xd')][_0xa971('0x96')](util['format'](_0xa971('0x12f'),_0x2bcebf[_0xa971('0x130')]));var _0x1832ff=eval(_0x2bcebf['operation']);if(!this[_0xa971('0x69')](_0x2bcebf['variable_id'])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0xb6'));}var _0x5c86b3=this[_0xa971('0x81')][_0xa971('0x84')](this,_0x2bcebf[_0xa971('0xb5')]);if(!_0x5c86b3){return this['channel'][_0xa971('0x2b')](_0x2bcebf,_0xa971('0xb7'));}if(_[_0xa971('0x131')](_0x1832ff)){var _0xe6c83d=this;_0x1832ff['forEach'](function(_0x9b52e7,_0x2ec0cc){_0xe6c83d[_0xa971('0xd')][_0xa971('0x83')](util[_0xa971('0x29')]('%s[%s]',_0x5c86b3,_0x2ec0cc),_0x9b52e7);});return this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')](_0xa971('0x132'),_0x5c86b3));}else{return this[_0xa971('0xd')][_0xa971('0x83')](_0x5c86b3,_0x1832ff);}};AGIVertices[_0xa971('0x13')][_0xa971('0xa')]=function(_0x2a8627){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2a8627[_0xa971('0x38')]));if(_0x2a8627[_0xa971('0x85')]===0x0){return this[_0xa971('0xe2')](_0x2a8627);}_0x2a8627[_0xa971('0x85')]-=0x1;if(!this['isConfigured'](_0x2a8627[_0xa971('0xe3')])){return this[_0xa971('0xd')]['error'](_0x2a8627,'no\x20file\x20audio\x20selected');}var _0x36db62=this['getSound'][_0xa971('0x84')](this,_0x2a8627[_0xa971('0xe3')]);if(!_0x36db62){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x2a8627,_0xa971('0xe4'));}var _0x12fec0=this[_0xa971('0xd')][_0xa971('0x133')](_0x36db62,_0x2a8627[_0xa971('0x134')],_0x2a8627[_0xa971('0x135')]);var _0x327de1=_0x12fec0['result'];if(_0x12fec0[_0xa971('0x8b')]===-0x1){this[_0xa971('0x36')][_0xa971('0x84')](this,_0x2a8627,'-1');return _0x12fec0;}else if(_0x12fec0[_0xa971('0x80')]===_0xa971('0x88')){_0x12fec0[_0xa971('0x8b')]=_0x12fec0['result'][_0xa971('0x7e')]>0x0?_0x12fec0[_0xa971('0x8b')]:'t';}else if(_[_0xa971('0x44')](_0x12fec0[_0xa971('0x8b')])){_0x12fec0[_0xa971('0x8b')]='#';_0x327de1='#';}if(!this[_0xa971('0x69')](_0x2a8627[_0xa971('0xb5')])){this['channel'][_0xa971('0x96')](_0xa971('0xb6'));}else{var _0x46659c=this[_0xa971('0x81')][_0xa971('0x84')](this,_0x2a8627[_0xa971('0xb5')]);if(!_0x46659c){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x2a8627,_0xa971('0xb7'));}this[_0xa971('0xd')][_0xa971('0x83')](_0x46659c,_0x327de1);}this[_0xa971('0x36')][_0xa971('0x84')](this,_0x2a8627,_0x327de1);return _0x12fec0;};AGIVertices[_0xa971('0x13')][_0xa971('0x96')]=function(_0x2c1aa3){logger['info'](util[_0xa971('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2c1aa3[_0xa971('0x38')]));return this['channel'][_0xa971('0x96')](_0x2c1aa3[_0xa971('0x136')]||_0x2c1aa3[_0xa971('0x38')]);};AGIVertices[_0xa971('0x13')][_0xa971('0x137')]=function(_0x1555ae){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x138'),_0x1555ae[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x1555ae[_0xa971('0x125')])){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x1555ae,_0xa971('0x12b'));}logger[_0xa971('0x2d')](util['format'](_0xa971('0x12c'),this['channel'][_0xa971('0x3b')],_0x1555ae[_0xa971('0x125')]));var _0x190428=this[_0xa971('0x4f')]['sync'](this,_0x1555ae[_0xa971('0x139')]);var _0x22eeaf=this['agentPause'][_0xa971('0x84')](this,_0x1555ae['findBy'],_0x190428);if(_0x22eeaf){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x126'),this['channel']['callerid'],_0x1555ae[_0xa971('0x125')]));this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa971('0xd')][_0xa971('0x3b')],_0x1555ae['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x128'),this[_0xa971('0xd')][_0xa971('0x3b')],_0x1555ae[_0xa971('0x125')]));this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa971('0xd')][_0xa971('0x3b')],_0x1555ae[_0xa971('0x125')]));return{'code':0xc8,'result':_0xa971('0x13a')};}};AGIVertices['prototype'][_0xa971('0x13b')]=function(_0x4e0604){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x13c'),_0x4e0604['label']));if(!this[_0xa971('0x69')](_0x4e0604[_0xa971('0xe3')])){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x4e0604,'no\x20file\x20audio\x20selected');}var _0x430a83=this[_0xa971('0x1d')][_0xa971('0x84')](this,_0x4e0604[_0xa971('0xe3')]);if(!_0x430a83){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x4e0604,'no\x20file\x20audio\x20found');}var _0x1bc4f4=this['channel'][_0xa971('0x59')]('PLAYBACK',[_0x430a83,_0x4e0604[_0xa971('0xc2')]]);if(_0x1bc4f4['result']===-0x1){return _0x1bc4f4;}return this[_0xa971('0xd')][_0xa971('0x96')](util['format'](_0xa971('0x97'),'PLAYBACK',_0x430a83));};AGIVertices[_0xa971('0x13')][_0xa971('0x13d')]=function(_0x3a7718){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x3a7718[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x3a7718[_0xa971('0x13e')])){return this['channel'][_0xa971('0x2b')](_0x3a7718,_0xa971('0x13f'));}var _0x2fb17f='';var _0x2d99ef=parseInt(_0x3a7718[_0xa971('0x13e')],0xa);if(isNaN(_0x2d99ef)){_0x2fb17f=_0x3a7718[_0xa971('0x13e')];}else{_0x2fb17f=this[_0xa971('0x14')][_0xa971('0x84')](this,_0x3a7718[_0xa971('0x13e')]);if(!_0x2fb17f){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x3a7718,_0xa971('0x140'));}}var _0xd9d347='';if(this['isConfigured'](_0x3a7718[_0xa971('0xe3')])){var _0x16a4b6=this['getSound'][_0xa971('0x84')](this,_0x3a7718[_0xa971('0xe3')]);if(_0x16a4b6){_0xd9d347=_0x16a4b6;}}this[_0xa971('0x36')][_0xa971('0x84')](this,_0x3a7718,_0x2fb17f);if(_0x3a7718[_0xa971('0xc2')][_0xa971('0x141')]('x')<0x0){_0x3a7718[_0xa971('0xc2')]+='x';}if(_0x3a7718[_0xa971('0xc2')][_0xa971('0x141')]('X')<0x0){_0x3a7718[_0xa971('0xc2')]+='X';}this[_0xa971('0xd')]['setVariable'](_0xa971('0x142'),_0x2fb17f?_0x2fb17f['toLowerCase']():'');var _0x4a74dc=this[_0xa971('0xd')][_0xa971('0x59')](_0xa971('0x143'),[_0x2fb17f,_0x3a7718[_0xa971('0xc2')],_0x3a7718[_0xa971('0xc3')],_0xd9d347,_0x3a7718['timeout'],_0x3a7718[_0xa971('0x7')],_0x3a7718[_0xa971('0x144')],_0x3a7718[_0xa971('0x145')],'',_0x3a7718[_0xa971('0x146')]]);if(_0x4a74dc[_0xa971('0x8b')]===-0x1){return _0x4a74dc;}return this['channel'][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x97'),_0xa971('0x143'),_0x2fb17f));};AGIVertices[_0xa971('0x13')][_0xa971('0x147')]=function(_0x264d62){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x148'),_0x264d62[_0xa971('0x38')]));var _0x5cbfd0=_0x264d62['recordingFormat']||_0xa971('0x105');var _0x210f74=util[_0xa971('0x29')]('%s_%s',this[_0xa971('0xd')][_0xa971('0x37')],rs[_0xa971('0xe9')](0x5));var _0x1a3aa7=util[_0xa971('0x29')](_0xa971('0x149'),FILES_PATH,_0x210f74,_0x5cbfd0);var _0x28dd4e=util[_0xa971('0x29')]('%s/recordings/%s',FILES_PATH,_0x210f74);this['createSquareRecording'][_0xa971('0x84')](this,_0x264d62,_0x210f74,_0x1a3aa7);this[_0xa971('0xd')][_0xa971('0x83')]('RECORDING_SAVENAME',_0x210f74);logger[_0xa971('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x28dd4e,_0x5cbfd0,_0x264d62['escape_digits'],_0x264d62['timeout']);return this['channel'][_0xa971('0xff')](_0x28dd4e,_0x5cbfd0,_0x264d62[_0xa971('0x14a')],_0x264d62[_0xa971('0x88')],undefined,!![]);};AGIVertices[_0xa971('0x13')]['saydigits']=function(_0x3b7f34){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x14b'),_0x3b7f34[_0xa971('0x38')]));return this[_0xa971('0xd')]['sayDigits'](_0x3b7f34[_0xa971('0x14c')]['replace'](/\s+/g,''),_0x3b7f34[_0xa971('0x14a')]);};AGIVertices[_0xa971('0x13')][_0xa971('0x14d')]=function(_0x4a9232){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4a9232[_0xa971('0x38')]));return this[_0xa971('0xd')][_0xa971('0x14e')](_0x4a9232['number'][_0xa971('0x5b')](/\s+/g,''),_0x4a9232[_0xa971('0x14a')]);};AGIVertices[_0xa971('0x13')][_0xa971('0x14f')]=function(_0x460ac2){logger[_0xa971('0x2d')](util['format'](_0xa971('0x150'),_0x460ac2['label']));return this[_0xa971('0xd')]['sayPhonetic'](_0x460ac2['text'],_0x460ac2[_0xa971('0x14a')]);};AGIVertices['prototype'][_0xa971('0x151')]=function(_0x3a5650){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3a5650[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x3a5650[_0xa971('0x152')])){return this[_0xa971('0xd')]['noop'](_0xa971('0x153'));}var _0x212933=this['getMailAccount'][_0xa971('0x84')](this,_0x3a5650[_0xa971('0x152')]);if(!_0x212933||!_0x212933['Smtp']){return this[_0xa971('0xd')]['error'](_0x3a5650,_0xa971('0x154'));}var _0x57b09b={'from':util['format'](_0xa971('0x155'),_0x212933['name'],_0x212933[_0xa971('0x156')]||_0x212933['Smtp'][_0xa971('0x157')]),'to':_0x3a5650['to']||'','cc':_0x3a5650['cc']||'','bcc':_0x3a5650[_0xa971('0x158')]||'','subject':_0x3a5650[_0xa971('0x159')],'html':_0x3a5650[_0xa971('0x5f')],'text':_0x3a5650[_0xa971('0x5f')]};var _0x2db02c={'tls':{'rejectUnauthorized':![]}};if(_0x212933[_0xa971('0x15a')]['service']){_0x2db02c[_0xa971('0x15b')]=_0x212933[_0xa971('0x15a')][_0xa971('0x15b')];}else{_0x2db02c[_0xa971('0x15c')]=_0x212933[_0xa971('0x15a')][_0xa971('0x15c')];_0x2db02c[_0xa971('0x15d')]=_0x212933[_0xa971('0x15a')][_0xa971('0x15d')];_0x2db02c[_0xa971('0x15e')]=_0x212933[_0xa971('0x15a')]['secure'];}if(_0x212933[_0xa971('0x15a')]['authentication']){_0x2db02c[_0xa971('0x15f')]={'user':_0x212933[_0xa971('0x15a')]['user'],'pass':_0x212933[_0xa971('0x15a')][_0xa971('0x160')]};}if(this['isConfigured'](_0x3a5650[_0xa971('0x161')])){}logger[_0xa971('0x162')](_0xa971('0x163'),JSON[_0xa971('0xe6')](_0x57b09b));this[_0xa971('0x36')][_0xa971('0x84')](this,_0x3a5650,_0x3a5650[_0xa971('0x152')]);this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x164'),_0x212933[_0xa971('0x16')]));this[_0xa971('0x22')]['sync'](this,_0x2db02c,_0x57b09b);return this[_0xa971('0xd')]['noop'](_0xa971('0x165'));};AGIVertices[_0xa971('0x13')][_0xa971('0x166')]=function(_0x12bd93){logger[_0xa971('0x2d')](util['format'](_0xa971('0x167'),_0x12bd93['label']));return this[_0xa971('0xd')]['noop'](_0xa971('0x168'));};AGIVertices[_0xa971('0x13')][_0xa971('0x169')]=function(_0x1e45be){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x16a'),_0x1e45be[_0xa971('0x38')]));if(!this['isConfigured'](_0x1e45be[_0xa971('0x16b')])){return this['channel']['noop'](_0xa971('0x16c'));}var _0x2c3259=this['getSmsAccount'][_0xa971('0x84')](this,_0x1e45be[_0xa971('0x16b')]);if(!_0x2c3259){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x1e45be,_0xa971('0x16d'));}var _0x5229b5={'body':_0x1e45be[_0xa971('0x16e')],'phone':_0x1e45be['to']||'','SmsAccountId':_0x2c3259['id']};logger[_0xa971('0x162')](_0xa971('0x16f'),JSON[_0xa971('0xe6')](_0x5229b5));this[_0xa971('0x36')]['sync'](this,_0x1e45be,_0x1e45be[_0xa971('0x16b')]);this['channel'][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x170'),_0x2c3259['name']));this[_0xa971('0x35')][_0xa971('0x84')](this,_0x5229b5);return this['channel'][_0xa971('0x96')](_0xa971('0x171'));};AGIVertices[_0xa971('0x13')][_0xa971('0x172')]=function(_0x12bde4){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x173'),_0x12bde4[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x12bde4[_0xa971('0xb5')])){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x12bde4,_0xa971('0x174'));}var _0x2dad17=this['getVariable'][_0xa971('0x84')](this,_0x12bde4[_0xa971('0xb5')]);if(!_0x2dad17){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x12bde4,_0xa971('0xb7'));}return this[_0xa971('0xd')][_0xa971('0x83')](_0x2dad17,_0x12bde4['variable_value']);};AGIVertices[_0xa971('0x13')][_0xa971('0x175')]=function(_0x8eac1c){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x176'),_0x8eac1c[_0xa971('0x38')]));this['channel'][_0xa971('0x96')](_0xa971('0x177'));if(_0x8eac1c[_0xa971('0x8c')]==='yes'){this['channel'][_0xa971('0x96')](_0xa971('0x178'));return this[_0xa971('0xd')][_0xa971('0x8c')]();}return this[_0xa971('0xd')]['noop']('Skipped\x20Answer');};AGIVertices['prototype']['subproject']=function(_0x534a75){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x179'),_0x534a75[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x534a75[_0xa971('0x17a')])){return this[_0xa971('0xd')]['error'](_0x534a75,_0xa971('0x17b'));}var _0x4c57a2=this[_0xa971('0x17c')][_0xa971('0x84')](this,_0x534a75[_0xa971('0x17a')]);if(!this[_0xa971('0x69')](_0x4c57a2)){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x534a75,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x534a75[_0xa971('0x17a')]));}if(_0x4c57a2===this['channel'][_0xa971('0x3a')]){return this['channel']['error'](_0x534a75,_0xa971('0x17d'));}this[_0xa971('0x36')][_0xa971('0x84')](this,_0x534a75,_0x4c57a2);var _0x3de36c=this['channel'][_0xa971('0x59')]('AGI',util[_0xa971('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xa971('0x7')][_0xa971('0x15c')]||'127.0.0.1',_0x4c57a2,this[_0xa971('0xd')][_0xa971('0x3a')]));if(_0x3de36c['result']===-0x1){return _0x3de36c;}return this['channel'][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x97'),_0xa971('0x17e'),_0x4c57a2));};AGIVertices[_0xa971('0x13')]['system']=function(_0x45fdb2){logger[_0xa971('0x2d')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x45fdb2[_0xa971('0x38')]));var _0x3af0f8=this[_0xa971('0x58')][_0xa971('0x84')](this,_0x45fdb2['command']);this[_0xa971('0x36')][_0xa971('0x84')](this,_0x45fdb2,_0x45fdb2['command']);if(this[_0xa971('0x69')](_0x45fdb2[_0xa971('0xb5')])){var _0x3e1473=this['getVariable'][_0xa971('0x84')](this,_0x45fdb2[_0xa971('0xb5')]);if(_0x3e1473){this[_0xa971('0xd')]['setVariable'](_0x3e1473,_0x3af0f8);return this['channel']['noop'](util[_0xa971('0x29')](_0xa971('0x17f'),_0x45fdb2['command'],_0x3e1473));}}return this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x45fdb2[_0xa971('0x180')]));};AGIVertices[_0xa971('0x13')][_0xa971('0x181')]=function(_0x516ea0){logger[_0xa971('0x2d')](util['format'](_0xa971('0x182'),_0x516ea0[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x516ea0['text'])){return this[_0xa971('0xd')][_0xa971('0x96')](_0xa971('0x9b'));}this[_0xa971('0xd')][_0xa971('0x96')](util['format'](_0xa971('0x183'),_0x516ea0[_0xa971('0x5f')]));var _0x546419=this[_0xa971('0x5c')][_0xa971('0x84')](this,_0x516ea0);if(_0x546419){this[_0xa971('0xd')]['noop'](util[_0xa971('0x29')](_0xa971('0x184'),_0x546419));var _0x92142f=this[_0xa971('0xd')][_0xa971('0xd7')](_0x546419);try{fs['unlink'](_0x546419+_0xa971('0xd9'));}catch(_0xe91dde){logger['error'](_0xe91dde);}return _0x92142f;}return this[_0xa971('0xd')][_0xa971('0x2b')](_0x516ea0,_0xa971('0x185'));};AGIVertices[_0xa971('0x13')][_0xa971('0x186')]=function(_0x8f5d49){logger['info'](util[_0xa971('0x29')](_0xa971('0x187'),_0x8f5d49[_0xa971('0x38')]));if(!this[_0xa971('0x69')](_0x8f5d49[_0xa971('0x125')])){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x8f5d49,'no\x20find\x20by\x20configured');}logger[_0xa971('0x2d')](util[_0xa971('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa971('0xd')][_0xa971('0x3b')],_0x8f5d49[_0xa971('0x125')]));var _0x5a806c=this['agentUnpause'][_0xa971('0x84')](this,_0x8f5d49[_0xa971('0x125')]);if(_0x5a806c){logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x126'),this[_0xa971('0xd')][_0xa971('0x3b')],_0x8f5d49[_0xa971('0x125')]));this[_0xa971('0xd')][_0xa971('0x96')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xa971('0xd')][_0xa971('0x3b')],_0x8f5d49[_0xa971('0x125')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa971('0x2d')](util[_0xa971('0x29')](_0xa971('0x128'),this[_0xa971('0xd')][_0xa971('0x3b')],_0x8f5d49['findBy']));this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x128'),this[_0xa971('0xd')][_0xa971('0x3b')],_0x8f5d49[_0xa971('0x125')]));return{'code':0xc8,'result':_0xa971('0x13a')};}};AGIVertices[_0xa971('0x13')][_0xa971('0x188')]=function(_0x761059){logger[_0xa971('0x2d')](util[_0xa971('0x29')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x761059[_0xa971('0x38')]));var _0x639998=this[_0xa971('0xd')]['exec'](_0xa971('0x189'),[_0x761059['mailbox'],_0x761059['options']]);if(_0x639998[_0xa971('0x8b')]===-0x1){return _0x639998;}return this[_0xa971('0xd')][_0xa971('0x96')](util[_0xa971('0x29')](_0xa971('0x97'),_0xa971('0x189'),_0x761059[_0xa971('0x18a')]));};AGIVertices['prototype'][_0xa971('0x18b')]=function(_0x105715){logger['info'](util[_0xa971('0x29')](_0xa971('0x18c'),_0x105715['label']));if(!this[_0xa971('0x69')](_0x105715['variable_id'])){return this[_0xa971('0xd')]['error'](_0x105715,_0xa971('0x174'));}var _0x19d68c=this[_0xa971('0x81')][_0xa971('0x84')](this,_0x105715[_0xa971('0xb5')]);if(!_0x19d68c){return this[_0xa971('0xd')][_0xa971('0x2b')](_0x105715,_0xa971('0xb7'));}var _0x48538a=this[_0xa971('0xd')]['getVariable'](_0x19d68c);return{'code':0xc8,'result':_0x48538a[_0xa971('0x80')]?_0x48538a['extra']:'-'};};String[_0xa971('0x13')][_0xa971('0x7f')]=function(_0x436c5d,_0x38780f){return this[_0xa971('0x7d')](_0x436c5d)[_0xa971('0x18d')](_0x38780f);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 79c4d15..83b5bba 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 _0xee14=['blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','Action','QueuePause','ACW','getAgent','then','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','uniqueid','[TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','attended','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xee14,0x13a));var _0x4ee1=function(_0x289f13,_0x3c9745){_0x289f13=_0x289f13-0x0;var _0x4ba62f=_0xee14[_0x289f13];return _0x4ba62f;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4ee1('0x0'));var ami=require(_0x4ee1('0x1'));var logger=require(_0x4ee1('0x2'))(_0x4ee1('0x3'));var RpcUser=require(_0x4ee1('0x4'));var RpcVoiceAgentReport=require(_0x4ee1('0x5'));function Acw(_0x34a0ae){this[_0x4ee1('0x6')]=_0x34a0ae[_0x4ee1('0x6')];this['agents']=_0x34a0ae[_0x4ee1('0x7')];this['timers']=_0x34a0ae[_0x4ee1('0x8')];this[_0x4ee1('0x9')]={};ami['on'](_0x4ee1('0xa'),this[_0x4ee1('0xb')][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0xd'),this['syncHangupRequest'][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0xe'),this['syncHangup'][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0xf'),this[_0x4ee1('0x10')][_0x4ee1('0xc')](this));ami['on']('attendedtransfer',this[_0x4ee1('0x11')][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0x12'),this[_0x4ee1('0x13')][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0x14'),this['syncAgentConnectPreview'][_0x4ee1('0xc')](this));}function getDiff(_0x461f99){var _0x1096a5=moment()[_0x4ee1('0x15')](0x0);var _0x46d2c2=moment(_0x461f99)[_0x4ee1('0x15')](0x0);return _0x1096a5[_0x4ee1('0x16')](_0x46d2c2,_0x4ee1('0x17'));}Acw[_0x4ee1('0x18')]['startAcw']=function(_0x2f9194){try{var _0x38008f=this;var _0x34651b=this[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x19')];var _0x38fc33=this[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x1a')];ami[_0x4ee1('0x1b')]({'action':_0x4ee1('0x1c'),'interface':_0x34651b,'paused':!![],'reason':_0x4ee1('0x1d')})['then'](function(_0x236215){if(_0x38008f[_0x4ee1('0x7')][_0x34651b]){return RpcUser[_0x4ee1('0x1e')](_0x38008f[_0x4ee1('0x7')][_0x34651b]['id'])[_0x4ee1('0x1f')](function(_0x383ab0){if(_0x383ab0&&!_0x383ab0['voicePause']){logger[_0x4ee1('0x20')](_0x4ee1('0x21'),_0x2f9194,_0x34651b,_0x38fc33);return RpcUser[_0x4ee1('0x22')](_0x38008f[_0x4ee1('0x7')][_0x34651b],_0x4ee1('0x1d'),_0x2f9194)[_0x4ee1('0x1f')](function(_0x328f21){_0x38008f[_0x4ee1('0x8')][_0x34651b]={};logger[_0x4ee1('0x20')](_0x4ee1('0x23'),_0x2f9194,_0x38008f['voiceQueues'][_0x38fc33]['acwTimeout'],_0x34651b,_0x38fc33);_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x24')]=setTimeout(_0x38008f[_0x4ee1('0x25')][_0x4ee1('0xc')](_0x38008f,_0x34651b),_0x38008f[_0x4ee1('0x6')][_0x38fc33][_0x4ee1('0x26')]*0x3e8);_0x38008f['timers'][_0x34651b]['lastPauseAt']=_0x328f21[_0x4ee1('0x27')];_0x38008f[_0x4ee1('0x8')][_0x34651b]['uniqueid']=_0x2f9194;_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x1a')]=_0x38fc33;_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x28')]=function(){var _0x2d699c=getDiff(_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x27')]);clearTimeout(_0x38008f['timers'][_0x34651b][_0x4ee1('0x24')]);RpcVoiceAgentReport['update']({'acwtime':_0x2d699c},_0x38008f[_0x4ee1('0x8')][_0x34651b]['uniqueid'],_0x34651b)[_0x4ee1('0x1f')](function(_0x1d91be){logger[_0x4ee1('0x20')](_0x4ee1('0x29'),_0x2f9194,_0x2d699c,_0x1d91be);})[_0x4ee1('0x2a')](function(_0x4d5331){logger[_0x4ee1('0x2b')]('[%s][UPDATE][ERRORS:%s]',_0x2f9194,_0x4d5331);});delete _0x38008f[_0x4ee1('0x8')][_0x34651b];};});}else{logger[_0x4ee1('0x20')](_0x4ee1('0x2c'),_0x2f9194,_0x34651b,_0x38fc33);}});}})[_0x4ee1('0x2a')](function(_0xac31e9){logger['error'](_0x4ee1('0x23'),_0x2f9194,_0x38008f[_0x4ee1('0x6')][_0x38fc33][_0x4ee1('0x26')],_0x34651b,_0x38fc33);})[_0x4ee1('0x2d')](function(){delete _0x38008f[_0x4ee1('0x9')][_0x2f9194];});}catch(_0x393990){logger['error']('[ACW][START]\x20%s',_0x393990[_0x4ee1('0x2e')]);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x25')]=function(_0x5a2f6f){try{var _0x963c2b=this;if(_0x963c2b[_0x4ee1('0x8')][_0x5a2f6f]){var _0x264aed=_0x963c2b[_0x4ee1('0x8')][_0x5a2f6f][_0x4ee1('0x2f')];var _0x115590=_0x963c2b[_0x4ee1('0x8')][_0x5a2f6f][_0x4ee1('0x1a')];var _0x36898c=_0x963c2b[_0x4ee1('0x6')][_0x115590][_0x4ee1('0x26')];logger[_0x4ee1('0x20')](_0x4ee1('0x30'),_0x5a2f6f);RpcUser['saveUnpause'](this[_0x4ee1('0x7')][_0x5a2f6f]);RpcVoiceAgentReport[_0x4ee1('0x31')]({'acwtime':_0x36898c,'agentacw':!![]},_0x264aed,_0x5a2f6f)[_0x4ee1('0x1f')](function(_0x50539f){logger['info'](_0x4ee1('0x29'),_0x264aed,_0x36898c,_0x50539f);})[_0x4ee1('0x2a')](function(_0x74e6e2){logger[_0x4ee1('0x2b')]('[%s][UPDATE][ERRORS:%s]',_0x264aed,_0x74e6e2);});}else{logger[_0x4ee1('0x2b')](_0x4ee1('0x32'),_0x5a2f6f);if(_0x963c2b[_0x4ee1('0x8')]){logger[_0x4ee1('0x20')](_0x4ee1('0x33'),JSON[_0x4ee1('0x34')](_0x963c2b[_0x4ee1('0x8')]));}}}catch(_0x325b59){logger['error'](_0x4ee1('0x35'),_0x325b59[_0x4ee1('0x2e')]);}};Acw[_0x4ee1('0x18')][_0x4ee1('0xb')]=function(_0x45bb22){try{if(this[_0x4ee1('0x6')][_0x45bb22['queue']]&&this[_0x4ee1('0x6')][_0x45bb22[_0x4ee1('0x1a')]][_0x4ee1('0x3')]){if(this[_0x4ee1('0x7')][_0x45bb22[_0x4ee1('0x19')]]){this[_0x4ee1('0x9')][_0x45bb22[_0x4ee1('0x2f')]]={'queue':_0x45bb22[_0x4ee1('0x1a')],'interface':_0x45bb22[_0x4ee1('0x19')]};}}}catch(_0x29493d){logger[_0x4ee1('0x2b')](_0x4ee1('0x36'),_0x29493d[_0x4ee1('0x2e')]);}};Acw['prototype'][_0x4ee1('0x37')]=function(_0x40a3e3){try{if(this['voiceQueues'][_0x40a3e3[_0x4ee1('0x1a')]]&&this['voiceQueues'][_0x40a3e3[_0x4ee1('0x1a')]]['acw']){if(this[_0x4ee1('0x7')][_0x40a3e3[_0x4ee1('0x19')]]){this['channels'][_0x40a3e3[_0x4ee1('0x2f')]]={'queue':_0x40a3e3[_0x4ee1('0x1a')],'interface':_0x40a3e3[_0x4ee1('0x19')]};}}}catch(_0x3dfd9c){logger['error'](_0x4ee1('0x38'),_0x3dfd9c[_0x4ee1('0x2e')]);}};Acw[_0x4ee1('0x18')]['syncHangupRequest']=function(_0x4fbe92){try{if(this[_0x4ee1('0x9')][_0x4fbe92[_0x4ee1('0x2f')]]&&_[_0x4ee1('0x39')](this[_0x4ee1('0x9')][_0x4fbe92[_0x4ee1('0x2f')]]['attended'])){logger['info'](_0x4ee1('0x3a'),_0x4fbe92[_0x4ee1('0x2f')]);this[_0x4ee1('0x3b')](_0x4fbe92[_0x4ee1('0x2f')]);}else if(this['channels'][_0x4fbe92[_0x4ee1('0x3c')]]&&_[_0x4ee1('0x39')](this['channels'][_0x4fbe92[_0x4ee1('0x3c')]][_0x4ee1('0x3d')])){logger[_0x4ee1('0x20')](_0x4ee1('0x3e'),_0x4fbe92[_0x4ee1('0x3c')]);this[_0x4ee1('0x3b')](_0x4fbe92[_0x4ee1('0x3c')]);}}catch(_0x4d6926){logger[_0x4ee1('0x2b')]('[ACW][syncHangupRequest]\x20%s',_0x4d6926['message']);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x3f')]=function(_0x3bda30){try{if(this[_0x4ee1('0x9')][_0x3bda30['uniqueid']]&&this[_0x4ee1('0x9')][_0x3bda30[_0x4ee1('0x2f')]][_0x4ee1('0x3d')]){logger[_0x4ee1('0x20')](_0x4ee1('0x40'),_0x3bda30['uniqueid']);this[_0x4ee1('0x3b')](_0x3bda30[_0x4ee1('0x2f')]);}else if(this[_0x4ee1('0x9')][_0x3bda30['linkedid']]&&this[_0x4ee1('0x9')][_0x3bda30['linkedid']][_0x4ee1('0x3d')]){logger['info'](_0x4ee1('0x41'),_0x3bda30['linkedid']);this[_0x4ee1('0x3b')](_0x3bda30['linkedid']);}}catch(_0x58919){logger[_0x4ee1('0x2b')](_0x4ee1('0x42'),_0x58919['message']);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x11')]=function(_0xcdb873){try{if(!_[_0x4ee1('0x43')](this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x44')]])){this[_0x4ee1('0x3b')](_0xcdb873['transfereeuniqueid']);if(this['channels'][_0xcdb873[_0x4ee1('0x45')]]){this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x45')]][_0x4ee1('0x3d')]=!![];this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x46')]]=this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x45')]];delete this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x45')]];}}else if(!_[_0x4ee1('0x43')](this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x46')]])){this['startAcw'](_0xcdb873[_0x4ee1('0x46')]);if(this['channels'][_0xcdb873[_0x4ee1('0x47')]]){this[_0x4ee1('0x9')][_0xcdb873['origtransfereruniqueid']][_0x4ee1('0x3d')]=!![];this[_0x4ee1('0x9')][_0xcdb873['transfereeuniqueid']]=this['channels'][_0xcdb873[_0x4ee1('0x47')]];delete this['channels'][_0xcdb873[_0x4ee1('0x47')]];}}}catch(_0x2785b8){logger['error'](_0x4ee1('0x48'),_0x2785b8[_0x4ee1('0x2e')]);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x13')]=function(_0x1a68e1){try{if(this[_0x4ee1('0x9')][_0x1a68e1[_0x4ee1('0x49')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x4ee1('0x34')](_0x1a68e1[_0x4ee1('0x49')]));this['startAcw'](_0x1a68e1[_0x4ee1('0x49')]);}else if(this[_0x4ee1('0x9')][_0x1a68e1[_0x4ee1('0x4a')]]){logger['info'](_0x4ee1('0x4b'),JSON['stringify'](_0x1a68e1[_0x4ee1('0x4a')]));this['startAcw'](_0x1a68e1['transfererlinkedid']);}}catch(_0x17d663){logger[_0x4ee1('0x2b')](_0x4ee1('0x4c'),_0x17d663[_0x4ee1('0x2e')]);}};Acw[_0x4ee1('0x18')]['syncAgentRingNoAnswer']=function(_0x27d354){try{if(this[_0x4ee1('0x6')][_0x27d354[_0x4ee1('0x1a')]]&&this['voiceQueues'][_0x27d354[_0x4ee1('0x1a')]][_0x4ee1('0x4d')]===_0x4ee1('0x4e')){if(this[_0x4ee1('0x7')][_0x27d354[_0x4ee1('0x19')]]){logger[_0x4ee1('0x20')](_0x4ee1('0x4f'),_0x27d354[_0x4ee1('0x2f')],_0x27d354[_0x4ee1('0x19')],_0x27d354[_0x4ee1('0x1a')]);return RpcUser[_0x4ee1('0x22')](this[_0x4ee1('0x7')][_0x27d354['interface']],_0x4ee1('0x50'),_0x27d354['uniqueid']);}}}catch(_0x25cfc3){logger['error'](_0x4ee1('0x51'),_0x25cfc3[_0x4ee1('0x2e')]);}};module[_0x4ee1('0x52')]=Acw; \ No newline at end of file +var _0x5d58=['[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','bind','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','diff','seconds','startAcw','channels','interface','queue','Action','QueuePause','ACW','then','getAgent','voicePause','info','savePause','acwTimeout','lastPauseAt','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','prototype','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','uniqueid','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s'];(function(_0x5d6a0e,_0x2002b2){var _0x34c9fd=function(_0x20794e){while(--_0x20794e){_0x5d6a0e['push'](_0x5d6a0e['shift']());}};_0x34c9fd(++_0x2002b2);}(_0x5d58,0x187));var _0x85d5=function(_0x16ea08,_0x280221){_0x16ea08=_0x16ea08-0x0;var _0x307436=_0x5d58[_0x16ea08];return _0x307436;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0x85d5('0x0'));var RpcUser=require(_0x85d5('0x1'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1469fc){this[_0x85d5('0x2')]=_0x1469fc['voiceQueues'];this[_0x85d5('0x3')]=_0x1469fc[_0x85d5('0x3')];this[_0x85d5('0x4')]=_0x1469fc[_0x85d5('0x4')];this['channels']={};ami['on'](_0x85d5('0x5'),this[_0x85d5('0x6')]['bind'](this));ami['on'](_0x85d5('0x7'),this['syncHangupRequest'][_0x85d5('0x8')](this));ami['on'](_0x85d5('0x9'),this[_0x85d5('0xa')]['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x85d5('0x8')](this));ami['on'](_0x85d5('0xb'),this[_0x85d5('0xc')][_0x85d5('0x8')](this));ami['on'](_0x85d5('0xd'),this[_0x85d5('0xe')][_0x85d5('0x8')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x3e1285){var _0x226d34=moment()[_0x85d5('0xf')](0x0);var _0x1704f0=moment(_0x3e1285)[_0x85d5('0xf')](0x0);return _0x226d34[_0x85d5('0x10')](_0x1704f0,_0x85d5('0x11'));}Acw['prototype'][_0x85d5('0x12')]=function(_0x2d7c95){try{var _0x1621ed=this;var _0x3da3f4=this[_0x85d5('0x13')][_0x2d7c95][_0x85d5('0x14')];var _0x2dbf13=this[_0x85d5('0x13')][_0x2d7c95][_0x85d5('0x15')];ami[_0x85d5('0x16')]({'action':_0x85d5('0x17'),'interface':_0x3da3f4,'paused':!![],'reason':_0x85d5('0x18')})[_0x85d5('0x19')](function(_0x3df634){if(_0x1621ed[_0x85d5('0x3')][_0x3da3f4]){return RpcUser[_0x85d5('0x1a')](_0x1621ed[_0x85d5('0x3')][_0x3da3f4]['id'])[_0x85d5('0x19')](function(_0x53bd11){if(_0x53bd11&&!_0x53bd11[_0x85d5('0x1b')]){logger[_0x85d5('0x1c')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2d7c95,_0x3da3f4,_0x2dbf13);return RpcUser[_0x85d5('0x1d')](_0x1621ed[_0x85d5('0x3')][_0x3da3f4],'ACW',_0x2d7c95)['then'](function(_0x347337){_0x1621ed['timers'][_0x3da3f4]={};logger[_0x85d5('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2d7c95,_0x1621ed[_0x85d5('0x2')][_0x2dbf13][_0x85d5('0x1e')],_0x3da3f4,_0x2dbf13);_0x1621ed['timers'][_0x3da3f4]['timer']=setTimeout(_0x1621ed['stopAcw']['bind'](_0x1621ed,_0x3da3f4),_0x1621ed[_0x85d5('0x2')][_0x2dbf13][_0x85d5('0x1e')]*0x3e8);_0x1621ed[_0x85d5('0x4')][_0x3da3f4][_0x85d5('0x1f')]=_0x347337[_0x85d5('0x1f')];_0x1621ed[_0x85d5('0x4')][_0x3da3f4]['uniqueid']=_0x2d7c95;_0x1621ed[_0x85d5('0x4')][_0x3da3f4]['queue']=_0x2dbf13;_0x1621ed[_0x85d5('0x4')][_0x3da3f4][_0x85d5('0x20')]=function(){var _0x233ccd=getDiff(_0x1621ed['timers'][_0x3da3f4][_0x85d5('0x1f')]);clearTimeout(_0x1621ed[_0x85d5('0x4')][_0x3da3f4][_0x85d5('0x21')]);RpcVoiceAgentReport[_0x85d5('0x22')]({'acwtime':_0x233ccd},_0x1621ed[_0x85d5('0x4')][_0x3da3f4]['uniqueid'],_0x3da3f4)[_0x85d5('0x19')](function(_0x476c8b){logger[_0x85d5('0x1c')](_0x85d5('0x23'),_0x2d7c95,_0x233ccd,_0x476c8b);})[_0x85d5('0x24')](function(_0x572daf){logger['error'](_0x85d5('0x25'),_0x2d7c95,_0x572daf);});delete _0x1621ed[_0x85d5('0x4')][_0x3da3f4];};});}else{logger[_0x85d5('0x1c')](_0x85d5('0x26'),_0x2d7c95,_0x3da3f4,_0x2dbf13);}});}})[_0x85d5('0x24')](function(_0x5efb7d){logger[_0x85d5('0x27')](_0x85d5('0x28'),_0x2d7c95,_0x1621ed['voiceQueues'][_0x2dbf13]['acwTimeout'],_0x3da3f4,_0x2dbf13);})[_0x85d5('0x29')](function(){delete _0x1621ed[_0x85d5('0x13')][_0x2d7c95];});}catch(_0x5a442c){logger[_0x85d5('0x27')]('[ACW][START]\x20%s',_0x5a442c[_0x85d5('0x2a')]);}};Acw[_0x85d5('0x2b')]['stopAcw']=function(_0x377ca1){try{var _0x10449e=this;if(_0x10449e[_0x85d5('0x4')][_0x377ca1]){var _0x2220b2=_0x10449e['timers'][_0x377ca1]['uniqueid'];var _0x40820e=_0x10449e[_0x85d5('0x4')][_0x377ca1][_0x85d5('0x15')];var _0x3546d6=_0x10449e[_0x85d5('0x2')][_0x40820e][_0x85d5('0x1e')];logger[_0x85d5('0x1c')](_0x85d5('0x2c'),_0x377ca1);RpcUser[_0x85d5('0x2d')](this['agents'][_0x377ca1]);RpcVoiceAgentReport['update']({'acwtime':_0x3546d6,'agentacw':!![]},_0x2220b2,_0x377ca1)[_0x85d5('0x19')](function(_0xb17769){logger[_0x85d5('0x1c')](_0x85d5('0x23'),_0x2220b2,_0x3546d6,_0xb17769);})[_0x85d5('0x24')](function(_0x2a0ff0){logger[_0x85d5('0x27')](_0x85d5('0x25'),_0x2220b2,_0x2a0ff0);});}else{logger['error'](_0x85d5('0x2e'),_0x377ca1);if(_0x10449e[_0x85d5('0x4')]){logger[_0x85d5('0x1c')](_0x85d5('0x2f'),JSON['stringify'](_0x10449e[_0x85d5('0x4')]));}}}catch(_0x1d530c){logger[_0x85d5('0x27')](_0x85d5('0x30'),_0x1d530c['message']);}};Acw[_0x85d5('0x2b')]['syncAgentConnect']=function(_0x484a4d){try{if(this[_0x85d5('0x2')][_0x484a4d['queue']]&&this[_0x85d5('0x2')][_0x484a4d['queue']]['acw']){if(this[_0x85d5('0x3')][_0x484a4d[_0x85d5('0x14')]]){this[_0x85d5('0x13')][_0x484a4d[_0x85d5('0x31')]]={'queue':_0x484a4d[_0x85d5('0x15')],'interface':_0x484a4d['interface']};}}}catch(_0x519ced){logger[_0x85d5('0x27')](_0x85d5('0x32'),_0x519ced[_0x85d5('0x2a')]);}};Acw[_0x85d5('0x2b')][_0x85d5('0x33')]=function(_0x139872){try{if(this['voiceQueues'][_0x139872['queue']]&&this[_0x85d5('0x2')][_0x139872['queue']][_0x85d5('0x0')]){if(this[_0x85d5('0x3')][_0x139872[_0x85d5('0x14')]]){this[_0x85d5('0x13')][_0x139872[_0x85d5('0x31')]]={'queue':_0x139872['queue'],'interface':_0x139872['interface']};}}}catch(_0x34a42b){logger[_0x85d5('0x27')](_0x85d5('0x34'),_0x34a42b[_0x85d5('0x2a')]);}};Acw[_0x85d5('0x2b')][_0x85d5('0x35')]=function(_0x270b19){try{if(this[_0x85d5('0x13')][_0x270b19[_0x85d5('0x31')]]&&_[_0x85d5('0x36')](this[_0x85d5('0x13')][_0x270b19[_0x85d5('0x31')]][_0x85d5('0x37')])){logger[_0x85d5('0x1c')](_0x85d5('0x38'),_0x270b19[_0x85d5('0x31')]);this[_0x85d5('0x12')](_0x270b19['uniqueid']);}else if(this['channels'][_0x270b19[_0x85d5('0x39')]]&&_[_0x85d5('0x36')](this[_0x85d5('0x13')][_0x270b19[_0x85d5('0x39')]][_0x85d5('0x37')])){logger[_0x85d5('0x1c')]('[%s][HANGUP:LINKEDID]',_0x270b19[_0x85d5('0x39')]);this['startAcw'](_0x270b19['linkedid']);}}catch(_0x1cc44b){logger[_0x85d5('0x27')](_0x85d5('0x3a'),_0x1cc44b[_0x85d5('0x2a')]);}};Acw[_0x85d5('0x2b')]['syncHangup']=function(_0x26adc5){try{if(this['channels'][_0x26adc5[_0x85d5('0x31')]]&&this[_0x85d5('0x13')][_0x26adc5[_0x85d5('0x31')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x26adc5[_0x85d5('0x31')]);this[_0x85d5('0x12')](_0x26adc5[_0x85d5('0x31')]);}else if(this['channels'][_0x26adc5['linkedid']]&&this[_0x85d5('0x13')][_0x26adc5[_0x85d5('0x39')]][_0x85d5('0x37')]){logger[_0x85d5('0x1c')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x26adc5[_0x85d5('0x39')]);this[_0x85d5('0x12')](_0x26adc5[_0x85d5('0x39')]);}}catch(_0x912786){logger[_0x85d5('0x27')](_0x85d5('0x3b'),_0x912786[_0x85d5('0x2a')]);}};Acw[_0x85d5('0x2b')][_0x85d5('0xc')]=function(_0x873f7e){try{if(!_[_0x85d5('0x3c')](this[_0x85d5('0x13')][_0x873f7e[_0x85d5('0x3d')]])){this[_0x85d5('0x12')](_0x873f7e[_0x85d5('0x3d')]);if(this['channels'][_0x873f7e[_0x85d5('0x3e')]]){this[_0x85d5('0x13')][_0x873f7e[_0x85d5('0x3e')]][_0x85d5('0x37')]=!![];this['channels'][_0x873f7e[_0x85d5('0x3f')]]=this['channels'][_0x873f7e[_0x85d5('0x3e')]];delete this[_0x85d5('0x13')][_0x873f7e[_0x85d5('0x3e')]];}}else if(!_[_0x85d5('0x3c')](this['channels'][_0x873f7e[_0x85d5('0x3f')]])){this['startAcw'](_0x873f7e['transfertargetuniqueid']);if(this['channels'][_0x873f7e[_0x85d5('0x40')]]){this[_0x85d5('0x13')][_0x873f7e[_0x85d5('0x40')]][_0x85d5('0x37')]=!![];this[_0x85d5('0x13')][_0x873f7e['transfereeuniqueid']]=this['channels'][_0x873f7e[_0x85d5('0x40')]];delete this[_0x85d5('0x13')][_0x873f7e[_0x85d5('0x40')]];}}}catch(_0xfac901){logger['error'](_0x85d5('0x41'),_0xfac901[_0x85d5('0x2a')]);}};Acw[_0x85d5('0x2b')]['syncBlindTransfer']=function(_0x565ebe){try{if(this[_0x85d5('0x13')][_0x565ebe[_0x85d5('0x42')]]){logger[_0x85d5('0x1c')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x85d5('0x43')](_0x565ebe[_0x85d5('0x42')]));this[_0x85d5('0x12')](_0x565ebe[_0x85d5('0x42')]);}else if(this['channels'][_0x565ebe[_0x85d5('0x44')]]){logger[_0x85d5('0x1c')](_0x85d5('0x45'),JSON['stringify'](_0x565ebe[_0x85d5('0x44')]));this[_0x85d5('0x12')](_0x565ebe[_0x85d5('0x44')]);}}catch(_0x561bde){logger[_0x85d5('0x27')](_0x85d5('0x46'),_0x561bde['message']);}};Acw[_0x85d5('0x2b')]['syncAgentRingNoAnswer']=function(_0x13424a){try{if(this['voiceQueues'][_0x13424a[_0x85d5('0x15')]]&&this[_0x85d5('0x2')][_0x13424a[_0x85d5('0x15')]][_0x85d5('0x47')]==='all'){if(this[_0x85d5('0x3')][_0x13424a[_0x85d5('0x14')]]){logger[_0x85d5('0x1c')](_0x85d5('0x48'),_0x13424a[_0x85d5('0x31')],_0x13424a[_0x85d5('0x14')],_0x13424a[_0x85d5('0x15')]);return RpcUser[_0x85d5('0x1d')](this['agents'][_0x13424a['interface']],_0x85d5('0x49'),_0x13424a['uniqueid']);}}}catch(_0x29e17f){logger[_0x85d5('0x27')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x29e17f['message']);}};module[_0x85d5('0x4a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 59fd8c9..0229985 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 _0xf1ec=['sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','log','close','asterisk-manager','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf1ec,0x1e6));var _0xcf1e=function(_0x3c9fe0,_0x46fe3e){_0x3c9fe0=_0x3c9fe0-0x0;var _0x5a519e=_0xf1ec[_0x3c9fe0];return _0x5a519e;};'use strict';var Manager=require(_0xcf1e('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require(_0xcf1e('0x1'));var _=require(_0xcf1e('0x2'));var logger=require(_0xcf1e('0x3'))(_0xcf1e('0x4'));var config=require(_0xcf1e('0x5'));var ami=new Manager(config[_0xcf1e('0x6')][_0xcf1e('0x7')],config[_0xcf1e('0x6')]['ip'],config[_0xcf1e('0x6')][_0xcf1e('0x8')],config['asterisk'][_0xcf1e('0x9')],!![]);ami[_0xcf1e('0xa')]();ami[_0xcf1e('0xb')]=BPromise['promisify'](ami[_0xcf1e('0xc')]);function error(_0x40f32c){logger[_0xcf1e('0xd')](util[_0xcf1e('0xe')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xcf1e('0x8')],config[_0xcf1e('0x6')]['ip'],config['asterisk'][_0xcf1e('0x7')],util[_0xcf1e('0xf')](_0x40f32c,![],null)));}function close(){logger[_0xcf1e('0xd')](util[_0xcf1e('0xe')](_0xcf1e('0x10'),config[_0xcf1e('0x6')]['username'],config[_0xcf1e('0x6')]['ip'],config[_0xcf1e('0x6')]['port']));}ami[_0xcf1e('0x11')]=function(){return function(){return ami[_0xcf1e('0xb')]({'action':_0xcf1e('0x12')});};};ami[_0xcf1e('0x13')]=function(){return function(){return ami[_0xcf1e('0xb')]({'action':_0xcf1e('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xcf1e('0xb')]({'action':_0xcf1e('0x15')});};};ami[_0xcf1e('0x16')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xcf1e('0xb')]({'action':_0xcf1e('0x17')});};};function connect(_0x56642d){logger[_0xcf1e('0x18')](util[_0xcf1e('0xe')](_0xcf1e('0x19'),config[_0xcf1e('0x6')][_0xcf1e('0x8')],config[_0xcf1e('0x6')]['ip'],config[_0xcf1e('0x6')][_0xcf1e('0x7')]));ami[_0xcf1e('0x1a')](_0xcf1e('0xd'),error);ami['once']('close',close);}ami['on'](_0xcf1e('0x1b'),connect);ami['on'](_0xcf1e('0x1c'),function(_0x41edf0){logger[_0xcf1e('0x18')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xcf1e('0x6')][_0xcf1e('0x8')],config['asterisk']['ip'],config[_0xcf1e('0x6')]['port'],util[_0xcf1e('0xf')](_0x41edf0,![],null)));});ami['on']('fullybooted',function(_0x9864bf){logger[_0xcf1e('0x18')](util[_0xcf1e('0xe')](_0xcf1e('0x1d'),config[_0xcf1e('0x6')][_0xcf1e('0x8')],config[_0xcf1e('0x6')]['ip'],config[_0xcf1e('0x6')][_0xcf1e('0x7')]));return BPromise[_0xcf1e('0x1e')]()['then'](ami[_0xcf1e('0x11')]())[_0xcf1e('0x1f')](ami[_0xcf1e('0x13')]())[_0xcf1e('0x1f')](ami['actionSipPeerStatus']())[_0xcf1e('0x1f')](ami[_0xcf1e('0x16')]())[_0xcf1e('0x1f')](ami[_0xcf1e('0x20')]())[_0xcf1e('0x21')](function(_0x4fcbb1){console[_0xcf1e('0x22')](_0x4fcbb1);});});ami[_0xcf1e('0x1a')](_0xcf1e('0xd'),error);ami[_0xcf1e('0x1a')](_0xcf1e('0x23'),close);module['exports']=ami; \ No newline at end of file +var _0xb7c9=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','port','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','resolve','then','catch','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment','asterisk','keepConnected','Action','promisify','action','format'];(function(_0x4368d4,_0x52bdd9){var _0x4d7d71=function(_0x35f8d8){while(--_0x35f8d8){_0x4368d4['push'](_0x4368d4['shift']());}};_0x4d7d71(++_0x52bdd9);}(_0xb7c9,0x17f));var _0x9b7c=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xb7c9[_0x411017];return _0x2adeea;};'use strict';var Manager=require(_0x9b7c('0x0'));var BPromise=require(_0x9b7c('0x1'));var moment=require(_0x9b7c('0x2'));var util=require('util');var _=require(_0x9b7c('0x3'));var logger=require(_0x9b7c('0x4'))(_0x9b7c('0x5'));var config=require(_0x9b7c('0x6'));var ami=new Manager(config[_0x9b7c('0x7')]['port'],config['asterisk']['ip'],config['asterisk']['username'],config[_0x9b7c('0x7')]['password'],!![]);ami[_0x9b7c('0x8')]();ami[_0x9b7c('0x9')]=BPromise[_0x9b7c('0xa')](ami[_0x9b7c('0xb')]);function error(_0x2562a6){logger['error'](util[_0x9b7c('0xc')](_0x9b7c('0xd'),config[_0x9b7c('0x7')][_0x9b7c('0xe')],config['asterisk']['ip'],config[_0x9b7c('0x7')][_0x9b7c('0xf')],util[_0x9b7c('0x10')](_0x2562a6,![],null)));}function close(){logger[_0x9b7c('0x11')](util[_0x9b7c('0xc')](_0x9b7c('0x12'),config['asterisk']['username'],config[_0x9b7c('0x7')]['ip'],config['asterisk'][_0x9b7c('0xf')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x9b7c('0x9')]({'action':_0x9b7c('0x13')});};};ami[_0x9b7c('0x14')]=function(){return function(){return ami[_0x9b7c('0x9')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x9b7c('0x15')});};};ami[_0x9b7c('0x16')]=function(){return function(){return ami[_0x9b7c('0x9')]({'action':'queuesummary'});};};ami[_0x9b7c('0x17')]=function(){return function(){return ami[_0x9b7c('0x9')]({'action':_0x9b7c('0x18')});};};function connect(_0x3910ff){logger[_0x9b7c('0x19')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x9b7c('0x7')]['username'],config['asterisk']['ip'],config[_0x9b7c('0x7')][_0x9b7c('0xf')]));ami[_0x9b7c('0x1a')](_0x9b7c('0x11'),error);ami[_0x9b7c('0x1a')]('close',close);}ami['on'](_0x9b7c('0x1b'),connect);ami['on'](_0x9b7c('0x1c'),function(_0x4897bd){logger[_0x9b7c('0x19')](util[_0x9b7c('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0x9b7c('0x7')]['ip'],config[_0x9b7c('0x7')][_0x9b7c('0xf')],util[_0x9b7c('0x10')](_0x4897bd,![],null)));});ami['on']('fullybooted',function(_0x44fccb){logger[_0x9b7c('0x19')](util[_0x9b7c('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x9b7c('0x7')][_0x9b7c('0xe')],config['asterisk']['ip'],config[_0x9b7c('0x7')][_0x9b7c('0xf')]));return BPromise[_0x9b7c('0x1d')]()[_0x9b7c('0x1e')](ami['actionSipShowRegistry']())[_0x9b7c('0x1e')](ami[_0x9b7c('0x14')]())[_0x9b7c('0x1e')](ami['actionSipPeerStatus']())[_0x9b7c('0x1e')](ami[_0x9b7c('0x16')]())[_0x9b7c('0x1e')](ami[_0x9b7c('0x17')]())[_0x9b7c('0x1f')](function(_0x33e5b1){console['log'](_0x33e5b1);});});ami[_0x9b7c('0x1a')](_0x9b7c('0x11'),error);ami['once']('close',close);module[_0x9b7c('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 12fb71b..21aaf4f 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 _0x5d70=['../../config/logger','http','request','then','debug','rpc','error','memberReport','result','exports','jayson/promise','bluebird'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x5d70,0xe2));var _0x05d7=function(_0x36c580,_0x4d5712){_0x36c580=_0x36c580-0x0;var _0x4690ce=_0x5d70[_0x36c580];return _0x4690ce;};'use strict';var jayson=require(_0x05d7('0x0'));var BPromise=require(_0x05d7('0x1'));var logger=require(_0x05d7('0x2'))('ami');var client=jayson['client'][_0x05d7('0x3')]({'port':0x2329});client['Request']=function(_0x512e6d,_0x360652){return new BPromise(function(_0x1afd6f,_0x35dfd8){return client[_0x05d7('0x4')](_0x512e6d,_0x360652)[_0x05d7('0x5')](function(_0x2fdb59){logger[_0x05d7('0x6')](_0x05d7('0x7'),'memberReport',_0x512e6d,_0x360652,_0x2fdb59);if(_0x2fdb59[_0x05d7('0x8')]){logger[_0x05d7('0x8')](_0x05d7('0x7'),_0x05d7('0x9'),_0x512e6d,_0x2fdb59[_0x05d7('0x8')]['message'],_0x360652);return _0x35dfd8(_0x2fdb59['error']['message']);}else{return _0x1afd6f(_0x2fdb59[_0x05d7('0xa')]);}})['catch'](function(_0x255c1c){logger[_0x05d7('0x8')](_0x05d7('0x7'),_0x05d7('0x9'),_0x512e6d,_0x255c1c,_0x360652);return _0x35dfd8(_0x255c1c);});});};module[_0x05d7('0xb')]=client; \ No newline at end of file +var _0x01d3=['Request','request','then','debug','rpc','memberReport','error','message','result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http'];(function(_0x36ffcb,_0x4d22c3){var _0xfdd92b=function(_0xb1e39f){while(--_0xb1e39f){_0x36ffcb['push'](_0x36ffcb['shift']());}};_0xfdd92b(++_0x4d22c3);}(_0x01d3,0x1ba));var _0x301d=function(_0x3c8f30,_0x38d497){_0x3c8f30=_0x3c8f30-0x0;var _0x259cf3=_0x01d3[_0x3c8f30];return _0x259cf3;};'use strict';var jayson=require(_0x301d('0x0'));var BPromise=require(_0x301d('0x1'));var logger=require(_0x301d('0x2'))(_0x301d('0x3'));var client=jayson[_0x301d('0x4')][_0x301d('0x5')]({'port':0x2329});client[_0x301d('0x6')]=function(_0x4e5e6e,_0x2b17e1){return new BPromise(function(_0x1567c2,_0x4d39bb){return client[_0x301d('0x7')](_0x4e5e6e,_0x2b17e1)[_0x301d('0x8')](function(_0x1983b9){logger[_0x301d('0x9')](_0x301d('0xa'),_0x301d('0xb'),_0x4e5e6e,_0x2b17e1,_0x1983b9);if(_0x1983b9[_0x301d('0xc')]){logger[_0x301d('0xc')](_0x301d('0xa'),_0x301d('0xb'),_0x4e5e6e,_0x1983b9[_0x301d('0xc')]['message'],_0x2b17e1);return _0x4d39bb(_0x1983b9[_0x301d('0xc')][_0x301d('0xd')]);}else{return _0x1567c2(_0x1983b9[_0x301d('0xe')]);}})[_0x301d('0xf')](function(_0x3142a4){logger['error'](_0x301d('0xa'),_0x301d('0xb'),_0x4e5e6e,_0x3142a4,_0x2b17e1);return _0x4d39bb(_0x3142a4);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index e3e2449..700b666 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 _0x619d=['callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','voiceQueue','getQueue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x619d,0xd9));var _0xd619=function(_0x310a79,_0x4138d8){_0x310a79=_0x310a79-0x0;var _0x9680ff=_0x619d[_0x310a79];return _0x9680ff;};'use strict';var util=require(_0xd619('0x0'));var _=require(_0xd619('0x1'));var moment=require(_0xd619('0x2'));function checkNameSurname(_0x5c107c,_0x11ba2b,_0x15ef15){var _0x35e5bf='';if(!_[_0xd619('0x3')](_0x11ba2b)&&_0xd619('0x4')===typeof _0x11ba2b){_0x35e5bf+=_0x11ba2b;}if(!_['isNil'](_0x15ef15)&&_0xd619('0x4')===typeof _0x15ef15){_0x35e5bf+='\x20'+_0x15ef15;}if(_0x35e5bf!==''){return _0x35e5bf;}return _0x5c107c;}function Action(_0x322325,_0x130bcc,_0x2f5d9a){this['voiceQueue']=_0x322325;this[_0xd619('0x5')]=_0x2f5d9a||undefined;this[_0xd619('0x6')]=checkNameSurname(_0x130bcc[_0xd619('0x7')][_0xd619('0x8')],_0x130bcc[_0xd619('0x7')]['firstName'],_0x130bcc['Contact'][_0xd619('0x9')]);this[_0xd619('0xa')]=_0x130bcc[_0xd619('0x7')][_0xd619('0x8')];this[_0xd619('0xb')]=_0x322325['name'];this[_0xd619('0xc')]=_0x130bcc[_0xd619('0xc')]||![];this[_0xd619('0xd')]=_0x322325[_0xd619('0xd')];this[_0xd619('0xe')]=_0x322325[_0xd619('0xe')]||0x3;this[_0xd619('0xf')]=_0x130bcc['scheduledat'];this['countbusyretry']=_0x130bcc['countbusyretry'];this[_0xd619('0x10')]=_0x130bcc[_0xd619('0x10')];this[_0xd619('0x11')]=_0x130bcc[_0xd619('0x11')];this['ContactId']=_0x130bcc['ContactId'];this[_0xd619('0x12')]=_0x130bcc[_0xd619('0x12')];this[_0xd619('0x13')]=_0x130bcc['UserId'];this[_0xd619('0x14')]=_0x130bcc[_0xd619('0x14')];this[_0xd619('0x15')]=_0x130bcc[_0xd619('0x15')];this['idHopper']=_0x130bcc['id'];this[_0xd619('0x16')]=_0x130bcc[_0xd619('0x7')][_0xd619('0x17')]||'';this[_0xd619('0x18')]=moment()[_0xd619('0x19')](_0xd619('0x1a'));this[_0xd619('0x1b')]=_0x130bcc['callback'];this[_0xd619('0x1c')]=_0x130bcc['callbackuniqueid'];this[_0xd619('0x1d')]=_0x130bcc[_0xd619('0x1d')];this[_0xd619('0x1e')]=_0x130bcc[_0xd619('0x1e')];this[_0xd619('0x1f')]='';this[_0xd619('0x20')]='';}Action[_0xd619('0x21')][_0xd619('0x22')]=function(){return util[_0xd619('0x19')](_0xd619('0x23'),this[_0xd619('0x6')],this['voiceQueue'][_0xd619('0x24')]>0x0?this['number'][_0xd619('0x25')](this[_0xd619('0x26')][_0xd619('0x24')]):this[_0xd619('0xa')]);};Action['prototype'][_0xd619('0x27')]=function(){return this[_0xd619('0xb')];};module[_0xd619('0x28')]=Action; \ No newline at end of file +var _0xf531=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','substring','dialCutDigit','queue','util','moment','string','isNil','voiceQueue','uniqueid','name','phone','firstName','Contact','lastName','number','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4fe5b5,_0x41efab){var _0x221fbe=function(_0x35fd94){while(--_0x35fd94){_0x4fe5b5['push'](_0x4fe5b5['shift']());}};_0x221fbe(++_0x41efab);}(_0xf531,0x7d));var _0x1f53=function(_0x10d2cd,_0x48316f){_0x10d2cd=_0x10d2cd-0x0;var _0x59594f=_0xf531[_0x10d2cd];return _0x59594f;};'use strict';var util=require(_0x1f53('0x0'));var _=require('lodash');var moment=require(_0x1f53('0x1'));function checkNameSurname(_0x1a8d5d,_0x56e219,_0x51b790){var _0x587a15='';if(!_['isNil'](_0x56e219)&&_0x1f53('0x2')===typeof _0x56e219){_0x587a15+=_0x56e219;}if(!_[_0x1f53('0x3')](_0x51b790)&&_0x1f53('0x2')===typeof _0x51b790){_0x587a15+='\x20'+_0x51b790;}if(_0x587a15!==''){return _0x587a15;}return _0x1a8d5d;}function Action(_0x1e3615,_0x1d1ada,_0x5711b8){this[_0x1f53('0x4')]=_0x1e3615;this[_0x1f53('0x5')]=_0x5711b8||undefined;this[_0x1f53('0x6')]=checkNameSurname(_0x1d1ada['Contact'][_0x1f53('0x7')],_0x1d1ada['Contact'][_0x1f53('0x8')],_0x1d1ada[_0x1f53('0x9')][_0x1f53('0xa')]);this[_0x1f53('0xb')]=_0x1d1ada['Contact'][_0x1f53('0x7')];this['queue']=_0x1e3615['name'];this[_0x1f53('0xc')]=_0x1d1ada[_0x1f53('0xc')]||![];this['type']=_0x1e3615[_0x1f53('0xd')];this[_0x1f53('0xe')]=_0x1e3615[_0x1f53('0xe')]||0x3;this['scheduledat']=_0x1d1ada['scheduledat'];this[_0x1f53('0xf')]=_0x1d1ada[_0x1f53('0xf')];this[_0x1f53('0x10')]=_0x1d1ada[_0x1f53('0x10')];this[_0x1f53('0x11')]=_0x1d1ada[_0x1f53('0x11')];this[_0x1f53('0x12')]=_0x1d1ada['ContactId'];this[_0x1f53('0x13')]=_0x1d1ada[_0x1f53('0x13')];this[_0x1f53('0x14')]=_0x1d1ada[_0x1f53('0x14')];this[_0x1f53('0x15')]=_0x1d1ada[_0x1f53('0x15')];this['CampaignId']=_0x1d1ada[_0x1f53('0x16')];this[_0x1f53('0x17')]=_0x1d1ada['id'];this[_0x1f53('0x18')]=_0x1d1ada[_0x1f53('0x9')][_0x1f53('0x8')]||'';this['starttime']=moment()[_0x1f53('0x19')](_0x1f53('0x1a'));this[_0x1f53('0x1b')]=_0x1d1ada[_0x1f53('0x1b')];this['callbackuniqueid']=_0x1d1ada[_0x1f53('0x1c')];this[_0x1f53('0x1d')]=_0x1d1ada[_0x1f53('0x1d')];this[_0x1f53('0x1e')]=_0x1d1ada['recallme'];this[_0x1f53('0x1f')]='';this[_0x1f53('0x20')]='';}Action[_0x1f53('0x21')][_0x1f53('0x22')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this[_0x1f53('0x4')]['dialCutDigit']>0x0?this['number'][_0x1f53('0x23')](this['voiceQueue'][_0x1f53('0x24')]):this[_0x1f53('0xb')]);};Action[_0x1f53('0x21')]['getQueue']=function(){return this[_0x1f53('0x25')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index dcf1f04..2214831 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 _0xaeb4=['membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','state','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','talktime','queue'];(function(_0x5433bb,_0x5503e4){var _0x10176a=function(_0x1426cc){while(--_0x1426cc){_0x5433bb['push'](_0x5433bb['shift']());}};_0x10176a(++_0x5503e4);}(_0xaeb4,0x82));var _0x4aeb=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xaeb4[_0x249e96];return _0x17444c;};'use strict';var util=require('util');var _=require(_0x4aeb('0x0'));var moment=require(_0x4aeb('0x1'));function getSeconds(_0x22e8cc,_0x4f8de4){var _0x313585=moment(_0x22e8cc)[_0x4aeb('0x2')](0x0);var _0x243eb3=moment(_0x4f8de4)[_0x4aeb('0x2')](0x0);return _0x313585[_0x4aeb('0x3')](_0x243eb3,'seconds');}function AgentComplete(_0x141c89,_0x48bc7e){this[_0x4aeb('0x4')]=0x4;this[_0x4aeb('0x5')]='Answer';this['scheduledat']=_0x141c89[_0x4aeb('0x6')];this['type']=_0x141c89[_0x4aeb('0x7')];this[_0x4aeb('0x8')]=_0x141c89[_0x4aeb('0x7')]===_0x4aeb('0x9')?'queue':_0x141c89['type'];this[_0x4aeb('0xa')]=_0x141c89[_0x4aeb('0xa')];this[_0x4aeb('0xb')]=_0x141c89[_0x4aeb('0xb')];this[_0x4aeb('0xc')]=_0x141c89[_0x4aeb('0xc')];this[_0x4aeb('0xd')]=_0x141c89[_0x4aeb('0xa')]+_0x141c89[_0x4aeb('0xb')]+_0x141c89[_0x4aeb('0xc')];this['uniqueid']=_0x48bc7e[_0x4aeb('0xe')];this['calleridname']=_0x141c89[_0x4aeb('0xf')];this[_0x4aeb('0x10')]=_0x141c89[_0x4aeb('0x11')];this['starttime']=_0x141c89[_0x4aeb('0x12')];this[_0x4aeb('0x13')]=_0x141c89['responsetime'];this[_0x4aeb('0x14')]=_0x141c89[_0x4aeb('0x14')];this[_0x4aeb('0x15')]=moment()[_0x4aeb('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4aeb('0x17')]=getSeconds(_0x141c89['responsetime'],_0x141c89[_0x4aeb('0x12')]);this['holdtime']=getSeconds(_0x141c89[_0x4aeb('0x14')],_0x141c89[_0x4aeb('0x13')]);this[_0x4aeb('0x18')]=getSeconds(this[_0x4aeb('0x15')],_0x141c89['answertime']);this[_0x4aeb('0x19')]=_0x48bc7e[_0x4aeb('0x19')];this[_0x4aeb('0x1a')]=_0x48bc7e[_0x4aeb('0x1a')];this[_0x4aeb('0x1b')]=_0x48bc7e[_0x4aeb('0x1b')];this[_0x4aeb('0x1c')]=_0x141c89[_0x4aeb('0x1c')];this[_0x4aeb('0x1d')]=_0x141c89[_0x4aeb('0x1d')];this[_0x4aeb('0x1e')]=_0x141c89[_0x4aeb('0x1e')];this[_0x4aeb('0x1f')]=_0x141c89[_0x4aeb('0x1f')];this[_0x4aeb('0x20')]=_0x141c89[_0x4aeb('0x20')];this['ListId']=_0x141c89[_0x4aeb('0x21')];this['UserId']=_0x141c89[_0x4aeb('0x22')];this['VoiceQueueId']=_0x141c89[_0x4aeb('0x23')];this[_0x4aeb('0x24')]=_0x141c89[_0x4aeb('0x24')];this['originatecalleridnum']=_0x141c89[_0x4aeb('0x25')]||'';this[_0x4aeb('0x26')]=_0x141c89['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x31af=['answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','name','calleridnum','number','starttime','responsetime'];(function(_0x372675,_0x23afd7){var _0x5fc343=function(_0x832246){while(--_0x832246){_0x372675['push'](_0x372675['shift']());}};_0x5fc343(++_0x23afd7);}(_0x31af,0x171));var _0xf31a=function(_0xe3343c,_0x3d05c8){_0xe3343c=_0xe3343c-0x0;var _0x2f9e6f=_0x31af[_0xe3343c];return _0x2f9e6f;};'use strict';var util=require(_0xf31a('0x0'));var _=require(_0xf31a('0x1'));var moment=require(_0xf31a('0x2'));function getSeconds(_0x22bbd9,_0xd95c5e){var _0x1e536c=moment(_0x22bbd9)['milliseconds'](0x0);var _0x9f7752=moment(_0xd95c5e)[_0xf31a('0x3')](0x0);return _0x1e536c[_0xf31a('0x4')](_0x9f7752,_0xf31a('0x5'));}function AgentComplete(_0x595b94,_0x346000){this[_0xf31a('0x6')]=0x4;this['statedesc']='Answer';this[_0xf31a('0x7')]=_0x595b94[_0xf31a('0x7')];this[_0xf31a('0x8')]=_0x595b94[_0xf31a('0x8')];this[_0xf31a('0x9')]=_0x595b94['type']===_0xf31a('0xa')?'queue':_0x595b94[_0xf31a('0x8')];this[_0xf31a('0xb')]=_0x595b94[_0xf31a('0xb')];this['countcongestionretry']=_0x595b94[_0xf31a('0xc')];this['countnoanswerretry']=_0x595b94[_0xf31a('0xd')];this[_0xf31a('0xe')]=_0x595b94[_0xf31a('0xb')]+_0x595b94[_0xf31a('0xc')]+_0x595b94[_0xf31a('0xd')];this[_0xf31a('0xf')]=_0x346000['uniqueid'];this['calleridname']=_0x595b94[_0xf31a('0x10')];this[_0xf31a('0x11')]=_0x595b94[_0xf31a('0x12')];this[_0xf31a('0x13')]=_0x595b94[_0xf31a('0x13')];this[_0xf31a('0x14')]=_0x595b94[_0xf31a('0x14')];this[_0xf31a('0x15')]=_0x595b94[_0xf31a('0x15')];this[_0xf31a('0x16')]=moment()['format'](_0xf31a('0x17'));this[_0xf31a('0x18')]=getSeconds(_0x595b94[_0xf31a('0x14')],_0x595b94[_0xf31a('0x13')]);this['holdtime']=getSeconds(_0x595b94[_0xf31a('0x15')],_0x595b94[_0xf31a('0x14')]);this[_0xf31a('0x19')]=getSeconds(this[_0xf31a('0x16')],_0x595b94[_0xf31a('0x15')]);this[_0xf31a('0x1a')]=_0x346000[_0xf31a('0x1a')];this[_0xf31a('0x1b')]=_0x346000['membername'];this['reason']=_0x346000['reason'];this['callback']=_0x595b94[_0xf31a('0x1c')];this['callbackuniqueid']=_0x595b94['callbackuniqueid'];this[_0xf31a('0x1d')]=_0x595b94['callbackat'];this[_0xf31a('0x1e')]=_0x595b94['recallme'];this['ContactId']=_0x595b94[_0xf31a('0x1f')];this[_0xf31a('0x20')]=_0x595b94['ListId'];this[_0xf31a('0x21')]=_0x595b94[_0xf31a('0x21')];this[_0xf31a('0x22')]=_0x595b94[_0xf31a('0x22')];this[_0xf31a('0x23')]=_0x595b94['CampaignId'];this['originatecalleridnum']=_0x595b94[_0xf31a('0x24')]||'';this[_0xf31a('0x25')]=_0x595b94['originatecalleridname']||'';}module[_0xf31a('0x26')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 2adda08..3f79bce 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 _0x870d=['queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound'];(function(_0x2f3947,_0x2ee083){var _0x3e6ab7=function(_0x4057c0){while(--_0x4057c0){_0x2f3947['push'](_0x2f3947['shift']());}};_0x3e6ab7(++_0x2ee083);}(_0x870d,0xde));var _0xd870=function(_0xd44b02,_0xb8a41b){_0xd44b02=_0xd44b02-0x0;var _0xfaf867=_0x870d[_0xd44b02];return _0xfaf867;};'use strict';var util=require('util');var _=require(_0xd870('0x0'));var moment=require(_0xd870('0x1'));function getSeconds(_0x133361,_0x2ce080){var _0x2762a1=moment(_0x133361)[_0xd870('0x2')](0x0);var _0x54e456=moment(_0x2ce080)[_0xd870('0x2')](0x0);return _0x2762a1[_0xd870('0x3')](_0x54e456,_0xd870('0x4'));}function Final(_0x44e9d6){this[_0xd870('0x5')]=_0x44e9d6['uniqueid'];this[_0xd870('0x6')]=_0x44e9d6[_0xd870('0x6')];this[_0xd870('0x7')]=_0x44e9d6['type'];this['campaigntype']=_0x44e9d6[_0xd870('0x7')]===_0xd870('0x8')?_0xd870('0x9'):_0x44e9d6[_0xd870('0x7')];this[_0xd870('0xa')]=_0x44e9d6[_0xd870('0xa')];this['countcongestionretry']=_0x44e9d6['countcongestionretry'];this[_0xd870('0xb')]=_0x44e9d6[_0xd870('0xb')];this[_0xd870('0xc')]=_0x44e9d6['countbusyretry']+_0x44e9d6[_0xd870('0xd')]+_0x44e9d6[_0xd870('0xb')];this['queue']=_0x44e9d6[_0xd870('0x9')];this[_0xd870('0xe')]=_0x44e9d6['calleridname'];this[_0xd870('0xf')]=_0x44e9d6['calleridnum'];this[_0xd870('0x10')]=_0x44e9d6[_0xd870('0x10')];this[_0xd870('0x11')]=_0x44e9d6[_0xd870('0x11')];this['endtime']=_0x44e9d6[_0xd870('0x11')];this[_0xd870('0x12')]=_0x44e9d6['ringtime']||0x0;this[_0xd870('0x13')]=_0x44e9d6[_0xd870('0x13')]||0x0;this[_0xd870('0x14')]=_0x44e9d6['talktime']||0x0;this[_0xd870('0x15')]=_0x44e9d6[_0xd870('0x15')];this['callbackuniqueid']=_0x44e9d6[_0xd870('0x16')];this[_0xd870('0x17')]=_0x44e9d6['callbackat'];this[_0xd870('0x18')]=_0x44e9d6[_0xd870('0x18')];this['ContactId']=_0x44e9d6[_0xd870('0x19')];this[_0xd870('0x1a')]=_0x44e9d6[_0xd870('0x1a')];this[_0xd870('0x1b')]=_0x44e9d6['UserId'];this['VoiceQueueId']=_0x44e9d6[_0xd870('0x1c')];this[_0xd870('0x1d')]=_0x44e9d6['CampaignId'];this['originatecalleridnum']=_0x44e9d6[_0xd870('0x1e')]||'';this[_0xd870('0x1f')]=_0x44e9d6[_0xd870('0x1f')]||'';}module[_0xd870('0x20')]=Final; \ No newline at end of file +var _0x8fcd=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type'];(function(_0x40e13b,_0x4a4057){var _0x5be7a9=function(_0x591bb7){while(--_0x591bb7){_0x40e13b['push'](_0x40e13b['shift']());}};_0x5be7a9(++_0x4a4057);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x4d64ab,_0x1fc971){_0x4d64ab=_0x4d64ab-0x0;var _0x4ba399=_0x8fcd[_0x4d64ab];return _0x4ba399;};'use strict';var util=require(_0xd8fc('0x0'));var _=require(_0xd8fc('0x1'));var moment=require(_0xd8fc('0x2'));function getSeconds(_0x419f4b,_0x162c5a){var _0x5c28de=moment(_0x419f4b)['milliseconds'](0x0);var _0x353592=moment(_0x162c5a)[_0xd8fc('0x3')](0x0);return _0x5c28de[_0xd8fc('0x4')](_0x353592,_0xd8fc('0x5'));}function Final(_0x2c4812){this[_0xd8fc('0x6')]=_0x2c4812['uniqueid'];this['scheduledat']=_0x2c4812[_0xd8fc('0x7')];this['type']=_0x2c4812[_0xd8fc('0x8')];this[_0xd8fc('0x9')]=_0x2c4812[_0xd8fc('0x8')]===_0xd8fc('0xa')?'queue':_0x2c4812['type'];this[_0xd8fc('0xb')]=_0x2c4812['countbusyretry'];this['countcongestionretry']=_0x2c4812[_0xd8fc('0xc')];this[_0xd8fc('0xd')]=_0x2c4812['countnoanswerretry'];this['countglobal']=_0x2c4812[_0xd8fc('0xb')]+_0x2c4812[_0xd8fc('0xc')]+_0x2c4812['countnoanswerretry'];this[_0xd8fc('0xe')]=_0x2c4812[_0xd8fc('0xe')];this[_0xd8fc('0xf')]=_0x2c4812[_0xd8fc('0xf')];this[_0xd8fc('0x10')]=_0x2c4812['calleridnum'];this[_0xd8fc('0x11')]=_0x2c4812['starttime'];this[_0xd8fc('0x12')]=_0x2c4812[_0xd8fc('0x12')];this[_0xd8fc('0x13')]=_0x2c4812['responsetime'];this[_0xd8fc('0x14')]=_0x2c4812[_0xd8fc('0x14')]||0x0;this['holdtime']=_0x2c4812['holdtime']||0x0;this[_0xd8fc('0x15')]=_0x2c4812[_0xd8fc('0x15')]||0x0;this[_0xd8fc('0x16')]=_0x2c4812['callback'];this[_0xd8fc('0x17')]=_0x2c4812[_0xd8fc('0x17')];this[_0xd8fc('0x18')]=_0x2c4812[_0xd8fc('0x18')];this[_0xd8fc('0x19')]=_0x2c4812[_0xd8fc('0x19')];this[_0xd8fc('0x1a')]=_0x2c4812[_0xd8fc('0x1a')];this[_0xd8fc('0x1b')]=_0x2c4812['ListId'];this[_0xd8fc('0x1c')]=_0x2c4812[_0xd8fc('0x1c')];this[_0xd8fc('0x1d')]=_0x2c4812[_0xd8fc('0x1d')];this[_0xd8fc('0x1e')]=_0x2c4812[_0xd8fc('0x1e')];this['originatecalleridnum']=_0x2c4812[_0xd8fc('0x1f')]||'';this[_0xd8fc('0x20')]=_0x2c4812['originatecalleridname']||'';}module[_0xd8fc('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 681ecb7..9b321e8 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 _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(_0x285b48,_0x41b4c6){var _0x5020e9=function(_0x537f18){while(--_0x537f18){_0x285b48['push'](_0x285b48['shift']());}};_0x5020e9(++_0x41b4c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 +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(_0x1becd6,_0x8682d2){var _0x2e31a1=function(_0x2266a6){while(--_0x2266a6){_0x1becd6['push'](_0x1becd6['shift']());}};_0x2e31a1(++_0x8682d2);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index ca3cb31..1d46846 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 _0x1a77=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','queue','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId'];(function(_0x5d8992,_0x23a1b4){var _0x7be749=function(_0x1c4a01){while(--_0x1c4a01){_0x5d8992['push'](_0x5d8992['shift']());}};_0x7be749(++_0x23a1b4);}(_0x1a77,0x88));var _0x71a7=function(_0x8e338d,_0x41c31f){_0x8e338d=_0x8e338d-0x0;var _0x181825=_0x1a77[_0x8e338d];return _0x181825;};'use strict';var util=require(_0x71a7('0x0'));var _=require('lodash');var moment=require(_0x71a7('0x1'));function getSeconds(_0xdaaf3,_0x20651f){var _0x3079fa=moment(_0xdaaf3)[_0x71a7('0x2')](0x0);var _0xdeb085=moment(_0x20651f)[_0x71a7('0x2')](0x0);return _0x3079fa['diff'](_0xdeb085,_0x71a7('0x3'));}function History(_0x1a7407){this[_0x71a7('0x4')]=_0x1a7407['uniqueid'];this['scheduledat']=_0x1a7407[_0x71a7('0x5')]||undefined;this[_0x71a7('0x6')]=_0x1a7407[_0x71a7('0x6')];this[_0x71a7('0x7')]=_0x1a7407['type']===_0x71a7('0x8')?'queue':_0x1a7407['type'];this[_0x71a7('0x9')]=_0x1a7407[_0x71a7('0x9')];this[_0x71a7('0xa')]=_0x1a7407[_0x71a7('0xa')];this[_0x71a7('0xb')]=_0x1a7407[_0x71a7('0xb')];this[_0x71a7('0xc')]=_0x1a7407[_0x71a7('0x9')]+_0x1a7407['countcongestionretry']+_0x1a7407['countnoanswerretry'];this['queue']=_0x1a7407[_0x71a7('0xd')];this[_0x71a7('0xe')]=_0x1a7407[_0x71a7('0xf')];this[_0x71a7('0x10')]=_0x1a7407[_0x71a7('0x11')];this[_0x71a7('0x12')]=_0x1a7407[_0x71a7('0x12')];this[_0x71a7('0x13')]=_0x1a7407[_0x71a7('0x13')];this['endtime']=_0x1a7407[_0x71a7('0x13')];this[_0x71a7('0x14')]=getSeconds(_0x1a7407['responsetime'],_0x1a7407[_0x71a7('0x12')]);this[_0x71a7('0x15')]=0x0;this[_0x71a7('0x16')]=0x0;this[_0x71a7('0x17')]=_0x1a7407[_0x71a7('0x17')];this[_0x71a7('0x18')]=_0x1a7407['callbackuniqueid'];this[_0x71a7('0x19')]=_0x1a7407[_0x71a7('0x19')];this[_0x71a7('0x1a')]=_0x1a7407[_0x71a7('0x1a')];this['ContactId']=_0x1a7407['ContactId'];this[_0x71a7('0x1b')]=_0x1a7407[_0x71a7('0x1b')];this['UserId']=_0x1a7407['UserId'];this[_0x71a7('0x1c')]=_0x1a7407['VoiceQueueId'];this[_0x71a7('0x1d')]=_0x1a7407['CampaignId'];this[_0x71a7('0x1e')]=_0x1a7407[_0x71a7('0x1e')]||'';this[_0x71a7('0x1f')]=_0x1a7407[_0x71a7('0x1f')]||'';}module[_0x71a7('0x20')]=History; \ No newline at end of file +var _0xe3d6=['calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0xe3d6,0x1d3));var _0x6e3d=function(_0x234724,_0x5147d6){_0x234724=_0x234724-0x0;var _0x2ee2f5=_0xe3d6[_0x234724];return _0x2ee2f5;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x6e3d('0x0'));function getSeconds(_0x2dc029,_0x245cfd){var _0x3d9837=moment(_0x2dc029)[_0x6e3d('0x1')](0x0);var _0x294d7e=moment(_0x245cfd)[_0x6e3d('0x1')](0x0);return _0x3d9837[_0x6e3d('0x2')](_0x294d7e,'seconds');}function History(_0x78e3e4){this[_0x6e3d('0x3')]=_0x78e3e4['uniqueid'];this[_0x6e3d('0x4')]=_0x78e3e4['scheduledat']||undefined;this[_0x6e3d('0x5')]=_0x78e3e4[_0x6e3d('0x5')];this[_0x6e3d('0x6')]=_0x78e3e4[_0x6e3d('0x5')]===_0x6e3d('0x7')?_0x6e3d('0x8'):_0x78e3e4['type'];this[_0x6e3d('0x9')]=_0x78e3e4[_0x6e3d('0x9')];this[_0x6e3d('0xa')]=_0x78e3e4[_0x6e3d('0xa')];this['countnoanswerretry']=_0x78e3e4[_0x6e3d('0xb')];this[_0x6e3d('0xc')]=_0x78e3e4[_0x6e3d('0x9')]+_0x78e3e4[_0x6e3d('0xa')]+_0x78e3e4['countnoanswerretry'];this[_0x6e3d('0x8')]=_0x78e3e4[_0x6e3d('0x8')];this[_0x6e3d('0xd')]=_0x78e3e4[_0x6e3d('0xe')];this[_0x6e3d('0xf')]=_0x78e3e4['number'];this[_0x6e3d('0x10')]=_0x78e3e4['starttime'];this['responsetime']=_0x78e3e4[_0x6e3d('0x11')];this[_0x6e3d('0x12')]=_0x78e3e4[_0x6e3d('0x11')];this[_0x6e3d('0x13')]=getSeconds(_0x78e3e4[_0x6e3d('0x11')],_0x78e3e4[_0x6e3d('0x10')]);this['holdtime']=0x0;this[_0x6e3d('0x14')]=0x0;this[_0x6e3d('0x15')]=_0x78e3e4[_0x6e3d('0x15')];this[_0x6e3d('0x16')]=_0x78e3e4[_0x6e3d('0x16')];this['callbackat']=_0x78e3e4[_0x6e3d('0x17')];this[_0x6e3d('0x18')]=_0x78e3e4[_0x6e3d('0x18')];this['ContactId']=_0x78e3e4[_0x6e3d('0x19')];this[_0x6e3d('0x1a')]=_0x78e3e4[_0x6e3d('0x1a')];this[_0x6e3d('0x1b')]=_0x78e3e4[_0x6e3d('0x1b')];this[_0x6e3d('0x1c')]=_0x78e3e4[_0x6e3d('0x1c')];this[_0x6e3d('0x1d')]=_0x78e3e4[_0x6e3d('0x1d')];this[_0x6e3d('0x1e')]=_0x78e3e4[_0x6e3d('0x1e')]||'';this[_0x6e3d('0x1f')]=_0x78e3e4['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index cb600f5..5c8fa6e 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 _0x5eb8=['launchHandleIvr','handleIvr','dialActive','loggedIn','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','dialOriginateCallerIdNumber','TrunkBackup','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','countcongestionretry','add','dialCongestionRetryFrequency','minutes','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','entity\x20is\x20undefine','reason','NoSuchNumber','[syncAgentComplete][createHistory][0]','dialGlobalMaxRetry','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','countglobal','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalPauses','floor','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Date]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Agent\x20free','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','[startMethodPredictive][StartPredictive][First]','getDataPredictive','startMethodPredictive','[averageHandleTime][ErlangB]\x20','averageHandleTime','dialPredictiveOptimization','outboundQueuePauses','dialPredictiveOptimizationPercentage','abandonmentRate','[CatchErlangB]','agentBusyFactor','predictiveIntervalAnsweredCalls','[getDataPredictive]','check\x20failure','[startMethodPredictive]','[handlePredictive]','[startMethodPredictive][milliseconds]\x20','Failure\x20','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','temp','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','[actionOriginate]\x20','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[abandonmentRate]','\x20m\x20=\x20','\x20interval\x20=\x20','\x20p\x20=\x20','\x20Amax\x20=\x20','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','busyFactor','\x20Umin\x20=\x20','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','127.0.0.1','roundrobin','prototype','enqueue','tail','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','outbound','strategy','available','pTalking','sumBillable','sumHoldTime','type','abandoned','waiting','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','originated','Trunk','active','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','isEmpty','info','[checkGetDataPredictive][objIsEmpty]','[checkGetDataPredictive][obj]','[ErlangB]','seconds','startProgressive','[freeVariablesPredictive]','startPredictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','hasOwnProperty','Action','channel','No\x20such\x20channel','updateOriginated','voiceQueues','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','resolve','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','merge','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','status','reachable','SIP/%s','unmonitored','saveInDb','uniqueId','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','amd','[syncMachine][createHistory]','[syncMachine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','agent','agiafterat','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','dropreason','dialQueueProject2','Abandoned','CALLEREXIT','syncQueueMember','actionid','paused','stateinterface','locked','rrmemory','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','ContactId','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','content','indexOf','true','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','power','handlePower','dialPowerLevel','Queue'];(function(_0x1a554b,_0x29a147){var _0x27d940=function(_0x39a5d3){while(--_0x39a5d3){_0x1a554b['push'](_0x1a554b['shift']());}};_0x27d940(++_0x29a147);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1c3e42,_0x1a4fe9){_0x1c3e42=_0x1c3e42-0x0;var _0x348fdc=_0x5eb8[_0x1c3e42];return _0x348fdc;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x85eb('0x0'));var uuid=require(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var rr=require('rr');var md5=require(_0x85eb('0x3'));var Redis=require(_0x85eb('0x4'));var config=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var loggerBooked=require(_0x85eb('0x6'))(_0x85eb('0x8'));var loggerPredictive=require(_0x85eb('0x6'))(_0x85eb('0x9'));var loggerPredictiveCalls=require('../../../config/logger')(_0x85eb('0xa'));var loggerSyncQueueSummary=require(_0x85eb('0x6'))(_0x85eb('0xb'));var ami=require('../ami');config[_0x85eb('0xc')]=_['defaults'](config[_0x85eb('0xc')],{'host':_0x85eb('0xd'),'port':0x18eb});var io=require(_0x85eb('0xe'))(new Redis(config[_0x85eb('0xc')]));var cmHopper=require(_0x85eb('0xf'));var cmHopperFinal=require(_0x85eb('0x10'));var cmHopperHistory=require(_0x85eb('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x85eb('0x12'));var Action=require(_0x85eb('0x13'));var History=require('./history');var Final=require(_0x85eb('0x14'));var AgentComplete=require(_0x85eb('0x15'));var QueueCallerAbandon=require(_0x85eb('0x16'));var Hangup=require(_0x85eb('0x17'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x85eb('0x18');var strategy={'rrmemory':'rrmemory','roundrobin':_0x85eb('0x19')};var Sequence=function(){};Sequence[_0x85eb('0x1a')][_0x85eb('0x1b')]=function(_0x1604ba){this[_0x85eb('0x1c')]=this['tail']?this[_0x85eb('0x1c')]['finally'](_0x1604ba):_0x1604ba();};function Dialer(_0x17140b,_0x10c2c9){this[_0x85eb('0x1d')]=new Sequence();this[_0x85eb('0x1e')]=_0x10c2c9;this['voiceQueues']=_0x17140b['voiceQueues'];this['campaigns']=_0x17140b[_0x85eb('0x1f')];this[_0x85eb('0x20')]=_0x17140b[_0x85eb('0x20')];this[_0x85eb('0x21')]=_0x17140b[_0x85eb('0x21')];this[_0x85eb('0x22')]=config['maxNumberOriginate']||0x2;this[_0x85eb('0x23')]={};this[_0x85eb('0x24')]={};this[_0x85eb('0x25')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this['startProgressive']={};this[_0x85eb('0x26')]={};this[_0x85eb('0x27')]={};this[_0x85eb('0x28')]={};ami['on'](_0x85eb('0x29'),this[_0x85eb('0x2a')][_0x85eb('0x2b')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x85eb('0x2c'),this[_0x85eb('0x2d')][_0x85eb('0x2b')](this));ami['on'](_0x85eb('0x2e'),this[_0x85eb('0x2f')][_0x85eb('0x2b')](this));ami['on']('custom:queuesummary',this[_0x85eb('0xb')][_0x85eb('0x2b')](this));ami['on'](_0x85eb('0x30'),this[_0x85eb('0x31')][_0x85eb('0x2b')](this));ami['on']('newexten',this[_0x85eb('0x32')][_0x85eb('0x2b')](this));ami['on'](_0x85eb('0x33'),this[_0x85eb('0x34')][_0x85eb('0x2b')](this));ami['on'](_0x85eb('0x35'),this['syncQueueMember']['bind'](this));ami['on'](_0x85eb('0x36'),this['syncQueueStatusComplete'][_0x85eb('0x2b')](this));this['loopCampaigns']();this[_0x85eb('0x37')]();}function isNotNull(_0x3570f7){return _0x3570f7!==null&&!_[_0x85eb('0x38')](_0x3570f7);}function checkIsLoggedIn(_0x1d9278,_0xa67e1c){return function(){if(_0xa67e1c<=0x0){_0x1d9278[_0x85eb('0x39')]=_0x85eb('0x3a');throw _0x1d9278['name']+_0x85eb('0x3b');}};}function isActive(_0xcbcf2b){return _0xcbcf2b;}function checkIsActive(_0x515ee9,_0x197898){return function(){if(!isActive(_0x197898)){_0x515ee9['message']='NOT_ACTIVE';throw _0x515ee9[_0x85eb('0x3c')]+_0x85eb('0x3d');}};}function checkInterval(_0x3e6f34){return function(){if(!isNotNull(_0x3e6f34[_0x85eb('0x3e')])){_0x3e6f34[_0x85eb('0x39')]=_0x85eb('0x3f');throw _0x3e6f34[_0x85eb('0x3c')]+_0x85eb('0x40');}if(!isNotNull(_0x3e6f34[_0x85eb('0x3e')][_0x85eb('0x41')])){_0x3e6f34['message']=_0x85eb('0x3f');throw _0x3e6f34[_0x85eb('0x3c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x3e6f34[_0x85eb('0x3e')][_0x85eb('0x41')]))){_0x3e6f34[_0x85eb('0x39')]=_0x85eb('0x3f');throw _0x3e6f34[_0x85eb('0x3c')]+_0x85eb('0x40');}};}function msgResponse(_0xf4d0e4,_0x35f092,_0x272a99){return{'action':_0xf4d0e4,'response':_0x35f092,'message':_0x272a99};}function myreject(_0x373e5f){return function(_0x424053){return _0x373e5f(msgResponse(_0x85eb('0x42'),_0x85eb('0x43'),JSON[_0x85eb('0x44')](_0x424053)));};}function getSeconds(_0x4b69a7,_0x4361e2){var _0x3dfe74=moment(_0x4b69a7)['milliseconds'](0x0);var _0x5b77e5=moment(_0x4361e2)[_0x85eb('0x45')](0x0);return _0x3dfe74[_0x85eb('0x46')](_0x5b77e5,'seconds');}function emit(_0x4317bc,_0x50c7f9,_0x4440ec){io['to'](_0x4317bc)['emit'](_0x50c7f9,_0x4440ec);}function emitVoiceQueueSummary(_0xaa27ca){if(_0xaa27ca['type']===_0x85eb('0x47')){var _0x5c618a={'id':_0xaa27ca['id'],'name':_0xaa27ca[_0x85eb('0x3c')],'strategy':_0xaa27ca[_0x85eb('0x48')],'answered':_0xaa27ca['answered'],'available':_0xaa27ca[_0x85eb('0x49')],'loggedIn':_0xaa27ca['loggedIn'],'pTalking':_0xaa27ca[_0x85eb('0x4a')],'sumBillable':_0xaa27ca[_0x85eb('0x4b')],'sumDuration':_0xaa27ca['sumDuration'],'sumHoldTime':_0xaa27ca[_0x85eb('0x4c')]||0x0,'talking':_0xaa27ca['talking'],'total':_0xaa27ca['total'],'type':_0xaa27ca[_0x85eb('0x4d')],'unmanaged':_0xaa27ca['unmanaged'],'abandoned':_0xaa27ca[_0x85eb('0x4e')],'waiting':_0xaa27ca[_0x85eb('0x4f')],'loggedInDb':_0xaa27ca['loggedInDb'],'dialActive':_0xaa27ca['dialActive'],'dialMethod':_0xaa27ca[_0x85eb('0x50')],'dialOriginateCallerIdName':_0xaa27ca[_0x85eb('0x51')],'dialOriginateCallerIdNumber':_0xaa27ca['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xaa27ca['dialOriginateTimeout'],'dialPrefix':_0xaa27ca[_0x85eb('0x52')],'outboundAnswerAgiCallsDay':_0xaa27ca[_0x85eb('0x53')],'outboundAnswerCallsDay':_0xaa27ca[_0x85eb('0x54')],'outboundBlacklistCallsDay':_0xaa27ca[_0x85eb('0x55')],'outboundBusyCallsDay':_0xaa27ca[_0x85eb('0x56')],'outboundCongestionCallsDay':_0xaa27ca['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0xaa27ca[_0x85eb('0x57')],'outboundDropCallsDayCallersExit':_0xaa27ca[_0x85eb('0x58')],'outboundDropCallsDayTimeout':_0xaa27ca[_0x85eb('0x59')],'outboundNoAnswerCallsDay':_0xaa27ca[_0x85eb('0x5a')],'outboundNoSuchCallsDay':_0xaa27ca[_0x85eb('0x5b')],'outboundOriginateFailureCallsDay':_0xaa27ca[_0x85eb('0x5c')],'outboundReCallsDay':_0xaa27ca[_0x85eb('0x5d')],'outboundRejectCallsDay':_0xaa27ca[_0x85eb('0x5e')],'outboundUnknownCallsDay':_0xaa27ca[_0x85eb('0x5f')],'predictiveIntervalAnsweredCalls':_0xaa27ca['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xaa27ca[_0x85eb('0x60')],'predictiveIntervalAvgTalktime':_0xaa27ca[_0x85eb('0x61')],'predictiveIntervalDroppedCallsCallersExit':_0xaa27ca['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xaa27ca[_0x85eb('0x62')],'predictiveIntervalErlangCalls':_0xaa27ca[_0x85eb('0x63')],'predictiveIntervalErlangCallsDroppedCalls':_0xaa27ca[_0x85eb('0x64')],'predictiveIntervalHitRate':_0xaa27ca[_0x85eb('0x65')],'predictiveIntervalLowerLimit':_0xaa27ca[_0x85eb('0x66')],'predictiveIntervalMultiplicativeFactor':_0xaa27ca[_0x85eb('0x67')],'predictiveIntervalPauses':_0xaa27ca['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0xaa27ca[_0x85eb('0x68')],'message':_0xaa27ca[_0x85eb('0x39')],'originated':_0xaa27ca[_0x85eb('0x69')]};if(_0xaa27ca[_0x85eb('0x6a')]){_0x5c618a[_0x85eb('0x6a')]={'id':_0xaa27ca[_0x85eb('0x6a')]['id'],'name':_0xaa27ca[_0x85eb('0x6a')][_0x85eb('0x3c')],'active':_0xaa27ca['Trunk'][_0x85eb('0x6b')],'callerid':_0xaa27ca[_0x85eb('0x6a')][_0x85eb('0x6c')]};}if(_0xaa27ca[_0x85eb('0x3e')]){_0x5c618a[_0x85eb('0x3e')]={'id':_0xaa27ca[_0x85eb('0x3e')]['id'],'name':_0xaa27ca[_0x85eb('0x3e')][_0x85eb('0x3c')]};}var _0x8cf8c4=md5(JSON[_0x85eb('0x44')](_0x5c618a));if(_0xaa27ca[_0x85eb('0x3')]!==_0x8cf8c4){_0xaa27ca[_0x85eb('0x3')]=_0x8cf8c4;emit(util['format'](_0x85eb('0x6d'),_0x5c618a[_0x85eb('0x3c')]),_0x85eb('0x6e'),_0x5c618a);}}}function emitCampaignSummary(_0x4e60dc){if(_0x4e60dc[_0x85eb('0x4d')]===_0x85eb('0x6f')){emit(util[_0x85eb('0x70')](_0x85eb('0x71'),_0x4e60dc[_0x85eb('0x3c')]),'campaign:save',_0x4e60dc);}}function checkGetDataPredictive(_0x2ef4d1){if(isNotNull(_0x2ef4d1)){if(!_[_0x85eb('0x72')](_0x2ef4d1)){if(_0x2ef4d1[_0x85eb('0x68')]>0x0){if(!_['isUndefined'](_0x2ef4d1[_0x85eb('0x61')])&&_0x2ef4d1[_0x85eb('0x61')]>0x0){return!![];}else{loggerPredictive[_0x85eb('0x73')]('[checkGetDataPredictive][avgTalktime]',JSON['stringify'](_0x2ef4d1));}if(!_[_0x85eb('0x38')](_0x2ef4d1['predictiveIntervalAvgHoldtime'])&&_0x2ef4d1['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x85eb('0x73')]('[checkGetDataPredictive][avgHoldtime]',JSON[_0x85eb('0x44')](_0x2ef4d1));}}else{loggerPredictive[_0x85eb('0x73')]('[checkGetDataPredictive][totalCalls]',JSON['stringify'](_0x2ef4d1));}}else{loggerPredictive[_0x85eb('0x73')](_0x85eb('0x74'),JSON[_0x85eb('0x44')](_0x2ef4d1));}}else{loggerPredictive[_0x85eb('0x73')](_0x85eb('0x75'),JSON['stringify'](_0x2ef4d1));}return![];}function mergeDataErlangB(_0x1bb9f8){return function(_0x30062e){loggerPredictive[_0x85eb('0x73')](_0x85eb('0x76'),JSON[_0x85eb('0x44')](_0x30062e));_['merge'](_0x1bb9f8,_0x30062e);};}function getDiff(_0x140919){var _0x5cd2d3=moment()[_0x85eb('0x45')](0x0);var _0x40d846=moment(_0x140919)['milliseconds'](0x0);return _0x5cd2d3[_0x85eb('0x46')](_0x40d846,_0x85eb('0x77'));}function ifInterval(_0x415ee6,_0x26e04a){if(_[_0x85eb('0x38')](_0x26e04a)){return![];}if(getDiff(_0x26e04a)<_0x415ee6*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x130fe3){if(isNotNull(_0x130fe3)){if(!_['isUndefined'](_0x130fe3[_0x85eb('0x78')])){_0x130fe3['startProgressive']=undefined;loggerPredictive[_0x85eb('0x73')](_0x85eb('0x79'),'startProgressive',_0x130fe3[_0x85eb('0x3c')]);}if(!_[_0x85eb('0x38')](_0x130fe3['startPredictive'])){_0x130fe3[_0x85eb('0x7a')]=undefined;loggerPredictive['info'](_0x85eb('0x79'),_0x85eb('0x7a'),_0x130fe3[_0x85eb('0x3c')]);}if(!_[_0x85eb('0x38')](_0x130fe3[_0x85eb('0x7b')])){clearInterval(_0x130fe3[_0x85eb('0x7b')]);_0x130fe3['handlePredictive']=undefined;loggerPredictive[_0x85eb('0x73')](_0x85eb('0x79'),_0x85eb('0x7b'),_0x130fe3[_0x85eb('0x3c')]);}}}function erlangb(_0x18f739,_0x1529dd){if(_0x1529dd===0x0){return 0x0;}var _0x2024df=0x1;for(var _0x1cb659=0x1;_0x1cb659<=_0x1529dd;_0x1cb659+=0x1){_0x2024df=0x1+_0x2024df*_0x1cb659/_0x18f739;}return 0x1/_0x2024df;}function isVoiceQueueOutbound(_0x425db9){return _0x425db9===_0x85eb('0x47');}function isNotPreview(_0x2292b5){return _0x2292b5!=='preview';}function isCampaignIvr(_0x271842){return _0x271842===_0x85eb('0x6f');}function getCallerId(_0x46e5d3,_0xdaf2fe,_0x4470b3){if(!_[_0x85eb('0x38')](_0x4470b3)&&'string'===typeof _0x4470b3&&!_[_0x85eb('0x72')](_0x4470b3)){if(!_['isUndefined'](_0xdaf2fe)&&_0x85eb('0x7c')===typeof _0xdaf2fe&&!_[_0x85eb('0x72')](_0xdaf2fe)){return util[_0x85eb('0x70')](_0x85eb('0x7d'),_0xdaf2fe,_0x4470b3);}return util[_0x85eb('0x70')]('\x22%s\x22\x20<%s>',_0x4470b3,_0x4470b3);}if(!_[_0x85eb('0x38')](_0x46e5d3)&&_0x85eb('0x7c')===typeof _0x46e5d3&&!_[_0x85eb('0x72')](_0x46e5d3)){return _0x46e5d3;}return _0x85eb('0x7e');}function loggerCatchQueueSummary(_0x10af0e,_0x14cab8){return function(_0x23fcf9){freeVariablesPredictive(_0x14cab8);emitVoiceQueueSummary(_0x14cab8);emitCampaignSummary(_0x14cab8);loggerSyncQueueSummary[_0x85eb('0x7f')](_0x10af0e,util['inspect'](_0x23fcf9,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3b896a,_0x4d27bd){return function(_0x223265){loggerPredictive[_0x85eb('0x7f')](_0x3b896a,JSON[_0x85eb('0x44')](_0x223265));freeVariablesPredictive(_0x4d27bd);};}function loggerCatch(_0x41960f){return function(_0x259ee3){logger['error'](_0x41960f,util[_0x85eb('0x80')](_0x259ee3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xbd544c){return _0xbd544c&&!_[_0x85eb('0x38')](_0xbd544c)&&_0xbd544c[_0x85eb('0x81')]>0x0;}function decremetOriginate(_0x47487e){if(!_[_0x85eb('0x38')](_0x47487e)&&_0x47487e!==null){if(_0x47487e['hasOwnProperty']('originated')){if(_0x47487e[_0x85eb('0x69')]>0x0){_0x47487e['originated']-=0x1;}else{logger[_0x85eb('0x7f')](_0x85eb('0x82'));}}}else{logger[_0x85eb('0x7f')](_0x85eb('0x83'));}}function checkContactLowerLimitOriginate(_0x232e3f,_0x2b7258,_0x542098){if(_0x2b7258>_0x542098){for(var _0x2c4985=0x0;_0x2c4985<_0x2b7258-_0x542098;_0x2c4985+=0x1){decremetOriginate(_0x232e3f);}}}function loggerGetContactDialer(_0x236966,_0x3f30e4,_0x2e65d5){return function(_0x52bbdf){checkContactLowerLimitOriginate(_0x3f30e4,_0x2e65d5,0x0);logger[_0x85eb('0x7f')](_0x236966,util[_0x85eb('0x80')](_0x52bbdf,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xcc7da3){return function(_0x14bf0e){if(isNotNull(_0x14bf0e)&&isNotNull(_0x14bf0e[0x0])){if(_0x14bf0e[0x0]['contactsRescheduled']>0x0){_0xcc7da3[_0x85eb('0x39')]=_0x85eb('0x84');logger[_0x85eb('0x73')](_0x85eb('0x85')+_0xcc7da3[_0x85eb('0x3c')],_0x14bf0e[0x0][_0x85eb('0x86')],_0x85eb('0x87'));}else{_0xcc7da3[_0x85eb('0x39')]=_0x85eb('0x88');logger[_0x85eb('0x73')](_0x85eb('0x89')+_0xcc7da3[_0x85eb('0x3c')]);}}};}function notSendMessagesQueue(_0x1d9d3a){if(_0x1d9d3a[_0x85eb('0x8a')]){freeVariablesPredictive(_0x1d9d3a);if(_0x1d9d3a[_0x85eb('0x69')]===0x0&&_0x1d9d3a[_0x85eb('0x8b')]===0x0&&_0x1d9d3a[_0x85eb('0x4f')]===0x0&&(_0x1d9d3a[_0x85eb('0x4a')]||0x0)===0x0){_0x1d9d3a[_0x85eb('0x8a')]=![];_0x1d9d3a['available']=0x0;_0x1d9d3a[_0x85eb('0x39')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x85eb('0x7f')](_0x85eb('0x8c'),_0x1d9d3a[_0x85eb('0x3c')],_0x85eb('0x8d'));}else{_0x1d9d3a[_0x85eb('0x39')]=_0x85eb('0x8e');loggerSyncQueueSummary[_0x85eb('0x7f')](_0x85eb('0x8c'),_0x1d9d3a[_0x85eb('0x3c')],'is\x20disactive');}emitVoiceQueueSummary(_0x1d9d3a);}}function notSendMessagesCampaign(_0x581643){if(_0x581643[_0x85eb('0x8a')]){if(_0x581643[_0x85eb('0x69')]===0x0){_0x581643[_0x85eb('0x8a')]=![];_0x581643[_0x85eb('0x39')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x85eb('0x7f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x581643[_0x85eb('0x3c')],_0x85eb('0x8d'));}else{_0x581643[_0x85eb('0x39')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x85eb('0x7f')](_0x85eb('0x8f'),_0x581643[_0x85eb('0x3c')],'is\x20disactive');}emitCampaignSummary(_0x581643);}}function createObjHistory(_0x588c72,_0x45a1ef,_0x35abaa,_0x194de6,_0x403ddf){_0x588c72['message']=_0x35abaa;var _0x8cb47=new Action(_0x588c72,_0x45a1ef);var _0x4ae1dd=new History(_0x8cb47);_0x4ae1dd[_0x85eb('0x90')]=_0x194de6;_0x4ae1dd[_0x85eb('0x91')]=_0x403ddf;_0x4ae1dd[_0x85eb('0x92')]=_0x8cb47[_0x85eb('0x93')];return _0x4ae1dd;}Dialer[_0x85eb('0x1a')][_0x85eb('0x37')]=function(){var _0x53cf37=this;setInterval(function(){_0x53cf37[_0x85eb('0x94')](_0x53cf37['uniqueId'],_0x85eb('0x95'));_0x53cf37[_0x85eb('0x94')](_0x53cf37[_0x85eb('0x24')],_0x85eb('0x96'));},0x32c8);};Dialer[_0x85eb('0x1a')][_0x85eb('0x94')]=function(_0xd0f1f8,_0x11db35){var _0x3a471d=this;for(var _0x543146 in _0xd0f1f8){if(_0xd0f1f8[_0x85eb('0x97')](_0x543146)){this[_0x85eb('0x1d')]['enqueue'](function(){if(!_['isNil'](_0xd0f1f8[_0x543146])){return ami[_0x85eb('0x98')]({'action':'status','channel':_0xd0f1f8[_0x543146][_0x85eb('0x99')]})['catch'](function(_0x101ae0){if(_0x101ae0['message']===_0x85eb('0x9a')){setTimeout(function(){if(_0xd0f1f8[_0x543146]&&_0xd0f1f8[_0x543146][_0x85eb('0x4d')]!=='ivr'){_0x3a471d[_0x85eb('0x9b')](_0x3a471d[_0x85eb('0x9c')][_0xd0f1f8[_0x543146]['queue']]);logger[_0x85eb('0x7f')](_0x85eb('0x9d'),_0x11db35,_0x543146,_0xd0f1f8[_0x543146][_0x85eb('0x9e')]);delete _0xd0f1f8[_0x543146];}if(_0xd0f1f8[_0x543146]&&_0xd0f1f8[_0x543146][_0x85eb('0x4d')]==='ivr'){_0x3a471d[_0x85eb('0x9b')](_0x3a471d['campaigns'][_0xd0f1f8[_0x543146][_0x85eb('0x9e')]]);logger[_0x85eb('0x7f')](_0x85eb('0x9f'),_0x11db35,_0x543146,_0xd0f1f8[_0x543146]['queue']);delete _0xd0f1f8[_0x543146];}},0x2328);}});}});}}};Dialer[_0x85eb('0x1a')][_0x85eb('0xa0')]=function(_0x760d65){return BPromise['resolve']()[_0x85eb('0xa1')](cmHopper['countReScheduled'](_0x760d65))[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xa3')));};Dialer[_0x85eb('0x1a')]['checkIsBlackList']=function(_0x4a7184){return BPromise['resolve']()[_0x85eb('0xa1')](cmHopperBlack[_0x85eb('0xa4')](_0x4a7184))[_0x85eb('0xa2')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x85eb('0x1a')][_0x85eb('0xa5')]=function(_0x45d6af){return BPromise[_0x85eb('0xa6')]()[_0x85eb('0xa1')](cmHopperBlack['checkIsBlackListIvr'](_0x45d6af))['catch'](loggerCatch(_0x85eb('0xa7')));};Dialer[_0x85eb('0x1a')]['averageHandleTime']=function(_0x16b1ea){return BPromise[_0x85eb('0xa6')]()[_0x85eb('0xa1')](cmHopperHistory[_0x85eb('0xa8')](_0x16b1ea))[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xa9')));};Dialer[_0x85eb('0x1a')][_0x85eb('0xaa')]=function(_0xc2d257){return BPromise[_0x85eb('0xa6')]()[_0x85eb('0xa1')](cmHopper[_0x85eb('0xaa')](_0xc2d257))[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xab')));};Dialer[_0x85eb('0x1a')]['getContactDialer']=function(_0x21c621,_0x22112e,_0x2e58a4,_0x1b29ee){return BPromise[_0x85eb('0xa6')]()[_0x85eb('0xa1')](cmHopper[_0x85eb('0xac')](_0x21c621,_0x22112e,_0x2e58a4,_0x1b29ee))[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xad')));};Dialer[_0x85eb('0x1a')]['getContactDialerIvr']=function(_0x4440f2,_0x24f4d6,_0x48439c){return BPromise[_0x85eb('0xa6')]()['then'](cmHopper[_0x85eb('0xae')](_0x4440f2,_0x24f4d6,_0x48439c))[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xad')));};Dialer[_0x85eb('0x1a')][_0x85eb('0xaf')]=function(_0x31ae2e){return BPromise['resolve']()[_0x85eb('0xa1')](voiceQueueRt[_0x85eb('0xaf')](_0x31ae2e))[_0x85eb('0xa2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x85eb('0x1a')][_0x85eb('0xb0')]=function(_0x2d0bfb){return BPromise[_0x85eb('0xa6')]()[_0x85eb('0xa1')](cmHopper[_0x85eb('0xb0')](_0x2d0bfb))[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xb1')));};Dialer['prototype'][_0x85eb('0xb2')]=function(_0x32e1ed){return BPromise['resolve']()['then'](cmHopperHistory[_0x85eb('0xb2')](_0x32e1ed))['catch'](loggerCatch(_0x85eb('0xb3')));};Dialer[_0x85eb('0x1a')][_0x85eb('0x9b')]=function(_0x3bb604){if(!_['isUndefined'](_0x3bb604)&&_0x3bb604!==null){if(_0x3bb604['hasOwnProperty'](_0x85eb('0x69'))){if(_0x3bb604['originated']>0x0){_0x3bb604[_0x85eb('0x69')]-=0x1;}else{logger[_0x85eb('0x7f')](_0x85eb('0xb4'));}}}else{logger[_0x85eb('0x7f')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0x85eb('0xb5')]=function(_0x1cd0ff,_0x43e9ff){var _0x4b600a=this;return function(_0x59e505){_0x4b600a[_0x85eb('0x9b')](_0x43e9ff);logger[_0x85eb('0x7f')](_0x1cd0ff,util[_0x85eb('0x80')](_0x59e505,{'showHidden':![],'depth':null}));};};Dialer[_0x85eb('0x1a')][_0x85eb('0xb6')]=function(_0x2fde2c,_0x819d42,_0xe7512c){var _0xa5feb7={'state':0x19,'statedesc':_0x85eb('0xb7')};this[_0x85eb('0x9b')](_0x819d42);this['saveInDb'](_[_0x85eb('0xb8')](_0xa5feb7,_[_0x85eb('0xb9')](_0xe7512c,['ContactId',_0x85eb('0xba'),_0x85eb('0xbb'),_0x85eb('0xbc'),_0x85eb('0xbd')])),_0x85eb('0xbe'),_0x85eb('0xbf'));logger['error'](_0x2fde2c);};Dialer['prototype'][_0x85eb('0xc0')]=function(_0x55c697){return _0x55c697===_0x85eb('0xc1');};Dialer['prototype'][_0x85eb('0xc2')]=function(_0x364b9a){return!_['isUndefined'](_0x364b9a)&&_0x364b9a&&!_['isUndefined'](_0x364b9a[_0x85eb('0x3c')])&&!_[_0x85eb('0x38')](_0x364b9a['active'])&&_0x364b9a[_0x85eb('0x6b')]&&(this[_0x85eb('0x21')][util[_0x85eb('0x70')]('SIP/%s',_0x364b9a['name'])][_0x85eb('0xc3')]===_0x85eb('0xc4')||this[_0x85eb('0x21')][util[_0x85eb('0x70')](_0x85eb('0xc5'),_0x364b9a[_0x85eb('0x3c')])][_0x85eb('0xc3')]===_0x85eb('0xc6'));};Dialer[_0x85eb('0x1a')][_0x85eb('0xc7')]=function(_0x5db4d5,_0x17a5f8,_0x4d8d44){this[_0x85eb('0xb2')](_0x5db4d5)[_0x85eb('0xa2')](loggerCatch(_0x17a5f8));this[_0x85eb('0xb0')](_0x5db4d5)[_0x85eb('0xa2')](loggerCatch(_0x4d8d44));};Dialer[_0x85eb('0x1a')]['syncVarSet']=function(_0x34c380){var _0x24cd4b=this[_0x85eb('0xc8')][_0x34c380['uniqueid']];var _0x22e8ae;if(!_[_0x85eb('0xc9')](_0x34c380)&&!_[_0x85eb('0xc9')](_0x34c380[_0x85eb('0xca')])&&!_[_0x85eb('0xc9')](_0x34c380[_0x85eb('0xca')][_0x85eb('0xcb')])&&_0x34c380[_0x85eb('0xcc')]===_0x85eb('0xcd')&&_0x24cd4b){if(_0x24cd4b[_0x85eb('0x4d')]!==_0x85eb('0x6f')&&this[_0x85eb('0x9c')][_0x24cd4b[_0x85eb('0x9e')]][_0x85eb('0xce')]&&_0x34c380[_0x85eb('0xcf')]===_0x85eb('0xd0')){delete this['uniqueId'][_0x34c380[_0x85eb('0xd1')]];this[_0x85eb('0x9b')](this[_0x85eb('0x9c')][_0x24cd4b[_0x85eb('0x9e')]]);this[_0x85eb('0x9c')][_0x24cd4b[_0x85eb('0x9e')]][_0x85eb('0x54')]+=0x1;this['voiceQueues'][_0x24cd4b[_0x85eb('0x9e')]][_0x85eb('0x53')]+=0x1;_0x22e8ae=new Hangup(_0x24cd4b,_0x34c380);_0x22e8ae['state']=0x12;_0x22e8ae[_0x85eb('0x91')]='HangupInAMD';_0x22e8ae[_0x85eb('0xd2')]=_0x85eb('0xd3');this[_0x85eb('0xc7')](_0x22e8ae,_0x85eb('0xd4'),_0x85eb('0xd5'));}if(_0x24cd4b[_0x85eb('0x4d')]!==_0x85eb('0x6f')&&this[_0x85eb('0x9c')][_0x24cd4b['queue']]['dialAMDActive']&&_0x34c380[_0x85eb('0xcf')]===_0x85eb('0xd6')){delete this[_0x85eb('0xc8')][_0x34c380[_0x85eb('0xd1')]];this['updateOriginated'](this[_0x85eb('0x9c')][_0x24cd4b[_0x85eb('0x9e')]]);this[_0x85eb('0x9c')][_0x24cd4b['queue']][_0x85eb('0x54')]+=0x1;this[_0x85eb('0x9c')][_0x24cd4b[_0x85eb('0x9e')]]['outboundAnswerAgiCallsDay']+=0x1;_0x22e8ae=new Hangup(_0x24cd4b,_0x34c380);_0x22e8ae[_0x85eb('0x90')]=0x13;_0x22e8ae[_0x85eb('0x91')]=_0x85eb('0xd7');_0x22e8ae['membername']=_0x85eb('0xd3');_0x22e8ae[_0x85eb('0xd8')]=!![];this[_0x85eb('0xc7')](_0x22e8ae,_0x85eb('0xd9'),_0x85eb('0xda'));}if(_0x24cd4b[_0x85eb('0x4d')]===_0x85eb('0x6f')&&this[_0x85eb('0x1f')][_0x24cd4b[_0x85eb('0x9e')]]['dialAMDActive']&&_0x34c380[_0x85eb('0xcf')]===_0x85eb('0xd0')){delete this[_0x85eb('0xc8')][_0x34c380[_0x85eb('0xd1')]];this[_0x85eb('0x9b')](this[_0x85eb('0x1f')][_0x24cd4b['queue']]);_0x22e8ae=new Hangup(_0x24cd4b,_0x34c380);_0x22e8ae['state']=0x12;_0x22e8ae[_0x85eb('0x91')]=_0x85eb('0xdb');_0x22e8ae[_0x85eb('0xd2')]=_0x85eb('0xd3');this[_0x85eb('0xc7')](_0x22e8ae,_0x85eb('0xdc'),_0x85eb('0xdd'));}if(_0x24cd4b['type']===_0x85eb('0x6f')&&this[_0x85eb('0x1f')][_0x24cd4b['queue']][_0x85eb('0xce')]&&_0x34c380[_0x85eb('0xcf')]===_0x85eb('0xd6')){delete this[_0x85eb('0xc8')][_0x34c380[_0x85eb('0xd1')]];this[_0x85eb('0x9b')](this[_0x85eb('0x1f')][_0x24cd4b[_0x85eb('0x9e')]]);_0x22e8ae=new Hangup(_0x24cd4b,_0x34c380);_0x22e8ae[_0x85eb('0x90')]=0x13;_0x22e8ae['statedesc']='Machine';_0x22e8ae['membername']=_0x85eb('0xd3');_0x22e8ae[_0x85eb('0xd8')]=!![];this[_0x85eb('0xc7')](_0x22e8ae,_0x85eb('0xde'),_0x85eb('0xdf'));}}};Dialer[_0x85eb('0x1a')][_0x85eb('0x31')]=function(_0x384eb8){var _0xb14288=this[_0x85eb('0xc8')][_0x384eb8['uniqueid']];var _0xc37e2=this;var _0x1c8512;if(_0xb14288&&_0xb14288[_0x85eb('0x4d')]===_0x85eb('0x6f')){delete this[_0x85eb('0xc8')][_0x384eb8[_0x85eb('0xd1')]];this['updateOriginated'](this[_0x85eb('0x1f')][_0xb14288['queue']]);this[_0x85eb('0x1f')][_0xb14288['queue']][_0x85eb('0xe0')]+=0x1;_0x1c8512=new Hangup(_0xb14288,_0x384eb8);this[_0x85eb('0xb2')](_0x1c8512)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xe1')));this[_0x85eb('0xb0')](_0x1c8512)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xe2')));}if(_0xb14288&&_0xb14288[_0x85eb('0x4d')]!=='ivr'&&isNotNull(this['voiceQueues'][_0xb14288[_0x85eb('0x9e')]][_0x85eb('0xe3')])){delete this[_0x85eb('0xc8')][_0x384eb8[_0x85eb('0xd1')]];this[_0x85eb('0x9b')](this['voiceQueues'][_0xb14288[_0x85eb('0x9e')]]);this['voiceQueues'][_0xb14288['queue']][_0x85eb('0x54')]+=0x1;this[_0x85eb('0x9c')][_0xb14288['queue']][_0x85eb('0x53')]+=0x1;_0x1c8512=new Hangup(_0xb14288,_0x384eb8);_0x1c8512[_0x85eb('0x90')]=0x10;_0x1c8512[_0x85eb('0x91')]=_0x85eb('0xe4');_0x1c8512[_0x85eb('0xd2')]='AGI';this[_0x85eb('0xb2')](_0x1c8512)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xe1')));this[_0x85eb('0xb0')](_0x1c8512)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xe2')));}if(_0xb14288&&_0xb14288[_0x85eb('0x4d')]!==_0x85eb('0x6f')&&!isNotNull(this[_0x85eb('0x9c')][_0xb14288[_0x85eb('0x9e')]]['dialQueueProject'])){delete this['uniqueId'][_0x384eb8['uniqueid']];this[_0x85eb('0x9b')](this[_0x85eb('0x9c')][_0xb14288[_0x85eb('0x9e')]]);this['voiceQueues'][_0xb14288[_0x85eb('0x9e')]][_0x85eb('0x5f')]+=0x1;_0x1c8512=new Hangup(_0xb14288,_0x384eb8);_0x1c8512['state']=0xc;_0x1c8512[_0x85eb('0x91')]=_0x384eb8[_0x85eb('0xe5')];_0x1c8512[_0x85eb('0xd2')]=_0x85eb('0xe6');this['createHistory'](_0x1c8512)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xe1')));this[_0x85eb('0xb0')](_0x1c8512)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xe2')));}};Dialer[_0x85eb('0x1a')][_0x85eb('0x2f')]=function(_0x2b16f1){var _0x518eda=this[_0x85eb('0xc8')][_0x2b16f1[_0x85eb('0xd1')]];var _0x4a654d=this;if(this[_0x85eb('0x9c')][_0x2b16f1['queue']]){if(_0x518eda&&_0x518eda[_0x85eb('0x4d')]!==_0x85eb('0x6f')){delete this[_0x85eb('0xc8')][_0x2b16f1[_0x85eb('0xd1')]];this[_0x85eb('0x9c')][_0x2b16f1['queue']][_0x85eb('0x54')]+=0x1;var _0x5172d8=new AgentComplete(_0x518eda,_0x2b16f1);if(_0x2b16f1['reason']===_0x85eb('0xe7')){_0x5172d8[_0x85eb('0xe8')]=this['voiceQueues'][_0x2b16f1[_0x85eb('0x9e')]]['dialQueueProject2']&&this[_0x85eb('0x9c')][_0x2b16f1[_0x85eb('0x9e')]][_0x85eb('0xe9')]?moment()[_0x85eb('0x70')](_0x85eb('0xea')):undefined;}this[_0x85eb('0xb2')](_0x5172d8)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xeb')));this['moveContactManagedDialer'](_0x5172d8)['catch'](loggerCatch(_0x85eb('0xec')));}}};Dialer[_0x85eb('0x1a')][_0x85eb('0x2a')]=function(_0x174d51){if(this[_0x85eb('0x9c')][_0x174d51[_0x85eb('0x9e')]]){if(this[_0x85eb('0xc8')][_0x174d51[_0x85eb('0xd1')]]&&this[_0x85eb('0xc8')][_0x174d51[_0x85eb('0xd1')]][_0x85eb('0x4d')]!==_0x85eb('0x6f')){this[_0x85eb('0x9b')](this['voiceQueues'][_0x174d51[_0x85eb('0x9e')]]);this[_0x85eb('0xc8')][_0x174d51['uniqueid']]['answertime']=moment()['format'](_0x85eb('0xea'));}}};Dialer[_0x85eb('0x1a')][_0x85eb('0xed')]=function(_0x7acbfd){this['createHistory'](_0x7acbfd)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xeb')));this[_0x85eb('0xb0')](_0x7acbfd)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xee')));};Dialer['prototype'][_0x85eb('0xef')]=function(_0xccb94c){var _0x5ae2e8=this[_0x85eb('0xc8')][_0xccb94c[_0x85eb('0xd1')]];var _0x44242b=this;if(this[_0x85eb('0x9c')][_0xccb94c[_0x85eb('0x9e')]]){if(_0x5ae2e8&&_0x5ae2e8[_0x85eb('0x4d')]!==_0x85eb('0x6f')){delete this[_0x85eb('0xc8')][_0xccb94c['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0xccb94c[_0x85eb('0x9e')]]);_0x5ae2e8['droptime']=moment()[_0x85eb('0x70')](_0x85eb('0xea'));var _0xb11d22=new QueueCallerAbandon(_0x5ae2e8,_0xccb94c);if(getSeconds(_0x5ae2e8[_0x85eb('0xf0')],_0x5ae2e8[_0x85eb('0xf1')])>=_0x5ae2e8[_0x85eb('0xf2')]){this['voiceQueues'][_0xccb94c[_0x85eb('0x9e')]][_0x85eb('0x62')]+=0x1;this[_0x85eb('0x9c')][_0xccb94c[_0x85eb('0x9e')]][_0x85eb('0x59')]+=0x1;this[_0x85eb('0x9c')][_0xccb94c[_0x85eb('0x9e')]][_0x85eb('0x64')]+=0x1;_0xb11d22[_0x85eb('0x90')]=0xa;_0xb11d22['statedesc']=_0x85eb('0xf3');_0xb11d22[_0x85eb('0xf4')]='TIMEOUT';_0xb11d22[_0x85eb('0xe8')]=this[_0x85eb('0x9c')][_0xccb94c[_0x85eb('0x9e')]][_0x85eb('0xf5')]?moment()[_0x85eb('0x70')](_0x85eb('0xea')):undefined;this['queueCallerAbandonCreateState'](_0xb11d22);}else{this[_0x85eb('0x9c')][_0xccb94c[_0x85eb('0x9e')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0xccb94c[_0x85eb('0x9e')]][_0x85eb('0x58')]+=0x1;_0xb11d22['state']=0xb;_0xb11d22[_0x85eb('0x91')]=_0x85eb('0xf6');_0xb11d22['dropreason']=_0x85eb('0xf7');this[_0x85eb('0xed')](_0xb11d22);}}}};Dialer[_0x85eb('0x1a')][_0x85eb('0x32')]=function(_0x235fee){if(this['actions'][_0x235fee['uniqueid']]){this[_0x85eb('0x24')][_0x235fee[_0x85eb('0xd1')]][_0x85eb('0x99')]=_0x235fee[_0x85eb('0x99')];}if(this[_0x85eb('0xc8')][_0x235fee[_0x85eb('0xd1')]]){this[_0x85eb('0xc8')][_0x235fee['uniqueid']][_0x85eb('0x99')]=_0x235fee[_0x85eb('0x99')];}};Dialer[_0x85eb('0x1a')][_0x85eb('0xf8')]=function(_0x372412){if(strategy[this[_0x85eb('0x9c')][this[_0x85eb('0x24')][_0x372412[_0x85eb('0xf9')]][_0x85eb('0x9e')]][_0x85eb('0x48')]]==='roundrobin'){if(this[_0x85eb('0x24')][_0x372412[_0x85eb('0xf9')]]&&_[_0x85eb('0xc9')](this[_0x85eb('0x24')][_0x372412[_0x85eb('0xf9')]]['locked'])&&_0x372412['status']==='1'&&_0x372412[_0x85eb('0xfa')]==='0'){if(this[_0x85eb('0x20')][_0x372412[_0x85eb('0xfb')]]){if(!this[_0x85eb('0x20')][_0x372412[_0x85eb('0xfb')]][_0x85eb('0xfc')]){this['agents'][_0x372412[_0x85eb('0xfb')]][_0x85eb('0xfc')]=!![];this[_0x85eb('0x24')][_0x372412['actionid']][_0x85eb('0xfc')]=!![];this['actions'][_0x372412[_0x85eb('0xf9')]]['stateinterface']=_0x372412[_0x85eb('0xfb')];}}}}else if((strategy[this[_0x85eb('0x9c')][this[_0x85eb('0x24')][_0x372412['actionid']][_0x85eb('0x9e')]][_0x85eb('0x48')]]||_0x85eb('0xfd'))===_0x85eb('0xfd')){if(this['actions'][_0x372412[_0x85eb('0xf9')]]){if(this[_0x85eb('0x20')][_0x372412['stateinterface']]){this[_0x85eb('0x24')][_0x372412[_0x85eb('0xf9')]][_0x85eb('0xfb')]=_0x372412['stateinterface'];if(_['isNil'](this[_0x85eb('0x27')][this[_0x85eb('0x24')][_0x372412[_0x85eb('0xf9')]][_0x85eb('0x9e')]])){this[_0x85eb('0x27')][this['actions'][_0x372412[_0x85eb('0xf9')]][_0x85eb('0x9e')]]=[];}this['queueBooked'][this[_0x85eb('0x24')][_0x372412[_0x85eb('0xf9')]][_0x85eb('0x9e')]][_0x85eb('0xfe')](_['merge'](_['pick'](this[_0x85eb('0x24')][_0x372412[_0x85eb('0xf9')]],['idHopper','stateinterface']),{'status':_0x372412[_0x85eb('0xc3')],'paused':_0x372412[_0x85eb('0xfa')]}));}}}};function unlockQueueStatus(_0x912883,_0x4e1282){setTimeout(function(){if(_[_0x85eb('0x38')](_0x912883[_0x85eb('0xff')])){loggerBooked['error'](_0x85eb('0x100'),_0x4e1282);}_0x912883[_0x85eb('0xff')]=!![];loggerBooked[_0x85eb('0x73')](_0x85eb('0x101'),_0x4e1282,JSON[_0x85eb('0x44')](_[_0x85eb('0xb9')](_0x912883,['name',_0x85eb('0xff')])));},0x1f3);}Dialer[_0x85eb('0x1a')][_0x85eb('0x102')]=function(_0x508e4e){var _0x4d19d5=this;var _0x4b1c73=_0x4d19d5[_0x85eb('0x9c')][_0x4d19d5['actions'][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x9e')]];if(strategy[this[_0x85eb('0x9c')][this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x9e')]][_0x85eb('0x48')]]==='roundrobin'){if(this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]]&&this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0xfb')]){this[_0x85eb('0x1e')][_0x85eb('0x103')](this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x104')],this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0xfb')])[_0x85eb('0xa2')](function(_0x294f23){logger['error'](_0x85eb('0x105'),util[_0x85eb('0x80')](_0x294f23,{'showHidden':![],'depth':null}));})[_0x85eb('0x106')](function(){_0x4d19d5[_0x85eb('0x9b')](_0x4d19d5['voiceQueues'][_0x4d19d5[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x9e')]]);_0x4d19d5[_0x85eb('0x20')][_0x4d19d5[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]]['stateinterface']]['locked']=![];delete _0x4d19d5['actions'][_0x508e4e[_0x85eb('0xf9')]];unlockQueueStatus(_0x4b1c73);});}else{this[_0x85eb('0x9b')](this[_0x85eb('0x9c')][this['actions'][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x9e')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x107')],'ListId':this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0xba')],'VoiceQueueId':this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0xbc')]||undefined,'CampaignId':this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0xbd')]||undefined})['catch'](loggerCatch(_0x85eb('0x108')));delete this[_0x85eb('0x24')][_0x508e4e['actionid']];unlockQueueStatus(_0x4b1c73);}}else if((strategy[this[_0x85eb('0x9c')][this['actions'][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x9e')]][_0x85eb('0x48')]]||_0x85eb('0xfd'))===_0x85eb('0xfd')){var _0x3f828b;if(this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]]&&!_['isEmpty'](this['queueBooked'][this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]]['queue']])){if(this[_0x85eb('0x28')][_0x4d19d5[_0x85eb('0x24')][_0x508e4e['actionid']][_0x85eb('0x9e')]]){this[_0x85eb('0x28')][_0x4d19d5[_0x85eb('0x24')][_0x508e4e['actionid']][_0x85eb('0x9e')]]=this['queueBookedRR'][this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x9e')]]?this[_0x85eb('0x28')][this['actions'][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x9e')]]:this[_0x85eb('0x27')][this[_0x85eb('0x24')][_0x508e4e['actionid']][_0x85eb('0x9e')]]?this[_0x85eb('0x27')][this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x9e')]][_0x85eb('0x109')]||0x0:0x0;}this['queueBooked'][this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]]['queue']]['_rr']=this[_0x85eb('0x28')][this[_0x85eb('0x24')][_0x508e4e[_0x85eb('0xf9')]][_0x85eb('0x9e')]];for(var _0x17d94e=0x0;_0x17d94e=0x0?!![]:![];})[_0x85eb('0xa2')](myreject(_0x10450c)));}}else{_0x4144d7[_0x85eb('0xfe')](ami[_0x85eb('0x98')]({'action':_0x85eb('0x120'),'command':util[_0x85eb('0x70')](_0x85eb('0x121'),_0x26eca2,!_['isUndefined'](config[_0x85eb('0x11d')][_0x39a36c])?_0x39a36c:'')})[_0x85eb('0xa1')](function(_0x4656b6){return _0x4656b6['content']['indexOf'](_0x85eb('0x125'))>=0x0?!![]:![];})['catch'](myreject(_0x10450c)));}BPromise['all'](_0x4144d7)[_0x85eb('0xa1')](function(_0x26c945){var _0x4ba6bf=_['some'](_0x26c945);if(_0x4ba6bf){return _0x3a10a4(_0x4ba6bf);}else{_0x4a3f65[_0x85eb('0x39')]=_0x41cb8a?_0x85eb('0x126'):_0x85eb('0x127');return _0x10450c(msgResponse('[ifTime][promiseAll]',_0x85eb('0x11a'),_0x85eb('0x128')+_0x41cb8a+'\x20'+_0x5b3318+_0x85eb('0x129')+util[_0x85eb('0x80')](_0x26eca2,{'showHidden':![],'depth':null})+_0x85eb('0x12a')+_0x39a36c));}})[_0x85eb('0xa2')](function(_0x580136){return _0x10450c(msgResponse('ifTime',_0x85eb('0x11a'),JSON[_0x85eb('0x44')](_0x580136)));});});};Dialer[_0x85eb('0x1a')]['checkDialMethod']=function(_0x599423){var _0x1d57d5=this;return function(){switch(_0x599423[_0x85eb('0x50')]){case _0x85eb('0x12b'):freeVariablesPredictive(_0x599423);_0x1d57d5['handlePower'](_0x599423,0x1);break;case _0x85eb('0x12c'):freeVariablesPredictive(_0x599423);_0x1d57d5[_0x85eb('0x12d')](_0x599423,_0x599423[_0x85eb('0x12e')]);break;case'predictive':_0x1d57d5[_0x85eb('0x9')](_0x599423);break;case _0x85eb('0x8'):freeVariablesPredictive(_0x599423);_0x1d57d5['handlePower'](_0x599423,0x1);break;default:freeVariablesPredictive(_0x599423);logger[_0x85eb('0x7f')](_0x85eb('0x12f'),_0x599423[_0x85eb('0x3c')],'method\x20not\x20recognized');}};};Dialer[_0x85eb('0x1a')][_0x85eb('0x130')]=function(_0x1a87bf){var _0x473c44=this;return function(){_0x473c44[_0x85eb('0x131')](_0x1a87bf);};};Dialer[_0x85eb('0x1a')][_0x85eb('0xb')]=function(_0x346976){var _0x20ecbc=this;if(isNotPreview(_0x346976[_0x85eb('0x50')])){if(isVoiceQueueOutbound(_0x346976[_0x85eb('0x4d')])&&isActive(_0x346976[_0x85eb('0x132')])){_0x346976['sendMessageOneNotActive']=!![];BPromise[_0x85eb('0xa6')]()[_0x85eb('0xa1')](checkIsLoggedIn(_0x346976,_0x346976[_0x85eb('0x133')]))['then'](checkIsActive(_0x346976,_0x346976[_0x85eb('0x132')]))[_0x85eb('0xa1')](checkInterval(_0x346976))[_0x85eb('0xa1')](_0x20ecbc[_0x85eb('0x114')](_0x346976))[_0x85eb('0xa1')](_0x20ecbc['checkIfTime'](_0x346976[_0x85eb('0x134')],_0x346976['dialTimezone'],_0x346976[_0x85eb('0x3c')],_0x346976))[_0x85eb('0xa1')](_0x20ecbc[_0x85eb('0x119')](_0x346976[_0x85eb('0x3e')],_0x346976[_0x85eb('0x135')],_0x346976['name'],_0x346976))[_0x85eb('0xa1')](_0x20ecbc[_0x85eb('0x136')](_0x346976))[_0x85eb('0xa2')](loggerCatchQueueSummary(_0x85eb('0x137'),_0x346976));}else{notSendMessagesQueue(_0x346976);}}else{freeVariablesPredictive(_0x346976);}};Dialer[_0x85eb('0x1a')]['syncCampaigns']=function(){var _0x161c81=this;var _0x5bda51;for(var _0x29945b in this['campaigns']){if(this['campaigns'][_0x85eb('0x97')](_0x29945b)){_0x5bda51=this[_0x85eb('0x1f')][_0x29945b];if(isCampaignIvr(_0x5bda51[_0x85eb('0x4d')])&&isActive(_0x5bda51[_0x85eb('0x6b')])){_0x5bda51[_0x85eb('0x8a')]=!![];BPromise[_0x85eb('0xa6')]()['then'](checkIsActive(_0x5bda51,_0x5bda51[_0x85eb('0x6b')]))[_0x85eb('0xa1')](checkInterval(_0x5bda51))['then'](_0x161c81['checkIsTrunkReachable'](_0x5bda51))['then'](_0x161c81[_0x85eb('0x117')](_0x5bda51[_0x85eb('0x134')],_0x5bda51[_0x85eb('0x135')],_0x5bda51['name'],_0x5bda51))[_0x85eb('0xa1')](_0x161c81[_0x85eb('0x119')](_0x5bda51[_0x85eb('0x3e')],_0x5bda51[_0x85eb('0x135')],_0x5bda51[_0x85eb('0x3c')],_0x5bda51))['then'](_0x161c81[_0x85eb('0x130')](_0x5bda51))['catch'](loggerCatchQueueSummary(_0x85eb('0x138'),_0x5bda51));}else{notSendMessagesCampaign(_0x5bda51);}}}};function getCallerIdRandom(_0x526eda,_0xe2b265){var _0x26f7f0,_0x204434,_0x27b910;if(_0xe2b265<=0x0){_0xe2b265=0x1;}_0x26f7f0=new RegExp('\x5cw{0,'+_0xe2b265+'}$');_0x204434=Math[_0x85eb('0x139')](0xa,_0xe2b265-0x1);_0x27b910=Math[_0x85eb('0x139')](0xa,_0xe2b265)-0x1;return util[_0x85eb('0x70')]('%s',_[_0x85eb('0x13a')](_0x526eda,_0x26f7f0,_[_0x85eb('0x13b')](_0x204434,_0x27b910)));}function extractCalleridName(_0x289594){var _0x1145f3=_0x289594['match'](/"(.*?)"/);return _0x1145f3?_0x1145f3[0x1]:_0x289594;}function extractCalleridNumber(_0x5b4d1f){var _0x3b7375=_0x5b4d1f[_0x85eb('0x13c')](/<(.*?)>/);return _0x3b7375?_0x3b7375[0x1]:_0x5b4d1f;}Dialer['prototype'][_0x85eb('0x13d')]=function(_0x1406b3,_0x197491){var _0x2dbdf3=this;var _0x1e08e0=uuid['v4']();this['actions'][_0x1e08e0]=new Action(_0x1406b3,_0x197491,_0x1e08e0);return new BPromise(function(_0x38dab1,_0x20e57b){if(_[_0x85eb('0x38')](_0x1406b3)&&_0x85eb('0x13e')!==typeof _0x1406b3){return _0x20e57b(msgResponse(_0x85eb('0x13f'),_0x85eb('0x11a'),_0x85eb('0x140')));}if(_[_0x85eb('0x38')](_0x197491[_0x85eb('0x141')][_0x85eb('0x142')])||_0x197491[_0x85eb('0x141')][_0x85eb('0x142')]===null){return _0x20e57b(msgResponse(_0x85eb('0x13f'),'Failure','contact\x20is\x20undefine'));}var _0x23ce17={'XMD-CALLERID':_0x2dbdf3['actions'][_0x1e08e0][_0x85eb('0x143')](),'XMD-AGI':_0x1406b3[_0x85eb('0xe3')]?util[_0x85eb('0x70')](_0x85eb('0x144'),ipAgi,_0x1406b3[_0x85eb('0xe3')]):_0x85eb('0x145'),'XMD-AGIAFTER':_0x1406b3[_0x85eb('0xf5')]?util[_0x85eb('0x70')](_0x85eb('0x144'),ipAgi,_0x1406b3[_0x85eb('0xf5')]):_0x85eb('0x145'),'XMD-QUEUE':_0x1406b3[_0x85eb('0x4d')]==='outbound'?util[_0x85eb('0x70')](_0x85eb('0x146'),_0x1406b3[_0x85eb('0x3c')],_0x1406b3[_0x85eb('0x147')]||'',_0x1406b3[_0x85eb('0xe9')]?'c':'',_0x1406b3[_0x85eb('0xf2')]||0x3):_0x85eb('0x145'),'XMD-CONTACTID':_0x197491['ContactId'],'XMD-CDRTYPE':_0x85eb('0x7'),'CALLERID(all)':_0x2dbdf3[_0x85eb('0x24')][_0x1e08e0][_0x85eb('0x143')](),'XMD-AMD':_0x1406b3[_0x85eb('0xce')]?_0x85eb('0x148'):_0x85eb('0x145'),'XMD-DESTINATION':_0x85eb('0xcd')};if(_0x1406b3['dialAMDActive']){_0x23ce17['XMD-AMDINITIALSILENCE']=_0x1406b3[_0x85eb('0x149')]||0x9c4;_0x23ce17[_0x85eb('0x14a')]=_0x1406b3[_0x85eb('0x14b')]||0x5dc;_0x23ce17[_0x85eb('0x14c')]=_0x1406b3[_0x85eb('0x14d')]||0x320;_0x23ce17[_0x85eb('0x14e')]=_0x1406b3[_0x85eb('0x14f')]||0x1388;_0x23ce17[_0x85eb('0x150')]=_0x1406b3[_0x85eb('0x151')]||0x64;_0x23ce17[_0x85eb('0x152')]=_0x1406b3['dialAMDBetweenWordsSilence']||0x32;_0x23ce17[_0x85eb('0x153')]=_0x1406b3['dialAMDMaximumNumberOfWords']||0x3;_0x23ce17[_0x85eb('0x154')]=_0x1406b3[_0x85eb('0x155')]||0x100;_0x23ce17[_0x85eb('0x156')]=_0x1406b3[_0x85eb('0x157')]||0x1388;}if(_0x1406b3[_0x85eb('0x4d')]===_0x85eb('0x47')){_0x23ce17[_0x85eb('0x158')]=_0x197491[_0x85eb('0xbc')];}else{_0x23ce17[_0x85eb('0x159')]=_0x197491[_0x85eb('0xbd')];}for(var _0x48bbb2 in _0x197491['Contact']){if(_0x197491[_0x85eb('0x141')][_0x85eb('0x97')](_0x48bbb2)){if(isNotNull(_0x197491[_0x85eb('0x141')][_0x48bbb2])&&_0x48bbb2!=='id'&&_0x48bbb2!==_0x85eb('0x15a')&&_0x48bbb2!==_0x85eb('0x15b')&&_0x48bbb2!==_0x85eb('0x15c')){_0x23ce17[util[_0x85eb('0x70')](_0x85eb('0x15d'),'XMD-',_['toUpper'](_0x48bbb2))]=_0x197491['Contact'][_0x48bbb2];}}}var _0x3c62fb=_0x2dbdf3[_0x85eb('0xc2')](_0x1406b3[_0x85eb('0x6a')])?getCallerId(_0x1406b3[_0x85eb('0x6a')]['callerid'],_0x1406b3[_0x85eb('0x51')],_0x1406b3['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x1406b3['dialOriginateCallerIdNumber'],_0x1406b3['dialRandomLastDigitCallerIdNumber']):_0x1406b3[_0x85eb('0x15e')]):getCallerId(_[_0x85eb('0xc9')](_0x1406b3[_0x85eb('0x15f')])?_0x1406b3['Trunk']['callerid']:_0x1406b3[_0x85eb('0x15f')]['callerid'],_0x1406b3[_0x85eb('0x51')],_0x1406b3[_0x85eb('0x160')]>0x0?getCallerIdRandom(_0x1406b3[_0x85eb('0x15e')],_0x1406b3[_0x85eb('0x160')]):_0x1406b3['dialOriginateCallerIdNumber']);if(_0x3c62fb){_0x23ce17[_0x85eb('0x161')]=_0x2dbdf3[_0x85eb('0x24')][_0x1e08e0][_0x85eb('0x162')]=extractCalleridName(_0x3c62fb);_0x23ce17[_0x85eb('0x163')]=_0x2dbdf3[_0x85eb('0x24')][_0x1e08e0][_0x85eb('0x164')]=extractCalleridNumber(_0x3c62fb);}return ami['Action']({'actionid':_0x1e08e0,'action':_0x85eb('0x13f'),'channel':_0x2dbdf3[_0x85eb('0xc2')](_0x1406b3['Trunk'])?util[_0x85eb('0x70')](_0x85eb('0x165'),_0x1406b3['Trunk'][_0x85eb('0x3c')],isNotNull(_0x1406b3[_0x85eb('0x52')])?_0x1406b3['dialPrefix'][_0x85eb('0x166')]()||'':'',_0x1406b3[_0x85eb('0x167')]>0x0?_0x197491[_0x85eb('0x141')][_0x85eb('0x142')]['substring'](_0x1406b3[_0x85eb('0x167')]):_0x197491[_0x85eb('0x141')][_0x85eb('0x142')]):util[_0x85eb('0x70')](_0x85eb('0x165'),_[_0x85eb('0xc9')](_0x1406b3[_0x85eb('0x15f')])?_0x1406b3['Trunk'][_0x85eb('0x3c')]:_0x1406b3[_0x85eb('0x15f')][_0x85eb('0x3c')],isNotNull(_0x1406b3['dialPrefix'])?_0x1406b3[_0x85eb('0x52')]['trim']()||'':'',_0x1406b3[_0x85eb('0x167')]>0x0?_0x197491[_0x85eb('0x141')][_0x85eb('0x142')][_0x85eb('0x168')](_0x1406b3[_0x85eb('0x167')]):_0x197491[_0x85eb('0x141')][_0x85eb('0x142')]),'callerid':_0x3c62fb,'Exten':'xcally-motion-dialer','Context':_0x85eb('0x169'),'Priority':'1','variable':_0x23ce17,'timeout':(_0x1406b3[_0x85eb('0x16a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1e08e0})[_0x85eb('0xa1')](function(_0x5bed2a){return _0x38dab1(_0x5bed2a);})[_0x85eb('0xa2')](function(_0x17bac0){_0x1406b3[_0x85eb('0x5c')]+=0x1;var _0x75460f=new History(_0x2dbdf3['actions'][_0x1e08e0]);logger['error'](util[_0x85eb('0x70')](_0x85eb('0x16b'),JSON[_0x85eb('0x44')](_0x17bac0)));_0x75460f[_0x85eb('0x90')]=0xe;_0x75460f['statedesc']=_0x85eb('0x16c');_0x75460f[_0x85eb('0x93')]=moment()['format'](_0x85eb('0xea'));_0x75460f[_0x85eb('0x92')]=_0x75460f[_0x85eb('0x93')];_0x2dbdf3[_0x85eb('0xb2')](_0x75460f)['catch'](loggerCatch(_0x85eb('0x16d')));_0x2dbdf3[_0x85eb('0xb0')](_0x75460f)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0x16d')))[_0x85eb('0x106')](function(){delete _0x2dbdf3[_0x85eb('0x24')][_0x1e08e0];return _0x20e57b(msgResponse(_0x85eb('0x13f'),_0x85eb('0x43'),_0x85eb('0x16e')));});});});};Dialer[_0x85eb('0x1a')][_0x85eb('0x2d')]=function(_0x3109dc){var _0x3d55af=this[_0x85eb('0x24')][_0x3109dc[_0x85eb('0xf9')]];var _0x2192a8=this;if(_0x3d55af){delete this['actions'][_0x3109dc[_0x85eb('0xf9')]];_0x3d55af[_0x85eb('0xf1')]=moment()[_0x85eb('0x70')](_0x85eb('0xea'));var _0xbfe9f5=_0x3d55af['type']===_0x85eb('0x6f')?this[_0x85eb('0x1f')][_0x3d55af[_0x85eb('0x9e')]]:this['voiceQueues'][_0x3d55af[_0x85eb('0x16f')]()];if(!this[_0x85eb('0xc0')](_0x3109dc[_0x85eb('0x170')])){this[_0x85eb('0x9b')](_0xbfe9f5);return this['callProgressDetecting'](_0x3d55af,_0xbfe9f5,_0x3109dc)[_0x85eb('0xa1')](function(_0x2c6bd0){})[_0x85eb('0xa2')](loggerCatch(_0x85eb('0x171')));}else{this['uniqueId'][_0x3109dc[_0x85eb('0xd1')]]=_0x3d55af;}}};Dialer[_0x85eb('0x1a')][_0x85eb('0x172')]=function(_0x3a4117,_0x53f80e,_0x474613){var _0x2847ce=new History(_0x53f80e);if(_0x2847ce['countbusyretry']+_0x2847ce['countcongestionretry']+_0x2847ce[_0x85eb('0x173')]>=_0x474613['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x3a4117){case 0x3:if(_0x2847ce[_0x85eb('0x173')]>=_0x474613[_0x85eb('0x174')]-0x1){return!![];}else{this[_0x85eb('0xaa')]({'active':![],'countnoanswerretry':_0x2847ce['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x474613[_0x85eb('0x175')],'minutes')['format'](_0x85eb('0xea')),'ContactId':_0x2847ce[_0x85eb('0x107')],'ListId':_0x2847ce[_0x85eb('0xba')],'VoiceQueueId':_0x2847ce[_0x85eb('0xbc')]||undefined,'CampaignId':_0x2847ce[_0x85eb('0xbd')]||undefined})['catch'](loggerCatch(_0x85eb('0x176')));}break;case 0x5:if(_0x2847ce[_0x85eb('0x177')]>=_0x474613[_0x85eb('0x178')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x2847ce[_0x85eb('0x177')]+=0x1,'scheduledat':moment()['add'](_0x474613[_0x85eb('0x179')],'minutes')['format'](_0x85eb('0xea')),'ContactId':_0x2847ce[_0x85eb('0x107')],'ListId':_0x2847ce[_0x85eb('0xba')],'VoiceQueueId':_0x2847ce[_0x85eb('0xbc')]||undefined,'CampaignId':_0x2847ce[_0x85eb('0xbd')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x2847ce['countcongestionretry']>=_0x474613[_0x85eb('0x17a')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x2847ce[_0x85eb('0x17b')]+=0x1,'scheduledat':moment()[_0x85eb('0x17c')](_0x474613[_0x85eb('0x17d')],_0x85eb('0x17e'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2847ce['ContactId'],'ListId':_0x2847ce['ListId'],'VoiceQueueId':_0x2847ce[_0x85eb('0xbc')]||undefined,'CampaignId':_0x2847ce[_0x85eb('0xbd')]||undefined})[_0x85eb('0xa2')](loggerCatch(_0x85eb('0x17f')));}break;default:return!![];}};Dialer[_0x85eb('0x1a')]['callProgressDetecting']=function(_0x312f26,_0x184983,_0x1629d6){var _0x38bbcd=this;var _0x22fc3f=new History(_0x312f26);return new BPromise(function(_0x53cf58,_0x10cc74){if(_[_0x85eb('0x38')](_0x184983)&&'object'!==typeof _0x184983){return _0x10cc74(msgResponse(_0x85eb('0x180'),_0x85eb('0x11a'),_0x85eb('0x181')));}if(_[_0x85eb('0x38')](_0x1629d6)&&_0x85eb('0x13e')!==typeof _0x1629d6){return _0x10cc74(msgResponse(_0x85eb('0x180'),_0x85eb('0x11a'),'evt\x20is\x20undefine'));}switch(_0x1629d6[_0x85eb('0x182')]){case'0':_0x184983['outboundNoSuchCallsDay']+=0x1;_0x22fc3f[_0x85eb('0x90')]=0x0;_0x22fc3f['statedesc']=_0x85eb('0x183');_0x38bbcd[_0x85eb('0xb2')](_0x22fc3f)['catch'](loggerCatch(_0x85eb('0x184')));if(_0x38bbcd[_0x85eb('0x172')](0x0,_0x312f26,_0x184983)){if(_0x22fc3f[_0x85eb('0x177')]+_0x22fc3f[_0x85eb('0x17b')]+_0x22fc3f[_0x85eb('0x173')]>=_0x184983[_0x85eb('0x185')]){_0x38bbcd[_0x85eb('0x186')](_0x22fc3f,_0x53cf58,_0x10cc74,_0x85eb('0x187'));}else{_0x38bbcd[_0x85eb('0x188')](_0x22fc3f,_0x53cf58,_0x10cc74,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x184983[_0x85eb('0x5a')]+=0x1;_0x22fc3f[_0x85eb('0x90')]=0x3;_0x22fc3f[_0x85eb('0x91')]=_0x85eb('0x189');_0x22fc3f[_0x85eb('0x173')]+=0x1;_0x22fc3f[_0x85eb('0x18a')]+=0x1;_0x38bbcd['createHistory'](_0x22fc3f)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0x18b')));if(_0x38bbcd[_0x85eb('0x172')](0x3,_0x312f26,_0x184983)){if(_0x22fc3f['countnoanswerretry']>=_0x184983[_0x85eb('0x174')]){_0x38bbcd[_0x85eb('0x188')](_0x22fc3f,_0x53cf58,_0x10cc74,_0x85eb('0x18c'));}else{_0x38bbcd['stateGlobal'](_0x22fc3f,_0x53cf58,_0x10cc74,_0x85eb('0x18c'));}}break;case'5':_0x184983[_0x85eb('0x56')]+=0x1;_0x22fc3f[_0x85eb('0x90')]=0x5;_0x22fc3f['statedesc']=_0x85eb('0x18d');_0x22fc3f['countbusyretry']+=0x1;_0x22fc3f[_0x85eb('0x18a')]+=0x1;_0x38bbcd[_0x85eb('0xb2')](_0x22fc3f)[_0x85eb('0xa2')](loggerCatch(_0x85eb('0x18e')));if(_0x38bbcd[_0x85eb('0x172')](0x5,_0x312f26,_0x184983)){if(_0x22fc3f[_0x85eb('0x177')]>=_0x184983[_0x85eb('0x178')]){_0x38bbcd[_0x85eb('0x188')](_0x22fc3f,_0x53cf58,_0x10cc74,_0x85eb('0x18f'));}else{_0x38bbcd[_0x85eb('0x186')](_0x22fc3f,_0x53cf58,_0x10cc74,_0x85eb('0x18f'));}}break;case'8':_0x184983['outboundCongestionCallsDay']+=0x1;_0x22fc3f[_0x85eb('0x90')]=0x8;_0x22fc3f['statedesc']=_0x85eb('0x190');_0x22fc3f[_0x85eb('0x17b')]+=0x1;_0x22fc3f[_0x85eb('0x18a')]+=0x1;_0x38bbcd['createHistory'](_0x22fc3f)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x38bbcd[_0x85eb('0x172')](0x8,_0x312f26,_0x184983)){if(_0x22fc3f[_0x85eb('0x17b')]>=_0x184983[_0x85eb('0x17a')]){_0x38bbcd[_0x85eb('0x188')](_0x22fc3f,_0x53cf58,_0x10cc74,_0x85eb('0x191'));}else{_0x38bbcd[_0x85eb('0x186')](_0x22fc3f,_0x53cf58,_0x10cc74,_0x85eb('0x191'));}}break;default:_0x184983[_0x85eb('0x5f')]+=0x1;_0x22fc3f[_0x85eb('0x90')]=0xc;_0x22fc3f[_0x85eb('0x91')]=_0x1629d6[_0x85eb('0x182')];_0x38bbcd['createHistory'](_0x22fc3f)['catch'](loggerCatch(_0x85eb('0x192')));if(_0x38bbcd[_0x85eb('0x172')](_0x1629d6['reason'],_0x312f26,_0x184983)){if(_0x22fc3f['countbusyretry']+_0x22fc3f[_0x85eb('0x17b')]+_0x22fc3f[_0x85eb('0x173')]>=_0x184983[_0x85eb('0x185')]){_0x38bbcd[_0x85eb('0x186')](_0x22fc3f,_0x53cf58,_0x10cc74,_0x1629d6[_0x85eb('0x182')]);}else{_0x38bbcd[_0x85eb('0x188')](_0x22fc3f,_0x53cf58,_0x10cc74,_0x1629d6['reason']);}}}});};Dialer[_0x85eb('0x1a')]['stateGlobal']=function(_0x2a88b5,_0x16b721,_0x4cca6f,_0x269613){var _0x1ab728=new Final(_0x2a88b5);_0x1ab728[_0x85eb('0x90')]=0xf;_0x1ab728[_0x85eb('0x91')]=_0x85eb('0x193');this[_0x85eb('0x188')](_0x1ab728,_0x16b721,_0x4cca6f,_0x269613);};Dialer['prototype'][_0x85eb('0x188')]=function(_0x2d96ad,_0x477ddd,_0x3fb4d8,_0x3665f2){this[_0x85eb('0xb0')](_0x2d96ad)[_0x85eb('0xa1')](function(_0x5b98ee){return _0x477ddd(msgResponse(_0x85eb('0x180'),_0x85eb('0xc1'),_0x3665f2));})['catch'](function(_0x10302b){return _0x3fb4d8(msgResponse(_0x85eb('0x194'),_0x85eb('0x11a'),_0x85eb('0x195')));});};Dialer[_0x85eb('0x1a')][_0x85eb('0x9')]=function(_0x3d2d3d){var _0xda8a0e=this;var _0x5d2cd2=_0x3d2d3d['dialPredictiveOptimizationPercentage']/0x64;var _0x114e3a=_0x3d2d3d['outboundDropCallsDayTimeout']/(_0x3d2d3d['outboundDropCallsDayTimeout']+_0x3d2d3d[_0x85eb('0x54')]);var _0x129334=_0x3d2d3d[_0x85eb('0x133')]-_0x3d2d3d['predictiveIntervalPauses']-_0x3d2d3d[_0x85eb('0x4f')]-_0x3d2d3d[_0x85eb('0x69')]-_0x3d2d3d[_0x85eb('0x8b')];var _0x160ea8=(_0x3d2d3d[_0x85eb('0x133')]-_0x3d2d3d[_0x85eb('0x196')])*_0x3d2d3d['predictiveIntervalLowerLimit'];var _0x3ef8ab=Math[_0x85eb('0x197')](_0x3d2d3d['erlangCalls']*_0x3d2d3d['erlangAbandonmentRate']*_0x3d2d3d[_0x85eb('0x65')]*_0x3d2d3d[_0x85eb('0x67')]);if(_[_0x85eb('0x38')](_0x3d2d3d['startProgressive'])){loggerPredictive[_0x85eb('0x73')](_0x85eb('0x198'));if(!_[_0x85eb('0x38')](_0x3d2d3d['startPredictive'])){_0x3d2d3d['startPredictive']=undefined;loggerPredictive['error'](_0x85eb('0x199'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x85eb('0x38')](_0x3d2d3d[_0x85eb('0x7b')])){loggerPredictive[_0x85eb('0x7f')](_0x85eb('0x199'),_0x85eb('0x19a'));clearInterval(_0x3d2d3d[_0x85eb('0x7b')]);_0x3d2d3d[_0x85eb('0x7b')]=undefined;}_0x3d2d3d[_0x85eb('0x78')]=moment()['format'](_0x85eb('0xea'));loggerPredictive[_0x85eb('0x73')](_0x85eb('0x19b'),_0x3d2d3d[_0x85eb('0x78')],_0x3d2d3d['name']);this['handlePower'](_0x3d2d3d,0x1);}else if(ifInterval(_0x3d2d3d['dialPredictiveInterval'],_0x3d2d3d[_0x85eb('0x78')])){this[_0x85eb('0x12d')](_0x3d2d3d,0x1);loggerPredictiveCalls[_0x85eb('0x73')]('[startMethodPredictive][StartProgressive][Loop]',_0x3d2d3d[_0x85eb('0x78')],_0x3d2d3d[_0x85eb('0x3c')]);_0x3d2d3d['erlangCalls']=0x0;_0x3d2d3d['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x5d2cd2<_0x114e3a&&_0x3d2d3d['dialPredictiveOptimization']===_0x85eb('0x19c')){freeVariablesPredictive(_0x3d2d3d);loggerPredictive[_0x85eb('0x73')](_0x85eb('0x19d'),'Dropped\x20calls\x20day',_0x114e3a,_0x85eb('0x78'),_0x3d2d3d[_0x85eb('0x3c')]);}else if(_0x129334>_0x160ea8){freeVariablesPredictive(_0x3d2d3d);loggerPredictive[_0x85eb('0x73')]('[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]',_0x85eb('0x19e'),_0x129334,'agent\x20max\x20free\x20',_0x160ea8);}else if(_0x3ef8ab<_0x3d2d3d['predictiveIntervalErlangCallsDroppedCalls']&&_0x3d2d3d['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x3d2d3d);loggerPredictive[_0x85eb('0x73')](_0x85eb('0x19f'),_0x85eb('0x1a0'),_0x3ef8ab,'Drop\x20in\x20this\x20interval',_0x3d2d3d['predictiveIntervalErlangCallsDroppedCalls'],_0x85eb('0x78'),_0x3d2d3d[_0x85eb('0x3c')]);}else if(!ifInterval(_0x3d2d3d[_0x85eb('0x1a1')],_0x3d2d3d[_0x85eb('0x78')])&&_[_0x85eb('0x38')](_0x3d2d3d[_0x85eb('0x7a')])&&!_[_0x85eb('0x38')](_0x3d2d3d['startProgressive'])){_0x3d2d3d[_0x85eb('0x7a')]=moment()['format'](_0x85eb('0xea'));loggerPredictive[_0x85eb('0x73')](_0x85eb('0x1a2'),_0x3d2d3d[_0x85eb('0x7a')],_0x3d2d3d['name']);this['averageHandleTime'](_0x3d2d3d[_0x85eb('0x1a1')])[_0x85eb('0xa1')](this[_0x85eb('0x1a3')](_0x3d2d3d))[_0x85eb('0xa1')](mergeDataErlangB(_0x3d2d3d))['then'](this[_0x85eb('0x1a4')](_0x3d2d3d))[_0x85eb('0xa2')](loggerCatchPredictive(_0x85eb('0x1a5'),_0x3d2d3d));}else if(!ifInterval(_0x3d2d3d[_0x85eb('0x1a1')],_0x3d2d3d[_0x85eb('0x7a')])){_0x3d2d3d['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x3d2d3d[_0x85eb('0x7a')]=moment()[_0x85eb('0x70')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x85eb('0x73')]('[startMethodPredictive][StartPredictive][Repeat]',_0x3d2d3d[_0x85eb('0x7a')],_0x3d2d3d[_0x85eb('0x3c')]);clearInterval(_0x3d2d3d[_0x85eb('0x7b')]);_0x3d2d3d[_0x85eb('0x7b')]=undefined;this[_0x85eb('0x1a6')](_0x3d2d3d[_0x85eb('0x1a1')])['then'](this[_0x85eb('0x1a3')](_0x3d2d3d))[_0x85eb('0xa1')](mergeDataErlangB(_0x3d2d3d))[_0x85eb('0xa1')](this[_0x85eb('0x1a4')](_0x3d2d3d))[_0x85eb('0xa2')](loggerCatchPredictive(_0x85eb('0x1a5'),_0x3d2d3d));}};Dialer[_0x85eb('0x1a')]['getDataPredictive']=function(_0xaea736){var _0x4f9280=this;return function(_0x3a77f9){return new BPromise(function(_0x4ee3c4,_0x352158){_[_0x85eb('0xb8')](_0xaea736,_0x3a77f9[0x0]);if(checkGetDataPredictive(_0x3a77f9[0x0])){loggerPredictive[_0x85eb('0x73')](JSON[_0x85eb('0x44')](_0x3a77f9[0x0]));if(_0xaea736[_0x85eb('0x1a7')]===_0x85eb('0x19c')){return _0x4f9280[_0x85eb('0xaf')](_0xaea736['id'])[_0x85eb('0xa1')](function(_0x434c3f){var _0x3b54db=_0xaea736['loggedIn']-_0x434c3f[0x0][_0x85eb('0x1a8')];var _0x508ff3=_0xaea736[_0x85eb('0x1a1')]*0x3c;var _0xeb825f=_0x3a77f9[0x0]['predictiveIntervalAvgTalktime']+_0x3a77f9[0x0][_0x85eb('0x60')];var _0x4026ef=(_0x3a77f9[0x0]['predictiveIntervalAnsweredCalls']+_0x3a77f9[0x0][_0x85eb('0x62')]+_0x3a77f9[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3a77f9[0x0]['predictiveIntervalTotalCalls'];var _0x433b9f=_0xaea736[_0x85eb('0x1a9')]/0x64;_0xaea736[_0x85eb('0x196')]=_0x434c3f[0x0][_0x85eb('0x1a8')]||0x0;_0xaea736[_0x85eb('0x65')]=_0x4026ef>0x0?_0x4026ef:0x1;return _0x4f9280[_0x85eb('0x1aa')](_0x3b54db,_0x508ff3,_0xeb825f,_0x4026ef,_0x433b9f);})[_0x85eb('0xa1')](function(_0x1a24bf){return _0x4ee3c4(_0x1a24bf);})[_0x85eb('0xa2')](function(_0x27847d){return _0x352158(msgResponse(_0x85eb('0x1ab'),_0x85eb('0x11a'),JSON['stringify'](_0x27847d)));});}if(_0xaea736[_0x85eb('0x1a7')]===_0x85eb('0x1ac')){return _0x4f9280[_0x85eb('0xaf')](_0xaea736['id'])[_0x85eb('0xa1')](function(_0x28e181){var _0x3541da=_0xaea736[_0x85eb('0x133')]-_0x28e181[0x0]['outboundQueuePauses'];var _0x19d38f=_0xaea736[_0x85eb('0x1a1')]*0x3c;var _0x4ee93b=_0x3a77f9[0x0][_0x85eb('0x61')]+_0x3a77f9[0x0][_0x85eb('0x60')];var _0xcd5ff1=(_0x3a77f9[0x0][_0x85eb('0x1ad')]+_0x3a77f9[0x0][_0x85eb('0x62')]+_0x3a77f9[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3a77f9[0x0][_0x85eb('0x68')];var _0x3e27d4=_0xaea736[_0x85eb('0x1a9')]/0x64;_0xaea736['predictiveIntervalPauses']=_0x28e181[0x0]['outboundQueuePauses']||0x0;_0xaea736['predictiveIntervalHitRate']=_0xcd5ff1>0x0?_0xcd5ff1:0x1;return _0x4f9280['busyFactor'](_0x3541da,_0x19d38f,_0x4ee93b,_0xcd5ff1,_0x3e27d4);})[_0x85eb('0xa1')](function(_0x49d352){return _0x4ee3c4(_0x49d352);})[_0x85eb('0xa2')](function(_0xffa5c9){return _0x352158(msgResponse('[CatchErlangB]',_0x85eb('0x11a'),JSON[_0x85eb('0x44')](_0xffa5c9)));});}}else{return _0x352158(msgResponse(_0x85eb('0x1ae'),'Failure',_0x85eb('0x1af')));}});};};Dialer[_0x85eb('0x1a')][_0x85eb('0x1a4')]=function(_0x1a10f5){var _0x56ffb1=this;return function(){var _0x41f924=0x0;var _0x290228=Math[_0x85eb('0x197')](_0x1a10f5['erlangCallToSecond']*0x3e8);if(_0x290228>0x0){_0x290228=_0x290228<0x64?0x64:_0x290228;loggerPredictive['info'](_0x85eb('0x1b0'),_0x290228);_0x1a10f5[_0x85eb('0x7b')]=setInterval(function(){_0x56ffb1[_0x85eb('0x7b')](_0x1a10f5);loggerPredictiveCalls[_0x85eb('0x73')](_0x85eb('0x1b1'),_0x41f924+=0x1);},_0x290228);}else{loggerPredictive[_0x85eb('0x73')](_0x85eb('0x1b2'),_0x85eb('0x1b3'),_0x290228);}};};Dialer[_0x85eb('0x1a')][_0x85eb('0x1b4')]=function(_0x395345,_0x2cef07){var _0x14d956=this;return function(_0x3cf732){if(_[_0x85eb('0x72')](_0x3cf732)){if(_[_0x85eb('0xc9')](_0x2cef07[_0x85eb('0xbb')])||!_0x2cef07['recallme']){if(_0x395345[_0x85eb('0x50')]===_0x85eb('0x8')){_0x395345[_0x85eb('0xff')]=_[_0x85eb('0x38')](_0x395345[_0x85eb('0xff')])?!![]:_0x395345['queueStatusComplete'];var _0x25408a=uuid['v4']();_0x14d956['actions'][_0x25408a]=new Action(_0x395345,_0x2cef07,_0x25408a);loggerBooked[_0x85eb('0x73')](_0x85eb('0x1b5'),_0x25408a,_0x85eb('0x1b6'),JSON[_0x85eb('0x44')](_0x395345[_0x85eb('0xff')]),_0x85eb('0x1b7'),_0x395345[_0x85eb('0x3c')]);if(_0x395345[_0x85eb('0xff')]){_0x395345['queueStatusComplete']=![];_0x14d956[_0x85eb('0x27')][_0x14d956[_0x85eb('0x24')][_0x25408a][_0x85eb('0x9e')]]=[];ami[_0x85eb('0x98')]({'actionid':_0x25408a,'action':_0x85eb('0x1b8'),'queue':_0x395345[_0x85eb('0x3c')]})[_0x85eb('0xa2')](function(_0x570d9e){_0x14d956[_0x85eb('0x9b')](_0x395345);_0x14d956[_0x85eb('0xaa')]({'active':![],'ContactId':_0x14d956['actions'][_0x25408a]['ContactId'],'ListId':_0x14d956[_0x85eb('0x24')][_0x25408a][_0x85eb('0xba')],'VoiceQueueId':_0x14d956[_0x85eb('0x24')][_0x25408a][_0x85eb('0xbc')]||undefined,'CampaignId':_0x14d956[_0x85eb('0x24')][_0x25408a]['CampaignId']||undefined})[_0x85eb('0xa2')](loggerCatch(_0x85eb('0x1b9')));delete _0x14d956['actions'][_0x25408a];});}else{loggerBooked[_0x85eb('0x73')](_0x85eb('0x1ba'),JSON[_0x85eb('0x44')](_0x395345[_0x85eb('0xff')]),'Queue:\x20',_0x395345[_0x85eb('0x3c')]);_0x14d956[_0x85eb('0x9b')](_0x395345);_0x14d956['rescheduleContact']({'active':![],'ContactId':_0x14d956[_0x85eb('0x24')][_0x25408a][_0x85eb('0x107')],'ListId':_0x14d956['actions'][_0x25408a][_0x85eb('0xba')],'VoiceQueueId':_0x14d956['actions'][_0x25408a][_0x85eb('0xbc')]||undefined,'CampaignId':_0x14d956[_0x85eb('0x24')][_0x25408a][_0x85eb('0xbd')]||undefined})[_0x85eb('0xa2')](loggerCatch(_0x85eb('0x1b9')));delete _0x14d956[_0x85eb('0x24')][_0x25408a];}}else{return _0x14d956[_0x85eb('0x13d')](_0x395345,_0x2cef07);}}else{if(getDiff(_0x2cef07[_0x85eb('0x1bb')])<_0x395345[_0x85eb('0x1bc')]*0x3c){_0x14d956[_0x85eb('0x1e')]['run'](_0x2cef07['id'])[_0x85eb('0x106')](function(){_0x14d956[_0x85eb('0x9b')](_0x395345);});}else{_0x395345[_0x85eb('0x5d')]+=0x1;_0x14d956['updateOriginated'](_0x395345);if(_0x395345[_0x85eb('0x1bd')]){_0x14d956['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2cef07[_0x85eb('0x107')],'ListId':_0x2cef07[_0x85eb('0xba')],'VoiceQueueId':_0x2cef07[_0x85eb('0xbc')]||undefined,'CampaignId':_0x2cef07[_0x85eb('0xbd')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x14d956[_0x85eb('0xb2')](createObjHistory(_0x395345,_0x2cef07,_0x85eb('0x1be'),0x17,_0x85eb('0x1bf')))[_0x85eb('0xa2')](loggerCatch(_0x85eb('0x1c0')));}else{_0x14d956[_0x85eb('0xc7')](createObjHistory(_0x395345,_0x2cef07,'RECALLFAILEDTIMEOUT',0x16,_0x85eb('0x1c1')),_0x85eb('0x1c2'),'[Originate][HistoryRecallClose]');}}}}else{_0x395345[_0x85eb('0x55')]+=0x1;_0x14d956[_0x85eb('0xc7')](createObjHistory(_0x395345,_0x2cef07,_0x85eb('0x1c3'),0xd,_0x85eb('0x1c4')),_0x85eb('0x1c5'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x85eb('0x1a')][_0x85eb('0x131')]=function(_0x1c9fb3){var _0x3a9f54=this;var _0x59c0ab=[];var _0x216b1e=_0x1c9fb3['limitCalls']-_0x1c9fb3['originated']-_0x1c9fb3['temp'];emitCampaignSummary(_0x1c9fb3);if(_0x216b1e>0x0){if(_0x216b1e>this['maxNumberOriginate']){_0x216b1e=this[_0x85eb('0x22')];}_0x1c9fb3[_0x85eb('0x1c6')]+=_0x216b1e;this[_0x85eb('0xae')](_0x1c9fb3['id'],_0x216b1e,_0x1c9fb3['dialOrderByScheduledAt'])[_0x85eb('0xa1')](function(_0x10c7ab){_0x1c9fb3[_0x85eb('0x1c6')]-=_0x216b1e;_0x1c9fb3['temp']=_0x1c9fb3[_0x85eb('0x1c6')]>0x0?_0x1c9fb3[_0x85eb('0x1c6')]:0x0;if(!checkContactEmpty(_0x10c7ab)){_0x1c9fb3[_0x85eb('0x39')]=_0x85eb('0x88');logger[_0x85eb('0x73')]('[getContactCampaign2][Empty]'+_0x1c9fb3[_0x85eb('0x3c')]);}else{_0x1c9fb3[_0x85eb('0x69')]+=_0x10c7ab[_0x85eb('0x81')];_0x1c9fb3[_0x85eb('0x39')]=_0x85eb('0x1c7');for(var _0x1e2a22=0x0;_0x1e2a22<_0x10c7ab['length'];_0x1e2a22+=0x1){_0x1c9fb3[_0x85eb('0x1c8')]+=0x1;if(_[_0x85eb('0xc9')](_0x10c7ab[_0x1e2a22])||_[_0x85eb('0xc9')](_0x10c7ab[_0x1e2a22]['Contact'])||_['isNil'](_0x10c7ab[_0x1e2a22][_0x85eb('0x141')][_0x85eb('0x142')])){_0x3a9f54[_0x85eb('0xb6')]('[actionOriginate]\x20',_0x1c9fb3,_0x10c7ab[_0x1e2a22]);}else{_0x3a9f54['checkIsBlackListIvr'](_['pick'](_0x10c7ab[_0x1e2a22],[_0x85eb('0xbd'),'Contact.phone']))[_0x85eb('0xa1')](_0x3a9f54[_0x85eb('0x1b4')](_0x1c9fb3,_0x10c7ab[_0x1e2a22]))[_0x85eb('0xa2')](_0x3a9f54[_0x85eb('0xb5')](_0x85eb('0x1c9'),_0x1c9fb3));}}}})[_0x85eb('0xa2')](loggerGetContactDialer(_0x85eb('0x1ca'),_0x1c9fb3,_0x216b1e));}};Dialer[_0x85eb('0x1a')][_0x85eb('0x12d')]=function(_0x269254,_0x41890f){var _0x42e696=this;var _0x11c6e3=[];var _0x1fc00d=_0x41890f>=0x1?_0x41890f:0x1;var _0x2d7491=[];if(_0x269254[_0x85eb('0x50')]==='booked'){_0x1fc00d=0x1;}var _0x1ebb43=Math[_0x85eb('0x197')](_0x269254['available']*_0x1fc00d)-_0x269254['originated']-_0x269254[_0x85eb('0x1c6')];emitVoiceQueueSummary(_0x269254);if(_0x269254[_0x85eb('0x1cb')]>0x0){var _0x4a4c1d=_0x269254[_0x85eb('0x1cb')]-_0x269254[_0x85eb('0x69')]-_0x269254[_0x85eb('0x8b')]-_0x269254[_0x85eb('0x1c6')]-_0x269254[_0x85eb('0x4a')];if(_0x1ebb43>_0x4a4c1d){_0x1ebb43=_0x4a4c1d;}}if(_0x1ebb43>0x0){if(_0x269254['dialMethod']===_0x85eb('0x8')){_0x1ebb43=0x1;}if(_0x1ebb43>this[_0x85eb('0x22')]){_0x1ebb43=this[_0x85eb('0x22')];}_0x269254['temp']+=_0x1ebb43;for(var _0x24f235 in this['agents']){if(this[_0x85eb('0x20')]['hasOwnProperty'](_0x24f235)){if(this[_0x85eb('0x20')][_0x24f235][_0x85eb('0x90')]===_0x85eb('0x1cc')&&this[_0x85eb('0x20')][_0x24f235]['status']===_0x85eb('0xc4')){_0x11c6e3['push'](this[_0x85eb('0x20')][_0x24f235]['id']);}}}this[_0x85eb('0xac')](_0x269254['id'],_0x11c6e3,_0x1ebb43,_0x269254['dialOrderByScheduledAt'])['then'](function(_0x4298ef){_0x269254[_0x85eb('0x1c6')]-=_0x1ebb43;_0x269254[_0x85eb('0x1c6')]=_0x269254[_0x85eb('0x1c6')]>0x0?_0x269254['temp']:0x0;if(!checkContactEmpty(_0x4298ef)){_0x42e696[_0x85eb('0xa0')](_0x269254)[_0x85eb('0xa1')](sendMessageReschedule(_0x269254))[_0x85eb('0xa2')](loggerCatch(_0x85eb('0xa3')));}else{_0x269254[_0x85eb('0x69')]+=_0x4298ef[_0x85eb('0x81')];_0x269254[_0x85eb('0x39')]=_0x269254['dialMethod']===_0x85eb('0x8')?_0x85eb('0x148'):_0x85eb('0x1c7');for(var _0x4b1244=0x0;_0x4b1244<_0x4298ef[_0x85eb('0x81')];_0x4b1244+=0x1){if(_[_0x85eb('0xc9')](_0x4298ef[_0x4b1244])||_['isNil'](_0x4298ef[_0x4b1244][_0x85eb('0x141')])||_[_0x85eb('0xc9')](_0x4298ef[_0x4b1244][_0x85eb('0x141')][_0x85eb('0x142')])){_0x42e696[_0x85eb('0xb6')]('[actionOriginate]\x20',_0x269254,_0x4298ef[_0x4b1244]);}else{_0x42e696[_0x85eb('0xa4')](_[_0x85eb('0xb9')](_0x4298ef[_0x4b1244],[_0x85eb('0xbc'),_0x85eb('0x1cd')]))[_0x85eb('0xa1')](_0x42e696[_0x85eb('0x1b4')](_0x269254,_0x4298ef[_0x4b1244]))[_0x85eb('0xa2')](_0x42e696[_0x85eb('0xb5')](_0x85eb('0x1ce'),_0x269254));}}}})[_0x85eb('0xa2')](loggerGetContactDialer(_0x85eb('0x1cf'),_0x269254,_0x1ebb43));}};Dialer[_0x85eb('0x1a')][_0x85eb('0x7b')]=function(_0x15ef64){var _0x2e843e=this;if(_0x15ef64[_0x85eb('0x1cb')]>0x0){var _0x27fd86=_0x15ef64[_0x85eb('0x1cb')]-_0x15ef64[_0x85eb('0x69')]-_0x15ef64[_0x85eb('0x8b')];if(_0x27fd86>0x0){this['tryOriginatePredictive'](_0x15ef64);}else{loggerPredictiveCalls[_0x85eb('0x73')](_0x85eb('0x1d0'));}}else{this['tryOriginatePredictive'](_0x15ef64);}};Dialer['prototype'][_0x85eb('0x1d1')]=function(_0x4708b3){var _0xb63a5a=this;var _0x943119=[];_0x4708b3[_0x85eb('0x69')]+=0x1;for(var _0x32771 in this[_0x85eb('0x20')]){if(this['agents'][_0x85eb('0x97')](_0x32771)){if(this[_0x85eb('0x20')][_0x32771][_0x85eb('0x90')]==='not_inuse'&&this[_0x85eb('0x20')][_0x32771][_0x85eb('0xc3')]===_0x85eb('0xc4')){_0x943119[_0x85eb('0xfe')](this['agents'][_0x32771]['id']);}}}this['getContactDialer'](_0x4708b3['id'],_0x943119,0x1,_0x4708b3[_0x85eb('0x1d2')])[_0x85eb('0xa1')](function(_0x5a0736){if(!checkContactEmpty(_0x5a0736)){checkContactLowerLimitOriginate(_0x4708b3,0x1,0x0);_0xb63a5a[_0x85eb('0xa0')](_0x4708b3)[_0x85eb('0xa1')](sendMessageReschedule(_0x4708b3))[_0x85eb('0xa2')](loggerCatch('[countReScheduled]\x20'));}else{_0x4708b3['message']=_0x85eb('0x1c7');if(_[_0x85eb('0xc9')](_0x5a0736[0x0])||_[_0x85eb('0xc9')](_0x5a0736[0x0][_0x85eb('0x141')])||_[_0x85eb('0xc9')](_0x5a0736[0x0][_0x85eb('0x141')][_0x85eb('0x142')])){_0xb63a5a['emptyContact'](_0x85eb('0x1ce'),_0x4708b3,_0x5a0736[0x0]);}else{_0xb63a5a[_0x85eb('0xa4')](_[_0x85eb('0xb9')](_0x5a0736[0x0],['VoiceQueueId',_0x85eb('0x1cd')]))['then'](_0xb63a5a[_0x85eb('0x1b4')](_0x4708b3,_0x5a0736[0x0]))[_0x85eb('0xa2')](_0xb63a5a[_0x85eb('0xb5')](_0x85eb('0x1d3'),_0x4708b3));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x4708b3,0x1));emitVoiceQueueSummary(_0x4708b3);};Dialer[_0x85eb('0x1a')][_0x85eb('0x1aa')]=function(_0x1de1a9,_0x4306d2,_0xa5a32a,_0x4f6057,_0x981088,_0xa2ee86){loggerPredictive[_0x85eb('0x73')](_0x85eb('0x1d4'),_0x85eb('0x1d5'),_0x1de1a9,_0x85eb('0x1d6'),_0x4306d2,'\x20Ts\x20=\x20',_0xa5a32a,_0x85eb('0x1d7'),_0x4f6057,_0x85eb('0x1d8'),_0x981088);return new BPromise(function(_0x109643,_0x2c9f7a){if(_0x1de1a9<=0x0||isNaN(_0x1de1a9)){return _0x2c9f7a(msgResponse('[abandonmentRate]',_0x85eb('0x43'),_0x85eb('0x1d9')+_0x1de1a9));}if(_0xa5a32a<=0x0||isNaN(_0xa5a32a)){return _0x2c9f7a(msgResponse('[abandonmentRate]',_0x85eb('0x43'),_0x85eb('0x1da')+_0xa5a32a));}if(_0x4f6057<=0x0||isNaN(_0x4f6057)){return _0x2c9f7a(msgResponse(_0x85eb('0x1d4'),'Error',_0x85eb('0x1db')+_0x4f6057));}if(_0x4306d2<=0x0||isNaN(_0x4306d2)){return _0x2c9f7a(msgResponse(_0x85eb('0x1d4'),_0x85eb('0x43'),'interval\x20=\x20'+_0x4306d2));}if(_0x981088<=0x0||isNaN(_0x981088)){return _0x2c9f7a(msgResponse(_0x85eb('0x1d4'),_0x85eb('0x43'),_0x85eb('0x1dc')+_0x981088));}_0xa2ee86=_0xa2ee86||0x0;var _0x22099b=0x1/_0xa5a32a;var _0x12840b=0x0;var _0x17da85=0x0;var _0x9b87b8=0x0;var _0x30cc4b=0x0;for(var _0x51d5af=0x0;_0x9b87b8<_0x981088;_0x51d5af+=0x1){_0x17da85=_0x51d5af/_0x4306d2;_0x12840b=(_0x4f6057*_0x17da85+_0xa2ee86)/_0x22099b;_0x9b87b8=erlangb(_0x12840b,_0x1de1a9);_0x30cc4b=_0x12840b/_0x1de1a9*(0x1-erlangb(_0x12840b,_0x1de1a9));}return _0x109643({'erlangCalls':_0x51d5af,'erlangCallToSecond':_0x4306d2/_0x51d5af,'erlangAbandonmentRate':_0x9b87b8,'erlangBusyFactor':_0x30cc4b});});};Dialer[_0x85eb('0x1a')][_0x85eb('0x1dd')]=function(_0x1831d2,_0x195d7f,_0x5b9af2,_0x59a7c6,_0x9601aa,_0x2bc664){loggerPredictive['info']('[busyFactor]',_0x85eb('0x1d5'),_0x1831d2,_0x85eb('0x1d6'),_0x195d7f,'\x20Ts\x20=\x20',_0x5b9af2,_0x85eb('0x1d7'),_0x59a7c6,_0x85eb('0x1de'),_0x9601aa);return new BPromise(function(_0x35511b,_0x5ed966){if(_0x1831d2<=0x0||isNaN(_0x1831d2)){return _0x5ed966(msgResponse(_0x85eb('0x1d4'),'Error',_0x85eb('0x1d9')+_0x1831d2));}if(_0x5b9af2<=0x0||isNaN(_0x5b9af2)){return _0x5ed966(msgResponse(_0x85eb('0x1d4'),'Error',_0x85eb('0x1da')+_0x5b9af2));}if(_0x59a7c6<=0x0||isNaN(_0x59a7c6)){return _0x5ed966(msgResponse(_0x85eb('0x1d4'),_0x85eb('0x43'),'p\x20=\x20'+_0x59a7c6));}if(_0x195d7f<=0x0||isNaN(_0x195d7f)){return _0x5ed966(msgResponse(_0x85eb('0x1d4'),_0x85eb('0x43'),'interval\x20=\x20'+_0x195d7f));}if(_0x9601aa<=0x0||isNaN(_0x9601aa)){return _0x5ed966(msgResponse('[abandonmentRate]',_0x85eb('0x43'),_0x85eb('0x1dc')+_0x9601aa));}_0x2bc664=_0x2bc664||0x0;var _0x5d809e=0x1/_0x5b9af2;var _0x19146b=0x0;var _0x40ee93=0x0;var _0x49c286=0x0;var _0x123eae=0x0;for(var _0x1bd96c=0x0;_0x123eae<_0x9601aa;_0x1bd96c+=0x1){_0x40ee93=_0x1bd96c/_0x195d7f;_0x19146b=(_0x59a7c6*_0x40ee93+_0x2bc664)/_0x5d809e;_0x49c286=erlangb(_0x19146b,_0x1831d2);_0x123eae=_0x19146b/_0x1831d2*(0x1-erlangb(_0x19146b,_0x1831d2));}return _0x35511b({'erlangCalls':_0x1bd96c,'erlangCallToSecond':_0x195d7f/_0x1bd96c,'erlangAbandonmentRate':_0x49c286,'erlangBusyFactor':_0x123eae});});};module[_0x85eb('0x1df')]=Dialer; \ No newline at end of file +var _0x3423=['sumDuration','talking','total','unmanaged','abandoned','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalLowerLimit','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','[checkGetDataPredictive][avgTalktime]','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][objIsEmpty]','[checkGetDataPredictive][obj]','[ErlangB]','merge','[freeVariablesPredictive]','startPredictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','pTalking','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','statedesc','endtime','clearZombieChannels','sequence','Action','status','channel','catch','No\x20such\x20channel','type','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','then','checkIsBlackList','resolve','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','isSuccess','Success','SIP/%s','reachable','unmonitored','isNil','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','uniqueid','state','HangupInAMD','membername','[syncHangupInAMD]','Machine','amd','[syncMachine][createHistory]','[syncMachine]','AMD','[syncHangupInAMDIvr][createHistory]','dialAMDActive','MACHINE','[syncMachineIvr][createHistory]','[syncMachineIvr]','[syncHangupIvr]','AnswerAGI','dialQueueProject','cause-txt','Unknow','[syncHangupIvr][createHistory]','agent','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','agiafterat','Abandoned','CALLEREXIT','actionid','locked','paused','stateinterface','queueBooked','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','Failure','isArray','push','command','interval','indexOf','true','iftime\x20%s,%s','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdNumber','TrunkBackup','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','starttime','[originate][error]','Error','originate\x20action\x20Error','responsetime','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','countnoanswerretry','dialNoAnswerRetryFrequency','minutes','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','add','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','countglobal','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','reason\x205\x20busy','stateGlobal','Congestion','reason\x208\x20congestion','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','floor','erlangAbandonmentRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','[startMethodPredictive][StartPredictive][First]','getDataPredictive','startMethodPredictive','[averageHandleTime][ErlangB]\x20','outboundQueuePauses','predictiveIntervalAnsweredCalls','agentBusyFactor','predictiveIntervalHitRate','busyFactor','[CatchErlangB]','[getDataPredictive]','check\x20failure','erlangCallToSecond','[startMethodPredictive]','[handlePredictive]','Failure\x20','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[countReScheduled]\x20','Contact.phone','tryOriginatePredictive','not_inuse','loggerHandler','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','[abandonmentRate]','\x20interval\x20=\x20','\x20p\x20=\x20','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','\x20Ts\x20=\x20','\x20Umin\x20=\x20','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','syncHangup','newexten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','[ifTime][Action]','stringify','milliseconds','seconds','outbound','strategy','answered','available','loggedIn','sumBillable'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x3342('0x0'));var uuid=require(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var rr=require('rr');var md5=require(_0x3342('0x3'));var Redis=require(_0x3342('0x4'));var config=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var loggerBooked=require(_0x3342('0x6'))(_0x3342('0x8'));var loggerPredictive=require(_0x3342('0x6'))(_0x3342('0x9'));var loggerPredictiveCalls=require(_0x3342('0x6'))(_0x3342('0xa'));var loggerSyncQueueSummary=require(_0x3342('0x6'))(_0x3342('0xb'));var ami=require(_0x3342('0xc'));config[_0x3342('0xd')]=_[_0x3342('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3342('0xf'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x3342('0x10'));var voiceQueueRt=require(_0x3342('0x11'));var Action=require('./action');var History=require(_0x3342('0x12'));var Final=require('./final');var AgentComplete=require(_0x3342('0x13'));var QueueCallerAbandon=require(_0x3342('0x14'));var Hangup=require('./hangup');var ipAgi=process[_0x3342('0x15')][_0x3342('0x16')]||_0x3342('0x17');var strategy={'rrmemory':_0x3342('0x18'),'roundrobin':_0x3342('0x19')};var Sequence=function(){};Sequence[_0x3342('0x1a')][_0x3342('0x1b')]=function(_0x59be1d){this[_0x3342('0x1c')]=this[_0x3342('0x1c')]?this['tail'][_0x3342('0x1d')](_0x59be1d):_0x59be1d();};function Dialer(_0x2c9df0,_0x51ef91){this['sequence']=new Sequence();this[_0x3342('0x1e')]=_0x51ef91;this[_0x3342('0x1f')]=_0x2c9df0[_0x3342('0x1f')];this[_0x3342('0x20')]=_0x2c9df0[_0x3342('0x20')];this[_0x3342('0x21')]=_0x2c9df0[_0x3342('0x21')];this[_0x3342('0x22')]=_0x2c9df0[_0x3342('0x22')];this['maxNumberOriginate']=config[_0x3342('0x23')]||0x2;this[_0x3342('0x24')]={};this[_0x3342('0x25')]={};this['contactsId']={};this[_0x3342('0x26')]={};this[_0x3342('0x27')]={};this['startPredictive']={};this[_0x3342('0x28')]={};this[_0x3342('0x29')]={};this['queueBooked']={};this[_0x3342('0x2a')]={};ami['on']('agentconnect',this[_0x3342('0x2b')][_0x3342('0x2c')](this));ami['on'](_0x3342('0x2d'),this[_0x3342('0x2e')][_0x3342('0x2c')](this));ami['on'](_0x3342('0x2f'),this[_0x3342('0x30')][_0x3342('0x2c')](this));ami['on']('agentcomplete',this[_0x3342('0x31')]['bind'](this));ami['on']('custom:queuesummary',this[_0x3342('0xb')]['bind'](this));ami['on']('hangup',this[_0x3342('0x32')]['bind'](this));ami['on'](_0x3342('0x33'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0x3342('0x34')][_0x3342('0x2c')](this));ami['on'](_0x3342('0x35'),this['syncQueueMember'][_0x3342('0x2c')](this));ami['on'](_0x3342('0x36'),this[_0x3342('0x37')][_0x3342('0x2c')](this));this['loopCampaigns']();this[_0x3342('0x38')]();}function isNotNull(_0x3d6810){return _0x3d6810!==null&&!_[_0x3342('0x39')](_0x3d6810);}function checkIsLoggedIn(_0x301114,_0xf82530){return function(){if(_0xf82530<=0x0){_0x301114[_0x3342('0x3a')]=_0x3342('0x3b');throw _0x301114['name']+_0x3342('0x3c');}};}function isActive(_0x4dafa3){return _0x4dafa3;}function checkIsActive(_0x9c9def,_0x407f8c){return function(){if(!isActive(_0x407f8c)){_0x9c9def['message']=_0x3342('0x3d');throw _0x9c9def[_0x3342('0x3e')]+_0x3342('0x3f');}};}function checkInterval(_0x4e7410){return function(){if(!isNotNull(_0x4e7410['Interval'])){_0x4e7410[_0x3342('0x3a')]=_0x3342('0x40');throw _0x4e7410[_0x3342('0x3e')]+_0x3342('0x41');}if(!isNotNull(_0x4e7410[_0x3342('0x42')][_0x3342('0x43')])){_0x4e7410[_0x3342('0x3a')]=_0x3342('0x40');throw _0x4e7410[_0x3342('0x3e')]+_0x3342('0x41');}if(!isNotNull(_[_0x3342('0x44')](_0x4e7410[_0x3342('0x42')]['Intervals']))){_0x4e7410['message']=_0x3342('0x40');throw _0x4e7410['name']+_0x3342('0x41');}};}function msgResponse(_0x464650,_0x1a74d3,_0x361d23){return{'action':_0x464650,'response':_0x1a74d3,'message':_0x361d23};}function myreject(_0x2dbc02){return function(_0xd0256d){return _0x2dbc02(msgResponse(_0x3342('0x45'),'Error',JSON[_0x3342('0x46')](_0xd0256d)));};}function getSeconds(_0x2db4ac,_0x23dbe8){var _0x155493=moment(_0x2db4ac)[_0x3342('0x47')](0x0);var _0x5bd5eb=moment(_0x23dbe8)[_0x3342('0x47')](0x0);return _0x155493['diff'](_0x5bd5eb,_0x3342('0x48'));}function emit(_0x2b9923,_0x2eb484,_0x2e57a0){io['to'](_0x2b9923)['emit'](_0x2eb484,_0x2e57a0);}function emitVoiceQueueSummary(_0x370cfa){if(_0x370cfa['type']===_0x3342('0x49')){var _0x128657={'id':_0x370cfa['id'],'name':_0x370cfa[_0x3342('0x3e')],'strategy':_0x370cfa[_0x3342('0x4a')],'answered':_0x370cfa[_0x3342('0x4b')],'available':_0x370cfa[_0x3342('0x4c')],'loggedIn':_0x370cfa[_0x3342('0x4d')],'pTalking':_0x370cfa['pTalking'],'sumBillable':_0x370cfa[_0x3342('0x4e')],'sumDuration':_0x370cfa[_0x3342('0x4f')],'sumHoldTime':_0x370cfa['sumHoldTime']||0x0,'talking':_0x370cfa[_0x3342('0x50')],'total':_0x370cfa[_0x3342('0x51')],'type':_0x370cfa['type'],'unmanaged':_0x370cfa[_0x3342('0x52')],'abandoned':_0x370cfa[_0x3342('0x53')],'waiting':_0x370cfa['waiting'],'loggedInDb':_0x370cfa['loggedInDb'],'dialActive':_0x370cfa['dialActive'],'dialMethod':_0x370cfa[_0x3342('0x54')],'dialOriginateCallerIdName':_0x370cfa[_0x3342('0x55')],'dialOriginateCallerIdNumber':_0x370cfa['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x370cfa[_0x3342('0x56')],'dialPrefix':_0x370cfa[_0x3342('0x57')],'outboundAnswerAgiCallsDay':_0x370cfa[_0x3342('0x58')],'outboundAnswerCallsDay':_0x370cfa[_0x3342('0x59')],'outboundBlacklistCallsDay':_0x370cfa[_0x3342('0x5a')],'outboundBusyCallsDay':_0x370cfa[_0x3342('0x5b')],'outboundCongestionCallsDay':_0x370cfa[_0x3342('0x5c')],'outboundDropCallsDayACS':_0x370cfa[_0x3342('0x5d')],'outboundDropCallsDayCallersExit':_0x370cfa['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x370cfa['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x370cfa[_0x3342('0x5e')],'outboundNoSuchCallsDay':_0x370cfa[_0x3342('0x5f')],'outboundOriginateFailureCallsDay':_0x370cfa[_0x3342('0x60')],'outboundReCallsDay':_0x370cfa[_0x3342('0x61')],'outboundRejectCallsDay':_0x370cfa[_0x3342('0x62')],'outboundUnknownCallsDay':_0x370cfa[_0x3342('0x63')],'predictiveIntervalAnsweredCalls':_0x370cfa['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x370cfa[_0x3342('0x64')],'predictiveIntervalAvgTalktime':_0x370cfa[_0x3342('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x370cfa[_0x3342('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x370cfa[_0x3342('0x67')],'predictiveIntervalErlangCalls':_0x370cfa[_0x3342('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x370cfa[_0x3342('0x69')],'predictiveIntervalHitRate':_0x370cfa['predictiveIntervalHitRate'],'predictiveIntervalLowerLimit':_0x370cfa[_0x3342('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x370cfa['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x370cfa[_0x3342('0x6b')],'predictiveIntervalTotalCalls':_0x370cfa[_0x3342('0x6c')],'message':_0x370cfa[_0x3342('0x3a')],'originated':_0x370cfa[_0x3342('0x6d')]};if(_0x370cfa['Trunk']){_0x128657[_0x3342('0x6e')]={'id':_0x370cfa[_0x3342('0x6e')]['id'],'name':_0x370cfa['Trunk'][_0x3342('0x3e')],'active':_0x370cfa[_0x3342('0x6e')][_0x3342('0x6f')],'callerid':_0x370cfa[_0x3342('0x6e')]['callerid']};}if(_0x370cfa[_0x3342('0x42')]){_0x128657[_0x3342('0x42')]={'id':_0x370cfa['Interval']['id'],'name':_0x370cfa[_0x3342('0x42')]['name']};}var _0x5683e0=md5(JSON[_0x3342('0x46')](_0x128657));if(_0x370cfa[_0x3342('0x3')]!==_0x5683e0){_0x370cfa[_0x3342('0x3')]=_0x5683e0;emit(util[_0x3342('0x70')](_0x3342('0x71'),_0x128657[_0x3342('0x3e')]),_0x3342('0x72'),_0x128657);}}}function emitCampaignSummary(_0x4f2c1a){if(_0x4f2c1a['type']===_0x3342('0x73')){emit(util['format'](_0x3342('0x74'),_0x4f2c1a['name']),'campaign:save',_0x4f2c1a);}}function checkGetDataPredictive(_0x494d60){if(isNotNull(_0x494d60)){if(!_[_0x3342('0x44')](_0x494d60)){if(_0x494d60[_0x3342('0x6c')]>0x0){if(!_[_0x3342('0x39')](_0x494d60[_0x3342('0x65')])&&_0x494d60['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x3342('0x75')](_0x3342('0x76'),JSON['stringify'](_0x494d60));}if(!_[_0x3342('0x39')](_0x494d60[_0x3342('0x64')])&&_0x494d60[_0x3342('0x64')]>0x0){return!![];}else{loggerPredictive['info'](_0x3342('0x77'),JSON[_0x3342('0x46')](_0x494d60));}}else{loggerPredictive[_0x3342('0x75')](_0x3342('0x78'),JSON[_0x3342('0x46')](_0x494d60));}}else{loggerPredictive['info'](_0x3342('0x79'),JSON[_0x3342('0x46')](_0x494d60));}}else{loggerPredictive[_0x3342('0x75')](_0x3342('0x7a'),JSON[_0x3342('0x46')](_0x494d60));}return![];}function mergeDataErlangB(_0x386a5d){return function(_0x3db07c){loggerPredictive[_0x3342('0x75')](_0x3342('0x7b'),JSON['stringify'](_0x3db07c));_[_0x3342('0x7c')](_0x386a5d,_0x3db07c);};}function getDiff(_0x4eebaa){var _0x1919d5=moment()['milliseconds'](0x0);var _0x49e3c6=moment(_0x4eebaa)['milliseconds'](0x0);return _0x1919d5['diff'](_0x49e3c6,_0x3342('0x48'));}function ifInterval(_0xdaabb4,_0x3cd098){if(_[_0x3342('0x39')](_0x3cd098)){return![];}if(getDiff(_0x3cd098)<_0xdaabb4*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3d9be7){if(isNotNull(_0x3d9be7)){if(!_[_0x3342('0x39')](_0x3d9be7[_0x3342('0x28')])){_0x3d9be7[_0x3342('0x28')]=undefined;loggerPredictive[_0x3342('0x75')](_0x3342('0x7d'),_0x3342('0x28'),_0x3d9be7['name']);}if(!_['isUndefined'](_0x3d9be7[_0x3342('0x7e')])){_0x3d9be7['startPredictive']=undefined;loggerPredictive[_0x3342('0x75')]('[freeVariablesPredictive]','startPredictive',_0x3d9be7[_0x3342('0x3e')]);}if(!_[_0x3342('0x39')](_0x3d9be7[_0x3342('0x7f')])){clearInterval(_0x3d9be7['handlePredictive']);_0x3d9be7['handlePredictive']=undefined;loggerPredictive[_0x3342('0x75')](_0x3342('0x7d'),'handlePredictive',_0x3d9be7[_0x3342('0x3e')]);}}}function erlangb(_0x219a17,_0x372af5){if(_0x372af5===0x0){return 0x0;}var _0x4d3660=0x1;for(var _0x23c186=0x1;_0x23c186<=_0x372af5;_0x23c186+=0x1){_0x4d3660=0x1+_0x4d3660*_0x23c186/_0x219a17;}return 0x1/_0x4d3660;}function isVoiceQueueOutbound(_0x3936bb){return _0x3936bb===_0x3342('0x49');}function isNotPreview(_0x3028e8){return _0x3028e8!==_0x3342('0x1e');}function isCampaignIvr(_0x19e27b){return _0x19e27b===_0x3342('0x73');}function getCallerId(_0x57942a,_0x4bc9a9,_0x30e299){if(!_['isUndefined'](_0x30e299)&&_0x3342('0x80')===typeof _0x30e299&&!_[_0x3342('0x44')](_0x30e299)){if(!_[_0x3342('0x39')](_0x4bc9a9)&&_0x3342('0x80')===typeof _0x4bc9a9&&!_[_0x3342('0x44')](_0x4bc9a9)){return util['format'](_0x3342('0x81'),_0x4bc9a9,_0x30e299);}return util[_0x3342('0x70')]('\x22%s\x22\x20<%s>',_0x30e299,_0x30e299);}if(!_[_0x3342('0x39')](_0x57942a)&&_0x3342('0x80')===typeof _0x57942a&&!_[_0x3342('0x44')](_0x57942a)){return _0x57942a;}return _0x3342('0x82');}function loggerCatchQueueSummary(_0x1ba552,_0x3a82c8){return function(_0x19fcc5){freeVariablesPredictive(_0x3a82c8);emitVoiceQueueSummary(_0x3a82c8);emitCampaignSummary(_0x3a82c8);loggerSyncQueueSummary[_0x3342('0x83')](_0x1ba552,util[_0x3342('0x84')](_0x19fcc5,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x36eec8,_0x42fcd7){return function(_0x28bbfa){loggerPredictive[_0x3342('0x83')](_0x36eec8,JSON['stringify'](_0x28bbfa));freeVariablesPredictive(_0x42fcd7);};}function loggerCatch(_0x5c9399){return function(_0x146ffc){logger[_0x3342('0x83')](_0x5c9399,util[_0x3342('0x84')](_0x146ffc,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3cd93a){return _0x3cd93a&&!_['isUndefined'](_0x3cd93a)&&_0x3cd93a['length']>0x0;}function decremetOriginate(_0x3310ac){if(!_[_0x3342('0x39')](_0x3310ac)&&_0x3310ac!==null){if(_0x3310ac[_0x3342('0x85')](_0x3342('0x6d'))){if(_0x3310ac[_0x3342('0x6d')]>0x0){_0x3310ac[_0x3342('0x6d')]-=0x1;}else{logger[_0x3342('0x83')](_0x3342('0x86'));}}}else{logger[_0x3342('0x83')](_0x3342('0x87'));}}function checkContactLowerLimitOriginate(_0x4887d4,_0x3392a2,_0x5e2ff3){if(_0x3392a2>_0x5e2ff3){for(var _0x1c5d7d=0x0;_0x1c5d7d<_0x3392a2-_0x5e2ff3;_0x1c5d7d+=0x1){decremetOriginate(_0x4887d4);}}}function loggerGetContactDialer(_0xba7c0e,_0x536fbc,_0x18cadb){return function(_0x3506d4){checkContactLowerLimitOriginate(_0x536fbc,_0x18cadb,0x0);logger['error'](_0xba7c0e,util[_0x3342('0x84')](_0x3506d4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3624be){return function(_0x1e3353){if(isNotNull(_0x1e3353)&&isNotNull(_0x1e3353[0x0])){if(_0x1e3353[0x0][_0x3342('0x88')]>0x0){_0x3624be[_0x3342('0x3a')]=_0x3342('0x89');logger[_0x3342('0x75')]('[getContactDialer2][ReScheduled]'+_0x3624be[_0x3342('0x3e')],_0x1e3353[0x0]['contactsRescheduled'],'contacts');}else{_0x3624be[_0x3342('0x3a')]=_0x3342('0x8a');logger[_0x3342('0x75')](_0x3342('0x8b')+_0x3624be[_0x3342('0x3e')]);}}};}function notSendMessagesQueue(_0x936eba){if(_0x936eba[_0x3342('0x8c')]){freeVariablesPredictive(_0x936eba);if(_0x936eba[_0x3342('0x6d')]===0x0&&_0x936eba['talking']===0x0&&_0x936eba[_0x3342('0x8d')]===0x0&&(_0x936eba[_0x3342('0x8e')]||0x0)===0x0){_0x936eba[_0x3342('0x8c')]=![];_0x936eba[_0x3342('0x4c')]=0x0;_0x936eba[_0x3342('0x3a')]=_0x3342('0x3d');loggerSyncQueueSummary[_0x3342('0x83')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x936eba[_0x3342('0x3e')],_0x3342('0x8f'));}else{_0x936eba[_0x3342('0x3a')]=_0x3342('0x90');loggerSyncQueueSummary[_0x3342('0x83')](_0x3342('0x91'),_0x936eba['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x936eba);}}function notSendMessagesCampaign(_0x585b5e){if(_0x585b5e[_0x3342('0x8c')]){if(_0x585b5e[_0x3342('0x6d')]===0x0){_0x585b5e[_0x3342('0x8c')]=![];_0x585b5e[_0x3342('0x3a')]=_0x3342('0x3d');loggerSyncQueueSummary[_0x3342('0x83')](_0x3342('0x92'),_0x585b5e[_0x3342('0x3e')],'is\x20not\x20active');}else{_0x585b5e[_0x3342('0x3a')]=_0x3342('0x90');loggerSyncQueueSummary[_0x3342('0x83')](_0x3342('0x92'),_0x585b5e['name'],_0x3342('0x93'));}emitCampaignSummary(_0x585b5e);}}function createObjHistory(_0x41e449,_0x3cbe12,_0x3ec056,_0xe125dd,_0x283466){_0x41e449[_0x3342('0x3a')]=_0x3ec056;var _0x212ba9=new Action(_0x41e449,_0x3cbe12);var _0x3d2745=new History(_0x212ba9);_0x3d2745['state']=_0xe125dd;_0x3d2745[_0x3342('0x94')]=_0x283466;_0x3d2745[_0x3342('0x95')]=_0x212ba9['starttime'];return _0x3d2745;}Dialer[_0x3342('0x1a')]['loopClearZombieChannels']=function(){var _0x123fd4=this;setInterval(function(){_0x123fd4['clearZombieChannels'](_0x123fd4[_0x3342('0x26')],'[uniqueid]');_0x123fd4[_0x3342('0x96')](_0x123fd4[_0x3342('0x25')],'[actions]');},0x32c8);};Dialer[_0x3342('0x1a')][_0x3342('0x96')]=function(_0x5f1acc,_0xe5acb2){var _0x24c9ef=this;for(var _0x380463 in _0x5f1acc){if(_0x5f1acc[_0x3342('0x85')](_0x380463)){this[_0x3342('0x97')][_0x3342('0x1b')](function(){if(!_['isNil'](_0x5f1acc[_0x380463])){return ami[_0x3342('0x98')]({'action':_0x3342('0x99'),'channel':_0x5f1acc[_0x380463][_0x3342('0x9a')]})[_0x3342('0x9b')](function(_0x283731){if(_0x283731[_0x3342('0x3a')]===_0x3342('0x9c')){setTimeout(function(){if(_0x5f1acc[_0x380463]&&_0x5f1acc[_0x380463][_0x3342('0x9d')]!==_0x3342('0x73')){_0x24c9ef[_0x3342('0x9e')](_0x24c9ef['voiceQueues'][_0x5f1acc[_0x380463][_0x3342('0x9f')]]);logger[_0x3342('0x83')](_0x3342('0xa0'),_0xe5acb2,_0x380463,_0x5f1acc[_0x380463]['queue']);delete _0x5f1acc[_0x380463];}if(_0x5f1acc[_0x380463]&&_0x5f1acc[_0x380463]['type']===_0x3342('0x73')){_0x24c9ef['updateOriginated'](_0x24c9ef['campaigns'][_0x5f1acc[_0x380463][_0x3342('0x9f')]]);logger[_0x3342('0x83')]('[Dialer][checkChannel][ivr]',_0xe5acb2,_0x380463,_0x5f1acc[_0x380463][_0x3342('0x9f')]);delete _0x5f1acc[_0x380463];}},0x2328);}});}});}}};Dialer['prototype'][_0x3342('0xa1')]=function(_0x5d1b47){return BPromise['resolve']()[_0x3342('0xa2')](cmHopper[_0x3342('0xa1')](_0x5d1b47))[_0x3342('0x9b')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x3342('0xa3')]=function(_0x499a58){return BPromise[_0x3342('0xa4')]()[_0x3342('0xa2')](cmHopperBlack[_0x3342('0xa3')](_0x499a58))[_0x3342('0x9b')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x3342('0xa5')]=function(_0x2be9e6){return BPromise['resolve']()[_0x3342('0xa2')](cmHopperBlack['checkIsBlackListIvr'](_0x2be9e6))[_0x3342('0x9b')](loggerCatch(_0x3342('0xa6')));};Dialer[_0x3342('0x1a')][_0x3342('0xa7')]=function(_0x22b415){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0x22b415))[_0x3342('0x9b')](loggerCatch(_0x3342('0xa8')));};Dialer[_0x3342('0x1a')]['rescheduleContact']=function(_0x3393d9){return BPromise[_0x3342('0xa4')]()[_0x3342('0xa2')](cmHopper[_0x3342('0xa9')](_0x3393d9))[_0x3342('0x9b')](loggerCatch(_0x3342('0xaa')));};Dialer['prototype'][_0x3342('0xab')]=function(_0x56147f,_0x5ccb90,_0x53699e,_0x135da6){return BPromise[_0x3342('0xa4')]()['then'](cmHopper[_0x3342('0xab')](_0x56147f,_0x5ccb90,_0x53699e,_0x135da6))[_0x3342('0x9b')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x3342('0x1a')][_0x3342('0xac')]=function(_0xdb902b,_0x464e4c,_0x59e963){return BPromise[_0x3342('0xa4')]()[_0x3342('0xa2')](cmHopper[_0x3342('0xac')](_0xdb902b,_0x464e4c,_0x59e963))['catch'](loggerCatch(_0x3342('0xad')));};Dialer[_0x3342('0x1a')][_0x3342('0xae')]=function(_0x37918e){return BPromise[_0x3342('0xa4')]()[_0x3342('0xa2')](voiceQueueRt[_0x3342('0xae')](_0x37918e))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x3342('0x1a')][_0x3342('0xaf')]=function(_0x28b7ba){return BPromise[_0x3342('0xa4')]()[_0x3342('0xa2')](cmHopper[_0x3342('0xaf')](_0x28b7ba))[_0x3342('0x9b')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x3342('0x1a')][_0x3342('0xb0')]=function(_0xc75c0d){return BPromise[_0x3342('0xa4')]()[_0x3342('0xa2')](cmHopperHistory['createHistory'](_0xc75c0d))[_0x3342('0x9b')](loggerCatch(_0x3342('0xb1')));};Dialer[_0x3342('0x1a')][_0x3342('0x9e')]=function(_0x526d93){if(!_[_0x3342('0x39')](_0x526d93)&&_0x526d93!==null){if(_0x526d93[_0x3342('0x85')](_0x3342('0x6d'))){if(_0x526d93[_0x3342('0x6d')]>0x0){_0x526d93[_0x3342('0x6d')]-=0x1;}else{logger[_0x3342('0x83')](_0x3342('0xb2'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x3342('0x1a')]['loggerHandler']=function(_0x122a34,_0x38c9c4){var _0x36e6a7=this;return function(_0x23b307){_0x36e6a7[_0x3342('0x9e')](_0x38c9c4);logger['error'](_0x122a34,util[_0x3342('0x84')](_0x23b307,{'showHidden':![],'depth':null}));};};Dialer[_0x3342('0x1a')][_0x3342('0xb3')]=function(_0x5a6430,_0x4cad21,_0x1403e9){var _0x3a019d={'state':0x19,'statedesc':_0x3342('0xb4')};this[_0x3342('0x9e')](_0x4cad21);this[_0x3342('0xb5')](_[_0x3342('0x7c')](_0x3a019d,_[_0x3342('0xb6')](_0x1403e9,[_0x3342('0xb7'),_0x3342('0xb8'),_0x3342('0xb9'),_0x3342('0xba'),_0x3342('0xbb')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x5a6430);};Dialer[_0x3342('0x1a')][_0x3342('0xbc')]=function(_0x2799b3){return _0x2799b3===_0x3342('0xbd');};Dialer[_0x3342('0x1a')]['isTrunkReachable']=function(_0x2b3659){return!_[_0x3342('0x39')](_0x2b3659)&&_0x2b3659&&!_[_0x3342('0x39')](_0x2b3659['name'])&&!_[_0x3342('0x39')](_0x2b3659[_0x3342('0x6f')])&&_0x2b3659['active']&&(this['trunks'][util[_0x3342('0x70')](_0x3342('0xbe'),_0x2b3659[_0x3342('0x3e')])][_0x3342('0x99')]===_0x3342('0xbf')||this['trunks'][util['format'](_0x3342('0xbe'),_0x2b3659[_0x3342('0x3e')])][_0x3342('0x99')]===_0x3342('0xc0'));};Dialer[_0x3342('0x1a')][_0x3342('0xb5')]=function(_0x3e66da,_0x5d197f,_0x4aab57){this['createHistory'](_0x3e66da)[_0x3342('0x9b')](loggerCatch(_0x5d197f));this['moveContactManagedDialer'](_0x3e66da)['catch'](loggerCatch(_0x4aab57));};Dialer['prototype'][_0x3342('0x34')]=function(_0x319a6e){var _0x5435c8=this[_0x3342('0x26')][_0x319a6e['uniqueid']];var _0x53e972;if(!_[_0x3342('0xc1')](_0x319a6e)&&!_['isNil'](_0x319a6e[_0x3342('0xc2')])&&!_[_0x3342('0xc1')](_0x319a6e[_0x3342('0xc2')][_0x3342('0xc3')])&&_0x319a6e[_0x3342('0xc4')]===_0x3342('0xc5')&&_0x5435c8){if(_0x5435c8['type']!==_0x3342('0x73')&&this[_0x3342('0x1f')][_0x5435c8[_0x3342('0x9f')]]['dialAMDActive']&&_0x319a6e[_0x3342('0xc6')]===_0x3342('0xc7')){delete this[_0x3342('0x26')][_0x319a6e[_0x3342('0xc8')]];this[_0x3342('0x9e')](this[_0x3342('0x1f')][_0x5435c8['queue']]);this[_0x3342('0x1f')][_0x5435c8[_0x3342('0x9f')]][_0x3342('0x59')]+=0x1;this[_0x3342('0x1f')][_0x5435c8[_0x3342('0x9f')]]['outboundAnswerAgiCallsDay']+=0x1;_0x53e972=new Hangup(_0x5435c8,_0x319a6e);_0x53e972[_0x3342('0xc9')]=0x12;_0x53e972[_0x3342('0x94')]=_0x3342('0xca');_0x53e972[_0x3342('0xcb')]='AMD';this[_0x3342('0xb5')](_0x53e972,'[syncHangupInAMD][createHistory]',_0x3342('0xcc'));}if(_0x5435c8[_0x3342('0x9d')]!==_0x3342('0x73')&&this['voiceQueues'][_0x5435c8[_0x3342('0x9f')]]['dialAMDActive']&&_0x319a6e[_0x3342('0xc6')]==='MACHINE'){delete this[_0x3342('0x26')][_0x319a6e[_0x3342('0xc8')]];this[_0x3342('0x9e')](this['voiceQueues'][_0x5435c8[_0x3342('0x9f')]]);this[_0x3342('0x1f')][_0x5435c8[_0x3342('0x9f')]][_0x3342('0x59')]+=0x1;this[_0x3342('0x1f')][_0x5435c8[_0x3342('0x9f')]][_0x3342('0x58')]+=0x1;_0x53e972=new Hangup(_0x5435c8,_0x319a6e);_0x53e972['state']=0x13;_0x53e972[_0x3342('0x94')]=_0x3342('0xcd');_0x53e972[_0x3342('0xcb')]='AMD';_0x53e972[_0x3342('0xce')]=!![];this[_0x3342('0xb5')](_0x53e972,_0x3342('0xcf'),_0x3342('0xd0'));}if(_0x5435c8[_0x3342('0x9d')]===_0x3342('0x73')&&this[_0x3342('0x20')][_0x5435c8[_0x3342('0x9f')]]['dialAMDActive']&&_0x319a6e[_0x3342('0xc6')]===_0x3342('0xc7')){delete this['uniqueId'][_0x319a6e[_0x3342('0xc8')]];this[_0x3342('0x9e')](this[_0x3342('0x20')][_0x5435c8[_0x3342('0x9f')]]);_0x53e972=new Hangup(_0x5435c8,_0x319a6e);_0x53e972[_0x3342('0xc9')]=0x12;_0x53e972[_0x3342('0x94')]=_0x3342('0xca');_0x53e972[_0x3342('0xcb')]=_0x3342('0xd1');this[_0x3342('0xb5')](_0x53e972,_0x3342('0xd2'),'[syncHangupInAMDIvr]');}if(_0x5435c8['type']===_0x3342('0x73')&&this[_0x3342('0x20')][_0x5435c8[_0x3342('0x9f')]][_0x3342('0xd3')]&&_0x319a6e[_0x3342('0xc6')]===_0x3342('0xd4')){delete this[_0x3342('0x26')][_0x319a6e[_0x3342('0xc8')]];this[_0x3342('0x9e')](this[_0x3342('0x20')][_0x5435c8[_0x3342('0x9f')]]);_0x53e972=new Hangup(_0x5435c8,_0x319a6e);_0x53e972[_0x3342('0xc9')]=0x13;_0x53e972[_0x3342('0x94')]=_0x3342('0xcd');_0x53e972[_0x3342('0xcb')]=_0x3342('0xd1');_0x53e972['amd']=!![];this['saveInDb'](_0x53e972,_0x3342('0xd5'),_0x3342('0xd6'));}}};Dialer['prototype'][_0x3342('0x32')]=function(_0x173dda){var _0x5d98e9=this[_0x3342('0x26')][_0x173dda['uniqueid']];var _0x24049f=this;var _0x3ab2f3;if(_0x5d98e9&&_0x5d98e9[_0x3342('0x9d')]===_0x3342('0x73')){delete this[_0x3342('0x26')][_0x173dda[_0x3342('0xc8')]];this[_0x3342('0x9e')](this[_0x3342('0x20')][_0x5d98e9[_0x3342('0x9f')]]);this['campaigns'][_0x5d98e9['queue']]['ivrAnswerCallsDay']+=0x1;_0x3ab2f3=new Hangup(_0x5d98e9,_0x173dda);this[_0x3342('0xb0')](_0x3ab2f3)[_0x3342('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3342('0xaf')](_0x3ab2f3)[_0x3342('0x9b')](loggerCatch(_0x3342('0xd7')));}if(_0x5d98e9&&_0x5d98e9[_0x3342('0x9d')]!=='ivr'&&isNotNull(this[_0x3342('0x1f')][_0x5d98e9[_0x3342('0x9f')]]['dialQueueProject'])){delete this['uniqueId'][_0x173dda[_0x3342('0xc8')]];this[_0x3342('0x9e')](this[_0x3342('0x1f')][_0x5d98e9[_0x3342('0x9f')]]);this[_0x3342('0x1f')][_0x5d98e9[_0x3342('0x9f')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x5d98e9[_0x3342('0x9f')]][_0x3342('0x58')]+=0x1;_0x3ab2f3=new Hangup(_0x5d98e9,_0x173dda);_0x3ab2f3[_0x3342('0xc9')]=0x10;_0x3ab2f3[_0x3342('0x94')]=_0x3342('0xd8');_0x3ab2f3['membername']='AGI';this['createHistory'](_0x3ab2f3)[_0x3342('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3342('0xaf')](_0x3ab2f3)[_0x3342('0x9b')](loggerCatch(_0x3342('0xd7')));}if(_0x5d98e9&&_0x5d98e9[_0x3342('0x9d')]!==_0x3342('0x73')&&!isNotNull(this[_0x3342('0x1f')][_0x5d98e9[_0x3342('0x9f')]][_0x3342('0xd9')])){delete this[_0x3342('0x26')][_0x173dda[_0x3342('0xc8')]];this[_0x3342('0x9e')](this[_0x3342('0x1f')][_0x5d98e9['queue']]);this[_0x3342('0x1f')][_0x5d98e9[_0x3342('0x9f')]][_0x3342('0x63')]+=0x1;_0x3ab2f3=new Hangup(_0x5d98e9,_0x173dda);_0x3ab2f3[_0x3342('0xc9')]=0xc;_0x3ab2f3[_0x3342('0x94')]=_0x173dda[_0x3342('0xda')];_0x3ab2f3[_0x3342('0xcb')]=_0x3342('0xdb');this[_0x3342('0xb0')](_0x3ab2f3)[_0x3342('0x9b')](loggerCatch(_0x3342('0xdc')));this[_0x3342('0xaf')](_0x3ab2f3)['catch'](loggerCatch(_0x3342('0xd7')));}};Dialer[_0x3342('0x1a')]['syncAgentComplete']=function(_0x275fce){var _0x78daec=this[_0x3342('0x26')][_0x275fce['uniqueid']];var _0x44fb91=this;if(this[_0x3342('0x1f')][_0x275fce[_0x3342('0x9f')]]){if(_0x78daec&&_0x78daec[_0x3342('0x9d')]!==_0x3342('0x73')){delete this[_0x3342('0x26')][_0x275fce['uniqueid']];this[_0x3342('0x1f')][_0x275fce[_0x3342('0x9f')]][_0x3342('0x59')]+=0x1;var _0x4583cb=new AgentComplete(_0x78daec,_0x275fce);if(_0x275fce['reason']===_0x3342('0xdd')){_0x4583cb['agiafterat']=this['voiceQueues'][_0x275fce[_0x3342('0x9f')]][_0x3342('0xde')]&&this[_0x3342('0x1f')][_0x275fce[_0x3342('0x9f')]][_0x3342('0xdf')]?moment()[_0x3342('0x70')](_0x3342('0xe0')):undefined;}this[_0x3342('0xb0')](_0x4583cb)[_0x3342('0x9b')](loggerCatch(_0x3342('0xe1')));this['moveContactManagedDialer'](_0x4583cb)['catch'](loggerCatch(_0x3342('0xe2')));}}};Dialer[_0x3342('0x1a')]['syncAgentConnect']=function(_0x25fd87){if(this['voiceQueues'][_0x25fd87[_0x3342('0x9f')]]){if(this[_0x3342('0x26')][_0x25fd87[_0x3342('0xc8')]]&&this['uniqueId'][_0x25fd87['uniqueid']][_0x3342('0x9d')]!==_0x3342('0x73')){this[_0x3342('0x9e')](this[_0x3342('0x1f')][_0x25fd87['queue']]);this['uniqueId'][_0x25fd87[_0x3342('0xc8')]]['answertime']=moment()[_0x3342('0x70')](_0x3342('0xe0'));}}};Dialer[_0x3342('0x1a')][_0x3342('0xe3')]=function(_0x2d87c6){this['createHistory'](_0x2d87c6)['catch'](loggerCatch(_0x3342('0xe1')));this[_0x3342('0xaf')](_0x2d87c6)[_0x3342('0x9b')](loggerCatch(_0x3342('0xe4')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x5a0763){var _0x41b43e=this[_0x3342('0x26')][_0x5a0763['uniqueid']];var _0x4f7a68=this;if(this[_0x3342('0x1f')][_0x5a0763[_0x3342('0x9f')]]){if(_0x41b43e&&_0x41b43e[_0x3342('0x9d')]!=='ivr'){delete this[_0x3342('0x26')][_0x5a0763[_0x3342('0xc8')]];this[_0x3342('0x9e')](this[_0x3342('0x1f')][_0x5a0763['queue']]);_0x41b43e[_0x3342('0xe5')]=moment()['format'](_0x3342('0xe0'));var _0x3c3576=new QueueCallerAbandon(_0x41b43e,_0x5a0763);if(getSeconds(_0x41b43e[_0x3342('0xe5')],_0x41b43e['responsetime'])>=_0x41b43e[_0x3342('0xe6')]){this['voiceQueues'][_0x5a0763[_0x3342('0x9f')]][_0x3342('0x67')]+=0x1;this[_0x3342('0x1f')][_0x5a0763[_0x3342('0x9f')]][_0x3342('0xe7')]+=0x1;this[_0x3342('0x1f')][_0x5a0763[_0x3342('0x9f')]][_0x3342('0x69')]+=0x1;_0x3c3576[_0x3342('0xc9')]=0xa;_0x3c3576['statedesc']=_0x3342('0xe8');_0x3c3576[_0x3342('0xe9')]=_0x3342('0xea');_0x3c3576[_0x3342('0xeb')]=this[_0x3342('0x1f')][_0x5a0763['queue']]['dialQueueProject2']?moment()['format'](_0x3342('0xe0')):undefined;this[_0x3342('0xe3')](_0x3c3576);}else{this[_0x3342('0x1f')][_0x5a0763['queue']][_0x3342('0x66')]+=0x1;this[_0x3342('0x1f')][_0x5a0763[_0x3342('0x9f')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3c3576[_0x3342('0xc9')]=0xb;_0x3c3576['statedesc']=_0x3342('0xec');_0x3c3576[_0x3342('0xe9')]=_0x3342('0xed');this[_0x3342('0xe3')](_0x3c3576);}}}};Dialer[_0x3342('0x1a')]['syncNewExten']=function(_0x2e6edd){if(this[_0x3342('0x25')][_0x2e6edd[_0x3342('0xc8')]]){this['actions'][_0x2e6edd[_0x3342('0xc8')]][_0x3342('0x9a')]=_0x2e6edd[_0x3342('0x9a')];}if(this[_0x3342('0x26')][_0x2e6edd['uniqueid']]){this[_0x3342('0x26')][_0x2e6edd[_0x3342('0xc8')]][_0x3342('0x9a')]=_0x2e6edd[_0x3342('0x9a')];}};Dialer[_0x3342('0x1a')]['syncQueueMember']=function(_0x12364b){if(strategy[this['voiceQueues'][this[_0x3342('0x25')][_0x12364b[_0x3342('0xee')]][_0x3342('0x9f')]][_0x3342('0x4a')]]==='roundrobin'){if(this[_0x3342('0x25')][_0x12364b[_0x3342('0xee')]]&&_[_0x3342('0xc1')](this[_0x3342('0x25')][_0x12364b['actionid']][_0x3342('0xef')])&&_0x12364b['status']==='1'&&_0x12364b[_0x3342('0xf0')]==='0'){if(this[_0x3342('0x21')][_0x12364b['stateinterface']]){if(!this[_0x3342('0x21')][_0x12364b['stateinterface']][_0x3342('0xef')]){this[_0x3342('0x21')][_0x12364b[_0x3342('0xf1')]][_0x3342('0xef')]=!![];this[_0x3342('0x25')][_0x12364b[_0x3342('0xee')]][_0x3342('0xef')]=!![];this[_0x3342('0x25')][_0x12364b[_0x3342('0xee')]][_0x3342('0xf1')]=_0x12364b[_0x3342('0xf1')];}}}}else if((strategy[this['voiceQueues'][this[_0x3342('0x25')][_0x12364b[_0x3342('0xee')]][_0x3342('0x9f')]]['strategy']]||'rrmemory')===_0x3342('0x18')){if(this['actions'][_0x12364b[_0x3342('0xee')]]){if(this[_0x3342('0x21')][_0x12364b[_0x3342('0xf1')]]){this[_0x3342('0x25')][_0x12364b[_0x3342('0xee')]][_0x3342('0xf1')]=_0x12364b[_0x3342('0xf1')];if(_[_0x3342('0xc1')](this['queueBooked'][this[_0x3342('0x25')][_0x12364b[_0x3342('0xee')]]['queue']])){this[_0x3342('0xf2')][this[_0x3342('0x25')][_0x12364b[_0x3342('0xee')]]['queue']]=[];}this['queueBooked'][this[_0x3342('0x25')][_0x12364b[_0x3342('0xee')]][_0x3342('0x9f')]]['push'](_[_0x3342('0x7c')](_[_0x3342('0xb6')](this[_0x3342('0x25')][_0x12364b['actionid']],[_0x3342('0xf3'),'stateinterface']),{'status':_0x12364b['status'],'paused':_0x12364b[_0x3342('0xf0')]}));}}}};function unlockQueueStatus(_0xad537d,_0x1fea43){setTimeout(function(){if(_[_0x3342('0x39')](_0xad537d[_0x3342('0xf4')])){loggerBooked[_0x3342('0x83')]('[unlockQueueStatus][undefined]',_0x1fea43);}_0xad537d[_0x3342('0xf4')]=!![];loggerBooked[_0x3342('0x75')](_0x3342('0xf5'),_0x1fea43,JSON[_0x3342('0x46')](_[_0x3342('0xb6')](_0xad537d,[_0x3342('0x3e'),_0x3342('0xf4')])));},0x1f3);}Dialer[_0x3342('0x1a')][_0x3342('0x37')]=function(_0x1d2a77){var _0x39d11f=this;var _0x47fd01=_0x39d11f['voiceQueues'][_0x39d11f['actions'][_0x1d2a77[_0x3342('0xee')]][_0x3342('0x9f')]];if(strategy[this[_0x3342('0x1f')][this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0x9f')]]['strategy']]===_0x3342('0x19')){if(this['actions'][_0x1d2a77[_0x3342('0xee')]]&&this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0xf1')]){this[_0x3342('0x1e')][_0x3342('0xf6')](this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]]['idHopper'],this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0xf1')])[_0x3342('0x9b')](function(_0x4a9b40){logger['error'](_0x3342('0xf7'),util['inspect'](_0x4a9b40,{'showHidden':![],'depth':null}));})[_0x3342('0x1d')](function(){_0x39d11f[_0x3342('0x9e')](_0x39d11f[_0x3342('0x1f')][_0x39d11f[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0x9f')]]);_0x39d11f[_0x3342('0x21')][_0x39d11f[_0x3342('0x25')][_0x1d2a77['actionid']][_0x3342('0xf1')]][_0x3342('0xef')]=![];delete _0x39d11f[_0x3342('0x25')][_0x1d2a77['actionid']];unlockQueueStatus(_0x47fd01);});}else{this[_0x3342('0x9e')](this[_0x3342('0x1f')][this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0x9f')]]);this[_0x3342('0xa9')]({'active':![],'ContactId':this['actions'][_0x1d2a77[_0x3342('0xee')]][_0x3342('0xb7')],'ListId':this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]]['ListId'],'VoiceQueueId':this['actions'][_0x1d2a77[_0x3342('0xee')]][_0x3342('0xba')]||undefined,'CampaignId':this[_0x3342('0x25')][_0x1d2a77['actionid']][_0x3342('0xbb')]||undefined})[_0x3342('0x9b')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]];unlockQueueStatus(_0x47fd01);}}else if((strategy[this[_0x3342('0x1f')][this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0x9f')]][_0x3342('0x4a')]]||_0x3342('0x18'))===_0x3342('0x18')){var _0x50d7a5;if(this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]]&&!_[_0x3342('0x44')](this[_0x3342('0xf2')][this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0x9f')]])){if(this[_0x3342('0x2a')][_0x39d11f[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0x9f')]]){this[_0x3342('0x2a')][_0x39d11f[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0x9f')]]=this[_0x3342('0x2a')][this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0x9f')]]?this[_0x3342('0x2a')][this[_0x3342('0x25')][_0x1d2a77['actionid']][_0x3342('0x9f')]]:this[_0x3342('0xf2')][this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]]['queue']]?this[_0x3342('0xf2')][this['actions'][_0x1d2a77[_0x3342('0xee')]]['queue']]['_rr']||0x0:0x0;}this[_0x3342('0xf2')][this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]]['queue']][_0x3342('0xf8')]=this[_0x3342('0x2a')][this[_0x3342('0x25')][_0x1d2a77[_0x3342('0xee')]][_0x3342('0x9f')]];for(var _0x7b2d65=0x0;_0x7b2d65=0x0?!![]:![];})['catch'](myreject(_0x469c7c)));}}else{_0x5c9bb5[_0x3342('0x111')](ami[_0x3342('0x98')]({'action':'command','command':util[_0x3342('0x70')](_0x3342('0x116'),_0xd8d21e,!_[_0x3342('0x39')](config[_0x3342('0x10d')][_0x419b45])?_0x419b45:'')})['then'](function(_0xdb3a3f){return _0xdb3a3f[_0x3342('0x117')]['indexOf'](_0x3342('0x115'))>=0x0?!![]:![];})[_0x3342('0x9b')](myreject(_0x469c7c)));}BPromise[_0x3342('0x118')](_0x5c9bb5)['then'](function(_0x56d6f6){var _0x662306=_[_0x3342('0x119')](_0x56d6f6);if(_0x662306){return _0x5ed69e(_0x662306);}else{_0x25b6cc['message']=_0x1bcac1?_0x3342('0x11a'):'INTERVAL_IS_OVERTIME';return _0x469c7c(msgResponse(_0x3342('0x11b'),_0x3342('0x10f'),'Global:\x20'+_0x1bcac1+'\x20'+_0x81fea+_0x3342('0x11c')+util[_0x3342('0x84')](_0xd8d21e,{'showHidden':![],'depth':null})+_0x3342('0x11d')+_0x419b45));}})[_0x3342('0x9b')](function(_0x50b2e1){return _0x469c7c(msgResponse(_0x3342('0x109'),_0x3342('0x10f'),JSON[_0x3342('0x46')](_0x50b2e1)));});});};Dialer[_0x3342('0x1a')][_0x3342('0x11e')]=function(_0x16cc56){var _0x18c443=this;return function(){switch(_0x16cc56['dialMethod']){case'progressive':freeVariablesPredictive(_0x16cc56);_0x18c443[_0x3342('0x11f')](_0x16cc56,0x1);break;case _0x3342('0x120'):freeVariablesPredictive(_0x16cc56);_0x18c443['handlePower'](_0x16cc56,_0x16cc56[_0x3342('0x121')]);break;case _0x3342('0x9'):_0x18c443[_0x3342('0x9')](_0x16cc56);break;case _0x3342('0x8'):freeVariablesPredictive(_0x16cc56);_0x18c443[_0x3342('0x11f')](_0x16cc56,0x1);break;default:freeVariablesPredictive(_0x16cc56);logger[_0x3342('0x83')](_0x3342('0x122'),_0x16cc56[_0x3342('0x3e')],_0x3342('0x123'));}};};Dialer['prototype'][_0x3342('0x124')]=function(_0x2a5fef){var _0x287b01=this;return function(){_0x287b01[_0x3342('0x125')](_0x2a5fef);};};Dialer[_0x3342('0x1a')]['syncQueueSummary']=function(_0x56138b){var _0x28bfbc=this;if(isNotPreview(_0x56138b[_0x3342('0x54')])){if(isVoiceQueueOutbound(_0x56138b[_0x3342('0x9d')])&&isActive(_0x56138b['dialActive'])){_0x56138b[_0x3342('0x8c')]=!![];BPromise[_0x3342('0xa4')]()[_0x3342('0xa2')](checkIsLoggedIn(_0x56138b,_0x56138b[_0x3342('0x4d')]))['then'](checkIsActive(_0x56138b,_0x56138b[_0x3342('0x126')]))[_0x3342('0xa2')](checkInterval(_0x56138b))[_0x3342('0xa2')](_0x28bfbc[_0x3342('0x127')](_0x56138b))[_0x3342('0xa2')](_0x28bfbc[_0x3342('0x108')](_0x56138b[_0x3342('0x128')],_0x56138b['dialTimezone'],_0x56138b['name'],_0x56138b))[_0x3342('0xa2')](_0x28bfbc['checkIfTimeIntervals'](_0x56138b[_0x3342('0x42')],_0x56138b[_0x3342('0x129')],_0x56138b[_0x3342('0x3e')],_0x56138b))['then'](_0x28bfbc[_0x3342('0x11e')](_0x56138b))['catch'](loggerCatchQueueSummary(_0x3342('0x12a'),_0x56138b));}else{notSendMessagesQueue(_0x56138b);}}else{freeVariablesPredictive(_0x56138b);}};Dialer['prototype']['syncCampaigns']=function(){var _0x1ef652=this;var _0xb63314;for(var _0x6c8230 in this[_0x3342('0x20')]){if(this[_0x3342('0x20')][_0x3342('0x85')](_0x6c8230)){_0xb63314=this[_0x3342('0x20')][_0x6c8230];if(isCampaignIvr(_0xb63314['type'])&&isActive(_0xb63314[_0x3342('0x6f')])){_0xb63314[_0x3342('0x8c')]=!![];BPromise[_0x3342('0xa4')]()[_0x3342('0xa2')](checkIsActive(_0xb63314,_0xb63314[_0x3342('0x6f')]))[_0x3342('0xa2')](checkInterval(_0xb63314))['then'](_0x1ef652[_0x3342('0x127')](_0xb63314))[_0x3342('0xa2')](_0x1ef652['checkIfTime'](_0xb63314['dialGlobalInterval'],_0xb63314[_0x3342('0x129')],_0xb63314['name'],_0xb63314))[_0x3342('0xa2')](_0x1ef652['checkIfTimeIntervals'](_0xb63314[_0x3342('0x42')],_0xb63314[_0x3342('0x129')],_0xb63314['name'],_0xb63314))[_0x3342('0xa2')](_0x1ef652[_0x3342('0x124')](_0xb63314))['catch'](loggerCatchQueueSummary(_0x3342('0x12b'),_0xb63314));}else{notSendMessagesCampaign(_0xb63314);}}}};function getCallerIdRandom(_0x9a8920,_0x2862fd){var _0x157ac9,_0x12e124,_0x27cc40;if(_0x2862fd<=0x0){_0x2862fd=0x1;}_0x157ac9=new RegExp('\x5cw{0,'+_0x2862fd+'}$');_0x12e124=Math[_0x3342('0x12c')](0xa,_0x2862fd-0x1);_0x27cc40=Math[_0x3342('0x12c')](0xa,_0x2862fd)-0x1;return util[_0x3342('0x70')]('%s',_[_0x3342('0x12d')](_0x9a8920,_0x157ac9,_[_0x3342('0x12e')](_0x12e124,_0x27cc40)));}function extractCalleridName(_0x28377b){var _0x4fb893=_0x28377b[_0x3342('0x12f')](/"(.*?)"/);return _0x4fb893?_0x4fb893[0x1]:_0x28377b;}function extractCalleridNumber(_0x160b1c){var _0x2f9b97=_0x160b1c[_0x3342('0x12f')](/<(.*?)>/);return _0x2f9b97?_0x2f9b97[0x1]:_0x160b1c;}Dialer[_0x3342('0x1a')][_0x3342('0x130')]=function(_0x281ffa,_0x5c5ee7){var _0x31f0ae=this;var _0x1e49ef=uuid['v4']();this[_0x3342('0x25')][_0x1e49ef]=new Action(_0x281ffa,_0x5c5ee7,_0x1e49ef);return new BPromise(function(_0x20cdbc,_0x162b8f){if(_[_0x3342('0x39')](_0x281ffa)&&_0x3342('0x131')!==typeof _0x281ffa){return _0x162b8f(msgResponse(_0x3342('0x132'),'Failure',_0x3342('0x133')));}if(_[_0x3342('0x39')](_0x5c5ee7[_0x3342('0x134')][_0x3342('0x135')])||_0x5c5ee7['Contact'][_0x3342('0x135')]===null){return _0x162b8f(msgResponse(_0x3342('0x132'),_0x3342('0x10f'),'contact\x20is\x20undefine'));}var _0x128dd1={'XMD-CALLERID':_0x31f0ae['actions'][_0x1e49ef][_0x3342('0x136')](),'XMD-AGI':_0x281ffa[_0x3342('0xd9')]?util[_0x3342('0x70')](_0x3342('0x137'),ipAgi,_0x281ffa[_0x3342('0xd9')]):'NONE','XMD-AGIAFTER':_0x281ffa['dialQueueProject2']?util[_0x3342('0x70')](_0x3342('0x137'),ipAgi,_0x281ffa[_0x3342('0xde')]):_0x3342('0x138'),'XMD-QUEUE':_0x281ffa[_0x3342('0x9d')]===_0x3342('0x49')?util[_0x3342('0x70')](_0x3342('0x139'),_0x281ffa[_0x3342('0x3e')],_0x281ffa[_0x3342('0x13a')]||'',_0x281ffa[_0x3342('0xdf')]?'c':'',_0x281ffa[_0x3342('0xe6')]||0x3):_0x3342('0x138'),'XMD-CONTACTID':_0x5c5ee7[_0x3342('0xb7')],'XMD-CDRTYPE':_0x3342('0x7'),'CALLERID(all)':_0x31f0ae['actions'][_0x1e49ef][_0x3342('0x136')](),'XMD-AMD':_0x281ffa[_0x3342('0xd3')]?_0x3342('0x13b'):_0x3342('0x138'),'XMD-DESTINATION':_0x3342('0xc5')};if(_0x281ffa[_0x3342('0xd3')]){_0x128dd1[_0x3342('0x13c')]=_0x281ffa[_0x3342('0x13d')]||0x9c4;_0x128dd1[_0x3342('0x13e')]=_0x281ffa['dialAMDGreeting']||0x5dc;_0x128dd1['XMD-AMDAFTERGREETINGSILENCE']=_0x281ffa[_0x3342('0x13f')]||0x320;_0x128dd1[_0x3342('0x140')]=_0x281ffa[_0x3342('0x141')]||0x1388;_0x128dd1[_0x3342('0x142')]=_0x281ffa[_0x3342('0x143')]||0x64;_0x128dd1[_0x3342('0x144')]=_0x281ffa[_0x3342('0x145')]||0x32;_0x128dd1[_0x3342('0x146')]=_0x281ffa[_0x3342('0x147')]||0x3;_0x128dd1[_0x3342('0x148')]=_0x281ffa['dialAMDSilenceThreshold']||0x100;_0x128dd1['XMD-AMDMAXIMUMWORDLENGTH']=_0x281ffa[_0x3342('0x149')]||0x1388;}if(_0x281ffa['type']===_0x3342('0x49')){_0x128dd1['XMD-VOICEQUEUEID']=_0x5c5ee7[_0x3342('0xba')];}else{_0x128dd1['XMD-CAMPAIGNID']=_0x5c5ee7['CampaignId'];}for(var _0x36bd2b in _0x5c5ee7['Contact']){if(_0x5c5ee7[_0x3342('0x134')][_0x3342('0x85')](_0x36bd2b)){if(isNotNull(_0x5c5ee7[_0x3342('0x134')][_0x36bd2b])&&_0x36bd2b!=='id'&&_0x36bd2b!=='tags'&&_0x36bd2b!==_0x3342('0x14a')&&_0x36bd2b!==_0x3342('0x14b')){_0x128dd1[util['format'](_0x3342('0x14c'),_0x3342('0x14d'),_[_0x3342('0x14e')](_0x36bd2b))]=_0x5c5ee7[_0x3342('0x134')][_0x36bd2b];}}}var _0x570147=_0x31f0ae[_0x3342('0x106')](_0x281ffa['Trunk'])?getCallerId(_0x281ffa[_0x3342('0x6e')]['callerid'],_0x281ffa[_0x3342('0x55')],_0x281ffa['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x281ffa[_0x3342('0x14f')],_0x281ffa['dialRandomLastDigitCallerIdNumber']):_0x281ffa['dialOriginateCallerIdNumber']):getCallerId(_[_0x3342('0xc1')](_0x281ffa[_0x3342('0x150')])?_0x281ffa[_0x3342('0x6e')][_0x3342('0x151')]:_0x281ffa[_0x3342('0x150')][_0x3342('0x151')],_0x281ffa[_0x3342('0x55')],_0x281ffa[_0x3342('0x152')]>0x0?getCallerIdRandom(_0x281ffa['dialOriginateCallerIdNumber'],_0x281ffa[_0x3342('0x152')]):_0x281ffa['dialOriginateCallerIdNumber']);if(_0x570147){_0x128dd1[_0x3342('0x153')]=_0x31f0ae['actions'][_0x1e49ef][_0x3342('0x154')]=extractCalleridName(_0x570147);_0x128dd1[_0x3342('0x155')]=_0x31f0ae['actions'][_0x1e49ef][_0x3342('0x156')]=extractCalleridNumber(_0x570147);}return ami[_0x3342('0x98')]({'actionid':_0x1e49ef,'action':_0x3342('0x132'),'channel':_0x31f0ae['isTrunkReachable'](_0x281ffa['Trunk'])?util['format'](_0x3342('0x157'),_0x281ffa[_0x3342('0x6e')][_0x3342('0x3e')],isNotNull(_0x281ffa[_0x3342('0x57')])?_0x281ffa[_0x3342('0x57')][_0x3342('0x158')]()||'':'',_0x281ffa[_0x3342('0x159')]>0x0?_0x5c5ee7[_0x3342('0x134')][_0x3342('0x135')][_0x3342('0x15a')](_0x281ffa[_0x3342('0x159')]):_0x5c5ee7[_0x3342('0x134')][_0x3342('0x135')]):util[_0x3342('0x70')](_0x3342('0x157'),_[_0x3342('0xc1')](_0x281ffa['TrunkBackup'])?_0x281ffa[_0x3342('0x6e')][_0x3342('0x3e')]:_0x281ffa[_0x3342('0x150')][_0x3342('0x3e')],isNotNull(_0x281ffa[_0x3342('0x57')])?_0x281ffa[_0x3342('0x57')][_0x3342('0x158')]()||'':'',_0x281ffa[_0x3342('0x159')]>0x0?_0x5c5ee7[_0x3342('0x134')][_0x3342('0x135')]['substring'](_0x281ffa[_0x3342('0x159')]):_0x5c5ee7[_0x3342('0x134')][_0x3342('0x135')]),'callerid':_0x570147,'Exten':_0x3342('0xc5'),'Context':_0x3342('0x15b'),'Priority':'1','variable':_0x128dd1,'timeout':(_0x281ffa[_0x3342('0x56')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1e49ef})['then'](function(_0x2de430){return _0x20cdbc(_0x2de430);})[_0x3342('0x9b')](function(_0x7a894){_0x281ffa['outboundOriginateFailureCallsDay']+=0x1;var _0x1b5e97=new History(_0x31f0ae[_0x3342('0x25')][_0x1e49ef]);logger[_0x3342('0x83')](util['format'](_0x3342('0x15c'),JSON[_0x3342('0x46')](_0x7a894)));_0x1b5e97[_0x3342('0xc9')]=0xe;_0x1b5e97['statedesc']=_0x3342('0x15d');_0x1b5e97[_0x3342('0x15e')]=moment()[_0x3342('0x70')](_0x3342('0xe0'));_0x1b5e97[_0x3342('0x95')]=_0x1b5e97[_0x3342('0x15e')];_0x31f0ae['createHistory'](_0x1b5e97)[_0x3342('0x9b')](loggerCatch(_0x3342('0x15f')));_0x31f0ae[_0x3342('0xaf')](_0x1b5e97)['catch'](loggerCatch(_0x3342('0x15f')))[_0x3342('0x1d')](function(){delete _0x31f0ae[_0x3342('0x25')][_0x1e49ef];return _0x162b8f(msgResponse(_0x3342('0x132'),_0x3342('0x160'),_0x3342('0x161')));});});});};Dialer[_0x3342('0x1a')][_0x3342('0x30')]=function(_0x535077){var _0x28d2ce=this[_0x3342('0x25')][_0x535077[_0x3342('0xee')]];var _0x2fc75d=this;if(_0x28d2ce){delete this[_0x3342('0x25')][_0x535077[_0x3342('0xee')]];_0x28d2ce[_0x3342('0x162')]=moment()[_0x3342('0x70')](_0x3342('0xe0'));var _0x4fa92d=_0x28d2ce[_0x3342('0x9d')]==='ivr'?this['campaigns'][_0x28d2ce[_0x3342('0x9f')]]:this['voiceQueues'][_0x28d2ce[_0x3342('0x163')]()];if(!this[_0x3342('0xbc')](_0x535077['response'])){this[_0x3342('0x9e')](_0x4fa92d);return this[_0x3342('0x164')](_0x28d2ce,_0x4fa92d,_0x535077)[_0x3342('0xa2')](function(_0x1ad011){})[_0x3342('0x9b')](loggerCatch(_0x3342('0x165')));}else{this['uniqueId'][_0x535077[_0x3342('0xc8')]]=_0x28d2ce;}}};Dialer[_0x3342('0x1a')][_0x3342('0x166')]=function(_0x51ab92,_0x2015e,_0x2f0e88){var _0x4240b1=new History(_0x2015e);if(_0x4240b1[_0x3342('0x167')]+_0x4240b1[_0x3342('0x168')]+_0x4240b1['countnoanswerretry']>=_0x2f0e88[_0x3342('0x169')]-0x1){return!![];}switch(_0x51ab92){case 0x3:if(_0x4240b1['countnoanswerretry']>=_0x2f0e88[_0x3342('0x16a')]-0x1){return!![];}else{this[_0x3342('0xa9')]({'active':![],'countnoanswerretry':_0x4240b1[_0x3342('0x16b')]+=0x1,'scheduledat':moment()['add'](_0x2f0e88[_0x3342('0x16c')],_0x3342('0x16d'))[_0x3342('0x70')](_0x3342('0xe0')),'ContactId':_0x4240b1[_0x3342('0xb7')],'ListId':_0x4240b1['ListId'],'VoiceQueueId':_0x4240b1['VoiceQueueId']||undefined,'CampaignId':_0x4240b1[_0x3342('0xbb')]||undefined})['catch'](loggerCatch(_0x3342('0x16e')));}break;case 0x5:if(_0x4240b1['countbusyretry']>=_0x2f0e88[_0x3342('0x16f')]-0x1){return!![];}else{this[_0x3342('0xa9')]({'active':![],'countbusyretry':_0x4240b1[_0x3342('0x167')]+=0x1,'scheduledat':moment()[_0x3342('0x170')](_0x2f0e88[_0x3342('0x171')],_0x3342('0x16d'))[_0x3342('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4240b1[_0x3342('0xb7')],'ListId':_0x4240b1[_0x3342('0xb8')],'VoiceQueueId':_0x4240b1[_0x3342('0xba')]||undefined,'CampaignId':_0x4240b1[_0x3342('0xbb')]||undefined})[_0x3342('0x9b')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x4240b1[_0x3342('0x168')]>=_0x2f0e88[_0x3342('0x172')]-0x1){return!![];}else{this[_0x3342('0xa9')]({'active':![],'countcongestionretry':_0x4240b1[_0x3342('0x168')]+=0x1,'scheduledat':moment()[_0x3342('0x170')](_0x2f0e88[_0x3342('0x173')],_0x3342('0x16d'))[_0x3342('0x70')](_0x3342('0xe0')),'ContactId':_0x4240b1[_0x3342('0xb7')],'ListId':_0x4240b1[_0x3342('0xb8')],'VoiceQueueId':_0x4240b1[_0x3342('0xba')]||undefined,'CampaignId':_0x4240b1['CampaignId']||undefined})[_0x3342('0x9b')](loggerCatch(_0x3342('0x174')));}break;default:return!![];}};Dialer[_0x3342('0x1a')][_0x3342('0x164')]=function(_0x520037,_0x252923,_0x421ae0){var _0xa37061=this;var _0x566012=new History(_0x520037);return new BPromise(function(_0x22f724,_0x564c0b){if(_[_0x3342('0x39')](_0x252923)&&_0x3342('0x131')!==typeof _0x252923){return _0x564c0b(msgResponse(_0x3342('0x175'),_0x3342('0x10f'),'entity\x20is\x20undefine'));}if(_[_0x3342('0x39')](_0x421ae0)&&_0x3342('0x131')!==typeof _0x421ae0){return _0x564c0b(msgResponse(_0x3342('0x175'),_0x3342('0x10f'),_0x3342('0x176')));}switch(_0x421ae0['reason']){case'0':_0x252923['outboundNoSuchCallsDay']+=0x1;_0x566012[_0x3342('0xc9')]=0x0;_0x566012[_0x3342('0x94')]=_0x3342('0x177');_0xa37061[_0x3342('0xb0')](_0x566012)[_0x3342('0x9b')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xa37061[_0x3342('0x166')](0x0,_0x520037,_0x252923)){if(_0x566012['countbusyretry']+_0x566012[_0x3342('0x168')]+_0x566012['countnoanswerretry']>=_0x252923[_0x3342('0x169')]){_0xa37061['stateGlobal'](_0x566012,_0x22f724,_0x564c0b,'reason\x200\x20no\x20such\x20number....');}else{_0xa37061[_0x3342('0x178')](_0x566012,_0x22f724,_0x564c0b,_0x3342('0x179'));}}break;case'3':_0x252923[_0x3342('0x5e')]+=0x1;_0x566012[_0x3342('0xc9')]=0x3;_0x566012[_0x3342('0x94')]=_0x3342('0x17a');_0x566012[_0x3342('0x16b')]+=0x1;_0x566012[_0x3342('0x17b')]+=0x1;_0xa37061[_0x3342('0xb0')](_0x566012)['catch'](loggerCatch(_0x3342('0x17c')));if(_0xa37061[_0x3342('0x166')](0x3,_0x520037,_0x252923)){if(_0x566012[_0x3342('0x16b')]>=_0x252923[_0x3342('0x16a')]){_0xa37061['createStateFinal'](_0x566012,_0x22f724,_0x564c0b,'reason\x203\x20ringing\x20no\x20answer');}else{_0xa37061['stateGlobal'](_0x566012,_0x22f724,_0x564c0b,_0x3342('0x17d'));}}break;case'5':_0x252923[_0x3342('0x5b')]+=0x1;_0x566012[_0x3342('0xc9')]=0x5;_0x566012[_0x3342('0x94')]=_0x3342('0x17e');_0x566012['countbusyretry']+=0x1;_0x566012[_0x3342('0x17b')]+=0x1;_0xa37061[_0x3342('0xb0')](_0x566012)[_0x3342('0x9b')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0xa37061['checkRetriveMax'](0x5,_0x520037,_0x252923)){if(_0x566012[_0x3342('0x167')]>=_0x252923[_0x3342('0x16f')]){_0xa37061['createStateFinal'](_0x566012,_0x22f724,_0x564c0b,_0x3342('0x17f'));}else{_0xa37061[_0x3342('0x180')](_0x566012,_0x22f724,_0x564c0b,_0x3342('0x17f'));}}break;case'8':_0x252923[_0x3342('0x5c')]+=0x1;_0x566012[_0x3342('0xc9')]=0x8;_0x566012[_0x3342('0x94')]=_0x3342('0x181');_0x566012['countcongestionretry']+=0x1;_0x566012[_0x3342('0x17b')]+=0x1;_0xa37061['createHistory'](_0x566012)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0xa37061[_0x3342('0x166')](0x8,_0x520037,_0x252923)){if(_0x566012[_0x3342('0x168')]>=_0x252923[_0x3342('0x172')]){_0xa37061['createStateFinal'](_0x566012,_0x22f724,_0x564c0b,_0x3342('0x182'));}else{_0xa37061[_0x3342('0x180')](_0x566012,_0x22f724,_0x564c0b,_0x3342('0x182'));}}break;default:_0x252923[_0x3342('0x63')]+=0x1;_0x566012[_0x3342('0xc9')]=0xc;_0x566012[_0x3342('0x94')]=_0x421ae0[_0x3342('0x183')];_0xa37061['createHistory'](_0x566012)[_0x3342('0x9b')](loggerCatch(_0x3342('0x184')));if(_0xa37061['checkRetriveMax'](_0x421ae0[_0x3342('0x183')],_0x520037,_0x252923)){if(_0x566012['countbusyretry']+_0x566012[_0x3342('0x168')]+_0x566012['countnoanswerretry']>=_0x252923[_0x3342('0x169')]){_0xa37061[_0x3342('0x180')](_0x566012,_0x22f724,_0x564c0b,_0x421ae0[_0x3342('0x183')]);}else{_0xa37061[_0x3342('0x178')](_0x566012,_0x22f724,_0x564c0b,_0x421ae0[_0x3342('0x183')]);}}}});};Dialer['prototype'][_0x3342('0x180')]=function(_0x32df70,_0xc0bcd9,_0x3fcf9b,_0x49cb65){var _0x20fa19=new Final(_0x32df70);_0x20fa19[_0x3342('0xc9')]=0xf;_0x20fa19[_0x3342('0x94')]=_0x3342('0x185');this[_0x3342('0x178')](_0x20fa19,_0xc0bcd9,_0x3fcf9b,_0x49cb65);};Dialer['prototype'][_0x3342('0x178')]=function(_0x569daf,_0x148b3d,_0x3dce77,_0x1d4169){this[_0x3342('0xaf')](_0x569daf)[_0x3342('0xa2')](function(_0xe7e7b0){return _0x148b3d(msgResponse(_0x3342('0x175'),_0x3342('0xbd'),_0x1d4169));})[_0x3342('0x9b')](function(_0x5d3830){return _0x3dce77(msgResponse(_0x3342('0x186'),'Failure',_0x3342('0x187')));});};Dialer[_0x3342('0x1a')][_0x3342('0x9')]=function(_0x42cc64){var _0x2cd257=this;var _0x56ec0c=_0x42cc64[_0x3342('0x188')]/0x64;var _0x39975f=_0x42cc64[_0x3342('0xe7')]/(_0x42cc64['outboundDropCallsDayTimeout']+_0x42cc64[_0x3342('0x59')]);var _0x2d3a68=_0x42cc64[_0x3342('0x4d')]-_0x42cc64[_0x3342('0x6b')]-_0x42cc64['waiting']-_0x42cc64[_0x3342('0x6d')]-_0x42cc64['talking'];var _0x31191d=(_0x42cc64[_0x3342('0x4d')]-_0x42cc64[_0x3342('0x6b')])*_0x42cc64['predictiveIntervalLowerLimit'];var _0x491e3d=Math[_0x3342('0x189')](_0x42cc64['erlangCalls']*_0x42cc64[_0x3342('0x18a')]*_0x42cc64['predictiveIntervalHitRate']*_0x42cc64[_0x3342('0x18b')]);if(_[_0x3342('0x39')](_0x42cc64['startProgressive'])){loggerPredictive[_0x3342('0x75')](_0x3342('0x18c'));if(!_[_0x3342('0x39')](_0x42cc64[_0x3342('0x7e')])){_0x42cc64['startPredictive']=undefined;loggerPredictive[_0x3342('0x83')](_0x3342('0x18d'),_0x3342('0x18e'));}if(!_[_0x3342('0x39')](_0x42cc64[_0x3342('0x7f')])){loggerPredictive['error'](_0x3342('0x18d'),_0x3342('0x18f'));clearInterval(_0x42cc64[_0x3342('0x7f')]);_0x42cc64[_0x3342('0x7f')]=undefined;}_0x42cc64[_0x3342('0x28')]=moment()[_0x3342('0x70')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info']('[startMethodPredictive][StartProgressive][Date]',_0x42cc64['startProgressive'],_0x42cc64[_0x3342('0x3e')]);this[_0x3342('0x11f')](_0x42cc64,0x1);}else if(ifInterval(_0x42cc64[_0x3342('0x190')],_0x42cc64[_0x3342('0x28')])){this[_0x3342('0x11f')](_0x42cc64,0x1);loggerPredictiveCalls[_0x3342('0x75')](_0x3342('0x191'),_0x42cc64[_0x3342('0x28')],_0x42cc64[_0x3342('0x3e')]);_0x42cc64[_0x3342('0x192')]=0x0;_0x42cc64[_0x3342('0x69')]=0x0;}else if(_0x56ec0c<_0x39975f&&_0x42cc64[_0x3342('0x193')]==='dropRate'){freeVariablesPredictive(_0x42cc64);loggerPredictive[_0x3342('0x75')](_0x3342('0x194'),_0x3342('0x195'),_0x39975f,_0x3342('0x28'),_0x42cc64[_0x3342('0x3e')]);}else if(_0x2d3a68>_0x31191d){freeVariablesPredictive(_0x42cc64);loggerPredictive[_0x3342('0x75')](_0x3342('0x196'),'Agent\x20free',_0x2d3a68,'agent\x20max\x20free\x20',_0x31191d);}else if(_0x491e3d<_0x42cc64[_0x3342('0x69')]&&_0x42cc64['dialPredictiveOptimization']===_0x3342('0x197')){freeVariablesPredictive(_0x42cc64);loggerPredictive[_0x3342('0x75')](_0x3342('0x198'),_0x3342('0x199'),_0x491e3d,_0x3342('0x19a'),_0x42cc64['predictiveIntervalErlangCallsDroppedCalls'],_0x3342('0x28'),_0x42cc64['name']);}else if(!ifInterval(_0x42cc64[_0x3342('0x190')],_0x42cc64[_0x3342('0x28')])&&_[_0x3342('0x39')](_0x42cc64[_0x3342('0x7e')])&&!_[_0x3342('0x39')](_0x42cc64[_0x3342('0x28')])){_0x42cc64['startPredictive']=moment()[_0x3342('0x70')](_0x3342('0xe0'));loggerPredictive[_0x3342('0x75')](_0x3342('0x19b'),_0x42cc64[_0x3342('0x7e')],_0x42cc64[_0x3342('0x3e')]);this[_0x3342('0xa7')](_0x42cc64[_0x3342('0x190')])[_0x3342('0xa2')](this[_0x3342('0x19c')](_0x42cc64))[_0x3342('0xa2')](mergeDataErlangB(_0x42cc64))['then'](this[_0x3342('0x19d')](_0x42cc64))['catch'](loggerCatchPredictive(_0x3342('0x19e'),_0x42cc64));}else if(!ifInterval(_0x42cc64[_0x3342('0x190')],_0x42cc64[_0x3342('0x7e')])){_0x42cc64[_0x3342('0x69')]=0x0;_0x42cc64['startPredictive']=moment()[_0x3342('0x70')](_0x3342('0xe0'));loggerPredictive[_0x3342('0x75')]('[startMethodPredictive][StartPredictive][Repeat]',_0x42cc64[_0x3342('0x7e')],_0x42cc64[_0x3342('0x3e')]);clearInterval(_0x42cc64[_0x3342('0x7f')]);_0x42cc64[_0x3342('0x7f')]=undefined;this[_0x3342('0xa7')](_0x42cc64[_0x3342('0x190')])[_0x3342('0xa2')](this[_0x3342('0x19c')](_0x42cc64))['then'](mergeDataErlangB(_0x42cc64))[_0x3342('0xa2')](this[_0x3342('0x19d')](_0x42cc64))[_0x3342('0x9b')](loggerCatchPredictive(_0x3342('0x19e'),_0x42cc64));}};Dialer[_0x3342('0x1a')][_0x3342('0x19c')]=function(_0x56386e){var _0x47f58a=this;return function(_0x30dbf0){return new BPromise(function(_0x388f95,_0x136064){_[_0x3342('0x7c')](_0x56386e,_0x30dbf0[0x0]);if(checkGetDataPredictive(_0x30dbf0[0x0])){loggerPredictive[_0x3342('0x75')](JSON['stringify'](_0x30dbf0[0x0]));if(_0x56386e['dialPredictiveOptimization']===_0x3342('0x197')){return _0x47f58a['getVoiceQueueRtPauses'](_0x56386e['id'])[_0x3342('0xa2')](function(_0x4b1d30){var _0x40348d=_0x56386e[_0x3342('0x4d')]-_0x4b1d30[0x0][_0x3342('0x19f')];var _0x206026=_0x56386e[_0x3342('0x190')]*0x3c;var _0x17fc13=_0x30dbf0[0x0]['predictiveIntervalAvgTalktime']+_0x30dbf0[0x0][_0x3342('0x64')];var _0x1ecae0=(_0x30dbf0[0x0][_0x3342('0x1a0')]+_0x30dbf0[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x30dbf0[0x0][_0x3342('0x66')])/_0x30dbf0[0x0]['predictiveIntervalTotalCalls'];var _0x30c176=_0x56386e['dialPredictiveOptimizationPercentage']/0x64;_0x56386e[_0x3342('0x6b')]=_0x4b1d30[0x0][_0x3342('0x19f')]||0x0;_0x56386e['predictiveIntervalHitRate']=_0x1ecae0>0x0?_0x1ecae0:0x1;return _0x47f58a['abandonmentRate'](_0x40348d,_0x206026,_0x17fc13,_0x1ecae0,_0x30c176);})[_0x3342('0xa2')](function(_0x1643d2){return _0x388f95(_0x1643d2);})[_0x3342('0x9b')](function(_0x45ab3b){return _0x136064(msgResponse('[CatchErlangB]',_0x3342('0x10f'),JSON[_0x3342('0x46')](_0x45ab3b)));});}if(_0x56386e['dialPredictiveOptimization']===_0x3342('0x1a1')){return _0x47f58a[_0x3342('0xae')](_0x56386e['id'])[_0x3342('0xa2')](function(_0x499266){var _0x1a8413=_0x56386e[_0x3342('0x4d')]-_0x499266[0x0][_0x3342('0x19f')];var _0x19e71e=_0x56386e[_0x3342('0x190')]*0x3c;var _0x8c022=_0x30dbf0[0x0]['predictiveIntervalAvgTalktime']+_0x30dbf0[0x0][_0x3342('0x64')];var _0x3976cd=(_0x30dbf0[0x0]['predictiveIntervalAnsweredCalls']+_0x30dbf0[0x0][_0x3342('0x67')]+_0x30dbf0[0x0][_0x3342('0x66')])/_0x30dbf0[0x0][_0x3342('0x6c')];var _0x12d97=_0x56386e[_0x3342('0x188')]/0x64;_0x56386e[_0x3342('0x6b')]=_0x499266[0x0]['outboundQueuePauses']||0x0;_0x56386e[_0x3342('0x1a2')]=_0x3976cd>0x0?_0x3976cd:0x1;return _0x47f58a[_0x3342('0x1a3')](_0x1a8413,_0x19e71e,_0x8c022,_0x3976cd,_0x12d97);})['then'](function(_0x49c005){return _0x388f95(_0x49c005);})['catch'](function(_0x53a656){return _0x136064(msgResponse(_0x3342('0x1a4'),_0x3342('0x10f'),JSON[_0x3342('0x46')](_0x53a656)));});}}else{return _0x136064(msgResponse(_0x3342('0x1a5'),'Failure',_0x3342('0x1a6')));}});};};Dialer[_0x3342('0x1a')][_0x3342('0x19d')]=function(_0x3d07b5){var _0x54f8b5=this;return function(){var _0x5726e8=0x0;var _0x3900e3=Math['floor'](_0x3d07b5[_0x3342('0x1a7')]*0x3e8);if(_0x3900e3>0x0){_0x3900e3=_0x3900e3<0x64?0x64:_0x3900e3;loggerPredictive[_0x3342('0x75')](_0x3342('0x1a8'),_0x3900e3);_0x3d07b5[_0x3342('0x7f')]=setInterval(function(){_0x54f8b5['handlePredictive'](_0x3d07b5);loggerPredictiveCalls[_0x3342('0x75')](_0x3342('0x1a9'),_0x5726e8+=0x1);},_0x3900e3);}else{loggerPredictive[_0x3342('0x75')]('[startMethodPredictive][milliseconds]\x20',_0x3342('0x1aa'),_0x3900e3);}};};Dialer[_0x3342('0x1a')]['checkContactBlack']=function(_0x34223d,_0x397453){var _0xbbbee7=this;return function(_0x2b7f38){if(_[_0x3342('0x44')](_0x2b7f38)){if(_[_0x3342('0xc1')](_0x397453['UserId'])||!_0x397453['recallme']){if(_0x34223d[_0x3342('0x54')]===_0x3342('0x8')){_0x34223d['queueStatusComplete']=_[_0x3342('0x39')](_0x34223d[_0x3342('0xf4')])?!![]:_0x34223d[_0x3342('0xf4')];var _0xb0e18d=uuid['v4']();_0xbbbee7[_0x3342('0x25')][_0xb0e18d]=new Action(_0x34223d,_0x397453,_0xb0e18d);loggerBooked['info'](_0x3342('0x1ab'),_0xb0e18d,_0x3342('0x1ac'),JSON[_0x3342('0x46')](_0x34223d[_0x3342('0xf4')]),_0x3342('0x1ad'),_0x34223d[_0x3342('0x3e')]);if(_0x34223d['queueStatusComplete']){_0x34223d[_0x3342('0xf4')]=![];_0xbbbee7[_0x3342('0xf2')][_0xbbbee7['actions'][_0xb0e18d][_0x3342('0x9f')]]=[];ami[_0x3342('0x98')]({'actionid':_0xb0e18d,'action':_0x3342('0x1ae'),'queue':_0x34223d[_0x3342('0x3e')]})[_0x3342('0x9b')](function(_0x39355a){_0xbbbee7[_0x3342('0x9e')](_0x34223d);_0xbbbee7[_0x3342('0xa9')]({'active':![],'ContactId':_0xbbbee7[_0x3342('0x25')][_0xb0e18d][_0x3342('0xb7')],'ListId':_0xbbbee7[_0x3342('0x25')][_0xb0e18d]['ListId'],'VoiceQueueId':_0xbbbee7[_0x3342('0x25')][_0xb0e18d][_0x3342('0xba')]||undefined,'CampaignId':_0xbbbee7[_0x3342('0x25')][_0xb0e18d][_0x3342('0xbb')]||undefined})[_0x3342('0x9b')](loggerCatch(_0x3342('0x1af')));delete _0xbbbee7[_0x3342('0x25')][_0xb0e18d];});}else{loggerBooked[_0x3342('0x75')](_0x3342('0x1b0'),JSON['stringify'](_0x34223d[_0x3342('0xf4')]),_0x3342('0x1ad'),_0x34223d['name']);_0xbbbee7[_0x3342('0x9e')](_0x34223d);_0xbbbee7[_0x3342('0xa9')]({'active':![],'ContactId':_0xbbbee7[_0x3342('0x25')][_0xb0e18d][_0x3342('0xb7')],'ListId':_0xbbbee7[_0x3342('0x25')][_0xb0e18d][_0x3342('0xb8')],'VoiceQueueId':_0xbbbee7[_0x3342('0x25')][_0xb0e18d][_0x3342('0xba')]||undefined,'CampaignId':_0xbbbee7[_0x3342('0x25')][_0xb0e18d][_0x3342('0xbb')]||undefined})[_0x3342('0x9b')](loggerCatch(_0x3342('0x1af')));delete _0xbbbee7[_0x3342('0x25')][_0xb0e18d];}}else{return _0xbbbee7['actionOriginate'](_0x34223d,_0x397453);}}else{if(getDiff(_0x397453['scheduledat'])<_0x34223d['dialRecallMeTimeout']*0x3c){_0xbbbee7[_0x3342('0x1e')]['run'](_0x397453['id'])[_0x3342('0x1d')](function(){_0xbbbee7[_0x3342('0x9e')](_0x34223d);});}else{_0x34223d[_0x3342('0x61')]+=0x1;_0xbbbee7[_0x3342('0x9e')](_0x34223d);if(_0x34223d['dialRecallInQueue']){_0xbbbee7['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x397453[_0x3342('0xb7')],'ListId':_0x397453[_0x3342('0xb8')],'VoiceQueueId':_0x397453[_0x3342('0xba')]||undefined,'CampaignId':_0x397453[_0x3342('0xbb')]||undefined})[_0x3342('0x9b')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0xbbbee7[_0x3342('0xb0')](createObjHistory(_0x34223d,_0x397453,_0x3342('0x1b1'),0x17,_0x3342('0x1b2')))['catch'](loggerCatch(_0x3342('0x1b3')));}else{_0xbbbee7[_0x3342('0xb5')](createObjHistory(_0x34223d,_0x397453,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),_0x3342('0x1b4'),_0x3342('0x1b5'));}}}}else{_0x34223d[_0x3342('0x5a')]+=0x1;_0xbbbee7[_0x3342('0xb5')](createObjHistory(_0x34223d,_0x397453,_0x3342('0x1b6'),0xd,_0x3342('0x1b7')),_0x3342('0x1b8'),_0x3342('0x1b9'));throw'inBlackList';}};};Dialer['prototype'][_0x3342('0x125')]=function(_0xc237d){var _0x432ae9=this;var _0x2771ce=[];var _0x53d7da=_0xc237d['limitCalls']-_0xc237d['originated']-_0xc237d['temp'];emitCampaignSummary(_0xc237d);if(_0x53d7da>0x0){if(_0x53d7da>this['maxNumberOriginate']){_0x53d7da=this['maxNumberOriginate'];}_0xc237d[_0x3342('0x1ba')]+=_0x53d7da;this[_0x3342('0xac')](_0xc237d['id'],_0x53d7da,_0xc237d[_0x3342('0x1bb')])[_0x3342('0xa2')](function(_0x492dbf){_0xc237d[_0x3342('0x1ba')]-=_0x53d7da;_0xc237d[_0x3342('0x1ba')]=_0xc237d[_0x3342('0x1ba')]>0x0?_0xc237d['temp']:0x0;if(!checkContactEmpty(_0x492dbf)){_0xc237d[_0x3342('0x3a')]=_0x3342('0x8a');logger['info'](_0x3342('0x1bc')+_0xc237d[_0x3342('0x3e')]);}else{_0xc237d[_0x3342('0x6d')]+=_0x492dbf[_0x3342('0xf9')];_0xc237d[_0x3342('0x3a')]=_0x3342('0x1bd');for(var _0x188f20=0x0;_0x188f20<_0x492dbf[_0x3342('0xf9')];_0x188f20+=0x1){_0xc237d[_0x3342('0x1be')]+=0x1;if(_[_0x3342('0xc1')](_0x492dbf[_0x188f20])||_[_0x3342('0xc1')](_0x492dbf[_0x188f20][_0x3342('0x134')])||_[_0x3342('0xc1')](_0x492dbf[_0x188f20][_0x3342('0x134')][_0x3342('0x135')])){_0x432ae9['emptyContact'](_0x3342('0x1bf'),_0xc237d,_0x492dbf[_0x188f20]);}else{_0x432ae9[_0x3342('0xa5')](_['pick'](_0x492dbf[_0x188f20],[_0x3342('0xbb'),'Contact.phone']))[_0x3342('0xa2')](_0x432ae9[_0x3342('0x1c0')](_0xc237d,_0x492dbf[_0x188f20]))[_0x3342('0x9b')](_0x432ae9['loggerHandler'](_0x3342('0x1c1'),_0xc237d));}}}})[_0x3342('0x9b')](loggerGetContactDialer(_0x3342('0x1c2'),_0xc237d,_0x53d7da));}};Dialer[_0x3342('0x1a')][_0x3342('0x11f')]=function(_0x13404a,_0x27eb41){var _0x2057a0=this;var _0x3f29cf=[];var _0x47ed63=_0x27eb41>=0x1?_0x27eb41:0x1;var _0x32c4f6=[];if(_0x13404a[_0x3342('0x54')]===_0x3342('0x8')){_0x47ed63=0x1;}var _0x25d356=Math[_0x3342('0x189')](_0x13404a[_0x3342('0x4c')]*_0x47ed63)-_0x13404a[_0x3342('0x6d')]-_0x13404a[_0x3342('0x1ba')];emitVoiceQueueSummary(_0x13404a);if(_0x13404a[_0x3342('0x1c3')]>0x0){var _0x1d5558=_0x13404a[_0x3342('0x1c3')]-_0x13404a['originated']-_0x13404a[_0x3342('0x50')]-_0x13404a[_0x3342('0x1ba')]-_0x13404a[_0x3342('0x8e')];if(_0x25d356>_0x1d5558){_0x25d356=_0x1d5558;}}if(_0x25d356>0x0){if(_0x13404a['dialMethod']===_0x3342('0x8')){_0x25d356=0x1;}if(_0x25d356>this[_0x3342('0x23')]){_0x25d356=this['maxNumberOriginate'];}_0x13404a[_0x3342('0x1ba')]+=_0x25d356;for(var _0x4f9edb in this[_0x3342('0x21')]){if(this[_0x3342('0x21')][_0x3342('0x85')](_0x4f9edb)){if(this[_0x3342('0x21')][_0x4f9edb]['state']==='not_inuse'&&this['agents'][_0x4f9edb]['status']===_0x3342('0xbf')){_0x3f29cf[_0x3342('0x111')](this[_0x3342('0x21')][_0x4f9edb]['id']);}}}this[_0x3342('0xab')](_0x13404a['id'],_0x3f29cf,_0x25d356,_0x13404a[_0x3342('0x1bb')])[_0x3342('0xa2')](function(_0x39c24c){_0x13404a[_0x3342('0x1ba')]-=_0x25d356;_0x13404a[_0x3342('0x1ba')]=_0x13404a[_0x3342('0x1ba')]>0x0?_0x13404a[_0x3342('0x1ba')]:0x0;if(!checkContactEmpty(_0x39c24c)){_0x2057a0[_0x3342('0xa1')](_0x13404a)[_0x3342('0xa2')](sendMessageReschedule(_0x13404a))['catch'](loggerCatch(_0x3342('0x1c4')));}else{_0x13404a[_0x3342('0x6d')]+=_0x39c24c[_0x3342('0xf9')];_0x13404a['message']=_0x13404a['dialMethod']===_0x3342('0x8')?_0x3342('0x13b'):_0x3342('0x1bd');for(var _0x1bf5c8=0x0;_0x1bf5c8<_0x39c24c[_0x3342('0xf9')];_0x1bf5c8+=0x1){if(_[_0x3342('0xc1')](_0x39c24c[_0x1bf5c8])||_[_0x3342('0xc1')](_0x39c24c[_0x1bf5c8][_0x3342('0x134')])||_['isNil'](_0x39c24c[_0x1bf5c8]['Contact']['phone'])){_0x2057a0[_0x3342('0xb3')]('[actionOriginate]\x20',_0x13404a,_0x39c24c[_0x1bf5c8]);}else{_0x2057a0[_0x3342('0xa3')](_[_0x3342('0xb6')](_0x39c24c[_0x1bf5c8],[_0x3342('0xba'),_0x3342('0x1c5')]))['then'](_0x2057a0[_0x3342('0x1c0')](_0x13404a,_0x39c24c[_0x1bf5c8]))[_0x3342('0x9b')](_0x2057a0['loggerHandler']('[actionOriginate]\x20',_0x13404a));}}}})[_0x3342('0x9b')](loggerGetContactDialer('[getContactDialer2]',_0x13404a,_0x25d356));}};Dialer[_0x3342('0x1a')][_0x3342('0x7f')]=function(_0x2785ac){var _0x192ffe=this;if(_0x2785ac[_0x3342('0x1c3')]>0x0){var _0xadbc3=_0x2785ac[_0x3342('0x1c3')]-_0x2785ac[_0x3342('0x6d')]-_0x2785ac['talking'];if(_0xadbc3>0x0){this[_0x3342('0x1c6')](_0x2785ac);}else{loggerPredictiveCalls[_0x3342('0x75')]('[handlePredictive][limitChannel]');}}else{this[_0x3342('0x1c6')](_0x2785ac);}};Dialer[_0x3342('0x1a')][_0x3342('0x1c6')]=function(_0x475fd2){var _0x4db844=this;var _0x400f42=[];_0x475fd2['originated']+=0x1;for(var _0x390f37 in this[_0x3342('0x21')]){if(this['agents'][_0x3342('0x85')](_0x390f37)){if(this[_0x3342('0x21')][_0x390f37]['state']===_0x3342('0x1c7')&&this['agents'][_0x390f37][_0x3342('0x99')]==='reachable'){_0x400f42[_0x3342('0x111')](this['agents'][_0x390f37]['id']);}}}this[_0x3342('0xab')](_0x475fd2['id'],_0x400f42,0x1,_0x475fd2[_0x3342('0x1bb')])[_0x3342('0xa2')](function(_0x34e941){if(!checkContactEmpty(_0x34e941)){checkContactLowerLimitOriginate(_0x475fd2,0x1,0x0);_0x4db844[_0x3342('0xa1')](_0x475fd2)[_0x3342('0xa2')](sendMessageReschedule(_0x475fd2))[_0x3342('0x9b')](loggerCatch(_0x3342('0x1c4')));}else{_0x475fd2[_0x3342('0x3a')]=_0x3342('0x1bd');if(_[_0x3342('0xc1')](_0x34e941[0x0])||_[_0x3342('0xc1')](_0x34e941[0x0][_0x3342('0x134')])||_[_0x3342('0xc1')](_0x34e941[0x0]['Contact']['phone'])){_0x4db844[_0x3342('0xb3')](_0x3342('0x1bf'),_0x475fd2,_0x34e941[0x0]);}else{_0x4db844[_0x3342('0xa3')](_[_0x3342('0xb6')](_0x34e941[0x0],[_0x3342('0xba'),_0x3342('0x1c5')]))[_0x3342('0xa2')](_0x4db844[_0x3342('0x1c0')](_0x475fd2,_0x34e941[0x0]))[_0x3342('0x9b')](_0x4db844[_0x3342('0x1c8')](_0x3342('0x1c9'),_0x475fd2));}}})[_0x3342('0x9b')](loggerGetContactDialer(_0x3342('0x1ca'),_0x475fd2,0x1));emitVoiceQueueSummary(_0x475fd2);};Dialer[_0x3342('0x1a')][_0x3342('0x1cb')]=function(_0x370082,_0x344934,_0x555220,_0x3ba2ab,_0x423aa7,_0xbf7ab0){loggerPredictive[_0x3342('0x75')](_0x3342('0x1cc'),'\x20m\x20=\x20',_0x370082,_0x3342('0x1cd'),_0x344934,'\x20Ts\x20=\x20',_0x555220,_0x3342('0x1ce'),_0x3ba2ab,'\x20Amax\x20=\x20',_0x423aa7);return new BPromise(function(_0x10ba9f,_0x1562f6){if(_0x370082<=0x0||isNaN(_0x370082)){return _0x1562f6(msgResponse('[abandonmentRate]','Error',_0x3342('0x1cf')+_0x370082));}if(_0x555220<=0x0||isNaN(_0x555220)){return _0x1562f6(msgResponse(_0x3342('0x1cc'),_0x3342('0x160'),_0x3342('0x1d0')+_0x555220));}if(_0x3ba2ab<=0x0||isNaN(_0x3ba2ab)){return _0x1562f6(msgResponse(_0x3342('0x1cc'),_0x3342('0x160'),_0x3342('0x1d1')+_0x3ba2ab));}if(_0x344934<=0x0||isNaN(_0x344934)){return _0x1562f6(msgResponse(_0x3342('0x1cc'),'Error',_0x3342('0x1d2')+_0x344934));}if(_0x423aa7<=0x0||isNaN(_0x423aa7)){return _0x1562f6(msgResponse('[abandonmentRate]',_0x3342('0x160'),_0x3342('0x1d3')+_0x423aa7));}_0xbf7ab0=_0xbf7ab0||0x0;var _0x2953c4=0x1/_0x555220;var _0x321ffb=0x0;var _0x5341eb=0x0;var _0x48a849=0x0;var _0x56522a=0x0;for(var _0x519b34=0x0;_0x48a849<_0x423aa7;_0x519b34+=0x1){_0x5341eb=_0x519b34/_0x344934;_0x321ffb=(_0x3ba2ab*_0x5341eb+_0xbf7ab0)/_0x2953c4;_0x48a849=erlangb(_0x321ffb,_0x370082);_0x56522a=_0x321ffb/_0x370082*(0x1-erlangb(_0x321ffb,_0x370082));}return _0x10ba9f({'erlangCalls':_0x519b34,'erlangCallToSecond':_0x344934/_0x519b34,'erlangAbandonmentRate':_0x48a849,'erlangBusyFactor':_0x56522a});});};Dialer[_0x3342('0x1a')][_0x3342('0x1a3')]=function(_0x26b2ae,_0x411f7d,_0x3694da,_0xa66d52,_0x5cc965,_0x3e051e){loggerPredictive['info']('[busyFactor]','\x20m\x20=\x20',_0x26b2ae,_0x3342('0x1cd'),_0x411f7d,_0x3342('0x1d4'),_0x3694da,_0x3342('0x1ce'),_0xa66d52,_0x3342('0x1d5'),_0x5cc965);return new BPromise(function(_0x3c56f3,_0x4cdd15){if(_0x26b2ae<=0x0||isNaN(_0x26b2ae)){return _0x4cdd15(msgResponse(_0x3342('0x1cc'),_0x3342('0x160'),_0x3342('0x1cf')+_0x26b2ae));}if(_0x3694da<=0x0||isNaN(_0x3694da)){return _0x4cdd15(msgResponse('[abandonmentRate]',_0x3342('0x160'),'Ts\x20=\x20'+_0x3694da));}if(_0xa66d52<=0x0||isNaN(_0xa66d52)){return _0x4cdd15(msgResponse(_0x3342('0x1cc'),_0x3342('0x160'),_0x3342('0x1d1')+_0xa66d52));}if(_0x411f7d<=0x0||isNaN(_0x411f7d)){return _0x4cdd15(msgResponse(_0x3342('0x1cc'),_0x3342('0x160'),'interval\x20=\x20'+_0x411f7d));}if(_0x5cc965<=0x0||isNaN(_0x5cc965)){return _0x4cdd15(msgResponse(_0x3342('0x1cc'),_0x3342('0x160'),_0x3342('0x1d3')+_0x5cc965));}_0x3e051e=_0x3e051e||0x0;var _0x3bef11=0x1/_0x3694da;var _0x3a382a=0x0;var _0x36899b=0x0;var _0xf98988=0x0;var _0x5e42ad=0x0;for(var _0x2debaa=0x0;_0x5e42ad<_0x5cc965;_0x2debaa+=0x1){_0x36899b=_0x2debaa/_0x411f7d;_0x3a382a=(_0xa66d52*_0x36899b+_0x3e051e)/_0x3bef11;_0xf98988=erlangb(_0x3a382a,_0x26b2ae);_0x5e42ad=_0x3a382a/_0x26b2ae*(0x1-erlangb(_0x3a382a,_0x26b2ae));}return _0x3c56f3({'erlangCalls':_0x2debaa,'erlangCallToSecond':_0x411f7d/_0x2debaa,'erlangAbandonmentRate':_0xf98988,'erlangBusyFactor':_0x5e42ad});});};module[_0x3342('0x1d6')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 00fb755..26521cd 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 _0xb1fa=['connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername'];(function(_0xe9aede,_0x1da244){var _0x23b020=function(_0x1dc330){while(--_0x1dc330){_0xe9aede['push'](_0xe9aede['shift']());}};_0x23b020(++_0x1da244);}(_0xb1fa,0x9e));var _0xab1f=function(_0x950a15,_0x425b56){_0x950a15=_0x950a15-0x0;var _0x9e8786=_0xb1fa[_0x950a15];return _0x9e8786;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xab1f('0x0'));function getSeconds(_0x487245,_0x45034c){var _0x576d99=moment(_0x487245)['milliseconds'](0x0);var _0x4fa20a=moment(_0x45034c)['milliseconds'](0x0);return _0x576d99['diff'](_0x4fa20a,_0xab1f('0x1'));}function QueueCallerAbandon(_0x592156,_0x50ada8){this['scheduledat']=_0x592156[_0xab1f('0x2')];this['type']=_0x592156[_0xab1f('0x3')];this[_0xab1f('0x4')]=_0x592156['type']===_0xab1f('0x5')?'queue':_0x592156['type'];this[_0xab1f('0x6')]=_0x592156[_0xab1f('0x6')];this[_0xab1f('0x7')]=_0x592156[_0xab1f('0x7')];this[_0xab1f('0x8')]=_0x592156['countnoanswerretry'];this[_0xab1f('0x9')]=_0x592156['countbusyretry']+_0x592156['countcongestionretry']+_0x592156[_0xab1f('0x8')];this[_0xab1f('0xa')]=_0x50ada8['uniqueid'];this['calleridname']=_0x592156[_0xab1f('0xb')];this['calleridnum']=_0x592156[_0xab1f('0xc')];this[_0xab1f('0xd')]=_0x592156[_0xab1f('0xd')];this['responsetime']=_0x592156[_0xab1f('0xe')];this[_0xab1f('0xf')]=_0x592156[_0xab1f('0xf')];this[_0xab1f('0x10')]=this['droptime'];this[_0xab1f('0x11')]=getSeconds(_0x592156['responsetime'],_0x592156[_0xab1f('0xd')]);this[_0xab1f('0x12')]=getSeconds(this[_0xab1f('0xf')],_0x592156['responsetime']);this[_0xab1f('0x13')]=0x0;this[_0xab1f('0x14')]=_0x50ada8['queue'];this[_0xab1f('0x15')]=_0x50ada8[_0xab1f('0x16')];this[_0xab1f('0x17')]=_0x50ada8[_0xab1f('0x17')];this[_0xab1f('0x18')]=_0x592156['callback'];this[_0xab1f('0x19')]=_0x592156[_0xab1f('0x19')];this['callbackat']=_0x592156[_0xab1f('0x1a')];this[_0xab1f('0x1b')]=_0x592156['recallme'];this['ContactId']=_0x592156[_0xab1f('0x1c')];this[_0xab1f('0x1d')]=_0x592156[_0xab1f('0x1d')];this[_0xab1f('0x1e')]=_0x592156[_0xab1f('0x1e')];this[_0xab1f('0x1f')]=_0x592156[_0xab1f('0x1f')];this['CampaignId']=_0x592156[_0xab1f('0x20')];this[_0xab1f('0x21')]=_0x592156[_0xab1f('0x21')]||'';this[_0xab1f('0x22')]=_0x592156['originatecalleridname']||'';}module[_0xab1f('0x23')]=QueueCallerAbandon; \ No newline at end of file +var _0xc220=['originatecalleridnum','originatecalleridname','moment','milliseconds','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0xc220,0x1af));var _0x0c22=function(_0x5a7e0f,_0x2d5c67){_0x5a7e0f=_0x5a7e0f-0x0;var _0x2ba40a=_0xc220[_0x5a7e0f];return _0x2ba40a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x0c22('0x0'));function getSeconds(_0xa5f311,_0x156aa8){var _0x835f70=moment(_0xa5f311)[_0x0c22('0x1')](0x0);var _0x30d801=moment(_0x156aa8)[_0x0c22('0x1')](0x0);return _0x835f70['diff'](_0x30d801,_0x0c22('0x2'));}function QueueCallerAbandon(_0x2583bc,_0x172732){this[_0x0c22('0x3')]=_0x2583bc[_0x0c22('0x3')];this[_0x0c22('0x4')]=_0x2583bc['type'];this['campaigntype']=_0x2583bc[_0x0c22('0x4')]===_0x0c22('0x5')?_0x0c22('0x6'):_0x2583bc['type'];this[_0x0c22('0x7')]=_0x2583bc[_0x0c22('0x7')];this[_0x0c22('0x8')]=_0x2583bc['countcongestionretry'];this[_0x0c22('0x9')]=_0x2583bc[_0x0c22('0x9')];this[_0x0c22('0xa')]=_0x2583bc[_0x0c22('0x7')]+_0x2583bc[_0x0c22('0x8')]+_0x2583bc[_0x0c22('0x9')];this['uniqueid']=_0x172732['uniqueid'];this[_0x0c22('0xb')]=_0x2583bc[_0x0c22('0xc')];this[_0x0c22('0xd')]=_0x2583bc['number'];this[_0x0c22('0xe')]=_0x2583bc[_0x0c22('0xe')];this[_0x0c22('0xf')]=_0x2583bc[_0x0c22('0xf')];this[_0x0c22('0x10')]=_0x2583bc[_0x0c22('0x10')];this[_0x0c22('0x11')]=this[_0x0c22('0x10')];this[_0x0c22('0x12')]=getSeconds(_0x2583bc[_0x0c22('0xf')],_0x2583bc[_0x0c22('0xe')]);this[_0x0c22('0x13')]=getSeconds(this[_0x0c22('0x10')],_0x2583bc[_0x0c22('0xf')]);this['talktime']=0x0;this[_0x0c22('0x6')]=_0x172732[_0x0c22('0x6')];this['membername']=_0x172732[_0x0c22('0x14')];this[_0x0c22('0x15')]=_0x172732['reason'];this['callback']=_0x2583bc[_0x0c22('0x16')];this[_0x0c22('0x17')]=_0x2583bc['callbackuniqueid'];this[_0x0c22('0x18')]=_0x2583bc['callbackat'];this[_0x0c22('0x19')]=_0x2583bc[_0x0c22('0x19')];this['ContactId']=_0x2583bc[_0x0c22('0x1a')];this['ListId']=_0x2583bc[_0x0c22('0x1b')];this[_0x0c22('0x1c')]=_0x2583bc[_0x0c22('0x1c')];this[_0x0c22('0x1d')]=_0x2583bc[_0x0c22('0x1d')];this[_0x0c22('0x1e')]=_0x2583bc[_0x0c22('0x1e')];this[_0x0c22('0x1f')]=_0x2583bc['originatecalleridnum']||'';this[_0x0c22('0x20')]=_0x2583bc[_0x0c22('0x20')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0876ff4..4285aa5 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 _0xce5b=['moment','uniqueid','format','%s/%s/%s','name','fax','localstationid','headerinfo','AttachmentId','exports','util','lodash'];(function(_0x370f62,_0x4577da){var _0x473e23=function(_0x534a3f){while(--_0x534a3f){_0x370f62['push'](_0x370f62['shift']());}};_0x473e23(++_0x4577da);}(_0xce5b,0x76));var _0xbce5=function(_0x1153e4,_0x11a5bf){_0x1153e4=_0x1153e4-0x0;var _0x516718=_0xce5b[_0x1153e4];return _0x516718;};'use strict';var util=require(_0xbce5('0x0'));var _=require(_0xbce5('0x1'));var moment=require(_0xbce5('0x2'));function Action(_0x222f3c,_0xdd145a,_0x583f3e){this[_0xbce5('0x3')]=_0x222f3c||undefined;this['channel']=util[_0xbce5('0x4')](_0xbce5('0x5'),_0xdd145a['tech'],_0xdd145a['Trunk'][_0xbce5('0x6')],_0x583f3e[_0xbce5('0x7')]);this[_0xbce5('0x8')]=_0xdd145a[_0xbce5('0x8')];this[_0xbce5('0x9')]=_0xdd145a['headerinfo'];this['path']=_0x583f3e['path'];this['AttachmentId']=_0x583f3e[_0xbce5('0xa')];}module[_0xbce5('0xb')]=Action; \ No newline at end of file +var _0x2fbe=['util','moment','uniqueid','channel','format','%s/%s/%s','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x2fbe,0x1a4));var _0xe2fb=function(_0x2aea75,_0x507a2b){_0x2aea75=_0x2aea75-0x0;var _0x409e92=_0x2fbe[_0x2aea75];return _0x409e92;};'use strict';var util=require(_0xe2fb('0x0'));var _=require('lodash');var moment=require(_0xe2fb('0x1'));function Action(_0x24e1b9,_0x45458c,_0x217bb2){this[_0xe2fb('0x2')]=_0x24e1b9||undefined;this[_0xe2fb('0x3')]=util[_0xe2fb('0x4')](_0xe2fb('0x5'),_0x45458c['tech'],_0x45458c[_0xe2fb('0x6')][_0xe2fb('0x7')],_0x217bb2[_0xe2fb('0x8')]);this[_0xe2fb('0x9')]=_0x45458c[_0xe2fb('0x9')];this[_0xe2fb('0xa')]=_0x45458c[_0xe2fb('0xa')];this[_0xe2fb('0xb')]=_0x217bb2['path'];this[_0xe2fb('0xc')]=_0x217bb2[_0xe2fb('0xc')];}module[_0xe2fb('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 36736a0..e525122 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 _0x8a3c=['path','tiff2pdf','./util/gs','fax','../ami','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','channel','uniqueid','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','then','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','syncOriginateResponse','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','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','dir','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','SIP/%s','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid'];(function(_0x115599,_0x4526cb){var _0x5a9c07=function(_0x291ee0){while(--_0x291ee0){_0x115599['push'](_0x115599['shift']());}};_0x5a9c07(++_0x4526cb);}(_0x8a3c,0xde));var _0xc8a3=function(_0x395b75,_0x5e4170){_0x395b75=_0x395b75-0x0;var _0x21f76c=_0x8a3c[_0x395b75];return _0x21f76c;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xc8a3('0x0'));var uuid=require(_0xc8a3('0x1'));var moment=require('moment');var path=require(_0xc8a3('0x2'));var tiff2pdf=require(_0xc8a3('0x3'));var gs=require(_0xc8a3('0x4'));var logger=require('../../../config/logger')(_0xc8a3('0x5'));var ami=require(_0xc8a3('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0xc8a3('0x7'));var ut=require(_0xc8a3('0x8'));var Action=require(_0xc8a3('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xc8a3('0xa'));var faxMessage=require(_0xc8a3('0xb'));function Fax(_0x4d7ce7){this[_0xc8a3('0xc')]={};this[_0xc8a3('0xd')]=_0x4d7ce7[_0xc8a3('0xd')];this[_0xc8a3('0xe')]=_0x4d7ce7['trunks'];this[_0xc8a3('0xf')]={};ami['on'](_0xc8a3('0x10'),this[_0xc8a3('0x11')][_0xc8a3('0x12')](this));ami['on'](_0xc8a3('0x13'),this[_0xc8a3('0x14')][_0xc8a3('0x12')](this));ami['on'](_0xc8a3('0x15'),this[_0xc8a3('0x16')][_0xc8a3('0x12')](this));ami['on'](_0xc8a3('0x17'),this[_0xc8a3('0x18')][_0xc8a3('0x12')](this));ami['on'](_0xc8a3('0x19'),this[_0xc8a3('0x1a')][_0xc8a3('0x12')](this));ami['on'](_0xc8a3('0x1b'),this['syncReceiveFax'][_0xc8a3('0x12')](this));ami['on'](_0xc8a3('0x1c'),this[_0xc8a3('0x1d')][_0xc8a3('0x12')](this));ami['on'](_0xc8a3('0x1e'),this['syncOriginateResponse'][_0xc8a3('0x12')](this));}Fax[_0xc8a3('0x1f')][_0xc8a3('0x11')]=function(_0x2ea53a){if(_0x2ea53a['context']===_0xc8a3('0x20')){for(var _0x42b5b3 in this[_0xc8a3('0xd')]){if(this['faxAccounts'][_0xc8a3('0x21')](_0x42b5b3)){if(_0x2ea53a[_0xc8a3('0x22')]===this[_0xc8a3('0xd')][_0x42b5b3][_0xc8a3('0x23')]){this[_0xc8a3('0xc')][_0x2ea53a['uniqueid']]={};this[_0xc8a3('0xc')][_0x2ea53a['uniqueid']][_0xc8a3('0x24')]=_0x2ea53a[_0xc8a3('0x24')];this['channels'][_0x2ea53a['uniqueid']]['id']=this[_0xc8a3('0xd')][_0x42b5b3]['id'];this[_0xc8a3('0xc')][_0x2ea53a[_0xc8a3('0x25')]][_0xc8a3('0x26')]=this['faxAccounts'][_0x42b5b3][_0xc8a3('0x26')];logger[_0xc8a3('0x27')](_0x2ea53a[_0xc8a3('0x25')],_0xc8a3('0x28'));}}}}if(this['actions'][_0x2ea53a['uniqueid']]){this[_0xc8a3('0xc')][_0x2ea53a[_0xc8a3('0x25')]]={};this[_0xc8a3('0xc')][_0x2ea53a['uniqueid']][_0xc8a3('0x24')]=_0x2ea53a[_0xc8a3('0x24')];logger[_0xc8a3('0x27')](_0x2ea53a['uniqueid'],_0xc8a3('0x28'));}};Fax[_0xc8a3('0x1f')][_0xc8a3('0x14')]=function(_0x235d57){if(this[_0xc8a3('0xc')][_0x235d57[_0xc8a3('0x25')]]){for(var _0x2d54c9 in _0x235d57[_0xc8a3('0x29')]){if(_0x235d57[_0xc8a3('0x29')][_0xc8a3('0x21')](_0x2d54c9)){this[_0xc8a3('0xc')][_0x235d57['uniqueid']][_0x2d54c9]=_0x235d57[_0xc8a3('0x2a')];}}}};Fax[_0xc8a3('0x1f')][_0xc8a3('0x16')]=function(_0x2920c0){if(this[_0xc8a3('0xc')][_0x2920c0[_0xc8a3('0x25')]]){this[_0xc8a3('0xc')][_0x2920c0[_0xc8a3('0x25')]]['channelstate']=_0x2920c0[_0xc8a3('0x2b')];this[_0xc8a3('0xc')][_0x2920c0[_0xc8a3('0x25')]][_0xc8a3('0x2c')]=_0x2920c0[_0xc8a3('0x2c')];}};Fax[_0xc8a3('0x1f')][_0xc8a3('0x18')]=function(_0xb8c0ea){if(this[_0xc8a3('0xc')][_0xb8c0ea[_0xc8a3('0x25')]]){for(var _0x56b6c8 in _0xb8c0ea['variable']){if(_0xb8c0ea[_0xc8a3('0x29')][_0xc8a3('0x21')](_0x56b6c8)){this[_0xc8a3('0xc')][_0xb8c0ea[_0xc8a3('0x25')]][_0x56b6c8]=_0xb8c0ea[_0xc8a3('0x2a')];}}}};Fax[_0xc8a3('0x1f')][_0xc8a3('0x1a')]=function(_0x58d32d){if(this[_0xc8a3('0xc')][_0x58d32d[_0xc8a3('0x25')]]){this['channels'][_0x58d32d[_0xc8a3('0x25')]][_0xc8a3('0x2d')]=_0x58d32d['operation'];this[_0xc8a3('0xc')][_0x58d32d['uniqueid']][_0xc8a3('0x2e')]=_0x58d32d['status'];this[_0xc8a3('0xc')][_0x58d32d[_0xc8a3('0x25')]][_0xc8a3('0x23')]=_0x58d32d[_0xc8a3('0x23')];this[_0xc8a3('0xc')][_0x58d32d[_0xc8a3('0x25')]]['filename']=_0x58d32d[_0xc8a3('0x2f')];logger[_0xc8a3('0x27')](_0x58d32d[_0xc8a3('0x25')],'\x20syncFaxStatus\x20');}};Fax[_0xc8a3('0x1f')][_0xc8a3('0x30')]=function(_0xb60eb1){var _0x2dfbd1=this;if(this[_0xc8a3('0xc')][_0xb60eb1[_0xc8a3('0x25')]]){var _0x4c3467=this['channels'][_0xb60eb1[_0xc8a3('0x25')]]['id'];this[_0xc8a3('0xc')][_0xb60eb1[_0xc8a3('0x25')]][_0xc8a3('0x31')]=_0xb60eb1[_0xc8a3('0x31')];this[_0xc8a3('0xc')][_0xb60eb1['uniqueid']][_0xc8a3('0x32')]=_0xb60eb1[_0xc8a3('0x32')];this[_0xc8a3('0xc')][_0xb60eb1['uniqueid']][_0xc8a3('0x23')]=_0xb60eb1['localstationid'];this[_0xc8a3('0xc')][_0xb60eb1[_0xc8a3('0x25')]][_0xc8a3('0x33')]=_0xb60eb1[_0xc8a3('0x33')];this[_0xc8a3('0xc')][_0xb60eb1[_0xc8a3('0x25')]][_0xc8a3('0x34')]=_0xb60eb1[_0xc8a3('0x34')];this[_0xc8a3('0xc')][_0xb60eb1['uniqueid']][_0xc8a3('0x2f')]=_0xb60eb1[_0xc8a3('0x2f')];this[_0xc8a3('0xc')][_0xb60eb1[_0xc8a3('0x25')]][_0xc8a3('0x35')]=_0xb60eb1[_0xc8a3('0x35')];if(this[_0xc8a3('0xc')][_0xb60eb1[_0xc8a3('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0xb60eb1[_0xc8a3('0x2f')],'/var/opt/motion2/server/files/attachments/',function(_0x57eabd){logger[_0xc8a3('0x27')](_0xb60eb1[_0xc8a3('0x25')],_0xc8a3('0x36'),_0x57eabd['message']);attachment[_0xc8a3('0x37')]({'name':path[_0xc8a3('0x38')](_0xb60eb1[_0xc8a3('0x2f')])['name'],'basename':path[_0xc8a3('0x38')](_0xb60eb1[_0xc8a3('0x2f')])[_0xc8a3('0x26')]+'.pdf','type':'application/pdf'})[_0xc8a3('0x39')](function(_0x448f7){faxAccount['notify'](_0x4c3467,{'from':_0xb60eb1[_0xc8a3('0x35')],'mapKey':_0xc8a3('0x5'),'body':path[_0xc8a3('0x38')](_0xb60eb1[_0xc8a3('0x2f')])[_0xc8a3('0x26')]+'.pdf','AttachmentId':_0x448f7['id']})[_0xc8a3('0x3a')](function(_0xd9de89){logger[_0xc8a3('0x3b')](_0xb60eb1[_0xc8a3('0x25')],_0xc8a3('0x3c'),JSON['stringify'](_0xd9de89));});})[_0xc8a3('0x3a')](function(_0x3c4264){logger['error'](_0xb60eb1[_0xc8a3('0x25')],_0xc8a3('0x3d'),JSON[_0xc8a3('0x3e')](_0x3c4264));});});}logger[_0xc8a3('0x27')](_0xb60eb1[_0xc8a3('0x25')],'\x20receiveFax\x20');}};Fax[_0xc8a3('0x1f')][_0xc8a3('0x3f')]=function(_0x55812e){if(this[_0xc8a3('0xf')][_0x55812e['uniqueid']]){_['merge'](this[_0xc8a3('0xc')][_0x55812e['uniqueid']],_[_0xc8a3('0x40')](_0x55812e,[_0xc8a3('0x41'),_0xc8a3('0x42')]));}};function updateStatus(_0x6d26d6){if(_0x6d26d6[_0xc8a3('0x43')]){faxMessage['update'](_0x6d26d6[_0xc8a3('0x43')],{'failMessage':_0xc8a3('0x44')})['then'](function(_0x4c0522){ut['logger'](_0xc8a3('0x45'),_0x4c0522);})[_0xc8a3('0x3a')](function(_0x55b059){ut['logger'](_0xc8a3('0x46'),_0x55b059);});}else{ut[_0xc8a3('0x47')](_0xc8a3('0x48'));}}Fax[_0xc8a3('0x1f')][_0xc8a3('0x49')]=function(_0xa913a3,_0x44f72,_0x1f02c2){var _0x2e8fc8=this;var _0x33863a={};if(_0x44f72){_0x33863a={'read':_0x44f72};}else{_0x33863a={'failMessage':_0x1f02c2};}if(this[_0xc8a3('0xf')][_0xa913a3][_0xc8a3('0x43')]){faxMessage['update'](this[_0xc8a3('0xf')][_0xa913a3][_0xc8a3('0x43')],_0x33863a)[_0xc8a3('0x39')](function(_0x267477){ut['logger']('[Fax][Message][Updated]',_0x267477);})['catch'](function(_0x95f9be){ut[_0xc8a3('0x47')](_0xc8a3('0x4a'),_0x95f9be);})['finally'](function(){delete _0x2e8fc8[_0xc8a3('0xc')][_0xa913a3];delete _0x2e8fc8[_0xc8a3('0xf')][_0xa913a3];});}else{ut[_0xc8a3('0x47')](_0xc8a3('0x4b'));delete this[_0xc8a3('0xc')][_0xa913a3];delete this[_0xc8a3('0xf')][_0xa913a3];}};Fax['prototype'][_0xc8a3('0x1d')]=function(_0x422472){var _0x25857c=this;if(this['channels'][_0x422472[_0xc8a3('0x25')]]){if(this[_0xc8a3('0xf')][_0x422472[_0xc8a3('0x25')]]){this[_0xc8a3('0xc')][_0x422472['uniqueid']]['id']=this[_0xc8a3('0xf')][_0x422472['uniqueid']]['id'];this[_0xc8a3('0xc')][_0x422472[_0xc8a3('0x25')]][_0xc8a3('0x26')]=this[_0xc8a3('0xf')][_0x422472['uniqueid']][_0xc8a3('0x26')];}logger[_0xc8a3('0x27')](_0x422472['uniqueid'],this['actions'][_0x422472[_0xc8a3('0x25')]]?'\x20hangup\x20sendFile\x20':_0xc8a3('0x4c'),JSON['stringify'](this[_0xc8a3('0xc')][_0x422472[_0xc8a3('0x25')]]));if(this['actions'][_0x422472['uniqueid']]){if(this[_0xc8a3('0xc')][_0x422472[_0xc8a3('0x25')]][_0xc8a3('0x4d')]>0x0&&this[_0xc8a3('0xc')][_0x422472[_0xc8a3('0x25')]]['faxstatus']===_0xc8a3('0x4e')){this[_0xc8a3('0x49')](_0x422472[_0xc8a3('0x25')],!![]);}else{this['updateStatus'](_0x422472[_0xc8a3('0x25')],![],this[_0xc8a3('0xc')][_0x422472[_0xc8a3('0x25')]][_0xc8a3('0x4f')]?_0xc8a3('0x50')+this[_0xc8a3('0xc')][_0x422472[_0xc8a3('0x25')]][_0xc8a3('0x4f')]:_0xc8a3('0x51'));}}}};Fax['prototype']['send']=function(_0x48efbc){var _0x34f121=this;return new BPromise(function(_0x2ffa3c,_0x2225e3){_0x34f121[_0xc8a3('0x52')](_0x48efbc,_0x34f121[_0xc8a3('0xd')][_0x48efbc[_0xc8a3('0x53')]])[_0xc8a3('0x39')](function(_0x21b2b){ut[_0xc8a3('0x47')](_0xc8a3('0x54'),_0x21b2b);_0x2ffa3c(ut[_0xc8a3('0x55')](_0xc8a3('0x56')));})[_0xc8a3('0x3a')](function(_0x2121a2){ut[_0xc8a3('0x47')](_0xc8a3('0x57'),_0x2121a2);updateStatus(_0x48efbc);_0x2225e3(ut['message'](_0xc8a3('0x58')));});});};Fax[_0xc8a3('0x1f')]['checkAfterSend']=function(_0x116855){var _0x54054a=this;return new BPromise(function(_0x1597fa,_0x26a91a){var _0x2f6ff3=_0x54054a['checkTrunk'](_0x54054a[_0xc8a3('0xd')][_0x116855[_0xc8a3('0x53')]][_0xc8a3('0x59')],_0x116855);if(_0x2f6ff3[_0xc8a3('0x5a')]){_0x1597fa(ut[_0xc8a3('0x55')](_0xc8a3('0x5b')));}else{_0x26a91a(ut['message'](_0x2f6ff3['message']));}});};function originate(_0x14ceb7,_0x1aa3fb,_0x550881){return new BPromise(function(_0x21e4f8,_0x1ea00f){if(_0x550881){var _0x291a8e=util[_0xc8a3('0x5c')](_0xc8a3('0x5d'),path[_0xc8a3('0x38')](_0x14ceb7[_0xc8a3('0x2')])[_0xc8a3('0x26')],_0x14ceb7[_0xc8a3('0x2')]);gs[_0xc8a3('0x5e')](_0x291a8e)[_0xc8a3('0x39')](function(){_0x14ceb7[_0xc8a3('0x2')]=util[_0xc8a3('0x5c')](_0xc8a3('0x5f'),path[_0xc8a3('0x38')](_0x14ceb7[_0xc8a3('0x2')])[_0xc8a3('0x60')],path[_0xc8a3('0x38')](_0x14ceb7[_0xc8a3('0x2')])[_0xc8a3('0x26')]);_0x1aa3fb['XMF-PATH']=_0x14ceb7[_0xc8a3('0x2')];ut['logger'](_0xc8a3('0x61'),'');ami['Action'](ut[_0xc8a3('0x62')](_0x14ceb7,_0x1aa3fb))[_0xc8a3('0x39')](function(_0x2bad5a){_0x21e4f8(_0x2bad5a);})[_0xc8a3('0x3a')](function(_0x32d17f){_0x1ea00f(_0x32d17f);});})['catch'](function(_0x786b1d){_0x1ea00f(_0x786b1d);});}else{ami['Action'](ut[_0xc8a3('0x62')](_0x14ceb7,_0x1aa3fb))[_0xc8a3('0x39')](function(_0x7c5e61){_0x21e4f8(_0x7c5e61);})[_0xc8a3('0x3a')](function(_0x393de1){_0x1ea00f(_0x393de1);});}});}Fax[_0xc8a3('0x1f')][_0xc8a3('0x52')]=function(_0x52f7e7,_0x2fa591){var _0x654572=this;return new BPromise(function(_0x5553a2,_0x7d7acc){var _0x3f2658=uuid['v4']();var _0x1b0144=ut[_0xc8a3('0x63')](_0x52f7e7,_0x2fa591);_0x654572[_0xc8a3('0xf')][_0x3f2658]=new Action(_0x3f2658,_0x2fa591,_0x52f7e7);var _0x25e1e8=_0x654572[_0xc8a3('0xf')][_0x3f2658];if(path[_0xc8a3('0x38')](_0x52f7e7[_0xc8a3('0x2')])[_0xc8a3('0x64')]===_0xc8a3('0x65')){originate(_0x25e1e8,_0x1b0144,!![])[_0xc8a3('0x39')](function(_0x45585e){_0x5553a2(_0x45585e);})[_0xc8a3('0x3a')](function(_0x54c9c6){_0x7d7acc(_0x54c9c6);});}else{originate(_0x25e1e8,_0x1b0144,![])[_0xc8a3('0x39')](function(_0x36db0c){_0x5553a2(_0x36db0c);})[_0xc8a3('0x3a')](function(_0x5146b3){_0x7d7acc(_0x5146b3);});}});};Fax[_0xc8a3('0x1f')][_0xc8a3('0x66')]=function(_0x3664ef){return!_[_0xc8a3('0x67')](_0x3664ef)&&!_[_0xc8a3('0x67')](_0x3664ef[_0xc8a3('0x26')])&&!_[_0xc8a3('0x67')](_0x3664ef['active'])&&_0x3664ef['active']&&!_['isNil'](this[_0xc8a3('0xe')][util[_0xc8a3('0x5c')](_0xc8a3('0x68'),_0x3664ef[_0xc8a3('0x26')])])&&!_[_0xc8a3('0x67')](this['trunks'][util[_0xc8a3('0x5c')](_0xc8a3('0x68'),_0x3664ef[_0xc8a3('0x26')])]['status'])&&(this['trunks'][util[_0xc8a3('0x5c')](_0xc8a3('0x68'),_0x3664ef[_0xc8a3('0x26')])][_0xc8a3('0x2e')]==='reachable'||this[_0xc8a3('0xe')][util[_0xc8a3('0x5c')](_0xc8a3('0x68'),_0x3664ef[_0xc8a3('0x26')])]['status']==='unmonitored');};Fax[_0xc8a3('0x1f')][_0xc8a3('0x69')]=function(_0x4c4925,_0x283651){if(!this[_0xc8a3('0x66')](_0x4c4925)){ut[_0xc8a3('0x47')](_0xc8a3('0x6a'),_['isNil'](_0x4c4925)?'':_0x4c4925[_0xc8a3('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x283651[_0xc8a3('0x5')])){ut[_0xc8a3('0x47')](_0xc8a3('0x6b'),JSON['stringify'](_0x283651));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xc8a3('0x67')](_0x283651['path'])){ut['logger'](_0xc8a3('0x6c'),JSON['stringify'](_0x283651));return{'isValid':![],'message':_0xc8a3('0x6d')};}return{'isValid':!![],'message':_0xc8a3('0x6e')};};module[_0xc8a3('0x6f')]=Fax; \ No newline at end of file +var _0xe09d=['isTrunkReachable','isNil','active','trunks','SIP/%s','status','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','bind','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncNewchannel','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','actions','syncVarSet','variable','prototype','syncNewState','channelstate','channelstatedesc','value','operation','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','info','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','ext'];(function(_0x2cb446,_0x4864ed){var _0x3a0084=function(_0x2b954b){while(--_0x2b954b){_0x2cb446['push'](_0x2cb446['shift']());}};_0x3a0084(++_0x4864ed);}(_0xe09d,0x1d2));var _0xde09=function(_0x2156fc,_0x5f5545){_0x2156fc=_0x2156fc-0x0;var _0x25a9f0=_0xe09d[_0x2156fc];return _0x25a9f0;};'use strict';var util=require('util');var _=require(_0xde09('0x0'));var BPromise=require(_0xde09('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0xde09('0x2'));var logger=require(_0xde09('0x3'))(_0xde09('0x4'));var ami=require(_0xde09('0x5'));var rpcDb=require(_0xde09('0x6'));var Channel=require(_0xde09('0x7'));var ut=require('./util/util');var Action=require(_0xde09('0x8'));var faxAccount=require(_0xde09('0x9'));var attachment=require(_0xde09('0xa'));var faxMessage=require(_0xde09('0xb'));function Fax(_0x3043bf){this['channels']={};this[_0xde09('0xc')]=_0x3043bf[_0xde09('0xc')];this['trunks']=_0x3043bf['trunks'];this['actions']={};ami['on']('newchannel',this['syncNewchannel']['bind'](this));ami['on']('varset',this['syncVarSet'][_0xde09('0xd')](this));ami['on'](_0xde09('0xe'),this['syncNewState'][_0xde09('0xd')](this));ami['on']('newexten',this[_0xde09('0xf')]['bind'](this));ami['on'](_0xde09('0x10'),this[_0xde09('0x11')][_0xde09('0xd')](this));ami['on'](_0xde09('0x12'),this[_0xde09('0x13')][_0xde09('0xd')](this));ami['on'](_0xde09('0x14'),this[_0xde09('0x15')][_0xde09('0xd')](this));ami['on'](_0xde09('0x16'),this['syncOriginateResponse'][_0xde09('0xd')](this));}Fax['prototype'][_0xde09('0x17')]=function(_0x496da7){if(_0x496da7['context']===_0xde09('0x18')){for(var _0x2398de in this[_0xde09('0xc')]){if(this[_0xde09('0xc')][_0xde09('0x19')](_0x2398de)){if(_0x496da7[_0xde09('0x1a')]===this['faxAccounts'][_0x2398de][_0xde09('0x1b')]){this[_0xde09('0x1c')][_0x496da7['uniqueid']]={};this[_0xde09('0x1c')][_0x496da7[_0xde09('0x1d')]]['channel']=_0x496da7[_0xde09('0x1e')];this[_0xde09('0x1c')][_0x496da7[_0xde09('0x1d')]]['id']=this[_0xde09('0xc')][_0x2398de]['id'];this['channels'][_0x496da7[_0xde09('0x1d')]][_0xde09('0x1f')]=this[_0xde09('0xc')][_0x2398de][_0xde09('0x1f')];logger['info'](_0x496da7[_0xde09('0x1d')],_0xde09('0x20'));}}}}if(this[_0xde09('0x21')][_0x496da7[_0xde09('0x1d')]]){this[_0xde09('0x1c')][_0x496da7[_0xde09('0x1d')]]={};this[_0xde09('0x1c')][_0x496da7[_0xde09('0x1d')]][_0xde09('0x1e')]=_0x496da7[_0xde09('0x1e')];logger['info'](_0x496da7['uniqueid'],'\x20syncNewchannel\x20');}};Fax['prototype'][_0xde09('0x22')]=function(_0x42fb23){if(this[_0xde09('0x1c')][_0x42fb23[_0xde09('0x1d')]]){for(var _0x567c32 in _0x42fb23[_0xde09('0x23')]){if(_0x42fb23[_0xde09('0x23')][_0xde09('0x19')](_0x567c32)){this[_0xde09('0x1c')][_0x42fb23[_0xde09('0x1d')]][_0x567c32]=_0x42fb23['value'];}}}};Fax[_0xde09('0x24')][_0xde09('0x25')]=function(_0x2547ec){if(this[_0xde09('0x1c')][_0x2547ec['uniqueid']]){this[_0xde09('0x1c')][_0x2547ec[_0xde09('0x1d')]][_0xde09('0x26')]=_0x2547ec['channelstate'];this[_0xde09('0x1c')][_0x2547ec['uniqueid']][_0xde09('0x27')]=_0x2547ec[_0xde09('0x27')];}};Fax['prototype'][_0xde09('0xf')]=function(_0x336dff){if(this[_0xde09('0x1c')][_0x336dff[_0xde09('0x1d')]]){for(var _0x18d7a5 in _0x336dff['variable']){if(_0x336dff[_0xde09('0x23')]['hasOwnProperty'](_0x18d7a5)){this[_0xde09('0x1c')][_0x336dff[_0xde09('0x1d')]][_0x18d7a5]=_0x336dff[_0xde09('0x28')];}}}};Fax[_0xde09('0x24')][_0xde09('0x11')]=function(_0x5c3ce1){if(this[_0xde09('0x1c')][_0x5c3ce1[_0xde09('0x1d')]]){this['channels'][_0x5c3ce1[_0xde09('0x1d')]]['operation']=_0x5c3ce1[_0xde09('0x29')];this[_0xde09('0x1c')][_0x5c3ce1[_0xde09('0x1d')]]['status']=_0x5c3ce1['status'];this['channels'][_0x5c3ce1[_0xde09('0x1d')]][_0xde09('0x1b')]=_0x5c3ce1[_0xde09('0x1b')];this[_0xde09('0x1c')][_0x5c3ce1['uniqueid']]['filename']=_0x5c3ce1[_0xde09('0x2a')];logger['info'](_0x5c3ce1['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0xde09('0x24')][_0xde09('0x13')]=function(_0xc44345){var _0x56cbeb=this;if(this[_0xde09('0x1c')][_0xc44345[_0xde09('0x1d')]]){var _0x27be33=this['channels'][_0xc44345[_0xde09('0x1d')]]['id'];this['channels'][_0xc44345[_0xde09('0x1d')]][_0xde09('0x2b')]=_0xc44345['remotestationid'];this['channels'][_0xc44345[_0xde09('0x1d')]][_0xde09('0x2c')]=_0xc44345['pagestransferred'];this[_0xde09('0x1c')][_0xc44345[_0xde09('0x1d')]][_0xde09('0x1b')]=_0xc44345[_0xde09('0x1b')];this[_0xde09('0x1c')][_0xc44345[_0xde09('0x1d')]][_0xde09('0x2d')]=_0xc44345[_0xde09('0x2d')];this[_0xde09('0x1c')][_0xc44345['uniqueid']][_0xde09('0x2e')]=_0xc44345[_0xde09('0x2e')];this[_0xde09('0x1c')][_0xc44345[_0xde09('0x1d')]][_0xde09('0x2a')]=_0xc44345['filename'];this[_0xde09('0x1c')][_0xc44345['uniqueid']][_0xde09('0x2f')]=_0xc44345[_0xde09('0x2f')];if(this['channels'][_0xc44345[_0xde09('0x1d')]][_0xde09('0x2c')]>0x0){tiff2pdf(_0xc44345[_0xde09('0x2a')],'/var/opt/motion2/server/files/attachments/',function(_0x29555c){logger[_0xde09('0x30')](_0xc44345[_0xde09('0x1d')],_0xde09('0x31'),_0x29555c[_0xde09('0x32')]);attachment['create']({'name':path[_0xde09('0x33')](_0xc44345[_0xde09('0x2a')])[_0xde09('0x1f')],'basename':path[_0xde09('0x33')](_0xc44345[_0xde09('0x2a')])[_0xde09('0x1f')]+_0xde09('0x34'),'type':_0xde09('0x35')})[_0xde09('0x36')](function(_0x44d4c2){faxAccount['notify'](_0x27be33,{'from':_0xc44345['calleridnum'],'mapKey':_0xde09('0x4'),'body':path['parse'](_0xc44345[_0xde09('0x2a')])[_0xde09('0x1f')]+_0xde09('0x34'),'AttachmentId':_0x44d4c2['id']})[_0xde09('0x37')](function(_0x2e54a2){logger[_0xde09('0x38')](_0xc44345['uniqueid'],_0xde09('0x39'),JSON[_0xde09('0x3a')](_0x2e54a2));});})[_0xde09('0x37')](function(_0x4c1438){logger[_0xde09('0x38')](_0xc44345['uniqueid'],'\x20receiveFax\x20',JSON['stringify'](_0x4c1438));});});}logger[_0xde09('0x30')](_0xc44345[_0xde09('0x1d')],_0xde09('0x3b'));}};Fax[_0xde09('0x24')][_0xde09('0x3c')]=function(_0x50aa53){if(this['actions'][_0x50aa53[_0xde09('0x1d')]]){_['merge'](this['channels'][_0x50aa53[_0xde09('0x1d')]],_[_0xde09('0x3d')](_0x50aa53,['response',_0xde09('0x3e')]));}};function updateStatus(_0x1b717f){if(_0x1b717f[_0xde09('0x3f')]){faxMessage['update'](_0x1b717f[_0xde09('0x3f')],{'failMessage':_0xde09('0x40')})[_0xde09('0x36')](function(_0x4bd7df){ut[_0xde09('0x41')]('[Fax][Message][Error][Updated]',_0x4bd7df);})[_0xde09('0x37')](function(_0x40f7a2){ut[_0xde09('0x41')](_0xde09('0x42'),_0x40f7a2);});}else{ut[_0xde09('0x41')](_0xde09('0x43'));}}Fax[_0xde09('0x24')]['updateStatus']=function(_0x317c6f,_0x54240b,_0x4dd9c5){var _0x33cbc4=this;var _0x5aa122={};if(_0x54240b){_0x5aa122={'read':_0x54240b};}else{_0x5aa122={'failMessage':_0x4dd9c5};}if(this[_0xde09('0x21')][_0x317c6f]['AttachmentId']){faxMessage[_0xde09('0x44')](this['actions'][_0x317c6f][_0xde09('0x3f')],_0x5aa122)[_0xde09('0x36')](function(_0x3d54bb){ut['logger']('[Fax][Message][Updated]',_0x3d54bb);})['catch'](function(_0x3ef147){ut[_0xde09('0x41')](_0xde09('0x45'),_0x3ef147);})[_0xde09('0x46')](function(){delete _0x33cbc4[_0xde09('0x1c')][_0x317c6f];delete _0x33cbc4['actions'][_0x317c6f];});}else{ut['logger'](_0xde09('0x47'));delete this[_0xde09('0x1c')][_0x317c6f];delete this[_0xde09('0x21')][_0x317c6f];}};Fax[_0xde09('0x24')][_0xde09('0x15')]=function(_0x5ccca0){var _0x3d9f39=this;if(this[_0xde09('0x1c')][_0x5ccca0[_0xde09('0x1d')]]){if(this[_0xde09('0x21')][_0x5ccca0[_0xde09('0x1d')]]){this['channels'][_0x5ccca0[_0xde09('0x1d')]]['id']=this[_0xde09('0x21')][_0x5ccca0[_0xde09('0x1d')]]['id'];this[_0xde09('0x1c')][_0x5ccca0['uniqueid']][_0xde09('0x1f')]=this['actions'][_0x5ccca0[_0xde09('0x1d')]][_0xde09('0x1f')];}logger[_0xde09('0x30')](_0x5ccca0['uniqueid'],this[_0xde09('0x21')][_0x5ccca0['uniqueid']]?_0xde09('0x48'):_0xde09('0x49'),JSON[_0xde09('0x3a')](this[_0xde09('0x1c')][_0x5ccca0['uniqueid']]));if(this[_0xde09('0x21')][_0x5ccca0[_0xde09('0x1d')]]){if(this[_0xde09('0x1c')][_0x5ccca0[_0xde09('0x1d')]][_0xde09('0x4a')]>0x0&&this[_0xde09('0x1c')][_0x5ccca0[_0xde09('0x1d')]][_0xde09('0x10')]===_0xde09('0x4b')){this[_0xde09('0x4c')](_0x5ccca0[_0xde09('0x1d')],!![]);}else{this[_0xde09('0x4c')](_0x5ccca0['uniqueid'],![],this[_0xde09('0x1c')][_0x5ccca0[_0xde09('0x1d')]]['faxstatusstring']?_0xde09('0x4d')+this[_0xde09('0x1c')][_0x5ccca0[_0xde09('0x1d')]]['faxstatusstring']:_0xde09('0x4e'));}}}};Fax[_0xde09('0x24')]['send']=function(_0x1d465b){var _0x7b01ec=this;return new BPromise(function(_0x4a3348,_0x4c50e4){_0x7b01ec[_0xde09('0x4f')](_0x1d465b,_0x7b01ec['faxAccounts'][_0x1d465b['FaxAccountId']])[_0xde09('0x36')](function(_0x57dc1f){ut[_0xde09('0x41')](_0xde09('0x50'),_0x57dc1f);_0x4a3348(ut['message'](_0xde09('0x51')));})[_0xde09('0x37')](function(_0x14c071){ut[_0xde09('0x41')]('[Fax][execOriginate][failure]',_0x14c071);updateStatus(_0x1d465b);_0x4c50e4(ut[_0xde09('0x32')](_0xde09('0x52')));});});};Fax[_0xde09('0x24')][_0xde09('0x53')]=function(_0xaf80b3){var _0x143266=this;return new BPromise(function(_0x23faec,_0x4d82e5){var _0x199f95=_0x143266[_0xde09('0x54')](_0x143266[_0xde09('0xc')][_0xaf80b3[_0xde09('0x55')]][_0xde09('0x56')],_0xaf80b3);if(_0x199f95[_0xde09('0x57')]){_0x23faec(ut[_0xde09('0x32')]('Trunk\x20Reachable'));}else{_0x4d82e5(ut['message'](_0x199f95['message']));}});};function originate(_0xc599f2,_0x1ce1b0,_0x114432){return new BPromise(function(_0x42ce54,_0x5ba614){if(_0x114432){var _0x376ff8=util[_0xde09('0x58')](_0xde09('0x59'),path[_0xde09('0x33')](_0xc599f2[_0xde09('0x5a')])[_0xde09('0x1f')],_0xc599f2[_0xde09('0x5a')]);gs[_0xde09('0x5b')](_0x376ff8)[_0xde09('0x36')](function(){_0xc599f2[_0xde09('0x5a')]=util['format'](_0xde09('0x5c'),path['parse'](_0xc599f2['path'])[_0xde09('0x5d')],path['parse'](_0xc599f2[_0xde09('0x5a')])[_0xde09('0x1f')]);_0x1ce1b0[_0xde09('0x5e')]=_0xc599f2['path'];ut[_0xde09('0x41')]('Convert\x20pdf\x20to\x20tif','');ami[_0xde09('0x5f')](ut['variablesAction'](_0xc599f2,_0x1ce1b0))['then'](function(_0xc3cdf9){_0x42ce54(_0xc3cdf9);})['catch'](function(_0x4fc884){_0x5ba614(_0x4fc884);});})['catch'](function(_0x37bba3){_0x5ba614(_0x37bba3);});}else{ami['Action'](ut[_0xde09('0x60')](_0xc599f2,_0x1ce1b0))[_0xde09('0x36')](function(_0x148afc){_0x42ce54(_0x148afc);})[_0xde09('0x37')](function(_0x4237df){_0x5ba614(_0x4237df);});}});}Fax[_0xde09('0x24')]['execOriginate']=function(_0x16243b,_0x187e73){var _0x1f8c0a=this;return new BPromise(function(_0x89d292,_0x5a4ce0){var _0x28af9f=uuid['v4']();var _0x4e099c=ut[_0xde09('0x61')](_0x16243b,_0x187e73);_0x1f8c0a[_0xde09('0x21')][_0x28af9f]=new Action(_0x28af9f,_0x187e73,_0x16243b);var _0x122509=_0x1f8c0a[_0xde09('0x21')][_0x28af9f];if(path[_0xde09('0x33')](_0x16243b[_0xde09('0x5a')])[_0xde09('0x62')]==='.pdf'){originate(_0x122509,_0x4e099c,!![])[_0xde09('0x36')](function(_0x3ce0bd){_0x89d292(_0x3ce0bd);})['catch'](function(_0x40dcce){_0x5a4ce0(_0x40dcce);});}else{originate(_0x122509,_0x4e099c,![])['then'](function(_0x5eedff){_0x89d292(_0x5eedff);})[_0xde09('0x37')](function(_0x12c09f){_0x5a4ce0(_0x12c09f);});}});};Fax['prototype'][_0xde09('0x63')]=function(_0x3d7f57){return!_[_0xde09('0x64')](_0x3d7f57)&&!_['isNil'](_0x3d7f57[_0xde09('0x1f')])&&!_['isNil'](_0x3d7f57[_0xde09('0x65')])&&_0x3d7f57[_0xde09('0x65')]&&!_[_0xde09('0x64')](this[_0xde09('0x66')][util['format'](_0xde09('0x67'),_0x3d7f57['name'])])&&!_[_0xde09('0x64')](this['trunks'][util['format'](_0xde09('0x67'),_0x3d7f57[_0xde09('0x1f')])][_0xde09('0x68')])&&(this[_0xde09('0x66')][util[_0xde09('0x58')](_0xde09('0x67'),_0x3d7f57[_0xde09('0x1f')])]['status']===_0xde09('0x69')||this['trunks'][util[_0xde09('0x58')](_0xde09('0x67'),_0x3d7f57[_0xde09('0x1f')])][_0xde09('0x68')]==='unmonitored');};Fax[_0xde09('0x24')][_0xde09('0x54')]=function(_0x4be5b8,_0x3aebc1){if(!this[_0xde09('0x63')](_0x4be5b8)){ut[_0xde09('0x41')](_0xde09('0x6a'),_[_0xde09('0x64')](_0x4be5b8)?'':_0x4be5b8[_0xde09('0x1f')]+_0xde09('0x6b'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xde09('0x64')](_0x3aebc1[_0xde09('0x4')])){ut['logger'](_0xde09('0x6c'),JSON[_0xde09('0x3a')](_0x3aebc1));return{'isValid':![],'message':_0xde09('0x6d')};}if(_[_0xde09('0x64')](_0x3aebc1[_0xde09('0x5a')])){ut[_0xde09('0x41')](_0xde09('0x6e'),JSON[_0xde09('0x3a')](_0x3aebc1));return{'isValid':![],'message':_0xde09('0x6f')};}return{'isValid':!![],'message':_0xde09('0x70')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b23325a..906278e 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 _0x0e36=['catch','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve'];(function(_0x54a6c1,_0x2be625){var _0x2af157=function(_0x14fb5e){while(--_0x14fb5e){_0x54a6c1['push'](_0x54a6c1['shift']());}};_0x2af157(++_0x2be625);}(_0x0e36,0x9a));var _0x60e3=function(_0x44e829,_0x58d3f7){_0x44e829=_0x44e829-0x0;var _0x52568a=_0x0e36[_0x44e829];return _0x52568a;};'use strict';var util=require(_0x60e3('0x0'));var BPromise=require('bluebird');var logger=require(_0x60e3('0x1'))(_0x60e3('0x2'));var _=require(_0x60e3('0x3'));var faxAccount=require(_0x60e3('0x4'));function loggerCatch(_0x364424){return function(_0x3d12b4){logger[_0x60e3('0x5')](_0x364424,util[_0x60e3('0x6')](_0x3d12b4,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x228c29,_0x7be2ff){return BPromise[_0x60e3('0x7')]()['then'](faxAccount['notify'](_0x228c29,_0x7be2ff))[_0x60e3('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x93b8=['resolve','then','notify','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0x93b8,0x160));var _0x893b=function(_0x5da55f,_0x2c4b7c){_0x5da55f=_0x5da55f-0x0;var _0x38b7c0=_0x93b8[_0x5da55f];return _0x38b7c0;};'use strict';var util=require(_0x893b('0x0'));var BPromise=require(_0x893b('0x1'));var logger=require(_0x893b('0x2'))(_0x893b('0x3'));var _=require(_0x893b('0x4'));var faxAccount=require(_0x893b('0x5'));function loggerCatch(_0x40d699){return function(_0x2002f6){logger[_0x893b('0x6')](_0x40d699,util[_0x893b('0x7')](_0x2002f6,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x15b6b6,_0x205b04){return BPromise[_0x893b('0x8')]()[_0x893b('0x9')](faxAccount[_0x893b('0xa')](_0x15b6b6,_0x205b04))['catch'](loggerCatch(_0x893b('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index fef2ebc..dd900b4 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 _0x490d=['Exec\x20gs','util','fax','child_process','exec','info'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x490d,0xe5));var _0xd490=function(_0x314623,_0x522ac8){_0x314623=_0x314623-0x0;var _0x5a4de0=_0x490d[_0x314623];return _0x5a4de0;};'use strict';var util=require(_0xd490('0x0'));var logger=require('../../../../config/logger')(_0xd490('0x1'));var BPromise=require('bluebird');var exec=require(_0xd490('0x2'))[_0xd490('0x3')];exports['execute']=function(_0x35c874){return new BPromise(function(_0x178a8a,_0x5b6e74){exec(_0x35c874,function(_0x34f5cf,_0x4d2bb6,_0x5327e8){logger[_0xd490('0x4')](_0xd490('0x5'),_0x4d2bb6);if(_0x34f5cf){logger[_0xd490('0x4')](_0xd490('0x5'),'\x20Error\x20:',util['inspect'](_0x34f5cf,{'showHidden':![],'depth':null}),_0x4d2bb6,_0x5327e8);_0x5b6e74(_0x34f5cf);}_0x178a8a(_0x4d2bb6);});});}; \ No newline at end of file +var _0xf3b7=['inspect','util','fax','child_process','exec','execute','info','\x20Error\x20:'];(function(_0x198563,_0x18163f){var _0x412958=function(_0x1ee0e4){while(--_0x1ee0e4){_0x198563['push'](_0x198563['shift']());}};_0x412958(++_0x18163f);}(_0xf3b7,0x191));var _0x7f3b=function(_0x43fdf9,_0x21f1d5){_0x43fdf9=_0x43fdf9-0x0;var _0x565164=_0xf3b7[_0x43fdf9];return _0x565164;};'use strict';var util=require(_0x7f3b('0x0'));var logger=require('../../../../config/logger')(_0x7f3b('0x1'));var BPromise=require('bluebird');var exec=require(_0x7f3b('0x2'))[_0x7f3b('0x3')];exports[_0x7f3b('0x4')]=function(_0x5cbc68){return new BPromise(function(_0x29fd95,_0x44d6f4){exec(_0x5cbc68,function(_0x1dd956,_0x4d1803,_0x29c237){logger[_0x7f3b('0x5')]('Exec\x20gs',_0x4d1803);if(_0x1dd956){logger[_0x7f3b('0x5')]('Exec\x20gs',_0x7f3b('0x6'),util[_0x7f3b('0x7')](_0x1dd956,{'showHidden':![],'depth':null}),_0x4d1803,_0x29c237);_0x44d6f4(_0x1dd956);}_0x29fd95(_0x4d1803);});});}; \ 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 c534f81..e198125 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 _0x0dd7=['modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','uniqueid','util','lodash','moment','../../../../config/logger','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x0dd7,0x1ce));var _0x70dd=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0x0dd7[_0x224f65];return _0x3f921c;};'use strict';var util=require(_0x70dd('0x0'));var _=require(_0x70dd('0x1'));var moment=require(_0x70dd('0x2'));var logger=require(_0x70dd('0x3'))('fax');exports['message']=function(_0x11a57a){return{'message':_0x11a57a};};exports[_0x70dd('0x4')]=function(_0x5cb2f3,_0x14f81d){logger['info'](_0x5cb2f3,util[_0x70dd('0x5')](_0x14f81d,{'showHidden':![],'depth':null}));};exports[_0x70dd('0x6')]=function(_0x453635,_0x4c3429){var _0x163547={'XMF-ECM':_0x4c3429[_0x70dd('0x7')],'XMF-HEADERINFO':_0x4c3429[_0x70dd('0x8')],'XMF-MINRATE':_0x4c3429[_0x70dd('0x9')],'XMF-MAXRATE':_0x4c3429[_0x70dd('0xa')],'XMF-MODEM':util[_0x70dd('0xb')](_0x70dd('0xc'),_0x4c3429[_0x70dd('0xd')]),'XMF-GATEWAY':_0x4c3429[_0x70dd('0xe')],'XMF-FAXDETECT':_0x4c3429[_0x70dd('0xf')],'XMF-T38TIMEOUT':_0x4c3429[_0x70dd('0x10')],'XMF-LOCALSTATIONID':_0x4c3429[_0x70dd('0x11')],'XMF-PATH':_0x453635[_0x70dd('0x12')]};return _0x163547;};exports[_0x70dd('0x13')]=function(_0x53622a,_0x21c178){return{'actionid':_0x53622a['uniqueid'],'action':_0x70dd('0x14'),'channel':_0x53622a[_0x70dd('0x15')],'Exten':_0x70dd('0x16'),'Context':_0x70dd('0x17'),'Priority':'1','callerid':util[_0x70dd('0xb')]('\x22%s\x22\x20<%s>',_0x53622a[_0x70dd('0x8')]?_0x53622a['headerinfo']:'',_0x53622a[_0x70dd('0x11')]),'variable':_0x21c178,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x53622a[_0x70dd('0x18')]};}; \ No newline at end of file +var _0x962e=['message','logger','info','inspect','addVariables','ecm','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','path','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','../../../../config/logger','fax'];(function(_0x748839,_0x4ba0b4){var _0xeaf1a8=function(_0x854548){while(--_0x854548){_0x748839['push'](_0x748839['shift']());}};_0xeaf1a8(++_0x4ba0b4);}(_0x962e,0x88));var _0xe962=function(_0x3612d5,_0xba7292){_0x3612d5=_0x3612d5-0x0;var _0x2febbf=_0x962e[_0x3612d5];return _0x2febbf;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var logger=require(_0xe962('0x0'))(_0xe962('0x1'));exports[_0xe962('0x2')]=function(_0x3ee45f){return{'message':_0x3ee45f};};exports[_0xe962('0x3')]=function(_0x1826b4,_0x2d9586){logger[_0xe962('0x4')](_0x1826b4,util[_0xe962('0x5')](_0x2d9586,{'showHidden':![],'depth':null}));};exports[_0xe962('0x6')]=function(_0xdb7f07,_0x180be4){var _0x138f2d={'XMF-ECM':_0x180be4[_0xe962('0x7')],'XMF-HEADERINFO':_0x180be4['headerinfo'],'XMF-MINRATE':_0x180be4[_0xe962('0x8')],'XMF-MAXRATE':_0x180be4[_0xe962('0x9')],'XMF-MODEM':util[_0xe962('0xa')]('\x22%s\x22',_0x180be4[_0xe962('0xb')]),'XMF-GATEWAY':_0x180be4[_0xe962('0xc')],'XMF-FAXDETECT':_0x180be4[_0xe962('0xd')],'XMF-T38TIMEOUT':_0x180be4[_0xe962('0xe')],'XMF-LOCALSTATIONID':_0x180be4['localstationid'],'XMF-PATH':_0xdb7f07[_0xe962('0xf')]};return _0x138f2d;};exports['variablesAction']=function(_0x40e591,_0x16e0c3){return{'actionid':_0x40e591['uniqueid'],'action':_0xe962('0x10'),'channel':_0x40e591[_0xe962('0x11')],'Exten':_0xe962('0x12'),'Context':_0xe962('0x13'),'Priority':'1','callerid':util['format'](_0xe962('0x14'),_0x40e591[_0xe962('0x15')]?_0x40e591['headerinfo']:'',_0x40e591[_0xe962('0x16')]),'variable':_0x16e0c3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x40e591['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 628dfe0..3dc3f9c 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 _0x4e7b=['util','moment','./server','./report','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','hour','get','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird'];(function(_0x5dbed0,_0x435bf){var _0x2889c1=function(_0x1fb249){while(--_0x1fb249){_0x5dbed0['push'](_0x5dbed0['shift']());}};_0x2889c1(++_0x435bf);}(_0x4e7b,0x130));var _0xb4e7=function(_0xe80d14,_0x437d91){_0xe80d14=_0xe80d14-0x0;var _0x24aa32=_0x4e7b[_0xe80d14];return _0x24aa32;};'use strict';var BPromise=require(_0xb4e7('0x0'));var util=require(_0xb4e7('0x1'));var moment=require(_0xb4e7('0x2'));var server=require(_0xb4e7('0x3'));var Realtime=require('./realtime');var Report=require(_0xb4e7('0x4'));var Acw=require(_0xb4e7('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xb4e7('0x6'));var Preview=require(_0xb4e7('0x7'));var Fax=require('./fax');var user=require(_0xb4e7('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xb4e7('0x9'));var voiceCallReport=require(_0xb4e7('0xa'));var trunk=require(_0xb4e7('0xb'));var trigger=require(_0xb4e7('0xc'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xb4e7('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xb4e7('0xe'));var zendesk=require(_0xb4e7('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xb4e7('0x10'));var freshdesk=require(_0xb4e7('0x11'));var desk=require(_0xb4e7('0x12'));var zoho=require(_0xb4e7('0x13'));var vtiger=require(_0xb4e7('0x14'));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'](_0xb4e7('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb4e7('0x16')](_0xb4e7('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xb4e7('0x17')]()[_0xb4e7('0x18')](user[_0xb4e7('0x19')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x1a')]())[_0xb4e7('0x18')](user['getTelephones']())[_0xb4e7('0x18')](realtime[_0xb4e7('0x1b')]())[_0xb4e7('0x18')](trunk[_0xb4e7('0x1c')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x1d')]())[_0xb4e7('0x18')](voiceQueue[_0xb4e7('0x1e')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x1f')]())[_0xb4e7('0x18')](trigger['getTriggers']())['then'](realtime[_0xb4e7('0x20')]())[_0xb4e7('0x18')](template[_0xb4e7('0x21')]())[_0xb4e7('0x18')](realtime['initTemplates']())['then'](zendesk[_0xb4e7('0x22')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x23')]())['then'](salesforce['getSalesforceAccounts']())[_0xb4e7('0x18')](realtime[_0xb4e7('0x24')]())[_0xb4e7('0x18')](sugarcrm[_0xb4e7('0x25')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x26')]())['then'](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0xb4e7('0x27')]())['then'](desk[_0xb4e7('0x28')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x29')]())[_0xb4e7('0x18')](zoho[_0xb4e7('0x2a')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x2b')]())['then'](vtiger[_0xb4e7('0x2c')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x2d')]())['then'](campaign[_0xb4e7('0x2e')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x2f')]())['then'](voiceExtension[_0xb4e7('0x30')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x31')]())[_0xb4e7('0x18')](faxAccount[_0xb4e7('0x32')]())[_0xb4e7('0x18')](realtime[_0xb4e7('0x33')]())[_0xb4e7('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0xb4e7('0x17')]()[_0xb4e7('0x18')](voiceQueueReport['getVoiceQueueReports']())[_0xb4e7('0x18')](realtime[_0xb4e7('0x34')]())['then'](cmHopperHistory[_0xb4e7('0x35')]())['then'](realtime[_0xb4e7('0x36')]())['then'](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())[_0xb4e7('0x18')](voiceCallReport[_0xb4e7('0x37')]())['then'](realtime[_0xb4e7('0x38')]())[_0xb4e7('0x18')](function(_0x2153d9){})[_0xb4e7('0x39')](function(_0x4fbb4d){console[_0xb4e7('0x3a')](_0x4fbb4d);});}function main(){return server[_0xb4e7('0x3b')](realtime,preview,fax)['then'](function(_0x44b062){return initRealtime();})[_0xb4e7('0x18')](function(){return initParams();})[_0xb4e7('0x18')](function(){report[_0xb4e7('0x3c')]();setInterval(initRealtime,0x1388);})[_0xb4e7('0x39')](function(_0xd98376){console[_0xb4e7('0x3a')](_0xd98376);});}main(); \ No newline at end of file +var _0x9bc5=['getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','sync','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','get','hour','resolve','getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts'];(function(_0x30f8ed,_0xc48d02){var _0x1a5243=function(_0x433659){while(--_0x433659){_0x30f8ed['push'](_0x30f8ed['shift']());}};_0x1a5243(++_0xc48d02);}(_0x9bc5,0xc6));var _0x59bc=function(_0x861613,_0x1b9304){_0x861613=_0x861613-0x0;var _0x4a0962=_0x9bc5[_0x861613];return _0x4a0962;};'use strict';var BPromise=require('bluebird');var util=require(_0x59bc('0x0'));var moment=require('moment');var server=require(_0x59bc('0x1'));var Realtime=require(_0x59bc('0x2'));var Report=require(_0x59bc('0x3'));var Acw=require(_0x59bc('0x4'));var Trigger=require(_0x59bc('0x5'));var Dialer=require(_0x59bc('0x6'));var Preview=require(_0x59bc('0x7'));var Fax=require(_0x59bc('0x8'));var user=require(_0x59bc('0x9'));var voiceQueue=require(_0x59bc('0xa'));var voiceQueueReport=require(_0x59bc('0xb'));var voiceCallReport=require(_0x59bc('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0x59bc('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0x59bc('0xe'));var campaign=require(_0x59bc('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x59bc('0x10'));var zendesk=require(_0x59bc('0x11'));var salesforce=require(_0x59bc('0x12'));var sugarcrm=require(_0x59bc('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x59bc('0x14'));var zoho=require(_0x59bc('0x15'));var vtiger=require('./rpc/integrations/vtiger');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()[_0x59bc('0x16')](_0x59bc('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x59bc('0x18')]()['then'](user[_0x59bc('0x19')]())[_0x59bc('0x1a')](realtime['initAgents']())[_0x59bc('0x1a')](user[_0x59bc('0x1b')]())['then'](realtime[_0x59bc('0x1c')]())['then'](trunk[_0x59bc('0x1d')]())['then'](realtime[_0x59bc('0x1e')]())[_0x59bc('0x1a')](voiceQueue['getVoiceQueues']())['then'](realtime[_0x59bc('0x1f')]())['then'](trigger[_0x59bc('0x20')]())[_0x59bc('0x1a')](realtime[_0x59bc('0x21')]())[_0x59bc('0x1a')](template['getTemplates']())[_0x59bc('0x1a')](realtime[_0x59bc('0x22')]())[_0x59bc('0x1a')](zendesk[_0x59bc('0x23')]())[_0x59bc('0x1a')](realtime['initZendeskAccounts']())[_0x59bc('0x1a')](salesforce[_0x59bc('0x24')]())[_0x59bc('0x1a')](realtime[_0x59bc('0x25')]())[_0x59bc('0x1a')](sugarcrm[_0x59bc('0x26')]())[_0x59bc('0x1a')](realtime[_0x59bc('0x27')]())['then'](freshdesk[_0x59bc('0x28')]())[_0x59bc('0x1a')](realtime[_0x59bc('0x29')]())[_0x59bc('0x1a')](desk['getDeskAccounts']())[_0x59bc('0x1a')](realtime[_0x59bc('0x2a')]())['then'](zoho[_0x59bc('0x2b')]())[_0x59bc('0x1a')](realtime[_0x59bc('0x2c')]())[_0x59bc('0x1a')](vtiger[_0x59bc('0x2d')]())[_0x59bc('0x1a')](realtime[_0x59bc('0x2e')]())[_0x59bc('0x1a')](campaign[_0x59bc('0x2f')]())['then'](realtime[_0x59bc('0x30')]())[_0x59bc('0x1a')](voiceExtension['getVoiceExtensions']())[_0x59bc('0x1a')](realtime[_0x59bc('0x31')]())[_0x59bc('0x1a')](faxAccount[_0x59bc('0x32')]())[_0x59bc('0x1a')](realtime[_0x59bc('0x33')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x59bc('0x18')]()[_0x59bc('0x1a')](voiceQueueReport[_0x59bc('0x34')]())[_0x59bc('0x1a')](realtime[_0x59bc('0x35')]())['then'](cmHopperHistory[_0x59bc('0x36')]())['then'](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())[_0x59bc('0x1a')](voiceCallReport[_0x59bc('0x37')]())[_0x59bc('0x1a')](realtime[_0x59bc('0x38')]())[_0x59bc('0x1a')](function(_0x158c4b){})[_0x59bc('0x39')](function(_0x4f2e9d){console['log'](_0x4f2e9d);});}function main(){return server['listen'](realtime,preview,fax)[_0x59bc('0x1a')](function(_0x4adf74){return initRealtime();})[_0x59bc('0x1a')](function(){return initParams();})[_0x59bc('0x1a')](function(){report[_0x59bc('0x3a')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x358fec){console['log'](_0x358fec);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 61cdeee..d1957e6 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 _0x5266=['exports','lodash','util','md5','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','toNumber','format','stringify','user:%s','emit','user:save'];(function(_0x39eb4c,_0x3bdb6d){var _0x5f4d5f=function(_0x4ef3eb){while(--_0x4ef3eb){_0x39eb4c['push'](_0x39eb4c['shift']());}};_0x5f4d5f(++_0x3bdb6d);}(_0x5266,0xf1));var _0x6526=function(_0x469b7d,_0x4760f8){_0x469b7d=_0x469b7d-0x0;var _0xc78a4b=_0x5266[_0x469b7d];return _0xc78a4b;};'use strict';var _=require(_0x6526('0x0'));var util=require(_0x6526('0x1'));var moment=require('moment');var md5=require(_0x6526('0x2'));var Redis=require('ioredis');var config=require(_0x6526('0x3'));config['redis']=_[_0x6526('0x4')](config['redis'],{'host':_0x6526('0x5'),'port':0x18eb});var io=require(_0x6526('0x6'))(new Redis(config[_0x6526('0x7')]));function Agent(_0x10b5f8){this['id']=_0x10b5f8['id']||0x0;this[_0x6526('0x8')]=_0x10b5f8['name']||'';this['email']=_0x10b5f8[_0x6526('0x9')]||'';this[_0x6526('0xa')]=_0x10b5f8[_0x6526('0xa')]||'';this[_0x6526('0xb')]=_0x10b5f8[_0x6526('0xb')]||'';this[_0x6526('0xc')]=_0x6526('0xd');this[_0x6526('0xe')]=0x0;this[_0x6526('0xf')]=_0x6526('0xd');this[_0x6526('0x10')]='';this[_0x6526('0x11')]='';this[_0x6526('0x12')]='';this[_0x6526('0x13')]='';this[_0x6526('0x14')]=_0x10b5f8[_0x6526('0x14')]||![];this[_0x6526('0x15')]=_0x6526('0xd');this[_0x6526('0x16')]=0x0;this[_0x6526('0x17')]='';this[_0x6526('0x18')]='';this[_0x6526('0x19')]=![];this[_0x6526('0x1a')]=![];this['md5']='';}Agent[_0x6526('0x1b')][_0x6526('0x1c')]=function(_0x282fc2){var _0x49f90f;if(_0x282fc2&&_0x282fc2['state']){_0x49f90f=_0x282fc2[_0x6526('0xc')][_0x6526('0x1d')]();switch(_0x49f90f){case _0x6526('0x1e'):_0x49f90f='idle';break;case _0x6526('0x1f'):_0x49f90f=_0x6526('0x20');break;}}if(_0x49f90f&&this[_0x6526('0x15')]!==_0x49f90f||_0x282fc2['statePause']){this[_0x6526('0x16')]=_[_0x6526('0x21')](moment()[_0x6526('0x22')]('x'));}if(_0x49f90f){this[_0x6526('0x15')]=_0x49f90f;}var _0x23961e={'id':this['id'],'name':this[_0x6526('0x8')],'email':this[_0x6526('0x9')],'accountcode':this[_0x6526('0xa')],'fullname':this[_0x6526('0xb')],'state':this['state'],'stateTime':this[_0x6526('0xe')],'status':this[_0x6526('0xf')],'address':this['address'],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x6526('0x16')],'voiceStatusCallerIdNumber':this[_0x6526('0x17')],'voiceStatusQueue':this[_0x6526('0x18')],'interface':this[_0x6526('0x13')],'onhold':this[_0x6526('0x19')]};var _0x44a808=md5(JSON[_0x6526('0x23')](_0x23961e));if(this[_0x6526('0x2')]!==_0x44a808){this['md5']=_0x44a808;io['to'](util[_0x6526('0x22')](_0x6526('0x24'),_0x23961e[_0x6526('0x8')]))[_0x6526('0x25')](_0x6526('0x26'),_0x23961e);}};module[_0x6526('0x27')]=Agent; \ No newline at end of file +var _0x5d8b=['localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','updateStatusRealtime','toLowerCase','idle','inuse','voiceStatus','statePause','toNumber','format','onhold','stringify','user:%s','emit','user:save','lodash','ioredis','../../../config/environment','redis','defaults'];(function(_0x2d146c,_0x5d11f3){var _0x4f081f=function(_0x24ccdc){while(--_0x24ccdc){_0x2d146c['push'](_0x2d146c['shift']());}};_0x4f081f(++_0x5d11f3);}(_0x5d8b,0x123));var _0xb5d8=function(_0x43e3fc,_0x468c59){_0x43e3fc=_0x43e3fc-0x0;var _0x470b04=_0x5d8b[_0x43e3fc];return _0x470b04;};'use strict';var _=require(_0xb5d8('0x0'));var util=require('util');var moment=require('moment');var md5=require('md5');var Redis=require(_0xb5d8('0x1'));var config=require(_0xb5d8('0x2'));config[_0xb5d8('0x3')]=_[_0xb5d8('0x4')](config[_0xb5d8('0x3')],{'host':_0xb5d8('0x5'),'port':0x18eb});var io=require(_0xb5d8('0x6'))(new Redis(config[_0xb5d8('0x3')]));function Agent(_0x3f3531){this['id']=_0x3f3531['id']||0x0;this[_0xb5d8('0x7')]=_0x3f3531[_0xb5d8('0x7')]||'';this[_0xb5d8('0x8')]=_0x3f3531[_0xb5d8('0x8')]||'';this['accountcode']=_0x3f3531[_0xb5d8('0x9')]||'';this[_0xb5d8('0xa')]=_0x3f3531['fullname']||'';this[_0xb5d8('0xb')]=_0xb5d8('0xc');this[_0xb5d8('0xd')]=0x0;this[_0xb5d8('0xe')]=_0xb5d8('0xc');this[_0xb5d8('0xf')]='';this[_0xb5d8('0x10')]='';this['mobile']='';this[_0xb5d8('0x11')]='';this[_0xb5d8('0x12')]=_0x3f3531[_0xb5d8('0x12')]||![];this['voiceStatus']=_0xb5d8('0xc');this[_0xb5d8('0x13')]=0x0;this[_0xb5d8('0x14')]='';this[_0xb5d8('0x15')]='';this['onhold']=![];this[_0xb5d8('0x16')]=![];this[_0xb5d8('0x17')]='';}Agent['prototype'][_0xb5d8('0x18')]=function(_0x309e11){var _0xfa860e;if(_0x309e11&&_0x309e11[_0xb5d8('0xb')]){_0xfa860e=_0x309e11[_0xb5d8('0xb')][_0xb5d8('0x19')]();switch(_0xfa860e){case'not_inuse':_0xfa860e=_0xb5d8('0x1a');break;case _0xb5d8('0x1b'):_0xfa860e='talking';break;}}if(_0xfa860e&&this[_0xb5d8('0x1c')]!==_0xfa860e||_0x309e11[_0xb5d8('0x1d')]){this['voiceStatusTime']=_[_0xb5d8('0x1e')](moment()[_0xb5d8('0x1f')]('x'));}if(_0xfa860e){this['voiceStatus']=_0xfa860e;}var _0x3faa3a={'id':this['id'],'name':this['name'],'email':this[_0xb5d8('0x8')],'accountcode':this['accountcode'],'fullname':this[_0xb5d8('0xa')],'state':this['state'],'stateTime':this[_0xb5d8('0xd')],'status':this[_0xb5d8('0xe')],'address':this[_0xb5d8('0xf')],'online':this[_0xb5d8('0x12')],'voiceStatus':this[_0xb5d8('0x1c')],'voiceStatusTime':this[_0xb5d8('0x13')],'voiceStatusCallerIdNumber':this[_0xb5d8('0x14')],'voiceStatusQueue':this[_0xb5d8('0x15')],'interface':this['interface'],'onhold':this[_0xb5d8('0x20')]};var _0x26e9cf=md5(JSON[_0xb5d8('0x21')](_0x3faa3a));if(this[_0xb5d8('0x17')]!==_0x26e9cf){this[_0xb5d8('0x17')]=_0x26e9cf;io['to'](util[_0xb5d8('0x1f')](_0xb5d8('0x22'),_0x3faa3a['name']))[_0xb5d8('0x23')](_0xb5d8('0x24'),_0x3faa3a);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 87b74f6..c4d2c2b 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 _0x1152=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','sendMessageOneNotActive','active','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1152,0x182));var _0x2115=function(_0x43b4b5,_0x3efc1b){_0x43b4b5=_0x43b4b5-0x0;var _0x2df432=_0x1152[_0x43b4b5];return _0x2df432;};'use strict';function Campaign(_0x414bf7){this['id']=_0x414bf7['id']||0x0;this[_0x2115('0x0')]=_0x414bf7[_0x2115('0x0')]||'';this[_0x2115('0x1')]=_0x414bf7[_0x2115('0x1')]||_0x2115('0x2');this[_0x2115('0x3')]=0x0;this[_0x2115('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x2115('0x5')]=0x0;this['message']='';this[_0x2115('0x6')]=!![];this[_0x2115('0x7')]=_0x414bf7['active'];this['limitCalls']=_0x414bf7['limitCalls'];this['dialTimezone']=_0x414bf7['dialTimezone']||null;this[_0x2115('0x8')]=_0x414bf7[_0x2115('0x8')]?_0x414bf7[_0x2115('0x8')]:null;this['dialOriginateCallerIdName']=_0x414bf7[_0x2115('0x9')];this['dialOriginateCallerIdNumber']=_0x414bf7['dialOriginateCallerIdNumber'];this[_0x2115('0xa')]=_0x414bf7[_0x2115('0xa')]||0x1e;this[_0x2115('0xb')]=_0x414bf7['dialCongestionMaxRetry'];this[_0x2115('0xc')]=_0x414bf7['dialCongestionRetryFrequency'];this[_0x2115('0xd')]=_0x414bf7[_0x2115('0xd')];this[_0x2115('0xe')]=_0x414bf7[_0x2115('0xe')];this[_0x2115('0xf')]=_0x414bf7['dialNoAnswerMaxRetry'];this[_0x2115('0x10')]=_0x414bf7['dialNoAnswerRetryFrequency'];this[_0x2115('0x11')]=_0x414bf7[_0x2115('0x11')];this[_0x2115('0x12')]=_0x414bf7[_0x2115('0x12')]||_0x2115('0x13');this[_0x2115('0x14')]=_0x414bf7[_0x2115('0x14')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x414bf7[_0x2115('0x15')]||undefined;this[_0x2115('0x16')]=_0x414bf7[_0x2115('0x16')]||undefined;this[_0x2115('0x17')]=_0x414bf7[_0x2115('0x17')]?_0x414bf7[_0x2115('0x17')]:undefined;this[_0x2115('0x18')]=_0x414bf7[_0x2115('0x18')]?_0x414bf7['Trunk']:undefined;this[_0x2115('0x19')]=_0x414bf7[_0x2115('0x19')]?_0x414bf7[_0x2115('0x19')]:undefined;this['SquareProject']=_0x414bf7[_0x2115('0x1a')]?_0x414bf7[_0x2115('0x1a')]:undefined;this[_0x2115('0x1b')]=_0x414bf7[_0x2115('0x1a')]?_0x414bf7[_0x2115('0x1a')][_0x2115('0x0')]:undefined;this[_0x2115('0x1c')]=_0x414bf7[_0x2115('0x1c')]||![];this[_0x2115('0x1d')]=_0x414bf7[_0x2115('0x1d')];this[_0x2115('0x1e')]=_0x414bf7[_0x2115('0x1e')];this[_0x2115('0x1f')]=_0x414bf7[_0x2115('0x1f')];this['dialAMDTotalAnalysisTime']=_0x414bf7[_0x2115('0x20')];this[_0x2115('0x21')]=_0x414bf7[_0x2115('0x21')];this[_0x2115('0x22')]=_0x414bf7[_0x2115('0x22')];this[_0x2115('0x23')]=_0x414bf7['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x414bf7['dialAMDSilenceThreshold'];this[_0x2115('0x24')]=_0x414bf7[_0x2115('0x24')];}module[_0x2115('0x25')]=Campaign; \ No newline at end of file +var _0x2750=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x568c88,_0x4bfc44){var _0x589375=function(_0x3732d2){while(--_0x3732d2){_0x568c88['push'](_0x568c88['shift']());}};_0x589375(++_0x4bfc44);}(_0x2750,0x13b));var _0x0275=function(_0x136684,_0x13acf4){_0x136684=_0x136684-0x0;var _0x411d9b=_0x2750[_0x136684];return _0x411d9b;};'use strict';function Campaign(_0x1c9f4d){this['id']=_0x1c9f4d['id']||0x0;this['name']=_0x1c9f4d[_0x0275('0x0')]||'';this[_0x0275('0x1')]=_0x1c9f4d[_0x0275('0x1')]||_0x0275('0x2');this[_0x0275('0x3')]=0x0;this[_0x0275('0x4')]=0x0;this[_0x0275('0x5')]=0x0;this[_0x0275('0x6')]=0x0;this[_0x0275('0x7')]='';this[_0x0275('0x8')]=!![];this['active']=_0x1c9f4d[_0x0275('0x9')];this[_0x0275('0xa')]=_0x1c9f4d[_0x0275('0xa')];this[_0x0275('0xb')]=_0x1c9f4d['dialTimezone']||null;this[_0x0275('0xc')]=_0x1c9f4d[_0x0275('0xc')]?_0x1c9f4d[_0x0275('0xc')]:null;this['dialOriginateCallerIdName']=_0x1c9f4d['dialOriginateCallerIdName'];this[_0x0275('0xd')]=_0x1c9f4d['dialOriginateCallerIdNumber'];this[_0x0275('0xe')]=_0x1c9f4d[_0x0275('0xe')]||0x1e;this[_0x0275('0xf')]=_0x1c9f4d[_0x0275('0xf')];this[_0x0275('0x10')]=_0x1c9f4d['dialCongestionRetryFrequency'];this[_0x0275('0x11')]=_0x1c9f4d[_0x0275('0x11')];this[_0x0275('0x12')]=_0x1c9f4d['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x1c9f4d[_0x0275('0x13')];this[_0x0275('0x14')]=_0x1c9f4d[_0x0275('0x14')];this[_0x0275('0x15')]=_0x1c9f4d[_0x0275('0x15')];this[_0x0275('0x16')]=_0x1c9f4d['dialOrderByScheduledAt']||_0x0275('0x17');this[_0x0275('0x18')]=_0x1c9f4d['dialPrefix']||undefined;this[_0x0275('0x19')]=_0x1c9f4d[_0x0275('0x19')]||undefined;this['dialCutDigit']=_0x1c9f4d[_0x0275('0x1a')]||undefined;this[_0x0275('0x1b')]=_0x1c9f4d['TrunkBackup']?_0x1c9f4d['TrunkBackup']:undefined;this['Trunk']=_0x1c9f4d['Trunk']?_0x1c9f4d['Trunk']:undefined;this[_0x0275('0x1c')]=_0x1c9f4d[_0x0275('0x1c')]?_0x1c9f4d[_0x0275('0x1c')]:undefined;this['SquareProject']=_0x1c9f4d[_0x0275('0x1d')]?_0x1c9f4d[_0x0275('0x1d')]:undefined;this[_0x0275('0x1e')]=_0x1c9f4d['SquareProject']?_0x1c9f4d[_0x0275('0x1d')][_0x0275('0x0')]:undefined;this['dialAMDActive']=_0x1c9f4d['dialAMDActive']||![];this[_0x0275('0x1f')]=_0x1c9f4d[_0x0275('0x1f')];this[_0x0275('0x20')]=_0x1c9f4d['dialAMDGreeting'];this[_0x0275('0x21')]=_0x1c9f4d['dialAMDAfterGreetingSilence'];this[_0x0275('0x22')]=_0x1c9f4d['dialAMDTotalAnalysisTime'];this[_0x0275('0x23')]=_0x1c9f4d[_0x0275('0x23')];this['dialAMDBetweenWordsSilence']=_0x1c9f4d[_0x0275('0x24')];this[_0x0275('0x25')]=_0x1c9f4d[_0x0275('0x25')];this['dialAMDSilenceThreshold']=_0x1c9f4d[_0x0275('0x26')];this[_0x0275('0x27')]=_0x1c9f4d[_0x0275('0x27')];}module[_0x0275('0x28')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6443839..fa8d58a 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 _0x34f0=['uniqueid','exten','answered','endtime','abandoned','lastapplication','lastdata','holdtime','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','connectedlinenum','connectedlinename','accountcode','context'];(function(_0xc84970,_0x750d4a){var _0x22556e=function(_0xa9e22){while(--_0xa9e22){_0xc84970['push'](_0xc84970['shift']());}};_0x22556e(++_0x750d4a);}(_0x34f0,0x13b));var _0x034f=function(_0x1bc7fb,_0x118f79){_0x1bc7fb=_0x1bc7fb-0x0;var _0x104f25=_0x34f0[_0x1bc7fb];return _0x104f25;};'use strict';function Channel(){this[_0x034f('0x0')]=null;this[_0x034f('0x1')]='';this['destinationchannel']='';this[_0x034f('0x2')]=0x0;this['calleridname']='';this[_0x034f('0x3')]=undefined;this[_0x034f('0x4')]=undefined;this[_0x034f('0x5')]=0x0;this[_0x034f('0x6')]='';this[_0x034f('0x7')]=0x0;this['linkedid']=0x0;this[_0x034f('0x8')]=0x0;this[_0x034f('0x9')]=![];this['answertime']=null;this[_0x034f('0xa')]=null;this['unmanaged']=![];this[_0x034f('0xb')]=![];this[_0x034f('0xc')]='';this[_0x034f('0xd')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x034f('0xe')]=0x0;this['type']=null;this['tag']=null;this[_0x034f('0xf')]=null;this[_0x034f('0x10')]=![];this[_0x034f('0x11')]=null;this[_0x034f('0x12')]=null;this[_0x034f('0x13')]=[];this['transfercalleridnum']=undefined;this[_0x034f('0x14')]=undefined;this[_0x034f('0x15')]=0x0;}module[_0x034f('0x16')]=Channel; \ No newline at end of file +var _0x8838=['holdtime','type','disposition','monitor','monitorFilename','queue','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','endtime','abandoned','lastapplication','lastdata','duration','billableseconds'];(function(_0x208950,_0x53dbee){var _0x2b2aa6=function(_0x314b84){while(--_0x314b84){_0x208950['push'](_0x208950['shift']());}};_0x2b2aa6(++_0x53dbee);}(_0x8838,0x90));var _0x8883=function(_0x33b10a,_0x147e12){_0x33b10a=_0x33b10a-0x0;var _0x166203=_0x8838[_0x33b10a];return _0x166203;};'use strict';function Channel(){this[_0x8883('0x0')]=null;this[_0x8883('0x1')]='';this[_0x8883('0x2')]='';this[_0x8883('0x3')]=0x0;this[_0x8883('0x4')]='';this[_0x8883('0x5')]=undefined;this[_0x8883('0x6')]=undefined;this[_0x8883('0x7')]=0x0;this[_0x8883('0x8')]='';this[_0x8883('0x9')]=0x0;this[_0x8883('0xa')]=0x0;this[_0x8883('0xb')]=0x0;this['answered']=![];this['answertime']=null;this[_0x8883('0xc')]=null;this['unmanaged']=![];this[_0x8883('0xd')]=![];this[_0x8883('0xe')]='';this[_0x8883('0xf')]='';this[_0x8883('0x10')]=0x0;this[_0x8883('0x11')]=0x0;this[_0x8883('0x12')]=0x0;this[_0x8883('0x13')]=null;this['tag']=null;this[_0x8883('0x14')]=null;this[_0x8883('0x15')]=![];this[_0x8883('0x16')]=null;this[_0x8883('0x17')]=null;this['monitors']=[];this[_0x8883('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x8883('0x19')]=0x0;}module[_0x8883('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index da04964..f7ff561 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 _0xcd99=['consumerKey','consumerSecret','tokenSecret','serverUrl','Configurations','exports','name','username','authType','password'];(function(_0x763d0e,_0x3af2ab){var _0x2e4a24=function(_0x49996b){while(--_0x49996b){_0x763d0e['push'](_0x763d0e['shift']());}};_0x2e4a24(++_0x3af2ab);}(_0xcd99,0x18c));var _0x9cd9=function(_0xb73f15,_0x13a0d6){_0xb73f15=_0xb73f15-0x0;var _0x155543=_0xcd99[_0xb73f15];return _0x155543;};'use strict';function DeskAccount(_0x491bff){this['id']=_0x491bff['id']||0x0;this[_0x9cd9('0x0')]=_0x491bff[_0x9cd9('0x0')]||'';this[_0x9cd9('0x1')]=_0x491bff[_0x9cd9('0x1')]||'';this['remoteUri']=_0x491bff['remoteUri']||'';this[_0x9cd9('0x2')]=_0x491bff['authType']||'';this[_0x9cd9('0x3')]=_0x491bff[_0x9cd9('0x3')]||'';this[_0x9cd9('0x4')]=_0x491bff[_0x9cd9('0x4')]||'';this[_0x9cd9('0x5')]=_0x491bff[_0x9cd9('0x5')]||'';this['token']=_0x491bff['token']||'';this['tokenSecret']=_0x491bff[_0x9cd9('0x6')]||'';this['type']=_0x491bff['type']||'';this[_0x9cd9('0x7')]=_0x491bff[_0x9cd9('0x7')]||'';this['Configurations']=_0x491bff[_0x9cd9('0x8')]||{};}module[_0x9cd9('0x9')]=DeskAccount; \ No newline at end of file +var _0x6c85=['Configurations','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type'];(function(_0x51e805,_0x169c64){var _0x53f95c=function(_0x18e926){while(--_0x18e926){_0x51e805['push'](_0x51e805['shift']());}};_0x53f95c(++_0x169c64);}(_0x6c85,0x1a5));var _0x56c8=function(_0x794558,_0x52b0ec){_0x794558=_0x794558-0x0;var _0x4ab609=_0x6c85[_0x794558];return _0x4ab609;};'use strict';function DeskAccount(_0x485d85){this['id']=_0x485d85['id']||0x0;this['name']=_0x485d85[_0x56c8('0x0')]||'';this[_0x56c8('0x1')]=_0x485d85[_0x56c8('0x1')]||'';this[_0x56c8('0x2')]=_0x485d85[_0x56c8('0x2')]||'';this[_0x56c8('0x3')]=_0x485d85[_0x56c8('0x3')]||'';this[_0x56c8('0x4')]=_0x485d85[_0x56c8('0x4')]||'';this['consumerKey']=_0x485d85['consumerKey']||'';this[_0x56c8('0x5')]=_0x485d85[_0x56c8('0x5')]||'';this[_0x56c8('0x6')]=_0x485d85['token']||'';this[_0x56c8('0x7')]=_0x485d85[_0x56c8('0x7')]||'';this[_0x56c8('0x8')]=_0x485d85['type']||'';this['serverUrl']=_0x485d85['serverUrl']||'';this[_0x56c8('0x9')]=_0x485d85[_0x56c8('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 79e967f..c107b7b 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 _0xf4eb=['ListId','key','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk'];(function(_0x5da398,_0x13a526){var _0x4db43a=function(_0x377646){while(--_0x377646){_0x5da398['push'](_0x5da398['shift']());}};_0x4db43a(++_0x13a526);}(_0xf4eb,0xec));var _0xbf4e=function(_0x429478,_0xc2d221){_0x429478=_0x429478-0x0;var _0x292417=_0xf4eb[_0x429478];return _0x292417;};'use strict';function FaxAccount(_0x3e6fbd){this['id']=_0x3e6fbd['id']||0x0;this['name']=_0x3e6fbd['name']||'';this['description']=_0x3e6fbd['description'];this[_0xbf4e('0x0')]=_0x3e6fbd['ecm'];this['headerinfo']=_0x3e6fbd[_0xbf4e('0x1')];this[_0xbf4e('0x2')]=_0x3e6fbd[_0xbf4e('0x2')];this[_0xbf4e('0x3')]=_0x3e6fbd[_0xbf4e('0x3')]||0x960;this[_0xbf4e('0x4')]=_0x3e6fbd[_0xbf4e('0x4')]||0x3840;this['modem']=_0x3e6fbd[_0xbf4e('0x5')]||'v17,v27,v29';this['gateway']=_0x3e6fbd[_0xbf4e('0x6')]||'no';this[_0xbf4e('0x7')]=_0x3e6fbd[_0xbf4e('0x7')]||'no';this[_0xbf4e('0x8')]=_0x3e6fbd[_0xbf4e('0x8')]||0x1388;this[_0xbf4e('0x9')]=_0x3e6fbd[_0xbf4e('0x9')]||'SIP';this['Trunk']=_0x3e6fbd[_0xbf4e('0xa')]?_0x3e6fbd['Trunk']:undefined;this[_0xbf4e('0xb')]=_0x3e6fbd[_0xbf4e('0xb')];this['key']=_0x3e6fbd[_0xbf4e('0xc')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x4483=['maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x2b8156,_0x1264c8){var _0x44f049=function(_0x62cc30){while(--_0x62cc30){_0x2b8156['push'](_0x2b8156['shift']());}};_0x44f049(++_0x1264c8);}(_0x4483,0x1a3));var _0x3448=function(_0x510c2e,_0x489682){_0x510c2e=_0x510c2e-0x0;var _0x470ac7=_0x4483[_0x510c2e];return _0x470ac7;};'use strict';function FaxAccount(_0x43f30d){this['id']=_0x43f30d['id']||0x0;this[_0x3448('0x0')]=_0x43f30d[_0x3448('0x0')]||'';this['description']=_0x43f30d[_0x3448('0x1')];this[_0x3448('0x2')]=_0x43f30d[_0x3448('0x2')];this[_0x3448('0x3')]=_0x43f30d[_0x3448('0x3')];this['localstationid']=_0x43f30d[_0x3448('0x4')];this[_0x3448('0x5')]=_0x43f30d[_0x3448('0x5')]||0x960;this[_0x3448('0x6')]=_0x43f30d[_0x3448('0x6')]||0x3840;this[_0x3448('0x7')]=_0x43f30d[_0x3448('0x7')]||_0x3448('0x8');this['gateway']=_0x43f30d['gateway']||'no';this[_0x3448('0x9')]=_0x43f30d[_0x3448('0x9')]||'no';this[_0x3448('0xa')]=_0x43f30d[_0x3448('0xa')]||0x1388;this[_0x3448('0xb')]=_0x43f30d[_0x3448('0xb')]||_0x3448('0xc');this[_0x3448('0xd')]=_0x43f30d[_0x3448('0xd')]?_0x43f30d[_0x3448('0xd')]:undefined;this[_0x3448('0xe')]=_0x43f30d['ListId'];this['key']=_0x43f30d[_0x3448('0xf')];}module[_0x3448('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 6fe22e2..7c9d963 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 _0xbef4=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x4ece58,_0x50922a){var _0x20d209=function(_0x3de5f6){while(--_0x3de5f6){_0x4ece58['push'](_0x4ece58['shift']());}};_0x20d209(++_0x50922a);}(_0xbef4,0x182));var _0x4bef=function(_0x131604,_0x475a68){_0x131604=_0x131604-0x0;var _0x4a2aea=_0xbef4[_0x131604];return _0x4a2aea;};'use strict';function FreshdeskAccount(_0x932862){this['id']=_0x932862['id']||0x0;this[_0x4bef('0x0')]=_0x932862[_0x4bef('0x0')]||'';this[_0x4bef('0x1')]=_0x932862[_0x4bef('0x1')]||'';this[_0x4bef('0x2')]=_0x932862[_0x4bef('0x3')]||'';this[_0x4bef('0x4')]=_0x932862[_0x4bef('0x4')]||'';this['serverUrl']=_0x932862[_0x4bef('0x5')]||'';this[_0x4bef('0x6')]=_0x932862[_0x4bef('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x6603=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x4920a1,_0x6ed284){var _0x424013=function(_0x788a50){while(--_0x788a50){_0x4920a1['push'](_0x4920a1['shift']());}};_0x424013(++_0x6ed284);}(_0x6603,0x1e4));var _0x3660=function(_0xfe37da,_0x20fa71){_0xfe37da=_0xfe37da-0x0;var _0x3009a5=_0x6603[_0xfe37da];return _0x3009a5;};'use strict';function FreshdeskAccount(_0x7f9e25){this['id']=_0x7f9e25['id']||0x0;this['name']=_0x7f9e25[_0x3660('0x0')]||'';this[_0x3660('0x1')]=_0x7f9e25[_0x3660('0x1')]||'';this[_0x3660('0x2')]=_0x7f9e25[_0x3660('0x3')]||'';this[_0x3660('0x4')]=_0x7f9e25[_0x3660('0x4')]||'';this[_0x3660('0x5')]=_0x7f9e25[_0x3660('0x5')]||'';this[_0x3660('0x6')]=_0x7f9e25[_0x3660('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 245961e..7978afc 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 _0xc7e2=['position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename','accountcode','context','exten','assigned','mohtime','variables','exports','type','inbound','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x2e21e7,_0x5def61){var _0x3bb3d7=function(_0x31b346){while(--_0x31b346){_0x2e21e7['push'](_0x2e21e7['shift']());}};_0x3bb3d7(++_0x5def61);}(_0xc7e2,0xc0));var _0x2c7e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7e2[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0x2c7e('0x0')]=_0x2c7e('0x1');this['uniqueid']='';this['calleridnum']='';this[_0x2c7e('0x2')]='';this[_0x2c7e('0x3')]='';this[_0x2c7e('0x4')]=null;this[_0x2c7e('0x5')]=null;this[_0x2c7e('0x6')]=0x1;this['count']=0x1;this[_0x2c7e('0x7')]=![];this[_0x2c7e('0x8')]=null;this[_0x2c7e('0x9')]=![];this[_0x2c7e('0xa')]=null;this[_0x2c7e('0xb')]=![];this[_0x2c7e('0xc')]=null;this['originalposition']=0x1;this['channel']='';this[_0x2c7e('0xd')]='';this[_0x2c7e('0xe')]='';this[_0x2c7e('0xf')]='';this[_0x2c7e('0x10')]='';this[_0x2c7e('0x11')]='';this['priority']='';this['holdtime']=0x0;this[_0x2c7e('0x12')]=![];this['lastAssignedTo']='';this[_0x2c7e('0x13')]=0x0;this[_0x2c7e('0x14')]={};}module[_0x2c7e('0x15')]=QueueReport; \ No newline at end of file +var _0xa937=['holdtime','lastAssignedTo','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','priority'];(function(_0x8b6a3d,_0x2b99a9){var _0x20cdc5=function(_0x1ac6e9){while(--_0x1ac6e9){_0x8b6a3d['push'](_0x8b6a3d['shift']());}};_0x20cdc5(++_0x2b99a9);}(_0xa937,0x163));var _0x7a93=function(_0x400aaf,_0x554050){_0x400aaf=_0x400aaf-0x0;var _0xa41b93=_0xa937[_0x400aaf];return _0xa41b93;};'use strict';function QueueReport(){this[_0x7a93('0x0')]='inbound';this[_0x7a93('0x1')]='';this[_0x7a93('0x2')]='';this[_0x7a93('0x3')]='';this[_0x7a93('0x4')]='';this['queuecallerjoinAt']=null;this[_0x7a93('0x5')]=null;this[_0x7a93('0x6')]=0x1;this[_0x7a93('0x7')]=0x1;this[_0x7a93('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x7a93('0x9')]=![];this[_0x7a93('0xa')]=null;this['queuecallerexit']=![];this[_0x7a93('0xb')]=null;this[_0x7a93('0xc')]=0x1;this[_0x7a93('0xd')]='';this[_0x7a93('0xe')]='';this[_0x7a93('0xf')]='';this['accountcode']='';this[_0x7a93('0x10')]='';this[_0x7a93('0x11')]='';this[_0x7a93('0x12')]='';this[_0x7a93('0x13')]=0x0;this['assigned']=![];this[_0x7a93('0x14')]='';this['mohtime']=0x0;this[_0x7a93('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 25e2394..b00469e 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 _0x2018=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x2018,0xdd));var _0x8201=function(_0x4b6314,_0x960a41){_0x4b6314=_0x4b6314-0x0;var _0x512faa=_0x2018[_0x4b6314];return _0x512faa;};'use strict';function SalesforceAccount(_0x451ebd){this['id']=_0x451ebd['id']||0x0;this[_0x8201('0x0')]=_0x451ebd[_0x8201('0x0')]||'';this['username']=_0x451ebd[_0x8201('0x1')]||'';this[_0x8201('0x2')]=_0x451ebd[_0x8201('0x2')]||'';this['password']=_0x451ebd[_0x8201('0x3')]||'';this[_0x8201('0x4')]=_0x451ebd[_0x8201('0x4')]||'';this[_0x8201('0x5')]=_0x451ebd['clientSecret']||'';this[_0x8201('0x6')]=_0x451ebd[_0x8201('0x6')]||'';this['type']=_0x451ebd[_0x8201('0x7')]||_0x8201('0x8');this[_0x8201('0x9')]=_0x451ebd[_0x8201('0x9')]||'';this[_0x8201('0xa')]=_0x451ebd[_0x8201('0xa')]||{};}module[_0x8201('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x2e6b=['serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','integrationTab'];(function(_0x514076,_0x3e6a00){var _0x1954ce=function(_0x18907b){while(--_0x18907b){_0x514076['push'](_0x514076['shift']());}};_0x1954ce(++_0x3e6a00);}(_0x2e6b,0xb6));var _0xb2e6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2e6b[_0x20a584];return _0x4b41a8;};'use strict';function SalesforceAccount(_0xbd51cf){this['id']=_0xbd51cf['id']||0x0;this[_0xb2e6('0x0')]=_0xbd51cf[_0xb2e6('0x0')]||'';this[_0xb2e6('0x1')]=_0xbd51cf[_0xb2e6('0x1')]||'';this[_0xb2e6('0x2')]=_0xbd51cf[_0xb2e6('0x2')]||'';this[_0xb2e6('0x3')]=_0xbd51cf['password']||'';this[_0xb2e6('0x4')]=_0xbd51cf[_0xb2e6('0x4')]||'';this[_0xb2e6('0x5')]=_0xbd51cf['clientSecret']||'';this[_0xb2e6('0x6')]=_0xbd51cf[_0xb2e6('0x6')]||'';this['type']=_0xbd51cf['type']||_0xb2e6('0x7');this[_0xb2e6('0x8')]=_0xbd51cf[_0xb2e6('0x8')]||'';this[_0xb2e6('0x9')]=_0xbd51cf[_0xb2e6('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index be5ac67..c32e66c 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 _0x4016=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x9f021c,_0x59b485){var _0x3f6ca8=function(_0x2d9b17){while(--_0x2d9b17){_0x9f021c['push'](_0x9f021c['shift']());}};_0x3f6ca8(++_0x59b485);}(_0x4016,0xed));var _0x6401=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4016[_0x1facfa];return _0x9ec701;};'use strict';function SugarcrmAccount(_0x506f7a){this['id']=_0x506f7a['id']||0x0;this['name']=_0x506f7a[_0x6401('0x0')]||'';this[_0x6401('0x1')]=_0x506f7a[_0x6401('0x1')]||'';this[_0x6401('0x2')]=_0x506f7a[_0x6401('0x2')]||'';this[_0x6401('0x3')]=_0x506f7a[_0x6401('0x3')]||'';this[_0x6401('0x4')]=_0x506f7a[_0x6401('0x4')]||'';this[_0x6401('0x5')]=_0x506f7a[_0x6401('0x5')]||{};}module[_0x6401('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xe3f6=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x50514b,_0x83db65){var _0x5d8587=function(_0x327ba5){while(--_0x327ba5){_0x50514b['push'](_0x50514b['shift']());}};_0x5d8587(++_0x83db65);}(_0xe3f6,0x12e));var _0x6e3f=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xe3f6[_0x4b7895];return _0x264180;};'use strict';function SugarcrmAccount(_0x5e11ba){this['id']=_0x5e11ba['id']||0x0;this['name']=_0x5e11ba[_0x6e3f('0x0')]||'';this['username']=_0x5e11ba[_0x6e3f('0x1')]||'';this[_0x6e3f('0x2')]=_0x5e11ba[_0x6e3f('0x2')]||'';this[_0x6e3f('0x3')]=_0x5e11ba[_0x6e3f('0x3')]||'';this[_0x6e3f('0x4')]=_0x5e11ba[_0x6e3f('0x4')]||'';this[_0x6e3f('0x5')]=_0x5e11ba[_0x6e3f('0x5')]||{};}module[_0x6e3f('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 87fc810..ae2452d 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 _0x1e08=['state','unknown','stateTime','status','address','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e08,0x1f0));var _0x81e0=function(_0x3cc4c8,_0x114636){_0x3cc4c8=_0x3cc4c8-0x0;var _0xdc0123=_0x1e08[_0x3cc4c8];return _0xdc0123;};'use strict';function Telephone(_0x3dab16){this['id']=_0x3dab16['id']||0x0;this['name']=_0x3dab16[_0x81e0('0x0')]||'';this['accountcode']=_0x3dab16['accountcode']||'';this[_0x81e0('0x1')]=_0x81e0('0x2');this[_0x81e0('0x3')]=0x0;this[_0x81e0('0x4')]='unknown';this[_0x81e0('0x5')]='';}module[_0x81e0('0x6')]=Telephone; \ No newline at end of file +var _0x3216=['stateTime','status','unknown','exports','name','accountcode','state'];(function(_0x1e9f22,_0x17b2b0){var _0x51b3a1=function(_0x30414c){while(--_0x30414c){_0x1e9f22['push'](_0x1e9f22['shift']());}};_0x51b3a1(++_0x17b2b0);}(_0x3216,0x146));var _0x6321=function(_0x1aa26f,_0x43055c){_0x1aa26f=_0x1aa26f-0x0;var _0x54442a=_0x3216[_0x1aa26f];return _0x54442a;};'use strict';function Telephone(_0x25d03a){this['id']=_0x25d03a['id']||0x0;this[_0x6321('0x0')]=_0x25d03a['name']||'';this[_0x6321('0x1')]=_0x25d03a[_0x6321('0x1')]||'';this[_0x6321('0x2')]='unknown';this[_0x6321('0x3')]=0x0;this[_0x6321('0x4')]=_0x6321('0x5');this['address']='';}module[_0x6321('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index e039554..6e07981 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 _0xd64b=['exports','name','html'];(function(_0x5a9f1e,_0x570dfb){var _0x4562cd=function(_0x461101){while(--_0x461101){_0x5a9f1e['push'](_0x5a9f1e['shift']());}};_0x4562cd(++_0x570dfb);}(_0xd64b,0xc1));var _0xbd64=function(_0x1cb61b,_0x4037a1){_0x1cb61b=_0x1cb61b-0x0;var _0x13923c=_0xd64b[_0x1cb61b];return _0x13923c;};'use strict';function template(_0x272488){this['id']=_0x272488['id']||0x0;this['name']=_0x272488[_0xbd64('0x0')]||'';this['html']=_0x272488[_0xbd64('0x1')]||'';}module[_0xbd64('0x2')]=template; \ No newline at end of file +var _0xf4eb=['exports'];(function(_0x57439c,_0x116a3f){var _0x5efb87=function(_0x2dc72a){while(--_0x2dc72a){_0x57439c['push'](_0x57439c['shift']());}};_0x5efb87(++_0x116a3f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x33a4f7,_0x3a3a9a){_0x33a4f7=_0x33a4f7-0x0;var _0x68f3ad=_0xf4eb[_0x33a4f7];return _0x68f3ad;};'use strict';function template(_0x3e6fbd){this['id']=_0x3e6fbd['id']||0x0;this['name']=_0x3e6fbd['name']||'';this['html']=_0x3e6fbd['html']||'';}module[_0xbf4e('0x0')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 4fea07f..053cf13 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 _0xf5a7=['channel','voice','status','AllConditions','Actions','exports','name'];(function(_0x51566a,_0x4f96bc){var _0x152159=function(_0x58a74f){while(--_0x58a74f){_0x51566a['push'](_0x51566a['shift']());}};_0x152159(++_0x4f96bc);}(_0xf5a7,0xdf));var _0x7f5a=function(_0x4cc74d,_0x57643f){_0x4cc74d=_0x4cc74d-0x0;var _0x2680d0=_0xf5a7[_0x4cc74d];return _0x2680d0;};'use strict';function Trigger(_0x37c973){this['id']=_0x37c973['id']||0x0;this[_0x7f5a('0x0')]=_0x37c973[_0x7f5a('0x0')]||'';this['channel']=_0x37c973[_0x7f5a('0x1')]||_0x7f5a('0x2');this[_0x7f5a('0x3')]=_0x37c973[_0x7f5a('0x3')]||![];this['AllConditions']=_0x37c973[_0x7f5a('0x4')]||[];this['AnyConditions']=_0x37c973['AnyConditions']||[];this[_0x7f5a('0x5')]=_0x37c973[_0x7f5a('0x5')]||[];}module[_0x7f5a('0x6')]=Trigger; \ No newline at end of file +var _0x20e2=['AnyConditions','Actions','name','channel','voice','status'];(function(_0x11cacd,_0x4ee2d3){var _0x17f2f0=function(_0x3a9155){while(--_0x3a9155){_0x11cacd['push'](_0x11cacd['shift']());}};_0x17f2f0(++_0x4ee2d3);}(_0x20e2,0x176));var _0x220e=function(_0x23461e,_0x1aadf0){_0x23461e=_0x23461e-0x0;var _0x5133ec=_0x20e2[_0x23461e];return _0x5133ec;};'use strict';function Trigger(_0x57c9e2){this['id']=_0x57c9e2['id']||0x0;this['name']=_0x57c9e2[_0x220e('0x0')]||'';this[_0x220e('0x1')]=_0x57c9e2[_0x220e('0x1')]||_0x220e('0x2');this[_0x220e('0x3')]=_0x57c9e2['status']||![];this['AllConditions']=_0x57c9e2['AllConditions']||[];this[_0x220e('0x4')]=_0x57c9e2[_0x220e('0x4')]||[];this['Actions']=_0x57c9e2[_0x220e('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 9fcf130..cd01757 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 _0xd304=['domain','domainport','stateRegistry','registrationtime','address','exports','active','stateTime','status','unknown','registry','indexOf','split','port'];(function(_0x25c7fb,_0x2e4e86){var _0x214b77=function(_0x36b7c0){while(--_0x36b7c0){_0x25c7fb['push'](_0x25c7fb['shift']());}};_0x214b77(++_0x2e4e86);}(_0xd304,0x18e));var _0x4d30=function(_0xfc2400,_0x50eebc){_0xfc2400=_0xfc2400-0x0;var _0x13cdc9=_0xd304[_0xfc2400];return _0x13cdc9;};'use strict';function Trunk(_0x2560bb){this['id']=_0x2560bb['id']||0x0;this[_0x4d30('0x0')]=_0x2560bb[_0x4d30('0x0')]||![];this['name']=_0x2560bb['name']||'';this['state']='unknown';this[_0x4d30('0x1')]=0x0;this[_0x4d30('0x2')]=_0x4d30('0x3');this[_0x4d30('0x4')]=_0x2560bb[_0x4d30('0x4')]&&_0x2560bb[_0x4d30('0x4')][_0x4d30('0x5')](':')?_0x2560bb[_0x4d30('0x4')][_0x4d30('0x6')](':')[0x0]:'';this['host']='';this[_0x4d30('0x7')]='';this[_0x4d30('0x8')]='';this[_0x4d30('0x9')]='';this['refresh']='';this[_0x4d30('0xa')]=_0x4d30('0x3');this[_0x4d30('0xb')]='';this[_0x4d30('0xc')]='';}module[_0x4d30('0xd')]=Trunk; \ No newline at end of file +var _0xf034=['stateTime','status','registry','indexOf','split','host','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','unknown'];(function(_0x145d8f,_0xa3e94a){var _0x28c5fd=function(_0x590ed8){while(--_0x590ed8){_0x145d8f['push'](_0x145d8f['shift']());}};_0x28c5fd(++_0xa3e94a);}(_0xf034,0x192));var _0x4f03=function(_0x5350d9,_0x2d1c41){_0x5350d9=_0x5350d9-0x0;var _0x36128b=_0xf034[_0x5350d9];return _0x36128b;};'use strict';function Trunk(_0x407cd7){this['id']=_0x407cd7['id']||0x0;this[_0x4f03('0x0')]=_0x407cd7[_0x4f03('0x0')]||![];this[_0x4f03('0x1')]=_0x407cd7[_0x4f03('0x1')]||'';this['state']=_0x4f03('0x2');this[_0x4f03('0x3')]=0x0;this[_0x4f03('0x4')]=_0x4f03('0x2');this[_0x4f03('0x5')]=_0x407cd7['registry']&&_0x407cd7['registry'][_0x4f03('0x6')](':')?_0x407cd7[_0x4f03('0x5')][_0x4f03('0x7')](':')[0x0]:'';this[_0x4f03('0x8')]='';this['port']='';this['domain']='';this[_0x4f03('0x9')]='';this[_0x4f03('0xa')]='';this[_0x4f03('0xb')]='unknown';this[_0x4f03('0xc')]='';this[_0x4f03('0xd')]='';}module[_0x4f03('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 fb27afd..f0a2073 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 _0xf109=['exten','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf109,0xce));var _0x9f10=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xf109[_0x36884e];return _0x1cc367;};'use strict';function voiceExtension(_0x4debcd){this['id']=_0x4debcd['id']||0x0;this[_0x9f10('0x0')]=_0x4debcd[_0x9f10('0x0')]||'';this['recordingFormat']=_0x4debcd['recordingFormat']||'none';}module[_0x9f10('0x1')]=voiceExtension; \ No newline at end of file +var _0x0bb5=['exten','recordingFormat','none','exports'];(function(_0x298777,_0x217d2f){var _0x123b57=function(_0x2f94f1){while(--_0x2f94f1){_0x298777['push'](_0x298777['shift']());}};_0x123b57(++_0x217d2f);}(_0x0bb5,0x148));var _0x50bb=function(_0x30bbbc,_0x59df09){_0x30bbbc=_0x30bbbc-0x0;var _0x480ca4=_0x0bb5[_0x30bbbc];return _0x480ca4;};'use strict';function voiceExtension(_0x4878e5){this['id']=_0x4878e5['id']||0x0;this[_0x50bb('0x0')]=_0x4878e5['exten']||'';this['recordingFormat']=_0x4878e5[_0x50bb('0x1')]||_0x50bb('0x2');}module[_0x50bb('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 d1ebe20..223fa2c 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 _0x5486=['dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalLowerLimit','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','busy','invalid','unavailable','ringing','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage'];(function(_0x588c78,_0x57d2f6){var _0x50a103=function(_0x5c9816){while(--_0x5c9816){_0x588c78['push'](_0x588c78['shift']());}};_0x50a103(++_0x57d2f6);}(_0x5486,0x165));var _0x6548=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5486[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=['unknown','not_inuse','inuse',_0x6548('0x0'),_0x6548('0x1'),_0x6548('0x2'),_0x6548('0x3'),'ringinuse',_0x6548('0x4')];var monitorFormat={'wav':_0x6548('0x5'),'wav49':'wav49','gsm':_0x6548('0x6')};var strategy={'rrmemory':_0x6548('0x7'),'roundrobin':_0x6548('0x8')};function VoiceQueue(_0x539ad1){this['id']=_0x539ad1['id']||0x0;this[_0x6548('0x9')]=_0x539ad1['name']||'';this[_0x6548('0xa')]=_0x539ad1['monitor_format']||'';this[_0x6548('0xb')]=_0x539ad1[_0x6548('0xb')]||_0x6548('0xc');this[_0x6548('0xd')]=0x0;this['talking']=0x0;this['total']=0x0;this['answered']=0x0;this[_0x6548('0xe')]=0x0;this[_0x6548('0xf')]=0x0;this[_0x6548('0x10')]=0x0;this[_0x6548('0x11')]=0x0;this[_0x6548('0x12')]=0x0;this[_0x6548('0x13')]=0x0;this[_0x6548('0x14')]=0x0;this['acw']=_0x539ad1[_0x6548('0x15')]||![];this['acwTimeout']=_0x539ad1[_0x6548('0x16')]||0xa;this[_0x6548('0x17')]=_0x539ad1['autopause']||'no';this[_0x6548('0x18')]=!![];this[_0x6548('0x19')]='';this[_0x6548('0x1a')]=0x0;this[_0x6548('0x1b')]=0x0;this[_0x6548('0x1c')]=_0x539ad1['dialTimezone']||null;this[_0x6548('0x1d')]=_0x539ad1['dialGlobalInterval']?_0x539ad1[_0x6548('0x1d')]:null;this[_0x6548('0x1e')]=_0x539ad1[_0x6548('0x1e')];this[_0x6548('0x1f')]=_0x539ad1[_0x6548('0x1f')]||_0x6548('0x20');this[_0x6548('0x21')]=_0x539ad1[_0x6548('0x21')]||0x0;this['dialLimitQueue']=_0x539ad1[_0x6548('0x22')]||0x0;this['dialPowerLevel']=_0x539ad1[_0x6548('0x23')]||0x1;this[_0x6548('0x24')]=_0x539ad1[_0x6548('0x24')]||_0x6548('0x25');this[_0x6548('0x26')]=_0x539ad1[_0x6548('0x26')]||0.03;this[_0x6548('0x27')]=_0x539ad1[_0x6548('0x27')]||0x258;this[_0x6548('0x28')]=_0x539ad1[_0x6548('0x28')]||_0x6548('0x29');this[_0x6548('0x2a')]=_0x539ad1[_0x6548('0x2a')]||_0x6548('0x29');this[_0x6548('0x2b')]=_0x539ad1[_0x6548('0x2b')]||0x1e;this[_0x6548('0x2c')]=_0x539ad1['dialQueueOptions']||_0x6548('0x2d');this[_0x6548('0x2e')]=_0x539ad1[_0x6548('0x2e')]||0x3;this[_0x6548('0x2f')]=_0x539ad1[_0x6548('0x2f')]||undefined;this['dialCongestionMaxRetry']=_0x539ad1[_0x6548('0x30')]||0x3;this['dialCongestionRetryFrequency']=_0x539ad1['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x539ad1['dialBusyMaxRetry']||0x3;this[_0x6548('0x31')]=_0x539ad1[_0x6548('0x31')]||0x96;this[_0x6548('0x32')]=_0x539ad1[_0x6548('0x32')]||0x3;this[_0x6548('0x33')]=_0x539ad1[_0x6548('0x33')]||0x96;this[_0x6548('0x34')]=_0x539ad1[_0x6548('0x34')]||0x4;this[_0x6548('0x35')]=_0x539ad1['Trunk']?_0x539ad1[_0x6548('0x35')]:undefined;this[_0x6548('0x36')]=_0x539ad1[_0x6548('0x36')]?_0x539ad1[_0x6548('0x36')]:undefined;this[_0x6548('0x37')]=_0x539ad1[_0x6548('0x37')]||undefined;this[_0x6548('0x38')]=_0x539ad1[_0x6548('0x38')]?_0x539ad1['Interval']:undefined;this['dialOrderByScheduledAt']=_0x539ad1[_0x6548('0x39')]||_0x6548('0x3a');this[_0x6548('0x3b')]=_0x539ad1['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x539ad1[_0x6548('0x3c')]||undefined;this[_0x6548('0x3d')]=strategy[_0x539ad1[_0x6548('0x3d')]]||_0x6548('0x7');this[_0x6548('0x3e')]=!![];this[_0x6548('0x3f')]=_0x539ad1[_0x6548('0x3f')]||![];this[_0x6548('0x40')]=_0x539ad1['dialAMDInitialSilence'];this[_0x6548('0x41')]=_0x539ad1[_0x6548('0x41')];this[_0x6548('0x42')]=_0x539ad1['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x539ad1[_0x6548('0x43')];this[_0x6548('0x44')]=_0x539ad1[_0x6548('0x44')];this[_0x6548('0x45')]=_0x539ad1[_0x6548('0x45')];this['dialAMDMaximumNumberOfWords']=_0x539ad1['dialAMDMaximumNumberOfWords'];this[_0x6548('0x46')]=_0x539ad1[_0x6548('0x46')];this[_0x6548('0x47')]=_0x539ad1['dialAMDMaximumWordLength'];this[_0x6548('0x48')]=0x0;this['pTalking']=0x0;this[_0x6548('0x49')]=_0x539ad1[_0x6548('0x49')];this[_0x6548('0x4a')]=0x0;this[_0x6548('0x4b')]=0x0;this[_0x6548('0x4c')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x6548('0x4d')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x6548('0x4e')]=0x0;this[_0x6548('0x4f')]=0x0;this[_0x6548('0x50')]=0x0;this['outboundReCallsDay']=0x0;this['startProgressive']=undefined;this[_0x6548('0x51')]=undefined;this[_0x6548('0x52')]=undefined;this[_0x6548('0x53')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x6548('0x54')]=0x0;this[_0x6548('0x55')]=0x0;this[_0x6548('0x56')]=0x0;this[_0x6548('0x57')]=0x0;this[_0x6548('0x58')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x6548('0x59')]=0.4;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x6548('0x5a')]=0x1;this[_0x6548('0x5b')]=0x0;this[_0x6548('0x5c')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x6548('0x5d')]=0x0;this[_0x6548('0x5e')]=_0x539ad1[_0x6548('0x5e')]||0x1e;this[_0x6548('0x5f')]=_0x539ad1['dialRecallInQueue']||![];this[_0x6548('0x60')]=_0x539ad1[_0x6548('0x60')]||undefined;this['dialAgiAfterHangupClient']=_0x539ad1[_0x6548('0x61')]||![];this[_0x6548('0x62')]=_0x539ad1[_0x6548('0x62')]||![];this['monitor_format']=monitorFormat[_0x539ad1[_0x6548('0xa')]]?monitorFormat[_0x539ad1['monitor_format']]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xdf47=['startProgressive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalLowerLimit','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','exports','unknown','not_inuse','inuse','busy','invalid','ringing','onhold','wav49','roundrobin','name','monitor_format','type','inbound','total','answered','sumHoldTime','sumBillable','loggedIn','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','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','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay'];(function(_0x2ee06b,_0x55aad1){var _0x572b78=function(_0x593858){while(--_0x593858){_0x2ee06b['push'](_0x2ee06b['shift']());}};_0x572b78(++_0x55aad1);}(_0xdf47,0x6e));var _0x7df4=function(_0x156b02,_0x502fb9){_0x156b02=_0x156b02-0x0;var _0x8dd1a9=_0xdf47[_0x156b02];return _0x8dd1a9;};'use strict';var statusDesc=[_0x7df4('0x0'),_0x7df4('0x1'),_0x7df4('0x2'),_0x7df4('0x3'),_0x7df4('0x4'),'unavailable',_0x7df4('0x5'),'ringinuse',_0x7df4('0x6')];var monitorFormat={'wav':'wav','wav49':_0x7df4('0x7'),'gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':_0x7df4('0x8')};function VoiceQueue(_0x5777fe){this['id']=_0x5777fe['id']||0x0;this[_0x7df4('0x9')]=_0x5777fe['name']||'';this[_0x7df4('0xa')]=_0x5777fe[_0x7df4('0xa')]||'';this['type']=_0x5777fe[_0x7df4('0xb')]||_0x7df4('0xc');this['waiting']=0x0;this['talking']=0x0;this[_0x7df4('0xd')]=0x0;this[_0x7df4('0xe')]=0x0;this['sumDuration']=0x0;this[_0x7df4('0xf')]=0x0;this[_0x7df4('0x10')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x7df4('0x11')]=0x0;this['available']=0x0;this['acw']=_0x5777fe['acw']||![];this[_0x7df4('0x12')]=_0x5777fe[_0x7df4('0x12')]||0xa;this['autopause']=_0x5777fe['autopause']||'no';this[_0x7df4('0x13')]=!![];this[_0x7df4('0x14')]='';this[_0x7df4('0x15')]=0x0;this[_0x7df4('0x16')]=0x0;this['dialTimezone']=_0x5777fe[_0x7df4('0x17')]||null;this[_0x7df4('0x18')]=_0x5777fe[_0x7df4('0x18')]?_0x5777fe['dialGlobalInterval']:null;this['dialActive']=_0x5777fe['dialActive'];this[_0x7df4('0x19')]=_0x5777fe['dialMethod']||_0x7df4('0x1a');this[_0x7df4('0x1b')]=_0x5777fe['dialLimitChannel']||0x0;this[_0x7df4('0x1c')]=_0x5777fe[_0x7df4('0x1c')]||0x0;this[_0x7df4('0x1d')]=_0x5777fe[_0x7df4('0x1d')]||0x1;this[_0x7df4('0x1e')]=_0x5777fe['dialPredictiveOptimization']||_0x7df4('0x1f');this[_0x7df4('0x20')]=_0x5777fe[_0x7df4('0x20')]||0.03;this['dialPredictiveInterval']=_0x5777fe[_0x7df4('0x21')]||0x258;this[_0x7df4('0x22')]=_0x5777fe['dialOriginateCallerIdName']||_0x7df4('0x23');this[_0x7df4('0x24')]=_0x5777fe['dialOriginateCallerIdNumber']||_0x7df4('0x23');this[_0x7df4('0x25')]=_0x5777fe[_0x7df4('0x25')]||0x1e;this['dialQueueOptions']=_0x5777fe[_0x7df4('0x26')]||_0x7df4('0x27');this['dialQueueTimeout']=_0x5777fe[_0x7df4('0x28')]||0x3;this[_0x7df4('0x29')]=_0x5777fe[_0x7df4('0x29')]||undefined;this[_0x7df4('0x2a')]=_0x5777fe['dialCongestionMaxRetry']||0x3;this[_0x7df4('0x2b')]=_0x5777fe[_0x7df4('0x2b')]||0x96;this['dialBusyMaxRetry']=_0x5777fe[_0x7df4('0x2c')]||0x3;this[_0x7df4('0x2d')]=_0x5777fe['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x5777fe['dialNoAnswerMaxRetry']||0x3;this[_0x7df4('0x2e')]=_0x5777fe[_0x7df4('0x2e')]||0x96;this['dialGlobalMaxRetry']=_0x5777fe[_0x7df4('0x2f')]||0x4;this[_0x7df4('0x30')]=_0x5777fe[_0x7df4('0x30')]?_0x5777fe[_0x7df4('0x30')]:undefined;this['TrunkBackup']=_0x5777fe[_0x7df4('0x31')]?_0x5777fe[_0x7df4('0x31')]:undefined;this[_0x7df4('0x32')]=_0x5777fe[_0x7df4('0x32')]||undefined;this[_0x7df4('0x33')]=_0x5777fe[_0x7df4('0x33')]?_0x5777fe[_0x7df4('0x33')]:undefined;this[_0x7df4('0x34')]=_0x5777fe[_0x7df4('0x34')]||_0x7df4('0x35');this[_0x7df4('0x36')]=_0x5777fe['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x7df4('0x37')]=_0x5777fe[_0x7df4('0x37')]||undefined;this['strategy']=strategy[_0x5777fe[_0x7df4('0x38')]]||_0x7df4('0x39');this[_0x7df4('0x3a')]=!![];this[_0x7df4('0x3b')]=_0x5777fe[_0x7df4('0x3b')]||![];this[_0x7df4('0x3c')]=_0x5777fe['dialAMDInitialSilence'];this[_0x7df4('0x3d')]=_0x5777fe[_0x7df4('0x3d')];this[_0x7df4('0x3e')]=_0x5777fe[_0x7df4('0x3e')];this['dialAMDTotalAnalysisTime']=_0x5777fe[_0x7df4('0x3f')];this[_0x7df4('0x40')]=_0x5777fe['dialAMDMinWordLength'];this[_0x7df4('0x41')]=_0x5777fe[_0x7df4('0x41')];this[_0x7df4('0x42')]=_0x5777fe[_0x7df4('0x42')];this[_0x7df4('0x43')]=_0x5777fe[_0x7df4('0x43')];this[_0x7df4('0x44')]=_0x5777fe[_0x7df4('0x44')];this[_0x7df4('0x45')]=0x0;this['pTalking']=0x0;this['timeout']=_0x5777fe[_0x7df4('0x46')];this[_0x7df4('0x47')]=0x0;this[_0x7df4('0x48')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x7df4('0x49')]=0x0;this[_0x7df4('0x4a')]=0x0;this[_0x7df4('0x4b')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x7df4('0x4c')]=0x0;this[_0x7df4('0x4d')]=0x0;this[_0x7df4('0x4e')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x7df4('0x4f')]=0x0;this[_0x7df4('0x50')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x7df4('0x51')]=0x0;this[_0x7df4('0x52')]=0x0;this[_0x7df4('0x53')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x7df4('0x54')]=0x0;this[_0x7df4('0x55')]=0x0;this[_0x7df4('0x56')]=0.4;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x7df4('0x57')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x7df4('0x58')]=0x0;this[_0x7df4('0x59')]=_0x5777fe[_0x7df4('0x59')]||0x1e;this['dialRecallInQueue']=_0x5777fe[_0x7df4('0x5a')]||![];this['dialQueueProject2']=_0x5777fe[_0x7df4('0x5b')]||undefined;this[_0x7df4('0x5c')]=_0x5777fe[_0x7df4('0x5c')]||![];this[_0x7df4('0x5d')]=_0x5777fe[_0x7df4('0x5d')]||![];this[_0x7df4('0xa')]=monitorFormat[_0x5777fe[_0x7df4('0xa')]]?monitorFormat[_0x5777fe[_0x7df4('0xa')]]:undefined;}module[_0x7df4('0x5e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 7348b9c..82f7a22 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 _0x719a=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x748eb1,_0x4daaec){var _0x4a9dfe=function(_0x27fa2a){while(--_0x27fa2a){_0x748eb1['push'](_0x748eb1['shift']());}};_0x4a9dfe(++_0x4daaec);}(_0x719a,0x81));var _0xa719=function(_0x49a9e7,_0x4b80c7){_0x49a9e7=_0x49a9e7-0x0;var _0x3ec9b4=_0x719a[_0x49a9e7];return _0x3ec9b4;};'use strict';function VtigerAccount(_0x58756a){this['id']=_0x58756a['id']||0x0;this[_0xa719('0x0')]=_0x58756a['name']||'';this['username']=_0x58756a[_0xa719('0x1')]||'';this[_0xa719('0x2')]=_0x58756a[_0xa719('0x2')]||'';this['remoteUri']=_0x58756a[_0xa719('0x3')]||'';this[_0xa719('0x4')]=_0x58756a[_0xa719('0x4')]||'';this['Configurations']=_0x58756a[_0xa719('0x5')]||{};}module[_0xa719('0x6')]=VtigerAccount; \ No newline at end of file +var _0x2517=['accessKey','remoteUri','Configurations','exports','name','username'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x2517,0x11e));var _0x7251=function(_0x1cb34b,_0x31330b){_0x1cb34b=_0x1cb34b-0x0;var _0x323cb3=_0x2517[_0x1cb34b];return _0x323cb3;};'use strict';function VtigerAccount(_0x1269b5){this['id']=_0x1269b5['id']||0x0;this[_0x7251('0x0')]=_0x1269b5[_0x7251('0x0')]||'';this[_0x7251('0x1')]=_0x1269b5['username']||'';this[_0x7251('0x2')]=_0x1269b5[_0x7251('0x2')]||'';this[_0x7251('0x3')]=_0x1269b5[_0x7251('0x3')]||'';this['serverUrl']=_0x1269b5['serverUrl']||'';this[_0x7251('0x4')]=_0x1269b5[_0x7251('0x4')]||{};}module[_0x7251('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index b6fdc66..8822eb6 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 _0xca84=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x45dfdc,_0x2334c0){var _0x35f15b=function(_0xdd4563){while(--_0xdd4563){_0x45dfdc['push'](_0x45dfdc['shift']());}};_0x35f15b(++_0x2334c0);}(_0xca84,0x131));var _0x4ca8=function(_0x5cd31b,_0x23dce0){_0x5cd31b=_0x5cd31b-0x0;var _0x477311=_0xca84[_0x5cd31b];return _0x477311;};'use strict';function ZendeskAccount(_0x552b78){this['id']=_0x552b78['id']||0x0;this[_0x4ca8('0x0')]=_0x552b78[_0x4ca8('0x0')]||'';this['username']=_0x552b78[_0x4ca8('0x1')]||'';this[_0x4ca8('0x2')]=_0x552b78['password']||'';this[_0x4ca8('0x3')]=_0x552b78[_0x4ca8('0x3')]||'';this[_0x4ca8('0x4')]=_0x552b78[_0x4ca8('0x4')]||'';this[_0x4ca8('0x5')]=_0x552b78[_0x4ca8('0x5')]||'';this[_0x4ca8('0x6')]=_0x552b78[_0x4ca8('0x6')]||_0x4ca8('0x7');this[_0x4ca8('0x8')]=_0x552b78[_0x4ca8('0x8')]||'';this[_0x4ca8('0x9')]=_0x552b78[_0x4ca8('0x9')]||{};}module[_0x4ca8('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x688d=['integrationTab','serverUrl','Configurations','name','username','token','remoteUri','authType','type'];(function(_0x272808,_0x5f5b49){var _0x575b12=function(_0x1228cb){while(--_0x1228cb){_0x272808['push'](_0x272808['shift']());}};_0x575b12(++_0x5f5b49);}(_0x688d,0xdb));var _0xd688=function(_0xf2e000,_0x192d3a){_0xf2e000=_0xf2e000-0x0;var _0x33368d=_0x688d[_0xf2e000];return _0x33368d;};'use strict';function ZendeskAccount(_0x5adb99){this['id']=_0x5adb99['id']||0x0;this[_0xd688('0x0')]=_0x5adb99['name']||'';this['username']=_0x5adb99[_0xd688('0x1')]||'';this['password']=_0x5adb99['password']||'';this[_0xd688('0x2')]=_0x5adb99[_0xd688('0x2')]||'';this[_0xd688('0x3')]=_0x5adb99['remoteUri']||'';this[_0xd688('0x4')]=_0x5adb99['authType']||'';this[_0xd688('0x5')]=_0x5adb99[_0xd688('0x5')]||_0xd688('0x6');this[_0xd688('0x7')]=_0x5adb99['serverUrl']||'';this[_0xd688('0x8')]=_0x5adb99['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 8b7a6c3..7d4e5ac 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 _0x71ab=['host','Configurations','serverUrl','exports','name','authToken'];(function(_0x73c4d9,_0x23f1ba){var _0x570536=function(_0x3c14b2){while(--_0x3c14b2){_0x73c4d9['push'](_0x73c4d9['shift']());}};_0x570536(++_0x23f1ba);}(_0x71ab,0x64));var _0xb71a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x71ab[_0x14add3];return _0x4a174f;};'use strict';function ZohoAccount(_0x3c4f5d){this['id']=_0x3c4f5d['id']||0x0;this[_0xb71a('0x0')]=_0x3c4f5d['name']||'';this[_0xb71a('0x1')]=_0x3c4f5d['authToken']||'';this[_0xb71a('0x2')]=_0x3c4f5d[_0xb71a('0x2')]||'';this[_0xb71a('0x3')]=_0x3c4f5d[_0xb71a('0x3')]||{};this[_0xb71a('0x4')]=_0x3c4f5d[_0xb71a('0x4')]||'';}module[_0xb71a('0x5')]=ZohoAccount; \ No newline at end of file +var _0xeda8=['serverUrl','exports','name','authToken','host','Configurations'];(function(_0x216934,_0x355088){var _0x90b7a4=function(_0x18d07a){while(--_0x18d07a){_0x216934['push'](_0x216934['shift']());}};_0x90b7a4(++_0x355088);}(_0xeda8,0x104));var _0x8eda=function(_0x320a46,_0x535b12){_0x320a46=_0x320a46-0x0;var _0x5b91c9=_0xeda8[_0x320a46];return _0x5b91c9;};'use strict';function ZohoAccount(_0x549162){this['id']=_0x549162['id']||0x0;this[_0x8eda('0x0')]=_0x549162['name']||'';this[_0x8eda('0x1')]=_0x549162[_0x8eda('0x1')]||'';this[_0x8eda('0x2')]=_0x549162[_0x8eda('0x2')]||'';this[_0x8eda('0x3')]=_0x549162[_0x8eda('0x3')]||{};this[_0x8eda('0x4')]=_0x549162[_0x8eda('0x4')]||'';}module[_0x8eda('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 e0b93e4..822b0c1 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 _0x05ca=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','util','lodash','isNil','string','uniqueid','queue','name','type','dialAnswer','Agent','format','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','callback','callbackuniqueid'];(function(_0x4d5670,_0x117c7f){var _0x2208dc=function(_0x437124){while(--_0x437124){_0x4d5670['push'](_0x4d5670['shift']());}};_0x2208dc(++_0x117c7f);}(_0x05ca,0x113));var _0xa05c=function(_0x2c7cd3,_0x369d68){_0x2c7cd3=_0x2c7cd3-0x0;var _0x36d395=_0x05ca[_0x2c7cd3];return _0x36d395;};'use strict';var util=require(_0xa05c('0x0'));var _=require(_0xa05c('0x1'));var moment=require('moment');function checkNameSurname(_0x51cab2,_0x145a4d,_0x52f6ec){var _0x79f716='';if(!_[_0xa05c('0x2')](_0x145a4d)&&_0xa05c('0x3')===typeof _0x145a4d){_0x79f716+=_0x145a4d;}if(!_[_0xa05c('0x2')](_0x52f6ec)&&_0xa05c('0x3')===typeof _0x52f6ec){_0x79f716+='\x20'+_0x52f6ec;}if(_0x79f716!==''){return _0x79f716;}return _0x51cab2;}function Action(_0x4ba162,_0x4a17a2,_0x5a4ff5,_0x3bf3a1,_0x5c0bad){this[_0xa05c('0x4')]=_0x5a4ff5||undefined;this['idContact']=_0x4ba162['id'];this[_0xa05c('0x5')]=_0x4a17a2[_0xa05c('0x6')];this['type']=_0x4a17a2[_0xa05c('0x7')];this['campaigntype']=_0xa05c('0x5');this[_0xa05c('0x8')]=![];this['membername']=_[_0xa05c('0x2')](_0x4ba162[_0xa05c('0x9')])?undefined:_0x4ba162['Agent']['name'];this['channelAgent']=this['membername']?util[_0xa05c('0xa')]('SIP/%s',this['membername']):_0x3bf3a1||undefined;this['calleridname']=checkNameSurname(_0x4ba162[_0xa05c('0xb')][_0xa05c('0xc')],_0x4ba162[_0xa05c('0xb')][_0xa05c('0xd')],_0x4ba162[_0xa05c('0xb')]['lastName']);this['active']=_0x4ba162[_0xa05c('0xe')]||![];this[_0xa05c('0xf')]=_0x4ba162[_0xa05c('0xb')][_0xa05c('0xc')];this['scheduledat']=_0x4ba162[_0xa05c('0x10')];this[_0xa05c('0x11')]=_0x4ba162[_0xa05c('0x11')]||0x0;this[_0xa05c('0x12')]=_0x4ba162[_0xa05c('0x12')]||0x0;this['countnoanswerretry']=_0x4ba162[_0xa05c('0x13')]||0x0;this['countglobal']=(_0x4ba162['countbusyretry']||0x0)+(_0x4ba162[_0xa05c('0x12')]||0x0)+(_0x4ba162[_0xa05c('0x13')]||0x0);this[_0xa05c('0x14')]=_0x4ba162[_0xa05c('0x14')];this[_0xa05c('0x15')]=_0x4ba162['callbackuniqueid'];this[_0xa05c('0x16')]=_0x4ba162[_0xa05c('0x16')];this[_0xa05c('0x17')]=_0x4ba162['recallme'];this[_0xa05c('0x18')]=_0x4ba162[_0xa05c('0x18')];this[_0xa05c('0x19')]=_0x4ba162[_0xa05c('0x19')];this[_0xa05c('0x1a')]=_[_0xa05c('0x2')](_0x4ba162['Agent'])?_0x4ba162[_0xa05c('0x1a')]:_0x4ba162[_0xa05c('0x9')]['id'];this[_0xa05c('0x1b')]=_0x4ba162[_0xa05c('0x1b')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xa05c('0x1c')][_0xa05c('0x1d')]=function(){return util['format'](_0xa05c('0x1e'),this[_0xa05c('0x1f')],this[_0xa05c('0x20')]);};module['exports']=Action; \ No newline at end of file +var _0xa5c2=['channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','string','isNil','uniqueid','idContact','type','membername','Agent','name'];(function(_0x5d7254,_0x3c638c){var _0xc1ada1=function(_0x27e4b7){while(--_0x27e4b7){_0x5d7254['push'](_0x5d7254['shift']());}};_0xc1ada1(++_0x3c638c);}(_0xa5c2,0x64));var _0x2a5c=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0xa5c2[_0x26b622];return _0x58a028;};'use strict';var util=require(_0x2a5c('0x0'));var _=require(_0x2a5c('0x1'));var moment=require(_0x2a5c('0x2'));function checkNameSurname(_0x3d94d9,_0x2ecd58,_0x54049d){var _0x1e075a='';if(!_['isNil'](_0x2ecd58)&&_0x2a5c('0x3')===typeof _0x2ecd58){_0x1e075a+=_0x2ecd58;}if(!_[_0x2a5c('0x4')](_0x54049d)&&'string'===typeof _0x54049d){_0x1e075a+='\x20'+_0x54049d;}if(_0x1e075a!==''){return _0x1e075a;}return _0x3d94d9;}function Action(_0x950c76,_0x4c88e8,_0x4b4dd4,_0x2fde8e,_0xd7d6){this[_0x2a5c('0x5')]=_0x4b4dd4||undefined;this[_0x2a5c('0x6')]=_0x950c76['id'];this['queue']=_0x4c88e8['name'];this['type']=_0x4c88e8[_0x2a5c('0x7')];this['campaigntype']='queue';this['dialAnswer']=![];this[_0x2a5c('0x8')]=_['isNil'](_0x950c76[_0x2a5c('0x9')])?undefined:_0x950c76[_0x2a5c('0x9')][_0x2a5c('0xa')];this[_0x2a5c('0xb')]=this['membername']?util[_0x2a5c('0xc')](_0x2a5c('0xd'),this[_0x2a5c('0x8')]):_0x2fde8e||undefined;this[_0x2a5c('0xe')]=checkNameSurname(_0x950c76[_0x2a5c('0xf')][_0x2a5c('0x10')],_0x950c76[_0x2a5c('0xf')]['firstName'],_0x950c76['Contact'][_0x2a5c('0x11')]);this['active']=_0x950c76[_0x2a5c('0x12')]||![];this[_0x2a5c('0x13')]=_0x950c76[_0x2a5c('0xf')]['phone'];this['scheduledat']=_0x950c76['scheduledat'];this[_0x2a5c('0x14')]=_0x950c76[_0x2a5c('0x14')]||0x0;this[_0x2a5c('0x15')]=_0x950c76[_0x2a5c('0x15')]||0x0;this['countnoanswerretry']=_0x950c76['countnoanswerretry']||0x0;this[_0x2a5c('0x16')]=(_0x950c76[_0x2a5c('0x14')]||0x0)+(_0x950c76[_0x2a5c('0x15')]||0x0)+(_0x950c76[_0x2a5c('0x17')]||0x0);this[_0x2a5c('0x18')]=_0x950c76['callback'];this['callbackuniqueid']=_0x950c76[_0x2a5c('0x19')];this[_0x2a5c('0x1a')]=_0x950c76[_0x2a5c('0x1a')];this['recallme']=_0x950c76[_0x2a5c('0x1b')];this[_0x2a5c('0x1c')]=_0x950c76[_0x2a5c('0x1c')];this[_0x2a5c('0x1d')]=_0x950c76[_0x2a5c('0x1d')];this[_0x2a5c('0x1e')]=_['isNil'](_0x950c76[_0x2a5c('0x9')])?_0x950c76['UserId']:_0x950c76['Agent']['id'];this[_0x2a5c('0x1f')]=_0x950c76[_0x2a5c('0x1f')];this[_0x2a5c('0x20')]='';this['originatecalleridname']='';}Action[_0x2a5c('0x21')][_0x2a5c('0x22')]=function(){return util[_0x2a5c('0xc')](_0x2a5c('0x23'),this[_0x2a5c('0xe')],this[_0x2a5c('0x24')]);};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 45d31bf..9f894ec 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 _0x37af=['stringify','format','voice_queue:save','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','available','message','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','booked','clearZombieChannels','hasOwnProperty','preview','setMessage','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','actions','pick','contactId','UserId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','length','getDiff','scheduledat','dialRecallMeTimeout','run','then','logger2','[RecallMe]','catch','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','acw','complete','total','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[syncHangupRequest][logAgentReject]','disableContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','isUndefined','object','NoSuchNumber','createAgentHistory','logAgent','reason','[callProgressDetectingAgent][logCongestion]','phone','VoiceQueueId','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','Contact','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','addVariables','toLowerVariables','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','syncHangupRequest','variables','filterKey','keys','variable','addVariable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./action','./util/util','defaults','localhost','socket.io-emitter','redis','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','outbound','name','answered','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalTotalCalls','originated','Trunk','active','callerid','Interval'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x37af,0xe4));var _0xf37a=function(_0x544560,_0x49f2dd){_0x544560=_0x544560-0x0;var _0xae38e9=_0x37af[_0x544560];return _0xae38e9;};'use strict';var util=require(_0xf37a('0x0'));var _=require(_0xf37a('0x1'));var BPromise=require(_0xf37a('0x2'));var uuid=require(_0xf37a('0x3'));var moment=require('moment');var md5=require(_0xf37a('0x4'));var Redis=require(_0xf37a('0x5'));var config=require(_0xf37a('0x6'));var logger=require(_0xf37a('0x7'))('preview');var loggerAction=require('../../../config/logger')(_0xf37a('0x8'));var ami=require(_0xf37a('0x9'));var rpcDb=require('./rpcDb');var Action=require(_0xf37a('0xa'));var ut=require(_0xf37a('0xb'));config['redis']=_[_0xf37a('0xc')](config['redis'],{'host':_0xf37a('0xd'),'port':0x18eb});var io=require(_0xf37a('0xe'))(new Redis(config[_0xf37a('0xf')]));var Sequence=function(){};Sequence[_0xf37a('0x10')][_0xf37a('0x11')]=function(_0x158147){this['tail']=this[_0xf37a('0x12')]?this[_0xf37a('0x12')][_0xf37a('0x13')](_0x158147):_0x158147();};function Preview(_0x3bb12f){this[_0xf37a('0x14')]=new Sequence();this[_0xf37a('0x15')]=_0x3bb12f['voiceQueues'];this['trunks']=_0x3bb12f[_0xf37a('0x16')];this['actions']={};this[_0xf37a('0x17')]=_0x3bb12f['agents'];this[_0xf37a('0x18')]=0x0;ami['on'](_0xf37a('0x19'),this[_0xf37a('0x1a')][_0xf37a('0x1b')](this));ami['on']('hangup',this[_0xf37a('0x1c')][_0xf37a('0x1b')](this));ami['on'](_0xf37a('0x1d'),this['syncHangupRequest'][_0xf37a('0x1b')](this));ami['on'](_0xf37a('0x1e'),this['syncDialEnd']['bind'](this));ami['on'](_0xf37a('0x1f'),this[_0xf37a('0x20')][_0xf37a('0x1b')](this));ami['on'](_0xf37a('0x21'),this[_0xf37a('0x22')][_0xf37a('0x1b')](this));ami['on'](_0xf37a('0x23'),this[_0xf37a('0x24')][_0xf37a('0x1b')](this));ami['on'](_0xf37a('0x25'),this['syncBlindTransfer'][_0xf37a('0x1b')](this));this[_0xf37a('0x26')](this['campaignsPreview']);}function emit(_0x9f2a97,_0x43fa35,_0x5a1686){io['to'](_0x9f2a97)[_0xf37a('0x27')](_0x43fa35,_0x5a1686);}function emitCampaignPreview(_0x48fc64){if(_0x48fc64[_0xf37a('0x28')]===_0xf37a('0x29')){var _0x28fa90={'id':_0x48fc64['id'],'name':_0x48fc64[_0xf37a('0x2a')],'strategy':_0x48fc64['strategy'],'answered':_0x48fc64[_0xf37a('0x2b')],'available':_0x48fc64['available'],'loggedIn':_0x48fc64['loggedIn'],'pTalking':_0x48fc64[_0xf37a('0x2c')],'sumBillable':_0x48fc64[_0xf37a('0x2d')],'sumDuration':_0x48fc64[_0xf37a('0x2e')],'sumHoldTime':_0x48fc64[_0xf37a('0x2f')]||0x0,'talking':_0x48fc64[_0xf37a('0x30')],'total':_0x48fc64['total'],'type':_0x48fc64[_0xf37a('0x28')],'unmanaged':_0x48fc64[_0xf37a('0x31')],'abandoned':_0x48fc64[_0xf37a('0x32')],'waiting':_0x48fc64[_0xf37a('0x33')],'loggedInDb':_0x48fc64[_0xf37a('0x34')],'dialActive':_0x48fc64[_0xf37a('0x35')],'dialMethod':_0x48fc64[_0xf37a('0x36')],'dialOriginateCallerIdName':_0x48fc64[_0xf37a('0x37')],'dialOriginateCallerIdNumber':_0x48fc64[_0xf37a('0x38')],'dialOriginateTimeout':_0x48fc64[_0xf37a('0x39')],'dialPrefix':_0x48fc64['dialPrefix'],'outboundAnswerAgiCallsDay':_0x48fc64[_0xf37a('0x3a')],'outboundAnswerCallsDay':_0x48fc64[_0xf37a('0x3b')],'outboundBlacklistCallsDay':_0x48fc64[_0xf37a('0x3c')],'outboundBusyCallsDay':_0x48fc64['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x48fc64[_0xf37a('0x3d')],'outboundDropCallsDayACS':_0x48fc64[_0xf37a('0x3e')],'outboundDropCallsDayCallersExit':_0x48fc64[_0xf37a('0x3f')],'outboundDropCallsDayTimeout':_0x48fc64[_0xf37a('0x40')],'outboundNoAnswerCallsDay':_0x48fc64[_0xf37a('0x41')],'outboundNoSuchCallsDay':_0x48fc64[_0xf37a('0x42')],'outboundOriginateFailureCallsDay':_0x48fc64[_0xf37a('0x43')],'outboundReCallsDay':_0x48fc64['outboundReCallsDay'],'outboundRejectCallsDay':_0x48fc64[_0xf37a('0x44')],'outboundUnknownCallsDay':_0x48fc64[_0xf37a('0x45')],'predictiveIntervalAnsweredCalls':_0x48fc64['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x48fc64[_0xf37a('0x46')],'predictiveIntervalAvgTalktime':_0x48fc64[_0xf37a('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x48fc64[_0xf37a('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x48fc64[_0xf37a('0x49')],'predictiveIntervalErlangCalls':_0x48fc64[_0xf37a('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x48fc64['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x48fc64[_0xf37a('0x4b')],'predictiveIntervalLowerLimit':_0x48fc64['predictiveIntervalLowerLimit'],'predictiveIntervalMultiplicativeFactor':_0x48fc64['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x48fc64['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0x48fc64[_0xf37a('0x4c')],'message':_0x48fc64['message'],'originated':_0x48fc64[_0xf37a('0x4d')]};if(_0x48fc64[_0xf37a('0x4e')]){_0x28fa90['Trunk']={'id':_0x48fc64[_0xf37a('0x4e')]['id'],'name':_0x48fc64[_0xf37a('0x4e')][_0xf37a('0x2a')],'active':_0x48fc64[_0xf37a('0x4e')][_0xf37a('0x4f')],'callerid':_0x48fc64[_0xf37a('0x4e')][_0xf37a('0x50')]};}if(_0x48fc64['Interval']){_0x28fa90[_0xf37a('0x51')]={'id':_0x48fc64[_0xf37a('0x51')]['id'],'name':_0x48fc64[_0xf37a('0x51')][_0xf37a('0x2a')]};}var _0x422043=md5(JSON[_0xf37a('0x52')](_0x28fa90));if(_0x48fc64[_0xf37a('0x4')]!==_0x422043){_0x48fc64[_0xf37a('0x4')]=_0x422043;emit(util[_0xf37a('0x53')]('voice:queue:%s',_0x28fa90[_0xf37a('0x2a')]),_0xf37a('0x54'),_0x28fa90);}}}function emitVoiceQueueChannelRemove(_0x1f7dd9){emit(util[_0xf37a('0x53')](_0xf37a('0x55'),_0x1f7dd9[_0xf37a('0x2a')]),_0xf37a('0x56'),_0x1f7dd9);}function notSendMessagesQueue(_0x31ea0a){if(_0x31ea0a[_0xf37a('0x57')]){if(_0x31ea0a['originated']===0x0&&_0x31ea0a[_0xf37a('0x2c')]===0x0){_0x31ea0a[_0xf37a('0x57')]=![];_0x31ea0a[_0xf37a('0x58')]=0x0;_0x31ea0a['paused']=0x0;_0x31ea0a[_0xf37a('0x59')]=_0xf37a('0x5a');ut[_0xf37a('0x5b')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x31ea0a[_0xf37a('0x2a')]+_0xf37a('0x5c'));}else{_0x31ea0a[_0xf37a('0x59')]='IS_DISACTIVED';ut[_0xf37a('0x5b')](_0xf37a('0x5d'),_0x31ea0a[_0xf37a('0x2a')]+_0xf37a('0x5e'));}emitCampaignPreview(_0x31ea0a);}}Preview[_0xf37a('0x10')][_0xf37a('0x26')]=function(){var _0x344a9f=this;setInterval(function(){_0x344a9f[_0xf37a('0x5f')]();},0x7cf);};Preview[_0xf37a('0x10')][_0xf37a('0x5f')]=function(){var _0x1a46e7=this[_0xf37a('0x15')];this['clockClearZombieChannels']+=0x1;for(var _0x2bb1c2 in _0x1a46e7){if(_0x1a46e7['hasOwnProperty'](_0x2bb1c2)&&(_0x1a46e7[_0x2bb1c2]['dialMethod']==='preview'||_0x1a46e7[_0x2bb1c2][_0xf37a('0x36')]===_0xf37a('0x60'))&&_0x1a46e7[_0x2bb1c2]['type']===_0xf37a('0x29')){if(this[_0xf37a('0x18')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xf37a('0x61')]();}}if(_0x1a46e7[_0xf37a('0x62')](_0x2bb1c2)&&_0x1a46e7[_0x2bb1c2][_0xf37a('0x36')]===_0xf37a('0x63')&&_0x1a46e7[_0x2bb1c2][_0xf37a('0x28')]===_0xf37a('0x29')){if(_0x1a46e7[_0x2bb1c2][_0xf37a('0x35')]){this[_0xf37a('0x64')](_0x1a46e7[_0x2bb1c2]);this['recallMe'](_0x1a46e7[_0x2bb1c2]);}else{notSendMessagesQueue(_0x1a46e7[_0x2bb1c2]);}}}};Preview[_0xf37a('0x10')][_0xf37a('0x65')]=function(_0x44e8c2){var _0x4d7ab7=this;this[_0xf37a('0x14')][_0xf37a('0x11')](function(){if(!_[_0xf37a('0x66')](_0x4d7ab7['actions'][_0x44e8c2])){loggerAction[_0xf37a('0x67')](_0xf37a('0x68'),_0x44e8c2,_0xf37a('0x69'),_0x4d7ab7['actions'][_0x44e8c2][_0xf37a('0x6a')],_0xf37a('0x6b'),JSON[_0xf37a('0x52')](_0x4d7ab7[_0xf37a('0x15')][_0x4d7ab7['actions'][_0x44e8c2][_0xf37a('0x6a')]][_0xf37a('0x4d')]),_0xf37a('0x6c'),JSON[_0xf37a('0x52')](_0x4d7ab7['campaignsPreview'][_0x4d7ab7[_0xf37a('0x6d')][_0x44e8c2][_0xf37a('0x6a')]][_0xf37a('0x2c')]),JSON[_0xf37a('0x52')](_0x4d7ab7[_0xf37a('0x6d')][_0x44e8c2]['dialAnswer']),JSON[_0xf37a('0x52')](_[_0xf37a('0x6e')](_0x4d7ab7['actions'][_0x44e8c2],[_0xf37a('0x6f'),_0xf37a('0x70'),'VoiceQueueId',_0xf37a('0x71')])));return ami[_0xf37a('0x72')]({'action':_0xf37a('0x73'),'channel':_0x4d7ab7['actions'][_0x44e8c2][_0xf37a('0x74')]})['catch'](function(_0x4ee56c){if(_0x4ee56c['message']===_0xf37a('0x75')){setTimeout(function(){if(_0x4d7ab7['actions'][_0x44e8c2]){ut[_0xf37a('0x76')](_0x4d7ab7[_0xf37a('0x15')][_0x4d7ab7['actions'][_0x44e8c2][_0xf37a('0x6a')]],_0xf37a('0x77'));if(_0x4d7ab7[_0xf37a('0x6d')][_0x44e8c2][_0xf37a('0x78')]===!![]){ut[_0xf37a('0x79')](_0x4d7ab7[_0xf37a('0x15')][_0x4d7ab7[_0xf37a('0x6d')][_0x44e8c2][_0xf37a('0x6a')]],_0xf37a('0x77'));ut[_0xf37a('0x7a')](_0xf37a('0x7b')+_0x44e8c2,_0x4d7ab7[_0xf37a('0x6d')][_0x44e8c2]['queue']);}ut[_0xf37a('0x7a')](_0xf37a('0x7c')+_0x44e8c2,_0x4d7ab7[_0xf37a('0x6d')][_0x44e8c2][_0xf37a('0x6a')]);delete _0x4d7ab7['actions'][_0x44e8c2];}},0x2328);}});}});};Preview[_0xf37a('0x10')]['clearZombieChannels']=function(){var _0x506956=this;loggerAction[_0xf37a('0x67')](_0xf37a('0x7d'),_[_0xf37a('0x7e')](this['actions']));for(var _0x1ac00b in this[_0xf37a('0x6d')]){if(_0x506956[_0xf37a('0x6d')][_0xf37a('0x62')](_0x1ac00b)){_0x506956[_0xf37a('0x65')](_0x1ac00b);}}};Preview[_0xf37a('0x10')][_0xf37a('0x7f')]=function(_0x59396f){var _0x49b9bb=this;rpcDb[_0xf37a('0x80')](_0x59396f['id'],ut['agentReadyId'](this[_0xf37a('0x17')]))['then'](function(_0x2241ed){if(!_[_0xf37a('0x66')](_0x2241ed)){for(var _0x99fbb4=0x0;_0x99fbb4<_0x2241ed[_0xf37a('0x81')];_0x99fbb4+=0x1){if(ut[_0xf37a('0x82')](_0x2241ed[_0x99fbb4][_0xf37a('0x83')])<_0x59396f[_0xf37a('0x84')]*0x3c){_0x49b9bb[_0xf37a('0x85')](_0x2241ed[_0x99fbb4]['id'])[_0xf37a('0x86')](ut[_0xf37a('0x87')](_0xf37a('0x88')))[_0xf37a('0x89')](ut[_0xf37a('0x87')]('[RecallMe]'));}else{var _0x4f4355=new Action(_0x2241ed[_0x99fbb4],_0x59396f);_0x4f4355[_0xf37a('0x8a')]=moment()[_0xf37a('0x53')](_0xf37a('0x8b'));_0x59396f['outboundReCallsDay']+=0x1;ut[_0xf37a('0x8c')](_0x4f4355,0x17,'RecallInQueue');if(_0x59396f[_0xf37a('0x8d')]){rpcDb['rescheduleContactInQueue'](ut[_0xf37a('0x8e')](_0x2241ed[_0x99fbb4]));rpcDb[_0xf37a('0x8f')](_0x4f4355,_0xf37a('0x90'));}else{ut['logCustomer'](_0x4f4355,0x16,_0xf37a('0x91'));rpcDb['createCustomerHistory'](_0x4f4355,_0xf37a('0x92'));rpcDb[_0xf37a('0x93')](_0x4f4355,_0xf37a('0x92'));}}}}})[_0xf37a('0x89')](ut[_0xf37a('0x87')](_0xf37a('0x94')));};Preview[_0xf37a('0x10')]['setMessage']=function(_0x425603){_0x425603['sendMessageOneNotActive']=!![];if(ut[_0xf37a('0x95')](_0x425603['loggedIn'])){_0x425603['message']=_0xf37a('0x96');}else if(!ut[_0xf37a('0x97')](_0x425603[_0xf37a('0x35')])){_0x425603[_0xf37a('0x59')]=_0xf37a('0x5a');}else if(!this['isTrunkReachable'](_0x425603[_0xf37a('0x4e')])){if(!this[_0xf37a('0x98')](_0x425603[_0xf37a('0x99')])){_0x425603[_0xf37a('0x59')]=_0xf37a('0x9a');}else{_0x425603[_0xf37a('0x59')]=_0xf37a('0x9b');}}else{_0x425603[_0xf37a('0x59')]=_0xf37a('0x9b');}emitCampaignPreview(_0x425603);};Preview['prototype'][_0xf37a('0x9c')]=function(_0x242381,_0x30c224,_0x212d74){var _0x395a6d=this;var _0x577609=this[_0xf37a('0x6d')][_0x30c224];var _0x12d97d=this[_0xf37a('0x15')][_0x577609[_0xf37a('0x6a')]];var _0x2c7f30;if(_0x12d97d){switch(_0x212d74){case'1':_0x12d97d[_0xf37a('0x42')]+=0x1;_0x577609[_0xf37a('0x9d')]=ut[_0xf37a('0x9e')](_0x577609);ut['logCustomer'](_0x577609,0x0,'NoSuchNumber');rpcDb['createCustomerHistory'](_0x577609,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xf37a('0x9e')](_0x577609)>=_0x12d97d['dialGlobalMaxRetry']){_0x2c7f30=ut[_0xf37a('0x9f')](_0x577609,0xf,'Global');rpcDb['createCustomerFinal'](_0x2c7f30,_0xf37a('0xa0'));}else{rpcDb['createCustomerFinal'](_0x577609,_0xf37a('0xa0'));}delete this[_0xf37a('0x6d')][_0x242381['linkedid']];break;case _0xf37a('0xa1'):var _0xc8638d=moment()[_0xf37a('0x53')](_0xf37a('0x8b'));_0x577609['responsetime']=_0xc8638d;_0x577609[_0xf37a('0xa2')]=_0xc8638d;_0x577609[_0xf37a('0x78')]=!![];_0x12d97d[_0xf37a('0x2c')]+=0x1;logger[_0xf37a('0x67')](_0xf37a('0xa3'),_0x577609[_0xf37a('0xa4')],_0xf37a('0xa5'),_0x12d97d[_0xf37a('0x2a')],'pTalking:\x20',_0x12d97d[_0xf37a('0x2c')]);ami[_0xf37a('0x27')](_0xf37a('0xa6'),ut[_0xf37a('0xa7')](_0x577609,'connect'));if(_0x12d97d[_0xf37a('0xa8')]){ami[_0xf37a('0x27')]('custom:agentConnectPreview',ut['buildAcw'](_0x577609));}break;case'16':ami[_0xf37a('0x27')]('custom:agentcomplete',ut[_0xf37a('0xa7')](_0x577609,_0xf37a('0xa9')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x577609,'complete'));_0x12d97d['outboundAnswerCallsDay']+=0x1;_0x12d97d[_0xf37a('0xaa')]+=0x1;_0x12d97d[_0xf37a('0x2b')]+=0x1;ut[_0xf37a('0x79')](_0x12d97d,_0xf37a('0xab'));_0x577609[_0xf37a('0x9d')]=ut['totalGlobal'](_0x577609);ut[_0xf37a('0x8c')](_0x577609,0x4,'Answer');rpcDb[_0xf37a('0x8f')](_0x577609,_0xf37a('0xac'));rpcDb['createCustomerFinal'](_0x577609,_0xf37a('0xad'));rpcDb[_0xf37a('0xae')](_0x577609);_0x12d97d[_0xf37a('0x2e')]+=_0x577609[_0xf37a('0xaf')];_0x12d97d[_0xf37a('0x2d')]+=_0x577609['talktime'];logger['info'](_0xf37a('0xb0'),_0x577609['uniqueid'],'\x20Queue',_0x12d97d['name'],_0xf37a('0x6c'),_0x12d97d[_0xf37a('0x2c')]);delete this['actions'][_0x242381[_0xf37a('0xb1')]];break;case _0xf37a('0xb2'):_0x12d97d[_0xf37a('0xb3')]+=0x1;_0x577609[_0xf37a('0xb4')]+=0x1;_0x577609[_0xf37a('0x9d')]=ut[_0xf37a('0x9e')](_0x577609);ut['logCustomer'](_0x577609,0x5,_0xf37a('0xb5'));rpcDb['createCustomerHistory'](_0x577609,_0xf37a('0xb6'));if(ut[_0xf37a('0x9e')](_0x577609)>=_0x12d97d[_0xf37a('0xb7')]){_0x2c7f30=ut[_0xf37a('0x9f')](_0x577609,0xf,'Global');rpcDb[_0xf37a('0x93')](_0x2c7f30,_0xf37a('0xb8'));}else{if(_0x577609[_0xf37a('0xb4')]>=_0x12d97d[_0xf37a('0xb9')]){rpcDb[_0xf37a('0x93')](_0x577609,_0xf37a('0xb6'));}else{rpcDb[_0xf37a('0xba')](ut[_0xf37a('0xbb')](_0x577609,_0xf37a('0xb4'),_0x12d97d[_0xf37a('0xbc')]),_0x577609[_0xf37a('0xbd')],_0x577609[_0xf37a('0xbe')]);}}break;case _0xf37a('0xbf'):_0x12d97d[_0xf37a('0x41')]+=0x1;_0x577609[_0xf37a('0xc0')]+=0x1;_0x577609[_0xf37a('0x9d')]=ut['totalGlobal'](_0x577609);ut[_0xf37a('0x8c')](_0x577609,0x3,_0xf37a('0xc1'));rpcDb[_0xf37a('0x8f')](_0x577609,_0xf37a('0xc2'));if(ut[_0xf37a('0x9e')](_0x577609)>=_0x12d97d[_0xf37a('0xb7')]){_0x2c7f30=ut[_0xf37a('0x9f')](_0x577609,0xf,_0xf37a('0xc3'));rpcDb[_0xf37a('0x93')](_0x2c7f30,_0xf37a('0xc4'));}else{if(_0x577609['countnoanswerretry']>=_0x12d97d[_0xf37a('0xc5')]){rpcDb[_0xf37a('0x93')](_0x577609,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xf37a('0xba')](ut[_0xf37a('0xbb')](_0x577609,_0xf37a('0xc0'),_0x12d97d[_0xf37a('0xc6')]),_0x577609['unlockAgent'],_0x577609['activeContact']);}}break;case _0xf37a('0xc7'):_0x12d97d[_0xf37a('0x3d')]+=0x1;_0x577609[_0xf37a('0xc8')]+=0x1;_0x577609[_0xf37a('0x9d')]=ut[_0xf37a('0x9e')](_0x577609);ut[_0xf37a('0x8c')](_0x577609,0x8,_0xf37a('0xc9'));rpcDb[_0xf37a('0x8f')](_0x577609,_0xf37a('0xca'));if(ut[_0xf37a('0x9e')](_0x577609)>=_0x12d97d[_0xf37a('0xb7')]){_0x2c7f30=ut[_0xf37a('0x9f')](_0x577609,0xf,_0xf37a('0xc3'));rpcDb['createCustomerFinal'](_0x2c7f30,_0xf37a('0xcb'));}else{if(_0x577609[_0xf37a('0xc8')]>=_0x12d97d[_0xf37a('0xcc')]){rpcDb['createCustomerFinal'](_0x577609,_0xf37a('0xca'));}else{rpcDb[_0xf37a('0xba')](ut['scheduledAt'](_0x577609,_0xf37a('0xc8'),_0x12d97d[_0xf37a('0xbc')]),_0x577609['unlockAgent'],_0x577609[_0xf37a('0xbe')]);}}break;case'CANCEL':_0x12d97d[_0xf37a('0x44')]+=0x1;_0x577609[_0xf37a('0x9d')]=ut[_0xf37a('0x9e')](_0x577609);ut[_0xf37a('0x8c')](_0x577609,0x14,'AgentReject');rpcDb['createCustomerHistory'](_0x577609,_0xf37a('0xcd'));if(_0x577609['unlockAgent']){rpcDb['unlockContact'](_0x577609['idContact']);}if(_0x577609[_0xf37a('0xbe')]){rpcDb[_0xf37a('0xce')](_0x577609[_0xf37a('0xcf')]);}break;default:if(_0x577609['dialAnswer']){ut[_0xf37a('0x79')](_0x12d97d,_0xf37a('0xd0'));ut['loggerError'](_0xf37a('0xd1')+_0x12d97d['name'],_0x242381);}_0x12d97d['outboundUnknownCallsDay']+=0x1;_0x577609[_0xf37a('0x9d')]=ut[_0xf37a('0x9e')](_0x577609);ut[_0xf37a('0x8c')](_0x577609,0xc,_0x242381[_0xf37a('0xd2')]||_0x242381[_0xf37a('0xd3')]);rpcDb['createCustomerHistory'](_0x577609,_0xf37a('0xd4'));if(ut[_0xf37a('0x9e')](_0x577609)>=_0x12d97d[_0xf37a('0xb7')]){_0x2c7f30=ut[_0xf37a('0x9f')](_0x577609,0xf,_0xf37a('0xc3'));rpcDb[_0xf37a('0x93')](_0x2c7f30,_0xf37a('0xd5'));}else{rpcDb[_0xf37a('0x93')](_0x577609,_0xf37a('0xd5'));}delete this[_0xf37a('0x6d')][_0x242381[_0xf37a('0xb1')]];}if(!(_0x577609[_0xf37a('0x78')]&&_0x212d74==='16')){ut[_0xf37a('0x76')](_0x12d97d,_0xf37a('0xd6'));logger[_0xf37a('0x67')]('[originated][decrement][callProgressDetectingCustomer]',_0x577609[_0xf37a('0xa4')],_0xf37a('0xa5'),_0x12d97d['name'],'originated:\x20',_0x12d97d[_0xf37a('0x4d')]);}if(_0x212d74!=='ANSWER'){delete this[_0xf37a('0x6d')][_0x242381[_0xf37a('0xb1')]];delete this[_0xf37a('0x6d')][_0x242381[_0xf37a('0xd7')]];}}};Preview[_0xf37a('0x10')]['callProgressDetectingAgent']=function(_0x5887ac,_0xe1a340,_0x413605){if(_[_0xf37a('0xd8')](_0xe1a340)&&_0xf37a('0xd9')!==typeof _0xe1a340){return;}if(_[_0xf37a('0xd8')](_0x413605)&&'object'!==typeof _0x413605){return;}switch(_0x413605['reason']){case'0':ut['logAgent'](_0x5887ac,0x0,_0xf37a('0xda'));rpcDb[_0xf37a('0xdb')](_0x5887ac,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xf37a('0xdc')](_0x5887ac,0x3,_0xf37a('0xc1'));rpcDb['createAgentHistory'](_0x5887ac,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xf37a('0xdc')](_0x5887ac,0x5,_0xf37a('0xb5'));rpcDb[_0xf37a('0xdb')](_0x5887ac,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x5887ac,0x8,_0xf37a('0xc9'));rpcDb['createAgentHistory'](_0x5887ac,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xf37a('0xdc')](_0x5887ac,0x16,'AnswerAGI');rpcDb[_0xf37a('0xdb')](_0x5887ac,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xf37a('0xdc')](_0x5887ac,0xc,_0x413605[_0xf37a('0xdd')]);rpcDb[_0xf37a('0xdb')](_0x5887ac,_0xf37a('0xde'));}ut[_0xf37a('0x76')](_0xe1a340,'[callProgressDetectingAgent]');logger[_0xf37a('0x67')]('[originated][decrement][callProgressDetectingAgent]',_0x5887ac[_0xf37a('0xa4')],_0xf37a('0xa5'),_0xe1a340[_0xf37a('0x2a')],_0xf37a('0x6b'),_0xe1a340[_0xf37a('0x4d')]);delete this[_0xf37a('0x6d')][_0x5887ac['uniqueid']];};Preview[_0xf37a('0x10')]['checkInBlack']=function(_0x4b1aa1,_0x3fc159,_0x2d8a28,_0x3ee901,_0x546f12){var _0x3c7785=this;return new BPromise(function(_0x1bfe86,_0x19e53b){if(_[_0xf37a('0x66')](_0x3fc159)||_[_0xf37a('0x66')](_0x3fc159['Contact'])||_[_0xf37a('0x66')](_0x3fc159['Contact'][_0xf37a('0xdf')])||_['isNil'](_0x3fc159[_0xf37a('0xe0')])){_0x19e53b(ut[_0xf37a('0x59')](_0xf37a('0xe1'),_0x3ee901,_0x546f12));return;}var _0x5b2063=uuid['v4']();var _0x11d731=_0x3c7785[_0xf37a('0x15')][_0x3fc159[_0xf37a('0x69')]['name']];var _0x77c6bf=_0x2d8a28?_0x3c7785[_0xf37a('0x17')][_0x2d8a28]['id']:undefined;_0x3c7785[_0xf37a('0x6d')][_0x5b2063]=new Action(_0x3fc159,_0x11d731,_0x5b2063,_0x2d8a28,_0x77c6bf);var _0x26fe68=_0x3c7785['actions'][_0x5b2063];_0x26fe68[_0xf37a('0xbd')]=_0x3ee901;_0x26fe68[_0xf37a('0xbe')]=_0x546f12;_0x26fe68['lookAgent']=_0x2d8a28;if(_[_0xf37a('0xe2')](_0x4b1aa1)){_0x3c7785[_0xf37a('0xe3')](_0x26fe68,_0x11d731,_0x3fc159,_0x2d8a28)[_0xf37a('0x86')](function(_0x2f655f){logger[_0xf37a('0x67')](_0xf37a('0xe4'),'Queue:\x20'+_0x26fe68['queue']+'\x20IdHopper:\x20'+_0x26fe68[_0xf37a('0xcf')],JSON[_0xf37a('0x52')](_0x2f655f));ami['emit']('custom:agentcalled',ut[_0xf37a('0xa7')](_0x26fe68,'called'));_0x1bfe86(ut[_0xf37a('0x59')](_0xf37a('0xe5')));})[_0xf37a('0x89')](function(_0x3c25bc){ut[_0xf37a('0x5b')](_0xf37a('0xe6'),_0x3c25bc);_0x19e53b(ut[_0xf37a('0x59')](_0xf37a('0xe7'),_0x3ee901,_0x546f12));});}else{_0x11d731[_0xf37a('0x3c')]+=0x1;ut[_0xf37a('0xe8')](_0x26fe68);rpcDb[_0xf37a('0xe9')](_0x26fe68,_0xf37a('0xea'));delete _0x3c7785[_0xf37a('0x6d')][_0x5b2063];_0x19e53b(ut['message'](_0xf37a('0xeb'),_0x3ee901,_0x546f12));}});};Preview[_0xf37a('0x10')]['isTrunkReachable']=function(_0x86c578){return!_[_0xf37a('0x66')](_0x86c578)&&!_[_0xf37a('0x66')](_0x86c578['name'])&&!_[_0xf37a('0x66')](_0x86c578[_0xf37a('0x4f')])&&_0x86c578[_0xf37a('0x4f')]&&!_[_0xf37a('0x66')](this['trunks'][util['format']('SIP/%s',_0x86c578[_0xf37a('0x2a')])])&&!_['isNil'](this['trunks'][util['format']('SIP/%s',_0x86c578[_0xf37a('0x2a')])][_0xf37a('0x73')])&&(this[_0xf37a('0x16')][util[_0xf37a('0x53')](_0xf37a('0xec'),_0x86c578[_0xf37a('0x2a')])][_0xf37a('0x73')]===_0xf37a('0xed')||this['trunks'][util[_0xf37a('0x53')](_0xf37a('0xec'),_0x86c578[_0xf37a('0x2a')])][_0xf37a('0x73')]===_0xf37a('0xee'));};Preview[_0xf37a('0x10')][_0xf37a('0x85')]=function(_0xf293b,_0x525865){var _0x1596fa=this;return new BPromise(function(_0x3cf8a0,_0x3c627d){_0x1596fa[_0xf37a('0xef')](_0xf293b,_0x525865)[_0xf37a('0x86')](function(_0x5e6bf8){_0x3cf8a0(_[_0xf37a('0x6e')](_0x5e6bf8,['message']));})[_0xf37a('0x89')](function(_0x28bf5a){if(_0x28bf5a[_0xf37a('0xf0')]){rpcDb[_0xf37a('0xf1')](_0xf293b);}if(_0x28bf5a['active']){rpcDb[_0xf37a('0xce')](_0xf293b);}_0x3c627d(_[_0xf37a('0x6e')](_0x28bf5a,['message']));});});};Preview[_0xf37a('0x10')]['execRun']=function(_0x224d5f,_0x7b7d0e){var _0x27a15b=this;return new BPromise(function(_0x108d98,_0x8c9fe9){var _0x316676,_0x29ed12;rpcDb[_0xf37a('0xf2')](_0x224d5f)[_0xf37a('0x86')](function(_0x32c4f8){if(!_[_0xf37a('0x66')](_0x32c4f8[0x0])){_0x29ed12=_0x32c4f8[0x0][_0xf37a('0xf3')]?![]:!![];_0x316676=_0x32c4f8[0x0][_0xf37a('0xf3')]?!![]:![];_0x316676=_0x7b7d0e?!![]:_0x316676;}var _0x3a22f0=_0x27a15b[_0xf37a('0xf4')](_0x32c4f8);if(_0x3a22f0[_0xf37a('0xf5')]){rpcDb['checkIsBlackList'](_[_0xf37a('0x6e')](_0x32c4f8[0x0],[_0xf37a('0xe0'),_0xf37a('0xf6')]))[_0xf37a('0x86')](function(_0x4a751d){_0x27a15b[_0xf37a('0xf7')](_0x4a751d,_0x32c4f8[0x0],_0x7b7d0e,_0x29ed12,_0x316676)[_0xf37a('0x86')](function(_0x203cbe){_0x108d98(_0x203cbe);})[_0xf37a('0x89')](function(_0x254dbe){_0x8c9fe9(_0x254dbe);});})[_0xf37a('0x89')](function(_0x1ef087){ut[_0xf37a('0x5b')](_0xf37a('0xf8'),_0x1ef087);_0x8c9fe9(ut[_0xf37a('0x59')](_0xf37a('0xf9'),_0x29ed12,_0x316676));});}else{_0x8c9fe9(ut['message'](_0x3a22f0[_0xf37a('0x59')],_0x29ed12,_0x316676));}})[_0xf37a('0x89')](function(_0xaa6342){ut[_0xf37a('0x5b')](_0xf37a('0xfa'),_0xaa6342);_0x8c9fe9(ut[_0xf37a('0x59')](_0xf37a('0xf9'),![],!![]));});});};Preview['prototype'][_0xf37a('0xf4')]=function(_0x2edd6d){if(_[_0xf37a('0x66')](_0x2edd6d)||_[_0xf37a('0xe2')](_0x2edd6d)||!_[_0xf37a('0x66')](_0x2edd6d[0x0]['Agent'])&&_[_0xf37a('0x66')](_0x2edd6d[0x0][_0xf37a('0xfb')][_0xf37a('0x2a')])){ut[_0xf37a('0x5b')](_0xf37a('0xfc'),_0x2edd6d);return{'isValid':![],'message':_0xf37a('0xfd')};}var _0x3da0e9=this[_0xf37a('0x15')][_0x2edd6d[0x0][_0xf37a('0x69')][_0xf37a('0x2a')]];_0x3da0e9[_0xf37a('0x59')]=_0xf37a('0x9b');if(_['isNil'](_0x3da0e9)){ut[_0xf37a('0x5b')](_0xf37a('0xfe'),_0x3da0e9);return{'isValid':![],'message':_0xf37a('0xff')};}if(!this[_0xf37a('0x98')](_0x3da0e9[_0xf37a('0x4e')])){ut[_0xf37a('0x5b')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xf37a('0x100')+_0x3da0e9[_0xf37a('0x2a')]+_0xf37a('0x101'));if(!this['isTrunkReachable'](_0x3da0e9[_0xf37a('0x99')])){ut[_0xf37a('0x5b')](_0xf37a('0x102'),_0x3da0e9[_0xf37a('0x2a')]+_0xf37a('0x103'));return{'isValid':![],'message':_0xf37a('0x104')};}}if(!ut[_0xf37a('0x97')](_0x3da0e9[_0xf37a('0x35')])){ut[_0xf37a('0x5b')](_0xf37a('0x105'),_0x3da0e9[_0xf37a('0x2a')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xf37a('0x100')+_0x3da0e9[_0xf37a('0x2a')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xf37a('0x106')};};Preview[_0xf37a('0x10')]['execCall']=function(_0x3f4428,_0x3f601a,_0x48db14,_0x464a07){var _0x68641=this;return new BPromise(function(_0x24a794,_0x24191e){var _0xfe6e27=_0x3f4428[_0xf37a('0xa4')];var _0x2af04b=_0x68641[_0xf37a('0x98')](_0x3f601a[_0xf37a('0x4e')])?util[_0xf37a('0x53')](_0xf37a('0x107'),_0x3f601a[_0xf37a('0x4e')][_0xf37a('0x2a')],_['isNil'](_0x3f601a['dialPrefix'])?'':_0x3f601a[_0xf37a('0x108')]['trim']()||'',_0x3f601a[_0xf37a('0x109')]>0x0?_0x48db14[_0xf37a('0x10a')][_0xf37a('0xdf')][_0xf37a('0x10b')](_0x3f601a[_0xf37a('0x109')]):_0x48db14[_0xf37a('0x10a')][_0xf37a('0xdf')]):util[_0xf37a('0x53')](_0xf37a('0x107'),_[_0xf37a('0x66')](_0x3f601a['TrunkBackup'])?_0x3f601a[_0xf37a('0x4e')]['name']:_0x3f601a[_0xf37a('0x99')]['name'],_['isNil'](_0x3f601a[_0xf37a('0x108')])?'':_0x3f601a[_0xf37a('0x108')][_0xf37a('0x10c')]()||'',_0x3f601a[_0xf37a('0x109')]>0x0?_0x48db14['Contact'][_0xf37a('0xdf')]['substring'](_0x3f601a[_0xf37a('0x109')]):_0x48db14[_0xf37a('0x10a')][_0xf37a('0xdf')]);var _0x1004e3=_0x68641[_0xf37a('0x98')](_0x3f601a['Trunk'])?ut[_0xf37a('0x10d')](_0x3f601a[_0xf37a('0x4e')][_0xf37a('0x50')],_0x3f601a['dialOriginateCallerIdName'],_0x3f601a[_0xf37a('0x10e')]>0x0?ut[_0xf37a('0x10f')](_0x3f601a[_0xf37a('0x38')],_0x3f601a[_0xf37a('0x10e')]):_0x3f601a[_0xf37a('0x38')]):ut[_0xf37a('0x10d')](_[_0xf37a('0x66')](_0x3f601a[_0xf37a('0x99')])?_0x3f601a['Trunk'][_0xf37a('0x50')]:_0x3f601a[_0xf37a('0x99')][_0xf37a('0x50')],_0x3f601a['dialOriginateCallerIdName'],_0x3f601a[_0xf37a('0x10e')]>0x0?ut[_0xf37a('0x10f')](_0x3f601a[_0xf37a('0x38')],_0x3f601a['dialRandomLastDigitCallerIdNumber']):_0x3f601a[_0xf37a('0x38')]);if(_0x1004e3){_0x3f4428[_0xf37a('0x110')]=ut[_0xf37a('0x111')](_0x1004e3);_0x3f4428['originatecalleridnum']=ut['extractCalleridNumber'](_0x1004e3);}var _0x536b17=ut[_0xf37a('0x112')](_0x3f601a,_0x48db14,_0x2af04b,_0x1004e3,_0xfe6e27,_0x3f4428);_['merge'](_0x3f4428,ut[_0xf37a('0x113')](_0x536b17));_0x3f4428['starttime']=moment()['format'](_0xf37a('0x8b'));ami[_0xf37a('0x72')](ut['variablesAction'](_0x3f4428,_0x3f601a,_0x536b17,_0x3f4428[_0xf37a('0xbe')],_0x464a07))['then'](function(_0x3ef008){_0x3f601a[_0xf37a('0x4d')]+=0x1;logger[_0xf37a('0x67')](_0xf37a('0x114'),_0xfe6e27,_0xf37a('0xa5'),_0x3f601a[_0xf37a('0x2a')],_0xf37a('0x6b'),_0x3f601a['originated']);_0x24a794(_0x3ef008);})[_0xf37a('0x89')](function(_0x2b8195){ut[_0xf37a('0xdc')](_0x3f4428,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x3f4428,_0xf37a('0x115'));_0x24191e(_0x2b8195);});});};Preview[_0xf37a('0x10')][_0xf37a('0x20')]=function(_0x4bcd81){if(this[_0xf37a('0x6d')][_0x4bcd81['linkedid']]){this['actions'][_0x4bcd81[_0xf37a('0xb1')]][_0xf37a('0x74')]=_0x4bcd81[_0xf37a('0x74')];}};Preview['prototype'][_0xf37a('0x1a')]=function(_0x479e0d){var _0x46e7f1=this;var _0x13c0a4=this[_0xf37a('0x6d')][_0x479e0d[_0xf37a('0x116')]];if(_0x13c0a4){if(_0x13c0a4['lookAgent']&&this[_0xf37a('0x17')][_0x13c0a4[_0xf37a('0x117')]]){ut[_0xf37a('0x118')](_0x13c0a4,this['agents'][_0x13c0a4[_0xf37a('0x117')]]['name'],this['agents'][_0x13c0a4[_0xf37a('0x117')]]['id']);}var _0x55d786=_[_0xf37a('0x119')](_0x13c0a4);_0x55d786[_0xf37a('0x11a')]=moment()[_0xf37a('0x53')](_0xf37a('0x8b'));var _0x48870e=_0x46e7f1[_0xf37a('0x15')][_0x13c0a4[_0xf37a('0x6a')]];if(ut[_0xf37a('0x11b')](_0x479e0d[_0xf37a('0x11c')])){if(_0x13c0a4[_0xf37a('0xbd')]){rpcDb[_0xf37a('0xf1')](_0x13c0a4[_0xf37a('0xcf')]);}if(_0x13c0a4[_0xf37a('0xbe')]){rpcDb[_0xf37a('0xce')](_0x13c0a4[_0xf37a('0xcf')]);}ami[_0xf37a('0x27')](_0xf37a('0x11d'),ut[_0xf37a('0xa7')](_0x13c0a4,_0xf37a('0x11e')));this[_0xf37a('0x11f')](_0x55d786,_0x48870e,_0x479e0d);}else{_0x13c0a4[_0xf37a('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0xf37a('0xdc')](_0x55d786,0x4,'Answer');rpcDb[_0xf37a('0xdb')](_0x55d786,_0xf37a('0x120'));}}};Preview['prototype'][_0xf37a('0x1c')]=function(_0x39197c){var _0x1df859=this;var _0x4450a3=this['actions'][_0x39197c[_0xf37a('0xb1')]];var _0x2f7137;if(_0x4450a3){_0x2f7137=this[_0xf37a('0x15')][_0x4450a3['queue']];logger[_0xf37a('0x67')](_0xf37a('0x121'),_0x39197c['linkedid'],_0xf37a('0xa5'),_0x2f7137['name'],_0xf37a('0x6c'),_0x2f7137[_0xf37a('0x2c')]);}if(this[_0xf37a('0x6d')][_0x39197c['linkedid']]&&_0x39197c[_0xf37a('0xb1')]!==_0x39197c[_0xf37a('0xa4')]){if(_0x39197c['cause']==='16'&&this[_0xf37a('0x6d')][_0x39197c[_0xf37a('0xb1')]][_0xf37a('0x78')]){this[_0xf37a('0x9c')](_0x39197c,_0x39197c[_0xf37a('0xb1')],_0x39197c[_0xf37a('0x122')]);}else if(this[_0xf37a('0x6d')][_0x39197c[_0xf37a('0xb1')]]['dialAnswer']){logger['info'](_0xf37a('0x123'),_0x39197c[_0xf37a('0xb1')],_0x39197c['cause'],_0xf37a('0xa5'),_0x2f7137['name'],_0xf37a('0x6c'),_0x2f7137[_0xf37a('0x2c')]);this['callProgressDetectingCustomer'](_0x39197c,_0x39197c[_0xf37a('0xb1')],_0x39197c['cause']);}}else if(_0x4450a3&&_[_0xf37a('0x66')](_0x4450a3['statedesc'])&&_0x2f7137[_0xf37a('0x124')]&&_0x39197c[_0xf37a('0xb1')]===_0x39197c['uniqueid']&&_['isNil'](_0x39197c[_0xf37a('0xdd')])&&_0x39197c[_0xf37a('0x122')]==='16'&&_0x39197c['channelstate']==='6'&&_[_0xf37a('0xd8')](_0x4450a3[_0xf37a('0x125')])){if(_0x4450a3[_0xf37a('0xbd')]){rpcDb['unlockContact'](_0x4450a3[_0xf37a('0xcf')]);}if(_0x4450a3[_0xf37a('0xbe')]){rpcDb[_0xf37a('0xce')](_0x4450a3[_0xf37a('0xcf')]);}_0x39197c[_0xf37a('0xdd')]='22';this['callProgressDetectingAgent'](_0x4450a3,_0x2f7137,_0x39197c);}else if(_0x4450a3&&_0x4450a3[_0xf37a('0x125')]){if(_0x39197c[_0xf37a('0x122')]==='16'&&this['actions'][_0x39197c[_0xf37a('0xb1')]][_0xf37a('0x78')]){logger[_0xf37a('0x67')](_0xf37a('0x126'),_0x39197c[_0xf37a('0xb1')],_0x39197c[_0xf37a('0x122')],_0xf37a('0xa5'),_0x2f7137['name'],'pTalking:\x20',_0x2f7137[_0xf37a('0x2c')]);this[_0xf37a('0x9c')](_0x39197c,_0x39197c[_0xf37a('0xb1')],_0x39197c[_0xf37a('0x122')]);}else if(this[_0xf37a('0x6d')][_0x39197c['linkedid']][_0xf37a('0x78')]){logger[_0xf37a('0x67')]('[syncHangup][talking][cause]',_0x39197c[_0xf37a('0xb1')],_0x39197c['cause'],_0xf37a('0xa5'),_0x2f7137[_0xf37a('0x2a')],'pTalking:\x20',_0x2f7137['pTalking']);this[_0xf37a('0x9c')](_0x39197c,_0x39197c[_0xf37a('0xb1')],_0x39197c[_0xf37a('0x122')]);}}};Preview['prototype'][_0xf37a('0x127')]=function(_0x41a6b0){if(this['actions'][_0x41a6b0[_0xf37a('0xd7')]]&&_0x41a6b0[_0xf37a('0xd7')]!==_0x41a6b0[_0xf37a('0x128')]){this[_0xf37a('0x9c')](_0x41a6b0,_0x41a6b0[_0xf37a('0xd7')],_0x41a6b0[_0xf37a('0xd3')]);}};Preview[_0xf37a('0x10')][_0xf37a('0x129')]=function(_0x553669){if(this[_0xf37a('0x6d')][_0x553669['linkedid']]&&_0x553669[_0xf37a('0xb1')]!==_0x553669[_0xf37a('0xa4')]&&!this[_0xf37a('0x6d')][_0x553669[_0xf37a('0xb1')]][_0xf37a('0x78')]){if(_0x553669[_0xf37a('0x122')]==='1'){this['callProgressDetectingCustomer'](_0x553669,_0x553669[_0xf37a('0xb1')],_0x553669[_0xf37a('0x122')]);}}};Preview['prototype']['addVariable']=function(_0x539050,_0x158431,_0x10fbd8){if(this['actions'][_0x539050]){if(_[_0xf37a('0x66')](this[_0xf37a('0x6d')][_0x539050][_0xf37a('0x12a')])){this[_0xf37a('0x6d')][_0x539050][_0xf37a('0x12a')]={};}this[_0xf37a('0x6d')][_0x539050][_0xf37a('0x12a')][_0x158431]=_0x10fbd8;}};Preview[_0xf37a('0x10')]['syncVarSet']=function(_0x3de25e){try{if(!_[_0xf37a('0x66')](_0x3de25e)){if(ut[_0xf37a('0x12b')](_[_0xf37a('0x12c')](_0x3de25e[_0xf37a('0x12d')])[0x0])){this[_0xf37a('0x12e')](_0x3de25e[_0xf37a('0xa4')],_[_0xf37a('0x12c')](_0x3de25e[_0xf37a('0x12d')])[0x0],_0x3de25e['value']);}}}catch(_0x429773){logger[_0xf37a('0x12f')](_0xf37a('0x130'),util[_0xf37a('0x131')](_0x429773,{'showHidden':![],'depth':null}));}};Preview[_0xf37a('0x10')][_0xf37a('0x24')]=function(_0x3bbfd3){if(_0x3bbfd3){if(this['actions'][_0x3bbfd3[_0xf37a('0x132')]]){this[_0xf37a('0x6d')][_0x3bbfd3[_0xf37a('0x132')]]['transfer']=!![];}}};Preview[_0xf37a('0x10')][_0xf37a('0x133')]=function(_0x2a56fc){if(_0x2a56fc){if(this[_0xf37a('0x6d')][_0x2a56fc['transfererlinkedid']]){this[_0xf37a('0x6d')][_0x2a56fc[_0xf37a('0x134')]]['transfer']=!![];}}};module[_0xf37a('0x135')]=Preview; \ No newline at end of file +var _0x0242=['Contact','phone','Contact\x20is\x20undefined','isEmpty','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','Call\x20unsuccessful','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','syncOriginateResponse','actionid','lookAgent','clone','isFailure','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','dialstatus','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','ioredis','../../../config/logger','actionPreview','../ami','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','trunks','actions','agents','clockClearZombieChannels','originateresponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','syncDialEnd','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','Trunk','active','callerid','Interval','stringify','voice:queue:%s','format','voice_queue_channel:remove','sendMessageOneNotActive','available','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','sequence','isNil','info','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','emit','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','BUSY','Busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','countbusyretry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','unlockAgent','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','unlockContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]'];(function(_0x279262,_0x465e81){var _0x47fcda=function(_0x5e6de2){while(--_0x5e6de2){_0x279262['push'](_0x279262['shift']());}};_0x47fcda(++_0x465e81);}(_0x0242,0x189));var _0x2024=function(_0x33c2af,_0x163198){_0x33c2af=_0x33c2af-0x0;var _0x13c04a=_0x0242[_0x33c2af];return _0x13c04a;};'use strict';var util=require(_0x2024('0x0'));var _=require('lodash');var BPromise=require(_0x2024('0x1'));var uuid=require(_0x2024('0x2'));var moment=require(_0x2024('0x3'));var md5=require(_0x2024('0x4'));var Redis=require(_0x2024('0x5'));var config=require('../../../config/environment');var logger=require(_0x2024('0x6'))('preview');var loggerAction=require(_0x2024('0x6'))(_0x2024('0x7'));var ami=require(_0x2024('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0x2024('0x9'));var ut=require(_0x2024('0xa'));config[_0x2024('0xb')]=_[_0x2024('0xc')](config[_0x2024('0xb')],{'host':_0x2024('0xd'),'port':0x18eb});var io=require(_0x2024('0xe'))(new Redis(config[_0x2024('0xb')]));var Sequence=function(){};Sequence[_0x2024('0xf')][_0x2024('0x10')]=function(_0x26c1dc){this['tail']=this[_0x2024('0x11')]?this[_0x2024('0x11')][_0x2024('0x12')](_0x26c1dc):_0x26c1dc();};function Preview(_0x5c3699){this['sequence']=new Sequence();this['campaignsPreview']=_0x5c3699['voiceQueues'];this['trunks']=_0x5c3699[_0x2024('0x13')];this[_0x2024('0x14')]={};this[_0x2024('0x15')]=_0x5c3699[_0x2024('0x15')];this[_0x2024('0x16')]=0x0;ami['on'](_0x2024('0x17'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x2024('0x18'),this[_0x2024('0x19')][_0x2024('0x1a')](this));ami['on'](_0x2024('0x1b'),this[_0x2024('0x1c')]['bind'](this));ami['on']('dialend',this[_0x2024('0x1d')]['bind'](this));ami['on']('newexten',this[_0x2024('0x1e')]['bind'](this));ami['on']('varset',this[_0x2024('0x1f')][_0x2024('0x1a')](this));ami['on'](_0x2024('0x20'),this[_0x2024('0x21')][_0x2024('0x1a')](this));ami['on'](_0x2024('0x22'),this['syncBlindTransfer']['bind'](this));this[_0x2024('0x23')](this[_0x2024('0x24')]);}function emit(_0x1e7f7a,_0x940ffd,_0x4c0f2a){io['to'](_0x1e7f7a)['emit'](_0x940ffd,_0x4c0f2a);}function emitCampaignPreview(_0x19d797){if(_0x19d797[_0x2024('0x25')]===_0x2024('0x26')){var _0x190ed1={'id':_0x19d797['id'],'name':_0x19d797[_0x2024('0x27')],'strategy':_0x19d797[_0x2024('0x28')],'answered':_0x19d797[_0x2024('0x29')],'available':_0x19d797['available'],'loggedIn':_0x19d797[_0x2024('0x2a')],'pTalking':_0x19d797[_0x2024('0x2b')],'sumBillable':_0x19d797[_0x2024('0x2c')],'sumDuration':_0x19d797[_0x2024('0x2d')],'sumHoldTime':_0x19d797[_0x2024('0x2e')]||0x0,'talking':_0x19d797[_0x2024('0x2f')],'total':_0x19d797[_0x2024('0x30')],'type':_0x19d797[_0x2024('0x25')],'unmanaged':_0x19d797[_0x2024('0x31')],'abandoned':_0x19d797[_0x2024('0x32')],'waiting':_0x19d797[_0x2024('0x33')],'loggedInDb':_0x19d797['loggedInDb'],'dialActive':_0x19d797[_0x2024('0x34')],'dialMethod':_0x19d797[_0x2024('0x35')],'dialOriginateCallerIdName':_0x19d797[_0x2024('0x36')],'dialOriginateCallerIdNumber':_0x19d797[_0x2024('0x37')],'dialOriginateTimeout':_0x19d797[_0x2024('0x38')],'dialPrefix':_0x19d797['dialPrefix'],'outboundAnswerAgiCallsDay':_0x19d797['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x19d797['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x19d797[_0x2024('0x39')],'outboundBusyCallsDay':_0x19d797[_0x2024('0x3a')],'outboundCongestionCallsDay':_0x19d797['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x19d797[_0x2024('0x3b')],'outboundDropCallsDayCallersExit':_0x19d797['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x19d797[_0x2024('0x3c')],'outboundNoAnswerCallsDay':_0x19d797[_0x2024('0x3d')],'outboundNoSuchCallsDay':_0x19d797[_0x2024('0x3e')],'outboundOriginateFailureCallsDay':_0x19d797[_0x2024('0x3f')],'outboundReCallsDay':_0x19d797[_0x2024('0x40')],'outboundRejectCallsDay':_0x19d797[_0x2024('0x41')],'outboundUnknownCallsDay':_0x19d797[_0x2024('0x42')],'predictiveIntervalAnsweredCalls':_0x19d797['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x19d797[_0x2024('0x43')],'predictiveIntervalAvgTalktime':_0x19d797[_0x2024('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x19d797[_0x2024('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x19d797[_0x2024('0x46')],'predictiveIntervalErlangCalls':_0x19d797[_0x2024('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x19d797[_0x2024('0x48')],'predictiveIntervalHitRate':_0x19d797[_0x2024('0x49')],'predictiveIntervalLowerLimit':_0x19d797[_0x2024('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x19d797[_0x2024('0x4b')],'predictiveIntervalPauses':_0x19d797[_0x2024('0x4c')],'predictiveIntervalTotalCalls':_0x19d797[_0x2024('0x4d')],'message':_0x19d797[_0x2024('0x4e')],'originated':_0x19d797[_0x2024('0x4f')]};if(_0x19d797[_0x2024('0x50')]){_0x190ed1[_0x2024('0x50')]={'id':_0x19d797[_0x2024('0x50')]['id'],'name':_0x19d797['Trunk'][_0x2024('0x27')],'active':_0x19d797['Trunk'][_0x2024('0x51')],'callerid':_0x19d797[_0x2024('0x50')][_0x2024('0x52')]};}if(_0x19d797[_0x2024('0x53')]){_0x190ed1['Interval']={'id':_0x19d797[_0x2024('0x53')]['id'],'name':_0x19d797[_0x2024('0x53')][_0x2024('0x27')]};}var _0x2958e1=md5(JSON[_0x2024('0x54')](_0x190ed1));if(_0x19d797[_0x2024('0x4')]!==_0x2958e1){_0x19d797[_0x2024('0x4')]=_0x2958e1;emit(util['format'](_0x2024('0x55'),_0x190ed1[_0x2024('0x27')]),'voice_queue:save',_0x190ed1);}}}function emitVoiceQueueChannelRemove(_0x1f3e29){emit(util[_0x2024('0x56')](_0x2024('0x55'),_0x1f3e29[_0x2024('0x27')]),_0x2024('0x57'),_0x1f3e29);}function notSendMessagesQueue(_0x10d2c0){if(_0x10d2c0[_0x2024('0x58')]){if(_0x10d2c0['originated']===0x0&&_0x10d2c0[_0x2024('0x2b')]===0x0){_0x10d2c0[_0x2024('0x58')]=![];_0x10d2c0[_0x2024('0x59')]=0x0;_0x10d2c0['paused']=0x0;_0x10d2c0['message']='NOT_ACTIVE';ut[_0x2024('0x5a')](_0x2024('0x5b'),_0x10d2c0[_0x2024('0x27')]+_0x2024('0x5c'));}else{_0x10d2c0[_0x2024('0x4e')]=_0x2024('0x5d');ut[_0x2024('0x5a')](_0x2024('0x5b'),_0x10d2c0[_0x2024('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x10d2c0);}}Preview[_0x2024('0xf')]['loopCampaigns']=function(){var _0x4c8cd6=this;setInterval(function(){_0x4c8cd6['syncCampaigns']();},0x7cf);};Preview[_0x2024('0xf')][_0x2024('0x5e')]=function(){var _0x58491b=this[_0x2024('0x24')];this[_0x2024('0x16')]+=0x1;for(var _0x49c55b in _0x58491b){if(_0x58491b[_0x2024('0x5f')](_0x49c55b)&&(_0x58491b[_0x49c55b][_0x2024('0x35')]===_0x2024('0x60')||_0x58491b[_0x49c55b][_0x2024('0x35')]===_0x2024('0x61'))&&_0x58491b[_0x49c55b][_0x2024('0x25')]===_0x2024('0x26')){if(this[_0x2024('0x16')]>0x7){this[_0x2024('0x16')]=0x0;this[_0x2024('0x62')]();}}if(_0x58491b[_0x2024('0x5f')](_0x49c55b)&&_0x58491b[_0x49c55b][_0x2024('0x35')]===_0x2024('0x60')&&_0x58491b[_0x49c55b][_0x2024('0x25')]===_0x2024('0x26')){if(_0x58491b[_0x49c55b][_0x2024('0x34')]){this[_0x2024('0x63')](_0x58491b[_0x49c55b]);this[_0x2024('0x64')](_0x58491b[_0x49c55b]);}else{notSendMessagesQueue(_0x58491b[_0x49c55b]);}}}};Preview[_0x2024('0xf')][_0x2024('0x65')]=function(_0x31a273){var _0x42a852=this;this[_0x2024('0x66')]['enqueue'](function(){if(!_[_0x2024('0x67')](_0x42a852[_0x2024('0x14')][_0x31a273])){loggerAction[_0x2024('0x68')](_0x2024('0x69'),_0x31a273,_0x2024('0x6a'),_0x42a852['actions'][_0x31a273]['queue'],_0x2024('0x6b'),JSON[_0x2024('0x54')](_0x42a852[_0x2024('0x24')][_0x42a852[_0x2024('0x14')][_0x31a273][_0x2024('0x6c')]][_0x2024('0x4f')]),_0x2024('0x6d'),JSON[_0x2024('0x54')](_0x42a852[_0x2024('0x24')][_0x42a852[_0x2024('0x14')][_0x31a273]['queue']][_0x2024('0x2b')]),JSON[_0x2024('0x54')](_0x42a852[_0x2024('0x14')][_0x31a273][_0x2024('0x6e')]),JSON[_0x2024('0x54')](_[_0x2024('0x6f')](_0x42a852[_0x2024('0x14')][_0x31a273],[_0x2024('0x70'),'UserId',_0x2024('0x71'),'ListId'])));return ami[_0x2024('0x72')]({'action':_0x2024('0x73'),'channel':_0x42a852[_0x2024('0x14')][_0x31a273][_0x2024('0x74')]})[_0x2024('0x75')](function(_0x48acdb){if(_0x48acdb[_0x2024('0x4e')]===_0x2024('0x76')){setTimeout(function(){if(_0x42a852[_0x2024('0x14')][_0x31a273]){ut['updateOriginated'](_0x42a852[_0x2024('0x24')][_0x42a852[_0x2024('0x14')][_0x31a273][_0x2024('0x6c')]],'[clearZombieChannel]');if(_0x42a852[_0x2024('0x14')][_0x31a273][_0x2024('0x6e')]===!![]){ut[_0x2024('0x77')](_0x42a852['campaignsPreview'][_0x42a852[_0x2024('0x14')][_0x31a273][_0x2024('0x6c')]],_0x2024('0x78'));ut[_0x2024('0x79')](_0x2024('0x7a')+_0x31a273,_0x42a852['actions'][_0x31a273]['queue']);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x31a273,_0x42a852['actions'][_0x31a273][_0x2024('0x6c')]);delete _0x42a852[_0x2024('0x14')][_0x31a273];}},0x2328);}});}});};Preview[_0x2024('0xf')][_0x2024('0x62')]=function(){var _0xcaaee0=this;loggerAction[_0x2024('0x68')](_0x2024('0x7b'),_['size'](this[_0x2024('0x14')]));for(var _0x426a43 in this[_0x2024('0x14')]){if(_0xcaaee0[_0x2024('0x14')][_0x2024('0x5f')](_0x426a43)){_0xcaaee0[_0x2024('0x65')](_0x426a43);}}};Preview[_0x2024('0xf')][_0x2024('0x64')]=function(_0x27cdee){var _0x159969=this;rpcDb[_0x2024('0x7c')](_0x27cdee['id'],ut['agentReadyId'](this[_0x2024('0x15')]))[_0x2024('0x7d')](function(_0x1eebfe){if(!_[_0x2024('0x67')](_0x1eebfe)){for(var _0x1aef57=0x0;_0x1aef57<_0x1eebfe[_0x2024('0x7e')];_0x1aef57+=0x1){if(ut[_0x2024('0x7f')](_0x1eebfe[_0x1aef57][_0x2024('0x80')])<_0x27cdee[_0x2024('0x81')]*0x3c){_0x159969[_0x2024('0x82')](_0x1eebfe[_0x1aef57]['id'])[_0x2024('0x7d')](ut[_0x2024('0x83')]('[RecallMe]'))[_0x2024('0x75')](ut[_0x2024('0x83')](_0x2024('0x84')));}else{var _0x4716d0=new Action(_0x1eebfe[_0x1aef57],_0x27cdee);_0x4716d0[_0x2024('0x85')]=moment()[_0x2024('0x56')](_0x2024('0x86'));_0x27cdee[_0x2024('0x40')]+=0x1;ut[_0x2024('0x87')](_0x4716d0,0x17,_0x2024('0x88'));if(_0x27cdee[_0x2024('0x89')]){rpcDb['rescheduleContactInQueue'](ut[_0x2024('0x8a')](_0x1eebfe[_0x1aef57]));rpcDb[_0x2024('0x8b')](_0x4716d0,_0x2024('0x8c'));}else{ut[_0x2024('0x87')](_0x4716d0,0x16,_0x2024('0x8d'));rpcDb[_0x2024('0x8b')](_0x4716d0,'[HistoryRecallClose]');rpcDb[_0x2024('0x8e')](_0x4716d0,_0x2024('0x8f'));}}}}})[_0x2024('0x75')](ut[_0x2024('0x83')](_0x2024('0x90')));};Preview['prototype']['setMessage']=function(_0x310714){_0x310714['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x310714['loggedIn'])){_0x310714['message']=_0x2024('0x91');}else if(!ut[_0x2024('0x92')](_0x310714[_0x2024('0x34')])){_0x310714[_0x2024('0x4e')]='NOT_ACTIVE';}else if(!this[_0x2024('0x93')](_0x310714['Trunk'])){if(!this[_0x2024('0x93')](_0x310714[_0x2024('0x94')])){_0x310714[_0x2024('0x4e')]=_0x2024('0x95');}else{_0x310714[_0x2024('0x4e')]='ACTIVE';}}else{_0x310714[_0x2024('0x4e')]=_0x2024('0x96');}emitCampaignPreview(_0x310714);};Preview[_0x2024('0xf')][_0x2024('0x97')]=function(_0xe70178,_0x5a4b1a,_0x58815a){var _0x44d64b=this;var _0x72e67b=this['actions'][_0x5a4b1a];var _0x5302d2=this[_0x2024('0x24')][_0x72e67b[_0x2024('0x6c')]];var _0x52bcd0;if(_0x5302d2){switch(_0x58815a){case'1':_0x5302d2[_0x2024('0x3e')]+=0x1;_0x72e67b[_0x2024('0x98')]=ut[_0x2024('0x99')](_0x72e67b);ut[_0x2024('0x87')](_0x72e67b,0x0,_0x2024('0x9a'));rpcDb[_0x2024('0x8b')](_0x72e67b,_0x2024('0x9b'));if(ut['totalGlobal'](_0x72e67b)>=_0x5302d2['dialGlobalMaxRetry']){_0x52bcd0=ut['cloneAction'](_0x72e67b,0xf,'Global');rpcDb[_0x2024('0x8e')](_0x52bcd0,_0x2024('0x9c'));}else{rpcDb[_0x2024('0x8e')](_0x72e67b,'[callProgressDetectingCustomer][logNoSuchGlobal]');}delete this[_0x2024('0x14')][_0xe70178[_0x2024('0x9d')]];break;case'ANSWER':var _0x2569d6=moment()['format'](_0x2024('0x86'));_0x72e67b[_0x2024('0x9e')]=_0x2569d6;_0x72e67b[_0x2024('0x9f')]=_0x2569d6;_0x72e67b[_0x2024('0x6e')]=!![];_0x5302d2[_0x2024('0x2b')]+=0x1;logger[_0x2024('0x68')](_0x2024('0xa0'),_0x72e67b[_0x2024('0xa1')],_0x2024('0xa2'),_0x5302d2[_0x2024('0x27')],_0x2024('0x6d'),_0x5302d2[_0x2024('0x2b')]);ami['emit'](_0x2024('0xa3'),ut[_0x2024('0xa4')](_0x72e67b,_0x2024('0xa5')));if(_0x5302d2[_0x2024('0xa6')]){ami[_0x2024('0xa7')](_0x2024('0xa8'),ut[_0x2024('0xa9')](_0x72e67b));}break;case'16':ami[_0x2024('0xa7')](_0x2024('0xaa'),ut['buildObj'](_0x72e67b,'complete'));emitVoiceQueueChannelRemove(ut[_0x2024('0xa4')](_0x72e67b,_0x2024('0xab')));_0x5302d2['outboundAnswerCallsDay']+=0x1;_0x5302d2[_0x2024('0x30')]+=0x1;_0x5302d2[_0x2024('0x29')]+=0x1;ut[_0x2024('0x77')](_0x5302d2,'[16]');_0x72e67b['countglobal']=ut[_0x2024('0x99')](_0x72e67b);ut[_0x2024('0x87')](_0x72e67b,0x4,_0x2024('0xac'));rpcDb[_0x2024('0x8b')](_0x72e67b,_0x2024('0xad'));rpcDb[_0x2024('0x8e')](_0x72e67b,_0x2024('0xae'));rpcDb['crateCustomerReportQueue'](_0x72e67b);_0x5302d2[_0x2024('0x2d')]+=_0x72e67b[_0x2024('0xaf')];_0x5302d2[_0x2024('0x2c')]+=_0x72e67b[_0x2024('0xaf')];logger['info'](_0x2024('0xb0'),_0x72e67b[_0x2024('0xa1')],_0x2024('0xa2'),_0x5302d2[_0x2024('0x27')],_0x2024('0x6d'),_0x5302d2[_0x2024('0x2b')]);delete this[_0x2024('0x14')][_0xe70178[_0x2024('0x9d')]];break;case _0x2024('0xb1'):_0x5302d2[_0x2024('0x3a')]+=0x1;_0x72e67b['countbusyretry']+=0x1;_0x72e67b['countglobal']=ut[_0x2024('0x99')](_0x72e67b);ut[_0x2024('0x87')](_0x72e67b,0x5,_0x2024('0xb2'));rpcDb[_0x2024('0x8b')](_0x72e67b,_0x2024('0xb3'));if(ut[_0x2024('0x99')](_0x72e67b)>=_0x5302d2[_0x2024('0xb4')]){_0x52bcd0=ut[_0x2024('0xb5')](_0x72e67b,0xf,_0x2024('0xb6'));rpcDb['createCustomerFinal'](_0x52bcd0,_0x2024('0xb7'));}else{if(_0x72e67b['countbusyretry']>=_0x5302d2[_0x2024('0xb8')]){rpcDb[_0x2024('0x8e')](_0x72e67b,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x2024('0xb9')](ut[_0x2024('0xba')](_0x72e67b,_0x2024('0xbb'),_0x5302d2[_0x2024('0xbc')]),_0x72e67b['unlockAgent'],_0x72e67b['activeContact']);}}break;case _0x2024('0xbd'):_0x5302d2[_0x2024('0x3d')]+=0x1;_0x72e67b[_0x2024('0xbe')]+=0x1;_0x72e67b[_0x2024('0x98')]=ut[_0x2024('0x99')](_0x72e67b);ut[_0x2024('0x87')](_0x72e67b,0x3,'NoAnswer');rpcDb[_0x2024('0x8b')](_0x72e67b,_0x2024('0xbf'));if(ut[_0x2024('0x99')](_0x72e67b)>=_0x5302d2[_0x2024('0xb4')]){_0x52bcd0=ut['cloneAction'](_0x72e67b,0xf,'Global');rpcDb['createCustomerFinal'](_0x52bcd0,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x72e67b['countnoanswerretry']>=_0x5302d2[_0x2024('0xc0')]){rpcDb['createCustomerFinal'](_0x72e67b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x2024('0xba')](_0x72e67b,'countnoanswerretry',_0x5302d2[_0x2024('0xc1')]),_0x72e67b['unlockAgent'],_0x72e67b[_0x2024('0xc2')]);}}break;case _0x2024('0xc3'):_0x5302d2[_0x2024('0xc4')]+=0x1;_0x72e67b[_0x2024('0xc5')]+=0x1;_0x72e67b[_0x2024('0x98')]=ut['totalGlobal'](_0x72e67b);ut[_0x2024('0x87')](_0x72e67b,0x8,_0x2024('0xc6'));rpcDb[_0x2024('0x8b')](_0x72e67b,_0x2024('0xc7'));if(ut[_0x2024('0x99')](_0x72e67b)>=_0x5302d2[_0x2024('0xb4')]){_0x52bcd0=ut[_0x2024('0xb5')](_0x72e67b,0xf,_0x2024('0xb6'));rpcDb[_0x2024('0x8e')](_0x52bcd0,_0x2024('0xc8'));}else{if(_0x72e67b[_0x2024('0xc5')]>=_0x5302d2[_0x2024('0xc9')]){rpcDb[_0x2024('0x8e')](_0x72e67b,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x2024('0xb9')](ut[_0x2024('0xba')](_0x72e67b,_0x2024('0xc5'),_0x5302d2[_0x2024('0xbc')]),_0x72e67b[_0x2024('0xca')],_0x72e67b[_0x2024('0xc2')]);}}break;case _0x2024('0xcb'):_0x5302d2[_0x2024('0x41')]+=0x1;_0x72e67b['countglobal']=ut['totalGlobal'](_0x72e67b);ut[_0x2024('0x87')](_0x72e67b,0x14,_0x2024('0xcc'));rpcDb[_0x2024('0x8b')](_0x72e67b,_0x2024('0xcd'));if(_0x72e67b['unlockAgent']){rpcDb[_0x2024('0xce')](_0x72e67b[_0x2024('0xcf')]);}if(_0x72e67b['activeContact']){rpcDb['disableContact'](_0x72e67b[_0x2024('0xcf')]);}break;default:if(_0x72e67b[_0x2024('0x6e')]){ut[_0x2024('0x77')](_0x5302d2,_0x2024('0xd0'));ut[_0x2024('0x79')](_0x2024('0xd1')+_0x5302d2[_0x2024('0x27')],_0xe70178);}_0x5302d2[_0x2024('0x42')]+=0x1;_0x72e67b[_0x2024('0x98')]=ut[_0x2024('0x99')](_0x72e67b);ut[_0x2024('0x87')](_0x72e67b,0xc,_0xe70178['cause-txt']||_0xe70178['dialstatus']);rpcDb['createCustomerHistory'](_0x72e67b,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x2024('0x99')](_0x72e67b)>=_0x5302d2[_0x2024('0xb4')]){_0x52bcd0=ut['cloneAction'](_0x72e67b,0xf,_0x2024('0xb6'));rpcDb[_0x2024('0x8e')](_0x52bcd0,_0x2024('0xd2'));}else{rpcDb['createCustomerFinal'](_0x72e67b,_0x2024('0xd2'));}delete this['actions'][_0xe70178[_0x2024('0x9d')]];}if(!(_0x72e67b['dialAnswer']&&_0x58815a==='16')){ut[_0x2024('0xd3')](_0x5302d2,_0x2024('0xd4'));logger['info'](_0x2024('0xd5'),_0x72e67b[_0x2024('0xa1')],_0x2024('0xa2'),_0x5302d2[_0x2024('0x27')],_0x2024('0x6b'),_0x5302d2[_0x2024('0x4f')]);}if(_0x58815a!==_0x2024('0xd6')){delete this['actions'][_0xe70178['linkedid']];delete this[_0x2024('0x14')][_0xe70178[_0x2024('0xd7')]];}}};Preview[_0x2024('0xf')][_0x2024('0xd8')]=function(_0x201af9,_0x4bb501,_0x57ab59){if(_[_0x2024('0xd9')](_0x4bb501)&&_0x2024('0xda')!==typeof _0x4bb501){return;}if(_[_0x2024('0xd9')](_0x57ab59)&&'object'!==typeof _0x57ab59){return;}switch(_0x57ab59[_0x2024('0xdb')]){case'0':ut[_0x2024('0xdc')](_0x201af9,0x0,_0x2024('0x9a'));rpcDb['createAgentHistory'](_0x201af9,_0x2024('0xdd'));break;case'3':ut[_0x2024('0xdc')](_0x201af9,0x3,_0x2024('0xde'));rpcDb[_0x2024('0xdf')](_0x201af9,_0x2024('0xe0'));break;case'5':ut[_0x2024('0xdc')](_0x201af9,0x5,_0x2024('0xb2'));rpcDb[_0x2024('0xdf')](_0x201af9,_0x2024('0xe1'));break;case'8':ut[_0x2024('0xdc')](_0x201af9,0x8,_0x2024('0xc6'));rpcDb[_0x2024('0xdf')](_0x201af9,_0x2024('0xe2'));break;case'22':ut[_0x2024('0xdc')](_0x201af9,0x16,_0x2024('0xe3'));rpcDb[_0x2024('0xdf')](_0x201af9,_0x2024('0xe4'));break;default:ut[_0x2024('0xdc')](_0x201af9,0xc,_0x57ab59[_0x2024('0xdb')]);rpcDb[_0x2024('0xdf')](_0x201af9,_0x2024('0xe2'));}ut[_0x2024('0xd3')](_0x4bb501,_0x2024('0xe5'));logger[_0x2024('0x68')](_0x2024('0xe6'),_0x201af9[_0x2024('0xa1')],_0x2024('0xa2'),_0x4bb501[_0x2024('0x27')],_0x2024('0x6b'),_0x4bb501['originated']);delete this['actions'][_0x201af9[_0x2024('0xa1')]];};Preview[_0x2024('0xf')]['checkInBlack']=function(_0x459131,_0x2d09a8,_0x568c2b,_0x1d983d,_0x5e1c98){var _0xf52232=this;return new BPromise(function(_0x46a06a,_0x42f730){if(_[_0x2024('0x67')](_0x2d09a8)||_[_0x2024('0x67')](_0x2d09a8[_0x2024('0xe7')])||_['isNil'](_0x2d09a8[_0x2024('0xe7')][_0x2024('0xe8')])||_[_0x2024('0x67')](_0x2d09a8[_0x2024('0x71')])){_0x42f730(ut[_0x2024('0x4e')](_0x2024('0xe9'),_0x1d983d,_0x5e1c98));return;}var _0x3556d4=uuid['v4']();var _0x53e98d=_0xf52232[_0x2024('0x24')][_0x2d09a8[_0x2024('0x6a')]['name']];var _0x22cc3e=_0x568c2b?_0xf52232[_0x2024('0x15')][_0x568c2b]['id']:undefined;_0xf52232[_0x2024('0x14')][_0x3556d4]=new Action(_0x2d09a8,_0x53e98d,_0x3556d4,_0x568c2b,_0x22cc3e);var _0x3963f0=_0xf52232[_0x2024('0x14')][_0x3556d4];_0x3963f0['unlockAgent']=_0x1d983d;_0x3963f0[_0x2024('0xc2')]=_0x5e1c98;_0x3963f0['lookAgent']=_0x568c2b;if(_[_0x2024('0xea')](_0x459131)){_0xf52232['execCall'](_0x3963f0,_0x53e98d,_0x2d09a8,_0x568c2b)[_0x2024('0x7d')](function(_0x299a5b){logger[_0x2024('0x68')]('[Preview][execCall][success]',_0x2024('0xeb')+_0x3963f0['queue']+_0x2024('0xec')+_0x3963f0[_0x2024('0xcf')],JSON[_0x2024('0x54')](_0x299a5b));ami[_0x2024('0xa7')]('custom:agentcalled',ut[_0x2024('0xa4')](_0x3963f0,_0x2024('0xed')));_0x46a06a(ut[_0x2024('0x4e')](_0x2024('0xee')));})[_0x2024('0x75')](function(_0x4bd635){ut[_0x2024('0x5a')](_0x2024('0xef'),_0x4bd635);_0x42f730(ut['message']('Call\x20failed',_0x1d983d,_0x5e1c98));});}else{_0x53e98d['outboundBlacklistCallsDay']+=0x1;ut[_0x2024('0xf0')](_0x3963f0);rpcDb[_0x2024('0xf1')](_0x3963f0,_0x2024('0xf2'));delete _0xf52232[_0x2024('0x14')][_0x3556d4];_0x42f730(ut[_0x2024('0x4e')](_0x2024('0xf3'),_0x1d983d,_0x5e1c98));}});};Preview[_0x2024('0xf')][_0x2024('0x93')]=function(_0xe70ad){return!_[_0x2024('0x67')](_0xe70ad)&&!_[_0x2024('0x67')](_0xe70ad[_0x2024('0x27')])&&!_['isNil'](_0xe70ad['active'])&&_0xe70ad['active']&&!_[_0x2024('0x67')](this[_0x2024('0x13')][util[_0x2024('0x56')]('SIP/%s',_0xe70ad['name'])])&&!_[_0x2024('0x67')](this[_0x2024('0x13')][util[_0x2024('0x56')](_0x2024('0xf4'),_0xe70ad[_0x2024('0x27')])][_0x2024('0x73')])&&(this[_0x2024('0x13')][util[_0x2024('0x56')](_0x2024('0xf4'),_0xe70ad[_0x2024('0x27')])][_0x2024('0x73')]===_0x2024('0xf5')||this['trunks'][util[_0x2024('0x56')](_0x2024('0xf4'),_0xe70ad[_0x2024('0x27')])][_0x2024('0x73')]===_0x2024('0xf6'));};Preview[_0x2024('0xf')][_0x2024('0x82')]=function(_0x546c9e,_0x315bb6){var _0x19e104=this;return new BPromise(function(_0x52276e,_0x74393f){_0x19e104[_0x2024('0xf7')](_0x546c9e,_0x315bb6)[_0x2024('0x7d')](function(_0x246bc5){_0x52276e(_['pick'](_0x246bc5,[_0x2024('0x4e')]));})[_0x2024('0x75')](function(_0x43c547){if(_0x43c547[_0x2024('0xf8')]){rpcDb[_0x2024('0xce')](_0x546c9e);}if(_0x43c547['active']){rpcDb[_0x2024('0xf9')](_0x546c9e);}_0x74393f(_[_0x2024('0x6f')](_0x43c547,[_0x2024('0x4e')]));});});};Preview[_0x2024('0xf')]['execRun']=function(_0x1695b5,_0xdf3f39){var _0x48101c=this;return new BPromise(function(_0x5ddf6c,_0xe31b53){var _0x4b5237,_0x4bfa5f;rpcDb[_0x2024('0xfa')](_0x1695b5)[_0x2024('0x7d')](function(_0x579e36){if(!_['isNil'](_0x579e36[0x0])){_0x4bfa5f=_0x579e36[0x0][_0x2024('0xfb')]?![]:!![];_0x4b5237=_0x579e36[0x0][_0x2024('0xfb')]?!![]:![];_0x4b5237=_0xdf3f39?!![]:_0x4b5237;}var _0x442e5f=_0x48101c[_0x2024('0xfc')](_0x579e36);if(_0x442e5f[_0x2024('0xfd')]){rpcDb[_0x2024('0xfe')](_[_0x2024('0x6f')](_0x579e36[0x0],['VoiceQueueId',_0x2024('0xff')]))[_0x2024('0x7d')](function(_0x39bc82){_0x48101c[_0x2024('0x100')](_0x39bc82,_0x579e36[0x0],_0xdf3f39,_0x4bfa5f,_0x4b5237)[_0x2024('0x7d')](function(_0x14d8cf){_0x5ddf6c(_0x14d8cf);})[_0x2024('0x75')](function(_0x488c0d){_0xe31b53(_0x488c0d);});})[_0x2024('0x75')](function(_0x5e8071){ut['logger']('[Preview][checkIsBlackList]',_0x5e8071);_0xe31b53(ut['message'](_0x2024('0x101'),_0x4bfa5f,_0x4b5237));});}else{_0xe31b53(ut[_0x2024('0x4e')](_0x442e5f['message'],_0x4bfa5f,_0x4b5237));}})[_0x2024('0x75')](function(_0x541bd8){ut[_0x2024('0x5a')](_0x2024('0x102'),_0x541bd8);_0xe31b53(ut[_0x2024('0x4e')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x2024('0xf')]['validateContact']=function(_0xd8fa84){if(_[_0x2024('0x67')](_0xd8fa84)||_[_0x2024('0xea')](_0xd8fa84)||!_['isNil'](_0xd8fa84[0x0][_0x2024('0x103')])&&_[_0x2024('0x67')](_0xd8fa84[0x0][_0x2024('0x103')][_0x2024('0x27')])){ut['logger'](_0x2024('0x104'),_0xd8fa84);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x3ef3cc=this[_0x2024('0x24')][_0xd8fa84[0x0][_0x2024('0x6a')][_0x2024('0x27')]];_0x3ef3cc[_0x2024('0x4e')]=_0x2024('0x96');if(_[_0x2024('0x67')](_0x3ef3cc)){ut[_0x2024('0x5a')](_0x2024('0x105'),_0x3ef3cc);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x3ef3cc['Trunk'])){ut['logger'](_0x2024('0x106'),_0x2024('0x107')+_0x3ef3cc[_0x2024('0x27')]+_0x2024('0x108'));if(!this[_0x2024('0x93')](_0x3ef3cc[_0x2024('0x94')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x3ef3cc[_0x2024('0x27')]+_0x2024('0x109'));return{'isValid':![],'message':_0x2024('0x10a')};}}if(!ut[_0x2024('0x92')](_0x3ef3cc[_0x2024('0x34')])){ut[_0x2024('0x5a')](_0x2024('0x10b'),_0x3ef3cc[_0x2024('0x27')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x3ef3cc[_0x2024('0x27')]+_0x2024('0x10c')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype']['execCall']=function(_0x23dff9,_0x479963,_0x4c1b0a,_0x5b1413){var _0x24fcbc=this;return new BPromise(function(_0x37db3d,_0x173f5c){var _0x55a114=_0x23dff9['uniqueid'];var _0x40f39e=_0x24fcbc[_0x2024('0x93')](_0x479963['Trunk'])?util[_0x2024('0x56')](_0x2024('0x10d'),_0x479963[_0x2024('0x50')]['name'],_[_0x2024('0x67')](_0x479963[_0x2024('0x10e')])?'':_0x479963[_0x2024('0x10e')][_0x2024('0x10f')]()||'',_0x479963[_0x2024('0x110')]>0x0?_0x4c1b0a[_0x2024('0xe7')][_0x2024('0xe8')][_0x2024('0x111')](_0x479963[_0x2024('0x110')]):_0x4c1b0a[_0x2024('0xe7')][_0x2024('0xe8')]):util[_0x2024('0x56')](_0x2024('0x10d'),_[_0x2024('0x67')](_0x479963[_0x2024('0x94')])?_0x479963['Trunk'][_0x2024('0x27')]:_0x479963[_0x2024('0x94')][_0x2024('0x27')],_[_0x2024('0x67')](_0x479963['dialPrefix'])?'':_0x479963[_0x2024('0x10e')][_0x2024('0x10f')]()||'',_0x479963[_0x2024('0x110')]>0x0?_0x4c1b0a['Contact']['phone'][_0x2024('0x111')](_0x479963[_0x2024('0x110')]):_0x4c1b0a[_0x2024('0xe7')]['phone']);var _0x2fad42=_0x24fcbc['isTrunkReachable'](_0x479963[_0x2024('0x50')])?ut[_0x2024('0x112')](_0x479963[_0x2024('0x50')][_0x2024('0x52')],_0x479963[_0x2024('0x36')],_0x479963[_0x2024('0x113')]>0x0?ut[_0x2024('0x114')](_0x479963[_0x2024('0x37')],_0x479963[_0x2024('0x113')]):_0x479963[_0x2024('0x37')]):ut[_0x2024('0x112')](_[_0x2024('0x67')](_0x479963[_0x2024('0x94')])?_0x479963['Trunk'][_0x2024('0x52')]:_0x479963[_0x2024('0x94')]['callerid'],_0x479963['dialOriginateCallerIdName'],_0x479963['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x2024('0x114')](_0x479963['dialOriginateCallerIdNumber'],_0x479963[_0x2024('0x113')]):_0x479963[_0x2024('0x37')]);if(_0x2fad42){_0x23dff9['originatecalleridname']=ut[_0x2024('0x115')](_0x2fad42);_0x23dff9[_0x2024('0x116')]=ut['extractCalleridNumber'](_0x2fad42);}var _0x1808df=ut[_0x2024('0x117')](_0x479963,_0x4c1b0a,_0x40f39e,_0x2fad42,_0x55a114,_0x23dff9);_[_0x2024('0x118')](_0x23dff9,ut[_0x2024('0x119')](_0x1808df));_0x23dff9[_0x2024('0x85')]=moment()['format'](_0x2024('0x86'));ami[_0x2024('0x72')](ut[_0x2024('0x11a')](_0x23dff9,_0x479963,_0x1808df,_0x23dff9[_0x2024('0xc2')],_0x5b1413))[_0x2024('0x7d')](function(_0x5d4be1){_0x479963[_0x2024('0x4f')]+=0x1;logger[_0x2024('0x68')](_0x2024('0x11b'),_0x55a114,_0x2024('0xa2'),_0x479963['name'],_0x2024('0x6b'),_0x479963[_0x2024('0x4f')]);_0x37db3d(_0x5d4be1);})[_0x2024('0x75')](function(_0x53a496){ut['logAgent'](_0x23dff9,0xe,'OriginateError');rpcDb[_0x2024('0xdf')](_0x23dff9,'[originateFailure][logOriginateFailure]');_0x173f5c(_0x53a496);});});};Preview['prototype'][_0x2024('0x1e')]=function(_0x1e2408){if(this[_0x2024('0x14')][_0x1e2408[_0x2024('0x9d')]]){this['actions'][_0x1e2408[_0x2024('0x9d')]][_0x2024('0x74')]=_0x1e2408[_0x2024('0x74')];}};Preview['prototype'][_0x2024('0x11c')]=function(_0x38c897){var _0x162965=this;var _0x3ebccf=this[_0x2024('0x14')][_0x38c897[_0x2024('0x11d')]];if(_0x3ebccf){if(_0x3ebccf[_0x2024('0x11e')]&&this[_0x2024('0x15')][_0x3ebccf[_0x2024('0x11e')]]){ut['logLookAgent'](_0x3ebccf,this[_0x2024('0x15')][_0x3ebccf[_0x2024('0x11e')]][_0x2024('0x27')],this[_0x2024('0x15')][_0x3ebccf['lookAgent']]['id']);}var _0x44ced0=_[_0x2024('0x11f')](_0x3ebccf);_0x44ced0['responsetime']=moment()['format'](_0x2024('0x86'));var _0x33738f=_0x162965[_0x2024('0x24')][_0x3ebccf['queue']];if(ut[_0x2024('0x120')](_0x38c897['response'])){if(_0x3ebccf[_0x2024('0xca')]){rpcDb['unlockContact'](_0x3ebccf['idContact']);}if(_0x3ebccf[_0x2024('0xc2')]){rpcDb[_0x2024('0xf9')](_0x3ebccf[_0x2024('0xcf')]);}ami[_0x2024('0xa7')]('custom:agentringnoanswer',ut[_0x2024('0xa4')](_0x3ebccf,_0x2024('0x121')));this[_0x2024('0xd8')](_0x44ced0,_0x33738f,_0x38c897);}else{_0x3ebccf[_0x2024('0x85')]=moment()[_0x2024('0x56')](_0x2024('0x86'));ut[_0x2024('0xdc')](_0x44ced0,0x4,_0x2024('0xac'));rpcDb[_0x2024('0xdf')](_0x44ced0,_0x2024('0x122'));}}};Preview[_0x2024('0xf')][_0x2024('0x19')]=function(_0x50479b){var _0x5be11e=this;var _0x46eb8c=this[_0x2024('0x14')][_0x50479b['linkedid']];var _0x5e4eca;if(_0x46eb8c){_0x5e4eca=this[_0x2024('0x24')][_0x46eb8c['queue']];logger[_0x2024('0x68')](_0x2024('0x123'),_0x50479b['linkedid'],_0x2024('0xa2'),_0x5e4eca['name'],_0x2024('0x6d'),_0x5e4eca[_0x2024('0x2b')]);}if(this[_0x2024('0x14')][_0x50479b['linkedid']]&&_0x50479b[_0x2024('0x9d')]!==_0x50479b[_0x2024('0xa1')]){if(_0x50479b[_0x2024('0x124')]==='16'&&this[_0x2024('0x14')][_0x50479b[_0x2024('0x9d')]][_0x2024('0x6e')]){this[_0x2024('0x97')](_0x50479b,_0x50479b[_0x2024('0x9d')],_0x50479b[_0x2024('0x124')]);}else if(this[_0x2024('0x14')][_0x50479b[_0x2024('0x9d')]]['dialAnswer']){logger[_0x2024('0x68')](_0x2024('0x125'),_0x50479b[_0x2024('0x9d')],_0x50479b[_0x2024('0x124')],_0x2024('0xa2'),_0x5e4eca[_0x2024('0x27')],_0x2024('0x6d'),_0x5e4eca[_0x2024('0x2b')]);this[_0x2024('0x97')](_0x50479b,_0x50479b[_0x2024('0x9d')],_0x50479b[_0x2024('0x124')]);}}else if(_0x46eb8c&&_['isNil'](_0x46eb8c[_0x2024('0x126')])&&_0x5e4eca[_0x2024('0x127')]&&_0x50479b[_0x2024('0x9d')]===_0x50479b[_0x2024('0xa1')]&&_[_0x2024('0x67')](_0x50479b[_0x2024('0xdb')])&&_0x50479b[_0x2024('0x124')]==='16'&&_0x50479b['channelstate']==='6'&&_[_0x2024('0xd9')](_0x46eb8c[_0x2024('0x128')])){if(_0x46eb8c[_0x2024('0xca')]){rpcDb[_0x2024('0xce')](_0x46eb8c['idContact']);}if(_0x46eb8c[_0x2024('0xc2')]){rpcDb[_0x2024('0xf9')](_0x46eb8c[_0x2024('0xcf')]);}_0x50479b['reason']='22';this[_0x2024('0xd8')](_0x46eb8c,_0x5e4eca,_0x50479b);}else if(_0x46eb8c&&_0x46eb8c['transfer']){if(_0x50479b[_0x2024('0x124')]==='16'&&this[_0x2024('0x14')][_0x50479b['linkedid']][_0x2024('0x6e')]){logger[_0x2024('0x68')](_0x2024('0x129'),_0x50479b[_0x2024('0x9d')],_0x50479b[_0x2024('0x124')],'\x20Queue',_0x5e4eca[_0x2024('0x27')],_0x2024('0x6d'),_0x5e4eca[_0x2024('0x2b')]);this['callProgressDetectingCustomer'](_0x50479b,_0x50479b[_0x2024('0x9d')],_0x50479b['cause']);}else if(this[_0x2024('0x14')][_0x50479b[_0x2024('0x9d')]]['dialAnswer']){logger[_0x2024('0x68')](_0x2024('0x125'),_0x50479b[_0x2024('0x9d')],_0x50479b['cause'],_0x2024('0xa2'),_0x5e4eca[_0x2024('0x27')],_0x2024('0x6d'),_0x5e4eca['pTalking']);this[_0x2024('0x97')](_0x50479b,_0x50479b[_0x2024('0x9d')],_0x50479b[_0x2024('0x124')]);}}};Preview[_0x2024('0xf')][_0x2024('0x1d')]=function(_0x34cfc7){if(this[_0x2024('0x14')][_0x34cfc7[_0x2024('0xd7')]]&&_0x34cfc7[_0x2024('0xd7')]!==_0x34cfc7[_0x2024('0x12a')]){this[_0x2024('0x97')](_0x34cfc7,_0x34cfc7[_0x2024('0xd7')],_0x34cfc7[_0x2024('0x12b')]);}};Preview[_0x2024('0xf')][_0x2024('0x1c')]=function(_0x174fe8){if(this[_0x2024('0x14')][_0x174fe8[_0x2024('0x9d')]]&&_0x174fe8[_0x2024('0x9d')]!==_0x174fe8[_0x2024('0xa1')]&&!this[_0x2024('0x14')][_0x174fe8[_0x2024('0x9d')]][_0x2024('0x6e')]){if(_0x174fe8[_0x2024('0x124')]==='1'){this['callProgressDetectingCustomer'](_0x174fe8,_0x174fe8[_0x2024('0x9d')],_0x174fe8['cause']);}}};Preview[_0x2024('0xf')][_0x2024('0x12c')]=function(_0x229f1b,_0x5c8a32,_0x527490){if(this[_0x2024('0x14')][_0x229f1b]){if(_[_0x2024('0x67')](this[_0x2024('0x14')][_0x229f1b]['variables'])){this[_0x2024('0x14')][_0x229f1b]['variables']={};}this['actions'][_0x229f1b]['variables'][_0x5c8a32]=_0x527490;}};Preview[_0x2024('0xf')][_0x2024('0x1f')]=function(_0x418e8b){try{if(!_['isNil'](_0x418e8b)){if(ut[_0x2024('0x12d')](_[_0x2024('0x12e')](_0x418e8b[_0x2024('0x12f')])[0x0])){this[_0x2024('0x12c')](_0x418e8b[_0x2024('0xa1')],_['keys'](_0x418e8b[_0x2024('0x12f')])[0x0],_0x418e8b[_0x2024('0x130')]);}}}catch(_0x39388f){logger[_0x2024('0x131')](_0x2024('0x132'),util[_0x2024('0x133')](_0x39388f,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x2024('0x21')]=function(_0x537cac){if(_0x537cac){if(this[_0x2024('0x14')][_0x537cac[_0x2024('0x134')]]){this['actions'][_0x537cac[_0x2024('0x134')]][_0x2024('0x128')]=!![];}}};Preview[_0x2024('0xf')][_0x2024('0x135')]=function(_0x539aa6){if(_0x539aa6){if(this['actions'][_0x539aa6[_0x2024('0x136')]]){this[_0x2024('0x14')][_0x539aa6[_0x2024('0x136')]]['transfer']=!![];}}};module[_0x2024('0x137')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 784cf49..99384fc 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 _0x6901=['unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x6901,0x12c));var _0x1690=function(_0x478c79,_0x570904){_0x478c79=_0x478c79-0x0;var _0x514b55=_0x6901[_0x478c79];return _0x514b55;};'use strict';var util=require(_0x1690('0x0'));var BPromise=require(_0x1690('0x1'));var logger=require(_0x1690('0x2'))(_0x1690('0x3'));var _=require(_0x1690('0x4'));var cmHopper=require(_0x1690('0x5'));var cmHopperFinal=require(_0x1690('0x6'));var cmHopperHistory=require(_0x1690('0x7'));var cmHopperBlack=require(_0x1690('0x8'));var voiceQueueRt=require(_0x1690('0x9'));var agentReportPreview=require(_0x1690('0xa'));var voiceQueueReport=require(_0x1690('0xb'));function loggerCatch(_0x5144d0){return function(_0x3bd71e){logger[_0x1690('0xc')](_0x5144d0,util['inspect'](_0x3bd71e,{'showHidden':![],'depth':null}));};}function create(_0x214e05){return BPromise[_0x1690('0xd')]()[_0x1690('0xe')](cmHopperHistory[_0x1690('0xf')](_0x214e05))['catch'](loggerCatch(_0x1690('0x10')));}function createAgent(_0x198268){return BPromise[_0x1690('0xd')]()[_0x1690('0xe')](agentReportPreview['createHistory'](_0x198268))[_0x1690('0x11')](loggerCatch(_0x1690('0x10')));}function moveContact(_0x2eb15b){return BPromise['resolve']()['then'](cmHopper[_0x1690('0x12')](_0x2eb15b,!![]))[_0x1690('0x11')](loggerCatch(_0x1690('0x13')));}exports[_0x1690('0x14')]=function(_0x20763e){return BPromise['resolve']()[_0x1690('0xe')](cmHopperBlack['checkIsBlackList'](_0x20763e))[_0x1690('0x11')](loggerCatch(_0x1690('0x15')));};exports[_0x1690('0x16')]=function(_0x177597){return BPromise[_0x1690('0xd')]()['then'](cmHopper[_0x1690('0x16')](_0x177597))[_0x1690('0x11')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x5a13e7,_0x14f772){create(_0x5a13e7)[_0x1690('0x11')](loggerCatch(_0x14f772));moveContact(_0x5a13e7)['catch'](loggerCatch(_0x14f772));};exports[_0x1690('0x17')]=function(_0x3d8d22,_0xa085){createAgent(_0x3d8d22)[_0x1690('0x11')](loggerCatch(_0xa085));};exports[_0x1690('0x18')]=function(_0x2d7c45,_0x31e9f7){create(_0x2d7c45)['catch'](loggerCatch(_0x31e9f7));};exports[_0x1690('0x19')]=function(_0x2cb424,_0x59d3d1){moveContact(_0x2cb424)[_0x1690('0x11')](loggerCatch(_0x59d3d1));};exports[_0x1690('0x1a')]=function(_0x5ead81,_0x5d525b,_0x8aaa79){if(_0x5d525b){_0x5ead81[_0x1690('0x1b')]=null;}if(_0x8aaa79){_0x5ead81[_0x1690('0x1c')]=![];}return BPromise[_0x1690('0xd')]()['then'](cmHopper[_0x1690('0x1a')](_0x5ead81))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x1690('0x1d')]=function(_0x2c0873){return BPromise[_0x1690('0xd')]()[_0x1690('0xe')](cmHopper[_0x1690('0x1d')](_0x2c0873))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x1690('0x1e')]=function(_0x27fe65){return BPromise[_0x1690('0xd')]()['then'](cmHopper[_0x1690('0x1e')]({'UserId':null},_0x27fe65,0x1))['catch'](loggerCatch(_0x1690('0x1f')));};exports[_0x1690('0x20')]=function(_0x5659f4){return BPromise[_0x1690('0xd')]()[_0x1690('0xe')](cmHopper[_0x1690('0x1e')]({'active':![]},_0x5659f4,0x1))['catch'](loggerCatch(_0x1690('0x21')));};exports['crateCustomerReportQueue']=function(_0x50f028){var _0x377661={};_0x377661['type']=_0x50f028[_0x1690('0x22')];_0x377661['uniqueid']=_0x50f028['uniqueid'];_0x377661[_0x1690('0x23')]=_0x50f028['calleridnum'];_0x377661[_0x1690('0x24')]=_0x50f028[_0x1690('0x24')];_0x377661[_0x1690('0x25')]=_0x50f028[_0x1690('0x25')];_0x377661[_0x1690('0x26')]=_0x50f028[_0x1690('0x27')];_0x377661[_0x1690('0x28')]=_0x50f028['answertime'];_0x377661[_0x1690('0x29')]=0x1;_0x377661[_0x1690('0x2a')]=_0x50f028[_0x1690('0x2b')];_0x377661[_0x1690('0x2c')]=_0x50f028[_0x1690('0x2d')];_0x377661['context']=_0x1690('0x2e');_0x377661['exten']=_0x1690('0x2f');_0x377661[_0x1690('0x30')]=0x0;_0x377661[_0x1690('0x31')]=0x1;_0x377661[_0x1690('0x32')]=_0x50f028[_0x1690('0x2d')];_0x377661[_0x1690('0x33')]='COMPLETED';return BPromise[_0x1690('0xd')]()[_0x1690('0xe')](voiceQueueReport['create'](_0x377661))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x425c4a,_0x47578d){return BPromise['resolve']()['then'](cmHopper[_0x1690('0x34')](_0x425c4a,_0x47578d))[_0x1690('0x11')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x1690('0x35')]=function(_0x20469b){return BPromise['resolve']()[_0x1690('0xe')](cmHopper['rescheduleContact'](_0x20469b,!![],!![]))[_0x1690('0x11')](loggerCatch(_0x1690('0x36')));}; \ No newline at end of file +var _0xa31d=['../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa31d,0x193));var _0xda31=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0xa31d[_0x7791d5];return _0x5ce288;};'use strict';var util=require(_0xda31('0x0'));var BPromise=require(_0xda31('0x1'));var logger=require(_0xda31('0x2'))(_0xda31('0x3'));var _=require(_0xda31('0x4'));var cmHopper=require(_0xda31('0x5'));var cmHopperFinal=require(_0xda31('0x6'));var cmHopperHistory=require(_0xda31('0x7'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xda31('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xda31('0x9'));function loggerCatch(_0x2c8814){return function(_0x438dee){logger[_0xda31('0xa')](_0x2c8814,util['inspect'](_0x438dee,{'showHidden':![],'depth':null}));};}function create(_0xc9fb28){return BPromise['resolve']()[_0xda31('0xb')](cmHopperHistory[_0xda31('0xc')](_0xc9fb28))[_0xda31('0xd')](loggerCatch(_0xda31('0xe')));}function createAgent(_0x17d017){return BPromise[_0xda31('0xf')]()[_0xda31('0xb')](agentReportPreview[_0xda31('0xc')](_0x17d017))[_0xda31('0xd')](loggerCatch(_0xda31('0xe')));}function moveContact(_0x69c6d2){return BPromise[_0xda31('0xf')]()['then'](cmHopper[_0xda31('0x10')](_0x69c6d2,!![]))[_0xda31('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xda31('0x11')]=function(_0x558968){return BPromise[_0xda31('0xf')]()['then'](cmHopperBlack[_0xda31('0x11')](_0x558968))[_0xda31('0xd')](loggerCatch(_0xda31('0x12')));};exports[_0xda31('0x13')]=function(_0x4b9cf4){return BPromise[_0xda31('0xf')]()[_0xda31('0xb')](cmHopper['getContactPreview'](_0x4b9cf4))[_0xda31('0xd')](loggerCatch(_0xda31('0x14')));};exports['createHistory']=function(_0x4f95f3,_0x5b4f3e){create(_0x4f95f3)[_0xda31('0xd')](loggerCatch(_0x5b4f3e));moveContact(_0x4f95f3)[_0xda31('0xd')](loggerCatch(_0x5b4f3e));};exports['createAgentHistory']=function(_0x478907,_0x2b7dee){createAgent(_0x478907)[_0xda31('0xd')](loggerCatch(_0x2b7dee));};exports['createCustomerHistory']=function(_0x16171b,_0x117435){create(_0x16171b)[_0xda31('0xd')](loggerCatch(_0x117435));};exports['createCustomerFinal']=function(_0x348e97,_0x4caeb1){moveContact(_0x348e97)[_0xda31('0xd')](loggerCatch(_0x4caeb1));};exports[_0xda31('0x15')]=function(_0x434943,_0x2e89be,_0x1fc8bc){if(_0x2e89be){_0x434943[_0xda31('0x16')]=null;}if(_0x1fc8bc){_0x434943[_0xda31('0x17')]=![];}return BPromise[_0xda31('0xf')]()[_0xda31('0xb')](cmHopper[_0xda31('0x15')](_0x434943))[_0xda31('0xd')](loggerCatch(_0xda31('0x18')));};exports[_0xda31('0x19')]=function(_0x356d39){return BPromise[_0xda31('0xf')]()[_0xda31('0xb')](cmHopper[_0xda31('0x19')](_0x356d39))['catch'](loggerCatch(_0xda31('0x1a')));};exports[_0xda31('0x1b')]=function(_0x43db16){return BPromise[_0xda31('0xf')]()[_0xda31('0xb')](cmHopper[_0xda31('0x1b')]({'UserId':null},_0x43db16,0x1))[_0xda31('0xd')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x49d7e5){return BPromise[_0xda31('0xf')]()['then'](cmHopper[_0xda31('0x1b')]({'active':![]},_0x49d7e5,0x1))[_0xda31('0xd')](loggerCatch(_0xda31('0x1c')));};exports['crateCustomerReportQueue']=function(_0x4f91ea){var _0x1325ce={};_0x1325ce['type']=_0x4f91ea[_0xda31('0x1d')];_0x1325ce[_0xda31('0x1e')]=_0x4f91ea[_0xda31('0x1e')];_0x1325ce[_0xda31('0x1f')]=_0x4f91ea[_0xda31('0x1f')];_0x1325ce[_0xda31('0x20')]=_0x4f91ea[_0xda31('0x20')];_0x1325ce['queue']=_0x4f91ea[_0xda31('0x21')];_0x1325ce['queuecallerjoinAt']=_0x4f91ea['answertime'];_0x1325ce[_0xda31('0x22')]=_0x4f91ea['answertime'];_0x1325ce['queuecallercomplete']=0x1;_0x1325ce[_0xda31('0x23')]=_0x4f91ea[_0xda31('0x24')];_0x1325ce[_0xda31('0x25')]=_0x4f91ea[_0xda31('0x26')];_0x1325ce[_0xda31('0x27')]=_0xda31('0x28');_0x1325ce[_0xda31('0x29')]=_0xda31('0x2a');_0x1325ce[_0xda31('0x2b')]=0x0;_0x1325ce[_0xda31('0x2c')]=0x1;_0x1325ce['lastAssignedTo']=_0x4f91ea[_0xda31('0x26')];_0x1325ce[_0xda31('0x2d')]=_0xda31('0x2e');return BPromise[_0xda31('0xf')]()[_0xda31('0xb')](voiceQueueReport['create'](_0x1325ce))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xda31('0x2f')]=function(_0x38da94,_0x2373f5){return BPromise[_0xda31('0xf')]()['then'](cmHopper[_0xda31('0x2f')](_0x38da94,_0x2373f5))[_0xda31('0xd')](loggerCatch(_0xda31('0x30')));};exports[_0xda31('0x31')]=function(_0x3901af){return BPromise[_0xda31('0xf')]()[_0xda31('0xb')](cmHopper[_0xda31('0x15')](_0x3901af,!![],!![]))[_0xda31('0xd')](loggerCatch(_0xda31('0x32')));}; \ 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 5da4839..3550094 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 _0x362b=['ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countnoanswerretry','cloneAction','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','buildAcw','not_inuse','status','reachable','push','getDiff','diff','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countbusyretry','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','getCallerIdRandom','pow','replace','random','extractCalleridName','extractCalleridNumber','match','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger','info','loggerError','error','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','Queue','name','calleridname','calleridnum'];(function(_0x18de04,_0x208379){var _0x266c98=function(_0xbc852b){while(--_0xbc852b){_0x18de04['push'](_0x18de04['shift']());}};_0x266c98(++_0x208379);}(_0x362b,0xf7));var _0xb362=function(_0xbe7dfa,_0xdc61fb){_0xbe7dfa=_0xbe7dfa-0x0;var _0xcb4e76=_0x362b[_0xbe7dfa];return _0xcb4e76;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var logger=require(_0xb362('0x0'))(_0xb362('0x1'));var ipAgi=process[_0xb362('0x2')]['XCALLY_IP_AGI']||_0xb362('0x3');function getSeconds(_0xcb89bc,_0x53249d){var _0x3d65ef=moment(_0xcb89bc)['milliseconds'](0x0);var _0x3ef9bc=moment(_0x53249d)[_0xb362('0x4')](0x0);return _0x3d65ef['diff'](_0x3ef9bc,_0xb362('0x5'));}exports[_0xb362('0x6')]=function(_0x38a809){return function(_0x3af7b7){logger['error'](_0x38a809,util[_0xb362('0x7')](_0x3af7b7,{'showHidden':![],'depth':null}));};};exports[_0xb362('0x8')]=function(_0x184382,_0x317340){logger[_0xb362('0x9')](_0x184382,util['inspect'](_0x317340,{'showHidden':![],'depth':null}));};exports[_0xb362('0xa')]=function(_0x42f532,_0x508c77){logger[_0xb362('0xb')](_0x42f532,util[_0xb362('0x7')](_0x508c77,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2e4c79){return function(_0x5dc767){logger[_0xb362('0x9')](_0x2e4c79,util[_0xb362('0x7')](_0x5dc767,{'showHidden':![],'depth':null}));};};exports[_0xb362('0xc')]=function(_0x3055be,_0x440c1a,_0x3122b3){return{'message':_0x3055be,'unlock':_0x440c1a,'active':_0x3122b3};};exports[_0xb362('0xd')]=function(_0x3fc871,_0x48fee8,_0x1f7b62){if(!_[_0xb362('0xe')](_0x1f7b62)&&_0xb362('0xf')===typeof _0x1f7b62&&!_['isEmpty'](_0x1f7b62)){if(!_['isUndefined'](_0x48fee8)&&_0xb362('0xf')===typeof _0x48fee8&&!_[_0xb362('0x10')](_0x48fee8)){return util[_0xb362('0x11')](_0xb362('0x12'),_0x48fee8,_0x1f7b62);}return util[_0xb362('0x11')](_0xb362('0x12'),_0x1f7b62,_0x1f7b62);}if(!_[_0xb362('0xe')](_0x3fc871)&&_0xb362('0xf')===typeof _0x3fc871&&!_[_0xb362('0x10')](_0x3fc871)){return _0x3fc871;}return _0xb362('0x13');};exports[_0xb362('0x14')]=function(_0x41a691){if(_['isNil'](_0x41a691)){return![];}return _0x41a691;};exports['addVariables']=function(_0x1e62cb,_0xb86a24,_0x1dc897,_0x5e3c53,_0x3e95b0,_0x49e561){var _0x46f836={'XMD-QUEUE':_0xb86a24['Queue']?_0xb86a24[_0xb362('0x15')][_0xb362('0x16')]:'','XMD-CALLERID':_0x5e3c53,'XMD-CALLERID-PREVIEW':_0x49e561?util[_0xb362('0x11')](_0xb362('0x12'),_0x49e561[_0xb362('0x17')],_0x49e561[_0xb362('0x18')]):_0x5e3c53,'XMD-DIALID':_0x3e95b0,'XMD-CONTACTID':_0xb86a24[_0xb362('0x19')],'XMD-CDRTYPE':_0xb362('0x1a'),'CALLERID(all)':_0x5e3c53,'XMD-VOICEQUEUEID':_0xb86a24[_0xb362('0x1b')],'XMD-DIALCHANNEL':_0x1dc897,'XMD-DIALTIMEOUT':_0x1e62cb['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xb362('0x11')](_0xb362('0x1c'),_0x1e62cb['dialQueueProject2']?'g':'',_[_0xb362('0x10')](_0x1e62cb[_0xb362('0x1d')])?'':_0xb362('0x1e')),'XMD-DIALURL':_0x1e62cb[_0xb362('0x1f')]||'','XMD-AGI':_0x1e62cb[_0xb362('0x20')]?util[_0xb362('0x11')](_0xb362('0x21'),ipAgi,_0x1e62cb['dialQueueProject']):_0xb362('0x22'),'XMD-AGIAFTER':_0x1e62cb['dialQueueProject2']?util[_0xb362('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1e62cb[_0xb362('0x23')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x49e561?_0x49e561[_0xb362('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x49e561?_0x49e561['originatecalleridname']:'','XMD-DESTINATION':_0xb362('0x25')};if(!_[_0xb362('0x10')](_0x1e62cb[_0xb362('0x1d')])){_0x46f836[util[_0xb362('0x11')]('%s',_0xb362('0x26'))]=_0x1e62cb[_0xb362('0x1d')];_0x46f836[util['format']('%s',_0xb362('0x27'))]=_0x3e95b0;}if(_0xb86a24&&_0xb86a24[_0xb362('0x28')]){for(var _0x44fd3f in _0xb86a24['Contact']){if(_0xb86a24[_0xb362('0x28')]['hasOwnProperty'](_0x44fd3f)){if(!_['isNil'](_0xb86a24[_0xb362('0x28')][_0x44fd3f])&&_0x44fd3f!=='id'&&_0x44fd3f!=='tags'&&_0x44fd3f!==_0xb362('0x29')&&_0x44fd3f!==_0xb362('0x2a')){_0x46f836[util['format'](_0xb362('0x2b'),_0xb362('0x2c'),_[_0xb362('0x2d')](_0x44fd3f))]=_0xb86a24['Contact'][_0x44fd3f];}}}}return _0x46f836;};exports[_0xb362('0x2e')]=function(_0x276ae4){var _0x29915c={};for(var _0x2a4fd9 in _0x276ae4){if(_0x276ae4[_0xb362('0x2f')](_0x2a4fd9)){_0x29915c[util[_0xb362('0x11')]('%s',_[_0xb362('0x30')](_0x2a4fd9))]=_0x276ae4[_0x2a4fd9];}}return{'variables':_0x29915c};};exports[_0xb362('0x31')]=function(_0x132878,_0x53b790){if(!_[_0xb362('0x32')](_0x132878)){if(_0x132878[_0xb362('0x2f')](_0xb362('0x33'))){if(_0x132878['originated']>0x0){_0x132878['originated']-=0x1;}else{logger[_0xb362('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x53b790);}}}else{logger['error'](_0xb362('0x34'),_0x53b790);}};exports[_0xb362('0x35')]=function(_0x147141){var _0x3dddc3=moment()[_0xb362('0x11')](_0xb362('0x36'));_0x147141[_0xb362('0x37')]=0xd;_0x147141[_0xb362('0x38')]=_0xb362('0x39');_0x147141[_0xb362('0x3a')]=_0x3dddc3;_0x147141[_0xb362('0x3b')]=_0x3dddc3;_0x147141['endtime']=_0x3dddc3;};exports[_0xb362('0x3c')]=function(_0x46bbde,_0x274670,_0x3ff8fe){var _0x21da09=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x46bbde[_0xb362('0x37')]=_0x274670;_0x46bbde[_0xb362('0x38')]=_0x3ff8fe;_0x46bbde[_0xb362('0x3b')]=_0x21da09;_0x46bbde[_0xb362('0x3d')]=getSeconds(_0x46bbde[_0xb362('0x3b')],_0x46bbde[_0xb362('0x3a')]);};exports[_0xb362('0x3e')]=function(_0x4163bb,_0x47becc,_0x14199c){_0x4163bb[_0xb362('0x3f')]=_0x47becc;_0x4163bb[_0xb362('0x40')]=_0x14199c;};exports[_0xb362('0x41')]=function(_0x190b64,_0x3744b6,_0x3bbc91){var _0x4dc723=moment()['format'](_0xb362('0x36'));_0x190b64[_0xb362('0x37')]=_0x3744b6;_0x190b64[_0xb362('0x38')]=_0x3bbc91;_0x190b64[_0xb362('0x3b')]=_0x190b64['responsetime']?_0x190b64[_0xb362('0x3b')]:_0x4dc723;_0x190b64[_0xb362('0x42')]=_0x190b64['endtime']?_0x190b64[_0xb362('0x42')]:_0x4dc723;_0x190b64[_0xb362('0x3d')]=getSeconds(_0x190b64['responsetime']||0x0,_0x190b64[_0xb362('0x3a')]||0x0);_0x190b64[_0xb362('0x43')]=_0x190b64['answertime']?getSeconds(_0x190b64[_0xb362('0x42')],_0x190b64[_0xb362('0x44')]):0x0;};exports[_0xb362('0x45')]=function(_0x232dba){return _0x232dba===_0xb362('0x46');};exports['variablesAction']=function(_0xf1f4c6,_0x30d96c,_0x15b92a,_0xd869ca,_0x2723ee){var _0x3253c3=_0xd869ca?_0xb362('0x47'):_0xf1f4c6['calleridname'];_0x3253c3=_0x2723ee?_0xb362('0x48'):_0x3253c3;return{'actionid':_0xf1f4c6[_0xb362('0x49')],'action':_0xb362('0x4a'),'channel':_0xf1f4c6[_0xb362('0x4b')],'callerid':util[_0xb362('0x11')](_0xb362('0x12'),_0x3253c3,_0xf1f4c6['calleridnum']),'Exten':_0xb362('0x25'),'Context':_0xb362('0x4c'),'Priority':'1','variable':_0x15b92a,'timeout':(_0x30d96c[_0xb362('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0xf1f4c6['uniqueid']};};exports['totalGlobal']=function(_0xf85f2d){return _0xf85f2d['countbusyretry']+_0xf85f2d['countcongestionretry']+_0xf85f2d[_0xb362('0x4e')];};exports[_0xb362('0x4f')]=function(_0x2c4af1){var _0x43902d=_['clone'](_0x2c4af1);_0x43902d[_0xb362('0x37')]=0xf;_0x43902d[_0xb362('0x38')]='Global';return _0x43902d;};exports[_0xb362('0x50')]=function(_0x5ed9a6,_0x1172b6,_0x245e6f){var _0x5160a2={};_0x5160a2[_0x1172b6]=_0x5ed9a6[_0x1172b6];_0x5160a2[_0xb362('0x51')]=![];_0x5160a2[_0xb362('0x52')]=moment()[_0xb362('0x53')](_0x245e6f,'minutes')[_0xb362('0x11')](_0xb362('0x36'));_0x5160a2[_0xb362('0x19')]=_0x5ed9a6[_0xb362('0x19')];_0x5160a2[_0xb362('0x54')]=_0x5ed9a6[_0xb362('0x54')];_0x5160a2[_0xb362('0x1b')]=_0x5ed9a6['VoiceQueueId']||undefined;return _0x5160a2;};exports[_0xb362('0x55')]=function(_0xe934c2,_0x176bfa){if(!_['isNil'](_0xe934c2)){if(_0xe934c2[_0xb362('0x56')]>0x0){_0xe934c2[_0xb362('0x56')]-=0x1;}else{logger[_0xb362('0xb')](_0x176bfa,_0xb362('0x57'));}}else{logger['error'](_0x176bfa,_0xb362('0x58'));}};exports[_0xb362('0x59')]=function(_0x3c40a6){if(_0x3c40a6<=0x0){return!![];}return![];};exports[_0xb362('0x5a')]=function(_0x26484b,_0x383984){_0x26484b['lastevent']=_0x383984;_0x26484b[_0xb362('0x16')]=_0x26484b[_0xb362('0x5b')];_0x26484b[_0xb362('0x5c')]=_0x26484b[_0xb362('0x4b')];return _0x26484b;};exports[_0xb362('0x5d')]=function(_0x492429){var _0x26f2fe={};_0x26f2fe['queue']=_0x492429[_0xb362('0x5b')];_0x26f2fe['interface']=_0x492429['channelAgent'];_0x26f2fe[_0xb362('0x49')]=_0x492429[_0xb362('0x49')];return _0x26f2fe;};exports['agentReadyId']=function(_0x40c083){var _0x1901cf=[];for(var _0x41521b in _0x40c083){if(_0x40c083['hasOwnProperty'](_0x41521b)){if(!_[_0xb362('0x32')](_0x40c083[_0x41521b])&&_0x40c083[_0x41521b][_0xb362('0x37')]===_0xb362('0x5e')&&_0x40c083[_0x41521b][_0xb362('0x5f')]===_0xb362('0x60')){_0x1901cf[_0xb362('0x61')](_0x40c083[_0x41521b]['id']);}}}return _0x1901cf;};exports[_0xb362('0x62')]=function(_0x55695f){var _0x3416e0=moment()[_0xb362('0x4')](0x0);var _0x4200f9=moment(_0x55695f)[_0xb362('0x4')](0x0);return _0x3416e0[_0xb362('0x63')](_0x4200f9,_0xb362('0x5'));};exports[_0xb362('0x64')]=function(_0x1732e1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1732e1['ContactId'],'ListId':_0x1732e1['ListId'],'VoiceQueueId':_0x1732e1[_0xb362('0x1b')]||undefined,'CampaignId':_0x1732e1['CampaignId']||undefined};};exports[_0xb362('0x65')]=function(_0x1adb70){if(_0x1adb70===_0xb362('0x49')||_0x1adb70===_0xb362('0x66')||_0x1adb70===_0xb362('0x5b')||_0x1adb70===_0xb362('0x67')||_0x1adb70===_0xb362('0x68')||_0x1adb70===_0xb362('0x69')||_0x1adb70===_0xb362('0x3f')||_0x1adb70===_0xb362('0x4b')||_0x1adb70===_0xb362('0x17')||_0x1adb70===_0xb362('0x51')||_0x1adb70===_0xb362('0x18')||_0x1adb70==='scheduledat'||_0x1adb70===_0xb362('0x6a')||_0x1adb70===_0xb362('0x6b')||_0x1adb70===_0xb362('0x4e')||_0x1adb70==='countglobal'||_0x1adb70===_0xb362('0x6c')||_0x1adb70===_0xb362('0x6d')||_0x1adb70===_0xb362('0x6e')||_0x1adb70===_0xb362('0x6f')||_0x1adb70===_0xb362('0x19')||_0x1adb70===_0xb362('0x54')||_0x1adb70===_0xb362('0x40')||_0x1adb70===_0xb362('0x1b')||_0x1adb70===_0xb362('0x70')||_0x1adb70===_0xb362('0x71')||_0x1adb70==='xmd-queue'||_0x1adb70==='xmd-phone'||_0x1adb70===_0xb362('0x72')||_0x1adb70===_0xb362('0x73')||_0x1adb70===_0xb362('0x74')||_0x1adb70===_0xb362('0x75')||_0x1adb70==='xmd-dialid'||_0x1adb70===_0xb362('0x76')||_0x1adb70===_0xb362('0x77')||_0x1adb70===_0xb362('0x78')||_0x1adb70===_0xb362('0x79')||_0x1adb70===_0xb362('0x7a')||_0x1adb70==='xmd-agi'||_0x1adb70===_0xb362('0x7b')||_0x1adb70===_0xb362('0x7c')||_0x1adb70===_0xb362('0x7d')||_0x1adb70===_0xb362('0x7e')||_0x1adb70==='rtpaudioqosloss'||_0x1adb70==='rtpaudioqoslossbridged'||_0x1adb70===_0xb362('0x7f')||_0x1adb70===_0xb362('0x80')||_0x1adb70===_0xb362('0x7b')||_0x1adb70==='rtpaudioqosbridged'||_0x1adb70==='rtpaudioqosjitter'||_0x1adb70===_0xb362('0x7e')||_0x1adb70==='rtpaudioqosloss'||_0x1adb70==='rtpaudioqoslossbridged'||_0x1adb70==='rtpaudioqosrtt'||_0x1adb70===_0xb362('0x80')||_0x1adb70==='bridgepeer'||_0x1adb70==='bridgepvtcallid'||_0x1adb70==='state'||_0x1adb70===_0xb362('0x38')){return![];}return!![];};exports[_0xb362('0x81')]=function(_0x27259d,_0x53f81c){var _0x3d43f1,_0x12aab7,_0x18ff88;if(_0x53f81c<=0x0){_0x53f81c=0x1;}_0x3d43f1=new RegExp('\x5cw{0,'+_0x53f81c+'}$');_0x12aab7=Math[_0xb362('0x82')](0xa,_0x53f81c-0x1);_0x18ff88=Math[_0xb362('0x82')](0xa,_0x53f81c)-0x1;return util[_0xb362('0x11')]('%s',_[_0xb362('0x83')](_0x27259d,_0x3d43f1,_[_0xb362('0x84')](_0x12aab7,_0x18ff88)));};exports[_0xb362('0x85')]=function(_0x76c19a){var _0x5936d2=_0x76c19a['match'](/"(.*?)"/);return _0x5936d2?_0x5936d2[0x1]:_0x76c19a;};exports[_0xb362('0x86')]=function(_0x96f6){var _0x2af90e=_0x96f6[_0xb362('0x87')](/<(.*?)>/);return _0x2af90e?_0x2af90e[0x1]:_0x96f6;}; \ No newline at end of file +var _0x7cac=['xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridNumber','match','util','moment','../../../../config/logger','env','milliseconds','diff','seconds','error','logger','inspect','loggerError','info','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','endtime','logAgent','responsetime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','channelAgent','buildAcw','not_inuse','status','reachable','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid'];(function(_0x34ea22,_0x1270b3){var _0x1ca470=function(_0xf63cf4){while(--_0xf63cf4){_0x34ea22['push'](_0x34ea22['shift']());}};_0x1ca470(++_0x1270b3);}(_0x7cac,0x1a9));var _0xc7ca=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7cac[_0x17b6e3];return _0x3906f3;};'use strict';var util=require(_0xc7ca('0x0'));var _=require('lodash');var moment=require(_0xc7ca('0x1'));var logger=require(_0xc7ca('0x2'))('preview');var ipAgi=process[_0xc7ca('0x3')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x1e38ca,_0x41964e){var _0x4a1d72=moment(_0x1e38ca)[_0xc7ca('0x4')](0x0);var _0x52a6c8=moment(_0x41964e)[_0xc7ca('0x4')](0x0);return _0x4a1d72[_0xc7ca('0x5')](_0x52a6c8,_0xc7ca('0x6'));}exports['loggerCatch']=function(_0x3012a7){return function(_0x567a4e){logger[_0xc7ca('0x7')](_0x3012a7,util['inspect'](_0x567a4e,{'showHidden':![],'depth':null}));};};exports[_0xc7ca('0x8')]=function(_0x4a4b4e,_0xfb1ec1){logger['info'](_0x4a4b4e,util[_0xc7ca('0x9')](_0xfb1ec1,{'showHidden':![],'depth':null}));};exports[_0xc7ca('0xa')]=function(_0x115903,_0x17b16e){logger['error'](_0x115903,util['inspect'](_0x17b16e,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x551e5d){return function(_0x27392d){logger[_0xc7ca('0xb')](_0x551e5d,util[_0xc7ca('0x9')](_0x27392d,{'showHidden':![],'depth':null}));};};exports[_0xc7ca('0xc')]=function(_0x967e9a,_0x17e2d7,_0x3f64a7){return{'message':_0x967e9a,'unlock':_0x17e2d7,'active':_0x3f64a7};};exports[_0xc7ca('0xd')]=function(_0xb959f8,_0x25f643,_0x3eb2f0){if(!_['isUndefined'](_0x3eb2f0)&&_0xc7ca('0xe')===typeof _0x3eb2f0&&!_['isEmpty'](_0x3eb2f0)){if(!_['isUndefined'](_0x25f643)&&'string'===typeof _0x25f643&&!_[_0xc7ca('0xf')](_0x25f643)){return util[_0xc7ca('0x10')](_0xc7ca('0x11'),_0x25f643,_0x3eb2f0);}return util[_0xc7ca('0x10')](_0xc7ca('0x11'),_0x3eb2f0,_0x3eb2f0);}if(!_[_0xc7ca('0x12')](_0xb959f8)&&_0xc7ca('0xe')===typeof _0xb959f8&&!_[_0xc7ca('0xf')](_0xb959f8)){return _0xb959f8;}return _0xc7ca('0x13');};exports[_0xc7ca('0x14')]=function(_0xdaf6a3){if(_[_0xc7ca('0x15')](_0xdaf6a3)){return![];}return _0xdaf6a3;};exports['addVariables']=function(_0x1efe26,_0x54634f,_0x1c2184,_0x4fa479,_0x400e84,_0x1aac2f){var _0x45f5f7={'XMD-QUEUE':_0x54634f[_0xc7ca('0x16')]?_0x54634f[_0xc7ca('0x16')][_0xc7ca('0x17')]:'','XMD-CALLERID':_0x4fa479,'XMD-CALLERID-PREVIEW':_0x1aac2f?util[_0xc7ca('0x10')](_0xc7ca('0x11'),_0x1aac2f['calleridname'],_0x1aac2f[_0xc7ca('0x18')]):_0x4fa479,'XMD-DIALID':_0x400e84,'XMD-CONTACTID':_0x54634f[_0xc7ca('0x19')],'XMD-CDRTYPE':_0xc7ca('0x1a'),'CALLERID(all)':_0x4fa479,'XMD-VOICEQUEUEID':_0x54634f[_0xc7ca('0x1b')],'XMD-DIALCHANNEL':_0x1c2184,'XMD-DIALTIMEOUT':_0x1efe26['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xc7ca('0x10')](_0xc7ca('0x1c'),_0x1efe26[_0xc7ca('0x1d')]?'g':'',_[_0xc7ca('0xf')](_0x1efe26['monitor_format'])?'':_0xc7ca('0x1e')),'XMD-DIALURL':_0x1efe26[_0xc7ca('0x1f')]||'','XMD-AGI':_0x1efe26[_0xc7ca('0x20')]?util[_0xc7ca('0x10')](_0xc7ca('0x21'),ipAgi,_0x1efe26[_0xc7ca('0x20')]):_0xc7ca('0x22'),'XMD-AGIAFTER':_0x1efe26[_0xc7ca('0x1d')]?util[_0xc7ca('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1efe26['dialQueueProject2']):_0xc7ca('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x1aac2f?_0x1aac2f[_0xc7ca('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x1aac2f?_0x1aac2f[_0xc7ca('0x24')]:'','XMD-DESTINATION':_0xc7ca('0x25')};if(!_[_0xc7ca('0xf')](_0x1efe26['monitor_format'])){_0x45f5f7[util[_0xc7ca('0x10')]('%s',_0xc7ca('0x26'))]=_0x1efe26['monitor_format'];_0x45f5f7[util[_0xc7ca('0x10')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x400e84;}if(_0x54634f&&_0x54634f[_0xc7ca('0x27')]){for(var _0x3504df in _0x54634f[_0xc7ca('0x27')]){if(_0x54634f[_0xc7ca('0x27')][_0xc7ca('0x28')](_0x3504df)){if(!_['isNil'](_0x54634f[_0xc7ca('0x27')][_0x3504df])&&_0x3504df!=='id'&&_0x3504df!==_0xc7ca('0x29')&&_0x3504df!==_0xc7ca('0x2a')&&_0x3504df!==_0xc7ca('0x2b')){_0x45f5f7[util['format'](_0xc7ca('0x2c'),'XMD-',_['toUpper'](_0x3504df))]=_0x54634f[_0xc7ca('0x27')][_0x3504df];}}}}return _0x45f5f7;};exports[_0xc7ca('0x2d')]=function(_0x119439){var _0x21c83b={};for(var _0x517708 in _0x119439){if(_0x119439[_0xc7ca('0x28')](_0x517708)){_0x21c83b[util['format']('%s',_[_0xc7ca('0x2e')](_0x517708))]=_0x119439[_0x517708];}}return{'variables':_0x21c83b};};exports[_0xc7ca('0x2f')]=function(_0x6378d8,_0x1793da){if(!_[_0xc7ca('0x15')](_0x6378d8)){if(_0x6378d8[_0xc7ca('0x28')](_0xc7ca('0x30'))){if(_0x6378d8[_0xc7ca('0x30')]>0x0){_0x6378d8[_0xc7ca('0x30')]-=0x1;}else{logger[_0xc7ca('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1793da);}}}else{logger[_0xc7ca('0x7')](_0xc7ca('0x31'),_0x1793da);}};exports['logBlacklist']=function(_0x37c87c){var _0x429257=moment()[_0xc7ca('0x10')](_0xc7ca('0x32'));_0x37c87c[_0xc7ca('0x33')]=0xd;_0x37c87c[_0xc7ca('0x34')]='Blacklist';_0x37c87c[_0xc7ca('0x35')]=_0x429257;_0x37c87c['responsetime']=_0x429257;_0x37c87c[_0xc7ca('0x36')]=_0x429257;};exports[_0xc7ca('0x37')]=function(_0x293fd7,_0x30b5e8,_0x505b58){var _0x447810=moment()[_0xc7ca('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x293fd7[_0xc7ca('0x33')]=_0x30b5e8;_0x293fd7['statedesc']=_0x505b58;_0x293fd7[_0xc7ca('0x38')]=_0x447810;_0x293fd7[_0xc7ca('0x39')]=getSeconds(_0x293fd7['responsetime'],_0x293fd7[_0xc7ca('0x35')]);};exports[_0xc7ca('0x3a')]=function(_0x2e09c2,_0x3df08a,_0x642756){_0x2e09c2[_0xc7ca('0x3b')]=_0x3df08a;_0x2e09c2[_0xc7ca('0x3c')]=_0x642756;};exports[_0xc7ca('0x3d')]=function(_0xc8c4d3,_0x12ff09,_0x48192f){var _0x19559d=moment()[_0xc7ca('0x10')](_0xc7ca('0x32'));_0xc8c4d3[_0xc7ca('0x33')]=_0x12ff09;_0xc8c4d3[_0xc7ca('0x34')]=_0x48192f;_0xc8c4d3['responsetime']=_0xc8c4d3[_0xc7ca('0x38')]?_0xc8c4d3[_0xc7ca('0x38')]:_0x19559d;_0xc8c4d3[_0xc7ca('0x36')]=_0xc8c4d3[_0xc7ca('0x36')]?_0xc8c4d3[_0xc7ca('0x36')]:_0x19559d;_0xc8c4d3[_0xc7ca('0x39')]=getSeconds(_0xc8c4d3[_0xc7ca('0x38')]||0x0,_0xc8c4d3['starttime']||0x0);_0xc8c4d3[_0xc7ca('0x3e')]=_0xc8c4d3['answertime']?getSeconds(_0xc8c4d3['endtime'],_0xc8c4d3[_0xc7ca('0x3f')]):0x0;};exports['isFailure']=function(_0x2dbd71){return _0x2dbd71===_0xc7ca('0x40');};exports[_0xc7ca('0x41')]=function(_0x17aae1,_0x191190,_0x3da449,_0x492a91,_0x467fea){var _0x37c356=_0x492a91?_0xc7ca('0x42'):_0x17aae1[_0xc7ca('0x43')];_0x37c356=_0x467fea?_0xc7ca('0x44'):_0x37c356;return{'actionid':_0x17aae1[_0xc7ca('0x45')],'action':'originate','channel':_0x17aae1['channelAgent'],'callerid':util[_0xc7ca('0x10')](_0xc7ca('0x11'),_0x37c356,_0x17aae1['calleridnum']),'Exten':_0xc7ca('0x25'),'Context':_0xc7ca('0x46'),'Priority':'1','variable':_0x3da449,'timeout':(_0x191190[_0xc7ca('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x17aae1[_0xc7ca('0x45')]};};exports[_0xc7ca('0x48')]=function(_0x372a8d){return _0x372a8d[_0xc7ca('0x49')]+_0x372a8d[_0xc7ca('0x4a')]+_0x372a8d[_0xc7ca('0x4b')];};exports[_0xc7ca('0x4c')]=function(_0x2fa56e){var _0x33a320=_[_0xc7ca('0x4d')](_0x2fa56e);_0x33a320[_0xc7ca('0x33')]=0xf;_0x33a320[_0xc7ca('0x34')]=_0xc7ca('0x4e');return _0x33a320;};exports[_0xc7ca('0x4f')]=function(_0x3f5b26,_0x22d321,_0x1fca8f){var _0x45d88a={};_0x45d88a[_0x22d321]=_0x3f5b26[_0x22d321];_0x45d88a[_0xc7ca('0x50')]=![];_0x45d88a[_0xc7ca('0x51')]=moment()[_0xc7ca('0x52')](_0x1fca8f,_0xc7ca('0x53'))['format'](_0xc7ca('0x32'));_0x45d88a[_0xc7ca('0x19')]=_0x3f5b26['ContactId'];_0x45d88a[_0xc7ca('0x54')]=_0x3f5b26[_0xc7ca('0x54')];_0x45d88a[_0xc7ca('0x1b')]=_0x3f5b26[_0xc7ca('0x1b')]||undefined;return _0x45d88a;};exports[_0xc7ca('0x55')]=function(_0x422c5f,_0x35b88a){if(!_[_0xc7ca('0x15')](_0x422c5f)){if(_0x422c5f[_0xc7ca('0x56')]>0x0){_0x422c5f[_0xc7ca('0x56')]-=0x1;}else{logger[_0xc7ca('0x7')](_0x35b88a,_0xc7ca('0x57'));}}else{logger[_0xc7ca('0x7')](_0x35b88a,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xc7ca('0x58')]=function(_0x3472b8){if(_0x3472b8<=0x0){return!![];}return![];};exports['buildObj']=function(_0x345060,_0x32c238){_0x345060[_0xc7ca('0x59')]=_0x32c238;_0x345060[_0xc7ca('0x17')]=_0x345060[_0xc7ca('0x5a')];_0x345060[_0xc7ca('0x5b')]=_0x345060[_0xc7ca('0x5c')];return _0x345060;};exports[_0xc7ca('0x5d')]=function(_0xe95456){var _0x56dcaa={};_0x56dcaa[_0xc7ca('0x5a')]=_0xe95456[_0xc7ca('0x5a')];_0x56dcaa[_0xc7ca('0x5b')]=_0xe95456[_0xc7ca('0x5c')];_0x56dcaa[_0xc7ca('0x45')]=_0xe95456['uniqueid'];return _0x56dcaa;};exports['agentReadyId']=function(_0xdeaa66){var _0x35d66e=[];for(var _0xb13657 in _0xdeaa66){if(_0xdeaa66[_0xc7ca('0x28')](_0xb13657)){if(!_[_0xc7ca('0x15')](_0xdeaa66[_0xb13657])&&_0xdeaa66[_0xb13657][_0xc7ca('0x33')]===_0xc7ca('0x5e')&&_0xdeaa66[_0xb13657][_0xc7ca('0x5f')]===_0xc7ca('0x60')){_0x35d66e[_0xc7ca('0x61')](_0xdeaa66[_0xb13657]['id']);}}}return _0x35d66e;};exports[_0xc7ca('0x62')]=function(_0x12daa3){var _0x3973e2=moment()[_0xc7ca('0x4')](0x0);var _0x5661f7=moment(_0x12daa3)[_0xc7ca('0x4')](0x0);return _0x3973e2[_0xc7ca('0x5')](_0x5661f7,_0xc7ca('0x6'));};exports['createBody']=function(_0x28e12b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x28e12b[_0xc7ca('0x19')],'ListId':_0x28e12b[_0xc7ca('0x54')],'VoiceQueueId':_0x28e12b[_0xc7ca('0x1b')]||undefined,'CampaignId':_0x28e12b[_0xc7ca('0x63')]||undefined};};exports[_0xc7ca('0x64')]=function(_0x2ef684){if(_0x2ef684==='uniqueid'||_0x2ef684===_0xc7ca('0x65')||_0x2ef684===_0xc7ca('0x5a')||_0x2ef684===_0xc7ca('0x66')||_0x2ef684===_0xc7ca('0x67')||_0x2ef684===_0xc7ca('0x68')||_0x2ef684===_0xc7ca('0x3b')||_0x2ef684===_0xc7ca('0x5c')||_0x2ef684===_0xc7ca('0x43')||_0x2ef684===_0xc7ca('0x50')||_0x2ef684===_0xc7ca('0x18')||_0x2ef684===_0xc7ca('0x51')||_0x2ef684==='countbusyretry'||_0x2ef684===_0xc7ca('0x4a')||_0x2ef684===_0xc7ca('0x4b')||_0x2ef684===_0xc7ca('0x69')||_0x2ef684===_0xc7ca('0x6a')||_0x2ef684==='callbackuniqueid'||_0x2ef684==='callbackat'||_0x2ef684===_0xc7ca('0x6b')||_0x2ef684===_0xc7ca('0x19')||_0x2ef684===_0xc7ca('0x54')||_0x2ef684===_0xc7ca('0x3c')||_0x2ef684===_0xc7ca('0x1b')||_0x2ef684===_0xc7ca('0x6c')||_0x2ef684==='xmd-voicequeueid'||_0x2ef684===_0xc7ca('0x6d')||_0x2ef684===_0xc7ca('0x6e')||_0x2ef684===_0xc7ca('0x6f')||_0x2ef684===_0xc7ca('0x70')||_0x2ef684===_0xc7ca('0x71')||_0x2ef684==='xmd-dialoptions'||_0x2ef684===_0xc7ca('0x72')||_0x2ef684===_0xc7ca('0x73')||_0x2ef684===_0xc7ca('0x74')||_0x2ef684===_0xc7ca('0x75')||_0x2ef684===_0xc7ca('0x76')||_0x2ef684===_0xc7ca('0x77')||_0x2ef684===_0xc7ca('0x78')||_0x2ef684==='rtpaudioqos'||_0x2ef684===_0xc7ca('0x79')||_0x2ef684===_0xc7ca('0x7a')||_0x2ef684==='rtpaudioqosjitterbridged'||_0x2ef684===_0xc7ca('0x7b')||_0x2ef684===_0xc7ca('0x7c')||_0x2ef684===_0xc7ca('0x7d')||_0x2ef684==='rtpaudioqosrttbridged'||_0x2ef684===_0xc7ca('0x7e')||_0x2ef684===_0xc7ca('0x79')||_0x2ef684==='rtpaudioqosjitter'||_0x2ef684===_0xc7ca('0x7f')||_0x2ef684===_0xc7ca('0x7b')||_0x2ef684===_0xc7ca('0x7c')||_0x2ef684===_0xc7ca('0x7d')||_0x2ef684===_0xc7ca('0x80')||_0x2ef684==='bridgepeer'||_0x2ef684===_0xc7ca('0x81')||_0x2ef684===_0xc7ca('0x33')||_0x2ef684===_0xc7ca('0x34')){return![];}return!![];};exports[_0xc7ca('0x82')]=function(_0x1bdd10,_0x3cc9c0){var _0x144b98,_0x6036f6,_0x4222e6;if(_0x3cc9c0<=0x0){_0x3cc9c0=0x1;}_0x144b98=new RegExp(_0xc7ca('0x83')+_0x3cc9c0+'}$');_0x6036f6=Math[_0xc7ca('0x84')](0xa,_0x3cc9c0-0x1);_0x4222e6=Math[_0xc7ca('0x84')](0xa,_0x3cc9c0)-0x1;return util['format']('%s',_['replace'](_0x1bdd10,_0x144b98,_[_0xc7ca('0x85')](_0x6036f6,_0x4222e6)));};exports['extractCalleridName']=function(_0x8123cb){var _0x57c3df=_0x8123cb['match'](/"(.*?)"/);return _0x57c3df?_0x57c3df[0x1]:_0x8123cb;};exports[_0xc7ca('0x86')]=function(_0x5daee5){var _0x5c319d=_0x5daee5[_0xc7ca('0x87')](/<(.*?)>/);return _0x5c319d?_0x5c319d[0x1]:_0x5daee5;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 4af68b4..b041f1e 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 _0x0dee=['string','boolean','queueremove','queuepause','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0dee,0xf7));var _0xe0de=function(_0x26edd6,_0x2ce3dc){_0x26edd6=_0x26edd6-0x0;var _0x46dc22=_0x0dee[_0x26edd6];return _0x46dc22;};'use strict';exports[_0xe0de('0x0')]={'queue':{'type':_0xe0de('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xe0de('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xe0de('0x2'),'required':![]}};exports[_0xe0de('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xe0de('0x1'),'required':!![]}};exports[_0xe0de('0x4')]={'interface':{'type':_0xe0de('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xe0de('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xe0de('0x1'),'required':![]}};exports[_0xe0de('0x5')]={'uniqueid':{'type':_0xe0de('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xe0de('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xe0de('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xe0de('0x6')]={'uniqueid':{'type':_0xe0de('0x1'),'required':!![]}};exports[_0xe0de('0x7')]={'uniqueid':{'type':_0xe0de('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xe0de('0x1')}}; \ No newline at end of file +var _0x0f9f=['queueremove','queuepause','reload','voicechannel','voicequeuechannelredirect','string','boolean'];(function(_0x34311c,_0x52a317){var _0x4b8b35=function(_0x16888a){while(--_0x16888a){_0x34311c['push'](_0x34311c['shift']());}};_0x4b8b35(++_0x52a317);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x3ee4bc,_0x55538c){_0x3ee4bc=_0x3ee4bc-0x0;var _0xd7e1d7=_0x0f9f[_0x3ee4bc];return _0xd7e1d7;};'use strict';exports['queueadd']={'queue':{'type':_0xf0f9('0x0'),'required':!![]},'interface':{'type':_0xf0f9('0x0'),'required':!![]},'membername':{'type':_0xf0f9('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xf0f9('0x1'),'required':![]}};exports[_0xf0f9('0x2')]={'queue':{'type':_0xf0f9('0x0'),'required':!![]},'interface':{'type':_0xf0f9('0x0'),'required':!![]}};exports[_0xf0f9('0x3')]={'interface':{'type':_0xf0f9('0x0'),'required':!![]},'paused':{'type':_0xf0f9('0x1')},'reason':{'type':_0xf0f9('0x0'),'required':![]}};exports[_0xf0f9('0x4')]={'module':{'type':_0xf0f9('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xf0f9('0x0'),'required':!![]}};exports[_0xf0f9('0x5')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xf0f9('0x0')},'format':{'type':_0xf0f9('0x0')},'mixmonitorid':{'type':_0xf0f9('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xf0f9('0x0'),'required':!![]}};exports[_0xf0f9('0x6')]={'uniqueid':{'type':_0xf0f9('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8c550f3..a8e1816 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 _0xab66=['../model/voiceQueue','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','faxAccounts','mapKeys','format','SIP/%s','name','isNil','interface','hasOwnProperty','total','answered','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','initVoiceCallReports','outbound','duration','ANSWERED','billableseconds','initCampaigns','campaigns','initVoiceExtensions','initFaxAccounts','exports','lodash','moment','../model/telephone','../model/trunk'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0xab66,0x17c));var _0x6ab6=function(_0x2d0690,_0x108966){_0x2d0690=_0x2d0690-0x0;var _0x345fac=_0xab66[_0x2d0690];return _0x345fac;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x6ab6('0x0'));var moment=require(_0x6ab6('0x1'));var Agent=require('../model/agent');var Telephone=require(_0x6ab6('0x2'));var Trunk=require(_0x6ab6('0x3'));var VoiceQueue=require(_0x6ab6('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x6ab6('0x5'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x6ab6('0x6'));var ZendeskAccount=require(_0x6ab6('0x7'));var SalesforceAccount=require(_0x6ab6('0x8'));var FreshdeskAccount=require(_0x6ab6('0x9'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x6ab6('0xa'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var FaxAccount=require(_0x6ab6('0xb'));var Realtime=function(){this[_0x6ab6('0xc')]={};this[_0x6ab6('0xd')]={};this[_0x6ab6('0xe')]={};this[_0x6ab6('0xf')]={};this['triggers']={};this['campaigns']={};this[_0x6ab6('0x10')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x6ab6('0x11')]={};this[_0x6ab6('0x12')]={};this[_0x6ab6('0x13')]={};this[_0x6ab6('0x14')]={};this[_0x6ab6('0x15')]={};this[_0x6ab6('0x16')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0x6ab6('0x17')]={};this[_0x6ab6('0x18')]={};this[_0x6ab6('0x19')]={};this[_0x6ab6('0x1a')]={};};function freeIsNotKey(_0x5d41fb,_0x22ecd2,_0xc0b132){var _0x4f5f22=_[_0x6ab6('0x1b')](_0x5d41fb,function(_0x4128e8,_0x21d344){return _0x4128e8[_0xc0b132];});for(var _0x5cd1f5 in _0x22ecd2){if(_0x22ecd2['hasOwnProperty'](_0x5cd1f5)){if(!_0x4f5f22[_0x5cd1f5]){delete _0x22ecd2[_0x5cd1f5];}}}}function freeIsNotKeySip(_0x4ee423,_0x2d78ec){var _0x49fa5a=_['mapKeys'](_0x4ee423,function(_0x3eef74,_0x2199cf){return util[_0x6ab6('0x1c')](_0x6ab6('0x1d'),_0x3eef74[_0x6ab6('0x1e')]);});for(var _0x4ab28c in _0x2d78ec){if(_0x2d78ec['hasOwnProperty'](_0x4ab28c)){if(!_0x49fa5a[_0x4ab28c]){delete _0x2d78ec[_0x4ab28c];}}}}function freeIsNotKeyAgent(_0x33f0cb,_0x221a91){var _0x3773e0=_[_0x6ab6('0x1b')](_0x33f0cb,function(_0x331cc5,_0x4f7811){var _0x50f277=_[_0x6ab6('0x1f')](_0x331cc5['interface'])?util[_0x6ab6('0x1c')]('SIP/%s',_0x331cc5[_0x6ab6('0x1e')]):_0x331cc5[_0x6ab6('0x20')];return _0x50f277;});for(var _0x831441 in _0x221a91){if(_0x221a91[_0x6ab6('0x21')](_0x831441)){if(!_0x3773e0[_0x831441]){delete _0x221a91[_0x831441];}}}}function clearVoiceCallReports(_0x5416d3){_0x5416d3[_0x6ab6('0x22')]=0x0;_0x5416d3[_0x6ab6('0x23')]=0x0;_0x5416d3['sumHoldTime']=0x0;_0x5416d3[_0x6ab6('0x24')]=0x0;_0x5416d3[_0x6ab6('0x25')]=0x0;}function clearCampaigns(_0x3aec7d){if(!_[_0x6ab6('0x26')](_0x3aec7d)){for(var _0x514d2b in _0x3aec7d){if(_0x3aec7d[_0x6ab6('0x21')](_0x514d2b)){_0x3aec7d[_0x514d2b]['ivrTotalCallsDays']=0x0;_0x3aec7d[_0x514d2b][_0x6ab6('0x27')]=0x0;}}}}function clearVoiceQueues(_0x461f87){if(!_['isEmpty'](_0x461f87)){for(var _0x5c7b75 in _0x461f87){if(_0x461f87[_0x6ab6('0x21')](_0x5c7b75)){_0x461f87[_0x5c7b75][_0x6ab6('0x22')]=0x0;_0x461f87[_0x5c7b75]['answered']=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x28')]=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x29')]=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x2a')]=0x0;_0x461f87[_0x5c7b75]['sumDuration']=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x25')]=0x0;_0x461f87[_0x5c7b75]['outboundAnswerAgiCallsDay']=0x0;_0x461f87[_0x5c7b75]['outboundNoAnswerCallsDay']=0x0;_0x461f87[_0x5c7b75]['outboundBusyCallsDay']=0x0;_0x461f87[_0x5c7b75]['outboundCongestionCallsDay']=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x2b')]=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x2c')]=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x2d')]=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x2e')]=0x0;_0x461f87[_0x5c7b75]['outboundBlacklistCallsDay']=0x0;_0x461f87[_0x5c7b75]['outboundOriginateFailureCallsDay']=0x0;_0x461f87[_0x5c7b75]['outboundRejectCallsDay']=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x2f')]=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x30')]=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x31')]=0x0;_0x461f87[_0x5c7b75][_0x6ab6('0x32')]=!![];}}}}Realtime[_0x6ab6('0x33')][_0x6ab6('0x34')]=function(_0x187686,_0x2dc819){for(var _0x29239d in _0x2dc819){if(_0x187686[_0x6ab6('0x21')](_0x29239d)){_0x187686[_0x29239d]=_0x2dc819[_0x29239d];}}};Realtime[_0x6ab6('0x33')][_0x6ab6('0x35')]=function(){var _0x22edee=this;return function(_0x1e65a2){if(_0x1e65a2){freeIsNotKeyAgent(_0x1e65a2,_0x22edee[_0x6ab6('0xc')]);for(var _0x587509=0x0,_0x45a3bd={},_0x3d1ec5={};_0x587509<_0x1e65a2[_0x6ab6('0x36')];_0x587509+=0x1){_0x45a3bd=_0x1e65a2[_0x587509];var _0x21b3a5=_[_0x6ab6('0x1f')](_0x45a3bd[_0x6ab6('0x20')])?util[_0x6ab6('0x1c')](_0x6ab6('0x1d'),_0x45a3bd[_0x6ab6('0x1e')]):_0x45a3bd[_0x6ab6('0x20')];if(_[_0x6ab6('0x37')](_0x22edee[_0x6ab6('0xc')][_0x21b3a5])){_0x22edee[_0x6ab6('0xc')][_0x21b3a5]=new Agent(_0x45a3bd);}else{_0x22edee[_0x6ab6('0x34')](_0x22edee['agents'][_0x21b3a5],_0x45a3bd);}}}return _0x22edee['agents'];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x38')]=function(){var _0x4d2cb6=this;return function(_0x35b4a8){if(_0x35b4a8){freeIsNotKeySip(_0x35b4a8,_0x4d2cb6['telephones']);for(var _0x28da36=0x0,_0xc54b45={},_0x22d6b1={};_0x28da36<_0x35b4a8['length'];_0x28da36+=0x1){_0xc54b45=_0x35b4a8[_0x28da36];if(_[_0x6ab6('0x37')](_0x4d2cb6['telephones'][util[_0x6ab6('0x1c')](_0x6ab6('0x1d'),_0xc54b45['name'])])){_0x4d2cb6[_0x6ab6('0xd')][util['format'](_0x6ab6('0x1d'),_0xc54b45[_0x6ab6('0x1e')])]=new Telephone(_0xc54b45);}else{_0x4d2cb6[_0x6ab6('0x34')](_0x4d2cb6[_0x6ab6('0xd')][util['format']('SIP/%s',_0xc54b45['name'])],_0xc54b45);}}}return _0x4d2cb6[_0x6ab6('0xd')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x39')]=function(){var _0x1dc27d=this;return function(_0x39d7ee){if(_0x39d7ee){freeIsNotKeySip(_0x39d7ee,_0x1dc27d[_0x6ab6('0xe')]);for(var _0x257064=0x0,_0x24b94a={},_0x28b66a={};_0x257064<_0x39d7ee[_0x6ab6('0x36')];_0x257064+=0x1){_0x24b94a=_0x39d7ee[_0x257064];if(_[_0x6ab6('0x37')](_0x1dc27d['trunks'][util['format'](_0x6ab6('0x1d'),_0x24b94a[_0x6ab6('0x1e')])])){_0x1dc27d[_0x6ab6('0xe')][util[_0x6ab6('0x1c')](_0x6ab6('0x1d'),_0x24b94a[_0x6ab6('0x1e')])]=new Trunk(_0x24b94a);}else{_0x1dc27d[_0x6ab6('0x34')](_0x1dc27d[_0x6ab6('0xe')][util[_0x6ab6('0x1c')]('SIP/%s',_0x24b94a[_0x6ab6('0x1e')])],_0x24b94a);}}}return _0x1dc27d[_0x6ab6('0xe')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x3a')]=function(){var _0xda48bd=this;return function(_0x1c35cd){if(_0x1c35cd){freeIsNotKey(_0x1c35cd,_0xda48bd[_0x6ab6('0xf')],'name');for(var _0x5a0c42=0x0,_0x1a21a0={},_0x2cf21a={};_0x5a0c42<_0x1c35cd[_0x6ab6('0x36')];_0x5a0c42+=0x1){_0x1a21a0=_0x1c35cd[_0x5a0c42];if(_['isUndefined'](_0xda48bd[_0x6ab6('0xf')][_0x1a21a0[_0x6ab6('0x1e')]])){_0xda48bd[_0x6ab6('0xf')][_0x1a21a0[_0x6ab6('0x1e')]]=new VoiceQueue(_0x1a21a0);}else{_0xda48bd['mergeFromDatabase'](_0xda48bd[_0x6ab6('0xf')][_0x1a21a0[_0x6ab6('0x1e')]],_0x1a21a0);}}}return _0xda48bd[_0x6ab6('0xf')];};};Realtime['prototype'][_0x6ab6('0x3b')]=function(){var _0x127eda=this;return function(_0x1ee78d){if(_0x1ee78d){freeIsNotKey(_0x1ee78d,_0x127eda['triggers'],'id');for(var _0x46a485=0x0,_0x4a4ccc={},_0x567dc9={};_0x46a485<_0x1ee78d[_0x6ab6('0x36')];_0x46a485+=0x1){_0x4a4ccc=_0x1ee78d[_0x46a485];if(_[_0x6ab6('0x37')](_0x127eda[_0x6ab6('0x3c')][_0x4a4ccc['id']])){_0x127eda[_0x6ab6('0x3c')][_0x4a4ccc['id']]=new Trigger(_0x4a4ccc);}else{_0x127eda[_0x6ab6('0x34')](_0x127eda[_0x6ab6('0x3c')][_0x4a4ccc['id']],_0x4a4ccc);}}}return _0x127eda[_0x6ab6('0x3c')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x3d')]=function(){var _0x1aa7f8=this;return function(_0x68a997){if(_0x68a997){freeIsNotKey(_0x68a997,_0x1aa7f8[_0x6ab6('0x10')],'id');for(var _0x1bc012=0x0,_0x3c9287={},_0xcc249c={};_0x1bc012<_0x68a997['length'];_0x1bc012+=0x1){_0x3c9287=_0x68a997[_0x1bc012];if(_[_0x6ab6('0x37')](_0x1aa7f8[_0x6ab6('0x10')][_0x3c9287['id']])){_0x1aa7f8['templates'][_0x3c9287['id']]=new Template(_0x3c9287);}else{_0x1aa7f8['mergeFromDatabase'](_0x1aa7f8[_0x6ab6('0x10')][_0x3c9287['id']],_0x3c9287);}}}return _0x1aa7f8[_0x6ab6('0x10')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x3e')]=function(){var _0x50434d=this;return function(_0x2fd7f9){if(_0x2fd7f9){freeIsNotKey(_0x2fd7f9,_0x50434d[_0x6ab6('0x16')],'id');for(var _0x2bdbc7=0x0,_0x26fe17={},_0x28a18e={};_0x2bdbc7<_0x2fd7f9[_0x6ab6('0x36')];_0x2bdbc7+=0x1){_0x26fe17=_0x2fd7f9[_0x2bdbc7];if(_[_0x6ab6('0x37')](_0x50434d[_0x6ab6('0x16')][_0x26fe17['id']])){_0x50434d[_0x6ab6('0x16')][_0x26fe17['id']]=new ZendeskAccount(_0x26fe17);}else{_0x50434d[_0x6ab6('0x34')](_0x50434d['zendeskAccounts'][_0x26fe17['id']],_0x26fe17);}}}return _0x50434d[_0x6ab6('0x16')];};};Realtime['prototype'][_0x6ab6('0x3f')]=function(){var _0x5575d0=this;return function(_0x3f974c){if(_0x3f974c){freeIsNotKey(_0x3f974c,_0x5575d0['salesforceAccounts'],'id');for(var _0x4079ae=0x0,_0xccda98={},_0xbbd531={};_0x4079ae<_0x3f974c[_0x6ab6('0x36')];_0x4079ae+=0x1){_0xccda98=_0x3f974c[_0x4079ae];if(_['isUndefined'](_0x5575d0[_0x6ab6('0x40')][_0xccda98['id']])){_0x5575d0[_0x6ab6('0x40')][_0xccda98['id']]=new SalesforceAccount(_0xccda98);}else{_0x5575d0[_0x6ab6('0x34')](_0x5575d0['salesforceAccounts'][_0xccda98['id']],_0xccda98);}}}return _0x5575d0[_0x6ab6('0x40')];};};Realtime[_0x6ab6('0x33')]['initFreshdeskAccounts']=function(){var _0x4788f3=this;return function(_0x500490){if(_0x500490){freeIsNotKey(_0x500490,_0x4788f3[_0x6ab6('0x41')],'id');for(var _0x5d3e53=0x0,_0x2ed3cd={},_0x848dfd={};_0x5d3e53<_0x500490['length'];_0x5d3e53+=0x1){_0x2ed3cd=_0x500490[_0x5d3e53];if(_[_0x6ab6('0x37')](_0x4788f3[_0x6ab6('0x41')][_0x2ed3cd['id']])){_0x4788f3[_0x6ab6('0x41')][_0x2ed3cd['id']]=new FreshdeskAccount(_0x2ed3cd);}else{_0x4788f3['mergeFromDatabase'](_0x4788f3['freshdeskAccounts'][_0x2ed3cd['id']],_0x2ed3cd);}}}return _0x4788f3['freshdeskAccounts'];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x42')]=function(){var _0x45249d=this;return function(_0x98490e){if(_0x98490e){freeIsNotKey(_0x98490e,_0x45249d['zohoAccounts'],'id');for(var _0x2942fd=0x0,_0x5a9ebc={},_0x1a35da={};_0x2942fd<_0x98490e[_0x6ab6('0x36')];_0x2942fd+=0x1){_0x5a9ebc=_0x98490e[_0x2942fd];if(_[_0x6ab6('0x37')](_0x45249d['zohoAccounts'][_0x5a9ebc['id']])){_0x45249d[_0x6ab6('0x17')][_0x5a9ebc['id']]=new ZohoAccount(_0x5a9ebc);}else{_0x45249d[_0x6ab6('0x34')](_0x45249d[_0x6ab6('0x17')][_0x5a9ebc['id']],_0x5a9ebc);}}}return _0x45249d['zohoAccounts'];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x43')]=function(){var _0x246cbe=this;return function(_0x11ece6){if(_0x11ece6){freeIsNotKey(_0x11ece6,_0x246cbe[_0x6ab6('0x18')],'id');for(var _0x16b8c9=0x0,_0x44c5ae={},_0x4fcac7={};_0x16b8c9<_0x11ece6['length'];_0x16b8c9+=0x1){_0x44c5ae=_0x11ece6[_0x16b8c9];if(_[_0x6ab6('0x37')](_0x246cbe[_0x6ab6('0x18')][_0x44c5ae['id']])){_0x246cbe[_0x6ab6('0x18')][_0x44c5ae['id']]=new DeskAccount(_0x44c5ae);}else{_0x246cbe[_0x6ab6('0x34')](_0x246cbe[_0x6ab6('0x18')][_0x44c5ae['id']],_0x44c5ae);}}}return _0x246cbe[_0x6ab6('0x18')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x44')]=function(){var _0x5b7ed6=this;return function(_0xffcc70){if(_0xffcc70){freeIsNotKey(_0xffcc70,_0x5b7ed6[_0x6ab6('0x45')],'id');for(var _0x272ba2=0x0,_0x15ca08={},_0x40ee7b={};_0x272ba2<_0xffcc70['length'];_0x272ba2+=0x1){_0x15ca08=_0xffcc70[_0x272ba2];if(_[_0x6ab6('0x37')](_0x5b7ed6[_0x6ab6('0x45')][_0x15ca08['id']])){_0x5b7ed6['sugarcrmAccounts'][_0x15ca08['id']]=new SugarcrmAccount(_0x15ca08);}else{_0x5b7ed6[_0x6ab6('0x34')](_0x5b7ed6[_0x6ab6('0x45')][_0x15ca08['id']],_0x15ca08);}}}return _0x5b7ed6[_0x6ab6('0x45')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x46')]=function(){var _0x5ed9cf=this;return function(_0x515aa3){if(_0x515aa3){freeIsNotKey(_0x515aa3,_0x5ed9cf[_0x6ab6('0x19')],'id');for(var _0x268e3c=0x0,_0xf8d8c8={},_0x11a3a0={};_0x268e3c<_0x515aa3[_0x6ab6('0x36')];_0x268e3c+=0x1){_0xf8d8c8=_0x515aa3[_0x268e3c];if(_['isUndefined'](_0x5ed9cf['vtigerAccounts'][_0xf8d8c8['id']])){_0x5ed9cf['vtigerAccounts'][_0xf8d8c8['id']]=new VtigerAccount(_0xf8d8c8);}else{_0x5ed9cf['mergeFromDatabase'](_0x5ed9cf[_0x6ab6('0x19')][_0xf8d8c8['id']],_0xf8d8c8);}}}return _0x5ed9cf[_0x6ab6('0x19')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x47')]=function(){var _0x481bb6=this;return function(_0x47df16){for(var _0x4c6594=0x0;_0x4c6594<_0x47df16[_0x6ab6('0x36')];_0x4c6594+=0x1){_[_0x6ab6('0x48')](_0x481bb6[_0x6ab6('0xf')][_0x47df16[_0x4c6594]['name']],_0x47df16[_0x4c6594]);}return _0x481bb6[_0x6ab6('0xf')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x49')]=function(){var _0x3a724c=this;return function(_0x36ba5b){clearVoiceQueues(_0x3a724c[_0x6ab6('0xf')]);if(_0x36ba5b){_0x36ba5b=_[_0x6ab6('0x4a')](_0x36ba5b,_0x6ab6('0x4b'));for(var _0x2c4959 in _0x36ba5b){if(_0x36ba5b[_0x6ab6('0x21')](_0x2c4959)){var _0x41ee25={};for(var _0x2bdcaf=0x0;_0x2bdcaf<_0x36ba5b[_0x2c4959]['length'];_0x2bdcaf+=0x1){var _0x7c42c4=_0x36ba5b[_0x2c4959][_0x2bdcaf][_0x6ab6('0x4c')];if(_0x3a724c[_0x6ab6('0xf')][_0x7c42c4]){if(_0x36ba5b[_0x2c4959][_0x2bdcaf]['queuecallerexit']){_0x3a724c[_0x6ab6('0xf')][_0x7c42c4][_0x6ab6('0x28')]+=0x1;}if(_0x36ba5b[_0x2c4959][_0x2bdcaf][_0x6ab6('0x4d')]){_0x3a724c[_0x6ab6('0xf')][_0x7c42c4][_0x6ab6('0x29')]+=0x1;}_0x3a724c[_0x6ab6('0xf')][_0x7c42c4]['sumHoldTime']+=moment(_0x36ba5b[_0x2c4959][_0x2bdcaf][_0x6ab6('0x4e')])['diff'](moment(_0x36ba5b[_0x2c4959][_0x2bdcaf][_0x6ab6('0x4f')]),_0x6ab6('0x50'))||0x0;if(_0x2bdcaf===_0x36ba5b[_0x2c4959][_0x6ab6('0x36')]-0x1){_0x3a724c['voiceQueues'][_0x7c42c4]['sumDuration']+=moment(_0x36ba5b[_0x2c4959][_0x2bdcaf][_0x6ab6('0x51')]||_0x36ba5b[_0x2c4959][_0x2bdcaf][_0x6ab6('0x52')]||_0x36ba5b[_0x2c4959][_0x2bdcaf][_0x6ab6('0x53')])[_0x6ab6('0x54')](moment(_0x36ba5b[_0x2c4959][_0x2bdcaf][_0x6ab6('0x4f')]),_0x6ab6('0x50'))||0x0;_0x3a724c[_0x6ab6('0xf')][_0x7c42c4][_0x6ab6('0x22')]+=0x1;if(_0x36ba5b[_0x2c4959][_0x2bdcaf][_0x6ab6('0x55')]){_0x3a724c['voiceQueues'][_0x7c42c4][_0x6ab6('0x23')]+=0x1;_0x3a724c[_0x6ab6('0xf')][_0x7c42c4][_0x6ab6('0x25')]+=moment(_0x36ba5b[_0x2c4959][_0x2bdcaf]['queuecallercompleteAt'])['diff'](moment(_0x36ba5b[_0x2c4959][_0x2bdcaf][_0x6ab6('0x4e')]),_0x6ab6('0x50'))||0x0;}}else{_0x3a724c[_0x6ab6('0xf')][_0x7c42c4][_0x6ab6('0x24')]+=_0x3a724c['voiceQueues'][_0x7c42c4][_0x6ab6('0x2a')]||0x0;}}}}}}return _0x3a724c[_0x6ab6('0xf')];};};Realtime['prototype'][_0x6ab6('0x56')]=function(){var _0x52aec1=this;return function(_0x5be238){clearVoiceCallReports(_0x52aec1[_0x6ab6('0x57')]);if(_0x5be238){for(var _0x3970cc=0x0;_0x3970cc<_0x5be238[_0x6ab6('0x36')];_0x3970cc+=0x1){_0x52aec1[_0x6ab6('0x57')]['total']+=0x1;_0x52aec1[_0x6ab6('0x57')][_0x6ab6('0x24')]+=_0x5be238[_0x3970cc][_0x6ab6('0x58')];if(_0x5be238[_0x3970cc]['disposition']===_0x6ab6('0x59')){_0x52aec1['outbound']['answered']+=0x1;_0x52aec1[_0x6ab6('0x57')][_0x6ab6('0x2a')]+=_0x5be238[_0x3970cc][_0x6ab6('0x58')]-_0x5be238[_0x3970cc][_0x6ab6('0x5a')]||0x0;_0x52aec1[_0x6ab6('0x57')]['sumBillable']+=_0x5be238[_0x3970cc][_0x6ab6('0x5a')];}}}return _0x52aec1[_0x6ab6('0x57')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x5b')]=function(){var _0x121e4f=this;return function(_0xf06e2d){if(_0xf06e2d){freeIsNotKey(_0xf06e2d,_0x121e4f['campaigns'],'name');for(var _0x4003d3=0x0,_0x24e193={};_0x4003d3<_0xf06e2d[_0x6ab6('0x36')];_0x4003d3+=0x1){_0x24e193=_0xf06e2d[_0x4003d3];if(_[_0x6ab6('0x37')](_0x121e4f[_0x6ab6('0x5c')][_0x24e193[_0x6ab6('0x1e')]])){_0x121e4f[_0x6ab6('0x5c')][_0x24e193[_0x6ab6('0x1e')]]=new Campaign(_0x24e193);}else{_0x121e4f['mergeFromDatabase'](_0x121e4f[_0x6ab6('0x5c')][_0x24e193['name']],_0x24e193);}}}return _0x121e4f[_0x6ab6('0x5c')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x5d')]=function(){var _0x171af4=this;return function(_0x326f38){if(_0x326f38){freeIsNotKey(_0x326f38,_0x171af4[_0x6ab6('0x11')],'id');for(var _0x247442=0x0,_0x2764df={};_0x247442<_0x326f38['length'];_0x247442+=0x1){_0x2764df=_0x326f38[_0x247442];if(_[_0x6ab6('0x37')](_0x171af4[_0x6ab6('0x11')][_0x2764df['id']])){_0x171af4[_0x6ab6('0x11')][_0x2764df['id']]=new VoiceExtension(_0x2764df);}else{_0x171af4['mergeFromDatabase'](_0x171af4[_0x6ab6('0x11')][_0x2764df['id']],_0x2764df);}}}return _0x171af4[_0x6ab6('0x11')];};};Realtime[_0x6ab6('0x33')]['initCampaignHopperHistory']=function(){var _0x5ca700=this;return function(_0x411364){clearCampaigns(_0x5ca700[_0x6ab6('0x5c')]);for(var _0x3c6718=0x0;_0x3c6718<_0x411364[_0x6ab6('0x36')];_0x3c6718+=0x1){_[_0x6ab6('0x48')](_0x5ca700[_0x6ab6('0x5c')][_0x411364[_0x3c6718]['name']],_0x411364[_0x3c6718]);}return _0x5ca700[_0x6ab6('0x5c')];};};Realtime[_0x6ab6('0x33')][_0x6ab6('0x5e')]=function(){var _0x4572de=this;return function(_0x2b8c1a){if(_0x2b8c1a){freeIsNotKey(_0x2b8c1a,_0x4572de[_0x6ab6('0x1a')],'id');for(var _0x147b37=0x0,_0x5a4ce6={},_0x526262={};_0x147b37<_0x2b8c1a[_0x6ab6('0x36')];_0x147b37+=0x1){_0x5a4ce6=_0x2b8c1a[_0x147b37];if(_['isUndefined'](_0x4572de[_0x6ab6('0x1a')][_0x5a4ce6['id']])){_0x4572de['faxAccounts'][_0x5a4ce6['id']]=new FaxAccount(_0x5a4ce6);}else{_0x4572de[_0x6ab6('0x34')](_0x4572de[_0x6ab6('0x1a')][_0x5a4ce6['id']],_0x5a4ce6);}}}return _0x4572de['faxAccounts'];};};module[_0x6ab6('0x5f')]=Realtime; \ No newline at end of file +var _0x63c8=['zohoAccounts','deskAccounts','vtigerAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','initTelephones','isUndefined','initTrunks','trunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x63c8,0x177));var _0x863c=function(_0x524c10,_0x42b298){_0x524c10=_0x524c10-0x0;var _0x311f85=_0x63c8[_0x524c10];return _0x311f85;};'use strict';var BPromise=require(_0x863c('0x0'));var util=require(_0x863c('0x1'));var _=require(_0x863c('0x2'));var moment=require(_0x863c('0x3'));var Agent=require(_0x863c('0x4'));var Telephone=require(_0x863c('0x5'));var Trunk=require(_0x863c('0x6'));var VoiceQueue=require(_0x863c('0x7'));var Trigger=require(_0x863c('0x8'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x863c('0x9'));var SalesforceAccount=require(_0x863c('0xa'));var FreshdeskAccount=require(_0x863c('0xb'));var SugarcrmAccount=require(_0x863c('0xc'));var ZohoAccount=require(_0x863c('0xd'));var DeskAccount=require(_0x863c('0xe'));var VtigerAccount=require(_0x863c('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x863c('0x10')]={};this[_0x863c('0x11')]={};this['trunks']={};this[_0x863c('0x12')]={};this[_0x863c('0x13')]={};this[_0x863c('0x14')]={};this[_0x863c('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x863c('0x16')]={};this[_0x863c('0x17')]={};this[_0x863c('0x18')]={};this[_0x863c('0x19')]={};this['timers']={};this[_0x863c('0x1a')]={};this[_0x863c('0x1b')]={};this[_0x863c('0x1c')]={};this['freshdeskAccounts']={};this[_0x863c('0x1d')]={};this[_0x863c('0x1e')]={};this[_0x863c('0x1f')]={};this[_0x863c('0x20')]={};};function freeIsNotKey(_0x3590d6,_0x3c0001,_0xda67c9){var _0x293f64=_[_0x863c('0x21')](_0x3590d6,function(_0x46d11c,_0x18021d){return _0x46d11c[_0xda67c9];});for(var _0x4ab372 in _0x3c0001){if(_0x3c0001['hasOwnProperty'](_0x4ab372)){if(!_0x293f64[_0x4ab372]){delete _0x3c0001[_0x4ab372];}}}}function freeIsNotKeySip(_0x5b110b,_0x10cab2){var _0x5a9384=_['mapKeys'](_0x5b110b,function(_0x386f1c,_0x48bfdb){return util['format']('SIP/%s',_0x386f1c[_0x863c('0x22')]);});for(var _0x47c362 in _0x10cab2){if(_0x10cab2[_0x863c('0x23')](_0x47c362)){if(!_0x5a9384[_0x47c362]){delete _0x10cab2[_0x47c362];}}}}function freeIsNotKeyAgent(_0x2383ca,_0x54af69){var _0x41a6a2=_[_0x863c('0x21')](_0x2383ca,function(_0x4c8ab0,_0x341a26){var _0x21a82f=_[_0x863c('0x24')](_0x4c8ab0[_0x863c('0x25')])?util[_0x863c('0x26')](_0x863c('0x27'),_0x4c8ab0[_0x863c('0x22')]):_0x4c8ab0[_0x863c('0x25')];return _0x21a82f;});for(var _0x2f6e72 in _0x54af69){if(_0x54af69[_0x863c('0x23')](_0x2f6e72)){if(!_0x41a6a2[_0x2f6e72]){delete _0x54af69[_0x2f6e72];}}}}function clearVoiceCallReports(_0x4ce8e2){_0x4ce8e2[_0x863c('0x28')]=0x0;_0x4ce8e2[_0x863c('0x29')]=0x0;_0x4ce8e2[_0x863c('0x2a')]=0x0;_0x4ce8e2[_0x863c('0x2b')]=0x0;_0x4ce8e2[_0x863c('0x2c')]=0x0;}function clearCampaigns(_0x32a75c){if(!_[_0x863c('0x2d')](_0x32a75c)){for(var _0x702cb2 in _0x32a75c){if(_0x32a75c[_0x863c('0x23')](_0x702cb2)){_0x32a75c[_0x702cb2][_0x863c('0x2e')]=0x0;_0x32a75c[_0x702cb2][_0x863c('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x4d738b){if(!_[_0x863c('0x2d')](_0x4d738b)){for(var _0x9d399b in _0x4d738b){if(_0x4d738b[_0x863c('0x23')](_0x9d399b)){_0x4d738b[_0x9d399b]['total']=0x0;_0x4d738b[_0x9d399b]['answered']=0x0;_0x4d738b[_0x9d399b][_0x863c('0x30')]=0x0;_0x4d738b[_0x9d399b]['abandoned']=0x0;_0x4d738b[_0x9d399b][_0x863c('0x2a')]=0x0;_0x4d738b[_0x9d399b][_0x863c('0x2b')]=0x0;_0x4d738b[_0x9d399b]['sumBillable']=0x0;_0x4d738b[_0x9d399b][_0x863c('0x31')]=0x0;_0x4d738b[_0x9d399b]['outboundNoAnswerCallsDay']=0x0;_0x4d738b[_0x9d399b][_0x863c('0x32')]=0x0;_0x4d738b[_0x9d399b][_0x863c('0x33')]=0x0;_0x4d738b[_0x9d399b]['outboundNoSuchCallsDay']=0x0;_0x4d738b[_0x9d399b][_0x863c('0x34')]=0x0;_0x4d738b[_0x9d399b][_0x863c('0x35')]=0x0;_0x4d738b[_0x9d399b][_0x863c('0x36')]=0x0;_0x4d738b[_0x9d399b][_0x863c('0x37')]=0x0;_0x4d738b[_0x9d399b][_0x863c('0x38')]=0x0;_0x4d738b[_0x9d399b][_0x863c('0x39')]=0x0;_0x4d738b[_0x9d399b][_0x863c('0x3a')]=0x0;_0x4d738b[_0x9d399b]['outboundAnswerAgiCallsDay']=0x0;_0x4d738b[_0x9d399b]['outboundAnswerCallsDay']=0x0;_0x4d738b[_0x9d399b][_0x863c('0x3b')]=!![];}}}}Realtime['prototype'][_0x863c('0x3c')]=function(_0x41a688,_0x4a0e3a){for(var _0x1cbfea in _0x4a0e3a){if(_0x41a688['hasOwnProperty'](_0x1cbfea)){_0x41a688[_0x1cbfea]=_0x4a0e3a[_0x1cbfea];}}};Realtime[_0x863c('0x3d')][_0x863c('0x3e')]=function(){var _0x4d45a2=this;return function(_0x500aa8){if(_0x500aa8){freeIsNotKeyAgent(_0x500aa8,_0x4d45a2[_0x863c('0x10')]);for(var _0x4c221f=0x0,_0x3f433a={},_0x542787={};_0x4c221f<_0x500aa8[_0x863c('0x3f')];_0x4c221f+=0x1){_0x3f433a=_0x500aa8[_0x4c221f];var _0xecfea3=_[_0x863c('0x24')](_0x3f433a[_0x863c('0x25')])?util[_0x863c('0x26')](_0x863c('0x27'),_0x3f433a[_0x863c('0x22')]):_0x3f433a['interface'];if(_['isUndefined'](_0x4d45a2[_0x863c('0x10')][_0xecfea3])){_0x4d45a2[_0x863c('0x10')][_0xecfea3]=new Agent(_0x3f433a);}else{_0x4d45a2['mergeFromDatabase'](_0x4d45a2['agents'][_0xecfea3],_0x3f433a);}}}return _0x4d45a2[_0x863c('0x10')];};};Realtime[_0x863c('0x3d')][_0x863c('0x40')]=function(){var _0x280880=this;return function(_0x57c3c3){if(_0x57c3c3){freeIsNotKeySip(_0x57c3c3,_0x280880[_0x863c('0x11')]);for(var _0xa9f95b=0x0,_0x1ccc67={},_0x4d6c83={};_0xa9f95b<_0x57c3c3[_0x863c('0x3f')];_0xa9f95b+=0x1){_0x1ccc67=_0x57c3c3[_0xa9f95b];if(_[_0x863c('0x41')](_0x280880[_0x863c('0x11')][util['format']('SIP/%s',_0x1ccc67[_0x863c('0x22')])])){_0x280880['telephones'][util[_0x863c('0x26')](_0x863c('0x27'),_0x1ccc67['name'])]=new Telephone(_0x1ccc67);}else{_0x280880[_0x863c('0x3c')](_0x280880['telephones'][util[_0x863c('0x26')](_0x863c('0x27'),_0x1ccc67[_0x863c('0x22')])],_0x1ccc67);}}}return _0x280880[_0x863c('0x11')];};};Realtime['prototype'][_0x863c('0x42')]=function(){var _0x593a1e=this;return function(_0x181005){if(_0x181005){freeIsNotKeySip(_0x181005,_0x593a1e[_0x863c('0x43')]);for(var _0x36903c=0x0,_0x5cd2e0={},_0x4ade15={};_0x36903c<_0x181005[_0x863c('0x3f')];_0x36903c+=0x1){_0x5cd2e0=_0x181005[_0x36903c];if(_[_0x863c('0x41')](_0x593a1e[_0x863c('0x43')][util['format']('SIP/%s',_0x5cd2e0[_0x863c('0x22')])])){_0x593a1e[_0x863c('0x43')][util[_0x863c('0x26')]('SIP/%s',_0x5cd2e0['name'])]=new Trunk(_0x5cd2e0);}else{_0x593a1e['mergeFromDatabase'](_0x593a1e[_0x863c('0x43')][util[_0x863c('0x26')](_0x863c('0x27'),_0x5cd2e0[_0x863c('0x22')])],_0x5cd2e0);}}}return _0x593a1e[_0x863c('0x43')];};};Realtime[_0x863c('0x3d')][_0x863c('0x44')]=function(){var _0x517afd=this;return function(_0x2a5cda){if(_0x2a5cda){freeIsNotKey(_0x2a5cda,_0x517afd['voiceQueues'],'name');for(var _0x116b02=0x0,_0xbf709a={},_0x2d1d8f={};_0x116b02<_0x2a5cda[_0x863c('0x3f')];_0x116b02+=0x1){_0xbf709a=_0x2a5cda[_0x116b02];if(_[_0x863c('0x41')](_0x517afd[_0x863c('0x12')][_0xbf709a['name']])){_0x517afd[_0x863c('0x12')][_0xbf709a['name']]=new VoiceQueue(_0xbf709a);}else{_0x517afd['mergeFromDatabase'](_0x517afd['voiceQueues'][_0xbf709a['name']],_0xbf709a);}}}return _0x517afd[_0x863c('0x12')];};};Realtime[_0x863c('0x3d')][_0x863c('0x45')]=function(){var _0x283afd=this;return function(_0x5cf24e){if(_0x5cf24e){freeIsNotKey(_0x5cf24e,_0x283afd[_0x863c('0x13')],'id');for(var _0x35c9c3=0x0,_0x561399={},_0x3b9f7c={};_0x35c9c3<_0x5cf24e['length'];_0x35c9c3+=0x1){_0x561399=_0x5cf24e[_0x35c9c3];if(_[_0x863c('0x41')](_0x283afd[_0x863c('0x13')][_0x561399['id']])){_0x283afd['triggers'][_0x561399['id']]=new Trigger(_0x561399);}else{_0x283afd[_0x863c('0x3c')](_0x283afd[_0x863c('0x13')][_0x561399['id']],_0x561399);}}}return _0x283afd[_0x863c('0x13')];};};Realtime['prototype'][_0x863c('0x46')]=function(){var _0x550aae=this;return function(_0x156a10){if(_0x156a10){freeIsNotKey(_0x156a10,_0x550aae[_0x863c('0x15')],'id');for(var _0x27ddae=0x0,_0x2f9c2d={},_0x571406={};_0x27ddae<_0x156a10['length'];_0x27ddae+=0x1){_0x2f9c2d=_0x156a10[_0x27ddae];if(_[_0x863c('0x41')](_0x550aae[_0x863c('0x15')][_0x2f9c2d['id']])){_0x550aae[_0x863c('0x15')][_0x2f9c2d['id']]=new Template(_0x2f9c2d);}else{_0x550aae['mergeFromDatabase'](_0x550aae['templates'][_0x2f9c2d['id']],_0x2f9c2d);}}}return _0x550aae['templates'];};};Realtime[_0x863c('0x3d')][_0x863c('0x47')]=function(){var _0x484528=this;return function(_0x4cd65e){if(_0x4cd65e){freeIsNotKey(_0x4cd65e,_0x484528[_0x863c('0x1a')],'id');for(var _0x97f7b3=0x0,_0x174510={},_0x2f3692={};_0x97f7b3<_0x4cd65e['length'];_0x97f7b3+=0x1){_0x174510=_0x4cd65e[_0x97f7b3];if(_[_0x863c('0x41')](_0x484528[_0x863c('0x1a')][_0x174510['id']])){_0x484528[_0x863c('0x1a')][_0x174510['id']]=new ZendeskAccount(_0x174510);}else{_0x484528['mergeFromDatabase'](_0x484528[_0x863c('0x1a')][_0x174510['id']],_0x174510);}}}return _0x484528['zendeskAccounts'];};};Realtime[_0x863c('0x3d')]['initSalesforceAccounts']=function(){var _0x49fe20=this;return function(_0x53dd49){if(_0x53dd49){freeIsNotKey(_0x53dd49,_0x49fe20[_0x863c('0x1b')],'id');for(var _0x2b3ee5=0x0,_0x48b8c3={},_0x498e9f={};_0x2b3ee5<_0x53dd49[_0x863c('0x3f')];_0x2b3ee5+=0x1){_0x48b8c3=_0x53dd49[_0x2b3ee5];if(_[_0x863c('0x41')](_0x49fe20['salesforceAccounts'][_0x48b8c3['id']])){_0x49fe20[_0x863c('0x1b')][_0x48b8c3['id']]=new SalesforceAccount(_0x48b8c3);}else{_0x49fe20[_0x863c('0x3c')](_0x49fe20['salesforceAccounts'][_0x48b8c3['id']],_0x48b8c3);}}}return _0x49fe20['salesforceAccounts'];};};Realtime[_0x863c('0x3d')][_0x863c('0x48')]=function(){var _0x1f0820=this;return function(_0x14038e){if(_0x14038e){freeIsNotKey(_0x14038e,_0x1f0820[_0x863c('0x49')],'id');for(var _0x3f1fad=0x0,_0x3f40d0={},_0x376a2a={};_0x3f1fad<_0x14038e[_0x863c('0x3f')];_0x3f1fad+=0x1){_0x3f40d0=_0x14038e[_0x3f1fad];if(_[_0x863c('0x41')](_0x1f0820['freshdeskAccounts'][_0x3f40d0['id']])){_0x1f0820[_0x863c('0x49')][_0x3f40d0['id']]=new FreshdeskAccount(_0x3f40d0);}else{_0x1f0820[_0x863c('0x3c')](_0x1f0820[_0x863c('0x49')][_0x3f40d0['id']],_0x3f40d0);}}}return _0x1f0820[_0x863c('0x49')];};};Realtime[_0x863c('0x3d')][_0x863c('0x4a')]=function(){var _0x5cc55d=this;return function(_0x2a179){if(_0x2a179){freeIsNotKey(_0x2a179,_0x5cc55d[_0x863c('0x1d')],'id');for(var _0x409e3a=0x0,_0xabcbc7={},_0x2f3d02={};_0x409e3a<_0x2a179['length'];_0x409e3a+=0x1){_0xabcbc7=_0x2a179[_0x409e3a];if(_['isUndefined'](_0x5cc55d[_0x863c('0x1d')][_0xabcbc7['id']])){_0x5cc55d[_0x863c('0x1d')][_0xabcbc7['id']]=new ZohoAccount(_0xabcbc7);}else{_0x5cc55d[_0x863c('0x3c')](_0x5cc55d[_0x863c('0x1d')][_0xabcbc7['id']],_0xabcbc7);}}}return _0x5cc55d['zohoAccounts'];};};Realtime[_0x863c('0x3d')]['initDeskAccounts']=function(){var _0x3af926=this;return function(_0x43e9df){if(_0x43e9df){freeIsNotKey(_0x43e9df,_0x3af926['deskAccounts'],'id');for(var _0x463a1e=0x0,_0x3c794a={},_0x246c25={};_0x463a1e<_0x43e9df[_0x863c('0x3f')];_0x463a1e+=0x1){_0x3c794a=_0x43e9df[_0x463a1e];if(_['isUndefined'](_0x3af926[_0x863c('0x1e')][_0x3c794a['id']])){_0x3af926['deskAccounts'][_0x3c794a['id']]=new DeskAccount(_0x3c794a);}else{_0x3af926[_0x863c('0x3c')](_0x3af926['deskAccounts'][_0x3c794a['id']],_0x3c794a);}}}return _0x3af926[_0x863c('0x1e')];};};Realtime[_0x863c('0x3d')]['initSugarcrmAccounts']=function(){var _0x9fb064=this;return function(_0x515079){if(_0x515079){freeIsNotKey(_0x515079,_0x9fb064[_0x863c('0x1c')],'id');for(var _0x3ecb78=0x0,_0x1469dc={},_0x1c4667={};_0x3ecb78<_0x515079[_0x863c('0x3f')];_0x3ecb78+=0x1){_0x1469dc=_0x515079[_0x3ecb78];if(_['isUndefined'](_0x9fb064[_0x863c('0x1c')][_0x1469dc['id']])){_0x9fb064[_0x863c('0x1c')][_0x1469dc['id']]=new SugarcrmAccount(_0x1469dc);}else{_0x9fb064[_0x863c('0x3c')](_0x9fb064[_0x863c('0x1c')][_0x1469dc['id']],_0x1469dc);}}}return _0x9fb064[_0x863c('0x1c')];};};Realtime[_0x863c('0x3d')][_0x863c('0x4b')]=function(){var _0x5baa3c=this;return function(_0x108358){if(_0x108358){freeIsNotKey(_0x108358,_0x5baa3c[_0x863c('0x1f')],'id');for(var _0x141024=0x0,_0x59264b={},_0x573b93={};_0x141024<_0x108358[_0x863c('0x3f')];_0x141024+=0x1){_0x59264b=_0x108358[_0x141024];if(_[_0x863c('0x41')](_0x5baa3c[_0x863c('0x1f')][_0x59264b['id']])){_0x5baa3c[_0x863c('0x1f')][_0x59264b['id']]=new VtigerAccount(_0x59264b);}else{_0x5baa3c[_0x863c('0x3c')](_0x5baa3c[_0x863c('0x1f')][_0x59264b['id']],_0x59264b);}}}return _0x5baa3c['vtigerAccounts'];};};Realtime['prototype'][_0x863c('0x4c')]=function(){var _0x58813c=this;return function(_0x33f16e){for(var _0x5b5b3e=0x0;_0x5b5b3e<_0x33f16e['length'];_0x5b5b3e+=0x1){_[_0x863c('0x4d')](_0x58813c[_0x863c('0x12')][_0x33f16e[_0x5b5b3e]['name']],_0x33f16e[_0x5b5b3e]);}return _0x58813c[_0x863c('0x12')];};};Realtime['prototype'][_0x863c('0x4e')]=function(){var _0x1eee13=this;return function(_0x5ce370){clearVoiceQueues(_0x1eee13['voiceQueues']);if(_0x5ce370){_0x5ce370=_[_0x863c('0x4f')](_0x5ce370,_0x863c('0x50'));for(var _0x49ade3 in _0x5ce370){if(_0x5ce370[_0x863c('0x23')](_0x49ade3)){var _0x1cd5ae={};for(var _0x2909b7=0x0;_0x2909b7<_0x5ce370[_0x49ade3][_0x863c('0x3f')];_0x2909b7+=0x1){var _0x553aa5=_0x5ce370[_0x49ade3][_0x2909b7][_0x863c('0x51')];if(_0x1eee13['voiceQueues'][_0x553aa5]){if(_0x5ce370[_0x49ade3][_0x2909b7][_0x863c('0x52')]){_0x1eee13['voiceQueues'][_0x553aa5]['unmanaged']+=0x1;}if(_0x5ce370[_0x49ade3][_0x2909b7][_0x863c('0x53')]){_0x1eee13[_0x863c('0x12')][_0x553aa5][_0x863c('0x54')]+=0x1;}_0x1eee13[_0x863c('0x12')][_0x553aa5][_0x863c('0x2a')]+=moment(_0x5ce370[_0x49ade3][_0x2909b7][_0x863c('0x55')])[_0x863c('0x56')](moment(_0x5ce370[_0x49ade3][_0x2909b7]['queuecallerjoinAt']),_0x863c('0x57'))||0x0;if(_0x2909b7===_0x5ce370[_0x49ade3]['length']-0x1){_0x1eee13[_0x863c('0x12')][_0x553aa5][_0x863c('0x2b')]+=moment(_0x5ce370[_0x49ade3][_0x2909b7][_0x863c('0x58')]||_0x5ce370[_0x49ade3][_0x2909b7][_0x863c('0x59')]||_0x5ce370[_0x49ade3][_0x2909b7]['queuecallerexitAt'])[_0x863c('0x56')](moment(_0x5ce370[_0x49ade3][_0x2909b7]['queuecallerjoinAt']),_0x863c('0x57'))||0x0;_0x1eee13['voiceQueues'][_0x553aa5]['total']+=0x1;if(_0x5ce370[_0x49ade3][_0x2909b7][_0x863c('0x5a')]){_0x1eee13['voiceQueues'][_0x553aa5][_0x863c('0x29')]+=0x1;_0x1eee13['voiceQueues'][_0x553aa5][_0x863c('0x2c')]+=moment(_0x5ce370[_0x49ade3][_0x2909b7][_0x863c('0x58')])['diff'](moment(_0x5ce370[_0x49ade3][_0x2909b7][_0x863c('0x55')]),_0x863c('0x57'))||0x0;}}else{_0x1eee13[_0x863c('0x12')][_0x553aa5][_0x863c('0x2b')]+=_0x1eee13[_0x863c('0x12')][_0x553aa5][_0x863c('0x2a')]||0x0;}}}}}}return _0x1eee13['voiceQueues'];};};Realtime['prototype'][_0x863c('0x5b')]=function(){var _0x691a1b=this;return function(_0x3ce088){clearVoiceCallReports(_0x691a1b[_0x863c('0x5c')]);if(_0x3ce088){for(var _0x398629=0x0;_0x398629<_0x3ce088[_0x863c('0x3f')];_0x398629+=0x1){_0x691a1b[_0x863c('0x5c')][_0x863c('0x28')]+=0x1;_0x691a1b['outbound']['sumDuration']+=_0x3ce088[_0x398629][_0x863c('0x5d')];if(_0x3ce088[_0x398629][_0x863c('0x5e')]===_0x863c('0x5f')){_0x691a1b['outbound'][_0x863c('0x29')]+=0x1;_0x691a1b[_0x863c('0x5c')]['sumHoldTime']+=_0x3ce088[_0x398629]['duration']-_0x3ce088[_0x398629][_0x863c('0x60')]||0x0;_0x691a1b[_0x863c('0x5c')][_0x863c('0x2c')]+=_0x3ce088[_0x398629]['billableseconds'];}}}return _0x691a1b[_0x863c('0x5c')];};};Realtime[_0x863c('0x3d')][_0x863c('0x61')]=function(){var _0x3cdb47=this;return function(_0x5292f8){if(_0x5292f8){freeIsNotKey(_0x5292f8,_0x3cdb47[_0x863c('0x14')],_0x863c('0x22'));for(var _0x533619=0x0,_0x39ec3a={};_0x533619<_0x5292f8[_0x863c('0x3f')];_0x533619+=0x1){_0x39ec3a=_0x5292f8[_0x533619];if(_[_0x863c('0x41')](_0x3cdb47['campaigns'][_0x39ec3a['name']])){_0x3cdb47[_0x863c('0x14')][_0x39ec3a['name']]=new Campaign(_0x39ec3a);}else{_0x3cdb47[_0x863c('0x3c')](_0x3cdb47[_0x863c('0x14')][_0x39ec3a[_0x863c('0x22')]],_0x39ec3a);}}}return _0x3cdb47[_0x863c('0x14')];};};Realtime[_0x863c('0x3d')]['initVoiceExtensions']=function(){var _0x37b0a5=this;return function(_0x1c9df2){if(_0x1c9df2){freeIsNotKey(_0x1c9df2,_0x37b0a5[_0x863c('0x16')],'id');for(var _0x404b22=0x0,_0x354df9={};_0x404b22<_0x1c9df2['length'];_0x404b22+=0x1){_0x354df9=_0x1c9df2[_0x404b22];if(_['isUndefined'](_0x37b0a5['voiceExtensions'][_0x354df9['id']])){_0x37b0a5[_0x863c('0x16')][_0x354df9['id']]=new VoiceExtension(_0x354df9);}else{_0x37b0a5['mergeFromDatabase'](_0x37b0a5[_0x863c('0x16')][_0x354df9['id']],_0x354df9);}}}return _0x37b0a5['voiceExtensions'];};};Realtime['prototype'][_0x863c('0x62')]=function(){var _0x4c826d=this;return function(_0x6725bd){clearCampaigns(_0x4c826d[_0x863c('0x14')]);for(var _0x4e25bc=0x0;_0x4e25bc<_0x6725bd[_0x863c('0x3f')];_0x4e25bc+=0x1){_[_0x863c('0x4d')](_0x4c826d[_0x863c('0x14')][_0x6725bd[_0x4e25bc]['name']],_0x6725bd[_0x4e25bc]);}return _0x4c826d[_0x863c('0x14')];};};Realtime[_0x863c('0x3d')][_0x863c('0x63')]=function(){var _0x4dcf38=this;return function(_0xd44eba){if(_0xd44eba){freeIsNotKey(_0xd44eba,_0x4dcf38[_0x863c('0x20')],'id');for(var _0x6a4b79=0x0,_0xce867={},_0x54b96e={};_0x6a4b79<_0xd44eba[_0x863c('0x3f')];_0x6a4b79+=0x1){_0xce867=_0xd44eba[_0x6a4b79];if(_['isUndefined'](_0x4dcf38[_0x863c('0x20')][_0xce867['id']])){_0x4dcf38[_0x863c('0x20')][_0xce867['id']]=new FaxAccount(_0xce867);}else{_0x4dcf38[_0x863c('0x3c')](_0x4dcf38[_0x863c('0x20')][_0xce867['id']],_0xce867);}}}return _0x4dcf38['faxAccounts'];};};module[_0x863c('0x64')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 83361fa..7af2685 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 _0xfdba=['format','SIP/%s','voiceQueueReport','length','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','voiceCallReport','destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','channel','destinationchannel','callerid','calleridpreview','connectedlinenum','create','monitor','monitors','monitorFilename','filename','createdAt','membername','xcally-motion-dialer','voiceAgentReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','voiceDialReport','blindTransfer','attendedTransfer','exports','util','../../../config/logger','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','agents','telephones','prototype','sync','realtime','findAgent','find','accountcode','name','isNil','interface'];(function(_0x5022e8,_0x52bc32){var _0x36edbf=function(_0x1ca432){while(--_0x1ca432){_0x5022e8['push'](_0x5022e8['shift']());}};_0x36edbf(++_0x52bc32);}(_0xfdba,0x77));var _0xafdb=function(_0xe57475,_0x5433f5){_0xe57475=_0xe57475-0x0;var _0x4c0999=_0xfdba[_0xe57475];return _0x4c0999;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require('moment');var util=require(_0xafdb('0x0'));var logger=require(_0xafdb('0x1'))('ami');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xafdb('0x2'));var RpcVoiceDialReport=require(_0xafdb('0x3'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xafdb('0x4'));var RpcVoiceTransferReport=require(_0xafdb('0x5'));var VoiceQueueReport=require(_0xafdb('0x6'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xafdb('0x7'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x3a1219){this['realtime']=_0x3a1219;this[_0xafdb('0x8')]=_0x3a1219[_0xafdb('0x8')];this[_0xafdb('0x9')]=_0x3a1219[_0xafdb('0x9')];}Report[_0xafdb('0xa')][_0xafdb('0xb')]=function(_0x8fb395){var _0x5142a9=new VoiceQueueReport(this['realtime']);var _0x46b685=new VoiceAgentReport(this[_0xafdb('0xc')]);var _0x1d251f=new VoiceDialReport(this[_0xafdb('0xc')]);var _0x407f58=new VoiceCallReport(this['realtime']);var _0x192ca8=new UserReport(this['realtime']);};Report[_0xafdb('0xa')][_0xafdb('0xd')]=function(_0x3174d2){var _0x5640dc=undefined;_0x5640dc=_[_0xafdb('0xe')](this[_0xafdb('0x8')],function(_0x27d8d0){return _0x27d8d0[_0xafdb('0xf')]==_0x3174d2||_0x27d8d0[_0xafdb('0x10')]==_0x3174d2;});if(_[_0xafdb('0x11')](_0x5640dc)){var _0x5e312a=_[_0xafdb('0xe')](this[_0xafdb('0x9')],function(_0x58cdf1){return _0x58cdf1[_0xafdb('0xf')]==_0x3174d2||_0x58cdf1[_0xafdb('0x10')]==_0x3174d2;});if(_0x5e312a){_0x5640dc=_[_0xafdb('0xe')](this[_0xafdb('0x8')],function(_0x40934f){return _0x40934f[_0xafdb('0x12')]==util[_0xafdb('0x13')](_0xafdb('0x14'),_0x5e312a[_0xafdb('0x10')]);});}}return _0x5640dc;};Report[_0xafdb('0xa')][_0xafdb('0x15')]=function(_0x704294){for(var _0x921175=0x0;_0x921175<_0x704294[_0xafdb('0x16')];_0x921175+=0x1){var _0x2f2c06=this[_0xafdb('0xd')](_0x704294[_0x921175]['connectedlinenum']);if(_0x2f2c06){_0x704294[_0x921175][_0xafdb('0xf')]=_0x2f2c06[_0xafdb('0xf')];_0x704294[_0x921175][_0xafdb('0x17')]=!![];_0x704294[_0x921175][_0xafdb('0x18')]=_0x2f2c06[_0xafdb('0x10')];_0x704294[_0x921175][_0xafdb('0x12')]=_['isNil'](_0x2f2c06['interface'])?util[_0xafdb('0x13')](_0xafdb('0x14'),_0x2f2c06[_0xafdb('0x10')]):_0x2f2c06[_0xafdb('0x12')];if(_0x704294[_0x921175][_0xafdb('0x19')]){_0x704294[_0x921175][_0xafdb('0x1a')]=moment()[_0xafdb('0x13')](_0xafdb('0x1b'));}if(_0x704294[_0x921175][_0xafdb('0x1c')]){_0x704294[_0x921175][_0xafdb('0x1d')]=moment()[_0xafdb('0x13')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xafdb('0x15')](_0x704294[_0x921175]);}RpcVoiceQueueReport['create'](_0x704294[_0x921175]);}};function extractCalleridNumber(_0x5c1bac){var _0x2274f2=_0x5c1bac[_0xafdb('0x1e')](/<(.*?)>/);return _0x2274f2?_0x2274f2[0x1]:_0x5c1bac;}Report[_0xafdb('0xa')][_0xafdb('0x1f')]=function(_0x164fe5){_0x164fe5[_0xafdb('0x20')]=_0x164fe5[_0xafdb('0x20')]||_0x164fe5[_0xafdb('0x21')];if(_0x164fe5[_0xafdb('0x22')]=='dialer'){_0x164fe5[_0xafdb('0x23')]=_0xafdb('0x24');_0x164fe5[_0xafdb('0x25')]=_0x164fe5[_0xafdb('0x24')];if(_0x164fe5[_0xafdb('0x26')]==_0xafdb('0x27')){_0x164fe5[_0xafdb('0xf')]='';_0x164fe5['destination']=extractCalleridNumber(_0x164fe5['callerid']);}else if(_0x164fe5[_0xafdb('0x26')]==_0xafdb('0x28')){if(_0x164fe5['destination']==_0xafdb('0x29')){_0x164fe5[_0xafdb('0x20')]=extractCalleridNumber(_0x164fe5['calleridpreview']);_0x164fe5[_0xafdb('0x2a')]=_0x164fe5[_0xafdb('0x2b')];_0x164fe5['destinationchannel']=[_0x164fe5[_0xafdb('0x2c')],_0x164fe5[_0xafdb('0x2c')]=_0x164fe5[_0xafdb('0x2d')]][0x0];_0x164fe5[_0xafdb('0x2e')]=_0x164fe5[_0xafdb('0x2f')];}else{_0x164fe5[_0xafdb('0x20')]=_0x164fe5[_0xafdb('0x2a')];_0x164fe5['calleridnum']=_0x164fe5[_0xafdb('0x2b')];if(_0x164fe5['disposition']=='ANSWERED'){_0x164fe5[_0xafdb('0xf')]=_0x164fe5[_0xafdb('0x30')];}else{_0x164fe5['accountcode']='';}}}}else{_0x164fe5[_0xafdb('0x2e')]=util[_0xafdb('0x13')]('\x22%s\x22\x20<%s>',_0x164fe5['calleridname'],_0x164fe5[_0xafdb('0x2a')]);}RpcVoiceCallReport[_0xafdb('0x31')](_0x164fe5);if(_0x164fe5[_0xafdb('0x32')]){for(var _0xe3575e=0x0;_0xe3575e<_0x164fe5[_0xafdb('0x33')]['length'];_0xe3575e+=0x1){_0x164fe5[_0xafdb('0x34')]=_0x164fe5[_0xafdb('0x33')][_0xe3575e][_0xafdb('0x35')];_0x164fe5['createdAt']=_0x164fe5[_0xafdb('0x33')][_0xe3575e][_0xafdb('0x36')];if(_0x164fe5[_0xafdb('0x21')]==_0xafdb('0x29')){_0x164fe5['calleridnum']=_0x164fe5[_0xafdb('0x30')];_0x164fe5['calleridname']=_0x164fe5['connectedlinename'];_0x164fe5[_0xafdb('0x30')]=_0x164fe5[_0xafdb('0xf')];_0x164fe5['connectedlinename']=_0x164fe5[_0xafdb('0x37')];_0x164fe5[_0xafdb('0x21')]=_0x164fe5[_0xafdb('0x2b')];}else if(_0x164fe5['exten']==_0xafdb('0x38')){_0x164fe5[_0xafdb('0x2a')]=_0x164fe5['destination'];_0x164fe5[_0xafdb('0x21')]=_0x164fe5[_0xafdb('0x2b')];}RpcVoiceRecording[_0xafdb('0x31')](_0x164fe5);}}};Report[_0xafdb('0xa')][_0xafdb('0x39')]=function(_0x3081d3){RpcVoiceAgentReport['create'](_0x3081d3);};Report[_0xafdb('0xa')]['voiceDialReport']=function(_0x176c27){RpcVoiceDialReport[_0xafdb('0x31')](_0x176c27);var _0x4fe0fd=undefined;var _0x2745ba=_0x176c27[_0xafdb('0x2c')];if(_[_0xafdb('0x3a')](_0x2745ba,_0xafdb('0x3b'))){var _0x40e692=_0x2745ba[_0xafdb('0x3c')](_0x2745ba[_0xafdb('0x3d')]('/')+0x1,_0x2745ba[_0xafdb('0x3d')]('@'));_0x4fe0fd=_[_0xafdb('0xe')](this['agents'],function(_0x23de63){return _0x23de63[_0xafdb('0x3e')]==_0x40e692||_0x23de63[_0xafdb('0x3f')]==_0x40e692||_0x23de63[_0xafdb('0xf')]==_0x40e692;});}else{var _0x40e692=_0x2745ba[_0xafdb('0x3c')](_0x2745ba[_0xafdb('0x3d')]('/')+0x1,_0x2745ba[_0xafdb('0x40')]('-'));_0x4fe0fd=this[_0xafdb('0xd')](_0x40e692);}if(_0x4fe0fd){_0x176c27['interface']=_[_0xafdb('0x11')](_0x4fe0fd[_0xafdb('0x12')])?util['format']('SIP/%s',_0x4fe0fd[_0xafdb('0x10')]):_0x4fe0fd[_0xafdb('0x12')];_0x176c27[_0xafdb('0x37')]=_0x4fe0fd[_0xafdb('0x10')];_0x176c27[_0xafdb('0xf')]=_0x4fe0fd[_0xafdb('0xf')];RpcMemberReport[_0xafdb('0x41')](_0x176c27);}};Report['prototype'][_0xafdb('0x42')]=function(_0x39357c){RpcVoiceTransferReport[_0xafdb('0x42')](_0x39357c);};Report['prototype'][_0xafdb('0x43')]=function(_0x5bd25a){RpcVoiceTransferReport['attendedTransfer'](_0x5bd25a);};module[_0xafdb('0x44')]=Report; \ No newline at end of file +var _0x24bd=['type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','destination','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','connectedlinenum','calleridname','create','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','voiceDialReport','Local','substring','indexOf','phone','lastIndexOf','findAgent','blindTransfer','attendedTransfer','bluebird','lodash','moment','util','../../../config/logger','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','find','name','isNil','accountcode','format','SIP/%s','voiceQueueReport','length','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','voiceCallReport','exten'];(function(_0xe2b1c9,_0xbaf73){var _0x4cea8c=function(_0xa3d653){while(--_0xa3d653){_0xe2b1c9['push'](_0xe2b1c9['shift']());}};_0x4cea8c(++_0xbaf73);}(_0x24bd,0xba));var _0xd24b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x24bd[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0xd24b('0x0'));var _=require(_0xd24b('0x1'));var moment=require(_0xd24b('0x2'));var util=require(_0xd24b('0x3'));var logger=require(_0xd24b('0x4'))('ami');var ami=require(_0xd24b('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xd24b('0x6'));var RpcMemberReport=require(_0xd24b('0x7'));var RpcVoiceQueueReport=require(_0xd24b('0x8'));var RpcVoiceRecording=require(_0xd24b('0x9'));var RpcVoiceTransferReport=require(_0xd24b('0xa'));var VoiceQueueReport=require(_0xd24b('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xd24b('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xd24b('0xd'));function Report(_0x3f9535){this[_0xd24b('0xe')]=_0x3f9535;this[_0xd24b('0xf')]=_0x3f9535[_0xd24b('0xf')];this[_0xd24b('0x10')]=_0x3f9535[_0xd24b('0x10')];}Report[_0xd24b('0x11')][_0xd24b('0x12')]=function(_0x8161db){var _0x129a32=new VoiceQueueReport(this[_0xd24b('0xe')]);var _0x3bd040=new VoiceAgentReport(this[_0xd24b('0xe')]);var _0x475bf5=new VoiceDialReport(this[_0xd24b('0xe')]);var _0x1bd470=new VoiceCallReport(this['realtime']);var _0x2742b6=new UserReport(this[_0xd24b('0xe')]);};Report['prototype']['findAgent']=function(_0x44f3ed){var _0x319132=undefined;_0x319132=_[_0xd24b('0x13')](this[_0xd24b('0xf')],function(_0x2290b4){return _0x2290b4['accountcode']==_0x44f3ed||_0x2290b4[_0xd24b('0x14')]==_0x44f3ed;});if(_[_0xd24b('0x15')](_0x319132)){var _0x56afe9=_['find'](this[_0xd24b('0x10')],function(_0x45dd5f){return _0x45dd5f[_0xd24b('0x16')]==_0x44f3ed||_0x45dd5f['name']==_0x44f3ed;});if(_0x56afe9){_0x319132=_[_0xd24b('0x13')](this[_0xd24b('0xf')],function(_0x5beb24){return _0x5beb24['interface']==util[_0xd24b('0x17')](_0xd24b('0x18'),_0x56afe9['name']);});}}return _0x319132;};Report[_0xd24b('0x11')][_0xd24b('0x19')]=function(_0x1e41d1){for(var _0x39edb0=0x0;_0x39edb0<_0x1e41d1[_0xd24b('0x1a')];_0x39edb0+=0x1){var _0x90d339=this['findAgent'](_0x1e41d1[_0x39edb0]['connectedlinenum']);if(_0x90d339){_0x1e41d1[_0x39edb0][_0xd24b('0x16')]=_0x90d339['accountcode'];_0x1e41d1[_0x39edb0]['assigned']=!![];_0x1e41d1[_0x39edb0][_0xd24b('0x1b')]=_0x90d339['name'];_0x1e41d1[_0x39edb0][_0xd24b('0x1c')]=_[_0xd24b('0x15')](_0x90d339[_0xd24b('0x1c')])?util['format'](_0xd24b('0x18'),_0x90d339[_0xd24b('0x14')]):_0x90d339[_0xd24b('0x1c')];if(_0x1e41d1[_0x39edb0][_0xd24b('0x1d')]){_0x1e41d1[_0x39edb0][_0xd24b('0x1e')]=moment()[_0xd24b('0x17')](_0xd24b('0x1f'));}if(_0x1e41d1[_0x39edb0]['queuecallerexit']){_0x1e41d1[_0x39edb0][_0xd24b('0x20')]=moment()['format'](_0xd24b('0x1f'));}RpcMemberReport[_0xd24b('0x19')](_0x1e41d1[_0x39edb0]);}RpcVoiceQueueReport['create'](_0x1e41d1[_0x39edb0]);}};function extractCalleridNumber(_0x5bdd2b){var _0x35ac77=_0x5bdd2b[_0xd24b('0x21')](/<(.*?)>/);return _0x35ac77?_0x35ac77[0x1]:_0x5bdd2b;}Report[_0xd24b('0x11')][_0xd24b('0x22')]=function(_0xd5ac46){_0xd5ac46['destination']=_0xd5ac46['destination']||_0xd5ac46[_0xd24b('0x23')];if(_0xd5ac46[_0xd24b('0x24')]==_0xd24b('0x25')){_0xd5ac46[_0xd24b('0x26')]=_0xd24b('0x27');_0xd5ac46[_0xd24b('0x28')]=_0xd5ac46[_0xd24b('0x27')];if(_0xd5ac46[_0xd24b('0x29')]==_0xd24b('0x2a')){_0xd5ac46[_0xd24b('0x16')]='';_0xd5ac46[_0xd24b('0x2b')]=extractCalleridNumber(_0xd5ac46[_0xd24b('0x2c')]);}else if(_0xd5ac46['context']==_0xd24b('0x2d')){if(_0xd5ac46[_0xd24b('0x2b')]==_0xd24b('0x2e')){_0xd5ac46[_0xd24b('0x2b')]=extractCalleridNumber(_0xd5ac46[_0xd24b('0x2f')]);_0xd5ac46[_0xd24b('0x30')]=_0xd5ac46[_0xd24b('0x31')];_0xd5ac46[_0xd24b('0x32')]=[_0xd5ac46['channel'],_0xd5ac46[_0xd24b('0x33')]=_0xd5ac46['destinationchannel']][0x0];_0xd5ac46[_0xd24b('0x2c')]=_0xd5ac46[_0xd24b('0x2f')];}else{_0xd5ac46[_0xd24b('0x2b')]=_0xd5ac46[_0xd24b('0x30')];_0xd5ac46[_0xd24b('0x30')]=_0xd5ac46[_0xd24b('0x31')];if(_0xd5ac46[_0xd24b('0x34')]==_0xd24b('0x35')){_0xd5ac46['accountcode']=_0xd5ac46[_0xd24b('0x36')];}else{_0xd5ac46[_0xd24b('0x16')]='';}}}}else{_0xd5ac46[_0xd24b('0x2c')]=util[_0xd24b('0x17')]('\x22%s\x22\x20<%s>',_0xd5ac46[_0xd24b('0x37')],_0xd5ac46[_0xd24b('0x30')]);}RpcVoiceCallReport[_0xd24b('0x38')](_0xd5ac46);if(_0xd5ac46['monitor']){for(var _0x73892b=0x0;_0x73892b<_0xd5ac46[_0xd24b('0x39')][_0xd24b('0x1a')];_0x73892b+=0x1){_0xd5ac46[_0xd24b('0x3a')]=_0xd5ac46['monitors'][_0x73892b][_0xd24b('0x3b')];_0xd5ac46[_0xd24b('0x3c')]=_0xd5ac46[_0xd24b('0x39')][_0x73892b][_0xd24b('0x3c')];if(_0xd5ac46[_0xd24b('0x23')]==_0xd24b('0x2e')){_0xd5ac46[_0xd24b('0x30')]=_0xd5ac46['connectedlinenum'];_0xd5ac46[_0xd24b('0x37')]=_0xd5ac46[_0xd24b('0x3d')];_0xd5ac46[_0xd24b('0x36')]=_0xd5ac46['accountcode'];_0xd5ac46[_0xd24b('0x3d')]=_0xd5ac46[_0xd24b('0x3e')];_0xd5ac46['exten']=_0xd5ac46[_0xd24b('0x31')];}else if(_0xd5ac46[_0xd24b('0x23')]==_0xd24b('0x3f')){_0xd5ac46['calleridnum']=_0xd5ac46[_0xd24b('0x2b')];_0xd5ac46[_0xd24b('0x23')]=_0xd5ac46[_0xd24b('0x31')];}RpcVoiceRecording['create'](_0xd5ac46);}}};Report[_0xd24b('0x11')][_0xd24b('0x40')]=function(_0x2c769d){RpcVoiceAgentReport[_0xd24b('0x38')](_0x2c769d);};Report[_0xd24b('0x11')][_0xd24b('0x41')]=function(_0x56d1d1){RpcVoiceDialReport[_0xd24b('0x38')](_0x56d1d1);var _0x5bd678=undefined;var _0x11ccc2=_0x56d1d1['channel'];if(_['startsWith'](_0x11ccc2,_0xd24b('0x42'))){var _0x38fd63=_0x11ccc2[_0xd24b('0x43')](_0x11ccc2[_0xd24b('0x44')]('/')+0x1,_0x11ccc2[_0xd24b('0x44')]('@'));_0x5bd678=_[_0xd24b('0x13')](this[_0xd24b('0xf')],function(_0x424731){return _0x424731['mobile']==_0x38fd63||_0x424731[_0xd24b('0x45')]==_0x38fd63||_0x424731[_0xd24b('0x16')]==_0x38fd63;});}else{var _0x38fd63=_0x11ccc2[_0xd24b('0x43')](_0x11ccc2[_0xd24b('0x44')]('/')+0x1,_0x11ccc2[_0xd24b('0x46')]('-'));_0x5bd678=this[_0xd24b('0x47')](_0x38fd63);}if(_0x5bd678){_0x56d1d1['interface']=_['isNil'](_0x5bd678[_0xd24b('0x1c')])?util[_0xd24b('0x17')](_0xd24b('0x18'),_0x5bd678['name']):_0x5bd678[_0xd24b('0x1c')];_0x56d1d1[_0xd24b('0x3e')]=_0x5bd678[_0xd24b('0x14')];_0x56d1d1[_0xd24b('0x16')]=_0x5bd678['accountcode'];RpcMemberReport[_0xd24b('0x41')](_0x56d1d1);}};Report[_0xd24b('0x11')][_0xd24b('0x48')]=function(_0x22f635){RpcVoiceTransferReport[_0xd24b('0x48')](_0x22f635);};Report['prototype']['attendedTransfer']=function(_0x1285b5){RpcVoiceTransferReport[_0xd24b('0x49')](_0x1285b5);};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 7157fc8..77a0fa7 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 _0x5edf=['isUndefined','emit','isNotNull','stateRegistry','merge','omit','username','state','format','name','trunk:save','error','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','trunk:%s','Queue','startsWith','Local','substring','indexOf','find','mobile','phone','[syncDeviceState][UserReport]','peer','status','address','telephone:save','[syncPeerStatus][UserReport]','exports','moment','bluebird','ioredis','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','inspect','prototype','loopSyncRealTimeShow','actionSipShowRegistry'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5edf,0x1b1));var _0xf5ed=function(_0x12ab68,_0x5b909e){_0x12ab68=_0x12ab68-0x0;var _0x51e2bb=_0x5edf[_0x12ab68];return _0x51e2bb;};'use strict';var _=require('lodash');var moment=require(_0xf5ed('0x0'));var BPromise=require(_0xf5ed('0x1'));var util=require('util');var Redis=require(_0xf5ed('0x2'));var config=require(_0xf5ed('0x3'));var logger=require('../../../config/logger')(_0xf5ed('0x4'));var ami=require(_0xf5ed('0x5'));config[_0xf5ed('0x6')]=_[_0xf5ed('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf5ed('0x8'))(new Redis(config['redis']));function UserReport(_0x10d722){this[_0xf5ed('0x9')]=_0x10d722['trunks'];this[_0xf5ed('0xa')]=_0x10d722[_0xf5ed('0xa')];this[_0xf5ed('0xb')]=_0x10d722[_0xf5ed('0xb')];ami['on'](_0xf5ed('0xc'),this[_0xf5ed('0xd')][_0xf5ed('0xe')](this));ami['on'](_0xf5ed('0xf'),this['syncRegistry'][_0xf5ed('0xe')](this));ami['on'](_0xf5ed('0x10'),this[_0xf5ed('0x11')][_0xf5ed('0xe')](this));ami['on'](_0xf5ed('0x12'),this[_0xf5ed('0x13')][_0xf5ed('0xe')](this));this['loopSyncRealTimeShow']();return BPromise['resolve']()[_0xf5ed('0x14')](ami['actionSipShowRegistry']())['then'](ami[_0xf5ed('0x15')]())[_0xf5ed('0x14')](ami[_0xf5ed('0x16')]())[_0xf5ed('0x17')](loggerCatch(_0xf5ed('0x18')));}function loggerCatch(_0x59b5da){return function(_0x223ed0){logger['error'](_0x59b5da,util[_0xf5ed('0x19')](_0x223ed0,{'showHidden':![],'depth':null}));};}UserReport[_0xf5ed('0x1a')][_0xf5ed('0x1b')]=function(){setInterval(function(){BPromise['resolve']()[_0xf5ed('0x14')](ami[_0xf5ed('0x1c')]())[_0xf5ed('0x14')](ami[_0xf5ed('0x15')]())[_0xf5ed('0x14')](ami[_0xf5ed('0x16')]())[_0xf5ed('0x17')](loggerCatch(_0xf5ed('0x18')));},0x32c8);};UserReport[_0xf5ed('0x1a')]['isNotNull']=function(_0x13e63a){return _0x13e63a!==null&&!_[_0xf5ed('0x1d')](_0x13e63a);};UserReport[_0xf5ed('0x1a')][_0xf5ed('0x1e')]=function(_0xe6bc73,_0x2a45e3,_0x1cd8a7){io['to'](_0xe6bc73)[_0xf5ed('0x1e')](_0x2a45e3,_0x1cd8a7);};UserReport[_0xf5ed('0x1a')][_0xf5ed('0xd')]=function(_0x477dff){try{if(this[_0xf5ed('0x1f')](_0x477dff)){var _0x134cfa=_['find'](this[_0xf5ed('0x9')],{'registry':_0x477dff['username']});if(_0x134cfa){_0x477dff[_0xf5ed('0x20')]=_0x477dff['state'];_[_0xf5ed('0x21')](_0x134cfa,_[_0xf5ed('0x22')](_0x477dff,['event','actionid',_0xf5ed('0x23'),_0xf5ed('0x24')]));this[_0xf5ed('0x1e')](util[_0xf5ed('0x25')]('trunk:%s',_0x134cfa[_0xf5ed('0x26')]),_0xf5ed('0x27'),_0x134cfa);}}}catch(_0x10db59){logger[_0xf5ed('0x28')](_0xf5ed('0x29'),util[_0xf5ed('0x19')](_0x10db59,{'showHidden':![],'depth':null}));}};UserReport[_0xf5ed('0x1a')][_0xf5ed('0x11')]=function(_0x31a868){try{if(this[_0xf5ed('0x1f')](_0x31a868)){if(this[_0xf5ed('0xa')][_0x31a868[_0xf5ed('0x2a')]]){if(!this[_0xf5ed('0xa')][_0x31a868['device']][_0xf5ed('0x2b')]||_0x31a868[_0xf5ed('0x24')][_0xf5ed('0x2c')]()==_0xf5ed('0x2d')){this[_0xf5ed('0xa')][_0x31a868[_0xf5ed('0x2a')]][_0xf5ed('0x2b')]=![];if(this[_0xf5ed('0xa')][_0x31a868['device']][_0xf5ed('0x24')]!==_0x31a868[_0xf5ed('0x24')][_0xf5ed('0x2c')]()){this[_0xf5ed('0xa')][_0x31a868[_0xf5ed('0x2a')]][_0xf5ed('0x2e')]=_[_0xf5ed('0x2f')](moment()[_0xf5ed('0x25')]('x'));}this[_0xf5ed('0xa')][_0x31a868[_0xf5ed('0x2a')]][_0xf5ed('0x24')]=_0x31a868[_0xf5ed('0x24')]['toLowerCase']();this['agents'][_0x31a868['device']][_0xf5ed('0x30')](_0x31a868);}}else if(this[_0xf5ed('0xb')][_0x31a868[_0xf5ed('0x2a')]]){if(this[_0xf5ed('0xb')][_0x31a868[_0xf5ed('0x2a')]][_0xf5ed('0x24')]!==_0x31a868[_0xf5ed('0x24')]['toLowerCase']()){this[_0xf5ed('0xb')][_0x31a868[_0xf5ed('0x2a')]][_0xf5ed('0x2e')]=_[_0xf5ed('0x2f')](moment()['format']('x'));}this[_0xf5ed('0xb')][_0x31a868[_0xf5ed('0x2a')]][_0xf5ed('0x24')]=_0x31a868['state']['toLowerCase']();this['emit'](util['format'](_0xf5ed('0x31'),this[_0xf5ed('0xb')][_0x31a868[_0xf5ed('0x2a')]][_0xf5ed('0x26')]),'telephone:save',this[_0xf5ed('0xb')][_0x31a868[_0xf5ed('0x2a')]]);}else if(this['trunks'][_0x31a868[_0xf5ed('0x2a')]]){if(this['trunks'][_0x31a868['device']][_0xf5ed('0x24')]!==_0x31a868[_0xf5ed('0x24')][_0xf5ed('0x2c')]()){this['trunks'][_0x31a868[_0xf5ed('0x2a')]]['stateTime']=_['toNumber'](moment()[_0xf5ed('0x25')]('x'));}this[_0xf5ed('0x9')][_0x31a868[_0xf5ed('0x2a')]]['state']=_0x31a868[_0xf5ed('0x24')][_0xf5ed('0x2c')]();this[_0xf5ed('0x1e')](util[_0xf5ed('0x25')](_0xf5ed('0x32'),this[_0xf5ed('0x9')][_0x31a868['device']]['name']),'trunk:save',this['trunks'][_0x31a868[_0xf5ed('0x2a')]]);}else if(_['startsWith'](_0x31a868['device'],_0xf5ed('0x33'))){}else if(_[_0xf5ed('0x34')](_0x31a868['device'],_0xf5ed('0x35'))){var _0x503f5d=_0x31a868['device'];var _0x2754b6=_0x503f5d[_0xf5ed('0x36')](_0x503f5d['indexOf']('/')+0x1,_0x503f5d[_0xf5ed('0x37')]('@'));var _0x2e7af4=_[_0xf5ed('0x38')](this[_0xf5ed('0xa')],function(_0x301efc){return _0x301efc[_0xf5ed('0x39')]==_0x2754b6||_0x301efc[_0xf5ed('0x3a')]==_0x2754b6||_0x301efc['accountcode']==_0x2754b6;});if(_0x2e7af4){if(_0x2e7af4[_0xf5ed('0x24')]!==_0x31a868['state'][_0xf5ed('0x2c')]()){_0x2e7af4[_0xf5ed('0x2e')]=_[_0xf5ed('0x2f')](moment()[_0xf5ed('0x25')]('x'));}_0x2e7af4[_0xf5ed('0x24')]=_0x31a868[_0xf5ed('0x24')][_0xf5ed('0x2c')]();_0x2e7af4[_0xf5ed('0x2b')]=!![];_0x2e7af4['updateStatusRealtime'](_0x31a868);}}else{}}}catch(_0x3151f8){logger[_0xf5ed('0x28')](_0xf5ed('0x3b'),util[_0xf5ed('0x19')](_0x3151f8,{'showHidden':![],'depth':null}));}};UserReport[_0xf5ed('0x1a')][_0xf5ed('0x13')]=function(_0x5af447){try{if(this[_0xf5ed('0x1f')](_0x5af447)&&this[_0xf5ed('0x1f')](_0x5af447['peerstatus'])){if(this[_0xf5ed('0xa')][_0x5af447[_0xf5ed('0x3c')]]){if(!this[_0xf5ed('0xa')][_0x5af447[_0xf5ed('0x3c')]]['local']||_0x5af447[_0xf5ed('0x12')][_0xf5ed('0x2c')]()=='registered'){this[_0xf5ed('0xa')][_0x5af447[_0xf5ed('0x3c')]][_0xf5ed('0x2b')]=![];this[_0xf5ed('0xa')][_0x5af447[_0xf5ed('0x3c')]][_0xf5ed('0x3d')]=_0x5af447[_0xf5ed('0x12')]['toLowerCase']();this[_0xf5ed('0xa')][_0x5af447[_0xf5ed('0x3c')]][_0xf5ed('0x3e')]=_0x5af447[_0xf5ed('0x3e')];this[_0xf5ed('0xa')][_0x5af447[_0xf5ed('0x3c')]][_0xf5ed('0x30')](_0x5af447);}}else if(this[_0xf5ed('0xb')][_0x5af447[_0xf5ed('0x3c')]]){this['telephones'][_0x5af447[_0xf5ed('0x3c')]][_0xf5ed('0x3d')]=_0x5af447['peerstatus'][_0xf5ed('0x2c')]();this[_0xf5ed('0xb')][_0x5af447[_0xf5ed('0x3c')]][_0xf5ed('0x3e')]=_0x5af447[_0xf5ed('0x3e')];this[_0xf5ed('0x1e')](util[_0xf5ed('0x25')](_0xf5ed('0x31'),this[_0xf5ed('0xb')][_0x5af447[_0xf5ed('0x3c')]]['name']),_0xf5ed('0x3f'),this[_0xf5ed('0xb')][_0x5af447[_0xf5ed('0x3c')]]);}else if(this[_0xf5ed('0x9')][_0x5af447[_0xf5ed('0x3c')]]){this[_0xf5ed('0x9')][_0x5af447[_0xf5ed('0x3c')]][_0xf5ed('0x3d')]=_0x5af447['peerstatus'][_0xf5ed('0x2c')]();this[_0xf5ed('0x9')][_0x5af447[_0xf5ed('0x3c')]]['address']=_0x5af447[_0xf5ed('0x3e')];this['emit'](util[_0xf5ed('0x25')](_0xf5ed('0x32'),this[_0xf5ed('0x9')][_0x5af447[_0xf5ed('0x3c')]][_0xf5ed('0x26')]),_0xf5ed('0x27'),this['trunks'][_0x5af447[_0xf5ed('0x3c')]]);}else{}}}catch(_0x49bd5f){logger[_0xf5ed('0x28')](_0xf5ed('0x40'),util[_0xf5ed('0x19')](_0x49bd5f,{'showHidden':![],'depth':null}));}};module[_0xf5ed('0x41')]=UserReport; \ No newline at end of file +var _0xfda2=['registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','[loopSyncRealTimeShow]','inspect','prototype','isNotNull','isUndefined','emit','username','state','merge','omit','event','actionid','format','trunk:%s','name','trunk:save','error','device','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','startsWith','Queue','Local','substring','indexOf','find','mobile','accountcode','peer','registered','address','status','telephone:save','[syncPeerStatus][UserReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind'];(function(_0x370723,_0x179030){var _0x4f82bb=function(_0x49f0ee){while(--_0x49f0ee){_0x370723['push'](_0x370723['shift']());}};_0x4f82bb(++_0x179030);}(_0xfda2,0x1b1));var _0x2fda=function(_0x2841ad,_0xeb57ec){_0x2841ad=_0x2841ad-0x0;var _0x50a781=_0xfda2[_0x2841ad];return _0x50a781;};'use strict';var _=require(_0x2fda('0x0'));var moment=require(_0x2fda('0x1'));var BPromise=require('bluebird');var util=require('util');var Redis=require(_0x2fda('0x2'));var config=require(_0x2fda('0x3'));var logger=require(_0x2fda('0x4'))(_0x2fda('0x5'));var ami=require(_0x2fda('0x6'));config[_0x2fda('0x7')]=_['defaults'](config[_0x2fda('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2fda('0x8'))(new Redis(config[_0x2fda('0x7')]));function UserReport(_0x13d607){this[_0x2fda('0x9')]=_0x13d607[_0x2fda('0x9')];this['agents']=_0x13d607[_0x2fda('0xa')];this[_0x2fda('0xb')]=_0x13d607['telephones'];ami['on'](_0x2fda('0xc'),this[_0x2fda('0xd')][_0x2fda('0xe')](this));ami['on'](_0x2fda('0xf'),this[_0x2fda('0xd')]['bind'](this));ami['on'](_0x2fda('0x10'),this[_0x2fda('0x11')][_0x2fda('0xe')](this));ami['on'](_0x2fda('0x12'),this[_0x2fda('0x13')][_0x2fda('0xe')](this));this[_0x2fda('0x14')]();return BPromise[_0x2fda('0x15')]()[_0x2fda('0x16')](ami['actionSipShowRegistry']())[_0x2fda('0x16')](ami[_0x2fda('0x17')]())['then'](ami[_0x2fda('0x18')]())['catch'](loggerCatch(_0x2fda('0x19')));}function loggerCatch(_0x3015f7){return function(_0x5005b9){logger['error'](_0x3015f7,util[_0x2fda('0x1a')](_0x5005b9,{'showHidden':![],'depth':null}));};}UserReport[_0x2fda('0x1b')][_0x2fda('0x14')]=function(){setInterval(function(){BPromise[_0x2fda('0x15')]()['then'](ami['actionSipShowRegistry']())[_0x2fda('0x16')](ami[_0x2fda('0x17')]())[_0x2fda('0x16')](ami['actionSipPeerStatus']())['catch'](loggerCatch(_0x2fda('0x19')));},0x32c8);};UserReport['prototype'][_0x2fda('0x1c')]=function(_0x4f831){return _0x4f831!==null&&!_[_0x2fda('0x1d')](_0x4f831);};UserReport[_0x2fda('0x1b')]['emit']=function(_0x537c71,_0x134b98,_0x37aff3){io['to'](_0x537c71)[_0x2fda('0x1e')](_0x134b98,_0x37aff3);};UserReport[_0x2fda('0x1b')][_0x2fda('0xd')]=function(_0x5affb2){try{if(this['isNotNull'](_0x5affb2)){var _0x4d9c4c=_['find'](this['trunks'],{'registry':_0x5affb2[_0x2fda('0x1f')]});if(_0x4d9c4c){_0x5affb2['stateRegistry']=_0x5affb2[_0x2fda('0x20')];_[_0x2fda('0x21')](_0x4d9c4c,_[_0x2fda('0x22')](_0x5affb2,[_0x2fda('0x23'),_0x2fda('0x24'),_0x2fda('0x1f'),'state']));this['emit'](util[_0x2fda('0x25')](_0x2fda('0x26'),_0x4d9c4c[_0x2fda('0x27')]),_0x2fda('0x28'),_0x4d9c4c);}}}catch(_0x8e3e27){logger[_0x2fda('0x29')]('[syncRegistry][UserReport]',util[_0x2fda('0x1a')](_0x8e3e27,{'showHidden':![],'depth':null}));}};UserReport[_0x2fda('0x1b')][_0x2fda('0x11')]=function(_0x2984cf){try{if(this[_0x2fda('0x1c')](_0x2984cf)){if(this[_0x2fda('0xa')][_0x2984cf[_0x2fda('0x2a')]]){if(!this[_0x2fda('0xa')][_0x2984cf[_0x2fda('0x2a')]][_0x2fda('0x2b')]||_0x2984cf['state'][_0x2fda('0x2c')]()=='inuse'){this[_0x2fda('0xa')][_0x2984cf[_0x2fda('0x2a')]][_0x2fda('0x2b')]=![];if(this[_0x2fda('0xa')][_0x2984cf[_0x2fda('0x2a')]][_0x2fda('0x20')]!==_0x2984cf[_0x2fda('0x20')]['toLowerCase']()){this[_0x2fda('0xa')][_0x2984cf[_0x2fda('0x2a')]][_0x2fda('0x2d')]=_[_0x2fda('0x2e')](moment()['format']('x'));}this['agents'][_0x2984cf[_0x2fda('0x2a')]][_0x2fda('0x20')]=_0x2984cf['state'][_0x2fda('0x2c')]();this[_0x2fda('0xa')][_0x2984cf[_0x2fda('0x2a')]][_0x2fda('0x2f')](_0x2984cf);}}else if(this[_0x2fda('0xb')][_0x2984cf[_0x2fda('0x2a')]]){if(this[_0x2fda('0xb')][_0x2984cf[_0x2fda('0x2a')]][_0x2fda('0x20')]!==_0x2984cf['state'][_0x2fda('0x2c')]()){this[_0x2fda('0xb')][_0x2984cf[_0x2fda('0x2a')]][_0x2fda('0x2d')]=_[_0x2fda('0x2e')](moment()[_0x2fda('0x25')]('x'));}this['telephones'][_0x2984cf['device']][_0x2fda('0x20')]=_0x2984cf[_0x2fda('0x20')][_0x2fda('0x2c')]();this[_0x2fda('0x1e')](util['format'](_0x2fda('0x30'),this['telephones'][_0x2984cf[_0x2fda('0x2a')]][_0x2fda('0x27')]),'telephone:save',this[_0x2fda('0xb')][_0x2984cf[_0x2fda('0x2a')]]);}else if(this[_0x2fda('0x9')][_0x2984cf[_0x2fda('0x2a')]]){if(this[_0x2fda('0x9')][_0x2984cf[_0x2fda('0x2a')]][_0x2fda('0x20')]!==_0x2984cf[_0x2fda('0x20')][_0x2fda('0x2c')]()){this[_0x2fda('0x9')][_0x2984cf['device']][_0x2fda('0x2d')]=_[_0x2fda('0x2e')](moment()[_0x2fda('0x25')]('x'));}this['trunks'][_0x2984cf[_0x2fda('0x2a')]]['state']=_0x2984cf[_0x2fda('0x20')][_0x2fda('0x2c')]();this[_0x2fda('0x1e')](util['format'](_0x2fda('0x26'),this[_0x2fda('0x9')][_0x2984cf['device']][_0x2fda('0x27')]),_0x2fda('0x28'),this['trunks'][_0x2984cf['device']]);}else if(_[_0x2fda('0x31')](_0x2984cf[_0x2fda('0x2a')],_0x2fda('0x32'))){}else if(_[_0x2fda('0x31')](_0x2984cf[_0x2fda('0x2a')],_0x2fda('0x33'))){var _0x43ebca=_0x2984cf[_0x2fda('0x2a')];var _0x2f8ccd=_0x43ebca[_0x2fda('0x34')](_0x43ebca[_0x2fda('0x35')]('/')+0x1,_0x43ebca['indexOf']('@'));var _0x64ee66=_[_0x2fda('0x36')](this[_0x2fda('0xa')],function(_0x4ca5eb){return _0x4ca5eb[_0x2fda('0x37')]==_0x2f8ccd||_0x4ca5eb['phone']==_0x2f8ccd||_0x4ca5eb[_0x2fda('0x38')]==_0x2f8ccd;});if(_0x64ee66){if(_0x64ee66[_0x2fda('0x20')]!==_0x2984cf[_0x2fda('0x20')][_0x2fda('0x2c')]()){_0x64ee66[_0x2fda('0x2d')]=_[_0x2fda('0x2e')](moment()[_0x2fda('0x25')]('x'));}_0x64ee66[_0x2fda('0x20')]=_0x2984cf[_0x2fda('0x20')][_0x2fda('0x2c')]();_0x64ee66['local']=!![];_0x64ee66['updateStatusRealtime'](_0x2984cf);}}else{}}}catch(_0x201b94){logger[_0x2fda('0x29')]('[syncDeviceState][UserReport]',util[_0x2fda('0x1a')](_0x201b94,{'showHidden':![],'depth':null}));}};UserReport[_0x2fda('0x1b')][_0x2fda('0x13')]=function(_0x3d54a6){try{if(this[_0x2fda('0x1c')](_0x3d54a6)&&this[_0x2fda('0x1c')](_0x3d54a6[_0x2fda('0x12')])){if(this[_0x2fda('0xa')][_0x3d54a6['peer']]){if(!this['agents'][_0x3d54a6[_0x2fda('0x39')]][_0x2fda('0x2b')]||_0x3d54a6['peerstatus'][_0x2fda('0x2c')]()==_0x2fda('0x3a')){this[_0x2fda('0xa')][_0x3d54a6[_0x2fda('0x39')]][_0x2fda('0x2b')]=![];this[_0x2fda('0xa')][_0x3d54a6[_0x2fda('0x39')]]['status']=_0x3d54a6[_0x2fda('0x12')][_0x2fda('0x2c')]();this[_0x2fda('0xa')][_0x3d54a6[_0x2fda('0x39')]][_0x2fda('0x3b')]=_0x3d54a6[_0x2fda('0x3b')];this[_0x2fda('0xa')][_0x3d54a6['peer']][_0x2fda('0x2f')](_0x3d54a6);}}else if(this[_0x2fda('0xb')][_0x3d54a6['peer']]){this[_0x2fda('0xb')][_0x3d54a6[_0x2fda('0x39')]][_0x2fda('0x3c')]=_0x3d54a6[_0x2fda('0x12')][_0x2fda('0x2c')]();this[_0x2fda('0xb')][_0x3d54a6[_0x2fda('0x39')]][_0x2fda('0x3b')]=_0x3d54a6[_0x2fda('0x3b')];this[_0x2fda('0x1e')](util[_0x2fda('0x25')](_0x2fda('0x30'),this[_0x2fda('0xb')][_0x3d54a6[_0x2fda('0x39')]][_0x2fda('0x27')]),_0x2fda('0x3d'),this[_0x2fda('0xb')][_0x3d54a6[_0x2fda('0x39')]]);}else if(this[_0x2fda('0x9')][_0x3d54a6[_0x2fda('0x39')]]){this[_0x2fda('0x9')][_0x3d54a6[_0x2fda('0x39')]]['status']=_0x3d54a6['peerstatus'][_0x2fda('0x2c')]();this['trunks'][_0x3d54a6['peer']]['address']=_0x3d54a6[_0x2fda('0x3b')];this[_0x2fda('0x1e')](util['format'](_0x2fda('0x26'),this[_0x2fda('0x9')][_0x3d54a6[_0x2fda('0x39')]][_0x2fda('0x27')]),_0x2fda('0x28'),this[_0x2fda('0x9')][_0x3d54a6['peer']]);}else{}}}catch(_0xcdd33){logger[_0x2fda('0x29')](_0x2fda('0x3e'),util['inspect'](_0xcdd33,{'showHidden':![],'depth':null}));}};module[_0x2fda('0x3f')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 625be48..1fce18c 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 _0x0024=['../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','channels','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','prototype','log','info','%s|%s','uniqueid','membername','queue','exten','calleridnum','join','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','agents','interface','isNil','assign','destchannel','calleridname','destcalleridnum','destcalleridname','accountcode','destaccountcode','destuniqueid','context','priority','type','inbound','agent','variables','channel','emit','user:called','CALLED','error','stack','ringtime','connect','agentconnectAt','agentcalledAt','user:%s','user:agentconnect','CONNECT','syncMusicOnHoldStart','find','updateStatusRealtime','onhold','rejected','custom:agentringnoanswer','RINGNOANSWER','holdtime','originalposition','abandoned','custom:agentqueuecallerabandon','CALLERABANDON','talktime','reason','transfer','acwTimeout','cause','custom:agentansweredelsewhere','custom:agentcomplete','recalculate','agentcompleteAt','user:save','clear','ATTENDED','secondtransfereruniqueid','secondtransfererexten','secondtransferercontext','complete','acw','transfertargetchannel','syncBlindTransfer','transfererchannel','BLIND','transfereeuniqueid','extension','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','keys','variable','includes','exports','lodash','moment','util','ioredis','../../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0024,0x107));var _0x4002=function(_0x32de2a,_0x5e9e2e){_0x32de2a=_0x32de2a-0x0;var _0x29e4b5=_0x0024[_0x32de2a];return _0x29e4b5;};'use strict';var _=require(_0x4002('0x0'));var moment=require(_0x4002('0x1'));var util=require(_0x4002('0x2'));var Redis=require(_0x4002('0x3'));var config=require(_0x4002('0x4'));var logger=require(_0x4002('0x5'))(_0x4002('0x6'));var ami=require(_0x4002('0x7'));config[_0x4002('0x8')]=_[_0x4002('0x9')](config[_0x4002('0x8')],{'host':_0x4002('0xa'),'port':0x18eb});var io=require(_0x4002('0xb'))(new Redis(config['redis']));function VoiceAgentReport(_0x34af7a){this[_0x4002('0xc')]=_0x34af7a['voiceQueues'];this['agents']=_0x34af7a['agents'];this[_0x4002('0xd')]={};this['variables']={};ami['on'](_0x4002('0xe'),this[_0x4002('0xf')]['bind'](this));ami['on'](_0x4002('0x10'),this[_0x4002('0x11')][_0x4002('0x12')](this));ami['on'](_0x4002('0x13'),this[_0x4002('0x14')][_0x4002('0x12')](this));ami['on'](_0x4002('0x15'),this[_0x4002('0x16')][_0x4002('0x12')](this));ami['on'](_0x4002('0x17'),this[_0x4002('0x18')][_0x4002('0x12')](this));ami['on'](_0x4002('0x19'),this[_0x4002('0x1a')][_0x4002('0x12')](this));ami['on'](_0x4002('0x1b'),this[_0x4002('0x1c')][_0x4002('0x12')](this));ami['on'](_0x4002('0x1d'),this[_0x4002('0x1e')][_0x4002('0x12')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4002('0x12')](this));ami['on'](_0x4002('0x1f'),this['syncMusicOnHoldStart'][_0x4002('0x12')](this));ami['on'](_0x4002('0x20'),this[_0x4002('0x21')][_0x4002('0x12')](this));}VoiceAgentReport[_0x4002('0x22')][_0x4002('0x23')]=function(_0x47e6b9,_0x54fc20){logger[_0x4002('0x24')](util['format'](_0x4002('0x25'),_0x47e6b9,[_0x54fc20[_0x4002('0x26')],_0x54fc20[_0x4002('0x27')],_0x54fc20[_0x4002('0x28')],_0x54fc20[_0x4002('0x29')],_0x54fc20[_0x4002('0x2a')]][_0x4002('0x2b')]('|')));};VoiceAgentReport[_0x4002('0x22')][_0x4002('0x2c')]=function(_0x1f1ae3,_0x4613e8){return moment(_0x1f1ae3)[_0x4002('0x2d')](_0x4613e8,_0x4002('0x2e'))[_0x4002('0x2f')](_0x4002('0x30'));};VoiceAgentReport['prototype'][_0x4002('0x31')]=function(_0x4a4c32,_0x5e5163){return moment(_0x4a4c32)[_0x4002('0x32')](moment(_0x5e5163),'seconds');};VoiceAgentReport[_0x4002('0x22')][_0x4002('0xf')]=function(_0x39b69f){try{var _0x1dedd4=this[_0x4002('0x33')][_0x39b69f[_0x4002('0x34')]];if(!_[_0x4002('0x35')](_0x1dedd4)){_0x1dedd4=_[_0x4002('0x36')](_0x1dedd4,{'queue':_0x39b69f[_0x4002('0x28')],'destconnectedlinenum':_0x39b69f[_0x4002('0x2a')]});io['emit']('user:save',_0x1dedd4);}var _0x31727e=this[_0x4002('0xd')][_0x39b69f[_0x4002('0x37')]]={'agentcalledAt':moment()['format'](_0x4002('0x30')),'calleridnum':_0x39b69f[_0x4002('0x2a')],'calleridname':_0x39b69f[_0x4002('0x38')],'connectedlinenum':_0x39b69f[_0x4002('0x39')],'connectedlinename':_0x39b69f[_0x4002('0x3a')],'accountcode':_0x39b69f[_0x4002('0x3b')],'destaccountcode':_0x39b69f[_0x4002('0x3c')],'channel':_0x39b69f['channel'],'destchannel':_0x39b69f[_0x4002('0x37')],'uniqueid':_0x39b69f[_0x4002('0x26')],'destuniqueid':_0x39b69f[_0x4002('0x3d')],'context':_0x39b69f[_0x4002('0x3e')],'exten':_0x39b69f[_0x4002('0x29')],'priority':_0x39b69f[_0x4002('0x3f')],'queue':_0x39b69f[_0x4002('0x28')],'type':this[_0x4002('0xc')][_0x39b69f[_0x4002('0x28')]]?this[_0x4002('0xc')][_0x39b69f[_0x4002('0x28')]][_0x4002('0x40')]||_0x4002('0x41'):'inbound','interface':_0x39b69f[_0x4002('0x34')],'membername':_0x39b69f[_0x4002('0x27')],'agentconnect':![],'agentconnectAt':null,'holdtime':0x0,'ringtime':0x0,'agentcomplete':![],'agentcompleteAt':null,'talktime':0x0,'agentringnoanswer':![],'agentringnoanswerAt':null,'reason':_0x4002('0x42'),'transfer':![],'transferAt':null,'transfertype':null,'transferuniqueid':null,'transfercontext':null,'transferextension':null,'position':null,'originalposition':null,'cause':'','cause-txt':'','UserId':this[_0x4002('0x33')][_0x39b69f[_0x4002('0x34')]]?this[_0x4002('0x33')][_0x39b69f['interface']]['id']:null,'lastevent':'called','agentacw':![],'acwtime':0x0,'variables':this[_0x4002('0x43')][_0x39b69f[_0x4002('0x44')]]?this['variables'][_0x39b69f[_0x4002('0x44')]]:{}};ami[_0x4002('0x45')]('custom:agentcalled',_0x31727e);io['to'](util[_0x4002('0x2f')]('user:%s',_0x31727e[_0x4002('0x27')]))[_0x4002('0x45')](_0x4002('0x46'),_0x31727e);this[_0x4002('0x23')](_0x4002('0x47'),this[_0x4002('0xd')][_0x39b69f['destchannel']]);}catch(_0x3829e1){logger[_0x4002('0x48')](_0x3829e1[_0x4002('0x49')]);}};VoiceAgentReport['prototype'][_0x4002('0x11')]=function(_0x84f5a){try{var _0x16ecd8=this[_0x4002('0xd')][_0x84f5a['destchannel']];if(!_[_0x4002('0x35')](_0x16ecd8)){_0x16ecd8=_[_0x4002('0x36')](_0x16ecd8,{'holdtime':parseInt(_0x84f5a['holdtime'],0xa),'ringtime':parseInt(_0x84f5a[_0x4002('0x4a')],0xa),'agentconnect':!![],'lastevent':_0x4002('0x4b')});_0x16ecd8[_0x4002('0x4c')]=this[_0x4002('0x2c')](_0x16ecd8[_0x4002('0x4d')],_0x16ecd8[_0x4002('0x4a')]);ami['emit']('custom:agentconnect',_0x16ecd8);io['to'](util['format'](_0x4002('0x4e'),_0x16ecd8[_0x4002('0x27')]))[_0x4002('0x45')](_0x4002('0x4f'),_0x16ecd8);this['log'](_0x4002('0x50'),_0x16ecd8);}}catch(_0x35274f){logger['error'](_0x35274f['stack']);}};VoiceAgentReport[_0x4002('0x22')][_0x4002('0x51')]=function(_0x20e74a){try{var _0xcebe82=_[_0x4002('0x52')](this['channels'],{'channel':_0x20e74a[_0x4002('0x44')],'agentconnect':!![]});if(!_[_0x4002('0x35')](_0xcebe82)){if(!_[_0x4002('0x35')](this[_0x4002('0x33')][_0xcebe82['interface']])){this[_0x4002('0x33')][_0xcebe82[_0x4002('0x34')]]['onhold']=!![];this[_0x4002('0x33')][_0xcebe82[_0x4002('0x34')]][_0x4002('0x53')]();}}}catch(_0x29c875){logger[_0x4002('0x48')](_0x29c875[_0x4002('0x49')]);}};VoiceAgentReport[_0x4002('0x22')][_0x4002('0x21')]=function(_0x32d901){try{var _0x2963fb=_[_0x4002('0x52')](this[_0x4002('0xd')],{'channel':_0x32d901[_0x4002('0x44')],'agentconnect':!![]});if(!_['isNil'](_0x2963fb)){if(!_['isNil'](this[_0x4002('0x33')][_0x2963fb[_0x4002('0x34')]])){this[_0x4002('0x33')][_0x2963fb[_0x4002('0x34')]][_0x4002('0x54')]=![];this[_0x4002('0x33')][_0x2963fb[_0x4002('0x34')]][_0x4002('0x53')]();}}}catch(_0x4597c2){logger[_0x4002('0x48')](_0x4597c2[_0x4002('0x49')]);}};VoiceAgentReport[_0x4002('0x22')][_0x4002('0x14')]=function(_0x1f35a5){try{var _0x114eee=this[_0x4002('0xd')][_0x1f35a5[_0x4002('0x37')]];if(!_[_0x4002('0x35')](_0x114eee)){_0x114eee=_[_0x4002('0x36')](_0x114eee,{'ringtime':parseInt(_0x1f35a5[_0x4002('0x4a')],0xa)/0x3e8,'agentringnoanswer':!![],'reason':_0x4002('0x55'),'lastevent':'rejected'});_0x114eee['agentringnoanswerAt']=this[_0x4002('0x2c')](_0x114eee[_0x4002('0x4d')],_0x114eee[_0x4002('0x4a')]);ami[_0x4002('0x45')](_0x4002('0x56'),_0x114eee);this['log'](_0x4002('0x57'),_0x114eee);}}catch(_0x4a8519){logger['error'](_0x4a8519[_0x4002('0x49')]);}};VoiceAgentReport[_0x4002('0x22')]['syncQueueCallerAbandon']=function(_0x274a6c){try{for(var _0x12bd22 in this[_0x4002('0xd')]){var _0xb7d7c9=this[_0x4002('0xd')][_0x12bd22];if(!_['isNil'](_0xb7d7c9)&&_0xb7d7c9[_0x4002('0x44')]==_0x274a6c['channel']){_0xb7d7c9=_[_0x4002('0x36')](_0xb7d7c9,{'holdtime':parseInt(_0x274a6c[_0x4002('0x58')],0xa),'position':parseInt(_0x274a6c['position'],0xa),'originalposition':parseInt(_0x274a6c[_0x4002('0x59')],0xa),'agentringnoanswer':!![],'agentringnoanswerAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x4002('0x5a'),'lastevent':_0x4002('0x5a')});ami['emit'](_0x4002('0x5b'),_0xb7d7c9);this['log'](_0x4002('0x5c'),_0xb7d7c9);}}}catch(_0x9835e2){logger['error'](_0x9835e2[_0x4002('0x49')]);}};VoiceAgentReport['prototype'][_0x4002('0x18')]=function(_0x1ca620){try{var _0x1dfbe6=this['channels'][_0x1ca620[_0x4002('0x37')]];if(!_[_0x4002('0x35')](_0x1dfbe6)){_0x1dfbe6=_['assign'](_0x1dfbe6,{'talktime':parseInt(_0x1ca620[_0x4002('0x5d')],0xa),'reason':_0x1ca620[_0x4002('0x5e')]==_0x4002('0x5f')?_0x4002('0x42'):_0x1ca620[_0x4002('0x5e')],'agentcomplete':!![],'lastevent':'complete','agentacw':this[_0x4002('0xc')][_0x1dfbe6[_0x4002('0x28')]]&&this[_0x4002('0xc')][_0x1dfbe6['queue']]['acw']?!![]:![],'acwtime':this[_0x4002('0xc')][_0x1dfbe6[_0x4002('0x28')]]&&this['voiceQueues'][_0x1dfbe6[_0x4002('0x28')]]['acw']?this[_0x4002('0xc')][_0x1dfbe6[_0x4002('0x28')]][_0x4002('0x60')]:0x0});_0x1dfbe6['agentcompleteAt']=this[_0x4002('0x2c')](_0x1dfbe6[_0x4002('0x4c')],_0x1dfbe6[_0x4002('0x5d')]);this[_0x4002('0x23')]('COMPLETE',_0x1dfbe6);}}catch(_0x5c9475){logger[_0x4002('0x48')](_0x5c9475[_0x4002('0x49')]);}};VoiceAgentReport[_0x4002('0x22')]['clear']=function(_0x4856ba){try{switch(_0x4856ba[_0x4002('0x61')]){case 0x1a:_0x4856ba=_[_0x4002('0x36')](_0x4856ba,{'agentringnoanswer':!![],'reason':'answered_elsewhere','lastevent':'answered_elsewhere'});var _0x52726c=_[_0x4002('0x52')](this[_0x4002('0xd')],{'channel':_0x4856ba['channel'],'agentconnect':!![]});if(!_[_0x4002('0x35')](_0x52726c)){_0x4856ba=_['assign'](_0x4856ba,{'agentringnoanswerAt':_0x52726c['agentconnectAt'],'answeredelsewheremembername':_0x52726c[_0x4002('0x27')],'answeredelsewheredestinationuniqueid':_0x52726c[_0x4002('0x3d')]});}ami[_0x4002('0x45')](_0x4002('0x62'),_0x4856ba);break;}if(_0x4856ba[_0x4002('0x17')]){ami[_0x4002('0x45')](_0x4002('0x63'),_0x4856ba);io['to'](util[_0x4002('0x2f')]('user:%s',_0x4856ba[_0x4002('0x27')]))[_0x4002('0x45')]('user:agentcomplete',_0x4856ba);}this[_0x4002('0x23')]('HANGUP',_0x4856ba);ami['emit']('custom:voiceAgentReport',_0x4856ba);if(this[_0x4002('0xd')][_0x4856ba[_0x4002('0x37')]]){delete this[_0x4002('0xd')][_0x4856ba[_0x4002('0x37')]];}}catch(_0x2ee03c){logger['error'](_0x2ee03c);}};VoiceAgentReport[_0x4002('0x22')][_0x4002('0x1c')]=function(_0x2e6ccd){try{var _0x34ccd0=this['channels'][_0x2e6ccd[_0x4002('0x44')]];if(!_[_0x4002('0x35')](_0x34ccd0)){_0x34ccd0=_['assign'](_0x34ccd0,{'cause':parseInt(_0x2e6ccd['cause'],0xa),'cause-txt':_0x2e6ccd['cause-txt']});if(_0x34ccd0[_0x4002('0x64')]){_0x34ccd0=_['assign'](_0x34ccd0,{'agentcomplete':!![],'agentcompleteAt':moment()[_0x4002('0x2f')](_0x4002('0x30')),'lastevent':'complete','agentacw':this[_0x4002('0xc')][_0x34ccd0['queue']]&&this[_0x4002('0xc')][_0x34ccd0[_0x4002('0x28')]]['acw']?!![]:![],'acwtime':this[_0x4002('0xc')][_0x34ccd0[_0x4002('0x28')]]&&this[_0x4002('0xc')][_0x34ccd0[_0x4002('0x28')]]['acw']?this[_0x4002('0xc')][_0x34ccd0[_0x4002('0x28')]]['acwTimeout']:0x0});_0x34ccd0[_0x4002('0x5d')]=this[_0x4002('0x31')](_0x34ccd0[_0x4002('0x65')],_0x34ccd0[_0x4002('0x4c')]);}var _0x54f8c8=this[_0x4002('0x33')][_0x34ccd0[_0x4002('0x34')]];if(!_[_0x4002('0x35')](_0x54f8c8)){_0x54f8c8=_['assign'](_0x54f8c8,{'queue':null,'destconnectedlinenum':null});io[_0x4002('0x45')](_0x4002('0x66'),_0x54f8c8);}setTimeout(this[_0x4002('0x67')][_0x4002('0x12')](this,_0x34ccd0),0x3e8);}if(this[_0x4002('0x43')][_0x2e6ccd['channel']]){delete this[_0x4002('0x43')][_0x2e6ccd[_0x4002('0x44')]];}}catch(_0x550c2d){logger[_0x4002('0x48')](_0x550c2d[_0x4002('0x49')]);}};VoiceAgentReport['prototype'][_0x4002('0x1e')]=function(_0x4f3887){try{var _0x2c02a7=this['channels'][_0x4f3887['origtransfererchannel']];if(!_[_0x4002('0x35')](_0x2c02a7)){_0x2c02a7=_[_0x4002('0x36')](_0x2c02a7,{'transfer':!![],'transferAt':moment()[_0x4002('0x2f')](_0x4002('0x30')),'transfertype':_0x4002('0x68'),'agentcomplete':!![],'agentcompleteAt':moment()[_0x4002('0x2f')](_0x4002('0x30')),'transferuniqueid':_0x4f3887[_0x4002('0x69')],'transfercontext':_0x4f3887[_0x4002('0x6a')],'transferextension':_0x4f3887[_0x4002('0x6b')],'reason':_0x4002('0x5f'),'lastevent':_0x4002('0x6c'),'agentacw':this['voiceQueues'][_0x2c02a7[_0x4002('0x28')]]&&this[_0x4002('0xc')][_0x2c02a7[_0x4002('0x28')]][_0x4002('0x6d')]?!![]:![],'acwtime':this[_0x4002('0xc')][_0x2c02a7[_0x4002('0x28')]]&&this[_0x4002('0xc')][_0x2c02a7['queue']][_0x4002('0x6d')]?this['voiceQueues'][_0x2c02a7[_0x4002('0x28')]][_0x4002('0x60')]:0x0});_0x2c02a7[_0x4002('0x5d')]=this[_0x4002('0x31')](_0x2c02a7['agentcompleteAt'],_0x2c02a7[_0x4002('0x4c')]);this[_0x4002('0x23')](_0x4002('0x68'),_0x2c02a7);}if(!_[_0x4002('0x35')](this[_0x4002('0xd')][_0x4f3887['transfertargetchannel']])){this[_0x4002('0xd')][_0x4f3887[_0x4002('0x6e')]][_0x4002('0x64')]=!![];}}catch(_0xb9b6b){logger[_0x4002('0x48')](_0xb9b6b[_0x4002('0x49')]);}};VoiceAgentReport[_0x4002('0x22')][_0x4002('0x6f')]=function(_0x34149c){try{var _0x31e4bb=this['channels'][_0x34149c[_0x4002('0x70')]];if(!_['isNil'](_0x31e4bb)){_0x31e4bb=_[_0x4002('0x36')](_0x31e4bb,{'transfer':!![],'transferAt':moment()[_0x4002('0x2f')](_0x4002('0x30')),'transfertype':_0x4002('0x71'),'transferuniqueid':_0x34149c[_0x4002('0x72')],'transfercontext':_0x34149c['context'],'transferextension':_0x34149c[_0x4002('0x73')],'agentcomplete':!![],'agentcompleteAt':moment()['format'](_0x4002('0x30')),'reason':'transfer','lastevent':'complete','agentacw':this[_0x4002('0xc')][_0x31e4bb[_0x4002('0x28')]]&&this[_0x4002('0xc')][_0x31e4bb[_0x4002('0x28')]][_0x4002('0x6d')]?!![]:![],'acwtime':this['voiceQueues'][_0x31e4bb[_0x4002('0x28')]]&&this[_0x4002('0xc')][_0x31e4bb[_0x4002('0x28')]][_0x4002('0x6d')]?this[_0x4002('0xc')][_0x31e4bb[_0x4002('0x28')]][_0x4002('0x60')]:0x0});_0x31e4bb[_0x4002('0x64')]=!![];this[_0x4002('0x23')](_0x4002('0x71'),_0x31e4bb);}}catch(_0x1cae77){logger['error'](_0x1cae77[_0x4002('0x49')]);}};VoiceAgentReport[_0x4002('0x22')][_0x4002('0x1a')]=function(_0x402246){var _0x379646=[_0x4002('0x74'),_0x4002('0x75'),_0x4002('0x76'),_0x4002('0x77'),_0x4002('0x78'),'rtpaudioqoslossbridged',_0x4002('0x79'),_0x4002('0x7a'),_0x4002('0x7b'),'sipuri','bridgepeer',_0x4002('0x7c'),_0x4002('0x7d'),_0x4002('0x7e'),'memberinterface',_0x4002('0x7f'),_0x4002('0x27'),_0x4002('0x80'),_0x4002('0x81')];try{var _0x1f8501=_[_0x4002('0x82')](_0x402246[_0x4002('0x83')])[0x0];if(!_[_0x4002('0x35')](_0x1f8501)&&!_[_0x4002('0x84')](_0x379646,_0x1f8501)){if(!this['variables'][_0x402246[_0x4002('0x44')]]){this[_0x4002('0x43')][_0x402246[_0x4002('0x44')]]={};}this['variables'][_0x402246[_0x4002('0x44')]][_0x1f8501]=_0x402246['value'];}}catch(_0x5af2d4){logger[_0x4002('0x48')](_0x5af2d4[_0x4002('0x49')]);}};module[_0x4002('0x85')]=VoiceAgentReport; \ No newline at end of file +var _0x2b22=['../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','channels','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','varset','hangup','syncHangup','attendedtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','prototype','log','info','format','%s|%s','uniqueid','membername','exten','join','addTime','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','interface','calleridnum','emit','destchannel','calleridname','destcalleridname','accountcode','channel','context','queue','inbound','agent','called','variables','custom:agentcalled','user:%s','user:called','CALLED','error','stack','isNil','holdtime','ringtime','connect','agentconnectAt','agentcalledAt','custom:agentconnect','CONNECT','find','updateStatusRealtime','rejected','agentringnoanswerAt','syncQueueCallerAbandon','assign','position','abandoned','custom:agentqueuecallerabandon','CALLERABANDON','syncAgentComplete','transfer','complete','acw','acwTimeout','agentcompleteAt','talktime','COMPLETE','clear','cause','answered_elsewhere','destuniqueid','custom:agentansweredelsewhere','custom:agentcomplete','user:agentcomplete','HANGUP','custom:voiceAgentReport','cause-txt','recalculate','user:save','origtransfererchannel','ATTENDED','secondtransferercontext','transfertargetchannel','BLIND','transfereeuniqueid','syncVarSet','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','variable','includes','value','lodash','moment','util','ioredis','../../../config/environment'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x2b22,0xf9));var _0x22b2=function(_0x1f07af,_0x4b1fc5){_0x1f07af=_0x1f07af-0x0;var _0x24dd42=_0x2b22[_0x1f07af];return _0x24dd42;};'use strict';var _=require(_0x22b2('0x0'));var moment=require(_0x22b2('0x1'));var util=require(_0x22b2('0x2'));var Redis=require(_0x22b2('0x3'));var config=require(_0x22b2('0x4'));var logger=require(_0x22b2('0x5'))(_0x22b2('0x6'));var ami=require(_0x22b2('0x7'));config[_0x22b2('0x8')]=_[_0x22b2('0x9')](config[_0x22b2('0x8')],{'host':_0x22b2('0xa'),'port':0x18eb});var io=require(_0x22b2('0xb'))(new Redis(config[_0x22b2('0x8')]));function VoiceAgentReport(_0x4ce298){this[_0x22b2('0xc')]=_0x4ce298[_0x22b2('0xc')];this[_0x22b2('0xd')]=_0x4ce298[_0x22b2('0xd')];this[_0x22b2('0xe')]={};this['variables']={};ami['on'](_0x22b2('0xf'),this[_0x22b2('0x10')][_0x22b2('0x11')](this));ami['on'](_0x22b2('0x12'),this[_0x22b2('0x13')]['bind'](this));ami['on'](_0x22b2('0x14'),this[_0x22b2('0x15')]['bind'](this));ami['on'](_0x22b2('0x16'),this['syncQueueCallerAbandon'][_0x22b2('0x11')](this));ami['on'](_0x22b2('0x17'),this['syncAgentComplete'][_0x22b2('0x11')](this));ami['on'](_0x22b2('0x18'),this['syncVarSet'][_0x22b2('0x11')](this));ami['on'](_0x22b2('0x19'),this[_0x22b2('0x1a')][_0x22b2('0x11')](this));ami['on'](_0x22b2('0x1b'),this['syncAttendedTransfer'][_0x22b2('0x11')](this));ami['on']('blindtransfer',this[_0x22b2('0x1c')]['bind'](this));ami['on'](_0x22b2('0x1d'),this['syncMusicOnHoldStart'][_0x22b2('0x11')](this));ami['on'](_0x22b2('0x1e'),this[_0x22b2('0x1f')][_0x22b2('0x11')](this));}VoiceAgentReport[_0x22b2('0x20')][_0x22b2('0x21')]=function(_0x2fa806,_0x257b64){logger[_0x22b2('0x22')](util[_0x22b2('0x23')](_0x22b2('0x24'),_0x2fa806,[_0x257b64[_0x22b2('0x25')],_0x257b64[_0x22b2('0x26')],_0x257b64['queue'],_0x257b64[_0x22b2('0x27')],_0x257b64['calleridnum']][_0x22b2('0x28')]('|')));};VoiceAgentReport['prototype'][_0x22b2('0x29')]=function(_0x59bf7f,_0x2bfbef){return moment(_0x59bf7f)['add'](_0x2bfbef,_0x22b2('0x2a'))[_0x22b2('0x23')](_0x22b2('0x2b'));};VoiceAgentReport[_0x22b2('0x20')][_0x22b2('0x2c')]=function(_0x513fa0,_0x497ed1){return moment(_0x513fa0)[_0x22b2('0x2d')](moment(_0x497ed1),_0x22b2('0x2a'));};VoiceAgentReport[_0x22b2('0x20')]['syncAgentCalled']=function(_0x4975cc){try{var _0x3751c4=this[_0x22b2('0xd')][_0x4975cc[_0x22b2('0x2e')]];if(!_['isNil'](_0x3751c4)){_0x3751c4=_['assign'](_0x3751c4,{'queue':_0x4975cc['queue'],'destconnectedlinenum':_0x4975cc[_0x22b2('0x2f')]});io[_0x22b2('0x30')]('user:save',_0x3751c4);}var _0x36caef=this[_0x22b2('0xe')][_0x4975cc[_0x22b2('0x31')]]={'agentcalledAt':moment()[_0x22b2('0x23')](_0x22b2('0x2b')),'calleridnum':_0x4975cc[_0x22b2('0x2f')],'calleridname':_0x4975cc[_0x22b2('0x32')],'connectedlinenum':_0x4975cc['destcalleridnum'],'connectedlinename':_0x4975cc[_0x22b2('0x33')],'accountcode':_0x4975cc[_0x22b2('0x34')],'destaccountcode':_0x4975cc['destaccountcode'],'channel':_0x4975cc[_0x22b2('0x35')],'destchannel':_0x4975cc[_0x22b2('0x31')],'uniqueid':_0x4975cc[_0x22b2('0x25')],'destuniqueid':_0x4975cc['destuniqueid'],'context':_0x4975cc[_0x22b2('0x36')],'exten':_0x4975cc[_0x22b2('0x27')],'priority':_0x4975cc['priority'],'queue':_0x4975cc[_0x22b2('0x37')],'type':this[_0x22b2('0xc')][_0x4975cc[_0x22b2('0x37')]]?this['voiceQueues'][_0x4975cc[_0x22b2('0x37')]]['type']||_0x22b2('0x38'):_0x22b2('0x38'),'interface':_0x4975cc[_0x22b2('0x2e')],'membername':_0x4975cc['membername'],'agentconnect':![],'agentconnectAt':null,'holdtime':0x0,'ringtime':0x0,'agentcomplete':![],'agentcompleteAt':null,'talktime':0x0,'agentringnoanswer':![],'agentringnoanswerAt':null,'reason':_0x22b2('0x39'),'transfer':![],'transferAt':null,'transfertype':null,'transferuniqueid':null,'transfercontext':null,'transferextension':null,'position':null,'originalposition':null,'cause':'','cause-txt':'','UserId':this[_0x22b2('0xd')][_0x4975cc[_0x22b2('0x2e')]]?this['agents'][_0x4975cc[_0x22b2('0x2e')]]['id']:null,'lastevent':_0x22b2('0x3a'),'agentacw':![],'acwtime':0x0,'variables':this[_0x22b2('0x3b')][_0x4975cc[_0x22b2('0x35')]]?this[_0x22b2('0x3b')][_0x4975cc[_0x22b2('0x35')]]:{}};ami['emit'](_0x22b2('0x3c'),_0x36caef);io['to'](util['format'](_0x22b2('0x3d'),_0x36caef['membername']))[_0x22b2('0x30')](_0x22b2('0x3e'),_0x36caef);this[_0x22b2('0x21')](_0x22b2('0x3f'),this[_0x22b2('0xe')][_0x4975cc[_0x22b2('0x31')]]);}catch(_0x2b098e){logger[_0x22b2('0x40')](_0x2b098e[_0x22b2('0x41')]);}};VoiceAgentReport[_0x22b2('0x20')][_0x22b2('0x13')]=function(_0x4333be){try{var _0x115652=this[_0x22b2('0xe')][_0x4333be[_0x22b2('0x31')]];if(!_[_0x22b2('0x42')](_0x115652)){_0x115652=_['assign'](_0x115652,{'holdtime':parseInt(_0x4333be[_0x22b2('0x43')],0xa),'ringtime':parseInt(_0x4333be[_0x22b2('0x44')],0xa),'agentconnect':!![],'lastevent':_0x22b2('0x45')});_0x115652[_0x22b2('0x46')]=this['addTime'](_0x115652[_0x22b2('0x47')],_0x115652['ringtime']);ami[_0x22b2('0x30')](_0x22b2('0x48'),_0x115652);io['to'](util['format']('user:%s',_0x115652[_0x22b2('0x26')]))[_0x22b2('0x30')]('user:agentconnect',_0x115652);this[_0x22b2('0x21')](_0x22b2('0x49'),_0x115652);}}catch(_0x207475){logger['error'](_0x207475[_0x22b2('0x41')]);}};VoiceAgentReport[_0x22b2('0x20')]['syncMusicOnHoldStart']=function(_0x3e36ea){try{var _0x17c777=_[_0x22b2('0x4a')](this[_0x22b2('0xe')],{'channel':_0x3e36ea[_0x22b2('0x35')],'agentconnect':!![]});if(!_[_0x22b2('0x42')](_0x17c777)){if(!_[_0x22b2('0x42')](this[_0x22b2('0xd')][_0x17c777[_0x22b2('0x2e')]])){this[_0x22b2('0xd')][_0x17c777[_0x22b2('0x2e')]]['onhold']=!![];this[_0x22b2('0xd')][_0x17c777[_0x22b2('0x2e')]]['updateStatusRealtime']();}}}catch(_0x462831){logger[_0x22b2('0x40')](_0x462831[_0x22b2('0x41')]);}};VoiceAgentReport[_0x22b2('0x20')][_0x22b2('0x1f')]=function(_0x1cf973){try{var _0x10915e=_[_0x22b2('0x4a')](this['channels'],{'channel':_0x1cf973[_0x22b2('0x35')],'agentconnect':!![]});if(!_[_0x22b2('0x42')](_0x10915e)){if(!_[_0x22b2('0x42')](this[_0x22b2('0xd')][_0x10915e[_0x22b2('0x2e')]])){this[_0x22b2('0xd')][_0x10915e[_0x22b2('0x2e')]]['onhold']=![];this[_0x22b2('0xd')][_0x10915e[_0x22b2('0x2e')]][_0x22b2('0x4b')]();}}}catch(_0x1be8cc){logger[_0x22b2('0x40')](_0x1be8cc[_0x22b2('0x41')]);}};VoiceAgentReport[_0x22b2('0x20')]['syncAgentRingNoAnswer']=function(_0x56cd53){try{var _0x20ea4f=this['channels'][_0x56cd53[_0x22b2('0x31')]];if(!_[_0x22b2('0x42')](_0x20ea4f)){_0x20ea4f=_['assign'](_0x20ea4f,{'ringtime':parseInt(_0x56cd53[_0x22b2('0x44')],0xa)/0x3e8,'agentringnoanswer':!![],'reason':_0x22b2('0x4c'),'lastevent':'rejected'});_0x20ea4f[_0x22b2('0x4d')]=this[_0x22b2('0x29')](_0x20ea4f['agentcalledAt'],_0x20ea4f[_0x22b2('0x44')]);ami['emit']('custom:agentringnoanswer',_0x20ea4f);this[_0x22b2('0x21')]('RINGNOANSWER',_0x20ea4f);}}catch(_0x3cb209){logger[_0x22b2('0x40')](_0x3cb209[_0x22b2('0x41')]);}};VoiceAgentReport[_0x22b2('0x20')][_0x22b2('0x4e')]=function(_0x52583c){try{for(var _0x3fd675 in this[_0x22b2('0xe')]){var _0x573f0d=this[_0x22b2('0xe')][_0x3fd675];if(!_[_0x22b2('0x42')](_0x573f0d)&&_0x573f0d[_0x22b2('0x35')]==_0x52583c[_0x22b2('0x35')]){_0x573f0d=_[_0x22b2('0x4f')](_0x573f0d,{'holdtime':parseInt(_0x52583c[_0x22b2('0x43')],0xa),'position':parseInt(_0x52583c[_0x22b2('0x50')],0xa),'originalposition':parseInt(_0x52583c['originalposition'],0xa),'agentringnoanswer':!![],'agentringnoanswerAt':moment()[_0x22b2('0x23')](_0x22b2('0x2b')),'reason':_0x22b2('0x51'),'lastevent':_0x22b2('0x51')});ami[_0x22b2('0x30')](_0x22b2('0x52'),_0x573f0d);this['log'](_0x22b2('0x53'),_0x573f0d);}}}catch(_0x550107){logger['error'](_0x550107[_0x22b2('0x41')]);}};VoiceAgentReport[_0x22b2('0x20')][_0x22b2('0x54')]=function(_0x33d331){try{var _0x5c33f5=this[_0x22b2('0xe')][_0x33d331[_0x22b2('0x31')]];if(!_[_0x22b2('0x42')](_0x5c33f5)){_0x5c33f5=_[_0x22b2('0x4f')](_0x5c33f5,{'talktime':parseInt(_0x33d331['talktime'],0xa),'reason':_0x33d331['reason']==_0x22b2('0x55')?_0x22b2('0x39'):_0x33d331['reason'],'agentcomplete':!![],'lastevent':_0x22b2('0x56'),'agentacw':this[_0x22b2('0xc')][_0x5c33f5[_0x22b2('0x37')]]&&this[_0x22b2('0xc')][_0x5c33f5[_0x22b2('0x37')]][_0x22b2('0x57')]?!![]:![],'acwtime':this['voiceQueues'][_0x5c33f5['queue']]&&this['voiceQueues'][_0x5c33f5[_0x22b2('0x37')]]['acw']?this[_0x22b2('0xc')][_0x5c33f5[_0x22b2('0x37')]][_0x22b2('0x58')]:0x0});_0x5c33f5[_0x22b2('0x59')]=this['addTime'](_0x5c33f5['agentconnectAt'],_0x5c33f5[_0x22b2('0x5a')]);this[_0x22b2('0x21')](_0x22b2('0x5b'),_0x5c33f5);}}catch(_0x55c5c5){logger[_0x22b2('0x40')](_0x55c5c5[_0x22b2('0x41')]);}};VoiceAgentReport[_0x22b2('0x20')][_0x22b2('0x5c')]=function(_0x28d983){try{switch(_0x28d983[_0x22b2('0x5d')]){case 0x1a:_0x28d983=_[_0x22b2('0x4f')](_0x28d983,{'agentringnoanswer':!![],'reason':_0x22b2('0x5e'),'lastevent':_0x22b2('0x5e')});var _0x3d5df9=_[_0x22b2('0x4a')](this[_0x22b2('0xe')],{'channel':_0x28d983['channel'],'agentconnect':!![]});if(!_[_0x22b2('0x42')](_0x3d5df9)){_0x28d983=_['assign'](_0x28d983,{'agentringnoanswerAt':_0x3d5df9[_0x22b2('0x46')],'answeredelsewheremembername':_0x3d5df9[_0x22b2('0x26')],'answeredelsewheredestinationuniqueid':_0x3d5df9[_0x22b2('0x5f')]});}ami['emit'](_0x22b2('0x60'),_0x28d983);break;}if(_0x28d983['agentcomplete']){ami[_0x22b2('0x30')](_0x22b2('0x61'),_0x28d983);io['to'](util['format'](_0x22b2('0x3d'),_0x28d983[_0x22b2('0x26')]))[_0x22b2('0x30')](_0x22b2('0x62'),_0x28d983);}this[_0x22b2('0x21')](_0x22b2('0x63'),_0x28d983);ami[_0x22b2('0x30')](_0x22b2('0x64'),_0x28d983);if(this[_0x22b2('0xe')][_0x28d983[_0x22b2('0x31')]]){delete this[_0x22b2('0xe')][_0x28d983[_0x22b2('0x31')]];}}catch(_0xcf41d0){logger[_0x22b2('0x40')](_0xcf41d0);}};VoiceAgentReport[_0x22b2('0x20')][_0x22b2('0x1a')]=function(_0x5e4d8f){try{var _0x99db59=this[_0x22b2('0xe')][_0x5e4d8f[_0x22b2('0x35')]];if(!_[_0x22b2('0x42')](_0x99db59)){_0x99db59=_[_0x22b2('0x4f')](_0x99db59,{'cause':parseInt(_0x5e4d8f[_0x22b2('0x5d')],0xa),'cause-txt':_0x5e4d8f[_0x22b2('0x65')]});if(_0x99db59[_0x22b2('0x66')]){_0x99db59=_[_0x22b2('0x4f')](_0x99db59,{'agentcomplete':!![],'agentcompleteAt':moment()[_0x22b2('0x23')](_0x22b2('0x2b')),'lastevent':_0x22b2('0x56'),'agentacw':this[_0x22b2('0xc')][_0x99db59[_0x22b2('0x37')]]&&this[_0x22b2('0xc')][_0x99db59['queue']][_0x22b2('0x57')]?!![]:![],'acwtime':this[_0x22b2('0xc')][_0x99db59[_0x22b2('0x37')]]&&this[_0x22b2('0xc')][_0x99db59['queue']][_0x22b2('0x57')]?this[_0x22b2('0xc')][_0x99db59[_0x22b2('0x37')]][_0x22b2('0x58')]:0x0});_0x99db59[_0x22b2('0x5a')]=this[_0x22b2('0x2c')](_0x99db59[_0x22b2('0x59')],_0x99db59[_0x22b2('0x46')]);}var _0x27bcb8=this['agents'][_0x99db59[_0x22b2('0x2e')]];if(!_[_0x22b2('0x42')](_0x27bcb8)){_0x27bcb8=_[_0x22b2('0x4f')](_0x27bcb8,{'queue':null,'destconnectedlinenum':null});io[_0x22b2('0x30')](_0x22b2('0x67'),_0x27bcb8);}setTimeout(this[_0x22b2('0x5c')]['bind'](this,_0x99db59),0x3e8);}if(this[_0x22b2('0x3b')][_0x5e4d8f[_0x22b2('0x35')]]){delete this['variables'][_0x5e4d8f[_0x22b2('0x35')]];}}catch(_0x44bf18){logger[_0x22b2('0x40')](_0x44bf18['stack']);}};VoiceAgentReport[_0x22b2('0x20')]['syncAttendedTransfer']=function(_0x403789){try{var _0x5015f1=this[_0x22b2('0xe')][_0x403789[_0x22b2('0x68')]];if(!_[_0x22b2('0x42')](_0x5015f1)){_0x5015f1=_[_0x22b2('0x4f')](_0x5015f1,{'transfer':!![],'transferAt':moment()[_0x22b2('0x23')](_0x22b2('0x2b')),'transfertype':_0x22b2('0x69'),'agentcomplete':!![],'agentcompleteAt':moment()[_0x22b2('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'transferuniqueid':_0x403789['secondtransfereruniqueid'],'transfercontext':_0x403789['secondtransfererexten'],'transferextension':_0x403789[_0x22b2('0x6a')],'reason':'transfer','lastevent':_0x22b2('0x56'),'agentacw':this[_0x22b2('0xc')][_0x5015f1[_0x22b2('0x37')]]&&this[_0x22b2('0xc')][_0x5015f1[_0x22b2('0x37')]][_0x22b2('0x57')]?!![]:![],'acwtime':this['voiceQueues'][_0x5015f1[_0x22b2('0x37')]]&&this[_0x22b2('0xc')][_0x5015f1['queue']][_0x22b2('0x57')]?this[_0x22b2('0xc')][_0x5015f1[_0x22b2('0x37')]][_0x22b2('0x58')]:0x0});_0x5015f1[_0x22b2('0x5a')]=this['diffTime'](_0x5015f1[_0x22b2('0x59')],_0x5015f1[_0x22b2('0x46')]);this['log'](_0x22b2('0x69'),_0x5015f1);}if(!_[_0x22b2('0x42')](this['channels'][_0x403789[_0x22b2('0x6b')]])){this[_0x22b2('0xe')][_0x403789['transfertargetchannel']]['recalculate']=!![];}}catch(_0x99bcdf){logger['error'](_0x99bcdf[_0x22b2('0x41')]);}};VoiceAgentReport[_0x22b2('0x20')][_0x22b2('0x1c')]=function(_0x333589){try{var _0x470727=this['channels'][_0x333589['transfererchannel']];if(!_[_0x22b2('0x42')](_0x470727)){_0x470727=_[_0x22b2('0x4f')](_0x470727,{'transfer':!![],'transferAt':moment()[_0x22b2('0x23')](_0x22b2('0x2b')),'transfertype':_0x22b2('0x6c'),'transferuniqueid':_0x333589[_0x22b2('0x6d')],'transfercontext':_0x333589[_0x22b2('0x36')],'transferextension':_0x333589['extension'],'agentcomplete':!![],'agentcompleteAt':moment()[_0x22b2('0x23')](_0x22b2('0x2b')),'reason':_0x22b2('0x55'),'lastevent':_0x22b2('0x56'),'agentacw':this['voiceQueues'][_0x470727[_0x22b2('0x37')]]&&this[_0x22b2('0xc')][_0x470727[_0x22b2('0x37')]][_0x22b2('0x57')]?!![]:![],'acwtime':this[_0x22b2('0xc')][_0x470727[_0x22b2('0x37')]]&&this[_0x22b2('0xc')][_0x470727[_0x22b2('0x37')]]['acw']?this['voiceQueues'][_0x470727[_0x22b2('0x37')]][_0x22b2('0x58')]:0x0});_0x470727[_0x22b2('0x66')]=!![];this[_0x22b2('0x21')](_0x22b2('0x6c'),_0x470727);}}catch(_0x593deb){logger[_0x22b2('0x40')](_0x593deb[_0x22b2('0x41')]);}};VoiceAgentReport[_0x22b2('0x20')][_0x22b2('0x6e')]=function(_0x5efcb5){var _0x4b9bfd=[_0x22b2('0x6f'),'rtpaudioqosbridged',_0x22b2('0x70'),_0x22b2('0x71'),'rtpaudioqosloss',_0x22b2('0x72'),_0x22b2('0x73'),_0x22b2('0x74'),_0x22b2('0x75'),'sipuri',_0x22b2('0x76'),'bridgepvtcallid',_0x22b2('0x77'),_0x22b2('0x78'),'memberinterface',_0x22b2('0x79'),_0x22b2('0x26'),_0x22b2('0x7a'),_0x22b2('0x7b')];try{var _0x5fb7b7=_['keys'](_0x5efcb5[_0x22b2('0x7c')])[0x0];if(!_[_0x22b2('0x42')](_0x5fb7b7)&&!_[_0x22b2('0x7d')](_0x4b9bfd,_0x5fb7b7)){if(!this[_0x22b2('0x3b')][_0x5efcb5[_0x22b2('0x35')]]){this[_0x22b2('0x3b')][_0x5efcb5['channel']]={};}this['variables'][_0x5efcb5[_0x22b2('0x35')]][_0x5fb7b7]=_0x5efcb5[_0x22b2('0x7e')];}}catch(_0x61d919){logger[_0x22b2('0x40')](_0x61d919[_0x22b2('0x41')]);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 909d8f6..95790a7 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 _0xb01c=['BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','not_inuse','inuse','unavailable','ringinuse','onhold','set','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','agents','syncNewExten','bind','newchannel','syncNewChannel','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','actionCoreShowChannels','catch','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','channels','merge','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','OutgoingSpoolFailed','format','disposition','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','exten','user:%s','channel','name','user:agentconnect','[syncNewChannel][VoiceCallReport]','application','appdata','applicationdata','toLowerCase','starttime','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','cdr(','match','queue','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','rec','syncVarSet','variable','mixmonitor_filename','syncMixMonitorFilename','value','xmd-callerid','callerid','xmd-cdrtype','type','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','endtime','billableseconds','omit','user:agentcomplete','accountcode','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension'];(function(_0x4309d9,_0x5b0b57){var _0x1af166=function(_0x20d871){while(--_0x20d871){_0x4309d9['push'](_0x4309d9['shift']());}};_0x1af166(++_0x5b0b57);}(_0xb01c,0x9f));var _0xcb01=function(_0x2cedc6,_0x10b12e){_0x2cedc6=_0x2cedc6-0x0;var _0x123a85=_0xb01c[_0x2cedc6];return _0x123a85;};'use strict';var BPromise=require(_0xcb01('0x0'));var _=require(_0xcb01('0x1'));var moment=require(_0xcb01('0x2'));var util=require(_0xcb01('0x3'));var path=require('path');var Redis=require(_0xcb01('0x4'));var config=require(_0xcb01('0x5'));var logger=require(_0xcb01('0x6'))(_0xcb01('0x7'));var ami=require('../ami');var Channel=require(_0xcb01('0x8'));var statusDesc=[_0xcb01('0x9'),_0xcb01('0xa'),_0xcb01('0xb'),'busy','invalid',_0xcb01('0xc'),'ringing',_0xcb01('0xd'),_0xcb01('0xe')];var applications=[_0xcb01('0xf'),'queue','agi',_0xcb01('0x10'),'playback',_0xcb01('0x11')];var dispositions=[_0xcb01('0x12'),_0xcb01('0x13'),_0xcb01('0x13'),_0xcb01('0x12'),'NO\x20ANSWER',_0xcb01('0x12'),'ANSWERED',_0xcb01('0x14'),_0xcb01('0x13'),_0xcb01('0x13'),_0xcb01('0x13')];var actions={};config[_0xcb01('0x15')]=_[_0xcb01('0x16')](config[_0xcb01('0x15')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcb01('0x15')]));function VoiceCallReport(_0x239b25){this['channels']=_0x239b25['channels'];this[_0xcb01('0x17')]=_0x239b25[_0xcb01('0x17')];ami['on']('coreshowchannel',this[_0xcb01('0x18')][_0xcb01('0x19')](this));ami['on']('newexten',this[_0xcb01('0x18')][_0xcb01('0x19')](this));ami['on'](_0xcb01('0x1a'),this[_0xcb01('0x1b')][_0xcb01('0x19')](this));ami['on']('newstate',this[_0xcb01('0x1c')][_0xcb01('0x19')](this));ami['on'](_0xcb01('0x1d'),this['syncVarSet']['bind'](this));ami['on'](_0xcb01('0x1e'),this[_0xcb01('0x1f')]['bind'](this));ami['on'](_0xcb01('0x20'),this[_0xcb01('0x21')][_0xcb01('0x19')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xcb01('0x19')](this));ami['on'](_0xcb01('0x22'),this[_0xcb01('0x23')][_0xcb01('0x19')](this));ami['on'](_0xcb01('0x24'),this['syncMusicOnHoldStart'][_0xcb01('0x19')](this));ami['on'](_0xcb01('0x25'),this[_0xcb01('0x26')][_0xcb01('0x19')](this));return BPromise['resolve']()['then'](ami[_0xcb01('0x27')]())[_0xcb01('0x28')](function(_0x46f2e2){console['log'](_0x46f2e2);});}VoiceCallReport[_0xcb01('0x29')][_0xcb01('0x2a')]=function(_0x3ae3b2){return _0x3ae3b2!==null&&!_[_0xcb01('0x2b')](_0x3ae3b2);};VoiceCallReport[_0xcb01('0x29')][_0xcb01('0x2c')]=function(_0x23cad5,_0x4941eb,_0x190557){io['to'](_0x23cad5)[_0xcb01('0x2c')](_0x4941eb,_0x190557);};VoiceCallReport['prototype'][_0xcb01('0x21')]=function(_0x577d4e){try{if(this[_0xcb01('0x2a')](_0x577d4e)){if(_0x577d4e[_0xcb01('0x2d')]===_0x577d4e[_0xcb01('0x2e')]){if(!_[_0xcb01('0x2b')](this[_0xcb01('0x2f')][_0x577d4e[_0xcb01('0x2d')]])){_[_0xcb01('0x30')](this[_0xcb01('0x2f')][_0x577d4e[_0xcb01('0x2d')]],_['pick'](_0x577d4e,_[_0xcb01('0x31')](this[_0xcb01('0x2f')][_0x577d4e[_0xcb01('0x2d')]])));}}}}catch(_0x2136af){logger[_0xcb01('0x32')](_0xcb01('0x33'),util[_0xcb01('0x34')](_0x2136af,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x14e0f6){try{if(this[_0xcb01('0x2a')](_0x14e0f6)){if(_0x14e0f6[_0xcb01('0x2d')]===_0x14e0f6[_0xcb01('0x2e')]&&_0x14e0f6['channel']!=_0xcb01('0x35')){if(_[_0xcb01('0x2b')](this[_0xcb01('0x2f')][_0x14e0f6[_0xcb01('0x2d')]])){this['channels'][_0x14e0f6[_0xcb01('0x2d')]]=new Channel();this['channels'][_0x14e0f6['uniqueid']]['starttime']=moment()[_0xcb01('0x36')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb01('0x2f')][_0x14e0f6[_0xcb01('0x2d')]][_0xcb01('0x37')]=dispositions[_[_0xcb01('0x38')](_0x14e0f6[_0xcb01('0x39')])];_['merge'](this[_0xcb01('0x2f')][_0x14e0f6['uniqueid']],_['pick'](_0x14e0f6,_[_0xcb01('0x31')](this[_0xcb01('0x2f')][_0x14e0f6[_0xcb01('0x2d')]])));if(_0x14e0f6[_0xcb01('0x3a')]===_0xcb01('0x3b')){if(this['agents'][_0x14e0f6['channel'][_0xcb01('0x3c')]('-')[0x0]]){this[_0xcb01('0x17')][_0x14e0f6['channel'][_0xcb01('0x3c')]('-')[0x0]][_0xcb01('0x3d')]=_0x14e0f6[_0xcb01('0x3e')];this[_0xcb01('0x2c')](util['format'](_0xcb01('0x3f'),this['agents'][_0x14e0f6[_0xcb01('0x40')][_0xcb01('0x3c')]('-')[0x0]][_0xcb01('0x41')]),_0xcb01('0x42'),{'destaccountcode':this[_0xcb01('0x17')][_0x14e0f6[_0xcb01('0x40')][_0xcb01('0x3c')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x14e0f6[_0xcb01('0x3e')]});}}}}}}catch(_0x1f4171){logger[_0xcb01('0x32')](_0xcb01('0x43'),util['inspect'](_0x1f4171,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xcb01('0x18')]=function(_0x1da190){try{if(this[_0xcb01('0x2a')](_0x1da190)){if(_0x1da190[_0xcb01('0x2d')]===_0x1da190['linkedid']&&_0x1da190[_0xcb01('0x3e')]!='h'&&_0x1da190[_0xcb01('0x40')]!=_0xcb01('0x35')){_0x1da190[_0xcb01('0x44')]=_0x1da190[_0xcb01('0x44')]['toLowerCase']();_0x1da190['applicationdata']=(_0x1da190[_0xcb01('0x45')]||_0x1da190[_0xcb01('0x46')])[_0xcb01('0x47')]();if(_[_0xcb01('0x2b')](this['channels'][_0x1da190['uniqueid']])){this[_0xcb01('0x2f')][_0x1da190[_0xcb01('0x2d')]]=new Channel();this['channels'][_0x1da190[_0xcb01('0x2d')]][_0xcb01('0x48')]=_0x1da190[_0xcb01('0x49')]?moment()['subtract'](moment['duration'](_0x1da190[_0xcb01('0x49')])['seconds'](),_0xcb01('0x4a'))[_0xcb01('0x36')](_0xcb01('0x4b')):moment()[_0xcb01('0x36')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb01('0x2f')][_0x1da190['uniqueid']]['disposition']=_0xcb01('0x12');}_[_0xcb01('0x30')](this['channels'][_0x1da190[_0xcb01('0x2d')]],_['pick'](_0x1da190,_[_0xcb01('0x31')](this[_0xcb01('0x2f')][_0x1da190[_0xcb01('0x2d')]])));if(_[_0xcb01('0x4c')](applications,_0x1da190[_0xcb01('0x44')])){this[_0xcb01('0x2f')][_0x1da190['uniqueid']][_0xcb01('0x4d')]=_0x1da190[_0xcb01('0x44')];this[_0xcb01('0x2f')][_0x1da190[_0xcb01('0x2d')]][_0xcb01('0x4e')]=_0x1da190[_0xcb01('0x46')];if(_0x1da190[_0xcb01('0x44')]===_0xcb01('0xf')&&_['startsWith'](_0x1da190['applicationdata'],_0xcb01('0x4f'))){var _0x17b477=_0x1da190['applicationdata'][_0xcb01('0x3c')]('=');var _0x452800=_0x17b477[0x0][_0xcb01('0x50')](/cdr\((.*)\)/);if(_0x452800){this['channels'][_0x1da190[_0xcb01('0x2d')]][_0x452800[0x1]]=_0x17b477[0x1];}}else if(_0x1da190[_0xcb01('0x44')]==='queue'){this['channels'][_0x1da190[_0xcb01('0x2d')]][_0xcb01('0x51')]=_0x1da190[_0xcb01('0x46')][_0xcb01('0x3c')](',')[0x0];}}}}}catch(_0x29be2a){logger[_0xcb01('0x32')](_0xcb01('0x52'),util['inspect'](_0x29be2a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb01('0x29')][_0xcb01('0x1c')]=function(_0x2de2ae){try{if(this[_0xcb01('0x2a')](_0x2de2ae)){if(_0x2de2ae['uniqueid']!==_0x2de2ae[_0xcb01('0x2e')]){if(this[_0xcb01('0x2f')][_0x2de2ae[_0xcb01('0x2e')]]){if(_0x2de2ae[_0xcb01('0x39')]==='6'){if(!this[_0xcb01('0x2f')][_0x2de2ae[_0xcb01('0x2e')]][_0xcb01('0x53')]){var _0x4eb567=moment();this[_0xcb01('0x2f')][_0x2de2ae['linkedid']]['answered']=!![];this[_0xcb01('0x2f')][_0x2de2ae['linkedid']][_0xcb01('0x54')]=_0x4eb567['format'](_0xcb01('0x4b'));if(this['channels'][_0x2de2ae[_0xcb01('0x2e')]][_0xcb01('0x48')]){this[_0xcb01('0x2f')][_0x2de2ae['linkedid']][_0xcb01('0x55')]=_0x4eb567[_0xcb01('0x56')](this['channels'][_0x2de2ae[_0xcb01('0x2e')]]['starttime'],'seconds');}}this[_0xcb01('0x2f')][_0x2de2ae[_0xcb01('0x2e')]][_0xcb01('0x2e')]=_0x2de2ae[_0xcb01('0x2d')];if(_0x2de2ae[_0xcb01('0x57')]!==_0xcb01('0x58')){this[_0xcb01('0x2f')][_0x2de2ae[_0xcb01('0x2e')]][_0xcb01('0x59')]=_0x2de2ae['calleridnum'];}this[_0xcb01('0x2f')][_0x2de2ae['linkedid']][_0xcb01('0x5a')]=_0x2de2ae[_0xcb01('0x5b')];this['channels'][_0x2de2ae[_0xcb01('0x2e')]][_0xcb01('0x5c')]=_0x2de2ae['channel'];this[_0xcb01('0x2f')][_0x2de2ae[_0xcb01('0x2e')]]['disposition']=dispositions[_[_0xcb01('0x38')](_0x2de2ae[_0xcb01('0x39')])];if(this[_0xcb01('0x17')][_0x2de2ae[_0xcb01('0x40')][_0xcb01('0x3c')]('-')[0x0]]){this[_0xcb01('0x2f')][_0x2de2ae[_0xcb01('0x2e')]]['UserId']=this['agents'][_0x2de2ae[_0xcb01('0x40')][_0xcb01('0x3c')]('-')[0x0]]['id'];this[_0xcb01('0x2f')][_0x2de2ae[_0xcb01('0x2e')]]['membername']=this[_0xcb01('0x17')][_0x2de2ae[_0xcb01('0x40')][_0xcb01('0x3c')]('-')[0x0]][_0xcb01('0x41')];}}}}else{if(this[_0xcb01('0x2f')][_0x2de2ae[_0xcb01('0x2d')]]){if(_0x2de2ae['channelstate']==='6'){if(this[_0xcb01('0x17')][_0x2de2ae['channel'][_0xcb01('0x3c')]('-')[0x0]]){this['channels'][_0x2de2ae[_0xcb01('0x2d')]][_0xcb01('0x5d')]=this['agents'][_0x2de2ae[_0xcb01('0x40')]['split']('-')[0x0]]['id'];this[_0xcb01('0x2f')][_0x2de2ae['uniqueid']][_0xcb01('0x5e')]=this['agents'][_0x2de2ae['channel'][_0xcb01('0x3c')]('-')[0x0]][_0xcb01('0x41')];}}}}}}catch(_0x45231b){logger[_0xcb01('0x32')](_0xcb01('0x5f'),util[_0xcb01('0x34')](_0x45231b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb01('0x29')]['syncMixMonitorFilename']=function(_0x73eeb9,_0x515230){if(this['channels'][_0x73eeb9]){this['channels'][_0x73eeb9][_0xcb01('0x60')]=!![];if(_[_0xcb01('0x61')](_0x515230,_0xcb01('0x62'))){_0x515230=_0x515230[_0xcb01('0x63')]('.wav49',_0xcb01('0x64'));}this[_0xcb01('0x2f')][_0x73eeb9][_0xcb01('0x65')]=_0x515230;var _0x59193e=_[_0xcb01('0x66')](this[_0xcb01('0x2f')][_0x73eeb9][_0xcb01('0x67')],{'filename':_0x515230});if(_[_0xcb01('0x68')](_0x59193e)){this['channels'][_0x73eeb9]['monitors']['push']({'filename':_0x515230,'createdAt':moment()[_0xcb01('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xcb01('0x69')});}}};VoiceCallReport[_0xcb01('0x29')][_0xcb01('0x6a')]=function(_0x8f9a59){try{if(this[_0xcb01('0x2a')](_0x8f9a59)){if(this[_0xcb01('0x2f')][_0x8f9a59[_0xcb01('0x2d')]]&&_0x8f9a59[_0xcb01('0x40')]!='OutgoingSpoolFailed'){if(this[_0xcb01('0x2a')](_0x8f9a59[_0xcb01('0x6b')])){if(this[_0xcb01('0x2a')](_0x8f9a59[_0xcb01('0x6b')][_0xcb01('0x6c')])){this[_0xcb01('0x6d')](_0x8f9a59[_0xcb01('0x2d')],_0x8f9a59[_0xcb01('0x6e')]);}else if(this[_0xcb01('0x2a')](_0x8f9a59[_0xcb01('0x6b')]['xmd-phone'])){this[_0xcb01('0x2f')][_0x8f9a59[_0xcb01('0x2d')]][_0xcb01('0x57')]=_0x8f9a59[_0xcb01('0x6e')];}else if(this[_0xcb01('0x2a')](_0x8f9a59[_0xcb01('0x6b')][_0xcb01('0x6f')])){this[_0xcb01('0x2f')][_0x8f9a59[_0xcb01('0x2d')]][_0xcb01('0x70')]=_0x8f9a59[_0xcb01('0x6e')];}else if(this['isNotNull'](_0x8f9a59['variable'][_0xcb01('0x71')])){this[_0xcb01('0x2f')][_0x8f9a59[_0xcb01('0x2d')]][_0xcb01('0x72')]=_0x8f9a59['value'];}else if(this[_0xcb01('0x2a')](_0x8f9a59['variable']['xmd-queue'])){this[_0xcb01('0x2f')][_0x8f9a59[_0xcb01('0x2d')]][_0xcb01('0x51')]=_0x8f9a59[_0xcb01('0x6e')][_0xcb01('0x3c')](',')[0x0];}else if(this[_0xcb01('0x2a')](_0x8f9a59[_0xcb01('0x6b')]['xmd-originatecalleridnum'])){this[_0xcb01('0x2f')][_0x8f9a59[_0xcb01('0x2d')]][_0xcb01('0x73')]=_0x8f9a59['value'];}else if(this[_0xcb01('0x2a')](_0x8f9a59['variable'][_0xcb01('0x74')])){this[_0xcb01('0x2f')][_0x8f9a59['uniqueid']][_0xcb01('0x75')]=_0x8f9a59['value'];}else if(this[_0xcb01('0x2a')](_0x8f9a59['variable'][_0xcb01('0x76')])){this[_0xcb01('0x2f')][_0x8f9a59['uniqueid']][_0xcb01('0x77')]=_0x8f9a59[_0xcb01('0x6e')];}else if(this[_0xcb01('0x2a')](_0x8f9a59[_0xcb01('0x6b')][_0xcb01('0x78')])){this[_0xcb01('0x2f')][_0x8f9a59[_0xcb01('0x2d')]]['queue']=_0x8f9a59[_0xcb01('0x6e')];}else if(this[_0xcb01('0x2a')](_0x8f9a59[_0xcb01('0x6b')][_0xcb01('0x79')])){this[_0xcb01('0x2f')][_0x8f9a59[_0xcb01('0x2d')]][_0xcb01('0x7a')]=_0x8f9a59[_0xcb01('0x6e')];}}}else if(this['isNotNull'](_0x8f9a59[_0xcb01('0x6b')]['mixmonitor_filename'])){if(_0x8f9a59[_0xcb01('0x6e')]){var _0x7ed576=path[_0xcb01('0x7b')](_0x8f9a59[_0xcb01('0x6e')])[_0xcb01('0x41')];this[_0xcb01('0x6d')](_0x7ed576,_0x8f9a59[_0xcb01('0x6e')]);}}else if(this['channels'][_0x8f9a59[_0xcb01('0x2e')]]){if(this['isNotNull'](_0x8f9a59[_0xcb01('0x6b')])){if(this[_0xcb01('0x2a')](_0x8f9a59['variable']['sipcallid'])){this['channels'][_0x8f9a59[_0xcb01('0x2e')]]['sipcalllinkedid']=_0x8f9a59['value'];}}}}}catch(_0x34b441){logger['error']('[syncVarSet][VoiceCallReport]',util[_0xcb01('0x34')](_0x34b441,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xcb01('0x1f')]=function(_0x34bacf){try{if(this[_0xcb01('0x2a')](_0x34bacf)){if(this[_0xcb01('0x2f')][_0x34bacf[_0xcb01('0x2d')]]){var _0xc29103=moment();this[_0xcb01('0x2f')][_0x34bacf['uniqueid']][_0xcb01('0x7c')]=_0xc29103['format'](_0xcb01('0x4b'));this['channels'][_0x34bacf[_0xcb01('0x2d')]][_0xcb01('0x49')]=_0xc29103[_0xcb01('0x56')](this[_0xcb01('0x2f')][_0x34bacf['uniqueid']][_0xcb01('0x48')],_0xcb01('0x4a'));if(this['channels'][_0x34bacf[_0xcb01('0x2d')]]['answered']){this[_0xcb01('0x2f')][_0x34bacf[_0xcb01('0x2d')]]['billableseconds']=_0xc29103[_0xcb01('0x56')](this[_0xcb01('0x2f')][_0x34bacf['uniqueid']][_0xcb01('0x54')],'seconds');this[_0xcb01('0x2f')][_0x34bacf[_0xcb01('0x2d')]][_0xcb01('0x55')]=this[_0xcb01('0x2f')][_0x34bacf[_0xcb01('0x2d')]]['duration']-this[_0xcb01('0x2f')][_0x34bacf[_0xcb01('0x2d')]][_0xcb01('0x7d')];}if(_0x34bacf[_0xcb01('0x3a')]==='from-sip'){if(this[_0xcb01('0x17')][_0x34bacf['channel'][_0xcb01('0x3c')]('-')[0x0]]){this['agents'][_0x34bacf[_0xcb01('0x40')][_0xcb01('0x3c')]('-')[0x0]]=_[_0xcb01('0x7e')](this['agents'][_0x34bacf[_0xcb01('0x40')][_0xcb01('0x3c')]('-')[0x0]],[_0xcb01('0x3d')]);this[_0xcb01('0x2c')](util['format'](_0xcb01('0x3f'),this[_0xcb01('0x17')][_0x34bacf[_0xcb01('0x40')][_0xcb01('0x3c')]('-')[0x0]][_0xcb01('0x41')]),_0xcb01('0x7f'),{'destaccountcode':this[_0xcb01('0x17')][_0x34bacf[_0xcb01('0x40')][_0xcb01('0x3c')]('-')[0x0]][_0xcb01('0x80')]});}}ami[_0xcb01('0x2c')]('custom:voiceCallReport',this[_0xcb01('0x2f')][_0x34bacf['uniqueid']]);delete this[_0xcb01('0x2f')][_0x34bacf['uniqueid']];}}}catch(_0x4979a7){logger[_0xcb01('0x32')](_0xcb01('0x81'),util[_0xcb01('0x34')](_0x4979a7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb01('0x29')]['syncAttendedTransfer']=function(_0x2e4cd7){try{if(this['isNotNull'](_0x2e4cd7)){if(this['channels'][_0x2e4cd7[_0xcb01('0x82')]]){this[_0xcb01('0x2f')][_0x2e4cd7['transfereeuniqueid']][_0xcb01('0x83')]=_0x2e4cd7[_0xcb01('0x84')];this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x82')]]['transferconnectedlinenum']=_0x2e4cd7['transfertargetcalleridnum'];if(this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x85')]]){var _0x34a6ad=this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x85')]];this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x85')]]=this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x82')]];this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x82')]]=_0x34a6ad;}}else if(this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x86')]]){this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x86')]][_0xcb01('0x83')]=_0x2e4cd7[_0xcb01('0x84')];this['channels'][_0x2e4cd7[_0xcb01('0x86')]][_0xcb01('0x87')]=_0x2e4cd7['transfertargetcalleridnum'];if(this[_0xcb01('0x2f')][_0x2e4cd7['origtransfereruniqueid']]){var _0x34a6ad=this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x88')]];this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x88')]]=this[_0xcb01('0x2f')][_0x2e4cd7[_0xcb01('0x86')]];this[_0xcb01('0x2f')][_0x2e4cd7['transfertargetuniqueid']]=_0x34a6ad;}}}}catch(_0x587b30){logger[_0xcb01('0x32')](_0xcb01('0x89'),util[_0xcb01('0x34')](_0x587b30,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb01('0x29')][_0xcb01('0x23')]=function(_0x53a06f){try{if(this['isNotNull'](_0x53a06f)){if(this[_0xcb01('0x2f')][_0x53a06f['transfereeuniqueid']]){this[_0xcb01('0x2f')][_0x53a06f['transfereeuniqueid']][_0xcb01('0x83')]=_0x53a06f['transfereecalleridnum'];this[_0xcb01('0x2f')][_0x53a06f[_0xcb01('0x82')]][_0xcb01('0x87')]=_0x53a06f[_0xcb01('0x8a')];this[_0xcb01('0x1f')]({'event':_0xcb01('0x8b'),'uniqueid':_0x53a06f[_0xcb01('0x82')],'context':_0x53a06f[_0xcb01('0x3a')],'channel':_0x53a06f[_0xcb01('0x8c')]});}}}catch(_0x150cd2){logger[_0xcb01('0x32')](_0xcb01('0x8d'),util[_0xcb01('0x34')](_0x150cd2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb01('0x29')][_0xcb01('0x8e')]=function(_0x427632){try{if(this[_0xcb01('0x2a')](_0x427632)){if(this['channels'][_0x427632[_0xcb01('0x2d')]]){if(!_[_0xcb01('0x68')](this[_0xcb01('0x2f')][_0x427632['uniqueid']][_0xcb01('0x54')])){this[_0xcb01('0x2f')][_0x427632[_0xcb01('0x2d')]]['mohstarttime']=moment()[_0xcb01('0x36')](_0xcb01('0x4b'));}}}}catch(_0x43ee0d){logger[_0xcb01('0x32')](_0xcb01('0x8f'),util[_0xcb01('0x34')](_0x43ee0d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb01('0x29')][_0xcb01('0x26')]=function(_0x324966){try{if(this[_0xcb01('0x2a')](_0x324966)){if(this[_0xcb01('0x2f')][_0x324966[_0xcb01('0x2d')]]){if(!_['isNil'](this[_0xcb01('0x2f')][_0x324966[_0xcb01('0x2d')]][_0xcb01('0x90')])){this[_0xcb01('0x2f')][_0x324966[_0xcb01('0x2d')]][_0xcb01('0x91')]+=moment()[_0xcb01('0x92')](0x0)[_0xcb01('0x56')](this[_0xcb01('0x2f')][_0x324966[_0xcb01('0x2d')]]['mohstarttime'],_0xcb01('0x4a'));delete this[_0xcb01('0x2f')][_0x324966[_0xcb01('0x2d')]][_0xcb01('0x90')];}}}}catch(_0x56f500){logger['error'](_0xcb01('0x93'),util['inspect'](_0x56f500,{'showHidden':![],'depth':null}));}};module[_0xcb01('0x94')]=VoiceCallReport; \ No newline at end of file +var _0x6c7a=['BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','log','prototype','isNotNull','isUndefined','emit','syncNewCallerId','uniqueid','linkedid','merge','pick','error','inspect','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','context','from-sip','split','channel','user:%s','name','user:agentconnect','exten','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','appdata','starttime','duration','subtract','seconds','keys','includes','lastapplication','lastdata','startsWith','cdr(','match','answered','answertime','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','destinationchannel','toNumber','membername','UserId','[syncNewState][VoiceCallReport]','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','isNil','push','rec','variable','value','xmd-phone','xmd-cdrtype','type','xmd-queue','originatecalleridnum','destination','xmd-callerid-preview','sipcallid','sipcalluniqueid','parse','syncMixMonitorFilename','sipcalllinkedid','[syncVarSet][VoiceCallReport]','diff','holdtime','omit','destconnectedlinenum','accountcode','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','[syncMusicOnHoldStart][VoiceCallReport]','milliseconds','mohstarttime','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','playback','NO\x20ANSWER','FAILED','ANSWERED'];(function(_0x17161f,_0x361af1){var _0x5ba489=function(_0x172af1){while(--_0x172af1){_0x17161f['push'](_0x17161f['shift']());}};_0x5ba489(++_0x361af1);}(_0x6c7a,0x113));var _0xa6c7=function(_0x5ba687,_0x11edc6){_0x5ba687=_0x5ba687-0x0;var _0x26b212=_0x6c7a[_0x5ba687];return _0x26b212;};'use strict';var BPromise=require(_0xa6c7('0x0'));var _=require(_0xa6c7('0x1'));var moment=require(_0xa6c7('0x2'));var util=require(_0xa6c7('0x3'));var path=require(_0xa6c7('0x4'));var Redis=require(_0xa6c7('0x5'));var config=require(_0xa6c7('0x6'));var logger=require(_0xa6c7('0x7'))('ami');var ami=require('../ami');var Channel=require(_0xa6c7('0x8'));var statusDesc=['unknown',_0xa6c7('0x9'),_0xa6c7('0xa'),_0xa6c7('0xb'),_0xa6c7('0xc'),_0xa6c7('0xd'),_0xa6c7('0xe'),_0xa6c7('0xf'),_0xa6c7('0x10')];var applications=[_0xa6c7('0x11'),_0xa6c7('0x12'),'agi','dial',_0xa6c7('0x13'),'voicemail'];var dispositions=[_0xa6c7('0x14'),_0xa6c7('0x15'),_0xa6c7('0x15'),_0xa6c7('0x14'),_0xa6c7('0x14'),_0xa6c7('0x14'),_0xa6c7('0x16'),_0xa6c7('0x17'),'FAILED',_0xa6c7('0x15'),_0xa6c7('0x15')];var actions={};config[_0xa6c7('0x18')]=_[_0xa6c7('0x19')](config[_0xa6c7('0x18')],{'host':_0xa6c7('0x1a'),'port':0x18eb});var io=require(_0xa6c7('0x1b'))(new Redis(config[_0xa6c7('0x18')]));function VoiceCallReport(_0xae382b){this[_0xa6c7('0x1c')]=_0xae382b[_0xa6c7('0x1c')];this[_0xa6c7('0x1d')]=_0xae382b[_0xa6c7('0x1d')];ami['on'](_0xa6c7('0x1e'),this[_0xa6c7('0x1f')][_0xa6c7('0x20')](this));ami['on'](_0xa6c7('0x21'),this[_0xa6c7('0x1f')][_0xa6c7('0x20')](this));ami['on'](_0xa6c7('0x22'),this[_0xa6c7('0x23')][_0xa6c7('0x20')](this));ami['on']('newstate',this['syncNewState'][_0xa6c7('0x20')](this));ami['on']('varset',this[_0xa6c7('0x24')][_0xa6c7('0x20')](this));ami['on'](_0xa6c7('0x25'),this[_0xa6c7('0x26')][_0xa6c7('0x20')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0xa6c7('0x20')](this));ami['on'](_0xa6c7('0x27'),this[_0xa6c7('0x28')][_0xa6c7('0x20')](this));ami['on'](_0xa6c7('0x29'),this[_0xa6c7('0x2a')][_0xa6c7('0x20')](this));ami['on'](_0xa6c7('0x2b'),this[_0xa6c7('0x2c')][_0xa6c7('0x20')](this));ami['on']('musiconholdstop',this[_0xa6c7('0x2d')][_0xa6c7('0x20')](this));return BPromise[_0xa6c7('0x2e')]()[_0xa6c7('0x2f')](ami['actionCoreShowChannels']())['catch'](function(_0x168f7c){console[_0xa6c7('0x30')](_0x168f7c);});}VoiceCallReport[_0xa6c7('0x31')][_0xa6c7('0x32')]=function(_0x526218){return _0x526218!==null&&!_[_0xa6c7('0x33')](_0x526218);};VoiceCallReport[_0xa6c7('0x31')]['emit']=function(_0x19ba84,_0x35fe68,_0x39cbc3){io['to'](_0x19ba84)[_0xa6c7('0x34')](_0x35fe68,_0x39cbc3);};VoiceCallReport[_0xa6c7('0x31')][_0xa6c7('0x35')]=function(_0x26378d){try{if(this[_0xa6c7('0x32')](_0x26378d)){if(_0x26378d[_0xa6c7('0x36')]===_0x26378d[_0xa6c7('0x37')]){if(!_[_0xa6c7('0x33')](this[_0xa6c7('0x1c')][_0x26378d[_0xa6c7('0x36')]])){_[_0xa6c7('0x38')](this[_0xa6c7('0x1c')][_0x26378d[_0xa6c7('0x36')]],_[_0xa6c7('0x39')](_0x26378d,_['keys'](this[_0xa6c7('0x1c')][_0x26378d[_0xa6c7('0x36')]])));}}}}catch(_0x24890a){logger[_0xa6c7('0x3a')]('[syncNewCallerId][VoiceCallReport]',util[_0xa6c7('0x3b')](_0x24890a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa6c7('0x31')]['syncNewChannel']=function(_0x20e04b){try{if(this[_0xa6c7('0x32')](_0x20e04b)){if(_0x20e04b['uniqueid']===_0x20e04b[_0xa6c7('0x37')]&&_0x20e04b['channel']!=_0xa6c7('0x3c')){if(_[_0xa6c7('0x33')](this['channels'][_0x20e04b[_0xa6c7('0x36')]])){this['channels'][_0x20e04b['uniqueid']]=new Channel();this[_0xa6c7('0x1c')][_0x20e04b['uniqueid']]['starttime']=moment()[_0xa6c7('0x3d')](_0xa6c7('0x3e'));this[_0xa6c7('0x1c')][_0x20e04b[_0xa6c7('0x36')]][_0xa6c7('0x3f')]=dispositions[_['toNumber'](_0x20e04b[_0xa6c7('0x40')])];_[_0xa6c7('0x38')](this[_0xa6c7('0x1c')][_0x20e04b[_0xa6c7('0x36')]],_[_0xa6c7('0x39')](_0x20e04b,_['keys'](this[_0xa6c7('0x1c')][_0x20e04b[_0xa6c7('0x36')]])));if(_0x20e04b[_0xa6c7('0x41')]===_0xa6c7('0x42')){if(this[_0xa6c7('0x1d')][_0x20e04b['channel'][_0xa6c7('0x43')]('-')[0x0]]){this[_0xa6c7('0x1d')][_0x20e04b[_0xa6c7('0x44')]['split']('-')[0x0]]['destconnectedlinenum']=_0x20e04b['exten'];this['emit'](util[_0xa6c7('0x3d')](_0xa6c7('0x45'),this[_0xa6c7('0x1d')][_0x20e04b[_0xa6c7('0x44')]['split']('-')[0x0]][_0xa6c7('0x46')]),_0xa6c7('0x47'),{'destaccountcode':this['agents'][_0x20e04b[_0xa6c7('0x44')][_0xa6c7('0x43')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x20e04b[_0xa6c7('0x48')]});}}}}}}catch(_0x213f0a){logger[_0xa6c7('0x3a')](_0xa6c7('0x49'),util[_0xa6c7('0x3b')](_0x213f0a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa6c7('0x1f')]=function(_0x45a242){try{if(this[_0xa6c7('0x32')](_0x45a242)){if(_0x45a242[_0xa6c7('0x36')]===_0x45a242[_0xa6c7('0x37')]&&_0x45a242['exten']!='h'&&_0x45a242[_0xa6c7('0x44')]!=_0xa6c7('0x3c')){_0x45a242[_0xa6c7('0x4a')]=_0x45a242[_0xa6c7('0x4a')][_0xa6c7('0x4b')]();_0x45a242[_0xa6c7('0x4c')]=(_0x45a242[_0xa6c7('0x4d')]||_0x45a242[_0xa6c7('0x4c')])[_0xa6c7('0x4b')]();if(_[_0xa6c7('0x33')](this['channels'][_0x45a242[_0xa6c7('0x36')]])){this[_0xa6c7('0x1c')][_0x45a242[_0xa6c7('0x36')]]=new Channel();this[_0xa6c7('0x1c')][_0x45a242['uniqueid']][_0xa6c7('0x4e')]=_0x45a242[_0xa6c7('0x4f')]?moment()[_0xa6c7('0x50')](moment[_0xa6c7('0x4f')](_0x45a242[_0xa6c7('0x4f')])[_0xa6c7('0x51')](),_0xa6c7('0x51'))[_0xa6c7('0x3d')](_0xa6c7('0x3e')):moment()[_0xa6c7('0x3d')](_0xa6c7('0x3e'));this[_0xa6c7('0x1c')][_0x45a242[_0xa6c7('0x36')]]['disposition']=_0xa6c7('0x14');}_[_0xa6c7('0x38')](this[_0xa6c7('0x1c')][_0x45a242['uniqueid']],_[_0xa6c7('0x39')](_0x45a242,_[_0xa6c7('0x52')](this[_0xa6c7('0x1c')][_0x45a242[_0xa6c7('0x36')]])));if(_[_0xa6c7('0x53')](applications,_0x45a242['application'])){this['channels'][_0x45a242[_0xa6c7('0x36')]][_0xa6c7('0x54')]=_0x45a242[_0xa6c7('0x4a')];this[_0xa6c7('0x1c')][_0x45a242[_0xa6c7('0x36')]][_0xa6c7('0x55')]=_0x45a242[_0xa6c7('0x4c')];if(_0x45a242[_0xa6c7('0x4a')]===_0xa6c7('0x11')&&_[_0xa6c7('0x56')](_0x45a242['applicationdata'],_0xa6c7('0x57'))){var _0x2db4f1=_0x45a242[_0xa6c7('0x4c')]['split']('=');var _0x399e51=_0x2db4f1[0x0][_0xa6c7('0x58')](/cdr\((.*)\)/);if(_0x399e51){this[_0xa6c7('0x1c')][_0x45a242['uniqueid']][_0x399e51[0x1]]=_0x2db4f1[0x1];}}else if(_0x45a242['application']===_0xa6c7('0x12')){this[_0xa6c7('0x1c')][_0x45a242[_0xa6c7('0x36')]]['queue']=_0x45a242['applicationdata']['split'](',')[0x0];}}}}}catch(_0x51c045){logger['error']('[syncNewExten][VoiceCallReport]',util['inspect'](_0x51c045,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x1e1c31){try{if(this['isNotNull'](_0x1e1c31)){if(_0x1e1c31[_0xa6c7('0x36')]!==_0x1e1c31[_0xa6c7('0x37')]){if(this[_0xa6c7('0x1c')][_0x1e1c31['linkedid']]){if(_0x1e1c31[_0xa6c7('0x40')]==='6'){if(!this['channels'][_0x1e1c31['linkedid']][_0xa6c7('0x59')]){var _0x4bacf0=moment();this[_0xa6c7('0x1c')][_0x1e1c31[_0xa6c7('0x37')]][_0xa6c7('0x59')]=!![];this[_0xa6c7('0x1c')][_0x1e1c31[_0xa6c7('0x37')]][_0xa6c7('0x5a')]=_0x4bacf0[_0xa6c7('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x1e1c31['linkedid']][_0xa6c7('0x4e')]){this[_0xa6c7('0x1c')][_0x1e1c31['linkedid']]['holdtime']=_0x4bacf0['diff'](this[_0xa6c7('0x1c')][_0x1e1c31[_0xa6c7('0x37')]][_0xa6c7('0x4e')],_0xa6c7('0x51'));}}this[_0xa6c7('0x1c')][_0x1e1c31['linkedid']][_0xa6c7('0x37')]=_0x1e1c31[_0xa6c7('0x36')];if(_0x1e1c31['calleridnum']!==_0xa6c7('0x5b')){this[_0xa6c7('0x1c')][_0x1e1c31[_0xa6c7('0x37')]][_0xa6c7('0x5c')]=_0x1e1c31[_0xa6c7('0x5d')];}this[_0xa6c7('0x1c')][_0x1e1c31[_0xa6c7('0x37')]][_0xa6c7('0x5e')]=_0x1e1c31[_0xa6c7('0x5f')];this[_0xa6c7('0x1c')][_0x1e1c31[_0xa6c7('0x37')]][_0xa6c7('0x60')]=_0x1e1c31['channel'];this['channels'][_0x1e1c31['linkedid']][_0xa6c7('0x3f')]=dispositions[_[_0xa6c7('0x61')](_0x1e1c31[_0xa6c7('0x40')])];if(this['agents'][_0x1e1c31[_0xa6c7('0x44')][_0xa6c7('0x43')]('-')[0x0]]){this[_0xa6c7('0x1c')][_0x1e1c31[_0xa6c7('0x37')]]['UserId']=this['agents'][_0x1e1c31[_0xa6c7('0x44')][_0xa6c7('0x43')]('-')[0x0]]['id'];this[_0xa6c7('0x1c')][_0x1e1c31[_0xa6c7('0x37')]][_0xa6c7('0x62')]=this[_0xa6c7('0x1d')][_0x1e1c31[_0xa6c7('0x44')][_0xa6c7('0x43')]('-')[0x0]][_0xa6c7('0x46')];}}}}else{if(this[_0xa6c7('0x1c')][_0x1e1c31['uniqueid']]){if(_0x1e1c31['channelstate']==='6'){if(this[_0xa6c7('0x1d')][_0x1e1c31[_0xa6c7('0x44')][_0xa6c7('0x43')]('-')[0x0]]){this[_0xa6c7('0x1c')][_0x1e1c31['uniqueid']][_0xa6c7('0x63')]=this['agents'][_0x1e1c31[_0xa6c7('0x44')][_0xa6c7('0x43')]('-')[0x0]]['id'];this[_0xa6c7('0x1c')][_0x1e1c31[_0xa6c7('0x36')]][_0xa6c7('0x62')]=this[_0xa6c7('0x1d')][_0x1e1c31[_0xa6c7('0x44')]['split']('-')[0x0]][_0xa6c7('0x46')];}}}}}}catch(_0x57abb0){logger[_0xa6c7('0x3a')](_0xa6c7('0x64'),util[_0xa6c7('0x3b')](_0x57abb0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa6c7('0x31')]['syncMixMonitorFilename']=function(_0x41e9f2,_0xaa870d){if(this[_0xa6c7('0x1c')][_0x41e9f2]){this[_0xa6c7('0x1c')][_0x41e9f2][_0xa6c7('0x65')]=!![];if(_[_0xa6c7('0x66')](_0xaa870d,_0xa6c7('0x67'))){_0xaa870d=_0xaa870d[_0xa6c7('0x68')](_0xa6c7('0x67'),_0xa6c7('0x69'));}this['channels'][_0x41e9f2][_0xa6c7('0x6a')]=_0xaa870d;var _0x1182d6=_[_0xa6c7('0x6b')](this[_0xa6c7('0x1c')][_0x41e9f2]['monitors'],{'filename':_0xaa870d});if(_[_0xa6c7('0x6c')](_0x1182d6)){this[_0xa6c7('0x1c')][_0x41e9f2]['monitors'][_0xa6c7('0x6d')]({'filename':_0xaa870d,'createdAt':moment()[_0xa6c7('0x3d')](_0xa6c7('0x3e')),'mixmonitorid':'','status':_0xa6c7('0x6e')});}}};VoiceCallReport[_0xa6c7('0x31')][_0xa6c7('0x24')]=function(_0x5bf2d7){try{if(this[_0xa6c7('0x32')](_0x5bf2d7)){if(this[_0xa6c7('0x1c')][_0x5bf2d7[_0xa6c7('0x36')]]&&_0x5bf2d7[_0xa6c7('0x44')]!=_0xa6c7('0x3c')){if(this[_0xa6c7('0x32')](_0x5bf2d7[_0xa6c7('0x6f')])){if(this[_0xa6c7('0x32')](_0x5bf2d7[_0xa6c7('0x6f')]['mixmonitor_filename'])){this['syncMixMonitorFilename'](_0x5bf2d7[_0xa6c7('0x36')],_0x5bf2d7[_0xa6c7('0x70')]);}else if(this['isNotNull'](_0x5bf2d7['variable'][_0xa6c7('0x71')])){this[_0xa6c7('0x1c')][_0x5bf2d7[_0xa6c7('0x36')]]['calleridnum']=_0x5bf2d7['value'];}else if(this[_0xa6c7('0x32')](_0x5bf2d7[_0xa6c7('0x6f')]['xmd-callerid'])){this[_0xa6c7('0x1c')][_0x5bf2d7[_0xa6c7('0x36')]]['callerid']=_0x5bf2d7['value'];}else if(this[_0xa6c7('0x32')](_0x5bf2d7[_0xa6c7('0x6f')][_0xa6c7('0x72')])){this[_0xa6c7('0x1c')][_0x5bf2d7[_0xa6c7('0x36')]][_0xa6c7('0x73')]=_0x5bf2d7[_0xa6c7('0x70')];}else if(this[_0xa6c7('0x32')](_0x5bf2d7['variable'][_0xa6c7('0x74')])){this[_0xa6c7('0x1c')][_0x5bf2d7[_0xa6c7('0x36')]]['queue']=_0x5bf2d7[_0xa6c7('0x70')][_0xa6c7('0x43')](',')[0x0];}else if(this[_0xa6c7('0x32')](_0x5bf2d7[_0xa6c7('0x6f')]['xmd-originatecalleridnum'])){this[_0xa6c7('0x1c')][_0x5bf2d7[_0xa6c7('0x36')]][_0xa6c7('0x75')]=_0x5bf2d7[_0xa6c7('0x70')];}else if(this['isNotNull'](_0x5bf2d7[_0xa6c7('0x6f')]['xmd-destination'])){this['channels'][_0x5bf2d7[_0xa6c7('0x36')]][_0xa6c7('0x76')]=_0x5bf2d7[_0xa6c7('0x70')];}else if(this[_0xa6c7('0x32')](_0x5bf2d7[_0xa6c7('0x6f')][_0xa6c7('0x77')])){this[_0xa6c7('0x1c')][_0x5bf2d7[_0xa6c7('0x36')]]['calleridpreview']=_0x5bf2d7[_0xa6c7('0x70')];}else if(this[_0xa6c7('0x32')](_0x5bf2d7[_0xa6c7('0x6f')]['xmcs-queue'])){this[_0xa6c7('0x1c')][_0x5bf2d7['uniqueid']]['queue']=_0x5bf2d7[_0xa6c7('0x70')];}else if(this[_0xa6c7('0x32')](_0x5bf2d7['variable'][_0xa6c7('0x78')])){this['channels'][_0x5bf2d7[_0xa6c7('0x36')]][_0xa6c7('0x79')]=_0x5bf2d7['value'];}}}else if(this[_0xa6c7('0x32')](_0x5bf2d7[_0xa6c7('0x6f')]['mixmonitor_filename'])){if(_0x5bf2d7[_0xa6c7('0x70')]){var _0x48341a=path[_0xa6c7('0x7a')](_0x5bf2d7[_0xa6c7('0x70')])['name'];this[_0xa6c7('0x7b')](_0x48341a,_0x5bf2d7[_0xa6c7('0x70')]);}}else if(this[_0xa6c7('0x1c')][_0x5bf2d7[_0xa6c7('0x37')]]){if(this[_0xa6c7('0x32')](_0x5bf2d7[_0xa6c7('0x6f')])){if(this[_0xa6c7('0x32')](_0x5bf2d7[_0xa6c7('0x6f')][_0xa6c7('0x78')])){this[_0xa6c7('0x1c')][_0x5bf2d7[_0xa6c7('0x37')]][_0xa6c7('0x7c')]=_0x5bf2d7[_0xa6c7('0x70')];}}}}}catch(_0x5b07a0){logger[_0xa6c7('0x3a')](_0xa6c7('0x7d'),util[_0xa6c7('0x3b')](_0x5b07a0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa6c7('0x31')][_0xa6c7('0x26')]=function(_0x58966d){try{if(this[_0xa6c7('0x32')](_0x58966d)){if(this['channels'][_0x58966d['uniqueid']]){var _0x5540e3=moment();this[_0xa6c7('0x1c')][_0x58966d['uniqueid']]['endtime']=_0x5540e3[_0xa6c7('0x3d')](_0xa6c7('0x3e'));this[_0xa6c7('0x1c')][_0x58966d[_0xa6c7('0x36')]][_0xa6c7('0x4f')]=_0x5540e3['diff'](this['channels'][_0x58966d[_0xa6c7('0x36')]][_0xa6c7('0x4e')],_0xa6c7('0x51'));if(this[_0xa6c7('0x1c')][_0x58966d[_0xa6c7('0x36')]]['answered']){this[_0xa6c7('0x1c')][_0x58966d['uniqueid']]['billableseconds']=_0x5540e3[_0xa6c7('0x7e')](this['channels'][_0x58966d[_0xa6c7('0x36')]][_0xa6c7('0x5a')],_0xa6c7('0x51'));this['channels'][_0x58966d['uniqueid']][_0xa6c7('0x7f')]=this[_0xa6c7('0x1c')][_0x58966d[_0xa6c7('0x36')]]['duration']-this[_0xa6c7('0x1c')][_0x58966d[_0xa6c7('0x36')]]['billableseconds'];}if(_0x58966d[_0xa6c7('0x41')]===_0xa6c7('0x42')){if(this[_0xa6c7('0x1d')][_0x58966d['channel'][_0xa6c7('0x43')]('-')[0x0]]){this['agents'][_0x58966d[_0xa6c7('0x44')][_0xa6c7('0x43')]('-')[0x0]]=_[_0xa6c7('0x80')](this['agents'][_0x58966d[_0xa6c7('0x44')][_0xa6c7('0x43')]('-')[0x0]],[_0xa6c7('0x81')]);this[_0xa6c7('0x34')](util[_0xa6c7('0x3d')](_0xa6c7('0x45'),this[_0xa6c7('0x1d')][_0x58966d[_0xa6c7('0x44')]['split']('-')[0x0]][_0xa6c7('0x46')]),'user:agentcomplete',{'destaccountcode':this['agents'][_0x58966d[_0xa6c7('0x44')][_0xa6c7('0x43')]('-')[0x0]][_0xa6c7('0x82')]});}}ami[_0xa6c7('0x34')](_0xa6c7('0x83'),this['channels'][_0x58966d[_0xa6c7('0x36')]]);delete this['channels'][_0x58966d[_0xa6c7('0x36')]];}}}catch(_0x3311b5){logger[_0xa6c7('0x3a')](_0xa6c7('0x84'),util[_0xa6c7('0x3b')](_0x3311b5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa6c7('0x31')][_0xa6c7('0x28')]=function(_0x230f42){try{if(this[_0xa6c7('0x32')](_0x230f42)){if(this[_0xa6c7('0x1c')][_0x230f42[_0xa6c7('0x85')]]){this[_0xa6c7('0x1c')][_0x230f42['transfereeuniqueid']][_0xa6c7('0x86')]=_0x230f42['origtransferercalleridnum'];this[_0xa6c7('0x1c')][_0x230f42[_0xa6c7('0x85')]][_0xa6c7('0x87')]=_0x230f42[_0xa6c7('0x88')];if(this[_0xa6c7('0x1c')][_0x230f42[_0xa6c7('0x89')]]){var _0x34f41d=this[_0xa6c7('0x1c')][_0x230f42[_0xa6c7('0x89')]];this[_0xa6c7('0x1c')][_0x230f42[_0xa6c7('0x89')]]=this[_0xa6c7('0x1c')][_0x230f42['transfereeuniqueid']];this[_0xa6c7('0x1c')][_0x230f42[_0xa6c7('0x85')]]=_0x34f41d;}}else if(this[_0xa6c7('0x1c')][_0x230f42['transfertargetuniqueid']]){this[_0xa6c7('0x1c')][_0x230f42['transfertargetuniqueid']][_0xa6c7('0x86')]=_0x230f42['origtransferercalleridnum'];this[_0xa6c7('0x1c')][_0x230f42[_0xa6c7('0x8a')]][_0xa6c7('0x87')]=_0x230f42['transfertargetcalleridnum'];if(this['channels'][_0x230f42[_0xa6c7('0x8b')]]){var _0x34f41d=this['channels'][_0x230f42['origtransfereruniqueid']];this[_0xa6c7('0x1c')][_0x230f42[_0xa6c7('0x8b')]]=this['channels'][_0x230f42[_0xa6c7('0x8a')]];this[_0xa6c7('0x1c')][_0x230f42[_0xa6c7('0x8a')]]=_0x34f41d;}}}}catch(_0x28feff){logger[_0xa6c7('0x3a')](_0xa6c7('0x8c'),util[_0xa6c7('0x3b')](_0x28feff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa6c7('0x31')][_0xa6c7('0x2a')]=function(_0x3cd96c){try{if(this[_0xa6c7('0x32')](_0x3cd96c)){if(this['channels'][_0x3cd96c[_0xa6c7('0x85')]]){this['channels'][_0x3cd96c[_0xa6c7('0x85')]][_0xa6c7('0x86')]=_0x3cd96c[_0xa6c7('0x8d')];this[_0xa6c7('0x1c')][_0x3cd96c[_0xa6c7('0x85')]][_0xa6c7('0x87')]=_0x3cd96c['extension'];this[_0xa6c7('0x26')]({'event':_0xa6c7('0x8e'),'uniqueid':_0x3cd96c['transfereeuniqueid'],'context':_0x3cd96c[_0xa6c7('0x41')],'channel':_0x3cd96c[_0xa6c7('0x8f')]});}}}catch(_0x2b185f){logger[_0xa6c7('0x3a')](_0xa6c7('0x90'),util[_0xa6c7('0x3b')](_0x2b185f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa6c7('0x2c')]=function(_0x5605cc){try{if(this[_0xa6c7('0x32')](_0x5605cc)){if(this[_0xa6c7('0x1c')][_0x5605cc[_0xa6c7('0x36')]]){if(!_[_0xa6c7('0x6c')](this[_0xa6c7('0x1c')][_0x5605cc['uniqueid']][_0xa6c7('0x5a')])){this[_0xa6c7('0x1c')][_0x5605cc[_0xa6c7('0x36')]]['mohstarttime']=moment()[_0xa6c7('0x3d')](_0xa6c7('0x3e'));}}}}catch(_0x3419ac){logger[_0xa6c7('0x3a')](_0xa6c7('0x91'),util[_0xa6c7('0x3b')](_0x3419ac,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa6c7('0x31')][_0xa6c7('0x2d')]=function(_0x3c1436){try{if(this[_0xa6c7('0x32')](_0x3c1436)){if(this[_0xa6c7('0x1c')][_0x3c1436[_0xa6c7('0x36')]]){if(!_['isNil'](this[_0xa6c7('0x1c')][_0x3c1436[_0xa6c7('0x36')]]['mohstarttime'])){this['channels'][_0x3c1436[_0xa6c7('0x36')]]['mohtime']+=moment()[_0xa6c7('0x92')](0x0)[_0xa6c7('0x7e')](this['channels'][_0x3c1436[_0xa6c7('0x36')]]['mohstarttime'],'seconds');delete this[_0xa6c7('0x1c')][_0x3c1436[_0xa6c7('0x36')]][_0xa6c7('0x93')];}}}}catch(_0x2070b1){logger[_0xa6c7('0x3a')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0xa6c7('0x3b')](_0x2070b1,{'showHidden':![],'depth':null}));}};module[_0xa6c7('0x94')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 67dfe61..7557d37 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 _0x153b=['voice:outbound','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','isUndefined','variables','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','membername','memberrealtime','isNil','endtime','diff','starttime','complete','total','answertime','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','custom:voiceDialReport','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','varset','hangup','syncHangup','prototype','isNotNull','emit','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','voice_outbound_channel:save','uniqueid','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','format','lastevent','connect','custom:dialconnect'];(function(_0x2dee25,_0x19e8be){var _0xcb06de=function(_0x16c44b){while(--_0x16c44b){_0x2dee25['push'](_0x2dee25['shift']());}};_0xcb06de(++_0x19e8be);}(_0x153b,0x12e));var _0xb153=function(_0x412eb8,_0x1062f3){_0x412eb8=_0x412eb8-0x0;var _0x29ba36=_0x153b[_0x412eb8];return _0x29ba36;};'use strict';var _=require('lodash');var moment=require(_0xb153('0x0'));var util=require(_0xb153('0x1'));var Redis=require('ioredis');var config=require(_0xb153('0x2'));var logger=require(_0xb153('0x3'))(_0xb153('0x4'));var ami=require(_0xb153('0x5'));config[_0xb153('0x6')]=_[_0xb153('0x7')](config[_0xb153('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb153('0x8'))(new Redis(config[_0xb153('0x6')]));function VoiceDialReport(_0x530bb1){this[_0xb153('0x9')]=_0x530bb1[_0xb153('0xa')];this[_0xb153('0xb')]=_0x530bb1[_0xb153('0xb')];this['variables']={};ami['on'](_0xb153('0xc'),this[_0xb153('0xd')][_0xb153('0xe')](this));ami['on']('dialend',this['syncDialEnd'][_0xb153('0xe')](this));ami['on'](_0xb153('0xf'),this['syncVarSet'][_0xb153('0xe')](this));ami['on'](_0xb153('0x10'),this[_0xb153('0x11')]['bind'](this));}VoiceDialReport[_0xb153('0x12')][_0xb153('0x13')]=function(_0x17ec6c){return _0x17ec6c!==null&&!_['isUndefined'](_0x17ec6c);};VoiceDialReport[_0xb153('0x12')][_0xb153('0x14')]=function(_0x1203f7,_0x5b70e2,_0x16ab81){io['to'](_0x1203f7)[_0xb153('0x14')](_0x5b70e2,_0x16ab81);};VoiceDialReport[_0xb153('0x12')][_0xb153('0xd')]=function(_0x2656fd){try{if(this['isNotNull'](_0x2656fd)){if(this[_0xb153('0x9')][_0x2656fd['uniqueid']]){_[_0xb153('0x15')](this[_0xb153('0x9')][_0x2656fd['uniqueid']],{'starttime':moment()['format'](_0xb153('0x16')),'lastevent':_0xb153('0x17'),'interface':_0x2656fd[_0xb153('0x18')][_0xb153('0x19')](0x0,_0x2656fd[_0xb153('0x18')][_0xb153('0x1a')]('-')),'membername':_0x2656fd['channel'][_0xb153('0x19')](_0x2656fd['channel'][_0xb153('0x1a')]('/')+0x1,_0x2656fd[_0xb153('0x18')][_0xb153('0x1a')]('-'))},_['omit'](_0x2656fd,[_0xb153('0x1b'),'privilege']));this['emit']('voice:outbound',_0xb153('0x1c'),this[_0xb153('0x9')][_0x2656fd['uniqueid']]);ami[_0xb153('0x14')]('custom:dialbegin',this[_0xb153('0x9')][_0x2656fd[_0xb153('0x1d')]]);}}}catch(_0x53e468){logger[_0xb153('0x1e')](_0xb153('0x1f'),util[_0xb153('0x20')](_0x53e468,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xb153('0x21')]=function(_0xf56220){try{if(this['isNotNull'](_0xf56220)){if(this['channels'][_0xf56220[_0xb153('0x1d')]]){this[_0xb153('0x9')][_0xf56220[_0xb153('0x1d')]][_0xb153('0x22')]=_0xf56220['dialstatus'];if(_0xf56220['dialstatus']===_0xb153('0x23')){this[_0xb153('0x9')][_0xf56220[_0xb153('0x1d')]][_0xb153('0x24')]=_0xf56220[_0xb153('0x24')];this[_0xb153('0x9')][_0xf56220['uniqueid']][_0xb153('0x25')]=_0xf56220[_0xb153('0x25')];this[_0xb153('0x9')][_0xf56220[_0xb153('0x1d')]]['answertime']=moment()[_0xb153('0x26')](_0xb153('0x16'));this[_0xb153('0x9')][_0xf56220['uniqueid']][_0xb153('0x27')]=_0xb153('0x28');ami[_0xb153('0x14')](_0xb153('0x29'),this[_0xb153('0x9')][_0xf56220[_0xb153('0x1d')]]);}this[_0xb153('0x14')](_0xb153('0x2a'),_0xb153('0x1c'),this[_0xb153('0x9')][_0xf56220[_0xb153('0x1d')]]);}}}catch(_0x5936cc){logger[_0xb153('0x1e')](_0xb153('0x2b'),util[_0xb153('0x20')](_0x5936cc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb153('0x12')]['syncVarSet']=function(_0x152c56){try{if(this['isNotNull'](_0x152c56)){this[_0xb153('0x2c')](_0x152c56[_0xb153('0x1d')],_[_0xb153('0x2d')](_0x152c56[_0xb153('0x2e')])[0x0],_0x152c56[_0xb153('0x2f')]);if(this[_0xb153('0x13')](_0x152c56[_0xb153('0x2e')])&&this['isNotNull'](_0x152c56[_0xb153('0x2e')][_0xb153('0x30')])){if(_[_0xb153('0x31')](this[_0xb153('0x9')][_0x152c56[_0xb153('0x1d')]])){this['channels'][_0x152c56[_0xb153('0x1d')]]={'routeId':_0x152c56[_0xb153('0x2f')],'variables':this[_0xb153('0x32')][_0x152c56['uniqueid']]};this['emit']('voice:outbound','voice_outbound_channel:save',this[_0xb153('0x9')][_0x152c56[_0xb153('0x1d')]]);}}}}catch(_0x52b78c){logger[_0xb153('0x1e')](_0xb153('0x33'),util[_0xb153('0x20')](_0x52b78c,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x10aee2,_0x62a24a,_0xe12ed2){var _0x379cbd=[_0xb153('0x34'),_0xb153('0x35'),_0xb153('0x36'),_0xb153('0x37'),_0xb153('0x38'),_0xb153('0x39'),_0xb153('0x3a'),_0xb153('0x3b'),_0xb153('0x3c'),_0xb153('0x3d'),_0xb153('0x3e'),_0xb153('0x3f'),'membercalls','memberdynamic',_0xb153('0x40'),_0xb153('0x41'),_0xb153('0x42'),'memberpenalty',_0xb153('0x43')];if(!_[_0xb153('0x44')](_0x62a24a)&&!_['includes'](_0x379cbd,_0x62a24a)){if(_['isUndefined'](this[_0xb153('0x32')][_0x10aee2])){this[_0xb153('0x32')][_0x10aee2]={};}this['variables'][_0x10aee2][_0x62a24a]=_0xe12ed2;}};VoiceDialReport[_0xb153('0x12')][_0xb153('0x11')]=function(_0x9d7320){try{if(this['isNotNull'](_0x9d7320)){if(this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]]){this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]][_0xb153('0x45')]=moment()[_0xb153('0x26')](_0xb153('0x16'));this['channels'][_0x9d7320['uniqueid']]['duration']=moment(this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]][_0xb153('0x45')])[_0xb153('0x46')](this['channels'][_0x9d7320['uniqueid']][_0xb153('0x47')],'seconds');this['channels'][_0x9d7320[_0xb153('0x1d')]][_0xb153('0x27')]=_0xb153('0x48');this[_0xb153('0xb')][_0xb153('0x49')]+=0x1;if(this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]][_0xb153('0x4a')]){this[_0xb153('0xb')][_0xb153('0x4b')]+=0x1;this['channels'][_0x9d7320['uniqueid']][_0xb153('0x4c')]=moment(this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]][_0xb153('0x4a')])['diff'](this[_0xb153('0x9')][_0x9d7320['uniqueid']][_0xb153('0x47')],'seconds');this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]][_0xb153('0x4d')]=moment(this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]][_0xb153('0x45')])[_0xb153('0x46')](this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]]['answertime'],'seconds');this[_0xb153('0xb')][_0xb153('0x4e')]+=this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]][_0xb153('0x4c')]||0x0;this[_0xb153('0xb')][_0xb153('0x4f')]+=this[_0xb153('0x9')][_0x9d7320['uniqueid']][_0xb153('0x4d')];}this['outbound'][_0xb153('0x50')]+=this[_0xb153('0x9')][_0x9d7320['uniqueid']][_0xb153('0x51')];ami[_0xb153('0x14')](_0xb153('0x52'),this['channels'][_0x9d7320['uniqueid']]);ami[_0xb153('0x14')]('custom:dialend',this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]]);this[_0xb153('0x14')]('voice:outbound','voice_outbound:save',this[_0xb153('0xb')]);this['emit'](_0xb153('0x2a'),_0xb153('0x53'),this[_0xb153('0x9')][_0x9d7320[_0xb153('0x1d')]]);delete this['channels'][_0x9d7320[_0xb153('0x1d')]];}if(this['variables'][_0x9d7320[_0xb153('0x1d')]]){delete this[_0xb153('0x32')][_0x9d7320[_0xb153('0x1d')]];}}}catch(_0x56d9b9){logger[_0xb153('0x1e')](_0xb153('0x54'),util['inspect'](_0x56d9b9,{'showHidden':![],'depth':null}));}};module[_0xb153('0x55')]=VoiceDialReport; \ No newline at end of file +var _0x9f84=['sumBillable','sumDuration','custom:voiceDialReport','voice_outbound:save','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','defaults','redis','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','uniqueid','merge','format','called','channel','substring','lastIndexOf','omit','event','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','voice:outbound','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','syncVarSet','addVariable','keys','variable','value','outboundrouteid','variables','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','endtime','duration','diff','starttime','seconds','complete','answered','holdtime','billableseconds','sumHoldTime'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x9f84,0x118));var _0x49f8=function(_0x14cc9d,_0x138641){_0x14cc9d=_0x14cc9d-0x0;var _0x28fee3=_0x9f84[_0x14cc9d];return _0x28fee3;};'use strict';var _=require(_0x49f8('0x0'));var moment=require(_0x49f8('0x1'));var util=require(_0x49f8('0x2'));var Redis=require(_0x49f8('0x3'));var config=require('../../../config/environment');var logger=require(_0x49f8('0x4'))(_0x49f8('0x5'));var ami=require(_0x49f8('0x6'));config['redis']=_[_0x49f8('0x7')](config[_0x49f8('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x49f8('0x9'))(new Redis(config['redis']));function VoiceDialReport(_0x3571a8){this[_0x49f8('0xa')]=_0x3571a8[_0x49f8('0xb')];this[_0x49f8('0xc')]=_0x3571a8[_0x49f8('0xc')];this['variables']={};ami['on'](_0x49f8('0xd'),this[_0x49f8('0xe')][_0x49f8('0xf')](this));ami['on'](_0x49f8('0x10'),this[_0x49f8('0x11')][_0x49f8('0xf')](this));ami['on'](_0x49f8('0x12'),this['syncVarSet'][_0x49f8('0xf')](this));ami['on'](_0x49f8('0x13'),this[_0x49f8('0x14')][_0x49f8('0xf')](this));}VoiceDialReport['prototype'][_0x49f8('0x15')]=function(_0x2923bb){return _0x2923bb!==null&&!_[_0x49f8('0x16')](_0x2923bb);};VoiceDialReport[_0x49f8('0x17')][_0x49f8('0x18')]=function(_0x310308,_0x28d059,_0x3dbde2){io['to'](_0x310308)[_0x49f8('0x18')](_0x28d059,_0x3dbde2);};VoiceDialReport[_0x49f8('0x17')][_0x49f8('0xe')]=function(_0x52845b){try{if(this['isNotNull'](_0x52845b)){if(this[_0x49f8('0xa')][_0x52845b[_0x49f8('0x19')]]){_[_0x49f8('0x1a')](this['channels'][_0x52845b['uniqueid']],{'starttime':moment()[_0x49f8('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x49f8('0x1c'),'interface':_0x52845b[_0x49f8('0x1d')][_0x49f8('0x1e')](0x0,_0x52845b[_0x49f8('0x1d')][_0x49f8('0x1f')]('-')),'membername':_0x52845b[_0x49f8('0x1d')][_0x49f8('0x1e')](_0x52845b['channel']['lastIndexOf']('/')+0x1,_0x52845b['channel']['lastIndexOf']('-'))},_[_0x49f8('0x20')](_0x52845b,[_0x49f8('0x21'),'privilege']));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x49f8('0xa')][_0x52845b[_0x49f8('0x19')]]);ami['emit'](_0x49f8('0x22'),this[_0x49f8('0xa')][_0x52845b['uniqueid']]);}}}catch(_0x4105e9){logger[_0x49f8('0x23')](_0x49f8('0x24'),util[_0x49f8('0x25')](_0x4105e9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x49f8('0x17')][_0x49f8('0x11')]=function(_0x7e2f89){try{if(this['isNotNull'](_0x7e2f89)){if(this[_0x49f8('0xa')][_0x7e2f89['uniqueid']]){this[_0x49f8('0xa')][_0x7e2f89[_0x49f8('0x19')]][_0x49f8('0x26')]=_0x7e2f89[_0x49f8('0x26')];if(_0x7e2f89[_0x49f8('0x26')]===_0x49f8('0x27')){this[_0x49f8('0xa')][_0x7e2f89[_0x49f8('0x19')]]['connectedlinenum']=_0x7e2f89[_0x49f8('0x28')];this[_0x49f8('0xa')][_0x7e2f89[_0x49f8('0x19')]][_0x49f8('0x29')]=_0x7e2f89[_0x49f8('0x29')];this[_0x49f8('0xa')][_0x7e2f89[_0x49f8('0x19')]][_0x49f8('0x2a')]=moment()[_0x49f8('0x1b')](_0x49f8('0x2b'));this[_0x49f8('0xa')][_0x7e2f89[_0x49f8('0x19')]][_0x49f8('0x2c')]=_0x49f8('0x2d');ami['emit']('custom:dialconnect',this[_0x49f8('0xa')][_0x7e2f89['uniqueid']]);}this[_0x49f8('0x18')](_0x49f8('0x2e'),_0x49f8('0x2f'),this[_0x49f8('0xa')][_0x7e2f89[_0x49f8('0x19')]]);}}}catch(_0x1a9409){logger['error'](_0x49f8('0x30'),util[_0x49f8('0x25')](_0x1a9409,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x49f8('0x31')]=function(_0x14f2d8){try{if(this[_0x49f8('0x15')](_0x14f2d8)){this[_0x49f8('0x32')](_0x14f2d8[_0x49f8('0x19')],_[_0x49f8('0x33')](_0x14f2d8[_0x49f8('0x34')])[0x0],_0x14f2d8[_0x49f8('0x35')]);if(this[_0x49f8('0x15')](_0x14f2d8['variable'])&&this['isNotNull'](_0x14f2d8[_0x49f8('0x34')][_0x49f8('0x36')])){if(_[_0x49f8('0x16')](this[_0x49f8('0xa')][_0x14f2d8[_0x49f8('0x19')]])){this['channels'][_0x14f2d8['uniqueid']]={'routeId':_0x14f2d8[_0x49f8('0x35')],'variables':this[_0x49f8('0x37')][_0x14f2d8[_0x49f8('0x19')]]};this['emit'](_0x49f8('0x2e'),_0x49f8('0x2f'),this[_0x49f8('0xa')][_0x14f2d8[_0x49f8('0x19')]]);}}}}catch(_0x4d2923){logger['error']('[syncVarSet][VoiceDialReport]',util[_0x49f8('0x25')](_0x4d2923,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x49f8('0x17')][_0x49f8('0x32')]=function(_0x11d702,_0x9afb06,_0x567e02){var _0x1eec27=[_0x49f8('0x38'),'rtpaudioqosbridged',_0x49f8('0x39'),_0x49f8('0x3a'),_0x49f8('0x3b'),_0x49f8('0x3c'),_0x49f8('0x3d'),_0x49f8('0x3e'),_0x49f8('0x3f'),_0x49f8('0x40'),_0x49f8('0x41'),_0x49f8('0x42'),_0x49f8('0x43'),'memberdynamic',_0x49f8('0x44'),_0x49f8('0x45'),_0x49f8('0x46'),_0x49f8('0x47'),_0x49f8('0x48')];if(!_['isNil'](_0x9afb06)&&!_[_0x49f8('0x49')](_0x1eec27,_0x9afb06)){if(_[_0x49f8('0x16')](this[_0x49f8('0x37')][_0x11d702])){this[_0x49f8('0x37')][_0x11d702]={};}this[_0x49f8('0x37')][_0x11d702][_0x9afb06]=_0x567e02;}};VoiceDialReport[_0x49f8('0x17')][_0x49f8('0x14')]=function(_0x3eb678){try{if(this['isNotNull'](_0x3eb678)){if(this[_0x49f8('0xa')][_0x3eb678['uniqueid']]){this[_0x49f8('0xa')][_0x3eb678['uniqueid']][_0x49f8('0x4a')]=moment()[_0x49f8('0x1b')](_0x49f8('0x2b'));this['channels'][_0x3eb678['uniqueid']][_0x49f8('0x4b')]=moment(this[_0x49f8('0xa')][_0x3eb678[_0x49f8('0x19')]]['endtime'])[_0x49f8('0x4c')](this['channels'][_0x3eb678[_0x49f8('0x19')]][_0x49f8('0x4d')],_0x49f8('0x4e'));this['channels'][_0x3eb678[_0x49f8('0x19')]][_0x49f8('0x2c')]=_0x49f8('0x4f');this[_0x49f8('0xc')]['total']+=0x1;if(this[_0x49f8('0xa')][_0x3eb678['uniqueid']][_0x49f8('0x2a')]){this[_0x49f8('0xc')][_0x49f8('0x50')]+=0x1;this[_0x49f8('0xa')][_0x3eb678[_0x49f8('0x19')]][_0x49f8('0x51')]=moment(this[_0x49f8('0xa')][_0x3eb678[_0x49f8('0x19')]][_0x49f8('0x2a')])[_0x49f8('0x4c')](this[_0x49f8('0xa')][_0x3eb678['uniqueid']][_0x49f8('0x4d')],_0x49f8('0x4e'));this['channels'][_0x3eb678['uniqueid']][_0x49f8('0x52')]=moment(this[_0x49f8('0xa')][_0x3eb678['uniqueid']][_0x49f8('0x4a')])['diff'](this[_0x49f8('0xa')][_0x3eb678[_0x49f8('0x19')]][_0x49f8('0x2a')],'seconds');this[_0x49f8('0xc')][_0x49f8('0x53')]+=this[_0x49f8('0xa')][_0x3eb678['uniqueid']]['holdtime']||0x0;this[_0x49f8('0xc')][_0x49f8('0x54')]+=this[_0x49f8('0xa')][_0x3eb678['uniqueid']][_0x49f8('0x52')];}this[_0x49f8('0xc')][_0x49f8('0x55')]+=this[_0x49f8('0xa')][_0x3eb678['uniqueid']][_0x49f8('0x4b')];ami['emit'](_0x49f8('0x56'),this[_0x49f8('0xa')][_0x3eb678[_0x49f8('0x19')]]);ami[_0x49f8('0x18')]('custom:dialend',this[_0x49f8('0xa')][_0x3eb678[_0x49f8('0x19')]]);this[_0x49f8('0x18')](_0x49f8('0x2e'),_0x49f8('0x57'),this[_0x49f8('0xc')]);this['emit']('voice:outbound',_0x49f8('0x58'),this[_0x49f8('0xa')][_0x3eb678[_0x49f8('0x19')]]);delete this[_0x49f8('0xa')][_0x3eb678[_0x49f8('0x19')]];}if(this['variables'][_0x3eb678[_0x49f8('0x19')]]){delete this['variables'][_0x3eb678[_0x49f8('0x19')]];}}}catch(_0x2ad683){logger['error'](_0x49f8('0x59'),util[_0x49f8('0x25')](_0x2ad683,{'showHidden':![],'depth':null}));}};module[_0x49f8('0x5a')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 454b39d..23a8250 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 _0x042d=['custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncQueueSummaryComplete','isUndefined','uniqueid','queuecallerjoinAt','position','count','pick','keys','last','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','syncQueueCallerLeave','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallercomplete','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','startsWith','toLowerCase','local/','linkedid','add','FORWARDTRANSFER','transfertype','FORWARD','transferuniqueid','COMPLETEDBY','reason','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','value','variable','queuestatus','CONTINUE','queuecallerleaveAt','queueposition','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','length','abandoned','sumHoldTime','seconds','diff','queuecallercompleteAt','custom:queuecallerunmanaged','lastevent','custom:queuecallerabandon','[syncHangup][VoiceQueueReport]','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','switch','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLIND','extension','BlindTransfer','context','transfererchannel','[syncMusicOnHoldStart][VoiceQueueReport]','mohstarttime','mohtime','milliseconds','moment','bluebird','util','md5','../../../config/environment','../../../config/logger','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','sequence','isNil','Action','status','channel','catch','message','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','voice:queue:%s','name','voice_queue_channel:save','emitVoiceQueueChannelRemove','format','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','talking','total','unmanaged','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','clearZombieChannels','[queues]','then','[queuesummary]','queue','countBy','callers','toNumber','loggedin'];(function(_0x22335d,_0x3f0f59){var _0xdf9157=function(_0x52cbc7){while(--_0x52cbc7){_0x22335d['push'](_0x22335d['shift']());}};_0xdf9157(++_0x3f0f59);}(_0x042d,0x12b));var _0xd042=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x042d[_0x2e3107];return _0x833d69;};'use strict';var _=require('lodash');var moment=require(_0xd042('0x0'));var BPromise=require(_0xd042('0x1'));var util=require(_0xd042('0x2'));var md5=require(_0xd042('0x3'));var Redis=require('ioredis');var config=require(_0xd042('0x4'));var logger=require(_0xd042('0x5'))('ami');var ami=require(_0xd042('0x6'));var QueueReport=require(_0xd042('0x7'));config[_0xd042('0x8')]=_[_0xd042('0x9')](config['redis'],{'host':_0xd042('0xa'),'port':0x18eb});var io=require(_0xd042('0xb'))(new Redis(config[_0xd042('0x8')]));var Sequence=function(){};Sequence[_0xd042('0xc')][_0xd042('0xd')]=function(_0x32443f){this[_0xd042('0xe')]=this[_0xd042('0xe')]?this['tail'][_0xd042('0xf')](_0x32443f):_0x32443f();};function VoiceQueueReport(_0x10abe9){this['sequence']=new Sequence();this[_0xd042('0x10')]={};this['agents']=_0x10abe9[_0xd042('0x11')];this[_0xd042('0x12')]=_0x10abe9[_0xd042('0x13')];this[_0xd042('0x14')]=_0x10abe9[_0xd042('0x14')];this[_0xd042('0x15')]=!![];this[_0xd042('0x16')]=_0x10abe9[_0xd042('0x16')];this[_0xd042('0x17')]={};ami['on'](_0xd042('0x18'),this[_0xd042('0x19')][_0xd042('0x1a')](this));ami['on'](_0xd042('0x1b'),this['syncQueueSummaryComplete'][_0xd042('0x1a')](this));ami['on'](_0xd042('0x1c'),this[_0xd042('0x1d')][_0xd042('0x1a')](this));ami['on'](_0xd042('0x1e'),this[_0xd042('0x1f')][_0xd042('0x1a')](this));ami['on'](_0xd042('0x20'),this['syncQueueCallerLeave']['bind'](this));ami['on'](_0xd042('0x21'),this[_0xd042('0x22')][_0xd042('0x1a')](this));ami['on'](_0xd042('0x23'),this['syncAgentConnect']['bind'](this));ami['on'](_0xd042('0x24'),this[_0xd042('0x25')][_0xd042('0x1a')](this));ami['on'](_0xd042('0x26'),this[_0xd042('0x27')][_0xd042('0x1a')](this));ami['on'](_0xd042('0x28'),this['syncFullyBooted'][_0xd042('0x1a')](this));ami['on'](_0xd042('0x29'),this[_0xd042('0x2a')]['bind'](this));ami['on'](_0xd042('0x2b'),this[_0xd042('0x2c')][_0xd042('0x1a')](this));ami['on']('attendedtransfer',this[_0xd042('0x2d')]['bind'](this));ami['on'](_0xd042('0x2e'),this[_0xd042('0x2f')][_0xd042('0x1a')](this));this[_0xd042('0x30')]();this['loopQueueShow']();}function isNotNull(_0x2402c1){return _0x2402c1!==null&&!_['isUndefined'](_0x2402c1);}function clearChannels(_0x2b0b52){if(!_[_0xd042('0x31')](_0x2b0b52)){for(var _0x35c357 in _0x2b0b52){if(_0x2b0b52[_0xd042('0x32')](_0x35c357)){delete _0x2b0b52[_0x35c357];}}}}function clearCampaigns(_0x4d6bd7){if(!_[_0xd042('0x31')](_0x4d6bd7)){for(var _0x3038ff in _0x4d6bd7){if(_0x4d6bd7[_0xd042('0x32')](_0x3038ff)){_0x4d6bd7[_0x3038ff][_0xd042('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2a0179){if(!_['isEmpty'](_0x2a0179)){for(var _0x27f561 in _0x2a0179){if(_0x2a0179[_0xd042('0x32')](_0x27f561)){_0x2a0179[_0x27f561][_0xd042('0x33')]=0x0;_0x2a0179[_0x27f561]['talking']=0x0;_0x2a0179[_0x27f561][_0xd042('0x34')]=0x0;_0x2a0179[_0x27f561][_0xd042('0x35')]=0x0;_0x2a0179[_0x27f561][_0xd042('0x36')]=!![];}}}}function clearAgentBooked(_0x887bac){if(!_[_0xd042('0x31')](_0x887bac)){for(var _0x251120 in _0x887bac){if(_0x887bac['hasOwnProperty'](_0x251120)){_0x887bac[_0x251120]['unlockRR']=!![];}}}}VoiceQueueReport[_0xd042('0xc')]['clearZombieChannels']=function(){var _0x28b618=this;for(var _0x1710c5 in this[_0xd042('0x12')]){if(this[_0xd042('0x12')][_0xd042('0x32')](_0x1710c5)&&!this[_0xd042('0x12')][_0x1710c5]['switch']){this[_0xd042('0x37')]['enqueue'](function(){if(!_[_0xd042('0x38')](_0x28b618[_0xd042('0x12')][_0x1710c5])){return ami[_0xd042('0x39')]({'action':_0xd042('0x3a'),'channel':_0x28b618[_0xd042('0x12')][_0x1710c5][_0xd042('0x3b')]})[_0xd042('0x3c')](function(_0x389055){if(_0x389055[_0xd042('0x3d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x28b618['channels'][_0x1710c5]){delete _0x28b618[_0xd042('0x12')][_0x1710c5];logger[_0xd042('0x3e')](_0xd042('0x3f'),_0x1710c5);}if(_0x28b618['queueReports'][_0x1710c5]){delete _0x28b618[_0xd042('0x10')][_0x1710c5];logger[_0xd042('0x3e')](_0xd042('0x40'),_0x1710c5);}if(_0x28b618['variables'][_0x1710c5]){delete _0x28b618[_0xd042('0x17')][_0x1710c5];logger['error'](_0xd042('0x41'),_0x1710c5);}},0x1f40);}});}});}}};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x42')]=function(){logger['error'](_0xd042('0x43'));clearChannels(this['channels']);this[_0xd042('0x44')](this[_0xd042('0x10')]);clearAgentBooked(this[_0xd042('0x11')]);clearVoiceQueues(this[_0xd042('0x14')]);clearCampaigns(this[_0xd042('0x16')]);};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x44')]=function(_0xacf39a){var _0x472955=this;if(!_['isEmpty'](_0xacf39a)){for(var _0x4a96ce in _0xacf39a){if(_0xacf39a['hasOwnProperty'](_0x4a96ce)){_0x472955['emitVoiceQueueChannelRemove'](_0xacf39a[_0x4a96ce]);delete _0xacf39a[_0x4a96ce];}}}};function loggerCatch(_0x569939){return function(_0x34d481){logger[_0xd042('0x3e')](_0x569939,util[_0xd042('0x45')](_0x34d481,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xd042('0xc')][_0xd042('0x46')]=function(_0x5409df,_0xe6b03d,_0x4a3c06){io['to'](_0x5409df)[_0xd042('0x46')](_0xe6b03d,_0x4a3c06);};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x47')]=function(_0x2ba441){this[_0xd042('0x46')](util['format'](_0xd042('0x48'),_0x2ba441[_0xd042('0x49')]),_0xd042('0x4a'),_0x2ba441);};VoiceQueueReport['prototype'][_0xd042('0x4b')]=function(_0x8f8a66){this[_0xd042('0x46')](util[_0xd042('0x4c')]('voice:queue:%s',_0x8f8a66[_0xd042('0x49')]),_0xd042('0x4d'),_0x8f8a66);};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x4e')]=function(_0x383ea2){if(_0x383ea2[_0xd042('0x4f')]===_0xd042('0x50')){var _0x58d327={'id':_0x383ea2['id'],'name':_0x383ea2[_0xd042('0x49')],'strategy':_0x383ea2[_0xd042('0x51')],'answered':_0x383ea2[_0xd042('0x52')],'available':_0x383ea2[_0xd042('0x53')],'loggedIn':_0x383ea2[_0xd042('0x54')],'pTalking':_0x383ea2[_0xd042('0x34')],'sumBillable':_0x383ea2[_0xd042('0x55')],'sumDuration':_0x383ea2[_0xd042('0x56')],'sumHoldTime':_0x383ea2['sumHoldTime']||0x0,'talking':_0x383ea2[_0xd042('0x57')],'total':_0x383ea2[_0xd042('0x58')],'type':_0x383ea2[_0xd042('0x4f')],'unmanaged':_0x383ea2[_0xd042('0x59')],'abandoned':_0x383ea2['abandoned'],'waiting':_0x383ea2[_0xd042('0x35')]};if(_0x383ea2[_0xd042('0x5a')]){_0x58d327[_0xd042('0x5a')]={'id':_0x383ea2['Trunk']['id'],'name':_0x383ea2[_0xd042('0x5a')][_0xd042('0x49')],'active':_0x383ea2[_0xd042('0x5a')][_0xd042('0x5b')],'callerid':_0x383ea2['Trunk'][_0xd042('0x5c')]};}if(_0x383ea2[_0xd042('0x5d')]){_0x58d327[_0xd042('0x5d')]={'id':_0x383ea2[_0xd042('0x5d')]['id'],'name':_0x383ea2[_0xd042('0x5d')][_0xd042('0x49')]};}var _0x4ec83d=md5(JSON['stringify'](_0x58d327));if(_0x383ea2[_0xd042('0x3')]!==_0x4ec83d){_0x383ea2[_0xd042('0x3')]=_0x4ec83d;this[_0xd042('0x46')](util['format']('voice:queue:%s',_0x58d327[_0xd042('0x49')]),_0xd042('0x5e'),_0x58d327);}}};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x5f')]=function(_0x1884bd){return _0x1884bd!==null&&!_['isUndefined'](_0x1884bd);};VoiceQueueReport[_0xd042('0xc')]['loopQueueShow']=function(){var _0x2fd378=this;setInterval(function(){_0x2fd378[_0xd042('0x60')]();ami['Action']({'action':'queues'})[_0xd042('0x3c')](loggerCatch(_0xd042('0x61')));},0x2710);};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x30')]=function(){var _0x4baac7=this;setInterval(function(){if(_0x4baac7[_0xd042('0x15')]){return ami[_0xd042('0x39')]({'action':_0xd042('0x18')})[_0xd042('0x62')](function(_0x16929d){_0x4baac7['flagQueueSummary']=![];})[_0xd042('0x3c')](loggerCatch(_0xd042('0x63')));}},0x3e8);};VoiceQueueReport['prototype'][_0xd042('0x19')]=function(_0x2f9866){try{if(this['isNotNull'](_0x2f9866)&&this[_0xd042('0x5f')](_0x2f9866['queue'])){if(this[_0xd042('0x14')][_0x2f9866[_0xd042('0x64')]]){var _0x3d4ce2=_[_0xd042('0x65')](this[_0xd042('0x12')],_0xd042('0x64'))[_0x2f9866[_0xd042('0x64')]]||0x0;var _0x75ed5f=_0x3d4ce2-_0x2f9866[_0xd042('0x66')];if(this['voiceQueues'][_0x2f9866[_0xd042('0x64')]]['waiting']!==_[_0xd042('0x67')](_0x2f9866[_0xd042('0x66')])||this['voiceQueues'][_0x2f9866[_0xd042('0x64')]][_0xd042('0x54')]!==_['toNumber'](_0x2f9866[_0xd042('0x68')])||this['voiceQueues'][_0x2f9866['queue']][_0xd042('0x53')]!==_[_0xd042('0x67')](_0x2f9866[_0xd042('0x53')])||this['voiceQueues'][_0x2f9866[_0xd042('0x64')]][_0xd042('0x57')]!==_0x75ed5f){this['voiceQueues'][_0x2f9866[_0xd042('0x64')]][_0xd042('0x35')]=_['toNumber'](_0x2f9866[_0xd042('0x66')]);this[_0xd042('0x14')][_0x2f9866['queue']]['loggedIn']=_[_0xd042('0x67')](_0x2f9866[_0xd042('0x68')]);this[_0xd042('0x14')][_0x2f9866[_0xd042('0x64')]][_0xd042('0x53')]=_[_0xd042('0x67')](_0x2f9866[_0xd042('0x53')]);this['voiceQueues'][_0x2f9866[_0xd042('0x64')]]['talking']=_0x75ed5f>0x0?_0x75ed5f:0x0;this[_0xd042('0x14')][_0x2f9866[_0xd042('0x64')]][_0xd042('0x57')]=this['voiceQueues'][_0x2f9866[_0xd042('0x64')]]['talking']>_[_0xd042('0x67')](_0x2f9866['loggedin'])?_[_0xd042('0x67')](_0x2f9866['loggedin']):this[_0xd042('0x14')][_0x2f9866[_0xd042('0x64')]]['talking'];this[_0xd042('0x4e')](this[_0xd042('0x14')][_0x2f9866['queue']]);}ami[_0xd042('0x46')](_0xd042('0x69'),this[_0xd042('0x14')][_0x2f9866[_0xd042('0x64')]]);}}}catch(_0x446456){logger['error'](_0xd042('0x6a'),util['inspect'](_0x446456,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x6b')]=function(_0x3b0f77){this[_0xd042('0x15')]=!![];};VoiceQueueReport[_0xd042('0xc')]['syncNewExten']=function(_0x226882){};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x1d')]=function(_0x45983d){try{if(this[_0xd042('0x5f')](_0x45983d)){if(_[_0xd042('0x6c')](this[_0xd042('0x10')][_0x45983d[_0xd042('0x6d')]])){this['queueReports'][_0x45983d[_0xd042('0x6d')]]=[];this[_0xd042('0x12')][_0x45983d[_0xd042('0x6d')]]={};}var _0x59cc40=new QueueReport();_0x59cc40[_0xd042('0x49')]=_0x45983d['queue'];_0x59cc40['type']=this[_0xd042('0x14')][_0x59cc40[_0xd042('0x49')]]&&this['voiceQueues'][_0x59cc40[_0xd042('0x49')]][_0xd042('0x4f')]?this[_0xd042('0x14')][_0x59cc40['name']][_0xd042('0x4f')]||_0xd042('0x50'):'inbound';_0x59cc40[_0xd042('0x64')]=_0x45983d[_0xd042('0x64')];_0x59cc40[_0xd042('0x6e')]=moment()[_0xd042('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x59cc40[_0xd042('0x6f')]=_0x45983d[_0xd042('0x6f')];_0x59cc40[_0xd042('0x70')]=_0x45983d[_0xd042('0x70')];_['merge'](_0x59cc40,_[_0xd042('0x71')](_0x45983d,_[_0xd042('0x72')](_0x59cc40)));this[_0xd042('0x10')][_0x45983d[_0xd042('0x6d')]]['push'](_0x59cc40);this['channels'][_0x45983d[_0xd042('0x6d')]]=_0x59cc40;this['emitVoiceQueueChannelSave'](_0x59cc40);}}catch(_0x98117a){logger[_0xd042('0x3e')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0xd042('0x45')](_0x98117a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd042('0xc')]['syncQueueCallerAbandon']=function(_0x15954d){try{if(this[_0xd042('0x5f')](_0x15954d)){if(this[_0xd042('0x10')][_0x15954d[_0xd042('0x6d')]]){var _0x229c58=_[_0xd042('0x73')](this['queueReports'][_0x15954d[_0xd042('0x6d')]]);_0x229c58['queuecallercomplete']=![];_0x229c58['queuecallercompleteAt']=null;_0x229c58[_0xd042('0x74')]=_0x15954d[_0xd042('0x74')];_0x229c58[_0xd042('0x75')]=_0x15954d['originalposition'];_0x229c58['queuecallerabandon']=!![];_0x229c58[_0xd042('0x76')]=moment()[_0xd042('0x4c')](_0xd042('0x77'));_0x229c58[_0xd042('0x78')]=_0xd042('0x79');_0x229c58[_0xd042('0x7a')]=null;this[_0xd042('0x12')][_0x15954d['uniqueid']]=_0x229c58;this[_0xd042('0x4b')](_0x229c58);}}}catch(_0x4bfff2){logger[_0xd042('0x3e')](_0xd042('0x7b'),util[_0xd042('0x45')](_0x4bfff2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x7c')]=function(_0x52adee){try{if(this[_0xd042('0x5f')](_0x52adee)){if(this[_0xd042('0x10')][_0x52adee[_0xd042('0x6d')]]){var _0x2abd2c=_['last'](this[_0xd042('0x10')][_0x52adee[_0xd042('0x6d')]]);_0x2abd2c['queuecallerleaveAt']=moment()['format'](_0xd042('0x77'));_0x2abd2c[_0xd042('0x7d')]=_0x52adee[_0xd042('0x7d')];_0x2abd2c[_0xd042('0x7e')]=_0x52adee[_0xd042('0x7e')];this[_0xd042('0x12')][_0x52adee[_0xd042('0x6d')]]=_0x2abd2c;this[_0xd042('0x47')](_0x2abd2c);}}}catch(_0x1db4e0){logger[_0xd042('0x3e')](_0xd042('0x7f'),util[_0xd042('0x45')](_0x1db4e0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd042('0xc')]['syncAgentConnect']=function(_0x1111f1){try{if(this[_0xd042('0x5f')](_0x1111f1)){if(this[_0xd042('0x10')][_0x1111f1[_0xd042('0x6d')]]){var _0x5a6c31=_[_0xd042('0x73')](this[_0xd042('0x10')][_0x1111f1[_0xd042('0x6d')]]);_0x5a6c31[_0xd042('0x80')]=!![];_0x5a6c31['queuecallerexitreason']=_0xd042('0x81');}}}catch(_0x15f11b){logger[_0xd042('0x3e')](_0xd042('0x82'),util['inspect'](_0x15f11b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x22')]=function(_0x415652){try{if(this[_0xd042('0x5f')](_0x415652)){if(this[_0xd042('0x10')][_0x415652[_0xd042('0x6d')]]){var _0x2b502b=_[_0xd042('0x73')](this[_0xd042('0x10')][_0x415652['uniqueid']]);_0x2b502b[_0xd042('0x1e')]=![];_0x2b502b[_0xd042('0x76')]=null;_0x2b502b[_0xd042('0x83')]=!![];_0x2b502b[_0xd042('0x7a')]=_0x415652[_0xd042('0x84')];_0x2b502b[_0xd042('0x74')]=_0x415652['holdtime'];_0x2b502b['queuecallercomplete']=!![];_0x2b502b[_0xd042('0x85')]=![];_0x2b502b[_0xd042('0x86')]=null;if(!_0x2b502b[_0xd042('0x87')]){if(_0x415652['reason']==_0xd042('0x87')){_0x2b502b['queuecallerexitreason']=_0xd042('0x88');}else{if(_[_0xd042('0x89')](_0x415652[_0xd042('0x3b')][_0xd042('0x8a')](),_0xd042('0x8b'))){if(this['queueReports'][_0x415652[_0xd042('0x8c')]]){var _0x5bc993=_[_0xd042('0x73')](this[_0xd042('0x10')][_0x415652[_0xd042('0x8c')]]);_0x5bc993[_0xd042('0x80')]=![];_0x5bc993[_0xd042('0x85')]=!![];_0x5bc993[_0xd042('0x86')]=moment(_0x2b502b[_0xd042('0x6e')])[_0xd042('0x8d')](_0x415652[_0xd042('0x74')],'seconds')[_0xd042('0x4c')](_0xd042('0x77'));_0x5bc993[_0xd042('0x78')]=_0xd042('0x8e');_0x5bc993[_0xd042('0x87')]=!![];_0x5bc993[_0xd042('0x8f')]=_0xd042('0x90');_0x5bc993['transferexten']=_0x415652['destexten'];_0x5bc993[_0xd042('0x91')]=_0x415652[_0xd042('0x6d')];var _0x2ec2bf=this['queueReports'][_0x415652[_0xd042('0x8c')]];this[_0xd042('0x10')][_0x415652[_0xd042('0x8c')]]=this[_0xd042('0x10')][_0x415652[_0xd042('0x6d')]];this[_0xd042('0x10')][_0x415652[_0xd042('0x6d')]]=_0x2ec2bf;}}else{_0x2b502b[_0xd042('0x78')]=_0xd042('0x92')+_0x415652[_0xd042('0x93')][_0xd042('0x94')]();}}}this[_0xd042('0x12')][_0x415652['uniqueid']]=_0x2b502b;this[_0xd042('0x4b')](_0x2b502b);}}}catch(_0x320c82){logger[_0xd042('0x3e')](_0xd042('0x95'),util[_0xd042('0x45')](_0x320c82,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd042('0xc')]['syncVarSet']=function(_0x287443){try{if(this['isNotNull'](_0x287443)){this[_0xd042('0x96')](_0x287443[_0xd042('0x6d')],_[_0xd042('0x72')](_0x287443['variable'])[0x0],_0x287443[_0xd042('0x97')]);if(this[_0xd042('0x10')][_0x287443[_0xd042('0x6d')]]){var _0x3ed626=_[_0xd042('0x73')](this[_0xd042('0x10')][_0x287443[_0xd042('0x6d')]]);if(_0x3ed626){if(this[_0xd042('0x5f')](_0x287443['variable'])&&this[_0xd042('0x5f')](_0x287443[_0xd042('0x98')][_0xd042('0x99')])){switch(_0x287443[_0xd042('0x97')]){case _0xd042('0x9a'):_0x3ed626[_0xd042('0x85')]=![];_0x3ed626['queuecallerexitAt']=null;break;default:_0x3ed626[_0xd042('0x85')]=!![];_0x3ed626[_0xd042('0x86')]=moment()[_0xd042('0x4c')](_0xd042('0x77'));_0x3ed626[_0xd042('0x9b')]=moment()[_0xd042('0x4c')](_0xd042('0x77'));}_0x3ed626['queuecallerabandon']=![];_0x3ed626[_0xd042('0x76')]=null;_0x3ed626[_0xd042('0x78')]=_0x287443[_0xd042('0x97')];this[_0xd042('0x12')][_0x287443['uniqueid']]=_0x3ed626;this[_0xd042('0x4b')](_0x3ed626);}else if(this[_0xd042('0x5f')](_0x287443[_0xd042('0x98')])&&this['isNotNull'](_0x287443[_0xd042('0x98')][_0xd042('0x9c')])){if(!_0x3ed626['queuecallerabandon']){_0x3ed626[_0xd042('0x85')]=!![];_0x3ed626[_0xd042('0x86')]=moment()[_0xd042('0x4c')](_0xd042('0x77'));_0x3ed626[_0xd042('0x78')]='EXITWITHKEY';_0x3ed626['queuecallerleaveAt']=moment()['format'](_0xd042('0x77'));this[_0xd042('0x12')][_0x287443['uniqueid']]=_0x3ed626;}}_0x3ed626[_0xd042('0x17')]=this[_0xd042('0x17')][_0x287443['uniqueid']];}}}}catch(_0x377397){logger[_0xd042('0x3e')]('[syncVarSet][VoiceQueueReport]',util[_0xd042('0x45')](_0x377397,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x96')]=function(_0x205c26,_0x2a6284,_0xcffdf1){var _0x146d79=['rtpaudioqos',_0xd042('0x9d'),_0xd042('0x9e'),_0xd042('0x9f'),_0xd042('0xa0'),_0xd042('0xa1'),'rtpaudioqosrtt',_0xd042('0xa2'),_0xd042('0xa3'),_0xd042('0xa4'),_0xd042('0xa5'),_0xd042('0xa6'),_0xd042('0xa7'),_0xd042('0xa8'),_0xd042('0xa9'),_0xd042('0xaa'),'membername','memberpenalty',_0xd042('0xab')];if(!_[_0xd042('0x38')](_0x2a6284)&&!_[_0xd042('0xac')](_0x146d79,_0x2a6284)){if(_[_0xd042('0x6c')](this[_0xd042('0x17')][_0x205c26])){this[_0xd042('0x17')][_0x205c26]={};}this['variables'][_0x205c26][_0x2a6284]=_0xcffdf1;}};VoiceQueueReport[_0xd042('0xc')][_0xd042('0x27')]=function(_0x53d707){try{if(this[_0xd042('0x5f')](_0x53d707)){if(this[_0xd042('0x10')][_0x53d707[_0xd042('0x6d')]]){for(var _0x2cc466=0x0,_0x425d0a={};_0x2cc4660x0?_0x4f5d56:0x0;this[_0x68eb('0xe')][_0x49ac33[_0x68eb('0x5f')]]['talking']=this['voiceQueues'][_0x49ac33[_0x68eb('0x5f')]]['talking']>_['toNumber'](_0x49ac33[_0x68eb('0x63')])?_[_0x68eb('0x62')](_0x49ac33['loggedin']):this[_0x68eb('0xe')][_0x49ac33[_0x68eb('0x5f')]][_0x68eb('0x31')];this[_0x68eb('0x64')](this['voiceQueues'][_0x49ac33[_0x68eb('0x5f')]]);}ami['emit'](_0x68eb('0x65'),this['voiceQueues'][_0x49ac33['queue']]);}}}catch(_0x218827){logger[_0x68eb('0x3e')](_0x68eb('0x66'),util[_0x68eb('0x45')](_0x218827,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x68eb('0x7')][_0x68eb('0x67')]=function(_0x1b00b){this[_0x68eb('0x5c')]=!![];};VoiceQueueReport[_0x68eb('0x7')][_0x68eb('0x68')]=function(_0x59504d){};VoiceQueueReport[_0x68eb('0x7')][_0x68eb('0x16')]=function(_0x22c01c){try{if(this[_0x68eb('0x59')](_0x22c01c)){if(_['isUndefined'](this[_0x68eb('0xb')][_0x22c01c[_0x68eb('0x69')]])){this[_0x68eb('0xb')][_0x22c01c[_0x68eb('0x69')]]=[];this[_0x68eb('0xd')][_0x22c01c[_0x68eb('0x69')]]={};}var _0x29bcec=new QueueReport();_0x29bcec['name']=_0x22c01c[_0x68eb('0x5f')];_0x29bcec['type']=this[_0x68eb('0xe')][_0x29bcec['name']]&&this[_0x68eb('0xe')][_0x29bcec[_0x68eb('0x49')]][_0x68eb('0x4b')]?this[_0x68eb('0xe')][_0x29bcec[_0x68eb('0x49')]][_0x68eb('0x4b')]||_0x68eb('0x4c'):_0x68eb('0x4c');_0x29bcec[_0x68eb('0x5f')]=_0x22c01c[_0x68eb('0x5f')];_0x29bcec[_0x68eb('0x6a')]=moment()[_0x68eb('0x4a')](_0x68eb('0x6b'));_0x29bcec[_0x68eb('0x6c')]=_0x22c01c[_0x68eb('0x6c')];_0x29bcec['count']=_0x22c01c[_0x68eb('0x6d')];_['merge'](_0x29bcec,_[_0x68eb('0x6e')](_0x22c01c,_[_0x68eb('0x6f')](_0x29bcec)));this[_0x68eb('0xb')][_0x22c01c[_0x68eb('0x69')]]['push'](_0x29bcec);this[_0x68eb('0xd')][_0x22c01c['uniqueid']]=_0x29bcec;this[_0x68eb('0x47')](_0x29bcec);}}catch(_0x410b52){logger[_0x68eb('0x3e')](_0x68eb('0x70'),util[_0x68eb('0x45')](_0x410b52,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x68eb('0x18')]=function(_0x2a3b46){try{if(this['isNotNull'](_0x2a3b46)){if(this['queueReports'][_0x2a3b46[_0x68eb('0x69')]]){var _0x3179fe=_[_0x68eb('0x71')](this['queueReports'][_0x2a3b46[_0x68eb('0x69')]]);_0x3179fe['queuecallercomplete']=![];_0x3179fe[_0x68eb('0x72')]=null;_0x3179fe[_0x68eb('0x73')]=_0x2a3b46['holdtime'];_0x3179fe[_0x68eb('0x74')]=_0x2a3b46['originalposition'];_0x3179fe[_0x68eb('0x17')]=!![];_0x3179fe[_0x68eb('0x75')]=moment()[_0x68eb('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3179fe[_0x68eb('0x76')]=_0x68eb('0x77');_0x3179fe[_0x68eb('0x78')]=null;this['channels'][_0x2a3b46[_0x68eb('0x69')]]=_0x3179fe;this[_0x68eb('0x44')](_0x3179fe);}}}catch(_0x57c0cc){logger[_0x68eb('0x3e')](_0x68eb('0x79'),util[_0x68eb('0x45')](_0x57c0cc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x68eb('0x7')]['syncQueueCallerLeave']=function(_0xa74b50){try{if(this['isNotNull'](_0xa74b50)){if(this[_0x68eb('0xb')][_0xa74b50[_0x68eb('0x69')]]){var _0x51f9fb=_[_0x68eb('0x71')](this[_0x68eb('0xb')][_0xa74b50[_0x68eb('0x69')]]);_0x51f9fb[_0x68eb('0x7a')]=moment()[_0x68eb('0x4a')](_0x68eb('0x6b'));_0x51f9fb[_0x68eb('0x7b')]=_0xa74b50['connectedlinenum'];_0x51f9fb['connectedlinename']=_0xa74b50[_0x68eb('0x7c')];this['channels'][_0xa74b50[_0x68eb('0x69')]]=_0x51f9fb;this[_0x68eb('0x47')](_0x51f9fb);}}}catch(_0x24b159){logger[_0x68eb('0x3e')]('[syncQueueCallerLeave][VoiceQueueReport]',util['inspect'](_0x24b159,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x68eb('0x7')]['syncAgentConnect']=function(_0x1978be){try{if(this[_0x68eb('0x59')](_0x1978be)){if(this[_0x68eb('0xb')][_0x1978be[_0x68eb('0x69')]]){var _0x1a8688=_[_0x68eb('0x71')](this['queueReports'][_0x1978be[_0x68eb('0x69')]]);_0x1a8688[_0x68eb('0x7d')]=!![];_0x1a8688[_0x68eb('0x76')]=_0x68eb('0x7e');}}}catch(_0x43985e){logger[_0x68eb('0x3e')](_0x68eb('0x7f'),util[_0x68eb('0x45')](_0x43985e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x68eb('0x7')][_0x68eb('0x1c')]=function(_0x134a3c){try{if(this[_0x68eb('0x59')](_0x134a3c)){if(this[_0x68eb('0xb')][_0x134a3c['uniqueid']]){var _0x3fbd09=_[_0x68eb('0x71')](this[_0x68eb('0xb')][_0x134a3c[_0x68eb('0x69')]]);_0x3fbd09[_0x68eb('0x17')]=![];_0x3fbd09['queuecallerabandonAt']=null;_0x3fbd09['assigned']=!![];_0x3fbd09[_0x68eb('0x78')]=_0x134a3c[_0x68eb('0x80')];_0x3fbd09[_0x68eb('0x73')]=_0x134a3c[_0x68eb('0x73')];_0x3fbd09[_0x68eb('0x7d')]=!![];_0x3fbd09['queuecallerexit']=![];_0x3fbd09[_0x68eb('0x81')]=null;if(!_0x3fbd09[_0x68eb('0x82')]){if(_0x134a3c[_0x68eb('0x83')]=='transfer'){_0x3fbd09[_0x68eb('0x76')]='COMPLETED';}else{if(_[_0x68eb('0x84')](_0x134a3c[_0x68eb('0x3a')]['toLowerCase'](),_0x68eb('0x85'))){if(this[_0x68eb('0xb')][_0x134a3c[_0x68eb('0x86')]]){var _0x3ae917=_[_0x68eb('0x71')](this[_0x68eb('0xb')][_0x134a3c['linkedid']]);_0x3ae917[_0x68eb('0x7d')]=![];_0x3ae917[_0x68eb('0x87')]=!![];_0x3ae917[_0x68eb('0x81')]=moment(_0x3fbd09[_0x68eb('0x6a')])[_0x68eb('0x88')](_0x134a3c[_0x68eb('0x73')],_0x68eb('0x89'))[_0x68eb('0x4a')](_0x68eb('0x6b'));_0x3ae917[_0x68eb('0x76')]=_0x68eb('0x8a');_0x3ae917[_0x68eb('0x82')]=!![];_0x3ae917[_0x68eb('0x8b')]=_0x68eb('0x8c');_0x3ae917[_0x68eb('0x8d')]=_0x134a3c[_0x68eb('0x8e')];_0x3ae917[_0x68eb('0x8f')]=_0x134a3c[_0x68eb('0x69')];var _0x110661=this['queueReports'][_0x134a3c[_0x68eb('0x86')]];this['queueReports'][_0x134a3c[_0x68eb('0x86')]]=this['queueReports'][_0x134a3c[_0x68eb('0x69')]];this[_0x68eb('0xb')][_0x134a3c[_0x68eb('0x69')]]=_0x110661;}}else{_0x3fbd09[_0x68eb('0x76')]=_0x68eb('0x90')+_0x134a3c[_0x68eb('0x83')]['toUpperCase']();}}}this[_0x68eb('0xd')][_0x134a3c['uniqueid']]=_0x3fbd09;this[_0x68eb('0x44')](_0x3fbd09);}}}catch(_0x3f9b8e){logger['error'](_0x68eb('0x91'),util['inspect'](_0x3f9b8e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x68eb('0x7')]['syncVarSet']=function(_0x162519){try{if(this[_0x68eb('0x59')](_0x162519)){this[_0x68eb('0x92')](_0x162519[_0x68eb('0x69')],_[_0x68eb('0x6f')](_0x162519[_0x68eb('0x93')])[0x0],_0x162519[_0x68eb('0x94')]);if(this[_0x68eb('0xb')][_0x162519[_0x68eb('0x69')]]){var _0x36ecaa=_[_0x68eb('0x71')](this[_0x68eb('0xb')][_0x162519['uniqueid']]);if(_0x36ecaa){if(this[_0x68eb('0x59')](_0x162519[_0x68eb('0x93')])&&this[_0x68eb('0x59')](_0x162519[_0x68eb('0x93')][_0x68eb('0x95')])){switch(_0x162519['value']){case _0x68eb('0x96'):_0x36ecaa[_0x68eb('0x87')]=![];_0x36ecaa[_0x68eb('0x81')]=null;break;default:_0x36ecaa[_0x68eb('0x87')]=!![];_0x36ecaa[_0x68eb('0x81')]=moment()[_0x68eb('0x4a')](_0x68eb('0x6b'));_0x36ecaa[_0x68eb('0x7a')]=moment()[_0x68eb('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x36ecaa[_0x68eb('0x17')]=![];_0x36ecaa[_0x68eb('0x75')]=null;_0x36ecaa['queuecallerexitreason']=_0x162519[_0x68eb('0x94')];this[_0x68eb('0xd')][_0x162519[_0x68eb('0x69')]]=_0x36ecaa;this['emitVoiceQueueChannelRemove'](_0x36ecaa);}else if(this['isNotNull'](_0x162519[_0x68eb('0x93')])&&this[_0x68eb('0x59')](_0x162519['variable']['queueposition'])){if(!_0x36ecaa[_0x68eb('0x17')]){_0x36ecaa[_0x68eb('0x87')]=!![];_0x36ecaa[_0x68eb('0x81')]=moment()[_0x68eb('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x36ecaa['queuecallerexitreason']=_0x68eb('0x97');_0x36ecaa[_0x68eb('0x7a')]=moment()[_0x68eb('0x4a')](_0x68eb('0x6b'));this[_0x68eb('0xd')][_0x162519[_0x68eb('0x69')]]=_0x36ecaa;}}_0x36ecaa[_0x68eb('0x10')]=this[_0x68eb('0x10')][_0x162519['uniqueid']];}}}}catch(_0x22564a){logger[_0x68eb('0x3e')]('[syncVarSet][VoiceQueueReport]',util[_0x68eb('0x45')](_0x22564a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x68eb('0x92')]=function(_0x3b50b6,_0x1c44c0,_0x1ce78a){var _0x476012=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter',_0x68eb('0x98'),_0x68eb('0x99'),'rtpaudioqoslossbridged',_0x68eb('0x9a'),_0x68eb('0x9b'),_0x68eb('0x9c'),_0x68eb('0x9d'),_0x68eb('0x9e'),_0x68eb('0x9f'),_0x68eb('0xa0'),_0x68eb('0xa1'),_0x68eb('0xa2'),_0x68eb('0xa3'),_0x68eb('0x80'),_0x68eb('0xa4'),_0x68eb('0xa5')];if(!_[_0x68eb('0x37')](_0x1c44c0)&&!_['includes'](_0x476012,_0x1c44c0)){if(_[_0x68eb('0x2d')](this[_0x68eb('0x10')][_0x3b50b6])){this[_0x68eb('0x10')][_0x3b50b6]={};}this[_0x68eb('0x10')][_0x3b50b6][_0x1c44c0]=_0x1ce78a;}};VoiceQueueReport[_0x68eb('0x7')][_0x68eb('0x20')]=function(_0x2ca705){try{if(this[_0x68eb('0x59')](_0x2ca705)){if(this[_0x68eb('0xb')][_0x2ca705['uniqueid']]){for(var _0x592ec9=0x0,_0x4c9fc4={};_0x592ec9=0x0?moment(_0x4eb867[_0xf6a1('0x14')])[_0xf6a1('0xb')](_0x4eb867[_0xf6a1('0x15')],_0xf6a1('0xc')):null,'data1':_0xf6a1('0x16'),'data2':_0x4eb867[_0xf6a1('0xf')],'data3':_0x4eb867['exten'],'data4':_0x4eb867[_0xf6a1('0x17')]||null,'role':'agent','internal':_0x4eb867[_0xf6a1('0xf')]?_['toNumber'](_0x4eb867['accountcode']):undefined,'uniqueid':_0x4eb867[_0xf6a1('0x10')]},'log':_0xf6a1('0x6')});}; \ No newline at end of file +var _0x0529=['queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','seconds','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','queuecallerleaveAt','diff','inbound','exten'];(function(_0x27b127,_0x4dd728){var _0x16f9ed=function(_0x5cfb99){while(--_0x5cfb99){_0x27b127['push'](_0x27b127['shift']());}};_0x16f9ed(++_0x4dd728);}(_0x0529,0x1b1));var _0x9052=function(_0x1d6e83,_0x5554ac){_0x1d6e83=_0x1d6e83-0x0;var _0x32889b=_0x0529[_0x1d6e83];return _0x32889b;};'use strict';var moment=require(_0x9052('0x0'));var _=require(_0x9052('0x1'));var util=require(_0x9052('0x2'));var client=require(_0x9052('0x3'));exports[_0x9052('0x4')]=function(_0x55ce0e){var _0x39ee61=_0x55ce0e[_0x9052('0x5')]||_0x55ce0e[_0x9052('0x6')];return client['Request'](_0x9052('0x7'),{'body':{'channel':_0x9052('0x8'),'membername':_0x55ce0e[_0x9052('0x9')],'interface':_[_0x9052('0xa')](_0x55ce0e[_0x9052('0xb')])?util[_0x9052('0xc')]('SIP/%s',_0x55ce0e['lastAssignedTo']):_0x55ce0e[_0x9052('0xb')],'type':'TALKING','enterAt':_0x55ce0e[_0x9052('0xd')],'exitAt':_0x39ee61,'duration':moment(_0x39ee61)[_0x9052('0xe')](_0x55ce0e[_0x9052('0xd')],'seconds'),'data1':_0x9052('0xf'),'data2':_0x55ce0e['calleridnum'],'data3':_0x55ce0e[_0x9052('0x10')],'data4':null,'data5':_0x55ce0e[_0x9052('0x11')],'role':_0x9052('0x12'),'internal':_0x55ce0e[_0x9052('0x13')]?_[_0x9052('0x14')](_0x55ce0e['accountcode']):undefined,'uniqueid':_0x55ce0e[_0x9052('0x15')]},'log':_0x9052('0x7')});};exports[_0x9052('0x16')]=function(_0x247491){return client['Request'](_0x9052('0x7'),{'body':{'channel':_0x9052('0x8'),'membername':_0x247491[_0x9052('0x17')],'interface':_0x247491[_0x9052('0xb')],'type':_0x9052('0x18'),'enterAt':_0x247491[_0x9052('0x19')],'exitAt':_0x247491[_0x9052('0x1a')],'duration':moment(_0x247491['endtime'])[_0x9052('0xe')](_0x247491[_0x9052('0x19')],_0x9052('0x1b'))>=0x0?moment(_0x247491[_0x9052('0x1a')])[_0x9052('0xe')](_0x247491[_0x9052('0x19')],_0x9052('0x1b')):null,'data1':_0x9052('0x1c'),'data2':_0x247491[_0x9052('0x13')],'data3':_0x247491['exten'],'data4':_0x247491[_0x9052('0x1d')]||null,'role':_0x9052('0x12'),'internal':_0x247491[_0x9052('0x13')]?_[_0x9052('0x14')](_0x247491[_0x9052('0x13')]):undefined,'uniqueid':_0x247491[_0x9052('0x15')]},'log':_0x9052('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9fc73f2..8e420d3 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 _0xf4e7=['../client','getTemplates','html'];(function(_0xa73be1,_0x589b06){var _0x2ab11f=function(_0x4d2cbf){while(--_0x4d2cbf){_0xa73be1['push'](_0xa73be1['shift']());}};_0x2ab11f(++_0x589b06);}(_0xf4e7,0x15c));var _0x7f4e=function(_0x1a2318,_0x3d1585){_0x1a2318=_0x1a2318-0x0;var _0xd987dd=_0xf4e7[_0x1a2318];return _0xd987dd;};'use strict';var client=require(_0x7f4e('0x0'));exports[_0x7f4e('0x1')]=function(_0x5d22f1){return function(_0x485201){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x7f4e('0x2')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x76da=['Request','GetTemplate','name','../client','getTemplates'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x76da,0xbc));var _0xa76d=function(_0x19389d,_0x258f3a){_0x19389d=_0x19389d-0x0;var _0xd16b67=_0x76da[_0x19389d];return _0xd16b67;};'use strict';var client=require(_0xa76d('0x0'));exports[_0xa76d('0x1')]=function(_0xf8f9a3){return function(_0x4dab4c){return client[_0xa76d('0x2')](_0xa76d('0x3'),{'options':{'raw':!![],'attributes':['id',_0xa76d('0x4'),'html']},'log':_0xa76d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 3b9d947..2212038 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(_0x35933a,_0x3d4b25){var _0x45264b=function(_0x5ef155){while(--_0x5ef155){_0x35933a['push'](_0x35933a['shift']());}};_0x45264b(++_0x3d4b25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0xc55e80,_0xb3b184){var _0x533ad6=function(_0x4a4be5){while(--_0x4a4be5){_0xc55e80['push'](_0xc55e80['shift']());}};_0x533ad6(++_0xb3b184);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 18bad8a..fb43799 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 _0xf14c=['GetTrunk','../client','getTrunks','Request','name','registry'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf14c,0xa9));var _0xcf14=function(_0x2d418c,_0xff28db){_0x2d418c=_0x2d418c-0x0;var _0x4c5a45=_0xf14c[_0x2d418c];return _0x4c5a45;};'use strict';var client=require(_0xcf14('0x0'));exports[_0xcf14('0x1')]=function(_0x4f21b4){return function(_0x1ffbe8){return client[_0xcf14('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xcf14('0x3'),_0xcf14('0x4')]},'log':_0xcf14('0x5')});};}; \ No newline at end of file +var _0x7f39=['GetTrunk','name','registry','../client','getTrunks','Request'];(function(_0x4585f7,_0x5427f3){var _0x2f983b=function(_0x33e9be){while(--_0x33e9be){_0x4585f7['push'](_0x4585f7['shift']());}};_0x2f983b(++_0x5427f3);}(_0x7f39,0x69));var _0x97f3=function(_0x26260c,_0x3a9df0){_0x26260c=_0x26260c-0x0;var _0x21f487=_0x7f39[_0x26260c];return _0x21f487;};'use strict';var client=require(_0x97f3('0x0'));exports[_0x97f3('0x1')]=function(_0x2026cb){return function(_0xa9f3e0){return client[_0x97f3('0x2')](_0x97f3('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x97f3('0x4'),_0x97f3('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 94730e2..8242c94 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 _0x76bb=['agent','email','online','lastPauseAt','voicePause','interface','Request','name','PauseUser','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','accountcode','fullname','lastLoginAt','pauseType','getAgents','GetUser'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0x76bb,0x1de));var _0xb76b=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0x76bb[_0x4aa4e6];return _0x322588;};'use strict';var client=require('../client');exports[_0xb76b('0x0')]=function(){return function(){return client['Request'](_0xb76b('0x1'),{'options':{'raw':![],'where':{'role':_0xb76b('0x2')},'attributes':['id','name',_0xb76b('0x3'),'accountcode','fullname',_0xb76b('0x4'),'lastLoginAt','pauseType',_0xb76b('0x5'),_0xb76b('0x6'),'phone','mobile',_0xb76b('0x7')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0xb76b('0x8')](_0xb76b('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xb76b('0x9'),'accountcode','internal']},'log':'getTelephones'});};};exports['savePause']=function(_0x12bf54,_0x78ba73,_0x580fd4){return client[_0xb76b('0x8')](_0xb76b('0xa'),{'body':{'type':_0x78ba73,'uniqueid':_0x580fd4},'options':{'where':{'id':_0x12bf54['id']}},'log':_0xb76b('0xb')});};exports[_0xb76b('0xc')]=function(_0x3c5d49){return client['Request'](_0xb76b('0xd'),{'body':{},'options':{'where':{'id':_0x3c5d49['id']}},'log':_0xb76b('0xb')});};exports[_0xb76b('0xe')]=function(_0x1657ab){return client[_0xb76b('0x8')](_0xb76b('0xf'),{'options':{'raw':![],'where':{'role':'agent','id':_0x1657ab},'attributes':['id','name',_0xb76b('0x3'),_0xb76b('0x10'),_0xb76b('0x11'),_0xb76b('0x4'),_0xb76b('0x12'),_0xb76b('0x13'),_0xb76b('0x5'),_0xb76b('0x6'),'interface']},'log':_0xb76b('0xe')});}; \ No newline at end of file +var _0x66cc=['name','interface','Request','GetUser','agent','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','mobile','getAgents','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0xcce8b2,_0x39cc26){var _0x1f3e87=function(_0x703caf){while(--_0x703caf){_0xcce8b2['push'](_0xcce8b2['shift']());}};_0x1f3e87(++_0x39cc26);}(_0x66cc,0x7a));var _0xc66c=function(_0x59095e,_0x4a0bb2){_0x59095e=_0x59095e-0x0;var _0x31873c=_0x66cc[_0x59095e];return _0x31873c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0xc66c('0x0')](_0xc66c('0x1'),{'options':{'raw':![],'where':{'role':_0xc66c('0x2')},'attributes':['id','name',_0xc66c('0x3'),_0xc66c('0x4'),_0xc66c('0x5'),_0xc66c('0x6'),_0xc66c('0x7'),_0xc66c('0x8'),_0xc66c('0x9'),_0xc66c('0xa'),'phone',_0xc66c('0xb'),'interface']},'log':_0xc66c('0xc')});};};exports[_0xc66c('0xd')]=function(){return function(){return client[_0xc66c('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':_0xc66c('0xe')},'attributes':['id','name',_0xc66c('0x4'),_0xc66c('0xf')]},'log':_0xc66c('0xd')});};};exports[_0xc66c('0x10')]=function(_0x543dfa,_0x111705,_0xcc2b6a){return client[_0xc66c('0x0')](_0xc66c('0x11'),{'body':{'type':_0x111705,'uniqueid':_0xcc2b6a},'options':{'where':{'id':_0x543dfa['id']}},'log':_0xc66c('0x10')});};exports[_0xc66c('0x12')]=function(_0x1e5025){return client[_0xc66c('0x0')](_0xc66c('0x13'),{'body':{},'options':{'where':{'id':_0x1e5025['id']}},'log':_0xc66c('0x10')});};exports[_0xc66c('0x14')]=function(_0x5b70ae){return client[_0xc66c('0x0')](_0xc66c('0x15'),{'options':{'raw':![],'where':{'role':_0xc66c('0x2'),'id':_0x5b70ae},'attributes':['id',_0xc66c('0x16'),_0xc66c('0x3'),_0xc66c('0x4'),_0xc66c('0x5'),_0xc66c('0x6'),_0xc66c('0x7'),'pauseType',_0xc66c('0x9'),'voicePause',_0xc66c('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index feea670..482fd29 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 _0x26e7=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create','Request'];(function(_0x4dc20f,_0xcd0e35){var _0x3cf77d=function(_0x4ef817){while(--_0x4ef817){_0x4dc20f['push'](_0x4dc20f['shift']());}};_0x3cf77d(++_0xcd0e35);}(_0x26e7,0x13e));var _0x726e=function(_0x1f909a,_0x15d56f){_0x1f909a=_0x1f909a-0x0;var _0x543f16=_0x26e7[_0x1f909a];return _0x543f16;};'use strict';var client=require('../client');exports[_0x726e('0x0')]=function(_0x47d367){return client[_0x726e('0x1')](_0x726e('0x2'),{'body':_0x47d367,'log':_0x726e('0x2')});};exports[_0x726e('0x3')]=function(_0x4475f3,_0x48ef8c,_0x308ef8){return client['Request'](_0x726e('0x4'),{'body':_0x4475f3,'options':{'where':{'uniqueid':_0x48ef8c,'interface':_0x308ef8}},'log':_0x726e('0x4')});}; \ No newline at end of file +var _0xa75b=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','Request'];(function(_0x53569d,_0xfc9982){var _0x4eb501=function(_0xbae953){while(--_0xbae953){_0x53569d['push'](_0x53569d['shift']());}};_0x4eb501(++_0xfc9982);}(_0xa75b,0x1e1));var _0xba75=function(_0x1cc325,_0x3b3dc7){_0x1cc325=_0x1cc325-0x0;var _0x4c944e=_0xa75b[_0x1cc325];return _0x4c944e;};'use strict';var client=require(_0xba75('0x0'));exports[_0xba75('0x1')]=function(_0x41f3f1){return client['Request'](_0xba75('0x2'),{'body':_0x41f3f1,'log':_0xba75('0x2')});};exports['update']=function(_0x5aa040,_0x56d806,_0x1fbfee){return client[_0xba75('0x3')](_0xba75('0x4'),{'body':_0x5aa040,'options':{'where':{'uniqueid':_0x56d806,'interface':_0x1fbfee}},'log':_0xba75('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 8c5c66e..9edf781 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 _0x1970=['calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0x73a236,_0x1a0f55){var _0x4da60c=function(_0x926437){while(--_0x926437){_0x73a236['push'](_0x73a236['shift']());}};_0x4da60c(++_0x1a0f55);}(_0x1970,0xf6));var _0x0197=function(_0x32100c,_0x30b2d5){_0x32100c=_0x32100c-0x0;var _0x2730ea=_0x1970[_0x32100c];return _0x2730ea;};'use strict';var moment=require(_0x0197('0x0'));var util=require('util');var _=require('lodash');var client=require(_0x0197('0x1'));exports[_0x0197('0x2')]=function(_0x542ce4){return client[_0x0197('0x3')](_0x0197('0x4'),{'body':_[_0x0197('0x5')](_0x542ce4,{'source':_0x542ce4[_0x0197('0x6')],'destinationcontext':_0x542ce4[_0x0197('0x7')],'callerid':_0x542ce4[_0x0197('0x8')],'amaflags':_0x0197('0x9')}),'log':_0x0197('0x4')});};exports[_0x0197('0xa')]=function(){return function(){return client['Request'](_0x0197('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x0197('0xc')](_0x0197('0xd'))[_0x0197('0xe')](_0x0197('0xf')),moment()[_0x0197('0x10')](_0x0197('0xd'))['format'](_0x0197('0xf'))]}},'attributes':['type',_0x0197('0x11'),_0x0197('0x12'),_0x0197('0x13')]},'log':_0x0197('0x14')});};}; \ No newline at end of file +var _0x4a8f=['billableseconds','GetVoiceCallReports','util','lodash','../client','Request','CreateVoiceCallReport','merge','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration'];(function(_0x3943c5,_0x17d33b){var _0x315152=function(_0xa52aad){while(--_0xa52aad){_0x3943c5['push'](_0x3943c5['shift']());}};_0x315152(++_0x17d33b);}(_0x4a8f,0x113));var _0xf4a8=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0x4a8f[_0x3b5049];return _0x12454e;};'use strict';var moment=require('moment');var util=require(_0xf4a8('0x0'));var _=require(_0xf4a8('0x1'));var client=require(_0xf4a8('0x2'));exports['create']=function(_0x1fc9f8){return client[_0xf4a8('0x3')](_0xf4a8('0x4'),{'body':_[_0xf4a8('0x5')](_0x1fc9f8,{'source':_0x1fc9f8['calleridnum'],'destinationcontext':_0x1fc9f8[_0xf4a8('0x6')],'callerid':_0x1fc9f8['callerid'],'amaflags':_0xf4a8('0x7')}),'log':_0xf4a8('0x4')});};exports[_0xf4a8('0x8')]=function(){return function(){return client['Request'](_0xf4a8('0x9'),{'options':{'where':{'type':[_0xf4a8('0xa')],'createdAt':{'$between':[moment()[_0xf4a8('0xb')](_0xf4a8('0xc'))[_0xf4a8('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf4a8('0xe')]('day')['format'](_0xf4a8('0xf'))]}},'attributes':[_0xf4a8('0x10'),_0xf4a8('0x11'),_0xf4a8('0x12'),_0xf4a8('0x13')]},'log':_0xf4a8('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 81e95a9..4145419 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 _0x5ef8=['../client','create','Request','CreateVoiceDialReport'];(function(_0x58675f,_0x390355){var _0x1cc7f0=function(_0x31d6d6){while(--_0x31d6d6){_0x58675f['push'](_0x58675f['shift']());}};_0x1cc7f0(++_0x390355);}(_0x5ef8,0x15c));var _0x85ef=function(_0x302069,_0x54ce82){_0x302069=_0x302069-0x0;var _0x506dd5=_0x5ef8[_0x302069];return _0x506dd5;};'use strict';var client=require(_0x85ef('0x0'));exports[_0x85ef('0x1')]=function(_0x28d85e){return client[_0x85ef('0x2')](_0x85ef('0x3'),{'body':_0x28d85e,'log':_0x85ef('0x3')});}; \ No newline at end of file +var _0x1c87=['Request','CreateVoiceDialReport','create'];(function(_0x1358b3,_0x526a3e){var _0x21ca72=function(_0x2be7ce){while(--_0x2be7ce){_0x1358b3['push'](_0x1358b3['shift']());}};_0x21ca72(++_0x526a3e);}(_0x1c87,0x1a0));var _0x71c8=function(_0x1a387c,_0x3a66cc){_0x1a387c=_0x1a387c-0x0;var _0x2b8089=_0x1c87[_0x1a387c];return _0x2b8089;};'use strict';var client=require('../client');exports[_0x71c8('0x0')]=function(_0x29e65e){return client[_0x71c8('0x1')](_0x71c8('0x2'),{'body':_0x29e65e,'log':_0x71c8('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 35cbc6e..f201627 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 _0x611b=['GetVoiceExtension','recordingFormat','getVoiceExtensions','Request'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x611b,0xca));var _0xb611=function(_0x4c691c,_0x333803){_0x4c691c=_0x4c691c-0x0;var _0x18620d=_0x611b[_0x4c691c];return _0x18620d;};'use strict';var client=require('../client');exports[_0xb611('0x0')]=function(){return function(){return client[_0xb611('0x1')](_0xb611('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xb611('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xb611('0x0')});};}; \ No newline at end of file +var _0x36f3=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x36f3,0x1e3));var _0x336f=function(_0x500d15,_0x5d0dde){_0x500d15=_0x500d15-0x0;var _0x45a955=_0x36f3[_0x500d15];return _0x45a955;};'use strict';var client=require(_0x336f('0x0'));exports[_0x336f('0x1')]=function(){return function(){return client[_0x336f('0x2')](_0x336f('0x3'),{'options':{'raw':!![],'attributes':['id',_0x336f('0x4'),_0x336f('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x336f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index eec0942..d99a63d 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 _0x9d5b=['dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue'];(function(_0x20567b,_0x4840e2){var _0x42cda8=function(_0x2d82d8){while(--_0x2d82d8){_0x20567b['push'](_0x20567b['shift']());}};_0x42cda8(++_0x4840e2);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x3677ea,_0x405c47){_0x3677ea=_0x3677ea-0x0;var _0x4a69b2=_0x9d5b[_0x3677ea];return _0x4a69b2;};'use strict';var client=require('../client');exports[_0xb9d5('0x0')]=function(){return function(){return client[_0xb9d5('0x1')](_0xb9d5('0x2'),{'options':{'raw':![],'attributes':['id',_0xb9d5('0x3'),_0xb9d5('0x4'),'acwTimeout',_0xb9d5('0x5'),'monitor_format',_0xb9d5('0x6'),_0xb9d5('0x7'),_0xb9d5('0x8'),_0xb9d5('0x9'),_0xb9d5('0xa'),'dialPowerLevel',_0xb9d5('0xb'),_0xb9d5('0xc'),'dialPredictiveInterval',_0xb9d5('0xd'),_0xb9d5('0xe'),_0xb9d5('0xf'),_0xb9d5('0x10'),'dialQueueTimeout',_0xb9d5('0x11'),_0xb9d5('0x12'),'dialCongestionRetryFrequency',_0xb9d5('0x13'),_0xb9d5('0x14'),_0xb9d5('0x15'),_0xb9d5('0x16'),_0xb9d5('0x17'),_0xb9d5('0x18'),_0xb9d5('0x19'),_0xb9d5('0x1a'),_0xb9d5('0x1b'),_0xb9d5('0x1c'),_0xb9d5('0x1d'),'dialAMDGreeting',_0xb9d5('0x1e'),_0xb9d5('0x1f'),'dialAMDMinWordLength',_0xb9d5('0x20'),_0xb9d5('0x21'),_0xb9d5('0x22'),'dialAMDMaximumWordLength',_0xb9d5('0x23'),_0xb9d5('0x24'),_0xb9d5('0x25'),_0xb9d5('0x26'),_0xb9d5('0x27'),_0xb9d5('0x28'),_0xb9d5('0x29'),_0xb9d5('0x2a'),_0xb9d5('0x2b'),_0xb9d5('0x2c'),_0xb9d5('0x2d')],'include':[{'model':_0xb9d5('0x2e'),'as':_0xb9d5('0x2e'),'attributes':['id',_0xb9d5('0x3'),'callerid',_0xb9d5('0x2f')]},{'model':_0xb9d5('0x2e'),'as':_0xb9d5('0x30'),'attributes':['id',_0xb9d5('0x3'),_0xb9d5('0x31'),_0xb9d5('0x2f')]},{'model':'Interval','as':_0xb9d5('0x32'),'attributes':['id','name'],'include':[{'model':_0xb9d5('0x32'),'as':_0xb9d5('0x33'),'attributes':['id',_0xb9d5('0x3'),_0xb9d5('0x34')]}]}]},'log':_0xb9d5('0x0')});};}; \ No newline at end of file +var _0x0c19=['../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','callerid','Interval','interval'];(function(_0x599e0a,_0x3162d9){var _0x3ac3e0=function(_0x4aad77){while(--_0x4aad77){_0x599e0a['push'](_0x599e0a['shift']());}};_0x3ac3e0(++_0x3162d9);}(_0x0c19,0xf5));var _0x90c1=function(_0x2384c3,_0x52619a){_0x2384c3=_0x2384c3-0x0;var _0x400fc9=_0x0c19[_0x2384c3];return _0x400fc9;};'use strict';var client=require(_0x90c1('0x0'));exports[_0x90c1('0x1')]=function(){return function(){return client[_0x90c1('0x2')](_0x90c1('0x3'),{'options':{'raw':![],'attributes':['id',_0x90c1('0x4'),_0x90c1('0x5'),'acwTimeout',_0x90c1('0x6'),_0x90c1('0x7'),_0x90c1('0x8'),'dialActive',_0x90c1('0x9'),_0x90c1('0xa'),'dialLimitQueue',_0x90c1('0xb'),_0x90c1('0xc'),_0x90c1('0xd'),_0x90c1('0xe'),_0x90c1('0xf'),_0x90c1('0x10'),_0x90c1('0x11'),'dialQueueOptions',_0x90c1('0x12'),_0x90c1('0x13'),'dialCongestionMaxRetry',_0x90c1('0x14'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x90c1('0x15'),'dialNoAnswerRetryFrequency',_0x90c1('0x16'),_0x90c1('0x17'),_0x90c1('0x18'),_0x90c1('0x19'),'dialCheckDuplicateType','dialAMDActive',_0x90c1('0x1a'),_0x90c1('0x1b'),_0x90c1('0x1c'),_0x90c1('0x1d'),'dialAMDMinWordLength',_0x90c1('0x1e'),_0x90c1('0x1f'),_0x90c1('0x20'),_0x90c1('0x21'),_0x90c1('0x22'),_0x90c1('0x23'),'dialRecallInQueue',_0x90c1('0x24'),_0x90c1('0x25'),_0x90c1('0x26'),_0x90c1('0x27'),_0x90c1('0x7'),_0x90c1('0x28'),_0x90c1('0x29'),_0x90c1('0x2a')],'include':[{'model':_0x90c1('0x2b'),'as':_0x90c1('0x2b'),'attributes':['id',_0x90c1('0x4'),'callerid',_0x90c1('0x2c')]},{'model':_0x90c1('0x2b'),'as':_0x90c1('0x2d'),'attributes':['id',_0x90c1('0x4'),_0x90c1('0x2e'),_0x90c1('0x2c')]},{'model':'Interval','as':_0x90c1('0x2f'),'attributes':['id','name'],'include':[{'model':_0x90c1('0x2f'),'as':'Intervals','attributes':['id','name',_0x90c1('0x30')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 3035217..fdb69a0 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 _0xa091=['CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','Request'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xa091,0xb1));var _0x1a09=function(_0x403d03,_0x58e441){_0x403d03=_0x403d03-0x0;var _0xc1c1ad=_0xa091[_0x403d03];return _0xc1c1ad;};'use strict';var moment=require(_0x1a09('0x0'));var _=require(_0x1a09('0x1'));var client=require('../client');exports['create']=function(_0x1309c3){return client[_0x1a09('0x2')](_0x1a09('0x3'),{'body':_0x1309c3,'log':_0x1a09('0x3')});};exports[_0x1a09('0x4')]=function(){return function(){return client[_0x1a09('0x2')](_0x1a09('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x1a09('0x6')](_0x1a09('0x7'))[_0x1a09('0x8')](_0x1a09('0x9')),moment()['endOf'](_0x1a09('0x7'))[_0x1a09('0x8')](_0x1a09('0x9'))]}},'attributes':[_0x1a09('0xa'),'queue',_0x1a09('0xb'),_0x1a09('0xc'),_0x1a09('0xd'),_0x1a09('0xe'),'queuecallerexit',_0x1a09('0xf'),'queuecallerabandon',_0x1a09('0x10')]},'log':_0x1a09('0x11')});};}; \ No newline at end of file +var _0x9a0a=['GetVoiceQueueReport','startOf','day','format','uniqueid','queue','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','create','Request','CreateVoiceQueueReport','getVoiceQueueReports'];(function(_0x31ff78,_0x423e2c){var _0x484272=function(_0x33783a){while(--_0x33783a){_0x31ff78['push'](_0x31ff78['shift']());}};_0x484272(++_0x423e2c);}(_0x9a0a,0x18c));var _0xa9a0=function(_0x74a6bb,_0x26f453){_0x74a6bb=_0x74a6bb-0x0;var _0x13cebb=_0x9a0a[_0x74a6bb];return _0x13cebb;};'use strict';var moment=require('moment');var _=require('lodash');var client=require('../client');exports[_0xa9a0('0x0')]=function(_0x3ce194){return client[_0xa9a0('0x1')](_0xa9a0('0x2'),{'body':_0x3ce194,'log':_0xa9a0('0x2')});};exports[_0xa9a0('0x3')]=function(){return function(){return client[_0xa9a0('0x1')](_0xa9a0('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xa9a0('0x5')](_0xa9a0('0x6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xa9a0('0x6'))[_0xa9a0('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xa9a0('0x8'),_0xa9a0('0x9'),'queuecallerjoinAt',_0xa9a0('0xa'),_0xa9a0('0xb'),_0xa9a0('0xc'),_0xa9a0('0xd'),_0xa9a0('0xe'),_0xa9a0('0xf'),'queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 9421cb3..1ab95ec 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 _0xd8d5=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x11632b,_0xce6dfc){var _0x355438=function(_0x428b8c){while(--_0x428b8c){_0x11632b['push'](_0x11632b['shift']());}};_0x355438(++_0xce6dfc);}(_0xd8d5,0x6f));var _0x5d8d=function(_0x3a861d,_0x526dd3){_0x3a861d=_0x3a861d-0x0;var _0xa2f951=_0xd8d5[_0x3a861d];return _0xa2f951;};'use strict';var client=require(_0x5d8d('0x0'));exports[_0x5d8d('0x1')]=function(_0x10b750){return function(){return client[_0x5d8d('0x2')](_0x5d8d('0x3'),{'options':{'where':{'VoiceQueueId':_0x10b750,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x57ab=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x434aea,_0x401301){var _0x359dae=function(_0x1bf481){while(--_0x1bf481){_0x434aea['push'](_0x434aea['shift']());}};_0x359dae(++_0x401301);}(_0x57ab,0x189));var _0xb57a=function(_0x3c76fc,_0x39e116){_0x3c76fc=_0x3c76fc-0x0;var _0x4755f5=_0x57ab[_0x3c76fc];return _0x4755f5;};'use strict';var client=require('../client');exports[_0xb57a('0x0')]=function(_0x488f59){return function(){return client[_0xb57a('0x1')](_0xb57a('0x2'),{'options':{'where':{'VoiceQueueId':_0x488f59,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 086085c..ee00a2d 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 _0xbdaa=['monitorFilename','lodash','create','Request','merge'];(function(_0x6a21a8,_0x14efb6){var _0x34dcd6=function(_0xa598a){while(--_0xa598a){_0x6a21a8['push'](_0x6a21a8['shift']());}};_0x34dcd6(++_0x14efb6);}(_0xbdaa,0x10f));var _0xabda=function(_0x9840ad,_0xb0c183){_0x9840ad=_0x9840ad-0x0;var _0x19ba73=_0xbdaa[_0x9840ad];return _0x19ba73;};'use strict';var _=require(_0xabda('0x0'));var client=require('../client');exports[_0xabda('0x1')]=function(_0x1e7ffa){return client[_0xabda('0x2')]('CreateVoiceRecording',{'body':_[_0xabda('0x3')](_0x1e7ffa,{'value':_0x1e7ffa[_0xabda('0x4')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0x3c7f=['merge','lodash','../client','create','CreateVoiceRecording'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x3c7f,0x1c3));var _0xf3c7=function(_0x39c0dc,_0x13e770){_0x39c0dc=_0x39c0dc-0x0;var _0x52addd=_0x3c7f[_0x39c0dc];return _0x52addd;};'use strict';var _=require(_0xf3c7('0x0'));var client=require(_0xf3c7('0x1'));exports[_0xf3c7('0x2')]=function(_0x4c9b86){return client['Request'](_0xf3c7('0x3'),{'body':_[_0xf3c7('0x4')](_0x4c9b86,{'value':_0x4c9b86['monitorFilename']}),'log':_0xf3c7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index abe8579..df71ddb 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 _0x4061=['transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','CreateVoiceTransferReport','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transferercontext'];(function(_0x3966b6,_0x459403){var _0x41cdf3=function(_0x2731c2){while(--_0x2731c2){_0x3966b6['push'](_0x3966b6['shift']());}};_0x41cdf3(++_0x459403);}(_0x4061,0x186));var _0x1406=function(_0x1f2488,_0x2ff33b){_0x1f2488=_0x1f2488-0x0;var _0x2434ac=_0x4061[_0x1f2488];return _0x2434ac;};'use strict';var client=require('../client');exports['blindTransfer']=function(_0x3d262e){return client[_0x1406('0x0')]('CreateVoiceTransferReport',{'body':{'result':_0x3d262e[_0x1406('0x1')],'transfererchannel':_0x3d262e[_0x1406('0x2')],'transferercalleridnum':_0x3d262e[_0x1406('0x3')],'transferercalleridname':_0x3d262e[_0x1406('0x4')],'transfererconnectedlinenum':_0x3d262e['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3d262e['transfererconnectedlinename'],'transfereraccountcode':_0x3d262e['transfereraccountcode'],'transferercontext':_0x3d262e[_0x1406('0x5')],'transfererexten':_0x3d262e[_0x1406('0x6')],'transfererlinkedid':_0x3d262e[_0x1406('0x7')],'transfereechannel':_0x3d262e[_0x1406('0x8')],'transfereecalleridnum':_0x3d262e[_0x1406('0x9')],'transfereecalleridname':_0x3d262e[_0x1406('0xa')],'transfereeconnectedlinenum':_0x3d262e['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x3d262e[_0x1406('0xb')],'transfereeaccountcode':_0x3d262e[_0x1406('0xc')],'transfereecontext':_0x3d262e[_0x1406('0xd')],'transfereeexten':_0x3d262e[_0x1406('0xe')],'transfereelinkedid':_0x3d262e[_0x1406('0xf')],'isexternal':_0x3d262e[_0x1406('0x10')],'context':_0x3d262e[_0x1406('0x11')],'extension':_0x3d262e[_0x1406('0x12')],'type':_0x1406('0x13')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x41c00a){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x41c00a[_0x1406('0x1')],'transfererchannel':_0x41c00a['origtransfererchannel'],'transferercalleridnum':_0x41c00a['origtransferercalleridnum'],'transferercalleridname':_0x41c00a[_0x1406('0x14')],'transfererconnectedlinenum':_0x41c00a[_0x1406('0x15')],'transfererconnectedlinename':_0x41c00a[_0x1406('0x16')],'transfereraccountcode':_0x41c00a[_0x1406('0x17')],'transferercontext':_0x41c00a[_0x1406('0x18')],'transfererexten':_0x41c00a[_0x1406('0x19')],'transfererlinkedid':_0x41c00a['origtransfererlinkedid'],'transfereechannel':_0x41c00a[_0x1406('0x1a')],'transfereecalleridnum':_0x41c00a[_0x1406('0x1b')],'transfereecalleridname':_0x41c00a['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x41c00a[_0x1406('0x1c')],'transfereeconnectedlinename':_0x41c00a['transfertargetconnectedlinename'],'transfereeaccountcode':_0x41c00a[_0x1406('0x1d')],'transfereecontext':_0x41c00a[_0x1406('0x1e')],'transfereeexten':_0x41c00a[_0x1406('0x1f')],'transfereelinkedid':_0x41c00a[_0x1406('0x20')],'isexternal':_0x41c00a[_0x1406('0x10')],'context':_0x41c00a['origtransferercontext'],'extension':_0x41c00a[_0x1406('0x21')],'type':_0x1406('0x22')},'log':_0x1406('0x23')});}; \ No newline at end of file +var _0x30df=['isexternal','context','extension','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid'];(function(_0x253e1f,_0xd247f0){var _0x1adb58=function(_0x523236){while(--_0x523236){_0x253e1f['push'](_0x253e1f['shift']());}};_0x1adb58(++_0xd247f0);}(_0x30df,0x137));var _0xf30d=function(_0x4a1440,_0x4bcfc0){_0x4a1440=_0x4a1440-0x0;var _0x2179d8=_0x30df[_0x4a1440];return _0x2179d8;};'use strict';var client=require(_0xf30d('0x0'));exports['blindTransfer']=function(_0xe85569){return client[_0xf30d('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0xe85569[_0xf30d('0x2')],'transfererchannel':_0xe85569[_0xf30d('0x3')],'transferercalleridnum':_0xe85569[_0xf30d('0x4')],'transferercalleridname':_0xe85569[_0xf30d('0x5')],'transfererconnectedlinenum':_0xe85569[_0xf30d('0x6')],'transfererconnectedlinename':_0xe85569[_0xf30d('0x7')],'transfereraccountcode':_0xe85569[_0xf30d('0x8')],'transferercontext':_0xe85569[_0xf30d('0x9')],'transfererexten':_0xe85569[_0xf30d('0xa')],'transfererlinkedid':_0xe85569[_0xf30d('0xb')],'transfereechannel':_0xe85569[_0xf30d('0xc')],'transfereecalleridnum':_0xe85569['transfereecalleridnum'],'transfereecalleridname':_0xe85569['transfereecalleridname'],'transfereeconnectedlinenum':_0xe85569['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0xe85569[_0xf30d('0xd')],'transfereeaccountcode':_0xe85569[_0xf30d('0xe')],'transfereecontext':_0xe85569['transfereecontext'],'transfereeexten':_0xe85569[_0xf30d('0xf')],'transfereelinkedid':_0xe85569[_0xf30d('0x10')],'isexternal':_0xe85569[_0xf30d('0x11')],'context':_0xe85569[_0xf30d('0x12')],'extension':_0xe85569[_0xf30d('0x13')],'type':'blind'},'log':_0xf30d('0x14')});};exports[_0xf30d('0x15')]=function(_0x3c35ac){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x3c35ac['result'],'transfererchannel':_0x3c35ac[_0xf30d('0x16')],'transferercalleridnum':_0x3c35ac[_0xf30d('0x17')],'transferercalleridname':_0x3c35ac['origtransferercalleridname'],'transfererconnectedlinenum':_0x3c35ac[_0xf30d('0x18')],'transfererconnectedlinename':_0x3c35ac[_0xf30d('0x19')],'transfereraccountcode':_0x3c35ac[_0xf30d('0x1a')],'transferercontext':_0x3c35ac[_0xf30d('0x1b')],'transfererexten':_0x3c35ac[_0xf30d('0x1c')],'transfererlinkedid':_0x3c35ac[_0xf30d('0x1d')],'transfereechannel':_0x3c35ac[_0xf30d('0x1e')],'transfereecalleridnum':_0x3c35ac[_0xf30d('0x1f')],'transfereecalleridname':_0x3c35ac[_0xf30d('0x20')],'transfereeconnectedlinenum':_0x3c35ac[_0xf30d('0x21')],'transfereeconnectedlinename':_0x3c35ac[_0xf30d('0x22')],'transfereeaccountcode':_0x3c35ac[_0xf30d('0x23')],'transfereecontext':_0x3c35ac[_0xf30d('0x24')],'transfereeexten':_0x3c35ac[_0xf30d('0x25')],'transfereelinkedid':_0x3c35ac['transfertargetlinkedid'],'isexternal':_0x3c35ac['isexternal'],'context':_0x3c35ac[_0xf30d('0x26')],'extension':_0x3c35ac[_0xf30d('0x27')],'type':_0xf30d('0x28')},'log':_0xf30d('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b2e1991..6625bd3 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 _0xae95=['status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','context','telephones','values','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','moment','../properties','listen','format','%s/%s','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','pick','keys','module','Reload','then','message','catch','error','username','command','action','Command','Action','content','voiceQueues','hasOwnProperty','available','pTalking','sumDuration','talking','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','name','Interval','push','length','channels','voicechannel','find','uniqueid','channel','%s.%s','filename','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','mixmonitorid','rec'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0xae95,0x99));var _0x5ae9=function(_0x111300,_0x494c29){_0x111300=_0x111300-0x0;var _0x5a6f3f=_0xae95[_0x111300];return _0x5a6f3f;};'use strict';var _=require(_0x5ae9('0x0'));var util=require(_0x5ae9('0x1'));var jayson=require(_0x5ae9('0x2'));var schema=require(_0x5ae9('0x3'));var BPromise=require('bluebird');var moment=require(_0x5ae9('0x4'));var config=require('../../../config/environment');var properties=require(_0x5ae9('0x5'));var ami=require('../ami');exports[_0x5ae9('0x6')]=function(_0x2e0042,_0x4bcb45,_0x4efc99){return new BPromise(function(_0x72c9b9,_0x173184){var _0x3e5642={'QueuePause':function(_0x5c2cd1){return new Promise(function(_0x507b58,_0x4da50d){var _0x36858d=util[_0x5ae9('0x7')](_0x5ae9('0x8'),'SIP',_0x5c2cd1['name']);if(_0x2e0042[_0x5ae9('0x9')]&&_0x2e0042[_0x5ae9('0x9')][_0x36858d]&&_0x2e0042[_0x5ae9('0x9')][_0x36858d][_0x5ae9('0xa')]){_0x2e0042[_0x5ae9('0x9')][_0x36858d][_0x5ae9('0xb')]();}if(_0x2e0042[_0x5ae9('0xc')][_0x36858d]){_0x2e0042['agents'][_0x36858d]['updateStatusRealtime']({'statePause':_0x5c2cd1[_0x5ae9('0xd')]?!![]:![]});}_0x507b58({'code':0xc8,'message':_0x5ae9('0xe')});});},'Reload':function(_0x26550f){var _0x277f20=this;return new Promise(function(_0x235e1b,_0x3941a6){if(ami[_0x5ae9('0xf')]()==![]){return _0x3941a6(_0x277f20['error'](0x1f4,[config[_0x5ae9('0x10')]['ip'],config[_0x5ae9('0x10')]['username'],_0x5ae9('0x11')][_0x5ae9('0x12')]('\x20')));}_0x26550f=_[_0x5ae9('0x13')](_0x26550f,_[_0x5ae9('0x14')](properties[_0x5ae9('0x15')]));_0x26550f['action']=_0x5ae9('0x16');return ami['Action'](_0x26550f)[_0x5ae9('0x17')](function(_0x258a01){_0x235e1b({'code':0xc8,'message':_0x258a01[_0x5ae9('0x18')]});})[_0x5ae9('0x19')](function(_0x2b541e){_0x3941a6(_0x277f20[_0x5ae9('0x1a')](0x1f5,_0x2b541e[_0x5ae9('0x18')]));});});},'Command':function(_0x1ddcbc){var _0x4add7f=this;return new Promise(function(_0x49236a,_0xa070fd){if(ami[_0x5ae9('0xf')]()==![]){return _0xa070fd(_0x4add7f[_0x5ae9('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0x5ae9('0x10')][_0x5ae9('0x1b')],_0x5ae9('0x11')][_0x5ae9('0x12')]('\x20')));}_0x1ddcbc=_['pick'](_0x1ddcbc,_0x5ae9('0x1c'));_0x1ddcbc[_0x5ae9('0x1d')]=_0x5ae9('0x1e');return ami[_0x5ae9('0x1f')](_0x1ddcbc)[_0x5ae9('0x17')](function(_0xe0c223){_0x49236a({'code':0xc8,'message':_0xe0c223[_0x5ae9('0x20')]});})[_0x5ae9('0x19')](function(_0x7740f6){_0xa070fd(_0x4add7f[_0x5ae9('0x1a')](0x1f5,_0x7740f6[_0x5ae9('0x18')]));});});},'VoiceQueues':function(_0x434a16){return new Promise(function(_0x119f0f,_0x22c094){var _0x805347=[];for(var _0x5e89f4 in _0x2e0042['voiceQueues']){if(_0x2e0042[_0x5ae9('0x21')][_0x5ae9('0x22')](_0x5e89f4)){var _0x3e343f=_0x2e0042['voiceQueues'][_0x5e89f4];var _0xdfd74={'id':_0x3e343f['id'],'name':_0x3e343f['name'],'strategy':_0x3e343f['strategy'],'answered':_0x3e343f['answered'],'available':_0x3e343f[_0x5ae9('0x23')],'loggedIn':_0x3e343f['loggedIn'],'pTalking':_0x3e343f[_0x5ae9('0x24')],'sumBillable':_0x3e343f['sumBillable'],'sumDuration':_0x3e343f[_0x5ae9('0x25')],'sumHoldTime':_0x3e343f['sumHoldTime']||0x0,'talking':_0x3e343f[_0x5ae9('0x26')],'total':_0x3e343f[_0x5ae9('0x27')],'type':_0x3e343f[_0x5ae9('0x28')],'unmanaged':_0x3e343f[_0x5ae9('0x29')],'abandoned':_0x3e343f['abandoned'],'waiting':_0x3e343f[_0x5ae9('0x2a')],'loggedInDb':_0x3e343f[_0x5ae9('0x2b')]};if(_0x3e343f['type']===_0x5ae9('0x2c')){_0xdfd74[_0x5ae9('0x2d')]=_0x3e343f[_0x5ae9('0x2d')];_0xdfd74[_0x5ae9('0x2e')]=_0x3e343f[_0x5ae9('0x2e')];_0xdfd74[_0x5ae9('0x2f')]=_0x3e343f[_0x5ae9('0x2f')];_0xdfd74[_0x5ae9('0x30')]=_0x3e343f[_0x5ae9('0x30')];_0xdfd74[_0x5ae9('0x31')]=_0x3e343f[_0x5ae9('0x31')];_0xdfd74['dialPrefix']=_0x3e343f['dialPrefix'];_0xdfd74[_0x5ae9('0x32')]=_0x3e343f[_0x5ae9('0x32')];_0xdfd74[_0x5ae9('0x33')]=_0x3e343f[_0x5ae9('0x33')];_0xdfd74[_0x5ae9('0x34')]=_0x3e343f[_0x5ae9('0x34')];_0xdfd74[_0x5ae9('0x35')]=_0x3e343f['outboundBusyCallsDay'];_0xdfd74[_0x5ae9('0x36')]=_0x3e343f[_0x5ae9('0x36')];_0xdfd74[_0x5ae9('0x37')]=_0x3e343f[_0x5ae9('0x37')];_0xdfd74[_0x5ae9('0x38')]=_0x3e343f[_0x5ae9('0x38')];_0xdfd74['outboundDropCallsDayTimeout']=_0x3e343f[_0x5ae9('0x39')];_0xdfd74[_0x5ae9('0x3a')]=_0x3e343f['outboundNoAnswerCallsDay'];_0xdfd74[_0x5ae9('0x3b')]=_0x3e343f['outboundNoSuchCallsDay'];_0xdfd74[_0x5ae9('0x3c')]=_0x3e343f['outboundOriginateFailureCallsDay'];_0xdfd74[_0x5ae9('0x3d')]=_0x3e343f['outboundReCallsDay'];_0xdfd74[_0x5ae9('0x3e')]=_0x3e343f[_0x5ae9('0x3e')];_0xdfd74[_0x5ae9('0x3f')]=_0x3e343f[_0x5ae9('0x3f')];_0xdfd74[_0x5ae9('0x40')]=_0x3e343f[_0x5ae9('0x40')];_0xdfd74[_0x5ae9('0x41')]=_0x3e343f[_0x5ae9('0x41')];_0xdfd74[_0x5ae9('0x42')]=_0x3e343f['predictiveIntervalAvgTalktime'];_0xdfd74[_0x5ae9('0x43')]=_0x3e343f[_0x5ae9('0x43')];_0xdfd74[_0x5ae9('0x44')]=_0x3e343f[_0x5ae9('0x44')];_0xdfd74[_0x5ae9('0x45')]=_0x3e343f[_0x5ae9('0x45')];_0xdfd74['predictiveIntervalErlangCallsDroppedCalls']=_0x3e343f[_0x5ae9('0x46')];_0xdfd74[_0x5ae9('0x47')]=_0x3e343f[_0x5ae9('0x47')];_0xdfd74[_0x5ae9('0x48')]=_0x3e343f['predictiveIntervalLowerLimit'];_0xdfd74[_0x5ae9('0x49')]=_0x3e343f[_0x5ae9('0x49')];_0xdfd74[_0x5ae9('0x4a')]=_0x3e343f[_0x5ae9('0x4a')];_0xdfd74[_0x5ae9('0x4b')]=_0x3e343f['predictiveIntervalTotalCalls'];_0xdfd74[_0x5ae9('0x18')]=_0x3e343f[_0x5ae9('0x18')];_0xdfd74[_0x5ae9('0x4c')]=_0x3e343f[_0x5ae9('0x4c')];}if(_0x3e343f['Trunk']){_0xdfd74[_0x5ae9('0x4d')]={'id':_0x3e343f[_0x5ae9('0x4d')]['id'],'name':_0x3e343f[_0x5ae9('0x4d')][_0x5ae9('0x4e')],'active':_0x3e343f[_0x5ae9('0x4d')]['active'],'callerid':_0x3e343f[_0x5ae9('0x4d')]['callerid']};}if(_0x3e343f['Interval']){_0xdfd74[_0x5ae9('0x4f')]={'id':_0x3e343f['Interval']['id'],'name':_0x3e343f['Interval'][_0x5ae9('0x4e')]};}_0x805347[_0x5ae9('0x50')](_0xdfd74);}}_0x119f0f({'count':_0x805347[_0x5ae9('0x51')],'rows':_0x805347});});},'VoiceChannels':function(_0x58ac87){return new Promise(function(_0x50c938,_0x52fa12){var _0x9745f0=_['values'](_0x2e0042[_0x5ae9('0x52')]);_0x50c938({'count':_0x9745f0['length'],'rows':_0x9745f0});});},'VoiceChannelMixMonitor':function(_0x208742){var _0x5546cf=this;return new Promise(function(_0x30e7c6,_0x502d4e){if(ami[_0x5ae9('0xf')]()==![]){return _0x502d4e(_0x5546cf[_0x5ae9('0x1a')](0x1f4,[config[_0x5ae9('0x10')]['ip'],config[_0x5ae9('0x10')][_0x5ae9('0x1b')],'ami\x20disconnected']['join']('\x20')));}var _0x43b4a2=schema(properties[_0x5ae9('0x53')])['validate'](_0x208742);if(_0x43b4a2[_0x5ae9('0x51')]>0x0){return _0x502d4e(_0x5546cf[_0x5ae9('0x1a')](0x1f4,_['map'](_0x43b4a2,'message')[_0x5ae9('0x12')](',\x20')));}var _0x4ae783=_[_0x5ae9('0x54')](_0x2e0042[_0x5ae9('0x52')],{'uniqueid':_0x208742[_0x5ae9('0x55')]});if(_0x4ae783&&_0x4ae783[_0x5ae9('0x56')]){var _0x384b68=util[_0x5ae9('0x7')](_0x5ae9('0x57'),_0x208742[_0x5ae9('0x58')]||_0x208742['uniqueid'],_0x208742[_0x5ae9('0x7')]||'wav');return ami['Action']({'action':'MixMonitor','channel':_0x4ae783[_0x5ae9('0x56')],'file':_0x384b68,'options':'ai(mixmonitorid)'})['then'](function(_0x2881f6){var _0xa4991a=_['find'](_0x4ae783['monitors'],{'filename':_0x5ae9('0x59')+_0x384b68[_0x5ae9('0x5a')]()});if(_[_0x5ae9('0x5b')](_0xa4991a)){_0x4ae783[_0x5ae9('0x5c')]['push']({'filename':_0x5ae9('0x59')+_0x384b68[_0x5ae9('0x5a')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x2881f6[_0x5ae9('0x5d')],'status':_0x5ae9('0x5e')});}else{_0xa4991a['mixmonitorid']=_0x2881f6['mixmonitorid'];_0xa4991a[_0x5ae9('0x5f')]='rec';}_0x30e7c6({'code':0xc8,'message':[_0x208742[_0x5ae9('0x55')],_0x5ae9('0x60'),_0x2881f6['mixmonitorid']][_0x5ae9('0x12')]('\x20'),'mixmonitorid':_0x2881f6[_0x5ae9('0x5d')]});})[_0x5ae9('0x19')](function(_0x4af023){_0x502d4e(_0x5546cf['error'](0x1f5,[_0x208742['uniqueid'],_0x4af023[_0x5ae9('0x18')][_0x5ae9('0x5a')]()][_0x5ae9('0x12')]('\x20')));});}else{return _0x502d4e(_0x5546cf[_0x5ae9('0x1a')](0x1f5,_0x5ae9('0x61')));}});},'VoiceChannelStopMixMonitor':function(_0x269e78){var _0x564e6c=this;return new Promise(function(_0x483cdf,_0x14e2c7){if(ami['isConnected']()==![]){return _0x14e2c7(_0x564e6c[_0x5ae9('0x1a')](0x1f4,[config[_0x5ae9('0x10')]['ip'],config[_0x5ae9('0x10')][_0x5ae9('0x1b')],'ami\x20disconnected'][_0x5ae9('0x12')]('\x20')));}var _0x1b14e1=schema(properties[_0x5ae9('0x53')])[_0x5ae9('0x3')](_0x269e78);if(_0x1b14e1['length']>0x0){return _0x14e2c7(_0x564e6c[_0x5ae9('0x1a')](0x1f4,_[_0x5ae9('0x62')](_0x1b14e1,_0x5ae9('0x18'))[_0x5ae9('0x12')](',\x20')));}var _0x4ba3ef=_[_0x5ae9('0x54')](_0x2e0042[_0x5ae9('0x52')],{'uniqueid':_0x269e78[_0x5ae9('0x55')]});if(_0x4ba3ef){return BPromise[_0x5ae9('0x63')]()[_0x5ae9('0x17')](function(){if(_0x4ba3ef[_0x5ae9('0x56')]){return ami[_0x5ae9('0x1f')]({'action':_0x5ae9('0x64'),'channel':_0x4ba3ef['channel'],'mixmonitorid':_0x269e78[_0x5ae9('0x5d')]})[_0x5ae9('0x19')](function(_0x5c4e22){});}})[_0x5ae9('0x17')](function(){if(_0x4ba3ef[_0x5ae9('0x65')]){return ami[_0x5ae9('0x1f')]({'action':_0x5ae9('0x64'),'channel':_0x4ba3ef[_0x5ae9('0x65')],'mixmonitorid':_0x269e78[_0x5ae9('0x5d')]})[_0x5ae9('0x19')](function(_0x375f2a){});}})[_0x5ae9('0x17')](function(_0xba9175){var _0x1e3ff6=_[_0x5ae9('0x54')](_0x4ba3ef['monitors'],{'mixmonitorid':_0x269e78[_0x5ae9('0x5d')]});if(_0x1e3ff6){_0x1e3ff6['status']=_0x5ae9('0x66');}})['then'](function(){var _0x57f2c3=util[_0x5ae9('0x7')](_0x5ae9('0x57'),_0x269e78[_0x5ae9('0x58')]||_0x269e78[_0x5ae9('0x55')],_0x269e78['format']||'wav');var _0x2224e6=_[_0x5ae9('0x54')](_0x4ba3ef['monitors'],{'filename':_0x5ae9('0x59')+_0x57f2c3['toLowerCase']()});if(_0x2224e6){_0x2224e6['status']=_0x5ae9('0x66');}})[_0x5ae9('0x17')](function(){_0x483cdf({'code':0xc8,'message':[_0x269e78[_0x5ae9('0x55')],_0x5ae9('0x67')][_0x5ae9('0x12')]('\x20')});})['catch'](function(_0x438554){_0x14e2c7(_0x564e6c[_0x5ae9('0x1a')](0x1f5,[_0x269e78['uniqueid'],_0x438554[_0x5ae9('0x18')][_0x5ae9('0x5a')]()][_0x5ae9('0x12')]('\x20')));});}else{return _0x14e2c7(_0x564e6c[_0x5ae9('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x677ae1){return new Promise(function(_0x26a491,_0x3ac058){var _0xfb414=_['values'](_0x2e0042['queueChannels']);_0x26a491({'count':_0xfb414[_0x5ae9('0x51')],'rows':_0xfb414});});},'VoiceQueuesChannel':function(_0x2b1e3d){var _0x381b44=this;return new Promise(function(_0x1acd39,_0x494eed){var _0x40d075=schema(properties[_0x5ae9('0x68')])['validate'](_0x2b1e3d);if(_0x40d075[_0x5ae9('0x51')]>0x0){return _0x494eed(_0x381b44[_0x5ae9('0x1a')](0x1f4,_[_0x5ae9('0x62')](_0x40d075,_0x5ae9('0x18'))[_0x5ae9('0x12')](',\x20')));}var _0x4f83f0=_[_0x5ae9('0x54')](_0x2e0042[_0x5ae9('0x69')],{'uniqueid':_0x2b1e3d[_0x5ae9('0x55')]});if(_0x4f83f0){_0x1acd39(_0x4f83f0);}else{return _0x494eed(_0x381b44[_0x5ae9('0x1a')](0x1f5,_0x5ae9('0x61')));}});},'VoiceQueuesChannelHangup':function(_0x50a362){var _0x1966aa=this;return new Promise(function(_0x5a89d0,_0x1d6d23){if(ami[_0x5ae9('0xf')]()==![]){return _0x1d6d23(_0x1966aa[_0x5ae9('0x1a')](0x1f4,[config[_0x5ae9('0x10')]['ip'],config[_0x5ae9('0x10')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x2d3b0c=schema(properties[_0x5ae9('0x6a')])[_0x5ae9('0x3')](_0x50a362);if(_0x2d3b0c[_0x5ae9('0x51')]>0x0){return _0x1d6d23(_0x1966aa[_0x5ae9('0x1a')](0x1f4,_[_0x5ae9('0x62')](_0x2d3b0c,_0x5ae9('0x18'))[_0x5ae9('0x12')](',\x20')));}var _0x2fe157=_[_0x5ae9('0x54')](_0x2e0042[_0x5ae9('0x69')],{'uniqueid':_0x50a362[_0x5ae9('0x55')]});if(_0x2fe157&&_0x2fe157[_0x5ae9('0x56')]){return ami['Action']({'action':'Hangup','channel':_0x2fe157[_0x5ae9('0x56')]})[_0x5ae9('0x17')](function(_0x41d762){_0x5a89d0({'code':0xc8,'message':[_0x50a362[_0x5ae9('0x55')],_0x41d762[_0x5ae9('0x18')][_0x5ae9('0x5a')]()]['join']('\x20')});})[_0x5ae9('0x19')](function(_0x169b81){_0x1d6d23(_0x1966aa[_0x5ae9('0x1a')](0x1f5,[_0x50a362[_0x5ae9('0x55')],_0x169b81[_0x5ae9('0x18')][_0x5ae9('0x5a')]()][_0x5ae9('0x12')]('\x20')));});}else{return _0x1d6d23(_0x1966aa[_0x5ae9('0x1a')](0x1f5,_0x5ae9('0x61')));}});},'VoiceQueuesChannelRedirect':function(_0xe266f){var _0x304158=this;return new Promise(function(_0x32e2d7,_0x18dddd){if(ami[_0x5ae9('0xf')]()==![]){return _0x18dddd(_0x304158[_0x5ae9('0x1a')](0x1f4,[config[_0x5ae9('0x10')]['ip'],config['asterisk'][_0x5ae9('0x1b')],_0x5ae9('0x11')][_0x5ae9('0x12')]('\x20')));}var _0x638e6b=schema(properties[_0x5ae9('0x6b')])['validate'](_0xe266f);if(_0x638e6b[_0x5ae9('0x51')]>0x0){return _0x18dddd(_0x304158[_0x5ae9('0x1a')](0x1f4,_[_0x5ae9('0x62')](_0x638e6b,'message')[_0x5ae9('0x12')](',\x20')));}var _0x5d2365=_[_0x5ae9('0x54')](_0x2e0042[_0x5ae9('0x69')],{'uniqueid':_0xe266f[_0x5ae9('0x55')]});if(_0x5d2365&&_0x5d2365[_0x5ae9('0x56')]){return ami[_0x5ae9('0x1f')]({'action':_0x5ae9('0x6c'),'channel':_0x5d2365[_0x5ae9('0x56')],'exten':_0xe266f['exten'],'context':_0xe266f[_0x5ae9('0x6d')]||_0x5d2365[_0x5ae9('0x6d')],'priority':0x1})[_0x5ae9('0x17')](function(_0x87e2fe){_0x32e2d7({'code':0xc8,'message':[_0xe266f['uniqueid'],_0x87e2fe[_0x5ae9('0x18')][_0x5ae9('0x5a')]()][_0x5ae9('0x12')]('\x20')});})[_0x5ae9('0x19')](function(_0x327c22){_0x18dddd(_0x304158[_0x5ae9('0x1a')](0x1f5,[_0xe266f[_0x5ae9('0x55')],_0x327c22['message'][_0x5ae9('0x5a')]()][_0x5ae9('0x12')]('\x20')));});}else{return _0x18dddd(_0x304158['error'](0x1f5,_0x5ae9('0x61')));}});},'Agents':function(_0x1ba704){return new Promise(function(_0x58f87c,_0x111679){var _0x4e86a7=_['values'](_0x2e0042[_0x5ae9('0xc')]);_0x58f87c({'count':_0x4e86a7[_0x5ae9('0x51')],'rows':_0x4e86a7});});},'Telephones':function(_0x31bce0){return new Promise(function(_0x991ec2,_0x127296){var _0x1403d8=_['values'](_0x2e0042[_0x5ae9('0x6e')]);_0x991ec2({'count':_0x1403d8['length'],'rows':_0x1403d8});});},'Trunks':function(_0x17847e){return new Promise(function(_0x300074,_0x2e609d){var _0x486d5d=_[_0x5ae9('0x6f')](_0x2e0042['trunks']);_0x300074({'count':_0x486d5d['length'],'rows':_0x486d5d});});},'OutboundChannels':function(_0x37edd9){return new Promise(function(_0x419ab3,_0x3429ed){var _0x97edb6=_['values'](_0x2e0042[_0x5ae9('0x70')]);_0x419ab3({'count':_0x97edb6[_0x5ae9('0x51')],'rows':_0x97edb6});});},'Outbound':function(_0x1037aa){return new Promise(function(_0x36375b,_0x6c58f2){_0x36375b(_0x2e0042['outbound']);});},'Campaigns':function(_0x2ac642){return new Promise(function(_0x4be9d6,_0x3cf046){var _0x2b0cf3=_['values'](_0x2e0042[_0x5ae9('0x71')]);_0x4be9d6({'count':_0x2b0cf3[_0x5ae9('0x51')],'rows':_0x2b0cf3});});},'VoiceQueuesPreview':function(_0x1d7152){var _0x148964=this;return new Promise(function(_0x34828c,_0x412fc8){_0x4bcb45['run'](_0x1d7152['id'])[_0x5ae9('0x17')](function(_0x3fd5bf){_0x34828c({'code':0xc8,'message':_0x3fd5bf[_0x5ae9('0x18')]});})['catch'](function(_0x4be186){_0x412fc8(_0x148964[_0x5ae9('0x1a')](0x1f4,_0x4be186[_0x5ae9('0x18')]));});});},'EventManager':function(_0x1271fb){var _0x41d897=this;return new Promise(function(_0x1bbf27,_0x4734bb){if(!_0x1271fb[_0x5ae9('0x72')]){return _0x4734bb(_0x41d897[_0x5ae9('0x1a')](0x1f4,_0x5ae9('0x73')));}ami[_0x5ae9('0x74')]('custom:'+_0x1271fb['event'],_0x1271fb['message']);_0x1bbf27({'code':0xc8,'message':_0x1271fb});});},'FaxAccounts':function(_0x5ea1fd){return new Promise(function(_0x43fe65,_0x7e10d3){var _0x4233a3=_['values'](_0x2e0042[_0x5ae9('0x75')]);_0x43fe65({'count':_0x4233a3[_0x5ae9('0x51')],'rows':_0x4233a3});});},'SendFax':function(_0x2bff3a){var _0x242add=this;return new Promise(function(_0x9b9a04,_0x3cb064){_0x4efc99[_0x5ae9('0x76')](_0x2bff3a)['then'](function(_0x37daec){_0x9b9a04({'code':0xc8,'message':_0x37daec[_0x5ae9('0x18')]});})[_0x5ae9('0x19')](function(_0x18097b){_0x3cb064(_0x242add[_0x5ae9('0x1a')](0x1f4,_0x18097b[_0x5ae9('0x18')]));});});},'CheckAfterSend':function(_0x42e69b){var _0xb9d310=this;return new Promise(function(_0x279119,_0x488498){_0x4efc99[_0x5ae9('0x77')](_0x42e69b)['then'](function(_0x4adb4f){_0x279119({'code':0xc8,'message':_0x4adb4f[_0x5ae9('0x18')]});})['catch'](function(_0x310719){_0x488498(_0xb9d310[_0x5ae9('0x1a')](0x1f4,_0x310719['message']));});});}};var _0x4466a5=jayson[_0x5ae9('0x78')](_0x3e5642)[_0x5ae9('0x79')]();_0x4466a5['on'](_0x5ae9('0x1a'),function(_0x2912ed){return _0x173184(_0x2912ed);});_0x4466a5[_0x5ae9('0x6')](0x232a,_0x5ae9('0x7a'),function(){console['log'](_0x5ae9('0x7b'),0x232a);return _0x72c9b9('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x7d9b=['Action','then','message','catch','error','username','pick','command','content','voiceQueues','hasOwnProperty','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','active','callerid','Interval','push','length','voicechannel','find','channels','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','outbound','run','Event\x20name\x20mandatory','event','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','../../../config/environment','../properties','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','keys','module','action'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x7d9b,0x162));var _0xb7d9=function(_0x16c314,_0x4bcd8e){_0x16c314=_0x16c314-0x0;var _0x1b0580=_0x7d9b[_0x16c314];return _0x1b0580;};'use strict';var _=require(_0xb7d9('0x0'));var util=require('util');var jayson=require(_0xb7d9('0x1'));var schema=require(_0xb7d9('0x2'));var BPromise=require(_0xb7d9('0x3'));var moment=require('moment');var config=require(_0xb7d9('0x4'));var properties=require(_0xb7d9('0x5'));var ami=require('../ami');exports['listen']=function(_0x4d6fff,_0x52e120,_0x60539e){return new BPromise(function(_0x4fb1e1,_0x591c1e){var _0x5c165a={'QueuePause':function(_0x305660){return new Promise(function(_0x3474ea,_0x473945){var _0x3b413e=util[_0xb7d9('0x6')](_0xb7d9('0x7'),_0xb7d9('0x8'),_0x305660[_0xb7d9('0x9')]);if(_0x4d6fff[_0xb7d9('0xa')]&&_0x4d6fff[_0xb7d9('0xa')][_0x3b413e]&&_0x4d6fff['timers'][_0x3b413e][_0xb7d9('0xb')]){_0x4d6fff[_0xb7d9('0xa')][_0x3b413e][_0xb7d9('0xc')]();}if(_0x4d6fff[_0xb7d9('0xd')][_0x3b413e]){_0x4d6fff['agents'][_0x3b413e][_0xb7d9('0xe')]({'statePause':_0x305660[_0xb7d9('0xf')]?!![]:![]});}_0x3474ea({'code':0xc8,'message':_0xb7d9('0x10')});});},'Reload':function(_0x279efd){var _0x12f803=this;return new Promise(function(_0x518b78,_0x4e09b1){if(ami[_0xb7d9('0x11')]()==![]){return _0x4e09b1(_0x12f803['error'](0x1f4,[config[_0xb7d9('0x12')]['ip'],config[_0xb7d9('0x12')]['username'],_0xb7d9('0x13')][_0xb7d9('0x14')]('\x20')));}_0x279efd=_['pick'](_0x279efd,_[_0xb7d9('0x15')](properties[_0xb7d9('0x16')]));_0x279efd[_0xb7d9('0x17')]='Reload';return ami[_0xb7d9('0x18')](_0x279efd)[_0xb7d9('0x19')](function(_0x59515f){_0x518b78({'code':0xc8,'message':_0x59515f[_0xb7d9('0x1a')]});})[_0xb7d9('0x1b')](function(_0x4b9ea8){_0x4e09b1(_0x12f803[_0xb7d9('0x1c')](0x1f5,_0x4b9ea8[_0xb7d9('0x1a')]));});});},'Command':function(_0x4593ad){var _0xa9c88=this;return new Promise(function(_0x1642f1,_0x28920c){if(ami[_0xb7d9('0x11')]()==![]){return _0x28920c(_0xa9c88['error'](0x1f4,[config['asterisk']['ip'],config[_0xb7d9('0x12')][_0xb7d9('0x1d')],'ami\x20disconnected'][_0xb7d9('0x14')]('\x20')));}_0x4593ad=_[_0xb7d9('0x1e')](_0x4593ad,_0xb7d9('0x1f'));_0x4593ad['action']='Command';return ami[_0xb7d9('0x18')](_0x4593ad)[_0xb7d9('0x19')](function(_0x4e9951){_0x1642f1({'code':0xc8,'message':_0x4e9951[_0xb7d9('0x20')]});})[_0xb7d9('0x1b')](function(_0x2031a2){_0x28920c(_0xa9c88[_0xb7d9('0x1c')](0x1f5,_0x2031a2['message']));});});},'VoiceQueues':function(_0x50be72){return new Promise(function(_0xa5366d,_0x15520b){var _0x4a1455=[];for(var _0x9678d2 in _0x4d6fff[_0xb7d9('0x21')]){if(_0x4d6fff[_0xb7d9('0x21')][_0xb7d9('0x22')](_0x9678d2)){var _0x215cf7=_0x4d6fff['voiceQueues'][_0x9678d2];var _0x3028d7={'id':_0x215cf7['id'],'name':_0x215cf7[_0xb7d9('0x9')],'strategy':_0x215cf7['strategy'],'answered':_0x215cf7['answered'],'available':_0x215cf7[_0xb7d9('0x23')],'loggedIn':_0x215cf7[_0xb7d9('0x24')],'pTalking':_0x215cf7[_0xb7d9('0x25')],'sumBillable':_0x215cf7[_0xb7d9('0x26')],'sumDuration':_0x215cf7[_0xb7d9('0x27')],'sumHoldTime':_0x215cf7[_0xb7d9('0x28')]||0x0,'talking':_0x215cf7[_0xb7d9('0x29')],'total':_0x215cf7[_0xb7d9('0x2a')],'type':_0x215cf7[_0xb7d9('0x2b')],'unmanaged':_0x215cf7['unmanaged'],'abandoned':_0x215cf7['abandoned'],'waiting':_0x215cf7['waiting'],'loggedInDb':_0x215cf7['loggedInDb']};if(_0x215cf7[_0xb7d9('0x2b')]==='outbound'){_0x3028d7[_0xb7d9('0x2c')]=_0x215cf7['dialActive'];_0x3028d7['dialMethod']=_0x215cf7[_0xb7d9('0x2d')];_0x3028d7[_0xb7d9('0x2e')]=_0x215cf7[_0xb7d9('0x2e')];_0x3028d7['dialOriginateCallerIdNumber']=_0x215cf7[_0xb7d9('0x2f')];_0x3028d7['dialOriginateTimeout']=_0x215cf7['dialOriginateTimeout'];_0x3028d7[_0xb7d9('0x30')]=_0x215cf7[_0xb7d9('0x30')];_0x3028d7[_0xb7d9('0x31')]=_0x215cf7[_0xb7d9('0x31')];_0x3028d7['outboundAnswerCallsDay']=_0x215cf7[_0xb7d9('0x32')];_0x3028d7[_0xb7d9('0x33')]=_0x215cf7[_0xb7d9('0x33')];_0x3028d7[_0xb7d9('0x34')]=_0x215cf7[_0xb7d9('0x34')];_0x3028d7[_0xb7d9('0x35')]=_0x215cf7[_0xb7d9('0x35')];_0x3028d7['outboundDropCallsDayACS']=_0x215cf7['outboundDropCallsDayACS'];_0x3028d7['outboundDropCallsDayCallersExit']=_0x215cf7[_0xb7d9('0x36')];_0x3028d7['outboundDropCallsDayTimeout']=_0x215cf7[_0xb7d9('0x37')];_0x3028d7['outboundNoAnswerCallsDay']=_0x215cf7[_0xb7d9('0x38')];_0x3028d7[_0xb7d9('0x39')]=_0x215cf7[_0xb7d9('0x39')];_0x3028d7['outboundOriginateFailureCallsDay']=_0x215cf7[_0xb7d9('0x3a')];_0x3028d7[_0xb7d9('0x3b')]=_0x215cf7['outboundReCallsDay'];_0x3028d7['outboundRejectCallsDay']=_0x215cf7['outboundRejectCallsDay'];_0x3028d7[_0xb7d9('0x3c')]=_0x215cf7[_0xb7d9('0x3c')];_0x3028d7['predictiveIntervalAnsweredCalls']=_0x215cf7[_0xb7d9('0x3d')];_0x3028d7[_0xb7d9('0x3e')]=_0x215cf7[_0xb7d9('0x3e')];_0x3028d7[_0xb7d9('0x3f')]=_0x215cf7[_0xb7d9('0x3f')];_0x3028d7[_0xb7d9('0x40')]=_0x215cf7[_0xb7d9('0x40')];_0x3028d7[_0xb7d9('0x41')]=_0x215cf7['predictiveIntervalDroppedCallsTimeout'];_0x3028d7[_0xb7d9('0x42')]=_0x215cf7[_0xb7d9('0x42')];_0x3028d7[_0xb7d9('0x43')]=_0x215cf7[_0xb7d9('0x43')];_0x3028d7[_0xb7d9('0x44')]=_0x215cf7[_0xb7d9('0x44')];_0x3028d7[_0xb7d9('0x45')]=_0x215cf7[_0xb7d9('0x45')];_0x3028d7[_0xb7d9('0x46')]=_0x215cf7['predictiveIntervalMultiplicativeFactor'];_0x3028d7[_0xb7d9('0x47')]=_0x215cf7['predictiveIntervalPauses'];_0x3028d7[_0xb7d9('0x48')]=_0x215cf7[_0xb7d9('0x48')];_0x3028d7[_0xb7d9('0x1a')]=_0x215cf7['message'];_0x3028d7[_0xb7d9('0x49')]=_0x215cf7[_0xb7d9('0x49')];}if(_0x215cf7[_0xb7d9('0x4a')]){_0x3028d7[_0xb7d9('0x4a')]={'id':_0x215cf7['Trunk']['id'],'name':_0x215cf7[_0xb7d9('0x4a')]['name'],'active':_0x215cf7[_0xb7d9('0x4a')][_0xb7d9('0x4b')],'callerid':_0x215cf7[_0xb7d9('0x4a')][_0xb7d9('0x4c')]};}if(_0x215cf7[_0xb7d9('0x4d')]){_0x3028d7['Interval']={'id':_0x215cf7['Interval']['id'],'name':_0x215cf7[_0xb7d9('0x4d')]['name']};}_0x4a1455[_0xb7d9('0x4e')](_0x3028d7);}}_0xa5366d({'count':_0x4a1455[_0xb7d9('0x4f')],'rows':_0x4a1455});});},'VoiceChannels':function(_0x55ed38){return new Promise(function(_0x18d841,_0x5b716c){var _0x5062fc=_['values'](_0x4d6fff['channels']);_0x18d841({'count':_0x5062fc[_0xb7d9('0x4f')],'rows':_0x5062fc});});},'VoiceChannelMixMonitor':function(_0x1d38f2){var _0x88c772=this;return new Promise(function(_0x526456,_0x41f815){if(ami['isConnected']()==![]){return _0x41f815(_0x88c772['error'](0x1f4,[config[_0xb7d9('0x12')]['ip'],config[_0xb7d9('0x12')][_0xb7d9('0x1d')],_0xb7d9('0x13')][_0xb7d9('0x14')]('\x20')));}var _0x263f53=schema(properties[_0xb7d9('0x50')])['validate'](_0x1d38f2);if(_0x263f53[_0xb7d9('0x4f')]>0x0){return _0x41f815(_0x88c772['error'](0x1f4,_['map'](_0x263f53,_0xb7d9('0x1a'))[_0xb7d9('0x14')](',\x20')));}var _0x2d063b=_[_0xb7d9('0x51')](_0x4d6fff[_0xb7d9('0x52')],{'uniqueid':_0x1d38f2[_0xb7d9('0x53')]});if(_0x2d063b&&_0x2d063b[_0xb7d9('0x54')]){var _0x349029=util[_0xb7d9('0x6')]('%s.%s',_0x1d38f2[_0xb7d9('0x55')]||_0x1d38f2[_0xb7d9('0x53')],_0x1d38f2[_0xb7d9('0x6')]||_0xb7d9('0x56'));return ami['Action']({'action':_0xb7d9('0x57'),'channel':_0x2d063b[_0xb7d9('0x54')],'file':_0x349029,'options':_0xb7d9('0x58')})[_0xb7d9('0x19')](function(_0x53ad7d){var _0x56526d=_[_0xb7d9('0x51')](_0x2d063b[_0xb7d9('0x59')],{'filename':_0xb7d9('0x5a')+_0x349029[_0xb7d9('0x5b')]()});if(_[_0xb7d9('0x5c')](_0x56526d)){_0x2d063b[_0xb7d9('0x59')]['push']({'filename':_0xb7d9('0x5a')+_0x349029[_0xb7d9('0x5b')](),'createdAt':moment()[_0xb7d9('0x6')](_0xb7d9('0x5d')),'mixmonitorid':_0x53ad7d[_0xb7d9('0x5e')],'status':_0xb7d9('0x5f')});}else{_0x56526d[_0xb7d9('0x5e')]=_0x53ad7d[_0xb7d9('0x5e')];_0x56526d[_0xb7d9('0x60')]=_0xb7d9('0x5f');}_0x526456({'code':0xc8,'message':[_0x1d38f2[_0xb7d9('0x53')],'MixMonitor\x20Success',_0x53ad7d[_0xb7d9('0x5e')]]['join']('\x20'),'mixmonitorid':_0x53ad7d[_0xb7d9('0x5e')]});})[_0xb7d9('0x1b')](function(_0x556d27){_0x41f815(_0x88c772[_0xb7d9('0x1c')](0x1f5,[_0x1d38f2[_0xb7d9('0x53')],_0x556d27[_0xb7d9('0x1a')][_0xb7d9('0x5b')]()][_0xb7d9('0x14')]('\x20')));});}else{return _0x41f815(_0x88c772['error'](0x1f5,_0xb7d9('0x61')));}});},'VoiceChannelStopMixMonitor':function(_0x348998){var _0x3ecbb4=this;return new Promise(function(_0x10958c,_0xd88bdb){if(ami['isConnected']()==![]){return _0xd88bdb(_0x3ecbb4[_0xb7d9('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0xb7d9('0x12')][_0xb7d9('0x1d')],_0xb7d9('0x13')][_0xb7d9('0x14')]('\x20')));}var _0x178636=schema(properties['voicechannel'])[_0xb7d9('0x2')](_0x348998);if(_0x178636['length']>0x0){return _0xd88bdb(_0x3ecbb4[_0xb7d9('0x1c')](0x1f4,_[_0xb7d9('0x62')](_0x178636,_0xb7d9('0x1a'))[_0xb7d9('0x14')](',\x20')));}var _0x172a49=_[_0xb7d9('0x51')](_0x4d6fff[_0xb7d9('0x52')],{'uniqueid':_0x348998[_0xb7d9('0x53')]});if(_0x172a49){return BPromise[_0xb7d9('0x63')]()[_0xb7d9('0x19')](function(){if(_0x172a49[_0xb7d9('0x54')]){return ami['Action']({'action':_0xb7d9('0x64'),'channel':_0x172a49['channel'],'mixmonitorid':_0x348998[_0xb7d9('0x5e')]})[_0xb7d9('0x1b')](function(_0x1eef27){});}})['then'](function(){if(_0x172a49[_0xb7d9('0x65')]){return ami[_0xb7d9('0x18')]({'action':_0xb7d9('0x64'),'channel':_0x172a49['destinationchannel'],'mixmonitorid':_0x348998[_0xb7d9('0x5e')]})['catch'](function(_0x4f010b){});}})[_0xb7d9('0x19')](function(_0x8c7ad0){var _0x3b1f25=_[_0xb7d9('0x51')](_0x172a49[_0xb7d9('0x59')],{'mixmonitorid':_0x348998[_0xb7d9('0x5e')]});if(_0x3b1f25){_0x3b1f25[_0xb7d9('0x60')]=_0xb7d9('0x66');}})[_0xb7d9('0x19')](function(){var _0x31c908=util[_0xb7d9('0x6')](_0xb7d9('0x67'),_0x348998[_0xb7d9('0x55')]||_0x348998[_0xb7d9('0x53')],_0x348998[_0xb7d9('0x6')]||_0xb7d9('0x56'));var _0x329339=_[_0xb7d9('0x51')](_0x172a49[_0xb7d9('0x59')],{'filename':_0xb7d9('0x5a')+_0x31c908['toLowerCase']()});if(_0x329339){_0x329339['status']=_0xb7d9('0x66');}})[_0xb7d9('0x19')](function(){_0x10958c({'code':0xc8,'message':[_0x348998[_0xb7d9('0x53')],_0xb7d9('0x68')][_0xb7d9('0x14')]('\x20')});})[_0xb7d9('0x1b')](function(_0x1e7f73){_0xd88bdb(_0x3ecbb4['error'](0x1f5,[_0x348998['uniqueid'],_0x1e7f73[_0xb7d9('0x1a')][_0xb7d9('0x5b')]()][_0xb7d9('0x14')]('\x20')));});}else{return _0xd88bdb(_0x3ecbb4[_0xb7d9('0x1c')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x18faf1){return new Promise(function(_0x2d4b62,_0x3d6522){var _0x4064ff=_[_0xb7d9('0x69')](_0x4d6fff[_0xb7d9('0x6a')]);_0x2d4b62({'count':_0x4064ff[_0xb7d9('0x4f')],'rows':_0x4064ff});});},'VoiceQueuesChannel':function(_0xb3834b){var _0x1af550=this;return new Promise(function(_0x348813,_0x5a9781){var _0x4d6cd1=schema(properties[_0xb7d9('0x6b')])[_0xb7d9('0x2')](_0xb3834b);if(_0x4d6cd1['length']>0x0){return _0x5a9781(_0x1af550[_0xb7d9('0x1c')](0x1f4,_[_0xb7d9('0x62')](_0x4d6cd1,_0xb7d9('0x1a'))['join'](',\x20')));}var _0x49c7ae=_[_0xb7d9('0x51')](_0x4d6fff[_0xb7d9('0x6a')],{'uniqueid':_0xb3834b[_0xb7d9('0x53')]});if(_0x49c7ae){_0x348813(_0x49c7ae);}else{return _0x5a9781(_0x1af550[_0xb7d9('0x1c')](0x1f5,_0xb7d9('0x61')));}});},'VoiceQueuesChannelHangup':function(_0x17baf4){var _0x231473=this;return new Promise(function(_0x1e63b2,_0x22b3d6){if(ami[_0xb7d9('0x11')]()==![]){return _0x22b3d6(_0x231473[_0xb7d9('0x1c')](0x1f4,[config[_0xb7d9('0x12')]['ip'],config[_0xb7d9('0x12')][_0xb7d9('0x1d')],_0xb7d9('0x13')][_0xb7d9('0x14')]('\x20')));}var _0x3119d5=schema(properties['voicequeuechannelhangup'])[_0xb7d9('0x2')](_0x17baf4);if(_0x3119d5[_0xb7d9('0x4f')]>0x0){return _0x22b3d6(_0x231473['error'](0x1f4,_['map'](_0x3119d5,_0xb7d9('0x1a'))[_0xb7d9('0x14')](',\x20')));}var _0x1dd332=_[_0xb7d9('0x51')](_0x4d6fff[_0xb7d9('0x6a')],{'uniqueid':_0x17baf4[_0xb7d9('0x53')]});if(_0x1dd332&&_0x1dd332[_0xb7d9('0x54')]){return ami[_0xb7d9('0x18')]({'action':'Hangup','channel':_0x1dd332[_0xb7d9('0x54')]})['then'](function(_0x3127ad){_0x1e63b2({'code':0xc8,'message':[_0x17baf4[_0xb7d9('0x53')],_0x3127ad[_0xb7d9('0x1a')]['toLowerCase']()][_0xb7d9('0x14')]('\x20')});})['catch'](function(_0x5ded39){_0x22b3d6(_0x231473['error'](0x1f5,[_0x17baf4[_0xb7d9('0x53')],_0x5ded39[_0xb7d9('0x1a')]['toLowerCase']()][_0xb7d9('0x14')]('\x20')));});}else{return _0x22b3d6(_0x231473[_0xb7d9('0x1c')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x40c57c){var _0x514d03=this;return new Promise(function(_0x25119a,_0x2d4f4b){if(ami[_0xb7d9('0x11')]()==![]){return _0x2d4f4b(_0x514d03[_0xb7d9('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0xb7d9('0x12')][_0xb7d9('0x1d')],_0xb7d9('0x13')]['join']('\x20')));}var _0x161700=schema(properties[_0xb7d9('0x6c')])['validate'](_0x40c57c);if(_0x161700[_0xb7d9('0x4f')]>0x0){return _0x2d4f4b(_0x514d03[_0xb7d9('0x1c')](0x1f4,_[_0xb7d9('0x62')](_0x161700,_0xb7d9('0x1a'))[_0xb7d9('0x14')](',\x20')));}var _0x588eed=_[_0xb7d9('0x51')](_0x4d6fff[_0xb7d9('0x6a')],{'uniqueid':_0x40c57c[_0xb7d9('0x53')]});if(_0x588eed&&_0x588eed['channel']){return ami[_0xb7d9('0x18')]({'action':_0xb7d9('0x6d'),'channel':_0x588eed[_0xb7d9('0x54')],'exten':_0x40c57c['exten'],'context':_0x40c57c[_0xb7d9('0x6e')]||_0x588eed[_0xb7d9('0x6e')],'priority':0x1})['then'](function(_0x35770e){_0x25119a({'code':0xc8,'message':[_0x40c57c[_0xb7d9('0x53')],_0x35770e[_0xb7d9('0x1a')][_0xb7d9('0x5b')]()][_0xb7d9('0x14')]('\x20')});})[_0xb7d9('0x1b')](function(_0x2583b0){_0x2d4f4b(_0x514d03[_0xb7d9('0x1c')](0x1f5,[_0x40c57c[_0xb7d9('0x53')],_0x2583b0[_0xb7d9('0x1a')][_0xb7d9('0x5b')]()]['join']('\x20')));});}else{return _0x2d4f4b(_0x514d03['error'](0x1f5,_0xb7d9('0x61')));}});},'Agents':function(_0x421017){return new Promise(function(_0x475246,_0x4a9eb9){var _0x492e48=_[_0xb7d9('0x69')](_0x4d6fff[_0xb7d9('0xd')]);_0x475246({'count':_0x492e48[_0xb7d9('0x4f')],'rows':_0x492e48});});},'Telephones':function(_0x336613){return new Promise(function(_0x14913,_0x4e7bcb){var _0x1e70e=_[_0xb7d9('0x69')](_0x4d6fff[_0xb7d9('0x6f')]);_0x14913({'count':_0x1e70e[_0xb7d9('0x4f')],'rows':_0x1e70e});});},'Trunks':function(_0x341041){return new Promise(function(_0x17999e,_0x330ab1){var _0x21cfbe=_['values'](_0x4d6fff[_0xb7d9('0x70')]);_0x17999e({'count':_0x21cfbe[_0xb7d9('0x4f')],'rows':_0x21cfbe});});},'OutboundChannels':function(_0x5e06ca){return new Promise(function(_0x2963f6,_0x1ef354){var _0x564a89=_['values'](_0x4d6fff[_0xb7d9('0x71')]);_0x2963f6({'count':_0x564a89[_0xb7d9('0x4f')],'rows':_0x564a89});});},'Outbound':function(_0x3f372a){return new Promise(function(_0x4d526d,_0x57a286){_0x4d526d(_0x4d6fff[_0xb7d9('0x72')]);});},'Campaigns':function(_0x1a2435){return new Promise(function(_0x421588,_0x4a60e7){var _0x4aae5e=_[_0xb7d9('0x69')](_0x4d6fff['campaigns']);_0x421588({'count':_0x4aae5e[_0xb7d9('0x4f')],'rows':_0x4aae5e});});},'VoiceQueuesPreview':function(_0x251b0a){var _0x29d685=this;return new Promise(function(_0x57a47d,_0x40db27){_0x52e120[_0xb7d9('0x73')](_0x251b0a['id'])[_0xb7d9('0x19')](function(_0x37525e){_0x57a47d({'code':0xc8,'message':_0x37525e[_0xb7d9('0x1a')]});})[_0xb7d9('0x1b')](function(_0x4bbdb3){_0x40db27(_0x29d685[_0xb7d9('0x1c')](0x1f4,_0x4bbdb3['message']));});});},'EventManager':function(_0x167de9){var _0x2bb80c=this;return new Promise(function(_0x3eb791,_0x3dfe16){if(!_0x167de9['event']){return _0x3dfe16(_0x2bb80c[_0xb7d9('0x1c')](0x1f4,_0xb7d9('0x74')));}ami['emit']('custom:'+_0x167de9[_0xb7d9('0x75')],_0x167de9[_0xb7d9('0x1a')]);_0x3eb791({'code':0xc8,'message':_0x167de9});});},'FaxAccounts':function(_0x5e800a){return new Promise(function(_0x77dfd1,_0x38903e){var _0x50a36c=_[_0xb7d9('0x69')](_0x4d6fff[_0xb7d9('0x76')]);_0x77dfd1({'count':_0x50a36c[_0xb7d9('0x4f')],'rows':_0x50a36c});});},'SendFax':function(_0x342726){var _0x2a9eec=this;return new Promise(function(_0x50faa6,_0x2addd4){_0x60539e[_0xb7d9('0x77')](_0x342726)[_0xb7d9('0x19')](function(_0x30d906){_0x50faa6({'code':0xc8,'message':_0x30d906[_0xb7d9('0x1a')]});})['catch'](function(_0x52c0c4){_0x2addd4(_0x2a9eec[_0xb7d9('0x1c')](0x1f4,_0x52c0c4[_0xb7d9('0x1a')]));});});},'CheckAfterSend':function(_0x5ab3de){var _0x5ebe6f=this;return new Promise(function(_0x5e9fc8,_0x29d8fd){_0x60539e[_0xb7d9('0x78')](_0x5ab3de)[_0xb7d9('0x19')](function(_0x5501a1){_0x5e9fc8({'code':0xc8,'message':_0x5501a1[_0xb7d9('0x1a')]});})['catch'](function(_0x1b8362){_0x29d8fd(_0x5ebe6f['error'](0x1f4,_0x1b8362['message']));});});}};var _0x588463=jayson[_0xb7d9('0x79')](_0x5c165a)['http']();_0x588463['on'](_0xb7d9('0x1c'),function(_0x3eb2fe){return _0x591c1e(_0x3eb2fe);});_0x588463['listen'](0x232a,_0xb7d9('0x7a'),function(){console[_0xb7d9('0x7b')](_0xb7d9('0x7c'),0x232a);return _0x4fb1e1(_0xb7d9('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 507456d..591f7bb 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 _0x9011=['bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','stringify','exec','autoCreate','data2','data1','calleridnum','isNil','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','resolve','then','format','user:%s','name','action','toLowerCase','merge','xmd-contactid2','catch','error','Error\x20creating\x20contact'];(function(_0x2be82e,_0x1b042b){var _0x4e0410=function(_0x3e3d40){while(--_0x3e3d40){_0x2be82e['push'](_0x2be82e['shift']());}};_0x4e0410(++_0x1b042b);}(_0x9011,0x172));var _0x1901=function(_0x73cb1a,_0x35f977){_0x73cb1a=_0x73cb1a-0x0;var _0x223ae7=_0x9011[_0x73cb1a];return _0x223ae7;};'use strict';var BPromise=require(_0x1901('0x0'));var util=require(_0x1901('0x1'));var _=require('lodash');var Redis=require(_0x1901('0x2'));var config=require(_0x1901('0x3'));var logger=require(_0x1901('0x4'))(_0x1901('0x5'));var cmContactRpc=require(_0x1901('0x6'));config['redis']=_[_0x1901('0x7')](config[_0x1901('0x8')],{'host':_0x1901('0x9'),'port':0x18eb});var io=require(_0x1901('0xa'))(new Redis(config[_0x1901('0x8')]));function emit(_0x33974f,_0x24cec9,_0x3cdc62){logger[_0x1901('0xb')](_0x33974f,_0x24cec9,JSON[_0x1901('0xc')](_0x3cdc62));io['to'](_0x33974f)['emit'](_0x24cec9,_0x3cdc62);}exports[_0x1901('0xd')]=function(_0x665a6e,_0x32be5e,_0x4bfedb){_0x4bfedb[_0x1901('0xe')]=0x0;if(_0x32be5e[_0x1901('0xf')]&&parseInt(_0x32be5e['data2'],0xa)){var _0xfa467d={'ListId':parseInt(_0x32be5e[_0x1901('0x10')],0xa),'phone':_0x4bfedb[_0x1901('0x11')]};if(_[_0x1901('0x12')](_0x4bfedb['routeId'])){_0xfa467d[_0x1901('0x13')]=_0x4bfedb[_0x1901('0x14')]&&_0x4bfedb[_0x1901('0x14')]!==_0x1901('0x15')?_0x4bfedb[_0x1901('0x14')]:_0x4bfedb['calleridnum']||_0x4bfedb[_0x1901('0x16')];}else{_0xfa467d[_0x1901('0x13')]=_0x4bfedb[_0x1901('0x17')]&&_0x4bfedb['destcalleridname']!==_0x1901('0x15')?_0x4bfedb[_0x1901('0x17')]:_0x4bfedb[_0x1901('0x18')]||_0x4bfedb['uniqueid'];_0xfa467d['phone']=_0x4bfedb[_0x1901('0x17')]&&_0x4bfedb[_0x1901('0x17')]!==_0x1901('0x15')?_0x4bfedb['destcalleridname']:_0x4bfedb['destcalleridnum']||_0x4bfedb['uniqueid'];}BPromise[_0x1901('0x19')]()['then'](cmContactRpc['showContact']({'where':_['omit'](_0xfa467d,[_0x1901('0x13')])}))[_0x1901('0x1a')](function(_0x1b7827){if(_0x1b7827){_0x4bfedb['xmd-contactid2']=_0x1b7827['id'];emit(util[_0x1901('0x1b')](_0x1901('0x1c'),_0x665a6e[_0x1901('0x1d')]),util[_0x1901('0x1b')]('trigger:%s',_0x32be5e[_0x1901('0x1e')][_0x1901('0x1f')]()),_[_0x1901('0x20')](_0x4bfedb,{'ListId':parseInt(_0x32be5e[_0x1901('0x10')],0xa)}));return;}else{return BPromise[_0x1901('0x19')]()[_0x1901('0x1a')](cmContactRpc['createContact'](_0xfa467d));}})[_0x1901('0x1a')](function(_0x3eab9f){if(_0x3eab9f){_0x4bfedb[_0x1901('0x21')]=_0x3eab9f['id'];emit(util[_0x1901('0x1b')](_0x1901('0x1c'),_0x665a6e[_0x1901('0x1d')]),util['format']('trigger:%s',_0x32be5e['action']['toLowerCase']()),_[_0x1901('0x20')](_0x4bfedb,{'ListId':parseInt(_0x32be5e['data1'],0xa)}));}})[_0x1901('0x22')](function(_0x16e163){logger[_0x1901('0x23')](_0x1901('0x24'),JSON[_0x1901('0xc')](_0x16e163));});}else{if(_0x665a6e){emit(util[_0x1901('0x1b')](_0x1901('0x1c'),_0x665a6e[_0x1901('0x1d')]),util[_0x1901('0x1b')]('trigger:%s',_0x32be5e['action']['toLowerCase']()),_[_0x1901('0x20')]({'ListId':parseInt(_0x32be5e[_0x1901('0x10')],0xa)},_0x4bfedb));}}}; \ No newline at end of file +var _0x79e9=['then','xmd-contactid2','catch','error','Error\x20creating\x20contact','bluebird','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','redis','localhost','socket.io-emitter','info','stringify','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','showContact','format','user:%s','name','trigger:%s','action','toLowerCase','merge','resolve'];(function(_0x1fe847,_0x1ef444){var _0x4c1da5=function(_0xfac600){while(--_0xfac600){_0x1fe847['push'](_0x1fe847['shift']());}};_0x4c1da5(++_0x1ef444);}(_0x79e9,0x181));var _0x979e=function(_0x7b34af,_0x3f8aa5){_0x7b34af=_0x7b34af-0x0;var _0x2b93bf=_0x79e9[_0x7b34af];return _0x2b93bf;};'use strict';var BPromise=require(_0x979e('0x0'));var util=require(_0x979e('0x1'));var _=require(_0x979e('0x2'));var Redis=require(_0x979e('0x3'));var config=require(_0x979e('0x4'));var logger=require(_0x979e('0x5'))(_0x979e('0x6'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_['defaults'](config[_0x979e('0x7')],{'host':_0x979e('0x8'),'port':0x18eb});var io=require(_0x979e('0x9'))(new Redis(config['redis']));function emit(_0x4f97a0,_0x3eaee4,_0x5a6a24){logger[_0x979e('0xa')](_0x4f97a0,_0x3eaee4,JSON[_0x979e('0xb')](_0x5a6a24));io['to'](_0x4f97a0)['emit'](_0x3eaee4,_0x5a6a24);}exports['exec']=function(_0x40b28b,_0x53645b,_0x31f9ea){_0x31f9ea['autoCreate']=0x0;if(_0x53645b[_0x979e('0xc')]&&parseInt(_0x53645b[_0x979e('0xc')],0xa)){var _0x297443={'ListId':parseInt(_0x53645b[_0x979e('0xd')],0xa),'phone':_0x31f9ea[_0x979e('0xe')]};if(_[_0x979e('0xf')](_0x31f9ea[_0x979e('0x10')])){_0x297443[_0x979e('0x11')]=_0x31f9ea['calleridname']&&_0x31f9ea[_0x979e('0x12')]!==_0x979e('0x13')?_0x31f9ea[_0x979e('0x12')]:_0x31f9ea[_0x979e('0xe')]||_0x31f9ea[_0x979e('0x14')];}else{_0x297443[_0x979e('0x11')]=_0x31f9ea['destcalleridname']&&_0x31f9ea['destcalleridname']!==_0x979e('0x13')?_0x31f9ea[_0x979e('0x15')]:_0x31f9ea[_0x979e('0x16')]||_0x31f9ea[_0x979e('0x14')];_0x297443[_0x979e('0x17')]=_0x31f9ea[_0x979e('0x15')]&&_0x31f9ea[_0x979e('0x15')]!==_0x979e('0x13')?_0x31f9ea[_0x979e('0x15')]:_0x31f9ea[_0x979e('0x16')]||_0x31f9ea['uniqueid'];}BPromise['resolve']()['then'](cmContactRpc[_0x979e('0x18')]({'where':_['omit'](_0x297443,['firstName'])}))['then'](function(_0x1a2e2c){if(_0x1a2e2c){_0x31f9ea['xmd-contactid2']=_0x1a2e2c['id'];emit(util[_0x979e('0x19')](_0x979e('0x1a'),_0x40b28b[_0x979e('0x1b')]),util[_0x979e('0x19')](_0x979e('0x1c'),_0x53645b[_0x979e('0x1d')][_0x979e('0x1e')]()),_[_0x979e('0x1f')](_0x31f9ea,{'ListId':parseInt(_0x53645b[_0x979e('0xd')],0xa)}));return;}else{return BPromise[_0x979e('0x20')]()[_0x979e('0x21')](cmContactRpc['createContact'](_0x297443));}})['then'](function(_0x3b8f49){if(_0x3b8f49){_0x31f9ea[_0x979e('0x22')]=_0x3b8f49['id'];emit(util[_0x979e('0x19')](_0x979e('0x1a'),_0x40b28b[_0x979e('0x1b')]),util[_0x979e('0x19')]('trigger:%s',_0x53645b[_0x979e('0x1d')][_0x979e('0x1e')]()),_[_0x979e('0x1f')](_0x31f9ea,{'ListId':parseInt(_0x53645b[_0x979e('0xd')],0xa)}));}})[_0x979e('0x23')](function(_0x2909bf){logger[_0x979e('0x24')](_0x979e('0x25'),JSON[_0x979e('0xb')](_0x2909bf));});}else{if(_0x40b28b){emit(util[_0x979e('0x19')](_0x979e('0x1a'),_0x40b28b['name']),util['format'](_0x979e('0x1c'),_0x53645b[_0x979e('0x1d')][_0x979e('0x1e')]()),_[_0x979e('0x1f')]({'ListId':parseInt(_0x53645b[_0x979e('0xd')],0xa)},_0x31f9ea));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 62e9af8..8fa7f69 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 _0xb1a6=['AccountId','interaction','message','event','lastevent','util','lodash','mustache','ioredis','./urlforward','../rpc/cmContact','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','custom:agentcalled','syncCustomEvent','bind','custom:dialbegin','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','checkTriggers','hasOwnProperty','status','checkTrigger','merge','Actions','length','interface','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','url','uri','buildUri','isNil','data3','data4','location','uriLocation','800','windowHeight','data6','600','user:%s','name','format','trigger:%s:%s','action','toLowerCase','jscripty','trigger:%s','contactmanager','accounts','queue','routeId','urlforward','exec','parse','query','search','every','AllConditions','checkConditions','channel','AnyConditions','account','ChatWebsiteId','operator','value','upperFirst'];(function(_0x45e957,_0x2d8674){var _0x596900=function(_0x5c7c0f){while(--_0x5c7c0f){_0x45e957['push'](_0x45e957['shift']());}};_0x596900(++_0x2d8674);}(_0xb1a6,0xcd));var _0x6b1a=function(_0x2f0878,_0xd00c5f){_0x2f0878=_0x2f0878-0x0;var _0xed1407=_0xb1a6[_0x2f0878];return _0xed1407;};'use strict';var util=require(_0x6b1a('0x0'));var _=require(_0x6b1a('0x1'));var url=require('url');var Mustache=require(_0x6b1a('0x2'));var Redis=require(_0x6b1a('0x3'));var urlforward=require(_0x6b1a('0x4'));var integration=require('./integration');var cmContact=require('./cmContact');var cmContactRpc=require(_0x6b1a('0x5'));var config=require(_0x6b1a('0x6'));var logger=require(_0x6b1a('0x7'))('trigger');var ami=require(_0x6b1a('0x8'));config[_0x6b1a('0x9')]=_[_0x6b1a('0xa')](config[_0x6b1a('0x9')],{'host':_0x6b1a('0xb'),'port':0x18eb});var io=require(_0x6b1a('0xc'))(new Redis(config[_0x6b1a('0x9')]));var operators={'equals':function(_0x52698f,_0x9549ce){return _0x52698f==_0x9549ce;},'not_equals':function(_0x55b7ab,_0x4e4f45){return _0x55b7ab!=_0x4e4f45;}};var barAndWebActions=[_0x6b1a('0xd'),'url',_0x6b1a('0xe')];function Trigger(_0x10401f){this[_0x6b1a('0xf')]=_0x10401f['triggers'];this[_0x6b1a('0x10')]=_0x10401f[_0x6b1a('0x10')];this['voiceQueues']=_0x10401f[_0x6b1a('0x11')];this[_0x6b1a('0x12')]=_0x10401f['templates'];this[_0x6b1a('0x13')]=_0x10401f[_0x6b1a('0x13')];this['zendeskAccounts']=_0x10401f[_0x6b1a('0x14')];this['freshdeskAccounts']=_0x10401f[_0x6b1a('0x15')];this[_0x6b1a('0x16')]=_0x10401f[_0x6b1a('0x16')];this['sugarcrmAccounts']=_0x10401f['sugarcrmAccounts'];this[_0x6b1a('0x17')]=_0x10401f['zohoAccounts'];this[_0x6b1a('0x18')]=_0x10401f['deskAccounts'];this['vtigerAccounts']=_0x10401f[_0x6b1a('0x19')];this['accounts']={'zendesk':this[_0x6b1a('0x14')],'salesforce':this[_0x6b1a('0x16')],'freshdesk':this[_0x6b1a('0x15')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x6b1a('0x17')],'desk':this[_0x6b1a('0x18')],'vtiger':this[_0x6b1a('0x19')]};ami['on'](_0x6b1a('0x1a'),this[_0x6b1a('0x1b')][_0x6b1a('0x1c')](this));ami['on']('custom:agentconnect',this[_0x6b1a('0x1b')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0x6b1a('0x1b')][_0x6b1a('0x1c')](this));ami['on']('custom:agentcomplete',this[_0x6b1a('0x1b')][_0x6b1a('0x1c')](this));ami['on']('custom:queuecallerabandon',this[_0x6b1a('0x1b')][_0x6b1a('0x1c')](this));ami['on'](_0x6b1a('0x1d'),this['syncCustomEvent'][_0x6b1a('0x1c')](this));ami['on'](_0x6b1a('0x1e'),this[_0x6b1a('0x1b')]['bind'](this));ami['on'](_0x6b1a('0x1f'),this[_0x6b1a('0x1b')][_0x6b1a('0x1c')](this));ami['on'](_0x6b1a('0x20'),this[_0x6b1a('0x1b')]['bind'](this));ami['on'](_0x6b1a('0x21'),this[_0x6b1a('0x1b')][_0x6b1a('0x1c')](this));ami['on']('custom:incomingmessage',this[_0x6b1a('0x1b')][_0x6b1a('0x1c')](this));ami['on'](_0x6b1a('0x22'),this[_0x6b1a('0x1b')][_0x6b1a('0x1c')](this));ami['on'](_0x6b1a('0x23'),this['syncCustomEvent'][_0x6b1a('0x1c')](this));ami['on'](_0x6b1a('0x24'),this[_0x6b1a('0x1b')][_0x6b1a('0x1c')](this));}Trigger[_0x6b1a('0x25')][_0x6b1a('0x26')]=function(_0x1aa641,_0x2c1f86,_0x44f500){logger[_0x6b1a('0x27')](_0x1aa641,_0x2c1f86,JSON[_0x6b1a('0x28')](_0x44f500));io['to'](_0x1aa641)[_0x6b1a('0x26')](_0x2c1f86,_0x44f500);};Trigger['prototype'][_0x6b1a('0x1b')]=function(_0xa8477){var _0x382e51=_['clone'](_0xa8477);this[_0x6b1a('0x29')](_0x382e51);};Trigger[_0x6b1a('0x25')][_0x6b1a('0x29')]=function(_0x46f3c1){var _0x61978a;for(var _0x2d5be3 in this['triggers']){if(this[_0x6b1a('0xf')][_0x6b1a('0x2a')](_0x2d5be3)){if(this[_0x6b1a('0xf')][_0x2d5be3][_0x6b1a('0x2b')]){_0x61978a=this[_0x6b1a('0x2c')](this[_0x6b1a('0xf')][_0x2d5be3],_0x46f3c1);if(_0x61978a){_[_0x6b1a('0x2d')](_0x46f3c1,_0x46f3c1['variables']);for(var _0x30f2e6=0x0,_0x59b792,_0x4b6bf5,_0xee63f2;_0x30f2e60x0){_0x24cc34=_[_0x0d4d('0x25')](_0x143246,_0x35fa07);}return _0x24cc34;}function getCustomFields(_0x298373,_0xb09cb1){var _0x18b01a=[];var _0x5abfe3={'custom_fields':{}};if(_0x298373[_0x0d4d('0x24')]>0x0){_[_0x0d4d('0x26')](_0x298373,function(_0x53a4fb){if(_0x53a4fb[_0x0d4d('0x27')]===_0x0d4d('0x28')&&_0x53a4fb[_0x0d4d('0x29')]&&!_0x53a4fb[_0x0d4d('0x2a')]){_0x5abfe3[_0x53a4fb[_0x0d4d('0x29')]['toLowerCase']()]=_0x53a4fb['content'][_0x0d4d('0x2b')]();}else if(_0x53a4fb['type']===_0x0d4d('0x28')&&_0x53a4fb[_0x0d4d('0x2c')]&&_0x53a4fb[_0x0d4d('0x2a')]){_0x5abfe3[_0x0d4d('0x2d')][_0x53a4fb[_0x0d4d('0x2c')]]=_0x53a4fb[_0x0d4d('0x2e')][_0x0d4d('0x2b')]();}else if(_0x53a4fb['type']==='variable'&&_0x53a4fb[_0x0d4d('0x2f')]&&_0x53a4fb[_0x0d4d('0x2c')]&&_0x53a4fb['customField']){_0xb09cb1[_0x53a4fb[_0x0d4d('0x2f')]]&&(_0x5abfe3[_0x0d4d('0x2d')][_0x53a4fb['idField']]=_0xb09cb1[_0x53a4fb[_0x0d4d('0x2f')]][_0x0d4d('0x2b')]());}else if(_0x53a4fb[_0x0d4d('0x27')]===_0x0d4d('0x30')&&_0x53a4fb[_0x0d4d('0x31')]&&_0x53a4fb[_0x0d4d('0x31')][_0x0d4d('0x32')]&&_0x53a4fb[_0x0d4d('0x2c')]&&_0x53a4fb['customField']){_0xb09cb1[_0x53a4fb[_0x0d4d('0x31')]['name']['toLowerCase']()]&&(_0x5abfe3[_0x0d4d('0x2d')][_0x53a4fb[_0x0d4d('0x2c')]]=_0xb09cb1[_0x53a4fb[_0x0d4d('0x31')][_0x0d4d('0x32')][_0x0d4d('0x33')]()]['toString']());}});}if(_0x5abfe3[_0x0d4d('0x34')]){_0x5abfe3[_0x0d4d('0x34')]=Number(_0x5abfe3['priority']);}return _0x5abfe3;}function getTicket(_0x192bbf,_0x2ab484,_0x1af5ae,_0x50c162,_0x578dbe){logger['info'](_0x0d4d('0x35'));var _0xb0dcfd=_[_0x0d4d('0x36')]({'subject':intUtil[_0x0d4d('0x37')](_0x50c162['Subjects'],_0x578dbe,'\x20'),'type':_0x0d4d('0x38'),'status':_0x0d4d('0x39'),'labels':[_0x0d4d('0x3a'),'Motion','CTI'][_0x0d4d('0x3b')](getTags(_0x50c162[_0x0d4d('0x3c')],_0x0d4d('0x32'))),'description':intUtil[_0x0d4d('0x37')](_0x50c162[_0x0d4d('0x3d')],_0x578dbe,'\x0a'),'_links':{'assigned_user':{'href':util[_0x0d4d('0xe')]('/api/v2/users/%d',_0x2ab484['id']),'class':_0x0d4d('0x3e')}},'message':{'direction':'in','body':intUtil['getString'](_0x50c162[_0x0d4d('0x3d')],_0x578dbe,'\x0a')}},getCustomFields(_0x50c162[_0x0d4d('0x3f')],_0x578dbe));return request({'uri':util[_0x0d4d('0xe')](_0x0d4d('0x40'),_0x192bbf[_0x0d4d('0x10')],_0x1af5ae['id']),'method':_0x0d4d('0x23'),'body':_0xb0dcfd});}exports[_0x0d4d('0x41')]=function(_0x472ba5,_0x5a9e74,_0x45a433,_0x91063b,_0x3dd267,_0x540bb7){var _0x589cd8,_0xf09b73;_0x540bb7[_0x0d4d('0x10')]=intUtil[_0x0d4d('0x42')](_0x540bb7[_0x0d4d('0x10')]);_0x540bb7[_0x0d4d('0x43')]=intUtil[_0x0d4d('0x42')](_0x540bb7[_0x0d4d('0x43')]);if(_0x3dd267&&_0x3dd267['monitor_format']){logger[_0x0d4d('0xc')](_0x0d4d('0x44'),_0x0d4d('0x45'));_0x5a9e74['recordingURL']=util['format'](_0x0d4d('0x46'),_0x540bb7[_0x0d4d('0x43')],_0x5a9e74[_0x0d4d('0x47')],md5(_0x5a9e74[_0x0d4d('0x47')]));}else{_0x5a9e74[_0x0d4d('0x48')]='';}headers['Authorization']=getAuth(_0x540bb7);return getUser(_0x540bb7,_0x91063b['email'])[_0x0d4d('0x15')](function(_0x1f0e0d){_0x589cd8=_0x1f0e0d;logger[_0x0d4d('0xc')]('The\x20User\x20ID\x20is:',_0x589cd8['id']);return getEndUser(_0x540bb7,_0x5a9e74['calleridname'],_0x5a9e74[_0x0d4d('0x49')]);})[_0x0d4d('0x15')](function(_0x5f5dcf){_0xf09b73=_0x5f5dcf;logger[_0x0d4d('0xc')](_0x0d4d('0x4a'),_0xf09b73['id']);return getTicket(_0x540bb7,_0x589cd8,_0xf09b73,_0x45a433,_0x5a9e74);})[_0x0d4d('0x15')](function(_0x32fd32){if(_0x32fd32){logger[_0x0d4d('0xc')](_0x0d4d('0x4b'));logger[_0x0d4d('0xc')](_0x0d4d('0x4c'),_0x32fd32['id']);switch(_0x540bb7[_0x0d4d('0x27')]){case'integrationTab':logger[_0x0d4d('0xc')]('[QUEUE]',_0x0d4d('0x4d'));emit(util[_0x0d4d('0xe')]('user:%s',_0x91063b['name']),'trigger:desk:display',{'recordId':_0x32fd32['id']});break;case _0x0d4d('0x4e'):logger[_0x0d4d('0xc')](_0x0d4d('0x44'),_0x0d4d('0x4f'));emit(util[_0x0d4d('0xe')](_0x0d4d('0x50'),_0x91063b[_0x0d4d('0x32')]),'trigger:browser:url',{'uri':util[_0x0d4d('0xe')](_0x0d4d('0x51'),_0x32fd32['id'])});break;default:logger[_0x0d4d('0x52')](_0x0d4d('0x44'),_0x0d4d('0x53'));}}})[_0x0d4d('0x54')](function(_0x21ed0d){console[_0x0d4d('0x52')](_0x21ed0d);logger[_0x0d4d('0x52')]('[QUEUE]',JSON['stringify'](_0x21ed0d));});};exports[_0x0d4d('0x55')]=function(_0x332483,_0x5f0a1a,_0x57fa18,_0x32f54a,_0x3f6d35,_0x4f1b03,_0x47c1fd){var _0x37432e,_0x4e57ab;_0x4f1b03[_0x0d4d('0x10')]=intUtil[_0x0d4d('0x42')](_0x4f1b03[_0x0d4d('0x10')]);_0x4f1b03[_0x0d4d('0x43')]=intUtil['stripTrailingSlash'](_0x4f1b03[_0x0d4d('0x43')]);if(_0x47c1fd&&_0x47c1fd[_0x0d4d('0x56')]&&_0x47c1fd['recordingFormat']!==_0x0d4d('0x57')){logger[_0x0d4d('0xc')](_0x0d4d('0x58'),_0x0d4d('0x45'));_0x5f0a1a[_0x0d4d('0x48')]=util['format'](_0x0d4d('0x46'),_0x4f1b03['serverUrl'],_0x5f0a1a[_0x0d4d('0x47')],md5(_0x5f0a1a['uniqueid']));}headers['Authorization']=getAuth(_0x4f1b03);return getUser(_0x4f1b03,_0x32f54a[_0x0d4d('0x59')])[_0x0d4d('0x15')](function(_0x2e130c){_0x37432e=_0x2e130c;logger[_0x0d4d('0xc')](_0x0d4d('0x5a'),_0x37432e['id']);return getEndUser(_0x4f1b03,_0x5f0a1a[_0x0d4d('0x5b')],_0x5f0a1a[_0x0d4d('0x5c')]);})[_0x0d4d('0x15')](function(_0x1592c6){_0x4e57ab=_0x1592c6;logger[_0x0d4d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4e57ab['id']);return getTicket(_0x4f1b03,_0x37432e,_0x4e57ab,_0x57fa18,_0x5f0a1a);})[_0x0d4d('0x15')](function(_0xd52b76){if(_0xd52b76){logger[_0x0d4d('0xc')](_0x0d4d('0x4b'));logger[_0x0d4d('0xc')](_0x0d4d('0x4c'),_0xd52b76['id']);switch(_0x4f1b03[_0x0d4d('0x27')]){case'integrationTab':logger[_0x0d4d('0xc')](_0x0d4d('0x44'),_0x0d4d('0x4d'));emit(util[_0x0d4d('0xe')](_0x0d4d('0x50'),_0x32f54a[_0x0d4d('0x32')]),'trigger:desk:display',{'recordId':_0xd52b76['id']});break;case _0x0d4d('0x4e'):logger[_0x0d4d('0xc')](_0x0d4d('0x44'),_0x0d4d('0x4f'));emit(util[_0x0d4d('0xe')](_0x0d4d('0x50'),_0x32f54a[_0x0d4d('0x32')]),'trigger:browser:url',{'uri':util['format'](_0x0d4d('0x5d'),_0x4f1b03[_0x0d4d('0x10')],_0xd52b76['id'])});break;default:logger[_0x0d4d('0x52')](_0x0d4d('0x58'),_0x0d4d('0x53'));}}})['catch'](function(_0x16ec9d){logger[_0x0d4d('0x52')](_0x0d4d('0x58'),JSON[_0x0d4d('0x16')](_0x16ec9d));});};exports['abandoned']=function(_0x29bda8,_0x5e205c,_0x2a9956,_0x1150fd,_0x14fe69,_0x5a5406){var _0x15c027,_0x353581;_0x5a5406[_0x0d4d('0x10')]=intUtil[_0x0d4d('0x42')](_0x5a5406['remoteUri']);_0x5a5406[_0x0d4d('0x43')]=intUtil[_0x0d4d('0x42')](_0x5a5406[_0x0d4d('0x43')]);if(_0x14fe69&&_0x14fe69[_0x0d4d('0x5e')]){logger[_0x0d4d('0xc')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x5e205c[_0x0d4d('0x48')]=util[_0x0d4d('0xe')](_0x0d4d('0x46'),_0x5a5406[_0x0d4d('0x43')],_0x5e205c[_0x0d4d('0x47')],md5(_0x5e205c[_0x0d4d('0x47')]));}else{_0x5e205c[_0x0d4d('0x48')]='';}headers['Authorization']=getAuth(_0x5a5406);return getUser(_0x5a5406)['then'](function(_0x3a07e5){_0x15c027=_0x3a07e5;logger[_0x0d4d('0xc')](_0x0d4d('0x5a'),_0x15c027['id']);return getEndUser(_0x5a5406,_0x5e205c['calleridname'],_0x5e205c[_0x0d4d('0x49')]);})[_0x0d4d('0x15')](function(_0x46f378){_0x353581=_0x46f378;logger['info'](_0x0d4d('0x4a'),_0x353581['id']);return getTicket(_0x5a5406,_0x15c027,_0x353581,_0x2a9956,_0x5e205c);})[_0x0d4d('0x15')](function(_0x51bff0){if(_0x51bff0){logger['info']('Ticket\x20created!');logger[_0x0d4d('0xc')]('The\x20Ticket\x20ID\x20is:',_0x51bff0['id']);}})['catch'](function(_0x3226c0){logger[_0x0d4d('0x52')](_0x0d4d('0x5f'),JSON[_0x0d4d('0x16')](_0x3226c0));});}; \ No newline at end of file +var _0xb657=['calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','[QUEUE]','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','[OUTBOUND]','catch','abandoned','[ABANDONED]','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','format','%s/users','then','find','entries','Agent\x20found!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','remoteUri','total_entries','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','length','map','string','nameField','customField','toLowerCase','content','toString','type','idField','custom_fields','variableName','Variable','name','priority','Creating\x20new\x20ticket...','merge','phone','new','xCALLY','Motion','CTI','concat','getString','Descriptions','/api/v2/users/%d','Fields','%s/customers/%d/cases','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:','calleridname'];(function(_0x20d3a2,_0xfbdc39){var _0x3c923d=function(_0x194c35){while(--_0x194c35){_0x20d3a2['push'](_0x20d3a2['shift']());}};_0x3c923d(++_0xfbdc39);}(_0xb657,0x150));var _0x7b65=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb657[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7b65('0x0'));var rp=require(_0x7b65('0x1'));var md5=require(_0x7b65('0x2'));var util=require(_0x7b65('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7b65('0x4'));var config=require(_0x7b65('0x5'));var logger=require(_0x7b65('0x6'))(_0x7b65('0x7'));config[_0x7b65('0x8')]=_[_0x7b65('0x9')](config[_0x7b65('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x7b65('0xa'))(new Redis(config[_0x7b65('0x8')]));function emit(_0x2580f0,_0x289d2a,_0x52c17e){io['to'](_0x2580f0)[_0x7b65('0xb')](_0x289d2a,_0x52c17e);}var headers={'Content-Type':_0x7b65('0xc'),'Accept':_0x7b65('0xc')};function getUser(_0x597c4f,_0xf86fd7){logger[_0x7b65('0xd')](_0x7b65('0xe'),_0xf86fd7);return request({'uri':util[_0x7b65('0xf')](_0x7b65('0x10'),_0x597c4f['remoteUri'])})[_0x7b65('0x11')](function(_0x4d4ac2){if(_0x4d4ac2['total_entries']){return _[_0x7b65('0x12')](_0x4d4ac2['_embedded'][_0x7b65('0x13')],{'email':_0xf86fd7});}})[_0x7b65('0x11')](function(_0x3c86a4){if(_0x3c86a4){logger[_0x7b65('0xd')](_0x7b65('0x14'));return _0x3c86a4;}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7b65('0x15'),_0x597c4f['remoteUri'])});}});}function request(_0x5d0f37){logger[_0x7b65('0x16')](_0x7b65('0x17'),JSON[_0x7b65('0x18')](_0x5d0f37));return rp(_[_0x7b65('0x9')](_0x5d0f37,{'method':_0x7b65('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0xb6519){var _0x39d1a3;if(_0xb6519[_0x7b65('0x1a')]===_0x7b65('0x1b')){_0x39d1a3=util[_0x7b65('0xf')](_0x7b65('0x1c'),_0xb6519[_0x7b65('0x1d')],_0xb6519['password']);}else if(_0xb6519[_0x7b65('0x1a')]===_0x7b65('0x1e')){_0x39d1a3=util[_0x7b65('0xf')](_0x7b65('0x1f'),_0xb6519['username'],_0xb6519[_0x7b65('0x1e')]);}return util[_0x7b65('0xf')](_0x7b65('0x20'),new Buffer(_0x39d1a3)['toString']('base64'));}function getEndUser(_0x43b3ec,_0xbe1bcd,_0x204ab0){logger[_0x7b65('0xd')](_0x7b65('0x21'),_0x204ab0);return request({'uri':util[_0x7b65('0xf')]('%s/customers/search',_0x43b3ec[_0x7b65('0x22')]),'qs':{'phone':_0x204ab0}})[_0x7b65('0x11')](function(_0x2faabb){if(_0x2faabb[_0x7b65('0x23')]){logger[_0x7b65('0xd')](_0x7b65('0x24'));return _0x2faabb[_0x7b65('0x25')][_0x7b65('0x13')][0x0];}else{logger[_0x7b65('0xd')](_0x7b65('0x26'));return request({'uri':util[_0x7b65('0xf')]('%s/customers',_0x43b3ec[_0x7b65('0x22')]),'method':_0x7b65('0x27'),'body':{'first_name':_0xbe1bcd,'title':_0xbe1bcd,'phone_numbers':[{'type':_0x7b65('0x28'),'value':_0x204ab0}]}});}});}function getTags(_0x165924,_0x48b6eb){var _0x5a6cf6=[];if(_0x165924&&_0x165924[_0x7b65('0x29')]>0x0){_0x5a6cf6=_[_0x7b65('0x2a')](_0x165924,_0x48b6eb);}return _0x5a6cf6;}function getCustomFields(_0x412ac9,_0x45f760){var _0x5975ae=[];var _0x54c0cf={'custom_fields':{}};if(_0x412ac9[_0x7b65('0x29')]>0x0){_['forEach'](_0x412ac9,function(_0x20c3e5){if(_0x20c3e5['type']===_0x7b65('0x2b')&&_0x20c3e5[_0x7b65('0x2c')]&&!_0x20c3e5[_0x7b65('0x2d')]){_0x54c0cf[_0x20c3e5[_0x7b65('0x2c')][_0x7b65('0x2e')]()]=_0x20c3e5[_0x7b65('0x2f')][_0x7b65('0x30')]();}else if(_0x20c3e5[_0x7b65('0x31')]===_0x7b65('0x2b')&&_0x20c3e5[_0x7b65('0x32')]&&_0x20c3e5[_0x7b65('0x2d')]){_0x54c0cf[_0x7b65('0x33')][_0x20c3e5[_0x7b65('0x32')]]=_0x20c3e5[_0x7b65('0x2f')][_0x7b65('0x30')]();}else if(_0x20c3e5['type']==='variable'&&_0x20c3e5[_0x7b65('0x34')]&&_0x20c3e5['idField']&&_0x20c3e5['customField']){_0x45f760[_0x20c3e5[_0x7b65('0x34')]]&&(_0x54c0cf[_0x7b65('0x33')][_0x20c3e5[_0x7b65('0x32')]]=_0x45f760[_0x20c3e5['variableName']][_0x7b65('0x30')]());}else if(_0x20c3e5[_0x7b65('0x31')]==='customVariable'&&_0x20c3e5[_0x7b65('0x35')]&&_0x20c3e5[_0x7b65('0x35')][_0x7b65('0x36')]&&_0x20c3e5['idField']&&_0x20c3e5[_0x7b65('0x2d')]){_0x45f760[_0x20c3e5[_0x7b65('0x35')][_0x7b65('0x36')][_0x7b65('0x2e')]()]&&(_0x54c0cf[_0x7b65('0x33')][_0x20c3e5[_0x7b65('0x32')]]=_0x45f760[_0x20c3e5[_0x7b65('0x35')][_0x7b65('0x36')][_0x7b65('0x2e')]()][_0x7b65('0x30')]());}});}if(_0x54c0cf[_0x7b65('0x37')]){_0x54c0cf[_0x7b65('0x37')]=Number(_0x54c0cf[_0x7b65('0x37')]);}return _0x54c0cf;}function getTicket(_0x328999,_0x41ab85,_0x3267e6,_0x388923,_0x1f5b4b){logger[_0x7b65('0xd')](_0x7b65('0x38'));var _0x39c97d=_[_0x7b65('0x39')]({'subject':intUtil['getString'](_0x388923['Subjects'],_0x1f5b4b,'\x20'),'type':_0x7b65('0x3a'),'status':_0x7b65('0x3b'),'labels':[_0x7b65('0x3c'),_0x7b65('0x3d'),_0x7b65('0x3e')][_0x7b65('0x3f')](getTags(_0x388923['Tags'],_0x7b65('0x36'))),'description':intUtil[_0x7b65('0x40')](_0x388923[_0x7b65('0x41')],_0x1f5b4b,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7b65('0xf')](_0x7b65('0x42'),_0x41ab85['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0x7b65('0x40')](_0x388923[_0x7b65('0x41')],_0x1f5b4b,'\x0a')}},getCustomFields(_0x388923[_0x7b65('0x43')],_0x1f5b4b));return request({'uri':util[_0x7b65('0xf')](_0x7b65('0x44'),_0x328999['remoteUri'],_0x3267e6['id']),'method':'POST','body':_0x39c97d});}exports['queue']=function(_0x38f10f,_0x331755,_0x5cc57f,_0x4468ce,_0x1e29e1,_0x7af6d9){var _0x5999e1,_0x3a09ec;_0x7af6d9[_0x7b65('0x22')]=intUtil[_0x7b65('0x45')](_0x7af6d9[_0x7b65('0x22')]);_0x7af6d9[_0x7b65('0x46')]=intUtil[_0x7b65('0x45')](_0x7af6d9[_0x7b65('0x46')]);if(_0x1e29e1&&_0x1e29e1[_0x7b65('0x47')]){logger['info']('[QUEUE]',_0x7b65('0x48'));_0x331755[_0x7b65('0x49')]=util['format'](_0x7b65('0x4a'),_0x7af6d9[_0x7b65('0x46')],_0x331755[_0x7b65('0x4b')],md5(_0x331755[_0x7b65('0x4b')]));}else{_0x331755[_0x7b65('0x49')]='';}headers[_0x7b65('0x4c')]=getAuth(_0x7af6d9);return getUser(_0x7af6d9,_0x4468ce[_0x7b65('0x4d')])['then'](function(_0x15d3a1){_0x5999e1=_0x15d3a1;logger[_0x7b65('0xd')](_0x7b65('0x4e'),_0x5999e1['id']);return getEndUser(_0x7af6d9,_0x331755[_0x7b65('0x4f')],_0x331755[_0x7b65('0x50')]);})[_0x7b65('0x11')](function(_0x27684a){_0x3a09ec=_0x27684a;logger[_0x7b65('0xd')](_0x7b65('0x51'),_0x3a09ec['id']);return getTicket(_0x7af6d9,_0x5999e1,_0x3a09ec,_0x5cc57f,_0x331755);})['then'](function(_0x9fb2c1){if(_0x9fb2c1){logger[_0x7b65('0xd')](_0x7b65('0x52'));logger[_0x7b65('0xd')]('The\x20Ticket\x20ID\x20is:',_0x9fb2c1['id']);switch(_0x7af6d9[_0x7b65('0x31')]){case _0x7b65('0x53'):logger[_0x7b65('0xd')]('[QUEUE]',_0x7b65('0x54'));emit(util['format'](_0x7b65('0x55'),_0x4468ce[_0x7b65('0x36')]),_0x7b65('0x56'),{'recordId':_0x9fb2c1['id']});break;case _0x7b65('0x57'):logger[_0x7b65('0xd')](_0x7b65('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7b65('0xf')]('user:%s',_0x4468ce['name']),_0x7b65('0x59'),{'uri':util['format'](_0x7b65('0x5a'),_0x9fb2c1['id'])});break;default:logger[_0x7b65('0x5b')]('[QUEUE]',_0x7b65('0x5c'));}}})['catch'](function(_0x3c6a1a){console['error'](_0x3c6a1a);logger[_0x7b65('0x5b')]('[QUEUE]',JSON['stringify'](_0x3c6a1a));});};exports[_0x7b65('0x5d')]=function(_0x2f754c,_0x24256b,_0x35c638,_0x592f12,_0xfdb544,_0x1e8d4f,_0x455e40){var _0x63d3e,_0xe6d803;_0x1e8d4f[_0x7b65('0x22')]=intUtil[_0x7b65('0x45')](_0x1e8d4f['remoteUri']);_0x1e8d4f[_0x7b65('0x46')]=intUtil['stripTrailingSlash'](_0x1e8d4f[_0x7b65('0x46')]);if(_0x455e40&&_0x455e40[_0x7b65('0x5e')]&&_0x455e40[_0x7b65('0x5e')]!=='none'){logger[_0x7b65('0xd')]('[OUTBOUND]',_0x7b65('0x48'));_0x24256b[_0x7b65('0x49')]=util[_0x7b65('0xf')](_0x7b65('0x4a'),_0x1e8d4f[_0x7b65('0x46')],_0x24256b[_0x7b65('0x4b')],md5(_0x24256b['uniqueid']));}headers[_0x7b65('0x4c')]=getAuth(_0x1e8d4f);return getUser(_0x1e8d4f,_0x592f12['email'])[_0x7b65('0x11')](function(_0x555c44){_0x63d3e=_0x555c44;logger[_0x7b65('0xd')]('The\x20User\x20ID\x20is:',_0x63d3e['id']);return getEndUser(_0x1e8d4f,_0x24256b[_0x7b65('0x5f')],_0x24256b[_0x7b65('0x60')]);})[_0x7b65('0x11')](function(_0x17f222){_0xe6d803=_0x17f222;logger[_0x7b65('0xd')](_0x7b65('0x51'),_0xe6d803['id']);return getTicket(_0x1e8d4f,_0x63d3e,_0xe6d803,_0x35c638,_0x24256b);})['then'](function(_0x3858c7){if(_0x3858c7){logger['info'](_0x7b65('0x52'));logger['info'](_0x7b65('0x61'),_0x3858c7['id']);switch(_0x1e8d4f[_0x7b65('0x31')]){case'integrationTab':logger['info'](_0x7b65('0x58'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x7b65('0xf')]('user:%s',_0x592f12[_0x7b65('0x36')]),_0x7b65('0x56'),{'recordId':_0x3858c7['id']});break;case _0x7b65('0x57'):logger[_0x7b65('0xd')](_0x7b65('0x58'),_0x7b65('0x62'));emit(util[_0x7b65('0xf')](_0x7b65('0x55'),_0x592f12[_0x7b65('0x36')]),_0x7b65('0x59'),{'uri':util[_0x7b65('0xf')](_0x7b65('0x63'),_0x1e8d4f[_0x7b65('0x22')],_0x3858c7['id'])});break;default:logger['error'](_0x7b65('0x64'),_0x7b65('0x5c'));}}})[_0x7b65('0x65')](function(_0x1c188c){logger['error'](_0x7b65('0x64'),JSON[_0x7b65('0x18')](_0x1c188c));});};exports[_0x7b65('0x66')]=function(_0x2ef878,_0x19962c,_0x4496b6,_0x54e7b5,_0x192901,_0x59640d){var _0x305406,_0x28ecbe;_0x59640d['remoteUri']=intUtil['stripTrailingSlash'](_0x59640d[_0x7b65('0x22')]);_0x59640d[_0x7b65('0x46')]=intUtil['stripTrailingSlash'](_0x59640d['serverUrl']);if(_0x192901&&_0x192901[_0x7b65('0x47')]){logger[_0x7b65('0xd')]('[ABANDONED]',_0x7b65('0x48'));_0x19962c['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x59640d[_0x7b65('0x46')],_0x19962c[_0x7b65('0x4b')],md5(_0x19962c[_0x7b65('0x4b')]));}else{_0x19962c[_0x7b65('0x49')]='';}headers[_0x7b65('0x4c')]=getAuth(_0x59640d);return getUser(_0x59640d)['then'](function(_0x59c9be){_0x305406=_0x59c9be;logger['info'](_0x7b65('0x4e'),_0x305406['id']);return getEndUser(_0x59640d,_0x19962c[_0x7b65('0x4f')],_0x19962c['calleridnum']);})['then'](function(_0x23849e){_0x28ecbe=_0x23849e;logger[_0x7b65('0xd')](_0x7b65('0x51'),_0x28ecbe['id']);return getTicket(_0x59640d,_0x305406,_0x28ecbe,_0x4496b6,_0x19962c);})[_0x7b65('0x11')](function(_0x48c906){if(_0x48c906){logger[_0x7b65('0xd')](_0x7b65('0x52'));logger[_0x7b65('0xd')](_0x7b65('0x61'),_0x48c906['id']);}})[_0x7b65('0x65')](function(_0x2bd4d6){logger['error'](_0x7b65('0x67'),JSON[_0x7b65('0x18')](_0x2bd4d6));});}; \ 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 936089c..d96828e 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 _0xe3f8=['find','contact','email','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','defaults','GET','map','type','string','customField','nameField','idField','push','content','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','catch','abandoned','[ABANDONED]','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','info','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/api/v2/agents','length','Agent\x20found!'];(function(_0x26655f,_0x456a29){var _0x473132=function(_0x26b4f8){while(--_0x26b4f8){_0x26655f['push'](_0x26655f['shift']());}};_0x473132(++_0x456a29);}(_0xe3f8,0x1ad));var _0x8e3f=function(_0x2f4ec5,_0x540c30){_0x2f4ec5=_0x2f4ec5-0x0;var _0x524f34=_0xe3f8[_0x2f4ec5];return _0x524f34;};'use strict';var _=require(_0x8e3f('0x0'));var rp=require(_0x8e3f('0x1'));var md5=require(_0x8e3f('0x2'));var util=require(_0x8e3f('0x3'));var Redis=require('ioredis');var intUtil=require(_0x8e3f('0x4'));var config=require(_0x8e3f('0x5'));var logger=require(_0x8e3f('0x6'))(_0x8e3f('0x7'));config[_0x8e3f('0x8')]=_['defaults'](config['redis'],{'host':_0x8e3f('0x9'),'port':0x18eb});var io=require(_0x8e3f('0xa'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x1817d1,_0x4809f0,_0x2ae3e5){io['to'](_0x1817d1)[_0x8e3f('0xb')](_0x4809f0,_0x2ae3e5);}function getTicket(_0x22a7ae,_0x582e71,_0x17dd6c,_0x32cd88,_0x26c6a2){logger['info'](_0x8e3f('0xc'));var _0x3f5f51=_[_0x8e3f('0xd')]({'responder_id':_0x582e71['id'],'requester_id':_0x17dd6c['id'],'name':util[_0x8e3f('0xe')](_0x8e3f('0xf'),_0x26c6a2[_0x8e3f('0x10')]),'phone':_0x26c6a2['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8e3f('0x11')](_0x32cd88[_0x8e3f('0x12')],_0x26c6a2,'\x20'),'description':intUtil[_0x8e3f('0x11')](_0x32cd88[_0x8e3f('0x13')],_0x26c6a2,_0x8e3f('0x14')),'tags':getTags(_0x32cd88['Tags'],_0x8e3f('0x15'))},getCustomFields(_0x32cd88[_0x8e3f('0x16')],_0x26c6a2));_0x3f5f51[_0x8e3f('0x17')]=_[_0x8e3f('0x18')](_[_0x8e3f('0x19')](_0x3f5f51['custom_fields'],'id'),_0x8e3f('0x1a'));return request({'uri':util[_0x8e3f('0xe')]('%s/api/v2/tickets',_0x22a7ae[_0x8e3f('0x1b')]),'method':_0x8e3f('0x1c'),'body':_0x3f5f51})[_0x8e3f('0x1d')](function(_0x3b0014){logger[_0x8e3f('0x1e')](_0x8e3f('0x1f'));return _0x3b0014;});}function getUser(_0x2e4f53,_0x3fa7ac){logger[_0x8e3f('0x1e')](_0x8e3f('0x20'),_0x3fa7ac);return request({'uri':util[_0x8e3f('0xe')](_0x8e3f('0x21'),_0x2e4f53['remoteUri']),'qs':{'email':_0x3fa7ac}})[_0x8e3f('0x1d')](function(_0x10bc74){if(_0x10bc74[_0x8e3f('0x22')]){logger[_0x8e3f('0x1e')](_0x8e3f('0x23'));return _[_0x8e3f('0x24')](_0x10bc74,function(_0x535467){return _0x535467[_0x8e3f('0x25')][_0x8e3f('0x26')]===_0x3fa7ac;});}else{logger[_0x8e3f('0x1e')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8e3f('0xe')]('%s/api/v2/agents/me',_0x2e4f53[_0x8e3f('0x1b')])})[_0x8e3f('0x1d')](function(_0x8b1656){logger[_0x8e3f('0x1e')](_0x8e3f('0x27'));return _0x8b1656;});}});}function getEndUser(_0x2ff891,_0x5ba911,_0x175f5b){logger[_0x8e3f('0x1e')](_0x8e3f('0x28'),_0x175f5b);return request({'uri':util[_0x8e3f('0xe')]('%s/api/v2/contacts',_0x2ff891[_0x8e3f('0x1b')]),'qs':{'phone':_0x175f5b}})[_0x8e3f('0x1d')](function(_0x10322a){if(_0x10322a['length']){logger[_0x8e3f('0x1e')](_0x8e3f('0x29'));return _[_0x8e3f('0x24')](_0x10322a,{'phone':_0x175f5b});}else{logger[_0x8e3f('0x1e')](_0x8e3f('0x2a'));return request({'uri':util[_0x8e3f('0xe')]('%s/api/v2/contacts',_0x2ff891[_0x8e3f('0x1b')]),'method':_0x8e3f('0x1c'),'body':{'name':_0x5ba911,'phone':_0x175f5b}})[_0x8e3f('0x1d')](function(_0x12bdb1){logger[_0x8e3f('0x1e')](_0x8e3f('0x2b'));return _0x12bdb1;});}});}function getAuth(_0x340de6){return util[_0x8e3f('0xe')](_0x8e3f('0x2c'),new Buffer(_0x340de6[_0x8e3f('0x2d')]+':X')[_0x8e3f('0x2e')](_0x8e3f('0x2f')));}function request(_0x15cbd6){logger[_0x8e3f('0x30')]('[HTTP]',JSON[_0x8e3f('0x31')](_0x15cbd6));return rp(_[_0x8e3f('0x32')](_0x15cbd6,{'method':_0x8e3f('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x407bc7,_0x26f57f){var _0x20c892=[];if(_0x407bc7&&_0x407bc7[_0x8e3f('0x22')]>0x0){_0x20c892=_[_0x8e3f('0x34')](_0x407bc7,_0x26f57f);}return _0x20c892;}function getCustomFields(_0x3daa06,_0x1b9b31){var _0x251d25=[];var _0x2ce262={'custom_fields':[]};if(_0x3daa06[_0x8e3f('0x22')]>0x0){_['forEach'](_0x3daa06,function(_0x239d09){if(_0x239d09[_0x8e3f('0x35')]===_0x8e3f('0x36')&&_0x239d09['nameField']&&!_0x239d09[_0x8e3f('0x37')]){_0x2ce262[_0x239d09[_0x8e3f('0x38')]['toLowerCase']()]=_0x239d09['content'][_0x8e3f('0x2e')]();}else if(_0x239d09[_0x8e3f('0x35')]===_0x8e3f('0x36')&&_0x239d09[_0x8e3f('0x39')]&&_0x239d09[_0x8e3f('0x37')]){_0x2ce262['custom_fields'][_0x8e3f('0x3a')]({'id':_0x239d09[_0x8e3f('0x39')],'value':_0x239d09[_0x8e3f('0x3b')][_0x8e3f('0x2e')]()});}else if(_0x239d09[_0x8e3f('0x35')]===_0x8e3f('0x3c')&&_0x239d09[_0x8e3f('0x3d')]&&_0x239d09['idField']&&_0x239d09[_0x8e3f('0x37')]){_0x1b9b31[_0x239d09[_0x8e3f('0x3d')]]&&_0x2ce262['custom_fields'][_0x8e3f('0x3a')]({'id':_0x239d09[_0x8e3f('0x39')],'value':_0x1b9b31[_0x239d09['variableName']][_0x8e3f('0x2e')]()});}else if(_0x239d09[_0x8e3f('0x35')]===_0x8e3f('0x3e')&&_0x239d09[_0x8e3f('0x3f')]&&_0x239d09[_0x8e3f('0x3f')][_0x8e3f('0x15')]&&_0x239d09['idField']&&_0x239d09[_0x8e3f('0x37')]){_0x1b9b31[_0x239d09['Variable']['name']['toLowerCase']()]&&_0x2ce262[_0x8e3f('0x17')][_0x8e3f('0x3a')]({'id':_0x239d09[_0x8e3f('0x39')],'value':_0x1b9b31[_0x239d09[_0x8e3f('0x3f')][_0x8e3f('0x15')][_0x8e3f('0x40')]()][_0x8e3f('0x2e')]()});}});}return _0x2ce262;}exports[_0x8e3f('0x41')]=function(_0x4ea0a6,_0xc06700,_0x26ed25,_0x590edf,_0x397252,_0x5ab60f){var _0x5411d8,_0x44e908;_0x5ab60f[_0x8e3f('0x1b')]=intUtil[_0x8e3f('0x42')](_0x5ab60f['remoteUri']);_0x5ab60f[_0x8e3f('0x43')]=intUtil[_0x8e3f('0x42')](_0x5ab60f[_0x8e3f('0x43')]);if(_0x397252&&_0x397252[_0x8e3f('0x44')]){logger[_0x8e3f('0x1e')]('[QUEUE]',_0x8e3f('0x45'));_0xc06700[_0x8e3f('0x46')]=util[_0x8e3f('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ab60f[_0x8e3f('0x43')],_0xc06700[_0x8e3f('0x47')],md5(_0xc06700['uniqueid']));}else{_0xc06700[_0x8e3f('0x46')]='';}headers[_0x8e3f('0x48')]=getAuth(_0x5ab60f);return getUser(_0x5ab60f,_0x590edf[_0x8e3f('0x26')])[_0x8e3f('0x1d')](function(_0x54d153){_0x5411d8=_0x54d153;logger['info'](_0x8e3f('0x49'),_0x5411d8['id']);return getEndUser(_0x5ab60f,_0xc06700[_0x8e3f('0x10')],_0xc06700[_0x8e3f('0x4a')]);})[_0x8e3f('0x1d')](function(_0x48cb2b){_0x44e908=_0x48cb2b;logger[_0x8e3f('0x1e')]('The\x20Enduser\x20ID\x20is:',_0x44e908['id']);return getTicket(_0x5ab60f,_0x5411d8,_0x44e908,_0x26ed25,_0xc06700);})[_0x8e3f('0x1d')](function(_0x156808){if(_0x156808&&_0x156808['id']){logger[_0x8e3f('0x1e')](_0x8e3f('0x1f'));logger['info'](_0x8e3f('0x4b'),_0x156808['id']);logger['info'](_0x8e3f('0x4c'),_0x8e3f('0x4d'));emit(util[_0x8e3f('0xe')](_0x8e3f('0x4e'),_0x590edf['name']),_0x8e3f('0x4f'),{'uri':util['format'](_0x8e3f('0x50'),_0x5ab60f[_0x8e3f('0x1b')],_0x156808['id'])});}})['catch'](function(_0x29698b){logger[_0x8e3f('0x51')]('[QUEUE]',JSON[_0x8e3f('0x31')](_0x29698b));});};exports[_0x8e3f('0x52')]=function(_0x2a8432,_0x287611,_0x273255,_0x437172,_0x34517e,_0x56b5e2,_0x228f67){var _0x49107c,_0x39758d;_0x56b5e2[_0x8e3f('0x1b')]=intUtil[_0x8e3f('0x42')](_0x56b5e2['remoteUri']);_0x56b5e2[_0x8e3f('0x43')]=intUtil[_0x8e3f('0x42')](_0x56b5e2[_0x8e3f('0x43')]);if(_0x228f67&&_0x228f67[_0x8e3f('0x53')]&&_0x228f67[_0x8e3f('0x53')]!==_0x8e3f('0x54')){logger[_0x8e3f('0x1e')](_0x8e3f('0x55'),_0x8e3f('0x45'));_0x287611[_0x8e3f('0x46')]=util[_0x8e3f('0xe')](_0x8e3f('0x56'),_0x56b5e2[_0x8e3f('0x43')],_0x287611[_0x8e3f('0x47')],md5(_0x287611['uniqueid']));}headers[_0x8e3f('0x48')]=getAuth(_0x56b5e2);return getUser(_0x56b5e2,_0x437172[_0x8e3f('0x26')])[_0x8e3f('0x1d')](function(_0x463551){_0x49107c=_0x463551;logger[_0x8e3f('0x1e')]('The\x20User\x20ID\x20is:',_0x49107c['id']);return getEndUser(_0x56b5e2,_0x287611[_0x8e3f('0x57')],_0x287611[_0x8e3f('0x58')]);})['then'](function(_0x1d830b){_0x39758d=_0x1d830b;logger[_0x8e3f('0x1e')](_0x8e3f('0x59'),_0x39758d['id']);return getTicket(_0x56b5e2,_0x49107c,_0x39758d,_0x273255,_0x287611);})['then'](function(_0x1ac832){if(_0x1ac832&&_0x1ac832['id']){logger[_0x8e3f('0x1e')](_0x8e3f('0x1f'));logger[_0x8e3f('0x1e')](_0x8e3f('0x4b'),_0x1ac832['id']);logger[_0x8e3f('0x1e')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8e3f('0xe')](_0x8e3f('0x4e'),_0x437172[_0x8e3f('0x15')]),_0x8e3f('0x4f'),{'uri':util[_0x8e3f('0xe')](_0x8e3f('0x50'),_0x56b5e2[_0x8e3f('0x1b')],_0x1ac832['id'])});}})[_0x8e3f('0x5a')](function(_0x20281c){logger[_0x8e3f('0x51')](_0x8e3f('0x55'),JSON['stringify'](_0x20281c));});};exports[_0x8e3f('0x5b')]=function(_0x28bde0,_0x7d553e,_0x1f0d07,_0x24f4bf,_0x11d1f6,_0x11a2ba){var _0x1be9d7,_0x4ac2cd;_0x11a2ba[_0x8e3f('0x1b')]=intUtil['stripTrailingSlash'](_0x11a2ba['remoteUri']);_0x11a2ba['serverUrl']=intUtil[_0x8e3f('0x42')](_0x11a2ba[_0x8e3f('0x43')]);if(_0x11d1f6&&_0x11d1f6[_0x8e3f('0x44')]){logger[_0x8e3f('0x1e')](_0x8e3f('0x5c'),_0x8e3f('0x45'));_0x7d553e[_0x8e3f('0x46')]=util[_0x8e3f('0xe')](_0x8e3f('0x56'),_0x11a2ba[_0x8e3f('0x43')],_0x7d553e[_0x8e3f('0x47')],md5(_0x7d553e[_0x8e3f('0x47')]));}else{_0x7d553e['recordingURL']='';}headers['Authorization']=getAuth(_0x11a2ba);return getUser(_0x11a2ba,_0x24f4bf['email'])[_0x8e3f('0x1d')](function(_0x14743d){_0x1be9d7=_0x14743d;logger[_0x8e3f('0x1e')](_0x8e3f('0x49'),_0x1be9d7['id']);return getEndUser(_0x11a2ba,_0x7d553e[_0x8e3f('0x10')],_0x7d553e[_0x8e3f('0x4a')]);})[_0x8e3f('0x1d')](function(_0x34101d){_0x4ac2cd=_0x34101d;logger[_0x8e3f('0x1e')]('The\x20Enduser\x20ID\x20is:',_0x4ac2cd['id']);return getTicket(_0x11a2ba,_0x1be9d7,_0x4ac2cd,_0x1f0d07,_0x7d553e);})[_0x8e3f('0x1d')](function(_0x23df09){if(_0x23df09){logger[_0x8e3f('0x1e')](_0x8e3f('0x1f'));logger['info'](_0x8e3f('0x4b'),_0x23df09['id']);}})[_0x8e3f('0x5a')](function(_0x24f336){logger[_0x8e3f('0x51')]('[ABANDONED]',JSON['stringify'](_0x24f336));});}; \ No newline at end of file +var _0x1990=['./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Tags','Fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','forEach','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','user:%s','abandoned','[ABANDONED]','lodash','request-promise','util','ioredis'];(function(_0x5833ec,_0x3190af){var _0x14335d=function(_0x59cff2){while(--_0x59cff2){_0x5833ec['push'](_0x5833ec['shift']());}};_0x14335d(++_0x3190af);}(_0x1990,0xb4));var _0x0199=function(_0x57c2e7,_0xeed8e3){_0x57c2e7=_0x57c2e7-0x0;var _0x379a00=_0x1990[_0x57c2e7];return _0x379a00;};'use strict';var _=require(_0x0199('0x0'));var rp=require(_0x0199('0x1'));var md5=require('md5');var util=require(_0x0199('0x2'));var Redis=require(_0x0199('0x3'));var intUtil=require(_0x0199('0x4'));var config=require(_0x0199('0x5'));var logger=require(_0x0199('0x6'))(_0x0199('0x7'));config[_0x0199('0x8')]=_[_0x0199('0x9')](config['redis'],{'host':_0x0199('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0199('0x8')]));var headers={'Content-Type':_0x0199('0xb'),'Accept':_0x0199('0xb')};function emit(_0x4751f8,_0x23f06e,_0x417de6){io['to'](_0x4751f8)['emit'](_0x23f06e,_0x417de6);}function getTicket(_0x8a1c80,_0x5503de,_0xcdf036,_0x56900b,_0x4154c2){logger[_0x0199('0xc')](_0x0199('0xd'));var _0x56c651=_['merge']({'responder_id':_0x5503de['id'],'requester_id':_0xcdf036['id'],'name':util[_0x0199('0xe')](_0x0199('0xf'),_0x4154c2['calleridname']),'phone':_0x4154c2[_0x0199('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x0199('0x11')](_0x56900b[_0x0199('0x12')],_0x4154c2,'\x20'),'description':intUtil[_0x0199('0x11')](_0x56900b['Descriptions'],_0x4154c2,'
'),'tags':getTags(_0x56900b[_0x0199('0x13')],'name')},getCustomFields(_0x56900b[_0x0199('0x14')],_0x4154c2));_0x56c651['custom_fields']=_[_0x0199('0x15')](_[_0x0199('0x16')](_0x56c651['custom_fields'],'id'),_0x0199('0x17'));return request({'uri':util[_0x0199('0xe')](_0x0199('0x18'),_0x8a1c80[_0x0199('0x19')]),'method':'POST','body':_0x56c651})['then'](function(_0x31ba30){logger['info'](_0x0199('0x1a'));return _0x31ba30;});}function getUser(_0x557367,_0x3db017){logger[_0x0199('0xc')](_0x0199('0x1b'),_0x3db017);return request({'uri':util[_0x0199('0xe')](_0x0199('0x1c'),_0x557367['remoteUri']),'qs':{'email':_0x3db017}})[_0x0199('0x1d')](function(_0x4f785b){if(_0x4f785b[_0x0199('0x1e')]){logger[_0x0199('0xc')](_0x0199('0x1f'));return _[_0x0199('0x20')](_0x4f785b,function(_0x554ac0){return _0x554ac0[_0x0199('0x21')][_0x0199('0x22')]===_0x3db017;});}else{logger[_0x0199('0xc')](_0x0199('0x23'));return request({'uri':util[_0x0199('0xe')]('%s/api/v2/agents/me',_0x557367['remoteUri'])})[_0x0199('0x1d')](function(_0x25d0a6){logger[_0x0199('0xc')](_0x0199('0x24'));return _0x25d0a6;});}});}function getEndUser(_0x222009,_0x3cbafd,_0x2f6d18){logger[_0x0199('0xc')](_0x0199('0x25'),_0x2f6d18);return request({'uri':util[_0x0199('0xe')](_0x0199('0x26'),_0x222009[_0x0199('0x19')]),'qs':{'phone':_0x2f6d18}})['then'](function(_0xb361a){if(_0xb361a[_0x0199('0x1e')]){logger[_0x0199('0xc')](_0x0199('0x27'));return _[_0x0199('0x20')](_0xb361a,{'phone':_0x2f6d18});}else{logger[_0x0199('0xc')](_0x0199('0x28'));return request({'uri':util[_0x0199('0xe')](_0x0199('0x26'),_0x222009[_0x0199('0x19')]),'method':'POST','body':{'name':_0x3cbafd,'phone':_0x2f6d18}})[_0x0199('0x1d')](function(_0x168da8){logger['info'](_0x0199('0x29'));return _0x168da8;});}});}function getAuth(_0x76ec4f){return util['format'](_0x0199('0x2a'),new Buffer(_0x76ec4f[_0x0199('0x2b')]+':X')[_0x0199('0x2c')](_0x0199('0x2d')));}function request(_0x39435f){logger[_0x0199('0x2e')](_0x0199('0x2f'),JSON['stringify'](_0x39435f));return rp(_[_0x0199('0x9')](_0x39435f,{'method':_0x0199('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x3e1ff5,_0x53d771){var _0xd04f9a=[];if(_0x3e1ff5&&_0x3e1ff5[_0x0199('0x1e')]>0x0){_0xd04f9a=_['map'](_0x3e1ff5,_0x53d771);}return _0xd04f9a;}function getCustomFields(_0x2308fe,_0x43246a){var _0x3372cc=[];var _0x50f141={'custom_fields':[]};if(_0x2308fe[_0x0199('0x1e')]>0x0){_[_0x0199('0x31')](_0x2308fe,function(_0x54f7ef){if(_0x54f7ef[_0x0199('0x32')]==='string'&&_0x54f7ef[_0x0199('0x33')]&&!_0x54f7ef[_0x0199('0x34')]){_0x50f141[_0x54f7ef[_0x0199('0x33')][_0x0199('0x35')]()]=_0x54f7ef[_0x0199('0x36')][_0x0199('0x2c')]();}else if(_0x54f7ef[_0x0199('0x32')]===_0x0199('0x37')&&_0x54f7ef[_0x0199('0x38')]&&_0x54f7ef[_0x0199('0x34')]){_0x50f141[_0x0199('0x39')][_0x0199('0x3a')]({'id':_0x54f7ef[_0x0199('0x38')],'value':_0x54f7ef['content'][_0x0199('0x2c')]()});}else if(_0x54f7ef[_0x0199('0x32')]===_0x0199('0x3b')&&_0x54f7ef[_0x0199('0x3c')]&&_0x54f7ef[_0x0199('0x38')]&&_0x54f7ef[_0x0199('0x34')]){_0x43246a[_0x54f7ef[_0x0199('0x3c')]]&&_0x50f141[_0x0199('0x39')]['push']({'id':_0x54f7ef[_0x0199('0x38')],'value':_0x43246a[_0x54f7ef[_0x0199('0x3c')]][_0x0199('0x2c')]()});}else if(_0x54f7ef[_0x0199('0x32')]===_0x0199('0x3d')&&_0x54f7ef[_0x0199('0x3e')]&&_0x54f7ef[_0x0199('0x3e')]['name']&&_0x54f7ef[_0x0199('0x38')]&&_0x54f7ef[_0x0199('0x34')]){_0x43246a[_0x54f7ef[_0x0199('0x3e')]['name'][_0x0199('0x35')]()]&&_0x50f141['custom_fields'][_0x0199('0x3a')]({'id':_0x54f7ef[_0x0199('0x38')],'value':_0x43246a[_0x54f7ef['Variable'][_0x0199('0x3f')][_0x0199('0x35')]()][_0x0199('0x2c')]()});}});}return _0x50f141;}exports[_0x0199('0x40')]=function(_0x4ba16e,_0x202d35,_0x37a3ad,_0x516c80,_0x5792c1,_0xc28078){var _0x5c6182,_0x3e3f53;_0xc28078[_0x0199('0x19')]=intUtil['stripTrailingSlash'](_0xc28078[_0x0199('0x19')]);_0xc28078['serverUrl']=intUtil[_0x0199('0x41')](_0xc28078['serverUrl']);if(_0x5792c1&&_0x5792c1[_0x0199('0x42')]){logger['info'](_0x0199('0x43'),'Recording\x20is\x20enabled!');_0x202d35['recordingURL']=util[_0x0199('0xe')](_0x0199('0x44'),_0xc28078[_0x0199('0x45')],_0x202d35[_0x0199('0x46')],md5(_0x202d35[_0x0199('0x46')]));}else{_0x202d35['recordingURL']='';}headers[_0x0199('0x47')]=getAuth(_0xc28078);return getUser(_0xc28078,_0x516c80['email'])[_0x0199('0x1d')](function(_0x10abc2){_0x5c6182=_0x10abc2;logger[_0x0199('0xc')](_0x0199('0x48'),_0x5c6182['id']);return getEndUser(_0xc28078,_0x202d35[_0x0199('0x49')],_0x202d35[_0x0199('0x10')]);})['then'](function(_0x22a019){_0x3e3f53=_0x22a019;logger[_0x0199('0xc')]('The\x20Enduser\x20ID\x20is:',_0x3e3f53['id']);return getTicket(_0xc28078,_0x5c6182,_0x3e3f53,_0x37a3ad,_0x202d35);})[_0x0199('0x1d')](function(_0x2effb9){if(_0x2effb9&&_0x2effb9['id']){logger['info']('Ticket\x20created!');logger['info'](_0x0199('0x4a'),_0x2effb9['id']);logger[_0x0199('0xc')]('[QUEUE]',_0x0199('0x4b'));emit(util[_0x0199('0xe')]('user:%s',_0x516c80[_0x0199('0x3f')]),'trigger:browser:url',{'uri':util['format'](_0x0199('0x4c'),_0xc28078[_0x0199('0x19')],_0x2effb9['id'])});}})[_0x0199('0x4d')](function(_0x7399a1){logger[_0x0199('0x4e')]('[QUEUE]',JSON[_0x0199('0x4f')](_0x7399a1));});};exports[_0x0199('0x50')]=function(_0x4dab17,_0x4c5513,_0x45feea,_0x4717ce,_0x37ffcb,_0x5eb0d2,_0x48efe7){var _0x1d4e41,_0x20a4cf;_0x5eb0d2[_0x0199('0x19')]=intUtil[_0x0199('0x41')](_0x5eb0d2[_0x0199('0x19')]);_0x5eb0d2[_0x0199('0x45')]=intUtil[_0x0199('0x41')](_0x5eb0d2[_0x0199('0x45')]);if(_0x48efe7&&_0x48efe7[_0x0199('0x51')]&&_0x48efe7[_0x0199('0x51')]!==_0x0199('0x52')){logger['info']('[OUTBOUND]',_0x0199('0x53'));_0x4c5513[_0x0199('0x54')]=util[_0x0199('0xe')](_0x0199('0x44'),_0x5eb0d2[_0x0199('0x45')],_0x4c5513[_0x0199('0x46')],md5(_0x4c5513[_0x0199('0x46')]));}headers['Authorization']=getAuth(_0x5eb0d2);return getUser(_0x5eb0d2,_0x4717ce[_0x0199('0x22')])['then'](function(_0x38f1a4){_0x1d4e41=_0x38f1a4;logger[_0x0199('0xc')](_0x0199('0x48'),_0x1d4e41['id']);return getEndUser(_0x5eb0d2,_0x4c5513[_0x0199('0x55')],_0x4c5513[_0x0199('0x56')]);})[_0x0199('0x1d')](function(_0x5ec9fb){_0x20a4cf=_0x5ec9fb;logger[_0x0199('0xc')](_0x0199('0x57'),_0x20a4cf['id']);return getTicket(_0x5eb0d2,_0x1d4e41,_0x20a4cf,_0x45feea,_0x4c5513);})[_0x0199('0x1d')](function(_0xc064ff){if(_0xc064ff&&_0xc064ff['id']){logger['info'](_0x0199('0x1a'));logger[_0x0199('0xc')](_0x0199('0x4a'),_0xc064ff['id']);logger[_0x0199('0xc')](_0x0199('0x58'),_0x0199('0x4b'));emit(util[_0x0199('0xe')](_0x0199('0x59'),_0x4717ce[_0x0199('0x3f')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x5eb0d2[_0x0199('0x19')],_0xc064ff['id'])});}})[_0x0199('0x4d')](function(_0x4b52b4){logger[_0x0199('0x4e')](_0x0199('0x58'),JSON['stringify'](_0x4b52b4));});};exports[_0x0199('0x5a')]=function(_0xa15d31,_0xf351a3,_0x1bb73b,_0x3486c1,_0x1883df,_0x48fa26){var _0x39a8e1,_0x548a66;_0x48fa26['remoteUri']=intUtil[_0x0199('0x41')](_0x48fa26['remoteUri']);_0x48fa26['serverUrl']=intUtil['stripTrailingSlash'](_0x48fa26[_0x0199('0x45')]);if(_0x1883df&&_0x1883df[_0x0199('0x42')]){logger[_0x0199('0xc')](_0x0199('0x5b'),_0x0199('0x53'));_0xf351a3[_0x0199('0x54')]=util['format'](_0x0199('0x44'),_0x48fa26[_0x0199('0x45')],_0xf351a3[_0x0199('0x46')],md5(_0xf351a3[_0x0199('0x46')]));}else{_0xf351a3['recordingURL']='';}headers[_0x0199('0x47')]=getAuth(_0x48fa26);return getUser(_0x48fa26,_0x3486c1[_0x0199('0x22')])[_0x0199('0x1d')](function(_0x433f9f){_0x39a8e1=_0x433f9f;logger['info'](_0x0199('0x48'),_0x39a8e1['id']);return getEndUser(_0x48fa26,_0xf351a3[_0x0199('0x49')],_0xf351a3[_0x0199('0x10')]);})[_0x0199('0x1d')](function(_0x4de980){_0x548a66=_0x4de980;logger[_0x0199('0xc')]('The\x20Enduser\x20ID\x20is:',_0x548a66['id']);return getTicket(_0x48fa26,_0x39a8e1,_0x548a66,_0x1bb73b,_0xf351a3);})[_0x0199('0x1d')](function(_0x2f0d2a){if(_0x2f0d2a){logger['info'](_0x0199('0x1a'));logger[_0x0199('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2f0d2a['id']);}})[_0x0199('0x4d')](function(_0x3ffff1){logger['error']('[ABANDONED]',JSON[_0x0199('0x4f')](_0x3ffff1));});}; \ 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 28f4357..7d9c862 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 _0xd7fc=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','abandoned','salesforce','desk','vtiger','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','error','lodash','./zendesk','./zoho','./desk','zendesk','sugarcrm','freshdesk','zoho','exec','includes','data1','toLowerCase','data2','find'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xd7fc,0x1c3));var _0xcd7f=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xd7fc[_0x3f2a90];return _0xb46279;};'use strict';var _=require(_0xcd7f('0x0'));var util=require('util');var zendesk=require(_0xcd7f('0x1'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xcd7f('0x2'));var desk=require(_0xcd7f('0x3'));var vtiger=require('./vtiger');var integrations=[_0xcd7f('0x4'),'salesforce',_0xcd7f('0x5'),_0xcd7f('0x6'),_0xcd7f('0x7'),'desk','vtiger'];exports[_0xcd7f('0x8')]=function(_0x4134de,_0x2bb7e1,_0x32055d,_0x3b069e,_0x26dce3,_0x5f30cd){if(_0x32055d){if(_[_0xcd7f('0x9')](integrations,_0x4134de[_0xcd7f('0xa')][_0xcd7f('0xb')]())){try{var _0x1631e5=null;var _0x35c586='';var _0x408951=_0x32055d[_0x4134de[_0xcd7f('0xa')][_0xcd7f('0xb')]()];if(_0x408951){var _0x40b17e=_0x408951[_0x4134de[_0xcd7f('0xc')]];if(_0x40b17e){var _0x1135c2=_[_0xcd7f('0xd')](_0x40b17e[_0xcd7f('0xe')],{'id':parseInt(_0x4134de[_0xcd7f('0xf')],0xa)});if(_0x1135c2){if(_0x3b069e){if(_0x26dce3&&_0x2bb7e1[_0xcd7f('0x10')]){_0x35c586=_0xcd7f('0x10');}else if(_0x2bb7e1[_0xcd7f('0x11')]){_0x35c586=_0xcd7f('0x12');}else{console[_0xcd7f('0x13')](_0xcd7f('0x14'),_0x2bb7e1);}}else{_0x35c586=_0xcd7f('0x15');}switch(_0x4134de['data1'][_0xcd7f('0xb')]()){case _0xcd7f('0x4'):zendesk[_0x35c586](_0x4134de,_0x2bb7e1,_0x1135c2,_0x3b069e,_0x26dce3,_0x40b17e,_0x5f30cd);break;case _0xcd7f('0x16'):salesforce[_0x35c586](_0x4134de,_0x2bb7e1,_0x1135c2,_0x3b069e,_0x26dce3,_0x40b17e,_0x5f30cd);break;case _0xcd7f('0x5'):sugarcrm[_0x35c586](_0x4134de,_0x2bb7e1,_0x1135c2,_0x3b069e,_0x26dce3,_0x40b17e,_0x5f30cd);break;case _0xcd7f('0x6'):freshdesk[_0x35c586](_0x4134de,_0x2bb7e1,_0x1135c2,_0x3b069e,_0x26dce3,_0x40b17e,_0x5f30cd);break;case _0xcd7f('0x7'):zoho[_0x35c586](_0x4134de,_0x2bb7e1,_0x1135c2,_0x3b069e,_0x26dce3,_0x40b17e,_0x5f30cd);break;case _0xcd7f('0x17'):desk[_0x35c586](_0x4134de,_0x2bb7e1,_0x1135c2,_0x3b069e,_0x26dce3,_0x40b17e,_0x5f30cd);break;case _0xcd7f('0x18'):vtiger[_0x35c586](_0x4134de,_0x2bb7e1,_0x1135c2,_0x3b069e,_0x26dce3,_0x40b17e,_0x5f30cd);break;default:console[_0xcd7f('0x13')](_0xcd7f('0x19'));}}else{_0x1631e5=require(_0xcd7f('0x1a'))(_0x4134de[_0xcd7f('0xa')]['toLowerCase']());_0x1631e5['error'](_0xcd7f('0x1b'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x4134de[_0xcd7f('0xa')][_0xcd7f('0xb')](),_0x4134de[_0xcd7f('0xf')]));}}else{_0x1631e5=require(_0xcd7f('0x1a'))(_0x4134de[_0xcd7f('0xa')][_0xcd7f('0xb')]());_0x1631e5['error'](_0xcd7f('0x1b'),util[_0xcd7f('0x1c')](_0xcd7f('0x1d'),_0x4134de[_0xcd7f('0xa')][_0xcd7f('0xb')](),_0x4134de['data2']));}}else{}}catch(_0x516ebc){console[_0xcd7f('0x1e')](_0x516ebc);}}}}; \ No newline at end of file +var _0x4198=['zendesk','sugarcrm','freshdesk','zoho','desk','exec','includes','data1','toLowerCase','find','Configurations','data3','routeId','outbound','log','EVENT\x20UNKNOWN','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','./zendesk','./salesforce','./sugarcrm','./desk','./vtiger'];(function(_0x21e71a,_0xf0b818){var _0x174f46=function(_0x2dd53e){while(--_0x2dd53e){_0x21e71a['push'](_0x21e71a['shift']());}};_0x174f46(++_0xf0b818);}(_0x4198,0x174));var _0x8419=function(_0x260355,_0x26146a){_0x260355=_0x260355-0x0;var _0x59ef1c=_0x4198[_0x260355];return _0x59ef1c;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x8419('0x0'));var salesforce=require(_0x8419('0x1'));var sugarcrm=require(_0x8419('0x2'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x8419('0x3'));var vtiger=require(_0x8419('0x4'));var integrations=[_0x8419('0x5'),'salesforce',_0x8419('0x6'),_0x8419('0x7'),_0x8419('0x8'),_0x8419('0x9'),'vtiger'];exports[_0x8419('0xa')]=function(_0x4b9387,_0x356673,_0x5ba02b,_0x535b74,_0x3b42db,_0x756119){if(_0x5ba02b){if(_[_0x8419('0xb')](integrations,_0x4b9387[_0x8419('0xc')][_0x8419('0xd')]())){try{var _0x5ec5f0=null;var _0x2211f8='';var _0x49e8d0=_0x5ba02b[_0x4b9387[_0x8419('0xc')]['toLowerCase']()];if(_0x49e8d0){var _0xa10d8e=_0x49e8d0[_0x4b9387['data2']];if(_0xa10d8e){var _0x49c4e1=_[_0x8419('0xe')](_0xa10d8e[_0x8419('0xf')],{'id':parseInt(_0x4b9387[_0x8419('0x10')],0xa)});if(_0x49c4e1){if(_0x535b74){if(_0x3b42db&&_0x356673['queue']){_0x2211f8='queue';}else if(_0x356673[_0x8419('0x11')]){_0x2211f8=_0x8419('0x12');}else{console[_0x8419('0x13')](_0x8419('0x14'),_0x356673);}}else{_0x2211f8='abandoned';}switch(_0x4b9387['data1'][_0x8419('0xd')]()){case _0x8419('0x5'):zendesk[_0x2211f8](_0x4b9387,_0x356673,_0x49c4e1,_0x535b74,_0x3b42db,_0xa10d8e,_0x756119);break;case'salesforce':salesforce[_0x2211f8](_0x4b9387,_0x356673,_0x49c4e1,_0x535b74,_0x3b42db,_0xa10d8e,_0x756119);break;case'sugarcrm':sugarcrm[_0x2211f8](_0x4b9387,_0x356673,_0x49c4e1,_0x535b74,_0x3b42db,_0xa10d8e,_0x756119);break;case _0x8419('0x7'):freshdesk[_0x2211f8](_0x4b9387,_0x356673,_0x49c4e1,_0x535b74,_0x3b42db,_0xa10d8e,_0x756119);break;case _0x8419('0x8'):zoho[_0x2211f8](_0x4b9387,_0x356673,_0x49c4e1,_0x535b74,_0x3b42db,_0xa10d8e,_0x756119);break;case'desk':desk[_0x2211f8](_0x4b9387,_0x356673,_0x49c4e1,_0x535b74,_0x3b42db,_0xa10d8e,_0x756119);break;case _0x8419('0x15'):vtiger[_0x2211f8](_0x4b9387,_0x356673,_0x49c4e1,_0x535b74,_0x3b42db,_0xa10d8e,_0x756119);break;default:console[_0x8419('0x13')](_0x8419('0x16'));}}else{_0x5ec5f0=require(_0x8419('0x17'))(_0x4b9387[_0x8419('0xc')][_0x8419('0xd')]());_0x5ec5f0[_0x8419('0x18')](_0x8419('0x19'),util[_0x8419('0x1a')](_0x8419('0x1b'),_0x4b9387[_0x8419('0xc')][_0x8419('0xd')](),_0x4b9387[_0x8419('0x10')]));}}else{_0x5ec5f0=require(_0x8419('0x17'))(_0x4b9387['data1']['toLowerCase']());_0x5ec5f0[_0x8419('0x18')](_0x8419('0x19'),util[_0x8419('0x1a')](_0x8419('0x1c'),_0x4b9387['data1'][_0x8419('0xd')](),_0x4b9387['data2']));}}else{}}catch(_0x16ccf6){console[_0x8419('0x18')](_0x16ccf6);}}}}; \ 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 561427d..3d65d02 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 _0x1aaf=['Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','contact','Contact','lead','Lead','Phone','Name','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','queue','serverUrl','monitor_format','uniqueid','recordingURL','email','calleridname','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','[QUEUE]','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','catch','stringify','abandoned','[ABANDONED]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','merge','utc','getString','sobject','Task','create','find','execute','length','Email','info'];(function(_0x328418,_0x22fce4){var _0xe1dbbe=function(_0x50bf9b){while(--_0x50bf9b){_0x328418['push'](_0x328418['shift']());}};_0xe1dbbe(++_0x22fce4);}(_0x1aaf,0xb2));var _0xf1aa=function(_0x39ede6,_0x533f1d){_0x39ede6=_0x39ede6-0x0;var _0x4a68c0=_0x1aaf[_0x39ede6];return _0x4a68c0;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xf1aa('0x0'));var BPromise=require(_0xf1aa('0x1'));var md5=require(_0xf1aa('0x2'));var jsforce=require('jsforce');var util=require(_0xf1aa('0x3'));var Redis=require(_0xf1aa('0x4'));var intUtil=require('./util');var config=require(_0xf1aa('0x5'));var logger=require(_0xf1aa('0x6'))(_0xf1aa('0x7'));config[_0xf1aa('0x8')]=_['defaults'](config[_0xf1aa('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf1aa('0x8')]));function emit(_0x41df2d,_0x5e9290,_0x4982a0){io['to'](_0x41df2d)['emit'](_0x5e9290,_0x4982a0);}function getTicket(_0x299ede,_0x52c0c3,_0x3fc3d2,_0xf942d6,_0x438307,_0x290aed,_0x22a981){var _0x26b214=_[_0xf1aa('0x9')]({'OwnerId':_0x52c0c3['id'],'ActivityDate':moment[_0xf1aa('0xa')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xf1aa('0xb')](_0xf942d6['Subjects'],_0x438307,'\x20'),'Description':intUtil['getString'](_0xf942d6['Descriptions'],_0x438307,'\x0a')},getCustomFields(_0x290aed,_0x438307));if(_0x3fc3d2){_0x26b214['WhoId']=_0x3fc3d2['id'];}return _0x22a981[_0xf1aa('0xc')](_0xf1aa('0xd'))[_0xf1aa('0xe')](_0x26b214);}function getUser(_0x504fbb,_0x495220,_0x2a15bd){var _0x6709c2={'Email':_0x495220};var _0x1df59e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2a15bd[_0xf1aa('0xc')]('User')[_0xf1aa('0xf')](_0x6709c2,_0x1df59e)[_0xf1aa('0x10')]()['then'](function(_0x45f4bb){if(_0x45f4bb[_0xf1aa('0x11')]){var _0x4eb83c=_[_0xf1aa('0xf')](_0x45f4bb,function(_0x16117b){return _0x16117b[_0xf1aa('0x12')]===_0x495220;});if(_0x4eb83c){logger[_0xf1aa('0x13')](_0xf1aa('0x14'),_0x495220);return BPromise['resolve']({'id':_0x4eb83c['Id'],'name':_0x4eb83c['Name']});}}else{logger[_0xf1aa('0x13')](_0xf1aa('0x15'),_0x495220);return _0x2a15bd[_0xf1aa('0x16')]()[_0xf1aa('0x17')](function(_0x3a4351){return BPromise[_0xf1aa('0x18')]({'id':_0x3a4351[_0xf1aa('0x19')],'name':_0x3a4351[_0xf1aa('0x1a')]});});}});}function getEndUser(_0x3fe3aa,_0x46e0ca,_0x39994e,_0x5cb809,_0x2d66ce){var _0x7fbed5={'Phone':_0x5cb809};var _0x5214ea={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf1aa('0x18')]()['then'](function(){logger[_0xf1aa('0x13')](_0xf1aa('0x1b'),_0x5cb809,_0x46e0ca['moduleSearch']);switch(_0x46e0ca[_0xf1aa('0x1c')]){case _0xf1aa('0x1d'):return _0x2d66ce[_0xf1aa('0xc')]('Contact')[_0xf1aa('0xf')](_0x7fbed5,_0x5214ea)[_0xf1aa('0x10')]()[_0xf1aa('0x17')](function(_0x3d9a8b){if(_0x3d9a8b&&_0x3d9a8b[_0xf1aa('0x11')]){return _0x3d9a8b;}else{return _0x2d66ce[_0xf1aa('0xc')]('Lead')[_0xf1aa('0xf')](_0x7fbed5,_0x5214ea);}});case _0xf1aa('0x1e'):return _0x2d66ce[_0xf1aa('0xc')](_0xf1aa('0x1f'))[_0xf1aa('0xf')](_0x7fbed5,_0x5214ea)['execute']();case _0xf1aa('0x20'):return _0x2d66ce[_0xf1aa('0xc')](_0xf1aa('0x21'))[_0xf1aa('0xf')](_0x7fbed5,_0x5214ea);default:return null;}})['then'](function(_0x3c2bfd){if(_0x3c2bfd&&_0x3c2bfd[_0xf1aa('0x11')]){var _0x36bff0=_[_0xf1aa('0xf')](_0x3c2bfd,function(_0x38d3d4){return _0x38d3d4[_0xf1aa('0x22')]===_0x5cb809;});if(_0x36bff0){return BPromise[_0xf1aa('0x18')]({'id':_0x36bff0['Id'],'name':_0x36bff0[_0xf1aa('0x23')],'phone':_0x36bff0[_0xf1aa('0x22')]});}}})[_0xf1aa('0x17')](function(_0x43d26a){if(_0x43d26a){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x5cb809);return BPromise['resolve'](_0x43d26a);}else{logger[_0xf1aa('0x13')](_0xf1aa('0x24'),_0x5cb809);var _0x1ca173={'LastName':_0x39994e!==_0xf1aa('0x25')?_0x39994e:util[_0xf1aa('0x26')]('Caller\x20-\x20%s',_0x5cb809),'Phone':_0x5cb809};if(_0x46e0ca[_0xf1aa('0x27')]){switch(_0x46e0ca[_0xf1aa('0x27')]){case _0xf1aa('0x1e'):logger[_0xf1aa('0x13')](_0xf1aa('0x28'),_0x5cb809,_0x46e0ca[_0xf1aa('0x27')]);break;case'lead':logger[_0xf1aa('0x13')](_0xf1aa('0x28'),_0x5cb809,_0x46e0ca['moduleCreate']);_0x1ca173['Company']=_0xf1aa('0x29');break;default:return null;}}return _0x2d66ce[_0xf1aa('0xc')](_[_0xf1aa('0x2a')](_0x46e0ca[_0xf1aa('0x27')]))[_0xf1aa('0xe')](_0x1ca173);}});}function getCustomFields(_0x15718c,_0x1b8291){var _0x1e0571={};if(_0x15718c[_0xf1aa('0x11')]>0x0){_[_0xf1aa('0x2b')](_0x15718c,function(_0x1d0924){if(_0x1d0924[_0xf1aa('0x2c')]===_0xf1aa('0x2d')&&_0x1d0924[_0xf1aa('0x2e')]){_0x1e0571[_0x1d0924[_0xf1aa('0x2e')]]=_0x1d0924[_0xf1aa('0x2f')][_0xf1aa('0x30')]();}else if(_0x1d0924[_0xf1aa('0x2c')]==='variable'&&_0x1d0924[_0xf1aa('0x31')]&&_0x1d0924[_0xf1aa('0x2e')]){_0x1b8291[_0x1d0924[_0xf1aa('0x31')]]&&(_0x1e0571[_0x1d0924['idField']]=_0x1b8291[_0x1d0924['variableName']][_0xf1aa('0x30')]());}else if(_0x1d0924[_0xf1aa('0x2c')]===_0xf1aa('0x32')&&_0x1d0924['Variable']&&_0x1d0924[_0xf1aa('0x33')][_0xf1aa('0x34')]&&_0x1d0924[_0xf1aa('0x2e')]){_0x1b8291[_0x1d0924['Variable'][_0xf1aa('0x34')]['toLowerCase']()]&&(_0x1e0571[_0x1d0924[_0xf1aa('0x2e')]]=_0x1b8291[_0x1d0924[_0xf1aa('0x33')]['name'][_0xf1aa('0x35')]()]['toString']());}});}return _0x1e0571;}function getConnection(_0x5a1598){var _0x1f8ab3=_0x5a1598[_0xf1aa('0x36')][_0xf1aa('0x37')](_0x5a1598[_0xf1aa('0x38')]);var _0x36c6dc=new jsforce[(_0xf1aa('0x39'))]({'oauth2':{'loginUrl':_0x5a1598[_0xf1aa('0x3a')]||_0xf1aa('0x3b'),'clientId':_0x5a1598[_0xf1aa('0x3c')],'clientSecret':_0x5a1598['clientSecret']}});return _0x36c6dc[_0xf1aa('0x3d')](_0x5a1598[_0xf1aa('0x3e')],_0x1f8ab3)[_0xf1aa('0x17')](function(){logger[_0xf1aa('0x13')]('Connection\x20established.');return _0x36c6dc;});}exports[_0xf1aa('0x3f')]=function(_0x34d36f,_0x3b5c4e,_0x3271fa,_0x3b8c97,_0x1325c1,_0x4e40bf){var _0x5996bd,_0x2a0372,_0x373c24,_0x40afdc;_0x4e40bf['serverUrl']=intUtil['stripTrailingSlash'](_0x4e40bf[_0xf1aa('0x40')]);if(_0x1325c1&&_0x1325c1[_0xf1aa('0x41')]){logger[_0xf1aa('0x13')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b5c4e['recordingURL']=util[_0xf1aa('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e40bf[_0xf1aa('0x40')],_0x3b5c4e[_0xf1aa('0x42')],md5(_0x3b5c4e[_0xf1aa('0x42')]));}else{_0x3b5c4e[_0xf1aa('0x43')]='';}return getConnection(_0x4e40bf)['then'](function(_0x2f9855){_0x40afdc=_0x2f9855;return getUser(_0x4e40bf,_0x3b8c97[_0xf1aa('0x44')],_0x40afdc);})[_0xf1aa('0x17')](function(_0x14eb25){_0x5996bd=_0x14eb25;return getEndUser(_0x4e40bf,_0x3271fa,_0x3b5c4e[_0xf1aa('0x45')],_0x3b5c4e['calleridnum'],_0x40afdc);})['then'](function(_0x4ae09f){_0x2a0372=_0x4ae09f;return getTicket(_0x4e40bf,_0x5996bd,_0x2a0372,_0x3271fa,_0x3b5c4e,_0x3271fa['Fields'],_0x40afdc);})[_0xf1aa('0x17')](function(_0x339403){_0x373c24=_0x339403;logger[_0xf1aa('0x13')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x373c24['id']);logger[_0xf1aa('0x13')](_0xf1aa('0x46'),_0x373c24['id'],_0x3b8c97[_0xf1aa('0x34')],_0x4e40bf[_0xf1aa('0x2c')]);switch(_0x4e40bf['type']){case _0xf1aa('0x47'):emit(util[_0xf1aa('0x26')]('user:%s',_0x3b8c97['name']),_0xf1aa('0x48'),{'recordId':_0x373c24['id']});break;case'newTab':emit(util[_0xf1aa('0x26')](_0xf1aa('0x49'),_0x3b8c97['name']),_0xf1aa('0x4a'),{'uri':util[_0xf1aa('0x26')](_0xf1aa('0x4b'),_0x40afdc[_0xf1aa('0x4c')],_0x373c24['id'])});break;default:logger['error'](_0xf1aa('0x4d'));}})['catch'](function(_0x60a8ef){logger[_0xf1aa('0x4e')](_0xf1aa('0x4f'),JSON['stringify'](_0x60a8ef));});};exports[_0xf1aa('0x50')]=function(_0x2a5e61,_0x46b2f3,_0x3ff35d,_0x5cf0cb,_0x3627c3,_0x553098,_0xc644db){var _0x33541c,_0x458e68,_0x4cee76,_0x32bb23;_0x553098[_0xf1aa('0x40')]=intUtil[_0xf1aa('0x51')](_0x553098['serverUrl']);if(_0xc644db&&_0xc644db[_0xf1aa('0x52')]&&_0xc644db[_0xf1aa('0x52')]!==_0xf1aa('0x53')){logger[_0xf1aa('0x13')](_0xf1aa('0x54'),_0xf1aa('0x55'));_0x46b2f3[_0xf1aa('0x43')]=util[_0xf1aa('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x553098[_0xf1aa('0x40')],_0x46b2f3[_0xf1aa('0x42')],md5(_0x46b2f3[_0xf1aa('0x42')]));}return getConnection(_0x553098)[_0xf1aa('0x17')](function(_0x40581e){_0x32bb23=_0x40581e;return getUser(_0x553098,_0x5cf0cb[_0xf1aa('0x44')],_0x32bb23);})[_0xf1aa('0x17')](function(_0x371e48){_0x33541c=_0x371e48;return getEndUser(_0x553098,_0x3ff35d,_0x46b2f3[_0xf1aa('0x56')],_0x46b2f3['destcalleridnum'],_0x32bb23);})[_0xf1aa('0x17')](function(_0xe6c466){_0x458e68=_0xe6c466;return getTicket(_0x553098,_0x33541c,_0x458e68,_0x3ff35d,_0x46b2f3,_0x3ff35d[_0xf1aa('0x57')],_0x32bb23);})[_0xf1aa('0x17')](function(_0x3ca7a8){_0x4cee76=_0x3ca7a8;logger['info'](_0xf1aa('0x58'),_0x4cee76['id']);logger[_0xf1aa('0x13')](_0xf1aa('0x59'),_0x4cee76['id'],_0x5cf0cb[_0xf1aa('0x34')],_0x553098['type']);switch(_0x553098[_0xf1aa('0x2c')]){case'integrationTab':emit(util[_0xf1aa('0x26')](_0xf1aa('0x49'),_0x5cf0cb[_0xf1aa('0x34')]),'trigger:salesforce:display',{'recordId':_0x4cee76['id']});break;case'newTab':emit(util[_0xf1aa('0x26')](_0xf1aa('0x49'),_0x5cf0cb[_0xf1aa('0x34')]),_0xf1aa('0x4a'),{'uri':util[_0xf1aa('0x26')](_0xf1aa('0x4b'),_0x32bb23[_0xf1aa('0x4c')],_0x4cee76['id'])});break;default:logger[_0xf1aa('0x4e')](_0xf1aa('0x54'),_0xf1aa('0x5a'));}})[_0xf1aa('0x5b')](function(_0x5b8223){logger[_0xf1aa('0x4e')](_0xf1aa('0x54'),JSON[_0xf1aa('0x5c')](_0x5b8223));});};exports[_0xf1aa('0x5d')]=function(_0x25bad6,_0x2b19d3,_0x227741,_0x4a67e8,_0x4c3490,_0x1758b7){var _0x568c5f,_0x29d721,_0x35ae93,_0x568b6f;_0x1758b7[_0xf1aa('0x40')]=intUtil[_0xf1aa('0x51')](_0x1758b7[_0xf1aa('0x40')]);if(_0x4c3490&&_0x4c3490['monitor_format']){logger[_0xf1aa('0x13')](_0xf1aa('0x5e'),_0xf1aa('0x55'));_0x2b19d3[_0xf1aa('0x43')]=util[_0xf1aa('0x26')](_0xf1aa('0x5f'),_0x1758b7[_0xf1aa('0x40')],_0x2b19d3['uniqueid'],md5(_0x2b19d3[_0xf1aa('0x42')]));}else{_0x2b19d3['recordingURL']='';}return getConnection(_0x1758b7)[_0xf1aa('0x17')](function(_0x5cfac2){_0x568b6f=_0x5cfac2;return getUser(_0x1758b7,_0x4a67e8['email'],_0x568b6f);})[_0xf1aa('0x17')](function(_0x570796){_0x568c5f=_0x570796;return getEndUser(_0x1758b7,_0x227741,_0x2b19d3[_0xf1aa('0x45')],_0x2b19d3[_0xf1aa('0x60')],_0x568b6f);})[_0xf1aa('0x17')](function(_0x4baf0c){_0x29d721=_0x4baf0c;return getTicket(_0x1758b7,_0x568c5f,_0x29d721,_0x227741,_0x2b19d3,_0x227741['Fields'],_0x568b6f);})[_0xf1aa('0x17')](function(_0x5d5b9d){_0x35ae93=_0x5d5b9d;logger['info'](_0xf1aa('0x61'),_0x35ae93['id']);logger[_0xf1aa('0x13')](_0xf1aa('0x62'),_0x1758b7[_0xf1aa('0x2c')]);})[_0xf1aa('0x5b')](function(_0x583c46){logger['error'](_0xf1aa('0x5e'),JSON[_0xf1aa('0x5c')](_0x583c46));});}; \ No newline at end of file +var _0xafed=['info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','moduleSearch','contact_lead','Contact','contact','Lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','No\x20Company','upperFirst','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','securityToken','https://login.salesforce.com','clientId','clientSecret','login','username','queue','stripTrailingSlash','monitor_format','[QUEUE]','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','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','instanceUrl','error','catch','stringify','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','trigger:browser:url','%s/%s/e','abandoned','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','[ABANDONED]','lodash','request-promise','moment','md5','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','merge','utc','getString','Subjects','Descriptions','WhoId','sobject','Task','find','execute','length'];(function(_0xdfffd4,_0x4d1714){var _0x1ec649=function(_0x562645){while(--_0x562645){_0xdfffd4['push'](_0xdfffd4['shift']());}};_0x1ec649(++_0x4d1714);}(_0xafed,0x16e));var _0xdafe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafed[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdafe('0x0'));var rp=require(_0xdafe('0x1'));var moment=require(_0xdafe('0x2'));var BPromise=require('bluebird');var md5=require(_0xdafe('0x3'));var jsforce=require(_0xdafe('0x4'));var util=require(_0xdafe('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xdafe('0x6'));var logger=require(_0xdafe('0x7'))(_0xdafe('0x8'));config['redis']=_['defaults'](config[_0xdafe('0x9')],{'host':_0xdafe('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdafe('0x9')]));function emit(_0x2656cf,_0x4f40e8,_0x7875f0){io['to'](_0x2656cf)['emit'](_0x4f40e8,_0x7875f0);}function getTicket(_0x53be0c,_0x41fa55,_0x119a27,_0x23e786,_0x3f1ff1,_0x24c4bf,_0x27016e){var _0x559d1e=_[_0xdafe('0xb')]({'OwnerId':_0x41fa55['id'],'ActivityDate':moment[_0xdafe('0xc')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xdafe('0xd')](_0x23e786[_0xdafe('0xe')],_0x3f1ff1,'\x20'),'Description':intUtil[_0xdafe('0xd')](_0x23e786[_0xdafe('0xf')],_0x3f1ff1,'\x0a')},getCustomFields(_0x24c4bf,_0x3f1ff1));if(_0x119a27){_0x559d1e[_0xdafe('0x10')]=_0x119a27['id'];}return _0x27016e[_0xdafe('0x11')](_0xdafe('0x12'))['create'](_0x559d1e);}function getUser(_0x44415a,_0x49e253,_0x52bb31){var _0x172c25={'Email':_0x49e253};var _0x2bc6a2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x52bb31[_0xdafe('0x11')]('User')[_0xdafe('0x13')](_0x172c25,_0x2bc6a2)[_0xdafe('0x14')]()['then'](function(_0x357fc5){if(_0x357fc5[_0xdafe('0x15')]){var _0x4ed6de=_[_0xdafe('0x13')](_0x357fc5,function(_0x249a8c){return _0x249a8c['Email']===_0x49e253;});if(_0x4ed6de){logger[_0xdafe('0x16')](_0xdafe('0x17'),_0x49e253);return BPromise['resolve']({'id':_0x4ed6de['Id'],'name':_0x4ed6de[_0xdafe('0x18')]});}}else{logger[_0xdafe('0x16')](_0xdafe('0x19'),_0x49e253);return _0x52bb31[_0xdafe('0x1a')]()[_0xdafe('0x1b')](function(_0x268102){return BPromise[_0xdafe('0x1c')]({'id':_0x268102[_0xdafe('0x1d')],'name':_0x268102['display_name']});});}});}function getEndUser(_0x1ebeb1,_0x3b2678,_0x59fd1f,_0x22c572,_0x1f8de7){var _0x2e3bde={'Phone':_0x22c572};var _0x339c9e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xdafe('0x1c')]()[_0xdafe('0x1b')](function(){logger[_0xdafe('0x16')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x22c572,_0x3b2678[_0xdafe('0x1e')]);switch(_0x3b2678[_0xdafe('0x1e')]){case _0xdafe('0x1f'):return _0x1f8de7[_0xdafe('0x11')](_0xdafe('0x20'))[_0xdafe('0x13')](_0x2e3bde,_0x339c9e)[_0xdafe('0x14')]()[_0xdafe('0x1b')](function(_0x21089e){if(_0x21089e&&_0x21089e[_0xdafe('0x15')]){return _0x21089e;}else{return _0x1f8de7[_0xdafe('0x11')]('Lead')[_0xdafe('0x13')](_0x2e3bde,_0x339c9e);}});case _0xdafe('0x21'):return _0x1f8de7[_0xdafe('0x11')](_0xdafe('0x20'))[_0xdafe('0x13')](_0x2e3bde,_0x339c9e)['execute']();case'lead':return _0x1f8de7[_0xdafe('0x11')](_0xdafe('0x22'))[_0xdafe('0x13')](_0x2e3bde,_0x339c9e);default:return null;}})[_0xdafe('0x1b')](function(_0x33dbd5){if(_0x33dbd5&&_0x33dbd5['length']){var _0x7c900a=_[_0xdafe('0x13')](_0x33dbd5,function(_0x41723d){return _0x41723d[_0xdafe('0x23')]===_0x22c572;});if(_0x7c900a){return BPromise[_0xdafe('0x1c')]({'id':_0x7c900a['Id'],'name':_0x7c900a[_0xdafe('0x18')],'phone':_0x7c900a[_0xdafe('0x23')]});}}})[_0xdafe('0x1b')](function(_0x3d5a15){if(_0x3d5a15){logger[_0xdafe('0x16')](_0xdafe('0x24'),_0x22c572);return BPromise[_0xdafe('0x1c')](_0x3d5a15);}else{logger[_0xdafe('0x16')](_0xdafe('0x25'),_0x22c572);var _0x1be0a1={'LastName':_0x59fd1f!==_0xdafe('0x26')?_0x59fd1f:util['format']('Caller\x20-\x20%s',_0x22c572),'Phone':_0x22c572};if(_0x3b2678[_0xdafe('0x27')]){switch(_0x3b2678[_0xdafe('0x27')]){case'contact':logger[_0xdafe('0x16')](_0xdafe('0x28'),_0x22c572,_0x3b2678['moduleCreate']);break;case _0xdafe('0x29'):logger['info'](_0xdafe('0x28'),_0x22c572,_0x3b2678[_0xdafe('0x27')]);_0x1be0a1['Company']=_0xdafe('0x2a');break;default:return null;}}return _0x1f8de7[_0xdafe('0x11')](_[_0xdafe('0x2b')](_0x3b2678[_0xdafe('0x27')]))['create'](_0x1be0a1);}});}function getCustomFields(_0x178f8a,_0x40017b){var _0x2d24b9={};if(_0x178f8a[_0xdafe('0x15')]>0x0){_[_0xdafe('0x2c')](_0x178f8a,function(_0x3fd481){if(_0x3fd481[_0xdafe('0x2d')]==='string'&&_0x3fd481[_0xdafe('0x2e')]){_0x2d24b9[_0x3fd481[_0xdafe('0x2e')]]=_0x3fd481[_0xdafe('0x2f')][_0xdafe('0x30')]();}else if(_0x3fd481[_0xdafe('0x2d')]===_0xdafe('0x31')&&_0x3fd481[_0xdafe('0x32')]&&_0x3fd481[_0xdafe('0x2e')]){_0x40017b[_0x3fd481[_0xdafe('0x32')]]&&(_0x2d24b9[_0x3fd481[_0xdafe('0x2e')]]=_0x40017b[_0x3fd481[_0xdafe('0x32')]][_0xdafe('0x30')]());}else if(_0x3fd481[_0xdafe('0x2d')]===_0xdafe('0x33')&&_0x3fd481[_0xdafe('0x34')]&&_0x3fd481['Variable'][_0xdafe('0x35')]&&_0x3fd481[_0xdafe('0x2e')]){_0x40017b[_0x3fd481['Variable'][_0xdafe('0x35')][_0xdafe('0x36')]()]&&(_0x2d24b9[_0x3fd481['idField']]=_0x40017b[_0x3fd481[_0xdafe('0x34')][_0xdafe('0x35')][_0xdafe('0x36')]()]['toString']());}});}return _0x2d24b9;}function getConnection(_0x1b28dc){var _0x235a3d=_0x1b28dc[_0xdafe('0x37')]['concat'](_0x1b28dc[_0xdafe('0x38')]);var _0x5495c2=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1b28dc['remoteUri']||_0xdafe('0x39'),'clientId':_0x1b28dc[_0xdafe('0x3a')],'clientSecret':_0x1b28dc[_0xdafe('0x3b')]}});return _0x5495c2[_0xdafe('0x3c')](_0x1b28dc[_0xdafe('0x3d')],_0x235a3d)[_0xdafe('0x1b')](function(){logger['info']('Connection\x20established.');return _0x5495c2;});}exports[_0xdafe('0x3e')]=function(_0xee5c78,_0x546673,_0x5675ea,_0xa2eadd,_0x585e10,_0x12e506){var _0x55d5f7,_0x25dff8,_0x857345,_0x186783;_0x12e506['serverUrl']=intUtil[_0xdafe('0x3f')](_0x12e506['serverUrl']);if(_0x585e10&&_0x585e10[_0xdafe('0x40')]){logger[_0xdafe('0x16')](_0xdafe('0x41'),'Recording\x20is\x20enabled!');_0x546673['recordingURL']=util[_0xdafe('0x42')](_0xdafe('0x43'),_0x12e506[_0xdafe('0x44')],_0x546673['uniqueid'],md5(_0x546673[_0xdafe('0x45')]));}else{_0x546673[_0xdafe('0x46')]='';}return getConnection(_0x12e506)[_0xdafe('0x1b')](function(_0xed4dd5){_0x186783=_0xed4dd5;return getUser(_0x12e506,_0xa2eadd[_0xdafe('0x47')],_0x186783);})[_0xdafe('0x1b')](function(_0x30550d){_0x55d5f7=_0x30550d;return getEndUser(_0x12e506,_0x5675ea,_0x546673[_0xdafe('0x48')],_0x546673[_0xdafe('0x49')],_0x186783);})[_0xdafe('0x1b')](function(_0x41d021){_0x25dff8=_0x41d021;return getTicket(_0x12e506,_0x55d5f7,_0x25dff8,_0x5675ea,_0x546673,_0x5675ea[_0xdafe('0x4a')],_0x186783);})[_0xdafe('0x1b')](function(_0x4c3972){_0x857345=_0x4c3972;logger[_0xdafe('0x16')](_0xdafe('0x4b'),_0x857345['id']);logger['info'](_0xdafe('0x4c'),_0x857345['id'],_0xa2eadd['name'],_0x12e506['type']);switch(_0x12e506['type']){case _0xdafe('0x4d'):emit(util[_0xdafe('0x42')](_0xdafe('0x4e'),_0xa2eadd[_0xdafe('0x35')]),'trigger:salesforce:display',{'recordId':_0x857345['id']});break;case _0xdafe('0x4f'):emit(util[_0xdafe('0x42')](_0xdafe('0x4e'),_0xa2eadd[_0xdafe('0x35')]),'trigger:browser:url',{'uri':util[_0xdafe('0x42')]('%s/%s/e',_0x186783[_0xdafe('0x50')],_0x857345['id'])});break;default:logger[_0xdafe('0x51')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xdafe('0x52')](function(_0x1d9250){logger['error']('[QUEUE]',JSON[_0xdafe('0x53')](_0x1d9250));});};exports[_0xdafe('0x54')]=function(_0x3b2a4d,_0x4b83a4,_0x1ee721,_0x3b6211,_0x500072,_0x1129cf,_0x589a4e){var _0x160e74,_0x24bf2d,_0xfa2fb7,_0x3d20a6;_0x1129cf[_0xdafe('0x44')]=intUtil[_0xdafe('0x3f')](_0x1129cf['serverUrl']);if(_0x589a4e&&_0x589a4e[_0xdafe('0x55')]&&_0x589a4e[_0xdafe('0x55')]!=='none'){logger[_0xdafe('0x16')](_0xdafe('0x56'),_0xdafe('0x57'));_0x4b83a4[_0xdafe('0x46')]=util[_0xdafe('0x42')](_0xdafe('0x43'),_0x1129cf[_0xdafe('0x44')],_0x4b83a4[_0xdafe('0x45')],md5(_0x4b83a4[_0xdafe('0x45')]));}return getConnection(_0x1129cf)[_0xdafe('0x1b')](function(_0xcf18aa){_0x3d20a6=_0xcf18aa;return getUser(_0x1129cf,_0x3b6211[_0xdafe('0x47')],_0x3d20a6);})['then'](function(_0x5c3444){_0x160e74=_0x5c3444;return getEndUser(_0x1129cf,_0x1ee721,_0x4b83a4[_0xdafe('0x58')],_0x4b83a4[_0xdafe('0x59')],_0x3d20a6);})[_0xdafe('0x1b')](function(_0x43b418){_0x24bf2d=_0x43b418;return getTicket(_0x1129cf,_0x160e74,_0x24bf2d,_0x1ee721,_0x4b83a4,_0x1ee721[_0xdafe('0x4a')],_0x3d20a6);})['then'](function(_0x4f1b35){_0xfa2fb7=_0x4f1b35;logger[_0xdafe('0x16')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xfa2fb7['id']);logger[_0xdafe('0x16')](_0xdafe('0x5a'),_0xfa2fb7['id'],_0x3b6211[_0xdafe('0x35')],_0x1129cf['type']);switch(_0x1129cf['type']){case _0xdafe('0x4d'):emit(util['format']('user:%s',_0x3b6211[_0xdafe('0x35')]),_0xdafe('0x5b'),{'recordId':_0xfa2fb7['id']});break;case _0xdafe('0x4f'):emit(util[_0xdafe('0x42')]('user:%s',_0x3b6211[_0xdafe('0x35')]),_0xdafe('0x5c'),{'uri':util['format'](_0xdafe('0x5d'),_0x3d20a6[_0xdafe('0x50')],_0xfa2fb7['id'])});break;default:logger[_0xdafe('0x51')](_0xdafe('0x56'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xdafe('0x52')](function(_0x5a679b){logger[_0xdafe('0x51')](_0xdafe('0x56'),JSON[_0xdafe('0x53')](_0x5a679b));});};exports[_0xdafe('0x5e')]=function(_0x3e2021,_0x57adb5,_0x6e4e47,_0x13a571,_0x219ad0,_0x1087fc){var _0x3001fc,_0x2ca5b5,_0x155f5a,_0x690da0;_0x1087fc[_0xdafe('0x44')]=intUtil[_0xdafe('0x3f')](_0x1087fc[_0xdafe('0x44')]);if(_0x219ad0&&_0x219ad0[_0xdafe('0x40')]){logger[_0xdafe('0x16')]('[ABANDONED]',_0xdafe('0x57'));_0x57adb5['recordingURL']=util['format'](_0xdafe('0x43'),_0x1087fc['serverUrl'],_0x57adb5[_0xdafe('0x45')],md5(_0x57adb5['uniqueid']));}else{_0x57adb5[_0xdafe('0x46')]='';}return getConnection(_0x1087fc)['then'](function(_0x5e2016){_0x690da0=_0x5e2016;return getUser(_0x1087fc,_0x13a571[_0xdafe('0x47')],_0x690da0);})[_0xdafe('0x1b')](function(_0x159224){_0x3001fc=_0x159224;return getEndUser(_0x1087fc,_0x6e4e47,_0x57adb5[_0xdafe('0x48')],_0x57adb5[_0xdafe('0x49')],_0x690da0);})['then'](function(_0x225f8e){_0x2ca5b5=_0x225f8e;return getTicket(_0x1087fc,_0x3001fc,_0x2ca5b5,_0x6e4e47,_0x57adb5,_0x6e4e47[_0xdafe('0x4a')],_0x690da0);})[_0xdafe('0x1b')](function(_0x7ed954){_0x155f5a=_0x7ed954;logger['info']('[ABANDONED]\x20Ticket\x20%s\x20created.',_0x155f5a['id']);logger[_0xdafe('0x16')](_0xdafe('0x5f'),_0x1087fc[_0xdafe('0x2d')]);})['catch'](function(_0x32b7dc){logger[_0xdafe('0x51')](_0xdafe('0x60'),JSON['stringify'](_0x32b7dc));});}; \ 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 8cc4c4e..ba816b1 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 _0x5162=['uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','[OUTBOUND]','The\x20Ticket\x20ID\x20is:','abandoned','[ABANDONED]','calleridnum','lodash','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','POST','emit','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','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!','first_name','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','toLowerCase','content','idField','custom_fields','variable','customField','variableName','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','remoteUri','stripTrailingSlash'];(function(_0x3286f7,_0x4839a3){var _0x43854a=function(_0x381f90){while(--_0x381f90){_0x3286f7['push'](_0x3286f7['shift']());}};_0x43854a(++_0x4839a3);}(_0x5162,0x103));var _0x2516=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0x5162[_0x319e2e];return _0x302524;};'use strict';var _=require(_0x2516('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x2516('0x1'));var intUtil=require(_0x2516('0x2'));var config=require(_0x2516('0x3'));var logger=require(_0x2516('0x4'))(_0x2516('0x5'));config[_0x2516('0x6')]=_[_0x2516('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2516('0x6')]));var def={'method':_0x2516('0x8'),'json':!![]};function emit(_0xa1557,_0x3a8834,_0x3abc5d){io['to'](_0xa1557)[_0x2516('0x9')](_0x3a8834,_0x3abc5d);}function getTicket(_0x1cb817,_0x590875,_0x409550,_0x3f7e71,_0x18bfd3,_0x5dda21,_0x530b1b){logger['info']('Creating\x20new\x20ticket...');var _0xf83a79=new Date();var _0x3c7762=[{'name':_0x2516('0xa'),'value':intUtil[_0x2516('0xb')](_0x3f7e71['Subjects'],_0x18bfd3,'\x20')},{'name':_0x2516('0xc'),'value':_0x590875['id']},{'name':_0x2516('0xd'),'value':_0x590875['id']},{'name':_0x2516('0xe'),'value':intUtil[_0x2516('0xb')](_0x3f7e71[_0x2516('0xf')],_0x18bfd3,'\x0a')},{'name':_0x2516('0x10'),'value':_0xf83a79[_0x2516('0x11')]()[_0x2516('0x12')](0x0,0x13)[_0x2516('0x13')]('T','\x20')},{'name':_0x2516('0x14'),'value':'0'},{'name':_0x2516('0x15'),'value':'15'},{'name':_0x2516('0x16'),'value':_0x409550['id']},{'name':_0x2516('0x17'),'value':_0x2516('0x18')},{'name':_0x2516('0x19'),'value':_0x409550['name']}];if(_0x5dda21[_0x2516('0x1a')]){_[_0x2516('0x1b')](_0x5dda21,function(_0x1a1005){if(_0x18bfd3[_0x1a1005['variableName']]){_0x3c7762[_0x2516('0x1c')]({'name':_0x1a1005['idField'],'value':_0x18bfd3[_0x1a1005['variableName']]});}});}return request({'form':{'method':_0x2516('0x1d'),'input_type':_0x2516('0x1e'),'response_type':_0x2516('0x1e'),'rest_data':JSON[_0x2516('0x1f')]({'session':_0x530b1b['id'],'module_name':_0x2516('0x20'),'name_value_list':_0x3c7762})}});}function getAuth(_0x42ba50){return util[_0x2516('0x21')](_0x2516('0x22'),new Buffer(_0x42ba50[_0x2516('0x23')]+':X')[_0x2516('0x24')](_0x2516('0x25')));}function getServerInfo(_0x11e78b){return request({'form':{'method':_0x2516('0x26'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x2516('0x1f')]({'session':_0x11e78b['id']})}});}function getUser(_0x1c8993,_0x24abe0,_0x2d5b1b){logger[_0x2516('0x27')](_0x2516('0x28'),_0x24abe0);return request({'form':{'method':_0x2516('0x29'),'input_type':_0x2516('0x1e'),'response_type':'JSON','rest_data':JSON[_0x2516('0x1f')]({'session':_0x2d5b1b['id'],'module_name':_0x2516('0x2a'),'query':util[_0x2516('0x21')](_0x2516('0x2b'),_0x24abe0),'order_by':'','offset':'0','select_fields':['id','name',_0x2516('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2516('0x2d')](function(_0x1f722c){if(_0x1f722c[_0x2516('0x2e')][_0x2516('0x1a')]){var _0x4a3dc8=_[_0x2516('0x2f')](_0x1f722c[_0x2516('0x2e')],function(_0x935035){return _0x935035[_0x2516('0x30')][_0x2516('0x2c')][_0x2516('0x31')]===_0x24abe0;});if(_0x4a3dc8){logger['info'](_0x2516('0x32'));return BPromise[_0x2516('0x33')]({'id':_0x4a3dc8['name_value_list']['id'][_0x2516('0x31')],'name':_0x4a3dc8[_0x2516('0x30')][_0x2516('0xa')][_0x2516('0x31')]});}}else{logger[_0x2516('0x27')](_0x2516('0x34'));return BPromise[_0x2516('0x33')]({'id':_0x2d5b1b[_0x2516('0x30')][_0x2516('0x35')]['id'],'name':_0x2d5b1b[_0x2516('0x30')][_0x2516('0x2c')]['id']});}});}function getEndUser(_0x2978b2,_0x2a5346,_0x20f6bf,_0xe29221){logger['info'](_0x2516('0x36'),_0x20f6bf);return request({'form':{'method':'get_entry_list','input_type':_0x2516('0x1e'),'response_type':'JSON','rest_data':JSON[_0x2516('0x1f')]({'session':_0xe29221['id'],'module_name':'Contacts','query':util[_0x2516('0x21')](_0x2516('0x37'),_0x20f6bf),'order_by':'','offset':'0','select_fields':['id',_0x2516('0xa'),_0x2516('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2516('0x2d')](function(_0x3947e7){if(_0x3947e7[_0x2516('0x2e')][_0x2516('0x1a')]){var _0x1ad634=_['find'](_0x3947e7[_0x2516('0x2e')],function(_0x4578c7){return _0x4578c7[_0x2516('0x30')][_0x2516('0x38')]['value']===_0x20f6bf;});if(_0x1ad634){logger['info'](_0x2516('0x39'));return BPromise[_0x2516('0x33')]({'id':_0x1ad634[_0x2516('0x30')]['id'][_0x2516('0x31')],'name':_0x1ad634[_0x2516('0x30')][_0x2516('0xa')][_0x2516('0x31')],'phone':_0x1ad634[_0x2516('0x30')][_0x2516('0x38')][_0x2516('0x31')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x2516('0x1d'),'input_type':_0x2516('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xe29221['id'],'module_name':_0x2516('0x18'),'name_value_list':[{'name':_0x2516('0x3a'),'value':_0x2a5346!==''?_0x2a5346:util[_0x2516('0x21')]('Caller\x20-\x20%s',_0x20f6bf)},{'name':_0x2516('0x38'),'value':_0x20f6bf}]})}})[_0x2516('0x2d')](function(_0x550ca5){logger[_0x2516('0x27')](_0x2516('0x3b'));return BPromise[_0x2516('0x33')]({'id':_0x550ca5['id'],'name':_0x550ca5[_0x2516('0x2e')][_0x2516('0x3a')][_0x2516('0x31')],'phone':_0x550ca5[_0x2516('0x2e')][_0x2516('0x38')][_0x2516('0x31')]});});}});}function request(_0xc1c0fb){logger[_0x2516('0x3c')](_0x2516('0x3d'),JSON[_0x2516('0x1f')](_0xc1c0fb));return rp(_['merge'](def,_0xc1c0fb));}function getTags(_0x1b72cd,_0x1bc0e){var _0x5debf2=[];if(_0x1b72cd&&_0x1b72cd[_0x2516('0x1a')]>0x0){_0x5debf2=_[_0x2516('0x3e')](_0x1b72cd,_0x1bc0e);}return _0x5debf2;}function getCustomFields(_0x2eadc7,_0x1afefb){var _0x421c58=[];var _0x582cb6={'custom_fields':[]};if(_0x2eadc7[_0x2516('0x1a')]>0x0){_[_0x2516('0x1b')](_0x2eadc7,function(_0x160801){if(_0x160801[_0x2516('0x3f')]===_0x2516('0x40')&&_0x160801[_0x2516('0x41')]&&!_0x160801['customField']){_0x582cb6[_0x160801[_0x2516('0x41')][_0x2516('0x42')]()]=_0x160801[_0x2516('0x43')][_0x2516('0x24')]();}else if(_0x160801[_0x2516('0x3f')]===_0x2516('0x40')&&_0x160801[_0x2516('0x44')]&&_0x160801['customField']){_0x582cb6[_0x2516('0x45')]['push']({'id':_0x160801[_0x2516('0x44')],'value':_0x160801['content'][_0x2516('0x24')]()});}else if(_0x160801[_0x2516('0x3f')]===_0x2516('0x46')&&_0x160801['variableName']&&_0x160801['idField']&&_0x160801[_0x2516('0x47')]){_0x1afefb[_0x160801[_0x2516('0x48')]]&&_0x582cb6['custom_fields']['push']({'id':_0x160801[_0x2516('0x44')],'value':_0x1afefb[_0x160801[_0x2516('0x48')]][_0x2516('0x24')]()});}else if(_0x160801['type']===_0x2516('0x49')&&_0x160801['Variable']&&_0x160801[_0x2516('0x4a')][_0x2516('0xa')]&&_0x160801[_0x2516('0x44')]&&_0x160801[_0x2516('0x47')]){_0x1afefb[_0x160801['Variable'][_0x2516('0xa')][_0x2516('0x42')]()]&&_0x582cb6[_0x2516('0x45')][_0x2516('0x1c')]({'id':_0x160801[_0x2516('0x44')],'value':_0x1afefb[_0x160801['Variable'][_0x2516('0xa')][_0x2516('0x42')]()][_0x2516('0x24')]()});}});}return _0x582cb6;}function getConnection(_0x2e359e){return request({'method':'POST','form':{'method':_0x2516('0x4b'),'input_type':_0x2516('0x1e'),'response_type':_0x2516('0x1e'),'rest_data':JSON[_0x2516('0x1f')]({'user_auth':{'user_name':_0x2e359e[_0x2516('0x4c')],'password':_0x2e359e['password'],'encryption':_0x2516('0x4d')},'application':_0x2516('0x4e')})}})[_0x2516('0x2d')](function(_0x2810e8){var _0x1ebe64=_0x2810e8;if(_0x1ebe64['id']){def[_0x2516('0x4f')]=_0x1ebe64['id'];return BPromise['resolve'](_0x1ebe64);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x2e359e['id']));}});}function setRelationship(_0x323590,_0x4f7eb4,_0x5459b2,_0x499540){return request({'form':{'method':_0x2516('0x50'),'input_type':_0x2516('0x1e'),'response_type':_0x2516('0x1e'),'rest_data':JSON[_0x2516('0x1f')]({'session':_0x323590['id'],'module_name':_0x2516('0x20'),'module_id':_0x5459b2['id'],'link_field_name':_0x499540,'related_ids':[_0x4f7eb4['id']]})}});}exports['queue']=function(_0x1c1e14,_0x32b432,_0x249ef8,_0x4f75cd,_0x173fb2,_0x350206){var _0x4a7db6,_0x1b5411,_0x3789cf,_0x458e56;_0x350206[_0x2516('0x51')]=intUtil[_0x2516('0x52')](_0x350206['remoteUri']);_0x350206['serverUrl']=intUtil[_0x2516('0x52')](_0x350206['serverUrl']);def[_0x2516('0x53')]=util['format'](_0x2516('0x54'),_0x350206[_0x2516('0x51')]);if(_0x173fb2&&_0x173fb2[_0x2516('0x55')]){logger[_0x2516('0x27')](_0x2516('0x56'),_0x2516('0x57'));_0x32b432[_0x2516('0x58')]=util[_0x2516('0x21')](_0x2516('0x59'),_0x350206[_0x2516('0x5a')],_0x32b432[_0x2516('0x5b')],md5(_0x32b432['uniqueid']));}else{_0x32b432[_0x2516('0x58')]='';}return getConnection(_0x350206)[_0x2516('0x2d')](function(_0x3adc8c){_0x458e56=_0x3adc8c;return getUser(_0x350206,_0x4f75cd['name'],_0x458e56);})[_0x2516('0x2d')](function(_0x58eff3){_0x4a7db6=_0x58eff3;logger[_0x2516('0x27')](_0x2516('0x5c'),_0x4a7db6['id']);return getEndUser(_0x350206,_0x32b432[_0x2516('0x5d')],_0x32b432['calleridnum'],_0x458e56);})['then'](function(_0x5a51c6){_0x1b5411=_0x5a51c6;logger[_0x2516('0x27')](_0x2516('0x5e'),_0x1b5411['id']);return getTicket(_0x350206,_0x4a7db6,_0x1b5411,_0x249ef8,_0x32b432,_0x249ef8[_0x2516('0x5f')],_0x458e56);})[_0x2516('0x2d')](function(_0x4ee11d){_0x3789cf=_0x4ee11d;logger[_0x2516('0x27')](_0x2516('0x60'));logger[_0x2516('0x27')]('The\x20Ticket\x20ID\x20is:',_0x3789cf['id']);return setRelationship(_0x458e56,_0x4a7db6,_0x3789cf,_0x2516('0x61'));})[_0x2516('0x2d')](function(){return setRelationship(_0x458e56,_0x1b5411,_0x3789cf,_0x2516('0x62'));})[_0x2516('0x2d')](function(){return getServerInfo(_0x458e56);})[_0x2516('0x2d')](function(_0x29cf37){var _0x26b897=parseInt(_0x29cf37[_0x2516('0x63')][_0x2516('0x64')](0x0));var _0x1c2217=util[_0x2516('0x21')](_0x2516('0x65'),_0x350206[_0x2516('0x51')],_0x3789cf['id']);if(_0x26b897>0x6){_0x1c2217=util['format'](_0x2516('0x66'),_0x350206[_0x2516('0x51')],_0x3789cf['id']);}logger[_0x2516('0x27')](_0x2516('0x56'),_0x2516('0x67'));emit(util[_0x2516('0x21')](_0x2516('0x68'),_0x4f75cd['name']),_0x2516('0x69'),{'uri':_0x1c2217});})[_0x2516('0x6a')](function(_0x2ee658){logger[_0x2516('0x6b')](_0x2516('0x56'),JSON[_0x2516('0x1f')](_0x2ee658));});};exports['outbound']=function(_0x53b427,_0x565332,_0x331d78,_0x3c69f5,_0x3f188d,_0x2cc379,_0x58730b){var _0x51473f,_0x2a154a,_0x56645a,_0x1c0540;_0x2cc379[_0x2516('0x51')]=intUtil['stripTrailingSlash'](_0x2cc379[_0x2516('0x51')]);_0x2cc379[_0x2516('0x5a')]=intUtil[_0x2516('0x52')](_0x2cc379[_0x2516('0x5a')]);def[_0x2516('0x53')]=util[_0x2516('0x21')](_0x2516('0x54'),_0x2cc379[_0x2516('0x51')]);if(_0x58730b&&_0x58730b[_0x2516('0x6c')]&&_0x58730b['recordingFormat']!=='none'){logger[_0x2516('0x27')](_0x2516('0x6d'),_0x2516('0x57'));_0x565332['recordingURL']=util[_0x2516('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2cc379[_0x2516('0x5a')],_0x565332[_0x2516('0x5b')],md5(_0x565332[_0x2516('0x5b')]));}return getConnection(_0x2cc379)[_0x2516('0x2d')](function(_0xfa4038){_0x1c0540=_0xfa4038;return getUser(_0x2cc379,_0x3c69f5[_0x2516('0xa')],_0x1c0540);})[_0x2516('0x2d')](function(_0x3379f8){_0x51473f=_0x3379f8;logger[_0x2516('0x27')](_0x2516('0x5c'),_0x51473f['id']);return getEndUser(_0x2cc379,_0x565332['destcalleridname'],_0x565332['destcalleridnum'],_0x1c0540);})[_0x2516('0x2d')](function(_0x598f4a){_0x2a154a=_0x598f4a;logger['info'](_0x2516('0x5e'),_0x2a154a['id']);return getTicket(_0x2cc379,_0x51473f,_0x2a154a,_0x331d78,_0x565332,_0x331d78[_0x2516('0x5f')],_0x1c0540);})[_0x2516('0x2d')](function(_0xa4eeae){_0x56645a=_0xa4eeae;logger[_0x2516('0x27')](_0x2516('0x60'));logger[_0x2516('0x27')](_0x2516('0x6e'),_0x56645a['id']);return setRelationship(_0x1c0540,_0x51473f,_0x56645a,_0x2516('0x61'));})['then'](function(){return setRelationship(_0x1c0540,_0x2a154a,_0x56645a,_0x2516('0x62'));})[_0x2516('0x2d')](function(){return getServerInfo(_0x1c0540);})[_0x2516('0x2d')](function(_0x55aac6){var _0x5dca12=parseInt(_0x55aac6[_0x2516('0x63')][_0x2516('0x64')](0x0));var _0x737c82=util[_0x2516('0x21')](_0x2516('0x65'),_0x2cc379[_0x2516('0x51')],_0x56645a['id']);if(_0x5dca12>0x6){_0x737c82=util['format'](_0x2516('0x66'),_0x2cc379['remoteUri'],_0x56645a['id']);}logger['info'](_0x2516('0x6d'),_0x2516('0x67'));emit(util[_0x2516('0x21')]('user:%s',_0x3c69f5[_0x2516('0xa')]),_0x2516('0x69'),{'uri':_0x737c82});})[_0x2516('0x6a')](function(_0x3feef2){logger['error'](_0x2516('0x6d'),JSON[_0x2516('0x1f')](_0x3feef2));});};exports[_0x2516('0x6f')]=function(_0x1d1983,_0x485c77,_0x42d604,_0x112984,_0x5b7252,_0x55ac5f){var _0x2397ba,_0x505a65,_0x293e40,_0x437a04;_0x55ac5f[_0x2516('0x51')]=intUtil[_0x2516('0x52')](_0x55ac5f[_0x2516('0x51')]);_0x55ac5f['serverUrl']=intUtil['stripTrailingSlash'](_0x55ac5f['serverUrl']);def[_0x2516('0x53')]=util[_0x2516('0x21')]('%s/service/v4_1/rest.php',_0x55ac5f[_0x2516('0x51')]);if(_0x5b7252&&_0x5b7252[_0x2516('0x55')]){logger[_0x2516('0x27')](_0x2516('0x70'),_0x2516('0x57'));_0x485c77[_0x2516('0x58')]=util['format'](_0x2516('0x59'),_0x55ac5f[_0x2516('0x5a')],_0x485c77[_0x2516('0x5b')],md5(_0x485c77['uniqueid']));}else{_0x485c77['recordingURL']='';}return getConnection(_0x55ac5f)['then'](function(_0x50dd15){_0x437a04=_0x50dd15;return getUser(_0x55ac5f,_0x112984[_0x2516('0xa')],_0x437a04);})[_0x2516('0x2d')](function(_0x1fee50){_0x2397ba=_0x1fee50;logger['info']('The\x20User\x20ID\x20is:',_0x2397ba['id']);return getEndUser(_0x55ac5f,_0x485c77['calleridname'],_0x485c77[_0x2516('0x71')],_0x437a04);})[_0x2516('0x2d')](function(_0x379aa8){_0x505a65=_0x379aa8;logger[_0x2516('0x27')](_0x2516('0x5e'),_0x505a65['id']);return getTicket(_0x55ac5f,_0x2397ba,_0x505a65,_0x42d604,_0x485c77,_0x42d604[_0x2516('0x5f')],_0x437a04);})[_0x2516('0x2d')](function(_0x6b0739){_0x293e40=_0x6b0739;logger['info'](_0x2516('0x60'));logger[_0x2516('0x27')](_0x2516('0x6e'),_0x293e40['id']);return setRelationship(_0x437a04,_0x2397ba,_0x293e40,_0x2516('0x61'));})[_0x2516('0x2d')](function(){return setRelationship(_0x437a04,_0x505a65,_0x293e40,'contacts');})[_0x2516('0x2d')](function(){return getServerInfo(_0x437a04);})[_0x2516('0x6a')](function(_0x55f462){logger[_0x2516('0x6b')](_0x2516('0x70'),JSON[_0x2516('0x1f')](_0x55f462));});}; \ No newline at end of file +var _0x77d4=['nameField','customField','toLowerCase','type','string','custom_fields','content','variable','customVariable','Variable','POST','login','username','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','destcalleridnum','abandoned','[ABANDONED]','calleridnum','Ticket\x20created!','request-promise','md5','ioredis','./util','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','getString','Descriptions','slice','duration_hours','duration_minutes','parent_id','Contacts','parent_name','length','push','idField','variableName','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','get_entry_list','Employees','user_name','then','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','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','forEach'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x77d4,0x108));var _0x477d=function(_0x1fd2f6,_0x56214a){_0x1fd2f6=_0x1fd2f6-0x0;var _0x11d4d8=_0x77d4[_0x1fd2f6];return _0x11d4d8;};'use strict';var _=require('lodash');var rp=require(_0x477d('0x0'));var BPromise=require('bluebird');var md5=require(_0x477d('0x1'));var util=require('util');var Redis=require(_0x477d('0x2'));var intUtil=require(_0x477d('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x477d('0x4'));config[_0x477d('0x5')]=_[_0x477d('0x6')](config[_0x477d('0x5')],{'host':_0x477d('0x7'),'port':0x18eb});var io=require(_0x477d('0x8'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x2dd5d2,_0x579859,_0x5da70c){io['to'](_0x2dd5d2)[_0x477d('0x9')](_0x579859,_0x5da70c);}function getTicket(_0x29f11b,_0x204cb9,_0x2c326c,_0x1cef1c,_0x58ff29,_0x932cc9,_0x4f11bc){logger[_0x477d('0xa')](_0x477d('0xb'));var _0x55ace3=new Date();var _0x472012=[{'name':_0x477d('0xc'),'value':intUtil['getString'](_0x1cef1c['Subjects'],_0x58ff29,'\x20')},{'name':_0x477d('0xd'),'value':_0x204cb9['id']},{'name':_0x477d('0xe'),'value':_0x204cb9['id']},{'name':'description','value':intUtil[_0x477d('0xf')](_0x1cef1c[_0x477d('0x10')],_0x58ff29,'\x0a')},{'name':'date_start','value':_0x55ace3['toISOString']()[_0x477d('0x11')](0x0,0x13)['replace']('T','\x20')},{'name':_0x477d('0x12'),'value':'0'},{'name':_0x477d('0x13'),'value':'15'},{'name':_0x477d('0x14'),'value':_0x2c326c['id']},{'name':'parent_type','value':_0x477d('0x15')},{'name':_0x477d('0x16'),'value':_0x2c326c[_0x477d('0xc')]}];if(_0x932cc9[_0x477d('0x17')]){_['forEach'](_0x932cc9,function(_0x28f17a){if(_0x58ff29[_0x28f17a['variableName']]){_0x472012[_0x477d('0x18')]({'name':_0x28f17a[_0x477d('0x19')],'value':_0x58ff29[_0x28f17a[_0x477d('0x1a')]]});}});}return request({'form':{'method':_0x477d('0x1b'),'input_type':_0x477d('0x1c'),'response_type':_0x477d('0x1c'),'rest_data':JSON['stringify']({'session':_0x4f11bc['id'],'module_name':_0x477d('0x1d'),'name_value_list':_0x472012})}});}function getAuth(_0x49c442){return util[_0x477d('0x1e')](_0x477d('0x1f'),new Buffer(_0x49c442[_0x477d('0x20')]+':X')[_0x477d('0x21')](_0x477d('0x22')));}function getServerInfo(_0x3b3cda){return request({'form':{'method':_0x477d('0x23'),'input_type':_0x477d('0x1c'),'response_type':_0x477d('0x1c'),'rest_data':JSON[_0x477d('0x24')]({'session':_0x3b3cda['id']})}});}function getUser(_0x3d2943,_0x3525e8,_0x43c845){logger[_0x477d('0xa')]('Getting\x20agent\x20with\x20name',_0x3525e8);return request({'form':{'method':_0x477d('0x25'),'input_type':'JSON','response_type':_0x477d('0x1c'),'rest_data':JSON[_0x477d('0x24')]({'session':_0x43c845['id'],'module_name':_0x477d('0x26'),'query':util[_0x477d('0x1e')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x3525e8),'order_by':'','offset':'0','select_fields':['id',_0x477d('0xc'),_0x477d('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x477d('0x28')](function(_0x48ee5e){if(_0x48ee5e['entry_list'][_0x477d('0x17')]){var _0x3c6270=_[_0x477d('0x29')](_0x48ee5e['entry_list'],function(_0x254141){return _0x254141[_0x477d('0x2a')][_0x477d('0x27')][_0x477d('0x2b')]===_0x3525e8;});if(_0x3c6270){logger[_0x477d('0xa')]('Agent\x20found!');return BPromise[_0x477d('0x2c')]({'id':_0x3c6270[_0x477d('0x2a')]['id'][_0x477d('0x2b')],'name':_0x3c6270[_0x477d('0x2a')][_0x477d('0xc')][_0x477d('0x2b')]});}}else{logger[_0x477d('0xa')](_0x477d('0x2d'));return BPromise[_0x477d('0x2c')]({'id':_0x43c845[_0x477d('0x2a')][_0x477d('0x2e')]['id'],'name':_0x43c845[_0x477d('0x2a')][_0x477d('0x27')]['id']});}});}function getEndUser(_0x2f7851,_0x16042d,_0x4127c1,_0x9857c2){logger[_0x477d('0xa')](_0x477d('0x2f'),_0x4127c1);return request({'form':{'method':_0x477d('0x25'),'input_type':'JSON','response_type':_0x477d('0x1c'),'rest_data':JSON['stringify']({'session':_0x9857c2['id'],'module_name':_0x477d('0x15'),'query':util[_0x477d('0x1e')](_0x477d('0x30'),_0x4127c1),'order_by':'','offset':'0','select_fields':['id','name',_0x477d('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x477d('0x28')](function(_0x2b2091){if(_0x2b2091[_0x477d('0x32')][_0x477d('0x17')]){var _0x463fca=_[_0x477d('0x29')](_0x2b2091[_0x477d('0x32')],function(_0x2064e6){return _0x2064e6[_0x477d('0x2a')]['phone_home'][_0x477d('0x2b')]===_0x4127c1;});if(_0x463fca){logger[_0x477d('0xa')](_0x477d('0x33'));return BPromise['resolve']({'id':_0x463fca[_0x477d('0x2a')]['id'][_0x477d('0x2b')],'name':_0x463fca[_0x477d('0x2a')]['name']['value'],'phone':_0x463fca[_0x477d('0x2a')][_0x477d('0x31')][_0x477d('0x2b')]});}}else{logger[_0x477d('0xa')](_0x477d('0x34'));return request({'form':{'method':'set_entry','input_type':_0x477d('0x1c'),'response_type':'JSON','rest_data':JSON[_0x477d('0x24')]({'session':_0x9857c2['id'],'module_name':_0x477d('0x15'),'name_value_list':[{'name':_0x477d('0x35'),'value':_0x16042d!==''?_0x16042d:util['format'](_0x477d('0x36'),_0x4127c1)},{'name':_0x477d('0x31'),'value':_0x4127c1}]})}})[_0x477d('0x28')](function(_0x4758a5){logger['info'](_0x477d('0x37'));return BPromise[_0x477d('0x2c')]({'id':_0x4758a5['id'],'name':_0x4758a5[_0x477d('0x32')][_0x477d('0x35')][_0x477d('0x2b')],'phone':_0x4758a5['entry_list'][_0x477d('0x31')][_0x477d('0x2b')]});});}});}function request(_0x4d1c8e){logger[_0x477d('0x38')]('[HTTP]',JSON[_0x477d('0x24')](_0x4d1c8e));return rp(_[_0x477d('0x39')](def,_0x4d1c8e));}function getTags(_0x131f61,_0x335b2a){var _0x1f9552=[];if(_0x131f61&&_0x131f61[_0x477d('0x17')]>0x0){_0x1f9552=_[_0x477d('0x3a')](_0x131f61,_0x335b2a);}return _0x1f9552;}function getCustomFields(_0xb94247,_0x43ffd1){var _0x4c22f5=[];var _0x5759f={'custom_fields':[]};if(_0xb94247[_0x477d('0x17')]>0x0){_[_0x477d('0x3b')](_0xb94247,function(_0x432985){if(_0x432985['type']==='string'&&_0x432985[_0x477d('0x3c')]&&!_0x432985[_0x477d('0x3d')]){_0x5759f[_0x432985['nameField'][_0x477d('0x3e')]()]=_0x432985['content']['toString']();}else if(_0x432985[_0x477d('0x3f')]===_0x477d('0x40')&&_0x432985[_0x477d('0x19')]&&_0x432985[_0x477d('0x3d')]){_0x5759f[_0x477d('0x41')][_0x477d('0x18')]({'id':_0x432985['idField'],'value':_0x432985[_0x477d('0x42')][_0x477d('0x21')]()});}else if(_0x432985[_0x477d('0x3f')]===_0x477d('0x43')&&_0x432985[_0x477d('0x1a')]&&_0x432985['idField']&&_0x432985['customField']){_0x43ffd1[_0x432985[_0x477d('0x1a')]]&&_0x5759f[_0x477d('0x41')][_0x477d('0x18')]({'id':_0x432985['idField'],'value':_0x43ffd1[_0x432985[_0x477d('0x1a')]][_0x477d('0x21')]()});}else if(_0x432985[_0x477d('0x3f')]===_0x477d('0x44')&&_0x432985[_0x477d('0x45')]&&_0x432985[_0x477d('0x45')][_0x477d('0xc')]&&_0x432985['idField']&&_0x432985[_0x477d('0x3d')]){_0x43ffd1[_0x432985[_0x477d('0x45')][_0x477d('0xc')][_0x477d('0x3e')]()]&&_0x5759f[_0x477d('0x41')][_0x477d('0x18')]({'id':_0x432985[_0x477d('0x19')],'value':_0x43ffd1[_0x432985[_0x477d('0x45')][_0x477d('0xc')][_0x477d('0x3e')]()][_0x477d('0x21')]()});}});}return _0x5759f;}function getConnection(_0x3f8f26){return request({'method':_0x477d('0x46'),'form':{'method':_0x477d('0x47'),'input_type':_0x477d('0x1c'),'response_type':'JSON','rest_data':JSON[_0x477d('0x24')]({'user_auth':{'user_name':_0x3f8f26[_0x477d('0x48')],'password':_0x3f8f26['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x477d('0x28')](function(_0x33811f){var _0x330f31=_0x33811f;if(_0x330f31['id']){def[_0x477d('0x49')]=_0x330f31['id'];return BPromise[_0x477d('0x2c')](_0x330f31);}else{throw new Error(util[_0x477d('0x1e')](_0x477d('0x4a'),_0x3f8f26['id']));}});}function setRelationship(_0x342f18,_0x593faf,_0x15dcaf,_0x470d3e){return request({'form':{'method':_0x477d('0x4b'),'input_type':_0x477d('0x1c'),'response_type':_0x477d('0x1c'),'rest_data':JSON[_0x477d('0x24')]({'session':_0x342f18['id'],'module_name':_0x477d('0x1d'),'module_id':_0x15dcaf['id'],'link_field_name':_0x470d3e,'related_ids':[_0x593faf['id']]})}});}exports[_0x477d('0x4c')]=function(_0x5d9114,_0x3178ed,_0xfa7e26,_0x295aeb,_0x477889,_0x45cf6d){var _0x5ef5cc,_0x1c496a,_0x215f73,_0x3ce50f;_0x45cf6d[_0x477d('0x4d')]=intUtil[_0x477d('0x4e')](_0x45cf6d['remoteUri']);_0x45cf6d['serverUrl']=intUtil[_0x477d('0x4e')](_0x45cf6d[_0x477d('0x4f')]);def[_0x477d('0x50')]=util[_0x477d('0x1e')](_0x477d('0x51'),_0x45cf6d[_0x477d('0x4d')]);if(_0x477889&&_0x477889[_0x477d('0x52')]){logger[_0x477d('0xa')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3178ed['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x45cf6d[_0x477d('0x4f')],_0x3178ed['uniqueid'],md5(_0x3178ed[_0x477d('0x53')]));}else{_0x3178ed['recordingURL']='';}return getConnection(_0x45cf6d)[_0x477d('0x28')](function(_0x1316df){_0x3ce50f=_0x1316df;return getUser(_0x45cf6d,_0x295aeb['name'],_0x3ce50f);})[_0x477d('0x28')](function(_0x4739ac){_0x5ef5cc=_0x4739ac;logger[_0x477d('0xa')](_0x477d('0x54'),_0x5ef5cc['id']);return getEndUser(_0x45cf6d,_0x3178ed[_0x477d('0x55')],_0x3178ed['calleridnum'],_0x3ce50f);})[_0x477d('0x28')](function(_0x245fbe){_0x1c496a=_0x245fbe;logger['info'](_0x477d('0x56'),_0x1c496a['id']);return getTicket(_0x45cf6d,_0x5ef5cc,_0x1c496a,_0xfa7e26,_0x3178ed,_0xfa7e26[_0x477d('0x57')],_0x3ce50f);})[_0x477d('0x28')](function(_0x207460){_0x215f73=_0x207460;logger[_0x477d('0xa')]('Ticket\x20created!');logger['info'](_0x477d('0x58'),_0x215f73['id']);return setRelationship(_0x3ce50f,_0x5ef5cc,_0x215f73,_0x477d('0x59'));})['then'](function(){return setRelationship(_0x3ce50f,_0x1c496a,_0x215f73,_0x477d('0x5a'));})['then'](function(){return getServerInfo(_0x3ce50f);})['then'](function(_0x382587){var _0x44c193=parseInt(_0x382587[_0x477d('0x5b')][_0x477d('0x5c')](0x0));var _0x6873d7=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x45cf6d[_0x477d('0x4d')],_0x215f73['id']);if(_0x44c193>0x6){_0x6873d7=util[_0x477d('0x1e')](_0x477d('0x5d'),_0x45cf6d[_0x477d('0x4d')],_0x215f73['id']);}logger[_0x477d('0xa')](_0x477d('0x5e'),_0x477d('0x5f'));emit(util[_0x477d('0x1e')](_0x477d('0x60'),_0x295aeb['name']),'trigger:browser:url',{'uri':_0x6873d7});})[_0x477d('0x61')](function(_0x5049bd){logger[_0x477d('0x62')](_0x477d('0x5e'),JSON[_0x477d('0x24')](_0x5049bd));});};exports['outbound']=function(_0xcb40f3,_0x27d58e,_0x5ec335,_0x2d1e6d,_0x3ab693,_0x45a898,_0x31e38e){var _0x3f5c88,_0x4592d9,_0x55f1a9,_0xee47ac;_0x45a898[_0x477d('0x4d')]=intUtil[_0x477d('0x4e')](_0x45a898[_0x477d('0x4d')]);_0x45a898['serverUrl']=intUtil[_0x477d('0x4e')](_0x45a898['serverUrl']);def[_0x477d('0x50')]=util[_0x477d('0x1e')]('%s/service/v4_1/rest.php',_0x45a898[_0x477d('0x4d')]);if(_0x31e38e&&_0x31e38e[_0x477d('0x63')]&&_0x31e38e[_0x477d('0x63')]!=='none'){logger['info'](_0x477d('0x64'),_0x477d('0x65'));_0x27d58e[_0x477d('0x66')]=util[_0x477d('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x45a898[_0x477d('0x4f')],_0x27d58e[_0x477d('0x53')],md5(_0x27d58e['uniqueid']));}return getConnection(_0x45a898)[_0x477d('0x28')](function(_0x2aac51){_0xee47ac=_0x2aac51;return getUser(_0x45a898,_0x2d1e6d[_0x477d('0xc')],_0xee47ac);})['then'](function(_0x1f2c3e){_0x3f5c88=_0x1f2c3e;logger[_0x477d('0xa')](_0x477d('0x54'),_0x3f5c88['id']);return getEndUser(_0x45a898,_0x27d58e['destcalleridname'],_0x27d58e[_0x477d('0x67')],_0xee47ac);})[_0x477d('0x28')](function(_0x290e77){_0x4592d9=_0x290e77;logger[_0x477d('0xa')](_0x477d('0x56'),_0x4592d9['id']);return getTicket(_0x45a898,_0x3f5c88,_0x4592d9,_0x5ec335,_0x27d58e,_0x5ec335[_0x477d('0x57')],_0xee47ac);})[_0x477d('0x28')](function(_0x3a3202){_0x55f1a9=_0x3a3202;logger[_0x477d('0xa')]('Ticket\x20created!');logger['info'](_0x477d('0x58'),_0x55f1a9['id']);return setRelationship(_0xee47ac,_0x3f5c88,_0x55f1a9,'users');})[_0x477d('0x28')](function(){return setRelationship(_0xee47ac,_0x4592d9,_0x55f1a9,'contacts');})[_0x477d('0x28')](function(){return getServerInfo(_0xee47ac);})['then'](function(_0x29e618){var _0x2852d5=parseInt(_0x29e618[_0x477d('0x5b')][_0x477d('0x5c')](0x0));var _0x5c8fd8=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x45a898['remoteUri'],_0x55f1a9['id']);if(_0x2852d5>0x6){_0x5c8fd8=util['format'](_0x477d('0x5d'),_0x45a898[_0x477d('0x4d')],_0x55f1a9['id']);}logger[_0x477d('0xa')](_0x477d('0x64'),_0x477d('0x5f'));emit(util[_0x477d('0x1e')]('user:%s',_0x2d1e6d[_0x477d('0xc')]),'trigger:browser:url',{'uri':_0x5c8fd8});})['catch'](function(_0x26af90){logger[_0x477d('0x62')](_0x477d('0x64'),JSON[_0x477d('0x24')](_0x26af90));});};exports[_0x477d('0x68')]=function(_0x46c6c9,_0x5ce2a1,_0x5effb6,_0x109d15,_0x10959a,_0x3c73ff){var _0x506d9b,_0x55f189,_0x12c685,_0x39aed2;_0x3c73ff[_0x477d('0x4d')]=intUtil[_0x477d('0x4e')](_0x3c73ff[_0x477d('0x4d')]);_0x3c73ff[_0x477d('0x4f')]=intUtil[_0x477d('0x4e')](_0x3c73ff[_0x477d('0x4f')]);def[_0x477d('0x50')]=util['format'](_0x477d('0x51'),_0x3c73ff[_0x477d('0x4d')]);if(_0x10959a&&_0x10959a['monitor_format']){logger[_0x477d('0xa')](_0x477d('0x69'),_0x477d('0x65'));_0x5ce2a1[_0x477d('0x66')]=util[_0x477d('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c73ff[_0x477d('0x4f')],_0x5ce2a1['uniqueid'],md5(_0x5ce2a1[_0x477d('0x53')]));}else{_0x5ce2a1[_0x477d('0x66')]='';}return getConnection(_0x3c73ff)['then'](function(_0x3679f7){_0x39aed2=_0x3679f7;return getUser(_0x3c73ff,_0x109d15[_0x477d('0xc')],_0x39aed2);})['then'](function(_0x35b831){_0x506d9b=_0x35b831;logger[_0x477d('0xa')]('The\x20User\x20ID\x20is:',_0x506d9b['id']);return getEndUser(_0x3c73ff,_0x5ce2a1[_0x477d('0x55')],_0x5ce2a1[_0x477d('0x6a')],_0x39aed2);})[_0x477d('0x28')](function(_0x46cfc4){_0x55f189=_0x46cfc4;logger[_0x477d('0xa')](_0x477d('0x56'),_0x55f189['id']);return getTicket(_0x3c73ff,_0x506d9b,_0x55f189,_0x5effb6,_0x5ce2a1,_0x5effb6[_0x477d('0x57')],_0x39aed2);})[_0x477d('0x28')](function(_0x328a33){_0x12c685=_0x328a33;logger[_0x477d('0xa')](_0x477d('0x6b'));logger[_0x477d('0xa')](_0x477d('0x58'),_0x12c685['id']);return setRelationship(_0x39aed2,_0x506d9b,_0x12c685,_0x477d('0x59'));})[_0x477d('0x28')](function(){return setRelationship(_0x39aed2,_0x55f189,_0x12c685,'contacts');})[_0x477d('0x28')](function(){return getServerInfo(_0x39aed2);})['catch'](function(_0x4f8429){logger[_0x477d('0x62')](_0x477d('0x69'),JSON['stringify'](_0x4f8429));});}; \ 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 480ae81..c6fb495 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 _0x3024=['keyType','customVariable','join','stripTrailingSlash','substr','lodash','length','sortBy','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent'];(function(_0x27854e,_0x6407eb){var _0xc91f16=function(_0x78d3aa){while(--_0x78d3aa){_0x27854e['push'](_0x27854e['shift']());}};_0xc91f16(++_0x6407eb);}(_0x3024,0x15e));var _0x4302=function(_0x2503d6,_0x124fbe){_0x2503d6=_0x2503d6-0x0;var _0x3cb595=_0x3024[_0x2503d6];return _0x3cb595;};'use strict';var _=require(_0x4302('0x0'));var util=require('util');exports['getString']=function(_0x4fc37e,_0x1c39a9,_0x3a803e){var _0x9202b4=[];if(_0x4fc37e[_0x4302('0x1')]>0x0){var _0x2b5a18=_[_0x4302('0x2')](_0x4fc37e,['id']);for(var _0x3054ae=0x0;_0x3054ae<_0x2b5a18[_0x4302('0x1')];_0x3054ae++){var _0x488a45=_0x2b5a18[_0x3054ae];if(_0x488a45[_0x4302('0x3')]===_0x4302('0x4')){_0x9202b4[_0x4302('0x5')](_0x488a45[_0x4302('0x6')]);}else if(_0x488a45['type']===_0x4302('0x7')&&_0x488a45[_0x4302('0x8')]){_0x1c39a9[_0x488a45[_0x4302('0x8')]]&&_0x9202b4[_0x4302('0x5')](_0x1c39a9[_0x488a45['variableName']][_0x4302('0x9')]());}else if(_0x488a45[_0x4302('0x3')]==='customVariable'&&_0x488a45['Variable']&&_0x488a45[_0x4302('0xa')][_0x4302('0xb')]){_0x1c39a9[_0x488a45[_0x4302('0xa')][_0x4302('0xb')]['toLowerCase']()]&&_0x9202b4['push'](_0x1c39a9[_0x488a45[_0x4302('0xa')]['name'][_0x4302('0xc')]()][_0x4302('0x9')]());}else if(_0x488a45[_0x4302('0x3')]===_0x4302('0xd')){if(_0x488a45['keyType']===_0x4302('0x4')&&_0x488a45[_0x4302('0xe')]){_0x9202b4[_0x4302('0x5')](util[_0x4302('0xf')](_0x4302('0x10'),_0x488a45[_0x4302('0xe')],_0x488a45[_0x4302('0x11')]));}else if(_0x488a45['keyType']===_0x4302('0x7')&&_0x488a45[_0x4302('0x8')]&&_0x488a45[_0x4302('0xe')]){_0x1c39a9[_0x488a45[_0x4302('0x8')]]&&_0x9202b4[_0x4302('0x5')](util['format'](_0x4302('0x10'),_0x488a45[_0x4302('0xe')],_0x1c39a9[_0x488a45['variableName']]));}else if(_0x488a45[_0x4302('0x12')]===_0x4302('0x13')&&_0x488a45[_0x4302('0xa')]&&_0x488a45['Variable'][_0x4302('0xb')]&&_0x488a45[_0x4302('0xe')]){_0x1c39a9[_0x488a45[_0x4302('0xa')][_0x4302('0xb')][_0x4302('0xc')]()]&&_0x9202b4[_0x4302('0x5')](util[_0x4302('0xf')]('%s:\x20%s',_0x488a45['key'],_0x1c39a9[_0x488a45['Variable'][_0x4302('0xb')][_0x4302('0xc')]()]));}}}}return _0x9202b4[_0x4302('0x14')](_0x3a803e);};exports[_0x4302('0x15')]=function(_0x40df01){if(_0x40df01&&_0x40df01[_0x4302('0x16')](-0x1)==='/'){return _0x40df01[_0x4302('0x16')](0x0,_0x40df01[_0x4302('0x1')]-0x1);}return _0x40df01;}; \ No newline at end of file +var _0xa139=['keyValue','%s:\x20%s','key','keyContent','keyType','format','join','stripTrailingSlash','substr','util','getString','length','sortBy','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase'];(function(_0x4e9466,_0x1a4b1e){var _0x3fd4bd=function(_0x1c39fa){while(--_0x1c39fa){_0x4e9466['push'](_0x4e9466['shift']());}};_0x3fd4bd(++_0x1a4b1e);}(_0xa139,0x134));var _0x9a13=function(_0x21659e,_0x4fd9c9){_0x21659e=_0x21659e-0x0;var _0x2e0dd4=_0xa139[_0x21659e];return _0x2e0dd4;};'use strict';var _=require('lodash');var util=require(_0x9a13('0x0'));exports[_0x9a13('0x1')]=function(_0x4b151d,_0x2a3796,_0x514c4c){var _0x21f242=[];if(_0x4b151d[_0x9a13('0x2')]>0x0){var _0x31fa00=_[_0x9a13('0x3')](_0x4b151d,['id']);for(var _0x3148c7=0x0;_0x3148c7<_0x31fa00[_0x9a13('0x2')];_0x3148c7++){var _0x380126=_0x31fa00[_0x3148c7];if(_0x380126[_0x9a13('0x4')]===_0x9a13('0x5')){_0x21f242[_0x9a13('0x6')](_0x380126[_0x9a13('0x7')]);}else if(_0x380126[_0x9a13('0x4')]==='variable'&&_0x380126['variableName']){_0x2a3796[_0x380126[_0x9a13('0x8')]]&&_0x21f242[_0x9a13('0x6')](_0x2a3796[_0x380126[_0x9a13('0x8')]][_0x9a13('0x9')]());}else if(_0x380126[_0x9a13('0x4')]===_0x9a13('0xa')&&_0x380126[_0x9a13('0xb')]&&_0x380126[_0x9a13('0xb')][_0x9a13('0xc')]){_0x2a3796[_0x380126[_0x9a13('0xb')][_0x9a13('0xc')][_0x9a13('0xd')]()]&&_0x21f242['push'](_0x2a3796[_0x380126[_0x9a13('0xb')][_0x9a13('0xc')][_0x9a13('0xd')]()]['toString']());}else if(_0x380126['type']===_0x9a13('0xe')){if(_0x380126['keyType']===_0x9a13('0x5')&&_0x380126['key']){_0x21f242[_0x9a13('0x6')](util['format'](_0x9a13('0xf'),_0x380126[_0x9a13('0x10')],_0x380126[_0x9a13('0x11')]));}else if(_0x380126[_0x9a13('0x12')]==='variable'&&_0x380126[_0x9a13('0x8')]&&_0x380126[_0x9a13('0x10')]){_0x2a3796[_0x380126[_0x9a13('0x8')]]&&_0x21f242['push'](util[_0x9a13('0x13')]('%s:\x20%s',_0x380126[_0x9a13('0x10')],_0x2a3796[_0x380126[_0x9a13('0x8')]]));}else if(_0x380126[_0x9a13('0x12')]===_0x9a13('0xa')&&_0x380126['Variable']&&_0x380126[_0x9a13('0xb')]['name']&&_0x380126[_0x9a13('0x10')]){_0x2a3796[_0x380126[_0x9a13('0xb')][_0x9a13('0xc')][_0x9a13('0xd')]()]&&_0x21f242[_0x9a13('0x6')](util[_0x9a13('0x13')](_0x9a13('0xf'),_0x380126[_0x9a13('0x10')],_0x2a3796[_0x380126[_0x9a13('0xb')][_0x9a13('0xc')][_0x9a13('0xd')]()]));}}}}return _0x21f242[_0x9a13('0x14')](_0x514c4c);};exports[_0x9a13('0x15')]=function(_0x326abe){if(_0x326abe&&_0x326abe[_0x9a13('0x16')](-0x1)==='/'){return _0x326abe['substr'](0x0,_0x326abe[_0x9a13('0x2')]-0x1);}return _0x326abe;}; \ 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 da16b06..d3de996 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 _0xe706=['%s/webservice.php','remoteUri','create','sessionName','success','result','format','stringify','error','catch','query','test','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','Getting\x20agent\x20with\x20email','GET','admin','then','resolve','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','username','getUser','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','getEndUser','accessKey','token','getConnection','[HTTP]','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','stripTrailingSlash','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','abandoned','[ABANDONED]','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','content','toString','variable','variableName','idField','customVariable','name','Variable','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST'];(function(_0xf1f277,_0x371963){var _0x36c036=function(_0x5346a6){while(--_0x5346a6){_0xf1f277['push'](_0xf1f277['shift']());}};_0x36c036(++_0x371963);}(_0xe706,0xa3));var _0x6e70=function(_0x2fa488,_0x408715){_0x2fa488=_0x2fa488-0x0;var _0x1ec0a9=_0xe706[_0x2fa488];return _0x1ec0a9;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_0x3f474a[_0x6e70('0x10')]===_0x6e70('0x11')&&_0x3f474a['idField']){_0x100eb7[_0x3f474a['idField']]=_0x3f474a[_0x6e70('0x12')][_0x6e70('0x13')]();}else if(_0x3f474a[_0x6e70('0x10')]===_0x6e70('0x14')&&_0x3f474a[_0x6e70('0x15')]&&_0x3f474a[_0x6e70('0x16')]&&_0x25e61c[_0x3f474a[_0x6e70('0x15')]]){_0x100eb7[_0x3f474a[_0x6e70('0x16')]]=_0x25e61c[_0x3f474a['variableName']]['toString']();}else if(_0x3f474a['type']===_0x6e70('0x17')&&_0x3f474a['Variable']&&_0x3f474a['Variable'][_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x16')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x18')]['toLowerCase']()]){_0x100eb7[_0x3f474a[_0x6e70('0x16')]]=_0x25e61c[_0x3f474a[_0x6e70('0x19')]['name']['toLowerCase']()][_0x6e70('0x13')]();}});}return _0x100eb7;}function createTicket(_0x5ea7a5,_0x28a21f,_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21){logger[_0x6e70('0x1a')](_0x6e70('0x1b'));var _0x3af484=_[_0x6e70('0x1c')]({'parent_id':'','assigned_user_id':_0x28a21f['id'],'ticketpriorities':_0x6e70('0x1d'),'ticketstatus':_0x6e70('0x1e'),'ticket_title':intUtil[_0x6e70('0x1f')](_0x53acdc[_0x6e70('0x20')],_0x497d61,'\x20'),'description':intUtil['getString'](_0x53acdc[_0x6e70('0x21')],_0x497d61,'\x0a'),'contact_id':_0x173afe['id']},getCustomFields(_0xc238ba,_0x497d61));var _0x344b65={'method':_0x6e70('0x22'),'uri':util['format'](_0x6e70('0x23'),_0x5ea7a5[_0x6e70('0x24')]),'form':{'operation':_0x6e70('0x25'),'username':'admin','sessionName':_0x208e21[_0x6e70('0x26')],'elementType':'HelpDesk','element':JSON['stringify'](_0x3af484)},'json':!![]};return request(_0x344b65)['then'](function(_0x41e352){if(_0x41e352[_0x6e70('0x27')]){return BPromise['resolve']({'id':_0x41e352[_0x6e70('0x28')]['id']});}else{throw new Error(util[_0x6e70('0x29')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x6e70('0x2a')](_0x41e352[_0x6e70('0x2b')])));}})[_0x6e70('0x2c')](function(_0x4a67ac){var _0x54a5fe=req[_0x6e70('0x2d')][_0x6e70('0x2e')]?0x1f4:_0x4a67ac[_0x6e70('0x2f')]||0x1f4;logger[_0x6e70('0x2b')](_0x6e70('0x30'),'createTicket',_0x54a5fe,JSON[_0x6e70('0x2a')](_0x4a67ac));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){logger[_0x6e70('0x1a')](_0x6e70('0x31'),_0xecf336);return request({'method':_0x6e70('0x32'),'uri':util[_0x6e70('0x29')](_0x6e70('0x23'),_0x406f29[_0x6e70('0x24')]),'qs':{'operation':'query','username':_0x6e70('0x33'),'sessionName':_0x2864a0['sessionName'],'query':util[_0x6e70('0x29')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0xecf336)},'json':!![]})[_0x6e70('0x34')](function(_0x2722e8){if(_0x2722e8[_0x6e70('0x27')]&&_0x2722e8['result'][_0x6e70('0xe')]){logger[_0x6e70('0x1a')]('Agent\x20found!');return BPromise[_0x6e70('0x35')]({'id':_0x2722e8[_0x6e70('0x28')][0x0]['id'],'email':_0x2722e8['result'][0x0][_0x6e70('0x36')],'name':_0x2722e8[_0x6e70('0x28')][0x0][_0x6e70('0x37')]+'\x20'+_0x2722e8[_0x6e70('0x28')][_0x6e70('0x38')]});}else{logger[_0x6e70('0x1a')](_0x6e70('0x39'));return BPromise[_0x6e70('0x35')]({'id':_0x2864a0[_0x6e70('0x3a')],'email':_0x406f29[_0x6e70('0x3b')],'name':'admin'});}})[_0x6e70('0x2c')](function(_0x4795a0){var _0x23cd1a=req[_0x6e70('0x2d')][_0x6e70('0x2e')]?0x1f4:_0x4795a0[_0x6e70('0x2f')]||0x1f4;logger[_0x6e70('0x2b')](_0x6e70('0x30'),_0x6e70('0x3c'),_0x23cd1a,JSON[_0x6e70('0x2a')](_0x4795a0));});}function getEndUser(_0x80bebb,_0x198dd1,_0x2a5444,_0x23d5e2){logger[_0x6e70('0x1a')]('Searching\x20end\x20user\x20with\x20phone',_0x2a5444);return request({'method':'GET','uri':util['format'](_0x6e70('0x23'),_0x80bebb[_0x6e70('0x24')]),'qs':{'operation':_0x6e70('0x2d'),'username':_0x6e70('0x33'),'sessionName':_0x23d5e2[_0x6e70('0x26')],'query':util[_0x6e70('0x29')]('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;',_0x2a5444,_0x2a5444,_0x2a5444,_0x2a5444,_0x2a5444)},'json':!![]})[_0x6e70('0x34')](function(_0x9e7ad2){if(_0x9e7ad2[_0x6e70('0x27')]&&_0x9e7ad2[_0x6e70('0x28')][_0x6e70('0xe')]){logger[_0x6e70('0x1a')](_0x6e70('0x3d'));return BPromise[_0x6e70('0x35')]({'id':_0x9e7ad2['result'][0x0]['id'],'name':_0x9e7ad2[_0x6e70('0x28')][0x0][_0x6e70('0x3e')]+'\x20'+_0x9e7ad2[_0x6e70('0x28')][0x0][_0x6e70('0x3f')],'phone':_0x2a5444});}else{logger[_0x6e70('0x1a')](_0x6e70('0x40'));return request({'method':_0x6e70('0x22'),'uri':util['format']('%s/webservice.php',_0x80bebb['remoteUri']),'form':{'operation':_0x6e70('0x25'),'sessionName':_0x23d5e2[_0x6e70('0x26')],'elementType':_0x6e70('0x41'),'element':JSON[_0x6e70('0x2a')]({'lastname':_0x198dd1,'phone':_0x2a5444,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x34')](function(_0x49e068){logger[_0x6e70('0x1a')](_0x6e70('0x42'));return BPromise[_0x6e70('0x35')]({'id':_0x49e068['result']['id'],'name':_0x49e068['result']['lastname'],'phone':_0x49e068[_0x6e70('0x28')]['phone']});})[_0x6e70('0x2c')](function(_0x39913a){var _0x3fed21=req[_0x6e70('0x2d')]['test']?0x1f4:_0x39913a[_0x6e70('0x2f')]||0x1f4;logger['error'](_0x6e70('0x30'),_0x6e70('0x43'),_0x3fed21,JSON[_0x6e70('0x2a')](_0x39913a));});}});}function getConnection(_0x3478e2){var _0x5bbc3a=_0x3478e2[_0x6e70('0x3b')];var _0x44b637=_0x3478e2[_0x6e70('0x44')];return request({'method':_0x6e70('0x32'),'uri':util[_0x6e70('0x29')](_0x6e70('0x23'),_0x3478e2[_0x6e70('0x24')]),'qs':{'operation':'getchallenge','username':_0x5bbc3a},'json':!![]})[_0x6e70('0x34')](function(_0x3884a4){if(_0x3884a4[_0x6e70('0x27')]){return request({'method':_0x6e70('0x22'),'uri':util[_0x6e70('0x29')](_0x6e70('0x23'),_0x3478e2[_0x6e70('0x24')]),'form':{'operation':'login','username':_0x6e70('0x33'),'accessKey':md5(_0x3884a4['result'][_0x6e70('0x45')]+_0x44b637)},'json':!![]});}})[_0x6e70('0x34')](function(_0x4b351e){if(_0x4b351e['success']){return BPromise[_0x6e70('0x35')](_0x4b351e[_0x6e70('0x28')]);}else{throw new Error(util[_0x6e70('0x29')]('Account\x20%d\x20is\x20not\x20valid',_0x3478e2['id']));}})['catch'](function(_0x238ebb){var _0x11ac3d=req[_0x6e70('0x2d')][_0x6e70('0x2e')]?0x1f4:_0x238ebb[_0x6e70('0x2f')]||0x1f4;logger[_0x6e70('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x6e70('0x46'),_0x11ac3d,JSON[_0x6e70('0x2a')](_0x238ebb));});}function request(_0x219f4){logger[_0x6e70('0x1a')](_0x6e70('0x47'),JSON['stringify'](_0x219f4));return rp(_0x219f4);}exports['queue']=function(_0x2c5538,_0x2e3ea6,_0x34fdba,_0x15f994,_0x810e6a,_0x5dd73e){var _0x41bd0b,_0x232366,_0x1fa320,_0x23ebfb;_0x5dd73e[_0x6e70('0x24')]=intUtil['stripTrailingSlash'](_0x5dd73e[_0x6e70('0x24')]);if(_0x810e6a&&_0x810e6a[_0x6e70('0x48')]){logger[_0x6e70('0x1a')](_0x6e70('0x49'),_0x6e70('0x4a'));_0x2e3ea6[_0x6e70('0x4b')]=util['format'](_0x6e70('0x4c'),_0x5dd73e[_0x6e70('0x4d')],_0x2e3ea6['uniqueid'],md5(_0x2e3ea6[_0x6e70('0x4e')]));}else{_0x2e3ea6[_0x6e70('0x4b')]='';}return getConnection(_0x5dd73e)['then'](function(_0x3cfaa9){_0x23ebfb=_0x3cfaa9;return getUser(_0x5dd73e,_0x15f994?_0x15f994[_0x6e70('0x4f')]:'',_0x23ebfb);})[_0x6e70('0x34')](function(_0x46d536){_0x41bd0b=_0x46d536;logger[_0x6e70('0x1a')]('The\x20User\x20ID\x20is:',_0x41bd0b['id']);return getEndUser(_0x5dd73e,_0x2e3ea6[_0x6e70('0x50')],_0x2e3ea6[_0x6e70('0x51')],_0x23ebfb);})[_0x6e70('0x34')](function(_0x13be81){_0x232366=_0x13be81;logger[_0x6e70('0x1a')](_0x6e70('0x52'),_0x232366['id']);return createTicket(_0x5dd73e,_0x41bd0b,_0x232366,_0x34fdba,_0x2e3ea6,_0x34fdba[_0x6e70('0x53')],_0x23ebfb);})[_0x6e70('0x34')](function(_0x6043cd){_0x1fa320=_0x6043cd;logger[_0x6e70('0x1a')](_0x6e70('0x54'));logger[_0x6e70('0x1a')](_0x6e70('0x55'),_0x1fa320['id']);var _0x1fd9a6=util[_0x6e70('0x29')](_0x6e70('0x56'),_0x5dd73e[_0x6e70('0x24')],_[_0x6e70('0x57')](_0x1fa320['id'],'x')[0x1]);logger[_0x6e70('0x1a')](_0x6e70('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6e70('0x29')](_0x6e70('0x58'),_0x15f994[_0x6e70('0x18')]),_0x6e70('0x59'),{'uri':_0x1fd9a6});})[_0x6e70('0x2c')](function(_0x3880dd){logger['error'](_0x6e70('0x49'),JSON[_0x6e70('0x2a')](_0x3880dd));});};exports['outbound']=function(_0x246ea2,_0x692205,_0x459a30,_0x590f7f,_0x51f268,_0x2f9be4,_0xd6bccd){var _0x2d0203,_0x41a861,_0x10d299,_0x739946;_0x2f9be4[_0x6e70('0x24')]=intUtil['stripTrailingSlash'](_0x2f9be4['remoteUri']);_0x2f9be4[_0x6e70('0x4d')]=intUtil[_0x6e70('0x5a')](_0x2f9be4[_0x6e70('0x4d')]);if(_0xd6bccd&&_0xd6bccd[_0x6e70('0x5b')]&&_0xd6bccd['recordingFormat']!=='none'){logger[_0x6e70('0x1a')](_0x6e70('0x5c'),'Recording\x20is\x20enabled!');_0x692205['recordingURL']=util[_0x6e70('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f9be4[_0x6e70('0x4d')],_0x692205[_0x6e70('0x4e')],md5(_0x692205[_0x6e70('0x4e')]));}return getConnection(_0x2f9be4)[_0x6e70('0x34')](function(_0x64ea5b){_0x739946=_0x64ea5b;return getUser(_0x2f9be4,_0x590f7f?_0x590f7f[_0x6e70('0x4f')]:'',_0x739946);})[_0x6e70('0x34')](function(_0x6ab1d6){_0x2d0203=_0x6ab1d6;logger['info'](_0x6e70('0x5d'),_0x2d0203['id']);return getEndUser(_0x2f9be4,_0x692205[_0x6e70('0x5e')],_0x692205[_0x6e70('0x5f')],_0x739946);})[_0x6e70('0x34')](function(_0x7aa313){_0x41a861=_0x7aa313;logger['info']('The\x20Enduser\x20ID\x20is:',_0x41a861['id']);return createTicket(_0x2f9be4,_0x2d0203,_0x41a861,_0x459a30,_0x692205,_0x459a30['Fields'],_0x739946);})[_0x6e70('0x34')](function(_0xd91b9){_0x10d299=_0xd91b9;logger[_0x6e70('0x1a')]('Ticket\x20created!');logger['info'](_0x6e70('0x55'),_0x10d299['id']);var _0x3dae08=util[_0x6e70('0x29')](_0x6e70('0x56'),_0x2f9be4[_0x6e70('0x24')],_[_0x6e70('0x57')](_0x10d299['id'],'x')[0x1]);logger['info'](_0x6e70('0x5c'),_0x6e70('0x60'));emit(util[_0x6e70('0x29')](_0x6e70('0x58'),_0x590f7f['name']),_0x6e70('0x59'),{'uri':_0x3dae08});})['catch'](function(_0x5b4046){logger[_0x6e70('0x2b')](_0x6e70('0x5c'),JSON[_0x6e70('0x2a')](_0x5b4046));});};exports[_0x6e70('0x61')]=function(_0x326584,_0x2be0fc,_0x4b5b19,_0x370eeb,_0x152003,_0x186550){var _0x18e64c,_0x20f977,_0x13c092,_0x363722;_0x186550[_0x6e70('0x24')]=intUtil[_0x6e70('0x5a')](_0x186550[_0x6e70('0x24')]);_0x186550['serverUrl']=intUtil[_0x6e70('0x5a')](_0x186550[_0x6e70('0x4d')]);if(_0x152003&&_0x152003[_0x6e70('0x48')]){logger['info']('[ABANDONED]',_0x6e70('0x4a'));_0x2be0fc[_0x6e70('0x4b')]=util[_0x6e70('0x29')](_0x6e70('0x4c'),_0x186550[_0x6e70('0x4d')],_0x2be0fc['uniqueid'],md5(_0x2be0fc['uniqueid']));}else{_0x2be0fc[_0x6e70('0x4b')]='';}return getConnection(_0x186550)[_0x6e70('0x34')](function(_0x56d4d9){_0x363722=_0x56d4d9;return getUser(_0x186550,_0x370eeb?_0x370eeb[_0x6e70('0x4f')]:'',_0x363722);})[_0x6e70('0x34')](function(_0xf7a034){_0x18e64c=_0xf7a034;logger[_0x6e70('0x1a')](_0x6e70('0x5d'),_0x18e64c['id']);return getEndUser(_0x186550,_0x2be0fc[_0x6e70('0x50')],_0x2be0fc[_0x6e70('0x51')],_0x363722);})[_0x6e70('0x34')](function(_0x3650e9){_0x20f977=_0x3650e9;logger[_0x6e70('0x1a')](_0x6e70('0x52'),_0x20f977['id']);return createTicket(_0x186550,_0x18e64c,_0x20f977,_0x4b5b19,_0x2be0fc,_0x4b5b19[_0x6e70('0x53')],_0x363722);})[_0x6e70('0x34')](function(_0x2473e8){_0x13c092=_0x2473e8;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1a')]('The\x20Ticket\x20ID\x20is:',_0x13c092['id']);})[_0x6e70('0x2c')](function(_0x4b2d40){logger['error'](_0x6e70('0x62'),JSON['stringify'](_0x4b2d40));});}; \ No newline at end of file +var _0xd8b0=['customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Descriptions','%s/webservice.php','remoteUri','create','admin','sessionName','HelpDesk','stringify','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','test','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','Searching\x20end\x20user\x20with\x20phone','format','success','Enduser\x20found!','firstname','POST','Contacts','lastname','phone','username','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','user:%s','trigger:browser:url','stripTrailingSlash','recordingFormat','none','Recording\x20is\x20enabled!','email','The\x20User\x20ID\x20is:','destcalleridname','Fields','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]','abandoned','[ABANDONED]','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','type','idField','content','toString','variable','variableName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xd')]==='string'&&_0x2c5e9e[_0x0d8b('0xe')]){_0x1f4800[_0x2c5e9e['idField']]=_0x2c5e9e[_0x0d8b('0xf')][_0x0d8b('0x10')]();}else if(_0x2c5e9e[_0x0d8b('0xd')]===_0x0d8b('0x11')&&_0x2c5e9e[_0x0d8b('0x12')]&&_0x2c5e9e[_0x0d8b('0xe')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x12')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xe')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x12')]][_0x0d8b('0x10')]();}else if(_0x2c5e9e[_0x0d8b('0xd')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0x14')]['name']&&_0x2c5e9e[_0x0d8b('0xe')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')][_0x0d8b('0x15')][_0x0d8b('0x16')]()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xe')]]=_0x3b027f[_0x2c5e9e['Variable'][_0x0d8b('0x15')][_0x0d8b('0x16')]()][_0x0d8b('0x10')]();}});}return _0x1f4800;}function createTicket(_0x5fecbd,_0x333674,_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e){logger[_0x0d8b('0x17')](_0x0d8b('0x18'));var _0x143372=_[_0x0d8b('0x19')]({'parent_id':'','assigned_user_id':_0x333674['id'],'ticketpriorities':_0x0d8b('0x1a'),'ticketstatus':_0x0d8b('0x1b'),'ticket_title':intUtil[_0x0d8b('0x1c')](_0x264b39['Subjects'],_0xa3612a,'\x20'),'description':intUtil['getString'](_0x264b39[_0x0d8b('0x1d')],_0xa3612a,'\x0a'),'contact_id':_0x18dd2d['id']},getCustomFields(_0x4a15bf,_0xa3612a));var _0x54a9a7={'method':'POST','uri':util['format'](_0x0d8b('0x1e'),_0x5fecbd[_0x0d8b('0x1f')]),'form':{'operation':_0x0d8b('0x20'),'username':_0x0d8b('0x21'),'sessionName':_0x27512e[_0x0d8b('0x22')],'elementType':_0x0d8b('0x23'),'element':JSON[_0x0d8b('0x24')](_0x143372)},'json':!![]};return request(_0x54a9a7)[_0x0d8b('0x25')](function(_0x27b695){if(_0x27b695['success']){return BPromise[_0x0d8b('0x26')]({'id':_0x27b695[_0x0d8b('0x27')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x28'),JSON['stringify'](_0x27b695[_0x0d8b('0x29')])));}})[_0x0d8b('0x2a')](function(_0xa2af02){var _0x4fe6f9=req['query'][_0x0d8b('0x2b')]?0x1f4:_0xa2af02[_0x0d8b('0x2c')]||0x1f4;logger['error'](_0x0d8b('0x2d'),'createTicket',_0x4fe6f9,JSON[_0x0d8b('0x24')](_0xa2af02));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){logger[_0x0d8b('0x17')]('Getting\x20agent\x20with\x20email',_0x97050a);return request({'method':_0x0d8b('0x2e'),'uri':util['format'](_0x0d8b('0x1e'),_0x4b59e5[_0x0d8b('0x1f')]),'qs':{'operation':_0x0d8b('0x2f'),'username':'admin','sessionName':_0x48f24f['sessionName'],'query':util['format'](_0x0d8b('0x30'),_0x97050a)},'json':!![]})['then'](function(_0x3cdf3c){if(_0x3cdf3c['success']&&_0x3cdf3c['result'][_0x0d8b('0xb')]){logger[_0x0d8b('0x17')](_0x0d8b('0x31'));return BPromise[_0x0d8b('0x26')]({'id':_0x3cdf3c[_0x0d8b('0x27')][0x0]['id'],'email':_0x3cdf3c[_0x0d8b('0x27')][0x0][_0x0d8b('0x32')],'name':_0x3cdf3c[_0x0d8b('0x27')][0x0]['first_name']+'\x20'+_0x3cdf3c[_0x0d8b('0x27')][_0x0d8b('0x33')]});}else{logger['info'](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x26')]({'id':_0x48f24f[_0x0d8b('0x35')],'email':_0x4b59e5['username'],'name':_0x0d8b('0x21')});}})[_0x0d8b('0x2a')](function(_0x206157){var _0x31ceba=req[_0x0d8b('0x2f')]['test']?0x1f4:_0x206157[_0x0d8b('0x2c')]||0x1f4;logger[_0x0d8b('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0d8b('0x36'),_0x31ceba,JSON[_0x0d8b('0x24')](_0x206157));});}function getEndUser(_0x188af2,_0x974b9b,_0x373544,_0x519088){logger['info'](_0x0d8b('0x37'),_0x373544);return request({'method':'GET','uri':util['format'](_0x0d8b('0x1e'),_0x188af2[_0x0d8b('0x1f')]),'qs':{'operation':_0x0d8b('0x2f'),'username':_0x0d8b('0x21'),'sessionName':_0x519088[_0x0d8b('0x22')],'query':util[_0x0d8b('0x38')]('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;',_0x373544,_0x373544,_0x373544,_0x373544,_0x373544)},'json':!![]})[_0x0d8b('0x25')](function(_0x6a02ad){if(_0x6a02ad[_0x0d8b('0x39')]&&_0x6a02ad[_0x0d8b('0x27')][_0x0d8b('0xb')]){logger[_0x0d8b('0x17')](_0x0d8b('0x3a'));return BPromise['resolve']({'id':_0x6a02ad[_0x0d8b('0x27')][0x0]['id'],'name':_0x6a02ad[_0x0d8b('0x27')][0x0][_0x0d8b('0x3b')]+'\x20'+_0x6a02ad[_0x0d8b('0x27')][0x0]['lastname'],'phone':_0x373544});}else{logger[_0x0d8b('0x17')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x0d8b('0x3c'),'uri':util[_0x0d8b('0x38')](_0x0d8b('0x1e'),_0x188af2[_0x0d8b('0x1f')]),'form':{'operation':_0x0d8b('0x20'),'sessionName':_0x519088[_0x0d8b('0x22')],'elementType':_0x0d8b('0x3d'),'element':JSON[_0x0d8b('0x24')]({'lastname':_0x974b9b,'phone':_0x373544,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x25')](function(_0x2c3c84){logger['info']('Enduser\x20created.');return BPromise['resolve']({'id':_0x2c3c84['result']['id'],'name':_0x2c3c84['result'][_0x0d8b('0x3e')],'phone':_0x2c3c84[_0x0d8b('0x27')][_0x0d8b('0x3f')]});})['catch'](function(_0x4a76a3){var _0x1b216d=req[_0x0d8b('0x2f')][_0x0d8b('0x2b')]?0x1f4:_0x4a76a3['statusCode']||0x1f4;logger[_0x0d8b('0x29')](_0x0d8b('0x2d'),'getEndUser',_0x1b216d,JSON['stringify'](_0x4a76a3));});}});}function getConnection(_0x372740){var _0x495870=_0x372740[_0x0d8b('0x40')];var _0x5a96b1=_0x372740['accessKey'];return request({'method':_0x0d8b('0x2e'),'uri':util[_0x0d8b('0x38')]('%s/webservice.php',_0x372740['remoteUri']),'qs':{'operation':'getchallenge','username':_0x495870},'json':!![]})['then'](function(_0x374d40){if(_0x374d40[_0x0d8b('0x39')]){return request({'method':_0x0d8b('0x3c'),'uri':util['format'](_0x0d8b('0x1e'),_0x372740[_0x0d8b('0x1f')]),'form':{'operation':_0x0d8b('0x41'),'username':_0x0d8b('0x21'),'accessKey':md5(_0x374d40[_0x0d8b('0x27')][_0x0d8b('0x42')]+_0x5a96b1)},'json':!![]});}})[_0x0d8b('0x25')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x39')]){return BPromise[_0x0d8b('0x26')](_0x1d5067[_0x0d8b('0x27')]);}else{throw new Error(util[_0x0d8b('0x38')](_0x0d8b('0x43'),_0x372740['id']));}})[_0x0d8b('0x2a')](function(_0x570af8){var _0xdfcf32=req[_0x0d8b('0x2f')][_0x0d8b('0x2b')]?0x1f4:_0x570af8[_0x0d8b('0x2c')]||0x1f4;logger['error'](_0x0d8b('0x2d'),'getConnection',_0xdfcf32,JSON['stringify'](_0x570af8));});}function request(_0x39a31d){logger[_0x0d8b('0x17')](_0x0d8b('0x44'),JSON[_0x0d8b('0x24')](_0x39a31d));return rp(_0x39a31d);}exports['queue']=function(_0x131579,_0x1106d6,_0x386074,_0x241587,_0x45cd22,_0x4cd85a){var _0x5c0824,_0x4e4d5f,_0x573f4f,_0x368ede;_0x4cd85a[_0x0d8b('0x1f')]=intUtil['stripTrailingSlash'](_0x4cd85a['remoteUri']);if(_0x45cd22&&_0x45cd22[_0x0d8b('0x45')]){logger[_0x0d8b('0x17')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1106d6[_0x0d8b('0x46')]=util[_0x0d8b('0x38')](_0x0d8b('0x47'),_0x4cd85a[_0x0d8b('0x48')],_0x1106d6[_0x0d8b('0x49')],md5(_0x1106d6['uniqueid']));}else{_0x1106d6[_0x0d8b('0x46')]='';}return getConnection(_0x4cd85a)[_0x0d8b('0x25')](function(_0x5481fc){_0x368ede=_0x5481fc;return getUser(_0x4cd85a,_0x241587?_0x241587['email']:'',_0x368ede);})[_0x0d8b('0x25')](function(_0x3f2d95){_0x5c0824=_0x3f2d95;logger['info']('The\x20User\x20ID\x20is:',_0x5c0824['id']);return getEndUser(_0x4cd85a,_0x1106d6[_0x0d8b('0x4a')],_0x1106d6[_0x0d8b('0x4b')],_0x368ede);})[_0x0d8b('0x25')](function(_0xb58818){_0x4e4d5f=_0xb58818;logger['info'](_0x0d8b('0x4c'),_0x4e4d5f['id']);return createTicket(_0x4cd85a,_0x5c0824,_0x4e4d5f,_0x386074,_0x1106d6,_0x386074['Fields'],_0x368ede);})['then'](function(_0x38c24e){_0x573f4f=_0x38c24e;logger[_0x0d8b('0x17')]('Ticket\x20created!');logger['info'](_0x0d8b('0x4d'),_0x573f4f['id']);var _0x3d7161=util[_0x0d8b('0x38')](_0x0d8b('0x4e'),_0x4cd85a[_0x0d8b('0x1f')],_[_0x0d8b('0x4f')](_0x573f4f['id'],'x')[0x1]);logger[_0x0d8b('0x17')](_0x0d8b('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0d8b('0x38')](_0x0d8b('0x51'),_0x241587[_0x0d8b('0x15')]),_0x0d8b('0x52'),{'uri':_0x3d7161});})[_0x0d8b('0x2a')](function(_0x47104e){logger[_0x0d8b('0x29')](_0x0d8b('0x50'),JSON[_0x0d8b('0x24')](_0x47104e));});};exports['outbound']=function(_0x2a8fad,_0x451940,_0x180b7b,_0x23de9e,_0x43ad22,_0x577951,_0x1e1dce){var _0x2d6284,_0x181d49,_0x17a87f,_0x1d6cd4;_0x577951['remoteUri']=intUtil['stripTrailingSlash'](_0x577951[_0x0d8b('0x1f')]);_0x577951[_0x0d8b('0x48')]=intUtil[_0x0d8b('0x53')](_0x577951[_0x0d8b('0x48')]);if(_0x1e1dce&&_0x1e1dce['recordingFormat']&&_0x1e1dce[_0x0d8b('0x54')]!==_0x0d8b('0x55')){logger[_0x0d8b('0x17')]('[OUTBOUND]',_0x0d8b('0x56'));_0x451940['recordingURL']=util[_0x0d8b('0x38')](_0x0d8b('0x47'),_0x577951[_0x0d8b('0x48')],_0x451940[_0x0d8b('0x49')],md5(_0x451940[_0x0d8b('0x49')]));}return getConnection(_0x577951)[_0x0d8b('0x25')](function(_0x5b5fdb){_0x1d6cd4=_0x5b5fdb;return getUser(_0x577951,_0x23de9e?_0x23de9e[_0x0d8b('0x57')]:'',_0x1d6cd4);})['then'](function(_0x71e8d8){_0x2d6284=_0x71e8d8;logger[_0x0d8b('0x17')](_0x0d8b('0x58'),_0x2d6284['id']);return getEndUser(_0x577951,_0x451940[_0x0d8b('0x59')],_0x451940['destcalleridnum'],_0x1d6cd4);})[_0x0d8b('0x25')](function(_0x34d01f){_0x181d49=_0x34d01f;logger[_0x0d8b('0x17')](_0x0d8b('0x4c'),_0x181d49['id']);return createTicket(_0x577951,_0x2d6284,_0x181d49,_0x180b7b,_0x451940,_0x180b7b[_0x0d8b('0x5a')],_0x1d6cd4);})[_0x0d8b('0x25')](function(_0x223fd8){_0x17a87f=_0x223fd8;logger[_0x0d8b('0x17')](_0x0d8b('0x5b'));logger[_0x0d8b('0x17')]('The\x20Ticket\x20ID\x20is:',_0x17a87f['id']);var _0x4ee1e8=util[_0x0d8b('0x38')](_0x0d8b('0x4e'),_0x577951['remoteUri'],_[_0x0d8b('0x4f')](_0x17a87f['id'],'x')[0x1]);logger['info']('[OUTBOUND]',_0x0d8b('0x5c'));emit(util[_0x0d8b('0x38')]('user:%s',_0x23de9e['name']),_0x0d8b('0x52'),{'uri':_0x4ee1e8});})[_0x0d8b('0x2a')](function(_0x70e4b2){logger[_0x0d8b('0x29')](_0x0d8b('0x5d'),JSON[_0x0d8b('0x24')](_0x70e4b2));});};exports[_0x0d8b('0x5e')]=function(_0x5b4402,_0x1ca60c,_0x5878c2,_0x1a203e,_0x2c6242,_0x2bb690){var _0x14a34b,_0x49f610,_0x3fe47d,_0x4a1c4a;_0x2bb690[_0x0d8b('0x1f')]=intUtil[_0x0d8b('0x53')](_0x2bb690[_0x0d8b('0x1f')]);_0x2bb690[_0x0d8b('0x48')]=intUtil[_0x0d8b('0x53')](_0x2bb690[_0x0d8b('0x48')]);if(_0x2c6242&&_0x2c6242[_0x0d8b('0x45')]){logger[_0x0d8b('0x17')](_0x0d8b('0x5f'),_0x0d8b('0x56'));_0x1ca60c['recordingURL']=util[_0x0d8b('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2bb690[_0x0d8b('0x48')],_0x1ca60c[_0x0d8b('0x49')],md5(_0x1ca60c['uniqueid']));}else{_0x1ca60c[_0x0d8b('0x46')]='';}return getConnection(_0x2bb690)['then'](function(_0x10c318){_0x4a1c4a=_0x10c318;return getUser(_0x2bb690,_0x1a203e?_0x1a203e[_0x0d8b('0x57')]:'',_0x4a1c4a);})[_0x0d8b('0x25')](function(_0x259ac9){_0x14a34b=_0x259ac9;logger[_0x0d8b('0x17')](_0x0d8b('0x58'),_0x14a34b['id']);return getEndUser(_0x2bb690,_0x1ca60c[_0x0d8b('0x4a')],_0x1ca60c[_0x0d8b('0x4b')],_0x4a1c4a);})['then'](function(_0x10eca6){_0x49f610=_0x10eca6;logger[_0x0d8b('0x17')]('The\x20Enduser\x20ID\x20is:',_0x49f610['id']);return createTicket(_0x2bb690,_0x14a34b,_0x49f610,_0x5878c2,_0x1ca60c,_0x5878c2[_0x0d8b('0x5a')],_0x4a1c4a);})[_0x0d8b('0x25')](function(_0x303d6){_0x3fe47d=_0x303d6;logger[_0x0d8b('0x17')](_0x0d8b('0x5b'));logger[_0x0d8b('0x17')](_0x0d8b('0x4d'),_0x3fe47d['id']);})[_0x0d8b('0x2a')](function(_0x466082){logger[_0x0d8b('0x29')](_0x0d8b('0x5f'),JSON[_0x0d8b('0x24')](_0x466082));});}; \ 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 855a341..e29ba11 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 _0x9c15=['agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','authType','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','GET','map','forEach','string','nameField','toLowerCase','content','type','idField','variable','variableName','customField','custom_fields','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','recordingURL','destcalleridname','integrationTab','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','The\x20Enduser\x20ID\x20is:','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','getString','Descriptions','Fields','Ticket\x20created!','ticket','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results'];(function(_0x3d76aa,_0x53d9a9){var _0x45f536=function(_0x488975){while(--_0x488975){_0x3d76aa['push'](_0x3d76aa['shift']());}};_0x45f536(++_0x53d9a9);}(_0x9c15,0x1e9));var _0x59c1=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9c15[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x59c1('0x0'));var rp=require(_0x59c1('0x1'));var md5=require(_0x59c1('0x2'));var util=require(_0x59c1('0x3'));var Redis=require(_0x59c1('0x4'));var intUtil=require(_0x59c1('0x5'));var config=require(_0x59c1('0x6'));var logger=require(_0x59c1('0x7'))(_0x59c1('0x8'));config[_0x59c1('0x9')]=_[_0x59c1('0xa')](config[_0x59c1('0x9')],{'host':_0x59c1('0xb'),'port':0x18eb});var io=require(_0x59c1('0xc'))(new Redis(config[_0x59c1('0x9')]));function emit(_0x479407,_0x47b3d7,_0x578bcf){io['to'](_0x479407)[_0x59c1('0xd')](_0x47b3d7,_0x578bcf);}var headers={'Content-Type':_0x59c1('0xe'),'Accept':_0x59c1('0xe')};function getTicket(_0xe9ffef,_0x32b9c9,_0x26e40e,_0xe4d925,_0x27182a){logger[_0x59c1('0xf')](_0x59c1('0x10'));return request({'uri':util[_0x59c1('0x11')]('%s/tickets.json',_0xe9ffef[_0x59c1('0x12')]),'method':_0x59c1('0x13'),'body':{'ticket':_['merge']({'requester_id':_0x26e40e['id'],'submitter_id':_0x32b9c9?_0x32b9c9['id']:undefined,'assignee_id':_0x32b9c9?_0x32b9c9['id']:undefined,'tags':getTags(_0xe4d925[_0x59c1('0x14')],'name'),'subject':intUtil[_0x59c1('0x15')](_0xe4d925['Subjects'],_0x27182a,'\x20'),'description':intUtil[_0x59c1('0x15')](_0xe4d925[_0x59c1('0x16')],_0x27182a,'\x0a'),'comment':{'public':![],'body':intUtil[_0x59c1('0x15')](_0xe4d925[_0x59c1('0x16')],_0x27182a,'\x0a')}},getCustomFields(_0xe4d925[_0x59c1('0x17')],_0x27182a))}})['then'](function(_0x2c76a2){logger['info'](_0x59c1('0x18'));return _0x2c76a2[_0x59c1('0x19')];});}function getUser(_0x56ba22,_0x3728c5){logger[_0x59c1('0xf')]('Getting\x20agent\x20with\x20email',_0x3728c5);return request({'uri':util[_0x59c1('0x11')](_0x59c1('0x1a'),_0x56ba22[_0x59c1('0x12')]),'qs':{'query':util[_0x59c1('0x11')](_0x59c1('0x1b'),_0x3728c5)}})['then'](function(_0x5e70c4){if(_0x5e70c4[_0x59c1('0x1c')]){logger['info']('Agent\x20found!');return _[_0x59c1('0x1d')](_0x5e70c4[_0x59c1('0x1e')],{'email':_0x3728c5,'role':_0x59c1('0x1f')});}else{logger[_0x59c1('0xf')](_0x59c1('0x20'));return request({'uri':util[_0x59c1('0x11')](_0x59c1('0x21'),_0x56ba22['remoteUri'])})[_0x59c1('0x22')](function(_0x1689b4){logger[_0x59c1('0xf')](_0x59c1('0x23'));return _0x1689b4[_0x59c1('0x24')];});}});}function getEndUser(_0x59ef8b,_0x2cfd45,_0x2a3f34){logger['info'](_0x59c1('0x25'),_0x2a3f34);return request({'uri':util[_0x59c1('0x11')](_0x59c1('0x1a'),_0x59ef8b[_0x59c1('0x12')]),'qs':{'query':util[_0x59c1('0x11')]('type:user\x20role:end-user\x20phone:%s',_0x2a3f34)}})[_0x59c1('0x22')](function(_0x5e7e2b){var _0x370464;if(_0x5e7e2b[_0x59c1('0x1e')][_0x59c1('0x26')]){_0x5e7e2b[_0x59c1('0x1e')]=_[_0x59c1('0x27')](_0x5e7e2b[_0x59c1('0x1e')],{'suspended':![],'role':_0x59c1('0x28')});if(_0x5e7e2b[_0x59c1('0x1e')][_0x59c1('0x26')]){_0x370464=_['first'](_0x5e7e2b['results']);}}if(_0x370464){logger[_0x59c1('0xf')]('Enduser\x20found!');return _0x370464;}else{logger[_0x59c1('0xf')](_0x59c1('0x29'));return request({'uri':util[_0x59c1('0x11')]('%s/users.json',_0x59ef8b[_0x59c1('0x12')]),'method':'POST','body':{'user':{'role':_0x59c1('0x28'),'name':util[_0x59c1('0x11')]('Caller\x20-\x20%s',_0x2cfd45||_0x2a3f34),'phone':_0x2a3f34}}})[_0x59c1('0x22')](function(_0x1b2e7c){logger[_0x59c1('0xf')](_0x59c1('0x2a'));return _0x1b2e7c[_0x59c1('0x24')];});}});}function getAuth(_0x159418){var _0x4ed6a0;if(_0x159418[_0x59c1('0x2b')]==='password'){_0x4ed6a0=util[_0x59c1('0x11')]('%s:%s',_0x159418[_0x59c1('0x2c')],_0x159418[_0x59c1('0x2d')]);}else if(_0x159418['authType']===_0x59c1('0x2e')){_0x4ed6a0=util[_0x59c1('0x11')](_0x59c1('0x2f'),_0x159418[_0x59c1('0x2c')],_0x159418[_0x59c1('0x2e')]);}return util['format'](_0x59c1('0x30'),new Buffer(_0x4ed6a0)[_0x59c1('0x31')](_0x59c1('0x32')));}function request(_0x50d3e2){logger[_0x59c1('0x33')]('[HTTP]',JSON[_0x59c1('0x34')](_0x50d3e2));return rp(_[_0x59c1('0xa')](_0x50d3e2,{'method':_0x59c1('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x1bd5e7,_0x3d20b1){var _0x1db064=[];if(_0x1bd5e7&&_0x1bd5e7[_0x59c1('0x26')]>0x0){_0x1db064=_[_0x59c1('0x36')](_0x1bd5e7,_0x3d20b1);}return _0x1db064;}function getCustomFields(_0x4dbace,_0x2fe79b){var _0xfc51d7=[];var _0x430fbe={'custom_fields':[]};if(_0x4dbace[_0x59c1('0x26')]>0x0){_[_0x59c1('0x37')](_0x4dbace,function(_0x556db8){if(_0x556db8['type']===_0x59c1('0x38')&&_0x556db8[_0x59c1('0x39')]&&!_0x556db8['customField']){_0x430fbe[_0x556db8[_0x59c1('0x39')][_0x59c1('0x3a')]()]=_0x556db8[_0x59c1('0x3b')][_0x59c1('0x31')]();}else if(_0x556db8[_0x59c1('0x3c')]===_0x59c1('0x38')&&_0x556db8[_0x59c1('0x3d')]&&_0x556db8['customField']){_0x430fbe['custom_fields']['push']({'id':_0x556db8[_0x59c1('0x3d')],'value':_0x556db8[_0x59c1('0x3b')]['toString']()});}else if(_0x556db8['type']===_0x59c1('0x3e')&&_0x556db8[_0x59c1('0x3f')]&&_0x556db8[_0x59c1('0x3d')]&&_0x556db8[_0x59c1('0x40')]){_0x2fe79b[_0x556db8['variableName']]&&_0x430fbe[_0x59c1('0x41')][_0x59c1('0x42')]({'id':_0x556db8[_0x59c1('0x3d')],'value':_0x2fe79b[_0x556db8[_0x59c1('0x3f')]][_0x59c1('0x31')]()});}else if(_0x556db8[_0x59c1('0x3c')]===_0x59c1('0x43')&&_0x556db8['Variable']&&_0x556db8[_0x59c1('0x44')][_0x59c1('0x45')]&&_0x556db8[_0x59c1('0x3d')]&&_0x556db8[_0x59c1('0x40')]){_0x2fe79b[_0x556db8['Variable']['name'][_0x59c1('0x3a')]()]&&_0x430fbe[_0x59c1('0x41')][_0x59c1('0x42')]({'id':_0x556db8[_0x59c1('0x3d')],'value':_0x2fe79b[_0x556db8[_0x59c1('0x44')][_0x59c1('0x45')]['toLowerCase']()][_0x59c1('0x31')]()});}});}return _0x430fbe;}exports[_0x59c1('0x46')]=function(_0x3ed0d9,_0x53d0b4,_0x3a9518,_0x5e3494,_0x14b973,_0x423135){var _0x1f65b2,_0x1c72cb;_0x423135[_0x59c1('0x12')]=intUtil[_0x59c1('0x47')](_0x423135[_0x59c1('0x12')]);_0x423135[_0x59c1('0x48')]=intUtil[_0x59c1('0x47')](_0x423135['serverUrl']);if(_0x14b973&&_0x14b973[_0x59c1('0x49')]){logger['info'](_0x59c1('0x4a'),_0x59c1('0x4b'));_0x53d0b4['recordingURL']=util[_0x59c1('0x11')](_0x59c1('0x4c'),_0x423135[_0x59c1('0x48')],_0x53d0b4[_0x59c1('0x4d')],md5(_0x53d0b4[_0x59c1('0x4d')]));}else{_0x53d0b4['recordingURL']='';}headers[_0x59c1('0x4e')]=getAuth(_0x423135);return getUser(_0x423135,_0x5e3494[_0x59c1('0x4f')])[_0x59c1('0x22')](function(_0x425efc){_0x1f65b2=_0x425efc;logger[_0x59c1('0xf')](_0x59c1('0x50'),_0x1f65b2['id']);return getEndUser(_0x423135,_0x53d0b4[_0x59c1('0x51')],_0x53d0b4['calleridnum']);})['then'](function(_0xe01e28){_0x1c72cb=_0xe01e28;logger[_0x59c1('0xf')]('The\x20Enduser\x20ID\x20is:',_0x1c72cb['id']);return getTicket(_0x423135,_0x1f65b2,_0x1c72cb,_0x3a9518,_0x53d0b4);})[_0x59c1('0x22')](function(_0x4b5536){if(_0x4b5536){logger[_0x59c1('0xf')](_0x59c1('0x52'),_0x4b5536['id']);switch(_0x423135['type']){case'integrationTab':logger[_0x59c1('0xf')](_0x59c1('0x4a'),_0x59c1('0x53'));return request({'uri':util[_0x59c1('0x11')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x423135['remoteUri'],_0x1f65b2['id'],_0x4b5536['id']),'method':_0x59c1('0x13')});case _0x59c1('0x54'):logger[_0x59c1('0xf')](_0x59c1('0x4a'),_0x59c1('0x55'));emit(util[_0x59c1('0x11')](_0x59c1('0x56'),_0x5e3494[_0x59c1('0x45')]),_0x59c1('0x57'),{'uri':util['format'](_0x59c1('0x58'),_0x423135[_0x59c1('0x12')],_0x4b5536['id'])});break;default:logger['error'](_0x59c1('0x4a'),_0x59c1('0x59'));}}})[_0x59c1('0x5a')](function(_0xb9c3c5){logger[_0x59c1('0x5b')](_0x59c1('0x5c'),util[_0x59c1('0x5d')](_0xb9c3c5,{'showHidden':!![],'depth':null}));});};exports[_0x59c1('0x5e')]=function(_0x12f016,_0x582982,_0x36e435,_0x528e9d,_0x364c57,_0x53df45,_0x5af639){var _0x1b0295,_0x34e019;_0x53df45[_0x59c1('0x12')]=intUtil[_0x59c1('0x47')](_0x53df45['remoteUri']);_0x53df45[_0x59c1('0x48')]=intUtil['stripTrailingSlash'](_0x53df45['serverUrl']);if(_0x5af639&&_0x5af639[_0x59c1('0x5f')]&&_0x5af639['recordingFormat']!=='none'){logger['info']('[OUTBOUND]',_0x59c1('0x4b'));_0x582982[_0x59c1('0x60')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x53df45['serverUrl'],_0x582982[_0x59c1('0x4d')],md5(_0x582982[_0x59c1('0x4d')]));}headers[_0x59c1('0x4e')]=getAuth(_0x53df45);return getUser(_0x53df45,_0x528e9d[_0x59c1('0x4f')])[_0x59c1('0x22')](function(_0xd71754){_0x1b0295=_0xd71754;logger[_0x59c1('0xf')]('The\x20User\x20ID\x20is:',_0x1b0295['id']);return getEndUser(_0x53df45,_0x582982[_0x59c1('0x61')],_0x582982['destcalleridnum']);})[_0x59c1('0x22')](function(_0x43f1a1){_0x34e019=_0x43f1a1;logger[_0x59c1('0xf')]('The\x20Enduser\x20ID\x20is:',_0x34e019['id']);return getTicket(_0x53df45,_0x1b0295,_0x34e019,_0x36e435,_0x582982);})[_0x59c1('0x22')](function(_0x46a1ac){if(_0x46a1ac){logger['info'](_0x59c1('0x52'),_0x46a1ac['id']);switch(_0x53df45['type']){case _0x59c1('0x62'):logger[_0x59c1('0xf')](_0x59c1('0x63'),_0x59c1('0x53'));return request({'uri':util[_0x59c1('0x11')](_0x59c1('0x64'),_0x53df45[_0x59c1('0x12')],_0x1b0295['id'],_0x46a1ac['id']),'method':_0x59c1('0x13')});case _0x59c1('0x54'):logger[_0x59c1('0xf')](_0x59c1('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x59c1('0x11')](_0x59c1('0x56'),_0x528e9d[_0x59c1('0x45')]),_0x59c1('0x57'),{'uri':util[_0x59c1('0x11')](_0x59c1('0x58'),_0x53df45[_0x59c1('0x12')],_0x46a1ac['id'])});break;default:logger[_0x59c1('0x5b')]('[OUTBOUND]',_0x59c1('0x59'));}}})[_0x59c1('0x5a')](function(_0x2784d1){logger[_0x59c1('0x5b')](_0x59c1('0x65'),util[_0x59c1('0x5d')](_0x2784d1,{'showHidden':!![],'depth':null}));});};exports['abandoned']=function(_0x17aa38,_0x54fecc,_0x398e12,_0x261666,_0x14d551,_0x34e037){var _0x43b2c9,_0x35e817;_0x34e037[_0x59c1('0x12')]=intUtil[_0x59c1('0x47')](_0x34e037['remoteUri']);_0x34e037[_0x59c1('0x48')]=intUtil[_0x59c1('0x47')](_0x34e037[_0x59c1('0x48')]);if(_0x14d551&&_0x14d551['monitor_format']){logger['info']('[ABANDONED]',_0x59c1('0x4b'));_0x54fecc['recordingURL']=util[_0x59c1('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34e037['serverUrl'],_0x54fecc[_0x59c1('0x4d')],md5(_0x54fecc[_0x59c1('0x4d')]));}else{_0x54fecc['recordingURL']='';}headers[_0x59c1('0x4e')]=getAuth(_0x34e037);return getUser(_0x34e037)[_0x59c1('0x22')](function(_0x2ca2d8){_0x43b2c9=_0x2ca2d8;logger[_0x59c1('0xf')](_0x59c1('0x50'),_0x43b2c9['id']);return getEndUser(_0x34e037,_0x54fecc[_0x59c1('0x51')],_0x54fecc['calleridnum']);})[_0x59c1('0x22')](function(_0x55fc2f){_0x35e817=_0x55fc2f;logger['info'](_0x59c1('0x66'),_0x35e817['id']);return getTicket(_0x34e037,_0x43b2c9,_0x35e817,_0x398e12,_0x54fecc);})[_0x59c1('0x22')](function(_0x1e72e6){if(_0x1e72e6){logger[_0x59c1('0xf')](_0x59c1('0x52'),_0x1e72e6['id']);}})['catch'](function(_0x5c6571){logger[_0x59c1('0x5b')](_0x59c1('0x67'),util['inspect'](_0x5c6571,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe47a=['%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','name','getString','Descriptions','Fields','then','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','results','%s/users/me.json','Admin\x20account\x20selected.','user','length','end-user','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','debug','[HTTP]','GET','map','forEach','type','string','nameField','toLowerCase','content','toString','idField','customField','custom_fields','variable','variableName','push','customVariable','Variable','queue','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:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe47a,0x139));var _0xae47=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xe47a[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var rp=require(_0xae47('0x0'));var md5=require(_0xae47('0x1'));var util=require('util');var Redis=require(_0xae47('0x2'));var intUtil=require(_0xae47('0x3'));var config=require('../../../../config/environment');var logger=require(_0xae47('0x4'))(_0xae47('0x5'));config[_0xae47('0x6')]=_[_0xae47('0x7')](config[_0xae47('0x6')],{'host':_0xae47('0x8'),'port':0x18eb});var io=require(_0xae47('0x9'))(new Redis(config[_0xae47('0x6')]));function emit(_0x30da48,_0x59e674,_0x25b82e){io['to'](_0x30da48)['emit'](_0x59e674,_0x25b82e);}var headers={'Content-Type':_0xae47('0xa'),'Accept':_0xae47('0xa')};function getTicket(_0x5d9693,_0x5db7e2,_0x499d84,_0x121a13,_0x13f986){logger[_0xae47('0xb')](_0xae47('0xc'));return request({'uri':util[_0xae47('0xd')](_0xae47('0xe'),_0x5d9693[_0xae47('0xf')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x499d84['id'],'submitter_id':_0x5db7e2?_0x5db7e2['id']:undefined,'assignee_id':_0x5db7e2?_0x5db7e2['id']:undefined,'tags':getTags(_0x121a13[_0xae47('0x10')],_0xae47('0x11')),'subject':intUtil[_0xae47('0x12')](_0x121a13['Subjects'],_0x13f986,'\x20'),'description':intUtil[_0xae47('0x12')](_0x121a13[_0xae47('0x13')],_0x13f986,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x121a13[_0xae47('0x13')],_0x13f986,'\x0a')}},getCustomFields(_0x121a13[_0xae47('0x14')],_0x13f986))}})[_0xae47('0x15')](function(_0x119215){logger['info']('Ticket\x20created!');return _0x119215['ticket'];});}function getUser(_0x4216ac,_0x3e7a10){logger[_0xae47('0xb')](_0xae47('0x16'),_0x3e7a10);return request({'uri':util[_0xae47('0xd')](_0xae47('0x17'),_0x4216ac['remoteUri']),'qs':{'query':util[_0xae47('0xd')]('type:user\x20role:agent\x20email:%s',_0x3e7a10)}})['then'](function(_0x5a5bca){if(_0x5a5bca[_0xae47('0x18')]){logger['info'](_0xae47('0x19'));return _['find'](_0x5a5bca[_0xae47('0x1a')],{'email':_0x3e7a10,'role':'agent'});}else{logger[_0xae47('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xae47('0xd')](_0xae47('0x1b'),_0x4216ac['remoteUri'])})[_0xae47('0x15')](function(_0x265b92){logger['info'](_0xae47('0x1c'));return _0x265b92[_0xae47('0x1d')];});}});}function getEndUser(_0x24a89b,_0xf4e73c,_0x239740){logger[_0xae47('0xb')]('Searching\x20enduser\x20with\x20phone',_0x239740);return request({'uri':util[_0xae47('0xd')]('%s/search.json',_0x24a89b[_0xae47('0xf')]),'qs':{'query':util[_0xae47('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x239740)}})['then'](function(_0x57e836){var _0x533afc;if(_0x57e836['results'][_0xae47('0x1e')]){_0x57e836[_0xae47('0x1a')]=_['filter'](_0x57e836[_0xae47('0x1a')],{'suspended':![],'role':_0xae47('0x1f')});if(_0x57e836[_0xae47('0x1a')][_0xae47('0x1e')]){_0x533afc=_['first'](_0x57e836[_0xae47('0x1a')]);}}if(_0x533afc){logger[_0xae47('0xb')](_0xae47('0x20'));return _0x533afc;}else{logger[_0xae47('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xae47('0xd')](_0xae47('0x21'),_0x24a89b[_0xae47('0xf')]),'method':_0xae47('0x22'),'body':{'user':{'role':'end-user','name':util[_0xae47('0xd')](_0xae47('0x23'),_0xf4e73c||_0x239740),'phone':_0x239740}}})[_0xae47('0x15')](function(_0x2426af){logger[_0xae47('0xb')](_0xae47('0x24'));return _0x2426af[_0xae47('0x1d')];});}});}function getAuth(_0x26ae8c){var _0x6a9fa7;if(_0x26ae8c[_0xae47('0x25')]===_0xae47('0x26')){_0x6a9fa7=util[_0xae47('0xd')](_0xae47('0x27'),_0x26ae8c[_0xae47('0x28')],_0x26ae8c[_0xae47('0x26')]);}else if(_0x26ae8c[_0xae47('0x25')]==='token'){_0x6a9fa7=util['format'](_0xae47('0x29'),_0x26ae8c[_0xae47('0x28')],_0x26ae8c[_0xae47('0x2a')]);}return util[_0xae47('0xd')](_0xae47('0x2b'),new Buffer(_0x6a9fa7)['toString']('base64'));}function request(_0x90e226){logger[_0xae47('0x2c')](_0xae47('0x2d'),JSON['stringify'](_0x90e226));return rp(_[_0xae47('0x7')](_0x90e226,{'method':_0xae47('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x1484cf,_0x55c55c){var _0x10405a=[];if(_0x1484cf&&_0x1484cf['length']>0x0){_0x10405a=_[_0xae47('0x2f')](_0x1484cf,_0x55c55c);}return _0x10405a;}function getCustomFields(_0x5b016f,_0x573ba0){var _0x559930=[];var _0x1b5571={'custom_fields':[]};if(_0x5b016f[_0xae47('0x1e')]>0x0){_[_0xae47('0x30')](_0x5b016f,function(_0x40e031){if(_0x40e031[_0xae47('0x31')]===_0xae47('0x32')&&_0x40e031[_0xae47('0x33')]&&!_0x40e031['customField']){_0x1b5571[_0x40e031[_0xae47('0x33')][_0xae47('0x34')]()]=_0x40e031[_0xae47('0x35')][_0xae47('0x36')]();}else if(_0x40e031['type']==='string'&&_0x40e031[_0xae47('0x37')]&&_0x40e031[_0xae47('0x38')]){_0x1b5571[_0xae47('0x39')]['push']({'id':_0x40e031[_0xae47('0x37')],'value':_0x40e031[_0xae47('0x35')][_0xae47('0x36')]()});}else if(_0x40e031[_0xae47('0x31')]===_0xae47('0x3a')&&_0x40e031[_0xae47('0x3b')]&&_0x40e031['idField']&&_0x40e031[_0xae47('0x38')]){_0x573ba0[_0x40e031[_0xae47('0x3b')]]&&_0x1b5571[_0xae47('0x39')][_0xae47('0x3c')]({'id':_0x40e031[_0xae47('0x37')],'value':_0x573ba0[_0x40e031[_0xae47('0x3b')]][_0xae47('0x36')]()});}else if(_0x40e031[_0xae47('0x31')]===_0xae47('0x3d')&&_0x40e031[_0xae47('0x3e')]&&_0x40e031[_0xae47('0x3e')][_0xae47('0x11')]&&_0x40e031[_0xae47('0x37')]&&_0x40e031[_0xae47('0x38')]){_0x573ba0[_0x40e031['Variable'][_0xae47('0x11')][_0xae47('0x34')]()]&&_0x1b5571[_0xae47('0x39')][_0xae47('0x3c')]({'id':_0x40e031['idField'],'value':_0x573ba0[_0x40e031[_0xae47('0x3e')][_0xae47('0x11')][_0xae47('0x34')]()][_0xae47('0x36')]()});}});}return _0x1b5571;}exports[_0xae47('0x3f')]=function(_0x120ced,_0x5d3d2b,_0x3c5156,_0x3ccf92,_0x42c698,_0x394a33){var _0x110559,_0x1fb26c;_0x394a33['remoteUri']=intUtil[_0xae47('0x40')](_0x394a33[_0xae47('0xf')]);_0x394a33[_0xae47('0x41')]=intUtil[_0xae47('0x40')](_0x394a33[_0xae47('0x41')]);if(_0x42c698&&_0x42c698[_0xae47('0x42')]){logger['info']('[QUEUE]',_0xae47('0x43'));_0x5d3d2b[_0xae47('0x44')]=util[_0xae47('0xd')](_0xae47('0x45'),_0x394a33[_0xae47('0x41')],_0x5d3d2b[_0xae47('0x46')],md5(_0x5d3d2b[_0xae47('0x46')]));}else{_0x5d3d2b[_0xae47('0x44')]='';}headers[_0xae47('0x47')]=getAuth(_0x394a33);return getUser(_0x394a33,_0x3ccf92[_0xae47('0x48')])[_0xae47('0x15')](function(_0xc474f6){_0x110559=_0xc474f6;logger[_0xae47('0xb')](_0xae47('0x49'),_0x110559['id']);return getEndUser(_0x394a33,_0x5d3d2b[_0xae47('0x4a')],_0x5d3d2b[_0xae47('0x4b')]);})[_0xae47('0x15')](function(_0x5379f6){_0x1fb26c=_0x5379f6;logger[_0xae47('0xb')](_0xae47('0x4c'),_0x1fb26c['id']);return getTicket(_0x394a33,_0x110559,_0x1fb26c,_0x3c5156,_0x5d3d2b);})[_0xae47('0x15')](function(_0x54f7a8){if(_0x54f7a8){logger[_0xae47('0xb')](_0xae47('0x4d'),_0x54f7a8['id']);switch(_0x394a33[_0xae47('0x31')]){case _0xae47('0x4e'):logger['info'](_0xae47('0x4f'),_0xae47('0x50'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x394a33[_0xae47('0xf')],_0x110559['id'],_0x54f7a8['id']),'method':_0xae47('0x22')});case _0xae47('0x51'):logger['info'](_0xae47('0x4f'),_0xae47('0x52'));emit(util['format']('user:%s',_0x3ccf92[_0xae47('0x11')]),_0xae47('0x53'),{'uri':util[_0xae47('0xd')](_0xae47('0x54'),_0x394a33[_0xae47('0xf')],_0x54f7a8['id'])});break;default:logger[_0xae47('0x55')]('[QUEUE]',_0xae47('0x56'));}}})['catch'](function(_0x350a87){logger[_0xae47('0x55')](_0xae47('0x57'),util[_0xae47('0x58')](_0x350a87,{'showHidden':!![],'depth':null}));});};exports[_0xae47('0x59')]=function(_0x2371c0,_0x52cc9a,_0x1fb795,_0x286be0,_0x2bdeeb,_0x1fb8b2,_0x5082f6){var _0x18a7f6,_0x28c838;_0x1fb8b2[_0xae47('0xf')]=intUtil[_0xae47('0x40')](_0x1fb8b2[_0xae47('0xf')]);_0x1fb8b2[_0xae47('0x41')]=intUtil[_0xae47('0x40')](_0x1fb8b2['serverUrl']);if(_0x5082f6&&_0x5082f6[_0xae47('0x5a')]&&_0x5082f6['recordingFormat']!==_0xae47('0x5b')){logger[_0xae47('0xb')](_0xae47('0x5c'),'Recording\x20is\x20enabled!');_0x52cc9a[_0xae47('0x44')]=util[_0xae47('0xd')](_0xae47('0x45'),_0x1fb8b2[_0xae47('0x41')],_0x52cc9a[_0xae47('0x46')],md5(_0x52cc9a['uniqueid']));}headers[_0xae47('0x47')]=getAuth(_0x1fb8b2);return getUser(_0x1fb8b2,_0x286be0[_0xae47('0x48')])[_0xae47('0x15')](function(_0x264692){_0x18a7f6=_0x264692;logger[_0xae47('0xb')](_0xae47('0x49'),_0x18a7f6['id']);return getEndUser(_0x1fb8b2,_0x52cc9a[_0xae47('0x5d')],_0x52cc9a[_0xae47('0x5e')]);})[_0xae47('0x15')](function(_0x4b4e5c){_0x28c838=_0x4b4e5c;logger[_0xae47('0xb')](_0xae47('0x4c'),_0x28c838['id']);return getTicket(_0x1fb8b2,_0x18a7f6,_0x28c838,_0x1fb795,_0x52cc9a);})['then'](function(_0x2a4cda){if(_0x2a4cda){logger[_0xae47('0xb')](_0xae47('0x4d'),_0x2a4cda['id']);switch(_0x1fb8b2[_0xae47('0x31')]){case'integrationTab':logger['info'](_0xae47('0x5c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xae47('0xd')](_0xae47('0x5f'),_0x1fb8b2[_0xae47('0xf')],_0x18a7f6['id'],_0x2a4cda['id']),'method':_0xae47('0x22')});case'newTab':logger[_0xae47('0xb')](_0xae47('0x5c'),_0xae47('0x52'));emit(util[_0xae47('0xd')](_0xae47('0x60'),_0x286be0[_0xae47('0x11')]),_0xae47('0x53'),{'uri':util[_0xae47('0xd')](_0xae47('0x54'),_0x1fb8b2[_0xae47('0xf')],_0x2a4cda['id'])});break;default:logger[_0xae47('0x55')](_0xae47('0x5c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xae47('0x61')](function(_0x4a1738){logger[_0xae47('0x55')](_0xae47('0x62'),util['inspect'](_0x4a1738,{'showHidden':!![],'depth':null}));});};exports[_0xae47('0x63')]=function(_0x488607,_0x2a75e7,_0xd3c0fa,_0x513871,_0x35b6c2,_0xfae7d4){var _0x18ed4f,_0x52bb73;_0xfae7d4[_0xae47('0xf')]=intUtil['stripTrailingSlash'](_0xfae7d4[_0xae47('0xf')]);_0xfae7d4[_0xae47('0x41')]=intUtil['stripTrailingSlash'](_0xfae7d4[_0xae47('0x41')]);if(_0x35b6c2&&_0x35b6c2[_0xae47('0x42')]){logger[_0xae47('0xb')](_0xae47('0x64'),_0xae47('0x43'));_0x2a75e7[_0xae47('0x44')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfae7d4[_0xae47('0x41')],_0x2a75e7[_0xae47('0x46')],md5(_0x2a75e7[_0xae47('0x46')]));}else{_0x2a75e7['recordingURL']='';}headers[_0xae47('0x47')]=getAuth(_0xfae7d4);return getUser(_0xfae7d4)[_0xae47('0x15')](function(_0x5e8104){_0x18ed4f=_0x5e8104;logger['info'](_0xae47('0x49'),_0x18ed4f['id']);return getEndUser(_0xfae7d4,_0x2a75e7[_0xae47('0x4a')],_0x2a75e7[_0xae47('0x4b')]);})[_0xae47('0x15')](function(_0x3201a8){_0x52bb73=_0x3201a8;logger[_0xae47('0xb')](_0xae47('0x4c'),_0x52bb73['id']);return getTicket(_0xfae7d4,_0x18ed4f,_0x52bb73,_0xd3c0fa,_0x2a75e7);})[_0xae47('0x15')](function(_0x26fe01){if(_0x26fe01){logger[_0xae47('0xb')](_0xae47('0x4d'),_0x26fe01['id']);}})[_0xae47('0x61')](function(_0x53cbcb){logger[_0xae47('0x55')](_0xae47('0x65'),util['inspect'](_0x53cbcb,{'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 8027e1d..630a6b8 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 _0x425d=['Descriptions','Fields','lastevent','called','Called','complete','connect','Call\x20Result','rejected','Rejected','abandoned','utc','talktime','answertime','endtime','diff','mm:ss','CONTACTID','LEADID','Leads','SEID','','hasOwnProperty','%s','encodeXML','POST','https://crm.%s/crm/private/xml/Calls/insertRecords','host','authToken','crmapi','then','parse','toJson','response','result','recorddetail','Call\x20created!','Error\x20on\x20call\x20creation:\x20','Getting\x20agent\x20with\x20email','GET','https://crm.%s/crm/private/json/Users/getUsers','users','find','user','Standard','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','https://crm.%s/crm/private/json/Contacts/searchRecords','((Phone:%s))','Contacts','row','length','val','content','https://crm.%s/crm/private/json/Leads/searchRecords','Enduser\x20found\x20in\x20Leads!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','https://crm.%s/crm/private/xml/Leads/insertRecords','Error\x20on\x20Lead\x20creation:\x20','Error\x20on\x20Lead\x20retrieve:\x20','debug','[HTTP]','type','string','idField','variable','variableName','toString','Variable','name','toLowerCase','indexOf','split','queue','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','catch','error','recordingFormat','none','[OUTBOUND]','serverUrl','email','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','monitor_format','[ABANDONED]','lodash','md5','util','./util','xml2json','entities','moment','ioredis','../../../../config/logger','zoho','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20call...','merge','inbound','outbound','starttime','format','YYYY-MM-DD\x20HH:mm:ss','getString'];(function(_0xd290e6,_0x180f6a){var _0x519d12=function(_0x31ec14){while(--_0x31ec14){_0xd290e6['push'](_0xd290e6['shift']());}};_0x519d12(++_0x180f6a);}(_0x425d,0x1e0));var _0xd425=function(_0x5566b7,_0x4e9e2c){_0x5566b7=_0x5566b7-0x0;var _0x1c7ea7=_0x425d[_0x5566b7];return _0x1c7ea7;};'use strict';var _=require(_0xd425('0x0'));var rp=require('request-promise');var md5=require(_0xd425('0x1'));var util=require(_0xd425('0x2'));var intUtil=require(_0xd425('0x3'));var parser=require(_0xd425('0x4'));var entities=require(_0xd425('0x5'));var moment=require(_0xd425('0x6'));var Redis=require(_0xd425('0x7'));var config=require('../../../../config/environment');var logger=require(_0xd425('0x8'))(_0xd425('0x9'));config[_0xd425('0xa')]=_[_0xd425('0xb')](config[_0xd425('0xa')],{'host':_0xd425('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd425('0xa')]));function emit(_0x374c3d,_0x262b02,_0x3c4db2){io['to'](_0x374c3d)[_0xd425('0xd')](_0x262b02,_0x3c4db2);}var headers={'Content-Type':_0xd425('0xe'),'Accept':_0xd425('0xe')};function getCall(_0x1969ba,_0x3a7a01,_0x35a7f4,_0x3d2bcf,_0x10d463,_0x26f6d2){logger[_0xd425('0xf')](_0xd425('0x10'));var _0x2385a5=_[_0xd425('0x11')]({'SMOWNERID':_0x3a7a01['id'],'Call Type':_0x26f6d2||_0xd425('0x12'),'Call Start Time':(_0x26f6d2===_0xd425('0x13')?_0x10d463[_0xd425('0x14')]:_0x10d463['agentcalledAt'])||moment()[_0xd425('0x15')](_0xd425('0x16')),'Subject':intUtil[_0xd425('0x17')](_0x3d2bcf['Subjects'],_0x10d463,'\x20'),'Description':intUtil[_0xd425('0x17')](_0x3d2bcf[_0xd425('0x18')],_0x10d463,'\x0a')},getCustomFields(_0x3d2bcf[_0xd425('0x19')],_0x10d463));switch(_0x10d463[_0xd425('0x1a')]){case _0xd425('0x1b'):_0x2385a5['Call\x20Result']=_0xd425('0x1c');break;case _0xd425('0x1d'):case _0xd425('0x1e'):_0x2385a5[_0xd425('0x1f')]='Answered';break;case _0xd425('0x20'):_0x2385a5[_0xd425('0x1f')]=_0xd425('0x21');break;case _0xd425('0x22'):_0x2385a5['Call\x20Result']='Abandoned';break;default:}if(_0x10d463['talktime']){_0x2385a5['Call\x20Duration']=moment[_0xd425('0x23')](parseInt(_0x10d463[_0xd425('0x24')])*0x3e8)[_0xd425('0x15')]('mm:ss');}else if(_0x10d463[_0xd425('0x25')]&&_0x10d463[_0xd425('0x26')]){_0x2385a5['Call\x20Duration']=moment[_0xd425('0x23')](moment(_0x10d463[_0xd425('0x26')],_0xd425('0x16'))[_0xd425('0x27')](moment(_0x10d463[_0xd425('0x14')],_0xd425('0x16'))))[_0xd425('0x15')](_0xd425('0x28'));}if(_0x35a7f4[_0xd425('0x29')]){_0x2385a5[_0xd425('0x29')]=_0x35a7f4[_0xd425('0x29')];}else if(_0x35a7f4[_0xd425('0x2a')]){_0x2385a5['SEMODULE']=_0xd425('0x2b');_0x2385a5[_0xd425('0x2c')]=_0x35a7f4[_0xd425('0x2a')];}var _0x1908a5=_0xd425('0x2d');for(var _0x400dd7 in _0x2385a5){if(_0x2385a5[_0xd425('0x2e')](_0x400dd7)){_0x1908a5+=util['format'](_0xd425('0x2f'),entities[_0xd425('0x30')](_0x400dd7),entities[_0xd425('0x30')](_0x2385a5[_0x400dd7]));}}_0x1908a5+='';return request({'method':_0xd425('0x31'),'uri':util[_0xd425('0x15')](_0xd425('0x32'),_0x1969ba[_0xd425('0x33')]),'qs':{'authtoken':_0x1969ba[_0xd425('0x34')],'scope':_0xd425('0x35'),'xmlData':_0x1908a5},'json':!![]})[_0xd425('0x36')](function(_0x37b63c){_0x37b63c=JSON[_0xd425('0x37')](parser[_0xd425('0x38')](_0x37b63c));if(_0x37b63c['response']){if(_0x37b63c[_0xd425('0x39')][_0xd425('0x3a')]&&_0x37b63c[_0xd425('0x39')][_0xd425('0x3a')][_0xd425('0x3b')]){logger[_0xd425('0xf')](_0xd425('0x3c'));return{'id':_0x37b63c[_0xd425('0x39')][_0xd425('0x3a')][_0xd425('0x3b')]['FL'][0x0]['$t']};}}throw new Error(_0xd425('0x3d')+JSON['stringify'](_0x37b63c));});}function getUser(_0x316493,_0x2a2a9b){_0x2a2a9b&&logger[_0xd425('0xf')](_0xd425('0x3e'),_0x2a2a9b);return request({'method':_0xd425('0x3f'),'uri':util['format'](_0xd425('0x40'),_0x316493[_0xd425('0x33')]),'qs':{'type':'AllUsers','authtoken':_0x316493['authToken'],'scope':'crmapi'},'json':!![]})[_0xd425('0x36')](function(_0xfb0c8){if(_0xfb0c8[_0xd425('0x41')]&&_0xfb0c8[_0xd425('0x41')]['user']){var _0x42b974;if(_0x2a2a9b){_0x42b974=_[_0xd425('0x42')](_0xfb0c8[_0xd425('0x41')][_0xd425('0x43')],{'email':_0x2a2a9b,'profile':_0xd425('0x44')});}if(_0x42b974){logger[_0xd425('0xf')](_0xd425('0x45'));}else{logger['info'](_0xd425('0x46'));_0x42b974=_['find'](_0xfb0c8[_0xd425('0x41')][_0xd425('0x43')],{'profile':_0xd425('0x47')});}return _0x42b974;}else{logger['error'](_0xd425('0x48'),JSON[_0xd425('0x49')](_0xfb0c8));throw new Error(_0xd425('0x4a')+JSON[_0xd425('0x49')](_0xfb0c8));}});}function getEndUser(_0x58f36d,_0x1d38fa,_0x3cf540){logger['info']('Searching\x20enduser\x20with\x20phone',_0x3cf540);return request({'method':'GET','uri':util[_0xd425('0x15')](_0xd425('0x4b'),_0x58f36d[_0xd425('0x33')]),'qs':{'authtoken':_0x58f36d['authToken'],'scope':'crmapi','criteria':util['format'](_0xd425('0x4c'),_0x3cf540)},'json':!![]})[_0xd425('0x36')](function(_0xe72957){if(_0xe72957[_0xd425('0x39')]&&_0xe72957[_0xd425('0x39')][_0xd425('0x3a')]){logger[_0xd425('0xf')]('Enduser\x20found\x20in\x20Contacts!');var _0x26383d={};var _0x3c88a8=_0xe72957[_0xd425('0x39')]['result'][_0xd425('0x4d')][_0xd425('0x4e')]['no']?_0xe72957[_0xd425('0x39')]['result'][_0xd425('0x4d')][_0xd425('0x4e')]['FL']:_0xe72957[_0xd425('0x39')][_0xd425('0x3a')]['Contacts'][_0xd425('0x4e')][0x0]['FL'];for(var _0x4668ef=0x0,_0x2b1149=_0x3c88a8[_0xd425('0x4f')];_0x4668ef<_0x2b1149;_0x4668ef++){_0x26383d[_0x3c88a8[_0x4668ef][_0xd425('0x50')]]=_0x3c88a8[_0x4668ef][_0xd425('0x51')];}return _0x26383d;}else{return request({'method':_0xd425('0x3f'),'uri':util['format'](_0xd425('0x52'),_0x58f36d[_0xd425('0x33')]),'qs':{'authtoken':_0x58f36d['authToken'],'scope':_0xd425('0x35'),'criteria':util['format']('((Phone:%s))',_0x3cf540)},'json':!![]})[_0xd425('0x36')](function(_0x59e893){if(_0x59e893[_0xd425('0x39')]&&_0x59e893['response'][_0xd425('0x3a')]){logger[_0xd425('0xf')](_0xd425('0x53'));var _0x3516f3={};var _0x4420d2=_0x59e893['response'][_0xd425('0x3a')]['Leads'][_0xd425('0x4e')]['no']?_0x59e893['response'][_0xd425('0x3a')][_0xd425('0x2b')][_0xd425('0x4e')]['FL']:_0x59e893[_0xd425('0x39')][_0xd425('0x3a')]['Leads'][_0xd425('0x4e')][0x0]['FL'];for(var _0x433777=0x0,_0x35e77b=_0x4420d2[_0xd425('0x4f')];_0x433777<_0x35e77b;_0x433777++){_0x3516f3[_0x4420d2[_0x433777][_0xd425('0x50')]]=_0x4420d2[_0x433777]['content'];}return _0x3516f3;}else{logger[_0xd425('0xf')](_0xd425('0x54'));_0x1d38fa=getName(_0x1d38fa);return request({'method':_0xd425('0x31'),'uri':util[_0xd425('0x15')](_0xd425('0x55'),_0x58f36d[_0xd425('0x33')]),'qs':{'authtoken':_0x58f36d['authToken'],'scope':_0xd425('0x35'),'xmlData':util[_0xd425('0x15')]('%s%s%s',entities[_0xd425('0x30')](_0x1d38fa[0x0]),entities[_0xd425('0x30')](_0x1d38fa[0x1]),_0x3cf540)},'json':!![]})[_0xd425('0x36')](function(_0x3c6538){_0x3c6538=JSON['parse'](parser[_0xd425('0x38')](_0x3c6538));if(_0x3c6538[_0xd425('0x39')]){if(_0x3c6538[_0xd425('0x39')][_0xd425('0x3a')]&&_0x3c6538[_0xd425('0x39')]['result']['recorddetail']){logger[_0xd425('0xf')]('Enduser\x20created.');return request({'method':_0xd425('0x3f'),'uri':util[_0xd425('0x15')]('https://crm.%s/crm/private/json/Leads/getRecordById',_0x58f36d[_0xd425('0x33')]),'qs':{'authtoken':_0x58f36d['authToken'],'scope':'crmapi','id':_0x3c6538[_0xd425('0x39')][_0xd425('0x3a')][_0xd425('0x3b')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0xd425('0x56')+JSON[_0xd425('0x49')](_0x3c6538));})[_0xd425('0x36')](function(_0xeb3586){if(_0xeb3586[_0xd425('0x39')]){if(_0xeb3586['response'][_0xd425('0x3a')]){var _0x1c6141={};for(var _0x1be9bb=0x0,_0x48ae90=_0xeb3586[_0xd425('0x39')][_0xd425('0x3a')][_0xd425('0x2b')][_0xd425('0x4e')]['FL']['length'];_0x1be9bb<_0x48ae90;_0x1be9bb++){_0x1c6141[_0xeb3586['response']['result'][_0xd425('0x2b')][_0xd425('0x4e')]['FL'][_0x1be9bb][_0xd425('0x50')]]=_0xeb3586[_0xd425('0x39')]['result']['Leads']['row']['FL'][_0x1be9bb]['content'];}return _0x1c6141;}}throw new Error(_0xd425('0x57')+JSON[_0xd425('0x49')](_0xeb3586));});}});}});}function request(_0x5abb99){logger[_0xd425('0x58')](_0xd425('0x59'),JSON[_0xd425('0x49')](_0x5abb99));return rp(_0x5abb99);}function getCustomFields(_0x57e23e,_0x517e2e){var _0x599cb5={};if(_0x57e23e['length']>0x0){_['forEach'](_0x57e23e,function(_0x5ec12a){if(_0x5ec12a[_0xd425('0x5a')]===_0xd425('0x5b')&&_0x5ec12a[_0xd425('0x5c')]){_0x599cb5[_0x5ec12a['idField']]=_0x5ec12a[_0xd425('0x51')]['toString']();}else if(_0x5ec12a[_0xd425('0x5a')]===_0xd425('0x5d')&&_0x5ec12a[_0xd425('0x5e')]&&_0x5ec12a[_0xd425('0x5c')]&&_0x517e2e[_0x5ec12a[_0xd425('0x5e')]]){_0x599cb5[_0x5ec12a[_0xd425('0x5c')]]=_0x517e2e[_0x5ec12a[_0xd425('0x5e')]][_0xd425('0x5f')]();}else if(_0x5ec12a[_0xd425('0x5a')]==='customVariable'&&_0x5ec12a[_0xd425('0x60')]&&_0x5ec12a[_0xd425('0x60')][_0xd425('0x61')]&&_0x5ec12a[_0xd425('0x5c')]&&_0x517e2e[_0x5ec12a['Variable']['name'][_0xd425('0x62')]()]){_0x599cb5[_0x5ec12a[_0xd425('0x5c')]]=_0x517e2e[_0x5ec12a[_0xd425('0x60')][_0xd425('0x61')][_0xd425('0x62')]()][_0xd425('0x5f')]();}});}return _0x599cb5;}function getName(_0x28d1ec){if(_0x28d1ec[_0xd425('0x63')]('\x20')>0x0){var _0x1fcde4=_0x28d1ec[_0xd425('0x64')](/ (.+)/);if(_0x1fcde4[0x1]){return _0x1fcde4;}}return[_0x28d1ec,_0x28d1ec];}exports[_0xd425('0x65')]=function(_0x470e6f,_0x3e0eea,_0x28979e,_0x5e72db,_0x44a6f9,_0x343cc1){var _0xd2f2e8,_0x4fd793;if(_0x44a6f9&&_0x44a6f9['monitor_format']){logger['info'](_0xd425('0x66'),_0xd425('0x67'));_0x3e0eea[_0xd425('0x68')]=util['format'](_0xd425('0x69'),_0x343cc1['serverUrl'],_0x3e0eea[_0xd425('0x6a')],md5(_0x3e0eea[_0xd425('0x6a')]));}else{_0x3e0eea[_0xd425('0x68')]='';}return getUser(_0x343cc1,_0x5e72db['email'])[_0xd425('0x36')](function(_0xf80825){_0xd2f2e8=_0xf80825;logger[_0xd425('0xf')](_0xd425('0x6b'),_0xd2f2e8['id']);return getEndUser(_0x343cc1,_0x3e0eea[_0xd425('0x6c')],_0x3e0eea[_0xd425('0x6d')]);})[_0xd425('0x36')](function(_0x44db7f){_0x4fd793=_0x44db7f;logger[_0xd425('0xf')](_0xd425('0x6e'),_0x4fd793[_0xd425('0x29')]||_0x4fd793[_0xd425('0x2a')]);return getCall(_0x343cc1,_0xd2f2e8,_0x4fd793,_0x28979e,_0x3e0eea,_0xd425('0x6f'));})[_0xd425('0x36')](function(_0x445f98){if(_0x445f98){logger[_0xd425('0xf')](_0xd425('0x70'),_0x445f98['id']);logger[_0xd425('0xf')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd425('0x15')]('user:%s',_0x5e72db[_0xd425('0x61')]),_0xd425('0x71'),{'uri':util[_0xd425('0x15')](_0xd425('0x72'),_0x343cc1['host'],_0x445f98['id'])});}})[_0xd425('0x73')](function(_0x40f591){logger[_0xd425('0x74')](_0xd425('0x66'),JSON[_0xd425('0x49')](_0x40f591));});};exports[_0xd425('0x13')]=function(_0x4c9d96,_0x4c8d7f,_0x3ccffe,_0x5b1104,_0x5e76f5,_0x174081,_0x4a9215){var _0x20f6ec,_0x46fd93;if(_0x4a9215&&_0x4a9215[_0xd425('0x75')]&&_0x4a9215[_0xd425('0x75')]!==_0xd425('0x76')){logger[_0xd425('0xf')](_0xd425('0x77'),'Recording\x20is\x20enabled!');_0x4c8d7f[_0xd425('0x68')]=util[_0xd425('0x15')](_0xd425('0x69'),_0x174081[_0xd425('0x78')],_0x4c8d7f[_0xd425('0x6a')],md5(_0x4c8d7f['uniqueid']));}return getUser(_0x174081,_0x5b1104[_0xd425('0x79')])[_0xd425('0x36')](function(_0x4e05cd){_0x20f6ec=_0x4e05cd;logger[_0xd425('0xf')](_0xd425('0x6b'),_0x20f6ec['id']);return getEndUser(_0x174081,_0x4c8d7f['destcalleridname'],_0x4c8d7f[_0xd425('0x7a')]);})[_0xd425('0x36')](function(_0x74d30b){_0x46fd93=_0x74d30b;logger[_0xd425('0xf')](_0xd425('0x6e'),_0x46fd93['CONTACTID']||_0x46fd93[_0xd425('0x2a')]);return getCall(_0x174081,_0x20f6ec,_0x46fd93,_0x3ccffe,_0x4c8d7f,'Outbound');})[_0xd425('0x36')](function(_0x38c5b7){if(_0x38c5b7){logger['info'](_0xd425('0x70'),_0x38c5b7['id']);logger[_0xd425('0xf')](_0xd425('0x77'),_0xd425('0x7b'));emit(util['format']('user:%s',_0x5b1104[_0xd425('0x61')]),_0xd425('0x71'),{'uri':util[_0xd425('0x15')]('https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s',_0x174081[_0xd425('0x33')],_0x38c5b7['id'])});}})[_0xd425('0x73')](function(_0x5b932c){logger[_0xd425('0x74')]('[OUTBOUND]',JSON[_0xd425('0x49')](_0x5b932c));});};exports[_0xd425('0x22')]=function(_0x25a217,_0x2493e7,_0x5750dc,_0x513d18,_0x2df4aa,_0x413a65){var _0x4b8cab,_0x61349a;if(_0x2df4aa&&_0x2df4aa[_0xd425('0x7c')]){logger['info'](_0xd425('0x7d'),_0xd425('0x67'));_0x2493e7[_0xd425('0x68')]=util[_0xd425('0x15')](_0xd425('0x69'),_0x413a65[_0xd425('0x78')],_0x2493e7[_0xd425('0x6a')],md5(_0x2493e7['uniqueid']));}else{_0x2493e7['recordingURL']='';}return getUser(_0x413a65)[_0xd425('0x36')](function(_0x4ba218){_0x4b8cab=_0x4ba218;logger[_0xd425('0xf')](_0xd425('0x6b'),_0x4b8cab['id']);return getEndUser(_0x413a65,_0x2493e7['calleridname'],_0x2493e7[_0xd425('0x6d')]);})[_0xd425('0x36')](function(_0x5dac05){_0x61349a=_0x5dac05;logger['info'](_0xd425('0x6e'),_0x61349a[_0xd425('0x29')]||_0x61349a[_0xd425('0x2a')]);return getCall(_0x413a65,_0x4b8cab,_0x61349a,_0x5750dc,_0x2493e7,_0xd425('0x6f'));})[_0xd425('0x36')](function(_0x4461c0){if(_0x4461c0){logger[_0xd425('0xf')](_0xd425('0x70'),_0x4461c0['id']);}})['catch'](function(_0x2cff42){logger[_0xd425('0x74')]('[ABANDONED]',JSON[_0xd425('0x49')](_0x2cff42));});}; \ No newline at end of file +var _0x24ca=['Agent\x20found!','Using\x20the\x20admin\x20account!','find','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','https://crm.%s/crm/private/json/Contacts/searchRecords','((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','%s%s%s','parse','https://crm.%s/crm/private/json/Leads/getRecordById','Error\x20on\x20Lead\x20creation:\x20','debug','forEach','type','string','idField','toString','variable','variableName','customVariable','name','toLowerCase','Variable','split','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Call\x20ID\x20is:','user:%s','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','catch','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','[ABANDONED]','calleridname','lodash','md5','util','./util','entities','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','application/json','info','merge','inbound','outbound','agentcalledAt','format','YYYY-MM-DD\x20HH:mm:ss','getString','Subjects','Descriptions','called','Call\x20Result','connect','rejected','Rejected','abandoned','Abandoned','Call\x20Duration','utc','talktime','endtime','starttime','mm:ss','CONTACTID','LEADID','SEMODULE','Leads','','hasOwnProperty','%s','encodeXML','','POST','https://crm.%s/crm/private/xml/Calls/insertRecords','authToken','crmapi','then','toJson','response','result','recorddetail','Call\x20created!','Error\x20on\x20call\x20creation:\x20','GET','https://crm.%s/crm/private/json/Users/getUsers','host','users','user','Standard'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x24ca,0x1bc));var _0xa24c=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x24ca[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0xa24c('0x0'));var rp=require('request-promise');var md5=require(_0xa24c('0x1'));var util=require(_0xa24c('0x2'));var intUtil=require(_0xa24c('0x3'));var parser=require('xml2json');var entities=require(_0xa24c('0x4'));var moment=require(_0xa24c('0x5'));var Redis=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var logger=require(_0xa24c('0x8'))(_0xa24c('0x9'));config[_0xa24c('0xa')]=_[_0xa24c('0xb')](config[_0xa24c('0xa')],{'host':_0xa24c('0xc'),'port':0x18eb});var io=require(_0xa24c('0xd'))(new Redis(config['redis']));function emit(_0x42d89c,_0x3a5727,_0x2d645c){io['to'](_0x42d89c)['emit'](_0x3a5727,_0x2d645c);}var headers={'Content-Type':_0xa24c('0xe'),'Accept':_0xa24c('0xe')};function getCall(_0x288f76,_0x211003,_0x169632,_0x43aa5a,_0x1a71a8,_0xc82af0){logger[_0xa24c('0xf')]('Creating\x20new\x20call...');var _0x43bcd3=_[_0xa24c('0x10')]({'SMOWNERID':_0x211003['id'],'Call Type':_0xc82af0||_0xa24c('0x11'),'Call Start Time':(_0xc82af0===_0xa24c('0x12')?_0x1a71a8['starttime']:_0x1a71a8[_0xa24c('0x13')])||moment()[_0xa24c('0x14')](_0xa24c('0x15')),'Subject':intUtil[_0xa24c('0x16')](_0x43aa5a[_0xa24c('0x17')],_0x1a71a8,'\x20'),'Description':intUtil[_0xa24c('0x16')](_0x43aa5a[_0xa24c('0x18')],_0x1a71a8,'\x0a')},getCustomFields(_0x43aa5a['Fields'],_0x1a71a8));switch(_0x1a71a8['lastevent']){case _0xa24c('0x19'):_0x43bcd3[_0xa24c('0x1a')]='Called';break;case'complete':case _0xa24c('0x1b'):_0x43bcd3[_0xa24c('0x1a')]='Answered';break;case _0xa24c('0x1c'):_0x43bcd3['Call\x20Result']=_0xa24c('0x1d');break;case _0xa24c('0x1e'):_0x43bcd3[_0xa24c('0x1a')]=_0xa24c('0x1f');break;default:}if(_0x1a71a8['talktime']){_0x43bcd3[_0xa24c('0x20')]=moment[_0xa24c('0x21')](parseInt(_0x1a71a8[_0xa24c('0x22')])*0x3e8)['format']('mm:ss');}else if(_0x1a71a8['answertime']&&_0x1a71a8['endtime']){_0x43bcd3[_0xa24c('0x20')]=moment[_0xa24c('0x21')](moment(_0x1a71a8[_0xa24c('0x23')],_0xa24c('0x15'))['diff'](moment(_0x1a71a8[_0xa24c('0x24')],'YYYY-MM-DD\x20HH:mm:ss')))[_0xa24c('0x14')](_0xa24c('0x25'));}if(_0x169632['CONTACTID']){_0x43bcd3[_0xa24c('0x26')]=_0x169632[_0xa24c('0x26')];}else if(_0x169632[_0xa24c('0x27')]){_0x43bcd3[_0xa24c('0x28')]=_0xa24c('0x29');_0x43bcd3['SEID']=_0x169632[_0xa24c('0x27')];}var _0x5cc9cb=_0xa24c('0x2a');for(var _0x3951ae in _0x43bcd3){if(_0x43bcd3[_0xa24c('0x2b')](_0x3951ae)){_0x5cc9cb+=util['format'](_0xa24c('0x2c'),entities[_0xa24c('0x2d')](_0x3951ae),entities[_0xa24c('0x2d')](_0x43bcd3[_0x3951ae]));}}_0x5cc9cb+=_0xa24c('0x2e');return request({'method':_0xa24c('0x2f'),'uri':util[_0xa24c('0x14')](_0xa24c('0x30'),_0x288f76['host']),'qs':{'authtoken':_0x288f76[_0xa24c('0x31')],'scope':_0xa24c('0x32'),'xmlData':_0x5cc9cb},'json':!![]})[_0xa24c('0x33')](function(_0x12dbdc){_0x12dbdc=JSON['parse'](parser[_0xa24c('0x34')](_0x12dbdc));if(_0x12dbdc[_0xa24c('0x35')]){if(_0x12dbdc[_0xa24c('0x35')]['result']&&_0x12dbdc[_0xa24c('0x35')][_0xa24c('0x36')][_0xa24c('0x37')]){logger['info'](_0xa24c('0x38'));return{'id':_0x12dbdc['response'][_0xa24c('0x36')][_0xa24c('0x37')]['FL'][0x0]['$t']};}}throw new Error(_0xa24c('0x39')+JSON['stringify'](_0x12dbdc));});}function getUser(_0x1f52f8,_0x53f90){_0x53f90&&logger[_0xa24c('0xf')]('Getting\x20agent\x20with\x20email',_0x53f90);return request({'method':_0xa24c('0x3a'),'uri':util['format'](_0xa24c('0x3b'),_0x1f52f8[_0xa24c('0x3c')]),'qs':{'type':'AllUsers','authtoken':_0x1f52f8['authToken'],'scope':_0xa24c('0x32')},'json':!![]})[_0xa24c('0x33')](function(_0x182e86){if(_0x182e86[_0xa24c('0x3d')]&&_0x182e86[_0xa24c('0x3d')][_0xa24c('0x3e')]){var _0x4416a4;if(_0x53f90){_0x4416a4=_['find'](_0x182e86[_0xa24c('0x3d')][_0xa24c('0x3e')],{'email':_0x53f90,'profile':_0xa24c('0x3f')});}if(_0x4416a4){logger[_0xa24c('0xf')](_0xa24c('0x40'));}else{logger[_0xa24c('0xf')](_0xa24c('0x41'));_0x4416a4=_[_0xa24c('0x42')](_0x182e86[_0xa24c('0x3d')][_0xa24c('0x3e')],{'profile':'Administrator'});}return _0x4416a4;}else{logger[_0xa24c('0x43')](_0xa24c('0x44'),JSON[_0xa24c('0x45')](_0x182e86));throw new Error(_0xa24c('0x46')+JSON['stringify'](_0x182e86));}});}function getEndUser(_0x56a485,_0x19a65f,_0x56ef4d){logger[_0xa24c('0xf')](_0xa24c('0x47'),_0x56ef4d);return request({'method':_0xa24c('0x3a'),'uri':util[_0xa24c('0x14')](_0xa24c('0x48'),_0x56a485['host']),'qs':{'authtoken':_0x56a485['authToken'],'scope':_0xa24c('0x32'),'criteria':util[_0xa24c('0x14')](_0xa24c('0x49'),_0x56ef4d)},'json':!![]})[_0xa24c('0x33')](function(_0x722488){if(_0x722488[_0xa24c('0x35')]&&_0x722488['response']['result']){logger[_0xa24c('0xf')](_0xa24c('0x4a'));var _0x4037d6={};var _0x2101f8=_0x722488[_0xa24c('0x35')]['result'][_0xa24c('0x4b')][_0xa24c('0x4c')]['no']?_0x722488['response']['result'][_0xa24c('0x4b')][_0xa24c('0x4c')]['FL']:_0x722488[_0xa24c('0x35')]['result']['Contacts'][_0xa24c('0x4c')][0x0]['FL'];for(var _0x32af67=0x0,_0x31048c=_0x2101f8[_0xa24c('0x4d')];_0x32af67<_0x31048c;_0x32af67++){_0x4037d6[_0x2101f8[_0x32af67][_0xa24c('0x4e')]]=_0x2101f8[_0x32af67][_0xa24c('0x4f')];}return _0x4037d6;}else{return request({'method':_0xa24c('0x3a'),'uri':util[_0xa24c('0x14')]('https://crm.%s/crm/private/json/Leads/searchRecords',_0x56a485['host']),'qs':{'authtoken':_0x56a485[_0xa24c('0x31')],'scope':_0xa24c('0x32'),'criteria':util[_0xa24c('0x14')]('((Phone:%s))',_0x56ef4d)},'json':!![]})[_0xa24c('0x33')](function(_0x51df93){if(_0x51df93[_0xa24c('0x35')]&&_0x51df93[_0xa24c('0x35')][_0xa24c('0x36')]){logger[_0xa24c('0xf')](_0xa24c('0x50'));var _0x35ed8a={};var _0x3f52fe=_0x51df93[_0xa24c('0x35')]['result'][_0xa24c('0x29')][_0xa24c('0x4c')]['no']?_0x51df93[_0xa24c('0x35')]['result'][_0xa24c('0x29')][_0xa24c('0x4c')]['FL']:_0x51df93[_0xa24c('0x35')][_0xa24c('0x36')][_0xa24c('0x29')][_0xa24c('0x4c')][0x0]['FL'];for(var _0x1a20bd=0x0,_0x46f725=_0x3f52fe[_0xa24c('0x4d')];_0x1a20bd<_0x46f725;_0x1a20bd++){_0x35ed8a[_0x3f52fe[_0x1a20bd][_0xa24c('0x4e')]]=_0x3f52fe[_0x1a20bd][_0xa24c('0x4f')];}return _0x35ed8a;}else{logger['info'](_0xa24c('0x51'));_0x19a65f=getName(_0x19a65f);return request({'method':_0xa24c('0x2f'),'uri':util[_0xa24c('0x14')](_0xa24c('0x52'),_0x56a485[_0xa24c('0x3c')]),'qs':{'authtoken':_0x56a485[_0xa24c('0x31')],'scope':_0xa24c('0x32'),'xmlData':util[_0xa24c('0x14')](_0xa24c('0x53'),entities['encodeXML'](_0x19a65f[0x0]),entities['encodeXML'](_0x19a65f[0x1]),_0x56ef4d)},'json':!![]})[_0xa24c('0x33')](function(_0x5c14df){_0x5c14df=JSON[_0xa24c('0x54')](parser[_0xa24c('0x34')](_0x5c14df));if(_0x5c14df['response']){if(_0x5c14df[_0xa24c('0x35')][_0xa24c('0x36')]&&_0x5c14df[_0xa24c('0x35')]['result']['recorddetail']){logger[_0xa24c('0xf')]('Enduser\x20created.');return request({'method':_0xa24c('0x3a'),'uri':util[_0xa24c('0x14')](_0xa24c('0x55'),_0x56a485[_0xa24c('0x3c')]),'qs':{'authtoken':_0x56a485[_0xa24c('0x31')],'scope':_0xa24c('0x32'),'id':_0x5c14df[_0xa24c('0x35')][_0xa24c('0x36')][_0xa24c('0x37')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0xa24c('0x56')+JSON['stringify'](_0x5c14df));})[_0xa24c('0x33')](function(_0x2759c1){if(_0x2759c1[_0xa24c('0x35')]){if(_0x2759c1['response']['result']){var _0x487cc9={};for(var _0x2da4f0=0x0,_0x5c2367=_0x2759c1[_0xa24c('0x35')][_0xa24c('0x36')]['Leads'][_0xa24c('0x4c')]['FL'][_0xa24c('0x4d')];_0x2da4f0<_0x5c2367;_0x2da4f0++){_0x487cc9[_0x2759c1[_0xa24c('0x35')][_0xa24c('0x36')][_0xa24c('0x29')][_0xa24c('0x4c')]['FL'][_0x2da4f0][_0xa24c('0x4e')]]=_0x2759c1[_0xa24c('0x35')]['result'][_0xa24c('0x29')]['row']['FL'][_0x2da4f0]['content'];}return _0x487cc9;}}throw new Error('Error\x20on\x20Lead\x20retrieve:\x20'+JSON['stringify'](_0x2759c1));});}});}});}function request(_0x49b0df){logger[_0xa24c('0x57')]('[HTTP]',JSON[_0xa24c('0x45')](_0x49b0df));return rp(_0x49b0df);}function getCustomFields(_0x3fd3f9,_0x5247f9){var _0x1a5f17={};if(_0x3fd3f9[_0xa24c('0x4d')]>0x0){_[_0xa24c('0x58')](_0x3fd3f9,function(_0x6f5aad){if(_0x6f5aad[_0xa24c('0x59')]===_0xa24c('0x5a')&&_0x6f5aad[_0xa24c('0x5b')]){_0x1a5f17[_0x6f5aad[_0xa24c('0x5b')]]=_0x6f5aad[_0xa24c('0x4f')][_0xa24c('0x5c')]();}else if(_0x6f5aad[_0xa24c('0x59')]===_0xa24c('0x5d')&&_0x6f5aad['variableName']&&_0x6f5aad[_0xa24c('0x5b')]&&_0x5247f9[_0x6f5aad[_0xa24c('0x5e')]]){_0x1a5f17[_0x6f5aad['idField']]=_0x5247f9[_0x6f5aad[_0xa24c('0x5e')]][_0xa24c('0x5c')]();}else if(_0x6f5aad[_0xa24c('0x59')]===_0xa24c('0x5f')&&_0x6f5aad['Variable']&&_0x6f5aad['Variable'][_0xa24c('0x60')]&&_0x6f5aad['idField']&&_0x5247f9[_0x6f5aad['Variable'][_0xa24c('0x60')][_0xa24c('0x61')]()]){_0x1a5f17[_0x6f5aad[_0xa24c('0x5b')]]=_0x5247f9[_0x6f5aad[_0xa24c('0x62')]['name']['toLowerCase']()][_0xa24c('0x5c')]();}});}return _0x1a5f17;}function getName(_0x512b6f){if(_0x512b6f['indexOf']('\x20')>0x0){var _0xfcc193=_0x512b6f[_0xa24c('0x63')](/ (.+)/);if(_0xfcc193[0x1]){return _0xfcc193;}}return[_0x512b6f,_0x512b6f];}exports[_0xa24c('0x64')]=function(_0x54528f,_0x2fbc8b,_0x128e5b,_0x5c3285,_0x37d4da,_0x3f306d){var _0x3096bf,_0x4bee5c;if(_0x37d4da&&_0x37d4da[_0xa24c('0x65')]){logger[_0xa24c('0xf')](_0xa24c('0x66'),_0xa24c('0x67'));_0x2fbc8b[_0xa24c('0x68')]=util['format'](_0xa24c('0x69'),_0x3f306d[_0xa24c('0x6a')],_0x2fbc8b[_0xa24c('0x6b')],md5(_0x2fbc8b[_0xa24c('0x6b')]));}else{_0x2fbc8b[_0xa24c('0x68')]='';}return getUser(_0x3f306d,_0x5c3285[_0xa24c('0x6c')])[_0xa24c('0x33')](function(_0x4f4ed9){_0x3096bf=_0x4f4ed9;logger[_0xa24c('0xf')](_0xa24c('0x6d'),_0x3096bf['id']);return getEndUser(_0x3f306d,_0x2fbc8b['calleridname'],_0x2fbc8b[_0xa24c('0x6e')]);})[_0xa24c('0x33')](function(_0x14da5e){_0x4bee5c=_0x14da5e;logger[_0xa24c('0xf')](_0xa24c('0x6f'),_0x4bee5c[_0xa24c('0x26')]||_0x4bee5c[_0xa24c('0x27')]);return getCall(_0x3f306d,_0x3096bf,_0x4bee5c,_0x128e5b,_0x2fbc8b,_0xa24c('0x70'));})[_0xa24c('0x33')](function(_0x32ddc3){if(_0x32ddc3){logger['info'](_0xa24c('0x71'),_0x32ddc3['id']);logger[_0xa24c('0xf')](_0xa24c('0x66'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa24c('0x14')](_0xa24c('0x72'),_0x5c3285[_0xa24c('0x60')]),'trigger:browser:url',{'uri':util[_0xa24c('0x14')](_0xa24c('0x73'),_0x3f306d[_0xa24c('0x3c')],_0x32ddc3['id'])});}})[_0xa24c('0x74')](function(_0x320901){logger[_0xa24c('0x43')]('[QUEUE]',JSON['stringify'](_0x320901));});};exports[_0xa24c('0x12')]=function(_0x4b281b,_0x16678e,_0x1879ae,_0x26427c,_0x4073c5,_0x12d715,_0x58e328){var _0x1f7b20,_0x39c76a;if(_0x58e328&&_0x58e328[_0xa24c('0x75')]&&_0x58e328[_0xa24c('0x75')]!==_0xa24c('0x76')){logger[_0xa24c('0xf')]('[OUTBOUND]',_0xa24c('0x67'));_0x16678e[_0xa24c('0x68')]=util[_0xa24c('0x14')](_0xa24c('0x69'),_0x12d715['serverUrl'],_0x16678e[_0xa24c('0x6b')],md5(_0x16678e['uniqueid']));}return getUser(_0x12d715,_0x26427c[_0xa24c('0x6c')])[_0xa24c('0x33')](function(_0x342442){_0x1f7b20=_0x342442;logger[_0xa24c('0xf')]('The\x20User\x20ID\x20is:',_0x1f7b20['id']);return getEndUser(_0x12d715,_0x16678e[_0xa24c('0x77')],_0x16678e[_0xa24c('0x78')]);})['then'](function(_0x8e5e2a){_0x39c76a=_0x8e5e2a;logger[_0xa24c('0xf')](_0xa24c('0x6f'),_0x39c76a[_0xa24c('0x26')]||_0x39c76a[_0xa24c('0x27')]);return getCall(_0x12d715,_0x1f7b20,_0x39c76a,_0x1879ae,_0x16678e,_0xa24c('0x79'));})[_0xa24c('0x33')](function(_0x37089c){if(_0x37089c){logger['info'](_0xa24c('0x71'),_0x37089c['id']);logger[_0xa24c('0xf')](_0xa24c('0x7a'),_0xa24c('0x7b'));emit(util[_0xa24c('0x14')](_0xa24c('0x72'),_0x26427c[_0xa24c('0x60')]),_0xa24c('0x7c'),{'uri':util[_0xa24c('0x14')](_0xa24c('0x73'),_0x12d715[_0xa24c('0x3c')],_0x37089c['id'])});}})['catch'](function(_0x283c5b){logger[_0xa24c('0x43')]('[OUTBOUND]',JSON[_0xa24c('0x45')](_0x283c5b));});};exports[_0xa24c('0x1e')]=function(_0x1f7c59,_0x4f0f11,_0x5b4468,_0xf03c2f,_0x4c9b19,_0x53928f){var _0x105ed5,_0x3101d5;if(_0x4c9b19&&_0x4c9b19[_0xa24c('0x65')]){logger[_0xa24c('0xf')](_0xa24c('0x7d'),_0xa24c('0x67'));_0x4f0f11['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x53928f[_0xa24c('0x6a')],_0x4f0f11['uniqueid'],md5(_0x4f0f11['uniqueid']));}else{_0x4f0f11[_0xa24c('0x68')]='';}return getUser(_0x53928f)[_0xa24c('0x33')](function(_0x32d14a){_0x105ed5=_0x32d14a;logger[_0xa24c('0xf')](_0xa24c('0x6d'),_0x105ed5['id']);return getEndUser(_0x53928f,_0x4f0f11[_0xa24c('0x7e')],_0x4f0f11[_0xa24c('0x6e')]);})[_0xa24c('0x33')](function(_0x2544fc){_0x3101d5=_0x2544fc;logger['info'](_0xa24c('0x6f'),_0x3101d5[_0xa24c('0x26')]||_0x3101d5[_0xa24c('0x27')]);return getCall(_0x53928f,_0x105ed5,_0x3101d5,_0x5b4468,_0x4f0f11,_0xa24c('0x70'));})[_0xa24c('0x33')](function(_0x84aa80){if(_0x84aa80){logger[_0xa24c('0xf')](_0xa24c('0x71'),_0x84aa80['id']);}})[_0xa24c('0x74')](function(_0x3c5495){logger[_0xa24c('0x43')](_0xa24c('0x7d'),JSON['stringify'](_0x3c5495));});}; \ 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 56eb312..cd5baa6 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 _0xe2ab=['render','GET','POST','data7','then','info','statusCode','error','format','%s\x20%s\x20%s\x20[%s]:%s','data2','name','request-promise','util','exec','data1','toUpperCase'];(function(_0x2110f3,_0x38367a){var _0x8bcd8b=function(_0x4e03df){while(--_0x4e03df){_0x2110f3['push'](_0x2110f3['shift']());}};_0x8bcd8b(++_0x38367a);}(_0xe2ab,0x1c6));var _0xbe2a=function(_0x13182e,_0x45e0f4){_0x13182e=_0x13182e-0x0;var _0x464946=_0xe2ab[_0x13182e];return _0x464946;};'use strict';var rp=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports[_0xbe2a('0x2')]=function(_0x2e2fc4,_0x80eb2c){var _0x32922a={'method':_0x2e2fc4[_0xbe2a('0x3')][_0xbe2a('0x4')](),'uri':encodeURI(Mustache[_0xbe2a('0x5')](_0x2e2fc4['data2'],_0x80eb2c)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2e2fc4[_0xbe2a('0x3')][_0xbe2a('0x4')]()){case _0xbe2a('0x6'):_0x32922a['qs']=_0x80eb2c;break;case _0xbe2a('0x7'):_0x32922a['body']=_0x2e2fc4['data7']?Mustache[_0xbe2a('0x5')](_0x2e2fc4[_0xbe2a('0x8')],_0x80eb2c):_0x80eb2c;break;}rp(_0x32922a)[_0xbe2a('0x9')](function(_0x17a6e2){logger[_0xbe2a('0xa')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s',_0x2e2fc4['data1'],_0x2e2fc4['data2'],_0x17a6e2[_0xbe2a('0xb')],_0x17a6e2['body']));})['catch'](function(_0x3e4ffe){logger[_0xbe2a('0xc')](util[_0xbe2a('0xd')](_0xbe2a('0xe'),_0x2e2fc4['data1'],_0x2e2fc4[_0xbe2a('0xf')],_0x3e4ffe[_0xbe2a('0xb')],_0x3e4ffe[_0xbe2a('0x10')],_0x3e4ffe['message']));});}; \ No newline at end of file +var _0xfb4b=['body','data7','then','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','data2','statusCode','catch','error','%s\x20%s\x20%s\x20[%s]:%s','name','request-promise','mustache','../../../../config/logger','trigger','data1','toUpperCase','render'];(function(_0x570f39,_0x17177b){var _0x301ea1=function(_0x169048){while(--_0x169048){_0x570f39['push'](_0x570f39['shift']());}};_0x301ea1(++_0x17177b);}(_0xfb4b,0x1ae));var _0xbfb4=function(_0xa1de55,_0x380108){_0xa1de55=_0xa1de55-0x0;var _0x1f9386=_0xfb4b[_0xa1de55];return _0x1f9386;};'use strict';var rp=require(_0xbfb4('0x0'));var util=require('util');var Mustache=require(_0xbfb4('0x1'));var logger=require(_0xbfb4('0x2'))(_0xbfb4('0x3'));exports['exec']=function(_0xbd1550,_0x15e05f){var _0x5b5c01={'method':_0xbd1550[_0xbfb4('0x4')][_0xbfb4('0x5')](),'uri':encodeURI(Mustache[_0xbfb4('0x6')](_0xbd1550['data2'],_0x15e05f)),'json':!![],'resolveWithFullResponse':!![]};switch(_0xbd1550[_0xbfb4('0x4')][_0xbfb4('0x5')]()){case'GET':_0x5b5c01['qs']=_0x15e05f;break;case'POST':_0x5b5c01[_0xbfb4('0x7')]=_0xbd1550['data7']?Mustache[_0xbfb4('0x6')](_0xbd1550[_0xbfb4('0x8')],_0x15e05f):_0x15e05f;break;}rp(_0x5b5c01)[_0xbfb4('0x9')](function(_0x28c4fb){logger[_0xbfb4('0xa')](util[_0xbfb4('0xb')](_0xbfb4('0xc'),_0xbd1550[_0xbfb4('0x4')],_0xbd1550[_0xbfb4('0xd')],_0x28c4fb[_0xbfb4('0xe')],_0x28c4fb[_0xbfb4('0x7')]));})[_0xbfb4('0xf')](function(_0x4cbb17){logger[_0xbfb4('0x10')](util['format'](_0xbfb4('0x11'),_0xbd1550[_0xbfb4('0x4')],_0xbd1550[_0xbfb4('0xd')],_0x4cbb17[_0xbfb4('0xe')],_0x4cbb17[_0xbfb4('0x12')],_0x4cbb17['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index af97d7d..3e044eb 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 _0xca8d=['http','Request','request','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xca8d,0x172));var _0xdca8=function(_0x248f6b,_0x401324){_0x248f6b=_0x248f6b-0x0;var _0x54b829=_0xca8d[_0x248f6b];return _0x54b829;};'use strict';var jayson=require(_0xdca8('0x0'));var BPromise=require(_0xdca8('0x1'));var logger=require(_0xdca8('0x2'))(_0xdca8('0x3'));var client=jayson[_0xdca8('0x4')][_0xdca8('0x5')]({'port':0x2329});client[_0xdca8('0x6')]=function(_0x4cfc92,_0x9e965e){return new BPromise(function(_0x3bae79,_0x379fb8){return client[_0xdca8('0x7')](_0x4cfc92,_0x9e965e)['then'](function(_0x3366d5){logger[_0xdca8('0x8')](_0xdca8('0x9'),_0xdca8('0x3'),_0x4cfc92,_0x9e965e,_0x3366d5);if(_0x3366d5[_0xdca8('0xa')]){logger['error'](_0xdca8('0x9'),_0xdca8('0x3'),_0x4cfc92,_0x3366d5[_0xdca8('0xa')]['message'],_0x9e965e);return _0x379fb8(_0x3366d5[_0xdca8('0xa')][_0xdca8('0xb')]);}else{return _0x3bae79(_0x3366d5[_0xdca8('0xc')]);}})[_0xdca8('0xd')](function(_0x6580b5){logger[_0xdca8('0xa')](_0xdca8('0x9'),_0xdca8('0x3'),_0x4cfc92,_0x6580b5,_0x9e965e);return _0x379fb8(_0x6580b5);});});};module[_0xdca8('0xe')]=client; \ No newline at end of file +var _0xee39=['rpc','routing','error','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then'];(function(_0x586421,_0x1c185f){var _0x52f861=function(_0x3d6ef9){while(--_0x3d6ef9){_0x586421['push'](_0x586421['shift']());}};_0x52f861(++_0x1c185f);}(_0xee39,0x1e6));var _0x9ee3=function(_0x2e35be,_0x5c79d8){_0x2e35be=_0x2e35be-0x0;var _0x1ccc5f=_0xee39[_0x2e35be];return _0x1ccc5f;};'use strict';var jayson=require(_0x9ee3('0x0'));var BPromise=require(_0x9ee3('0x1'));var logger=require(_0x9ee3('0x2'))('routing');var client=jayson[_0x9ee3('0x3')][_0x9ee3('0x4')]({'port':0x2329});client[_0x9ee3('0x5')]=function(_0x3cdeaf,_0x2724c7){return new BPromise(function(_0x3a556a,_0x3398c6){return client[_0x9ee3('0x6')](_0x3cdeaf,_0x2724c7)[_0x9ee3('0x7')](function(_0x2689bb){logger['debug'](_0x9ee3('0x8'),_0x9ee3('0x9'),_0x3cdeaf,_0x2724c7,_0x2689bb);if(_0x2689bb[_0x9ee3('0xa')]){logger['error'](_0x9ee3('0x8'),'routing',_0x3cdeaf,_0x2689bb[_0x9ee3('0xa')]['message'],_0x2724c7);return _0x3398c6(_0x2689bb[_0x9ee3('0xa')]['message']);}else{return _0x3a556a(_0x2689bb['result']);}})[_0x9ee3('0xb')](function(_0x5d3644){logger[_0x9ee3('0xa')]('rpc',_0x9ee3('0x9'),_0x3cdeaf,_0x5d3644,_0x2724c7);return _0x3398c6(_0x5d3644);});});};module[_0x9ee3('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5e4097f..d021087 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 _0xbcb5=['./realtime','./lib/email','./rpc/mailAccount','getMailAccounts','initMailAccounts','then','refresh','mailAccounts','listen','catch','log','bluebird','./server'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xbcb5,0x150));var _0x5bcb=function(_0x45f773,_0x47e1c0){_0x45f773=_0x45f773-0x0;var _0x156669=_0xbcb5[_0x45f773];return _0x156669;};'use strict';var BPromise=require(_0x5bcb('0x0'));var server=require(_0x5bcb('0x1'));var Realtime=require(_0x5bcb('0x2'));var EmailChannel=require(_0x5bcb('0x3'));var mailAccount=require(_0x5bcb('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0x5bcb('0x5')]())['then'](realtime[_0x5bcb('0x6')]())[_0x5bcb('0x7')](function(){email[_0x5bcb('0x8')](realtime[_0x5bcb('0x9')]);return realtime;});}function main(){return server[_0x5bcb('0xa')](realtime,email)[_0x5bcb('0x7')](function(_0x2c2b5f){return initRealtime();})['then'](function(_0x1cde0c){return setInterval(initRealtime,0x2710);})[_0x5bcb('0xb')](function(_0x34e409){console[_0x5bcb('0xc')](_0x34e409);});}main(); \ No newline at end of file +var _0x7631=['./realtime','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','listen','catch','log','bluebird','./server'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7631,0x77));var _0x1763=function(_0x5fc9c6,_0x3150d6){_0x5fc9c6=_0x5fc9c6-0x0;var _0x5f3433=_0x7631[_0x5fc9c6];return _0x5f3433;};'use strict';var BPromise=require(_0x1763('0x0'));var server=require(_0x1763('0x1'));var Realtime=require(_0x1763('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x1763('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x1763('0x4')]()[_0x1763('0x5')](mailAccount[_0x1763('0x6')]())[_0x1763('0x5')](realtime[_0x1763('0x7')]())[_0x1763('0x5')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x1763('0x8')](realtime,email)['then'](function(_0x53c4d7){return initRealtime();})[_0x1763('0x5')](function(_0x39b9d9){return setInterval(initRealtime,0x2710);})[_0x1763('0x9')](function(_0x3a93b8){console[_0x1763('0xa')](_0x3a93b8);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c5473e6..3cd1154 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 _0xcf98=['end','handleImapEnd','error','handleImapError','status','messageStatus','prototype','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','isNil','Smtp','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','emit','name','key','Imap','stringify','mailAccount:update','refresh','hasOwnProperty','active','imapAccounts','email','box','handleImapBox','bind','handleImapEmail'];(function(_0x3622a6,_0x58798b){var _0xc32e8e=function(_0x1aa271){while(--_0x1aa271){_0x3622a6['push'](_0x3622a6['shift']());}};_0xc32e8e(++_0x58798b);}(_0xcf98,0x8d));var _0x8cf9=function(_0x4bcfd5,_0x3cb1bd){_0x4bcfd5=_0x4bcfd5-0x0;var _0x345543=_0xcf98[_0x4bcfd5];return _0x345543;};'use strict';var _=require('lodash');var moment=require(_0x8cf9('0x0'));var BPromise=require(_0x8cf9('0x1'));var md5=require(_0x8cf9('0x2'));var Redis=require(_0x8cf9('0x3'));var config=require(_0x8cf9('0x4'));var logger=require('../../../config/logger')('email');config[_0x8cf9('0x5')]=_[_0x8cf9('0x6')](config[_0x8cf9('0x5')],{'host':_0x8cf9('0x7'),'port':0x18eb});var io=require(_0x8cf9('0x8'))(new Redis(config[_0x8cf9('0x5')]));var EmailImap=require(_0x8cf9('0x9'));var EmailSmtp=require(_0x8cf9('0xa'));var mailAccount=require(_0x8cf9('0xb'));var md5Accounts={};function EmailChannel(_0x136309){logger[_0x8cf9('0xc')]('start\x20email\x20channel');this[_0x8cf9('0xd')]=_0x136309[_0x8cf9('0xd')];this['imapAccounts']={};this[_0x8cf9('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0x8cf9('0xf')]=function(_0x432742){var _0x1af7e4=this[_0x8cf9('0xd')][_0x432742];var _0x236fbd={'id':_0x1af7e4['id'],'name':_0x1af7e4[_0x8cf9('0x10')],'key':_0x1af7e4[_0x8cf9('0x11')],'active':_0x1af7e4['active'],'Imap':{'status':_0x1af7e4[_0x8cf9('0x12')]['status'],'messageStatus':_0x1af7e4['Imap']['messageStatus'],'total':_0x1af7e4[_0x8cf9('0x12')]['total']}};if(_['isNil'](md5Accounts[_0x432742])){md5Accounts[_0x432742]={};}var _0x41b825=md5(JSON[_0x8cf9('0x13')](_0x236fbd));if(md5Accounts[_0x432742][_0x8cf9('0x2')]!==_0x41b825){md5Accounts[_0x432742]['md5']=_0x41b825;io[_0x8cf9('0xf')](_0x8cf9('0x14'),_0x236fbd);}};EmailChannel['prototype'][_0x8cf9('0x15')]=function(_0xc13eeb){for(var _0x2417d8 in _0xc13eeb){if(_0xc13eeb[_0x8cf9('0x16')](_0x2417d8)){if(_0xc13eeb[_0x2417d8][_0x8cf9('0x12')]&&_0xc13eeb[_0x2417d8][_0x8cf9('0x17')]){var _0x21f397=_0xc13eeb[_0x2417d8][_0x8cf9('0x12')];if(!this[_0x8cf9('0x18')][_0x8cf9('0x16')](_0x21f397['id'])){this[_0x8cf9('0x18')][_0x21f397['id']]=new EmailImap(_0x21f397,_0xc13eeb[_0x2417d8][_0x8cf9('0x19')]);this[_0x8cf9('0x18')][_0x21f397['id']]['on'](_0x8cf9('0x1a'),this[_0x8cf9('0x1b')][_0x8cf9('0x1c')](this,_0x2417d8));this['imapAccounts'][_0x21f397['id']]['on']('email',this[_0x8cf9('0x1d')]['bind'](this,_0x2417d8));this[_0x8cf9('0x18')][_0x21f397['id']]['on'](_0x8cf9('0x1e'),this[_0x8cf9('0x1f')][_0x8cf9('0x1c')](this,_0x2417d8));this[_0x8cf9('0x18')][_0x21f397['id']]['on'](_0x8cf9('0x20'),this[_0x8cf9('0x21')][_0x8cf9('0x1c')](this,_0x2417d8));}}else{if(_['isNil'](this[_0x8cf9('0xd')][_0x2417d8]['Imap'])){this['mailAccounts'][_0x2417d8][_0x8cf9('0x12')]={};}this[_0x8cf9('0xd')][_0x2417d8]['Imap'][_0x8cf9('0x22')]='disabled';this['mailAccounts'][_0x2417d8][_0x8cf9('0x12')][_0x8cf9('0x23')]='';this['emit'](_0x2417d8);}}}};EmailChannel[_0x8cf9('0x24')][_0x8cf9('0x1b')]=function(_0x170414,_0x36dbcc){if(this[_0x8cf9('0xd')][_0x170414]){this['mailAccounts'][_0x170414]['Imap'][_0x8cf9('0x22')]=_0x8cf9('0x25');this[_0x8cf9('0xd')][_0x170414][_0x8cf9('0x12')][_0x8cf9('0x23')]=_0x36dbcc[_0x8cf9('0x10')];if(_0x36dbcc[_0x8cf9('0x26')]){this[_0x8cf9('0xd')][_0x170414][_0x8cf9('0x12')]['total']=_0x36dbcc['messages'][_0x8cf9('0x27')];}return this['emit'](_0x170414);}};EmailChannel[_0x8cf9('0x24')][_0x8cf9('0x1d')]=function(_0x2bbd81,_0x443ca1){logger['info'](_0x8cf9('0x28'),_0x443ca1[_0x8cf9('0x29')],_0x443ca1[_0x8cf9('0x2a')],_0x443ca1[_0x8cf9('0x2b')],_0x2bbd81);if(this[_0x8cf9('0xd')][_0x2bbd81]){return mailAccount[_0x8cf9('0x2c')](_0x2bbd81,_0x443ca1)[_0x8cf9('0x2d')](function(_0x52631c){if(_0x52631c){logger['info'](_0x8cf9('0x2e'));}})[_0x8cf9('0x2f')](function(_0x289b5b){logger[_0x8cf9('0x20')](_0x8cf9('0x30'),JSON[_0x8cf9('0x13')](_0x289b5b));});}};EmailChannel['prototype'][_0x8cf9('0x1f')]=function(_0x43057b){if(this[_0x8cf9('0xd')][_0x43057b]&&this[_0x8cf9('0xd')][_0x43057b][_0x8cf9('0x12')]){if(this[_0x8cf9('0x18')][this[_0x8cf9('0xd')][_0x43057b][_0x8cf9('0x12')]['id']]){delete this['imapAccounts'][this[_0x8cf9('0xd')][_0x43057b][_0x8cf9('0x12')]['id']];}this[_0x8cf9('0xd')][_0x43057b]['Imap'][_0x8cf9('0x31')]=moment();this['emit'](_0x43057b);}};EmailChannel[_0x8cf9('0x24')]['handleImapError']=function(_0x25870e,_0x5a577d){if(this[_0x8cf9('0xd')][_0x25870e]){this['mailAccounts'][_0x25870e][_0x8cf9('0x12')]['status']='error';this[_0x8cf9('0xd')][_0x25870e]['Imap'][_0x8cf9('0x23')]=_0x5a577d;return this['emit'](_0x25870e);}};EmailChannel[_0x8cf9('0x24')]['sendMail']=function(_0x236a22,_0x4542d5){return this[_0x8cf9('0xe')][_0x8cf9('0x32')](_0x236a22,_0x4542d5);};EmailChannel[_0x8cf9('0x24')][_0x8cf9('0x33')]=function(_0x2e2a03){var _0x1f4c52=this;if(this[_0x8cf9('0xd')][_0x2e2a03['id']]){if(_[_0x8cf9('0x34')](this[_0x8cf9('0xd')][_0x2e2a03['id']][_0x8cf9('0x35')])){this[_0x8cf9('0xd')][_0x2e2a03['id']][_0x8cf9('0x35')]={};}this['mailAccounts'][_0x2e2a03['id']][_0x8cf9('0x35')][_0x8cf9('0x31')]=moment();return new BPromise(function(_0x7b9a5a,_0x13fde7){return _0x1f4c52[_0x8cf9('0xe')][_0x8cf9('0x36')](_0x2e2a03)[_0x8cf9('0x2d')](function(_0x5d4c08){_0x1f4c52[_0x8cf9('0xd')][_0x2e2a03['id']][_0x8cf9('0x35')][_0x8cf9('0x22')]=_0x8cf9('0x37');_0x1f4c52['mailAccounts'][_0x2e2a03['id']][_0x8cf9('0x35')][_0x8cf9('0x23')]='';_0x1f4c52[_0x8cf9('0xf')](_0x2e2a03['id']);_0x7b9a5a(_0x5d4c08);})[_0x8cf9('0x2f')](function(_0x40361e){_0x1f4c52[_0x8cf9('0xd')][_0x2e2a03['id']][_0x8cf9('0x35')]['status']=_0x8cf9('0x20');_0x1f4c52[_0x8cf9('0xd')][_0x2e2a03['id']][_0x8cf9('0x35')][_0x8cf9('0x23')]=_0x40361e;_0x1f4c52['emit'](_0x2e2a03['id']);_0x13fde7(_0x40361e);});});}return this['smtp'][_0x8cf9('0x36')](_0x2e2a03);};module[_0x8cf9('0x38')]=EmailChannel; \ No newline at end of file +var _0x2aa3=['box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','smtp','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','Imap','status','messageStatus','total','isNil','mailAccount:update','hasOwnProperty','active'];(function(_0x4a15fc,_0x1ef3c3){var _0x683e72=function(_0x482c75){while(--_0x482c75){_0x4a15fc['push'](_0x4a15fc['shift']());}};_0x683e72(++_0x1ef3c3);}(_0x2aa3,0x83));var _0x32aa=function(_0x482b59,_0x8037f7){_0x482b59=_0x482b59-0x0;var _0x2b7518=_0x2aa3[_0x482b59];return _0x2b7518;};'use strict';var _=require(_0x32aa('0x0'));var moment=require(_0x32aa('0x1'));var BPromise=require(_0x32aa('0x2'));var md5=require(_0x32aa('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x32aa('0x4'))(_0x32aa('0x5'));config[_0x32aa('0x6')]=_[_0x32aa('0x7')](config[_0x32aa('0x6')],{'host':_0x32aa('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32aa('0x6')]));var EmailImap=require(_0x32aa('0x9'));var EmailSmtp=require(_0x32aa('0xa'));var mailAccount=require(_0x32aa('0xb'));var md5Accounts={};function EmailChannel(_0x18ded0){logger[_0x32aa('0xc')](_0x32aa('0xd'));this[_0x32aa('0xe')]=_0x18ded0['mailAccounts'];this[_0x32aa('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x32aa('0x10')][_0x32aa('0x11')]=function(_0x39f58e){var _0x24fde2=this['mailAccounts'][_0x39f58e];var _0x339b72={'id':_0x24fde2['id'],'name':_0x24fde2[_0x32aa('0x12')],'key':_0x24fde2[_0x32aa('0x13')],'active':_0x24fde2['active'],'Imap':{'status':_0x24fde2[_0x32aa('0x14')][_0x32aa('0x15')],'messageStatus':_0x24fde2[_0x32aa('0x14')][_0x32aa('0x16')],'total':_0x24fde2[_0x32aa('0x14')][_0x32aa('0x17')]}};if(_[_0x32aa('0x18')](md5Accounts[_0x39f58e])){md5Accounts[_0x39f58e]={};}var _0x46758f=md5(JSON['stringify'](_0x339b72));if(md5Accounts[_0x39f58e][_0x32aa('0x3')]!==_0x46758f){md5Accounts[_0x39f58e][_0x32aa('0x3')]=_0x46758f;io[_0x32aa('0x11')](_0x32aa('0x19'),_0x339b72);}};EmailChannel[_0x32aa('0x10')]['refresh']=function(_0x2b1704){for(var _0x251fa4 in _0x2b1704){if(_0x2b1704[_0x32aa('0x1a')](_0x251fa4)){if(_0x2b1704[_0x251fa4][_0x32aa('0x14')]&&_0x2b1704[_0x251fa4][_0x32aa('0x1b')]){var _0x4f2a1a=_0x2b1704[_0x251fa4]['Imap'];if(!this[_0x32aa('0xf')][_0x32aa('0x1a')](_0x4f2a1a['id'])){this[_0x32aa('0xf')][_0x4f2a1a['id']]=new EmailImap(_0x4f2a1a,_0x2b1704[_0x251fa4]['email']);this['imapAccounts'][_0x4f2a1a['id']]['on'](_0x32aa('0x1c'),this[_0x32aa('0x1d')][_0x32aa('0x1e')](this,_0x251fa4));this[_0x32aa('0xf')][_0x4f2a1a['id']]['on'](_0x32aa('0x5'),this[_0x32aa('0x1f')]['bind'](this,_0x251fa4));this[_0x32aa('0xf')][_0x4f2a1a['id']]['on'](_0x32aa('0x20'),this[_0x32aa('0x21')][_0x32aa('0x1e')](this,_0x251fa4));this[_0x32aa('0xf')][_0x4f2a1a['id']]['on'](_0x32aa('0x22'),this[_0x32aa('0x23')][_0x32aa('0x1e')](this,_0x251fa4));}}else{if(_[_0x32aa('0x18')](this['mailAccounts'][_0x251fa4][_0x32aa('0x14')])){this['mailAccounts'][_0x251fa4][_0x32aa('0x14')]={};}this[_0x32aa('0xe')][_0x251fa4]['Imap']['status']=_0x32aa('0x24');this[_0x32aa('0xe')][_0x251fa4][_0x32aa('0x14')][_0x32aa('0x16')]='';this[_0x32aa('0x11')](_0x251fa4);}}}};EmailChannel[_0x32aa('0x10')][_0x32aa('0x1d')]=function(_0x405b03,_0x1daf14){if(this['mailAccounts'][_0x405b03]){this[_0x32aa('0xe')][_0x405b03][_0x32aa('0x14')]['status']=_0x32aa('0x25');this['mailAccounts'][_0x405b03]['Imap'][_0x32aa('0x16')]=_0x1daf14[_0x32aa('0x12')];if(_0x1daf14[_0x32aa('0x26')]){this[_0x32aa('0xe')][_0x405b03]['Imap'][_0x32aa('0x17')]=_0x1daf14[_0x32aa('0x26')][_0x32aa('0x17')];}return this[_0x32aa('0x11')](_0x405b03);}};EmailChannel[_0x32aa('0x10')][_0x32aa('0x1f')]=function(_0x4b0d5a,_0x5b410f){logger[_0x32aa('0xc')](_0x32aa('0x27'),_0x5b410f[_0x32aa('0x28')],_0x5b410f[_0x32aa('0x29')],_0x5b410f['from'],_0x4b0d5a);if(this['mailAccounts'][_0x4b0d5a]){return mailAccount[_0x32aa('0x2a')](_0x4b0d5a,_0x5b410f)['then'](function(_0x2d11c0){if(_0x2d11c0){logger[_0x32aa('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0x32aa('0x2b')](function(_0x165b60){logger['error'](_0x32aa('0x2c'),JSON[_0x32aa('0x2d')](_0x165b60));});}};EmailChannel[_0x32aa('0x10')][_0x32aa('0x21')]=function(_0x28960b){if(this[_0x32aa('0xe')][_0x28960b]&&this[_0x32aa('0xe')][_0x28960b][_0x32aa('0x14')]){if(this[_0x32aa('0xf')][this[_0x32aa('0xe')][_0x28960b][_0x32aa('0x14')]['id']]){delete this[_0x32aa('0xf')][this[_0x32aa('0xe')][_0x28960b][_0x32aa('0x14')]['id']];}this['mailAccounts'][_0x28960b][_0x32aa('0x14')][_0x32aa('0x2e')]=moment();this[_0x32aa('0x11')](_0x28960b);}};EmailChannel[_0x32aa('0x10')][_0x32aa('0x23')]=function(_0x57da77,_0x337cb7){if(this[_0x32aa('0xe')][_0x57da77]){this[_0x32aa('0xe')][_0x57da77][_0x32aa('0x14')][_0x32aa('0x15')]=_0x32aa('0x22');this[_0x32aa('0xe')][_0x57da77][_0x32aa('0x14')][_0x32aa('0x16')]=_0x337cb7;return this[_0x32aa('0x11')](_0x57da77);}};EmailChannel[_0x32aa('0x10')]['sendMail']=function(_0x529d2c,_0x4273ed){return this[_0x32aa('0x2f')][_0x32aa('0x30')](_0x529d2c,_0x4273ed);};EmailChannel[_0x32aa('0x10')][_0x32aa('0x31')]=function(_0x19a859){var _0x3de549=this;if(this['mailAccounts'][_0x19a859['id']]){if(_[_0x32aa('0x18')](this[_0x32aa('0xe')][_0x19a859['id']][_0x32aa('0x32')])){this[_0x32aa('0xe')][_0x19a859['id']]['Smtp']={};}this[_0x32aa('0xe')][_0x19a859['id']]['Smtp'][_0x32aa('0x2e')]=moment();return new BPromise(function(_0xd2e67d,_0x7ba190){return _0x3de549[_0x32aa('0x2f')][_0x32aa('0x33')](_0x19a859)['then'](function(_0x2c82d5){_0x3de549[_0x32aa('0xe')][_0x19a859['id']][_0x32aa('0x32')][_0x32aa('0x15')]='verified';_0x3de549[_0x32aa('0xe')][_0x19a859['id']]['Smtp'][_0x32aa('0x16')]='';_0x3de549[_0x32aa('0x11')](_0x19a859['id']);_0xd2e67d(_0x2c82d5);})['catch'](function(_0x6fa1bf){_0x3de549[_0x32aa('0xe')][_0x19a859['id']][_0x32aa('0x32')][_0x32aa('0x15')]=_0x32aa('0x22');_0x3de549[_0x32aa('0xe')][_0x19a859['id']][_0x32aa('0x32')][_0x32aa('0x16')]=_0x6fa1bf;_0x3de549['emit'](_0x19a859['id']);_0x7ba190(_0x6fa1bf);});});}return this['smtp'][_0x32aa('0x33')](_0x19a859);};module[_0x32aa('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 82d1676..f8d1578 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 _0xf24d=['handleSimpleParser','parser','emit','closeBox','textCode','upperFirst','exports','imap','mailparser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','bind','once','handleEnd','error','handleError','connect','inherits','connTimeout','authTimeout','isNil','user','password','host','port','tls','autotls','service','anonymous@xcally.com','prototype','handleReady','handleOpenBox','box','readUnseen','handleCloseBox','end','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageEnd','handleMessageAttributes'];(function(_0x4bad1a,_0xd65641){var _0x3ba588=function(_0x4af808){while(--_0x4af808){_0x4bad1a['push'](_0x4bad1a['shift']());}};_0x3ba588(++_0xd65641);}(_0xf24d,0x18f));var _0xdf24=function(_0x5785f5,_0x289cad){_0x5785f5=_0x5785f5-0x0;var _0xb76dee=_0xf24d[_0x5785f5];return _0xb76dee;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xdf24('0x0'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0xdf24('0x1'))['simpleParser'];var EventEmitter=require(_0xdf24('0x2'))[_0xdf24('0x3')];var utils=require(_0xdf24('0x4'));var logger=require(_0xdf24('0x5'))(_0xdf24('0x6'));function EmailImap(_0x2f6457,_0x39ecaf){this[_0xdf24('0x7')]=_0xdf24('0x8');this[_0xdf24('0x9')]=this[_0xdf24('0xa')](_0x2f6457,_0x39ecaf);this[_0xdf24('0x0')]=new Imap(this[_0xdf24('0x9')]);this[_0xdf24('0x0')]['once'](_0xdf24('0xb'),this['handleReady'][_0xdf24('0xc')](this));this[_0xdf24('0x0')][_0xdf24('0xd')]('end',this[_0xdf24('0xe')]['bind'](this));this['imap']['on'](_0xdf24('0xf'),this[_0xdf24('0x10')][_0xdf24('0xc')](this));this['imap'][_0xdf24('0x11')]();}util[_0xdf24('0x12')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0xce59ea,_0x19a4fb){var _0x5550ef={'connTimeout':_0xce59ea[_0xdf24('0x13')]?_0xce59ea[_0xdf24('0x13')]*0x3e8:0x2710,'authTimeout':_0xce59ea[_0xdf24('0x14')]?_0xce59ea[_0xdf24('0x14')]*0x3e8:0x1388};if(_[_0xdf24('0x15')](_0xce59ea['service'])){if(_0xce59ea['authentication']){_0x5550ef[_0xdf24('0x16')]=_0xce59ea['user'];_0x5550ef[_0xdf24('0x17')]=_0xce59ea[_0xdf24('0x17')];}_0x5550ef[_0xdf24('0x18')]=_0xce59ea[_0xdf24('0x18')];_0x5550ef['port']=_0xce59ea[_0xdf24('0x19')]||0x3e1;if(_0xce59ea['tls']){_0x5550ef[_0xdf24('0x1a')]=!![];}else{_0x5550ef[_0xdf24('0x1a')]=![];_0x5550ef[_0xdf24('0x1b')]='required';}}else{_0x5550ef[_0xdf24('0x16')]=_0xce59ea[_0xdf24('0x16')];_0x5550ef['password']=_0xce59ea['password'];_0x5550ef[_0xdf24('0x18')]=utils['getHost'](_0xce59ea[_0xdf24('0x1c')]);_0x5550ef[_0xdf24('0x19')]=0x3e1;_0x5550ef[_0xdf24('0x1a')]=!![];}_0x5550ef[_0xdf24('0x6')]=_0x19a4fb||_0xce59ea[_0xdf24('0x16')]||_0xdf24('0x1d');return _0x5550ef;};EmailImap[_0xdf24('0x1e')][_0xdf24('0x1f')]=function(){this[_0xdf24('0x0')]['openBox'](this['mailbox'],![],this[_0xdf24('0x20')][_0xdf24('0xc')](this));};EmailImap[_0xdf24('0x1e')]['handleOpenBox']=function(_0x597633,_0x370ed1){if(_0x597633){this[_0xdf24('0x10')](_0x597633,!![]);}else{this['emit'](_0xdf24('0x21'),_0x370ed1);this[_0xdf24('0x22')]();}};EmailImap[_0xdf24('0x1e')][_0xdf24('0x23')]=function(_0x41b0d2){if(_0x41b0d2){this[_0xdf24('0x10')](_0x41b0d2,!![]);}else{this[_0xdf24('0x0')][_0xdf24('0x24')]();}};EmailImap[_0xdf24('0x1e')][_0xdf24('0x22')]=function(){this['imap']['search']([_0xdf24('0x25')],this[_0xdf24('0x26')][_0xdf24('0xc')](this));};EmailImap[_0xdf24('0x1e')][_0xdf24('0x26')]=function(_0x35b9b4,_0x1c0764){if(_0x35b9b4){this[_0xdf24('0x10')](_0x35b9b4,!![]);}else{if(_0x1c0764[_0xdf24('0x27')]){try{var _0x1839e9=this[_0xdf24('0x0')][_0xdf24('0x28')](_0x1c0764,{'bodies':'','markSeen':!![]});_0x1839e9['on']('message',this[_0xdf24('0x29')]['bind'](this));_0x1839e9[_0xdf24('0xd')](_0xdf24('0xf'),this[_0xdf24('0x2a')][_0xdf24('0xc')](this));_0x1839e9[_0xdf24('0xd')]('end',this[_0xdf24('0x2b')][_0xdf24('0xc')](this));}catch(_0x285a3b){logger[_0xdf24('0xf')](_0x285a3b);}}else{this['imap']['closeBox'](!![],this['handleCloseBox'][_0xdf24('0xc')](this));}}};EmailImap['prototype'][_0xdf24('0x29')]=function(_0x502f26,_0x14f37e){_0x502f26['on'](_0xdf24('0x2c'),this[_0xdf24('0x2d')][_0xdf24('0xc')](this));_0x502f26['once'](_0xdf24('0x2e'),this['handleMessageAttributes'][_0xdf24('0xc')](this));_0x502f26[_0xdf24('0xd')]('end',this[_0xdf24('0x2f')]['bind'](this));};EmailImap['prototype'][_0xdf24('0x2d')]=function(_0x3328ff,_0x4b4aae){simpleParser(_0x3328ff,this['handleSimpleParser'][_0xdf24('0xc')](this));};EmailImap[_0xdf24('0x1e')][_0xdf24('0x30')]=function(_0x45f250){};EmailImap[_0xdf24('0x1e')][_0xdf24('0x2f')]=function(){};EmailImap[_0xdf24('0x1e')][_0xdf24('0x31')]=function(_0x41a1c3,_0x41f6a3){if(_0x41a1c3){logger['error'](_0x41a1c3);}else{var _0x4b1848=this;utils[_0xdf24('0x32')](this[_0xdf24('0x9')],_0x41f6a3,function(_0x369e10){_0x4b1848[_0xdf24('0x33')]('email',_0x369e10);});}};EmailImap[_0xdf24('0x1e')][_0xdf24('0x2b')]=function(){this[_0xdf24('0x0')][_0xdf24('0x34')](!![],this['handleCloseBox'][_0xdf24('0xc')](this));};EmailImap['prototype'][_0xdf24('0x2a')]=function(_0x2c248f){this[_0xdf24('0x10')](_0x2c248f);this['imap']['closeBox'](!![],this[_0xdf24('0x23')][_0xdf24('0xc')](this));};EmailImap[_0xdf24('0x1e')][_0xdf24('0xe')]=function(){this['emit'](_0xdf24('0x24'));};EmailImap[_0xdf24('0x1e')][_0xdf24('0x10')]=function(_0x144b10,_0x57bbf9){logger[_0xdf24('0xf')](_0xdf24('0x10'),this[_0xdf24('0x9')][_0xdf24('0x6')],JSON['stringify'](_0x144b10));var _0xf90ee2='';if(_0x144b10){if(_0x144b10[_0xdf24('0x35')]){_0xf90ee2=_0x144b10[_0xdf24('0x35')];}else{for(var _0x4edd73 in _0x144b10){if(_0x144b10['hasOwnProperty'](_0x4edd73)){_0xf90ee2+=_[_0xdf24('0x36')](_0x4edd73)+':\x20'+_0x144b10[_0x4edd73]+'\x0a';}}}}if(_0x57bbf9){this[_0xdf24('0x0')][_0xdf24('0x24')]();}else{this[_0xdf24('0x33')](_0xdf24('0xf'),_0xf90ee2);this[_0xdf24('0x33')](_0xdf24('0x24'));}};module[_0xdf24('0x37')]=EmailImap; \ No newline at end of file +var _0xdf4d=['util','mailparser','simpleParser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','once','ready','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','end','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','path'];(function(_0x45ea3c,_0xaf1584){var _0x5b502e=function(_0x3f8e44){while(--_0x3f8e44){_0x45ea3c['push'](_0x45ea3c['shift']());}};_0x5b502e(++_0xaf1584);}(_0xdf4d,0x1b8));var _0xddf4=function(_0x243e82,_0x50326d){_0x243e82=_0x243e82-0x0;var _0x44babd=_0xdf4d[_0x243e82];return _0x44babd;};'use strict';var fs=require('fs');var path=require(_0xddf4('0x0'));var util=require(_0xddf4('0x1'));var Imap=require('imap');var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0xddf4('0x2'))[_0xddf4('0x3')];var EventEmitter=require(_0xddf4('0x4'))[_0xddf4('0x5')];var utils=require(_0xddf4('0x6'));var logger=require(_0xddf4('0x7'))(_0xddf4('0x8'));function EmailImap(_0x130591,_0x38967a){this[_0xddf4('0x9')]='INBOX';this[_0xddf4('0xa')]=this[_0xddf4('0xb')](_0x130591,_0x38967a);this[_0xddf4('0xc')]=new Imap(this['account']);this[_0xddf4('0xc')][_0xddf4('0xd')](_0xddf4('0xe'),this[_0xddf4('0xf')][_0xddf4('0x10')](this));this[_0xddf4('0xc')][_0xddf4('0xd')]('end',this[_0xddf4('0x11')][_0xddf4('0x10')](this));this[_0xddf4('0xc')]['on'](_0xddf4('0x12'),this[_0xddf4('0x13')]['bind'](this));this[_0xddf4('0xc')][_0xddf4('0x14')]();}util[_0xddf4('0x15')](EmailImap,EventEmitter);EmailImap[_0xddf4('0x16')]['getAccount']=function(_0x14d4f3,_0x1271bf){var _0x237079={'connTimeout':_0x14d4f3[_0xddf4('0x17')]?_0x14d4f3[_0xddf4('0x17')]*0x3e8:0x2710,'authTimeout':_0x14d4f3[_0xddf4('0x18')]?_0x14d4f3['authTimeout']*0x3e8:0x1388};if(_[_0xddf4('0x19')](_0x14d4f3[_0xddf4('0x1a')])){if(_0x14d4f3['authentication']){_0x237079[_0xddf4('0x1b')]=_0x14d4f3[_0xddf4('0x1b')];_0x237079['password']=_0x14d4f3[_0xddf4('0x1c')];}_0x237079['host']=_0x14d4f3[_0xddf4('0x1d')];_0x237079[_0xddf4('0x1e')]=_0x14d4f3[_0xddf4('0x1e')]||0x3e1;if(_0x14d4f3[_0xddf4('0x1f')]){_0x237079[_0xddf4('0x1f')]=!![];}else{_0x237079['tls']=![];_0x237079[_0xddf4('0x20')]=_0xddf4('0x21');}}else{_0x237079['user']=_0x14d4f3[_0xddf4('0x1b')];_0x237079[_0xddf4('0x1c')]=_0x14d4f3[_0xddf4('0x1c')];_0x237079[_0xddf4('0x1d')]=utils[_0xddf4('0x22')](_0x14d4f3[_0xddf4('0x1a')]);_0x237079[_0xddf4('0x1e')]=0x3e1;_0x237079[_0xddf4('0x1f')]=!![];}_0x237079[_0xddf4('0x8')]=_0x1271bf||_0x14d4f3[_0xddf4('0x1b')]||_0xddf4('0x23');return _0x237079;};EmailImap['prototype'][_0xddf4('0xf')]=function(){this[_0xddf4('0xc')][_0xddf4('0x24')](this['mailbox'],![],this[_0xddf4('0x25')]['bind'](this));};EmailImap['prototype'][_0xddf4('0x25')]=function(_0x5d9d7b,_0x5086c5){if(_0x5d9d7b){this[_0xddf4('0x13')](_0x5d9d7b,!![]);}else{this[_0xddf4('0x26')](_0xddf4('0x27'),_0x5086c5);this[_0xddf4('0x28')]();}};EmailImap[_0xddf4('0x16')][_0xddf4('0x29')]=function(_0x34435b){if(_0x34435b){this[_0xddf4('0x13')](_0x34435b,!![]);}else{this['imap']['end']();}};EmailImap[_0xddf4('0x16')]['readUnseen']=function(){this['imap'][_0xddf4('0x2a')]([_0xddf4('0x2b')],this[_0xddf4('0x2c')][_0xddf4('0x10')](this));};EmailImap[_0xddf4('0x16')][_0xddf4('0x2c')]=function(_0xaf8e4c,_0x19842c){if(_0xaf8e4c){this[_0xddf4('0x13')](_0xaf8e4c,!![]);}else{if(_0x19842c[_0xddf4('0x2d')]){try{var _0x152ceb=this[_0xddf4('0xc')]['fetch'](_0x19842c,{'bodies':'','markSeen':!![]});_0x152ceb['on'](_0xddf4('0x2e'),this['handleFetchMessage'][_0xddf4('0x10')](this));_0x152ceb[_0xddf4('0xd')](_0xddf4('0x12'),this['handleFetchError'][_0xddf4('0x10')](this));_0x152ceb[_0xddf4('0xd')](_0xddf4('0x2f'),this[_0xddf4('0x30')][_0xddf4('0x10')](this));}catch(_0x43e694){logger[_0xddf4('0x12')](_0x43e694);}}else{this['imap'][_0xddf4('0x31')](!![],this[_0xddf4('0x29')][_0xddf4('0x10')](this));}}};EmailImap['prototype'][_0xddf4('0x32')]=function(_0x385ff8,_0x5312e8){_0x385ff8['on'](_0xddf4('0x33'),this[_0xddf4('0x34')][_0xddf4('0x10')](this));_0x385ff8[_0xddf4('0xd')](_0xddf4('0x35'),this[_0xddf4('0x36')]['bind'](this));_0x385ff8[_0xddf4('0xd')](_0xddf4('0x2f'),this[_0xddf4('0x37')][_0xddf4('0x10')](this));};EmailImap['prototype'][_0xddf4('0x34')]=function(_0x21943a,_0x2dc02f){simpleParser(_0x21943a,this[_0xddf4('0x38')][_0xddf4('0x10')](this));};EmailImap['prototype']['handleMessageAttributes']=function(_0x5a487e){};EmailImap['prototype'][_0xddf4('0x37')]=function(){};EmailImap[_0xddf4('0x16')][_0xddf4('0x38')]=function(_0x5853da,_0x17881a){if(_0x5853da){logger[_0xddf4('0x12')](_0x5853da);}else{var _0x1b61cd=this;utils[_0xddf4('0x39')](this['account'],_0x17881a,function(_0xf35ae3){_0x1b61cd[_0xddf4('0x26')](_0xddf4('0x8'),_0xf35ae3);});}};EmailImap[_0xddf4('0x16')][_0xddf4('0x30')]=function(){this[_0xddf4('0xc')]['closeBox'](!![],this[_0xddf4('0x29')][_0xddf4('0x10')](this));};EmailImap[_0xddf4('0x16')]['handleFetchError']=function(_0xbaa11c){this['handleError'](_0xbaa11c);this[_0xddf4('0xc')][_0xddf4('0x31')](!![],this[_0xddf4('0x29')][_0xddf4('0x10')](this));};EmailImap['prototype'][_0xddf4('0x11')]=function(){this[_0xddf4('0x26')](_0xddf4('0x2f'));};EmailImap[_0xddf4('0x16')][_0xddf4('0x13')]=function(_0x3e62f5,_0x31630b){logger[_0xddf4('0x12')](_0xddf4('0x13'),this['account']['email'],JSON[_0xddf4('0x3a')](_0x3e62f5));var _0x3c8b55='';if(_0x3e62f5){if(_0x3e62f5['textCode']){_0x3c8b55=_0x3e62f5[_0xddf4('0x3b')];}else{for(var _0x4049a5 in _0x3e62f5){if(_0x3e62f5[_0xddf4('0x3c')](_0x4049a5)){_0x3c8b55+=_[_0xddf4('0x3d')](_0x4049a5)+':\x20'+_0x3e62f5[_0x4049a5]+'\x0a';}}}}if(_0x31630b){this['imap']['end']();}else{this[_0xddf4('0x26')](_0xddf4('0x12'),_0x3c8b55);this[_0xddf4('0x26')](_0xddf4('0x2f'));}};module[_0xddf4('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index f1934e7..475d917 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 _0x5134=['use','compile','sendMail','toString','prototype','verify','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','createTransport'];(function(_0x4c0845,_0x12c6d8){var _0x2ada77=function(_0x55bf3c){while(--_0x55bf3c){_0x4c0845['push'](_0x4c0845['shift']());}};_0x2ada77(++_0x12c6d8);}(_0x5134,0x131));var _0x4513=function(_0x256823,_0x2392df){_0x256823=_0x256823-0x0;var _0x5db66b=_0x5134[_0x256823];return _0x5db66b;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x4513('0x0'));var inlineBase64=require(_0x4513('0x1'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0xfb0fe2,_0x30b448){return new BPromise(function(_0x512a31,_0x1d523c){var _0x267c03=nodemailer[_0x4513('0x2')](_0xfb0fe2);_0x267c03[_0x4513('0x3')](_0x4513('0x4'),inlineBase64());_0x267c03[_0x4513('0x5')](_0x30b448,function(_0x4ea7ef,_0x5c86ce){if(_0x4ea7ef){_0x1d523c(_0x4ea7ef[_0x4513('0x6')]());}else{_0x512a31(_0x5c86ce);}});});};EmailSmtp[_0x4513('0x7')][_0x4513('0x8')]=function(_0x310443){return new BPromise(function(_0xf4829,_0x5a49ff){var _0x5cff0a=nodemailer[_0x4513('0x2')](_0x310443);_0x5cff0a['verify'](function(_0x2f1b48,_0xadd4f3){if(_0x2f1b48){_0x5a49ff(_0x2f1b48[_0x4513('0x6')]());}else{if(_0xadd4f3){_0xf4829(_0xadd4f3);}else{_0x5a49ff(_0x4513('0x9'));}}});});};module[_0x4513('0xa')]=EmailSmtp; \ No newline at end of file +var _0xaa61=['createTransport','compile','sendMail','verify','toString','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x2c51d0,_0x55816b){var _0x1e6d11=function(_0x23ccb9){while(--_0x23ccb9){_0x2c51d0['push'](_0x2c51d0['shift']());}};_0x1e6d11(++_0x55816b);}(_0xaa61,0x165));var _0x1aa6=function(_0x11a655,_0x36b87b){_0x11a655=_0x11a655-0x0;var _0x15184f=_0xaa61[_0x11a655];return _0x15184f;};'use strict';var nodemailer=require(_0x1aa6('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x1aa6('0x1'));function EmailSmtp(){}EmailSmtp[_0x1aa6('0x2')]['send']=function(_0x400927,_0x247570){return new BPromise(function(_0x49a4cd,_0x43b8f8){var _0x1ec266=nodemailer[_0x1aa6('0x3')](_0x400927);_0x1ec266['use'](_0x1aa6('0x4'),inlineBase64());_0x1ec266[_0x1aa6('0x5')](_0x247570,function(_0x64685e,_0x5d330c){if(_0x64685e){_0x43b8f8(_0x64685e['toString']());}else{_0x49a4cd(_0x5d330c);}});});};EmailSmtp[_0x1aa6('0x2')]['verify']=function(_0x547d0f){return new BPromise(function(_0x543c5f,_0x982906){var _0x2687dc=nodemailer['createTransport'](_0x547d0f);_0x2687dc[_0x1aa6('0x6')](function(_0x557aca,_0x30039a){if(_0x557aca){_0x982906(_0x557aca[_0x1aa6('0x7')]());}else{if(_0x30039a){_0x543c5f(_0x30039a);}else{_0x982906('Not\x20verifired');}}});});};module[_0x1aa6('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index abcd48b..ce23bab 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 _0x7fa1=['now','join','server/files/attachments/','writeFileSync','push','contentType','parser','from','subject','messageId','inReplyTo','date','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','content','Attachments','Title','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','Anonymous','length','pop','isEmpty','html','test','replace','body','textAsHtml','originTo','message','originCc','includes','attachments','attach','attachment','filename','attachment-','%s-%s'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x7fa1,0x15c));var _0x17fa=function(_0x106c52,_0x16fe87){_0x106c52=_0x106c52-0x0;var _0x29ab9e=_0x7fa1[_0x106c52];return _0x29ab9e;};'use strict';var _=require(_0x17fa('0x0'));var moment=require(_0x17fa('0x1'));var random=require(_0x17fa('0x2'));var fs=require('fs');var path=require(_0x17fa('0x3'));var util=require(_0x17fa('0x4'));var tnef=require(_0x17fa('0x5'));var logger=require(_0x17fa('0x6'))(_0x17fa('0x7'));var config=require(_0x17fa('0x8'));function getAddress(_0x365f07){var _0x56ee5b=_[_0x17fa('0x9')](_0x365f07[_0x17fa('0xa')]);return _0x56ee5b&&_0x56ee5b[_0x17fa('0xb')]?_0x56ee5b[_0x17fa('0xb')]:_0x17fa('0xc')+random[_0x17fa('0xd')](0x6)+_0x17fa('0xe');}function getFirstName(_0x518964){var _0x36620e=_[_0x17fa('0x9')](_0x518964[_0x17fa('0xa')]);if(_0x36620e&&_0x36620e[_0x17fa('0xf')]){var _0x3873f8=_0x36620e[_0x17fa('0xf')][_0x17fa('0x10')](/\s+/);return _0x3873f8['length']?_0x3873f8['slice'](0x0,-0x1)['join']('\x20'):_0x36620e[_0x17fa('0xf')];}return _0x17fa('0x11');}function getLastName(_0x564eea){var _0x41a220=_['head'](_0x564eea['value']);if(_0x41a220&&_0x41a220[_0x17fa('0xf')]){var _0x57a7a6=_0x41a220[_0x17fa('0xf')][_0x17fa('0x10')](/\s+/);return _0x57a7a6[_0x17fa('0x12')]>0x1?_0x57a7a6[_0x17fa('0x13')]():'';}return'';}function getMails(_0x4649ab,_0x5b2f32){var _0x1056ff='';for(var _0x1dac20=0x0;_0x1dac20<_0x5b2f32[_0x17fa('0xa')]['length'];_0x1dac20+=0x1){if(_0x5b2f32['value'][_0x1dac20][_0x17fa('0xb')]!==_0x4649ab){if(!_[_0x17fa('0x14')](_0x1056ff)){_0x1056ff+=',';}_0x1056ff+=_0x5b2f32[_0x17fa('0xa')][_0x1dac20]['name']||_0x5b2f32['value'][_0x1dac20][_0x17fa('0xb')]||'';_0x1056ff+='\x20<';_0x1056ff+=_0x5b2f32[_0x17fa('0xa')][_0x1dac20][_0x17fa('0xb')]?_0x5b2f32[_0x17fa('0xa')][_0x1dac20][_0x17fa('0xb')]:_0x17fa('0xc')+random[_0x17fa('0xd')](0x6)+'@xcally.com';_0x1056ff+='>';}}return _0x1056ff;}function parseEmail(_0x1cc94a,_0x39b115,_0x2957d6){if(_0x39b115[_0x17fa('0x15')]){var _0x1a5781=/)<[^<]*)*<\/script>/gi;while(_0x1a5781[_0x17fa('0x16')](_0x39b115[_0x17fa('0x15')])){_0x39b115[_0x17fa('0x15')]=_0x39b115['html'][_0x17fa('0x17')](_0x1a5781,'');}_0x2957d6['body']=_0x39b115[_0x17fa('0x15')];}else{_0x2957d6[_0x17fa('0x18')]=_0x39b115[_0x17fa('0x19')];}if(_0x2957d6['body']){_0x2957d6['body']=_0x2957d6['body'][_0x17fa('0x17')](/Empty\x20message

';if(_0x47676b[_0x17fa('0x35')]){for(var _0x2f2921=0x0;_0x2f2921<_0x47676b[_0x17fa('0x35')][_0x17fa('0x12')];_0x2f2921++){var _0x1a69f3=_0x47676b[_0x17fa('0x35')][_0x2f2921];_0x1c99bb[_0x17fa('0x1b')]['attachments'][_0x17fa('0x28')]({'filename':_0x1a69f3[_0x17fa('0x36')],'content':new Buffer(_0x1a69f3[_0x17fa('0x37')])});}}}_0x3fe583(parseEmail(_0xb6cc2c,_0x4b9927,_0x1c99bb));});}else{_0x4b9927[_0x17fa('0x15')]='

Empty\x20message

';_0x3fe583(parseEmail(_0xb6cc2c,_0x4b9927,_0x1c99bb));}}else{_0x3fe583(parseEmail(_0xb6cc2c,_0x4b9927,_0x1c99bb));}};exports[_0x17fa('0x38')]=function(_0x3630a4){switch(_0x3630a4){case _0x17fa('0x39'):return _0x17fa('0x3a');case'yahoo':return _0x17fa('0x3b');case _0x17fa('0x3c'):return _0x17fa('0x3d');case _0x17fa('0x3e'):return'outlook.office365.com';}return _0x17fa('0x3f');}; \ No newline at end of file +var _0x36fe=['length','join','Anonymous','split','pop','isEmpty','generate','html','test','body','replace','Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','@xcally.com','head','name'];(function(_0x57f5f9,_0x35c7d0){var _0x4567de=function(_0x5e8836){while(--_0x5e8836){_0x57f5f9['push'](_0x57f5f9['shift']());}};_0x4567de(++_0x35c7d0);}(_0x36fe,0x127));var _0xe36f=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x36fe[_0x586fa2];return _0x515be9;};'use strict';var _=require(_0xe36f('0x0'));var moment=require(_0xe36f('0x1'));var random=require(_0xe36f('0x2'));var fs=require('fs');var path=require(_0xe36f('0x3'));var util=require(_0xe36f('0x4'));var tnef=require(_0xe36f('0x5'));var logger=require(_0xe36f('0x6'))(_0xe36f('0x7'));var config=require(_0xe36f('0x8'));function getAddress(_0x3a8892){var _0x34e023=_['head'](_0x3a8892[_0xe36f('0x9')]);return _0x34e023&&_0x34e023['address']?_0x34e023[_0xe36f('0xa')]:_0xe36f('0xb')+random['generate'](0x6)+_0xe36f('0xc');}function getFirstName(_0x21f2a5){var _0x50fd83=_[_0xe36f('0xd')](_0x21f2a5[_0xe36f('0x9')]);if(_0x50fd83&&_0x50fd83[_0xe36f('0xe')]){var _0x44bc2f=_0x50fd83[_0xe36f('0xe')]['split'](/\s+/);return _0x44bc2f[_0xe36f('0xf')]?_0x44bc2f['slice'](0x0,-0x1)[_0xe36f('0x10')]('\x20'):_0x50fd83[_0xe36f('0xe')];}return _0xe36f('0x11');}function getLastName(_0x4c42cc){var _0x187f4e=_[_0xe36f('0xd')](_0x4c42cc['value']);if(_0x187f4e&&_0x187f4e[_0xe36f('0xe')]){var _0x889c5d=_0x187f4e[_0xe36f('0xe')][_0xe36f('0x12')](/\s+/);return _0x889c5d['length']>0x1?_0x889c5d[_0xe36f('0x13')]():'';}return'';}function getMails(_0x8acac3,_0xd3436c){var _0x5e0ffd='';for(var _0x2fcef3=0x0;_0x2fcef3<_0xd3436c[_0xe36f('0x9')]['length'];_0x2fcef3+=0x1){if(_0xd3436c[_0xe36f('0x9')][_0x2fcef3][_0xe36f('0xa')]!==_0x8acac3){if(!_[_0xe36f('0x14')](_0x5e0ffd)){_0x5e0ffd+=',';}_0x5e0ffd+=_0xd3436c[_0xe36f('0x9')][_0x2fcef3][_0xe36f('0xe')]||_0xd3436c[_0xe36f('0x9')][_0x2fcef3]['address']||'';_0x5e0ffd+='\x20<';_0x5e0ffd+=_0xd3436c['value'][_0x2fcef3]['address']?_0xd3436c['value'][_0x2fcef3][_0xe36f('0xa')]:_0xe36f('0xb')+random[_0xe36f('0x15')](0x6)+_0xe36f('0xc');_0x5e0ffd+='>';}}return _0x5e0ffd;}function parseEmail(_0x58d56c,_0x5995c8,_0x1a85fe){if(_0x5995c8[_0xe36f('0x16')]){var _0x1502bf=/)<[^<]*)*<\/script>/gi;while(_0x1502bf[_0xe36f('0x17')](_0x5995c8[_0xe36f('0x16')])){_0x5995c8['html']=_0x5995c8[_0xe36f('0x16')]['replace'](_0x1502bf,'');}_0x1a85fe[_0xe36f('0x18')]=_0x5995c8[_0xe36f('0x16')];}else{_0x1a85fe[_0xe36f('0x18')]=_0x5995c8['textAsHtml'];}if(_0x1a85fe[_0xe36f('0x18')]){_0x1a85fe[_0xe36f('0x18')]=_0x1a85fe['body'][_0xe36f('0x19')](/0x0){if(this[_0x533a03+_0xd36f('0x24')]>0x0&&this[_0x533a03+_0xd36f('0x25')]>=this[_0x533a03+_0xd36f('0x24')]){return _0xd36f('0x26');}else{return'working';}}else{return'idle';}};Agent[_0xd36f('0x23')]['updateRealtime']=function(){var _0x19a4e4=[_0xd36f('0x27'),_0xd36f('0x28'),'openchannel',_0xd36f('0x29'),_0xd36f('0x2a')];for(var _0x30ff82=0x0;_0x30ff82<_0x19a4e4[_0xd36f('0x2b')];_0x30ff82+=0x1){var _0x316cad=this[_0xd36f('0x2c')](_0x19a4e4[_0x30ff82]);if(this[_0x19a4e4[_0x30ff82]+_0xd36f('0x2d')]!==_0x316cad){this[_0x19a4e4[_0x30ff82]+'StatusTime']=_['toNumber'](moment()[_0xd36f('0x2e')]('x'));}this[_0x19a4e4[_0x30ff82]+_0xd36f('0x2d')]=_0x316cad;}var _0xd8e642={'id':this['id'],'name':this[_0xd36f('0x9')],'online':this['online'],'voicePause':this[_0xd36f('0xb')],'chatPause':this[_0xd36f('0xc')],'mailPause':this[_0xd36f('0xd')],'smsPause':this['smsPause'],'faxPause':this[_0xd36f('0xe')],'openchannelPause':this[_0xd36f('0xf')],'chatStatus':this[_0xd36f('0x2f')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd36f('0x12')],'chatCurrentCapacity':this[_0xd36f('0x13')],'mailStatus':this[_0xd36f('0x14')],'mailStatusTime':this[_0xd36f('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xd36f('0x30')],'faxStatus':this[_0xd36f('0x17')],'faxStatusTime':this[_0xd36f('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xd36f('0x1a')],'smsStatus':this[_0xd36f('0x1b')],'smsStatusTime':this[_0xd36f('0x1c')],'smsCapacity':this[_0xd36f('0x1d')],'smsCurrentCapacity':this[_0xd36f('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xd36f('0x31')],'openchannelCapacity':this[_0xd36f('0x1f')],'openchannelCurrentCapacity':this[_0xd36f('0x20')],'busy':this[_0xd36f('0x21')],'busyQueue':this['busyQueue']};var _0x14dcb3=md5(JSON[_0xd36f('0x32')](_0xd8e642));if(this[_0xd36f('0x2')]!==_0x14dcb3){this[_0xd36f('0x2')]=_0x14dcb3;io[_0xd36f('0x33')](_0xd36f('0x34'),_0xd8e642);}};module[_0xd36f('0x35')]=Agent; \ No newline at end of file +var _0xb808=['emit','user:save','exports','moment','md5','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','updateRealtime','mail','fax','length','StatusTime','format','Status','chatStatus','mailCurrentCapacity','faxStatus','faxCurrentCapacity','smsCapacity','stringify'];(function(_0x31cf14,_0xc80a31){var _0x5321e0=function(_0x1a358e){while(--_0x1a358e){_0x31cf14['push'](_0x31cf14['shift']());}};_0x5321e0(++_0xc80a31);}(_0xb808,0xd7));var _0x8b80=function(_0x205a7e,_0x8539a3){_0x205a7e=_0x205a7e-0x0;var _0x51c5f4=_0xb808[_0x205a7e];return _0x51c5f4;};'use strict';var _=require('lodash');var moment=require(_0x8b80('0x0'));var md5=require(_0x8b80('0x1'));var Redis=require('ioredis');var config=require(_0x8b80('0x2'));config[_0x8b80('0x3')]=_['defaults'](config[_0x8b80('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x8b80('0x4'))(new Redis(config['redis']));function Agent(_0x249c97){this['id']=_0x249c97['id']||0x0;this[_0x8b80('0x5')]=_0x249c97[_0x8b80('0x5')]||'';this[_0x8b80('0x6')]=_0x249c97[_0x8b80('0x6')]||!![];this[_0x8b80('0x7')]=_0x249c97[_0x8b80('0x7')]||![];this[_0x8b80('0x8')]=_0x249c97[_0x8b80('0x8')]||![];this[_0x8b80('0x9')]=_0x249c97['mailPause']||![];this[_0x8b80('0xa')]=_0x249c97[_0x8b80('0xa')]||![];this[_0x8b80('0xb')]=_0x249c97[_0x8b80('0xb')]||![];this[_0x8b80('0xc')]=_0x249c97['openchannelPause']||![];this['chatStatus']=_0x8b80('0xd');this[_0x8b80('0xe')]=0x0;this[_0x8b80('0xf')]=_0x249c97[_0x8b80('0xf')]||0x0;this[_0x8b80('0x10')]=0x0;this[_0x8b80('0x11')]=_0x8b80('0xd');this[_0x8b80('0x12')]=0x0;this[_0x8b80('0x13')]=_0x249c97['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x8b80('0xd');this[_0x8b80('0x14')]=0x0;this['faxCapacity']=_0x249c97[_0x8b80('0x15')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x8b80('0x16')]=_0x8b80('0xd');this[_0x8b80('0x17')]=0x0;this['smsCapacity']=_0x249c97['smsCapacity']||0x0;this[_0x8b80('0x18')]=0x0;this[_0x8b80('0x19')]=_0x8b80('0xd');this[_0x8b80('0x1a')]=0x0;this[_0x8b80('0x1b')]=_0x249c97[_0x8b80('0x1b')]||0x0;this[_0x8b80('0x1c')]=0x0;this[_0x8b80('0x1d')]=![];this[_0x8b80('0x1e')]=undefined;this[_0x8b80('0x1')]='';this['updateRealtime']();}Agent[_0x8b80('0x1f')][_0x8b80('0x20')]=function(_0x451824){if(this[_0x451824+_0x8b80('0x21')]>0x0){if(this[_0x451824+_0x8b80('0x22')]>0x0&&this[_0x451824+_0x8b80('0x21')]>=this[_0x451824+_0x8b80('0x22')]){return _0x8b80('0x23');}else{return _0x8b80('0x24');}}else{return'idle';}};Agent[_0x8b80('0x1f')][_0x8b80('0x25')]=function(){var _0x199983=[_0x8b80('0x26'),'chat','openchannel',_0x8b80('0x27'),'sms'];for(var _0x1c1e85=0x0;_0x1c1e85<_0x199983[_0x8b80('0x28')];_0x1c1e85+=0x1){var _0x2bbb97=this[_0x8b80('0x20')](_0x199983[_0x1c1e85]);if(this[_0x199983[_0x1c1e85]+'Status']!==_0x2bbb97){this[_0x199983[_0x1c1e85]+_0x8b80('0x29')]=_['toNumber'](moment()[_0x8b80('0x2a')]('x'));}this[_0x199983[_0x1c1e85]+_0x8b80('0x2b')]=_0x2bbb97;}var _0x5effba={'id':this['id'],'name':this['name'],'online':this[_0x8b80('0x6')],'voicePause':this[_0x8b80('0x7')],'chatPause':this[_0x8b80('0x8')],'mailPause':this[_0x8b80('0x9')],'smsPause':this[_0x8b80('0xb')],'faxPause':this[_0x8b80('0xa')],'openchannelPause':this[_0x8b80('0xc')],'chatStatus':this[_0x8b80('0x2c')],'chatStatusTime':this[_0x8b80('0xe')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x8b80('0x10')],'mailStatus':this[_0x8b80('0x11')],'mailStatusTime':this[_0x8b80('0x12')],'mailCapacity':this[_0x8b80('0x13')],'mailCurrentCapacity':this[_0x8b80('0x2d')],'faxStatus':this[_0x8b80('0x2e')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x8b80('0x15')],'faxCurrentCapacity':this[_0x8b80('0x2f')],'smsStatus':this[_0x8b80('0x16')],'smsStatusTime':this[_0x8b80('0x17')],'smsCapacity':this[_0x8b80('0x30')],'smsCurrentCapacity':this[_0x8b80('0x18')],'openchannelStatus':this[_0x8b80('0x19')],'openchannelStatusTime':this[_0x8b80('0x1a')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x8b80('0x1c')],'busy':this['busy'],'busyQueue':this[_0x8b80('0x1e')]};var _0x3f32cd=md5(JSON[_0x8b80('0x31')](_0x5effba));if(this[_0x8b80('0x1')]!==_0x3f32cd){this[_0x8b80('0x1')]=_0x3f32cd;io[_0x8b80('0x32')](_0x8b80('0x33'),_0x5effba);}};module[_0x8b80('0x34')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 7965ba0..b284d28 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 _0x9c77=['prototype','_rr','map','updateRealtime','paused','loggedIn','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','updateRouting'];(function(_0x13d3e5,_0x17f5d0){var _0x2ef95b=function(_0x499868){while(--_0x499868){_0x13d3e5['push'](_0x13d3e5['shift']());}};_0x2ef95b(++_0x17f5d0);}(_0x9c77,0x1a3));var _0x79c7=function(_0x3f7611,_0x5e6e30){_0x3f7611=_0x3f7611-0x0;var _0x129ff1=_0x9c77[_0x3f7611];return _0x129ff1;};'use strict';var _=require(_0x79c7('0x0'));var md5=require(_0x79c7('0x1'));var util=require('util');var Redis=require(_0x79c7('0x2'));var config=require(_0x79c7('0x3'));config[_0x79c7('0x4')]=_[_0x79c7('0x5')](config['redis'],{'host':_0x79c7('0x6'),'port':0x18eb});var io=require(_0x79c7('0x7'))(new Redis(config[_0x79c7('0x4')]));function ChatQueue(_0x300b2a){this['id']=_0x300b2a['id']||0x0;this[_0x79c7('0x8')]=_0x300b2a['name']||'';this['timeout']=_0x300b2a['timeout']||0xa;this[_0x79c7('0x9')]=_0x300b2a['strategy']||'beepall';this['Agents']=_0x300b2a[_0x79c7('0xa')];this[_0x79c7('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x79c7('0xc')]();this['updateRealtime']();}ChatQueue[_0x79c7('0xd')][_0x79c7('0xc')]=function(){var _0x306570=this[_0x79c7('0xb')][_0x79c7('0xe')];this[_0x79c7('0xb')]=_[_0x79c7('0xf')](this[_0x79c7('0xa')],'id');this['mapAgentsId']['_rr']=_0x306570;};ChatQueue[_0x79c7('0xd')][_0x79c7('0x10')]=function(){this['loggedIn']=0x0;this[_0x79c7('0x11')]=0x0;for(var _0x6f606d=0x0;_0x6f606d=0x0?this[_0x79c7('0x14')]:0x0;var _0x3be0bd={'id':this['id'],'available':this[_0x79c7('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x79c7('0x11')],'waiting':this[_0x79c7('0x15')]};var _0x2cd59e=md5(JSON[_0x79c7('0x16')](_0x3be0bd));if(this[_0x79c7('0x1')]!==_0x2cd59e){this[_0x79c7('0x1')]=_0x2cd59e;io['to'](util[_0x79c7('0x17')](_0x79c7('0x18'),_0x3be0bd[_0x79c7('0x8')]))[_0x79c7('0x19')]('chat_queue:save',_0x3be0bd);}};module[_0x79c7('0x1a')]=ChatQueue; \ No newline at end of file +var _0x1cfa=['updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','Agents','length','online','chatPause','available','stringify','emit','chat_queue:save','exports','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','waiting','updateRouting'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x1cfa,0x1d0));var _0xa1cf=function(_0x438c9b,_0x11e600){_0x438c9b=_0x438c9b-0x0;var _0x412c43=_0x1cfa[_0x438c9b];return _0x412c43;};'use strict';var _=require(_0xa1cf('0x0'));var md5=require(_0xa1cf('0x1'));var util=require(_0xa1cf('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xa1cf('0x3')]=_[_0xa1cf('0x4')](config[_0xa1cf('0x3')],{'host':_0xa1cf('0x5'),'port':0x18eb});var io=require(_0xa1cf('0x6'))(new Redis(config[_0xa1cf('0x3')]));function ChatQueue(_0x368ade){this['id']=_0x368ade['id']||0x0;this[_0xa1cf('0x7')]=_0x368ade[_0xa1cf('0x7')]||'';this[_0xa1cf('0x8')]=_0x368ade['timeout']||0xa;this[_0xa1cf('0x9')]=_0x368ade[_0xa1cf('0x9')]||'beepall';this['Agents']=_0x368ade['Agents'];this['mapAgentsId']={};this[_0xa1cf('0xa')]=0x0;this[_0xa1cf('0x1')]='';this[_0xa1cf('0xb')]();this[_0xa1cf('0xc')]();}ChatQueue[_0xa1cf('0xd')][_0xa1cf('0xb')]=function(){var _0x55c02e=this['mapAgentsId'][_0xa1cf('0xe')];this[_0xa1cf('0xf')]=_[_0xa1cf('0x10')](this['Agents'],'id');this[_0xa1cf('0xf')]['_rr']=_0x55c02e;};ChatQueue[_0xa1cf('0xd')][_0xa1cf('0xc')]=function(){this[_0xa1cf('0x11')]=0x0;this[_0xa1cf('0x12')]=0x0;for(var _0x29a116=0x0;_0x29a116=0x0?this[_0xa1cf('0x17')]:0x0;var _0x1d966b={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa1cf('0x11')],'name':this[_0xa1cf('0x7')],'paused':this[_0xa1cf('0x12')],'waiting':this['waiting']};var _0x2a38ca=md5(JSON[_0xa1cf('0x18')](_0x1d966b));if(this[_0xa1cf('0x1')]!==_0x2a38ca){this[_0xa1cf('0x1')]=_0x2a38ca;io['to'](util['format']('chat:queue:%s',_0x1d966b['name']))[_0xa1cf('0x19')](_0xa1cf('0x1a'),_0x1d966b);}};module[_0xa1cf('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 6d4dee7..a309f39 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 _0x6ae5=['map','loggedIn','length','online','faxPause','available','paused','stringify','format','emit','fax_queue:save','exports','md5','util','ioredis','redis','defaults','name','timeout','strategy','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0x6ae5,0xae));var _0x56ae=function(_0x2c838e,_0x4edbd1){_0x2c838e=_0x2c838e-0x0;var _0x1316fb=_0x6ae5[_0x2c838e];return _0x1316fb;};'use strict';var _=require('lodash');var md5=require(_0x56ae('0x0'));var util=require(_0x56ae('0x1'));var Redis=require(_0x56ae('0x2'));var config=require('../../../config/environment');config[_0x56ae('0x3')]=_[_0x56ae('0x4')](config[_0x56ae('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x56ae('0x3')]));function FaxQueue(_0xa54ea2){this['id']=_0xa54ea2['id']||0x0;this[_0x56ae('0x5')]=_0xa54ea2['name']||'';this[_0x56ae('0x6')]=_0xa54ea2[_0x56ae('0x6')]||0xa;this['strategy']=_0xa54ea2[_0x56ae('0x7')]||'beepall';this[_0x56ae('0x8')]=_0xa54ea2[_0x56ae('0x8')];this['mapAgentsId']={};this[_0x56ae('0x9')]=0x0;this[_0x56ae('0x0')]='';this['updateRouting']();this[_0x56ae('0xa')]();}FaxQueue[_0x56ae('0xb')][_0x56ae('0xc')]=function(){var _0x233f47=this[_0x56ae('0xd')][_0x56ae('0xe')];this['mapAgentsId']=_[_0x56ae('0xf')](this[_0x56ae('0x8')],'id');this[_0x56ae('0xd')][_0x56ae('0xe')]=_0x233f47;};FaxQueue['prototype'][_0x56ae('0xa')]=function(){this[_0x56ae('0x10')]=0x0;this['paused']=0x0;for(var _0x5da3b9=0x0;_0x5da3b9=0x0?this['available']:0x0;var _0x33b62e={'id':this['id'],'available':this['available'],'loggedIn':this[_0x56ae('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x56ae('0x9')]};var _0x472512=md5(JSON[_0x56ae('0x16')](_0x33b62e));if(this[_0x56ae('0x0')]!==_0x472512){this[_0x56ae('0x0')]=_0x472512;io['to'](util[_0x56ae('0x17')]('fax:queue:%s',_0x33b62e[_0x56ae('0x5')]))[_0x56ae('0x18')](_0x56ae('0x19'),_0x33b62e);}};module[_0x56ae('0x1a')]=FaxQueue; \ No newline at end of file +var _0x00c2=['stringify','format','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available'];(function(_0x401a04,_0x27cd04){var _0x469676=function(_0x39aea1){while(--_0x39aea1){_0x401a04['push'](_0x401a04['shift']());}};_0x469676(++_0x27cd04);}(_0x00c2,0x159));var _0x200c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00c2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x200c('0x0'));var md5=require(_0x200c('0x1'));var util=require(_0x200c('0x2'));var Redis=require(_0x200c('0x3'));var config=require(_0x200c('0x4'));config[_0x200c('0x5')]=_[_0x200c('0x6')](config[_0x200c('0x5')],{'host':_0x200c('0x7'),'port':0x18eb});var io=require(_0x200c('0x8'))(new Redis(config['redis']));function FaxQueue(_0x5c6afc){this['id']=_0x5c6afc['id']||0x0;this['name']=_0x5c6afc[_0x200c('0x9')]||'';this[_0x200c('0xa')]=_0x5c6afc[_0x200c('0xa')]||0xa;this[_0x200c('0xb')]=_0x5c6afc[_0x200c('0xb')]||_0x200c('0xc');this[_0x200c('0xd')]=_0x5c6afc[_0x200c('0xd')];this[_0x200c('0xe')]={};this[_0x200c('0xf')]=0x0;this[_0x200c('0x1')]='';this[_0x200c('0x10')]();this[_0x200c('0x11')]();}FaxQueue[_0x200c('0x12')][_0x200c('0x10')]=function(){var _0x252d8c=this[_0x200c('0xe')][_0x200c('0x13')];this[_0x200c('0xe')]=_[_0x200c('0x14')](this[_0x200c('0xd')],'id');this[_0x200c('0xe')]['_rr']=_0x252d8c;};FaxQueue[_0x200c('0x12')][_0x200c('0x11')]=function(){this[_0x200c('0x15')]=0x0;this[_0x200c('0x16')]=0x0;for(var _0x3c525a=0x0;_0x3c525a=0x0?this[_0x200c('0x1a')]:0x0;var _0x10f37e={'id':this['id'],'available':this[_0x200c('0x1a')],'loggedIn':this[_0x200c('0x15')],'name':this['name'],'paused':this[_0x200c('0x16')],'waiting':this['waiting']};var _0x3a8d54=md5(JSON[_0x200c('0x1b')](_0x10f37e));if(this[_0x200c('0x1')]!==_0x3a8d54){this[_0x200c('0x1')]=_0x3a8d54;io['to'](util[_0x200c('0x1c')]('fax:queue:%s',_0x10f37e[_0x200c('0x9')]))[_0x200c('0x1d')](_0x200c('0x1e'),_0x10f37e);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 558f19c..a4daed0 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 _0x1ad1=['Intervals','name'];(function(_0x19db4e,_0x379ed6){var _0x4efb03=function(_0x390155){while(--_0x390155){_0x19db4e['push'](_0x19db4e['shift']());}};_0x4efb03(++_0x379ed6);}(_0x1ad1,0x19d));var _0x11ad=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1ad1[_0x19e35c];return _0x3e1fe8;};'use strict';function Interval(_0x2ad90b){this['id']=_0x2ad90b['id']||0x0;this[_0x11ad('0x0')]=_0x2ad90b[_0x11ad('0x0')]||'';this[_0x11ad('0x1')]=_0x2ad90b[_0x11ad('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xa9e5=['name','Intervals'];(function(_0x108fe9,_0x485e06){var _0x204349=function(_0x1d22ea){while(--_0x1d22ea){_0x108fe9['push'](_0x108fe9['shift']());}};_0x204349(++_0x485e06);}(_0xa9e5,0x1e0));var _0x5a9e=function(_0x113577,_0x3559b0){_0x113577=_0x113577-0x0;var _0x2cb452=_0xa9e5[_0x113577];return _0x2cb452;};'use strict';function Interval(_0x4b8417){this['id']=_0x4b8417['id']||0x0;this['name']=_0x4b8417[_0x5a9e('0x0')]||'';this[_0x5a9e('0x1')]=_0x4b8417[_0x5a9e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 7cbe9b6..9dfe46b 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 _0xb96d=['mail_queue:save','exports','md5','util','ioredis','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format'];(function(_0xc898fd,_0x35cd76){var _0x51fb89=function(_0x7908e1){while(--_0x7908e1){_0xc898fd['push'](_0xc898fd['shift']());}};_0x51fb89(++_0x35cd76);}(_0xb96d,0x9e));var _0xdb96=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xb96d[_0x43776a];return _0x18eb8f;};'use strict';var _=require('lodash');var md5=require(_0xdb96('0x0'));var util=require(_0xdb96('0x1'));var Redis=require(_0xdb96('0x2'));var config=require('../../../config/environment');config[_0xdb96('0x3')]=_[_0xdb96('0x4')](config[_0xdb96('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdb96('0x3')]));function MailQueue(_0x2583a1){this['id']=_0x2583a1['id']||0x0;this[_0xdb96('0x5')]=_0x2583a1[_0xdb96('0x5')]||'';this['timeout']=_0x2583a1[_0xdb96('0x6')]||0xa;this[_0xdb96('0x7')]=_0x2583a1['strategy']||_0xdb96('0x8');this['Agents']=_0x2583a1[_0xdb96('0x9')];this[_0xdb96('0xa')]={};this['waiting']=0x0;this[_0xdb96('0x0')]='';this[_0xdb96('0xb')]();this['updateRealtime']();}MailQueue[_0xdb96('0xc')][_0xdb96('0xb')]=function(){var _0x2e78b6=this[_0xdb96('0xa')]['_rr'];this[_0xdb96('0xa')]=_[_0xdb96('0xd')](this[_0xdb96('0x9')],'id');this['mapAgentsId'][_0xdb96('0xe')]=_0x2e78b6;};MailQueue[_0xdb96('0xc')][_0xdb96('0xf')]=function(){this[_0xdb96('0x10')]=0x0;this[_0xdb96('0x11')]=0x0;for(var _0xf88086=0x0;_0xf88086=0x0?this[_0xdb96('0x15')]:0x0;var _0x33ec8f={'id':this['id'],'available':this[_0xdb96('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xdb96('0x11')],'waiting':this['waiting']};var _0x51a885=md5(JSON[_0xdb96('0x16')](_0x33ec8f));if(this[_0xdb96('0x0')]!==_0x51a885){this[_0xdb96('0x0')]=_0x51a885;io['to'](util[_0xdb96('0x17')]('mail:queue:%s',_0x33ec8f[_0xdb96('0x5')]))['emit'](_0xdb96('0x18'),_0x33ec8f);}};module[_0xdb96('0x19')]=MailQueue; \ No newline at end of file +var _0xad40=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','paused','available','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x37125d,_0x2af7df){var _0x29f232=function(_0x207537){while(--_0x207537){_0x37125d['push'](_0x37125d['shift']());}};_0x29f232(++_0x2af7df);}(_0xad40,0xfa));var _0x0ad4=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xad40[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0ad4('0x0'));var md5=require(_0x0ad4('0x1'));var util=require(_0x0ad4('0x2'));var Redis=require(_0x0ad4('0x3'));var config=require('../../../config/environment');config[_0x0ad4('0x4')]=_[_0x0ad4('0x5')](config[_0x0ad4('0x4')],{'host':_0x0ad4('0x6'),'port':0x18eb});var io=require(_0x0ad4('0x7'))(new Redis(config[_0x0ad4('0x4')]));function MailQueue(_0x39131b){this['id']=_0x39131b['id']||0x0;this['name']=_0x39131b[_0x0ad4('0x8')]||'';this[_0x0ad4('0x9')]=_0x39131b[_0x0ad4('0x9')]||0xa;this[_0x0ad4('0xa')]=_0x39131b[_0x0ad4('0xa')]||_0x0ad4('0xb');this[_0x0ad4('0xc')]=_0x39131b['Agents'];this[_0x0ad4('0xd')]={};this[_0x0ad4('0xe')]=0x0;this[_0x0ad4('0x1')]='';this[_0x0ad4('0xf')]();this[_0x0ad4('0x10')]();}MailQueue[_0x0ad4('0x11')][_0x0ad4('0xf')]=function(){var _0x48c3d9=this[_0x0ad4('0xd')][_0x0ad4('0x12')];this[_0x0ad4('0xd')]=_[_0x0ad4('0x13')](this[_0x0ad4('0xc')],'id');this[_0x0ad4('0xd')][_0x0ad4('0x12')]=_0x48c3d9;};MailQueue[_0x0ad4('0x11')][_0x0ad4('0x10')]=function(){this[_0x0ad4('0x14')]=0x0;this['paused']=0x0;for(var _0x920236=0x0;_0x920236=0x0?this[_0x0ad4('0x18')]:0x0;var _0x5dbea6={'id':this['id'],'available':this[_0x0ad4('0x18')],'loggedIn':this[_0x0ad4('0x14')],'name':this[_0x0ad4('0x8')],'paused':this[_0x0ad4('0x17')],'waiting':this[_0x0ad4('0xe')]};var _0x5a3460=md5(JSON['stringify'](_0x5dbea6));if(this[_0x0ad4('0x1')]!==_0x5a3460){this['md5']=_0x5a3460;io['to'](util['format'](_0x0ad4('0x19'),_0x5dbea6['name']))[_0x0ad4('0x1a')](_0x0ad4('0x1b'),_0x5dbea6);}};module[_0x0ad4('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 02fb7d6..6b89229 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 _0xe16a=['loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr'];(function(_0x1c2ad3,_0x1105eb){var _0x383430=function(_0xdb15f){while(--_0xdb15f){_0x1c2ad3['push'](_0x1c2ad3['shift']());}};_0x383430(++_0x1105eb);}(_0xe16a,0x185));var _0xae16=function(_0x3ccad7,_0x447b5e){_0x3ccad7=_0x3ccad7-0x0;var _0x94a949=_0xe16a[_0x3ccad7];return _0x94a949;};'use strict';var _=require('lodash');var md5=require(_0xae16('0x0'));var util=require('util');var Redis=require(_0xae16('0x1'));var config=require(_0xae16('0x2'));config[_0xae16('0x3')]=_[_0xae16('0x4')](config[_0xae16('0x3')],{'host':_0xae16('0x5'),'port':0x18eb});var io=require(_0xae16('0x6'))(new Redis(config[_0xae16('0x3')]));function OpenchannelQueue(_0x489fb7){this['id']=_0x489fb7['id']||0x0;this[_0xae16('0x7')]=_0x489fb7[_0xae16('0x7')]||'';this['timeout']=_0x489fb7[_0xae16('0x8')]||0xa;this[_0xae16('0x9')]=_0x489fb7[_0xae16('0x9')]||'beepall';this['Agents']=_0x489fb7[_0xae16('0xa')];this[_0xae16('0xb')]={};this[_0xae16('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xae16('0xd')]();}OpenchannelQueue[_0xae16('0xe')]['updateRouting']=function(){var _0x10afeb=this[_0xae16('0xb')][_0xae16('0xf')];this[_0xae16('0xb')]=_['map'](this[_0xae16('0xa')],'id');this['mapAgentsId']['_rr']=_0x10afeb;};OpenchannelQueue[_0xae16('0xe')][_0xae16('0xd')]=function(){this[_0xae16('0x10')]=0x0;this[_0xae16('0x11')]=0x0;for(var _0x3206f5=0x0;_0x3206f5=0x0?this[_0xae16('0x15')]:0x0;var _0x151104={'id':this['id'],'available':this['available'],'loggedIn':this[_0xae16('0x10')],'name':this[_0xae16('0x7')],'paused':this['paused'],'waiting':this[_0xae16('0xc')]};var _0x23a102=md5(JSON[_0xae16('0x16')](_0x151104));if(this['md5']!==_0x23a102){this[_0xae16('0x0')]=_0x23a102;io['to'](util[_0xae16('0x17')](_0xae16('0x18'),_0x151104[_0xae16('0x7')]))[_0xae16('0x19')](_0xae16('0x1a'),_0x151104);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xc967=['../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xc967,0xe4));var _0x7c96=function(_0x1d72a2,_0x5083b0){_0x1d72a2=_0x1d72a2-0x0;var _0x3b194b=_0xc967[_0x1d72a2];return _0x3b194b;};'use strict';var _=require(_0x7c96('0x0'));var md5=require(_0x7c96('0x1'));var util=require(_0x7c96('0x2'));var Redis=require(_0x7c96('0x3'));var config=require(_0x7c96('0x4'));config[_0x7c96('0x5')]=_[_0x7c96('0x6')](config[_0x7c96('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7c96('0x5')]));function OpenchannelQueue(_0x165ec3){this['id']=_0x165ec3['id']||0x0;this[_0x7c96('0x7')]=_0x165ec3[_0x7c96('0x7')]||'';this[_0x7c96('0x8')]=_0x165ec3[_0x7c96('0x8')]||0xa;this[_0x7c96('0x9')]=_0x165ec3[_0x7c96('0x9')]||_0x7c96('0xa');this[_0x7c96('0xb')]=_0x165ec3[_0x7c96('0xb')];this[_0x7c96('0xc')]={};this[_0x7c96('0xd')]=0x0;this[_0x7c96('0x1')]='';this[_0x7c96('0xe')]();this[_0x7c96('0xf')]();}OpenchannelQueue[_0x7c96('0x10')]['updateRouting']=function(){var _0x16abda=this[_0x7c96('0xc')][_0x7c96('0x11')];this['mapAgentsId']=_['map'](this[_0x7c96('0xb')],'id');this[_0x7c96('0xc')][_0x7c96('0x11')]=_0x16abda;};OpenchannelQueue[_0x7c96('0x10')]['updateRealtime']=function(){this[_0x7c96('0x12')]=0x0;this[_0x7c96('0x13')]=0x0;for(var _0x22fa20=0x0;_0x22fa20=0x0?this[_0x7c96('0x16')]:0x0;var _0x22e33={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x7c96('0x7')],'paused':this[_0x7c96('0x13')],'waiting':this['waiting']};var _0x96e256=md5(JSON[_0x7c96('0x17')](_0x22e33));if(this[_0x7c96('0x1')]!==_0x96e256){this[_0x7c96('0x1')]=_0x96e256;io['to'](util[_0x7c96('0x18')](_0x7c96('0x19'),_0x22e33[_0x7c96('0x7')]))[_0x7c96('0x1a')](_0x7c96('0x1b'),_0x22e33);}};module[_0x7c96('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index f5cdce5..85977ef 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 _0x7d7a=['localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','Agents','paused','online','loggedIn','available','stringify','format','sms:queue:%s','emit','exports','md5','util','../../../config/environment','redis','defaults'];(function(_0x457062,_0x1893df){var _0x4df1a9=function(_0x5b9652){while(--_0x5b9652){_0x457062['push'](_0x457062['shift']());}};_0x4df1a9(++_0x1893df);}(_0x7d7a,0x124));var _0xa7d7=function(_0x219a87,_0x2102ef){_0x219a87=_0x219a87-0x0;var _0x3eedf6=_0x7d7a[_0x219a87];return _0x3eedf6;};'use strict';var _=require('lodash');var md5=require(_0xa7d7('0x0'));var util=require(_0xa7d7('0x1'));var Redis=require('ioredis');var config=require(_0xa7d7('0x2'));config[_0xa7d7('0x3')]=_[_0xa7d7('0x4')](config[_0xa7d7('0x3')],{'host':_0xa7d7('0x5'),'port':0x18eb});var io=require(_0xa7d7('0x6'))(new Redis(config[_0xa7d7('0x3')]));function SmsQueue(_0x27cd3c){this['id']=_0x27cd3c['id']||0x0;this[_0xa7d7('0x7')]=_0x27cd3c[_0xa7d7('0x7')]||'';this[_0xa7d7('0x8')]=_0x27cd3c[_0xa7d7('0x8')]||0xa;this[_0xa7d7('0x9')]=_0x27cd3c[_0xa7d7('0x9')]||_0xa7d7('0xa');this['Agents']=_0x27cd3c['Agents'];this[_0xa7d7('0xb')]={};this[_0xa7d7('0xc')]=0x0;this['md5']='';this[_0xa7d7('0xd')]();this[_0xa7d7('0xe')]();}SmsQueue[_0xa7d7('0xf')][_0xa7d7('0xd')]=function(){var _0x19b921=this[_0xa7d7('0xb')][_0xa7d7('0x10')];this[_0xa7d7('0xb')]=_['map'](this[_0xa7d7('0x11')],'id');this[_0xa7d7('0xb')][_0xa7d7('0x10')]=_0x19b921;};SmsQueue[_0xa7d7('0xf')][_0xa7d7('0xe')]=function(){this['loggedIn']=0x0;this[_0xa7d7('0x12')]=0x0;for(var _0x3defa1=0x0;_0x3defa1=0x0?this[_0xa7d7('0x15')]:0x0;var _0x35c6ca={'id':this['id'],'available':this[_0xa7d7('0x15')],'loggedIn':this[_0xa7d7('0x14')],'name':this[_0xa7d7('0x7')],'paused':this[_0xa7d7('0x12')],'waiting':this['waiting']};var _0x253fd7=md5(JSON[_0xa7d7('0x16')](_0x35c6ca));if(this[_0xa7d7('0x0')]!==_0x253fd7){this[_0xa7d7('0x0')]=_0x253fd7;io['to'](util[_0xa7d7('0x17')](_0xa7d7('0x18'),_0x35c6ca[_0xa7d7('0x7')]))[_0xa7d7('0x19')]('sms_queue:save',_0x35c6ca);}};module[_0xa7d7('0x1a')]=SmsQueue; \ No newline at end of file +var _0x88ce=['sms:queue:%s','sms_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','length','online','smsPause','available','paused','stringify','format'];(function(_0x1839a8,_0x88627){var _0x180edc=function(_0x59760c){while(--_0x59760c){_0x1839a8['push'](_0x1839a8['shift']());}};_0x180edc(++_0x88627);}(_0x88ce,0xab));var _0xe88c=function(_0x1682a5,_0x9a883d){_0x1682a5=_0x1682a5-0x0;var _0x215d4f=_0x88ce[_0x1682a5];return _0x215d4f;};'use strict';var _=require('lodash');var md5=require(_0xe88c('0x0'));var util=require('util');var Redis=require(_0xe88c('0x1'));var config=require(_0xe88c('0x2'));config[_0xe88c('0x3')]=_[_0xe88c('0x4')](config[_0xe88c('0x3')],{'host':_0xe88c('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe88c('0x3')]));function SmsQueue(_0x2945d8){this['id']=_0x2945d8['id']||0x0;this[_0xe88c('0x6')]=_0x2945d8[_0xe88c('0x6')]||'';this[_0xe88c('0x7')]=_0x2945d8['timeout']||0xa;this[_0xe88c('0x8')]=_0x2945d8[_0xe88c('0x8')]||_0xe88c('0x9');this['Agents']=_0x2945d8[_0xe88c('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xe88c('0x0')]='';this['updateRouting']();this[_0xe88c('0xb')]();}SmsQueue[_0xe88c('0xc')][_0xe88c('0xd')]=function(){var _0x243933=this[_0xe88c('0xe')][_0xe88c('0xf')];this[_0xe88c('0xe')]=_[_0xe88c('0x10')](this[_0xe88c('0xa')],'id');this[_0xe88c('0xe')]['_rr']=_0x243933;};SmsQueue[_0xe88c('0xc')]['updateRealtime']=function(){this[_0xe88c('0x11')]=0x0;this['paused']=0x0;for(var _0xcabaa4=0x0;_0xcabaa4=0x0?this[_0xe88c('0x15')]:0x0;var _0x584a7c={'id':this['id'],'available':this[_0xe88c('0x15')],'loggedIn':this[_0xe88c('0x11')],'name':this[_0xe88c('0x6')],'paused':this[_0xe88c('0x16')],'waiting':this['waiting']};var _0x4eb51d=md5(JSON[_0xe88c('0x17')](_0x584a7c));if(this['md5']!==_0x4eb51d){this[_0xe88c('0x0')]=_0x4eb51d;io['to'](util[_0xe88c('0x18')](_0xe88c('0x19'),_0x584a7c[_0xe88c('0x6')]))['emit'](_0xe88c('0x1a'),_0x584a7c);}};module[_0xe88c('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8615097..70080f3 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 _0x9c35=['faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','bluebird','lodash','moment','../model/interval','../model/mailQueue','../model/faxQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9c35,0x13c));var _0x59c3=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x9c35[_0x2405bc];return _0x5272d4;};'use strict';var BPromise=require(_0x59c3('0x0'));var util=require('util');var _=require(_0x59c3('0x1'));var moment=require(_0x59c3('0x2'));var Agent=require('../model/agent');var Interval=require(_0x59c3('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x59c3('0x4'));var FaxQueue=require(_0x59c3('0x5'));var Realtime=function(){this[_0x59c3('0x6')]={};this[_0x59c3('0x7')]={};this[_0x59c3('0x8')]={};this[_0x59c3('0x9')]={};this['smsQueues']={};this[_0x59c3('0xa')]={};this[_0x59c3('0xb')]={};this['chatQueuesWaitingInteractions']={};this['mailQueuesWaitingInteractions']={};this[_0x59c3('0xc')]={};this[_0x59c3('0xd')]={};this[_0x59c3('0xe')]={};};function freeIsNotKey(_0x28c0e4,_0xfb60ee,_0x4e051a){var _0x1095a0=_[_0x59c3('0xf')](_0x28c0e4,function(_0x46653f,_0x75c52f){return _0x46653f[_0x4e051a];});for(var _0x181be4 in _0xfb60ee){if(_0xfb60ee[_0x59c3('0x10')](_0x181be4)){if(!_0x1095a0[_0x181be4]){delete _0xfb60ee[_0x181be4];}}}}Realtime['prototype'][_0x59c3('0x11')]=function(_0x38f46e,_0x1f9ab7){for(var _0x36a3ca in _0x1f9ab7){if(_0x38f46e[_0x59c3('0x10')](_0x36a3ca)){_0x38f46e[_0x36a3ca]=_0x1f9ab7[_0x36a3ca];}}};Realtime[_0x59c3('0x12')]['initAgents']=function(){var _0x5f44b0=this;return function(_0x4fa16b){if(_0x4fa16b){freeIsNotKey(_0x4fa16b,_0x5f44b0[_0x59c3('0x6')],'id');for(var _0x18ba42=0x0,_0xf3e1dd={},_0x514ef7={};_0x18ba42<_0x4fa16b[_0x59c3('0x13')];_0x18ba42+=0x1){_0xf3e1dd=_0x4fa16b[_0x18ba42];if(_[_0x59c3('0x14')](_0x5f44b0[_0x59c3('0x6')][_0xf3e1dd['id']])){_0x5f44b0[_0x59c3('0x6')][_0xf3e1dd['id']]=new Agent(_0xf3e1dd);}else{_0x5f44b0[_0x59c3('0x11')](_0x5f44b0[_0x59c3('0x6')][_0xf3e1dd['id']],_0xf3e1dd);}}}return _0x5f44b0[_0x59c3('0x6')];};};Realtime['prototype'][_0x59c3('0x15')]=function(){var _0x30f707=this;return function(_0x347a46){if(_0x347a46){freeIsNotKey(_0x347a46,_0x30f707[_0x59c3('0x7')],'id');for(var _0xde23cc=0x0,_0x1f256a={},_0x41f857={};_0xde23cc<_0x347a46[_0x59c3('0x13')];_0xde23cc+=0x1){_0x1f256a=_0x347a46[_0xde23cc];if(_[_0x59c3('0x14')](_0x30f707[_0x59c3('0x7')][_0x1f256a['id']])){_0x30f707[_0x59c3('0x7')][_0x1f256a['id']]=new Interval(_0x1f256a);}else{_0x30f707[_0x59c3('0x11')](_0x30f707[_0x59c3('0x7')][_0x1f256a['id']],_0x1f256a);}}}return _0x30f707[_0x59c3('0x7')];};};Realtime[_0x59c3('0x12')][_0x59c3('0x16')]=function(){var _0x239256=this;return function(_0xea40a1){if(_0xea40a1){freeIsNotKey(_0xea40a1,_0x239256[_0x59c3('0x8')],'id');for(var _0x213e3f=0x0,_0xf42047={},_0x50d80a={};_0x213e3f<_0xea40a1['length'];_0x213e3f+=0x1){_0xf42047=_0xea40a1[_0x213e3f];if(_['isUndefined'](_0x239256[_0x59c3('0x8')][_0xf42047['id']])){_0x239256[_0x59c3('0x8')][_0xf42047['id']]=new OpenchannelQueue(_0xf42047);}else{_0x239256[_0x59c3('0x11')](_0x239256[_0x59c3('0x8')][_0xf42047['id']],_0xf42047);}_0x239256[_0x59c3('0x8')][_0xf42047['id']][_0x59c3('0x17')]();_0x239256[_0x59c3('0x8')][_0xf42047['id']][_0x59c3('0x18')]();}}return _0x239256[_0x59c3('0x8')];};};Realtime[_0x59c3('0x12')][_0x59c3('0x19')]=function(){var _0x3d613b=this;return function(_0x5d769f){if(_0x5d769f){freeIsNotKey(_0x5d769f,_0x3d613b[_0x59c3('0x9')],'id');for(var _0xb302f3=0x0,_0x3a5adf={},_0x392190={};_0xb302f3<_0x5d769f[_0x59c3('0x13')];_0xb302f3+=0x1){_0x3a5adf=_0x5d769f[_0xb302f3];if(_[_0x59c3('0x14')](_0x3d613b[_0x59c3('0x9')][_0x3a5adf['id']])){_0x3d613b[_0x59c3('0x9')][_0x3a5adf['id']]=new ChatQueue(_0x3a5adf);}else{_0x3d613b[_0x59c3('0x11')](_0x3d613b['chatQueues'][_0x3a5adf['id']],_0x3a5adf);}_0x3d613b[_0x59c3('0x9')][_0x3a5adf['id']]['updateRouting']();_0x3d613b[_0x59c3('0x9')][_0x3a5adf['id']][_0x59c3('0x18')]();}}return _0x3d613b[_0x59c3('0x9')];};};Realtime[_0x59c3('0x12')][_0x59c3('0x1a')]=function(){var _0x22821d=this;return function(_0x27a13d){if(_0x27a13d){freeIsNotKey(_0x27a13d,_0x22821d[_0x59c3('0x1b')],'id');for(var _0x16716a=0x0,_0x575c4a={},_0x347c91={};_0x16716a<_0x27a13d[_0x59c3('0x13')];_0x16716a+=0x1){_0x575c4a=_0x27a13d[_0x16716a];if(_['isUndefined'](_0x22821d['smsQueues'][_0x575c4a['id']])){_0x22821d[_0x59c3('0x1b')][_0x575c4a['id']]=new SmsQueue(_0x575c4a);}else{_0x22821d[_0x59c3('0x11')](_0x22821d[_0x59c3('0x1b')][_0x575c4a['id']],_0x575c4a);}_0x22821d['smsQueues'][_0x575c4a['id']][_0x59c3('0x17')]();_0x22821d[_0x59c3('0x1b')][_0x575c4a['id']][_0x59c3('0x18')]();}}return _0x22821d[_0x59c3('0x1b')];};};Realtime[_0x59c3('0x12')][_0x59c3('0x1c')]=function(){var _0x335678=this;return function(_0x1e5eb0){if(_0x1e5eb0){freeIsNotKey(_0x1e5eb0,_0x335678[_0x59c3('0xa')],'id');for(var _0x57cf13=0x0,_0xb47ce3={},_0x3ef5e5={};_0x57cf13<_0x1e5eb0[_0x59c3('0x13')];_0x57cf13+=0x1){_0xb47ce3=_0x1e5eb0[_0x57cf13];if(_['isUndefined'](_0x335678[_0x59c3('0xa')][_0xb47ce3['id']])){_0x335678[_0x59c3('0xa')][_0xb47ce3['id']]=new MailQueue(_0xb47ce3);}else{_0x335678[_0x59c3('0x11')](_0x335678[_0x59c3('0xa')][_0xb47ce3['id']],_0xb47ce3);}_0x335678[_0x59c3('0xa')][_0xb47ce3['id']][_0x59c3('0x17')]();_0x335678[_0x59c3('0xa')][_0xb47ce3['id']][_0x59c3('0x18')]();}}return _0x335678[_0x59c3('0xa')];};};Realtime[_0x59c3('0x12')][_0x59c3('0x1d')]=function(){var _0xd1a966=this;return function(_0x5d5e45){if(_0x5d5e45){freeIsNotKey(_0x5d5e45,_0xd1a966[_0x59c3('0xb')],'id');for(var _0x339c82=0x0,_0x441c3a={},_0x44dec0={};_0x339c82<_0x5d5e45['length'];_0x339c82+=0x1){_0x441c3a=_0x5d5e45[_0x339c82];if(_[_0x59c3('0x14')](_0xd1a966[_0x59c3('0xb')][_0x441c3a['id']])){_0xd1a966['faxQueues'][_0x441c3a['id']]=new FaxQueue(_0x441c3a);}else{_0xd1a966[_0x59c3('0x11')](_0xd1a966[_0x59c3('0xb')][_0x441c3a['id']],_0x441c3a);}_0xd1a966[_0x59c3('0xb')][_0x441c3a['id']]['updateRouting']();_0xd1a966[_0x59c3('0xb')][_0x441c3a['id']][_0x59c3('0x18')]();}}return _0xd1a966['faxQueues'];};};module['exports']=Realtime; \ No newline at end of file +var _0xd380=['intervals','isUndefined','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','initSmsQueues','initMailQueues','faxQueues','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/mailQueue','../model/faxQueue','agents','openchannelQueues','smsQueues','mailQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initAgents','length','initIntervals'];(function(_0xd4527a,_0x141ed6){var _0x58d97c=function(_0x4c8da4){while(--_0x4c8da4){_0xd4527a['push'](_0xd4527a['shift']());}};_0x58d97c(++_0x141ed6);}(_0xd380,0x196));var _0x0d38=function(_0x116d8e,_0x3c3f40){_0x116d8e=_0x116d8e-0x0;var _0x53390c=_0xd380[_0x116d8e];return _0x53390c;};'use strict';var BPromise=require(_0x0d38('0x0'));var util=require(_0x0d38('0x1'));var _=require(_0x0d38('0x2'));var moment=require(_0x0d38('0x3'));var Agent=require('../model/agent');var Interval=require(_0x0d38('0x4'));var OpenchannelQueue=require(_0x0d38('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x0d38('0x6'));var FaxQueue=require(_0x0d38('0x7'));var Realtime=function(){this[_0x0d38('0x8')]={};this['intervals']={};this[_0x0d38('0x9')]={};this['chatQueues']={};this[_0x0d38('0xa')]={};this[_0x0d38('0xb')]={};this['faxQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0d38('0xc')]={};this[_0x0d38('0xd')]={};this[_0x0d38('0xe')]={};this[_0x0d38('0xf')]={};};function freeIsNotKey(_0x5c0c61,_0x144f6c,_0x998d1c){var _0x5f1155=_[_0x0d38('0x10')](_0x5c0c61,function(_0x2189be,_0x18dfd0){return _0x2189be[_0x998d1c];});for(var _0x3e9695 in _0x144f6c){if(_0x144f6c[_0x0d38('0x11')](_0x3e9695)){if(!_0x5f1155[_0x3e9695]){delete _0x144f6c[_0x3e9695];}}}}Realtime['prototype'][_0x0d38('0x12')]=function(_0x892cb4,_0x4faf80){for(var _0x2f6ab6 in _0x4faf80){if(_0x892cb4[_0x0d38('0x11')](_0x2f6ab6)){_0x892cb4[_0x2f6ab6]=_0x4faf80[_0x2f6ab6];}}};Realtime[_0x0d38('0x13')][_0x0d38('0x14')]=function(){var _0x5f4350=this;return function(_0x5c6856){if(_0x5c6856){freeIsNotKey(_0x5c6856,_0x5f4350[_0x0d38('0x8')],'id');for(var _0x4ee879=0x0,_0x59f11a={},_0x5bad76={};_0x4ee879<_0x5c6856[_0x0d38('0x15')];_0x4ee879+=0x1){_0x59f11a=_0x5c6856[_0x4ee879];if(_['isUndefined'](_0x5f4350['agents'][_0x59f11a['id']])){_0x5f4350[_0x0d38('0x8')][_0x59f11a['id']]=new Agent(_0x59f11a);}else{_0x5f4350[_0x0d38('0x12')](_0x5f4350[_0x0d38('0x8')][_0x59f11a['id']],_0x59f11a);}}}return _0x5f4350[_0x0d38('0x8')];};};Realtime[_0x0d38('0x13')][_0x0d38('0x16')]=function(){var _0x2317ed=this;return function(_0x53e6a2){if(_0x53e6a2){freeIsNotKey(_0x53e6a2,_0x2317ed[_0x0d38('0x17')],'id');for(var _0x5bfd31=0x0,_0x1f0785={},_0x3cb1ca={};_0x5bfd31<_0x53e6a2[_0x0d38('0x15')];_0x5bfd31+=0x1){_0x1f0785=_0x53e6a2[_0x5bfd31];if(_[_0x0d38('0x18')](_0x2317ed[_0x0d38('0x17')][_0x1f0785['id']])){_0x2317ed['intervals'][_0x1f0785['id']]=new Interval(_0x1f0785);}else{_0x2317ed[_0x0d38('0x12')](_0x2317ed[_0x0d38('0x17')][_0x1f0785['id']],_0x1f0785);}}}return _0x2317ed[_0x0d38('0x17')];};};Realtime['prototype'][_0x0d38('0x19')]=function(){var _0x42c7d8=this;return function(_0x3eb0ba){if(_0x3eb0ba){freeIsNotKey(_0x3eb0ba,_0x42c7d8['openchannelQueues'],'id');for(var _0x5779fb=0x0,_0x2b12a1={},_0x41b276={};_0x5779fb<_0x3eb0ba['length'];_0x5779fb+=0x1){_0x2b12a1=_0x3eb0ba[_0x5779fb];if(_[_0x0d38('0x18')](_0x42c7d8[_0x0d38('0x9')][_0x2b12a1['id']])){_0x42c7d8[_0x0d38('0x9')][_0x2b12a1['id']]=new OpenchannelQueue(_0x2b12a1);}else{_0x42c7d8['mergeFromDatabase'](_0x42c7d8[_0x0d38('0x9')][_0x2b12a1['id']],_0x2b12a1);}_0x42c7d8[_0x0d38('0x9')][_0x2b12a1['id']][_0x0d38('0x1a')]();_0x42c7d8[_0x0d38('0x9')][_0x2b12a1['id']][_0x0d38('0x1b')]();}}return _0x42c7d8['openchannelQueues'];};};Realtime[_0x0d38('0x13')][_0x0d38('0x1c')]=function(){var _0x2ee7b1=this;return function(_0x4ad787){if(_0x4ad787){freeIsNotKey(_0x4ad787,_0x2ee7b1[_0x0d38('0x1d')],'id');for(var _0x5f34d4=0x0,_0xc55e18={},_0x29b8c6={};_0x5f34d4<_0x4ad787[_0x0d38('0x15')];_0x5f34d4+=0x1){_0xc55e18=_0x4ad787[_0x5f34d4];if(_[_0x0d38('0x18')](_0x2ee7b1[_0x0d38('0x1d')][_0xc55e18['id']])){_0x2ee7b1[_0x0d38('0x1d')][_0xc55e18['id']]=new ChatQueue(_0xc55e18);}else{_0x2ee7b1[_0x0d38('0x12')](_0x2ee7b1[_0x0d38('0x1d')][_0xc55e18['id']],_0xc55e18);}_0x2ee7b1[_0x0d38('0x1d')][_0xc55e18['id']][_0x0d38('0x1a')]();_0x2ee7b1[_0x0d38('0x1d')][_0xc55e18['id']][_0x0d38('0x1b')]();}}return _0x2ee7b1[_0x0d38('0x1d')];};};Realtime['prototype'][_0x0d38('0x1e')]=function(){var _0x52be6c=this;return function(_0x6f6aeb){if(_0x6f6aeb){freeIsNotKey(_0x6f6aeb,_0x52be6c[_0x0d38('0xa')],'id');for(var _0x5abfbf=0x0,_0x7d450b={},_0x2f44b7={};_0x5abfbf<_0x6f6aeb['length'];_0x5abfbf+=0x1){_0x7d450b=_0x6f6aeb[_0x5abfbf];if(_[_0x0d38('0x18')](_0x52be6c[_0x0d38('0xa')][_0x7d450b['id']])){_0x52be6c['smsQueues'][_0x7d450b['id']]=new SmsQueue(_0x7d450b);}else{_0x52be6c['mergeFromDatabase'](_0x52be6c[_0x0d38('0xa')][_0x7d450b['id']],_0x7d450b);}_0x52be6c['smsQueues'][_0x7d450b['id']][_0x0d38('0x1a')]();_0x52be6c[_0x0d38('0xa')][_0x7d450b['id']][_0x0d38('0x1b')]();}}return _0x52be6c[_0x0d38('0xa')];};};Realtime['prototype'][_0x0d38('0x1f')]=function(){var _0x5642e9=this;return function(_0x3486a8){if(_0x3486a8){freeIsNotKey(_0x3486a8,_0x5642e9[_0x0d38('0xb')],'id');for(var _0x1d35c0=0x0,_0x42c2da={},_0x5c6677={};_0x1d35c0<_0x3486a8[_0x0d38('0x15')];_0x1d35c0+=0x1){_0x42c2da=_0x3486a8[_0x1d35c0];if(_['isUndefined'](_0x5642e9[_0x0d38('0xb')][_0x42c2da['id']])){_0x5642e9['mailQueues'][_0x42c2da['id']]=new MailQueue(_0x42c2da);}else{_0x5642e9['mergeFromDatabase'](_0x5642e9[_0x0d38('0xb')][_0x42c2da['id']],_0x42c2da);}_0x5642e9[_0x0d38('0xb')][_0x42c2da['id']][_0x0d38('0x1a')]();_0x5642e9[_0x0d38('0xb')][_0x42c2da['id']][_0x0d38('0x1b')]();}}return _0x5642e9['mailQueues'];};};Realtime[_0x0d38('0x13')]['initFaxQueues']=function(){var _0x3727d0=this;return function(_0x12ee2b){if(_0x12ee2b){freeIsNotKey(_0x12ee2b,_0x3727d0[_0x0d38('0x20')],'id');for(var _0x1be66c=0x0,_0x49846e={},_0x4590d9={};_0x1be66c<_0x12ee2b[_0x0d38('0x15')];_0x1be66c+=0x1){_0x49846e=_0x12ee2b[_0x1be66c];if(_['isUndefined'](_0x3727d0[_0x0d38('0x20')][_0x49846e['id']])){_0x3727d0[_0x0d38('0x20')][_0x49846e['id']]=new FaxQueue(_0x49846e);}else{_0x3727d0[_0x0d38('0x12')](_0x3727d0[_0x0d38('0x20')][_0x49846e['id']],_0x49846e);}_0x3727d0[_0x0d38('0x20')][_0x49846e['id']][_0x0d38('0x1a')]();_0x3727d0[_0x0d38('0x20')][_0x49846e['id']][_0x0d38('0x1b')]();}}return _0x3727d0[_0x0d38('0x20')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 8567b33..4430df5 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 _0x4d27=['Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','update'];(function(_0x47d56f,_0x4115dc){var _0x4c66a1=function(_0x318260){while(--_0x318260){_0x47d56f['push'](_0x47d56f['shift']());}};_0x4c66a1(++_0x4115dc);}(_0x4d27,0x95));var _0x74d2=function(_0x1e2cae,_0x4ad9b2){_0x1e2cae=_0x1e2cae-0x0;var _0x44630b=_0x4d27[_0x1e2cae];return _0x44630b;};'use strict';var client=require('../client');exports[_0x74d2('0x0')]=function(_0x55e6f5,_0x374afa){return client[_0x74d2('0x1')](_0x74d2('0x2'),{'body':_0x374afa,'options':{'where':{'id':_0x55e6f5}},'log':'updateChatInteraction'});};exports[_0x74d2('0x3')]=function(_0x139c35,_0x5cea39){return client[_0x74d2('0x1')]('AddTagsToChatInteraction',{'body':_0x5cea39,'options':{'where':{'id':_0x139c35}},'log':_0x74d2('0x4')});}; \ No newline at end of file +var _0xab5e=['updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction'];(function(_0x156b34,_0x1bf0ef){var _0x31a5cc=function(_0xb4b4ba){while(--_0xb4b4ba){_0x156b34['push'](_0x156b34['shift']());}};_0x31a5cc(++_0x1bf0ef);}(_0xab5e,0x1c5));var _0xeab5=function(_0x359262,_0xee224){_0x359262=_0x359262-0x0;var _0x3630d6=_0xab5e[_0x359262];return _0x3630d6;};'use strict';var client=require('../client');exports[_0xeab5('0x0')]=function(_0x545f26,_0x130f1c){return client[_0xeab5('0x1')](_0xeab5('0x2'),{'body':_0x130f1c,'options':{'where':{'id':_0x545f26}},'log':_0xeab5('0x3')});};exports['addTags']=function(_0x3dde1f,_0x328739){return client[_0xeab5('0x1')](_0xeab5('0x4'),{'body':_0x328739,'options':{'where':{'id':_0x3dde1f}},'log':_0xeab5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 55171da..cd25df4 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 _0x0bc0=['create','Request','createChatMessage','../client'];(function(_0x37c8ca,_0x104b95){var _0x33fd32=function(_0x2124f9){while(--_0x2124f9){_0x37c8ca['push'](_0x37c8ca['shift']());}};_0x33fd32(++_0x104b95);}(_0x0bc0,0xd7));var _0x00bc=function(_0x3e1353,_0x138834){_0x3e1353=_0x3e1353-0x0;var _0x2e6cae=_0x0bc0[_0x3e1353];return _0x2e6cae;};'use strict';var client=require(_0x00bc('0x0'));exports[_0x00bc('0x1')]=function(_0x2093ae){return client[_0x00bc('0x2')]('CreateChatMessage',{'body':_0x2093ae,'log':_0x00bc('0x3')});}; \ No newline at end of file +var _0xf957=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0xf957,0x9d));var _0x7f95=function(_0x5bb0ca,_0x25a426){_0x5bb0ca=_0x5bb0ca-0x0;var _0x41e691=_0xf957[_0x5bb0ca];return _0x41e691;};'use strict';var client=require(_0x7f95('0x0'));exports[_0x7f95('0x1')]=function(_0x353f43){return client[_0x7f95('0x2')](_0x7f95('0x3'),{'body':_0x353f43,'log':_0x7f95('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 84f0c5a..dcd8827 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 _0x6b5b=['name','timeout','User','Agents','online','chatPause','../client','getChatQueues','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b5b,0xba));var _0xb6b5=function(_0x1a621a,_0x269b5b){_0x1a621a=_0x1a621a-0x0;var _0x4ea4eb=_0x6b5b[_0x1a621a];return _0x4ea4eb;};'use strict';var client=require(_0xb6b5('0x0'));exports[_0xb6b5('0x1')]=function(){return function(){return client[_0xb6b5('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xb6b5('0x3'),_0xb6b5('0x4'),'strategy'],'include':[{'model':_0xb6b5('0x5'),'as':_0xb6b5('0x6'),'attributes':['id',_0xb6b5('0x3'),_0xb6b5('0x7'),_0xb6b5('0x8')]}]},'log':_0xb6b5('0x1')});};}; \ No newline at end of file +var _0xe7b5=['getChatQueues','GetChatQueue','name','timeout','strategy','User','chatPause'];(function(_0x5eb9a1,_0x59fadf){var _0x1c9912=function(_0x5ac798){while(--_0x5ac798){_0x5eb9a1['push'](_0x5eb9a1['shift']());}};_0x1c9912(++_0x59fadf);}(_0xe7b5,0x165));var _0x5e7b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe7b5[_0x19950b];return _0x3c6b41;};'use strict';var client=require('../client');exports[_0x5e7b('0x0')]=function(){return function(){return client['Request'](_0x5e7b('0x1'),{'options':{'raw':![],'attributes':['id',_0x5e7b('0x2'),_0x5e7b('0x3'),_0x5e7b('0x4')],'include':[{'model':_0x5e7b('0x5'),'as':'Agents','attributes':['id',_0x5e7b('0x2'),'online',_0x5e7b('0x6')]}]},'log':_0x5e7b('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 13066ac..0bb4f8b 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 _0xe630=['create','Request','CreateChatQueueReport','DESC','UpdateChatQueueReport','../client'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xe630,0x149));var _0x0e63=function(_0x3d3a19,_0x595596){_0x3d3a19=_0x3d3a19-0x0;var _0x4e5e65=_0xe630[_0x3d3a19];return _0x4e5e65;};'use strict';var client=require(_0x0e63('0x0'));exports[_0x0e63('0x1')]=function(_0x54847d){return client[_0x0e63('0x2')](_0x0e63('0x3'),{'body':_0x54847d,'log':_0x0e63('0x3')});};exports['update']=function(_0x103691,_0x219cbe){return client[_0x0e63('0x2')]('UpdateChatQueueReport',{'body':_0x219cbe,'options':{'where':{'uniqueid':_0x103691},'order':[['id',_0x0e63('0x4')]],'limit':0x1},'log':_0x0e63('0x5')});}; \ No newline at end of file +var _0xd66c=['UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport'];(function(_0x49011c,_0xf2352f){var _0x374f01=function(_0x82776){while(--_0x82776){_0x49011c['push'](_0x49011c['shift']());}};_0x374f01(++_0xf2352f);}(_0xd66c,0x106));var _0xcd66=function(_0x1c2bde,_0x38f219){_0x1c2bde=_0x1c2bde-0x0;var _0xfdda33=_0xd66c[_0x1c2bde];return _0xfdda33;};'use strict';var client=require(_0xcd66('0x0'));exports['create']=function(_0x35f78b){return client[_0xcd66('0x1')](_0xcd66('0x2'),{'body':_0x35f78b,'log':_0xcd66('0x2')});};exports['update']=function(_0xeccb2d,_0x13a713){return client[_0xcd66('0x1')](_0xcd66('0x3'),{'body':_0x13a713,'options':{'where':{'uniqueid':_0xeccb2d},'order':[['id',_0xcd66('0x4')]],'limit':0x1},'log':_0xcd66('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 0e42f7b..58e6f66 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 _0xac4e=['update','UpdateFaxInteraction','addTags','addTagsToFaxInteraction'];(function(_0x3b49a7,_0x311fc0){var _0x3dffc1=function(_0x14a0ea){while(--_0x14a0ea){_0x3b49a7['push'](_0x3b49a7['shift']());}};_0x3dffc1(++_0x311fc0);}(_0xac4e,0x64));var _0xeac4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xac4e[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0xeac4('0x0')]=function(_0x2e9204,_0x78db93){return client['Request'](_0xeac4('0x1'),{'body':_0x78db93,'options':{'where':{'id':_0x2e9204}},'log':'updateFaxInteraction'});};exports[_0xeac4('0x2')]=function(_0x53465c,_0x5dee5a){return client['Request']('AddTagsToFaxInteraction',{'body':_0x5dee5a,'options':{'where':{'id':_0x53465c}},'log':_0xeac4('0x3')});}; \ No newline at end of file +var _0x296e=['AddTagsToFaxInteraction','update','Request','updateFaxInteraction','addTags'];(function(_0x2b0960,_0x525d1c){var _0x140c06=function(_0x491281){while(--_0x491281){_0x2b0960['push'](_0x2b0960['shift']());}};_0x140c06(++_0x525d1c);}(_0x296e,0x14b));var _0xe296=function(_0x3a792c,_0x1369e9){_0x3a792c=_0x3a792c-0x0;var _0x478647=_0x296e[_0x3a792c];return _0x478647;};'use strict';var client=require('../client');exports[_0xe296('0x0')]=function(_0x4b3459,_0x45ce17){return client[_0xe296('0x1')]('UpdateFaxInteraction',{'body':_0x45ce17,'options':{'where':{'id':_0x4b3459}},'log':_0xe296('0x2')});};exports[_0xe296('0x3')]=function(_0x299563,_0x553656){return client[_0xe296('0x1')](_0xe296('0x4'),{'body':_0x553656,'options':{'where':{'id':_0x299563}},'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 4c964b5..bcb1ec0 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 _0xa220=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0xc8e463,_0x2906de){var _0x264f41=function(_0x29d9df){while(--_0x29d9df){_0xc8e463['push'](_0xc8e463['shift']());}};_0x264f41(++_0x2906de);}(_0xa220,0x119));var _0x0a22=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa220[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0x0a22('0x0'));exports[_0x0a22('0x1')]=function(_0x32d1ac){return client[_0x0a22('0x2')](_0x0a22('0x3'),{'body':_0x32d1ac,'log':_0x0a22('0x4')});}; \ No newline at end of file +var _0xb1bb=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x1d7466,_0x161771){var _0x3ebbb6=function(_0x2044f6){while(--_0x2044f6){_0x1d7466['push'](_0x1d7466['shift']());}};_0x3ebbb6(++_0x161771);}(_0xb1bb,0x8a));var _0xbb1b=function(_0x1e229f,_0x4aaa56){_0x1e229f=_0x1e229f-0x0;var _0x3f7e23=_0xb1bb[_0x1e229f];return _0x3f7e23;};'use strict';var client=require(_0xbb1b('0x0'));exports[_0xbb1b('0x1')]=function(_0x3e4048){return client[_0xbb1b('0x2')](_0xbb1b('0x3'),{'body':_0x3e4048,'log':_0xbb1b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d8ceda8..dcfe326 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 _0xb065=['User','Agents','name','online','faxPause','getFaxQueues','GetFaxQueue','strategy'];(function(_0x211cc8,_0x3d2722){var _0x2e2398=function(_0x49379f){while(--_0x49379f){_0x211cc8['push'](_0x211cc8['shift']());}};_0x2e2398(++_0x3d2722);}(_0xb065,0xa5));var _0x5b06=function(_0x22a80c,_0x4b5e06){_0x22a80c=_0x22a80c-0x0;var _0x1c8501=_0xb065[_0x22a80c];return _0x1c8501;};'use strict';var client=require('../client');exports[_0x5b06('0x0')]=function(){return function(){return client['Request'](_0x5b06('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x5b06('0x2')],'include':[{'model':_0x5b06('0x3'),'as':_0x5b06('0x4'),'attributes':['id',_0x5b06('0x5'),_0x5b06('0x6'),_0x5b06('0x7')]}]},'log':_0x5b06('0x0')});};}; \ No newline at end of file +var _0xb026=['strategy','Agents','faxPause','getFaxQueues','../client','Request','name'];(function(_0x5cb500,_0x5dcf93){var _0x51d582=function(_0x75f3d9){while(--_0x75f3d9){_0x5cb500['push'](_0x5cb500['shift']());}};_0x51d582(++_0x5dcf93);}(_0xb026,0x19a));var _0x6b02=function(_0x37f40e,_0x5c5a1d){_0x37f40e=_0x37f40e-0x0;var _0x1bab3f=_0xb026[_0x37f40e];return _0x1bab3f;};'use strict';var client=require(_0x6b02('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x6b02('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x6b02('0x2'),'timeout',_0x6b02('0x3')],'include':[{'model':'User','as':_0x6b02('0x4'),'attributes':['id',_0x6b02('0x2'),'online',_0x6b02('0x5')]}]},'log':_0x6b02('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 78d6e53..9cd4629 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 _0x302c=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','../client','create'];(function(_0x45fff6,_0x46946e){var _0xd526bb=function(_0x28a7a3){while(--_0x28a7a3){_0x45fff6['push'](_0x45fff6['shift']());}};_0xd526bb(++_0x46946e);}(_0x302c,0x15c));var _0xc302=function(_0x130d49,_0x48636f){_0x130d49=_0x130d49-0x0;var _0xd18fa0=_0x302c[_0x130d49];return _0xd18fa0;};'use strict';var client=require(_0xc302('0x0'));exports[_0xc302('0x1')]=function(_0x345daa){return client[_0xc302('0x2')](_0xc302('0x3'),{'body':_0x345daa,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x256168,_0xdc61f1){return client[_0xc302('0x2')]('UpdateFaxQueueReport',{'body':_0xdc61f1,'options':{'where':{'uniqueid':_0x256168},'order':[['id','DESC']],'limit':0x1},'log':_0xc302('0x4')});}; \ No newline at end of file +var _0xcdd0=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x53538f,_0x3b129d){var _0x4a5ffc=function(_0x331303){while(--_0x331303){_0x53538f['push'](_0x53538f['shift']());}};_0x4a5ffc(++_0x3b129d);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xcdd0[_0x54d4fe];return _0x1ab5bb;};'use strict';var client=require(_0x0cdd('0x0'));exports[_0x0cdd('0x1')]=function(_0x31f015){return client[_0x0cdd('0x2')]('CreateFaxQueueReport',{'body':_0x31f015,'log':_0x0cdd('0x3')});};exports['update']=function(_0x47eb4d,_0x2ff2d3){return client['Request'](_0x0cdd('0x4'),{'body':_0x2ff2d3,'options':{'where':{'uniqueid':_0x47eb4d},'order':[['id',_0x0cdd('0x5')]],'limit':0x1},'log':_0x0cdd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 75d43e2..722ae91 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 _0x9d9b=['interval','getIntervals','Request','name','Intervals'];(function(_0x5442c6,_0x6a7ac9){var _0x539526=function(_0x32f13c){while(--_0x32f13c){_0x5442c6['push'](_0x5442c6['shift']());}};_0x539526(++_0x6a7ac9);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x5c1b35,_0x2fd2d5){_0x5c1b35=_0x5c1b35-0x0;var _0x20cb2e=_0x9d9b[_0x5c1b35];return _0x20cb2e;};'use strict';var client=require('../client');exports[_0xb9d9('0x0')]=function(){return function(){return client[_0xb9d9('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb9d9('0x2')],'include':[{'model':'Interval','as':_0xb9d9('0x3'),'attributes':['id',_0xb9d9('0x2'),_0xb9d9('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xd139=['name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x33b295,_0x32fa89){var _0x225279=function(_0x41609c){while(--_0x41609c){_0x33b295['push'](_0x33b295['shift']());}};_0x225279(++_0x32fa89);}(_0xd139,0x14e));var _0x9d13=function(_0x59560a,_0x275999){_0x59560a=_0x59560a-0x0;var _0x3bcc81=_0xd139[_0x59560a];return _0x3bcc81;};'use strict';var client=require(_0x9d13('0x0'));exports[_0x9d13('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9d13('0x2')],'include':[{'model':_0x9d13('0x3'),'as':_0x9d13('0x4'),'attributes':['id',_0x9d13('0x2'),_0x9d13('0x5')]}]},'log':_0x9d13('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 56e5354..5377f1c 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 _0xf873=['AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x1205cd,_0x5d88a8){var _0x100399=function(_0x11abf5){while(--_0x11abf5){_0x1205cd['push'](_0x1205cd['shift']());}};_0x100399(++_0x5d88a8);}(_0xf873,0x6b));var _0x3f87=function(_0x10448b,_0x4a0889){_0x10448b=_0x10448b-0x0;var _0x5be6b6=_0xf873[_0x10448b];return _0x5be6b6;};'use strict';var client=require('../client');exports[_0x3f87('0x0')]=function(_0x380206,_0x224dd3){return client[_0x3f87('0x1')](_0x3f87('0x2'),{'body':_0x224dd3,'options':{'where':{'id':_0x380206}},'log':_0x3f87('0x3')});};exports[_0x3f87('0x4')]=function(_0x4747f5,_0x3caee4){return client[_0x3f87('0x1')](_0x3f87('0x5'),{'body':_0x3caee4,'options':{'where':{'id':_0x4747f5}},'log':_0x3f87('0x6')});}; \ No newline at end of file +var _0x9acb=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction'];(function(_0xf57e93,_0x459863){var _0x15228b=function(_0x3fcce8){while(--_0x3fcce8){_0xf57e93['push'](_0xf57e93['shift']());}};_0x15228b(++_0x459863);}(_0x9acb,0x169));var _0xb9ac=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x9acb[_0x2bf141];return _0x48277b;};'use strict';var client=require('../client');exports[_0xb9ac('0x0')]=function(_0x1184c1,_0x795fbe){return client[_0xb9ac('0x1')](_0xb9ac('0x2'),{'body':_0x795fbe,'options':{'where':{'id':_0x1184c1}},'log':_0xb9ac('0x3')});};exports[_0xb9ac('0x4')]=function(_0x196c8b,_0x168531){return client[_0xb9ac('0x1')](_0xb9ac('0x5'),{'body':_0x168531,'options':{'where':{'id':_0x196c8b}},'log':_0xb9ac('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 0253511..984c11c 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 _0x9fd8=['create','Request','createMailMessage','../client'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9fd8,0x18f));var _0x89fd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9fd8[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x89fd('0x0'));exports[_0x89fd('0x1')]=function(_0x5f0179){return client[_0x89fd('0x2')]('CreateMailMessage',{'body':_0x5f0179,'log':_0x89fd('0x3')});}; \ No newline at end of file +var _0xd669=['CreateMailMessage','../client','Request'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd669,0xd6));var _0x9d66=function(_0x10cfc2,_0x1cffff){_0x10cfc2=_0x10cfc2-0x0;var _0x19f55e=_0xd669[_0x10cfc2];return _0x19f55e;};'use strict';var client=require(_0x9d66('0x0'));exports['create']=function(_0x540fe1){return client[_0x9d66('0x1')](_0x9d66('0x2'),{'body':_0x540fe1,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 199287e..e657efd 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 _0x4178=['User','name','online','mailPause','getMailQueues','Request','GetMailQueue','strategy'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4178,0x145));var _0x8417=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4178[_0x42cae2];return _0x5f256f;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x8417('0x0')](_0x8417('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x8417('0x2')],'include':[{'model':_0x8417('0x3'),'as':'Agents','attributes':['id',_0x8417('0x4'),_0x8417('0x5'),_0x8417('0x6')]}]},'log':_0x8417('0x7')});};}; \ No newline at end of file +var _0x48b3=['name','strategy','online','mailPause','getMailQueues','Request','GetMailQueue'];(function(_0x5745d2,_0x536b58){var _0xd6df54=function(_0xfc4bad){while(--_0xfc4bad){_0x5745d2['push'](_0x5745d2['shift']());}};_0xd6df54(++_0x536b58);}(_0x48b3,0xa6));var _0x348b=function(_0x2257aa,_0x2ff5d5){_0x2257aa=_0x2257aa-0x0;var _0x3d7082=_0x48b3[_0x2257aa];return _0x3d7082;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x348b('0x0')](_0x348b('0x1'),{'options':{'raw':![],'attributes':['id',_0x348b('0x2'),'timeout',_0x348b('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x348b('0x2'),_0x348b('0x4'),_0x348b('0x5')]}]},'log':_0x348b('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a74cb81..74487eb 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 _0x3333=['UpdateMailQueueReport','../client','Request','CreateMailQueueReport','DESC'];(function(_0x3504a0,_0x3f770f){var _0x3dfca3=function(_0x5adf34){while(--_0x5adf34){_0x3504a0['push'](_0x3504a0['shift']());}};_0x3dfca3(++_0x3f770f);}(_0x3333,0xbf));var _0x3333=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x3333[_0x1e4150];return _0x1ce3ee;};'use strict';var client=require(_0x3333('0x0'));exports['create']=function(_0x411b67){return client[_0x3333('0x1')](_0x3333('0x2'),{'body':_0x411b67,'log':_0x3333('0x2')});};exports['update']=function(_0x51f4dd,_0x587fbc){return client[_0x3333('0x1')]('UpdateMailQueueReport',{'body':_0x587fbc,'options':{'where':{'uniqueid':_0x51f4dd},'order':[['id',_0x3333('0x3')]],'limit':0x1},'log':_0x3333('0x4')});}; \ No newline at end of file +var _0xe1d7=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1d7,0x120));var _0x7e1d=function(_0x40cb69,_0x37f2ba){_0x40cb69=_0x40cb69-0x0;var _0x55e036=_0xe1d7[_0x40cb69];return _0x55e036;};'use strict';var client=require(_0x7e1d('0x0'));exports[_0x7e1d('0x1')]=function(_0x3932d0){return client[_0x7e1d('0x2')](_0x7e1d('0x3'),{'body':_0x3932d0,'log':_0x7e1d('0x3')});};exports[_0x7e1d('0x4')]=function(_0x37bfcf,_0x1b2607){return client['Request']('UpdateMailQueueReport',{'body':_0x1b2607,'options':{'where':{'uniqueid':_0x37bfcf},'order':[['id','DESC']],'limit':0x1},'log':_0x7e1d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 0c94874..fd17559 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 _0x827d=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x827d,0xdf));var _0xd827=function(_0x726f5c,_0xf7a97){_0x726f5c=_0x726f5c-0x0;var _0x410dd7=_0x827d[_0x726f5c];return _0x410dd7;};'use strict';var client=require(_0xd827('0x0'));exports[_0xd827('0x1')]=function(_0x585ceb,_0x5aa3d2){return client['Request'](_0xd827('0x2'),{'body':_0x5aa3d2,'options':{'where':{'id':_0x585ceb}},'log':_0xd827('0x3')});};exports[_0xd827('0x4')]=function(_0x5b637d,_0x408451){return client['Request'](_0xd827('0x5'),{'body':_0x408451,'options':{'where':{'id':_0x5b637d}},'log':_0xd827('0x6')});}; \ No newline at end of file +var _0x1cfc=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request'];(function(_0xf9b8f5,_0x3f6c27){var _0x4e4067=function(_0x2977e8){while(--_0x2977e8){_0xf9b8f5['push'](_0xf9b8f5['shift']());}};_0x4e4067(++_0x3f6c27);}(_0x1cfc,0x64));var _0xc1cf=function(_0x523913,_0x356a5d){_0x523913=_0x523913-0x0;var _0x139d5f=_0x1cfc[_0x523913];return _0x139d5f;};'use strict';var client=require(_0xc1cf('0x0'));exports['update']=function(_0x40b0f3,_0x1280c4){return client[_0xc1cf('0x1')](_0xc1cf('0x2'),{'body':_0x1280c4,'options':{'where':{'id':_0x40b0f3}},'log':_0xc1cf('0x3')});};exports['addTags']=function(_0xbfcd73,_0x398dd4){return client[_0xc1cf('0x1')](_0xc1cf('0x4'),{'body':_0x398dd4,'options':{'where':{'id':_0xbfcd73}},'log':_0xc1cf('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index a6a5eec..12c4b9f 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 _0x750a=['CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x124c75,_0x1b3a4){var _0x474b15=function(_0x418347){while(--_0x418347){_0x124c75['push'](_0x124c75['shift']());}};_0x474b15(++_0x1b3a4);}(_0x750a,0x140));var _0xa750=function(_0x58fcb9,_0x4d381d){_0x58fcb9=_0x58fcb9-0x0;var _0x1c5d0a=_0x750a[_0x58fcb9];return _0x1c5d0a;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(_0x5368b2){return client['Request'](_0xa750('0x1'),{'body':_0x5368b2,'log':_0xa750('0x2')});}; \ No newline at end of file +var _0x34e8=['../client','create','Request','createOpenchannelMessage'];(function(_0x1840b3,_0x4918a3){var _0x507ac7=function(_0x172cf1){while(--_0x172cf1){_0x1840b3['push'](_0x1840b3['shift']());}};_0x507ac7(++_0x4918a3);}(_0x34e8,0x12c));var _0x834e=function(_0x1bebc5,_0x20976f){_0x1bebc5=_0x1bebc5-0x0;var _0x2c13f6=_0x34e8[_0x1bebc5];return _0x2c13f6;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateOpenchannelMessage',{'body':_0x8b339,'log':_0x834e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 809cdc5..9240802 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 _0x1665=['openchannelPause','getOpenchannelQueues','Request','name','strategy','User','online'];(function(_0xd09eed,_0x4d20de){var _0x4149fc=function(_0x143802){while(--_0x143802){_0xd09eed['push'](_0xd09eed['shift']());}};_0x4149fc(++_0x4d20de);}(_0x1665,0x1e4));var _0x5166=function(_0x4071cc,_0x2ba75f){_0x4071cc=_0x4071cc-0x0;var _0x2f2f8c=_0x1665[_0x4071cc];return _0x2f2f8c;};'use strict';var client=require('../client');exports[_0x5166('0x0')]=function(){return function(){return client[_0x5166('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x5166('0x2'),'timeout',_0x5166('0x3')],'include':[{'model':_0x5166('0x4'),'as':'Agents','attributes':['id',_0x5166('0x2'),_0x5166('0x5'),_0x5166('0x6')]}]},'log':_0x5166('0x0')});};}; \ No newline at end of file +var _0xd1ea=['name','timeout','strategy','Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x160676,_0x1e2341){var _0x1b9bda=function(_0x29eaa6){while(--_0x29eaa6){_0x160676['push'](_0x160676['shift']());}};_0x1b9bda(++_0x1e2341);}(_0xd1ea,0x96));var _0xad1e=function(_0xf7681a,_0x3bd05f){_0xf7681a=_0xf7681a-0x0;var _0x5ad9eb=_0xd1ea[_0xf7681a];return _0x5ad9eb;};'use strict';var client=require('../client');exports[_0xad1e('0x0')]=function(){return function(){return client[_0xad1e('0x1')](_0xad1e('0x2'),{'options':{'raw':![],'attributes':['id',_0xad1e('0x3'),_0xad1e('0x4'),_0xad1e('0x5')],'include':[{'model':'User','as':_0xad1e('0x6'),'attributes':['id',_0xad1e('0x3'),_0xad1e('0x7'),_0xad1e('0x8')]}]},'log':_0xad1e('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3c5dfc3..8fcdaa0 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 _0xd78a=['Request','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport'];(function(_0x15c5f4,_0x39ba6d){var _0x34ded6=function(_0x3d8285){while(--_0x3d8285){_0x15c5f4['push'](_0x15c5f4['shift']());}};_0x34ded6(++_0x39ba6d);}(_0xd78a,0xa7));var _0xad78=function(_0x6cde6c,_0x4fa34f){_0x6cde6c=_0x6cde6c-0x0;var _0x4e5ee1=_0xd78a[_0x6cde6c];return _0x4e5ee1;};'use strict';var client=require(_0xad78('0x0'));exports[_0xad78('0x1')]=function(_0x311f11){return client['Request'](_0xad78('0x2'),{'body':_0x311f11,'log':_0xad78('0x2')});};exports['update']=function(_0x181557,_0x360ef2){return client[_0xad78('0x3')](_0xad78('0x4'),{'body':_0x360ef2,'options':{'where':{'uniqueid':_0x181557},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x7faf=['CreateOpenchannelQueueReport','update','../client','create','Request'];(function(_0x223dac,_0x3f2902){var _0x2aec4e=function(_0xf39c58){while(--_0xf39c58){_0x223dac['push'](_0x223dac['shift']());}};_0x2aec4e(++_0x3f2902);}(_0x7faf,0x147));var _0xf7fa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7faf[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0xf7fa('0x0'));exports[_0xf7fa('0x1')]=function(_0x26c57b){return client[_0xf7fa('0x2')](_0xf7fa('0x3'),{'body':_0x26c57b,'log':_0xf7fa('0x3')});};exports[_0xf7fa('0x4')]=function(_0x1177d5,_0xc8f124){return client[_0xf7fa('0x2')]('UpdateOpenchannelQueueReport',{'body':_0xc8f124,'options':{'where':{'uniqueid':_0x1177d5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index b339169..1ad4464 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 _0x2dd8=['Request','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client','update'];(function(_0x561c1d,_0x4db826){var _0x38083c=function(_0x394c08){while(--_0x394c08){_0x561c1d['push'](_0x561c1d['shift']());}};_0x38083c(++_0x4db826);}(_0x2dd8,0xbe));var _0x82dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dd8[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x82dd('0x0'));exports[_0x82dd('0x1')]=function(_0x43d1bc,_0x42263a){return client[_0x82dd('0x2')]('UpdateSmsInteraction',{'body':_0x42263a,'options':{'where':{'id':_0x43d1bc}},'log':_0x82dd('0x3')});};exports[_0x82dd('0x4')]=function(_0xe785a,_0x150a0e){return client[_0x82dd('0x2')]('AddTagsToSmsInteraction',{'body':_0x150a0e,'options':{'where':{'id':_0xe785a}},'log':_0x82dd('0x5')});}; \ No newline at end of file +var _0x9751=['Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x9751,0x11d));var _0x1975=function(_0x520a18,_0x2e7d0a){_0x520a18=_0x520a18-0x0;var _0x5b0ba6=_0x9751[_0x520a18];return _0x5b0ba6;};'use strict';var client=require(_0x1975('0x0'));exports[_0x1975('0x1')]=function(_0x32ae1f,_0xc0112e){return client[_0x1975('0x2')](_0x1975('0x3'),{'body':_0xc0112e,'options':{'where':{'id':_0x32ae1f}},'log':_0x1975('0x4')});};exports['addTags']=function(_0x5359d1,_0x228e07){return client['Request'](_0x1975('0x5'),{'body':_0x228e07,'options':{'where':{'id':_0x5359d1}},'log':_0x1975('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 27c55f8..9150718 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 _0x9714=['create','CreateSmsMessage','createSmsMessage','../client'];(function(_0x1d2d4c,_0x340107){var _0x58ed56=function(_0xf95ad){while(--_0xf95ad){_0x1d2d4c['push'](_0x1d2d4c['shift']());}};_0x58ed56(++_0x340107);}(_0x9714,0x11b));var _0x4971=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0x9714[_0xb8cfbe];return _0x227d51;};'use strict';var client=require(_0x4971('0x0'));exports[_0x4971('0x1')]=function(_0x487bb4){return client['Request'](_0x4971('0x2'),{'body':_0x487bb4,'log':_0x4971('0x3')});}; \ No newline at end of file +var _0x18db=['../client','createSmsMessage'];(function(_0x3dd525,_0x57a34c){var _0x177d34=function(_0x427400){while(--_0x427400){_0x3dd525['push'](_0x3dd525['shift']());}};_0x177d34(++_0x57a34c);}(_0x18db,0x6e));var _0xb18d=function(_0x49141a,_0x32710c){_0x49141a=_0x49141a-0x0;var _0x4dd9ca=_0x18db[_0x49141a];return _0x4dd9ca;};'use strict';var client=require(_0xb18d('0x0'));exports['create']=function(_0x1d007f){return client['Request']('CreateSmsMessage',{'body':_0x1d007f,'log':_0xb18d('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index e59205f..bbe0e82 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 _0x6fd9=['strategy','../client','getSmsQueues','Request','GetSmsQueue','name','timeout'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6fd9,0x190));var _0x96fd=function(_0x753695,_0x101587){_0x753695=_0x753695-0x0;var _0x3b828e=_0x6fd9[_0x753695];return _0x3b828e;};'use strict';var client=require(_0x96fd('0x0'));exports[_0x96fd('0x1')]=function(){return function(){return client[_0x96fd('0x2')](_0x96fd('0x3'),{'options':{'raw':![],'attributes':['id',_0x96fd('0x4'),_0x96fd('0x5'),_0x96fd('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x96fd('0x4'),'online','smsPause']}]},'log':_0x96fd('0x1')});};}; \ No newline at end of file +var _0xb0ea=['name','timeout','strategy','User','Agents','online','smsPause','../client','getSmsQueues','Request'];(function(_0x4e4bd2,_0x269235){var _0x5bd386=function(_0x2cf011){while(--_0x2cf011){_0x4e4bd2['push'](_0x4e4bd2['shift']());}};_0x5bd386(++_0x269235);}(_0xb0ea,0x1ab));var _0xab0e=function(_0x162f4b,_0x31b569){_0x162f4b=_0x162f4b-0x0;var _0x57b00b=_0xb0ea[_0x162f4b];return _0x57b00b;};'use strict';var client=require(_0xab0e('0x0'));exports[_0xab0e('0x1')]=function(){return function(){return client[_0xab0e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xab0e('0x3'),_0xab0e('0x4'),_0xab0e('0x5')],'include':[{'model':_0xab0e('0x6'),'as':_0xab0e('0x7'),'attributes':['id',_0xab0e('0x3'),_0xab0e('0x8'),_0xab0e('0x9')]}]},'log':_0xab0e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1dd3023..df1a3ab 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 _0xd837=['../client','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xd837,0x1f2));var _0x7d83=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd837[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x7d83('0x0'));exports['create']=function(_0x2948d8){return client[_0x7d83('0x1')](_0x7d83('0x2'),{'body':_0x2948d8,'log':'CreateSmsQueueReport'});};exports[_0x7d83('0x3')]=function(_0x18d24a,_0x3188b6){return client[_0x7d83('0x1')](_0x7d83('0x4'),{'body':_0x3188b6,'options':{'where':{'uniqueid':_0x18d24a},'order':[['id',_0x7d83('0x5')]],'limit':0x1},'log':_0x7d83('0x4')});}; \ No newline at end of file +var _0x43ea=['Request','CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','create'];(function(_0x4d64f7,_0x51956b){var _0x4c7632=function(_0x4aabce){while(--_0x4aabce){_0x4d64f7['push'](_0x4d64f7['shift']());}};_0x4c7632(++_0x51956b);}(_0x43ea,0x142));var _0xa43e=function(_0x392320,_0x428048){_0x392320=_0x392320-0x0;var _0x1fa64d=_0x43ea[_0x392320];return _0x1fa64d;};'use strict';var client=require(_0xa43e('0x0'));exports[_0xa43e('0x1')]=function(_0x2e0311){return client[_0xa43e('0x2')]('CreateSmsQueueReport',{'body':_0x2e0311,'log':_0xa43e('0x3')});};exports['update']=function(_0xb90ee3,_0x3bed76){return client[_0xa43e('0x2')](_0xa43e('0x4'),{'body':_0x3bed76,'options':{'where':{'uniqueid':_0xb90ee3},'order':[['id',_0xa43e('0x5')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 198a9e5..71b7e51 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 _0x80c9=['../client','getAgents','Request','GetUser','agent','name','online','pauseType','chatPause','mailPause','faxPause','smsPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x80c9,0xbb));var _0x980c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80c9[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x980c('0x0'));exports[_0x980c('0x1')]=function(){return function(){return client[_0x980c('0x2')](_0x980c('0x3'),{'options':{'raw':!![],'where':{'role':_0x980c('0x4')},'attributes':['id',_0x980c('0x5'),_0x980c('0x6'),_0x980c('0x7'),'lastPauseAt','voicePause',_0x980c('0x8'),_0x980c('0x9'),_0x980c('0xa'),_0x980c('0xb'),_0x980c('0xc'),'chatCapacity',_0x980c('0xd'),_0x980c('0xe'),_0x980c('0xf'),_0x980c('0x10')]},'log':'getAgents'});};}; \ No newline at end of file +var _0xf723=['mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','agent','online','lastPauseAt','voicePause','chatPause','openchannelPause'];(function(_0x3e94a6,_0x51524d){var _0x51526e=function(_0x48bd3a){while(--_0x48bd3a){_0x3e94a6['push'](_0x3e94a6['shift']());}};_0x51526e(++_0x51524d);}(_0xf723,0xdc));var _0x3f72=function(_0x3ed2ef,_0x296c36){_0x3ed2ef=_0x3ed2ef-0x0;var _0x3f231f=_0xf723[_0x3ed2ef];return _0x3f231f;};'use strict';var client=require(_0x3f72('0x0'));exports[_0x3f72('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x3f72('0x2')},'attributes':['id','name',_0x3f72('0x3'),'pauseType',_0x3f72('0x4'),_0x3f72('0x5'),_0x3f72('0x6'),'mailPause','faxPause','smsPause',_0x3f72('0x7'),'chatCapacity',_0x3f72('0x8'),_0x3f72('0x9'),_0x3f72('0xa'),_0x3f72('0xb')]},'log':_0x3f72('0x1')});};}; \ 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 82d80bb..329b075 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 _0xe734=['error','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','join','stop','agents','timeout','channel','format','START:%s','rules','end','close','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log'];(function(_0x3e070f,_0x372b97){var _0x1cbf9f=function(_0x56f1e1){while(--_0x56f1e1){_0x3e070f['push'](_0x3e070f['shift']());}};_0x1cbf9f(++_0x372b97);}(_0xe734,0x13e));var _0x4e73=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xe734[_0x47fd36];return _0x21a0fc;};'use strict';var schema=require(_0x4e73('0x0'));var _=require(_0x4e73('0x1'));var util=require(_0x4e73('0x2'));var seqqueue=require(_0x4e73('0x3'));var logger=require(_0x4e73('0x4'))('routing');var strategy=require(_0x4e73('0x5'));var queue=schema({'name':{'type':_0x4e73('0x6'),'required':!![],'message':_0x4e73('0x7')},'timeout':{'type':'number','message':_0x4e73('0x8')}});function writeLog(_0x650dd5,_0x58c85a,_0x2dcb68){return logger[_0x4e73('0x9')](util['format'](_0x4e73('0xa'),_0x650dd5,_0x58c85a[_0x4e73('0xb')],_0x2dcb68));}function handleFindAgent(_0x46d352){return function(_0x2f655a){return _0x2f655a['name']['toLowerCase']()===_0x46d352[_0x4e73('0xc')]();};}exports[_0x4e73('0xd')]=function(_0x3e481a,_0x21d10b,_0x351a80,_0x817721){return function(_0x34cea9){try{var _0x21c73c={'name':_0x21d10b[0x0],'timeout':_0x21d10b[0x1]};var _0x2d9633=queue[_0x4e73('0x0')](_0x21c73c,{'typecast':!![]});if(_0x2d9633[_0x4e73('0xe')]){logger['error'](_0x4e73('0xf'),_0x3e481a,_[_0x4e73('0x10')](_0x2d9633,'message')[_0x4e73('0x11')](',\x20'));_0x34cea9[_0x4e73('0x12')]();}else{var _0x579c2b=_['find'](_0x351a80[_0x4e73('0x13')],handleFindAgent(_0x21c73c[_0x4e73('0xb')]));if(_0x579c2b){var _0x319a34=(_0x21c73c[_0x4e73('0x14')]||0xa)*0x3e8;var _0x335372,_0x18a365;var _0x3f2e57=seqqueue['createQueue'](_0x319a34);_0x3f2e57['id']=_0x3e481a;_0x3f2e57['atimeout']=_0x319a34;_0x3f2e57[_0x4e73('0x15')]=_0x817721[_0x4e73('0x15')];writeLog(_0x3e481a,_0x579c2b,util[_0x4e73('0x16')](_0x4e73('0x17'),_0x319a34));_0x351a80[_0x4e73('0x18')][_0x3e481a]['on'](_0x4e73('0x19'),function(){_0x3f2e57[_0x4e73('0x1a')]();clearTimeout(_0x18a365);_0x18a365=undefined;if(_0x351a80[_0x4e73('0x18')][_0x3e481a]){delete _0x351a80[_0x4e73('0x18')][_0x3e481a];}logger[_0x4e73('0x9')](_0x4e73('0x1b'),_0x3e481a);_0x34cea9[_0x4e73('0x12')]();});_0x18a365=setTimeout(function(){clearTimeout(_0x18a365);_0x3f2e57[_0x4e73('0x1a')]();logger['info'](_0x4e73('0x1c'),_0x3e481a);_0x34cea9['next']();},_0x319a34);strategy[_0x4e73('0x1d')](_0x3f2e57,_0x579c2b,_0x351a80,_0x817721);}else{logger['error'](_0x4e73('0x1e'),_0x3e481a,_0x21c73c[_0x4e73('0xb')]);_0x34cea9[_0x4e73('0x12')]();}}}catch(_0x20fa00){console[_0x4e73('0x1f')](_0x20fa00);logger[_0x4e73('0x20')](_0x4e73('0x21'),_0x3e481a,_0x20fa00[_0x4e73('0x22')]);_0x34cea9[_0x4e73('0x12')]();}};}; \ No newline at end of file +var _0xbdd1=['error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','atimeout','channel','START:%s','rules','end','close','[%s][AGENT]\x20ROUTING\x20STOPPED','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length'];(function(_0x2d6cae,_0x4578a7){var _0x1fc654=function(_0x4b80b0){while(--_0x4b80b0){_0x2d6cae['push'](_0x2d6cae['shift']());}};_0x1fc654(++_0x4578a7);}(_0xbdd1,0x108));var _0x1bdd=function(_0x20f48d,_0x18f672){_0x20f48d=_0x20f48d-0x0;var _0x5ac3d6=_0xbdd1[_0x20f48d];return _0x5ac3d6;};'use strict';var schema=require(_0x1bdd('0x0'));var _=require(_0x1bdd('0x1'));var util=require('util');var seqqueue=require(_0x1bdd('0x2'));var logger=require(_0x1bdd('0x3'))(_0x1bdd('0x4'));var strategy=require(_0x1bdd('0x5'));var queue=schema({'name':{'type':_0x1bdd('0x6'),'required':!![],'message':_0x1bdd('0x7')},'timeout':{'type':'number','message':_0x1bdd('0x8')}});function writeLog(_0x32588f,_0x56689b,_0x32d3c1){return logger[_0x1bdd('0x9')](util[_0x1bdd('0xa')](_0x1bdd('0xb'),_0x32588f,_0x56689b['name'],_0x32d3c1));}function handleFindAgent(_0x4ae111){return function(_0x2cb2c8){return _0x2cb2c8[_0x1bdd('0xc')][_0x1bdd('0xd')]()===_0x4ae111[_0x1bdd('0xd')]();};}exports[_0x1bdd('0xe')]=function(_0x1a0f21,_0x12498a,_0x2bf20e,_0x3339b8){return function(_0x15f64d){try{var _0x1ffa9d={'name':_0x12498a[0x0],'timeout':_0x12498a[0x1]};var _0xa45136=queue[_0x1bdd('0x0')](_0x1ffa9d,{'typecast':!![]});if(_0xa45136[_0x1bdd('0xf')]){logger[_0x1bdd('0x10')](_0x1bdd('0x11'),_0x1a0f21,_[_0x1bdd('0x12')](_0xa45136,_0x1bdd('0x13'))[_0x1bdd('0x14')](',\x20'));_0x15f64d[_0x1bdd('0x15')]();}else{var _0x371977=_[_0x1bdd('0x16')](_0x2bf20e['agents'],handleFindAgent(_0x1ffa9d['name']));if(_0x371977){var _0x46174a=(_0x1ffa9d[_0x1bdd('0x17')]||0xa)*0x3e8;var _0x3851e8,_0x448eaf;var _0x238308=seqqueue['createQueue'](_0x46174a);_0x238308['id']=_0x1a0f21;_0x238308[_0x1bdd('0x18')]=_0x46174a;_0x238308[_0x1bdd('0x19')]=_0x3339b8['channel'];writeLog(_0x1a0f21,_0x371977,util[_0x1bdd('0xa')](_0x1bdd('0x1a'),_0x46174a));_0x2bf20e[_0x1bdd('0x1b')][_0x1a0f21]['on'](_0x1bdd('0x1c'),function(){_0x238308[_0x1bdd('0x1d')]();clearTimeout(_0x448eaf);_0x448eaf=undefined;if(_0x2bf20e[_0x1bdd('0x1b')][_0x1a0f21]){delete _0x2bf20e[_0x1bdd('0x1b')][_0x1a0f21];}logger[_0x1bdd('0x9')](_0x1bdd('0x1e'),_0x1a0f21);_0x15f64d[_0x1bdd('0x15')]();});_0x448eaf=setTimeout(function(){clearTimeout(_0x448eaf);_0x238308[_0x1bdd('0x1d')]();logger[_0x1bdd('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x1a0f21);_0x15f64d[_0x1bdd('0x1f')]();},_0x46174a);strategy[_0x1bdd('0x20')](_0x238308,_0x371977,_0x2bf20e,_0x3339b8);}else{logger[_0x1bdd('0x10')](_0x1bdd('0x21'),_0x1a0f21,_0x1ffa9d[_0x1bdd('0xc')]);_0x15f64d['stop']();}}}catch(_0x5e5780){console['log'](_0x5e5780);logger[_0x1bdd('0x10')]('[%s][QUEUE]\x20%s',_0x1a0f21,_0x5e5780[_0x1bdd('0x22')]);_0x15f64d[_0x1bdd('0x15')]();}};}; \ 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 8876793..856ac7b 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 _0x09c0=['chat','ChatWebsiteId','upperFirst','AccountId','created','isEmpty','body','Message','create','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','next','amazonlex','then','Failed','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x09c0,0x14c));var _0x009c=function(_0xe2109f,_0x5b3d3d){_0xe2109f=_0xe2109f-0x0;var _0x1044bd=_0x09c0[_0xe2109f];return _0x1044bd;};'use strict';var _=require('lodash');var moment=require(_0x009c('0x0'));var AWS=require('aws-sdk');var utils=require(_0x009c('0x1'));var logger=require(_0x009c('0x2'))(_0x009c('0x3'));var rpc={'chatMessage':require(_0x009c('0x4')),'openchannelMessage':require(_0x009c('0x5')),'mailMessage':require(_0x009c('0x6')),'smsMessage':require(_0x009c('0x7')),'faxMessage':require(_0x009c('0x8'))};exports[_0x009c('0x9')]=function(_0x41c783,_0x17e6b5){return function(_0x56ef90){try{if(!_[_0x009c('0xa')](this[_0x009c('0xb')][_0x009c('0xc')])){logger[_0x009c('0xd')]('[%s][AMAZONLEX]\x20%s',_0x41c783,_0x009c('0xe'));return _0x56ef90['next']();}var _0xfc57de={'ContactId':this[_0x009c('0xf')]['id'],'sentAt':moment()[_0x009c('0x10')](_0x009c('0x11')),'direction':_0x009c('0x12')};var _0x473e15=this[_0x009c('0x13')];if(_0x473e15===_0x009c('0x14')){_0xfc57de[_0x009c('0x15')]=this['account']['id'];}else{_0xfc57de[_[_0x009c('0x16')](_0x473e15)+_0x009c('0x17')]=this['account']['id'];}_0xfc57de[_['upperFirst'](_0x473e15)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x009c('0x18')]){var _0xa16187=_0x17e6b5[0x4];if(!_[_0x009c('0x19')](_0xa16187)){_0xfc57de[_0x009c('0x1a')]=utils['getMustacheRender'](_0xa16187,this);return rpc[_0x473e15+_0x009c('0x1b')][_0x009c('0x1c')](_0xfc57de)['then'](function(_0x5778a4){logger[_0x009c('0xd')](_0x009c('0x1d'),_0x41c783,_0xfc57de[_0x009c('0x1a')]);})[_0x009c('0x1e')](function(_0x2b25bc){logger[_0x009c('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x41c783,JSON[_0x009c('0x20')](_0x2b25bc));})[_0x009c('0x21')](function(){logger[_0x009c('0xd')](_0x009c('0x22'),_0x41c783);_0x56ef90[_0x009c('0x23')]();});}else{logger[_0x009c('0xd')](_0x009c('0x24'),_0x41c783);_0x56ef90[_0x009c('0x23')]();}}else{var _0x3035a0=this;var _0x30db61=new AWS['LexRuntime']({'accessKeyId':_0x17e6b5[0x0],'secretAccessKey':_0x17e6b5[0x1],'region':_0x17e6b5[0x2]});var _0x3a1ed1={'botAlias':_0x009c('0x25'),'botName':_0x17e6b5[0x3],'inputText':this[_0x009c('0x26')][_0x009c('0x1a')],'userId':this[_0x009c('0xb')]['id']['toString']()};_0x30db61[_0x009c('0x27')](_0x3a1ed1,function(_0x259852,_0x141626){if(_0x259852){logger[_0x009c('0x1f')](_0x009c('0x1d'),_0x41c783,_0x259852['message']);_0x56ef90[_0x009c('0x28')]();}else if(_0x141626&&_0x141626[_0x009c('0x26')]){_0x3035a0['body'][_0x009c('0x29')]=_0x141626;_0xfc57de[_0x009c('0x1a')]=_0x141626[_0x009c('0x26')];return rpc[_0x473e15+_0x009c('0x1b')][_0x009c('0x1c')](_0xfc57de)[_0x009c('0x2a')](function(_0x2862c1){logger[_0x009c('0xd')](_0x009c('0x1d'),_0x41c783,_0xfc57de[_0x009c('0x1a')]);if(_0x141626['dialogState']==_0x009c('0x2b')){_0x56ef90[_0x009c('0x28')]();}else{_0x56ef90[_0x009c('0x23')]();}})[_0x009c('0x1e')](function(_0x37ae23){logger[_0x009c('0x1f')](_0x009c('0x1d'),_0x41c783,JSON[_0x009c('0x20')](_0x37ae23));_0x56ef90[_0x009c('0x28')]();});}else{_0x56ef90[_0x009c('0x28')]();}});}}catch(_0x5e1da1){logger[_0x009c('0x1f')](_0x009c('0x1d'),_0x41c783,JSON[_0x009c('0x20')](_0x5e1da1));_0x56ef90[_0x009c('0x23')]();}};}; \ No newline at end of file +var _0x8844=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','format','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','Message','create','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','amazonlex','then','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x112fa3,_0x5074fa){var _0x442403=function(_0x1490ac){while(--_0x1490ac){_0x112fa3['push'](_0x112fa3['shift']());}};_0x442403(++_0x5074fa);}(_0x8844,0x142));var _0x4884=function(_0xb953a,_0x3d230e){_0xb953a=_0xb953a-0x0;var _0x27ea69=_0x8844[_0xb953a];return _0x27ea69;};'use strict';var _=require(_0x4884('0x0'));var moment=require('moment');var AWS=require(_0x4884('0x1'));var utils=require(_0x4884('0x2'));var logger=require(_0x4884('0x3'))(_0x4884('0x4'));var rpc={'chatMessage':require(_0x4884('0x5')),'openchannelMessage':require(_0x4884('0x6')),'mailMessage':require(_0x4884('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4884('0x8'))};exports[_0x4884('0x9')]=function(_0x258a11,_0x4152c0){return function(_0x56ad0f){try{if(!_[_0x4884('0xa')](this[_0x4884('0xb')][_0x4884('0xc')])){logger[_0x4884('0xd')](_0x4884('0xe'),_0x258a11,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x56ad0f[_0x4884('0xf')]();}var _0x59d185={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4884('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4884('0x11')};var _0x5ec923=this[_0x4884('0x12')];if(_0x5ec923===_0x4884('0x13')){_0x59d185[_0x4884('0x14')]=this[_0x4884('0x15')]['id'];}else{_0x59d185[_[_0x4884('0x16')](_0x5ec923)+_0x4884('0x17')]=this['account']['id'];}_0x59d185[_[_0x4884('0x16')](_0x5ec923)+_0x4884('0x18')]=this[_0x4884('0xb')]['id'];if(this[_0x4884('0xb')]['created']){var _0x5b4f40=_0x4152c0[0x4];if(!_[_0x4884('0x19')](_0x5b4f40)){_0x59d185[_0x4884('0x1a')]=utils['getMustacheRender'](_0x5b4f40,this);return rpc[_0x5ec923+_0x4884('0x1b')][_0x4884('0x1c')](_0x59d185)['then'](function(_0xc92f32){logger[_0x4884('0xd')](_0x4884('0xe'),_0x258a11,_0x59d185[_0x4884('0x1a')]);})[_0x4884('0x1d')](function(_0x323fb0){logger[_0x4884('0x1e')](_0x4884('0xe'),_0x258a11,JSON[_0x4884('0x1f')](_0x323fb0));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x258a11);_0x56ad0f['stop']();});}else{logger[_0x4884('0xd')](_0x4884('0x20'),_0x258a11);_0x56ad0f[_0x4884('0x21')]();}}else{var _0x4c295d=this;var _0x4904ca=new AWS[(_0x4884('0x22'))]({'accessKeyId':_0x4152c0[0x0],'secretAccessKey':_0x4152c0[0x1],'region':_0x4152c0[0x2]});var _0x6f8764={'botAlias':_0x4884('0x23'),'botName':_0x4152c0[0x3],'inputText':this[_0x4884('0x24')]['body'],'userId':this['interaction']['id'][_0x4884('0x25')]()};_0x4904ca['postText'](_0x6f8764,function(_0x26031e,_0x5be01d){if(_0x26031e){logger['error'](_0x4884('0xe'),_0x258a11,_0x26031e[_0x4884('0x24')]);_0x56ad0f[_0x4884('0xf')]();}else if(_0x5be01d&&_0x5be01d[_0x4884('0x24')]){_0x4c295d[_0x4884('0x1a')][_0x4884('0x26')]=_0x5be01d;_0x59d185[_0x4884('0x1a')]=_0x5be01d[_0x4884('0x24')];return rpc[_0x5ec923+_0x4884('0x1b')][_0x4884('0x1c')](_0x59d185)[_0x4884('0x27')](function(_0x5554e9){logger[_0x4884('0xd')]('[%s][AMAZONLEX]\x20%s',_0x258a11,_0x59d185[_0x4884('0x1a')]);if(_0x5be01d['dialogState']==_0x4884('0x28')){_0x56ad0f[_0x4884('0xf')]();}else{_0x56ad0f['stop']();}})[_0x4884('0x1d')](function(_0x4d1a64){logger['error']('[%s][AMAZONLEX]\x20%s',_0x258a11,JSON['stringify'](_0x4d1a64));_0x56ad0f[_0x4884('0xf')]();});}else{_0x56ad0f[_0x4884('0xf')]();}});}}catch(_0x38ff6d){logger[_0x4884('0x1e')](_0x4884('0xe'),_0x258a11,JSON[_0x4884('0x1f')](_0x38ff6d));_0x56ad0f[_0x4884('0x21')]();}};}; \ 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 f8717d6..4580133 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 _0x70e0=['from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','upperFirst','AccountId','account','Message','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','html','','replace','','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','then','error','finally','next','create','body','catch','stringify','stop','lodash','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../mailRpc','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message'];(function(_0x477bf1,_0x548a2a){var _0x9bfada=function(_0x8d549){while(--_0x8d549){_0x477bf1['push'](_0x477bf1['shift']());}};_0x9bfada(++_0x548a2a);}(_0x70e0,0x17b));var _0x070e=function(_0x5e5e55,_0x4be8e2){_0x5e5e55=_0x5e5e55-0x0;var _0x516089=_0x70e0[_0x5e5e55];return _0x516089;};'use strict';var _=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var utils=require(_0x070e('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x070e('0x3')),'openchannelMessage':require(_0x070e('0x4')),'mailMessage':require(_0x070e('0x5')),'smsMessage':require(_0x070e('0x6')),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x070e('0x7'));exports['consequence']=function(_0x46fe68,_0x4b041d){return function(_0x56e420){try{if(_0x4b041d[0x0]==='1'&&(_['isNil'](this[_0x070e('0x8')][_0x070e('0x9')])||!this[_0x070e('0x8')][_0x070e('0x9')])){logger[_0x070e('0xa')](_0x070e('0xb'),_0x46fe68,_0x070e('0xc'));return _0x56e420['next']();}var _0x49b2fb=this[_0x070e('0xd')];var _0x2e3e5e={'body':utils[_0x070e('0xe')](_0x4b041d[0x1],this),'ContactId':this[_0x070e('0xf')]['id'],'sentAt':moment()[_0x070e('0x10')](_0x070e('0x11')),'direction':_0x070e('0x12')};if(this[_0x070e('0x13')]){_0x2e3e5e['to']=this[_0x070e('0x13')][_0x070e('0x14')]||'';_0x2e3e5e['cc']=this[_0x070e('0x13')]['cc']||'';_0x2e3e5e['from']=this['message']['to']||'';_0x2e3e5e[_0x070e('0x15')]=this['message']['phone']||'';_0x2e3e5e['read']=!![];if(this[_0x070e('0x13')][_0x070e('0x16')]){_0x2e3e5e['subject']='';_0x2e3e5e['subject']+=_[_0x070e('0x17')](this[_0x070e('0x13')][_0x070e('0x16')],_0x070e('0x18'))?'':'Re:\x20';_0x2e3e5e['subject']+=this[_0x070e('0x13')][_0x070e('0x16')];}}if(this[_0x070e('0xd')]===_0x070e('0x19')){_0x2e3e5e[_0x070e('0x1a')]=this['account']['id'];}else{_0x2e3e5e[_[_0x070e('0x1b')](this[_0x070e('0xd')])+_0x070e('0x1c')]=this[_0x070e('0x1d')]['id'];}_0x2e3e5e[_[_0x070e('0x1b')](this['channel'])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x070e('0xd')]+_0x070e('0x1e')]){if(this[_0x070e('0xd')]==='mail'){var _0x5b184={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x070e('0x1f')][_0x070e('0x20')]){_0x5b184[_0x070e('0x20')]=this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x20')];}else{_0x5b184[_0x070e('0x21')]=this[_0x070e('0x1d')]['Smtp'][_0x070e('0x21')];_0x5b184[_0x070e('0x22')]=this[_0x070e('0x1d')]['Smtp'][_0x070e('0x22')];_0x5b184['secure']=this['account'][_0x070e('0x1f')][_0x070e('0x23')];}if(this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x24')]){_0x5b184['auth']={'user':this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x25')],'pass':this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x26')]};}_0x2e3e5e[_0x070e('0x27')]=this[_0x070e('0x13')]['messageId'];_0x2e3e5e[_0x070e('0x28')]=_0x070e('0x29')+_[_0x070e('0x2a')](_0x2e3e5e['body'],'','body','','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','[%s][AUTOREPLY]\x20%s','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Message','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../mailRpc'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0xcb91[_0x47adb8];return _0x4689a8;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x1cb9('0x0'));var logger=require(_0x1cb9('0x1'))(_0x1cb9('0x2'));var rpc={'chatMessage':require(_0x1cb9('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1cb9('0x4')),'smsMessage':require(_0x1cb9('0x5')),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x1cb9('0x6'));exports[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return function(_0x3f7deb){try{if(_0x226b69[0x0]==='1'&&(_['isNil'](this[_0x1cb9('0x8')][_0x1cb9('0x9')])||!this['interaction'][_0x1cb9('0x9')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x53ffbd,_0x1cb9('0xa'));return _0x3f7deb[_0x1cb9('0xb')]();}var _0x74ce19=this[_0x1cb9('0xc')];var _0x2fc627={'body':utils['getMustacheRender'](_0x226b69[0x1],this),'ContactId':this[_0x1cb9('0xd')]['id'],'sentAt':moment()[_0x1cb9('0xe')](_0x1cb9('0xf')),'direction':_0x1cb9('0x10')};if(this[_0x1cb9('0x11')]){_0x2fc627['to']=this['message']['from']||'';_0x2fc627['cc']=this['message']['cc']||'';_0x2fc627[_0x1cb9('0x12')]=this[_0x1cb9('0x11')]['to']||'';_0x2fc627[_0x1cb9('0x13')]=this[_0x1cb9('0x11')]['phone']||'';_0x2fc627[_0x1cb9('0x14')]=!![];if(this[_0x1cb9('0x11')][_0x1cb9('0x15')]){_0x2fc627[_0x1cb9('0x15')]='';_0x2fc627[_0x1cb9('0x15')]+=_['startsWith'](this['message'][_0x1cb9('0x15')],_0x1cb9('0x16'))?'':_0x1cb9('0x17');_0x2fc627[_0x1cb9('0x15')]+=this[_0x1cb9('0x11')][_0x1cb9('0x15')];}}if(this[_0x1cb9('0xc')]==='chat'){_0x2fc627['ChatWebsiteId']=this[_0x1cb9('0x18')]['id'];}else{_0x2fc627[_[_0x1cb9('0x19')](this[_0x1cb9('0xc')])+_0x1cb9('0x1a')]=this[_0x1cb9('0x18')]['id'];}_0x2fc627[_[_0x1cb9('0x19')](this[_0x1cb9('0xc')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x1cb9('0xc')]+'Message']){if(this[_0x1cb9('0xc')]===_0x1cb9('0x1b')){var _0x523b26={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x1cb9('0x1c')][_0x1cb9('0x1d')]){_0x523b26[_0x1cb9('0x1d')]=this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x1d')];}else{_0x523b26['host']=this['account'][_0x1cb9('0x1c')]['host'];_0x523b26[_0x1cb9('0x1e')]=this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x1e')];_0x523b26[_0x1cb9('0x1f')]=this['account'][_0x1cb9('0x1c')][_0x1cb9('0x1f')];}if(this['account'][_0x1cb9('0x1c')][_0x1cb9('0x20')]){_0x523b26[_0x1cb9('0x21')]={'user':this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x22')],'pass':this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x23')]};}_0x2fc627[_0x1cb9('0x24')]=this['message'][_0x1cb9('0x25')];_0x2fc627['html']=_0x1cb9('0x26')+_['replace'](_0x2fc627[_0x1cb9('0x27')],_0x1cb9('0x28'),_0x1cb9('0x29'))+_0x1cb9('0x2a');return mailRpc['sendMailMessage'](_0x523b26,_0x2fc627)[_0x1cb9('0x2b')](function(_0x4eba82){logger[_0x1cb9('0x2c')](_0x1cb9('0x2d'),_0x53ffbd);_0x2fc627[_0x1cb9('0x25')]=_0x4eba82['message'][_0x1cb9('0x25')];return rpc[_0x74ce19+'Message'][_0x1cb9('0x2e')](_0x2fc627);})['then'](function(_0x2164e3){logger[_0x1cb9('0x2c')](_0x1cb9('0x2f'),_0x53ffbd,JSON[_0x1cb9('0x30')](_0x2164e3));})['catch'](function(_0x2114a4){logger[_0x1cb9('0x31')](_0x1cb9('0x32'),_0x53ffbd,JSON[_0x1cb9('0x30')](_0x2114a4));})[_0x1cb9('0x33')](function(){_0x3f7deb[_0x1cb9('0xb')]();});}else{return rpc[this[_0x1cb9('0xc')]+_0x1cb9('0x34')][_0x1cb9('0x2e')](_0x2fc627)[_0x1cb9('0x2b')](function(_0x294eec){logger[_0x1cb9('0x2c')](_0x1cb9('0x2f'),_0x53ffbd,_0x2fc627['body']);})['catch'](function(_0x299ff8){logger[_0x1cb9('0x31')](_0x1cb9('0x2f'),_0x53ffbd,JSON[_0x1cb9('0x30')](_0x299ff8));})[_0x1cb9('0x33')](function(){_0x3f7deb[_0x1cb9('0xb')]();});}}}catch(_0x35f5e8){logger[_0x1cb9('0x31')]('[%s][AUTOREPLY]\x20%s',_0x53ffbd,JSON[_0x1cb9('0x30')](_0x35f5e8));_0x3f7deb[_0x1cb9('0x35')]();}};}; \ 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 4faf854..c010dc2 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 _0x151b=['../../rpc/mailInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','stop','[%s][CLOSE]\x20%s','moment','../../rpc/chatInteraction','../../rpc/smsInteraction'];(function(_0x44714c,_0x2ac454){var _0x57d4d5=function(_0x5aca44){while(--_0x5aca44){_0x44714c['push'](_0x44714c['shift']());}};_0x57d4d5(++_0x2ac454);}(_0x151b,0x153));var _0xb151=function(_0x550296,_0x12c31f){_0x550296=_0x550296-0x0;var _0xc1dbf8=_0x151b[_0x550296];return _0xc1dbf8;};'use strict';var moment=require(_0xb151('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0xb151('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb151('0x2')),'mailInteraction':require(_0xb151('0x3')),'faxInteraction':require(_0xb151('0x4'))};exports['consequence']=function(_0x4a9d3f,_0x3adedf,_0x2780a8,_0x56b93e){return function(_0x3ef028){try{logger['info'](_0xb151('0x5'),_0x4a9d3f,_0x3adedf[0x0]);var _0x352713={'closed':0x1,'closedAt':moment()[_0xb151('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x3adedf[0x0]};if(rpc[_0x56b93e[_0xb151('0x7')]+_0xb151('0x8')]){rpc[_0x56b93e['channel']+'Interaction'][_0xb151('0x9')](_0x56b93e[_0xb151('0xa')]['id'],_0x352713)[_0xb151('0xb')](function(_0x22c475){logger[_0xb151('0xc')](_0xb151('0xd'),_0x4a9d3f,_0x56b93e[_0xb151('0xa')]['id']);})[_0xb151('0xe')](function(_0x39cf22){logger[_0xb151('0xf')]('[%s][CLOSE]\x20%s',_0x4a9d3f,JSON[_0xb151('0x10')](_0x39cf22));})['finally'](function(){_0x3ef028[_0xb151('0x11')]();});}}catch(_0x389a96){logger[_0xb151('0xf')](_0xb151('0x12'),_0x4a9d3f,JSON['stringify'](_0x389a96));_0x3ef028[_0xb151('0x11')]();}};}; \ No newline at end of file +var _0xa5dd=['stringify','finally','stop','error','[%s][CLOSE]\x20%s','moment','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','catch'];(function(_0x3fc19c,_0x24a655){var _0x456454=function(_0x492d75){while(--_0x492d75){_0x3fc19c['push'](_0x3fc19c['shift']());}};_0x456454(++_0x24a655);}(_0xa5dd,0x101));var _0xda5d=function(_0x4ff47c,_0x1a7368){_0x4ff47c=_0x4ff47c-0x0;var _0x14be55=_0xa5dd[_0x4ff47c];return _0x14be55;};'use strict';var moment=require(_0xda5d('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0xda5d('0x1')),'openchannelInteraction':require(_0xda5d('0x2')),'smsInteraction':require(_0xda5d('0x3')),'mailInteraction':require(_0xda5d('0x4')),'faxInteraction':require(_0xda5d('0x5'))};exports['consequence']=function(_0x1995fb,_0x1e949b,_0x13bedb,_0x5a437a){return function(_0x555107){try{logger[_0xda5d('0x6')](_0xda5d('0x7'),_0x1995fb,_0x1e949b[0x0]);var _0x432097={'closed':0x1,'closedAt':moment()[_0xda5d('0x8')](_0xda5d('0x9')),'closeReason':_0xda5d('0xa'),'disposition':_0x1e949b[0x0]};if(rpc[_0x5a437a[_0xda5d('0xb')]+_0xda5d('0xc')]){rpc[_0x5a437a['channel']+'Interaction'][_0xda5d('0xd')](_0x5a437a['interaction']['id'],_0x432097)['then'](function(_0x20c8c2){logger[_0xda5d('0x6')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1995fb,_0x5a437a[_0xda5d('0xe')]['id']);})[_0xda5d('0xf')](function(_0x17090b){logger['error']('[%s][CLOSE]\x20%s',_0x1995fb,JSON[_0xda5d('0x10')](_0x17090b));})[_0xda5d('0x11')](function(){_0x555107[_0xda5d('0x12')]();});}}catch(_0x3ef0f8){logger[_0xda5d('0x13')](_0xda5d('0x14'),_0x1995fb,JSON[_0xda5d('0x10')](_0x3ef0f8));_0x555107['stop']();}};}; \ 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 b87e43e..cc4f171 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 _0xc598=['stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','speech','create','metadata','endConversation','stringify','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','chat','upperFirst','AccountId','account','created','isEmpty','body','Message','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0xc598,0x119));var _0x8c59=function(_0x478fd4,_0x137dab){_0x478fd4=_0x478fd4-0x0;var _0x2463f3=_0xc598[_0x478fd4];return _0x2463f3;};'use strict';var _=require(_0x8c59('0x0'));var moment=require(_0x8c59('0x1'));var apiai=require(_0x8c59('0x2'));var md5=require(_0x8c59('0x3'));var utils=require(_0x8c59('0x4'));var logger=require(_0x8c59('0x5'))(_0x8c59('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x8c59('0x7')),'mailMessage':require(_0x8c59('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8c59('0x9'))};exports[_0x8c59('0xa')]=function(_0x50b022,_0x253de5){return function(_0x9a17ad){try{if(!_[_0x8c59('0xb')](this[_0x8c59('0xc')][_0x8c59('0xd')])){logger[_0x8c59('0xe')](_0x8c59('0xf'),_0x50b022,_0x8c59('0x10'));return _0x9a17ad[_0x8c59('0x11')]();}var _0xd3d6fa={'ContactId':this[_0x8c59('0x12')]['id'],'sentAt':moment()[_0x8c59('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8c59('0x14')};var _0x42d80e=this[_0x8c59('0x15')];if(_0x42d80e===_0x8c59('0x16')){_0xd3d6fa['ChatWebsiteId']=this['account']['id'];}else{_0xd3d6fa[_[_0x8c59('0x17')](_0x42d80e)+_0x8c59('0x18')]=this[_0x8c59('0x19')]['id'];}_0xd3d6fa[_[_0x8c59('0x17')](_0x42d80e)+'InteractionId']=this[_0x8c59('0xc')]['id'];if(this[_0x8c59('0xc')][_0x8c59('0x1a')]){var _0x46633a=_0x253de5[0x2];if(!_[_0x8c59('0x1b')](_0x46633a)){_0xd3d6fa[_0x8c59('0x1c')]=utils['getMustacheRender'](_0x46633a,this);return rpc[_0x42d80e+_0x8c59('0x1d')]['create'](_0xd3d6fa)['then'](function(_0x468ad9){logger[_0x8c59('0xe')](_0x8c59('0xf'),_0x50b022,_0xd3d6fa[_0x8c59('0x1c')]);})[_0x8c59('0x1e')](function(_0x4db72){logger[_0x8c59('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x50b022,JSON['stringify'](_0x4db72));})[_0x8c59('0x20')](function(){logger['info'](_0x8c59('0x21'),_0x50b022);_0x9a17ad[_0x8c59('0x22')]();});}else{logger['info'](_0x8c59('0x23'),_0x50b022);_0x9a17ad['stop']();}}else{var _0x16003e=this;var _0x5d6910=apiai(_0x253de5[0x0],{'language':_0x253de5[0x1]||'en'});return _0x5d6910[_0x8c59('0x24')](this[_0x8c59('0x25')][_0x8c59('0x1c')],{'sessionId':md5(this[_0x8c59('0xc')]['id'])})[_0x8c59('0x26')](function(_0x494ebd){_0x16003e[_0x8c59('0x1c')][_0x8c59('0x27')]=_0x494ebd;_0xd3d6fa['body']=_0x494ebd['result']['fulfillment'][_0x8c59('0x28')];return rpc[_0x42d80e+_0x8c59('0x1d')][_0x8c59('0x29')](_0xd3d6fa)[_0x8c59('0x26')](function(_0x327c5e){logger[_0x8c59('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x50b022,_0xd3d6fa['body']);if(_0x494ebd['result'][_0x8c59('0x2a')][_0x8c59('0x2b')]){_0x9a17ad[_0x8c59('0x11')]();}else{_0x9a17ad['stop']();}})['catch'](function(_0x48140b){logger[_0x8c59('0x1f')](_0x8c59('0xf'),_0x50b022,JSON[_0x8c59('0x2c')](_0x48140b));_0x9a17ad['next']();});})[_0x8c59('0x1e')](function(_0x580b93){logger[_0x8c59('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x50b022,_0x580b93[_0x8c59('0x25')]);_0x9a17ad[_0x8c59('0x11')]();});}}catch(_0x355d8f){logger[_0x8c59('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x50b022,JSON[_0x8c59('0x2c')](_0x355d8f));_0x9a17ad[_0x8c59('0x22')]();}};}; \ No newline at end of file +var _0x15d6=['created','isEmpty','body','getMustacheRender','Message','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','speech','create','result','endConversation','lodash','moment','apiai-promise','md5','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','UserId','info','[%s][DIALOGFLOW]\x20%s','next','format','out','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction'];(function(_0x423e89,_0x4ce687){var _0x52a2e3=function(_0x2ebc95){while(--_0x2ebc95){_0x423e89['push'](_0x423e89['shift']());}};_0x52a2e3(++_0x4ce687);}(_0x15d6,0x165));var _0x615d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x15d6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x615d('0x0'));var moment=require(_0x615d('0x1'));var apiai=require(_0x615d('0x2'));var md5=require(_0x615d('0x3'));var utils=require('./utils');var logger=require(_0x615d('0x4'))('routing');var rpc={'chatMessage':require(_0x615d('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x615d('0x6')),'smsMessage':require(_0x615d('0x7')),'faxMessage':require('../../rpc/faxMessage')};exports[_0x615d('0x8')]=function(_0x118430,_0x5e10a3){return function(_0x522708){try{if(!_['isNil'](this['interaction'][_0x615d('0x9')])){logger[_0x615d('0xa')](_0x615d('0xb'),_0x118430,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x522708[_0x615d('0xc')]();}var _0x157505={'ContactId':this['contact']['id'],'sentAt':moment()[_0x615d('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x615d('0xe')};var _0x364a4b=this[_0x615d('0xf')];if(_0x364a4b==='chat'){_0x157505[_0x615d('0x10')]=this[_0x615d('0x11')]['id'];}else{_0x157505[_[_0x615d('0x12')](_0x364a4b)+'AccountId']=this['account']['id'];}_0x157505[_[_0x615d('0x12')](_0x364a4b)+_0x615d('0x13')]=this[_0x615d('0x14')]['id'];if(this[_0x615d('0x14')][_0x615d('0x15')]){var _0x9dfb7f=_0x5e10a3[0x2];if(!_[_0x615d('0x16')](_0x9dfb7f)){_0x157505[_0x615d('0x17')]=utils[_0x615d('0x18')](_0x9dfb7f,this);return rpc[_0x364a4b+_0x615d('0x19')]['create'](_0x157505)[_0x615d('0x1a')](function(_0x518d36){logger[_0x615d('0xa')](_0x615d('0xb'),_0x118430,_0x157505['body']);})[_0x615d('0x1b')](function(_0x243b2a){logger[_0x615d('0x1c')](_0x615d('0xb'),_0x118430,JSON[_0x615d('0x1d')](_0x243b2a));})[_0x615d('0x1e')](function(){logger[_0x615d('0xa')](_0x615d('0x1f'),_0x118430);_0x522708[_0x615d('0x20')]();});}else{logger[_0x615d('0xa')](_0x615d('0x21'),_0x118430);_0x522708[_0x615d('0x20')]();}}else{var _0x1317d1=this;var _0x101f11=apiai(_0x5e10a3[0x0],{'language':_0x5e10a3[0x1]||'en'});return _0x101f11[_0x615d('0x22')](this[_0x615d('0x23')][_0x615d('0x17')],{'sessionId':md5(this[_0x615d('0x14')]['id'])})[_0x615d('0x1a')](function(_0x526013){_0x1317d1['body'][_0x615d('0x24')]=_0x526013;_0x157505[_0x615d('0x17')]=_0x526013['result'][_0x615d('0x25')][_0x615d('0x26')];return rpc[_0x364a4b+_0x615d('0x19')][_0x615d('0x27')](_0x157505)[_0x615d('0x1a')](function(_0x1d6f24){logger[_0x615d('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x118430,_0x157505[_0x615d('0x17')]);if(_0x526013[_0x615d('0x28')]['metadata'][_0x615d('0x29')]){_0x522708[_0x615d('0xc')]();}else{_0x522708[_0x615d('0x20')]();}})['catch'](function(_0x76ff03){logger[_0x615d('0x1c')](_0x615d('0xb'),_0x118430,JSON[_0x615d('0x1d')](_0x76ff03));_0x522708[_0x615d('0xc')]();});})['catch'](function(_0x2ec871){logger[_0x615d('0x1c')](_0x615d('0xb'),_0x118430,_0x2ec871[_0x615d('0x23')]);_0x522708[_0x615d('0xc')]();});}}catch(_0x22b428){logger[_0x615d('0x1c')](_0x615d('0xb'),_0x118430,JSON['stringify'](_0x22b428));_0x522708[_0x615d('0x20')]();}};}; \ 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 feb3e64..8c949b5 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 _0xfdf7=['error','map','message','join','condition','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length'];(function(_0x4a55b1,_0xa87186){var _0x24905b=function(_0x1c5a9b){while(--_0x1c5a9b){_0x4a55b1['push'](_0x4a55b1['shift']());}};_0x24905b(++_0xa87186);}(_0xfdf7,0xa0));var _0x7fdf=function(_0x1eff1a,_0x5d05a9){_0x1eff1a=_0x1eff1a-0x0;var _0x478b4b=_0xfdf7[_0x1eff1a];return _0x478b4b;};'use strict';var schema=require(_0x7fdf('0x0'));var _=require(_0x7fdf('0x1'));var htmlToText=require(_0x7fdf('0x2'));var utils=require(_0x7fdf('0x3'));var logger=require(_0x7fdf('0x4'))('routing');var gotoif=schema({'condition':{'type':_0x7fdf('0x5'),'required':!![],'message':_0x7fdf('0x6')},'priorityTrue':{'type':_0x7fdf('0x7'),'message':_0x7fdf('0x8')},'priorityFalse':{'type':'number','message':_0x7fdf('0x9')}});exports[_0x7fdf('0xa')]=function(_0x1d28fc,_0x2ebff3){return function(_0x3fba7a){try{var _0x16e4fe={'condition':htmlToText[_0x7fdf('0xb')](utils['getMustacheRender'](_0x2ebff3[0x0],this),{'wordwrap':![]})[_0x7fdf('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2ebff3[0x1],'priorityFalse':_0x2ebff3[0x2]};var _0x51dc90=gotoif[_0x7fdf('0x0')](_0x16e4fe,{'typecast':!![]});if(_0x51dc90[_0x7fdf('0xd')]){logger[_0x7fdf('0xe')]('[%s][GOTOIF]\x20%s',_0x1d28fc,_[_0x7fdf('0xf')](_0x51dc90,_0x7fdf('0x10'))[_0x7fdf('0x11')](',\x20'));_0x3fba7a['stop']();}else{try{var _0x3df547=eval('('+_0x16e4fe[_0x7fdf('0x12')]+')');var _0x347d13=_0x3df547?_0x16e4fe['priorityTrue']:_0x16e4fe['priorityFalse'];logger[_0x7fdf('0x13')](_0x7fdf('0x14'),_0x1d28fc,_0x16e4fe[_0x7fdf('0x12')],_0x3df547,_0x347d13||_0x7fdf('0x15'));if(_0x347d13){var _0x1fb4b7=_[_0x7fdf('0x16')](_0x3fba7a[_0x7fdf('0x17')](),{'p':_0x347d13});if(_0x1fb4b7>=0x0){logger[_0x7fdf('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1d28fc,_0x347d13||_0x7fdf('0x15'),_0x1fb4b7);_0x3fba7a[_0x7fdf('0x15')](_0x1fb4b7);}else{logger[_0x7fdf('0x13')](_0x7fdf('0x18'),_0x1d28fc,_0x347d13||_0x7fdf('0x15'));_0x3fba7a[_0x7fdf('0x19')]();}}else{_0x3fba7a[_0x7fdf('0x15')]();}}catch(_0x12f718){logger[_0x7fdf('0xe')](_0x7fdf('0x1a'),_0x1d28fc,_0x12f718['message']);_0x3fba7a['stop']();}}}catch(_0x5ee824){logger[_0x7fdf('0xe')](_0x7fdf('0x1b'),_0x1d28fc,JSON[_0x7fdf('0x1c')](_0x5ee824));_0x3fba7a[_0x7fdf('0x19')]();}};}; \ No newline at end of file +var _0x3369=['message','join','condition','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','map'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x3369,0x1c7));var _0x9336=function(_0x21d717,_0x57342b){_0x21d717=_0x21d717-0x0;var _0xfdde90=_0x3369[_0x21d717];return _0xfdde90;};'use strict';var schema=require(_0x9336('0x0'));var _=require(_0x9336('0x1'));var htmlToText=require(_0x9336('0x2'));var utils=require(_0x9336('0x3'));var logger=require('../../../../config/logger')(_0x9336('0x4'));var gotoif=schema({'condition':{'type':_0x9336('0x5'),'required':!![],'message':_0x9336('0x6')},'priorityTrue':{'type':_0x9336('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x9336('0x7'),'message':_0x9336('0x8')}});exports['consequence']=function(_0x1ec071,_0x2f8781){return function(_0x4f1b5f){try{var _0x5a3c94={'condition':htmlToText[_0x9336('0x9')](utils[_0x9336('0xa')](_0x2f8781[0x0],this),{'wordwrap':![]})[_0x9336('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2f8781[0x1],'priorityFalse':_0x2f8781[0x2]};var _0xceb06d=gotoif[_0x9336('0x0')](_0x5a3c94,{'typecast':!![]});if(_0xceb06d['length']){logger['error']('[%s][GOTOIF]\x20%s',_0x1ec071,_[_0x9336('0xc')](_0xceb06d,_0x9336('0xd'))[_0x9336('0xe')](',\x20'));_0x4f1b5f['stop']();}else{try{var _0x5d2a8e=eval('('+_0x5a3c94[_0x9336('0xf')]+')');var _0x1b21ec=_0x5d2a8e?_0x5a3c94['priorityTrue']:_0x5a3c94[_0x9336('0x10')];logger[_0x9336('0x11')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1ec071,_0x5a3c94['condition'],_0x5d2a8e,_0x1b21ec||_0x9336('0x12'));if(_0x1b21ec){var _0x36a82f=_[_0x9336('0x13')](_0x4f1b5f[_0x9336('0x14')](),{'p':_0x1b21ec});if(_0x36a82f>=0x0){logger[_0x9336('0x11')](_0x9336('0x15'),_0x1ec071,_0x1b21ec||_0x9336('0x12'),_0x36a82f);_0x4f1b5f[_0x9336('0x12')](_0x36a82f);}else{logger[_0x9336('0x11')](_0x9336('0x16'),_0x1ec071,_0x1b21ec||_0x9336('0x12'));_0x4f1b5f[_0x9336('0x17')]();}}else{_0x4f1b5f[_0x9336('0x12')]();}}catch(_0x50710a){logger[_0x9336('0x18')](_0x9336('0x19'),_0x1ec071,_0x50710a[_0x9336('0xd')]);_0x4f1b5f['stop']();}}}catch(_0x232a75){logger[_0x9336('0x18')]('[%s][GOTOIF]\x20%s',_0x1ec071,JSON['stringify'](_0x232a75));_0x4f1b5f['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 664ca4e..167759f 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 _0x5ffe=['length','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0xfee336,_0x274265){var _0x3a916b=function(_0x5a0f78){while(--_0x5a0f78){_0xfee336['push'](_0xfee336['shift']());}};_0x3a916b(++_0x274265);}(_0x5ffe,0x1ee));var _0xe5ff=function(_0x219ee4,_0x230f7b){_0x219ee4=_0x219ee4-0x0;var _0x36ea3e=_0x5ffe[_0x219ee4];return _0x36ea3e;};'use strict';var schema=require(_0xe5ff('0x0'));var _=require(_0xe5ff('0x1'));var logger=require('../../../../config/logger')(_0xe5ff('0x2'));var gotop=schema({'priority':{'type':_0xe5ff('0x3'),'required':!![],'message':_0xe5ff('0x4')}});exports[_0xe5ff('0x5')]=function(_0x3f0959,_0x3cd61a){return function(_0x5b93b5){try{var _0x1918ef={'priority':_0x3cd61a[0x0]};var _0x17b1a6=gotop[_0xe5ff('0x0')](_0x1918ef,{'typecast':!![]});if(_0x17b1a6[_0xe5ff('0x6')]){logger['error']('[%s][GOTOP]\x20%s',_0x3f0959,_[_0xe5ff('0x7')](_0x17b1a6,_0xe5ff('0x8'))[_0xe5ff('0x9')](',\x20'));_0x5b93b5[_0xe5ff('0xa')]();}else{logger[_0xe5ff('0xb')](_0xe5ff('0xc'),_0x3f0959,_0x1918ef[_0xe5ff('0xd')]);if(_0x1918ef['priority']){var _0x13e4cb=_[_0xe5ff('0xe')](_0x5b93b5['rules'](),{'p':_0x1918ef[_0xe5ff('0xd')]});if(_0x13e4cb>=0x0){logger[_0xe5ff('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3f0959,_0x1918ef[_0xe5ff('0xd')]||_0xe5ff('0xf'),_0x13e4cb);_0x5b93b5[_0xe5ff('0xf')](_0x13e4cb);}else{logger[_0xe5ff('0xb')](_0xe5ff('0x10'),_0x3f0959,_0x1918ef['priority']||_0xe5ff('0xf'));_0x5b93b5[_0xe5ff('0xa')]();}}else{_0x5b93b5[_0xe5ff('0xf')]();}}}catch(_0x1a1186){logger[_0xe5ff('0x11')](_0xe5ff('0x12'),_0x3f0959,JSON[_0xe5ff('0x13')](_0x1a1186));_0x5b93b5[_0xe5ff('0xa')]();}};}; \ No newline at end of file +var _0xa1f8=['stringify','validate','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x3c01e5,_0x4891f3){var _0x4a86d6=function(_0x40a85b){while(--_0x40a85b){_0x3c01e5['push'](_0x3c01e5['shift']());}};_0x4a86d6(++_0x4891f3);}(_0xa1f8,0xef));var _0x8a1f=function(_0x5953ca,_0x595eb4){_0x5953ca=_0x5953ca-0x0;var _0x3b60f4=_0xa1f8[_0x5953ca];return _0x3b60f4;};'use strict';var schema=require(_0x8a1f('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0x8a1f('0x1'));var gotop=schema({'priority':{'type':_0x8a1f('0x2'),'required':!![],'message':_0x8a1f('0x3')}});exports[_0x8a1f('0x4')]=function(_0x39801c,_0x1ea81c){return function(_0x473a36){try{var _0x57f64e={'priority':_0x1ea81c[0x0]};var _0x20ed65=gotop[_0x8a1f('0x0')](_0x57f64e,{'typecast':!![]});if(_0x20ed65[_0x8a1f('0x5')]){logger[_0x8a1f('0x6')](_0x8a1f('0x7'),_0x39801c,_[_0x8a1f('0x8')](_0x20ed65,'message')['join'](',\x20'));_0x473a36[_0x8a1f('0x9')]();}else{logger[_0x8a1f('0xa')](_0x8a1f('0xb'),_0x39801c,_0x57f64e['priority']);if(_0x57f64e[_0x8a1f('0xc')]){var _0x44196f=_['findIndex'](_0x473a36['rules'](),{'p':_0x57f64e[_0x8a1f('0xc')]});if(_0x44196f>=0x0){logger[_0x8a1f('0xa')](_0x8a1f('0xd'),_0x39801c,_0x57f64e[_0x8a1f('0xc')]||_0x8a1f('0xe'),_0x44196f);_0x473a36[_0x8a1f('0xe')](_0x44196f);}else{logger[_0x8a1f('0xa')](_0x8a1f('0xf'),_0x39801c,_0x57f64e['priority']||_0x8a1f('0xe'));_0x473a36[_0x8a1f('0x9')]();}}else{_0x473a36[_0x8a1f('0xe')]();}}}catch(_0x5cc7c9){logger[_0x8a1f('0x6')](_0x8a1f('0x7'),_0x39801c,JSON[_0x8a1f('0x10')](_0x5cc7c9));_0x473a36['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 6fed415..f536583 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 _0xbfe3=['upperFirst','AccountId','channel','InteractionId','Message','create','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','getMustacheRender','contact','chat','ChatWebsiteId'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0xbfe3,0x12a));var _0x3bfe=function(_0x24602c,_0x3a63b7){_0x24602c=_0x24602c-0x0;var _0x35fdd2=_0xbfe3[_0x24602c];return _0x35fdd2;};'use strict';var _=require(_0x3bfe('0x0'));var utils=require(_0x3bfe('0x1'));var logger=require(_0x3bfe('0x2'))('routing');var rpc={'chatMessage':require(_0x3bfe('0x3')),'openchannelMessage':require(_0x3bfe('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3bfe('0x5'))};exports['consequence']=function(_0x52c130,_0x59b708){return function(_0x26ff48){try{var _0x44bda9={'body':utils[_0x3bfe('0x6')](_0x59b708[0x0],this),'ContactId':this[_0x3bfe('0x7')]['id']};if(this['channel']===_0x3bfe('0x8')){_0x44bda9[_0x3bfe('0x9')]=this['account']['id'];}else{_0x44bda9[_[_0x3bfe('0xa')](this['channel'])+_0x3bfe('0xb')]=this['account']['id'];}_0x44bda9[_[_0x3bfe('0xa')](this[_0x3bfe('0xc')])+_0x3bfe('0xd')]=this['interaction']['id'];if(rpc[this[_0x3bfe('0xc')]+_0x3bfe('0xe')]){return rpc[this[_0x3bfe('0xc')]+_0x3bfe('0xe')][_0x3bfe('0xf')](_0x44bda9)['then'](function(_0xb8e506){logger['info'](_0x3bfe('0x10'),_0x52c130,_0x44bda9['body']);_0x26ff48[_0x3bfe('0x11')]();})[_0x3bfe('0x12')](function(_0x1d1da8){logger[_0x3bfe('0x13')]('[%s][MESSAGE]\x20%s',_0x52c130,JSON[_0x3bfe('0x14')](_0x1d1da8));_0x26ff48[_0x3bfe('0x15')]();});}}catch(_0x556148){logger[_0x3bfe('0x13')](_0x3bfe('0x10'),_0x52c130,JSON['stringify'](_0x556148));_0x26ff48[_0x3bfe('0x15')]();}};}; \ No newline at end of file +var _0x3927=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','channel','ChatWebsiteId','upperFirst','account','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','../../../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3927,0x9e));var _0x7392=function(_0x1bf0e2,_0x109c74){_0x1bf0e2=_0x1bf0e2-0x0;var _0xa6169a=_0x3927[_0x1bf0e2];return _0xa6169a;};'use strict';var _=require(_0x7392('0x0'));var utils=require('./utils');var logger=require(_0x7392('0x1'))(_0x7392('0x2'));var rpc={'chatMessage':require(_0x7392('0x3')),'openchannelMessage':require(_0x7392('0x4')),'mailMessage':require(_0x7392('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7392('0x6'))};exports[_0x7392('0x7')]=function(_0x30700c,_0x5cfa6a){return function(_0x26ed48){try{var _0x4b0999={'body':utils[_0x7392('0x8')](_0x5cfa6a[0x0],this),'ContactId':this['contact']['id']};if(this[_0x7392('0x9')]==='chat'){_0x4b0999[_0x7392('0xa')]=this['account']['id'];}else{_0x4b0999[_[_0x7392('0xb')](this[_0x7392('0x9')])+'AccountId']=this[_0x7392('0xc')]['id'];}_0x4b0999[_[_0x7392('0xb')](this[_0x7392('0x9')])+'InteractionId']=this[_0x7392('0xd')]['id'];if(rpc[this[_0x7392('0x9')]+_0x7392('0xe')]){return rpc[this['channel']+_0x7392('0xe')]['create'](_0x4b0999)[_0x7392('0xf')](function(_0x5e2062){logger[_0x7392('0x10')](_0x7392('0x11'),_0x30700c,_0x4b0999[_0x7392('0x12')]);_0x26ed48['next']();})[_0x7392('0x13')](function(_0x2cb12f){logger[_0x7392('0x14')]('[%s][MESSAGE]\x20%s',_0x30700c,JSON['stringify'](_0x2cb12f));_0x26ed48['stop']();});}}catch(_0x571596){logger[_0x7392('0x14')](_0x7392('0x11'),_0x30700c,JSON[_0x7392('0x15')](_0x571596));_0x26ed48[_0x7392('0x16')]();}};}; \ 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 8eac465..dbd4ba4 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 _0x2a8a=['getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s'];(function(_0x2aa9fe,_0x13e908){var _0x408bf8=function(_0x3b7557){while(--_0x3b7557){_0x2aa9fe['push'](_0x2aa9fe['shift']());}};_0x408bf8(++_0x13e908);}(_0x2a8a,0xaf));var _0xa2a8=function(_0x4a34cf,_0x31f7da){_0x4a34cf=_0x4a34cf-0x0;var _0x49d026=_0x2a8a[_0x4a34cf];return _0x49d026;};'use strict';var utils=require(_0xa2a8('0x0'));var logger=require(_0xa2a8('0x1'))(_0xa2a8('0x2'));exports['consequence']=function(_0x80b086,_0x14927d){return function(_0x421800){try{logger[_0xa2a8('0x3')](_0xa2a8('0x4'),_0x80b086,utils[_0xa2a8('0x5')](_0x14927d[0x0],this));_0x421800[_0xa2a8('0x6')]();}catch(_0x4174dc){logger[_0xa2a8('0x7')](_0xa2a8('0x4'),_0x80b086,JSON[_0xa2a8('0x8')](_0x4174dc));_0x421800[_0xa2a8('0x9')]();}};}; \ No newline at end of file +var _0x521e=['stringify','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x590c4b,_0x2f5c84){var _0x250d64=function(_0x46e74f){while(--_0x46e74f){_0x590c4b['push'](_0x590c4b['shift']());}};_0x250d64(++_0x2f5c84);}(_0x521e,0x1a5));var _0xe521=function(_0x27f958,_0x3a7798){_0x27f958=_0x27f958-0x0;var _0x1e1afb=_0x521e[_0x27f958];return _0x1e1afb;};'use strict';var utils=require(_0xe521('0x0'));var logger=require(_0xe521('0x1'))(_0xe521('0x2'));exports[_0xe521('0x3')]=function(_0x285282,_0x56228a){return function(_0x171999){try{logger[_0xe521('0x4')](_0xe521('0x5'),_0x285282,utils[_0xe521('0x6')](_0x56228a[0x0],this));_0x171999[_0xe521('0x7')]();}catch(_0xa57b0a){logger[_0xe521('0x8')](_0xe521('0x5'),_0x285282,JSON[_0xe521('0x9')](_0xa57b0a));_0x171999['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 56a15cd..d07bd8d 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 _0x71cf=['../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','error','length','map','join','stop','find','Queues','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20ROUTING\x20STOPPED','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','util','moment','../../../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x71cf,0x127));var _0xf71c=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0x71cf[_0x1a3e23];return _0x5ee0d8;};'use strict';var schema=require(_0xf71c('0x0'));var _=require(_0xf71c('0x1'));var util=require(_0xf71c('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xf71c('0x3'));var Redis=require('ioredis');var config=require(_0xf71c('0x4'));var logger=require(_0xf71c('0x5'))(_0xf71c('0x6'));var strategy=require(_0xf71c('0x7'));config[_0xf71c('0x8')]=_[_0xf71c('0x9')](config['redis'],{'host':_0xf71c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf71c('0x8')]));var attributes=['id',_0xf71c('0xb'),_0xf71c('0xc'),_0xf71c('0xd'),_0xf71c('0xe'),'joinAt'];function emit(_0x59926b,_0x4aa31c,_0x55d346){io['to'](_0x59926b)[_0xf71c('0xf')](_0x4aa31c,_0x55d346);}function emitChannelQueueInteraction(_0x4eec65,_0x1230ba,_0x3a7ffb,_0x37fb3f,_0x570633,_0x5afb16,_0x47b61c,_0x16821d){_0x3a7ffb[_0xf71c('0xb')]=_0x16821d;_0x3a7ffb[_0xf71c('0xd')]=_0x1230ba;_0x3a7ffb[_0xf71c('0xc')]=_0x37fb3f;_0x3a7ffb['id']=_0x570633;if(_0x5afb16){_0x47b61c[util[_0xf71c('0x10')](_0xf71c('0x11'),_0x4eec65)][_0x570633]=_[_0xf71c('0x12')](_0x3a7ffb,attributes);}else{delete _0x47b61c[util['format'](_0xf71c('0x11'),_0x4eec65)][_0x570633];}emit(util[_0xf71c('0x10')](_0xf71c('0x13'),_0x4eec65,_0x1230ba),util[_0xf71c('0x10')](_0xf71c('0x14'),_0x4eec65,_0x5afb16?_0xf71c('0x15'):_0xf71c('0x16')),_['pick'](_0x3a7ffb,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf71c('0x17')),'chatQueueReport':require(_0xf71c('0x18')),'smsQueueReport':require(_0xf71c('0x19')),'faxQueueReport':require(_0xf71c('0x1a'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xf71c('0x1b')},'timeout':{'type':_0xf71c('0x1c'),'message':_0xf71c('0x1d')}});function startRouting(_0x22a10b,_0x22816d,_0x4d74d0,_0x4804be){if(_0x22a10b&&_0x22816d&&_0x4d74d0){_0x22816d['waiting']+=0x1;var _0x37965d={'uniqueid':_0x22a10b,'from':_0x4d74d0['body']?_0x4d74d0[_0xf71c('0x1e')][_0xf71c('0xe')]:'','joinAt':moment()['format'](_0xf71c('0x1f')),'ContactId':_0x4d74d0['contact']?_0x4d74d0[_0xf71c('0x20')]['id']:null,'ListId':_0x4d74d0['list']?_0x4d74d0[_0xf71c('0x21')]['id']:null};_0x37965d[_[_0xf71c('0x22')](_0x4d74d0[_0xf71c('0x23')])+_0xf71c('0x24')]=_0x22816d['id']||null;_0x37965d[_[_0xf71c('0x22')](_0x4d74d0['channel'])+_0xf71c('0x25')]=_0x4d74d0[_0xf71c('0x26')]?_0x4d74d0[_0xf71c('0x26')]['id']:null;_0x37965d[_[_0xf71c('0x22')](_0x4d74d0['channel'])+_0xf71c('0x27')]=_0x4d74d0[_0xf71c('0x28')]?_0x4d74d0[_0xf71c('0x28')]['id']:null;_0x37965d[_[_0xf71c('0x22')](_0x4d74d0[_0xf71c('0x23')])+(_0x4d74d0[_0xf71c('0x23')]!=='chat'?_0xf71c('0x29'):_0xf71c('0x2a'))]=_0x4d74d0['account']?_0x4d74d0['account']['id']:null;logger[_0xf71c('0x2b')](util[_0xf71c('0x10')](_0xf71c('0x2c'),_0x22a10b,_0x22816d['name']));emitChannelQueueInteraction(_0x4d74d0['channel'],_0x22816d['name'],_0x37965d,_0x4d74d0[_0xf71c('0xc')][_0xf71c('0x2d')],_0x4d74d0['message']['id'],!![],_0x4804be,_0x22816d['id']);if(rpc[_0x4d74d0[_0xf71c('0x23')]+'QueueReport']){return rpc[_0x4d74d0[_0xf71c('0x23')]+'QueueReport'][_0xf71c('0x2e')](_0x37965d)['catch'](function(_0x36443e){logger['error'](_0xf71c('0x2f'));});}}}function stopRouting(_0x28f7f6,_0x58736e,_0x31a0b0,_0x27a351){if(_0x28f7f6&&_0x58736e){_0x58736e[_0xf71c('0x30')]-=0x1;var _0x462740={'leaveAt':moment()[_0xf71c('0x10')](_0xf71c('0x1f')),'acceptAt':moment()[_0xf71c('0x10')](_0xf71c('0x1f')),'reason':_0xf71c('0x31')};logger[_0xf71c('0x2b')](util[_0xf71c('0x10')](_0xf71c('0x32'),_0x28f7f6,_0x58736e[_0xf71c('0x2d')]));emitChannelQueueInteraction(_0x31a0b0[_0xf71c('0x23')],_0x58736e['name'],_0x31a0b0[_0xf71c('0x1e')],_0x31a0b0['account'][_0xf71c('0x2d')],_0x31a0b0['message']['id'],![],_0x27a351,_0x58736e['id']);if(rpc[_0x31a0b0[_0xf71c('0x23')]+_0xf71c('0x33')]){return rpc[_0x31a0b0['channel']+_0xf71c('0x33')][_0xf71c('0x34')](_0x28f7f6,_0x462740)['catch'](function(_0x451400){logger['error'](_0xf71c('0x35'));});}}}function endRouting(_0x416658,_0x4e15fc,_0x76d115,_0x420f06){if(_0x416658&&_0x4e15fc){_0x4e15fc[_0xf71c('0x30')]-=0x1;var _0x22c996={'leaveAt':moment()['format'](_0xf71c('0x1f')),'exitAt':moment()[_0xf71c('0x10')](_0xf71c('0x1f')),'reason':_0xf71c('0x36')};logger[_0xf71c('0x2b')](util[_0xf71c('0x10')](_0xf71c('0x37'),_0x416658,_0x4e15fc[_0xf71c('0x2d')]));emitChannelQueueInteraction(_0x76d115[_0xf71c('0x23')],_0x4e15fc[_0xf71c('0x2d')],_0x76d115['body'],_0x76d115[_0xf71c('0xc')]['name'],_0x76d115[_0xf71c('0x28')]['id'],![],_0x420f06);if(rpc[_0x76d115['channel']+_0xf71c('0x33')]){return rpc[_0x76d115['channel']+_0xf71c('0x33')][_0xf71c('0x34')](_0x416658,_0x22c996)[_0xf71c('0x38')](function(_0x49ab7f){logger[_0xf71c('0x39')](_0xf71c('0x35'));});}}}function handleFindQueue(_0x924f67){return function(_0x4c902c){return _0x4c902c[_0xf71c('0x2d')]['toLowerCase']()===_0x924f67['toLowerCase']();};}exports['consequence']=function(_0x474b99,_0x2a82ce,_0x24cc68,_0xefabfc){return function(_0x2a0fcf){try{var _0x57c3da={'name':_0x2a82ce[0x0],'timeout':_0x2a82ce[0x1]};var _0x2b850d=queue['validate'](_0x57c3da,{'typecast':!![]});if(_0x2b850d[_0xf71c('0x3a')]){logger[_0xf71c('0x39')]('[%s][QUEUE]\x20%s',_0x474b99,_[_0xf71c('0x3b')](_0x2b850d,_0xf71c('0x28'))[_0xf71c('0x3c')](',\x20'));_0x2a0fcf[_0xf71c('0x3d')]();}else{var _0x89db52=_[_0xf71c('0x3e')](_0x24cc68[_0xefabfc['channel']+_0xf71c('0x3f')],handleFindQueue(_0x57c3da[_0xf71c('0x2d')]));if(_0x89db52){startRouting(_0x474b99,_0x89db52,_0xefabfc,_0x24cc68);var _0x1921e5=(_0x89db52[_0xf71c('0x36')]||0xa)*0x3e8;var _0x2ec8be=(_0x57c3da[_0xf71c('0x36')]||0x14)*0x3e8;var _0x568f84,_0xd97c9f;if(_0x1921e5>_0x2ec8be){_0x2ec8be=_0x1921e5;}var _0x1013b3=seqqueue['createQueue'](_0x1921e5);_0x1013b3['id']=_0x474b99;_0x1013b3[_0xf71c('0x40')]=_0x1921e5;_0x1013b3[_0xf71c('0x41')]=_0x2ec8be;_0x1013b3[_0xf71c('0x23')]=_0xefabfc[_0xf71c('0x23')];_0x24cc68[_0xf71c('0x42')][_0x474b99]['on'](_0xf71c('0x43'),function(){stopRouting(_0x474b99,_0x89db52,_0xefabfc,_0x24cc68);_0x1013b3[_0xf71c('0x44')](!![]);clearTimeout(_0x568f84);_0x568f84=undefined;if(_0x24cc68['rules'][_0x474b99]){delete _0x24cc68[_0xf71c('0x42')][_0x474b99];}logger[_0xf71c('0x2b')](_0xf71c('0x45'),_0x474b99);_0x2a0fcf['stop']();});_0x568f84=setTimeout(function(){endRouting(_0x474b99,_0x89db52,_0xefabfc,_0x24cc68);clearTimeout(_0x568f84);_0x1013b3[_0xf71c('0x44')](!![]);logger['info']('[%s][QUEUE]\x20ROUTING\x20END',_0x474b99);_0x2a0fcf[_0xf71c('0x46')]();},_0x2ec8be);switch(_0x89db52[_0xf71c('0x47')]){case _0xf71c('0x48'):strategy[_0xf71c('0x48')](_0x1013b3,_0x89db52,_0x24cc68,_0xefabfc);break;default:strategy['beepall'](_0x1013b3,_0x89db52,_0x24cc68,_0xefabfc);}}else{logger[_0xf71c('0x39')](_0xf71c('0x49'),_0x474b99,_0x57c3da['name']);_0x2a0fcf[_0xf71c('0x3d')]();}}}catch(_0x32d3a5){console['log'](_0x32d3a5);logger[_0xf71c('0x39')](_0xf71c('0x4a'),_0x474b99,_0x32d3a5['stack']);_0x2a0fcf[_0xf71c('0x3d')]();}};}; \ No newline at end of file +var _0x35e6=['consequence','length','[%s][QUEUE]\x20%s','join','stop','find','timeout','createQueue','atimeout','qtimeout','end','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20ROUTING\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','queue','joinAt','emit','format','%sQueuesWaitingInteractions','%s:queue:%s','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','toLowerCase'];(function(_0x37b8b1,_0x4e0b3b){var _0x500ba8=function(_0x4ea8b3){while(--_0x4ea8b3){_0x37b8b1['push'](_0x37b8b1['shift']());}};_0x500ba8(++_0x4e0b3b);}(_0x35e6,0x192));var _0x635e=function(_0x410ea5,_0x429d56){_0x410ea5=_0x410ea5-0x0;var _0x1d3573=_0x35e6[_0x410ea5];return _0x1d3573;};'use strict';var schema=require(_0x635e('0x0'));var _=require(_0x635e('0x1'));var util=require('util');var seqqueue=require(_0x635e('0x2'));var moment=require(_0x635e('0x3'));var Redis=require(_0x635e('0x4'));var config=require(_0x635e('0x5'));var logger=require(_0x635e('0x6'))(_0x635e('0x7'));var strategy=require('./strategy');config[_0x635e('0x8')]=_[_0x635e('0x9')](config[_0x635e('0x8')],{'host':_0x635e('0xa'),'port':0x18eb});var io=require(_0x635e('0xb'))(new Redis(config[_0x635e('0x8')]));var attributes=['id',_0x635e('0xc'),'account',_0x635e('0xd'),'from',_0x635e('0xe')];function emit(_0x100acc,_0xe6102,_0x2400ba){io['to'](_0x100acc)[_0x635e('0xf')](_0xe6102,_0x2400ba);}function emitChannelQueueInteraction(_0x47e31a,_0x4b4e77,_0x5e3500,_0x472155,_0xb6ea27,_0x356624,_0x250c71,_0x30b401){_0x5e3500[_0x635e('0xc')]=_0x30b401;_0x5e3500['queue']=_0x4b4e77;_0x5e3500['account']=_0x472155;_0x5e3500['id']=_0xb6ea27;if(_0x356624){_0x250c71[util[_0x635e('0x10')](_0x635e('0x11'),_0x47e31a)][_0xb6ea27]=_['pick'](_0x5e3500,attributes);}else{delete _0x250c71[util[_0x635e('0x10')](_0x635e('0x11'),_0x47e31a)][_0xb6ea27];}emit(util[_0x635e('0x10')](_0x635e('0x12'),_0x47e31a,_0x4b4e77),util[_0x635e('0x10')]('%s_queue_waiting_interaction:%s',_0x47e31a,_0x356624?'save':_0x635e('0x13')),_[_0x635e('0x14')](_0x5e3500,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x635e('0x15')),'chatQueueReport':require(_0x635e('0x16')),'smsQueueReport':require(_0x635e('0x17')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x635e('0x18')},'timeout':{'type':_0x635e('0x19'),'message':_0x635e('0x1a')}});function startRouting(_0x12da7a,_0xc34d0,_0x4caf4a,_0x131bc0){if(_0x12da7a&&_0xc34d0&&_0x4caf4a){_0xc34d0[_0x635e('0x1b')]+=0x1;var _0x38f68d={'uniqueid':_0x12da7a,'from':_0x4caf4a[_0x635e('0x1c')]?_0x4caf4a['body'][_0x635e('0x1d')]:'','joinAt':moment()[_0x635e('0x10')](_0x635e('0x1e')),'ContactId':_0x4caf4a[_0x635e('0x1f')]?_0x4caf4a[_0x635e('0x1f')]['id']:null,'ListId':_0x4caf4a[_0x635e('0x20')]?_0x4caf4a[_0x635e('0x20')]['id']:null};_0x38f68d[_[_0x635e('0x21')](_0x4caf4a[_0x635e('0x22')])+_0x635e('0x23')]=_0xc34d0['id']||null;_0x38f68d[_[_0x635e('0x21')](_0x4caf4a[_0x635e('0x22')])+'InteractionId']=_0x4caf4a[_0x635e('0x24')]?_0x4caf4a[_0x635e('0x24')]['id']:null;_0x38f68d[_[_0x635e('0x21')](_0x4caf4a[_0x635e('0x22')])+'MessageId']=_0x4caf4a[_0x635e('0x25')]?_0x4caf4a[_0x635e('0x25')]['id']:null;_0x38f68d[_[_0x635e('0x21')](_0x4caf4a[_0x635e('0x22')])+(_0x4caf4a[_0x635e('0x22')]!==_0x635e('0x26')?_0x635e('0x27'):_0x635e('0x28'))]=_0x4caf4a[_0x635e('0x29')]?_0x4caf4a[_0x635e('0x29')]['id']:null;logger[_0x635e('0x2a')](util[_0x635e('0x10')](_0x635e('0x2b'),_0x12da7a,_0xc34d0[_0x635e('0x2c')]));emitChannelQueueInteraction(_0x4caf4a['channel'],_0xc34d0[_0x635e('0x2c')],_0x38f68d,_0x4caf4a[_0x635e('0x29')][_0x635e('0x2c')],_0x4caf4a['message']['id'],!![],_0x131bc0,_0xc34d0['id']);if(rpc[_0x4caf4a[_0x635e('0x22')]+'QueueReport']){return rpc[_0x4caf4a[_0x635e('0x22')]+_0x635e('0x2d')][_0x635e('0x2e')](_0x38f68d)['catch'](function(_0x29eeb5){logger[_0x635e('0x2f')]('create\x20queue\x20report');});}}}function stopRouting(_0x562ec1,_0x272ac6,_0x1193be,_0x155aa3){if(_0x562ec1&&_0x272ac6){_0x272ac6[_0x635e('0x1b')]-=0x1;var _0x5dfd86={'leaveAt':moment()[_0x635e('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x635e('0x30')};logger[_0x635e('0x2a')](util[_0x635e('0x10')](_0x635e('0x31'),_0x562ec1,_0x272ac6[_0x635e('0x2c')]));emitChannelQueueInteraction(_0x1193be['channel'],_0x272ac6[_0x635e('0x2c')],_0x1193be[_0x635e('0x1c')],_0x1193be['account']['name'],_0x1193be[_0x635e('0x25')]['id'],![],_0x155aa3,_0x272ac6['id']);if(rpc[_0x1193be[_0x635e('0x22')]+_0x635e('0x2d')]){return rpc[_0x1193be[_0x635e('0x22')]+_0x635e('0x2d')][_0x635e('0x32')](_0x562ec1,_0x5dfd86)[_0x635e('0x33')](function(_0x114e90){logger[_0x635e('0x2f')](_0x635e('0x34'));});}}}function endRouting(_0x1ecf0b,_0x5f0000,_0x12bd77,_0x12654e){if(_0x1ecf0b&&_0x5f0000){_0x5f0000[_0x635e('0x1b')]-=0x1;var _0x103b6f={'leaveAt':moment()[_0x635e('0x10')](_0x635e('0x1e')),'exitAt':moment()[_0x635e('0x10')](_0x635e('0x1e')),'reason':'timeout'};logger[_0x635e('0x2a')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x1ecf0b,_0x5f0000[_0x635e('0x2c')]));emitChannelQueueInteraction(_0x12bd77[_0x635e('0x22')],_0x5f0000['name'],_0x12bd77['body'],_0x12bd77[_0x635e('0x29')][_0x635e('0x2c')],_0x12bd77[_0x635e('0x25')]['id'],![],_0x12654e);if(rpc[_0x12bd77['channel']+_0x635e('0x2d')]){return rpc[_0x12bd77[_0x635e('0x22')]+_0x635e('0x2d')][_0x635e('0x32')](_0x1ecf0b,_0x103b6f)[_0x635e('0x33')](function(_0x28765f){logger[_0x635e('0x2f')](_0x635e('0x34'));});}}}function handleFindQueue(_0x8a38b9){return function(_0x27eafa){return _0x27eafa[_0x635e('0x2c')][_0x635e('0x35')]()===_0x8a38b9[_0x635e('0x35')]();};}exports[_0x635e('0x36')]=function(_0x1aa1ca,_0xb1793f,_0x10cda0,_0x4f76d7){return function(_0x39e086){try{var _0xdc148e={'name':_0xb1793f[0x0],'timeout':_0xb1793f[0x1]};var _0x1153f2=queue[_0x635e('0x0')](_0xdc148e,{'typecast':!![]});if(_0x1153f2[_0x635e('0x37')]){logger[_0x635e('0x2f')](_0x635e('0x38'),_0x1aa1ca,_['map'](_0x1153f2,_0x635e('0x25'))[_0x635e('0x39')](',\x20'));_0x39e086[_0x635e('0x3a')]();}else{var _0x488b40=_[_0x635e('0x3b')](_0x10cda0[_0x4f76d7[_0x635e('0x22')]+'Queues'],handleFindQueue(_0xdc148e[_0x635e('0x2c')]));if(_0x488b40){startRouting(_0x1aa1ca,_0x488b40,_0x4f76d7,_0x10cda0);var _0x36e451=(_0x488b40[_0x635e('0x3c')]||0xa)*0x3e8;var _0x314b09=(_0xdc148e[_0x635e('0x3c')]||0x14)*0x3e8;var _0x2c7c50,_0x5d1df8;if(_0x36e451>_0x314b09){_0x314b09=_0x36e451;}var _0x5db4b0=seqqueue[_0x635e('0x3d')](_0x36e451);_0x5db4b0['id']=_0x1aa1ca;_0x5db4b0[_0x635e('0x3e')]=_0x36e451;_0x5db4b0[_0x635e('0x3f')]=_0x314b09;_0x5db4b0[_0x635e('0x22')]=_0x4f76d7[_0x635e('0x22')];_0x10cda0['rules'][_0x1aa1ca]['on'](_0x635e('0x40'),function(){stopRouting(_0x1aa1ca,_0x488b40,_0x4f76d7,_0x10cda0);_0x5db4b0['close'](!![]);clearTimeout(_0x2c7c50);_0x2c7c50=undefined;if(_0x10cda0[_0x635e('0x41')][_0x1aa1ca]){delete _0x10cda0['rules'][_0x1aa1ca];}logger[_0x635e('0x2a')](_0x635e('0x42'),_0x1aa1ca);_0x39e086[_0x635e('0x3a')]();});_0x2c7c50=setTimeout(function(){endRouting(_0x1aa1ca,_0x488b40,_0x4f76d7,_0x10cda0);clearTimeout(_0x2c7c50);_0x5db4b0[_0x635e('0x43')](!![]);logger['info'](_0x635e('0x44'),_0x1aa1ca);_0x39e086[_0x635e('0x45')]();},_0x314b09);switch(_0x488b40[_0x635e('0x46')]){case _0x635e('0x47'):strategy[_0x635e('0x47')](_0x5db4b0,_0x488b40,_0x10cda0,_0x4f76d7);break;default:strategy[_0x635e('0x48')](_0x5db4b0,_0x488b40,_0x10cda0,_0x4f76d7);}}else{logger[_0x635e('0x2f')](_0x635e('0x49'),_0x1aa1ca,_0xdc148e[_0x635e('0x2c')]);_0x39e086['stop']();}}}catch(_0x3611e0){console[_0x635e('0x4a')](_0x3611e0);logger[_0x635e('0x2f')](_0x635e('0x38'),_0x1aa1ca,_0x3611e0[_0x635e('0x4b')]);_0x39e086['stop']();}};}; \ 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 28299c8..3a4a2a5 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 _0x0913=['hideNotification','TIMEOUT','exports','lodash','uuid','./util','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','forcedOwnership','isAgentAvailable','agents','channel','busy','showNotification','routing','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x0913,0x10b));var _0x3091=function(_0x253ee3,_0x12aeaa){_0x253ee3=_0x253ee3-0x0;var _0x4faebe=_0x0913[_0x253ee3];return _0x4faebe;};'use strict';var _=require(_0x3091('0x0'));var uuid=require(_0x3091('0x1'));var util=require(_0x3091('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x8cdf38,_0x33a75b,_0x3730df,_0x5c68e8){this[_0x3091('0x3')]=uuid['v4']();this[_0x3091('0x4')]=_0x8cdf38;this['agent']=_0x33a75b;this[_0x3091('0x5')]=_0x3730df;this['routing']=_0x5c68e8;this['squeue'][_0x3091('0x6')](this[_0x3091('0x7')][_0x3091('0x8')](this),this[_0x3091('0x9')][_0x3091('0x8')](this));this['squeue']['on'](_0x3091('0xa'),this[_0x3091('0x9')]['bind'](this));this[_0x3091('0x4')]['on'](_0x3091('0xb'),this[_0x3091('0xc')][_0x3091('0x8')](this));};Agent[_0x3091('0xd')][_0x3091('0x6')]=function(){this[_0x3091('0x4')][_0x3091('0x6')](this['handleRun'][_0x3091('0x8')](this),this['handleTimeout'][_0x3091('0x8')](this));};Agent[_0x3091('0xd')][_0x3091('0xc')]=function(){this[_0x3091('0x9')](!![]);};Agent[_0x3091('0xd')][_0x3091('0x7')]=function(_0x12ae71){logger[_0x3091('0xe')](_0x3091('0xf'),this[_0x3091('0x4')]['id'],this[_0x3091('0x10')]['id']);if(_[_0x3091('0x11')](this[_0x3091('0x5')]['agents'][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x3091('0x10')]['id']);setTimeout(this[_0x3091('0x6')][_0x3091('0x8')](this),0x3e8);}else{if(this['routing'][_0x3091('0x12')]||util[_0x3091('0x13')](this[_0x3091('0x4')]['id'],this[_0x3091('0x5')][_0x3091('0x14')][this['agent']['id']],this[_0x3091('0x4')][_0x3091('0x15')],![])){this['realtime']['agents'][this[_0x3091('0x10')]['id']][_0x3091('0x16')]=!![];this[_0x3091('0x5')][_0x3091('0x14')][this[_0x3091('0x10')]['id']]['busyQueue']=undefined;util[_0x3091('0x17')](this[_0x3091('0x3')],this[_0x3091('0x4')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x3091('0x18')]);util[_0x3091('0x19')](this[_0x3091('0x4')]['id'],this[_0x3091('0x5')][_0x3091('0x14')][this[_0x3091('0x10')]['id']],_0x3091('0x1a')+(this['routing'][_0x3091('0x12')]?_0x3091('0x1b'):''));}else{logger['info'](_0x3091('0x1c'),this[_0x3091('0x4')]['id'],this[_0x3091('0x10')]['id']);setTimeout(this[_0x3091('0x6')][_0x3091('0x8')](this),0x3e8);}}};Agent[_0x3091('0xd')][_0x3091('0x9')]=function(_0x22462f){if(_[_0x3091('0x11')](this[_0x3091('0x5')][_0x3091('0x14')][this[_0x3091('0x10')]['id']])){return logger[_0x3091('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x3091('0x10')]['id']);}else{logger[_0x3091('0xe')](_0x3091('0x1d'),this[_0x3091('0x4')]['id'],this[_0x3091('0x10')]['id']);util[_0x3091('0x1e')](this[_0x3091('0x3')],this[_0x3091('0x4')]['id'],this[_0x3091('0x5')][_0x3091('0x14')][this[_0x3091('0x10')]['id']],null,this['routing']);this[_0x3091('0x5')]['agents'][this['agent']['id']][_0x3091('0x16')]=![];this['realtime'][_0x3091('0x14')][this[_0x3091('0x10')]['id']]['busyQueue']=undefined;util[_0x3091('0x19')](this['squeue']['id'],this[_0x3091('0x5')][_0x3091('0x14')][this['agent']['id']],_0x22462f?'STOP':_0x3091('0x1f'));}if(!_0x22462f){setTimeout(this[_0x3091('0x6')][_0x3091('0x8')](this),0x3e8);}};function agent(_0x2a529f,_0x4a4d00,_0x254d8a,_0x56a716){return new Agent(_0x2a529f,_0x4a4d00,_0x254d8a,_0x56a716);}module[_0x3091('0x20')]=agent; \ No newline at end of file +var _0x2085=['STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','realtime','push','handleRun','bind','squeue','timeout','handleTimeout','drained','prototype','handleDrained','info','isNil','agents','agent','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification'];(function(_0x435a2e,_0x2239a3){var _0x3d163f=function(_0x377bee){while(--_0x377bee){_0x435a2e['push'](_0x435a2e['shift']());}};_0x3d163f(++_0x2239a3);}(_0x2085,0x13e));var _0x5208=function(_0x30ad27,_0x750e0f){_0x30ad27=_0x30ad27-0x0;var _0x42242a=_0x2085[_0x30ad27];return _0x42242a;};'use strict';var _=require(_0x5208('0x0'));var uuid=require(_0x5208('0x1'));var util=require(_0x5208('0x2'));var logger=require(_0x5208('0x3'))(_0x5208('0x4'));var Agent=function(_0x29a5a6,_0x300e96,_0x359b3f,_0x31253e){this[_0x5208('0x5')]=uuid['v4']();this['squeue']=_0x29a5a6;this['agent']=_0x300e96;this[_0x5208('0x6')]=_0x359b3f;this['routing']=_0x31253e;this['squeue'][_0x5208('0x7')](this[_0x5208('0x8')][_0x5208('0x9')](this),this['handleTimeout'][_0x5208('0x9')](this));this[_0x5208('0xa')]['on'](_0x5208('0xb'),this[_0x5208('0xc')][_0x5208('0x9')](this));this[_0x5208('0xa')]['on'](_0x5208('0xd'),this['handleDrained']['bind'](this));};Agent[_0x5208('0xe')][_0x5208('0x7')]=function(){this[_0x5208('0xa')][_0x5208('0x7')](this['handleRun'][_0x5208('0x9')](this),this['handleTimeout'][_0x5208('0x9')](this));};Agent[_0x5208('0xe')][_0x5208('0xf')]=function(){this[_0x5208('0xc')](!![]);};Agent['prototype'][_0x5208('0x8')]=function(_0x19e00f){logger[_0x5208('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_[_0x5208('0x11')](this[_0x5208('0x6')][_0x5208('0x12')][this[_0x5208('0x13')]['id']])){logger[_0x5208('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x5208('0xa')]['id'],this['agent']['id']);setTimeout(this[_0x5208('0x7')]['bind'](this),0x3e8);}else{if(this[_0x5208('0x4')][_0x5208('0x14')]||util[_0x5208('0x15')](this[_0x5208('0xa')]['id'],this[_0x5208('0x6')][_0x5208('0x12')][this[_0x5208('0x13')]['id']],this['squeue']['channel'],![])){this['realtime']['agents'][this[_0x5208('0x13')]['id']][_0x5208('0x16')]=!![];this['realtime'][_0x5208('0x12')][this[_0x5208('0x13')]['id']][_0x5208('0x17')]=undefined;util[_0x5208('0x18')](this[_0x5208('0x5')],this[_0x5208('0xa')]['id'],this[_0x5208('0x6')][_0x5208('0x12')][this[_0x5208('0x13')]['id']],null,this[_0x5208('0x4')]);util[_0x5208('0x19')](this['squeue']['id'],this['realtime']['agents'][this['agent']['id']],_0x5208('0x1a')+(this[_0x5208('0x4')][_0x5208('0x14')]?_0x5208('0x1b'):''));}else{logger[_0x5208('0x10')](_0x5208('0x1c'),this[_0x5208('0xa')]['id'],this[_0x5208('0x13')]['id']);setTimeout(this[_0x5208('0x7')][_0x5208('0x9')](this),0x3e8);}}};Agent[_0x5208('0xe')][_0x5208('0xc')]=function(_0x20105f){if(_[_0x5208('0x11')](this[_0x5208('0x6')][_0x5208('0x12')][this[_0x5208('0x13')]['id']])){return logger['info'](_0x5208('0x1d'),this[_0x5208('0xa')]['id'],this[_0x5208('0x13')]['id']);}else{logger[_0x5208('0x10')](_0x5208('0x1e'),this['squeue']['id'],this[_0x5208('0x13')]['id']);util[_0x5208('0x1f')](this[_0x5208('0x5')],this['squeue']['id'],this[_0x5208('0x6')][_0x5208('0x12')][this['agent']['id']],null,this['routing']);this[_0x5208('0x6')][_0x5208('0x12')][this[_0x5208('0x13')]['id']]['busy']=![];this[_0x5208('0x6')][_0x5208('0x12')][this['agent']['id']][_0x5208('0x17')]=undefined;util[_0x5208('0x19')](this[_0x5208('0xa')]['id'],this[_0x5208('0x6')]['agents'][this[_0x5208('0x13')]['id']],_0x20105f?_0x5208('0x20'):_0x5208('0x21'));}if(!_0x20105f){setTimeout(this[_0x5208('0x7')][_0x5208('0x9')](this),0x3e8);}};function agent(_0x43f1d3,_0xac2987,_0x53ec2b,_0x33ce72){return new Agent(_0x43f1d3,_0xac2987,_0x53ec2b,_0x33ce72);}module[_0x5208('0x22')]=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 19ed52a..7244b3f 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 _0xce9e=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','timeout','handleTimeout','drained','prototype','queue','isNil','Agents','length','agents','info'];(function(_0x15f317,_0x29845e){var _0x1210da=function(_0xb08a6b){while(--_0xb08a6b){_0x15f317['push'](_0x15f317['shift']());}};_0x1210da(++_0x29845e);}(_0xce9e,0xcc));var _0xece9=function(_0x563d77,_0x305794){_0x563d77=_0x563d77-0x0;var _0x24cfdf=_0xce9e[_0x563d77];return _0x24cfdf;};'use strict';var _=require(_0xece9('0x0'));var uuid=require(_0xece9('0x1'));var util=require('./util');var logger=require(_0xece9('0x2'))(_0xece9('0x3'));var Beepall=function(_0x4c0368,_0x17e2fa,_0x29960f,_0x5132a9){this[_0xece9('0x4')]=uuid['v4']();this[_0xece9('0x5')]=_0x4c0368;this['queue']=_0x17e2fa;this[_0xece9('0x6')]=_0x29960f;this['routing']=_0x5132a9;this[_0xece9('0x5')][_0xece9('0x7')](this[_0xece9('0x8')][_0xece9('0x9')](this),this['handleTimeout'][_0xece9('0x9')](this));this[_0xece9('0x5')]['on'](_0xece9('0xa'),this[_0xece9('0xb')][_0xece9('0x9')](this));this[_0xece9('0x5')]['on'](_0xece9('0xc'),this['handleDrained']['bind'](this));};Beepall['prototype']['push']=function(){this[_0xece9('0x5')][_0xece9('0x7')](this[_0xece9('0x8')][_0xece9('0x9')](this),this[_0xece9('0xb')]['bind'](this));};Beepall['prototype']['handleDrained']=function(_0x40a808){this[_0xece9('0xb')](!![]);};Beepall[_0xece9('0xd')][_0xece9('0x8')]=function(_0x22b37f){var _0x1cc982=!![];if(!_['isNil'](this[_0xece9('0xe')])&&!_[_0xece9('0xf')](this['queue'][_0xece9('0x10')])&&this[_0xece9('0xe')][_0xece9('0x10')][_0xece9('0x11')]>0x0){for(var _0x3b1a54=0x0,_0x17d336;_0x3b1a540x0){for(var _0x5cb9d0=0x0,_0x5918a6;_0x5cb9d00x0&&_0x484cce[_0x92e015+'CurrentCapacity']>=_0x484cce[_0x92e015+_0xcc2f('0x24')]){writeLog(_0x2bfcf4,_0x484cce,_0x92e015[_0xcc2f('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xcc2f('0x27')]=function(_0x5ccf78,_0x2e1f87,_0x37ae19,_0x11cac7,_0x3b3cc2){return sendNotification(!![],_0x5ccf78,_0x2e1f87,_0x37ae19,_0x11cac7,_0x3b3cc2);};exports[_0xcc2f('0x28')]=function(_0x14fa5e,_0x50ffcb,_0xd6588a,_0x16fcf8,_0x3e70b2){return sendNotification(![],_0x14fa5e,_0x50ffcb,_0xd6588a,_0x16fcf8,_0x3e70b2);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x0dd2=['\x20interaction','account','notificationSound','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','name','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','user:save','split'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x0dd2,0xa8));var _0x20dd=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x0dd2[_0x1f7201];return _0x289fd2;};'use strict';var _=require(_0x20dd('0x0'));var util=require(_0x20dd('0x1'));var utils=require('../utils');var Mustache=require(_0x20dd('0x2'));var Redis=require(_0x20dd('0x3'));var config=require(_0x20dd('0x4'));var logger=require(_0x20dd('0x5'))(_0x20dd('0x6'));config[_0x20dd('0x7')]=_[_0x20dd('0x8')](config['redis'],{'host':_0x20dd('0x9'),'port':0x18eb});var io=require(_0x20dd('0xa'))(new Redis(config[_0x20dd('0x7')]));function emit(_0x5efab9,_0x4a8133,_0x379db8){io['to'](_0x5efab9)[_0x20dd('0xb')](_0x4a8133,_0x379db8);}function sendNotification(_0x4fa21d,_0x1e4206,_0x1bd14c,_0x3495dd,_0x2522a5,_0x1a4376){io['to'](util[_0x20dd('0xc')](_0x20dd('0xd'),_0x3495dd['name']))[_0x20dd('0xb')](_0x20dd('0xe'),_0x3495dd);var _0x188091=_0x1a4376||{};var _0x3bb44f=_0x1bd14c[_0x20dd('0xf')]('.');var _0x2de4f4={'uniqueid':_0x1e4206,'channel':_0x3bb44f[0x0],'id':_0x3bb44f[0x1],'title':_0x3bb44f[0x0]+_0x20dd('0x10'),'interactionId':_0x3bb44f[0x2],'queue':_0x2522a5?_0x2522a5['name']:null,'sound':_0x188091[_0x20dd('0x11')][_0x20dd('0x12')],'shake':_0x188091[_0x20dd('0x11')]['notificationShake']};try{if(!_0x188091[_0x20dd('0x13')]){_0x188091[_0x20dd('0x13')]={};}if(_0x2522a5){_0x188091[_0x20dd('0x13')][_0x20dd('0x14')]=_0x2522a5;}else if(_0x188091['body']['queue']){delete _0x188091['body'][_0x20dd('0x14')];}_0x2de4f4[_0x20dd('0x15')]=utils['getMustacheRender'](_0x188091[_0x20dd('0x11')][_0x20dd('0x16')],_0x188091);}catch(_0x1e7c20){_0x2de4f4['msg']=_0x20dd('0x17');logger[_0x20dd('0x18')](util[_0x20dd('0xc')](_0x20dd('0x19'),_0x1e4206,_0x1e7c20[_0x20dd('0x1a')]));}io['to'](util[_0x20dd('0xc')]('user:%s',_0x3495dd[_0x20dd('0x1b')]))[_0x20dd('0xb')](util[_0x20dd('0xc')](_0x20dd('0x1c'),_0x4fa21d?_0x20dd('0x1d'):_0x20dd('0x1e')),_0x2de4f4);}function writeLog(_0x25d38e,_0x455f6c,_0x134406){return logger['info'](util[_0x20dd('0xc')](_0x20dd('0x1f'),_0x25d38e,_0x455f6c['name'],_0x134406));}exports[_0x20dd('0x20')]=function(_0x10a3bc,_0x288177,_0x20d7f2,_0xc9a927){if(_0x288177[_0x20dd('0x21')]){writeLog(_0x10a3bc,_0x288177,_0x20dd('0x22'));return![];}if(!_0x288177[_0x20dd('0x23')]){writeLog(_0x10a3bc,_0x288177,_0x20dd('0x24'));return![];}if(_0x288177[_0x20d7f2+_0x20dd('0x25')]){writeLog(_0x10a3bc,_0x288177,_0x20dd('0x26'));return![];}if(_0xc9a927&&_0x288177['hasOwnProperty'](_0x20d7f2+_0x20dd('0x27'))&&_0x288177[_0x20dd('0x28')](_0x20d7f2+_0x20dd('0x29'))){if(_0x288177[_0x20d7f2+_0x20dd('0x27')]>0x0&&_0x288177[_0x20d7f2+_0x20dd('0x29')]>=_0x288177[_0x20d7f2+'Capacity']){writeLog(_0x10a3bc,_0x288177,_0x20d7f2[_0x20dd('0x2a')]()+_0x20dd('0x2b'));return![];}}return!![];};exports['showNotification']=function(_0x560017,_0x151ad2,_0x357096,_0x2f61e3,_0x4718b8){return sendNotification(!![],_0x560017,_0x151ad2,_0x357096,_0x2f61e3,_0x4718b8);};exports[_0x20dd('0x2c')]=function(_0x26ae92,_0x141467,_0x5efc8d,_0x139571,_0x2b64a2){return sendNotification(![],_0x26ae92,_0x141467,_0x5efc8d,_0x139571,_0x2b64a2);};exports[_0x20dd('0x2d')]=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 20286ef..fafe2de 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 _0x6771=['isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x2684e0,_0x1135c4){var _0x73efa8=function(_0x2e2576){while(--_0x2e2576){_0x2684e0['push'](_0x2684e0['shift']());}};_0x73efa8(++_0x1135c4);}(_0x6771,0xc4));var _0x1677=function(_0x3f93e7,_0x39dabb){_0x3f93e7=_0x3f93e7-0x0;var _0x1dec48=_0x6771[_0x3f93e7];return _0x1dec48;};'use strict';var schema=require('validate');var sh=require(_0x1677('0x0'));var _=require(_0x1677('0x1'));var utils=require(_0x1677('0x2'));var logger=require(_0x1677('0x3'))(_0x1677('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x1677('0x5')}});exports[_0x1677('0x6')]=function(_0x2a811e,_0x18a479){return function(_0x593373){try{var _0xb801c1={'command':_0x18a479[0x0]};var _0x409d60=system[_0x1677('0x7')](_0xb801c1,{'typecast':!![]});if(_0x409d60[_0x1677('0x8')]){logger[_0x1677('0x9')](_0x1677('0xa'),_0x2a811e,_['map'](_0x409d60,_0x1677('0xb'))['join'](',\x20'));logger[_0x1677('0xc')](_0x1677('0xd'),_0x2a811e);_0x593373[_0x1677('0xe')]();}else{var _0x3063aa=this;var _0x4b0022=utils[_0x1677('0xf')](_0x18a479[0x0],this);logger[_0x1677('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2a811e,_0x4b0022);sh[_0x1677('0x10')](_[_0x1677('0x11')](_0x4b0022),function(_0xf1cf17,_0x321cf3){logger[_0x1677('0xc')](_0x1677('0x12'),_0x2a811e,_0xf1cf17);if(_0xf1cf17==0x0){var _0x554036=_0x321cf3[_0x1677('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x1677('0x14')](_0x18a479[0x1])||_[_0x1677('0x15')](_0x18a479[0x1])){logger['info'](_0x1677('0x16'),_0x2a811e);_0x3063aa[_0x1677('0x17')][_0x18a479[0x1]]=_0x554036;}else{logger[_0x1677('0xc')](_0x1677('0x18'),_0x2a811e,_0x18a479[0x1],_0x554036);_0x3063aa[_0x1677('0x17')][_0x18a479[0x1]]=_0x554036;}}_0x593373[_0x1677('0xe')]();});}}catch(_0x5aa889){logger[_0x1677('0x9')](_0x1677('0xa'),_0x2a811e,_[_0x1677('0x19')](_0x5aa889)?JSON[_0x1677('0x1a')](_0x5aa889):_0x5aa889);logger[_0x1677('0xc')](_0x1677('0xd'),_0x2a811e);_0x593373[_0x1677('0xe')]();}};}; \ No newline at end of file +var _0xd038=['error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xd038,0xa5));var _0x8d03=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0xd038[_0x3598bb];return _0x13c837;};'use strict';var schema=require(_0x8d03('0x0'));var sh=require(_0x8d03('0x1'));var _=require(_0x8d03('0x2'));var utils=require(_0x8d03('0x3'));var logger=require(_0x8d03('0x4'))(_0x8d03('0x5'));var system=schema({'command':{'type':_0x8d03('0x6'),'required':!![],'message':_0x8d03('0x7')}});exports[_0x8d03('0x8')]=function(_0x3a10bf,_0x3ba87e){return function(_0xfb2907){try{var _0x3e4cee={'command':_0x3ba87e[0x0]};var _0x2252b8=system[_0x8d03('0x0')](_0x3e4cee,{'typecast':!![]});if(_0x2252b8[_0x8d03('0x9')]){logger[_0x8d03('0xa')](_0x8d03('0xb'),_0x3a10bf,_[_0x8d03('0xc')](_0x2252b8,'message')[_0x8d03('0xd')](',\x20'));logger[_0x8d03('0xe')](_0x8d03('0xf'),_0x3a10bf);_0xfb2907[_0x8d03('0x10')]();}else{var _0x183a1d=this;var _0x20e9c7=utils['getMustacheRender'](_0x3ba87e[0x0],this);logger[_0x8d03('0xe')](_0x8d03('0x11'),_0x3a10bf,_0x20e9c7);sh[_0x8d03('0x12')](_['trim'](_0x20e9c7),function(_0x1910d5,_0x16169a){logger[_0x8d03('0xe')](_0x8d03('0x13'),_0x3a10bf,_0x1910d5);if(_0x1910d5==0x0){var _0x24fc05=_0x16169a['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3ba87e[0x1])||_[_0x8d03('0x14')](_0x3ba87e[0x1])){logger[_0x8d03('0xe')](_0x8d03('0x15'),_0x3a10bf);_0x183a1d[_0x8d03('0x16')][_0x3ba87e[0x1]]=_0x24fc05;}else{logger['info'](_0x8d03('0x17'),_0x3a10bf,_0x3ba87e[0x1],_0x24fc05);_0x183a1d[_0x8d03('0x16')][_0x3ba87e[0x1]]=_0x24fc05;}}_0xfb2907['next']();});}}catch(_0x5a17eb){logger[_0x8d03('0xa')](_0x8d03('0xb'),_0x3a10bf,_['isObject'](_0x5a17eb)?JSON[_0x8d03('0x18')](_0x5a17eb):_0x5a17eb);logger[_0x8d03('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3a10bf);_0xfb2907[_0x8d03('0x10')]();}};}; \ 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 38888c2..3d6285e 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(_0x16e19d,_0xfc4f46){var _0x227832=function(_0x31d0c9){while(--_0x31d0c9){_0x16e19d['push'](_0x16e19d['shift']());}};_0x227832(++_0xfc4f46);}(_0x7a54,0x106));var _0x47a5=function(_0x1c4281,_0x1ac10e){_0x1c4281=_0x1c4281-0x0;var _0x54314f=_0x7a54[_0x1c4281];return _0x54314f;};'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(_0xdbd7be,_0x56328d){var _0x476eee=function(_0x2e50b7){while(--_0x2e50b7){_0xdbd7be['push'](_0xdbd7be['shift']());}};_0x476eee(++_0x56328d);}(_0x7a54,0x106));var _0x47a5=function(_0x501ccd,_0x2cba14){_0x501ccd=_0x501ccd-0x0;var _0xf958bb=_0x7a54[_0x501ccd];return _0xf958bb;};'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 f8aba2b..9cd40ac 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 _0x87df=['lodash','exports','render','merge','body','contact','message','list','mustache'];(function(_0x746906,_0x350b60){var _0x107e62=function(_0x4e241c){while(--_0x4e241c){_0x746906['push'](_0x746906['shift']());}};_0x107e62(++_0x350b60);}(_0x87df,0x167));var _0xf87d=function(_0x57494e,_0x2c4d3d){_0x57494e=_0x57494e-0x0;var _0x4099da=_0x87df[_0x57494e];return _0x4099da;};'use strict';var Mustache=require(_0xf87d('0x0'));var _=require(_0xf87d('0x1'));module[_0xf87d('0x2')]={'getMustacheRender':function(_0x3151d0,_0x100a05){return Mustache[_0xf87d('0x3')](_0x3151d0,_[_0xf87d('0x4')](_0x100a05[_0xf87d('0x5')],{'contact':_0x100a05[_0xf87d('0x6')],'message':_0x100a05[_0xf87d('0x7')],'account':_0x100a05['account'],'interaction':_0x100a05['interaction'],'list':_0x100a05[_0xf87d('0x8')]}))||'';}}; \ No newline at end of file +var _0x579c=['interaction','list','mustache','lodash','exports','merge','contact','message','account'];(function(_0x39d11e,_0x35eb8a){var _0x586977=function(_0x450d77){while(--_0x450d77){_0x39d11e['push'](_0x39d11e['shift']());}};_0x586977(++_0x35eb8a);}(_0x579c,0xda));var _0xc579=function(_0x443617,_0x513d23){_0x443617=_0x443617-0x0;var _0x30b04b=_0x579c[_0x443617];return _0x30b04b;};'use strict';var Mustache=require(_0xc579('0x0'));var _=require(_0xc579('0x1'));module[_0xc579('0x2')]={'getMustacheRender':function(_0x1db849,_0x397136){return Mustache['render'](_0x1db849,_[_0xc579('0x3')](_0x397136['body'],{'contact':_0x397136[_0xc579('0x4')],'message':_0x397136[_0xc579('0x5')],'account':_0x397136[_0xc579('0x6')],'interaction':_0x397136[_0xc579('0x7')],'list':_0x397136[_0xc579('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 5d5ace7..fb6267c 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 _0x9016=['mailQueues','openchannelQueues','waiting','smsQueues','faxQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','existsSync','join','app','.js','toLowerCase','autoreply','split','push','slice','length','dialogflow','appdata','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','consequence','priority','info','Push\x20new\x20rule','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','end','No\x20applications\x20to\x20execute','stack','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues','available','loggedIn','name','paused'];(function(_0x3d4a15,_0x43acfa){var _0x40ba2b=function(_0x29c40d){while(--_0x29c40d){_0x3d4a15['push'](_0x3d4a15['shift']());}};_0x40ba2b(++_0x43acfa);}(_0x9016,0x6b));var _0x6901=function(_0x570dc3,_0x5eadf9){_0x570dc3=_0x570dc3-0x0;var _0x4cabfd=_0x9016[_0x570dc3];return _0x4cabfd;};'use strict';var _=require(_0x6901('0x0'));var util=require('util');var path=require(_0x6901('0x1'));var fs=require('fs');var jayson=require(_0x6901('0x2'));var BPromise=require(_0x6901('0x3'));var uuid=require(_0x6901('0x4'));var config=require(_0x6901('0x5'));var logger=require('../../../config/logger')(_0x6901('0x6'));var rpc={'openchannelQueueReport':require(_0x6901('0x7'))};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x6901('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x3ae378,_0x4c5f0b,_0x1dc2b9){return util['format'](_0x6901('0x9'),_0x3ae378,_0x4c5f0b||0x0,_0x1dc2b9||0x0);}function getIntervals(_0x154280,_0x687511){var _0x40a408=[];if(!_[_0x6901('0xa')](_0x687511[_0x6901('0xb')])&&!_[_0x6901('0xa')](_0x154280[_0x687511[_0x6901('0xb')]])&&!_[_0x6901('0xa')](_0x154280[_0x687511['IntervalId']][_0x6901('0xc')])){_0x40a408=_[_0x6901('0xd')](_0x154280[_0x687511['IntervalId']]['Intervals'],_0x6901('0xe'));}else if(!_[_0x6901('0xa')](_0x687511[_0x6901('0xe')])){_0x40a408=[_0x687511['interval']];}return _0x40a408;}exports['listen']=function(_0x277d15){_0x277d15[_0x6901('0xf')]={};return new BPromise(function(_0x232860,_0x29f6fe){var _0x19fae2={'Start':function(_0x205237){var _0x31afaa=this;return new Promise(function(_0x57a46c,_0xde853c){if(_0x205237){try{var _0x13f16c=[];var _0x24ca90=getId(_0x205237[_0x6901('0x10')],_0x205237[_0x6901('0x11')]?_0x205237[_0x6901('0x11')]['id']:0x0,_0x205237['interaction']?_0x205237[_0x6901('0x12')]['id']:0x0);if(_0x205237['applications']&&_['isArray'](_0x205237[_0x6901('0x13')])&&_0x205237[_0x6901('0x13')]['length']){for(var _0xdf8e13=0x0;_0xdf8e13<_0x205237['applications']['length'];_0xdf8e13+=0x1){var _0x5aa2ce=_0x205237[_0x6901('0x13')][_0xdf8e13];if(fs[_0x6901('0x14')](path[_0x6901('0x15')](__dirname,_0x6901('0x13'),_0x5aa2ce[_0x6901('0x16')]+_0x6901('0x17')))){var _0x18c911=[];switch(_0x5aa2ce[_0x6901('0x16')][_0x6901('0x18')]()){case _0x6901('0x19'):var _0x379ea5=_0x5aa2ce['appdata'][_0x6901('0x1a')](',');_0x18c911[_0x6901('0x1b')](_0x379ea5[0x0]);_0x18c911['push'](_0x379ea5[_0x6901('0x1c')](0x1,_0x379ea5[_0x6901('0x1d')])[_0x6901('0x15')](','));break;case _0x6901('0x1e'):var _0x379ea5=_0x5aa2ce[_0x6901('0x1f')][_0x6901('0x1a')](',');_0x18c911[_0x6901('0x1b')](_0x379ea5[0x0]);_0x18c911['push'](_0x379ea5[0x1]);_0x18c911['push'](_0x379ea5[_0x6901('0x1c')](0x2,_0x379ea5[_0x6901('0x1d')])[_0x6901('0x15')](','));break;case _0x6901('0x20'):var _0x379ea5=_0x5aa2ce[_0x6901('0x1f')][_0x6901('0x1a')](',');_0x18c911[_0x6901('0x1b')](_0x379ea5[0x0]);_0x18c911[_0x6901('0x1b')](_0x379ea5[0x1]);_0x18c911[_0x6901('0x1b')](_0x379ea5[0x2]);_0x18c911[_0x6901('0x1b')](_0x379ea5[0x3]);_0x18c911[_0x6901('0x1b')](_0x379ea5[_0x6901('0x1c')](0x4,_0x379ea5[_0x6901('0x1d')])[_0x6901('0x15')](','));break;case _0x6901('0x11'):_0x18c911[_0x6901('0x1b')](_0x5aa2ce[_0x6901('0x1f')]);break;case _0x6901('0x21'):_0x18c911[_0x6901('0x1b')](_0x5aa2ce[_0x6901('0x22')]);_0x18c911[_0x6901('0x1b')](_0x5aa2ce[_0x6901('0x1f')]);break;default:_0x18c911=_[_0x6901('0xa')](_0x5aa2ce['appdata'])?[]:_0x5aa2ce['appdata'][_0x6901('0x1a')](',');}var _0x455235={'id':util['format'](_0x6901('0x23'),_0x24ca90,_0x5aa2ce['id'],_0x5aa2ce['app']),'condition':require(_0x6901('0x24'))[_0x6901('0x25')](_0x24ca90,getIntervals(_0x277d15['intervals'],_0x5aa2ce),_0x277d15),'consequence':require('./applications/'+_0x5aa2ce[_0x6901('0x16')])[_0x6901('0x26')](_0x24ca90,_0x18c911,_0x277d15,_0x205237),'p':_0x5aa2ce[_0x6901('0x27')]||0x0};logger[_0x6901('0x28')](_0x6901('0x29'),_0x455235['id'],'on\x20interval',getIntervals(_0x277d15[_0x6901('0x2a')],_0x5aa2ce)[_0x6901('0x15')](_0x6901('0x2b')));_0x13f16c[_0x6901('0x1b')](_0x455235);}else{logger[_0x6901('0x2c')](_0x6901('0x2d'),path['join'](__dirname,_0x6901('0x13'),_0x5aa2ce[_0x6901('0x16')]+'.js'));}}_0x277d15[_0x6901('0xf')][_0x24ca90]=new RuleEngine(_0x13f16c);_0x277d15[_0x6901('0xf')][_0x24ca90][_0x6901('0x2e')](_0x205237,function(_0x591140){logger['info'](_0x6901('0x2f'),JSON[_0x6901('0x30')](_0x591140[_0x6901('0x31')]));if(_0x277d15['rules'][_0x24ca90]){_0x277d15[_0x6901('0xf')][_0x24ca90][_0x6901('0x32')](_0x6901('0x33'));}});return _0x57a46c({'code':0xc8,'message':_0x205237});}else{logger['info'](_0x6901('0x34'));return _0x57a46c({'code':0xc8,'message':_0x205237});}}catch(_0x323903){logger[_0x6901('0x2c')](_0x323903[_0x6901('0x35')]);return _0xde853c(_0x31afaa[_0x6901('0x2c')](0x1f4,_0x323903));}}return _0xde853c('routing\x20is\x20empty');});},'AcceptMessage':function(_0x25c7e9){var _0x107dae=this;return new Promise(function(_0x4d9dfe,_0x3cc6bc){if(_0x25c7e9[_0x6901('0x11')]&&_0x25c7e9['message']['id']){try{var _0xac8934=getId(_0x25c7e9[_0x6901('0x10')],_0x25c7e9['message']?_0x25c7e9[_0x6901('0x11')]['id']:0x0,_0x25c7e9[_0x6901('0x12')]?_0x25c7e9[_0x6901('0x12')]['id']:0x0);if(_0x277d15[_0x6901('0xf')][_0xac8934]){_0x277d15[_0x6901('0xf')][_0xac8934][_0x6901('0x32')](_0x6901('0x33'));if(rpc[_0x25c7e9['channel']+_0x6901('0x36')]){rpc[_0x25c7e9['channel']+_0x6901('0x36')][_0x6901('0x37')](_0xac8934,{'UserId':_0x25c7e9[_0x6901('0x11')][_0x6901('0x38')]})[_0x6901('0x39')](function(_0x5ea1bc){logger['error'](_0x6901('0x3a'));});}}return _0x4d9dfe({'code':0xc8,'message':_0x25c7e9});}catch(_0x334dc2){logger[_0x6901('0x2c')](_0x334dc2[_0x6901('0x35')]);return _0x3cc6bc(_0x107dae[_0x6901('0x2c')](0x1f4,_0x334dc2));}}logger[_0x6901('0x2c')](_0x6901('0x3b'));return _0x3cc6bc(_0x107dae[_0x6901('0x2c')](0x1f4,_0x6901('0x3b')));});},'RejectMessage':function(_0x401d2){var _0x24b1e3=this;return new Promise(function(_0x32cfe6,_0x435090){if(_0x401d2[_0x6901('0x3c')]&&_0x401d2[_0x6901('0x3c')]['id']){try{if(_0x277d15[_0x6901('0x3d')][_0x401d2[_0x6901('0x3c')]['id']]){_0x277d15['agents'][_0x401d2[_0x6901('0x3c')]['id']][_0x6901('0x3e')]=![];_0x277d15[_0x6901('0x3d')][_0x401d2[_0x6901('0x3c')]['id']][_0x6901('0x3f')]=undefined;}return _0x32cfe6({'code':0xc8,'message':_0x401d2});}catch(_0x18b272){logger[_0x6901('0x2c')](_0x18b272[_0x6901('0x35')]);return _0x435090(_0x24b1e3[_0x6901('0x2c')](0x1f4,_0x18b272));}}logger[_0x6901('0x2c')](_0x6901('0x3b'));return _0x435090(_0x24b1e3['error'](0x1f4,_0x6901('0x3b')));});},'AbandonInteraction':function(_0xfc1510){var _0x2efe8e=this;return new Promise(function(_0x1095ca,_0x35e3b4){if(_0xfc1510[_0x6901('0x10')]&&_0xfc1510[_0x6901('0x12')]&&_0xfc1510['interaction']['id']){try{var _0x27b0d6=getId(_0xfc1510['channel'],_0xfc1510[_0x6901('0x11')]?_0xfc1510[_0x6901('0x11')]['id']:0x0,_0xfc1510[_0x6901('0x12')]?_0xfc1510['interaction']['id']:0x0);if(_0x277d15['rules'][_0x27b0d6]){_0x277d15[_0x6901('0xf')][_0x27b0d6][_0x6901('0x32')](_0x6901('0x33'));}return _0x1095ca({'code':0xc8,'message':_0xfc1510});}catch(_0x1b9eca){logger[_0x6901('0x2c')](_0x1b9eca[_0x6901('0x35')]);return _0x35e3b4(_0x2efe8e[_0x6901('0x2c')](0x1f4,_0x1b9eca));}}logger[_0x6901('0x2c')]('message\x20is\x20empty');return _0x35e3b4(_0x2efe8e[_0x6901('0x2c')](0x1f4,_0x6901('0x3b')));});},'AgentCapacity':function(_0xe6f84e){var _0x463b36=this;return new Promise(function(_0x250144,_0x4b1f95){if(_0x277d15['agents'][_0x6901('0x40')](_0xe6f84e['id'])){for(var _0x3af425 in _0xe6f84e[_0x6901('0x41')]){if(_0xe6f84e[_0x6901('0x41')]['hasOwnProperty'](_0x3af425)){if(_0x277d15[_0x6901('0x3d')][_0xe6f84e['id']][_0x6901('0x40')](_0x3af425+_0x6901('0x42'))){_0x277d15['agents'][_0xe6f84e['id']][_0x3af425+_0x6901('0x42')]=parseInt(_0xe6f84e[_0x6901('0x41')][_0x3af425],0xa);}}}_0x277d15[_0x6901('0x3d')][_0xe6f84e['id']][_0x6901('0x43')]();return _0x250144({'code':0xc8,'message':_0x277d15[_0x6901('0x3d')][_0xe6f84e['id']]});}else{return _0x4b1f95(_0x463b36[_0x6901('0x2c')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x485026){return new Promise(function(_0x4e8089,_0x99b35d){var _0x5f21d1=_['values'](_0x277d15['agents']);_0x4e8089({'count':_0x5f21d1[_0x6901('0x1d')],'rows':_0x5f21d1});});},'ChatQueues':function(_0x4e5b79){return new Promise(function(_0x50aa07,_0x2b992d){var _0x549603=[];for(var _0x21e39d in _0x277d15[_0x6901('0x44')]){if(_0x277d15['chatQueues'][_0x6901('0x40')](_0x21e39d)){var _0x2ed6fe=_0x277d15['chatQueues'][_0x21e39d];var _0x485d84={'id':_0x2ed6fe['id'],'available':_0x2ed6fe[_0x6901('0x45')],'loggedIn':_0x2ed6fe[_0x6901('0x46')],'name':_0x2ed6fe[_0x6901('0x47')],'paused':_0x2ed6fe[_0x6901('0x48')],'waiting':_0x2ed6fe['waiting']};_0x549603['push'](_0x485d84);}}_0x50aa07({'count':_0x549603[_0x6901('0x1d')],'rows':_0x549603});});},'MailQueues':function(_0x38d334){return new Promise(function(_0x2aa9b3,_0x5992a8){var _0x4275f2=[];for(var _0x4740a4 in _0x277d15['mailQueues']){if(_0x277d15[_0x6901('0x49')][_0x6901('0x40')](_0x4740a4)){var _0x42a161=_0x277d15[_0x6901('0x49')][_0x4740a4];var _0x420fcf={'id':_0x42a161['id'],'available':_0x42a161[_0x6901('0x45')],'loggedIn':_0x42a161['loggedIn'],'name':_0x42a161[_0x6901('0x47')],'paused':_0x42a161[_0x6901('0x48')],'waiting':_0x42a161['waiting']};_0x4275f2[_0x6901('0x1b')](_0x420fcf);}}_0x2aa9b3({'count':_0x4275f2[_0x6901('0x1d')],'rows':_0x4275f2});});},'OpenchannelQueues':function(_0x4be162){return new Promise(function(_0x616bf0,_0x22f0fb){var _0x34d7b1=[];for(var _0x4021e5 in _0x277d15[_0x6901('0x4a')]){if(_0x277d15[_0x6901('0x4a')][_0x6901('0x40')](_0x4021e5)){var _0xd23c84=_0x277d15['openchannelQueues'][_0x4021e5];var _0x45e1af={'id':_0xd23c84['id'],'available':_0xd23c84[_0x6901('0x45')],'loggedIn':_0xd23c84[_0x6901('0x46')],'name':_0xd23c84[_0x6901('0x47')],'paused':_0xd23c84['paused'],'waiting':_0xd23c84[_0x6901('0x4b')]};_0x34d7b1['push'](_0x45e1af);}}_0x616bf0({'count':_0x34d7b1[_0x6901('0x1d')],'rows':_0x34d7b1});});},'SmsQueues':function(_0x490961){return new Promise(function(_0x2c913,_0x511b6b){var _0x430507=[];for(var _0x42f1b8 in _0x277d15[_0x6901('0x4c')]){if(_0x277d15['smsQueues'][_0x6901('0x40')](_0x42f1b8)){var _0x25eb97=_0x277d15[_0x6901('0x4c')][_0x42f1b8];var _0x4f425b={'id':_0x25eb97['id'],'available':_0x25eb97[_0x6901('0x45')],'loggedIn':_0x25eb97[_0x6901('0x46')],'name':_0x25eb97[_0x6901('0x47')],'paused':_0x25eb97[_0x6901('0x48')],'waiting':_0x25eb97[_0x6901('0x4b')]};_0x430507[_0x6901('0x1b')](_0x4f425b);}}_0x2c913({'count':_0x430507[_0x6901('0x1d')],'rows':_0x430507});});},'FaxQueues':function(_0x1803f){return new Promise(function(_0x744e3a,_0x47d719){var _0x3d7743=[];for(var _0x313827 in _0x277d15['faxQueues']){if(_0x277d15[_0x6901('0x4d')][_0x6901('0x40')](_0x313827)){var _0x15c2a1=_0x277d15[_0x6901('0x4d')][_0x313827];var _0x11c8bd={'id':_0x15c2a1['id'],'available':_0x15c2a1[_0x6901('0x45')],'loggedIn':_0x15c2a1['loggedIn'],'name':_0x15c2a1['name'],'paused':_0x15c2a1[_0x6901('0x48')],'waiting':_0x15c2a1['waiting']};_0x3d7743[_0x6901('0x1b')](_0x11c8bd);}}_0x744e3a({'count':_0x3d7743['length'],'rows':_0x3d7743});});},'ChatQueuesWaitingInteractions':function(_0x523684){return new Promise(function(_0x2c0635,_0x564164){var _0x36f398=_['values'](_0x277d15[_0x6901('0x4e')]);_0x2c0635({'count':_0x36f398['length'],'rows':_0x36f398});});},'MailQueuesWaitingInteractions':function(_0x4c8d78){return new Promise(function(_0x3b6830,_0x1b77d1){var _0x3a73cd=_[_0x6901('0x4f')](_0x277d15[_0x6901('0x50')]);_0x3b6830({'count':_0x3a73cd[_0x6901('0x1d')],'rows':_0x3a73cd});});},'OpenchannelQueuesWaitingInteractions':function(_0x43eed1){return new Promise(function(_0x1bc78c,_0x46a2b9){var _0x26af41=_[_0x6901('0x4f')](_0x277d15[_0x6901('0x51')]);_0x1bc78c({'count':_0x26af41[_0x6901('0x1d')],'rows':_0x26af41});});},'SmsQueuesWaitingInteractions':function(_0x3386c8){return new Promise(function(_0x2a5680,_0xe0b387){var _0x201235=_[_0x6901('0x4f')](_0x277d15[_0x6901('0x52')]);_0x2a5680({'count':_0x201235[_0x6901('0x1d')],'rows':_0x201235});});},'FaxQueuesWaitingInteractions':function(_0x483542){return new Promise(function(_0x2180a4,_0x18c2ba){var _0x57a475=_['values'](_0x277d15[_0x6901('0x53')]);_0x2180a4({'count':_0x57a475[_0x6901('0x1d')],'rows':_0x57a475});});}};var _0x1233d9=jayson[_0x6901('0x54')](_0x19fae2)[_0x6901('0x55')]();_0x1233d9['on']('error',function(_0x358170){logger[_0x6901('0x2c')](JSON[_0x6901('0x30')](_0x358170));return _0x29f6fe(_0x358170);});_0x1233d9['listen'](0x232c,_0x6901('0x56'),function(){console[_0x6901('0x57')](_0x6901('0x58'),0x232c);return _0x232860(_0x6901('0x59')+0x232c);});});}; \ No newline at end of file +var _0x3fea=['Applications\x20executed','matchPath','emit','end','error','stack','routing\x20is\x20empty','channel','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','uuid','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','format','isNil','IntervalId','Intervals','map','interval','listen','message','interaction','applications','isArray','existsSync','app','.js','toLowerCase','autoreply','push','length','join','dialogflow','split','slice','amazonlex','appdata','TagId','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','on\x20interval','Please\x20create\x20a\x20new\x20file\x20under','rules','execute'];(function(_0x16578c,_0x24fa12){var _0x7a6990=function(_0x33ce22){while(--_0x33ce22){_0x16578c['push'](_0x16578c['shift']());}};_0x7a6990(++_0x24fa12);}(_0x3fea,0x130));var _0xa3fe=function(_0x3b5632,_0x3601d4){_0x3b5632=_0x3b5632-0x0;var _0x1e6f9b=_0x3fea[_0x3b5632];return _0x1e6f9b;};'use strict';var _=require(_0xa3fe('0x0'));var util=require('util');var path=require(_0xa3fe('0x1'));var fs=require('fs');var jayson=require(_0xa3fe('0x2'));var BPromise=require('bluebird');var uuid=require(_0xa3fe('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport')};var rpc={'openchannelQueueReport':require(_0xa3fe('0x4')),'mailQueueReport':require(_0xa3fe('0x5')),'chatQueueReport':require(_0xa3fe('0x6')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xa3fe('0x7'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x2b667e,_0x30c58c,_0xcb70c5){return util[_0xa3fe('0x8')]('%s.%s.%s',_0x2b667e,_0x30c58c||0x0,_0xcb70c5||0x0);}function getIntervals(_0x41c548,_0x5619a8){var _0x55603a=[];if(!_[_0xa3fe('0x9')](_0x5619a8[_0xa3fe('0xa')])&&!_[_0xa3fe('0x9')](_0x41c548[_0x5619a8[_0xa3fe('0xa')]])&&!_[_0xa3fe('0x9')](_0x41c548[_0x5619a8[_0xa3fe('0xa')]][_0xa3fe('0xb')])){_0x55603a=_[_0xa3fe('0xc')](_0x41c548[_0x5619a8[_0xa3fe('0xa')]][_0xa3fe('0xb')],_0xa3fe('0xd'));}else if(!_[_0xa3fe('0x9')](_0x5619a8['interval'])){_0x55603a=[_0x5619a8[_0xa3fe('0xd')]];}return _0x55603a;}exports[_0xa3fe('0xe')]=function(_0x185df6){_0x185df6['rules']={};return new BPromise(function(_0x1aff4b,_0x494718){var _0x2146dc={'Start':function(_0x16a60d){var _0x4e35b4=this;return new Promise(function(_0x435df9,_0x3d3d8a){if(_0x16a60d){try{var _0x1482ce=[];var _0x5d72a5=getId(_0x16a60d['channel'],_0x16a60d[_0xa3fe('0xf')]?_0x16a60d[_0xa3fe('0xf')]['id']:0x0,_0x16a60d[_0xa3fe('0x10')]?_0x16a60d[_0xa3fe('0x10')]['id']:0x0);if(_0x16a60d[_0xa3fe('0x11')]&&_[_0xa3fe('0x12')](_0x16a60d['applications'])&&_0x16a60d['applications']['length']){for(var _0x275eb6=0x0;_0x275eb6<_0x16a60d[_0xa3fe('0x11')]['length'];_0x275eb6+=0x1){var _0x315e8b=_0x16a60d[_0xa3fe('0x11')][_0x275eb6];if(fs[_0xa3fe('0x13')](path['join'](__dirname,'applications',_0x315e8b[_0xa3fe('0x14')]+_0xa3fe('0x15')))){var _0x72a2f=[];switch(_0x315e8b[_0xa3fe('0x14')][_0xa3fe('0x16')]()){case _0xa3fe('0x17'):var _0x41c45d=_0x315e8b['appdata']['split'](',');_0x72a2f[_0xa3fe('0x18')](_0x41c45d[0x0]);_0x72a2f[_0xa3fe('0x18')](_0x41c45d['slice'](0x1,_0x41c45d[_0xa3fe('0x19')])[_0xa3fe('0x1a')](','));break;case _0xa3fe('0x1b'):var _0x41c45d=_0x315e8b['appdata'][_0xa3fe('0x1c')](',');_0x72a2f[_0xa3fe('0x18')](_0x41c45d[0x0]);_0x72a2f[_0xa3fe('0x18')](_0x41c45d[0x1]);_0x72a2f[_0xa3fe('0x18')](_0x41c45d[_0xa3fe('0x1d')](0x2,_0x41c45d[_0xa3fe('0x19')])[_0xa3fe('0x1a')](','));break;case _0xa3fe('0x1e'):var _0x41c45d=_0x315e8b[_0xa3fe('0x1f')][_0xa3fe('0x1c')](',');_0x72a2f['push'](_0x41c45d[0x0]);_0x72a2f['push'](_0x41c45d[0x1]);_0x72a2f['push'](_0x41c45d[0x2]);_0x72a2f[_0xa3fe('0x18')](_0x41c45d[0x3]);_0x72a2f[_0xa3fe('0x18')](_0x41c45d['slice'](0x4,_0x41c45d[_0xa3fe('0x19')])[_0xa3fe('0x1a')](','));break;case _0xa3fe('0xf'):_0x72a2f[_0xa3fe('0x18')](_0x315e8b['appdata']);break;case'tag':_0x72a2f[_0xa3fe('0x18')](_0x315e8b[_0xa3fe('0x20')]);_0x72a2f['push'](_0x315e8b[_0xa3fe('0x1f')]);break;default:_0x72a2f=_[_0xa3fe('0x9')](_0x315e8b['appdata'])?[]:_0x315e8b[_0xa3fe('0x1f')][_0xa3fe('0x1c')](',');}var _0x5b536f={'id':util['format'](_0xa3fe('0x21'),_0x5d72a5,_0x315e8b['id'],_0x315e8b[_0xa3fe('0x14')]),'condition':require(_0xa3fe('0x22'))['condition'](_0x5d72a5,getIntervals(_0x185df6[_0xa3fe('0x23')],_0x315e8b),_0x185df6),'consequence':require(_0xa3fe('0x24')+_0x315e8b[_0xa3fe('0x14')])[_0xa3fe('0x25')](_0x5d72a5,_0x72a2f,_0x185df6,_0x16a60d),'p':_0x315e8b[_0xa3fe('0x26')]||0x0};logger[_0xa3fe('0x27')]('Push\x20new\x20rule',_0x5b536f['id'],_0xa3fe('0x28'),getIntervals(_0x185df6['intervals'],_0x315e8b)[_0xa3fe('0x1a')]('\x20|\x20'));_0x1482ce[_0xa3fe('0x18')](_0x5b536f);}else{logger['error'](_0xa3fe('0x29'),path[_0xa3fe('0x1a')](__dirname,_0xa3fe('0x11'),_0x315e8b[_0xa3fe('0x14')]+_0xa3fe('0x15')));}}_0x185df6['rules'][_0x5d72a5]=new RuleEngine(_0x1482ce);_0x185df6[_0xa3fe('0x2a')][_0x5d72a5][_0xa3fe('0x2b')](_0x16a60d,function(_0x15f20a){logger[_0xa3fe('0x27')](_0xa3fe('0x2c'),JSON['stringify'](_0x15f20a[_0xa3fe('0x2d')]));if(_0x185df6[_0xa3fe('0x2a')][_0x5d72a5]){_0x185df6['rules'][_0x5d72a5][_0xa3fe('0x2e')](_0xa3fe('0x2f'));}});return _0x435df9({'code':0xc8,'message':_0x16a60d});}else{logger[_0xa3fe('0x27')]('No\x20applications\x20to\x20execute');return _0x435df9({'code':0xc8,'message':_0x16a60d});}}catch(_0x1c8ea1){logger[_0xa3fe('0x30')](_0x1c8ea1[_0xa3fe('0x31')]);return _0x3d3d8a(_0x4e35b4[_0xa3fe('0x30')](0x1f4,_0x1c8ea1));}}return _0x3d3d8a(_0xa3fe('0x32'));});},'AcceptMessage':function(_0x147519){var _0x3d360a=this;return new Promise(function(_0x43ee74,_0x33cd88){if(_0x147519[_0xa3fe('0xf')]&&_0x147519[_0xa3fe('0xf')]['id']){try{var _0x3642f8=getId(_0x147519[_0xa3fe('0x33')],_0x147519[_0xa3fe('0xf')]?_0x147519[_0xa3fe('0xf')]['id']:0x0,_0x147519[_0xa3fe('0x10')]?_0x147519[_0xa3fe('0x10')]['id']:0x0);if(_0x185df6[_0xa3fe('0x2a')][_0x3642f8]){_0x185df6['rules'][_0x3642f8]['emit']('end');if(rpc[_0x147519['channel']+'QueueReport']){rpc[_0x147519['channel']+_0xa3fe('0x34')][_0xa3fe('0x35')](_0x3642f8,{'UserId':_0x147519[_0xa3fe('0xf')][_0xa3fe('0x36')]})[_0xa3fe('0x37')](function(_0x592c45){logger['error'](_0xa3fe('0x38'));});}}return _0x43ee74({'code':0xc8,'message':_0x147519});}catch(_0x1a157e){logger['error'](_0x1a157e['stack']);return _0x33cd88(_0x3d360a[_0xa3fe('0x30')](0x1f4,_0x1a157e));}}logger[_0xa3fe('0x30')](_0xa3fe('0x39'));return _0x33cd88(_0x3d360a[_0xa3fe('0x30')](0x1f4,_0xa3fe('0x39')));});},'RejectMessage':function(_0x42368f){var _0x37c679=this;return new Promise(function(_0x29e188,_0x36d8b8){if(_0x42368f[_0xa3fe('0x3a')]&&_0x42368f[_0xa3fe('0x3a')]['id']){try{if(_0x185df6[_0xa3fe('0x3b')][_0x42368f[_0xa3fe('0x3a')]['id']]){_0x185df6[_0xa3fe('0x3b')][_0x42368f[_0xa3fe('0x3a')]['id']][_0xa3fe('0x3c')]=![];_0x185df6['agents'][_0x42368f[_0xa3fe('0x3a')]['id']][_0xa3fe('0x3d')]=undefined;}return _0x29e188({'code':0xc8,'message':_0x42368f});}catch(_0x5d0573){logger[_0xa3fe('0x30')](_0x5d0573[_0xa3fe('0x31')]);return _0x36d8b8(_0x37c679[_0xa3fe('0x30')](0x1f4,_0x5d0573));}}logger[_0xa3fe('0x30')](_0xa3fe('0x39'));return _0x36d8b8(_0x37c679[_0xa3fe('0x30')](0x1f4,_0xa3fe('0x39')));});},'AbandonInteraction':function(_0x489aad){var _0x3a7b1d=this;return new Promise(function(_0x399ff4,_0x1f049e){if(_0x489aad[_0xa3fe('0x33')]&&_0x489aad[_0xa3fe('0x10')]&&_0x489aad[_0xa3fe('0x10')]['id']){try{var _0xab4e15=getId(_0x489aad[_0xa3fe('0x33')],_0x489aad[_0xa3fe('0xf')]?_0x489aad['message']['id']:0x0,_0x489aad[_0xa3fe('0x10')]?_0x489aad['interaction']['id']:0x0);if(_0x185df6[_0xa3fe('0x2a')][_0xab4e15]){_0x185df6[_0xa3fe('0x2a')][_0xab4e15][_0xa3fe('0x2e')](_0xa3fe('0x2f'));}return _0x399ff4({'code':0xc8,'message':_0x489aad});}catch(_0x430e96){logger[_0xa3fe('0x30')](_0x430e96[_0xa3fe('0x31')]);return _0x1f049e(_0x3a7b1d['error'](0x1f4,_0x430e96));}}logger[_0xa3fe('0x30')](_0xa3fe('0x39'));return _0x1f049e(_0x3a7b1d[_0xa3fe('0x30')](0x1f4,_0xa3fe('0x39')));});},'AgentCapacity':function(_0x2a39a3){var _0x1d2ff1=this;return new Promise(function(_0x2b611b,_0x395834){if(_0x185df6[_0xa3fe('0x3b')][_0xa3fe('0x3e')](_0x2a39a3['id'])){for(var _0xff2502 in _0x2a39a3[_0xa3fe('0x3f')]){if(_0x2a39a3[_0xa3fe('0x3f')]['hasOwnProperty'](_0xff2502)){if(_0x185df6['agents'][_0x2a39a3['id']]['hasOwnProperty'](_0xff2502+_0xa3fe('0x40'))){_0x185df6[_0xa3fe('0x3b')][_0x2a39a3['id']][_0xff2502+_0xa3fe('0x40')]=parseInt(_0x2a39a3[_0xa3fe('0x3f')][_0xff2502],0xa);}}}_0x185df6[_0xa3fe('0x3b')][_0x2a39a3['id']][_0xa3fe('0x41')]();return _0x2b611b({'code':0xc8,'message':_0x185df6[_0xa3fe('0x3b')][_0x2a39a3['id']]});}else{return _0x395834(_0x1d2ff1[_0xa3fe('0x30')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x517f8f){return new Promise(function(_0x5f1d9b,_0x1e6172){var _0x470905=_[_0xa3fe('0x42')](_0x185df6['agents']);_0x5f1d9b({'count':_0x470905[_0xa3fe('0x19')],'rows':_0x470905});});},'ChatQueues':function(_0x47a8f2){return new Promise(function(_0x413b73,_0xd5d629){var _0x1355c3=[];for(var _0xcc05d2 in _0x185df6[_0xa3fe('0x43')]){if(_0x185df6[_0xa3fe('0x43')]['hasOwnProperty'](_0xcc05d2)){var _0x1dcd9b=_0x185df6[_0xa3fe('0x43')][_0xcc05d2];var _0x32f60c={'id':_0x1dcd9b['id'],'available':_0x1dcd9b[_0xa3fe('0x44')],'loggedIn':_0x1dcd9b[_0xa3fe('0x45')],'name':_0x1dcd9b[_0xa3fe('0x46')],'paused':_0x1dcd9b[_0xa3fe('0x47')],'waiting':_0x1dcd9b[_0xa3fe('0x48')]};_0x1355c3['push'](_0x32f60c);}}_0x413b73({'count':_0x1355c3[_0xa3fe('0x19')],'rows':_0x1355c3});});},'MailQueues':function(_0x4784d3){return new Promise(function(_0x5f5580,_0xdd3563){var _0x4226e5=[];for(var _0x371c0c in _0x185df6['mailQueues']){if(_0x185df6[_0xa3fe('0x49')][_0xa3fe('0x3e')](_0x371c0c)){var _0x2f59a2=_0x185df6['mailQueues'][_0x371c0c];var _0x3a41c6={'id':_0x2f59a2['id'],'available':_0x2f59a2[_0xa3fe('0x44')],'loggedIn':_0x2f59a2['loggedIn'],'name':_0x2f59a2[_0xa3fe('0x46')],'paused':_0x2f59a2[_0xa3fe('0x47')],'waiting':_0x2f59a2['waiting']};_0x4226e5[_0xa3fe('0x18')](_0x3a41c6);}}_0x5f5580({'count':_0x4226e5[_0xa3fe('0x19')],'rows':_0x4226e5});});},'OpenchannelQueues':function(_0x440c4b){return new Promise(function(_0xfd8565,_0x5e96c1){var _0x1248cf=[];for(var _0x540cfa in _0x185df6[_0xa3fe('0x4a')]){if(_0x185df6['openchannelQueues'][_0xa3fe('0x3e')](_0x540cfa)){var _0x299819=_0x185df6[_0xa3fe('0x4a')][_0x540cfa];var _0x154bec={'id':_0x299819['id'],'available':_0x299819['available'],'loggedIn':_0x299819['loggedIn'],'name':_0x299819[_0xa3fe('0x46')],'paused':_0x299819[_0xa3fe('0x47')],'waiting':_0x299819[_0xa3fe('0x48')]};_0x1248cf['push'](_0x154bec);}}_0xfd8565({'count':_0x1248cf[_0xa3fe('0x19')],'rows':_0x1248cf});});},'SmsQueues':function(_0x206334){return new Promise(function(_0x45102e,_0x546c78){var _0x5016fe=[];for(var _0x340071 in _0x185df6[_0xa3fe('0x4b')]){if(_0x185df6[_0xa3fe('0x4b')][_0xa3fe('0x3e')](_0x340071)){var _0x646b4f=_0x185df6[_0xa3fe('0x4b')][_0x340071];var _0x51d1f3={'id':_0x646b4f['id'],'available':_0x646b4f[_0xa3fe('0x44')],'loggedIn':_0x646b4f['loggedIn'],'name':_0x646b4f[_0xa3fe('0x46')],'paused':_0x646b4f['paused'],'waiting':_0x646b4f['waiting']};_0x5016fe['push'](_0x51d1f3);}}_0x45102e({'count':_0x5016fe['length'],'rows':_0x5016fe});});},'FaxQueues':function(_0x4cabcc){return new Promise(function(_0x1b526b,_0x1f29da){var _0xaad57c=[];for(var _0x587719 in _0x185df6[_0xa3fe('0x4c')]){if(_0x185df6[_0xa3fe('0x4c')][_0xa3fe('0x3e')](_0x587719)){var _0x3bf0ac=_0x185df6[_0xa3fe('0x4c')][_0x587719];var _0xd03cf={'id':_0x3bf0ac['id'],'available':_0x3bf0ac[_0xa3fe('0x44')],'loggedIn':_0x3bf0ac[_0xa3fe('0x45')],'name':_0x3bf0ac[_0xa3fe('0x46')],'paused':_0x3bf0ac[_0xa3fe('0x47')],'waiting':_0x3bf0ac[_0xa3fe('0x48')]};_0xaad57c[_0xa3fe('0x18')](_0xd03cf);}}_0x1b526b({'count':_0xaad57c[_0xa3fe('0x19')],'rows':_0xaad57c});});},'ChatQueuesWaitingInteractions':function(_0xdb60e9){return new Promise(function(_0x2aaf04,_0x249e6c){var _0x1cd99f=_['values'](_0x185df6[_0xa3fe('0x4d')]);_0x2aaf04({'count':_0x1cd99f[_0xa3fe('0x19')],'rows':_0x1cd99f});});},'MailQueuesWaitingInteractions':function(_0x1a2831){return new Promise(function(_0x576b69,_0x381da3){var _0x482006=_['values'](_0x185df6[_0xa3fe('0x4e')]);_0x576b69({'count':_0x482006[_0xa3fe('0x19')],'rows':_0x482006});});},'OpenchannelQueuesWaitingInteractions':function(_0x50f929){return new Promise(function(_0x3cb067,_0x53f9cb){var _0x29396c=_['values'](_0x185df6['openchannelQueuesWaitingInteractions']);_0x3cb067({'count':_0x29396c[_0xa3fe('0x19')],'rows':_0x29396c});});},'SmsQueuesWaitingInteractions':function(_0x5f59d1){return new Promise(function(_0x18ee60,_0x515b49){var _0x16bf74=_[_0xa3fe('0x42')](_0x185df6['smsQueuesWaitingInteractions']);_0x18ee60({'count':_0x16bf74[_0xa3fe('0x19')],'rows':_0x16bf74});});},'FaxQueuesWaitingInteractions':function(_0x6061f9){return new Promise(function(_0x255da1,_0x4d31fb){var _0x119181=_[_0xa3fe('0x42')](_0x185df6[_0xa3fe('0x4f')]);_0x255da1({'count':_0x119181['length'],'rows':_0x119181});});}};var _0x462584=jayson[_0xa3fe('0x50')](_0x2146dc)[_0xa3fe('0x51')]();_0x462584['on'](_0xa3fe('0x30'),function(_0x25812c){logger[_0xa3fe('0x30')](JSON[_0xa3fe('0x52')](_0x25812c));return _0x494718(_0x25812c);});_0x462584[_0xa3fe('0xe')](0x232c,_0xa3fe('0x53'),function(){console[_0xa3fe('0x54')](_0xa3fe('0x55'),0x232c);return _0x1aff4b(_0xa3fe('0x56')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index cc08b51..89cdc7c 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 _0xf05b=['condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch'];(function(_0x22ce62,_0x3d8b8b){var _0x465895=function(_0x47dff7){while(--_0x47dff7){_0x22ce62['push'](_0x22ce62['shift']());}};_0x465895(++_0x3d8b8b);}(_0xf05b,0x1c4));var _0xbf05=function(_0x486eda,_0x5f07b3){_0x486eda=_0x486eda-0x0;var _0x3e3984=_0xf05b[_0x486eda];return _0x3e3984;};'use strict';var util=require('util');var BPromise=require(_0xbf05('0x0'));var jayson=require(_0xbf05('0x1'));var _=require(_0xbf05('0x2'));var logger=require(_0xbf05('0x3'))(_0xbf05('0x4'));var client=jayson[_0xbf05('0x5')][_0xbf05('0x6')]({'port':0x232a});function request(_0x13bd8a,_0x207f90){return new BPromise(function(_0xa8f122,_0x63fe85){return client[_0xbf05('0x7')](_0x13bd8a,_0x207f90)[_0xbf05('0x8')](function(_0x2f3c32){if(_0x2f3c32[_0xbf05('0x9')]){return _0x63fe85(_0x2f3c32[_0xbf05('0x9')][_0xbf05('0xa')]);}else{return _0xa8f122(_0x2f3c32['result']);}})[_0xbf05('0xb')](function(_0x4afd8c){return _0x63fe85(_0x4afd8c);});});}exports[_0xbf05('0xc')]=function(_0x31caa5,_0x2fed54,_0x7cf588){return function(_0x4ad4f6){if(_0x7cf588[_0xbf05('0xd')]&&!_0x7cf588['rules'][_0x31caa5]){logger[_0xbf05('0xe')](_0xbf05('0xf'),_0x31caa5);return _0x4ad4f6[_0xbf05('0x10')]();}var _0x5c05a1=[];for(var _0x2ffef1=0x0;_0x2ffef1<_0x2fed54[_0xbf05('0x11')];_0x2ffef1+=0x1){_0x5c05a1['push'](request(_0xbf05('0x12'),{'command':util[_0xbf05('0x13')](_0xbf05('0x14'),_0x2fed54[_0x2ffef1])})[_0xbf05('0x8')](function(_0x36276a){return _0x36276a&&_0x36276a[_0xbf05('0xa')]&&_0x36276a[_0xbf05('0xa')][_0xbf05('0x15')]('true')>=0x0?!![]:![];})['catch'](function(_0x42859b){logger[_0xbf05('0x9')](_0xbf05('0x16'),_0x31caa5,_0x2fed54[_0x2ffef1]);}));}BPromise[_0xbf05('0x17')](_0x5c05a1)[_0xbf05('0x8')](function(_0x425637){var _0x1ab090=_[_0xbf05('0x18')](_0x425637);logger[_0xbf05('0xe')](_0xbf05('0x19'),_0x31caa5,_0x2fed54[_0xbf05('0x1a')](_0xbf05('0x1b')),_0x1ab090);_0x4ad4f6['when'](_0x1ab090);})[_0xbf05('0xb')](function(_0x35241c){console['log'](_0x35241c);logger[_0xbf05('0x9')](_0xbf05('0x19'),_0x31caa5,_0x2fed54[_0xbf05('0x1a')](_0xbf05('0x1b')),_0x35241c[_0xbf05('0x1c')]);_0x4ad4f6[_0xbf05('0x10')]();});};}; \ No newline at end of file +var _0x2b91=['jayson/promise','../../../config/logger','routing','client','http','request','then','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','indexOf','catch','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird'];(function(_0x9c9587,_0x4894c1){var _0x13df91=function(_0x57e18a){while(--_0x57e18a){_0x9c9587['push'](_0x9c9587['shift']());}};_0x13df91(++_0x4894c1);}(_0x2b91,0x120));var _0x12b9=function(_0x4017b3,_0x343489){_0x4017b3=_0x4017b3-0x0;var _0x288b91=_0x2b91[_0x4017b3];return _0x288b91;};'use strict';var util=require(_0x12b9('0x0'));var BPromise=require(_0x12b9('0x1'));var jayson=require(_0x12b9('0x2'));var _=require('lodash');var logger=require(_0x12b9('0x3'))(_0x12b9('0x4'));var client=jayson[_0x12b9('0x5')][_0x12b9('0x6')]({'port':0x232a});function request(_0x4f5002,_0x6d54){return new BPromise(function(_0x1b4c28,_0x207c14){return client[_0x12b9('0x7')](_0x4f5002,_0x6d54)[_0x12b9('0x8')](function(_0x4abefc){if(_0x4abefc[_0x12b9('0x9')]){return _0x207c14(_0x4abefc[_0x12b9('0x9')][_0x12b9('0xa')]);}else{return _0x1b4c28(_0x4abefc[_0x12b9('0xb')]);}})['catch'](function(_0x23338c){return _0x207c14(_0x23338c);});});}exports['condition']=function(_0xad49a,_0x5afe85,_0x5bb6e6){return function(_0x66a8ce){if(_0x5bb6e6[_0x12b9('0xc')]&&!_0x5bb6e6[_0x12b9('0xc')][_0xad49a]){logger[_0x12b9('0xd')](_0x12b9('0xe'),_0xad49a);return _0x66a8ce[_0x12b9('0xf')]();}var _0x2c650f=[];for(var _0x44eb27=0x0;_0x44eb27<_0x5afe85[_0x12b9('0x10')];_0x44eb27+=0x1){_0x2c650f[_0x12b9('0x11')](request(_0x12b9('0x12'),{'command':util['format']('iftime\x20%s',_0x5afe85[_0x44eb27])})['then'](function(_0x1d7765){return _0x1d7765&&_0x1d7765[_0x12b9('0xa')]&&_0x1d7765[_0x12b9('0xa')][_0x12b9('0x13')]('true')>=0x0?!![]:![];})[_0x12b9('0x14')](function(_0x15e9e4){logger[_0x12b9('0x9')](_0x12b9('0x15'),_0xad49a,_0x5afe85[_0x44eb27]);}));}BPromise['all'](_0x2c650f)[_0x12b9('0x8')](function(_0x2a6db8){var _0x1370eb=_[_0x12b9('0x16')](_0x2a6db8);logger[_0x12b9('0xd')](_0x12b9('0x17'),_0xad49a,_0x5afe85[_0x12b9('0x18')](_0x12b9('0x19')),_0x1370eb);_0x66a8ce[_0x12b9('0x1a')](_0x1370eb);})[_0x12b9('0x14')](function(_0x217372){console[_0x12b9('0x1b')](_0x217372);logger[_0x12b9('0x9')](_0x12b9('0x17'),_0xad49a,_0x5afe85[_0x12b9('0x18')](_0x12b9('0x19')),_0x217372[_0x12b9('0x1c')]);_0x66a8ce[_0x12b9('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index fc42aa4..ce80576 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 _0xeecc=['calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acwTimeout','request','CreateVoiceAgentReport','destchannel','agentcalled','assign','now','called','agentringnoanswer','isNil','rejected','queuecallerabandon','forIn','channel','abandon','agentconnect','connect','answered_elsewhere','destuniqueid','complete','blindtransfer','transfererchannel','cdr','attendedtransfer','origtransfererchannel','clone','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','secondtransfererchannel','transfereeconnectedlinenum','destinationchannel','diffTime','agentconnectAt','agentcalledAt','endtime','agentringnoanswerAt','answertime','starttime','unknown','transfer','lodash','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','queue','interface'];(function(_0x4bf1d9,_0x339443){var _0x1dd6b7=function(_0x1f357c){while(--_0x1f357c){_0x4bf1d9['push'](_0x4bf1d9['shift']());}};_0x1dd6b7(++_0x339443);}(_0xeecc,0x10c));var _0xceec=function(_0x4ddb61,_0xcfbb16){_0x4ddb61=_0x4ddb61-0x0;var _0xe4abf8=_0xeecc[_0x4ddb61];return _0xe4abf8;};'use strict';var _=require(_0xceec('0x0'));var util=require(_0xceec('0x1'));var utils=require(_0xceec('0x2'));var agents={};var transfers={};function writeDB(_0x8fed4d){utils['info'](util[_0xceec('0x3')](_0xceec('0x4'),_0x8fed4d['uniqueid'],_0x8fed4d['channel'],_0x8fed4d[_0xceec('0x5')],_0x8fed4d['membername'],_0x8fed4d[_0xceec('0x6')],_0x8fed4d[_0xceec('0x7')],_0x8fed4d[_0xceec('0x8')],_0x8fed4d[_0xceec('0x9')]));if(_0x8fed4d[_0xceec('0x5')]){utils[_0xceec('0xa')](_0x8fed4d[_0xceec('0x5')])['then'](function(_0x268947){if(_0x268947){_0x8fed4d['type']=_0x268947[_0xceec('0xb')];_0x8fed4d[_0xceec('0xc')]=_0x8fed4d[_0xceec('0xd')]?_0x268947['acw']:![];_0x8fed4d['acwtime']=_0x8fed4d['agentacw']?_0x268947[_0xceec('0xe')]:null;}utils[_0xceec('0xf')](_0xceec('0x10'),_0x8fed4d);});}else{utils['request'](_0xceec('0x10'),_0x8fed4d);}delete agents[_0x8fed4d[_0xceec('0x11')]];}function isClosed(_0x390bb5){return _0x390bb5['agentringnoanswer']||_0x390bb5['agentconnect']||_0x390bb5[_0xceec('0xd')];}exports[_0xceec('0x12')]=function(_0x5b06bd){agents[_0x5b06bd[_0xceec('0x11')]]=_[_0xceec('0x13')](_0x5b06bd,{'agentcalled':!![],'agentcalledAt':utils[_0xceec('0x14')](),'lastevent':_0xceec('0x15')});};exports[_0xceec('0x16')]=function(_0xe6a695){if(!_[_0xceec('0x17')](agents[_0xe6a695['destchannel']])){agents[_0xe6a695[_0xceec('0x11')]]=_[_0xceec('0x13')](agents[_0xe6a695[_0xceec('0x11')]],_0xe6a695,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xceec('0x14')](),'lastevent':'rejected','reason':_0xceec('0x18')});}};exports[_0xceec('0x19')]=function(_0xa35565){_[_0xceec('0x1a')](agents,function(_0x2ec97d,_0x47ace3){if(_0x2ec97d[_0xceec('0x1b')]==_0xa35565['channel']){if(!isClosed(_0x2ec97d)){_0x2ec97d=_['assign'](_0x2ec97d,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xceec('0x14')](),'lastevent':_0xceec('0x1c'),'reason':_0xceec('0x1c')});}}});};exports[_0xceec('0x1d')]=function(_0xce1720){if(!_[_0xceec('0x17')](agents[_0xce1720['destchannel']])){agents[_0xce1720[_0xceec('0x11')]]=_[_0xceec('0x13')](agents[_0xce1720[_0xceec('0x11')]],_0xce1720,{'agentconnect':!![],'agentconnectAt':utils[_0xceec('0x14')](),'lastevent':_0xceec('0x1e')});_[_0xceec('0x1a')](agents,function(_0x406419,_0x2ade2f){if(_0x406419['channel']==_0xce1720[_0xceec('0x1b')]){if(!isClosed(_0x406419)){_0x406419=_[_0xceec('0x13')](_0x406419,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xceec('0x14')](),'lastevent':'answered_elsewhere','reason':_0xceec('0x1f'),'answeredelsewheredestinationuniqueid':_0xce1720[_0xceec('0x20')],'answeredelsewheremembername':_0xce1720['membername']});}}});}};exports['agentcomplete']=function(_0x4291c4){if(!_[_0xceec('0x17')](agents[_0x4291c4[_0xceec('0x11')]])){agents[_0x4291c4[_0xceec('0x11')]]=_[_0xceec('0x13')](agents[_0x4291c4[_0xceec('0x11')]],_0x4291c4,{'agentcomplete':!![],'agentcompleteAt':utils[_0xceec('0x14')](),'lastevent':_0xceec('0x21')});}};exports[_0xceec('0x22')]=function(_0x4aec77){if(!_['isNil'](agents[_0x4aec77[_0xceec('0x23')]])){this[_0xceec('0x24')]({'destinationchannel':_0x4aec77['transfererchannel']});}};exports[_0xceec('0x25')]=function(_0x33f6a2){_[_0xceec('0x1a')](agents,function(_0x52bc43){if(_0x52bc43[_0xceec('0x1b')]==_0x33f6a2[_0xceec('0x26')]){transfers[_0x52bc43['destchannel']]=_[_0xceec('0x27')](_0x52bc43);transfers[_0x52bc43[_0xceec('0x11')]]=_[_0xceec('0x13')](transfers[_0x52bc43[_0xceec('0x11')]],{'channel':_0x33f6a2[_0xceec('0x28')],'calleridname':_0x33f6a2[_0xceec('0x29')],'calleridnum':_0x33f6a2[_0xceec('0x2a')]});}else if(_0x52bc43[_0xceec('0x1b')]==_0x33f6a2[_0xceec('0x2b')]){transfers[_0x52bc43[_0xceec('0x11')]]=_[_0xceec('0x27')](_0x52bc43);transfers[_0x52bc43['destchannel']]=_[_0xceec('0x13')](transfers[_0x52bc43['destchannel']],{'channel':_0x33f6a2['transfereechannel'],'calleridname':_0x33f6a2['transfereecalleridname'],'calleridnum':_0x33f6a2[_0xceec('0x2c')]});}});};exports['cdr']=function(_0x3833b1){if(!_[_0xceec('0x17')](agents[_0x3833b1[_0xceec('0x2d')]])){if(!_[_0xceec('0x17')](agents[_0x3833b1['destinationchannel']]['agentconnectAt'])){agents[_0x3833b1[_0xceec('0x2d')]]=_[_0xceec('0x13')](agents[_0x3833b1['destinationchannel']],{'agentcomplete':!![],'agentcompleteAt':_0x3833b1['endtime'],'holdtime':utils[_0xceec('0x2e')](agents[_0x3833b1[_0xceec('0x2d')]][_0xceec('0x2f')],agents[_0x3833b1[_0xceec('0x2d')]][_0xceec('0x30')]),'talktime':utils[_0xceec('0x2e')](_0x3833b1[_0xceec('0x31')],agents[_0x3833b1[_0xceec('0x2d')]][_0xceec('0x2f')]),'lastevent':_0xceec('0x21')});}else if(_[_0xceec('0x17')](agents[_0x3833b1[_0xceec('0x2d')]][_0xceec('0x32')])){agents[_0x3833b1[_0xceec('0x2d')]]=_[_0xceec('0x13')](agents[_0x3833b1['destinationchannel']],{'agentringnoanswer':!![],'agentringnoanswerAt':_0x3833b1[_0xceec('0x33')]||_0x3833b1[_0xceec('0x34')],'reason':_0xceec('0x35')});}writeDB(agents[_0x3833b1[_0xceec('0x2d')]]);if(!_[_0xceec('0x17')](transfers[_0x3833b1['destinationchannel']])){agents[_0x3833b1['destinationchannel']]=_['assign'](transfers[_0x3833b1[_0xceec('0x2d')]],{'agentcalledAt':utils[_0xceec('0x14')](),'agentconnectAt':transfers[_0x3833b1['destinationchannel']][_0xceec('0x1d')]?utils['now']():null,'lastevent':_0xceec('0x1e'),'reason':_0xceec('0x36')});delete transfers[_0x3833b1[_0xceec('0x2d')]];}}}; \ No newline at end of file +var _0x8cce=['interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destchannel','agentringnoanswer','agentconnect','agentcomplete','agentcalled','assign','now','called','rejected','forIn','channel','abandon','isNil','answered_elsewhere','destuniqueid','complete','transfererchannel','attendedtransfer','origtransfererchannel','clone','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','secondtransfererchannel','transfereechannel','cdr','destinationchannel','agentconnectAt','endtime','agentcalledAt','diffTime','agentringnoanswerAt','answertime','starttime','connect','transfer','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','membername'];(function(_0x5cd4f8,_0x4bc99a){var _0x440347=function(_0x305cfe){while(--_0x305cfe){_0x5cd4f8['push'](_0x5cd4f8['shift']());}};_0x440347(++_0x4bc99a);}(_0x8cce,0x1d7));var _0xe8cc=function(_0x79666c,_0x56fb15){_0x79666c=_0x79666c-0x0;var _0x52100c=_0x8cce[_0x79666c];return _0x52100c;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xe8cc('0x0'));var agents={};var transfers={};function writeDB(_0x38a59b){utils[_0xe8cc('0x1')](util['format'](_0xe8cc('0x2'),_0x38a59b[_0xe8cc('0x3')],_0x38a59b['channel'],_0x38a59b[_0xe8cc('0x4')],_0x38a59b[_0xe8cc('0x5')],_0x38a59b[_0xe8cc('0x6')],_0x38a59b[_0xe8cc('0x7')],_0x38a59b[_0xe8cc('0x8')],_0x38a59b[_0xe8cc('0x9')]));if(_0x38a59b[_0xe8cc('0x4')]){utils[_0xe8cc('0xa')](_0x38a59b[_0xe8cc('0x4')])['then'](function(_0x352fe6){if(_0x352fe6){_0x38a59b['type']=_0x352fe6[_0xe8cc('0xb')];_0x38a59b[_0xe8cc('0xc')]=_0x38a59b['agentcomplete']?_0x352fe6['acw']:![];_0x38a59b[_0xe8cc('0xd')]=_0x38a59b[_0xe8cc('0xc')]?_0x352fe6[_0xe8cc('0xe')]:null;}utils[_0xe8cc('0xf')](_0xe8cc('0x10'),_0x38a59b);});}else{utils['request'](_0xe8cc('0x10'),_0x38a59b);}delete agents[_0x38a59b[_0xe8cc('0x11')]];}function isClosed(_0x4175cb){return _0x4175cb[_0xe8cc('0x12')]||_0x4175cb[_0xe8cc('0x13')]||_0x4175cb[_0xe8cc('0x14')];}exports[_0xe8cc('0x15')]=function(_0x40e610){agents[_0x40e610[_0xe8cc('0x11')]]=_[_0xe8cc('0x16')](_0x40e610,{'agentcalled':!![],'agentcalledAt':utils[_0xe8cc('0x17')](),'lastevent':_0xe8cc('0x18')});};exports[_0xe8cc('0x12')]=function(_0x40d423){if(!_['isNil'](agents[_0x40d423[_0xe8cc('0x11')]])){agents[_0x40d423['destchannel']]=_[_0xe8cc('0x16')](agents[_0x40d423[_0xe8cc('0x11')]],_0x40d423,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xe8cc('0x17')](),'lastevent':_0xe8cc('0x19'),'reason':_0xe8cc('0x19')});}};exports['queuecallerabandon']=function(_0xba13a3){_[_0xe8cc('0x1a')](agents,function(_0x4abac0,_0x7fc9a7){if(_0x4abac0[_0xe8cc('0x1b')]==_0xba13a3[_0xe8cc('0x1b')]){if(!isClosed(_0x4abac0)){_0x4abac0=_[_0xe8cc('0x16')](_0x4abac0,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xe8cc('0x17')](),'lastevent':_0xe8cc('0x1c'),'reason':_0xe8cc('0x1c')});}}});};exports[_0xe8cc('0x13')]=function(_0x428801){if(!_[_0xe8cc('0x1d')](agents[_0x428801[_0xe8cc('0x11')]])){agents[_0x428801[_0xe8cc('0x11')]]=_[_0xe8cc('0x16')](agents[_0x428801[_0xe8cc('0x11')]],_0x428801,{'agentconnect':!![],'agentconnectAt':utils[_0xe8cc('0x17')](),'lastevent':'connect'});_[_0xe8cc('0x1a')](agents,function(_0x438782,_0xecb094){if(_0x438782['channel']==_0x428801[_0xe8cc('0x1b')]){if(!isClosed(_0x438782)){_0x438782=_[_0xe8cc('0x16')](_0x438782,{'agentringnoanswer':!![],'agentringnoanswerAt':utils['now'](),'lastevent':_0xe8cc('0x1e'),'reason':_0xe8cc('0x1e'),'answeredelsewheredestinationuniqueid':_0x428801[_0xe8cc('0x1f')],'answeredelsewheremembername':_0x428801[_0xe8cc('0x5')]});}}});}};exports[_0xe8cc('0x14')]=function(_0x86406f){if(!_[_0xe8cc('0x1d')](agents[_0x86406f[_0xe8cc('0x11')]])){agents[_0x86406f[_0xe8cc('0x11')]]=_['assign'](agents[_0x86406f[_0xe8cc('0x11')]],_0x86406f,{'agentcomplete':!![],'agentcompleteAt':utils['now'](),'lastevent':_0xe8cc('0x20')});}};exports['blindtransfer']=function(_0x5eb9dd){if(!_[_0xe8cc('0x1d')](agents[_0x5eb9dd[_0xe8cc('0x21')]])){this['cdr']({'destinationchannel':_0x5eb9dd['transfererchannel']});}};exports[_0xe8cc('0x22')]=function(_0x3b382d){_[_0xe8cc('0x1a')](agents,function(_0x598ef3){if(_0x598ef3['channel']==_0x3b382d[_0xe8cc('0x23')]){transfers[_0x598ef3['destchannel']]=_[_0xe8cc('0x24')](_0x598ef3);transfers[_0x598ef3[_0xe8cc('0x11')]]=_[_0xe8cc('0x16')](transfers[_0x598ef3['destchannel']],{'channel':_0x3b382d[_0xe8cc('0x25')],'calleridname':_0x3b382d[_0xe8cc('0x26')],'calleridnum':_0x3b382d[_0xe8cc('0x27')]});}else if(_0x598ef3['channel']==_0x3b382d[_0xe8cc('0x28')]){transfers[_0x598ef3[_0xe8cc('0x11')]]=_[_0xe8cc('0x24')](_0x598ef3);transfers[_0x598ef3['destchannel']]=_[_0xe8cc('0x16')](transfers[_0x598ef3[_0xe8cc('0x11')]],{'channel':_0x3b382d[_0xe8cc('0x29')],'calleridname':_0x3b382d['transfereecalleridname'],'calleridnum':_0x3b382d['transfereeconnectedlinenum']});}});};exports[_0xe8cc('0x2a')]=function(_0x1ad0da){if(!_['isNil'](agents[_0x1ad0da[_0xe8cc('0x2b')]])){if(!_[_0xe8cc('0x1d')](agents[_0x1ad0da[_0xe8cc('0x2b')]][_0xe8cc('0x2c')])){agents[_0x1ad0da['destinationchannel']]=_[_0xe8cc('0x16')](agents[_0x1ad0da[_0xe8cc('0x2b')]],{'agentcomplete':!![],'agentcompleteAt':_0x1ad0da[_0xe8cc('0x2d')],'holdtime':utils['diffTime'](agents[_0x1ad0da['destinationchannel']][_0xe8cc('0x2c')],agents[_0x1ad0da['destinationchannel']][_0xe8cc('0x2e')]),'talktime':utils[_0xe8cc('0x2f')](_0x1ad0da[_0xe8cc('0x2d')],agents[_0x1ad0da['destinationchannel']][_0xe8cc('0x2c')]),'lastevent':'complete'});}else if(_[_0xe8cc('0x1d')](agents[_0x1ad0da[_0xe8cc('0x2b')]][_0xe8cc('0x30')])){agents[_0x1ad0da[_0xe8cc('0x2b')]]=_['assign'](agents[_0x1ad0da[_0xe8cc('0x2b')]],{'agentringnoanswer':!![],'agentringnoanswerAt':_0x1ad0da[_0xe8cc('0x31')]||_0x1ad0da[_0xe8cc('0x32')],'reason':'unknown'});}writeDB(agents[_0x1ad0da[_0xe8cc('0x2b')]]);if(!_['isNil'](transfers[_0x1ad0da[_0xe8cc('0x2b')]])){agents[_0x1ad0da[_0xe8cc('0x2b')]]=_[_0xe8cc('0x16')](transfers[_0x1ad0da[_0xe8cc('0x2b')]],{'agentcalledAt':utils[_0xe8cc('0x17')](),'agentconnectAt':transfers[_0x1ad0da[_0xe8cc('0x2b')]]['agentconnect']?utils[_0xe8cc('0x17')]():null,'lastevent':_0xe8cc('0x33'),'reason':_0xe8cc('0x34')});delete transfers[_0x1ad0da[_0xe8cc('0x2b')]];}}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 89ac938..4f681d5 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 _0xd27c=['CreateVoiceCallReport','newchannel','isNil','musiconholdstart','musiconholdstartAt','now','musiconholdstop','diffTime','variable','value','xmd-phone','xmd-callerid-preview','xmd-callerid','Queue','lastdata','queue','xmd-contactid','ContactId','outboundrouteid','routeid','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','lastIndexOf','agentcomplete','connectedlinenum','assign','isBefore','starttime','isAfter','endtime','destinationchannel','Local/_attended@transfer','duration','billableseconds','hangup','answertime','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','accountcode','destination','callerid','disposition','then','request'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0xd27c,0x93));var _0xcd27=function(_0x5d2dc8,_0x4088bb){_0x5d2dc8=_0x5d2dc8-0x0;var _0x2e6a66=_0xd27c[_0x5d2dc8];return _0x2e6a66;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var channels={};var timeouts={};function writeDB(_0x537894){return function(){_0x537894[_0xcd27('0x0')]=_0x537894[_0xcd27('0x0')]||null;utils[_0xcd27('0x1')](util[_0xcd27('0x2')](_0xcd27('0x3'),_0x537894['uniqueid'],_0x537894[_0xcd27('0x4')],_0x537894[_0xcd27('0x5')],_0x537894[_0xcd27('0x6')],_0x537894['source'],_0x537894[_0xcd27('0x7')],_0x537894[_0xcd27('0x8')],_0x537894[_0xcd27('0x9')]));if(_0x537894[_0xcd27('0x6')]){utils['getUserByInternal'](_0x537894['accountcode'])[_0xcd27('0xa')](function(_0x59d847){if(_0x59d847){_0x537894['UserId']=_0x59d847['id'];}utils[_0xcd27('0xb')](_0xcd27('0xc'),_0x537894);});}else{utils['request'](_0xcd27('0xc'),_0x537894);}if(channels[_0x537894[_0xcd27('0x4')]]){delete channels[_0x537894[_0xcd27('0x4')]];}if(timeouts[_0x537894[_0xcd27('0x4')]]){delete timeouts[_0x537894[_0xcd27('0x4')]];}};}exports[_0xcd27('0xd')]=function(_0x32bc30){if(_[_0xcd27('0xe')](channels[_0x32bc30[_0xcd27('0x4')]])){channels[_0x32bc30[_0xcd27('0x4')]]={'mohtime':0x0};}};exports[_0xcd27('0xf')]=function(_0x43be8c){if(!_[_0xcd27('0xe')](channels[_0x43be8c[_0xcd27('0x4')]])){channels[_0x43be8c['channel']][_0xcd27('0x10')]=utils[_0xcd27('0x11')]();}};exports[_0xcd27('0x12')]=function(_0x372fd1){if(!_[_0xcd27('0xe')](channels[_0x372fd1['channel']])){if(!_[_0xcd27('0xe')](channels[_0x372fd1[_0xcd27('0x4')]]['musiconholdstartAt'])){channels[_0x372fd1[_0xcd27('0x4')]]['mohtime']+=utils[_0xcd27('0x13')](utils[_0xcd27('0x11')](),channels[_0x372fd1[_0xcd27('0x4')]][_0xcd27('0x10')]);delete channels[_0x372fd1[_0xcd27('0x4')]][_0xcd27('0x10')];}}};exports['varset']=function(_0x4f7992){if(!_[_0xcd27('0xe')](channels[_0x4f7992[_0xcd27('0x4')]])){if(!_[_0xcd27('0xe')](_0x4f7992[_0xcd27('0x14')]['xmd-originatecalleridnum'])){channels[_0x4f7992['channel']]['source']=_0x4f7992[_0xcd27('0x15')];}if(!_[_0xcd27('0xe')](_0x4f7992[_0xcd27('0x14')][_0xcd27('0x16')])){channels[_0x4f7992[_0xcd27('0x4')]][_0xcd27('0x7')]=_0x4f7992[_0xcd27('0x15')];}if(!_[_0xcd27('0xe')](_0x4f7992[_0xcd27('0x14')][_0xcd27('0x17')])||!_[_0xcd27('0xe')](_0x4f7992['variable'][_0xcd27('0x18')])){channels[_0x4f7992['channel']][_0xcd27('0x8')]=_0x4f7992[_0xcd27('0x15')];}if(!_[_0xcd27('0xe')](_0x4f7992[_0xcd27('0x14')]['xmd-queue'])){channels[_0x4f7992[_0xcd27('0x4')]]['lastapplication']=_0xcd27('0x19');channels[_0x4f7992[_0xcd27('0x4')]][_0xcd27('0x1a')]=_0x4f7992[_0xcd27('0x15')];channels[_0x4f7992[_0xcd27('0x4')]][_0xcd27('0x1b')]=!![];}if(!_[_0xcd27('0xe')](_0x4f7992['variable'][_0xcd27('0x1c')])){channels[_0x4f7992['channel']][_0xcd27('0x1d')]=_0x4f7992[_0xcd27('0x15')];}if(!_[_0xcd27('0xe')](_0x4f7992[_0xcd27('0x14')][_0xcd27('0x1e')])){channels[_0x4f7992[_0xcd27('0x4')]][_0xcd27('0x1f')]=_0x4f7992[_0xcd27('0x15')];}}};exports[_0xcd27('0x20')]=function(_0x3128a7){if(!_[_0xcd27('0xe')](channels[_0x3128a7[_0xcd27('0x4')]])){if(_0x3128a7[_0xcd27('0x21')][_0xcd27('0x22')]()==_0xcd27('0x23')&&_[_0xcd27('0x24')](_0x3128a7[_0xcd27('0x25')]['toLowerCase'](),_0xcd27('0x26'))){var _0x41e62c=_0x3128a7[_0xcd27('0x25')][_0xcd27('0x27')]('=');var _0x4b1910=_0x41e62c[0x0]['substring'](_0x41e62c[0x0][_0xcd27('0x28')]('(')+0x1,_0x41e62c[0x0][_0xcd27('0x28')](')'));var _0x5f423f=_0x41e62c[0x1];channels[_0x3128a7[_0xcd27('0x4')]][_0x4b1910]=_0x5f423f;}}};exports[_0xcd27('0x29')]=function(_0x3019cd){if(!_['isNil'](channels[_0x3019cd['channel']])&&!_['isNil'](channels[_0x3019cd[_0xcd27('0x4')]][_0xcd27('0x1b')])){channels[_0x3019cd[_0xcd27('0x4')]][_0xcd27('0x6')]=_0x3019cd[_0xcd27('0x2a')];}};exports['cdr']=function(_0x465cf4){if(!_[_0xcd27('0xe')](channels[_0x465cf4[_0xcd27('0x4')]])){if(_[_0xcd27('0xe')](timeouts[_0x465cf4[_0xcd27('0x4')]])){channels[_0x465cf4[_0xcd27('0x4')]]=_['assign'](_0x465cf4,channels[_0x465cf4[_0xcd27('0x4')]]);}else{clearTimeout(timeouts[_0x465cf4[_0xcd27('0x4')]]);channels[_0x465cf4[_0xcd27('0x4')]]=_[_0xcd27('0x2b')](channels[_0x465cf4[_0xcd27('0x4')]],{'starttime':utils[_0xcd27('0x2c')](_0x465cf4[_0xcd27('0x2d')],channels[_0x465cf4[_0xcd27('0x4')]][_0xcd27('0x2d')])?_0x465cf4[_0xcd27('0x2d')]:channels[_0x465cf4[_0xcd27('0x4')]][_0xcd27('0x2d')],'answertime':utils[_0xcd27('0x2c')](_0x465cf4['answertime'],channels[_0x465cf4[_0xcd27('0x4')]][_0xcd27('0x0')])?_0x465cf4[_0xcd27('0x0')]:channels[_0x465cf4['channel']]['answertime']});if(utils[_0xcd27('0x2e')](_0x465cf4[_0xcd27('0x2f')],channels[_0x465cf4['channel']]['endtime'])){channels[_0x465cf4['channel']]=_[_0xcd27('0x2b')](channels[_0x465cf4[_0xcd27('0x4')]],{'endtime':_0x465cf4[_0xcd27('0x2f')],'destinationchannel':_[_0xcd27('0x24')](_0x465cf4[_0xcd27('0x30')],_0xcd27('0x31'))?channels[_0x465cf4[_0xcd27('0x4')]]['destinationchannel']:_0x465cf4['destinationchannel']});}channels[_0x465cf4['channel']][_0xcd27('0x32')]=utils['diffTime'](channels[_0x465cf4['channel']][_0xcd27('0x2f')],channels[_0x465cf4[_0xcd27('0x4')]][_0xcd27('0x2d')]);channels[_0x465cf4['channel']][_0xcd27('0x33')]=utils[_0xcd27('0x13')](channels[_0x465cf4[_0xcd27('0x4')]]['endtime'],channels[_0x465cf4[_0xcd27('0x4')]][_0xcd27('0x0')]);if(_0x465cf4['lastapplication']['toLowerCase']()!=_0xcd27('0x34')){channels[_0x465cf4['channel']][_0xcd27('0x1a')]=_0x465cf4[_0xcd27('0x1a')];channels[_0x465cf4[_0xcd27('0x4')]]['lastapplication']=_0x465cf4['lastapplication'];}}timeouts[_0x465cf4['channel']]=setTimeout(writeDB(channels[_0x465cf4[_0xcd27('0x4')]]),0x3e8);}}; \ No newline at end of file +var _0xf939=['source','destination','disposition','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','isNil','musiconholdstartAt','now','mohtime','varset','variable','xmd-originatecalleridnum','value','xmd-phone','xmd-callerid-preview','callerid','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','outboundrouteid','routeid','newexten','application','toLowerCase','startsWith','appdata','cdr','substring','lastIndexOf','assign','starttime','isBefore','isAfter','endtime','destinationchannel','Local/_attended@transfer','duration','diffTime','billableseconds','hangup','lodash','./utils','answertime','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type'];(function(_0x5709f6,_0x4c4feb){var _0x302523=function(_0xf32303){while(--_0xf32303){_0x5709f6['push'](_0x5709f6['shift']());}};_0x302523(++_0x4c4feb);}(_0xf939,0x1b8));var _0x9f93=function(_0x50c525,_0x3e7a61){_0x50c525=_0x50c525-0x0;var _0x45d5cc=_0xf939[_0x50c525];return _0x45d5cc;};'use strict';var _=require(_0x9f93('0x0'));var util=require('util');var utils=require(_0x9f93('0x1'));var channels={};var timeouts={};function writeDB(_0xb26aaf){return function(){_0xb26aaf[_0x9f93('0x2')]=_0xb26aaf['answertime']||null;utils['info'](util[_0x9f93('0x3')](_0x9f93('0x4'),_0xb26aaf[_0x9f93('0x5')],_0xb26aaf[_0x9f93('0x6')],_0xb26aaf[_0x9f93('0x7')],_0xb26aaf['accountcode'],_0xb26aaf[_0x9f93('0x8')],_0xb26aaf[_0x9f93('0x9')],_0xb26aaf['callerid'],_0xb26aaf[_0x9f93('0xa')]));if(_0xb26aaf[_0x9f93('0xb')]){utils[_0x9f93('0xc')](_0xb26aaf[_0x9f93('0xb')])[_0x9f93('0xd')](function(_0xfbda43){if(_0xfbda43){_0xb26aaf[_0x9f93('0xe')]=_0xfbda43['id'];}utils[_0x9f93('0xf')]('CreateVoiceCallReport',_0xb26aaf);});}else{utils[_0x9f93('0xf')](_0x9f93('0x10'),_0xb26aaf);}if(channels[_0xb26aaf['channel']]){delete channels[_0xb26aaf[_0x9f93('0x6')]];}if(timeouts[_0xb26aaf[_0x9f93('0x6')]]){delete timeouts[_0xb26aaf[_0x9f93('0x6')]];}};}exports[_0x9f93('0x11')]=function(_0x43ab47){if(_[_0x9f93('0x12')](channels[_0x43ab47[_0x9f93('0x6')]])){channels[_0x43ab47[_0x9f93('0x6')]]={'mohtime':0x0};}};exports['musiconholdstart']=function(_0x5c6d02){if(!_['isNil'](channels[_0x5c6d02[_0x9f93('0x6')]])){channels[_0x5c6d02['channel']][_0x9f93('0x13')]=utils[_0x9f93('0x14')]();}};exports['musiconholdstop']=function(_0x2842e5){if(!_[_0x9f93('0x12')](channels[_0x2842e5['channel']])){if(!_[_0x9f93('0x12')](channels[_0x2842e5[_0x9f93('0x6')]][_0x9f93('0x13')])){channels[_0x2842e5[_0x9f93('0x6')]][_0x9f93('0x15')]+=utils['diffTime'](utils[_0x9f93('0x14')](),channels[_0x2842e5['channel']]['musiconholdstartAt']);delete channels[_0x2842e5[_0x9f93('0x6')]][_0x9f93('0x13')];}}};exports[_0x9f93('0x16')]=function(_0x10adf5){if(!_[_0x9f93('0x12')](channels[_0x10adf5[_0x9f93('0x6')]])){if(!_[_0x9f93('0x12')](_0x10adf5[_0x9f93('0x17')][_0x9f93('0x18')])){channels[_0x10adf5[_0x9f93('0x6')]]['source']=_0x10adf5[_0x9f93('0x19')];}if(!_[_0x9f93('0x12')](_0x10adf5[_0x9f93('0x17')][_0x9f93('0x1a')])){channels[_0x10adf5[_0x9f93('0x6')]][_0x9f93('0x9')]=_0x10adf5['value'];}if(!_[_0x9f93('0x12')](_0x10adf5[_0x9f93('0x17')][_0x9f93('0x1b')])||!_[_0x9f93('0x12')](_0x10adf5[_0x9f93('0x17')]['xmd-callerid'])){channels[_0x10adf5['channel']][_0x9f93('0x1c')]=_0x10adf5[_0x9f93('0x19')];}if(!_[_0x9f93('0x12')](_0x10adf5[_0x9f93('0x17')][_0x9f93('0x1d')])){channels[_0x10adf5[_0x9f93('0x6')]][_0x9f93('0x1e')]=_0x9f93('0x1f');channels[_0x10adf5['channel']][_0x9f93('0x20')]=_0x10adf5[_0x9f93('0x19')];channels[_0x10adf5['channel']][_0x9f93('0x21')]=!![];}if(!_['isNil'](_0x10adf5['variable'][_0x9f93('0x22')])){channels[_0x10adf5[_0x9f93('0x6')]]['ContactId']=_0x10adf5[_0x9f93('0x19')];}if(!_[_0x9f93('0x12')](_0x10adf5[_0x9f93('0x17')][_0x9f93('0x23')])){channels[_0x10adf5['channel']][_0x9f93('0x24')]=_0x10adf5['value'];}}};exports[_0x9f93('0x25')]=function(_0xaf0a3e){if(!_[_0x9f93('0x12')](channels[_0xaf0a3e[_0x9f93('0x6')]])){if(_0xaf0a3e[_0x9f93('0x26')][_0x9f93('0x27')]()=='set'&&_[_0x9f93('0x28')](_0xaf0a3e[_0x9f93('0x29')][_0x9f93('0x27')](),_0x9f93('0x2a'))){var _0x35b52f=_0xaf0a3e[_0x9f93('0x29')]['split']('=');var _0xd82495=_0x35b52f[0x0][_0x9f93('0x2b')](_0x35b52f[0x0][_0x9f93('0x2c')]('(')+0x1,_0x35b52f[0x0][_0x9f93('0x2c')](')'));var _0x44a122=_0x35b52f[0x1];channels[_0xaf0a3e[_0x9f93('0x6')]][_0xd82495]=_0x44a122;}}};exports['agentcomplete']=function(_0x5bc61a){if(!_[_0x9f93('0x12')](channels[_0x5bc61a[_0x9f93('0x6')]])&&!_[_0x9f93('0x12')](channels[_0x5bc61a['channel']][_0x9f93('0x21')])){channels[_0x5bc61a['channel']]['accountcode']=_0x5bc61a['connectedlinenum'];}};exports[_0x9f93('0x2a')]=function(_0x1596dc){if(!_[_0x9f93('0x12')](channels[_0x1596dc[_0x9f93('0x6')]])){if(_['isNil'](timeouts[_0x1596dc['channel']])){channels[_0x1596dc[_0x9f93('0x6')]]=_[_0x9f93('0x2d')](_0x1596dc,channels[_0x1596dc[_0x9f93('0x6')]]);}else{clearTimeout(timeouts[_0x1596dc[_0x9f93('0x6')]]);channels[_0x1596dc[_0x9f93('0x6')]]=_[_0x9f93('0x2d')](channels[_0x1596dc[_0x9f93('0x6')]],{'starttime':utils['isBefore'](_0x1596dc[_0x9f93('0x2e')],channels[_0x1596dc[_0x9f93('0x6')]][_0x9f93('0x2e')])?_0x1596dc[_0x9f93('0x2e')]:channels[_0x1596dc[_0x9f93('0x6')]][_0x9f93('0x2e')],'answertime':utils[_0x9f93('0x2f')](_0x1596dc[_0x9f93('0x2')],channels[_0x1596dc[_0x9f93('0x6')]][_0x9f93('0x2')])?_0x1596dc[_0x9f93('0x2')]:channels[_0x1596dc['channel']][_0x9f93('0x2')]});if(utils[_0x9f93('0x30')](_0x1596dc[_0x9f93('0x31')],channels[_0x1596dc[_0x9f93('0x6')]]['endtime'])){channels[_0x1596dc[_0x9f93('0x6')]]=_[_0x9f93('0x2d')](channels[_0x1596dc[_0x9f93('0x6')]],{'endtime':_0x1596dc[_0x9f93('0x31')],'destinationchannel':_[_0x9f93('0x28')](_0x1596dc[_0x9f93('0x32')],_0x9f93('0x33'))?channels[_0x1596dc[_0x9f93('0x6')]]['destinationchannel']:_0x1596dc[_0x9f93('0x32')]});}channels[_0x1596dc[_0x9f93('0x6')]][_0x9f93('0x34')]=utils[_0x9f93('0x35')](channels[_0x1596dc['channel']][_0x9f93('0x31')],channels[_0x1596dc[_0x9f93('0x6')]][_0x9f93('0x2e')]);channels[_0x1596dc['channel']][_0x9f93('0x36')]=utils[_0x9f93('0x35')](channels[_0x1596dc[_0x9f93('0x6')]][_0x9f93('0x31')],channels[_0x1596dc['channel']][_0x9f93('0x2')]);if(_0x1596dc[_0x9f93('0x1e')][_0x9f93('0x27')]()!=_0x9f93('0x37')){channels[_0x1596dc[_0x9f93('0x6')]][_0x9f93('0x20')]=_0x1596dc[_0x9f93('0x20')];channels[_0x1596dc['channel']][_0x9f93('0x1e')]=_0x1596dc[_0x9f93('0x1e')];}}timeouts[_0x1596dc[_0x9f93('0x6')]]=setTimeout(writeDB(channels[_0x1596dc[_0x9f93('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 104bcc4..9a09972 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 _0x238b=['shutdown','SHUTDOWN','fullybooted','info','FULLYBOOTED','error','close','CLOSE','./utils','connect','CONNECTED'];(function(_0x5fb438,_0x5739ec){var _0x2a4517=function(_0x1bd16e){while(--_0x1bd16e){_0x5fb438['push'](_0x5fb438['shift']());}};_0x2a4517(++_0x5739ec);}(_0x238b,0x194));var _0xb238=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x238b[_0x14add3];return _0x4a174f;};'use strict';var utils=require(_0xb238('0x0'));exports[_0xb238('0x1')]=function(){utils['info'](_0xb238('0x2'));};exports[_0xb238('0x3')]=function(){utils['info'](_0xb238('0x4'));};exports[_0xb238('0x5')]=function(){utils[_0xb238('0x6')](_0xb238('0x7'));};exports[_0xb238('0x8')]=function(_0x6153ee){utils['error'](_0x6153ee);};exports[_0xb238('0x9')]=function(){utils[_0xb238('0x6')](_0xb238('0xa'));};exports['managerevent']=function(_0x2d9e15){}; \ No newline at end of file +var _0x0b5c=['SHUTDOWN','FULLYBOOTED','error','close','managerevent','./utils','info','CONNECTED','shutdown'];(function(_0x22ee2e,_0x38048d){var _0x313cc8=function(_0x25c17a){while(--_0x25c17a){_0x22ee2e['push'](_0x22ee2e['shift']());}};_0x313cc8(++_0x38048d);}(_0x0b5c,0x83));var _0xc0b5=function(_0x2440df,_0x453be8){_0x2440df=_0x2440df-0x0;var _0x1fa6fb=_0x0b5c[_0x2440df];return _0x1fa6fb;};'use strict';var utils=require(_0xc0b5('0x0'));exports['connect']=function(){utils[_0xc0b5('0x1')](_0xc0b5('0x2'));};exports[_0xc0b5('0x3')]=function(){utils['info'](_0xc0b5('0x4'));};exports['fullybooted']=function(){utils[_0xc0b5('0x1')](_0xc0b5('0x5'));};exports[_0xc0b5('0x6')]=function(_0x24c3fd){utils['error'](_0x24c3fd);};exports[_0xc0b5('0x7')]=function(){utils[_0xc0b5('0x1')]('CLOSE');};exports[_0xc0b5('0x8')]=function(_0x19c42b){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c5f6792..b3c5ec9 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(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x34e29e,_0x3d6df5){var _0x4d0088=function(_0x317af6){while(--_0x317af6){_0x34e29e['push'](_0x34e29e['shift']());}};_0x4d0088(++_0x3d6df5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 0fa7892..3c78cda 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 _0x3685=['username','keepConnected','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','./utils','asterisk'];(function(_0x1d77f8,_0x4a3f30){var _0x74c134=function(_0x384968){while(--_0x384968){_0x1d77f8['push'](_0x1d77f8['shift']());}};_0x74c134(++_0x4a3f30);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};var AsteriskManager=require(_0x5368('0x0'));var config=require('../../config/environment');var agents=require(_0x5368('0x1'));var calls=require(_0x5368('0x2'));var queues=require(_0x5368('0x3'));var recordings=require(_0x5368('0x4'));var members=require(_0x5368('0x5'));var dials=require(_0x5368('0x6'));var transfers=require(_0x5368('0x7'));var core=require(_0x5368('0x8'));var utils=require(_0x5368('0x9'));var ami=new AsteriskManager(config[_0x5368('0xa')]['port'],config[_0x5368('0xa')]['ip'],config[_0x5368('0xa')][_0x5368('0xb')],config[_0x5368('0xa')]['password'],!![]);ami[_0x5368('0xc')]();ami['on'](_0x5368('0xd'),core[_0x5368('0xd')]);ami['on'](_0x5368('0xe'),core[_0x5368('0xe')]);ami['on'](_0x5368('0xf'),core[_0x5368('0xf')]);ami['on'](_0x5368('0x10'),core['error']);ami['on'](_0x5368('0x11'),core[_0x5368('0x11')]);ami['on'](_0x5368('0x12'),core['managerevent']);ami['on'](_0x5368('0x13'),function(_0x1cd07b){try{members['devicestatechange'](_0x1cd07b);}catch(_0x5d6a86){utils['error'](_0x5d6a86);}});ami['on'](_0x5368('0x14'),function(_0x28d957){try{agents[_0x5368('0x14')](_0x28d957);}catch(_0x5df43){utils[_0x5368('0x10')](_0x5df43);}});ami['on'](_0x5368('0x15'),function(_0x173cd2){try{agents[_0x5368('0x15')](_0x173cd2);}catch(_0x3a3b8e){utils[_0x5368('0x10')](_0x3a3b8e);}});ami['on']('agentconnect',function(_0x41ce0e){try{agents[_0x5368('0x16')](_0x41ce0e);recordings['agentconnect'](_0x41ce0e);queues[_0x5368('0x16')](_0x41ce0e);}catch(_0x1c04bd){utils[_0x5368('0x10')](_0x1c04bd);}});ami['on'](_0x5368('0x17'),function(_0x5b10e9){try{agents[_0x5368('0x17')](_0x5b10e9);queues['agentcomplete'](_0x5b10e9);members['agentcomplete'](_0x5b10e9);calls[_0x5368('0x17')](_0x5b10e9);}catch(_0x5e1398){utils['error'](_0x5e1398);}});ami['on']('queuecallerabandon',function(_0x39ad38){try{agents[_0x5368('0x18')](_0x39ad38);queues[_0x5368('0x18')](_0x39ad38);}catch(_0x5cef40){utils['error'](_0x5cef40);}});ami['on'](_0x5368('0x19'),function(_0x3c891a){try{queues[_0x5368('0x19')](_0x3c891a);}catch(_0x38f367){utils[_0x5368('0x10')](_0x38f367);}});ami['on'](_0x5368('0x1a'),function(_0x4885d0){try{queues[_0x5368('0x1a')](_0x4885d0);}catch(_0x380945){utils[_0x5368('0x10')](_0x380945);}});ami['on']('musiconholdstart',function(_0x45884f){try{queues[_0x5368('0x1b')](_0x45884f);calls[_0x5368('0x1b')](_0x45884f);}catch(_0x30d098){utils[_0x5368('0x10')](_0x30d098);}});ami['on'](_0x5368('0x1c'),function(_0xabac8c){try{queues[_0x5368('0x1c')](_0xabac8c);calls[_0x5368('0x1c')](_0xabac8c);}catch(_0x569d81){utils['error'](_0x569d81);}});ami['on'](_0x5368('0x1d'),function(_0x229e5){try{calls[_0x5368('0x1d')](_0x229e5);agents[_0x5368('0x1d')](_0x229e5);queues[_0x5368('0x1d')](_0x229e5);recordings['cdr'](_0x229e5);dials[_0x5368('0x1d')](_0x229e5);members[_0x5368('0x1d')](_0x229e5);}catch(_0x2e18e0){utils[_0x5368('0x10')](_0x2e18e0);}});ami['on'](_0x5368('0x1e'),function(_0x3af128){try{queues[_0x5368('0x1e')](_0x3af128);agents[_0x5368('0x1e')](_0x3af128);transfers[_0x5368('0x1e')](_0x3af128);}catch(_0x3c8ae1){utils[_0x5368('0x10')](_0x3c8ae1);}});ami['on'](_0x5368('0x1f'),function(_0x7449cd){try{queues['attendedtransfer'](_0x7449cd);transfers[_0x5368('0x1f')](_0x7449cd);agents[_0x5368('0x1f')](_0x7449cd);}catch(_0x36e230){utils['error'](_0x36e230);}});ami['on'](_0x5368('0x20'),function(_0x50131a){try{queues[_0x5368('0x20')](_0x50131a);recordings[_0x5368('0x20')](_0x50131a);calls['varset'](_0x50131a);dials[_0x5368('0x20')](_0x50131a);}catch(_0x1ce386){utils['error'](_0x1ce386);}});ami['on']('newexten',function(_0x32a50e){try{calls[_0x5368('0x21')](_0x32a50e);dials['newexten'](_0x32a50e);}catch(_0x46169e){utils[_0x5368('0x10')](_0x46169e);}});ami['on'](_0x5368('0x22'),function(_0x4dc0ee){try{calls[_0x5368('0x22')](_0x4dc0ee);dials['newchannel'](_0x4dc0ee);}catch(_0x22b489){utils[_0x5368('0x10')](_0x22b489);}});ami['on'](_0x5368('0x23'),function(_0x5f44d2){try{dials[_0x5368('0x23')](_0x5f44d2);}catch(_0x20c1f2){utils[_0x5368('0x10')](_0x20c1f2);}});ami['on'](_0x5368('0x24'),function(_0x5ea3ac){try{dials[_0x5368('0x24')](_0x5ea3ac);}catch(_0x4d016f){utils[_0x5368('0x10')](_0x4d016f);}}); \ No newline at end of file +var _0xf14b=['./dials.controller','./transfers.controller','./core.controller','asterisk','port','username','password','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller'];(function(_0x4583c1,_0x13dbc7){var _0x2583fa=function(_0x545b5b){while(--_0x545b5b){_0x4583c1['push'](_0x4583c1['shift']());}};_0x2583fa(++_0x13dbc7);}(_0xf14b,0xdd));var _0xbf14=function(_0x2694f6,_0x31b042){_0x2694f6=_0x2694f6-0x0;var _0x13ab43=_0xf14b[_0x2694f6];return _0x13ab43;};var AsteriskManager=require(_0xbf14('0x0'));var config=require(_0xbf14('0x1'));var agents=require(_0xbf14('0x2'));var calls=require(_0xbf14('0x3'));var queues=require(_0xbf14('0x4'));var recordings=require(_0xbf14('0x5'));var members=require(_0xbf14('0x6'));var dials=require(_0xbf14('0x7'));var transfers=require(_0xbf14('0x8'));var core=require(_0xbf14('0x9'));var utils=require('./utils');var ami=new AsteriskManager(config[_0xbf14('0xa')][_0xbf14('0xb')],config[_0xbf14('0xa')]['ip'],config[_0xbf14('0xa')][_0xbf14('0xc')],config[_0xbf14('0xa')][_0xbf14('0xd')],!![]);ami['keepConnected']();ami['on'](_0xbf14('0xe'),core[_0xbf14('0xe')]);ami['on'](_0xbf14('0xf'),core['shutdown']);ami['on']('fullybooted',core[_0xbf14('0x10')]);ami['on'](_0xbf14('0x11'),core[_0xbf14('0x11')]);ami['on'](_0xbf14('0x12'),core[_0xbf14('0x12')]);ami['on'](_0xbf14('0x13'),core['managerevent']);ami['on']('devicestatechange',function(_0x489c04){try{members[_0xbf14('0x14')](_0x489c04);}catch(_0x29a064){utils[_0xbf14('0x11')](_0x29a064);}});ami['on'](_0xbf14('0x15'),function(_0x10b52e){try{agents[_0xbf14('0x15')](_0x10b52e);}catch(_0x3b5644){utils[_0xbf14('0x11')](_0x3b5644);}});ami['on'](_0xbf14('0x16'),function(_0x8eaece){try{agents['agentringnoanswer'](_0x8eaece);}catch(_0x31d032){utils[_0xbf14('0x11')](_0x31d032);}});ami['on'](_0xbf14('0x17'),function(_0x4a7490){try{agents[_0xbf14('0x17')](_0x4a7490);recordings[_0xbf14('0x17')](_0x4a7490);queues['agentconnect'](_0x4a7490);}catch(_0x117524){utils[_0xbf14('0x11')](_0x117524);}});ami['on'](_0xbf14('0x18'),function(_0x401db1){try{agents['agentcomplete'](_0x401db1);queues[_0xbf14('0x18')](_0x401db1);members[_0xbf14('0x18')](_0x401db1);calls[_0xbf14('0x18')](_0x401db1);}catch(_0x5283b1){utils[_0xbf14('0x11')](_0x5283b1);}});ami['on'](_0xbf14('0x19'),function(_0x1ecaf6){try{agents[_0xbf14('0x19')](_0x1ecaf6);queues[_0xbf14('0x19')](_0x1ecaf6);}catch(_0x67a572){utils['error'](_0x67a572);}});ami['on'](_0xbf14('0x1a'),function(_0x4b3e6f){try{queues[_0xbf14('0x1a')](_0x4b3e6f);}catch(_0x419696){utils[_0xbf14('0x11')](_0x419696);}});ami['on'](_0xbf14('0x1b'),function(_0x2b20b4){try{queues[_0xbf14('0x1b')](_0x2b20b4);}catch(_0x8c3ccc){utils[_0xbf14('0x11')](_0x8c3ccc);}});ami['on'](_0xbf14('0x1c'),function(_0x55b494){try{queues[_0xbf14('0x1c')](_0x55b494);calls['musiconholdstart'](_0x55b494);}catch(_0xdee1df){utils[_0xbf14('0x11')](_0xdee1df);}});ami['on'](_0xbf14('0x1d'),function(_0x5c812b){try{queues['musiconholdstop'](_0x5c812b);calls[_0xbf14('0x1d')](_0x5c812b);}catch(_0x265ae0){utils[_0xbf14('0x11')](_0x265ae0);}});ami['on']('cdr',function(_0x4d2421){try{calls[_0xbf14('0x1e')](_0x4d2421);agents[_0xbf14('0x1e')](_0x4d2421);queues[_0xbf14('0x1e')](_0x4d2421);recordings[_0xbf14('0x1e')](_0x4d2421);dials[_0xbf14('0x1e')](_0x4d2421);members[_0xbf14('0x1e')](_0x4d2421);}catch(_0x8aa8cc){utils['error'](_0x8aa8cc);}});ami['on'](_0xbf14('0x1f'),function(_0x766cb1){try{queues['blindtransfer'](_0x766cb1);agents[_0xbf14('0x1f')](_0x766cb1);transfers[_0xbf14('0x1f')](_0x766cb1);}catch(_0x20343c){utils['error'](_0x20343c);}});ami['on'](_0xbf14('0x20'),function(_0x292c10){try{queues[_0xbf14('0x20')](_0x292c10);transfers[_0xbf14('0x20')](_0x292c10);agents[_0xbf14('0x20')](_0x292c10);}catch(_0x4f6ac4){utils[_0xbf14('0x11')](_0x4f6ac4);}});ami['on'](_0xbf14('0x21'),function(_0x4bce0d){try{queues['varset'](_0x4bce0d);recordings[_0xbf14('0x21')](_0x4bce0d);calls[_0xbf14('0x21')](_0x4bce0d);dials[_0xbf14('0x21')](_0x4bce0d);}catch(_0x243ee6){utils[_0xbf14('0x11')](_0x243ee6);}});ami['on'](_0xbf14('0x22'),function(_0x271890){try{calls[_0xbf14('0x22')](_0x271890);dials[_0xbf14('0x22')](_0x271890);}catch(_0x4b1c56){utils[_0xbf14('0x11')](_0x4b1c56);}});ami['on']('newchannel',function(_0x37a77b){try{calls['newchannel'](_0x37a77b);dials[_0xbf14('0x23')](_0x37a77b);}catch(_0x18b8f6){utils[_0xbf14('0x11')](_0x18b8f6);}});ami['on'](_0xbf14('0x24'),function(_0x25cc5a){try{dials['dialbegin'](_0x25cc5a);}catch(_0x13c435){utils[_0xbf14('0x11')](_0x13c435);}});ami['on']('dialend',function(_0x18ae0d){try{dials[_0xbf14('0x25')](_0x18ae0d);}catch(_0x234494){utils[_0xbf14('0x11')](_0x234494);}}); \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 464bc13..0ae63a2 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 _0xfcb3=['CreateMemberReport','catch','error','some','startsWith','devicestatechange','INUSE','device','voice','agent','NOT_INUSE','duration','diffTime','exitAt','enterAt','isNil','assign','cdr','split','source','data3','destinationchannel','data1','destination','lodash','./utils','Local/_attended@transfer','info','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal'];(function(_0x1ae661,_0x3a7e42){var _0x11edfb=function(_0xe8870f){while(--_0xe8870f){_0x1ae661['push'](_0x1ae661['shift']());}};_0x11edfb(++_0x3a7e42);}(_0xfcb3,0x177));var _0x3fcb=function(_0x5f2705,_0x45d36d){_0x5f2705=_0x5f2705-0x0;var _0xbd9195=_0xfcb3[_0x5f2705];return _0xbd9195;};'use strict';var _=require(_0x3fcb('0x0'));var util=require('util');var utils=require(_0x3fcb('0x1'));var members={};var exclude=[_0x3fcb('0x2'),'Queue:'];function writeDB(_0x533386){utils[_0x3fcb('0x3')](util['format'](_0x3fcb('0x4'),_0x533386[_0x3fcb('0x5')],_0x533386[_0x3fcb('0x6')],_0x533386[_0x3fcb('0x7')],_0x533386[_0x3fcb('0x8')],_0x533386[_0x3fcb('0x9')],_0x533386[_0x3fcb('0xa')]));if(_0x533386['interface']){utils[_0x3fcb('0xb')](_0x533386[_0x3fcb('0x6')])[_0x3fcb('0xc')](function(_0x3f150a){if(_0x3f150a){_0x533386[_0x3fcb('0x9')]=_0x3f150a[_0x3fcb('0xd')];_0x533386[_0x3fcb('0xe')]=_0x3f150a[_0x3fcb('0xe')];utils['request']('CreateMemberReport',_0x533386);}else{utils['getUserByName'](_0x533386['interface']['split']('/')[0x1])['then'](function(_0x5592f8){if(_0x5592f8){_0x533386['membername']=_0x5592f8[_0x3fcb('0xd')];_0x533386[_0x3fcb('0xe')]=_0x5592f8[_0x3fcb('0xe')];utils['request'](_0x3fcb('0xf'),_0x533386);}});}})[_0x3fcb('0x10')](function(_0x5dc775){utils[_0x3fcb('0x11')](_0x5dc775);});}delete members[_0x533386['interface']];}function startsWith(_0x37e420,_0x5adda3){return _[_0x3fcb('0x12')](_0x37e420,function(_0x3eb130){return _[_0x3fcb('0x13')](_0x5adda3,_0x3eb130);});}exports[_0x3fcb('0x14')]=function(_0x58ab0b){switch(_0x58ab0b['state']){case _0x3fcb('0x15'):if(!startsWith(exclude,_0x58ab0b[_0x3fcb('0x16')])){members[_0x58ab0b[_0x3fcb('0x16')]]={'channel':_0x3fcb('0x17'),'interface':_0x58ab0b['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0x3fcb('0x18'),'data1':_0x3fcb('0xe')};}break;case _0x3fcb('0x19'):if(!_['isNil'](members[_0x58ab0b['device']])){members[_0x58ab0b[_0x3fcb('0x16')]]['exitAt']=utils['now']();members[_0x58ab0b['device']][_0x3fcb('0x1a')]=utils[_0x3fcb('0x1b')](members[_0x58ab0b[_0x3fcb('0x16')]][_0x3fcb('0x1c')],members[_0x58ab0b[_0x3fcb('0x16')]][_0x3fcb('0x1d')]);}default:break;}};exports['agentcomplete']=function(_0x5a2987){if(!_[_0x3fcb('0x1e')](members[_0x5a2987['interface']])){members[_0x5a2987[_0x3fcb('0x6')]]=_[_0x3fcb('0x1f')](members[_0x5a2987[_0x3fcb('0x6')]],{'data4':_0x5a2987['queue']});}};exports[_0x3fcb('0x20')]=function(_0x566d0e){if(_0x566d0e[_0x3fcb('0x7')]){var _0x2f6fb1=_0x566d0e[_0x3fcb('0x7')][_0x3fcb('0x21')]('-')[0x0];if(!_[_0x3fcb('0x1e')](members[_0x2f6fb1])){members[_0x2f6fb1]=_[_0x3fcb('0x1f')](members[_0x2f6fb1],{'data1':members[_0x2f6fb1]['data1']||_0x566d0e[_0x3fcb('0xa')],'data2':members[_0x2f6fb1][_0x3fcb('0x8')]||_0x566d0e[_0x3fcb('0x22')],'data3':members[_0x2f6fb1][_0x3fcb('0x23')]||_0x566d0e['destination'],'uniqueid':members[_0x2f6fb1][_0x3fcb('0x5')]||_0x566d0e[_0x3fcb('0x5')]});if(members[_0x2f6fb1][_0x3fcb('0x1c')]){writeDB(members[_0x2f6fb1]);}}}if(_0x566d0e[_0x3fcb('0x24')]){var _0xfbbc5c=_0x566d0e[_0x3fcb('0x24')][_0x3fcb('0x21')]('-')[0x0];if(!_[_0x3fcb('0x1e')](members[_0xfbbc5c])){members[_0xfbbc5c]=_['assign'](members[_0xfbbc5c],{'data1':members[_0xfbbc5c][_0x3fcb('0x25')]||_0x566d0e[_0x3fcb('0xa')],'data2':members[_0xfbbc5c][_0x3fcb('0x8')]||_0x566d0e[_0x3fcb('0x22')],'data3':members[_0xfbbc5c]['data3']||_0x566d0e[_0x3fcb('0x26')],'uniqueid':members[_0xfbbc5c][_0x3fcb('0x5')]||_0x566d0e['uniqueid']});if(members[_0xfbbc5c][_0x3fcb('0x1c')]){writeDB(members[_0xfbbc5c]);}}}}; \ No newline at end of file +var _0x9a48=['some','startsWith','devicestatechange','state','INUSE','device','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','assign','queue','cdr','data1','source','data3','destination','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','split','CreateMemberReport','catch'];(function(_0x3e0f97,_0x5e2b3d){var _0x572633=function(_0x3ced4f){while(--_0x3ced4f){_0x3e0f97['push'](_0x3e0f97['shift']());}};_0x572633(++_0x5e2b3d);}(_0x9a48,0x6f));var _0x89a4=function(_0x25de09,_0x96ed5a){_0x25de09=_0x25de09-0x0;var _0x3eda1e=_0x9a48[_0x25de09];return _0x3eda1e;};'use strict';var _=require(_0x89a4('0x0'));var util=require(_0x89a4('0x1'));var utils=require('./utils');var members={};var exclude=[_0x89a4('0x2'),_0x89a4('0x3')];function writeDB(_0x5ab139){utils[_0x89a4('0x4')](util[_0x89a4('0x5')](_0x89a4('0x6'),_0x5ab139[_0x89a4('0x7')],_0x5ab139[_0x89a4('0x8')],_0x5ab139[_0x89a4('0x9')],_0x5ab139[_0x89a4('0xa')],_0x5ab139[_0x89a4('0xb')],_0x5ab139[_0x89a4('0xc')]));if(_0x5ab139[_0x89a4('0x8')]){utils[_0x89a4('0xd')](_0x5ab139['interface'])[_0x89a4('0xe')](function(_0x36e186){if(_0x36e186){_0x5ab139[_0x89a4('0xb')]=_0x36e186[_0x89a4('0xf')];_0x5ab139[_0x89a4('0x10')]=_0x36e186['internal'];utils[_0x89a4('0x11')]('CreateMemberReport',_0x5ab139);}else{utils['getUserByName'](_0x5ab139[_0x89a4('0x8')][_0x89a4('0x12')]('/')[0x1])[_0x89a4('0xe')](function(_0xfdb341){if(_0xfdb341){_0x5ab139[_0x89a4('0xb')]=_0xfdb341[_0x89a4('0xf')];_0x5ab139['internal']=_0xfdb341[_0x89a4('0x10')];utils[_0x89a4('0x11')](_0x89a4('0x13'),_0x5ab139);}});}})[_0x89a4('0x14')](function(_0x268d70){utils['error'](_0x268d70);});}delete members[_0x5ab139[_0x89a4('0x8')]];}function startsWith(_0x2717d2,_0x418fc1){return _[_0x89a4('0x15')](_0x2717d2,function(_0x59cace){return _[_0x89a4('0x16')](_0x418fc1,_0x59cace);});}exports[_0x89a4('0x17')]=function(_0x798275){switch(_0x798275[_0x89a4('0x18')]){case _0x89a4('0x19'):if(!startsWith(exclude,_0x798275[_0x89a4('0x1a')])){members[_0x798275[_0x89a4('0x1a')]]={'channel':_0x89a4('0x1b'),'interface':_0x798275[_0x89a4('0x1a')],'type':_0x89a4('0x1c'),'enterAt':utils[_0x89a4('0x1d')](),'role':'agent','data1':_0x89a4('0x10')};}break;case _0x89a4('0x1e'):if(!_[_0x89a4('0x1f')](members[_0x798275[_0x89a4('0x1a')]])){members[_0x798275[_0x89a4('0x1a')]][_0x89a4('0x20')]=utils['now']();members[_0x798275[_0x89a4('0x1a')]][_0x89a4('0x21')]=utils[_0x89a4('0x22')](members[_0x798275[_0x89a4('0x1a')]][_0x89a4('0x20')],members[_0x798275[_0x89a4('0x1a')]][_0x89a4('0x23')]);}default:break;}};exports['agentcomplete']=function(_0x4ca299){if(!_[_0x89a4('0x1f')](members[_0x4ca299[_0x89a4('0x8')]])){members[_0x4ca299[_0x89a4('0x8')]]=_[_0x89a4('0x24')](members[_0x4ca299[_0x89a4('0x8')]],{'data4':_0x4ca299[_0x89a4('0x25')]});}};exports[_0x89a4('0x26')]=function(_0x4ca7d3){if(_0x4ca7d3['channel']){var _0x416ef9=_0x4ca7d3[_0x89a4('0x9')]['split']('-')[0x0];if(!_[_0x89a4('0x1f')](members[_0x416ef9])){members[_0x416ef9]=_[_0x89a4('0x24')](members[_0x416ef9],{'data1':members[_0x416ef9][_0x89a4('0x27')]||_0x4ca7d3[_0x89a4('0xc')],'data2':members[_0x416ef9]['data2']||_0x4ca7d3[_0x89a4('0x28')],'data3':members[_0x416ef9][_0x89a4('0x29')]||_0x4ca7d3[_0x89a4('0x2a')],'uniqueid':members[_0x416ef9][_0x89a4('0x7')]||_0x4ca7d3[_0x89a4('0x7')]});if(members[_0x416ef9][_0x89a4('0x20')]){writeDB(members[_0x416ef9]);}}}if(_0x4ca7d3['destinationchannel']){var _0x28c8a9=_0x4ca7d3[_0x89a4('0x2b')][_0x89a4('0x12')]('-')[0x0];if(!_[_0x89a4('0x1f')](members[_0x28c8a9])){members[_0x28c8a9]=_[_0x89a4('0x24')](members[_0x28c8a9],{'data1':members[_0x28c8a9][_0x89a4('0x27')]||_0x4ca7d3[_0x89a4('0xc')],'data2':members[_0x28c8a9]['data2']||_0x4ca7d3[_0x89a4('0x28')],'data3':members[_0x28c8a9][_0x89a4('0x29')]||_0x4ca7d3[_0x89a4('0x2a')],'uniqueid':members[_0x28c8a9][_0x89a4('0x7')]||_0x4ca7d3[_0x89a4('0x7')]});if(members[_0x28c8a9][_0x89a4('0x20')]){writeDB(members[_0x28c8a9]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 3ebc94e..572403f 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 _0x59f7=['secondtransfererchannel','transfereecalleridname','transfereecalleridnum','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','lodash','./utils','queue','lastAssignedTo','calleridnum','accountcode','then','type','request','CreateVoiceQueueReport','queuecallerjoin','clone','channel','assign','position','now','varset','isNil','variable','queuestatus','value','CONTINUE','toUpperCase','queuecallerabandon','ABANDONED','diffTime','queuecallerjoinAt','agentconnect','connectedlinenum','connectedlinename','membername','agentcomplete','transfer','COMPLETEDBY','blindtransfer','transfereechannel','BLIND','extension','transfereeuniqueid','BLINDTRANSFER','forIn','origtransfererchannel','transfertargetchannel','transfertargetcalleridname','ATTENDED','ATTENDEDTRANSFER','origtransfererexten','origtransfereruniqueid'];(function(_0x3301c2,_0x3f8369){var _0x1da11f=function(_0x19220d){while(--_0x19220d){_0x3301c2['push'](_0x3301c2['shift']());}};_0x1da11f(++_0x3f8369);}(_0x59f7,0x151));var _0x759f=function(_0x19b38c,_0x4ee4cc){_0x19b38c=_0x19b38c-0x0;var _0x1f055a=_0x59f7[_0x19b38c];return _0x1f055a;};'use strict';var _=require(_0x759f('0x0'));var util=require('util');var utils=require(_0x759f('0x1'));var queues={};var transfers={};function writeDB(_0x364aa6,_0x2e6078){utils['info'](util['format']('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x364aa6['uniqueid'],_0x364aa6['channel'],_0x364aa6[_0x759f('0x2')],_0x364aa6[_0x759f('0x3')],_0x364aa6[_0x759f('0x4')],_0x364aa6[_0x759f('0x5')],_0x364aa6['queuecallerexitreason']));if(_0x364aa6[_0x759f('0x2')]){utils['getVoiceQueueByName'](_0x364aa6[_0x759f('0x2')])[_0x759f('0x6')](function(_0x470a65){if(_0x470a65){_0x364aa6[_0x759f('0x7')]=_0x470a65['type'];}utils[_0x759f('0x8')](_0x759f('0x9'),_0x364aa6);});}else{utils[_0x759f('0x8')](_0x759f('0x9'),_0x364aa6);}if(_0x2e6078){delete queues[_0x364aa6['channel']];}}exports[_0x759f('0xa')]=function(_0x3656fb){if(!_['isNil'](queues[_0x3656fb['channel']])){writeDB(_[_0x759f('0xb')](queues[_0x3656fb[_0x759f('0xc')]]),![]);}queues[_0x3656fb[_0x759f('0xc')]]=_[_0x759f('0xd')](_0x3656fb,{'originalposition':_0x3656fb[_0x759f('0xe')],'queuecallerjoinAt':utils[_0x759f('0xf')](),'mohtime':0x0});};exports[_0x759f('0x10')]=function(_0x2bc5af){if(!_[_0x759f('0x11')](queues[_0x2bc5af[_0x759f('0xc')]])){if(!_[_0x759f('0x11')](_0x2bc5af[_0x759f('0x12')][_0x759f('0x13')])){if(_0x2bc5af[_0x759f('0x14')]!=_0x759f('0x15')){queues[_0x2bc5af[_0x759f('0xc')]]=_[_0x759f('0xd')](queues[_0x2bc5af[_0x759f('0xc')]],{'queuecallerabandon':![],'queuecallerabandonAt':null,'queuecallerexit':!![],'queuecallerexitAt':utils[_0x759f('0xf')](),'queuecallerexitreason':_0x2bc5af['value'][_0x759f('0x16')]()});}}}};exports[_0x759f('0x17')]=function(_0x2a38ad){var _0xcd97c1={'queuecallerabandon':!![],'queuecallerabandonAt':utils[_0x759f('0xf')](),'queuecallerexitreason':_0x759f('0x18')};if(!_[_0x759f('0x11')](queues[_0x2a38ad[_0x759f('0xc')]])){queues[_0x2a38ad[_0x759f('0xc')]]=_[_0x759f('0xd')](queues[_0x2a38ad[_0x759f('0xc')]],_0xcd97c1);}if(!_[_0x759f('0x11')](transfers[_0x2a38ad[_0x759f('0xc')]])){transfers[_0x2a38ad[_0x759f('0xc')]]=_[_0x759f('0xd')](transfers[_0x2a38ad['channel']],_0xcd97c1);}};exports['queuecallerleave']=function(_0x289e84){if(!_[_0x759f('0x11')](queues[_0x289e84[_0x759f('0xc')]])){queues[_0x289e84[_0x759f('0xc')]]=_[_0x759f('0xd')](queues[_0x289e84['channel']],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0x759f('0xf')](),'holdtime':utils[_0x759f('0x19')](utils['now'](),queues[_0x289e84[_0x759f('0xc')]]['queuecallerjoinAt'])});}if(!_['isNil'](transfers[_0x289e84[_0x759f('0xc')]])){transfers[_0x289e84[_0x759f('0xc')]]=_[_0x759f('0xd')](transfers[_0x289e84[_0x759f('0xc')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0x759f('0xf')](),'holdtime':utils[_0x759f('0x19')](utils[_0x759f('0xf')](),transfers[_0x289e84['channel']][_0x759f('0x1a')])});}};exports[_0x759f('0x1b')]=function(_0x4f1166){var _0x3bce04={'connectedlinenum':_0x4f1166[_0x759f('0x1c')],'connectedlinename':_0x4f1166[_0x759f('0x1d')],'assigned':!![],'lastAssignedTo':_0x4f1166[_0x759f('0x1e')]};if(!_[_0x759f('0x11')](queues[_0x4f1166[_0x759f('0xc')]])){queues[_0x4f1166[_0x759f('0xc')]]=_['assign'](queues[_0x4f1166[_0x759f('0xc')]],_0x3bce04);}if(!_[_0x759f('0x11')](transfers[_0x4f1166[_0x759f('0xc')]])){transfers[_0x4f1166['channel']]=_['assign'](transfers[_0x4f1166[_0x759f('0xc')]],_0x3bce04);}};exports[_0x759f('0x1f')]=function(_0x2cad79){var _0x53fff7={'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0x759f('0xf')]()};if(_0x2cad79['reason']!=_0x759f('0x20')){_0x53fff7['queuecallerexitreason']=_0x759f('0x21')+_0x2cad79['reason'][_0x759f('0x16')]();}if(!_[_0x759f('0x11')](queues[_0x2cad79[_0x759f('0xc')]])){queues[_0x2cad79['channel']]=_[_0x759f('0xd')](queues[_0x2cad79[_0x759f('0xc')]],_0x53fff7);writeDB(queues[_0x2cad79[_0x759f('0xc')]],!![]);}};exports[_0x759f('0x22')]=function(_0x3c74b5){if(!_[_0x759f('0x11')](queues[_0x3c74b5['transfereechannel']])){queues[_0x3c74b5[_0x759f('0x23')]]=_[_0x759f('0xd')](queues[_0x3c74b5[_0x759f('0x23')]],{'transfer':!![],'transfertype':_0x759f('0x24'),'transferexten':_0x3c74b5[_0x759f('0x25')],'transferuniqueid':_0x3c74b5[_0x759f('0x26')],'queuecallerexitreason':_0x759f('0x27')});}};exports['attendedtransfer']=function(_0x6e70f2){_[_0x759f('0x28')](queues,function(_0x2dd99e){if(_0x2dd99e['channel']==_0x6e70f2[_0x759f('0x29')]){transfers[_0x6e70f2[_0x759f('0x2a')]]=_[_0x759f('0xb')](_0x2dd99e);transfers[_0x6e70f2['transfertargetchannel']]=_[_0x759f('0xd')](transfers[_0x6e70f2[_0x759f('0x2a')]],{'queuecallerjoinAt':utils[_0x759f('0xf')](),'queuecallerleaveAt':utils[_0x759f('0xf')](),'channel':_0x6e70f2[_0x759f('0x2a')],'calleridname':_0x6e70f2[_0x759f('0x2b')],'calleridnum':_0x6e70f2['transfertargetcalleridnum'],'queuecallerenterreason':0x2});queues[_0x6e70f2[_0x759f('0x2a')]]=_[_0x759f('0xd')](queues[_0x6e70f2['transfertargetchannel']],{'transfer':!![],'transfertype':_0x759f('0x2c'),'queuecallerexitreason':_0x759f('0x2d'),'transferexten':_0x6e70f2[_0x759f('0x2e')],'transferuniqueid':_0x6e70f2[_0x759f('0x2f')]});queues[_0x6e70f2[_0x759f('0x29')]]=_[_0x759f('0xd')](queues[_0x6e70f2[_0x759f('0x29')]],{'queuecallerexitreason':_0x759f('0x2c'),'queuecallerenterreason':0x1});}else if(_0x2dd99e[_0x759f('0xc')]==_0x6e70f2[_0x759f('0x30')]){transfers[_0x6e70f2['transfereechannel']]=_['clone'](_0x2dd99e);transfers[_0x6e70f2['transfereechannel']]=_[_0x759f('0xd')](transfers[_0x6e70f2[_0x759f('0x23')]],{'queuecallerjoinAt':utils['now'](),'queuecallerleaveAt':utils['now'](),'channel':_0x6e70f2[_0x759f('0x23')],'calleridname':_0x6e70f2[_0x759f('0x31')],'calleridnum':_0x6e70f2[_0x759f('0x32')],'queuecallerenterreason':0x2});queues[_0x6e70f2[_0x759f('0x23')]]=_[_0x759f('0xd')](queues[_0x6e70f2[_0x759f('0x23')]],{'transfer':!![],'transfertype':_0x759f('0x2c'),'queuecallerexitreason':_0x759f('0x2d'),'transferexten':_0x6e70f2['secondtransfererexten'],'transferuniqueid':_0x6e70f2['secondtransfereruniqueid']});queues[_0x6e70f2[_0x759f('0x30')]]=_['assign'](queues[_0x6e70f2[_0x759f('0x30')]],{'queuecallerexitreason':'ATTENDED','queuecallerenterreason':0x1});}});};exports[_0x759f('0x33')]=function(_0x4b8be6){if(!_['isNil'](queues[_0x4b8be6[_0x759f('0xc')]])){queues[_0x4b8be6[_0x759f('0xc')]][_0x759f('0x34')]=utils[_0x759f('0xf')]();}};exports[_0x759f('0x35')]=function(_0x32a8b8){if(!_[_0x759f('0x11')](queues[_0x32a8b8['channel']])){if(!_[_0x759f('0x11')](queues[_0x32a8b8[_0x759f('0xc')]][_0x759f('0x34')])){queues[_0x32a8b8[_0x759f('0xc')]][_0x759f('0x36')]+=utils[_0x759f('0x19')](utils[_0x759f('0xf')](),queues[_0x32a8b8[_0x759f('0xc')]][_0x759f('0x34')]);delete queues[_0x32a8b8[_0x759f('0xc')]]['musiconholdstartAt'];}}};exports['cdr']=function(_0xada24){if(!_[_0x759f('0x11')](queues[_0xada24[_0x759f('0xc')]])){writeDB(queues[_0xada24['channel']],!![]);}if(!_[_0x759f('0x11')](transfers[_0xada24['channel']])){if(transfers[_0xada24[_0x759f('0xc')]]['assigned']){transfers[_0xada24[_0x759f('0xc')]]=_['assign'](transfers[_0xada24[_0x759f('0xc')]],{'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0x759f('0xf')](),'queuecallerexitreason':'COMPLETED'});}writeDB(transfers[_0xada24[_0x759f('0xc')]],![]);delete transfers[_0xada24[_0x759f('0xc')]];}}; \ No newline at end of file +var _0x747d=['musiconholdstart','musiconholdstop','musiconholdstartAt','assigned','COMPLETED','lodash','./utils','format','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','queuecallerjoin','isNil','clone','assign','position','now','varset','variable','queuestatus','value','toUpperCase','queuecallerabandon','ABANDONED','queuecallerleave','diffTime','queuecallerjoinAt','connectedlinenum','connectedlinename','agentcomplete','reason','transfer','COMPLETEDBY','blindtransfer','transfereechannel','BLIND','extension','transfereeuniqueid','BLINDTRANSFER','attendedtransfer','forIn','transfertargetchannel','ATTENDED','ATTENDEDTRANSFER','origtransfererexten','origtransfereruniqueid','origtransfererchannel','transfereecalleridname','transfereecalleridnum','secondtransfererexten','secondtransfereruniqueid','secondtransfererchannel'];(function(_0x21f8c1,_0x2f1aad){var _0x28b5e7=function(_0x444965){while(--_0x444965){_0x21f8c1['push'](_0x21f8c1['shift']());}};_0x28b5e7(++_0x2f1aad);}(_0x747d,0x167));var _0xd747=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x747d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd747('0x0'));var util=require('util');var utils=require(_0xd747('0x1'));var queues={};var transfers={};function writeDB(_0x4f4ece,_0xd10d4b){utils['info'](util[_0xd747('0x2')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x4f4ece['uniqueid'],_0x4f4ece[_0xd747('0x3')],_0x4f4ece[_0xd747('0x4')],_0x4f4ece['lastAssignedTo'],_0x4f4ece[_0xd747('0x5')],_0x4f4ece[_0xd747('0x6')],_0x4f4ece[_0xd747('0x7')]));if(_0x4f4ece[_0xd747('0x4')]){utils[_0xd747('0x8')](_0x4f4ece[_0xd747('0x4')])[_0xd747('0x9')](function(_0x34a85a){if(_0x34a85a){_0x4f4ece[_0xd747('0xa')]=_0x34a85a['type'];}utils[_0xd747('0xb')](_0xd747('0xc'),_0x4f4ece);});}else{utils[_0xd747('0xb')](_0xd747('0xc'),_0x4f4ece);}if(_0xd10d4b){delete queues[_0x4f4ece[_0xd747('0x3')]];}}exports[_0xd747('0xd')]=function(_0xe380f7){if(!_[_0xd747('0xe')](queues[_0xe380f7['channel']])){writeDB(_[_0xd747('0xf')](queues[_0xe380f7['channel']]),![]);}queues[_0xe380f7[_0xd747('0x3')]]=_[_0xd747('0x10')](_0xe380f7,{'originalposition':_0xe380f7[_0xd747('0x11')],'queuecallerjoinAt':utils[_0xd747('0x12')](),'mohtime':0x0});};exports[_0xd747('0x13')]=function(_0x69335a){if(!_[_0xd747('0xe')](queues[_0x69335a[_0xd747('0x3')]])){if(!_['isNil'](_0x69335a[_0xd747('0x14')][_0xd747('0x15')])){if(_0x69335a[_0xd747('0x16')]!='CONTINUE'){queues[_0x69335a[_0xd747('0x3')]]=_[_0xd747('0x10')](queues[_0x69335a[_0xd747('0x3')]],{'queuecallerabandon':![],'queuecallerabandonAt':null,'queuecallerexit':!![],'queuecallerexitAt':utils[_0xd747('0x12')](),'queuecallerexitreason':_0x69335a[_0xd747('0x16')][_0xd747('0x17')]()});}}}};exports[_0xd747('0x18')]=function(_0x5b8462){var _0x11791e={'queuecallerabandon':!![],'queuecallerabandonAt':utils[_0xd747('0x12')](),'queuecallerexitreason':_0xd747('0x19')};if(!_[_0xd747('0xe')](queues[_0x5b8462[_0xd747('0x3')]])){queues[_0x5b8462[_0xd747('0x3')]]=_[_0xd747('0x10')](queues[_0x5b8462[_0xd747('0x3')]],_0x11791e);}if(!_[_0xd747('0xe')](transfers[_0x5b8462[_0xd747('0x3')]])){transfers[_0x5b8462[_0xd747('0x3')]]=_[_0xd747('0x10')](transfers[_0x5b8462[_0xd747('0x3')]],_0x11791e);}};exports[_0xd747('0x1a')]=function(_0x245765){if(!_[_0xd747('0xe')](queues[_0x245765[_0xd747('0x3')]])){queues[_0x245765[_0xd747('0x3')]]=_['assign'](queues[_0x245765[_0xd747('0x3')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0xd747('0x12')](),'holdtime':utils[_0xd747('0x1b')](utils['now'](),queues[_0x245765[_0xd747('0x3')]][_0xd747('0x1c')])});}if(!_[_0xd747('0xe')](transfers[_0x245765[_0xd747('0x3')]])){transfers[_0x245765[_0xd747('0x3')]]=_['assign'](transfers[_0x245765['channel']],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0xd747('0x12')](),'holdtime':utils[_0xd747('0x1b')](utils[_0xd747('0x12')](),transfers[_0x245765[_0xd747('0x3')]]['queuecallerjoinAt'])});}};exports['agentconnect']=function(_0x450898){var _0x4d8aae={'connectedlinenum':_0x450898[_0xd747('0x1d')],'connectedlinename':_0x450898[_0xd747('0x1e')],'assigned':!![],'lastAssignedTo':_0x450898['membername']};if(!_[_0xd747('0xe')](queues[_0x450898[_0xd747('0x3')]])){queues[_0x450898[_0xd747('0x3')]]=_[_0xd747('0x10')](queues[_0x450898[_0xd747('0x3')]],_0x4d8aae);}if(!_['isNil'](transfers[_0x450898['channel']])){transfers[_0x450898[_0xd747('0x3')]]=_[_0xd747('0x10')](transfers[_0x450898['channel']],_0x4d8aae);}};exports[_0xd747('0x1f')]=function(_0x3618c0){var _0x55e8ed={'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0xd747('0x12')]()};if(_0x3618c0[_0xd747('0x20')]!=_0xd747('0x21')){_0x55e8ed[_0xd747('0x7')]=_0xd747('0x22')+_0x3618c0[_0xd747('0x20')][_0xd747('0x17')]();}if(!_[_0xd747('0xe')](queues[_0x3618c0[_0xd747('0x3')]])){queues[_0x3618c0[_0xd747('0x3')]]=_[_0xd747('0x10')](queues[_0x3618c0[_0xd747('0x3')]],_0x55e8ed);writeDB(queues[_0x3618c0[_0xd747('0x3')]],!![]);}};exports[_0xd747('0x23')]=function(_0x2b43d9){if(!_['isNil'](queues[_0x2b43d9[_0xd747('0x24')]])){queues[_0x2b43d9['transfereechannel']]=_[_0xd747('0x10')](queues[_0x2b43d9[_0xd747('0x24')]],{'transfer':!![],'transfertype':_0xd747('0x25'),'transferexten':_0x2b43d9[_0xd747('0x26')],'transferuniqueid':_0x2b43d9[_0xd747('0x27')],'queuecallerexitreason':_0xd747('0x28')});}};exports[_0xd747('0x29')]=function(_0x5c9f98){_[_0xd747('0x2a')](queues,function(_0x197f77){if(_0x197f77[_0xd747('0x3')]==_0x5c9f98['origtransfererchannel']){transfers[_0x5c9f98['transfertargetchannel']]=_[_0xd747('0xf')](_0x197f77);transfers[_0x5c9f98[_0xd747('0x2b')]]=_[_0xd747('0x10')](transfers[_0x5c9f98[_0xd747('0x2b')]],{'queuecallerjoinAt':utils['now'](),'queuecallerleaveAt':utils[_0xd747('0x12')](),'channel':_0x5c9f98[_0xd747('0x2b')],'calleridname':_0x5c9f98['transfertargetcalleridname'],'calleridnum':_0x5c9f98['transfertargetcalleridnum'],'queuecallerenterreason':0x2});queues[_0x5c9f98[_0xd747('0x2b')]]=_[_0xd747('0x10')](queues[_0x5c9f98['transfertargetchannel']],{'transfer':!![],'transfertype':_0xd747('0x2c'),'queuecallerexitreason':_0xd747('0x2d'),'transferexten':_0x5c9f98[_0xd747('0x2e')],'transferuniqueid':_0x5c9f98[_0xd747('0x2f')]});queues[_0x5c9f98[_0xd747('0x30')]]=_[_0xd747('0x10')](queues[_0x5c9f98[_0xd747('0x30')]],{'queuecallerexitreason':_0xd747('0x2c'),'queuecallerenterreason':0x1});}else if(_0x197f77[_0xd747('0x3')]==_0x5c9f98['secondtransfererchannel']){transfers[_0x5c9f98['transfereechannel']]=_[_0xd747('0xf')](_0x197f77);transfers[_0x5c9f98[_0xd747('0x24')]]=_[_0xd747('0x10')](transfers[_0x5c9f98[_0xd747('0x24')]],{'queuecallerjoinAt':utils[_0xd747('0x12')](),'queuecallerleaveAt':utils[_0xd747('0x12')](),'channel':_0x5c9f98[_0xd747('0x24')],'calleridname':_0x5c9f98[_0xd747('0x31')],'calleridnum':_0x5c9f98[_0xd747('0x32')],'queuecallerenterreason':0x2});queues[_0x5c9f98['transfereechannel']]=_[_0xd747('0x10')](queues[_0x5c9f98[_0xd747('0x24')]],{'transfer':!![],'transfertype':_0xd747('0x2c'),'queuecallerexitreason':'ATTENDEDTRANSFER','transferexten':_0x5c9f98[_0xd747('0x33')],'transferuniqueid':_0x5c9f98[_0xd747('0x34')]});queues[_0x5c9f98[_0xd747('0x35')]]=_[_0xd747('0x10')](queues[_0x5c9f98[_0xd747('0x35')]],{'queuecallerexitreason':_0xd747('0x2c'),'queuecallerenterreason':0x1});}});};exports[_0xd747('0x36')]=function(_0x113272){if(!_['isNil'](queues[_0x113272[_0xd747('0x3')]])){queues[_0x113272['channel']]['musiconholdstartAt']=utils[_0xd747('0x12')]();}};exports[_0xd747('0x37')]=function(_0x4503ce){if(!_[_0xd747('0xe')](queues[_0x4503ce[_0xd747('0x3')]])){if(!_[_0xd747('0xe')](queues[_0x4503ce[_0xd747('0x3')]][_0xd747('0x38')])){queues[_0x4503ce[_0xd747('0x3')]]['mohtime']+=utils[_0xd747('0x1b')](utils[_0xd747('0x12')](),queues[_0x4503ce[_0xd747('0x3')]][_0xd747('0x38')]);delete queues[_0x4503ce[_0xd747('0x3')]][_0xd747('0x38')];}}};exports['cdr']=function(_0x56c313){if(!_['isNil'](queues[_0x56c313['channel']])){writeDB(queues[_0x56c313[_0xd747('0x3')]],!![]);}if(!_['isNil'](transfers[_0x56c313['channel']])){if(transfers[_0x56c313[_0xd747('0x3')]][_0xd747('0x39')]){transfers[_0x56c313[_0xd747('0x3')]]=_[_0xd747('0x10')](transfers[_0x56c313[_0xd747('0x3')]],{'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0xd747('0x12')](),'queuecallerexitreason':_0xd747('0x3a')});}writeDB(transfers[_0x56c313[_0xd747('0x3')]],![]);delete transfers[_0x56c313[_0xd747('0x3')]];}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index cfa1c39..69e5130 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 _0xd892=['type','destinationchannel','destination','destinationcontext','uniqueid','connectedlinename','calleridnum','calleridname','lodash','debug','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','channel','isNil','variable','mixmonitor_filename','endsWith','value','.wav49','assign','agentconnect','queue','connectedlinenum'];(function(_0x489e91,_0x486720){var _0x1d78e5=function(_0x348d87){while(--_0x348d87){_0x489e91['push'](_0x489e91['shift']());}};_0x1d78e5(++_0x486720);}(_0xd892,0x158));var _0x2d89=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd892[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x2d89('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x2536a2){utils[_0x2d89('0x1')](_0x2536a2);if(_0x2536a2['accountcode']){utils['getUserByInternal'](_0x2536a2[_0x2d89('0x2')])[_0x2d89('0x3')](function(_0x2c99e8){if(_0x2c99e8){_0x2536a2[_0x2d89('0x4')]=_0x2c99e8[_0x2d89('0x5')];_0x2536a2[_0x2d89('0x6')]=_0x2c99e8['id'];}utils[_0x2d89('0x7')](_0x2d89('0x8'),_0x2536a2);});}else{utils[_0x2d89('0x7')]('CreateVoiceRecording',_0x2536a2);}if(recordings[_0x2536a2[_0x2d89('0x9')]]){delete recordings[_0x2536a2['channel']];}}exports['varset']=function(_0x961ac2){if(!_[_0x2d89('0xa')](_0x961ac2[_0x2d89('0xb')])&&!_[_0x2d89('0xa')](_0x961ac2['variable'][_0x2d89('0xc')])){if(!_[_0x2d89('0xa')](recordings[_0x961ac2['channel']])){writeDB(recordings[_0x961ac2[_0x2d89('0x9')]]);}if(_[_0x2d89('0xd')](_0x961ac2[_0x2d89('0xe')],_0x2d89('0xf'))){_0x961ac2[_0x2d89('0xe')]=_0x961ac2[_0x2d89('0xe')]['replace']('.wav49','.WAV');}recordings[_0x961ac2['channel']]=_[_0x2d89('0x10')](_0x961ac2,{});}};exports[_0x2d89('0x11')]=function(_0xc27906){if(!_[_0x2d89('0xa')](recordings[_0xc27906[_0x2d89('0x9')]])){recordings[_0xc27906[_0x2d89('0x9')]]=_['assign'](recordings[_0xc27906['channel']],{'membername':_0xc27906[_0x2d89('0x4')],'queue':_0xc27906[_0x2d89('0x12')],'accountcode':_0xc27906[_0x2d89('0x13')]});}};exports['cdr']=function(_0x339d82){if(!_[_0x2d89('0xa')](recordings[_0x339d82[_0x2d89('0x9')]])){recordings[_0x339d82[_0x2d89('0x9')]]=_['assign'](recordings[_0x339d82[_0x2d89('0x9')]],{'type':_0x339d82[_0x2d89('0x14')]});writeDB(recordings[_0x339d82[_0x2d89('0x9')]]);}else if(!_['isNil'](recordings[_0x339d82[_0x2d89('0x15')]])){recordings[_0x339d82[_0x2d89('0x9')]]=recordings[_0x339d82[_0x2d89('0x15')]];delete recordings[_0x339d82[_0x2d89('0x15')]];recordings[_0x339d82['channel']]=_['assign'](recordings[_0x339d82[_0x2d89('0x9')]],{'type':_0x339d82['type'],'channel':_0x339d82[_0x2d89('0x9')],'exten':_0x339d82[_0x2d89('0x16')],'context':_0x339d82[_0x2d89('0x17')],'uniqueid':_0x339d82[_0x2d89('0x18')],'calleridnum':recordings[_0x339d82['channel']][_0x2d89('0x13')],'calleridname':recordings[_0x339d82[_0x2d89('0x9')]][_0x2d89('0x19')],'connectedlinenum':recordings[_0x339d82['channel']][_0x2d89('0x1a')],'connectedlinename':recordings[_0x339d82[_0x2d89('0x9')]][_0x2d89('0x1b')]});writeDB(recordings[_0x339d82[_0x2d89('0x9')]]);}}; \ No newline at end of file +var _0xcdd5=['value','.wav49','replace','.WAV','assign','agentconnect','connectedlinenum','cdr','type','destinationchannel','uniqueid','calleridname','lodash','./utils','debug','getUserByInternal','then','membername','name','request','CreateVoiceRecording','channel','varset','isNil','variable','mixmonitor_filename','endsWith'];(function(_0x43f6e4,_0x2dc04e){var _0x443b13=function(_0xfcece8){while(--_0xfcece8){_0x43f6e4['push'](_0x43f6e4['shift']());}};_0x443b13(++_0x2dc04e);}(_0xcdd5,0x186));var _0x5cdd=function(_0x2456f7,_0x33072b){_0x2456f7=_0x2456f7-0x0;var _0x196522=_0xcdd5[_0x2456f7];return _0x196522;};'use strict';var _=require(_0x5cdd('0x0'));var utils=require(_0x5cdd('0x1'));var recordings={};function writeDB(_0x1eaa57){utils[_0x5cdd('0x2')](_0x1eaa57);if(_0x1eaa57['accountcode']){utils[_0x5cdd('0x3')](_0x1eaa57['accountcode'])[_0x5cdd('0x4')](function(_0x1752e0){if(_0x1752e0){_0x1eaa57[_0x5cdd('0x5')]=_0x1752e0[_0x5cdd('0x6')];_0x1eaa57['UserId']=_0x1752e0['id'];}utils[_0x5cdd('0x7')](_0x5cdd('0x8'),_0x1eaa57);});}else{utils[_0x5cdd('0x7')](_0x5cdd('0x8'),_0x1eaa57);}if(recordings[_0x1eaa57['channel']]){delete recordings[_0x1eaa57[_0x5cdd('0x9')]];}}exports[_0x5cdd('0xa')]=function(_0x4652d1){if(!_[_0x5cdd('0xb')](_0x4652d1['variable'])&&!_['isNil'](_0x4652d1[_0x5cdd('0xc')][_0x5cdd('0xd')])){if(!_[_0x5cdd('0xb')](recordings[_0x4652d1[_0x5cdd('0x9')]])){writeDB(recordings[_0x4652d1['channel']]);}if(_[_0x5cdd('0xe')](_0x4652d1[_0x5cdd('0xf')],_0x5cdd('0x10'))){_0x4652d1[_0x5cdd('0xf')]=_0x4652d1[_0x5cdd('0xf')][_0x5cdd('0x11')](_0x5cdd('0x10'),_0x5cdd('0x12'));}recordings[_0x4652d1['channel']]=_[_0x5cdd('0x13')](_0x4652d1,{});}};exports[_0x5cdd('0x14')]=function(_0x4887fc){if(!_[_0x5cdd('0xb')](recordings[_0x4887fc[_0x5cdd('0x9')]])){recordings[_0x4887fc['channel']]=_[_0x5cdd('0x13')](recordings[_0x4887fc[_0x5cdd('0x9')]],{'membername':_0x4887fc[_0x5cdd('0x5')],'queue':_0x4887fc['queue'],'accountcode':_0x4887fc[_0x5cdd('0x15')]});}};exports[_0x5cdd('0x16')]=function(_0x529428){if(!_[_0x5cdd('0xb')](recordings[_0x529428[_0x5cdd('0x9')]])){recordings[_0x529428['channel']]=_[_0x5cdd('0x13')](recordings[_0x529428[_0x5cdd('0x9')]],{'type':_0x529428[_0x5cdd('0x17')]});writeDB(recordings[_0x529428[_0x5cdd('0x9')]]);}else if(!_[_0x5cdd('0xb')](recordings[_0x529428[_0x5cdd('0x18')]])){recordings[_0x529428[_0x5cdd('0x9')]]=recordings[_0x529428[_0x5cdd('0x18')]];delete recordings[_0x529428[_0x5cdd('0x18')]];recordings[_0x529428[_0x5cdd('0x9')]]=_[_0x5cdd('0x13')](recordings[_0x529428[_0x5cdd('0x9')]],{'type':_0x529428[_0x5cdd('0x17')],'channel':_0x529428[_0x5cdd('0x9')],'exten':_0x529428['destination'],'context':_0x529428['destinationcontext'],'uniqueid':_0x529428[_0x5cdd('0x19')],'calleridnum':recordings[_0x529428[_0x5cdd('0x9')]][_0x5cdd('0x15')],'calleridname':recordings[_0x529428[_0x5cdd('0x9')]]['connectedlinename'],'connectedlinenum':recordings[_0x529428[_0x5cdd('0x9')]]['calleridnum'],'connectedlinename':recordings[_0x529428['channel']][_0x5cdd('0x1a')]});writeDB(recordings[_0x529428[_0x5cdd('0x9')]]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 322ab49..d0987e1 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 _0x1e1d=['type','request','blind','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','lodash','./utils','info','format'];(function(_0x5802da,_0x3514cf){var _0x590954=function(_0xf8333d){while(--_0xf8333d){_0x5802da['push'](_0x5802da['shift']());}};_0x590954(++_0x3514cf);}(_0x1e1d,0x1f4));var _0xd1e1=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x1e1d[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xd1e1('0x0'));var util=require('util');var utils=require(_0xd1e1('0x1'));function writeDB(_0x496f68){utils[_0xd1e1('0x2')](util[_0xd1e1('0x3')]('TRANSFER|%s',_0x496f68[_0xd1e1('0x4')]));utils[_0xd1e1('0x5')]('CreateVoiceTransferReport',_0x496f68);}exports['blindtransfer']=function(_0x58a2c8){_0x58a2c8[_0xd1e1('0x4')]=_0xd1e1('0x6');writeDB(_0x58a2c8);};exports[_0xd1e1('0x7')]=function(_0x4d42cb){_0x4d42cb=_[_0xd1e1('0x8')](_0x4d42cb,{'transfererchannel':_0x4d42cb[_0xd1e1('0x9')],'transferercalleridnum':_0x4d42cb[_0xd1e1('0xa')],'transferercalleridname':_0x4d42cb[_0xd1e1('0xb')],'transfererconnectedlinenum':_0x4d42cb[_0xd1e1('0xc')],'transfererconnectedlinename':_0x4d42cb[_0xd1e1('0xd')],'transfereraccountcode':_0x4d42cb['origtransfereraccountcode'],'transferercontext':_0x4d42cb[_0xd1e1('0xe')],'transfererexten':_0x4d42cb[_0xd1e1('0xf')],'transfererlinkedid':_0x4d42cb['origtransfererlinkedid'],'context':_0x4d42cb[_0xd1e1('0x10')],'extension':_0x4d42cb[_0xd1e1('0x11')],'type':_0xd1e1('0x12')});if(_[_0xd1e1('0x13')](_0x4d42cb[_0xd1e1('0x14')])){_0x4d42cb=_[_0xd1e1('0x8')](_0x4d42cb,{'transfereechannel':_0x4d42cb[_0xd1e1('0x15')],'transfereecalleridnum':_0x4d42cb[_0xd1e1('0x16')],'transfereecalleridname':_0x4d42cb[_0xd1e1('0x17')],'transfereeconnectedlinenum':_0x4d42cb[_0xd1e1('0x18')],'transfereeconnectedlinename':_0x4d42cb[_0xd1e1('0x19')],'transfereeaccountcode':_0x4d42cb[_0xd1e1('0x1a')],'transfereecontext':_0x4d42cb['transfertargetcontext'],'transfereeexten':_0x4d42cb['transfertargetexten'],'transfereelinkedid':_0x4d42cb[_0xd1e1('0x1b')]});}writeDB(_0x4d42cb);}; \ No newline at end of file +var _0x9d92=['origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid','util','info','format','type','request','CreateVoiceTransferReport','blindtransfer','blind','attendedtransfer','assign','origtransfererchannel'];(function(_0x5efa7a,_0x25efcc){var _0x5db4e1=function(_0x521f4b){while(--_0x521f4b){_0x5efa7a['push'](_0x5efa7a['shift']());}};_0x5db4e1(++_0x25efcc);}(_0x9d92,0x12d));var _0x29d9=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x9d92[_0x507c81];return _0x368a25;};'use strict';var _=require('lodash');var util=require(_0x29d9('0x0'));var utils=require('./utils');function writeDB(_0x18b060){utils[_0x29d9('0x1')](util[_0x29d9('0x2')]('TRANSFER|%s',_0x18b060[_0x29d9('0x3')]));utils[_0x29d9('0x4')](_0x29d9('0x5'),_0x18b060);}exports[_0x29d9('0x6')]=function(_0x2b30d8){_0x2b30d8[_0x29d9('0x3')]=_0x29d9('0x7');writeDB(_0x2b30d8);};exports[_0x29d9('0x8')]=function(_0x1b0a3a){_0x1b0a3a=_[_0x29d9('0x9')](_0x1b0a3a,{'transfererchannel':_0x1b0a3a[_0x29d9('0xa')],'transferercalleridnum':_0x1b0a3a['origtransferercalleridnum'],'transferercalleridname':_0x1b0a3a[_0x29d9('0xb')],'transfererconnectedlinenum':_0x1b0a3a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1b0a3a[_0x29d9('0xc')],'transfereraccountcode':_0x1b0a3a[_0x29d9('0xd')],'transferercontext':_0x1b0a3a['secondtransferercontext'],'transfererexten':_0x1b0a3a[_0x29d9('0xe')],'transfererlinkedid':_0x1b0a3a[_0x29d9('0xf')],'context':_0x1b0a3a[_0x29d9('0x10')],'extension':_0x1b0a3a[_0x29d9('0x11')],'type':_0x29d9('0x12')});if(_['isNil'](_0x1b0a3a[_0x29d9('0x13')])){_0x1b0a3a=_[_0x29d9('0x9')](_0x1b0a3a,{'transfereechannel':_0x1b0a3a[_0x29d9('0x14')],'transfereecalleridnum':_0x1b0a3a[_0x29d9('0x15')],'transfereecalleridname':_0x1b0a3a[_0x29d9('0x16')],'transfereeconnectedlinenum':_0x1b0a3a[_0x29d9('0x17')],'transfereeconnectedlinename':_0x1b0a3a[_0x29d9('0x18')],'transfereeaccountcode':_0x1b0a3a['transfertargetaccountcode'],'transfereecontext':_0x1b0a3a['transfertargetcontext'],'transfereeexten':_0x1b0a3a['transfertargetexten'],'transfereelinkedid':_0x1b0a3a[_0x29d9('0x19')]});}writeDB(_0x1b0a3a);}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 6194e35..1b634b1 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 _0x9099=['getVoiceQueueByName','acw','acwTimeout','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','http','../../config/logger','xdr','info','debug','stringify','error','request','then','stack','internal','name','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','catch','getUserByName'];(function(_0x46e997,_0x9558a1){var _0xa9c0a7=function(_0x192e51){while(--_0x192e51){_0x46e997['push'](_0x46e997['shift']());}};_0xa9c0a7(++_0x9558a1);}(_0x9099,0x177));var _0x9909=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0x9099[_0x3005d5];return _0x547c7e;};'use strict';var jayson=require('jayson/promise');var moment=require('moment');var BPromise=require(_0x9909('0x0'));var client=jayson['client'][_0x9909('0x1')]({'port':0x2329});var logger=require(_0x9909('0x2'))(_0x9909('0x3'));exports[_0x9909('0x4')]=function(_0x44eac7){logger[_0x9909('0x4')](_0x44eac7);};exports[_0x9909('0x5')]=function(_0x8dfd78){logger[_0x9909('0x5')](JSON[_0x9909('0x6')](_0x8dfd78));};exports['error']=function(_0x261ef6){logger[_0x9909('0x7')](_0x261ef6['stack']);};exports[_0x9909('0x8')]=function(_0x4b780f,_0x1da21){return client[_0x9909('0x8')](_0x4b780f,{'body':_0x1da21})[_0x9909('0x9')](function(_0x92aa91){logger[_0x9909('0x5')](JSON[_0x9909('0x6')](_0x92aa91));})['catch'](function(_0x5635f6){logger[_0x9909('0x7')](_0x5635f6[_0x9909('0xa')]);});};function getUser(_0x11f5d2){return client[_0x9909('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x9909('0xb'),_0x9909('0xc'),'interface'],'where':_0x11f5d2,'limit':0x1}})[_0x9909('0x9')](function(_0x22aa5e){logger[_0x9909('0x4')]('GETUSER|'+JSON[_0x9909('0x6')](_0x11f5d2)+'|'+(_0x22aa5e[_0x9909('0xd')][_0x9909('0xe')]?_0x9909('0xf'):_0x9909('0x10')));return _0x22aa5e[_0x9909('0xd')][_0x9909('0xe')]?_0x22aa5e[_0x9909('0xd')][0x0]:null;});}exports[_0x9909('0x11')]=function(_0x23b50c){return new BPromise(function(_0x1147f7,_0x19ebde){if(_0x23b50c){return getUser({'internal':_0x23b50c})[_0x9909('0x9')](function(_0x35a1fe){return _0x1147f7(_0x35a1fe);})['catch'](function(_0x3196a6){logger[_0x9909('0x7')](_0x3196a6[_0x9909('0xa')]);return _0x1147f7(null);});}else{return _0x1147f7(null);}});};exports[_0x9909('0x12')]=function(_0x248731){return new BPromise(function(_0x4fcb51,_0x50f610){if(_0x248731){return getUser({'interface':_0x248731})[_0x9909('0x9')](function(_0x34d809){return _0x4fcb51(_0x34d809);})[_0x9909('0x13')](function(_0x1a007b){logger['error'](_0x1a007b['stack']);return _0x4fcb51(null);});}else{return _0x4fcb51(null);}});};exports[_0x9909('0x14')]=function(_0x5c0eeb){return new BPromise(function(_0x47962e,_0x526b6c){if(_0x5c0eeb){return getUser({'name':_0x5c0eeb})[_0x9909('0x9')](function(_0x1fc191){return _0x47962e(_0x1fc191);})[_0x9909('0x13')](function(_0x279524){logger[_0x9909('0x7')](_0x279524[_0x9909('0xa')]);return _0x47962e(null);});}else{return _0x47962e(null);}});};exports[_0x9909('0x15')]=function(_0x5d63d1){return new BPromise(function(_0xdb34e6,_0x3d2627){if(_0x5d63d1){return client[_0x9909('0x8')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name','type',_0x9909('0x16'),_0x9909('0x17')],'where':{'name':_0x5d63d1},'limit':0x1}})[_0x9909('0x9')](function(_0xdc43e5){logger[_0x9909('0x4')]('GETVOICEQUEUEBYNAME|'+_0x5d63d1+'|'+(_0xdc43e5[_0x9909('0xd')][_0x9909('0xe')]?_0x9909('0xf'):_0x9909('0x10')));return _0xdb34e6(_0xdc43e5[_0x9909('0xd')]['length']?_0xdc43e5[_0x9909('0xd')][0x0]:null);})['catch'](function(_0x148fee){logger['error'](_0x148fee['stack']);return _0xdb34e6(null);});}else{return _0xdb34e6(null);}});};exports[_0x9909('0x18')]=function(_0x1bc8c1,_0x5af159){return moment(_0x1bc8c1)[_0x9909('0x19')](_0x5af159,_0x9909('0x1a'))[_0x9909('0x1b')](_0x9909('0x1c'));};exports['subtractTime']=function(_0x57d86c,_0x1430a1){return moment(_0x57d86c)[_0x9909('0x1d')](_0x1430a1,_0x9909('0x1a'))[_0x9909('0x1b')](_0x9909('0x1c'));};exports[_0x9909('0x1e')]=function(_0x11bf79,_0x3eddd7){return moment(_0x11bf79)[_0x9909('0x1f')](moment(_0x3eddd7),'seconds');};exports[_0x9909('0x20')]=function(_0x3a3211,_0x1c74f2){return parseInt(_0x3a3211,0xa)+parseInt(_0x1c74f2,0xa);};exports[_0x9909('0x21')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x23b396,_0x5e15c1){if(_0x5e15c1){return moment(_0x23b396)[_0x9909('0x22')](_0x5e15c1);}else{return!![];}};exports[_0x9909('0x23')]=function(_0x505ae0,_0x484711){if(_0x484711){return moment(_0x505ae0)[_0x9909('0x23')](_0x484711);}else if(_0x505ae0){return!![];}else{return![];}}; \ No newline at end of file +var _0x1620=['isBefore','jayson/promise','moment','bluebird','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','internal','name','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','sumTime','now','isAfter'];(function(_0x3ebf2b,_0x407f42){var _0xe2c15=function(_0x3d5b84){while(--_0x3d5b84){_0x3ebf2b['push'](_0x3ebf2b['shift']());}};_0xe2c15(++_0x407f42);}(_0x1620,0xf7));var _0x0162=function(_0x220384,_0x588909){_0x220384=_0x220384-0x0;var _0x1ba7fc=_0x1620[_0x220384];return _0x1ba7fc;};'use strict';var jayson=require(_0x0162('0x0'));var moment=require(_0x0162('0x1'));var BPromise=require(_0x0162('0x2'));var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x0162('0x3'))(_0x0162('0x4'));exports[_0x0162('0x5')]=function(_0x465550){logger[_0x0162('0x5')](_0x465550);};exports[_0x0162('0x6')]=function(_0x42477f){logger[_0x0162('0x6')](JSON[_0x0162('0x7')](_0x42477f));};exports[_0x0162('0x8')]=function(_0x51900e){logger['error'](_0x51900e[_0x0162('0x9')]);};exports[_0x0162('0xa')]=function(_0x314765,_0x30a410){return client[_0x0162('0xa')](_0x314765,{'body':_0x30a410})[_0x0162('0xb')](function(_0x1e9408){logger['debug'](JSON[_0x0162('0x7')](_0x1e9408));})[_0x0162('0xc')](function(_0x13c212){logger[_0x0162('0x8')](_0x13c212[_0x0162('0x9')]);});};function getUser(_0x57809a){return client[_0x0162('0xa')](_0x0162('0xd'),{'options':{'raw':!![],'attributes':['id',_0x0162('0xe'),_0x0162('0xf'),'interface'],'where':_0x57809a,'limit':0x1}})[_0x0162('0xb')](function(_0x47d5d9){logger['info']('GETUSER|'+JSON[_0x0162('0x7')](_0x57809a)+'|'+(_0x47d5d9[_0x0162('0x10')][_0x0162('0x11')]?_0x0162('0x12'):_0x0162('0x13')));return _0x47d5d9[_0x0162('0x10')][_0x0162('0x11')]?_0x47d5d9['result'][0x0]:null;});}exports[_0x0162('0x14')]=function(_0x7a562a){return new BPromise(function(_0x5d03f9,_0x236dc9){if(_0x7a562a){return getUser({'internal':_0x7a562a})[_0x0162('0xb')](function(_0x123853){return _0x5d03f9(_0x123853);})[_0x0162('0xc')](function(_0x40eca7){logger[_0x0162('0x8')](_0x40eca7[_0x0162('0x9')]);return _0x5d03f9(null);});}else{return _0x5d03f9(null);}});};exports[_0x0162('0x15')]=function(_0x236b21){return new BPromise(function(_0x1dd2df,_0x55b051){if(_0x236b21){return getUser({'interface':_0x236b21})['then'](function(_0x55012d){return _0x1dd2df(_0x55012d);})[_0x0162('0xc')](function(_0x4975d1){logger[_0x0162('0x8')](_0x4975d1[_0x0162('0x9')]);return _0x1dd2df(null);});}else{return _0x1dd2df(null);}});};exports[_0x0162('0x16')]=function(_0x53bb84){return new BPromise(function(_0x5698b8,_0x448e84){if(_0x53bb84){return getUser({'name':_0x53bb84})[_0x0162('0xb')](function(_0x52f852){return _0x5698b8(_0x52f852);})[_0x0162('0xc')](function(_0x417fcc){logger[_0x0162('0x8')](_0x417fcc['stack']);return _0x5698b8(null);});}else{return _0x5698b8(null);}});};exports[_0x0162('0x17')]=function(_0x247e48){return new BPromise(function(_0x44a16b,_0x358f08){if(_0x247e48){return client['request'](_0x0162('0x18'),{'options':{'raw':!![],'attributes':['id',_0x0162('0xf'),_0x0162('0x19'),'acw',_0x0162('0x1a')],'where':{'name':_0x247e48},'limit':0x1}})[_0x0162('0xb')](function(_0xd8e1de){logger['info'](_0x0162('0x1b')+_0x247e48+'|'+(_0xd8e1de[_0x0162('0x10')][_0x0162('0x11')]?_0x0162('0x12'):_0x0162('0x13')));return _0x44a16b(_0xd8e1de[_0x0162('0x10')]['length']?_0xd8e1de[_0x0162('0x10')][0x0]:null);})[_0x0162('0xc')](function(_0x33a463){logger[_0x0162('0x8')](_0x33a463[_0x0162('0x9')]);return _0x44a16b(null);});}else{return _0x44a16b(null);}});};exports[_0x0162('0x1c')]=function(_0xa63995,_0x58a28d){return moment(_0xa63995)[_0x0162('0x1d')](_0x58a28d,_0x0162('0x1e'))['format'](_0x0162('0x1f'));};exports[_0x0162('0x20')]=function(_0x27bae6,_0x620000){return moment(_0x27bae6)[_0x0162('0x21')](_0x620000,_0x0162('0x1e'))[_0x0162('0x22')](_0x0162('0x1f'));};exports[_0x0162('0x23')]=function(_0x4d8d39,_0x502fa5){return moment(_0x4d8d39)[_0x0162('0x24')](moment(_0x502fa5),_0x0162('0x1e'));};exports[_0x0162('0x25')]=function(_0x335a91,_0x306962){return parseInt(_0x335a91,0xa)+parseInt(_0x306962,0xa);};exports[_0x0162('0x26')]=function(){return moment()[_0x0162('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0162('0x27')]=function(_0x3d0156,_0x4de427){if(_0x4de427){return moment(_0x3d0156)[_0x0162('0x27')](_0x4de427);}else{return!![];}};exports['isBefore']=function(_0x64895b,_0x6d2419){if(_0x6d2419){return moment(_0x64895b)[_0x0162('0x28')](_0x6d2419);}else if(_0x64895b){return!![];}else{return![];}}; \ No newline at end of file